From: support Date: Tue, 28 Mar 2023 08:32:21 +0000 (+0000) Subject: Built motion from commit d6d69adf.|2.6.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22avatar.png/%22?a=commitdiff_plain;h=b87a575034fe6ab852b6f61630f54ac63937759a;p=motion2.git Built motion from commit d6d69adf.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 71a49a3..b9e4532 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T15:51:14.173Z", + "time": "2023-03-28T08:22:22.752Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9896e72..041f9c9 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T15:51:14.173Z", + "time": "2023-03-28T08:22:22.752Z", "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 a9e22a9..bd1495d 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 _0x6877=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x758e7f,_0x128061){var _0x1ad1e6=function(_0x1c1e6d){while(--_0x1c1e6d){_0x758e7f['push'](_0x758e7f['shift']());}};_0x1ad1e6(++_0x128061);}(_0x6877,0xb5));var _0x7687=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x6877[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x7687('0x0'));module[_0x7687('0x1')]={'name':{'type':Sequelize[_0x7687('0x2')],'get':function(_0x3e8c55){return this[_0x7687('0x3')](_0x7687('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7687('0x5'),_0x7687('0x6'),_0x7687('0x7'),_0x7687('0x8'),_0x7687('0x9'),_0x7687('0xa'),_0x7687('0xb'),_0x7687('0xc')]],'msg':_0x7687('0xd')}},'comment':_0x7687('0xd')},'data1':{'type':Sequelize[_0x7687('0xe')](0x1000),'comment':_0x7687('0xf')},'data2':{'type':Sequelize[_0x7687('0xe')](0x1000),'comment':_0x7687('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x7687('0x11')},'data5':{'type':Sequelize[_0x7687('0xe')](0x1000),'comments':_0x7687('0x12')},'data6':{'type':Sequelize['STRING'],'comments':_0x7687('0x13')},'data7':{'type':Sequelize[_0x7687('0x14')],'comments':_0x7687('0x15')}}; \ No newline at end of file +var _0xabdb=['jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING','integration','motionbar'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xabdb,0x93));var _0xbabd=function(_0x5ded12,_0xed47a){_0x5ded12=_0x5ded12-0x0;var _0x1c01b0=_0xabdb[_0x5ded12];return _0x1c01b0;};'use strict';var Sequelize=require('sequelize');module[_0xbabd('0x0')]={'name':{'type':Sequelize[_0xbabd('0x1')],'get':function(_0xb14022){return this[_0xbabd('0x2')]('action');}},'action':{'type':Sequelize[_0xbabd('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xbabd('0x4'),_0xbabd('0x5'),_0xbabd('0x6'),'urlForward',_0xbabd('0x7'),'bot',_0xbabd('0x8')]],'msg':_0xbabd('0x9')}},'comment':_0xbabd('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xbabd('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xbabd('0xb')},'data3':{'type':Sequelize[_0xbabd('0x3')](0x1000),'comment':_0xbabd('0xc')},'data4':{'type':Sequelize[_0xbabd('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xbabd('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0xbabd('0xe')},'data7':{'type':Sequelize[_0xbabd('0xf')],'comments':_0xbabd('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 811263a..a27b8bd 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 _0x9322=['limit','undefined','count','set','Content-Range','reject','then','destroy','end','error','stack','name','send','body','Action','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','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','status','json','offset'];(function(_0x1098bf,_0x1adfc5){var _0x1e130a=function(_0x55e577){while(--_0x55e577){_0x1098bf['push'](_0x1098bf['shift']());}};_0x1e130a(++_0x1adfc5);}(_0x9322,0x1c0));var _0x2932=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9322[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x2932('0x0'));var rimraf=require(_0x2932('0x1'));var zipdir=require(_0x2932('0x2'));var jsonpatch=require(_0x2932('0x3'));var rp=require(_0x2932('0x4'));var moment=require(_0x2932('0x5'));var BPromise=require(_0x2932('0x6'));var Mustache=require(_0x2932('0x7'));var util=require('util');var path=require(_0x2932('0x8'));var sox=require(_0x2932('0x9'));var csv=require('to-csv');var ejs=require(_0x2932('0xa'));var fs=require('fs');var fs_extra=require(_0x2932('0xb'));var _=require('lodash');var squel=require(_0x2932('0xc'));var crypto=require('crypto');var jsforce=require(_0x2932('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2932('0xe'));var querystring=require(_0x2932('0xf'));var Papa=require(_0x2932('0x10'));var Redis=require(_0x2932('0x11'));var authService=require(_0x2932('0x12'));var qs=require(_0x2932('0x13'));var as=require(_0x2932('0x14'));var hardwareService=require(_0x2932('0x15'));var logger=require(_0x2932('0x16'))(_0x2932('0x17'));var utils=require(_0x2932('0x18'));var config=require(_0x2932('0x19'));var licenseUtil=require(_0x2932('0x1a'));var db=require(_0x2932('0x1b'))['db'];function respondWithStatusCode(_0x4dda2a,_0x4b233c){_0x4b233c=_0x4b233c||0xcc;return function(_0x407dde){if(_0x407dde){return _0x4dda2a[_0x2932('0x1c')](_0x4b233c);}return _0x4dda2a[_0x2932('0x1d')](_0x4b233c)['end']();};}function respondWithResult(_0x465df5,_0x299b97){_0x299b97=_0x299b97||0xc8;return function(_0x13b5b9){if(_0x13b5b9){return _0x465df5[_0x2932('0x1d')](_0x299b97)[_0x2932('0x1e')](_0x13b5b9);}};}function respondWithFilteredResult(_0xf9cc74,_0xcfc2a1){return function(_0x238a76){if(_0x238a76){var _0x4a1d21=typeof _0xcfc2a1[_0x2932('0x1f')]==='undefined'&&typeof _0xcfc2a1[_0x2932('0x20')]===_0x2932('0x21');var _0x5c89e7=_0x238a76[_0x2932('0x22')];var _0x3f8387=_0x4a1d21?0x0:_0xcfc2a1[_0x2932('0x1f')];var _0x4eb3ee=_0x4a1d21?_0x238a76[_0x2932('0x22')]:_0xcfc2a1['offset']+_0xcfc2a1[_0x2932('0x20')];var _0x2147ee;if(_0x4eb3ee>=_0x5c89e7){_0x4eb3ee=_0x5c89e7;_0x2147ee=0xc8;}else{_0x2147ee=0xce;}_0xf9cc74['status'](_0x2147ee);return _0xf9cc74[_0x2932('0x23')](_0x2932('0x24'),_0x3f8387+'-'+_0x4eb3ee+'/'+_0x5c89e7)[_0x2932('0x1e')](_0x238a76);}return null;};}function patchUpdates(_0x181126){return function(_0x326012){try{jsonpatch['apply'](_0x326012,_0x181126,!![]);}catch(_0x8018a7){return BPromise[_0x2932('0x25')](_0x8018a7);}return _0x326012['save']();};}function saveUpdates(_0x587598,_0x5cf397){return function(_0x3765ea){if(_0x3765ea){return _0x3765ea['update'](_0x587598)[_0x2932('0x26')](function(_0x5df732){return _0x5df732;});}return null;};}function removeEntity(_0x289d68,_0x3deb36){return function(_0x57b872){if(_0x57b872){return _0x57b872[_0x2932('0x27')]()[_0x2932('0x26')](function(){_0x289d68['status'](0xcc)[_0x2932('0x28')]();});}};}function handleEntityNotFound(_0x2e5b52,_0x2d971c){return function(_0x329c7c){if(!_0x329c7c){_0x2e5b52[_0x2932('0x1c')](0x194);}return _0x329c7c;};}function handleError(_0x4e9951,_0x1c4711){_0x1c4711=_0x1c4711||0x1f4;return function(_0x1047b2){logger[_0x2932('0x29')](_0x1047b2[_0x2932('0x2a')]);if(_0x1047b2[_0x2932('0x2b')]){delete _0x1047b2['name'];}_0x4e9951[_0x2932('0x1d')](_0x1c4711)[_0x2932('0x2c')](_0x1047b2);};}exports['update']=function(_0x4efe19,_0x3a1070){if(_0x4efe19[_0x2932('0x2d')]['id']){delete _0x4efe19[_0x2932('0x2d')]['id'];}return db[_0x2932('0x2e')]['find']({'where':{'id':_0x4efe19[_0x2932('0x2f')]['id']}})[_0x2932('0x26')](handleEntityNotFound(_0x3a1070,null))[_0x2932('0x26')](saveUpdates(_0x4efe19[_0x2932('0x2d')],null))[_0x2932('0x26')](respondWithResult(_0x3a1070,null))['catch'](handleError(_0x3a1070,null));};exports[_0x2932('0x27')]=function(_0x4f2767,_0xf50b6f){return db[_0x2932('0x2e')]['find']({'where':{'id':_0x4f2767[_0x2932('0x2f')]['id']}})[_0x2932('0x26')](handleEntityNotFound(_0xf50b6f,null))['then'](removeEntity(_0xf50b6f,null))['catch'](handleError(_0xf50b6f,null));}; \ No newline at end of file +var _0xfae3=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','body','Action','params','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfae3,0xa1));var _0x3fae=function(_0x416f4e,_0x46a4b1){_0x416f4e=_0x416f4e-0x0;var _0x230028=_0xfae3[_0x416f4e];return _0x230028;};'use strict';var emlformat=require(_0x3fae('0x0'));var rimraf=require(_0x3fae('0x1'));var zipdir=require(_0x3fae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fae('0x3'));var moment=require(_0x3fae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3fae('0x5'));var util=require(_0x3fae('0x6'));var path=require('path');var sox=require(_0x3fae('0x7'));var csv=require(_0x3fae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fae('0x9'));var _=require(_0x3fae('0xa'));var squel=require(_0x3fae('0xb'));var crypto=require(_0x3fae('0xc'));var jsforce=require(_0x3fae('0xd'));var deskjs=require(_0x3fae('0xe'));var toCsv=require(_0x3fae('0x8'));var querystring=require('querystring');var Papa=require(_0x3fae('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fae('0x10'));var as=require(_0x3fae('0x11'));var hardwareService=require(_0x3fae('0x12'));var logger=require(_0x3fae('0x13'))(_0x3fae('0x14'));var utils=require(_0x3fae('0x15'));var config=require(_0x3fae('0x16'));var licenseUtil=require(_0x3fae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588541,_0x17c764){_0x17c764=_0x17c764||0xcc;return function(_0x2bef52){if(_0x2bef52){return _0x588541[_0x3fae('0x18')](_0x17c764);}return _0x588541[_0x3fae('0x19')](_0x17c764)[_0x3fae('0x1a')]();};}function respondWithResult(_0x2da9f0,_0x5e055d){_0x5e055d=_0x5e055d||0xc8;return function(_0x222428){if(_0x222428){return _0x2da9f0[_0x3fae('0x19')](_0x5e055d)[_0x3fae('0x1b')](_0x222428);}};}function respondWithFilteredResult(_0x455260,_0x17f28b){return function(_0x3d6322){if(_0x3d6322){var _0x167b6f=typeof _0x17f28b[_0x3fae('0x1c')]===_0x3fae('0x1d')&&typeof _0x17f28b[_0x3fae('0x1e')]==='undefined';var _0x10021d=_0x3d6322[_0x3fae('0x1f')];var _0x401886=_0x167b6f?0x0:_0x17f28b['offset'];var _0x30c016=_0x167b6f?_0x3d6322[_0x3fae('0x1f')]:_0x17f28b[_0x3fae('0x1c')]+_0x17f28b['limit'];var _0x26663d;if(_0x30c016>=_0x10021d){_0x30c016=_0x10021d;_0x26663d=0xc8;}else{_0x26663d=0xce;}_0x455260['status'](_0x26663d);return _0x455260[_0x3fae('0x20')](_0x3fae('0x21'),_0x401886+'-'+_0x30c016+'/'+_0x10021d)[_0x3fae('0x1b')](_0x3d6322);}return null;};}function patchUpdates(_0x4aeb49){return function(_0x34fb1c){try{jsonpatch[_0x3fae('0x22')](_0x34fb1c,_0x4aeb49,!![]);}catch(_0x308e18){return BPromise[_0x3fae('0x23')](_0x308e18);}return _0x34fb1c['save']();};}function saveUpdates(_0x186db1,_0x3efe3e){return function(_0x14c9eb){if(_0x14c9eb){return _0x14c9eb['update'](_0x186db1)[_0x3fae('0x24')](function(_0x12ce06){return _0x12ce06;});}return null;};}function removeEntity(_0x5bb7c5,_0x4effd3){return function(_0x3b4131){if(_0x3b4131){return _0x3b4131[_0x3fae('0x25')]()['then'](function(){_0x5bb7c5[_0x3fae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c62e7,_0x41694a){return function(_0x281dd7){if(!_0x281dd7){_0x3c62e7[_0x3fae('0x18')](0x194);}return _0x281dd7;};}function handleError(_0x54dcdd,_0x5511de){_0x5511de=_0x5511de||0x1f4;return function(_0x241950){logger[_0x3fae('0x26')](_0x241950['stack']);if(_0x241950['name']){delete _0x241950[_0x3fae('0x27')];}_0x54dcdd[_0x3fae('0x19')](_0x5511de)['send'](_0x241950);};}exports['update']=function(_0x35b32a,_0x7e19da){if(_0x35b32a[_0x3fae('0x28')]['id']){delete _0x35b32a[_0x3fae('0x28')]['id'];}return db[_0x3fae('0x29')]['find']({'where':{'id':_0x35b32a[_0x3fae('0x2a')]['id']}})[_0x3fae('0x24')](handleEntityNotFound(_0x7e19da,null))['then'](saveUpdates(_0x35b32a[_0x3fae('0x28')],null))[_0x3fae('0x24')](respondWithResult(_0x7e19da,null))[_0x3fae('0x2b')](handleError(_0x7e19da,null));};exports[_0x3fae('0x25')]=function(_0x129c01,_0x44a4eb){return db['Action'][_0x3fae('0x2c')]({'where':{'id':_0x129c01[_0x3fae('0x2a')]['id']}})['then'](handleEntityNotFound(_0x44a4eb,null))[_0x3fae('0x24')](removeEntity(_0x44a4eb,null))[_0x3fae('0x2b')](handleError(_0x44a4eb,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index dad8473..0e346a2 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 _0x6208=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','util'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x6208,0x192));var _0x8620=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x6208[_0x44c768];return _0x55daf5;};'use strict';var _=require('lodash');var util=require(_0x8620('0x0'));var logger=require(_0x8620('0x1'))(_0x8620('0x2'));var moment=require(_0x8620('0x3'));var BPromise=require(_0x8620('0x4'));var rp=require(_0x8620('0x5'));var fs=require('fs');var path=require(_0x8620('0x6'));var rimraf=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var attributes=require(_0x8620('0x9'));module['exports']=function(_0x1069e7,_0x431cfc){return _0x1069e7[_0x8620('0xa')](_0x8620('0xb'),attributes,{'tableName':_0x8620('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7615=['path','rimraf','./action.attributes','exports','define','Action','lodash','api','bluebird','request-promise'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0x7615,0xec));var _0x5761=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x7615[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x5761('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5761('0x1'));var moment=require('moment');var BPromise=require(_0x5761('0x2'));var rp=require(_0x5761('0x3'));var fs=require('fs');var path=require(_0x5761('0x4'));var rimraf=require(_0x5761('0x5'));var config=require('../../config/environment');var attributes=require(_0x5761('0x6'));module[_0x5761('0x7')]=function(_0x17609e,_0x1e81a2){return _0x17609e[_0x5761('0x8')](_0x5761('0x9'),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 b11187b..950ad33 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x65a7d8,_0x481040){var _0x3207bf=function(_0x199b26){while(--_0x199b26){_0x65a7d8['push'](_0x65a7d8['shift']());}};_0x3207bf(++_0x481040);}(_0xe14b,0x93));var _0xbe14=function(_0x492bf9,_0x3494c9){_0x492bf9=_0x492bf9-0x0;var _0x2df282=_0xe14b[_0x492bf9];return _0x2df282;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x7a54=['info','Action,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x4c571f,_0x520dd9){_0x4c571f=_0x4c571f-0x0;var _0x13c69e=_0x7a54[_0x4c571f];return _0x13c69e;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index b9a6156..e2de447 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 _0xad91=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4c538c,_0x46c4dc){var _0x236796=function(_0x10c34f){while(--_0x10c34f){_0x4c538c['push'](_0x4c538c['shift']());}};_0x236796(++_0x46c4dc);}(_0xad91,0x91));var _0x1ad9=function(_0x593b33,_0x1ea034){_0x593b33=_0x593b33-0x0;var _0x2f17a2=_0xad91[_0x593b33];return _0x2f17a2;};'use strict';var multer=require('multer');var util=require(_0x1ad9('0x0'));var path=require(_0x1ad9('0x1'));var timeout=require(_0x1ad9('0x2'));var express=require(_0x1ad9('0x3'));var router=express[_0x1ad9('0x4')]();var fs_extra=require(_0x1ad9('0x5'));var auth=require(_0x1ad9('0x6'));var interaction=require(_0x1ad9('0x7'));var config=require(_0x1ad9('0x8'));var controller=require(_0x1ad9('0x9'));router[_0x1ad9('0xa')](_0x1ad9('0xb'),auth[_0x1ad9('0xc')](),controller['update']);router['delete'](_0x1ad9('0xb'),auth[_0x1ad9('0xc')](),controller[_0x1ad9('0xd')]);module[_0x1ad9('0xe')]=router; \ No newline at end of file +var _0x3f1a=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./action.controller','put'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f1a,0x104));var _0xa3f1=function(_0x248701,_0x27e401){_0x248701=_0x248701-0x0;var _0x557185=_0x3f1a[_0x248701];return _0x557185;};'use strict';var multer=require(_0xa3f1('0x0'));var util=require(_0xa3f1('0x1'));var path=require(_0xa3f1('0x2'));var timeout=require(_0xa3f1('0x3'));var express=require(_0xa3f1('0x4'));var router=express[_0xa3f1('0x5')]();var fs_extra=require(_0xa3f1('0x6'));var auth=require(_0xa3f1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3f1('0x8'));router[_0xa3f1('0x9')](_0xa3f1('0xa'),auth[_0xa3f1('0xb')](),controller[_0xa3f1('0xc')]);router[_0xa3f1('0xd')](_0xa3f1('0xa'),auth[_0xa3f1('0xb')](),controller[_0xa3f1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c6166d1..762882a 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x340d49,_0x4ee2b4){var _0x2cf1ec=function(_0x12f166){while(--_0x12f166){_0x340d49['push'](_0x340d49['shift']());}};_0x2cf1ec(++_0x4ee2b4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x4b9438,_0x1f41c){var _0x128b3a=function(_0x546826){while(--_0x546826){_0x4b9438['push'](_0x4b9438['shift']());}};_0x128b3a(++_0x1f41c);}(_0xeff8,0x186));var _0x8eff=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xeff8[_0x1780f8];return _0x33a410;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 762a761..470a4a1 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 _0xb39f=['where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','select','replace','DESC','web','fullPath','%s-%s.%s','randomstring','output','csv','AnalyticExtractedReport','cdr','endDate','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','clone','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort'];(function(_0x212f52,_0x8241e8){var _0x3c912f=function(_0x51d5ef){while(--_0x51d5ef){_0x212f52['push'](_0x212f52['shift']());}};_0x3c912f(++_0x8241e8);}(_0xb39f,0x66));var _0xfb39=function(_0xda8baa,_0x52664d){_0xda8baa=_0xda8baa-0x0;var _0x339249=_0xb39f[_0xda8baa];return _0x339249;};'use strict';var emlformat=require(_0xfb39('0x0'));var rimraf=require(_0xfb39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb39('0x2'));var moment=require(_0xfb39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfb39('0x4'));var util=require(_0xfb39('0x5'));var path=require(_0xfb39('0x6'));var sox=require(_0xfb39('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb39('0x8'));var squel=require('squel');var crypto=require(_0xfb39('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfb39('0xa'));var toCsv=require(_0xfb39('0xb'));var querystring=require(_0xfb39('0xc'));var Papa=require(_0xfb39('0xd'));var Redis=require(_0xfb39('0xe'));var authService=require(_0xfb39('0xf'));var qs=require(_0xfb39('0x10'));var as=require(_0xfb39('0x11'));var hardwareService=require(_0xfb39('0x12'));var logger=require(_0xfb39('0x13'))(_0xfb39('0x14'));var utils=require(_0xfb39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb39('0x16'));var db=require(_0xfb39('0x17'))['db'];var dbH=require(_0xfb39('0x17'))[_0xfb39('0x18')];function respondWithStatusCode(_0x16b436,_0x588e7e){_0x588e7e=_0x588e7e||0xcc;return function(_0x14dfdd){if(_0x14dfdd){return _0x16b436['sendStatus'](_0x588e7e);}return _0x16b436[_0xfb39('0x19')](_0x588e7e)[_0xfb39('0x1a')]();};}function respondWithResult(_0x18d7ce,_0x464b35){_0x464b35=_0x464b35||0xc8;return function(_0x29c4fb){if(_0x29c4fb){return _0x18d7ce['status'](_0x464b35)[_0xfb39('0x1b')](_0x29c4fb);}};}function respondWithFilteredResult(_0x58fece,_0xfcc91f){return function(_0x2b08bb){if(_0x2b08bb){var _0x133edf=typeof _0xfcc91f[_0xfb39('0x1c')]===_0xfb39('0x1d')&&typeof _0xfcc91f[_0xfb39('0x1e')]===_0xfb39('0x1d');var _0x57edbc=_0x2b08bb[_0xfb39('0x1f')];var _0x8c28b=_0x133edf?0x0:_0xfcc91f[_0xfb39('0x1c')];var _0x12465b=_0x133edf?_0x2b08bb[_0xfb39('0x1f')]:_0xfcc91f['offset']+_0xfcc91f['limit'];var _0xfc03ea;if(_0x12465b>=_0x57edbc){_0x12465b=_0x57edbc;_0xfc03ea=0xc8;}else{_0xfc03ea=0xce;}_0x58fece[_0xfb39('0x19')](_0xfc03ea);return _0x58fece[_0xfb39('0x20')](_0xfb39('0x21'),_0x8c28b+'-'+_0x12465b+'/'+_0x57edbc)['json'](_0x2b08bb);}return null;};}function patchUpdates(_0x7e837e){return function(_0x99239b){try{jsonpatch[_0xfb39('0x22')](_0x99239b,_0x7e837e,!![]);}catch(_0x1bac02){return BPromise['reject'](_0x1bac02);}return _0x99239b['save']();};}function saveUpdates(_0x3d59a2,_0x4451f5){return function(_0x29f1ea){if(_0x29f1ea){return _0x29f1ea[_0xfb39('0x23')](_0x3d59a2)[_0xfb39('0x24')](function(_0x2a276e){return _0x2a276e;});}return null;};}function removeEntity(_0x1e1d7f,_0x235449){return function(_0x6551af){if(_0x6551af){return _0x6551af[_0xfb39('0x25')]()[_0xfb39('0x24')](function(){var _0x44e515=_0x6551af[_0xfb39('0x26')]({'plain':!![]});var _0x8bce2d='CustomReports';return db[_0xfb39('0x27')][_0xfb39('0x25')]({'where':{'type':_0x8bce2d,'resourceId':_0x44e515['id']}})[_0xfb39('0x24')](function(){return _0x6551af;});})[_0xfb39('0x24')](function(){_0x1e1d7f[_0xfb39('0x19')](0xcc)[_0xfb39('0x1a')]();});}};}function handleEntityNotFound(_0x460e00,_0x2f6879){return function(_0x549911){if(!_0x549911){_0x460e00[_0xfb39('0x28')](0x194);}return _0x549911;};}function handleError(_0x1b95d3,_0x42d220){_0x42d220=_0x42d220||0x1f4;return function(_0x520ebf){logger[_0xfb39('0x29')](_0x520ebf[_0xfb39('0x2a')]);if(_0x520ebf[_0xfb39('0x2b')]){delete _0x520ebf[_0xfb39('0x2b')];}_0x1b95d3['status'](_0x42d220)[_0xfb39('0x2c')](_0x520ebf);};}exports[_0xfb39('0x2d')]=function(_0x3804a6,_0x1eb1b3){var _0x1fd532={},_0x51a9f4={},_0x811993={'count':0x0,'rows':[]};var _0x1fd560=_[_0xfb39('0x2e')](db[_0xfb39('0x2f')]['rawAttributes'],function(_0x4c2ab5){return{'name':_0x4c2ab5[_0xfb39('0x30')],'type':_0x4c2ab5[_0xfb39('0x31')][_0xfb39('0x32')]};});_0x51a9f4[_0xfb39('0x33')]=_[_0xfb39('0x2e')](_0x1fd560,_0xfb39('0x2b'));_0x51a9f4['query']=_[_0xfb39('0x34')](_0x3804a6[_0xfb39('0x35')]);_0x51a9f4[_0xfb39('0x36')]=_[_0xfb39('0x37')](_0x51a9f4['model'],_0x51a9f4[_0xfb39('0x35')]);_0x1fd532[_0xfb39('0x38')]=_[_0xfb39('0x37')](_0x51a9f4[_0xfb39('0x33')],qs[_0xfb39('0x39')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x39')]));_0x1fd532[_0xfb39('0x38')]=_0x1fd532[_0xfb39('0x38')]['length']?_0x1fd532[_0xfb39('0x38')]:_0x51a9f4[_0xfb39('0x33')];if(!_0x3804a6['query']['hasOwnProperty']('nolimit')){_0x1fd532[_0xfb39('0x1e')]=qs[_0xfb39('0x1e')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x1e')]);_0x1fd532[_0xfb39('0x1c')]=qs[_0xfb39('0x1c')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x1c')]);}_0x1fd532[_0xfb39('0x3a')]=qs[_0xfb39('0x3b')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x3b')]);_0x1fd532[_0xfb39('0x3c')]=qs[_0xfb39('0x36')](_[_0xfb39('0x3d')](_0x3804a6['query'],_0x51a9f4['filters']),_0x1fd560);if(_0x3804a6[_0xfb39('0x35')][_0xfb39('0x3e')]){_0x1fd532[_0xfb39('0x3c')]=_['merge'](_0x1fd532[_0xfb39('0x3c')],{'$or':_[_0xfb39('0x2e')](_0x1fd560,function(_0x5bebf0){if(_0x5bebf0[_0xfb39('0x31')]!==_0xfb39('0x3f')){var _0x449525={};_0x449525[_0x5bebf0[_0xfb39('0x2b')]]={'$like':'%'+_0x3804a6['query'][_0xfb39('0x3e')]+'%'};return _0x449525;}})});}_0x1fd532=_[_0xfb39('0x40')]({},_0x1fd532,_0x3804a6[_0xfb39('0x41')]);var _0x5abc5a={'where':_0x1fd532[_0xfb39('0x3c')]};return db[_0xfb39('0x2f')][_0xfb39('0x1f')](_0x5abc5a)[_0xfb39('0x24')](function(_0x428bfc){_0x811993['count']=_0x428bfc;if(_0x3804a6[_0xfb39('0x35')]['includeAll']){_0x1fd532[_0xfb39('0x42')]=[{'all':!![]}];}return db[_0xfb39('0x2f')][_0xfb39('0x43')](_0x1fd532);})['then'](function(_0x369964){_0x811993[_0xfb39('0x44')]=_0x369964;return _0x811993;})[_0xfb39('0x24')](respondWithFilteredResult(_0x1eb1b3,_0x1fd532))['catch'](handleError(_0x1eb1b3,null));};exports[_0xfb39('0x45')]=function(_0x48d612,_0x1a1271){var _0x5f56ea={'raw':![],'where':{'id':_0x48d612[_0xfb39('0x46')]['id']}},_0x54125e={};_0x54125e['model']=_[_0xfb39('0x34')](db[_0xfb39('0x2f')][_0xfb39('0x47')]);_0x54125e[_0xfb39('0x35')]=_[_0xfb39('0x34')](_0x48d612[_0xfb39('0x35')]);_0x54125e[_0xfb39('0x36')]=_[_0xfb39('0x37')](_0x54125e['model'],_0x54125e['query']);_0x5f56ea[_0xfb39('0x38')]=_[_0xfb39('0x37')](_0x54125e[_0xfb39('0x33')],qs[_0xfb39('0x39')](_0x48d612[_0xfb39('0x35')][_0xfb39('0x39')]));_0x5f56ea[_0xfb39('0x38')]=_0x5f56ea[_0xfb39('0x38')][_0xfb39('0x48')]?_0x5f56ea[_0xfb39('0x38')]:_0x54125e[_0xfb39('0x33')];if(_0x48d612[_0xfb39('0x35')][_0xfb39('0x49')]){_0x5f56ea[_0xfb39('0x42')]=[{'all':!![]}];}_0x5f56ea=_[_0xfb39('0x40')]({},_0x5f56ea,_0x48d612[_0xfb39('0x41')]);return db[_0xfb39('0x2f')][_0xfb39('0x4a')](_0x5f56ea)['then'](handleEntityNotFound(_0x1a1271,null))['then'](respondWithResult(_0x1a1271,null))['catch'](handleError(_0x1a1271,null));};exports[_0xfb39('0x4b')]=function(_0x91671f,_0x32e869){return db[_0xfb39('0x2f')][_0xfb39('0x4b')](_0x91671f[_0xfb39('0x4c')],{})[_0xfb39('0x24')](function(_0x11ca18){var _0x373c3e=_0x91671f[_0xfb39('0x4d')]['get']({'plain':!![]});if(!_0x373c3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x373c3e['role']===_0xfb39('0x4d')){var _0x17cf88=_0x11ca18[_0xfb39('0x26')]({'plain':!![]});var _0xd6d6e7=_0xfb39('0x4e');return db[_0xfb39('0x4f')][_0xfb39('0x4a')]({'where':{'name':_0xd6d6e7,'userProfileId':_0x373c3e[_0xfb39('0x50')]},'raw':!![]})[_0xfb39('0x24')](function(_0xab2cf2){if(_0xab2cf2&&_0xab2cf2[_0xfb39('0x51')]===0x0){return db[_0xfb39('0x27')][_0xfb39('0x4b')]({'name':_0x17cf88[_0xfb39('0x2b')],'resourceId':_0x17cf88['id'],'type':'CustomReports','sectionId':_0xab2cf2['id']},{})[_0xfb39('0x24')](function(){return _0x11ca18;});}else{return _0x11ca18;}})[_0xfb39('0x52')](function(_0x37fb70){logger[_0xfb39('0x29')](_0xfb39('0x53'),_0x37fb70);throw _0x37fb70;});}return _0x11ca18;})[_0xfb39('0x24')](respondWithResult(_0x32e869,0xc9))['catch'](handleError(_0x32e869,null));};exports[_0xfb39('0x23')]=function(_0x1bd26f,_0x308f6e){if(_0x1bd26f[_0xfb39('0x4c')]['id']){delete _0x1bd26f[_0xfb39('0x4c')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x1bd26f[_0xfb39('0x46')]['id']}})[_0xfb39('0x24')](handleEntityNotFound(_0x308f6e,null))[_0xfb39('0x24')](saveUpdates(_0x1bd26f['body'],null))['then'](respondWithResult(_0x308f6e,null))[_0xfb39('0x52')](handleError(_0x308f6e,null));};exports['destroy']=function(_0x31bb04,_0x1f0123){return db['AnalyticCustomReport'][_0xfb39('0x4a')]({'where':{'id':_0x31bb04['params']['id']}})['then'](handleEntityNotFound(_0x1f0123,null))[_0xfb39('0x24')](removeEntity(_0x1f0123,null))[_0xfb39('0x52')](handleError(_0x1f0123,null));};exports['preview']=function(_0x54292e,_0x307517){var _0x34ef1a=0xa;var _0xfc6653=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),_0xfb39('0x57')];var _0x2dfb1c={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfb39('0x59'),'MAX':_0xfb39('0x5a'),'MIN':_0xfb39('0x5b'),'AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':_0xfb39('0x5e'),'GROUP_CONCAT DESC':_0xfb39('0x5f')};var _0x2c57cd={'SEC_TO_TIME':_0xfb39('0x60'),'DATE':_0xfb39('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ba86a=function(_0x48fcad){return!_[_0xfb39('0x63')](['IS\x20NULL',_0xfb39('0x64'),_0xfb39('0x65'),_0xfb39('0x66')],_0x48fcad);};var _0xb97dbd=function(_0x5b12ae){if(!_0x5b12ae||!_0x5b12ae[_0xfb39('0x67')][_0xfb39('0x48')]){return'';}for(var _0x4297a7='(',_0x28eadd=0x0;_0x28eadd<_0x5b12ae[_0xfb39('0x67')]['length'];_0x28eadd+=0x1){_0x28eadd>0x0&&(_0x4297a7+='\x20'+_0x5b12ae[_0xfb39('0x68')]+'\x20');_0x4297a7+=_0x5b12ae['rules'][_0x28eadd][_0xfb39('0x69')]?_0xb97dbd(_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x69')]):_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x6a')]+'\x20'+_0x5b12ae[_0xfb39('0x67')][_0x28eadd]['condition']+(_0x3ba86a(_0x5b12ae['rules'][_0x28eadd][_0xfb39('0x6b')])?'\x20'+_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x6c')]:'');}return _0x4297a7+')';};var _0xf1f612={'where':{'id':_0x54292e[_0xfb39('0x46')]['id']}},_0x529851,_0x534b80,_0x4ff81e,_0x3d4539,_0x6fec66;_0xf1f612=_['merge']({},_0xf1f612,_0x54292e[_0xfb39('0x41')]);return db[_0xfb39('0x2f')]['find'](_0xf1f612)[_0xfb39('0x24')](function(_0x400c54){if(_0x400c54){_0x529851=_0x400c54;return _0x400c54[_0xfb39('0x6d')]();}return null;})[_0xfb39('0x24')](function(_0x226193){if(_0x226193){if(!_0x226193['length']){throw new db['Sequelize'][(_0xfb39('0x6e'))](_0xfb39('0x6f'),0x193);}_0x534b80=_0x226193;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5eee12){if(_0x5eee12){_0x4ff81e=_[_0xfb39('0x71')](_0x5eee12,'id');var _0x1c2296;var _0x584065=squel['select']();_0x584065[_0xfb39('0x72')](_0x529851[_0xfb39('0x73')]);for(var _0x56a9f8=0x0;_0x56a9f8<_0x534b80[_0xfb39('0x48')];_0x56a9f8+=0x1){_0x1c2296=_0x534b80[_0x56a9f8][_0xfb39('0x74')]?_0x4ff81e[_0x534b80[_0x56a9f8][_0xfb39('0x74')]][_0xfb39('0x75')]:_0x534b80[_0x56a9f8][_0xfb39('0x6a')];_0x1c2296=_0x534b80[_0x56a9f8][_0xfb39('0x76')]?_['replace'](_0x2dfb1c[_0x534b80[_0x56a9f8]['function']],'%s',_0x1c2296):_0x1c2296;_0x1c2296=_0x534b80[_0x56a9f8]['format']?_['replace'](_0x2c57cd[_0x534b80[_0x56a9f8][_0xfb39('0x77')]],'%s',_0x1c2296):_0x1c2296;if(_0x534b80[_0x56a9f8][_0xfb39('0x78')]){_0x584065['group'](_0x1c2296);}_0x534b80[_0x56a9f8][_0xfb39('0x79')]&&_0x584065['order'](_0x1c2296,_0x534b80[_0x56a9f8][_0xfb39('0x79')]==='DESC'?![]:!![]);_0x584065[_0xfb39('0x6a')](_0x1c2296,_0x534b80[_0x56a9f8][_0xfb39('0x7a')]||_0x1c2296);}if(_0x529851[_0xfb39('0x7b')]){_0x529851[_0xfb39('0x7b')]=JSON[_0xfb39('0x7c')](_0x529851[_0xfb39('0x7b')]);for(var _0x55f2dc=0x0;_0x55f2dc<_0x529851[_0xfb39('0x7b')][_0xfb39('0x48')];_0x55f2dc+=0x1){if(_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')]&&_[_0xfb39('0x63')](_0xfc6653,_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')])&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7d')]&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')]&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7f')]){_0x584065[_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')]](_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x529851['table'],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7d')],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7f')]));}}}if(_0x529851[_0xfb39('0x80')]){_0x529851[_0xfb39('0x80')]=JSON['parse'](_0x529851[_0xfb39('0x80')]);_0x584065[_0xfb39('0x3c')](_0xb97dbd(_0x529851[_0xfb39('0x80')][_0xfb39('0x69')]));}_0x6fec66=_0x584065['clone']();_0x584065[_0xfb39('0x1e')](_0x34ef1a);_0x584065[_0xfb39('0x1c')](0x0);logger[_0xfb39('0x81')](_0xfb39('0x82'),_0x584065[_0xfb39('0x83')]());return dbH[_0xfb39('0x84')][_0xfb39('0x35')](_0x584065[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')][_0xfb39('0x86')]});}})[_0xfb39('0x24')](respondWithResult(_0x307517,null))[_0xfb39('0x52')](handleError(_0x307517,null));};function runReport(_0x221165,_0x315f88,_0x1750ad){var _0x359995=_0x315f88[_0xfb39('0x2b')];var _0x3c08ea=0xa;var _0x1e0837=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),_0xfb39('0x57')];var _0x3753c6={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfb39('0x5a'),'MIN':'MIN(%s)','AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':_0xfb39('0x5e'),'GROUP_CONCAT DESC':_0xfb39('0x5f')};var _0x3b0251={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfb39('0x61'),'HOUR':_0xfb39('0x87'),'ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':_0xfb39('0x88')};var _0x2b9c0d=function(_0x339177){return!_[_0xfb39('0x63')]([_0xfb39('0x89'),'IS\x20NOT\x20NULL',_0xfb39('0x65'),_0xfb39('0x66')],_0x339177);};var _0xf26627=function(_0x590718){if(!_0x590718||!_0x590718['rules'][_0xfb39('0x48')]){return'';}for(var _0x1d6cf7='(',_0x31006d=0x0;_0x31006d<_0x590718['rules'][_0xfb39('0x48')];_0x31006d+=0x1){_0x31006d>0x0&&(_0x1d6cf7+='\x20'+_0x590718[_0xfb39('0x68')]+'\x20');_0x1d6cf7+=_0x590718[_0xfb39('0x67')][_0x31006d]['group']?_0xf26627(_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x69')]):_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x6a')]+'\x20'+_0x590718[_0xfb39('0x67')][_0x31006d]['condition']+(_0x2b9c0d(_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x6b')])?'\x20'+_0x590718['rules'][_0x31006d]['value']:'');}return _0x1d6cf7+')';};var _0x11f252={'where':{'id':_0x221165['id']}},_0x2e01c7,_0x2198f4,_0x57e81d,_0x451418,_0xce83ac;_0x11f252=_[_0xfb39('0x40')]({},_0x11f252,_0x1750ad);return db[_0xfb39('0x2f')][_0xfb39('0x4a')](_0x11f252)['then'](function(_0x26f1da){if(_0x26f1da){_0x2e01c7=_0x26f1da;return _0x26f1da[_0xfb39('0x6d')]();}return null;})[_0xfb39('0x24')](function(_0x345bc5){if(_0x345bc5){if(!_0x345bc5[_0xfb39('0x48')]){throw new db['Sequelize'][(_0xfb39('0x6e'))](_0xfb39('0x6f'),0x193);}_0x2198f4=_0x345bc5;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})[_0xfb39('0x24')](function(_0x3e2d5e){if(_0x3e2d5e){_0x57e81d=_['keyBy'](_0x3e2d5e,'id');var _0x19ce10;var _0x337cac=squel[_0xfb39('0x8a')]();_0x337cac[_0xfb39('0x72')](_0x2e01c7[_0xfb39('0x73')]);for(var _0x53a218=0x0;_0x53a218<_0x2198f4[_0xfb39('0x48')];_0x53a218+=0x1){_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x74')]?_0x57e81d[_0x2198f4[_0x53a218]['MetricId']][_0xfb39('0x75')]:_0x2198f4[_0x53a218][_0xfb39('0x6a')];_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x76')]?_[_0xfb39('0x8b')](_0x3753c6[_0x2198f4[_0x53a218]['function']],'%s',_0x19ce10):_0x19ce10;_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x77')]?_[_0xfb39('0x8b')](_0x3b0251[_0x2198f4[_0x53a218][_0xfb39('0x77')]],'%s',_0x19ce10):_0x19ce10;if(_0x2198f4[_0x53a218][_0xfb39('0x78')]){_0x337cac[_0xfb39('0x69')](_0x19ce10);}_0x2198f4[_0x53a218][_0xfb39('0x79')]&&_0x337cac['order'](_0x19ce10,_0x2198f4[_0x53a218][_0xfb39('0x79')]===_0xfb39('0x8c')?![]:!![]);_0x337cac[_0xfb39('0x6a')](_0x19ce10,_0x2198f4[_0x53a218]['alias']||_0x19ce10);}if(_0x2e01c7[_0xfb39('0x7b')]){_0x2e01c7[_0xfb39('0x7b')]=JSON[_0xfb39('0x7c')](_0x2e01c7[_0xfb39('0x7b')]);for(var _0xa4dbd2=0x0;_0xa4dbd2<_0x2e01c7[_0xfb39('0x7b')][_0xfb39('0x48')];_0xa4dbd2+=0x1){if(_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x31')]&&_[_0xfb39('0x63')](_0x1e0837,_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x31')])&&_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7d')]&&_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7e')]&&_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x7f')]){_0x337cac[_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x31')]](_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7e')],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x2e01c7['table'],_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7d')],_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x7e')],_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7f')]));}}}if(_0x2e01c7['conditions']){_0x2e01c7[_0xfb39('0x80')]=JSON[_0xfb39('0x7c')](_0x2e01c7[_0xfb39('0x80')]);_0x337cac['where'](_0xf26627(_0x2e01c7['conditions'][_0xfb39('0x69')]));}_0xce83ac=_0x337cac['clone']();_0x337cac[_0xfb39('0x1e')](_0x3c08ea);_0x337cac['offset'](0x0);return;}})['then'](function(){if(_0x315f88['output']===_0xfb39('0x8d')){return null;}var _0x533c82=_['merge'](_0x315f88,{'name':_0x315f88[_0xfb39('0x8e')]||_0x315f88['name']||_0x2e01c7[_0xfb39('0x2b')],'basename':_0x359995,'savename':util[_0xfb39('0x77')](_0xfb39('0x8f'),_0x315f88[_0xfb39('0x2b')]||_0x2e01c7[_0xfb39('0x2b')],require(_0xfb39('0x90'))['generate'](0x4),_0x315f88[_0xfb39('0x91')]||_0xfb39('0x92')),'reportId':_0x2e01c7['id'],'reportType':'custom'});return db[_0xfb39('0x93')][_0xfb39('0x4b')](_0x533c82,{'raw':!![]});})[_0xfb39('0x24')](function(_0x12e8d1){if(_0x2e01c7[_0xfb39('0x73')]===_0xfb39('0x94')){_0xce83ac[_0xfb39('0x3c')](_0x2e01c7['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x315f88['startDate'],_0x315f88[_0xfb39('0x95')]);}else{_0xce83ac['where'](_0x2e01c7[_0xfb39('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x315f88[_0xfb39('0x96')],_0x315f88['endDate']);}if(_0x12e8d1){logger[_0xfb39('0x97')](_0xfb39('0x98'),_0xce83ac[_0xfb39('0x83')]());require(_0xfb39('0x99'))['fork'](path[_0xfb39('0x54')](__dirname,_0xfb39('0x9a'),_0x12e8d1[_0xfb39('0x91')]),[_0x12e8d1['id'],_0xce83ac[_0xfb39('0x83')](),path[_0xfb39('0x54')](__dirname,_0xfb39('0x9b'),_0x12e8d1[_0xfb39('0x9c')]),_0x359995]);return _0x12e8d1;}else{var _0x5403e6=squel[_0xfb39('0x8a')]();_0x5403e6[_0xfb39('0x72')]('('+_0xce83ac[_0xfb39('0x83')]()+')',_0xfb39('0x9d'));_0x5403e6[_0xfb39('0x6a')](_0xfb39('0x9e'),_0xfb39('0x1f'));_0xce83ac[_0xfb39('0x1e')](_0x315f88[_0xfb39('0x1e')]||_0x3c08ea);_0xce83ac[_0xfb39('0x1c')](_0x315f88[_0xfb39('0x1c')]||0x0);return dbH['sequelize'][_0xfb39('0x35')](_0x5403e6['toString'](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')][_0xfb39('0x86')]})[_0xfb39('0x24')](function(_0x41972c){if(!_0x41972c[_0xfb39('0x48')]){_0x451418=0x0;}else{_0x451418=_0x41972c[0x0]['count']||0x0;}return dbH[_0xfb39('0x84')]['query'](_0xce83ac[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')]['QueryTypes'][_0xfb39('0x86')]});})[_0xfb39('0x24')](function(_0x283d9d){return{'rows':_0x283d9d||[],'count':_0x451418};});}});}exports[_0xfb39('0x9f')]=function(_0x920abf,_0x15c5f0){return runReport(_0x920abf[_0xfb39('0x46')],_0x920abf[_0xfb39('0x35')],_0x920abf['options'])[_0xfb39('0x24')](respondWithResult(_0x15c5f0,null))[_0xfb39('0x52')](handleError(_0x15c5f0,null));};exports[_0xfb39('0xa0')]=runReport;exports['query']=function(_0xbab3d1,_0x5b8750){var _0x2b7e42=0xa;var _0x18f47a=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),'cross_join'];var _0x3c8928={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfb39('0x5a'),'MIN':_0xfb39('0x5b'),'AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d2280={'SEC_TO_TIME':_0xfb39('0x60'),'DATE':'DATE(%s)','HOUR':_0xfb39('0x87'),'ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':_0xfb39('0x88')};var _0x3c825c=function(_0x15375d){return!_[_0xfb39('0x63')]([_0xfb39('0x89'),_0xfb39('0x64'),_0xfb39('0x65'),_0xfb39('0x66')],_0x15375d);};var _0x2830e6=function(_0x386641){if(!_0x386641||!_0x386641[_0xfb39('0x67')]['length']){return'';}for(var _0x78c6e1='(',_0x241528=0x0;_0x241528<_0x386641[_0xfb39('0x67')][_0xfb39('0x48')];_0x241528+=0x1){_0x241528>0x0&&(_0x78c6e1+='\x20'+_0x386641[_0xfb39('0x68')]+'\x20');_0x78c6e1+=_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x69')]?_0x2830e6(_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x69')]):_0x386641[_0xfb39('0x67')][_0x241528]['field']+'\x20'+_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6b')]+(_0x3c825c(_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6b')])?'\x20'+_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6c')]:'');}return _0x78c6e1+')';};var _0x2dc8ab={'where':{'id':_0xbab3d1[_0xfb39('0x46')]['id']}},_0x33f556,_0x2f11ef,_0x2a78fd,_0x339bfc,_0x5e8e6b;_0x2dc8ab=_[_0xfb39('0x40')]({},_0x2dc8ab,_0xbab3d1[_0xfb39('0x41')]);return db['AnalyticCustomReport'][_0xfb39('0x4a')](_0x2dc8ab)[_0xfb39('0x24')](function(_0x8bc759){if(_0x8bc759){_0x33f556=_0x8bc759;return _0x8bc759[_0xfb39('0x6d')]();}return null;})['then'](function(_0x342298){if(_0x342298){if(!_0x342298['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xfb39('0x6f'),0x193);}_0x2f11ef=_0x342298;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})[_0xfb39('0x24')](function(_0x474f9b){if(_0x474f9b){_0x2a78fd=_['keyBy'](_0x474f9b,'id');var _0x188a0f;var _0x3efef9=squel['select']();_0x3efef9['from'](_0x33f556[_0xfb39('0x73')]);for(var _0x5e4b33=0x0;_0x5e4b33<_0x2f11ef[_0xfb39('0x48')];_0x5e4b33+=0x1){_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x74')]?_0x2a78fd[_0x2f11ef[_0x5e4b33][_0xfb39('0x74')]][_0xfb39('0x75')]:_0x2f11ef[_0x5e4b33][_0xfb39('0x6a')];_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x76')]?_[_0xfb39('0x8b')](_0x3c8928[_0x2f11ef[_0x5e4b33][_0xfb39('0x76')]],'%s',_0x188a0f):_0x188a0f;_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x77')]?_[_0xfb39('0x8b')](_0x1d2280[_0x2f11ef[_0x5e4b33]['format']],'%s',_0x188a0f):_0x188a0f;if(_0x2f11ef[_0x5e4b33][_0xfb39('0x78')]){_0x3efef9['group'](_0x188a0f);}_0x2f11ef[_0x5e4b33][_0xfb39('0x79')]&&_0x3efef9['order'](_0x188a0f,_0x2f11ef[_0x5e4b33][_0xfb39('0x79')]===_0xfb39('0x8c')?![]:!![]);_0x3efef9[_0xfb39('0x6a')](_0x188a0f,_0x2f11ef[_0x5e4b33][_0xfb39('0x7a')]||_0x188a0f);}if(_0x33f556[_0xfb39('0x7b')]){_0x33f556['joins']=JSON[_0xfb39('0x7c')](_0x33f556[_0xfb39('0x7b')]);for(var _0x51eee5=0x0;_0x51eee5<_0x33f556[_0xfb39('0x7b')][_0xfb39('0x48')];_0x51eee5+=0x1){if(_0x33f556[_0xfb39('0x7b')][_0x51eee5]['type']&&_[_0xfb39('0x63')](_0x18f47a,_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x31')])&&_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7d')]&&_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7e')]&&_0x33f556['joins'][_0x51eee5]['foreignKey']){_0x3efef9[_0x33f556['joins'][_0x51eee5][_0xfb39('0x31')]](_0x33f556[_0xfb39('0x7b')][_0x51eee5]['foreignTable'],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x33f556[_0xfb39('0x73')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7d')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7e')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7f')]));}}}if(_0x33f556['conditions']){_0x33f556['conditions']=JSON[_0xfb39('0x7c')](_0x33f556[_0xfb39('0x80')]);_0x3efef9[_0xfb39('0x3c')](_0x2830e6(_0x33f556[_0xfb39('0x80')]['group']));}_0x5e8e6b=_0x3efef9[_0xfb39('0xa1')]();_0x3efef9[_0xfb39('0x1e')](_0x2b7e42);_0x3efef9[_0xfb39('0x1c')](0x0);logger[_0xfb39('0x81')](_0xfb39('0x82'),_0x3efef9[_0xfb39('0x83')]());return dbH[_0xfb39('0x84')]['query'](_0x3efef9[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')]['SELECT']});}})[_0xfb39('0x24')](function(){return{'sql':_0x5e8e6b['toString']()};})['then'](respondWithResult(_0x5b8750,null))['catch'](handleError(_0x5b8750,null));}; \ No newline at end of file +var _0xc0ac=['filters','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(DISTINCT\x20%s)','HOUR(%s)','operator','getFields','Sequelize','keyBy','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','QueryTypes','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','count','status','set','Content-Range','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where'];(function(_0x1cc0b8,_0x3bdfe7){var _0x4b1daf=function(_0x4edc04){while(--_0x4edc04){_0x1cc0b8['push'](_0x1cc0b8['shift']());}};_0x4b1daf(++_0x3bdfe7);}(_0xc0ac,0x65));var _0xcc0a=function(_0x83195f,_0x48c6d6){_0x83195f=_0x83195f-0x0;var _0x409b61=_0xc0ac[_0x83195f];return _0x409b61;};'use strict';var emlformat=require(_0xcc0a('0x0'));var rimraf=require(_0xcc0a('0x1'));var zipdir=require(_0xcc0a('0x2'));var jsonpatch=require(_0xcc0a('0x3'));var rp=require(_0xcc0a('0x4'));var moment=require(_0xcc0a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc0a('0x6'));var path=require('path');var sox=require(_0xcc0a('0x7'));var csv=require('to-csv');var ejs=require(_0xcc0a('0x8'));var fs=require('fs');var fs_extra=require(_0xcc0a('0x9'));var _=require(_0xcc0a('0xa'));var squel=require(_0xcc0a('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc0a('0xc'));var deskjs=require(_0xcc0a('0xd'));var toCsv=require(_0xcc0a('0xe'));var querystring=require('querystring');var Papa=require(_0xcc0a('0xf'));var Redis=require('ioredis');var authService=require(_0xcc0a('0x10'));var qs=require(_0xcc0a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc0a('0x12'));var logger=require(_0xcc0a('0x13'))(_0xcc0a('0x14'));var utils=require(_0xcc0a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcc0a('0x16'));var db=require(_0xcc0a('0x17'))['db'];var dbH=require(_0xcc0a('0x17'))[_0xcc0a('0x18')];function respondWithStatusCode(_0x116e7a,_0x41c1e2){_0x41c1e2=_0x41c1e2||0xcc;return function(_0x2b41db){if(_0x2b41db){return _0x116e7a[_0xcc0a('0x19')](_0x41c1e2);}return _0x116e7a['status'](_0x41c1e2)[_0xcc0a('0x1a')]();};}function respondWithResult(_0x6c390b,_0x3fdb7f){_0x3fdb7f=_0x3fdb7f||0xc8;return function(_0x1238aa){if(_0x1238aa){return _0x6c390b['status'](_0x3fdb7f)[_0xcc0a('0x1b')](_0x1238aa);}};}function respondWithFilteredResult(_0x4cc3d6,_0x302bd2){return function(_0x5d60c1){if(_0x5d60c1){var _0x421f02=typeof _0x302bd2[_0xcc0a('0x1c')]==='undefined'&&typeof _0x302bd2['limit']==='undefined';var _0x4230ee=_0x5d60c1[_0xcc0a('0x1d')];var _0x27433e=_0x421f02?0x0:_0x302bd2[_0xcc0a('0x1c')];var _0x33befe=_0x421f02?_0x5d60c1[_0xcc0a('0x1d')]:_0x302bd2[_0xcc0a('0x1c')]+_0x302bd2['limit'];var _0x39b122;if(_0x33befe>=_0x4230ee){_0x33befe=_0x4230ee;_0x39b122=0xc8;}else{_0x39b122=0xce;}_0x4cc3d6[_0xcc0a('0x1e')](_0x39b122);return _0x4cc3d6[_0xcc0a('0x1f')](_0xcc0a('0x20'),_0x27433e+'-'+_0x33befe+'/'+_0x4230ee)[_0xcc0a('0x1b')](_0x5d60c1);}return null;};}function patchUpdates(_0x561a6a){return function(_0x250b3b){try{jsonpatch['apply'](_0x250b3b,_0x561a6a,!![]);}catch(_0x465aa5){return BPromise['reject'](_0x465aa5);}return _0x250b3b[_0xcc0a('0x21')]();};}function saveUpdates(_0x233ea8,_0x7a16ca){return function(_0x3cdaf4){if(_0x3cdaf4){return _0x3cdaf4[_0xcc0a('0x22')](_0x233ea8)[_0xcc0a('0x23')](function(_0x2633c1){return _0x2633c1;});}return null;};}function removeEntity(_0x290579,_0x328b53){return function(_0x304791){if(_0x304791){return _0x304791[_0xcc0a('0x24')]()[_0xcc0a('0x23')](function(){var _0x29843d=_0x304791[_0xcc0a('0x25')]({'plain':!![]});var _0x16969f=_0xcc0a('0x26');return db[_0xcc0a('0x27')][_0xcc0a('0x24')]({'where':{'type':_0x16969f,'resourceId':_0x29843d['id']}})[_0xcc0a('0x23')](function(){return _0x304791;});})['then'](function(){_0x290579[_0xcc0a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec74f,_0x2e51b1){return function(_0x4f5728){if(!_0x4f5728){_0x5ec74f[_0xcc0a('0x19')](0x194);}return _0x4f5728;};}function handleError(_0x43f4a7,_0x52d3dd){_0x52d3dd=_0x52d3dd||0x1f4;return function(_0x56046a){logger['error'](_0x56046a[_0xcc0a('0x28')]);if(_0x56046a[_0xcc0a('0x29')]){delete _0x56046a[_0xcc0a('0x29')];}_0x43f4a7[_0xcc0a('0x1e')](_0x52d3dd)[_0xcc0a('0x2a')](_0x56046a);};}exports[_0xcc0a('0x2b')]=function(_0x335782,_0x42c098){var _0x3ce04c={},_0x55a0c8={},_0x33f3b8={'count':0x0,'rows':[]};var _0xe504c1=_['map'](db[_0xcc0a('0x2c')][_0xcc0a('0x2d')],function(_0x424bcf){return{'name':_0x424bcf[_0xcc0a('0x2e')],'type':_0x424bcf['type'][_0xcc0a('0x2f')]};});_0x55a0c8['model']=_['map'](_0xe504c1,_0xcc0a('0x29'));_0x55a0c8['query']=_[_0xcc0a('0x30')](_0x335782[_0xcc0a('0x31')]);_0x55a0c8['filters']=_[_0xcc0a('0x32')](_0x55a0c8[_0xcc0a('0x33')],_0x55a0c8[_0xcc0a('0x31')]);_0x3ce04c[_0xcc0a('0x34')]=_[_0xcc0a('0x32')](_0x55a0c8[_0xcc0a('0x33')],qs[_0xcc0a('0x35')](_0x335782[_0xcc0a('0x31')][_0xcc0a('0x35')]));_0x3ce04c[_0xcc0a('0x34')]=_0x3ce04c[_0xcc0a('0x34')][_0xcc0a('0x36')]?_0x3ce04c['attributes']:_0x55a0c8[_0xcc0a('0x33')];if(!_0x335782[_0xcc0a('0x31')][_0xcc0a('0x37')]('nolimit')){_0x3ce04c['limit']=qs['limit'](_0x335782['query'][_0xcc0a('0x38')]);_0x3ce04c[_0xcc0a('0x1c')]=qs['offset'](_0x335782['query'][_0xcc0a('0x1c')]);}_0x3ce04c[_0xcc0a('0x39')]=qs[_0xcc0a('0x3a')](_0x335782['query'][_0xcc0a('0x3a')]);_0x3ce04c[_0xcc0a('0x3b')]=qs[_0xcc0a('0x3c')](_[_0xcc0a('0x3d')](_0x335782['query'],_0x55a0c8[_0xcc0a('0x3c')]),_0xe504c1);if(_0x335782['query'][_0xcc0a('0x3e')]){_0x3ce04c['where']=_[_0xcc0a('0x3f')](_0x3ce04c['where'],{'$or':_[_0xcc0a('0x40')](_0xe504c1,function(_0x9ddea7){if(_0x9ddea7[_0xcc0a('0x41')]!==_0xcc0a('0x42')){var _0x43e705={};_0x43e705[_0x9ddea7[_0xcc0a('0x29')]]={'$like':'%'+_0x335782['query'][_0xcc0a('0x3e')]+'%'};return _0x43e705;}})});}_0x3ce04c=_['merge']({},_0x3ce04c,_0x335782[_0xcc0a('0x43')]);var _0xb9ea9={'where':_0x3ce04c[_0xcc0a('0x3b')]};return db[_0xcc0a('0x2c')][_0xcc0a('0x1d')](_0xb9ea9)[_0xcc0a('0x23')](function(_0x31f637){_0x33f3b8[_0xcc0a('0x1d')]=_0x31f637;if(_0x335782[_0xcc0a('0x31')]['includeAll']){_0x3ce04c['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xcc0a('0x44')](_0x3ce04c);})[_0xcc0a('0x23')](function(_0x5687e4){_0x33f3b8[_0xcc0a('0x45')]=_0x5687e4;return _0x33f3b8;})[_0xcc0a('0x23')](respondWithFilteredResult(_0x42c098,_0x3ce04c))['catch'](handleError(_0x42c098,null));};exports[_0xcc0a('0x46')]=function(_0x2a6e2d,_0xb1eef1){var _0x32873c={'raw':![],'where':{'id':_0x2a6e2d[_0xcc0a('0x47')]['id']}},_0x38d28b={};_0x38d28b[_0xcc0a('0x33')]=_['keys'](db['AnalyticCustomReport'][_0xcc0a('0x2d')]);_0x38d28b[_0xcc0a('0x31')]=_[_0xcc0a('0x30')](_0x2a6e2d['query']);_0x38d28b[_0xcc0a('0x3c')]=_[_0xcc0a('0x32')](_0x38d28b[_0xcc0a('0x33')],_0x38d28b['query']);_0x32873c[_0xcc0a('0x34')]=_[_0xcc0a('0x32')](_0x38d28b['model'],qs['fields'](_0x2a6e2d[_0xcc0a('0x31')][_0xcc0a('0x35')]));_0x32873c[_0xcc0a('0x34')]=_0x32873c[_0xcc0a('0x34')][_0xcc0a('0x36')]?_0x32873c['attributes']:_0x38d28b[_0xcc0a('0x33')];if(_0x2a6e2d[_0xcc0a('0x31')][_0xcc0a('0x48')]){_0x32873c[_0xcc0a('0x49')]=[{'all':!![]}];}_0x32873c=_[_0xcc0a('0x3f')]({},_0x32873c,_0x2a6e2d[_0xcc0a('0x43')]);return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')](_0x32873c)['then'](handleEntityNotFound(_0xb1eef1,null))[_0xcc0a('0x23')](respondWithResult(_0xb1eef1,null))[_0xcc0a('0x4b')](handleError(_0xb1eef1,null));};exports[_0xcc0a('0x4c')]=function(_0x4fa3bb,_0x4253ff){return db['AnalyticCustomReport'][_0xcc0a('0x4c')](_0x4fa3bb[_0xcc0a('0x4d')],{})[_0xcc0a('0x23')](function(_0x45f3e8){var _0x58be84=_0x4fa3bb[_0xcc0a('0x4e')][_0xcc0a('0x25')]({'plain':!![]});if(!_0x58be84)throw new Error(_0xcc0a('0x4f'));if(_0x58be84[_0xcc0a('0x50')]===_0xcc0a('0x4e')){var _0x58ce00=_0x45f3e8[_0xcc0a('0x25')]({'plain':!![]});var _0x198770='Reports';return db['UserProfileSection'][_0xcc0a('0x4a')]({'where':{'name':_0x198770,'userProfileId':_0x58be84[_0xcc0a('0x51')]},'raw':!![]})['then'](function(_0x156c9c){if(_0x156c9c&&_0x156c9c[_0xcc0a('0x52')]===0x0){return db[_0xcc0a('0x27')]['create']({'name':_0x58ce00['name'],'resourceId':_0x58ce00['id'],'type':'CustomReports','sectionId':_0x156c9c['id']},{})[_0xcc0a('0x23')](function(){return _0x45f3e8;});}else{return _0x45f3e8;}})[_0xcc0a('0x4b')](function(_0x211834){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211834);throw _0x211834;});}return _0x45f3e8;})[_0xcc0a('0x23')](respondWithResult(_0x4253ff,0xc9))['catch'](handleError(_0x4253ff,null));};exports[_0xcc0a('0x22')]=function(_0xd85fec,_0x488235){if(_0xd85fec[_0xcc0a('0x4d')]['id']){delete _0xd85fec[_0xcc0a('0x4d')]['id'];}return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')]({'where':{'id':_0xd85fec[_0xcc0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x488235,null))[_0xcc0a('0x23')](saveUpdates(_0xd85fec[_0xcc0a('0x4d')],null))[_0xcc0a('0x23')](respondWithResult(_0x488235,null))['catch'](handleError(_0x488235,null));};exports[_0xcc0a('0x24')]=function(_0x465502,_0x4b49d4){return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')]({'where':{'id':_0x465502['params']['id']}})['then'](handleEntityNotFound(_0x4b49d4,null))[_0xcc0a('0x23')](removeEntity(_0x4b49d4,null))[_0xcc0a('0x4b')](handleError(_0x4b49d4,null));};exports[_0xcc0a('0x53')]=function(_0x20c7ca,_0x40934a){var _0x482ff8=0xa;var _0xb18262=[_0xcc0a('0x54'),_0xcc0a('0x55'),_0xcc0a('0x56'),_0xcc0a('0x57')];var _0x12f584={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':_0xcc0a('0x5c'),'GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x12b24c={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':_0xcc0a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xcc0a('0x62'),'UNIX_TIMESTAMP':_0xcc0a('0x63')};var _0x5f1bbd=function(_0x16f0bf){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x16f0bf);};var _0x2509eb=function(_0x3c38ee){if(!_0x3c38ee||!_0x3c38ee[_0xcc0a('0x69')][_0xcc0a('0x36')]){return'';}for(var _0x21355a='(',_0x3d40f3=0x0;_0x3d40f3<_0x3c38ee['rules'][_0xcc0a('0x36')];_0x3d40f3+=0x1){_0x3d40f3>0x0&&(_0x21355a+='\x20'+_0x3c38ee['operator']+'\x20');_0x21355a+=_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6a')]?_0x2509eb(_0x3c38ee['rules'][_0x3d40f3][_0xcc0a('0x6a')]):_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6b')]+'\x20'+_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6c')]+(_0x5f1bbd(_0x3c38ee['rules'][_0x3d40f3]['condition'])?'\x20'+_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6d')]:'');}return _0x21355a+')';};var _0x12a824={'where':{'id':_0x20c7ca[_0xcc0a('0x47')]['id']}},_0x3b8e1d,_0x581f27,_0x16c444,_0x1625ec,_0x354b60;_0x12a824=_['merge']({},_0x12a824,_0x20c7ca[_0xcc0a('0x43')]);return db[_0xcc0a('0x2c')]['find'](_0x12a824)['then'](function(_0x14257c){if(_0x14257c){_0x3b8e1d=_0x14257c;return _0x14257c['getFields']();}return null;})['then'](function(_0x300216){if(_0x300216){if(!_0x300216[_0xcc0a('0x36')]){throw new db['Sequelize'][(_0xcc0a('0x6e'))](_0xcc0a('0x6f'),0x193);}_0x581f27=_0x300216;return db[_0xcc0a('0x70')][_0xcc0a('0x44')]({'raw':!![]});}return null;})['then'](function(_0x545f2d){if(_0x545f2d){_0x16c444=_['keyBy'](_0x545f2d,'id');var _0xdadb47;var _0x4da418=squel[_0xcc0a('0x71')]();_0x4da418[_0xcc0a('0x72')](_0x3b8e1d[_0xcc0a('0x73')]);for(var _0x302302=0x0;_0x302302<_0x581f27[_0xcc0a('0x36')];_0x302302+=0x1){_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x74')]?_0x16c444[_0x581f27[_0x302302]['MetricId']][_0xcc0a('0x75')]:_0x581f27[_0x302302][_0xcc0a('0x6b')];_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x12f584[_0x581f27[_0x302302][_0xcc0a('0x76')]],'%s',_0xdadb47):_0xdadb47;_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x78')]?_[_0xcc0a('0x77')](_0x12b24c[_0x581f27[_0x302302][_0xcc0a('0x78')]],'%s',_0xdadb47):_0xdadb47;if(_0x581f27[_0x302302]['groupBy']){_0x4da418[_0xcc0a('0x6a')](_0xdadb47);}_0x581f27[_0x302302][_0xcc0a('0x79')]&&_0x4da418[_0xcc0a('0x39')](_0xdadb47,_0x581f27[_0x302302][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x4da418[_0xcc0a('0x6b')](_0xdadb47,_0x581f27[_0x302302][_0xcc0a('0x7b')]||_0xdadb47);}if(_0x3b8e1d[_0xcc0a('0x7c')]){_0x3b8e1d['joins']=JSON[_0xcc0a('0x7d')](_0x3b8e1d['joins']);for(var _0x2f19a1=0x0;_0x2f19a1<_0x3b8e1d[_0xcc0a('0x7c')][_0xcc0a('0x36')];_0x2f19a1+=0x1){if(_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x41')]&&_['includes'](_0xb18262,_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x41')])&&_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x7e')]&&_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')]&&_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x80')]){_0x4da418[_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x41')]](_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x3b8e1d[_0xcc0a('0x73')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7e')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x80')]));}}}if(_0x3b8e1d[_0xcc0a('0x82')]){_0x3b8e1d['conditions']=JSON[_0xcc0a('0x7d')](_0x3b8e1d[_0xcc0a('0x82')]);_0x4da418[_0xcc0a('0x3b')](_0x2509eb(_0x3b8e1d[_0xcc0a('0x82')][_0xcc0a('0x6a')]));}_0x354b60=_0x4da418['clone']();_0x4da418['limit'](_0x482ff8);_0x4da418['offset'](0x0);logger[_0xcc0a('0x83')](_0xcc0a('0x84'),_0x4da418[_0xcc0a('0x85')]());return dbH[_0xcc0a('0x86')][_0xcc0a('0x31')](_0x4da418['toString'](),{'type':dbH[_0xcc0a('0x86')]['QueryTypes'][_0xcc0a('0x87')]});}})[_0xcc0a('0x23')](respondWithResult(_0x40934a,null))[_0xcc0a('0x4b')](handleError(_0x40934a,null));};function runReport(_0x305b37,_0x428f9f,_0x2ceee5){var _0x1f75e4=_0x428f9f[_0xcc0a('0x29')];var _0x1a9b6c=0xa;var _0x426f9b=[_0xcc0a('0x54'),'left_join','right_join',_0xcc0a('0x57')];var _0x22f1b3={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':_0xcc0a('0x88'),'MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':_0xcc0a('0x5c'),'GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x1a12a0={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':'DATE(%s)','HOUR':_0xcc0a('0x89'),'ROUND':_0xcc0a('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc0f9f6=function(_0x27e5e9){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x27e5e9);};var _0x114ae8=function(_0x15348d){if(!_0x15348d||!_0x15348d[_0xcc0a('0x69')][_0xcc0a('0x36')]){return'';}for(var _0x5f1497='(',_0x3a7154=0x0;_0x3a7154<_0x15348d[_0xcc0a('0x69')][_0xcc0a('0x36')];_0x3a7154+=0x1){_0x3a7154>0x0&&(_0x5f1497+='\x20'+_0x15348d[_0xcc0a('0x8a')]+'\x20');_0x5f1497+=_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6a')]?_0x114ae8(_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6a')]):_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6b')]+'\x20'+_0x15348d[_0xcc0a('0x69')][_0x3a7154]['condition']+(_0xc0f9f6(_0x15348d['rules'][_0x3a7154][_0xcc0a('0x6c')])?'\x20'+_0x15348d['rules'][_0x3a7154][_0xcc0a('0x6d')]:'');}return _0x5f1497+')';};var _0x2821ab={'where':{'id':_0x305b37['id']}},_0x1c2419,_0xa3263b,_0x115445,_0x501428,_0x34be1c;_0x2821ab=_[_0xcc0a('0x3f')]({},_0x2821ab,_0x2ceee5);return db['AnalyticCustomReport'][_0xcc0a('0x4a')](_0x2821ab)[_0xcc0a('0x23')](function(_0x2b061d){if(_0x2b061d){_0x1c2419=_0x2b061d;return _0x2b061d[_0xcc0a('0x8b')]();}return null;})['then'](function(_0x239392){if(_0x239392){if(!_0x239392['length']){throw new db[(_0xcc0a('0x8c'))][(_0xcc0a('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa3263b=_0x239392;return db[_0xcc0a('0x70')][_0xcc0a('0x44')]({'raw':!![]});}return null;})[_0xcc0a('0x23')](function(_0x1f91b8){if(_0x1f91b8){_0x115445=_[_0xcc0a('0x8d')](_0x1f91b8,'id');var _0xf3a820;var _0x462cd1=squel[_0xcc0a('0x71')]();_0x462cd1[_0xcc0a('0x72')](_0x1c2419[_0xcc0a('0x73')]);for(var _0x1c7121=0x0;_0x1c7121<_0xa3263b[_0xcc0a('0x36')];_0x1c7121+=0x1){_0xf3a820=_0xa3263b[_0x1c7121]['MetricId']?_0x115445[_0xa3263b[_0x1c7121][_0xcc0a('0x74')]]['metric']:_0xa3263b[_0x1c7121][_0xcc0a('0x6b')];_0xf3a820=_0xa3263b[_0x1c7121][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x22f1b3[_0xa3263b[_0x1c7121][_0xcc0a('0x76')]],'%s',_0xf3a820):_0xf3a820;_0xf3a820=_0xa3263b[_0x1c7121][_0xcc0a('0x78')]?_['replace'](_0x1a12a0[_0xa3263b[_0x1c7121][_0xcc0a('0x78')]],'%s',_0xf3a820):_0xf3a820;if(_0xa3263b[_0x1c7121]['groupBy']){_0x462cd1[_0xcc0a('0x6a')](_0xf3a820);}_0xa3263b[_0x1c7121][_0xcc0a('0x79')]&&_0x462cd1[_0xcc0a('0x39')](_0xf3a820,_0xa3263b[_0x1c7121][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x462cd1[_0xcc0a('0x6b')](_0xf3a820,_0xa3263b[_0x1c7121]['alias']||_0xf3a820);}if(_0x1c2419['joins']){_0x1c2419[_0xcc0a('0x7c')]=JSON['parse'](_0x1c2419['joins']);for(var _0x26224b=0x0;_0x26224b<_0x1c2419['joins'][_0xcc0a('0x36')];_0x26224b+=0x1){if(_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x41')]&&_[_0xcc0a('0x64')](_0x426f9b,_0x1c2419['joins'][_0x26224b][_0xcc0a('0x41')])&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7e')]&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7f')]&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x80')]){_0x462cd1[_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x41')]](_0x1c2419['joins'][_0x26224b]['foreignTable'],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x1c2419['table'],_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7e')],_0x1c2419[_0xcc0a('0x7c')][_0x26224b]['foreignTable'],_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x80')]));}}}if(_0x1c2419[_0xcc0a('0x82')]){_0x1c2419[_0xcc0a('0x82')]=JSON[_0xcc0a('0x7d')](_0x1c2419[_0xcc0a('0x82')]);_0x462cd1[_0xcc0a('0x3b')](_0x114ae8(_0x1c2419[_0xcc0a('0x82')]['group']));}_0x34be1c=_0x462cd1['clone']();_0x462cd1[_0xcc0a('0x38')](_0x1a9b6c);_0x462cd1[_0xcc0a('0x1c')](0x0);return;}})[_0xcc0a('0x23')](function(){if(_0x428f9f[_0xcc0a('0x8e')]===_0xcc0a('0x8f')){return null;}var _0x4276a1=_[_0xcc0a('0x3f')](_0x428f9f,{'name':_0x428f9f[_0xcc0a('0x90')]||_0x428f9f[_0xcc0a('0x29')]||_0x1c2419['name'],'basename':_0x1f75e4,'savename':util[_0xcc0a('0x78')]('%s-%s.%s',_0x428f9f[_0xcc0a('0x29')]||_0x1c2419[_0xcc0a('0x29')],require(_0xcc0a('0x91'))[_0xcc0a('0x92')](0x4),_0x428f9f[_0xcc0a('0x8e')]||_0xcc0a('0x93')),'reportId':_0x1c2419['id'],'reportType':_0xcc0a('0x94')});return db[_0xcc0a('0x95')][_0xcc0a('0x4c')](_0x4276a1,{'raw':!![]});})[_0xcc0a('0x23')](function(_0x4cf13d){if(_0x1c2419[_0xcc0a('0x73')]==='cdr'){_0x34be1c[_0xcc0a('0x3b')](_0x1c2419[_0xcc0a('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x428f9f[_0xcc0a('0x96')],_0x428f9f['endDate']);}else{_0x34be1c[_0xcc0a('0x3b')](_0x1c2419[_0xcc0a('0x73')]+_0xcc0a('0x97'),_0x428f9f[_0xcc0a('0x96')],_0x428f9f['endDate']);}if(_0x4cf13d){logger[_0xcc0a('0x98')](_0xcc0a('0x99'),_0x34be1c['toString']());require(_0xcc0a('0x9a'))[_0xcc0a('0x9b')](path[_0xcc0a('0x54')](__dirname,_0xcc0a('0x9c'),_0x4cf13d[_0xcc0a('0x8e')]),[_0x4cf13d['id'],_0x34be1c[_0xcc0a('0x85')](),path['join'](__dirname,_0xcc0a('0x9d'),_0x4cf13d['savename']),_0x1f75e4]);return _0x4cf13d;}else{var _0x472356=squel[_0xcc0a('0x71')]();_0x472356[_0xcc0a('0x72')]('('+_0x34be1c[_0xcc0a('0x85')]()+')',_0xcc0a('0x9e'));_0x472356[_0xcc0a('0x6b')]('COUNT(*)',_0xcc0a('0x1d'));_0x34be1c['limit'](_0x428f9f[_0xcc0a('0x38')]||_0x1a9b6c);_0x34be1c[_0xcc0a('0x1c')](_0x428f9f['offset']||0x0);return dbH[_0xcc0a('0x86')][_0xcc0a('0x31')](_0x472356['toString'](),{'type':dbH[_0xcc0a('0x86')][_0xcc0a('0x9f')][_0xcc0a('0x87')]})[_0xcc0a('0x23')](function(_0x218289){if(!_0x218289[_0xcc0a('0x36')]){_0x501428=0x0;}else{_0x501428=_0x218289[0x0][_0xcc0a('0x1d')]||0x0;}return dbH['sequelize'][_0xcc0a('0x31')](_0x34be1c[_0xcc0a('0x85')](),{'type':dbH[_0xcc0a('0x86')][_0xcc0a('0x9f')][_0xcc0a('0x87')]});})[_0xcc0a('0x23')](function(_0x42778e){return{'rows':_0x42778e||[],'count':_0x501428};});}});}exports[_0xcc0a('0xa0')]=function(_0x48f4b9,_0x525ec5){return runReport(_0x48f4b9[_0xcc0a('0x47')],_0x48f4b9[_0xcc0a('0x31')],_0x48f4b9[_0xcc0a('0x43')])[_0xcc0a('0x23')](respondWithResult(_0x525ec5,null))[_0xcc0a('0x4b')](handleError(_0x525ec5,null));};exports['runReport']=runReport;exports[_0xcc0a('0x31')]=function(_0x4a7952,_0x8a991a){var _0x42c962=0xa;var _0x20eebd=['join',_0xcc0a('0x55'),'right_join','cross_join'];var _0x517ecb={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':_0xcc0a('0x88'),'MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x151371={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':_0xcc0a('0x61'),'HOUR':_0xcc0a('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ff6d2=function(_0x190351){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x190351);};var _0x3efd22=function(_0x52774c){if(!_0x52774c||!_0x52774c[_0xcc0a('0x69')]['length']){return'';}for(var _0xda857d='(',_0x1612f4=0x0;_0x1612f4<_0x52774c[_0xcc0a('0x69')][_0xcc0a('0x36')];_0x1612f4+=0x1){_0x1612f4>0x0&&(_0xda857d+='\x20'+_0x52774c[_0xcc0a('0x8a')]+'\x20');_0xda857d+=_0x52774c['rules'][_0x1612f4]['group']?_0x3efd22(_0x52774c['rules'][_0x1612f4][_0xcc0a('0x6a')]):_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6b')]+'\x20'+_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6c')]+(_0x2ff6d2(_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6c')])?'\x20'+_0x52774c['rules'][_0x1612f4]['value']:'');}return _0xda857d+')';};var _0x1e7249={'where':{'id':_0x4a7952[_0xcc0a('0x47')]['id']}},_0x5446d8,_0x307d3e,_0x2fdc86,_0x3e3c2f,_0x332abd;_0x1e7249=_[_0xcc0a('0x3f')]({},_0x1e7249,_0x4a7952['options']);return db['AnalyticCustomReport'][_0xcc0a('0x4a')](_0x1e7249)[_0xcc0a('0x23')](function(_0x2b1468){if(_0x2b1468){_0x5446d8=_0x2b1468;return _0x2b1468['getFields']();}return null;})[_0xcc0a('0x23')](function(_0x11b29a){if(_0x11b29a){if(!_0x11b29a[_0xcc0a('0x36')]){throw new db[(_0xcc0a('0x8c'))][(_0xcc0a('0x6e'))](_0xcc0a('0x6f'),0x193);}_0x307d3e=_0x11b29a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xcc0a('0x23')](function(_0x592734){if(_0x592734){_0x2fdc86=_[_0xcc0a('0x8d')](_0x592734,'id');var _0x2bf625;var _0x368779=squel[_0xcc0a('0x71')]();_0x368779[_0xcc0a('0x72')](_0x5446d8[_0xcc0a('0x73')]);for(var _0x246cfd=0x0;_0x246cfd<_0x307d3e[_0xcc0a('0x36')];_0x246cfd+=0x1){_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x74')]?_0x2fdc86[_0x307d3e[_0x246cfd][_0xcc0a('0x74')]]['metric']:_0x307d3e[_0x246cfd][_0xcc0a('0x6b')];_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x517ecb[_0x307d3e[_0x246cfd][_0xcc0a('0x76')]],'%s',_0x2bf625):_0x2bf625;_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x78')]?_[_0xcc0a('0x77')](_0x151371[_0x307d3e[_0x246cfd][_0xcc0a('0x78')]],'%s',_0x2bf625):_0x2bf625;if(_0x307d3e[_0x246cfd]['groupBy']){_0x368779[_0xcc0a('0x6a')](_0x2bf625);}_0x307d3e[_0x246cfd][_0xcc0a('0x79')]&&_0x368779['order'](_0x2bf625,_0x307d3e[_0x246cfd][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x368779[_0xcc0a('0x6b')](_0x2bf625,_0x307d3e[_0x246cfd][_0xcc0a('0x7b')]||_0x2bf625);}if(_0x5446d8[_0xcc0a('0x7c')]){_0x5446d8[_0xcc0a('0x7c')]=JSON[_0xcc0a('0x7d')](_0x5446d8[_0xcc0a('0x7c')]);for(var _0x5cd454=0x0;_0x5cd454<_0x5446d8[_0xcc0a('0x7c')]['length'];_0x5cd454+=0x1){if(_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x41')]&&_[_0xcc0a('0x64')](_0x20eebd,_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x41')])&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7e')]&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')]&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454]['foreignKey']){_0x368779[_0x5446d8['joins'][_0x5cd454][_0xcc0a('0x41')]](_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x5446d8[_0xcc0a('0x73')],_0x5446d8['joins'][_0x5cd454]['parentKey'],_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')],_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x80')]));}}}if(_0x5446d8[_0xcc0a('0x82')]){_0x5446d8[_0xcc0a('0x82')]=JSON[_0xcc0a('0x7d')](_0x5446d8['conditions']);_0x368779[_0xcc0a('0x3b')](_0x3efd22(_0x5446d8[_0xcc0a('0x82')]['group']));}_0x332abd=_0x368779['clone']();_0x368779[_0xcc0a('0x38')](_0x42c962);_0x368779[_0xcc0a('0x1c')](0x0);logger[_0xcc0a('0x83')](_0xcc0a('0x84'),_0x368779[_0xcc0a('0x85')]());return dbH[_0xcc0a('0x86')]['query'](_0x368779[_0xcc0a('0x85')](),{'type':dbH[_0xcc0a('0x86')]['QueryTypes'][_0xcc0a('0x87')]});}})[_0xcc0a('0x23')](function(){return{'sql':_0x332abd[_0xcc0a('0x85')]()};})[_0xcc0a('0x23')](respondWithResult(_0x8a991a,null))['catch'](handleError(_0x8a991a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 94b0705..2484517 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 _0xdcaf=['exports','define','analytics_custom_reports','lodash','util','moment','bluebird'];(function(_0x434d68,_0xcbdfed){var _0x56f3ce=function(_0x3553ab){while(--_0x3553ab){_0x434d68['push'](_0x434d68['shift']());}};_0x56f3ce(++_0xcbdfed);}(_0xdcaf,0x88));var _0xfdca=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcaf[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfdca('0x0'));var util=require(_0xfdca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfdca('0x2'));var BPromise=require(_0xfdca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xfdca('0x4')]=function(_0x31558c,_0x3b54bc){return _0x31558c[_0xfdca('0x5')]('AnalyticCustomReport',attributes,{'tableName':_0xfdca('0x6'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3855=['path','rimraf','./analyticCustomReport.attributes','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1df0a9,_0xc0d944){var _0x13238e=function(_0x12db5c){while(--_0x12db5c){_0x1df0a9['push'](_0x1df0a9['shift']());}};_0x13238e(++_0xc0d944);}(_0x3855,0xea));var _0x5385=function(_0x186b4c,_0x376b66){_0x186b4c=_0x186b4c-0x0;var _0x48346b=_0x3855[_0x186b4c];return _0x48346b;};'use strict';var _=require(_0x5385('0x0'));var util=require(_0x5385('0x1'));var logger=require('../../config/logger')(_0x5385('0x2'));var moment=require(_0x5385('0x3'));var BPromise=require(_0x5385('0x4'));var rp=require(_0x5385('0x5'));var fs=require('fs');var path=require(_0x5385('0x6'));var rimraf=require(_0x5385('0x7'));var config=require('../../config/environment');var attributes=require(_0x5385('0x8'));module['exports']=function(_0x1e15c3,_0x58f0e1){return _0x1e15c3['define']('AnalyticCustomReport',attributes,{'tableName':_0x5385('0x9'),'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 272b455..0123fa3 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 _0x74db=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','lodash','bluebird','randomstring','ioredis'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x74db,0x165));var _0xb74d=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x74db[_0x2fdf82];return _0x2382f5;};'use strict';var _=require(_0xb74d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb74d('0x1'));var rs=require(_0xb74d('0x2'));var fs=require('fs');var Redis=require(_0xb74d('0x3'));var db=require(_0xb74d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb74d('0x5'))(_0xb74d('0x6'));var config=require(_0xb74d('0x7'));var jayson=require(_0xb74d('0x8'));var client=jayson['client'][_0xb74d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19ba6f,_0x401180,_0x2b5728){return new BPromise(function(_0x1a1d4a,_0x2d6c4f){return client[_0xb74d('0xa')](_0x19ba6f,_0x2b5728)['then'](function(_0x3e7a76){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x401180,_0xb74d('0xb'));logger['debug'](_0xb74d('0xc'),_0x401180,'request\x20sent',JSON[_0xb74d('0xd')](_0x3e7a76));if(_0x3e7a76[_0xb74d('0xe')]){if(_0x3e7a76['error'][_0xb74d('0xf')]===0x1f4){logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);return _0x2d6c4f(_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);}logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);return _0x1a1d4a(_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);}else{logger[_0xb74d('0x12')](_0xb74d('0x10'),_0x401180,'request\x20sent');_0x1a1d4a(_0x3e7a76['result']['message']);}})['catch'](function(_0x2d545f){logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x2d545f);_0x2d6c4f(_0x2d545f);});});} \ No newline at end of file +var _0xbbc9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3794db,_0x5e1968){var _0x3a7499=function(_0x1f4241){while(--_0x1f4241){_0x3794db['push'](_0x3794db['shift']());}};_0x3a7499(++_0x5e1968);}(_0xbbc9,0x15a));var _0x9bbc=function(_0x4efa2a,_0x1dbe0e){_0x4efa2a=_0x4efa2a-0x0;var _0x1055f7=_0xbbc9[_0x4efa2a];return _0x1055f7;};'use strict';var _=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var moment=require(_0x9bbc('0x2'));var BPromise=require(_0x9bbc('0x3'));var rs=require(_0x9bbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bbc('0x5'))['db'];var utils=require(_0x9bbc('0x6'));var logger=require(_0x9bbc('0x7'))(_0x9bbc('0x8'));var config=require(_0x9bbc('0x9'));var jayson=require(_0x9bbc('0xa'));var client=jayson[_0x9bbc('0xb')][_0x9bbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x396af3,_0x40d49f,_0x2825b4){return new BPromise(function(_0x4ccd0a,_0x421e32){return client['request'](_0x396af3,_0x2825b4)[_0x9bbc('0xd')](function(_0x3ced5f){logger[_0x9bbc('0xe')](_0x9bbc('0xf'),_0x40d49f,_0x9bbc('0x10'));logger[_0x9bbc('0x11')](_0x9bbc('0x12'),_0x40d49f,_0x9bbc('0x10'),JSON[_0x9bbc('0x13')](_0x3ced5f));if(_0x3ced5f[_0x9bbc('0x14')]){if(_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x15')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x40d49f,_0x3ced5f[_0x9bbc('0x14')]['message']);return _0x421e32(_0x3ced5f[_0x9bbc('0x14')]['message']);}logger[_0x9bbc('0x14')](_0x9bbc('0xf'),_0x40d49f,_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x16')]);return _0x4ccd0a(_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x16')]);}else{logger[_0x9bbc('0xe')](_0x9bbc('0xf'),_0x40d49f,_0x9bbc('0x10'));_0x4ccd0a(_0x3ced5f[_0x9bbc('0x17')][_0x9bbc('0x16')]);}})[_0x9bbc('0x18')](function(_0x48daee){logger[_0x9bbc('0x14')](_0x9bbc('0xf'),_0x40d49f,_0x48daee);_0x421e32(_0x48daee);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4abc718..b1a9367 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 _0x2bce=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','/:id/run','run','query','post','create','put','update','/:id'];(function(_0x37d1e4,_0x2eeb58){var _0x13155a=function(_0x435f88){while(--_0x435f88){_0x37d1e4['push'](_0x37d1e4['shift']());}};_0x13155a(++_0x2eeb58);}(_0x2bce,0x199));var _0xe2bc=function(_0x150667,_0x3bbe53){_0x150667=_0x150667-0x0;var _0x36f17e=_0x2bce[_0x150667];return _0x36f17e;};'use strict';var multer=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var path=require(_0xe2bc('0x2'));var timeout=require(_0xe2bc('0x3'));var express=require(_0xe2bc('0x4'));var router=express[_0xe2bc('0x5')]();var fs_extra=require(_0xe2bc('0x6'));var auth=require(_0xe2bc('0x7'));var interaction=require(_0xe2bc('0x8'));var config=require(_0xe2bc('0x9'));var controller=require(_0xe2bc('0xa'));router[_0xe2bc('0xb')]('/',auth[_0xe2bc('0xc')](),controller[_0xe2bc('0xd')]);router[_0xe2bc('0xb')]('/:id',auth[_0xe2bc('0xc')](),controller['show']);router[_0xe2bc('0xb')](_0xe2bc('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xe2bc('0xb')](_0xe2bc('0xf'),auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x10')]);router[_0xe2bc('0xb')]('/:id/query',auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x11')]);router[_0xe2bc('0x12')]('/',auth['isAuthenticated'](),controller[_0xe2bc('0x13')]);router[_0xe2bc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe2bc('0x15')]);router['delete'](_0xe2bc('0x16'),auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd9d1=['/:id/preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0xd9d1,0x12a));var _0x1d9d=function(_0x476f8a,_0x492fac){_0x476f8a=_0x476f8a-0x0;var _0x4a3dda=_0xd9d1[_0x476f8a];return _0x4a3dda;};'use strict';var multer=require('multer');var util=require(_0x1d9d('0x0'));var path=require(_0x1d9d('0x1'));var timeout=require(_0x1d9d('0x2'));var express=require(_0x1d9d('0x3'));var router=express[_0x1d9d('0x4')]();var fs_extra=require(_0x1d9d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1d9d('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x1d9d('0x7')]('/',auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x9')]);router[_0x1d9d('0x7')]('/:id',auth[_0x1d9d('0x8')](),controller['show']);router[_0x1d9d('0x7')](_0x1d9d('0xa'),auth[_0x1d9d('0x8')](),controller['preview']);router['get'](_0x1d9d('0xb'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0xc')]);router[_0x1d9d('0x7')](_0x1d9d('0xd'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0xe')]);router[_0x1d9d('0xf')]('/',auth['isAuthenticated'](),controller[_0x1d9d('0x10')]);router[_0x1d9d('0x11')](_0x1d9d('0x12'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x13')]);router[_0x1d9d('0x14')]('/:id',auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e3b3f17..00bc2ff 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xfdbd[_0x2a390b];return _0x5df10a;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x6bcc5,_0x9c28f0){_0x6bcc5=_0x6bcc5-0x0;var _0x345542=_0xb4c7[_0x6bcc5];return _0x345542;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 57ae404..43fa31a 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 _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x220909,_0x4fa78a){_0x220909=_0x220909-0x0;var _0x1119ae=_0xc6ac[_0x220909];return _0x1119ae;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x415a01,_0x4a47df){var _0x3ad4ed=function(_0x1ab653){while(--_0x1ab653){_0x415a01['push'](_0x415a01['shift']());}};_0x3ad4ed(++_0x4a47df);}(_0x1967,0x173));var _0x7196=function(_0x7da333,_0x180e53){_0x7da333=_0x7da333-0x0;var _0x5d878e=_0x1967[_0x7da333];return _0x5d878e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b76627b..264d171 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 _0x30d6=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','util','../../config/logger','api','moment','request-promise','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x30d6,0x192));var _0x630d=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0x30d6[_0x8e7772];return _0x408200;};'use strict';var _=require('lodash');var util=require(_0x630d('0x0'));var logger=require(_0x630d('0x1'))(_0x630d('0x2'));var moment=require(_0x630d('0x3'));var BPromise=require('bluebird');var rp=require(_0x630d('0x4'));var fs=require('fs');var path=require(_0x630d('0x5'));var rimraf=require(_0x630d('0x6'));var config=require(_0x630d('0x7'));var attributes=require(_0x630d('0x8'));module[_0x630d('0x9')]=function(_0x1bb227,_0x40b96b){return _0x1bb227[_0x630d('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x630d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2468=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x18392d,_0x1646af){var _0x300409=function(_0x352c54){while(--_0x352c54){_0x18392d['push'](_0x18392d['shift']());}};_0x300409(++_0x1646af);}(_0x2468,0x145));var _0x8246=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x2468[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x8246('0x0'));var util=require('util');var logger=require(_0x8246('0x1'))(_0x8246('0x2'));var moment=require(_0x8246('0x3'));var BPromise=require(_0x8246('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8246('0x5'));var rimraf=require(_0x8246('0x6'));var config=require(_0x8246('0x7'));var attributes=require(_0x8246('0x8'));module[_0x8246('0x9')]=function(_0x737d2f,_0x4b830d){return _0x737d2f['define'](_0x8246('0xa'),attributes,{'tableName':_0x8246('0xb'),'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 90dbb89..0634619 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 _0x8db8=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','then','info'];(function(_0x162def,_0x4fdb79){var _0x2e19f1=function(_0x446f98){while(--_0x446f98){_0x162def['push'](_0x162def['shift']());}};_0x2e19f1(++_0x4fdb79);}(_0x8db8,0xb1));var _0x88db=function(_0x4501fe,_0x5727e9){_0x4501fe=_0x4501fe-0x0;var _0x170487=_0x8db8[_0x4501fe];return _0x170487;};'use strict';var _=require(_0x88db('0x0'));var util=require(_0x88db('0x1'));var moment=require(_0x88db('0x2'));var BPromise=require(_0x88db('0x3'));var rs=require(_0x88db('0x4'));var fs=require('fs');var Redis=require(_0x88db('0x5'));var db=require(_0x88db('0x6'))['db'];var utils=require(_0x88db('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x88db('0x8'));var client=jayson['client'][_0x88db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a7794,_0x2d31a6,_0x23388b){return new BPromise(function(_0x2eafe0,_0x318d5b){return client['request'](_0x3a7794,_0x23388b)[_0x88db('0xa')](function(_0x3175c8){logger[_0x88db('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x88db('0xc'));logger['debug'](_0x88db('0xd'),_0x2d31a6,_0x88db('0xc'),JSON[_0x88db('0xe')](_0x3175c8));if(_0x3175c8[_0x88db('0xf')]){if(_0x3175c8['error'][_0x88db('0x10')]===0x1f4){logger[_0x88db('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);return _0x318d5b(_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);}logger[_0x88db('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);return _0x2eafe0(_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);}else{logger[_0x88db('0xb')](_0x88db('0x12'),_0x2d31a6,_0x88db('0xc'));_0x2eafe0(_0x3175c8[_0x88db('0x13')][_0x88db('0x11')]);}})[_0x88db('0x14')](function(_0x127e20){logger[_0x88db('0xf')](_0x88db('0x12'),_0x2d31a6,_0x127e20);_0x318d5b(_0x127e20);});});} \ No newline at end of file +var _0x8f5a=['AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','info'];(function(_0x493b42,_0x3161e5){var _0x1ab527=function(_0x54ec08){while(--_0x54ec08){_0x493b42['push'](_0x493b42['shift']());}};_0x1ab527(++_0x3161e5);}(_0x8f5a,0x138));var _0xa8f5=function(_0x4760a0,_0x1d1ee2){_0x4760a0=_0x4760a0-0x0;var _0x5d7ebc=_0x8f5a[_0x4760a0];return _0x5d7ebc;};'use strict';var _=require(_0xa8f5('0x0'));var util=require(_0xa8f5('0x1'));var moment=require(_0xa8f5('0x2'));var BPromise=require(_0xa8f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f5('0x6'));var jayson=require(_0xa8f5('0x7'));var client=jayson[_0xa8f5('0x8')][_0xa8f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f8cd4,_0x22d627,_0xc4165b){return new BPromise(function(_0xaee3a1,_0x2adf97){return client['request'](_0x2f8cd4,_0xc4165b)['then'](function(_0x450fbb){logger[_0xa8f5('0xa')](_0xa8f5('0xb'),_0x22d627,'request\x20sent');logger['debug'](_0xa8f5('0xc'),_0x22d627,_0xa8f5('0xd'),JSON[_0xa8f5('0xe')](_0x450fbb));if(_0x450fbb[_0xa8f5('0xf')]){if(_0x450fbb['error'][_0xa8f5('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x22d627,_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);return _0x2adf97(_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);}logger['error'](_0xa8f5('0xb'),_0x22d627,_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);return _0xaee3a1(_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);}else{logger[_0xa8f5('0xa')](_0xa8f5('0xb'),_0x22d627,_0xa8f5('0xd'));_0xaee3a1(_0x450fbb['result'][_0xa8f5('0x11')]);}})[_0xa8f5('0x12')](function(_0x58fec7){logger[_0xa8f5('0xf')](_0xa8f5('0xb'),_0x22d627,_0x58fec7);_0x2adf97(_0x58fec7);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index deffc97..d22d806 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 _0xe321=['preview','run','/:id/query','query','post','put','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4a6702,_0x405e77){var _0x3c5e45=function(_0x2e841f){while(--_0x2e841f){_0x4a6702['push'](_0x4a6702['shift']());}};_0x3c5e45(++_0x405e77);}(_0xe321,0x194));var _0x1e32=function(_0x2e67a4,_0x281041){_0x2e67a4=_0x2e67a4-0x0;var _0x4cb738=_0xe321[_0x2e67a4];return _0x4cb738;};'use strict';var multer=require('multer');var util=require(_0x1e32('0x0'));var path=require(_0x1e32('0x1'));var timeout=require(_0x1e32('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e32('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e32('0x4'));var controller=require(_0x1e32('0x5'));router[_0x1e32('0x6')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0x8')]);router[_0x1e32('0x6')](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller['show']);router[_0x1e32('0x6')]('/:id/preview',auth[_0x1e32('0x7')](),controller[_0x1e32('0xa')]);router['get']('/:id/run',auth[_0x1e32('0x7')](),controller[_0x1e32('0xb')]);router['get'](_0x1e32('0xc'),auth[_0x1e32('0x7')](),controller[_0x1e32('0xd')]);router[_0x1e32('0xe')]('/',auth[_0x1e32('0x7')](),controller['create']);router[_0x1e32('0xf')]('/:id',auth[_0x1e32('0x7')](),controller['update']);router['delete'](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x10')]);module[_0x1e32('0x11')]=router; \ No newline at end of file +var _0xc00b=['put','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/preview','run','post','create'];(function(_0x374fab,_0x32970f){var _0x3dc5c9=function(_0x5d1160){while(--_0x5d1160){_0x374fab['push'](_0x374fab['shift']());}};_0x3dc5c9(++_0x32970f);}(_0xc00b,0x1e5));var _0xbc00=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0xc00b[_0x12a020];return _0x63cddd;};'use strict';var multer=require(_0xbc00('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc00('0x1'));var router=express['Router']();var fs_extra=require(_0xbc00('0x2'));var auth=require(_0xbc00('0x3'));var interaction=require(_0xbc00('0x4'));var config=require(_0xbc00('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xbc00('0x6')]('/',auth['isAuthenticated'](),controller[_0xbc00('0x7')]);router['get'](_0xbc00('0x8'),auth[_0xbc00('0x9')](),controller[_0xbc00('0xa')]);router[_0xbc00('0x6')](_0xbc00('0xb'),auth[_0xbc00('0x9')](),controller['preview']);router[_0xbc00('0x6')]('/:id/run',auth[_0xbc00('0x9')](),controller[_0xbc00('0xc')]);router[_0xbc00('0x6')]('/:id/query',auth[_0xbc00('0x9')](),controller['query']);router[_0xbc00('0xd')]('/',auth['isAuthenticated'](),controller[_0xbc00('0xe')]);router[_0xbc00('0xf')](_0xbc00('0x8'),auth['isAuthenticated'](),controller[_0xbc00('0x10')]);router[_0xbc00('0x11')](_0xbc00('0x8'),auth['isAuthenticated'](),controller[_0xbc00('0x12')]);module[_0xbc00('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ad197ae..e22745e 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 _0x04d1=['Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x04d1,0x1d9));var _0x104d=function(_0x33fb6c,_0xdf875b){_0x33fb6c=_0x33fb6c-0x0;var _0x291370=_0x04d1[_0x33fb6c];return _0x291370;};'use strict';var Sequelize=require(_0x104d('0x0'));var moment=require('moment');module[_0x104d('0x1')]={'name':{'type':Sequelize[_0x104d('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x104d('0x3')](_0x104d('0x4'),_0x104d('0x5'),_0x104d('0x6')),'allowNull':![],'defaultValue':_0x104d('0x4')},'savename':{'type':Sequelize[_0x104d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x104d('0x7')]},'status':{'type':Sequelize[_0x104d('0x2')],'defaultValue':_0x104d('0x8')},'type':{'type':Sequelize[_0x104d('0x3')]('manual',_0x104d('0x9')),'allowNull':![],'defaultValue':_0x104d('0xa')},'reportId':{'type':Sequelize[_0x104d('0xb')](0xb)[_0x104d('0xc')]},'reportType':{'type':Sequelize[_0x104d('0x2')]}}; \ No newline at end of file +var _0xd3c4=['pdf','xlsx','csv','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x5e0ad7,_0x527a48){var _0x1da054=function(_0x2d040c){while(--_0x2d040c){_0x5e0ad7['push'](_0x5e0ad7['shift']());}};_0x1da054(++_0x527a48);}(_0xd3c4,0x1c3));var _0x4d3c=function(_0x1f7a55,_0x352d22){_0x1f7a55=_0x1f7a55-0x0;var _0x2a291b=_0xd3c4[_0x1f7a55];return _0x2a291b;};'use strict';var Sequelize=require(_0x4d3c('0x0'));var moment=require(_0x4d3c('0x1'));module[_0x4d3c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4d3c('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x4d3c('0x4'),_0x4d3c('0x5')),'allowNull':![],'defaultValue':_0x4d3c('0x6')},'savename':{'type':Sequelize[_0x4d3c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4d3c('0x7')]},'status':{'type':Sequelize[_0x4d3c('0x3')],'defaultValue':_0x4d3c('0x8')},'type':{'type':Sequelize[_0x4d3c('0x9')](_0x4d3c('0xa'),_0x4d3c('0xb')),'allowNull':![],'defaultValue':_0x4d3c('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x4d3c('0xc')]},'reportType':{'type':Sequelize[_0x4d3c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fdbfc6e..c2a8c66 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 _0xbc07=['status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','AnalyticExtractedReport','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','savename','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','end'];(function(_0x11cd67,_0x5402e2){var _0x4f1f3b=function(_0x308392){while(--_0x308392){_0x11cd67['push'](_0x11cd67['shift']());}};_0x4f1f3b(++_0x5402e2);}(_0xbc07,0xf3));var _0x7bc0=function(_0x17f12e,_0x3621e6){_0x17f12e=_0x17f12e-0x0;var _0x286ca2=_0xbc07[_0x17f12e];return _0x286ca2;};'use strict';var emlformat=require(_0x7bc0('0x0'));var rimraf=require(_0x7bc0('0x1'));var zipdir=require(_0x7bc0('0x2'));var jsonpatch=require(_0x7bc0('0x3'));var rp=require(_0x7bc0('0x4'));var moment=require(_0x7bc0('0x5'));var BPromise=require(_0x7bc0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7bc0('0x7'));var csv=require(_0x7bc0('0x8'));var ejs=require(_0x7bc0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bc0('0xb'));var deskjs=require(_0x7bc0('0xc'));var toCsv=require(_0x7bc0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc0('0xd'));var authService=require(_0x7bc0('0xe'));var qs=require(_0x7bc0('0xf'));var as=require(_0x7bc0('0x10'));var hardwareService=require(_0x7bc0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7bc0('0x12'));var config=require(_0x7bc0('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48cd37,_0x170a84){_0x170a84=_0x170a84||0xcc;return function(_0x34ce1e){if(_0x34ce1e){return _0x48cd37['sendStatus'](_0x170a84);}return _0x48cd37['status'](_0x170a84)[_0x7bc0('0x14')]();};}function respondWithResult(_0x554189,_0x1bba64){_0x1bba64=_0x1bba64||0xc8;return function(_0x30d2f3){if(_0x30d2f3){return _0x554189[_0x7bc0('0x15')](_0x1bba64)['json'](_0x30d2f3);}};}function respondWithFilteredResult(_0x24e610,_0x4107f1){return function(_0xcddba7){if(_0xcddba7){var _0x1c512e=typeof _0x4107f1[_0x7bc0('0x16')]===_0x7bc0('0x17')&&typeof _0x4107f1[_0x7bc0('0x18')]===_0x7bc0('0x17');var _0x2c6752=_0xcddba7[_0x7bc0('0x19')];var _0x150245=_0x1c512e?0x0:_0x4107f1[_0x7bc0('0x16')];var _0x9271c4=_0x1c512e?_0xcddba7[_0x7bc0('0x19')]:_0x4107f1['offset']+_0x4107f1['limit'];var _0x5275d8;if(_0x9271c4>=_0x2c6752){_0x9271c4=_0x2c6752;_0x5275d8=0xc8;}else{_0x5275d8=0xce;}_0x24e610[_0x7bc0('0x15')](_0x5275d8);return _0x24e610[_0x7bc0('0x1a')]('Content-Range',_0x150245+'-'+_0x9271c4+'/'+_0x2c6752)[_0x7bc0('0x1b')](_0xcddba7);}return null;};}function patchUpdates(_0x3179a8){return function(_0x1ba038){try{jsonpatch[_0x7bc0('0x1c')](_0x1ba038,_0x3179a8,!![]);}catch(_0x5d2100){return BPromise['reject'](_0x5d2100);}return _0x1ba038[_0x7bc0('0x1d')]();};}function saveUpdates(_0x48c9a8,_0x16c784){return function(_0x3d54a9){if(_0x3d54a9){return _0x3d54a9[_0x7bc0('0x1e')](_0x48c9a8)[_0x7bc0('0x1f')](function(_0x3a47ba){return _0x3a47ba;});}return null;};}function removeEntity(_0x45a66e,_0x2f3f62){return function(_0x110094){if(_0x110094){return _0x110094[_0x7bc0('0x20')]()[_0x7bc0('0x1f')](function(){var _0x1bc121=_0x110094[_0x7bc0('0x21')]({'plain':!![]});var _0x1ab057=_0x7bc0('0x22');return db[_0x7bc0('0x23')][_0x7bc0('0x20')]({'where':{'type':_0x1ab057,'resourceId':_0x1bc121['id']}})[_0x7bc0('0x1f')](function(){return _0x110094;});})[_0x7bc0('0x1f')](function(){_0x45a66e['status'](0xcc)[_0x7bc0('0x14')]();});}};}function handleEntityNotFound(_0x475b52,_0x1e884c){return function(_0x4216cc){if(!_0x4216cc){_0x475b52[_0x7bc0('0x24')](0x194);}return _0x4216cc;};}function handleError(_0x307895,_0x5d090c){_0x5d090c=_0x5d090c||0x1f4;return function(_0x46b941){logger[_0x7bc0('0x25')](_0x46b941['stack']);if(_0x46b941[_0x7bc0('0x26')]){delete _0x46b941['name'];}_0x307895[_0x7bc0('0x15')](_0x5d090c)[_0x7bc0('0x27')](_0x46b941);};}exports['index']=function(_0x1ba845,_0x3ba533){var _0x2f841f={},_0x63acc3={},_0x1b3bd2={'count':0x0,'rows':[]};var _0x4c9817=_['map'](db[_0x7bc0('0x28')]['rawAttributes'],function(_0x393cc6){return{'name':_0x393cc6['fieldName'],'type':_0x393cc6[_0x7bc0('0x29')][_0x7bc0('0x2a')]};});_0x63acc3[_0x7bc0('0x2b')]=_['map'](_0x4c9817,_0x7bc0('0x26'));_0x63acc3[_0x7bc0('0x2c')]=_['keys'](_0x1ba845[_0x7bc0('0x2c')]);_0x63acc3[_0x7bc0('0x2d')]=_[_0x7bc0('0x2e')](_0x63acc3[_0x7bc0('0x2b')],_0x63acc3[_0x7bc0('0x2c')]);_0x2f841f['attributes']=_['intersection'](_0x63acc3['model'],qs[_0x7bc0('0x2f')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x2f')]));_0x2f841f['attributes']=_0x2f841f[_0x7bc0('0x30')][_0x7bc0('0x31')]?_0x2f841f['attributes']:_0x63acc3[_0x7bc0('0x2b')];if(!_0x1ba845[_0x7bc0('0x2c')]['hasOwnProperty'](_0x7bc0('0x32'))){_0x2f841f[_0x7bc0('0x18')]=qs[_0x7bc0('0x18')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x18')]);_0x2f841f[_0x7bc0('0x16')]=qs[_0x7bc0('0x16')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x16')]);}_0x2f841f[_0x7bc0('0x33')]=qs[_0x7bc0('0x34')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x34')]);_0x2f841f[_0x7bc0('0x35')]=qs[_0x7bc0('0x2d')](_[_0x7bc0('0x36')](_0x1ba845[_0x7bc0('0x2c')],_0x63acc3[_0x7bc0('0x2d')]),_0x4c9817);if(_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x37')]){_0x2f841f[_0x7bc0('0x35')]=_[_0x7bc0('0x38')](_0x2f841f[_0x7bc0('0x35')],{'$or':_[_0x7bc0('0x39')](_0x4c9817,function(_0x549973){if(_0x549973['type']!==_0x7bc0('0x3a')){var _0x3ded29={};_0x3ded29[_0x549973[_0x7bc0('0x26')]]={'$like':'%'+_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x37')]+'%'};return _0x3ded29;}})});}_0x2f841f=_['merge']({},_0x2f841f,_0x1ba845[_0x7bc0('0x3b')]);var _0x34ad15={'where':_0x2f841f[_0x7bc0('0x35')]};return db[_0x7bc0('0x28')][_0x7bc0('0x19')](_0x34ad15)[_0x7bc0('0x1f')](function(_0x497dd7){_0x1b3bd2[_0x7bc0('0x19')]=_0x497dd7;if(_0x1ba845['query'][_0x7bc0('0x3c')]){_0x2f841f[_0x7bc0('0x3d')]=[{'all':!![]}];}return db[_0x7bc0('0x28')]['findAll'](_0x2f841f);})[_0x7bc0('0x1f')](function(_0x5ebd5e){_0x1b3bd2[_0x7bc0('0x3e')]=_0x5ebd5e;return _0x1b3bd2;})['then'](respondWithFilteredResult(_0x3ba533,_0x2f841f))['catch'](handleError(_0x3ba533,null));};exports['show']=function(_0x12ba49,_0x572ae9){var _0x2ce726={'raw':!![],'where':{'id':_0x12ba49['params']['id']}},_0x643185={};_0x643185['model']=_[_0x7bc0('0x3f')](db[_0x7bc0('0x28')][_0x7bc0('0x40')]);_0x643185[_0x7bc0('0x2c')]=_[_0x7bc0('0x3f')](_0x12ba49['query']);_0x643185[_0x7bc0('0x2d')]=_[_0x7bc0('0x2e')](_0x643185[_0x7bc0('0x2b')],_0x643185[_0x7bc0('0x2c')]);_0x2ce726[_0x7bc0('0x30')]=_['intersection'](_0x643185[_0x7bc0('0x2b')],qs[_0x7bc0('0x2f')](_0x12ba49[_0x7bc0('0x2c')][_0x7bc0('0x2f')]));_0x2ce726[_0x7bc0('0x30')]=_0x2ce726[_0x7bc0('0x30')][_0x7bc0('0x31')]?_0x2ce726[_0x7bc0('0x30')]:_0x643185[_0x7bc0('0x2b')];if(_0x12ba49[_0x7bc0('0x2c')][_0x7bc0('0x3c')]){_0x2ce726['include']=[{'all':!![]}];}_0x2ce726=_[_0x7bc0('0x38')]({},_0x2ce726,_0x12ba49[_0x7bc0('0x3b')]);return db[_0x7bc0('0x28')][_0x7bc0('0x41')](_0x2ce726)[_0x7bc0('0x1f')](handleEntityNotFound(_0x572ae9,null))[_0x7bc0('0x1f')](respondWithResult(_0x572ae9,null))[_0x7bc0('0x42')](handleError(_0x572ae9,null));};exports[_0x7bc0('0x43')]=function(_0x551174,_0x4d20e2){return db[_0x7bc0('0x28')][_0x7bc0('0x43')](_0x551174[_0x7bc0('0x44')],{})['then'](function(_0x4e563e){var _0x4b8f90=_0x551174[_0x7bc0('0x45')][_0x7bc0('0x21')]({'plain':!![]});if(!_0x4b8f90)throw new Error(_0x7bc0('0x46'));if(_0x4b8f90['role']===_0x7bc0('0x45')){var _0x281cc8=_0x4e563e['get']({'plain':!![]});var _0x18137e=_0x7bc0('0x22');return db[_0x7bc0('0x47')]['find']({'where':{'name':_0x18137e,'userProfileId':_0x4b8f90[_0x7bc0('0x48')]},'raw':!![]})[_0x7bc0('0x1f')](function(_0xfa168f){if(_0xfa168f&&_0xfa168f[_0x7bc0('0x49')]===0x0){return db[_0x7bc0('0x23')][_0x7bc0('0x43')]({'name':_0x281cc8['name'],'resourceId':_0x281cc8['id'],'type':_0xfa168f[_0x7bc0('0x26')],'sectionId':_0xfa168f['id']},{})[_0x7bc0('0x1f')](function(){return _0x4e563e;});}else{return _0x4e563e;}})[_0x7bc0('0x42')](function(_0x5cddc8){logger[_0x7bc0('0x25')](_0x7bc0('0x4a'),_0x5cddc8);throw _0x5cddc8;});}return _0x4e563e;})[_0x7bc0('0x1f')](respondWithResult(_0x4d20e2,0xc9))[_0x7bc0('0x42')](handleError(_0x4d20e2,null));};exports[_0x7bc0('0x1e')]=function(_0xe78c1e,_0x5e9042){if(_0xe78c1e[_0x7bc0('0x44')]['id']){delete _0xe78c1e[_0x7bc0('0x44')]['id'];}return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0xe78c1e[_0x7bc0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e9042,null))[_0x7bc0('0x1f')](saveUpdates(_0xe78c1e[_0x7bc0('0x44')],null))['then'](respondWithResult(_0x5e9042,null))[_0x7bc0('0x42')](handleError(_0x5e9042,null));};exports[_0x7bc0('0x20')]=function(_0x315774,_0x3bbda3){return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0x315774[_0x7bc0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bbda3,null))['then'](removeEntity(_0x3bbda3,null))['catch'](handleError(_0x3bbda3,null));};exports[_0x7bc0('0x4c')]=function(_0x551481,_0x4fb3da,_0x33b42e){return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0x551481['params']['id']},'attributes':['name',_0x7bc0('0x4d'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x4fb3da,null))[_0x7bc0('0x1f')](function(_0x1db9fa){if(_0x1db9fa){if(!fs[_0x7bc0('0x4e')](path[_0x7bc0('0x4f')](config[_0x7bc0('0x50')],_0x7bc0('0x51'),_0x1db9fa['savename']))){throw new db[(_0x7bc0('0x52'))][(_0x7bc0('0x53'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x551481[_0x7bc0('0x2c')][_0x7bc0('0x54')]){return _0x4fb3da[_0x7bc0('0x24')](0xc8);}return _0x4fb3da[_0x7bc0('0x4c')](path[_0x7bc0('0x4f')](config['root'],'server/files/reports',_0x1db9fa[_0x7bc0('0x55')]),util['format'](_0x7bc0('0x56'),_0x1db9fa[_0x7bc0('0x4d')]||_0x1db9fa[_0x7bc0('0x26')],_0x1db9fa['output'][_0x7bc0('0x57')]()));}})[_0x7bc0('0x42')](handleError(_0x4fb3da,null));}; \ No newline at end of file +var _0xd653=['keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','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','update','basename','savename','output','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','server/files/reports','format','%s.%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','key','map'];(function(_0x270f63,_0x4d27f6){var _0x2d7cd8=function(_0x377acf){while(--_0x377acf){_0x270f63['push'](_0x270f63['shift']());}};_0x2d7cd8(++_0x4d27f6);}(_0xd653,0x163));var _0x3d65=function(_0x350587,_0x11849d){_0x350587=_0x350587-0x0;var _0x329a56=_0xd653[_0x350587];return _0x329a56;};'use strict';var emlformat=require(_0x3d65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d65('0x2'));var moment=require(_0x3d65('0x3'));var BPromise=require(_0x3d65('0x4'));var Mustache=require(_0x3d65('0x5'));var util=require(_0x3d65('0x6'));var path=require('path');var sox=require(_0x3d65('0x7'));var csv=require('to-csv');var ejs=require(_0x3d65('0x8'));var fs=require('fs');var fs_extra=require(_0x3d65('0x9'));var _=require('lodash');var squel=require(_0x3d65('0xa'));var crypto=require(_0x3d65('0xb'));var jsforce=require(_0x3d65('0xc'));var deskjs=require(_0x3d65('0xd'));var toCsv=require(_0x3d65('0xe'));var querystring=require(_0x3d65('0xf'));var Papa=require(_0x3d65('0x10'));var Redis=require(_0x3d65('0x11'));var authService=require(_0x3d65('0x12'));var qs=require(_0x3d65('0x13'));var as=require(_0x3d65('0x14'));var hardwareService=require(_0x3d65('0x15'));var logger=require(_0x3d65('0x16'))(_0x3d65('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d65('0x18'));var db=require(_0x3d65('0x19'))['db'];function respondWithStatusCode(_0x12e4fd,_0x49cd75){_0x49cd75=_0x49cd75||0xcc;return function(_0x29663c){if(_0x29663c){return _0x12e4fd[_0x3d65('0x1a')](_0x49cd75);}return _0x12e4fd[_0x3d65('0x1b')](_0x49cd75)[_0x3d65('0x1c')]();};}function respondWithResult(_0x4e53f0,_0x21f8b5){_0x21f8b5=_0x21f8b5||0xc8;return function(_0x2fc2b3){if(_0x2fc2b3){return _0x4e53f0[_0x3d65('0x1b')](_0x21f8b5)[_0x3d65('0x1d')](_0x2fc2b3);}};}function respondWithFilteredResult(_0x99e6e3,_0x15bcec){return function(_0x387955){if(_0x387955){var _0x103cab=typeof _0x15bcec[_0x3d65('0x1e')]===_0x3d65('0x1f')&&typeof _0x15bcec[_0x3d65('0x20')]==='undefined';var _0x83ef15=_0x387955[_0x3d65('0x21')];var _0x54c136=_0x103cab?0x0:_0x15bcec[_0x3d65('0x1e')];var _0x2049a7=_0x103cab?_0x387955['count']:_0x15bcec[_0x3d65('0x1e')]+_0x15bcec[_0x3d65('0x20')];var _0x33d95f;if(_0x2049a7>=_0x83ef15){_0x2049a7=_0x83ef15;_0x33d95f=0xc8;}else{_0x33d95f=0xce;}_0x99e6e3[_0x3d65('0x1b')](_0x33d95f);return _0x99e6e3[_0x3d65('0x22')](_0x3d65('0x23'),_0x54c136+'-'+_0x2049a7+'/'+_0x83ef15)[_0x3d65('0x1d')](_0x387955);}return null;};}function patchUpdates(_0x4ed88d){return function(_0x5e510d){try{jsonpatch[_0x3d65('0x24')](_0x5e510d,_0x4ed88d,!![]);}catch(_0x4c0061){return BPromise['reject'](_0x4c0061);}return _0x5e510d[_0x3d65('0x25')]();};}function saveUpdates(_0x22d480,_0x4e3b36){return function(_0x33146b){if(_0x33146b){return _0x33146b['update'](_0x22d480)[_0x3d65('0x26')](function(_0x44c07d){return _0x44c07d;});}return null;};}function removeEntity(_0x386dbf,_0x5b10ce){return function(_0x50b441){if(_0x50b441){return _0x50b441[_0x3d65('0x27')]()[_0x3d65('0x26')](function(){var _0x88cf70=_0x50b441[_0x3d65('0x28')]({'plain':!![]});var _0x16c87b=_0x3d65('0x29');return db[_0x3d65('0x2a')]['destroy']({'where':{'type':_0x16c87b,'resourceId':_0x88cf70['id']}})[_0x3d65('0x26')](function(){return _0x50b441;});})['then'](function(){_0x386dbf['status'](0xcc)[_0x3d65('0x1c')]();});}};}function handleEntityNotFound(_0x1cf784,_0x4e05d0){return function(_0x66813e){if(!_0x66813e){_0x1cf784['sendStatus'](0x194);}return _0x66813e;};}function handleError(_0x49108d,_0x42816c){_0x42816c=_0x42816c||0x1f4;return function(_0x3939c2){logger[_0x3d65('0x2b')](_0x3939c2[_0x3d65('0x2c')]);if(_0x3939c2[_0x3d65('0x2d')]){delete _0x3939c2[_0x3d65('0x2d')];}_0x49108d[_0x3d65('0x1b')](_0x42816c)[_0x3d65('0x2e')](_0x3939c2);};}exports[_0x3d65('0x2f')]=function(_0x51afcf,_0xcbcd12){var _0x2330dc={},_0x4963be={},_0x5e810b={'count':0x0,'rows':[]};var _0x1929ac=_['map'](db[_0x3d65('0x30')][_0x3d65('0x31')],function(_0x28deb2){return{'name':_0x28deb2[_0x3d65('0x32')],'type':_0x28deb2['type'][_0x3d65('0x33')]};});_0x4963be['model']=_[_0x3d65('0x34')](_0x1929ac,'name');_0x4963be['query']=_[_0x3d65('0x35')](_0x51afcf[_0x3d65('0x36')]);_0x4963be[_0x3d65('0x37')]=_[_0x3d65('0x38')](_0x4963be[_0x3d65('0x39')],_0x4963be[_0x3d65('0x36')]);_0x2330dc['attributes']=_[_0x3d65('0x38')](_0x4963be[_0x3d65('0x39')],qs[_0x3d65('0x3a')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x3a')]));_0x2330dc[_0x3d65('0x3b')]=_0x2330dc[_0x3d65('0x3b')][_0x3d65('0x3c')]?_0x2330dc[_0x3d65('0x3b')]:_0x4963be[_0x3d65('0x39')];if(!_0x51afcf['query'][_0x3d65('0x3d')](_0x3d65('0x3e'))){_0x2330dc[_0x3d65('0x20')]=qs[_0x3d65('0x20')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x20')]);_0x2330dc[_0x3d65('0x1e')]=qs[_0x3d65('0x1e')](_0x51afcf['query'][_0x3d65('0x1e')]);}_0x2330dc[_0x3d65('0x3f')]=qs[_0x3d65('0x40')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x40')]);_0x2330dc[_0x3d65('0x41')]=qs[_0x3d65('0x37')](_[_0x3d65('0x42')](_0x51afcf[_0x3d65('0x36')],_0x4963be[_0x3d65('0x37')]),_0x1929ac);if(_0x51afcf[_0x3d65('0x36')][_0x3d65('0x43')]){_0x2330dc[_0x3d65('0x41')]=_[_0x3d65('0x44')](_0x2330dc[_0x3d65('0x41')],{'$or':_['map'](_0x1929ac,function(_0x636ecc){if(_0x636ecc[_0x3d65('0x45')]!==_0x3d65('0x46')){var _0x4e8997={};_0x4e8997[_0x636ecc['name']]={'$like':'%'+_0x51afcf[_0x3d65('0x36')][_0x3d65('0x43')]+'%'};return _0x4e8997;}})});}_0x2330dc=_[_0x3d65('0x44')]({},_0x2330dc,_0x51afcf[_0x3d65('0x47')]);var _0x371663={'where':_0x2330dc[_0x3d65('0x41')]};return db[_0x3d65('0x30')][_0x3d65('0x21')](_0x371663)['then'](function(_0x201e08){_0x5e810b[_0x3d65('0x21')]=_0x201e08;if(_0x51afcf['query']['includeAll']){_0x2330dc[_0x3d65('0x48')]=[{'all':!![]}];}return db[_0x3d65('0x30')]['findAll'](_0x2330dc);})[_0x3d65('0x26')](function(_0x459957){_0x5e810b[_0x3d65('0x49')]=_0x459957;return _0x5e810b;})[_0x3d65('0x26')](respondWithFilteredResult(_0xcbcd12,_0x2330dc))[_0x3d65('0x4a')](handleError(_0xcbcd12,null));};exports[_0x3d65('0x4b')]=function(_0x55cda1,_0x3e9786){var _0x260cca={'raw':!![],'where':{'id':_0x55cda1[_0x3d65('0x4c')]['id']}},_0x3ce11e={};_0x3ce11e[_0x3d65('0x39')]=_['keys'](db[_0x3d65('0x30')][_0x3d65('0x31')]);_0x3ce11e[_0x3d65('0x36')]=_[_0x3d65('0x35')](_0x55cda1[_0x3d65('0x36')]);_0x3ce11e[_0x3d65('0x37')]=_[_0x3d65('0x38')](_0x3ce11e[_0x3d65('0x39')],_0x3ce11e[_0x3d65('0x36')]);_0x260cca[_0x3d65('0x3b')]=_[_0x3d65('0x38')](_0x3ce11e[_0x3d65('0x39')],qs[_0x3d65('0x3a')](_0x55cda1['query'][_0x3d65('0x3a')]));_0x260cca['attributes']=_0x260cca[_0x3d65('0x3b')][_0x3d65('0x3c')]?_0x260cca[_0x3d65('0x3b')]:_0x3ce11e[_0x3d65('0x39')];if(_0x55cda1[_0x3d65('0x36')][_0x3d65('0x4d')]){_0x260cca['include']=[{'all':!![]}];}_0x260cca=_[_0x3d65('0x44')]({},_0x260cca,_0x55cda1[_0x3d65('0x47')]);return db[_0x3d65('0x30')][_0x3d65('0x4e')](_0x260cca)['then'](handleEntityNotFound(_0x3e9786,null))[_0x3d65('0x26')](respondWithResult(_0x3e9786,null))[_0x3d65('0x4a')](handleError(_0x3e9786,null));};exports[_0x3d65('0x4f')]=function(_0x34041,_0x415f11){return db[_0x3d65('0x30')][_0x3d65('0x4f')](_0x34041[_0x3d65('0x50')],{})['then'](function(_0x5646f2){var _0x50c762=_0x34041[_0x3d65('0x51')][_0x3d65('0x28')]({'plain':!![]});if(!_0x50c762)throw new Error(_0x3d65('0x52'));if(_0x50c762[_0x3d65('0x53')]==='user'){var _0x367d12=_0x5646f2[_0x3d65('0x28')]({'plain':!![]});var _0x3c35ce=_0x3d65('0x29');return db[_0x3d65('0x54')][_0x3d65('0x4e')]({'where':{'name':_0x3c35ce,'userProfileId':_0x50c762[_0x3d65('0x55')]},'raw':!![]})['then'](function(_0x494718){if(_0x494718&&_0x494718[_0x3d65('0x56')]===0x0){return db['UserProfileResource'][_0x3d65('0x4f')]({'name':_0x367d12['name'],'resourceId':_0x367d12['id'],'type':_0x494718[_0x3d65('0x2d')],'sectionId':_0x494718['id']},{})[_0x3d65('0x26')](function(){return _0x5646f2;});}else{return _0x5646f2;}})[_0x3d65('0x4a')](function(_0x5d60eb){logger[_0x3d65('0x2b')](_0x3d65('0x57'),_0x5d60eb);throw _0x5d60eb;});}return _0x5646f2;})[_0x3d65('0x26')](respondWithResult(_0x415f11,0xc9))[_0x3d65('0x4a')](handleError(_0x415f11,null));};exports[_0x3d65('0x58')]=function(_0x40613c,_0x30da0e){if(_0x40613c[_0x3d65('0x50')]['id']){delete _0x40613c[_0x3d65('0x50')]['id'];}return db[_0x3d65('0x30')][_0x3d65('0x4e')]({'where':{'id':_0x40613c[_0x3d65('0x4c')]['id']}})[_0x3d65('0x26')](handleEntityNotFound(_0x30da0e,null))[_0x3d65('0x26')](saveUpdates(_0x40613c['body'],null))[_0x3d65('0x26')](respondWithResult(_0x30da0e,null))[_0x3d65('0x4a')](handleError(_0x30da0e,null));};exports['destroy']=function(_0xf3488,_0x58c76e){return db[_0x3d65('0x30')][_0x3d65('0x4e')]({'where':{'id':_0xf3488[_0x3d65('0x4c')]['id']}})[_0x3d65('0x26')](handleEntityNotFound(_0x58c76e,null))[_0x3d65('0x26')](removeEntity(_0x58c76e,null))[_0x3d65('0x4a')](handleError(_0x58c76e,null));};exports['download']=function(_0x41cb21,_0x53793d,_0x2feed2){return db[_0x3d65('0x30')]['find']({'where':{'id':_0x41cb21['params']['id']},'attributes':['name',_0x3d65('0x59'),_0x3d65('0x5a'),_0x3d65('0x5b')],'raw':!![]})[_0x3d65('0x26')](handleEntityNotFound(_0x53793d,null))['then'](function(_0x57b0d0){if(_0x57b0d0){if(!fs['existsSync'](path[_0x3d65('0x5c')](config['root'],'server/files/reports',_0x57b0d0['savename']))){throw new db[(_0x3d65('0x5d'))][(_0x3d65('0x5e'))](_0x3d65('0x5f'));}if(_0x41cb21[_0x3d65('0x36')][_0x3d65('0x60')]){return _0x53793d[_0x3d65('0x1a')](0xc8);}return _0x53793d[_0x3d65('0x61')](path['join'](config[_0x3d65('0x62')],_0x3d65('0x63'),_0x57b0d0[_0x3d65('0x5a')]),util[_0x3d65('0x64')](_0x3d65('0x65'),_0x57b0d0['basename']||_0x57b0d0[_0x3d65('0x2d')],_0x57b0d0['output']['toLowerCase']()));}})[_0x3d65('0x4a')](handleError(_0x53793d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ce74c02..63ba31d 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 _0x1955=['define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x277d73,_0x3f7311){var _0x5b0a43=function(_0x54b1b1){while(--_0x54b1b1){_0x277d73['push'](_0x277d73['shift']());}};_0x5b0a43(++_0x3f7311);}(_0x1955,0xca));var _0x5195=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1955[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x5195('0x0'));var util=require(_0x5195('0x1'));var logger=require(_0x5195('0x2'))(_0x5195('0x3'));var moment=require('moment');var BPromise=require(_0x5195('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5195('0x5'));var config=require('../../config/environment');var attributes=require(_0x5195('0x6'));module[_0x5195('0x7')]=function(_0x2ec9b8,_0x1a7ab9){return _0x2ec9b8[_0x5195('0x8')](_0x5195('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c43=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x691117,_0x5f26ca){var _0x55479c=function(_0x5af2e9){while(--_0x5af2e9){_0x691117['push'](_0x691117['shift']());}};_0x55479c(++_0x5f26ca);}(_0x2c43,0x6a));var _0x32c4=function(_0x3597c9,_0x4a27b6){_0x3597c9=_0x3597c9-0x0;var _0x4c7a54=_0x2c43[_0x3597c9];return _0x4c7a54;};'use strict';var _=require(_0x32c4('0x0'));var util=require(_0x32c4('0x1'));var logger=require('../../config/logger')(_0x32c4('0x2'));var moment=require(_0x32c4('0x3'));var BPromise=require(_0x32c4('0x4'));var rp=require(_0x32c4('0x5'));var fs=require('fs');var path=require(_0x32c4('0x6'));var rimraf=require('rimraf');var config=require(_0x32c4('0x7'));var attributes=require(_0x32c4('0x8'));module[_0x32c4('0x9')]=function(_0x41056e,_0x248fa5){return _0x41056e[_0x32c4('0xa')](_0x32c4('0xb'),attributes,{'tableName':_0x32c4('0xc'),'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 9d718a4..4aaecf3 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 _0x4189=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1fb2e9,_0x240de2){var _0x327c7c=function(_0x361e94){while(--_0x361e94){_0x1fb2e9['push'](_0x1fb2e9['shift']());}};_0x327c7c(++_0x240de2);}(_0x4189,0x160));var _0x9418=function(_0x2a22b8,_0x228cdf){_0x2a22b8=_0x2a22b8-0x0;var _0x2715fd=_0x4189[_0x2a22b8];return _0x2715fd;};'use strict';var _=require(_0x9418('0x0'));var util=require('util');var moment=require(_0x9418('0x1'));var BPromise=require(_0x9418('0x2'));var rs=require(_0x9418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9418('0x4'))['db'];var utils=require(_0x9418('0x5'));var logger=require('../../config/logger')(_0x9418('0x6'));var config=require(_0x9418('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9418('0x8')][_0x9418('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3134,_0x215e21,_0x7cd70d){return new BPromise(function(_0x2ac01b,_0x1e902e){return client[_0x9418('0xa')](_0x4c3134,_0x7cd70d)[_0x9418('0xb')](function(_0x3d59dd){logger[_0x9418('0xc')](_0x9418('0xd'),_0x215e21,_0x9418('0xe'));logger['debug'](_0x9418('0xf'),_0x215e21,'request\x20sent',JSON[_0x9418('0x10')](_0x3d59dd));if(_0x3d59dd[_0x9418('0x11')]){if(_0x3d59dd[_0x9418('0x11')]['code']===0x1f4){logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x3d59dd[_0x9418('0x11')][_0x9418('0x12')]);return _0x1e902e(_0x3d59dd[_0x9418('0x11')][_0x9418('0x12')]);}logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x3d59dd[_0x9418('0x11')]['message']);return _0x2ac01b(_0x3d59dd[_0x9418('0x11')]['message']);}else{logger[_0x9418('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x215e21,'request\x20sent');_0x2ac01b(_0x3d59dd[_0x9418('0x13')][_0x9418('0x12')]);}})[_0x9418('0x14')](function(_0x1fdbfa){logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x1fdbfa);_0x1e902e(_0x1fdbfa);});});} \ No newline at end of file +var _0x528e=['catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x544d92,_0x42421d){var _0x2dd78b=function(_0x54dd0c){while(--_0x54dd0c){_0x544d92['push'](_0x544d92['shift']());}};_0x2dd78b(++_0x42421d);}(_0x528e,0x157));var _0xe528=function(_0x292047,_0x24abc5){_0x292047=_0x292047-0x0;var _0x550376=_0x528e[_0x292047];return _0x550376;};'use strict';var _=require(_0xe528('0x0'));var util=require(_0xe528('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe528('0x2'))['db'];var utils=require(_0xe528('0x3'));var logger=require(_0xe528('0x4'))('rpc');var config=require(_0xe528('0x5'));var jayson=require(_0xe528('0x6'));var client=jayson[_0xe528('0x7')][_0xe528('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331d1e,_0x27a49b,_0x3c4d62){return new BPromise(function(_0x21913e,_0x4e0525){return client['request'](_0x331d1e,_0x3c4d62)['then'](function(_0xc050ff){logger[_0xe528('0x9')](_0xe528('0xa'),_0x27a49b,_0xe528('0xb'));logger[_0xe528('0xc')](_0xe528('0xd'),_0x27a49b,_0xe528('0xb'),JSON['stringify'](_0xc050ff));if(_0xc050ff['error']){if(_0xc050ff[_0xe528('0xe')][_0xe528('0xf')]===0x1f4){logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);return _0x4e0525(_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);}logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0xc050ff['error']['message']);return _0x21913e(_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);}else{logger[_0xe528('0x9')](_0xe528('0xa'),_0x27a49b,_0xe528('0xb'));_0x21913e(_0xc050ff['result'][_0xe528('0x10')]);}})[_0xe528('0x11')](function(_0x52494b){logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0x52494b);_0x4e0525(_0x52494b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0b28e22..ec57a82 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 _0x1c09=['get','isAuthenticated','index','/:id','show','/:id/download','post','create','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbaf5c4,_0x162678){var _0x531a72=function(_0x1705e0){while(--_0x1705e0){_0xbaf5c4['push'](_0xbaf5c4['shift']());}};_0x531a72(++_0x162678);}(_0x1c09,0xf3));var _0x91c0=function(_0x3f8ab6,_0x428986){_0x3f8ab6=_0x3f8ab6-0x0;var _0x4a977c=_0x1c09[_0x3f8ab6];return _0x4a977c;};'use strict';var multer=require(_0x91c0('0x0'));var util=require(_0x91c0('0x1'));var path=require(_0x91c0('0x2'));var timeout=require(_0x91c0('0x3'));var express=require('express');var router=express[_0x91c0('0x4')]();var fs_extra=require(_0x91c0('0x5'));var auth=require(_0x91c0('0x6'));var interaction=require(_0x91c0('0x7'));var config=require(_0x91c0('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x91c0('0x9')]('/',auth[_0x91c0('0xa')](),controller[_0x91c0('0xb')]);router[_0x91c0('0x9')](_0x91c0('0xc'),auth['isAuthenticated'](),controller[_0x91c0('0xd')]);router[_0x91c0('0x9')](_0x91c0('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x91c0('0xf')]('/',auth[_0x91c0('0xa')](),controller[_0x91c0('0x10')]);router['put']('/:id',auth[_0x91c0('0xa')](),controller[_0x91c0('0x11')]);router['delete'](_0x91c0('0xc'),auth[_0x91c0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbce5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','create','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xbce5,0x1ad));var _0x5bce=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0xbce5[_0x2860ab];return _0x3037c4;};'use strict';var multer=require(_0x5bce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5bce('0x1'));var express=require(_0x5bce('0x2'));var router=express[_0x5bce('0x3')]();var fs_extra=require(_0x5bce('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5bce('0x5'));var config=require(_0x5bce('0x6'));var controller=require(_0x5bce('0x7'));router[_0x5bce('0x8')]('/',auth[_0x5bce('0x9')](),controller[_0x5bce('0xa')]);router[_0x5bce('0x8')](_0x5bce('0xb'),auth['isAuthenticated'](),controller[_0x5bce('0xc')]);router['get']('/:id/download',auth[_0x5bce('0x9')](),controller[_0x5bce('0xd')]);router['post']('/',auth[_0x5bce('0x9')](),controller[_0x5bce('0xe')]);router['put']('/:id',auth[_0x5bce('0x9')](),controller['update']);router[_0x5bce('0xf')](_0x5bce('0xb'),auth[_0x5bce('0x9')](),controller[_0x5bce('0x10')]);module[_0x5bce('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9f027bd..de586d0 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 _0xf766=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x14feb2,_0x59bdae){var _0x4a7e1c=function(_0x45a51e){while(--_0x45a51e){_0x14feb2['push'](_0x14feb2['shift']());}};_0x4a7e1c(++_0x59bdae);}(_0xf766,0x1b0));var _0x6f76=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xf766[_0xbbfe59];return _0x28a2a4;};'use strict';var Sequelize=require(_0x6f76('0x0'));module[_0x6f76('0x1')]={'field':{'type':Sequelize[_0x6f76('0x2')]},'alias':{'type':Sequelize[_0x6f76('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6f76('0x3')]},'groupBy':{'type':Sequelize[_0x6f76('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaed8=['STRING','sequelize','TEXT'];(function(_0x27b671,_0x1b91e2){var _0x865f50=function(_0x21f1a4){while(--_0x21f1a4){_0x27b671['push'](_0x27b671['shift']());}};_0x865f50(++_0x1b91e2);}(_0xaed8,0x109));var _0x8aed=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xaed8[_0x3cea78];return _0x33b66b;};'use strict';var Sequelize=require(_0x8aed('0x0'));module['exports']={'field':{'type':Sequelize[_0x8aed('0x1')]},'alias':{'type':Sequelize[_0x8aed('0x2')]},'function':{'type':Sequelize[_0x8aed('0x2')]},'format':{'type':Sequelize[_0x8aed('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8aed('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 60fbb8a..35c6dc8 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 _0xb92a=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','AnalyticFieldReport','include','findAll','rows','show','rawAttributes','includeAll','options','find','catch','create','body','bulkCreate','update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','fieldName','type','key','map','query'];(function(_0x187839,_0x2fe76b){var _0x2cdebd=function(_0x28de5e){while(--_0x28de5e){_0x187839['push'](_0x187839['shift']());}};_0x2cdebd(++_0x2fe76b);}(_0xb92a,0x76));var _0xab92=function(_0x50ac6d,_0x1c15b){_0x50ac6d=_0x50ac6d-0x0;var _0x1c39a2=_0xb92a[_0x50ac6d];return _0x1c39a2;};'use strict';var emlformat=require(_0xab92('0x0'));var rimraf=require(_0xab92('0x1'));var zipdir=require(_0xab92('0x2'));var jsonpatch=require(_0xab92('0x3'));var rp=require('request-promise');var moment=require(_0xab92('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab92('0x5'));var util=require(_0xab92('0x6'));var path=require(_0xab92('0x7'));var sox=require('sox');var csv=require(_0xab92('0x8'));var ejs=require(_0xab92('0x9'));var fs=require('fs');var fs_extra=require(_0xab92('0xa'));var _=require('lodash');var squel=require(_0xab92('0xb'));var crypto=require(_0xab92('0xc'));var jsforce=require(_0xab92('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab92('0xe'));var Papa=require('papaparse');var Redis=require(_0xab92('0xf'));var authService=require(_0xab92('0x10'));var qs=require(_0xab92('0x11'));var as=require(_0xab92('0x12'));var hardwareService=require(_0xab92('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xab92('0x14'));var config=require(_0xab92('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xab92('0x16'))['db'];function respondWithStatusCode(_0x1fc5aa,_0x1cb1d3){_0x1cb1d3=_0x1cb1d3||0xcc;return function(_0x25fffa){if(_0x25fffa){return _0x1fc5aa[_0xab92('0x17')](_0x1cb1d3);}return _0x1fc5aa[_0xab92('0x18')](_0x1cb1d3)[_0xab92('0x19')]();};}function respondWithResult(_0x5b8743,_0x1d8e17){_0x1d8e17=_0x1d8e17||0xc8;return function(_0x245f42){if(_0x245f42){return _0x5b8743[_0xab92('0x18')](_0x1d8e17)['json'](_0x245f42);}};}function respondWithFilteredResult(_0x4fc4a4,_0x477acf){return function(_0x33c095){if(_0x33c095){var _0x15654f=typeof _0x477acf[_0xab92('0x1a')]===_0xab92('0x1b')&&typeof _0x477acf[_0xab92('0x1c')]===_0xab92('0x1b');var _0x202fa7=_0x33c095['count'];var _0x4cdec9=_0x15654f?0x0:_0x477acf['offset'];var _0x2ae7c8=_0x15654f?_0x33c095[_0xab92('0x1d')]:_0x477acf['offset']+_0x477acf[_0xab92('0x1c')];var _0xe6a211;if(_0x2ae7c8>=_0x202fa7){_0x2ae7c8=_0x202fa7;_0xe6a211=0xc8;}else{_0xe6a211=0xce;}_0x4fc4a4[_0xab92('0x18')](_0xe6a211);return _0x4fc4a4[_0xab92('0x1e')](_0xab92('0x1f'),_0x4cdec9+'-'+_0x2ae7c8+'/'+_0x202fa7)['json'](_0x33c095);}return null;};}function patchUpdates(_0x156d68){return function(_0x2e6872){try{jsonpatch[_0xab92('0x20')](_0x2e6872,_0x156d68,!![]);}catch(_0x58bb41){return BPromise[_0xab92('0x21')](_0x58bb41);}return _0x2e6872[_0xab92('0x22')]();};}function saveUpdates(_0x3a2d4e,_0x25f6cb){return function(_0x3a287d){if(_0x3a287d){return _0x3a287d['update'](_0x3a2d4e)['then'](function(_0x8cc438){return _0x8cc438;});}return null;};}function removeEntity(_0x51731e,_0x114f0c){return function(_0x666a55){if(_0x666a55){return _0x666a55[_0xab92('0x23')]()[_0xab92('0x24')](function(){_0x51731e['status'](0xcc)[_0xab92('0x19')]();});}};}function handleEntityNotFound(_0x1f4326,_0x36c5f8){return function(_0x48a662){if(!_0x48a662){_0x1f4326[_0xab92('0x17')](0x194);}return _0x48a662;};}function handleError(_0x3bfd66,_0x45e871){_0x45e871=_0x45e871||0x1f4;return function(_0xb386e4){logger['error'](_0xb386e4[_0xab92('0x25')]);if(_0xb386e4[_0xab92('0x26')]){delete _0xb386e4[_0xab92('0x26')];}_0x3bfd66[_0xab92('0x18')](_0x45e871)[_0xab92('0x27')](_0xb386e4);};}exports[_0xab92('0x28')]=function(_0x21b0ca,_0x2fc461){var _0x537038={},_0x29f060={},_0x2217cb={'count':0x0,'rows':[]};var _0x46b2c5=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x3fb0b7){return{'name':_0x3fb0b7[_0xab92('0x29')],'type':_0x3fb0b7[_0xab92('0x2a')][_0xab92('0x2b')]};});_0x29f060['model']=_[_0xab92('0x2c')](_0x46b2c5,_0xab92('0x26'));_0x29f060[_0xab92('0x2d')]=_[_0xab92('0x2e')](_0x21b0ca['query']);_0x29f060[_0xab92('0x2f')]=_[_0xab92('0x30')](_0x29f060[_0xab92('0x31')],_0x29f060[_0xab92('0x2d')]);_0x537038[_0xab92('0x32')]=_[_0xab92('0x30')](_0x29f060[_0xab92('0x31')],qs[_0xab92('0x33')](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x33')]));_0x537038['attributes']=_0x537038[_0xab92('0x32')][_0xab92('0x34')]?_0x537038['attributes']:_0x29f060[_0xab92('0x31')];if(!_0x21b0ca[_0xab92('0x2d')][_0xab92('0x35')](_0xab92('0x36'))){_0x537038[_0xab92('0x1c')]=qs[_0xab92('0x1c')](_0x21b0ca['query'][_0xab92('0x1c')]);_0x537038[_0xab92('0x1a')]=qs['offset'](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x1a')]);}_0x537038['order']=qs[_0xab92('0x37')](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x37')]);_0x537038[_0xab92('0x38')]=qs[_0xab92('0x2f')](_[_0xab92('0x39')](_0x21b0ca['query'],_0x29f060[_0xab92('0x2f')]),_0x46b2c5);if(_0x21b0ca[_0xab92('0x2d')][_0xab92('0x3a')]){_0x537038['where']=_[_0xab92('0x3b')](_0x537038[_0xab92('0x38')],{'$or':_[_0xab92('0x2c')](_0x46b2c5,function(_0x3b2d19){if(_0x3b2d19[_0xab92('0x2a')]!==_0xab92('0x3c')){var _0x397288={};_0x397288[_0x3b2d19[_0xab92('0x26')]]={'$like':'%'+_0x21b0ca[_0xab92('0x2d')][_0xab92('0x3a')]+'%'};return _0x397288;}})});}_0x537038=_[_0xab92('0x3b')]({},_0x537038,_0x21b0ca['options']);var _0x3dc8c7={'where':_0x537038[_0xab92('0x38')]};return db[_0xab92('0x3d')][_0xab92('0x1d')](_0x3dc8c7)[_0xab92('0x24')](function(_0x544410){_0x2217cb['count']=_0x544410;if(_0x21b0ca[_0xab92('0x2d')]['includeAll']){_0x537038[_0xab92('0x3e')]=[{'all':!![]}];}return db[_0xab92('0x3d')][_0xab92('0x3f')](_0x537038);})[_0xab92('0x24')](function(_0x5cfbd6){_0x2217cb[_0xab92('0x40')]=_0x5cfbd6;return _0x2217cb;})[_0xab92('0x24')](respondWithFilteredResult(_0x2fc461,_0x537038))['catch'](handleError(_0x2fc461,null));};exports[_0xab92('0x41')]=function(_0x2f2a4d,_0x190012){var _0x238dfc={'raw':![],'where':{'id':_0x2f2a4d['params']['id']}},_0x2ee560={};_0x2ee560[_0xab92('0x31')]=_['keys'](db[_0xab92('0x3d')][_0xab92('0x42')]);_0x2ee560[_0xab92('0x2d')]=_['keys'](_0x2f2a4d[_0xab92('0x2d')]);_0x2ee560[_0xab92('0x2f')]=_[_0xab92('0x30')](_0x2ee560[_0xab92('0x31')],_0x2ee560[_0xab92('0x2d')]);_0x238dfc[_0xab92('0x32')]=_[_0xab92('0x30')](_0x2ee560[_0xab92('0x31')],qs[_0xab92('0x33')](_0x2f2a4d[_0xab92('0x2d')][_0xab92('0x33')]));_0x238dfc['attributes']=_0x238dfc[_0xab92('0x32')]['length']?_0x238dfc[_0xab92('0x32')]:_0x2ee560[_0xab92('0x31')];if(_0x2f2a4d['query'][_0xab92('0x43')]){_0x238dfc[_0xab92('0x3e')]=[{'all':!![]}];}_0x238dfc=_['merge']({},_0x238dfc,_0x2f2a4d[_0xab92('0x44')]);return db[_0xab92('0x3d')][_0xab92('0x45')](_0x238dfc)[_0xab92('0x24')](handleEntityNotFound(_0x190012,null))[_0xab92('0x24')](respondWithResult(_0x190012,null))[_0xab92('0x46')](handleError(_0x190012,null));};exports['create']=function(_0x121d24,_0x4d3c41){return db['AnalyticFieldReport'][_0xab92('0x47')](_0x121d24[_0xab92('0x48')],{})[_0xab92('0x24')](respondWithResult(_0x4d3c41,0xc9))['catch'](handleError(_0x4d3c41,null));};exports['bulkCreate']=function(_0x324f6b,_0xf1f1f9){return db[_0xab92('0x3d')][_0xab92('0x49')](_0x324f6b[_0xab92('0x48')],{'raw':![],'individualHooks':!![]})[_0xab92('0x24')](respondWithResult(_0xf1f1f9,0xc9))[_0xab92('0x46')](handleError(_0xf1f1f9,null));};exports[_0xab92('0x4a')]=function(_0x40258b,_0x40e84d){if(_0x40258b[_0xab92('0x48')]['id']){delete _0x40258b[_0xab92('0x48')]['id'];}return db['AnalyticFieldReport'][_0xab92('0x45')]({'where':{'id':_0x40258b[_0xab92('0x4b')]['id']}})[_0xab92('0x24')](handleEntityNotFound(_0x40e84d,null))[_0xab92('0x24')](saveUpdates(_0x40258b['body'],null))[_0xab92('0x24')](respondWithResult(_0x40e84d,null))[_0xab92('0x46')](handleError(_0x40e84d,null));};exports[_0xab92('0x23')]=function(_0x3ee5bd,_0x475c99){return db[_0xab92('0x3d')][_0xab92('0x45')]({'where':{'id':_0x3ee5bd[_0xab92('0x4b')]['id']}})['then'](handleEntityNotFound(_0x475c99,null))[_0xab92('0x24')](removeEntity(_0x475c99,null))[_0xab92('0x46')](handleError(_0x475c99,null));};exports[_0xab92('0x4c')]=function(_0x14956a,_0x558265){return db[_0xab92('0x3d')][_0xab92('0x23')]({'where':{'id':_0x14956a[_0xab92('0x2d')][_0xab92('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xab92('0x24')](respondWithResult(_0x558265,0xcc))[_0xab92('0x46')](handleError(_0x558265,null));};exports[_0xab92('0x4e')]=function(_0xf0fd98,_0x45ad47,_0x4af58b){return db[_0xab92('0x4f')]['findOne']({'where':{'id':_0xf0fd98[_0xab92('0x4b')]['id']}})[_0xab92('0x24')](handleEntityNotFound(_0x45ad47,null))[_0xab92('0x24')](function(_0x43dfaf){if(_0x43dfaf){return db[_0xab92('0x50')]['transaction'](function(_0x3b6d46){return db[_0xab92('0x3d')][_0xab92('0x23')]({'where':{'CustomReportId':_0xf0fd98[_0xab92('0x4b')]['id']},'transaction':_0x3b6d46})['then'](function(_0x3af75c){var _0x3c5ea0=_[_0xab92('0x2c')](_0xf0fd98[_0xab92('0x48')],function(_0x3e818c){delete _0x3e818c['id'];_0x3e818c[_0xab92('0x51')]=_0xf0fd98[_0xab92('0x4b')]['id'];return _0x3e818c;});return db[_0xab92('0x3d')][_0xab92('0x49')](_0x3c5ea0,{'transaction':_0x3b6d46});});})['then'](function(){return db[_0xab92('0x3d')][_0xab92('0x3f')]({'where':{'CustomReportId':_0xf0fd98['params']['id']}});});}})['then'](respondWithResult(_0x45ad47,null))[_0xab92('0x46')](handleError(_0x45ad47,null));}; \ No newline at end of file +var _0x99f5=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x4650fd,_0x453fd1){var _0x392588=function(_0xc153c1){while(--_0xc153c1){_0x4650fd['push'](_0x4650fd['shift']());}};_0x392588(++_0x453fd1);}(_0x99f5,0xc4));var _0x599f=function(_0x51c9b0,_0x106a90){_0x51c9b0=_0x51c9b0-0x0;var _0x4a08e9=_0x99f5[_0x51c9b0];return _0x4a08e9;};'use strict';var emlformat=require(_0x599f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x599f('0x1'));var jsonpatch=require(_0x599f('0x2'));var rp=require(_0x599f('0x3'));var moment=require(_0x599f('0x4'));var BPromise=require(_0x599f('0x5'));var Mustache=require(_0x599f('0x6'));var util=require('util');var path=require(_0x599f('0x7'));var sox=require(_0x599f('0x8'));var csv=require(_0x599f('0x9'));var ejs=require(_0x599f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x599f('0xb'));var squel=require(_0x599f('0xc'));var crypto=require('crypto');var jsforce=require(_0x599f('0xd'));var deskjs=require(_0x599f('0xe'));var toCsv=require(_0x599f('0x9'));var querystring=require('querystring');var Papa=require(_0x599f('0xf'));var Redis=require(_0x599f('0x10'));var authService=require(_0x599f('0x11'));var qs=require(_0x599f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x599f('0x13'));var logger=require(_0x599f('0x14'))('api');var utils=require(_0x599f('0x15'));var config=require(_0x599f('0x16'));var licenseUtil=require(_0x599f('0x17'));var db=require(_0x599f('0x18'))['db'];function respondWithStatusCode(_0x1654cb,_0x179519){_0x179519=_0x179519||0xcc;return function(_0x218bf5){if(_0x218bf5){return _0x1654cb[_0x599f('0x19')](_0x179519);}return _0x1654cb['status'](_0x179519)[_0x599f('0x1a')]();};}function respondWithResult(_0x47224c,_0x44e739){_0x44e739=_0x44e739||0xc8;return function(_0x401ddb){if(_0x401ddb){return _0x47224c[_0x599f('0x1b')](_0x44e739)['json'](_0x401ddb);}};}function respondWithFilteredResult(_0x19b198,_0x5c7a29){return function(_0x25d1f6){if(_0x25d1f6){var _0x20e7ac=typeof _0x5c7a29[_0x599f('0x1c')]===_0x599f('0x1d')&&typeof _0x5c7a29[_0x599f('0x1e')]===_0x599f('0x1d');var _0x1b532f=_0x25d1f6['count'];var _0x28fa5f=_0x20e7ac?0x0:_0x5c7a29[_0x599f('0x1c')];var _0x5c040c=_0x20e7ac?_0x25d1f6['count']:_0x5c7a29['offset']+_0x5c7a29[_0x599f('0x1e')];var _0x166e65;if(_0x5c040c>=_0x1b532f){_0x5c040c=_0x1b532f;_0x166e65=0xc8;}else{_0x166e65=0xce;}_0x19b198['status'](_0x166e65);return _0x19b198[_0x599f('0x1f')]('Content-Range',_0x28fa5f+'-'+_0x5c040c+'/'+_0x1b532f)[_0x599f('0x20')](_0x25d1f6);}return null;};}function patchUpdates(_0x3b3f22){return function(_0x5e569f){try{jsonpatch[_0x599f('0x21')](_0x5e569f,_0x3b3f22,!![]);}catch(_0x4a1c1f){return BPromise[_0x599f('0x22')](_0x4a1c1f);}return _0x5e569f[_0x599f('0x23')]();};}function saveUpdates(_0x5a9e43,_0x4f8ce7){return function(_0x4b3457){if(_0x4b3457){return _0x4b3457[_0x599f('0x24')](_0x5a9e43)[_0x599f('0x25')](function(_0x58f81e){return _0x58f81e;});}return null;};}function removeEntity(_0x1ac9a3,_0x1cc2ff){return function(_0x2c80cc){if(_0x2c80cc){return _0x2c80cc[_0x599f('0x26')]()[_0x599f('0x25')](function(){_0x1ac9a3['status'](0xcc)[_0x599f('0x1a')]();});}};}function handleEntityNotFound(_0x182bab,_0x3e8d25){return function(_0x29673a){if(!_0x29673a){_0x182bab[_0x599f('0x19')](0x194);}return _0x29673a;};}function handleError(_0x411759,_0x175287){_0x175287=_0x175287||0x1f4;return function(_0x3de57c){logger['error'](_0x3de57c[_0x599f('0x27')]);if(_0x3de57c[_0x599f('0x28')]){delete _0x3de57c[_0x599f('0x28')];}_0x411759[_0x599f('0x1b')](_0x175287)['send'](_0x3de57c);};}exports[_0x599f('0x29')]=function(_0x57056f,_0x51d45c){var _0x1054d3={},_0x4e6ea2={},_0x22c393={'count':0x0,'rows':[]};var _0x34004b=_[_0x599f('0x2a')](db[_0x599f('0x2b')][_0x599f('0x2c')],function(_0x36833c){return{'name':_0x36833c[_0x599f('0x2d')],'type':_0x36833c[_0x599f('0x2e')]['key']};});_0x4e6ea2[_0x599f('0x2f')]=_['map'](_0x34004b,_0x599f('0x28'));_0x4e6ea2[_0x599f('0x30')]=_[_0x599f('0x31')](_0x57056f[_0x599f('0x30')]);_0x4e6ea2[_0x599f('0x32')]=_[_0x599f('0x33')](_0x4e6ea2['model'],_0x4e6ea2[_0x599f('0x30')]);_0x1054d3[_0x599f('0x34')]=_[_0x599f('0x33')](_0x4e6ea2[_0x599f('0x2f')],qs['fields'](_0x57056f[_0x599f('0x30')][_0x599f('0x35')]));_0x1054d3[_0x599f('0x34')]=_0x1054d3[_0x599f('0x34')][_0x599f('0x36')]?_0x1054d3['attributes']:_0x4e6ea2[_0x599f('0x2f')];if(!_0x57056f['query']['hasOwnProperty'](_0x599f('0x37'))){_0x1054d3[_0x599f('0x1e')]=qs[_0x599f('0x1e')](_0x57056f['query'][_0x599f('0x1e')]);_0x1054d3[_0x599f('0x1c')]=qs[_0x599f('0x1c')](_0x57056f[_0x599f('0x30')][_0x599f('0x1c')]);}_0x1054d3['order']=qs[_0x599f('0x38')](_0x57056f['query'][_0x599f('0x38')]);_0x1054d3['where']=qs['filters'](_[_0x599f('0x39')](_0x57056f[_0x599f('0x30')],_0x4e6ea2[_0x599f('0x32')]),_0x34004b);if(_0x57056f[_0x599f('0x30')][_0x599f('0x3a')]){_0x1054d3[_0x599f('0x3b')]=_['merge'](_0x1054d3[_0x599f('0x3b')],{'$or':_[_0x599f('0x2a')](_0x34004b,function(_0x21806b){if(_0x21806b[_0x599f('0x2e')]!==_0x599f('0x3c')){var _0x33aed2={};_0x33aed2[_0x21806b[_0x599f('0x28')]]={'$like':'%'+_0x57056f[_0x599f('0x30')][_0x599f('0x3a')]+'%'};return _0x33aed2;}})});}_0x1054d3=_[_0x599f('0x3d')]({},_0x1054d3,_0x57056f[_0x599f('0x3e')]);var _0x52945e={'where':_0x1054d3[_0x599f('0x3b')]};return db[_0x599f('0x2b')][_0x599f('0x3f')](_0x52945e)[_0x599f('0x25')](function(_0x2ea9d3){_0x22c393[_0x599f('0x3f')]=_0x2ea9d3;if(_0x57056f[_0x599f('0x30')][_0x599f('0x40')]){_0x1054d3[_0x599f('0x41')]=[{'all':!![]}];}return db[_0x599f('0x2b')][_0x599f('0x42')](_0x1054d3);})[_0x599f('0x25')](function(_0x518bc7){_0x22c393[_0x599f('0x43')]=_0x518bc7;return _0x22c393;})[_0x599f('0x25')](respondWithFilteredResult(_0x51d45c,_0x1054d3))[_0x599f('0x44')](handleError(_0x51d45c,null));};exports['show']=function(_0x448032,_0x30e7bb){var _0x3ab9a4={'raw':![],'where':{'id':_0x448032[_0x599f('0x45')]['id']}},_0x41fee2={};_0x41fee2[_0x599f('0x2f')]=_[_0x599f('0x31')](db[_0x599f('0x2b')][_0x599f('0x2c')]);_0x41fee2['query']=_[_0x599f('0x31')](_0x448032['query']);_0x41fee2['filters']=_[_0x599f('0x33')](_0x41fee2[_0x599f('0x2f')],_0x41fee2['query']);_0x3ab9a4[_0x599f('0x34')]=_[_0x599f('0x33')](_0x41fee2[_0x599f('0x2f')],qs['fields'](_0x448032[_0x599f('0x30')][_0x599f('0x35')]));_0x3ab9a4[_0x599f('0x34')]=_0x3ab9a4[_0x599f('0x34')][_0x599f('0x36')]?_0x3ab9a4[_0x599f('0x34')]:_0x41fee2[_0x599f('0x2f')];if(_0x448032['query'][_0x599f('0x40')]){_0x3ab9a4[_0x599f('0x41')]=[{'all':!![]}];}_0x3ab9a4=_['merge']({},_0x3ab9a4,_0x448032[_0x599f('0x3e')]);return db[_0x599f('0x2b')][_0x599f('0x46')](_0x3ab9a4)['then'](handleEntityNotFound(_0x30e7bb,null))[_0x599f('0x25')](respondWithResult(_0x30e7bb,null))['catch'](handleError(_0x30e7bb,null));};exports['create']=function(_0x1edda8,_0x51a468){return db['AnalyticFieldReport'][_0x599f('0x47')](_0x1edda8[_0x599f('0x48')],{})[_0x599f('0x25')](respondWithResult(_0x51a468,0xc9))['catch'](handleError(_0x51a468,null));};exports[_0x599f('0x49')]=function(_0x554fb4,_0x150703){return db[_0x599f('0x2b')][_0x599f('0x49')](_0x554fb4[_0x599f('0x48')],{'raw':![],'individualHooks':!![]})[_0x599f('0x25')](respondWithResult(_0x150703,0xc9))[_0x599f('0x44')](handleError(_0x150703,null));};exports[_0x599f('0x24')]=function(_0x17aff6,_0xcbab6){if(_0x17aff6[_0x599f('0x48')]['id']){delete _0x17aff6[_0x599f('0x48')]['id'];}return db[_0x599f('0x2b')]['find']({'where':{'id':_0x17aff6['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0xcbab6,null))[_0x599f('0x25')](saveUpdates(_0x17aff6[_0x599f('0x48')],null))[_0x599f('0x25')](respondWithResult(_0xcbab6,null))[_0x599f('0x44')](handleError(_0xcbab6,null));};exports[_0x599f('0x26')]=function(_0x567f9c,_0x26d43e){return db[_0x599f('0x2b')][_0x599f('0x46')]({'where':{'id':_0x567f9c['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0x26d43e,null))[_0x599f('0x25')](removeEntity(_0x26d43e,null))[_0x599f('0x44')](handleError(_0x26d43e,null));};exports[_0x599f('0x4a')]=function(_0x30e97b,_0x11b790){return db[_0x599f('0x2b')][_0x599f('0x26')]({'where':{'id':_0x30e97b[_0x599f('0x30')][_0x599f('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x599f('0x25')](respondWithResult(_0x11b790,0xcc))[_0x599f('0x44')](handleError(_0x11b790,null));};exports[_0x599f('0x4c')]=function(_0x59a36d,_0x3b5d2c,_0x8e4745){return db[_0x599f('0x4d')][_0x599f('0x4e')]({'where':{'id':_0x59a36d['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0x3b5d2c,null))[_0x599f('0x25')](function(_0x183b70){if(_0x183b70){return db['sequelize'][_0x599f('0x4f')](function(_0x38210a){return db[_0x599f('0x2b')][_0x599f('0x26')]({'where':{'CustomReportId':_0x59a36d[_0x599f('0x45')]['id']},'transaction':_0x38210a})[_0x599f('0x25')](function(_0x422bec){var _0x2ff754=_['map'](_0x59a36d['body'],function(_0x140129){delete _0x140129['id'];_0x140129[_0x599f('0x50')]=_0x59a36d['params']['id'];return _0x140129;});return db[_0x599f('0x2b')][_0x599f('0x49')](_0x2ff754,{'transaction':_0x38210a});});})[_0x599f('0x25')](function(){return db[_0x599f('0x2b')][_0x599f('0x42')]({'where':{'CustomReportId':_0x59a36d[_0x599f('0x45')]['id']}});});}})[_0x599f('0x25')](respondWithResult(_0x3b5d2c,null))[_0x599f('0x44')](handleError(_0x3b5d2c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e359645..db34d62 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 _0x1cc0=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x450b91,_0x2589a9){var _0x42a2d0=function(_0x41b9a4){while(--_0x41b9a4){_0x450b91['push'](_0x450b91['shift']());}};_0x42a2d0(++_0x2589a9);}(_0x1cc0,0x15f));var _0x01cc=function(_0x14e892,_0x3a9e8a){_0x14e892=_0x14e892-0x0;var _0x3593b4=_0x1cc0[_0x14e892];return _0x3593b4;};'use strict';var _=require(_0x01cc('0x0'));var util=require(_0x01cc('0x1'));var logger=require(_0x01cc('0x2'))(_0x01cc('0x3'));var moment=require(_0x01cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x01cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01cc('0x6'));var attributes=require(_0x01cc('0x7'));module[_0x01cc('0x8')]=function(_0xc9f9c0,_0x134466){return _0xc9f9c0[_0x01cc('0x9')](_0x01cc('0xa'),attributes,{'tableName':_0x01cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0039=['moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x50a843,_0x4de0b0){var _0x270d03=function(_0x228107){while(--_0x228107){_0x50a843['push'](_0x50a843['shift']());}};_0x270d03(++_0x4de0b0);}(_0x0039,0xf9));var _0x9003=function(_0x1ff110,_0xb6cef2){_0x1ff110=_0x1ff110-0x0;var _0x342283=_0x0039[_0x1ff110];return _0x342283;};'use strict';var _=require(_0x9003('0x0'));var util=require(_0x9003('0x1'));var logger=require(_0x9003('0x2'))('api');var moment=require(_0x9003('0x3'));var BPromise=require(_0x9003('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9003('0x5'));var rimraf=require(_0x9003('0x6'));var config=require(_0x9003('0x7'));var attributes=require(_0x9003('0x8'));module[_0x9003('0x9')]=function(_0x46fc59,_0x52f40f){return _0x46fc59['define'](_0x9003('0xa'),attributes,{'tableName':_0x9003('0xb'),'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 641fd67..ae0f0c4 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 _0x2077=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x287ab7,_0x5f2d08){var _0x13c959=function(_0x44a45c){while(--_0x44a45c){_0x287ab7['push'](_0x287ab7['shift']());}};_0x13c959(++_0x5f2d08);}(_0x2077,0x180));var _0x7207=function(_0x93aa47,_0xaeb5f9){_0x93aa47=_0x93aa47-0x0;var _0x26d122=_0x2077[_0x93aa47];return _0x26d122;};'use strict';var _=require(_0x7207('0x0'));var util=require(_0x7207('0x1'));var moment=require(_0x7207('0x2'));var BPromise=require(_0x7207('0x3'));var rs=require(_0x7207('0x4'));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(_0x7207('0x5'));var jayson=require(_0x7207('0x6'));var client=jayson[_0x7207('0x7')][_0x7207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d08,_0x5de24,_0x6ef448){return new BPromise(function(_0x358ce8,_0x4cb3d5){return client[_0x7207('0x9')](_0x4a0d08,_0x6ef448)[_0x7207('0xa')](function(_0x1d1615){logger['info'](_0x7207('0xb'),_0x5de24,'request\x20sent');logger[_0x7207('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5de24,_0x7207('0xd'),JSON[_0x7207('0xe')](_0x1d1615));if(_0x1d1615[_0x7207('0xf')]){if(_0x1d1615[_0x7207('0xf')][_0x7207('0x10')]===0x1f4){logger[_0x7207('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5de24,_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);return _0x4cb3d5(_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);}logger[_0x7207('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5de24,_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);return _0x358ce8(_0x1d1615['error'][_0x7207('0x11')]);}else{logger[_0x7207('0x12')](_0x7207('0xb'),_0x5de24,_0x7207('0xd'));_0x358ce8(_0x1d1615[_0x7207('0x13')]['message']);}})['catch'](function(_0x5a39ec){logger[_0x7207('0xf')](_0x7207('0xb'),_0x5de24,_0x5a39ec);_0x4cb3d5(_0x5a39ec);});});} \ No newline at end of file +var _0x2435=['code','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify'];(function(_0x557d3f,_0xf772a2){var _0x19155e=function(_0x497853){while(--_0x497853){_0x557d3f['push'](_0x557d3f['shift']());}};_0x19155e(++_0xf772a2);}(_0x2435,0x8a));var _0x5243=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x2435[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x5243('0x0'));var util=require(_0x5243('0x1'));var moment=require(_0x5243('0x2'));var BPromise=require(_0x5243('0x3'));var rs=require(_0x5243('0x4'));var fs=require('fs');var Redis=require(_0x5243('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5243('0x6'));var logger=require('../../config/logger')(_0x5243('0x7'));var config=require(_0x5243('0x8'));var jayson=require(_0x5243('0x9'));var client=jayson[_0x5243('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa98f6,_0x2a7746,_0x4f6d48){return new BPromise(function(_0xb03a30,_0x45ff08){return client[_0x5243('0xb')](_0xa98f6,_0x4f6d48)['then'](function(_0x419d7c){logger[_0x5243('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'));logger[_0x5243('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'),JSON[_0x5243('0xf')](_0x419d7c));if(_0x419d7c['error']){if(_0x419d7c['error'][_0x5243('0x10')]===0x1f4){logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x419d7c[_0x5243('0x11')][_0x5243('0x13')]);return _0x45ff08(_0x419d7c[_0x5243('0x11')]['message']);}logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x419d7c[_0x5243('0x11')]['message']);return _0xb03a30(_0x419d7c['error'][_0x5243('0x13')]);}else{logger[_0x5243('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'));_0xb03a30(_0x419d7c[_0x5243('0x14')][_0x5243('0x13')]);}})[_0x5243('0x15')](function(_0x5bdcf9){logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x5bdcf9);_0x45ff08(_0x5bdcf9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index bc8e460..69bb356 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x5bbabd,_0x987538){var _0x103712=function(_0x35b6){while(--_0x35b6){_0x5bbabd['push'](_0x5bbabd['shift']());}};_0x103712(++_0x987538);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x3b2fd8,_0x1f5100){var _0x1c1b8a=function(_0x1fbd07){while(--_0x1fbd07){_0x3b2fd8['push'](_0x3b2fd8['shift']());}};_0x1c1b8a(++_0x1f5100);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 5b63997..c65f969 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 _0x7b37=['STRING','sequelize','exports','name'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x7b37,0xd9));var _0x77b3=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0x7b37[_0x4250b4];return _0x8a4807;};'use strict';var Sequelize=require(_0x77b3('0x0'));module[_0x77b3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77b3('0x2')},'table':{'type':Sequelize[_0x77b3('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x77b3('0x3')]}}; \ No newline at end of file +var _0x9f4d=['TEXT','sequelize','exports','STRING','name'];(function(_0x2c0a07,_0x56553b){var _0x515ba5=function(_0x384f1e){while(--_0x384f1e){_0x2c0a07['push'](_0x2c0a07['shift']());}};_0x515ba5(++_0x56553b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x2b7567,_0x412715){_0x2b7567=_0x2b7567-0x0;var _0x2522dc=_0x9f4d[_0x2b7567];return _0x2522dc;};'use strict';var Sequelize=require(_0xd9f4('0x0'));module[_0xd9f4('0x1')]={'name':{'type':Sequelize[_0xd9f4('0x2')],'allowNull':![],'unique':_0xd9f4('0x3')},'table':{'type':Sequelize[_0xd9f4('0x2')]},'metric':{'type':Sequelize[_0xd9f4('0x4')]},'description':{'type':Sequelize[_0xd9f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 62dc01a..fbc7d88 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x250a85,_0x49f110){var _0x216492=function(_0x5866c6){while(--_0x5866c6){_0x250a85['push'](_0x250a85['shift']());}};_0x216492(++_0x49f110);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xd0a0ae,_0x239a61){var _0x4da1a4=function(_0x10554c){while(--_0x10554c){_0xd0a0ae['push'](_0xd0a0ae['shift']());}};_0x4da1a4(++_0x239a61);}(_0x008c,0x188));var _0xc008=function(_0x121737,_0x37e36b){_0x121737=_0x121737-0x0;var _0x5f4d4b=_0x008c[_0x121737];return _0x5f4d4b;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c2f0728..fe66b94 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 _0x5bd7=['analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0xf9b115,_0x499f75){var _0x2f3525=function(_0x6cec4a){while(--_0x6cec4a){_0xf9b115['push'](_0xf9b115['shift']());}};_0x2f3525(++_0x499f75);}(_0x5bd7,0x12a));var _0x75bd=function(_0x134019,_0x3a1963){_0x134019=_0x134019-0x0;var _0x1807e7=_0x5bd7[_0x134019];return _0x1807e7;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var logger=require(_0x75bd('0x1'))(_0x75bd('0x2'));var moment=require('moment');var BPromise=require(_0x75bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bd('0x4'));var rimraf=require(_0x75bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bd('0x6'));module[_0x75bd('0x7')]=function(_0x2aaa6a,_0x47c9c7){return _0x2aaa6a[_0x75bd('0x8')](_0x75bd('0x9'),attributes,{'tableName':_0x75bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d8=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0xecea29,_0x1a5257){var _0x2d0701=function(_0x16b646){while(--_0x16b646){_0xecea29['push'](_0xecea29['shift']());}};_0x2d0701(++_0x1a5257);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x1db2d6,_0x4445f3){_0x1db2d6=_0x1db2d6-0x0;var _0x3f52f8=_0xb3d8[_0x1db2d6];return _0x3f52f8;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var logger=require(_0x8b3d('0x1'))(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b3d('0x4'));var rimraf=require(_0x8b3d('0x5'));var config=require(_0x8b3d('0x6'));var attributes=require(_0x8b3d('0x7'));module[_0x8b3d('0x8')]=function(_0x22d97b,_0x3b0f04){return _0x22d97b[_0x8b3d('0x9')](_0x8b3d('0xa'),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 7fce14d..0f7e457 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 _0x33b3=['AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0x33b3,0x154));var _0x333b=function(_0x5388e4,_0x5eb0ad){_0x5388e4=_0x5388e4-0x0;var _0x208b64=_0x33b3[_0x5388e4];return _0x208b64;};'use strict';var _=require(_0x333b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x333b('0x1'));var rs=require(_0x333b('0x2'));var fs=require('fs');var Redis=require(_0x333b('0x3'));var db=require(_0x333b('0x4'))['db'];var utils=require(_0x333b('0x5'));var logger=require(_0x333b('0x6'))(_0x333b('0x7'));var config=require(_0x333b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x333b('0x9')][_0x333b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438890,_0x435a4b,_0x29efdb){return new BPromise(function(_0x48373b,_0x4c38c6){return client[_0x333b('0xb')](_0x438890,_0x29efdb)[_0x333b('0xc')](function(_0x3ff2e7){logger[_0x333b('0xd')](_0x333b('0xe'),_0x435a4b,_0x333b('0xf'));logger[_0x333b('0x10')](_0x333b('0x11'),_0x435a4b,_0x333b('0xf'),JSON['stringify'](_0x3ff2e7));if(_0x3ff2e7[_0x333b('0x12')]){if(_0x3ff2e7[_0x333b('0x12')][_0x333b('0x13')]===0x1f4){logger[_0x333b('0x12')](_0x333b('0xe'),_0x435a4b,_0x3ff2e7['error'][_0x333b('0x14')]);return _0x4c38c6(_0x3ff2e7[_0x333b('0x12')]['message']);}logger['error'](_0x333b('0xe'),_0x435a4b,_0x3ff2e7[_0x333b('0x12')][_0x333b('0x14')]);return _0x48373b(_0x3ff2e7['error'][_0x333b('0x14')]);}else{logger['info'](_0x333b('0xe'),_0x435a4b,_0x333b('0xf'));_0x48373b(_0x3ff2e7['result'][_0x333b('0x14')]);}})['catch'](function(_0x3af1ea){logger[_0x333b('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x435a4b,_0x3af1ea);_0x4c38c6(_0x3af1ea);});});} \ No newline at end of file +var _0x482b=['../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x47f19b,_0x56f361){var _0x2af1aa=function(_0x430768){while(--_0x430768){_0x47f19b['push'](_0x47f19b['shift']());}};_0x2af1aa(++_0x56f361);}(_0x482b,0xb8));var _0xb482=function(_0x5f07d0,_0x30a246){_0x5f07d0=_0x5f07d0-0x0;var _0x1c83f1=_0x482b[_0x5f07d0];return _0x1c83f1;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var moment=require('moment');var BPromise=require(_0xb482('0x2'));var rs=require(_0xb482('0x3'));var fs=require('fs');var Redis=require(_0xb482('0x4'));var db=require(_0xb482('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb482('0x6'))(_0xb482('0x7'));var config=require(_0xb482('0x8'));var jayson=require(_0xb482('0x9'));var client=jayson['client'][_0xb482('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475438,_0x15753c,_0x3bbcbd){return new BPromise(function(_0x2a2b2c,_0x3a0598){return client[_0xb482('0xb')](_0x475438,_0x3bbcbd)[_0xb482('0xc')](function(_0x40dc09){logger[_0xb482('0xd')](_0xb482('0xe'),_0x15753c,_0xb482('0xf'));logger[_0xb482('0x10')](_0xb482('0x11'),_0x15753c,'request\x20sent',JSON[_0xb482('0x12')](_0x40dc09));if(_0x40dc09[_0xb482('0x13')]){if(_0x40dc09[_0xb482('0x13')][_0xb482('0x14')]===0x1f4){logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x40dc09['error'][_0xb482('0x15')]);return _0x3a0598(_0x40dc09[_0xb482('0x13')]['message']);}logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x40dc09[_0xb482('0x13')][_0xb482('0x15')]);return _0x2a2b2c(_0x40dc09[_0xb482('0x13')][_0xb482('0x15')]);}else{logger['info'](_0xb482('0xe'),_0x15753c,'request\x20sent');_0x2a2b2c(_0x40dc09[_0xb482('0x16')][_0xb482('0x15')]);}})[_0xb482('0x17')](function(_0x25df00){logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x25df00);_0x3a0598(_0x25df00);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index cfe2c6b..f347e6e 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 _0xfa45=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x111283,_0x58ddcb){var _0x1e5f06=function(_0x2b30a4){while(--_0x2b30a4){_0x111283['push'](_0x111283['shift']());}};_0x1e5f06(++_0x58ddcb);}(_0xfa45,0x11b));var _0x5fa4=function(_0x2ff24c,_0x92e17f){_0x2ff24c=_0x2ff24c-0x0;var _0x373ecd=_0xfa45[_0x2ff24c];return _0x373ecd;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var fs_extra=require(_0x5fa4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5fa4('0x7'));var config=require('../../config/environment');var controller=require(_0x5fa4('0x8'));router[_0x5fa4('0x9')]('/',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xb')]);router[_0x5fa4('0x9')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xd')]);router[_0x5fa4('0xe')]('/',auth[_0x5fa4('0xa')](),controller['create']);router[_0x5fa4('0xf')]('/:id',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x10')]);router[_0x5fa4('0x11')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x12')]);module[_0x5fa4('0x13')]=router; \ No newline at end of file +var _0xa74a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','delete','destroy'];(function(_0x3f932d,_0x46d3e9){var _0x39fea1=function(_0x4ba570){while(--_0x4ba570){_0x3f932d['push'](_0x3f932d['shift']());}};_0x39fea1(++_0x46d3e9);}(_0xa74a,0x66));var _0xaa74=function(_0x4979fb,_0x1e0921){_0x4979fb=_0x4979fb-0x0;var _0x58fbea=_0xa74a[_0x4979fb];return _0x58fbea;};'use strict';var multer=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var path=require(_0xaa74('0x2'));var timeout=require(_0xaa74('0x3'));var express=require(_0xaa74('0x4'));var router=express[_0xaa74('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa74('0x6'));var interaction=require(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xaa74('0x9')](),controller[_0xaa74('0xa')]);router[_0xaa74('0xb')](_0xaa74('0xc'),auth[_0xaa74('0x9')](),controller['show']);router[_0xaa74('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa74('0xe')]);router['put'](_0xaa74('0xc'),auth[_0xaa74('0x9')](),controller['update']);router[_0xaa74('0xf')]('/:id',auth[_0xaa74('0x9')](),controller[_0xaa74('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a112de7..ccd8e10 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 _0xed55=['exports','TEXT','sequelize'];(function(_0x3e2e1c,_0x182117){var _0x4c9c90=function(_0x54221c){while(--_0x54221c){_0x3e2e1c['push'](_0x3e2e1c['shift']());}};_0x4c9c90(++_0x182117);}(_0xed55,0x161));var _0x5ed5=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xed55[_0x3cb152];return _0x4f54c3;};'use strict';var Sequelize=require(_0x5ed5('0x0'));module[_0x5ed5('0x1')]={'tree':{'type':Sequelize[_0x5ed5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x433e=['exports','TEXT','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x433e,0xbf));var _0xe433=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x433e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe433('0x0'));module[_0xe433('0x1')]={'tree':{'type':Sequelize[_0xe433('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 66de523..92532d5 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 _0x71f6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x39dd10,_0x134622){var _0x35bd8a=function(_0x156710){while(--_0x156710){_0x39dd10['push'](_0x39dd10['shift']());}};_0x35bd8a(++_0x134622);}(_0x71f6,0x1c9));var _0x671f=function(_0xfb09e6,_0x4f3696){_0xfb09e6=_0xfb09e6-0x0;var _0x3fe899=_0x71f6[_0xfb09e6];return _0x3fe899;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x671f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x671f('0x1'));var rp=require(_0x671f('0x2'));var moment=require(_0x671f('0x3'));var BPromise=require(_0x671f('0x4'));var Mustache=require('mustache');var util=require(_0x671f('0x5'));var path=require(_0x671f('0x6'));var sox=require(_0x671f('0x7'));var csv=require(_0x671f('0x8'));var ejs=require(_0x671f('0x9'));var fs=require('fs');var fs_extra=require(_0x671f('0xa'));var _=require(_0x671f('0xb'));var squel=require(_0x671f('0xc'));var crypto=require(_0x671f('0xd'));var jsforce=require(_0x671f('0xe'));var deskjs=require(_0x671f('0xf'));var toCsv=require(_0x671f('0x8'));var querystring=require(_0x671f('0x10'));var Papa=require(_0x671f('0x11'));var Redis=require('ioredis');var authService=require(_0x671f('0x12'));var qs=require(_0x671f('0x13'));var as=require(_0x671f('0x14'));var hardwareService=require(_0x671f('0x15'));var logger=require(_0x671f('0x16'))(_0x671f('0x17'));var utils=require('../../config/utils');var config=require(_0x671f('0x18'));var licenseUtil=require(_0x671f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55fab9,_0x2cda75){_0x2cda75=_0x2cda75||0xcc;return function(_0x26e290){if(_0x26e290){return _0x55fab9[_0x671f('0x1a')](_0x2cda75);}return _0x55fab9[_0x671f('0x1b')](_0x2cda75)['end']();};}function respondWithResult(_0x3819a2,_0x84fd65){_0x84fd65=_0x84fd65||0xc8;return function(_0x12237c){if(_0x12237c){return _0x3819a2[_0x671f('0x1b')](_0x84fd65)['json'](_0x12237c);}};}function respondWithFilteredResult(_0x3f281b,_0x27792b){return function(_0x257bc6){if(_0x257bc6){var _0x5dd12b=typeof _0x27792b[_0x671f('0x1c')]===_0x671f('0x1d')&&typeof _0x27792b[_0x671f('0x1e')]===_0x671f('0x1d');var _0x4d4840=_0x257bc6[_0x671f('0x1f')];var _0x82caa3=_0x5dd12b?0x0:_0x27792b[_0x671f('0x1c')];var _0x3263ee=_0x5dd12b?_0x257bc6[_0x671f('0x1f')]:_0x27792b['offset']+_0x27792b[_0x671f('0x1e')];var _0x5d5c74;if(_0x3263ee>=_0x4d4840){_0x3263ee=_0x4d4840;_0x5d5c74=0xc8;}else{_0x5d5c74=0xce;}_0x3f281b['status'](_0x5d5c74);return _0x3f281b[_0x671f('0x20')](_0x671f('0x21'),_0x82caa3+'-'+_0x3263ee+'/'+_0x4d4840)[_0x671f('0x22')](_0x257bc6);}return null;};}function patchUpdates(_0x2054e5){return function(_0x4b1d6d){try{jsonpatch['apply'](_0x4b1d6d,_0x2054e5,!![]);}catch(_0x3a0e83){return BPromise[_0x671f('0x23')](_0x3a0e83);}return _0x4b1d6d[_0x671f('0x24')]();};}function saveUpdates(_0x11b3fe,_0x7e276d){return function(_0x2b5850){if(_0x2b5850){return _0x2b5850[_0x671f('0x25')](_0x11b3fe)['then'](function(_0x2892e4){return _0x2892e4;});}return null;};}function removeEntity(_0x25fa98,_0x40be48){return function(_0x4a0c48){if(_0x4a0c48){return _0x4a0c48[_0x671f('0x26')]()[_0x671f('0x27')](function(){_0x25fa98[_0x671f('0x1b')](0xcc)[_0x671f('0x28')]();});}};}function handleEntityNotFound(_0x9d968f,_0x4f0130){return function(_0x15960b){if(!_0x15960b){_0x9d968f[_0x671f('0x1a')](0x194);}return _0x15960b;};}function handleError(_0xdc83dc,_0x5d7a8d){_0x5d7a8d=_0x5d7a8d||0x1f4;return function(_0x2a41ba){logger[_0x671f('0x29')](_0x2a41ba[_0x671f('0x2a')]);if(_0x2a41ba[_0x671f('0x2b')]){delete _0x2a41ba[_0x671f('0x2b')];}_0xdc83dc['status'](_0x5d7a8d)[_0x671f('0x2c')](_0x2a41ba);};}exports[_0x671f('0x2d')]=function(_0x15d1cf,_0x113bbb){var _0x9d21a6={},_0x13110c={},_0x5e9b63={'count':0x0,'rows':[]};var _0x19158e=_[_0x671f('0x2e')](db[_0x671f('0x2f')][_0x671f('0x30')],function(_0x397e70){return{'name':_0x397e70[_0x671f('0x31')],'type':_0x397e70[_0x671f('0x32')]['key']};});_0x13110c[_0x671f('0x33')]=_[_0x671f('0x2e')](_0x19158e,'name');_0x13110c[_0x671f('0x34')]=_[_0x671f('0x35')](_0x15d1cf['query']);_0x13110c[_0x671f('0x36')]=_[_0x671f('0x37')](_0x13110c[_0x671f('0x33')],_0x13110c[_0x671f('0x34')]);_0x9d21a6[_0x671f('0x38')]=_[_0x671f('0x37')](_0x13110c[_0x671f('0x33')],qs[_0x671f('0x39')](_0x15d1cf['query']['fields']));_0x9d21a6[_0x671f('0x38')]=_0x9d21a6[_0x671f('0x38')][_0x671f('0x3a')]?_0x9d21a6[_0x671f('0x38')]:_0x13110c[_0x671f('0x33')];if(!_0x15d1cf[_0x671f('0x34')][_0x671f('0x3b')](_0x671f('0x3c'))){_0x9d21a6['limit']=qs[_0x671f('0x1e')](_0x15d1cf[_0x671f('0x34')][_0x671f('0x1e')]);_0x9d21a6[_0x671f('0x1c')]=qs[_0x671f('0x1c')](_0x15d1cf[_0x671f('0x34')][_0x671f('0x1c')]);}_0x9d21a6[_0x671f('0x3d')]=qs[_0x671f('0x3e')](_0x15d1cf['query'][_0x671f('0x3e')]);_0x9d21a6[_0x671f('0x3f')]=qs[_0x671f('0x36')](_[_0x671f('0x40')](_0x15d1cf[_0x671f('0x34')],_0x13110c[_0x671f('0x36')]),_0x19158e);if(_0x15d1cf[_0x671f('0x34')][_0x671f('0x41')]){_0x9d21a6['where']=_['merge'](_0x9d21a6[_0x671f('0x3f')],{'$or':_['map'](_0x19158e,function(_0x30e5e8){if(_0x30e5e8[_0x671f('0x32')]!==_0x671f('0x42')){var _0x3e3a54={};_0x3e3a54[_0x30e5e8[_0x671f('0x2b')]]={'$like':'%'+_0x15d1cf['query'][_0x671f('0x41')]+'%'};return _0x3e3a54;}})});}_0x9d21a6=_[_0x671f('0x43')]({},_0x9d21a6,_0x15d1cf[_0x671f('0x44')]);var _0x1ae61e={'where':_0x9d21a6[_0x671f('0x3f')]};return db[_0x671f('0x2f')][_0x671f('0x1f')](_0x1ae61e)['then'](function(_0x224c78){_0x5e9b63[_0x671f('0x1f')]=_0x224c78;if(_0x15d1cf['query'][_0x671f('0x45')]){_0x9d21a6[_0x671f('0x46')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x671f('0x47')](_0x9d21a6);})['then'](function(_0x2f8c8b){_0x5e9b63[_0x671f('0x48')]=_0x2f8c8b;return _0x5e9b63;})[_0x671f('0x27')](respondWithFilteredResult(_0x113bbb,_0x9d21a6))[_0x671f('0x49')](handleError(_0x113bbb,null));};exports['show']=function(_0x1676b4,_0x1e9c27){var _0x287332={'raw':!![],'where':{'id':_0x1676b4['params']['id']}},_0x501aa5={};_0x501aa5[_0x671f('0x33')]=_['keys'](db[_0x671f('0x2f')]['rawAttributes']);_0x501aa5[_0x671f('0x34')]=_['keys'](_0x1676b4[_0x671f('0x34')]);_0x501aa5[_0x671f('0x36')]=_[_0x671f('0x37')](_0x501aa5[_0x671f('0x33')],_0x501aa5[_0x671f('0x34')]);_0x287332[_0x671f('0x38')]=_[_0x671f('0x37')](_0x501aa5[_0x671f('0x33')],qs[_0x671f('0x39')](_0x1676b4[_0x671f('0x34')][_0x671f('0x39')]));_0x287332[_0x671f('0x38')]=_0x287332[_0x671f('0x38')]['length']?_0x287332[_0x671f('0x38')]:_0x501aa5[_0x671f('0x33')];if(_0x1676b4[_0x671f('0x34')][_0x671f('0x45')]){_0x287332['include']=[{'all':!![]}];}_0x287332=_[_0x671f('0x43')]({},_0x287332,_0x1676b4[_0x671f('0x44')]);return db[_0x671f('0x2f')][_0x671f('0x4a')](_0x287332)[_0x671f('0x27')](handleEntityNotFound(_0x1e9c27,null))[_0x671f('0x27')](respondWithResult(_0x1e9c27,null))[_0x671f('0x49')](handleError(_0x1e9c27,null));};exports['create']=function(_0x465db5,_0x55c0fb){return db[_0x671f('0x2f')][_0x671f('0x4b')](_0x465db5[_0x671f('0x4c')],{})[_0x671f('0x27')](respondWithResult(_0x55c0fb,0xc9))[_0x671f('0x49')](handleError(_0x55c0fb,null));};exports['update']=function(_0x4925d5,_0x5e718a){if(_0x4925d5['body']['id']){delete _0x4925d5[_0x671f('0x4c')]['id'];}return db[_0x671f('0x2f')][_0x671f('0x4a')]({'where':{'id':_0x4925d5[_0x671f('0x4d')]['id']}})[_0x671f('0x27')](handleEntityNotFound(_0x5e718a,null))['then'](saveUpdates(_0x4925d5[_0x671f('0x4c')],null))[_0x671f('0x27')](respondWithResult(_0x5e718a,null))['catch'](handleError(_0x5e718a,null));};exports[_0x671f('0x26')]=function(_0x5eb327,_0x31f3ef){return db[_0x671f('0x2f')][_0x671f('0x4a')]({'where':{'id':_0x5eb327[_0x671f('0x4d')]['id']}})[_0x671f('0x27')](handleEntityNotFound(_0x31f3ef,null))[_0x671f('0x27')](removeEntity(_0x31f3ef,null))[_0x671f('0x49')](handleError(_0x31f3ef,null));}; \ No newline at end of file +var _0x0f5b=['length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','rows','catch','params','filters','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','name','index','map','AnalyticTreeReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0xc74a9a,_0x3595ae){var _0x4b794d=function(_0x38c2d9){while(--_0x38c2d9){_0xc74a9a['push'](_0xc74a9a['shift']());}};_0x4b794d(++_0x3595ae);}(_0x0f5b,0x1ca));var _0xb0f5=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x0f5b[_0x309a5e];return _0x1d21f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0f5('0x0'));var zipdir=require(_0xb0f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0f5('0x2'));var moment=require(_0xb0f5('0x3'));var BPromise=require(_0xb0f5('0x4'));var Mustache=require(_0xb0f5('0x5'));var util=require('util');var path=require(_0xb0f5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0f5('0x7'));var _=require(_0xb0f5('0x8'));var squel=require('squel');var crypto=require(_0xb0f5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb0f5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb0f5('0xb'));var authService=require(_0xb0f5('0xc'));var qs=require(_0xb0f5('0xd'));var as=require(_0xb0f5('0xe'));var hardwareService=require(_0xb0f5('0xf'));var logger=require(_0xb0f5('0x10'))(_0xb0f5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb0f5('0x12'));var db=require(_0xb0f5('0x13'))['db'];function respondWithStatusCode(_0x34924c,_0x761147){_0x761147=_0x761147||0xcc;return function(_0x3e4774){if(_0x3e4774){return _0x34924c[_0xb0f5('0x14')](_0x761147);}return _0x34924c['status'](_0x761147)[_0xb0f5('0x15')]();};}function respondWithResult(_0x20e886,_0x4e4af8){_0x4e4af8=_0x4e4af8||0xc8;return function(_0x10f0f8){if(_0x10f0f8){return _0x20e886[_0xb0f5('0x16')](_0x4e4af8)[_0xb0f5('0x17')](_0x10f0f8);}};}function respondWithFilteredResult(_0x56d58f,_0xd76902){return function(_0x25ab18){if(_0x25ab18){var _0x4ac4ca=typeof _0xd76902[_0xb0f5('0x18')]===_0xb0f5('0x19')&&typeof _0xd76902[_0xb0f5('0x1a')]===_0xb0f5('0x19');var _0x21f72d=_0x25ab18[_0xb0f5('0x1b')];var _0x4013e9=_0x4ac4ca?0x0:_0xd76902[_0xb0f5('0x18')];var _0x4ca0a1=_0x4ac4ca?_0x25ab18[_0xb0f5('0x1b')]:_0xd76902[_0xb0f5('0x18')]+_0xd76902[_0xb0f5('0x1a')];var _0x2f5619;if(_0x4ca0a1>=_0x21f72d){_0x4ca0a1=_0x21f72d;_0x2f5619=0xc8;}else{_0x2f5619=0xce;}_0x56d58f[_0xb0f5('0x16')](_0x2f5619);return _0x56d58f['set'](_0xb0f5('0x1c'),_0x4013e9+'-'+_0x4ca0a1+'/'+_0x21f72d)[_0xb0f5('0x17')](_0x25ab18);}return null;};}function patchUpdates(_0x29bc4b){return function(_0xc1e55b){try{jsonpatch[_0xb0f5('0x1d')](_0xc1e55b,_0x29bc4b,!![]);}catch(_0x1ec1f4){return BPromise[_0xb0f5('0x1e')](_0x1ec1f4);}return _0xc1e55b[_0xb0f5('0x1f')]();};}function saveUpdates(_0x1d305f,_0x7293a6){return function(_0x5e3c8e){if(_0x5e3c8e){return _0x5e3c8e['update'](_0x1d305f)['then'](function(_0x1657a8){return _0x1657a8;});}return null;};}function removeEntity(_0x4a2b05,_0x103a32){return function(_0x3c04fa){if(_0x3c04fa){return _0x3c04fa[_0xb0f5('0x20')]()[_0xb0f5('0x21')](function(){_0x4a2b05[_0xb0f5('0x16')](0xcc)[_0xb0f5('0x15')]();});}};}function handleEntityNotFound(_0xec778c,_0x250c05){return function(_0x48c004){if(!_0x48c004){_0xec778c[_0xb0f5('0x14')](0x194);}return _0x48c004;};}function handleError(_0x1a4a9e,_0x2b73c1){_0x2b73c1=_0x2b73c1||0x1f4;return function(_0x57a152){logger['error'](_0x57a152['stack']);if(_0x57a152[_0xb0f5('0x22')]){delete _0x57a152[_0xb0f5('0x22')];}_0x1a4a9e[_0xb0f5('0x16')](_0x2b73c1)['send'](_0x57a152);};}exports[_0xb0f5('0x23')]=function(_0x295c1a,_0x492e0f){var _0x36846a={},_0x11bbd5={},_0x4cfe0e={'count':0x0,'rows':[]};var _0x1460c2=_[_0xb0f5('0x24')](db[_0xb0f5('0x25')][_0xb0f5('0x26')],function(_0x13d5ff){return{'name':_0x13d5ff['fieldName'],'type':_0x13d5ff[_0xb0f5('0x27')]['key']};});_0x11bbd5[_0xb0f5('0x28')]=_[_0xb0f5('0x24')](_0x1460c2,_0xb0f5('0x22'));_0x11bbd5[_0xb0f5('0x29')]=_[_0xb0f5('0x2a')](_0x295c1a[_0xb0f5('0x29')]);_0x11bbd5['filters']=_[_0xb0f5('0x2b')](_0x11bbd5[_0xb0f5('0x28')],_0x11bbd5[_0xb0f5('0x29')]);_0x36846a[_0xb0f5('0x2c')]=_[_0xb0f5('0x2b')](_0x11bbd5[_0xb0f5('0x28')],qs[_0xb0f5('0x2d')](_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x2d')]));_0x36846a['attributes']=_0x36846a[_0xb0f5('0x2c')][_0xb0f5('0x2e')]?_0x36846a['attributes']:_0x11bbd5[_0xb0f5('0x28')];if(!_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x2f')](_0xb0f5('0x30'))){_0x36846a[_0xb0f5('0x1a')]=qs[_0xb0f5('0x1a')](_0x295c1a['query'][_0xb0f5('0x1a')]);_0x36846a[_0xb0f5('0x18')]=qs['offset'](_0x295c1a['query'][_0xb0f5('0x18')]);}_0x36846a[_0xb0f5('0x31')]=qs[_0xb0f5('0x32')](_0x295c1a[_0xb0f5('0x29')]['sort']);_0x36846a['where']=qs['filters'](_['pick'](_0x295c1a[_0xb0f5('0x29')],_0x11bbd5['filters']),_0x1460c2);if(_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x33')]){_0x36846a[_0xb0f5('0x34')]=_['merge'](_0x36846a[_0xb0f5('0x34')],{'$or':_['map'](_0x1460c2,function(_0x51b48d){if(_0x51b48d[_0xb0f5('0x27')]!==_0xb0f5('0x35')){var _0x2bcc18={};_0x2bcc18[_0x51b48d[_0xb0f5('0x22')]]={'$like':'%'+_0x295c1a['query'][_0xb0f5('0x33')]+'%'};return _0x2bcc18;}})});}_0x36846a=_['merge']({},_0x36846a,_0x295c1a['options']);var _0x5f59bd={'where':_0x36846a[_0xb0f5('0x34')]};return db['AnalyticTreeReport']['count'](_0x5f59bd)[_0xb0f5('0x21')](function(_0x4a8d4e){_0x4cfe0e[_0xb0f5('0x1b')]=_0x4a8d4e;if(_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x36')]){_0x36846a['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x36846a);})[_0xb0f5('0x21')](function(_0x33f744){_0x4cfe0e[_0xb0f5('0x37')]=_0x33f744;return _0x4cfe0e;})[_0xb0f5('0x21')](respondWithFilteredResult(_0x492e0f,_0x36846a))[_0xb0f5('0x38')](handleError(_0x492e0f,null));};exports['show']=function(_0x2edb9f,_0xedf52a){var _0x4e92ed={'raw':!![],'where':{'id':_0x2edb9f[_0xb0f5('0x39')]['id']}},_0x30ec50={};_0x30ec50[_0xb0f5('0x28')]=_[_0xb0f5('0x2a')](db[_0xb0f5('0x25')][_0xb0f5('0x26')]);_0x30ec50[_0xb0f5('0x29')]=_['keys'](_0x2edb9f[_0xb0f5('0x29')]);_0x30ec50[_0xb0f5('0x3a')]=_[_0xb0f5('0x2b')](_0x30ec50[_0xb0f5('0x28')],_0x30ec50['query']);_0x4e92ed[_0xb0f5('0x2c')]=_[_0xb0f5('0x2b')](_0x30ec50['model'],qs['fields'](_0x2edb9f['query'][_0xb0f5('0x2d')]));_0x4e92ed[_0xb0f5('0x2c')]=_0x4e92ed[_0xb0f5('0x2c')]['length']?_0x4e92ed[_0xb0f5('0x2c')]:_0x30ec50[_0xb0f5('0x28')];if(_0x2edb9f[_0xb0f5('0x29')][_0xb0f5('0x36')]){_0x4e92ed[_0xb0f5('0x3b')]=[{'all':!![]}];}_0x4e92ed=_['merge']({},_0x4e92ed,_0x2edb9f['options']);return db[_0xb0f5('0x25')][_0xb0f5('0x3c')](_0x4e92ed)[_0xb0f5('0x21')](handleEntityNotFound(_0xedf52a,null))['then'](respondWithResult(_0xedf52a,null))[_0xb0f5('0x38')](handleError(_0xedf52a,null));};exports[_0xb0f5('0x3d')]=function(_0x5a2c22,_0x4f32b0){return db[_0xb0f5('0x25')][_0xb0f5('0x3d')](_0x5a2c22[_0xb0f5('0x3e')],{})[_0xb0f5('0x21')](respondWithResult(_0x4f32b0,0xc9))['catch'](handleError(_0x4f32b0,null));};exports['update']=function(_0x3beaf0,_0x1c871b){if(_0x3beaf0[_0xb0f5('0x3e')]['id']){delete _0x3beaf0['body']['id'];}return db[_0xb0f5('0x25')][_0xb0f5('0x3c')]({'where':{'id':_0x3beaf0[_0xb0f5('0x39')]['id']}})['then'](handleEntityNotFound(_0x1c871b,null))[_0xb0f5('0x21')](saveUpdates(_0x3beaf0[_0xb0f5('0x3e')],null))['then'](respondWithResult(_0x1c871b,null))[_0xb0f5('0x38')](handleError(_0x1c871b,null));};exports['destroy']=function(_0x2589d6,_0x6061b5){return db[_0xb0f5('0x25')][_0xb0f5('0x3c')]({'where':{'id':_0x2589d6[_0xb0f5('0x39')]['id']}})[_0xb0f5('0x21')](handleEntityNotFound(_0x6061b5,null))[_0xb0f5('0x21')](removeEntity(_0x6061b5,null))[_0xb0f5('0x38')](handleError(_0x6061b5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4ad8786..9ce3b44 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 _0x84a6=['../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','../../config/logger','api','moment','path'];(function(_0x173488,_0x4b1b33){var _0x994dac=function(_0x53dfce){while(--_0x53dfce){_0x173488['push'](_0x173488['shift']());}};_0x994dac(++_0x4b1b33);}(_0x84a6,0x1ac));var _0x684a=function(_0x264755,_0x44b561){_0x264755=_0x264755-0x0;var _0x38db02=_0x84a6[_0x264755];return _0x38db02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x684a('0x0'))(_0x684a('0x1'));var moment=require(_0x684a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x684a('0x3'));var rimraf=require('rimraf');var config=require(_0x684a('0x4'));var attributes=require(_0x684a('0x5'));module[_0x684a('0x6')]=function(_0x57b592,_0x22981f){return _0x57b592['define']('AnalyticTreeReport',attributes,{'tableName':_0x684a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff1=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees','lodash'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x4ff1,0x112));var _0x14ff=function(_0x49e2b8,_0x5cf700){_0x49e2b8=_0x49e2b8-0x0;var _0x1f2213=_0x4ff1[_0x49e2b8];return _0x1f2213;};'use strict';var _=require(_0x14ff('0x0'));var util=require(_0x14ff('0x1'));var logger=require(_0x14ff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x14ff('0x3'));var rp=require(_0x14ff('0x4'));var fs=require('fs');var path=require(_0x14ff('0x5'));var rimraf=require(_0x14ff('0x6'));var config=require(_0x14ff('0x7'));var attributes=require(_0x14ff('0x8'));module['exports']=function(_0x19b5dd,_0x15afa3){return _0x19b5dd[_0x14ff('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x14ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 5fd46de..f6ef299 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x59ddfe,_0x486a4a){var _0x230651=function(_0x578125){while(--_0x578125){_0x59ddfe['push'](_0x59ddfe['shift']());}};_0x230651(++_0x486a4a);}(_0x1261,0x144));var _0x1126=function(_0x55d7b0,_0x2a82dc){_0x55d7b0=_0x55d7b0-0x0;var _0x2a376c=_0x1261[_0x55d7b0];return _0x2a376c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x255769,_0x4a37fb){var _0x25db2a=function(_0x5eec59){while(--_0x5eec59){_0x255769['push'](_0x255769['shift']());}};_0x25db2a(++_0x4a37fb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9e787a0..668805d 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 _0x9ecd=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x47d707,_0x2a0a8d){var _0x5f1b64=function(_0x5718d9){while(--_0x5718d9){_0x47d707['push'](_0x47d707['shift']());}};_0x5f1b64(++_0x2a0a8d);}(_0x9ecd,0xe9));var _0xd9ec=function(_0x59f9ba,_0x52aed5){_0x59f9ba=_0x59f9ba-0x0;var _0x4909bc=_0x9ecd[_0x59f9ba];return _0x4909bc;};'use strict';var multer=require('multer');var util=require(_0xd9ec('0x0'));var path=require('path');var timeout=require(_0xd9ec('0x1'));var express=require(_0xd9ec('0x2'));var router=express[_0xd9ec('0x3')]();var fs_extra=require(_0xd9ec('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9ec('0x5'));var controller=require(_0xd9ec('0x6'));router[_0xd9ec('0x7')]('/',auth[_0xd9ec('0x8')](),controller['index']);router[_0xd9ec('0x7')](_0xd9ec('0x9'),auth['isAuthenticated'](),controller[_0xd9ec('0xa')]);router[_0xd9ec('0xb')]('/',auth[_0xd9ec('0x8')](),controller[_0xd9ec('0xc')]);router[_0xd9ec('0xd')](_0xd9ec('0x9'),auth[_0xd9ec('0x8')](),controller[_0xd9ec('0xe')]);router[_0xd9ec('0xf')]('/:id',auth[_0xd9ec('0x8')](),controller['destroy']);module[_0xd9ec('0x10')]=router; \ No newline at end of file +var _0x3606=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3ac91c,_0x52d391){var _0x249e30=function(_0x4c5e30){while(--_0x4c5e30){_0x3ac91c['push'](_0x3ac91c['shift']());}};_0x249e30(++_0x52d391);}(_0x3606,0x1dc));var _0x6360=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x3606[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x6360('0x0'));var util=require(_0x6360('0x1'));var path=require(_0x6360('0x2'));var timeout=require(_0x6360('0x3'));var express=require(_0x6360('0x4'));var router=express[_0x6360('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6360('0x6'));var interaction=require(_0x6360('0x7'));var config=require(_0x6360('0x8'));var controller=require(_0x6360('0x9'));router['get']('/',auth[_0x6360('0xa')](),controller[_0x6360('0xb')]);router[_0x6360('0xc')](_0x6360('0xd'),auth[_0x6360('0xa')](),controller['show']);router[_0x6360('0xe')]('/',auth[_0x6360('0xa')](),controller[_0x6360('0xf')]);router[_0x6360('0x10')](_0x6360('0xd'),auth['isAuthenticated'](),controller[_0x6360('0x11')]);router[_0x6360('0x12')](_0x6360('0xd'),auth[_0x6360('0xa')](),controller[_0x6360('0x13')]);module[_0x6360('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e411f2a..d758818 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 _0xb8ca=['exports','STRING','sequelize'];(function(_0x44686d,_0x5f0e88){var _0xb85e98=function(_0x2aa27d){while(--_0x2aa27d){_0x44686d['push'](_0x44686d['shift']());}};_0xb85e98(++_0x5f0e88);}(_0xb8ca,0x89));var _0xab8c=function(_0x37b3ee,_0x41d16d){_0x37b3ee=_0x37b3ee-0x0;var _0x40f96d=_0xb8ca[_0x37b3ee];return _0x40f96d;};'use strict';var Sequelize=require(_0xab8c('0x0'));module[_0xab8c('0x1')]={'name':{'type':Sequelize[_0xab8c('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab8c('0x2')]}}; \ No newline at end of file +var _0x2bd6=['exports','STRING','sequelize'];(function(_0x6b252,_0x5d91af){var _0x354504=function(_0x1aeedc){while(--_0x1aeedc){_0x6b252['push'](_0x6b252['shift']());}};_0x354504(++_0x5d91af);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2bd6[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'name':{'type':Sequelize[_0x62bd('0x2')]},'basename':{'type':Sequelize[_0x62bd('0x2')]},'type':{'type':Sequelize[_0x62bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ec2ec30..9a6ac61 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 _0x4cf1=['body','file','originalname','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','destroy','then','error','stack','name','send','index','map','Attachment','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','get','omit','createdAt','updatedAt','create'];(function(_0x235c2d,_0x116b14){var _0x343c42=function(_0x46a52b){while(--_0x46a52b){_0x235c2d['push'](_0x235c2d['shift']());}};_0x343c42(++_0x116b14);}(_0x4cf1,0xbe));var _0x14cf=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x4cf1[_0x5d1044];return _0x3cd90e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14cf('0x0'));var jsonpatch=require(_0x14cf('0x1'));var rp=require(_0x14cf('0x2'));var moment=require(_0x14cf('0x3'));var BPromise=require(_0x14cf('0x4'));var Mustache=require(_0x14cf('0x5'));var util=require(_0x14cf('0x6'));var path=require(_0x14cf('0x7'));var sox=require(_0x14cf('0x8'));var csv=require(_0x14cf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14cf('0xa'));var _=require(_0x14cf('0xb'));var squel=require(_0x14cf('0xc'));var crypto=require(_0x14cf('0xd'));var jsforce=require(_0x14cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14cf('0xf'));var Papa=require(_0x14cf('0x10'));var Redis=require(_0x14cf('0x11'));var authService=require(_0x14cf('0x12'));var qs=require(_0x14cf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14cf('0x14'));var logger=require(_0x14cf('0x15'))(_0x14cf('0x16'));var utils=require('../../config/utils');var config=require(_0x14cf('0x17'));var licenseUtil=require(_0x14cf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28364a,_0x3d39b9){_0x3d39b9=_0x3d39b9||0xcc;return function(_0xdc2f6a){if(_0xdc2f6a){return _0x28364a[_0x14cf('0x19')](_0x3d39b9);}return _0x28364a[_0x14cf('0x1a')](_0x3d39b9)[_0x14cf('0x1b')]();};}function respondWithResult(_0x520fc1,_0x2d5037){_0x2d5037=_0x2d5037||0xc8;return function(_0x953241){if(_0x953241){return _0x520fc1[_0x14cf('0x1a')](_0x2d5037)['json'](_0x953241);}};}function respondWithFilteredResult(_0x232187,_0x55d6d0){return function(_0x398090){if(_0x398090){var _0x2b3612=typeof _0x55d6d0[_0x14cf('0x1c')]===_0x14cf('0x1d')&&typeof _0x55d6d0['limit']===_0x14cf('0x1d');var _0xa6a523=_0x398090[_0x14cf('0x1e')];var _0x7ca15=_0x2b3612?0x0:_0x55d6d0[_0x14cf('0x1c')];var _0x243bc4=_0x2b3612?_0x398090[_0x14cf('0x1e')]:_0x55d6d0[_0x14cf('0x1c')]+_0x55d6d0[_0x14cf('0x1f')];var _0x3be873;if(_0x243bc4>=_0xa6a523){_0x243bc4=_0xa6a523;_0x3be873=0xc8;}else{_0x3be873=0xce;}_0x232187[_0x14cf('0x1a')](_0x3be873);return _0x232187[_0x14cf('0x20')](_0x14cf('0x21'),_0x7ca15+'-'+_0x243bc4+'/'+_0xa6a523)[_0x14cf('0x22')](_0x398090);}return null;};}function patchUpdates(_0x59f44a){return function(_0x512b12){try{jsonpatch[_0x14cf('0x23')](_0x512b12,_0x59f44a,!![]);}catch(_0x4c519e){return BPromise['reject'](_0x4c519e);}return _0x512b12[_0x14cf('0x24')]();};}function saveUpdates(_0x5ec1aa,_0x111959){return function(_0x64d1b5){if(_0x64d1b5){return _0x64d1b5['update'](_0x5ec1aa)['then'](function(_0x258a07){return _0x258a07;});}return null;};}function removeEntity(_0x16871f,_0x4338c3){return function(_0x56aa57){if(_0x56aa57){return _0x56aa57[_0x14cf('0x25')]()[_0x14cf('0x26')](function(){_0x16871f[_0x14cf('0x1a')](0xcc)[_0x14cf('0x1b')]();});}};}function handleEntityNotFound(_0x5c870d,_0x1bc9ed){return function(_0x1d371b){if(!_0x1d371b){_0x5c870d[_0x14cf('0x19')](0x194);}return _0x1d371b;};}function handleError(_0x1ffcac,_0x3e730a){_0x3e730a=_0x3e730a||0x1f4;return function(_0x1c6708){logger[_0x14cf('0x27')](_0x1c6708[_0x14cf('0x28')]);if(_0x1c6708[_0x14cf('0x29')]){delete _0x1c6708[_0x14cf('0x29')];}_0x1ffcac['status'](_0x3e730a)[_0x14cf('0x2a')](_0x1c6708);};}exports[_0x14cf('0x2b')]=function(_0x2174aa,_0x4290b5){var _0x139a2d={},_0x5251e4={},_0x47fa7d={'count':0x0,'rows':[]};var _0x5e1513=_[_0x14cf('0x2c')](db[_0x14cf('0x2d')][_0x14cf('0x2e')],function(_0x19ec8b){return{'name':_0x19ec8b['fieldName'],'type':_0x19ec8b['type']['key']};});_0x5251e4[_0x14cf('0x2f')]=_['map'](_0x5e1513,_0x14cf('0x29'));_0x5251e4[_0x14cf('0x30')]=_['keys'](_0x2174aa[_0x14cf('0x30')]);_0x5251e4[_0x14cf('0x31')]=_[_0x14cf('0x32')](_0x5251e4[_0x14cf('0x2f')],_0x5251e4[_0x14cf('0x30')]);_0x139a2d[_0x14cf('0x33')]=_[_0x14cf('0x32')](_0x5251e4[_0x14cf('0x2f')],qs['fields'](_0x2174aa['query'][_0x14cf('0x34')]));_0x139a2d['attributes']=_0x139a2d[_0x14cf('0x33')][_0x14cf('0x35')]?_0x139a2d[_0x14cf('0x33')]:_0x5251e4[_0x14cf('0x2f')];if(!_0x2174aa[_0x14cf('0x30')]['hasOwnProperty'](_0x14cf('0x36'))){_0x139a2d[_0x14cf('0x1f')]=qs['limit'](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x1f')]);_0x139a2d[_0x14cf('0x1c')]=qs[_0x14cf('0x1c')](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x1c')]);}_0x139a2d['order']=qs[_0x14cf('0x37')](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x37')]);_0x139a2d['where']=qs[_0x14cf('0x31')](_[_0x14cf('0x38')](_0x2174aa[_0x14cf('0x30')],_0x5251e4[_0x14cf('0x31')]),_0x5e1513);if(_0x2174aa[_0x14cf('0x30')][_0x14cf('0x39')]){_0x139a2d[_0x14cf('0x3a')]=_['merge'](_0x139a2d[_0x14cf('0x3a')],{'$or':_[_0x14cf('0x2c')](_0x5e1513,function(_0x17d6c6){if(_0x17d6c6[_0x14cf('0x3b')]!==_0x14cf('0x3c')){var _0x17cbb3={};_0x17cbb3[_0x17d6c6[_0x14cf('0x29')]]={'$like':'%'+_0x2174aa[_0x14cf('0x30')]['filter']+'%'};return _0x17cbb3;}})});}_0x139a2d=_[_0x14cf('0x3d')]({},_0x139a2d,_0x2174aa[_0x14cf('0x3e')]);var _0x36f511={'where':_0x139a2d['where']};return db[_0x14cf('0x2d')]['count'](_0x36f511)[_0x14cf('0x26')](function(_0x2077cb){_0x47fa7d['count']=_0x2077cb;if(_0x2174aa[_0x14cf('0x30')][_0x14cf('0x3f')]){_0x139a2d[_0x14cf('0x40')]=[{'all':!![]}];}return db[_0x14cf('0x2d')][_0x14cf('0x41')](_0x139a2d);})['then'](function(_0x3eb917){_0x47fa7d[_0x14cf('0x42')]=_0x3eb917;return _0x47fa7d;})[_0x14cf('0x26')](respondWithFilteredResult(_0x4290b5,_0x139a2d))[_0x14cf('0x43')](handleError(_0x4290b5,null));};exports[_0x14cf('0x44')]=function(_0x4d61a8,_0x1cc476){var _0x2064a0={'raw':!![],'where':{'id':_0x4d61a8[_0x14cf('0x45')]['id']}},_0x589588={};_0x589588[_0x14cf('0x2f')]=_[_0x14cf('0x46')](db[_0x14cf('0x2d')][_0x14cf('0x2e')]);_0x589588[_0x14cf('0x30')]=_[_0x14cf('0x46')](_0x4d61a8[_0x14cf('0x30')]);_0x589588['filters']=_['intersection'](_0x589588[_0x14cf('0x2f')],_0x589588[_0x14cf('0x30')]);_0x2064a0[_0x14cf('0x33')]=_[_0x14cf('0x32')](_0x589588[_0x14cf('0x2f')],qs[_0x14cf('0x34')](_0x4d61a8[_0x14cf('0x30')][_0x14cf('0x34')]));_0x2064a0['attributes']=_0x2064a0[_0x14cf('0x33')]['length']?_0x2064a0[_0x14cf('0x33')]:_0x589588[_0x14cf('0x2f')];if(_0x4d61a8['query'][_0x14cf('0x3f')]){_0x2064a0[_0x14cf('0x40')]=[{'all':!![]}];}_0x2064a0=_[_0x14cf('0x3d')]({},_0x2064a0,_0x4d61a8['options']);return db[_0x14cf('0x2d')][_0x14cf('0x47')](_0x2064a0)[_0x14cf('0x26')](handleEntityNotFound(_0x1cc476,null))['then'](respondWithResult(_0x1cc476,null))[_0x14cf('0x43')](handleError(_0x1cc476,null));};exports['clone']=function(_0x2de760,_0x3beeea){var _0x11f703={'where':{'id':_0x2de760[_0x14cf('0x45')]['id']}},_0x3e44ee={};_0x3e44ee[_0x14cf('0x2f')]=_['keys'](db[_0x14cf('0x2d')][_0x14cf('0x2e')]);_0x11f703['attributes']=_[_0x14cf('0x32')](_0x3e44ee[_0x14cf('0x2f')],qs['fields'](_0x2de760[_0x14cf('0x30')][_0x14cf('0x34')]));_0x11f703[_0x14cf('0x33')]=_0x11f703[_0x14cf('0x33')][_0x14cf('0x35')]?_0x11f703[_0x14cf('0x33')]:_0x3e44ee[_0x14cf('0x2f')];if(_0x2de760['query']['includeAll']){_0x11f703['include']=[{'all':!![]}];}_0x11f703=_[_0x14cf('0x3d')]({},_0x11f703,_0x2de760[_0x14cf('0x3e')]);return db['Attachment'][_0x14cf('0x47')](_0x11f703)[_0x14cf('0x26')](handleEntityNotFound(_0x3beeea,null))[_0x14cf('0x26')](function(_0x1caa55){if(_0x1caa55){var _0x195f69=_0x1caa55[_0x14cf('0x48')]({'plain':!![]});_0x195f69=qs[_0x14cf('0x49')](_0x195f69,['id',_0x14cf('0x4a'),'updatedAt']);_0x2de760['body']=_['omit'](_0x2de760['body'],['id',_0x14cf('0x4a'),_0x14cf('0x4b')]);return db['Attachment'][_0x14cf('0x4c')](_['merge'](_0x195f69,_0x2de760['body']),{'include':_0x2de760[_0x14cf('0x30')][_0x14cf('0x3f')]?[{'all':!![]}]:undefined});}})[_0x14cf('0x26')](respondWithResult(_0x3beeea,0xc9))[_0x14cf('0x43')](handleError(_0x3beeea,null));};exports['update']=function(_0x3fae93,_0x3d982d){if(_0x3fae93[_0x14cf('0x4d')]['id']){delete _0x3fae93[_0x14cf('0x4d')]['id'];}return db[_0x14cf('0x2d')]['find']({'where':{'id':_0x3fae93[_0x14cf('0x45')]['id']}})[_0x14cf('0x26')](handleEntityNotFound(_0x3d982d,null))['then'](saveUpdates(_0x3fae93['body'],null))['then'](respondWithResult(_0x3d982d,null))[_0x14cf('0x43')](handleError(_0x3d982d,null));};exports[_0x14cf('0x25')]=function(_0x4f56f6,_0x28dc97){return db[_0x14cf('0x2d')][_0x14cf('0x47')]({'where':{'id':_0x4f56f6[_0x14cf('0x45')]['id']}})[_0x14cf('0x26')](handleEntityNotFound(_0x28dc97,null))[_0x14cf('0x26')](removeEntity(_0x28dc97,null))[_0x14cf('0x43')](handleError(_0x28dc97,null));};exports[_0x14cf('0x4c')]=function(_0x589de8,_0x4b80c5,_0x27e44f){_0x589de8['body'][_0x14cf('0x29')]=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x4f')];_0x589de8[_0x14cf('0x4d')]['basename']=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x50')];_0x589de8[_0x14cf('0x4d')]['type']=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x51')];return db['Attachment'][_0x14cf('0x4c')](_0x589de8['body'])[_0x14cf('0x26')](respondWithResult(_0x4b80c5,0xc9))[_0x14cf('0x43')](handleError(_0x4b80c5,null));};exports['download']=function(_0x2942ea,_0x19c89d,_0x485cce){return db[_0x14cf('0x2d')][_0x14cf('0x52')]({'where':{'id':_0x2942ea[_0x14cf('0x45')]['id']},'raw':!![]})[_0x14cf('0x26')](handleEntityNotFound(_0x19c89d,null))[_0x14cf('0x26')](function(_0x20426d){if(_0x20426d){var _0x3deb91=_0x20426d[_0x14cf('0x53')]!==null;var _0x12fc27=path[_0x14cf('0x54')](config[_0x14cf('0x55')],_0x14cf('0x56'));if(_0x3deb91){_0x12fc27=path[_0x14cf('0x54')](_0x12fc27,_0x14cf('0x57'));}var _0x4955f0=path[_0x14cf('0x54')](_0x12fc27,_0x20426d['basename']);return _0x19c89d[_0x14cf('0x58')](_0x4955f0);}})[_0x14cf('0x43')](handleError(_0x19c89d,null));}; \ No newline at end of file +var _0x0e65=['key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','rows','catch','params','includeAll','include','find','get','omit','createdAt','updatedAt','body','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','fieldName'];(function(_0x377031,_0x1825c9){var _0x532ea4=function(_0x84e692){while(--_0x84e692){_0x377031['push'](_0x377031['shift']());}};_0x532ea4(++_0x1825c9);}(_0x0e65,0xd1));var _0x50e6=function(_0x326488,_0x37fa02){_0x326488=_0x326488-0x0;var _0x130c5e=_0x0e65[_0x326488];return _0x130c5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50e6('0x1'));var BPromise=require(_0x50e6('0x2'));var Mustache=require(_0x50e6('0x3'));var util=require(_0x50e6('0x4'));var path=require(_0x50e6('0x5'));var sox=require(_0x50e6('0x6'));var csv=require(_0x50e6('0x7'));var ejs=require(_0x50e6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50e6('0x9'));var squel=require('squel');var crypto=require(_0x50e6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50e6('0xb'));var Papa=require(_0x50e6('0xc'));var Redis=require(_0x50e6('0xd'));var authService=require(_0x50e6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x50e6('0xf'));var hardwareService=require(_0x50e6('0x10'));var logger=require(_0x50e6('0x11'))(_0x50e6('0x12'));var utils=require(_0x50e6('0x13'));var config=require(_0x50e6('0x14'));var licenseUtil=require(_0x50e6('0x15'));var db=require(_0x50e6('0x16'))['db'];function respondWithStatusCode(_0x53507f,_0x4eb0a4){_0x4eb0a4=_0x4eb0a4||0xcc;return function(_0x3167ba){if(_0x3167ba){return _0x53507f[_0x50e6('0x17')](_0x4eb0a4);}return _0x53507f['status'](_0x4eb0a4)['end']();};}function respondWithResult(_0x442f38,_0x2d3012){_0x2d3012=_0x2d3012||0xc8;return function(_0x4bce25){if(_0x4bce25){return _0x442f38[_0x50e6('0x18')](_0x2d3012)[_0x50e6('0x19')](_0x4bce25);}};}function respondWithFilteredResult(_0x270fd5,_0x297cf8){return function(_0x3b35e7){if(_0x3b35e7){var _0x4f48fc=typeof _0x297cf8[_0x50e6('0x1a')]===_0x50e6('0x1b')&&typeof _0x297cf8[_0x50e6('0x1c')]===_0x50e6('0x1b');var _0x55afe8=_0x3b35e7[_0x50e6('0x1d')];var _0x1159a2=_0x4f48fc?0x0:_0x297cf8[_0x50e6('0x1a')];var _0x194144=_0x4f48fc?_0x3b35e7[_0x50e6('0x1d')]:_0x297cf8[_0x50e6('0x1a')]+_0x297cf8[_0x50e6('0x1c')];var _0x5e5c0e;if(_0x194144>=_0x55afe8){_0x194144=_0x55afe8;_0x5e5c0e=0xc8;}else{_0x5e5c0e=0xce;}_0x270fd5[_0x50e6('0x18')](_0x5e5c0e);return _0x270fd5[_0x50e6('0x1e')](_0x50e6('0x1f'),_0x1159a2+'-'+_0x194144+'/'+_0x55afe8)[_0x50e6('0x19')](_0x3b35e7);}return null;};}function patchUpdates(_0x2e77b7){return function(_0x1c4ccb){try{jsonpatch[_0x50e6('0x20')](_0x1c4ccb,_0x2e77b7,!![]);}catch(_0x14b17a){return BPromise[_0x50e6('0x21')](_0x14b17a);}return _0x1c4ccb[_0x50e6('0x22')]();};}function saveUpdates(_0x486718,_0x3bc1db){return function(_0x5e6201){if(_0x5e6201){return _0x5e6201[_0x50e6('0x23')](_0x486718)[_0x50e6('0x24')](function(_0x529a03){return _0x529a03;});}return null;};}function removeEntity(_0x226bff,_0x1d1e2c){return function(_0xe0a76c){if(_0xe0a76c){return _0xe0a76c[_0x50e6('0x25')]()[_0x50e6('0x24')](function(){_0x226bff[_0x50e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f7bc,_0x15df56){return function(_0x2a1186){if(!_0x2a1186){_0x41f7bc[_0x50e6('0x17')](0x194);}return _0x2a1186;};}function handleError(_0x500043,_0x225ce9){_0x225ce9=_0x225ce9||0x1f4;return function(_0x4392ab){logger[_0x50e6('0x26')](_0x4392ab[_0x50e6('0x27')]);if(_0x4392ab[_0x50e6('0x28')]){delete _0x4392ab['name'];}_0x500043[_0x50e6('0x18')](_0x225ce9)[_0x50e6('0x29')](_0x4392ab);};}exports[_0x50e6('0x2a')]=function(_0xcd9e6,_0x1d4077){var _0x330cc2={},_0x181356={},_0x507f77={'count':0x0,'rows':[]};var _0x1d1617=_[_0x50e6('0x2b')](db[_0x50e6('0x2c')]['rawAttributes'],function(_0x44f0eb){return{'name':_0x44f0eb[_0x50e6('0x2d')],'type':_0x44f0eb['type'][_0x50e6('0x2e')]};});_0x181356[_0x50e6('0x2f')]=_[_0x50e6('0x2b')](_0x1d1617,_0x50e6('0x28'));_0x181356[_0x50e6('0x30')]=_[_0x50e6('0x31')](_0xcd9e6[_0x50e6('0x30')]);_0x181356['filters']=_['intersection'](_0x181356[_0x50e6('0x2f')],_0x181356[_0x50e6('0x30')]);_0x330cc2[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x181356[_0x50e6('0x2f')],qs[_0x50e6('0x34')](_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x34')]));_0x330cc2[_0x50e6('0x32')]=_0x330cc2['attributes'][_0x50e6('0x35')]?_0x330cc2[_0x50e6('0x32')]:_0x181356[_0x50e6('0x2f')];if(!_0xcd9e6[_0x50e6('0x30')]['hasOwnProperty'](_0x50e6('0x36'))){_0x330cc2[_0x50e6('0x1c')]=qs[_0x50e6('0x1c')](_0xcd9e6[_0x50e6('0x30')]['limit']);_0x330cc2[_0x50e6('0x1a')]=qs['offset'](_0xcd9e6['query']['offset']);}_0x330cc2['order']=qs[_0x50e6('0x37')](_0xcd9e6[_0x50e6('0x30')]['sort']);_0x330cc2[_0x50e6('0x38')]=qs['filters'](_[_0x50e6('0x39')](_0xcd9e6['query'],_0x181356[_0x50e6('0x3a')]),_0x1d1617);if(_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x3b')]){_0x330cc2['where']=_['merge'](_0x330cc2['where'],{'$or':_[_0x50e6('0x2b')](_0x1d1617,function(_0x564bc2){if(_0x564bc2[_0x50e6('0x3c')]!==_0x50e6('0x3d')){var _0x4c91d7={};_0x4c91d7[_0x564bc2[_0x50e6('0x28')]]={'$like':'%'+_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x3b')]+'%'};return _0x4c91d7;}})});}_0x330cc2=_[_0x50e6('0x3e')]({},_0x330cc2,_0xcd9e6[_0x50e6('0x3f')]);var _0x45a84d={'where':_0x330cc2[_0x50e6('0x38')]};return db[_0x50e6('0x2c')][_0x50e6('0x1d')](_0x45a84d)[_0x50e6('0x24')](function(_0x55c955){_0x507f77[_0x50e6('0x1d')]=_0x55c955;if(_0xcd9e6[_0x50e6('0x30')]['includeAll']){_0x330cc2['include']=[{'all':!![]}];}return db[_0x50e6('0x2c')]['findAll'](_0x330cc2);})[_0x50e6('0x24')](function(_0x57041b){_0x507f77[_0x50e6('0x40')]=_0x57041b;return _0x507f77;})[_0x50e6('0x24')](respondWithFilteredResult(_0x1d4077,_0x330cc2))[_0x50e6('0x41')](handleError(_0x1d4077,null));};exports['show']=function(_0x17f7cb,_0x538959){var _0x418c1d={'raw':!![],'where':{'id':_0x17f7cb[_0x50e6('0x42')]['id']}},_0x304b29={};_0x304b29[_0x50e6('0x2f')]=_[_0x50e6('0x31')](db[_0x50e6('0x2c')]['rawAttributes']);_0x304b29[_0x50e6('0x30')]=_[_0x50e6('0x31')](_0x17f7cb[_0x50e6('0x30')]);_0x304b29[_0x50e6('0x3a')]=_['intersection'](_0x304b29[_0x50e6('0x2f')],_0x304b29[_0x50e6('0x30')]);_0x418c1d[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x304b29['model'],qs['fields'](_0x17f7cb[_0x50e6('0x30')][_0x50e6('0x34')]));_0x418c1d[_0x50e6('0x32')]=_0x418c1d[_0x50e6('0x32')][_0x50e6('0x35')]?_0x418c1d[_0x50e6('0x32')]:_0x304b29[_0x50e6('0x2f')];if(_0x17f7cb[_0x50e6('0x30')][_0x50e6('0x43')]){_0x418c1d[_0x50e6('0x44')]=[{'all':!![]}];}_0x418c1d=_['merge']({},_0x418c1d,_0x17f7cb[_0x50e6('0x3f')]);return db[_0x50e6('0x2c')][_0x50e6('0x45')](_0x418c1d)[_0x50e6('0x24')](handleEntityNotFound(_0x538959,null))['then'](respondWithResult(_0x538959,null))[_0x50e6('0x41')](handleError(_0x538959,null));};exports['clone']=function(_0x5a0cf6,_0x2b6a93){var _0x57f5b4={'where':{'id':_0x5a0cf6['params']['id']}},_0x538ca1={};_0x538ca1[_0x50e6('0x2f')]=_[_0x50e6('0x31')](db['Attachment']['rawAttributes']);_0x57f5b4[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x538ca1[_0x50e6('0x2f')],qs['fields'](_0x5a0cf6['query'][_0x50e6('0x34')]));_0x57f5b4[_0x50e6('0x32')]=_0x57f5b4[_0x50e6('0x32')][_0x50e6('0x35')]?_0x57f5b4[_0x50e6('0x32')]:_0x538ca1[_0x50e6('0x2f')];if(_0x5a0cf6[_0x50e6('0x30')][_0x50e6('0x43')]){_0x57f5b4[_0x50e6('0x44')]=[{'all':!![]}];}_0x57f5b4=_[_0x50e6('0x3e')]({},_0x57f5b4,_0x5a0cf6['options']);return db[_0x50e6('0x2c')][_0x50e6('0x45')](_0x57f5b4)[_0x50e6('0x24')](handleEntityNotFound(_0x2b6a93,null))['then'](function(_0x5266ea){if(_0x5266ea){var _0x350431=_0x5266ea[_0x50e6('0x46')]({'plain':!![]});_0x350431=qs[_0x50e6('0x47')](_0x350431,['id',_0x50e6('0x48'),_0x50e6('0x49')]);_0x5a0cf6[_0x50e6('0x4a')]=_['omit'](_0x5a0cf6[_0x50e6('0x4a')],['id','createdAt',_0x50e6('0x49')]);return db[_0x50e6('0x2c')][_0x50e6('0x4b')](_['merge'](_0x350431,_0x5a0cf6['body']),{'include':_0x5a0cf6[_0x50e6('0x30')][_0x50e6('0x43')]?[{'all':!![]}]:undefined});}})[_0x50e6('0x24')](respondWithResult(_0x2b6a93,0xc9))[_0x50e6('0x41')](handleError(_0x2b6a93,null));};exports[_0x50e6('0x23')]=function(_0x5bf954,_0x1f7e76){if(_0x5bf954[_0x50e6('0x4a')]['id']){delete _0x5bf954[_0x50e6('0x4a')]['id'];}return db[_0x50e6('0x2c')][_0x50e6('0x45')]({'where':{'id':_0x5bf954['params']['id']}})[_0x50e6('0x24')](handleEntityNotFound(_0x1f7e76,null))[_0x50e6('0x24')](saveUpdates(_0x5bf954['body'],null))['then'](respondWithResult(_0x1f7e76,null))[_0x50e6('0x41')](handleError(_0x1f7e76,null));};exports['destroy']=function(_0x4fc356,_0x1ff127){return db[_0x50e6('0x2c')][_0x50e6('0x45')]({'where':{'id':_0x4fc356[_0x50e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ff127,null))[_0x50e6('0x24')](removeEntity(_0x1ff127,null))[_0x50e6('0x41')](handleError(_0x1ff127,null));};exports[_0x50e6('0x4b')]=function(_0x27086e,_0xa21f70,_0x54cf56){_0x27086e['body'][_0x50e6('0x28')]=_0x27086e[_0x50e6('0x4c')]['originalname'];_0x27086e['body'][_0x50e6('0x4d')]=_0x27086e[_0x50e6('0x4c')]['filename'];_0x27086e[_0x50e6('0x4a')][_0x50e6('0x3c')]=_0x27086e[_0x50e6('0x4c')][_0x50e6('0x4e')];return db[_0x50e6('0x2c')][_0x50e6('0x4b')](_0x27086e[_0x50e6('0x4a')])['then'](respondWithResult(_0xa21f70,0xc9))[_0x50e6('0x41')](handleError(_0xa21f70,null));};exports[_0x50e6('0x4f')]=function(_0x4bea5d,_0x588fda,_0x46f158){return db[_0x50e6('0x2c')][_0x50e6('0x50')]({'where':{'id':_0x4bea5d[_0x50e6('0x42')]['id']},'raw':!![]})[_0x50e6('0x24')](handleEntityNotFound(_0x588fda,null))[_0x50e6('0x24')](function(_0x5e831a){if(_0x5e831a){var _0x5d70b6=_0x5e831a[_0x50e6('0x51')]!==null;var _0x31875f=path[_0x50e6('0x52')](config[_0x50e6('0x53')],_0x50e6('0x54'));if(_0x5d70b6){_0x31875f=path[_0x50e6('0x52')](_0x31875f,'offline-chat/');}var _0x321c45=path['join'](_0x31875f,_0x5e831a[_0x50e6('0x4d')]);return _0x588fda[_0x50e6('0x4f')](_0x321c45);}})[_0x50e6('0x41')](handleError(_0x588fda,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f3317a5..4dfc112 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 _0x82f0=['Attachment','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x1d8e83,_0x3a44be){var _0x30d861=function(_0xc4fd25){while(--_0xc4fd25){_0x1d8e83['push'](_0x1d8e83['shift']());}};_0x30d861(++_0x3a44be);}(_0x82f0,0x10b));var _0x082f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x82f0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x082f('0x0'));var util=require(_0x082f('0x1'));var logger=require(_0x082f('0x2'))(_0x082f('0x3'));var moment=require(_0x082f('0x4'));var BPromise=require(_0x082f('0x5'));var rp=require(_0x082f('0x6'));var fs=require('fs');var path=require(_0x082f('0x7'));var rimraf=require(_0x082f('0x8'));var config=require(_0x082f('0x9'));var attributes=require(_0x082f('0xa'));module[_0x082f('0xb')]=function(_0x424804,_0x190fc4){return _0x424804[_0x082f('0xc')](_0x082f('0xd'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e05=['path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api','moment','request-promise'];(function(_0x4e8fb5,_0x5bb89a){var _0x198b65=function(_0x2c6be8){while(--_0x2c6be8){_0x4e8fb5['push'](_0x4e8fb5['shift']());}};_0x198b65(++_0x5bb89a);}(_0x7e05,0x19f));var _0x57e0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e05[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var logger=require('../../config/logger')(_0x57e0('0x2'));var moment=require(_0x57e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x57e0('0x4'));var fs=require('fs');var path=require(_0x57e0('0x5'));var rimraf=require('rimraf');var config=require(_0x57e0('0x6'));var attributes=require(_0x57e0('0x7'));module[_0x57e0('0x8')]=function(_0x5af8d8,_0x1c28d4){return _0x5af8d8[_0x57e0('0x9')](_0x57e0('0xa'),attributes,{'tableName':_0x57e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c7e682c..d1527d4 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 _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x11273e,_0x3821a6){var _0x1e8616=function(_0x439d86){while(--_0x439d86){_0x11273e['push'](_0x11273e['shift']());}};_0x1e8616(++_0x3821a6);}(_0xf874,0xed));var _0x4f87=function(_0x5bdd43,_0x1ba582){_0x5bdd43=_0x5bdd43-0x0;var _0x2df923=_0xf874[_0x5bdd43];return _0x2df923;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file +var _0xe812=['error','code','message','info','result','CreateAttachment','Attachment','create','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50d160,_0x447b4f){var _0x28172e=function(_0x569824){while(--_0x569824){_0x50d160['push'](_0x50d160['shift']());}};_0x28172e(++_0x447b4f);}(_0xe812,0x1f2));var _0x2e81=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe812[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var moment=require(_0x2e81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e81('0x2'));var db=require(_0x2e81('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e81('0x4'))(_0x2e81('0x5'));var config=require('../../config/environment');var jayson=require(_0x2e81('0x6'));var client=jayson[_0x2e81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36604d,_0x32b221,_0x27f9c6){return new BPromise(function(_0x5559ca,_0x142cab){return client[_0x2e81('0x8')](_0x36604d,_0x27f9c6)[_0x2e81('0x9')](function(_0x11a56b){logger['info'](_0x2e81('0xa'),_0x32b221,_0x2e81('0xb'));logger[_0x2e81('0xc')](_0x2e81('0xd'),_0x32b221,_0x2e81('0xb'),JSON[_0x2e81('0xe')](_0x11a56b));if(_0x11a56b[_0x2e81('0xf')]){if(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x10')]===0x1f4){logger[_0x2e81('0xf')](_0x2e81('0xa'),_0x32b221,_0x11a56b['error'][_0x2e81('0x11')]);return _0x142cab(_0x11a56b[_0x2e81('0xf')]['message']);}logger[_0x2e81('0xf')]('Attachment,\x20%s,\x20%s',_0x32b221,_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);return _0x5559ca(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);}else{logger[_0x2e81('0x12')](_0x2e81('0xa'),_0x32b221,'request\x20sent');_0x5559ca(_0x11a56b[_0x2e81('0x13')][_0x2e81('0x11')]);}})['catch'](function(_0x330131){logger['error'](_0x2e81('0xa'),_0x32b221,_0x330131);_0x142cab(_0x330131);});});}exports[_0x2e81('0x14')]=function(_0x4c1b11){var _0x402992=this;return new Promise(function(_0x2bb9b6,_0xbb61a4){return db[_0x2e81('0x15')][_0x2e81('0x16')](_0x4c1b11[_0x2e81('0x17')],{'raw':_0x4c1b11[_0x2e81('0x18')]?_0x4c1b11[_0x2e81('0x18')][_0x2e81('0x19')]===undefined?!![]:![]:!![]})[_0x2e81('0x9')](function(_0x524694){logger[_0x2e81('0x12')](_0x2e81('0x14'),_0x4c1b11);logger[_0x2e81('0xc')](_0x2e81('0x14'),_0x4c1b11,JSON[_0x2e81('0xe')](_0x524694));_0x2bb9b6(_0x524694);})[_0x2e81('0x1a')](function(_0x18b9be){logger[_0x2e81('0xf')]('CreateAttachment',_0x18b9be[_0x2e81('0x11')],_0x4c1b11);_0xbb61a4(_0x402992['error'](0x1f4,_0x18b9be[_0x2e81('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b288c5e..de6e249 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x4569f4,_0x30d93f){var _0x1421e5=function(_0x515aaa){while(--_0x515aaa){_0x4569f4['push'](_0x4569f4['shift']());}};_0x1421e5(++_0x30d93f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x584eed,_0x5ab3e8){_0x584eed=_0x584eed-0x0;var _0x112b46=_0x5f2f[_0x584eed];return _0x112b46;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20ae3b,_0x23a21c){_0x20ae3b=_0x20ae3b-0x0;var _0x391475=_0x0b0e[_0x20ae3b];return _0x391475;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 72257f8..b798b2a 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bae=['undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blockedAt','agent','then','blockDuration','blocked','add','clearBlockUser','getLicense','catch','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x0bae,0x146));var _0xe0ba=function(_0x18e1bf,_0x2fbc81){_0x18e1bf=_0x18e1bf-0x0;var _0x4bd981=_0x0bae[_0x18e1bf];return _0x4bd981;};'use strict';var passport=require(_0xe0ba('0x0'));var LocalStrategy=require(_0xe0ba('0x1'))[_0xe0ba('0x2')];var moment=require(_0xe0ba('0x3'));var ActiveDirectory=require(_0xe0ba('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xe0ba('0x5'));var utils=require(_0xe0ba('0x6'));var config=require(_0xe0ba('0x7'));var logger=require(_0xe0ba('0x8'))(_0xe0ba('0x9'));function isActiveDirectoryConfigured(_0x21ff6f){var _0x27e0d8=![];if(typeof _0x21ff6f['activedirectory']!==_0xe0ba('0xa')){_0x27e0d8=_0x21ff6f[_0xe0ba('0xb')][_0xe0ba('0xc')]&&_0x21ff6f[_0xe0ba('0xb')][_0xe0ba('0xd')]&&_0x21ff6f['activedirectory'][_0xe0ba('0xe')];}return _0x27e0d8;}function adAuthenticate(_0x2c9d7a,_0x48fb8e,_0x4538fd){return new BPromise(function(_0x8b5354,_0x3d8504){try{var _0x2d801b=new ActiveDirectory(_0x2c9d7a);_0x2d801b[_0xe0ba('0xf')](_0x48fb8e,_0x4538fd,function(_0x303911,_0x29167c){if(_0x303911){logger[_0xe0ba('0x10')](_0xe0ba('0x11'),_0x48fb8e,util['inspect'](_0x303911,{'showHidden':![],'depth':null}));_0x3d8504(_0xe0ba('0x12'));}else if(!_0x29167c){logger['error'](_0xe0ba('0x13'),_0x48fb8e);_0x3d8504(_0xe0ba('0x12'));}else{_0x8b5354(_0x29167c);}});}catch(_0x5c73fc){_0x3d8504(_0x5c73fc);}});}function ActiveDirectoryAuthenticate(_0x42a03c,_0x4f9f91,_0x1e2bf0,_0x1c4fef){var _0x54f21e,_0x3b019a;if(!isActiveDirectoryConfigured(config)){logger[_0xe0ba('0x10')](_0xe0ba('0x14'),_0x4f9f91);return _0x1c4fef(null,![],{'message':_0xe0ba('0x12')});}return db[_0xe0ba('0x15')][_0xe0ba('0x16')]({'where':{'id':0x1},'attributes':[_0xe0ba('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x26f5c3){_0x54f21e=_0x26f5c3;if(!_0x54f21e[_0xe0ba('0x17')]){logger[_0xe0ba('0x10')](_0xe0ba('0x18'),_0x4f9f91);throw new Error(_0xe0ba('0x12'));}return _0x42a03c[_0xe0ba('0x16')]({'attributes':['id',_0xe0ba('0x19'),_0xe0ba('0x1a'),'salt',_0xe0ba('0x1b'),_0xe0ba('0x1c'),'blocked',_0xe0ba('0x1d'),'online'],'where':{'name':_0x4f9f91,'role':{'$or':['admin','user',_0xe0ba('0x1e')]},'adSsoEnabled':!![]}});})['then'](function(_0x23efac){if(!_0x23efac||_0x23efac&&_0x23efac['name']!==_0x4f9f91){throw new Error(_0xe0ba('0x12'));}_0x3b019a=_0x23efac;var _0x1fe832=_0x3b019a[_0xe0ba('0x19')]+'@'+config[_0xe0ba('0xb')][_0xe0ba('0xe')];return adAuthenticate(config[_0xe0ba('0xb')],_0x1fe832,_0x1e2bf0);})[_0xe0ba('0x1f')](function(_0x152d6c){if(_0x3b019a[_0xe0ba('0x1c')]){throw new Error(_0xe0ba('0x12'));}if(_0x54f21e[_0xe0ba('0x20')]>0x0){if(_0x3b019a[_0xe0ba('0x21')]){if(moment(_0x3b019a[_0xe0ba('0x1d')])[_0xe0ba('0x22')](_0x54f21e['blockDuration'],'minutes')>moment()){throw new Error(_0xe0ba('0x12'));}return utils[_0xe0ba('0x23')](_0x3b019a,0x0,![],null)[_0xe0ba('0x1f')](function(){return utils[_0xe0ba('0x24')](_0x3b019a);})[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}else{return utils[_0xe0ba('0x24')](_0x3b019a)[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}}else{return utils[_0xe0ba('0x24')](_0x3b019a)[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}})[_0xe0ba('0x25')](function(_0x53954f){return _0x1c4fef(null,![],_0x53954f);});}function handleError(_0x6d286a,_0x59fead,_0x5a2d2e){return _0x6d286a[_0xe0ba('0x26')](_0x59fead||0x1f4)[_0xe0ba('0x27')]({'message':_0x5a2d2e?_0x5a2d2e['message']||_0x5a2d2e:''});}exports[_0xe0ba('0x28')]=function(_0x507d57,_0x37d6ba,_0x3d5e62){passport[_0xe0ba('0xf')]('ad-login',function(_0x298fcd,_0x47576a,_0x2a9180){var _0x32cc58=_0x298fcd||_0x2a9180;if(_0x32cc58){return handleError(_0x37d6ba,0x191,_0x32cc58);}if(!_0x47576a){return handleError(_0x37d6ba,0x194,{'message':_0xe0ba('0x29')});}else{var _0x5cf830={'payload':{'id':_0x47576a['id'],'role':_0x47576a[_0xe0ba('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xe0ba('0x2a')](_0x5cf830)[_0xe0ba('0x1f')](function(_0x1fb069){_0x37d6ba[_0xe0ba('0x2b')]({'id':_0x47576a['id'],'token':_0x1fb069,'statusCall':'','isAlreadyLogged':_0x47576a[_0xe0ba('0x2c')]});});}})(_0x507d57,_0x37d6ba,_0x3d5e62);};passport[_0xe0ba('0x2d')](_0xe0ba('0x2e'),new LocalStrategy({'usernameField':_0xe0ba('0x19'),'passwordField':_0xe0ba('0x1a')},function(_0x392837,_0x1ee0b1,_0x4ee26d){return ActiveDirectoryAuthenticate(db[_0xe0ba('0x2f')],_0x392837,_0x1ee0b1,_0x4ee26d);})); \ No newline at end of file +var _0x6c25=['findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','name','salt','disabled','blocked','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','use','password','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured'];(function(_0x159378,_0x280501){var _0x4abb7c=function(_0x3eaffa){while(--_0x3eaffa){_0x159378['push'](_0x159378['shift']());}};_0x4abb7c(++_0x280501);}(_0x6c25,0x143));var _0x56c2=function(_0x2937af,_0xf5d16b){_0x2937af=_0x2937af-0x0;var _0x1c272d=_0x6c25[_0x2937af];return _0x1c272d;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x56c2('0x0'))[_0x56c2('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x56c2('0x2'));var BPromise=require(_0x56c2('0x3'));var util=require(_0x56c2('0x4'));var db=require(_0x56c2('0x5'))['db'];var authService=require(_0x56c2('0x6'));var utils=require(_0x56c2('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x56c2('0x8'));function isActiveDirectoryConfigured(_0xbeb27e){var _0x5b67e5=![];if(typeof _0xbeb27e[_0x56c2('0x9')]!==_0x56c2('0xa')){_0x5b67e5=_0xbeb27e[_0x56c2('0x9')][_0x56c2('0xb')]&&_0xbeb27e['activedirectory'][_0x56c2('0xc')]&&_0xbeb27e[_0x56c2('0x9')][_0x56c2('0xd')];}return _0x5b67e5;}function adAuthenticate(_0x3783ba,_0x13d6ca,_0x555454){return new BPromise(function(_0x2acc9e,_0x2ffddc){try{var _0x5c883e=new ActiveDirectory(_0x3783ba);_0x5c883e[_0x56c2('0xe')](_0x13d6ca,_0x555454,function(_0x499780,_0x3a776d){if(_0x499780){logger[_0x56c2('0xf')](_0x56c2('0x10'),_0x13d6ca,util[_0x56c2('0x11')](_0x499780,{'showHidden':![],'depth':null}));_0x2ffddc('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3a776d){logger['error'](_0x56c2('0x12'),_0x13d6ca);_0x2ffddc('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2acc9e(_0x3a776d);}});}catch(_0x106147){_0x2ffddc(_0x106147);}});}function ActiveDirectoryAuthenticate(_0x5e7292,_0x499557,_0x2eec30,_0x3430fe){var _0xc6df82,_0x14ae4b;if(!isActiveDirectoryConfigured(config)){logger[_0x56c2('0xf')](_0x56c2('0x13'),_0x499557);return _0x3430fe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x56c2('0x14')]({'where':{'id':0x1},'attributes':[_0x56c2('0x15'),_0x56c2('0x16')],'raw':!![]})[_0x56c2('0x17')](function(_0x5d711d){_0xc6df82=_0x5d711d;if(!_0xc6df82[_0x56c2('0x15')]){logger[_0x56c2('0xf')](_0x56c2('0x18'),_0x499557);throw new Error(_0x56c2('0x19'));}return _0x5e7292[_0x56c2('0x14')]({'attributes':['id',_0x56c2('0x1a'),'password',_0x56c2('0x1b'),'role',_0x56c2('0x1c'),_0x56c2('0x1d'),_0x56c2('0x1e'),_0x56c2('0x1f')],'where':{'name':_0x499557,'role':{'$or':[_0x56c2('0x20'),_0x56c2('0x21'),_0x56c2('0x22')]},'adSsoEnabled':!![]}});})[_0x56c2('0x17')](function(_0x470e6d){if(!_0x470e6d||_0x470e6d&&_0x470e6d['name']!==_0x499557){throw new Error(_0x56c2('0x19'));}_0x14ae4b=_0x470e6d;var _0x4064f3=_0x14ae4b['name']+'@'+config[_0x56c2('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x4064f3,_0x2eec30);})[_0x56c2('0x17')](function(_0x246358){if(_0x14ae4b[_0x56c2('0x1c')]){throw new Error(_0x56c2('0x19'));}if(_0xc6df82[_0x56c2('0x16')]>0x0){if(_0x14ae4b[_0x56c2('0x1d')]){if(moment(_0x14ae4b[_0x56c2('0x1e')])[_0x56c2('0x23')](_0xc6df82[_0x56c2('0x16')],_0x56c2('0x24'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x56c2('0x25')](_0x14ae4b,0x0,![],null)[_0x56c2('0x17')](function(){return utils['getLicense'](_0x14ae4b);})[_0x56c2('0x17')](function(){return _0x3430fe(null,_0x14ae4b);});}else{return utils[_0x56c2('0x26')](_0x14ae4b)[_0x56c2('0x17')](function(){return _0x3430fe(null,_0x14ae4b);});}}else{return utils[_0x56c2('0x26')](_0x14ae4b)['then'](function(){return _0x3430fe(null,_0x14ae4b);});}})[_0x56c2('0x27')](function(_0x20ee11){return _0x3430fe(null,![],_0x20ee11);});}function handleError(_0x5e5826,_0xe59a86,_0x164c48){return _0x5e5826[_0x56c2('0x28')](_0xe59a86||0x1f4)[_0x56c2('0x29')]({'message':_0x164c48?_0x164c48[_0x56c2('0x2a')]||_0x164c48:''});}exports[_0x56c2('0x2b')]=function(_0x26fe6a,_0x50b59c,_0x183e09){passport['authenticate']('ad-login',function(_0x2229e1,_0x55edc9,_0x2135c1){var _0x1126cf=_0x2229e1||_0x2135c1;if(_0x1126cf){return handleError(_0x50b59c,0x191,_0x1126cf);}if(!_0x55edc9){return handleError(_0x50b59c,0x194,{'message':_0x56c2('0x2c')});}else{var _0x51eb09={'payload':{'id':_0x55edc9['id'],'role':_0x55edc9[_0x56c2('0x2d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x51eb09)[_0x56c2('0x17')](function(_0x1a3a5e){_0x50b59c[_0x56c2('0x2e')]({'id':_0x55edc9['id'],'token':_0x1a3a5e,'statusCall':'','isAlreadyLogged':_0x55edc9['online']});});}})(_0x26fe6a,_0x50b59c,_0x183e09);};passport[_0x56c2('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0x56c2('0x1a'),'passwordField':_0x56c2('0x30')},function(_0x661d39,_0x3cb47c,_0x4364b4){return ActiveDirectoryAuthenticate(db['User'],_0x661d39,_0x3cb47c,_0x4364b4);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 469c386..69ff908 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c48=['Router','./authActiveDirectory.controller','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c48,0x193));var _0x86c4=function(_0xce9f7b,_0x4e38f5){_0xce9f7b=_0xce9f7b-0x0;var _0x2379fd=_0x6c48[_0xce9f7b];return _0x2379fd;};'use strict';var express=require(_0x86c4('0x0'));var router=express[_0x86c4('0x1')]();var controller=require(_0x86c4('0x2'));router['post']('/',controller['login']);module[_0x86c4('0x3')]=router; \ No newline at end of file +var _0x2c09=['express','exports'];(function(_0x5c9364,_0x27d6b1){var _0x5f52fa=function(_0x122bc6){while(--_0x122bc6){_0x5c9364['push'](_0x5c9364['shift']());}};_0x5f52fa(++_0x27d6b1);}(_0x2c09,0x188));var _0x92c0=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x2c09[_0x278e3c];return _0x3e2d9b;};'use strict';var express=require(_0x92c0('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x92c0('0x1')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b8440fe..c9d4000 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x4a5b3a,_0x3a1d9d){_0x4a5b3a=_0x4a5b3a-0x0;var _0x483e5c=_0x7a54[_0x4a5b3a];return _0x483e5c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x2cade3,_0x57de32){_0x2cade3=_0x2cade3-0x0;var _0x5a4877=_0x7a54[_0x2cade3];return _0x5a4877;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5d6ee1a..67a315c 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 _0xf78b=['isMiddleware','login','setTokenCookie','express','Router','./authGoogle.controller','get','/callback','callback'];(function(_0x4884bc,_0x315521){var _0xff9945=function(_0x59af0){while(--_0x59af0){_0x4884bc['push'](_0x4884bc['shift']());}};_0xff9945(++_0x315521);}(_0xf78b,0x78));var _0xbf78=function(_0x54edab,_0x49b7ad){_0x54edab=_0x54edab-0x0;var _0x35c7c9=_0xf78b[_0x54edab];return _0x35c7c9;};'use strict';var express=require(_0xbf78('0x0'));var passport=require('passport');var router=express[_0xbf78('0x1')]();var controller=require(_0xbf78('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xbf78('0x3')]('/',controller['login']);router[_0xbf78('0x3')](_0xbf78('0x4'),controller[_0xbf78('0x5')],authService[_0xbf78('0x6')],userController[_0xbf78('0x7')],authService[_0xbf78('0x8')]);module['exports']=router; \ No newline at end of file +var _0x8c52=['login','/callback','callback','isMiddleware','setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x299ffa,_0x4609df){var _0x17fe64=function(_0x41de7c){while(--_0x41de7c){_0x299ffa['push'](_0x299ffa['shift']());}};_0x17fe64(++_0x4609df);}(_0x8c52,0x7e));var _0x28c5=function(_0x5d8778,_0x3c2f0e){_0x5d8778=_0x5d8778-0x0;var _0x133e42=_0x8c52[_0x5d8778];return _0x133e42;};'use strict';var express=require(_0x28c5('0x0'));var passport=require('passport');var router=express[_0x28c5('0x1')]();var controller=require(_0x28c5('0x2'));var userController=require(_0x28c5('0x3'));var authService=require(_0x28c5('0x4'));router[_0x28c5('0x5')]('/',controller[_0x28c5('0x6')]);router[_0x28c5('0x5')](_0x28c5('0x7'),controller[_0x28c5('0x8')],authService[_0x28c5('0x9')],userController[_0x28c5('0x6')],authService[_0x28c5('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 966835f..0d8e840 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 _0x9795=['MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','use','local-login','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','client','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','allowedLoginAttempts','add','clearBlockUser','catch'];(function(_0x2331f4,_0xe518c3){var _0x224d15=function(_0xa917c5){while(--_0xa917c5){_0x2331f4['push'](_0x2331f4['shift']());}};_0x224d15(++_0xe518c3);}(_0x9795,0x157));var _0x5979=function(_0x46344e,_0x516028){_0x46344e=_0x46344e-0x0;var _0x42a4f5=_0x9795[_0x46344e];return _0x42a4f5;};'use strict';var util=require(_0x5979('0x0'));var passport=require(_0x5979('0x1'));var LocalStrategy=require(_0x5979('0x2'))[_0x5979('0x3')];var jayson=require(_0x5979('0x4'));var _=require('lodash');var rs=require(_0x5979('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x5979('0x6'));var utils=require('../../config/utils');var client=jayson[_0x5979('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x2d74c9,_0xabd45a,_0x505829,_0x33b227){var _0x2bb3cd,_0x341f98;return db[_0x5979('0x8')][_0x5979('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5979('0xa')],'raw':!![]})['then'](function(_0x5d389e){_0x2bb3cd=_0x5d389e;return _0x2d74c9['findOne']({'attributes':['id',_0x5979('0xb'),_0x5979('0xc'),_0x5979('0xd'),_0x5979('0xe'),_0x5979('0xf'),_0x5979('0x10'),_0x5979('0x11'),_0x5979('0x12')],'where':{'name':_0xabd45a,'role':{'$or':['admin','user',_0x5979('0x13')]}}});})['then'](function(_0x15497e){if(!_0x15497e||_0x15497e&&_0x15497e['name']!==_0xabd45a){throw new Error(_0x5979('0x14'));}else{_0x341f98=_0x15497e;return _0x341f98;}})[_0x5979('0x15')](function(){_0x341f98[_0x5979('0x16')](_0x505829,function(_0x466f73,_0x6243ed){var _0x41275b=_0x341f98[_0x5979('0x12')]+0x1;if(_0x466f73){return _0x33b227(_0x466f73);}else if(!_0x6243ed){if(_0x341f98[_0x5979('0xf')]){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else if(_0x2bb3cd['allowedLoginAttempts']>0x0){if(_0x341f98[_0x5979('0x10')]){if(_0x2bb3cd[_0x5979('0xa')]>0x0){if(moment(_0x341f98[_0x5979('0x11')])['add'](_0x2bb3cd[_0x5979('0xa')],'minutes')>moment()){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else{return utils['clearBlockUser'](_0x341f98,_0x41275b,![],null)[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}}else{return _0x33b227(null,![],{'message':_0x5979('0x14')});}}else{if(_0x41275b>=_0x2bb3cd[_0x5979('0x17')]){return utils['clearBlockUser'](_0x341f98,0x0,!![],moment())[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}else{return utils['clearBlockUser'](_0x341f98,_0x41275b,![],null)[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}}}else{return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x341f98['disabled']){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else if(_0x2bb3cd[_0x5979('0x17')]>0x0){if(_0x341f98['blocked']){if(_0x2bb3cd[_0x5979('0xa')]>0x0){if(moment(_0x341f98[_0x5979('0x11')])[_0x5979('0x18')](_0x2bb3cd['blockDuration'],'minutes')>moment()){return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5979('0x19')](_0x341f98,0x0,![],null)['then'](function(){return utils['getLicense'](_0x341f98);})[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);});}}else{return _0x33b227(null,![],{'message':_0x5979('0x14')});}}else{return utils[_0x5979('0x19')](_0x341f98,0x0,![],null)[_0x5979('0x15')](function(){return utils['getLicense'](_0x341f98);})[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);})[_0x5979('0x1a')](function(_0x514b51){return _0x33b227(null,![],_0x514b51);});}}else{if(_0x341f98[_0x5979('0x10')]){return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x341f98)[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);});}}}});})['catch'](function(_0x1478b7){return _0x33b227(null,![],_0x1478b7);});}function sendServiceMail(_0x5c0d5f){return db[_0x5979('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0x5979('0xb'),_0x5979('0x1c')],'include':[{'model':db[_0x5979('0x1d')],'as':_0x5979('0x1e'),'include':[{'model':db[_0x5979('0x1f')],'as':_0x5979('0x1f')}]}]})[_0x5979('0x15')](function(_0x9b3932){if(!_0x9b3932){throw new Error(_0x5979('0x20'));}var _0x1adf1a=_0x9b3932[_0x5979('0x21')]();var _0x30421e={'account':_0x1adf1a,'message':_['merge']({'from':util[_0x5979('0x22')](_0x5979('0x23'),_0x9b3932[_0x5979('0xb')],_0x9b3932[_0x5979('0x1c')]||_0x9b3932[_0x5979('0x1e')][_0x5979('0x24')])},_0x5c0d5f)};return client[_0x5979('0x25')](_0x5979('0x26'),_0x30421e);})['then'](function(_0x3e06c0){if(_0x3e06c0[_0x5979('0x27')]){throw new Error(util[_0x5979('0x22')](_0x5979('0x28'),_0x3e06c0[_0x5979('0x27')]['message']||JSON[_0x5979('0x29')](_0x3e06c0[_0x5979('0x27')])));}return!![];});}function handleError(_0x4539b7,_0x449259,_0x3b9958){return _0x4539b7[_0x5979('0x2a')](_0x449259||0x1f4)[_0x5979('0x2b')]({'message':_0x3b9958?_0x3b9958[_0x5979('0x2c')]||_0x3b9958:''});}exports[_0x5979('0x2d')]=function(_0x539525,_0x42b317,_0x560fa3){passport[_0x5979('0x16')]('local-login',function(_0x452ba7,_0x1a9497,_0x24f00b){var _0x5c7203=_0x452ba7||_0x24f00b;if(_0x5c7203){return handleError(_0x42b317,0x191,_0x5c7203);}if(!_0x1a9497){return handleError(_0x42b317,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4443ac={'payload':{'id':_0x1a9497['id'],'role':_0x1a9497[_0x5979('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4443ac)[_0x5979('0x15')](function(_0x2935b6){_0x42b317[_0x5979('0x2e')]({'id':_0x1a9497['id'],'token':_0x2935b6,'statusCall':'','isAlreadyLogged':_0x1a9497[_0x5979('0x2f')]});});}})(_0x539525,_0x42b317,_0x560fa3);};exports[_0x5979('0x30')]=function(_0x36d130,_0x23e1d0){if(!_0x36d130['body']['email']){return handleError(_0x23e1d0,0x1f4,{'message':_0x5979('0x31')});}var _0xc72589=rs[_0x5979('0x32')]();_0x36d130['body']['email']=_0x36d130[_0x5979('0x33')][_0x5979('0x1c')]['trim']()[_0x5979('0x34')]();var _0x1eb186;return db[_0x5979('0x8')][_0x5979('0x9')]({'where':{'id':0x1},'attributes':[_0x5979('0x17'),_0x5979('0xa')],'raw':!![]})[_0x5979('0x15')](function(_0x8838b1){_0x1eb186=_0x8838b1;return db[_0x5979('0x35')][_0x5979('0x36')]({'where':{'email':_0x36d130[_0x5979('0x33')][_0x5979('0x1c')]}});})['then'](function(_0x54106f){if(!_0x54106f){throw new Error(_0x5979('0x37'));}if(_0x54106f[_0x5979('0xf')]){throw new Error(_0x5979('0x38'));}if(_0x54106f[_0x5979('0x10')]){if(moment(_0x54106f['blockedAt'])[_0x5979('0x18')](_0x1eb186['blockDuration'],_0x5979('0x39'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x54106f['blocked']=![];_0x54106f['blockedAt']=null;}}_0x54106f[_0x5979('0x3a')]=_0xc72589;_0x54106f[_0x5979('0x3b')]=Date['now']()+0x36ee80;return _0x54106f[_0x5979('0x3c')]();})[_0x5979('0x15')](function(){return sendServiceMail({'to':_0x36d130[_0x5979('0x33')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x5979('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x36d130[_0x5979('0x3e')]['host']+_0x5979('0x3f')+_0xc72589+'\x0a\x0a'+_0x5979('0x40')});})[_0x5979('0x15')](function(){_0x23e1d0['status'](0xc8)[_0x5979('0x2b')]({'message':'Reset\x20Email\x20sent!'});})[_0x5979('0x1a')](function(_0x314691){return handleError(_0x23e1d0,0x1f4,_0x314691);});};exports[_0x5979('0x41')]=function(_0x46a5be,_0x532883){return db[_0x5979('0x35')][_0x5979('0x36')]({'where':{'resetPasswordToken':_0x46a5be[_0x5979('0x42')][_0x5979('0x43')],'resetPasswordExpires':{'$gt':Date[_0x5979('0x44')]()}}})[_0x5979('0x15')](function(_0x27ea76){if(!_0x27ea76){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x5979('0x9')]({'attributes':['id',_0x5979('0x45'),_0x5979('0x46'),_0x5979('0x47')]})['then'](function(_0x571d44){if(_0x571d44[_0x5979('0x45')])authService['validatePasswordPattern'](_0x46a5be[_0x5979('0x33')][_0x5979('0xc')]);if(!_0x571d44['enforcePasswordHistory']||!_0x27ea76['previousPasswords'])return _0x27ea76;authService['validatePasswordHistory'](_0x46a5be[_0x5979('0x33')][_0x5979('0xc')],_0x27ea76['previousPasswords'],_0x571d44[_0x5979('0x47')]);return _0x27ea76;})[_0x5979('0x15')](function(){_0x27ea76[_0x5979('0xc')]=_0x46a5be[_0x5979('0x33')]['password'];_0x27ea76[_0x5979('0x3a')]=null;_0x27ea76[_0x5979('0x3b')]=null;return _0x27ea76[_0x5979('0x3c')]();});})[_0x5979('0x15')](function(){_0x532883[_0x5979('0x2a')](0xc8)[_0x5979('0x2b')]({'message':'Password\x20reset!'});})[_0x5979('0x1a')](function(_0x5ef745){return handleError(_0x532883,0x1f4,_0x5ef745);});};passport[_0x5979('0x48')](_0x5979('0x49'),new LocalStrategy({'usernameField':_0x5979('0xb'),'passwordField':_0x5979('0xc')},function(_0x324610,_0x8649c4,_0x4edec4){return localAuthenticate(db[_0x5979('0x35')],_0x324610,_0x8649c4,_0x4edec4);})); \ No newline at end of file +var _0xf5a2=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','blockDuration','clearBlockUser','minutes','getLicense','blocked','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request'];(function(_0xf73dcd,_0x15c363){var _0x44c1e2=function(_0x5f1996){while(--_0x5f1996){_0xf73dcd['push'](_0xf73dcd['shift']());}};_0x44c1e2(++_0x15c363);}(_0xf5a2,0x185));var _0x2f5a=function(_0x480c57,_0x5bba33){_0x480c57=_0x480c57-0x0;var _0x1109b7=_0xf5a2[_0x480c57];return _0x1109b7;};'use strict';var util=require(_0x2f5a('0x0'));var passport=require(_0x2f5a('0x1'));var LocalStrategy=require('passport-local')[_0x2f5a('0x2')];var jayson=require(_0x2f5a('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x2f5a('0x4'));var utils=require(_0x2f5a('0x5'));var client=jayson[_0x2f5a('0x6')][_0x2f5a('0x7')]({'port':0x232b});function localAuthenticate(_0x5ee553,_0x2cd5f2,_0xbb0bec,_0x1186a6){var _0x4adae1,_0x112fb9;return db[_0x2f5a('0x8')][_0x2f5a('0x9')]({'where':{'id':0x1},'attributes':[_0x2f5a('0xa'),'blockDuration'],'raw':!![]})[_0x2f5a('0xb')](function(_0x173089){_0x4adae1=_0x173089;return _0x5ee553['findOne']({'attributes':['id','name','password',_0x2f5a('0xc'),_0x2f5a('0xd'),_0x2f5a('0xe'),'blocked',_0x2f5a('0xf'),_0x2f5a('0x10')],'where':{'name':_0x2cd5f2,'role':{'$or':[_0x2f5a('0x11'),_0x2f5a('0x12'),_0x2f5a('0x13')]}}});})['then'](function(_0x2d4e15){if(!_0x2d4e15||_0x2d4e15&&_0x2d4e15[_0x2f5a('0x14')]!==_0x2cd5f2){throw new Error(_0x2f5a('0x15'));}else{_0x112fb9=_0x2d4e15;return _0x112fb9;}})[_0x2f5a('0xb')](function(){_0x112fb9[_0x2f5a('0x16')](_0xbb0bec,function(_0x5ca12f,_0x5cbe8b){var _0x3cdc3a=_0x112fb9[_0x2f5a('0x10')]+0x1;if(_0x5ca12f){return _0x1186a6(_0x5ca12f);}else if(!_0x5cbe8b){if(_0x112fb9['disabled']){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else if(_0x4adae1['allowedLoginAttempts']>0x0){if(_0x112fb9['blocked']){if(_0x4adae1['blockDuration']>0x0){if(moment(_0x112fb9[_0x2f5a('0xf')])[_0x2f5a('0x17')](_0x4adae1[_0x2f5a('0x18')],'minutes')>moment()){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['clearBlockUser'](_0x112fb9,_0x3cdc3a,![],null)[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{if(_0x3cdc3a>=_0x4adae1['allowedLoginAttempts']){return utils[_0x2f5a('0x19')](_0x112fb9,0x0,!![],moment())[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});});}else{return utils['clearBlockUser'](_0x112fb9,_0x3cdc3a,![],null)[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});});}}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{if(_0x112fb9['disabled']){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else if(_0x4adae1[_0x2f5a('0xa')]>0x0){if(_0x112fb9['blocked']){if(_0x4adae1[_0x2f5a('0x18')]>0x0){if(moment(_0x112fb9[_0x2f5a('0xf')])['add'](_0x4adae1[_0x2f5a('0x18')],_0x2f5a('0x1a'))>moment()){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['clearBlockUser'](_0x112fb9,0x0,![],null)[_0x2f5a('0xb')](function(){return utils[_0x2f5a('0x1b')](_0x112fb9);})[_0x2f5a('0xb')](function(){return _0x1186a6(null,_0x112fb9);});}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{return utils['clearBlockUser'](_0x112fb9,0x0,![],null)[_0x2f5a('0xb')](function(){return utils['getLicense'](_0x112fb9);})[_0x2f5a('0xb')](function(){return _0x1186a6(null,_0x112fb9);})['catch'](function(_0x4470f4){return _0x1186a6(null,![],_0x4470f4);});}}else{if(_0x112fb9[_0x2f5a('0x1c')]){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['getLicense'](_0x112fb9)['then'](function(){return _0x1186a6(null,_0x112fb9);});}}}});})['catch'](function(_0x416c24){return _0x1186a6(null,![],_0x416c24);});}function sendServiceMail(_0x3f5900){return db[_0x2f5a('0x1d')][_0x2f5a('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x2f5a('0x14'),_0x2f5a('0x1f')],'include':[{'model':db[_0x2f5a('0x20')],'as':'Smtp','include':[{'model':db[_0x2f5a('0x21')],'as':_0x2f5a('0x21')}]}]})[_0x2f5a('0xb')](function(_0x502342){if(!_0x502342){throw new Error(_0x2f5a('0x22'));}var _0xd082c=_0x502342[_0x2f5a('0x23')]();var _0x597904={'account':_0xd082c,'message':_[_0x2f5a('0x24')]({'from':util[_0x2f5a('0x25')](_0x2f5a('0x26'),_0x502342[_0x2f5a('0x14')],_0x502342[_0x2f5a('0x1f')]||_0x502342[_0x2f5a('0x27')][_0x2f5a('0x12')])},_0x3f5900)};return client[_0x2f5a('0x28')]('SendMail',_0x597904);})['then'](function(_0x6f51f9){if(_0x6f51f9[_0x2f5a('0x29')]){throw new Error(util[_0x2f5a('0x25')](_0x2f5a('0x2a'),_0x6f51f9[_0x2f5a('0x29')][_0x2f5a('0x2b')]||JSON['stringify'](_0x6f51f9['error'])));}return!![];});}function handleError(_0x454afd,_0x1a1446,_0x5ec2e7){return _0x454afd[_0x2f5a('0x2c')](_0x1a1446||0x1f4)[_0x2f5a('0x2d')]({'message':_0x5ec2e7?_0x5ec2e7['message']||_0x5ec2e7:''});}exports[_0x2f5a('0x2e')]=function(_0x453127,_0x3a057b,_0x1cff3b){passport[_0x2f5a('0x16')](_0x2f5a('0x2f'),function(_0xdafc3a,_0x2958d4,_0x5f2410){var _0x32640c=_0xdafc3a||_0x5f2410;if(_0x32640c){return handleError(_0x3a057b,0x191,_0x32640c);}if(!_0x2958d4){return handleError(_0x3a057b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x55b2d4={'payload':{'id':_0x2958d4['id'],'role':_0x2958d4[_0x2f5a('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x2f5a('0x30')](_0x55b2d4)[_0x2f5a('0xb')](function(_0x593144){_0x3a057b['json']({'id':_0x2958d4['id'],'token':_0x593144,'statusCall':'','isAlreadyLogged':_0x2958d4[_0x2f5a('0x31')]});});}})(_0x453127,_0x3a057b,_0x1cff3b);};exports[_0x2f5a('0x32')]=function(_0xe517df,_0x1f57bc){if(!_0xe517df[_0x2f5a('0x33')]['email']){return handleError(_0x1f57bc,0x1f4,{'message':_0x2f5a('0x34')});}var _0x32e11d=rs[_0x2f5a('0x35')]();_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')]=_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')][_0x2f5a('0x36')]()[_0x2f5a('0x37')]();var _0x51b6d5;return db['Setting'][_0x2f5a('0x9')]({'where':{'id':0x1},'attributes':[_0x2f5a('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x339708){_0x51b6d5=_0x339708;return db[_0x2f5a('0x38')][_0x2f5a('0x1e')]({'where':{'email':_0xe517df['body']['email']}});})[_0x2f5a('0xb')](function(_0x5ea25f){if(!_0x5ea25f){throw new Error(_0x2f5a('0x39'));}if(_0x5ea25f[_0x2f5a('0xe')]){throw new Error(_0x2f5a('0x3a'));}if(_0x5ea25f[_0x2f5a('0x1c')]){if(moment(_0x5ea25f[_0x2f5a('0xf')])[_0x2f5a('0x17')](_0x51b6d5['blockDuration'],_0x2f5a('0x1a'))>moment()){throw new Error(_0x2f5a('0x3b'));}else{_0x5ea25f[_0x2f5a('0x1c')]=![];_0x5ea25f[_0x2f5a('0xf')]=null;}}_0x5ea25f[_0x2f5a('0x3c')]=_0x32e11d;_0x5ea25f[_0x2f5a('0x3d')]=Date[_0x2f5a('0x3e')]()+0x36ee80;return _0x5ea25f[_0x2f5a('0x3f')]();})[_0x2f5a('0xb')](function(){return sendServiceMail({'to':_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')],'subject':_0x2f5a('0x40'),'text':_0x2f5a('0x41')+_0x2f5a('0x42')+_0x2f5a('0x43')+_0xe517df[_0x2f5a('0x44')][_0x2f5a('0x45')]+_0x2f5a('0x46')+_0x32e11d+'\x0a\x0a'+_0x2f5a('0x47')});})[_0x2f5a('0xb')](function(){_0x1f57bc[_0x2f5a('0x2c')](0xc8)[_0x2f5a('0x2d')]({'message':_0x2f5a('0x48')});})[_0x2f5a('0x49')](function(_0x496a17){return handleError(_0x1f57bc,0x1f4,_0x496a17);});};exports['reset']=function(_0x222707,_0x4cbb84){return db['User']['find']({'where':{'resetPasswordToken':_0x222707[_0x2f5a('0x4a')][_0x2f5a('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x2f5a('0x3e')]()}}})[_0x2f5a('0xb')](function(_0x2cd422){if(!_0x2cd422){throw new Error(_0x2f5a('0x4c'));}return db['Setting'][_0x2f5a('0x9')]({'attributes':['id',_0x2f5a('0x4d'),_0x2f5a('0x4e'),_0x2f5a('0x4f')]})[_0x2f5a('0xb')](function(_0x16127c){if(_0x16127c[_0x2f5a('0x4d')])authService[_0x2f5a('0x50')](_0x222707[_0x2f5a('0x33')][_0x2f5a('0x51')]);if(!_0x16127c[_0x2f5a('0x4e')]||!_0x2cd422[_0x2f5a('0x52')])return _0x2cd422;authService[_0x2f5a('0x53')](_0x222707['body'][_0x2f5a('0x51')],_0x2cd422['previousPasswords'],_0x16127c['passwordHistoryLimit']);return _0x2cd422;})[_0x2f5a('0xb')](function(){_0x2cd422[_0x2f5a('0x51')]=_0x222707['body']['password'];_0x2cd422['resetPasswordToken']=null;_0x2cd422[_0x2f5a('0x3d')]=null;return _0x2cd422[_0x2f5a('0x3f')]();});})[_0x2f5a('0xb')](function(){_0x4cbb84[_0x2f5a('0x2c')](0xc8)['send']({'message':_0x2f5a('0x54')});})[_0x2f5a('0x49')](function(_0x3ed5e0){return handleError(_0x4cbb84,0x1f4,_0x3ed5e0);});};passport[_0x2f5a('0x55')]('local-login',new LocalStrategy({'usernameField':_0x2f5a('0x14'),'passwordField':'password'},function(_0x410a1e,_0x19985f,_0x4f7d77){return localAuthenticate(db[_0x2f5a('0x38')],_0x410a1e,_0x19985f,_0x4f7d77);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9825d85..7cc5328 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 _0xc115=['post','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x13e77a,_0xadf480){var _0x499845=function(_0x55cd3c){while(--_0x55cd3c){_0x13e77a['push'](_0x13e77a['shift']());}};_0x499845(++_0xadf480);}(_0xc115,0x145));var _0x5c11=function(_0x57a60f,_0x410a3a){_0x57a60f=_0x57a60f-0x0;var _0x19cfe3=_0xc115[_0x57a60f];return _0x19cfe3;};'use strict';var express=require(_0x5c11('0x0'));var router=express[_0x5c11('0x1')]();var controller=require(_0x5c11('0x2'));router[_0x5c11('0x3')]('/',controller['login']);router['post'](_0x5c11('0x4'),controller[_0x5c11('0x5')]);router[_0x5c11('0x3')](_0x5c11('0x6'),controller[_0x5c11('0x7')]);module['exports']=router; \ No newline at end of file +var _0xe73e=['forgot','/reset/:token','exports','Router','./authLocal.controller','login','post','/forgot'];(function(_0x2a8443,_0x43f6a8){var _0x1ccfac=function(_0x3a533c){while(--_0x3a533c){_0x2a8443['push'](_0x2a8443['shift']());}};_0x1ccfac(++_0x43f6a8);}(_0xe73e,0x1f3));var _0xee73=function(_0x5ae190,_0x104c8a){_0x5ae190=_0x5ae190-0x0;var _0x42d1c5=_0xe73e[_0x5ae190];return _0x42d1c5;};'use strict';var express=require('express');var router=express[_0xee73('0x0')]();var controller=require(_0xee73('0x1'));router['post']('/',controller[_0xee73('0x2')]);router[_0xee73('0x3')](_0xee73('0x4'),controller[_0xee73('0x5')]);router['post'](_0xee73('0x6'),controller['reset']);module[_0xee73('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 36c63d6..d70345b 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 _0xa2b8=['INTEGER','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2b8,0x177));var _0x8a2b=function(_0x5338dc,_0x529f8f){_0x5338dc=_0x5338dc-0x0;var _0x3b1f77=_0xa2b8[_0x5338dc];return _0x3b1f77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a2b('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x8a2b('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8a2b('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3d29=['exports','BOOLEAN','sequelize'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x3d29,0x110));var _0x93d2=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x3d29[_0x3afe18];return _0x19ed1f;};'use strict';var Sequelize=require(_0x93d2('0x0'));module[_0x93d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x93d2('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 13af6ab..03d0320 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 _0x44bd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','apply','reject','save','update','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','addConditions','Condition','omit','ids','getConditions','findOne','pick','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44bd,0x143));var _0xd44b=function(_0x4ae83e,_0x518979){_0x4ae83e=_0x4ae83e-0x0;var _0x5add5e=_0x44bd[_0x4ae83e];return _0x5add5e;};'use strict';var emlformat=require(_0xd44b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd44b('0x1'));var jsonpatch=require(_0xd44b('0x2'));var rp=require(_0xd44b('0x3'));var moment=require(_0xd44b('0x4'));var BPromise=require(_0xd44b('0x5'));var Mustache=require(_0xd44b('0x6'));var util=require('util');var path=require(_0xd44b('0x7'));var sox=require(_0xd44b('0x8'));var csv=require(_0xd44b('0x9'));var ejs=require(_0xd44b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd44b('0xb'));var squel=require(_0xd44b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd44b('0xd'));var deskjs=require(_0xd44b('0xe'));var toCsv=require(_0xd44b('0x9'));var querystring=require(_0xd44b('0xf'));var Papa=require(_0xd44b('0x10'));var Redis=require(_0xd44b('0x11'));var authService=require(_0xd44b('0x12'));var qs=require(_0xd44b('0x13'));var as=require(_0xd44b('0x14'));var hardwareService=require(_0xd44b('0x15'));var logger=require(_0xd44b('0x16'))(_0xd44b('0x17'));var utils=require('../../config/utils');var config=require(_0xd44b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd44b('0x19'))['db'];function respondWithStatusCode(_0x4176dd,_0x43a0b9){_0x43a0b9=_0x43a0b9||0xcc;return function(_0x2980c9){if(_0x2980c9){return _0x4176dd[_0xd44b('0x1a')](_0x43a0b9);}return _0x4176dd['status'](_0x43a0b9)['end']();};}function respondWithResult(_0x37e371,_0x49645e){_0x49645e=_0x49645e||0xc8;return function(_0x41a7dc){if(_0x41a7dc){return _0x37e371[_0xd44b('0x1b')](_0x49645e)[_0xd44b('0x1c')](_0x41a7dc);}};}function respondWithFilteredResult(_0x3e1044,_0x2e2a67){return function(_0x5d7ff3){if(_0x5d7ff3){var _0x5e6d8b=typeof _0x2e2a67[_0xd44b('0x1d')]==='undefined'&&typeof _0x2e2a67[_0xd44b('0x1e')]===_0xd44b('0x1f');var _0x51402e=_0x5d7ff3['count'];var _0x12c86c=_0x5e6d8b?0x0:_0x2e2a67[_0xd44b('0x1d')];var _0x9fd116=_0x5e6d8b?_0x5d7ff3['count']:_0x2e2a67[_0xd44b('0x1d')]+_0x2e2a67[_0xd44b('0x1e')];var _0x48422d;if(_0x9fd116>=_0x51402e){_0x9fd116=_0x51402e;_0x48422d=0xc8;}else{_0x48422d=0xce;}_0x3e1044[_0xd44b('0x1b')](_0x48422d);return _0x3e1044['set']('Content-Range',_0x12c86c+'-'+_0x9fd116+'/'+_0x51402e)['json'](_0x5d7ff3);}return null;};}function patchUpdates(_0x41e8ef){return function(_0x1dc02b){try{jsonpatch[_0xd44b('0x20')](_0x1dc02b,_0x41e8ef,!![]);}catch(_0x166521){return BPromise[_0xd44b('0x21')](_0x166521);}return _0x1dc02b[_0xd44b('0x22')]();};}function saveUpdates(_0x2ea0cc,_0x2c8633){return function(_0x24bd4f){if(_0x24bd4f){return _0x24bd4f[_0xd44b('0x23')](_0x2ea0cc)[_0xd44b('0x24')](function(_0x3223d8){return _0x3223d8;});}return null;};}function removeEntity(_0x226aff,_0x46c108){return function(_0x3d2be9){if(_0x3d2be9){return _0x3d2be9['destroy']()[_0xd44b('0x24')](function(){_0x226aff[_0xd44b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10f825,_0x2b213a){return function(_0x14f23e){if(!_0x14f23e){_0x10f825['sendStatus'](0x194);}return _0x14f23e;};}function handleError(_0x219c4d,_0x4c343e){_0x4c343e=_0x4c343e||0x1f4;return function(_0x516356){logger[_0xd44b('0x25')](_0x516356[_0xd44b('0x26')]);if(_0x516356[_0xd44b('0x27')]){delete _0x516356[_0xd44b('0x27')];}_0x219c4d[_0xd44b('0x1b')](_0x4c343e)[_0xd44b('0x28')](_0x516356);};}exports[_0xd44b('0x29')]=function(_0x457b5d,_0x2b90c){var _0x21e3b5={},_0x293a98={},_0x5ec3d2={'count':0x0,'rows':[]};var _0x513484=_[_0xd44b('0x2a')](db[_0xd44b('0x2b')][_0xd44b('0x2c')],function(_0x1215db){return{'name':_0x1215db[_0xd44b('0x2d')],'type':_0x1215db[_0xd44b('0x2e')][_0xd44b('0x2f')]};});_0x293a98['model']=_[_0xd44b('0x2a')](_0x513484,'name');_0x293a98[_0xd44b('0x30')]=_[_0xd44b('0x31')](_0x457b5d[_0xd44b('0x30')]);_0x293a98['filters']=_[_0xd44b('0x32')](_0x293a98[_0xd44b('0x33')],_0x293a98['query']);_0x21e3b5['attributes']=_['intersection'](_0x293a98[_0xd44b('0x33')],qs['fields'](_0x457b5d['query'][_0xd44b('0x34')]));_0x21e3b5[_0xd44b('0x35')]=_0x21e3b5[_0xd44b('0x35')][_0xd44b('0x36')]?_0x21e3b5['attributes']:_0x293a98[_0xd44b('0x33')];if(!_0x457b5d[_0xd44b('0x30')][_0xd44b('0x37')](_0xd44b('0x38'))){_0x21e3b5['limit']=qs[_0xd44b('0x1e')](_0x457b5d['query'][_0xd44b('0x1e')]);_0x21e3b5[_0xd44b('0x1d')]=qs[_0xd44b('0x1d')](_0x457b5d[_0xd44b('0x30')]['offset']);}_0x21e3b5[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x457b5d[_0xd44b('0x30')][_0xd44b('0x3a')]);_0x21e3b5[_0xd44b('0x3b')]=qs['filters'](_['pick'](_0x457b5d[_0xd44b('0x30')],_0x293a98[_0xd44b('0x3c')]),_0x513484);if(_0x457b5d['query'][_0xd44b('0x3d')]){_0x21e3b5['where']=_['merge'](_0x21e3b5[_0xd44b('0x3b')],{'$or':_[_0xd44b('0x2a')](_0x513484,function(_0x273ccf){if(_0x273ccf[_0xd44b('0x2e')]!=='VIRTUAL'){var _0x34762c={};_0x34762c[_0x273ccf['name']]={'$like':'%'+_0x457b5d[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x34762c;}})});}_0x21e3b5=_[_0xd44b('0x3e')]({},_0x21e3b5,_0x457b5d[_0xd44b('0x3f')]);var _0x289739={'where':_0x21e3b5['where']};return db[_0xd44b('0x2b')][_0xd44b('0x40')](_0x289739)[_0xd44b('0x24')](function(_0x17618f){_0x5ec3d2['count']=_0x17618f;if(_0x457b5d['query']['includeAll']){_0x21e3b5['include']=[{'all':!![]}];}return db['Automation'][_0xd44b('0x41')](_0x21e3b5);})[_0xd44b('0x24')](function(_0x295068){_0x5ec3d2[_0xd44b('0x42')]=_0x295068;return _0x5ec3d2;})[_0xd44b('0x24')](respondWithFilteredResult(_0x2b90c,_0x21e3b5))[_0xd44b('0x43')](handleError(_0x2b90c,null));};exports['show']=function(_0x2be128,_0x3073db){var _0x3f5903={'raw':![],'where':{'id':_0x2be128[_0xd44b('0x44')]['id']}},_0x2519ea={};_0x2519ea[_0xd44b('0x33')]=_['keys'](db[_0xd44b('0x2b')]['rawAttributes']);_0x2519ea['query']=_[_0xd44b('0x31')](_0x2be128[_0xd44b('0x30')]);_0x2519ea['filters']=_['intersection'](_0x2519ea['model'],_0x2519ea[_0xd44b('0x30')]);_0x3f5903[_0xd44b('0x35')]=_[_0xd44b('0x32')](_0x2519ea[_0xd44b('0x33')],qs[_0xd44b('0x34')](_0x2be128[_0xd44b('0x30')][_0xd44b('0x34')]));_0x3f5903[_0xd44b('0x35')]=_0x3f5903[_0xd44b('0x35')][_0xd44b('0x36')]?_0x3f5903['attributes']:_0x2519ea['model'];if(_0x2be128['query'][_0xd44b('0x45')]){_0x3f5903[_0xd44b('0x46')]=[{'all':!![]}];}_0x3f5903=_[_0xd44b('0x3e')]({},_0x3f5903,_0x2be128[_0xd44b('0x3f')]);return db['Automation'][_0xd44b('0x47')](_0x3f5903)[_0xd44b('0x24')](handleEntityNotFound(_0x3073db,null))[_0xd44b('0x24')](respondWithResult(_0x3073db,null))[_0xd44b('0x43')](handleError(_0x3073db,null));};exports[_0xd44b('0x48')]=function(_0x274833,_0x2d17be){return db[_0xd44b('0x2b')]['create'](_0x274833[_0xd44b('0x49')],{})[_0xd44b('0x24')](respondWithResult(_0x2d17be,0xc9))[_0xd44b('0x43')](handleError(_0x2d17be,null));};exports[_0xd44b('0x23')]=function(_0x5d04a2,_0x27c800){if(_0x5d04a2[_0xd44b('0x49')]['id']){delete _0x5d04a2[_0xd44b('0x49')]['id'];}return db[_0xd44b('0x2b')][_0xd44b('0x47')]({'where':{'id':_0x5d04a2[_0xd44b('0x44')]['id']}})['then'](handleEntityNotFound(_0x27c800,null))[_0xd44b('0x24')](saveUpdates(_0x5d04a2[_0xd44b('0x49')],null))['then'](respondWithResult(_0x27c800,null))[_0xd44b('0x43')](handleError(_0x27c800,null));};exports[_0xd44b('0x4a')]=function(_0x2ce26a,_0x4b5dd2){return db[_0xd44b('0x2b')][_0xd44b('0x47')]({'where':{'id':_0x2ce26a[_0xd44b('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b5dd2,null))[_0xd44b('0x24')](removeEntity(_0x4b5dd2,null))[_0xd44b('0x43')](handleError(_0x4b5dd2,null));};exports[_0xd44b('0x4b')]=function(_0xae08,_0x4ef50b,_0x133649){return db[_0xd44b('0x4c')]['find']({'where':{'id':_0xae08['params']['id']}})['then'](handleEntityNotFound(_0x4ef50b,null))[_0xd44b('0x24')](function(_0x55d5ce){if(_0x55d5ce){return _0x55d5ce[_0xd44b('0x4b')](_0xae08[_0xd44b('0x49')]['ids'],_[_0xd44b('0x4d')](_0xae08[_0xd44b('0x49')],[_0xd44b('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4ef50b,null))['catch'](handleError(_0x4ef50b,null));};exports[_0xd44b('0x4f')]=function(_0x3ac6f4,_0x55fdc6,_0x5f3b52){var _0x481523={};var _0x25af26={};var _0xb2b393;var _0x2f5c5c;return db['Automation'][_0xd44b('0x50')]({'where':{'id':_0x3ac6f4['params']['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x55fdc6,null))[_0xd44b('0x24')](function(_0x426f7e){if(_0x426f7e){_0xb2b393=_0x426f7e;_0x25af26[_0xd44b('0x33')]=_[_0xd44b('0x31')](db[_0xd44b('0x4c')][_0xd44b('0x2c')]);_0x25af26['query']=_[_0xd44b('0x31')](_0x3ac6f4[_0xd44b('0x30')]);_0x25af26[_0xd44b('0x3c')]=_['intersection'](_0x25af26[_0xd44b('0x33')],_0x25af26[_0xd44b('0x30')]);_0x481523[_0xd44b('0x35')]=_[_0xd44b('0x32')](_0x25af26[_0xd44b('0x33')],qs[_0xd44b('0x34')](_0x3ac6f4['query'][_0xd44b('0x34')]));_0x481523['attributes']=_0x481523['attributes'][_0xd44b('0x36')]?_0x481523[_0xd44b('0x35')]:_0x25af26[_0xd44b('0x33')];_0x481523[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x3ac6f4[_0xd44b('0x30')]['sort']);_0x481523[_0xd44b('0x3b')]=qs['filters'](_[_0xd44b('0x51')](_0x3ac6f4[_0xd44b('0x30')],_0x25af26['filters']));if(_0x3ac6f4[_0xd44b('0x30')]['filter']){_0x481523['where']=_[_0xd44b('0x3e')](_0x481523[_0xd44b('0x3b')],{'$or':_[_0xd44b('0x2a')](_0x481523[_0xd44b('0x35')],function(_0x2e274b){var _0x41c0a9={};_0x41c0a9[_0x2e274b]={'$like':'%'+_0x3ac6f4[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x41c0a9;})});}_0x481523=_['merge']({},_0x481523,_0x3ac6f4[_0xd44b('0x3f')]);return _0xb2b393['getConditions'](_0x481523);}})[_0xd44b('0x24')](function(_0x2438fe){if(_0x2438fe){_0x2f5c5c=_0x2438fe['length'];if(!_0x3ac6f4[_0xd44b('0x30')]['hasOwnProperty']('nolimit')){_0x481523[_0xd44b('0x1e')]=qs[_0xd44b('0x1e')](_0x3ac6f4['query']['limit']);_0x481523['offset']=qs[_0xd44b('0x1d')](_0x3ac6f4[_0xd44b('0x30')][_0xd44b('0x1d')]);}return _0xb2b393[_0xd44b('0x4f')](_0x481523);}})[_0xd44b('0x24')](function(_0x6e8ede){if(_0x6e8ede){return _0x6e8ede?{'count':_0x2f5c5c,'rows':_0x6e8ede}:null;}})[_0xd44b('0x24')](respondWithResult(_0x55fdc6,null))[_0xd44b('0x43')](handleError(_0x55fdc6,null));};exports[_0xd44b('0x52')]=function(_0x5f4f66,_0x1d55b1,_0x3beaff){return db[_0xd44b('0x53')][_0xd44b('0x47')]({'where':{'id':_0x5f4f66['params']['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x1d55b1,null))['then'](function(_0x2b2036){if(_0x2b2036){return _0x2b2036[_0xd44b('0x52')](_0x5f4f66[_0xd44b('0x49')]['ids'],_[_0xd44b('0x4d')](_0x5f4f66['body'],['ids','id'])||{});}})[_0xd44b('0x24')](respondWithResult(_0x1d55b1,null))[_0xd44b('0x43')](handleError(_0x1d55b1,null));};exports[_0xd44b('0x54')]=function(_0x886cf8,_0x22ca85,_0xd9bb1c){var _0x29d234={};var _0x2db881={};var _0xef1de9;var _0x42df86;return db[_0xd44b('0x2b')]['findOne']({'where':{'id':_0x886cf8[_0xd44b('0x44')]['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x22ca85,null))[_0xd44b('0x24')](function(_0x434915){if(_0x434915){_0xef1de9=_0x434915;_0x2db881[_0xd44b('0x33')]=_['keys'](db[_0xd44b('0x53')][_0xd44b('0x2c')]);_0x2db881[_0xd44b('0x30')]=_[_0xd44b('0x31')](_0x886cf8[_0xd44b('0x30')]);_0x2db881[_0xd44b('0x3c')]=_[_0xd44b('0x32')](_0x2db881[_0xd44b('0x33')],_0x2db881['query']);_0x29d234['attributes']=_[_0xd44b('0x32')](_0x2db881['model'],qs[_0xd44b('0x34')](_0x886cf8['query'][_0xd44b('0x34')]));_0x29d234[_0xd44b('0x35')]=_0x29d234[_0xd44b('0x35')]['length']?_0x29d234['attributes']:_0x2db881[_0xd44b('0x33')];_0x29d234[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3a')]);_0x29d234['where']=qs[_0xd44b('0x3c')](_[_0xd44b('0x51')](_0x886cf8[_0xd44b('0x30')],_0x2db881[_0xd44b('0x3c')]));if(_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3d')]){_0x29d234[_0xd44b('0x3b')]=_[_0xd44b('0x3e')](_0x29d234['where'],{'$or':_['map'](_0x29d234[_0xd44b('0x35')],function(_0x204111){var _0x283e66={};_0x283e66[_0x204111]={'$like':'%'+_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x283e66;})});}_0x29d234=_['merge']({},_0x29d234,_0x886cf8['options']);return _0xef1de9['getActions'](_0x29d234);}})[_0xd44b('0x24')](function(_0x3a86fe){if(_0x3a86fe){_0x42df86=_0x3a86fe[_0xd44b('0x36')];if(!_0x886cf8['query'][_0xd44b('0x37')](_0xd44b('0x38'))){_0x29d234['limit']=qs[_0xd44b('0x1e')](_0x886cf8[_0xd44b('0x30')][_0xd44b('0x1e')]);_0x29d234['offset']=qs[_0xd44b('0x1d')](_0x886cf8[_0xd44b('0x30')]['offset']);}return _0xef1de9[_0xd44b('0x54')](_0x29d234);}})['then'](function(_0x3f4377){if(_0x3f4377){return _0x3f4377?{'count':_0x42df86,'rows':_0x3f4377}:null;}})[_0xd44b('0x24')](respondWithResult(_0x22ca85,null))[_0xd44b('0x43')](handleError(_0x22ca85,null));}; \ No newline at end of file +var _0xeeb1=['includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','ids','findOne','Condition','getConditions','hasOwnProperty','addActions','omit','getActions','Action','nolimit','eml-format','zip-dir','fast-json-patch','moment','util','lodash','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge'];(function(_0x3fabbf,_0xe1b751){var _0x3186ea=function(_0x1f9493){while(--_0x1f9493){_0x3fabbf['push'](_0x3fabbf['shift']());}};_0x3186ea(++_0xe1b751);}(_0xeeb1,0x14e));var _0x1eeb=function(_0x6a7421,_0x20b4f5){_0x6a7421=_0x6a7421-0x0;var _0x33f5d1=_0xeeb1[_0x6a7421];return _0x33f5d1;};'use strict';var emlformat=require(_0x1eeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1eeb('0x1'));var jsonpatch=require(_0x1eeb('0x2'));var rp=require('request-promise');var moment=require(_0x1eeb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1eeb('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1eeb('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1eeb('0x6'));var deskjs=require('desk.js');var toCsv=require(_0x1eeb('0x7'));var querystring=require(_0x1eeb('0x8'));var Papa=require(_0x1eeb('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1eeb('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eeb('0xb'));var logger=require(_0x1eeb('0xc'))(_0x1eeb('0xd'));var utils=require(_0x1eeb('0xe'));var config=require(_0x1eeb('0xf'));var licenseUtil=require(_0x1eeb('0x10'));var db=require(_0x1eeb('0x11'))['db'];function respondWithStatusCode(_0x2faa7b,_0x2d460a){_0x2d460a=_0x2d460a||0xcc;return function(_0x46f067){if(_0x46f067){return _0x2faa7b[_0x1eeb('0x12')](_0x2d460a);}return _0x2faa7b[_0x1eeb('0x13')](_0x2d460a)[_0x1eeb('0x14')]();};}function respondWithResult(_0x1f6566,_0x17312b){_0x17312b=_0x17312b||0xc8;return function(_0x3d7596){if(_0x3d7596){return _0x1f6566[_0x1eeb('0x13')](_0x17312b)[_0x1eeb('0x15')](_0x3d7596);}};}function respondWithFilteredResult(_0x461be8,_0xdc3c33){return function(_0x4e6d49){if(_0x4e6d49){var _0x92c488=typeof _0xdc3c33['offset']===_0x1eeb('0x16')&&typeof _0xdc3c33[_0x1eeb('0x17')]==='undefined';var _0x53a297=_0x4e6d49['count'];var _0x216d77=_0x92c488?0x0:_0xdc3c33['offset'];var _0x2c7b98=_0x92c488?_0x4e6d49[_0x1eeb('0x18')]:_0xdc3c33[_0x1eeb('0x19')]+_0xdc3c33[_0x1eeb('0x17')];var _0x3fcb29;if(_0x2c7b98>=_0x53a297){_0x2c7b98=_0x53a297;_0x3fcb29=0xc8;}else{_0x3fcb29=0xce;}_0x461be8[_0x1eeb('0x13')](_0x3fcb29);return _0x461be8['set'](_0x1eeb('0x1a'),_0x216d77+'-'+_0x2c7b98+'/'+_0x53a297)['json'](_0x4e6d49);}return null;};}function patchUpdates(_0x42b665){return function(_0x2b5b0b){try{jsonpatch[_0x1eeb('0x1b')](_0x2b5b0b,_0x42b665,!![]);}catch(_0x5ac8a9){return BPromise['reject'](_0x5ac8a9);}return _0x2b5b0b[_0x1eeb('0x1c')]();};}function saveUpdates(_0x1fe93f,_0xc73ff8){return function(_0x5b72fc){if(_0x5b72fc){return _0x5b72fc[_0x1eeb('0x1d')](_0x1fe93f)[_0x1eeb('0x1e')](function(_0x3ddb59){return _0x3ddb59;});}return null;};}function removeEntity(_0x2e0484,_0x2540a6){return function(_0x787ddc){if(_0x787ddc){return _0x787ddc[_0x1eeb('0x1f')]()['then'](function(){_0x2e0484[_0x1eeb('0x13')](0xcc)[_0x1eeb('0x14')]();});}};}function handleEntityNotFound(_0x159561,_0xf56d6a){return function(_0x36d557){if(!_0x36d557){_0x159561[_0x1eeb('0x12')](0x194);}return _0x36d557;};}function handleError(_0x41e2a4,_0x16da5f){_0x16da5f=_0x16da5f||0x1f4;return function(_0xd30c4d){logger[_0x1eeb('0x20')](_0xd30c4d['stack']);if(_0xd30c4d[_0x1eeb('0x21')]){delete _0xd30c4d[_0x1eeb('0x21')];}_0x41e2a4[_0x1eeb('0x13')](_0x16da5f)[_0x1eeb('0x22')](_0xd30c4d);};}exports[_0x1eeb('0x23')]=function(_0x369065,_0x3ace44){var _0x323bb5={},_0x2e6cb2={},_0x2cda05={'count':0x0,'rows':[]};var _0x933be1=_['map'](db[_0x1eeb('0x24')][_0x1eeb('0x25')],function(_0x5c0f97){return{'name':_0x5c0f97[_0x1eeb('0x26')],'type':_0x5c0f97[_0x1eeb('0x27')][_0x1eeb('0x28')]};});_0x2e6cb2[_0x1eeb('0x29')]=_[_0x1eeb('0x2a')](_0x933be1,_0x1eeb('0x21'));_0x2e6cb2[_0x1eeb('0x2b')]=_['keys'](_0x369065['query']);_0x2e6cb2['filters']=_['intersection'](_0x2e6cb2[_0x1eeb('0x29')],_0x2e6cb2[_0x1eeb('0x2b')]);_0x323bb5[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x2e6cb2[_0x1eeb('0x29')],qs['fields'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x2e')]));_0x323bb5[_0x1eeb('0x2c')]=_0x323bb5[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x323bb5[_0x1eeb('0x2c')]:_0x2e6cb2[_0x1eeb('0x29')];if(!_0x369065[_0x1eeb('0x2b')]['hasOwnProperty']('nolimit')){_0x323bb5['limit']=qs[_0x1eeb('0x17')](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0x323bb5[_0x1eeb('0x19')]=qs['offset'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}_0x323bb5[_0x1eeb('0x30')]=qs['sort'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0x323bb5[_0x1eeb('0x32')]=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x369065[_0x1eeb('0x2b')],_0x2e6cb2[_0x1eeb('0x33')]),_0x933be1);if(_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0x323bb5['where']=_['merge'](_0x323bb5[_0x1eeb('0x32')],{'$or':_[_0x1eeb('0x2a')](_0x933be1,function(_0x2868a1){if(_0x2868a1[_0x1eeb('0x27')]!==_0x1eeb('0x36')){var _0x47fa0c={};_0x47fa0c[_0x2868a1[_0x1eeb('0x21')]]={'$like':'%'+_0x369065[_0x1eeb('0x2b')]['filter']+'%'};return _0x47fa0c;}})});}_0x323bb5=_[_0x1eeb('0x37')]({},_0x323bb5,_0x369065['options']);var _0x1bd5ed={'where':_0x323bb5[_0x1eeb('0x32')]};return db[_0x1eeb('0x24')][_0x1eeb('0x18')](_0x1bd5ed)['then'](function(_0x266edb){_0x2cda05['count']=_0x266edb;if(_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x38')]){_0x323bb5[_0x1eeb('0x39')]=[{'all':!![]}];}return db[_0x1eeb('0x24')][_0x1eeb('0x3a')](_0x323bb5);})[_0x1eeb('0x1e')](function(_0x53d459){_0x2cda05[_0x1eeb('0x3b')]=_0x53d459;return _0x2cda05;})[_0x1eeb('0x1e')](respondWithFilteredResult(_0x3ace44,_0x323bb5))[_0x1eeb('0x3c')](handleError(_0x3ace44,null));};exports[_0x1eeb('0x3d')]=function(_0x2aba74,_0x59b7df){var _0x5ac76f={'raw':![],'where':{'id':_0x2aba74[_0x1eeb('0x3e')]['id']}},_0x20d4a7={};_0x20d4a7[_0x1eeb('0x29')]=_[_0x1eeb('0x3f')](db[_0x1eeb('0x24')][_0x1eeb('0x25')]);_0x20d4a7[_0x1eeb('0x2b')]=_['keys'](_0x2aba74[_0x1eeb('0x2b')]);_0x20d4a7[_0x1eeb('0x33')]=_[_0x1eeb('0x2d')](_0x20d4a7[_0x1eeb('0x29')],_0x20d4a7[_0x1eeb('0x2b')]);_0x5ac76f[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x20d4a7[_0x1eeb('0x29')],qs['fields'](_0x2aba74['query'][_0x1eeb('0x2e')]));_0x5ac76f[_0x1eeb('0x2c')]=_0x5ac76f[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x5ac76f[_0x1eeb('0x2c')]:_0x20d4a7[_0x1eeb('0x29')];if(_0x2aba74[_0x1eeb('0x2b')][_0x1eeb('0x38')]){_0x5ac76f[_0x1eeb('0x39')]=[{'all':!![]}];}_0x5ac76f=_[_0x1eeb('0x37')]({},_0x5ac76f,_0x2aba74[_0x1eeb('0x40')]);return db[_0x1eeb('0x24')]['find'](_0x5ac76f)[_0x1eeb('0x1e')](handleEntityNotFound(_0x59b7df,null))[_0x1eeb('0x1e')](respondWithResult(_0x59b7df,null))[_0x1eeb('0x3c')](handleError(_0x59b7df,null));};exports[_0x1eeb('0x41')]=function(_0xfe982c,_0x498153){return db['Automation'][_0x1eeb('0x41')](_0xfe982c['body'],{})[_0x1eeb('0x1e')](respondWithResult(_0x498153,0xc9))[_0x1eeb('0x3c')](handleError(_0x498153,null));};exports[_0x1eeb('0x1d')]=function(_0x13ff3d,_0x44d64f){if(_0x13ff3d[_0x1eeb('0x42')]['id']){delete _0x13ff3d['body']['id'];}return db[_0x1eeb('0x24')][_0x1eeb('0x43')]({'where':{'id':_0x13ff3d[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x44d64f,null))[_0x1eeb('0x1e')](saveUpdates(_0x13ff3d[_0x1eeb('0x42')],null))[_0x1eeb('0x1e')](respondWithResult(_0x44d64f,null))[_0x1eeb('0x3c')](handleError(_0x44d64f,null));};exports[_0x1eeb('0x1f')]=function(_0x327041,_0x5ce347){return db[_0x1eeb('0x24')]['find']({'where':{'id':_0x327041[_0x1eeb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ce347,null))['then'](removeEntity(_0x5ce347,null))[_0x1eeb('0x3c')](handleError(_0x5ce347,null));};exports['addConditions']=function(_0x291252,_0x5706d2,_0x2e97ca){return db['Condition'][_0x1eeb('0x43')]({'where':{'id':_0x291252['params']['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x5706d2,null))['then'](function(_0x111a2a){if(_0x111a2a){return _0x111a2a['addConditions'](_0x291252[_0x1eeb('0x42')][_0x1eeb('0x44')],_['omit'](_0x291252['body'],[_0x1eeb('0x44'),'id'])||{});}})[_0x1eeb('0x1e')](respondWithResult(_0x5706d2,null))[_0x1eeb('0x3c')](handleError(_0x5706d2,null));};exports['getConditions']=function(_0x48e214,_0x226869,_0x2f11bb){var _0x271066={};var _0x4a36d0={};var _0x2648e1;var _0x458e00;return db[_0x1eeb('0x24')][_0x1eeb('0x45')]({'where':{'id':_0x48e214[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x226869,null))[_0x1eeb('0x1e')](function(_0x1e08a7){if(_0x1e08a7){_0x2648e1=_0x1e08a7;_0x4a36d0[_0x1eeb('0x29')]=_[_0x1eeb('0x3f')](db[_0x1eeb('0x46')][_0x1eeb('0x25')]);_0x4a36d0[_0x1eeb('0x2b')]=_[_0x1eeb('0x3f')](_0x48e214[_0x1eeb('0x2b')]);_0x4a36d0[_0x1eeb('0x33')]=_[_0x1eeb('0x2d')](_0x4a36d0['model'],_0x4a36d0[_0x1eeb('0x2b')]);_0x271066[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x4a36d0[_0x1eeb('0x29')],qs[_0x1eeb('0x2e')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x2e')]));_0x271066['attributes']=_0x271066[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x271066[_0x1eeb('0x2c')]:_0x4a36d0[_0x1eeb('0x29')];_0x271066[_0x1eeb('0x30')]=qs[_0x1eeb('0x31')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0x271066['where']=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x48e214['query'],_0x4a36d0['filters']));if(_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0x271066[_0x1eeb('0x32')]=_[_0x1eeb('0x37')](_0x271066[_0x1eeb('0x32')],{'$or':_['map'](_0x271066[_0x1eeb('0x2c')],function(_0x1387b1){var _0x117e88={};_0x117e88[_0x1387b1]={'$like':'%'+_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x35')]+'%'};return _0x117e88;})});}_0x271066=_[_0x1eeb('0x37')]({},_0x271066,_0x48e214['options']);return _0x2648e1[_0x1eeb('0x47')](_0x271066);}})[_0x1eeb('0x1e')](function(_0x2c2057){if(_0x2c2057){_0x458e00=_0x2c2057['length'];if(!_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x48')]('nolimit')){_0x271066['limit']=qs['limit'](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0x271066[_0x1eeb('0x19')]=qs[_0x1eeb('0x19')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}return _0x2648e1[_0x1eeb('0x47')](_0x271066);}})['then'](function(_0x2aed06){if(_0x2aed06){return _0x2aed06?{'count':_0x458e00,'rows':_0x2aed06}:null;}})[_0x1eeb('0x1e')](respondWithResult(_0x226869,null))[_0x1eeb('0x3c')](handleError(_0x226869,null));};exports[_0x1eeb('0x49')]=function(_0x2b9544,_0x102749,_0x226c9b){return db['Action'][_0x1eeb('0x43')]({'where':{'id':_0x2b9544[_0x1eeb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x102749,null))['then'](function(_0x43b9e0){if(_0x43b9e0){return _0x43b9e0[_0x1eeb('0x49')](_0x2b9544[_0x1eeb('0x42')]['ids'],_[_0x1eeb('0x4a')](_0x2b9544[_0x1eeb('0x42')],[_0x1eeb('0x44'),'id'])||{});}})['then'](respondWithResult(_0x102749,null))[_0x1eeb('0x3c')](handleError(_0x102749,null));};exports[_0x1eeb('0x4b')]=function(_0x3e4f1c,_0x1e36ca,_0x224938){var _0xda9f5a={};var _0x31a455={};var _0x51f467;var _0x2306e5;return db['Automation']['findOne']({'where':{'id':_0x3e4f1c[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x1e36ca,null))['then'](function(_0x4bcad8){if(_0x4bcad8){_0x51f467=_0x4bcad8;_0x31a455['model']=_['keys'](db[_0x1eeb('0x4c')][_0x1eeb('0x25')]);_0x31a455[_0x1eeb('0x2b')]=_[_0x1eeb('0x3f')](_0x3e4f1c[_0x1eeb('0x2b')]);_0x31a455['filters']=_[_0x1eeb('0x2d')](_0x31a455['model'],_0x31a455[_0x1eeb('0x2b')]);_0xda9f5a[_0x1eeb('0x2c')]=_['intersection'](_0x31a455[_0x1eeb('0x29')],qs[_0x1eeb('0x2e')](_0x3e4f1c[_0x1eeb('0x2b')]['fields']));_0xda9f5a[_0x1eeb('0x2c')]=_0xda9f5a[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0xda9f5a[_0x1eeb('0x2c')]:_0x31a455[_0x1eeb('0x29')];_0xda9f5a['order']=qs['sort'](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0xda9f5a['where']=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x3e4f1c[_0x1eeb('0x2b')],_0x31a455[_0x1eeb('0x33')]));if(_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0xda9f5a[_0x1eeb('0x32')]=_[_0x1eeb('0x37')](_0xda9f5a[_0x1eeb('0x32')],{'$or':_[_0x1eeb('0x2a')](_0xda9f5a['attributes'],function(_0x3a3af7){var _0x51639f={};_0x51639f[_0x3a3af7]={'$like':'%'+_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x35')]+'%'};return _0x51639f;})});}_0xda9f5a=_[_0x1eeb('0x37')]({},_0xda9f5a,_0x3e4f1c[_0x1eeb('0x40')]);return _0x51f467[_0x1eeb('0x4b')](_0xda9f5a);}})['then'](function(_0x49b19d){if(_0x49b19d){_0x2306e5=_0x49b19d[_0x1eeb('0x2f')];if(!_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x48')](_0x1eeb('0x4d'))){_0xda9f5a[_0x1eeb('0x17')]=qs[_0x1eeb('0x17')](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0xda9f5a[_0x1eeb('0x19')]=qs[_0x1eeb('0x19')](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}return _0x51f467[_0x1eeb('0x4b')](_0xda9f5a);}})['then'](function(_0x494eae){if(_0x494eae){return _0x494eae?{'count':_0x2306e5,'rows':_0x494eae}:null;}})[_0x1eeb('0x1e')](respondWithResult(_0x1e36ca,null))[_0x1eeb('0x3c')](handleError(_0x1e36ca,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 72399be..7e28f5c 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 _0xa59c=['Automation','tools_automations','lodash','util','request-promise','path','../../config/environment','./automation.attributes','define'];(function(_0x3aa88e,_0x4f2dc8){var _0x3bbdee=function(_0x459c2d){while(--_0x459c2d){_0x3aa88e['push'](_0x3aa88e['shift']());}};_0x3bbdee(++_0x4f2dc8);}(_0xa59c,0x14f));var _0xca59=function(_0x2c2616,_0x14ec49){_0x2c2616=_0x2c2616-0x0;var _0x327d21=_0xa59c[_0x2c2616];return _0x327d21;};'use strict';var _=require(_0xca59('0x0'));var util=require(_0xca59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca59('0x2'));var fs=require('fs');var path=require(_0xca59('0x3'));var rimraf=require('rimraf');var config=require(_0xca59('0x4'));var attributes=require(_0xca59('0x5'));module['exports']=function(_0x4cdeaa,_0x161d65){return _0x4cdeaa[_0xca59('0x6')](_0xca59('0x7'),attributes,{'tableName':_0xca59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x864c=['../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x864c,0x125));var _0xc864=function(_0x121789,_0x24bd14){_0x121789=_0x121789-0x0;var _0x108646=_0x864c[_0x121789];return _0x108646;};'use strict';var _=require(_0xc864('0x0'));var util=require(_0xc864('0x1'));var logger=require(_0xc864('0x2'))(_0xc864('0x3'));var moment=require(_0xc864('0x4'));var BPromise=require(_0xc864('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc864('0x6'));var rimraf=require('rimraf');var config=require(_0xc864('0x7'));var attributes=require(_0xc864('0x8'));module['exports']=function(_0x42b298,_0x15dd9b){return _0x42b298[_0xc864('0x9')](_0xc864('0xa'),attributes,{'tableName':_0xc864('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 5150ce8..8babc30 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 _0x958a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2713e1,_0xfd4305){var _0x4bd714=function(_0x359529){while(--_0x359529){_0x2713e1['push'](_0x2713e1['shift']());}};_0x4bd714(++_0xfd4305);}(_0x958a,0x128));var _0xa958=function(_0x3aaa0b,_0xe53b50){_0x3aaa0b=_0x3aaa0b-0x0;var _0x29e865=_0x958a[_0x3aaa0b];return _0x29e865;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});} \ No newline at end of file +var _0x390a=['jayson/promise','client','request','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x9ead04,_0x5abdf1){var _0x1fa9c8=function(_0x9c348){while(--_0x9c348){_0x9ead04['push'](_0x9ead04['shift']());}};_0x1fa9c8(++_0x5abdf1);}(_0x390a,0xc9));var _0xa390=function(_0x1289a7,_0x51e6d8){_0x1289a7=_0x1289a7-0x0;var _0x341185=_0x390a[_0x1289a7];return _0x341185;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x4'));var db=require(_0xa390('0x5'))['db'];var utils=require(_0xa390('0x6'));var logger=require(_0xa390('0x7'))('rpc');var config=require(_0xa390('0x8'));var jayson=require(_0xa390('0x9'));var client=jayson[_0xa390('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49cc,_0x1f9de0,_0x53bfb4){return new BPromise(function(_0x492418,_0xc8cd85){return client[_0xa390('0xb')](_0x2d49cc,_0x53bfb4)[_0xa390('0xc')](function(_0x226003){logger[_0xa390('0xd')]('Automation,\x20%s,\x20%s',_0x1f9de0,'request\x20sent');logger[_0xa390('0xe')](_0xa390('0xf'),_0x1f9de0,_0xa390('0x10'),JSON['stringify'](_0x226003));if(_0x226003[_0xa390('0x11')]){if(_0x226003[_0xa390('0x11')]['code']===0x1f4){logger[_0xa390('0x11')](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0xc8cd85(_0x226003[_0xa390('0x11')][_0xa390('0x13')]);}logger['error'](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0x492418(_0x226003['error'][_0xa390('0x13')]);}else{logger['info'](_0xa390('0x12'),_0x1f9de0,_0xa390('0x10'));_0x492418(_0x226003['result'][_0xa390('0x13')]);}})[_0xa390('0x14')](function(_0x59d609){logger[_0xa390('0x11')]('Automation,\x20%s,\x20%s',_0x1f9de0,_0x59d609);_0xc8cd85(_0x59d609);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8a2f13e..1e15159 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 _0x074a=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x074a,0x97));var _0xa074=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x074a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require(_0xa074('0x3'));var express=require('express');var router=express[_0xa074('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa074('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa074('0x6'));router[_0xa074('0x7')]('/',auth[_0xa074('0x8')](),controller[_0xa074('0x9')]);router[_0xa074('0x7')](_0xa074('0xa'),auth[_0xa074('0x8')](),controller[_0xa074('0xb')]);router[_0xa074('0x7')](_0xa074('0xc'),auth[_0xa074('0x8')](),controller[_0xa074('0xd')]);router[_0xa074('0x7')](_0xa074('0xe'),auth[_0xa074('0x8')](),controller[_0xa074('0xf')]);router[_0xa074('0x10')]('/',auth[_0xa074('0x8')](),controller[_0xa074('0x11')]);router[_0xa074('0x10')](_0xa074('0xc'),auth[_0xa074('0x8')](),controller[_0xa074('0x12')]);router[_0xa074('0x10')](_0xa074('0xe'),auth[_0xa074('0x8')](),controller[_0xa074('0x13')]);router[_0xa074('0x14')](_0xa074('0xa'),auth[_0xa074('0x8')](),controller[_0xa074('0x15')]);router[_0xa074('0x16')]('/:id',auth[_0xa074('0x8')](),controller[_0xa074('0x17')]);module[_0xa074('0x18')]=router; \ No newline at end of file +var _0xdecb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','/:id/actions','addActions','put','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x4d87a1,_0x3029fe){var _0x4c0343=function(_0x5355d0){while(--_0x5355d0){_0x4d87a1['push'](_0x4d87a1['shift']());}};_0x4c0343(++_0x3029fe);}(_0xdecb,0xe2));var _0xbdec=function(_0x498a6a,_0x3136d8){_0x498a6a=_0x498a6a-0x0;var _0x1fb842=_0xdecb[_0x498a6a];return _0x1fb842;};'use strict';var multer=require('multer');var util=require(_0xbdec('0x0'));var path=require(_0xbdec('0x1'));var timeout=require(_0xbdec('0x2'));var express=require('express');var router=express[_0xbdec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbdec('0x4'));var interaction=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var controller=require(_0xbdec('0x7'));router[_0xbdec('0x8')]('/',auth[_0xbdec('0x9')](),controller[_0xbdec('0xa')]);router['get'](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0xc')]);router[_0xbdec('0x8')](_0xbdec('0xd'),auth[_0xbdec('0x9')](),controller[_0xbdec('0xe')]);router[_0xbdec('0x8')]('/:id/actions',auth[_0xbdec('0x9')](),controller[_0xbdec('0xf')]);router[_0xbdec('0x10')]('/',auth[_0xbdec('0x9')](),controller['create']);router[_0xbdec('0x10')](_0xbdec('0xd'),auth[_0xbdec('0x9')](),controller['addConditions']);router[_0xbdec('0x10')](_0xbdec('0x11'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x12')]);router[_0xbdec('0x13')](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x14')]);router[_0xbdec('0x15')](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x16')]);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 475a2b3..b8e7b55 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 _0x42a1=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','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)'];(function(_0x115fdb,_0x338195){var _0x36edb7=function(_0xefbbe0){while(--_0xefbbe0){_0x115fdb['push'](_0x115fdb['shift']());}};_0x36edb7(++_0x338195);}(_0x42a1,0x123));var _0x142a=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x42a1[_0x4a5494];return _0x57cbb5;};'use strict';var Sequelize=require(_0x142a('0x0'));module[_0x142a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x142a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x142a('0x3')](_0x142a('0x4')),'allowNull':![],'defaultValue':_0x142a('0x4')},'description':{'type':Sequelize[_0x142a('0x5')]},'active':{'type':Sequelize[_0x142a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x142a('0x7')](0x4)[_0x142a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x142a('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'comment':_0x142a('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x142a('0xd')},'dialTimezone':{'type':Sequelize[_0x142a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x142a('0x5')],'defaultValue':_0x142a('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x142a('0x3')](_0x142a('0xf'),_0x142a('0x10'),_0x142a('0x11')),'defaultValue':_0x142a('0xf')},'dialAMDActive':{'type':Sequelize[_0x142a('0x6')],'defaultValue':0x0,'comment':_0x142a('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x142a('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x142a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x142a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x142a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x142a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x142a('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x142a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x142a('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x142a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x142a('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x142a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x142a('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x142a('0x3')](_0x142a('0x1b'),_0x142a('0x1c')),'defaultValue':_0x142a('0x1b')},'dialPrefix':{'type':Sequelize[_0x142a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x142a('0x1d')},'dialCutDigit':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x142a('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x25')}}; \ No newline at end of file +var _0x69ed=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x69ed,0x1b6));var _0xd69e=function(_0xfc68da,_0x14afb0){_0xfc68da=_0xfc68da-0x0;var _0x10919e=_0x69ed[_0xfc68da];return _0x10919e;};'use strict';var Sequelize=require(_0xd69e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd69e('0x1')],'unique':_0xd69e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd69e('0x3')](_0xd69e('0x4')),'allowNull':![],'defaultValue':_0xd69e('0x4')},'description':{'type':Sequelize[_0xd69e('0x1')]},'active':{'type':Sequelize[_0xd69e('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd69e('0x6')](0x4)[_0xd69e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd69e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd69e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd69e('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd69e('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd69e('0xc')},'dialTimezone':{'type':Sequelize[_0xd69e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd69e('0x1')],'defaultValue':_0xd69e('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xd69e('0x3')]('always','never',_0xd69e('0xe')),'defaultValue':_0xd69e('0xf')},'dialAMDActive':{'type':Sequelize[_0xd69e('0x5')],'defaultValue':0x0,'comment':_0xd69e('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd69e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd69e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd69e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd69e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd69e('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd69e('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd69e('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd69e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd69e('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd69e('0x3')]('DESC',_0xd69e('0x19')),'defaultValue':_0xd69e('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd69e('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd69e('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4ddcb25..284d1e5 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 _0x8307=['getHopperHistories','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','scheduledAt','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','from','onlyIfOpen','fromQuery','NOW()','cm_contacts','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','rows'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x8307,0xc4));var _0x7830=function(_0x2969f0,_0x11b411){_0x2969f0=_0x2969f0-0x0;var _0x2ca8c0=_0x8307[_0x2969f0];return _0x2ca8c0;};'use strict';var emlformat=require(_0x7830('0x0'));var rimraf=require(_0x7830('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7830('0x2'));var rp=require(_0x7830('0x3'));var moment=require(_0x7830('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7830('0x5'));var util=require(_0x7830('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7830('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7830('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7830('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7830('0xa'));var toCsv=require(_0x7830('0x7'));var querystring=require('querystring');var Papa=require(_0x7830('0xb'));var Redis=require(_0x7830('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7830('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7830('0xe'))(_0x7830('0xf'));var utils=require(_0x7830('0x10'));var config=require(_0x7830('0x11'));var licenseUtil=require(_0x7830('0x12'));var db=require(_0x7830('0x13'))['db'];function respondWithStatusCode(_0x36e303,_0x39450e){_0x39450e=_0x39450e||0xcc;return function(_0x4fdb60){if(_0x4fdb60){return _0x36e303[_0x7830('0x14')](_0x39450e);}return _0x36e303[_0x7830('0x15')](_0x39450e)[_0x7830('0x16')]();};}function respondWithResult(_0x5db865,_0x4dd3e0){_0x4dd3e0=_0x4dd3e0||0xc8;return function(_0x5818f6){if(_0x5818f6){return _0x5db865[_0x7830('0x15')](_0x4dd3e0)['json'](_0x5818f6);}};}function respondWithFilteredResult(_0x27d88a,_0x16b7e7){return function(_0x29a4bd){if(_0x29a4bd){var _0x38906b=typeof _0x16b7e7[_0x7830('0x17')]===_0x7830('0x18')&&typeof _0x16b7e7[_0x7830('0x19')]===_0x7830('0x18');var _0x355c4e=_0x29a4bd[_0x7830('0x1a')];var _0x3bc49a=_0x38906b?0x0:_0x16b7e7[_0x7830('0x17')];var _0xf5cda=_0x38906b?_0x29a4bd[_0x7830('0x1a')]:_0x16b7e7[_0x7830('0x17')]+_0x16b7e7['limit'];var _0x40674b;if(_0xf5cda>=_0x355c4e){_0xf5cda=_0x355c4e;_0x40674b=0xc8;}else{_0x40674b=0xce;}_0x27d88a[_0x7830('0x15')](_0x40674b);return _0x27d88a[_0x7830('0x1b')](_0x7830('0x1c'),_0x3bc49a+'-'+_0xf5cda+'/'+_0x355c4e)[_0x7830('0x1d')](_0x29a4bd);}return null;};}function patchUpdates(_0x3966bd){return function(_0x1eaf27){try{jsonpatch[_0x7830('0x1e')](_0x1eaf27,_0x3966bd,!![]);}catch(_0x492be9){return BPromise[_0x7830('0x1f')](_0x492be9);}return _0x1eaf27[_0x7830('0x20')]();};}function saveUpdates(_0x8d90af,_0x152213){return function(_0x3ab7d6){if(_0x3ab7d6){return _0x3ab7d6['update'](_0x8d90af)[_0x7830('0x21')](function(_0x168546){return _0x168546;});}return null;};}function removeEntity(_0x3da993,_0x56efc3){return function(_0x2f69d3){if(_0x2f69d3){return _0x2f69d3['destroy']()['then'](function(){var _0x11668a=_0x2f69d3[_0x7830('0x22')]({'plain':!![]});var _0x449d4b=_0x7830('0x23');return db[_0x7830('0x24')][_0x7830('0x25')]({'where':{'type':_0x449d4b,'resourceId':_0x11668a['id']}})[_0x7830('0x21')](function(){return _0x2f69d3;});})[_0x7830('0x21')](function(){_0x3da993[_0x7830('0x15')](0xcc)[_0x7830('0x16')]();});}};}function handleEntityNotFound(_0xc6ca8e,_0x17b1c6){return function(_0x5cbfc2){if(!_0x5cbfc2){_0xc6ca8e[_0x7830('0x14')](0x194);}return _0x5cbfc2;};}function handleError(_0x214f4b,_0x555eab){_0x555eab=_0x555eab||0x1f4;return function(_0x2a6018){logger[_0x7830('0x26')](_0x2a6018['stack']);if(_0x2a6018[_0x7830('0x27')]){delete _0x2a6018[_0x7830('0x27')];}_0x214f4b['status'](_0x555eab)[_0x7830('0x28')](_0x2a6018);};}exports[_0x7830('0x29')]=function(_0x14a345,_0x12debf){var _0x461fe={},_0x172bb7={},_0x4f798d={'count':0x0,'rows':[]};var _0x116fdd=_[_0x7830('0x2a')](db[_0x7830('0x2b')][_0x7830('0x2c')],function(_0x10baa5){return{'name':_0x10baa5[_0x7830('0x2d')],'type':_0x10baa5[_0x7830('0x2e')][_0x7830('0x2f')]};});_0x172bb7[_0x7830('0x30')]=_[_0x7830('0x2a')](_0x116fdd,_0x7830('0x27'));_0x172bb7[_0x7830('0x31')]=_[_0x7830('0x32')](_0x14a345[_0x7830('0x31')]);_0x172bb7[_0x7830('0x33')]=_['intersection'](_0x172bb7[_0x7830('0x30')],_0x172bb7[_0x7830('0x31')]);_0x461fe['attributes']=_[_0x7830('0x34')](_0x172bb7['model'],qs['fields'](_0x14a345[_0x7830('0x31')][_0x7830('0x35')]));_0x461fe[_0x7830('0x36')]=_0x461fe[_0x7830('0x36')][_0x7830('0x37')]?_0x461fe[_0x7830('0x36')]:_0x172bb7[_0x7830('0x30')];if(!_0x14a345['query'][_0x7830('0x38')](_0x7830('0x39'))){_0x461fe[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x14a345[_0x7830('0x31')][_0x7830('0x19')]);_0x461fe['offset']=qs['offset'](_0x14a345[_0x7830('0x31')][_0x7830('0x17')]);}_0x461fe[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x14a345[_0x7830('0x31')][_0x7830('0x3b')]);_0x461fe[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x14a345[_0x7830('0x31')],_0x172bb7[_0x7830('0x33')]),_0x116fdd);if(_0x14a345[_0x7830('0x31')][_0x7830('0x3e')]){_0x461fe[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x461fe[_0x7830('0x3c')],{'$or':_['map'](_0x116fdd,function(_0x4cf61c){if(_0x4cf61c[_0x7830('0x2e')]!==_0x7830('0x40')){var _0x5487cf={};_0x5487cf[_0x4cf61c[_0x7830('0x27')]]={'$like':'%'+_0x14a345[_0x7830('0x31')]['filter']+'%'};return _0x5487cf;}})});}_0x461fe=_[_0x7830('0x3f')]({},_0x461fe,_0x14a345['options']);var _0x50579b={'where':_0x461fe[_0x7830('0x3c')]};return db['Campaign']['count'](_0x50579b)[_0x7830('0x21')](function(_0x623843){_0x4f798d[_0x7830('0x1a')]=_0x623843;if(_0x14a345['query'][_0x7830('0x41')]){_0x461fe[_0x7830('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x7830('0x43')](_0x461fe);})[_0x7830('0x21')](function(_0xfb5857){_0x4f798d['rows']=_0xfb5857;return _0x4f798d;})[_0x7830('0x21')](respondWithFilteredResult(_0x12debf,_0x461fe))[_0x7830('0x44')](handleError(_0x12debf,null));};exports[_0x7830('0x45')]=function(_0x25b00d,_0x3bfaab){var _0x525fcc={'raw':![],'where':{'id':_0x25b00d[_0x7830('0x46')]['id']}},_0x3f2a4a={};_0x3f2a4a[_0x7830('0x30')]=_[_0x7830('0x32')](db['Campaign']['rawAttributes']);_0x3f2a4a[_0x7830('0x31')]=_[_0x7830('0x32')](_0x25b00d[_0x7830('0x31')]);_0x3f2a4a[_0x7830('0x33')]=_[_0x7830('0x34')](_0x3f2a4a[_0x7830('0x30')],_0x3f2a4a[_0x7830('0x31')]);_0x525fcc['attributes']=_[_0x7830('0x34')](_0x3f2a4a[_0x7830('0x30')],qs[_0x7830('0x35')](_0x25b00d[_0x7830('0x31')][_0x7830('0x35')]));_0x525fcc[_0x7830('0x36')]=_0x525fcc[_0x7830('0x36')]['length']?_0x525fcc[_0x7830('0x36')]:_0x3f2a4a[_0x7830('0x30')];if(_0x25b00d[_0x7830('0x31')][_0x7830('0x41')]){_0x525fcc[_0x7830('0x42')]=[{'all':!![]}];}_0x525fcc=_[_0x7830('0x3f')]({},_0x525fcc,_0x25b00d[_0x7830('0x47')]);return db['Campaign'][_0x7830('0x48')](_0x525fcc)[_0x7830('0x21')](handleEntityNotFound(_0x3bfaab,null))['then'](respondWithResult(_0x3bfaab,null))[_0x7830('0x44')](handleError(_0x3bfaab,null));};exports[_0x7830('0x49')]=function(_0x28c373,_0x1e74e0){return db[_0x7830('0x2b')][_0x7830('0x49')](_0x28c373[_0x7830('0x4a')],{})[_0x7830('0x21')](function(_0x3b03bb){var _0x357300=_0x28c373[_0x7830('0x4b')]['get']({'plain':!![]});if(!_0x357300)throw new Error(_0x7830('0x4c'));if(_0x357300[_0x7830('0x4d')]===_0x7830('0x4b')){var _0x3d789b=_0x3b03bb['get']({'plain':!![]});var _0x42ebde=_0x7830('0x23');return db[_0x7830('0x4e')][_0x7830('0x48')]({'where':{'name':_0x42ebde,'userProfileId':_0x357300[_0x7830('0x4f')]},'raw':!![]})[_0x7830('0x21')](function(_0x32e7bf){if(_0x32e7bf&&_0x32e7bf[_0x7830('0x50')]===0x0){return db['UserProfileResource'][_0x7830('0x49')]({'name':_0x3d789b[_0x7830('0x27')],'resourceId':_0x3d789b['id'],'type':_0x32e7bf[_0x7830('0x27')],'sectionId':_0x32e7bf['id']},{})[_0x7830('0x21')](function(){return _0x3b03bb;});}else{return _0x3b03bb;}})[_0x7830('0x44')](function(_0x341ca9){logger[_0x7830('0x26')](_0x7830('0x51'),_0x341ca9);throw _0x341ca9;});}return _0x3b03bb;})[_0x7830('0x21')](respondWithResult(_0x1e74e0,0xc9))[_0x7830('0x44')](handleError(_0x1e74e0,null));};exports[_0x7830('0x52')]=function(_0xc09d5a,_0x35f188){var _0x7985bb={'where':{'id':_0xc09d5a[_0x7830('0x46')]['id']}},_0x5a7b5c={};_0x5a7b5c[_0x7830('0x30')]=_['keys'](db[_0x7830('0x2b')]['rawAttributes']);_0x7985bb[_0x7830('0x36')]=_[_0x7830('0x34')](_0x5a7b5c['model'],qs[_0x7830('0x35')](_0xc09d5a['query']['fields']));_0x7985bb[_0x7830('0x36')]=_0x7985bb[_0x7830('0x36')][_0x7830('0x37')]?_0x7985bb[_0x7830('0x36')]:_0x5a7b5c[_0x7830('0x30')];if(_0xc09d5a[_0x7830('0x31')][_0x7830('0x41')]){_0x7985bb['include']=[{'all':!![]}];}_0x7985bb=_[_0x7830('0x3f')]({},_0x7985bb,_0xc09d5a[_0x7830('0x47')]);return db[_0x7830('0x2b')][_0x7830('0x48')](_0x7985bb)[_0x7830('0x21')](handleEntityNotFound(_0x35f188,null))[_0x7830('0x21')](function(_0x3e6d34){if(_0x3e6d34){var _0x139608=_0x3e6d34[_0x7830('0x22')]({'plain':!![]});_0x139608=qs[_0x7830('0x53')](_0x139608,['id',_0x7830('0x54'),_0x7830('0x55')]);_0xc09d5a[_0x7830('0x4a')]=_[_0x7830('0x53')](_0xc09d5a['body'],['id',_0x7830('0x54'),_0x7830('0x55')]);return db['Campaign'][_0x7830('0x49')](_['merge'](_0x139608,_0xc09d5a[_0x7830('0x4a')]),{'include':_0xc09d5a[_0x7830('0x31')][_0x7830('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x315df4){var _0x598f98=_0xc09d5a[_0x7830('0x4b')][_0x7830('0x22')]({'plain':!![]});if(!_0x598f98)throw new Error(_0x7830('0x4c'));if(_0x598f98[_0x7830('0x4d')]===_0x7830('0x4b')){var _0x4edc54=_0x315df4[_0x7830('0x22')]({'plain':!![]});var _0xced78a=_0x7830('0x23');return db[_0x7830('0x4e')][_0x7830('0x48')]({'where':{'name':_0xced78a,'userProfileId':_0x598f98[_0x7830('0x4f')]},'raw':!![]})['then'](function(_0x2f683e){if(_0x2f683e&&_0x2f683e['autoAssociation']===0x0){return db[_0x7830('0x24')][_0x7830('0x49')]({'name':_0x4edc54['name'],'resourceId':_0x4edc54['id'],'type':_0x2f683e[_0x7830('0x27')],'sectionId':_0x2f683e['id']},{})['then'](function(){return _0x315df4;});}else{return _0x315df4;}})[_0x7830('0x44')](function(_0x184883){logger[_0x7830('0x26')](_0x7830('0x51'),_0x184883);throw _0x184883;});}return _0x315df4;});}})[_0x7830('0x21')](respondWithResult(_0x35f188,0xc9))[_0x7830('0x44')](handleError(_0x35f188,null));};exports['update']=function(_0x407be0,_0x189009){if(_0x407be0[_0x7830('0x4a')]['id']){delete _0x407be0['body']['id'];}return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x407be0[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x189009,null))[_0x7830('0x21')](saveUpdates(_0x407be0[_0x7830('0x4a')],null))[_0x7830('0x21')](respondWithResult(_0x189009,null))[_0x7830('0x44')](handleError(_0x189009,null));};exports[_0x7830('0x25')]=function(_0xda6837,_0x4b1162){return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0xda6837[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x4b1162,null))['then'](removeEntity(_0x4b1162,null))[_0x7830('0x44')](handleError(_0x4b1162,null));};exports[_0x7830('0x56')]=function(_0x384da4,_0x590f92,_0x3c05ab){var _0xda1b4f={'raw':!![],'where':{}};var _0xde637c={};var _0x3a0b0b={'count':0x0,'rows':[]};return db['Campaign'][_0x7830('0x57')]({'where':{'id':_0x384da4[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x590f92,null))[_0x7830('0x21')](function(_0x8ed649){if(_0x8ed649){_0xde637c[_0x7830('0x30')]=_['keys'](db[_0x7830('0x58')][_0x7830('0x2c')]);_0xde637c[_0x7830('0x31')]=_[_0x7830('0x32')](_0x384da4[_0x7830('0x31')]);_0xde637c['filters']=_['intersection'](_0xde637c[_0x7830('0x30')],_0xde637c[_0x7830('0x31')]);_0xda1b4f[_0x7830('0x36')]=_['intersection'](_0xde637c[_0x7830('0x30')],qs['fields'](_0x384da4[_0x7830('0x31')][_0x7830('0x35')]));_0xda1b4f[_0x7830('0x36')]=_0xda1b4f[_0x7830('0x36')]['length']?_0xda1b4f[_0x7830('0x36')]:_0xde637c['model'];if(!_0x384da4[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0xda1b4f['limit']=qs[_0x7830('0x19')](_0x384da4[_0x7830('0x31')]['limit']);_0xda1b4f[_0x7830('0x17')]=qs['offset'](_0x384da4[_0x7830('0x31')][_0x7830('0x17')]);}_0xda1b4f[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x384da4[_0x7830('0x31')][_0x7830('0x3b')]);_0xda1b4f[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x384da4['query'],_0xde637c[_0x7830('0x33')]));_0xda1b4f[_0x7830('0x3c')]['CampaignId']=_0x8ed649['id'];if(_0x384da4['query']['filter']){_0xda1b4f[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0xda1b4f[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0xda1b4f[_0x7830('0x36')],function(_0x262c2c){var _0xf39aed={};_0xf39aed[_0x262c2c]={'$like':'%'+_0x384da4['query'][_0x7830('0x3e')]+'%'};return _0xf39aed;})});}_0xda1b4f=_['merge']({},_0xda1b4f,_0x384da4[_0x7830('0x47')]);return db['CmHopper'][_0x7830('0x1a')]({'where':_0xda1b4f[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x4787){_0x3a0b0b['count']=_0x4787;if(_0x384da4[_0x7830('0x31')][_0x7830('0x41')]){_0xda1b4f[_0x7830('0x42')]=[{'all':!![]}];}return db[_0x7830('0x58')][_0x7830('0x43')](_0xda1b4f);})['then'](function(_0x4d3b6f){_0x3a0b0b[_0x7830('0x59')]=_0x4d3b6f;return _0x3a0b0b;});}})['then'](respondWithFilteredResult(_0x590f92,_0xda1b4f))['catch'](handleError(_0x590f92,null));};exports[_0x7830('0x5a')]=function(_0x5a7400,_0x21e6be,_0x41843e){var _0x59ead9={'raw':!![],'where':{}};var _0x2f2289={};var _0x4b0559={'count':0x0,'rows':[]};return db[_0x7830('0x2b')]['findOne']({'where':{'id':_0x5a7400[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x21e6be,null))[_0x7830('0x21')](function(_0x4c8fea){if(_0x4c8fea){_0x2f2289[_0x7830('0x30')]=_[_0x7830('0x32')](db['CmHopperHistory'][_0x7830('0x2c')]);_0x2f2289['query']=_[_0x7830('0x32')](_0x5a7400[_0x7830('0x31')]);_0x2f2289[_0x7830('0x33')]=_['intersection'](_0x2f2289[_0x7830('0x30')],_0x2f2289[_0x7830('0x31')]);_0x59ead9[_0x7830('0x36')]=_[_0x7830('0x34')](_0x2f2289['model'],qs['fields'](_0x5a7400[_0x7830('0x31')][_0x7830('0x35')]));_0x59ead9[_0x7830('0x36')]=_0x59ead9['attributes'][_0x7830('0x37')]?_0x59ead9[_0x7830('0x36')]:_0x2f2289[_0x7830('0x30')];if(!_0x5a7400['query']['hasOwnProperty'](_0x7830('0x39'))){_0x59ead9[_0x7830('0x19')]=qs['limit'](_0x5a7400[_0x7830('0x31')]['limit']);_0x59ead9['offset']=qs[_0x7830('0x17')](_0x5a7400['query'][_0x7830('0x17')]);}_0x59ead9['order']=qs['sort'](_0x5a7400[_0x7830('0x31')][_0x7830('0x3b')]);_0x59ead9['where']=qs['filters'](_['pick'](_0x5a7400['query'],_0x2f2289[_0x7830('0x33')]));_0x59ead9[_0x7830('0x3c')][_0x7830('0x5b')]=_0x4c8fea['id'];if(_0x5a7400[_0x7830('0x31')]['filter']){_0x59ead9[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x59ead9[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x59ead9[_0x7830('0x36')],function(_0x3fedc0){var _0xecdac8={};_0xecdac8[_0x3fedc0]={'$like':'%'+_0x5a7400[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0xecdac8;})});}_0x59ead9=_['merge']({},_0x59ead9,_0x5a7400[_0x7830('0x47')]);return db[_0x7830('0x5c')][_0x7830('0x1a')]({'where':_0x59ead9[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x3ecf35){_0x4b0559[_0x7830('0x1a')]=_0x3ecf35;if(_0x5a7400[_0x7830('0x31')][_0x7830('0x41')]){_0x59ead9['include']=[{'all':!![]}];}return db[_0x7830('0x5c')][_0x7830('0x43')](_0x59ead9);})[_0x7830('0x21')](function(_0x2ec5d7){_0x4b0559[_0x7830('0x59')]=_0x2ec5d7;return _0x4b0559;});}})['then'](respondWithFilteredResult(_0x21e6be,_0x59ead9))[_0x7830('0x44')](handleError(_0x21e6be,null));};exports['getHopperFinals']=function(_0x2751ee,_0x31a950,_0x59008f){var _0x225aa3={'raw':!![],'where':{}};var _0xadfa94={};var _0x367f64={'count':0x0,'rows':[]};return db[_0x7830('0x2b')][_0x7830('0x57')]({'where':{'id':_0x2751ee[_0x7830('0x46')]['id']}})['then'](handleEntityNotFound(_0x31a950,null))[_0x7830('0x21')](function(_0x13c2fd){if(_0x13c2fd){_0xadfa94[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x5d')]['rawAttributes']);_0xadfa94[_0x7830('0x31')]=_['keys'](_0x2751ee[_0x7830('0x31')]);_0xadfa94[_0x7830('0x33')]=_['intersection'](_0xadfa94['model'],_0xadfa94[_0x7830('0x31')]);_0x225aa3[_0x7830('0x36')]=_[_0x7830('0x34')](_0xadfa94[_0x7830('0x30')],qs[_0x7830('0x35')](_0x2751ee[_0x7830('0x31')][_0x7830('0x35')]));_0x225aa3[_0x7830('0x36')]=_0x225aa3[_0x7830('0x36')][_0x7830('0x37')]?_0x225aa3[_0x7830('0x36')]:_0xadfa94[_0x7830('0x30')];if(!_0x2751ee[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x225aa3['limit']=qs[_0x7830('0x19')](_0x2751ee[_0x7830('0x31')][_0x7830('0x19')]);_0x225aa3[_0x7830('0x17')]=qs[_0x7830('0x17')](_0x2751ee[_0x7830('0x31')][_0x7830('0x17')]);}_0x225aa3[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x2751ee['query'][_0x7830('0x3b')]);_0x225aa3['where']=qs[_0x7830('0x33')](_['pick'](_0x2751ee[_0x7830('0x31')],_0xadfa94['filters']));_0x225aa3[_0x7830('0x3c')][_0x7830('0x5b')]=_0x13c2fd['id'];if(_0x2751ee[_0x7830('0x31')]['filter']){_0x225aa3[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x225aa3[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x225aa3[_0x7830('0x36')],function(_0xf28c68){var _0x27815d={};_0x27815d[_0xf28c68]={'$like':'%'+_0x2751ee[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x27815d;})});}_0x225aa3=_[_0x7830('0x3f')]({},_0x225aa3,_0x2751ee[_0x7830('0x47')]);return db[_0x7830('0x5d')][_0x7830('0x1a')]({'where':_0x225aa3[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x1c568a){_0x367f64[_0x7830('0x1a')]=_0x1c568a;if(_0x2751ee[_0x7830('0x31')]['includeAll']){_0x225aa3[_0x7830('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x225aa3);})[_0x7830('0x21')](function(_0x325b60){_0x367f64[_0x7830('0x59')]=_0x325b60;return _0x367f64;});}})['then'](respondWithFilteredResult(_0x31a950,_0x225aa3))[_0x7830('0x44')](handleError(_0x31a950,null));};exports[_0x7830('0x5e')]=function(_0x424175,_0x1a019d,_0x53b465){var _0x266888={'raw':!![],'where':{}};var _0x54bf0c={};var _0x386c1f={'count':0x0,'rows':[]};return db[_0x7830('0x2b')][_0x7830('0x57')]({'where':{'id':_0x424175[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x1a019d,null))[_0x7830('0x21')](function(_0xb1473b){if(_0xb1473b){_0x54bf0c[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x5f')][_0x7830('0x2c')]);_0x54bf0c[_0x7830('0x31')]=_['keys'](_0x424175[_0x7830('0x31')]);_0x54bf0c[_0x7830('0x33')]=_[_0x7830('0x34')](_0x54bf0c[_0x7830('0x30')],_0x54bf0c[_0x7830('0x31')]);_0x266888[_0x7830('0x36')]=_['intersection'](_0x54bf0c[_0x7830('0x30')],qs[_0x7830('0x35')](_0x424175[_0x7830('0x31')][_0x7830('0x35')]));_0x266888['attributes']=_0x266888[_0x7830('0x36')][_0x7830('0x37')]?_0x266888[_0x7830('0x36')]:_0x54bf0c[_0x7830('0x30')];if(!_0x424175[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x266888[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x424175[_0x7830('0x31')][_0x7830('0x19')]);_0x266888[_0x7830('0x17')]=qs['offset'](_0x424175[_0x7830('0x31')][_0x7830('0x17')]);}_0x266888[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x424175[_0x7830('0x31')][_0x7830('0x3b')]);_0x266888[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x424175[_0x7830('0x31')],_0x54bf0c[_0x7830('0x33')]));_0x266888[_0x7830('0x3c')]['CampaignId']=_0xb1473b['id'];if(_0x424175[_0x7830('0x31')][_0x7830('0x3e')]){_0x266888[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x266888[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x266888[_0x7830('0x36')],function(_0x2e731b){var _0x45bdb0={};_0x45bdb0[_0x2e731b]={'$like':'%'+_0x424175[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x45bdb0;})});}_0x266888=_['merge']({},_0x266888,_0x424175[_0x7830('0x47')]);return db['CmHopperBlack']['count']({'where':_0x266888['where']})[_0x7830('0x21')](function(_0x5a6d81){_0x386c1f[_0x7830('0x1a')]=_0x5a6d81;if(_0x424175[_0x7830('0x31')][_0x7830('0x41')]){_0x266888['include']=[{'all':!![]}];}return db[_0x7830('0x5f')]['findAll'](_0x266888);})[_0x7830('0x21')](function(_0x59f8dd){_0x386c1f[_0x7830('0x59')]=_0x59f8dd;return _0x386c1f;});}})['then'](respondWithFilteredResult(_0x1a019d,_0x266888))['catch'](handleError(_0x1a019d,null));};exports['getLists']=function(_0x424bab,_0x51b20e,_0x366e0f){var _0x244a2d={};var _0x334a9e={};var _0x2b8074;var _0x51682a;return db['Campaign']['findOne']({'where':{'id':_0x424bab['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x51b20e,null))[_0x7830('0x21')](function(_0x40332d){if(_0x40332d){_0x2b8074=_0x40332d;_0x334a9e[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x60')][_0x7830('0x2c')]);_0x334a9e[_0x7830('0x31')]=_[_0x7830('0x32')](_0x424bab['query']);_0x334a9e[_0x7830('0x33')]=_[_0x7830('0x34')](_0x334a9e[_0x7830('0x30')],_0x334a9e[_0x7830('0x31')]);_0x244a2d['attributes']=_[_0x7830('0x34')](_0x334a9e[_0x7830('0x30')],qs[_0x7830('0x35')](_0x424bab[_0x7830('0x31')][_0x7830('0x35')]));_0x244a2d[_0x7830('0x36')]=_0x244a2d[_0x7830('0x36')][_0x7830('0x37')]?_0x244a2d[_0x7830('0x36')]:_0x334a9e[_0x7830('0x30')];_0x244a2d[_0x7830('0x3a')]=qs['sort'](_0x424bab[_0x7830('0x31')]['sort']);_0x244a2d[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x424bab[_0x7830('0x31')],_0x334a9e[_0x7830('0x33')]));if(_0x424bab[_0x7830('0x31')][_0x7830('0x3e')]){_0x244a2d['where']=_[_0x7830('0x3f')](_0x244a2d[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x244a2d['attributes'],function(_0x59ccff){var _0x13f0b2={};_0x13f0b2[_0x59ccff]={'$like':'%'+_0x424bab[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x13f0b2;})});}_0x244a2d=_[_0x7830('0x3f')]({},_0x244a2d,_0x424bab[_0x7830('0x47')]);return _0x2b8074[_0x7830('0x61')](_0x244a2d);}})['then'](function(_0x4e40a3){if(_0x4e40a3){_0x51682a=_0x4e40a3[_0x7830('0x37')];if(!_0x424bab[_0x7830('0x31')]['hasOwnProperty'](_0x7830('0x39'))){_0x244a2d['limit']=qs[_0x7830('0x19')](_0x424bab[_0x7830('0x31')][_0x7830('0x19')]);_0x244a2d[_0x7830('0x17')]=qs[_0x7830('0x17')](_0x424bab['query']['offset']);}return _0x2b8074[_0x7830('0x61')](_0x244a2d);}})[_0x7830('0x21')](function(_0x2235c7){if(_0x2235c7){return _0x2235c7?{'count':_0x51682a,'rows':_0x2235c7}:null;}})[_0x7830('0x21')](respondWithResult(_0x51b20e,null))['catch'](handleError(_0x51b20e,null));};exports[_0x7830('0x62')]=function(_0x1ac28f,_0x3a4614,_0x2477d4){var _0x242559,_0x5237df;var _0x25383b=[];var _0x192d31=moment()['format'](_0x7830('0x63'));return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x1ac28f[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x3a4614,null))[_0x7830('0x21')](function(_0x13e144){if(_0x13e144){_0x5237df=_0x13e144;return _0x13e144[_0x7830('0x62')](_0x1ac28f[_0x7830('0x4a')][_0x7830('0x64')],_['omit'](_0x1ac28f[_0x7830('0x4a')],[_0x7830('0x64'),'id'])||{});}return null;})['spread'](function(_0x765635){var _0xe9c1b5;var _0x4d404e;_0x242559=_0x765635||[];var _0x2d44a5=[];if(_0x765635){for(var _0x3ebfe6=0x0;_0x3ebfe6<_0x765635[_0x7830('0x37')];_0x3ebfe6+=0x1){var _0x5c67dd=_0x765635[_0x3ebfe6][_0x7830('0x22')]({'plain':!![]});_0x5237df[_0x7830('0x65')]=_0x1ac28f[_0x7830('0x4a')]['dialCheckDuplicateType']?_0x1ac28f['body'][_0x7830('0x65')]:_0x5237df[_0x7830('0x65')];switch(_0x5237df[_0x7830('0x65')]){case _0x7830('0x66'):_0xe9c1b5=squel[_0x7830('0x67')]()[_0x7830('0x68')](_0x7830('0x69'))['fromQuery']([_0x7830('0x6a'),'scheduledAt',_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')]('NOW()',_0x7830('0x6f'))[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0x5c67dd['CmListId'][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')](),_0x7830('0x5b'))['field']('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))['from']('cm_contacts')[_0x7830('0x3c')](_0x7830('0x71'))['where'](_0x7830('0x72'),_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74'))[_0x7830('0x3c')](_0x7830('0x75'),squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x76'))['from'](_0x7830('0x77'))[_0x7830('0x3c')](_0x7830('0x78'),_0x1ac28f['params']['id']['toString']()))[_0x7830('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7830('0x6d')]()[_0x7830('0x6e')]('COALESCE(phone,\x27\x27)')[_0x7830('0x79')](_0x7830('0x69'))[_0x7830('0x3c')](_0x7830('0x78'),_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())))[_0x7830('0x70')]();break;case _0x7830('0x7a'):_0xe9c1b5=squel['insert']()[_0x7830('0x68')](_0x7830('0x69'))[_0x7830('0x7b')](['phone',_0x7830('0x6f'),_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),'createdAt',_0x7830('0x55')],squel[_0x7830('0x6d')]()['field'](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')](_0x7830('0x7c'),'scheduledAt')[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')](),_0x7830('0x5b'))['field']('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74'))[_0x7830('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7830('0x6d')]()['field'](_0x7830('0x7e'))[_0x7830('0x79')](_0x7830('0x69'))[_0x7830('0x3c')]('CampaignId\x20=\x20?',_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())))[_0x7830('0x70')]();break;default:_0xe9c1b5=squel[_0x7830('0x67')]()[_0x7830('0x68')](_0x7830('0x69'))['fromQuery'](['phone','scheduledAt','ContactId',_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()['field'](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')](_0x7830('0x7c'),_0x7830('0x6f'))['field']('id',_0x7830('0x6b'))['field'](_0x5c67dd[_0x7830('0x73')]['toString'](),'ListId')[_0x7830('0x6e')](_0x1ac28f['params']['id'][_0x7830('0x70')](),_0x7830('0x5b'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27','updatedAt')[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')](_0x7830('0x71'))[_0x7830('0x3c')]('ListId\x20=\x20?',_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x7830('0x70')]();}_0x4d404e=squel[_0x7830('0x67')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x7830('0x7f'),_0x7830('0x6f'),'phone',_0x7830('0x80'),'createdAt',_0x7830('0x55')],squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x81'),'id')[_0x7830('0x6e')]('NOW()',_0x7830('0x6f'))['field'](_0x7830('0x82'),_0x7830('0x6a'))[_0x7830('0x6e')]('ci.OrderBY','OrderBy')[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))['from'](_0x7830('0x83'),'ci')[_0x7830('0x84')](_0x7830('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x7830('0x85'),_0x5c67dd['CmListId'][_0x7830('0x70')]())['where']('h.CampaignId=?',_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())['where'](_0x7830('0x86'),_0x192d31))[_0x7830('0x70')]();_0x2d44a5[_0x7830('0x87')](db[_0x7830('0x88')][_0x7830('0x31')](_0xe9c1b5));_0x25383b[_0x7830('0x87')](db['sequelize'][_0x7830('0x31')](_0x4d404e));}return BPromise[_0x7830('0x89')](_0x2d44a5);}})['then'](function(){return BPromise[_0x7830('0x89')](_0x25383b);})['then'](function(){return _0x242559;})[_0x7830('0x21')](respondWithResult(_0x3a4614,null))[_0x7830('0x44')](handleError(_0x3a4614,null));};exports[_0x7830('0x8a')]=function(_0x23d9b3,_0xdb7cd6,_0x29bdbc){return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x23d9b3['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0xdb7cd6,null))[_0x7830('0x21')](function(_0x3204f0){if(_0x3204f0){return _0x3204f0[_0x7830('0x8a')](_0x23d9b3[_0x7830('0x31')][_0x7830('0x64')]);}})[_0x7830('0x21')](function(_0xe0245e){if(_0xe0245e){return db['CmHopper'][_0x7830('0x25')]({'where':{'ListId':_0x23d9b3[_0x7830('0x31')][_0x7830('0x64')],'CampaignId':_0x23d9b3[_0x7830('0x46')]['id']}})[_0x7830('0x21')](function(){return _0xe0245e;});}})['then'](respondWithStatusCode(_0xdb7cd6,null))[_0x7830('0x44')](handleError(_0xdb7cd6,null));};exports[_0x7830('0x8b')]=function(_0x24318a,_0x3f82b3,_0x302aa4){var _0x3915e0={};var _0x11ddcd={};var _0x187a73;var _0x200870;return db['Campaign'][_0x7830('0x57')]({'where':{'id':_0x24318a['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x3f82b3,null))['then'](function(_0x1534da){if(_0x1534da){_0x187a73=_0x1534da;_0x11ddcd[_0x7830('0x30')]=_[_0x7830('0x32')](db['CmList'][_0x7830('0x2c')]);_0x11ddcd[_0x7830('0x31')]=_[_0x7830('0x32')](_0x24318a[_0x7830('0x31')]);_0x11ddcd[_0x7830('0x33')]=_[_0x7830('0x34')](_0x11ddcd['model'],_0x11ddcd[_0x7830('0x31')]);_0x3915e0['attributes']=_[_0x7830('0x34')](_0x11ddcd[_0x7830('0x30')],qs[_0x7830('0x35')](_0x24318a[_0x7830('0x31')][_0x7830('0x35')]));_0x3915e0[_0x7830('0x36')]=_0x3915e0[_0x7830('0x36')][_0x7830('0x37')]?_0x3915e0[_0x7830('0x36')]:_0x11ddcd[_0x7830('0x30')];_0x3915e0[_0x7830('0x3a')]=qs['sort'](_0x24318a['query']['sort']);_0x3915e0[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x24318a['query'],_0x11ddcd[_0x7830('0x33')]));if(_0x24318a['query']['filter']){_0x3915e0[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x3915e0[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x3915e0['attributes'],function(_0x49da77){var _0x41e095={};_0x41e095[_0x49da77]={'$like':'%'+_0x24318a[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x41e095;})});}_0x3915e0=_[_0x7830('0x3f')]({},_0x3915e0,_0x24318a['options']);return _0x187a73[_0x7830('0x8b')](_0x3915e0);}})[_0x7830('0x21')](function(_0xf1ec90){if(_0xf1ec90){_0x200870=_0xf1ec90[_0x7830('0x37')];if(!_0x24318a[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x3915e0[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x24318a[_0x7830('0x31')][_0x7830('0x19')]);_0x3915e0['offset']=qs[_0x7830('0x17')](_0x24318a[_0x7830('0x31')]['offset']);}return _0x187a73[_0x7830('0x8b')](_0x3915e0);}})[_0x7830('0x21')](function(_0xf9532f){if(_0xf9532f){return _0xf9532f?{'count':_0x200870,'rows':_0xf9532f}:null;}})[_0x7830('0x21')](respondWithResult(_0x3f82b3,null))[_0x7830('0x44')](handleError(_0x3f82b3,null));};exports[_0x7830('0x8c')]=function(_0x16329c,_0x38e751,_0x4713af){var _0x599903,_0x59f7d1;var _0x3514df=[];var _0x164ccd=moment()[_0x7830('0x8d')](_0x7830('0x63'));return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x16329c[_0x7830('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e751,null))[_0x7830('0x21')](function(_0xce6fbb){if(_0xce6fbb){_0x59f7d1=_0xce6fbb;return _0xce6fbb[_0x7830('0x8c')](_0x16329c[_0x7830('0x4a')][_0x7830('0x64')],_[_0x7830('0x53')](_0x16329c[_0x7830('0x4a')],['ids','id'])||{});}return null;})['spread'](function(_0xf9e8b){var _0x382886;var _0x48a5cf;_0x599903=_0xf9e8b||[];var _0x429a54=[];if(_0xf9e8b){for(var _0x417741=0x0;_0x417741<_0xf9e8b[_0x7830('0x37')];_0x417741+=0x1){var _0xa11841=_0xf9e8b[_0x417741][_0x7830('0x22')]({'plain':!![]});_0x382886=squel[_0x7830('0x67')]()['into']('cm_hopper_black')[_0x7830('0x7b')]([_0x7830('0x6a'),_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()['field']('phone',_0x7830('0x6a'))[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0xa11841[_0x7830('0x73')][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x16329c['params']['id']['toString'](),_0x7830('0x5b'))[_0x7830('0x6e')]('NOW()',_0x7830('0x54'))[_0x7830('0x6e')](_0x7830('0x7c'),_0x7830('0x55'))[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')](_0x7830('0x71'))[_0x7830('0x3c')]('ListId\x20=\x20?',_0xa11841[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74')))[_0x7830('0x70')]();_0x429a54[_0x7830('0x87')](db[_0x7830('0x88')]['query'](_0x382886));}return BPromise[_0x7830('0x89')](_0x429a54);}})[_0x7830('0x21')](function(){return _0x599903;})[_0x7830('0x21')](respondWithResult(_0x38e751,null))[_0x7830('0x44')](handleError(_0x38e751,null));};exports[_0x7830('0x8e')]=function(_0x31cc6a,_0x4f81cb,_0x4aad4d){return db['Campaign'][_0x7830('0x48')]({'where':{'id':_0x31cc6a[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x4f81cb,null))[_0x7830('0x21')](function(_0x27213d){if(_0x27213d){return _0x27213d['removeBlackLists'](_0x31cc6a[_0x7830('0x31')][_0x7830('0x64')]);}})[_0x7830('0x21')](function(_0x2c5ce6){if(_0x2c5ce6){return db['CmHopperBlack'][_0x7830('0x25')]({'where':{'ListId':_0x31cc6a[_0x7830('0x31')]['ids'],'CampaignId':_0x31cc6a[_0x7830('0x46')]['id']}})[_0x7830('0x21')](function(){return _0x2c5ce6;});}})[_0x7830('0x21')](respondWithStatusCode(_0x4f81cb,null))[_0x7830('0x44')](handleError(_0x4f81cb,null));}; \ No newline at end of file +var _0x0647=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','field','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','insert','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','then','IvrCampaigns','UserProfileResource','error','stack','name','send','index','type','key','map','query','keys','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','clone','rawAttributes','length','find','omit','createdAt','updatedAt','body','role','userProfileId'];(function(_0x392890,_0xb8d3dd){var _0x2b2e30=function(_0x4b355f){while(--_0x4b355f){_0x392890['push'](_0x392890['shift']());}};_0x2b2e30(++_0xb8d3dd);}(_0x0647,0xd0));var _0x7064=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x0647[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0x7064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7064('0x1'));var jsonpatch=require(_0x7064('0x2'));var rp=require(_0x7064('0x3'));var moment=require(_0x7064('0x4'));var BPromise=require(_0x7064('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7064('0x6'));var sox=require(_0x7064('0x7'));var csv=require(_0x7064('0x8'));var ejs=require(_0x7064('0x9'));var fs=require('fs');var fs_extra=require(_0x7064('0xa'));var _=require(_0x7064('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7064('0xc'));var deskjs=require(_0x7064('0xd'));var toCsv=require(_0x7064('0x8'));var querystring=require('querystring');var Papa=require(_0x7064('0xe'));var Redis=require(_0x7064('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7064('0x10'));var as=require(_0x7064('0x11'));var hardwareService=require(_0x7064('0x12'));var logger=require('../../config/logger')(_0x7064('0x13'));var utils=require(_0x7064('0x14'));var config=require(_0x7064('0x15'));var licenseUtil=require(_0x7064('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303dcd,_0x4151b6){_0x4151b6=_0x4151b6||0xcc;return function(_0x268a94){if(_0x268a94){return _0x303dcd[_0x7064('0x17')](_0x4151b6);}return _0x303dcd[_0x7064('0x18')](_0x4151b6)[_0x7064('0x19')]();};}function respondWithResult(_0x265aa6,_0x3badc8){_0x3badc8=_0x3badc8||0xc8;return function(_0x57e440){if(_0x57e440){return _0x265aa6['status'](_0x3badc8)['json'](_0x57e440);}};}function respondWithFilteredResult(_0x39f83b,_0x15a1c0){return function(_0x36378c){if(_0x36378c){var _0x4b39db=typeof _0x15a1c0[_0x7064('0x1a')]===_0x7064('0x1b')&&typeof _0x15a1c0['limit']===_0x7064('0x1b');var _0x38d20c=_0x36378c[_0x7064('0x1c')];var _0x203633=_0x4b39db?0x0:_0x15a1c0[_0x7064('0x1a')];var _0x17f306=_0x4b39db?_0x36378c[_0x7064('0x1c')]:_0x15a1c0[_0x7064('0x1a')]+_0x15a1c0[_0x7064('0x1d')];var _0x19b456;if(_0x17f306>=_0x38d20c){_0x17f306=_0x38d20c;_0x19b456=0xc8;}else{_0x19b456=0xce;}_0x39f83b[_0x7064('0x18')](_0x19b456);return _0x39f83b[_0x7064('0x1e')](_0x7064('0x1f'),_0x203633+'-'+_0x17f306+'/'+_0x38d20c)['json'](_0x36378c);}return null;};}function patchUpdates(_0x431fac){return function(_0x141983){try{jsonpatch[_0x7064('0x20')](_0x141983,_0x431fac,!![]);}catch(_0x2d49a9){return BPromise['reject'](_0x2d49a9);}return _0x141983[_0x7064('0x21')]();};}function saveUpdates(_0x51ae69,_0x446730){return function(_0x6eed9e){if(_0x6eed9e){return _0x6eed9e['update'](_0x51ae69)[_0x7064('0x22')](function(_0x14b006){return _0x14b006;});}return null;};}function removeEntity(_0x1a62a2,_0x464e8a){return function(_0x167149){if(_0x167149){return _0x167149['destroy']()['then'](function(){var _0x33f470=_0x167149['get']({'plain':!![]});var _0x2eec57=_0x7064('0x23');return db[_0x7064('0x24')]['destroy']({'where':{'type':_0x2eec57,'resourceId':_0x33f470['id']}})[_0x7064('0x22')](function(){return _0x167149;});})[_0x7064('0x22')](function(){_0x1a62a2[_0x7064('0x18')](0xcc)[_0x7064('0x19')]();});}};}function handleEntityNotFound(_0x358e67,_0x57039f){return function(_0x561186){if(!_0x561186){_0x358e67['sendStatus'](0x194);}return _0x561186;};}function handleError(_0x5e2a06,_0x2fc640){_0x2fc640=_0x2fc640||0x1f4;return function(_0x4aad53){logger[_0x7064('0x25')](_0x4aad53[_0x7064('0x26')]);if(_0x4aad53['name']){delete _0x4aad53[_0x7064('0x27')];}_0x5e2a06[_0x7064('0x18')](_0x2fc640)[_0x7064('0x28')](_0x4aad53);};}exports[_0x7064('0x29')]=function(_0x19749e,_0x5c1b1d){var _0x41db8a={},_0x230f24={},_0x2a95b2={'count':0x0,'rows':[]};var _0x16f422=_['map'](db['Campaign']['rawAttributes'],function(_0x21192d){return{'name':_0x21192d['fieldName'],'type':_0x21192d[_0x7064('0x2a')][_0x7064('0x2b')]};});_0x230f24['model']=_[_0x7064('0x2c')](_0x16f422,_0x7064('0x27'));_0x230f24[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x19749e['query']);_0x230f24['filters']=_[_0x7064('0x2f')](_0x230f24['model'],_0x230f24[_0x7064('0x2d')]);_0x41db8a[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x230f24['model'],qs[_0x7064('0x31')](_0x19749e[_0x7064('0x2d')][_0x7064('0x31')]));_0x41db8a[_0x7064('0x30')]=_0x41db8a['attributes']['length']?_0x41db8a[_0x7064('0x30')]:_0x230f24[_0x7064('0x32')];if(!_0x19749e['query'][_0x7064('0x33')](_0x7064('0x34'))){_0x41db8a[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x19749e[_0x7064('0x2d')][_0x7064('0x1d')]);_0x41db8a[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x19749e[_0x7064('0x2d')][_0x7064('0x1a')]);}_0x41db8a[_0x7064('0x35')]=qs['sort'](_0x19749e[_0x7064('0x2d')][_0x7064('0x36')]);_0x41db8a[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x19749e['query'],_0x230f24[_0x7064('0x38')]),_0x16f422);if(_0x19749e[_0x7064('0x2d')][_0x7064('0x3a')]){_0x41db8a[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x41db8a[_0x7064('0x37')],{'$or':_['map'](_0x16f422,function(_0x1c301e){if(_0x1c301e[_0x7064('0x2a')]!=='VIRTUAL'){var _0x995bec={};_0x995bec[_0x1c301e[_0x7064('0x27')]]={'$like':'%'+_0x19749e[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x995bec;}})});}_0x41db8a=_[_0x7064('0x3b')]({},_0x41db8a,_0x19749e[_0x7064('0x3c')]);var _0x73d2c0={'where':_0x41db8a[_0x7064('0x37')]};return db[_0x7064('0x3d')][_0x7064('0x1c')](_0x73d2c0)[_0x7064('0x22')](function(_0x329dfa){_0x2a95b2[_0x7064('0x1c')]=_0x329dfa;if(_0x19749e['query'][_0x7064('0x3e')]){_0x41db8a[_0x7064('0x3f')]=[{'all':!![]}];}return db['Campaign'][_0x7064('0x40')](_0x41db8a);})[_0x7064('0x22')](function(_0x10e45f){_0x2a95b2[_0x7064('0x41')]=_0x10e45f;return _0x2a95b2;})[_0x7064('0x22')](respondWithFilteredResult(_0x5c1b1d,_0x41db8a))[_0x7064('0x42')](handleError(_0x5c1b1d,null));};exports['show']=function(_0x5b1cac,_0x24f6b9){var _0x173d43={'raw':![],'where':{'id':_0x5b1cac[_0x7064('0x43')]['id']}},_0x5d4040={};_0x5d4040[_0x7064('0x32')]=_['keys'](db[_0x7064('0x3d')]['rawAttributes']);_0x5d4040['query']=_['keys'](_0x5b1cac[_0x7064('0x2d')]);_0x5d4040[_0x7064('0x38')]=_['intersection'](_0x5d4040[_0x7064('0x32')],_0x5d4040[_0x7064('0x2d')]);_0x173d43['attributes']=_[_0x7064('0x2f')](_0x5d4040[_0x7064('0x32')],qs['fields'](_0x5b1cac[_0x7064('0x2d')][_0x7064('0x31')]));_0x173d43[_0x7064('0x30')]=_0x173d43['attributes']['length']?_0x173d43[_0x7064('0x30')]:_0x5d4040[_0x7064('0x32')];if(_0x5b1cac[_0x7064('0x2d')][_0x7064('0x3e')]){_0x173d43[_0x7064('0x3f')]=[{'all':!![]}];}_0x173d43=_[_0x7064('0x3b')]({},_0x173d43,_0x5b1cac[_0x7064('0x3c')]);return db['Campaign']['find'](_0x173d43)[_0x7064('0x22')](handleEntityNotFound(_0x24f6b9,null))[_0x7064('0x22')](respondWithResult(_0x24f6b9,null))[_0x7064('0x42')](handleError(_0x24f6b9,null));};exports[_0x7064('0x44')]=function(_0x1db6f7,_0x56fda1){return db[_0x7064('0x3d')]['create'](_0x1db6f7['body'],{})['then'](function(_0x4d0829){var _0x58ee99=_0x1db6f7['user']['get']({'plain':!![]});if(!_0x58ee99)throw new Error(_0x7064('0x45'));if(_0x58ee99['role']===_0x7064('0x46')){var _0x249e43=_0x4d0829[_0x7064('0x47')]({'plain':!![]});var _0x43bbdc=_0x7064('0x23');return db[_0x7064('0x48')]['find']({'where':{'name':_0x43bbdc,'userProfileId':_0x58ee99['userProfileId']},'raw':!![]})['then'](function(_0x1a713a){if(_0x1a713a&&_0x1a713a[_0x7064('0x49')]===0x0){return db['UserProfileResource'][_0x7064('0x44')]({'name':_0x249e43[_0x7064('0x27')],'resourceId':_0x249e43['id'],'type':_0x1a713a[_0x7064('0x27')],'sectionId':_0x1a713a['id']},{})[_0x7064('0x22')](function(){return _0x4d0829;});}else{return _0x4d0829;}})[_0x7064('0x42')](function(_0x4f7e16){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7e16);throw _0x4f7e16;});}return _0x4d0829;})[_0x7064('0x22')](respondWithResult(_0x56fda1,0xc9))['catch'](handleError(_0x56fda1,null));};exports[_0x7064('0x4a')]=function(_0x388a59,_0x10c14b){var _0x22a0bd={'where':{'id':_0x388a59['params']['id']}},_0x3c73a6={};_0x3c73a6['model']=_[_0x7064('0x2e')](db['Campaign'][_0x7064('0x4b')]);_0x22a0bd[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x3c73a6[_0x7064('0x32')],qs[_0x7064('0x31')](_0x388a59[_0x7064('0x2d')]['fields']));_0x22a0bd['attributes']=_0x22a0bd[_0x7064('0x30')][_0x7064('0x4c')]?_0x22a0bd[_0x7064('0x30')]:_0x3c73a6[_0x7064('0x32')];if(_0x388a59[_0x7064('0x2d')][_0x7064('0x3e')]){_0x22a0bd[_0x7064('0x3f')]=[{'all':!![]}];}_0x22a0bd=_['merge']({},_0x22a0bd,_0x388a59[_0x7064('0x3c')]);return db['Campaign'][_0x7064('0x4d')](_0x22a0bd)[_0x7064('0x22')](handleEntityNotFound(_0x10c14b,null))['then'](function(_0x3c16a5){if(_0x3c16a5){var _0xc26fc1=_0x3c16a5[_0x7064('0x47')]({'plain':!![]});_0xc26fc1=qs[_0x7064('0x4e')](_0xc26fc1,['id',_0x7064('0x4f'),_0x7064('0x50')]);_0x388a59[_0x7064('0x51')]=_[_0x7064('0x4e')](_0x388a59[_0x7064('0x51')],['id','createdAt',_0x7064('0x50')]);return db[_0x7064('0x3d')][_0x7064('0x44')](_['merge'](_0xc26fc1,_0x388a59['body']),{'include':_0x388a59[_0x7064('0x2d')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3f5275){var _0x4d71f9=_0x388a59[_0x7064('0x46')][_0x7064('0x47')]({'plain':!![]});if(!_0x4d71f9)throw new Error(_0x7064('0x45'));if(_0x4d71f9[_0x7064('0x52')]===_0x7064('0x46')){var _0x4fb294=_0x3f5275['get']({'plain':!![]});var _0x47e7f4='IvrCampaigns';return db['UserProfileSection'][_0x7064('0x4d')]({'where':{'name':_0x47e7f4,'userProfileId':_0x4d71f9[_0x7064('0x53')]},'raw':!![]})[_0x7064('0x22')](function(_0x22b5d1){if(_0x22b5d1&&_0x22b5d1[_0x7064('0x49')]===0x0){return db[_0x7064('0x24')][_0x7064('0x44')]({'name':_0x4fb294[_0x7064('0x27')],'resourceId':_0x4fb294['id'],'type':_0x22b5d1[_0x7064('0x27')],'sectionId':_0x22b5d1['id']},{})['then'](function(){return _0x3f5275;});}else{return _0x3f5275;}})['catch'](function(_0xf9ceda){logger[_0x7064('0x25')](_0x7064('0x54'),_0xf9ceda);throw _0xf9ceda;});}return _0x3f5275;});}})[_0x7064('0x22')](respondWithResult(_0x10c14b,0xc9))['catch'](handleError(_0x10c14b,null));};exports['update']=function(_0xe7fb0e,_0x1457f7){if(_0xe7fb0e[_0x7064('0x51')]['id']){delete _0xe7fb0e[_0x7064('0x51')]['id'];}return db['Campaign'][_0x7064('0x4d')]({'where':{'id':_0xe7fb0e[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x1457f7,null))[_0x7064('0x22')](saveUpdates(_0xe7fb0e[_0x7064('0x51')],null))[_0x7064('0x22')](respondWithResult(_0x1457f7,null))[_0x7064('0x42')](handleError(_0x1457f7,null));};exports[_0x7064('0x55')]=function(_0x5ec835,_0xc71b4a){return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x5ec835[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0xc71b4a,null))[_0x7064('0x22')](removeEntity(_0xc71b4a,null))['catch'](handleError(_0xc71b4a,null));};exports[_0x7064('0x56')]=function(_0xf94d89,_0x17dbdb,_0x37cbc5){var _0x4c08f2={'raw':!![],'where':{}};var _0x158a10={};var _0x4d194a={'count':0x0,'rows':[]};return db[_0x7064('0x3d')]['findOne']({'where':{'id':_0xf94d89[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x17dbdb,null))[_0x7064('0x22')](function(_0x2eb5cd){if(_0x2eb5cd){_0x158a10[_0x7064('0x32')]=_['keys'](db[_0x7064('0x57')][_0x7064('0x4b')]);_0x158a10[_0x7064('0x2d')]=_['keys'](_0xf94d89[_0x7064('0x2d')]);_0x158a10[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x158a10[_0x7064('0x32')],_0x158a10[_0x7064('0x2d')]);_0x4c08f2[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x158a10['model'],qs['fields'](_0xf94d89[_0x7064('0x2d')][_0x7064('0x31')]));_0x4c08f2[_0x7064('0x30')]=_0x4c08f2[_0x7064('0x30')][_0x7064('0x4c')]?_0x4c08f2[_0x7064('0x30')]:_0x158a10[_0x7064('0x32')];if(!_0xf94d89[_0x7064('0x2d')]['hasOwnProperty'](_0x7064('0x34'))){_0x4c08f2['limit']=qs[_0x7064('0x1d')](_0xf94d89[_0x7064('0x2d')][_0x7064('0x1d')]);_0x4c08f2[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0xf94d89[_0x7064('0x2d')]['offset']);}_0x4c08f2[_0x7064('0x35')]=qs[_0x7064('0x36')](_0xf94d89[_0x7064('0x2d')]['sort']);_0x4c08f2[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0xf94d89[_0x7064('0x2d')],_0x158a10[_0x7064('0x38')]));_0x4c08f2[_0x7064('0x37')][_0x7064('0x58')]=_0x2eb5cd['id'];if(_0xf94d89[_0x7064('0x2d')][_0x7064('0x3a')]){_0x4c08f2[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x4c08f2[_0x7064('0x37')],{'$or':_[_0x7064('0x2c')](_0x4c08f2[_0x7064('0x30')],function(_0x596d8f){var _0x53fad1={};_0x53fad1[_0x596d8f]={'$like':'%'+_0xf94d89[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x53fad1;})});}_0x4c08f2=_[_0x7064('0x3b')]({},_0x4c08f2,_0xf94d89[_0x7064('0x3c')]);return db[_0x7064('0x57')][_0x7064('0x1c')]({'where':_0x4c08f2[_0x7064('0x37')]})['then'](function(_0x54e172){_0x4d194a[_0x7064('0x1c')]=_0x54e172;if(_0xf94d89[_0x7064('0x2d')]['includeAll']){_0x4c08f2[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x57')][_0x7064('0x40')](_0x4c08f2);})[_0x7064('0x22')](function(_0x520ac5){_0x4d194a[_0x7064('0x41')]=_0x520ac5;return _0x4d194a;});}})[_0x7064('0x22')](respondWithFilteredResult(_0x17dbdb,_0x4c08f2))[_0x7064('0x42')](handleError(_0x17dbdb,null));};exports[_0x7064('0x59')]=function(_0x3c51b7,_0xe0995a,_0x2a39c2){var _0x343e44={'raw':!![],'where':{}};var _0x5784e4={};var _0x281bcb={'count':0x0,'rows':[]};return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x3c51b7[_0x7064('0x43')]['id']}})['then'](handleEntityNotFound(_0xe0995a,null))['then'](function(_0x1e5e14){if(_0x1e5e14){_0x5784e4['model']=_[_0x7064('0x2e')](db[_0x7064('0x5b')][_0x7064('0x4b')]);_0x5784e4[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x3c51b7[_0x7064('0x2d')]);_0x5784e4[_0x7064('0x38')]=_['intersection'](_0x5784e4[_0x7064('0x32')],_0x5784e4['query']);_0x343e44[_0x7064('0x30')]=_['intersection'](_0x5784e4['model'],qs[_0x7064('0x31')](_0x3c51b7[_0x7064('0x2d')][_0x7064('0x31')]));_0x343e44[_0x7064('0x30')]=_0x343e44[_0x7064('0x30')]['length']?_0x343e44['attributes']:_0x5784e4['model'];if(!_0x3c51b7[_0x7064('0x2d')][_0x7064('0x33')]('nolimit')){_0x343e44[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x3c51b7[_0x7064('0x2d')]['limit']);_0x343e44[_0x7064('0x1a')]=qs['offset'](_0x3c51b7[_0x7064('0x2d')][_0x7064('0x1a')]);}_0x343e44[_0x7064('0x35')]=qs['sort'](_0x3c51b7['query']['sort']);_0x343e44[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x3c51b7[_0x7064('0x2d')],_0x5784e4[_0x7064('0x38')]));_0x343e44[_0x7064('0x37')]['CampaignId']=_0x1e5e14['id'];if(_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3a')]){_0x343e44[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x343e44['where'],{'$or':_[_0x7064('0x2c')](_0x343e44[_0x7064('0x30')],function(_0x8450fc){var _0x4cffb4={};_0x4cffb4[_0x8450fc]={'$like':'%'+_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x4cffb4;})});}_0x343e44=_['merge']({},_0x343e44,_0x3c51b7[_0x7064('0x3c')]);return db['CmHopperHistory'][_0x7064('0x1c')]({'where':_0x343e44[_0x7064('0x37')]})['then'](function(_0x5b0d95){_0x281bcb['count']=_0x5b0d95;if(_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3e')]){_0x343e44[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5b')][_0x7064('0x40')](_0x343e44);})['then'](function(_0x3c2fb4){_0x281bcb[_0x7064('0x41')]=_0x3c2fb4;return _0x281bcb;});}})['then'](respondWithFilteredResult(_0xe0995a,_0x343e44))['catch'](handleError(_0xe0995a,null));};exports['getHopperFinals']=function(_0x3e2524,_0x50a8a4,_0x14440c){var _0x3c66a1={'raw':!![],'where':{}};var _0x510e3={};var _0x18afb6={'count':0x0,'rows':[]};return db['Campaign'][_0x7064('0x5a')]({'where':{'id':_0x3e2524['params']['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x50a8a4,null))[_0x7064('0x22')](function(_0x553210){if(_0x553210){_0x510e3[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x5c')][_0x7064('0x4b')]);_0x510e3[_0x7064('0x2d')]=_['keys'](_0x3e2524['query']);_0x510e3['filters']=_[_0x7064('0x2f')](_0x510e3['model'],_0x510e3[_0x7064('0x2d')]);_0x3c66a1[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x510e3[_0x7064('0x32')],qs['fields'](_0x3e2524[_0x7064('0x2d')][_0x7064('0x31')]));_0x3c66a1[_0x7064('0x30')]=_0x3c66a1[_0x7064('0x30')][_0x7064('0x4c')]?_0x3c66a1[_0x7064('0x30')]:_0x510e3[_0x7064('0x32')];if(!_0x3e2524['query'][_0x7064('0x33')](_0x7064('0x34'))){_0x3c66a1['limit']=qs[_0x7064('0x1d')](_0x3e2524[_0x7064('0x2d')][_0x7064('0x1d')]);_0x3c66a1['offset']=qs[_0x7064('0x1a')](_0x3e2524['query'][_0x7064('0x1a')]);}_0x3c66a1[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x3e2524[_0x7064('0x2d')]['sort']);_0x3c66a1[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x3e2524[_0x7064('0x2d')],_0x510e3[_0x7064('0x38')]));_0x3c66a1[_0x7064('0x37')][_0x7064('0x58')]=_0x553210['id'];if(_0x3e2524['query']['filter']){_0x3c66a1[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x3c66a1[_0x7064('0x37')],{'$or':_['map'](_0x3c66a1[_0x7064('0x30')],function(_0x17fdb1){var _0x4af513={};_0x4af513[_0x17fdb1]={'$like':'%'+_0x3e2524[_0x7064('0x2d')]['filter']+'%'};return _0x4af513;})});}_0x3c66a1=_['merge']({},_0x3c66a1,_0x3e2524[_0x7064('0x3c')]);return db['CmHopperFinal'][_0x7064('0x1c')]({'where':_0x3c66a1[_0x7064('0x37')]})['then'](function(_0x49da1d){_0x18afb6['count']=_0x49da1d;if(_0x3e2524[_0x7064('0x2d')][_0x7064('0x3e')]){_0x3c66a1[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5c')][_0x7064('0x40')](_0x3c66a1);})[_0x7064('0x22')](function(_0x5f9ec9){_0x18afb6[_0x7064('0x41')]=_0x5f9ec9;return _0x18afb6;});}})[_0x7064('0x22')](respondWithFilteredResult(_0x50a8a4,_0x3c66a1))['catch'](handleError(_0x50a8a4,null));};exports[_0x7064('0x5d')]=function(_0x331edd,_0x31df93,_0x3e81dc){var _0x434dae={'raw':!![],'where':{}};var _0x5a561c={};var _0x306ebe={'count':0x0,'rows':[]};return db['Campaign'][_0x7064('0x5a')]({'where':{'id':_0x331edd[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x31df93,null))[_0x7064('0x22')](function(_0x1e3d34){if(_0x1e3d34){_0x5a561c[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x5e')]['rawAttributes']);_0x5a561c[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x331edd[_0x7064('0x2d')]);_0x5a561c[_0x7064('0x38')]=_['intersection'](_0x5a561c[_0x7064('0x32')],_0x5a561c['query']);_0x434dae[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x5a561c[_0x7064('0x32')],qs[_0x7064('0x31')](_0x331edd['query'][_0x7064('0x31')]));_0x434dae[_0x7064('0x30')]=_0x434dae[_0x7064('0x30')][_0x7064('0x4c')]?_0x434dae[_0x7064('0x30')]:_0x5a561c['model'];if(!_0x331edd[_0x7064('0x2d')]['hasOwnProperty'](_0x7064('0x34'))){_0x434dae[_0x7064('0x1d')]=qs['limit'](_0x331edd[_0x7064('0x2d')][_0x7064('0x1d')]);_0x434dae[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x331edd['query'][_0x7064('0x1a')]);}_0x434dae[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x331edd[_0x7064('0x2d')][_0x7064('0x36')]);_0x434dae[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x331edd[_0x7064('0x2d')],_0x5a561c[_0x7064('0x38')]));_0x434dae['where'][_0x7064('0x58')]=_0x1e3d34['id'];if(_0x331edd[_0x7064('0x2d')][_0x7064('0x3a')]){_0x434dae['where']=_[_0x7064('0x3b')](_0x434dae[_0x7064('0x37')],{'$or':_['map'](_0x434dae[_0x7064('0x30')],function(_0x26e373){var _0xa140d6={};_0xa140d6[_0x26e373]={'$like':'%'+_0x331edd['query'][_0x7064('0x3a')]+'%'};return _0xa140d6;})});}_0x434dae=_[_0x7064('0x3b')]({},_0x434dae,_0x331edd[_0x7064('0x3c')]);return db[_0x7064('0x5e')][_0x7064('0x1c')]({'where':_0x434dae['where']})[_0x7064('0x22')](function(_0x589c92){_0x306ebe[_0x7064('0x1c')]=_0x589c92;if(_0x331edd[_0x7064('0x2d')]['includeAll']){_0x434dae[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5e')]['findAll'](_0x434dae);})[_0x7064('0x22')](function(_0x5a6d9e){_0x306ebe['rows']=_0x5a6d9e;return _0x306ebe;});}})['then'](respondWithFilteredResult(_0x31df93,_0x434dae))['catch'](handleError(_0x31df93,null));};exports[_0x7064('0x5f')]=function(_0x24cc3c,_0x5e5d29,_0x4d47cb){var _0x5c61a0={};var _0x8d755e={};var _0x710297;var _0x50ebfe;return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x24cc3c[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x5e5d29,null))[_0x7064('0x22')](function(_0x771372){if(_0x771372){_0x710297=_0x771372;_0x8d755e[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x60')][_0x7064('0x4b')]);_0x8d755e['query']=_[_0x7064('0x2e')](_0x24cc3c[_0x7064('0x2d')]);_0x8d755e[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x8d755e[_0x7064('0x32')],_0x8d755e[_0x7064('0x2d')]);_0x5c61a0[_0x7064('0x30')]=_['intersection'](_0x8d755e[_0x7064('0x32')],qs[_0x7064('0x31')](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x31')]));_0x5c61a0['attributes']=_0x5c61a0[_0x7064('0x30')]['length']?_0x5c61a0['attributes']:_0x8d755e[_0x7064('0x32')];_0x5c61a0[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x36')]);_0x5c61a0[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x24cc3c['query'],_0x8d755e['filters']));if(_0x24cc3c[_0x7064('0x2d')]['filter']){_0x5c61a0[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x5c61a0[_0x7064('0x37')],{'$or':_[_0x7064('0x2c')](_0x5c61a0[_0x7064('0x30')],function(_0x34e187){var _0x211d94={};_0x211d94[_0x34e187]={'$like':'%'+_0x24cc3c[_0x7064('0x2d')]['filter']+'%'};return _0x211d94;})});}_0x5c61a0=_[_0x7064('0x3b')]({},_0x5c61a0,_0x24cc3c['options']);return _0x710297[_0x7064('0x5f')](_0x5c61a0);}})[_0x7064('0x22')](function(_0x4ef45b){if(_0x4ef45b){_0x50ebfe=_0x4ef45b['length'];if(!_0x24cc3c[_0x7064('0x2d')][_0x7064('0x33')]('nolimit')){_0x5c61a0[_0x7064('0x1d')]=qs['limit'](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x1d')]);_0x5c61a0[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x24cc3c[_0x7064('0x2d')]['offset']);}return _0x710297['getLists'](_0x5c61a0);}})[_0x7064('0x22')](function(_0xe1d574){if(_0xe1d574){return _0xe1d574?{'count':_0x50ebfe,'rows':_0xe1d574}:null;}})[_0x7064('0x22')](respondWithResult(_0x5e5d29,null))[_0x7064('0x42')](handleError(_0x5e5d29,null));};exports[_0x7064('0x61')]=function(_0x8c906d,_0x3b00d2,_0x3b7629){var _0x2aa6dc,_0x14c746;var _0x2355de=[];var _0x1b8159=moment()['format'](_0x7064('0x62'));return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x8c906d[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x3b00d2,null))[_0x7064('0x22')](function(_0x109b58){if(_0x109b58){_0x14c746=_0x109b58;return _0x109b58[_0x7064('0x61')](_0x8c906d['body'][_0x7064('0x63')],_[_0x7064('0x4e')](_0x8c906d['body'],[_0x7064('0x63'),'id'])||{});}return null;})[_0x7064('0x64')](function(_0x155196){var _0x1cc3dc;var _0x5d774b;_0x2aa6dc=_0x155196||[];var _0x187826=[];if(_0x155196){for(var _0x41bde3=0x0;_0x41bde3<_0x155196['length'];_0x41bde3+=0x1){var _0xa3d60e=_0x155196[_0x41bde3][_0x7064('0x47')]({'plain':!![]});_0x14c746[_0x7064('0x65')]=_0x8c906d[_0x7064('0x51')][_0x7064('0x65')]?_0x8c906d[_0x7064('0x51')][_0x7064('0x65')]:_0x14c746[_0x7064('0x65')];switch(_0x14c746[_0x7064('0x65')]){case _0x7064('0x66'):_0x1cc3dc=squel['insert']()['into'](_0x7064('0x67'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6a'),_0x7064('0x6b'),_0x7064('0x6c'),_0x7064('0x58'),'createdAt','updatedAt'],squel['select']()['field'](_0x7064('0x69'),'phone')['field'](_0x7064('0x6d'),_0x7064('0x6a'))['field']('id','ContactId')[_0x7064('0x6e')](_0xa3d60e['CmListId'][_0x7064('0x6f')](),'ListId')[_0x7064('0x6e')](_0x8c906d[_0x7064('0x43')]['id']['toString'](),'CampaignId')[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')]('cm_contacts')[_0x7064('0x37')](_0x7064('0x71'))[_0x7064('0x37')](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x76'))[_0x7064('0x70')]('cm_hopper_final')['where'](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]()))[_0x7064('0x37')](_0x7064('0x78'),squel[_0x7064('0x75')]()[_0x7064('0x6e')]('COALESCE(phone,\x27\x27)')[_0x7064('0x70')](_0x7064('0x67'))[_0x7064('0x37')](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]())))[_0x7064('0x6f')]();break;case _0x7064('0x79'):_0x1cc3dc=squel['insert']()['into'](_0x7064('0x67'))['fromQuery']([_0x7064('0x69'),_0x7064('0x6a'),_0x7064('0x6b'),_0x7064('0x6c'),_0x7064('0x58'),_0x7064('0x4f'),'updatedAt'],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),_0x7064('0x69'))['field']('NOW()',_0x7064('0x6a'))[_0x7064('0x6e')]('id',_0x7064('0x6b'))['field'](_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')](),'ListId')[_0x7064('0x6e')](_0x8c906d['params']['id'][_0x7064('0x6f')](),_0x7064('0x58'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))['field']('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')](_0x7064('0x7a'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74'))['where'](_0x7064('0x78'),squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x7b'))[_0x7064('0x70')](_0x7064('0x67'))[_0x7064('0x37')](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]())))['toString']();break;default:_0x1cc3dc=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x67'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6a'),'ContactId','ListId',_0x7064('0x58'),_0x7064('0x4f'),_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),_0x7064('0x69'))[_0x7064('0x6e')]('NOW()','scheduledAt')['field']('id',_0x7064('0x6b'))['field'](_0xa3d60e[_0x7064('0x73')]['toString'](),_0x7064('0x6c'))['field'](_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')](),_0x7064('0x58'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')](_0x7064('0x7a'))[_0x7064('0x37')](_0x7064('0x71'))['where'](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74')))[_0x7064('0x6f')]();}_0x5d774b=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x7e'))[_0x7064('0x68')]([_0x7064('0x7f'),_0x7064('0x6a'),_0x7064('0x69'),_0x7064('0x80'),_0x7064('0x4f'),_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x81'),'id')[_0x7064('0x6e')]('NOW()',_0x7064('0x6a'))[_0x7064('0x6e')]('ci.item',_0x7064('0x69'))[_0x7064('0x6e')](_0x7064('0x82'),_0x7064('0x80'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))['from'](_0x7064('0x83'),'ci')[_0x7064('0x84')](_0x7064('0x67'),'h',_0x7064('0x85'))[_0x7064('0x37')](_0x7064('0x86'),_0xa3d60e['CmListId'][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x87'),_0x8c906d[_0x7064('0x43')]['id']['toString']())[_0x7064('0x37')](_0x7064('0x88'),_0x1b8159))[_0x7064('0x6f')]();_0x187826[_0x7064('0x89')](db[_0x7064('0x8a')][_0x7064('0x2d')](_0x1cc3dc));_0x2355de[_0x7064('0x89')](db[_0x7064('0x8a')][_0x7064('0x2d')](_0x5d774b));}return BPromise[_0x7064('0x8b')](_0x187826);}})[_0x7064('0x22')](function(){return BPromise[_0x7064('0x8b')](_0x2355de);})['then'](function(){return _0x2aa6dc;})[_0x7064('0x22')](respondWithResult(_0x3b00d2,null))['catch'](handleError(_0x3b00d2,null));};exports[_0x7064('0x8c')]=function(_0x1d14de,_0x300bba,_0x3fc398){return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x1d14de[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x300bba,null))['then'](function(_0x5f4db2){if(_0x5f4db2){return _0x5f4db2[_0x7064('0x8c')](_0x1d14de[_0x7064('0x2d')][_0x7064('0x63')]);}})[_0x7064('0x22')](function(_0x5d080f){if(_0x5d080f){return db[_0x7064('0x57')]['destroy']({'where':{'ListId':_0x1d14de['query'][_0x7064('0x63')],'CampaignId':_0x1d14de['params']['id']}})[_0x7064('0x22')](function(){return _0x5d080f;});}})[_0x7064('0x22')](respondWithStatusCode(_0x300bba,null))[_0x7064('0x42')](handleError(_0x300bba,null));};exports['getBlackLists']=function(_0x204954,_0x4c82d2,_0x46d142){var _0x2663b6={};var _0x5608ea={};var _0x3c5c30;var _0x2a7226;return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x204954[_0x7064('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c82d2,null))['then'](function(_0x540fae){if(_0x540fae){_0x3c5c30=_0x540fae;_0x5608ea[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x60')][_0x7064('0x4b')]);_0x5608ea[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x204954[_0x7064('0x2d')]);_0x5608ea[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x5608ea[_0x7064('0x32')],_0x5608ea[_0x7064('0x2d')]);_0x2663b6[_0x7064('0x30')]=_['intersection'](_0x5608ea[_0x7064('0x32')],qs[_0x7064('0x31')](_0x204954[_0x7064('0x2d')]['fields']));_0x2663b6[_0x7064('0x30')]=_0x2663b6[_0x7064('0x30')][_0x7064('0x4c')]?_0x2663b6[_0x7064('0x30')]:_0x5608ea[_0x7064('0x32')];_0x2663b6['order']=qs['sort'](_0x204954[_0x7064('0x2d')][_0x7064('0x36')]);_0x2663b6[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x204954[_0x7064('0x2d')],_0x5608ea['filters']));if(_0x204954[_0x7064('0x2d')][_0x7064('0x3a')]){_0x2663b6['where']=_[_0x7064('0x3b')](_0x2663b6[_0x7064('0x37')],{'$or':_['map'](_0x2663b6[_0x7064('0x30')],function(_0x5b2206){var _0x502520={};_0x502520[_0x5b2206]={'$like':'%'+_0x204954[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x502520;})});}_0x2663b6=_[_0x7064('0x3b')]({},_0x2663b6,_0x204954[_0x7064('0x3c')]);return _0x3c5c30[_0x7064('0x8d')](_0x2663b6);}})['then'](function(_0x47fb5c){if(_0x47fb5c){_0x2a7226=_0x47fb5c[_0x7064('0x4c')];if(!_0x204954[_0x7064('0x2d')][_0x7064('0x33')](_0x7064('0x34'))){_0x2663b6[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x204954['query'][_0x7064('0x1d')]);_0x2663b6[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x204954['query'][_0x7064('0x1a')]);}return _0x3c5c30[_0x7064('0x8d')](_0x2663b6);}})[_0x7064('0x22')](function(_0x5d8c1b){if(_0x5d8c1b){return _0x5d8c1b?{'count':_0x2a7226,'rows':_0x5d8c1b}:null;}})[_0x7064('0x22')](respondWithResult(_0x4c82d2,null))[_0x7064('0x42')](handleError(_0x4c82d2,null));};exports[_0x7064('0x8e')]=function(_0x5662e9,_0x5e0899,_0x51ee08){var _0x4e52b8,_0x4d91e0;var _0x26c475=[];var _0x11bd8e=moment()[_0x7064('0x8f')](_0x7064('0x62'));return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x5662e9[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x5e0899,null))[_0x7064('0x22')](function(_0x3a693a){if(_0x3a693a){_0x4d91e0=_0x3a693a;return _0x3a693a[_0x7064('0x8e')](_0x5662e9[_0x7064('0x51')][_0x7064('0x63')],_[_0x7064('0x4e')](_0x5662e9[_0x7064('0x51')],['ids','id'])||{});}return null;})[_0x7064('0x64')](function(_0x196ef9){var _0xb89e04;var _0x904c1b;_0x4e52b8=_0x196ef9||[];var _0x5ac7b0=[];if(_0x196ef9){for(var _0x41ee85=0x0;_0x41ee85<_0x196ef9[_0x7064('0x4c')];_0x41ee85+=0x1){var _0x49be4b=_0x196ef9[_0x41ee85]['get']({'plain':!![]});_0xb89e04=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x90'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6b'),'ListId',_0x7064('0x58'),'createdAt',_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),'phone')[_0x7064('0x6e')]('id',_0x7064('0x6b'))[_0x7064('0x6e')](_0x49be4b['CmListId'][_0x7064('0x6f')](),'ListId')['field'](_0x5662e9[_0x7064('0x43')]['id'][_0x7064('0x6f')](),'CampaignId')[_0x7064('0x6e')](_0x7064('0x6d'),_0x7064('0x4f'))[_0x7064('0x6e')](_0x7064('0x6d'),_0x7064('0x50'))[_0x7064('0x70')]('cm_contacts')[_0x7064('0x37')]('deletedAt\x20IS\x20NULL')[_0x7064('0x37')](_0x7064('0x72'),_0x49be4b[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74')))['toString']();_0x5ac7b0[_0x7064('0x89')](db['sequelize']['query'](_0xb89e04));}return BPromise['all'](_0x5ac7b0);}})['then'](function(){return _0x4e52b8;})[_0x7064('0x22')](respondWithResult(_0x5e0899,null))[_0x7064('0x42')](handleError(_0x5e0899,null));};exports[_0x7064('0x91')]=function(_0x205f3f,_0x1bd14f,_0x3b6a67){return db[_0x7064('0x3d')]['find']({'where':{'id':_0x205f3f[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x1bd14f,null))['then'](function(_0x544db7){if(_0x544db7){return _0x544db7[_0x7064('0x91')](_0x205f3f[_0x7064('0x2d')]['ids']);}})[_0x7064('0x22')](function(_0x80c877){if(_0x80c877){return db[_0x7064('0x5e')][_0x7064('0x55')]({'where':{'ListId':_0x205f3f[_0x7064('0x2d')][_0x7064('0x63')],'CampaignId':_0x205f3f[_0x7064('0x43')]['id']}})[_0x7064('0x22')](function(){return _0x80c877;});}})[_0x7064('0x22')](respondWithStatusCode(_0x1bd14f,null))[_0x7064('0x42')](handleError(_0x1bd14f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b8f080b..113c0dd 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x13c312,_0xb56507){var _0x1c31fe=function(_0x4fa80b){while(--_0x4fa80b){_0x13c312['push'](_0x13c312['shift']());}};_0x1c31fe(++_0xb56507);}(_0x7a54,0x106));var _0x47a5=function(_0x1445dd,_0x5843bd){_0x1445dd=_0x1445dd-0x0;var _0x5818c5=_0x7a54[_0x1445dd];return _0x5818c5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 9a66789..e87b1cf 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 _0x70e0=['findAll','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign'];(function(_0x760968,_0x2c607c){var _0x1c707b=function(_0x4cfd81){while(--_0x4cfd81){_0x760968['push'](_0x760968['shift']());}};_0x1c707b(++_0x2c607c);}(_0x70e0,0x17b));var _0x070e=function(_0x4a8e60,_0x59d8ec){_0x4a8e60=_0x4a8e60-0x0;var _0x5902f9=_0x70e0[_0x4a8e60];return _0x5902f9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Campaign,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Campaign,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}exports[_0x070e('0x16')]=function(_0x38f6e6){var _0x2060cc=this;return new Promise(function(_0x364b3f,_0x5037eb){return db[_0x070e('0x17')][_0x070e('0x18')]({'raw':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1a')]===undefined?!![]:![]:!![],'where':_0x38f6e6['options']?_0x38f6e6['options']['where']||null:null,'attributes':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1b')]||null:null,'limit':_0x38f6e6['options']?_0x38f6e6[_0x070e('0x19')]['limit']||null:null,'include':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')]?_[_0x070e('0x1d')](_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')],function(_0xe405e){return{'model':db[_0xe405e[_0x070e('0x1e')]],'as':_0xe405e['as'],'attributes':_0xe405e['attributes'],'include':_0xe405e[_0x070e('0x1c')]?_[_0x070e('0x1d')](_0xe405e[_0x070e('0x1c')],function(_0x503f4d){return{'model':db[_0x503f4d[_0x070e('0x1e')]],'as':_0x503f4d['as'],'attributes':_0x503f4d['attributes'],'include':_0x503f4d['include']?_[_0x070e('0x1d')](_0x503f4d[_0x070e('0x1c')],function(_0x41deb1){return{'model':db[_0x41deb1[_0x070e('0x1e')]],'as':_0x41deb1['as'],'attributes':_0x41deb1[_0x070e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x374c54){logger[_0x070e('0xb')](_0x070e('0x16'),_0x38f6e6);logger[_0x070e('0xc')](_0x070e('0x16'),_0x38f6e6,JSON[_0x070e('0xf')](_0x374c54));_0x364b3f(_0x374c54);})[_0x070e('0x15')](function(_0x26373b){logger['error'](_0x070e('0x16'),_0x26373b[_0x070e('0x13')],_0x38f6e6);_0x5037eb(_0x2060cc[_0x070e('0x10')](0x1f4,_0x26373b['message']));});});}; \ No newline at end of file +var _0x8b7c=['debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x3e235d,_0x4ec78a){var _0x3bfa12=function(_0x7f9c34){while(--_0x7f9c34){_0x3e235d['push'](_0x3e235d['shift']());}};_0x3bfa12(++_0x4ec78a);}(_0x8b7c,0x119));var _0xc8b7=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0x8b7c[_0x5b87ce];return _0x597aa7;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var moment=require(_0xc8b7('0x2'));var BPromise=require(_0xc8b7('0x3'));var rs=require(_0xc8b7('0x4'));var fs=require('fs');var Redis=require(_0xc8b7('0x5'));var db=require(_0xc8b7('0x6'))['db'];var utils=require(_0xc8b7('0x7'));var logger=require('../../config/logger')(_0xc8b7('0x8'));var config=require(_0xc8b7('0x9'));var jayson=require(_0xc8b7('0xa'));var client=jayson['client'][_0xc8b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x90cb38,_0x42d65e,_0x2c7807){return new BPromise(function(_0x9e4763,_0x2f149d){return client['request'](_0x90cb38,_0x2c7807)[_0xc8b7('0xc')](function(_0x504550){logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,_0xc8b7('0xf'));logger[_0xc8b7('0x10')](_0xc8b7('0x11'),_0x42d65e,'request\x20sent',JSON['stringify'](_0x504550));if(_0x504550['error']){if(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x13')]===0x1f4){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error']['message']);return _0x2f149d(_0x504550['error'][_0xc8b7('0x14')]);}logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error'][_0xc8b7('0x14')]);return _0x9e4763(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x14')]);}else{logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,'request\x20sent');_0x9e4763(_0x504550[_0xc8b7('0x15')][_0xc8b7('0x14')]);}})[_0xc8b7('0x16')](function(_0x3323de){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x3323de);_0x2f149d(_0x3323de);});});}exports[_0xc8b7('0x17')]=function(_0x485415){var _0x5ae36a=this;return new Promise(function(_0x1cf47c,_0x403659){return db[_0xc8b7('0x18')]['findAll']({'raw':_0x485415['options']?_0x485415[_0xc8b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1a')]||null:null,'attributes':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1b')]||null:null,'limit':_0x485415['options']?_0x485415[_0xc8b7('0x19')][_0xc8b7('0x1c')]||null:null,'include':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x485415[_0xc8b7('0x19')]['include'],function(_0x3b0e47){return{'model':db[_0x3b0e47[_0xc8b7('0x1f')]],'as':_0x3b0e47['as'],'attributes':_0x3b0e47[_0xc8b7('0x1b')],'include':_0x3b0e47[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x3b0e47[_0xc8b7('0x1d')],function(_0x2acda2){return{'model':db[_0x2acda2[_0xc8b7('0x1f')]],'as':_0x2acda2['as'],'attributes':_0x2acda2[_0xc8b7('0x1b')],'include':_0x2acda2[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x2acda2['include'],function(_0x28e65d){return{'model':db[_0x28e65d[_0xc8b7('0x1f')]],'as':_0x28e65d['as'],'attributes':_0x28e65d[_0xc8b7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8b7('0xc')](function(_0x2046f5){logger[_0xc8b7('0xd')]('GetCampaign',_0x485415);logger['debug'](_0xc8b7('0x17'),_0x485415,JSON[_0xc8b7('0x20')](_0x2046f5));_0x1cf47c(_0x2046f5);})[_0xc8b7('0x16')](function(_0x2a2b25){logger[_0xc8b7('0x12')](_0xc8b7('0x17'),_0x2a2b25[_0xc8b7('0x14')],_0x485415);_0x403659(_0x5ae36a['error'](0x1f4,_0x2a2b25[_0xc8b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b19d9f2..d93cc9b 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 _0xff94=['addLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x3e16c0,_0x4fcb17){var _0x2abad6=function(_0x50c82d){while(--_0x50c82d){_0x3e16c0['push'](_0x3e16c0['shift']());}};_0x2abad6(++_0x4fcb17);}(_0xff94,0x130));var _0x4ff9=function(_0xf1e5da,_0x3ecd47){_0xf1e5da=_0xf1e5da-0x0;var _0x331120=_0xff94[_0xf1e5da];return _0x331120;};'use strict';var multer=require(_0x4ff9('0x0'));var util=require(_0x4ff9('0x1'));var path=require(_0x4ff9('0x2'));var timeout=require(_0x4ff9('0x3'));var express=require(_0x4ff9('0x4'));var router=express[_0x4ff9('0x5')]();var fs_extra=require(_0x4ff9('0x6'));var auth=require(_0x4ff9('0x7'));var interaction=require(_0x4ff9('0x8'));var config=require(_0x4ff9('0x9'));var controller=require(_0x4ff9('0xa'));router[_0x4ff9('0xb')]('/',auth[_0x4ff9('0xc')](),controller['index']);router[_0x4ff9('0xb')](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller['show']);router[_0x4ff9('0xb')](_0x4ff9('0xe'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0xf')]);router[_0x4ff9('0xb')]('/:id/hopper_histories',auth[_0x4ff9('0xc')](),controller['getHopperHistories']);router[_0x4ff9('0xb')]('/:id/hopper_finals',auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x10')]);router[_0x4ff9('0xb')](_0x4ff9('0x11'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x12')]);router['get'](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x14')]);router[_0x4ff9('0xb')](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x16')]);router[_0x4ff9('0x17')]('/',auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x18')]);router['post'](_0x4ff9('0x19'),auth[_0x4ff9('0xc')](),controller['clone']);router[_0x4ff9('0x17')](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1a')]);router['post'](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller['addBlackLists']);router[_0x4ff9('0x1b')](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1c')]);router['delete'](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1d')]);router[_0x4ff9('0x1e')](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller['removeLists']);router[_0x4ff9('0x1e')](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1f')]);module[_0x4ff9('0x20')]=router; \ No newline at end of file +var _0x303a=['/:id/hoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x30f78d,_0x41a626){var _0x70a7dd=function(_0x563da5){while(--_0x563da5){_0x30f78d['push'](_0x30f78d['shift']());}};_0x70a7dd(++_0x41a626);}(_0x303a,0x1a0));var _0xa303=function(_0x5e2a0f,_0x447ab4){_0x5e2a0f=_0x5e2a0f-0x0;var _0x3e8c10=_0x303a[_0x5e2a0f];return _0x3e8c10;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['getHoppers']);router[_0xa303('0x9')]('/:id/hopper_histories',auth[_0xa303('0xa')](),controller['getHopperHistories']);router[_0xa303('0x9')](_0xa303('0xe'),auth[_0xa303('0xa')](),controller[_0xa303('0xf')]);router['get'](_0xa303('0x10'),auth['isAuthenticated'](),controller[_0xa303('0x11')]);router[_0xa303('0x9')](_0xa303('0x12'),auth['isAuthenticated'](),controller[_0xa303('0x13')]);router[_0xa303('0x9')](_0xa303('0x14'),auth[_0xa303('0xa')](),controller[_0xa303('0x15')]);router[_0xa303('0x16')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0x17')]);router['post'](_0xa303('0x18'),auth[_0xa303('0xa')](),controller[_0xa303('0x19')]);router[_0xa303('0x16')](_0xa303('0x12'),auth[_0xa303('0xa')](),controller['addLists']);router[_0xa303('0x16')]('/:id/blacklists',auth[_0xa303('0xa')](),controller['addBlackLists']);router[_0xa303('0x1a')]('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0x1b')]);router[_0xa303('0x1c')]('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0x1d')]);router[_0xa303('0x1c')]('/:id/lists',auth[_0xa303('0xa')](),controller[_0xa303('0x1e')]);router[_0xa303('0x1c')](_0xa303('0x14'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);module[_0xa303('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ddeac35..9fc812b 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 _0x6f06=['sequelize','STRING'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0x6f06,0x1b2));var _0x66f0=function(_0x7342e,_0x1c3fe7){_0x7342e=_0x7342e-0x0;var _0x524ece=_0x6f06[_0x7342e];return _0x524ece;};'use strict';var Sequelize=require(_0x66f0('0x0'));module['exports']={'key':{'type':Sequelize[_0x66f0('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x66f0('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x185a=['STRING','TEXT','medium','getDataValue','sequelize','exports'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0x185a,0x1ae));var _0xa185=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x185a[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xa185('0x0'));module[_0xa185('0x1')]={'key':{'type':Sequelize[_0xa185('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xa185('0x3')],'length':_0xa185('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa185('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa185('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 849e275..775a24e 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 _0x69f7=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','get','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error'];(function(_0x5272e0,_0x169ce5){var _0xa4fc96=function(_0x4f359a){while(--_0x4f359a){_0x5272e0['push'](_0x5272e0['shift']());}};_0xa4fc96(++_0x169ce5);}(_0x69f7,0x10b));var _0x769f=function(_0x2b5520,_0x2d77b4){_0x2b5520=_0x2b5520-0x0;var _0x5873db=_0x69f7[_0x2b5520];return _0x5873db;};'use strict';var emlformat=require(_0x769f('0x0'));var rimraf=require(_0x769f('0x1'));var zipdir=require(_0x769f('0x2'));var jsonpatch=require(_0x769f('0x3'));var rp=require('request-promise');var moment=require(_0x769f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x769f('0x5'));var util=require(_0x769f('0x6'));var path=require(_0x769f('0x7'));var sox=require(_0x769f('0x8'));var csv=require('to-csv');var ejs=require(_0x769f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x769f('0xa'));var crypto=require(_0x769f('0xb'));var jsforce=require(_0x769f('0xc'));var deskjs=require(_0x769f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x769f('0xe'));var Papa=require(_0x769f('0xf'));var Redis=require(_0x769f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x769f('0x11'));var as=require(_0x769f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x769f('0x13'))(_0x769f('0x14'));var utils=require(_0x769f('0x15'));var config=require(_0x769f('0x16'));var licenseUtil=require(_0x769f('0x17'));var db=require(_0x769f('0x18'))['db'];function respondWithStatusCode(_0x31e7b8,_0x41c336){_0x41c336=_0x41c336||0xcc;return function(_0x4145cd){if(_0x4145cd){return _0x31e7b8[_0x769f('0x19')](_0x41c336);}return _0x31e7b8['status'](_0x41c336)[_0x769f('0x1a')]();};}function respondWithResult(_0x4a4f09,_0x5e4857){_0x5e4857=_0x5e4857||0xc8;return function(_0x12aa50){if(_0x12aa50){return _0x4a4f09[_0x769f('0x1b')](_0x5e4857)['json'](_0x12aa50);}};}function respondWithFilteredResult(_0x3d3279,_0x26ea7c){return function(_0x40074c){if(_0x40074c){var _0x45ba69=typeof _0x26ea7c['offset']===_0x769f('0x1c')&&typeof _0x26ea7c[_0x769f('0x1d')]==='undefined';var _0x2fc324=_0x40074c[_0x769f('0x1e')];var _0x49dacb=_0x45ba69?0x0:_0x26ea7c['offset'];var _0x47d7fd=_0x45ba69?_0x40074c[_0x769f('0x1e')]:_0x26ea7c[_0x769f('0x1f')]+_0x26ea7c[_0x769f('0x1d')];var _0x4a1b81;if(_0x47d7fd>=_0x2fc324){_0x47d7fd=_0x2fc324;_0x4a1b81=0xc8;}else{_0x4a1b81=0xce;}_0x3d3279['status'](_0x4a1b81);return _0x3d3279[_0x769f('0x20')](_0x769f('0x21'),_0x49dacb+'-'+_0x47d7fd+'/'+_0x2fc324)['json'](_0x40074c);}return null;};}function patchUpdates(_0x47e6a6){return function(_0x9ebcdd){try{jsonpatch[_0x769f('0x22')](_0x9ebcdd,_0x47e6a6,!![]);}catch(_0x74a59f){return BPromise['reject'](_0x74a59f);}return _0x9ebcdd['save']();};}function saveUpdates(_0x372dc7,_0x1d30eb){return function(_0x5f2197){if(_0x5f2197){return _0x5f2197[_0x769f('0x23')](_0x372dc7)['then'](function(_0x2bae5e){return _0x2bae5e;});}return null;};}function removeEntity(_0x427d26,_0x37592a){return function(_0x47774e){if(_0x47774e){return _0x47774e[_0x769f('0x24')]()[_0x769f('0x25')](function(){var _0x35a90d=_0x47774e[_0x769f('0x26')]({'plain':!![]});var _0x323f6c=_0x769f('0x27');return db[_0x769f('0x28')][_0x769f('0x24')]({'where':{'type':_0x323f6c,'resourceId':_0x35a90d['id']}})[_0x769f('0x25')](function(){return _0x47774e;});})[_0x769f('0x25')](function(){_0x427d26[_0x769f('0x1b')](0xcc)[_0x769f('0x1a')]();});}};}function handleEntityNotFound(_0x5c7b46,_0x3f056){return function(_0x33bb7c){if(!_0x33bb7c){_0x5c7b46[_0x769f('0x19')](0x194);}return _0x33bb7c;};}function handleError(_0x1610fa,_0x36ee61){_0x36ee61=_0x36ee61||0x1f4;return function(_0x35040a){logger['error'](_0x35040a[_0x769f('0x29')]);if(_0x35040a[_0x769f('0x2a')]){delete _0x35040a[_0x769f('0x2a')];}_0x1610fa[_0x769f('0x1b')](_0x36ee61)[_0x769f('0x2b')](_0x35040a);};}exports[_0x769f('0x2c')]=function(_0x5107d3,_0x5d831c){var _0x46fded={},_0x10dbaa={},_0x5c677b={'count':0x0,'rows':[]};var _0x3c1384=_[_0x769f('0x2d')](db[_0x769f('0x2e')][_0x769f('0x2f')],function(_0x35d7fb){return{'name':_0x35d7fb['fieldName'],'type':_0x35d7fb[_0x769f('0x30')][_0x769f('0x31')]};});_0x10dbaa['model']=_[_0x769f('0x2d')](_0x3c1384,_0x769f('0x2a'));_0x10dbaa['query']=_[_0x769f('0x32')](_0x5107d3[_0x769f('0x33')]);_0x10dbaa['filters']=_['intersection'](_0x10dbaa[_0x769f('0x34')],_0x10dbaa[_0x769f('0x33')]);_0x46fded[_0x769f('0x35')]=_[_0x769f('0x36')](_0x10dbaa[_0x769f('0x34')],qs[_0x769f('0x37')](_0x5107d3['query']['fields']));_0x46fded[_0x769f('0x35')]=_0x46fded['attributes'][_0x769f('0x38')]?_0x46fded[_0x769f('0x35')]:_0x10dbaa[_0x769f('0x34')];if(!_0x5107d3['query'][_0x769f('0x39')]('nolimit')){_0x46fded[_0x769f('0x1d')]=qs['limit'](_0x5107d3[_0x769f('0x33')][_0x769f('0x1d')]);_0x46fded['offset']=qs[_0x769f('0x1f')](_0x5107d3[_0x769f('0x33')][_0x769f('0x1f')]);}_0x46fded[_0x769f('0x3a')]=qs['sort'](_0x5107d3[_0x769f('0x33')][_0x769f('0x3b')]);_0x46fded[_0x769f('0x3c')]=qs[_0x769f('0x3d')](_['pick'](_0x5107d3[_0x769f('0x33')],_0x10dbaa[_0x769f('0x3d')]),_0x3c1384);if(_0x5107d3[_0x769f('0x33')][_0x769f('0x3e')]){_0x46fded[_0x769f('0x3c')]=_[_0x769f('0x3f')](_0x46fded['where'],{'$or':[{'key':{'$like':'%'+_0x5107d3[_0x769f('0x33')][_0x769f('0x3e')]+'%'}},{'value':{'$like':'%'+_0x5107d3[_0x769f('0x33')]['filter']+'%'}}]});}_0x46fded=_[_0x769f('0x3f')]({},_0x46fded,_0x5107d3['options']);var _0x5f6251={'where':_0x46fded[_0x769f('0x3c')]};return db[_0x769f('0x2e')]['count'](_0x5f6251)[_0x769f('0x25')](function(_0x3792ec){_0x5c677b[_0x769f('0x1e')]=_0x3792ec;if(_0x5107d3[_0x769f('0x33')][_0x769f('0x40')]){_0x46fded[_0x769f('0x41')]=[{'all':!![]}];}return db[_0x769f('0x2e')][_0x769f('0x42')](_0x46fded);})['then'](function(_0x4f8a5b){_0x5c677b[_0x769f('0x43')]=_0x4f8a5b;return _0x5c677b;})[_0x769f('0x25')](respondWithFilteredResult(_0x5d831c,_0x46fded))[_0x769f('0x44')](handleError(_0x5d831c,null));};exports[_0x769f('0x45')]=function(_0x593712,_0x5a7822){var _0x43af02={'raw':!![],'where':{'id':_0x593712[_0x769f('0x46')]['id']}},_0x57d17e={};_0x57d17e[_0x769f('0x34')]=_['keys'](db[_0x769f('0x2e')][_0x769f('0x2f')]);_0x57d17e['query']=_[_0x769f('0x32')](_0x593712['query']);_0x57d17e[_0x769f('0x3d')]=_[_0x769f('0x36')](_0x57d17e[_0x769f('0x34')],_0x57d17e[_0x769f('0x33')]);_0x43af02[_0x769f('0x35')]=_[_0x769f('0x36')](_0x57d17e[_0x769f('0x34')],qs[_0x769f('0x37')](_0x593712[_0x769f('0x33')][_0x769f('0x37')]));_0x43af02['attributes']=_0x43af02['attributes']['length']?_0x43af02[_0x769f('0x35')]:_0x57d17e[_0x769f('0x34')];if(_0x593712[_0x769f('0x33')][_0x769f('0x40')]){_0x43af02[_0x769f('0x41')]=[{'all':!![]}];}_0x43af02=_[_0x769f('0x3f')]({},_0x43af02,_0x593712[_0x769f('0x47')]);return db[_0x769f('0x2e')][_0x769f('0x48')](_0x43af02)[_0x769f('0x25')](handleEntityNotFound(_0x5a7822,null))['then'](respondWithResult(_0x5a7822,null))['catch'](handleError(_0x5a7822,null));};exports[_0x769f('0x23')]=function(_0x5e35f9,_0x4b3fe6){if(_0x5e35f9[_0x769f('0x49')]['id']){delete _0x5e35f9[_0x769f('0x49')]['id'];}return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':{'id':_0x5e35f9[_0x769f('0x46')]['id']}})[_0x769f('0x25')](handleEntityNotFound(_0x4b3fe6,null))[_0x769f('0x25')](saveUpdates(_0x5e35f9[_0x769f('0x49')],null))[_0x769f('0x25')](respondWithResult(_0x4b3fe6,null))[_0x769f('0x44')](handleError(_0x4b3fe6,null));};exports[_0x769f('0x24')]=function(_0x171240,_0xf411f0){return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':{'id':_0x171240[_0x769f('0x46')]['id']}})[_0x769f('0x25')](handleEntityNotFound(_0xf411f0,null))[_0x769f('0x25')](removeEntity(_0xf411f0,null))[_0x769f('0x44')](handleError(_0xf411f0,null));};exports[_0x769f('0x4a')]=function(_0x36cb80,_0xf80bba){var _0x53ab9a={'key':_0x36cb80[_0x769f('0x49')][_0x769f('0x31')]};if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4b')]){_0x53ab9a['MailAccountId']=_0x36cb80[_0x769f('0x49')][_0x769f('0x4b')];}else if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4c')]){_0x53ab9a[_0x769f('0x4c')]=_0x36cb80[_0x769f('0x49')][_0x769f('0x4c')];}else if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4d')]){_0x53ab9a['OpenchannelAccountId']=_0x36cb80[_0x769f('0x49')]['OpenchannelAccountId'];}else if(_0x36cb80[_0x769f('0x49')]['ChatWebsiteId']){_0x53ab9a[_0x769f('0x4e')]=_0x36cb80[_0x769f('0x49')]['ChatWebsiteId'];}return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':_0x53ab9a})[_0x769f('0x25')](function(_0x377176){if(_0x377176){throw new db[(_0x769f('0x4f'))][(_0x769f('0x50'))](_0x769f('0x51'));}return db[_0x769f('0x2e')][_0x769f('0x4a')](_0x36cb80[_0x769f('0x49')]);})[_0x769f('0x25')](function(_0x1b1023){var _0x476a96=_0x36cb80['user'][_0x769f('0x26')]({'plain':!![]});if(!_0x476a96)throw new Error(_0x769f('0x52'));if(_0x476a96[_0x769f('0x53')]===_0x769f('0x54')){var _0x5f2487=_0x1b1023['get']({'plain':!![]});return db[_0x769f('0x55')][_0x769f('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x476a96[_0x769f('0x56')]},'raw':!![]})[_0x769f('0x25')](function(_0x6c3807){if(_0x6c3807&&_0x6c3807[_0x769f('0x57')]===0x0){return db[_0x769f('0x28')][_0x769f('0x4a')]({'name':_0x5f2487[_0x769f('0x2a')],'resourceId':_0x5f2487['id'],'type':_0x6c3807['name'],'sectionId':_0x6c3807['id']},{})[_0x769f('0x25')](function(){return _0x1b1023;});}else{return _0x1b1023;}})[_0x769f('0x44')](function(_0x36455c){logger[_0x769f('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36455c);throw _0x36455c;});}return _0x1b1023;})['then'](respondWithResult(_0xf80bba,0xc9))[_0x769f('0x44')](handleError(_0xf80bba,null));}; \ No newline at end of file +var _0x1444=['merge','options','includeAll','rows','show','params','include','body','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','error','name','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x1fcca4,_0x4e1a61){var _0x3568a4=function(_0x187191){while(--_0x187191){_0x1fcca4['push'](_0x1fcca4['shift']());}};_0x3568a4(++_0x4e1a61);}(_0x1444,0x123));var _0x4144=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x1444[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0x4144('0x0'));var rimraf=require(_0x4144('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4144('0x2'));var rp=require(_0x4144('0x3'));var moment=require(_0x4144('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4144('0x5'));var util=require(_0x4144('0x6'));var path=require(_0x4144('0x7'));var sox=require(_0x4144('0x8'));var csv=require(_0x4144('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4144('0xa'));var _=require(_0x4144('0xb'));var squel=require(_0x4144('0xc'));var crypto=require(_0x4144('0xd'));var jsforce=require(_0x4144('0xe'));var deskjs=require(_0x4144('0xf'));var toCsv=require(_0x4144('0x9'));var querystring=require(_0x4144('0x10'));var Papa=require('papaparse');var Redis=require(_0x4144('0x11'));var authService=require(_0x4144('0x12'));var qs=require(_0x4144('0x13'));var as=require(_0x4144('0x14'));var hardwareService=require(_0x4144('0x15'));var logger=require(_0x4144('0x16'))(_0x4144('0x17'));var utils=require('../../config/utils');var config=require(_0x4144('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4144('0x19'))['db'];function respondWithStatusCode(_0x1637cc,_0x424853){_0x424853=_0x424853||0xcc;return function(_0x26f558){if(_0x26f558){return _0x1637cc[_0x4144('0x1a')](_0x424853);}return _0x1637cc['status'](_0x424853)[_0x4144('0x1b')]();};}function respondWithResult(_0x500b98,_0x506f71){_0x506f71=_0x506f71||0xc8;return function(_0x11927d){if(_0x11927d){return _0x500b98[_0x4144('0x1c')](_0x506f71)[_0x4144('0x1d')](_0x11927d);}};}function respondWithFilteredResult(_0x54aad2,_0x47f568){return function(_0x119ddf){if(_0x119ddf){var _0x1486a3=typeof _0x47f568[_0x4144('0x1e')]===_0x4144('0x1f')&&typeof _0x47f568['limit']===_0x4144('0x1f');var _0x4fbb9e=_0x119ddf[_0x4144('0x20')];var _0x289b9d=_0x1486a3?0x0:_0x47f568['offset'];var _0x11a9e7=_0x1486a3?_0x119ddf[_0x4144('0x20')]:_0x47f568[_0x4144('0x1e')]+_0x47f568[_0x4144('0x21')];var _0x4e3cc4;if(_0x11a9e7>=_0x4fbb9e){_0x11a9e7=_0x4fbb9e;_0x4e3cc4=0xc8;}else{_0x4e3cc4=0xce;}_0x54aad2[_0x4144('0x1c')](_0x4e3cc4);return _0x54aad2[_0x4144('0x22')]('Content-Range',_0x289b9d+'-'+_0x11a9e7+'/'+_0x4fbb9e)[_0x4144('0x1d')](_0x119ddf);}return null;};}function patchUpdates(_0x4222f1){return function(_0x16e83f){try{jsonpatch[_0x4144('0x23')](_0x16e83f,_0x4222f1,!![]);}catch(_0x1b9f18){return BPromise[_0x4144('0x24')](_0x1b9f18);}return _0x16e83f[_0x4144('0x25')]();};}function saveUpdates(_0x1170ea,_0x22ee17){return function(_0x4b3efc){if(_0x4b3efc){return _0x4b3efc[_0x4144('0x26')](_0x1170ea)[_0x4144('0x27')](function(_0x383af2){return _0x383af2;});}return null;};}function removeEntity(_0x22a89e,_0x38dffb){return function(_0x575a8f){if(_0x575a8f){return _0x575a8f[_0x4144('0x28')]()[_0x4144('0x27')](function(){var _0x53ef19=_0x575a8f['get']({'plain':!![]});var _0x3f13c7=_0x4144('0x29');return db[_0x4144('0x2a')]['destroy']({'where':{'type':_0x3f13c7,'resourceId':_0x53ef19['id']}})[_0x4144('0x27')](function(){return _0x575a8f;});})['then'](function(){_0x22a89e[_0x4144('0x1c')](0xcc)[_0x4144('0x1b')]();});}};}function handleEntityNotFound(_0x58773a,_0x49e142){return function(_0x1162fb){if(!_0x1162fb){_0x58773a[_0x4144('0x1a')](0x194);}return _0x1162fb;};}function handleError(_0x3a40e4,_0xdfe3e4){_0xdfe3e4=_0xdfe3e4||0x1f4;return function(_0x2c63e6){logger[_0x4144('0x2b')](_0x2c63e6['stack']);if(_0x2c63e6['name']){delete _0x2c63e6[_0x4144('0x2c')];}_0x3a40e4['status'](_0xdfe3e4)['send'](_0x2c63e6);};}exports['index']=function(_0x3dda7f,_0x5b14cf){var _0x4a480c={},_0x18a9f3={},_0x4d15f9={'count':0x0,'rows':[]};var _0x534c99=_[_0x4144('0x2d')](db[_0x4144('0x2e')][_0x4144('0x2f')],function(_0x5331ab){return{'name':_0x5331ab[_0x4144('0x30')],'type':_0x5331ab[_0x4144('0x31')][_0x4144('0x32')]};});_0x18a9f3['model']=_['map'](_0x534c99,_0x4144('0x2c'));_0x18a9f3[_0x4144('0x33')]=_[_0x4144('0x34')](_0x3dda7f[_0x4144('0x33')]);_0x18a9f3['filters']=_[_0x4144('0x35')](_0x18a9f3[_0x4144('0x36')],_0x18a9f3[_0x4144('0x33')]);_0x4a480c[_0x4144('0x37')]=_[_0x4144('0x35')](_0x18a9f3[_0x4144('0x36')],qs[_0x4144('0x38')](_0x3dda7f[_0x4144('0x33')]['fields']));_0x4a480c[_0x4144('0x37')]=_0x4a480c[_0x4144('0x37')][_0x4144('0x39')]?_0x4a480c['attributes']:_0x18a9f3[_0x4144('0x36')];if(!_0x3dda7f['query'][_0x4144('0x3a')](_0x4144('0x3b'))){_0x4a480c[_0x4144('0x21')]=qs[_0x4144('0x21')](_0x3dda7f[_0x4144('0x33')][_0x4144('0x21')]);_0x4a480c[_0x4144('0x1e')]=qs[_0x4144('0x1e')](_0x3dda7f[_0x4144('0x33')][_0x4144('0x1e')]);}_0x4a480c[_0x4144('0x3c')]=qs[_0x4144('0x3d')](_0x3dda7f['query']['sort']);_0x4a480c[_0x4144('0x3e')]=qs[_0x4144('0x3f')](_['pick'](_0x3dda7f[_0x4144('0x33')],_0x18a9f3[_0x4144('0x3f')]),_0x534c99);if(_0x3dda7f['query']['filter']){_0x4a480c[_0x4144('0x3e')]=_['merge'](_0x4a480c[_0x4144('0x3e')],{'$or':[{'key':{'$like':'%'+_0x3dda7f['query'][_0x4144('0x40')]+'%'}},{'value':{'$like':'%'+_0x3dda7f['query'][_0x4144('0x40')]+'%'}}]});}_0x4a480c=_[_0x4144('0x41')]({},_0x4a480c,_0x3dda7f[_0x4144('0x42')]);var _0x4103c3={'where':_0x4a480c[_0x4144('0x3e')]};return db[_0x4144('0x2e')][_0x4144('0x20')](_0x4103c3)[_0x4144('0x27')](function(_0x2156e9){_0x4d15f9[_0x4144('0x20')]=_0x2156e9;if(_0x3dda7f[_0x4144('0x33')][_0x4144('0x43')]){_0x4a480c['include']=[{'all':!![]}];}return db[_0x4144('0x2e')]['findAll'](_0x4a480c);})[_0x4144('0x27')](function(_0x4b9d05){_0x4d15f9[_0x4144('0x44')]=_0x4b9d05;return _0x4d15f9;})[_0x4144('0x27')](respondWithFilteredResult(_0x5b14cf,_0x4a480c))['catch'](handleError(_0x5b14cf,null));};exports[_0x4144('0x45')]=function(_0x35d89c,_0x586ff6){var _0x20226d={'raw':!![],'where':{'id':_0x35d89c[_0x4144('0x46')]['id']}},_0x245d5b={};_0x245d5b[_0x4144('0x36')]=_[_0x4144('0x34')](db[_0x4144('0x2e')][_0x4144('0x2f')]);_0x245d5b[_0x4144('0x33')]=_[_0x4144('0x34')](_0x35d89c['query']);_0x245d5b[_0x4144('0x3f')]=_[_0x4144('0x35')](_0x245d5b[_0x4144('0x36')],_0x245d5b[_0x4144('0x33')]);_0x20226d['attributes']=_[_0x4144('0x35')](_0x245d5b[_0x4144('0x36')],qs['fields'](_0x35d89c[_0x4144('0x33')][_0x4144('0x38')]));_0x20226d[_0x4144('0x37')]=_0x20226d['attributes']['length']?_0x20226d['attributes']:_0x245d5b[_0x4144('0x36')];if(_0x35d89c['query'][_0x4144('0x43')]){_0x20226d[_0x4144('0x47')]=[{'all':!![]}];}_0x20226d=_['merge']({},_0x20226d,_0x35d89c[_0x4144('0x42')]);return db['CannedAnswer']['find'](_0x20226d)[_0x4144('0x27')](handleEntityNotFound(_0x586ff6,null))[_0x4144('0x27')](respondWithResult(_0x586ff6,null))['catch'](handleError(_0x586ff6,null));};exports['update']=function(_0x17ed3d,_0x1eddbc){if(_0x17ed3d['body']['id']){delete _0x17ed3d[_0x4144('0x48')]['id'];}return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':{'id':_0x17ed3d[_0x4144('0x46')]['id']}})[_0x4144('0x27')](handleEntityNotFound(_0x1eddbc,null))[_0x4144('0x27')](saveUpdates(_0x17ed3d[_0x4144('0x48')],null))[_0x4144('0x27')](respondWithResult(_0x1eddbc,null))[_0x4144('0x4a')](handleError(_0x1eddbc,null));};exports[_0x4144('0x28')]=function(_0xadd6d,_0x36040e){return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':{'id':_0xadd6d['params']['id']}})['then'](handleEntityNotFound(_0x36040e,null))[_0x4144('0x27')](removeEntity(_0x36040e,null))[_0x4144('0x4a')](handleError(_0x36040e,null));};exports[_0x4144('0x4b')]=function(_0x2e0eb5,_0x394b40){var _0x9d5ee9={'key':_0x2e0eb5['body'][_0x4144('0x32')]};if(_0x2e0eb5['body']['MailAccountId']){_0x9d5ee9[_0x4144('0x4c')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4c')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4d')]){_0x9d5ee9[_0x4144('0x4d')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4d')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4e')]){_0x9d5ee9['OpenchannelAccountId']=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4e')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4f')]){_0x9d5ee9[_0x4144('0x4f')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4f')];}return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':_0x9d5ee9})[_0x4144('0x27')](function(_0x2f58f3){if(_0x2f58f3){throw new db['Sequelize']['ValidationError'](_0x4144('0x50'));}return db[_0x4144('0x2e')][_0x4144('0x4b')](_0x2e0eb5['body']);})['then'](function(_0x1ad4bb){var _0x15fb25=_0x2e0eb5['user']['get']({'plain':!![]});if(!_0x15fb25)throw new Error(_0x4144('0x51'));if(_0x15fb25[_0x4144('0x52')]===_0x4144('0x53')){var _0x1a1c7f=_0x1ad4bb[_0x4144('0x54')]({'plain':!![]});return db[_0x4144('0x55')][_0x4144('0x49')]({'where':{'name':_0x4144('0x29'),'userProfileId':_0x15fb25[_0x4144('0x56')]},'raw':!![]})[_0x4144('0x27')](function(_0xbe6dc9){if(_0xbe6dc9&&_0xbe6dc9[_0x4144('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a1c7f[_0x4144('0x2c')],'resourceId':_0x1a1c7f['id'],'type':_0xbe6dc9[_0x4144('0x2c')],'sectionId':_0xbe6dc9['id']},{})[_0x4144('0x27')](function(){return _0x1ad4bb;});}else{return _0x1ad4bb;}})[_0x4144('0x4a')](function(_0x2a10a0){logger[_0x4144('0x2b')](_0x4144('0x58'),_0x2a10a0);throw _0x2a10a0;});}return _0x1ad4bb;})['then'](respondWithResult(_0x394b40,0xc9))[_0x4144('0x4a')](handleError(_0x394b40,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d6e4200..8736492 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 _0x5e32=['CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','exports','define'];(function(_0x3a0228,_0x2725a6){var _0x5dc524=function(_0xc656fb){while(--_0xc656fb){_0x3a0228['push'](_0x3a0228['shift']());}};_0x5dc524(++_0x2725a6);}(_0x5e32,0x17f));var _0x25e3=function(_0xc0e2c4,_0xa4c81e){_0xc0e2c4=_0xc0e2c4-0x0;var _0x3e378c=_0x5e32[_0xc0e2c4];return _0x3e378c;};'use strict';var _=require(_0x25e3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x25e3('0x1'));var BPromise=require('bluebird');var rp=require(_0x25e3('0x2'));var fs=require('fs');var path=require(_0x25e3('0x3'));var rimraf=require(_0x25e3('0x4'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x25e3('0x5')]=function(_0x874d86,_0x4bc3e0){return _0x874d86[_0x25e3('0x6')](_0x25e3('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25e3('0x8'),'collate':_0x25e3('0x9')});}; \ No newline at end of file +var _0x2b80=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer'];(function(_0x38f6a6,_0x1ffef2){var _0x210267=function(_0x40122e){while(--_0x40122e){_0x38f6a6['push'](_0x38f6a6['shift']());}};_0x210267(++_0x1ffef2);}(_0x2b80,0x139));var _0x02b8=function(_0x3abc9f,_0x49440e){_0x3abc9f=_0x3abc9f-0x0;var _0x486bc4=_0x2b80[_0x3abc9f];return _0x486bc4;};'use strict';var _=require('lodash');var util=require(_0x02b8('0x0'));var logger=require(_0x02b8('0x1'))(_0x02b8('0x2'));var moment=require(_0x02b8('0x3'));var BPromise=require(_0x02b8('0x4'));var rp=require(_0x02b8('0x5'));var fs=require('fs');var path=require(_0x02b8('0x6'));var rimraf=require(_0x02b8('0x7'));var config=require(_0x02b8('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x02b8('0x9')]=function(_0x363531,_0x3949b8){return _0x363531['define'](_0x02b8('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x02b8('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 834b904..3270bc6 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ca0fe,_0x15679a){var _0x55fd76=function(_0x4ffb61){while(--_0x4ffb61){_0x4ca0fe['push'](_0x4ca0fe['shift']());}};_0x55fd76(++_0x15679a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x597b07,_0x3586d4){var _0x515abd=function(_0x313916){while(--_0x313916){_0x597b07['push'](_0x597b07['shift']());}};_0x515abd(++_0x3586d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c2451b6..e3c7148 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 _0x392b=['./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x392b,0xdc));var _0xb392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x392b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xb392('0x0'));var util=require('util');var path=require(_0xb392('0x1'));var timeout=require(_0xb392('0x2'));var express=require(_0xb392('0x3'));var router=express[_0xb392('0x4')]();var fs_extra=require(_0xb392('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb392('0x6'));var config=require(_0xb392('0x7'));var controller=require(_0xb392('0x8'));router[_0xb392('0x9')]('/',auth[_0xb392('0xa')](),controller['index']);router['get'](_0xb392('0xb'),auth['isAuthenticated'](),controller[_0xb392('0xc')]);router[_0xb392('0xd')]('/',auth[_0xb392('0xa')](),controller[_0xb392('0xe')]);router['put'](_0xb392('0xb'),auth[_0xb392('0xa')](),controller[_0xb392('0xf')]);router[_0xb392('0x10')](_0xb392('0xb'),auth[_0xb392('0xa')](),controller[_0xb392('0x11')]);module[_0xb392('0x12')]=router; \ No newline at end of file +var _0xb51b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','express'];(function(_0x2a71d2,_0x35bcda){var _0x200112=function(_0x40735f){while(--_0x40735f){_0x2a71d2['push'](_0x2a71d2['shift']());}};_0x200112(++_0x35bcda);}(_0xb51b,0x1be));var _0xbb51=function(_0x452856,_0x4b73e2){_0x452856=_0x452856-0x0;var _0x340ecc=_0xb51b[_0x452856];return _0x340ecc;};'use strict';var multer=require(_0xbb51('0x0'));var util=require(_0xbb51('0x1'));var path=require(_0xbb51('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb51('0x3'));var router=express[_0xbb51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb51('0x5'));var interaction=require(_0xbb51('0x6'));var config=require(_0xbb51('0x7'));var controller=require('./cannedAnswer.controller');router[_0xbb51('0x8')]('/',auth[_0xbb51('0x9')](),controller[_0xbb51('0xa')]);router[_0xbb51('0x8')](_0xbb51('0xb'),auth[_0xbb51('0x9')](),controller[_0xbb51('0xc')]);router[_0xbb51('0xd')]('/',auth[_0xbb51('0x9')](),controller[_0xbb51('0xe')]);router['put'](_0xbb51('0xb'),auth[_0xbb51('0x9')](),controller[_0xbb51('0xf')]);router[_0xbb51('0x10')](_0xbb51('0xb'),auth['isAuthenticated'](),controller[_0xbb51('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 84993b1..8fbc656 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 _0xde71=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xde71,0x1c1));var _0x1de7=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0xde71[_0x2ef8c1];return _0x288305;};'use strict';var Sequelize=require(_0x1de7('0x0'));module[_0x1de7('0x1')]={'calldate':{'type':Sequelize[_0x1de7('0x2')],'allowNull':![],'defaultValue':_0x1de7('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1de7('0x4')]},'dst':{'type':Sequelize[_0x1de7('0x4')]},'dcontext':{'type':Sequelize[_0x1de7('0x4')]},'channel':{'type':Sequelize[_0x1de7('0x4')]},'dstchannel':{'type':Sequelize[_0x1de7('0x4')]},'lastapp':{'type':Sequelize[_0x1de7('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1de7('0x4')]},'amaflags':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1de7('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x1de7('0x4')]},'sequence':{'type':Sequelize[_0x1de7('0x4')]},'peeraccount':{'type':Sequelize[_0x1de7('0x4')]},'type':{'type':Sequelize[_0x1de7('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecf8=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xecf8,0xd4));var _0x8ecf=function(_0xe7f95,_0x3699cf){_0xe7f95=_0xe7f95-0x0;var _0x245a31=_0xecf8[_0xe7f95];return _0x245a31;};'use strict';var Sequelize=require(_0x8ecf('0x0'));module[_0x8ecf('0x1')]={'calldate':{'type':Sequelize[_0x8ecf('0x2')],'allowNull':![],'defaultValue':_0x8ecf('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x8ecf('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x8ecf('0x4')]},'channel':{'type':Sequelize[_0x8ecf('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x8ecf('0x4')]},'lastdata':{'type':Sequelize[_0x8ecf('0x4')]},'duration':{'type':Sequelize[_0x8ecf('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8ecf('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8ecf('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8ecf('0x4')]},'userfield':{'type':Sequelize[_0x8ecf('0x4')]},'uniqueid':{'type':Sequelize[_0x8ecf('0x4')]},'linkedid':{'type':Sequelize[_0x8ecf('0x4')]},'sequence':{'type':Sequelize[_0x8ecf('0x4')]},'peeraccount':{'type':Sequelize[_0x8ecf('0x4')]},'type':{'type':Sequelize[_0x8ecf('0x4')]},'tag':{'type':Sequelize[_0x8ecf('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1a6838f..101a090 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 _0x0bde=['findAll','rows','create','body','catch','update','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0bd('0x1'));var rp=require(_0xe0bd('0x2'));var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe0bd('0xd'));var deskjs=require(_0xe0bd('0xe'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0xf'));var Papa=require(_0xe0bd('0x10'));var Redis=require(_0xe0bd('0x11'));var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0bd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0bd('0x15'));var db=require(_0xe0bd('0x16'))['db'];function respondWithStatusCode(_0x54d40e,_0xc492b4){_0xc492b4=_0xc492b4||0xcc;return function(_0x5272ca){if(_0x5272ca){return _0x54d40e[_0xe0bd('0x17')](_0xc492b4);}return _0x54d40e[_0xe0bd('0x18')](_0xc492b4)[_0xe0bd('0x19')]();};}function respondWithResult(_0x20ab47,_0x47664e){_0x47664e=_0x47664e||0xc8;return function(_0x335f17){if(_0x335f17){return _0x20ab47[_0xe0bd('0x18')](_0x47664e)[_0xe0bd('0x1a')](_0x335f17);}};}function respondWithFilteredResult(_0x4f63fa,_0x50891d){return function(_0x4fb006){if(_0x4fb006){var _0x2ff887=typeof _0x50891d[_0xe0bd('0x1b')]===_0xe0bd('0x1c')&&typeof _0x50891d[_0xe0bd('0x1d')]===_0xe0bd('0x1c');var _0x55f304=_0x4fb006['count'];var _0x1becc8=_0x2ff887?0x0:_0x50891d['offset'];var _0x4f36f7=_0x2ff887?_0x4fb006[_0xe0bd('0x1e')]:_0x50891d[_0xe0bd('0x1b')]+_0x50891d[_0xe0bd('0x1d')];var _0x5f22e2;if(_0x4f36f7>=_0x55f304){_0x4f36f7=_0x55f304;_0x5f22e2=0xc8;}else{_0x5f22e2=0xce;}_0x4f63fa[_0xe0bd('0x18')](_0x5f22e2);return _0x4f63fa[_0xe0bd('0x1f')](_0xe0bd('0x20'),_0x1becc8+'-'+_0x4f36f7+'/'+_0x55f304)['json'](_0x4fb006);}return null;};}function patchUpdates(_0x1bf742){return function(_0x25f595){try{jsonpatch[_0xe0bd('0x21')](_0x25f595,_0x1bf742,!![]);}catch(_0x532584){return BPromise[_0xe0bd('0x22')](_0x532584);}return _0x25f595[_0xe0bd('0x23')]();};}function saveUpdates(_0x2b4f7d,_0x5378d2){return function(_0x1d6a19){if(_0x1d6a19){return _0x1d6a19['update'](_0x2b4f7d)[_0xe0bd('0x24')](function(_0x2bcfcc){return _0x2bcfcc;});}return null;};}function removeEntity(_0x4bcd48,_0xa4a4e9){return function(_0xf6d956){if(_0xf6d956){return _0xf6d956[_0xe0bd('0x25')]()[_0xe0bd('0x24')](function(){_0x4bcd48[_0xe0bd('0x18')](0xcc)[_0xe0bd('0x19')]();});}};}function handleEntityNotFound(_0x2096a2,_0x162356){return function(_0x537708){if(!_0x537708){_0x2096a2['sendStatus'](0x194);}return _0x537708;};}function handleError(_0x275f14,_0x39c98e){_0x39c98e=_0x39c98e||0x1f4;return function(_0x47d171){logger['error'](_0x47d171[_0xe0bd('0x26')]);if(_0x47d171[_0xe0bd('0x27')]){delete _0x47d171[_0xe0bd('0x27')];}_0x275f14[_0xe0bd('0x18')](_0x39c98e)['send'](_0x47d171);};}exports[_0xe0bd('0x28')]=function(_0x4ef39b,_0x9146fe){var _0x170874={},_0x42bea7={},_0x1b857c={'count':0x0,'rows':[]};var _0x1e2020=_[_0xe0bd('0x29')](db[_0xe0bd('0x2a')][_0xe0bd('0x2b')],function(_0x25d515){return{'name':_0x25d515[_0xe0bd('0x2c')],'type':_0x25d515[_0xe0bd('0x2d')][_0xe0bd('0x2e')]};});_0x42bea7[_0xe0bd('0x2f')]=_['map'](_0x1e2020,_0xe0bd('0x27'));_0x42bea7[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x4ef39b[_0xe0bd('0x30')]);_0x42bea7[_0xe0bd('0x32')]=_[_0xe0bd('0x33')](_0x42bea7['model'],_0x42bea7['query']);_0x170874[_0xe0bd('0x34')]=_[_0xe0bd('0x33')](_0x42bea7[_0xe0bd('0x2f')],qs[_0xe0bd('0x35')](_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x35')]));_0x170874[_0xe0bd('0x34')]=_0x170874['attributes'][_0xe0bd('0x36')]?_0x170874[_0xe0bd('0x34')]:_0x42bea7[_0xe0bd('0x2f')];if(!_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x37')](_0xe0bd('0x38'))){_0x170874['limit']=qs[_0xe0bd('0x1d')](_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x1d')]);_0x170874[_0xe0bd('0x1b')]=qs[_0xe0bd('0x1b')](_0x4ef39b['query']['offset']);}_0x170874[_0xe0bd('0x39')]=qs[_0xe0bd('0x3a')](_0x4ef39b[_0xe0bd('0x30')]['sort']);_0x170874[_0xe0bd('0x3b')]=qs['filters'](_['pick'](_0x4ef39b[_0xe0bd('0x30')],_0x42bea7[_0xe0bd('0x32')]),_0x1e2020);if(_0x4ef39b['query']['filter']){_0x170874['where']=_[_0xe0bd('0x3c')](_0x170874[_0xe0bd('0x3b')],{'$or':_[_0xe0bd('0x29')](_0x1e2020,function(_0x5d2aff){if(_0x5d2aff[_0xe0bd('0x2d')]!==_0xe0bd('0x3d')){var _0x1e6823={};_0x1e6823[_0x5d2aff['name']]={'$like':'%'+_0x4ef39b['query'][_0xe0bd('0x3e')]+'%'};return _0x1e6823;}})});}_0x170874=_['merge']({},_0x170874,_0x4ef39b[_0xe0bd('0x3f')]);var _0x195f0f={'where':_0x170874['where']};return db[_0xe0bd('0x2a')][_0xe0bd('0x1e')](_0x195f0f)[_0xe0bd('0x24')](function(_0xb65059){_0x1b857c[_0xe0bd('0x1e')]=_0xb65059;if(_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x40')]){_0x170874['include']=[{'all':!![]}];}return db[_0xe0bd('0x2a')][_0xe0bd('0x41')](_0x170874);})[_0xe0bd('0x24')](function(_0x3c138e){_0x1b857c[_0xe0bd('0x42')]=_0x3c138e;return _0x1b857c;})['then'](respondWithFilteredResult(_0x9146fe,_0x170874))['catch'](handleError(_0x9146fe,null));};exports['show']=function(_0x2b27b1,_0x1a121f){var _0x15de49={'raw':!![],'where':{'id':_0x2b27b1['params']['id']}},_0x32ed4f={};_0x32ed4f['model']=_[_0xe0bd('0x31')](db[_0xe0bd('0x2a')][_0xe0bd('0x2b')]);_0x32ed4f[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x2b27b1[_0xe0bd('0x30')]);_0x32ed4f[_0xe0bd('0x32')]=_['intersection'](_0x32ed4f[_0xe0bd('0x2f')],_0x32ed4f['query']);_0x15de49[_0xe0bd('0x34')]=_[_0xe0bd('0x33')](_0x32ed4f['model'],qs['fields'](_0x2b27b1[_0xe0bd('0x30')][_0xe0bd('0x35')]));_0x15de49[_0xe0bd('0x34')]=_0x15de49[_0xe0bd('0x34')][_0xe0bd('0x36')]?_0x15de49[_0xe0bd('0x34')]:_0x32ed4f[_0xe0bd('0x2f')];if(_0x2b27b1[_0xe0bd('0x30')][_0xe0bd('0x40')]){_0x15de49['include']=[{'all':!![]}];}_0x15de49=_[_0xe0bd('0x3c')]({},_0x15de49,_0x2b27b1[_0xe0bd('0x3f')]);return db[_0xe0bd('0x2a')]['find'](_0x15de49)[_0xe0bd('0x24')](handleEntityNotFound(_0x1a121f,null))[_0xe0bd('0x24')](respondWithResult(_0x1a121f,null))['catch'](handleError(_0x1a121f,null));};exports[_0xe0bd('0x43')]=function(_0x136ac6,_0x578792){return db[_0xe0bd('0x2a')][_0xe0bd('0x43')](_0x136ac6[_0xe0bd('0x44')],{})['then'](respondWithResult(_0x578792,0xc9))[_0xe0bd('0x45')](handleError(_0x578792,null));};exports[_0xe0bd('0x46')]=function(_0x147438,_0x21ae20){if(_0x147438[_0xe0bd('0x44')]['id']){delete _0x147438[_0xe0bd('0x44')]['id'];}return db[_0xe0bd('0x2a')][_0xe0bd('0x47')]({'where':{'id':_0x147438[_0xe0bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x21ae20,null))['then'](saveUpdates(_0x147438['body'],null))[_0xe0bd('0x24')](respondWithResult(_0x21ae20,null))[_0xe0bd('0x45')](handleError(_0x21ae20,null));};exports['destroy']=function(_0xacd120,_0x284ea3){return db[_0xe0bd('0x2a')][_0xe0bd('0x47')]({'where':{'id':_0xacd120[_0xe0bd('0x48')]['id']}})[_0xe0bd('0x24')](handleEntityNotFound(_0x284ea3,null))[_0xe0bd('0x24')](removeEntity(_0x284ea3,null))[_0xe0bd('0x45')](handleError(_0x284ea3,null));};exports[_0xe0bd('0x49')]=function(_0x2631f5,_0x503939){return db[_0xe0bd('0x2a')][_0xe0bd('0x49')]()[_0xe0bd('0x24')](respondWithResult(_0x503939,null))['catch'](handleError(_0x503939,null));}; \ No newline at end of file +var _0x60c2=['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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','Cdr','findAll','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2cf9f9,_0x52b995){var _0x44e2b3=function(_0x5d76ae){while(--_0x5d76ae){_0x2cf9f9['push'](_0x2cf9f9['shift']());}};_0x44e2b3(++_0x52b995);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xa'));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=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['index']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={},_0x233a61={},_0x5993fd={'count':0x0,'rows':[]};var _0xc6868a=_[_0x260c('0x2f')](db['Cdr'][_0x260c('0x30')],function(_0xcb8c28){return{'name':_0xcb8c28[_0x260c('0x31')],'type':_0xcb8c28[_0x260c('0x32')][_0x260c('0x33')]};});_0x233a61[_0x260c('0x34')]=_[_0x260c('0x2f')](_0xc6868a,_0x260c('0x2d'));_0x233a61['query']=_[_0x260c('0x35')](_0xf1ad3e[_0x260c('0x36')]);_0x233a61['filters']=_[_0x260c('0x37')](_0x233a61['model'],_0x233a61['query']);_0x16b663['attributes']=_[_0x260c('0x37')](_0x233a61[_0x260c('0x34')],qs['fields'](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x38')]));_0x16b663[_0x260c('0x39')]=_0x16b663[_0x260c('0x39')][_0x260c('0x3a')]?_0x16b663[_0x260c('0x39')]:_0x233a61['model'];if(!_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3b')](_0x260c('0x3c'))){_0x16b663[_0x260c('0x21')]=qs[_0x260c('0x21')](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x21')]);_0x16b663[_0x260c('0x1f')]=qs[_0x260c('0x1f')](_0xf1ad3e['query'][_0x260c('0x1f')]);}_0x16b663['order']=qs['sort'](_0xf1ad3e['query']['sort']);_0x16b663['where']=qs['filters'](_['pick'](_0xf1ad3e[_0x260c('0x36')],_0x233a61[_0x260c('0x3d')]),_0xc6868a);if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3e')]){_0x16b663['where']=_[_0x260c('0x3f')](_0x16b663[_0x260c('0x40')],{'$or':_['map'](_0xc6868a,function(_0x35afd6){if(_0x35afd6[_0x260c('0x32')]!==_0x260c('0x41')){var _0x1dbc8a={};_0x1dbc8a[_0x35afd6[_0x260c('0x2d')]]={'$like':'%'+_0xf1ad3e['query']['filter']+'%'};return _0x1dbc8a;}})});}_0x16b663=_[_0x260c('0x3f')]({},_0x16b663,_0xf1ad3e[_0x260c('0x42')]);var _0x1de711={'where':_0x16b663[_0x260c('0x40')]};return db['Cdr'][_0x260c('0x22')](_0x1de711)[_0x260c('0x29')](function(_0x265bd8){_0x5993fd[_0x260c('0x22')]=_0x265bd8;if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x43')]){_0x16b663[_0x260c('0x44')]=[{'all':!![]}];}return db[_0x260c('0x45')][_0x260c('0x46')](_0x16b663);})[_0x260c('0x29')](function(_0x3392df){_0x5993fd[_0x260c('0x47')]=_0x3392df;return _0x5993fd;})[_0x260c('0x29')](respondWithFilteredResult(_0x2e49dd,_0x16b663))['catch'](handleError(_0x2e49dd,null));};exports['show']=function(_0x19ab59,_0x30b3f9){var _0xccd9c1={'raw':!![],'where':{'id':_0x19ab59[_0x260c('0x48')]['id']}},_0x50ed87={};_0x50ed87['model']=_['keys'](db[_0x260c('0x45')]['rawAttributes']);_0x50ed87[_0x260c('0x36')]=_[_0x260c('0x35')](_0x19ab59[_0x260c('0x36')]);_0x50ed87[_0x260c('0x3d')]=_['intersection'](_0x50ed87[_0x260c('0x34')],_0x50ed87[_0x260c('0x36')]);_0xccd9c1['attributes']=_[_0x260c('0x37')](_0x50ed87['model'],qs[_0x260c('0x38')](_0x19ab59[_0x260c('0x36')][_0x260c('0x38')]));_0xccd9c1['attributes']=_0xccd9c1[_0x260c('0x39')][_0x260c('0x3a')]?_0xccd9c1[_0x260c('0x39')]:_0x50ed87[_0x260c('0x34')];if(_0x19ab59[_0x260c('0x36')][_0x260c('0x43')]){_0xccd9c1[_0x260c('0x44')]=[{'all':!![]}];}_0xccd9c1=_[_0x260c('0x3f')]({},_0xccd9c1,_0x19ab59[_0x260c('0x42')]);return db[_0x260c('0x45')][_0x260c('0x49')](_0xccd9c1)[_0x260c('0x29')](handleEntityNotFound(_0x30b3f9,null))['then'](respondWithResult(_0x30b3f9,null))['catch'](handleError(_0x30b3f9,null));};exports[_0x260c('0x4a')]=function(_0x4517be,_0x18321f){return db[_0x260c('0x45')]['create'](_0x4517be[_0x260c('0x4b')],{})[_0x260c('0x29')](respondWithResult(_0x18321f,0xc9))[_0x260c('0x4c')](handleError(_0x18321f,null));};exports[_0x260c('0x28')]=function(_0x45175a,_0x1d0890){if(_0x45175a[_0x260c('0x4b')]['id']){delete _0x45175a[_0x260c('0x4b')]['id'];}return db[_0x260c('0x45')]['find']({'where':{'id':_0x45175a[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1d0890,null))['then'](saveUpdates(_0x45175a[_0x260c('0x4b')],null))['then'](respondWithResult(_0x1d0890,null))[_0x260c('0x4c')](handleError(_0x1d0890,null));};exports['destroy']=function(_0x4dcdca,_0x1e34fe){return db[_0x260c('0x45')][_0x260c('0x49')]({'where':{'id':_0x4dcdca[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1e34fe,null))[_0x260c('0x29')](removeEntity(_0x1e34fe,null))[_0x260c('0x4c')](handleError(_0x1e34fe,null));};exports['describe']=function(_0x12fbe5,_0x49b350){return db[_0x260c('0x45')][_0x260c('0x4d')]()[_0x260c('0x29')](respondWithResult(_0x49b350,null))[_0x260c('0x4c')](handleError(_0x49b350,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9a848d3..47d9d20 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xc1385f,_0x9c0bea){var _0x2d1bee=function(_0x4b5d8d){while(--_0x4b5d8d){_0xc1385f['push'](_0xc1385f['shift']());}};_0x2d1bee(++_0x9c0bea);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x517db2,_0x22e5f6){var _0x636271=function(_0x4af022){while(--_0x4af022){_0x517db2['push'](_0x517db2['shift']());}};_0x636271(++_0x22e5f6);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index bdde1a6..faea156 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 _0x88d7=['Cdr,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5bc1fe,_0x458299){var _0x482b91=function(_0xeb37d0){while(--_0xeb37d0){_0x5bc1fe['push'](_0x5bc1fe['shift']());}};_0x482b91(++_0x458299);}(_0x88d7,0x107));var _0x788d=function(_0xd9d17d,_0x3f089b){_0xd9d17d=_0xd9d17d-0x0;var _0x487156=_0x88d7[_0xd9d17d];return _0x487156;};'use strict';var _=require(_0x788d('0x0'));var util=require(_0x788d('0x1'));var moment=require('moment');var BPromise=require(_0x788d('0x2'));var rs=require(_0x788d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x788d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x788d('0x5'))(_0x788d('0x6'));var config=require(_0x788d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x788d('0x8')][_0x788d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2679d0,_0x3497b6,_0x4babe1){return new BPromise(function(_0x100dc7,_0x50dbfa){return client['request'](_0x2679d0,_0x4babe1)[_0x788d('0xa')](function(_0x4af167){logger[_0x788d('0xb')]('Cdr,\x20%s,\x20%s',_0x3497b6,'request\x20sent');logger['debug'](_0x788d('0xc'),_0x3497b6,_0x788d('0xd'),JSON[_0x788d('0xe')](_0x4af167));if(_0x4af167[_0x788d('0xf')]){if(_0x4af167[_0x788d('0xf')][_0x788d('0x10')]===0x1f4){logger[_0x788d('0xf')](_0x788d('0x11'),_0x3497b6,_0x4af167['error'][_0x788d('0x12')]);return _0x50dbfa(_0x4af167['error']['message']);}logger[_0x788d('0xf')](_0x788d('0x11'),_0x3497b6,_0x4af167['error'][_0x788d('0x12')]);return _0x100dc7(_0x4af167[_0x788d('0xf')][_0x788d('0x12')]);}else{logger[_0x788d('0xb')]('Cdr,\x20%s,\x20%s',_0x3497b6,_0x788d('0xd'));_0x100dc7(_0x4af167['result']['message']);}})[_0x788d('0x13')](function(_0x113d90){logger[_0x788d('0xf')]('Cdr,\x20%s,\x20%s',_0x3497b6,_0x113d90);_0x50dbfa(_0x113d90);});});} \ No newline at end of file +var _0x3e2c=['then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x431344,_0x1840f8){var _0x3a6bf6=function(_0xae0376){while(--_0xae0376){_0x431344['push'](_0x431344['shift']());}};_0x3a6bf6(++_0x1840f8);}(_0x3e2c,0x174));var _0xc3e2=function(_0x455afa,_0x235bfc){_0x455afa=_0x455afa-0x0;var _0x46ee43=_0x3e2c[_0x455afa];return _0x46ee43;};'use strict';var _=require(_0xc3e2('0x0'));var util=require(_0xc3e2('0x1'));var moment=require(_0xc3e2('0x2'));var BPromise=require(_0xc3e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e2('0x4'));var db=require(_0xc3e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3e2('0x6'))('rpc');var config=require(_0xc3e2('0x7'));var jayson=require(_0xc3e2('0x8'));var client=jayson[_0xc3e2('0x9')][_0xc3e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277700,_0x17fb54,_0x54a486){return new BPromise(function(_0x2ea2d2,_0x1f1b72){return client[_0xc3e2('0xb')](_0x277700,_0x54a486)[_0xc3e2('0xc')](function(_0xacbf8e){logger[_0xc3e2('0xd')]('Cdr,\x20%s,\x20%s',_0x17fb54,'request\x20sent');logger[_0xc3e2('0xe')](_0xc3e2('0xf'),_0x17fb54,_0xc3e2('0x10'),JSON[_0xc3e2('0x11')](_0xacbf8e));if(_0xacbf8e[_0xc3e2('0x12')]){if(_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x13')]===0x1f4){logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0xacbf8e['error']['message']);return _0x1f1b72(_0xacbf8e['error']['message']);}logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x15')]);return _0x2ea2d2(_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x15')]);}else{logger[_0xc3e2('0xd')](_0xc3e2('0x14'),_0x17fb54,'request\x20sent');_0x2ea2d2(_0xacbf8e[_0xc3e2('0x16')]['message']);}})[_0xc3e2('0x17')](function(_0x4b1baf){logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0x4b1baf);_0x1f1b72(_0x4b1baf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9e01cdf..c0c547f 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x53ff3b,_0x58f396){var _0x4d7ac2=function(_0x13e433){while(--_0x13e433){_0x53ff3b['push'](_0x53ff3b['shift']());}};_0x4d7ac2(++_0x58f396);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 49d83e5..5d0801c 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 _0xd56d=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xd56d,0x15a));var _0xdd56=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0xd56d[_0x4b9dc9];return _0x57b302;};'use strict';var Sequelize=require(_0xdd56('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdd56('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdd56('0x2')],'allowNull':![],'defaultValue':_0xdd56('0x3')},'appdata':{'type':Sequelize[_0xdd56('0x4')]()},'description':{'type':Sequelize[_0xdd56('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdd56('0x5')}}; \ No newline at end of file +var _0x655d=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x655d,0x15e));var _0xd655=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x655d[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xd655('0x0'));module[_0xd655('0x1')]={'priority':{'type':Sequelize[_0xd655('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd655('0x3')],'allowNull':![],'defaultValue':_0xd655('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd655('0x3')]},'interval':{'type':Sequelize[_0xd655('0x3')],'defaultValue':_0xd655('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 46eafdf..fb0dd21 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 _0x6427=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','body','params','catch','rimraf','zip-dir'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6427,0xbe));var _0x7642=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6427[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7642('0x0'));var zipdir=require(_0x7642('0x1'));var jsonpatch=require(_0x7642('0x2'));var rp=require(_0x7642('0x3'));var moment=require(_0x7642('0x4'));var BPromise=require(_0x7642('0x5'));var Mustache=require('mustache');var util=require(_0x7642('0x6'));var path=require(_0x7642('0x7'));var sox=require(_0x7642('0x8'));var csv=require(_0x7642('0x9'));var ejs=require(_0x7642('0xa'));var fs=require('fs');var fs_extra=require(_0x7642('0xb'));var _=require(_0x7642('0xc'));var squel=require(_0x7642('0xd'));var crypto=require(_0x7642('0xe'));var jsforce=require(_0x7642('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7642('0x10'));var Papa=require(_0x7642('0x11'));var Redis=require(_0x7642('0x12'));var authService=require(_0x7642('0x13'));var qs=require(_0x7642('0x14'));var as=require(_0x7642('0x15'));var hardwareService=require(_0x7642('0x16'));var logger=require(_0x7642('0x17'))(_0x7642('0x18'));var utils=require(_0x7642('0x19'));var config=require(_0x7642('0x1a'));var licenseUtil=require(_0x7642('0x1b'));var db=require(_0x7642('0x1c'))['db'];function respondWithStatusCode(_0x3e5f50,_0x3c1291){_0x3c1291=_0x3c1291||0xcc;return function(_0x32e5c9){if(_0x32e5c9){return _0x3e5f50[_0x7642('0x1d')](_0x3c1291);}return _0x3e5f50['status'](_0x3c1291)[_0x7642('0x1e')]();};}function respondWithResult(_0x3adb30,_0x4930f4){_0x4930f4=_0x4930f4||0xc8;return function(_0x146ef9){if(_0x146ef9){return _0x3adb30['status'](_0x4930f4)[_0x7642('0x1f')](_0x146ef9);}};}function respondWithFilteredResult(_0x506c94,_0x1aa890){return function(_0x37964a){if(_0x37964a){var _0x3b87aa=typeof _0x1aa890[_0x7642('0x20')]===_0x7642('0x21')&&typeof _0x1aa890[_0x7642('0x22')]===_0x7642('0x21');var _0x4b04a7=_0x37964a[_0x7642('0x23')];var _0x392686=_0x3b87aa?0x0:_0x1aa890[_0x7642('0x20')];var _0x96bc79=_0x3b87aa?_0x37964a['count']:_0x1aa890['offset']+_0x1aa890[_0x7642('0x22')];var _0x42db03;if(_0x96bc79>=_0x4b04a7){_0x96bc79=_0x4b04a7;_0x42db03=0xc8;}else{_0x42db03=0xce;}_0x506c94['status'](_0x42db03);return _0x506c94[_0x7642('0x24')](_0x7642('0x25'),_0x392686+'-'+_0x96bc79+'/'+_0x4b04a7)['json'](_0x37964a);}return null;};}function patchUpdates(_0x503c13){return function(_0xb6b0c4){try{jsonpatch[_0x7642('0x26')](_0xb6b0c4,_0x503c13,!![]);}catch(_0x580573){return BPromise['reject'](_0x580573);}return _0xb6b0c4[_0x7642('0x27')]();};}function saveUpdates(_0xc23c3,_0x37de2b){return function(_0x4f55d4){if(_0x4f55d4){return _0x4f55d4[_0x7642('0x28')](_0xc23c3)[_0x7642('0x29')](function(_0x508265){return _0x508265;});}return null;};}function removeEntity(_0x606a05,_0x812f9){return function(_0xf31489){if(_0xf31489){return _0xf31489[_0x7642('0x2a')]()['then'](function(){_0x606a05[_0x7642('0x2b')](0xcc)[_0x7642('0x1e')]();});}};}function handleEntityNotFound(_0x1b8eac,_0x15148a){return function(_0x5b74c3){if(!_0x5b74c3){_0x1b8eac[_0x7642('0x1d')](0x194);}return _0x5b74c3;};}function handleError(_0x5c2750,_0x1993e3){_0x1993e3=_0x1993e3||0x1f4;return function(_0x2083f6){logger['error'](_0x2083f6[_0x7642('0x2c')]);if(_0x2083f6[_0x7642('0x2d')]){delete _0x2083f6[_0x7642('0x2d')];}_0x5c2750['status'](_0x1993e3)[_0x7642('0x2e')](_0x2083f6);};}exports['show']=function(_0x3f4764,_0x6e04c5){var _0x4a4fee={'raw':!![],'where':{'id':_0x3f4764['params']['id']}},_0x788aa9={};_0x788aa9[_0x7642('0x2f')]=_[_0x7642('0x30')](db[_0x7642('0x31')][_0x7642('0x32')]);_0x788aa9[_0x7642('0x33')]=_[_0x7642('0x30')](_0x3f4764[_0x7642('0x33')]);_0x788aa9[_0x7642('0x34')]=_[_0x7642('0x35')](_0x788aa9[_0x7642('0x2f')],_0x788aa9[_0x7642('0x33')]);_0x4a4fee[_0x7642('0x36')]=_['intersection'](_0x788aa9['model'],qs[_0x7642('0x37')](_0x3f4764[_0x7642('0x33')][_0x7642('0x37')]));_0x4a4fee['attributes']=_0x4a4fee[_0x7642('0x36')][_0x7642('0x38')]?_0x4a4fee['attributes']:_0x788aa9[_0x7642('0x2f')];if(_0x3f4764['query'][_0x7642('0x39')]){_0x4a4fee[_0x7642('0x3a')]=[{'all':!![]}];}_0x4a4fee=_[_0x7642('0x3b')]({},_0x4a4fee,_0x3f4764['options']);return db['ChatApplication'][_0x7642('0x3c')](_0x4a4fee)['then'](handleEntityNotFound(_0x6e04c5,null))['then'](respondWithResult(_0x6e04c5,null))['catch'](handleError(_0x6e04c5,null));};exports['update']=function(_0x3dd01f,_0x160c10){if(_0x3dd01f[_0x7642('0x3d')]['id']){delete _0x3dd01f[_0x7642('0x3d')]['id'];}return db[_0x7642('0x31')][_0x7642('0x3c')]({'where':{'id':_0x3dd01f[_0x7642('0x3e')]['id']}})[_0x7642('0x29')](handleEntityNotFound(_0x160c10,null))[_0x7642('0x29')](saveUpdates(_0x3dd01f[_0x7642('0x3d')],null))['then'](respondWithResult(_0x160c10,null))['catch'](handleError(_0x160c10,null));};exports['destroy']=function(_0xc5edf3,_0x22ed74){return db[_0x7642('0x31')][_0x7642('0x3c')]({'where':{'id':_0xc5edf3[_0x7642('0x3e')]['id']}})[_0x7642('0x29')](handleEntityNotFound(_0x22ed74,null))[_0x7642('0x29')](removeEntity(_0x22ed74,null))[_0x7642('0x3f')](handleError(_0x22ed74,null));}; \ No newline at end of file +var _0x515d=['filters','attributes','intersection','fields','length','includeAll','include','merge','ChatApplication','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','query'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x515d,0x104));var _0xd515=function(_0x40472f,_0x577cb8){_0x40472f=_0x40472f-0x0;var _0x1a819e=_0x515d[_0x40472f];return _0x1a819e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd515('0x0'));var zipdir=require(_0xd515('0x1'));var jsonpatch=require(_0xd515('0x2'));var rp=require(_0xd515('0x3'));var moment=require(_0xd515('0x4'));var BPromise=require(_0xd515('0x5'));var Mustache=require(_0xd515('0x6'));var util=require(_0xd515('0x7'));var path=require('path');var sox=require(_0xd515('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd515('0x9'));var _=require(_0xd515('0xa'));var squel=require(_0xd515('0xb'));var crypto=require(_0xd515('0xc'));var jsforce=require(_0xd515('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd515('0xe'));var querystring=require(_0xd515('0xf'));var Papa=require(_0xd515('0x10'));var Redis=require(_0xd515('0x11'));var authService=require(_0xd515('0x12'));var qs=require(_0xd515('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd515('0x14'));var logger=require(_0xd515('0x15'))(_0xd515('0x16'));var utils=require(_0xd515('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd515('0x18'));var db=require(_0xd515('0x19'))['db'];function respondWithStatusCode(_0x29c078,_0x33b905){_0x33b905=_0x33b905||0xcc;return function(_0x1d6bda){if(_0x1d6bda){return _0x29c078[_0xd515('0x1a')](_0x33b905);}return _0x29c078[_0xd515('0x1b')](_0x33b905)[_0xd515('0x1c')]();};}function respondWithResult(_0x1f23b7,_0x43384b){_0x43384b=_0x43384b||0xc8;return function(_0x10620b){if(_0x10620b){return _0x1f23b7[_0xd515('0x1b')](_0x43384b)[_0xd515('0x1d')](_0x10620b);}};}function respondWithFilteredResult(_0x589d04,_0x274550){return function(_0xc41eca){if(_0xc41eca){var _0xc8fbf=typeof _0x274550[_0xd515('0x1e')]===_0xd515('0x1f')&&typeof _0x274550[_0xd515('0x20')]===_0xd515('0x1f');var _0x139e91=_0xc41eca[_0xd515('0x21')];var _0x564c4e=_0xc8fbf?0x0:_0x274550['offset'];var _0x43bb12=_0xc8fbf?_0xc41eca[_0xd515('0x21')]:_0x274550[_0xd515('0x1e')]+_0x274550[_0xd515('0x20')];var _0x1ef858;if(_0x43bb12>=_0x139e91){_0x43bb12=_0x139e91;_0x1ef858=0xc8;}else{_0x1ef858=0xce;}_0x589d04[_0xd515('0x1b')](_0x1ef858);return _0x589d04[_0xd515('0x22')](_0xd515('0x23'),_0x564c4e+'-'+_0x43bb12+'/'+_0x139e91)[_0xd515('0x1d')](_0xc41eca);}return null;};}function patchUpdates(_0x5c7fef){return function(_0x57e1f4){try{jsonpatch[_0xd515('0x24')](_0x57e1f4,_0x5c7fef,!![]);}catch(_0x5b1649){return BPromise[_0xd515('0x25')](_0x5b1649);}return _0x57e1f4[_0xd515('0x26')]();};}function saveUpdates(_0x2b2ed5,_0x4e9d06){return function(_0xb422bc){if(_0xb422bc){return _0xb422bc[_0xd515('0x27')](_0x2b2ed5)[_0xd515('0x28')](function(_0x299b46){return _0x299b46;});}return null;};}function removeEntity(_0x519b7f,_0x430153){return function(_0x11cc9f){if(_0x11cc9f){return _0x11cc9f[_0xd515('0x29')]()[_0xd515('0x28')](function(){_0x519b7f[_0xd515('0x1b')](0xcc)[_0xd515('0x1c')]();});}};}function handleEntityNotFound(_0x130533,_0x84adb){return function(_0x19ce0c){if(!_0x19ce0c){_0x130533['sendStatus'](0x194);}return _0x19ce0c;};}function handleError(_0x5b6a98,_0x2e4455){_0x2e4455=_0x2e4455||0x1f4;return function(_0x2b803a){logger[_0xd515('0x2a')](_0x2b803a[_0xd515('0x2b')]);if(_0x2b803a[_0xd515('0x2c')]){delete _0x2b803a[_0xd515('0x2c')];}_0x5b6a98[_0xd515('0x1b')](_0x2e4455)[_0xd515('0x2d')](_0x2b803a);};}exports['show']=function(_0x38766a,_0x290489){var _0x3c2841={'raw':!![],'where':{'id':_0x38766a[_0xd515('0x2e')]['id']}},_0x154c02={};_0x154c02[_0xd515('0x2f')]=_[_0xd515('0x30')](db['ChatApplication']['rawAttributes']);_0x154c02['query']=_[_0xd515('0x30')](_0x38766a[_0xd515('0x31')]);_0x154c02[_0xd515('0x32')]=_['intersection'](_0x154c02['model'],_0x154c02['query']);_0x3c2841[_0xd515('0x33')]=_[_0xd515('0x34')](_0x154c02[_0xd515('0x2f')],qs[_0xd515('0x35')](_0x38766a[_0xd515('0x31')]['fields']));_0x3c2841[_0xd515('0x33')]=_0x3c2841['attributes'][_0xd515('0x36')]?_0x3c2841[_0xd515('0x33')]:_0x154c02[_0xd515('0x2f')];if(_0x38766a[_0xd515('0x31')][_0xd515('0x37')]){_0x3c2841[_0xd515('0x38')]=[{'all':!![]}];}_0x3c2841=_[_0xd515('0x39')]({},_0x3c2841,_0x38766a['options']);return db[_0xd515('0x3a')][_0xd515('0x3b')](_0x3c2841)[_0xd515('0x28')](handleEntityNotFound(_0x290489,null))[_0xd515('0x28')](respondWithResult(_0x290489,null))[_0xd515('0x3c')](handleError(_0x290489,null));};exports['update']=function(_0x21c3dc,_0x599054){if(_0x21c3dc[_0xd515('0x3d')]['id']){delete _0x21c3dc[_0xd515('0x3d')]['id'];}return db[_0xd515('0x3a')][_0xd515('0x3b')]({'where':{'id':_0x21c3dc[_0xd515('0x2e')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x599054,null))[_0xd515('0x28')](saveUpdates(_0x21c3dc[_0xd515('0x3d')],null))[_0xd515('0x28')](respondWithResult(_0x599054,null))[_0xd515('0x3c')](handleError(_0x599054,null));};exports[_0xd515('0x29')]=function(_0x4201c3,_0x59a029){return db[_0xd515('0x3a')][_0xd515('0x3b')]({'where':{'id':_0x4201c3[_0xd515('0x2e')]['id']}})['then'](handleEntityNotFound(_0x59a029,null))[_0xd515('0x28')](removeEntity(_0x59a029,null))['catch'](handleError(_0x59a029,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e571437..e82bed4 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 _0x4971=['bluebird','request-promise','path','rimraf','../../config/environment','define','chat_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x27b095,_0x2ead9b){var _0x282066=function(_0x3ace01){while(--_0x3ace01){_0x27b095['push'](_0x27b095['shift']());}};_0x282066(++_0x2ead9b);}(_0x4971,0xa4));var _0x1497=function(_0x3120e6,_0x324456){_0x3120e6=_0x3120e6-0x0;var _0x5b739f=_0x4971[_0x3120e6];return _0x5b739f;};'use strict';var _=require(_0x1497('0x0'));var util=require('util');var logger=require(_0x1497('0x1'))(_0x1497('0x2'));var moment=require(_0x1497('0x3'));var BPromise=require(_0x1497('0x4'));var rp=require(_0x1497('0x5'));var fs=require('fs');var path=require(_0x1497('0x6'));var rimraf=require(_0x1497('0x7'));var config=require(_0x1497('0x8'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x57b934,_0x53edf1){return _0x57b934[_0x1497('0x9')]('ChatApplication',attributes,{'tableName':_0x1497('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1497('0xb')});}; \ No newline at end of file +var _0x1502=['moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x1502,0x1c3));var _0x2150=function(_0x196d3e,_0x2c56da){_0x196d3e=_0x196d3e-0x0;var _0x160f54=_0x1502[_0x196d3e];return _0x160f54;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));module['exports']=function(_0x2e34e9,_0x38dbdf){return _0x2e34e9['define'](_0x2150('0xa'),attributes,{'tableName':_0x2150('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2150('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 305d974..c99f67e 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 _0x7bc8=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x23dabd,_0x577de7){var _0x3580a1=function(_0x39204e){while(--_0x39204e){_0x23dabd['push'](_0x23dabd['shift']());}};_0x3580a1(++_0x577de7);}(_0x7bc8,0x16a));var _0x87bc=function(_0x3a832f,_0x1de647){_0x3a832f=_0x3a832f-0x0;var _0x13f6c2=_0x7bc8[_0x3a832f];return _0x13f6c2;};'use strict';var _=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var moment=require('moment');var BPromise=require(_0x87bc('0x2'));var rs=require(_0x87bc('0x3'));var fs=require('fs');var Redis=require(_0x87bc('0x4'));var db=require(_0x87bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87bc('0x6'))('rpc');var config=require(_0x87bc('0x7'));var jayson=require(_0x87bc('0x8'));var client=jayson[_0x87bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a2fa,_0x1329fe,_0xc2b90b){return new BPromise(function(_0x582fbb,_0x5038af){return client[_0x87bc('0xa')](_0x12a2fa,_0xc2b90b)[_0x87bc('0xb')](function(_0x211610){logger[_0x87bc('0xc')](_0x87bc('0xd'),_0x1329fe,_0x87bc('0xe'));logger[_0x87bc('0xf')](_0x87bc('0x10'),_0x1329fe,_0x87bc('0xe'),JSON[_0x87bc('0x11')](_0x211610));if(_0x211610[_0x87bc('0x12')]){if(_0x211610[_0x87bc('0x12')][_0x87bc('0x13')]===0x1f4){logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x211610[_0x87bc('0x12')][_0x87bc('0x14')]);return _0x5038af(_0x211610['error']['message']);}logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x211610[_0x87bc('0x12')]['message']);return _0x582fbb(_0x211610[_0x87bc('0x12')][_0x87bc('0x14')]);}else{logger[_0x87bc('0xc')](_0x87bc('0xd'),_0x1329fe,'request\x20sent');_0x582fbb(_0x211610[_0x87bc('0x15')][_0x87bc('0x14')]);}})[_0x87bc('0x16')](function(_0x22a6c4){logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x22a6c4);_0x5038af(_0x22a6c4);});});} \ No newline at end of file +var _0x1cd2=['stringify','error','message','ChatApplication,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x1cd2,0xae));var _0x21cd=function(_0x20af23,_0x3b4d17){_0x20af23=_0x20af23-0x0;var _0x20983d=_0x1cd2[_0x20af23];return _0x20983d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x21cd('0x0'));var BPromise=require(_0x21cd('0x1'));var rs=require(_0x21cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21cd('0x3'))['db'];var utils=require(_0x21cd('0x4'));var logger=require(_0x21cd('0x5'))(_0x21cd('0x6'));var config=require('../../config/environment');var jayson=require(_0x21cd('0x7'));var client=jayson['client'][_0x21cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a2abd,_0x52f6b7,_0x321233){return new BPromise(function(_0x5853ad,_0x16c012){return client[_0x21cd('0x9')](_0x5a2abd,_0x321233)[_0x21cd('0xa')](function(_0x5e532a){logger[_0x21cd('0xb')]('ChatApplication,\x20%s,\x20%s',_0x52f6b7,_0x21cd('0xc'));logger[_0x21cd('0xd')](_0x21cd('0xe'),_0x52f6b7,_0x21cd('0xc'),JSON[_0x21cd('0xf')](_0x5e532a));if(_0x5e532a[_0x21cd('0x10')]){if(_0x5e532a['error']['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x52f6b7,_0x5e532a[_0x21cd('0x10')]['message']);return _0x16c012(_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);}logger[_0x21cd('0x10')](_0x21cd('0x12'),_0x52f6b7,_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);return _0x5853ad(_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);}else{logger['info'](_0x21cd('0x12'),_0x52f6b7,_0x21cd('0xc'));_0x5853ad(_0x5e532a[_0x21cd('0x13')][_0x21cd('0x11')]);}})[_0x21cd('0x14')](function(_0x391958){logger['error'](_0x21cd('0x12'),_0x52f6b7,_0x391958);_0x16c012(_0x391958);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8c272e4..3cc1b87 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 _0x9001=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','put','isAuthenticated'];(function(_0x2074a3,_0x45500a){var _0x5562a2=function(_0x46323b){while(--_0x46323b){_0x2074a3['push'](_0x2074a3['shift']());}};_0x5562a2(++_0x45500a);}(_0x9001,0x154));var _0x1900=function(_0x1fda64,_0x440db3){_0x1fda64=_0x1fda64-0x0;var _0x377bfc=_0x9001[_0x1fda64];return _0x377bfc;};'use strict';var multer=require(_0x1900('0x0'));var util=require(_0x1900('0x1'));var path=require(_0x1900('0x2'));var timeout=require(_0x1900('0x3'));var express=require(_0x1900('0x4'));var router=express[_0x1900('0x5')]();var fs_extra=require(_0x1900('0x6'));var auth=require(_0x1900('0x7'));var interaction=require(_0x1900('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x1900('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1900('0xa')]('/:id',auth[_0x1900('0xb')](),controller[_0x1900('0xc')]);router[_0x1900('0xd')]('/:id',auth[_0x1900('0xb')](),controller[_0x1900('0xe')]);module[_0x1900('0xf')]=router; \ No newline at end of file +var _0xeb70=['../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','express','fs-extra'];(function(_0x5addbe,_0x3978c9){var _0x6287f2=function(_0x14af78){while(--_0x14af78){_0x5addbe['push'](_0x5addbe['shift']());}};_0x6287f2(++_0x3978c9);}(_0xeb70,0x173));var _0x0eb7=function(_0x117c97,_0x3ebe2b){_0x117c97=_0x117c97-0x0;var _0x47dedc=_0xeb70[_0x117c97];return _0x47dedc;};'use strict';var multer=require('multer');var util=require(_0x0eb7('0x0'));var path=require(_0x0eb7('0x1'));var timeout=require('connect-timeout');var express=require(_0x0eb7('0x2'));var router=express['Router']();var fs_extra=require(_0x0eb7('0x3'));var auth=require(_0x0eb7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb7('0x5'));var controller=require(_0x0eb7('0x6'));router[_0x0eb7('0x7')](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xa')]);router['put'](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xb')]);router[_0x0eb7('0xc')](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xd')]);module[_0x0eb7('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 37bdd1b..692c7bd 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 _0x1f2e=['STRING','BOOLEAN'];(function(_0xb976c9,_0x5eb949){var _0x95a87e=function(_0x5d6e0c){while(--_0x5d6e0c){_0xb976c9['push'](_0xb976c9['shift']());}};_0x95a87e(++_0x5eb949);}(_0x1f2e,0x82));var _0xe1f2=function(_0x52cd03,_0x49f262){_0x52cd03=_0x52cd03-0x0;var _0x4ccba2=_0x1f2e[_0x52cd03];return _0x4ccba2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe1f2('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe1f2('0x0')]},'write':{'type':Sequelize[_0xe1f2('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd367=['exports','STRING'];(function(_0x440c0e,_0x2124b9){var _0x1bfaf4=function(_0x688b9f){while(--_0x688b9f){_0x440c0e['push'](_0x440c0e['shift']());}};_0x1bfaf4(++_0x2124b9);}(_0xd367,0x1dc));var _0x7d36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd367[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x7d36('0x0')]={'name':{'type':Sequelize[_0x7d36('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7d36('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index abceea9..a5c7ec4 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 _0xc956=['includeAll','include','options','find','create','body','destroy','describe','getUnread','ChatInternalMessage','toInteger','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','json','undefined','limit','count','offset','set','apply','save','update','then','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','catch','show','params'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xc956,0x7a));var _0x6c95=function(_0x5d3569,_0x2753b7){_0x5d3569=_0x5d3569-0x0;var _0x233fbb=_0xc956[_0x5d3569];return _0x233fbb;};'use strict';var emlformat=require(_0x6c95('0x0'));var rimraf=require(_0x6c95('0x1'));var zipdir=require(_0x6c95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c95('0x3'));var moment=require(_0x6c95('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c95('0x5'));var util=require('util');var path=require(_0x6c95('0x6'));var sox=require(_0x6c95('0x7'));var csv=require(_0x6c95('0x8'));var ejs=require(_0x6c95('0x9'));var fs=require('fs');var fs_extra=require(_0x6c95('0xa'));var _=require(_0x6c95('0xb'));var squel=require(_0x6c95('0xc'));var crypto=require(_0x6c95('0xd'));var jsforce=require(_0x6c95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c95('0x8'));var querystring=require(_0x6c95('0xf'));var Papa=require(_0x6c95('0x10'));var Redis=require(_0x6c95('0x11'));var authService=require(_0x6c95('0x12'));var qs=require(_0x6c95('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c95('0x14'));var logger=require('../../config/logger')(_0x6c95('0x15'));var utils=require(_0x6c95('0x16'));var config=require(_0x6c95('0x17'));var licenseUtil=require(_0x6c95('0x18'));var db=require(_0x6c95('0x19'))['db'];config[_0x6c95('0x1a')]=_[_0x6c95('0x1b')](config[_0x6c95('0x1a')],{'host':_0x6c95('0x1c'),'port':0x18eb});var socket=require(_0x6c95('0x1d'))(new Redis(config[_0x6c95('0x1a')]));require(_0x6c95('0x1e'))[_0x6c95('0x1f')](socket);function respondWithStatusCode(_0xb027a2,_0x524a15){_0x524a15=_0x524a15||0xcc;return function(_0x17c2c7){if(_0x17c2c7){return _0xb027a2['sendStatus'](_0x524a15);}return _0xb027a2[_0x6c95('0x20')](_0x524a15)['end']();};}function respondWithResult(_0x57469e,_0x2ce12c){_0x2ce12c=_0x2ce12c||0xc8;return function(_0x5e0ac4){if(_0x5e0ac4){return _0x57469e[_0x6c95('0x20')](_0x2ce12c)[_0x6c95('0x21')](_0x5e0ac4);}};}function respondWithFilteredResult(_0x59344a,_0x5394a1){return function(_0x48482f){if(_0x48482f){var _0x51fc8a=typeof _0x5394a1['offset']===_0x6c95('0x22')&&typeof _0x5394a1[_0x6c95('0x23')]===_0x6c95('0x22');var _0x51b2d6=_0x48482f[_0x6c95('0x24')];var _0x578b19=_0x51fc8a?0x0:_0x5394a1[_0x6c95('0x25')];var _0x48ede1=_0x51fc8a?_0x48482f[_0x6c95('0x24')]:_0x5394a1[_0x6c95('0x25')]+_0x5394a1[_0x6c95('0x23')];var _0x17df05;if(_0x48ede1>=_0x51b2d6){_0x48ede1=_0x51b2d6;_0x17df05=0xc8;}else{_0x17df05=0xce;}_0x59344a['status'](_0x17df05);return _0x59344a[_0x6c95('0x26')]('Content-Range',_0x578b19+'-'+_0x48ede1+'/'+_0x51b2d6)['json'](_0x48482f);}return null;};}function patchUpdates(_0x499fd3){return function(_0x2b3744){try{jsonpatch[_0x6c95('0x27')](_0x2b3744,_0x499fd3,!![]);}catch(_0x3c8c1c){return BPromise['reject'](_0x3c8c1c);}return _0x2b3744[_0x6c95('0x28')]();};}function saveUpdates(_0x421dca,_0x536c16){return function(_0x7b1c30){if(_0x7b1c30){return _0x7b1c30[_0x6c95('0x29')](_0x421dca)[_0x6c95('0x2a')](function(_0x2285aa){return _0x2285aa;});}return null;};}function removeEntity(_0xf55bdd,_0xc7a7e8){return function(_0x5c7475){if(_0x5c7475){return _0x5c7475['destroy']()['then'](function(){_0xf55bdd[_0x6c95('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a68e9,_0x162303){return function(_0x2a14a0){if(!_0x2a14a0){_0x3a68e9[_0x6c95('0x2b')](0x194);}return _0x2a14a0;};}function handleError(_0x1935af,_0x2af40a){_0x2af40a=_0x2af40a||0x1f4;return function(_0x38b615){logger[_0x6c95('0x2c')](_0x38b615['stack']);if(_0x38b615[_0x6c95('0x2d')]){delete _0x38b615[_0x6c95('0x2d')];}_0x1935af[_0x6c95('0x20')](_0x2af40a)[_0x6c95('0x2e')](_0x38b615);};}exports[_0x6c95('0x2f')]=function(_0x2c90cd,_0x43250f){var _0x1f244e={},_0x21ae40={},_0x2af7ba={'count':0x0,'rows':[]};var _0x4525c7=_[_0x6c95('0x30')](db[_0x6c95('0x31')][_0x6c95('0x32')],function(_0x6fa692){return{'name':_0x6fa692['fieldName'],'type':_0x6fa692['type'][_0x6c95('0x33')]};});_0x21ae40[_0x6c95('0x34')]=_[_0x6c95('0x30')](_0x4525c7,_0x6c95('0x2d'));_0x21ae40[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x2c90cd[_0x6c95('0x35')]);_0x21ae40[_0x6c95('0x37')]=_[_0x6c95('0x38')](_0x21ae40[_0x6c95('0x34')],_0x21ae40['query']);_0x1f244e['attributes']=_[_0x6c95('0x38')](_0x21ae40['model'],qs[_0x6c95('0x39')](_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x39')]));_0x1f244e[_0x6c95('0x3a')]=_0x1f244e[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x1f244e[_0x6c95('0x3a')]:_0x21ae40[_0x6c95('0x34')];if(!_0x2c90cd[_0x6c95('0x35')]['hasOwnProperty'](_0x6c95('0x3c'))){_0x1f244e[_0x6c95('0x23')]=qs[_0x6c95('0x23')](_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x23')]);_0x1f244e[_0x6c95('0x25')]=qs['offset'](_0x2c90cd[_0x6c95('0x35')]['offset']);}_0x1f244e[_0x6c95('0x3d')]=qs[_0x6c95('0x3e')](_0x2c90cd[_0x6c95('0x35')]['sort']);_0x1f244e['where']=qs[_0x6c95('0x37')](_[_0x6c95('0x3f')](_0x2c90cd[_0x6c95('0x35')],_0x21ae40[_0x6c95('0x37')]),_0x4525c7);if(_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x40')]){_0x1f244e[_0x6c95('0x41')]=_[_0x6c95('0x42')](_0x1f244e[_0x6c95('0x41')],{'$or':_[_0x6c95('0x30')](_0x4525c7,function(_0x121f16){if(_0x121f16[_0x6c95('0x43')]!==_0x6c95('0x44')){var _0x3ca387={};_0x3ca387[_0x121f16[_0x6c95('0x2d')]]={'$like':'%'+_0x2c90cd['query'][_0x6c95('0x40')]+'%'};return _0x3ca387;}})});}_0x1f244e=_['merge']({},_0x1f244e,_0x2c90cd['options']);var _0x5ad004={'where':_0x1f244e[_0x6c95('0x41')]};return db['ChatGroup']['count'](_0x5ad004)[_0x6c95('0x2a')](function(_0xb8159e){_0x2af7ba[_0x6c95('0x24')]=_0xb8159e;if(_0x2c90cd[_0x6c95('0x35')]['includeAll']){_0x1f244e['include']=[{'all':!![]}];}return db[_0x6c95('0x31')]['findAll'](_0x1f244e);})[_0x6c95('0x2a')](function(_0x54a5fc){_0x2af7ba['rows']=_0x54a5fc;return _0x2af7ba;})[_0x6c95('0x2a')](respondWithFilteredResult(_0x43250f,_0x1f244e))[_0x6c95('0x45')](handleError(_0x43250f,null));};exports[_0x6c95('0x46')]=function(_0x254f95,_0x3daa2a){var _0x246417={'raw':!![],'where':{'id':_0x254f95[_0x6c95('0x47')]['id']}},_0x1dd579={};_0x1dd579[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x31')][_0x6c95('0x32')]);_0x1dd579[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x254f95[_0x6c95('0x35')]);_0x1dd579['filters']=_[_0x6c95('0x38')](_0x1dd579[_0x6c95('0x34')],_0x1dd579[_0x6c95('0x35')]);_0x246417['attributes']=_['intersection'](_0x1dd579[_0x6c95('0x34')],qs[_0x6c95('0x39')](_0x254f95[_0x6c95('0x35')][_0x6c95('0x39')]));_0x246417[_0x6c95('0x3a')]=_0x246417['attributes'][_0x6c95('0x3b')]?_0x246417[_0x6c95('0x3a')]:_0x1dd579[_0x6c95('0x34')];if(_0x254f95[_0x6c95('0x35')][_0x6c95('0x48')]){_0x246417[_0x6c95('0x49')]=[{'all':!![]}];}_0x246417=_['merge']({},_0x246417,_0x254f95[_0x6c95('0x4a')]);return db[_0x6c95('0x31')][_0x6c95('0x4b')](_0x246417)['then'](handleEntityNotFound(_0x3daa2a,null))[_0x6c95('0x2a')](respondWithResult(_0x3daa2a,null))[_0x6c95('0x45')](handleError(_0x3daa2a,null));};exports[_0x6c95('0x4c')]=function(_0x15c4e4,_0x18e802){return db[_0x6c95('0x31')][_0x6c95('0x4c')](_0x15c4e4[_0x6c95('0x4d')],{})[_0x6c95('0x2a')](respondWithResult(_0x18e802,0xc9))[_0x6c95('0x45')](handleError(_0x18e802,null));};exports[_0x6c95('0x29')]=function(_0x1a7ec1,_0x1ea200){if(_0x1a7ec1['body']['id']){delete _0x1a7ec1[_0x6c95('0x4d')]['id'];}return db['ChatGroup'][_0x6c95('0x4b')]({'where':{'id':_0x1a7ec1['params']['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x1ea200,null))[_0x6c95('0x2a')](saveUpdates(_0x1a7ec1[_0x6c95('0x4d')],null))['then'](respondWithResult(_0x1ea200,null))[_0x6c95('0x45')](handleError(_0x1ea200,null));};exports[_0x6c95('0x4e')]=function(_0x867fcf,_0x43b4bc){return db[_0x6c95('0x31')][_0x6c95('0x4b')]({'where':{'id':_0x867fcf[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x43b4bc,null))[_0x6c95('0x2a')](removeEntity(_0x43b4bc,null))['catch'](handleError(_0x43b4bc,null));};exports[_0x6c95('0x4f')]=function(_0x18af3e,_0x57f37e){return db[_0x6c95('0x31')][_0x6c95('0x4f')]()[_0x6c95('0x2a')](respondWithResult(_0x57f37e,null))['catch'](handleError(_0x57f37e,null));};exports[_0x6c95('0x50')]=function(_0x360102,_0x5b6187,_0x5d5985){return db[_0x6c95('0x51')][_0x6c95('0x24')]({'where':{'ChatGroupId':_0x360102[_0x6c95('0x47')]['id'],'ToId':_0x360102['user']['id'],'read':![]}})[_0x6c95('0x2a')](function(_0x402010){return{'id':_[_0x6c95('0x52')](_0x360102[_0x6c95('0x47')]['id']),'count':_0x402010};})[_0x6c95('0x2a')](respondWithResult(_0x5b6187,null))[_0x6c95('0x45')](handleError(_0x5b6187,null));};exports['addMembers']=function(_0x5dbd4b,_0x2ca4f9,_0x4adc88){return db[_0x6c95('0x31')][_0x6c95('0x4b')]({'where':{'id':_0x5dbd4b[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x2ca4f9,null))[_0x6c95('0x2a')](function(_0x2d0d2b){if(_0x2d0d2b){return _0x2d0d2b['addMembers'](_0x5dbd4b[_0x6c95('0x4d')][_0x6c95('0x53')],_[_0x6c95('0x54')](_0x5dbd4b['body'],[_0x6c95('0x53'),'id'])||{});}})['then'](respondWithResult(_0x2ca4f9,null))[_0x6c95('0x45')](handleError(_0x2ca4f9,null));};exports[_0x6c95('0x55')]=function(_0x390300,_0x461316,_0x4d30c3){var _0x775e37={};var _0x34b443={};var _0x196192;var _0x5b13ae;return db[_0x6c95('0x31')][_0x6c95('0x56')]({'where':{'id':_0x390300[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x461316,null))[_0x6c95('0x2a')](function(_0x3e3ab8){if(_0x3e3ab8){_0x196192=_0x3e3ab8;_0x34b443[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x57')][_0x6c95('0x32')]);_0x34b443[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x390300[_0x6c95('0x35')]);_0x34b443[_0x6c95('0x37')]=_[_0x6c95('0x38')](_0x34b443['model'],_0x34b443['query']);_0x775e37[_0x6c95('0x3a')]=_[_0x6c95('0x38')](_0x34b443[_0x6c95('0x34')],qs[_0x6c95('0x39')](_0x390300[_0x6c95('0x35')][_0x6c95('0x39')]));_0x775e37['attributes']=_0x775e37[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x775e37[_0x6c95('0x3a')]:_0x34b443['model'];_0x775e37[_0x6c95('0x3d')]=qs['sort'](_0x390300[_0x6c95('0x35')][_0x6c95('0x3e')]);_0x775e37[_0x6c95('0x41')]=qs[_0x6c95('0x37')](_[_0x6c95('0x3f')](_0x390300[_0x6c95('0x35')],_0x34b443[_0x6c95('0x37')]));if(_0x390300[_0x6c95('0x35')][_0x6c95('0x40')]){_0x775e37['where']=_[_0x6c95('0x42')](_0x775e37['where'],{'$or':_[_0x6c95('0x30')](_0x775e37[_0x6c95('0x3a')],function(_0x415acc){var _0x2f668f={};_0x2f668f[_0x415acc]={'$like':'%'+_0x390300[_0x6c95('0x35')]['filter']+'%'};return _0x2f668f;})});}_0x775e37=_[_0x6c95('0x42')]({},_0x775e37,_0x390300[_0x6c95('0x4a')]);return _0x196192[_0x6c95('0x55')](_0x775e37);}})[_0x6c95('0x2a')](function(_0x5a89ad){if(_0x5a89ad){_0x5b13ae=_0x5a89ad[_0x6c95('0x3b')];if(!_0x390300[_0x6c95('0x35')][_0x6c95('0x58')](_0x6c95('0x3c'))){_0x775e37[_0x6c95('0x23')]=qs[_0x6c95('0x23')](_0x390300[_0x6c95('0x35')][_0x6c95('0x23')]);_0x775e37[_0x6c95('0x25')]=qs[_0x6c95('0x25')](_0x390300['query'][_0x6c95('0x25')]);}return _0x196192['getMembers'](_0x775e37);}})[_0x6c95('0x2a')](function(_0x29a10a){if(_0x29a10a){return _0x29a10a?{'count':_0x5b13ae,'rows':_0x29a10a}:null;}})[_0x6c95('0x2a')](respondWithResult(_0x461316,null))[_0x6c95('0x45')](handleError(_0x461316,null));};exports['removeMembers']=function(_0x42a487,_0x515855,_0x3ae3f5){return db[_0x6c95('0x31')]['find']({'where':{'id':_0x42a487[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x515855,null))[_0x6c95('0x2a')](function(_0x42d001){if(_0x42d001){return _0x42d001[_0x6c95('0x59')](_0x42a487['query'][_0x6c95('0x53')]);}})[_0x6c95('0x2a')](respondWithStatusCode(_0x515855,null))[_0x6c95('0x45')](handleError(_0x515855,null));};exports[_0x6c95('0x5a')]=function(_0x21d4b4,_0x267649,_0x333e1e){if(_0x21d4b4[_0x6c95('0x4d')]['id']){delete _0x21d4b4[_0x6c95('0x4d')]['id'];}return db[_0x6c95('0x31')]['find']({'where':{'id':_0x21d4b4[_0x6c95('0x47')]['id']}})['then'](handleEntityNotFound(_0x267649,null))[_0x6c95('0x2a')](function(_0x5d4e37){if(_0x5d4e37){_0x21d4b4[_0x6c95('0x4d')][_0x6c95('0x5b')]=_0x5d4e37['id'];return db['ChatInternalMessage'][_0x6c95('0x4c')](_0x21d4b4[_0x6c95('0x4d')]);}})['then'](respondWithResult(_0x267649,null))[_0x6c95('0x45')](handleError(_0x267649,null));};exports[_0x6c95('0x5c')]=function(_0x38f735,_0x4f851a,_0x37bf36){var _0x4b942b={};var _0x505190={};var _0x4a1b6e;var _0x5ae177;return db['ChatGroup'][_0x6c95('0x56')]({'where':{'id':_0x38f735['params']['id']}})['then'](handleEntityNotFound(_0x4f851a,null))[_0x6c95('0x2a')](function(_0x317cb8){if(_0x317cb8){_0x4a1b6e=_0x317cb8;_0x505190[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x51')][_0x6c95('0x32')]);_0x505190[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x38f735[_0x6c95('0x35')]);_0x505190['filters']=_['intersection'](_0x505190[_0x6c95('0x34')],_0x505190[_0x6c95('0x35')]);_0x4b942b[_0x6c95('0x3a')]=_['intersection'](_0x505190[_0x6c95('0x34')],qs['fields'](_0x38f735['query'][_0x6c95('0x39')]));_0x4b942b[_0x6c95('0x3a')]=_0x4b942b[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x4b942b[_0x6c95('0x3a')]:_0x505190[_0x6c95('0x34')];_0x4b942b[_0x6c95('0x3d')]=qs[_0x6c95('0x3e')](_0x38f735[_0x6c95('0x35')][_0x6c95('0x3e')]);_0x4b942b[_0x6c95('0x41')]=qs[_0x6c95('0x37')](_['pick'](_0x38f735[_0x6c95('0x35')],_0x505190[_0x6c95('0x37')]));if(_0x38f735[_0x6c95('0x35')][_0x6c95('0x40')]){_0x4b942b[_0x6c95('0x41')]=_['merge'](_0x4b942b[_0x6c95('0x41')],{'$or':_[_0x6c95('0x30')](_0x4b942b['attributes'],function(_0x31c756){var _0x3294a8={};_0x3294a8[_0x31c756]={'$like':'%'+_0x38f735[_0x6c95('0x35')][_0x6c95('0x40')]+'%'};return _0x3294a8;})});}if(_0x38f735['query'][_0x6c95('0x5d')]){var _0x3e7803=_0x38f735[_0x6c95('0x35')][_0x6c95('0x5d')][_0x6c95('0x5e')](',');var _0x45b1d7={};_0x45b1d7[_0x3e7803[0x0]]={'$gte':moment(_0x3e7803[0x1])[_0x6c95('0x5f')](_0x6c95('0x60'))};_0x4b942b[_0x6c95('0x41')]=_[_0x6c95('0x42')](_0x4b942b[_0x6c95('0x41')],_0x45b1d7);}_0x4b942b=_[_0x6c95('0x42')]({},_0x4b942b,_0x38f735['options']);return _0x4a1b6e[_0x6c95('0x5c')](_0x4b942b);}})[_0x6c95('0x2a')](function(_0x2634e1){if(_0x2634e1){_0x5ae177=_0x2634e1[_0x6c95('0x3b')];if(!_0x38f735[_0x6c95('0x35')][_0x6c95('0x58')](_0x6c95('0x3c'))){_0x4b942b[_0x6c95('0x23')]=qs['limit'](_0x38f735[_0x6c95('0x35')][_0x6c95('0x23')]);_0x4b942b[_0x6c95('0x25')]=qs[_0x6c95('0x25')](_0x38f735[_0x6c95('0x35')][_0x6c95('0x25')]);}return _0x4a1b6e[_0x6c95('0x5c')](_0x4b942b);}})[_0x6c95('0x2a')](function(_0x4b53ae){if(_0x4b53ae){return _0x4b53ae?{'count':_0x5ae177,'rows':_0x4b53ae}:null;}})[_0x6c95('0x2a')](respondWithResult(_0x4f851a,null))['catch'](handleError(_0x4f851a,null));}; \ No newline at end of file +var _0x7b4b=['YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','intersection','attributes','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','fields','length','find','catch','create','body','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','pick','options','removeMembers','addMessage','getMessages','$gte','format'];(function(_0x1e5d56,_0x8a4924){var _0x37f85b=function(_0x250679){while(--_0x250679){_0x1e5d56['push'](_0x1e5d56['shift']());}};_0x37f85b(++_0x8a4924);}(_0x7b4b,0x1ce));var _0xb7b4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7b4b[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0xb7b4('0x0'));var rimraf=require(_0xb7b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb7b4('0x2'));var moment=require(_0xb7b4('0x3'));var BPromise=require(_0xb7b4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb7b4('0x5'));var sox=require(_0xb7b4('0x6'));var csv=require(_0xb7b4('0x7'));var ejs=require(_0xb7b4('0x8'));var fs=require('fs');var fs_extra=require(_0xb7b4('0x9'));var _=require('lodash');var squel=require(_0xb7b4('0xa'));var crypto=require('crypto');var jsforce=require(_0xb7b4('0xb'));var deskjs=require(_0xb7b4('0xc'));var toCsv=require(_0xb7b4('0x7'));var querystring=require(_0xb7b4('0xd'));var Papa=require(_0xb7b4('0xe'));var Redis=require(_0xb7b4('0xf'));var authService=require(_0xb7b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7b4('0x12'));var utils=require(_0xb7b4('0x13'));var config=require(_0xb7b4('0x14'));var licenseUtil=require(_0xb7b4('0x15'));var db=require(_0xb7b4('0x16'))['db'];config[_0xb7b4('0x17')]=_['defaults'](config[_0xb7b4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7b4('0x18'))(new Redis(config[_0xb7b4('0x17')]));require('./chatGroup.socket')[_0xb7b4('0x19')](socket);function respondWithStatusCode(_0x2cbed4,_0x3fb267){_0x3fb267=_0x3fb267||0xcc;return function(_0x14f4de){if(_0x14f4de){return _0x2cbed4[_0xb7b4('0x1a')](_0x3fb267);}return _0x2cbed4[_0xb7b4('0x1b')](_0x3fb267)[_0xb7b4('0x1c')]();};}function respondWithResult(_0x4d70a9,_0x27ebad){_0x27ebad=_0x27ebad||0xc8;return function(_0x1064d0){if(_0x1064d0){return _0x4d70a9[_0xb7b4('0x1b')](_0x27ebad)[_0xb7b4('0x1d')](_0x1064d0);}};}function respondWithFilteredResult(_0x2fe1b6,_0x2eb336){return function(_0x1daaa8){if(_0x1daaa8){var _0x321917=typeof _0x2eb336[_0xb7b4('0x1e')]===_0xb7b4('0x1f')&&typeof _0x2eb336[_0xb7b4('0x20')]===_0xb7b4('0x1f');var _0x707168=_0x1daaa8['count'];var _0x484de4=_0x321917?0x0:_0x2eb336[_0xb7b4('0x1e')];var _0xfe6849=_0x321917?_0x1daaa8[_0xb7b4('0x21')]:_0x2eb336['offset']+_0x2eb336['limit'];var _0x427fb7;if(_0xfe6849>=_0x707168){_0xfe6849=_0x707168;_0x427fb7=0xc8;}else{_0x427fb7=0xce;}_0x2fe1b6['status'](_0x427fb7);return _0x2fe1b6[_0xb7b4('0x22')](_0xb7b4('0x23'),_0x484de4+'-'+_0xfe6849+'/'+_0x707168)['json'](_0x1daaa8);}return null;};}function patchUpdates(_0x51cfd1){return function(_0x1fd025){try{jsonpatch[_0xb7b4('0x24')](_0x1fd025,_0x51cfd1,!![]);}catch(_0x2c33cf){return BPromise[_0xb7b4('0x25')](_0x2c33cf);}return _0x1fd025[_0xb7b4('0x26')]();};}function saveUpdates(_0x23c38b,_0x45555b){return function(_0x34c8e2){if(_0x34c8e2){return _0x34c8e2[_0xb7b4('0x27')](_0x23c38b)[_0xb7b4('0x28')](function(_0x3d8af7){return _0x3d8af7;});}return null;};}function removeEntity(_0x2e0e99,_0x12ee93){return function(_0x5b6d5a){if(_0x5b6d5a){return _0x5b6d5a[_0xb7b4('0x29')]()[_0xb7b4('0x28')](function(){_0x2e0e99[_0xb7b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba8502,_0x4f7d5c){return function(_0x50e37c){if(!_0x50e37c){_0xba8502[_0xb7b4('0x1a')](0x194);}return _0x50e37c;};}function handleError(_0xfd7c76,_0x14c7c1){_0x14c7c1=_0x14c7c1||0x1f4;return function(_0x6e39b6){logger[_0xb7b4('0x2a')](_0x6e39b6['stack']);if(_0x6e39b6[_0xb7b4('0x2b')]){delete _0x6e39b6[_0xb7b4('0x2b')];}_0xfd7c76[_0xb7b4('0x1b')](_0x14c7c1)[_0xb7b4('0x2c')](_0x6e39b6);};}exports[_0xb7b4('0x2d')]=function(_0x5dd56f,_0x11cbdb){var _0x46a0a9={},_0x2350cf={},_0x2b9798={'count':0x0,'rows':[]};var _0x2ab287=_[_0xb7b4('0x2e')](db[_0xb7b4('0x2f')][_0xb7b4('0x30')],function(_0x42a2a1){return{'name':_0x42a2a1['fieldName'],'type':_0x42a2a1[_0xb7b4('0x31')][_0xb7b4('0x32')]};});_0x2350cf[_0xb7b4('0x33')]=_['map'](_0x2ab287,_0xb7b4('0x2b'));_0x2350cf[_0xb7b4('0x34')]=_[_0xb7b4('0x35')](_0x5dd56f[_0xb7b4('0x34')]);_0x2350cf['filters']=_[_0xb7b4('0x36')](_0x2350cf['model'],_0x2350cf[_0xb7b4('0x34')]);_0x46a0a9[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x2350cf[_0xb7b4('0x33')],qs['fields'](_0x5dd56f[_0xb7b4('0x34')]['fields']));_0x46a0a9['attributes']=_0x46a0a9['attributes']['length']?_0x46a0a9['attributes']:_0x2350cf[_0xb7b4('0x33')];if(!_0x5dd56f[_0xb7b4('0x34')]['hasOwnProperty'](_0xb7b4('0x38'))){_0x46a0a9[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0x5dd56f['query'][_0xb7b4('0x20')]);_0x46a0a9[_0xb7b4('0x1e')]=qs['offset'](_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x1e')]);}_0x46a0a9[_0xb7b4('0x39')]=qs['sort'](_0x5dd56f['query'][_0xb7b4('0x3a')]);_0x46a0a9['where']=qs[_0xb7b4('0x3b')](_['pick'](_0x5dd56f[_0xb7b4('0x34')],_0x2350cf[_0xb7b4('0x3b')]),_0x2ab287);if(_0x5dd56f['query'][_0xb7b4('0x3c')]){_0x46a0a9[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x46a0a9[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x2ab287,function(_0x365f31){if(_0x365f31[_0xb7b4('0x31')]!==_0xb7b4('0x3f')){var _0x50a47f={};_0x50a47f[_0x365f31['name']]={'$like':'%'+_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x3c')]+'%'};return _0x50a47f;}})});}_0x46a0a9=_[_0xb7b4('0x3e')]({},_0x46a0a9,_0x5dd56f['options']);var _0xf59747={'where':_0x46a0a9[_0xb7b4('0x3d')]};return db[_0xb7b4('0x2f')][_0xb7b4('0x21')](_0xf59747)['then'](function(_0x1abde1){_0x2b9798[_0xb7b4('0x21')]=_0x1abde1;if(_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x40')]){_0x46a0a9[_0xb7b4('0x41')]=[{'all':!![]}];}return db[_0xb7b4('0x2f')][_0xb7b4('0x42')](_0x46a0a9);})[_0xb7b4('0x28')](function(_0xd1e414){_0x2b9798['rows']=_0xd1e414;return _0x2b9798;})[_0xb7b4('0x28')](respondWithFilteredResult(_0x11cbdb,_0x46a0a9))['catch'](handleError(_0x11cbdb,null));};exports['show']=function(_0x579826,_0xc1652){var _0x594a02={'raw':!![],'where':{'id':_0x579826[_0xb7b4('0x43')]['id']}},_0x235455={};_0x235455[_0xb7b4('0x33')]=_['keys'](db[_0xb7b4('0x2f')][_0xb7b4('0x30')]);_0x235455[_0xb7b4('0x34')]=_['keys'](_0x579826[_0xb7b4('0x34')]);_0x235455[_0xb7b4('0x3b')]=_['intersection'](_0x235455[_0xb7b4('0x33')],_0x235455[_0xb7b4('0x34')]);_0x594a02['attributes']=_[_0xb7b4('0x36')](_0x235455[_0xb7b4('0x33')],qs[_0xb7b4('0x44')](_0x579826['query']['fields']));_0x594a02[_0xb7b4('0x37')]=_0x594a02[_0xb7b4('0x37')][_0xb7b4('0x45')]?_0x594a02[_0xb7b4('0x37')]:_0x235455['model'];if(_0x579826[_0xb7b4('0x34')][_0xb7b4('0x40')]){_0x594a02[_0xb7b4('0x41')]=[{'all':!![]}];}_0x594a02=_['merge']({},_0x594a02,_0x579826['options']);return db['ChatGroup'][_0xb7b4('0x46')](_0x594a02)[_0xb7b4('0x28')](handleEntityNotFound(_0xc1652,null))[_0xb7b4('0x28')](respondWithResult(_0xc1652,null))[_0xb7b4('0x47')](handleError(_0xc1652,null));};exports[_0xb7b4('0x48')]=function(_0x33cfd8,_0x4db448){return db[_0xb7b4('0x2f')]['create'](_0x33cfd8['body'],{})[_0xb7b4('0x28')](respondWithResult(_0x4db448,0xc9))[_0xb7b4('0x47')](handleError(_0x4db448,null));};exports[_0xb7b4('0x27')]=function(_0x46235b,_0x12a505){if(_0x46235b[_0xb7b4('0x49')]['id']){delete _0x46235b[_0xb7b4('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x46235b['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x12a505,null))[_0xb7b4('0x28')](saveUpdates(_0x46235b[_0xb7b4('0x49')],null))[_0xb7b4('0x28')](respondWithResult(_0x12a505,null))[_0xb7b4('0x47')](handleError(_0x12a505,null));};exports[_0xb7b4('0x29')]=function(_0x1b9a9c,_0x38c20c){return db['ChatGroup']['find']({'where':{'id':_0x1b9a9c[_0xb7b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x38c20c,null))[_0xb7b4('0x28')](removeEntity(_0x38c20c,null))['catch'](handleError(_0x38c20c,null));};exports['describe']=function(_0x3277a6,_0xf96752){return db['ChatGroup']['describe']()[_0xb7b4('0x28')](respondWithResult(_0xf96752,null))[_0xb7b4('0x47')](handleError(_0xf96752,null));};exports[_0xb7b4('0x4a')]=function(_0x20b864,_0x54dce6,_0x1134ff){return db[_0xb7b4('0x4b')][_0xb7b4('0x21')]({'where':{'ChatGroupId':_0x20b864[_0xb7b4('0x43')]['id'],'ToId':_0x20b864[_0xb7b4('0x4c')]['id'],'read':![]}})[_0xb7b4('0x28')](function(_0x18f4ee){return{'id':_['toInteger'](_0x20b864[_0xb7b4('0x43')]['id']),'count':_0x18f4ee};})['then'](respondWithResult(_0x54dce6,null))['catch'](handleError(_0x54dce6,null));};exports['addMembers']=function(_0x1b0633,_0x245a52,_0x44edcc){return db[_0xb7b4('0x2f')][_0xb7b4('0x46')]({'where':{'id':_0x1b0633[_0xb7b4('0x43')]['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x245a52,null))[_0xb7b4('0x28')](function(_0x558c0d){if(_0x558c0d){return _0x558c0d[_0xb7b4('0x4d')](_0x1b0633[_0xb7b4('0x49')][_0xb7b4('0x4e')],_[_0xb7b4('0x4f')](_0x1b0633[_0xb7b4('0x49')],[_0xb7b4('0x4e'),'id'])||{});}})[_0xb7b4('0x28')](respondWithResult(_0x245a52,null))[_0xb7b4('0x47')](handleError(_0x245a52,null));};exports[_0xb7b4('0x50')]=function(_0xf65a67,_0x2616ce,_0x4a1101){var _0x1f9917={};var _0x31eb25={};var _0x26017b;var _0xec4c98;return db[_0xb7b4('0x2f')][_0xb7b4('0x51')]({'where':{'id':_0xf65a67[_0xb7b4('0x43')]['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x2616ce,null))[_0xb7b4('0x28')](function(_0x3039e2){if(_0x3039e2){_0x26017b=_0x3039e2;_0x31eb25[_0xb7b4('0x33')]=_[_0xb7b4('0x35')](db[_0xb7b4('0x52')]['rawAttributes']);_0x31eb25['query']=_[_0xb7b4('0x35')](_0xf65a67['query']);_0x31eb25[_0xb7b4('0x3b')]=_[_0xb7b4('0x36')](_0x31eb25[_0xb7b4('0x33')],_0x31eb25[_0xb7b4('0x34')]);_0x1f9917[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x31eb25[_0xb7b4('0x33')],qs[_0xb7b4('0x44')](_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x44')]));_0x1f9917[_0xb7b4('0x37')]=_0x1f9917[_0xb7b4('0x37')][_0xb7b4('0x45')]?_0x1f9917['attributes']:_0x31eb25[_0xb7b4('0x33')];_0x1f9917[_0xb7b4('0x39')]=qs[_0xb7b4('0x3a')](_0xf65a67['query'][_0xb7b4('0x3a')]);_0x1f9917[_0xb7b4('0x3d')]=qs['filters'](_[_0xb7b4('0x53')](_0xf65a67[_0xb7b4('0x34')],_0x31eb25['filters']));if(_0xf65a67[_0xb7b4('0x34')]['filter']){_0x1f9917['where']=_[_0xb7b4('0x3e')](_0x1f9917[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x1f9917[_0xb7b4('0x37')],function(_0x518ef5){var _0x4c54a5={};_0x4c54a5[_0x518ef5]={'$like':'%'+_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x3c')]+'%'};return _0x4c54a5;})});}_0x1f9917=_[_0xb7b4('0x3e')]({},_0x1f9917,_0xf65a67[_0xb7b4('0x54')]);return _0x26017b[_0xb7b4('0x50')](_0x1f9917);}})[_0xb7b4('0x28')](function(_0x55553e){if(_0x55553e){_0xec4c98=_0x55553e[_0xb7b4('0x45')];if(!_0xf65a67[_0xb7b4('0x34')]['hasOwnProperty']('nolimit')){_0x1f9917[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x20')]);_0x1f9917['offset']=qs[_0xb7b4('0x1e')](_0xf65a67['query'][_0xb7b4('0x1e')]);}return _0x26017b[_0xb7b4('0x50')](_0x1f9917);}})[_0xb7b4('0x28')](function(_0xab212d){if(_0xab212d){return _0xab212d?{'count':_0xec4c98,'rows':_0xab212d}:null;}})[_0xb7b4('0x28')](respondWithResult(_0x2616ce,null))[_0xb7b4('0x47')](handleError(_0x2616ce,null));};exports[_0xb7b4('0x55')]=function(_0x3cfdb3,_0x396892,_0x2baf50){return db[_0xb7b4('0x2f')][_0xb7b4('0x46')]({'where':{'id':_0x3cfdb3['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x396892,null))[_0xb7b4('0x28')](function(_0x55a054){if(_0x55a054){return _0x55a054[_0xb7b4('0x55')](_0x3cfdb3[_0xb7b4('0x34')][_0xb7b4('0x4e')]);}})[_0xb7b4('0x28')](respondWithStatusCode(_0x396892,null))['catch'](handleError(_0x396892,null));};exports[_0xb7b4('0x56')]=function(_0x5aca2b,_0x3477e0,_0x109ae8){if(_0x5aca2b[_0xb7b4('0x49')]['id']){delete _0x5aca2b[_0xb7b4('0x49')]['id'];}return db['ChatGroup'][_0xb7b4('0x46')]({'where':{'id':_0x5aca2b['params']['id']}})['then'](handleEntityNotFound(_0x3477e0,null))[_0xb7b4('0x28')](function(_0x4599d7){if(_0x4599d7){_0x5aca2b[_0xb7b4('0x49')]['ChatGroupId']=_0x4599d7['id'];return db[_0xb7b4('0x4b')][_0xb7b4('0x48')](_0x5aca2b[_0xb7b4('0x49')]);}})[_0xb7b4('0x28')](respondWithResult(_0x3477e0,null))[_0xb7b4('0x47')](handleError(_0x3477e0,null));};exports[_0xb7b4('0x57')]=function(_0x1aeb63,_0x3afbce,_0x2d7693){var _0x20dcaa={};var _0x3632d1={};var _0x5b5748;var _0x185170;return db[_0xb7b4('0x2f')][_0xb7b4('0x51')]({'where':{'id':_0x1aeb63['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x3afbce,null))[_0xb7b4('0x28')](function(_0x2f5892){if(_0x2f5892){_0x5b5748=_0x2f5892;_0x3632d1['model']=_['keys'](db[_0xb7b4('0x4b')][_0xb7b4('0x30')]);_0x3632d1[_0xb7b4('0x34')]=_['keys'](_0x1aeb63[_0xb7b4('0x34')]);_0x3632d1[_0xb7b4('0x3b')]=_[_0xb7b4('0x36')](_0x3632d1['model'],_0x3632d1[_0xb7b4('0x34')]);_0x20dcaa[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x3632d1['model'],qs[_0xb7b4('0x44')](_0x1aeb63[_0xb7b4('0x34')]['fields']));_0x20dcaa[_0xb7b4('0x37')]=_0x20dcaa['attributes'][_0xb7b4('0x45')]?_0x20dcaa['attributes']:_0x3632d1[_0xb7b4('0x33')];_0x20dcaa[_0xb7b4('0x39')]=qs[_0xb7b4('0x3a')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x3a')]);_0x20dcaa[_0xb7b4('0x3d')]=qs[_0xb7b4('0x3b')](_[_0xb7b4('0x53')](_0x1aeb63[_0xb7b4('0x34')],_0x3632d1[_0xb7b4('0x3b')]));if(_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x3c')]){_0x20dcaa[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x20dcaa[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x20dcaa['attributes'],function(_0x235fc6){var _0x46b99a={};_0x46b99a[_0x235fc6]={'$like':'%'+_0x1aeb63[_0xb7b4('0x34')]['filter']+'%'};return _0x46b99a;})});}if(_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x58')]){var _0x2616fd=_0x1aeb63['query'][_0xb7b4('0x58')]['split'](',');var _0x886b41={};_0x886b41[_0x2616fd[0x0]]={'$gte':moment(_0x2616fd[0x1])[_0xb7b4('0x59')](_0xb7b4('0x5a'))};_0x20dcaa[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x20dcaa[_0xb7b4('0x3d')],_0x886b41);}_0x20dcaa=_[_0xb7b4('0x3e')]({},_0x20dcaa,_0x1aeb63[_0xb7b4('0x54')]);return _0x5b5748[_0xb7b4('0x57')](_0x20dcaa);}})[_0xb7b4('0x28')](function(_0x786b72){if(_0x786b72){_0x185170=_0x786b72['length'];if(!_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x5b')](_0xb7b4('0x38'))){_0x20dcaa[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x20')]);_0x20dcaa[_0xb7b4('0x1e')]=qs[_0xb7b4('0x1e')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x1e')]);}return _0x5b5748[_0xb7b4('0x57')](_0x20dcaa);}})[_0xb7b4('0x28')](function(_0x4b99a9){if(_0x4b99a9){return _0x4b99a9?{'count':_0x185170,'rows':_0x4b99a9}:null;}})[_0xb7b4('0x28')](respondWithResult(_0x3afbce,null))[_0xb7b4('0x47')](handleError(_0x3afbce,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 76040da..f68cb39 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 _0x9b25=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save'];(function(_0x55a8a0,_0x313c62){var _0x581017=function(_0x5cf328){while(--_0x5cf328){_0x55a8a0['push'](_0x55a8a0['shift']());}};_0x581017(++_0x313c62);}(_0x9b25,0x1be));var _0x59b2=function(_0x394d5a,_0x23c990){_0x394d5a=_0x394d5a-0x0;var _0x281461=_0x9b25[_0x394d5a];return _0x281461;};'use strict';var EventEmitter=require(_0x59b2('0x0'));var ChatGroup=require(_0x59b2('0x1'))['db'][_0x59b2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59b2('0x3'),'afterUpdate':_0x59b2('0x4'),'afterDestroy':_0x59b2('0x5')};function emitEvent(_0x459769){return function(_0x72ea4a,_0x48e4ca,_0x4dd11d){ChatGroupEvents[_0x59b2('0x6')](_0x459769+':'+_0x72ea4a['id'],_0x72ea4a);ChatGroupEvents[_0x59b2('0x6')](_0x459769,_0x72ea4a);_0x4dd11d(null);};}for(var e in events){if(events[_0x59b2('0x7')](e)){var event=events[e];ChatGroup[_0x59b2('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x22a7=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4a8e2d,_0x4aefc9){var _0x11bc28=function(_0x17b594){while(--_0x17b594){_0x4a8e2d['push'](_0x4a8e2d['shift']());}};_0x11bc28(++_0x4aefc9);}(_0x22a7,0xe4));var _0x722a=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x22a7[_0x1911ed];return _0x11edaa;};'use strict';var EventEmitter=require(_0x722a('0x0'));var ChatGroup=require(_0x722a('0x1'))['db'][_0x722a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x722a('0x3')](0x0);var events={'afterCreate':_0x722a('0x4'),'afterUpdate':_0x722a('0x5'),'afterDestroy':_0x722a('0x6')};function emitEvent(_0x43a0f5){return function(_0x464d07,_0x462040,_0x2b51f3){ChatGroupEvents['emit'](_0x43a0f5+':'+_0x464d07['id'],_0x464d07);ChatGroupEvents[_0x722a('0x7')](_0x43a0f5,_0x464d07);_0x2b51f3(null);};}for(var e in events){if(events[_0x722a('0x8')](e)){var event=events[e];ChatGroup[_0x722a('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 17919f2..dfd2bd3 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 _0x0044=['ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x5f2c4f,_0x413414){var _0x498c51=function(_0x3fb596){while(--_0x3fb596){_0x5f2c4f['push'](_0x5f2c4f['shift']());}};_0x498c51(++_0x413414);}(_0x0044,0x12a));var _0x4004=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0044[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var logger=require(_0x4004('0x2'))(_0x4004('0x3'));var moment=require(_0x4004('0x4'));var BPromise=require(_0x4004('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4004('0x6'));var rimraf=require('rimraf');var config=require(_0x4004('0x7'));var attributes=require('./chatGroup.attributes');module[_0x4004('0x8')]=function(_0x3d6186,_0x1d85a7){return _0x3d6186[_0x4004('0x9')](_0x4004('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb92d=['path','rimraf','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb92d,0xa1));var _0xdb92=function(_0x4fb9ed,_0x187ea0){_0x4fb9ed=_0x4fb9ed-0x0;var _0x263645=_0xb92d[_0x4fb9ed];return _0x263645;};'use strict';var _=require(_0xdb92('0x0'));var util=require(_0xdb92('0x1'));var logger=require(_0xdb92('0x2'))(_0xdb92('0x3'));var moment=require(_0xdb92('0x4'));var BPromise=require(_0xdb92('0x5'));var rp=require(_0xdb92('0x6'));var fs=require('fs');var path=require(_0xdb92('0x7'));var rimraf=require(_0xdb92('0x8'));var config=require('../../config/environment');var attributes=require(_0xdb92('0x9'));module['exports']=function(_0xf77bdd,_0x2ed444){return _0xf77bdd['define'](_0xdb92('0xa'),attributes,{'tableName':_0xdb92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3c2e399..0ca96ee 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 _0xacc8=['request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x182093,_0x19eca5){var _0x180469=function(_0x3ec641){while(--_0x3ec641){_0x182093['push'](_0x182093['shift']());}};_0x180469(++_0x19eca5);}(_0xacc8,0xc5));var _0x8acc=function(_0x5c8440,_0x262351){_0x5c8440=_0x5c8440-0x0;var _0x301008=_0xacc8[_0x5c8440];return _0x301008;};'use strict';var _=require(_0x8acc('0x0'));var util=require('util');var moment=require(_0x8acc('0x1'));var BPromise=require(_0x8acc('0x2'));var rs=require(_0x8acc('0x3'));var fs=require('fs');var Redis=require(_0x8acc('0x4'));var db=require(_0x8acc('0x5'))['db'];var utils=require(_0x8acc('0x6'));var logger=require('../../config/logger')(_0x8acc('0x7'));var config=require(_0x8acc('0x8'));var jayson=require(_0x8acc('0x9'));var client=jayson['client'][_0x8acc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8acc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8acc('0xc'))(new Redis(config['redis']));require(_0x8acc('0xd'))[_0x8acc('0xe')](socket);function respondWithRpcPromise(_0x5a7185,_0x3fd766,_0x1c0d87){return new BPromise(function(_0x3669fb,_0x2bf3ad){return client[_0x8acc('0xf')](_0x5a7185,_0x1c0d87)[_0x8acc('0x10')](function(_0x390080){logger[_0x8acc('0x11')](_0x8acc('0x12'),_0x3fd766,_0x8acc('0x13'));logger[_0x8acc('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3fd766,_0x8acc('0x13'),JSON['stringify'](_0x390080));if(_0x390080[_0x8acc('0x15')]){if(_0x390080[_0x8acc('0x15')]['code']===0x1f4){logger[_0x8acc('0x15')]('ChatGroup,\x20%s,\x20%s',_0x3fd766,_0x390080[_0x8acc('0x15')][_0x8acc('0x16')]);return _0x2bf3ad(_0x390080['error'][_0x8acc('0x16')]);}logger[_0x8acc('0x15')](_0x8acc('0x12'),_0x3fd766,_0x390080['error'][_0x8acc('0x16')]);return _0x3669fb(_0x390080[_0x8acc('0x15')][_0x8acc('0x16')]);}else{logger[_0x8acc('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3fd766,_0x8acc('0x13'));_0x3669fb(_0x390080['result']['message']);}})[_0x8acc('0x17')](function(_0x5c9f47){logger['error'](_0x8acc('0x12'),_0x3fd766,_0x5c9f47);_0x2bf3ad(_0x5c9f47);});});} \ No newline at end of file +var _0x5a52=['code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35eaf7,_0xe9b5ef){var _0x1ecb45=function(_0x289852){while(--_0x289852){_0x35eaf7['push'](_0x35eaf7['shift']());}};_0x1ecb45(++_0xe9b5ef);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25a5('0x1'));var fs=require('fs');var Redis=require(_0x25a5('0x2'));var db=require(_0x25a5('0x3'))['db'];var utils=require(_0x25a5('0x4'));var logger=require(_0x25a5('0x5'))(_0x25a5('0x6'));var config=require(_0x25a5('0x7'));var jayson=require(_0x25a5('0x8'));var client=jayson['client'][_0x25a5('0x9')]({'port':0x232a});config['redis']=_[_0x25a5('0xa')](config[_0x25a5('0xb')],{'host':_0x25a5('0xc'),'port':0x18eb});var socket=require(_0x25a5('0xd'))(new Redis(config[_0x25a5('0xb')]));require(_0x25a5('0xe'))['register'](socket);function respondWithRpcPromise(_0x4dcda5,_0x428795,_0x304a26){return new BPromise(function(_0x107e85,_0x2a6e38){return client[_0x25a5('0xf')](_0x4dcda5,_0x304a26)[_0x25a5('0x10')](function(_0x1610b8){logger[_0x25a5('0x11')]('ChatGroup,\x20%s,\x20%s',_0x428795,_0x25a5('0x12'));logger[_0x25a5('0x13')](_0x25a5('0x14'),_0x428795,'request\x20sent',JSON[_0x25a5('0x15')](_0x1610b8));if(_0x1610b8['error']){if(_0x1610b8[_0x25a5('0x16')][_0x25a5('0x17')]===0x1f4){logger[_0x25a5('0x16')]('ChatGroup,\x20%s,\x20%s',_0x428795,_0x1610b8['error'][_0x25a5('0x18')]);return _0x2a6e38(_0x1610b8['error'][_0x25a5('0x18')]);}logger[_0x25a5('0x16')](_0x25a5('0x19'),_0x428795,_0x1610b8[_0x25a5('0x16')]['message']);return _0x107e85(_0x1610b8[_0x25a5('0x16')]['message']);}else{logger['info'](_0x25a5('0x19'),_0x428795,_0x25a5('0x12'));_0x107e85(_0x1610b8[_0x25a5('0x1a')][_0x25a5('0x18')]);}})[_0x25a5('0x1b')](function(_0x54987f){logger['error'](_0x25a5('0x19'),_0x428795,_0x54987f);_0x2a6e38(_0x54987f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0ff4292..e243f53 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 _0xe240=['emit','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x2d731f,_0x1a7db6){var _0x3bc2bf=function(_0x510010){while(--_0x510010){_0x2d731f['push'](_0x2d731f['shift']());}};_0x3bc2bf(++_0x1a7db6);}(_0xe240,0x135));var _0x0e24=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe240[_0x5c2e3e];return _0x53f64a;};'use strict';var ChatGroupEvents=require(_0x0e24('0x0'));var events=['save','remove','update'];function createListener(_0x4c5346,_0x1d68ea){return function(_0x2d3140){_0x1d68ea[_0x0e24('0x1')](_0x4c5346,_0x2d3140);};}function removeListener(_0x1f2955,_0x1e75ac){return function(){ChatGroupEvents[_0x0e24('0x2')](_0x1f2955,_0x1e75ac);};}exports['register']=function(_0x45ff05){for(var _0x464d74=0x0,_0x4a6690=events[_0x0e24('0x3')];_0x464d74<_0x4a6690;_0x464d74++){var _0x45f727=events[_0x464d74];var _0x106bee=createListener(_0x0e24('0x4')+_0x45f727,_0x45ff05);ChatGroupEvents['on'](_0x45f727,_0x106bee);}}; \ No newline at end of file +var _0x001d=['removeListener','register','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x1e2f5b,_0x60bf47){var _0x2bb7bc=function(_0x1ddf91){while(--_0x1ddf91){_0x1e2f5b['push'](_0x1e2f5b['shift']());}};_0x2bb7bc(++_0x60bf47);}(_0x001d,0x1d3));var _0xd001=function(_0x4054f7,_0x44b868){_0x4054f7=_0x4054f7-0x0;var _0x62b262=_0x001d[_0x4054f7];return _0x62b262;};'use strict';var ChatGroupEvents=require(_0xd001('0x0'));var events=[_0xd001('0x1'),_0xd001('0x2'),_0xd001('0x3')];function createListener(_0x2a0ee9,_0x30958b){return function(_0xa19fd4){_0x30958b[_0xd001('0x4')](_0x2a0ee9,_0xa19fd4);};}function removeListener(_0x16f820,_0x2fd4c6){return function(){ChatGroupEvents[_0xd001('0x5')](_0x16f820,_0x2fd4c6);};}exports[_0xd001('0x6')]=function(_0x1bd914){for(var _0x553afb=0x0,_0x4db95c=events['length'];_0x553afb<_0x4db95c;_0x553afb++){var _0x58335b=events[_0x553afb];var _0x194f3d=createListener(_0xd001('0x7')+_0x58335b,_0x1bd914);ChatGroupEvents['on'](_0x58335b,_0x194f3d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index afa761e..4175eec 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 _0xd1b8=['/:id/members','getMembers','/:id/messages','post','create','put','update','delete','destroy','removeMembers','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','/:id/unread','getUnread'];(function(_0xa4098e,_0x4c9e5c){var _0xeeffcb=function(_0x42b2ac){while(--_0x42b2ac){_0xa4098e['push'](_0xa4098e['shift']());}};_0xeeffcb(++_0x4c9e5c);}(_0xd1b8,0x1a8));var _0x8d1b=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xd1b8[_0x4de586];return _0x46baf5;};'use strict';var multer=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var path=require('path');var timeout=require(_0x8d1b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d1b('0x3'));var interaction=require(_0x8d1b('0x4'));var config=require(_0x8d1b('0x5'));var controller=require(_0x8d1b('0x6'));router[_0x8d1b('0x7')]('/',auth[_0x8d1b('0x8')](),controller['index']);router[_0x8d1b('0x7')]('/describe',auth[_0x8d1b('0x8')](),controller['describe']);router[_0x8d1b('0x7')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0xa')]);router[_0x8d1b('0x7')](_0x8d1b('0xb'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0xc')]);router[_0x8d1b('0x7')](_0x8d1b('0xd'),auth['isAuthenticated'](),controller[_0x8d1b('0xe')]);router['get'](_0x8d1b('0xf'),auth[_0x8d1b('0x8')](),controller['getMessages']);router[_0x8d1b('0x10')]('/',auth['isAuthenticated'](),controller[_0x8d1b('0x11')]);router[_0x8d1b('0x10')](_0x8d1b('0xd'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0x8d1b('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8d1b('0x12')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x13')]);router[_0x8d1b('0x14')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x15')]);router[_0x8d1b('0x14')](_0x8d1b('0xd'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6db0=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy'];(function(_0x1c6e46,_0x173536){var _0x236239=function(_0x6a5894){while(--_0x6a5894){_0x1c6e46['push'](_0x1c6e46['shift']());}};_0x236239(++_0x173536);}(_0x6db0,0x12a));var _0x06db=function(_0x2daf14,_0x2ec184){_0x2daf14=_0x2daf14-0x0;var _0x2aa029=_0x6db0[_0x2daf14];return _0x2aa029;};'use strict';var multer=require('multer');var util=require(_0x06db('0x0'));var path=require(_0x06db('0x1'));var timeout=require(_0x06db('0x2'));var express=require(_0x06db('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06db('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x06db('0x5'));var controller=require(_0x06db('0x6'));router[_0x06db('0x7')]('/',auth[_0x06db('0x8')](),controller[_0x06db('0x9')]);router[_0x06db('0x7')](_0x06db('0xa'),auth['isAuthenticated'](),controller[_0x06db('0xb')]);router[_0x06db('0x7')](_0x06db('0xc'),auth['isAuthenticated'](),controller[_0x06db('0xd')]);router[_0x06db('0x7')](_0x06db('0xe'),auth[_0x06db('0x8')](),controller[_0x06db('0xf')]);router[_0x06db('0x7')](_0x06db('0x10'),auth[_0x06db('0x8')](),controller['getMembers']);router[_0x06db('0x7')]('/:id/messages',auth[_0x06db('0x8')](),controller[_0x06db('0x11')]);router[_0x06db('0x12')]('/',auth[_0x06db('0x8')](),controller[_0x06db('0x13')]);router[_0x06db('0x12')]('/:id/members',auth[_0x06db('0x8')](),controller[_0x06db('0x14')]);router[_0x06db('0x12')]('/:id/messages',auth[_0x06db('0x8')](),controller[_0x06db('0x15')]);router[_0x06db('0x16')](_0x06db('0xc'),auth[_0x06db('0x8')](),controller[_0x06db('0x17')]);router[_0x06db('0x18')](_0x06db('0xc'),auth['isAuthenticated'](),controller[_0x06db('0x19')]);router[_0x06db('0x18')](_0x06db('0x10'),auth[_0x06db('0x8')](),controller['removeMembers']);module[_0x06db('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ffb5e13..c443495 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 _0x8fe4=['out','INTEGER','sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','long','ENUM'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8fe4,0x14c));var _0x48fe=function(_0x35cd06,_0x577a99){_0x35cd06=_0x35cd06-0x0;var _0x5c4f34=_0x8fe4[_0x35cd06];return _0x5c4f34;};'use strict';var Sequelize=require(_0x48fe('0x0'));module[_0x48fe('0x1')]={'closed':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x48fe('0x3'),'thumb'),'defaultValue':_0x48fe('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x48fe('0x4')]},'mailTranscript':{'type':Sequelize[_0x48fe('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x48fe('0x6')]},'disposition':{'type':Sequelize[_0x48fe('0x5')]},'secondDisposition':{'type':Sequelize[_0x48fe('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x48fe('0x5')]},'browserName':{'type':Sequelize[_0x48fe('0x5')]},'browserVersion':{'type':Sequelize[_0x48fe('0x5')]},'osName':{'type':Sequelize[_0x48fe('0x5')]},'osVersion':{'type':Sequelize[_0x48fe('0x5')]},'deviceModel':{'type':Sequelize[_0x48fe('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x48fe('0x5')]},'referer':{'type':Sequelize[_0x48fe('0x4')]},'customerIp':{'type':Sequelize[_0x48fe('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x48fe('0x7'))},'read1stAt':{'type':Sequelize[_0x48fe('0x6')]},'lastMsgAt':{'type':Sequelize[_0x48fe('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x48fe('0x8')]('in',_0x48fe('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x48fe('0x5')]},'customerPort':{'type':Sequelize[_0x48fe('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x48fe('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x48fe('0xa')]}}; \ No newline at end of file +var _0x28b7=['sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','ENUM','out'];(function(_0x1cd43e,_0x3c9426){var _0x2d32fa=function(_0x2c22b4){while(--_0x2c22b4){_0x1cd43e['push'](_0x1cd43e['shift']());}};_0x2d32fa(++_0x3c9426);}(_0x28b7,0x1dd));var _0x728b=function(_0x4a3baa,_0x19cb30){_0x4a3baa=_0x4a3baa-0x0;var _0x1e8aef=_0x28b7[_0x4a3baa];return _0x1e8aef;};'use strict';var Sequelize=require(_0x728b('0x0'));module[_0x728b('0x1')]={'closed':{'type':Sequelize[_0x728b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x728b('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x728b('0x4')]},'mailTranscript':{'type':Sequelize[_0x728b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x728b('0x6')]},'disposition':{'type':Sequelize[_0x728b('0x5')]},'secondDisposition':{'type':Sequelize[_0x728b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x728b('0x5')]},'note':{'type':Sequelize[_0x728b('0x5')]},'browserName':{'type':Sequelize[_0x728b('0x5')]},'browserVersion':{'type':Sequelize[_0x728b('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x728b('0x5')]},'deviceModel':{'type':Sequelize[_0x728b('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x728b('0x5')]},'referer':{'type':Sequelize[_0x728b('0x4')]},'customerIp':{'type':Sequelize[_0x728b('0x5')]},'formData':{'type':Sequelize[_0x728b('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x728b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x728b('0x7')]('in',_0x728b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x728b('0x5')]},'customerPort':{'type':Sequelize[_0x728b('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x728b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e06125d..85abb50 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 _0xa802=['mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','order','sort','where','ChatInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','hasOwnProperty','secret','includeAgent','alias','findAll','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','tmp','server','files','attachments','transcript-%d-%s.zip','push','direction','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','Contact','firstName','lastName','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','bluebird','mustache','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','stack','name','render','body','contact','agent','interaction','account','index','map','ChatInteraction','type','key','getOptions','query','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','find','create','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','attachmentUpload','file','originalname','basename'];(function(_0x342ebe,_0x459563){var _0x2898af=function(_0x4bf08d){while(--_0x4bf08d){_0x342ebe['push'](_0x342ebe['shift']());}};_0x2898af(++_0x459563);}(_0xa802,0x67));var _0x2a80=function(_0x18dfcf,_0x4709ca){_0x18dfcf=_0x18dfcf-0x0;var _0x422850=_0xa802[_0x18dfcf];return _0x422850;};'use strict';var rimraf=require(_0x2a80('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a80('0x1'));var Mustache=require(_0x2a80('0x2'));var util=require(_0x2a80('0x3'));var path=require(_0x2a80('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a80('0x5'));var Redis=require(_0x2a80('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x2a80('0x7'));var pdf=require(_0x2a80('0x8'));var logger=require(_0x2a80('0x9'))('api');var config=require(_0x2a80('0xa'));var db=require(_0x2a80('0xb'))['db'];config[_0x2a80('0xc')]=_[_0x2a80('0xd')](config['redis'],{'host':_0x2a80('0xe'),'port':0x18eb});var socket=require(_0x2a80('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2a80('0x10')](socket);var jayson=require(_0x2a80('0x11'));var client=jayson[_0x2a80('0x12')][_0x2a80('0x13')]({'port':0x232b});var client9004=jayson[_0x2a80('0x12')][_0x2a80('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x5819de,_0x3ade2c,_0x15b660,_0x56e43f){return new BPromise(function(_0xc17ce7,_0x449713){var _0x5d8f21=_0x56e43f||client;return _0x5d8f21[_0x2a80('0x14')](_0x5819de,_0x15b660)['then'](function(_0x1de562){logger[_0x2a80('0x15')](_0x2a80('0x16'),_0x3ade2c,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3ade2c,'request\x20sent',JSON[_0x2a80('0x17')](_0x1de562));if(_0x1de562['error']){if(_0x1de562[_0x2a80('0x18')][_0x2a80('0x19')]===0x1f4){logger[_0x2a80('0x18')](_0x2a80('0x16'),_0x3ade2c,_0x1de562['error'][_0x2a80('0x1a')]);return _0x449713(_0x1de562[_0x2a80('0x18')][_0x2a80('0x1a')]);}logger['error'](_0x2a80('0x16'),_0x3ade2c,_0x1de562['error']['message']);return _0xc17ce7(_0x1de562[_0x2a80('0x18')][_0x2a80('0x1a')]);}else{logger[_0x2a80('0x15')](_0x2a80('0x16'),_0x3ade2c,_0x2a80('0x1b'));_0xc17ce7(_0x1de562['result'][_0x2a80('0x1a')]);}})[_0x2a80('0x1c')](function(_0x20424b){logger[_0x2a80('0x18')](_0x2a80('0x16'),_0x3ade2c,_0x20424b);_0x449713(_0x20424b);});});}function respondWithStatusCode(_0x4f9185,_0x3a2d0e){_0x3a2d0e=_0x3a2d0e||0xcc;return function(_0x49c2c6){if(_0x49c2c6){return _0x4f9185[_0x2a80('0x1d')](_0x3a2d0e);}return _0x4f9185['status'](_0x3a2d0e)['end']();};}function respondWithResult(_0x16e922,_0x483f92){_0x483f92=_0x483f92||0xc8;return function(_0x39f2de){if(_0x39f2de){return _0x16e922[_0x2a80('0x1e')](_0x483f92)[_0x2a80('0x1f')](_0x39f2de);}};}function respondWithFilteredResult(_0x47bfb2,_0x2803e5){return function(_0xb4fdfa){if(_0xb4fdfa){var _0x15059d=typeof _0x2803e5[_0x2a80('0x20')]===_0x2a80('0x21')&&typeof _0x2803e5[_0x2a80('0x22')]==='undefined';var _0x2ef3b7=_0xb4fdfa['count'];var _0x5bfe69=_0x15059d?0x0:_0x2803e5[_0x2a80('0x20')];var _0x23c8a5=_0x15059d?_0xb4fdfa[_0x2a80('0x23')]:_0x2803e5[_0x2a80('0x20')]+_0x2803e5[_0x2a80('0x22')];var _0x1a4903;if(_0x23c8a5>=_0x2ef3b7){_0x23c8a5=_0x2ef3b7;_0x1a4903=0xc8;}else{_0x1a4903=0xce;}_0x47bfb2[_0x2a80('0x1e')](_0x1a4903);return _0x47bfb2[_0x2a80('0x24')](_0x2a80('0x25'),_0x5bfe69+'-'+_0x23c8a5+'/'+_0x2ef3b7)['json'](_0xb4fdfa);}return null;};}function saveUpdates(_0x58d46f){return function(_0x3ad276){if(_0x3ad276){return _0x3ad276[_0x2a80('0x26')](_0x58d46f)['then'](function(_0x1078c3){return _0x1078c3;});}return null;};}function removeEntity(_0x46c4b6){return function(_0xbde15a){if(_0xbde15a){return _0xbde15a[_0x2a80('0x27')]()[_0x2a80('0x28')](function(){_0x46c4b6[_0x2a80('0x1e')](0xcc)[_0x2a80('0x29')]();});}};}function handleEntityNotFound(_0x5afffb){return function(_0xf3b647){if(!_0xf3b647){_0x5afffb['sendStatus'](0x194);}return _0xf3b647;};}function handleError(_0x134638,_0x4ef250){_0x4ef250=_0x4ef250||0x1f4;return function(_0x136d71){logger['error'](_0x136d71[_0x2a80('0x2a')]);if(_0x136d71[_0x2a80('0x2b')]){delete _0x136d71[_0x2a80('0x2b')];}_0x134638[_0x2a80('0x1e')](_0x4ef250)['send'](_0x136d71);};}function getMustacheRender(_0xca47ac,_0x341d12){return Mustache[_0x2a80('0x2c')](_0xca47ac,_['merge'](_0x341d12[_0x2a80('0x2d')],{'contact':_0x341d12[_0x2a80('0x2e')],'message':_0x341d12[_0x2a80('0x1a')],'agent':_0x341d12[_0x2a80('0x2f')],'interaction':_0x341d12[_0x2a80('0x30')],'account':_0x341d12[_0x2a80('0x31')]}))||'';}exports[_0x2a80('0x32')]=function(_0x3ce1e6,_0x33115a){var _0x9edccb={};var _0x2f9a99=_[_0x2a80('0x33')](db[_0x2a80('0x34')]['rawAttributes'],function(_0x810e4a){return{'name':_0x810e4a['fieldName'],'type':_0x810e4a[_0x2a80('0x35')][_0x2a80('0x36')]};});_0x9edccb=qs[_0x2a80('0x37')](_0x2f9a99,_0x3ce1e6);return interaction['findAll']('chat',_0x3ce1e6[_0x2a80('0x38')],_0x3ce1e6['user'],_0x9edccb,_0x2f9a99)[_0x2a80('0x28')](respondWithFilteredResult(_0x33115a,_0x9edccb))[_0x2a80('0x1c')](handleError(_0x33115a,null));};exports[_0x2a80('0x39')]=function(_0x405982,_0xdb004f){var _0x18c957={'raw':![],'where':{'id':_0x405982['params']['id']}},_0x5e934b={};_0x5e934b[_0x2a80('0x3a')]=_[_0x2a80('0x3b')](db[_0x2a80('0x34')][_0x2a80('0x3c')]);_0x5e934b[_0x2a80('0x38')]=_[_0x2a80('0x3b')](_0x405982[_0x2a80('0x38')]);_0x5e934b[_0x2a80('0x3d')]=_[_0x2a80('0x3e')](_0x5e934b[_0x2a80('0x3a')],_0x5e934b[_0x2a80('0x38')]);_0x18c957[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x5e934b[_0x2a80('0x3a')],qs['fields'](_0x405982[_0x2a80('0x38')][_0x2a80('0x40')]));_0x18c957[_0x2a80('0x3f')]=_0x18c957[_0x2a80('0x3f')][_0x2a80('0x41')]?_0x18c957[_0x2a80('0x3f')]:_0x5e934b[_0x2a80('0x3a')];if(_0x405982[_0x2a80('0x38')][_0x2a80('0x42')]){_0x18c957['include']=[{'all':!![]}];}_0x18c957=_['merge']({},_0x18c957,_0x405982['options']);return db[_0x2a80('0x34')][_0x2a80('0x43')](_0x18c957)[_0x2a80('0x28')](handleEntityNotFound(_0xdb004f,null))['then'](respondWithResult(_0xdb004f,null))[_0x2a80('0x1c')](handleError(_0xdb004f,null));};exports[_0x2a80('0x44')]=function(_0x596960,_0x4a29a2){return db[_0x2a80('0x34')][_0x2a80('0x44')](_0x596960[_0x2a80('0x2d')],{})[_0x2a80('0x28')](respondWithResult(_0x4a29a2,0xc9))[_0x2a80('0x1c')](handleError(_0x4a29a2,null));};exports[_0x2a80('0x26')]=function(_0x1f4735,_0x166e60){if(_0x1f4735[_0x2a80('0x2d')]['id']){delete _0x1f4735['body']['id'];}return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x1f4735[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x166e60,null))[_0x2a80('0x28')](saveUpdates(_0x1f4735[_0x2a80('0x2d')],null))[_0x2a80('0x28')](respondWithResult(_0x166e60,null))[_0x2a80('0x1c')](handleError(_0x166e60,null));};exports[_0x2a80('0x27')]=function(_0x399513,_0x2380fe){return db[_0x2a80('0x34')]['find']({'where':{'id':_0x399513[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x2380fe,null))['then'](removeEntity(_0x2380fe,null))[_0x2a80('0x1c')](handleError(_0x2380fe,null));};exports[_0x2a80('0x46')]=function(_0x596ad7,_0x478d02){return db[_0x2a80('0x34')][_0x2a80('0x46')]()['then'](respondWithResult(_0x478d02,null))['catch'](handleError(_0x478d02,null));};exports[_0x2a80('0x47')]=function(_0x4653a1,_0x5eb007){var _0x35ec34=_0x4653a1[_0x2a80('0x45')]['id'];var _0x1e6ae8;var _0x5732b9;var _0x2410ae;return db[_0x2a80('0x34')][_0x2a80('0x48')]({'where':{'id':_0x35ec34}})['then'](function(_0x37a375){_0x1e6ae8=_0x37a375;return db['ChatWebsite'][_0x2a80('0x48')]({'where':{'id':_0x37a375[_0x2a80('0x49')]},'attributes':['id',_0x2a80('0x4a'),_0x2a80('0x4b'),_0x2a80('0x4c'),_0x2a80('0x4d'),_0x2a80('0x4e')],'raw':!![]});})[_0x2a80('0x28')](function(_0x285df3){if(_0x285df3&&_0x285df3[_0x2a80('0x4a')]&&_0x285df3[_0x2a80('0x4b')]){_0x5732b9=_0x285df3;var _0x5e354d={'interaction':{'id':_0x35ec34},'agent':{'id':_0x4653a1['user']['id'],'name':_0x4653a1[_0x2a80('0x4f')]['name'],'fullname':_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x50')],'email':_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x51')]},'contact':_0x4653a1[_0x2a80('0x2d')]['contact'],'account':_0x4653a1['body']['account']};var _0x49cbeb={'rejectUnauthorized':![],'method':_0x2a80('0x52'),'url':_0x2a80('0x53'),'headers':{'X-APIKEY':_0x285df3[_0x2a80('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x51')]],'buttons':null,'topic':_0x5732b9[_0x2a80('0x4c')],'note':_[_0x2a80('0x54')](_0x5732b9[_0x2a80('0x4d')])?null:getMustacheRender(_0x5732b9[_0x2a80('0x4d')],_0x5e354d),'metadata':null},'redirect':_0x2a80('0x55'),'json':!![]};try{if(!_['isNull'](_0x5732b9['vidaooMetadata'])){var _0x4bf632=getMustacheRender(_0x5732b9['vidaooMetadata'],_0x5e354d);var _0x269fc2=JSON[_0x2a80('0x56')](_0x4bf632);_0x49cbeb[_0x2a80('0x2d')][_0x2a80('0x57')]=_0x269fc2;}}catch(_0x4a938f){throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))](_0x2a80('0x5a'));}return rp(_0x49cbeb);}else{throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x15db2c){_0x2410ae=_0x15db2c;if(_0x2410ae['id']){var _0x4811da={'body':_0x2410ae['join_url'],'ChatWebsiteId':_0x5732b9['id'],'ChatInteractionId':_0x1e6ae8['id'],'direction':_0x2a80('0x5b'),'UserId':_0x4653a1[_0x2a80('0x4f')]['id']};return db[_0x2a80('0x5c')]['create'](_0x4811da,{});}else{throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1e6ae8['updateAttributes']({'vidaooSessionId':_0x2410ae['id']});})['then'](respondWithResult(_0x5eb007,null))['catch'](handleError(_0x5eb007,null));};exports[_0x2a80('0x5d')]=function(_0x313fb1,_0x3022a1){if(_0x313fb1[_0x2a80('0x2d')]['id']){delete _0x313fb1['body']['id'];}return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x313fb1[_0x2a80('0x45')]['id']},'include':[{'model':db[_0x2a80('0x5e')],'as':'Contact'}]})[_0x2a80('0x28')](handleEntityNotFound(_0x3022a1,null))[_0x2a80('0x28')](saveUpdates(_0x313fb1[_0x2a80('0x2d')],null))[_0x2a80('0x28')](respondWithResult(_0x3022a1,null))['catch'](handleError(_0x3022a1,null));};exports[_0x2a80('0x5f')]=function(_0x3fdd1c,_0x432284){if(_0x3fdd1c['body']['id']){delete _0x3fdd1c['body']['id'];}return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x3fdd1c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](function(_0x79a41c){if(!_0x79a41c){logger[_0x2a80('0x18')](_0x2a80('0x60'),_0x2a80('0x5f'),0x194,'entity\x20not\x20found');_0x432284['sendStatus'](0x194);}else{if(_0x79a41c['UserId']){throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Interaction\x20already\x20assigned');}}return _0x79a41c;})[_0x2a80('0x28')](function(_0xd37d00){if(_0xd37d00){return _0xd37d00[_0x2a80('0x26')]({'closed':_0x3fdd1c[_0x2a80('0x2d')][_0x2a80('0x61')],'disposition':_0x3fdd1c[_0x2a80('0x2d')]['disposition']})[_0x2a80('0x28')](function(_0x747ebe){return _0x747ebe;});}})[_0x2a80('0x28')](function(){return respondWithRpcPromise('AbandonInteraction',_0x2a80('0x5f'),_0x3fdd1c[_0x2a80('0x2d')],client9004);})[_0x2a80('0x28')](respondWithResult(_0x432284,null))['catch'](handleError(_0x432284,null));};exports[_0x2a80('0x62')]=function(_0x55a432,_0x1e9f02){_0x55a432[_0x2a80('0x2d')][_0x2a80('0x2b')]=_0x55a432[_0x2a80('0x63')][_0x2a80('0x64')];_0x55a432['body'][_0x2a80('0x65')]=_0x55a432['file']['filename'];_0x55a432[_0x2a80('0x2d')][_0x2a80('0x35')]=_0x55a432[_0x2a80('0x63')][_0x2a80('0x66')];return db[_0x2a80('0x67')][_0x2a80('0x44')](_0x55a432[_0x2a80('0x2d')])[_0x2a80('0x28')](respondWithResult(_0x1e9f02,0xc9))['catch'](handleError(_0x1e9f02,null));};exports['attachmentDownload']=function(_0x2b9c7e,_0x55b52a){return db[_0x2a80('0x34')]['findOne']({'where':{'id':_0x2b9c7e[_0x2a80('0x45')]['id']},'raw':!![]})[_0x2a80('0x28')](handleEntityNotFound(_0x55b52a,null))[_0x2a80('0x28')](function(_0x56968c){if(_0x56968c){if(_0x56968c[_0x2a80('0x61')]){return _0x55b52a['status'](0x193)[_0x2a80('0x1f')]({'status':0x193,'message':_0x2a80('0x68')});}return db['Attachment'][_0x2a80('0x48')]({'where':{'id':_0x2b9c7e[_0x2a80('0x38')][_0x2a80('0x69')]},'raw':!![]})['then'](handleEntityNotFound(_0x55b52a,null));}})['then'](function(_0x1363dd){if(_0x1363dd){var _0x28771d=_0x1363dd[_0x2a80('0x6a')]!==null;var _0x2dd35f=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0x6d'));if(_0x28771d){_0x2dd35f=path[_0x2a80('0x6b')](_0x2dd35f,_0x2a80('0x6e'));}var _0x170736=path['join'](_0x2dd35f,_0x1363dd['basename']);return _0x55b52a[_0x2a80('0x6f')](_0x170736);}})['catch'](handleError(_0x55b52a,null));};exports[_0x2a80('0x70')]=function(_0x2c843a,_0x4cdd96){var _0x5cb57b=null;var _0x24bd89=null;var _0x5d6511=null;if(_0x2c843a['body']['id']){delete _0x2c843a[_0x2a80('0x2d')]['id'];}if(_0x2c843a['body'][_0x2a80('0x71')]){_0x5d6511=path['join'](config['root'],'server/files/chat/upload/',util[_0x2a80('0x72')](_0x2a80('0x73'),Date['now']()));_0x2c843a[_0x2a80('0x2d')][_0x2a80('0x74')]=_0x5d6511;}return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x2c843a[_0x2a80('0x45')]['id']},'include':[{'model':db[_0x2a80('0x5c')],'as':_0x2a80('0x75'),'include':[{'model':db[_0x2a80('0x76')],'as':'User'}]}]})[_0x2a80('0x28')](handleEntityNotFound(_0x4cdd96,null))[_0x2a80('0x28')](saveUpdates(_0x2c843a[_0x2a80('0x2d')],null))[_0x2a80('0x28')](function(_0x3542fb){if(_0x3542fb){_0x5cb57b=_0x3542fb;return db[_0x2a80('0x77')][_0x2a80('0x43')]({'where':{'id':_0x5cb57b[_0x2a80('0x49')]}});}})[_0x2a80('0x28')](function(_0x499360){if(_0x499360){_0x24bd89=_0x499360;return db[_0x2a80('0x5e')][_0x2a80('0x43')]({'where':{'id':_0x5cb57b[_0x2a80('0x78')]}});}})[_0x2a80('0x28')](function(_0x2bdc5f){if(_0x2bdc5f){if(_0x5d6511){var _0x420c5a=null;for(var _0x327b83=0x1;_0x327b83<_0x5cb57b['Messages'][_0x2a80('0x41')];++_0x327b83){_0x420c5a=_0x5cb57b[_0x2a80('0x75')][_0x327b83];var _0x4e8382=_0x420c5a[_0x2a80('0x79')]?util['format'](_0x2a80('0x7a'),_0x24bd89[_0x2a80('0x7b')],_0x420c5a['UserId']):_0x2a80('0x7c');var _0x27f868=_0x2c843a[_0x2a80('0x2d')][_0x2a80('0x7d')]||util[_0x2a80('0x72')](_0x2a80('0x7a'),'Visitor',_0x420c5a[_0x2a80('0x78')]);switch(_0x24bd89[_0x2a80('0x7e')]){case _0x2a80('0x7f'):_0x4e8382=_0x420c5a[_0x2a80('0x79')]?util[_0x2a80('0x72')]('%s%d',_0x24bd89['agentAlias'],_0x420c5a[_0x2a80('0x79')]):_0x2a80('0x7c');break;case _0x2a80('0x80'):_0x4e8382=_0x420c5a[_0x2a80('0x79')]?_0x420c5a[_0x2a80('0x76')]['alias']||_0x420c5a[_0x2a80('0x76')]['fullname']:_0x2a80('0x7c');break;case'agent_fullname':_0x4e8382=_0x420c5a[_0x2a80('0x79')]?_0x420c5a[_0x2a80('0x76')]['fullname']:_0x2a80('0x7c');break;default:_0x4e8382=_0x420c5a[_0x2a80('0x79')]?util['format'](_0x2a80('0x7a'),_0x24bd89[_0x2a80('0x7b')],_0x420c5a[_0x2a80('0x79')]):_0x2a80('0x7c');}var _0x511070=util[_0x2a80('0x72')](_0x2a80('0x81'),moment(_0x420c5a[_0x2a80('0x82')])[_0x2a80('0x72')](_0x2a80('0x83')),_0x420c5a['direction']==='in'?_0x27f868:_0x4e8382,_0x420c5a[_0x2a80('0x2d')]);if(!_0x420c5a['secret']){fs[_0x2a80('0x84')](_0x5d6511,_0x511070);}}return db[_0x2a80('0x85')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2a80('0x86'),'raw':!![],'include':[{'model':db[_0x2a80('0x87')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x41370e){if(!_0x41370e||!_0x41370e[_0x2a80('0x86')]||!_0x2c843a[_0x2a80('0x2d')])return _0x5cb57b;var _0x10d27d=_0x41370e[_0x2a80('0x88')]();return respondWithRpcPromise(_0x2a80('0x89'),_0x2a80('0x8a'),{'account':_0x10d27d,'message':{'from':util[_0x2a80('0x72')](_0x2a80('0x8b'),_0x41370e[_0x2a80('0x2b')],_0x41370e[_0x2a80('0x51')]||_0x41370e[_0x2a80('0x86')][_0x2a80('0x4f')]),'to':_0x2c843a[_0x2a80('0x2d')]['mailTranscript'],'subject':_0x2a80('0x8c'),'text':util[_0x2a80('0x72')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2c843a['body'][_0x2a80('0x71')]),'attachments':[{'path':_0x5d6511}]}})[_0x2a80('0x28')](function(){return _0x5cb57b;})[_0x2a80('0x1c')](function(_0x265256){logger['error'](_0x265256);});})['then'](respondWithStatusCode(_0x4cdd96,0xc8))[_0x2a80('0x1c')](handleError(_0x4cdd96,null));};exports[_0x2a80('0x8d')]=function(_0x569a43,_0x1d5f6f){return db[_0x2a80('0x5c')][_0x2a80('0x43')]({'where':{'id':_0x569a43['params']['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x1d5f6f,null))[_0x2a80('0x28')](function(_0x840be0){if(_0x840be0){return _0x840be0['addMessage'](_0x569a43['body']['ids'],_[_0x2a80('0x8e')](_0x569a43[_0x2a80('0x2d')],[_0x2a80('0x8f'),'id'])||{});}})['then'](respondWithResult(_0x1d5f6f,null))['catch'](handleError(_0x1d5f6f,null));};exports['getMessages']=function(_0x2f851c,_0x52e202){var _0x2633bd={'raw':![],'where':{}};var _0x36bc88={};var _0x54b6a5={'count':0x0,'rows':[]};return db[_0x2a80('0x34')]['findOne']({'where':{'id':_0x2f851c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x52e202,null))[_0x2a80('0x28')](function(_0x17dae5){if(_0x17dae5){_0x36bc88[_0x2a80('0x3a')]=_[_0x2a80('0x3b')](db['ChatMessage']['rawAttributes']);_0x36bc88[_0x2a80('0x38')]=_[_0x2a80('0x3b')](_0x2f851c['query']);_0x36bc88[_0x2a80('0x3d')]=_[_0x2a80('0x3e')](_0x36bc88[_0x2a80('0x3a')],_0x36bc88[_0x2a80('0x38')]);_0x2633bd[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x36bc88['model'],qs[_0x2a80('0x40')](_0x2f851c['query'][_0x2a80('0x40')]));_0x2633bd['attributes']=_0x2633bd[_0x2a80('0x3f')][_0x2a80('0x41')]?_0x2633bd[_0x2a80('0x3f')]:_0x36bc88[_0x2a80('0x3a')];if(!_0x2f851c[_0x2a80('0x38')]['hasOwnProperty']('nolimit')){_0x2633bd[_0x2a80('0x22')]=qs[_0x2a80('0x22')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x22')]);_0x2633bd[_0x2a80('0x20')]=qs[_0x2a80('0x20')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x20')]);}_0x2633bd[_0x2a80('0x90')]=qs[_0x2a80('0x91')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x91')]);_0x2633bd['where']=qs[_0x2a80('0x3d')](_['pick'](_0x2f851c['query'],_0x36bc88['filters']));_0x2633bd[_0x2a80('0x92')][_0x2a80('0x93')]=_0x17dae5['id'];if(_0x2f851c['query'][_0x2a80('0x94')]){_0x2633bd[_0x2a80('0x92')]=_[_0x2a80('0x95')](_0x2633bd[_0x2a80('0x92')],{'$or':_['map'](_0x2633bd[_0x2a80('0x3f')],function(_0x2aae8c){var _0x7d2b18={};_0x7d2b18[_0x2aae8c]={'$like':'%'+_0x2f851c[_0x2a80('0x38')][_0x2a80('0x94')]+'%'};return _0x7d2b18;})});}if(_0x2f851c[_0x2a80('0x38')]['$gte']){var _0x33d5d=_0x2f851c['query'][_0x2a80('0x96')][_0x2a80('0x97')](',');var _0x5e007f={};_0x5e007f[_0x33d5d[0x0]]={'$gte':moment(_0x33d5d[0x1])[_0x2a80('0x72')](_0x2a80('0x98'))};_0x2633bd[_0x2a80('0x92')]=_[_0x2a80('0x95')](_0x2633bd['where'],_0x5e007f);}_0x2633bd=_[_0x2a80('0x95')]({},_0x2633bd,_0x2f851c[_0x2a80('0x99')]);return db[_0x2a80('0x5c')][_0x2a80('0x23')]({'where':_0x2633bd[_0x2a80('0x92')]})[_0x2a80('0x28')](function(_0x342a29){_0x54b6a5[_0x2a80('0x23')]=_0x342a29;if(_0x2f851c[_0x2a80('0x38')][_0x2a80('0x42')]){_0x2633bd[_0x2a80('0x9a')]=[{'all':!![]}];}return db[_0x2a80('0x5c')]['findAll'](_0x2633bd);})[_0x2a80('0x28')](function(_0x19ccee){_0x54b6a5[_0x2a80('0x9b')]=_0x19ccee;return _0x54b6a5;});}})[_0x2a80('0x28')](respondWithFilteredResult(_0x52e202,_0x2633bd))[_0x2a80('0x1c')](handleError(_0x52e202,null));};exports[_0x2a80('0x9c')]=function(_0x5a218c,_0x4be3ec){var _0x58da3a={'where':{}},_0x2abf5c={},_0x2b40cc={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2a80('0x48')]({'where':{'id':_0x5a218c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x4be3ec,null))[_0x2a80('0x28')](function(_0x34ee72){if(_0x34ee72){_0x2abf5c['model']=_[_0x2a80('0x3b')](db[_0x2a80('0x5c')]['rawAttributes']);_0x2abf5c['query']=_[_0x2a80('0x3b')](_0x5a218c[_0x2a80('0x38')]);_0x2abf5c[_0x2a80('0x3d')]=_['intersection'](_0x2abf5c[_0x2a80('0x3a')],_0x2abf5c['query']);_0x58da3a[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x2abf5c[_0x2a80('0x3a')],qs['fields'](_0x5a218c[_0x2a80('0x38')][_0x2a80('0x40')]));_0x58da3a['attributes']=_0x58da3a['attributes'][_0x2a80('0x41')]?_0x58da3a[_0x2a80('0x3f')]:_0x2abf5c[_0x2a80('0x3a')];if(!_0x5a218c['query'][_0x2a80('0x9d')]('nolimit')){_0x58da3a[_0x2a80('0x22')]=qs[_0x2a80('0x22')](_0x5a218c[_0x2a80('0x38')][_0x2a80('0x22')]);_0x58da3a[_0x2a80('0x20')]=qs['offset'](_0x5a218c['query']['offset']);}_0x58da3a[_0x2a80('0x90')]=qs['sort'](_0x5a218c[_0x2a80('0x38')]['sort']);_0x58da3a[_0x2a80('0x92')]=qs[_0x2a80('0x3d')](_['pick'](_0x5a218c[_0x2a80('0x38')],_0x2abf5c['filters']));_0x58da3a['where'][_0x2a80('0x93')]=_0x34ee72['id'];if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x94')]){_0x58da3a[_0x2a80('0x92')]=_['merge'](_0x58da3a[_0x2a80('0x92')],{'$or':_[_0x2a80('0x33')](_0x58da3a[_0x2a80('0x3f')],function(_0x3a4a2c){var _0xe73cf3={};_0xe73cf3[_0x3a4a2c]={'$like':'%'+_0x5a218c['query']['filter']+'%'};return _0xe73cf3;})});}_0x58da3a[_0x2a80('0x92')][_0x2a80('0x9e')]=![];if(_0x5a218c[_0x2a80('0x38')]['id']){_0x58da3a['where']['id']={'$gt':_0x5a218c[_0x2a80('0x38')]['id']};}_0x58da3a=_[_0x2a80('0x95')]({},_0x58da3a,_0x5a218c[_0x2a80('0x99')]);return db[_0x2a80('0x5c')][_0x2a80('0x23')]({'where':_0x58da3a[_0x2a80('0x92')]})[_0x2a80('0x28')](function(_0x21a697){_0x2b40cc[_0x2a80('0x23')]=_0x21a697;_0x58da3a[_0x2a80('0x9a')]=[];if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x9f')]){_0x58da3a[_0x2a80('0x9a')]['push']({'model':db['User'],'as':_0x2a80('0x76'),'attributes':['id',_0x2a80('0x50'),_0x2a80('0xa0')]});}if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x42')]){_0x58da3a['include']=[{'all':!![]}];}return db[_0x2a80('0x5c')][_0x2a80('0xa1')](_0x58da3a);})[_0x2a80('0x28')](function(_0x5afebe){_0x2b40cc[_0x2a80('0x9b')]=_0x5afebe;return _0x2b40cc;});}})[_0x2a80('0x28')](respondWithFilteredResult(_0x4be3ec,_0x58da3a))['catch'](handleError(_0x4be3ec,null));};exports[_0x2a80('0xa2')]=function(_0x69bc1d,_0xdbac0d){return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x69bc1d['params']['id']}})['then'](handleEntityNotFound(_0xdbac0d,null))[_0x2a80('0x28')](function(_0x3e0595){if(_0x3e0595){return _0x3e0595[_0x2a80('0xa3')](_0x69bc1d[_0x2a80('0x2d')]['ids'],_[_0x2a80('0x8e')](_0x69bc1d[_0x2a80('0x2d')],[_0x2a80('0x8f'),'id'])||{})[_0x2a80('0xa4')](function(){return db[_0x2a80('0xa5')][_0x2a80('0xa1')]({'attributes':['id',_0x2a80('0x2b'),_0x2a80('0xa6')],'where':{'id':_0x69bc1d[_0x2a80('0x2d')]['ids']}});})[_0x2a80('0x28')](function(_0x513eec){socket[_0x2a80('0xa7')](_0x2a80('0xa8'),{'id':Number(_0x69bc1d[_0x2a80('0x45')]['id']),'tags':_0x513eec||[]});return{'id':Number(_0x69bc1d['params']['id']),'tags':_0x513eec||[]};});}})[_0x2a80('0x28')](respondWithResult(_0xdbac0d,null))[_0x2a80('0x1c')](handleError(_0xdbac0d,null));};exports[_0x2a80('0xa9')]=function(_0x52a402,_0x4da365){return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x52a402[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x4da365,null))[_0x2a80('0x28')](function(_0x412093){if(_0x412093){return _0x412093[_0x2a80('0xa9')](_0x52a402[_0x2a80('0x38')]['ids']);}})[_0x2a80('0x28')](respondWithStatusCode(_0x4da365,null))[_0x2a80('0x1c')](handleError(_0x4da365,null));};exports[_0x2a80('0x6f')]=function(_0x59db0d,_0x2afa41){var _0x503f3d=moment()[_0x2a80('0xaa')]()[_0x2a80('0xab')]();var _0x69ffab=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],'server','files',_0x2a80('0xac'));var _0x111dfe=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0xad'),_0x2a80('0xae'),_0x2a80('0xaf'));var _0x988ee3=path['join'](_0x69ffab,_0x503f3d);var _0xa7224b=util[_0x2a80('0x72')](_0x2a80('0xb0'),_0x59db0d[_0x2a80('0x45')]['id'],_0x503f3d);var _0x46d2e2=path[_0x2a80('0x6b')](_0x69ffab,_0xa7224b);var _0x28002a=[];_0x28002a['push']({'model':db[_0x2a80('0x76')],'as':_0x2a80('0x76'),'attributes':['id','fullname'],'raw':!![]});_0x28002a[_0x2a80('0xb1')]({'model':db[_0x2a80('0x5e')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x59db0d['query'][_0x2a80('0xaf')]){_0x28002a[_0x2a80('0xb1')]({'model':db[_0x2a80('0x67')],'as':_0x2a80('0x67'),'raw':!![]});}var _0x3bc1fd=[{'model':db[_0x2a80('0x5c')],'as':_0x2a80('0x75'),'attributes':['id',_0x2a80('0x2d'),_0x2a80('0x82'),_0x2a80('0xb2'),'secret','read'],'include':_0x28002a}];_0x3bc1fd[_0x2a80('0xb1')]({'model':db[_0x2a80('0x77')],'as':_0x2a80('0xb3'),'attributes':['id',_0x2a80('0x2b')]});_0x3bc1fd[_0x2a80('0xb1')]({'model':db[_0x2a80('0x76')],'as':_0x2a80('0xb4'),'attributes':['id',_0x2a80('0x50')]});return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x59db0d[_0x2a80('0x45')]['id']},'include':_0x3bc1fd})[_0x2a80('0x28')](handleEntityNotFound(_0x2afa41,null))[_0x2a80('0x28')](function(_0x5ddf5c){if(_0x5ddf5c){var _0x4cc4ec=_0x5ddf5c[_0x2a80('0xb5')]({'plain':!![]});fs[_0x2a80('0xb6')](_0x988ee3);var _0x5d6ff2={'channel':_0x2a80('0xb7'),'account':_0x4cc4ec[_0x2a80('0xb3')][_0x2a80('0x2b')],'agent':_0x4cc4ec[_0x2a80('0xb4')]?_0x4cc4ec[_0x2a80('0xb4')][_0x2a80('0x50')]:_0x2a80('0xb8'),'createdAt':moment(_0x4cc4ec[_0x2a80('0x82')])[_0x2a80('0x72')](_0x2a80('0x98'))['toString'](),'closedAt':_0x4cc4ec[_0x2a80('0x61')]?moment(_0x4cc4ec[_0x2a80('0xb9')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4cc4ec[_0x2a80('0xba')],'chatInfo':{'browser':_0x4cc4ec['browserName'],'os':_0x4cc4ec['osName'],'referer':_0x4cc4ec['referer'],'customerIp':_0x4cc4ec[_0x2a80('0xbb')],'customerPort':_0x4cc4ec[_0x2a80('0xbc')]?_0x4cc4ec[_0x2a80('0xbc')]:'N.A.'},'messages':_(_0x4cc4ec[_0x2a80('0x75')])[_0x2a80('0xbd')]()['filter']({'secret':![]})[_0x2a80('0x33')](function(_0x3ec931){if(_0x3ec931[_0x2a80('0x67')]){var _0x1c5251=path[_0x2a80('0x6b')](_0x111dfe,_0x3ec931[_0x2a80('0x67')][_0x2a80('0x65')]);if(fs[_0x2a80('0xbe')](_0x1c5251)){fs[_0x2a80('0xbf')](_0x1c5251)[_0x2a80('0xc0')](fs[_0x2a80('0xc1')](path[_0x2a80('0x6b')](_0x988ee3,_0x3ec931['Attachment']['basename'])));}}return{'date':moment(_0x3ec931[_0x2a80('0x82')])[_0x2a80('0x72')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x3ec931['direction']===_0x2a80('0x5b')?_0x3ec931[_0x2a80('0x76')]?_0x3ec931[_0x2a80('0x76')][_0x2a80('0x50')]:_0x2a80('0x7c'):_0x3ec931[_0x2a80('0xc2')][_0x2a80('0xc3')]+(_0x3ec931[_0x2a80('0xc2')][_0x2a80('0xc4')]?'\x20'+_0x3ec931[_0x2a80('0xc2')]['lastName']:''),'body':_0x3ec931[_0x2a80('0x67')]?_0x3ec931[_0x2a80('0x67')][_0x2a80('0x65')]:_0x3ec931[_0x2a80('0x2d')],'direction':_0x3ec931[_0x2a80('0xb2')]===_0x2a80('0x5b')?'A':'C','secret':_0x3ec931['secret'],'read':_0x3ec931[_0x2a80('0xc5')],'attachment':_0x3ec931[_0x2a80('0x67')]};})[_0x2a80('0xc6')]()};return ejs['renderFile'](path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0xad'),_0x2a80('0xc7'),_0x2a80('0xc8')),{'interaction':_0x5d6ff2})[_0x2a80('0x28')](function(_0x442201){var _0x5374e9=path[_0x2a80('0x6b')](_0x988ee3,_0x2a80('0xc9')+_0x4cc4ec['id']+'-'+_0x503f3d+_0x2a80('0xca'));var _0x15dc02={'path':_0x5374e9,'channel':_0x2a80('0xb7'),'interactionId':_0x4cc4ec['id']};return pdf[_0x2a80('0xcb')](_0x442201,_0x15dc02);})[_0x2a80('0x28')](function(){return new Promise(function(_0x1f9bf8,_0x3bd597){zipdir(_0x988ee3,{'saveTo':_0x46d2e2},function(_0x51ecb2,_0x4e524c){if(_0x51ecb2)return _0x3bd597(_0x51ecb2);return _0x1f9bf8(_0x4e524c);});})[_0x2a80('0x28')](function(){return new BPromise(function(_0x13a087,_0x1f77e2){rimraf(_0x988ee3,function(_0x3569d3){if(_0x3569d3)_0x1f77e2(_0x3569d3);return _0x13a087();});});})[_0x2a80('0x28')](function(){return _0x2afa41[_0x2a80('0x6f')](_0x46d2e2,_0xa7224b,function(_0x586217){if(_0x586217){logger[_0x2a80('0x18')](_0x2a80('0xcc'),_0x586217);}else{fs['unlinkSync'](_0x46d2e2);}});});});}else{return _0x2afa41[_0x2a80('0x1d')](0xc8);}})[_0x2a80('0x1c')](handleError(_0x2afa41,null));}; \ No newline at end of file +var _0xd463=['Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','CmContact','length','%s%d','agentAlias','System','customer','Visitor','ContactId','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','intersection','hasOwnProperty','nolimit','limit','sort','where','ChatInteractionId','filter','$gte','options','include','rows','getMyMessages','pick','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','server','files','transcript-%d-%s.zip','push','firstName','attachments','read','Owner','get','mkdirSync','Account','N.A.','toString','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','lastName','value','renderFile','views','downloadInteraction.ejs','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','util','path','ejs','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','json','offset','undefined','count','set','update','then','destroy','end','stack','name','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','findAll','chat','show','params','model','keys','query','filters','fields','attributes','includeAll','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','parse'];(function(_0xdb255f,_0x3e9f0d){var _0x922e3c=function(_0x3da198){while(--_0x3da198){_0xdb255f['push'](_0xdb255f['shift']());}};_0x922e3c(++_0x3e9f0d);}(_0xd463,0x139));var _0x3d46=function(_0x5484f4,_0x4f2c3a){_0x5484f4=_0x5484f4-0x0;var _0x7f7dc9=_0xd463[_0x5484f4];return _0x7f7dc9;};'use strict';var rimraf=require(_0x3d46('0x0'));var zipdir=require(_0x3d46('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d46('0x2'));var path=require(_0x3d46('0x3'));var ejs=require(_0x3d46('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x3d46('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3d46('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x3d46('0x7'));var db=require(_0x3d46('0x8'))['db'];config[_0x3d46('0x9')]=_[_0x3d46('0xa')](config[_0x3d46('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d46('0xb'))(new Redis(config[_0x3d46('0x9')]));require(_0x3d46('0xc'))[_0x3d46('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d46('0xe')]['http']({'port':0x232b});var client9004=jayson[_0x3d46('0xe')]['http']({'port':0x232c});function respondWithRpcPromise(_0x424dca,_0x38f9e8,_0x48ded,_0x18ec0b){return new BPromise(function(_0x285583,_0x378d28){var _0x51b499=_0x18ec0b||client;return _0x51b499['request'](_0x424dca,_0x48ded)['then'](function(_0x19b5f2){logger['info'](_0x3d46('0xf'),_0x38f9e8,_0x3d46('0x10'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x38f9e8,'request\x20sent',JSON['stringify'](_0x19b5f2));if(_0x19b5f2[_0x3d46('0x11')]){if(_0x19b5f2['error']['code']===0x1f4){logger['error'](_0x3d46('0xf'),_0x38f9e8,_0x19b5f2[_0x3d46('0x11')]['message']);return _0x378d28(_0x19b5f2[_0x3d46('0x11')][_0x3d46('0x12')]);}logger[_0x3d46('0x11')](_0x3d46('0xf'),_0x38f9e8,_0x19b5f2[_0x3d46('0x11')][_0x3d46('0x12')]);return _0x285583(_0x19b5f2['error'][_0x3d46('0x12')]);}else{logger[_0x3d46('0x13')](_0x3d46('0xf'),_0x38f9e8,_0x3d46('0x10'));_0x285583(_0x19b5f2[_0x3d46('0x14')][_0x3d46('0x12')]);}})[_0x3d46('0x15')](function(_0x501a80){logger[_0x3d46('0x11')](_0x3d46('0xf'),_0x38f9e8,_0x501a80);_0x378d28(_0x501a80);});});}function respondWithStatusCode(_0x3dc3dd,_0xb51e08){_0xb51e08=_0xb51e08||0xcc;return function(_0x2ec010){if(_0x2ec010){return _0x3dc3dd['sendStatus'](_0xb51e08);}return _0x3dc3dd[_0x3d46('0x16')](_0xb51e08)['end']();};}function respondWithResult(_0x28a58a,_0x2d52aa){_0x2d52aa=_0x2d52aa||0xc8;return function(_0x485c32){if(_0x485c32){return _0x28a58a[_0x3d46('0x16')](_0x2d52aa)[_0x3d46('0x17')](_0x485c32);}};}function respondWithFilteredResult(_0x21b97e,_0x2fcd83){return function(_0x5e46e5){if(_0x5e46e5){var _0x26c600=typeof _0x2fcd83[_0x3d46('0x18')]==='undefined'&&typeof _0x2fcd83['limit']===_0x3d46('0x19');var _0x2f135a=_0x5e46e5[_0x3d46('0x1a')];var _0x30f56a=_0x26c600?0x0:_0x2fcd83['offset'];var _0x53161b=_0x26c600?_0x5e46e5[_0x3d46('0x1a')]:_0x2fcd83[_0x3d46('0x18')]+_0x2fcd83['limit'];var _0x101381;if(_0x53161b>=_0x2f135a){_0x53161b=_0x2f135a;_0x101381=0xc8;}else{_0x101381=0xce;}_0x21b97e[_0x3d46('0x16')](_0x101381);return _0x21b97e[_0x3d46('0x1b')]('Content-Range',_0x30f56a+'-'+_0x53161b+'/'+_0x2f135a)[_0x3d46('0x17')](_0x5e46e5);}return null;};}function saveUpdates(_0x57ccc9){return function(_0x10a76b){if(_0x10a76b){return _0x10a76b[_0x3d46('0x1c')](_0x57ccc9)[_0x3d46('0x1d')](function(_0x46da00){return _0x46da00;});}return null;};}function removeEntity(_0x3f43f8){return function(_0x23544d){if(_0x23544d){return _0x23544d[_0x3d46('0x1e')]()[_0x3d46('0x1d')](function(){_0x3f43f8[_0x3d46('0x16')](0xcc)[_0x3d46('0x1f')]();});}};}function handleEntityNotFound(_0x44021a){return function(_0x2d57f2){if(!_0x2d57f2){_0x44021a['sendStatus'](0x194);}return _0x2d57f2;};}function handleError(_0xca5409,_0x4ceb12){_0x4ceb12=_0x4ceb12||0x1f4;return function(_0x6775d){logger[_0x3d46('0x11')](_0x6775d[_0x3d46('0x20')]);if(_0x6775d[_0x3d46('0x21')]){delete _0x6775d['name'];}_0xca5409[_0x3d46('0x16')](_0x4ceb12)['send'](_0x6775d);};}function getMustacheRender(_0x222ef0,_0xe1cf44){return Mustache[_0x3d46('0x22')](_0x222ef0,_[_0x3d46('0x23')](_0xe1cf44[_0x3d46('0x24')],{'contact':_0xe1cf44[_0x3d46('0x25')],'message':_0xe1cf44[_0x3d46('0x12')],'agent':_0xe1cf44['agent'],'interaction':_0xe1cf44[_0x3d46('0x26')],'account':_0xe1cf44[_0x3d46('0x27')]}))||'';}exports[_0x3d46('0x28')]=function(_0x53d1f8,_0x3a9e3){var _0x2f5b8a={};var _0x416a60=_[_0x3d46('0x29')](db[_0x3d46('0x2a')][_0x3d46('0x2b')],function(_0x5e61ec){return{'name':_0x5e61ec[_0x3d46('0x2c')],'type':_0x5e61ec[_0x3d46('0x2d')]['key']};});_0x2f5b8a=qs['getOptions'](_0x416a60,_0x53d1f8);return interaction[_0x3d46('0x2e')](_0x3d46('0x2f'),_0x53d1f8['query'],_0x53d1f8['user'],_0x2f5b8a,_0x416a60)[_0x3d46('0x1d')](respondWithFilteredResult(_0x3a9e3,_0x2f5b8a))['catch'](handleError(_0x3a9e3,null));};exports[_0x3d46('0x30')]=function(_0x5672b8,_0x18ff05){var _0x1d5460={'raw':![],'where':{'id':_0x5672b8[_0x3d46('0x31')]['id']}},_0x20b87a={};_0x20b87a[_0x3d46('0x32')]=_[_0x3d46('0x33')](db[_0x3d46('0x2a')][_0x3d46('0x2b')]);_0x20b87a[_0x3d46('0x34')]=_['keys'](_0x5672b8['query']);_0x20b87a[_0x3d46('0x35')]=_['intersection'](_0x20b87a[_0x3d46('0x32')],_0x20b87a[_0x3d46('0x34')]);_0x1d5460['attributes']=_['intersection'](_0x20b87a[_0x3d46('0x32')],qs[_0x3d46('0x36')](_0x5672b8[_0x3d46('0x34')][_0x3d46('0x36')]));_0x1d5460[_0x3d46('0x37')]=_0x1d5460['attributes']['length']?_0x1d5460['attributes']:_0x20b87a[_0x3d46('0x32')];if(_0x5672b8[_0x3d46('0x34')][_0x3d46('0x38')]){_0x1d5460['include']=[{'all':!![]}];}_0x1d5460=_[_0x3d46('0x23')]({},_0x1d5460,_0x5672b8['options']);return db[_0x3d46('0x2a')][_0x3d46('0x39')](_0x1d5460)['then'](handleEntityNotFound(_0x18ff05,null))[_0x3d46('0x1d')](respondWithResult(_0x18ff05,null))['catch'](handleError(_0x18ff05,null));};exports[_0x3d46('0x3a')]=function(_0x32ac59,_0x5f379f){return db[_0x3d46('0x2a')][_0x3d46('0x3a')](_0x32ac59[_0x3d46('0x24')],{})[_0x3d46('0x1d')](respondWithResult(_0x5f379f,0xc9))[_0x3d46('0x15')](handleError(_0x5f379f,null));};exports[_0x3d46('0x1c')]=function(_0x70993d,_0x5ea568){if(_0x70993d['body']['id']){delete _0x70993d[_0x3d46('0x24')]['id'];}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x70993d[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x5ea568,null))[_0x3d46('0x1d')](saveUpdates(_0x70993d[_0x3d46('0x24')],null))[_0x3d46('0x1d')](respondWithResult(_0x5ea568,null))[_0x3d46('0x15')](handleError(_0x5ea568,null));};exports[_0x3d46('0x1e')]=function(_0x15885d,_0x47d4ef){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x15885d['params']['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x47d4ef,null))[_0x3d46('0x1d')](removeEntity(_0x47d4ef,null))['catch'](handleError(_0x47d4ef,null));};exports[_0x3d46('0x3b')]=function(_0xbdbeb3,_0x4cf737){return db[_0x3d46('0x2a')][_0x3d46('0x3b')]()[_0x3d46('0x1d')](respondWithResult(_0x4cf737,null))['catch'](handleError(_0x4cf737,null));};exports[_0x3d46('0x3c')]=function(_0x20adc3,_0x4eab29){var _0x2591b4=_0x20adc3[_0x3d46('0x31')]['id'];var _0x5768c0;var _0x13a411;var _0x89cc38;return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x2591b4}})[_0x3d46('0x1d')](function(_0x30d60){_0x5768c0=_0x30d60;return db[_0x3d46('0x3e')][_0x3d46('0x3d')]({'where':{'id':_0x30d60['ChatWebsiteId']},'attributes':['id',_0x3d46('0x3f'),_0x3d46('0x40'),_0x3d46('0x41'),_0x3d46('0x42'),_0x3d46('0x43')],'raw':!![]});})['then'](function(_0xcd8955){if(_0xcd8955&&_0xcd8955['vidaooApiKey']&&_0xcd8955[_0x3d46('0x40')]){_0x13a411=_0xcd8955;var _0x59ae11={'interaction':{'id':_0x2591b4},'agent':{'id':_0x20adc3[_0x3d46('0x44')]['id'],'name':_0x20adc3[_0x3d46('0x44')]['name'],'fullname':_0x20adc3['user'][_0x3d46('0x45')],'email':_0x20adc3[_0x3d46('0x44')][_0x3d46('0x46')]},'contact':_0x20adc3[_0x3d46('0x24')][_0x3d46('0x25')],'account':_0x20adc3[_0x3d46('0x24')]['account']};var _0x396bee={'rejectUnauthorized':![],'method':_0x3d46('0x47'),'url':_0x3d46('0x48'),'headers':{'X-APIKEY':_0xcd8955[_0x3d46('0x3f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x20adc3[_0x3d46('0x44')][_0x3d46('0x46')]],'buttons':null,'topic':_0x13a411[_0x3d46('0x41')],'note':_['isNull'](_0x13a411['vidaooNote'])?null:getMustacheRender(_0x13a411[_0x3d46('0x42')],_0x59ae11),'metadata':null},'redirect':_0x3d46('0x49'),'json':!![]};try{if(!_['isNull'](_0x13a411['vidaooMetadata'])){var _0x567a7b=getMustacheRender(_0x13a411[_0x3d46('0x43')],_0x59ae11);var _0x235377=JSON[_0x3d46('0x4a')](_0x567a7b);_0x396bee[_0x3d46('0x24')]['metadata']=_0x235377;}}catch(_0x342ee3){throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x4d'));}return rp(_0x396bee);}else{throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x4e'));}})[_0x3d46('0x1d')](function(_0x49fda3){_0x89cc38=_0x49fda3;if(_0x89cc38['id']){var _0xacaa4e={'body':_0x89cc38[_0x3d46('0x4f')],'ChatWebsiteId':_0x13a411['id'],'ChatInteractionId':_0x5768c0['id'],'direction':_0x3d46('0x50'),'UserId':_0x20adc3[_0x3d46('0x44')]['id']};return db[_0x3d46('0x51')][_0x3d46('0x3a')](_0xacaa4e,{});}else{throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x52'));}})[_0x3d46('0x1d')](function(){return _0x5768c0['updateAttributes']({'vidaooSessionId':_0x89cc38['id']});})[_0x3d46('0x1d')](respondWithResult(_0x4eab29,null))[_0x3d46('0x15')](handleError(_0x4eab29,null));};exports[_0x3d46('0x53')]=function(_0x15b84b,_0xb02869){if(_0x15b84b[_0x3d46('0x24')]['id']){delete _0x15b84b['body']['id'];}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x15b84b[_0x3d46('0x31')]['id']},'include':[{'model':db['CmContact'],'as':_0x3d46('0x54')}]})['then'](handleEntityNotFound(_0xb02869,null))[_0x3d46('0x1d')](saveUpdates(_0x15b84b[_0x3d46('0x24')],null))['then'](respondWithResult(_0xb02869,null))[_0x3d46('0x15')](handleError(_0xb02869,null));};exports[_0x3d46('0x55')]=function(_0x490169,_0x3a79a6){if(_0x490169[_0x3d46('0x24')]['id']){delete _0x490169[_0x3d46('0x24')]['id'];}return db['ChatInteraction'][_0x3d46('0x39')]({'where':{'id':_0x490169['params']['id']}})[_0x3d46('0x1d')](function(_0x147e59){if(!_0x147e59){logger[_0x3d46('0x11')](_0x3d46('0x56'),_0x3d46('0x55'),0x194,_0x3d46('0x57'));_0x3a79a6['sendStatus'](0x194);}else{if(_0x147e59[_0x3d46('0x58')]){throw new db['Sequelize'][(_0x3d46('0x4c'))]('Interaction\x20already\x20assigned');}}return _0x147e59;})[_0x3d46('0x1d')](function(_0x80f85a){if(_0x80f85a){return _0x80f85a[_0x3d46('0x1c')]({'closed':_0x490169[_0x3d46('0x24')][_0x3d46('0x59')],'disposition':_0x490169['body']['disposition']})[_0x3d46('0x1d')](function(_0x5c7037){return _0x5c7037;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x3d46('0x55'),_0x490169[_0x3d46('0x24')],client9004);})['then'](respondWithResult(_0x3a79a6,null))[_0x3d46('0x15')](handleError(_0x3a79a6,null));};exports[_0x3d46('0x5a')]=function(_0x35daaa,_0x1a5e66){_0x35daaa['body'][_0x3d46('0x21')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5c')];_0x35daaa[_0x3d46('0x24')][_0x3d46('0x5d')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5e')];_0x35daaa[_0x3d46('0x24')][_0x3d46('0x2d')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5f')];return db[_0x3d46('0x60')][_0x3d46('0x3a')](_0x35daaa[_0x3d46('0x24')])[_0x3d46('0x1d')](respondWithResult(_0x1a5e66,0xc9))[_0x3d46('0x15')](handleError(_0x1a5e66,null));};exports['attachmentDownload']=function(_0x238a7f,_0x2bf2fd){return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x238a7f[_0x3d46('0x31')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2bf2fd,null))[_0x3d46('0x1d')](function(_0x16189c){if(_0x16189c){if(_0x16189c[_0x3d46('0x59')]){return _0x2bf2fd['status'](0x193)[_0x3d46('0x17')]({'status':0x193,'message':'Unauthorized'});}return db[_0x3d46('0x60')][_0x3d46('0x3d')]({'where':{'id':_0x238a7f[_0x3d46('0x34')][_0x3d46('0x61')]},'raw':!![]})['then'](handleEntityNotFound(_0x2bf2fd,null));}})[_0x3d46('0x1d')](function(_0x4e3b7a){if(_0x4e3b7a){var _0x1baee4=_0x4e3b7a[_0x3d46('0x62')]!==null;var _0x7f920c=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0x65'));if(_0x1baee4){_0x7f920c=path['join'](_0x7f920c,_0x3d46('0x66'));}var _0x2b7716=path[_0x3d46('0x63')](_0x7f920c,_0x4e3b7a['basename']);return _0x2bf2fd[_0x3d46('0x67')](_0x2b7716);}})[_0x3d46('0x15')](handleError(_0x2bf2fd,null));};exports['close']=function(_0x423a54,_0x417bf7){var _0x3c6d16=null;var _0x4b1225=null;var _0x5789cc=null;if(_0x423a54[_0x3d46('0x24')]['id']){delete _0x423a54[_0x3d46('0x24')]['id'];}if(_0x423a54['body'][_0x3d46('0x68')]){_0x5789cc=path['join'](config['root'],_0x3d46('0x69'),util[_0x3d46('0x6a')](_0x3d46('0x6b'),Date[_0x3d46('0x6c')]()));_0x423a54['body'][_0x3d46('0x6d')]=_0x5789cc;}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x423a54['params']['id']},'include':[{'model':db[_0x3d46('0x51')],'as':_0x3d46('0x6e'),'include':[{'model':db[_0x3d46('0x6f')],'as':_0x3d46('0x6f')}]}]})[_0x3d46('0x1d')](handleEntityNotFound(_0x417bf7,null))[_0x3d46('0x1d')](saveUpdates(_0x423a54[_0x3d46('0x24')],null))[_0x3d46('0x1d')](function(_0x3dd1f8){if(_0x3dd1f8){_0x3c6d16=_0x3dd1f8;return db[_0x3d46('0x3e')][_0x3d46('0x39')]({'where':{'id':_0x3c6d16[_0x3d46('0x70')]}});}})[_0x3d46('0x1d')](function(_0x347ccc){if(_0x347ccc){_0x4b1225=_0x347ccc;return db[_0x3d46('0x71')][_0x3d46('0x39')]({'where':{'id':_0x3c6d16['ContactId']}});}})[_0x3d46('0x1d')](function(_0x431524){if(_0x431524){if(_0x5789cc){var _0x5898b0=null;for(var _0x1a1093=0x1;_0x1a1093<_0x3c6d16['Messages'][_0x3d46('0x72')];++_0x1a1093){_0x5898b0=_0x3c6d16[_0x3d46('0x6e')][_0x1a1093];var _0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util[_0x3d46('0x6a')](_0x3d46('0x73'),_0x4b1225[_0x3d46('0x74')],_0x5898b0['UserId']):_0x3d46('0x75');var _0x5c0032=_0x423a54[_0x3d46('0x24')][_0x3d46('0x76')]||util['format'](_0x3d46('0x73'),_0x3d46('0x77'),_0x5898b0[_0x3d46('0x78')]);switch(_0x4b1225['agentIdentifier']){case _0x3d46('0x79'):_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util[_0x3d46('0x6a')]('%s%d',_0x4b1225[_0x3d46('0x74')],_0x5898b0[_0x3d46('0x58')]):_0x3d46('0x75');break;case _0x3d46('0x7a'):_0x5cbb27=_0x5898b0['UserId']?_0x5898b0['User'][_0x3d46('0x7b')]||_0x5898b0[_0x3d46('0x6f')][_0x3d46('0x45')]:_0x3d46('0x75');break;case _0x3d46('0x7c'):_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?_0x5898b0[_0x3d46('0x6f')][_0x3d46('0x45')]:'System';break;default:_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util['format'](_0x3d46('0x73'),_0x4b1225['agentAlias'],_0x5898b0[_0x3d46('0x58')]):_0x3d46('0x75');}var _0xb8b4a4=util[_0x3d46('0x6a')](_0x3d46('0x7d'),moment(_0x5898b0[_0x3d46('0x7e')])[_0x3d46('0x6a')](_0x3d46('0x7f')),_0x5898b0[_0x3d46('0x80')]==='in'?_0x5c0032:_0x5cbb27,_0x5898b0[_0x3d46('0x24')]);if(!_0x5898b0[_0x3d46('0x81')]){fs['appendFileSync'](_0x5789cc,_0xb8b4a4);}}return db[_0x3d46('0x82')][_0x3d46('0x3d')]({'where':{'service':!![]},'include':[{'model':db[_0x3d46('0x83')],'as':_0x3d46('0x84'),'raw':!![],'include':[{'model':db[_0x3d46('0x85')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x3d46('0x1d')](function(_0x1ed05f){if(!_0x1ed05f||!_0x1ed05f[_0x3d46('0x84')]||!_0x423a54['body'])return _0x3c6d16;var _0x4d49f9=_0x1ed05f[_0x3d46('0x86')]();return respondWithRpcPromise(_0x3d46('0x87'),'sendMail',{'account':_0x4d49f9,'message':{'from':util[_0x3d46('0x6a')](_0x3d46('0x88'),_0x1ed05f['name'],_0x1ed05f['email']||_0x1ed05f[_0x3d46('0x84')][_0x3d46('0x44')]),'to':_0x423a54['body'][_0x3d46('0x68')],'subject':'Mail\x20Transcript','text':util[_0x3d46('0x6a')](_0x3d46('0x89'),_0x423a54[_0x3d46('0x24')][_0x3d46('0x68')]),'attachments':[{'path':_0x5789cc}]}})[_0x3d46('0x1d')](function(){return _0x3c6d16;})[_0x3d46('0x15')](function(_0x35f43f){logger[_0x3d46('0x11')](_0x35f43f);});})[_0x3d46('0x1d')](respondWithStatusCode(_0x417bf7,0xc8))['catch'](handleError(_0x417bf7,null));};exports['addMessage']=function(_0x10e2bd,_0x16c65e){return db[_0x3d46('0x51')][_0x3d46('0x39')]({'where':{'id':_0x10e2bd[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x16c65e,null))[_0x3d46('0x1d')](function(_0x51428a){if(_0x51428a){return _0x51428a['addMessage'](_0x10e2bd['body'][_0x3d46('0x8a')],_[_0x3d46('0x8b')](_0x10e2bd[_0x3d46('0x24')],[_0x3d46('0x8a'),'id'])||{});}})[_0x3d46('0x1d')](respondWithResult(_0x16c65e,null))[_0x3d46('0x15')](handleError(_0x16c65e,null));};exports[_0x3d46('0x8c')]=function(_0x5a8218,_0x28f91c){var _0x10db33={'raw':![],'where':{}};var _0xa5843c={};var _0x3f9be6={'count':0x0,'rows':[]};return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x5a8218['params']['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x28f91c,null))[_0x3d46('0x1d')](function(_0x297a09){if(_0x297a09){_0xa5843c[_0x3d46('0x32')]=_[_0x3d46('0x33')](db[_0x3d46('0x51')][_0x3d46('0x2b')]);_0xa5843c[_0x3d46('0x34')]=_[_0x3d46('0x33')](_0x5a8218['query']);_0xa5843c[_0x3d46('0x35')]=_[_0x3d46('0x8d')](_0xa5843c[_0x3d46('0x32')],_0xa5843c[_0x3d46('0x34')]);_0x10db33[_0x3d46('0x37')]=_['intersection'](_0xa5843c[_0x3d46('0x32')],qs['fields'](_0x5a8218['query'][_0x3d46('0x36')]));_0x10db33[_0x3d46('0x37')]=_0x10db33[_0x3d46('0x37')][_0x3d46('0x72')]?_0x10db33[_0x3d46('0x37')]:_0xa5843c[_0x3d46('0x32')];if(!_0x5a8218[_0x3d46('0x34')][_0x3d46('0x8e')](_0x3d46('0x8f'))){_0x10db33[_0x3d46('0x90')]=qs['limit'](_0x5a8218[_0x3d46('0x34')][_0x3d46('0x90')]);_0x10db33[_0x3d46('0x18')]=qs['offset'](_0x5a8218[_0x3d46('0x34')]['offset']);}_0x10db33['order']=qs[_0x3d46('0x91')](_0x5a8218['query']['sort']);_0x10db33[_0x3d46('0x92')]=qs[_0x3d46('0x35')](_['pick'](_0x5a8218[_0x3d46('0x34')],_0xa5843c[_0x3d46('0x35')]));_0x10db33[_0x3d46('0x92')][_0x3d46('0x93')]=_0x297a09['id'];if(_0x5a8218[_0x3d46('0x34')][_0x3d46('0x94')]){_0x10db33[_0x3d46('0x92')]=_[_0x3d46('0x23')](_0x10db33['where'],{'$or':_[_0x3d46('0x29')](_0x10db33[_0x3d46('0x37')],function(_0x249e1f){var _0x23c5e6={};_0x23c5e6[_0x249e1f]={'$like':'%'+_0x5a8218[_0x3d46('0x34')][_0x3d46('0x94')]+'%'};return _0x23c5e6;})});}if(_0x5a8218[_0x3d46('0x34')]['$gte']){var _0x2a69ba=_0x5a8218['query'][_0x3d46('0x95')]['split'](',');var _0x24c1f5={};_0x24c1f5[_0x2a69ba[0x0]]={'$gte':moment(_0x2a69ba[0x1])[_0x3d46('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10db33['where']=_['merge'](_0x10db33[_0x3d46('0x92')],_0x24c1f5);}_0x10db33=_[_0x3d46('0x23')]({},_0x10db33,_0x5a8218[_0x3d46('0x96')]);return db['ChatMessage'][_0x3d46('0x1a')]({'where':_0x10db33[_0x3d46('0x92')]})[_0x3d46('0x1d')](function(_0x41be3f){_0x3f9be6['count']=_0x41be3f;if(_0x5a8218[_0x3d46('0x34')][_0x3d46('0x38')]){_0x10db33[_0x3d46('0x97')]=[{'all':!![]}];}return db[_0x3d46('0x51')][_0x3d46('0x2e')](_0x10db33);})['then'](function(_0x4e1c61){_0x3f9be6[_0x3d46('0x98')]=_0x4e1c61;return _0x3f9be6;});}})[_0x3d46('0x1d')](respondWithFilteredResult(_0x28f91c,_0x10db33))[_0x3d46('0x15')](handleError(_0x28f91c,null));};exports[_0x3d46('0x99')]=function(_0x19d951,_0x420612){var _0x4c9d86={'where':{}},_0x3637d0={},_0x1bad8f={'count':0x0,'rows':[]};return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x19d951[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x420612,null))[_0x3d46('0x1d')](function(_0x406cde){if(_0x406cde){_0x3637d0[_0x3d46('0x32')]=_['keys'](db[_0x3d46('0x51')][_0x3d46('0x2b')]);_0x3637d0[_0x3d46('0x34')]=_['keys'](_0x19d951['query']);_0x3637d0[_0x3d46('0x35')]=_[_0x3d46('0x8d')](_0x3637d0[_0x3d46('0x32')],_0x3637d0['query']);_0x4c9d86[_0x3d46('0x37')]=_['intersection'](_0x3637d0[_0x3d46('0x32')],qs[_0x3d46('0x36')](_0x19d951[_0x3d46('0x34')]['fields']));_0x4c9d86[_0x3d46('0x37')]=_0x4c9d86[_0x3d46('0x37')][_0x3d46('0x72')]?_0x4c9d86[_0x3d46('0x37')]:_0x3637d0[_0x3d46('0x32')];if(!_0x19d951[_0x3d46('0x34')][_0x3d46('0x8e')](_0x3d46('0x8f'))){_0x4c9d86[_0x3d46('0x90')]=qs[_0x3d46('0x90')](_0x19d951[_0x3d46('0x34')][_0x3d46('0x90')]);_0x4c9d86[_0x3d46('0x18')]=qs['offset'](_0x19d951['query']['offset']);}_0x4c9d86['order']=qs[_0x3d46('0x91')](_0x19d951['query'][_0x3d46('0x91')]);_0x4c9d86[_0x3d46('0x92')]=qs[_0x3d46('0x35')](_[_0x3d46('0x9a')](_0x19d951[_0x3d46('0x34')],_0x3637d0[_0x3d46('0x35')]));_0x4c9d86[_0x3d46('0x92')][_0x3d46('0x93')]=_0x406cde['id'];if(_0x19d951['query'][_0x3d46('0x94')]){_0x4c9d86[_0x3d46('0x92')]=_[_0x3d46('0x23')](_0x4c9d86['where'],{'$or':_[_0x3d46('0x29')](_0x4c9d86[_0x3d46('0x37')],function(_0x379edf){var _0x38bd50={};_0x38bd50[_0x379edf]={'$like':'%'+_0x19d951[_0x3d46('0x34')]['filter']+'%'};return _0x38bd50;})});}_0x4c9d86[_0x3d46('0x92')][_0x3d46('0x81')]=![];if(_0x19d951['query']['id']){_0x4c9d86[_0x3d46('0x92')]['id']={'$gt':_0x19d951[_0x3d46('0x34')]['id']};}_0x4c9d86=_['merge']({},_0x4c9d86,_0x19d951[_0x3d46('0x96')]);return db[_0x3d46('0x51')][_0x3d46('0x1a')]({'where':_0x4c9d86[_0x3d46('0x92')]})[_0x3d46('0x1d')](function(_0x1f6509){_0x1bad8f[_0x3d46('0x1a')]=_0x1f6509;_0x4c9d86[_0x3d46('0x97')]=[];if(_0x19d951['query']['includeAgent']){_0x4c9d86['include']['push']({'model':db[_0x3d46('0x6f')],'as':'User','attributes':['id',_0x3d46('0x45'),_0x3d46('0x7b')]});}if(_0x19d951[_0x3d46('0x34')]['includeAll']){_0x4c9d86[_0x3d46('0x97')]=[{'all':!![]}];}return db[_0x3d46('0x51')]['findAll'](_0x4c9d86);})[_0x3d46('0x1d')](function(_0x240a35){_0x1bad8f[_0x3d46('0x98')]=_0x240a35;return _0x1bad8f;});}})[_0x3d46('0x1d')](respondWithFilteredResult(_0x420612,_0x4c9d86))[_0x3d46('0x15')](handleError(_0x420612,null));};exports[_0x3d46('0x9b')]=function(_0x26b33a,_0x2117f5){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x26b33a[_0x3d46('0x31')]['id']}})['then'](handleEntityNotFound(_0x2117f5,null))['then'](function(_0x3effaf){if(_0x3effaf){return _0x3effaf[_0x3d46('0x9c')](_0x26b33a[_0x3d46('0x24')][_0x3d46('0x8a')],_['omit'](_0x26b33a[_0x3d46('0x24')],['ids','id'])||{})[_0x3d46('0x9d')](function(){return db[_0x3d46('0x9e')]['findAll']({'attributes':['id',_0x3d46('0x21'),_0x3d46('0x9f')],'where':{'id':_0x26b33a[_0x3d46('0x24')][_0x3d46('0x8a')]}});})['then'](function(_0x16e785){socket['emit'](_0x3d46('0xa0'),{'id':Number(_0x26b33a[_0x3d46('0x31')]['id']),'tags':_0x16e785||[]});return{'id':Number(_0x26b33a[_0x3d46('0x31')]['id']),'tags':_0x16e785||[]};});}})['then'](respondWithResult(_0x2117f5,null))['catch'](handleError(_0x2117f5,null));};exports[_0x3d46('0xa1')]=function(_0x38e78a,_0x3a2d7f){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x38e78a[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x3a2d7f,null))[_0x3d46('0x1d')](function(_0x3969a9){if(_0x3969a9){return _0x3969a9[_0x3d46('0xa1')](_0x38e78a[_0x3d46('0x34')][_0x3d46('0x8a')]);}})[_0x3d46('0x1d')](respondWithStatusCode(_0x3a2d7f,null))[_0x3d46('0x15')](handleError(_0x3a2d7f,null));};exports[_0x3d46('0x67')]=function(_0x5251b3,_0xaae522){var _0x550375=moment()['unix']()['toString']();var _0x35e908=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0xa2'),_0x3d46('0xa3'),'tmp');var _0x4b21bf=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0xa2'),'files','attachments');var _0x34e107=path[_0x3d46('0x63')](_0x35e908,_0x550375);var _0x471f1c=util['format'](_0x3d46('0xa4'),_0x5251b3['params']['id'],_0x550375);var _0x2d4e1b=path[_0x3d46('0x63')](_0x35e908,_0x471f1c);var _0xfa3c95=[];_0xfa3c95[_0x3d46('0xa5')]({'model':db['User'],'as':_0x3d46('0x6f'),'attributes':['id',_0x3d46('0x45')],'raw':!![]});_0xfa3c95[_0x3d46('0xa5')]({'model':db[_0x3d46('0x71')],'as':_0x3d46('0x54'),'attributes':['id',_0x3d46('0xa6'),'lastName'],'raw':!![]});if(_0x5251b3[_0x3d46('0x34')][_0x3d46('0xa7')]){_0xfa3c95['push']({'model':db['Attachment'],'as':_0x3d46('0x60'),'raw':!![]});}var _0x480b40=[{'model':db[_0x3d46('0x51')],'as':_0x3d46('0x6e'),'attributes':['id',_0x3d46('0x24'),_0x3d46('0x7e'),_0x3d46('0x80'),_0x3d46('0x81'),_0x3d46('0xa8')],'include':_0xfa3c95}];_0x480b40[_0x3d46('0xa5')]({'model':db[_0x3d46('0x3e')],'as':'Account','attributes':['id','name']});_0x480b40[_0x3d46('0xa5')]({'model':db[_0x3d46('0x6f')],'as':_0x3d46('0xa9'),'attributes':['id',_0x3d46('0x45')]});return db['ChatInteraction'][_0x3d46('0x39')]({'where':{'id':_0x5251b3['params']['id']},'include':_0x480b40})[_0x3d46('0x1d')](handleEntityNotFound(_0xaae522,null))[_0x3d46('0x1d')](function(_0x12b45b){if(_0x12b45b){var _0x262fcd=_0x12b45b[_0x3d46('0xaa')]({'plain':!![]});fs[_0x3d46('0xab')](_0x34e107);var _0x4adb53={'channel':'Chat','account':_0x262fcd[_0x3d46('0xac')][_0x3d46('0x21')],'agent':_0x262fcd[_0x3d46('0xa9')]?_0x262fcd[_0x3d46('0xa9')]['fullname']:_0x3d46('0xad'),'createdAt':moment(_0x262fcd[_0x3d46('0x7e')])[_0x3d46('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x262fcd[_0x3d46('0x59')]?moment(_0x262fcd['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3d46('0xae')]():'','disposition':_0x262fcd[_0x3d46('0xaf')],'chatInfo':{'browser':_0x262fcd[_0x3d46('0xb0')],'os':_0x262fcd['osName'],'referer':_0x262fcd[_0x3d46('0xb1')],'customerIp':_0x262fcd[_0x3d46('0xb2')],'customerPort':_0x262fcd[_0x3d46('0xb3')]?_0x262fcd[_0x3d46('0xb3')]:_0x3d46('0xad')},'messages':_(_0x262fcd['Messages'])['tail']()[_0x3d46('0x94')]({'secret':![]})['map'](function(_0x7bd9bb){if(_0x7bd9bb['Attachment']){var _0x33523a=path[_0x3d46('0x63')](_0x4b21bf,_0x7bd9bb[_0x3d46('0x60')]['basename']);if(fs[_0x3d46('0xb4')](_0x33523a)){fs[_0x3d46('0xb5')](_0x33523a)[_0x3d46('0xb6')](fs[_0x3d46('0xb7')](path[_0x3d46('0x63')](_0x34e107,_0x7bd9bb['Attachment'][_0x3d46('0x5d')])));}}return{'date':moment(_0x7bd9bb[_0x3d46('0x7e')])[_0x3d46('0x6a')](_0x3d46('0xb8'))[_0x3d46('0xae')](),'sender':_0x7bd9bb[_0x3d46('0x80')]==='out'?_0x7bd9bb['User']?_0x7bd9bb[_0x3d46('0x6f')][_0x3d46('0x45')]:_0x3d46('0x75'):_0x7bd9bb['Contact'][_0x3d46('0xa6')]+(_0x7bd9bb[_0x3d46('0x54')][_0x3d46('0xb9')]?'\x20'+_0x7bd9bb[_0x3d46('0x54')][_0x3d46('0xb9')]:''),'body':_0x7bd9bb[_0x3d46('0x60')]?_0x7bd9bb[_0x3d46('0x60')][_0x3d46('0x5d')]:_0x7bd9bb['body'],'direction':_0x7bd9bb[_0x3d46('0x80')]==='out'?'A':'C','secret':_0x7bd9bb['secret'],'read':_0x7bd9bb[_0x3d46('0xa8')],'attachment':_0x7bd9bb['Attachment']};})[_0x3d46('0xba')]()};return ejs[_0x3d46('0xbb')](path[_0x3d46('0x63')](config['root'],_0x3d46('0xa2'),_0x3d46('0xbc'),_0x3d46('0xbd')),{'interaction':_0x4adb53})['then'](function(_0x2190dc){var _0x1aff82=path[_0x3d46('0x63')](_0x34e107,'transcript-'+_0x262fcd['id']+'-'+_0x550375+'.pdf');var _0x144269={'path':_0x1aff82,'channel':_0x3d46('0xbe'),'interactionId':_0x262fcd['id']};return pdf[_0x3d46('0xbf')](_0x2190dc,_0x144269);})[_0x3d46('0x1d')](function(){return new Promise(function(_0x2e24a4,_0x436b79){zipdir(_0x34e107,{'saveTo':_0x2d4e1b},function(_0x223f05,_0x164996){if(_0x223f05)return _0x436b79(_0x223f05);return _0x2e24a4(_0x164996);});})['then'](function(){return new BPromise(function(_0x516f96,_0x2aa33c){rimraf(_0x34e107,function(_0x3c1744){if(_0x3c1744)_0x2aa33c(_0x3c1744);return _0x516f96();});});})[_0x3d46('0x1d')](function(){return _0xaae522[_0x3d46('0x67')](_0x2d4e1b,_0x471f1c,function(_0x37bda7){if(_0x37bda7){logger[_0x3d46('0x11')](_0x3d46('0xc0'),_0x37bda7);}else{fs[_0x3d46('0xc1')](_0x2d4e1b);}});});});}else{return _0xaae522['sendStatus'](0xc8);}})['catch'](handleError(_0xaae522,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index daee97d..c666144 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 _0x8b9b=['emit','hook','../../mysqldb','ChatInteraction','ChatMessage','save','update','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x14b72e,_0x3420ef){var _0x38fc95=function(_0x3a9c49){while(--_0x3a9c49){_0x14b72e['push'](_0x14b72e['shift']());}};_0x38fc95(++_0x3420ef);}(_0x8b9b,0x13a));var _0xb8b9=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0x8b9b[_0x31edbe];return _0x37fcee;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb8b9('0x0'))['db'][_0xb8b9('0x1')];var ChatMessage=require(_0xb8b9('0x0'))['db'][_0xb8b9('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8b9('0x3'),'afterUpdate':_0xb8b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fae47){return function(_0x294d8a,_0x581e0a,_0x365739){_0x294d8a['getUsers']({'attributes':['id'],'raw':!![]})[_0xb8b9('0x5')](function(_0x281aca){_0x294d8a[_0xb8b9('0x6')]('Users',_0x281aca[_0xb8b9('0x7')](function(_0x3cae41){return{'id':_0x3cae41['id']};}));return ChatMessage[_0xb8b9('0x8')]({'where':{'ChatInteractionId':_0x294d8a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb8b9('0x5')](function(_0x3c5383){_0x294d8a['setDataValue'](_0xb8b9('0x9'),_0x3c5383[_0xb8b9('0xa')]);ChatInteractionEvents[_0xb8b9('0xb')](_0x2fae47+':'+_0x294d8a['id'],_0x294d8a);ChatInteractionEvents[_0xb8b9('0xb')](_0x2fae47,_0x294d8a);_0x365739(null);})['catch'](_0x365739(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb8b9('0xc')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x0c56=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','setDataValue','Users','then','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c56,0x97));var _0x60c5=function(_0x55c334,_0x2529b0){_0x55c334=_0x55c334-0x0;var _0xc2fc54=_0x0c56[_0x55c334];return _0xc2fc54;};'use strict';var EventEmitter=require(_0x60c5('0x0'));var ChatInteraction=require(_0x60c5('0x1'))['db'][_0x60c5('0x2')];var ChatMessage=require(_0x60c5('0x1'))['db'][_0x60c5('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x60c5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x60c5('0x5'),'afterDestroy':_0x60c5('0x6')};function emitEvent(_0x5cf68f){return function(_0x1ac38b,_0x3e22ec,_0x27f8a8){_0x1ac38b['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3a11eb){_0x1ac38b[_0x60c5('0x7')](_0x60c5('0x8'),_0x3a11eb['map'](function(_0x3d8ffa){return{'id':_0x3d8ffa['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1ac38b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x60c5('0x9')](function(_0x5b6501){_0x1ac38b[_0x60c5('0x7')](_0x60c5('0xa'),_0x5b6501['length']);ChatInteractionEvents['emit'](_0x5cf68f+':'+_0x1ac38b['id'],_0x1ac38b);ChatInteractionEvents[_0x60c5('0xb')](_0x5cf68f,_0x1ac38b);_0x27f8a8(null);})['catch'](_0x27f8a8(null));};}for(var e in events){if(events[_0x60c5('0xc')](e)){var event=events[e];ChatInteraction[_0x60c5('0xd')](e,emitEvent(event));}}module[_0x60c5('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e6023e9..e8f792c 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 _0x7ce9=['define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x1155d7,_0x1cc6dd){var _0x5c2d4f=function(_0x437cac){while(--_0x437cac){_0x1155d7['push'](_0x1155d7['shift']());}};_0x5c2d4f(++_0x1cc6dd);}(_0x7ce9,0xd8));var _0x97ce=function(_0x21bad5,_0x23a39d){_0x21bad5=_0x21bad5-0x0;var _0x235106=_0x7ce9[_0x21bad5];return _0x235106;};'use strict';var _=require(_0x97ce('0x0'));var util=require(_0x97ce('0x1'));var logger=require('../../config/logger')(_0x97ce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97ce('0x3'));var rimraf=require(_0x97ce('0x4'));var config=require(_0x97ce('0x5'));var attributes=require(_0x97ce('0x6'));module[_0x97ce('0x7')]=function(_0x3f37b9,_0x1894ec){return _0x3f37b9[_0x97ce('0x8')](_0x97ce('0x9'),attributes,{'tableName':_0x97ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24f548,_0xfa20e0,_0x344fc7){if(_0x24f548[_0x97ce('0xb')](_0x97ce('0xc'))){_0x24f548['closedAt']=moment()[_0x97ce('0xd')](_0x97ce('0xe'));}_0x344fc7(null,_0x24f548);}},'charset':'utf8mb4','collate':_0x97ce('0xf')});}; \ No newline at end of file +var _0xc518=['bluebird','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment'];(function(_0x5367c5,_0x439de4){var _0x22c25e=function(_0x54317c){while(--_0x54317c){_0x5367c5['push'](_0x5367c5['shift']());}};_0x22c25e(++_0x439de4);}(_0xc518,0x6d));var _0x8c51=function(_0x12ac1f,_0x461a52){_0x12ac1f=_0x12ac1f-0x0;var _0x724467=_0xc518[_0x12ac1f];return _0x724467;};'use strict';var _=require(_0x8c51('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c51('0x1'));var moment=require(_0x8c51('0x2'));var BPromise=require(_0x8c51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c51('0x4'));var rimraf=require(_0x8c51('0x5'));var config=require(_0x8c51('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x8c51('0x7')]=function(_0x23586e,_0x573f86){return _0x23586e[_0x8c51('0x8')](_0x8c51('0x9'),attributes,{'tableName':_0x8c51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11a8a2,_0x25e78e,_0x439a9f){if(_0x11a8a2[_0x8c51('0xb')]('closed')){_0x11a8a2[_0x8c51('0xc')]=moment()['format'](_0x8c51('0xd'));}_0x439a9f(null,_0x11a8a2);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 90889b8..3607628 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 _0x0b76=['spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ChatInteraction','update','raw','where','attributes','options','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','find','omit','body','ids'];(function(_0x33d22b,_0x30364b){var _0x2abcd5=function(_0x5d14da){while(--_0x5d14da){_0x33d22b['push'](_0x33d22b['shift']());}};_0x2abcd5(++_0x30364b);}(_0x0b76,0x1d6));var _0x60b7=function(_0x14682b,_0x32aa32){_0x14682b=_0x14682b-0x0;var _0x1fa061=_0x0b76[_0x14682b];return _0x1fa061;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var moment=require(_0x60b7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b7('0x4'));var logger=require(_0x60b7('0x5'))('rpc');var config=require(_0x60b7('0x6'));var jayson=require(_0x60b7('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x60b7('0x8')]=_[_0x60b7('0x9')](config[_0x60b7('0x8')],{'host':_0x60b7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60b7('0x8')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x227b65,_0x2298a7,_0x2b9e56){return new BPromise(function(_0xff0a07,_0xc371e8){return client[_0x60b7('0xb')](_0x227b65,_0x2b9e56)[_0x60b7('0xc')](function(_0x56ab71){logger['info'](_0x60b7('0xd'),_0x2298a7,_0x60b7('0xe'));logger[_0x60b7('0xf')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2298a7,'request\x20sent',JSON['stringify'](_0x56ab71));if(_0x56ab71['error']){if(_0x56ab71[_0x60b7('0x10')][_0x60b7('0x11')]===0x1f4){logger[_0x60b7('0x10')](_0x60b7('0xd'),_0x2298a7,_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);return _0xc371e8(_0x56ab71[_0x60b7('0x10')]['message']);}logger[_0x60b7('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x2298a7,_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);return _0xff0a07(_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);}else{logger['info'](_0x60b7('0xd'),_0x2298a7,_0x60b7('0xe'));_0xff0a07(_0x56ab71[_0x60b7('0x13')][_0x60b7('0x12')]);}})['catch'](function(_0x3414f3){logger[_0x60b7('0x10')](_0x60b7('0xd'),_0x2298a7,_0x3414f3);_0xc371e8(_0x3414f3);});});}exports['UpdateChatInteraction']=function(_0xc0f31){var _0x46a176=this;return new Promise(function(_0x1b59e7,_0x537605){return db[_0x60b7('0x14')][_0x60b7('0x15')](_0xc0f31['body'],{'raw':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x17')]||null:null,'attributes':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x18')]||null:null,'limit':_0xc0f31[_0x60b7('0x19')]?_0xc0f31[_0x60b7('0x19')]['limit']||null:null})[_0x60b7('0xc')](function(_0x1bdd64){logger['info'](_0x60b7('0x1a'),_0xc0f31);logger[_0x60b7('0xf')](_0x60b7('0x1a'),_0xc0f31,JSON[_0x60b7('0x1b')](_0x1bdd64));_0x1b59e7(_0x1bdd64);})[_0x60b7('0x1c')](function(_0x41a00b){logger[_0x60b7('0x10')](_0x60b7('0x1a'),_0x41a00b[_0x60b7('0x12')],_0xc0f31);_0x537605(_0x46a176[_0x60b7('0x10')](0x1f4,_0x41a00b[_0x60b7('0x12')]));});});};exports[_0x60b7('0x1d')]=function(_0x4aa7b4){return new Promise(function(_0x54a446,_0x522963){return db[_0x60b7('0x14')][_0x60b7('0x1e')]({'where':_0x4aa7b4[_0x60b7('0x19')]?_0x4aa7b4[_0x60b7('0x19')]['where']||null:null})[_0x60b7('0xc')](function(_0xce1570){if(_0xce1570){return _0xce1570['addTags'](_0x4aa7b4['body']['ids'],_[_0x60b7('0x1f')](_0x4aa7b4[_0x60b7('0x20')],[_0x60b7('0x21'),'id'])||{});}})[_0x60b7('0x22')](function(_0x1cb9bf){logger['info']('AddTags',_0x4aa7b4);logger[_0x60b7('0xf')](_0x60b7('0x23'),_0x4aa7b4,JSON['stringify'](_0x1cb9bf));_0x54a446(_0x1cb9bf);})['catch'](function(_0x2a5af0){logger['error']('AddTags',_0x2a5af0[_0x60b7('0x12')],_0x4aa7b4);_0x522963(_this[_0x60b7('0x10')](0x1f4,_0x2a5af0['message']));});});}; \ No newline at end of file +var _0x63ce=['body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update'];(function(_0x4ccefa,_0xcbf16){var _0x163fc6=function(_0x3baec4){while(--_0x3baec4){_0x4ccefa['push'](_0x4ccefa['shift']());}};_0x163fc6(++_0xcbf16);}(_0x63ce,0x111));var _0xe63c=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x63ce[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0xe63c('0x0'));var util=require(_0xe63c('0x1'));var moment=require('moment');var BPromise=require(_0xe63c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe63c('0x3'));var db=require(_0xe63c('0x4'))['db'];var utils=require(_0xe63c('0x5'));var logger=require('../../config/logger')(_0xe63c('0x6'));var config=require(_0xe63c('0x7'));var jayson=require(_0xe63c('0x8'));var client=jayson[_0xe63c('0x9')][_0xe63c('0xa')]({'port':0x232a});config['redis']=_[_0xe63c('0xb')](config[_0xe63c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe63c('0xd'))(new Redis(config[_0xe63c('0xc')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x313de5,_0x1e3230,_0x3c03d1){return new BPromise(function(_0x542c71,_0x75c546){return client[_0xe63c('0xe')](_0x313de5,_0x3c03d1)[_0xe63c('0xf')](function(_0x8cf663){logger['info'](_0xe63c('0x10'),_0x1e3230,_0xe63c('0x11'));logger[_0xe63c('0x12')](_0xe63c('0x13'),_0x1e3230,_0xe63c('0x11'),JSON[_0xe63c('0x14')](_0x8cf663));if(_0x8cf663[_0xe63c('0x15')]){if(_0x8cf663[_0xe63c('0x15')][_0xe63c('0x16')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1e3230,_0x8cf663[_0xe63c('0x15')]['message']);return _0x75c546(_0x8cf663[_0xe63c('0x15')]['message']);}logger['error'](_0xe63c('0x10'),_0x1e3230,_0x8cf663[_0xe63c('0x15')][_0xe63c('0x17')]);return _0x542c71(_0x8cf663[_0xe63c('0x15')][_0xe63c('0x17')]);}else{logger[_0xe63c('0x18')](_0xe63c('0x10'),_0x1e3230,_0xe63c('0x11'));_0x542c71(_0x8cf663[_0xe63c('0x19')][_0xe63c('0x17')]);}})[_0xe63c('0x1a')](function(_0x24a802){logger[_0xe63c('0x15')](_0xe63c('0x10'),_0x1e3230,_0x24a802);_0x75c546(_0x24a802);});});}exports['UpdateChatInteraction']=function(_0x20a9d9){var _0xc4c00e=this;return new Promise(function(_0x4519b3,_0x5034ef){return db['ChatInteraction'][_0xe63c('0x1b')](_0x20a9d9[_0xe63c('0x1c')],{'raw':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9['options'][_0xe63c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20a9d9['options']?_0x20a9d9['options'][_0xe63c('0x1f')]||null:null,'attributes':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9[_0xe63c('0x1d')][_0xe63c('0x20')]||null:null,'limit':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9['options'][_0xe63c('0x21')]||null:null})[_0xe63c('0xf')](function(_0xb37f){logger[_0xe63c('0x18')]('UpdateChatInteraction',_0x20a9d9);logger[_0xe63c('0x12')](_0xe63c('0x22'),_0x20a9d9,JSON[_0xe63c('0x14')](_0xb37f));_0x4519b3(_0xb37f);})[_0xe63c('0x1a')](function(_0x55fc85){logger[_0xe63c('0x15')]('UpdateChatInteraction',_0x55fc85[_0xe63c('0x17')],_0x20a9d9);_0x5034ef(_0xc4c00e['error'](0x1f4,_0x55fc85[_0xe63c('0x17')]));});});};exports[_0xe63c('0x23')]=function(_0x44b183){return new Promise(function(_0x43075a,_0x3ff052){return db[_0xe63c('0x24')][_0xe63c('0x25')]({'where':_0x44b183[_0xe63c('0x1d')]?_0x44b183[_0xe63c('0x1d')]['where']||null:null})[_0xe63c('0xf')](function(_0x1188c6){if(_0x1188c6){return _0x1188c6[_0xe63c('0x26')](_0x44b183[_0xe63c('0x1c')][_0xe63c('0x27')],_[_0xe63c('0x28')](_0x44b183[_0xe63c('0x1c')],[_0xe63c('0x27'),'id'])||{});}})[_0xe63c('0x29')](function(_0x426509){logger['info'](_0xe63c('0x2a'),_0x44b183);logger[_0xe63c('0x12')](_0xe63c('0x2a'),_0x44b183,JSON[_0xe63c('0x14')](_0x426509));_0x43075a(_0x426509);})['catch'](function(_0x471d42){logger[_0xe63c('0x15')]('AddTags',_0x471d42[_0xe63c('0x17')],_0x44b183);_0x3ff052(_this[_0xe63c('0x15')](0x1f4,_0x471d42['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 864cce1..090d614 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 _0x07ef=['save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x1aa825,_0x3c8504){var _0x18c654=function(_0x3aa5dc){while(--_0x3aa5dc){_0x1aa825['push'](_0x1aa825['shift']());}};_0x18c654(++_0x3c8504);}(_0x07ef,0x12d));var _0xf07e=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x07ef[_0x55c3d9];return _0x19fd97;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xf07e('0x0'),_0xf07e('0x1'),_0xf07e('0x2')];function createListener(_0x52d43b,_0x39aa77){return function(_0x245689){_0x39aa77[_0xf07e('0x3')](_0x52d43b,_0x245689);};}function removeListener(_0x1b282e,_0x1f8b13){return function(){ChatInteractionEvents[_0xf07e('0x4')](_0x1b282e,_0x1f8b13);};}exports['register']=function(_0x1cabd8){for(var _0x3f685a=0x0,_0x151a67=events[_0xf07e('0x5')];_0x3f685a<_0x151a67;_0x3f685a++){var _0x34c899=events[_0x3f685a];var _0x471e1d=createListener(_0xf07e('0x6')+_0x34c899,_0x1cabd8);ChatInteractionEvents['on'](_0x34c899,_0x471e1d);}}; \ No newline at end of file +var _0x69db=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x57a2a6,_0x3d21b2){var _0x74724a=function(_0x5918cc){while(--_0x5918cc){_0x57a2a6['push'](_0x57a2a6['shift']());}};_0x74724a(++_0x3d21b2);}(_0x69db,0x106));var _0xb69d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x69db[_0x2dafbe];return _0x58a45a;};'use strict';var ChatInteractionEvents=require(_0xb69d('0x0'));var events=[_0xb69d('0x1'),'remove',_0xb69d('0x2')];function createListener(_0x264d83,_0xb8a9d7){return function(_0x4334fa){_0xb8a9d7[_0xb69d('0x3')](_0x264d83,_0x4334fa);};}function removeListener(_0x40ad08,_0x1ac2c6){return function(){ChatInteractionEvents[_0xb69d('0x4')](_0x40ad08,_0x1ac2c6);};}exports[_0xb69d('0x5')]=function(_0x13d2c1){for(var _0x29ed58=0x0,_0x2f39b5=events[_0xb69d('0x6')];_0x29ed58<_0x2f39b5;_0x29ed58++){var _0x297707=events[_0x29ed58];var _0x51b684=createListener(_0xb69d('0x7')+_0x297707,_0x13d2c1);ChatInteractionEvents['on'](_0x297707,_0x51b684);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 943d114..ebce9a2 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 _0xc03d=['path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chat','chatinteraction:update','update','customUpdate','abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','util'];(function(_0x53be66,_0x9ec3be){var _0x9e5520=function(_0x5c4742){while(--_0x5c4742){_0x53be66['push'](_0x53be66['shift']());}};_0x9e5520(++_0x9ec3be);}(_0xc03d,0xf4));var _0xdc03=function(_0x38ef05,_0x39b256){_0x38ef05=_0x38ef05-0x0;var _0x4352a4=_0xc03d[_0x38ef05];return _0x4352a4;};'use strict';var multer=require('multer');var util=require(_0xdc03('0x0'));var path=require(_0xdc03('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc03('0x2'));var router=express[_0xdc03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc03('0x4'));var interaction=require(_0xdc03('0x5'));var config=require('../../config/environment');var controller=require(_0xdc03('0x6'));router[_0xdc03('0x7')]('/',auth[_0xdc03('0x8')](),controller['index']);router[_0xdc03('0x7')](_0xdc03('0x9'),auth['isAuthenticated'](),controller[_0xdc03('0xa')]);router[_0xdc03('0x7')]('/:id',auth[_0xdc03('0xb')](),controller['show']);router[_0xdc03('0x7')](_0xdc03('0xc'),auth[_0xdc03('0xb')](),controller['attachmentDownload']);router['get'](_0xdc03('0xd'),auth[_0xdc03('0x8')](),controller[_0xdc03('0xe')]);router[_0xdc03('0x7')]('/:id/my_messages',auth[_0xdc03('0xb')](),controller[_0xdc03('0xf')]);router[_0xdc03('0x7')](_0xdc03('0x10'),auth['isAuthenticated'](),controller[_0xdc03('0x11')]);router[_0xdc03('0x12')]('/',auth[_0xdc03('0x8')](),controller[_0xdc03('0x13')]);router[_0xdc03('0x12')](_0xdc03('0x14'),auth[_0xdc03('0x8')](),controller[_0xdc03('0x15')]);var upload=multer({'storage':multer[_0xdc03('0x16')]({'destination':function(_0x560650,_0x18035f,_0xa6b666){_0xa6b666(null,path[_0xdc03('0x17')](config[_0xdc03('0x18')],_0xdc03('0x19')));},'filename':function(_0x1b738b,_0x3c1899,_0x78c27b){_0x78c27b(null,util[_0xdc03('0x1a')](_0xdc03('0x1b'),Date[_0xdc03('0x1c')](),_0x3c1899['originalname'][_0xdc03('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdc03('0x12')](_0xdc03('0x1e'),upload[_0xdc03('0x1f')]('file'),controller[_0xdc03('0x20')]);router[_0xdc03('0x12')](_0xdc03('0xd'),auth[_0xdc03('0xb')](),controller[_0xdc03('0x21')]);router[_0xdc03('0x12')](_0xdc03('0x22'),auth['isAuthenticated'](),interaction[_0xdc03('0x23')]('chat',_0xdc03('0x24')),controller['addTags']);router[_0xdc03('0x25')](_0xdc03('0x26'),auth[_0xdc03('0x8')](),interaction[_0xdc03('0x23')](_0xdc03('0x27'),_0xdc03('0x28')),controller[_0xdc03('0x29')]);router['put']('/:id/custom_update',controller[_0xdc03('0x2a')]);router[_0xdc03('0x25')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xdc03('0x2b')]);router[_0xdc03('0x25')]('/:id/close',controller['close']);router[_0xdc03('0x2c')](_0xdc03('0x26'),auth[_0xdc03('0x8')](),interaction['tracked'](_0xdc03('0x27'),_0xdc03('0x2d')),controller[_0xdc03('0x2e')]);router[_0xdc03('0x2c')](_0xdc03('0x22'),auth[_0xdc03('0x8')](),controller[_0xdc03('0x2f')]);module[_0xdc03('0x30')]=router; \ No newline at end of file +var _0x5749=['/:id/tags','tracked','chat','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage'];(function(_0x4a538c,_0x50804b){var _0x552930=function(_0x49e6db){while(--_0x49e6db){_0x4a538c['push'](_0x4a538c['shift']());}};_0x552930(++_0x50804b);}(_0x5749,0x148));var _0x9574=function(_0x4584a2,_0x56e5d9){_0x4584a2=_0x4584a2-0x0;var _0x2510e0=_0x5749[_0x4584a2];return _0x2510e0;};'use strict';var multer=require('multer');var util=require(_0x9574('0x0'));var path=require('path');var timeout=require(_0x9574('0x1'));var express=require(_0x9574('0x2'));var router=express[_0x9574('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9574('0x4'));var interaction=require(_0x9574('0x5'));var config=require(_0x9574('0x6'));var controller=require('./chatInteraction.controller');router[_0x9574('0x7')]('/',auth[_0x9574('0x8')](),controller[_0x9574('0x9')]);router[_0x9574('0x7')](_0x9574('0xa'),auth[_0x9574('0x8')](),controller[_0x9574('0xb')]);router['get'](_0x9574('0xc'),auth[_0x9574('0xd')](),controller['show']);router[_0x9574('0x7')](_0x9574('0xe'),auth[_0x9574('0xd')](),controller[_0x9574('0xf')]);router[_0x9574('0x7')](_0x9574('0x10'),auth[_0x9574('0x8')](),controller[_0x9574('0x11')]);router[_0x9574('0x7')]('/:id/my_messages',auth[_0x9574('0xd')](),controller[_0x9574('0x12')]);router[_0x9574('0x7')](_0x9574('0x13'),auth[_0x9574('0x8')](),controller[_0x9574('0x14')]);router[_0x9574('0x15')]('/',auth[_0x9574('0x8')](),controller['create']);router['post']('/:id/vidaoo',auth[_0x9574('0x8')](),controller[_0x9574('0x16')]);var upload=multer({'storage':multer[_0x9574('0x17')]({'destination':function(_0x19c507,_0x1019c5,_0x3ec19f){_0x3ec19f(null,path[_0x9574('0x18')](config[_0x9574('0x19')],_0x9574('0x1a')));},'filename':function(_0x5ad45b,_0x1fff1a,_0x871cdf){_0x871cdf(null,util[_0x9574('0x1b')](_0x9574('0x1c'),Date[_0x9574('0x1d')](),_0x1fff1a[_0x9574('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9574('0x15')](_0x9574('0x1f'),upload[_0x9574('0x20')](_0x9574('0x21')),controller[_0x9574('0x22')]);router[_0x9574('0x15')](_0x9574('0x10'),auth[_0x9574('0xd')](),controller[_0x9574('0x23')]);router[_0x9574('0x15')](_0x9574('0x24'),auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),'chatinteraction:addtags'),controller[_0x9574('0x27')]);router[_0x9574('0x28')](_0x9574('0xc'),auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),'chatinteraction:update'),controller[_0x9574('0x29')]);router[_0x9574('0x28')](_0x9574('0x2a'),controller[_0x9574('0x2b')]);router['put'](_0x9574('0x2c'),auth[_0x9574('0xd')](),controller[_0x9574('0x2d')]);router[_0x9574('0x28')](_0x9574('0x2e'),controller[_0x9574('0x2f')]);router[_0x9574('0x30')]('/:id',auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),_0x9574('0x31')),controller[_0x9574('0x32')]);router['delete'](_0x9574('0x24'),auth['isAuthenticated'](),controller[_0x9574('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 31c8b44..016b01e 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 _0x8dc7=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2b1d63,_0x143c51){var _0x56dec0=function(_0x5dad38){while(--_0x5dad38){_0x2b1d63['push'](_0x2b1d63['shift']());}};_0x56dec0(++_0x143c51);}(_0x8dc7,0x1b5));var _0x78dc=function(_0x1da56b,_0x356602){_0x1da56b=_0x1da56b-0x0;var _0x51e2ba=_0x8dc7[_0x1da56b];return _0x51e2ba;};'use strict';var Sequelize=require(_0x78dc('0x0'));module[_0x78dc('0x1')]={'body':{'type':Sequelize[_0x78dc('0x2')](_0x78dc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x78dc('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x78dc('0x5')]}}; \ No newline at end of file +var _0x7fc9=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7fc9,0xee));var _0x97fc=function(_0xe61544,_0x30b2d2){_0xe61544=_0xe61544-0x0;var _0x58cc3e=_0x7fc9[_0xe61544];return _0x58cc3e;};'use strict';var Sequelize=require(_0x97fc('0x0'));module[_0x97fc('0x1')]={'body':{'type':Sequelize[_0x97fc('0x2')](_0x97fc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x97fc('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x97fc('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 046bd8e..8dcfc30 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 _0x5a92=['UserProfileResource','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x1a8b6f,_0x3aebf7){var _0x2f8ff2=function(_0x47f677){while(--_0x47f677){_0x1a8b6f['push'](_0x1a8b6f['shift']());}};_0x2f8ff2(++_0x3aebf7);}(_0x5a92,0x75));var _0x25a9=function(_0x591583,_0x255a3e){_0x591583=_0x591583-0x0;var _0x345ddd=_0x5a92[_0x591583];return _0x345ddd;};'use strict';var emlformat=require(_0x25a9('0x0'));var rimraf=require(_0x25a9('0x1'));var zipdir=require(_0x25a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25a9('0x3'));var moment=require(_0x25a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25a9('0x5'));var util=require(_0x25a9('0x6'));var path=require('path');var sox=require(_0x25a9('0x7'));var csv=require(_0x25a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25a9('0x9'));var squel=require('squel');var crypto=require(_0x25a9('0xa'));var jsforce=require(_0x25a9('0xb'));var deskjs=require(_0x25a9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x25a9('0xd'));var Papa=require(_0x25a9('0xe'));var Redis=require(_0x25a9('0xf'));var authService=require(_0x25a9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25a9('0x11'));var logger=require(_0x25a9('0x12'))(_0x25a9('0x13'));var utils=require(_0x25a9('0x14'));var config=require(_0x25a9('0x15'));var licenseUtil=require(_0x25a9('0x16'));var db=require('../../mysqldb')['db'];config[_0x25a9('0x17')]=_[_0x25a9('0x18')](config[_0x25a9('0x17')],{'host':_0x25a9('0x19'),'port':0x18eb});var socket=require(_0x25a9('0x1a'))(new Redis(config[_0x25a9('0x17')]));require(_0x25a9('0x1b'))['register'](socket);function respondWithStatusCode(_0x47e807,_0x3e0608){_0x3e0608=_0x3e0608||0xcc;return function(_0x19addf){if(_0x19addf){return _0x47e807[_0x25a9('0x1c')](_0x3e0608);}return _0x47e807[_0x25a9('0x1d')](_0x3e0608)[_0x25a9('0x1e')]();};}function respondWithResult(_0x714890,_0x99d906){_0x99d906=_0x99d906||0xc8;return function(_0x5f3cd0){if(_0x5f3cd0){return _0x714890['status'](_0x99d906)['json'](_0x5f3cd0);}};}function respondWithFilteredResult(_0x7e31e0,_0x346591){return function(_0x41ecf2){if(_0x41ecf2){var _0x544cda=typeof _0x346591[_0x25a9('0x1f')]===_0x25a9('0x20')&&typeof _0x346591[_0x25a9('0x21')]===_0x25a9('0x20');var _0x4b54b0=_0x41ecf2[_0x25a9('0x22')];var _0x3d0c31=_0x544cda?0x0:_0x346591[_0x25a9('0x1f')];var _0x3dd674=_0x544cda?_0x41ecf2['count']:_0x346591[_0x25a9('0x1f')]+_0x346591['limit'];var _0x1621f1;if(_0x3dd674>=_0x4b54b0){_0x3dd674=_0x4b54b0;_0x1621f1=0xc8;}else{_0x1621f1=0xce;}_0x7e31e0['status'](_0x1621f1);return _0x7e31e0[_0x25a9('0x23')](_0x25a9('0x24'),_0x3d0c31+'-'+_0x3dd674+'/'+_0x4b54b0)[_0x25a9('0x25')](_0x41ecf2);}return null;};}function patchUpdates(_0x53c73f){return function(_0x3998d7){try{jsonpatch['apply'](_0x3998d7,_0x53c73f,!![]);}catch(_0x436e48){return BPromise[_0x25a9('0x26')](_0x436e48);}return _0x3998d7[_0x25a9('0x27')]();};}function saveUpdates(_0x1ac89e,_0x17dac6){return function(_0x271586){if(_0x271586){return _0x271586['update'](_0x1ac89e)[_0x25a9('0x28')](function(_0x468964){return _0x468964;});}return null;};}function removeEntity(_0x360c74,_0x5e660a){return function(_0x515c2e){if(_0x515c2e){return _0x515c2e[_0x25a9('0x29')]()[_0x25a9('0x28')](function(){_0x360c74['status'](0xcc)[_0x25a9('0x1e')]();});}};}function handleEntityNotFound(_0x5b4931,_0x279672){return function(_0x2622f8){if(!_0x2622f8){_0x5b4931['sendStatus'](0x194);}return _0x2622f8;};}function handleError(_0x1c0641,_0x1e35ba){_0x1e35ba=_0x1e35ba||0x1f4;return function(_0x3c1d81){logger[_0x25a9('0x2a')](_0x3c1d81['stack']);if(_0x3c1d81[_0x25a9('0x2b')]){delete _0x3c1d81['name'];}_0x1c0641[_0x25a9('0x1d')](_0x1e35ba)[_0x25a9('0x2c')](_0x3c1d81);};}exports[_0x25a9('0x2d')]=function(_0x10166b,_0x308c5e){var _0x9a02a2={},_0x127987={},_0x132f5a={'count':0x0,'rows':[]};var _0x2e725d=_['map'](db[_0x25a9('0x2e')][_0x25a9('0x2f')],function(_0x1e605d){return{'name':_0x1e605d[_0x25a9('0x30')],'type':_0x1e605d[_0x25a9('0x31')][_0x25a9('0x32')]};});_0x127987[_0x25a9('0x33')]=_[_0x25a9('0x34')](_0x2e725d,_0x25a9('0x2b'));_0x127987[_0x25a9('0x35')]=_['keys'](_0x10166b[_0x25a9('0x35')]);_0x127987[_0x25a9('0x36')]=_[_0x25a9('0x37')](_0x127987[_0x25a9('0x33')],_0x127987[_0x25a9('0x35')]);_0x9a02a2[_0x25a9('0x38')]=_['intersection'](_0x127987[_0x25a9('0x33')],qs[_0x25a9('0x39')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x39')]));_0x9a02a2['attributes']=_0x9a02a2[_0x25a9('0x38')][_0x25a9('0x3a')]?_0x9a02a2[_0x25a9('0x38')]:_0x127987[_0x25a9('0x33')];if(!_0x10166b[_0x25a9('0x35')]['hasOwnProperty'](_0x25a9('0x3b'))){_0x9a02a2[_0x25a9('0x21')]=qs[_0x25a9('0x21')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x21')]);_0x9a02a2[_0x25a9('0x1f')]=qs[_0x25a9('0x1f')](_0x10166b[_0x25a9('0x35')]['offset']);}_0x9a02a2['order']=qs[_0x25a9('0x3c')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x3c')]);_0x9a02a2[_0x25a9('0x3d')]=qs[_0x25a9('0x36')](_[_0x25a9('0x3e')](_0x10166b[_0x25a9('0x35')],_0x127987[_0x25a9('0x36')]),_0x2e725d);if(_0x10166b[_0x25a9('0x35')][_0x25a9('0x3f')]){_0x9a02a2['where']=_['merge'](_0x9a02a2[_0x25a9('0x3d')],{'$or':_['map'](_0x2e725d,function(_0x56207b){if(_0x56207b[_0x25a9('0x31')]!==_0x25a9('0x40')){var _0x4ab1e2={};_0x4ab1e2[_0x56207b[_0x25a9('0x2b')]]={'$like':'%'+_0x10166b[_0x25a9('0x35')]['filter']+'%'};return _0x4ab1e2;}})});}_0x9a02a2=_[_0x25a9('0x41')]({},_0x9a02a2,_0x10166b[_0x25a9('0x42')]);var _0x455888={'where':_0x9a02a2[_0x25a9('0x3d')]};return db[_0x25a9('0x2e')][_0x25a9('0x22')](_0x455888)['then'](function(_0x316b49){_0x132f5a[_0x25a9('0x22')]=_0x316b49;if(_0x10166b[_0x25a9('0x35')][_0x25a9('0x43')]){_0x9a02a2[_0x25a9('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x9a02a2);})['then'](function(_0xd51a5){_0x132f5a['rows']=_0xd51a5;return _0x132f5a;})[_0x25a9('0x28')](respondWithFilteredResult(_0x308c5e,_0x9a02a2))[_0x25a9('0x45')](handleError(_0x308c5e,null));};exports[_0x25a9('0x46')]=function(_0x3f23cc,_0xca7971){var _0x4c9766={'raw':!![],'where':{'id':_0x3f23cc[_0x25a9('0x47')]['id']}},_0x225810={};_0x225810[_0x25a9('0x33')]=_['keys'](db[_0x25a9('0x2e')][_0x25a9('0x2f')]);_0x225810[_0x25a9('0x35')]=_[_0x25a9('0x48')](_0x3f23cc['query']);_0x225810[_0x25a9('0x36')]=_[_0x25a9('0x37')](_0x225810[_0x25a9('0x33')],_0x225810['query']);_0x4c9766[_0x25a9('0x38')]=_[_0x25a9('0x37')](_0x225810[_0x25a9('0x33')],qs[_0x25a9('0x39')](_0x3f23cc[_0x25a9('0x35')][_0x25a9('0x39')]));_0x4c9766['attributes']=_0x4c9766[_0x25a9('0x38')][_0x25a9('0x3a')]?_0x4c9766[_0x25a9('0x38')]:_0x225810[_0x25a9('0x33')];if(_0x3f23cc['query']['includeAll']){_0x4c9766['include']=[{'all':!![]}];}_0x4c9766=_['merge']({},_0x4c9766,_0x3f23cc[_0x25a9('0x42')]);return db[_0x25a9('0x2e')][_0x25a9('0x49')](_0x4c9766)['then'](handleEntityNotFound(_0xca7971,null))[_0x25a9('0x28')](respondWithResult(_0xca7971,null))[_0x25a9('0x45')](handleError(_0xca7971,null));};exports['create']=function(_0x19e121,_0x2d8501){return db[_0x25a9('0x2e')][_0x25a9('0x4a')](_0x19e121['body'],{})[_0x25a9('0x28')](respondWithResult(_0x2d8501,0xc9))[_0x25a9('0x45')](handleError(_0x2d8501,null));};exports['update']=function(_0x5a33ba,_0x24cc32){if(_0x5a33ba[_0x25a9('0x4b')]['id']){delete _0x5a33ba[_0x25a9('0x4b')]['id'];}return db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'id':_0x5a33ba[_0x25a9('0x47')]['id']}})[_0x25a9('0x28')](handleEntityNotFound(_0x24cc32,null))['then'](saveUpdates(_0x5a33ba[_0x25a9('0x4b')],null))[_0x25a9('0x28')](respondWithResult(_0x24cc32,null))[_0x25a9('0x45')](handleError(_0x24cc32,null));};exports['destroy']=function(_0x49f038,_0x1623f1){return db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'id':_0x49f038['params']['id']}})['then'](handleEntityNotFound(_0x1623f1,null))[_0x25a9('0x28')](removeEntity(_0x1623f1,null))['catch'](handleError(_0x1623f1,null));};exports[_0x25a9('0x4c')]=function(_0xeac259,_0x90fd58){return db[_0x25a9('0x2e')]['describe']()['then'](respondWithResult(_0x90fd58,null))[_0x25a9('0x45')](handleError(_0x90fd58,null));};function wrapUser(_0x56b634){return function(_0x3ccd9e){var _0x140efe=_0x56b634[_0x25a9('0x4d')]({'plain':!![]});_0x140efe[_0x25a9('0x4e')]=[];if(_0x3ccd9e){_0x140efe[_0x25a9('0x4f')]=_0x3ccd9e[_0x25a9('0x50')];_0x140efe[_0x25a9('0x51')]=_0x3ccd9e;}else{_0x140efe['lastMessageAt']=moment(0x0)[_0x25a9('0x52')](_0x25a9('0x53'));_0x140efe['lastMessage']={};}return _0x140efe;};}exports['getUsers']=function(_0x4488bb,_0x2e9cab,_0x1d15f7){var _0xd645c4=[];return db[_0x25a9('0x54')][_0x25a9('0x55')]({'where':{'role':[_0x25a9('0x56'),_0x25a9('0x57'),'user']},'attributes':['id',_0x25a9('0x58'),'name','role',_0x25a9('0x59'),_0x25a9('0x5a'),_0x25a9('0x5b'),_0x25a9('0x5c'),_0x25a9('0x5d'),_0x25a9('0x5e')],'order':qs[_0x25a9('0x3c')](_0x25a9('0x5f')),'include':[{'model':db[_0x25a9('0x60')],'as':_0x25a9('0x61'),'attributes':['id',_0x25a9('0x2b'),_0x25a9('0x31')],'through':{'attributes':[]}}]})[_0x25a9('0x28')](function(_0x224a10){if(_0x224a10){var _0xf9102d=_0x4488bb[_0x25a9('0x62')][_0x25a9('0x4d')]({'plain':!![]});if(!_0xf9102d)throw new Error(_0x25a9('0x63'));if(_0xf9102d[_0x25a9('0x64')]==='user'){return db[_0x25a9('0x65')][_0x25a9('0x49')]({'where':{'name':'Agents','userProfileId':_0xf9102d[_0x25a9('0x66')]},'raw':!![]})[_0x25a9('0x28')](function(_0x41626e){if(_0x41626e){if(_0x41626e['autoAssociation']===0x0){return db[_0x25a9('0x67')][_0x25a9('0x55')]({'where':{'sectionId':_0x41626e['id']},'raw':!![]})[_0x25a9('0x28')](function(_0x2276eb){var _0x51c11f=[];if(_['isEmpty'](_0x2276eb)){_0x51c11f=_['filter'](_0x224a10,function(_0x166e99){if(_0x166e99[_0x25a9('0x64')]!==_0x25a9('0x56')){return _0x166e99;}});return _0x51c11f;}else{for(var _0x3b48ce=0x0;_0x3b48ce<_0x224a10['length'];_0x3b48ce++){var _0x3f8d5f=_0x224a10[_0x3b48ce];if(_0x3f8d5f[_0x25a9('0x64')]==='agent'){var _0x513580=_[_0x25a9('0x49')](_0x2276eb,function(_0x394734){return _0x394734[_0x25a9('0x68')]===_0x3f8d5f['id'];});if(_0x513580)_0x51c11f[_0x25a9('0x69')](_0x3f8d5f);}else{_0x51c11f[_0x25a9('0x69')](_0x3f8d5f);}}return _0x51c11f;}});}else{return _0x224a10;}}else{var _0x448155=_[_0x25a9('0x3f')](_0x224a10,function(_0x3c57ae){if(_0x3c57ae['role']!==_0x25a9('0x56')){return _0x3c57ae;}});return _0x448155;}});}else{return _0x224a10;}}})[_0x25a9('0x28')](function(_0x4cdaef){var _0x27ec58=[];if(_0x4cdaef){_0xd645c4=_0x4cdaef;for(var _0x4b560e=0x0;_0x4b560e<_0x4cdaef[_0x25a9('0x3a')];_0x4b560e+=0x1){_0xd645c4[_0x4b560e]['messages']=[];_0x27ec58[_0x25a9('0x69')](db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'FromId':[_0x4488bb[_0x25a9('0x62')]['id'],_0x4cdaef[_0x4b560e]['id']],'ToId':[_0x4488bb[_0x25a9('0x62')]['id'],_0x4cdaef[_0x4b560e]['id']],'ChatGroupId':null},'attributes':['id',_0x25a9('0x50'),_0x25a9('0x6a'),_0x25a9('0x6b'),_0x25a9('0x6c'),_0x25a9('0x4b')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x25a9('0x28')](wrapUser(_0x4cdaef[_0x4b560e])));}return BPromise[_0x25a9('0x6d')](_0x27ec58);}return[];})[_0x25a9('0x28')](function(_0x3ad143){return{'rows':_0x3ad143,'count':_0x3ad143[_0x25a9('0x3a')]};})[_0x25a9('0x28')](respondWithResult(_0x2e9cab,null))[_0x25a9('0x45')](handleError(_0x2e9cab,null));}; \ No newline at end of file +var _0x2de3=['FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','ChatInternalMessage','include','findAll','show','params','includeAll','merge','create','body','catch','find','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','userpic','internal','online','showWebBar','-online','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','isEmpty','resourceId','push'];(function(_0x493d61,_0x67f009){var _0x147baa=function(_0x2ed817){while(--_0x2ed817){_0x493d61['push'](_0x493d61['shift']());}};_0x147baa(++_0x67f009);}(_0x2de3,0x70));var _0x32de=function(_0x44d37f,_0x5d21ee){_0x44d37f=_0x44d37f-0x0;var _0x48f105=_0x2de3[_0x44d37f];return _0x48f105;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32de('0x0'));var zipdir=require(_0x32de('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32de('0x2'));var moment=require('moment');var BPromise=require(_0x32de('0x3'));var Mustache=require(_0x32de('0x4'));var util=require(_0x32de('0x5'));var path=require(_0x32de('0x6'));var sox=require(_0x32de('0x7'));var csv=require('to-csv');var ejs=require(_0x32de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32de('0x9'));var squel=require(_0x32de('0xa'));var crypto=require(_0x32de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x32de('0xc'));var toCsv=require(_0x32de('0xd'));var querystring=require(_0x32de('0xe'));var Papa=require(_0x32de('0xf'));var Redis=require('ioredis');var authService=require(_0x32de('0x10'));var qs=require(_0x32de('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32de('0x12'))(_0x32de('0x13'));var utils=require('../../config/utils');var config=require(_0x32de('0x14'));var licenseUtil=require(_0x32de('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x32de('0x16')](config[_0x32de('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x32de('0x18'))(new Redis(config[_0x32de('0x17')]));require(_0x32de('0x19'))[_0x32de('0x1a')](socket);function respondWithStatusCode(_0x232376,_0x3316a1){_0x3316a1=_0x3316a1||0xcc;return function(_0x4042eb){if(_0x4042eb){return _0x232376[_0x32de('0x1b')](_0x3316a1);}return _0x232376['status'](_0x3316a1)['end']();};}function respondWithResult(_0x23cedc,_0x3fe272){_0x3fe272=_0x3fe272||0xc8;return function(_0x4db7b7){if(_0x4db7b7){return _0x23cedc[_0x32de('0x1c')](_0x3fe272)[_0x32de('0x1d')](_0x4db7b7);}};}function respondWithFilteredResult(_0x553d7d,_0x5870e1){return function(_0x16d6c6){if(_0x16d6c6){var _0x1e3cea=typeof _0x5870e1['offset']==='undefined'&&typeof _0x5870e1[_0x32de('0x1e')]===_0x32de('0x1f');var _0x27dcfc=_0x16d6c6['count'];var _0x2b75e9=_0x1e3cea?0x0:_0x5870e1[_0x32de('0x20')];var _0x2fe59a=_0x1e3cea?_0x16d6c6[_0x32de('0x21')]:_0x5870e1[_0x32de('0x20')]+_0x5870e1[_0x32de('0x1e')];var _0x54ae9e;if(_0x2fe59a>=_0x27dcfc){_0x2fe59a=_0x27dcfc;_0x54ae9e=0xc8;}else{_0x54ae9e=0xce;}_0x553d7d[_0x32de('0x1c')](_0x54ae9e);return _0x553d7d[_0x32de('0x22')](_0x32de('0x23'),_0x2b75e9+'-'+_0x2fe59a+'/'+_0x27dcfc)[_0x32de('0x1d')](_0x16d6c6);}return null;};}function patchUpdates(_0x243385){return function(_0x38a526){try{jsonpatch[_0x32de('0x24')](_0x38a526,_0x243385,!![]);}catch(_0x1d5ee7){return BPromise[_0x32de('0x25')](_0x1d5ee7);}return _0x38a526[_0x32de('0x26')]();};}function saveUpdates(_0x4d16c9,_0x5cecb1){return function(_0x55b208){if(_0x55b208){return _0x55b208[_0x32de('0x27')](_0x4d16c9)['then'](function(_0x4244f7){return _0x4244f7;});}return null;};}function removeEntity(_0x36936f,_0x573bcf){return function(_0x4e1ca4){if(_0x4e1ca4){return _0x4e1ca4[_0x32de('0x28')]()[_0x32de('0x29')](function(){_0x36936f[_0x32de('0x1c')](0xcc)[_0x32de('0x2a')]();});}};}function handleEntityNotFound(_0x2b6fde,_0x4d6299){return function(_0x5598c7){if(!_0x5598c7){_0x2b6fde['sendStatus'](0x194);}return _0x5598c7;};}function handleError(_0x23a532,_0x4ca57c){_0x4ca57c=_0x4ca57c||0x1f4;return function(_0x592bfa){logger[_0x32de('0x2b')](_0x592bfa[_0x32de('0x2c')]);if(_0x592bfa['name']){delete _0x592bfa[_0x32de('0x2d')];}_0x23a532['status'](_0x4ca57c)['send'](_0x592bfa);};}exports[_0x32de('0x2e')]=function(_0x5e5a4c,_0x3a902a){var _0x3aa285={},_0x358d72={},_0x5d6e5c={'count':0x0,'rows':[]};var _0x588868=_[_0x32de('0x2f')](db['ChatInternalMessage'][_0x32de('0x30')],function(_0x3b2ffa){return{'name':_0x3b2ffa[_0x32de('0x31')],'type':_0x3b2ffa[_0x32de('0x32')][_0x32de('0x33')]};});_0x358d72['model']=_[_0x32de('0x2f')](_0x588868,_0x32de('0x2d'));_0x358d72[_0x32de('0x34')]=_[_0x32de('0x35')](_0x5e5a4c[_0x32de('0x34')]);_0x358d72['filters']=_['intersection'](_0x358d72['model'],_0x358d72[_0x32de('0x34')]);_0x3aa285[_0x32de('0x36')]=_[_0x32de('0x37')](_0x358d72[_0x32de('0x38')],qs[_0x32de('0x39')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x39')]));_0x3aa285[_0x32de('0x36')]=_0x3aa285['attributes'][_0x32de('0x3a')]?_0x3aa285[_0x32de('0x36')]:_0x358d72[_0x32de('0x38')];if(!_0x5e5a4c['query']['hasOwnProperty'](_0x32de('0x3b'))){_0x3aa285[_0x32de('0x1e')]=qs['limit'](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x1e')]);_0x3aa285[_0x32de('0x20')]=qs[_0x32de('0x20')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x20')]);}_0x3aa285[_0x32de('0x3c')]=qs[_0x32de('0x3d')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x3d')]);_0x3aa285[_0x32de('0x3e')]=qs[_0x32de('0x3f')](_[_0x32de('0x40')](_0x5e5a4c[_0x32de('0x34')],_0x358d72[_0x32de('0x3f')]),_0x588868);if(_0x5e5a4c[_0x32de('0x34')][_0x32de('0x41')]){_0x3aa285['where']=_['merge'](_0x3aa285[_0x32de('0x3e')],{'$or':_[_0x32de('0x2f')](_0x588868,function(_0x24d58f){if(_0x24d58f[_0x32de('0x32')]!==_0x32de('0x42')){var _0x2a6b2a={};_0x2a6b2a[_0x24d58f[_0x32de('0x2d')]]={'$like':'%'+_0x5e5a4c[_0x32de('0x34')][_0x32de('0x41')]+'%'};return _0x2a6b2a;}})});}_0x3aa285=_['merge']({},_0x3aa285,_0x5e5a4c[_0x32de('0x43')]);var _0x43a26c={'where':_0x3aa285[_0x32de('0x3e')]};return db[_0x32de('0x44')][_0x32de('0x21')](_0x43a26c)[_0x32de('0x29')](function(_0x3b2807){_0x5d6e5c[_0x32de('0x21')]=_0x3b2807;if(_0x5e5a4c[_0x32de('0x34')]['includeAll']){_0x3aa285[_0x32de('0x45')]=[{'all':!![]}];}return db[_0x32de('0x44')][_0x32de('0x46')](_0x3aa285);})[_0x32de('0x29')](function(_0x3502d0){_0x5d6e5c['rows']=_0x3502d0;return _0x5d6e5c;})[_0x32de('0x29')](respondWithFilteredResult(_0x3a902a,_0x3aa285))['catch'](handleError(_0x3a902a,null));};exports[_0x32de('0x47')]=function(_0x490d87,_0x1b9465){var _0x6ff599={'raw':!![],'where':{'id':_0x490d87[_0x32de('0x48')]['id']}},_0x54591d={};_0x54591d[_0x32de('0x38')]=_[_0x32de('0x35')](db['ChatInternalMessage'][_0x32de('0x30')]);_0x54591d['query']=_[_0x32de('0x35')](_0x490d87[_0x32de('0x34')]);_0x54591d[_0x32de('0x3f')]=_[_0x32de('0x37')](_0x54591d[_0x32de('0x38')],_0x54591d[_0x32de('0x34')]);_0x6ff599[_0x32de('0x36')]=_[_0x32de('0x37')](_0x54591d[_0x32de('0x38')],qs['fields'](_0x490d87['query']['fields']));_0x6ff599[_0x32de('0x36')]=_0x6ff599[_0x32de('0x36')]['length']?_0x6ff599[_0x32de('0x36')]:_0x54591d[_0x32de('0x38')];if(_0x490d87[_0x32de('0x34')][_0x32de('0x49')]){_0x6ff599[_0x32de('0x45')]=[{'all':!![]}];}_0x6ff599=_[_0x32de('0x4a')]({},_0x6ff599,_0x490d87['options']);return db[_0x32de('0x44')]['find'](_0x6ff599)[_0x32de('0x29')](handleEntityNotFound(_0x1b9465,null))[_0x32de('0x29')](respondWithResult(_0x1b9465,null))['catch'](handleError(_0x1b9465,null));};exports[_0x32de('0x4b')]=function(_0x579fc2,_0x3bdd64){return db[_0x32de('0x44')][_0x32de('0x4b')](_0x579fc2[_0x32de('0x4c')],{})[_0x32de('0x29')](respondWithResult(_0x3bdd64,0xc9))['catch'](handleError(_0x3bdd64,null));};exports[_0x32de('0x27')]=function(_0x370af8,_0x504021){if(_0x370af8[_0x32de('0x4c')]['id']){delete _0x370af8[_0x32de('0x4c')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x370af8[_0x32de('0x48')]['id']}})[_0x32de('0x29')](handleEntityNotFound(_0x504021,null))['then'](saveUpdates(_0x370af8[_0x32de('0x4c')],null))['then'](respondWithResult(_0x504021,null))[_0x32de('0x4d')](handleError(_0x504021,null));};exports['destroy']=function(_0x41cd38,_0x187c61){return db['ChatInternalMessage'][_0x32de('0x4e')]({'where':{'id':_0x41cd38[_0x32de('0x48')]['id']}})[_0x32de('0x29')](handleEntityNotFound(_0x187c61,null))[_0x32de('0x29')](removeEntity(_0x187c61,null))[_0x32de('0x4d')](handleError(_0x187c61,null));};exports[_0x32de('0x4f')]=function(_0x4a40f6,_0x36fcbd){return db['ChatInternalMessage']['describe']()[_0x32de('0x29')](respondWithResult(_0x36fcbd,null))['catch'](handleError(_0x36fcbd,null));};function wrapUser(_0x54d93b){return function(_0xc72320){var _0x4c9e7a=_0x54d93b['get']({'plain':!![]});_0x4c9e7a[_0x32de('0x50')]=[];if(_0xc72320){_0x4c9e7a[_0x32de('0x51')]=_0xc72320[_0x32de('0x52')];_0x4c9e7a[_0x32de('0x53')]=_0xc72320;}else{_0x4c9e7a[_0x32de('0x51')]=moment(0x0)['format'](_0x32de('0x54'));_0x4c9e7a['lastMessage']={};}return _0x4c9e7a;};}exports['getUsers']=function(_0xb00e59,_0x55708f,_0x45cb9d){var _0x4fbf1c=[];return db['User'][_0x32de('0x46')]({'where':{'role':[_0x32de('0x55'),_0x32de('0x56'),_0x32de('0x57')]},'attributes':['id',_0x32de('0x58'),_0x32de('0x2d'),_0x32de('0x59'),_0x32de('0x5a'),_0x32de('0x5b'),_0x32de('0x5c'),'lastLoginAt','allowmessenger',_0x32de('0x5d')],'order':qs[_0x32de('0x3d')](_0x32de('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0x32de('0x5f'),'attributes':['id',_0x32de('0x2d'),_0x32de('0x32')],'through':{'attributes':[]}}]})[_0x32de('0x29')](function(_0x49429d){if(_0x49429d){var _0x17519b=_0xb00e59[_0x32de('0x57')]['get']({'plain':!![]});if(!_0x17519b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17519b['role']==='user'){return db[_0x32de('0x60')][_0x32de('0x4e')]({'where':{'name':'Agents','userProfileId':_0x17519b[_0x32de('0x61')]},'raw':!![]})['then'](function(_0x348ab4){if(_0x348ab4){if(_0x348ab4[_0x32de('0x62')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x348ab4['id']},'raw':!![]})['then'](function(_0xe6a8eb){var _0xd92e9a=[];if(_[_0x32de('0x63')](_0xe6a8eb)){_0xd92e9a=_[_0x32de('0x41')](_0x49429d,function(_0x2b030f){if(_0x2b030f['role']!==_0x32de('0x55')){return _0x2b030f;}});return _0xd92e9a;}else{for(var _0x4e2702=0x0;_0x4e2702<_0x49429d['length'];_0x4e2702++){var _0x406cb9=_0x49429d[_0x4e2702];if(_0x406cb9[_0x32de('0x59')]===_0x32de('0x55')){var _0x1acd15=_[_0x32de('0x4e')](_0xe6a8eb,function(_0x111e2c){return _0x111e2c[_0x32de('0x64')]===_0x406cb9['id'];});if(_0x1acd15)_0xd92e9a[_0x32de('0x65')](_0x406cb9);}else{_0xd92e9a[_0x32de('0x65')](_0x406cb9);}}return _0xd92e9a;}});}else{return _0x49429d;}}else{var _0x2f5f79=_[_0x32de('0x41')](_0x49429d,function(_0x5c25a3){if(_0x5c25a3[_0x32de('0x59')]!=='agent'){return _0x5c25a3;}});return _0x2f5f79;}});}else{return _0x49429d;}}})['then'](function(_0x3224c0){var _0x976982=[];if(_0x3224c0){_0x4fbf1c=_0x3224c0;for(var _0x1541bf=0x0;_0x1541bf<_0x3224c0['length'];_0x1541bf+=0x1){_0x4fbf1c[_0x1541bf][_0x32de('0x50')]=[];_0x976982[_0x32de('0x65')](db[_0x32de('0x44')][_0x32de('0x4e')]({'where':{'FromId':[_0xb00e59[_0x32de('0x57')]['id'],_0x3224c0[_0x1541bf]['id']],'ToId':[_0xb00e59[_0x32de('0x57')]['id'],_0x3224c0[_0x1541bf]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x32de('0x66'),_0x32de('0x67'),_0x32de('0x68'),_0x32de('0x4c')],'order':qs[_0x32de('0x3d')](_0x32de('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3224c0[_0x1541bf])));}return BPromise[_0x32de('0x6a')](_0x976982);}return[];})[_0x32de('0x29')](function(_0x38e323){return{'rows':_0x38e323,'count':_0x38e323[_0x32de('0x3a')]};})[_0x32de('0x29')](respondWithResult(_0x55708f,null))[_0x32de('0x4d')](handleError(_0x55708f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index dadb59d..6a3cde9 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 _0x57e9=['update','remove','emit','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x5ed413,_0x4f26c0){var _0x3cca33=function(_0x214afe){while(--_0x214afe){_0x5ed413['push'](_0x5ed413['shift']());}};_0x3cca33(++_0x4f26c0);}(_0x57e9,0xce));var _0x957e=function(_0x5b7a0a,_0x4d62d5){_0x5b7a0a=_0x5b7a0a-0x0;var _0x3418b6=_0x57e9[_0x5b7a0a];return _0x3418b6;};'use strict';var EventEmitter=require(_0x957e('0x0'));var ChatInternalMessage=require(_0x957e('0x1'))['db'][_0x957e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x957e('0x3'),'afterUpdate':_0x957e('0x4'),'afterDestroy':_0x957e('0x5')};function emitEvent(_0x44410f){return function(_0x3a44d5,_0xee6b30,_0x581cf6){ChatInternalMessageEvents[_0x957e('0x6')](_0x44410f+':'+_0x3a44d5['id'],_0x3a44d5);ChatInternalMessageEvents['emit'](_0x44410f,_0x3a44d5);_0x581cf6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x6e1d=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xbc8e40,_0x281072){var _0x5c5bcc=function(_0x41fa81){while(--_0x41fa81){_0xbc8e40['push'](_0xbc8e40['shift']());}};_0x5c5bcc(++_0x281072);}(_0x6e1d,0xfa));var _0xd6e1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x6e1d[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require(_0xd6e1('0x0'));var ChatInternalMessage=require(_0xd6e1('0x1'))['db'][_0xd6e1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd6e1('0x3')](0x0);var events={'afterCreate':_0xd6e1('0x4'),'afterUpdate':_0xd6e1('0x5'),'afterDestroy':_0xd6e1('0x6')};function emitEvent(_0x313df4){return function(_0x51f6fd,_0x362040,_0x13d61e){ChatInternalMessageEvents[_0xd6e1('0x7')](_0x313df4+':'+_0x51f6fd['id'],_0x51f6fd);ChatInternalMessageEvents['emit'](_0x313df4,_0x51f6fd);_0x13d61e(null);};}for(var e in events){if(events[_0xd6e1('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xd6e1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 25ba955..2430ea9 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 _0x84ca=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x33acc2,_0x198db3){var _0x29f09d=function(_0x3c527e){while(--_0x3c527e){_0x33acc2['push'](_0x33acc2['shift']());}};_0x29f09d(++_0x198db3);}(_0x84ca,0xca));var _0xa84c=function(_0x5ec57a,_0x4fb107){_0x5ec57a=_0x5ec57a-0x0;var _0x2b717b=_0x84ca[_0x5ec57a];return _0x2b717b;};'use strict';var _=require(_0xa84c('0x0'));var util=require(_0xa84c('0x1'));var logger=require('../../config/logger')(_0xa84c('0x2'));var moment=require(_0xa84c('0x3'));var BPromise=require(_0xa84c('0x4'));var rp=require(_0xa84c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa84c('0x6'));var config=require(_0xa84c('0x7'));var attributes=require(_0xa84c('0x8'));module[_0xa84c('0x9')]=function(_0x522894,_0x13b07c){return _0x522894[_0xa84c('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa84c('0xb'),'collate':_0xa84c('0xc')});}; \ No newline at end of file +var _0xf8b2=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x56d35f,_0x3508d1){var _0x56b755=function(_0x54c273){while(--_0x54c273){_0x56d35f['push'](_0x56d35f['shift']());}};_0x56b755(++_0x3508d1);}(_0xf8b2,0x150));var _0x2f8b=function(_0x21a44e,_0x203f07){_0x21a44e=_0x21a44e-0x0;var _0x5f1638=_0xf8b2[_0x21a44e];return _0x5f1638;};'use strict';var _=require(_0x2f8b('0x0'));var util=require('util');var logger=require(_0x2f8b('0x1'))(_0x2f8b('0x2'));var moment=require(_0x2f8b('0x3'));var BPromise=require(_0x2f8b('0x4'));var rp=require(_0x2f8b('0x5'));var fs=require('fs');var path=require(_0x2f8b('0x6'));var rimraf=require(_0x2f8b('0x7'));var config=require(_0x2f8b('0x8'));var attributes=require(_0x2f8b('0x9'));module[_0x2f8b('0xa')]=function(_0x3094f8,_0x4bc4f4){return _0x3094f8[_0x2f8b('0xb')](_0x2f8b('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f8b('0xd'),'collate':_0x2f8b('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6bee3a7..8334110 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 _0xb6a9=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xb6a9[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x9b6a('0x0'));var util=require(_0x9b6a('0x1'));var moment=require('moment');var BPromise=require(_0x9b6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b6a('0x3'));var db=require(_0x9b6a('0x4'))['db'];var utils=require(_0x9b6a('0x5'));var logger=require(_0x9b6a('0x6'))(_0x9b6a('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b6a('0x8'));var client=jayson[_0x9b6a('0x9')][_0x9b6a('0xa')]({'port':0x232a});config[_0x9b6a('0xb')]=_[_0x9b6a('0xc')](config[_0x9b6a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b6a('0xd'))(new Redis(config['redis']));require(_0x9b6a('0xe'))[_0x9b6a('0xf')](socket);function respondWithRpcPromise(_0x5efc13,_0x271ef4,_0x525480){return new BPromise(function(_0x55af0c,_0x222780){return client[_0x9b6a('0x10')](_0x5efc13,_0x525480)[_0x9b6a('0x11')](function(_0x2295f0){logger[_0x9b6a('0x12')](_0x9b6a('0x13'),_0x271ef4,_0x9b6a('0x14'));logger[_0x9b6a('0x15')](_0x9b6a('0x16'),_0x271ef4,_0x9b6a('0x14'),JSON[_0x9b6a('0x17')](_0x2295f0));if(_0x2295f0[_0x9b6a('0x18')]){if(_0x2295f0[_0x9b6a('0x18')]['code']===0x1f4){logger['error'](_0x9b6a('0x13'),_0x271ef4,_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);return _0x222780(_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);}logger[_0x9b6a('0x18')](_0x9b6a('0x13'),_0x271ef4,_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);return _0x55af0c(_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);}else{logger[_0x9b6a('0x12')](_0x9b6a('0x13'),_0x271ef4,_0x9b6a('0x14'));_0x55af0c(_0x2295f0[_0x9b6a('0x1a')][_0x9b6a('0x19')]);}})[_0x9b6a('0x1b')](function(_0xa8e9d6){logger[_0x9b6a('0x18')](_0x9b6a('0x13'),_0x271ef4,_0xa8e9d6);_0x222780(_0xa8e9d6);});});} \ No newline at end of file +var _0x7a55=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x22016b,_0x3ed930){var _0x3ed6f1=function(_0x1e7c48){while(--_0x1e7c48){_0x22016b['push'](_0x22016b['shift']());}};_0x3ed6f1(++_0x3ed930);}(_0x7a55,0x173));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x57a5('0x0'));var util=require(_0x57a5('0x1'));var moment=require('moment');var BPromise=require(_0x57a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57a5('0x3'));var db=require(_0x57a5('0x4'))['db'];var utils=require(_0x57a5('0x5'));var logger=require(_0x57a5('0x6'))(_0x57a5('0x7'));var config=require(_0x57a5('0x8'));var jayson=require(_0x57a5('0x9'));var client=jayson[_0x57a5('0xa')][_0x57a5('0xb')]({'port':0x232a});config[_0x57a5('0xc')]=_['defaults'](config[_0x57a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x57a5('0xd'))(new Redis(config[_0x57a5('0xc')]));require(_0x57a5('0xe'))[_0x57a5('0xf')](socket);function respondWithRpcPromise(_0x227632,_0x31c321,_0x2e86f1){return new BPromise(function(_0x4a14ab,_0x108c93){return client[_0x57a5('0x10')](_0x227632,_0x2e86f1)[_0x57a5('0x11')](function(_0x47f431){logger[_0x57a5('0x12')](_0x57a5('0x13'),_0x31c321,_0x57a5('0x14'));logger[_0x57a5('0x15')](_0x57a5('0x16'),_0x31c321,_0x57a5('0x14'),JSON[_0x57a5('0x17')](_0x47f431));if(_0x47f431[_0x57a5('0x18')]){if(_0x47f431[_0x57a5('0x18')][_0x57a5('0x19')]===0x1f4){logger['error'](_0x57a5('0x13'),_0x31c321,_0x47f431['error'][_0x57a5('0x1a')]);return _0x108c93(_0x47f431['error']['message']);}logger[_0x57a5('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x31c321,_0x47f431[_0x57a5('0x18')]['message']);return _0x4a14ab(_0x47f431[_0x57a5('0x18')]['message']);}else{logger[_0x57a5('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x31c321,_0x57a5('0x14'));_0x4a14ab(_0x47f431[_0x57a5('0x1b')]['message']);}})[_0x57a5('0x1c')](function(_0x23cfa1){logger['error'](_0x57a5('0x13'),_0x31c321,_0x23cfa1);_0x108c93(_0x23cfa1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index bb0f84f..120189f 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 _0xd6ec=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x4ecb61,_0xf4fe26){var _0x25eec8=function(_0xa0aeb){while(--_0xa0aeb){_0x4ecb61['push'](_0x4ecb61['shift']());}};_0x25eec8(++_0xf4fe26);}(_0xd6ec,0x18d));var _0xcd6e=function(_0x11f586,_0x1a11da){_0x11f586=_0x11f586-0x0;var _0x46b786=_0xd6ec[_0x11f586];return _0x46b786;};'use strict';var ChatInternalMessageEvents=require(_0xcd6e('0x0'));var events=['save',_0xcd6e('0x1'),_0xcd6e('0x2')];function createListener(_0x2269b6,_0x35f8b1){return function(_0x15bcf2){_0x35f8b1[_0xcd6e('0x3')](_0x2269b6,_0x15bcf2);};}function removeListener(_0x1ce042,_0x4f29f2){return function(){ChatInternalMessageEvents['removeListener'](_0x1ce042,_0x4f29f2);};}exports[_0xcd6e('0x4')]=function(_0x371d76){for(var _0x1f8c89=0x0,_0x176612=events[_0xcd6e('0x5')];_0x1f8c89<_0x176612;_0x1f8c89++){var _0xde523e=events[_0x1f8c89];var _0x8d3396=createListener(_0xcd6e('0x6')+_0xde523e,_0x371d76);ChatInternalMessageEvents['on'](_0xde523e,_0x8d3396);}}; \ No newline at end of file +var _0x0d5b=['removeListener','register','length','chatInternalMessage:','save','update'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0x0d5b,0x1a2));var _0xb0d5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d5b[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb0d5('0x0'),'remove',_0xb0d5('0x1')];function createListener(_0x3bea57,_0x4d5595){return function(_0x19e1f8){_0x4d5595['emit'](_0x3bea57,_0x19e1f8);};}function removeListener(_0x400434,_0x3c7ca5){return function(){ChatInternalMessageEvents[_0xb0d5('0x2')](_0x400434,_0x3c7ca5);};}exports[_0xb0d5('0x3')]=function(_0x3acb99){for(var _0x3cfb99=0x0,_0x56ba72=events[_0xb0d5('0x4')];_0x3cfb99<_0x56ba72;_0x3cfb99++){var _0x4f85c8=events[_0x3cfb99];var _0x20b444=createListener(_0xb0d5('0x5')+_0x4f85c8,_0x3acb99);ChatInternalMessageEvents['on'](_0x4f85c8,_0x20b444);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 39c142c..6ef9afb 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 _0x2ff7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x2ff7,0xbb));var _0x72ff=function(_0x5223de,_0xb0a127){_0x5223de=_0x5223de-0x0;var _0x4a52ee=_0x2ff7[_0x5223de];return _0x4a52ee;};'use strict';var multer=require(_0x72ff('0x0'));var util=require(_0x72ff('0x1'));var path=require('path');var timeout=require(_0x72ff('0x2'));var express=require(_0x72ff('0x3'));var router=express[_0x72ff('0x4')]();var fs_extra=require(_0x72ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72ff('0x6'));var config=require(_0x72ff('0x7'));var controller=require(_0x72ff('0x8'));router[_0x72ff('0x9')]('/',auth[_0x72ff('0xa')](),controller['index']);router[_0x72ff('0x9')](_0x72ff('0xb'),auth[_0x72ff('0xa')](),controller[_0x72ff('0xc')]);router[_0x72ff('0x9')]('/users',auth[_0x72ff('0xa')](),controller[_0x72ff('0xd')]);router[_0x72ff('0x9')](_0x72ff('0xe'),auth[_0x72ff('0xa')](),controller[_0x72ff('0xf')]);router['post']('/',auth[_0x72ff('0xa')](),controller[_0x72ff('0x10')]);router[_0x72ff('0x11')](_0x72ff('0xe'),controller[_0x72ff('0x12')]);router[_0x72ff('0x13')](_0x72ff('0xe'),auth[_0x72ff('0xa')](),controller[_0x72ff('0x14')]);module['exports']=router; \ No newline at end of file +var _0xed84=['connect-timeout','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','post','put','update','delete','destroy','exports','util','path'];(function(_0x19c6a6,_0x36701d){var _0x29014=function(_0x4a61b3){while(--_0x4a61b3){_0x19c6a6['push'](_0x19c6a6['shift']());}};_0x29014(++_0x36701d);}(_0xed84,0x166));var _0x4ed8=function(_0x2ee365,_0x4340e6){_0x2ee365=_0x2ee365-0x0;var _0x4b5298=_0xed84[_0x2ee365];return _0x4b5298;};'use strict';var multer=require('multer');var util=require(_0x4ed8('0x0'));var path=require(_0x4ed8('0x1'));var timeout=require(_0x4ed8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4ed8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4ed8('0x4'));var config=require('../../config/environment');var controller=require(_0x4ed8('0x5'));router[_0x4ed8('0x6')]('/',auth[_0x4ed8('0x7')](),controller['index']);router['get'](_0x4ed8('0x8'),auth[_0x4ed8('0x7')](),controller[_0x4ed8('0x9')]);router['get']('/users',auth[_0x4ed8('0x7')](),controller[_0x4ed8('0xa')]);router[_0x4ed8('0x6')](_0x4ed8('0xb'),auth[_0x4ed8('0x7')](),controller['show']);router[_0x4ed8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ed8('0xd')]('/:id',controller[_0x4ed8('0xe')]);router[_0x4ed8('0xf')](_0x4ed8('0xb'),auth[_0x4ed8('0x7')](),controller[_0x4ed8('0x10')]);module[_0x4ed8('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ebe9587..f02e840 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 _0x4849=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x52923d,_0x1c45a4){var _0x56ec0e=function(_0x27630c){while(--_0x27630c){_0x52923d['push'](_0x52923d['shift']());}};_0x56ec0e(++_0x1c45a4);}(_0x4849,0xf8));var _0x9484=function(_0x3db99c,_0xd75b6f){_0x3db99c=_0x3db99c-0x0;var _0xf5263b=_0x4849[_0x3db99c];return _0xf5263b;};'use strict';var Sequelize=require(_0x9484('0x0'));module[_0x9484('0x1')]={'body':{'type':Sequelize[_0x9484('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9484('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9484('0x4')]('in',_0x9484('0x5')),'defaultValue':_0x9484('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9484('0x6')]},'providerName':{'type':Sequelize[_0x9484('0x7')]},'providerResponse':{'type':Sequelize[_0x9484('0x2')]}}; \ No newline at end of file +var _0x81a5=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x81a5,0x1c8));var _0x581a=function(_0x191fa4,_0x59286d){_0x191fa4=_0x191fa4-0x0;var _0x4b7dac=_0x81a5[_0x191fa4];return _0x4b7dac;};'use strict';var Sequelize=require(_0x581a('0x0'));module[_0x581a('0x1')]={'body':{'type':Sequelize[_0x581a('0x2')](_0x581a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x581a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x581a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x581a('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7905795..f5bfb3d 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 _0xf6c6=['find','create','update','body','destroy','describe','accept','acceptMessage','reject','chat','UserId','agent','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','format','SIP/%s','channel','event','EventManager','rejectmessage','interaction','formData','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','register','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','Content-Range','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','rows','show','params','keys'];(function(_0x4f6173,_0xe63497){var _0x2eb711=function(_0x2b0c38){while(--_0x2b0c38){_0x4f6173['push'](_0x4f6173['shift']());}};_0x2eb711(++_0xe63497);}(_0xf6c6,0x8d));var _0x6f6c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xf6c6[_0x44946b];return _0x249bc4;};'use strict';var util=require(_0x6f6c('0x0'));var _=require(_0x6f6c('0x1'));var Redis=require(_0x6f6c('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x6f6c('0x3'))(_0x6f6c('0x4'));var config=require(_0x6f6c('0x5'));var db=require(_0x6f6c('0x6'))['db'];config['redis']=_[_0x6f6c('0x7')](config[_0x6f6c('0x8')],{'host':_0x6f6c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f6c('0xa'))[_0x6f6c('0xb')](socket);var jayson=require(_0x6f6c('0xc'));var client=jayson['client'][_0x6f6c('0xd')]({'port':0x232c});var client9002=jayson[_0x6f6c('0xe')][_0x6f6c('0xd')]({'port':0x232a});var interaction_log=require(_0x6f6c('0x3'))('chat-interactions');function respondWithRpcPromise(_0x32bd1a,_0x5ec938,_0x2f352d,_0xe0b67f){return new Promise(function(_0x2bbeb9,_0xf79d2d){var _0x452a02=_0xe0b67f||client;return _0x452a02[_0x6f6c('0xf')](_0x32bd1a,_0x2f352d)['then'](function(_0x2cb519){logger[_0x6f6c('0x10')](_0x6f6c('0x11'),_0x5ec938,_0x6f6c('0x12'));logger['debug'](_0x6f6c('0x13'),_0x5ec938,_0x6f6c('0x12'),JSON[_0x6f6c('0x14')](_0x2cb519));if(_0x2cb519[_0x6f6c('0x15')]){if(_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x16')]===0x1f4){logger['error'](_0x6f6c('0x11'),_0x5ec938,_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);return _0xf79d2d(_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);}logger[_0x6f6c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5ec938,_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);return _0x2bbeb9(_0x2cb519[_0x6f6c('0x15')]['message']);}else{logger['info'](_0x6f6c('0x11'),_0x5ec938,_0x6f6c('0x12'));_0x2bbeb9(_0x2cb519[_0x6f6c('0x18')][_0x6f6c('0x17')]);}})[_0x6f6c('0x19')](function(_0x3bd6c0){logger[_0x6f6c('0x15')](_0x6f6c('0x11'),_0x5ec938,_0x3bd6c0);_0xf79d2d(_0x3bd6c0);});});}function respondWithResult(_0x3184d7,_0x43d288){_0x43d288=_0x43d288||0xc8;return function(_0x2ecf8a){if(_0x2ecf8a){return _0x3184d7[_0x6f6c('0x1a')](_0x43d288)[_0x6f6c('0x1b')](_0x2ecf8a);}};}function respondWithFilteredResult(_0x56ea08,_0x5f17da){return function(_0x4842ee){if(_0x4842ee){var _0x14f811=typeof _0x5f17da[_0x6f6c('0x1c')]==='undefined'&&typeof _0x5f17da[_0x6f6c('0x1d')]===_0x6f6c('0x1e');var _0x58fdaa=_0x4842ee[_0x6f6c('0x1f')];var _0x42a7f3=_0x14f811?0x0:_0x5f17da[_0x6f6c('0x1c')];var _0x47673e=_0x14f811?_0x4842ee[_0x6f6c('0x1f')]:_0x5f17da['offset']+_0x5f17da[_0x6f6c('0x1d')];var _0x1fa26a;if(_0x47673e>=_0x58fdaa){_0x47673e=_0x58fdaa;_0x1fa26a=0xc8;}else{_0x1fa26a=0xce;}_0x56ea08[_0x6f6c('0x1a')](_0x1fa26a);return _0x56ea08['set'](_0x6f6c('0x20'),_0x42a7f3+'-'+_0x47673e+'/'+_0x58fdaa)[_0x6f6c('0x1b')](_0x4842ee);}return null;};}function saveUpdates(_0xf39934){return function(_0x3c03b2){if(_0x3c03b2){return _0x3c03b2['update'](_0xf39934)[_0x6f6c('0x21')](function(_0x295fea){return _0x295fea;});}return null;};}function removeEntity(_0x5031f7){return function(_0x13496e){if(_0x13496e){return _0x13496e['destroy']()[_0x6f6c('0x21')](function(){_0x5031f7[_0x6f6c('0x1a')](0xcc)[_0x6f6c('0x22')]();});}};}function handleEntityNotFound(_0x12aff5){return function(_0x172a7a){if(!_0x172a7a){_0x12aff5[_0x6f6c('0x23')](0x194);}return _0x172a7a;};}function handleError(_0x21d80f,_0xaf4f){_0xaf4f=_0xaf4f||0x1f4;return function(_0x15212e){logger[_0x6f6c('0x15')](_0x15212e[_0x6f6c('0x24')]);if(_0x15212e[_0x6f6c('0x25')]){delete _0x15212e['name'];}_0x21d80f['status'](_0xaf4f)[_0x6f6c('0x26')](_0x15212e);};}exports[_0x6f6c('0x27')]=function(_0x4f5590,_0x1f55e3){var _0xdfcd78={},_0xe6f2b0={},_0x5b4156={'count':0x0,'rows':[]};var _0x150545=_[_0x6f6c('0x28')](db['ChatMessage'][_0x6f6c('0x29')],function(_0x5121b8){return{'name':_0x5121b8[_0x6f6c('0x2a')],'type':_0x5121b8[_0x6f6c('0x2b')][_0x6f6c('0x2c')]};});_0xe6f2b0['model']=_[_0x6f6c('0x28')](_0x150545,_0x6f6c('0x25'));_0xe6f2b0[_0x6f6c('0x2d')]=_['keys'](_0x4f5590[_0x6f6c('0x2d')]);_0xe6f2b0[_0x6f6c('0x2e')]=_[_0x6f6c('0x2f')](_0xe6f2b0[_0x6f6c('0x30')],_0xe6f2b0['query']);_0xdfcd78[_0x6f6c('0x31')]=_['intersection'](_0xe6f2b0[_0x6f6c('0x30')],qs[_0x6f6c('0x32')](_0x4f5590[_0x6f6c('0x2d')]['fields']));_0xdfcd78[_0x6f6c('0x31')]=_0xdfcd78['attributes'][_0x6f6c('0x33')]?_0xdfcd78[_0x6f6c('0x31')]:_0xe6f2b0[_0x6f6c('0x30')];if(!_0x4f5590['query'][_0x6f6c('0x34')]('nolimit')){_0xdfcd78['limit']=qs['limit'](_0x4f5590[_0x6f6c('0x2d')]['limit']);_0xdfcd78[_0x6f6c('0x1c')]=qs[_0x6f6c('0x1c')](_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x1c')]);}_0xdfcd78[_0x6f6c('0x35')]=qs[_0x6f6c('0x36')](_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x36')]);_0xdfcd78['where']=qs[_0x6f6c('0x2e')](_[_0x6f6c('0x37')](_0x4f5590[_0x6f6c('0x2d')],_0xe6f2b0['filters']),_0x150545);if(_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x38')]){_0xdfcd78[_0x6f6c('0x39')]=_[_0x6f6c('0x3a')](_0xdfcd78['where'],{'$or':_[_0x6f6c('0x28')](_0x150545,function(_0x15a03a){if(_0x15a03a[_0x6f6c('0x2b')]!==_0x6f6c('0x3b')){var _0xf31723={};_0xf31723[_0x15a03a[_0x6f6c('0x25')]]={'$like':'%'+_0x4f5590['query'][_0x6f6c('0x38')]+'%'};return _0xf31723;}})});}_0xdfcd78=_[_0x6f6c('0x3a')]({},_0xdfcd78,_0x4f5590[_0x6f6c('0x3c')]);var _0x3327d4={'where':_0xdfcd78[_0x6f6c('0x39')]};return db[_0x6f6c('0x3d')][_0x6f6c('0x1f')](_0x3327d4)['then'](function(_0x502f7d){_0x5b4156['count']=_0x502f7d;if(_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x3e')]){_0xdfcd78[_0x6f6c('0x3f')]=[{'all':!![]}];}return db['ChatMessage'][_0x6f6c('0x40')](_0xdfcd78);})[_0x6f6c('0x21')](function(_0x31eaea){_0x5b4156[_0x6f6c('0x41')]=_0x31eaea;return _0x5b4156;})[_0x6f6c('0x21')](respondWithFilteredResult(_0x1f55e3,_0xdfcd78))[_0x6f6c('0x19')](handleError(_0x1f55e3,null));};exports[_0x6f6c('0x42')]=function(_0x1ab6a3,_0x3e5b33){var _0xe8ee2c={'raw':!![],'where':{'id':_0x1ab6a3[_0x6f6c('0x43')]['id']}},_0x4f14d1={};_0x4f14d1['model']=_[_0x6f6c('0x44')](db[_0x6f6c('0x3d')][_0x6f6c('0x29')]);_0x4f14d1[_0x6f6c('0x2d')]=_[_0x6f6c('0x44')](_0x1ab6a3['query']);_0x4f14d1['filters']=_[_0x6f6c('0x2f')](_0x4f14d1[_0x6f6c('0x30')],_0x4f14d1[_0x6f6c('0x2d')]);_0xe8ee2c[_0x6f6c('0x31')]=_[_0x6f6c('0x2f')](_0x4f14d1[_0x6f6c('0x30')],qs['fields'](_0x1ab6a3[_0x6f6c('0x2d')]['fields']));_0xe8ee2c[_0x6f6c('0x31')]=_0xe8ee2c[_0x6f6c('0x31')]['length']?_0xe8ee2c['attributes']:_0x4f14d1['model'];if(_0x1ab6a3['query'][_0x6f6c('0x3e')]){_0xe8ee2c[_0x6f6c('0x3f')]=[{'all':!![]}];}_0xe8ee2c=_[_0x6f6c('0x3a')]({},_0xe8ee2c,_0x1ab6a3[_0x6f6c('0x3c')]);return db[_0x6f6c('0x3d')][_0x6f6c('0x45')](_0xe8ee2c)[_0x6f6c('0x21')](handleEntityNotFound(_0x3e5b33,null))[_0x6f6c('0x21')](respondWithResult(_0x3e5b33,null))[_0x6f6c('0x19')](handleError(_0x3e5b33,null));};exports[_0x6f6c('0x46')]=function(_0x163235,_0x37d181){return db[_0x6f6c('0x3d')]['create'](_0x163235['body'],{})['then'](respondWithResult(_0x37d181,0xc9))[_0x6f6c('0x19')](handleError(_0x37d181,null));};exports[_0x6f6c('0x47')]=function(_0x34f07e,_0x13ca9a){if(_0x34f07e[_0x6f6c('0x48')]['id']){delete _0x34f07e[_0x6f6c('0x48')]['id'];}return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x34f07e['params']['id']}})[_0x6f6c('0x21')](handleEntityNotFound(_0x13ca9a,null))[_0x6f6c('0x21')](saveUpdates(_0x34f07e[_0x6f6c('0x48')],null))['then'](respondWithResult(_0x13ca9a,null))[_0x6f6c('0x19')](handleError(_0x13ca9a,null));};exports[_0x6f6c('0x49')]=function(_0x141e54,_0x567356){return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x141e54[_0x6f6c('0x43')]['id']}})[_0x6f6c('0x21')](handleEntityNotFound(_0x567356,null))[_0x6f6c('0x21')](removeEntity(_0x567356,null))[_0x6f6c('0x19')](handleError(_0x567356,null));};exports[_0x6f6c('0x4a')]=function(_0x156061,_0x579672){return db[_0x6f6c('0x3d')]['describe']()[_0x6f6c('0x21')](respondWithResult(_0x579672,null))[_0x6f6c('0x19')](handleError(_0x579672,null));};exports[_0x6f6c('0x4b')]=function(_0x3f7c78,_0x241acc){var _0x5c18d3='chat';return interactionService[_0x6f6c('0x4c')](_0x3f7c78,_0x5c18d3)[_0x6f6c('0x21')](respondWithResult(_0x241acc,null))[_0x6f6c('0x19')](handleError(_0x241acc,null));};exports[_0x6f6c('0x4d')]=function(_0x49cb28,_0x310f6f){var _0x14efff={'agent':{},'channel':_0x6f6c('0x4e')};if(_0x49cb28[_0x6f6c('0x48')]['id']){delete _0x49cb28['body']['id'];}_0x49cb28['body']['UserId']=_0x49cb28[_0x6f6c('0x48')][_0x6f6c('0x4f')]||_0x49cb28['user']['id'];_0x14efff[_0x6f6c('0x50')]['id']=_0x49cb28['body'][_0x6f6c('0x4f')];return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x49cb28[_0x6f6c('0x43')]['id'],'UserId':null}})[_0x6f6c('0x21')](handleEntityNotFound(_0x310f6f,null))[_0x6f6c('0x21')](function(_0x1ef112){if(_0x1ef112){_0x14efff['message']=_0x1ef112[_0x6f6c('0x51')]({'plain':!![]});return db[_0x6f6c('0x52')][_0x6f6c('0x45')]({'where':{'id':_0x1ef112['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x310f6f,null))['then'](function(_0x44526f){if(_0x44526f){_0x14efff['interaction']=_0x44526f['get']({'plain':!![]});interaction_log[_0x6f6c('0x10')](_0x6f6c('0x53'),_0x49cb28[_0x6f6c('0x54')]['id'],_0x49cb28[_0x6f6c('0x54')][_0x6f6c('0x25')],_0x49cb28[_0x6f6c('0x54')][_0x6f6c('0x55')],_0x14efff['interaction']['id'],_0x49cb28[_0x6f6c('0x48')]?JSON['stringify'](_0x49cb28[_0x6f6c('0x48')]):_0x6f6c('0x56'));return respondWithRpcPromise(_0x6f6c('0x57'),_0x6f6c('0x58'),_0x14efff);}return null;})[_0x6f6c('0x21')](function(_0x23c02b){var _0x3e7aa0=_0x6f6c('0x59')+_0x23c02b['message'][_0x6f6c('0x5a')];return db[_0x6f6c('0x5b')][_0x6f6c('0x2d')](_0x3e7aa0,{'type':db['Sequelize'][_0x6f6c('0x5c')][_0x6f6c('0x5d')],'raw':!![]})['then'](function(_0x682fa){return _0x682fa;});})[_0x6f6c('0x21')](function(_0xcc6ced){if(_0xcc6ced){_0x14efff[_0x6f6c('0x17')]['contact']=_0xcc6ced[0x0];if(!_0x49cb28['body'][_0x6f6c('0x4f')])return;return db['User']['find']({'where':{'id':_0x49cb28[_0x6f6c('0x48')]['UserId'],'role':_0x6f6c('0x50')},'attributes':['id',_0x6f6c('0x25'),_0x6f6c('0x5e'),_0x6f6c('0x5f'),_0x6f6c('0x60')],'raw':!![]});}return null;})['then'](function(_0x29aa17){if(!_0x29aa17)return null;_0x14efff[_0x6f6c('0x17')][_0x6f6c('0x50')]=_0x29aa17;return _0x14efff;})[_0x6f6c('0x21')](function(_0x371760){if(_0x371760){_0x371760[_0x6f6c('0x17')]['interface']=util[_0x6f6c('0x61')](_0x6f6c('0x62'),_0x49cb28[_0x6f6c('0x54')]['name']);_0x371760[_0x6f6c('0x17')][_0x6f6c('0x63')]=_0x14efff[_0x6f6c('0x63')];_0x371760[_0x6f6c('0x17')]['motionChannel']=_0x14efff['channel'];_0x371760['message'][_0x6f6c('0x64')]=_0x6f6c('0x4d');respondWithRpcPromise(_0x6f6c('0x65'),_0x6f6c('0x65'),{'event':_0x6f6c('0x66'),'message':_[_0x6f6c('0x3a')](_0x14efff['message'],JSON['parse'](_0x14efff[_0x6f6c('0x67')][_0x6f6c('0x68')]))},client9002);return _0x14efff;}return null;})[_0x6f6c('0x21')](respondWithResult(_0x310f6f,null))[_0x6f6c('0x19')](handleError(_0x310f6f,null));}; \ No newline at end of file +var _0x3e4f=['User','agent','email','interface','format','SIP/%s','channel','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','chat-interactions','request','then','debug','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','index','map','ChatMessage','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type','options','includeAll','include','findAll','catch','show','params','keys','length','merge','create','body','find','describe','accept','chat','acceptMessage','reject','UserId','user','ChatInteraction','ChatInteractionId','get','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x3e4f,0xd7));var _0xf3e4=function(_0x279275,_0x5eb9a7){_0x279275=_0x279275-0x0;var _0x651a96=_0x3e4f[_0x279275];return _0x651a96;};'use strict';var util=require(_0xf3e4('0x0'));var _=require(_0xf3e4('0x1'));var Redis=require(_0xf3e4('0x2'));var interactionService=require(_0xf3e4('0x3'));var qs=require(_0xf3e4('0x4'));var logger=require(_0xf3e4('0x5'))(_0xf3e4('0x6'));var config=require('../../config/environment');var db=require(_0xf3e4('0x7'))['db'];config[_0xf3e4('0x8')]=_[_0xf3e4('0x9')](config[_0xf3e4('0x8')],{'host':_0xf3e4('0xa'),'port':0x18eb});var socket=require(_0xf3e4('0xb'))(new Redis(config[_0xf3e4('0x8')]));require('./chatMessage.socket')[_0xf3e4('0xc')](socket);var jayson=require(_0xf3e4('0xd'));var client=jayson[_0xf3e4('0xe')][_0xf3e4('0xf')]({'port':0x232c});var client9002=jayson[_0xf3e4('0xe')][_0xf3e4('0xf')]({'port':0x232a});var interaction_log=require(_0xf3e4('0x5'))(_0xf3e4('0x10'));function respondWithRpcPromise(_0x16733d,_0x370623,_0x41978b,_0x2d1195){return new Promise(function(_0x2d991f,_0x5a6780){var _0x368d98=_0x2d1195||client;return _0x368d98[_0xf3e4('0x11')](_0x16733d,_0x41978b)[_0xf3e4('0x12')](function(_0xf6b7ac){logger['info']('ChatMessage,\x20%s,\x20%s',_0x370623,'request\x20sent');logger[_0xf3e4('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x370623,_0xf3e4('0x14'),JSON[_0xf3e4('0x15')](_0xf6b7ac));if(_0xf6b7ac[_0xf3e4('0x16')]){if(_0xf6b7ac['error']['code']===0x1f4){logger[_0xf3e4('0x16')](_0xf3e4('0x17'),_0x370623,_0xf6b7ac[_0xf3e4('0x16')]['message']);return _0x5a6780(_0xf6b7ac[_0xf3e4('0x16')]['message']);}logger[_0xf3e4('0x16')](_0xf3e4('0x17'),_0x370623,_0xf6b7ac['error'][_0xf3e4('0x18')]);return _0x2d991f(_0xf6b7ac['error'][_0xf3e4('0x18')]);}else{logger['info'](_0xf3e4('0x17'),_0x370623,_0xf3e4('0x14'));_0x2d991f(_0xf6b7ac[_0xf3e4('0x19')][_0xf3e4('0x18')]);}})['catch'](function(_0x3f14ca){logger['error'](_0xf3e4('0x17'),_0x370623,_0x3f14ca);_0x5a6780(_0x3f14ca);});});}function respondWithResult(_0x3032bc,_0x42264d){_0x42264d=_0x42264d||0xc8;return function(_0x23e034){if(_0x23e034){return _0x3032bc[_0xf3e4('0x1a')](_0x42264d)[_0xf3e4('0x1b')](_0x23e034);}};}function respondWithFilteredResult(_0x3f4a75,_0x98aeaf){return function(_0x4218eb){if(_0x4218eb){var _0x8486d1=typeof _0x98aeaf[_0xf3e4('0x1c')]===_0xf3e4('0x1d')&&typeof _0x98aeaf[_0xf3e4('0x1e')]===_0xf3e4('0x1d');var _0x3fcc9d=_0x4218eb[_0xf3e4('0x1f')];var _0x5f51c3=_0x8486d1?0x0:_0x98aeaf['offset'];var _0x377741=_0x8486d1?_0x4218eb[_0xf3e4('0x1f')]:_0x98aeaf[_0xf3e4('0x1c')]+_0x98aeaf[_0xf3e4('0x1e')];var _0x260ec3;if(_0x377741>=_0x3fcc9d){_0x377741=_0x3fcc9d;_0x260ec3=0xc8;}else{_0x260ec3=0xce;}_0x3f4a75[_0xf3e4('0x1a')](_0x260ec3);return _0x3f4a75[_0xf3e4('0x20')](_0xf3e4('0x21'),_0x5f51c3+'-'+_0x377741+'/'+_0x3fcc9d)[_0xf3e4('0x1b')](_0x4218eb);}return null;};}function saveUpdates(_0x4a2dee){return function(_0x459d62){if(_0x459d62){return _0x459d62[_0xf3e4('0x22')](_0x4a2dee)['then'](function(_0x7c302c){return _0x7c302c;});}return null;};}function removeEntity(_0x26cebe){return function(_0x4a4398){if(_0x4a4398){return _0x4a4398[_0xf3e4('0x23')]()['then'](function(){_0x26cebe[_0xf3e4('0x1a')](0xcc)[_0xf3e4('0x24')]();});}};}function handleEntityNotFound(_0x263383){return function(_0x14ae5f){if(!_0x14ae5f){_0x263383[_0xf3e4('0x25')](0x194);}return _0x14ae5f;};}function handleError(_0x467320,_0x3b7c76){_0x3b7c76=_0x3b7c76||0x1f4;return function(_0x59523e){logger[_0xf3e4('0x16')](_0x59523e['stack']);if(_0x59523e[_0xf3e4('0x26')]){delete _0x59523e['name'];}_0x467320[_0xf3e4('0x1a')](_0x3b7c76)['send'](_0x59523e);};}exports[_0xf3e4('0x27')]=function(_0x5769be,_0x2b5be3){var _0x5846be={},_0x234277={},_0x2e0ca2={'count':0x0,'rows':[]};var _0x1ca858=_[_0xf3e4('0x28')](db[_0xf3e4('0x29')][_0xf3e4('0x2a')],function(_0x8cce2f){return{'name':_0x8cce2f[_0xf3e4('0x2b')],'type':_0x8cce2f['type'][_0xf3e4('0x2c')]};});_0x234277[_0xf3e4('0x2d')]=_[_0xf3e4('0x28')](_0x1ca858,_0xf3e4('0x26'));_0x234277['query']=_['keys'](_0x5769be['query']);_0x234277[_0xf3e4('0x2e')]=_[_0xf3e4('0x2f')](_0x234277['model'],_0x234277[_0xf3e4('0x30')]);_0x5846be[_0xf3e4('0x31')]=_['intersection'](_0x234277[_0xf3e4('0x2d')],qs[_0xf3e4('0x32')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x32')]));_0x5846be[_0xf3e4('0x31')]=_0x5846be[_0xf3e4('0x31')]['length']?_0x5846be[_0xf3e4('0x31')]:_0x234277[_0xf3e4('0x2d')];if(!_0x5769be['query'][_0xf3e4('0x33')](_0xf3e4('0x34'))){_0x5846be[_0xf3e4('0x1e')]=qs[_0xf3e4('0x1e')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x1e')]);_0x5846be['offset']=qs['offset'](_0x5769be[_0xf3e4('0x30')]['offset']);}_0x5846be['order']=qs[_0xf3e4('0x35')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x35')]);_0x5846be['where']=qs['filters'](_[_0xf3e4('0x36')](_0x5769be[_0xf3e4('0x30')],_0x234277['filters']),_0x1ca858);if(_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x37')]){_0x5846be[_0xf3e4('0x38')]=_['merge'](_0x5846be['where'],{'$or':_[_0xf3e4('0x28')](_0x1ca858,function(_0x28afd3){if(_0x28afd3[_0xf3e4('0x39')]!=='VIRTUAL'){var _0x1facbf={};_0x1facbf[_0x28afd3[_0xf3e4('0x26')]]={'$like':'%'+_0x5769be['query'][_0xf3e4('0x37')]+'%'};return _0x1facbf;}})});}_0x5846be=_['merge']({},_0x5846be,_0x5769be[_0xf3e4('0x3a')]);var _0x51380c={'where':_0x5846be[_0xf3e4('0x38')]};return db['ChatMessage'][_0xf3e4('0x1f')](_0x51380c)['then'](function(_0x2a7207){_0x2e0ca2[_0xf3e4('0x1f')]=_0x2a7207;if(_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x3b')]){_0x5846be[_0xf3e4('0x3c')]=[{'all':!![]}];}return db['ChatMessage'][_0xf3e4('0x3d')](_0x5846be);})[_0xf3e4('0x12')](function(_0x22c220){_0x2e0ca2['rows']=_0x22c220;return _0x2e0ca2;})[_0xf3e4('0x12')](respondWithFilteredResult(_0x2b5be3,_0x5846be))[_0xf3e4('0x3e')](handleError(_0x2b5be3,null));};exports[_0xf3e4('0x3f')]=function(_0x2415d0,_0x27e137){var _0x3d35b4={'raw':!![],'where':{'id':_0x2415d0[_0xf3e4('0x40')]['id']}},_0x2cd4fc={};_0x2cd4fc[_0xf3e4('0x2d')]=_[_0xf3e4('0x41')](db[_0xf3e4('0x29')]['rawAttributes']);_0x2cd4fc['query']=_['keys'](_0x2415d0['query']);_0x2cd4fc['filters']=_[_0xf3e4('0x2f')](_0x2cd4fc[_0xf3e4('0x2d')],_0x2cd4fc['query']);_0x3d35b4['attributes']=_[_0xf3e4('0x2f')](_0x2cd4fc[_0xf3e4('0x2d')],qs['fields'](_0x2415d0[_0xf3e4('0x30')]['fields']));_0x3d35b4[_0xf3e4('0x31')]=_0x3d35b4[_0xf3e4('0x31')][_0xf3e4('0x42')]?_0x3d35b4[_0xf3e4('0x31')]:_0x2cd4fc[_0xf3e4('0x2d')];if(_0x2415d0[_0xf3e4('0x30')][_0xf3e4('0x3b')]){_0x3d35b4[_0xf3e4('0x3c')]=[{'all':!![]}];}_0x3d35b4=_[_0xf3e4('0x43')]({},_0x3d35b4,_0x2415d0[_0xf3e4('0x3a')]);return db['ChatMessage']['find'](_0x3d35b4)[_0xf3e4('0x12')](handleEntityNotFound(_0x27e137,null))[_0xf3e4('0x12')](respondWithResult(_0x27e137,null))[_0xf3e4('0x3e')](handleError(_0x27e137,null));};exports[_0xf3e4('0x44')]=function(_0x5466f3,_0x3cc5f8){return db['ChatMessage'][_0xf3e4('0x44')](_0x5466f3[_0xf3e4('0x45')],{})[_0xf3e4('0x12')](respondWithResult(_0x3cc5f8,0xc9))['catch'](handleError(_0x3cc5f8,null));};exports[_0xf3e4('0x22')]=function(_0x3646b5,_0x19b53f){if(_0x3646b5[_0xf3e4('0x45')]['id']){delete _0x3646b5[_0xf3e4('0x45')]['id'];}return db[_0xf3e4('0x29')][_0xf3e4('0x46')]({'where':{'id':_0x3646b5[_0xf3e4('0x40')]['id']}})[_0xf3e4('0x12')](handleEntityNotFound(_0x19b53f,null))[_0xf3e4('0x12')](saveUpdates(_0x3646b5[_0xf3e4('0x45')],null))[_0xf3e4('0x12')](respondWithResult(_0x19b53f,null))[_0xf3e4('0x3e')](handleError(_0x19b53f,null));};exports[_0xf3e4('0x23')]=function(_0x28c2b5,_0x4cea9a){return db[_0xf3e4('0x29')][_0xf3e4('0x46')]({'where':{'id':_0x28c2b5[_0xf3e4('0x40')]['id']}})[_0xf3e4('0x12')](handleEntityNotFound(_0x4cea9a,null))[_0xf3e4('0x12')](removeEntity(_0x4cea9a,null))[_0xf3e4('0x3e')](handleError(_0x4cea9a,null));};exports[_0xf3e4('0x47')]=function(_0x13fc75,_0x3063bf){return db[_0xf3e4('0x29')][_0xf3e4('0x47')]()[_0xf3e4('0x12')](respondWithResult(_0x3063bf,null))[_0xf3e4('0x3e')](handleError(_0x3063bf,null));};exports[_0xf3e4('0x48')]=function(_0x53abbf,_0x488829){var _0x34d4dd=_0xf3e4('0x49');return interactionService[_0xf3e4('0x4a')](_0x53abbf,_0x34d4dd)[_0xf3e4('0x12')](respondWithResult(_0x488829,null))[_0xf3e4('0x3e')](handleError(_0x488829,null));};exports[_0xf3e4('0x4b')]=function(_0x413070,_0x5ed390){var _0x45cce0={'agent':{},'channel':_0xf3e4('0x49')};if(_0x413070[_0xf3e4('0x45')]['id']){delete _0x413070['body']['id'];}_0x413070['body'][_0xf3e4('0x4c')]=_0x413070['body'][_0xf3e4('0x4c')]||_0x413070[_0xf3e4('0x4d')]['id'];_0x45cce0['agent']['id']=_0x413070['body'][_0xf3e4('0x4c')];return db[_0xf3e4('0x29')]['find']({'where':{'id':_0x413070[_0xf3e4('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ed390,null))[_0xf3e4('0x12')](function(_0x5d7527){if(_0x5d7527){_0x45cce0['message']=_0x5d7527['get']({'plain':!![]});return db[_0xf3e4('0x4e')][_0xf3e4('0x46')]({'where':{'id':_0x5d7527[_0xf3e4('0x4f')]}});}return null;})[_0xf3e4('0x12')](handleEntityNotFound(_0x5ed390,null))[_0xf3e4('0x12')](function(_0x5400b1){if(_0x5400b1){_0x45cce0['interaction']=_0x5400b1[_0xf3e4('0x50')]({'plain':!![]});interaction_log[_0xf3e4('0x51')](_0xf3e4('0x52'),_0x413070[_0xf3e4('0x4d')]['id'],_0x413070['user']['name'],_0x413070[_0xf3e4('0x4d')][_0xf3e4('0x53')],_0x45cce0[_0xf3e4('0x54')]['id'],_0x413070['body']?JSON[_0xf3e4('0x15')](_0x413070[_0xf3e4('0x45')]):_0xf3e4('0x55'));return respondWithRpcPromise(_0xf3e4('0x56'),_0xf3e4('0x57'),_0x45cce0);}return null;})[_0xf3e4('0x12')](function(_0x3be4c1){var _0x2ecbef=_0xf3e4('0x58')+_0x3be4c1['message'][_0xf3e4('0x59')];return db[_0xf3e4('0x5a')][_0xf3e4('0x30')](_0x2ecbef,{'type':db['Sequelize'][_0xf3e4('0x5b')][_0xf3e4('0x5c')],'raw':!![]})[_0xf3e4('0x12')](function(_0x1dbe47){return _0x1dbe47;});})[_0xf3e4('0x12')](function(_0x5b1cdb){if(_0x5b1cdb){_0x45cce0[_0xf3e4('0x18')][_0xf3e4('0x5d')]=_0x5b1cdb[0x0];if(!_0x413070[_0xf3e4('0x45')][_0xf3e4('0x4c')])return;return db[_0xf3e4('0x5e')][_0xf3e4('0x46')]({'where':{'id':_0x413070[_0xf3e4('0x45')][_0xf3e4('0x4c')],'role':_0xf3e4('0x5f')},'attributes':['id',_0xf3e4('0x26'),'fullname',_0xf3e4('0x60'),'internal'],'raw':!![]});}return null;})[_0xf3e4('0x12')](function(_0x21c5b1){if(!_0x21c5b1)return null;_0x45cce0[_0xf3e4('0x18')][_0xf3e4('0x5f')]=_0x21c5b1;return _0x45cce0;})[_0xf3e4('0x12')](function(_0xc42701){if(_0xc42701){_0xc42701[_0xf3e4('0x18')][_0xf3e4('0x61')]=util[_0xf3e4('0x62')](_0xf3e4('0x63'),_0x413070[_0xf3e4('0x4d')][_0xf3e4('0x26')]);_0xc42701['message'][_0xf3e4('0x64')]=_0x45cce0[_0xf3e4('0x64')];_0xc42701[_0xf3e4('0x18')]['motionChannel']=_0x45cce0[_0xf3e4('0x64')];_0xc42701[_0xf3e4('0x18')]['event']=_0xf3e4('0x4b');respondWithRpcPromise(_0xf3e4('0x65'),'EventManager',{'event':_0xf3e4('0x66'),'message':_[_0xf3e4('0x43')](_0x45cce0[_0xf3e4('0x18')],JSON['parse'](_0x45cce0[_0xf3e4('0x54')]['formData']))},client9002);return _0x45cce0;}return null;})['then'](respondWithResult(_0x5ed390,null))[_0xf3e4('0x3e')](handleError(_0x5ed390,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c26a15d..e8d89c5 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 _0x2a0a=['save','remove','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x5e7361,_0x31140d){var _0x248a05=function(_0x292e2c){while(--_0x292e2c){_0x5e7361['push'](_0x5e7361['shift']());}};_0x248a05(++_0x31140d);}(_0x2a0a,0x1e4));var _0xa2a0=function(_0x4a1b40,_0x3b0b46){_0x4a1b40=_0x4a1b40-0x0;var _0x268522=_0x2a0a[_0x4a1b40];return _0x268522;};'use strict';var EventEmitter=require(_0xa2a0('0x0'));var ChatMessage=require(_0xa2a0('0x1'))['db'][_0xa2a0('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa2a0('0x3')](0x0);var events={'afterCreate':_0xa2a0('0x4'),'afterUpdate':'update','afterDestroy':_0xa2a0('0x5')};function emitEvent(_0x22012d){return function(_0x371d2f,_0x2b000a,_0x94948){ChatMessageEvents[_0xa2a0('0x6')](_0x22012d+':'+_0x371d2f['id'],_0x371d2f);ChatMessageEvents[_0xa2a0('0x6')](_0x22012d,_0x371d2f);_0x94948(null);};}for(var e in events){if(events[_0xa2a0('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x1f25=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x30deef,_0x1590bc){var _0x398e43=function(_0x329367){while(--_0x329367){_0x30deef['push'](_0x30deef['shift']());}};_0x398e43(++_0x1590bc);}(_0x1f25,0x19d));var _0x51f2=function(_0x1248b6,_0x38035d){_0x1248b6=_0x1248b6-0x0;var _0x652c77=_0x1f25[_0x1248b6];return _0x652c77;};'use strict';var EventEmitter=require(_0x51f2('0x0'));var ChatMessage=require(_0x51f2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51f2('0x2'),'afterUpdate':_0x51f2('0x3'),'afterDestroy':_0x51f2('0x4')};function emitEvent(_0x38fc14){return function(_0x13ae99,_0x52a404,_0x49784f){ChatMessageEvents[_0x51f2('0x5')](_0x38fc14+':'+_0x13ae99['id'],_0x13ae99);ChatMessageEvents[_0x51f2('0x5')](_0x38fc14,_0x13ae99);_0x49784f(null);};}for(var e in events){if(events[_0x51f2('0x6')](e)){var event=events[e];ChatMessage[_0x51f2('0x7')](e,emitEvent(event));}}module[_0x51f2('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f1674a7..b34af50 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 _0x418a=['./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x4ab756,_0x4b4496){var _0x309a02=function(_0x22646f){while(--_0x22646f){_0x4ab756['push'](_0x4ab756['shift']());}};_0x309a02(++_0x4b4496);}(_0x418a,0xb7));var _0xa418=function(_0x41fe6c,_0xe9f85f){_0x41fe6c=_0x41fe6c-0x0;var _0x51f106=_0x418a[_0x41fe6c];return _0x51f106;};'use strict';var _=require(_0xa418('0x0'));var util=require(_0xa418('0x1'));var logger=require(_0xa418('0x2'))('api');var moment=require(_0xa418('0x3'));var BPromise=require('bluebird');var rp=require(_0xa418('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa418('0x5'));var config=require('../../config/environment');var attributes=require(_0xa418('0x6'));module[_0xa418('0x7')]=function(_0x5b1306,_0x10a8c8){return _0x5b1306[_0xa418('0x8')](_0xa418('0x9'),attributes,{'tableName':_0xa418('0xa'),'paranoid':![],'indexes':[{'name':_0xa418('0xb'),'fields':[_0xa418('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fed75,_0x5d15cb,_0x4d799f){var _0x29cf55=_0x5b1306[_0xa418('0xd')];var _0x43a0bc=_0x1fed75[_0xa418('0xe')]({'plain':!![]});if(_0x43a0bc[_0xa418('0xf')][_0xa418('0x10')]()==='in'||_0x43a0bc['direction']['toLowerCase']()===_0xa418('0x11')&&!_0x43a0bc['secret']&&!_[_0xa418('0x12')](_0x43a0bc['UserId'])){_0x29cf55[_0xa418('0x13')][_0xa418('0x14')]({'where':{'id':_0x43a0bc['ChatInteractionId']}})[_0xa418('0x15')](function(_0x543d2c){if(_0x543d2c){_0x543d2c[_0xa418('0x16')]({'lastMsgAt':_0x43a0bc[_0xa418('0x17')],'lastMsgDirection':_0x43a0bc[_0xa418('0xf')][_0xa418('0x10')]()});}})[_0xa418('0x18')](function(_0x5c6da7){console['error'](_0x5c6da7);});}_0x4d799f();}},'charset':_0xa418('0x19'),'collate':_0xa418('0x1a')});}; \ No newline at end of file +var _0xc081=['path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0xc081,0x14f));var _0x1c08=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0xc081[_0x431ff8];return _0x84ccd4;};'use strict';var _=require('lodash');var util=require(_0x1c08('0x0'));var logger=require(_0x1c08('0x1'))(_0x1c08('0x2'));var moment=require(_0x1c08('0x3'));var BPromise=require(_0x1c08('0x4'));var rp=require(_0x1c08('0x5'));var fs=require('fs');var path=require(_0x1c08('0x6'));var rimraf=require(_0x1c08('0x7'));var config=require('../../config/environment');var attributes=require(_0x1c08('0x8'));module[_0x1c08('0x9')]=function(_0x42283c,_0x4e6eec){return _0x42283c[_0x1c08('0xa')](_0x1c08('0xb'),attributes,{'tableName':_0x1c08('0xc'),'paranoid':![],'indexes':[{'name':_0x1c08('0xd'),'fields':[_0x1c08('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x645f58,_0x143e3f,_0x2183bc){var _0x2a050c=_0x42283c[_0x1c08('0xf')];var _0x274a4d=_0x645f58[_0x1c08('0x10')]({'plain':!![]});if(_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()==='in'||_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()==='out'&&!_0x274a4d[_0x1c08('0x13')]&&!_[_0x1c08('0x14')](_0x274a4d[_0x1c08('0x15')])){_0x2a050c[_0x1c08('0x16')][_0x1c08('0x17')]({'where':{'id':_0x274a4d[_0x1c08('0x18')]}})[_0x1c08('0x19')](function(_0x2e6a89){if(_0x2e6a89){_0x2e6a89[_0x1c08('0x1a')]({'lastMsgAt':_0x274a4d[_0x1c08('0x1b')],'lastMsgDirection':_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()});}})[_0x1c08('0x1c')](function(_0x4227db){console['error'](_0x4227db);});}_0x2183bc();}},'charset':_0x1c08('0x1d'),'collate':_0x1c08('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4ac97eb..671b673 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 _0x5aae=['stringify','error','message','request\x20sent','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','redis','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0xf78a1e,_0x19af07){var _0xc72a=function(_0xf84ce5){while(--_0xf84ce5){_0xf78a1e['push'](_0xf78a1e['shift']());}};_0xc72a(++_0x19af07);}(_0x5aae,0xe5));var _0xe5aa=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x5aae[_0x41e8c4];return _0x54ffbe;};'use strict';var _=require(_0xe5aa('0x0'));var util=require(_0xe5aa('0x1'));var moment=require(_0xe5aa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5aa('0x3'))['db'];var utils=require(_0xe5aa('0x4'));var logger=require(_0xe5aa('0x5'))('rpc');var config=require(_0xe5aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe5aa('0x7')][_0xe5aa('0x8')]({'port':0x232a});config['redis']=_[_0xe5aa('0x9')](config['redis'],{'host':_0xe5aa('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5aa('0xb')]));require(_0xe5aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xfb2450,_0x42f6ff,_0x3197e2){return new BPromise(function(_0x232e1b,_0x5c3512){return client[_0xe5aa('0xd')](_0xfb2450,_0x3197e2)[_0xe5aa('0xe')](function(_0x498150){logger[_0xe5aa('0xf')](_0xe5aa('0x10'),_0x42f6ff,'request\x20sent');logger[_0xe5aa('0x11')](_0xe5aa('0x12'),_0x42f6ff,'request\x20sent',JSON[_0xe5aa('0x13')](_0x498150));if(_0x498150[_0xe5aa('0x14')]){if(_0x498150[_0xe5aa('0x14')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x42f6ff,_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);return _0x5c3512(_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);}logger[_0xe5aa('0x14')](_0xe5aa('0x10'),_0x42f6ff,_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);return _0x232e1b(_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);}else{logger[_0xe5aa('0xf')](_0xe5aa('0x10'),_0x42f6ff,_0xe5aa('0x16'));_0x232e1b(_0x498150[_0xe5aa('0x17')][_0xe5aa('0x15')]);}})[_0xe5aa('0x18')](function(_0x3e6021){logger[_0xe5aa('0x14')]('ChatMessage,\x20%s,\x20%s',_0x42f6ff,_0x3e6021);_0x5c3512(_0x3e6021);});});}exports['CreateChatMessage']=function(_0x18cca0){var _0x37b354=this;return new Promise(function(_0xdc3427,_0x3a3f11){return db[_0xe5aa('0x19')][_0xe5aa('0x1a')](_0x18cca0[_0xe5aa('0x1b')],{'raw':_0x18cca0[_0xe5aa('0x1c')]?_0x18cca0[_0xe5aa('0x1c')][_0xe5aa('0x1d')]===undefined?!![]:![]:!![]})[_0xe5aa('0xe')](function(_0x545376){logger[_0xe5aa('0xf')](_0xe5aa('0x1e'),_0x18cca0);logger[_0xe5aa('0x11')](_0xe5aa('0x1e'),_0x18cca0,JSON['stringify'](_0x545376));_0xdc3427(_0x545376);})[_0xe5aa('0x18')](function(_0x479537){logger[_0xe5aa('0x14')](_0xe5aa('0x1e'),_0x479537[_0xe5aa('0x15')],_0x18cca0);_0x3a3f11(_0x37b354[_0xe5aa('0x14')](0x1f4,_0x479537[_0xe5aa('0x15')]));});});}; \ No newline at end of file +var _0xfc33=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc33,0xf0));var _0x3fc3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfc33[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3fc3('0x0'));var util=require(_0x3fc3('0x1'));var moment=require(_0x3fc3('0x2'));var BPromise=require(_0x3fc3('0x3'));var rs=require(_0x3fc3('0x4'));var fs=require('fs');var Redis=require(_0x3fc3('0x5'));var db=require(_0x3fc3('0x6'))['db'];var utils=require(_0x3fc3('0x7'));var logger=require('../../config/logger')(_0x3fc3('0x8'));var config=require(_0x3fc3('0x9'));var jayson=require(_0x3fc3('0xa'));var client=jayson[_0x3fc3('0xb')][_0x3fc3('0xc')]({'port':0x232a});config[_0x3fc3('0xd')]=_[_0x3fc3('0xe')](config[_0x3fc3('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fc3('0xd')]));require(_0x3fc3('0xf'))['register'](socket);function respondWithRpcPromise(_0x471b0c,_0x200521,_0x1f0f72){return new BPromise(function(_0x3c188e,_0x2a8e1b){return client[_0x3fc3('0x10')](_0x471b0c,_0x1f0f72)[_0x3fc3('0x11')](function(_0x2822ed){logger[_0x3fc3('0x12')](_0x3fc3('0x13'),_0x200521,'request\x20sent');logger[_0x3fc3('0x14')](_0x3fc3('0x15'),_0x200521,_0x3fc3('0x16'),JSON['stringify'](_0x2822ed));if(_0x2822ed[_0x3fc3('0x17')]){if(_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x18')]===0x1f4){logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x2822ed['error']['message']);return _0x2a8e1b(_0x2822ed['error'][_0x3fc3('0x19')]);}logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x19')]);return _0x3c188e(_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x19')]);}else{logger[_0x3fc3('0x12')](_0x3fc3('0x13'),_0x200521,_0x3fc3('0x16'));_0x3c188e(_0x2822ed[_0x3fc3('0x1a')][_0x3fc3('0x19')]);}})[_0x3fc3('0x1b')](function(_0x53c435){logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x53c435);_0x2a8e1b(_0x53c435);});});}exports[_0x3fc3('0x1c')]=function(_0x5ea38e){var _0x4efe16=this;return new Promise(function(_0x49a58e,_0x20f84a){return db[_0x3fc3('0x1d')][_0x3fc3('0x1e')](_0x5ea38e[_0x3fc3('0x1f')],{'raw':_0x5ea38e[_0x3fc3('0x20')]?_0x5ea38e[_0x3fc3('0x20')][_0x3fc3('0x21')]===undefined?!![]:![]:!![]})[_0x3fc3('0x11')](function(_0x57534b){logger['info'](_0x3fc3('0x1c'),_0x5ea38e);logger[_0x3fc3('0x14')](_0x3fc3('0x1c'),_0x5ea38e,JSON['stringify'](_0x57534b));_0x49a58e(_0x57534b);})['catch'](function(_0x5ca044){logger[_0x3fc3('0x17')]('CreateChatMessage',_0x5ca044[_0x3fc3('0x19')],_0x5ea38e);_0x20f84a(_0x4efe16[_0x3fc3('0x17')](0x1f4,_0x5ca044[_0x3fc3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ccad792..5585972 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 _0xcd59=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x31e16a,_0x210c6c){var _0x58e686=function(_0x2bb73c){while(--_0x2bb73c){_0x31e16a['push'](_0x31e16a['shift']());}};_0x58e686(++_0x210c6c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2df7c7,_0x5ec3eb){_0x2df7c7=_0x2df7c7-0x0;var _0x42995b=_0xcd59[_0x2df7c7];return _0x42995b;};'use strict';var ChatMessageEvents=require(_0x9cd5('0x0'));var events=[_0x9cd5('0x1'),_0x9cd5('0x2'),_0x9cd5('0x3')];function createListener(_0x271070,_0x302b21){return function(_0x4b93b9){_0x302b21[_0x9cd5('0x4')](_0x271070,_0x4b93b9);};}function removeListener(_0x191236,_0xf96efa){return function(){ChatMessageEvents[_0x9cd5('0x5')](_0x191236,_0xf96efa);};}exports[_0x9cd5('0x6')]=function(_0x2db192){for(var _0x46277c=0x0,_0x2cd19a=events[_0x9cd5('0x7')];_0x46277c<_0x2cd19a;_0x46277c++){var _0x3f888f=events[_0x46277c];var _0x545407=createListener(_0x9cd5('0x8')+_0x3f888f,_0x2db192);ChatMessageEvents['on'](_0x3f888f,_0x545407);}}; \ No newline at end of file +var _0x2fed=['emit','removeListener','register','length','./chatMessage.events','save','remove','update'];(function(_0x575df6,_0x19aa77){var _0xa101a5=function(_0x279d85){while(--_0x279d85){_0x575df6['push'](_0x575df6['shift']());}};_0xa101a5(++_0x19aa77);}(_0x2fed,0x7c));var _0xd2fe=function(_0x138400,_0x16d644){_0x138400=_0x138400-0x0;var _0x1da107=_0x2fed[_0x138400];return _0x1da107;};'use strict';var ChatMessageEvents=require(_0xd2fe('0x0'));var events=[_0xd2fe('0x1'),_0xd2fe('0x2'),_0xd2fe('0x3')];function createListener(_0x15f95a,_0x4b70e7){return function(_0x3c9206){_0x4b70e7[_0xd2fe('0x4')](_0x15f95a,_0x3c9206);};}function removeListener(_0x48707a,_0x58f3f8){return function(){ChatMessageEvents[_0xd2fe('0x5')](_0x48707a,_0x58f3f8);};}exports[_0xd2fe('0x6')]=function(_0xd85f89){for(var _0x5be4d3=0x0,_0x2f7bf5=events[_0xd2fe('0x7')];_0x5be4d3<_0x2f7bf5;_0x5be4d3++){var _0x3b6591=events[_0x5be4d3];var _0x42a8fb=createListener('chatMessage:'+_0x3b6591,_0xd85f89);ChatMessageEvents['on'](_0x3b6591,_0x42a8fb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e59331e..8f0e65e 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 _0x6328=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','chat','create','put','update','/:id/accept','reject'];(function(_0xce8373,_0x2ad630){var _0xa5cd5f=function(_0x5e0be0){while(--_0x5e0be0){_0xce8373['push'](_0xce8373['shift']());}};_0xa5cd5f(++_0x2ad630);}(_0x6328,0x1d7));var _0x8632=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x6328[_0xbf5e16];return _0x5975a5;};'use strict';var multer=require(_0x8632('0x0'));var util=require(_0x8632('0x1'));var path=require('path');var timeout=require(_0x8632('0x2'));var express=require(_0x8632('0x3'));var router=express[_0x8632('0x4')]();var fs_extra=require(_0x8632('0x5'));var auth=require(_0x8632('0x6'));var interaction=require(_0x8632('0x7'));var config=require(_0x8632('0x8'));var controller=require(_0x8632('0x9'));router[_0x8632('0xa')]('/',auth[_0x8632('0xb')](),controller['index']);router[_0x8632('0xa')](_0x8632('0xc'),auth['isAuthenticated'](),controller[_0x8632('0xd')]);router['get'](_0x8632('0xe'),auth['isAuthenticated'](),controller[_0x8632('0xf')]);router[_0x8632('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x8632('0x11'),'chatmessage:create'),controller[_0x8632('0x12')]);router[_0x8632('0x13')](_0x8632('0xe'),controller[_0x8632('0x14')]);router['put'](_0x8632('0x15'),auth[_0x8632('0xb')](),controller['accept']);router[_0x8632('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x8632('0x16')]);router[_0x8632('0x17')](_0x8632('0xe'),auth[_0x8632('0xb')](),controller[_0x8632('0x18')]);module[_0x8632('0x19')]=router; \ No newline at end of file +var _0xf6a7=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','delete','destroy','exports'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xf6a7,0xa1));var _0x7f6a=function(_0x2ab0b1,_0x4344be){_0x2ab0b1=_0x2ab0b1-0x0;var _0x30f3fc=_0xf6a7[_0x2ab0b1];return _0x30f3fc;};'use strict';var multer=require(_0x7f6a('0x0'));var util=require('util');var path=require(_0x7f6a('0x1'));var timeout=require(_0x7f6a('0x2'));var express=require(_0x7f6a('0x3'));var router=express[_0x7f6a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f6a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f6a('0x6'));var controller=require(_0x7f6a('0x7'));router[_0x7f6a('0x8')]('/',auth[_0x7f6a('0x9')](),controller['index']);router[_0x7f6a('0x8')](_0x7f6a('0xa'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0xb')]);router[_0x7f6a('0x8')](_0x7f6a('0xc'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0xd')]);router[_0x7f6a('0xe')]('/',auth[_0x7f6a('0x9')](),interaction[_0x7f6a('0xf')](_0x7f6a('0x10'),_0x7f6a('0x11')),controller['create']);router[_0x7f6a('0x12')]('/:id',controller[_0x7f6a('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x7f6a('0x14')](_0x7f6a('0xc'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0x15')]);module[_0x7f6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index bbabce2..366dcfc 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x370b75,_0x1e8cf4){var _0x4605ed=function(_0x1de0c3){while(--_0x1de0c3){_0x370b75['push'](_0x370b75['shift']());}};_0x4605ed(++_0x1e8cf4);}(_0x2032,0xd9));var _0x2203=function(_0x3391e5,_0x76cc0d){_0x3391e5=_0x3391e5-0x0;var _0x24387b=_0x2032[_0x3391e5];return _0x24387b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x31eea3,_0x2d40f2){var _0x3e7fef=function(_0x443476){while(--_0x443476){_0x31eea3['push'](_0x31eea3['shift']());}};_0x3e7fef(++_0x2d40f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0xb10b[_0x231a42];return _0x3c2a56;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('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 acf874e..c96e7f2 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x7a54,0x106));var _0x47a5=function(_0x48e390,_0x303e2c){_0x48e390=_0x48e390-0x0;var _0x326730=_0x7a54[_0x48e390];return _0x326730;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x217890,_0x40f4ed){var _0x21398a=function(_0x4e9a30){while(--_0x4e9a30){_0x217890['push'](_0x217890['shift']());}};_0x21398a(++_0x40f4ed);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 186ddb1..ad23f53 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4984=['events','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a1f0a,_0x564fcb){var _0x274c22=function(_0x463e1a){while(--_0x463e1a){_0x4a1f0a['push'](_0x4a1f0a['shift']());}};_0x274c22(++_0x564fcb);}(_0x4984,0x154));var _0x4498=function(_0x2f4aa2,_0xb72e14){_0x2f4aa2=_0x2f4aa2-0x0;var _0x4fdb16=_0x4984[_0x2f4aa2];return _0x4fdb16;};'use strict';var EventEmitter=require(_0x4498('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x4498('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4498('0x2')](0x0);var events={'afterCreate':_0x4498('0x3'),'afterUpdate':_0x4498('0x4'),'afterDestroy':_0x4498('0x5')};function emitEvent(_0x549cd5){return function(_0x35a60e,_0x3133a2,_0x7f3761){ChatOfflineMessageEvents[_0x4498('0x6')](_0x549cd5+':'+_0x35a60e['id'],_0x35a60e);ChatOfflineMessageEvents[_0x4498('0x6')](_0x549cd5,_0x35a60e);_0x7f3761(null);};}for(var e in events){if(events[_0x4498('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x4498('0x8')](e,emitEvent(event));}}module[_0x4498('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4071=['ChatOfflineMessage','setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5d3eeb,_0x1f6625){var _0x3e14d3=function(_0x87bcce){while(--_0x87bcce){_0x5d3eeb['push'](_0x5d3eeb['shift']());}};_0x3e14d3(++_0x1f6625);}(_0x4071,0x1e6));var _0x1407=function(_0x56904a,_0x1f845a){_0x56904a=_0x56904a-0x0;var _0x2825eb=_0x4071[_0x56904a];return _0x2825eb;};'use strict';var EventEmitter=require(_0x1407('0x0'));var ChatOfflineMessage=require(_0x1407('0x1'))['db'][_0x1407('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1407('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1407('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b752f){return function(_0x2ab190,_0x16809b,_0x565160){ChatOfflineMessageEvents[_0x1407('0x5')](_0x3b752f+':'+_0x2ab190['id'],_0x2ab190);ChatOfflineMessageEvents[_0x1407('0x5')](_0x3b752f,_0x2ab190);_0x565160(null);};}for(var e in events){if(events[_0x1407('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x1407('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5d44339..eea89fe 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 _0x798a=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage'];(function(_0x5e25d0,_0x15ece2){var _0x13fb23=function(_0xf27573){while(--_0xf27573){_0x5e25d0['push'](_0x5e25d0['shift']());}};_0x13fb23(++_0x15ece2);}(_0x798a,0x1a1));var _0xa798=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x798a[_0x7e2eb0];return _0xd92de4;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xa798('0x0')]=function(_0x20ee10){return _0x20ee10[_0xa798('0x1')](_0xa798('0x2'),attributes,{'tableName':_0xa798('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa798('0x4'),'collate':_0xa798('0x5')});}; \ No newline at end of file +var _0xfdd0=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x26b94d,_0x168f2f){var _0x29519f=function(_0x4717c5){while(--_0x4717c5){_0x26b94d['push'](_0x26b94d['shift']());}};_0x29519f(++_0x168f2f);}(_0xfdd0,0xb7));var _0x0fdd=function(_0x2cf818,_0x1cd613){_0x2cf818=_0x2cf818-0x0;var _0x4c1fc7=_0xfdd0[_0x2cf818];return _0x4c1fc7;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x0fdd('0x0')]=function(_0x310a4c){return _0x310a4c['define'](_0x0fdd('0x1'),attributes,{'tableName':_0x0fdd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0fdd('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 403609f..d5d1d02 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 _0x6b6d=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c10e0,_0x2ef0d2){var _0x2aa24d=function(_0x475a06){while(--_0x475a06){_0x4c10e0['push'](_0x4c10e0['shift']());}};_0x2aa24d(++_0x2ef0d2);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x6b6d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd6b6('0x0'));var util=require(_0xd6b6('0x1'));var moment=require(_0xd6b6('0x2'));var BPromise=require(_0xd6b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6b6('0x4'));var db=require(_0xd6b6('0x5'))['db'];var utils=require(_0xd6b6('0x6'));var logger=require(_0xd6b6('0x7'))('rpc');var config=require(_0xd6b6('0x8'));var jayson=require(_0xd6b6('0x9'));var client=jayson[_0xd6b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4fa7,_0x151300,_0xee52b3){return new BPromise(function(_0xb796b4,_0xf48c95){return client[_0xd6b6('0xb')](_0x1d4fa7,_0xee52b3)['then'](function(_0x577101){logger[_0xd6b6('0xc')](_0xd6b6('0xd'),_0x151300,'request\x20sent');logger[_0xd6b6('0xe')](_0xd6b6('0xf'),_0x151300,_0xd6b6('0x10'),JSON[_0xd6b6('0x11')](_0x577101));if(_0x577101[_0xd6b6('0x12')]){if(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x13')]===0x1f4){logger[_0xd6b6('0x12')](_0xd6b6('0xd'),_0x151300,_0x577101['error'][_0xd6b6('0x14')]);return _0xf48c95(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);}logger[_0xd6b6('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x151300,_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);return _0xb796b4(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);}else{logger[_0xd6b6('0xc')](_0xd6b6('0xd'),_0x151300,_0xd6b6('0x10'));_0xb796b4(_0x577101[_0xd6b6('0x15')][_0xd6b6('0x14')]);}})[_0xd6b6('0x16')](function(_0x2d3464){logger[_0xd6b6('0x12')](_0xd6b6('0xd'),_0x151300,_0x2d3464);_0xf48c95(_0x2d3464);});});} \ No newline at end of file +var _0xc2e5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4cee82,_0x208e67){var _0x200c1d=function(_0x372584){while(--_0x372584){_0x4cee82['push'](_0x4cee82['shift']());}};_0x200c1d(++_0x208e67);}(_0xc2e5,0x6f));var _0x5c2e=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xc2e5[_0x4fe19c];return _0x952ac7;};'use strict';var _=require('lodash');var util=require(_0x5c2e('0x0'));var moment=require(_0x5c2e('0x1'));var BPromise=require(_0x5c2e('0x2'));var rs=require(_0x5c2e('0x3'));var fs=require('fs');var Redis=require(_0x5c2e('0x4'));var db=require(_0x5c2e('0x5'))['db'];var utils=require(_0x5c2e('0x6'));var logger=require('../../config/logger')(_0x5c2e('0x7'));var config=require(_0x5c2e('0x8'));var jayson=require(_0x5c2e('0x9'));var client=jayson['client'][_0x5c2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5316f3,_0x3f34d9,_0x461b83){return new BPromise(function(_0x11782c,_0xb70b30){return client[_0x5c2e('0xb')](_0x5316f3,_0x461b83)['then'](function(_0x3f2455){logger[_0x5c2e('0xc')](_0x5c2e('0xd'),_0x3f34d9,_0x5c2e('0xe'));logger[_0x5c2e('0xf')](_0x5c2e('0x10'),_0x3f34d9,'request\x20sent',JSON[_0x5c2e('0x11')](_0x3f2455));if(_0x3f2455[_0x5c2e('0x12')]){if(_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x13')]===0x1f4){logger[_0x5c2e('0x12')](_0x5c2e('0xd'),_0x3f34d9,_0x3f2455['error'][_0x5c2e('0x14')]);return _0xb70b30(_0x3f2455['error']['message']);}logger[_0x5c2e('0x12')](_0x5c2e('0xd'),_0x3f34d9,_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x14')]);return _0x11782c(_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x14')]);}else{logger[_0x5c2e('0xc')](_0x5c2e('0xd'),_0x3f34d9,_0x5c2e('0xe'));_0x11782c(_0x3f2455[_0x5c2e('0x15')][_0x5c2e('0x14')]);}})[_0x5c2e('0x16')](function(_0x50210c){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f34d9,_0x50210c);_0xb70b30(_0x50210c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f8f9316..d84665f 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 _0x7a8d=['/:id','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','update'];(function(_0x1b502c,_0x251bbe){var _0x5f5561=function(_0x47bdf7){while(--_0x47bdf7){_0x1b502c['push'](_0x1b502c['shift']());}};_0x5f5561(++_0x251bbe);}(_0x7a8d,0xab));var _0xd7a8=function(_0x546ec1,_0x10b117){_0x546ec1=_0x546ec1-0x0;var _0x3031ef=_0x7a8d[_0x546ec1];return _0x3031ef;};'use strict';var multer=require(_0xd7a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7a8('0x1'));var express=require(_0xd7a8('0x2'));var router=express['Router']();var fs_extra=require(_0xd7a8('0x3'));var auth=require(_0xd7a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd7a8('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0xd7a8('0x6')]('/',auth[_0xd7a8('0x7')](),controller[_0xd7a8('0x8')]);router['get']('/describe',auth[_0xd7a8('0x7')](),controller['describe']);router[_0xd7a8('0x6')]('/:id',auth[_0xd7a8('0x7')](),controller['show']);router[_0xd7a8('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd7a8('0x7')](),controller[_0xd7a8('0xa')]);router['delete'](_0xd7a8('0xb'),auth[_0xd7a8('0x7')](),controller[_0xd7a8('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8d2c=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x8d2c,0xfd));var _0xc8d2=function(_0x1ebec5,_0x28e315){_0x1ebec5=_0x1ebec5-0x0;var _0x9b7fa7=_0x8d2c[_0x1ebec5];return _0x9b7fa7;};'use strict';var multer=require('multer');var util=require(_0xc8d2('0x0'));var path=require('path');var timeout=require(_0xc8d2('0x1'));var express=require(_0xc8d2('0x2'));var router=express[_0xc8d2('0x3')]();var fs_extra=require(_0xc8d2('0x4'));var auth=require(_0xc8d2('0x5'));var interaction=require(_0xc8d2('0x6'));var config=require(_0xc8d2('0x7'));var controller=require(_0xc8d2('0x8'));router[_0xc8d2('0x9')]('/',auth[_0xc8d2('0xa')](),controller[_0xc8d2('0xb')]);router['get'](_0xc8d2('0xc'),auth[_0xc8d2('0xa')](),controller[_0xc8d2('0xd')]);router[_0xc8d2('0x9')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0xf')]);router[_0xc8d2('0x10')]('/',auth[_0xc8d2('0xa')](),controller[_0xc8d2('0x11')]);router[_0xc8d2('0x12')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0x13')]);router[_0xc8d2('0x14')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0x15')]);module[_0xc8d2('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 876e290..41d383c 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 _0xb2a8=['STRING','INTEGER','exports','ENUM','mouseOver'];(function(_0x4ab759,_0x552b39){var _0x3f3435=function(_0x14aac6){while(--_0x14aac6){_0x4ab759['push'](_0x4ab759['shift']());}};_0x3f3435(++_0x552b39);}(_0xb2a8,0x18d));var _0x8b2a=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb2a8[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module[_0x8b2a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8b2a('0x1')](_0x8b2a('0x2'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x8b2a('0x3')]},'timeout':{'type':Sequelize[_0x8b2a('0x4')]}}; \ No newline at end of file +var _0xf1aa=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x36315e,_0x1cb3fc){var _0x905dc=function(_0x15e32f){while(--_0x15e32f){_0x36315e['push'](_0x36315e['shift']());}};_0x905dc(++_0x1cb3fc);}(_0xf1aa,0x1cb));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xaf1a('0x0'));module[_0xaf1a('0x1')]={'name':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf1a('0x3')](_0xaf1a('0x4'),_0xaf1a('0x5')),'defaultValue':_0xaf1a('0x4')},'selector':{'type':Sequelize[_0xaf1a('0x2')]},'timeout':{'type':Sequelize[_0xaf1a('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a574fb7..3f8f64a 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 _0x7722=['bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','show','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x252e9d,_0x4d938b){var _0x251f6d=function(_0x5c97e7){while(--_0x5c97e7){_0x252e9d['push'](_0x252e9d['shift']());}};_0x251f6d(++_0x4d938b);}(_0x7722,0x14e));var _0x2772=function(_0x3c85f1,_0x4cee02){_0x3c85f1=_0x3c85f1-0x0;var _0x22ad27=_0x7722[_0x3c85f1];return _0x22ad27;};'use strict';var emlformat=require(_0x2772('0x0'));var rimraf=require(_0x2772('0x1'));var zipdir=require(_0x2772('0x2'));var jsonpatch=require(_0x2772('0x3'));var rp=require(_0x2772('0x4'));var moment=require(_0x2772('0x5'));var BPromise=require(_0x2772('0x6'));var Mustache=require(_0x2772('0x7'));var util=require(_0x2772('0x8'));var path=require('path');var sox=require(_0x2772('0x9'));var csv=require('to-csv');var ejs=require(_0x2772('0xa'));var fs=require('fs');var fs_extra=require(_0x2772('0xb'));var _=require(_0x2772('0xc'));var squel=require(_0x2772('0xd'));var crypto=require(_0x2772('0xe'));var jsforce=require(_0x2772('0xf'));var deskjs=require(_0x2772('0x10'));var toCsv=require(_0x2772('0x11'));var querystring=require(_0x2772('0x12'));var Papa=require(_0x2772('0x13'));var Redis=require(_0x2772('0x14'));var authService=require(_0x2772('0x15'));var qs=require(_0x2772('0x16'));var as=require(_0x2772('0x17'));var hardwareService=require(_0x2772('0x18'));var logger=require(_0x2772('0x19'))('api');var utils=require(_0x2772('0x1a'));var config=require(_0x2772('0x1b'));var licenseUtil=require(_0x2772('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b427,_0x35afaf){_0x35afaf=_0x35afaf||0xcc;return function(_0x3d1440){if(_0x3d1440){return _0x14b427[_0x2772('0x1d')](_0x35afaf);}return _0x14b427[_0x2772('0x1e')](_0x35afaf)['end']();};}function respondWithResult(_0x21443a,_0x286672){_0x286672=_0x286672||0xc8;return function(_0x38fa62){if(_0x38fa62){return _0x21443a[_0x2772('0x1e')](_0x286672)['json'](_0x38fa62);}};}function respondWithFilteredResult(_0x1aecec,_0x580a8b){return function(_0x245645){if(_0x245645){var _0x122628=typeof _0x580a8b[_0x2772('0x1f')]===_0x2772('0x20')&&typeof _0x580a8b[_0x2772('0x21')]===_0x2772('0x20');var _0x314ba1=_0x245645['count'];var _0x27868d=_0x122628?0x0:_0x580a8b[_0x2772('0x1f')];var _0x3dd1ed=_0x122628?_0x245645[_0x2772('0x22')]:_0x580a8b[_0x2772('0x1f')]+_0x580a8b[_0x2772('0x21')];var _0x34eb25;if(_0x3dd1ed>=_0x314ba1){_0x3dd1ed=_0x314ba1;_0x34eb25=0xc8;}else{_0x34eb25=0xce;}_0x1aecec[_0x2772('0x1e')](_0x34eb25);return _0x1aecec[_0x2772('0x23')](_0x2772('0x24'),_0x27868d+'-'+_0x3dd1ed+'/'+_0x314ba1)['json'](_0x245645);}return null;};}function patchUpdates(_0x51beac){return function(_0x123e62){try{jsonpatch[_0x2772('0x25')](_0x123e62,_0x51beac,!![]);}catch(_0x2ef869){return BPromise[_0x2772('0x26')](_0x2ef869);}return _0x123e62[_0x2772('0x27')]();};}function saveUpdates(_0x4a3e28,_0x35a0dd){return function(_0x11c1b8){if(_0x11c1b8){return _0x11c1b8['update'](_0x4a3e28)['then'](function(_0x499214){return _0x499214;});}return null;};}function removeEntity(_0x5bc8f7,_0x52c703){return function(_0x4147dc){if(_0x4147dc){return _0x4147dc['destroy']()[_0x2772('0x28')](function(){_0x5bc8f7[_0x2772('0x1e')](0xcc)[_0x2772('0x29')]();});}};}function handleEntityNotFound(_0x26ffc5,_0x3d4c2f){return function(_0x111fdd){if(!_0x111fdd){_0x26ffc5[_0x2772('0x1d')](0x194);}return _0x111fdd;};}function handleError(_0xd34b26,_0x43995a){_0x43995a=_0x43995a||0x1f4;return function(_0x2de9a4){logger[_0x2772('0x2a')](_0x2de9a4[_0x2772('0x2b')]);if(_0x2de9a4['name']){delete _0x2de9a4[_0x2772('0x2c')];}_0xd34b26[_0x2772('0x1e')](_0x43995a)[_0x2772('0x2d')](_0x2de9a4);};}exports[_0x2772('0x2e')]=function(_0x3c7dda,_0x4923b0){var _0x4583d4={'raw':!![],'where':{'id':_0x3c7dda[_0x2772('0x2f')]['id']}},_0x4323f0={};_0x4323f0['model']=_['keys'](db[_0x2772('0x30')][_0x2772('0x31')]);_0x4323f0[_0x2772('0x32')]=_[_0x2772('0x33')](_0x3c7dda['query']);_0x4323f0[_0x2772('0x34')]=_[_0x2772('0x35')](_0x4323f0[_0x2772('0x36')],_0x4323f0['query']);_0x4583d4[_0x2772('0x37')]=_[_0x2772('0x35')](_0x4323f0[_0x2772('0x36')],qs['fields'](_0x3c7dda['query'][_0x2772('0x38')]));_0x4583d4['attributes']=_0x4583d4['attributes'][_0x2772('0x39')]?_0x4583d4[_0x2772('0x37')]:_0x4323f0[_0x2772('0x36')];if(_0x3c7dda[_0x2772('0x32')][_0x2772('0x3a')]){_0x4583d4[_0x2772('0x3b')]=[{'all':!![]}];}_0x4583d4=_[_0x2772('0x3c')]({},_0x4583d4,_0x3c7dda[_0x2772('0x3d')]);return db[_0x2772('0x30')][_0x2772('0x3e')](_0x4583d4)[_0x2772('0x28')](handleEntityNotFound(_0x4923b0,null))[_0x2772('0x28')](respondWithResult(_0x4923b0,null))[_0x2772('0x3f')](handleError(_0x4923b0,null));};exports['create']=function(_0xef3a95,_0x3b3ef2){return db[_0x2772('0x30')][_0x2772('0x40')](_0xef3a95['body'],{})[_0x2772('0x28')](respondWithResult(_0x3b3ef2,0xc9))[_0x2772('0x3f')](handleError(_0x3b3ef2,null));};exports[_0x2772('0x41')]=function(_0x20aefd,_0x44ef94){if(_0x20aefd[_0x2772('0x42')]['id']){delete _0x20aefd[_0x2772('0x42')]['id'];}return db[_0x2772('0x30')]['find']({'where':{'id':_0x20aefd[_0x2772('0x2f')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x44ef94,null))[_0x2772('0x28')](saveUpdates(_0x20aefd[_0x2772('0x42')],null))['then'](respondWithResult(_0x44ef94,null))[_0x2772('0x3f')](handleError(_0x44ef94,null));};exports[_0x2772('0x43')]=function(_0x488424,_0x2eb1e6){return db[_0x2772('0x30')][_0x2772('0x3e')]({'where':{'id':_0x488424[_0x2772('0x2f')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x2eb1e6,null))[_0x2772('0x28')](removeEntity(_0x2eb1e6,null))[_0x2772('0x3f')](handleError(_0x2eb1e6,null));}; \ No newline at end of file +var _0x0d4e=['fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','undefined','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes'];(function(_0x989656,_0x51b2b2){var _0x4be280=function(_0x4987a7){while(--_0x4987a7){_0x989656['push'](_0x989656['shift']());}};_0x4be280(++_0x51b2b2);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0d4e[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xe0d4('0x0'));var rimraf=require(_0xe0d4('0x1'));var zipdir=require(_0xe0d4('0x2'));var jsonpatch=require(_0xe0d4('0x3'));var rp=require(_0xe0d4('0x4'));var moment=require(_0xe0d4('0x5'));var BPromise=require(_0xe0d4('0x6'));var Mustache=require(_0xe0d4('0x7'));var util=require(_0xe0d4('0x8'));var path=require('path');var sox=require(_0xe0d4('0x9'));var csv=require(_0xe0d4('0xa'));var ejs=require(_0xe0d4('0xb'));var fs=require('fs');var fs_extra=require(_0xe0d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0d4('0xd'));var jsforce=require(_0xe0d4('0xe'));var deskjs=require(_0xe0d4('0xf'));var toCsv=require(_0xe0d4('0xa'));var querystring=require(_0xe0d4('0x10'));var Papa=require(_0xe0d4('0x11'));var Redis=require(_0xe0d4('0x12'));var authService=require(_0xe0d4('0x13'));var qs=require(_0xe0d4('0x14'));var as=require(_0xe0d4('0x15'));var hardwareService=require(_0xe0d4('0x16'));var logger=require(_0xe0d4('0x17'))(_0xe0d4('0x18'));var utils=require('../../config/utils');var config=require(_0xe0d4('0x19'));var licenseUtil=require(_0xe0d4('0x1a'));var db=require(_0xe0d4('0x1b'))['db'];function respondWithStatusCode(_0x258e16,_0x34bce6){_0x34bce6=_0x34bce6||0xcc;return function(_0x2561b5){if(_0x2561b5){return _0x258e16[_0xe0d4('0x1c')](_0x34bce6);}return _0x258e16[_0xe0d4('0x1d')](_0x34bce6)[_0xe0d4('0x1e')]();};}function respondWithResult(_0x161175,_0x3bbfd3){_0x3bbfd3=_0x3bbfd3||0xc8;return function(_0x42db0e){if(_0x42db0e){return _0x161175[_0xe0d4('0x1d')](_0x3bbfd3)[_0xe0d4('0x1f')](_0x42db0e);}};}function respondWithFilteredResult(_0x3a2a41,_0x4d536f){return function(_0x25b833){if(_0x25b833){var _0x3c0986=typeof _0x4d536f[_0xe0d4('0x20')]==='undefined'&&typeof _0x4d536f['limit']===_0xe0d4('0x21');var _0x252b69=_0x25b833[_0xe0d4('0x22')];var _0x174bfa=_0x3c0986?0x0:_0x4d536f[_0xe0d4('0x20')];var _0x58bd0a=_0x3c0986?_0x25b833[_0xe0d4('0x22')]:_0x4d536f[_0xe0d4('0x20')]+_0x4d536f[_0xe0d4('0x23')];var _0x20795b;if(_0x58bd0a>=_0x252b69){_0x58bd0a=_0x252b69;_0x20795b=0xc8;}else{_0x20795b=0xce;}_0x3a2a41[_0xe0d4('0x1d')](_0x20795b);return _0x3a2a41['set'](_0xe0d4('0x24'),_0x174bfa+'-'+_0x58bd0a+'/'+_0x252b69)['json'](_0x25b833);}return null;};}function patchUpdates(_0x533a85){return function(_0x795cf5){try{jsonpatch[_0xe0d4('0x25')](_0x795cf5,_0x533a85,!![]);}catch(_0x20c2c8){return BPromise['reject'](_0x20c2c8);}return _0x795cf5[_0xe0d4('0x26')]();};}function saveUpdates(_0x4527e9,_0x7e5713){return function(_0xb97419){if(_0xb97419){return _0xb97419[_0xe0d4('0x27')](_0x4527e9)[_0xe0d4('0x28')](function(_0x1e13bf){return _0x1e13bf;});}return null;};}function removeEntity(_0x18613d,_0x51adfc){return function(_0x4bfdef){if(_0x4bfdef){return _0x4bfdef[_0xe0d4('0x29')]()[_0xe0d4('0x28')](function(){_0x18613d['status'](0xcc)[_0xe0d4('0x1e')]();});}};}function handleEntityNotFound(_0x48cdef,_0x13c108){return function(_0x9fc63d){if(!_0x9fc63d){_0x48cdef[_0xe0d4('0x1c')](0x194);}return _0x9fc63d;};}function handleError(_0x4becc8,_0x3fe0c9){_0x3fe0c9=_0x3fe0c9||0x1f4;return function(_0x525088){logger['error'](_0x525088[_0xe0d4('0x2a')]);if(_0x525088[_0xe0d4('0x2b')]){delete _0x525088[_0xe0d4('0x2b')];}_0x4becc8[_0xe0d4('0x1d')](_0x3fe0c9)[_0xe0d4('0x2c')](_0x525088);};}exports[_0xe0d4('0x2d')]=function(_0xcae18f,_0x12089c){var _0xe65b15={'raw':!![],'where':{'id':_0xcae18f[_0xe0d4('0x2e')]['id']}},_0x4573ee={};_0x4573ee[_0xe0d4('0x2f')]=_[_0xe0d4('0x30')](db[_0xe0d4('0x31')]['rawAttributes']);_0x4573ee[_0xe0d4('0x32')]=_['keys'](_0xcae18f[_0xe0d4('0x32')]);_0x4573ee[_0xe0d4('0x33')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],_0x4573ee[_0xe0d4('0x32')]);_0xe65b15[_0xe0d4('0x35')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],qs[_0xe0d4('0x36')](_0xcae18f[_0xe0d4('0x32')][_0xe0d4('0x36')]));_0xe65b15[_0xe0d4('0x35')]=_0xe65b15['attributes'][_0xe0d4('0x37')]?_0xe65b15['attributes']:_0x4573ee[_0xe0d4('0x2f')];if(_0xcae18f['query'][_0xe0d4('0x38')]){_0xe65b15[_0xe0d4('0x39')]=[{'all':!![]}];}_0xe65b15=_[_0xe0d4('0x3a')]({},_0xe65b15,_0xcae18f[_0xe0d4('0x3b')]);return db['ChatProactiveAction'][_0xe0d4('0x3c')](_0xe65b15)[_0xe0d4('0x28')](handleEntityNotFound(_0x12089c,null))[_0xe0d4('0x28')](respondWithResult(_0x12089c,null))[_0xe0d4('0x3d')](handleError(_0x12089c,null));};exports[_0xe0d4('0x3e')]=function(_0xb845dc,_0x1932c2){return db[_0xe0d4('0x31')][_0xe0d4('0x3e')](_0xb845dc['body'],{})[_0xe0d4('0x28')](respondWithResult(_0x1932c2,0xc9))[_0xe0d4('0x3d')](handleError(_0x1932c2,null));};exports['update']=function(_0x2042ae,_0x396fe2){if(_0x2042ae[_0xe0d4('0x3f')]['id']){delete _0x2042ae[_0xe0d4('0x3f')]['id'];}return db[_0xe0d4('0x31')][_0xe0d4('0x3c')]({'where':{'id':_0x2042ae['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0x396fe2,null))['then'](saveUpdates(_0x2042ae['body'],null))['then'](respondWithResult(_0x396fe2,null))[_0xe0d4('0x3d')](handleError(_0x396fe2,null));};exports[_0xe0d4('0x29')]=function(_0x1bd6e8,_0xd732fc){return db[_0xe0d4('0x31')]['find']({'where':{'id':_0x1bd6e8['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0xd732fc,null))[_0xe0d4('0x28')](removeEntity(_0xd732fc,null))[_0xe0d4('0x3d')](handleError(_0xd732fc,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2be812d..e8d0b6e 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 _0x3f57=['define','ChatProactiveAction','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x3bc086,_0x2d5f25){var _0x434424=function(_0x1d2bfa){while(--_0x1d2bfa){_0x3bc086['push'](_0x3bc086['shift']());}};_0x434424(++_0x2d5f25);}(_0x3f57,0x1ca));var _0x73f5=function(_0x396d77,_0x3d62b1){_0x396d77=_0x396d77-0x0;var _0x22379a=_0x3f57[_0x396d77];return _0x22379a;};'use strict';var _=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var logger=require('../../config/logger')(_0x73f5('0x2'));var moment=require(_0x73f5('0x3'));var BPromise=require(_0x73f5('0x4'));var rp=require(_0x73f5('0x5'));var fs=require('fs');var path=require(_0x73f5('0x6'));var rimraf=require('rimraf');var config=require(_0x73f5('0x7'));var attributes=require(_0x73f5('0x8'));module[_0x73f5('0x9')]=function(_0x57e2e0,_0x577a36){return _0x57e2e0[_0x73f5('0xa')](_0x73f5('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c31=['path','../../config/environment','exports','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a2c4c,_0x4e6d8f){var _0x364481=function(_0x40c2be){while(--_0x40c2be){_0x2a2c4c['push'](_0x2a2c4c['shift']());}};_0x364481(++_0x4e6d8f);}(_0x8c31,0x12e));var _0x18c3=function(_0x3f5262,_0x1ad642){_0x3f5262=_0x3f5262-0x0;var _0x113366=_0x8c31[_0x3f5262];return _0x113366;};'use strict';var _=require(_0x18c3('0x0'));var util=require(_0x18c3('0x1'));var logger=require(_0x18c3('0x2'))('api');var moment=require(_0x18c3('0x3'));var BPromise=require(_0x18c3('0x4'));var rp=require(_0x18c3('0x5'));var fs=require('fs');var path=require(_0x18c3('0x6'));var rimraf=require('rimraf');var config=require(_0x18c3('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x18c3('0x8')]=function(_0x361a05,_0x3e9ae3){return _0x361a05[_0x18c3('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x18c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8cc017d..522c142 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 _0x56c1=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x56c1,0xb7));var _0x156c=function(_0x50caa6,_0x140c98){_0x50caa6=_0x50caa6-0x0;var _0x5627eb=_0x56c1[_0x50caa6];return _0x5627eb;};'use strict';var _=require(_0x156c('0x0'));var util=require('util');var moment=require(_0x156c('0x1'));var BPromise=require(_0x156c('0x2'));var rs=require(_0x156c('0x3'));var fs=require('fs');var Redis=require(_0x156c('0x4'));var db=require(_0x156c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x156c('0x6'))(_0x156c('0x7'));var config=require(_0x156c('0x8'));var jayson=require(_0x156c('0x9'));var client=jayson[_0x156c('0xa')][_0x156c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59b8b5,_0x1b984c,_0x23f2c0){return new BPromise(function(_0x5f1e5b,_0x17c15f){return client[_0x156c('0xc')](_0x59b8b5,_0x23f2c0)[_0x156c('0xd')](function(_0x554665){logger[_0x156c('0xe')](_0x156c('0xf'),_0x1b984c,_0x156c('0x10'));logger[_0x156c('0x11')](_0x156c('0x12'),_0x1b984c,_0x156c('0x10'),JSON[_0x156c('0x13')](_0x554665));if(_0x554665[_0x156c('0x14')]){if(_0x554665['error'][_0x156c('0x15')]===0x1f4){logger[_0x156c('0x14')](_0x156c('0xf'),_0x1b984c,_0x554665[_0x156c('0x14')][_0x156c('0x16')]);return _0x17c15f(_0x554665['error'][_0x156c('0x16')]);}logger['error'](_0x156c('0xf'),_0x1b984c,_0x554665[_0x156c('0x14')][_0x156c('0x16')]);return _0x5f1e5b(_0x554665[_0x156c('0x14')][_0x156c('0x16')]);}else{logger['info'](_0x156c('0xf'),_0x1b984c,'request\x20sent');_0x5f1e5b(_0x554665[_0x156c('0x17')][_0x156c('0x16')]);}})[_0x156c('0x18')](function(_0x1f9702){logger['error'](_0x156c('0xf'),_0x1b984c,_0x1f9702);_0x17c15f(_0x1f9702);});});} \ No newline at end of file +var _0xcb68=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x15f941,_0x4637f4){var _0x473b27=function(_0x2a63f3){while(--_0x2a63f3){_0x15f941['push'](_0x15f941['shift']());}};_0x473b27(++_0x4637f4);}(_0xcb68,0x1d1));var _0x8cb6=function(_0x1e73ec,_0x46f875){_0x1e73ec=_0x1e73ec-0x0;var _0x44ee6b=_0xcb68[_0x1e73ec];return _0x44ee6b;};'use strict';var _=require(_0x8cb6('0x0'));var util=require(_0x8cb6('0x1'));var moment=require(_0x8cb6('0x2'));var BPromise=require(_0x8cb6('0x3'));var rs=require(_0x8cb6('0x4'));var fs=require('fs');var Redis=require(_0x8cb6('0x5'));var db=require(_0x8cb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cb6('0x7'))('rpc');var config=require(_0x8cb6('0x8'));var jayson=require(_0x8cb6('0x9'));var client=jayson['client'][_0x8cb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4ecc,_0x62da10,_0x370825){return new BPromise(function(_0x2646fb,_0xb430cf){return client['request'](_0x5a4ecc,_0x370825)[_0x8cb6('0xb')](function(_0x21717f){logger[_0x8cb6('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x62da10,_0x8cb6('0xd'));logger['debug'](_0x8cb6('0xe'),_0x62da10,_0x8cb6('0xd'),JSON[_0x8cb6('0xf')](_0x21717f));if(_0x21717f[_0x8cb6('0x10')]){if(_0x21717f['error'][_0x8cb6('0x11')]===0x1f4){logger[_0x8cb6('0x10')](_0x8cb6('0x12'),_0x62da10,_0x21717f[_0x8cb6('0x10')]['message']);return _0xb430cf(_0x21717f[_0x8cb6('0x10')]['message']);}logger[_0x8cb6('0x10')](_0x8cb6('0x12'),_0x62da10,_0x21717f['error'][_0x8cb6('0x13')]);return _0x2646fb(_0x21717f[_0x8cb6('0x10')]['message']);}else{logger['info'](_0x8cb6('0x12'),_0x62da10,_0x8cb6('0xd'));_0x2646fb(_0x21717f[_0x8cb6('0x14')][_0x8cb6('0x13')]);}})[_0x8cb6('0x15')](function(_0x28c7f0){logger['error'](_0x8cb6('0x12'),_0x62da10,_0x28c7f0);_0xb430cf(_0x28c7f0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 80aa709..778cb86 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 _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0x1f467a,_0x541b53){var _0x4776f9=function(_0x556e0e){while(--_0x556e0e){_0x1f467a['push'](_0x1f467a['shift']());}};_0x4776f9(++_0x541b53);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x24e994,_0x4c48fe){_0x24e994=_0x24e994-0x0;var _0xbbf19a=_0xbd51[_0x24e994];return _0xbbf19a;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0x7da7,0x10d));var _0x77da=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x7da7[_0x284bc3];return _0x41ac81;};'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 fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3d9c094..4723efc 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 _0x01f8=['STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x619d16,_0x56d4a3){var _0x481301=function(_0x365ab2){while(--_0x365ab2){_0x619d16['push'](_0x619d16['shift']());}};_0x481301(++_0x56d4a3);}(_0x01f8,0x1c1));var _0x801f=function(_0x5d61f8,_0x45c759){_0x5d61f8=_0x5d61f8-0x0;var _0x21a83a=_0x01f8[_0x5d61f8];return _0x21a83a;};'use strict';var Sequelize=require(_0x801f('0x0'));module['exports']={'name':{'type':Sequelize[_0x801f('0x1')],'unique':_0x801f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x801f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x801f('0x4'),_0x801f('0x5'))}}; \ No newline at end of file +var _0x03a8=['sequelize','STRING','name','INTEGER'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0x03a8,0x16c));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x803a('0x0'));module['exports']={'name':{'type':Sequelize[_0x803a('0x1')],'unique':_0x803a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x803a('0x1')]},'timeout':{'type':Sequelize[_0x803a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4af0210..4545ce1 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 _0x2339=['squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','ChatQueue','include','query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','nolimit','order','sort','where','pick','ChatQueueId','map','filter','options','findAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','User','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','ids','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','util','lodash'];(function(_0x19ce7a,_0x2317f7){var _0x57d7b1=function(_0x547bb1){while(--_0x547bb1){_0x19ce7a['push'](_0x19ce7a['shift']());}};_0x57d7b1(++_0x2317f7);}(_0x2339,0xf2));var _0x9233=function(_0x3f527c,_0x33dc39){_0x3f527c=_0x3f527c-0x0;var _0x5bc470=_0x2339[_0x3f527c];return _0x5bc470;};'use strict';var BPromise=require('bluebird');var util=require(_0x9233('0x0'));var _=require(_0x9233('0x1'));var squel=require(_0x9233('0x2'));var Redis=require('ioredis');var qs=require(_0x9233('0x3'));var logger=require(_0x9233('0x4'))(_0x9233('0x5'));var config=require('../../config/environment');var db=require(_0x9233('0x6'))['db'];config[_0x9233('0x7')]=_[_0x9233('0x8')](config[_0x9233('0x7')],{'host':_0x9233('0x9'),'port':0x18eb});var socket=require(_0x9233('0xa'))(new Redis(config[_0x9233('0x7')]));require(_0x9233('0xb'))['register'](socket);function respondWithStatusCode(_0x47eb42,_0x36ab37){_0x36ab37=_0x36ab37||0xcc;return function(_0x338d93){if(_0x338d93){return _0x47eb42[_0x9233('0xc')](_0x36ab37);}return _0x47eb42[_0x9233('0xd')](_0x36ab37)['end']();};}function respondWithResult(_0x3f4e7b,_0x27333e){_0x27333e=_0x27333e||0xc8;return function(_0x282625){if(_0x282625){return _0x3f4e7b['status'](_0x27333e)[_0x9233('0xe')](_0x282625);}};}function respondWithFilteredResult(_0x587147,_0x35d953){return function(_0x26de7d){if(_0x26de7d){var _0x130cb2=typeof _0x35d953[_0x9233('0xf')]==='undefined'&&typeof _0x35d953['limit']===_0x9233('0x10');var _0x3dd6b8=_0x26de7d[_0x9233('0x11')];var _0x6e6c62=_0x130cb2?0x0:_0x35d953[_0x9233('0xf')];var _0x10ff6c=_0x130cb2?_0x26de7d[_0x9233('0x11')]:_0x35d953[_0x9233('0xf')]+_0x35d953[_0x9233('0x12')];var _0x1fb62d;if(_0x10ff6c>=_0x3dd6b8){_0x10ff6c=_0x3dd6b8;_0x1fb62d=0xc8;}else{_0x1fb62d=0xce;}_0x587147[_0x9233('0xd')](_0x1fb62d);return _0x587147[_0x9233('0x13')](_0x9233('0x14'),_0x6e6c62+'-'+_0x10ff6c+'/'+_0x3dd6b8)[_0x9233('0xe')](_0x26de7d);}return null;};}function saveUpdates(_0x3a0993){return function(_0x4cdba5){if(_0x4cdba5){return _0x4cdba5['update'](_0x3a0993)['then'](function(_0x551073){return _0x551073;});}return null;};}function removeEntity(_0x4073ff){return function(_0x4ab4e7){if(_0x4ab4e7){return _0x4ab4e7[_0x9233('0x15')]()[_0x9233('0x16')](function(){var _0x295ea5=_0x4ab4e7[_0x9233('0x17')]({'plain':!![]});var _0x414f30=_0x9233('0x18');return db[_0x9233('0x19')][_0x9233('0x15')]({'where':{'type':_0x414f30,'resourceId':_0x295ea5['id']}})[_0x9233('0x16')](function(){return _0x4ab4e7;});})[_0x9233('0x16')](function(){_0x4073ff['status'](0xcc)[_0x9233('0x1a')]();});}};}function handleEntityNotFound(_0x259b65){return function(_0x1f5cb8){if(!_0x1f5cb8){_0x259b65[_0x9233('0xc')](0x194);}return _0x1f5cb8;};}function handleError(_0xddb274,_0x58f166){_0x58f166=_0x58f166||0x1f4;return function(_0x3f8541){logger[_0x9233('0x1b')](_0x3f8541[_0x9233('0x1c')]);if(_0x3f8541['name']){delete _0x3f8541[_0x9233('0x1d')];}_0xddb274[_0x9233('0xd')](_0x58f166)[_0x9233('0x1e')](_0x3f8541);};}exports[_0x9233('0x1f')]=function(_0x53ad7b,_0x56fd8b){var _0x54a697={};var _0xb8ddac={'count':0x0,'rows':[]};var _0x5ee2a1=_['map'](db['ChatQueue'][_0x9233('0x20')],function(_0x12006a){return{'name':_0x12006a[_0x9233('0x21')],'type':_0x12006a[_0x9233('0x22')][_0x9233('0x23')]};});_0x54a697=qs['getOptions'](_0x5ee2a1,_0x53ad7b);var _0x1f4a5f={'where':_0x54a697['where']};return db[_0x9233('0x24')]['count'](_0x1f4a5f)['then'](function(_0x3a86e2){_0xb8ddac[_0x9233('0x11')]=_0x3a86e2;_0x54a697[_0x9233('0x25')]=qs[_0x9233('0x25')](_0x53ad7b[_0x9233('0x26')]);return db['ChatQueue']['findAll'](_0x54a697);})[_0x9233('0x16')](function(_0x13fdaf){_0xb8ddac[_0x9233('0x27')]=_0x13fdaf;return _0xb8ddac;})[_0x9233('0x16')](respondWithFilteredResult(_0x56fd8b,_0x54a697))[_0x9233('0x28')](handleError(_0x56fd8b,null));};exports[_0x9233('0x29')]=function(_0x32bc8b,_0x4c6dca){var _0x352c98={'raw':!![],'where':{'id':_0x32bc8b[_0x9233('0x2a')]['id']}},_0x452674={};_0x452674[_0x9233('0x2b')]=_['keys'](db[_0x9233('0x24')]['rawAttributes']);_0x452674[_0x9233('0x26')]=_[_0x9233('0x2c')](_0x32bc8b[_0x9233('0x26')]);_0x452674[_0x9233('0x2d')]=_[_0x9233('0x2e')](_0x452674['model'],_0x452674[_0x9233('0x26')]);_0x352c98['attributes']=_['intersection'](_0x452674[_0x9233('0x2b')],qs['fields'](_0x32bc8b[_0x9233('0x26')][_0x9233('0x2f')]));_0x352c98['attributes']=_0x352c98[_0x9233('0x30')][_0x9233('0x31')]?_0x352c98[_0x9233('0x30')]:_0x452674[_0x9233('0x2b')];if(_0x32bc8b[_0x9233('0x26')]['includeAll']){_0x352c98[_0x9233('0x25')]=[{'all':!![]}];}_0x352c98=_[_0x9233('0x32')]({},_0x352c98,_0x32bc8b['options']);return db[_0x9233('0x24')]['find'](_0x352c98)[_0x9233('0x16')](handleEntityNotFound(_0x4c6dca,null))[_0x9233('0x16')](respondWithResult(_0x4c6dca,null))[_0x9233('0x28')](handleError(_0x4c6dca,null));};exports[_0x9233('0x33')]=function(_0x405c44,_0x5337e0){return db[_0x9233('0x24')][_0x9233('0x33')](_0x405c44[_0x9233('0x34')],{})[_0x9233('0x16')](function(_0x99139e){var _0x356b19=_0x405c44[_0x9233('0x35')][_0x9233('0x17')]({'plain':!![]});if(!_0x356b19)throw new Error(_0x9233('0x36'));if(_0x356b19[_0x9233('0x37')]===_0x9233('0x35')){var _0x5648ae=_0x99139e['get']({'plain':!![]});var _0x431e05=_0x9233('0x18');return db[_0x9233('0x38')][_0x9233('0x39')]({'where':{'name':_0x431e05,'userProfileId':_0x356b19[_0x9233('0x3a')]},'raw':!![]})[_0x9233('0x16')](function(_0x5b5d56){if(_0x5b5d56&&_0x5b5d56[_0x9233('0x3b')]===0x0){return db[_0x9233('0x19')]['create']({'name':_0x5648ae[_0x9233('0x1d')],'resourceId':_0x5648ae['id'],'type':_0x5b5d56[_0x9233('0x1d')],'sectionId':_0x5b5d56['id']},{})[_0x9233('0x16')](function(){return _0x99139e;});}else{return _0x99139e;}})[_0x9233('0x28')](function(_0x59db25){logger[_0x9233('0x1b')](_0x9233('0x3c'),_0x59db25);throw _0x59db25;});}return _0x99139e;})['then'](respondWithResult(_0x5337e0,0xc9))[_0x9233('0x28')](handleError(_0x5337e0,null));};exports[_0x9233('0x3d')]=function(_0x1a6dea,_0x552fee){if(_0x1a6dea[_0x9233('0x34')]['id']){delete _0x1a6dea[_0x9233('0x34')]['id'];}return db['ChatQueue'][_0x9233('0x39')]({'where':{'id':_0x1a6dea[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x552fee,null))[_0x9233('0x16')](saveUpdates(_0x1a6dea[_0x9233('0x34')],null))[_0x9233('0x16')](respondWithResult(_0x552fee,null))[_0x9233('0x28')](handleError(_0x552fee,null));};exports['destroy']=function(_0x5ba9cb,_0x10614c){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x5ba9cb[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x10614c,null))[_0x9233('0x16')](removeEntity(_0x10614c,null))[_0x9233('0x28')](handleError(_0x10614c,null));};exports[_0x9233('0x3e')]=function(_0x5df49c,_0x50e158){return db['ChatQueue'][_0x9233('0x3e')]()[_0x9233('0x16')](respondWithResult(_0x50e158,null))['catch'](handleError(_0x50e158,null));};exports[_0x9233('0x3f')]=function(_0x4946be,_0x20a727){var _0x2fcba2={'raw':!![],'where':{}},_0x111a8d={},_0x245dba;return db[_0x9233('0x24')][_0x9233('0x40')]({'where':{'id':_0x4946be[_0x9233('0x2a')]['id']}})['then'](handleEntityNotFound(_0x20a727,null))[_0x9233('0x16')](function(_0x594b0d){if(_0x594b0d){_0x245dba=_0x594b0d['get']({'plain':!![]});_0x111a8d['model']=_[_0x9233('0x2c')](db[_0x9233('0x41')][_0x9233('0x20')]);_0x111a8d['query']=_['keys'](_0x4946be[_0x9233('0x26')]);_0x111a8d['filters']=_[_0x9233('0x2e')](_0x111a8d[_0x9233('0x2b')],_0x111a8d['query']);_0x2fcba2[_0x9233('0x30')]=_['intersection'](_0x111a8d['model'],qs[_0x9233('0x2f')](_0x4946be[_0x9233('0x26')][_0x9233('0x2f')]));_0x2fcba2[_0x9233('0x30')]=_0x2fcba2[_0x9233('0x30')]['length']?_0x2fcba2[_0x9233('0x30')]:_0x111a8d[_0x9233('0x2b')];if(!_0x4946be[_0x9233('0x26')]['hasOwnProperty'](_0x9233('0x42'))){_0x2fcba2[_0x9233('0x12')]=qs[_0x9233('0x12')](_0x4946be['query']['limit']);_0x2fcba2['offset']=qs['offset'](_0x4946be[_0x9233('0x26')][_0x9233('0xf')]);}_0x2fcba2[_0x9233('0x43')]=qs[_0x9233('0x44')](_0x4946be['query'][_0x9233('0x44')]);_0x2fcba2[_0x9233('0x45')]=qs[_0x9233('0x2d')](_[_0x9233('0x46')](_0x4946be[_0x9233('0x26')],_0x111a8d[_0x9233('0x2d')]));_0x2fcba2[_0x9233('0x45')][_0x9233('0x47')]=_0x594b0d['id'];if(_0x4946be[_0x9233('0x26')]['filter']){_0x2fcba2[_0x9233('0x45')]=_[_0x9233('0x32')](_0x2fcba2['where'],{'$or':_[_0x9233('0x48')](_0x2fcba2[_0x9233('0x30')],function(_0x47ca09){var _0x1b3564={};_0x1b3564[_0x47ca09]={'$like':'%'+_0x4946be[_0x9233('0x26')][_0x9233('0x49')]+'%'};return _0x1b3564;})});}_0x2fcba2=_[_0x9233('0x32')]({},_0x2fcba2,_0x4946be[_0x9233('0x4a')]);return db[_0x9233('0x41')][_0x9233('0x4b')](_0x2fcba2);}})[_0x9233('0x16')](function(_0xf6d35){if(_0xf6d35){return db['User']['findAndCountAll']({'where':{'id':_[_0x9233('0x48')](_0xf6d35,'UserId'),'role':_0x9233('0x4c')},'attributes':['id',_0x9233('0x1d'),_0x9233('0x4d'),_0x9233('0x4e'),_0x9233('0x4f')]});}})['then'](function(_0x2914dd){if(_0x2914dd){return{'count':_0x2914dd[_0x9233('0x11')],'rows':_[_0x9233('0x48')](_0x2914dd[_0x9233('0x27')],function(_0x503653){return{'membername':_0x503653[_0x9233('0x1d')],'UserId':_0x503653['id'],'queue_name':_0x245dba[_0x9233('0x1d')],'ChatQueueId':_0x245dba['id'],'interface':util[_0x9233('0x50')](_0x9233('0x51'),_0x9233('0x52'),_0x503653[_0x9233('0x1d')]),'penalty':0x0,'paused':_0x503653[_0x9233('0x4d')],'createdAt':_0x503653[_0x9233('0x4f')],'updatedAt':_0x503653[_0x9233('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9233('0x16')](respondWithFilteredResult(_0x20a727,_0x2fcba2))[_0x9233('0x28')](handleError(_0x20a727,null));};exports[_0x9233('0x53')]=function(_0x194264,_0x1f401d){var _0x5a30c5={};var _0x86bf89={};var _0x264077;var _0x3d9098;return db[_0x9233('0x24')][_0x9233('0x40')]({'where':{'id':_0x194264[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x1f401d,null))[_0x9233('0x16')](function(_0x425c9f){if(_0x425c9f){_0x264077=_0x425c9f;_0x86bf89[_0x9233('0x2b')]=_[_0x9233('0x2c')](db[_0x9233('0x54')][_0x9233('0x20')]);_0x86bf89['query']=_[_0x9233('0x2c')](_0x194264['query']);_0x86bf89['filters']=_[_0x9233('0x2e')](_0x86bf89[_0x9233('0x2b')],_0x86bf89['query']);_0x5a30c5['attributes']=_[_0x9233('0x2e')](_0x86bf89[_0x9233('0x2b')],qs[_0x9233('0x2f')](_0x194264[_0x9233('0x26')][_0x9233('0x2f')]));_0x5a30c5[_0x9233('0x30')]=_0x5a30c5[_0x9233('0x30')][_0x9233('0x31')]?_0x5a30c5[_0x9233('0x30')]:_0x86bf89[_0x9233('0x2b')];_0x5a30c5[_0x9233('0x43')]=qs[_0x9233('0x44')](_0x194264[_0x9233('0x26')][_0x9233('0x44')]);_0x5a30c5[_0x9233('0x45')]=qs['filters'](_[_0x9233('0x46')](_0x194264['query'],_0x86bf89[_0x9233('0x2d')]));if(_0x194264[_0x9233('0x26')][_0x9233('0x49')]){_0x5a30c5[_0x9233('0x45')]=_[_0x9233('0x32')](_0x5a30c5[_0x9233('0x45')],{'$or':_[_0x9233('0x48')](_0x5a30c5[_0x9233('0x30')],function(_0x2b1cf5){var _0x201e33={};_0x201e33[_0x2b1cf5]={'$like':'%'+_0x194264[_0x9233('0x26')]['filter']+'%'};return _0x201e33;})});}_0x5a30c5=_[_0x9233('0x32')]({},_0x5a30c5,_0x194264[_0x9233('0x4a')]);return _0x264077[_0x9233('0x53')](_0x5a30c5);}})['then'](function(_0x2acad0){if(_0x2acad0){_0x3d9098=_0x2acad0[_0x9233('0x31')];if(!_0x194264[_0x9233('0x26')][_0x9233('0x55')](_0x9233('0x42'))){_0x5a30c5[_0x9233('0x12')]=qs[_0x9233('0x12')](_0x194264[_0x9233('0x26')][_0x9233('0x12')]);_0x5a30c5[_0x9233('0xf')]=qs['offset'](_0x194264[_0x9233('0x26')][_0x9233('0xf')]);}return _0x264077['getTeams'](_0x5a30c5);}})[_0x9233('0x16')](function(_0x446e92){if(_0x446e92){return _0x446e92?{'count':_0x3d9098,'rows':_0x446e92}:null;}})[_0x9233('0x16')](respondWithResult(_0x1f401d,null))['catch'](handleError(_0x1f401d,null));};exports[_0x9233('0x56')]=function(_0x4558e3,_0x241705){var _0x2dcdb2=_0x4558e3[_0x9233('0x34')]['ids'];return db[_0x9233('0x54')][_0x9233('0x4b')]({'where':{'id':_0x2dcdb2},'attributes':['id'],'include':[{'model':db[_0x9233('0x57')],'as':'Agents','attributes':['id',_0x9233('0x1d'),'online','voicePause',_0x9233('0x58')],'raw':!![]}]})['then'](function(_0x2af982){if(_0x2af982){var _0x4ea715=_[_0x9233('0x59')](_0x2af982,function(_0x24b8f7){var _0x32a639=_0x24b8f7[_0x9233('0x17')]({'plain':!![]});return _0x32a639['Agents'];});return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x4558e3['params']['id']}})['then'](function(_0x2d2028){return db[_0x9233('0x5a')][_0x9233('0x5b')](function(_0x14faf6){return _0x2d2028[_0x9233('0x56')](_0x2dcdb2,{'transaction':_0x14faf6})[_0x9233('0x16')](function(){return BPromise[_0x9233('0x5c')](_0x4ea715,function(_0x1c8f80){return db[_0x9233('0x41')][_0x9233('0x5d')]({'where':{'UserId':_0x1c8f80['id'],'ChatQueueId':_0x4558e3['params']['id']},'transaction':_0x14faf6});});})['then'](function(){_0x4ea715[_0x9233('0x5e')](function(_0x5be4a4){socket['emit'](_0x9233('0x5f'),{'UserId':_0x5be4a4['id'],'ChatQueueId':_0x2d2028['id']});});});});});}})['then'](respondWithStatusCode(_0x241705,null))[_0x9233('0x28')](handleError(_0x241705,null));};exports['removeTeams']=function(_0x4467b2,_0x2f8b82){return db[_0x9233('0x54')][_0x9233('0x4b')]({'where':{'id':_0x4467b2['query'][_0x9233('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9233('0x61'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f8b82,null))[_0x9233('0x16')](function(_0x3d2243){var _0x678e2f=_[_0x9233('0x48')](_0x3d2243,'id');var _0x2c10b9=[];var _0x32564f=[];var _0x1f777a=squel[_0x9233('0x62')]();_0x1f777a[_0x9233('0x63')](_0x9233('0x64'))[_0x9233('0x65')](_0x9233('0x66'),'tq')[_0x9233('0x67')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9233('0x45')](_0x9233('0x68'),_0x4467b2['params']['id']);for(var _0x15d1ac=0x0;_0x15d1ac<_0x3d2243['length'];_0x15d1ac+=0x1){let _0x359843=_0x3d2243[_0x15d1ac];for(var _0x4b1d7d=0x0;_0x4b1d7d<_0x359843[_0x9233('0x61')]['length'];_0x4b1d7d+=0x1){let _0x28bc94=_0x359843[_0x9233('0x61')][_0x4b1d7d];var _0x383096=_0x1f777a[_0x9233('0x69')]();_0x383096['where'](_0x9233('0x6a'),_0x28bc94['id']);_0x32564f['push'](db[_0x9233('0x5a')][_0x9233('0x26')](_0x383096[_0x9233('0x6b')](),{'type':db['sequelize'][_0x9233('0x6c')]['SELECT']})[_0x9233('0x16')](function(_0x3151d4){if(_0x3151d4[_0x9233('0x31')]===0x1){return _0x28bc94['id'];}else{var _0x489dad=_[_0x9233('0x6d')](_[_0x9233('0x48')](_0x3151d4,_0x9233('0x6e')),function(_0x5e04be){return _['includes'](_0x678e2f,_0x5e04be);});if(_0x489dad){return _0x28bc94['id'];}}}));}}return BPromise['all'](_0x32564f)[_0x9233('0x16')](function(_0x3107a1){_0x2c10b9=_(_0x2c10b9)[_0x9233('0x6f')](_0x3107a1)[_0x9233('0x70')]()['value']();return db['ChatQueue'][_0x9233('0x39')]({'where':{'id':_0x4467b2[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](function(_0xb0a3ea){return db['sequelize'][_0x9233('0x5b')](function(_0x289434){return _0xb0a3ea[_0x9233('0x71')](_0x4467b2[_0x9233('0x26')]['ids'],{'transaction':_0x289434})['then'](function(){if(!_[_0x9233('0x72')](_0x2c10b9)){return _0xb0a3ea[_0x9233('0x73')](_0x2c10b9,{'transaction':_0x289434});}})[_0x9233('0x16')](function(){_0x2c10b9[_0x9233('0x5e')](function(_0x6f254a){socket[_0x9233('0x74')](_0x9233('0x75'),{'UserId':_0x6f254a,'ChatQueueId':_0xb0a3ea['id']});});});});});});})[_0x9233('0x16')](respondWithStatusCode(_0x2f8b82,null))[_0x9233('0x28')](handleError(_0x2f8b82,null));};exports['addAgents']=function(_0x249a44,_0x232855){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x249a44[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x232855,null))[_0x9233('0x16')](function(_0x4c0230){if(_0x4c0230){return _0x4c0230[_0x9233('0x76')](_0x249a44[_0x9233('0x34')]['ids'],_['omit'](_0x249a44[_0x9233('0x34')],['ids','id'])||{})[_0x9233('0x77')](function(_0x28409e){for(var _0x5f3a33=0x0;_0x5f3a33<_0x249a44['body'][_0x9233('0x60')][_0x9233('0x31')];_0x5f3a33+=0x1){socket[_0x9233('0x74')](_0x9233('0x5f'),{'UserId':Number(_0x249a44[_0x9233('0x34')][_0x9233('0x60')][_0x5f3a33]),'ChatQueueId':Number(_0x249a44[_0x9233('0x2a')]['id'])});}return _0x28409e;});}})['then'](respondWithResult(_0x232855,null))[_0x9233('0x28')](handleError(_0x232855,null));};exports['removeAgents']=function(_0x471cc9,_0x522bf1){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x471cc9[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x522bf1,null))['then'](function(_0x21bbdf){if(_0x21bbdf){return _0x21bbdf[_0x9233('0x73')](_0x471cc9[_0x9233('0x26')]['ids'])['then'](function(){if(_[_0x9233('0x78')](_0x471cc9[_0x9233('0x26')][_0x9233('0x60')])){for(var _0x3a5c18=0x0;_0x3a5c18<_0x471cc9[_0x9233('0x26')]['ids'][_0x9233('0x31')];_0x3a5c18+=0x1){socket[_0x9233('0x74')](_0x9233('0x75'),{'UserId':Number(_0x471cc9[_0x9233('0x26')]['ids'][_0x3a5c18]),'ChatQueueId':Number(_0x471cc9[_0x9233('0x2a')]['id'])});}}else{socket['emit'](_0x9233('0x75'),{'UserId':Number(_0x471cc9[_0x9233('0x26')][_0x9233('0x60')]),'ChatQueueId':Number(_0x471cc9['params']['id'])});}});}})[_0x9233('0x16')](respondWithStatusCode(_0x522bf1,null))[_0x9233('0x28')](handleError(_0x522bf1,null));};exports[_0x9233('0x79')]=function(_0xd34a22,_0x48b4cd){var _0x44040b={};var _0x6dbf7a={};var _0x535506;var _0x16e97e;return db[_0x9233('0x24')]['findOne']({'where':{'id':_0xd34a22[_0x9233('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48b4cd,null))[_0x9233('0x16')](function(_0x1ec6d6){if(_0x1ec6d6){_0x535506=_0x1ec6d6;_0x6dbf7a[_0x9233('0x2b')]=_['keys'](db[_0x9233('0x57')][_0x9233('0x20')]);_0x6dbf7a[_0x9233('0x26')]=_[_0x9233('0x2c')](_0xd34a22[_0x9233('0x26')]);_0x6dbf7a[_0x9233('0x2d')]=_[_0x9233('0x2e')](_0x6dbf7a[_0x9233('0x2b')],_0x6dbf7a[_0x9233('0x26')]);_0x44040b['attributes']=_[_0x9233('0x2e')](_0x6dbf7a[_0x9233('0x2b')],qs[_0x9233('0x2f')](_0xd34a22['query']['fields']));_0x44040b[_0x9233('0x30')]=_0x44040b[_0x9233('0x30')][_0x9233('0x31')]?_0x44040b[_0x9233('0x30')]:_0x6dbf7a[_0x9233('0x2b')];_0x44040b[_0x9233('0x43')]=qs[_0x9233('0x44')](_0xd34a22[_0x9233('0x26')]['sort']);_0x44040b[_0x9233('0x45')]=qs[_0x9233('0x2d')](_['pick'](_0xd34a22['query'],_0x6dbf7a[_0x9233('0x2d')]));if(_0xd34a22[_0x9233('0x26')][_0x9233('0x49')]){_0x44040b[_0x9233('0x45')]=_[_0x9233('0x32')](_0x44040b[_0x9233('0x45')],{'$or':_['map'](_0x44040b[_0x9233('0x30')],function(_0x2973a3){var _0x592a07={};_0x592a07[_0x2973a3]={'$like':'%'+_0xd34a22[_0x9233('0x26')][_0x9233('0x49')]+'%'};return _0x592a07;})});}_0x44040b=_[_0x9233('0x32')]({},_0x44040b,_0xd34a22[_0x9233('0x4a')]);return _0x535506[_0x9233('0x79')](_0x44040b);}})[_0x9233('0x16')](function(_0x57c43d){if(_0x57c43d){_0x16e97e=_0x57c43d[_0x9233('0x31')];if(!_0xd34a22['query']['hasOwnProperty'](_0x9233('0x42'))){_0x44040b[_0x9233('0x12')]=qs['limit'](_0xd34a22[_0x9233('0x26')]['limit']);_0x44040b[_0x9233('0xf')]=qs[_0x9233('0xf')](_0xd34a22[_0x9233('0x26')]['offset']);}return _0x535506[_0x9233('0x79')](_0x44040b);}})[_0x9233('0x16')](function(_0x41698b){if(_0x41698b){return _0x41698b?{'count':_0x16e97e,'rows':_0x41698b}:null;}})['then'](respondWithResult(_0x48b4cd,null))[_0x9233('0x28')](handleError(_0x48b4cd,null));}; \ No newline at end of file +var _0x88bb=['from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','then','ChatQueues','UserProfileResource','destroy','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','getOptions','where','include','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','sort','ChatQueueId','filter','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','order','pick','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select'];(function(_0x29e32c,_0x68fe8e){var _0x2ce2ae=function(_0x4e9190){while(--_0x4e9190){_0x29e32c['push'](_0x29e32c['shift']());}};_0x2ce2ae(++_0x68fe8e);}(_0x88bb,0x109));var _0xb88b=function(_0x55ec85,_0x3cc9ed){_0x55ec85=_0x55ec85-0x0;var _0xdf9b38=_0x88bb[_0x55ec85];return _0xdf9b38;};'use strict';var BPromise=require('bluebird');var util=require(_0xb88b('0x0'));var _=require('lodash');var squel=require(_0xb88b('0x1'));var Redis=require('ioredis');var qs=require(_0xb88b('0x2'));var logger=require(_0xb88b('0x3'))(_0xb88b('0x4'));var config=require(_0xb88b('0x5'));var db=require(_0xb88b('0x6'))['db'];config[_0xb88b('0x7')]=_[_0xb88b('0x8')](config['redis'],{'host':_0xb88b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x482bb9,_0x22eb73){_0x22eb73=_0x22eb73||0xcc;return function(_0x1cf797){if(_0x1cf797){return _0x482bb9[_0xb88b('0xa')](_0x22eb73);}return _0x482bb9['status'](_0x22eb73)[_0xb88b('0xb')]();};}function respondWithResult(_0x298f3a,_0x2b4aa4){_0x2b4aa4=_0x2b4aa4||0xc8;return function(_0x3cc95b){if(_0x3cc95b){return _0x298f3a[_0xb88b('0xc')](_0x2b4aa4)[_0xb88b('0xd')](_0x3cc95b);}};}function respondWithFilteredResult(_0x57fb79,_0x4182aa){return function(_0x369a02){if(_0x369a02){var _0x1ea354=typeof _0x4182aa['offset']===_0xb88b('0xe')&&typeof _0x4182aa[_0xb88b('0xf')]===_0xb88b('0xe');var _0x158f85=_0x369a02[_0xb88b('0x10')];var _0x5dfa9e=_0x1ea354?0x0:_0x4182aa[_0xb88b('0x11')];var _0x4a0126=_0x1ea354?_0x369a02['count']:_0x4182aa[_0xb88b('0x11')]+_0x4182aa[_0xb88b('0xf')];var _0x4ff402;if(_0x4a0126>=_0x158f85){_0x4a0126=_0x158f85;_0x4ff402=0xc8;}else{_0x4ff402=0xce;}_0x57fb79[_0xb88b('0xc')](_0x4ff402);return _0x57fb79[_0xb88b('0x12')](_0xb88b('0x13'),_0x5dfa9e+'-'+_0x4a0126+'/'+_0x158f85)[_0xb88b('0xd')](_0x369a02);}return null;};}function saveUpdates(_0x37e8b7){return function(_0x316a7a){if(_0x316a7a){return _0x316a7a['update'](_0x37e8b7)[_0xb88b('0x14')](function(_0x32baa2){return _0x32baa2;});}return null;};}function removeEntity(_0xe214d2){return function(_0xb45be0){if(_0xb45be0){return _0xb45be0['destroy']()['then'](function(){var _0x8eb8e1=_0xb45be0['get']({'plain':!![]});var _0x3cfac1=_0xb88b('0x15');return db[_0xb88b('0x16')][_0xb88b('0x17')]({'where':{'type':_0x3cfac1,'resourceId':_0x8eb8e1['id']}})[_0xb88b('0x14')](function(){return _0xb45be0;});})[_0xb88b('0x14')](function(){_0xe214d2[_0xb88b('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea3a9){return function(_0xdf5afb){if(!_0xdf5afb){_0x3ea3a9[_0xb88b('0xa')](0x194);}return _0xdf5afb;};}function handleError(_0x2b6a84,_0x47b28b){_0x47b28b=_0x47b28b||0x1f4;return function(_0x59f77d){logger[_0xb88b('0x18')](_0x59f77d[_0xb88b('0x19')]);if(_0x59f77d['name']){delete _0x59f77d[_0xb88b('0x1a')];}_0x2b6a84[_0xb88b('0xc')](_0x47b28b)[_0xb88b('0x1b')](_0x59f77d);};}exports['index']=function(_0xbd503b,_0x2f9b8d){var _0x182450={};var _0x523252={'count':0x0,'rows':[]};var _0x16aff4=_[_0xb88b('0x1c')](db[_0xb88b('0x1d')][_0xb88b('0x1e')],function(_0x2e06f1){return{'name':_0x2e06f1[_0xb88b('0x1f')],'type':_0x2e06f1[_0xb88b('0x20')]['key']};});_0x182450=qs[_0xb88b('0x21')](_0x16aff4,_0xbd503b);var _0x2ffcd5={'where':_0x182450[_0xb88b('0x22')]};return db[_0xb88b('0x1d')][_0xb88b('0x10')](_0x2ffcd5)[_0xb88b('0x14')](function(_0x14f603){_0x523252[_0xb88b('0x10')]=_0x14f603;_0x182450[_0xb88b('0x23')]=qs['include'](_0xbd503b[_0xb88b('0x24')]);return db['ChatQueue']['findAll'](_0x182450);})[_0xb88b('0x14')](function(_0x505a12){_0x523252['rows']=_0x505a12;return _0x523252;})['then'](respondWithFilteredResult(_0x2f9b8d,_0x182450))[_0xb88b('0x25')](handleError(_0x2f9b8d,null));};exports['show']=function(_0x44e08d,_0x5e6141){var _0x27eb12={'raw':!![],'where':{'id':_0x44e08d[_0xb88b('0x26')]['id']}},_0x2fb1d5={};_0x2fb1d5[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x1d')]['rawAttributes']);_0x2fb1d5['query']=_[_0xb88b('0x28')](_0x44e08d['query']);_0x2fb1d5[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x2fb1d5[_0xb88b('0x27')],_0x2fb1d5[_0xb88b('0x24')]);_0x27eb12[_0xb88b('0x2b')]=_['intersection'](_0x2fb1d5[_0xb88b('0x27')],qs[_0xb88b('0x2c')](_0x44e08d[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x27eb12[_0xb88b('0x2b')]=_0x27eb12[_0xb88b('0x2b')][_0xb88b('0x2d')]?_0x27eb12[_0xb88b('0x2b')]:_0x2fb1d5[_0xb88b('0x27')];if(_0x44e08d[_0xb88b('0x24')][_0xb88b('0x2e')]){_0x27eb12[_0xb88b('0x23')]=[{'all':!![]}];}_0x27eb12=_[_0xb88b('0x2f')]({},_0x27eb12,_0x44e08d[_0xb88b('0x30')]);return db[_0xb88b('0x1d')]['find'](_0x27eb12)[_0xb88b('0x14')](handleEntityNotFound(_0x5e6141,null))[_0xb88b('0x14')](respondWithResult(_0x5e6141,null))[_0xb88b('0x25')](handleError(_0x5e6141,null));};exports[_0xb88b('0x31')]=function(_0x20df2a,_0x56d8a9){return db[_0xb88b('0x1d')]['create'](_0x20df2a[_0xb88b('0x32')],{})[_0xb88b('0x14')](function(_0x21c726){var _0x237163=_0x20df2a['user'][_0xb88b('0x33')]({'plain':!![]});if(!_0x237163)throw new Error(_0xb88b('0x34'));if(_0x237163[_0xb88b('0x35')]===_0xb88b('0x36')){var _0x4078ed=_0x21c726[_0xb88b('0x33')]({'plain':!![]});var _0x2833a=_0xb88b('0x15');return db[_0xb88b('0x37')][_0xb88b('0x38')]({'where':{'name':_0x2833a,'userProfileId':_0x237163[_0xb88b('0x39')]},'raw':!![]})[_0xb88b('0x14')](function(_0x502f63){if(_0x502f63&&_0x502f63[_0xb88b('0x3a')]===0x0){return db[_0xb88b('0x16')][_0xb88b('0x31')]({'name':_0x4078ed['name'],'resourceId':_0x4078ed['id'],'type':_0x502f63[_0xb88b('0x1a')],'sectionId':_0x502f63['id']},{})[_0xb88b('0x14')](function(){return _0x21c726;});}else{return _0x21c726;}})['catch'](function(_0x55b1ec){logger[_0xb88b('0x18')](_0xb88b('0x3b'),_0x55b1ec);throw _0x55b1ec;});}return _0x21c726;})['then'](respondWithResult(_0x56d8a9,0xc9))['catch'](handleError(_0x56d8a9,null));};exports[_0xb88b('0x3c')]=function(_0x24bed2,_0x4ce61a){if(_0x24bed2['body']['id']){delete _0x24bed2['body']['id'];}return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x24bed2[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x4ce61a,null))['then'](saveUpdates(_0x24bed2[_0xb88b('0x32')],null))[_0xb88b('0x14')](respondWithResult(_0x4ce61a,null))[_0xb88b('0x25')](handleError(_0x4ce61a,null));};exports[_0xb88b('0x17')]=function(_0x39fbda,_0x3720cf){return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x39fbda[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x3720cf,null))[_0xb88b('0x14')](removeEntity(_0x3720cf,null))[_0xb88b('0x25')](handleError(_0x3720cf,null));};exports['describe']=function(_0x30ba0f,_0x35a44d){return db[_0xb88b('0x1d')][_0xb88b('0x3d')]()[_0xb88b('0x14')](respondWithResult(_0x35a44d,null))[_0xb88b('0x25')](handleError(_0x35a44d,null));};exports[_0xb88b('0x3e')]=function(_0x4b693a,_0x28a7ef){var _0x2e520b={'raw':!![],'where':{}},_0x185c30={},_0x58caaa;return db[_0xb88b('0x1d')][_0xb88b('0x3f')]({'where':{'id':_0x4b693a['params']['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x28a7ef,null))[_0xb88b('0x14')](function(_0x56651d){if(_0x56651d){_0x58caaa=_0x56651d[_0xb88b('0x33')]({'plain':!![]});_0x185c30[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x40')][_0xb88b('0x1e')]);_0x185c30['query']=_['keys'](_0x4b693a[_0xb88b('0x24')]);_0x185c30['filters']=_[_0xb88b('0x2a')](_0x185c30[_0xb88b('0x27')],_0x185c30[_0xb88b('0x24')]);_0x2e520b[_0xb88b('0x2b')]=_['intersection'](_0x185c30['model'],qs[_0xb88b('0x2c')](_0x4b693a[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x2e520b['attributes']=_0x2e520b['attributes']['length']?_0x2e520b[_0xb88b('0x2b')]:_0x185c30[_0xb88b('0x27')];if(!_0x4b693a[_0xb88b('0x24')][_0xb88b('0x41')](_0xb88b('0x42'))){_0x2e520b['limit']=qs[_0xb88b('0xf')](_0x4b693a['query'][_0xb88b('0xf')]);_0x2e520b['offset']=qs[_0xb88b('0x11')](_0x4b693a['query']['offset']);}_0x2e520b['order']=qs[_0xb88b('0x43')](_0x4b693a['query'][_0xb88b('0x43')]);_0x2e520b[_0xb88b('0x22')]=qs[_0xb88b('0x29')](_['pick'](_0x4b693a[_0xb88b('0x24')],_0x185c30['filters']));_0x2e520b[_0xb88b('0x22')][_0xb88b('0x44')]=_0x56651d['id'];if(_0x4b693a[_0xb88b('0x24')][_0xb88b('0x45')]){_0x2e520b['where']=_['merge'](_0x2e520b[_0xb88b('0x22')],{'$or':_['map'](_0x2e520b[_0xb88b('0x2b')],function(_0x5e76ce){var _0x3c5efa={};_0x3c5efa[_0x5e76ce]={'$like':'%'+_0x4b693a[_0xb88b('0x24')][_0xb88b('0x45')]+'%'};return _0x3c5efa;})});}_0x2e520b=_['merge']({},_0x2e520b,_0x4b693a[_0xb88b('0x30')]);return db[_0xb88b('0x40')][_0xb88b('0x46')](_0x2e520b);}})[_0xb88b('0x14')](function(_0x452b6b){if(_0x452b6b){return db[_0xb88b('0x47')]['findAndCountAll']({'where':{'id':_[_0xb88b('0x1c')](_0x452b6b,_0xb88b('0x48')),'role':_0xb88b('0x49')},'attributes':['id','name',_0xb88b('0x4a'),_0xb88b('0x4b'),_0xb88b('0x4c')]});}})['then'](function(_0x381ec9){if(_0x381ec9){return{'count':_0x381ec9[_0xb88b('0x10')],'rows':_[_0xb88b('0x1c')](_0x381ec9[_0xb88b('0x4d')],function(_0x4c4401){return{'membername':_0x4c4401[_0xb88b('0x1a')],'UserId':_0x4c4401['id'],'queue_name':_0x58caaa[_0xb88b('0x1a')],'ChatQueueId':_0x58caaa['id'],'interface':util[_0xb88b('0x4e')]('%s/%s',_0xb88b('0x4f'),_0x4c4401[_0xb88b('0x1a')]),'penalty':0x0,'paused':_0x4c4401[_0xb88b('0x4a')],'createdAt':_0x4c4401['createdAt'],'updatedAt':_0x4c4401[_0xb88b('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb88b('0x14')](respondWithFilteredResult(_0x28a7ef,_0x2e520b))['catch'](handleError(_0x28a7ef,null));};exports[_0xb88b('0x50')]=function(_0x21e209,_0x17cea5){var _0x1a75f3={};var _0x11fc41={};var _0x2ec9f9;var _0x52ef4b;return db[_0xb88b('0x1d')]['findOne']({'where':{'id':_0x21e209[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x17cea5,null))[_0xb88b('0x14')](function(_0xa27099){if(_0xa27099){_0x2ec9f9=_0xa27099;_0x11fc41[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x51')]['rawAttributes']);_0x11fc41[_0xb88b('0x24')]=_[_0xb88b('0x28')](_0x21e209[_0xb88b('0x24')]);_0x11fc41[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x11fc41[_0xb88b('0x27')],_0x11fc41[_0xb88b('0x24')]);_0x1a75f3['attributes']=_[_0xb88b('0x2a')](_0x11fc41['model'],qs[_0xb88b('0x2c')](_0x21e209['query'][_0xb88b('0x2c')]));_0x1a75f3[_0xb88b('0x2b')]=_0x1a75f3[_0xb88b('0x2b')]['length']?_0x1a75f3[_0xb88b('0x2b')]:_0x11fc41[_0xb88b('0x27')];_0x1a75f3[_0xb88b('0x52')]=qs[_0xb88b('0x43')](_0x21e209[_0xb88b('0x24')][_0xb88b('0x43')]);_0x1a75f3[_0xb88b('0x22')]=qs['filters'](_[_0xb88b('0x53')](_0x21e209[_0xb88b('0x24')],_0x11fc41[_0xb88b('0x29')]));if(_0x21e209['query']['filter']){_0x1a75f3[_0xb88b('0x22')]=_[_0xb88b('0x2f')](_0x1a75f3[_0xb88b('0x22')],{'$or':_[_0xb88b('0x1c')](_0x1a75f3[_0xb88b('0x2b')],function(_0x48f3ad){var _0x101798={};_0x101798[_0x48f3ad]={'$like':'%'+_0x21e209[_0xb88b('0x24')]['filter']+'%'};return _0x101798;})});}_0x1a75f3=_[_0xb88b('0x2f')]({},_0x1a75f3,_0x21e209[_0xb88b('0x30')]);return _0x2ec9f9[_0xb88b('0x50')](_0x1a75f3);}})[_0xb88b('0x14')](function(_0x7bff22){if(_0x7bff22){_0x52ef4b=_0x7bff22['length'];if(!_0x21e209['query'][_0xb88b('0x41')]('nolimit')){_0x1a75f3['limit']=qs[_0xb88b('0xf')](_0x21e209[_0xb88b('0x24')]['limit']);_0x1a75f3[_0xb88b('0x11')]=qs[_0xb88b('0x11')](_0x21e209[_0xb88b('0x24')][_0xb88b('0x11')]);}return _0x2ec9f9[_0xb88b('0x50')](_0x1a75f3);}})[_0xb88b('0x14')](function(_0x537ada){if(_0x537ada){return _0x537ada?{'count':_0x52ef4b,'rows':_0x537ada}:null;}})[_0xb88b('0x14')](respondWithResult(_0x17cea5,null))[_0xb88b('0x25')](handleError(_0x17cea5,null));};exports['addTeams']=function(_0x7dfbfe,_0x2b9e6b){var _0x1260c7=_0x7dfbfe[_0xb88b('0x32')][_0xb88b('0x54')];return db[_0xb88b('0x51')][_0xb88b('0x46')]({'where':{'id':_0x1260c7},'attributes':['id'],'include':[{'model':db[_0xb88b('0x47')],'as':_0xb88b('0x55'),'attributes':['id',_0xb88b('0x1a'),'online',_0xb88b('0x56'),_0xb88b('0x57')],'raw':!![]}]})[_0xb88b('0x14')](function(_0x373bb8){if(_0x373bb8){var _0x558e2d=_[_0xb88b('0x58')](_0x373bb8,function(_0xa04b2b){var _0x166cf5=_0xa04b2b[_0xb88b('0x33')]({'plain':!![]});return _0x166cf5[_0xb88b('0x55')];});return db[_0xb88b('0x1d')]['find']({'where':{'id':_0x7dfbfe[_0xb88b('0x26')]['id']}})['then'](function(_0x40899c){return db[_0xb88b('0x59')][_0xb88b('0x5a')](function(_0x2ba189){return _0x40899c[_0xb88b('0x5b')](_0x1260c7,{'transaction':_0x2ba189})[_0xb88b('0x14')](function(){return BPromise[_0xb88b('0x5c')](_0x558e2d,function(_0x20d826){return db[_0xb88b('0x40')][_0xb88b('0x5d')]({'where':{'UserId':_0x20d826['id'],'ChatQueueId':_0x7dfbfe[_0xb88b('0x26')]['id']},'transaction':_0x2ba189});});})[_0xb88b('0x14')](function(){_0x558e2d[_0xb88b('0x5e')](function(_0x10f3cc){socket[_0xb88b('0x5f')]('userChatQueue:save',{'UserId':_0x10f3cc['id'],'ChatQueueId':_0x40899c['id']});});});});});}})[_0xb88b('0x14')](respondWithStatusCode(_0x2b9e6b,null))[_0xb88b('0x25')](handleError(_0x2b9e6b,null));};exports[_0xb88b('0x60')]=function(_0x157d8c,_0x3751ce){return db['Team'][_0xb88b('0x46')]({'where':{'id':_0x157d8c[_0xb88b('0x24')][_0xb88b('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb88b('0x55'),'attributes':['id'],'raw':!![]}]})[_0xb88b('0x14')](handleEntityNotFound(_0x3751ce,null))[_0xb88b('0x14')](function(_0x1f75d9){var _0x12664a=_[_0xb88b('0x1c')](_0x1f75d9,'id');var _0x7c3782=[];var _0x5ec1db=[];var _0x1d4e51=squel[_0xb88b('0x61')]();_0x1d4e51['field']('tq.TeamId')[_0xb88b('0x62')]('team_has_chat_queues','tq')[_0xb88b('0x63')]('user_has_teams','ut',_0xb88b('0x64'))[_0xb88b('0x22')](_0xb88b('0x65'),_0x157d8c[_0xb88b('0x26')]['id']);for(var _0x5a8c9b=0x0;_0x5a8c9b<_0x1f75d9[_0xb88b('0x2d')];_0x5a8c9b+=0x1){let _0x54fab0=_0x1f75d9[_0x5a8c9b];for(var _0x90a1ab=0x0;_0x90a1ab<_0x54fab0[_0xb88b('0x55')]['length'];_0x90a1ab+=0x1){let _0x49d3a1=_0x54fab0['Agents'][_0x90a1ab];var _0x1a21fb=_0x1d4e51['clone']();_0x1a21fb['where'](_0xb88b('0x66'),_0x49d3a1['id']);_0x5ec1db[_0xb88b('0x67')](db['sequelize'][_0xb88b('0x24')](_0x1a21fb[_0xb88b('0x68')](),{'type':db[_0xb88b('0x59')][_0xb88b('0x69')]['SELECT']})['then'](function(_0x2d0046){if(_0x2d0046[_0xb88b('0x2d')]===0x1){return _0x49d3a1['id'];}else{var _0x557243=_[_0xb88b('0x6a')](_[_0xb88b('0x1c')](_0x2d0046,_0xb88b('0x6b')),function(_0x3f835a){return _[_0xb88b('0x6c')](_0x12664a,_0x3f835a);});if(_0x557243){return _0x49d3a1['id'];}}}));}}return BPromise[_0xb88b('0x6d')](_0x5ec1db)[_0xb88b('0x14')](function(_0x230745){_0x7c3782=_(_0x7c3782)[_0xb88b('0x6e')](_0x230745)['compact']()[_0xb88b('0x6f')]();return db[_0xb88b('0x1d')]['find']({'where':{'id':_0x157d8c[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](function(_0x4114eb){return db[_0xb88b('0x59')][_0xb88b('0x5a')](function(_0x2f8cc0){return _0x4114eb[_0xb88b('0x60')](_0x157d8c['query']['ids'],{'transaction':_0x2f8cc0})['then'](function(){if(!_[_0xb88b('0x70')](_0x7c3782)){return _0x4114eb[_0xb88b('0x71')](_0x7c3782,{'transaction':_0x2f8cc0});}})[_0xb88b('0x14')](function(){_0x7c3782[_0xb88b('0x5e')](function(_0x80b4b3){socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':_0x80b4b3,'ChatQueueId':_0x4114eb['id']});});});});});});})[_0xb88b('0x14')](respondWithStatusCode(_0x3751ce,null))[_0xb88b('0x25')](handleError(_0x3751ce,null));};exports[_0xb88b('0x73')]=function(_0x22f5a3,_0x2cc510){return db['ChatQueue'][_0xb88b('0x38')]({'where':{'id':_0x22f5a3[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x2cc510,null))[_0xb88b('0x14')](function(_0x46e798){if(_0x46e798){return _0x46e798['addAgents'](_0x22f5a3['body'][_0xb88b('0x54')],_[_0xb88b('0x74')](_0x22f5a3[_0xb88b('0x32')],['ids','id'])||{})[_0xb88b('0x75')](function(_0x2dd4d4){for(var _0x3b5bac=0x0;_0x3b5bac<_0x22f5a3['body'][_0xb88b('0x54')][_0xb88b('0x2d')];_0x3b5bac+=0x1){socket[_0xb88b('0x5f')](_0xb88b('0x76'),{'UserId':Number(_0x22f5a3['body'][_0xb88b('0x54')][_0x3b5bac]),'ChatQueueId':Number(_0x22f5a3[_0xb88b('0x26')]['id'])});}return _0x2dd4d4;});}})[_0xb88b('0x14')](respondWithResult(_0x2cc510,null))['catch'](handleError(_0x2cc510,null));};exports[_0xb88b('0x71')]=function(_0x1d183f,_0xecaadc){return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x1d183f[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0xecaadc,null))[_0xb88b('0x14')](function(_0x3b97dd){if(_0x3b97dd){return _0x3b97dd[_0xb88b('0x71')](_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')])['then'](function(){if(_[_0xb88b('0x77')](_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')])){for(var _0x3af9f3=0x0;_0x3af9f3<_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')][_0xb88b('0x2d')];_0x3af9f3+=0x1){socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':Number(_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')][_0x3af9f3]),'ChatQueueId':Number(_0x1d183f[_0xb88b('0x26')]['id'])});}}else{socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':Number(_0x1d183f['query'][_0xb88b('0x54')]),'ChatQueueId':Number(_0x1d183f[_0xb88b('0x26')]['id'])});}});}})['then'](respondWithStatusCode(_0xecaadc,null))[_0xb88b('0x25')](handleError(_0xecaadc,null));};exports[_0xb88b('0x78')]=function(_0x58ecf0,_0x31df5f){var _0x386003={};var _0x40746f={};var _0x1ebe94;var _0x348be1;return db[_0xb88b('0x1d')][_0xb88b('0x3f')]({'where':{'id':_0x58ecf0['params']['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x31df5f,null))['then'](function(_0xd9cd9a){if(_0xd9cd9a){_0x1ebe94=_0xd9cd9a;_0x40746f[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x47')]['rawAttributes']);_0x40746f[_0xb88b('0x24')]=_[_0xb88b('0x28')](_0x58ecf0[_0xb88b('0x24')]);_0x40746f[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x40746f[_0xb88b('0x27')],_0x40746f[_0xb88b('0x24')]);_0x386003[_0xb88b('0x2b')]=_[_0xb88b('0x2a')](_0x40746f['model'],qs['fields'](_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x386003[_0xb88b('0x2b')]=_0x386003['attributes']['length']?_0x386003[_0xb88b('0x2b')]:_0x40746f[_0xb88b('0x27')];_0x386003[_0xb88b('0x52')]=qs[_0xb88b('0x43')](_0x58ecf0[_0xb88b('0x24')]['sort']);_0x386003['where']=qs[_0xb88b('0x29')](_['pick'](_0x58ecf0[_0xb88b('0x24')],_0x40746f[_0xb88b('0x29')]));if(_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x45')]){_0x386003[_0xb88b('0x22')]=_[_0xb88b('0x2f')](_0x386003[_0xb88b('0x22')],{'$or':_[_0xb88b('0x1c')](_0x386003['attributes'],function(_0x4b1593){var _0x4f7255={};_0x4f7255[_0x4b1593]={'$like':'%'+_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x45')]+'%'};return _0x4f7255;})});}_0x386003=_[_0xb88b('0x2f')]({},_0x386003,_0x58ecf0[_0xb88b('0x30')]);return _0x1ebe94['getAgents'](_0x386003);}})[_0xb88b('0x14')](function(_0x131765){if(_0x131765){_0x348be1=_0x131765[_0xb88b('0x2d')];if(!_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x41')](_0xb88b('0x42'))){_0x386003['limit']=qs[_0xb88b('0xf')](_0x58ecf0[_0xb88b('0x24')]['limit']);_0x386003[_0xb88b('0x11')]=qs['offset'](_0x58ecf0['query']['offset']);}return _0x1ebe94[_0xb88b('0x78')](_0x386003);}})[_0xb88b('0x14')](function(_0x46fc49){if(_0x46fc49){return _0x46fc49?{'count':_0x348be1,'rows':_0x46fc49}:null;}})[_0xb88b('0x14')](respondWithResult(_0x31df5f,null))[_0xb88b('0x25')](handleError(_0x31df5f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c90edaf..f417cb2 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 _0xa3e6=['hook','exports','events','ChatQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3fc5e8,_0x5af2c0){var _0x280d80=function(_0x199afb){while(--_0x199afb){_0x3fc5e8['push'](_0x3fc5e8['shift']());}};_0x280d80(++_0x5af2c0);}(_0xa3e6,0x158));var _0x6a3e=function(_0xb881d2,_0x65f919){_0xb881d2=_0xb881d2-0x0;var _0x247b51=_0xa3e6[_0xb881d2];return _0x247b51;};'use strict';var EventEmitter=require(_0x6a3e('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x6a3e('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a3e('0x2'),'afterUpdate':_0x6a3e('0x3'),'afterDestroy':_0x6a3e('0x4')};function emitEvent(_0x5d8e3d){return function(_0x2190fc,_0x35a2b6,_0x3da56a){ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d+':'+_0x2190fc['id'],_0x2190fc);ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d,_0x2190fc);_0x3da56a(null);};}for(var e in events){if(events[_0x6a3e('0x6')](e)){var event=events[e];ChatQueue[_0x6a3e('0x7')](e,emitEvent(event));}}module[_0x6a3e('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe35f=['events','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x512d4f,_0xb1b718){var _0x2dc3a0=function(_0xc1b01b){while(--_0xc1b01b){_0x512d4f['push'](_0x512d4f['shift']());}};_0x2dc3a0(++_0xb1b718);}(_0xe35f,0x140));var _0xfe35=function(_0x15b3a0,_0x38bbf0){_0x15b3a0=_0x15b3a0-0x0;var _0x4cfc99=_0xe35f[_0x15b3a0];return _0x4cfc99;};'use strict';var EventEmitter=require(_0xfe35('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xfe35('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xfe35('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe35('0x3'),'afterDestroy':_0xfe35('0x4')};function emitEvent(_0x288435){return function(_0x52b875,_0x566e85,_0x2f6401){ChatQueueEvents[_0xfe35('0x5')](_0x288435+':'+_0x52b875['id'],_0x52b875);ChatQueueEvents[_0xfe35('0x5')](_0x288435,_0x52b875);_0x2f6401(null);};}for(var e in events){if(events[_0xfe35('0x6')](e)){var event=events[e];ChatQueue[_0xfe35('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7a1a208..6011096 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 _0x6ed5=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3333de,_0x323c42){var _0x20da72=function(_0x151536){while(--_0x151536){_0x3333de['push'](_0x3333de['shift']());}};_0x20da72(++_0x323c42);}(_0x6ed5,0xb6));var _0x56ed=function(_0x4561f1,_0x171083){_0x4561f1=_0x4561f1-0x0;var _0x1ddfb4=_0x6ed5[_0x4561f1];return _0x1ddfb4;};'use strict';var _=require(_0x56ed('0x0'));var util=require(_0x56ed('0x1'));var logger=require(_0x56ed('0x2'))(_0x56ed('0x3'));var moment=require(_0x56ed('0x4'));var BPromise=require(_0x56ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56ed('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x56ed('0x7')]=function(_0x442557,_0x2a763a){return _0x442557[_0x56ed('0x8')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x758f=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x758f,0x180));var _0xf758=function(_0x2f8000,_0x37c02b){_0x2f8000=_0x2f8000-0x0;var _0x25cfee=_0x758f[_0x2f8000];return _0x25cfee;};'use strict';var _=require(_0xf758('0x0'));var util=require(_0xf758('0x1'));var logger=require(_0xf758('0x2'))(_0xf758('0x3'));var moment=require(_0xf758('0x4'));var BPromise=require(_0xf758('0x5'));var rp=require(_0xf758('0x6'));var fs=require('fs');var path=require(_0xf758('0x7'));var rimraf=require(_0xf758('0x8'));var config=require(_0xf758('0x9'));var attributes=require(_0xf758('0xa'));module[_0xf758('0xb')]=function(_0x9ac051,_0x311ed0){return _0x9ac051[_0xf758('0xc')](_0xf758('0xd'),attributes,{'tableName':_0xf758('0xe'),'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 9d5d60a..852fb28 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 _0x332b=['options','where','attributes','include','map','model','then','debug','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetChatQueue','ChatQueue'];(function(_0x2969bc,_0x1d0a93){var _0x4790df=function(_0x4ec7ed){while(--_0x4ec7ed){_0x2969bc['push'](_0x2969bc['shift']());}};_0x4790df(++_0x1d0a93);}(_0x332b,0x1eb));var _0xb332=function(_0x37b003,_0x330b7a){_0x37b003=_0x37b003-0x0;var _0x1cb93a=_0x332b[_0x37b003];return _0x1cb93a;};'use strict';var _=require(_0xb332('0x0'));var util=require(_0xb332('0x1'));var moment=require(_0xb332('0x2'));var BPromise=require(_0xb332('0x3'));var rs=require(_0xb332('0x4'));var fs=require('fs');var Redis=require(_0xb332('0x5'));var db=require(_0xb332('0x6'))['db'];var utils=require(_0xb332('0x7'));var logger=require(_0xb332('0x8'))('rpc');var config=require(_0xb332('0x9'));var jayson=require(_0xb332('0xa'));var client=jayson[_0xb332('0xb')][_0xb332('0xc')]({'port':0x232a});config[_0xb332('0xd')]=_[_0xb332('0xe')](config[_0xb332('0xd')],{'host':_0xb332('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb332('0xd')]));require('./chatQueue.socket')[_0xb332('0x10')](socket);function respondWithRpcPromise(_0x3a8cc4,_0xf85dc6,_0x3c2721){return new BPromise(function(_0x596db2,_0x55d578){return client['request'](_0x3a8cc4,_0x3c2721)['then'](function(_0x4f9696){logger[_0xb332('0x11')](_0xb332('0x12'),_0xf85dc6,_0xb332('0x13'));logger['debug'](_0xb332('0x14'),_0xf85dc6,'request\x20sent',JSON[_0xb332('0x15')](_0x4f9696));if(_0x4f9696['error']){if(_0x4f9696['error'][_0xb332('0x16')]===0x1f4){logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);return _0x55d578(_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);}logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);return _0x596db2(_0x4f9696['error']['message']);}else{logger['info'](_0xb332('0x12'),_0xf85dc6,'request\x20sent');_0x596db2(_0x4f9696[_0xb332('0x19')]['message']);}})[_0xb332('0x1a')](function(_0x1b092d){logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x1b092d);_0x55d578(_0x1b092d);});});}exports[_0xb332('0x1b')]=function(_0x22312f){var _0x4a1ba0=this;return new Promise(function(_0x2b82db,_0x14dee6){return db[_0xb332('0x1c')]['findAll']({'raw':_0x22312f[_0xb332('0x1d')]?_0x22312f['options']['raw']===undefined?!![]:![]:!![],'where':_0x22312f[_0xb332('0x1d')]?_0x22312f[_0xb332('0x1d')][_0xb332('0x1e')]||null:null,'attributes':_0x22312f['options']?_0x22312f[_0xb332('0x1d')][_0xb332('0x1f')]||null:null,'limit':_0x22312f['options']?_0x22312f[_0xb332('0x1d')]['limit']||null:null,'include':_0x22312f[_0xb332('0x1d')]?_0x22312f[_0xb332('0x1d')][_0xb332('0x20')]?_[_0xb332('0x21')](_0x22312f['options'][_0xb332('0x20')],function(_0x49999a){return{'model':db[_0x49999a['model']],'as':_0x49999a['as'],'attributes':_0x49999a[_0xb332('0x1f')],'include':_0x49999a['include']?_[_0xb332('0x21')](_0x49999a[_0xb332('0x20')],function(_0x17fc02){return{'model':db[_0x17fc02['model']],'as':_0x17fc02['as'],'attributes':_0x17fc02[_0xb332('0x1f')],'include':_0x17fc02['include']?_[_0xb332('0x21')](_0x17fc02[_0xb332('0x20')],function(_0x3c8809){return{'model':db[_0x3c8809[_0xb332('0x22')]],'as':_0x3c8809['as'],'attributes':_0x3c8809[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x23')](function(_0x51ea26){logger[_0xb332('0x11')](_0xb332('0x1b'),_0x22312f);logger[_0xb332('0x24')](_0xb332('0x1b'),_0x22312f,JSON[_0xb332('0x15')](_0x51ea26));_0x2b82db(_0x51ea26);})[_0xb332('0x1a')](function(_0x197adf){logger[_0xb332('0x17')](_0xb332('0x1b'),_0x197adf['message'],_0x22312f);_0x14dee6(_0x4a1ba0[_0xb332('0x17')](0x1f4,_0x197adf[_0xb332('0x18')]));});});};exports[_0xb332('0x25')]=function(_0x4a7ddd){var _0x3845af=this;return new Promise(function(_0x4c55d3,_0x102df6){return db[_0xb332('0x1c')][_0xb332('0x26')]({'raw':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')][_0xb332('0x27')]===undefined?!![]:![]:!![],'where':_0x4a7ddd['options']?_0x4a7ddd['options'][_0xb332('0x1e')]||null:null,'attributes':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')]['attributes']||null:null,'include':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')][_0xb332('0x20')]?_[_0xb332('0x21')](_0x4a7ddd['options'][_0xb332('0x20')],function(_0x2e10fe){return{'model':db[_0x2e10fe[_0xb332('0x22')]],'as':_0x2e10fe['as'],'attributes':_0x2e10fe[_0xb332('0x1f')],'include':_0x2e10fe[_0xb332('0x20')]?_[_0xb332('0x21')](_0x2e10fe[_0xb332('0x20')],function(_0x46df74){return{'model':db[_0x46df74['model']],'as':_0x46df74['as'],'attributes':_0x46df74[_0xb332('0x1f')],'include':_0x46df74[_0xb332('0x20')]?_[_0xb332('0x21')](_0x46df74[_0xb332('0x20')],function(_0x440fd5){return{'model':db[_0x440fd5[_0xb332('0x22')]],'as':_0x440fd5['as'],'attributes':_0x440fd5[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x23')](function(_0x10247f){logger[_0xb332('0x11')](_0xb332('0x25'),_0x4a7ddd);logger[_0xb332('0x24')]('ShowChatQueue',_0x4a7ddd,JSON[_0xb332('0x15')](_0x10247f));_0x4c55d3(_0x10247f);})[_0xb332('0x1a')](function(_0x126c0){logger[_0xb332('0x17')](_0xb332('0x25'),_0x126c0['message'],_0x4a7ddd);_0x102df6(_0x3845af[_0xb332('0x17')](0x1f4,_0x126c0[_0xb332('0x18')]));});});}; \ No newline at end of file +var _0x7497=['stringify','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','debug'];(function(_0x1625d5,_0x2cb18b){var _0x5f0d99=function(_0x23cbb8){while(--_0x23cbb8){_0x1625d5['push'](_0x1625d5['shift']());}};_0x5f0d99(++_0x2cb18b);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});config[_0x7749('0xa')]=_[_0x7749('0xb')](config[_0x7749('0xa')],{'host':_0x7749('0xc'),'port':0x18eb});var socket=require(_0x7749('0xd'))(new Redis(config[_0x7749('0xa')]));require('./chatQueue.socket')[_0x7749('0xe')](socket);function respondWithRpcPromise(_0x581994,_0x781f3e,_0x837b9){return new BPromise(function(_0x32e711,_0x1e5c30){return client[_0x7749('0xf')](_0x581994,_0x837b9)[_0x7749('0x10')](function(_0x9fa376){logger[_0x7749('0x11')](_0x7749('0x12'),_0x781f3e,'request\x20sent');logger['debug'](_0x7749('0x13'),_0x781f3e,'request\x20sent',JSON['stringify'](_0x9fa376));if(_0x9fa376[_0x7749('0x14')]){if(_0x9fa376[_0x7749('0x14')][_0x7749('0x15')]===0x1f4){logger[_0x7749('0x14')](_0x7749('0x12'),_0x781f3e,_0x9fa376[_0x7749('0x14')]['message']);return _0x1e5c30(_0x9fa376['error'][_0x7749('0x16')]);}logger[_0x7749('0x14')]('ChatQueue,\x20%s,\x20%s',_0x781f3e,_0x9fa376[_0x7749('0x14')][_0x7749('0x16')]);return _0x32e711(_0x9fa376[_0x7749('0x14')][_0x7749('0x16')]);}else{logger[_0x7749('0x11')](_0x7749('0x12'),_0x781f3e,_0x7749('0x17'));_0x32e711(_0x9fa376[_0x7749('0x18')][_0x7749('0x16')]);}})[_0x7749('0x19')](function(_0x5c89d0){logger[_0x7749('0x14')](_0x7749('0x12'),_0x781f3e,_0x5c89d0);_0x1e5c30(_0x5c89d0);});});}exports['GetChatQueue']=function(_0x250a8c){var _0x544c8e=this;return new Promise(function(_0x753986,_0x11013a){return db[_0x7749('0x1a')][_0x7749('0x1b')]({'raw':_0x250a8c[_0x7749('0x1c')]?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1d')]===undefined?!![]:![]:!![],'where':_0x250a8c[_0x7749('0x1c')]?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1e')]||null:null,'attributes':_0x250a8c['options']?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1f')]||null:null,'limit':_0x250a8c['options']?_0x250a8c['options'][_0x7749('0x20')]||null:null,'include':_0x250a8c['options']?_0x250a8c[_0x7749('0x1c')][_0x7749('0x21')]?_[_0x7749('0x22')](_0x250a8c[_0x7749('0x1c')]['include'],function(_0x21f09e){return{'model':db[_0x21f09e['model']],'as':_0x21f09e['as'],'attributes':_0x21f09e['attributes'],'include':_0x21f09e['include']?_['map'](_0x21f09e['include'],function(_0x5cd489){return{'model':db[_0x5cd489[_0x7749('0x23')]],'as':_0x5cd489['as'],'attributes':_0x5cd489[_0x7749('0x1f')],'include':_0x5cd489['include']?_[_0x7749('0x22')](_0x5cd489[_0x7749('0x21')],function(_0x8112c9){return{'model':db[_0x8112c9[_0x7749('0x23')]],'as':_0x8112c9['as'],'attributes':_0x8112c9[_0x7749('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x10')](function(_0x5cdc03){logger[_0x7749('0x11')](_0x7749('0x24'),_0x250a8c);logger[_0x7749('0x25')]('GetChatQueue',_0x250a8c,JSON[_0x7749('0x26')](_0x5cdc03));_0x753986(_0x5cdc03);})[_0x7749('0x19')](function(_0xdc2321){logger[_0x7749('0x14')](_0x7749('0x24'),_0xdc2321[_0x7749('0x16')],_0x250a8c);_0x11013a(_0x544c8e[_0x7749('0x14')](0x1f4,_0xdc2321[_0x7749('0x16')]));});});};exports[_0x7749('0x27')]=function(_0x1f17d4){var _0x2980bd=this;return new Promise(function(_0x8247f9,_0x408f22){return db[_0x7749('0x1a')][_0x7749('0x28')]({'raw':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4[_0x7749('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4[_0x7749('0x1c')][_0x7749('0x1e')]||null:null,'attributes':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4['options']['attributes']||null:null,'include':_0x1f17d4['options']?_0x1f17d4[_0x7749('0x1c')][_0x7749('0x21')]?_[_0x7749('0x22')](_0x1f17d4[_0x7749('0x1c')]['include'],function(_0x377025){return{'model':db[_0x377025[_0x7749('0x23')]],'as':_0x377025['as'],'attributes':_0x377025[_0x7749('0x1f')],'include':_0x377025['include']?_[_0x7749('0x22')](_0x377025[_0x7749('0x21')],function(_0x4a14ec){return{'model':db[_0x4a14ec[_0x7749('0x23')]],'as':_0x4a14ec['as'],'attributes':_0x4a14ec['attributes'],'include':_0x4a14ec[_0x7749('0x21')]?_[_0x7749('0x22')](_0x4a14ec[_0x7749('0x21')],function(_0x559970){return{'model':db[_0x559970[_0x7749('0x23')]],'as':_0x559970['as'],'attributes':_0x559970[_0x7749('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x10')](function(_0x1afb44){logger['info']('ShowChatQueue',_0x1f17d4);logger['debug'](_0x7749('0x27'),_0x1f17d4,JSON[_0x7749('0x26')](_0x1afb44));_0x8247f9(_0x1afb44);})[_0x7749('0x19')](function(_0x12086f){logger[_0x7749('0x14')](_0x7749('0x27'),_0x12086f[_0x7749('0x16')],_0x1f17d4);_0x408f22(_0x2980bd[_0x7749('0x14')](0x1f4,_0x12086f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 458909a..8f5049b 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 _0xc3b5=['length','remove','update','emit','register'];(function(_0x2915ed,_0x1407b8){var _0x1d4fd9=function(_0x357ebc){while(--_0x357ebc){_0x2915ed['push'](_0x2915ed['shift']());}};_0x1d4fd9(++_0x1407b8);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x1e8332,_0x19907e){_0x1e8332=_0x1e8332-0x0;var _0x46d11f=_0xc3b5[_0x1e8332];return _0x46d11f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x5c3b('0x0'),_0x5c3b('0x1')];function createListener(_0xbe95d4,_0x3acf12){return function(_0x2f9a72){_0x3acf12[_0x5c3b('0x2')](_0xbe95d4,_0x2f9a72);};}function removeListener(_0x237a61,_0x48f8a1){return function(){ChatQueueEvents['removeListener'](_0x237a61,_0x48f8a1);};}exports[_0x5c3b('0x3')]=function(_0x6b8a1e){for(var _0x56345e=0x0,_0x568a28=events[_0x5c3b('0x4')];_0x56345e<_0x568a28;_0x56345e++){var _0x420839=events[_0x56345e];var _0x3892ad=createListener('chatQueue:'+_0x420839,_0x6b8a1e);ChatQueueEvents['on'](_0x420839,_0x3892ad);}}; \ No newline at end of file +var _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0xb332,0xd9));var _0x2b33=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0xb332[_0x58eec7];return _0x25c5d3;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e3ee10b..040fe52 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5966de,_0x2a212e){var _0x287241=function(_0x4f8a91){while(--_0x4f8a91){_0x5966de['push'](_0x5966de['shift']());}};_0x287241(++_0x2a212e);}(_0xe14b,0x93));var _0xbe14=function(_0x20c299,_0x3d9bb3){_0x20c299=_0x20c299-0x0;var _0x2fd0c3=_0xe14b[_0x20c299];return _0x2fd0c3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x44d1a8,_0x34ebdd){var _0x3ae535=function(_0x316cee){while(--_0x316cee){_0x44d1a8['push'](_0x44d1a8['shift']());}};_0x3ae535(++_0x34ebdd);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b290287..cd6b6b1 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 _0xdf85=['sequelize','STRING','DATE'];(function(_0x368d1a,_0x552486){var _0x4834c6=function(_0x2ce26b){while(--_0x2ce26b){_0x368d1a['push'](_0x368d1a['shift']());}};_0x4834c6(++_0x552486);}(_0xdf85,0x12c));var _0x5df8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdf85[_0x57b54c];return _0x59cc19;};'use strict';var moment=require('moment');var Sequelize=require(_0x5df8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5df8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5df8('0x1')]},'joinAt':{'type':Sequelize[_0x5df8('0x2')]},'leaveAt':{'type':Sequelize[_0x5df8('0x2')]},'acceptAt':{'type':Sequelize[_0x5df8('0x2')]},'exitAt':{'type':Sequelize[_0x5df8('0x2')]},'reason':{'type':Sequelize[_0x5df8('0x1')]}}; \ No newline at end of file +var _0xfbd1=['STRING','DATE','sequelize','exports'];(function(_0x503603,_0x4e5019){var _0x40986f=function(_0x34f6bc){while(--_0x34f6bc){_0x503603['push'](_0x503603['shift']());}};_0x40986f(++_0x4e5019);}(_0xfbd1,0x176));var _0x1fbd=function(_0x16c493,_0x504324){_0x16c493=_0x16c493-0x0;var _0x4d814b=_0xfbd1[_0x16c493];return _0x4d814b;};'use strict';var moment=require('moment');var Sequelize=require(_0x1fbd('0x0'));module[_0x1fbd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1fbd('0x2')]},'joinAt':{'type':Sequelize[_0x1fbd('0x3')]},'leaveAt':{'type':Sequelize[_0x1fbd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1fbd('0x3')]},'reason':{'type':Sequelize[_0x1fbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2724b3e..a95fd97 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 _0xed20=['../../mysqldb','sendStatus','end','status','offset','limit','undefined','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20f92e,_0x54358f){var _0x4779d5=function(_0x2fca65){while(--_0x2fca65){_0x20f92e['push'](_0x20f92e['shift']());}};_0x4779d5(++_0x54358f);}(_0xed20,0xce));var _0x0ed2=function(_0x591cc7,_0x4437cf){_0x591cc7=_0x591cc7-0x0;var _0x2cd866=_0xed20[_0x591cc7];return _0x2cd866;};'use strict';var emlformat=require(_0x0ed2('0x0'));var rimraf=require(_0x0ed2('0x1'));var zipdir=require(_0x0ed2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ed2('0x3'));var moment=require(_0x0ed2('0x4'));var BPromise=require(_0x0ed2('0x5'));var Mustache=require(_0x0ed2('0x6'));var util=require(_0x0ed2('0x7'));var path=require(_0x0ed2('0x8'));var sox=require('sox');var csv=require(_0x0ed2('0x9'));var ejs=require(_0x0ed2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed2('0xb'));var squel=require(_0x0ed2('0xc'));var crypto=require(_0x0ed2('0xd'));var jsforce=require(_0x0ed2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ed2('0x9'));var querystring=require(_0x0ed2('0xf'));var Papa=require(_0x0ed2('0x10'));var Redis=require(_0x0ed2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ed2('0x12'));var hardwareService=require(_0x0ed2('0x13'));var logger=require(_0x0ed2('0x14'))(_0x0ed2('0x15'));var utils=require(_0x0ed2('0x16'));var config=require(_0x0ed2('0x17'));var licenseUtil=require(_0x0ed2('0x18'));var db=require(_0x0ed2('0x19'))['db'];function respondWithStatusCode(_0x3cc6b4,_0x342768){_0x342768=_0x342768||0xcc;return function(_0x14355d){if(_0x14355d){return _0x3cc6b4[_0x0ed2('0x1a')](_0x342768);}return _0x3cc6b4['status'](_0x342768)[_0x0ed2('0x1b')]();};}function respondWithResult(_0x3b0f4b,_0x28c90f){_0x28c90f=_0x28c90f||0xc8;return function(_0x11b884){if(_0x11b884){return _0x3b0f4b[_0x0ed2('0x1c')](_0x28c90f)['json'](_0x11b884);}};}function respondWithFilteredResult(_0x30ccd2,_0x55ca){return function(_0x350995){if(_0x350995){var _0x5101f2=typeof _0x55ca[_0x0ed2('0x1d')]==='undefined'&&typeof _0x55ca[_0x0ed2('0x1e')]===_0x0ed2('0x1f');var _0xc0f621=_0x350995['count'];var _0x50c142=_0x5101f2?0x0:_0x55ca[_0x0ed2('0x1d')];var _0x6b3af1=_0x5101f2?_0x350995['count']:_0x55ca[_0x0ed2('0x1d')]+_0x55ca['limit'];var _0x25e4dc;if(_0x6b3af1>=_0xc0f621){_0x6b3af1=_0xc0f621;_0x25e4dc=0xc8;}else{_0x25e4dc=0xce;}_0x30ccd2[_0x0ed2('0x1c')](_0x25e4dc);return _0x30ccd2['set']('Content-Range',_0x50c142+'-'+_0x6b3af1+'/'+_0xc0f621)['json'](_0x350995);}return null;};}function patchUpdates(_0x13060b){return function(_0x270de4){try{jsonpatch[_0x0ed2('0x20')](_0x270de4,_0x13060b,!![]);}catch(_0x1206e3){return BPromise[_0x0ed2('0x21')](_0x1206e3);}return _0x270de4[_0x0ed2('0x22')]();};}function saveUpdates(_0x13d3b7,_0x56f511){return function(_0x4c1dbd){if(_0x4c1dbd){return _0x4c1dbd[_0x0ed2('0x23')](_0x13d3b7)[_0x0ed2('0x24')](function(_0x7a3157){return _0x7a3157;});}return null;};}function removeEntity(_0x505321,_0x42911c){return function(_0x306f97){if(_0x306f97){return _0x306f97[_0x0ed2('0x25')]()[_0x0ed2('0x24')](function(){_0x505321['status'](0xcc)[_0x0ed2('0x1b')]();});}};}function handleEntityNotFound(_0x24983e,_0x1abc6f){return function(_0x19ffde){if(!_0x19ffde){_0x24983e[_0x0ed2('0x1a')](0x194);}return _0x19ffde;};}function handleError(_0x5bb903,_0x14c0e6){_0x14c0e6=_0x14c0e6||0x1f4;return function(_0x23b304){logger[_0x0ed2('0x26')](_0x23b304[_0x0ed2('0x27')]);if(_0x23b304[_0x0ed2('0x28')]){delete _0x23b304[_0x0ed2('0x28')];}_0x5bb903[_0x0ed2('0x1c')](_0x14c0e6)[_0x0ed2('0x29')](_0x23b304);};}exports[_0x0ed2('0x2a')]=function(_0x1e6efe,_0x597c6e){var _0x3bc558={},_0x5e9d4d={},_0x49ff37={'count':0x0,'rows':[]};var _0x3c62e4=_[_0x0ed2('0x2b')](db[_0x0ed2('0x2c')][_0x0ed2('0x2d')],function(_0x2a9b01){return{'name':_0x2a9b01[_0x0ed2('0x2e')],'type':_0x2a9b01['type']['key']};});_0x5e9d4d['model']=_[_0x0ed2('0x2b')](_0x3c62e4,_0x0ed2('0x28'));_0x5e9d4d[_0x0ed2('0x2f')]=_[_0x0ed2('0x30')](_0x1e6efe['query']);_0x5e9d4d[_0x0ed2('0x31')]=_['intersection'](_0x5e9d4d[_0x0ed2('0x32')],_0x5e9d4d[_0x0ed2('0x2f')]);_0x3bc558['attributes']=_[_0x0ed2('0x33')](_0x5e9d4d['model'],qs[_0x0ed2('0x34')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x34')]));_0x3bc558[_0x0ed2('0x35')]=_0x3bc558['attributes'][_0x0ed2('0x36')]?_0x3bc558[_0x0ed2('0x35')]:_0x5e9d4d['model'];if(!_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x37')](_0x0ed2('0x38'))){_0x3bc558[_0x0ed2('0x1e')]=qs[_0x0ed2('0x1e')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x1e')]);_0x3bc558[_0x0ed2('0x1d')]=qs[_0x0ed2('0x1d')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x1d')]);}_0x3bc558[_0x0ed2('0x39')]=qs['sort'](_0x1e6efe['query'][_0x0ed2('0x3a')]);_0x3bc558['where']=qs[_0x0ed2('0x31')](_[_0x0ed2('0x3b')](_0x1e6efe[_0x0ed2('0x2f')],_0x5e9d4d[_0x0ed2('0x31')]),_0x3c62e4);if(_0x1e6efe[_0x0ed2('0x2f')]['filter']){_0x3bc558[_0x0ed2('0x3c')]=_[_0x0ed2('0x3d')](_0x3bc558[_0x0ed2('0x3c')],{'$or':_[_0x0ed2('0x2b')](_0x3c62e4,function(_0x1ec43b){if(_0x1ec43b[_0x0ed2('0x3e')]!==_0x0ed2('0x3f')){var _0x5b9c67={};_0x5b9c67[_0x1ec43b['name']]={'$like':'%'+_0x1e6efe['query'][_0x0ed2('0x40')]+'%'};return _0x5b9c67;}})});}_0x3bc558=_[_0x0ed2('0x3d')]({},_0x3bc558,_0x1e6efe[_0x0ed2('0x41')]);var _0x5606d7={'where':_0x3bc558[_0x0ed2('0x3c')]};return db['ChatQueueReport'][_0x0ed2('0x42')](_0x5606d7)[_0x0ed2('0x24')](function(_0x694ebb){_0x49ff37[_0x0ed2('0x42')]=_0x694ebb;if(_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x43')]){_0x3bc558[_0x0ed2('0x44')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x3bc558);})[_0x0ed2('0x24')](function(_0x4ced59){_0x49ff37[_0x0ed2('0x45')]=_0x4ced59;return _0x49ff37;})[_0x0ed2('0x24')](respondWithFilteredResult(_0x597c6e,_0x3bc558))['catch'](handleError(_0x597c6e,null));};exports[_0x0ed2('0x46')]=function(_0x3f5fa3,_0x50f596){var _0x1b4103={'raw':!![],'where':{'id':_0x3f5fa3['params']['id']}},_0x11c59d={};_0x11c59d[_0x0ed2('0x32')]=_['keys'](db[_0x0ed2('0x2c')][_0x0ed2('0x2d')]);_0x11c59d[_0x0ed2('0x2f')]=_['keys'](_0x3f5fa3['query']);_0x11c59d[_0x0ed2('0x31')]=_[_0x0ed2('0x33')](_0x11c59d[_0x0ed2('0x32')],_0x11c59d[_0x0ed2('0x2f')]);_0x1b4103['attributes']=_['intersection'](_0x11c59d[_0x0ed2('0x32')],qs['fields'](_0x3f5fa3[_0x0ed2('0x2f')][_0x0ed2('0x34')]));_0x1b4103[_0x0ed2('0x35')]=_0x1b4103[_0x0ed2('0x35')][_0x0ed2('0x36')]?_0x1b4103['attributes']:_0x11c59d[_0x0ed2('0x32')];if(_0x3f5fa3[_0x0ed2('0x2f')]['includeAll']){_0x1b4103[_0x0ed2('0x44')]=[{'all':!![]}];}_0x1b4103=_['merge']({},_0x1b4103,_0x3f5fa3['options']);return db[_0x0ed2('0x2c')][_0x0ed2('0x47')](_0x1b4103)[_0x0ed2('0x24')](handleEntityNotFound(_0x50f596,null))[_0x0ed2('0x24')](respondWithResult(_0x50f596,null))[_0x0ed2('0x48')](handleError(_0x50f596,null));};exports['create']=function(_0x567d5e,_0xa5b266){return db[_0x0ed2('0x2c')][_0x0ed2('0x49')](_0x567d5e[_0x0ed2('0x4a')],{})[_0x0ed2('0x24')](respondWithResult(_0xa5b266,0xc9))[_0x0ed2('0x48')](handleError(_0xa5b266,null));};exports[_0x0ed2('0x23')]=function(_0x6b3269,_0x3387e1){if(_0x6b3269[_0x0ed2('0x4a')]['id']){delete _0x6b3269[_0x0ed2('0x4a')]['id'];}return db[_0x0ed2('0x2c')][_0x0ed2('0x47')]({'where':{'id':_0x6b3269[_0x0ed2('0x4b')]['id']}})[_0x0ed2('0x24')](handleEntityNotFound(_0x3387e1,null))[_0x0ed2('0x24')](saveUpdates(_0x6b3269[_0x0ed2('0x4a')],null))['then'](respondWithResult(_0x3387e1,null))[_0x0ed2('0x48')](handleError(_0x3387e1,null));};exports[_0x0ed2('0x25')]=function(_0x204460,_0x58e9ca){return db[_0x0ed2('0x2c')]['find']({'where':{'id':_0x204460[_0x0ed2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58e9ca,null))[_0x0ed2('0x24')](removeEntity(_0x58e9ca,null))[_0x0ed2('0x48')](handleError(_0x58e9ca,null));};exports[_0x0ed2('0x4c')]=function(_0x1c77e2,_0x4b690e){return db['ChatQueueReport'][_0x0ed2('0x4c')]()['then'](respondWithResult(_0x4b690e,null))[_0x0ed2('0x48')](handleError(_0x4b690e,null));}; \ No newline at end of file +var _0x55c1=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0xd8d758,_0x153ed5){var _0x55628d=function(_0x1f43dd){while(--_0x1f43dd){_0xd8d758['push'](_0xd8d758['shift']());}};_0x55628d(++_0x153ed5);}(_0x55c1,0x1e5));var _0x155c=function(_0x129d52,_0x1beadf){_0x129d52=_0x129d52-0x0;var _0x79ef89=_0x55c1[_0x129d52];return _0x79ef89;};'use strict';var emlformat=require(_0x155c('0x0'));var rimraf=require(_0x155c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x155c('0x2'));var BPromise=require(_0x155c('0x3'));var Mustache=require(_0x155c('0x4'));var util=require(_0x155c('0x5'));var path=require(_0x155c('0x6'));var sox=require('sox');var csv=require(_0x155c('0x7'));var ejs=require(_0x155c('0x8'));var fs=require('fs');var fs_extra=require(_0x155c('0x9'));var _=require('lodash');var squel=require(_0x155c('0xa'));var crypto=require(_0x155c('0xb'));var jsforce=require(_0x155c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x155c('0xd'));var Redis=require(_0x155c('0xe'));var authService=require(_0x155c('0xf'));var qs=require(_0x155c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x155c('0x11'));var logger=require(_0x155c('0x12'))('api');var utils=require(_0x155c('0x13'));var config=require(_0x155c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x155c('0x15'))['db'];function respondWithStatusCode(_0x278370,_0x5b6173){_0x5b6173=_0x5b6173||0xcc;return function(_0x1f1866){if(_0x1f1866){return _0x278370[_0x155c('0x16')](_0x5b6173);}return _0x278370[_0x155c('0x17')](_0x5b6173)['end']();};}function respondWithResult(_0x372ec3,_0x37903b){_0x37903b=_0x37903b||0xc8;return function(_0xfe906a){if(_0xfe906a){return _0x372ec3[_0x155c('0x17')](_0x37903b)[_0x155c('0x18')](_0xfe906a);}};}function respondWithFilteredResult(_0x4899a3,_0x2997af){return function(_0x49f59f){if(_0x49f59f){var _0x48fe51=typeof _0x2997af[_0x155c('0x19')]==='undefined'&&typeof _0x2997af[_0x155c('0x1a')]===_0x155c('0x1b');var _0x9e024e=_0x49f59f['count'];var _0xe800de=_0x48fe51?0x0:_0x2997af[_0x155c('0x19')];var _0x224a3d=_0x48fe51?_0x49f59f[_0x155c('0x1c')]:_0x2997af[_0x155c('0x19')]+_0x2997af[_0x155c('0x1a')];var _0xa4c0c;if(_0x224a3d>=_0x9e024e){_0x224a3d=_0x9e024e;_0xa4c0c=0xc8;}else{_0xa4c0c=0xce;}_0x4899a3[_0x155c('0x17')](_0xa4c0c);return _0x4899a3[_0x155c('0x1d')](_0x155c('0x1e'),_0xe800de+'-'+_0x224a3d+'/'+_0x9e024e)[_0x155c('0x18')](_0x49f59f);}return null;};}function patchUpdates(_0xe422f6){return function(_0x250399){try{jsonpatch[_0x155c('0x1f')](_0x250399,_0xe422f6,!![]);}catch(_0x43b032){return BPromise[_0x155c('0x20')](_0x43b032);}return _0x250399[_0x155c('0x21')]();};}function saveUpdates(_0x5935af,_0x1564bf){return function(_0x3cc458){if(_0x3cc458){return _0x3cc458[_0x155c('0x22')](_0x5935af)[_0x155c('0x23')](function(_0x1006b8){return _0x1006b8;});}return null;};}function removeEntity(_0x254557,_0x4b6d0d){return function(_0x4f242c){if(_0x4f242c){return _0x4f242c[_0x155c('0x24')]()[_0x155c('0x23')](function(){_0x254557[_0x155c('0x17')](0xcc)[_0x155c('0x25')]();});}};}function handleEntityNotFound(_0x41e24d,_0x930c00){return function(_0x452175){if(!_0x452175){_0x41e24d[_0x155c('0x16')](0x194);}return _0x452175;};}function handleError(_0x241b38,_0x155028){_0x155028=_0x155028||0x1f4;return function(_0x36be3d){logger[_0x155c('0x26')](_0x36be3d[_0x155c('0x27')]);if(_0x36be3d[_0x155c('0x28')]){delete _0x36be3d[_0x155c('0x28')];}_0x241b38[_0x155c('0x17')](_0x155028)['send'](_0x36be3d);};}exports[_0x155c('0x29')]=function(_0x5a2004,_0x4d9a38){var _0x5bb056={},_0x47c89d={},_0x43608a={'count':0x0,'rows':[]};var _0x3593a0=_[_0x155c('0x2a')](db['ChatQueueReport'][_0x155c('0x2b')],function(_0x18dd71){return{'name':_0x18dd71[_0x155c('0x2c')],'type':_0x18dd71['type']['key']};});_0x47c89d['model']=_[_0x155c('0x2a')](_0x3593a0,_0x155c('0x28'));_0x47c89d['query']=_[_0x155c('0x2d')](_0x5a2004[_0x155c('0x2e')]);_0x47c89d[_0x155c('0x2f')]=_['intersection'](_0x47c89d[_0x155c('0x30')],_0x47c89d['query']);_0x5bb056[_0x155c('0x31')]=_[_0x155c('0x32')](_0x47c89d['model'],qs[_0x155c('0x33')](_0x5a2004[_0x155c('0x2e')]['fields']));_0x5bb056[_0x155c('0x31')]=_0x5bb056[_0x155c('0x31')]['length']?_0x5bb056[_0x155c('0x31')]:_0x47c89d[_0x155c('0x30')];if(!_0x5a2004[_0x155c('0x2e')][_0x155c('0x34')](_0x155c('0x35'))){_0x5bb056[_0x155c('0x1a')]=qs[_0x155c('0x1a')](_0x5a2004[_0x155c('0x2e')][_0x155c('0x1a')]);_0x5bb056[_0x155c('0x19')]=qs[_0x155c('0x19')](_0x5a2004['query'][_0x155c('0x19')]);}_0x5bb056[_0x155c('0x36')]=qs[_0x155c('0x37')](_0x5a2004['query'][_0x155c('0x37')]);_0x5bb056[_0x155c('0x38')]=qs['filters'](_['pick'](_0x5a2004[_0x155c('0x2e')],_0x47c89d[_0x155c('0x2f')]),_0x3593a0);if(_0x5a2004[_0x155c('0x2e')]['filter']){_0x5bb056[_0x155c('0x38')]=_[_0x155c('0x39')](_0x5bb056[_0x155c('0x38')],{'$or':_['map'](_0x3593a0,function(_0x394973){if(_0x394973['type']!==_0x155c('0x3a')){var _0x45457f={};_0x45457f[_0x394973[_0x155c('0x28')]]={'$like':'%'+_0x5a2004['query']['filter']+'%'};return _0x45457f;}})});}_0x5bb056=_[_0x155c('0x39')]({},_0x5bb056,_0x5a2004[_0x155c('0x3b')]);var _0x22fe10={'where':_0x5bb056['where']};return db[_0x155c('0x3c')][_0x155c('0x1c')](_0x22fe10)[_0x155c('0x23')](function(_0x40ade9){_0x43608a[_0x155c('0x1c')]=_0x40ade9;if(_0x5a2004['query']['includeAll']){_0x5bb056[_0x155c('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x155c('0x3e')](_0x5bb056);})['then'](function(_0x59af92){_0x43608a[_0x155c('0x3f')]=_0x59af92;return _0x43608a;})[_0x155c('0x23')](respondWithFilteredResult(_0x4d9a38,_0x5bb056))[_0x155c('0x40')](handleError(_0x4d9a38,null));};exports[_0x155c('0x41')]=function(_0x12337d,_0x5418de){var _0x350147={'raw':!![],'where':{'id':_0x12337d[_0x155c('0x42')]['id']}},_0x34b588={};_0x34b588[_0x155c('0x30')]=_[_0x155c('0x2d')](db[_0x155c('0x3c')][_0x155c('0x2b')]);_0x34b588[_0x155c('0x2e')]=_[_0x155c('0x2d')](_0x12337d[_0x155c('0x2e')]);_0x34b588[_0x155c('0x2f')]=_['intersection'](_0x34b588[_0x155c('0x30')],_0x34b588[_0x155c('0x2e')]);_0x350147['attributes']=_[_0x155c('0x32')](_0x34b588[_0x155c('0x30')],qs[_0x155c('0x33')](_0x12337d[_0x155c('0x2e')][_0x155c('0x33')]));_0x350147[_0x155c('0x31')]=_0x350147[_0x155c('0x31')][_0x155c('0x43')]?_0x350147[_0x155c('0x31')]:_0x34b588[_0x155c('0x30')];if(_0x12337d[_0x155c('0x2e')][_0x155c('0x44')]){_0x350147[_0x155c('0x3d')]=[{'all':!![]}];}_0x350147=_[_0x155c('0x39')]({},_0x350147,_0x12337d['options']);return db['ChatQueueReport']['find'](_0x350147)['then'](handleEntityNotFound(_0x5418de,null))['then'](respondWithResult(_0x5418de,null))[_0x155c('0x40')](handleError(_0x5418de,null));};exports[_0x155c('0x45')]=function(_0x9e5f88,_0x49656e){return db['ChatQueueReport'][_0x155c('0x45')](_0x9e5f88[_0x155c('0x46')],{})['then'](respondWithResult(_0x49656e,0xc9))['catch'](handleError(_0x49656e,null));};exports[_0x155c('0x22')]=function(_0x5a93ec,_0x14e43a){if(_0x5a93ec['body']['id']){delete _0x5a93ec[_0x155c('0x46')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a93ec[_0x155c('0x42')]['id']}})[_0x155c('0x23')](handleEntityNotFound(_0x14e43a,null))[_0x155c('0x23')](saveUpdates(_0x5a93ec['body'],null))[_0x155c('0x23')](respondWithResult(_0x14e43a,null))[_0x155c('0x40')](handleError(_0x14e43a,null));};exports[_0x155c('0x24')]=function(_0x3022f7,_0x3dfba3){return db[_0x155c('0x3c')][_0x155c('0x47')]({'where':{'id':_0x3022f7[_0x155c('0x42')]['id']}})[_0x155c('0x23')](handleEntityNotFound(_0x3dfba3,null))['then'](removeEntity(_0x3dfba3,null))[_0x155c('0x40')](handleError(_0x3dfba3,null));};exports[_0x155c('0x48')]=function(_0x263a1a,_0xf8d24e){return db[_0x155c('0x3c')]['describe']()[_0x155c('0x23')](respondWithResult(_0xf8d24e,null))[_0x155c('0x40')](handleError(_0xf8d24e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 00740b4..3aded76 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4d01e3,_0x44c37e){var _0x3b2491=function(_0x40b771){while(--_0x40b771){_0x4d01e3['push'](_0x4d01e3['shift']());}};_0x3b2491(++_0x44c37e);}(_0x757a,0xde));var _0xa757=function(_0x9fadbd,_0x29b939){_0x9fadbd=_0x9fadbd-0x0;var _0x437523=_0x757a[_0x9fadbd];return _0x437523;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fc512,_0x1996db){_0x1fc512=_0x1fc512-0x0;var _0xae94b9=_0xb10b[_0x1fc512];return _0xae94b9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index afd917a..c12ec06 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 _0xea36=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body'];(function(_0x1e4612,_0xcfd7d6){var _0x40aaa3=function(_0x2aa6dd){while(--_0x2aa6dd){_0x1e4612['push'](_0x1e4612['shift']());}};_0x40aaa3(++_0xcfd7d6);}(_0xea36,0xfa));var _0x6ea3=function(_0x331bc7,_0x35ee48){_0x331bc7=_0x331bc7-0x0;var _0x286a84=_0xea36[_0x331bc7];return _0x286a84;};'use strict';var _=require(_0x6ea3('0x0'));var util=require(_0x6ea3('0x1'));var moment=require(_0x6ea3('0x2'));var BPromise=require(_0x6ea3('0x3'));var rs=require(_0x6ea3('0x4'));var fs=require('fs');var Redis=require(_0x6ea3('0x5'));var db=require(_0x6ea3('0x6'))['db'];var utils=require(_0x6ea3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ea3('0x8'));var jayson=require(_0x6ea3('0x9'));var client=jayson[_0x6ea3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1163b7,_0x7c406a,_0x33c269){return new BPromise(function(_0x5864e9,_0x340c8d){return client['request'](_0x1163b7,_0x33c269)['then'](function(_0x5ec474){logger['info'](_0x6ea3('0xb'),_0x7c406a,'request\x20sent');logger[_0x6ea3('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x7c406a,_0x6ea3('0xd'),JSON[_0x6ea3('0xe')](_0x5ec474));if(_0x5ec474[_0x6ea3('0xf')]){if(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x10')]===0x1f4){logger[_0x6ea3('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x7c406a,_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);return _0x340c8d(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);}logger[_0x6ea3('0xf')](_0x6ea3('0xb'),_0x7c406a,_0x5ec474[_0x6ea3('0xf')]['message']);return _0x5864e9(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);}else{logger[_0x6ea3('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x7c406a,'request\x20sent');_0x5864e9(_0x5ec474['result'][_0x6ea3('0x11')]);}})[_0x6ea3('0x13')](function(_0x1ca246){logger[_0x6ea3('0xf')](_0x6ea3('0xb'),_0x7c406a,_0x1ca246);_0x340c8d(_0x1ca246);});});}exports[_0x6ea3('0x14')]=function(_0x198e09){var _0x5b3ae6=this;return new Promise(function(_0x13c6ab,_0x4ce7a1){return db[_0x6ea3('0x15')][_0x6ea3('0x16')](_0x198e09['body'],{'raw':_0x198e09[_0x6ea3('0x17')]?_0x198e09[_0x6ea3('0x17')][_0x6ea3('0x18')]===undefined?!![]:![]:!![]})[_0x6ea3('0x19')](function(_0x56210a){logger[_0x6ea3('0x12')](_0x6ea3('0x14'),_0x198e09);logger[_0x6ea3('0xc')](_0x6ea3('0x14'),_0x198e09,JSON[_0x6ea3('0xe')](_0x56210a));_0x13c6ab(_0x56210a);})['catch'](function(_0x2c6ec8){logger['error'](_0x6ea3('0x14'),_0x2c6ec8[_0x6ea3('0x11')],_0x198e09);_0x4ce7a1(_0x5b3ae6['error'](0x1f4,_0x2c6ec8['message']));});});};exports[_0x6ea3('0x1a')]=function(_0x199880){var _0x2207ec=this;return new Promise(function(_0x4c53bc,_0x3b091a){return db[_0x6ea3('0x15')][_0x6ea3('0x1b')](_0x199880[_0x6ea3('0x1c')],{'raw':_0x199880[_0x6ea3('0x17')]?_0x199880[_0x6ea3('0x17')][_0x6ea3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x199880['options']?_0x199880['options'][_0x6ea3('0x1d')]||null:null,'attributes':_0x199880[_0x6ea3('0x17')]?_0x199880['options']['attributes']||null:null,'limit':_0x199880[_0x6ea3('0x17')]?_0x199880['options'][_0x6ea3('0x1e')]||null:null})['then'](function(_0x1619e6){logger[_0x6ea3('0x12')](_0x6ea3('0x1a'),_0x199880);logger[_0x6ea3('0xc')](_0x6ea3('0x1a'),_0x199880,JSON['stringify'](_0x1619e6));_0x4c53bc(_0x1619e6);})[_0x6ea3('0x13')](function(_0x124b34){logger[_0x6ea3('0xf')](_0x6ea3('0x1a'),_0x124b34[_0x6ea3('0x11')],_0x199880);_0x3b091a(_0x2207ec[_0x6ea3('0xf')](0x1f4,_0x124b34['message']));});});}; \ No newline at end of file +var _0xaf60=['code','message','info','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','limit','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error'];(function(_0xa43518,_0x2a4c6b){var _0x5e9b94=function(_0x3d3c7f){while(--_0x3d3c7f){_0xa43518['push'](_0xa43518['shift']());}};_0x5e9b94(++_0x2a4c6b);}(_0xaf60,0x82));var _0x0af6=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xaf60[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var moment=require(_0x0af6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af6('0x4'))(_0x0af6('0x5'));var config=require(_0x0af6('0x6'));var jayson=require(_0x0af6('0x7'));var client=jayson[_0x0af6('0x8')][_0x0af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb218,_0x52c997,_0x376979){return new BPromise(function(_0x28d620,_0x525bcc){return client[_0x0af6('0xa')](_0x2eb218,_0x376979)[_0x0af6('0xb')](function(_0xe9d01a){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x52c997,'request\x20sent');logger[_0x0af6('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x52c997,_0x0af6('0xd'),JSON['stringify'](_0xe9d01a));if(_0xe9d01a['error']){if(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0xf')]===0x1f4){logger[_0x0af6('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);return _0x525bcc(_0xe9d01a[_0x0af6('0xe')]['message']);}logger[_0x0af6('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')]['message']);return _0x28d620(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);}else{logger[_0x0af6('0x11')](_0x0af6('0x12'),_0x52c997,'request\x20sent');_0x28d620(_0xe9d01a['result']['message']);}})['catch'](function(_0x4d5936){logger[_0x0af6('0xe')](_0x0af6('0x12'),_0x52c997,_0x4d5936);_0x525bcc(_0x4d5936);});});}exports[_0x0af6('0x13')]=function(_0x2bd5c0){var _0x5bf0d3=this;return new Promise(function(_0x57511e,_0x4bf9b8){return db[_0x0af6('0x14')]['create'](_0x2bd5c0[_0x0af6('0x15')],{'raw':_0x2bd5c0[_0x0af6('0x16')]?_0x2bd5c0['options'][_0x0af6('0x17')]===undefined?!![]:![]:!![]})[_0x0af6('0xb')](function(_0x2bac00){logger['info'](_0x0af6('0x13'),_0x2bd5c0);logger[_0x0af6('0xc')](_0x0af6('0x13'),_0x2bd5c0,JSON['stringify'](_0x2bac00));_0x57511e(_0x2bac00);})['catch'](function(_0x4adb2b){logger[_0x0af6('0xe')](_0x0af6('0x13'),_0x4adb2b[_0x0af6('0x10')],_0x2bd5c0);_0x4bf9b8(_0x5bf0d3[_0x0af6('0xe')](0x1f4,_0x4adb2b['message']));});});};exports[_0x0af6('0x18')]=function(_0x2083df){var _0x3fac44=this;return new Promise(function(_0x1aee87,_0x56df0b){return db[_0x0af6('0x14')][_0x0af6('0x19')](_0x2083df['body'],{'raw':_0x2083df[_0x0af6('0x16')]?_0x2083df['options'][_0x0af6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2083df[_0x0af6('0x16')]?_0x2083df[_0x0af6('0x16')][_0x0af6('0x1a')]||null:null,'attributes':_0x2083df[_0x0af6('0x16')]?_0x2083df['options']['attributes']||null:null,'limit':_0x2083df['options']?_0x2083df[_0x0af6('0x16')][_0x0af6('0x1b')]||null:null})[_0x0af6('0xb')](function(_0x4da5d0){logger[_0x0af6('0x11')](_0x0af6('0x18'),_0x2083df);logger['debug']('UpdateChatQueueReport',_0x2083df,JSON['stringify'](_0x4da5d0));_0x1aee87(_0x4da5d0);})[_0x0af6('0x1c')](function(_0x41bb88){logger['error'](_0x0af6('0x18'),_0x41bb88[_0x0af6('0x10')],_0x2083df);_0x56df0b(_0x3fac44[_0x0af6('0xe')](0x1f4,_0x41bb88[_0x0af6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2131b07..f0fcc5a 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 _0x2dd8=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x13c3bd,_0x11bcfb){var _0x4bbc90=function(_0x3958d2){while(--_0x3958d2){_0x13c3bd['push'](_0x13c3bd['shift']());}};_0x4bbc90(++_0x11bcfb);}(_0x2dd8,0x11b));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var path=require(_0x82dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x82dd('0x3')]();var fs_extra=require(_0x82dd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82dd('0x5'));var config=require('../../config/environment');var controller=require(_0x82dd('0x6'));router[_0x82dd('0x7')]('/',auth[_0x82dd('0x8')](),controller[_0x82dd('0x9')]);router[_0x82dd('0x7')](_0x82dd('0xa'),auth[_0x82dd('0x8')](),controller['describe']);router[_0x82dd('0x7')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller['show']);router['post']('/',auth[_0x82dd('0x8')](),controller[_0x82dd('0xc')]);router[_0x82dd('0xd')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller['update']);router[_0x82dd('0xe')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller[_0x82dd('0xf')]);module[_0x82dd('0x10')]=router; \ No newline at end of file +var _0x2ea7=['/describe','describe','get','show','post','create','/:id','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./chatQueueReport.controller','isAuthenticated'];(function(_0x2be892,_0x3cf508){var _0x7baad=function(_0x15c666){while(--_0x15c666){_0x2be892['push'](_0x2be892['shift']());}};_0x7baad(++_0x3cf508);}(_0x2ea7,0x1d4));var _0x72ea=function(_0x7d8e66,_0x599dbd){_0x7d8e66=_0x7d8e66-0x0;var _0x190e52=_0x2ea7[_0x7d8e66];return _0x190e52;};'use strict';var multer=require(_0x72ea('0x0'));var util=require(_0x72ea('0x1'));var path=require(_0x72ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x72ea('0x3'));var router=express['Router']();var fs_extra=require(_0x72ea('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x72ea('0x5'));var controller=require(_0x72ea('0x6'));router['get']('/',auth[_0x72ea('0x7')](),controller['index']);router['get'](_0x72ea('0x8'),auth[_0x72ea('0x7')](),controller[_0x72ea('0x9')]);router[_0x72ea('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x72ea('0xb')]);router[_0x72ea('0xc')]('/',auth[_0x72ea('0x7')](),controller[_0x72ea('0xd')]);router['put'](_0x72ea('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x72ea('0xf')](_0x72ea('0xe'),auth[_0x72ea('0x7')](),controller[_0x72ea('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0f33388..09ae418 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xeec444,_0x267a72){var _0x124b7b=function(_0x50712d){while(--_0x50712d){_0xeec444['push'](_0xeec444['shift']());}};_0x124b7b(++_0x267a72);}(_0x70e0,0x17b));var _0x070e=function(_0x5b0ad9,_0x346d66){_0x5b0ad9=_0x5b0ad9-0x0;var _0xc976c6=_0x70e0[_0x5b0ad9];return _0xc976c6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x9bde,0xe1));var _0xe9bd=function(_0x366f0d,_0x5ecaba){_0x366f0d=_0x366f0d-0x0;var _0x3973ef=_0x9bde[_0x366f0d];return _0x3973ef;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8a2fca2..006e03f 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 _0x9baf=['body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','ChatTransferReport','includeAll','findAll','rows','catch','show','params','keys','include','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9baf,0x1dd));var _0xf9ba=function(_0xf8cafb,_0x3bb857){_0xf8cafb=_0xf8cafb-0x0;var _0x11d273=_0x9baf[_0xf8cafb];return _0x11d273;};'use strict';var emlformat=require(_0xf9ba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9ba('0x1'));var rp=require('request-promise');var moment=require(_0xf9ba('0x2'));var BPromise=require(_0xf9ba('0x3'));var Mustache=require(_0xf9ba('0x4'));var util=require(_0xf9ba('0x5'));var path=require(_0xf9ba('0x6'));var sox=require(_0xf9ba('0x7'));var csv=require(_0xf9ba('0x8'));var ejs=require(_0xf9ba('0x9'));var fs=require('fs');var fs_extra=require(_0xf9ba('0xa'));var _=require(_0xf9ba('0xb'));var squel=require(_0xf9ba('0xc'));var crypto=require(_0xf9ba('0xd'));var jsforce=require(_0xf9ba('0xe'));var deskjs=require(_0xf9ba('0xf'));var toCsv=require(_0xf9ba('0x8'));var querystring=require(_0xf9ba('0x10'));var Papa=require(_0xf9ba('0x11'));var Redis=require(_0xf9ba('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf9ba('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9ba('0x14'));var logger=require(_0xf9ba('0x15'))(_0xf9ba('0x16'));var utils=require(_0xf9ba('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf9ba('0x18'));var db=require(_0xf9ba('0x19'))['db'];function respondWithStatusCode(_0x5c14a9,_0x2213e3){_0x2213e3=_0x2213e3||0xcc;return function(_0x84f397){if(_0x84f397){return _0x5c14a9[_0xf9ba('0x1a')](_0x2213e3);}return _0x5c14a9['status'](_0x2213e3)['end']();};}function respondWithResult(_0x458474,_0x3beb82){_0x3beb82=_0x3beb82||0xc8;return function(_0x3ae1cf){if(_0x3ae1cf){return _0x458474[_0xf9ba('0x1b')](_0x3beb82)[_0xf9ba('0x1c')](_0x3ae1cf);}};}function respondWithFilteredResult(_0x47535a,_0x476a22){return function(_0x1ddb6d){if(_0x1ddb6d){var _0x5cfa1d=typeof _0x476a22['offset']==='undefined'&&typeof _0x476a22[_0xf9ba('0x1d')]===_0xf9ba('0x1e');var _0x898f0d=_0x1ddb6d[_0xf9ba('0x1f')];var _0xbbaa4c=_0x5cfa1d?0x0:_0x476a22[_0xf9ba('0x20')];var _0x461ce6=_0x5cfa1d?_0x1ddb6d[_0xf9ba('0x1f')]:_0x476a22['offset']+_0x476a22[_0xf9ba('0x1d')];var _0x9fa1e3;if(_0x461ce6>=_0x898f0d){_0x461ce6=_0x898f0d;_0x9fa1e3=0xc8;}else{_0x9fa1e3=0xce;}_0x47535a[_0xf9ba('0x1b')](_0x9fa1e3);return _0x47535a[_0xf9ba('0x21')]('Content-Range',_0xbbaa4c+'-'+_0x461ce6+'/'+_0x898f0d)[_0xf9ba('0x1c')](_0x1ddb6d);}return null;};}function patchUpdates(_0x1acb0e){return function(_0x45e2f0){try{jsonpatch[_0xf9ba('0x22')](_0x45e2f0,_0x1acb0e,!![]);}catch(_0x576318){return BPromise[_0xf9ba('0x23')](_0x576318);}return _0x45e2f0[_0xf9ba('0x24')]();};}function saveUpdates(_0x1d6d89,_0x18b495){return function(_0xe6ecf2){if(_0xe6ecf2){return _0xe6ecf2[_0xf9ba('0x25')](_0x1d6d89)[_0xf9ba('0x26')](function(_0x313f71){return _0x313f71;});}return null;};}function removeEntity(_0x1dbdb2,_0x288c72){return function(_0x194a0a){if(_0x194a0a){return _0x194a0a[_0xf9ba('0x27')]()[_0xf9ba('0x26')](function(){_0x1dbdb2[_0xf9ba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45777f,_0xc6e83){return function(_0x4f56aa){if(!_0x4f56aa){_0x45777f[_0xf9ba('0x1a')](0x194);}return _0x4f56aa;};}function handleError(_0x4bd37d,_0x46a993){_0x46a993=_0x46a993||0x1f4;return function(_0x25eb5e){logger[_0xf9ba('0x28')](_0x25eb5e[_0xf9ba('0x29')]);if(_0x25eb5e[_0xf9ba('0x2a')]){delete _0x25eb5e[_0xf9ba('0x2a')];}_0x4bd37d['status'](_0x46a993)[_0xf9ba('0x2b')](_0x25eb5e);};}exports['index']=function(_0x1ff183,_0x19c57e){var _0x55829d={},_0x2494d9={},_0x21bb75={'count':0x0,'rows':[]};var _0x1ec9e1=_[_0xf9ba('0x2c')](db['ChatTransferReport'][_0xf9ba('0x2d')],function(_0x3aae87){return{'name':_0x3aae87[_0xf9ba('0x2e')],'type':_0x3aae87[_0xf9ba('0x2f')][_0xf9ba('0x30')]};});_0x2494d9[_0xf9ba('0x31')]=_[_0xf9ba('0x2c')](_0x1ec9e1,'name');_0x2494d9[_0xf9ba('0x32')]=_['keys'](_0x1ff183[_0xf9ba('0x32')]);_0x2494d9['filters']=_[_0xf9ba('0x33')](_0x2494d9[_0xf9ba('0x31')],_0x2494d9[_0xf9ba('0x32')]);_0x55829d[_0xf9ba('0x34')]=_[_0xf9ba('0x33')](_0x2494d9[_0xf9ba('0x31')],qs[_0xf9ba('0x35')](_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x35')]));_0x55829d[_0xf9ba('0x34')]=_0x55829d['attributes'][_0xf9ba('0x36')]?_0x55829d[_0xf9ba('0x34')]:_0x2494d9[_0xf9ba('0x31')];if(!_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x37')](_0xf9ba('0x38'))){_0x55829d['limit']=qs[_0xf9ba('0x1d')](_0x1ff183[_0xf9ba('0x32')]['limit']);_0x55829d[_0xf9ba('0x20')]=qs[_0xf9ba('0x20')](_0x1ff183['query'][_0xf9ba('0x20')]);}_0x55829d[_0xf9ba('0x39')]=qs[_0xf9ba('0x3a')](_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x3a')]);_0x55829d['where']=qs['filters'](_[_0xf9ba('0x3b')](_0x1ff183['query'],_0x2494d9[_0xf9ba('0x3c')]),_0x1ec9e1);if(_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x3d')]){_0x55829d[_0xf9ba('0x3e')]=_[_0xf9ba('0x3f')](_0x55829d[_0xf9ba('0x3e')],{'$or':_[_0xf9ba('0x2c')](_0x1ec9e1,function(_0x1aa33e){if(_0x1aa33e[_0xf9ba('0x2f')]!==_0xf9ba('0x40')){var _0x219067={};_0x219067[_0x1aa33e[_0xf9ba('0x2a')]]={'$like':'%'+_0x1ff183['query'][_0xf9ba('0x3d')]+'%'};return _0x219067;}})});}_0x55829d=_[_0xf9ba('0x3f')]({},_0x55829d,_0x1ff183[_0xf9ba('0x41')]);var _0x2d7b13={'where':_0x55829d[_0xf9ba('0x3e')]};return db[_0xf9ba('0x42')][_0xf9ba('0x1f')](_0x2d7b13)[_0xf9ba('0x26')](function(_0x20c711){_0x21bb75['count']=_0x20c711;if(_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x43')]){_0x55829d['include']=[{'all':!![]}];}return db[_0xf9ba('0x42')][_0xf9ba('0x44')](_0x55829d);})[_0xf9ba('0x26')](function(_0x47dd69){_0x21bb75[_0xf9ba('0x45')]=_0x47dd69;return _0x21bb75;})[_0xf9ba('0x26')](respondWithFilteredResult(_0x19c57e,_0x55829d))[_0xf9ba('0x46')](handleError(_0x19c57e,null));};exports[_0xf9ba('0x47')]=function(_0x242e06,_0x57e8c6){var _0x30c4d7={'raw':!![],'where':{'id':_0x242e06[_0xf9ba('0x48')]['id']}},_0x3fbf21={};_0x3fbf21[_0xf9ba('0x31')]=_[_0xf9ba('0x49')](db[_0xf9ba('0x42')][_0xf9ba('0x2d')]);_0x3fbf21[_0xf9ba('0x32')]=_[_0xf9ba('0x49')](_0x242e06[_0xf9ba('0x32')]);_0x3fbf21[_0xf9ba('0x3c')]=_[_0xf9ba('0x33')](_0x3fbf21[_0xf9ba('0x31')],_0x3fbf21['query']);_0x30c4d7[_0xf9ba('0x34')]=_[_0xf9ba('0x33')](_0x3fbf21['model'],qs[_0xf9ba('0x35')](_0x242e06['query'][_0xf9ba('0x35')]));_0x30c4d7[_0xf9ba('0x34')]=_0x30c4d7[_0xf9ba('0x34')][_0xf9ba('0x36')]?_0x30c4d7['attributes']:_0x3fbf21[_0xf9ba('0x31')];if(_0x242e06[_0xf9ba('0x32')][_0xf9ba('0x43')]){_0x30c4d7[_0xf9ba('0x4a')]=[{'all':!![]}];}_0x30c4d7=_['merge']({},_0x30c4d7,_0x242e06[_0xf9ba('0x41')]);return db[_0xf9ba('0x42')]['find'](_0x30c4d7)[_0xf9ba('0x26')](handleEntityNotFound(_0x57e8c6,null))[_0xf9ba('0x26')](respondWithResult(_0x57e8c6,null))[_0xf9ba('0x46')](handleError(_0x57e8c6,null));};exports['create']=function(_0x577151,_0x47547d){return db['ChatTransferReport'][_0xf9ba('0x4b')](_0x577151[_0xf9ba('0x4c')],{})['then'](respondWithResult(_0x47547d,0xc9))['catch'](handleError(_0x47547d,null));};exports['update']=function(_0x28fc45,_0x4ffc4b){if(_0x28fc45['body']['id']){delete _0x28fc45[_0xf9ba('0x4c')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x28fc45[_0xf9ba('0x48')]['id']}})[_0xf9ba('0x26')](handleEntityNotFound(_0x4ffc4b,null))[_0xf9ba('0x26')](saveUpdates(_0x28fc45[_0xf9ba('0x4c')],null))['then'](respondWithResult(_0x4ffc4b,null))[_0xf9ba('0x46')](handleError(_0x4ffc4b,null));};exports[_0xf9ba('0x27')]=function(_0x277ef0,_0xd9a2b6){return db['ChatTransferReport'][_0xf9ba('0x4d')]({'where':{'id':_0x277ef0['params']['id']}})[_0xf9ba('0x26')](handleEntityNotFound(_0xd9a2b6,null))[_0xf9ba('0x26')](removeEntity(_0xd9a2b6,null))[_0xf9ba('0x46')](handleError(_0xd9a2b6,null));};exports['describe']=function(_0x51b407,_0x17c061){return db[_0xf9ba('0x42')][_0xf9ba('0x4e')]()[_0xf9ba('0x26')](respondWithResult(_0x17c061,null))[_0xf9ba('0x46')](handleError(_0x17c061,null));}; \ No newline at end of file +var _0x694a=['hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','length','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x2f1cdd,_0x1ffdd7){var _0x5d0956=function(_0x137108){while(--_0x137108){_0x2f1cdd['push'](_0x2f1cdd['shift']());}};_0x5d0956(++_0x1ffdd7);}(_0x694a,0x13f));var _0xa694=function(_0x105702,_0x3d4a6c){_0x105702=_0x105702-0x0;var _0x10ff6b=_0x694a[_0x105702];return _0x10ff6b;};'use strict';var emlformat=require(_0xa694('0x0'));var rimraf=require(_0xa694('0x1'));var zipdir=require(_0xa694('0x2'));var jsonpatch=require(_0xa694('0x3'));var rp=require(_0xa694('0x4'));var moment=require(_0xa694('0x5'));var BPromise=require(_0xa694('0x6'));var Mustache=require(_0xa694('0x7'));var util=require('util');var path=require(_0xa694('0x8'));var sox=require('sox');var csv=require(_0xa694('0x9'));var ejs=require(_0xa694('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa694('0xb'));var squel=require(_0xa694('0xc'));var crypto=require('crypto');var jsforce=require(_0xa694('0xd'));var deskjs=require(_0xa694('0xe'));var toCsv=require(_0xa694('0x9'));var querystring=require(_0xa694('0xf'));var Papa=require(_0xa694('0x10'));var Redis=require('ioredis');var authService=require(_0xa694('0x11'));var qs=require(_0xa694('0x12'));var as=require(_0xa694('0x13'));var hardwareService=require(_0xa694('0x14'));var logger=require(_0xa694('0x15'))(_0xa694('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa694('0x17'));var db=require(_0xa694('0x18'))['db'];function respondWithStatusCode(_0xd34c8d,_0x521a91){_0x521a91=_0x521a91||0xcc;return function(_0x53bf9a){if(_0x53bf9a){return _0xd34c8d[_0xa694('0x19')](_0x521a91);}return _0xd34c8d['status'](_0x521a91)[_0xa694('0x1a')]();};}function respondWithResult(_0xbbe9c9,_0x11746b){_0x11746b=_0x11746b||0xc8;return function(_0x3aa6a6){if(_0x3aa6a6){return _0xbbe9c9[_0xa694('0x1b')](_0x11746b)['json'](_0x3aa6a6);}};}function respondWithFilteredResult(_0x1f3e37,_0x4a9763){return function(_0x573cea){if(_0x573cea){var _0x5091da=typeof _0x4a9763[_0xa694('0x1c')]==='undefined'&&typeof _0x4a9763[_0xa694('0x1d')]===_0xa694('0x1e');var _0x4cf929=_0x573cea[_0xa694('0x1f')];var _0x429524=_0x5091da?0x0:_0x4a9763[_0xa694('0x1c')];var _0x54f93d=_0x5091da?_0x573cea['count']:_0x4a9763[_0xa694('0x1c')]+_0x4a9763[_0xa694('0x1d')];var _0x4b1e26;if(_0x54f93d>=_0x4cf929){_0x54f93d=_0x4cf929;_0x4b1e26=0xc8;}else{_0x4b1e26=0xce;}_0x1f3e37['status'](_0x4b1e26);return _0x1f3e37[_0xa694('0x20')](_0xa694('0x21'),_0x429524+'-'+_0x54f93d+'/'+_0x4cf929)[_0xa694('0x22')](_0x573cea);}return null;};}function patchUpdates(_0x1f863e){return function(_0x4a9f4c){try{jsonpatch[_0xa694('0x23')](_0x4a9f4c,_0x1f863e,!![]);}catch(_0xfd05a3){return BPromise[_0xa694('0x24')](_0xfd05a3);}return _0x4a9f4c['save']();};}function saveUpdates(_0x4c8060,_0x321d72){return function(_0x22792c){if(_0x22792c){return _0x22792c[_0xa694('0x25')](_0x4c8060)[_0xa694('0x26')](function(_0x4150d9){return _0x4150d9;});}return null;};}function removeEntity(_0x27d51f,_0x21f538){return function(_0x4f401e){if(_0x4f401e){return _0x4f401e[_0xa694('0x27')]()[_0xa694('0x26')](function(){_0x27d51f['status'](0xcc)[_0xa694('0x1a')]();});}};}function handleEntityNotFound(_0x1ee200,_0x51efc2){return function(_0x337454){if(!_0x337454){_0x1ee200[_0xa694('0x19')](0x194);}return _0x337454;};}function handleError(_0x5332a0,_0x1f1c44){_0x1f1c44=_0x1f1c44||0x1f4;return function(_0x3721b7){logger[_0xa694('0x28')](_0x3721b7[_0xa694('0x29')]);if(_0x3721b7['name']){delete _0x3721b7[_0xa694('0x2a')];}_0x5332a0[_0xa694('0x1b')](_0x1f1c44)['send'](_0x3721b7);};}exports[_0xa694('0x2b')]=function(_0x3cc967,_0x2f3331){var _0x347391={},_0x27ace6={},_0x2fa8f3={'count':0x0,'rows':[]};var _0x408f93=_[_0xa694('0x2c')](db[_0xa694('0x2d')][_0xa694('0x2e')],function(_0x2180b9){return{'name':_0x2180b9['fieldName'],'type':_0x2180b9[_0xa694('0x2f')][_0xa694('0x30')]};});_0x27ace6[_0xa694('0x31')]=_[_0xa694('0x2c')](_0x408f93,_0xa694('0x2a'));_0x27ace6['query']=_[_0xa694('0x32')](_0x3cc967[_0xa694('0x33')]);_0x27ace6[_0xa694('0x34')]=_[_0xa694('0x35')](_0x27ace6[_0xa694('0x31')],_0x27ace6[_0xa694('0x33')]);_0x347391[_0xa694('0x36')]=_[_0xa694('0x35')](_0x27ace6['model'],qs['fields'](_0x3cc967[_0xa694('0x33')][_0xa694('0x37')]));_0x347391['attributes']=_0x347391['attributes']['length']?_0x347391[_0xa694('0x36')]:_0x27ace6[_0xa694('0x31')];if(!_0x3cc967[_0xa694('0x33')][_0xa694('0x38')]('nolimit')){_0x347391[_0xa694('0x1d')]=qs[_0xa694('0x1d')](_0x3cc967[_0xa694('0x33')][_0xa694('0x1d')]);_0x347391['offset']=qs['offset'](_0x3cc967[_0xa694('0x33')]['offset']);}_0x347391['order']=qs[_0xa694('0x39')](_0x3cc967[_0xa694('0x33')][_0xa694('0x39')]);_0x347391['where']=qs[_0xa694('0x34')](_[_0xa694('0x3a')](_0x3cc967[_0xa694('0x33')],_0x27ace6[_0xa694('0x34')]),_0x408f93);if(_0x3cc967[_0xa694('0x33')][_0xa694('0x3b')]){_0x347391[_0xa694('0x3c')]=_[_0xa694('0x3d')](_0x347391[_0xa694('0x3c')],{'$or':_[_0xa694('0x2c')](_0x408f93,function(_0x347588){if(_0x347588[_0xa694('0x2f')]!==_0xa694('0x3e')){var _0x497b65={};_0x497b65[_0x347588['name']]={'$like':'%'+_0x3cc967[_0xa694('0x33')]['filter']+'%'};return _0x497b65;}})});}_0x347391=_[_0xa694('0x3d')]({},_0x347391,_0x3cc967['options']);var _0x36f13b={'where':_0x347391[_0xa694('0x3c')]};return db[_0xa694('0x2d')][_0xa694('0x1f')](_0x36f13b)[_0xa694('0x26')](function(_0x5ec545){_0x2fa8f3['count']=_0x5ec545;if(_0x3cc967[_0xa694('0x33')]['includeAll']){_0x347391[_0xa694('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa694('0x40')](_0x347391);})[_0xa694('0x26')](function(_0x3f4176){_0x2fa8f3['rows']=_0x3f4176;return _0x2fa8f3;})[_0xa694('0x26')](respondWithFilteredResult(_0x2f3331,_0x347391))[_0xa694('0x41')](handleError(_0x2f3331,null));};exports[_0xa694('0x42')]=function(_0x29e820,_0x3e956e){var _0x25400c={'raw':!![],'where':{'id':_0x29e820[_0xa694('0x43')]['id']}},_0x32d791={};_0x32d791['model']=_[_0xa694('0x32')](db[_0xa694('0x2d')]['rawAttributes']);_0x32d791[_0xa694('0x33')]=_['keys'](_0x29e820[_0xa694('0x33')]);_0x32d791[_0xa694('0x34')]=_[_0xa694('0x35')](_0x32d791[_0xa694('0x31')],_0x32d791['query']);_0x25400c[_0xa694('0x36')]=_[_0xa694('0x35')](_0x32d791[_0xa694('0x31')],qs[_0xa694('0x37')](_0x29e820[_0xa694('0x33')][_0xa694('0x37')]));_0x25400c['attributes']=_0x25400c[_0xa694('0x36')][_0xa694('0x44')]?_0x25400c[_0xa694('0x36')]:_0x32d791[_0xa694('0x31')];if(_0x29e820[_0xa694('0x33')][_0xa694('0x45')]){_0x25400c[_0xa694('0x3f')]=[{'all':!![]}];}_0x25400c=_[_0xa694('0x3d')]({},_0x25400c,_0x29e820[_0xa694('0x46')]);return db[_0xa694('0x2d')]['find'](_0x25400c)['then'](handleEntityNotFound(_0x3e956e,null))[_0xa694('0x26')](respondWithResult(_0x3e956e,null))[_0xa694('0x41')](handleError(_0x3e956e,null));};exports[_0xa694('0x47')]=function(_0x47270f,_0x592d33){return db[_0xa694('0x2d')][_0xa694('0x47')](_0x47270f[_0xa694('0x48')],{})[_0xa694('0x26')](respondWithResult(_0x592d33,0xc9))[_0xa694('0x41')](handleError(_0x592d33,null));};exports[_0xa694('0x25')]=function(_0x42079e,_0x18b272){if(_0x42079e[_0xa694('0x48')]['id']){delete _0x42079e[_0xa694('0x48')]['id'];}return db[_0xa694('0x2d')][_0xa694('0x49')]({'where':{'id':_0x42079e[_0xa694('0x43')]['id']}})[_0xa694('0x26')](handleEntityNotFound(_0x18b272,null))[_0xa694('0x26')](saveUpdates(_0x42079e[_0xa694('0x48')],null))[_0xa694('0x26')](respondWithResult(_0x18b272,null))[_0xa694('0x41')](handleError(_0x18b272,null));};exports['destroy']=function(_0xee0725,_0x5d2e26){return db['ChatTransferReport']['find']({'where':{'id':_0xee0725[_0xa694('0x43')]['id']}})[_0xa694('0x26')](handleEntityNotFound(_0x5d2e26,null))['then'](removeEntity(_0x5d2e26,null))['catch'](handleError(_0x5d2e26,null));};exports['describe']=function(_0x53a5ad,_0x596735){return db['ChatTransferReport'][_0xa694('0x4a')]()[_0xa694('0x26')](respondWithResult(_0x596735,null))['catch'](handleError(_0x596735,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3c92e6d..8d9dfa8 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 _0xfa34=['path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1213eb,_0x254d44){var _0x1cb4bb=function(_0x37c984){while(--_0x37c984){_0x1213eb['push'](_0x1213eb['shift']());}};_0x1cb4bb(++_0x254d44);}(_0xfa34,0xbe));var _0x4fa3=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xfa34[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x4fa3('0x0'));var util=require(_0x4fa3('0x1'));var logger=require(_0x4fa3('0x2'))(_0x4fa3('0x3'));var moment=require(_0x4fa3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa3('0x5'));var rimraf=require(_0x4fa3('0x6'));var config=require(_0x4fa3('0x7'));var attributes=require(_0x4fa3('0x8'));module['exports']=function(_0x3f3c08,_0x91010e){return _0x3f3c08[_0x4fa3('0x9')](_0x4fa3('0xa'),attributes,{'tableName':_0x4fa3('0xb'),'paranoid':![],'indexes':[{'name':_0x4fa3('0xc'),'fields':[_0x4fa3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38bf=['rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x211c04,_0x4f8d4f){var _0x3e9615=function(_0x2f89c1){while(--_0x2f89c1){_0x211c04['push'](_0x211c04['shift']());}};_0x3e9615(++_0x4f8d4f);}(_0x38bf,0x16e));var _0xf38b=function(_0x39ac58,_0x16eb99){_0x39ac58=_0x39ac58-0x0;var _0x359332=_0x38bf[_0x39ac58];return _0x359332;};'use strict';var _=require('lodash');var util=require(_0xf38b('0x0'));var logger=require(_0xf38b('0x1'))('api');var moment=require(_0xf38b('0x2'));var BPromise=require(_0xf38b('0x3'));var rp=require(_0xf38b('0x4'));var fs=require('fs');var path=require(_0xf38b('0x5'));var rimraf=require(_0xf38b('0x6'));var config=require('../../config/environment');var attributes=require(_0xf38b('0x7'));module[_0xf38b('0x8')]=function(_0x5afe81,_0xfff9be){return _0x5afe81['define'](_0xf38b('0x9'),attributes,{'tableName':_0xf38b('0xa'),'paranoid':![],'indexes':[{'name':_0xf38b('0xb'),'fields':[_0xf38b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b599ded..1a9bd75 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 _0xb1fb=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring'];(function(_0x3bea28,_0x42a177){var _0xfcc523=function(_0x20bea0){while(--_0x20bea0){_0x3bea28['push'](_0x3bea28['shift']());}};_0xfcc523(++_0x42a177);}(_0xb1fb,0xec));var _0xbb1f=function(_0x4d18c8,_0x43a0d1){_0x4d18c8=_0x4d18c8-0x0;var _0x4314c9=_0xb1fb[_0x4d18c8];return _0x4314c9;};'use strict';var _=require('lodash');var util=require(_0xbb1f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbb1f('0x1'));var fs=require('fs');var Redis=require(_0xbb1f('0x2'));var db=require(_0xbb1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb1f('0x4'))('rpc');var config=require(_0xbb1f('0x5'));var jayson=require(_0xbb1f('0x6'));var client=jayson[_0xbb1f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33cad5,_0x4022,_0x2cb5e8){return new BPromise(function(_0x190189,_0x4ffd16){return client['request'](_0x33cad5,_0x2cb5e8)[_0xbb1f('0x8')](function(_0x169479){logger['info'](_0xbb1f('0x9'),_0x4022,_0xbb1f('0xa'));logger['debug'](_0xbb1f('0xb'),_0x4022,_0xbb1f('0xa'),JSON[_0xbb1f('0xc')](_0x169479));if(_0x169479[_0xbb1f('0xd')]){if(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xe')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4022,_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);return _0x4ffd16(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);}logger[_0xbb1f('0xd')](_0xbb1f('0x9'),_0x4022,_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);return _0x190189(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4022,_0xbb1f('0xa'));_0x190189(_0x169479['result'][_0xbb1f('0xf')]);}})[_0xbb1f('0x10')](function(_0x1caa45){logger[_0xbb1f('0xd')](_0xbb1f('0x9'),_0x4022,_0x1caa45);_0x4ffd16(_0x1caa45);});});} \ No newline at end of file +var _0x7443=['request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x12d287,_0x1953e6){var _0xf8e217=function(_0x48d64d){while(--_0x48d64d){_0x12d287['push'](_0x12d287['shift']());}};_0xf8e217(++_0x1953e6);}(_0x7443,0x1aa));var _0x3744=function(_0x32f9ce,_0x3937be){_0x32f9ce=_0x32f9ce-0x0;var _0x3de330=_0x7443[_0x32f9ce];return _0x3de330;};'use strict';var _=require('lodash');var util=require(_0x3744('0x0'));var moment=require(_0x3744('0x1'));var BPromise=require(_0x3744('0x2'));var rs=require(_0x3744('0x3'));var fs=require('fs');var Redis=require(_0x3744('0x4'));var db=require(_0x3744('0x5'))['db'];var utils=require(_0x3744('0x6'));var logger=require(_0x3744('0x7'))(_0x3744('0x8'));var config=require(_0x3744('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3744('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0c77,_0x4d553a,_0x30739e){return new BPromise(function(_0x28ab15,_0x2fe67f){return client[_0x3744('0xb')](_0x2a0c77,_0x30739e)[_0x3744('0xc')](function(_0x3cc9c7){logger['info'](_0x3744('0xd'),_0x4d553a,'request\x20sent');logger[_0x3744('0xe')](_0x3744('0xf'),_0x4d553a,_0x3744('0x10'),JSON[_0x3744('0x11')](_0x3cc9c7));if(_0x3cc9c7[_0x3744('0x12')]){if(_0x3cc9c7[_0x3744('0x12')]['code']===0x1f4){logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x3cc9c7[_0x3744('0x12')][_0x3744('0x13')]);return _0x2fe67f(_0x3cc9c7[_0x3744('0x12')]['message']);}logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x3cc9c7[_0x3744('0x12')]['message']);return _0x28ab15(_0x3cc9c7[_0x3744('0x12')][_0x3744('0x13')]);}else{logger[_0x3744('0x14')](_0x3744('0xd'),_0x4d553a,'request\x20sent');_0x28ab15(_0x3cc9c7[_0x3744('0x15')][_0x3744('0x13')]);}})[_0x3744('0x16')](function(_0x55d05b){logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x55d05b);_0x2fe67f(_0x55d05b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1c4c127..dafe12a 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 _0x9d64=['./chatTransferReport.controller','isAuthenticated','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d64,0x122));var _0x49d6=function(_0x4a3d63,_0x5cbed5){_0x4a3d63=_0x4a3d63-0x0;var _0x8cbc66=_0x9d64[_0x4a3d63];return _0x8cbc66;};'use strict';var multer=require(_0x49d6('0x0'));var util=require(_0x49d6('0x1'));var path=require(_0x49d6('0x2'));var timeout=require(_0x49d6('0x3'));var express=require(_0x49d6('0x4'));var router=express[_0x49d6('0x5')]();var fs_extra=require(_0x49d6('0x6'));var auth=require(_0x49d6('0x7'));var interaction=require(_0x49d6('0x8'));var config=require(_0x49d6('0x9'));var controller=require(_0x49d6('0xa'));router['get']('/',auth[_0x49d6('0xb')](),controller['index']);router[_0x49d6('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x49d6('0xc')](_0x49d6('0xd'),auth['isAuthenticated'](),controller[_0x49d6('0xe')]);router[_0x49d6('0xf')]('/',auth['isAuthenticated'](),controller[_0x49d6('0x10')]);router['put'](_0x49d6('0xd'),auth[_0x49d6('0xb')](),controller['update']);router[_0x49d6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x49d6('0x12')]);module[_0x49d6('0x13')]=router; \ No newline at end of file +var _0xa412=['isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x42b1ee,_0x443833){var _0x10c32e=function(_0x16f173){while(--_0x16f173){_0x42b1ee['push'](_0x42b1ee['shift']());}};_0x10c32e(++_0x443833);}(_0xa412,0x127));var _0x2a41=function(_0x2b6196,_0x15cc27){_0x2b6196=_0x2b6196-0x0;var _0x403e56=_0xa412[_0x2b6196];return _0x403e56;};'use strict';var multer=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var path=require(_0x2a41('0x2'));var timeout=require(_0x2a41('0x3'));var express=require(_0x2a41('0x4'));var router=express['Router']();var fs_extra=require(_0x2a41('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a41('0x6'));var config=require(_0x2a41('0x7'));var controller=require('./chatTransferReport.controller');router[_0x2a41('0x8')]('/',auth[_0x2a41('0x9')](),controller['index']);router[_0x2a41('0x8')](_0x2a41('0xa'),auth[_0x2a41('0x9')](),controller['describe']);router[_0x2a41('0x8')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller[_0x2a41('0xc')]);router[_0x2a41('0xd')]('/',auth[_0x2a41('0x9')](),controller[_0x2a41('0xe')]);router[_0x2a41('0xf')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller['update']);router[_0x2a41('0x10')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller[_0x2a41('0x11')]);module[_0x2a41('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b34e31c..b7b43ea 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 _0x8032=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input','name','text','email','parse','getDataValue','setDataValue','onlineForm','stringify','textarea'];(function(_0x516387,_0x133120){var _0x181646=function(_0x2e4297){while(--_0x2e4297){_0x516387['push'](_0x516387['shift']());}};_0x181646(++_0x133120);}(_0x8032,0x163));var _0x2803=function(_0x26dd96,_0x1e70a6){_0x26dd96=_0x26dd96-0x0;var _0x1aa18f=_0x8032[_0x26dd96];return _0x1aa18f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2803('0x0'));module[_0x2803('0x1')]={'name':{'type':Sequelize[_0x2803('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'unique':_0x2803('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x2803('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x4')},'customerAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2803('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2803('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x2803('0x8')),'defaultValue':_0x2803('0x9')},'header_online':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xa')},'start_chat_button':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xb')},'offline_chat_button':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'header_offline':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2803('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2803('0xf')]},'closingQuestion':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x12')},'noteTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x13')},'placeholderMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x14')},'closingMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x15')},'closingMessageButton':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'skipMessageButton':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x16')},'conditionAgreement':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x17')},'ratingType':{'type':Sequelize[_0x2803('0x18')](_0x2803('0x19'),_0x2803('0x1a')),'defaultValue':_0x2803('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2803('0x1b'),'variable':null,'config':{'placeholder':_0x2803('0x1c'),'type':_0x2803('0x1d'),'required':!![]},'props':{'title':_0x2803('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2803('0x1e')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x2803('0x1f')](this[_0x2803('0x20')]('onlineForm')):{};},'set':function(_0x507363){return this[_0x2803('0x21')](_0x2803('0x22'),JSON[_0x2803('0x23')](_0x507363));}},'offlineForm':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return JSON[_0x2803('0x23')]({'items':[{'type':'input','props':{'title':_0x2803('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2803('0x1e')},'variable':null},{'type':_0x2803('0x24'),'config':{'placeholder':_0x2803('0x25')},'props':{'title':_0x2803('0x25'),'helpText':_0x2803('0x26')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x2803('0x27'))?JSON[_0x2803('0x1f')](this[_0x2803('0x20')](_0x2803('0x27'))):{};},'set':function(_0x563db1){return this[_0x2803('0x21')](_0x2803('0x27'),JSON[_0x2803('0x23')](_0x563db1));}},'token':{'type':Sequelize[_0x2803('0x2')],'defaultValue':function(){return rs[_0x2803('0x28')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2803('0x2')]},'forwardOffline':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2803('0x2')]},'waitingTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x29')},'waitingMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x2a')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2b')},'offlineMessageBody':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x2c')},'enableUnmanagedNote':{'type':Sequelize[_0x2803('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return _0x2803('0x2d');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2f')},'verticalAlignment':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x2803('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2803('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x31')},'systemAvatar':{'type':Sequelize[_0x2803('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2803('0x7')],'comment':_0x2803('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![],'comment':_0x2803('0x33'),'set':function(_0x239011){if(!_0x239011)this[_0x2803('0x21')](_0x2803('0x34'),null);this[_0x2803('0x21')](_0x2803('0x35'),_0x239011);}},'vidaooEscalation':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2803('0x2')]},'vidaooTopic':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x36')},'vidaooNote':{'type':Sequelize[_0x2803('0x2')],'defaultValue':function(){return _0x2803('0x37');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2803('0xf')]}}; \ No newline at end of file +var _0xca3e=['#011F6A','#ffffff','INTEGER','rounded','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xca3e,0x1a0));var _0xeca3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xca3e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xeca3('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeca3('0x2')},'description':{'type':Sequelize[_0xeca3('0x1')]},'mapKey':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x3')},'key':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':_0xeca3('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeca3('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xeca3('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0xeca3('0x7')},'header_online':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'header_offline':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x9')},'download_transcript':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xb')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xeca3('0xc')]},'closingQuestion':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xd')},'noteTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0xe')},'closingMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xf')},'closingMessageButton':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0x10')},'conditionAgreement':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xeca3('0x11')](_0xeca3('0x12'),_0xeca3('0x13')),'defaultValue':_0xeca3('0x12')},'ratingStarsNumber':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xeca3('0xc')],'defaultValue':function(){return JSON[_0xeca3('0x14')]({'items':[{'type':_0xeca3('0x15'),'variable':null,'config':{'placeholder':_0xeca3('0x16'),'type':_0xeca3('0x17'),'required':!![]},'props':{'title':_0xeca3('0x16'),'helpText':''}},{'type':'input','props':{'title':_0xeca3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xeca3('0x18')](_0xeca3('0x19'))?JSON[_0xeca3('0x1a')](this[_0xeca3('0x18')](_0xeca3('0x19'))):{};},'set':function(_0x37b42b){return this['setDataValue']('onlineForm',JSON['stringify'](_0x37b42b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xeca3('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xeca3('0x3')},'variable':null},{'type':_0xeca3('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0xeca3('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xeca3('0x18')](_0xeca3('0x1d'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x218bea){return this['setDataValue'](_0xeca3('0x1d'),JSON[_0xeca3('0x14')](_0x218bea));}},'token':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':function(){return rs[_0xeca3('0x1e')]();}},'autoclose':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xeca3('0x1')]},'forwardOffline':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xeca3('0x1')]},'waitingTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x1f')},'waitingMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x21')},'offlineMessageBody':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x22')},'skipUnmanaged':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x10')},'sendUnmanaged':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'enableCustomerAttachment':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xeca3('0xc')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xeca3('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xeca3('0x23');}},'notificationSound':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x24')},'verticalAlignment':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x25')},'defaultTitle':{'type':Sequelize[_0xeca3('0x1')]},'customerAvatar':{'type':Sequelize[_0xeca3('0xc')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0x26')},'systemAvatar':{'type':Sequelize[_0xeca3('0xc')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeca3('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![],'comment':_0xeca3('0x27'),'set':function(_0x53077e){if(!_0x53077e)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xeca3('0x28')]('mandatoryDisposition',_0x53077e);}},'vidaooEscalation':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xeca3('0x1')]},'vidaooTopic':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':function(){return _0xeca3('0x29');}},'vidaooMetadata':{'type':Sequelize[_0xeca3('0xc')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xeca3('0xc')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ce07d77..40961e5 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 _0xb138=['getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','chat','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','notify','offline','Sequelize','no\x20available\x20attributes','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','ValidationError','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Smtp','user','MailAccountId','mimetype','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','interval','getProactiveActions','virtual','License','ifTime','readFileSync','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textButtonColor','color_button','READ_COMMITTED','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','Pause','find','create','address','split','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar'];(function(_0x64b2e1,_0x4b12fe){var _0x1ca8cd=function(_0x38992b){while(--_0x38992b){_0x64b2e1['push'](_0x64b2e1['shift']());}};_0x1ca8cd(++_0x4b12fe);}(_0xb138,0x1dd));var _0x8b13=function(_0x3df38b,_0x46223e){_0x3df38b=_0x3df38b-0x0;var _0x5e5e22=_0xb138[_0x3df38b];return _0x5e5e22;};'use strict';var Mustache=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var ejs=require(_0x8b13('0x3'));var fs=require('fs');var fs_extra=require(_0x8b13('0x4'));var _=require(_0x8b13('0x5'));var querystring=require(_0x8b13('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x8b13('0x7'));var jayson=require(_0x8b13('0x8'));var qs=require(_0x8b13('0x9'));var logger=require('../../config/logger')(_0x8b13('0xa'));var config=require(_0x8b13('0xb'));var APIBadRequestError=require('../../errors/api')[_0x8b13('0xc')];var APINotFoundError=require(_0x8b13('0xd'))[_0x8b13('0xe')];var APIOutOfIntervalError=require('../../errors/api')[_0x8b13('0xf')];var APIHandleError=require(_0x8b13('0xd'))['handleError'];var APIConflictError=require('../../errors/api')[_0x8b13('0x10')];var wildcardUtils=require(_0x8b13('0x11'));var URL=require(_0x8b13('0x12'))[_0x8b13('0x13')];var db=require(_0x8b13('0x14'))['db'];config['redis']=_[_0x8b13('0x15')](config[_0x8b13('0x16')],{'host':_0x8b13('0x17'),'port':0x18eb});var socket=require(_0x8b13('0x18'))(new Redis(config[_0x8b13('0x16')]));require(_0x8b13('0x19'))['register'](socket);var client=jayson['client'][_0x8b13('0x1a')]({'port':0x232c});var client9002=jayson[_0x8b13('0x1b')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x8b13('0x1b')][_0x8b13('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0xf29086,_0x2c615a,_0x13f956,_0x542357){return new Promise(function(_0x1c6c99,_0xea7881){var _0x393bc1=_0x542357||client;return _0x393bc1[_0x8b13('0x1c')](_0xf29086,_0x13f956)[_0x8b13('0x1d')](function(_0x1fcfe6){logger[_0x8b13('0x1e')](_0x8b13('0x1f'),_0x2c615a,'request\x20sent');logger['debug'](_0x8b13('0x20'),_0x2c615a,_0x8b13('0x21'),JSON[_0x8b13('0x22')](_0x1fcfe6));if(_0x1fcfe6[_0x8b13('0x23')]){if(_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x24')]===0x1f4){logger['error'](_0x8b13('0x1f'),_0x2c615a,_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x25')]);return _0xea7881(_0x1fcfe6['error']['message']);}logger[_0x8b13('0x23')](_0x8b13('0x1f'),_0x2c615a,_0x1fcfe6['error'][_0x8b13('0x25')]);return _0x1c6c99(_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x25')]);}else{logger[_0x8b13('0x1e')](_0x8b13('0x1f'),_0x2c615a,'request\x20sent');_0x1c6c99(_0x1fcfe6[_0x8b13('0x26')][_0x8b13('0x25')]);}})['catch'](function(_0x33422f){logger['error'](_0x8b13('0x1f'),_0x2c615a,_0x33422f);_0xea7881(_0x33422f);});});}function respondWithStatusCode(_0x325d68,_0x54786a){_0x54786a=_0x54786a||0xcc;return function(_0x3f1756){if(_0x3f1756){return _0x325d68[_0x8b13('0x27')](_0x54786a);}return _0x325d68['status'](_0x54786a)[_0x8b13('0x28')]();};}function respondWithResult(_0x14a739,_0x410122){_0x410122=_0x410122||0xc8;return function(_0x4048e4){if(_0x4048e4){return _0x14a739[_0x8b13('0x29')](_0x410122)['json'](_0x4048e4);}};}function respondWithFilteredResult(_0x6023f5,_0x1b09e2){return function(_0x3475d8){if(_0x3475d8){var _0x1511bf=typeof _0x1b09e2[_0x8b13('0x2a')]===_0x8b13('0x2b')&&typeof _0x1b09e2['limit']===_0x8b13('0x2b');var _0xfec033=_0x3475d8[_0x8b13('0x2c')];var _0x9d2377=_0x1511bf?0x0:_0x1b09e2[_0x8b13('0x2a')];var _0x29946e=_0x1511bf?_0x3475d8[_0x8b13('0x2c')]:_0x1b09e2[_0x8b13('0x2a')]+_0x1b09e2[_0x8b13('0x2d')];var _0x5751db;if(_0x29946e>=_0xfec033){_0x29946e=_0xfec033;_0x5751db=0xc8;}else{_0x5751db=0xce;}_0x6023f5[_0x8b13('0x29')](_0x5751db);return _0x6023f5[_0x8b13('0x2e')](_0x8b13('0x2f'),_0x9d2377+'-'+_0x29946e+'/'+_0xfec033)[_0x8b13('0x30')](_0x3475d8);}return null;};}function saveUpdates(_0x51a334){return function(_0x4f7d91){if(_0x4f7d91){return _0x4f7d91[_0x8b13('0x31')](_0x51a334)['then'](function(_0x5663fa){return _0x5663fa;});}return null;};}function removeEntity(_0x3b1dfa){return function(_0x535521){if(_0x535521){return _0x535521[_0x8b13('0x32')]()[_0x8b13('0x1d')](function(){var _0x40fc29=_0x535521[_0x8b13('0x33')]({'plain':!![]});var _0x11657e=_0x8b13('0x34');return db[_0x8b13('0x35')][_0x8b13('0x32')]({'where':{'type':_0x11657e,'resourceId':_0x40fc29['id']}})[_0x8b13('0x1d')](function(){return _0x535521;});})[_0x8b13('0x1d')](function(){_0x3b1dfa['status'](0xcc)[_0x8b13('0x28')]();});}};}function handleEntityNotFound(_0x31f5bd){return function(_0x19b21c){if(!_0x19b21c){_0x31f5bd[_0x8b13('0x27')](0x194);}return _0x19b21c;};}function handleError(_0x1ff25c,_0x24179a){_0x24179a=_0x24179a||0x1f4;return function(_0x6b4645){logger[_0x8b13('0x23')](_0x6b4645['stack']);if(_0x6b4645[_0x8b13('0x36')]){delete _0x6b4645['name'];}_0x1ff25c[_0x8b13('0x29')](_0x24179a)[_0x8b13('0x37')](_0x6b4645);};}function createInteractionObject(_0x2a8f6b,_0x5e63f6,_0x2bf1b0,_0x327eb1){var _0x4ec1a5=require('user-agent-parser');var _0xe6963d=new _0x4ec1a5();var _0x5daee9=_0xe6963d[_0x8b13('0x38')](_0x2bf1b0['user-agent'])[_0x8b13('0x39')]();var _0x3a8e06=_0x5e63f6[_0x8b13('0x3a')];if(_0x2bf1b0[_0x8b13('0x3b')]){_0x3a8e06=_0x2bf1b0[_0x8b13('0x3b')];}else if(_0x2bf1b0['x-forwarded-for']){_0x3a8e06=_['first'](_0x2bf1b0[_0x8b13('0x3c')]['split'](','));}return{'ContactId':_0x327eb1['id'],'ChatWebsiteId':_0x2a8f6b,'from':(_0x327eb1[_0x8b13('0x3d')]||'')+'\x20'+(_0x327eb1[_0x8b13('0x3e')]||''),'customerIp':_0x3a8e06,'customerPort':_0x2bf1b0['x-real-port']?_0x2bf1b0[_0x8b13('0x3f')]:null,'referer':_0x5e63f6[_0x8b13('0x40')],'browserName':_0x5daee9[_0x8b13('0x41')][_0x8b13('0x36')]&&_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]?util[_0x8b13('0x43')]('%s\x20%s',_0x5daee9['browser']['name'],_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]):_0x8b13('0x44'),'browserVersion':_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]||_0x8b13('0x44'),'osName':util['format'](_0x8b13('0x45'),_0x5daee9['os']['name'],_0x5daee9['os'][_0x8b13('0x42')]),'osVersion':_0x5daee9['os']['version'],'deviceModel':_0x5daee9[_0x8b13('0x46')][_0x8b13('0x47')]&&_0x5daee9[_0x8b13('0x46')][_0x8b13('0x48')]?util[_0x8b13('0x43')](_0x8b13('0x49'),_0x5daee9[_0x8b13('0x46')]['model'],_0x5daee9['device']['vendor'],_0x5daee9[_0x8b13('0x46')][_0x8b13('0x4a')]):null,'deviceVendor':_0x5daee9[_0x8b13('0x46')][_0x8b13('0x48')],'deviceType':_0x5daee9['device']['type'],'formData':JSON[_0x8b13('0x22')](_0x5e63f6)};}exports['index']=function(_0x24262a,_0x10928d){var _0x20c363={'include':[{'model':db['Pause'],'as':_0x8b13('0x4b')}]},_0x28ae75={},_0x46556f={'count':0x0,'rows':[]};var _0x2044fc=_[_0x8b13('0x4c')](db[_0x8b13('0x4d')][_0x8b13('0x4e')],function(_0x2619df){return{'name':_0x2619df[_0x8b13('0x4f')],'type':_0x2619df[_0x8b13('0x4a')][_0x8b13('0x50')]};});_0x28ae75['model']=_[_0x8b13('0x4c')](_0x2044fc,'name');_0x28ae75[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x24262a[_0x8b13('0x51')]);_0x28ae75['filters']=_[_0x8b13('0x53')](_0x28ae75[_0x8b13('0x47')],_0x28ae75[_0x8b13('0x51')]);_0x20c363[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x28ae75[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x24262a['query'][_0x8b13('0x55')]));_0x20c363['attributes']=_0x20c363[_0x8b13('0x54')][_0x8b13('0x56')]?_0x20c363[_0x8b13('0x54')]:_0x28ae75[_0x8b13('0x47')];if(!_0x24262a[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x20c363[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x24262a[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x20c363[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x24262a[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0x20c363[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x24262a['query'][_0x8b13('0x5a')]);_0x20c363[_0x8b13('0x5b')]=qs['filters'](_[_0x8b13('0x5c')](_0x24262a[_0x8b13('0x51')],_0x28ae75[_0x8b13('0x5d')]),_0x2044fc);if(_0x24262a[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x20c363[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x20c363[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x2044fc,function(_0x1ff311){if(_0x1ff311[_0x8b13('0x4a')]!==_0x8b13('0x60')){var _0x137e8c={};_0x137e8c[_0x1ff311[_0x8b13('0x36')]]={'$like':'%'+_0x24262a[_0x8b13('0x51')]['filter']+'%'};return _0x137e8c;}})});}_0x20c363=_[_0x8b13('0x5f')]({},_0x20c363,_0x24262a[_0x8b13('0x61')]);var _0x47a3fa={'where':_0x20c363[_0x8b13('0x5b')]};return db[_0x8b13('0x4d')][_0x8b13('0x2c')](_0x47a3fa)[_0x8b13('0x1d')](function(_0x1263f4){_0x46556f['count']=_0x1263f4;if(_0x24262a[_0x8b13('0x51')][_0x8b13('0x62')]){_0x20c363[_0x8b13('0x63')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8b13('0x64')](_0x20c363);})[_0x8b13('0x1d')](function(_0x585392){_0x46556f[_0x8b13('0x65')]=_0x585392;return _0x46556f;})[_0x8b13('0x1d')](respondWithFilteredResult(_0x10928d,_0x20c363))[_0x8b13('0x66')](handleError(_0x10928d,null));};exports[_0x8b13('0x67')]=function(_0x49e5cd,_0x13c8bd){var _0x28d568={'raw':![],'where':{'id':_0x49e5cd[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0x69')],'as':_0x8b13('0x4b')}]},_0x52e705={};_0x52e705[_0x8b13('0x47')]=_['keys'](db[_0x8b13('0x4d')][_0x8b13('0x4e')]);_0x52e705[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x49e5cd[_0x8b13('0x51')]);_0x52e705[_0x8b13('0x5d')]=_['intersection'](_0x52e705[_0x8b13('0x47')],_0x52e705[_0x8b13('0x51')]);_0x28d568[_0x8b13('0x54')]=_['intersection'](_0x52e705[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x49e5cd[_0x8b13('0x51')][_0x8b13('0x55')]));_0x28d568['attributes']=_0x28d568['attributes']['length']?_0x28d568['attributes']:_0x52e705['model'];if(_0x49e5cd[_0x8b13('0x51')][_0x8b13('0x62')]){_0x28d568['include']=[{'all':!![]}];}_0x28d568=_[_0x8b13('0x5f')]({},_0x28d568,_0x49e5cd['options']);return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x28d568)[_0x8b13('0x1d')](handleEntityNotFound(_0x13c8bd,null))[_0x8b13('0x1d')](respondWithResult(_0x13c8bd,null))[_0x8b13('0x66')](handleError(_0x13c8bd,null));};exports[_0x8b13('0x6b')]=function(_0xa7c7d5,_0x4c433c){var _0xe7e8eb=null;_0xa7c7d5['body'][_0x8b13('0x6c')][_0x8b13('0x6d')](',')[_0x8b13('0x6e')](_0x11a4ba=>{if(_0x11a4ba[_0x8b13('0x6f')]()!==''&&!wildcardUtils[_0x8b13('0x70')](_0x11a4ba[_0x8b13('0x6f')]())){_0xe7e8eb=new APIBadRequestError('\x22'+_0x11a4ba['trim']()+_0x8b13('0x71'));}});if(_0xe7e8eb){return handleError(_0x4c433c,null)(_0xe7e8eb);}return db['ChatWebsite'][_0x8b13('0x6b')](_0xa7c7d5[_0x8b13('0x72')],{})[_0x8b13('0x1d')](function(_0x177f73){var _0x177a64=_0xa7c7d5['user']['get']({'plain':!![]});if(!_0x177a64)throw new Error(_0x8b13('0x73'));if(_0x177a64[_0x8b13('0x74')]==='user'){var _0x180866=_0x177f73[_0x8b13('0x33')]({'plain':!![]});var _0x670b3e='ChatWebsites';return db[_0x8b13('0x75')][_0x8b13('0x6a')]({'where':{'name':_0x670b3e,'userProfileId':_0x177a64[_0x8b13('0x76')]},'raw':!![]})[_0x8b13('0x1d')](function(_0x52850c){if(_0x52850c&&_0x52850c[_0x8b13('0x77')]===0x0){return db[_0x8b13('0x35')]['create']({'name':_0x180866[_0x8b13('0x36')],'resourceId':_0x180866['id'],'type':_0x52850c[_0x8b13('0x36')],'sectionId':_0x52850c['id']},{})[_0x8b13('0x1d')](function(){return _0x177f73;});}else{return _0x177f73;}})[_0x8b13('0x66')](function(_0x45fe23){logger[_0x8b13('0x23')](_0x8b13('0x78'),_0x45fe23);throw _0x45fe23;});}return _0x177f73;})[_0x8b13('0x1d')](respondWithResult(_0x4c433c,0xc9))[_0x8b13('0x66')](handleError(_0x4c433c,null));};exports[_0x8b13('0x31')]=function(_0x2f2bc5,_0x46c25c){var _0x26b888=null;_0x2f2bc5[_0x8b13('0x72')]['address'][_0x8b13('0x6d')](',')['forEach'](_0x14dee4=>{if(_0x14dee4[_0x8b13('0x6f')]()!==''&&!wildcardUtils[_0x8b13('0x70')](_0x14dee4[_0x8b13('0x6f')]())){_0x26b888=new APIBadRequestError('\x22'+_0x14dee4['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x26b888){return handleError(_0x46c25c,null)(_0x26b888);}if(_0x2f2bc5[_0x8b13('0x72')]['id']){delete _0x2f2bc5[_0x8b13('0x72')]['id'];}return db['ChatWebsite'][_0x8b13('0x6a')]({'where':{'id':_0x2f2bc5[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0x69')],'as':_0x8b13('0x4b')}]})[_0x8b13('0x1d')](handleEntityNotFound(_0x46c25c,null))[_0x8b13('0x1d')](saveUpdates(_0x2f2bc5[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x46c25c,null))[_0x8b13('0x66')](handleError(_0x46c25c,null));};exports[_0x8b13('0x32')]=function(_0x48fd36,_0x2a1fd3){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x48fd36[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x2a1fd3,null))['then'](removeEntity(_0x2a1fd3,null))[_0x8b13('0x66')](handleError(_0x2a1fd3,null));};exports[_0x8b13('0x79')]=function(_0x1f77b1,_0x1dce78){return db[_0x8b13('0x4d')][_0x8b13('0x79')]()[_0x8b13('0x1d')](respondWithResult(_0x1dce78,null))[_0x8b13('0x66')](handleError(_0x1dce78,null));};exports['addDisposition']=function(_0x2642b1,_0x213b43){if(_0x2642b1[_0x8b13('0x72')]['id']){delete _0x2642b1['body']['id'];}return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x2642b1[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x213b43,null))[_0x8b13('0x1d')](function(_0x40fefa){if(_0x40fefa){_0x2642b1[_0x8b13('0x72')][_0x8b13('0x7a')]=_0x40fefa['id'];return db[_0x8b13('0x7b')][_0x8b13('0x6b')](_0x2642b1[_0x8b13('0x72')]);}})[_0x8b13('0x1d')](respondWithResult(_0x213b43,null))['catch'](handleError(_0x213b43,null));};exports[_0x8b13('0x7c')]=function(_0x111a4f,_0x235b61){var _0xc76c8b={'raw':![],'where':{}};var _0x15f169={};var _0x120a71={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x111a4f[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x235b61,null))[_0x8b13('0x1d')](function(_0x1819fb){if(_0x1819fb){_0x15f169[_0x8b13('0x47')]=_['keys'](db['Disposition'][_0x8b13('0x4e')]);_0x15f169['query']=_[_0x8b13('0x52')](_0x111a4f[_0x8b13('0x51')]);_0x15f169['filters']=_['intersection'](_0x15f169[_0x8b13('0x47')],_0x15f169[_0x8b13('0x51')]);_0xc76c8b[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x15f169[_0x8b13('0x47')],qs['fields'](_0x111a4f[_0x8b13('0x51')]['fields']));_0xc76c8b[_0x8b13('0x54')]=_0xc76c8b[_0x8b13('0x54')]['length']?_0xc76c8b[_0x8b13('0x54')]:_0x15f169[_0x8b13('0x47')];if(!_0x111a4f[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0xc76c8b['limit']=qs[_0x8b13('0x2d')](_0x111a4f[_0x8b13('0x51')][_0x8b13('0x2d')]);_0xc76c8b['offset']=qs[_0x8b13('0x2a')](_0x111a4f['query'][_0x8b13('0x2a')]);}_0xc76c8b[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5a')]);_0xc76c8b[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x111a4f[_0x8b13('0x51')],_0x15f169[_0x8b13('0x5d')]));_0xc76c8b['where'][_0x8b13('0x7a')]=_0x1819fb['id'];if(_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5e')]){_0xc76c8b[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0xc76c8b['where'],{'$or':_[_0x8b13('0x4c')](_0xc76c8b[_0x8b13('0x54')],function(_0x350441){var _0x10bf1a={};_0x10bf1a[_0x350441]={'$like':'%'+_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x10bf1a;})});}_0xc76c8b=_['merge']({},_0xc76c8b,_0x111a4f[_0x8b13('0x61')]);return db[_0x8b13('0x7b')]['count']({'where':_0xc76c8b[_0x8b13('0x5b')]})['then'](function(_0x1e85eb){_0x120a71['count']=_0x1e85eb;if(_0x111a4f[_0x8b13('0x51')][_0x8b13('0x62')]){_0xc76c8b[_0x8b13('0x63')]=[{'all':!![]}];}return db[_0x8b13('0x7b')][_0x8b13('0x64')](_0xc76c8b);})[_0x8b13('0x1d')](function(_0x165813){_0x120a71[_0x8b13('0x65')]=_0x165813;return _0x120a71;});}})['then'](respondWithFilteredResult(_0x235b61,_0xc76c8b))[_0x8b13('0x66')](handleError(_0x235b61,null));};exports[_0x8b13('0x7e')]=function(_0x5f190a,_0x35c94d){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x5f190a[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x35c94d,null))[_0x8b13('0x1d')](function(_0x42de53){if(_0x42de53){return _0x42de53[_0x8b13('0x7e')](_0x5f190a['query']['ids']);}})[_0x8b13('0x1d')](respondWithStatusCode(_0x35c94d,null))[_0x8b13('0x66')](handleError(_0x35c94d,null));};exports[_0x8b13('0x7f')]=function(_0x36f3af,_0xcafeff){if(_0x36f3af[_0x8b13('0x72')]['id']){delete _0x36f3af[_0x8b13('0x72')]['id'];}return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x36f3af[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0xcafeff,null))[_0x8b13('0x1d')](function(_0xf19be7){if(_0xf19be7){_0x36f3af[_0x8b13('0x72')][_0x8b13('0x7a')]=_0xf19be7['id'];return db[_0x8b13('0x80')]['create'](_0x36f3af[_0x8b13('0x72')]);}})['then'](respondWithResult(_0xcafeff,null))[_0x8b13('0x66')](handleError(_0xcafeff,null));};exports[_0x8b13('0x81')]=function(_0xeb3c0f,_0x394932){var _0x148dde={'raw':![],'where':{}};var _0x402c92={};var _0x7e200e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8b13('0x7d')]({'where':{'id':_0xeb3c0f['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x394932,null))[_0x8b13('0x1d')](function(_0x4db508){if(_0x4db508){_0x402c92['model']=_[_0x8b13('0x52')](db[_0x8b13('0x80')][_0x8b13('0x4e')]);_0x402c92[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0xeb3c0f[_0x8b13('0x51')]);_0x402c92['filters']=_[_0x8b13('0x53')](_0x402c92[_0x8b13('0x47')],_0x402c92['query']);_0x148dde['attributes']=_['intersection'](_0x402c92[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x55')]));_0x148dde[_0x8b13('0x54')]=_0x148dde[_0x8b13('0x54')][_0x8b13('0x56')]?_0x148dde[_0x8b13('0x54')]:_0x402c92['model'];if(!_0xeb3c0f[_0x8b13('0x51')]['hasOwnProperty'](_0x8b13('0x58'))){_0x148dde['limit']=qs[_0x8b13('0x2d')](_0xeb3c0f[_0x8b13('0x51')]['limit']);_0x148dde[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0x148dde[_0x8b13('0x59')]=qs['sort'](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x5a')]);_0x148dde[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_['pick'](_0xeb3c0f[_0x8b13('0x51')],_0x402c92['filters']));_0x148dde[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x4db508['id'];if(_0xeb3c0f[_0x8b13('0x51')]['filter']){_0x148dde['where']=_['merge'](_0x148dde['where'],{'$or':_[_0x8b13('0x4c')](_0x148dde['attributes'],function(_0x390acb){var _0x4a32ea={};_0x4a32ea[_0x390acb]={'$like':'%'+_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x4a32ea;})});}_0x148dde=_[_0x8b13('0x5f')]({},_0x148dde,_0xeb3c0f[_0x8b13('0x61')]);return db[_0x8b13('0x80')][_0x8b13('0x2c')]({'where':_0x148dde[_0x8b13('0x5b')]})[_0x8b13('0x1d')](function(_0x2a5ed3){_0x7e200e[_0x8b13('0x2c')]=_0x2a5ed3;if(_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x62')]){_0x148dde[_0x8b13('0x63')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8b13('0x64')](_0x148dde);})['then'](function(_0x592d90){_0x7e200e['rows']=_0x592d90;return _0x7e200e;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x394932,_0x148dde))[_0x8b13('0x66')](handleError(_0x394932,null));};exports[_0x8b13('0x82')]=function(_0x9f7c7c,_0x58545c){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x9f7c7c[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x58545c,null))['then'](function(_0x218f95){if(_0x218f95){return _0x218f95[_0x8b13('0x82')](_0x9f7c7c[_0x8b13('0x51')]['ids']);}})[_0x8b13('0x1d')](respondWithStatusCode(_0x58545c,null))[_0x8b13('0x66')](handleError(_0x58545c,null));};exports[_0x8b13('0x83')]=function(_0xf629c6,_0x3f2ac6){_0xf629c6[_0x8b13('0x72')][_0x8b13('0x84')]=_0xf629c6[_0x8b13('0x85')][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0xf629c6[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x3f2ac6,null))[_0x8b13('0x1d')](saveUpdates(_0xf629c6[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x3f2ac6,null))['catch'](handleError(_0x3f2ac6,null));};exports[_0x8b13('0x87')]=function(_0x386b00,_0x350c62){_0x386b00['body'][_0x8b13('0x88')]=_0x386b00['file'][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x386b00['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x350c62,null))[_0x8b13('0x1d')](saveUpdates(_0x386b00[_0x8b13('0x72')],null))['then'](respondWithResult(_0x350c62,null))[_0x8b13('0x66')](handleError(_0x350c62,null));};exports[_0x8b13('0x89')]=function(_0x56d3e5,_0x1d8a81){_0x56d3e5[_0x8b13('0x72')][_0x8b13('0x8a')]=_0x56d3e5[_0x8b13('0x85')]['filename'];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x56d3e5[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x1d8a81,null))[_0x8b13('0x1d')](saveUpdates(_0x56d3e5[_0x8b13('0x72')],null))['then'](respondWithResult(_0x1d8a81,null))[_0x8b13('0x66')](handleError(_0x1d8a81,null));};exports['addSystemAvatar']=function(_0x2e3023,_0x178d6b){_0x2e3023['body']['systemAvatar']=_0x2e3023[_0x8b13('0x85')][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x2e3023[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x178d6b,null))[_0x8b13('0x1d')](saveUpdates(_0x2e3023[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x178d6b,null))[_0x8b13('0x66')](handleError(_0x178d6b,null));};exports[_0x8b13('0x8b')]=function(_0x49f5f7,_0x305103){var _0x2c2f68=path['join'](config[_0x8b13('0x8c')],'server/files/images/logos/default_logo.svg');var _0x1a9b61={'where':{'id':_0x49f5f7[_0x8b13('0x68')]['id']},'attributes':['id',_0x8b13('0x84')],'raw':!![]};var _0x59ed6e=![];return require(_0x8b13('0x8d'))[_0x8b13('0x8e')]()[_0x8b13('0x1d')](function(_0x3e0cf8){if(_0x3e0cf8){_0x59ed6e=_0x3e0cf8[_0x8b13('0x8f')];}})['then'](function(){return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x1a9b61);})[_0x8b13('0x1d')](handleEntityNotFound(_0x305103,null))[_0x8b13('0x1d')](function(_0xfe9601){if(_0xfe9601){if(!_[_0x8b13('0x90')](_0xfe9601['sitepic'])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x93'),_0xfe9601['sitepic']))&&_0x59ed6e){_0x2c2f68=path[_0x8b13('0x92')](config['root'],'server/files/images/logos/',_0xfe9601[_0x8b13('0x84')]);}}return _0x305103[_0x8b13('0x94')](_0x2c2f68);}})['catch'](handleError(_0x305103,null));};exports[_0x8b13('0x95')]=function(_0x4bb94f,_0x38cbc5){var _0x5ac718=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x96'));var _0x4049ae={'where':{'id':_0x4bb94f[_0x8b13('0x68')]['id']},'attributes':['id',_0x8b13('0x88')],'raw':!![]};return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x4049ae)[_0x8b13('0x1d')](handleEntityNotFound(_0x38cbc5,null))['then'](function(_0x146e07){if(_0x146e07){if(!_[_0x8b13('0x90')](_0x146e07['agentAvatar'])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],'server/files/images/avatars/',_0x146e07[_0x8b13('0x88')]))){_0x5ac718=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x146e07['agentAvatar']);}}return _0x38cbc5[_0x8b13('0x94')](_0x5ac718);}})[_0x8b13('0x66')](handleError(_0x38cbc5,null));};exports[_0x8b13('0x98')]=function(_0x2ad402,_0x2a44a7){var _0x46d487=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x99'));var _0x3c2bf8={'where':{'id':_0x2ad402[_0x8b13('0x68')]['id']},'attributes':['id','customerAvatar',_0x8b13('0x9a')],'raw':!![]};return db[_0x8b13('0x4d')]['find'](_0x3c2bf8)[_0x8b13('0x1d')](handleEntityNotFound(_0x2a44a7,null))['then'](function(_0x254c92){if(_0x254c92){if(!_[_0x8b13('0x90')](_0x254c92[_0x8b13('0x8a')])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x254c92[_0x8b13('0x8a')]))&&_0x254c92[_0x8b13('0x9a')]){_0x46d487=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x254c92[_0x8b13('0x8a')]);}}return _0x2a44a7[_0x8b13('0x94')](_0x46d487);}})[_0x8b13('0x66')](handleError(_0x2a44a7,null));};exports[_0x8b13('0x9b')]=function(_0x11e8df,_0x406603){var _0x2a31c5=path[_0x8b13('0x92')](config['root'],_0x8b13('0x9c'));var _0x4d8e3c={'where':{'id':_0x11e8df[_0x8b13('0x68')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x8b13('0x4d')]['find'](_0x4d8e3c)[_0x8b13('0x1d')](handleEntityNotFound(_0x406603,null))['then'](function(_0x2de36d){if(_0x2de36d){if(!_[_0x8b13('0x90')](_0x2de36d[_0x8b13('0x9d')])){if(fs['existsSync'](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x2de36d[_0x8b13('0x9d')]))){_0x2a31c5=path['join'](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x2de36d[_0x8b13('0x9d')]);}}return _0x406603[_0x8b13('0x94')](_0x2a31c5);}})[_0x8b13('0x66')](handleError(_0x406603,null));};function checkWebsiteInterval(_0x5f1130){var _0x3a7034=_0x5f1130[_0x8b13('0x9e')];if(!_0x3a7034){return Promise[_0x8b13('0x9f')](_0x5f1130);}var _0x440ba0=_0x5f1130[_0x8b13('0xa0')]||undefined;return _0x3a7034['ifTime'](_0x440ba0)['then'](function(_0x408300){if(!_0x408300){throw new APIOutOfIntervalError();}return _0x5f1130;});}exports['notify']=function(_0x35d90b,_0x3ce2f6){var _0x467779={'body':_0x35d90b[_0x8b13('0x72')],'channel':_0x8b13('0xa1')};var _0x28905c=[];var _0x360e01=[];var _0x146486={};var _0xf31db9=![];if(_0x35d90b[_0x8b13('0x72')]['id']){delete _0x35d90b[_0x8b13('0x72')]['id'];}if(_[_0x8b13('0x90')](_0x35d90b['body']['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_['isNil'](_0x35d90b['body'][_0x8b13('0xa2')])){throw new APIBadRequestError(_0x8b13('0xa3'));}if(_[_0x8b13('0xa4')](_0x35d90b[_0x8b13('0x72')][_0x8b13('0x72')])){throw new APIBadRequestError(_0x8b13('0xa5'));}var _0x33ab8d=_0x35d90b[_0x8b13('0x72')][_0x8b13('0x3a')]&&_0x35d90b[_0x8b13('0x72')]['referer'];return db[_0x8b13('0xa6')][_0x8b13('0x79')]()[_0x8b13('0x1d')](function(_0x5ce5e8){if(!_0x5ce5e8){throw new Error('No\x20available\x20attributes');}_0x28905c=Object[_0x8b13('0x52')](_0x5ce5e8)[_0x8b13('0x5e')](function(_0x5188d5){return![_0x8b13('0xa7'),_0x8b13('0xa8')]['includes'](_0x5188d5);});_0x360e01=Object[_0x8b13('0x52')](_0x5ce5e8)[_0x8b13('0x5e')](function(_0x1ed1d5){return![_0x8b13('0xa7'),_0x8b13('0xa8'),'CompanyId','ListId'][_0x8b13('0xa9')](_0x1ed1d5);});if(!_['includes'](_0x360e01,_0x35d90b[_0x8b13('0x72')][_0x8b13('0xa2')])){throw new APIBadRequestError(_0x8b13('0xaa')+_0x360e01['join'](',\x20'));}_0x146486[_0x35d90b[_0x8b13('0x72')][_0x8b13('0xa2')]]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')];})['then'](function(){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x35d90b[_0x8b13('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x8b13('0xac'),'include':[{'model':db[_0x8b13('0xa6')],'as':_0x8b13('0xad'),'where':_0x146486,'limit':0x1,'order':[[_0x8b13('0xa8'),_0x8b13('0xae')]]}]},{'model':db[_0x8b13('0xaf')],'as':_0x8b13('0xb0')},{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0x9e'),'include':[{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0xb1'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x8b13('0x1d')](function(_0xc42df9){if(!_0xc42df9){throw new APINotFoundError(util['format'](_0x8b13('0xb2'),_0x35d90b[_0x8b13('0x68')]['id']));}if(_0x33ab8d){return checkWebsiteInterval(_0xc42df9);}return _0xc42df9;})[_0x8b13('0x1d')](function(_0x2d605e){_0x467779[_0x8b13('0xb3')]=_0x2d605e;_0x467779[_0x8b13('0xb4')]=_[_0x8b13('0xb5')](_0x2d605e[_0x8b13('0xb0')],[_0x8b13('0xb6')],[_0x8b13('0xb7')]);if(_0x467779['account'][_0x8b13('0xb0')]){delete _0x467779['account'][_0x8b13('0xb0')];}_0x467779['list']=_0x2d605e[_0x8b13('0xac')]||{'id':_0x2d605e['ListId']};if(_0x467779[_0x8b13('0xb8')]&&_0x467779['list'][_0x8b13('0xad')][_0x8b13('0x56')]){return _0x467779[_0x8b13('0xb8')][_0x8b13('0xad')][0x0];}var _0x43d524=_[_0x8b13('0x15')](_0x35d90b[_0x8b13('0x72')],{'firstName':_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')],'ListId':_0x2d605e[_0x8b13('0xb9')]});_0x43d524[_0x35d90b[_0x8b13('0x72')]['mapKey']]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')];return db[_0x8b13('0xa6')][_0x8b13('0x6b')](_0x43d524,{'fields':_0x28905c,'raw':!![]});})['then'](function(_0x50ba6e){_0x467779[_0x8b13('0xba')]=_0x50ba6e;var _0x15c9d8=createInteractionObject(_0x35d90b[_0x8b13('0x68')]['id'],_0x35d90b[_0x8b13('0x72')],_0x35d90b[_0x8b13('0xbb')],_0x50ba6e);var _0x55827a={'ChatWebsiteId':_0x35d90b[_0x8b13('0x68')]['id']};if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')]){_0x55827a[_0x8b13('0xbc')]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')];_0x55827a[_0x8b13('0xbd')]=![];return db[_0x8b13('0xbe')][_0x8b13('0x6a')]({'where':_0x55827a})[_0x8b13('0x1d')](function(_0x5cbbe3){var _0x478185=_0x35d90b[_0x8b13('0x72')]['customerIp']&&_0x35d90b[_0x8b13('0x72')]['referer'];if(_0x5cbbe3){_0xf31db9=!![];return _0x5cbbe3;}else if(!_0x478185&&_0x5cbbe3&&_0x5cbbe3[_0x8b13('0xbd')]){throw new APIConflictError(_0x8b13('0xbf'));}_0x15c9d8[_0x8b13('0xbc')]=_0x35d90b[_0x8b13('0x72')]['threadId'];_0x15c9d8[_0x8b13('0xc0')]=_0x35d90b[_0x8b13('0x72')]['externalUrl'];return db[_0x8b13('0xbe')]['create'](_0x15c9d8);});}_0x55827a[_0x8b13('0xc1')]=_0x50ba6e['id'];if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]&&_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]['id']){_0x55827a['id']=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]['id'];return db['ChatInteraction'][_0x8b13('0x6a')]({'where':_0x55827a})[_0x8b13('0x1d')](function(_0x1a4d35){var _0x1fc092=_0x35d90b['body']['customerIp']&&_0x35d90b['body'][_0x8b13('0x40')];if(!_0x1fc092&&_0x1a4d35&&_0x1a4d35['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x1a4d35){_0xf31db9=!![];return _0x1a4d35;}else{return db[_0x8b13('0xbe')][_0x8b13('0x6b')](_0x15c9d8);}});}return db[_0x8b13('0xbe')][_0x8b13('0x6b')](_0x15c9d8);})[_0x8b13('0x1d')](function(_0x2a90ae){if(!_0xf31db9){return _0x2a90ae;}var _0x2e865f={'from':(_0x467779['contact']['firstName']||'')+'\x20'+(_0x467779[_0x8b13('0xba')]['lastName']||'')};if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')]&&_0x35d90b[_0x8b13('0x72')]['messageId']&&_0x35d90b[_0x8b13('0x72')]['threadId']!=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc3')]){_0x2e865f[_0x8b13('0xbc')]=_0x35d90b['body'][_0x8b13('0xc3')];}return _0x2a90ae[_0x8b13('0x31')](_0x2e865f);})[_0x8b13('0x1d')](function(_0x3cc463){_0x467779[_0x8b13('0xc2')]=_0x3cc463[_0x8b13('0x33')]({'plain':!![]});_0x467779[_0x8b13('0xc2')]['created']=!_0xf31db9;if(_0x467779['interaction']['created']){if(_0x467779[_0x8b13('0xb3')][_0x8b13('0xc4')]){_0x467779['applications'][_0x8b13('0xc5')]({'id':0x0,'priority':_0x467779['applications'][_0x8b13('0x56')]+0x1,'app':_0x8b13('0xc6'),'appdata':'unmanaged','interval':_0x8b13('0xc7')});}}return db[_0x8b13('0xc8')][_0x8b13('0x6b')]({'body':_0x35d90b[_0x8b13('0x72')][_0x8b13('0x72')],'ChatWebsiteId':_0x35d90b['params']['id'],'ChatInteractionId':_0x3cc463['id'],'direction':'in','ContactId':_0x467779['contact']['id'],'AttachmentId':_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc9')]});})[_0x8b13('0x1d')](function(_0x1e3cc8){_0x467779[_0x8b13('0x25')]=_0x1e3cc8;if(!_0x467779[_0x8b13('0xc2')][_0x8b13('0xca')]){return;}return db[_0x8b13('0xcb')]['find']({'attributes':['id',_0x8b13('0x36')],'where':{'id':_0x467779['interaction'][_0x8b13('0xca')]}});})[_0x8b13('0x1d')](function(_0x1883b0){if(_0x1883b0){_0x467779[_0x8b13('0xb4')][_0x8b13('0xcc')]({'id':0x0,'priority':0x0,'app':_0x8b13('0xcd'),'appdata':_0x1883b0[_0x8b13('0x36')]+','+(_0x467779[_0x8b13('0xb3')][_0x8b13('0xce')]||0xa),'interval':_0x8b13('0xc7')});_0x467779[_0x8b13('0xcf')]=!![];}if(!_0x467779[_0x8b13('0xc2')][_0x8b13('0xd0')]){return;}return db[_0x8b13('0xd1')]['find']({'attributes':['id',_0x8b13('0x36')],'where':{'id':_0x467779[_0x8b13('0xc2')][_0x8b13('0xd0')]}});})[_0x8b13('0x1d')](function(_0x2d43e0){if(_0x2d43e0){_0x467779[_0x8b13('0xb4')][_0x8b13('0xcc')]({'id':0x0,'priority':0x1,'app':_0x8b13('0xd2'),'appdata':_0x2d43e0[_0x8b13('0x36')]+','+(_0x467779[_0x8b13('0xb3')][_0x8b13('0xd3')]||0x12c),'interval':_0x8b13('0xc7')});}return respondWithRpcPromise(_0x8b13('0xd4'),'startRouting',_0x467779);})['then'](function(_0x347e78){respondWithRpcPromise(_0x8b13('0xd5'),'EventManager',{'event':_0x8b13('0xd6'),'message':_0x347e78},client9002);return _0x347e78;})[_0x8b13('0x1d')](respondWithResult(_0x3ce2f6,null))[_0x8b13('0x66')](APIHandleError(_0x3ce2f6));};exports[_0x8b13('0xd7')]=function(_0x59babb,_0x5f4be9){var _0x12a4f8,_0xed9630,_0x350a80;var _0x35f557=[];var _0x1e84f3={};var _0x446fab=_0x59babb['files']||[];var _0x32c2d9=[];var _0x8c1dc0;return db['CmContact']['describe']()[_0x8b13('0x1d')](function(_0x2350d3){if(!_0x2350d3){throw new db[(_0x8b13('0xd8'))]['ValidationError'](_0x8b13('0xd9'));}_0x35f557=_['difference'](_['keys'](_0x2350d3),[_0x8b13('0xa7'),_0x8b13('0xa8'),'CompanyId','ListId']);if(_0x59babb[_0x8b13('0x72')]['id']){delete _0x59babb['body']['id'];}if(_[_0x8b13('0x90')](_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')])){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)[_0x8b13('0x37')](new db['Sequelize']['ValidationError'](_0x8b13('0xda')));}if(_['isNil'](_0x59babb['body'][_0x8b13('0x72')])||_0x59babb[_0x8b13('0x72')][_0x8b13('0x72')]===''){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)[_0x8b13('0x37')](new db[(_0x8b13('0xd8'))]['ValidationError'](_0x8b13('0xdb')));}if(_[_0x8b13('0x90')](_0x59babb[_0x8b13('0x72')][_0x8b13('0xdc')])){throw _0x5f4be9['status'](0x1f4)['send'](new db[(_0x8b13('0xd8'))][(_0x8b13('0xdd'))](_0x8b13('0xde')+_0x35f557));}if(!_[_0x8b13('0xa9')](_0x35f557,_0x59babb[_0x8b13('0x72')]['mapKeyOffline'])){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)['send'](new db[(_0x8b13('0xd8'))][(_0x8b13('0xdd'))](_0x8b13('0xdf')+_0x35f557));}_0x1e84f3[_0x59babb['body'][_0x8b13('0xdc')]]=_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')];})['then'](function(){return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x59babb[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0xe0')],'as':_0x8b13('0xac')},{'model':db[_0x8b13('0xe1')],'as':'MailAccount'}]});})[_0x8b13('0x1d')](handleEntityNotFound(_0x5f4be9,null))[_0x8b13('0x1d')](function(_0x4c9273){if(_0x4c9273&&_0x4c9273['List']){_0xed9630=_0x4c9273;var _0x4935f0=_[_0x8b13('0x15')](_0x59babb['body'],{'firstName':_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')],'phone':_0x59babb[_0x8b13('0x72')]['from'],'ListId':_0x4c9273['ListId']});_0x4935f0[_0x59babb['body'][_0x8b13('0xdc')]]=_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')];return db['CmContact'][_0x8b13('0xe2')]({'where':_0x1e84f3,'defaults':_0x4935f0});}})['spread'](function(_0x28090c){if(_0x28090c){_0x350a80=_0x28090c;var _0x5011be=fs['readFileSync'](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0xe3')),_0x8b13('0xe4'));var _0x5b033b=ejs['render'](_0x5011be,{'body':_[_0x8b13('0xe5')](_0x59babb[_0x8b13('0x72')]['body']),'bodyTitle':_0xed9630['offlineMessageBody']});return db[_0x8b13('0xe6')][_0x8b13('0x6b')]({'body':_0x5b033b,'plainBody':htmlToText[_0x8b13('0xe7')](_0x5b033b),'ContactId':_0x28090c['id'],'ChatWebsiteId':_0xed9630['id']});}})[_0x8b13('0x1d')](function(_0x2de61d){_0x8c1dc0=_0x2de61d;if(_0x446fab[_0x8b13('0x56')]){var _0x5a195d=_0x446fab[_0x8b13('0x4c')](function(_0xecc8ea){return{'name':_0xecc8ea[_0x8b13('0xe8')],'basename':_0xecc8ea[_0x8b13('0x86')],'type':_0xecc8ea['mimetype'],'ChatOfflineMessageId':_0x2de61d['id']};});_0x32c2d9=_0x5a195d['map'](_0x2e24f2=>{var _0x1e2036={'filename':_0x2e24f2[_0x8b13('0x36')],'path':path[_0x8b13('0x92')](config['root'],_0x8b13('0xe9'),_0x8b13('0xea'),'attachments',_0x8b13('0xeb'),_0x2e24f2['basename'])};return _0x1e2036;});if(!_0xed9630[_0x8b13('0xec')]){return db[_0x8b13('0xed')][_0x8b13('0xee')](function(_0x24b945){return db[_0x8b13('0xef')][_0x8b13('0xf0')](_0x5a195d,{'transaction':_0x24b945});});}}})[_0x8b13('0x1d')](function(){if(_0x8c1dc0){_0x12a4f8=_0x8c1dc0;return db['MailAccount'][_0x8b13('0x7d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8b13('0xf1')],'as':_0x8b13('0xf1'),'raw':!![]}]}]});}})[_0x8b13('0x1d')](function(_0x38a88d){if(_0x38a88d&&_0x38a88d['Smtp']&&_0xed9630[_0x8b13('0xf2')]&&_0xed9630[_0x8b13('0xf3')]){var _0x1f9f15=_0x38a88d['getSmtpOptions']();return respondWithRpcPromise(_0x8b13('0xf4'),_0x8b13('0xf5'),{'account':_0x1f9f15,'message':{'from':util[_0x8b13('0x43')](_0x8b13('0xf6'),_0x38a88d[_0x8b13('0x36')],_0x38a88d[_0x8b13('0xf7')]||_0x38a88d[_0x8b13('0xf8')][_0x8b13('0xf9')]),'to':_0xed9630[_0x8b13('0xf3')],'subject':_0xed9630['offlineMessageSubject'],'html':_0x12a4f8[_0x8b13('0x72')],'attachments':_0x32c2d9}},client9003)[_0x8b13('0x1d')](function(){return _0x12a4f8;})[_0x8b13('0x66')](function(_0x104e89){logger['error'](_0x104e89);});}})['then'](function(){if(_0xed9630&&_0xed9630[_0x8b13('0xec')]&&_0xed9630[_0x8b13('0xfa')]){var _0x331434=[];if(_0x446fab[_0x8b13('0x56')]){_0x331434=_0x446fab[_0x8b13('0x4c')](function(_0x4a19ef){return{'name':_0x4a19ef[_0x8b13('0xe8')],'basename':_0x4a19ef[_0x8b13('0x86')],'type':_0x4a19ef[_0x8b13('0xfb')],'ChatOfflineMessageId':_0x8c1dc0['id']};});}var _0x49a92f;if(!_['isNil'](_0xed9630['subjectOffline'])){var _0x542e1b=_[_0x8b13('0x4c')](_0x59babb[_0x8b13('0x72')],function(_0x59615c){return _0x59615c;});var _0x132e63=_[_0x8b13('0xfc')](_0x542e1b)[0x0];var _0x27c8d9=_[_0x8b13('0xfd')](_0x132e63,function(_0x3eda97){return _0x3eda97;});_0x49a92f=_0x27c8d9[0x1][_0xed9630['subjectOffline']];}var _0x1f544c={'from':_0x350a80['email'],'firstName':_0x350a80['firstName'],'lastName':_0x350a80[_0x8b13('0x3e')],'mapKey':_0x8b13('0xf7'),'message':{'from':_0x350a80[_0x8b13('0xf7')],'to':_0xed9630[_0x8b13('0xe1')]['email'],'cc':'','subject':_[_0x8b13('0x90')](_0x49a92f)?_0xed9630[_0x8b13('0xfe')]:_0x49a92f,'messageId':'','sentAt':new Date(),'attach':_0x331434['length'],'attachments':_0x331434,'originChannel':_0x8b13('0xff'),'ChatWebsiteId':_0xed9630['id'],'ChatOfflineMessageId':_0x12a4f8['id'],'originTo':_0xed9630[_0x8b13('0xe1')]['email']},'body':_0x12a4f8[_0x8b13('0x72')]};var _0x1d47ff={'account':{'id':_0xed9630['MailAccountId']},'body':_0x1f544c,'log':_0x8b13('0x100')};return respondWithRpcPromise(_0x8b13('0x100'),_0x8b13('0x101'),_0x1d47ff,client9001)[_0x8b13('0x1d')](function(){return _0x12a4f8;})['catch'](function(_0xfb0a65){logger['error'](_0xfb0a65);});}return;})[_0x8b13('0x1d')](function(){if(_0x12a4f8){return _0x12a4f8;}})[_0x8b13('0x1d')](respondWithResult(_0x5f4be9,null))[_0x8b13('0x66')](function(){for(var _0x3c12ea of _0x446fab){var _0x8cd0e=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0xe9'),_0x8b13('0xea'),_0x8b13('0x102'),_0x8b13('0xeb'),_0x3c12ea[_0x8b13('0x86')]);fs_extra[_0x8b13('0x103')](_0x8cd0e)['catch'](function(_0x188f6e){logger[_0x8b13('0x23')](_0x8b13('0x104'),_0x8cd0e,_0x188f6e);});}});};exports[_0x8b13('0x105')]=function(_0x2db1b7,_0x433862){return db[_0x8b13('0xbe')]['find']({'where':{'id':_0x2db1b7['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x433862,null))[_0x8b13('0x1d')](function(_0x2defbf){if(_0x2defbf){return _0x2defbf[_0x8b13('0x105')](_0x2db1b7[_0x8b13('0x72')][_0x8b13('0x106')],_[_0x8b13('0x107')](_0x2db1b7[_0x8b13('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x433862,null))['catch'](handleError(_0x433862,null));};exports[_0x8b13('0x108')]=function(_0x392239,_0x360153){var _0x33e47b={'raw':![],'where':{}};var _0x1be7a8={};var _0x5369e2={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x392239[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x360153,null))[_0x8b13('0x1d')](function(_0x1f771c){if(_0x1f771c){_0x1be7a8[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0xbe')]['rawAttributes']);_0x1be7a8['query']=_['keys'](_0x392239[_0x8b13('0x51')]);_0x1be7a8[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x1be7a8[_0x8b13('0x47')],_0x1be7a8[_0x8b13('0x51')]);_0x33e47b[_0x8b13('0x54')]=_['intersection'](_0x1be7a8[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x392239['query']['fields']));_0x33e47b['attributes']=_0x33e47b[_0x8b13('0x54')]['length']?_0x33e47b['attributes']:_0x1be7a8[_0x8b13('0x47')];if(!_0x392239['query'][_0x8b13('0x57')](_0x8b13('0x58'))){_0x33e47b[_0x8b13('0x2d')]=qs['limit'](_0x392239['query'][_0x8b13('0x2d')]);_0x33e47b[_0x8b13('0x2a')]=qs['offset'](_0x392239[_0x8b13('0x51')]['offset']);}_0x33e47b[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x392239['query'][_0x8b13('0x5a')]);_0x33e47b['where']=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x392239[_0x8b13('0x51')],_0x1be7a8['filters']));_0x33e47b[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x1f771c['id'];if(_0x392239[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x33e47b[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x33e47b[_0x8b13('0x5b')],{'$or':_['map'](_0x33e47b[_0x8b13('0x54')],function(_0x476cce){var _0x378484={};_0x378484[_0x476cce]={'$like':'%'+_0x392239[_0x8b13('0x51')]['filter']+'%'};return _0x378484;})});}_0x33e47b=_[_0x8b13('0x5f')]({},_0x33e47b,_0x392239['options']);return db[_0x8b13('0xbe')][_0x8b13('0x2c')]({'where':_0x33e47b['where']})[_0x8b13('0x1d')](function(_0x110259){_0x5369e2['count']=_0x110259;if(_0x392239[_0x8b13('0x51')][_0x8b13('0x62')]){_0x33e47b['include']=[{'model':db['CmContact'],'as':_0x8b13('0x109'),'required':![]},{'model':db[_0x8b13('0xcb')],'as':_0x8b13('0x10a'),'attributes':[_0x8b13('0x36'),_0x8b13('0x10b'),'internal'],'required':![]},{'model':db[_0x8b13('0x10c')],'as':_0x8b13('0x10d'),'attributes':['id',_0x8b13('0x36'),_0x8b13('0x10e')],'where':_0x392239['query'][_0x8b13('0x10f')]?{'id':_0x392239['query']['tag']}:undefined,'required':_0x392239[_0x8b13('0x51')][_0x8b13('0x10f')]?!![]:![]}];}return db[_0x8b13('0xbe')]['findAll'](_0x33e47b);})['then'](function(_0xf3a99b){_0x5369e2[_0x8b13('0x65')]=_0xf3a99b;return _0x5369e2;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x360153,_0x33e47b))[_0x8b13('0x66')](handleError(_0x360153,null));};exports['getSnippet']=function(_0x4d1e8f,_0xce789c){var _0x29db49=0x0;var _0x20a25a=0x0;var _0x2be3a5=![];var _0x1c1513;var _0x2dc404;return db['ChatWebsite'][_0x8b13('0x6a')]({'where':{'id':_0x4d1e8f[_0x8b13('0x68')]['id']},'include':[{'model':db['Interval'],'as':_0x8b13('0x9e'),'include':[{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0xb1'),'attributes':['id',_0x8b13('0x110')]}]}]})[_0x8b13('0x1d')](handleEntityNotFound(_0xce789c,null))['then'](function(_0x43f7ff){if(_0x43f7ff){_0x1c1513=_0x43f7ff;return _0x43f7ff[_0x8b13('0x111')]({'raw':!![]});}})[_0x8b13('0x1d')](function(_0x48d167){if(_0x1c1513){if(_0x48d167){_0x2dc404=_0x48d167;}}return require(_0x8b13('0x8d'))[_0x8b13('0x8e')]();})['then'](function(_0x19f701){if(_0x19f701){_0x20a25a=_0x19f701[_0x8b13('0x112')];_0x2be3a5=_0x19f701[_0x8b13('0x8f')];}})['then'](function(){return db['ChatInteraction'][_0x8b13('0x2c')]({'where':{'closed':![]}});})['then'](function(_0x2dc339){_0x29db49=_0x2dc339;if(_0x20a25a&&_0x2dc339>_0x20a25a){return db[_0x8b13('0x113')][_0x8b13('0x7d')]({'where':{'id':0x1}})['then'](function(_0x18aa8f){if(_0x18aa8f){_0x18aa8f['increment']('chatLicenseExceeded');}});}})[_0x8b13('0x1d')](function(){var _0x12408a=_0x1c1513[_0x8b13('0x9e')];var _0x1c87fa=_0x1c1513[_0x8b13('0xa0')]||undefined;return _0x12408a?_0x12408a[_0x8b13('0x114')](_0x1c87fa):!![];})['then'](function(_0x273dec){var _0x3680b8=fs[_0x8b13('0x115')](path[_0x8b13('0x92')](config['root'],_0x8b13('0x116')),_0x8b13('0xe4'));var _0x41d888=_0x8b13('0x117');var _0x1a3b50=![];var _0x3af827,_0xc62a7c;if(_0x4d1e8f['headers'][_0x8b13('0x40')]){_0x3af827=new URL(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x40')])[_0x8b13('0x118')];}else if(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x118')]){_0x3af827=new URL(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x118')])['origin'];}else{_0x3af827=_0x8b13('0x119');}_0xc62a7c=typeof _0x1c1513['address'][_0x8b13('0x6d')](',')[_0x8b13('0x6a')](function(_0x1f0508){return wildcardUtils[_0x8b13('0x11a')](_0x1f0508,_0x3af827);})!==_0x8b13('0x2b');var _0x132264={'chatVersion':_0x41d888,'chatWebsiteAddressOrigin':_0xc62a7c?_0x3af827:_0x1c1513['address'],'remote':_0x1c1513[_0x8b13('0x11b')],'query':querystring[_0x8b13('0x22')](_['merge'](_0x1c1513['get']({'plain':!![]}),{'customerIp':_0x4d1e8f['headers']['x-forwarded-for']||_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x11c')]||_0x4d1e8f[_0x8b13('0x11d')][_0x8b13('0x11e')]||_0x4d1e8f['ip'],'referer':_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x40')],'openedInteractions':_0x29db49,'maxInteractions':_0x20a25a,'virtual':_0x2be3a5['virtual'],'online':_0x273dec,'custom':_0x2be3a5,'address':_0xc62a7c?_0x3af827:null}))['replace'](/'/g,'\x5c\x27')};_0xce789c[_0x8b13('0x37')](ejs[_0x8b13('0x11f')](Mustache[_0x8b13('0x11f')](_0x3680b8,_0x132264),{'proactiveActions':_0x2dc404,'alignment':_0x1c1513[_0x8b13('0x120')],'verticalAlignment':_0x1c1513[_0x8b13('0x121')],'div_color':_0x1c1513[_0x8b13('0x10e')],'labelText':_0x1c1513[_0x8b13('0x122')],'text_color':_0x1c1513['textColor'],'text_button_color':_0x1c1513[_0x8b13('0x123')],'button_color':_0x1c1513[_0x8b13('0x124')],'background_color':_0x1c1513['backgroundColor'],'hideWhenOffline':_0x1c1513['hideWhenOffline'],'intervalId':_0x1c1513['IntervalId'],'isDevelopment':_0x1a3b50,'chatVersion':_0x41d888}));})[_0x8b13('0x66')](handleError(_0xce789c,null));};exports['addApplications']=function(_0x458c8f,_0xdda7e0){var _0xd5a593=_0x458c8f[_0x8b13('0x68')]['id'];var _0x17df3f=_0x458c8f[_0x8b13('0x72')];var _0x68adf4=0xc8;var _0x429040=null;return db[_0x8b13('0xed')]['transaction']({'isolationLevel':db[_0x8b13('0xed')]['Transaction']['ISOLATION_LEVELS'][_0x8b13('0x125')]},function(_0x259a1f){return db['ChatWebsite'][_0x8b13('0x7d')]({'where':{'id':_0xd5a593},'transaction':_0x259a1f})[_0x8b13('0x1d')](function(_0x457dd1){if(_0x457dd1){return db[_0x8b13('0xaf')][_0x8b13('0x32')]({'where':{'ChatWebsiteId':_0xd5a593},'transaction':_0x259a1f})[_0x8b13('0x1d')](function(){var _0x2c8a6d=_[_0x8b13('0x4c')](_0x17df3f,function(_0x3f35c1){_0x3f35c1[_0x8b13('0x7a')]=_0xd5a593;return _0x3f35c1;});return db[_0x8b13('0xaf')][_0x8b13('0xf0')](_0x2c8a6d,{'transaction':_0x259a1f});});}else{_0x68adf4=0x194;_0x429040=[];}});})[_0x8b13('0x1d')](function(){if(_0x68adf4!==0x194){return db[_0x8b13('0xaf')][_0x8b13('0x126')]({'where':{'ChatWebsiteId':_0xd5a593},'order':_0x8b13('0xb6')})[_0x8b13('0x1d')](function(_0x1ea799){_0x429040=_0x1ea799;});}})[_0x8b13('0x66')](function(_0x50032d){_0x68adf4=0x1f4;logger[_0x8b13('0x23')](_0x50032d[_0x8b13('0x127')]);if(_0x50032d['name']){delete _0x50032d[_0x8b13('0x36')];}_0x429040=_0x50032d;})['finally'](function(){if(_0x429040===null){_0xdda7e0[_0x8b13('0x27')](_0x68adf4);}else{if(_0x68adf4===0x1f4){_0xdda7e0[_0x8b13('0x29')](_0x68adf4)[_0x8b13('0x37')](_0x429040);}else{_0xdda7e0[_0x8b13('0x29')](_0x68adf4)[_0x8b13('0x30')](_0x429040);}}});};exports[_0x8b13('0x128')]=function(_0xdf5ae6,_0x286254){var _0x18abba={};var _0x2a1b92={};var _0x95e9fb;var _0x2dcef4;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0xdf5ae6[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x286254,null))[_0x8b13('0x1d')](function(_0x3349ac){if(_0x3349ac){_0x95e9fb=_0x3349ac;_0x2a1b92['model']=_[_0x8b13('0x52')](db[_0x8b13('0xaf')][_0x8b13('0x4e')]);_0x2a1b92[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0xdf5ae6['query']);_0x2a1b92[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x2a1b92[_0x8b13('0x47')],_0x2a1b92[_0x8b13('0x51')]);_0x18abba[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x2a1b92['model'],qs[_0x8b13('0x55')](_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x55')]));_0x18abba[_0x8b13('0x54')]=_0x18abba[_0x8b13('0x54')]['length']?_0x18abba[_0x8b13('0x54')]:_0x2a1b92['model'];_0x18abba[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0xdf5ae6['query'][_0x8b13('0x5a')]);_0x18abba[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0xdf5ae6[_0x8b13('0x51')],_0x2a1b92[_0x8b13('0x5d')]));if(_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x18abba[_0x8b13('0x5b')]=_['merge'](_0x18abba[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x18abba[_0x8b13('0x54')],function(_0x29503b){var _0x246e17={};_0x246e17[_0x29503b]={'$like':'%'+_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x246e17;})});}_0x18abba=_[_0x8b13('0x5f')]({},_0x18abba,_0xdf5ae6[_0x8b13('0x61')]);return _0x95e9fb['getApplications'](_0x18abba);}})['then'](function(_0x405fa3){if(_0x405fa3){_0x2dcef4=_0x405fa3[_0x8b13('0x56')];if(!_0xdf5ae6['query'][_0x8b13('0x57')]('nolimit')){_0x18abba['limit']=qs[_0x8b13('0x2d')](_0xdf5ae6[_0x8b13('0x51')]['limit']);_0x18abba['offset']=qs[_0x8b13('0x2a')](_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x2a')]);}return _0x95e9fb[_0x8b13('0x128')](_0x18abba);}})[_0x8b13('0x1d')](function(_0x359014){if(_0x359014){return _0x359014?{'count':_0x2dcef4,'rows':_0x359014}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x286254,null))[_0x8b13('0x66')](handleError(_0x286254,null));};exports[_0x8b13('0x129')]=function(_0x7c338d,_0x50bf52){return db[_0x8b13('0x12a')][_0x8b13('0x6a')]({'where':{'id':_0x7c338d[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x50bf52,null))['then'](function(_0x54c415){if(_0x54c415){return _0x54c415[_0x8b13('0x129')](_0x7c338d[_0x8b13('0x72')][_0x8b13('0x106')],_[_0x8b13('0x107')](_0x7c338d[_0x8b13('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x50bf52,null))[_0x8b13('0x66')](handleError(_0x50bf52,null));};exports[_0x8b13('0x111')]=function(_0x2d15be,_0x393e7e){var _0x3a0822={};var _0x5e49c9={};var _0x18a6ad;var _0x9c9c4;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x2d15be[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x393e7e,null))[_0x8b13('0x1d')](function(_0x3e4da0){if(_0x3e4da0){_0x18a6ad=_0x3e4da0;_0x5e49c9[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0x12b')][_0x8b13('0x4e')]);_0x5e49c9[_0x8b13('0x51')]=_['keys'](_0x2d15be['query']);_0x5e49c9['filters']=_['intersection'](_0x5e49c9['model'],_0x5e49c9[_0x8b13('0x51')]);_0x3a0822['attributes']=_[_0x8b13('0x53')](_0x5e49c9[_0x8b13('0x47')],qs['fields'](_0x2d15be['query']['fields']));_0x3a0822[_0x8b13('0x54')]=_0x3a0822[_0x8b13('0x54')]['length']?_0x3a0822['attributes']:_0x5e49c9['model'];_0x3a0822[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x2d15be[_0x8b13('0x51')]['sort']);_0x3a0822['where']=qs['filters'](_[_0x8b13('0x5c')](_0x2d15be[_0x8b13('0x51')],_0x5e49c9[_0x8b13('0x5d')]));if(_0x2d15be[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x3a0822[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x3a0822[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x3a0822[_0x8b13('0x54')],function(_0x4f5f8d){var _0x438b94={};_0x438b94[_0x4f5f8d]={'$like':'%'+_0x2d15be[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x438b94;})});}_0x3a0822=_[_0x8b13('0x5f')]({},_0x3a0822,_0x2d15be[_0x8b13('0x61')]);return _0x18a6ad[_0x8b13('0x111')](_0x3a0822);}})['then'](function(_0x220af3){if(_0x220af3){_0x9c9c4=_0x220af3[_0x8b13('0x56')];if(!_0x2d15be[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x3a0822['limit']=qs[_0x8b13('0x2d')](_0x2d15be[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x3a0822[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x2d15be['query'][_0x8b13('0x2a')]);}return _0x18a6ad[_0x8b13('0x111')](_0x3a0822);}})[_0x8b13('0x1d')](function(_0x29b91b){if(_0x29b91b){return _0x29b91b?{'count':_0x9c9c4,'rows':_0x29b91b}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x393e7e,null))['catch'](handleError(_0x393e7e,null));};exports[_0x8b13('0x12c')]=function(_0x5d1b47,_0x545e66){var _0x531a35=_0x5d1b47[_0x8b13('0x51')][_0x8b13('0x12d')]===_0x8b13('0x12e')?_0x8b13('0x12f'):_0x8b13('0x130');return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'attributes':['id',_0x531a35],'where':{'id':_0x5d1b47[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x545e66,null))[_0x8b13('0x1d')](function(_0x118f07){if(_0x118f07){var _0x3cc93f=_0x118f07[_0x531a35];var _0x436d82=_0x3cc93f&&_0x3cc93f[_0x8b13('0x131')]?_0x3cc93f['items']:[];_0x545e66[_0x8b13('0x37')]({'fromKey':_[_0x8b13('0x90')](_0x3cc93f[_0x8b13('0x132')])?undefined:_0x3cc93f['fromKey'],'count':_0x436d82['length'],'rows':_0x436d82});}})[_0x8b13('0x66')](handleError(_0x545e66,null));};exports[_0x8b13('0x133')]=function(_0x5e0767,_0x3dc6f2){var _0xd2411f={'raw':![],'where':{}};var _0x34f260={};var _0x22e6bd={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x5e0767[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x3dc6f2,null))['then'](function(_0x411ee5){if(_0x411ee5){_0x34f260[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0xe6')][_0x8b13('0x4e')]);_0x34f260[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x5e0767[_0x8b13('0x51')]);_0x34f260[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x34f260[_0x8b13('0x47')],_0x34f260[_0x8b13('0x51')]);_0xd2411f[_0x8b13('0x54')]=_['intersection'](_0x34f260['model'],qs[_0x8b13('0x55')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x55')]));_0xd2411f[_0x8b13('0x54')]=_0xd2411f[_0x8b13('0x54')][_0x8b13('0x56')]?_0xd2411f['attributes']:_0x34f260[_0x8b13('0x47')];if(!_0x5e0767[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0xd2411f['limit']=qs[_0x8b13('0x2d')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x2d')]);_0xd2411f[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0xd2411f[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5a')]);_0xd2411f['where']=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x5e0767[_0x8b13('0x51')],_0x34f260[_0x8b13('0x5d')]));_0xd2411f[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x411ee5['id'];if(_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5e')]){_0xd2411f[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0xd2411f['where'],{'$or':_[_0x8b13('0x4c')](_0xd2411f[_0x8b13('0x54')],function(_0x419f85){var _0x3b62e4={};_0x3b62e4[_0x419f85]={'$like':'%'+_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x3b62e4;})});}_0xd2411f=_[_0x8b13('0x5f')]({},_0xd2411f,_0x5e0767[_0x8b13('0x61')]);return db[_0x8b13('0xe6')]['count']({'where':_0xd2411f[_0x8b13('0x5b')]})['then'](function(_0xc5960e){_0x22e6bd[_0x8b13('0x2c')]=_0xc5960e;if(_0x5e0767[_0x8b13('0x51')]['includeAll']){_0xd2411f[_0x8b13('0x63')]=[{'all':!![]}];}else{_0xd2411f[_0x8b13('0x63')]=[{'model':db['CmContact'],'as':_0x8b13('0x109'),'required':![]},{'model':db[_0x8b13('0xef')],'as':'Attachments','required':![]}];}return db[_0x8b13('0xe6')]['findAll'](_0xd2411f);})['then'](function(_0x25d83b){_0x22e6bd[_0x8b13('0x65')]=_0x25d83b;return _0x22e6bd;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x3dc6f2,_0xd2411f))[_0x8b13('0x66')](handleError(_0x3dc6f2,null));};exports[_0x8b13('0x134')]=function(_0xc43aba,_0x1c68da){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0xc43aba[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x1c68da,null))[_0x8b13('0x1d')](function(_0xf3e201){if(_0xf3e201){return _0xf3e201[_0x8b13('0x134')](_0xc43aba['body'][_0x8b13('0x106')],_['omit'](_0xc43aba['body'],[_0x8b13('0x106'),'id'])||{})[_0x8b13('0x135')](function(_0x559cdf){for(var _0x1f2a30=0x0;_0x1f2a30<_0xc43aba[_0x8b13('0x72')][_0x8b13('0x106')][_0x8b13('0x56')];_0x1f2a30+=0x1){socket[_0x8b13('0x136')](_0x8b13('0x137'),{'UserId':Number(_0xc43aba[_0x8b13('0x72')]['ids'][_0x1f2a30]),'ChatWebsiteId':Number(_0xc43aba[_0x8b13('0x68')]['id'])});}return _0x559cdf;});}})['then'](respondWithResult(_0x1c68da,null))[_0x8b13('0x66')](handleError(_0x1c68da,null));};exports[_0x8b13('0x138')]=function(_0x5d245e,_0x2b4de7){return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x5d245e[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x2b4de7,null))[_0x8b13('0x1d')](function(_0x51e2da){if(_0x51e2da){return _0x51e2da['removeAgents'](_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')])['then'](function(){if(_[_0x8b13('0x139')](_0x5d245e['query']['ids'])){for(var _0x5827ee=0x0;_0x5827ee<_0x5d245e[_0x8b13('0x51')]['ids'][_0x8b13('0x56')];_0x5827ee+=0x1){socket[_0x8b13('0x136')](_0x8b13('0x13a'),{'UserId':Number(_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')][_0x5827ee]),'ChatWebsiteId':Number(_0x5d245e[_0x8b13('0x68')]['id'])});}}else{socket['emit'](_0x8b13('0x13a'),{'UserId':Number(_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')]),'ChatWebsiteId':Number(_0x5d245e[_0x8b13('0x68')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b4de7,null))[_0x8b13('0x66')](handleError(_0x2b4de7,null));};exports['getAgents']=function(_0x703e,_0x326163){var _0x503451={};var _0x21dedb={};var _0x50e0b8;var _0x555589;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x703e[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x326163,null))[_0x8b13('0x1d')](function(_0x36cbd3){if(_0x36cbd3){_0x50e0b8=_0x36cbd3;_0x21dedb[_0x8b13('0x47')]=_[_0x8b13('0x52')](db['User'][_0x8b13('0x4e')]);_0x21dedb['query']=_[_0x8b13('0x52')](_0x703e[_0x8b13('0x51')]);_0x21dedb[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x21dedb[_0x8b13('0x47')],_0x21dedb['query']);_0x503451[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x21dedb[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x703e['query'][_0x8b13('0x55')]));_0x503451[_0x8b13('0x54')]=_0x503451['attributes']['length']?_0x503451[_0x8b13('0x54')]:_0x21dedb[_0x8b13('0x47')];_0x503451['order']=qs[_0x8b13('0x5a')](_0x703e[_0x8b13('0x51')][_0x8b13('0x5a')]);_0x503451[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x703e[_0x8b13('0x51')],_0x21dedb['filters']));if(_0x703e[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x503451['where']=_[_0x8b13('0x5f')](_0x503451[_0x8b13('0x5b')],{'$or':_['map'](_0x503451['attributes'],function(_0x5e3ec8){var _0x24c28c={};_0x24c28c[_0x5e3ec8]={'$like':'%'+_0x703e[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x24c28c;})});}_0x503451=_[_0x8b13('0x5f')]({},_0x503451,_0x703e[_0x8b13('0x61')]);return _0x50e0b8[_0x8b13('0x13b')](_0x503451);}})[_0x8b13('0x1d')](function(_0xe679a3){if(_0xe679a3){_0x555589=_0xe679a3['length'];if(!_0x703e[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x503451[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x703e[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x503451[_0x8b13('0x2a')]=qs['offset'](_0x703e[_0x8b13('0x51')][_0x8b13('0x2a')]);}return _0x50e0b8[_0x8b13('0x13b')](_0x503451);}})[_0x8b13('0x1d')](function(_0x5816cd){if(_0x5816cd){return _0x5816cd?{'count':_0x555589,'rows':_0x5816cd}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x326163,null))[_0x8b13('0x66')](handleError(_0x326163,null));}; \ No newline at end of file +var _0xe5b3=['path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','map','ChatWebsite','rawAttributes','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','show','params','mandatoryDispositionPause','merge','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','ListId','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','list','defaults','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','customerIp','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','Start','startRouting','EventManager','offline','files','Sequelize','difference','CompanyId','from\x20is\x20mandatory','ValidationError','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','fromString','originalname','mimetype','offline-chat','openNewInteraction','sequelize','transaction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','order','Contact','Owner','fullname','internal','Tags','tag','getSnippet','interval','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','3.13.0','origin','testWebsiteWithWildcard','remote','x-forwarded-for','connection','replace','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','ChatOfflineMessage','Attachment','rows','addAgents','spread','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','util'];(function(_0x3f46e6,_0x1870d2){var _0x291241=function(_0x4f5e8d){while(--_0x4f5e8d){_0x3f46e6['push'](_0x3f46e6['shift']());}};_0x291241(++_0x1870d2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x66a2aa,_0x43001c){_0x66a2aa=_0x66a2aa-0x0;var _0x3933e7=_0xe5b3[_0x66a2aa];return _0x3933e7;};'use strict';var Mustache=require('mustache');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var ejs=require(_0x3e5b('0x2'));var fs=require('fs');var fs_extra=require(_0x3e5b('0x3'));var _=require(_0x3e5b('0x4'));var querystring=require(_0x3e5b('0x5'));var htmlToText=require(_0x3e5b('0x6'));var Redis=require(_0x3e5b('0x7'));var jayson=require(_0x3e5b('0x8'));var qs=require(_0x3e5b('0x9'));var logger=require(_0x3e5b('0xa'))('api');var config=require(_0x3e5b('0xb'));var APIBadRequestError=require(_0x3e5b('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x3e5b('0xc'))[_0x3e5b('0xd')];var APIOutOfIntervalError=require(_0x3e5b('0xc'))[_0x3e5b('0xe')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x3e5b('0xc'))[_0x3e5b('0xf')];var wildcardUtils=require(_0x3e5b('0x10'));var URL=require(_0x3e5b('0x11'))[_0x3e5b('0x12')];var db=require('../../mysqldb')['db'];config[_0x3e5b('0x13')]=_['defaults'](config[_0x3e5b('0x13')],{'host':_0x3e5b('0x14'),'port':0x18eb});var socket=require(_0x3e5b('0x15'))(new Redis(config[_0x3e5b('0x13')]));require(_0x3e5b('0x16'))[_0x3e5b('0x17')](socket);var client=jayson[_0x3e5b('0x18')]['http']({'port':0x232c});var client9002=jayson[_0x3e5b('0x18')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x3e5b('0x18')][_0x3e5b('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x17aaa3,_0x4fb471,_0x1f81a7,_0x59ddc0){return new Promise(function(_0x56a453,_0x258d6a){var _0x11b41b=_0x59ddc0||client;return _0x11b41b['request'](_0x17aaa3,_0x1f81a7)[_0x3e5b('0x1a')](function(_0x143040){logger['info'](_0x3e5b('0x1b'),_0x4fb471,_0x3e5b('0x1c'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4fb471,_0x3e5b('0x1c'),JSON[_0x3e5b('0x1d')](_0x143040));if(_0x143040[_0x3e5b('0x1e')]){if(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x1f')]===0x1f4){logger[_0x3e5b('0x1e')](_0x3e5b('0x1b'),_0x4fb471,_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);return _0x258d6a(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);}logger[_0x3e5b('0x1e')](_0x3e5b('0x1b'),_0x4fb471,_0x143040[_0x3e5b('0x1e')]['message']);return _0x56a453(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);}else{logger[_0x3e5b('0x21')](_0x3e5b('0x1b'),_0x4fb471,'request\x20sent');_0x56a453(_0x143040[_0x3e5b('0x22')]['message']);}})[_0x3e5b('0x23')](function(_0x36d960){logger['error'](_0x3e5b('0x1b'),_0x4fb471,_0x36d960);_0x258d6a(_0x36d960);});});}function respondWithStatusCode(_0x2f6368,_0x42d7e9){_0x42d7e9=_0x42d7e9||0xcc;return function(_0x3c8965){if(_0x3c8965){return _0x2f6368[_0x3e5b('0x24')](_0x42d7e9);}return _0x2f6368[_0x3e5b('0x25')](_0x42d7e9)[_0x3e5b('0x26')]();};}function respondWithResult(_0x2ddf57,_0x4c4b89){_0x4c4b89=_0x4c4b89||0xc8;return function(_0x1c7278){if(_0x1c7278){return _0x2ddf57['status'](_0x4c4b89)[_0x3e5b('0x27')](_0x1c7278);}};}function respondWithFilteredResult(_0x4fd64b,_0x101653){return function(_0x1f6473){if(_0x1f6473){var _0x1296ec=typeof _0x101653[_0x3e5b('0x28')]===_0x3e5b('0x29')&&typeof _0x101653[_0x3e5b('0x2a')]===_0x3e5b('0x29');var _0x9c2123=_0x1f6473[_0x3e5b('0x2b')];var _0x112dc0=_0x1296ec?0x0:_0x101653[_0x3e5b('0x28')];var _0x489221=_0x1296ec?_0x1f6473[_0x3e5b('0x2b')]:_0x101653[_0x3e5b('0x28')]+_0x101653[_0x3e5b('0x2a')];var _0x2a14eb;if(_0x489221>=_0x9c2123){_0x489221=_0x9c2123;_0x2a14eb=0xc8;}else{_0x2a14eb=0xce;}_0x4fd64b[_0x3e5b('0x25')](_0x2a14eb);return _0x4fd64b[_0x3e5b('0x2c')](_0x3e5b('0x2d'),_0x112dc0+'-'+_0x489221+'/'+_0x9c2123)['json'](_0x1f6473);}return null;};}function saveUpdates(_0x33f089){return function(_0x56a527){if(_0x56a527){return _0x56a527['update'](_0x33f089)[_0x3e5b('0x1a')](function(_0x78d68a){return _0x78d68a;});}return null;};}function removeEntity(_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x2e')]()[_0x3e5b('0x1a')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x2f')]({'plain':!![]});var _0x26f842=_0x3e5b('0x30');return db[_0x3e5b('0x31')][_0x3e5b('0x2e')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1a')](function(){return _0x40e37d;});})[_0x3e5b('0x1a')](function(){_0x51ea0d[_0x3e5b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e){return function(_0xec45c5){if(!_0xec45c5){_0x141b7e['sendStatus'](0x194);}return _0xec45c5;};}function handleError(_0x4edf59,_0x471196){_0x471196=_0x471196||0x1f4;return function(_0x56d7ef){logger[_0x3e5b('0x1e')](_0x56d7ef[_0x3e5b('0x32')]);if(_0x56d7ef[_0x3e5b('0x33')]){delete _0x56d7ef[_0x3e5b('0x33')];}_0x4edf59['status'](_0x471196)[_0x3e5b('0x34')](_0x56d7ef);};}function createInteractionObject(_0x4cdcb1,_0x42b970,_0x5ec841,_0x47f7c8){var _0x48f414=require(_0x3e5b('0x35'));var _0x174ebf=new _0x48f414();var _0x2eaa30=_0x174ebf[_0x3e5b('0x36')](_0x5ec841[_0x3e5b('0x37')])[_0x3e5b('0x38')]();var _0x5466ac=_0x42b970['customerIp'];if(_0x5ec841['cf-connecting-ip']){_0x5466ac=_0x5ec841['cf-connecting-ip'];}else if(_0x5ec841['x-forwarded-for']){_0x5466ac=_['first'](_0x5ec841['x-forwarded-for'][_0x3e5b('0x39')](','));}return{'ContactId':_0x47f7c8['id'],'ChatWebsiteId':_0x4cdcb1,'from':(_0x47f7c8[_0x3e5b('0x3a')]||'')+'\x20'+(_0x47f7c8[_0x3e5b('0x3b')]||''),'customerIp':_0x5466ac,'customerPort':_0x5ec841[_0x3e5b('0x3c')]?_0x5ec841[_0x3e5b('0x3c')]:null,'referer':_0x42b970[_0x3e5b('0x3d')],'browserName':_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x33')]&&_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]?util[_0x3e5b('0x40')]('%s\x20%s',_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x33')],_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]):_0x3e5b('0x41'),'browserVersion':_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]||_0x3e5b('0x41'),'osName':util[_0x3e5b('0x40')](_0x3e5b('0x42'),_0x2eaa30['os'][_0x3e5b('0x33')],_0x2eaa30['os']['version']),'osVersion':_0x2eaa30['os']['version'],'deviceModel':_0x2eaa30['device']['model']&&_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x44')]?util[_0x3e5b('0x40')](_0x3e5b('0x45'),_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x46')],_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x44')],_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x47')]):null,'deviceVendor':_0x2eaa30['device'][_0x3e5b('0x44')],'deviceType':_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x47')],'formData':JSON[_0x3e5b('0x1d')](_0x42b970)};}exports[_0x3e5b('0x48')]=function(_0x4f0c2c,_0x588ee7){var _0x495217={'include':[{'model':db[_0x3e5b('0x49')],'as':'mandatoryDispositionPause'}]},_0x1fbd87={},_0x20af6a={'count':0x0,'rows':[]};var _0x4b604d=_[_0x3e5b('0x4a')](db[_0x3e5b('0x4b')][_0x3e5b('0x4c')],function(_0x5acf51){return{'name':_0x5acf51['fieldName'],'type':_0x5acf51[_0x3e5b('0x47')]['key']};});_0x1fbd87[_0x3e5b('0x46')]=_[_0x3e5b('0x4a')](_0x4b604d,_0x3e5b('0x33'));_0x1fbd87[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4f0c2c[_0x3e5b('0x4d')]);_0x1fbd87[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x1fbd87[_0x3e5b('0x46')],_0x1fbd87['query']);_0x495217[_0x3e5b('0x51')]=_['intersection'](_0x1fbd87[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x495217[_0x3e5b('0x51')]=_0x495217[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x495217[_0x3e5b('0x51')]:_0x1fbd87[_0x3e5b('0x46')];if(!_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x495217[_0x3e5b('0x2a')]=qs['limit'](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x495217[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x495217['order']=qs[_0x3e5b('0x56')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x495217[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x4f0c2c[_0x3e5b('0x4d')],_0x1fbd87[_0x3e5b('0x4f')]),_0x4b604d);if(_0x4f0c2c['query'][_0x3e5b('0x59')]){_0x495217['where']=_['merge'](_0x495217[_0x3e5b('0x57')],{'$or':_['map'](_0x4b604d,function(_0x4a0c86){if(_0x4a0c86[_0x3e5b('0x47')]!==_0x3e5b('0x5a')){var _0x1f7959={};_0x1f7959[_0x4a0c86['name']]={'$like':'%'+_0x4f0c2c['query']['filter']+'%'};return _0x1f7959;}})});}_0x495217=_['merge']({},_0x495217,_0x4f0c2c[_0x3e5b('0x5b')]);var _0x999518={'where':_0x495217[_0x3e5b('0x57')]};return db[_0x3e5b('0x4b')][_0x3e5b('0x2b')](_0x999518)['then'](function(_0x5ac379){_0x20af6a[_0x3e5b('0x2b')]=_0x5ac379;if(_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x495217[_0x3e5b('0x5d')]=[{'all':!![]}];}return db[_0x3e5b('0x4b')]['findAll'](_0x495217);})['then'](function(_0x4abd65){_0x20af6a['rows']=_0x4abd65;return _0x20af6a;})[_0x3e5b('0x1a')](respondWithFilteredResult(_0x588ee7,_0x495217))[_0x3e5b('0x23')](handleError(_0x588ee7,null));};exports[_0x3e5b('0x5e')]=function(_0x80b4,_0x424a3d){var _0x24087b={'raw':![],'where':{'id':_0x80b4[_0x3e5b('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x3e5b('0x60')}]},_0x1915bc={};_0x1915bc[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x4b')][_0x3e5b('0x4c')]);_0x1915bc['query']=_[_0x3e5b('0x4e')](_0x80b4['query']);_0x1915bc[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x1915bc['model'],_0x1915bc['query']);_0x24087b['attributes']=_[_0x3e5b('0x50')](_0x1915bc['model'],qs[_0x3e5b('0x52')](_0x80b4[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x24087b[_0x3e5b('0x51')]=_0x24087b[_0x3e5b('0x51')]['length']?_0x24087b['attributes']:_0x1915bc[_0x3e5b('0x46')];if(_0x80b4[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x24087b['include']=[{'all':!![]}];}_0x24087b=_[_0x3e5b('0x61')]({},_0x24087b,_0x80b4[_0x3e5b('0x5b')]);return db[_0x3e5b('0x4b')][_0x3e5b('0x62')](_0x24087b)[_0x3e5b('0x1a')](handleEntityNotFound(_0x424a3d,null))[_0x3e5b('0x1a')](respondWithResult(_0x424a3d,null))[_0x3e5b('0x23')](handleError(_0x424a3d,null));};exports[_0x3e5b('0x63')]=function(_0x3a11a8,_0x52e98f){var _0x4eb336=null;_0x3a11a8[_0x3e5b('0x64')][_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x66')](_0x2411c3=>{if(_0x2411c3[_0x3e5b('0x67')]()!==''&&!wildcardUtils[_0x3e5b('0x68')](_0x2411c3['trim']())){_0x4eb336=new APIBadRequestError('\x22'+_0x2411c3[_0x3e5b('0x67')]()+_0x3e5b('0x69'));}});if(_0x4eb336){return handleError(_0x52e98f,null)(_0x4eb336);}return db['ChatWebsite'][_0x3e5b('0x63')](_0x3a11a8[_0x3e5b('0x64')],{})['then'](function(_0x52d89e){var _0x4f67d1=_0x3a11a8[_0x3e5b('0x6a')][_0x3e5b('0x2f')]({'plain':!![]});if(!_0x4f67d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f67d1[_0x3e5b('0x6b')]===_0x3e5b('0x6a')){var _0x47b810=_0x52d89e[_0x3e5b('0x2f')]({'plain':!![]});var _0x17f60f=_0x3e5b('0x30');return db[_0x3e5b('0x6c')][_0x3e5b('0x62')]({'where':{'name':_0x17f60f,'userProfileId':_0x4f67d1[_0x3e5b('0x6d')]},'raw':!![]})[_0x3e5b('0x1a')](function(_0x410c7a){if(_0x410c7a&&_0x410c7a[_0x3e5b('0x6e')]===0x0){return db['UserProfileResource'][_0x3e5b('0x63')]({'name':_0x47b810[_0x3e5b('0x33')],'resourceId':_0x47b810['id'],'type':_0x410c7a[_0x3e5b('0x33')],'sectionId':_0x410c7a['id']},{})[_0x3e5b('0x1a')](function(){return _0x52d89e;});}else{return _0x52d89e;}})[_0x3e5b('0x23')](function(_0x1ec1f6){logger[_0x3e5b('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ec1f6);throw _0x1ec1f6;});}return _0x52d89e;})['then'](respondWithResult(_0x52e98f,0xc9))[_0x3e5b('0x23')](handleError(_0x52e98f,null));};exports[_0x3e5b('0x6f')]=function(_0x4dd417,_0x404621){var _0x6e1c5=null;_0x4dd417[_0x3e5b('0x64')][_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x66')](_0x1bbcf5=>{if(_0x1bbcf5['trim']()!==''&&!wildcardUtils[_0x3e5b('0x68')](_0x1bbcf5[_0x3e5b('0x67')]())){_0x6e1c5=new APIBadRequestError('\x22'+_0x1bbcf5['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x6e1c5){return handleError(_0x404621,null)(_0x6e1c5);}if(_0x4dd417['body']['id']){delete _0x4dd417[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x4dd417[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0x49')],'as':_0x3e5b('0x60')}]})['then'](handleEntityNotFound(_0x404621,null))[_0x3e5b('0x1a')](saveUpdates(_0x4dd417[_0x3e5b('0x64')],null))['then'](respondWithResult(_0x404621,null))[_0x3e5b('0x23')](handleError(_0x404621,null));};exports['destroy']=function(_0x4f62fb,_0x211e73){return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x4f62fb[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x211e73,null))['then'](removeEntity(_0x211e73,null))[_0x3e5b('0x23')](handleError(_0x211e73,null));};exports[_0x3e5b('0x70')]=function(_0x14baa9,_0x1425eb){return db[_0x3e5b('0x4b')][_0x3e5b('0x70')]()['then'](respondWithResult(_0x1425eb,null))['catch'](handleError(_0x1425eb,null));};exports[_0x3e5b('0x71')]=function(_0x5c63d0,_0x568890){if(_0x5c63d0[_0x3e5b('0x64')]['id']){delete _0x5c63d0[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x5c63d0[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x568890,null))[_0x3e5b('0x1a')](function(_0x4dbea3){if(_0x4dbea3){_0x5c63d0[_0x3e5b('0x64')][_0x3e5b('0x72')]=_0x4dbea3['id'];return db[_0x3e5b('0x73')][_0x3e5b('0x63')](_0x5c63d0['body']);}})[_0x3e5b('0x1a')](respondWithResult(_0x568890,null))['catch'](handleError(_0x568890,null));};exports[_0x3e5b('0x74')]=function(_0x8f992f,_0x58ccf3){var _0x272ef1={'raw':![],'where':{}};var _0x3279cc={};var _0x43e8ad={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x8f992f[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x58ccf3,null))['then'](function(_0x1797da){if(_0x1797da){_0x3279cc[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0x73')][_0x3e5b('0x4c')]);_0x3279cc[_0x3e5b('0x4d')]=_['keys'](_0x8f992f[_0x3e5b('0x4d')]);_0x3279cc[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x3279cc[_0x3e5b('0x46')],_0x3279cc['query']);_0x272ef1[_0x3e5b('0x51')]=_['intersection'](_0x3279cc[_0x3e5b('0x46')],qs['fields'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x272ef1['attributes']=_0x272ef1[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x272ef1['attributes']:_0x3279cc[_0x3e5b('0x46')];if(!_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x272ef1['limit']=qs['limit'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x272ef1[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x272ef1['order']=qs['sort'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x272ef1[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x8f992f[_0x3e5b('0x4d')],_0x3279cc[_0x3e5b('0x4f')]));_0x272ef1[_0x3e5b('0x57')]['ChatWebsiteId']=_0x1797da['id'];if(_0x8f992f['query'][_0x3e5b('0x59')]){_0x272ef1['where']=_[_0x3e5b('0x61')](_0x272ef1[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x272ef1[_0x3e5b('0x51')],function(_0x3d4e20){var _0x269c0a={};_0x269c0a[_0x3d4e20]={'$like':'%'+_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x269c0a;})});}_0x272ef1=_[_0x3e5b('0x61')]({},_0x272ef1,_0x8f992f[_0x3e5b('0x5b')]);return db[_0x3e5b('0x73')][_0x3e5b('0x2b')]({'where':_0x272ef1[_0x3e5b('0x57')]})['then'](function(_0x59909d){_0x43e8ad[_0x3e5b('0x2b')]=_0x59909d;if(_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x272ef1[_0x3e5b('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x3e5b('0x76')](_0x272ef1);})['then'](function(_0x215c43){_0x43e8ad['rows']=_0x215c43;return _0x43e8ad;});}})[_0x3e5b('0x1a')](respondWithFilteredResult(_0x58ccf3,_0x272ef1))[_0x3e5b('0x23')](handleError(_0x58ccf3,null));};exports[_0x3e5b('0x77')]=function(_0x5bc994,_0x121c8f){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x5bc994[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x121c8f,null))['then'](function(_0x57819a){if(_0x57819a){return _0x57819a[_0x3e5b('0x77')](_0x5bc994['query'][_0x3e5b('0x78')]);}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x121c8f,null))[_0x3e5b('0x23')](handleError(_0x121c8f,null));};exports[_0x3e5b('0x79')]=function(_0x41de83,_0x2df067){if(_0x41de83[_0x3e5b('0x64')]['id']){delete _0x41de83[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x41de83[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x2df067,null))['then'](function(_0x9aecab){if(_0x9aecab){_0x41de83[_0x3e5b('0x64')]['ChatWebsiteId']=_0x9aecab['id'];return db['CannedAnswer'][_0x3e5b('0x63')](_0x41de83[_0x3e5b('0x64')]);}})[_0x3e5b('0x1a')](respondWithResult(_0x2df067,null))[_0x3e5b('0x23')](handleError(_0x2df067,null));};exports[_0x3e5b('0x7a')]=function(_0x4c66b7,_0xc78d12){var _0x41f7c8={'raw':![],'where':{}};var _0x506a2d={};var _0x53913d={'count':0x0,'rows':[]};return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x4c66b7['params']['id']}})['then'](handleEntityNotFound(_0xc78d12,null))[_0x3e5b('0x1a')](function(_0x12fcdf){if(_0x12fcdf){_0x506a2d['model']=_[_0x3e5b('0x4e')](db[_0x3e5b('0x7b')][_0x3e5b('0x4c')]);_0x506a2d[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4c66b7['query']);_0x506a2d['filters']=_[_0x3e5b('0x50')](_0x506a2d[_0x3e5b('0x46')],_0x506a2d[_0x3e5b('0x4d')]);_0x41f7c8[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x506a2d[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x41f7c8[_0x3e5b('0x51')]=_0x41f7c8[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x41f7c8[_0x3e5b('0x51')]:_0x506a2d[_0x3e5b('0x46')];if(!_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x41f7c8[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x41f7c8[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x41f7c8['order']=qs['sort'](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x41f7c8[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_['pick'](_0x4c66b7[_0x3e5b('0x4d')],_0x506a2d['filters']));_0x41f7c8[_0x3e5b('0x57')][_0x3e5b('0x72')]=_0x12fcdf['id'];if(_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x59')]){_0x41f7c8[_0x3e5b('0x57')]=_['merge'](_0x41f7c8[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x41f7c8[_0x3e5b('0x51')],function(_0x2cedeb){var _0xf51840={};_0xf51840[_0x2cedeb]={'$like':'%'+_0x4c66b7[_0x3e5b('0x4d')]['filter']+'%'};return _0xf51840;})});}_0x41f7c8=_['merge']({},_0x41f7c8,_0x4c66b7[_0x3e5b('0x5b')]);return db['CannedAnswer'][_0x3e5b('0x2b')]({'where':_0x41f7c8[_0x3e5b('0x57')]})[_0x3e5b('0x1a')](function(_0x28d461){_0x53913d['count']=_0x28d461;if(_0x4c66b7['query'][_0x3e5b('0x5c')]){_0x41f7c8[_0x3e5b('0x5d')]=[{'all':!![]}];}return db[_0x3e5b('0x7b')][_0x3e5b('0x76')](_0x41f7c8);})[_0x3e5b('0x1a')](function(_0x1bbe3e){_0x53913d['rows']=_0x1bbe3e;return _0x53913d;});}})['then'](respondWithFilteredResult(_0xc78d12,_0x41f7c8))[_0x3e5b('0x23')](handleError(_0xc78d12,null));};exports[_0x3e5b('0x7c')]=function(_0x38db0c,_0x1ac1ad){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x38db0c[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x1ac1ad,null))[_0x3e5b('0x1a')](function(_0x3df23e){if(_0x3df23e){return _0x3df23e[_0x3e5b('0x7c')](_0x38db0c[_0x3e5b('0x4d')][_0x3e5b('0x78')]);}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x1ac1ad,null))[_0x3e5b('0x23')](handleError(_0x1ac1ad,null));};exports['addLogo']=function(_0x3d381b,_0x3e4458){_0x3d381b[_0x3e5b('0x64')][_0x3e5b('0x7d')]=_0x3d381b[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x3d381b[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x3e4458,null))[_0x3e5b('0x1a')](saveUpdates(_0x3d381b[_0x3e5b('0x64')],null))['then'](respondWithResult(_0x3e4458,null))[_0x3e5b('0x23')](handleError(_0x3e4458,null));};exports[_0x3e5b('0x80')]=function(_0x253b17,_0x111f23){_0x253b17[_0x3e5b('0x64')][_0x3e5b('0x81')]=_0x253b17[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x253b17[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x111f23,null))['then'](saveUpdates(_0x253b17[_0x3e5b('0x64')],null))[_0x3e5b('0x1a')](respondWithResult(_0x111f23,null))[_0x3e5b('0x23')](handleError(_0x111f23,null));};exports[_0x3e5b('0x82')]=function(_0x1f12d8,_0x1ab144){_0x1f12d8[_0x3e5b('0x64')][_0x3e5b('0x83')]=_0x1f12d8[_0x3e5b('0x7e')]['filename'];return db['ChatWebsite'][_0x3e5b('0x62')]({'where':{'id':_0x1f12d8[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x1ab144,null))['then'](saveUpdates(_0x1f12d8[_0x3e5b('0x64')],null))[_0x3e5b('0x1a')](respondWithResult(_0x1ab144,null))['catch'](handleError(_0x1ab144,null));};exports[_0x3e5b('0x84')]=function(_0x36c589,_0x3e6f62){_0x36c589[_0x3e5b('0x64')][_0x3e5b('0x85')]=_0x36c589[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x36c589[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3e6f62,null))[_0x3e5b('0x1a')](saveUpdates(_0x36c589['body'],null))[_0x3e5b('0x1a')](respondWithResult(_0x3e6f62,null))[_0x3e5b('0x23')](handleError(_0x3e6f62,null));};exports[_0x3e5b('0x86')]=function(_0x45b212,_0x272aab){var _0x5c8cf2=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x89'));var _0xe07809={'where':{'id':_0x45b212[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x7d')],'raw':!![]};var _0x61d17a=![];return require('../../config/license/util')[_0x3e5b('0x8a')]()[_0x3e5b('0x1a')](function(_0x5027ef){if(_0x5027ef){_0x61d17a=_0x5027ef[_0x3e5b('0x8b')];}})[_0x3e5b('0x1a')](function(){return db['ChatWebsite']['find'](_0xe07809);})['then'](handleEntityNotFound(_0x272aab,null))[_0x3e5b('0x1a')](function(_0x39dafa){if(_0x39dafa){if(!_[_0x3e5b('0x8c')](_0x39dafa['sitepic'])){if(fs['existsSync'](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server/files/images/logos/',_0x39dafa['sitepic']))&&_0x61d17a){_0x5c8cf2=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x8d'),_0x39dafa[_0x3e5b('0x7d')]);}}return _0x272aab[_0x3e5b('0x8e')](_0x5c8cf2);}})['catch'](handleError(_0x272aab,null));};exports[_0x3e5b('0x8f')]=function(_0x23c2e1,_0x6dc9ea){var _0x5c7523=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x90'));var _0x48d60d={'where':{'id':_0x23c2e1['params']['id']},'attributes':['id',_0x3e5b('0x81')],'raw':!![]};return db[_0x3e5b('0x4b')][_0x3e5b('0x62')](_0x48d60d)[_0x3e5b('0x1a')](handleEntityNotFound(_0x6dc9ea,null))[_0x3e5b('0x1a')](function(_0x55afb6){if(_0x55afb6){if(!_[_0x3e5b('0x8c')](_0x55afb6[_0x3e5b('0x81')])){if(fs[_0x3e5b('0x91')](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x55afb6['agentAvatar']))){_0x5c7523=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x55afb6['agentAvatar']);}}return _0x6dc9ea[_0x3e5b('0x8e')](_0x5c7523);}})[_0x3e5b('0x23')](handleError(_0x6dc9ea,null));};exports[_0x3e5b('0x93')]=function(_0x334086,_0x44b54b){var _0x4c1c66=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5f2b13={'where':{'id':_0x334086[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x83'),_0x3e5b('0x94')],'raw':!![]};return db['ChatWebsite'][_0x3e5b('0x62')](_0x5f2b13)['then'](handleEntityNotFound(_0x44b54b,null))['then'](function(_0x376d11){if(_0x376d11){if(!_[_0x3e5b('0x8c')](_0x376d11['customerAvatar'])){if(fs[_0x3e5b('0x91')](path['join'](config[_0x3e5b('0x88')],'server/files/images/avatars/',_0x376d11[_0x3e5b('0x83')]))&&_0x376d11[_0x3e5b('0x94')]){_0x4c1c66=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server/files/images/avatars/',_0x376d11[_0x3e5b('0x83')]);}}return _0x44b54b[_0x3e5b('0x8e')](_0x4c1c66);}})[_0x3e5b('0x23')](handleError(_0x44b54b,null));};exports[_0x3e5b('0x95')]=function(_0x9a8a57,_0x59762c){var _0x2ad1dc=path[_0x3e5b('0x87')](config['root'],_0x3e5b('0x96'));var _0x5cf336={'where':{'id':_0x9a8a57[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x85')],'raw':!![]};return db[_0x3e5b('0x4b')]['find'](_0x5cf336)['then'](handleEntityNotFound(_0x59762c,null))['then'](function(_0x571557){if(_0x571557){if(!_[_0x3e5b('0x8c')](_0x571557[_0x3e5b('0x85')])){if(fs[_0x3e5b('0x91')](path[_0x3e5b('0x87')](config['root'],'server/files/images/avatars/',_0x571557['systemAvatar']))){_0x2ad1dc=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x571557['systemAvatar']);}}return _0x59762c[_0x3e5b('0x8e')](_0x2ad1dc);}})[_0x3e5b('0x23')](handleError(_0x59762c,null));};function checkWebsiteInterval(_0x25a910){var _0x59be8d=_0x25a910[_0x3e5b('0x97')];if(!_0x59be8d){return Promise['resolve'](_0x25a910);}var _0x13a7c1=_0x25a910['timezone']||undefined;return _0x59be8d[_0x3e5b('0x98')](_0x13a7c1)[_0x3e5b('0x1a')](function(_0x408741){if(!_0x408741){throw new APIOutOfIntervalError();}return _0x25a910;});}exports[_0x3e5b('0x99')]=function(_0x10fc88,_0x127d75){var _0x370c16={'body':_0x10fc88['body'],'channel':_0x3e5b('0x9a')};var _0x49ea7b=[];var _0x259c6d=[];var _0x51b6ae={};var _0x1a2f6e=![];if(_0x10fc88['body']['id']){delete _0x10fc88[_0x3e5b('0x64')]['id'];}if(_[_0x3e5b('0x8c')](_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')])){throw new APIBadRequestError(_0x3e5b('0x9c'));}if(_[_0x3e5b('0x8c')](_0x10fc88[_0x3e5b('0x64')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x3e5b('0x9d')](_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x64')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x4a1cba=_0x10fc88[_0x3e5b('0x64')]['customerIp']&&_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x3d')];return db[_0x3e5b('0x9e')][_0x3e5b('0x70')]()[_0x3e5b('0x1a')](function(_0x4531d9){if(!_0x4531d9){throw new Error(_0x3e5b('0x9f'));}_0x49ea7b=Object[_0x3e5b('0x4e')](_0x4531d9)[_0x3e5b('0x59')](function(_0x5cb09d){return![_0x3e5b('0xa0'),_0x3e5b('0xa1')]['includes'](_0x5cb09d);});_0x259c6d=Object[_0x3e5b('0x4e')](_0x4531d9)[_0x3e5b('0x59')](function(_0x4bf241){return![_0x3e5b('0xa0'),_0x3e5b('0xa1'),'CompanyId',_0x3e5b('0xa2')]['includes'](_0x4bf241);});if(!_[_0x3e5b('0xa3')](_0x259c6d,_0x10fc88['body'][_0x3e5b('0xa4')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x259c6d[_0x3e5b('0x87')](',\x20'));}_0x51b6ae[_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xa4')]]=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')];})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x10fc88[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0xa5')],'as':_0x3e5b('0xa6'),'include':[{'model':db[_0x3e5b('0x9e')],'as':_0x3e5b('0xa7'),'where':_0x51b6ae,'limit':0x1,'order':[[_0x3e5b('0xa1'),_0x3e5b('0xa8')]]}]},{'model':db[_0x3e5b('0xa9')],'as':_0x3e5b('0xaa')},{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0x97'),'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0xab'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x3e5b('0x1a')](function(_0x240456){if(!_0x240456){throw new APINotFoundError(util[_0x3e5b('0x40')](_0x3e5b('0xac'),_0x10fc88[_0x3e5b('0x5f')]['id']));}if(_0x4a1cba){return checkWebsiteInterval(_0x240456);}return _0x240456;})[_0x3e5b('0x1a')](function(_0x40a017){_0x370c16[_0x3e5b('0xad')]=_0x40a017;_0x370c16[_0x3e5b('0xae')]=_[_0x3e5b('0xaf')](_0x40a017[_0x3e5b('0xaa')],['priority'],['asc']);if(_0x370c16['account'][_0x3e5b('0xaa')]){delete _0x370c16[_0x3e5b('0xad')][_0x3e5b('0xaa')];}_0x370c16[_0x3e5b('0xb0')]=_0x40a017[_0x3e5b('0xa6')]||{'id':_0x40a017[_0x3e5b('0xa2')]};if(_0x370c16[_0x3e5b('0xb0')]&&_0x370c16[_0x3e5b('0xb0')]['Contacts'][_0x3e5b('0x53')]){return _0x370c16[_0x3e5b('0xb0')][_0x3e5b('0xa7')][0x0];}var _0x27281e=_[_0x3e5b('0xb1')](_0x10fc88[_0x3e5b('0x64')],{'firstName':_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')],'ListId':_0x40a017[_0x3e5b('0xa2')]});_0x27281e[_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xa4')]]=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')];return db[_0x3e5b('0x9e')]['create'](_0x27281e,{'fields':_0x49ea7b,'raw':!![]});})[_0x3e5b('0x1a')](function(_0x42b8dc){_0x370c16[_0x3e5b('0xb2')]=_0x42b8dc;var _0x1b9c17=createInteractionObject(_0x10fc88[_0x3e5b('0x5f')]['id'],_0x10fc88[_0x3e5b('0x64')],_0x10fc88[_0x3e5b('0xb3')],_0x42b8dc);var _0x5b6312={'ChatWebsiteId':_0x10fc88[_0x3e5b('0x5f')]['id']};if(_0x10fc88[_0x3e5b('0x64')]['threadId']){_0x5b6312['threadId']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb4')];_0x5b6312[_0x3e5b('0xb5')]=![];return db[_0x3e5b('0xb6')][_0x3e5b('0x62')]({'where':_0x5b6312})['then'](function(_0x18bc27){var _0x34cec1=_0x10fc88[_0x3e5b('0x64')]['customerIp']&&_0x10fc88['body'][_0x3e5b('0x3d')];if(_0x18bc27){_0x1a2f6e=!![];return _0x18bc27;}else if(!_0x34cec1&&_0x18bc27&&_0x18bc27[_0x3e5b('0xb5')]){throw new APIConflictError(_0x3e5b('0xb7'));}_0x1b9c17['threadId']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb4')];_0x1b9c17['externalUrl']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb8')];return db[_0x3e5b('0xb6')][_0x3e5b('0x63')](_0x1b9c17);});}_0x5b6312[_0x3e5b('0xb9')]=_0x42b8dc['id'];if(_0x10fc88['body'][_0x3e5b('0xba')]&&_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xba')]['id']){_0x5b6312['id']=_0x10fc88['body'][_0x3e5b('0xba')]['id'];return db[_0x3e5b('0xb6')]['find']({'where':_0x5b6312})['then'](function(_0x2f56d7){var _0x329531=_0x10fc88['body'][_0x3e5b('0xbb')]&&_0x10fc88['body']['referer'];if(!_0x329531&&_0x2f56d7&&_0x2f56d7['closed']){throw new APIConflictError(_0x3e5b('0xb7'));}else if(_0x2f56d7){_0x1a2f6e=!![];return _0x2f56d7;}else{return db[_0x3e5b('0xb6')][_0x3e5b('0x63')](_0x1b9c17);}});}return db[_0x3e5b('0xb6')]['create'](_0x1b9c17);})['then'](function(_0x31dd7a){if(!_0x1a2f6e){return _0x31dd7a;}var _0x2af831={'from':(_0x370c16[_0x3e5b('0xb2')][_0x3e5b('0x3a')]||'')+'\x20'+(_0x370c16['contact'][_0x3e5b('0x3b')]||'')};if(_0x10fc88['body'][_0x3e5b('0xb4')]&&_0x10fc88['body']['messageId']&&_0x10fc88[_0x3e5b('0x64')]['threadId']!=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xbc')]){_0x2af831[_0x3e5b('0xb4')]=_0x10fc88['body']['messageId'];}return _0x31dd7a['update'](_0x2af831);})['then'](function(_0x5d655f){_0x370c16[_0x3e5b('0xba')]=_0x5d655f[_0x3e5b('0x2f')]({'plain':!![]});_0x370c16[_0x3e5b('0xba')][_0x3e5b('0xbd')]=!_0x1a2f6e;if(_0x370c16['interaction'][_0x3e5b('0xbd')]){if(_0x370c16[_0x3e5b('0xad')][_0x3e5b('0xbe')]){_0x370c16[_0x3e5b('0xae')][_0x3e5b('0xbf')]({'id':0x0,'priority':_0x370c16[_0x3e5b('0xae')]['length']+0x1,'app':_0x3e5b('0xc0'),'appdata':_0x3e5b('0xc1'),'interval':_0x3e5b('0xc2')});}}return db[_0x3e5b('0xc3')][_0x3e5b('0x63')]({'body':_0x10fc88['body'][_0x3e5b('0x64')],'ChatWebsiteId':_0x10fc88[_0x3e5b('0x5f')]['id'],'ChatInteractionId':_0x5d655f['id'],'direction':'in','ContactId':_0x370c16['contact']['id'],'AttachmentId':_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xc4')]});})[_0x3e5b('0x1a')](function(_0x34c414){_0x370c16['message']=_0x34c414;if(!_0x370c16['interaction'][_0x3e5b('0xc5')]){return;}return db[_0x3e5b('0xc6')][_0x3e5b('0x62')]({'attributes':['id','name'],'where':{'id':_0x370c16['interaction']['UserId']}});})[_0x3e5b('0x1a')](function(_0x2be7d4){if(_0x2be7d4){_0x370c16['applications'][_0x3e5b('0xc7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2be7d4[_0x3e5b('0x33')]+','+(_0x370c16[_0x3e5b('0xad')][_0x3e5b('0xc8')]||0xa),'interval':_0x3e5b('0xc2')});_0x370c16[_0x3e5b('0xc9')]=!![];}if(!_0x370c16['interaction']['queueId']){return;}return db[_0x3e5b('0xca')]['find']({'attributes':['id',_0x3e5b('0x33')],'where':{'id':_0x370c16[_0x3e5b('0xba')][_0x3e5b('0xcb')]}});})['then'](function(_0x18621c){if(_0x18621c){_0x370c16[_0x3e5b('0xae')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x18621c[_0x3e5b('0x33')]+','+(_0x370c16['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x3e5b('0xc2')});}return respondWithRpcPromise(_0x3e5b('0xcc'),_0x3e5b('0xcd'),_0x370c16);})[_0x3e5b('0x1a')](function(_0x37943a){respondWithRpcPromise(_0x3e5b('0xce'),_0x3e5b('0xce'),{'event':_0x3e5b('0x99'),'message':_0x37943a},client9002);return _0x37943a;})['then'](respondWithResult(_0x127d75,null))['catch'](APIHandleError(_0x127d75));};exports[_0x3e5b('0xcf')]=function(_0x5750df,_0x5a26d9){var _0x2d8ef1,_0x556e15,_0x1fe234;var _0x1f0764=[];var _0x1eae47={};var _0x24f71b=_0x5750df[_0x3e5b('0xd0')]||[];var _0x242093=[];var _0x1b1564;return db[_0x3e5b('0x9e')][_0x3e5b('0x70')]()[_0x3e5b('0x1a')](function(_0x4ba35e){if(!_0x4ba35e){throw new db[(_0x3e5b('0xd1'))]['ValidationError']('no\x20available\x20attributes');}_0x1f0764=_[_0x3e5b('0xd2')](_[_0x3e5b('0x4e')](_0x4ba35e),['createdAt',_0x3e5b('0xa1'),_0x3e5b('0xd3'),_0x3e5b('0xa2')]);if(_0x5750df[_0x3e5b('0x64')]['id']){delete _0x5750df['body']['id'];}if(_[_0x3e5b('0x8c')](_0x5750df['body'][_0x3e5b('0x9b')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))]['ValidationError'](_0x3e5b('0xd4')));}if(_[_0x3e5b('0x8c')](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x64')])||_0x5750df[_0x3e5b('0x64')]['body']===''){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))][(_0x3e5b('0xd5'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db['Sequelize'][(_0x3e5b('0xd5'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f0764));}if(!_[_0x3e5b('0xa3')](_0x1f0764,_0x5750df['body'][_0x3e5b('0xd6')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))][(_0x3e5b('0xd5'))](_0x3e5b('0xd7')+_0x1f0764));}_0x1eae47[_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')]]=_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')];})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x5750df[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0xa5')],'as':_0x3e5b('0xa6')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x5a26d9,null))[_0x3e5b('0x1a')](function(_0x38295b){if(_0x38295b&&_0x38295b[_0x3e5b('0xa6')]){_0x556e15=_0x38295b;var _0x533bbb=_[_0x3e5b('0xb1')](_0x5750df[_0x3e5b('0x64')],{'firstName':_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')],'phone':_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')],'ListId':_0x38295b[_0x3e5b('0xa2')]});_0x533bbb[_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')]]=_0x5750df[_0x3e5b('0x64')]['from'];return db[_0x3e5b('0x9e')][_0x3e5b('0xd8')]({'where':_0x1eae47,'defaults':_0x533bbb});}})['spread'](function(_0x1fe8af){if(_0x1fe8af){_0x1fe234=_0x1fe8af;var _0x104a3f=fs[_0x3e5b('0xd9')](path[_0x3e5b('0x87')](config['root'],_0x3e5b('0xda')),'utf8');var _0x3e907b=ejs[_0x3e5b('0xdb')](_0x104a3f,{'body':_['toPairs'](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x64')]),'bodyTitle':_0x556e15['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x3e907b,'plainBody':htmlToText[_0x3e5b('0xdc')](_0x3e907b),'ContactId':_0x1fe8af['id'],'ChatWebsiteId':_0x556e15['id']});}})[_0x3e5b('0x1a')](function(_0x346598){_0x1b1564=_0x346598;if(_0x24f71b[_0x3e5b('0x53')]){var _0x1e8990=_0x24f71b[_0x3e5b('0x4a')](function(_0x38cfb0){return{'name':_0x38cfb0[_0x3e5b('0xdd')],'basename':_0x38cfb0[_0x3e5b('0x7f')],'type':_0x38cfb0[_0x3e5b('0xde')],'ChatOfflineMessageId':_0x346598['id']};});_0x242093=_0x1e8990[_0x3e5b('0x4a')](_0x34d441=>{var _0x13b073={'filename':_0x34d441['name'],'path':path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server','files','attachments',_0x3e5b('0xdf'),_0x34d441['basename'])};return _0x13b073;});if(!_0x556e15[_0x3e5b('0xe0')]){return db[_0x3e5b('0xe1')][_0x3e5b('0xe2')](function(_0x7a013d){return db['Attachment']['bulkCreate'](_0x1e8990,{'transaction':_0x7a013d});});}}})[_0x3e5b('0x1a')](function(){if(_0x1b1564){_0x2d8ef1=_0x1b1564;return db[_0x3e5b('0xe3')][_0x3e5b('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0x3e5b('0xe4')],'as':_0x3e5b('0xe5'),'raw':!![],'include':[{'model':db[_0x3e5b('0xe6')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x110efe){if(_0x110efe&&_0x110efe[_0x3e5b('0xe5')]&&_0x556e15['forwardOffline']&&_0x556e15['forwardOfflineAddress']){var _0x11311d=_0x110efe[_0x3e5b('0xe7')]();return respondWithRpcPromise(_0x3e5b('0xe8'),_0x3e5b('0xe9'),{'account':_0x11311d,'message':{'from':util['format'](_0x3e5b('0xea'),_0x110efe[_0x3e5b('0x33')],_0x110efe[_0x3e5b('0xeb')]||_0x110efe[_0x3e5b('0xe5')][_0x3e5b('0x6a')]),'to':_0x556e15[_0x3e5b('0xec')],'subject':_0x556e15[_0x3e5b('0xed')],'html':_0x2d8ef1[_0x3e5b('0x64')],'attachments':_0x242093}},client9003)[_0x3e5b('0x1a')](function(){return _0x2d8ef1;})['catch'](function(_0x5756f9){logger['error'](_0x5756f9);});}})[_0x3e5b('0x1a')](function(){if(_0x556e15&&_0x556e15[_0x3e5b('0xe0')]&&_0x556e15[_0x3e5b('0xee')]){var _0x43d8ed=[];if(_0x24f71b[_0x3e5b('0x53')]){_0x43d8ed=_0x24f71b[_0x3e5b('0x4a')](function(_0x4da8aa){return{'name':_0x4da8aa['originalname'],'basename':_0x4da8aa[_0x3e5b('0x7f')],'type':_0x4da8aa[_0x3e5b('0xde')],'ChatOfflineMessageId':_0x1b1564['id']};});}var _0x180906;if(!_[_0x3e5b('0x8c')](_0x556e15[_0x3e5b('0xef')])){var _0x1f0412=_[_0x3e5b('0x4a')](_0x5750df['body'],function(_0x45114e){return _0x45114e;});var _0x35430b=_[_0x3e5b('0xf0')](_0x1f0412)[0x0];var _0x386a66=_[_0x3e5b('0xf1')](_0x35430b,function(_0x434e78){return _0x434e78;});_0x180906=_0x386a66[0x1][_0x556e15[_0x3e5b('0xef')]];}var _0x1583d7={'from':_0x1fe234[_0x3e5b('0xeb')],'firstName':_0x1fe234[_0x3e5b('0x3a')],'lastName':_0x1fe234[_0x3e5b('0x3b')],'mapKey':'email','message':{'from':_0x1fe234[_0x3e5b('0xeb')],'to':_0x556e15['MailAccount']['email'],'cc':'','subject':_[_0x3e5b('0x8c')](_0x180906)?_0x556e15[_0x3e5b('0xed')]:_0x180906,'messageId':'','sentAt':new Date(),'attach':_0x43d8ed[_0x3e5b('0x53')],'attachments':_0x43d8ed,'originChannel':_0x3e5b('0xf2'),'ChatWebsiteId':_0x556e15['id'],'ChatOfflineMessageId':_0x2d8ef1['id'],'originTo':_0x556e15[_0x3e5b('0xe3')]['email']},'body':_0x2d8ef1['body']};var _0x3a3e20={'account':{'id':_0x556e15[_0x3e5b('0xee')]},'body':_0x1583d7,'log':_0x3e5b('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0x3e5b('0xf4'),_0x3a3e20,client9001)[_0x3e5b('0x1a')](function(){return _0x2d8ef1;})[_0x3e5b('0x23')](function(_0x5e42d4){logger[_0x3e5b('0x1e')](_0x5e42d4);});}return;})[_0x3e5b('0x1a')](function(){if(_0x2d8ef1){return _0x2d8ef1;}})[_0x3e5b('0x1a')](respondWithResult(_0x5a26d9,null))[_0x3e5b('0x23')](function(){for(var _0x1a5048 of _0x24f71b){var _0x3dc35c=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0xf5'),_0x3e5b('0xd0'),_0x3e5b('0xf6'),_0x3e5b('0xdf'),_0x1a5048[_0x3e5b('0x7f')]);fs_extra['remove'](_0x3dc35c)[_0x3e5b('0x23')](function(_0x555225){logger[_0x3e5b('0x1e')](_0x3e5b('0xf7'),_0x3dc35c,_0x555225);});}});};exports[_0x3e5b('0xf8')]=function(_0x42db1f,_0x4c8745){return db[_0x3e5b('0xb6')][_0x3e5b('0x62')]({'where':{'id':_0x42db1f[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4c8745,null))[_0x3e5b('0x1a')](function(_0x332a9e){if(_0x332a9e){return _0x332a9e['addInteraction'](_0x42db1f[_0x3e5b('0x64')]['ids'],_[_0x3e5b('0xf9')](_0x42db1f[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{});}})[_0x3e5b('0x1a')](respondWithResult(_0x4c8745,null))[_0x3e5b('0x23')](handleError(_0x4c8745,null));};exports[_0x3e5b('0xfa')]=function(_0x362b4a,_0x64d132){var _0x3fd595={'raw':![],'where':{}};var _0x5382e6={};var _0x50e28d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x362b4a['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x64d132,null))['then'](function(_0x2aef9e){if(_0x2aef9e){_0x5382e6[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0xb6')][_0x3e5b('0x4c')]);_0x5382e6['query']=_[_0x3e5b('0x4e')](_0x362b4a['query']);_0x5382e6['filters']=_[_0x3e5b('0x50')](_0x5382e6['model'],_0x5382e6[_0x3e5b('0x4d')]);_0x3fd595['attributes']=_[_0x3e5b('0x50')](_0x5382e6[_0x3e5b('0x46')],qs['fields'](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x3fd595[_0x3e5b('0x51')]=_0x3fd595[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x3fd595['attributes']:_0x5382e6['model'];if(!_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x3fd595[_0x3e5b('0x2a')]=qs['limit'](_0x362b4a['query']['limit']);_0x3fd595[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x3fd595[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x3fd595[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x362b4a[_0x3e5b('0x4d')],_0x5382e6['filters']));_0x3fd595[_0x3e5b('0x57')][_0x3e5b('0x72')]=_0x2aef9e['id'];if(_0x362b4a['query'][_0x3e5b('0x59')]){_0x3fd595[_0x3e5b('0x57')]=_['merge'](_0x3fd595[_0x3e5b('0x57')],{'$or':_['map'](_0x3fd595[_0x3e5b('0x51')],function(_0x5a2747){var _0x292214={};_0x292214[_0x5a2747]={'$like':'%'+_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x292214;})});}_0x3fd595=_[_0x3e5b('0x61')]({},_0x3fd595,_0x362b4a[_0x3e5b('0x5b')]);return db[_0x3e5b('0xb6')][_0x3e5b('0x2b')]({'where':_0x3fd595[_0x3e5b('0x57')]})[_0x3e5b('0x1a')](function(_0x5f0004){_0x50e28d[_0x3e5b('0x2b')]=_0x5f0004;if(_0x362b4a[_0x3e5b('0x4d')]['includeAll']){_0x3fd595[_0x3e5b('0x5d')]=[{'model':db[_0x3e5b('0x9e')],'as':_0x3e5b('0xfc'),'required':![]},{'model':db['User'],'as':_0x3e5b('0xfd'),'attributes':[_0x3e5b('0x33'),_0x3e5b('0xfe'),_0x3e5b('0xff')],'required':![]},{'model':db['Tag'],'as':_0x3e5b('0x100'),'attributes':['id',_0x3e5b('0x33'),'color'],'where':_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x101')]?{'id':_0x362b4a['query']['tag']}:undefined,'required':_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x101')]?!![]:![]}];}return db[_0x3e5b('0xb6')][_0x3e5b('0x76')](_0x3fd595);})[_0x3e5b('0x1a')](function(_0x3fb849){_0x50e28d['rows']=_0x3fb849;return _0x50e28d;});}})['then'](respondWithFilteredResult(_0x64d132,_0x3fd595))['catch'](handleError(_0x64d132,null));};exports[_0x3e5b('0x102')]=function(_0x2ba7c8,_0x5a0553){var _0x3c619a=0x0;var _0x927b25=0x0;var _0x4377be=![];var _0x41269e;var _0x1384a7;return db['ChatWebsite'][_0x3e5b('0x62')]({'where':{'id':_0x2ba7c8['params']['id']},'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0x97'),'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0xab'),'attributes':['id',_0x3e5b('0x103')]}]}]})['then'](handleEntityNotFound(_0x5a0553,null))[_0x3e5b('0x1a')](function(_0x145d81){if(_0x145d81){_0x41269e=_0x145d81;return _0x145d81[_0x3e5b('0x104')]({'raw':!![]});}})['then'](function(_0xe4197d){if(_0x41269e){if(_0xe4197d){_0x1384a7=_0xe4197d;}}return require(_0x3e5b('0x105'))[_0x3e5b('0x8a')]();})[_0x3e5b('0x1a')](function(_0x101f78){if(_0x101f78){_0x927b25=_0x101f78[_0x3e5b('0x106')];_0x4377be=_0x101f78[_0x3e5b('0x8b')];}})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0xb6')][_0x3e5b('0x2b')]({'where':{'closed':![]}});})[_0x3e5b('0x1a')](function(_0x2cfbdb){_0x3c619a=_0x2cfbdb;if(_0x927b25&&_0x2cfbdb>_0x927b25){return db[_0x3e5b('0x107')][_0x3e5b('0x75')]({'where':{'id':0x1}})[_0x3e5b('0x1a')](function(_0x315efe){if(_0x315efe){_0x315efe[_0x3e5b('0x108')](_0x3e5b('0x109'));}});}})[_0x3e5b('0x1a')](function(){var _0x4d20ac=_0x41269e[_0x3e5b('0x97')];var _0x385726=_0x41269e[_0x3e5b('0x10a')]||undefined;return _0x4d20ac?_0x4d20ac[_0x3e5b('0x98')](_0x385726):!![];})[_0x3e5b('0x1a')](function(_0x2a5704){var _0x2279fe=fs[_0x3e5b('0xd9')](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x10b')),'utf8');var _0x57712=_0x3e5b('0x10c');var _0x5a6b89=![];var _0x3a0d03,_0x174147;if(_0x2ba7c8['headers'][_0x3e5b('0x3d')]){_0x3a0d03=new URL(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x3d')])['origin'];}else if(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x10d')]){_0x3a0d03=new URL(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x10d')])[_0x3e5b('0x10d')];}else{_0x3a0d03='http://localhost:9000';}_0x174147=typeof _0x41269e[_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x62')](function(_0x279916){return wildcardUtils[_0x3e5b('0x10e')](_0x279916,_0x3a0d03);})!==_0x3e5b('0x29');var _0x1064b7={'chatVersion':_0x57712,'chatWebsiteAddressOrigin':_0x174147?_0x3a0d03:_0x41269e[_0x3e5b('0x65')],'remote':_0x41269e[_0x3e5b('0x10f')],'query':querystring[_0x3e5b('0x1d')](_[_0x3e5b('0x61')](_0x41269e[_0x3e5b('0x2f')]({'plain':!![]}),{'customerIp':_0x2ba7c8['headers'][_0x3e5b('0x110')]||_0x2ba7c8['headers']['x-real-ip']||_0x2ba7c8[_0x3e5b('0x111')]['remoteAddress']||_0x2ba7c8['ip'],'referer':_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x3d')],'openedInteractions':_0x3c619a,'maxInteractions':_0x927b25,'virtual':_0x4377be['virtual'],'online':_0x2a5704,'custom':_0x4377be,'address':_0x174147?_0x3a0d03:null}))[_0x3e5b('0x112')](/'/g,'\x5c\x27')};_0x5a0553[_0x3e5b('0x34')](ejs[_0x3e5b('0xdb')](Mustache[_0x3e5b('0xdb')](_0x2279fe,_0x1064b7),{'proactiveActions':_0x1384a7,'alignment':_0x41269e['alignment'],'verticalAlignment':_0x41269e[_0x3e5b('0x113')],'div_color':_0x41269e[_0x3e5b('0x114')],'labelText':_0x41269e[_0x3e5b('0x115')],'text_color':_0x41269e[_0x3e5b('0x116')],'text_button_color':_0x41269e[_0x3e5b('0x117')],'button_color':_0x41269e[_0x3e5b('0x118')],'background_color':_0x41269e[_0x3e5b('0x119')],'hideWhenOffline':_0x41269e[_0x3e5b('0x11a')],'intervalId':_0x41269e[_0x3e5b('0x11b')],'isDevelopment':_0x5a6b89,'chatVersion':_0x57712}));})[_0x3e5b('0x23')](handleError(_0x5a0553,null));};exports['addApplications']=function(_0x44bebe,_0x42320e){var _0x20d4a2=_0x44bebe[_0x3e5b('0x5f')]['id'];var _0x53e2d0=_0x44bebe[_0x3e5b('0x64')];var _0x33c246=0xc8;var _0x179eb4=null;return db[_0x3e5b('0xe1')][_0x3e5b('0xe2')]({'isolationLevel':db[_0x3e5b('0xe1')][_0x3e5b('0x11c')][_0x3e5b('0x11d')][_0x3e5b('0x11e')]},function(_0x4fecda){return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x20d4a2},'transaction':_0x4fecda})[_0x3e5b('0x1a')](function(_0xc33124){if(_0xc33124){return db[_0x3e5b('0xa9')][_0x3e5b('0x2e')]({'where':{'ChatWebsiteId':_0x20d4a2},'transaction':_0x4fecda})[_0x3e5b('0x1a')](function(){var _0x4fcaf4=_[_0x3e5b('0x4a')](_0x53e2d0,function(_0x2fd7f8){_0x2fd7f8[_0x3e5b('0x72')]=_0x20d4a2;return _0x2fd7f8;});return db[_0x3e5b('0xa9')]['bulkCreate'](_0x4fcaf4,{'transaction':_0x4fecda});});}else{_0x33c246=0x194;_0x179eb4=[];}});})[_0x3e5b('0x1a')](function(){if(_0x33c246!==0x194){return db['ChatApplication'][_0x3e5b('0x11f')]({'where':{'ChatWebsiteId':_0x20d4a2},'order':'priority'})[_0x3e5b('0x1a')](function(_0x24361e){_0x179eb4=_0x24361e;});}})[_0x3e5b('0x23')](function(_0x4e95be){_0x33c246=0x1f4;logger['error'](_0x4e95be[_0x3e5b('0x32')]);if(_0x4e95be['name']){delete _0x4e95be[_0x3e5b('0x33')];}_0x179eb4=_0x4e95be;})[_0x3e5b('0x120')](function(){if(_0x179eb4===null){_0x42320e[_0x3e5b('0x24')](_0x33c246);}else{if(_0x33c246===0x1f4){_0x42320e[_0x3e5b('0x25')](_0x33c246)[_0x3e5b('0x34')](_0x179eb4);}else{_0x42320e['status'](_0x33c246)[_0x3e5b('0x27')](_0x179eb4);}}});};exports[_0x3e5b('0x121')]=function(_0x4ea05f,_0x3674dd){var _0x39e7bf={};var _0x31896f={};var _0x1be5f8;var _0x372e8b;return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x4ea05f['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x3674dd,null))['then'](function(_0x4321c4){if(_0x4321c4){_0x1be5f8=_0x4321c4;_0x31896f[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0xa9')][_0x3e5b('0x4c')]);_0x31896f[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4ea05f[_0x3e5b('0x4d')]);_0x31896f[_0x3e5b('0x4f')]=_['intersection'](_0x31896f[_0x3e5b('0x46')],_0x31896f['query']);_0x39e7bf[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x31896f[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x39e7bf[_0x3e5b('0x51')]=_0x39e7bf[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x39e7bf['attributes']:_0x31896f[_0x3e5b('0x46')];_0x39e7bf[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x39e7bf[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x4ea05f[_0x3e5b('0x4d')],_0x31896f[_0x3e5b('0x4f')]));if(_0x4ea05f[_0x3e5b('0x4d')]['filter']){_0x39e7bf[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x39e7bf[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x39e7bf[_0x3e5b('0x51')],function(_0x4c94ea){var _0x853439={};_0x853439[_0x4c94ea]={'$like':'%'+_0x4ea05f[_0x3e5b('0x4d')]['filter']+'%'};return _0x853439;})});}_0x39e7bf=_[_0x3e5b('0x61')]({},_0x39e7bf,_0x4ea05f[_0x3e5b('0x5b')]);return _0x1be5f8['getApplications'](_0x39e7bf);}})[_0x3e5b('0x1a')](function(_0x3dec64){if(_0x3dec64){_0x372e8b=_0x3dec64[_0x3e5b('0x53')];if(!_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x39e7bf[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x39e7bf[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4ea05f['query'][_0x3e5b('0x28')]);}return _0x1be5f8[_0x3e5b('0x121')](_0x39e7bf);}})[_0x3e5b('0x1a')](function(_0x2149df){if(_0x2149df){return _0x2149df?{'count':_0x372e8b,'rows':_0x2149df}:null;}})[_0x3e5b('0x1a')](respondWithResult(_0x3674dd,null))[_0x3e5b('0x23')](handleError(_0x3674dd,null));};exports['addProactiveActions']=function(_0xf3179,_0x7efc5a){return db[_0x3e5b('0x122')]['find']({'where':{'id':_0xf3179[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7efc5a,null))[_0x3e5b('0x1a')](function(_0xcbca5a){if(_0xcbca5a){return _0xcbca5a['addProactiveActions'](_0xf3179[_0x3e5b('0x64')][_0x3e5b('0x78')],_[_0x3e5b('0xf9')](_0xf3179[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{});}})[_0x3e5b('0x1a')](respondWithResult(_0x7efc5a,null))[_0x3e5b('0x23')](handleError(_0x7efc5a,null));};exports['getProactiveActions']=function(_0x52afba,_0x2d5599){var _0x4f4773={};var _0x24c8be={};var _0x5c8f64;var _0x58f4dc;return db[_0x3e5b('0x4b')]['findOne']({'where':{'id':_0x52afba['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x2d5599,null))[_0x3e5b('0x1a')](function(_0x25eda6){if(_0x25eda6){_0x5c8f64=_0x25eda6;_0x24c8be[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x123')][_0x3e5b('0x4c')]);_0x24c8be[_0x3e5b('0x4d')]=_['keys'](_0x52afba['query']);_0x24c8be[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x24c8be['model'],_0x24c8be[_0x3e5b('0x4d')]);_0x4f4773[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x24c8be['model'],qs[_0x3e5b('0x52')](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x4f4773[_0x3e5b('0x51')]=_0x4f4773[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x4f4773['attributes']:_0x24c8be[_0x3e5b('0x46')];_0x4f4773[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x4f4773[_0x3e5b('0x57')]=qs['filters'](_['pick'](_0x52afba[_0x3e5b('0x4d')],_0x24c8be['filters']));if(_0x52afba[_0x3e5b('0x4d')]['filter']){_0x4f4773['where']=_['merge'](_0x4f4773['where'],{'$or':_['map'](_0x4f4773['attributes'],function(_0x44c05a){var _0x4605e7={};_0x4605e7[_0x44c05a]={'$like':'%'+_0x52afba[_0x3e5b('0x4d')]['filter']+'%'};return _0x4605e7;})});}_0x4f4773=_[_0x3e5b('0x61')]({},_0x4f4773,_0x52afba[_0x3e5b('0x5b')]);return _0x5c8f64[_0x3e5b('0x104')](_0x4f4773);}})[_0x3e5b('0x1a')](function(_0x2c71b7){if(_0x2c71b7){_0x58f4dc=_0x2c71b7['length'];if(!_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x4f4773[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x52afba[_0x3e5b('0x4d')]['limit']);_0x4f4773[_0x3e5b('0x28')]=qs['offset'](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}return _0x5c8f64[_0x3e5b('0x104')](_0x4f4773);}})[_0x3e5b('0x1a')](function(_0x19e743){if(_0x19e743){return _0x19e743?{'count':_0x58f4dc,'rows':_0x19e743}:null;}})[_0x3e5b('0x1a')](respondWithResult(_0x2d5599,null))[_0x3e5b('0x23')](handleError(_0x2d5599,null));};exports[_0x3e5b('0x124')]=function(_0x2f56f7,_0x4f4124){var _0x5b3865=_0x2f56f7[_0x3e5b('0x4d')][_0x3e5b('0x125')]===_0x3e5b('0x126')?'offlineForm':_0x3e5b('0x127');return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'attributes':['id',_0x5b3865],'where':{'id':_0x2f56f7[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x4f4124,null))[_0x3e5b('0x1a')](function(_0x237cd0){if(_0x237cd0){var _0x4dfcc3=_0x237cd0[_0x5b3865];var _0x26c52b=_0x4dfcc3&&_0x4dfcc3[_0x3e5b('0x128')]?_0x4dfcc3['items']:[];_0x4f4124[_0x3e5b('0x34')]({'fromKey':_[_0x3e5b('0x8c')](_0x4dfcc3[_0x3e5b('0x129')])?undefined:_0x4dfcc3[_0x3e5b('0x129')],'count':_0x26c52b['length'],'rows':_0x26c52b});}})[_0x3e5b('0x23')](handleError(_0x4f4124,null));};exports['getOfflineMessages']=function(_0x1fe8da,_0x5df772){var _0x1b5c74={'raw':![],'where':{}};var _0x37dc9e={};var _0x5c7a01={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x1fe8da[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x5df772,null))[_0x3e5b('0x1a')](function(_0x35fb01){if(_0x35fb01){_0x37dc9e[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x12a')][_0x3e5b('0x4c')]);_0x37dc9e[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x1fe8da[_0x3e5b('0x4d')]);_0x37dc9e['filters']=_[_0x3e5b('0x50')](_0x37dc9e['model'],_0x37dc9e[_0x3e5b('0x4d')]);_0x1b5c74[_0x3e5b('0x51')]=_['intersection'](_0x37dc9e['model'],qs[_0x3e5b('0x52')](_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x1b5c74[_0x3e5b('0x51')]=_0x1b5c74[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x1b5c74['attributes']:_0x37dc9e['model'];if(!_0x1fe8da[_0x3e5b('0x4d')]['hasOwnProperty'](_0x3e5b('0x55'))){_0x1b5c74[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x1fe8da[_0x3e5b('0x4d')]['limit']);_0x1b5c74[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x1b5c74[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x1fe8da[_0x3e5b('0x4d')]['sort']);_0x1b5c74[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x1fe8da[_0x3e5b('0x4d')],_0x37dc9e[_0x3e5b('0x4f')]));_0x1b5c74['where'][_0x3e5b('0x72')]=_0x35fb01['id'];if(_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x59')]){_0x1b5c74[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x1b5c74[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x1b5c74[_0x3e5b('0x51')],function(_0xe37b2d){var _0x3f7969={};_0x3f7969[_0xe37b2d]={'$like':'%'+_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x3f7969;})});}_0x1b5c74=_['merge']({},_0x1b5c74,_0x1fe8da[_0x3e5b('0x5b')]);return db[_0x3e5b('0x12a')]['count']({'where':_0x1b5c74['where']})[_0x3e5b('0x1a')](function(_0x305242){_0x5c7a01[_0x3e5b('0x2b')]=_0x305242;if(_0x1fe8da['query'][_0x3e5b('0x5c')]){_0x1b5c74[_0x3e5b('0x5d')]=[{'all':!![]}];}else{_0x1b5c74[_0x3e5b('0x5d')]=[{'model':db[_0x3e5b('0x9e')],'as':'Contact','required':![]},{'model':db[_0x3e5b('0x12b')],'as':'Attachments','required':![]}];}return db[_0x3e5b('0x12a')]['findAll'](_0x1b5c74);})[_0x3e5b('0x1a')](function(_0x1ad093){_0x5c7a01[_0x3e5b('0x12c')]=_0x1ad093;return _0x5c7a01;});}})['then'](respondWithFilteredResult(_0x5df772,_0x1b5c74))[_0x3e5b('0x23')](handleError(_0x5df772,null));};exports[_0x3e5b('0x12d')]=function(_0x1e909b,_0x422e9f){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x1e909b[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x422e9f,null))[_0x3e5b('0x1a')](function(_0x318838){if(_0x318838){return _0x318838[_0x3e5b('0x12d')](_0x1e909b[_0x3e5b('0x64')][_0x3e5b('0x78')],_[_0x3e5b('0xf9')](_0x1e909b[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{})[_0x3e5b('0x12e')](function(_0x329c7e){for(var _0x4a2afa=0x0;_0x4a2afa<_0x1e909b[_0x3e5b('0x64')][_0x3e5b('0x78')][_0x3e5b('0x53')];_0x4a2afa+=0x1){socket[_0x3e5b('0x12f')](_0x3e5b('0x130'),{'UserId':Number(_0x1e909b['body'][_0x3e5b('0x78')][_0x4a2afa]),'ChatWebsiteId':Number(_0x1e909b[_0x3e5b('0x5f')]['id'])});}return _0x329c7e;});}})[_0x3e5b('0x1a')](respondWithResult(_0x422e9f,null))[_0x3e5b('0x23')](handleError(_0x422e9f,null));};exports['removeAgents']=function(_0x32a075,_0x33cc14){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x32a075['params']['id']}})['then'](handleEntityNotFound(_0x33cc14,null))['then'](function(_0x5cb446){if(_0x5cb446){return _0x5cb446[_0x3e5b('0x131')](_0x32a075['query'][_0x3e5b('0x78')])[_0x3e5b('0x1a')](function(){if(_['isArray'](_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')])){for(var _0x2c4edd=0x0;_0x2c4edd<_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')][_0x3e5b('0x53')];_0x2c4edd+=0x1){socket[_0x3e5b('0x12f')](_0x3e5b('0x132'),{'UserId':Number(_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')][_0x2c4edd]),'ChatWebsiteId':Number(_0x32a075['params']['id'])});}}else{socket[_0x3e5b('0x12f')]('userChatWebsite:remove',{'UserId':Number(_0x32a075[_0x3e5b('0x4d')]['ids']),'ChatWebsiteId':Number(_0x32a075[_0x3e5b('0x5f')]['id'])});}});}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x33cc14,null))['catch'](handleError(_0x33cc14,null));};exports[_0x3e5b('0x133')]=function(_0x381f5c,_0x586800){var _0x1373cc={};var _0x6ca7ba={};var _0x5d596f;var _0x5a52a3;return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x381f5c[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x586800,null))[_0x3e5b('0x1a')](function(_0x207b1a){if(_0x207b1a){_0x5d596f=_0x207b1a;_0x6ca7ba[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0xc6')][_0x3e5b('0x4c')]);_0x6ca7ba[_0x3e5b('0x4d')]=_['keys'](_0x381f5c[_0x3e5b('0x4d')]);_0x6ca7ba[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x6ca7ba[_0x3e5b('0x46')],_0x6ca7ba[_0x3e5b('0x4d')]);_0x1373cc[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x6ca7ba[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x381f5c[_0x3e5b('0x4d')]['fields']));_0x1373cc[_0x3e5b('0x51')]=_0x1373cc[_0x3e5b('0x51')]['length']?_0x1373cc[_0x3e5b('0x51')]:_0x6ca7ba[_0x3e5b('0x46')];_0x1373cc[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x381f5c[_0x3e5b('0x4d')]['sort']);_0x1373cc['where']=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x381f5c[_0x3e5b('0x4d')],_0x6ca7ba[_0x3e5b('0x4f')]));if(_0x381f5c['query']['filter']){_0x1373cc[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x1373cc['where'],{'$or':_[_0x3e5b('0x4a')](_0x1373cc[_0x3e5b('0x51')],function(_0x1ebd4c){var _0x1db91a={};_0x1db91a[_0x1ebd4c]={'$like':'%'+_0x381f5c['query'][_0x3e5b('0x59')]+'%'};return _0x1db91a;})});}_0x1373cc=_['merge']({},_0x1373cc,_0x381f5c['options']);return _0x5d596f[_0x3e5b('0x133')](_0x1373cc);}})[_0x3e5b('0x1a')](function(_0x4a966d){if(_0x4a966d){_0x5a52a3=_0x4a966d[_0x3e5b('0x53')];if(!_0x381f5c['query'][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x1373cc['limit']=qs[_0x3e5b('0x2a')](_0x381f5c[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x1373cc[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x381f5c[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}return _0x5d596f[_0x3e5b('0x133')](_0x1373cc);}})['then'](function(_0x3ff5c4){if(_0x3ff5c4){return _0x3ff5c4?{'count':_0x5a52a3,'rows':_0x3ff5c4}:null;}})['then'](respondWithResult(_0x586800,null))[_0x3e5b('0x23')](handleError(_0x586800,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3dfa82c..22c737c 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 _0x6a88=['ChatWebsite','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6a88,0xa9));var _0x86a8=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x6a88[_0x187d80];return _0x498a77;};'use strict';var EventEmitter=require(_0x86a8('0x0'));var ChatWebsite=require(_0x86a8('0x1'))['db'][_0x86a8('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x86a8('0x3')](0x0);var events={'afterCreate':_0x86a8('0x4'),'afterUpdate':_0x86a8('0x5'),'afterDestroy':_0x86a8('0x6')};function emitEvent(_0x510057){return function(_0x21afeb,_0x5aa681,_0x59313b){ChatWebsiteEvents[_0x86a8('0x7')](_0x510057+':'+_0x21afeb['id'],_0x21afeb);ChatWebsiteEvents[_0x86a8('0x7')](_0x510057,_0x21afeb);_0x59313b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x86a8('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x0f3c=['exports','events','../../mysqldb','update','remove','emit','hook'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x0f3c,0x189));var _0xc0f3=function(_0x22f86d,_0x3ad632){_0x22f86d=_0x22f86d-0x0;var _0x137d5d=_0x0f3c[_0x22f86d];return _0x137d5d;};'use strict';var EventEmitter=require(_0xc0f3('0x0'));var ChatWebsite=require(_0xc0f3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0f3('0x2'),'afterDestroy':_0xc0f3('0x3')};function emitEvent(_0xa6a874){return function(_0x2d1f5d,_0x1be43d,_0x279717){ChatWebsiteEvents[_0xc0f3('0x4')](_0xa6a874+':'+_0x2d1f5d['id'],_0x2d1f5d);ChatWebsiteEvents[_0xc0f3('0x4')](_0xa6a874,_0x2d1f5d);_0x279717(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc0f3('0x5')](e,emitEvent(event));}}module[_0xc0f3('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 130377b..6d8b960 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 _0x4bb6=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1be72f,_0x50ca93){var _0xbfdb40=function(_0x572568){while(--_0x572568){_0x1be72f['push'](_0x1be72f['shift']());}};_0xbfdb40(++_0x50ca93);}(_0x4bb6,0x1e5));var _0x64bb=function(_0xe069b2,_0x1259a5){_0xe069b2=_0xe069b2-0x0;var _0x4a9d61=_0x4bb6[_0xe069b2];return _0x4a9d61;};'use strict';var _=require(_0x64bb('0x0'));var util=require(_0x64bb('0x1'));var logger=require('../../config/logger')(_0x64bb('0x2'));var moment=require('moment');var BPromise=require(_0x64bb('0x3'));var rp=require(_0x64bb('0x4'));var fs=require('fs');var path=require(_0x64bb('0x5'));var rimraf=require(_0x64bb('0x6'));var config=require(_0x64bb('0x7'));var attributes=require(_0x64bb('0x8'));module[_0x64bb('0x9')]=function(_0x1422eb,_0x5cdff5){return _0x1422eb[_0x64bb('0xa')](_0x64bb('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef6=['ChatWebsite','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','define'];(function(_0x44066b,_0x126423){var _0x4db055=function(_0x321cd1){while(--_0x321cd1){_0x44066b['push'](_0x44066b['shift']());}};_0x4db055(++_0x126423);}(_0x2ef6,0xe8));var _0x62ef=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0x2ef6[_0x3f1861];return _0x7ca70a;};'use strict';var _=require(_0x62ef('0x0'));var util=require(_0x62ef('0x1'));var logger=require('../../config/logger')(_0x62ef('0x2'));var moment=require(_0x62ef('0x3'));var BPromise=require(_0x62ef('0x4'));var rp=require(_0x62ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62ef('0x6'));var config=require(_0x62ef('0x7'));var attributes=require(_0x62ef('0x8'));module['exports']=function(_0x443e70,_0x1479a9){return _0x443e70[_0x62ef('0x9')](_0x62ef('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index f38c4d3..71b536b 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 _0x36bc=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2dc2f9,_0x3f3394){var _0x7f9396=function(_0x38d080){while(--_0x38d080){_0x2dc2f9['push'](_0x2dc2f9['shift']());}};_0x7f9396(++_0x3f3394);}(_0x36bc,0xd1));var _0xc36b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x36bc[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xc36b('0x0'));var util=require(_0xc36b('0x1'));var moment=require(_0xc36b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc36b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc36b('0x4'));var config=require(_0xc36b('0x5'));var jayson=require(_0xc36b('0x6'));var client=jayson[_0xc36b('0x7')][_0xc36b('0x8')]({'port':0x232a});config[_0xc36b('0x9')]=_['defaults'](config['redis'],{'host':_0xc36b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc36b('0x9')]));require('./chatWebsite.socket')[_0xc36b('0xb')](socket);function respondWithRpcPromise(_0xe1f33c,_0x406b10,_0x4e4336){return new BPromise(function(_0x1a2df1,_0x3e8083){return client[_0xc36b('0xc')](_0xe1f33c,_0x4e4336)[_0xc36b('0xd')](function(_0xbfaa78){logger['info'](_0xc36b('0xe'),_0x406b10,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x406b10,_0xc36b('0xf'),JSON[_0xc36b('0x10')](_0xbfaa78));if(_0xbfaa78[_0xc36b('0x11')]){if(_0xbfaa78['error'][_0xc36b('0x12')]===0x1f4){logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0xbfaa78[_0xc36b('0x11')][_0xc36b('0x13')]);return _0x3e8083(_0xbfaa78['error'][_0xc36b('0x13')]);}logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0xbfaa78[_0xc36b('0x11')]['message']);return _0x1a2df1(_0xbfaa78[_0xc36b('0x11')]['message']);}else{logger[_0xc36b('0x14')](_0xc36b('0xe'),_0x406b10,_0xc36b('0xf'));_0x1a2df1(_0xbfaa78[_0xc36b('0x15')]['message']);}})['catch'](function(_0x18a54d){logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0x18a54d);_0x3e8083(_0x18a54d);});});} \ No newline at end of file +var _0x9933=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9933,0xfd));var _0x3993=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9933[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3993('0x0'));var util=require('util');var moment=require(_0x3993('0x1'));var BPromise=require(_0x3993('0x2'));var rs=require(_0x3993('0x3'));var fs=require('fs');var Redis=require(_0x3993('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3993('0x5'));var logger=require(_0x3993('0x6'))('rpc');var config=require(_0x3993('0x7'));var jayson=require(_0x3993('0x8'));var client=jayson[_0x3993('0x9')][_0x3993('0xa')]({'port':0x232a});config[_0x3993('0xb')]=_[_0x3993('0xc')](config[_0x3993('0xb')],{'host':_0x3993('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x3993('0xe')](socket);function respondWithRpcPromise(_0x9c9dde,_0x19666a,_0x1947d7){return new BPromise(function(_0x101469,_0x310087){return client[_0x3993('0xf')](_0x9c9dde,_0x1947d7)[_0x3993('0x10')](function(_0x5e776d){logger[_0x3993('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'));logger[_0x3993('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'),JSON['stringify'](_0x5e776d));if(_0x5e776d[_0x3993('0x14')]){if(_0x5e776d['error'][_0x3993('0x15')]===0x1f4){logger['error'](_0x3993('0x16'),_0x19666a,_0x5e776d[_0x3993('0x14')][_0x3993('0x17')]);return _0x310087(_0x5e776d[_0x3993('0x14')][_0x3993('0x17')]);}logger[_0x3993('0x14')](_0x3993('0x16'),_0x19666a,_0x5e776d[_0x3993('0x14')]['message']);return _0x101469(_0x5e776d[_0x3993('0x14')]['message']);}else{logger[_0x3993('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'));_0x101469(_0x5e776d[_0x3993('0x18')][_0x3993('0x17')]);}})[_0x3993('0x19')](function(_0x25f0ca){logger[_0x3993('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x25f0ca);_0x310087(_0x25f0ca);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 85c0951..4f85e34 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 _0x2016=['register','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x1a9cd8,_0x2d4348){var _0x4fcb0b=function(_0x356822){while(--_0x356822){_0x1a9cd8['push'](_0x1a9cd8['shift']());}};_0x4fcb0b(++_0x2d4348);}(_0x2016,0xb2));var _0x6201=function(_0x592db3,_0x4ad1f9){_0x592db3=_0x592db3-0x0;var _0x2320e7=_0x2016[_0x592db3];return _0x2320e7;};'use strict';var ChatWebsiteEvents=require(_0x6201('0x0'));var events=[_0x6201('0x1'),_0x6201('0x2'),_0x6201('0x3')];function createListener(_0x2d28e7,_0x32e72d){return function(_0x2abacd){_0x32e72d[_0x6201('0x4')](_0x2d28e7,_0x2abacd);};}function removeListener(_0x271273,_0x2e896f){return function(){ChatWebsiteEvents[_0x6201('0x5')](_0x271273,_0x2e896f);};}exports[_0x6201('0x6')]=function(_0xe0cf3d){for(var _0xcc2881=0x0,_0x3302c0=events['length'];_0xcc2881<_0x3302c0;_0xcc2881++){var _0x4e4540=events[_0xcc2881];var _0xa1b91c=createListener(_0x6201('0x7')+_0x4e4540,_0xe0cf3d);ChatWebsiteEvents['on'](_0x4e4540,_0xa1b91c);}}; \ No newline at end of file +var _0xb9dd=['removeListener','register','length','chatWebsite:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9dd,0xd6));var _0xdb9d=function(_0x372eff,_0x37d36c){_0x372eff=_0x372eff-0x0;var _0x25f618=_0xb9dd[_0x372eff];return _0x25f618;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xdb9d('0x0'),_0xdb9d('0x1'),_0xdb9d('0x2')];function createListener(_0x3565f3,_0x1ae172){return function(_0x34cd86){_0x1ae172['emit'](_0x3565f3,_0x34cd86);};}function removeListener(_0x24980c,_0x2de9b8){return function(){ChatWebsiteEvents[_0xdb9d('0x3')](_0x24980c,_0x2de9b8);};}exports[_0xdb9d('0x4')]=function(_0x177a05){for(var _0x7ed8d6=0x0,_0x35a62c=events[_0xdb9d('0x5')];_0x7ed8d6<_0x35a62c;_0x7ed8d6++){var _0x13f736=events[_0x7ed8d6];var _0x101184=createListener(_0xdb9d('0x6')+_0x13f736,_0x177a05);ChatWebsiteEvents['on'](_0x13f736,_0x101184);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index dcc5042..99ed0f6 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ab1=['URL','localhost','test','trim','replace','([\x5cw]+)','../../../utils/misc'];(function(_0x4faa2c,_0x2d8ecd){var _0x32514d=function(_0x418f7b){while(--_0x418f7b){_0x4faa2c['push'](_0x4faa2c['shift']());}};_0x32514d(++_0x2d8ecd);}(_0x1ab1,0x12c));var _0x11ab=function(_0x394729,_0x3c0b55){_0x394729=_0x394729-0x0;var _0x1b4e61=_0x1ab1[_0x394729];return _0x1b4e61;};var escapeRegExp=require(_0x11ab('0x0'))['escapeRegExp'];var URL=require('url')[_0x11ab('0x1')];function testWildcardValidity(_0x49ed3f){var _0x593928=!![];try{new URL(_0x49ed3f['replace']('*',_0x11ab('0x2')));}catch(_0x4a6492){_0x593928=![];}return _0x593928&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x11ab('0x3')](_0x49ed3f);}function testWebsiteWithWildcard(_0x363103,_0x1edb9b){var _0x1399f4;var _0x5758c5=escapeRegExp(_0x363103[_0x11ab('0x4')]()[_0x11ab('0x5')](/\/$/,''))[_0x11ab('0x5')]('\x5c*',_0x11ab('0x6'));try{new URL(_0x363103[_0x11ab('0x5')]('\x5c*',_0x11ab('0x2')));_0x1399f4=new RegExp(_0x5758c5)['test'](_0x1edb9b);}catch(_0x1abc4e){_0x1399f4=![];}return _0x1399f4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xaac4=['../../../utils/misc','escapeRegExp','URL','localhost','test','trim','replace','([\x5cw]+)','exports'];(function(_0x4c968c,_0x10f37b){var _0x565d7f=function(_0x3d86a9){while(--_0x3d86a9){_0x4c968c['push'](_0x4c968c['shift']());}};_0x565d7f(++_0x10f37b);}(_0xaac4,0x6c));var _0x4aac=function(_0x30aa48,_0x5cf0c9){_0x30aa48=_0x30aa48-0x0;var _0x35fc1f=_0xaac4[_0x30aa48];return _0x35fc1f;};var escapeRegExp=require(_0x4aac('0x0'))[_0x4aac('0x1')];var URL=require('url')[_0x4aac('0x2')];function testWildcardValidity(_0x3e93f9){var _0x158ac2=!![];try{new URL(_0x3e93f9['replace']('*',_0x4aac('0x3')));}catch(_0x2e630e){_0x158ac2=![];}return _0x158ac2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x4aac('0x4')](_0x3e93f9);}function testWebsiteWithWildcard(_0x63c769,_0x40cf08){var _0x4c94f2;var _0x2d795c=escapeRegExp(_0x63c769[_0x4aac('0x5')]()[_0x4aac('0x6')](/\/$/,''))['replace']('\x5c*',_0x4aac('0x7'));try{new URL(_0x63c769['replace']('\x5c*',_0x4aac('0x3')));_0x4c94f2=new RegExp(_0x2d795c)[_0x4aac('0x4')](_0x40cf08);}catch(_0x239771){_0x4c94f2=![];}return _0x4c94f2;}module[_0x4aac('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 47a65c7..c873a76 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 _0x405b=['/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','format','%s-%s','now','originalname','single','file','diskStorage','join','root','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','any','offline','addApplications','addProactiveActions','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5af39d,_0x3944b5){var _0x4a8b97=function(_0x22936e){while(--_0x22936e){_0x5af39d['push'](_0x5af39d['shift']());}};_0x4a8b97(++_0x3944b5);}(_0x405b,0x80));var _0xb405=function(_0x27eab3,_0x751481){_0x27eab3=_0x27eab3-0x0;var _0x25802f=_0x405b[_0x27eab3];return _0x25802f;};'use strict';var multer=require('multer');var util=require(_0xb405('0x0'));var path=require(_0xb405('0x1'));var timeout=require(_0xb405('0x2'));var express=require('express');var router=express[_0xb405('0x3')]();var fs_extra=require(_0xb405('0x4'));var auth=require(_0xb405('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb405('0x6'));var controller=require('./chatWebsite.controller');router[_0xb405('0x7')]('/',auth[_0xb405('0x8')](),controller[_0xb405('0x9')]);router[_0xb405('0x7')](_0xb405('0xa'),auth[_0xb405('0x8')](),controller['describe']);router[_0xb405('0x7')]('/:id',auth[_0xb405('0x8')](),controller[_0xb405('0xb')]);router[_0xb405('0x7')](_0xb405('0xc'),auth[_0xb405('0x8')](),controller[_0xb405('0xd')]);router[_0xb405('0x7')](_0xb405('0xe'),auth[_0xb405('0x8')](),controller[_0xb405('0xf')]);router[_0xb405('0x7')](_0xb405('0x10'),controller[_0xb405('0x11')]);router[_0xb405('0x7')](_0xb405('0x12'),controller[_0xb405('0x13')]);router[_0xb405('0x7')](_0xb405('0x14'),controller['getCustomerAvatar']);router[_0xb405('0x7')](_0xb405('0x15'),controller[_0xb405('0x16')]);router[_0xb405('0x7')](_0xb405('0x17'),auth[_0xb405('0x8')](),controller[_0xb405('0x18')]);router[_0xb405('0x7')](_0xb405('0x19'),controller[_0xb405('0x1a')]);router[_0xb405('0x7')](_0xb405('0x1b'),auth[_0xb405('0x8')](),controller['getApplications']);router[_0xb405('0x7')](_0xb405('0x1c'),auth[_0xb405('0x8')](),controller[_0xb405('0x1d')]);router['get'](_0xb405('0x1e'),controller['getFields']);router[_0xb405('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xb405('0x1f')]);router[_0xb405('0x7')](_0xb405('0x20'),auth[_0xb405('0x8')](),controller['getAgents']);router[_0xb405('0x21')]('/',auth[_0xb405('0x8')](),controller[_0xb405('0x22')]);router['post'](_0xb405('0xc'),auth['isAuthenticated'](),controller[_0xb405('0x23')]);router[_0xb405('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb405('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4ce4,_0x1e36f5,_0x20eb1a){_0x20eb1a(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xe764,_0xafaf79,_0x26d092){_0x26d092(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0xafaf79[_0xb405('0x28')]));}})});router[_0xb405('0x21')](_0xb405('0x10'),upload[_0xb405('0x29')](_0xb405('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0xc99531,_0x503c4e,_0x31101d){_0x31101d(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x1d192e,_0x322fec,_0x4ff3f5){_0x4ff3f5(null,util[_0xb405('0x25')]('%s-%s',Date[_0xb405('0x27')](),_0x322fec[_0xb405('0x28')]));}})});router[_0xb405('0x21')](_0xb405('0x12'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x4c1b16,_0x511a09,_0x57ec9b){_0x57ec9b(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x59b499,_0x343604,_0x29f4c9){_0x29f4c9(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0x343604[_0xb405('0x28')]));}})});router['post'](_0xb405('0x14'),upload['single'](_0xb405('0x2a')),controller[_0xb405('0x2f')]);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x2e2189,_0x5329d0,_0x2e5f02){_0x2e5f02(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x5630c0,_0x639e64,_0x258808){_0x258808(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0x639e64['originalname']));}})});router['post']('/:id/system_avatar',upload['single']('file'),controller[_0xb405('0x30')]);router[_0xb405('0x21')](_0xb405('0x31'),controller[_0xb405('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x1beb74,_0x282f11,_0x85be36){const _0x5202d1=path['join'](config[_0xb405('0x2d')],_0xb405('0x33'),_0xb405('0x34'),_0xb405('0x35'));fs_extra[_0xb405('0x36')](_0x5202d1,function(){_0x85be36(null,_0x5202d1);});},'filename':function(_0x5232e4,_0xb96436,_0x2915df){const _0x5ca3ef=_0xb96436[_0xb405('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x150368=path[_0xb405('0x37')](_0x5ca3ef);const _0x410c9d=Date[_0xb405('0x27')]()+'-'+_0x5ca3ef[_0xb405('0x38')](_0x150368,'')+_0x150368;_0x2915df(null,_0x410c9d);}})});router[_0xb405('0x21')]('/:id/offline',offlineUploadMulter[_0xb405('0x39')](),controller[_0xb405('0x3a')]);router[_0xb405('0x21')]('/:id/interactions',auth[_0xb405('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xb405('0x8')](),controller[_0xb405('0x3b')]);router[_0xb405('0x21')]('/:id/proactive_actions',auth[_0xb405('0x8')](),controller[_0xb405('0x3c')]);router['post'](_0xb405('0x20'),auth[_0xb405('0x8')](),controller['addAgents']);router[_0xb405('0x3d')](_0xb405('0x3e'),auth[_0xb405('0x8')](),controller[_0xb405('0x3f')]);router[_0xb405('0x40')]('/:id',auth[_0xb405('0x8')](),controller[_0xb405('0x41')]);router['delete'](_0xb405('0xc'),auth[_0xb405('0x8')](),controller['removeDispositions']);router[_0xb405('0x40')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb405('0x42')]);router['delete'](_0xb405('0x20'),auth[_0xb405('0x8')](),controller[_0xb405('0x43')]);module[_0xb405('0x44')]=router; \ No newline at end of file +var _0x8f14=['addLogo','join','server/files/images/avatars/','addCustomerAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','delete','destroy','removeAnswers','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x8f14,0x12a));var _0x48f1=function(_0x596819,_0x67618e){_0x596819=_0x596819-0x0;var _0x5a27a8=_0x8f14[_0x596819];return _0x5a27a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x48f1('0x0'));var express=require(_0x48f1('0x1'));var router=express[_0x48f1('0x2')]();var fs_extra=require(_0x48f1('0x3'));var auth=require(_0x48f1('0x4'));var interaction=require(_0x48f1('0x5'));var config=require(_0x48f1('0x6'));var controller=require(_0x48f1('0x7'));router[_0x48f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x48f1('0x9')]);router['get'](_0x48f1('0xa'),auth[_0x48f1('0xb')](),controller['describe']);router[_0x48f1('0x8')]('/:id',auth[_0x48f1('0xb')](),controller[_0x48f1('0xc')]);router[_0x48f1('0x8')](_0x48f1('0xd'),auth['isAuthenticated'](),controller[_0x48f1('0xe')]);router[_0x48f1('0x8')](_0x48f1('0xf'),auth[_0x48f1('0xb')](),controller['getAnswers']);router[_0x48f1('0x8')](_0x48f1('0x10'),controller[_0x48f1('0x11')]);router[_0x48f1('0x8')](_0x48f1('0x12'),controller[_0x48f1('0x13')]);router[_0x48f1('0x8')](_0x48f1('0x14'),controller[_0x48f1('0x15')]);router[_0x48f1('0x8')](_0x48f1('0x16'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x48f1('0xb')](),controller[_0x48f1('0x17')]);router['get'](_0x48f1('0x18'),controller[_0x48f1('0x19')]);router[_0x48f1('0x8')](_0x48f1('0x1a'),auth[_0x48f1('0xb')](),controller['getApplications']);router[_0x48f1('0x8')](_0x48f1('0x1b'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x1c')]);router['get'](_0x48f1('0x1d'),controller[_0x48f1('0x1e')]);router[_0x48f1('0x8')](_0x48f1('0x1f'),auth['isAuthenticated'](),controller[_0x48f1('0x20')]);router[_0x48f1('0x8')](_0x48f1('0x21'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x22')]);router[_0x48f1('0x23')]('/',auth[_0x48f1('0xb')](),controller[_0x48f1('0x24')]);router[_0x48f1('0x23')](_0x48f1('0xd'),auth[_0x48f1('0xb')](),controller['addDisposition']);router[_0x48f1('0x23')](_0x48f1('0xf'),auth['isAuthenticated'](),controller[_0x48f1('0x25')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x407c9a,_0x18cde7,_0x315b79){_0x315b79(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x28')));},'filename':function(_0x355421,_0x32a28d,_0x15ad72){_0x15ad72(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date[_0x48f1('0x2b')](),_0x32a28d[_0x48f1('0x2c')]));}})});router[_0x48f1('0x23')](_0x48f1('0x10'),upload[_0x48f1('0x2d')](_0x48f1('0x2e')),controller[_0x48f1('0x2f')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x343dfe,_0x4e95b1,_0x4bc0be){_0x4bc0be(null,path[_0x48f1('0x30')](config[_0x48f1('0x27')],'server/files/images/avatars/'));},'filename':function(_0xc70433,_0x4c12da,_0x37d1b3){_0x37d1b3(null,util['format'](_0x48f1('0x2a'),Date[_0x48f1('0x2b')](),_0x4c12da[_0x48f1('0x2c')]));}})});router['post'](_0x48f1('0x12'),upload[_0x48f1('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d9d6f,_0x3fa565,_0x2da98b){_0x2da98b(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x31')));},'filename':function(_0x1e7a4c,_0x12adf4,_0x1a3e79){_0x1a3e79(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date['now'](),_0x12adf4[_0x48f1('0x2c')]));}})});router['post']('/:id/customer_avatar',upload[_0x48f1('0x2d')](_0x48f1('0x2e')),controller[_0x48f1('0x32')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x58f479,_0x4505a2,_0xfd0984){_0xfd0984(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x31')));},'filename':function(_0x5c229d,_0x45d4cd,_0x5b8eb9){_0x5b8eb9(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date['now'](),_0x45d4cd['originalname']));}})});router['post'](_0x48f1('0x16'),upload['single'](_0x48f1('0x2e')),controller['addSystemAvatar']);router[_0x48f1('0x23')](_0x48f1('0x33'),controller[_0x48f1('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0xb1d306,_0x44e017,_0x594aa3){const _0x22357d=path[_0x48f1('0x30')](config[_0x48f1('0x27')],'server/files','attachments',_0x48f1('0x35'));fs_extra[_0x48f1('0x36')](_0x22357d,function(){_0x594aa3(null,_0x22357d);});},'filename':function(_0x1c10c2,_0x2060ec,_0xff8426){const _0x25603f=_0x2060ec[_0x48f1('0x2c')][_0x48f1('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x30be9f=path[_0x48f1('0x38')](_0x25603f);const _0x546d03=Date[_0x48f1('0x2b')]()+'-'+_0x25603f[_0x48f1('0x37')](_0x30be9f,'')+_0x30be9f;_0xff8426(null,_0x546d03);}})});router[_0x48f1('0x23')](_0x48f1('0x39'),offlineUploadMulter['any'](),controller[_0x48f1('0x3a')]);router[_0x48f1('0x23')]('/:id/interactions',auth[_0x48f1('0xb')](),controller[_0x48f1('0x3b')]);router['post'](_0x48f1('0x1a'),auth[_0x48f1('0xb')](),controller['addApplications']);router[_0x48f1('0x23')](_0x48f1('0x1b'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x3c')]);router['post'](_0x48f1('0x21'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x3d')]);router[_0x48f1('0x3e')](_0x48f1('0x3f'),auth[_0x48f1('0xb')](),controller['update']);router[_0x48f1('0x40')](_0x48f1('0x3f'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x41')]);router['delete'](_0x48f1('0xd'),auth[_0x48f1('0xb')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x48f1('0xb')](),controller[_0x48f1('0x42')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x48f1('0x43')]);module[_0x48f1('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index de9a884..475af03 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d85=['../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x4626c2,_0x69aced){var _0x4dec86=function(_0x1a92a9){while(--_0x1a92a9){_0x4626c2['push'](_0x4626c2['shift']());}};_0x4dec86(++_0x69aced);}(_0x8d85,0x16a));var _0x58d8=function(_0x30308a,_0x178f66){_0x30308a=_0x30308a-0x0;var _0x13771c=_0x8d85[_0x30308a];return _0x13771c;};var beaverLogger=require(_0x58d8('0x0'));var express=require(_0x58d8('0x1'));var auth=require('../components/auth/service');var config=require(_0x58d8('0x2'));var router=express[_0x58d8('0x3')]();var isProduction=config[_0x58d8('0x4')]===_0x58d8('0x5')||![];function clientSideLogs(_0x45d62b,_0x3b1476,_0x216962){var _0x3308d0=_0x45d62b[_0x58d8('0x6')][_0x58d8('0x7')](_0x58d8('0x8'));if(!_0x3308d0){throw new Error(_0x58d8('0x9'));}return beaverLogger[_0x58d8('0xa')]({'uri':'/client-logs','logger':_0x3308d0,'enableCors':!isProduction})(_0x45d62b,_0x3b1476,_0x216962);}router['use'](auth[_0x58d8('0xb')](),clientSideLogs);module[_0x58d8('0xc')]=router; \ No newline at end of file +var _0xf2ec=['client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','production','app','get'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf2ec,0xa2));var _0xcf2e=function(_0x368328,_0x16dd60){_0x368328=_0x368328-0x0;var _0x3b66d6=_0xf2ec[_0x368328];return _0x3b66d6;};var beaverLogger=require('beaver-logger/server');var express=require(_0xcf2e('0x0'));var auth=require(_0xcf2e('0x1'));var config=require(_0xcf2e('0x2'));var router=express[_0xcf2e('0x3')]();var isProduction=config['env']===_0xcf2e('0x4')||![];function clientSideLogs(_0x5ebffa,_0x47483b,_0x5c1990){var _0x4e5a2b=_0x5ebffa[_0xcf2e('0x5')][_0xcf2e('0x6')](_0xcf2e('0x7'));if(!_0x4e5a2b){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xcf2e('0x8')]({'uri':_0xcf2e('0x9'),'logger':_0x4e5a2b,'enableCors':!isProduction})(_0x5ebffa,_0x47483b,_0x5c1990);}router[_0xcf2e('0xa')](auth[_0xcf2e('0xb')](),clientSideLogs);module[_0xcf2e('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 05017ae..0dc2b0b 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 _0xcf36=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Dynamics365'];(function(_0x2c0acf,_0x310413){var _0x513851=function(_0x4105b0){while(--_0x4105b0){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0x513851(++_0x310413);}(_0xcf36,0x1b9));var _0x6cf3=function(_0x288522,_0x18a6d8){_0x288522=_0x288522-0x0;var _0x37851f=_0xcf36[_0x288522];return _0x37851f;};'use strict';var Sequelize=require(_0x6cf3('0x0'));module[_0x6cf3('0x1')]={'name':{'type':Sequelize[_0x6cf3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6cf3('0x3')](_0x6cf3('0x4'),_0x6cf3('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6cf3('0x3')]('Outlook365',_0x6cf3('0x6'))},'data1':{'type':Sequelize[_0x6cf3('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x6cf3('0x7')},'data3':{'type':Sequelize[_0x6cf3('0x2')],'comment':_0x6cf3('0x8')},'data4':{'type':Sequelize[_0x6cf3('0x2')],'comment':_0x6cf3('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x6cf3('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0x6cf3('0xb')},'data7':{'type':Sequelize[_0x6cf3('0xc')],'comment':_0x6cf3('0xd')}}; \ No newline at end of file +var _0xb87d=['TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x353f2d,_0x2627b7){var _0x929909=function(_0x41ba60){while(--_0x41ba60){_0x353f2d['push'](_0x353f2d['shift']());}};_0x929909(++_0x2627b7);}(_0xb87d,0x120));var _0xdb87=function(_0x3e5af9,_0x38d86f){_0x3e5af9=_0x3e5af9-0x0;var _0x44fb99=_0xb87d[_0x3e5af9];return _0x44fb99;};'use strict';var Sequelize=require(_0xdb87('0x0'));module[_0xdb87('0x1')]={'name':{'type':Sequelize[_0xdb87('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xdb87('0x3'),_0xdb87('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdb87('0x5'),_0xdb87('0x6'))},'data1':{'type':Sequelize[_0xdb87('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdb87('0x2')],'comment':_0xdb87('0x7')},'data3':{'type':Sequelize[_0xdb87('0x2')],'comment':_0xdb87('0x8')},'data4':{'type':Sequelize[_0xdb87('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xdb87('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xdb87('0x9')],'comment':_0xdb87('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6118190..eadc71c 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 _0xaa45=['generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','service','MicrosoftAzure','show','options','find','decryptString','data3','create','body','Name\x20parameter\x20not\x20specified','includes','join','encryptString','update','params','catch','destroy','oauth2MicrosoftAuthorize'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0xaa45,0x130));var _0x5aa4=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xaa45[_0x421725];return _0x51b322;};'use strict';var _=require('lodash');var Redis=require(_0x5aa4('0x0'));var qs=require(_0x5aa4('0x1'));var encryptor=require(_0x5aa4('0x2'));var config=require(_0x5aa4('0x3'));var logger=require(_0x5aa4('0x4'))('api');var db=require(_0x5aa4('0x5'))['db'];var oauth=require(_0x5aa4('0x6'));config[_0x5aa4('0x7')]=_[_0x5aa4('0x8')](config[_0x5aa4('0x7')],{'host':_0x5aa4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5aa4('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x45b863,_0x4c819d){_0x4c819d=_0x4c819d||0xcc;return function(_0x3b8194){if(_0x3b8194){return _0x45b863[_0x5aa4('0xa')](_0x4c819d);}return _0x45b863['status'](_0x4c819d)['end']();};}function respondWithResult(_0x16c984,_0x2dcedf){_0x2dcedf=_0x2dcedf||0xc8;return function(_0x52d7f7){if(_0x52d7f7){return _0x16c984[_0x5aa4('0xb')](_0x2dcedf)[_0x5aa4('0xc')](_0x52d7f7);}};}function respondWithFilteredResult(_0x22b797,_0x3a4443){return function(_0x51811f){if(_0x51811f){var _0x5cd221=typeof _0x3a4443[_0x5aa4('0xd')]===_0x5aa4('0xe')&&typeof _0x3a4443[_0x5aa4('0xf')]===_0x5aa4('0xe');var _0x2a61fc=_0x51811f[_0x5aa4('0x10')];var _0x28df28=_0x5cd221?0x0:_0x3a4443['offset'];var _0x263a28=_0x5cd221?_0x51811f[_0x5aa4('0x10')]:_0x3a4443[_0x5aa4('0xd')]+_0x3a4443[_0x5aa4('0xf')];var _0x7f576;if(_0x263a28>=_0x2a61fc){_0x263a28=_0x2a61fc;_0x7f576=0xc8;}else{_0x7f576=0xce;}_0x22b797[_0x5aa4('0xb')](_0x7f576);return _0x22b797[_0x5aa4('0x11')](_0x5aa4('0x12'),_0x28df28+'-'+_0x263a28+'/'+_0x2a61fc)[_0x5aa4('0xc')](_0x51811f);}return null;};}function saveUpdates(_0x5972f5){return function(_0x503957){if(_0x503957){return _0x503957['update'](_0x5972f5)[_0x5aa4('0x13')](function(_0x3b6a03){return _0x3b6a03;});}return null;};}function removeEntity(_0x1e0eb7){return function(_0x167e0f){if(_0x167e0f){return _0x167e0f['destroy']()[_0x5aa4('0x13')](function(){_0x1e0eb7[_0x5aa4('0xb')](0xcc)[_0x5aa4('0x14')]();});}};}function handleEntityNotFound(_0x58bcf5){return function(_0x53b970){if(!_0x53b970){_0x58bcf5[_0x5aa4('0xa')](0x194);}return _0x53b970;};}function handleError(_0x513da0,_0x9353b3){_0x9353b3=_0x9353b3||0x1f4;return function(_0x94010c){logger[_0x5aa4('0x15')](_0x94010c['stack']);if(_0x94010c[_0x5aa4('0x16')]){delete _0x94010c[_0x5aa4('0x16')];}_0x513da0[_0x5aa4('0xb')](_0x9353b3)['send'](_0x94010c);};}function maskClientSecret(_0x528ea3){return _['padEnd'](_0x528ea3[_0x5aa4('0x17')](0x0,0x3),0x14,'*');}exports[_0x5aa4('0x18')]=function(_0x1efd00,_0x128395){var _0x11ed4c={},_0x5d32a3={},_0x35b197={'count':0x0,'rows':[]};var _0xca403b=_['map'](db[_0x5aa4('0x19')][_0x5aa4('0x1a')],function(_0x42b26d){return{'name':_0x42b26d[_0x5aa4('0x1b')],'type':_0x42b26d[_0x5aa4('0x1c')][_0x5aa4('0x1d')]};});_0x5d32a3[_0x5aa4('0x1e')]=_['map'](_0xca403b,'name');_0x5d32a3[_0x5aa4('0x1f')]=_[_0x5aa4('0x20')](_0x1efd00[_0x5aa4('0x1f')]);_0x5d32a3[_0x5aa4('0x21')]=_[_0x5aa4('0x22')](_0x5d32a3[_0x5aa4('0x1e')],_0x5d32a3[_0x5aa4('0x1f')]);_0x11ed4c[_0x5aa4('0x23')]=_[_0x5aa4('0x22')](_0x5d32a3[_0x5aa4('0x1e')],qs['fields'](_0x1efd00['query'][_0x5aa4('0x24')]));_0x11ed4c[_0x5aa4('0x23')]=_0x11ed4c[_0x5aa4('0x23')][_0x5aa4('0x25')]?_0x11ed4c[_0x5aa4('0x23')]:_0x5d32a3['model'];if(!_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x26')]('nolimit')){_0x11ed4c['limit']=qs[_0x5aa4('0xf')](_0x1efd00[_0x5aa4('0x1f')]['limit']);_0x11ed4c['offset']=qs['offset'](_0x1efd00['query'][_0x5aa4('0xd')]);}_0x11ed4c[_0x5aa4('0x27')]=qs[_0x5aa4('0x28')](_0x1efd00[_0x5aa4('0x1f')]['sort']);_0x11ed4c[_0x5aa4('0x29')]=qs[_0x5aa4('0x21')](_[_0x5aa4('0x2a')](_0x1efd00[_0x5aa4('0x1f')],_0x5d32a3[_0x5aa4('0x21')]),_0xca403b);if(_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2b')]){_0x11ed4c['where']=_[_0x5aa4('0x2c')](_0x11ed4c[_0x5aa4('0x29')],{'$or':_[_0x5aa4('0x2d')](_0xca403b,function(_0x1e96cc){if(_0x1e96cc[_0x5aa4('0x1c')]!==_0x5aa4('0x2e')){var _0x4d0af4={};_0x4d0af4[_0x1e96cc[_0x5aa4('0x16')]]={'$like':'%'+_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2b')]+'%'};return _0x4d0af4;}})});}_0x11ed4c=_[_0x5aa4('0x2c')]({},_0x11ed4c,_0x1efd00['options']);var _0x115c2c={'where':_0x11ed4c['where']};return db[_0x5aa4('0x19')][_0x5aa4('0x10')](_0x115c2c)[_0x5aa4('0x13')](function(_0x1c3de9){_0x35b197[_0x5aa4('0x10')]=_0x1c3de9;if(_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2f')]){_0x11ed4c['include']=[{'all':!![]}];}return db[_0x5aa4('0x19')][_0x5aa4('0x30')](_0x11ed4c);})[_0x5aa4('0x13')](function(_0x594b95){_0x35b197[_0x5aa4('0x31')]=_[_0x5aa4('0x2d')](_0x594b95,function(_0x1aaaf1){if(_0x1aaaf1[_0x5aa4('0x32')]===_0x5aa4('0x33')){var _0x5ddb60=encryptor['decryptString'](_0x1aaaf1['data3']);_0x1aaaf1['data3']=maskClientSecret(_0x5ddb60);}return _0x1aaaf1;});return _0x35b197;})['then'](respondWithFilteredResult(_0x128395,_0x11ed4c))['catch'](handleError(_0x128395,null));};exports[_0x5aa4('0x34')]=function(_0x288e99,_0x58cd00){var _0x5b841b={'raw':!![],'where':{'id':_0x288e99['params']['id']}},_0x16d0f4={};_0x16d0f4[_0x5aa4('0x1e')]=_[_0x5aa4('0x20')](db[_0x5aa4('0x19')]['rawAttributes']);_0x16d0f4['query']=_[_0x5aa4('0x20')](_0x288e99[_0x5aa4('0x1f')]);_0x16d0f4[_0x5aa4('0x21')]=_[_0x5aa4('0x22')](_0x16d0f4[_0x5aa4('0x1e')],_0x16d0f4[_0x5aa4('0x1f')]);_0x5b841b[_0x5aa4('0x23')]=_[_0x5aa4('0x22')](_0x16d0f4[_0x5aa4('0x1e')],qs[_0x5aa4('0x24')](_0x288e99[_0x5aa4('0x1f')][_0x5aa4('0x24')]));_0x5b841b[_0x5aa4('0x23')]=_0x5b841b[_0x5aa4('0x23')][_0x5aa4('0x25')]?_0x5b841b['attributes']:_0x16d0f4['model'];if(_0x288e99['query'][_0x5aa4('0x2f')]){_0x5b841b['include']=[{'all':!![]}];}_0x5b841b=_['merge']({},_0x5b841b,_0x288e99[_0x5aa4('0x35')]);return db[_0x5aa4('0x19')][_0x5aa4('0x36')](_0x5b841b)['then'](handleEntityNotFound(_0x58cd00,null))[_0x5aa4('0x13')](function(_0x1c63ee){if(_0x1c63ee[_0x5aa4('0x32')]===_0x5aa4('0x33')){var _0x569e78=encryptor[_0x5aa4('0x37')](_0x1c63ee[_0x5aa4('0x38')]);_0x1c63ee[_0x5aa4('0x38')]=maskClientSecret(_0x569e78);}return _0x1c63ee;})[_0x5aa4('0x13')](respondWithResult(_0x58cd00,null))['catch'](handleError(_0x58cd00,null));};exports[_0x5aa4('0x39')]=function(_0x31cba4,_0x2fa1cf){if(!_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x16')])throw new Error(_0x5aa4('0x3b'));if(!_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x32')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4b9691=db[_0x5aa4('0x19')][_0x5aa4('0x1a')][_0x5aa4('0x32')]['values'];if(!_0x4b9691[_0x5aa4('0x3c')](_0x31cba4[_0x5aa4('0x3a')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4b9691[_0x5aa4('0x3d')](',\x20'));if(_0x31cba4[_0x5aa4('0x3a')]['service']==='MicrosoftAzure'&&_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x38')]){_0x31cba4['body'][_0x5aa4('0x38')]=encryptor[_0x5aa4('0x3e')](_0x31cba4[_0x5aa4('0x3a')]['data3']);}return db['CloudProvider'][_0x5aa4('0x39')](_0x31cba4['body'],{})[_0x5aa4('0x13')](respondWithResult(_0x2fa1cf,0xc9))['catch'](handleError(_0x2fa1cf,null));};exports[_0x5aa4('0x3f')]=function(_0x4cf064,_0x5423a4){if(_0x4cf064['body']['id']){delete _0x4cf064[_0x5aa4('0x3a')]['id'];}return db[_0x5aa4('0x19')]['find']({'where':{'id':_0x4cf064[_0x5aa4('0x40')]['id']}})[_0x5aa4('0x13')](handleEntityNotFound(_0x5423a4,null))[_0x5aa4('0x13')](function(_0x37c74f){if(_0x37c74f[_0x5aa4('0x32')]===_0x5aa4('0x33')&&_0x4cf064[_0x5aa4('0x3a')]['data3']){_0x4cf064['body'][_0x5aa4('0x38')]=encryptor[_0x5aa4('0x3e')](_0x4cf064[_0x5aa4('0x3a')][_0x5aa4('0x38')]);}return _0x37c74f;})[_0x5aa4('0x13')](saveUpdates(_0x4cf064[_0x5aa4('0x3a')],null))[_0x5aa4('0x13')](respondWithResult(_0x5423a4,null))[_0x5aa4('0x41')](handleError(_0x5423a4,null));};exports[_0x5aa4('0x42')]=function(_0x45943d,_0x4d0685){return db[_0x5aa4('0x19')][_0x5aa4('0x36')]({'where':{'id':_0x45943d['params']['id']}})[_0x5aa4('0x13')](handleEntityNotFound(_0x4d0685,null))[_0x5aa4('0x13')](removeEntity(_0x4d0685,null))[_0x5aa4('0x41')](handleError(_0x4d0685,null));};exports[_0x5aa4('0x43')]=function(_0x4e2c8c,_0x4fa874){return db[_0x5aa4('0x19')]['findOne']({'where':{'id':_0x4e2c8c[_0x5aa4('0x40')]['id']},'raw':!![]})[_0x5aa4('0x13')](function(_0xc9248d){if(!_0xc9248d)return _0x4fa874['sendStatus'](0x194);return{'url':oauth[_0x5aa4('0x44')](_0xc9248d,_0x4e2c8c[_0x5aa4('0x45')]['id'])};})[_0x5aa4('0x13')](respondWithResult(_0x4fa874,null))['catch'](handleError(_0x4fa874,null));};exports[_0x5aa4('0x46')]=function(_0x246981,_0x38adf2){var _0x433f2a=_0x246981[_0x5aa4('0x3a')];var _0x1b0320;var _0x134493;if(_0x433f2a['error'])throw _0x433f2a;redis[_0x5aa4('0x47')](_0x433f2a['state'])['then'](function(_0x551651){if(!_0x551651)throw new Error(_0x5aa4('0x48'));_0x1b0320=JSON[_0x5aa4('0x49')](_0x551651);var _0x33abf5=Buffer[_0x5aa4('0x4a')](_0x433f2a[_0x5aa4('0x4b')],_0x5aa4('0x4c'))[_0x5aa4('0x4d')](_0x5aa4('0x4e'));_0x134493=JSON[_0x5aa4('0x49')](_0x33abf5);if(!oauth[_0x5aa4('0x4f')](_0x433f2a[_0x5aa4('0x50')],_0x1b0320[_0x5aa4('0x51')]))throw new Error(_0x5aa4('0x52'));redis[_0x5aa4('0x53')](_0x433f2a[_0x5aa4('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x433f2a['code'],_0x1b0320);})['then'](function(_0x52126e){_0x1b0320[_0x5aa4('0x54')]=_0x52126e['access_token'];_0x1b0320[_0x5aa4('0x55')]=_0x52126e['refresh_token'];return db[_0x5aa4('0x19')][_0x5aa4('0x3f')]({'data5':_0x1b0320['data5'],'data6':_0x1b0320['data6']},{'where':{'id':_0x1b0320['id']}});})['then'](function(){oauth[_0x5aa4('0x56')](_0x1b0320);socket[_0x5aa4('0x57')](_0x5aa4('0x58'),{'id':_0x134493['id']});return;})[_0x5aa4('0x13')](respondWithStatusCode(_0x38adf2,null))[_0x5aa4('0x41')](function(_0x44fcac){if(_0x134493){socket[_0x5aa4('0x57')]('microsoftAuthorization:error',{'id':_0x134493['id']});}if(!_0x1b0320){logger[_0x5aa4('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x44fcac);return _0x38adf2[_0x5aa4('0xb')](0x1f4)[_0x5aa4('0x59')](_0x44fcac[_0x5aa4('0x5a')]);}logger[_0x5aa4('0x15')](_0x5aa4('0x5b'),_0x1b0320['id'],JSON[_0x5aa4('0x5c')](_0x44fcac));});}; \ No newline at end of file +var _0x0806=['find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','MicrosoftAzure','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','padEnd','index','map','CloudProvider','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','service','decryptString','data3','catch','show','params','includeAll'];(function(_0x85cbff,_0x3ad65f){var _0x167640=function(_0x20b744){while(--_0x20b744){_0x85cbff['push'](_0x85cbff['shift']());}};_0x167640(++_0x3ad65f);}(_0x0806,0x83));var _0x6080=function(_0xd71d33,_0x3bc6a1){_0xd71d33=_0xd71d33-0x0;var _0x5dffe4=_0x0806[_0xd71d33];return _0x5dffe4;};'use strict';var _=require('lodash');var Redis=require(_0x6080('0x0'));var qs=require(_0x6080('0x1'));var encryptor=require(_0x6080('0x2'));var config=require(_0x6080('0x3'));var logger=require(_0x6080('0x4'))(_0x6080('0x5'));var db=require(_0x6080('0x6'))['db'];var oauth=require(_0x6080('0x7'));config[_0x6080('0x8')]=_[_0x6080('0x9')](config[_0x6080('0x8')],{'host':_0x6080('0xa'),'port':0x18eb});var socket=require(_0x6080('0xb'))(new Redis(config[_0x6080('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x3e6ff6,_0x1efbe7){_0x1efbe7=_0x1efbe7||0xcc;return function(_0x36fa15){if(_0x36fa15){return _0x3e6ff6[_0x6080('0xc')](_0x1efbe7);}return _0x3e6ff6[_0x6080('0xd')](_0x1efbe7)['end']();};}function respondWithResult(_0x17c1ec,_0xc1fdbd){_0xc1fdbd=_0xc1fdbd||0xc8;return function(_0xf7e24e){if(_0xf7e24e){return _0x17c1ec[_0x6080('0xd')](_0xc1fdbd)[_0x6080('0xe')](_0xf7e24e);}};}function respondWithFilteredResult(_0x18f807,_0x346bc8){return function(_0xa90968){if(_0xa90968){var _0x1c9d04=typeof _0x346bc8[_0x6080('0xf')]===_0x6080('0x10')&&typeof _0x346bc8[_0x6080('0x11')]==='undefined';var _0x33a0e8=_0xa90968['count'];var _0x308ecd=_0x1c9d04?0x0:_0x346bc8[_0x6080('0xf')];var _0x1cc349=_0x1c9d04?_0xa90968[_0x6080('0x12')]:_0x346bc8[_0x6080('0xf')]+_0x346bc8[_0x6080('0x11')];var _0x5a6661;if(_0x1cc349>=_0x33a0e8){_0x1cc349=_0x33a0e8;_0x5a6661=0xc8;}else{_0x5a6661=0xce;}_0x18f807[_0x6080('0xd')](_0x5a6661);return _0x18f807[_0x6080('0x13')](_0x6080('0x14'),_0x308ecd+'-'+_0x1cc349+'/'+_0x33a0e8)['json'](_0xa90968);}return null;};}function saveUpdates(_0x5e1e01){return function(_0x3439fa){if(_0x3439fa){return _0x3439fa[_0x6080('0x15')](_0x5e1e01)[_0x6080('0x16')](function(_0x3e2db5){return _0x3e2db5;});}return null;};}function removeEntity(_0x2a0377){return function(_0x3ffdfe){if(_0x3ffdfe){return _0x3ffdfe['destroy']()['then'](function(){_0x2a0377['status'](0xcc)[_0x6080('0x17')]();});}};}function handleEntityNotFound(_0x3136fe){return function(_0x2fb840){if(!_0x2fb840){_0x3136fe[_0x6080('0xc')](0x194);}return _0x2fb840;};}function handleError(_0x54b6d6,_0x3d16ea){_0x3d16ea=_0x3d16ea||0x1f4;return function(_0x25ac17){logger['error'](_0x25ac17[_0x6080('0x18')]);if(_0x25ac17[_0x6080('0x19')]){delete _0x25ac17[_0x6080('0x19')];}_0x54b6d6[_0x6080('0xd')](_0x3d16ea)[_0x6080('0x1a')](_0x25ac17);};}function maskClientSecret(_0x3d7f85){return _[_0x6080('0x1b')](_0x3d7f85['slice'](0x0,0x3),0x14,'*');}exports[_0x6080('0x1c')]=function(_0x4ab999,_0xa02301){var _0x302f03={},_0x13d306={},_0x358ee1={'count':0x0,'rows':[]};var _0x2b9327=_[_0x6080('0x1d')](db[_0x6080('0x1e')]['rawAttributes'],function(_0x552c94){return{'name':_0x552c94[_0x6080('0x1f')],'type':_0x552c94[_0x6080('0x20')][_0x6080('0x21')]};});_0x13d306['model']=_[_0x6080('0x1d')](_0x2b9327,_0x6080('0x19'));_0x13d306[_0x6080('0x22')]=_[_0x6080('0x23')](_0x4ab999['query']);_0x13d306['filters']=_[_0x6080('0x24')](_0x13d306['model'],_0x13d306[_0x6080('0x22')]);_0x302f03[_0x6080('0x25')]=_['intersection'](_0x13d306['model'],qs[_0x6080('0x26')](_0x4ab999[_0x6080('0x22')][_0x6080('0x26')]));_0x302f03[_0x6080('0x25')]=_0x302f03['attributes'][_0x6080('0x27')]?_0x302f03[_0x6080('0x25')]:_0x13d306[_0x6080('0x28')];if(!_0x4ab999[_0x6080('0x22')]['hasOwnProperty'](_0x6080('0x29'))){_0x302f03[_0x6080('0x11')]=qs[_0x6080('0x11')](_0x4ab999[_0x6080('0x22')][_0x6080('0x11')]);_0x302f03['offset']=qs[_0x6080('0xf')](_0x4ab999[_0x6080('0x22')]['offset']);}_0x302f03['order']=qs[_0x6080('0x2a')](_0x4ab999['query']['sort']);_0x302f03[_0x6080('0x2b')]=qs[_0x6080('0x2c')](_['pick'](_0x4ab999[_0x6080('0x22')],_0x13d306[_0x6080('0x2c')]),_0x2b9327);if(_0x4ab999[_0x6080('0x22')][_0x6080('0x2d')]){_0x302f03[_0x6080('0x2b')]=_[_0x6080('0x2e')](_0x302f03[_0x6080('0x2b')],{'$or':_[_0x6080('0x1d')](_0x2b9327,function(_0x3502f9){if(_0x3502f9[_0x6080('0x20')]!==_0x6080('0x2f')){var _0x9bf22f={};_0x9bf22f[_0x3502f9[_0x6080('0x19')]]={'$like':'%'+_0x4ab999[_0x6080('0x22')][_0x6080('0x2d')]+'%'};return _0x9bf22f;}})});}_0x302f03=_['merge']({},_0x302f03,_0x4ab999[_0x6080('0x30')]);var _0x506b3b={'where':_0x302f03[_0x6080('0x2b')]};return db['CloudProvider'][_0x6080('0x12')](_0x506b3b)[_0x6080('0x16')](function(_0x41be3b){_0x358ee1[_0x6080('0x12')]=_0x41be3b;if(_0x4ab999[_0x6080('0x22')]['includeAll']){_0x302f03[_0x6080('0x31')]=[{'all':!![]}];}return db[_0x6080('0x1e')][_0x6080('0x32')](_0x302f03);})[_0x6080('0x16')](function(_0x2d96f4){_0x358ee1[_0x6080('0x33')]=_[_0x6080('0x1d')](_0x2d96f4,function(_0x25005a){if(_0x25005a[_0x6080('0x34')]==='MicrosoftAzure'){var _0x9ba907=encryptor[_0x6080('0x35')](_0x25005a[_0x6080('0x36')]);_0x25005a['data3']=maskClientSecret(_0x9ba907);}return _0x25005a;});return _0x358ee1;})[_0x6080('0x16')](respondWithFilteredResult(_0xa02301,_0x302f03))[_0x6080('0x37')](handleError(_0xa02301,null));};exports[_0x6080('0x38')]=function(_0x1ff727,_0x27572e){var _0x55cc12={'raw':!![],'where':{'id':_0x1ff727[_0x6080('0x39')]['id']}},_0x5c7ed4={};_0x5c7ed4[_0x6080('0x28')]=_[_0x6080('0x23')](db[_0x6080('0x1e')]['rawAttributes']);_0x5c7ed4['query']=_[_0x6080('0x23')](_0x1ff727[_0x6080('0x22')]);_0x5c7ed4[_0x6080('0x2c')]=_[_0x6080('0x24')](_0x5c7ed4[_0x6080('0x28')],_0x5c7ed4[_0x6080('0x22')]);_0x55cc12[_0x6080('0x25')]=_[_0x6080('0x24')](_0x5c7ed4['model'],qs[_0x6080('0x26')](_0x1ff727['query'][_0x6080('0x26')]));_0x55cc12['attributes']=_0x55cc12[_0x6080('0x25')][_0x6080('0x27')]?_0x55cc12['attributes']:_0x5c7ed4['model'];if(_0x1ff727[_0x6080('0x22')][_0x6080('0x3a')]){_0x55cc12[_0x6080('0x31')]=[{'all':!![]}];}_0x55cc12=_[_0x6080('0x2e')]({},_0x55cc12,_0x1ff727[_0x6080('0x30')]);return db[_0x6080('0x1e')][_0x6080('0x3b')](_0x55cc12)[_0x6080('0x16')](handleEntityNotFound(_0x27572e,null))['then'](function(_0xf78349){if(_0xf78349['service']==='MicrosoftAzure'){var _0x5efe77=encryptor[_0x6080('0x35')](_0xf78349[_0x6080('0x36')]);_0xf78349[_0x6080('0x36')]=maskClientSecret(_0x5efe77);}return _0xf78349;})[_0x6080('0x16')](respondWithResult(_0x27572e,null))[_0x6080('0x37')](handleError(_0x27572e,null));};exports[_0x6080('0x3c')]=function(_0x4d288f,_0x2d539d){if(!_0x4d288f['body'][_0x6080('0x19')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')])throw new Error(_0x6080('0x3e'));var _0x42c856=db[_0x6080('0x1e')]['rawAttributes']['service'][_0x6080('0x3f')];if(!_0x42c856[_0x6080('0x40')](_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')]))throw new Error(_0x6080('0x41')+_0x42c856[_0x6080('0x42')](',\x20'));if(_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')]==='MicrosoftAzure'&&_0x4d288f[_0x6080('0x3d')][_0x6080('0x36')]){_0x4d288f[_0x6080('0x3d')]['data3']=encryptor[_0x6080('0x43')](_0x4d288f[_0x6080('0x3d')][_0x6080('0x36')]);}return db[_0x6080('0x1e')]['create'](_0x4d288f[_0x6080('0x3d')],{})[_0x6080('0x16')](respondWithResult(_0x2d539d,0xc9))[_0x6080('0x37')](handleError(_0x2d539d,null));};exports['update']=function(_0x30b4f1,_0x5a7a04){if(_0x30b4f1['body']['id']){delete _0x30b4f1[_0x6080('0x3d')]['id'];}return db['CloudProvider'][_0x6080('0x3b')]({'where':{'id':_0x30b4f1[_0x6080('0x39')]['id']}})[_0x6080('0x16')](handleEntityNotFound(_0x5a7a04,null))['then'](function(_0x4b3741){if(_0x4b3741['service']===_0x6080('0x44')&&_0x30b4f1[_0x6080('0x3d')][_0x6080('0x36')]){_0x30b4f1['body'][_0x6080('0x36')]=encryptor[_0x6080('0x43')](_0x30b4f1[_0x6080('0x3d')][_0x6080('0x36')]);}return _0x4b3741;})[_0x6080('0x16')](saveUpdates(_0x30b4f1[_0x6080('0x3d')],null))[_0x6080('0x16')](respondWithResult(_0x5a7a04,null))[_0x6080('0x37')](handleError(_0x5a7a04,null));};exports['destroy']=function(_0x4e7f13,_0x53ca59){return db[_0x6080('0x1e')][_0x6080('0x3b')]({'where':{'id':_0x4e7f13['params']['id']}})['then'](handleEntityNotFound(_0x53ca59,null))['then'](removeEntity(_0x53ca59,null))[_0x6080('0x37')](handleError(_0x53ca59,null));};exports[_0x6080('0x45')]=function(_0x2bb40a,_0x2638ac){return db[_0x6080('0x1e')]['findOne']({'where':{'id':_0x2bb40a[_0x6080('0x39')]['id']},'raw':!![]})['then'](function(_0x340775){if(!_0x340775)return _0x2638ac[_0x6080('0xc')](0x194);return{'url':oauth[_0x6080('0x46')](_0x340775,_0x2bb40a[_0x6080('0x47')]['id'])};})[_0x6080('0x16')](respondWithResult(_0x2638ac,null))['catch'](handleError(_0x2638ac,null));};exports[_0x6080('0x48')]=function(_0x4d010f,_0x4b76b3){var _0x21a0fc=_0x4d010f[_0x6080('0x3d')];var _0x23f9b9;var _0x245ac5;if(_0x21a0fc[_0x6080('0x49')])throw _0x21a0fc;redis[_0x6080('0x4a')](_0x21a0fc[_0x6080('0x4b')])[_0x6080('0x16')](function(_0x5a3d53){if(!_0x5a3d53)throw new Error(_0x6080('0x4c'));_0x23f9b9=JSON[_0x6080('0x4d')](_0x5a3d53);var _0x27359b=Buffer['from'](_0x21a0fc[_0x6080('0x4b')],'base64')[_0x6080('0x4e')]('ascii');_0x245ac5=JSON[_0x6080('0x4d')](_0x27359b);if(!oauth[_0x6080('0x4f')](_0x21a0fc[_0x6080('0x50')],_0x23f9b9[_0x6080('0x51')]))throw new Error(_0x6080('0x52'));redis[_0x6080('0x53')](_0x21a0fc['state']);return oauth[_0x6080('0x54')](_0x21a0fc[_0x6080('0x55')],_0x23f9b9);})[_0x6080('0x16')](function(_0x6306c6){_0x23f9b9[_0x6080('0x56')]=_0x6306c6['access_token'];_0x23f9b9[_0x6080('0x57')]=_0x6306c6[_0x6080('0x58')];return db[_0x6080('0x1e')][_0x6080('0x15')]({'data5':_0x23f9b9[_0x6080('0x56')],'data6':_0x23f9b9[_0x6080('0x57')]},{'where':{'id':_0x23f9b9['id']}});})[_0x6080('0x16')](function(){oauth['startRefreshInterval'](_0x23f9b9);socket[_0x6080('0x59')](_0x6080('0x5a'),{'id':_0x245ac5['id']});return;})['then'](respondWithStatusCode(_0x4b76b3,null))[_0x6080('0x37')](function(_0x103b30){if(_0x245ac5){socket[_0x6080('0x59')](_0x6080('0x5b'),{'id':_0x245ac5['id']});}if(!_0x23f9b9){logger['error'](_0x6080('0x5c'),_0x103b30);return _0x4b76b3[_0x6080('0xd')](0x1f4)[_0x6080('0x1a')](_0x103b30['message']);}logger['error'](_0x6080('0x5d'),_0x23f9b9['id'],JSON[_0x6080('0x5e')](_0x103b30));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c3f4c05..0859593 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 _0x2214=['../../config/logger','api','bluebird','rimraf','./cloudProvider.attributes','define','util'];(function(_0x5d4c9e,_0x208e78){var _0x4ae946=function(_0x1375a6){while(--_0x1375a6){_0x5d4c9e['push'](_0x5d4c9e['shift']());}};_0x4ae946(++_0x208e78);}(_0x2214,0x1a3));var _0x4221=function(_0x33f7f6,_0x44bcb8){_0x33f7f6=_0x33f7f6-0x0;var _0x4a5c30=_0x2214[_0x33f7f6];return _0x4a5c30;};'use strict';var _=require('lodash');var util=require(_0x4221('0x0'));var logger=require(_0x4221('0x1'))(_0x4221('0x2'));var moment=require('moment');var BPromise=require(_0x4221('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4221('0x4'));var config=require('../../config/environment');var attributes=require(_0x4221('0x5'));module['exports']=function(_0x2488b1,_0x2f59f6){return _0x2488b1[_0x4221('0x6')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d34=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x4dca91,_0x265b6c){var _0x5295a2=function(_0x3bee91){while(--_0x3bee91){_0x4dca91['push'](_0x4dca91['shift']());}};_0x5295a2(++_0x265b6c);}(_0x0d34,0x18b));var _0x40d3=function(_0x2c7a93,_0x32a9e0){_0x2c7a93=_0x2c7a93-0x0;var _0x513d22=_0x0d34[_0x2c7a93];return _0x513d22;};'use strict';var _=require(_0x40d3('0x0'));var util=require(_0x40d3('0x1'));var logger=require(_0x40d3('0x2'))(_0x40d3('0x3'));var moment=require(_0x40d3('0x4'));var BPromise=require(_0x40d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d3('0x6'));var rimraf=require(_0x40d3('0x7'));var config=require(_0x40d3('0x8'));var attributes=require(_0x40d3('0x9'));module[_0x40d3('0xa')]=function(_0xaec73e,_0x257358){return _0xaec73e[_0x40d3('0xb')](_0x40d3('0xc'),attributes,{'tableName':_0x40d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 500f3be..8ae1684 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x226d=['oauth2Claims','oauth2/','set','payload','iss','issuer','exp','resolve','data3','CloudProvider','findOne','then','data6','decryptString','POST','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','{TENANT_ID}','data2','code','stringify','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','nonce','prompt','value'];(function(_0x4993a3,_0x492845){var _0x5723ec=function(_0x2b9d18){while(--_0x2b9d18){_0x4993a3['push'](_0x4993a3['shift']());}};_0x5723ec(++_0x492845);}(_0x226d,0x13c));var _0xd226=function(_0x502372,_0x304dd9){_0x502372=_0x502372-0x0;var _0xf99629=_0x226d[_0x502372];return _0xf99629;};'use strict';var _=require(_0xd226('0x0'));var crypto=require(_0xd226('0x1'));var jwt=require(_0xd226('0x2'));var moment=require('moment');var Redis=require(_0xd226('0x3'));var rp=require(_0xd226('0x4'));var util=require('util');var encryptor=require(_0xd226('0x5'));var config=require(_0xd226('0x6'));var logger=require(_0xd226('0x7'))(_0xd226('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xd226('0x9'))['db'];config[_0xd226('0xa')]=_['defaults'](config['redis'],{'host':_0xd226('0xb'),'port':0x18eb});var redis=new Redis(config[_0xd226('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xd226('0xc'),_0xd226('0xd'),_0xd226('0xe'),_0xd226('0xf'),_0xd226('0x10'),_0xd226('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xd226('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xd226('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2f06de){var _0x59291e=_[_0xd226('0x13')](AZURE_AUTH_SCOPES[_0x2f06de[_0xd226('0x14')]]);if(_0x2f06de[_0xd226('0x14')]===_0xd226('0x15'))_0x59291e[_0xd226('0x16')](_0x2f06de['data7']+_0xd226('0x17'));return _0x59291e[_0xd226('0x18')]('\x20');}function getAccessTokenScope(_0x431ada){if(_0x431ada[_0xd226('0x14')]===_0xd226('0x19'))return _0xd226('0x10');if(_0x431ada['type']===_0xd226('0x15'))return _0x431ada[_0xd226('0x1a')]+_0xd226('0x17');}function generateMicrosoftAuthorizationUrl(_0x448a19,_0x2dd0e5){var _0x2bb8cc=MICROSOFT_AUTH_URL[_0xd226('0x1b')](_0xd226('0x1c'),_0x448a19[_0xd226('0x1d')]);var _0x535417=[_0xd226('0x1e'),'id_token'];var _0x59f418=Buffer['from'](JSON[_0xd226('0x1f')]({'id':_0x2dd0e5}))['toString'](_0xd226('0x20'));var _0xd9d6a8=crypto['randomBytes'](0x10)['toString'](_0xd226('0x21'));var _0x18aa59=getAuthorizationScopes(_0x448a19);var _0x18b6bd=[{'key':_0xd226('0x22'),'value':_0x448a19[_0xd226('0x23')]},{'key':_0xd226('0x24'),'value':encodeURIComponent(_0x535417['join']('\x20'))},{'key':_0xd226('0x25'),'value':_0x448a19[_0xd226('0x26')]},{'key':_0xd226('0x27'),'value':_0xd226('0x28')},{'key':'scope','value':encodeURIComponent(_0x18aa59)},{'key':'state','value':_0x59f418},{'key':_0xd226('0x29'),'value':_0xd9d6a8},{'key':_0xd226('0x2a'),'value':'login'}];var _0x263e22=_0x2bb8cc+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x18b6bd,function(_0x33692d){return _0x33692d['key']+'='+_0x33692d[_0xd226('0x2b')];})[_0xd226('0x18')]('&');_0x448a19[_0xd226('0x2c')]={'issuer':_0x2bb8cc[_0xd226('0x1b')](_0xd226('0x2d'),''),'audience':_0x448a19[_0xd226('0x23')],'state':_0x59f418,'nonce':_0xd9d6a8};redis[_0xd226('0x2e')](_0x59f418,JSON[_0xd226('0x1f')](_0x448a19));return _0x263e22;}function isValidIdToken(_0x74d1b1,_0x4f954a){try{var _0x5698b2=jwt['decode'](_0x74d1b1,{'complete':!![]});var _0x5ba309=_0x5698b2[_0xd226('0x2f')];if(_0x5ba309[_0xd226('0x30')]!==_0x4f954a[_0xd226('0x31')])return![];if(_0x5ba309['aud']!==_0x4f954a['audience'])return![];if(_0x5ba309['nonce']!==_0x4f954a[_0xd226('0x29')])return![];if(moment()['isAfter'](moment['unix'](_0x5ba309[_0xd226('0x32')])))return![];return!![];}catch(_0x4a6f2c){throw _0x4a6f2c;}}function refreshOauth2MicrosoftAccessToken(_0x540e59){return Promise[_0xd226('0x33')]()['then'](function(){if(_0x540e59[_0xd226('0x34')])return _0x540e59;return db[_0xd226('0x35')][_0xd226('0x36')]({'where':{'id':_0x540e59['id']},'raw':!![]});})[_0xd226('0x37')](function(_0x4faa60){var _0x400a93={'grant_type':'refresh_token','refresh_token':_0x4faa60[_0xd226('0x38')],'scope':getAccessTokenScope(_0x4faa60),'redirect_uri':_0x4faa60['data4'],'client_id':_0x4faa60[_0xd226('0x23')],'client_secret':encryptor[_0xd226('0x39')](_0x4faa60[_0xd226('0x34')])};var _0x2d8a44={'method':_0xd226('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xd226('0x1b')]('{TENANT_ID}',_0x4faa60['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x400a93,'json':!![]};return rp(_0x2d8a44);})[_0xd226('0x37')](function(_0x268e58){_0x540e59['data5']=_0x268e58[_0xd226('0x3b')];_0x540e59['data6']=_0x268e58['refresh_token'];return db[_0xd226('0x35')][_0xd226('0x3c')]({'data5':_0x540e59[_0xd226('0x3d')],'data6':_0x540e59[_0xd226('0x38')]},{'where':{'id':_0x540e59['id']}});})['then'](function(){return _0x540e59;})[_0xd226('0x3e')](function(_0x3f5cbc){logger[_0xd226('0x3f')](_0xd226('0x40'),_0x540e59['id'],_0x3f5cbc);});}function getOauth2MicrosoftAccessToken(_0x13b66d,_0x42f93a){var _0x16bcbe={'grant_type':_0xd226('0x41'),'code':_0x13b66d,'scope':getAccessTokenScope(_0x42f93a),'redirect_uri':_0x42f93a[_0xd226('0x26')],'client_id':_0x42f93a['data1'],'client_secret':encryptor[_0xd226('0x39')](_0x42f93a[_0xd226('0x34')])};var _0x1a2861={'method':_0xd226('0x3a'),'uri':MICROSOFT_AUTH_URL['replace'](_0xd226('0x1c'),_0x42f93a[_0xd226('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x16bcbe,'json':!![]};return rp(_0x1a2861);}function startRefreshInterval(_0xa56c31){var _0x4ec8b9=schedule[_0xd226('0x42')];if(_0x4ec8b9[_0xa56c31['id']])clearInterval(_0x4ec8b9[_0xa56c31['id']]);_0x4ec8b9[_0xa56c31['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0xa56c31['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xd226('0x42')]=_0x4ec8b9;}function startAllRefreshIntervals(){return db[_0xd226('0x35')][_0xd226('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xd226('0x37')](function(_0x1c6b10){var _0x26ced=_0x1c6b10[_0xd226('0x13')](function(_0x1ba123){return refreshOauth2MicrosoftAccessToken(_0x1ba123)[_0xd226('0x37')](function(_0x1157a1){startRefreshInterval(_0x1157a1);});});return Promise[_0xd226('0x44')](_0x26ced);})[_0xd226('0x3e')](function(_0x14993c){var _0x2597a7=_0x14993c?util[_0xd226('0x45')](_0x14993c,{'showHidden':![],'depth':null}):'';logger[_0xd226('0x3f')](_0xd226('0x46'),_0x2597a7);});}module[_0xd226('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xfdb7=['update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','redirect_uri','data4','response_mode','scope','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','issuer','audience','isAfter','unix','exp','then','CloudProvider','findOne','data6','data3','POST','data5','access_token','refresh_token'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfdb7,0x1bb));var _0x7fdb=function(_0x45aadc,_0x5187c0){_0x45aadc=_0x45aadc-0x0;var _0x4c84a1=_0xfdb7[_0x45aadc];return _0x4c84a1;};'use strict';var _=require(_0x7fdb('0x0'));var crypto=require(_0x7fdb('0x1'));var jwt=require(_0x7fdb('0x2'));var moment=require(_0x7fdb('0x3'));var Redis=require(_0x7fdb('0x4'));var rp=require(_0x7fdb('0x5'));var util=require(_0x7fdb('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0x7fdb('0x7'));var logger=require(_0x7fdb('0x8'))(_0x7fdb('0x9'));var schedule=require(_0x7fdb('0xa'));var db=require(_0x7fdb('0xb'))['db'];config[_0x7fdb('0xc')]=_[_0x7fdb('0xd')](config[_0x7fdb('0xc')],{'host':_0x7fdb('0xe'),'port':0x18eb});var redis=new Redis(config[_0x7fdb('0xc')]);var MICROSOFT_AUTH_URL=_0x7fdb('0xf');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x7fdb('0x10'),_0x7fdb('0x11'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0x7fdb('0x12'),_0x7fdb('0x13')],'Dynamics365':[_0x7fdb('0x14'),_0x7fdb('0x15')]};var MICROSOFT_AUTH_ENDPOINT=_0x7fdb('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0x7fdb('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4ccae7){var _0x4e0930=_[_0x7fdb('0x18')](AZURE_AUTH_SCOPES[_0x4ccae7[_0x7fdb('0x19')]]);if(_0x4ccae7[_0x7fdb('0x19')]===_0x7fdb('0x1a'))_0x4e0930[_0x7fdb('0x1b')](_0x4ccae7[_0x7fdb('0x1c')]+'/.default');return _0x4e0930[_0x7fdb('0x1d')]('\x20');}function getAccessTokenScope(_0x3c0416){if(_0x3c0416['type']===_0x7fdb('0x1e'))return _0x7fdb('0x1f');if(_0x3c0416[_0x7fdb('0x19')]===_0x7fdb('0x1a'))return _0x3c0416[_0x7fdb('0x1c')]+_0x7fdb('0x20');}function generateMicrosoftAuthorizationUrl(_0x1f7c2b,_0x134fb4){var _0x3763f9=MICROSOFT_AUTH_URL['replace'](_0x7fdb('0x21'),_0x1f7c2b[_0x7fdb('0x22')]);var _0x5313f1=['code',_0x7fdb('0x23')];var _0x2b6c7f=Buffer[_0x7fdb('0x24')](JSON[_0x7fdb('0x25')]({'id':_0x134fb4}))[_0x7fdb('0x26')](_0x7fdb('0x27'));var _0x4e8076=crypto[_0x7fdb('0x28')](0x10)['toString'](_0x7fdb('0x29'));var _0x179a00=getAuthorizationScopes(_0x1f7c2b);var _0x4001a5=[{'key':_0x7fdb('0x2a'),'value':_0x1f7c2b[_0x7fdb('0x2b')]},{'key':'response_type','value':encodeURIComponent(_0x5313f1[_0x7fdb('0x1d')]('\x20'))},{'key':_0x7fdb('0x2c'),'value':_0x1f7c2b[_0x7fdb('0x2d')]},{'key':_0x7fdb('0x2e'),'value':'form_post'},{'key':_0x7fdb('0x2f'),'value':encodeURIComponent(_0x179a00)},{'key':'state','value':_0x2b6c7f},{'key':_0x7fdb('0x30'),'value':_0x4e8076},{'key':_0x7fdb('0x31'),'value':_0x7fdb('0x32')}];var _0x3f3b42=_0x3763f9+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4001a5,function(_0x1d9a4f){return _0x1d9a4f[_0x7fdb('0x33')]+'='+_0x1d9a4f[_0x7fdb('0x34')];})['join']('&');_0x1f7c2b[_0x7fdb('0x35')]={'issuer':_0x3763f9[_0x7fdb('0x36')](_0x7fdb('0x37'),''),'audience':_0x1f7c2b[_0x7fdb('0x2b')],'state':_0x2b6c7f,'nonce':_0x4e8076};redis[_0x7fdb('0x38')](_0x2b6c7f,JSON[_0x7fdb('0x25')](_0x1f7c2b));return _0x3f3b42;}function isValidIdToken(_0x48bcef,_0x18c314){try{var _0x20757f=jwt[_0x7fdb('0x39')](_0x48bcef,{'complete':!![]});var _0x376fe2=_0x20757f[_0x7fdb('0x3a')];if(_0x376fe2['iss']!==_0x18c314[_0x7fdb('0x3b')])return![];if(_0x376fe2['aud']!==_0x18c314[_0x7fdb('0x3c')])return![];if(_0x376fe2[_0x7fdb('0x30')]!==_0x18c314[_0x7fdb('0x30')])return![];if(moment()[_0x7fdb('0x3d')](moment[_0x7fdb('0x3e')](_0x376fe2[_0x7fdb('0x3f')])))return![];return!![];}catch(_0x2bd9a5){throw _0x2bd9a5;}}function refreshOauth2MicrosoftAccessToken(_0x51dd68){return Promise['resolve']()[_0x7fdb('0x40')](function(){if(_0x51dd68['data3'])return _0x51dd68;return db[_0x7fdb('0x41')][_0x7fdb('0x42')]({'where':{'id':_0x51dd68['id']},'raw':!![]});})[_0x7fdb('0x40')](function(_0x2c5a75){var _0x19d819={'grant_type':'refresh_token','refresh_token':_0x2c5a75[_0x7fdb('0x43')],'scope':getAccessTokenScope(_0x2c5a75),'redirect_uri':_0x2c5a75['data4'],'client_id':_0x2c5a75[_0x7fdb('0x2b')],'client_secret':encryptor['decryptString'](_0x2c5a75[_0x7fdb('0x44')])};var _0x450c98={'method':_0x7fdb('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7fdb('0x21'),_0x2c5a75[_0x7fdb('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x19d819,'json':!![]};return rp(_0x450c98);})[_0x7fdb('0x40')](function(_0x41b540){_0x51dd68[_0x7fdb('0x46')]=_0x41b540[_0x7fdb('0x47')];_0x51dd68[_0x7fdb('0x43')]=_0x41b540[_0x7fdb('0x48')];return db['CloudProvider'][_0x7fdb('0x49')]({'data5':_0x51dd68[_0x7fdb('0x46')],'data6':_0x51dd68[_0x7fdb('0x43')]},{'where':{'id':_0x51dd68['id']}});})['then'](function(){return _0x51dd68;})[_0x7fdb('0x4a')](function(_0x4398ee){logger[_0x7fdb('0x4b')](_0x7fdb('0x4c'),_0x51dd68['id'],_0x4398ee);});}function getOauth2MicrosoftAccessToken(_0x30cb44,_0x3cf199){var _0x1a3686={'grant_type':_0x7fdb('0x4d'),'code':_0x30cb44,'scope':getAccessTokenScope(_0x3cf199),'redirect_uri':_0x3cf199[_0x7fdb('0x2d')],'client_id':_0x3cf199[_0x7fdb('0x2b')],'client_secret':encryptor[_0x7fdb('0x4e')](_0x3cf199['data3'])};var _0x7c0cd5={'method':_0x7fdb('0x45'),'uri':MICROSOFT_AUTH_URL[_0x7fdb('0x36')](_0x7fdb('0x21'),_0x3cf199[_0x7fdb('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a3686,'json':!![]};return rp(_0x7c0cd5);}function startRefreshInterval(_0x3253d5){var _0x15c459=schedule[_0x7fdb('0x4f')];if(_0x15c459[_0x3253d5['id']])clearInterval(_0x15c459[_0x3253d5['id']]);_0x15c459[_0x3253d5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7fdb('0x50')](this,{'id':_0x3253d5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7fdb('0x4f')]=_0x15c459;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x7fdb('0x51')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7fdb('0x40')](function(_0x16c058){var _0x5339fa=_0x16c058['map'](function(_0x359c0d){return refreshOauth2MicrosoftAccessToken(_0x359c0d)[_0x7fdb('0x40')](function(_0x520eff){startRefreshInterval(_0x520eff);});});return Promise[_0x7fdb('0x52')](_0x5339fa);})[_0x7fdb('0x4a')](function(_0x514ecc){var _0x114508=_0x514ecc?util[_0x7fdb('0x53')](_0x514ecc,{'showHidden':![],'depth':null}):'';logger[_0x7fdb('0x4b')](_0x7fdb('0x54'),_0x114508);});}module[_0x7fdb('0x55')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 9acb437..b6328fe 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 _0xedf1=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x45a1c4,_0x78263e){var _0x1947bf=function(_0x4c40ba){while(--_0x4c40ba){_0x45a1c4['push'](_0x45a1c4['shift']());}};_0x1947bf(++_0x78263e);}(_0xedf1,0xb2));var _0x1edf=function(_0x25b80e,_0x503088){_0x25b80e=_0x25b80e-0x0;var _0xd2c680=_0xedf1[_0x25b80e];return _0xd2c680;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});} \ No newline at end of file +var _0xb5fb=['request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15c530,_0x489b22){var _0x3bd24f=function(_0x164499){while(--_0x164499){_0x15c530['push'](_0x15c530['shift']());}};_0x3bd24f(++_0x489b22);}(_0xb5fb,0x172));var _0xbb5f=function(_0x5905f7,_0x2261f6){_0x5905f7=_0x5905f7-0x0;var _0x18724f=_0xb5fb[_0x5905f7];return _0x18724f;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8a3dbb5..5a6e725 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0x1261,0x144));var _0x1126=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x1261[_0x1e393b];return _0x3d0bfe;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x362743,_0x4f4b49){var _0x27047f=function(_0x54ef8e){while(--_0x54ef8e){_0x362743['push'](_0x362743['shift']());}};_0x27047f(++_0x4f4b49);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d5b4016..135e64e 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 _0xf350=['STRING','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf350,0x1e9));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f35('0x0'));module[_0x0f35('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0f35('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0f35('0x3')]},'companyId':{'type':Sequelize[_0x0f35('0x3')]},'website':{'type':Sequelize[_0x0f35('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0f35('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0f35('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0f35('0x3')]},'email':{'type':Sequelize[_0x0f35('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0f35('0x3')]},'sStreet':{'type':Sequelize[_0x0f35('0x3')]},'sPostalCode':{'type':Sequelize[_0x0f35('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f35('0x3')]}}; \ No newline at end of file +var _0x1948=['sequelize','STRING'];(function(_0x45875a,_0x2645c9){var _0x16da59=function(_0x29fa56){while(--_0x29fa56){_0x45875a['push'](_0x45875a['shift']());}};_0x16da59(++_0x2645c9);}(_0x1948,0x1b4));var _0x8194=function(_0x130308,_0x4d4478){_0x130308=_0x130308-0x0;var _0x1a728d=_0x1948[_0x130308];return _0x1a728d;};'use strict';var Sequelize=require(_0x8194('0x0'));module['exports']={'name':{'type':Sequelize[_0x8194('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8194('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8194('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8194('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8194('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8194('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8194('0x1')]},'sStreet':{'type':Sequelize[_0x8194('0x1')]},'sPostalCode':{'type':Sequelize[_0x8194('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8194('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7a7cf94..a0777a4 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 _0x5323=['Companies','UserProfileResource','error','name','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','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','describe','CmContact','addContacts','ids','omit','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x5323,0x1e8));var _0x3532=function(_0x4495f4,_0x1df31f){_0x4495f4=_0x4495f4-0x0;var _0xc2651c=_0x5323[_0x4495f4];return _0xc2651c;};'use strict';var emlformat=require(_0x3532('0x0'));var rimraf=require(_0x3532('0x1'));var zipdir=require(_0x3532('0x2'));var jsonpatch=require(_0x3532('0x3'));var rp=require(_0x3532('0x4'));var moment=require('moment');var BPromise=require(_0x3532('0x5'));var Mustache=require(_0x3532('0x6'));var util=require(_0x3532('0x7'));var path=require('path');var sox=require(_0x3532('0x8'));var csv=require(_0x3532('0x9'));var ejs=require(_0x3532('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3532('0xb'));var squel=require(_0x3532('0xc'));var crypto=require(_0x3532('0xd'));var jsforce=require(_0x3532('0xe'));var deskjs=require(_0x3532('0xf'));var toCsv=require(_0x3532('0x9'));var querystring=require('querystring');var Papa=require(_0x3532('0x10'));var Redis=require(_0x3532('0x11'));var authService=require(_0x3532('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3532('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3532('0x14'));var utils=require(_0x3532('0x15'));var config=require(_0x3532('0x16'));var licenseUtil=require(_0x3532('0x17'));var db=require(_0x3532('0x18'))['db'];function respondWithStatusCode(_0x379f29,_0x212786){_0x212786=_0x212786||0xcc;return function(_0x4a56c2){if(_0x4a56c2){return _0x379f29[_0x3532('0x19')](_0x212786);}return _0x379f29[_0x3532('0x1a')](_0x212786)[_0x3532('0x1b')]();};}function respondWithResult(_0x80089b,_0x465846){_0x465846=_0x465846||0xc8;return function(_0x706a49){if(_0x706a49){return _0x80089b['status'](_0x465846)[_0x3532('0x1c')](_0x706a49);}};}function respondWithFilteredResult(_0x4e3ffd,_0x3d619b){return function(_0x580693){if(_0x580693){var _0x19ed61=typeof _0x3d619b[_0x3532('0x1d')]==='undefined'&&typeof _0x3d619b[_0x3532('0x1e')]===_0x3532('0x1f');var _0x48eb5d=_0x580693[_0x3532('0x20')];var _0x19b3c5=_0x19ed61?0x0:_0x3d619b[_0x3532('0x1d')];var _0x3be0ec=_0x19ed61?_0x580693['count']:_0x3d619b[_0x3532('0x1d')]+_0x3d619b[_0x3532('0x1e')];var _0x1e961c;if(_0x3be0ec>=_0x48eb5d){_0x3be0ec=_0x48eb5d;_0x1e961c=0xc8;}else{_0x1e961c=0xce;}_0x4e3ffd[_0x3532('0x1a')](_0x1e961c);return _0x4e3ffd[_0x3532('0x21')](_0x3532('0x22'),_0x19b3c5+'-'+_0x3be0ec+'/'+_0x48eb5d)[_0x3532('0x1c')](_0x580693);}return null;};}function patchUpdates(_0x5eea7e){return function(_0x56f35f){try{jsonpatch['apply'](_0x56f35f,_0x5eea7e,!![]);}catch(_0x5ca2ca){return BPromise[_0x3532('0x23')](_0x5ca2ca);}return _0x56f35f[_0x3532('0x24')]();};}function saveUpdates(_0x82cde4,_0x450a32){return function(_0x2b1e03){if(_0x2b1e03){return _0x2b1e03[_0x3532('0x25')](_0x82cde4)['then'](function(_0x54be45){return _0x54be45;});}return null;};}function removeEntity(_0x1836a7,_0x5e97b8){return function(_0xbe99eb){if(_0xbe99eb){return _0xbe99eb[_0x3532('0x26')]()[_0x3532('0x27')](function(){var _0x3751d8=_0xbe99eb['get']({'plain':!![]});var _0x146c4d=_0x3532('0x28');return db[_0x3532('0x29')]['destroy']({'where':{'type':_0x146c4d,'resourceId':_0x3751d8['id']}})[_0x3532('0x27')](function(){return _0xbe99eb;});})[_0x3532('0x27')](function(){_0x1836a7['status'](0xcc)[_0x3532('0x1b')]();});}};}function handleEntityNotFound(_0x206cd6,_0x3cacae){return function(_0x47fe58){if(!_0x47fe58){_0x206cd6[_0x3532('0x19')](0x194);}return _0x47fe58;};}function handleError(_0x28dc84,_0x23d003){_0x23d003=_0x23d003||0x1f4;return function(_0x2c38b7){logger[_0x3532('0x2a')](_0x2c38b7['stack']);if(_0x2c38b7[_0x3532('0x2b')]){delete _0x2c38b7[_0x3532('0x2b')];}_0x28dc84[_0x3532('0x1a')](_0x23d003)['send'](_0x2c38b7);};}exports['index']=function(_0x495a03,_0x56d634){var _0x5260c5={},_0x144ad9={},_0x409fd3={'count':0x0,'rows':[]};return db[_0x3532('0x2c')]['describe']()[_0x3532('0x27')](function(_0x5b6f19){_0x144ad9[_0x3532('0x2d')]=_[_0x3532('0x2e')](_0x5b6f19);_0x144ad9[_0x3532('0x2f')]=_[_0x3532('0x2e')](_0x495a03[_0x3532('0x2f')]);_0x144ad9[_0x3532('0x30')]=_[_0x3532('0x31')](_0x144ad9[_0x3532('0x2d')],_0x144ad9[_0x3532('0x2f')]);_0x5260c5[_0x3532('0x32')]=_[_0x3532('0x31')](_0x144ad9[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x495a03[_0x3532('0x2f')][_0x3532('0x33')]));_0x5260c5[_0x3532('0x32')]=_0x5260c5[_0x3532('0x32')][_0x3532('0x34')]?_0x5260c5['attributes']:_0x144ad9[_0x3532('0x2d')];if(!_0x495a03[_0x3532('0x2f')]['hasOwnProperty'](_0x3532('0x35'))){_0x5260c5[_0x3532('0x1e')]=qs[_0x3532('0x1e')](_0x495a03[_0x3532('0x2f')][_0x3532('0x1e')]);_0x5260c5[_0x3532('0x1d')]=qs[_0x3532('0x1d')](_0x495a03[_0x3532('0x2f')][_0x3532('0x1d')]);}_0x5260c5[_0x3532('0x36')]=qs[_0x3532('0x37')](_0x495a03[_0x3532('0x2f')]['sort']);_0x5260c5[_0x3532('0x38')]=qs[_0x3532('0x30')](_[_0x3532('0x39')](_0x495a03[_0x3532('0x2f')],_0x144ad9[_0x3532('0x30')]),_0x5b6f19);if(_0x495a03[_0x3532('0x2f')][_0x3532('0x3a')]){_0x5260c5[_0x3532('0x38')]=_['merge'](_0x5260c5['where'],{'$or':_[_0x3532('0x3b')](_0x5260c5[_0x3532('0x32')],function(_0x4de40d){var _0x3dbcbc={};_0x3dbcbc[_0x4de40d]={'$like':'%'+_0x495a03['query'][_0x3532('0x3a')]+'%'};return _0x3dbcbc;})});}_0x5260c5=_[_0x3532('0x3c')]({},_0x5260c5,_0x495a03[_0x3532('0x3d')]);var _0x476f54={'where':_0x5260c5[_0x3532('0x38')]};return db[_0x3532('0x2c')]['count'](_0x476f54)[_0x3532('0x27')](function(_0x149201){_0x409fd3[_0x3532('0x20')]=_0x149201;if(_0x495a03[_0x3532('0x2f')][_0x3532('0x3e')]){_0x5260c5[_0x3532('0x3f')]=[{'all':!![]}];}return db[_0x3532('0x2c')][_0x3532('0x40')](_0x5260c5);})[_0x3532('0x27')](function(_0x443a61){_0x409fd3[_0x3532('0x41')]=_0x443a61;return _0x409fd3;})['then'](respondWithFilteredResult(_0x56d634,_0x5260c5))[_0x3532('0x42')](handleError(_0x56d634,null));})[_0x3532('0x42')](handleError(_0x56d634,null));};exports[_0x3532('0x43')]=function(_0x221e7f,_0x1c98b7){var _0x2acf54={'raw':![],'where':{'id':_0x221e7f['params']['id']}},_0x3c7e19={};_0x3c7e19[_0x3532('0x2d')]=_['keys'](db[_0x3532('0x2c')][_0x3532('0x44')]);_0x3c7e19[_0x3532('0x2f')]=_[_0x3532('0x2e')](_0x221e7f[_0x3532('0x2f')]);_0x3c7e19[_0x3532('0x30')]=_['intersection'](_0x3c7e19[_0x3532('0x2d')],_0x3c7e19['query']);_0x2acf54[_0x3532('0x32')]=_[_0x3532('0x31')](_0x3c7e19[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x221e7f[_0x3532('0x2f')][_0x3532('0x33')]));_0x2acf54[_0x3532('0x32')]=_0x2acf54[_0x3532('0x32')][_0x3532('0x34')]?_0x2acf54['attributes']:_0x3c7e19[_0x3532('0x2d')];if(_0x221e7f['query']['includeAll']){_0x2acf54[_0x3532('0x3f')]=[{'all':!![]}];}_0x2acf54=_['merge']({},_0x2acf54,_0x221e7f[_0x3532('0x3d')]);return db['CmCompany'][_0x3532('0x45')](_0x2acf54)['then'](handleEntityNotFound(_0x1c98b7,null))[_0x3532('0x27')](respondWithResult(_0x1c98b7,null))[_0x3532('0x42')](handleError(_0x1c98b7,null));};exports[_0x3532('0x46')]=function(_0x70a162,_0x1f12e0){return db['CmCompany'][_0x3532('0x46')](_0x70a162[_0x3532('0x47')],{})[_0x3532('0x27')](function(_0x5883e6){var _0x200588=_0x70a162[_0x3532('0x48')][_0x3532('0x49')]({'plain':!![]});if(!_0x200588)throw new Error(_0x3532('0x4a'));if(_0x200588[_0x3532('0x4b')]==='user'){var _0x5a3605=_0x5883e6[_0x3532('0x49')]({'plain':!![]});var _0x493e6c=_0x3532('0x28');return db[_0x3532('0x4c')][_0x3532('0x45')]({'where':{'name':_0x493e6c,'userProfileId':_0x200588[_0x3532('0x4d')]},'raw':!![]})[_0x3532('0x27')](function(_0xd347ad){if(_0xd347ad&&_0xd347ad[_0x3532('0x4e')]===0x0){return db[_0x3532('0x29')][_0x3532('0x46')]({'name':_0x5a3605[_0x3532('0x2b')],'resourceId':_0x5a3605['id'],'type':_0xd347ad[_0x3532('0x2b')],'sectionId':_0xd347ad['id']},{})[_0x3532('0x27')](function(){return _0x5883e6;});}else{return _0x5883e6;}})['catch'](function(_0x253a40){logger['error'](_0x3532('0x4f'),_0x253a40);throw _0x253a40;});}return _0x5883e6;})[_0x3532('0x27')](respondWithResult(_0x1f12e0,0xc9))[_0x3532('0x42')](handleError(_0x1f12e0,null));};exports['update']=function(_0x550585,_0x19b9af){if(_0x550585[_0x3532('0x47')]['id']){delete _0x550585['body']['id'];}return db[_0x3532('0x2c')][_0x3532('0x45')]({'where':{'id':_0x550585[_0x3532('0x50')]['id']}})['then'](handleEntityNotFound(_0x19b9af,null))[_0x3532('0x27')](saveUpdates(_0x550585[_0x3532('0x47')],null))['then'](respondWithResult(_0x19b9af,null))[_0x3532('0x42')](handleError(_0x19b9af,null));};exports['destroy']=function(_0x6c93a1,_0x593938){return db[_0x3532('0x2c')][_0x3532('0x45')]({'where':{'id':_0x6c93a1[_0x3532('0x50')]['id']}})[_0x3532('0x27')](handleEntityNotFound(_0x593938,null))['then'](removeEntity(_0x593938,null))[_0x3532('0x42')](handleError(_0x593938,null));};exports['describe']=function(_0x1282bb,_0x44b6a7){return db[_0x3532('0x2c')][_0x3532('0x51')]()[_0x3532('0x27')](respondWithResult(_0x44b6a7,null))['catch'](handleError(_0x44b6a7,null));};exports['addContacts']=function(_0x15e7fb,_0x100d84,_0x1a7cec){return db[_0x3532('0x52')][_0x3532('0x45')]({'where':{'id':_0x15e7fb[_0x3532('0x50')]['id']}})['then'](handleEntityNotFound(_0x100d84,null))['then'](function(_0x5bce3d){if(_0x5bce3d){return _0x5bce3d[_0x3532('0x53')](_0x15e7fb[_0x3532('0x47')][_0x3532('0x54')],_[_0x3532('0x55')](_0x15e7fb[_0x3532('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x100d84,null))[_0x3532('0x42')](handleError(_0x100d84,null));};exports[_0x3532('0x56')]=function(_0x380a30,_0x480359,_0x197b20){var _0x23674b={};var _0x11d3da={};var _0x1fab4f;var _0x5b288b;return db[_0x3532('0x2c')]['findOne']({'where':{'id':_0x380a30[_0x3532('0x50')]['id']}})[_0x3532('0x27')](handleEntityNotFound(_0x480359,null))[_0x3532('0x27')](function(_0x2120b0){if(_0x2120b0){_0x1fab4f=_0x2120b0;_0x11d3da[_0x3532('0x2d')]=_[_0x3532('0x2e')](db['CmContact'][_0x3532('0x44')]);_0x11d3da['query']=_[_0x3532('0x2e')](_0x380a30[_0x3532('0x2f')]);_0x11d3da[_0x3532('0x30')]=_[_0x3532('0x31')](_0x11d3da['model'],_0x11d3da[_0x3532('0x2f')]);_0x23674b[_0x3532('0x32')]=_[_0x3532('0x31')](_0x11d3da[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x380a30[_0x3532('0x2f')]['fields']));_0x23674b[_0x3532('0x32')]=_0x23674b[_0x3532('0x32')][_0x3532('0x34')]?_0x23674b[_0x3532('0x32')]:_0x11d3da['model'];_0x23674b[_0x3532('0x36')]=qs[_0x3532('0x37')](_0x380a30['query'][_0x3532('0x37')]);_0x23674b[_0x3532('0x38')]=qs[_0x3532('0x30')](_[_0x3532('0x39')](_0x380a30[_0x3532('0x2f')],_0x11d3da[_0x3532('0x30')]));if(_0x380a30['query'][_0x3532('0x3a')]){_0x23674b['where']=_['merge'](_0x23674b[_0x3532('0x38')],{'$or':_[_0x3532('0x3b')](_0x23674b[_0x3532('0x32')],function(_0x6d4e7){var _0x52a89a={};_0x52a89a[_0x6d4e7]={'$like':'%'+_0x380a30[_0x3532('0x2f')][_0x3532('0x3a')]+'%'};return _0x52a89a;})});}_0x23674b=_['merge']({},_0x23674b,_0x380a30['options']);return _0x1fab4f[_0x3532('0x56')](_0x23674b);}})[_0x3532('0x27')](function(_0x1e406e){if(_0x1e406e){_0x5b288b=_0x1e406e[_0x3532('0x34')];if(!_0x380a30['query'][_0x3532('0x57')](_0x3532('0x35'))){_0x23674b['limit']=qs['limit'](_0x380a30[_0x3532('0x2f')]['limit']);_0x23674b[_0x3532('0x1d')]=qs[_0x3532('0x1d')](_0x380a30['query'][_0x3532('0x1d')]);}return _0x1fab4f[_0x3532('0x56')](_0x23674b);}})[_0x3532('0x27')](function(_0x3dd9d7){if(_0x3dd9d7){return _0x3dd9d7?{'count':_0x5b288b,'rows':_0x3dd9d7}:null;}})['then'](respondWithResult(_0x480359,null))['catch'](handleError(_0x480359,null));}; \ No newline at end of file +var _0x9f57=['query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','CmCompany','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','CmContact','map','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Companies','error','stack','name','index','describe','keys','filters','intersection','model'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9f57,0x7b));var _0x79f5=function(_0x3e6058,_0xc27036){_0x3e6058=_0x3e6058-0x0;var _0x3b21ad=_0x9f57[_0x3e6058];return _0x3b21ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79f5('0x0'));var zipdir=require(_0x79f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79f5('0x2'));var moment=require('moment');var BPromise=require(_0x79f5('0x3'));var Mustache=require(_0x79f5('0x4'));var util=require('util');var path=require(_0x79f5('0x5'));var sox=require(_0x79f5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79f5('0x7'));var squel=require(_0x79f5('0x8'));var crypto=require(_0x79f5('0x9'));var jsforce=require(_0x79f5('0xa'));var deskjs=require(_0x79f5('0xb'));var toCsv=require(_0x79f5('0xc'));var querystring=require(_0x79f5('0xd'));var Papa=require(_0x79f5('0xe'));var Redis=require(_0x79f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x79f5('0x10'));var hardwareService=require(_0x79f5('0x11'));var logger=require(_0x79f5('0x12'))(_0x79f5('0x13'));var utils=require('../../config/utils');var config=require(_0x79f5('0x14'));var licenseUtil=require(_0x79f5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac636,_0x24686b){_0x24686b=_0x24686b||0xcc;return function(_0x3a86c6){if(_0x3a86c6){return _0x3ac636[_0x79f5('0x16')](_0x24686b);}return _0x3ac636[_0x79f5('0x17')](_0x24686b)[_0x79f5('0x18')]();};}function respondWithResult(_0x28eb6b,_0x3c1645){_0x3c1645=_0x3c1645||0xc8;return function(_0x1ce988){if(_0x1ce988){return _0x28eb6b[_0x79f5('0x17')](_0x3c1645)[_0x79f5('0x19')](_0x1ce988);}};}function respondWithFilteredResult(_0xe71172,_0x190561){return function(_0x145f83){if(_0x145f83){var _0x3b55d9=typeof _0x190561[_0x79f5('0x1a')]===_0x79f5('0x1b')&&typeof _0x190561[_0x79f5('0x1c')]===_0x79f5('0x1b');var _0x447a05=_0x145f83[_0x79f5('0x1d')];var _0x2fbcbf=_0x3b55d9?0x0:_0x190561[_0x79f5('0x1a')];var _0x3b0ed6=_0x3b55d9?_0x145f83[_0x79f5('0x1d')]:_0x190561['offset']+_0x190561[_0x79f5('0x1c')];var _0x1b73e3;if(_0x3b0ed6>=_0x447a05){_0x3b0ed6=_0x447a05;_0x1b73e3=0xc8;}else{_0x1b73e3=0xce;}_0xe71172[_0x79f5('0x17')](_0x1b73e3);return _0xe71172[_0x79f5('0x1e')](_0x79f5('0x1f'),_0x2fbcbf+'-'+_0x3b0ed6+'/'+_0x447a05)['json'](_0x145f83);}return null;};}function patchUpdates(_0x359ef4){return function(_0xd81731){try{jsonpatch[_0x79f5('0x20')](_0xd81731,_0x359ef4,!![]);}catch(_0x2ee8bd){return BPromise['reject'](_0x2ee8bd);}return _0xd81731[_0x79f5('0x21')]();};}function saveUpdates(_0x292d40,_0x38fef5){return function(_0x945d1a){if(_0x945d1a){return _0x945d1a[_0x79f5('0x22')](_0x292d40)[_0x79f5('0x23')](function(_0x69b8f9){return _0x69b8f9;});}return null;};}function removeEntity(_0x36cd42,_0x392203){return function(_0x333e69){if(_0x333e69){return _0x333e69[_0x79f5('0x24')]()[_0x79f5('0x23')](function(){var _0x42a0b5=_0x333e69['get']({'plain':!![]});var _0x348622=_0x79f5('0x25');return db['UserProfileResource'][_0x79f5('0x24')]({'where':{'type':_0x348622,'resourceId':_0x42a0b5['id']}})['then'](function(){return _0x333e69;});})['then'](function(){_0x36cd42[_0x79f5('0x17')](0xcc)[_0x79f5('0x18')]();});}};}function handleEntityNotFound(_0x4c32b0,_0x21b878){return function(_0x295fd6){if(!_0x295fd6){_0x4c32b0[_0x79f5('0x16')](0x194);}return _0x295fd6;};}function handleError(_0x3a7b54,_0x372f48){_0x372f48=_0x372f48||0x1f4;return function(_0x5d7479){logger[_0x79f5('0x26')](_0x5d7479[_0x79f5('0x27')]);if(_0x5d7479[_0x79f5('0x28')]){delete _0x5d7479[_0x79f5('0x28')];}_0x3a7b54[_0x79f5('0x17')](_0x372f48)['send'](_0x5d7479);};}exports[_0x79f5('0x29')]=function(_0x112e29,_0x100bfe){var _0x28cca4={},_0x4d7f45={},_0x10df3b={'count':0x0,'rows':[]};return db['CmCompany'][_0x79f5('0x2a')]()[_0x79f5('0x23')](function(_0x1e929b){_0x4d7f45['model']=_[_0x79f5('0x2b')](_0x1e929b);_0x4d7f45['query']=_[_0x79f5('0x2b')](_0x112e29['query']);_0x4d7f45[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x4d7f45[_0x79f5('0x2e')],_0x4d7f45[_0x79f5('0x2f')]);_0x28cca4[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x4d7f45[_0x79f5('0x2e')],qs[_0x79f5('0x31')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x28cca4[_0x79f5('0x30')]=_0x28cca4['attributes'][_0x79f5('0x32')]?_0x28cca4[_0x79f5('0x30')]:_0x4d7f45[_0x79f5('0x2e')];if(!_0x112e29['query']['hasOwnProperty'](_0x79f5('0x33'))){_0x28cca4[_0x79f5('0x1c')]=qs['limit'](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x1c')]);_0x28cca4['offset']=qs[_0x79f5('0x1a')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x1a')]);}_0x28cca4[_0x79f5('0x34')]=qs[_0x79f5('0x35')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x35')]);_0x28cca4[_0x79f5('0x36')]=qs[_0x79f5('0x2c')](_[_0x79f5('0x37')](_0x112e29['query'],_0x4d7f45[_0x79f5('0x2c')]),_0x1e929b);if(_0x112e29['query']['filter']){_0x28cca4['where']=_[_0x79f5('0x38')](_0x28cca4[_0x79f5('0x36')],{'$or':_['map'](_0x28cca4[_0x79f5('0x30')],function(_0x5d9053){var _0x3f76b8={};_0x3f76b8[_0x5d9053]={'$like':'%'+_0x112e29['query'][_0x79f5('0x39')]+'%'};return _0x3f76b8;})});}_0x28cca4=_[_0x79f5('0x38')]({},_0x28cca4,_0x112e29[_0x79f5('0x3a')]);var _0x3727b0={'where':_0x28cca4[_0x79f5('0x36')]};return db[_0x79f5('0x3b')]['count'](_0x3727b0)[_0x79f5('0x23')](function(_0x4ffe14){_0x10df3b[_0x79f5('0x1d')]=_0x4ffe14;if(_0x112e29[_0x79f5('0x2f')]['includeAll']){_0x28cca4[_0x79f5('0x3c')]=[{'all':!![]}];}return db[_0x79f5('0x3b')][_0x79f5('0x3d')](_0x28cca4);})[_0x79f5('0x23')](function(_0x292250){_0x10df3b[_0x79f5('0x3e')]=_0x292250;return _0x10df3b;})[_0x79f5('0x23')](respondWithFilteredResult(_0x100bfe,_0x28cca4))[_0x79f5('0x3f')](handleError(_0x100bfe,null));})['catch'](handleError(_0x100bfe,null));};exports[_0x79f5('0x40')]=function(_0x205eba,_0x519cac){var _0x60556={'raw':![],'where':{'id':_0x205eba[_0x79f5('0x41')]['id']}},_0x13ac09={};_0x13ac09[_0x79f5('0x2e')]=_[_0x79f5('0x2b')](db[_0x79f5('0x3b')][_0x79f5('0x42')]);_0x13ac09['query']=_['keys'](_0x205eba[_0x79f5('0x2f')]);_0x13ac09[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x13ac09[_0x79f5('0x2e')],_0x13ac09[_0x79f5('0x2f')]);_0x60556[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x13ac09['model'],qs[_0x79f5('0x31')](_0x205eba[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x60556[_0x79f5('0x30')]=_0x60556['attributes']['length']?_0x60556['attributes']:_0x13ac09['model'];if(_0x205eba[_0x79f5('0x2f')][_0x79f5('0x43')]){_0x60556[_0x79f5('0x3c')]=[{'all':!![]}];}_0x60556=_[_0x79f5('0x38')]({},_0x60556,_0x205eba[_0x79f5('0x3a')]);return db[_0x79f5('0x3b')][_0x79f5('0x44')](_0x60556)['then'](handleEntityNotFound(_0x519cac,null))[_0x79f5('0x23')](respondWithResult(_0x519cac,null))[_0x79f5('0x3f')](handleError(_0x519cac,null));};exports[_0x79f5('0x45')]=function(_0xc07226,_0x445516){return db[_0x79f5('0x3b')][_0x79f5('0x45')](_0xc07226[_0x79f5('0x46')],{})[_0x79f5('0x23')](function(_0x442511){var _0x3c74bb=_0xc07226[_0x79f5('0x47')][_0x79f5('0x48')]({'plain':!![]});if(!_0x3c74bb)throw new Error(_0x79f5('0x49'));if(_0x3c74bb['role']===_0x79f5('0x47')){var _0x226dc0=_0x442511['get']({'plain':!![]});var _0x5251b1=_0x79f5('0x25');return db[_0x79f5('0x4a')][_0x79f5('0x44')]({'where':{'name':_0x5251b1,'userProfileId':_0x3c74bb[_0x79f5('0x4b')]},'raw':!![]})[_0x79f5('0x23')](function(_0x33b5b3){if(_0x33b5b3&&_0x33b5b3[_0x79f5('0x4c')]===0x0){return db[_0x79f5('0x4d')]['create']({'name':_0x226dc0[_0x79f5('0x28')],'resourceId':_0x226dc0['id'],'type':_0x33b5b3[_0x79f5('0x28')],'sectionId':_0x33b5b3['id']},{})[_0x79f5('0x23')](function(){return _0x442511;});}else{return _0x442511;}})[_0x79f5('0x3f')](function(_0x41c30e){logger['error'](_0x79f5('0x4e'),_0x41c30e);throw _0x41c30e;});}return _0x442511;})[_0x79f5('0x23')](respondWithResult(_0x445516,0xc9))['catch'](handleError(_0x445516,null));};exports['update']=function(_0x3a4825,_0x3bf655){if(_0x3a4825['body']['id']){delete _0x3a4825[_0x79f5('0x46')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x3a4825['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x3bf655,null))[_0x79f5('0x23')](saveUpdates(_0x3a4825[_0x79f5('0x46')],null))[_0x79f5('0x23')](respondWithResult(_0x3bf655,null))[_0x79f5('0x3f')](handleError(_0x3bf655,null));};exports[_0x79f5('0x24')]=function(_0x1455b3,_0x31c3cf){return db[_0x79f5('0x3b')][_0x79f5('0x44')]({'where':{'id':_0x1455b3['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x31c3cf,null))[_0x79f5('0x23')](removeEntity(_0x31c3cf,null))['catch'](handleError(_0x31c3cf,null));};exports[_0x79f5('0x2a')]=function(_0x1306fd,_0x35e8ce){return db[_0x79f5('0x3b')][_0x79f5('0x2a')]()[_0x79f5('0x23')](respondWithResult(_0x35e8ce,null))[_0x79f5('0x3f')](handleError(_0x35e8ce,null));};exports[_0x79f5('0x4f')]=function(_0x23cff5,_0x3c858c,_0x6b915f){return db['CmContact'][_0x79f5('0x44')]({'where':{'id':_0x23cff5['params']['id']}})['then'](handleEntityNotFound(_0x3c858c,null))[_0x79f5('0x23')](function(_0x5f4c53){if(_0x5f4c53){return _0x5f4c53[_0x79f5('0x4f')](_0x23cff5['body'][_0x79f5('0x50')],_[_0x79f5('0x51')](_0x23cff5[_0x79f5('0x46')],['ids','id'])||{});}})[_0x79f5('0x23')](respondWithResult(_0x3c858c,null))['catch'](handleError(_0x3c858c,null));};exports[_0x79f5('0x52')]=function(_0x290c21,_0x30c1dd,_0x3b77fd){var _0x1d97bc={};var _0x3b36fe={};var _0x1785fe;var _0x333db7;return db[_0x79f5('0x3b')]['findOne']({'where':{'id':_0x290c21['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x30c1dd,null))[_0x79f5('0x23')](function(_0x400570){if(_0x400570){_0x1785fe=_0x400570;_0x3b36fe['model']=_['keys'](db[_0x79f5('0x53')][_0x79f5('0x42')]);_0x3b36fe['query']=_[_0x79f5('0x2b')](_0x290c21[_0x79f5('0x2f')]);_0x3b36fe[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x3b36fe[_0x79f5('0x2e')],_0x3b36fe['query']);_0x1d97bc[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x3b36fe['model'],qs['fields'](_0x290c21[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x1d97bc[_0x79f5('0x30')]=_0x1d97bc[_0x79f5('0x30')][_0x79f5('0x32')]?_0x1d97bc[_0x79f5('0x30')]:_0x3b36fe['model'];_0x1d97bc[_0x79f5('0x34')]=qs[_0x79f5('0x35')](_0x290c21['query'][_0x79f5('0x35')]);_0x1d97bc[_0x79f5('0x36')]=qs['filters'](_[_0x79f5('0x37')](_0x290c21[_0x79f5('0x2f')],_0x3b36fe[_0x79f5('0x2c')]));if(_0x290c21[_0x79f5('0x2f')]['filter']){_0x1d97bc['where']=_['merge'](_0x1d97bc[_0x79f5('0x36')],{'$or':_[_0x79f5('0x54')](_0x1d97bc[_0x79f5('0x30')],function(_0x501c3a){var _0x546bc1={};_0x546bc1[_0x501c3a]={'$like':'%'+_0x290c21['query'][_0x79f5('0x39')]+'%'};return _0x546bc1;})});}_0x1d97bc=_[_0x79f5('0x38')]({},_0x1d97bc,_0x290c21['options']);return _0x1785fe[_0x79f5('0x52')](_0x1d97bc);}})[_0x79f5('0x23')](function(_0x5aaaa2){if(_0x5aaaa2){_0x333db7=_0x5aaaa2[_0x79f5('0x32')];if(!_0x290c21['query']['hasOwnProperty'](_0x79f5('0x33'))){_0x1d97bc['limit']=qs[_0x79f5('0x1c')](_0x290c21['query'][_0x79f5('0x1c')]);_0x1d97bc[_0x79f5('0x1a')]=qs['offset'](_0x290c21[_0x79f5('0x2f')][_0x79f5('0x1a')]);}return _0x1785fe[_0x79f5('0x52')](_0x1d97bc);}})[_0x79f5('0x23')](function(_0x5ad320){if(_0x5ad320){return _0x5ad320?{'count':_0x333db7,'rows':_0x5ad320}:null;}})['then'](respondWithResult(_0x30c1dd,null))[_0x79f5('0x3f')](handleError(_0x30c1dd,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 77b2709..40445d5 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 _0xadcd=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','moment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xadcd,0x141));var _0xdadc=function(_0x17e3d6,_0x40ec46){_0x17e3d6=_0x17e3d6-0x0;var _0x987bbe=_0xadcd[_0x17e3d6];return _0x987bbe;};'use strict';var _=require(_0xdadc('0x0'));var util=require(_0xdadc('0x1'));var logger=require('../../config/logger')(_0xdadc('0x2'));var moment=require(_0xdadc('0x3'));var BPromise=require('bluebird');var rp=require(_0xdadc('0x4'));var fs=require('fs');var path=require(_0xdadc('0x5'));var rimraf=require(_0xdadc('0x6'));var config=require(_0xdadc('0x7'));var attributes=require(_0xdadc('0x8'));module[_0xdadc('0x9')]=function(_0x516874,_0x17614c){return _0x516874[_0xdadc('0xa')](_0xdadc('0xb'),attributes,{'tableName':_0xdadc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb215=['./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1fe81b,_0x3cf73b){var _0xddc709=function(_0x36e5cd){while(--_0x36e5cd){_0x1fe81b['push'](_0x1fe81b['shift']());}};_0xddc709(++_0x3cf73b);}(_0xb215,0x159));var _0x5b21=function(_0x334be1,_0x567a25){_0x334be1=_0x334be1-0x0;var _0x3bc278=_0xb215[_0x334be1];return _0x3bc278;};'use strict';var _=require('lodash');var util=require(_0x5b21('0x0'));var logger=require(_0x5b21('0x1'))(_0x5b21('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b21('0x3'));var fs=require('fs');var path=require(_0x5b21('0x4'));var rimraf=require(_0x5b21('0x5'));var config=require(_0x5b21('0x6'));var attributes=require(_0x5b21('0x7'));module[_0x5b21('0x8')]=function(_0x5c5cb5,_0x32ce2e){return _0x5c5cb5[_0x5b21('0x9')](_0x5b21('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 8d416e0..0a61bd5 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 _0x2b01=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0x2b01,0xed));var _0x12b0=function(_0xff4115,_0x4ee874){_0xff4115=_0xff4115-0x0;var _0x271f95=_0x2b01[_0xff4115];return _0x271f95;};'use strict';var _=require('lodash');var util=require(_0x12b0('0x0'));var moment=require(_0x12b0('0x1'));var BPromise=require(_0x12b0('0x2'));var rs=require(_0x12b0('0x3'));var fs=require('fs');var Redis=require(_0x12b0('0x4'));var db=require(_0x12b0('0x5'))['db'];var utils=require(_0x12b0('0x6'));var logger=require('../../config/logger')(_0x12b0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x128afc,_0x54ea84,_0x1b29da){return new BPromise(function(_0x449c6c,_0x491a3d){return client[_0x12b0('0x8')](_0x128afc,_0x1b29da)[_0x12b0('0x9')](function(_0x5b9d06){logger[_0x12b0('0xa')]('CmCompany,\x20%s,\x20%s',_0x54ea84,_0x12b0('0xb'));logger[_0x12b0('0xc')](_0x12b0('0xd'),_0x54ea84,'request\x20sent',JSON[_0x12b0('0xe')](_0x5b9d06));if(_0x5b9d06['error']){if(_0x5b9d06[_0x12b0('0xf')]['code']===0x1f4){logger[_0x12b0('0xf')]('CmCompany,\x20%s,\x20%s',_0x54ea84,_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);return _0x491a3d(_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);}logger['error'](_0x12b0('0x11'),_0x54ea84,_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);return _0x449c6c(_0x5b9d06['error']['message']);}else{logger[_0x12b0('0xa')](_0x12b0('0x11'),_0x54ea84,_0x12b0('0xb'));_0x449c6c(_0x5b9d06[_0x12b0('0x12')][_0x12b0('0x10')]);}})[_0x12b0('0x13')](function(_0x3ae4cd){logger['error'](_0x12b0('0x11'),_0x54ea84,_0x3ae4cd);_0x491a3d(_0x3ae4cd);});});} \ No newline at end of file +var _0x0e5a=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','debug'];(function(_0x201fe8,_0x5f3725){var _0x247260=function(_0x131362){while(--_0x131362){_0x201fe8['push'](_0x201fe8['shift']());}};_0x247260(++_0x5f3725);}(_0x0e5a,0x70));var _0xa0e5=function(_0x1eb2c3,_0x2dd707){_0x1eb2c3=_0x1eb2c3-0x0;var _0x4e749d=_0x0e5a[_0x1eb2c3];return _0x4e749d;};'use strict';var _=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0e5('0x2'));var fs=require('fs');var Redis=require(_0xa0e5('0x3'));var db=require(_0xa0e5('0x4'))['db'];var utils=require(_0xa0e5('0x5'));var logger=require('../../config/logger')(_0xa0e5('0x6'));var config=require(_0xa0e5('0x7'));var jayson=require(_0xa0e5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282ff4,_0x43d41d,_0x1545c3){return new BPromise(function(_0x404c4f,_0x1b2e57){return client[_0xa0e5('0x9')](_0x282ff4,_0x1545c3)[_0xa0e5('0xa')](function(_0x39fe38){logger[_0xa0e5('0xb')](_0xa0e5('0xc'),_0x43d41d,'request\x20sent');logger[_0xa0e5('0xd')](_0xa0e5('0xe'),_0x43d41d,_0xa0e5('0xf'),JSON['stringify'](_0x39fe38));if(_0x39fe38['error']){if(_0x39fe38['error'][_0xa0e5('0x10')]===0x1f4){logger[_0xa0e5('0x11')](_0xa0e5('0xc'),_0x43d41d,_0x39fe38[_0xa0e5('0x11')]['message']);return _0x1b2e57(_0x39fe38[_0xa0e5('0x11')]['message']);}logger[_0xa0e5('0x11')](_0xa0e5('0xc'),_0x43d41d,_0x39fe38[_0xa0e5('0x11')][_0xa0e5('0x12')]);return _0x404c4f(_0x39fe38['error'][_0xa0e5('0x12')]);}else{logger[_0xa0e5('0xb')](_0xa0e5('0xc'),_0x43d41d,'request\x20sent');_0x404c4f(_0x39fe38[_0xa0e5('0x13')]['message']);}})[_0xa0e5('0x14')](function(_0x922444){logger['error'](_0xa0e5('0xc'),_0x43d41d,_0x922444);_0x1b2e57(_0x922444);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 48ad87b..bbc54d9 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 _0x39ff=['../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','show','/:id/contacts','getContacts','create','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x55febe,_0x459f86){var _0x35e354=function(_0x5c90b6){while(--_0x5c90b6){_0x55febe['push'](_0x55febe['shift']());}};_0x35e354(++_0x459f86);}(_0x39ff,0xd5));var _0xf39f=function(_0x24d2fc,_0x29f500){_0x24d2fc=_0x24d2fc-0x0;var _0x3cd97f=_0x39ff[_0x24d2fc];return _0x3cd97f;};'use strict';var multer=require(_0xf39f('0x0'));var util=require(_0xf39f('0x1'));var path=require(_0xf39f('0x2'));var timeout=require(_0xf39f('0x3'));var express=require(_0xf39f('0x4'));var router=express[_0xf39f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf39f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf39f('0x7'));var controller=require(_0xf39f('0x8'));router['get']('/',auth[_0xf39f('0x9')](),controller['index']);router[_0xf39f('0xa')](_0xf39f('0xb'),auth[_0xf39f('0x9')](),controller['describe']);router[_0xf39f('0xa')]('/:id',auth[_0xf39f('0x9')](),controller[_0xf39f('0xc')]);router[_0xf39f('0xa')](_0xf39f('0xd'),auth[_0xf39f('0x9')](),controller[_0xf39f('0xe')]);router['post']('/',auth[_0xf39f('0x9')](),controller[_0xf39f('0xf')]);router[_0xf39f('0x10')](_0xf39f('0xd'),auth[_0xf39f('0x9')](),controller['addContacts']);router['put'](_0xf39f('0x11'),auth[_0xf39f('0x9')](),controller[_0xf39f('0x12')]);router[_0xf39f('0x13')](_0xf39f('0x11'),auth[_0xf39f('0x9')](),controller[_0xf39f('0x14')]);module[_0xf39f('0x15')]=router; \ No newline at end of file +var _0x37a5=['show','/:id/contacts','getContacts','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x37a5,0x107));var _0x537a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x37a5[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x537a('0x0'));var util=require(_0x537a('0x1'));var path=require('path');var timeout=require(_0x537a('0x2'));var express=require(_0x537a('0x3'));var router=express[_0x537a('0x4')]();var fs_extra=require(_0x537a('0x5'));var auth=require(_0x537a('0x6'));var interaction=require(_0x537a('0x7'));var config=require(_0x537a('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x537a('0x9')](),controller[_0x537a('0xa')]);router[_0x537a('0xb')](_0x537a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x537a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x537a('0xd')]);router[_0x537a('0xb')](_0x537a('0xe'),auth['isAuthenticated'](),controller[_0x537a('0xf')]);router[_0x537a('0x10')]('/',auth[_0x537a('0x9')](),controller[_0x537a('0x11')]);router[_0x537a('0x10')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x537a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x537a('0x13')]);router['delete'](_0x537a('0x14'),auth[_0x537a('0x9')](),controller[_0x537a('0x15')]);module[_0x537a('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 c630206..6c8c8a9 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 _0x2193=['INTEGER','UNSIGNED','DATE','NOW','sequelize','STRING'];(function(_0x5cafe1,_0x3ab7cb){var _0x3acc70=function(_0x60081f){while(--_0x60081f){_0x5cafe1['push'](_0x5cafe1['shift']());}};_0x3acc70(++_0x3ab7cb);}(_0x2193,0x1f0));var _0x3219=function(_0x4d75af,_0x39c35a){_0x4d75af=_0x4d75af-0x0;var _0x2abbea=_0x2193[_0x4d75af];return _0x2abbea;};'use strict';var _=require('lodash');var Sequelize=require(_0x3219('0x0'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x3219('0x1')]},'street':{'type':Sequelize[_0x3219('0x1')]},'postalCode':{'type':Sequelize[_0x3219('0x1')]},'city':{'type':Sequelize[_0x3219('0x1')]},'country':{'type':Sequelize[_0x3219('0x1')]},'dateOfBirth':{'type':Sequelize[_0x3219('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3219('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3219('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x3219('0x1')]},'fb_data':{'type':Sequelize[_0x3219('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3219('0x1')]},'viber':{'type':Sequelize[_0x3219('0x1')]},'line':{'type':Sequelize[_0x3219('0x1')]},'wechat':{'type':Sequelize[_0x3219('0x1')]},'telegram':{'type':Sequelize[_0x3219('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3219('0x2')](0x2)[_0x3219('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3219('0x4')],'defaultValue':Sequelize[_0x3219('0x5')]},'dialTimezone':{'type':Sequelize[_0x3219('0x1')]},'utcOffset':{'type':Sequelize[_0x3219('0x2')]}}; \ No newline at end of file +var _0x6681=['UNSIGNED','DATE','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x134150,_0x3bd9a8){var _0x554990=function(_0x1498c2){while(--_0x1498c2){_0x134150['push'](_0x134150['shift']());}};_0x554990(++_0x3bd9a8);}(_0x6681,0x17d));var _0x1668=function(_0x4cd69a,_0x3b6881){_0x4cd69a=_0x4cd69a-0x0;var _0x38f36c=_0x6681[_0x4cd69a];return _0x38f36c;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x1668('0x0')]={'firstName':{'type':Sequelize[_0x1668('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1668('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1668('0x1')]},'city':{'type':Sequelize[_0x1668('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1668('0x2')]},'phone':{'type':Sequelize[_0x1668('0x1')]},'mobile':{'type':Sequelize[_0x1668('0x1')]},'fax':{'type':Sequelize[_0x1668('0x1')]},'email':{'type':Sequelize[_0x1668('0x1')]},'url':{'type':Sequelize[_0x1668('0x1')]},'facebook':{'type':Sequelize[_0x1668('0x1')]},'fb_data':{'type':Sequelize[_0x1668('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x1668('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x1668('0x1')]},'line':{'type':Sequelize[_0x1668('0x1')]},'wechat':{'type':Sequelize[_0x1668('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1668('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x1668('0x1')]},'priority':{'type':Sequelize[_0x1668('0x3')](0x2)[_0x1668('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1668('0x5')],'defaultValue':Sequelize[_0x1668('0x6')]},'dialTimezone':{'type':Sequelize[_0x1668('0x1')]},'utcOffset':{'type':Sequelize[_0x1668('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3288a99..88879d6 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 _0x8d77=['OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','show','Tag','Tags','color','tag','ContactItemType','ItemType','sequelize','Phones.OrderBy','get','CmCustomField','omit','format','timezones','$and','pickBy','startsWith','map','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','CmHopper','phone','findOne','model','rawAttributes','intersection','attributes','order','sort','filters','filter','options','getTags','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','fields','nolimit','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','rows','getHopperFinals','pick','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','error\x20child\x20process','importUpdates','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Account','closed','disposition','secondDisposition','thirdDisposition','Owner','customerIp','customerPort','deviceModel','osName','ratingType','referer','subject','substatus','openchannel','externalUrl','threadId','flatten','reverse','value','slice','moment','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./cmContact.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','end','error','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','keys','length','cf_','columnName','displayName','analytics','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d77,0x1ae));var _0x78d7=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x8d77[_0x433a86];return _0x23000c;};'use strict';var moment=require(_0x78d7('0x0'));var BPromise=require('bluebird');var util=require(_0x78d7('0x1'));var path=require(_0x78d7('0x2'));var fs=require('fs');var _=require(_0x78d7('0x3'));var squel=require('squel');var Papa=require(_0x78d7('0x4'));var Redis=require(_0x78d7('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x78d7('0x6'));var logger=require(_0x78d7('0x7'))(_0x78d7('0x8'));var config=require(_0x78d7('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x78d7('0xa')]=_[_0x78d7('0xb')](config[_0x78d7('0xa')],{'host':_0x78d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78d7('0xa')]));require(_0x78d7('0xd'))[_0x78d7('0xe')](socket);function respondWithResult(_0x5c99f9,_0x3bd607){_0x3bd607=_0x3bd607||0xc8;return function(_0x20e34f){if(_0x20e34f){return _0x5c99f9[_0x78d7('0xf')](_0x3bd607)[_0x78d7('0x10')](_0x20e34f);}};}function respondWithFilteredResult(_0x493d57,_0xa26860){return function(_0x76b6b){if(_0x76b6b){var _0x5e0fed=typeof _0xa26860['offset']===_0x78d7('0x11')&&typeof _0xa26860[_0x78d7('0x12')]===_0x78d7('0x11');var _0x31d29c=_0x76b6b[_0x78d7('0x13')];var _0x5866b7=_0x5e0fed?0x0:_0xa26860[_0x78d7('0x14')];var _0x380f3a=_0x5e0fed?_0x76b6b['count']:_0xa26860['offset']+_0xa26860[_0x78d7('0x12')];var _0x3838db;if(_0x380f3a>=_0x31d29c){_0x380f3a=_0x31d29c;_0x3838db=0xc8;}else{_0x3838db=0xce;}_0x493d57[_0x78d7('0xf')](_0x3838db);return _0x493d57['set'](_0x78d7('0x15'),_0x5866b7+'-'+_0x380f3a+'/'+_0x31d29c)['json'](_0x76b6b);}return null;};}function saveUpdates(_0x1eba9f){return function(_0x5e0ec4){if(_0x5e0ec4){return _0x5e0ec4[_0x78d7('0x16')](_0x1eba9f)[_0x78d7('0x17')](function(_0x4d3029){return _0x4d3029;});}return null;};}function removeEntity(_0x30ab62){return function(_0xbe014e){if(_0xbe014e){return _0xbe014e['destroy']()[_0x78d7('0x17')](function(){_0x30ab62[_0x78d7('0xf')](0xcc)[_0x78d7('0x18')]();});}};}function handleEntityNotFound(_0x59caf6){return function(_0x182c20){if(!_0x182c20){_0x59caf6['sendStatus'](0x194);}return _0x182c20;};}function handleError(_0xc79c99,_0x2540f8){_0x2540f8=_0x2540f8||0x1f4;return function(_0xe88049){logger[_0x78d7('0x19')](_0xe88049['stack']);if(_0xe88049[_0x78d7('0x1a')]){delete _0xe88049[_0x78d7('0x1a')];}_0xc79c99[_0x78d7('0xf')](_0x2540f8)[_0x78d7('0x1b')](_0xe88049);};}exports[_0x78d7('0x1c')]=function(_0x83a444,_0x1ee336){var _0x57f43c={};return contacts[_0x78d7('0x1d')]()[_0x78d7('0x17')](function(_0x24055d){_0x57f43c=qs[_0x78d7('0x1e')](_0x24055d,_0x83a444);return contacts[_0x78d7('0x1f')](_0x83a444[_0x78d7('0x20')],_0x83a444[_0x78d7('0x21')],_0x57f43c,_0x24055d);})['then'](respondWithFilteredResult(_0x1ee336,_0x57f43c))[_0x78d7('0x22')](handleError(_0x1ee336,null));};exports['destroy']=function(_0x14a9ac,_0x2e2b63){return db[_0x78d7('0x23')][_0x78d7('0x24')]({'where':{'id':_0x14a9ac[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x2e2b63,null))[_0x78d7('0x17')](removeEntity(_0x2e2b63,null))[_0x78d7('0x22')](handleError(_0x2e2b63,null));};exports[_0x78d7('0x1d')]=function(_0x55ca31,_0x1279bf){return db[_0x78d7('0x23')]['describe']()['then'](function(_0x3e0946){delete _0x3e0946['tags'];for(var _0x479d4b=0x0;_0x479d4b0x0){return new Promise(function(_0x276408){var _0x2708ad=[];for(var _0x4fbd7c=0x0;_0x4fbd7c<_0xc402ec['length'];_0x4fbd7c++){_0x2708ad[_0x78d7('0x5e')](insertAdditionalPhones(_0xc402ec[_0x4fbd7c][_0x78d7('0x5f')],_0xc402ec[_0x4fbd7c][_0x78d7('0x55')]));}Promise['all'](_0x2708ad)[_0x78d7('0x17')](function(){_0x276408(0x1);});})[_0x78d7('0x17')](function(){return{'success':_0x4bc266,'failure':_0x23b331,'duplicates':_0x121968};});}else{return{'success':_0x4bc266,'failure':_0x23b331,'duplicates':_0x121968};}}})[_0x78d7('0x17')](respondWithResult(_0x3a3d36,0xc9))['catch'](handleError(_0x3a3d36,null));};exports[_0x78d7('0x60')]=function(_0x7cff06,_0x1fcdc3){var _0x4010b4;return db[_0x78d7('0x23')]['describe']()[_0x78d7('0x17')](function(_0x4776c8){return db[_0x78d7('0x23')][_0x78d7('0x24')]({'where':{'id':_0x7cff06[_0x78d7('0x25')]['id']},'include':[{'model':db[_0x78d7('0x61')],'as':_0x78d7('0x62'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0x63')],'required':_0x7cff06[_0x78d7('0x20')][_0x78d7('0x64')]?!![]:![]},{'model':db[_0x78d7('0x49')],'as':'Phones','where':{'CmContactId':_0x7cff06[_0x78d7('0x25')]['id']},'required':![],'include':[{'model':db[_0x78d7('0x65')],'as':_0x78d7('0x66')}]}],'order':[db[_0x78d7('0x67')]['literal'](_0x78d7('0x68'))],'attributes':_[_0x78d7('0x26')](_0x4776c8)});})[_0x78d7('0x17')](function(_0x5381bc){if(!_[_0x78d7('0x52')](_0x5381bc)){_0x4010b4=_0x5381bc[_0x78d7('0x69')]({'plain':!![]});var _0x2f641f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5381bc&&_0x5381bc['ListId']){if(_0x5381bc[_0x78d7('0x5b')]){_0x2f641f[_0x78d7('0x59')]['$and'][_0x78d7('0x5e')]({'ListId':{'$ne':_0x5381bc[_0x78d7('0x5b')]}});}}return db[_0x78d7('0x6a')][_0x78d7('0x1f')](_0x2f641f);}})[_0x78d7('0x17')](function(_0x4662fd){if(!_[_0x78d7('0x52')](_0x4662fd)){return _[_0x78d7('0x6b')](_0x4010b4,_['map'](_0x4662fd,function(_0x11e792){return util[_0x78d7('0x6c')]('cf_%d',_0x11e792['id']);}));}})[_0x78d7('0x17')](handleEntityNotFound(_0x1fcdc3,null))[_0x78d7('0x17')](respondWithResult(_0x1fcdc3,null))['catch'](handleError(_0x1fcdc3,null));};exports['update']=function(_0x8770d5,_0x3cbbd2){var _0x27eb28;if(_0x8770d5[_0x78d7('0x35')]['id']){delete _0x8770d5[_0x78d7('0x35')]['id'];}if(!_[_0x78d7('0x52')](_0x8770d5[_0x78d7('0x35')][_0x78d7('0x53')])){var _0x3beba4=_0x8770d5[_0x78d7('0x35')][_0x78d7('0x53')];if(!_[_0x78d7('0x52')](shared[_0x78d7('0x6d')][_0x3beba4]))_0x8770d5['body']['utcOffset']=shared[_0x78d7('0x6d')][_0x3beba4][_0x78d7('0x54')];}return db['CmContact']['find']({'where':{'id':_0x8770d5[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x3cbbd2,null))[_0x78d7('0x17')](saveUpdates(_0x8770d5[_0x78d7('0x35')],null))['then'](function(_0x4928c0){_0x27eb28=_0x4928c0;var _0x1d2a6b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4928c0&&_0x4928c0[_0x78d7('0x5b')]){if(_0x4928c0[_0x78d7('0x5b')]){_0x1d2a6b[_0x78d7('0x59')][_0x78d7('0x6e')][_0x78d7('0x5e')]({'ListId':{'$ne':_0x4928c0[_0x78d7('0x5b')]}});}}return db[_0x78d7('0x6a')][_0x78d7('0x1f')](_0x1d2a6b);})['then'](function(_0x1c6457){if(_0x1c6457){return _['omit'](_[_0x78d7('0x6f')](_0x8770d5[_0x78d7('0x35')],function(_0x29d370,_0xa79f17){return _[_0x78d7('0x70')](_0xa79f17,'cf_');}),_[_0x78d7('0x71')](_0x1c6457,function(_0x239cfe){return util[_0x78d7('0x6c')](_0x78d7('0x72'),_0x239cfe['id']);}));}})[_0x78d7('0x17')](function(_0x28c2b0){if(_0x28c2b0&&!_[_0x78d7('0x73')](_0x28c2b0)){var _0x32351c=squel['update']()[_0x78d7('0x74')](_0x78d7('0x75'))['setFields'](_0x28c2b0)[_0x78d7('0x59')](_0x78d7('0x76'),_0x8770d5['params']['id'])['toParam']();return db[_0x78d7('0x67')]['query'](_0x32351c['text'],{'replacements':_0x32351c[_0x78d7('0x2f')]});}})[_0x78d7('0x17')](function(){if(_0x8770d5['body']['phone']&&_0x27eb28){return db[_0x78d7('0x77')]['update']({'phone':_0x8770d5[_0x78d7('0x35')][_0x78d7('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x27eb28['id']}});}})[_0x78d7('0x17')](function(){return _0x27eb28;})[_0x78d7('0x17')](respondWithResult(_0x3cbbd2,null))[_0x78d7('0x22')](handleError(_0x3cbbd2,null));};exports['getTags']=function(_0x26499a,_0xbf1f5f){var _0x31d729={};var _0x3e5dd0={};var _0xc295dc;var _0x318594;return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x26499a[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0xbf1f5f,null))[_0x78d7('0x17')](function(_0xef0445){if(_0xef0445){_0xc295dc=_0xef0445;_0x3e5dd0[_0x78d7('0x7a')]=_[_0x78d7('0x26')](db[_0x78d7('0x61')][_0x78d7('0x7b')]);_0x3e5dd0[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x26499a['query']);_0x3e5dd0['filters']=_[_0x78d7('0x7c')](_0x3e5dd0[_0x78d7('0x7a')],_0x3e5dd0[_0x78d7('0x20')]);_0x31d729[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x3e5dd0[_0x78d7('0x7a')],qs['fields'](_0x26499a[_0x78d7('0x20')]['fields']));_0x31d729['attributes']=_0x31d729['attributes']['length']?_0x31d729[_0x78d7('0x7d')]:_0x3e5dd0[_0x78d7('0x7a')];_0x31d729[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x26499a['query'][_0x78d7('0x7f')]);_0x31d729[_0x78d7('0x59')]=qs['filters'](_['pick'](_0x26499a[_0x78d7('0x20')],_0x3e5dd0[_0x78d7('0x80')]));if(_0x26499a[_0x78d7('0x20')][_0x78d7('0x81')]){_0x31d729[_0x78d7('0x59')]=_['merge'](_0x31d729[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x31d729[_0x78d7('0x7d')],function(_0x1a252b){var _0xe38e5a={};_0xe38e5a[_0x1a252b]={'$like':'%'+_0x26499a['query'][_0x78d7('0x81')]+'%'};return _0xe38e5a;})});}_0x31d729=_[_0x78d7('0x34')]({},_0x31d729,_0x26499a[_0x78d7('0x82')]);return _0xc295dc[_0x78d7('0x83')](_0x31d729);}})[_0x78d7('0x17')](function(_0x527501){if(_0x527501){_0x318594=_0x527501[_0x78d7('0x27')];if(!_0x26499a['query']['hasOwnProperty']('nolimit')){_0x31d729[_0x78d7('0x12')]=qs['limit'](_0x26499a['query'][_0x78d7('0x12')]);_0x31d729[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x26499a[_0x78d7('0x20')]['offset']);}return _0xc295dc[_0x78d7('0x83')](_0x31d729);}})[_0x78d7('0x17')](function(_0x1b8453){if(_0x1b8453){return _0x1b8453?{'count':_0x318594,'rows':_0x1b8453}:null;}})[_0x78d7('0x17')](respondWithResult(_0xbf1f5f,null))['catch'](handleError(_0xbf1f5f,null));};exports['setTags']=function(_0x21a3bc,_0x1a0f34){if(_0x21a3bc[_0x78d7('0x35')]['id']){delete _0x21a3bc[_0x78d7('0x35')]['id'];}return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x21a3bc['params']['id']}})['then'](handleEntityNotFound(_0x1a0f34,null))[_0x78d7('0x17')](function(_0x36a475){if(_0x36a475){return _0x36a475[_0x78d7('0x84')](_0x21a3bc['body'][_0x78d7('0x85')]||[]);}return null;})['then'](respondWithResult(_0x1a0f34,null))[_0x78d7('0x22')](handleError(_0x1a0f34,null));};exports[_0x78d7('0x86')]=function(_0x53f7aa,_0x148cc3){var _0xb3ad5e=[];_0xb3ad5e[_0x78d7('0x5e')](addAdditionalPhones(_0x53f7aa['body']));Promise[_0x78d7('0x87')](_0xb3ad5e)[_0x78d7('0x17')](function(){_0xb3ad5e=[];_0xb3ad5e[_0x78d7('0x5e')](deleteCmHopperPhones(_0x53f7aa[_0x78d7('0x35')]['id']));_0xb3ad5e['push'](addCmHopperPhones(_0x53f7aa[_0x78d7('0x35')]['id']));Promise[_0x78d7('0x87')](_0xb3ad5e)[_0x78d7('0x17')](function(){return[0x1];})[_0x78d7('0x17')](respondWithResult(_0x148cc3,null));});};function addAdditionalPhones(_0x4ba06e){var _0xaff239;return new Promise(function(_0x2bd1af){return db[_0x78d7('0x49')][_0x78d7('0x3c')]({'where':{'CmContactId':_0x4ba06e['id']}})[_0x78d7('0x17')](function(){db[_0x78d7('0x65')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id',_0x78d7('0x88')]})[_0x78d7('0x17')](function(_0x44cff7){var _0x355305=[];for(var _0x345971=0x0;_0x345971<_0x4ba06e[_0x78d7('0x89')][_0x78d7('0x27')];_0x345971++){var _0x4f2337=_0x4ba06e[_0x78d7('0x8a')]?_['isNil'](_0x4ba06e[_0x78d7('0x8a')][_0x345971])?'':_0x4ba06e[_0x78d7('0x8a')][_0x345971]:_0x4ba06e[_0x78d7('0x89')][_0x345971]['ItemTypeId']?_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]:'';var _0x17eef9=_['isNil'](_0x4ba06e[_0x78d7('0x89')][_0x345971]['description'])?'':_0x4ba06e[_0x78d7('0x89')][_0x345971]['description'];var _0x5bcee0=_0x4f2337+':'+_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x78')]+'§'+_0x17eef9;if(_['isNil'](_0xaff239))_0xaff239=_0x5bcee0;else _0xaff239+=';'+_0x5bcee0;var _0x429bee=null;var _0xe9a5bd=null;if(_0x4ba06e[_0x78d7('0x8a')]){if(!_[_0x78d7('0x52')](_0x4ba06e[_0x78d7('0x8a')][_0x345971])){_0xe9a5bd=_[_0x78d7('0x24')](_0x44cff7,function(_0x818f36){return _0x818f36['id']===_0x4ba06e['item_types'][_0x345971];});if(!_[_0x78d7('0x52')](_0xe9a5bd)){_0x429bee=_0xe9a5bd[_0x78d7('0x88')];}}}else{if(!_[_0x78d7('0x52')](_0x4ba06e['items'][_0x345971])){_0xe9a5bd=_[_0x78d7('0x24')](_0x44cff7,function(_0x43391e){return _0x43391e['id']===_0x4ba06e['items'][_0x345971][_0x78d7('0x8b')];});if(!_[_0x78d7('0x52')](_0xe9a5bd)){_0x429bee=_0x345971;}}}if(_[_0x78d7('0x52')](_0x429bee)){_0x429bee=0x64;}_0x355305['push'](addAdditionalPhone(_0x4ba06e['id'],_0x4ba06e['items'][_0x345971][_0x78d7('0x78')],_0x4ba06e[_0x78d7('0x8a')]?_[_0x78d7('0x52')](_0x4ba06e['item_types'][_0x345971])?null:_0x4ba06e[_0x78d7('0x8a')][_0x345971]:_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]?_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]:null,_0x429bee,_0x17eef9));}Promise[_0x78d7('0x87')](_0x355305)[_0x78d7('0x17')](function(){db[_0x78d7('0x23')][_0x78d7('0x16')]({'AdditionalPhones':_0xaff239},{'where':{'id':_0x4ba06e['id']}})[_0x78d7('0x17')](function(){_0x2bd1af(0x1);});});});});});}function addAdditionalPhone(_0x20c936,_0x1dee8a,_0x50ee9b,_0xba68c2,_0x5b6e73){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x20c936,'item':_0x1dee8a}})[_0x78d7('0x17')](function(_0x32a999){if(_0x32a999)logger[_0x78d7('0x30')](_0x78d7('0x8c'),_0x32a999);else{db[_0x78d7('0x49')]['create']({'CmContactId':_0x20c936,'item':_0x1dee8a,'ItemTypeId':_0x50ee9b,'OrderBy':_0xba68c2,'ItemClass':_0x78d7('0x8d'),'description':_0x5b6e73});}});}function deleteCmHopperPhones(_0x28279a){return new Promise(function(_0x1a7267){return db[_0x78d7('0x77')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x28279a}})['then'](function(_0x3c2798){db[_0x78d7('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x78d7('0x71')](_0x3c2798,'id')}}});})[_0x78d7('0x17')](function(){_0x1a7267(0x1);});});}function addCmHopperPhones(_0x1da471){return new Promise(function(_0x2c3256){return db['CmHopper'][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1da471}})[_0x78d7('0x17')](function(_0x263e31){var _0x50bec8=[];_[_0x78d7('0x71')](_0x263e31,function(_0x25554a){_0x50bec8[_0x78d7('0x5e')](createCmHopperPhone(_0x1da471,_0x25554a['id']));});Promise[_0x78d7('0x87')](_0x50bec8)[_0x78d7('0x17')](function(){_0x2c3256(0x1);});});});}function createCmHopperPhone(_0x514671,_0x381e2b){return new Promise(function(_0x270bf3){db[_0x78d7('0x49')]['findAll']({'raw':!![],'attributes':[_0x78d7('0x8f'),_0x78d7('0x88')],'where':{'CmContactId':_0x514671,'ItemClass':'PHONE'},'include':[{'model':db[_0x78d7('0x65')],'attributes':[_0x78d7('0x88')],'as':_0x78d7('0x66')}],'order':[_0x78d7('0x88'),db[_0x78d7('0x67')][_0x78d7('0x90')](_0x78d7('0x91'))]})[_0x78d7('0x17')](function(_0x306566){var _0x47a92e=0x1;var _0x202954=_[_0x78d7('0x71')](_0x306566,function(_0x4856d4){_0x4856d4['CmHopperId']=_0x381e2b;_0x4856d4[_0x78d7('0x78')]=_0x4856d4[_0x78d7('0x8f')];_0x4856d4[_0x78d7('0x88')]=_0x47a92e;delete _0x4856d4['ItemType.OrderBy'];_0x47a92e=_0x47a92e+0x1;return _0x4856d4;});return db[_0x78d7('0x8e')]['bulkCreate'](_0x202954,{});})[_0x78d7('0x17')](function(){_0x270bf3(0x1);});});}function insertAdditionalPhones(_0x2ab99a,_0x1d4687){return new Promise(function(_0x5b8769){var _0x133adf=[];for(var _0x3f9637=0x0;_0x3f9637<_0x1d4687[_0x78d7('0x27')];_0x3f9637++){var _0x5cce25=_0x1d4687[_0x3f9637];_0x133adf[_0x78d7('0x5e')](parseContactItemType(_0x5cce25));}Promise[_0x78d7('0x87')](_0x133adf)['then'](function(){var _0x1fc2ad={'id':_0x2ab99a['id'],'items':_0x1d4687};return addAdditionalPhones(_0x1fc2ad)[_0x78d7('0x17')](function(){return addCmHopperPhones(_0x2ab99a['id']);});})[_0x78d7('0x17')](function(){_0x5b8769(_0x2ab99a);});});}function parseContactItemType(_0x1d9d76){return new Promise(function(_0x532d51){if(_0x1d9d76[_0x78d7('0x33')]('ItemTypeId')){_0x532d51(_0x1d9d76);}else{return db['ContactItemType'][_0x78d7('0x24')]({'where':{'name':_0x1d9d76[_0x78d7('0x66')]}})[_0x78d7('0x17')](function(_0x3e144f){if(_[_0x78d7('0x52')](_0x3e144f))_0x1d9d76[_0x78d7('0x8b')]=null;else _0x1d9d76[_0x78d7('0x8b')]=_0x3e144f['id'];_0x532d51(_0x1d9d76);});}});}exports['getAdditionalPhones']=function(_0x462a44,_0x2bb5f5){return db['CmContactHasItem'][_0x78d7('0x1f')]({'raw':!![],'where':{'CmContactId':_0x462a44[_0x78d7('0x25')]['id'],'ItemClass':_0x78d7('0x8d')},'include':[{'model':db[_0x78d7('0x65')],'as':_0x78d7('0x66')}],'order':[[_0x78d7('0x88')],[db[_0x78d7('0x67')][_0x78d7('0x90')](_0x78d7('0x91'))]]})[_0x78d7('0x17')](function(_0x58e847){return _0x58e847;})[_0x78d7('0x17')](respondWithResult(_0x2bb5f5,null))[_0x78d7('0x22')](handleError(_0x2bb5f5,null));};exports[_0x78d7('0x92')]=function(_0x4e99ee,_0x400b44){return db['CmContactHasItem'][_0x78d7('0x1f')]({'raw':!![],'where':{'CmContactId':_0x4e99ee[_0x78d7('0x35')][_0x78d7('0x93')]}})['then'](function(_0x54840c){var _0x182811=_[_0x78d7('0x71')](_0x54840c,function(_0x55afd6){_0x55afd6[_0x78d7('0x94')]=_0x4e99ee['body'][_0x78d7('0x95')];return _0x55afd6;});return db[_0x78d7('0x49')][_0x78d7('0x56')](_0x182811,{});})[_0x78d7('0x17')](function(){return addCmHopperPhones(_0x4e99ee[_0x78d7('0x35')]['toContactId']);})[_0x78d7('0x17')](function(){return['ok'];})[_0x78d7('0x17')](respondWithResult(_0x400b44,null))[_0x78d7('0x22')](handleError(_0x400b44,null));};exports[_0x78d7('0x96')]=function(_0x17cd3e,_0xe259cf){var _0x137ce8=[];_0x137ce8[_0x78d7('0x5e')](createCmHopperPhone(_0x17cd3e[_0x78d7('0x35')]['id'],_0x17cd3e[_0x78d7('0x35')]['hopperId']));Promise[_0x78d7('0x87')](_0x137ce8)[_0x78d7('0x17')](function(){return[0x1];})[_0x78d7('0x17')](respondWithResult(_0xe259cf,null));};exports[_0x78d7('0x97')]=function(_0x4687a3,_0x4c1069){var _0x1ebe25={'raw':![],'where':{}};var _0x1186b9={};var _0x37d7c5={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x4687a3['params']['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x4c1069,null))[_0x78d7('0x17')](function(_0x205fc1){if(_0x205fc1){_0x1186b9['model']=_['keys'](db[_0x78d7('0x77')]['rawAttributes']);_0x1186b9[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x4687a3[_0x78d7('0x20')]);_0x1186b9[_0x78d7('0x80')]=_[_0x78d7('0x7c')](_0x1186b9[_0x78d7('0x7a')],_0x1186b9[_0x78d7('0x20')]);_0x1ebe25[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x1186b9[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x4687a3[_0x78d7('0x20')]['fields']));_0x1ebe25[_0x78d7('0x7d')]=_0x1ebe25[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x1ebe25['attributes']:_0x1186b9[_0x78d7('0x7a')];if(!_0x4687a3['query'][_0x78d7('0x33')](_0x78d7('0x99'))){_0x1ebe25[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x12')]);_0x1ebe25[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x1ebe25[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x1ebe25[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_['pick'](_0x4687a3['query'],_0x1186b9[_0x78d7('0x80')]));_0x1ebe25[_0x78d7('0x59')][_0x78d7('0x9a')]=_0x205fc1['id'];if(_0x4687a3[_0x78d7('0x20')][_0x78d7('0x81')]){_0x1ebe25[_0x78d7('0x59')]=_['merge'](_0x1ebe25[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x1ebe25[_0x78d7('0x7d')],function(_0x15f09e){var _0x34a093={};_0x34a093[_0x15f09e]={'$like':'%'+_0x4687a3[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x34a093;})});}_0x1ebe25=_[_0x78d7('0x34')]({},_0x1ebe25,_0x4687a3[_0x78d7('0x82')]);return db['CmHopper'][_0x78d7('0x13')]({'where':_0x1ebe25[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x5b00ac){_0x37d7c5[_0x78d7('0x13')]=_0x5b00ac;if(_0x4687a3[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x1ebe25[_0x78d7('0x9c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1ebe25);})[_0x78d7('0x17')](function(_0x57e455){_0x37d7c5['rows']=_0x57e455;return _0x37d7c5;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x4c1069,_0x1ebe25))[_0x78d7('0x22')](handleError(_0x4c1069,null));};exports[_0x78d7('0x9d')]=function(_0x7f9d1,_0x297f55){var _0x59bc14={'raw':!![],'where':{}};var _0x29e39c={};var _0x41482e={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x7f9d1[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x297f55,null))[_0x78d7('0x17')](function(_0x3ae61c){if(_0x3ae61c){_0x29e39c[_0x78d7('0x7a')]=_['keys'](db[_0x78d7('0x9e')][_0x78d7('0x7b')]);_0x29e39c['query']=_[_0x78d7('0x26')](_0x7f9d1[_0x78d7('0x20')]);_0x29e39c[_0x78d7('0x80')]=_[_0x78d7('0x7c')](_0x29e39c['model'],_0x29e39c[_0x78d7('0x20')]);_0x59bc14[_0x78d7('0x7d')]=_['intersection'](_0x29e39c[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x98')]));_0x59bc14[_0x78d7('0x7d')]=_0x59bc14[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x59bc14[_0x78d7('0x7d')]:_0x29e39c['model'];if(!_0x7f9d1['query'][_0x78d7('0x33')]('nolimit')){_0x59bc14[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x12')]);_0x59bc14[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x7f9d1['query']['offset']);}_0x59bc14[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x59bc14[_0x78d7('0x59')]=qs['filters'](_['pick'](_0x7f9d1[_0x78d7('0x20')],_0x29e39c[_0x78d7('0x80')]));_0x59bc14[_0x78d7('0x59')]['ContactId']=_0x3ae61c['id'];if(_0x7f9d1['query'][_0x78d7('0x81')]){_0x59bc14[_0x78d7('0x59')]=_['merge'](_0x59bc14[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x59bc14[_0x78d7('0x7d')],function(_0x26909e){var _0x3eba47={};_0x3eba47[_0x26909e]={'$like':'%'+_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x3eba47;})});}_0x59bc14=_['merge']({},_0x59bc14,_0x7f9d1[_0x78d7('0x82')]);return db[_0x78d7('0x9e')]['count']({'where':_0x59bc14[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x12db34){_0x41482e[_0x78d7('0x13')]=_0x12db34;if(_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x59bc14['include']=[{'all':!![]}];}return db[_0x78d7('0x9e')][_0x78d7('0x1f')](_0x59bc14);})[_0x78d7('0x17')](function(_0x3e7814){_0x41482e[_0x78d7('0x9f')]=_0x3e7814;return _0x41482e;});}})['then'](respondWithFilteredResult(_0x297f55,_0x59bc14))['catch'](handleError(_0x297f55,null));};exports[_0x78d7('0xa0')]=function(_0x95c17c,_0x384a4f){var _0x4e54bd={'raw':!![],'where':{}};var _0xde2f2a={};var _0x2c07bb={'count':0x0,'rows':[]};return db[_0x78d7('0x23')]['findOne']({'where':{'id':_0x95c17c['params']['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x384a4f,null))[_0x78d7('0x17')](function(_0xeab451){if(_0xeab451){_0xde2f2a[_0x78d7('0x7a')]=_['keys'](db['CmHopperFinal'][_0x78d7('0x7b')]);_0xde2f2a[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x95c17c['query']);_0xde2f2a['filters']=_[_0x78d7('0x7c')](_0xde2f2a['model'],_0xde2f2a[_0x78d7('0x20')]);_0x4e54bd[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0xde2f2a['model'],qs['fields'](_0x95c17c['query'][_0x78d7('0x98')]));_0x4e54bd[_0x78d7('0x7d')]=_0x4e54bd[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x4e54bd[_0x78d7('0x7d')]:_0xde2f2a[_0x78d7('0x7a')];if(!_0x95c17c[_0x78d7('0x20')]['hasOwnProperty'](_0x78d7('0x99'))){_0x4e54bd[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x95c17c['query'][_0x78d7('0x12')]);_0x4e54bd[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x95c17c[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x4e54bd['order']=qs['sort'](_0x95c17c[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x4e54bd[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_[_0x78d7('0xa1')](_0x95c17c['query'],_0xde2f2a['filters']));_0x4e54bd['where']['ContactId']=_0xeab451['id'];if(_0x95c17c[_0x78d7('0x20')]['filter']){_0x4e54bd[_0x78d7('0x59')]=_['merge'](_0x4e54bd[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x4e54bd[_0x78d7('0x7d')],function(_0x322c30){var _0x14b892={};_0x14b892[_0x322c30]={'$like':'%'+_0x95c17c[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x14b892;})});}_0x4e54bd=_[_0x78d7('0x34')]({},_0x4e54bd,_0x95c17c[_0x78d7('0x82')]);return db[_0x78d7('0x4a')][_0x78d7('0x13')]({'where':_0x4e54bd[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x5c97ba){_0x2c07bb[_0x78d7('0x13')]=_0x5c97ba;if(_0x95c17c[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x4e54bd[_0x78d7('0x9c')]=[{'all':!![]}];}return db[_0x78d7('0x4a')][_0x78d7('0x1f')](_0x4e54bd);})[_0x78d7('0x17')](function(_0x18ab12){_0x2c07bb[_0x78d7('0x9f')]=_0x18ab12;return _0x2c07bb;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x384a4f,_0x4e54bd))[_0x78d7('0x22')](handleError(_0x384a4f,null));};exports['getJscriptySessions']=function(_0x570fb3,_0x163839){var _0x1d2c2e={'raw':!![],'where':{}};var _0x377291={};var _0x15e2fa={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x570fb3[_0x78d7('0x25')]['id']}})['then'](handleEntityNotFound(_0x163839,null))['then'](function(_0x125b89){if(_0x125b89){_0x377291[_0x78d7('0x7a')]=_[_0x78d7('0x26')](db[_0x78d7('0x4f')][_0x78d7('0x7b')]);_0x377291[_0x78d7('0x20')]=_['keys'](_0x570fb3['query']);_0x377291['filters']=_[_0x78d7('0x7c')](_0x377291['model'],_0x377291['query']);_0x1d2c2e[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x377291[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x570fb3['query'][_0x78d7('0x98')]));_0x1d2c2e['attributes']=_0x1d2c2e[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x1d2c2e[_0x78d7('0x7d')]:_0x377291[_0x78d7('0x7a')];if(!_0x570fb3[_0x78d7('0x20')][_0x78d7('0x33')](_0x78d7('0x99'))){_0x1d2c2e[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x570fb3[_0x78d7('0x20')]['limit']);_0x1d2c2e['offset']=qs['offset'](_0x570fb3[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x1d2c2e[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x570fb3['query'][_0x78d7('0x7f')]);_0x1d2c2e[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_[_0x78d7('0xa1')](_0x570fb3[_0x78d7('0x20')],_0x377291[_0x78d7('0x80')]));_0x1d2c2e[_0x78d7('0x59')]['ContactId']=_0x125b89['id'];if(_0x570fb3[_0x78d7('0x20')]['filter']){_0x1d2c2e[_0x78d7('0x59')]=_[_0x78d7('0x34')](_0x1d2c2e[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x1d2c2e[_0x78d7('0x7d')],function(_0x18ff8d){var _0x5dfd39={};_0x5dfd39[_0x18ff8d]={'$like':'%'+_0x570fb3[_0x78d7('0x20')]['filter']+'%'};return _0x5dfd39;})});}_0x1d2c2e=_[_0x78d7('0x34')]({},_0x1d2c2e,_0x570fb3[_0x78d7('0x82')]);return db[_0x78d7('0x4f')]['count']({'where':_0x1d2c2e[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x3ecae2){_0x15e2fa[_0x78d7('0x13')]=_0x3ecae2;if(_0x570fb3[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x1d2c2e[_0x78d7('0x9c')]=[{'all':!![]}];}return db[_0x78d7('0x4f')][_0x78d7('0x1f')](_0x1d2c2e);})[_0x78d7('0x17')](function(_0x206806){_0x15e2fa[_0x78d7('0x9f')]=_0x206806;return _0x15e2fa;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x163839,_0x1d2c2e))[_0x78d7('0x22')](handleError(_0x163839,null));};exports[_0x78d7('0xa2')]=function(_0x3d3c10,_0x271e7d){try{if(!_0x3d3c10[_0x78d7('0x35')]['ListId']){throw new Error(_0x78d7('0xa3'));}if(!_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3d3c10['body']['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3d3c10['body'][_0x78d7('0xa5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x495080=_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa4')][_0x78d7('0xa6')](',');var _0x1a092d=_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa7')][_0x78d7('0xa6')](',');if(!_0x495080[_0x78d7('0x27')]||!_0x1a092d[_0x78d7('0x27')]||_0x495080['length']!==_0x1a092d[_0x78d7('0x27')]){throw new Error(_0x78d7('0xa8'));}_0x3d3c10[_0x78d7('0x35')]['fields']=_[_0x78d7('0xa9')](_0x495080,_0x1a092d);if(!_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x98')]['phone']){throw new Error(_0x78d7('0xaa'));}if(!_0x3d3c10[_0x78d7('0x35')]['fields'][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}var _0x504f35=path['join'](config[_0x78d7('0xad')],_0x78d7('0xae'),_0x3d3c10[_0x78d7('0xaf')][_0x78d7('0xb0')]);fs['chmodSync'](_0x504f35,parseInt(_0x78d7('0xb1'),0x8));var _0x3c4e32=require(_0x78d7('0xb2'))['fork'](path[_0x78d7('0x39')](__dirname,_0x78d7('0xb3')),[_0x504f35,_0x3d3c10['body'][_0x78d7('0xa4')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa7')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x5b')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xb4')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x58')],_0x3d3c10['body'][_0x78d7('0xa5')]]);return _0x271e7d['status'](0xc8)[_0x78d7('0x10')]({'message':_0x78d7('0xb5'),'pid':_0x3c4e32[_0x78d7('0xb6')]});}catch(_0x4f161d){return _0x271e7d[_0x78d7('0xf')](0x1f4)[_0x78d7('0x1b')](_0x4f161d);}};exports['upload']=function(_0x4d0f0a,_0x2b2d2d){var _0x309316=fs['createReadStream'](_0x4d0f0a[_0x78d7('0xaf')][_0x78d7('0x2')]);Papa[_0x78d7('0xb7')](_0x309316,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x35e112){return _0x2b2d2d[_0x78d7('0xf')](0xc8)[_0x78d7('0x10')]({'file':_0x4d0f0a[_0x78d7('0xaf')],'fields':_0x35e112[_0x78d7('0xb8')][_0x78d7('0x98')]});}});};exports[_0x78d7('0xb9')]=function(_0x2434dc,_0x2894fd){return db[_0x78d7('0xba')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x78d7('0xbb')}})[_0x78d7('0x17')](function(_0x48a774){var _0x549f48=![];if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0xbc')]['phone']){throw new Error(_0x78d7('0xaa'));}if(!_0x2434dc['body'][_0x78d7('0xbc')][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0xa5')]){throw new Error(_0x78d7('0xbd'));}var _0x517bbd=require(_0x78d7('0xb2'))[_0x78d7('0xbe')](path[_0x78d7('0x39')](__dirname,_0x78d7('0xbf')),[_0x2434dc[_0x78d7('0x25')]['id'],JSON['stringify'](_0x2434dc['body']),JSON[_0x78d7('0xc0')](_0x48a774)]);_0x517bbd['on']('message',function(){_0x549f48=!![];return _0x2894fd['status'](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x517bbd[_0x78d7('0xb6')]});});_0x517bbd['on']('exit',function(_0x3185a7){if(_0x3185a7&&!_0x549f48){return _0x2894fd[_0x78d7('0xf')](0x1f4)['json']({'message':_0x78d7('0xc1'),'pid':_0x517bbd['pid']});}});})[_0x78d7('0x22')](handleError(_0x2894fd,null));};exports[_0x78d7('0xc2')]=function(_0x36c7e8,_0x331c29){return db['User'][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x78d7('0xbb')}})[_0x78d7('0x17')](function(_0x2d3515){var _0x54d069=![];if(!_0x36c7e8['body'][_0x78d7('0x5b')]){throw new Error(_0x78d7('0xa3'));}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xbc')][_0x78d7('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xbc')][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xa5')]){throw new Error(_0x78d7('0xbd'));}var _0x564035=require('child_process')[_0x78d7('0xbe')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x36c7e8[_0x78d7('0x25')]['id'],JSON[_0x78d7('0xc0')](_0x36c7e8[_0x78d7('0x35')]),JSON[_0x78d7('0xc0')](_0x2d3515)]);_0x564035['on'](_0x78d7('0xc3'),function(){_0x54d069=!![];return _0x331c29[_0x78d7('0xf')](0xc8)[_0x78d7('0x10')]({'message':_0x78d7('0xc4'),'pid':_0x564035[_0x78d7('0xb6')]});});_0x564035['on'](_0x78d7('0xc5'),function(_0x3247af){if(_0x3247af&&!_0x54d069){return _0x331c29[_0x78d7('0xf')](0x1f4)[_0x78d7('0x10')]({'message':_0x78d7('0xc1'),'pid':_0x564035[_0x78d7('0xb6')]});}});})[_0x78d7('0x22')](handleError(_0x331c29,null));};exports[_0x78d7('0xc6')]=function(_0x6cfac1,_0x317d3d){var _0x475ff8=[_0x78d7('0xc7'),_0x78d7('0xc8'),_0x78d7('0xc9'),'openchannel',_0x78d7('0xca'),_0x78d7('0xcb'),_0x78d7('0xcc')];var _0x3a7614={'offset':0x0,'order':qs['sort'](_0x78d7('0xcd'))},_0x2e029e={'count':0x0,'rows':[]};Promise[_0x78d7('0xce')]()[_0x78d7('0x17')](function(){if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')]){if(!_[_0x78d7('0xd0')](_0x475ff8,_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')][_0x78d7('0xd1')]())){throw new Error(_0x78d7('0xd2'));}_0x475ff8=[_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')][_0x78d7('0xd1')]()];}if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){try{var _0xea98d0=JSON['parse'](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]);if(!moment(_0xea98d0['from'])[_0x78d7('0xd4')]()){throw new Error(_0x78d7('0xd5'));}if(!moment(_0xea98d0['to'])[_0x78d7('0xd4')]()){throw new Error(_0x78d7('0xd6'));}}catch(_0x5951fd){throw new Error(_0x78d7('0xd7'));}}if(!_0x6cfac1[_0x78d7('0x20')]['hasOwnProperty'](_0x78d7('0x99'))){_0x3a7614[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0x12')]||0xa);_0x3a7614['offset']=qs[_0x78d7('0x14')](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0x14')]);}var _0x33f4d2=_0x475ff8[_0x78d7('0x71')](function(_0x43234d){if(_0x43234d===_0x78d7('0xcc')){var _0xbeb229={'attributes':['id','uniqueid',_0x78d7('0x2e'),_0x78d7('0xd8'),_0x78d7('0xd9'),'callerid',_0x78d7('0xda'),_0x78d7('0xdb'),_0x78d7('0xdc'),_0x78d7('0xdd'),_0x78d7('0xde'),'userDisposition',_0x78d7('0xdf'),_0x78d7('0xe0'),_0x78d7('0xe1')],'where':{'ContactId':_0x6cfac1[_0x78d7('0x25')]['id']},'include':[{'model':db[_0x78d7('0xba')],'as':_0x78d7('0xba'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0xe2'),'alias']}],'order':[[_0x78d7('0xde'),_0x78d7('0xe3')]]};if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){_0xbeb229[_0x78d7('0x59')][_0x78d7('0xde')]={'$gte':_0xea98d0[_0x78d7('0x3b')],'$lte':_0xea98d0['to']};}return db[_0x78d7('0x4c')][_0x78d7('0xe4')](_0xbeb229)[_0x78d7('0x17')](function(_0x5f23a8){_0x2e029e[_0x78d7('0x13')]+=_0x5f23a8[_0x78d7('0x13')];return _[_0x78d7('0x71')](_0x5f23a8[_0x78d7('0x9f')],function(_0x1fa608){var _0x4b72e9=_0x1fa608[_0x78d7('0x69')]({'plain':!![]});_0x4b72e9['channel']=_0x43234d;if(_0x4b72e9[_0x78d7('0xba')]){_0x4b72e9['User']={'id':_0x4b72e9[_0x78d7('0xba')]['id'],'name':_0x4b72e9[_0x78d7('0xba')][_0x78d7('0x1a')],'fullname':_0x4b72e9['User'][_0x78d7('0xe2')],'alias':_0x4b72e9[_0x78d7('0xba')][_0x78d7('0x2c')]};}return _0x4b72e9;});});}else{var _0xd2712d=_[_0x78d7('0xe5')](_0x43234d)+(_0x43234d==='chat'?'Website':_0x78d7('0xe6'));var _0x1bafab={'attributes':['id',_0x78d7('0xe7'),'closedAt',_0x78d7('0xde'),_0x78d7('0xdd'),_0x78d7('0xe8'),_0x78d7('0xe9'),_0x78d7('0xea'),'UserId',_0xd2712d+'Id'],'where':{'ContactId':_0x6cfac1[_0x78d7('0x25')]['id']},'include':[{'model':db[_0xd2712d],'as':'Account','attributes':['id',_0x78d7('0x1a'),'key']},{'model':db[_0x78d7('0xba')],'as':_0x78d7('0xeb'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0xe2')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x78d7('0x1a'),_0x78d7('0x63')],'through':{'attributes':[]}}],'order':[[_0x78d7('0xde'),_0x78d7('0xe3')]]};if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){_0x1bafab[_0x78d7('0x59')]['createdAt']={'$gte':_0xea98d0[_0x78d7('0x3b')],'$lte':_0xea98d0['to']};}switch(_0x43234d){case'chat':_0x1bafab[_0x78d7('0x7d')]['push']('browserName',_0x78d7('0xec'),_0x78d7('0xed'),_0x78d7('0xee'),_0x78d7('0xef'),'ratingMessage',_0x78d7('0xf0'),'ratingValue',_0x78d7('0xf1'));break;case _0x78d7('0xc7'):_0x1bafab['attributes'][_0x78d7('0x5e')](_0x78d7('0xf2'),_0x78d7('0xf3'));break;case _0x78d7('0xf4'):_0x1bafab['attributes']['push'](_0x78d7('0xf5'),_0x78d7('0xf6'));break;}return db[_[_0x78d7('0xe5')](_0x43234d)+'Interaction']['findAndCountAll'](_0x1bafab)[_0x78d7('0x17')](function(_0x2d3ba1){_0x2e029e[_0x78d7('0x13')]+=_0x2d3ba1[_0x78d7('0x13')];return _[_0x78d7('0x71')](_0x2d3ba1[_0x78d7('0x9f')],function(_0x3e05e2){var _0x1c53cd=_0x3e05e2['get']({'plain':!![]});_0x1c53cd[_0x78d7('0xcf')]=_0x43234d;if(_0x1c53cd[_0x78d7('0xeb')]){_0x1c53cd[_0x78d7('0xeb')]={'id':_0x1c53cd['Owner']['id'],'name':_0x1c53cd['Owner']['name'],'fullname':_0x1c53cd[_0x78d7('0xeb')][_0x78d7('0xe2')]};}return _0x1c53cd;});});}});return Promise[_0x78d7('0x87')](_0x33f4d2);})['then'](function(_0xb51eda){return _(_0xb51eda)[_0x78d7('0xf7')]()['sortBy'](_0x78d7('0xde'))[_0x78d7('0xf8')]()[_0x78d7('0xf9')]();})['then'](function(_0x455073){_0x2e029e[_0x78d7('0x9f')]=_0x3a7614[_0x78d7('0x12')]?_0x455073[_0x78d7('0xfa')](_0x3a7614[_0x78d7('0x14')],_0x3a7614[_0x78d7('0x14')]+_0x3a7614[_0x78d7('0x12')]):_0x455073;return _0x2e029e;})[_0x78d7('0x17')](respondWithFilteredResult(_0x317d3d,_0x3a7614))[_0x78d7('0x22')](handleError(_0x317d3d,null));}; \ No newline at end of file +var _0x20bb=['merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','ChatInteraction','update','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','create','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','push','where','ListId','findOrCreate','all','show','find','Tag','Tags','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','dialTimezone','CmCustomField','pickBy','cf_%d','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','PHONE','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','getHopperHistories','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','file','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','No\x20ListId\x20specified','error\x20child\x20process','getJourney','chat','sms','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','type','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','disposition','secondDisposition','key','color','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','openchannel','externalUrl','threadId','Interaction','Owner','flatten','reverse','slice','moment','bluebird','path','papaparse','../../components/contacts','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','sendStatus','error','stack','name','send','describe','getOptions','findAll','query','user','CmContact','params','tags','length','startsWith','cf_','displayName','values','info','keys','forEach','hasOwnProperty','columnName','catch'];(function(_0x4c975c,_0x3f71b6){var _0xf90e1f=function(_0xf7ee81){while(--_0xf7ee81){_0x4c975c['push'](_0x4c975c['shift']());}};_0xf90e1f(++_0x3f71b6);}(_0x20bb,0x1ba));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb20b('0x0'));var BPromise=require(_0xb20b('0x1'));var util=require('util');var path=require(_0xb20b('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xb20b('0x3'));var Redis=require('ioredis');var contacts=require(_0xb20b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xb20b('0x5'))(_0xb20b('0x6'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0xb20b('0x7'))['db'];config[_0xb20b('0x8')]=_['defaults'](config['redis'],{'host':_0xb20b('0x9'),'port':0x18eb});var socket=require(_0xb20b('0xa'))(new Redis(config[_0xb20b('0x8')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x476bf6,_0x160886){_0x160886=_0x160886||0xc8;return function(_0x2749b6){if(_0x2749b6){return _0x476bf6[_0xb20b('0xb')](_0x160886)[_0xb20b('0xc')](_0x2749b6);}};}function respondWithFilteredResult(_0x2aaa2f,_0x288151){return function(_0x165d09){if(_0x165d09){var _0x4057db=typeof _0x288151[_0xb20b('0xd')]===_0xb20b('0xe')&&typeof _0x288151[_0xb20b('0xf')]===_0xb20b('0xe');var _0x47ee21=_0x165d09[_0xb20b('0x10')];var _0xd89cfc=_0x4057db?0x0:_0x288151[_0xb20b('0xd')];var _0x1d3422=_0x4057db?_0x165d09[_0xb20b('0x10')]:_0x288151[_0xb20b('0xd')]+_0x288151[_0xb20b('0xf')];var _0x48c0d6;if(_0x1d3422>=_0x47ee21){_0x1d3422=_0x47ee21;_0x48c0d6=0xc8;}else{_0x48c0d6=0xce;}_0x2aaa2f[_0xb20b('0xb')](_0x48c0d6);return _0x2aaa2f[_0xb20b('0x11')](_0xb20b('0x12'),_0xd89cfc+'-'+_0x1d3422+'/'+_0x47ee21)['json'](_0x165d09);}return null;};}function saveUpdates(_0x37b959){return function(_0x868534){if(_0x868534){return _0x868534['update'](_0x37b959)['then'](function(_0x2cb12e){return _0x2cb12e;});}return null;};}function removeEntity(_0x2bbc36){return function(_0x42d07b){if(_0x42d07b){return _0x42d07b[_0xb20b('0x13')]()[_0xb20b('0x14')](function(){_0x2bbc36[_0xb20b('0xb')](0xcc)[_0xb20b('0x15')]();});}};}function handleEntityNotFound(_0x7ab4c3){return function(_0x5a84d0){if(!_0x5a84d0){_0x7ab4c3[_0xb20b('0x16')](0x194);}return _0x5a84d0;};}function handleError(_0x1e886c,_0x417eca){_0x417eca=_0x417eca||0x1f4;return function(_0x4f0931){logger[_0xb20b('0x17')](_0x4f0931[_0xb20b('0x18')]);if(_0x4f0931[_0xb20b('0x19')]){delete _0x4f0931[_0xb20b('0x19')];}_0x1e886c[_0xb20b('0xb')](_0x417eca)[_0xb20b('0x1a')](_0x4f0931);};}exports['index']=function(_0x439890,_0xed1148){var _0x397b33={};return contacts[_0xb20b('0x1b')]()[_0xb20b('0x14')](function(_0x43a300){_0x397b33=qs[_0xb20b('0x1c')](_0x43a300,_0x439890);return contacts[_0xb20b('0x1d')](_0x439890[_0xb20b('0x1e')],_0x439890[_0xb20b('0x1f')],_0x397b33,_0x43a300);})[_0xb20b('0x14')](respondWithFilteredResult(_0xed1148,_0x397b33))['catch'](handleError(_0xed1148,null));};exports[_0xb20b('0x13')]=function(_0xcf1d77,_0x26c73b){return db[_0xb20b('0x20')]['find']({'where':{'id':_0xcf1d77[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x26c73b,null))[_0xb20b('0x14')](removeEntity(_0x26c73b,null))['catch'](handleError(_0x26c73b,null));};exports[_0xb20b('0x1b')]=function(_0x3e9c75,_0x59a3ac){return db[_0xb20b('0x20')][_0xb20b('0x1b')]()[_0xb20b('0x14')](function(_0x516cc8){delete _0x516cc8[_0xb20b('0x22')];for(var _0x2867aa=0x0;_0x2867aa0x0){return new Promise(function(_0x59a814){var _0x1cc42f=[];for(var _0x38f352=0x0;_0x38f352<_0x36012a[_0xb20b('0x23')];_0x38f352++){_0x1cc42f[_0xb20b('0x54')](insertAdditionalPhones(_0x36012a[_0x38f352]['contact'],_0x36012a[_0x38f352][_0xb20b('0x50')]));}Promise[_0xb20b('0x58')](_0x1cc42f)[_0xb20b('0x14')](function(){_0x59a814(0x1);});})['then'](function(){return{'success':_0x5d7a81,'failure':_0x555544,'duplicates':_0x453d29};});}else{return{'success':_0x5d7a81,'failure':_0x555544,'duplicates':_0x453d29};}}})[_0xb20b('0x14')](respondWithResult(_0x15752d,0xc9))[_0xb20b('0x2d')](handleError(_0x15752d,null));};exports[_0xb20b('0x59')]=function(_0x4b9a06,_0x136858){var _0x3db918;return db[_0xb20b('0x20')]['describe']()[_0xb20b('0x14')](function(_0x47ba8b){return db[_0xb20b('0x20')][_0xb20b('0x5a')]({'where':{'id':_0x4b9a06['params']['id']},'include':[{'model':db[_0xb20b('0x5b')],'as':_0xb20b('0x5c'),'attributes':['id',_0xb20b('0x19'),'color'],'required':_0x4b9a06[_0xb20b('0x1e')][_0xb20b('0x5d')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xb20b('0x5e'),'where':{'CmContactId':_0x4b9a06[_0xb20b('0x21')]['id']},'required':![],'include':[{'model':db[_0xb20b('0x5f')],'as':_0xb20b('0x60')}]}],'order':[db[_0xb20b('0x61')][_0xb20b('0x62')](_0xb20b('0x63'))],'attributes':_[_0xb20b('0x29')](_0x47ba8b)});})[_0xb20b('0x14')](function(_0x1ae4a6){if(!_['isNil'](_0x1ae4a6)){_0x3db918=_0x1ae4a6[_0xb20b('0x31')]({'plain':!![]});var _0x482979={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ae4a6&&_0x1ae4a6[_0xb20b('0x56')]){if(_0x1ae4a6['ListId']){_0x482979[_0xb20b('0x55')][_0xb20b('0x64')]['push']({'ListId':{'$ne':_0x1ae4a6[_0xb20b('0x56')]}});}}return db['CmCustomField'][_0xb20b('0x1d')](_0x482979);}})[_0xb20b('0x14')](function(_0x402aa7){if(!_['isNil'](_0x402aa7)){return _[_0xb20b('0x65')](_0x3db918,_[_0xb20b('0x66')](_0x402aa7,function(_0x3535d8){return util[_0xb20b('0x67')]('cf_%d',_0x3535d8['id']);}));}})[_0xb20b('0x14')](handleEntityNotFound(_0x136858,null))[_0xb20b('0x14')](respondWithResult(_0x136858,null))[_0xb20b('0x2d')](handleError(_0x136858,null));};exports[_0xb20b('0x39')]=function(_0x38f995,_0x185280){var _0xa9f731;if(_0x38f995[_0xb20b('0x2f')]['id']){delete _0x38f995[_0xb20b('0x2f')]['id'];}if(!_[_0xb20b('0x4d')](_0x38f995[_0xb20b('0x2f')][_0xb20b('0x68')])){var _0x51f535=_0x38f995[_0xb20b('0x2f')]['dialTimezone'];if(!_[_0xb20b('0x4d')](shared[_0xb20b('0x4e')][_0x51f535]))_0x38f995[_0xb20b('0x2f')][_0xb20b('0x4f')]=shared[_0xb20b('0x4e')][_0x51f535][_0xb20b('0x4f')];}return db[_0xb20b('0x20')][_0xb20b('0x5a')]({'where':{'id':_0x38f995[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x185280,null))[_0xb20b('0x14')](saveUpdates(_0x38f995[_0xb20b('0x2f')],null))[_0xb20b('0x14')](function(_0x58f173){_0xa9f731=_0x58f173;var _0x227bdb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x58f173&&_0x58f173['ListId']){if(_0x58f173[_0xb20b('0x56')]){_0x227bdb[_0xb20b('0x55')]['$and'][_0xb20b('0x54')]({'ListId':{'$ne':_0x58f173['ListId']}});}}return db[_0xb20b('0x69')][_0xb20b('0x1d')](_0x227bdb);})['then'](function(_0x5f1e0e){if(_0x5f1e0e){return _[_0xb20b('0x65')](_[_0xb20b('0x6a')](_0x38f995[_0xb20b('0x2f')],function(_0x2befda,_0x27d5f7){return _[_0xb20b('0x24')](_0x27d5f7,_0xb20b('0x25'));}),_[_0xb20b('0x66')](_0x5f1e0e,function(_0x5f4c84){return util[_0xb20b('0x67')](_0xb20b('0x6b'),_0x5f4c84['id']);}));}})['then'](function(_0xadea89){if(_0xadea89&&!_[_0xb20b('0x6c')](_0xadea89)){var _0x35b637=squel[_0xb20b('0x39')]()[_0xb20b('0x6d')](_0xb20b('0x6e'))[_0xb20b('0x6f')](_0xadea89)[_0xb20b('0x55')](_0xb20b('0x70'),_0x38f995[_0xb20b('0x21')]['id'])[_0xb20b('0x71')]();return db[_0xb20b('0x61')][_0xb20b('0x1e')](_0x35b637[_0xb20b('0x72')],{'replacements':_0x35b637[_0xb20b('0x27')]});}})['then'](function(){if(_0x38f995[_0xb20b('0x2f')][_0xb20b('0x73')]&&_0xa9f731){return db[_0xb20b('0x36')][_0xb20b('0x39')]({'phone':_0x38f995['body'][_0xb20b('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0xa9f731['id']}});}})[_0xb20b('0x14')](function(){return _0xa9f731;})[_0xb20b('0x14')](respondWithResult(_0x185280,null))[_0xb20b('0x2d')](handleError(_0x185280,null));};exports[_0xb20b('0x74')]=function(_0x8409cb,_0x518ae3){var _0x747ddc={};var _0x3f2098={};var _0x21dd8d;var _0x238927;return db['CmContact'][_0xb20b('0x75')]({'where':{'id':_0x8409cb[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x518ae3,null))[_0xb20b('0x14')](function(_0x4895b4){if(_0x4895b4){_0x21dd8d=_0x4895b4;_0x3f2098[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x5b')][_0xb20b('0x77')]);_0x3f2098[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x8409cb[_0xb20b('0x1e')]);_0x3f2098[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x3f2098[_0xb20b('0x76')],_0x3f2098[_0xb20b('0x1e')]);_0x747ddc[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x3f2098['model'],qs[_0xb20b('0x7b')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x747ddc['attributes']=_0x747ddc[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x747ddc[_0xb20b('0x7a')]:_0x3f2098[_0xb20b('0x76')];_0x747ddc[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x8409cb['query'][_0xb20b('0x7d')]);_0x747ddc[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x8409cb['query'],_0x3f2098[_0xb20b('0x78')]));if(_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7f')]){_0x747ddc[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x747ddc['where'],{'$or':_[_0xb20b('0x66')](_0x747ddc[_0xb20b('0x7a')],function(_0x5485d3){var _0x295c5b={};_0x295c5b[_0x5485d3]={'$like':'%'+_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x295c5b;})});}_0x747ddc=_['merge']({},_0x747ddc,_0x8409cb[_0xb20b('0x80')]);return _0x21dd8d[_0xb20b('0x74')](_0x747ddc);}})[_0xb20b('0x14')](function(_0x46c3d8){if(_0x46c3d8){_0x238927=_0x46c3d8[_0xb20b('0x23')];if(!_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x747ddc['limit']=qs[_0xb20b('0xf')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x747ddc['offset']=qs[_0xb20b('0xd')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0xd')]);}return _0x21dd8d[_0xb20b('0x74')](_0x747ddc);}})['then'](function(_0x3e57f1){if(_0x3e57f1){return _0x3e57f1?{'count':_0x238927,'rows':_0x3e57f1}:null;}})[_0xb20b('0x14')](respondWithResult(_0x518ae3,null))[_0xb20b('0x2d')](handleError(_0x518ae3,null));};exports[_0xb20b('0x82')]=function(_0x4bbc7c,_0x4d4815){if(_0x4bbc7c['body']['id']){delete _0x4bbc7c[_0xb20b('0x2f')]['id'];}return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x4bbc7c['params']['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x4d4815,null))[_0xb20b('0x14')](function(_0x4c2cf3){if(_0x4c2cf3){return _0x4c2cf3[_0xb20b('0x82')](_0x4bbc7c[_0xb20b('0x2f')][_0xb20b('0x83')]||[]);}return null;})[_0xb20b('0x14')](respondWithResult(_0x4d4815,null))[_0xb20b('0x2d')](handleError(_0x4d4815,null));};exports[_0xb20b('0x84')]=function(_0x103821,_0x3cc315){var _0x14e763=[];_0x14e763[_0xb20b('0x54')](addAdditionalPhones(_0x103821[_0xb20b('0x2f')]));Promise[_0xb20b('0x58')](_0x14e763)[_0xb20b('0x14')](function(){_0x14e763=[];_0x14e763['push'](deleteCmHopperPhones(_0x103821[_0xb20b('0x2f')]['id']));_0x14e763[_0xb20b('0x54')](addCmHopperPhones(_0x103821[_0xb20b('0x2f')]['id']));Promise['all'](_0x14e763)[_0xb20b('0x14')](function(){return[0x1];})[_0xb20b('0x14')](respondWithResult(_0x3cc315,null));});};function addAdditionalPhones(_0x2ab2e0){var _0x46b079;return new Promise(function(_0x55f634){return db[_0xb20b('0x43')][_0xb20b('0x13')]({'where':{'CmContactId':_0x2ab2e0['id']}})[_0xb20b('0x14')](function(){db[_0xb20b('0x5f')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id',_0xb20b('0x85')]})[_0xb20b('0x14')](function(_0x578af1){var _0x4e379f=[];for(var _0x2a2ea2=0x0;_0x2a2ea2<_0x2ab2e0[_0xb20b('0x86')][_0xb20b('0x23')];_0x2a2ea2++){var _0x322576=_0x2ab2e0[_0xb20b('0x87')]?_[_0xb20b('0x4d')](_0x2ab2e0['item_types'][_0x2a2ea2])?'':_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2]:_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]?_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]:'';var _0xa72869=_[_0xb20b('0x4d')](_0x2ab2e0['items'][_0x2a2ea2][_0xb20b('0x89')])?'':_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x89')];var _0x8b50e6=_0x322576+':'+_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x73')]+'§'+_0xa72869;if(_['isNil'](_0x46b079))_0x46b079=_0x8b50e6;else _0x46b079+=';'+_0x8b50e6;var _0x4ff937=null;var _0x411bcd=null;if(_0x2ab2e0[_0xb20b('0x87')]){if(!_['isNil'](_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2])){_0x411bcd=_[_0xb20b('0x5a')](_0x578af1,function(_0x337fb6){return _0x337fb6['id']===_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2];});if(!_['isNil'](_0x411bcd)){_0x4ff937=_0x411bcd[_0xb20b('0x85')];}}}else{if(!_[_0xb20b('0x4d')](_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2])){_0x411bcd=_['find'](_0x578af1,function(_0x129ac1){return _0x129ac1['id']===_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')];});if(!_[_0xb20b('0x4d')](_0x411bcd)){_0x4ff937=_0x2a2ea2;}}}if(_['isNil'](_0x4ff937)){_0x4ff937=0x64;}_0x4e379f[_0xb20b('0x54')](addAdditionalPhone(_0x2ab2e0['id'],_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x73')],_0x2ab2e0[_0xb20b('0x87')]?_[_0xb20b('0x4d')](_0x2ab2e0['item_types'][_0x2a2ea2])?null:_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2]:_0x2ab2e0['items'][_0x2a2ea2]['ItemTypeId']?_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]:null,_0x4ff937,_0xa72869));}Promise[_0xb20b('0x58')](_0x4e379f)[_0xb20b('0x14')](function(){db[_0xb20b('0x20')][_0xb20b('0x39')]({'AdditionalPhones':_0x46b079},{'where':{'id':_0x2ab2e0['id']}})[_0xb20b('0x14')](function(){_0x55f634(0x1);});});});});});}function addAdditionalPhone(_0x5b3bbb,_0x498553,_0x9647d0,_0xabcb80,_0x38fa68){return db[_0xb20b('0x43')][_0xb20b('0x5a')]({'where':{'CmContactId':_0x5b3bbb,'item':_0x498553}})[_0xb20b('0x14')](function(_0x4f7c8b){if(_0x4f7c8b)logger['info'](_0xb20b('0x8a'),_0x4f7c8b);else{db['CmContactHasItem']['create']({'CmContactId':_0x5b3bbb,'item':_0x498553,'ItemTypeId':_0x9647d0,'OrderBy':_0xabcb80,'ItemClass':'PHONE','description':_0x38fa68});}});}function deleteCmHopperPhones(_0x3620de){return new Promise(function(_0x17a230){return db[_0xb20b('0x36')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3620de}})[_0xb20b('0x14')](function(_0x3c3066){db[_0xb20b('0x8b')]['destroy']({'where':{'CmHopperId':{'$in':_[_0xb20b('0x66')](_0x3c3066,'id')}}});})[_0xb20b('0x14')](function(){_0x17a230(0x1);});});}function addCmHopperPhones(_0x11063c){return new Promise(function(_0x35d661){return db['CmHopper'][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x11063c}})[_0xb20b('0x14')](function(_0x308658){var _0x3c982b=[];_[_0xb20b('0x66')](_0x308658,function(_0x4c691){_0x3c982b['push'](createCmHopperPhone(_0x11063c,_0x4c691['id']));});Promise[_0xb20b('0x58')](_0x3c982b)[_0xb20b('0x14')](function(){_0x35d661(0x1);});});});}function createCmHopperPhone(_0x5692d5,_0x459f8c){return new Promise(function(_0x440cdc){db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'attributes':[_0xb20b('0x8c'),_0xb20b('0x85')],'where':{'CmContactId':_0x5692d5,'ItemClass':'PHONE'},'include':[{'model':db[_0xb20b('0x5f')],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xb20b('0x85'),db[_0xb20b('0x61')][_0xb20b('0x62')](_0xb20b('0x8d'))]})[_0xb20b('0x14')](function(_0x7bf912){var _0xb5fe11=0x1;var _0x5710b5=_[_0xb20b('0x66')](_0x7bf912,function(_0x2abe61){_0x2abe61['CmHopperId']=_0x459f8c;_0x2abe61[_0xb20b('0x73')]=_0x2abe61[_0xb20b('0x8c')];_0x2abe61[_0xb20b('0x85')]=_0xb5fe11;delete _0x2abe61['ItemType.OrderBy'];_0xb5fe11=_0xb5fe11+0x1;return _0x2abe61;});return db[_0xb20b('0x8b')][_0xb20b('0x51')](_0x5710b5,{});})[_0xb20b('0x14')](function(){_0x440cdc(0x1);});});}function insertAdditionalPhones(_0x1b7731,_0x123e9e){return new Promise(function(_0x1c1182){var _0x5a690a=[];for(var _0xc15d=0x0;_0xc15d<_0x123e9e[_0xb20b('0x23')];_0xc15d++){var _0x59a13a=_0x123e9e[_0xc15d];_0x5a690a[_0xb20b('0x54')](parseContactItemType(_0x59a13a));}Promise[_0xb20b('0x58')](_0x5a690a)[_0xb20b('0x14')](function(){var _0x5208a8={'id':_0x1b7731['id'],'items':_0x123e9e};return addAdditionalPhones(_0x5208a8)[_0xb20b('0x14')](function(){return addCmHopperPhones(_0x1b7731['id']);});})['then'](function(){_0x1c1182(_0x1b7731);});});}function parseContactItemType(_0x2100fe){return new Promise(function(_0x14797a){if(_0x2100fe[_0xb20b('0x2b')](_0xb20b('0x88'))){_0x14797a(_0x2100fe);}else{return db[_0xb20b('0x5f')][_0xb20b('0x5a')]({'where':{'name':_0x2100fe[_0xb20b('0x60')]}})[_0xb20b('0x14')](function(_0x594a8f){if(_['isNil'](_0x594a8f))_0x2100fe[_0xb20b('0x88')]=null;else _0x2100fe[_0xb20b('0x88')]=_0x594a8f['id'];_0x14797a(_0x2100fe);});}});}exports['getAdditionalPhones']=function(_0xf4defc,_0x92e895){return db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'where':{'CmContactId':_0xf4defc[_0xb20b('0x21')]['id'],'ItemClass':_0xb20b('0x8e')},'include':[{'model':db[_0xb20b('0x5f')],'as':_0xb20b('0x60')}],'order':[[_0xb20b('0x85')],[db[_0xb20b('0x61')]['literal']('`ItemType`.OrderBy')]]})[_0xb20b('0x14')](function(_0x3a6f6f){return _0x3a6f6f;})[_0xb20b('0x14')](respondWithResult(_0x92e895,null))[_0xb20b('0x2d')](handleError(_0x92e895,null));};exports[_0xb20b('0x8f')]=function(_0x946e0d,_0x20a6cd){return db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'where':{'CmContactId':_0x946e0d[_0xb20b('0x2f')][_0xb20b('0x90')]}})['then'](function(_0x472eb2){var _0x1b5460=_[_0xb20b('0x66')](_0x472eb2,function(_0x463078){_0x463078['CmContactId']=_0x946e0d['body'][_0xb20b('0x91')];return _0x463078;});return db['CmContactHasItem'][_0xb20b('0x51')](_0x1b5460,{});})[_0xb20b('0x14')](function(){return addCmHopperPhones(_0x946e0d['body'][_0xb20b('0x91')]);})['then'](function(){return['ok'];})[_0xb20b('0x14')](respondWithResult(_0x20a6cd,null))[_0xb20b('0x2d')](handleError(_0x20a6cd,null));};exports[_0xb20b('0x92')]=function(_0x3d5f25,_0x5bb5a4){var _0x4f503e=[];_0x4f503e[_0xb20b('0x54')](createCmHopperPhone(_0x3d5f25[_0xb20b('0x2f')]['id'],_0x3d5f25[_0xb20b('0x2f')][_0xb20b('0x93')]));Promise[_0xb20b('0x58')](_0x4f503e)[_0xb20b('0x14')](function(){return[0x1];})[_0xb20b('0x14')](respondWithResult(_0x5bb5a4,null));};exports[_0xb20b('0x94')]=function(_0x4e3b14,_0x9e451d){var _0x37eb3f={'raw':![],'where':{}};var _0x5a64ca={};var _0x48b073={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x4e3b14['params']['id']}})['then'](handleEntityNotFound(_0x9e451d,null))[_0xb20b('0x14')](function(_0x1cb8aa){if(_0x1cb8aa){_0x5a64ca[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x36')][_0xb20b('0x77')]);_0x5a64ca['query']=_[_0xb20b('0x29')](_0x4e3b14['query']);_0x5a64ca[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x5a64ca[_0xb20b('0x76')],_0x5a64ca[_0xb20b('0x1e')]);_0x37eb3f[_0xb20b('0x7a')]=_['intersection'](_0x5a64ca[_0xb20b('0x76')],qs['fields'](_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x37eb3f[_0xb20b('0x7a')]=_0x37eb3f['attributes'][_0xb20b('0x23')]?_0x37eb3f['attributes']:_0x5a64ca['model'];if(!_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x37eb3f[_0xb20b('0xf')]=qs['limit'](_0x4e3b14[_0xb20b('0x1e')]['limit']);_0x37eb3f[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x4e3b14['query'][_0xb20b('0xd')]);}_0x37eb3f['order']=qs[_0xb20b('0x7d')](_0x4e3b14['query']['sort']);_0x37eb3f[_0xb20b('0x55')]=qs['filters'](_['pick'](_0x4e3b14['query'],_0x5a64ca[_0xb20b('0x78')]));_0x37eb3f['where'][_0xb20b('0x95')]=_0x1cb8aa['id'];if(_0x4e3b14[_0xb20b('0x1e')]['filter']){_0x37eb3f[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x37eb3f['where'],{'$or':_[_0xb20b('0x66')](_0x37eb3f['attributes'],function(_0x2d2578){var _0x2b3963={};_0x2b3963[_0x2d2578]={'$like':'%'+_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x2b3963;})});}_0x37eb3f=_[_0xb20b('0x2e')]({},_0x37eb3f,_0x4e3b14[_0xb20b('0x80')]);return db[_0xb20b('0x36')][_0xb20b('0x10')]({'where':_0x37eb3f[_0xb20b('0x55')]})[_0xb20b('0x14')](function(_0x207800){_0x48b073[_0xb20b('0x10')]=_0x207800;if(_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x96')]){_0x37eb3f['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x37eb3f);})['then'](function(_0x46f8fa){_0x48b073['rows']=_0x46f8fa;return _0x48b073;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x9e451d,_0x37eb3f))[_0xb20b('0x2d')](handleError(_0x9e451d,null));};exports[_0xb20b('0x97')]=function(_0x126038,_0x2a6429){var _0x2e0938={'raw':!![],'where':{}};var _0x2d8b89={};var _0x1c7dda={'count':0x0,'rows':[]};return db[_0xb20b('0x20')]['findOne']({'where':{'id':_0x126038[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x2a6429,null))[_0xb20b('0x14')](function(_0x283bd1){if(_0x283bd1){_0x2d8b89[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x45')][_0xb20b('0x77')]);_0x2d8b89[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x126038['query']);_0x2d8b89[_0xb20b('0x78')]=_['intersection'](_0x2d8b89[_0xb20b('0x76')],_0x2d8b89[_0xb20b('0x1e')]);_0x2e0938[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x2d8b89[_0xb20b('0x76')],qs[_0xb20b('0x7b')](_0x126038[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x2e0938['attributes']=_0x2e0938[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x2e0938[_0xb20b('0x7a')]:_0x2d8b89[_0xb20b('0x76')];if(!_0x126038[_0xb20b('0x1e')][_0xb20b('0x2b')]('nolimit')){_0x2e0938[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x126038['query'][_0xb20b('0xf')]);_0x2e0938[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x126038['query'][_0xb20b('0xd')]);}_0x2e0938[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x126038[_0xb20b('0x1e')][_0xb20b('0x7d')]);_0x2e0938[_0xb20b('0x55')]=qs['filters'](_[_0xb20b('0x7e')](_0x126038[_0xb20b('0x1e')],_0x2d8b89[_0xb20b('0x78')]));_0x2e0938['where'][_0xb20b('0x95')]=_0x283bd1['id'];if(_0x126038[_0xb20b('0x1e')]['filter']){_0x2e0938[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x2e0938[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x2e0938[_0xb20b('0x7a')],function(_0x35426d){var _0x147cca={};_0x147cca[_0x35426d]={'$like':'%'+_0x126038[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x147cca;})});}_0x2e0938=_['merge']({},_0x2e0938,_0x126038['options']);return db[_0xb20b('0x45')][_0xb20b('0x10')]({'where':_0x2e0938[_0xb20b('0x55')]})['then'](function(_0x35f6a9){_0x1c7dda[_0xb20b('0x10')]=_0x35f6a9;if(_0x126038[_0xb20b('0x1e')][_0xb20b('0x96')]){_0x2e0938[_0xb20b('0x98')]=[{'all':!![]}];}return db[_0xb20b('0x45')][_0xb20b('0x1d')](_0x2e0938);})[_0xb20b('0x14')](function(_0x3e559d){_0x1c7dda[_0xb20b('0x99')]=_0x3e559d;return _0x1c7dda;});}})['then'](respondWithFilteredResult(_0x2a6429,_0x2e0938))['catch'](handleError(_0x2a6429,null));};exports[_0xb20b('0x9a')]=function(_0x5adca3,_0x3d3da8){var _0x245c96={'raw':!![],'where':{}};var _0x2c6910={};var _0x224285={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x5adca3[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x3d3da8,null))[_0xb20b('0x14')](function(_0x37780a){if(_0x37780a){_0x2c6910[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x44')][_0xb20b('0x77')]);_0x2c6910['query']=_['keys'](_0x5adca3['query']);_0x2c6910[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x2c6910[_0xb20b('0x76')],_0x2c6910[_0xb20b('0x1e')]);_0x245c96[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x2c6910['model'],qs[_0xb20b('0x7b')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x245c96[_0xb20b('0x7a')]=_0x245c96[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x245c96[_0xb20b('0x7a')]:_0x2c6910['model'];if(!_0x5adca3[_0xb20b('0x1e')]['hasOwnProperty'](_0xb20b('0x81'))){_0x245c96['limit']=qs['limit'](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x245c96[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0xd')]);}_0x245c96[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7d')]);_0x245c96[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x5adca3[_0xb20b('0x1e')],_0x2c6910[_0xb20b('0x78')]));_0x245c96[_0xb20b('0x55')]['ContactId']=_0x37780a['id'];if(_0x5adca3['query']['filter']){_0x245c96[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x245c96[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x245c96[_0xb20b('0x7a')],function(_0x1a2c75){var _0x37ee89={};_0x37ee89[_0x1a2c75]={'$like':'%'+_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x37ee89;})});}_0x245c96=_['merge']({},_0x245c96,_0x5adca3[_0xb20b('0x80')]);return db['CmHopperFinal'][_0xb20b('0x10')]({'where':_0x245c96[_0xb20b('0x55')]})[_0xb20b('0x14')](function(_0x19ed8d){_0x224285[_0xb20b('0x10')]=_0x19ed8d;if(_0x5adca3['query'][_0xb20b('0x96')]){_0x245c96[_0xb20b('0x98')]=[{'all':!![]}];}return db[_0xb20b('0x44')][_0xb20b('0x1d')](_0x245c96);})[_0xb20b('0x14')](function(_0x3d0516){_0x224285['rows']=_0x3d0516;return _0x224285;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x3d3da8,_0x245c96))['catch'](handleError(_0x3d3da8,null));};exports[_0xb20b('0x9b')]=function(_0x5ed360,_0x57d88d){var _0x1483a4={'raw':!![],'where':{}};var _0x1897cc={};var _0x815fb8={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x5ed360['params']['id']}})['then'](handleEntityNotFound(_0x57d88d,null))[_0xb20b('0x14')](function(_0x3d290c){if(_0x3d290c){_0x1897cc[_0xb20b('0x76')]=_['keys'](db[_0xb20b('0x9c')]['rawAttributes']);_0x1897cc[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x5ed360[_0xb20b('0x1e')]);_0x1897cc[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x1897cc[_0xb20b('0x76')],_0x1897cc[_0xb20b('0x1e')]);_0x1483a4[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x1897cc[_0xb20b('0x76')],qs[_0xb20b('0x7b')](_0x5ed360['query'][_0xb20b('0x7b')]));_0x1483a4[_0xb20b('0x7a')]=_0x1483a4[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x1483a4[_0xb20b('0x7a')]:_0x1897cc[_0xb20b('0x76')];if(!_0x5ed360[_0xb20b('0x1e')]['hasOwnProperty'](_0xb20b('0x81'))){_0x1483a4[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x5ed360[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x1483a4[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x5ed360[_0xb20b('0x1e')]['offset']);}_0x1483a4[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x5ed360[_0xb20b('0x1e')]['sort']);_0x1483a4[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x5ed360[_0xb20b('0x1e')],_0x1897cc[_0xb20b('0x78')]));_0x1483a4[_0xb20b('0x55')][_0xb20b('0x95')]=_0x3d290c['id'];if(_0x5ed360['query'][_0xb20b('0x7f')]){_0x1483a4[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x1483a4[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x1483a4[_0xb20b('0x7a')],function(_0x1ed673){var _0x4c412c={};_0x4c412c[_0x1ed673]={'$like':'%'+_0x5ed360[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x4c412c;})});}_0x1483a4=_[_0xb20b('0x2e')]({},_0x1483a4,_0x5ed360[_0xb20b('0x80')]);return db[_0xb20b('0x9c')]['count']({'where':_0x1483a4[_0xb20b('0x55')]})['then'](function(_0x361aa5){_0x815fb8[_0xb20b('0x10')]=_0x361aa5;if(_0x5ed360['query']['includeAll']){_0x1483a4[_0xb20b('0x98')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1483a4);})[_0xb20b('0x14')](function(_0x25b1e2){_0x815fb8['rows']=_0x25b1e2;return _0x815fb8;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x57d88d,_0x1483a4))['catch'](handleError(_0x57d88d,null));};exports[_0xb20b('0x9d')]=function(_0x4e5f58,_0x22f7ca){try{if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x9e')]){throw new Error(_0xb20b('0x9f'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')]){throw new Error(_0xb20b('0xa1'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x2a0222=_0x4e5f58['body'][_0xb20b('0x9e')][_0xb20b('0xa4')](',');var _0x5d8998=_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')][_0xb20b('0xa4')](',');if(!_0x2a0222[_0xb20b('0x23')]||!_0x5d8998['length']||_0x2a0222['length']!==_0x5d8998[_0xb20b('0x23')]){throw new Error(_0xb20b('0xa5'));}_0x4e5f58['body'][_0xb20b('0x7b')]=_[_0xb20b('0xa6')](_0x2a0222,_0x5d8998);if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x7b')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x7b')][_0xb20b('0xa8')]){throw new Error(_0xb20b('0xa9'));}var _0xebc346=path[_0xb20b('0x34')](config['root'],_0xb20b('0xaa'),_0x4e5f58['file']['filename']);fs[_0xb20b('0xab')](_0xebc346,parseInt(_0xb20b('0xac'),0x8));var _0x12e4f4=require(_0xb20b('0xad'))[_0xb20b('0xae')](path[_0xb20b('0x34')](__dirname,'../../components/import/cm/csv'),[_0xebc346,_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x9e')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x56')],_0x4e5f58['body'][_0xb20b('0xaf')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x53')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa2')]]);return _0x22f7ca['status'](0xc8)[_0xb20b('0xc')]({'message':_0xb20b('0xb0'),'pid':_0x12e4f4[_0xb20b('0xb1')]});}catch(_0x1cde74){return _0x22f7ca['status'](0x1f4)[_0xb20b('0x1a')](_0x1cde74);}};exports['upload']=function(_0x18cfba,_0x5b6d4c){var _0x2d4790=fs['createReadStream'](_0x18cfba[_0xb20b('0xb2')]['path']);Papa[_0xb20b('0xb3')](_0x2d4790,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1f80d5){return _0x5b6d4c[_0xb20b('0xb')](0xc8)[_0xb20b('0xc')]({'file':_0x18cfba[_0xb20b('0xb2')],'fields':_0x1f80d5[_0xb20b('0xb4')]['fields']});}});};exports[_0xb20b('0xb5')]=function(_0x3a38f5,_0x351462){return db[_0xb20b('0xb6')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xb20b('0xb7')}})['then'](function(_0x15bd1a){var _0x4e8816=![];if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0xb8')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0x3a38f5['body']['binding'][_0xb20b('0xa8')]){throw new Error(_0xb20b('0xa9'));}if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x103a56=require(_0xb20b('0xad'))[_0xb20b('0xae')](path[_0xb20b('0x34')](__dirname,_0xb20b('0xb9')),[_0x3a38f5[_0xb20b('0x21')]['id'],JSON[_0xb20b('0xba')](_0x3a38f5[_0xb20b('0x2f')]),JSON[_0xb20b('0xba')](_0x15bd1a)]);_0x103a56['on'](_0xb20b('0xbb'),function(){_0x4e8816=!![];return _0x351462[_0xb20b('0xb')](0xc8)['json']({'message':_0xb20b('0xbc'),'pid':_0x103a56[_0xb20b('0xb1')]});});_0x103a56['on'](_0xb20b('0xbd'),function(_0x4a9202){if(_0x4a9202&&!_0x4e8816){return _0x351462[_0xb20b('0xb')](0x1f4)[_0xb20b('0xc')]({'message':'error\x20child\x20process','pid':_0x103a56['pid']});}});})['catch'](handleError(_0x351462,null));};exports[_0xb20b('0xbe')]=function(_0xc4c050,_0x87a948){return db[_0xb20b('0xb6')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb20b('0xb7')}})[_0xb20b('0x14')](function(_0x541d14){var _0x15edff=![];if(!_0xc4c050['body'][_0xb20b('0x56')]){throw new Error(_0xb20b('0xbf'));}if(!_0xc4c050[_0xb20b('0x2f')][_0xb20b('0xb8')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0xc4c050[_0xb20b('0x2f')]['binding'][_0xb20b('0xa8')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xc4c050[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x4347d4=require('child_process')[_0xb20b('0xae')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0xc4c050['params']['id'],JSON['stringify'](_0xc4c050[_0xb20b('0x2f')]),JSON[_0xb20b('0xba')](_0x541d14)]);_0x4347d4['on']('message',function(){_0x15edff=!![];return _0x87a948[_0xb20b('0xb')](0xc8)[_0xb20b('0xc')]({'message':_0xb20b('0xbc'),'pid':_0x4347d4[_0xb20b('0xb1')]});});_0x4347d4['on'](_0xb20b('0xbd'),function(_0x388b11){if(_0x388b11&&!_0x15edff){return _0x87a948[_0xb20b('0xb')](0x1f4)[_0xb20b('0xc')]({'message':_0xb20b('0xc0'),'pid':_0x4347d4[_0xb20b('0xb1')]});}});})[_0xb20b('0x2d')](handleError(_0x87a948,null));};exports[_0xb20b('0xc1')]=function(_0x139db0,_0x5941b5){var _0x3fa93d=['mail',_0xb20b('0xc2'),_0xb20b('0xc3'),'openchannel','fax','whatsapp','voice'];var _0x564887={'offset':0x0,'order':qs[_0xb20b('0x7d')]('-createdAt')},_0x32cb34={'count':0x0,'rows':[]};Promise[_0xb20b('0xc4')]()[_0xb20b('0x14')](function(){if(_0x139db0[_0xb20b('0x1e')][_0xb20b('0xc5')]){if(!_['includes'](_0x3fa93d,_0x139db0[_0xb20b('0x1e')]['channel'][_0xb20b('0xc6')]())){throw new Error(_0xb20b('0xc7'));}_0x3fa93d=[_0x139db0[_0xb20b('0x1e')]['channel'][_0xb20b('0xc6')]()];}if(_0x139db0[_0xb20b('0x1e')]['range']){try{var _0x4eacb2=JSON[_0xb20b('0xb3')](_0x139db0[_0xb20b('0x1e')][_0xb20b('0xc8')]);if(!moment(_0x4eacb2[_0xb20b('0x30')])[_0xb20b('0xc9')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4eacb2['to'])[_0xb20b('0xc9')]()){throw new Error(_0xb20b('0xca'));}}catch(_0x4200c9){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x139db0[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x564887[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x139db0[_0xb20b('0x1e')]['limit']||0xa);_0x564887[_0xb20b('0xd')]=qs['offset'](_0x139db0[_0xb20b('0x1e')][_0xb20b('0xd')]);}var _0x426277=_0x3fa93d[_0xb20b('0x66')](function(_0xeab1e0){if(_0xeab1e0==='voice'){var _0x420f7b={'attributes':['id',_0xb20b('0xcb'),_0xb20b('0xcc'),_0xb20b('0xcd'),_0xb20b('0xce'),'callerid',_0xb20b('0xcf'),_0xb20b('0xd0'),_0xb20b('0xd1'),_0xb20b('0xd2'),_0xb20b('0xd3'),_0xb20b('0xd4'),_0xb20b('0xd5'),_0xb20b('0xd6'),_0xb20b('0xd7')],'where':{'ContactId':_0x139db0[_0xb20b('0x21')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xb20b('0x19'),_0xb20b('0xd8'),_0xb20b('0xd9')]}],'order':[[_0xb20b('0xd3'),_0xb20b('0xda')]]};if(_0x139db0['query'][_0xb20b('0xc8')]){_0x420f7b[_0xb20b('0x55')]['createdAt']={'$gte':_0x4eacb2[_0xb20b('0x30')],'$lte':_0x4eacb2['to']};}return db[_0xb20b('0xdb')][_0xb20b('0xdc')](_0x420f7b)[_0xb20b('0x14')](function(_0x999ad4){_0x32cb34['count']+=_0x999ad4['count'];return _['map'](_0x999ad4['rows'],function(_0x13b673){var _0x3dbea8=_0x13b673[_0xb20b('0x31')]({'plain':!![]});_0x3dbea8[_0xb20b('0xc5')]=_0xeab1e0;if(_0x3dbea8[_0xb20b('0xb6')]){_0x3dbea8['User']={'id':_0x3dbea8['User']['id'],'name':_0x3dbea8[_0xb20b('0xb6')]['name'],'fullname':_0x3dbea8[_0xb20b('0xb6')][_0xb20b('0xd8')],'alias':_0x3dbea8[_0xb20b('0xb6')][_0xb20b('0xd9')]};}return _0x3dbea8;});});}else{var _0x12e4aa=_[_0xb20b('0xdd')](_0xeab1e0)+(_0xeab1e0===_0xb20b('0xc2')?_0xb20b('0xde'):_0xb20b('0xdf'));var _0x2a4cce={'attributes':['id',_0xb20b('0xe0'),'closedAt',_0xb20b('0xd3'),_0xb20b('0xd2'),_0xb20b('0xe1'),_0xb20b('0xe2'),'thirdDisposition','UserId',_0x12e4aa+'Id'],'where':{'ContactId':_0x139db0['params']['id']},'include':[{'model':db[_0x12e4aa],'as':_0xb20b('0xdf'),'attributes':['id',_0xb20b('0x19'),_0xb20b('0xe3')]},{'model':db['User'],'as':'Owner','attributes':['id','name',_0xb20b('0xd8')]},{'model':db['Tag'],'as':_0xb20b('0x5c'),'attributes':['id','name',_0xb20b('0xe4')],'through':{'attributes':[]}}],'order':[[_0xb20b('0xd3'),_0xb20b('0xda')]]};if(_0x139db0[_0xb20b('0x1e')]['range']){_0x2a4cce[_0xb20b('0x55')][_0xb20b('0xd3')]={'$gte':_0x4eacb2[_0xb20b('0x30')],'$lte':_0x4eacb2['to']};}switch(_0xeab1e0){case _0xb20b('0xc2'):_0x2a4cce[_0xb20b('0x7a')]['push']('browserName','customerIp',_0xb20b('0xe5'),_0xb20b('0xe6'),_0xb20b('0xe7'),_0xb20b('0xe8'),'ratingType',_0xb20b('0xe9'),_0xb20b('0xea'));break;case _0xb20b('0xeb'):_0x2a4cce['attributes'][_0xb20b('0x54')]('subject','substatus');break;case _0xb20b('0xec'):_0x2a4cce[_0xb20b('0x7a')]['push'](_0xb20b('0xed'),_0xb20b('0xee'));break;}return db[_['startCase'](_0xeab1e0)+_0xb20b('0xef')]['findAndCountAll'](_0x2a4cce)[_0xb20b('0x14')](function(_0x5252bf){_0x32cb34[_0xb20b('0x10')]+=_0x5252bf[_0xb20b('0x10')];return _['map'](_0x5252bf[_0xb20b('0x99')],function(_0x12ff17){var _0x3cb4d7=_0x12ff17[_0xb20b('0x31')]({'plain':!![]});_0x3cb4d7[_0xb20b('0xc5')]=_0xeab1e0;if(_0x3cb4d7[_0xb20b('0xf0')]){_0x3cb4d7[_0xb20b('0xf0')]={'id':_0x3cb4d7[_0xb20b('0xf0')]['id'],'name':_0x3cb4d7[_0xb20b('0xf0')]['name'],'fullname':_0x3cb4d7[_0xb20b('0xf0')][_0xb20b('0xd8')]};}return _0x3cb4d7;});});}});return Promise['all'](_0x426277);})[_0xb20b('0x14')](function(_0x4c84cd){return _(_0x4c84cd)[_0xb20b('0xf1')]()['sortBy'](_0xb20b('0xd3'))[_0xb20b('0xf2')]()['value']();})[_0xb20b('0x14')](function(_0x17e3f3){_0x32cb34['rows']=_0x564887['limit']?_0x17e3f3[_0xb20b('0xf3')](_0x564887[_0xb20b('0xd')],_0x564887[_0xb20b('0xd')]+_0x564887['limit']):_0x17e3f3;return _0x32cb34;})[_0xb20b('0x14')](respondWithFilteredResult(_0x5941b5,_0x564887))[_0xb20b('0x2d')](handleError(_0x5941b5,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 785eef1..147f783 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37aa=['update','remove','emit','hook','exports','events','../../mysqldb','CmContact','save'];(function(_0x234e1e,_0x531528){var _0x22a084=function(_0x5de93d){while(--_0x5de93d){_0x234e1e['push'](_0x234e1e['shift']());}};_0x22a084(++_0x531528);}(_0x37aa,0x11c));var _0xa37a=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x37aa[_0x1deb72];return _0x18bbdf;};'use strict';var EventEmitter=require(_0xa37a('0x0'));var CmContact=require(_0xa37a('0x1'))['db'][_0xa37a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa37a('0x3'),'afterUpdate':_0xa37a('0x4'),'afterDestroy':_0xa37a('0x5')};function emitEvent(_0x2b5dc7){return function(_0x379600,_0x476123,_0x33aacb){CmContactEvents[_0xa37a('0x6')](_0x2b5dc7+':'+_0x379600['id'],_0x379600);CmContactEvents[_0xa37a('0x6')](_0x2b5dc7,_0x379600);_0x33aacb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xa37a('0x7')](e,emitEvent(event));}}module[_0xa37a('0x8')]=CmContactEvents; \ No newline at end of file +var _0x2042=['remove','emit','hasOwnProperty','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x12953a,_0x5b758c){var _0x1badf3=function(_0x5bbe2f){while(--_0x5bbe2f){_0x12953a['push'](_0x12953a['shift']());}};_0x1badf3(++_0x5b758c);}(_0x2042,0x8a));var _0x2204=function(_0x1be23a,_0x3d7311){_0x1be23a=_0x1be23a-0x0;var _0x106912=_0x2042[_0x1be23a];return _0x106912;};'use strict';var EventEmitter=require(_0x2204('0x0'));var CmContact=require(_0x2204('0x1'))['db'][_0x2204('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2204('0x3')](0x0);var events={'afterCreate':_0x2204('0x4'),'afterUpdate':_0x2204('0x5'),'afterDestroy':_0x2204('0x6')};function emitEvent(_0x54d9bd){return function(_0x803075,_0x32709b,_0x30aa47){CmContactEvents[_0x2204('0x7')](_0x54d9bd+':'+_0x803075['id'],_0x803075);CmContactEvents[_0x2204('0x7')](_0x54d9bd,_0x803075);_0x30aa47(null);};}for(var e in events){if(events[_0x2204('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 9d403d9..f59ba9a 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x157e=['utf8mb4','utf8mb4_unicode_ci','models','get','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','../../config/logger','moment','./cmContact.attributes','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','resolve','timezones','utcOffset','add','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','ListId','all','Campaign','map','VoiceQueue','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT'];(function(_0x2ef9a9,_0x1f4fff){var _0x475eb1=function(_0x306893){while(--_0x306893){_0x2ef9a9['push'](_0x2ef9a9['shift']());}};_0x475eb1(++_0x1f4fff);}(_0x157e,0x94));var _0xe157=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0x157e[_0x673ea4];return _0x3e5938;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe157('0x0'))('api');var moment=require(_0xe157('0x1'));var shared=require('../../config/environment/shared');var attributes=require(_0xe157('0x2'));function getTimezoneCallbackAt(_0xd7d882,_0x43c1ec,_0x56aa6c,_0x5b588a){var _0x2af660=_0x5b588a?'Campaign':'VoiceQueue';var _0x2d0329=_0x56aa6c[_0xe157('0x3')]?_0x56aa6c['scheduledat']:moment()['format'](_0xe157('0x4'));if(_['isNil'](_0x56aa6c[_0xe157('0x5')])){return Promise['resolve'](_0x2d0329);}return _0xd7d882[_0x2af660][_0xe157('0x6')]({'where':{'id':_0x43c1ec}})[_0xe157('0x7')](function(_0x23169c){if(_[_0xe157('0x8')](_0x23169c)||_[_0xe157('0x8')](_0x23169c['dialTimezone'])){return Promise[_0xe157('0x9')](_0x2d0329);}var _0x54aa21=shared[_0xe157('0xa')];var _0x426188=_0x54aa21[_0x23169c[_0xe157('0x5')]];var _0x9b0c6e=_0x54aa21[_0x56aa6c[_0xe157('0x5')]];if(_[_0xe157('0x8')](_0x426188)&&_[_0xe157('0x8')](_0x9b0c6e)){return Promise[_0xe157('0x9')](_0x2d0329);}var _0x222fb8=_0x426188[_0xe157('0xb')]-_0x9b0c6e['utcOffset'];var _0x406f0f=_0x56aa6c[_0xe157('0x3')]?_0x56aa6c[_0xe157('0x3')]:moment();_0x2d0329=moment(_0x406f0f)[_0xe157('0xc')](_0x222fb8,_0xe157('0xd'))[_0xe157('0xe')](_0xe157('0x4'));return Promise['resolve'](_0x2d0329);});}function getNewHopperPayload(_0x4f96dc){return{'phone':_0x4f96dc[_0xe157('0xf')],'ContactId':_0x4f96dc['id'],'ListId':_0x4f96dc['ListId'],'scheduledat':_0x4f96dc[_0xe157('0x3')]?_0x4f96dc['scheduledat']:moment()[_0xe157('0xe')](_0xe157('0x4')),'priority':_0x4f96dc['priority']?_0x4f96dc[_0xe157('0x10')]:0x2,'callback':_0x4f96dc[_0xe157('0x11')]?!![]:![],'callbackuniqueid':_0x4f96dc[_0xe157('0x11')]?_0x4f96dc[_0xe157('0x11')]:undefined,'callbackat':_0x4f96dc['callbackUniqueid']?moment()[_0xe157('0xe')](_0xe157('0x4')):undefined};}function handleAlwaysCheckDuplicate(_0x33ad58,_0x5da87e,_0x4dc387,_0x59779a){var _0x5c89d4={'phone':_0x4dc387[_0xe157('0xf')]};var _0x4284ce={'calleridnum':_0x4dc387[_0xe157('0xf')]};if(_0x59779a){Object[_0xe157('0x12')](_0x5c89d4,{'CampaignId':_0x5da87e['id']});Object[_0xe157('0x12')](_0x4284ce,{'CampaignId':_0x5da87e['id']});}else{Object[_0xe157('0x12')](_0x5c89d4,{'VoiceQueueId':_0x5da87e['id']});Object[_0xe157('0x12')](_0x4284ce,{'VoiceQueueId':_0x5da87e['id']});}return _0x33ad58[_0xe157('0x13')][_0xe157('0x6')]({'where':_0x5c89d4})[_0xe157('0x7')](function(_0x524084){if(_0x524084){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x4dc387[_0xe157('0xf')]+_0xe157('0x14')+_0x5da87e['id']);}return _0x33ad58[_0xe157('0x15')][_0xe157('0x6')]({'where':_0x4284ce});})[_0xe157('0x7')](function(_0x924118){if(_0x924118){throw new Error(_0xe157('0x16')+_0x4dc387[_0xe157('0xf')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5da87e['id']);}var _0x659ae0=getNewHopperPayload(_0x4dc387);if(_0x59779a){_0x659ae0[_0xe157('0x17')]=_0x5da87e['id'];}else{_0x659ae0[_0xe157('0x18')]=_0x5da87e['id'];}return _0x33ad58[_0xe157('0x13')]['create'](_0x659ae0);});}function handleOnlyIfOpenCheckDuplicate(_0x30fca0,_0x315115,_0x2bd5fd,_0x1588eb){var _0x16eb86={'phone':_0x2bd5fd[_0xe157('0xf')]};if(_0x1588eb){Object[_0xe157('0x12')](_0x16eb86,{'CampaignId':_0x315115['id']});}else{Object[_0xe157('0x12')](_0x16eb86,{'VoiceQueueId':_0x315115['id']});}return _0x30fca0['CmHopper']['findOne']({'where':_0x16eb86})['then'](function(_0x13d92d){if(_0x13d92d){throw new Error(_0xe157('0x19')+_0x2bd5fd[_0xe157('0xf')]+_0xe157('0x14')+_0x315115['id']);}var _0x1ea01f=getNewHopperPayload(_0x2bd5fd);if(_0x1588eb){_0x1ea01f['CampaignId']=_0x315115['id'];}else{_0x1ea01f[_0xe157('0x18')]=_0x315115['id'];}return _0x30fca0['CmHopper'][_0xe157('0x1a')](_0x1ea01f);});}function handleNeverCheckDuplicate(_0x39425a,_0x465b0b,_0x1960c7){var _0x1af537=getNewHopperPayload(_0x1960c7);_0x1af537[_0xe157('0x18')]=_0x465b0b['id'];return _0x39425a[_0xe157('0x13')]['create'](_0x1af537);}function handleCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48){return getTimezoneCallbackAt(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48)[_0xe157('0x7')](function(_0x308691){_0xa65a73['scheduledat']=_0x308691;switch(_0x1128ae['dialCheckDuplicateType']){case _0xe157('0x1b'):return handleAlwaysCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48);case _0xe157('0x1c'):return handleOnlyIfOpenCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48);default:return handleNeverCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73);}});}function createHopperForVoiceQueues(_0xdb20ac,_0x38384d){return _0xdb20ac['VoiceQueue'][_0xe157('0x1d')]({'where':{'type':'outbound'},'attributes':['id',_0xe157('0x1e'),_0xe157('0x5')],'include':[{'model':_0xdb20ac[_0xe157('0x1f')],'as':_0xe157('0x20'),'where':{'id':_0x38384d[_0xe157('0x21')]}}],'raw':!![]})[_0xe157('0x7')](function(_0x4e73a7){var _0x511e9e=_0x4e73a7['map'](function(_0x49e2b1){return handleCheckDuplicate(_0xdb20ac,_0x49e2b1,_0x38384d,![]);});return Promise[_0xe157('0x22')](_0x511e9e);});}function createHopperForCampaigns(_0x5d7e8a,_0x4806ae){return _0x5d7e8a[_0xe157('0x23')][_0xe157('0x1d')]({'attributes':['id',_0xe157('0x1e'),_0xe157('0x5')],'include':[{'model':_0x5d7e8a[_0xe157('0x1f')],'as':_0xe157('0x20'),'where':{'id':_0x4806ae[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x566e86){var _0x553a80=_0x566e86[_0xe157('0x24')](function(_0x1a5906){return handleCheckDuplicate(_0x5d7e8a,_0x1a5906,_0x4806ae,!![]);});return Promise['all'](_0x553a80);});}function createHopperBlackForVoiceQueues(_0x15d6e2,_0x1b5dc2){return _0x15d6e2[_0xe157('0x25')][_0xe157('0x1d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x15d6e2['CmList'],'as':_0xe157('0x26'),'where':{'id':_0x1b5dc2[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x107788){var _0x44a3fb=_0x107788['map'](function(_0x499d10){return _0x15d6e2['CmHopperBlack'][_0xe157('0x1a')]({'phone':_0x1b5dc2[_0xe157('0xf')],'ContactId':_0x1b5dc2['id'],'ListId':_0x1b5dc2['ListId'],'VoiceQueueId':_0x499d10['id']});});return Promise[_0xe157('0x22')](_0x44a3fb);});}function createHopperBlackForCampaigns(_0x40d2d6,_0x34552b){return _0x40d2d6[_0xe157('0x23')][_0xe157('0x1d')]({'attributes':['id'],'include':[{'model':_0x40d2d6[_0xe157('0x1f')],'as':_0xe157('0x26'),'where':{'id':_0x34552b[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x23fb3f){var _0x5cd03d=_0x23fb3f[_0xe157('0x24')](function(_0x10b611){return _0x40d2d6[_0xe157('0x27')]['create']({'phone':_0x34552b[_0xe157('0xf')],'ContactId':_0x34552b['id'],'ListId':_0x34552b[_0xe157('0x21')],'CampaignId':_0x10b611['id']});});return Promise['all'](_0x5cd03d);});}module[_0xe157('0x28')]=function(_0x59a2d4){return _0x59a2d4[_0xe157('0x29')](_0xe157('0x2a'),attributes,{'tableName':_0xe157('0x2b'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xe157('0xf')]},{'name':_0xe157('0x2c'),'fields':[_0xe157('0x2d'),_0xe157('0x2e'),_0xe157('0xf'),_0xe157('0x2f'),'fax',_0xe157('0x30')],'type':_0xe157('0x31')}],'timestamps':!![],'charset':_0xe157('0x32'),'collate':_0xe157('0x33'),'hooks':{'afterCreate':function(_0x283bff,_0x4bb55d,_0x2e8f0d){var _0x3ccad4=_0x59a2d4[_0xe157('0x34')];var _0x1bcc18=_0x283bff[_0xe157('0x35')]({'plain':!![]});if(!_0x1bcc18[_0xe157('0x21')]){logger['error'](_0xe157('0x36')+_0x1bcc18['id']);return _0x2e8f0d();}if(!_0x1bcc18[_0xe157('0xf')]){return _0x2e8f0d();}return createHopperForVoiceQueues(_0x3ccad4,_0x1bcc18)[_0xe157('0x7')](function(){return createHopperBlackForVoiceQueues(_0x3ccad4,_0x1bcc18);})[_0xe157('0x7')](function(){return createHopperForCampaigns(_0x3ccad4,_0x1bcc18);})['then'](function(){return createHopperBlackForCampaigns(_0x3ccad4,_0x1bcc18);})[_0xe157('0x7')](function(){return _0x2e8f0d();})[_0xe157('0x37')](function(_0x10e853){logger['error']('[cmContact][afterCreate]',_0x10e853[_0xe157('0x38')]);_0x2e8f0d();});},'afterDestroy':function(_0x5aae19,_0x460313,_0x2dad82){var _0x10fde5=_0x59a2d4[_0xe157('0x34')];var _0x4cbdb3=_0x5aae19['get']({'plain':!![]});return _0x10fde5[_0xe157('0x13')][_0xe157('0x1d')]({'raw':!![],'where':{'ListId':_0x4cbdb3['ListId'],'ContactId':_0x4cbdb3['id']}})['then'](function(_0x539b53){if(!_[_0xe157('0x39')](_0x539b53)){var _0x25f4e6=[];for(var _0x11776f=0x0;_0x11776f<_0x539b53[_0xe157('0x3a')];_0x11776f+=0x1){var _0x232a6c=_0x10fde5[_0xe157('0x13')][_0xe157('0x3b')]({'where':{'ListId':_0x539b53[_0x11776f][_0xe157('0x21')],'ContactId':_0x539b53[_0x11776f][_0xe157('0x3c')],'VoiceQueueId':_0x539b53[_0x11776f][_0xe157('0x18')],'CampaignId':_0x539b53[_0x11776f][_0xe157('0x17')]}});_0x25f4e6[_0xe157('0x3d')](_0x232a6c);}return Promise[_0xe157('0x22')](_0x25f4e6);}})[_0xe157('0x7')](function(_0x41fc5d){logger[_0xe157('0x3e')](_0xe157('0x3f'),util['inspect'](_0x41fc5d,{'showHidden':![],'depth':null}));_0x2dad82();})[_0xe157('0x37')](function(_0x1800f5){logger['error'](_0xe157('0x40'),util[_0xe157('0x41')](_0x1800f5,{'showHidden':![],'depth':null}));_0x2dad82(_0x1800f5);});}}});}; \ No newline at end of file +var _0xb840=['get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','isEmpty','length','destroy','push','info','catch','[CmContact][afterDestroy][Error]','inspect','lodash','util','moment','../../config/environment/shared','./cmContact.attributes','Campaign','isNil','resolve','findOne','then','dialTimezone','timezones','utcOffset','scheduledat','add','minutes','format','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','always','onlyIfOpen','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','map','all','CmList','BlackLists','CmHopperBlack','define','CmContact','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models'];(function(_0x55d0fe,_0x13710a){var _0x33a650=function(_0x1c6a29){while(--_0x1c6a29){_0x55d0fe['push'](_0x55d0fe['shift']());}};_0x33a650(++_0x13710a);}(_0xb840,0xca));var _0x0b84=function(_0x97877,_0x422052){_0x97877=_0x97877-0x0;var _0x5d9569=_0xb840[_0x97877];return _0x5d9569;};'use strict';var _=require(_0x0b84('0x0'));var util=require(_0x0b84('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0b84('0x2'));var shared=require(_0x0b84('0x3'));var attributes=require(_0x0b84('0x4'));function getTimezoneCallbackAt(_0x23bb87,_0x21a210,_0x3ec277,_0x177837){var _0x7817cb=_0x177837?_0x0b84('0x5'):'VoiceQueue';var _0x33ffb6=_0x3ec277['scheduledat']?_0x3ec277['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x0b84('0x6')](_0x3ec277['dialTimezone'])){return Promise[_0x0b84('0x7')](_0x33ffb6);}return _0x23bb87[_0x7817cb][_0x0b84('0x8')]({'where':{'id':_0x21a210}})[_0x0b84('0x9')](function(_0x40e8cb){if(_[_0x0b84('0x6')](_0x40e8cb)||_[_0x0b84('0x6')](_0x40e8cb[_0x0b84('0xa')])){return Promise[_0x0b84('0x7')](_0x33ffb6);}var _0x2bdd5c=shared[_0x0b84('0xb')];var _0x32d703=_0x2bdd5c[_0x40e8cb[_0x0b84('0xa')]];var _0x219cf2=_0x2bdd5c[_0x3ec277[_0x0b84('0xa')]];if(_['isNil'](_0x32d703)&&_[_0x0b84('0x6')](_0x219cf2)){return Promise['resolve'](_0x33ffb6);}var _0x4a1d3b=_0x32d703[_0x0b84('0xc')]-_0x219cf2[_0x0b84('0xc')];var _0x342c9c=_0x3ec277[_0x0b84('0xd')]?_0x3ec277[_0x0b84('0xd')]:moment();_0x33ffb6=moment(_0x342c9c)[_0x0b84('0xe')](_0x4a1d3b,_0x0b84('0xf'))[_0x0b84('0x10')](_0x0b84('0x11'));return Promise[_0x0b84('0x7')](_0x33ffb6);});}function getNewHopperPayload(_0x52fdb2){return{'phone':_0x52fdb2[_0x0b84('0x12')],'ContactId':_0x52fdb2['id'],'ListId':_0x52fdb2[_0x0b84('0x13')],'scheduledat':_0x52fdb2[_0x0b84('0xd')]?_0x52fdb2[_0x0b84('0xd')]:moment()[_0x0b84('0x10')](_0x0b84('0x11')),'priority':_0x52fdb2[_0x0b84('0x14')]?_0x52fdb2[_0x0b84('0x14')]:0x2,'callback':_0x52fdb2[_0x0b84('0x15')]?!![]:![],'callbackuniqueid':_0x52fdb2[_0x0b84('0x15')]?_0x52fdb2[_0x0b84('0x15')]:undefined,'callbackat':_0x52fdb2[_0x0b84('0x15')]?moment()[_0x0b84('0x10')](_0x0b84('0x11')):undefined};}function handleAlwaysCheckDuplicate(_0x4a5b03,_0xf9d7ad,_0x285ad5,_0x247dde){var _0x5273ba={'phone':_0x285ad5['phone']};var _0x4edbcb={'calleridnum':_0x285ad5[_0x0b84('0x12')]};if(_0x247dde){Object['assign'](_0x5273ba,{'CampaignId':_0xf9d7ad['id']});Object[_0x0b84('0x16')](_0x4edbcb,{'CampaignId':_0xf9d7ad['id']});}else{Object['assign'](_0x5273ba,{'VoiceQueueId':_0xf9d7ad['id']});Object[_0x0b84('0x16')](_0x4edbcb,{'VoiceQueueId':_0xf9d7ad['id']});}return _0x4a5b03[_0x0b84('0x17')][_0x0b84('0x8')]({'where':_0x5273ba})[_0x0b84('0x9')](function(_0x55f294){if(_0x55f294){throw new Error(_0x0b84('0x18')+_0x285ad5['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0xf9d7ad['id']);}return _0x4a5b03['CmHopperFinal'][_0x0b84('0x8')]({'where':_0x4edbcb});})['then'](function(_0x560629){if(_0x560629){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x285ad5[_0x0b84('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0xf9d7ad['id']);}var _0x524a5f=getNewHopperPayload(_0x285ad5);if(_0x247dde){_0x524a5f[_0x0b84('0x19')]=_0xf9d7ad['id'];}else{_0x524a5f[_0x0b84('0x1a')]=_0xf9d7ad['id'];}return _0x4a5b03[_0x0b84('0x17')][_0x0b84('0x1b')](_0x524a5f);});}function handleOnlyIfOpenCheckDuplicate(_0x4c2d15,_0x4874f0,_0x1b9f62,_0x2f9560){var _0x2bee72={'phone':_0x1b9f62[_0x0b84('0x12')]};if(_0x2f9560){Object[_0x0b84('0x16')](_0x2bee72,{'CampaignId':_0x4874f0['id']});}else{Object[_0x0b84('0x16')](_0x2bee72,{'VoiceQueueId':_0x4874f0['id']});}return _0x4c2d15[_0x0b84('0x17')][_0x0b84('0x8')]({'where':_0x2bee72})[_0x0b84('0x9')](function(_0x2a4b49){if(_0x2a4b49){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1b9f62[_0x0b84('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x4874f0['id']);}var _0x447a62=getNewHopperPayload(_0x1b9f62);if(_0x2f9560){_0x447a62[_0x0b84('0x19')]=_0x4874f0['id'];}else{_0x447a62[_0x0b84('0x1a')]=_0x4874f0['id'];}return _0x4c2d15[_0x0b84('0x17')]['create'](_0x447a62);});}function handleNeverCheckDuplicate(_0x1de573,_0x350316,_0x29bbc6){var _0x5ad49c=getNewHopperPayload(_0x29bbc6);_0x5ad49c['VoiceQueueId']=_0x350316['id'];return _0x1de573[_0x0b84('0x17')][_0x0b84('0x1b')](_0x5ad49c);}function handleCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5){return getTimezoneCallbackAt(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5)[_0x0b84('0x9')](function(_0xe6df9e){_0x415f5a[_0x0b84('0xd')]=_0xe6df9e;switch(_0x1a0c9e['dialCheckDuplicateType']){case _0x0b84('0x1c'):return handleAlwaysCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5);case _0x0b84('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5);default:return handleNeverCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a);}});}function createHopperForVoiceQueues(_0x3c2b8b,_0xe816f3){return _0x3c2b8b[_0x0b84('0x1e')][_0x0b84('0x1f')]({'where':{'type':_0x0b84('0x20')},'attributes':['id',_0x0b84('0x21'),_0x0b84('0xa')],'include':[{'model':_0x3c2b8b['CmList'],'as':_0x0b84('0x22'),'where':{'id':_0xe816f3['ListId']}}],'raw':!![]})[_0x0b84('0x9')](function(_0x2a8b6c){var _0x44c0ad=_0x2a8b6c[_0x0b84('0x23')](function(_0x2e9d52){return handleCheckDuplicate(_0x3c2b8b,_0x2e9d52,_0xe816f3,![]);});return Promise[_0x0b84('0x24')](_0x44c0ad);});}function createHopperForCampaigns(_0x58ad82,_0x5e9bc6){return _0x58ad82[_0x0b84('0x5')][_0x0b84('0x1f')]({'attributes':['id',_0x0b84('0x21'),_0x0b84('0xa')],'include':[{'model':_0x58ad82[_0x0b84('0x25')],'as':_0x0b84('0x22'),'where':{'id':_0x5e9bc6[_0x0b84('0x13')]}}],'raw':!![]})[_0x0b84('0x9')](function(_0x3d88be){var _0x27a337=_0x3d88be[_0x0b84('0x23')](function(_0x1e18ed){return handleCheckDuplicate(_0x58ad82,_0x1e18ed,_0x5e9bc6,!![]);});return Promise['all'](_0x27a337);});}function createHopperBlackForVoiceQueues(_0x112122,_0x3fd736){return _0x112122[_0x0b84('0x1e')][_0x0b84('0x1f')]({'where':{'type':_0x0b84('0x20')},'attributes':['id'],'include':[{'model':_0x112122['CmList'],'as':_0x0b84('0x26'),'where':{'id':_0x3fd736[_0x0b84('0x13')]}}],'raw':!![]})['then'](function(_0x13e263){var _0x4ed5ce=_0x13e263[_0x0b84('0x23')](function(_0x53a437){return _0x112122['CmHopperBlack'][_0x0b84('0x1b')]({'phone':_0x3fd736[_0x0b84('0x12')],'ContactId':_0x3fd736['id'],'ListId':_0x3fd736[_0x0b84('0x13')],'VoiceQueueId':_0x53a437['id']});});return Promise[_0x0b84('0x24')](_0x4ed5ce);});}function createHopperBlackForCampaigns(_0x36c2e7,_0x2a88d4){return _0x36c2e7[_0x0b84('0x5')][_0x0b84('0x1f')]({'attributes':['id'],'include':[{'model':_0x36c2e7[_0x0b84('0x25')],'as':_0x0b84('0x26'),'where':{'id':_0x2a88d4[_0x0b84('0x13')]}}],'raw':!![]})[_0x0b84('0x9')](function(_0x3214e6){var _0x428528=_0x3214e6['map'](function(_0x2ba240){return _0x36c2e7[_0x0b84('0x27')][_0x0b84('0x1b')]({'phone':_0x2a88d4[_0x0b84('0x12')],'ContactId':_0x2a88d4['id'],'ListId':_0x2a88d4[_0x0b84('0x13')],'CampaignId':_0x2ba240['id']});});return Promise['all'](_0x428528);});}module['exports']=function(_0x9363e1){return _0x9363e1[_0x0b84('0x28')](_0x0b84('0x29'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x0b84('0x12'),'fields':[_0x0b84('0x12')]},{'name':_0x0b84('0x2a'),'fields':[_0x0b84('0x2b'),'lastName',_0x0b84('0x12'),_0x0b84('0x2c'),'fax',_0x0b84('0x2d')],'type':_0x0b84('0x2e')}],'timestamps':!![],'charset':_0x0b84('0x2f'),'collate':_0x0b84('0x30'),'hooks':{'afterCreate':function(_0x78b52f,_0x38df5b,_0x3b099d){var _0x372f62=_0x9363e1[_0x0b84('0x31')];var _0x5eefa2=_0x78b52f[_0x0b84('0x32')]({'plain':!![]});if(!_0x5eefa2[_0x0b84('0x13')]){logger[_0x0b84('0x33')](_0x0b84('0x34')+_0x5eefa2['id']);return _0x3b099d();}if(!_0x5eefa2[_0x0b84('0x12')]){return _0x3b099d();}return createHopperForVoiceQueues(_0x372f62,_0x5eefa2)['then'](function(){return createHopperBlackForVoiceQueues(_0x372f62,_0x5eefa2);})[_0x0b84('0x9')](function(){return createHopperForCampaigns(_0x372f62,_0x5eefa2);})['then'](function(){return createHopperBlackForCampaigns(_0x372f62,_0x5eefa2);})[_0x0b84('0x9')](function(){return _0x3b099d();})['catch'](function(_0x1bb551){logger[_0x0b84('0x33')](_0x0b84('0x35'),_0x1bb551[_0x0b84('0x36')]);_0x3b099d();});},'afterDestroy':function(_0x2cd22f,_0xb1ab6b,_0x31ddd0){var _0x5621b5=_0x9363e1[_0x0b84('0x31')];var _0x56f333=_0x2cd22f['get']({'plain':!![]});return _0x5621b5['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x56f333[_0x0b84('0x13')],'ContactId':_0x56f333['id']}})['then'](function(_0x39986a){if(!_[_0x0b84('0x37')](_0x39986a)){var _0x1c069e=[];for(var _0x34d7b0=0x0;_0x34d7b0<_0x39986a[_0x0b84('0x38')];_0x34d7b0+=0x1){var _0x3d7f07=_0x5621b5[_0x0b84('0x17')][_0x0b84('0x39')]({'where':{'ListId':_0x39986a[_0x34d7b0][_0x0b84('0x13')],'ContactId':_0x39986a[_0x34d7b0]['ContactId'],'VoiceQueueId':_0x39986a[_0x34d7b0][_0x0b84('0x1a')],'CampaignId':_0x39986a[_0x34d7b0]['CampaignId']}});_0x1c069e[_0x0b84('0x3a')](_0x3d7f07);}return Promise['all'](_0x1c069e);}})[_0x0b84('0x9')](function(_0x232c3a){logger[_0x0b84('0x3b')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x232c3a,{'showHidden':![],'depth':null}));_0x31ddd0();})[_0x0b84('0x3c')](function(_0x2224d0){logger[_0x0b84('0x33')](_0x0b84('0x3d'),util[_0x0b84('0x3e')](_0x2224d0,{'showHidden':![],'depth':null}));_0x31ddd0(_0x2224d0);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b9f6430..3d7dd7d 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4f2d32,_0x47e0ad){var _0x1c26bb=function(_0x39643b){while(--_0x39643b){_0x4f2d32['push'](_0x4f2d32['shift']());}};_0x1c26bb(++_0x47e0ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 84e3bde..4033d9a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9b7=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x5ed652,_0x531731){_0x5ed652=_0x5ed652-0x0;var _0x3c0826=_0xc9b7[_0x5ed652];return _0x3c0826;};'use strict';var Sequelize=require(_0x7c9b('0x0'));module[_0x7c9b('0x1')]={'CmContactId':{'type':Sequelize[_0x7c9b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':_0x7c9b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x0c02=['exports','INTEGER','STRING','PHONE'];(function(_0x4de487,_0x4dbeed){var _0x4642ad=function(_0x2bad4b){while(--_0x2bad4b){_0x4de487['push'](_0x4de487['shift']());}};_0x4642ad(++_0x4dbeed);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x20c0('0x0')]={'CmContactId':{'type':Sequelize[_0x20c0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x20c0('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':_0x20c0('0x3')},'OrderBy':{'type':Sequelize[_0x20c0('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 154a967..d85ea96 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74c8=['catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','stack','name','index','map','CmContactHasItem','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0xc84c38,_0x49fbeb){var _0x1253bc=function(_0x3ab7e9){while(--_0x3ab7e9){_0xc84c38['push'](_0xc84c38['shift']());}};_0x1253bc(++_0x49fbeb);}(_0x74c8,0x1b9));var _0x874c=function(_0x170ccb,_0xa9c592){_0x170ccb=_0x170ccb-0x0;var _0x29f8e5=_0x74c8[_0x170ccb];return _0x29f8e5;};'use strict';var emlformat=require(_0x874c('0x0'));var rimraf=require(_0x874c('0x1'));var zipdir=require(_0x874c('0x2'));var jsonpatch=require(_0x874c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x874c('0x4'));var util=require('util');var path=require(_0x874c('0x5'));var sox=require(_0x874c('0x6'));var csv=require(_0x874c('0x7'));var ejs=require(_0x874c('0x8'));var fs=require('fs');var fs_extra=require(_0x874c('0x9'));var _=require('lodash');var squel=require(_0x874c('0xa'));var crypto=require(_0x874c('0xb'));var jsforce=require(_0x874c('0xc'));var deskjs=require(_0x874c('0xd'));var toCsv=require(_0x874c('0x7'));var querystring=require(_0x874c('0xe'));var Papa=require(_0x874c('0xf'));var Redis=require(_0x874c('0x10'));var authService=require(_0x874c('0x11'));var qs=require(_0x874c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x874c('0x13'));var logger=require(_0x874c('0x14'))(_0x874c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x874c('0x16'))['db'];function respondWithStatusCode(_0xde9740,_0x41e084){_0x41e084=_0x41e084||0xcc;return function(_0x40c296){if(_0x40c296){return _0xde9740[_0x874c('0x17')](_0x41e084);}return _0xde9740[_0x874c('0x18')](_0x41e084)[_0x874c('0x19')]();};}function respondWithResult(_0x207197,_0x5dc45d){_0x5dc45d=_0x5dc45d||0xc8;return function(_0x11bdee){if(_0x11bdee){return _0x207197[_0x874c('0x18')](_0x5dc45d)[_0x874c('0x1a')](_0x11bdee);}};}function respondWithFilteredResult(_0x28b0fd,_0x49901f){return function(_0x5b73ee){if(_0x5b73ee){var _0x41723b=typeof _0x49901f[_0x874c('0x1b')]===_0x874c('0x1c')&&typeof _0x49901f['limit']===_0x874c('0x1c');var _0x474038=_0x5b73ee['count'];var _0x34870e=_0x41723b?0x0:_0x49901f[_0x874c('0x1b')];var _0xb11603=_0x41723b?_0x5b73ee[_0x874c('0x1d')]:_0x49901f[_0x874c('0x1b')]+_0x49901f['limit'];var _0x473882;if(_0xb11603>=_0x474038){_0xb11603=_0x474038;_0x473882=0xc8;}else{_0x473882=0xce;}_0x28b0fd[_0x874c('0x18')](_0x473882);return _0x28b0fd[_0x874c('0x1e')]('Content-Range',_0x34870e+'-'+_0xb11603+'/'+_0x474038)[_0x874c('0x1a')](_0x5b73ee);}return null;};}function patchUpdates(_0x346f7f){return function(_0x370717){try{jsonpatch[_0x874c('0x1f')](_0x370717,_0x346f7f,!![]);}catch(_0x54fea9){return BPromise[_0x874c('0x20')](_0x54fea9);}return _0x370717[_0x874c('0x21')]();};}function saveUpdates(_0x510871,_0x482a65){return function(_0x41d451){if(_0x41d451){return _0x41d451[_0x874c('0x22')](_0x510871)[_0x874c('0x23')](function(_0x5a16f8){return _0x5a16f8;});}return null;};}function removeEntity(_0x4b18eb,_0x37ea60){return function(_0x3d5580){if(_0x3d5580){return _0x3d5580[_0x874c('0x24')]()[_0x874c('0x23')](function(){var _0x3c887f=_0x3d5580['get']({'plain':!![]});var _0x272c82=_0x874c('0x25');return db[_0x874c('0x26')][_0x874c('0x24')]({'where':{'type':_0x272c82,'resourceId':_0x3c887f['id']}})[_0x874c('0x23')](function(){return _0x3d5580;});})['then'](function(){_0x4b18eb['status'](0xcc)[_0x874c('0x19')]();});}};}function handleEntityNotFound(_0x38cd31,_0x45ff4d){return function(_0x24ef80){if(!_0x24ef80){_0x38cd31[_0x874c('0x17')](0x194);}return _0x24ef80;};}function handleError(_0x479946,_0x461cd4){_0x461cd4=_0x461cd4||0x1f4;return function(_0x1d66a1){logger['error'](_0x1d66a1[_0x874c('0x27')]);if(_0x1d66a1[_0x874c('0x28')]){delete _0x1d66a1['name'];}_0x479946[_0x874c('0x18')](_0x461cd4)['send'](_0x1d66a1);};}exports[_0x874c('0x29')]=function(_0xe9f1bd,_0x29899b){var _0x3e2df2={},_0x4883e6={},_0x4a146f={'count':0x0,'rows':[]};var _0x7a834c=_[_0x874c('0x2a')](db[_0x874c('0x2b')][_0x874c('0x2c')],function(_0x2541e2){return{'name':_0x2541e2['fieldName'],'type':_0x2541e2['type'][_0x874c('0x2d')]};});_0x4883e6['model']=_[_0x874c('0x2a')](_0x7a834c,_0x874c('0x28'));_0x4883e6['query']=_[_0x874c('0x2e')](_0xe9f1bd[_0x874c('0x2f')]);_0x4883e6[_0x874c('0x30')]=_[_0x874c('0x31')](_0x4883e6[_0x874c('0x32')],_0x4883e6[_0x874c('0x2f')]);_0x3e2df2[_0x874c('0x33')]=_['intersection'](_0x4883e6[_0x874c('0x32')],qs[_0x874c('0x34')](_0xe9f1bd['query'][_0x874c('0x34')]));_0x3e2df2['attributes']=_0x3e2df2[_0x874c('0x33')][_0x874c('0x35')]?_0x3e2df2[_0x874c('0x33')]:_0x4883e6['model'];if(!_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x36')](_0x874c('0x37'))){_0x3e2df2[_0x874c('0x38')]=qs[_0x874c('0x38')](_0xe9f1bd[_0x874c('0x2f')]['limit']);_0x3e2df2['offset']=qs['offset'](_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x1b')]);}_0x3e2df2[_0x874c('0x39')]=qs[_0x874c('0x3a')](_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x3a')]);_0x3e2df2[_0x874c('0x3b')]=qs[_0x874c('0x30')](_[_0x874c('0x3c')](_0xe9f1bd['query'],_0x4883e6['filters']),_0x7a834c);if(_0xe9f1bd[_0x874c('0x2f')]['filter']){_0x3e2df2[_0x874c('0x3b')]=_[_0x874c('0x3d')](_0x3e2df2['where'],{'$or':_[_0x874c('0x2a')](_0x7a834c,function(_0x53b3b6){if(_0x53b3b6[_0x874c('0x3e')]!==_0x874c('0x3f')){var _0x60e998={};_0x60e998[_0x53b3b6[_0x874c('0x28')]]={'$like':'%'+_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x40')]+'%'};return _0x60e998;}})});}_0x3e2df2=_['merge']({},_0x3e2df2,_0xe9f1bd['options']);var _0x55bfc9={'where':_0x3e2df2['where']};return db['CmContactHasItem']['count'](_0x55bfc9)[_0x874c('0x23')](function(_0x9aea6d){_0x4a146f[_0x874c('0x1d')]=_0x9aea6d;if(_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x41')]){_0x3e2df2[_0x874c('0x42')]=[{'all':!![]}];}return db[_0x874c('0x2b')][_0x874c('0x43')](_0x3e2df2);})[_0x874c('0x23')](function(_0x4dde1e){_0x4a146f[_0x874c('0x44')]=_0x4dde1e;return _0x4a146f;})['then'](respondWithFilteredResult(_0x29899b,_0x3e2df2))[_0x874c('0x45')](handleError(_0x29899b,null));};exports[_0x874c('0x46')]=function(_0x15053a,_0x222d01){var _0x264fbd={'raw':!![],'where':{'id':_0x15053a[_0x874c('0x47')]['id']}},_0x5e0d98={};_0x5e0d98[_0x874c('0x32')]=_['keys'](db['CmContactHasItem'][_0x874c('0x2c')]);_0x5e0d98[_0x874c('0x2f')]=_[_0x874c('0x2e')](_0x15053a[_0x874c('0x2f')]);_0x5e0d98[_0x874c('0x30')]=_['intersection'](_0x5e0d98['model'],_0x5e0d98[_0x874c('0x2f')]);_0x264fbd[_0x874c('0x33')]=_['intersection'](_0x5e0d98[_0x874c('0x32')],qs[_0x874c('0x34')](_0x15053a[_0x874c('0x2f')]['fields']));_0x264fbd[_0x874c('0x33')]=_0x264fbd[_0x874c('0x33')][_0x874c('0x35')]?_0x264fbd[_0x874c('0x33')]:_0x5e0d98[_0x874c('0x32')];if(_0x15053a['query']['includeAll']){_0x264fbd[_0x874c('0x42')]=[{'all':!![]}];}_0x264fbd=_[_0x874c('0x3d')]({},_0x264fbd,_0x15053a[_0x874c('0x48')]);return db[_0x874c('0x2b')][_0x874c('0x49')](_0x264fbd)[_0x874c('0x23')](handleEntityNotFound(_0x222d01,null))[_0x874c('0x23')](respondWithResult(_0x222d01,null))[_0x874c('0x45')](handleError(_0x222d01,null));};exports[_0x874c('0x4a')]=function(_0x2ac65d,_0x31c4f5){return db[_0x874c('0x2b')][_0x874c('0x4a')](_0x2ac65d[_0x874c('0x4b')],{})[_0x874c('0x23')](function(_0x54131a){var _0x34b65d=_0x2ac65d[_0x874c('0x4c')][_0x874c('0x4d')]({'plain':!![]});if(!_0x34b65d)throw new Error(_0x874c('0x4e'));if(_0x34b65d[_0x874c('0x4f')]===_0x874c('0x4c')){var _0x475076=_0x54131a[_0x874c('0x4d')]({'plain':!![]});var _0x486d78='CmContactHasItems';return db[_0x874c('0x50')][_0x874c('0x49')]({'where':{'name':_0x486d78,'userProfileId':_0x34b65d[_0x874c('0x51')]},'raw':!![]})['then'](function(_0x4126b5){if(_0x4126b5&&_0x4126b5[_0x874c('0x52')]===0x0){return db[_0x874c('0x26')][_0x874c('0x4a')]({'name':_0x475076['name'],'resourceId':_0x475076['id'],'type':_0x4126b5[_0x874c('0x28')],'sectionId':_0x4126b5['id']},{})[_0x874c('0x23')](function(){return _0x54131a;});}else{return _0x54131a;}})[_0x874c('0x45')](function(_0xb2b62c){logger[_0x874c('0x53')](_0x874c('0x54'),_0xb2b62c);throw _0xb2b62c;});}return _0x54131a;})[_0x874c('0x23')](respondWithResult(_0x31c4f5,0xc9))['catch'](handleError(_0x31c4f5,null));};exports[_0x874c('0x22')]=function(_0x2772d7,_0x211a07){if(_0x2772d7[_0x874c('0x4b')]['id']){delete _0x2772d7[_0x874c('0x4b')]['id'];}return db[_0x874c('0x2b')][_0x874c('0x49')]({'where':{'id':_0x2772d7[_0x874c('0x47')]['id']}})[_0x874c('0x23')](handleEntityNotFound(_0x211a07,null))['then'](saveUpdates(_0x2772d7[_0x874c('0x4b')],null))[_0x874c('0x23')](respondWithResult(_0x211a07,null))[_0x874c('0x45')](handleError(_0x211a07,null));};exports[_0x874c('0x24')]=function(_0x26f666,_0x356dbe){return db[_0x874c('0x2b')][_0x874c('0x49')]({'where':{'id':_0x26f666['params']['id']}})[_0x874c('0x23')](handleEntityNotFound(_0x356dbe,null))[_0x874c('0x23')](removeEntity(_0x356dbe,null))[_0x874c('0x45')](handleError(_0x356dbe,null));}; \ No newline at end of file +var _0x1a94=['get','CmContactHasItems','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x3c5acb,_0x35f0af){var _0x3e069c=function(_0x56eb5f){while(--_0x56eb5f){_0x3c5acb['push'](_0x3c5acb['shift']());}};_0x3e069c(++_0x35f0af);}(_0x1a94,0xcd));var _0x41a9=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x1a94[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0x41a9('0x0'));var rimraf=require(_0x41a9('0x1'));var zipdir=require(_0x41a9('0x2'));var jsonpatch=require(_0x41a9('0x3'));var rp=require(_0x41a9('0x4'));var moment=require(_0x41a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x41a9('0x6'));var path=require(_0x41a9('0x7'));var sox=require('sox');var csv=require(_0x41a9('0x8'));var ejs=require(_0x41a9('0x9'));var fs=require('fs');var fs_extra=require(_0x41a9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41a9('0xb'));var deskjs=require(_0x41a9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41a9('0xd'));var Redis=require(_0x41a9('0xe'));var authService=require(_0x41a9('0xf'));var qs=require(_0x41a9('0x10'));var as=require(_0x41a9('0x11'));var hardwareService=require(_0x41a9('0x12'));var logger=require(_0x41a9('0x13'))(_0x41a9('0x14'));var utils=require(_0x41a9('0x15'));var config=require(_0x41a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x41a9('0x17'))['db'];function respondWithStatusCode(_0xc30a48,_0x2933a3){_0x2933a3=_0x2933a3||0xcc;return function(_0x5a24e9){if(_0x5a24e9){return _0xc30a48[_0x41a9('0x18')](_0x2933a3);}return _0xc30a48[_0x41a9('0x19')](_0x2933a3)[_0x41a9('0x1a')]();};}function respondWithResult(_0x1348fe,_0x53e9db){_0x53e9db=_0x53e9db||0xc8;return function(_0x508e46){if(_0x508e46){return _0x1348fe[_0x41a9('0x19')](_0x53e9db)[_0x41a9('0x1b')](_0x508e46);}};}function respondWithFilteredResult(_0x29e86d,_0x3888d9){return function(_0x5e7314){if(_0x5e7314){var _0x276cc4=typeof _0x3888d9[_0x41a9('0x1c')]===_0x41a9('0x1d')&&typeof _0x3888d9[_0x41a9('0x1e')]===_0x41a9('0x1d');var _0x501c9c=_0x5e7314[_0x41a9('0x1f')];var _0x5c262e=_0x276cc4?0x0:_0x3888d9['offset'];var _0x5e8b5c=_0x276cc4?_0x5e7314['count']:_0x3888d9['offset']+_0x3888d9[_0x41a9('0x1e')];var _0x1eb1f4;if(_0x5e8b5c>=_0x501c9c){_0x5e8b5c=_0x501c9c;_0x1eb1f4=0xc8;}else{_0x1eb1f4=0xce;}_0x29e86d[_0x41a9('0x19')](_0x1eb1f4);return _0x29e86d['set'](_0x41a9('0x20'),_0x5c262e+'-'+_0x5e8b5c+'/'+_0x501c9c)[_0x41a9('0x1b')](_0x5e7314);}return null;};}function patchUpdates(_0x54f05e){return function(_0x367458){try{jsonpatch[_0x41a9('0x21')](_0x367458,_0x54f05e,!![]);}catch(_0x25692b){return BPromise[_0x41a9('0x22')](_0x25692b);}return _0x367458['save']();};}function saveUpdates(_0x281551,_0x5d71a0){return function(_0x5384bf){if(_0x5384bf){return _0x5384bf[_0x41a9('0x23')](_0x281551)[_0x41a9('0x24')](function(_0x3e2be5){return _0x3e2be5;});}return null;};}function removeEntity(_0x54c9ff,_0x410e22){return function(_0x2c0540){if(_0x2c0540){return _0x2c0540[_0x41a9('0x25')]()['then'](function(){var _0x11705b=_0x2c0540[_0x41a9('0x26')]({'plain':!![]});var _0xcee575=_0x41a9('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xcee575,'resourceId':_0x11705b['id']}})[_0x41a9('0x24')](function(){return _0x2c0540;});})[_0x41a9('0x24')](function(){_0x54c9ff[_0x41a9('0x19')](0xcc)[_0x41a9('0x1a')]();});}};}function handleEntityNotFound(_0x48b2f5,_0x56ebbb){return function(_0x4a42ea){if(!_0x4a42ea){_0x48b2f5[_0x41a9('0x18')](0x194);}return _0x4a42ea;};}function handleError(_0x5a1a08,_0x343a73){_0x343a73=_0x343a73||0x1f4;return function(_0x58ffdb){logger[_0x41a9('0x28')](_0x58ffdb[_0x41a9('0x29')]);if(_0x58ffdb[_0x41a9('0x2a')]){delete _0x58ffdb[_0x41a9('0x2a')];}_0x5a1a08[_0x41a9('0x19')](_0x343a73)['send'](_0x58ffdb);};}exports[_0x41a9('0x2b')]=function(_0x3d0e32,_0x9b61a4){var _0x2eeab0={},_0x16afda={},_0x5841fd={'count':0x0,'rows':[]};var _0x579ca8=_[_0x41a9('0x2c')](db[_0x41a9('0x2d')][_0x41a9('0x2e')],function(_0x36d3a5){return{'name':_0x36d3a5[_0x41a9('0x2f')],'type':_0x36d3a5[_0x41a9('0x30')]['key']};});_0x16afda[_0x41a9('0x31')]=_[_0x41a9('0x2c')](_0x579ca8,'name');_0x16afda[_0x41a9('0x32')]=_[_0x41a9('0x33')](_0x3d0e32['query']);_0x16afda['filters']=_[_0x41a9('0x34')](_0x16afda[_0x41a9('0x31')],_0x16afda['query']);_0x2eeab0['attributes']=_[_0x41a9('0x34')](_0x16afda['model'],qs[_0x41a9('0x35')](_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x35')]));_0x2eeab0['attributes']=_0x2eeab0[_0x41a9('0x36')][_0x41a9('0x37')]?_0x2eeab0[_0x41a9('0x36')]:_0x16afda[_0x41a9('0x31')];if(!_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x38')](_0x41a9('0x39'))){_0x2eeab0[_0x41a9('0x1e')]=qs[_0x41a9('0x1e')](_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x1e')]);_0x2eeab0[_0x41a9('0x1c')]=qs[_0x41a9('0x1c')](_0x3d0e32['query'][_0x41a9('0x1c')]);}_0x2eeab0[_0x41a9('0x3a')]=qs[_0x41a9('0x3b')](_0x3d0e32[_0x41a9('0x32')]['sort']);_0x2eeab0[_0x41a9('0x3c')]=qs[_0x41a9('0x3d')](_[_0x41a9('0x3e')](_0x3d0e32[_0x41a9('0x32')],_0x16afda[_0x41a9('0x3d')]),_0x579ca8);if(_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x3f')]){_0x2eeab0['where']=_['merge'](_0x2eeab0['where'],{'$or':_[_0x41a9('0x2c')](_0x579ca8,function(_0x53692e){if(_0x53692e[_0x41a9('0x30')]!==_0x41a9('0x40')){var _0x439f0f={};_0x439f0f[_0x53692e[_0x41a9('0x2a')]]={'$like':'%'+_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x3f')]+'%'};return _0x439f0f;}})});}_0x2eeab0=_[_0x41a9('0x41')]({},_0x2eeab0,_0x3d0e32[_0x41a9('0x42')]);var _0x3bb573={'where':_0x2eeab0[_0x41a9('0x3c')]};return db['CmContactHasItem'][_0x41a9('0x1f')](_0x3bb573)[_0x41a9('0x24')](function(_0x21a1b0){_0x5841fd[_0x41a9('0x1f')]=_0x21a1b0;if(_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x43')]){_0x2eeab0['include']=[{'all':!![]}];}return db[_0x41a9('0x2d')][_0x41a9('0x44')](_0x2eeab0);})['then'](function(_0x179c4f){_0x5841fd[_0x41a9('0x45')]=_0x179c4f;return _0x5841fd;})[_0x41a9('0x24')](respondWithFilteredResult(_0x9b61a4,_0x2eeab0))['catch'](handleError(_0x9b61a4,null));};exports[_0x41a9('0x46')]=function(_0x14c9d2,_0x33a8ce){var _0x237544={'raw':!![],'where':{'id':_0x14c9d2[_0x41a9('0x47')]['id']}},_0x553ba7={};_0x553ba7[_0x41a9('0x31')]=_['keys'](db[_0x41a9('0x2d')][_0x41a9('0x2e')]);_0x553ba7['query']=_[_0x41a9('0x33')](_0x14c9d2[_0x41a9('0x32')]);_0x553ba7['filters']=_[_0x41a9('0x34')](_0x553ba7[_0x41a9('0x31')],_0x553ba7[_0x41a9('0x32')]);_0x237544[_0x41a9('0x36')]=_[_0x41a9('0x34')](_0x553ba7[_0x41a9('0x31')],qs['fields'](_0x14c9d2[_0x41a9('0x32')][_0x41a9('0x35')]));_0x237544['attributes']=_0x237544['attributes']['length']?_0x237544[_0x41a9('0x36')]:_0x553ba7['model'];if(_0x14c9d2[_0x41a9('0x32')][_0x41a9('0x43')]){_0x237544['include']=[{'all':!![]}];}_0x237544=_[_0x41a9('0x41')]({},_0x237544,_0x14c9d2['options']);return db[_0x41a9('0x2d')][_0x41a9('0x48')](_0x237544)[_0x41a9('0x24')](handleEntityNotFound(_0x33a8ce,null))[_0x41a9('0x24')](respondWithResult(_0x33a8ce,null))[_0x41a9('0x49')](handleError(_0x33a8ce,null));};exports[_0x41a9('0x4a')]=function(_0x24ad12,_0x71e74d){return db['CmContactHasItem'][_0x41a9('0x4a')](_0x24ad12[_0x41a9('0x4b')],{})[_0x41a9('0x24')](function(_0x5f11af){var _0x2ef973=_0x24ad12[_0x41a9('0x4c')]['get']({'plain':!![]});if(!_0x2ef973)throw new Error(_0x41a9('0x4d'));if(_0x2ef973['role']===_0x41a9('0x4c')){var _0xd8a25b=_0x5f11af[_0x41a9('0x26')]({'plain':!![]});var _0x3ae09f=_0x41a9('0x27');return db[_0x41a9('0x4e')][_0x41a9('0x48')]({'where':{'name':_0x3ae09f,'userProfileId':_0x2ef973[_0x41a9('0x4f')]},'raw':!![]})[_0x41a9('0x24')](function(_0x272253){if(_0x272253&&_0x272253[_0x41a9('0x50')]===0x0){return db['UserProfileResource'][_0x41a9('0x4a')]({'name':_0xd8a25b['name'],'resourceId':_0xd8a25b['id'],'type':_0x272253[_0x41a9('0x2a')],'sectionId':_0x272253['id']},{})[_0x41a9('0x24')](function(){return _0x5f11af;});}else{return _0x5f11af;}})[_0x41a9('0x49')](function(_0x5af028){logger[_0x41a9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5af028);throw _0x5af028;});}return _0x5f11af;})['then'](respondWithResult(_0x71e74d,0xc9))[_0x41a9('0x49')](handleError(_0x71e74d,null));};exports[_0x41a9('0x23')]=function(_0x2cb123,_0x3e3ff7){if(_0x2cb123[_0x41a9('0x4b')]['id']){delete _0x2cb123[_0x41a9('0x4b')]['id'];}return db[_0x41a9('0x2d')]['find']({'where':{'id':_0x2cb123['params']['id']}})[_0x41a9('0x24')](handleEntityNotFound(_0x3e3ff7,null))['then'](saveUpdates(_0x2cb123[_0x41a9('0x4b')],null))[_0x41a9('0x24')](respondWithResult(_0x3e3ff7,null))[_0x41a9('0x49')](handleError(_0x3e3ff7,null));};exports[_0x41a9('0x25')]=function(_0x32e81f,_0x34dd55){return db['CmContactHasItem'][_0x41a9('0x48')]({'where':{'id':_0x32e81f['params']['id']}})[_0x41a9('0x24')](handleEntityNotFound(_0x34dd55,null))[_0x41a9('0x24')](removeEntity(_0x34dd55,null))['catch'](handleError(_0x34dd55,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index a3e1564..3dfdb3b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69a2=['cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x4b2892,_0x5546b2){var _0x34aaac=function(_0x30d6ab){while(--_0x30d6ab){_0x4b2892['push'](_0x4b2892['shift']());}};_0x34aaac(++_0x5546b2);}(_0x69a2,0x1a1));var _0x269a=function(_0x1baa21,_0x4aed8b){_0x1baa21=_0x1baa21-0x0;var _0x3c3057=_0x69a2[_0x1baa21];return _0x3c3057;};'use strict';var _=require(_0x269a('0x0'));var util=require('util');var logger=require(_0x269a('0x1'))(_0x269a('0x2'));var moment=require(_0x269a('0x3'));var BPromise=require(_0x269a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x269a('0x5'));var rimraf=require(_0x269a('0x6'));var config=require(_0x269a('0x7'));var attributes=require(_0x269a('0x8'));module[_0x269a('0x9')]=function(_0x20f512,_0x592a71){return _0x20f512[_0x269a('0xa')](_0x269a('0xb'),attributes,{'tableName':_0x269a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7152=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e8f79,_0x3843a6){var _0x319b97=function(_0x504d79){while(--_0x504d79){_0x3e8f79['push'](_0x3e8f79['shift']());}};_0x319b97(++_0x3843a6);}(_0x7152,0x1f1));var _0x2715=function(_0x179b80,_0x440291){_0x179b80=_0x179b80-0x0;var _0x1e8d03=_0x7152[_0x179b80];return _0x1e8d03;};'use strict';var _=require(_0x2715('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2715('0x1'));var BPromise=require(_0x2715('0x2'));var rp=require(_0x2715('0x3'));var fs=require('fs');var path=require(_0x2715('0x4'));var rimraf=require(_0x2715('0x5'));var config=require(_0x2715('0x6'));var attributes=require(_0x2715('0x7'));module[_0x2715('0x8')]=function(_0x4fc237,_0x32e0e0){return _0x4fc237[_0x2715('0x9')](_0x2715('0xa'),attributes,{'tableName':_0x2715('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 5a01373..ac020e8 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc155=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x436985,_0x2e7f0b){var _0x2a8d4d=function(_0x9aadd4){while(--_0x9aadd4){_0x436985['push'](_0x436985['shift']());}};_0x2a8d4d(++_0x2e7f0b);}(_0xc155,0xa1));var _0x5c15=function(_0x5992ac,_0x2253b0){_0x5992ac=_0x5992ac-0x0;var _0x540bba=_0xc155[_0x5992ac];return _0x540bba;};'use strict';var _=require(_0x5c15('0x0'));var util=require('util');var moment=require(_0x5c15('0x1'));var BPromise=require(_0x5c15('0x2'));var rs=require(_0x5c15('0x3'));var fs=require('fs');var Redis=require(_0x5c15('0x4'));var db=require(_0x5c15('0x5'))['db'];var utils=require(_0x5c15('0x6'));var logger=require(_0x5c15('0x7'))(_0x5c15('0x8'));var config=require(_0x5c15('0x9'));var jayson=require(_0x5c15('0xa'));var client=jayson[_0x5c15('0xb')][_0x5c15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x586889,_0x4ae624,_0x580283){return new BPromise(function(_0x3104e6,_0x463f0b){return client[_0x5c15('0xd')](_0x586889,_0x580283)[_0x5c15('0xe')](function(_0x462811){logger['info'](_0x5c15('0xf'),_0x4ae624,_0x5c15('0x10'));logger[_0x5c15('0x11')](_0x5c15('0x12'),_0x4ae624,_0x5c15('0x10'),JSON[_0x5c15('0x13')](_0x462811));if(_0x462811[_0x5c15('0x14')]){if(_0x462811['error'][_0x5c15('0x15')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4ae624,_0x462811['error'][_0x5c15('0x16')]);return _0x463f0b(_0x462811[_0x5c15('0x14')][_0x5c15('0x16')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4ae624,_0x462811[_0x5c15('0x14')][_0x5c15('0x16')]);return _0x3104e6(_0x462811['error']['message']);}else{logger[_0x5c15('0x17')](_0x5c15('0xf'),_0x4ae624,_0x5c15('0x10'));_0x3104e6(_0x462811[_0x5c15('0x18')][_0x5c15('0x16')]);}})[_0x5c15('0x19')](function(_0x4f35dd){logger['error'](_0x5c15('0xf'),_0x4ae624,_0x4f35dd);_0x463f0b(_0x4f35dd);});});} \ No newline at end of file +var _0x78a4=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0x78a4,0x6f));var _0x478a=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x78a4[_0x256e32];return _0x464070;};'use strict';var _=require(_0x478a('0x0'));var util=require(_0x478a('0x1'));var moment=require(_0x478a('0x2'));var BPromise=require(_0x478a('0x3'));var rs=require(_0x478a('0x4'));var fs=require('fs');var Redis=require(_0x478a('0x5'));var db=require(_0x478a('0x6'))['db'];var utils=require(_0x478a('0x7'));var logger=require(_0x478a('0x8'))('rpc');var config=require(_0x478a('0x9'));var jayson=require(_0x478a('0xa'));var client=jayson['client'][_0x478a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506e5a,_0x2abd38,_0xa73a92){return new BPromise(function(_0x2340dc,_0x53ae5d){return client[_0x478a('0xc')](_0x506e5a,_0xa73a92)[_0x478a('0xd')](function(_0x16075c){logger[_0x478a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2abd38,'request\x20sent');logger['debug'](_0x478a('0xf'),_0x2abd38,'request\x20sent',JSON[_0x478a('0x10')](_0x16075c));if(_0x16075c['error']){if(_0x16075c[_0x478a('0x11')][_0x478a('0x12')]===0x1f4){logger[_0x478a('0x11')](_0x478a('0x13'),_0x2abd38,_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);return _0x53ae5d(_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);}logger['error'](_0x478a('0x13'),_0x2abd38,_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);return _0x2340dc(_0x16075c[_0x478a('0x11')]['message']);}else{logger['info'](_0x478a('0x13'),_0x2abd38,'request\x20sent');_0x2340dc(_0x16075c[_0x478a('0x15')][_0x478a('0x14')]);}})['catch'](function(_0x1099b2){logger[_0x478a('0x11')](_0x478a('0x13'),_0x2abd38,_0x1099b2);_0x53ae5d(_0x1099b2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7a4b596..6c61687 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf4=['update','/:id','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','post','create','put'];(function(_0x1563bc,_0x5e29bd){var _0xcf61a7=function(_0x3c0a2f){while(--_0x3c0a2f){_0x1563bc['push'](_0x1563bc['shift']());}};_0xcf61a7(++_0x5e29bd);}(_0xbaf4,0x13f));var _0x4baf=function(_0x47c36f,_0x2cae4f){_0x47c36f=_0x47c36f-0x0;var _0x54ad58=_0xbaf4[_0x47c36f];return _0x54ad58;};'use strict';var multer=require(_0x4baf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4baf('0x1'));var auth=require(_0x4baf('0x2'));var interaction=require(_0x4baf('0x3'));var config=require('../../config/environment');var controller=require(_0x4baf('0x4'));router['get']('/',auth[_0x4baf('0x5')](),controller[_0x4baf('0x6')]);router[_0x4baf('0x7')]('/:id',auth[_0x4baf('0x5')](),controller['show']);router[_0x4baf('0x8')]('/',auth[_0x4baf('0x5')](),controller[_0x4baf('0x9')]);router[_0x4baf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4baf('0xb')]);router['delete'](_0x4baf('0xc'),auth[_0x4baf('0x5')](),controller[_0x4baf('0xd')]);module[_0x4baf('0xe')]=router; \ No newline at end of file +var _0x72e6=['get','/:id','show','post','create','update','delete','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x72e6,0xda));var _0x672e=function(_0x4c6fa9,_0x3a7005){_0x4c6fa9=_0x4c6fa9-0x0;var _0x33ef35=_0x72e6[_0x4c6fa9];return _0x33ef35;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x672e('0x0'));var express=require(_0x672e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x672e('0x2'));var interaction=require(_0x672e('0x3'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x672e('0x4')](),controller[_0x672e('0x5')]);router[_0x672e('0x6')](_0x672e('0x7'),auth['isAuthenticated'](),controller[_0x672e('0x8')]);router[_0x672e('0x9')]('/',auth[_0x672e('0x4')](),controller[_0x672e('0xa')]);router['put'](_0x672e('0x7'),auth[_0x672e('0x4')](),controller[_0x672e('0xb')]);router[_0x672e('0xc')](_0x672e('0x7'),auth[_0x672e('0x4')](),controller['destroy']);module[_0x672e('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 66adf8d..a24e8aa 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 _0xf128=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','select','parse','values','isArray','BOOLEAN','ENUM'];(function(_0x4364eb,_0x53842f){var _0x43725e=function(_0x1714af){while(--_0x1714af){_0x4364eb['push'](_0x4364eb['shift']());}};_0x43725e(++_0x53842f);}(_0xf128,0x198));var _0x8f12=function(_0x4ff120,_0x30ee0b){_0x4ff120=_0x4ff120-0x0;var _0x1a8437=_0xf128[_0x4ff120];return _0x1a8437;};'use strict';var Sequelize=require(_0x8f12('0x0'));var _=require(_0x8f12('0x1'));module[_0x8f12('0x2')]={'name':{'type':Sequelize[_0x8f12('0x3')],'get':function(_0x5ac201){return this[_0x8f12('0x4')](_0x8f12('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x21e5c0){this[_0x8f12('0x6')](_0x8f12('0x5'),_0x21e5c0?_0x21e5c0:this[_0x8f12('0x4')](_0x8f12('0x7')));}},'type':{'type':Sequelize[_0x8f12('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x8f12('0x9')]('long'),'get':function(){if(this[_0x8f12('0x4')](_0x8f12('0xa'))===_0x8f12('0xb')){return JSON[_0x8f12('0xc')](this[_0x8f12('0x4')](_0x8f12('0xd')));}else{return this[_0x8f12('0x4')](_0x8f12('0xd'));}},'set':function(_0x2d6377){if(Array[_0x8f12('0xe')](_0x2d6377)){this[_0x8f12('0x6')]('values',JSON['stringify'](_0x2d6377));}else{this['setDataValue'](_0x8f12('0xd'),_0x2d6377);}}},'required':{'type':Sequelize[_0x8f12('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8f12('0x10')]('voice')}}; \ No newline at end of file +var _0xa808=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','setDataValue','getDataValue','STRING','long','select','parse','values'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xa808,0x8d));var _0x8a80=function(_0x41e1a7,_0xfd63ec){_0x41e1a7=_0x41e1a7-0x0;var _0x466ca1=_0xa808[_0x41e1a7];return _0x466ca1;};'use strict';var Sequelize=require(_0x8a80('0x0'));var _=require(_0x8a80('0x1'));module[_0x8a80('0x2')]={'name':{'type':Sequelize[_0x8a80('0x3')],'get':function(_0x47298c){return this['getDataValue'](_0x8a80('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5a5362){this[_0x8a80('0x5')](_0x8a80('0x4'),_0x5a5362?_0x5a5362:this[_0x8a80('0x6')]('name'));}},'type':{'type':Sequelize[_0x8a80('0x7')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x8a80('0x8')),'get':function(){if(this['getDataValue']('type')===_0x8a80('0x9')){return JSON[_0x8a80('0xa')](this['getDataValue'](_0x8a80('0xb')));}else{return this[_0x8a80('0x6')](_0x8a80('0xb'));}},'set':function(_0x24cd44){if(Array[_0x8a80('0xc')](_0x24cd44)){this[_0x8a80('0x5')](_0x8a80('0xb'),JSON[_0x8a80('0xd')](_0x24cd44));}else{this[_0x8a80('0x5')](_0x8a80('0xb'),_0x24cd44);}}},'required':{'type':Sequelize[_0x8a80('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8a80('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8a80('0xf')](_0x8a80('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index eae3ae4..d06a9eb 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 _0xc75c=['name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','body','find','params','sequelize','create','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','stack'];(function(_0x56641c,_0x4d0ee3){var _0x3e6270=function(_0x2ce371){while(--_0x2ce371){_0x56641c['push'](_0x56641c['shift']());}};_0x3e6270(++_0x4d0ee3);}(_0xc75c,0x11b));var _0xcc75=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0xc75c[_0xf1f37e];return _0x2e3a6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc75('0x0'));var zipdir=require(_0xcc75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc75('0x2'));var moment=require(_0xcc75('0x3'));var BPromise=require(_0xcc75('0x4'));var Mustache=require(_0xcc75('0x5'));var util=require(_0xcc75('0x6'));var path=require(_0xcc75('0x7'));var sox=require(_0xcc75('0x8'));var csv=require(_0xcc75('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc75('0xa'));var squel=require('squel');var crypto=require(_0xcc75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcc75('0xc'));var toCsv=require(_0xcc75('0x9'));var querystring=require(_0xcc75('0xd'));var Papa=require('papaparse');var Redis=require(_0xcc75('0xe'));var authService=require(_0xcc75('0xf'));var qs=require(_0xcc75('0x10'));var as=require(_0xcc75('0x11'));var hardwareService=require(_0xcc75('0x12'));var logger=require(_0xcc75('0x13'))(_0xcc75('0x14'));var utils=require(_0xcc75('0x15'));var config=require(_0xcc75('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc75('0x17'))['db'];function respondWithStatusCode(_0x54def0,_0x115485){_0x115485=_0x115485||0xcc;return function(_0x3b5c7c){if(_0x3b5c7c){return _0x54def0[_0xcc75('0x18')](_0x115485);}return _0x54def0[_0xcc75('0x19')](_0x115485)[_0xcc75('0x1a')]();};}function respondWithResult(_0x5c41b4,_0x9b8949){_0x9b8949=_0x9b8949||0xc8;return function(_0x3efcde){if(_0x3efcde){return _0x5c41b4[_0xcc75('0x19')](_0x9b8949)['json'](_0x3efcde);}};}function respondWithFilteredResult(_0x560e1a,_0x3cf88){return function(_0x35e38f){if(_0x35e38f){var _0x4f0a35=typeof _0x3cf88[_0xcc75('0x1b')]===_0xcc75('0x1c')&&typeof _0x3cf88[_0xcc75('0x1d')]===_0xcc75('0x1c');var _0x5d5379=_0x35e38f[_0xcc75('0x1e')];var _0x2459ef=_0x4f0a35?0x0:_0x3cf88[_0xcc75('0x1b')];var _0x2aeaf9=_0x4f0a35?_0x35e38f[_0xcc75('0x1e')]:_0x3cf88[_0xcc75('0x1b')]+_0x3cf88[_0xcc75('0x1d')];var _0x4d8ea7;if(_0x2aeaf9>=_0x5d5379){_0x2aeaf9=_0x5d5379;_0x4d8ea7=0xc8;}else{_0x4d8ea7=0xce;}_0x560e1a[_0xcc75('0x19')](_0x4d8ea7);return _0x560e1a['set']('Content-Range',_0x2459ef+'-'+_0x2aeaf9+'/'+_0x5d5379)[_0xcc75('0x1f')](_0x35e38f);}return null;};}function patchUpdates(_0x453918){return function(_0x4f05fa){try{jsonpatch[_0xcc75('0x20')](_0x4f05fa,_0x453918,!![]);}catch(_0x3bb6e6){return BPromise['reject'](_0x3bb6e6);}return _0x4f05fa['save']();};}function saveUpdates(_0x37329e,_0x3690dc){return function(_0x2f3014){if(_0x2f3014){return _0x2f3014[_0xcc75('0x21')](_0x37329e)[_0xcc75('0x22')](function(_0x229ed4){return _0x229ed4;});}return null;};}function removeEntity(_0x229738,_0x1822bb){return function(_0x188642){if(_0x188642){return _0x188642[_0xcc75('0x23')]()[_0xcc75('0x22')](function(){_0x229738[_0xcc75('0x19')](0xcc)[_0xcc75('0x1a')]();});}};}function handleEntityNotFound(_0x160d37,_0x2f03a2){return function(_0x4a6420){if(!_0x4a6420){_0x160d37[_0xcc75('0x18')](0x194);}return _0x4a6420;};}function handleError(_0x1ee12b,_0x52863f){_0x52863f=_0x52863f||0x1f4;return function(_0x41ab60){logger['error'](_0x41ab60[_0xcc75('0x24')]);if(_0x41ab60[_0xcc75('0x25')]){delete _0x41ab60[_0xcc75('0x25')];}_0x1ee12b['status'](_0x52863f)[_0xcc75('0x26')](_0x41ab60);};}exports[_0xcc75('0x27')]=function(_0x3d5414,_0x546663){var _0x222be4={},_0x9fcdca={},_0x2033e0={'count':0x0,'rows':[]};var _0xaaa0d1=_[_0xcc75('0x28')](db[_0xcc75('0x29')][_0xcc75('0x2a')],function(_0x36b3ce){return{'name':_0x36b3ce[_0xcc75('0x2b')],'type':_0x36b3ce[_0xcc75('0x2c')][_0xcc75('0x2d')]};});_0x9fcdca[_0xcc75('0x2e')]=_['differenceBy'](_[_0xcc75('0x28')](_0xaaa0d1,_0xcc75('0x25')),[_0xcc75('0x25')]);_0x9fcdca['query']=_['keys'](_0x3d5414['query']);_0x9fcdca[_0xcc75('0x2f')]=_[_0xcc75('0x30')](_0x9fcdca['model'],_0x9fcdca[_0xcc75('0x31')]);_0x222be4[_0xcc75('0x32')]=_[_0xcc75('0x30')](_0x9fcdca[_0xcc75('0x2e')],qs['fields'](_0x3d5414[_0xcc75('0x31')][_0xcc75('0x33')]));_0x222be4[_0xcc75('0x32')]=_0x222be4[_0xcc75('0x32')]['length']?_0x222be4[_0xcc75('0x32')]:_0x9fcdca['model'];if(!_0x3d5414['query']['hasOwnProperty']('nolimit')){_0x222be4[_0xcc75('0x1d')]=qs['limit'](_0x3d5414['query'][_0xcc75('0x1d')]);_0x222be4['offset']=qs[_0xcc75('0x1b')](_0x3d5414['query'][_0xcc75('0x1b')]);}_0x222be4[_0xcc75('0x34')]=qs[_0xcc75('0x35')](_0x3d5414[_0xcc75('0x31')][_0xcc75('0x35')]);_0x222be4[_0xcc75('0x36')]=qs[_0xcc75('0x2f')](_['pick'](_0x3d5414['query'],_0x9fcdca[_0xcc75('0x2f')]),_0xaaa0d1);if(_0x3d5414['query'][_0xcc75('0x37')]){_0x222be4[_0xcc75('0x36')]=_[_0xcc75('0x38')](_0x222be4['where'],{'$or':_['map'](_0xaaa0d1,function(_0x301c35){if(_0x301c35['type']!==_0xcc75('0x39')){var _0x128863={};_0x128863[_0x301c35[_0xcc75('0x25')]]={'$like':'%'+_0x3d5414['query'][_0xcc75('0x37')]+'%'};return _0x128863;}})});}_0x222be4=_[_0xcc75('0x38')]({},_0x222be4,_0x3d5414[_0xcc75('0x3a')]);var _0x1f69bc={'where':_0x222be4[_0xcc75('0x36')]};return db[_0xcc75('0x29')][_0xcc75('0x1e')](_0x1f69bc)[_0xcc75('0x22')](function(_0x180304){_0x2033e0['count']=_0x180304;if(_0x3d5414[_0xcc75('0x31')][_0xcc75('0x3b')]){_0x222be4[_0xcc75('0x3c')]=[{'all':!![]}];}return db[_0xcc75('0x29')][_0xcc75('0x3d')](_0x222be4);})[_0xcc75('0x22')](function(_0x4767b3){_0x2033e0[_0xcc75('0x3e')]=_0x4767b3;return _0x2033e0;})[_0xcc75('0x22')](respondWithFilteredResult(_0x546663,_0x222be4))[_0xcc75('0x3f')](handleError(_0x546663,null));};exports['show']=function(_0x478c4b,_0x321de1){var _0x27b0fa={'raw':!![],'where':{'id':_0x478c4b['params']['id']}},_0x2ff845={};_0x2ff845[_0xcc75('0x2e')]=_[_0xcc75('0x40')](db[_0xcc75('0x29')][_0xcc75('0x2a')]);_0x2ff845['query']=_[_0xcc75('0x40')](_0x478c4b['query']);_0x2ff845[_0xcc75('0x2f')]=_[_0xcc75('0x30')](_0x2ff845[_0xcc75('0x2e')],_0x2ff845['query']);_0x27b0fa['attributes']=_['intersection'](_0x2ff845['model'],qs[_0xcc75('0x33')](_0x478c4b['query'][_0xcc75('0x33')]));_0x27b0fa[_0xcc75('0x32')]=_0x27b0fa[_0xcc75('0x32')]['length']?_0x27b0fa[_0xcc75('0x32')]:_0x2ff845[_0xcc75('0x2e')];if(_0x478c4b[_0xcc75('0x31')]['includeAll']){_0x27b0fa[_0xcc75('0x3c')]=[{'all':!![]}];}_0x27b0fa=_['merge']({},_0x27b0fa,_0x478c4b[_0xcc75('0x3a')]);return db[_0xcc75('0x29')]['find'](_0x27b0fa)['then'](handleEntityNotFound(_0x321de1,null))[_0xcc75('0x22')](respondWithResult(_0x321de1,null))[_0xcc75('0x3f')](handleError(_0x321de1,null));};exports[_0xcc75('0x21')]=function(_0xc81c84,_0x1336b8){if(_0xc81c84['body']['id']){delete _0xc81c84[_0xcc75('0x41')]['id'];}return db[_0xcc75('0x29')][_0xcc75('0x42')]({'where':{'id':_0xc81c84[_0xcc75('0x43')]['id']}})['then'](handleEntityNotFound(_0x1336b8,null))['then'](saveUpdates(_0xc81c84[_0xcc75('0x41')],null))[_0xcc75('0x22')](respondWithResult(_0x1336b8,null))['catch'](handleError(_0x1336b8,null));};exports[_0xcc75('0x23')]=function(_0x59fd66,_0x4d57eb){return db[_0xcc75('0x29')][_0xcc75('0x42')]({'where':{'id':_0x59fd66[_0xcc75('0x43')]['id']}})[_0xcc75('0x22')](handleEntityNotFound(_0x4d57eb,null))['then'](removeEntity(_0x4d57eb,null))[_0xcc75('0x3f')](handleError(_0x4d57eb,null));};exports['create']=function(_0x226ea7,_0x139009){var _0x24d698;return db[_0xcc75('0x44')]['transaction'](function(_0x3eb389){return db[_0xcc75('0x29')][_0xcc75('0x45')](_0x226ea7['body'],{'transaction':_0x3eb389})[_0xcc75('0x22')](function(_0x20eae0){_0x24d698=_0x20eae0;var _0x13f26d={'type':db[_0xcc75('0x46')]['TEXT'],'transaction':_0x3eb389};switch(_0x226ea7[_0xcc75('0x41')][_0xcc75('0x2c')]){case _0xcc75('0x47'):_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x48')];break;case _0xcc75('0x49'):_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x4a')];break;case'switch':_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x4b')];_0x13f26d[_0xcc75('0x4c')]=![];break;default:}return db['sequelize'][_0xcc75('0x4d')][_0xcc75('0x4e')]('cm_contacts',util[_0xcc75('0x4f')]('cf_%d',_0x24d698['id']),_0x13f26d);})['then'](function(){return _0x24d698;});})[_0xcc75('0x22')](respondWithResult(_0x139009,0xc9))[_0xcc75('0x3f')](handleError(_0x139009,null));}; \ No newline at end of file +var _0x0294=['body','create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','then','name','send','index','map','CmCustomField','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x0294,0x15e));var _0x4029=function(_0x456cd7,_0x3be3f2){_0x456cd7=_0x456cd7-0x0;var _0x40c880=_0x0294[_0x456cd7];return _0x40c880;};'use strict';var emlformat=require(_0x4029('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4029('0x2'));var moment=require('moment');var BPromise=require(_0x4029('0x3'));var Mustache=require(_0x4029('0x4'));var util=require('util');var path=require(_0x4029('0x5'));var sox=require(_0x4029('0x6'));var csv=require(_0x4029('0x7'));var ejs=require(_0x4029('0x8'));var fs=require('fs');var fs_extra=require(_0x4029('0x9'));var _=require(_0x4029('0xa'));var squel=require('squel');var crypto=require(_0x4029('0xb'));var jsforce=require(_0x4029('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4029('0x7'));var querystring=require(_0x4029('0xd'));var Papa=require(_0x4029('0xe'));var Redis=require(_0x4029('0xf'));var authService=require(_0x4029('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4029('0x11'));var hardwareService=require(_0x4029('0x12'));var logger=require('../../config/logger')(_0x4029('0x13'));var utils=require('../../config/utils');var config=require(_0x4029('0x14'));var licenseUtil=require(_0x4029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x299362,_0x27778c){_0x27778c=_0x27778c||0xcc;return function(_0x298e3d){if(_0x298e3d){return _0x299362[_0x4029('0x16')](_0x27778c);}return _0x299362[_0x4029('0x17')](_0x27778c)[_0x4029('0x18')]();};}function respondWithResult(_0x310672,_0x18c36b){_0x18c36b=_0x18c36b||0xc8;return function(_0x40c9b5){if(_0x40c9b5){return _0x310672[_0x4029('0x17')](_0x18c36b)[_0x4029('0x19')](_0x40c9b5);}};}function respondWithFilteredResult(_0x4b5e6d,_0x3509f9){return function(_0x3c19e9){if(_0x3c19e9){var _0x59ec50=typeof _0x3509f9[_0x4029('0x1a')]===_0x4029('0x1b')&&typeof _0x3509f9[_0x4029('0x1c')]===_0x4029('0x1b');var _0x187fb0=_0x3c19e9['count'];var _0x7c151a=_0x59ec50?0x0:_0x3509f9['offset'];var _0x2403b7=_0x59ec50?_0x3c19e9['count']:_0x3509f9[_0x4029('0x1a')]+_0x3509f9[_0x4029('0x1c')];var _0x48d6b5;if(_0x2403b7>=_0x187fb0){_0x2403b7=_0x187fb0;_0x48d6b5=0xc8;}else{_0x48d6b5=0xce;}_0x4b5e6d[_0x4029('0x17')](_0x48d6b5);return _0x4b5e6d[_0x4029('0x1d')](_0x4029('0x1e'),_0x7c151a+'-'+_0x2403b7+'/'+_0x187fb0)['json'](_0x3c19e9);}return null;};}function patchUpdates(_0x184848){return function(_0x280d03){try{jsonpatch['apply'](_0x280d03,_0x184848,!![]);}catch(_0x48fa58){return BPromise[_0x4029('0x1f')](_0x48fa58);}return _0x280d03[_0x4029('0x20')]();};}function saveUpdates(_0x423c1e,_0x316bca){return function(_0x30945f){if(_0x30945f){return _0x30945f[_0x4029('0x21')](_0x423c1e)['then'](function(_0x45ce71){return _0x45ce71;});}return null;};}function removeEntity(_0x401ce0,_0x4e6665){return function(_0x553c81){if(_0x553c81){return _0x553c81[_0x4029('0x22')]()[_0x4029('0x23')](function(){_0x401ce0[_0x4029('0x17')](0xcc)[_0x4029('0x18')]();});}};}function handleEntityNotFound(_0x3734d8,_0x13a89d){return function(_0x585737){if(!_0x585737){_0x3734d8['sendStatus'](0x194);}return _0x585737;};}function handleError(_0x18e0f5,_0xefadc7){_0xefadc7=_0xefadc7||0x1f4;return function(_0x5f042d){logger['error'](_0x5f042d['stack']);if(_0x5f042d['name']){delete _0x5f042d[_0x4029('0x24')];}_0x18e0f5[_0x4029('0x17')](_0xefadc7)[_0x4029('0x25')](_0x5f042d);};}exports[_0x4029('0x26')]=function(_0x28b450,_0x2b8060){var _0xaffc3b={},_0x11e43c={},_0x2f6528={'count':0x0,'rows':[]};var _0xed6de=_[_0x4029('0x27')](db[_0x4029('0x28')]['rawAttributes'],function(_0x50b490){return{'name':_0x50b490['fieldName'],'type':_0x50b490[_0x4029('0x29')][_0x4029('0x2a')]};});_0x11e43c[_0x4029('0x2b')]=_['differenceBy'](_[_0x4029('0x27')](_0xed6de,_0x4029('0x24')),['name']);_0x11e43c['query']=_[_0x4029('0x2c')](_0x28b450[_0x4029('0x2d')]);_0x11e43c['filters']=_[_0x4029('0x2e')](_0x11e43c[_0x4029('0x2b')],_0x11e43c['query']);_0xaffc3b[_0x4029('0x2f')]=_[_0x4029('0x2e')](_0x11e43c[_0x4029('0x2b')],qs[_0x4029('0x30')](_0x28b450['query']['fields']));_0xaffc3b['attributes']=_0xaffc3b[_0x4029('0x2f')][_0x4029('0x31')]?_0xaffc3b[_0x4029('0x2f')]:_0x11e43c[_0x4029('0x2b')];if(!_0x28b450[_0x4029('0x2d')][_0x4029('0x32')](_0x4029('0x33'))){_0xaffc3b['limit']=qs[_0x4029('0x1c')](_0x28b450[_0x4029('0x2d')][_0x4029('0x1c')]);_0xaffc3b[_0x4029('0x1a')]=qs[_0x4029('0x1a')](_0x28b450[_0x4029('0x2d')][_0x4029('0x1a')]);}_0xaffc3b['order']=qs[_0x4029('0x34')](_0x28b450[_0x4029('0x2d')]['sort']);_0xaffc3b[_0x4029('0x35')]=qs[_0x4029('0x36')](_[_0x4029('0x37')](_0x28b450[_0x4029('0x2d')],_0x11e43c['filters']),_0xed6de);if(_0x28b450[_0x4029('0x2d')][_0x4029('0x38')]){_0xaffc3b['where']=_[_0x4029('0x39')](_0xaffc3b[_0x4029('0x35')],{'$or':_[_0x4029('0x27')](_0xed6de,function(_0x33c53f){if(_0x33c53f[_0x4029('0x29')]!==_0x4029('0x3a')){var _0xb7a14b={};_0xb7a14b[_0x33c53f[_0x4029('0x24')]]={'$like':'%'+_0x28b450[_0x4029('0x2d')]['filter']+'%'};return _0xb7a14b;}})});}_0xaffc3b=_[_0x4029('0x39')]({},_0xaffc3b,_0x28b450[_0x4029('0x3b')]);var _0x1ebd46={'where':_0xaffc3b[_0x4029('0x35')]};return db[_0x4029('0x28')][_0x4029('0x3c')](_0x1ebd46)[_0x4029('0x23')](function(_0x24adca){_0x2f6528['count']=_0x24adca;if(_0x28b450[_0x4029('0x2d')][_0x4029('0x3d')]){_0xaffc3b[_0x4029('0x3e')]=[{'all':!![]}];}return db[_0x4029('0x28')][_0x4029('0x3f')](_0xaffc3b);})['then'](function(_0xd0aef5){_0x2f6528[_0x4029('0x40')]=_0xd0aef5;return _0x2f6528;})[_0x4029('0x23')](respondWithFilteredResult(_0x2b8060,_0xaffc3b))[_0x4029('0x41')](handleError(_0x2b8060,null));};exports[_0x4029('0x42')]=function(_0x149ebd,_0x299f2f){var _0x162436={'raw':!![],'where':{'id':_0x149ebd[_0x4029('0x43')]['id']}},_0x247d95={};_0x247d95[_0x4029('0x2b')]=_[_0x4029('0x2c')](db[_0x4029('0x28')][_0x4029('0x44')]);_0x247d95[_0x4029('0x2d')]=_['keys'](_0x149ebd['query']);_0x247d95[_0x4029('0x36')]=_[_0x4029('0x2e')](_0x247d95[_0x4029('0x2b')],_0x247d95['query']);_0x162436[_0x4029('0x2f')]=_[_0x4029('0x2e')](_0x247d95[_0x4029('0x2b')],qs['fields'](_0x149ebd[_0x4029('0x2d')][_0x4029('0x30')]));_0x162436[_0x4029('0x2f')]=_0x162436[_0x4029('0x2f')][_0x4029('0x31')]?_0x162436[_0x4029('0x2f')]:_0x247d95[_0x4029('0x2b')];if(_0x149ebd[_0x4029('0x2d')]['includeAll']){_0x162436[_0x4029('0x3e')]=[{'all':!![]}];}_0x162436=_[_0x4029('0x39')]({},_0x162436,_0x149ebd[_0x4029('0x3b')]);return db['CmCustomField'][_0x4029('0x45')](_0x162436)[_0x4029('0x23')](handleEntityNotFound(_0x299f2f,null))[_0x4029('0x23')](respondWithResult(_0x299f2f,null))['catch'](handleError(_0x299f2f,null));};exports[_0x4029('0x21')]=function(_0x593cf0,_0x457876){if(_0x593cf0[_0x4029('0x46')]['id']){delete _0x593cf0[_0x4029('0x46')]['id'];}return db[_0x4029('0x28')]['find']({'where':{'id':_0x593cf0[_0x4029('0x43')]['id']}})[_0x4029('0x23')](handleEntityNotFound(_0x457876,null))[_0x4029('0x23')](saveUpdates(_0x593cf0[_0x4029('0x46')],null))[_0x4029('0x23')](respondWithResult(_0x457876,null))[_0x4029('0x41')](handleError(_0x457876,null));};exports[_0x4029('0x22')]=function(_0x2627b5,_0x1103a5){return db[_0x4029('0x28')][_0x4029('0x45')]({'where':{'id':_0x2627b5[_0x4029('0x43')]['id']}})[_0x4029('0x23')](handleEntityNotFound(_0x1103a5,null))[_0x4029('0x23')](removeEntity(_0x1103a5,null))[_0x4029('0x41')](handleError(_0x1103a5,null));};exports[_0x4029('0x47')]=function(_0x41443c,_0x380193){var _0x18a746;return db[_0x4029('0x48')][_0x4029('0x49')](function(_0x366c14){return db[_0x4029('0x28')][_0x4029('0x47')](_0x41443c[_0x4029('0x46')],{'transaction':_0x366c14})[_0x4029('0x23')](function(_0x1d8a56){_0x18a746=_0x1d8a56;var _0x3164d8={'type':db['Sequelize'][_0x4029('0x4a')],'transaction':_0x366c14};switch(_0x41443c['body'][_0x4029('0x29')]){case'text':_0x3164d8['type']=db[_0x4029('0x4b')]['TEXT'];break;case _0x4029('0x4c'):_0x3164d8[_0x4029('0x29')]=db[_0x4029('0x4b')][_0x4029('0x4d')];break;case _0x4029('0x4e'):_0x3164d8[_0x4029('0x29')]=db[_0x4029('0x4b')]['BOOLEAN'];_0x3164d8[_0x4029('0x4f')]=![];break;default:}return db[_0x4029('0x48')][_0x4029('0x50')][_0x4029('0x51')](_0x4029('0x52'),util['format'](_0x4029('0x53'),_0x18a746['id']),_0x3164d8);})['then'](function(){return _0x18a746;});})[_0x4029('0x23')](respondWithResult(_0x380193,0xc9))[_0x4029('0x41')](handleError(_0x380193,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7c479df..7f815fe 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 _0x6256=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment'];(function(_0x5db4c4,_0x2a8ced){var _0x5c32a0=function(_0x7b7ee5){while(--_0x7b7ee5){_0x5db4c4['push'](_0x5db4c4['shift']());}};_0x5c32a0(++_0x2a8ced);}(_0x6256,0x17c));var _0x6625=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x6256[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x6625('0x0'));var util=require(_0x6625('0x1'));var logger=require(_0x6625('0x2'))('api');var moment=require(_0x6625('0x3'));var BPromise=require(_0x6625('0x4'));var rp=require(_0x6625('0x5'));var fs=require('fs');var path=require(_0x6625('0x6'));var rimraf=require('rimraf');var config=require(_0x6625('0x7'));var attributes=require(_0x6625('0x8'));module['exports']=function(_0x2fa55d,_0x59d061){return _0x2fa55d[_0x6625('0x9')](_0x6625('0xa'),attributes,{'tableName':_0x6625('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa15=['api','moment','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x42dd63,_0x42af83){var _0x15a8a1=function(_0x532f63){while(--_0x532f63){_0x42dd63['push'](_0x42dd63['shift']());}};_0x15a8a1(++_0x42af83);}(_0xaa15,0xc9));var _0x5aa1=function(_0x1137ec,_0x2cd0b5){_0x1137ec=_0x1137ec-0x0;var _0x41dae3=_0xaa15[_0x1137ec];return _0x41dae3;};'use strict';var _=require(_0x5aa1('0x0'));var util=require(_0x5aa1('0x1'));var logger=require(_0x5aa1('0x2'))(_0x5aa1('0x3'));var moment=require(_0x5aa1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aa1('0x5'));var rimraf=require(_0x5aa1('0x6'));var config=require(_0x5aa1('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x5aa1('0x8')]=function(_0x51adad,_0x45e7ba){return _0x51adad[_0x5aa1('0x9')](_0x5aa1('0xa'),attributes,{'tableName':_0x5aa1('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 522f4e5..220136e 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 _0x0d7e=['jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x0d7e,0x167));var _0xe0d7=function(_0x45df9a,_0xfb0576){_0x45df9a=_0x45df9a-0x0;var _0x3023e8=_0x0d7e[_0x45df9a];return _0x3023e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0d7('0x0'));var BPromise=require(_0xe0d7('0x1'));var rs=require(_0xe0d7('0x2'));var fs=require('fs');var Redis=require(_0xe0d7('0x3'));var db=require(_0xe0d7('0x4'))['db'];var utils=require(_0xe0d7('0x5'));var logger=require(_0xe0d7('0x6'))(_0xe0d7('0x7'));var config=require(_0xe0d7('0x8'));var jayson=require(_0xe0d7('0x9'));var client=jayson[_0xe0d7('0xa')][_0xe0d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d3c7,_0x2afd10,_0x5b38e8){return new BPromise(function(_0x46e9fc,_0x4aebcb){return client[_0xe0d7('0xc')](_0x32d3c7,_0x5b38e8)[_0xe0d7('0xd')](function(_0x58271f){logger[_0xe0d7('0xe')](_0xe0d7('0xf'),_0x2afd10,'request\x20sent');logger[_0xe0d7('0x10')](_0xe0d7('0x11'),_0x2afd10,'request\x20sent',JSON[_0xe0d7('0x12')](_0x58271f));if(_0x58271f[_0xe0d7('0x13')]){if(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x14')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x2afd10,_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);return _0x4aebcb(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);}logger[_0xe0d7('0x13')](_0xe0d7('0xf'),_0x2afd10,_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);return _0x46e9fc(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);}else{logger[_0xe0d7('0xe')]('CmCustomField,\x20%s,\x20%s',_0x2afd10,'request\x20sent');_0x46e9fc(_0x58271f[_0xe0d7('0x16')][_0xe0d7('0x15')]);}})['catch'](function(_0x1f4dbd){logger['error'](_0xe0d7('0xf'),_0x2afd10,_0x1f4dbd);_0x4aebcb(_0x1f4dbd);});});} \ No newline at end of file +var _0xaa15=['lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xaa15,0xfc));var _0x5aa1=function(_0x1816ea,_0x10978a){_0x1816ea=_0x1816ea-0x0;var _0x369a33=_0xaa15[_0x1816ea];return _0x369a33;};'use strict';var _=require(_0x5aa1('0x0'));var util=require(_0x5aa1('0x1'));var moment=require(_0x5aa1('0x2'));var BPromise=require(_0x5aa1('0x3'));var rs=require(_0x5aa1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aa1('0x5'))('rpc');var config=require(_0x5aa1('0x6'));var jayson=require(_0x5aa1('0x7'));var client=jayson[_0x5aa1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x441fb1,_0xc74bc3,_0x21cce0){return new BPromise(function(_0x320f6c,_0x5308f5){return client[_0x5aa1('0x9')](_0x441fb1,_0x21cce0)['then'](function(_0x86a76a){logger[_0x5aa1('0xa')](_0x5aa1('0xb'),_0xc74bc3,_0x5aa1('0xc'));logger[_0x5aa1('0xd')](_0x5aa1('0xe'),_0xc74bc3,_0x5aa1('0xc'),JSON[_0x5aa1('0xf')](_0x86a76a));if(_0x86a76a[_0x5aa1('0x10')]){if(_0x86a76a['error'][_0x5aa1('0x11')]===0x1f4){logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);return _0x5308f5(_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);}logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);return _0x320f6c(_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);}else{logger[_0x5aa1('0xa')](_0x5aa1('0xb'),_0xc74bc3,_0x5aa1('0xc'));_0x320f6c(_0x86a76a[_0x5aa1('0x13')]['message']);}})[_0x5aa1('0x14')](function(_0x15ed7a){logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x15ed7a);_0x5308f5(_0x15ed7a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 25d2c2a..2cdc145 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 _0x5687=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x3ae5fd,_0x206748){var _0x4609f1=function(_0x9884ce){while(--_0x9884ce){_0x3ae5fd['push'](_0x3ae5fd['shift']());}};_0x4609f1(++_0x206748);}(_0x5687,0x1ce));var _0x7568=function(_0x19f59c,_0x4c62c6){_0x19f59c=_0x19f59c-0x0;var _0x4d6cc6=_0x5687[_0x19f59c];return _0x4d6cc6;};'use strict';var multer=require(_0x7568('0x0'));var util=require(_0x7568('0x1'));var path=require(_0x7568('0x2'));var timeout=require(_0x7568('0x3'));var express=require(_0x7568('0x4'));var router=express[_0x7568('0x5')]();var fs_extra=require(_0x7568('0x6'));var auth=require(_0x7568('0x7'));var interaction=require(_0x7568('0x8'));var config=require('../../config/environment');var controller=require(_0x7568('0x9'));router[_0x7568('0xa')]('/',auth[_0x7568('0xb')](),controller[_0x7568('0xc')]);router['get'](_0x7568('0xd'),auth[_0x7568('0xb')](),controller['show']);router[_0x7568('0xe')]('/',auth['isAuthenticated'](),controller[_0x7568('0xf')]);router['put'](_0x7568('0xd'),auth[_0x7568('0xb')](),controller[_0x7568('0x10')]);router[_0x7568('0x11')](_0x7568('0xd'),auth[_0x7568('0xb')](),controller[_0x7568('0x12')]);module[_0x7568('0x13')]=router; \ No newline at end of file +var _0xac39=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','update','destroy','exports','multer'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xac39,0x11c));var _0x9ac3=function(_0x300090,_0x3ae21d){_0x300090=_0x300090-0x0;var _0xf93823=_0xac39[_0x300090];return _0xf93823;};'use strict';var multer=require(_0x9ac3('0x0'));var util=require(_0x9ac3('0x1'));var path=require(_0x9ac3('0x2'));var timeout=require(_0x9ac3('0x3'));var express=require(_0x9ac3('0x4'));var router=express[_0x9ac3('0x5')]();var fs_extra=require(_0x9ac3('0x6'));var auth=require(_0x9ac3('0x7'));var interaction=require(_0x9ac3('0x8'));var config=require(_0x9ac3('0x9'));var controller=require(_0x9ac3('0xa'));router[_0x9ac3('0xb')]('/',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xd')]);router[_0x9ac3('0xb')]('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xe')]);router[_0x9ac3('0xf')]('/',auth[_0x9ac3('0xc')](),controller['create']);router['put']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x10')]);router['delete']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x11')]);module[_0x9ac3('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7877b52..8bf05af 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 _0xd76d=['INTEGER','UNSIGNED','contactListQueue','STRING','moment','sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x167d22,_0x14553d){var _0x2901ab=function(_0x575b81){while(--_0x575b81){_0x167d22['push'](_0x167d22['shift']());}};_0x2901ab(++_0x14553d);}(_0xd76d,0x90));var _0xdd76=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0xd76d[_0x5426e2];return _0x920dc;};'use strict';var moment=require(_0xdd76('0x0'));var Sequelize=require(_0xdd76('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdd76('0x3')],'defaultValue':moment()[_0xdd76('0x4')](_0xdd76('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd76('0x3')]},'priority':{'type':Sequelize[_0xdd76('0x6')](0x2)[_0xdd76('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdd76('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdd76('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xdd76('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xdd76('0x6')],'unique':_0xdd76('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdd76('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdd76('0x9')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdd76('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xeb01=['moment','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','DATE'];(function(_0x10bbf3,_0xde620a){var _0x13e422=function(_0x578026){while(--_0x578026){_0x10bbf3['push'](_0x10bbf3['shift']());}};_0x13e422(++_0xde620a);}(_0xeb01,0x1d0));var _0x1eb0=function(_0x116b06,_0x89886f){_0x116b06=_0x116b06-0x0;var _0xa66abd=_0xeb01[_0x116b06];return _0xa66abd;};'use strict';var moment=require(_0x1eb0('0x0'));var Sequelize=require('sequelize');module[_0x1eb0('0x1')]={'phone':{'type':Sequelize[_0x1eb0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x1eb0('0x4'))},'countbusyretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'ListId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'UserId':{'type':Sequelize[_0x1eb0('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'CampaignId':{'type':Sequelize[_0x1eb0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x1eb0('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9fa2a0d..6d00b95 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 _0x0bde=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','CmHopper','rows','show','params','options','catch','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','deletedat','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','scheduledat','getOpenContacts','outbound','preview','format','YYYY-MM-DD\x20HH:mm:ss','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var _=require(_0xe0bd('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xe0bd('0x1'))(_0xe0bd('0x2'));var shared=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];function respondWithResult(_0x2da4bd,_0x5541b9){_0x5541b9=_0x5541b9||0xc8;return function(_0x34df88){if(_0x34df88){return _0x2da4bd[_0xe0bd('0x5')](_0x5541b9)[_0xe0bd('0x6')](_0x34df88);}};}function respondWithFilteredResult(_0x3b712a,_0x22bfd1){return function(_0x26393f){if(_0x26393f){var _0x217145=typeof _0x22bfd1['offset']===_0xe0bd('0x7')&&typeof _0x22bfd1[_0xe0bd('0x8')]===_0xe0bd('0x7');var _0x2d32c6=_0x26393f[_0xe0bd('0x9')];var _0x3c47c4=_0x217145?0x0:_0x22bfd1[_0xe0bd('0xa')];var _0x58d892=_0x217145?_0x26393f['count']:_0x22bfd1['offset']+_0x22bfd1['limit'];var _0x44ffa9;if(_0x58d892>=_0x2d32c6){_0x58d892=_0x2d32c6;_0x44ffa9=0xc8;}else{_0x44ffa9=0xce;}_0x3b712a['status'](_0x44ffa9);return _0x3b712a['set'](_0xe0bd('0xb'),_0x3c47c4+'-'+_0x58d892+'/'+_0x2d32c6)[_0xe0bd('0x6')](_0x26393f);}return null;};}function saveUpdates(_0x54d40e,_0xc492b4){return function(_0x5272ca){if(_0x5272ca){return _0x5272ca[_0xe0bd('0xc')](_0x54d40e)[_0xe0bd('0xd')](function(_0x3b2fb1){return _0x3b2fb1;});}return null;};}function handleEntityNotFound(_0x20ab47,_0x47664e){return function(_0x335f17){if(!_0x335f17){_0x20ab47[_0xe0bd('0xe')](0x194);}return _0x335f17;};}function handleError(_0x210f20,_0x4f63fa){_0x4f63fa=_0x4f63fa||0x1f4;return function(_0x50891d){logger['error'](_0x50891d[_0xe0bd('0xf')]);if(_0x50891d[_0xe0bd('0x10')]){delete _0x50891d[_0xe0bd('0x10')];}_0x210f20[_0xe0bd('0x5')](_0x4f63fa)[_0xe0bd('0x11')](_0x50891d);};}exports['index']=function(_0x4ebe7a,_0x1becc8){var _0x4ac920={},_0x4f36f7={},_0x418d64={'count':0x0,'rows':[]};var _0xec158d=_[_0xe0bd('0x12')](db['CmHopper'][_0xe0bd('0x13')],function(_0xe1d808){return{'name':_0xe1d808[_0xe0bd('0x14')],'type':_0xe1d808['type'][_0xe0bd('0x15')]};});_0x4f36f7[_0xe0bd('0x16')]=_[_0xe0bd('0x12')](_0xec158d,'name');_0x4f36f7[_0xe0bd('0x17')]=_[_0xe0bd('0x18')](_0x4ebe7a[_0xe0bd('0x17')]);_0x4f36f7['filters']=_[_0xe0bd('0x19')](_0x4f36f7['model'],_0x4f36f7[_0xe0bd('0x17')]);_0x4f36f7[_0xe0bd('0x1a')]=_['concat'](_0x4f36f7[_0xe0bd('0x1a')],[_0xe0bd('0x1b'),_0xe0bd('0x1c'),_0xe0bd('0x1d'),_0xe0bd('0x1e'),_0xe0bd('0x1f'),_0xe0bd('0x20'),_0xe0bd('0x21'),'$eq','$not',_0xe0bd('0x22'),_0xe0bd('0x23'),'$in','$notIn',_0xe0bd('0x24'),_0xe0bd('0x25'),_0xe0bd('0x26'),_0xe0bd('0x27'),'$like',_0xe0bd('0x28'),'$contains',_0xe0bd('0x29'),_0xe0bd('0x2a')]);_0x4ac920[_0xe0bd('0x2b')]=_[_0xe0bd('0x19')](_0x4f36f7[_0xe0bd('0x16')],qs[_0xe0bd('0x2c')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x2c')]));_0x4ac920[_0xe0bd('0x2b')]=_0x4ac920[_0xe0bd('0x2b')][_0xe0bd('0x2d')]?_0x4ac920[_0xe0bd('0x2b')]:_0x4f36f7[_0xe0bd('0x16')];if(!_0x4ebe7a['query'][_0xe0bd('0x2e')](_0xe0bd('0x2f'))){_0x4ac920[_0xe0bd('0x8')]=qs[_0xe0bd('0x8')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x8')]);_0x4ac920['offset']=qs['offset'](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0xa')]);}_0x4ac920[_0xe0bd('0x30')]=qs[_0xe0bd('0x31')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x31')]);_0x4ac920[_0xe0bd('0x32')]=qs['filters'](_[_0xe0bd('0x33')](_0x4ebe7a[_0xe0bd('0x17')],_0x4f36f7[_0xe0bd('0x1a')]),_0xec158d);if(_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x34')]){_0x4ac920[_0xe0bd('0x32')]=_['merge'](_0x4ac920[_0xe0bd('0x32')],{'$or':_[_0xe0bd('0x12')](_0xec158d,function(_0x24b857){if(_0x24b857[_0xe0bd('0x35')]!==_0xe0bd('0x36')){var _0x5881e5={};_0x5881e5[_0x24b857['name']]={'$like':'%'+_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x34')]+'%'};return _0x5881e5;}})});}_0x4ac920=_[_0xe0bd('0x37')]({},_0x4ac920,_0x4ebe7a['options']);var _0x8a331={'where':_0x4ac920['where']};return db['CmHopper'][_0xe0bd('0x9')](_0x8a331)[_0xe0bd('0xd')](function(_0x4d8695){_0x418d64['count']=_0x4d8695;if(_0x4ebe7a['query'][_0xe0bd('0x38')]){_0x4ac920[_0xe0bd('0x39')]=[{'all':!![]}];}return db[_0xe0bd('0x3a')]['findAll'](_0x4ac920);})[_0xe0bd('0xd')](function(_0x2b4814){_0x418d64[_0xe0bd('0x3b')]=_0x2b4814;return _0x418d64;})['then'](respondWithFilteredResult(_0x1becc8,_0x4ac920))['catch'](handleError(_0x1becc8,null));};exports[_0xe0bd('0x3c')]=function(_0x4e5247,_0x1eba8b){var _0x195f0f={'raw':!![],'where':{'id':_0x4e5247[_0xe0bd('0x3d')]['id']}},_0x5aee49={};_0x5aee49[_0xe0bd('0x16')]=_[_0xe0bd('0x18')](db[_0xe0bd('0x3a')][_0xe0bd('0x13')]);_0x5aee49[_0xe0bd('0x17')]=_[_0xe0bd('0x18')](_0x4e5247['query']);_0x5aee49[_0xe0bd('0x1a')]=_[_0xe0bd('0x19')](_0x5aee49[_0xe0bd('0x16')],_0x5aee49[_0xe0bd('0x17')]);_0x195f0f[_0xe0bd('0x2b')]=_['intersection'](_0x5aee49['model'],qs['fields'](_0x4e5247[_0xe0bd('0x17')][_0xe0bd('0x2c')]));_0x195f0f[_0xe0bd('0x2b')]=_0x195f0f[_0xe0bd('0x2b')]['length']?_0x195f0f['attributes']:_0x5aee49[_0xe0bd('0x16')];if(_0x4e5247[_0xe0bd('0x17')][_0xe0bd('0x38')]){_0x195f0f[_0xe0bd('0x39')]=[{'all':!![]}];}_0x195f0f=_[_0xe0bd('0x37')]({},_0x195f0f,_0x4e5247[_0xe0bd('0x3e')]);return db[_0xe0bd('0x3a')]['find'](_0x195f0f)[_0xe0bd('0xd')](handleEntityNotFound(_0x1eba8b,null))['then'](respondWithResult(_0x1eba8b,null))[_0xe0bd('0x3f')](handleError(_0x1eba8b,null));};exports[_0xe0bd('0x40')]=function(_0x507876,_0x4cfad0){return db[_0xe0bd('0x3a')][_0xe0bd('0x40')](_0x507876[_0xe0bd('0x41')],{})[_0xe0bd('0xd')](respondWithResult(_0x4cfad0,0xc9))[_0xe0bd('0x3f')](handleError(_0x4cfad0,null));};exports[_0xe0bd('0xc')]=function(_0x368549,_0x37f9ea){if(_0x368549[_0xe0bd('0x41')]['id']){delete _0x368549['body']['id'];}return db[_0xe0bd('0x3a')][_0xe0bd('0x42')]({'where':{'id':_0x368549[_0xe0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x37f9ea,null))[_0xe0bd('0xd')](saveUpdates(_0x368549[_0xe0bd('0x41')],null))['then'](respondWithResult(_0x37f9ea,null))[_0xe0bd('0x3f')](handleError(_0x37f9ea,null));};exports[_0xe0bd('0x43')]=function(_0x578792,_0xd14c1d){return db[_0xe0bd('0x3a')][_0xe0bd('0x43')]()['then'](respondWithResult(_0xd14c1d,null))[_0xe0bd('0x3f')](handleError(_0xd14c1d,null));};exports[_0xe0bd('0x44')]=function(_0x147438,_0x21ae20){var _0x119d5c;var _0x2eff0d=_0x147438[_0xe0bd('0x3d')]['id'];return db[_0xe0bd('0x3a')][_0xe0bd('0x42')]({'where':{'id':_0x147438['params']['id']}})['then'](handleEntityNotFound(_0x21ae20,null))['then'](function(_0x43b646){if(_0x43b646){return _0x43b646[_0xe0bd('0x44')]()['then'](function(_0xacd120){return _0xacd120;});}})[_0xe0bd('0xd')](function(_0x1ab9b0){_0x119d5c=_0x1ab9b0;if(_0x1ab9b0){if(_0x1ab9b0[_0xe0bd('0x45')]||_0x1ab9b0[_0xe0bd('0x46')]){return db[_0x1ab9b0[_0xe0bd('0x45')]?_0xe0bd('0x47'):_0xe0bd('0x48')][_0xe0bd('0x42')]({'where':{'id':_0x1ab9b0[_0xe0bd('0x45')]?_0x1ab9b0['VoiceQueueId']:_0x1ab9b0[_0xe0bd('0x46')]},'attributes':['id',_0xe0bd('0x10')],'raw':!![]});}}})[_0xe0bd('0xd')](function(_0x52573c){var _0x16dda5={};if(_0x52573c){_[_0xe0bd('0x37')](_0x16dda5,_[_0xe0bd('0x49')](_0x119d5c[_0xe0bd('0x4a')],[_0xe0bd('0x4b'),_0xe0bd('0x4c'),'id']));_0x16dda5[_0xe0bd('0x4d')]=0x15;_0x16dda5[_0xe0bd('0x4e')]=_0xe0bd('0x4f');_0x16dda5['campaign']=_0x52573c[_0xe0bd('0x10')];_0x16dda5[_0xe0bd('0x50')]=_0x147438[_0xe0bd('0x51')][_0xe0bd('0x10')];_0x16dda5['UserId']=_0x147438[_0xe0bd('0x51')]['id'];_0x16dda5[_0xe0bd('0x4f')]=!![];_0x16dda5[_0xe0bd('0x52')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x16dda5[_0xe0bd('0x53')]=_0x119d5c[_0xe0bd('0x54')];_0x16dda5['campaigntype']=_0x119d5c[_0xe0bd('0x45')]?_0xe0bd('0x55'):_0xe0bd('0x56');return db[_0xe0bd('0x57')]['find']({'where':{'id':_0x16dda5[_0xe0bd('0x58')]},'attributes':[_0xe0bd('0x59'),_0xe0bd('0x5a')]})[_0xe0bd('0xd')](function(_0x373846){if(!_[_0xe0bd('0x5b')](_0x21ae20)&&!_[_0xe0bd('0x5b')](_0x373846['firstName'])){_0x16dda5[_0xe0bd('0x5c')]=_0x373846[_0xe0bd('0x59')];if(!_[_0xe0bd('0x5b')](_0x373846[_0xe0bd('0x5a')])){_0x16dda5[_0xe0bd('0x5c')]+='\x20'+_0x373846[_0xe0bd('0x5a')];}}})[_0xe0bd('0x5d')](function(){return db[_0xe0bd('0x5e')][_0xe0bd('0x40')](_0x16dda5);});}})[_0xe0bd('0xd')](function(_0x29b248){return db[_0xe0bd('0x5f')][_0xe0bd('0x44')]({'where':{'CmHopperId':_0x2eff0d}});})[_0xe0bd('0xd')](function(){return _0x21ae20[_0xe0bd('0x5')](0xcc)[_0xe0bd('0x60')]();})[_0xe0bd('0x3f')](handleError(_0x21ae20,null));};exports[_0xe0bd('0x61')]=function(_0x178398,_0x8e61d6){var _0x9d03de=[];return db[_0xe0bd('0x57')][_0xe0bd('0x43')]()['then'](function(_0x4b461a){_0x9d03de=_[_0xe0bd('0x18')](_0x4b461a);return _0x178398[_0xe0bd('0x51')][_0xe0bd('0x62')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0xe0bd('0x63')],'raw':!![]});})[_0xe0bd('0xd')](function(_0x4dfd2a){if(_0x4dfd2a&&_0x4dfd2a[_0xe0bd('0x2d')]){return db['sequelize'][_0xe0bd('0x64')](function(_0x2ede67){var _0x14bbeb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x4dfd2a,'id')},'$or':[{'UserId':null},{'UserId':_0x178398[_0xe0bd('0x51')]['id']}]};var _0x1c9407={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4dfd2a)[_0xe0bd('0x34')]([_0xe0bd('0x63'),0x0])[_0xe0bd('0x12')]('id')[_0xe0bd('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x178398['user']['id']}]};var _0x338028={'$or':[_0x14bbeb,_0x1c9407]};var _0x40a584=[];if(_0x178398['body'][_0xe0bd('0x66')]&&_0x178398[_0xe0bd('0x41')][_0xe0bd('0x66')]===_0xe0bd('0x67')){if(!_[_0xe0bd('0x68')](_0x178398[_0xe0bd('0x41')][_0xe0bd('0x69')])){_0x338028['id']={'$in':_0x178398[_0xe0bd('0x41')]['hopperIds']};}_0x40a584=[[_0xe0bd('0x6a'),_0xe0bd('0x6b')],[_0xe0bd('0x6c'),_0x4dfd2a[0x0]['dialOrderByScheduledAt']===_0xe0bd('0x6b')?_0xe0bd('0x6d'):_0xe0bd('0x6b')],db[_0xe0bd('0x6e')]['literal'](_0xe0bd('0x6f')),['id',_0xe0bd('0x6d')]];}else{if(!_[_0xe0bd('0x68')](_0x178398['body'][_0xe0bd('0x69')])){_0x338028['id']={'$notIn':_0x178398[_0xe0bd('0x41')][_0xe0bd('0x69')]};}_0x40a584=[['priority',_0xe0bd('0x6d')],['scheduledAt',_0x4dfd2a[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe0bd('0x70')](_0xe0bd('0x71')),['id',_0xe0bd('0x6b')]];}return db[_0xe0bd('0x3a')]['findOne']({'attributes':['id','scheduledat',_0xe0bd('0x54'),_0xe0bd('0x72')],'where':_0x338028,'order':_0x40a584,'transaction':_0x2ede67,'lock':_0x2ede67[_0xe0bd('0x73')][_0xe0bd('0x74')],'include':[{'model':db[_0xe0bd('0x57')],'as':_0xe0bd('0x75'),'attributes':_0x9d03de,'include':[{'model':db[_0xe0bd('0x76')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x10')]}]},{'model':db[_0xe0bd('0x78')],'as':'List','attributes':['id',_0xe0bd('0x10')]},{'model':db['VoiceQueue'],'as':_0xe0bd('0x79'),'attributes':['id',_0xe0bd('0x10'),_0xe0bd('0x7a')]}]})[_0xe0bd('0xd')](function(_0x191423){if(_0x191423){return _0x191423[_0xe0bd('0xc')]({'UserId':_0x178398[_0xe0bd('0x51')]['id']},{'transaction':_0x2ede67});}});});}})['then'](handleEntityNotFound(_0x8e61d6,null))[_0xe0bd('0xd')](respondWithResult(_0x8e61d6,null))[_0xe0bd('0x3f')](handleError(_0x8e61d6,null));};exports['getPreviewRecall']=function(_0x4303ec,_0x2acb14,_0x1f230d){var _0x4fb0cb=[];var _0x5991e5=_0x4303ec[_0xe0bd('0x3d')]['id'];var _0x1cc0dd=_0x4303ec['user']['id'];return db[_0xe0bd('0x57')][_0xe0bd('0x43')]()['then'](function(_0x485bde){_0x4fb0cb=_[_0xe0bd('0x18')](_0x485bde);return db[_0xe0bd('0x6e')][_0xe0bd('0x64')](function(_0x6e9712){const _0x4e3815={'id':_0x5991e5};return db[_0xe0bd('0x3a')]['findOne']({'attributes':['id',_0xe0bd('0x7b'),_0xe0bd('0x72')],'where':_0x4e3815,'transaction':_0x6e9712,'lock':_0x6e9712[_0xe0bd('0x73')][_0xe0bd('0x74')],'include':[{'model':db[_0xe0bd('0x57')],'as':_0xe0bd('0x75'),'attributes':_0x4fb0cb,'include':[{'model':db[_0xe0bd('0x76')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x10')]}]},{'model':db[_0xe0bd('0x78')],'as':'List','attributes':['id',_0xe0bd('0x10')]},{'model':db[_0xe0bd('0x47')],'as':_0xe0bd('0x79'),'attributes':['id','name',_0xe0bd('0x7a')]}]})[_0xe0bd('0xd')](function(_0x6a6012){if(_0x6a6012){return _0x6a6012[_0xe0bd('0xc')]({'UserId':_0x1cc0dd},{'transaction':_0x6e9712});}});});})[_0xe0bd('0xd')](handleEntityNotFound(_0x2acb14,null))[_0xe0bd('0xd')](respondWithResult(_0x2acb14,null))['catch'](handleError(_0x2acb14,null));};exports[_0xe0bd('0x7c')]=function(_0x378034,_0x17435d){return _0x378034[_0xe0bd('0x51')]['getVoiceQueues']({'where':{'type':_0xe0bd('0x7d'),'dialActive':!![],'dialMethod':_0xe0bd('0x7e')},'attributes':['id'],'raw':!![]})[_0xe0bd('0xd')](function(_0x3fb7f9){if(_0x3fb7f9&&_0x3fb7f9[_0xe0bd('0x2d')]){return db['CmHopper'][_0xe0bd('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x7f')](_0xe0bd('0x80'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x12')](_0x3fb7f9,'id')},'$or':[{'UserId':null},{'UserId':_0x378034[_0xe0bd('0x51')]['id']}]}});}return 0x0;})[_0xe0bd('0xd')](function(_0x3a82a5){if(!_[_0xe0bd('0x5b')](_0x3a82a5)&&_[_0xe0bd('0x81')](_0x3a82a5)){return _0x17435d[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'contacts':_0x3a82a5});}else{logger[_0xe0bd('0x82')](_0xe0bd('0x83'),_0xe0bd('0x7c'),0x194,_0xe0bd('0x84'));_0x17435d[_0xe0bd('0xe')](0x194);}})[_0xe0bd('0x3f')](handleError(_0x17435d,null));};exports[_0xe0bd('0x85')]=function(_0x5a9a57,_0x9b312e){var _0x36ca72=shared[_0xe0bd('0x86')];var _0x52287d=[];_[_0xe0bd('0x12')](_0x36ca72,function(_0x1ae29c){_0x52287d[_0xe0bd('0x87')]({'id':_0x1ae29c[_0xe0bd('0x10')],'name':_0x1ae29c[_0xe0bd('0x10')],'utcOffset':_0x1ae29c[_0xe0bd('0x88')]});});return _0x9b312e[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'tz':_0x52287d});};exports[_0xe0bd('0x89')]=function(_0x531f39,_0x52a859){var _0x4e9fe0=shared[_0xe0bd('0x86')];var _0x42b1b4={};if(!_[_0xe0bd('0x5b')](_0x4e9fe0[_0x531f39['body']['id']]))_0x42b1b4=_0x4e9fe0[_0x531f39[_0xe0bd('0x41')]['id']];return _0x52a859[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')](_0x42b1b4);}; \ No newline at end of file +var _0xfc76=['destroy','end','getPreview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','List','dialActive','getPreviewRecall','transaction','Company','CmList','Queue','getOpenContacts','getVoiceQueues','outbound','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','timezones','json','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','index','map','CmHopper','rawAttributes','fieldName','key','model','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfc76,0xb5));var _0x6fc7=function(_0x19221b,_0x5cb19b){_0x19221b=_0x19221b-0x0;var _0x110b8c=_0xfc76[_0x19221b];return _0x110b8c;};'use strict';var moment=require('moment');var _=require(_0x6fc7('0x0'));var qs=require(_0x6fc7('0x1'));var logger=require(_0x6fc7('0x2'))(_0x6fc7('0x3'));var shared=require(_0x6fc7('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x316cc4,_0x40d212){_0x40d212=_0x40d212||0xc8;return function(_0x51280c){if(_0x51280c){return _0x316cc4[_0x6fc7('0x5')](_0x40d212)['json'](_0x51280c);}};}function respondWithFilteredResult(_0xe8177b,_0x82a35a){return function(_0x385a5a){if(_0x385a5a){var _0x4da7c3=typeof _0x82a35a[_0x6fc7('0x6')]===_0x6fc7('0x7')&&typeof _0x82a35a[_0x6fc7('0x8')]===_0x6fc7('0x7');var _0x36cb16=_0x385a5a[_0x6fc7('0x9')];var _0x4de75e=_0x4da7c3?0x0:_0x82a35a[_0x6fc7('0x6')];var _0x61730a=_0x4da7c3?_0x385a5a[_0x6fc7('0x9')]:_0x82a35a[_0x6fc7('0x6')]+_0x82a35a[_0x6fc7('0x8')];var _0x3c067c;if(_0x61730a>=_0x36cb16){_0x61730a=_0x36cb16;_0x3c067c=0xc8;}else{_0x3c067c=0xce;}_0xe8177b['status'](_0x3c067c);return _0xe8177b[_0x6fc7('0xa')](_0x6fc7('0xb'),_0x4de75e+'-'+_0x61730a+'/'+_0x36cb16)['json'](_0x385a5a);}return null;};}function saveUpdates(_0x433adc,_0x2c32b8){return function(_0x5f438d){if(_0x5f438d){return _0x5f438d[_0x6fc7('0xc')](_0x433adc)[_0x6fc7('0xd')](function(_0x4af729){return _0x4af729;});}return null;};}function handleEntityNotFound(_0x44d8e0,_0x3c107f){return function(_0x10a482){if(!_0x10a482){_0x44d8e0['sendStatus'](0x194);}return _0x10a482;};}function handleError(_0x556e28,_0xbb4a3e){_0xbb4a3e=_0xbb4a3e||0x1f4;return function(_0x45d585){logger['error'](_0x45d585[_0x6fc7('0xe')]);if(_0x45d585[_0x6fc7('0xf')]){delete _0x45d585[_0x6fc7('0xf')];}_0x556e28[_0x6fc7('0x5')](_0xbb4a3e)['send'](_0x45d585);};}exports[_0x6fc7('0x10')]=function(_0x69ea70,_0x280c69){var _0x62ec76={},_0x12be21={},_0x4258f0={'count':0x0,'rows':[]};var _0x59bb98=_[_0x6fc7('0x11')](db[_0x6fc7('0x12')][_0x6fc7('0x13')],function(_0x3bd771){return{'name':_0x3bd771[_0x6fc7('0x14')],'type':_0x3bd771['type'][_0x6fc7('0x15')]};});_0x12be21[_0x6fc7('0x16')]=_['map'](_0x59bb98,_0x6fc7('0xf'));_0x12be21['query']=_[_0x6fc7('0x17')](_0x69ea70['query']);_0x12be21[_0x6fc7('0x18')]=_[_0x6fc7('0x19')](_0x12be21[_0x6fc7('0x16')],_0x12be21['query']);_0x12be21[_0x6fc7('0x18')]=_['concat'](_0x12be21[_0x6fc7('0x18')],[_0x6fc7('0x1a'),_0x6fc7('0x1b'),_0x6fc7('0x1c'),_0x6fc7('0x1d'),_0x6fc7('0x1e'),_0x6fc7('0x1f'),_0x6fc7('0x20'),_0x6fc7('0x21'),_0x6fc7('0x22'),_0x6fc7('0x23'),_0x6fc7('0x24'),_0x6fc7('0x25'),_0x6fc7('0x26'),_0x6fc7('0x27'),'$notLike',_0x6fc7('0x28'),_0x6fc7('0x29'),_0x6fc7('0x27'),_0x6fc7('0x2a'),'$contains',_0x6fc7('0x2b'),_0x6fc7('0x2c')]);_0x62ec76[_0x6fc7('0x2d')]=_[_0x6fc7('0x19')](_0x12be21[_0x6fc7('0x16')],qs[_0x6fc7('0x2e')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x2e')]));_0x62ec76['attributes']=_0x62ec76['attributes'][_0x6fc7('0x30')]?_0x62ec76[_0x6fc7('0x2d')]:_0x12be21[_0x6fc7('0x16')];if(!_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x31')](_0x6fc7('0x32'))){_0x62ec76['limit']=qs[_0x6fc7('0x8')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x8')]);_0x62ec76[_0x6fc7('0x6')]=qs['offset'](_0x69ea70['query']['offset']);}_0x62ec76[_0x6fc7('0x33')]=qs[_0x6fc7('0x34')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x34')]);_0x62ec76[_0x6fc7('0x35')]=qs[_0x6fc7('0x18')](_[_0x6fc7('0x36')](_0x69ea70[_0x6fc7('0x2f')],_0x12be21[_0x6fc7('0x18')]),_0x59bb98);if(_0x69ea70['query'][_0x6fc7('0x37')]){_0x62ec76['where']=_[_0x6fc7('0x38')](_0x62ec76[_0x6fc7('0x35')],{'$or':_[_0x6fc7('0x11')](_0x59bb98,function(_0x24bb23){if(_0x24bb23['type']!==_0x6fc7('0x39')){var _0x3245a8={};_0x3245a8[_0x24bb23[_0x6fc7('0xf')]]={'$like':'%'+_0x69ea70[_0x6fc7('0x2f')]['filter']+'%'};return _0x3245a8;}})});}_0x62ec76=_[_0x6fc7('0x38')]({},_0x62ec76,_0x69ea70['options']);var _0xec700a={'where':_0x62ec76['where']};return db['CmHopper']['count'](_0xec700a)[_0x6fc7('0xd')](function(_0x516580){_0x4258f0[_0x6fc7('0x9')]=_0x516580;if(_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x3a')]){_0x62ec76[_0x6fc7('0x3b')]=[{'all':!![]}];}return db[_0x6fc7('0x12')][_0x6fc7('0x3c')](_0x62ec76);})[_0x6fc7('0xd')](function(_0x2990af){_0x4258f0[_0x6fc7('0x3d')]=_0x2990af;return _0x4258f0;})[_0x6fc7('0xd')](respondWithFilteredResult(_0x280c69,_0x62ec76))[_0x6fc7('0x3e')](handleError(_0x280c69,null));};exports[_0x6fc7('0x3f')]=function(_0x3c652e,_0xe46d5){var _0x3ac76e={'raw':!![],'where':{'id':_0x3c652e[_0x6fc7('0x40')]['id']}},_0x3be13b={};_0x3be13b[_0x6fc7('0x16')]=_['keys'](db['CmHopper'][_0x6fc7('0x13')]);_0x3be13b[_0x6fc7('0x2f')]=_[_0x6fc7('0x17')](_0x3c652e[_0x6fc7('0x2f')]);_0x3be13b['filters']=_[_0x6fc7('0x19')](_0x3be13b[_0x6fc7('0x16')],_0x3be13b[_0x6fc7('0x2f')]);_0x3ac76e[_0x6fc7('0x2d')]=_[_0x6fc7('0x19')](_0x3be13b[_0x6fc7('0x16')],qs[_0x6fc7('0x2e')](_0x3c652e[_0x6fc7('0x2f')][_0x6fc7('0x2e')]));_0x3ac76e[_0x6fc7('0x2d')]=_0x3ac76e[_0x6fc7('0x2d')][_0x6fc7('0x30')]?_0x3ac76e['attributes']:_0x3be13b[_0x6fc7('0x16')];if(_0x3c652e[_0x6fc7('0x2f')]['includeAll']){_0x3ac76e[_0x6fc7('0x3b')]=[{'all':!![]}];}_0x3ac76e=_[_0x6fc7('0x38')]({},_0x3ac76e,_0x3c652e[_0x6fc7('0x41')]);return db[_0x6fc7('0x12')][_0x6fc7('0x42')](_0x3ac76e)[_0x6fc7('0xd')](handleEntityNotFound(_0xe46d5,null))[_0x6fc7('0xd')](respondWithResult(_0xe46d5,null))[_0x6fc7('0x3e')](handleError(_0xe46d5,null));};exports[_0x6fc7('0x43')]=function(_0x1a727d,_0x49bfe6){return db[_0x6fc7('0x12')][_0x6fc7('0x43')](_0x1a727d['body'],{})['then'](respondWithResult(_0x49bfe6,0xc9))[_0x6fc7('0x3e')](handleError(_0x49bfe6,null));};exports[_0x6fc7('0xc')]=function(_0x4496e4,_0x554a48){if(_0x4496e4[_0x6fc7('0x44')]['id']){delete _0x4496e4[_0x6fc7('0x44')]['id'];}return db['CmHopper'][_0x6fc7('0x42')]({'where':{'id':_0x4496e4[_0x6fc7('0x40')]['id']}})[_0x6fc7('0xd')](handleEntityNotFound(_0x554a48,null))[_0x6fc7('0xd')](saveUpdates(_0x4496e4[_0x6fc7('0x44')],null))[_0x6fc7('0xd')](respondWithResult(_0x554a48,null))[_0x6fc7('0x3e')](handleError(_0x554a48,null));};exports[_0x6fc7('0x45')]=function(_0x357d7a,_0x24df1f){return db[_0x6fc7('0x12')]['describe']()['then'](respondWithResult(_0x24df1f,null))['catch'](handleError(_0x24df1f,null));};exports['destroy']=function(_0x22a0c5,_0x5d4d40){var _0x3357f9;var _0x25e671=_0x22a0c5[_0x6fc7('0x40')]['id'];return db[_0x6fc7('0x12')][_0x6fc7('0x42')]({'where':{'id':_0x22a0c5[_0x6fc7('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d4d40,null))[_0x6fc7('0xd')](function(_0x2ac05d){if(_0x2ac05d){return _0x2ac05d['destroy']()[_0x6fc7('0xd')](function(_0x24bf3e){return _0x24bf3e;});}})[_0x6fc7('0xd')](function(_0x334256){_0x3357f9=_0x334256;if(_0x334256){if(_0x334256[_0x6fc7('0x46')]||_0x334256[_0x6fc7('0x47')]){return db[_0x334256[_0x6fc7('0x46')]?_0x6fc7('0x48'):_0x6fc7('0x49')][_0x6fc7('0x42')]({'where':{'id':_0x334256['VoiceQueueId']?_0x334256[_0x6fc7('0x46')]:_0x334256[_0x6fc7('0x47')]},'attributes':['id',_0x6fc7('0xf')],'raw':!![]});}}})['then'](function(_0x44105e){var _0x4bb441={};if(_0x44105e){_[_0x6fc7('0x38')](_0x4bb441,_['omit'](_0x3357f9[_0x6fc7('0x4a')],[_0x6fc7('0x4b'),_0x6fc7('0x4c'),'id']));_0x4bb441[_0x6fc7('0x4d')]=0x15;_0x4bb441[_0x6fc7('0x4e')]=_0x6fc7('0x4f');_0x4bb441[_0x6fc7('0x50')]=_0x44105e[_0x6fc7('0xf')];_0x4bb441['membername']=_0x22a0c5[_0x6fc7('0x51')][_0x6fc7('0xf')];_0x4bb441[_0x6fc7('0x52')]=_0x22a0c5[_0x6fc7('0x51')]['id'];_0x4bb441[_0x6fc7('0x4f')]=!![];_0x4bb441['deletedat']=moment()[_0x6fc7('0x53')](_0x6fc7('0x54'));_0x4bb441[_0x6fc7('0x55')]=_0x3357f9[_0x6fc7('0x56')];_0x4bb441[_0x6fc7('0x57')]=_0x3357f9[_0x6fc7('0x46')]?_0x6fc7('0x58'):_0x6fc7('0x59');return db[_0x6fc7('0x5a')][_0x6fc7('0x42')]({'where':{'id':_0x4bb441[_0x6fc7('0x5b')]},'attributes':['firstName',_0x6fc7('0x5c')]})[_0x6fc7('0xd')](function(_0x27aa59){if(!_[_0x6fc7('0x5d')](_0x5d4d40)&&!_[_0x6fc7('0x5d')](_0x27aa59[_0x6fc7('0x5e')])){_0x4bb441[_0x6fc7('0x5f')]=_0x27aa59[_0x6fc7('0x5e')];if(!_['isNil'](_0x27aa59[_0x6fc7('0x5c')])){_0x4bb441['calleridname']+='\x20'+_0x27aa59['lastName'];}}})['finally'](function(){return db[_0x6fc7('0x60')][_0x6fc7('0x43')](_0x4bb441);});}})[_0x6fc7('0xd')](function(_0x4a166c){return db['CmHopperAdditionalPhone'][_0x6fc7('0x61')]({'where':{'CmHopperId':_0x25e671}});})['then'](function(){return _0x5d4d40[_0x6fc7('0x5')](0xcc)[_0x6fc7('0x62')]();})[_0x6fc7('0x3e')](handleError(_0x5d4d40,null));};exports[_0x6fc7('0x63')]=function(_0x389b31,_0x376047){var _0x26fb83=[];return db[_0x6fc7('0x5a')][_0x6fc7('0x45')]()[_0x6fc7('0xd')](function(_0x5642df){_0x26fb83=_[_0x6fc7('0x17')](_0x5642df);return _0x389b31[_0x6fc7('0x51')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x6fc7('0x64'),_0x6fc7('0x65')],'raw':!![]});})[_0x6fc7('0xd')](function(_0x2852ff){if(_0x2852ff&&_0x2852ff[_0x6fc7('0x30')]){return db[_0x6fc7('0x66')]['transaction'](function(_0x17c6c5){var _0x33e02b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6fc7('0x11')](_0x2852ff,'id')},'$or':[{'UserId':null},{'UserId':_0x389b31[_0x6fc7('0x51')]['id']}]};var _0xe5c9f0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2852ff)[_0x6fc7('0x37')]([_0x6fc7('0x65'),0x0])[_0x6fc7('0x11')]('id')[_0x6fc7('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x389b31[_0x6fc7('0x51')]['id']}]};var _0x287604={'$or':[_0x33e02b,_0xe5c9f0]};var _0xbeec61=[];if(_0x389b31['body'][_0x6fc7('0x68')]&&_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x68')]==='prev'){if(!_['isEmpty'](_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')])){_0x287604['id']={'$in':_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')]};}_0xbeec61=[[_0x6fc7('0x6a'),_0x6fc7('0x6b')],['scheduledAt',_0x2852ff[0x0][_0x6fc7('0x64')]==='ASC'?_0x6fc7('0x6c'):_0x6fc7('0x6b')],db['sequelize'][_0x6fc7('0x6d')](_0x6fc7('0x6e')),['id',_0x6fc7('0x6c')]];}else{if(!_[_0x6fc7('0x6f')](_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')])){_0x287604['id']={'$notIn':_0x389b31['body']['hopperIds']};}_0xbeec61=[[_0x6fc7('0x6a'),'DESC'],[_0x6fc7('0x70'),_0x2852ff[0x0]['dialOrderByScheduledAt']],db[_0x6fc7('0x66')][_0x6fc7('0x6d')](_0x6fc7('0x71')),['id',_0x6fc7('0x6b')]];}return db[_0x6fc7('0x12')][_0x6fc7('0x72')]({'attributes':['id',_0x6fc7('0x73'),_0x6fc7('0x56'),_0x6fc7('0x74')],'where':_0x287604,'order':_0xbeec61,'transaction':_0x17c6c5,'lock':_0x17c6c5[_0x6fc7('0x75')][_0x6fc7('0x76')],'include':[{'model':db[_0x6fc7('0x5a')],'as':_0x6fc7('0x77'),'attributes':_0x26fb83,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6fc7('0x78'),'attributes':['id',_0x6fc7('0xf')]},{'model':db[_0x6fc7('0x48')],'as':'Queue','attributes':['id','name',_0x6fc7('0x79')]}]})[_0x6fc7('0xd')](function(_0x57c69b){if(_0x57c69b){return _0x57c69b[_0x6fc7('0xc')]({'UserId':_0x389b31[_0x6fc7('0x51')]['id']},{'transaction':_0x17c6c5});}});});}})[_0x6fc7('0xd')](handleEntityNotFound(_0x376047,null))[_0x6fc7('0xd')](respondWithResult(_0x376047,null))['catch'](handleError(_0x376047,null));};exports[_0x6fc7('0x7a')]=function(_0x52873a,_0x52508f,_0xcee3db){var _0x148c69=[];var _0x681873=_0x52873a[_0x6fc7('0x40')]['id'];var _0x5755b6=_0x52873a[_0x6fc7('0x51')]['id'];return db['CmContact']['describe']()[_0x6fc7('0xd')](function(_0x351919){_0x148c69=_[_0x6fc7('0x17')](_0x351919);return db[_0x6fc7('0x66')][_0x6fc7('0x7b')](function(_0x5109b0){const _0x265cb2={'id':_0x681873};return db[_0x6fc7('0x12')][_0x6fc7('0x72')]({'attributes':['id',_0x6fc7('0x73'),'recallme'],'where':_0x265cb2,'transaction':_0x5109b0,'lock':_0x5109b0[_0x6fc7('0x75')][_0x6fc7('0x76')],'include':[{'model':db[_0x6fc7('0x5a')],'as':'Contact','attributes':_0x148c69,'include':[{'model':db['CmCompany'],'as':_0x6fc7('0x7c'),'attributes':['id',_0x6fc7('0xf')]}]},{'model':db[_0x6fc7('0x7d')],'as':_0x6fc7('0x78'),'attributes':['id',_0x6fc7('0xf')]},{'model':db[_0x6fc7('0x48')],'as':_0x6fc7('0x7e'),'attributes':['id',_0x6fc7('0xf'),_0x6fc7('0x79')]}]})[_0x6fc7('0xd')](function(_0x5cdb17){if(_0x5cdb17){return _0x5cdb17[_0x6fc7('0xc')]({'UserId':_0x5755b6},{'transaction':_0x5109b0});}});});})[_0x6fc7('0xd')](handleEntityNotFound(_0x52508f,null))['then'](respondWithResult(_0x52508f,null))[_0x6fc7('0x3e')](handleError(_0x52508f,null));};exports[_0x6fc7('0x7f')]=function(_0xa4384d,_0x17f059){return _0xa4384d['user'][_0x6fc7('0x80')]({'where':{'type':_0x6fc7('0x81'),'dialActive':!![],'dialMethod':_0x6fc7('0x82')},'attributes':['id'],'raw':!![]})[_0x6fc7('0xd')](function(_0x50134d){if(_0x50134d&&_0x50134d[_0x6fc7('0x30')]){return db[_0x6fc7('0x12')][_0x6fc7('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6fc7('0x53')](_0x6fc7('0x54'))},'VoiceQueueId':{'$in':_[_0x6fc7('0x11')](_0x50134d,'id')},'$or':[{'UserId':null},{'UserId':_0xa4384d[_0x6fc7('0x51')]['id']}]}});}return 0x0;})[_0x6fc7('0xd')](function(_0x2716de){if(!_['isNil'](_0x2716de)&&_[_0x6fc7('0x83')](_0x2716de)){return _0x17f059['status'](0xc8)['json']({'contacts':_0x2716de});}else{logger[_0x6fc7('0x84')](_0x6fc7('0x85'),'getOpenContacts',0x194,_0x6fc7('0x86'));_0x17f059[_0x6fc7('0x87')](0x194);}})[_0x6fc7('0x3e')](handleError(_0x17f059,null));};exports['getTimezones']=function(_0x2975d3,_0x29d9bc){var _0x4e34a2=shared[_0x6fc7('0x88')];var _0x209e66=[];_[_0x6fc7('0x11')](_0x4e34a2,function(_0xae380a){_0x209e66['push']({'id':_0xae380a[_0x6fc7('0xf')],'name':_0xae380a[_0x6fc7('0xf')],'utcOffset':_0xae380a['utcOffset']});});return _0x29d9bc['status'](0xc8)[_0x6fc7('0x89')]({'tz':_0x209e66});};exports[_0x6fc7('0x8a')]=function(_0x21fa82,_0x502fe3){var _0x58c6f1=shared[_0x6fc7('0x88')];var _0x40f459={};if(!_[_0x6fc7('0x5d')](_0x58c6f1[_0x21fa82[_0x6fc7('0x44')]['id']]))_0x40f459=_0x58c6f1[_0x21fa82[_0x6fc7('0x44')]['id']];return _0x502fe3['status'](0xc8)['json'](_0x40f459);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a1e691e..fcb3ee8 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x219361,_0xe89c58){var _0x27c488=function(_0xab8dc9){while(--_0xab8dc9){_0x219361['push'](_0x219361['shift']());}};_0x27c488(++_0xe89c58);}(_0x1883,0xab));var _0x3188=function(_0x546108,_0x4d2a3c){_0x546108=_0x546108-0x0;var _0x3278f0=_0x1883[_0x546108];return _0x3278f0;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x25fd12,_0x214bec){var _0x5c629b=function(_0x56e34c){while(--_0x56e34c){_0x25fd12['push'](_0x25fd12['shift']());}};_0x5c629b(++_0x214bec);}(_0x2542,0x169));var _0x2254=function(_0x70dfa,_0x229594){_0x70dfa=_0x70dfa-0x0;var _0x15a6f9=_0x2542[_0x70dfa];return _0x15a6f9;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f7da19d..1d58189 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 _0xbc1b=['YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','UPDATE','CmContact','Contact','User','Agent','name','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x40c9a2,_0x5b6985){var _0xc879f=function(_0x492976){while(--_0x492976){_0x40c9a2['push'](_0x40c9a2['shift']());}};_0xc879f(++_0x5b6985);}(_0xbc1b,0xb6));var _0xbbc1=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xbc1b[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var moment=require(_0xbbc1('0x2'));var BPromise=require(_0xbbc1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xbbc1('0x4'))(_0xbbc1('0x5'));exports[_0xbbc1('0x6')]=function(_0x329a80){var _0x10e61c=this;return new Promise(function(_0x423d3e,_0xd1653b){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x329a80['options']?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')]?_['map'](_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')],function(_0x4434f9){return{'model':db[_0x4434f9[_0xbbc1('0xf')]],'as':_0x4434f9['as'],'attributes':_0x4434f9[_0xbbc1('0xc')],'include':_0x4434f9['include']?_[_0xbbc1('0x10')](_0x4434f9['include'],function(_0x4fc061){return{'model':db[_0x4fc061[_0xbbc1('0xf')]],'as':_0x4fc061['as'],'attributes':_0x4fc061[_0xbbc1('0xc')],'include':_0x4fc061['include']?_[_0xbbc1('0x10')](_0x4fc061[_0xbbc1('0xe')],function(_0x48ef94){return{'model':db[_0x48ef94[_0xbbc1('0xf')]],'as':_0x48ef94['as'],'attributes':_0x48ef94[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x15b7da){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x329a80);logger[_0xbbc1('0x13')](_0xbbc1('0x6'),_0x329a80,JSON[_0xbbc1('0x14')](_0x15b7da));_0x423d3e(_0x15b7da);})[_0xbbc1('0x15')](function(_0xa64ea8){logger['error'](_0xbbc1('0x6'),_0xa64ea8[_0xbbc1('0x16')],_0x329a80);_0xd1653b(_0x10e61c[_0xbbc1('0x17')](0x1f4,_0xa64ea8[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x18')]=function(_0x4a4754){var _0x369bd8=this;return new Promise(function(_0x5f59fc,_0x5d14ee){return db['CmHopper'][_0xbbc1('0x19')]({'raw':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754['options'][_0xbbc1('0xc')]||null:null,'include':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x4a4754[_0xbbc1('0x9')]['include'],function(_0x3d6847){return{'model':db[_0x3d6847[_0xbbc1('0xf')]],'as':_0x3d6847['as'],'attributes':_0x3d6847[_0xbbc1('0xc')],'include':_0x3d6847[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x3d6847[_0xbbc1('0xe')],function(_0x5dfb08){return{'model':db[_0x5dfb08['model']],'as':_0x5dfb08['as'],'attributes':_0x5dfb08[_0xbbc1('0xc')],'include':_0x5dfb08[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x5dfb08[_0xbbc1('0xe')],function(_0x45d1f7){return{'model':db[_0x45d1f7[_0xbbc1('0xf')]],'as':_0x45d1f7['as'],'attributes':_0x45d1f7[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319a3e){logger['info'](_0xbbc1('0x18'),_0x4a4754);logger[_0xbbc1('0x13')]('ShowCmHopper',_0x4a4754,JSON[_0xbbc1('0x14')](_0x319a3e));_0x5f59fc(_0x319a3e);})[_0xbbc1('0x15')](function(_0x4a9750){logger['error']('ShowCmHopper',_0x4a9750['message'],_0x4a4754);_0x5d14ee(_0x369bd8[_0xbbc1('0x17')](0x1f4,_0x4a9750['message']));});});};exports['CreateCmHopper']=function(_0x263cad){var _0x2ce5a0=this;return new Promise(function(_0x1d7321,_0x43c09e){return db['CmHopper'][_0xbbc1('0x1a')](_0x263cad[_0xbbc1('0x1b')],{'raw':_0x263cad['options']?_0x263cad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x15d09e){logger[_0xbbc1('0x12')]('CreateCmHopper',_0x263cad);logger[_0xbbc1('0x13')]('CreateCmHopper',_0x263cad,JSON[_0xbbc1('0x14')](_0x15d09e));_0x1d7321(_0x15d09e);})[_0xbbc1('0x15')](function(_0x13fe0e){logger[_0xbbc1('0x17')](_0xbbc1('0x1c'),_0x13fe0e[_0xbbc1('0x16')],_0x263cad);_0x43c09e(_0x2ce5a0[_0xbbc1('0x17')](0x1f4,_0x13fe0e[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x1d')]=function(_0x2bbb2b){var _0x3a4c10=this;return new Promise(function(_0x9f2c0b,_0x29f62e){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2bbb2b[_0xbbc1('0x1b')],{'raw':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b['options'][_0xbbc1('0xd')]||null:null})['then'](function(_0x36f33c){logger[_0xbbc1('0x12')](_0xbbc1('0x1d'),_0x2bbb2b);logger[_0xbbc1('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2bbb2b['options'][_0xbbc1('0xb')]),_0x2bbb2b[_0xbbc1('0x1b')][_0xbbc1('0x1f')]);logger['debug']('UpdateCmHopper',_0x2bbb2b,JSON[_0xbbc1('0x14')](_0x36f33c));_0x9f2c0b(_0x36f33c);})['catch'](function(_0x118b49){logger[_0xbbc1('0x17')](_0xbbc1('0x1d'),_0x118b49['message'],_0x2bbb2b);_0x29f62e(_0x3a4c10['error'](0x1f4,_0x118b49[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x20')]=function(_0x5f1db){var _0x61fd86=this;return new Promise(function(_0x3acc83,_0x57b149){return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x5f1db[_0xbbc1('0x9')]?_0x5f1db[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null})['then'](function(_0x1cd257){logger[_0xbbc1('0x12')]('DestroyCmHopper',_0x5f1db);logger[_0xbbc1('0x13')](_0xbbc1('0x20'),_0x5f1db,JSON[_0xbbc1('0x14')](_0x1cd257));_0x3acc83(_0x1cd257);})[_0xbbc1('0x15')](function(_0x1c9694){logger[_0xbbc1('0x17')]('DestroyCmHopper',_0x1c9694[_0xbbc1('0x16')],_0x5f1db);_0x57b149(_0x61fd86[_0xbbc1('0x17')](0x1f4,_0x1c9694[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x22')]=function(_0x178580){var _0x3d53a9=this;return new Promise(function(_0x404895,_0x131da3){return db['CmContact'][_0xbbc1('0x23')]()['then'](function(_0x1d8428){return db['sequelize'][_0xbbc1('0x24')](function(_0x9b7c81){return db['CmHopper'][_0xbbc1('0x8')]({'where':_0x178580[_0xbbc1('0x9')]?_0x178580['options'][_0xbbc1('0xb')]||null:null,'attributes':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')]['attributes']||null:null,'limit':_0x178580['options']?_0x178580[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'order':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'transaction':_0x9b7c81,'lock':_0x9b7c81['LOCK'][_0xbbc1('0x26')],'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28'),'attributes':_['keys'](_0x1d8428)},{'model':db[_0xbbc1('0x29')],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]}]})[_0xbbc1('0x11')](function(_0x47fd4c){var _0x44f45b=[];var _0x3f719f=[];for(var _0x864752=0x0;_0x864752<_0x47fd4c[_0xbbc1('0x2d')];_0x864752+=0x1){var _0x482fd1=_0x47fd4c[_0x864752]['UserId'];if(_0x482fd1===null){_0x44f45b['push'](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}else if(!_0x3f719f[_0xbbc1('0x2e')](_0x482fd1)){_0x3f719f['push'](_0x482fd1);_0x44f45b[_0xbbc1('0x2f')](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}}return BPromise[_0xbbc1('0x30')](_0x44f45b);});})[_0xbbc1('0x11')](function(_0x3220ac){logger['info'](_0xbbc1('0x22'),_0x178580);if(_0x3220ac[_0xbbc1('0x2d')]>0x0){logger['info'](_0xbbc1('0x31'),_0x3220ac[0x0]['dataValues']['id'],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x32')],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x1f')]);}logger['debug'](_0xbbc1('0x22'),_0x178580,JSON['stringify'](_0x3220ac));_0x404895(_0x3220ac);})[_0xbbc1('0x15')](function(_0x58e3a8){logger[_0xbbc1('0x17')](_0xbbc1('0x22'),_0x58e3a8['message'],_0x178580);_0x131da3(_0x3d53a9['error'](0x1f4,_0x58e3a8[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x33')]=function(_0x2b0fe6){var _0x4ac138=this;return new Promise(function(_0x587cb4,_0x39678a){return db['sequelize'][_0xbbc1('0x24')](function(_0x2abd27){return db[_0xbbc1('0x34')][_0xbbc1('0x1a')](_0x2b0fe6[_0xbbc1('0x1b')],{'raw':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2abd27})[_0xbbc1('0x11')](function(){logger['info'](_0xbbc1('0x35'),JSON['stringify'](_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]),_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')][_0xbbc1('0x1f')]);return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'transaction':_0x2abd27});});})[_0xbbc1('0x11')](function(_0x46cde8){logger['info'](_0xbbc1('0x33'),_0x2b0fe6);logger[_0xbbc1('0x13')](_0xbbc1('0x33'),_0x2b0fe6,JSON[_0xbbc1('0x14')](_0x46cde8));_0x587cb4(_0x46cde8);})[_0xbbc1('0x15')](function(_0x1bab72){logger[_0xbbc1('0x17')](_0xbbc1('0x33'),_0x1bab72['message'],_0x2b0fe6);_0x39678a(_0x4ac138[_0xbbc1('0x17')](0x1f4,_0x1bab72[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x36')]=function(_0xa893ad){var _0x4c5594=this;return new Promise(function(_0x2e6326,_0xcfac27){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':[[db[_0xbbc1('0x37')]['fn'](_0xbbc1('0x38'),db['sequelize']['fn']('IF',db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x3a')+util[_0xbbc1('0x3b')](_0xbbc1('0x3c'),moment()[_0xbbc1('0x3b')](_0xbbc1('0x3d')))+_0xbbc1('0x3e')))),_0xbbc1('0x3f')]]})['then'](function(_0x564b3b){logger['info'](_0xbbc1('0x36'),_0xa893ad);logger[_0xbbc1('0x13')](_0xbbc1('0x36'),_0xa893ad,JSON[_0xbbc1('0x14')](_0x564b3b));_0x2e6326(_0x564b3b);})[_0xbbc1('0x15')](function(_0x474e81){logger[_0xbbc1('0x17')](_0xbbc1('0x36'),_0x474e81['message'],_0xa893ad);_0xcfac27(_0x4c5594['error'](0x1f4,_0x474e81[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x40')]=function(_0x326b39){var _0x1838e7=this;return new Promise(function(_0x23bbe9,_0x4bb450){return db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(){return db['sequelize'][_0xbbc1('0x24')](function(_0x35ea6c){return db[_0xbbc1('0x7')]['findAll']({'where':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':0x1,'order':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'group':db['CmHopper'][_0xbbc1('0x41')],'transaction':_0x35ea6c,'lock':_0x35ea6c[_0xbbc1('0x42')]['UPDATE'],'include':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')]['include']?_['map'](_0x326b39['options'][_0xbbc1('0xe')],function(_0x27b084){return{'model':db[_0x27b084[_0xbbc1('0xf')]],'as':_0x27b084['as'],'attributes':_0x27b084[_0xbbc1('0xc')],'include':_0x27b084[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x27b084[_0xbbc1('0xe')],function(_0x16e668){return{'model':db[_0x16e668[_0xbbc1('0xf')]],'as':_0x16e668['as'],'attributes':_0x16e668[_0xbbc1('0xc')],'include':_0x16e668['include']?_[_0xbbc1('0x10')](_0x16e668['include'],function(_0x266839){return{'model':db[_0x266839['model']],'as':_0x266839['as'],'attributes':_0x266839[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x339179){var _0x5a1392=[];for(var _0x355f7c=0x0;_0x355f7c<_0x339179['length'];_0x355f7c+=0x1){_0x5a1392['push'](_0x339179[_0x355f7c][_0xbbc1('0x1e')](_0x326b39['body'],{'transaction':_0x35ea6c}));}return BPromise[_0xbbc1('0x30')](_0x5a1392);});})[_0xbbc1('0x11')](function(_0x19f5ee){logger['info'](_0xbbc1('0x40'),_0x326b39);logger[_0xbbc1('0x13')](_0xbbc1('0x40'),_0x326b39,JSON[_0xbbc1('0x14')](_0x19f5ee));_0x23bbe9(_0x19f5ee);})['catch'](function(_0x4e761f){logger[_0xbbc1('0x17')](_0xbbc1('0x40'),_0x4e761f[_0xbbc1('0x16')],_0x326b39);_0x4bb450(_0x1838e7[_0xbbc1('0x17')](0x1f4,_0x4e761f[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x43')]=function(_0x2cf518){var _0x2a63f2=this;return new Promise(function(_0x3b4496,_0x48f49d){db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(_0x1b0718){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options']['attributes']||null:null,'limit':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options'][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x2cf518[_0xbbc1('0x9')]['include'],function(_0x13a7a9){return{'model':db[_0x13a7a9[_0xbbc1('0xf')]],'as':_0x13a7a9['as'],'attributes':_0x13a7a9['as']===_0xbbc1('0x28')?_['keys'](_0x1b0718):_0x13a7a9[_0xbbc1('0xc')],'include':_0x13a7a9[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x13a7a9[_0xbbc1('0xe')],function(_0x182079){return{'model':db[_0x182079[_0xbbc1('0xf')]],'as':_0x182079['as'],'attributes':_0x182079[_0xbbc1('0xc')],'include':_0x182079[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x182079[_0xbbc1('0xe')],function(_0x5558d9){return{'model':db[_0x5558d9[_0xbbc1('0xf')]],'as':_0x5558d9['as'],'attributes':_0x5558d9[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x24ab42){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x2cf518);logger[_0xbbc1('0x13')]('GetCmHopper',_0x2cf518,JSON[_0xbbc1('0x14')](_0x24ab42));_0x3b4496(_0x24ab42);})[_0xbbc1('0x15')](function(_0x357619){logger[_0xbbc1('0x17')](_0xbbc1('0x6'),_0x357619['message'],_0x2cf518);_0x48f49d(_0x2a63f2['error'](0x1f4,_0x357619[_0xbbc1('0x16')]));});});});};exports['GetContactByPhone']=function(_0x407cd4){var _0x341a86=this;return new Promise(function(_0xcdbfec,_0x191c7a){return db['CmContact'][_0xbbc1('0x44')]({'raw':!![],'where':{'phone':_0x407cd4['options'][_0xbbc1('0xb')][_0xbbc1('0x45')]},'attributes':['id',_0xbbc1('0x46')],'order':[['id','DESC']]})[_0xbbc1('0x11')](function(_0x4a2aa0){logger[_0xbbc1('0x12')]('getContactByPhone',_0x407cd4);logger[_0xbbc1('0x13')](_0xbbc1('0x47'),_0x407cd4,JSON[_0xbbc1('0x14')](_0x4a2aa0));_0xcdbfec(_0x4a2aa0);})[_0xbbc1('0x15')](function(_0x31832d){logger[_0xbbc1('0x17')]('getContactByPhone',_0x31832d[_0xbbc1('0x16')],_0x407cd4);_0x191c7a(_0x341a86['error'](0x1f4,_0x31832d[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x48')]=function(_0x2e3fa4){var _0x5bea06=this;return new Promise(function(_0x201d67,_0x68559d){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0xf09044){var _0x1e4fbf=_0x2e3fa4[_0xbbc1('0x9')]&&_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]?_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]:{};return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2e3fa4['body'],{'where':_0x1e4fbf,'transaction':_0xf09044})['then'](function(_0x8aeba2){logger['info']('ResetActiveCalls',_0x2e3fa4);logger['debug'](_0xbbc1('0x48'),_0x2e3fa4,JSON['stringify'](_0x8aeba2));_0x201d67(_0x8aeba2);})[_0xbbc1('0x15')](function(_0x4246aa){logger['error'](_0xbbc1('0x48'),_0x4246aa['message'],_0x2e3fa4);_0x68559d(_0x5bea06[_0xbbc1('0x17')](0x1f4,_0x4246aa['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x50fa21){var _0x135a7e=this;var _0x40dd9e=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')]['voiceQueueIds'];var _0x3007bb=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x49')];var _0x4b5a1c=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x4a')];return new Promise(function(_0x21ff2f,_0x6f1024){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'where':{'voiceQueueId':{'$in':_0x40dd9e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xbbc1('0x4b')+_0x3007bb+_0xbbc1('0x4c')),'$gt':db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x4d'))}},'UserId':{'$in':_0x4b5a1c}},'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28')},{'model':db['User'],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]},{'model':db[_0xbbc1('0x4e')],'as':_0xbbc1('0x4f')}]})['then'](function(_0x112f01){if(_0x112f01[_0xbbc1('0x2d')]>0x0){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0x514034){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xbbc1('0x39')](_0xbbc1('0x4d'))},{'where':{'id':{'$in':_['map'](_0x112f01,'id')}},'transaction':_0x514034})['then'](function(){_0x21ff2f(_0x112f01);})[_0xbbc1('0x15')](function(_0x1c4540){logger[_0xbbc1('0x17')](_0xbbc1('0x50'),_0x1c4540[_0xbbc1('0x16')],_0x50fa21);_0x6f1024(_0x135a7e['error'](0x1f4,_0x1c4540[_0xbbc1('0x16')]));});})[_0xbbc1('0x15')](function(_0xc89939){logger[_0xbbc1('0x17')]('CmHopperHandlePreviewRecallNotifications',_0xc89939['message'],_0x50fa21);_0x6f1024(_0x135a7e[_0xbbc1('0x17')](0x1f4,_0xc89939['message']));});}else{_0x21ff2f(_0x112f01);}});});}; \ No newline at end of file +var _0x80f7=['info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','where','create','body','CreateCmHopper','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','findAll','order','UPDATE','Contact','User','Agent','length','UserId','push','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','all','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','name','voicePause','List','NOW()','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','attributes','include','map','model','then'];(function(_0x465d26,_0x4178ef){var _0x55da6b=function(_0x168c09){while(--_0x168c09){_0x465d26['push'](_0x465d26['shift']());}};_0x55da6b(++_0x4178ef);}(_0x80f7,0xd6));var _0x780f=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0x80f7[_0x4d579b];return _0x288145;};'use strict';var _=require(_0x780f('0x0'));var util=require('util');var moment=require(_0x780f('0x1'));var BPromise=require(_0x780f('0x2'));var db=require(_0x780f('0x3'))['db'];var logger=require(_0x780f('0x4'))(_0x780f('0x5'));exports['GetCmHopper']=function(_0x48fadd){var _0xc5ea04=this;return new Promise(function(_0x36dbe0,_0x418805){return db[_0x780f('0x6')]['findAll']({'raw':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')]['where']||null:null,'attributes':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')]['limit']||null:null,'include':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x48fadd[_0x780f('0x7')]['include'],function(_0x24e2ba){return{'model':db[_0x24e2ba[_0x780f('0xc')]],'as':_0x24e2ba['as'],'attributes':_0x24e2ba['attributes'],'include':_0x24e2ba[_0x780f('0xa')]?_[_0x780f('0xb')](_0x24e2ba[_0x780f('0xa')],function(_0x15ef60){return{'model':db[_0x15ef60[_0x780f('0xc')]],'as':_0x15ef60['as'],'attributes':_0x15ef60[_0x780f('0x9')],'include':_0x15ef60[_0x780f('0xa')]?_[_0x780f('0xb')](_0x15ef60['include'],function(_0x156654){return{'model':db[_0x156654[_0x780f('0xc')]],'as':_0x156654['as'],'attributes':_0x156654[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0x380e25){logger[_0x780f('0xe')](_0x780f('0xf'),_0x48fadd);logger[_0x780f('0x10')]('GetCmHopper',_0x48fadd,JSON[_0x780f('0x11')](_0x380e25));_0x36dbe0(_0x380e25);})[_0x780f('0x12')](function(_0x5ca44c){logger[_0x780f('0x13')](_0x780f('0xf'),_0x5ca44c[_0x780f('0x14')],_0x48fadd);_0x418805(_0xc5ea04[_0x780f('0x13')](0x1f4,_0x5ca44c['message']));});});};exports[_0x780f('0x15')]=function(_0x5d0ce1){var _0x46dd57=this;return new Promise(function(_0xdce1bf,_0x53347e){return db[_0x780f('0x6')][_0x780f('0x16')]({'raw':_0x5d0ce1['options']?_0x5d0ce1['options'][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x5d0ce1[_0x780f('0x7')]?_0x5d0ce1[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':_0x5d0ce1['options']?_0x5d0ce1[_0x780f('0x7')][_0x780f('0x9')]||null:null,'include':_0x5d0ce1[_0x780f('0x7')]?_0x5d0ce1[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x5d0ce1[_0x780f('0x7')][_0x780f('0xa')],function(_0x5690e6){return{'model':db[_0x5690e6['model']],'as':_0x5690e6['as'],'attributes':_0x5690e6[_0x780f('0x9')],'include':_0x5690e6[_0x780f('0xa')]?_[_0x780f('0xb')](_0x5690e6[_0x780f('0xa')],function(_0x4312c0){return{'model':db[_0x4312c0[_0x780f('0xc')]],'as':_0x4312c0['as'],'attributes':_0x4312c0['attributes'],'include':_0x4312c0[_0x780f('0xa')]?_[_0x780f('0xb')](_0x4312c0[_0x780f('0xa')],function(_0x132a99){return{'model':db[_0x132a99[_0x780f('0xc')]],'as':_0x132a99['as'],'attributes':_0x132a99[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0415){logger[_0x780f('0xe')](_0x780f('0x15'),_0x5d0ce1);logger[_0x780f('0x10')](_0x780f('0x15'),_0x5d0ce1,JSON['stringify'](_0x4d0415));_0xdce1bf(_0x4d0415);})[_0x780f('0x12')](function(_0x5501ae){logger['error']('ShowCmHopper',_0x5501ae['message'],_0x5d0ce1);_0x53347e(_0x46dd57[_0x780f('0x13')](0x1f4,_0x5501ae[_0x780f('0x14')]));});});};exports['CreateCmHopper']=function(_0x11cb72){var _0x11c4ba=this;return new Promise(function(_0x1b5216,_0x38fbea){return db[_0x780f('0x6')][_0x780f('0x18')](_0x11cb72[_0x780f('0x19')],{'raw':_0x11cb72[_0x780f('0x7')]?_0x11cb72[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![]})[_0x780f('0xd')](function(_0x27df93){logger[_0x780f('0xe')](_0x780f('0x1a'),_0x11cb72);logger[_0x780f('0x10')](_0x780f('0x1a'),_0x11cb72,JSON[_0x780f('0x11')](_0x27df93));_0x1b5216(_0x27df93);})[_0x780f('0x12')](function(_0x236b3a){logger[_0x780f('0x13')]('CreateCmHopper',_0x236b3a[_0x780f('0x14')],_0x11cb72);_0x38fbea(_0x11c4ba[_0x780f('0x13')](0x1f4,_0x236b3a[_0x780f('0x14')]));});});};exports[_0x780f('0x1b')]=function(_0x1e347c){var _0x282703=this;return new Promise(function(_0x5eab7a,_0x5ad62c){return db['CmHopper'][_0x780f('0x1c')](_0x1e347c['body'],{'raw':_0x1e347c[_0x780f('0x7')]?_0x1e347c['options'][_0x780f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e347c[_0x780f('0x7')]?_0x1e347c[_0x780f('0x7')]['where']||null:null,'attributes':_0x1e347c[_0x780f('0x7')]?_0x1e347c['options'][_0x780f('0x9')]||null:null,'limit':_0x1e347c[_0x780f('0x7')]?_0x1e347c[_0x780f('0x7')][_0x780f('0x1d')]||null:null})[_0x780f('0xd')](function(_0x552cff){logger[_0x780f('0xe')](_0x780f('0x1b'),_0x1e347c);logger['info'](_0x780f('0x1e'),JSON[_0x780f('0x11')](_0x1e347c['options'][_0x780f('0x17')]),_0x1e347c[_0x780f('0x19')][_0x780f('0x1f')]);logger[_0x780f('0x10')](_0x780f('0x1b'),_0x1e347c,JSON[_0x780f('0x11')](_0x552cff));_0x5eab7a(_0x552cff);})['catch'](function(_0x217a68){logger['error'](_0x780f('0x1b'),_0x217a68[_0x780f('0x14')],_0x1e347c);_0x5ad62c(_0x282703[_0x780f('0x13')](0x1f4,_0x217a68['message']));});});};exports[_0x780f('0x20')]=function(_0x4861b6){var _0x32895a=this;return new Promise(function(_0x34054a,_0xce7bc){return db[_0x780f('0x6')][_0x780f('0x21')]({'where':_0x4861b6[_0x780f('0x7')]?_0x4861b6[_0x780f('0x7')]['where']||null:null})[_0x780f('0xd')](function(_0x4f1b8f){logger[_0x780f('0xe')](_0x780f('0x20'),_0x4861b6);logger[_0x780f('0x10')](_0x780f('0x20'),_0x4861b6,JSON[_0x780f('0x11')](_0x4f1b8f));_0x34054a(_0x4f1b8f);})[_0x780f('0x12')](function(_0x5d7498){logger[_0x780f('0x13')](_0x780f('0x20'),_0x5d7498[_0x780f('0x14')],_0x4861b6);_0xce7bc(_0x32895a[_0x780f('0x13')](0x1f4,_0x5d7498['message']));});});};exports[_0x780f('0x22')]=function(_0x1f1afd){var _0x2c38d2=this;return new Promise(function(_0x3079d0,_0x3e2207){return db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(_0x4053a7){return db['sequelize']['transaction'](function(_0x25c263){return db['CmHopper'][_0x780f('0x25')]({'where':_0x1f1afd[_0x780f('0x7')]?_0x1f1afd['options']['where']||null:null,'attributes':_0x1f1afd[_0x780f('0x7')]?_0x1f1afd[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x1f1afd['options']?_0x1f1afd[_0x780f('0x7')]['limit']||null:null,'order':_0x1f1afd['options']?_0x1f1afd[_0x780f('0x7')][_0x780f('0x26')]||null:null,'transaction':_0x25c263,'lock':_0x25c263['LOCK'][_0x780f('0x27')],'include':[{'model':db[_0x780f('0x23')],'as':_0x780f('0x28'),'attributes':_['keys'](_0x4053a7)},{'model':db[_0x780f('0x29')],'as':_0x780f('0x2a'),'attributes':['id','name','voicePause']}]})[_0x780f('0xd')](function(_0x44e6ee){var _0x5abe65=[];var _0x185c1b=[];for(var _0x520369=0x0;_0x520369<_0x44e6ee[_0x780f('0x2b')];_0x520369+=0x1){var _0x5afa4a=_0x44e6ee[_0x520369][_0x780f('0x2c')];if(_0x5afa4a===null){_0x5abe65[_0x780f('0x2d')](_0x44e6ee[_0x520369][_0x780f('0x1c')](_0x1f1afd[_0x780f('0x19')],{'transaction':_0x25c263}));}else if(!_0x185c1b['includes'](_0x5afa4a)){_0x185c1b[_0x780f('0x2d')](_0x5afa4a);_0x5abe65[_0x780f('0x2d')](_0x44e6ee[_0x520369][_0x780f('0x1c')](_0x1f1afd['body'],{'transaction':_0x25c263}));}}return BPromise['all'](_0x5abe65);});})[_0x780f('0xd')](function(_0x260f03){logger['info'](_0x780f('0x22'),_0x1f1afd);if(_0x260f03[_0x780f('0x2b')]>0x0){logger[_0x780f('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x260f03[0x0][_0x780f('0x2e')]['id'],_0x260f03[0x0]['dataValues'][_0x780f('0x2f')],_0x260f03[0x0]['dataValues'][_0x780f('0x1f')]);}logger[_0x780f('0x10')](_0x780f('0x22'),_0x1f1afd,JSON[_0x780f('0x11')](_0x260f03));_0x3079d0(_0x260f03);})['catch'](function(_0x16b25c){logger[_0x780f('0x13')](_0x780f('0x22'),_0x16b25c[_0x780f('0x14')],_0x1f1afd);_0x3e2207(_0x2c38d2[_0x780f('0x13')](0x1f4,_0x16b25c[_0x780f('0x14')]));});});});};exports[_0x780f('0x30')]=function(_0x43264d){var _0x8e5b4c=this;return new Promise(function(_0x295094,_0x4e4a83){return db[_0x780f('0x31')][_0x780f('0x32')](function(_0x11c805){return db['CmHopperFinal']['create'](_0x43264d[_0x780f('0x19')],{'raw':_0x43264d[_0x780f('0x7')]?_0x43264d[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x11c805})[_0x780f('0xd')](function(){logger[_0x780f('0xe')](_0x780f('0x33'),JSON[_0x780f('0x11')](_0x43264d[_0x780f('0x7')][_0x780f('0x17')]),_0x43264d[_0x780f('0x7')][_0x780f('0x17')][_0x780f('0x1f')]);return db[_0x780f('0x6')][_0x780f('0x21')]({'where':_0x43264d['options']?_0x43264d[_0x780f('0x7')]['where']||null:null,'transaction':_0x11c805});});})[_0x780f('0xd')](function(_0x4c1516){logger[_0x780f('0xe')]('MoveContactManagedDialer',_0x43264d);logger[_0x780f('0x10')](_0x780f('0x30'),_0x43264d,JSON['stringify'](_0x4c1516));_0x295094(_0x4c1516);})[_0x780f('0x12')](function(_0x4448b2){logger[_0x780f('0x13')]('MoveContactManagedDialer',_0x4448b2[_0x780f('0x14')],_0x43264d);_0x4e4a83(_0x8e5b4c['error'](0x1f4,_0x4448b2['message']));});});};exports['CountReScheduled']=function(_0xa6e46a){var _0x3e3846=this;return new Promise(function(_0xdd9e7,_0x1af9bf){return db[_0x780f('0x6')][_0x780f('0x25')]({'raw':_0xa6e46a[_0x780f('0x7')]?_0xa6e46a['options']['raw']===undefined?!![]:![]:!![],'where':_0xa6e46a[_0x780f('0x7')]?_0xa6e46a[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':[[db[_0x780f('0x31')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x780f('0x31')][_0x780f('0x34')](_0x780f('0x35')+util[_0x780f('0x36')]('\x22%s\x22',moment()[_0x780f('0x36')](_0x780f('0x37')))+'\x20,\x201,\x20null'))),_0x780f('0x38')]]})[_0x780f('0xd')](function(_0x47c28d){logger[_0x780f('0xe')]('CountReScheduled',_0xa6e46a);logger['debug'](_0x780f('0x39'),_0xa6e46a,JSON[_0x780f('0x11')](_0x47c28d));_0xdd9e7(_0x47c28d);})[_0x780f('0x12')](function(_0x54582d){logger[_0x780f('0x13')](_0x780f('0x39'),_0x54582d[_0x780f('0x14')],_0xa6e46a);_0x1af9bf(_0x3e3846[_0x780f('0x13')](0x1f4,_0x54582d[_0x780f('0x14')]));});});};exports[_0x780f('0x3a')]=function(_0x583823){var _0x2ef2e8=this;return new Promise(function(_0x274979,_0x30fbcf){return db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(){return db[_0x780f('0x31')]['transaction'](function(_0x1c006b){return db[_0x780f('0x6')]['findAll']({'where':_0x583823['options']?_0x583823['options'][_0x780f('0x17')]||null:null,'attributes':_0x583823['options']?_0x583823[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':0x1,'order':_0x583823['options']?_0x583823[_0x780f('0x7')][_0x780f('0x26')]||null:null,'group':db[_0x780f('0x6')][_0x780f('0x2c')],'transaction':_0x1c006b,'lock':_0x1c006b['LOCK'][_0x780f('0x27')],'include':_0x583823[_0x780f('0x7')]?_0x583823[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x583823[_0x780f('0x7')]['include'],function(_0x524446){return{'model':db[_0x524446[_0x780f('0xc')]],'as':_0x524446['as'],'attributes':_0x524446['attributes'],'include':_0x524446['include']?_[_0x780f('0xb')](_0x524446[_0x780f('0xa')],function(_0x4bf1cd){return{'model':db[_0x4bf1cd[_0x780f('0xc')]],'as':_0x4bf1cd['as'],'attributes':_0x4bf1cd['attributes'],'include':_0x4bf1cd[_0x780f('0xa')]?_['map'](_0x4bf1cd[_0x780f('0xa')],function(_0x410dd3){return{'model':db[_0x410dd3[_0x780f('0xc')]],'as':_0x410dd3['as'],'attributes':_0x410dd3[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0xe25688){var _0x4d0905=[];for(var _0x5c7f95=0x0;_0x5c7f95<_0xe25688[_0x780f('0x2b')];_0x5c7f95+=0x1){_0x4d0905[_0x780f('0x2d')](_0xe25688[_0x5c7f95]['update'](_0x583823[_0x780f('0x19')],{'transaction':_0x1c006b}));}return BPromise[_0x780f('0x3b')](_0x4d0905);});})[_0x780f('0xd')](function(_0x241f08){logger[_0x780f('0xe')](_0x780f('0x3a'),_0x583823);logger[_0x780f('0x10')](_0x780f('0x3a'),_0x583823,JSON[_0x780f('0x11')](_0x241f08));_0x274979(_0x241f08);})[_0x780f('0x12')](function(_0x2b6fe2){logger[_0x780f('0x13')]('GetContactRecallMe',_0x2b6fe2[_0x780f('0x14')],_0x583823);_0x30fbcf(_0x2ef2e8[_0x780f('0x13')](0x1f4,_0x2b6fe2[_0x780f('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x35cbab){var _0x9614e7=this;return new Promise(function(_0x34d87c,_0xe2093e){db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(_0x16161d){return db[_0x780f('0x6')][_0x780f('0x25')]({'raw':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x1d')]||null:null,'include':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x35cbab[_0x780f('0x7')][_0x780f('0xa')],function(_0x477b6a){return{'model':db[_0x477b6a['model']],'as':_0x477b6a['as'],'attributes':_0x477b6a['as']===_0x780f('0x28')?_[_0x780f('0x3c')](_0x16161d):_0x477b6a['attributes'],'include':_0x477b6a[_0x780f('0xa')]?_[_0x780f('0xb')](_0x477b6a['include'],function(_0x2e6a8d){return{'model':db[_0x2e6a8d[_0x780f('0xc')]],'as':_0x2e6a8d['as'],'attributes':_0x2e6a8d[_0x780f('0x9')],'include':_0x2e6a8d[_0x780f('0xa')]?_[_0x780f('0xb')](_0x2e6a8d['include'],function(_0x2da3b4){return{'model':db[_0x2da3b4['model']],'as':_0x2da3b4['as'],'attributes':_0x2da3b4[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0x4e794c){logger[_0x780f('0xe')](_0x780f('0xf'),_0x35cbab);logger[_0x780f('0x10')](_0x780f('0xf'),_0x35cbab,JSON[_0x780f('0x11')](_0x4e794c));_0x34d87c(_0x4e794c);})['catch'](function(_0xd9ea63){logger['error'](_0x780f('0xf'),_0xd9ea63[_0x780f('0x14')],_0x35cbab);_0xe2093e(_0x9614e7[_0x780f('0x13')](0x1f4,_0xd9ea63[_0x780f('0x14')]));});});});};exports[_0x780f('0x3d')]=function(_0x16cc8b){var _0x2063ef=this;return new Promise(function(_0x1d9ea9,_0x59c7af){return db[_0x780f('0x23')][_0x780f('0x3e')]({'raw':!![],'where':{'phone':_0x16cc8b['options']['where'][_0x780f('0x3f')]},'attributes':['id',_0x780f('0x40')],'order':[['id',_0x780f('0x41')]]})[_0x780f('0xd')](function(_0x616812){logger[_0x780f('0xe')](_0x780f('0x42'),_0x16cc8b);logger[_0x780f('0x10')]('getContactByPhone',_0x16cc8b,JSON[_0x780f('0x11')](_0x616812));_0x1d9ea9(_0x616812);})[_0x780f('0x12')](function(_0x5c2479){logger[_0x780f('0x13')](_0x780f('0x42'),_0x5c2479[_0x780f('0x14')],_0x16cc8b);_0x59c7af(_0x2063ef[_0x780f('0x13')](0x1f4,_0x5c2479[_0x780f('0x14')]));});});};exports['ResetActiveCalls']=function(_0x19ff5b){var _0x5cd755=this;return new Promise(function(_0x398c01,_0x487719){return db[_0x780f('0x31')]['transaction'](function(_0x423c59){var _0xf55c81=_0x19ff5b[_0x780f('0x7')]&&_0x19ff5b['options'][_0x780f('0x17')]?_0x19ff5b['options']['where']:{};return db[_0x780f('0x6')][_0x780f('0x1c')](_0x19ff5b[_0x780f('0x19')],{'where':_0xf55c81,'transaction':_0x423c59})[_0x780f('0xd')](function(_0x4972e4){logger['info']('ResetActiveCalls',_0x19ff5b);logger[_0x780f('0x10')](_0x780f('0x43'),_0x19ff5b,JSON[_0x780f('0x11')](_0x4972e4));_0x398c01(_0x4972e4);})['catch'](function(_0x38cb6c){logger[_0x780f('0x13')](_0x780f('0x43'),_0x38cb6c['message'],_0x19ff5b);_0x487719(_0x5cd755[_0x780f('0x13')](0x1f4,_0x38cb6c[_0x780f('0x14')]));});});});};exports[_0x780f('0x44')]=function(_0x2d78d8){var _0xfda5=this;var _0x369bdb=_0x2d78d8[_0x780f('0x19')][_0x780f('0x17')][_0x780f('0x45')];var _0x39cb68=_0x2d78d8[_0x780f('0x19')]['where']['interval'];var _0x50219d=_0x2d78d8['body']['where'][_0x780f('0x46')];return new Promise(function(_0x1d65f4,_0x3e7a10){return db[_0x780f('0x6')][_0x780f('0x25')]({'where':{'voiceQueueId':{'$in':_0x369bdb},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x780f('0x34')](_0x780f('0x47')+_0x39cb68+'\x20MINUTE'),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x50219d}},'include':[{'model':db[_0x780f('0x23')],'as':_0x780f('0x28')},{'model':db[_0x780f('0x29')],'as':_0x780f('0x2a'),'attributes':['id',_0x780f('0x48'),_0x780f('0x49')]},{'model':db['CmList'],'as':_0x780f('0x4a')}]})[_0x780f('0xd')](function(_0x37bbcf){if(_0x37bbcf[_0x780f('0x2b')]>0x0){return db[_0x780f('0x31')][_0x780f('0x32')](function(_0x34867c){return db[_0x780f('0x6')][_0x780f('0x1c')]({'recallmeNotifiedDate':db[_0x780f('0x31')][_0x780f('0x34')](_0x780f('0x4b'))},{'where':{'id':{'$in':_[_0x780f('0xb')](_0x37bbcf,'id')}},'transaction':_0x34867c})['then'](function(){_0x1d65f4(_0x37bbcf);})[_0x780f('0x12')](function(_0x5a7ce6){logger[_0x780f('0x13')](_0x780f('0x44'),_0x5a7ce6[_0x780f('0x14')],_0x2d78d8);_0x3e7a10(_0xfda5[_0x780f('0x13')](0x1f4,_0x5a7ce6['message']));});})['catch'](function(_0x586726){logger[_0x780f('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x586726[_0x780f('0x14')],_0x2d78d8);_0x3e7a10(_0xfda5[_0x780f('0x13')](0x1f4,_0x586726['message']));});}else{_0x1d65f4(_0x37bbcf);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0df9016..115b997 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 _0x7834=['Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','post','create','/timezone','getTimezone','put','delete','destroy','exports'];(function(_0x13adc2,_0x456fac){var _0x46f01f=function(_0x7bc52d){while(--_0x7bc52d){_0x13adc2['push'](_0x13adc2['shift']());}};_0x46f01f(++_0x456fac);}(_0x7834,0x160));var _0x4783=function(_0x113974,_0x4850e4){_0x113974=_0x113974-0x0;var _0x1b242f=_0x7834[_0x113974];return _0x1b242f;};'use strict';var express=require('express');var router=express[_0x4783('0x0')]();var auth=require(_0x4783('0x1'));var controller=require(_0x4783('0x2'));router[_0x4783('0x3')]('/',auth[_0x4783('0x4')](),controller[_0x4783('0x5')]);router[_0x4783('0x3')](_0x4783('0x6'),auth[_0x4783('0x4')](),controller[_0x4783('0x7')]);router['get'](_0x4783('0x8'),auth[_0x4783('0x4')](),controller[_0x4783('0x9')]);router[_0x4783('0x3')]('/timezones',auth[_0x4783('0x4')](),controller[_0x4783('0xa')]);router[_0x4783('0x3')](_0x4783('0xb'),auth['isAuthenticated'](),controller[_0x4783('0xc')]);router[_0x4783('0x3')](_0x4783('0xd'),auth[_0x4783('0x4')](),controller['getPreviewRecall']);router[_0x4783('0xe')]('/',auth['isAuthenticated'](),controller[_0x4783('0xf')]);router['post']('/preview',auth['isAuthenticated'](),controller['getPreview']);router[_0x4783('0xe')](_0x4783('0x10'),auth[_0x4783('0x4')](),controller[_0x4783('0x11')]);router[_0x4783('0x12')](_0x4783('0xb'),auth[_0x4783('0x4')](),controller['update']);router[_0x4783('0x13')](_0x4783('0xb'),auth['isAuthenticated'](),controller[_0x4783('0x14')]);module[_0x4783('0x15')]=router; \ No newline at end of file +var _0x4ed5=['describe','/opencontacts','getOpenContacts','isAuthenticated','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','exports','Router','get','index','/describe'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x4ed5,0xd8));var _0x54ed=function(_0x299eef,_0x232e2c){_0x299eef=_0x299eef-0x0;var _0x1bb665=_0x4ed5[_0x299eef];return _0x1bb665;};'use strict';var express=require('express');var router=express[_0x54ed('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0x54ed('0x1')]('/',auth['isAuthenticated'](),controller[_0x54ed('0x2')]);router[_0x54ed('0x1')](_0x54ed('0x3'),auth['isAuthenticated'](),controller[_0x54ed('0x4')]);router[_0x54ed('0x1')](_0x54ed('0x5'),auth['isAuthenticated'](),controller[_0x54ed('0x6')]);router[_0x54ed('0x1')]('/timezones',auth[_0x54ed('0x7')](),controller['getTimezones']);router[_0x54ed('0x1')]('/:id',auth['isAuthenticated'](),controller[_0x54ed('0x8')]);router[_0x54ed('0x1')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x54ed('0x9')]);router[_0x54ed('0xa')]('/',auth[_0x54ed('0x7')](),controller[_0x54ed('0xb')]);router[_0x54ed('0xa')](_0x54ed('0xc'),auth['isAuthenticated'](),controller[_0x54ed('0xd')]);router['post'](_0x54ed('0xe'),auth[_0x54ed('0x7')](),controller[_0x54ed('0xf')]);router[_0x54ed('0x10')](_0x54ed('0x11'),auth[_0x54ed('0x7')](),controller[_0x54ed('0x12')]);router[_0x54ed('0x13')](_0x54ed('0x11'),auth[_0x54ed('0x7')](),controller[_0x54ed('0x14')]);module[_0x54ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a4fd4ac..a343783 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1378=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x1378,0x1e2));var _0x8137=function(_0x38b047,_0xeec7a2){_0x38b047=_0x38b047-0x0;var _0x20af37=_0x1378[_0x38b047];return _0x20af37;};'use strict';var moment=require(_0x8137('0x0'));var Sequelize=require(_0x8137('0x1'));module[_0x8137('0x2')]={'CmHopperId':{'type':Sequelize[_0x8137('0x3')]},'phone':{'type':Sequelize[_0x8137('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8137('0x5')],'defaultValue':moment()['format'](_0x8137('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0677=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x25e7c5,_0x93bc23){var _0x47f9a1=function(_0x47a078){while(--_0x47a078){_0x25e7c5['push'](_0x25e7c5['shift']());}};_0x47f9a1(++_0x93bc23);}(_0x0677,0x1c7));var _0x7067=function(_0x113dd1,_0x15aaa1){_0x113dd1=_0x113dd1-0x0;var _0x1605e0=_0x0677[_0x113dd1];return _0x1605e0;};'use strict';var moment=require('moment');var Sequelize=require(_0x7067('0x0'));module[_0x7067('0x1')]={'CmHopperId':{'type':Sequelize[_0x7067('0x2')]},'phone':{'type':Sequelize[_0x7067('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7067('0x4')](_0x7067('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index c0aa6ea..4dc580a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ad7=['include','rows','params','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','stack','send','map','CmHopperAdditionalPhone','rawAttributes','key','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x4ad7,0x159));var _0x74ad=function(_0x5ad5f3,_0x17b05e){_0x5ad5f3=_0x5ad5f3-0x0;var _0x331296=_0x4ad7[_0x5ad5f3];return _0x331296;};'use strict';var emlformat=require(_0x74ad('0x0'));var rimraf=require(_0x74ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74ad('0x2'));var rp=require(_0x74ad('0x3'));var moment=require(_0x74ad('0x4'));var BPromise=require(_0x74ad('0x5'));var Mustache=require(_0x74ad('0x6'));var util=require('util');var path=require(_0x74ad('0x7'));var sox=require(_0x74ad('0x8'));var csv=require(_0x74ad('0x9'));var ejs=require(_0x74ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74ad('0xb'));var squel=require(_0x74ad('0xc'));var crypto=require(_0x74ad('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74ad('0x9'));var querystring=require(_0x74ad('0xe'));var Papa=require(_0x74ad('0xf'));var Redis=require(_0x74ad('0x10'));var authService=require(_0x74ad('0x11'));var qs=require(_0x74ad('0x12'));var as=require(_0x74ad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74ad('0x14'))('api');var utils=require(_0x74ad('0x15'));var config=require(_0x74ad('0x16'));var licenseUtil=require(_0x74ad('0x17'));var db=require(_0x74ad('0x18'))['db'];function respondWithStatusCode(_0xd762a5,_0x19d3dd){_0x19d3dd=_0x19d3dd||0xcc;return function(_0x5d7389){if(_0x5d7389){return _0xd762a5[_0x74ad('0x19')](_0x19d3dd);}return _0xd762a5[_0x74ad('0x1a')](_0x19d3dd)['end']();};}function respondWithResult(_0x47ab7a,_0x78c3f5){_0x78c3f5=_0x78c3f5||0xc8;return function(_0x432658){if(_0x432658){return _0x47ab7a['status'](_0x78c3f5)[_0x74ad('0x1b')](_0x432658);}};}function respondWithFilteredResult(_0x51e72c,_0x4835c9){return function(_0x2d77aa){if(_0x2d77aa){var _0x3281f0=typeof _0x4835c9[_0x74ad('0x1c')]===_0x74ad('0x1d')&&typeof _0x4835c9[_0x74ad('0x1e')]===_0x74ad('0x1d');var _0x321bef=_0x2d77aa[_0x74ad('0x1f')];var _0x8c1d97=_0x3281f0?0x0:_0x4835c9[_0x74ad('0x1c')];var _0x37b39d=_0x3281f0?_0x2d77aa[_0x74ad('0x1f')]:_0x4835c9['offset']+_0x4835c9['limit'];var _0x5d9e8e;if(_0x37b39d>=_0x321bef){_0x37b39d=_0x321bef;_0x5d9e8e=0xc8;}else{_0x5d9e8e=0xce;}_0x51e72c['status'](_0x5d9e8e);return _0x51e72c[_0x74ad('0x20')](_0x74ad('0x21'),_0x8c1d97+'-'+_0x37b39d+'/'+_0x321bef)[_0x74ad('0x1b')](_0x2d77aa);}return null;};}function patchUpdates(_0x478bb0){return function(_0x6ba5da){try{jsonpatch['apply'](_0x6ba5da,_0x478bb0,!![]);}catch(_0x350d5e){return BPromise[_0x74ad('0x22')](_0x350d5e);}return _0x6ba5da[_0x74ad('0x23')]();};}function saveUpdates(_0xacb1df,_0x2bae40){return function(_0x5b9156){if(_0x5b9156){return _0x5b9156[_0x74ad('0x24')](_0xacb1df)[_0x74ad('0x25')](function(_0x4e8168){return _0x4e8168;});}return null;};}function removeEntity(_0x384b03,_0x572a62){return function(_0x1949ab){if(_0x1949ab){return _0x1949ab[_0x74ad('0x26')]()['then'](function(){var _0x23abd0=_0x1949ab[_0x74ad('0x27')]({'plain':!![]});var _0x4465e8=_0x74ad('0x28');return db[_0x74ad('0x29')]['destroy']({'where':{'type':_0x4465e8,'resourceId':_0x23abd0['id']}})['then'](function(){return _0x1949ab;});})[_0x74ad('0x25')](function(){_0x384b03[_0x74ad('0x1a')](0xcc)[_0x74ad('0x2a')]();});}};}function handleEntityNotFound(_0x572b7b,_0x44e7d7){return function(_0x52dce3){if(!_0x52dce3){_0x572b7b[_0x74ad('0x19')](0x194);}return _0x52dce3;};}function handleError(_0x3e8d53,_0x3baa88){_0x3baa88=_0x3baa88||0x1f4;return function(_0x55ee04){logger['error'](_0x55ee04[_0x74ad('0x2b')]);if(_0x55ee04['name']){delete _0x55ee04['name'];}_0x3e8d53[_0x74ad('0x1a')](_0x3baa88)[_0x74ad('0x2c')](_0x55ee04);};}exports['index']=function(_0x1a5f28,_0x50e446){var _0x488541={},_0x5a8898={},_0x11bc21={'count':0x0,'rows':[]};var _0x59fb28=_[_0x74ad('0x2d')](db[_0x74ad('0x2e')][_0x74ad('0x2f')],function(_0x245089){return{'name':_0x245089['fieldName'],'type':_0x245089['type'][_0x74ad('0x30')]};});_0x5a8898['model']=_[_0x74ad('0x2d')](_0x59fb28,_0x74ad('0x31'));_0x5a8898['query']=_[_0x74ad('0x32')](_0x1a5f28[_0x74ad('0x33')]);_0x5a8898[_0x74ad('0x34')]=_[_0x74ad('0x35')](_0x5a8898[_0x74ad('0x36')],_0x5a8898[_0x74ad('0x33')]);_0x488541['attributes']=_['intersection'](_0x5a8898['model'],qs[_0x74ad('0x37')](_0x1a5f28['query'][_0x74ad('0x37')]));_0x488541['attributes']=_0x488541[_0x74ad('0x38')][_0x74ad('0x39')]?_0x488541[_0x74ad('0x38')]:_0x5a8898['model'];if(!_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3a')](_0x74ad('0x3b'))){_0x488541[_0x74ad('0x1e')]=qs[_0x74ad('0x1e')](_0x1a5f28[_0x74ad('0x33')]['limit']);_0x488541[_0x74ad('0x1c')]=qs['offset'](_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x1c')]);}_0x488541[_0x74ad('0x3c')]=qs[_0x74ad('0x3d')](_0x1a5f28[_0x74ad('0x33')]['sort']);_0x488541['where']=qs[_0x74ad('0x34')](_[_0x74ad('0x3e')](_0x1a5f28[_0x74ad('0x33')],_0x5a8898[_0x74ad('0x34')]),_0x59fb28);if(_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3f')]){_0x488541[_0x74ad('0x40')]=_[_0x74ad('0x41')](_0x488541['where'],{'$or':_[_0x74ad('0x2d')](_0x59fb28,function(_0x27e0df){if(_0x27e0df[_0x74ad('0x42')]!==_0x74ad('0x43')){var _0x14a478={};_0x14a478[_0x27e0df['name']]={'$like':'%'+_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3f')]+'%'};return _0x14a478;}})});}_0x488541=_['merge']({},_0x488541,_0x1a5f28[_0x74ad('0x44')]);var _0x237c6a={'where':_0x488541[_0x74ad('0x40')]};return db[_0x74ad('0x2e')][_0x74ad('0x1f')](_0x237c6a)[_0x74ad('0x25')](function(_0x1f4e51){_0x11bc21[_0x74ad('0x1f')]=_0x1f4e51;if(_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x45')]){_0x488541[_0x74ad('0x46')]=[{'all':!![]}];}return db[_0x74ad('0x2e')]['findAll'](_0x488541);})['then'](function(_0x5afdde){_0x11bc21[_0x74ad('0x47')]=_0x5afdde;return _0x11bc21;})[_0x74ad('0x25')](respondWithFilteredResult(_0x50e446,_0x488541))['catch'](handleError(_0x50e446,null));};exports['show']=function(_0x18f952,_0x836419){var _0x2e6266={'raw':!![],'where':{'id':_0x18f952[_0x74ad('0x48')]['id']}},_0x2e4726={};_0x2e4726[_0x74ad('0x36')]=_[_0x74ad('0x32')](db['CmHopperAdditionalPhone'][_0x74ad('0x2f')]);_0x2e4726[_0x74ad('0x33')]=_[_0x74ad('0x32')](_0x18f952[_0x74ad('0x33')]);_0x2e4726[_0x74ad('0x34')]=_['intersection'](_0x2e4726[_0x74ad('0x36')],_0x2e4726[_0x74ad('0x33')]);_0x2e6266['attributes']=_[_0x74ad('0x35')](_0x2e4726[_0x74ad('0x36')],qs['fields'](_0x18f952[_0x74ad('0x33')][_0x74ad('0x37')]));_0x2e6266['attributes']=_0x2e6266['attributes']['length']?_0x2e6266[_0x74ad('0x38')]:_0x2e4726[_0x74ad('0x36')];if(_0x18f952[_0x74ad('0x33')][_0x74ad('0x45')]){_0x2e6266[_0x74ad('0x46')]=[{'all':!![]}];}_0x2e6266=_[_0x74ad('0x41')]({},_0x2e6266,_0x18f952[_0x74ad('0x44')]);return db[_0x74ad('0x2e')][_0x74ad('0x49')](_0x2e6266)[_0x74ad('0x25')](handleEntityNotFound(_0x836419,null))[_0x74ad('0x25')](respondWithResult(_0x836419,null))[_0x74ad('0x4a')](handleError(_0x836419,null));};exports['create']=function(_0x3c5e82,_0x2f549a){return db['CmHopperAdditionalPhone'][_0x74ad('0x4b')](_0x3c5e82[_0x74ad('0x4c')],{})[_0x74ad('0x25')](function(_0x2cc543){var _0x4ceab3=_0x3c5e82[_0x74ad('0x4d')][_0x74ad('0x27')]({'plain':!![]});if(!_0x4ceab3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ceab3['role']==='user'){var _0x4bd557=_0x2cc543['get']({'plain':!![]});var _0x386aad=_0x74ad('0x28');return db[_0x74ad('0x4e')][_0x74ad('0x49')]({'where':{'name':_0x386aad,'userProfileId':_0x4ceab3[_0x74ad('0x4f')]},'raw':!![]})[_0x74ad('0x25')](function(_0x30b8a0){if(_0x30b8a0&&_0x30b8a0[_0x74ad('0x50')]===0x0){return db[_0x74ad('0x29')][_0x74ad('0x4b')]({'name':_0x4bd557[_0x74ad('0x31')],'resourceId':_0x4bd557['id'],'type':_0x30b8a0['name'],'sectionId':_0x30b8a0['id']},{})[_0x74ad('0x25')](function(){return _0x2cc543;});}else{return _0x2cc543;}})[_0x74ad('0x4a')](function(_0x416a1f){logger[_0x74ad('0x51')](_0x74ad('0x52'),_0x416a1f);throw _0x416a1f;});}return _0x2cc543;})['then'](respondWithResult(_0x2f549a,0xc9))[_0x74ad('0x4a')](handleError(_0x2f549a,null));};exports[_0x74ad('0x24')]=function(_0x28de3d,_0x29a501){if(_0x28de3d[_0x74ad('0x4c')]['id']){delete _0x28de3d[_0x74ad('0x4c')]['id'];}return db[_0x74ad('0x2e')][_0x74ad('0x49')]({'where':{'id':_0x28de3d[_0x74ad('0x48')]['id']}})['then'](handleEntityNotFound(_0x29a501,null))['then'](saveUpdates(_0x28de3d['body'],null))['then'](respondWithResult(_0x29a501,null))['catch'](handleError(_0x29a501,null));};exports['destroy']=function(_0x5b07d3,_0x4eda41){return db['CmHopperAdditionalPhone'][_0x74ad('0x49')]({'where':{'id':_0x5b07d3[_0x74ad('0x48')]['id']}})[_0x74ad('0x25')](handleEntityNotFound(_0x4eda41,null))['then'](removeEntity(_0x4eda41,null))[_0x74ad('0x4a')](handleError(_0x4eda41,null));}; \ No newline at end of file +var _0x77ab=['where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','save','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x5d7db0,_0x16404e){var _0x8fb186=function(_0x231b58){while(--_0x231b58){_0x5d7db0['push'](_0x5d7db0['shift']());}};_0x8fb186(++_0x16404e);}(_0x77ab,0x106));var _0xb77a=function(_0x21644e,_0x172f3a){_0x21644e=_0x21644e-0x0;var _0x49b905=_0x77ab[_0x21644e];return _0x49b905;};'use strict';var emlformat=require(_0xb77a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb77a('0x1'));var jsonpatch=require(_0xb77a('0x2'));var rp=require(_0xb77a('0x3'));var moment=require(_0xb77a('0x4'));var BPromise=require(_0xb77a('0x5'));var Mustache=require(_0xb77a('0x6'));var util=require(_0xb77a('0x7'));var path=require(_0xb77a('0x8'));var sox=require(_0xb77a('0x9'));var csv=require(_0xb77a('0xa'));var ejs=require(_0xb77a('0xb'));var fs=require('fs');var fs_extra=require(_0xb77a('0xc'));var _=require(_0xb77a('0xd'));var squel=require(_0xb77a('0xe'));var crypto=require(_0xb77a('0xf'));var jsforce=require(_0xb77a('0x10'));var deskjs=require(_0xb77a('0x11'));var toCsv=require(_0xb77a('0xa'));var querystring=require('querystring');var Papa=require(_0xb77a('0x12'));var Redis=require(_0xb77a('0x13'));var authService=require(_0xb77a('0x14'));var qs=require(_0xb77a('0x15'));var as=require(_0xb77a('0x16'));var hardwareService=require(_0xb77a('0x17'));var logger=require(_0xb77a('0x18'))(_0xb77a('0x19'));var utils=require('../../config/utils');var config=require(_0xb77a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238cab,_0x3402a2){_0x3402a2=_0x3402a2||0xcc;return function(_0x5d5abb){if(_0x5d5abb){return _0x238cab[_0xb77a('0x1b')](_0x3402a2);}return _0x238cab[_0xb77a('0x1c')](_0x3402a2)['end']();};}function respondWithResult(_0xca9f1e,_0x2de730){_0x2de730=_0x2de730||0xc8;return function(_0x34066b){if(_0x34066b){return _0xca9f1e[_0xb77a('0x1c')](_0x2de730)[_0xb77a('0x1d')](_0x34066b);}};}function respondWithFilteredResult(_0x5bd1c1,_0x1b9431){return function(_0x4dbe84){if(_0x4dbe84){var _0x2149ee=typeof _0x1b9431[_0xb77a('0x1e')]===_0xb77a('0x1f')&&typeof _0x1b9431[_0xb77a('0x20')]===_0xb77a('0x1f');var _0x31fdee=_0x4dbe84[_0xb77a('0x21')];var _0x4cebc5=_0x2149ee?0x0:_0x1b9431[_0xb77a('0x1e')];var _0x5baa2c=_0x2149ee?_0x4dbe84[_0xb77a('0x21')]:_0x1b9431['offset']+_0x1b9431['limit'];var _0x4dd45c;if(_0x5baa2c>=_0x31fdee){_0x5baa2c=_0x31fdee;_0x4dd45c=0xc8;}else{_0x4dd45c=0xce;}_0x5bd1c1[_0xb77a('0x1c')](_0x4dd45c);return _0x5bd1c1[_0xb77a('0x22')]('Content-Range',_0x4cebc5+'-'+_0x5baa2c+'/'+_0x31fdee)['json'](_0x4dbe84);}return null;};}function patchUpdates(_0x19d158){return function(_0x5b4beb){try{jsonpatch['apply'](_0x5b4beb,_0x19d158,!![]);}catch(_0xd8c3d2){return BPromise['reject'](_0xd8c3d2);}return _0x5b4beb[_0xb77a('0x23')]();};}function saveUpdates(_0x14a2af,_0x3600c9){return function(_0x4eb85e){if(_0x4eb85e){return _0x4eb85e['update'](_0x14a2af)[_0xb77a('0x24')](function(_0x5aa6e5){return _0x5aa6e5;});}return null;};}function removeEntity(_0x1dba2b,_0x1d6f39){return function(_0xd01c1f){if(_0xd01c1f){return _0xd01c1f['destroy']()[_0xb77a('0x24')](function(){var _0x3af2db=_0xd01c1f[_0xb77a('0x25')]({'plain':!![]});var _0x3d2ac2=_0xb77a('0x26');return db[_0xb77a('0x27')][_0xb77a('0x28')]({'where':{'type':_0x3d2ac2,'resourceId':_0x3af2db['id']}})[_0xb77a('0x24')](function(){return _0xd01c1f;});})[_0xb77a('0x24')](function(){_0x1dba2b[_0xb77a('0x1c')](0xcc)[_0xb77a('0x29')]();});}};}function handleEntityNotFound(_0x3148b1,_0x85d439){return function(_0x5e2671){if(!_0x5e2671){_0x3148b1['sendStatus'](0x194);}return _0x5e2671;};}function handleError(_0x1fffb9,_0x3697b0){_0x3697b0=_0x3697b0||0x1f4;return function(_0x524e00){logger[_0xb77a('0x2a')](_0x524e00[_0xb77a('0x2b')]);if(_0x524e00[_0xb77a('0x2c')]){delete _0x524e00[_0xb77a('0x2c')];}_0x1fffb9[_0xb77a('0x1c')](_0x3697b0)[_0xb77a('0x2d')](_0x524e00);};}exports[_0xb77a('0x2e')]=function(_0x570dda,_0x42014c){var _0xaa0b96={},_0x5a42f5={},_0x343c7a={'count':0x0,'rows':[]};var _0x15c7a3=_[_0xb77a('0x2f')](db[_0xb77a('0x30')]['rawAttributes'],function(_0x230bf9){return{'name':_0x230bf9[_0xb77a('0x31')],'type':_0x230bf9[_0xb77a('0x32')][_0xb77a('0x33')]};});_0x5a42f5['model']=_[_0xb77a('0x2f')](_0x15c7a3,_0xb77a('0x2c'));_0x5a42f5['query']=_[_0xb77a('0x34')](_0x570dda[_0xb77a('0x35')]);_0x5a42f5['filters']=_[_0xb77a('0x36')](_0x5a42f5[_0xb77a('0x37')],_0x5a42f5['query']);_0xaa0b96['attributes']=_['intersection'](_0x5a42f5[_0xb77a('0x37')],qs[_0xb77a('0x38')](_0x570dda[_0xb77a('0x35')][_0xb77a('0x38')]));_0xaa0b96[_0xb77a('0x39')]=_0xaa0b96[_0xb77a('0x39')][_0xb77a('0x3a')]?_0xaa0b96['attributes']:_0x5a42f5[_0xb77a('0x37')];if(!_0x570dda['query'][_0xb77a('0x3b')]('nolimit')){_0xaa0b96[_0xb77a('0x20')]=qs[_0xb77a('0x20')](_0x570dda['query']['limit']);_0xaa0b96[_0xb77a('0x1e')]=qs[_0xb77a('0x1e')](_0x570dda[_0xb77a('0x35')]['offset']);}_0xaa0b96[_0xb77a('0x3c')]=qs[_0xb77a('0x3d')](_0x570dda[_0xb77a('0x35')][_0xb77a('0x3d')]);_0xaa0b96[_0xb77a('0x3e')]=qs[_0xb77a('0x3f')](_[_0xb77a('0x40')](_0x570dda[_0xb77a('0x35')],_0x5a42f5['filters']),_0x15c7a3);if(_0x570dda[_0xb77a('0x35')]['filter']){_0xaa0b96[_0xb77a('0x3e')]=_['merge'](_0xaa0b96[_0xb77a('0x3e')],{'$or':_[_0xb77a('0x2f')](_0x15c7a3,function(_0x3b9175){if(_0x3b9175[_0xb77a('0x32')]!==_0xb77a('0x41')){var _0x25a60f={};_0x25a60f[_0x3b9175[_0xb77a('0x2c')]]={'$like':'%'+_0x570dda[_0xb77a('0x35')][_0xb77a('0x42')]+'%'};return _0x25a60f;}})});}_0xaa0b96=_[_0xb77a('0x43')]({},_0xaa0b96,_0x570dda[_0xb77a('0x44')]);var _0x1a9931={'where':_0xaa0b96[_0xb77a('0x3e')]};return db[_0xb77a('0x30')][_0xb77a('0x21')](_0x1a9931)[_0xb77a('0x24')](function(_0x23dfea){_0x343c7a[_0xb77a('0x21')]=_0x23dfea;if(_0x570dda[_0xb77a('0x35')][_0xb77a('0x45')]){_0xaa0b96[_0xb77a('0x46')]=[{'all':!![]}];}return db[_0xb77a('0x30')][_0xb77a('0x47')](_0xaa0b96);})[_0xb77a('0x24')](function(_0x3841e7){_0x343c7a['rows']=_0x3841e7;return _0x343c7a;})[_0xb77a('0x24')](respondWithFilteredResult(_0x42014c,_0xaa0b96))[_0xb77a('0x48')](handleError(_0x42014c,null));};exports['show']=function(_0x23860a,_0x4db366){var _0x441f7d={'raw':!![],'where':{'id':_0x23860a['params']['id']}},_0x323cde={};_0x323cde[_0xb77a('0x37')]=_[_0xb77a('0x34')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x323cde[_0xb77a('0x35')]=_[_0xb77a('0x34')](_0x23860a[_0xb77a('0x35')]);_0x323cde[_0xb77a('0x3f')]=_[_0xb77a('0x36')](_0x323cde[_0xb77a('0x37')],_0x323cde[_0xb77a('0x35')]);_0x441f7d[_0xb77a('0x39')]=_['intersection'](_0x323cde[_0xb77a('0x37')],qs[_0xb77a('0x38')](_0x23860a[_0xb77a('0x35')]['fields']));_0x441f7d[_0xb77a('0x39')]=_0x441f7d[_0xb77a('0x39')][_0xb77a('0x3a')]?_0x441f7d[_0xb77a('0x39')]:_0x323cde[_0xb77a('0x37')];if(_0x23860a[_0xb77a('0x35')][_0xb77a('0x45')]){_0x441f7d[_0xb77a('0x46')]=[{'all':!![]}];}_0x441f7d=_[_0xb77a('0x43')]({},_0x441f7d,_0x23860a['options']);return db['CmHopperAdditionalPhone'][_0xb77a('0x49')](_0x441f7d)[_0xb77a('0x24')](handleEntityNotFound(_0x4db366,null))[_0xb77a('0x24')](respondWithResult(_0x4db366,null))[_0xb77a('0x48')](handleError(_0x4db366,null));};exports[_0xb77a('0x4a')]=function(_0xf245da,_0x55c4db){return db[_0xb77a('0x30')][_0xb77a('0x4a')](_0xf245da['body'],{})['then'](function(_0x3ce5f0){var _0x12ae09=_0xf245da[_0xb77a('0x4b')][_0xb77a('0x25')]({'plain':!![]});if(!_0x12ae09)throw new Error(_0xb77a('0x4c'));if(_0x12ae09['role']==='user'){var _0x39e62c=_0x3ce5f0['get']({'plain':!![]});var _0x52a133='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xb77a('0x49')]({'where':{'name':_0x52a133,'userProfileId':_0x12ae09['userProfileId']},'raw':!![]})[_0xb77a('0x24')](function(_0x11f791){if(_0x11f791&&_0x11f791[_0xb77a('0x4d')]===0x0){return db[_0xb77a('0x27')][_0xb77a('0x4a')]({'name':_0x39e62c[_0xb77a('0x2c')],'resourceId':_0x39e62c['id'],'type':_0x11f791[_0xb77a('0x2c')],'sectionId':_0x11f791['id']},{})[_0xb77a('0x24')](function(){return _0x3ce5f0;});}else{return _0x3ce5f0;}})[_0xb77a('0x48')](function(_0x3998e8){logger[_0xb77a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3998e8);throw _0x3998e8;});}return _0x3ce5f0;})[_0xb77a('0x24')](respondWithResult(_0x55c4db,0xc9))[_0xb77a('0x48')](handleError(_0x55c4db,null));};exports[_0xb77a('0x4e')]=function(_0x5d9246,_0x4eee91){if(_0x5d9246[_0xb77a('0x4f')]['id']){delete _0x5d9246[_0xb77a('0x4f')]['id'];}return db[_0xb77a('0x30')][_0xb77a('0x49')]({'where':{'id':_0x5d9246[_0xb77a('0x50')]['id']}})[_0xb77a('0x24')](handleEntityNotFound(_0x4eee91,null))['then'](saveUpdates(_0x5d9246[_0xb77a('0x4f')],null))[_0xb77a('0x24')](respondWithResult(_0x4eee91,null))[_0xb77a('0x48')](handleError(_0x4eee91,null));};exports[_0xb77a('0x28')]=function(_0xae2c7b,_0x12a74f){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xae2c7b[_0xb77a('0x50')]['id']}})['then'](handleEntityNotFound(_0x12a74f,null))[_0xb77a('0x24')](removeEntity(_0x12a74f,null))[_0xb77a('0x48')](handleError(_0x12a74f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d428446..33e417d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadd2=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x4af06e,_0x410295){var _0x3a3ab4=function(_0x520a8b){while(--_0x520a8b){_0x4af06e['push'](_0x4af06e['shift']());}};_0x3a3ab4(++_0x410295);}(_0xadd2,0xa5));var _0x2add=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xadd2[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2add('0x0'))('api');var moment=require(_0x2add('0x1'));var BPromise=require(_0x2add('0x2'));var rp=require(_0x2add('0x3'));var fs=require('fs');var path=require(_0x2add('0x4'));var rimraf=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var attributes=require(_0x2add('0x7'));module[_0x2add('0x8')]=function(_0x30d864,_0x53a89d){return _0x30d864['define'](_0x2add('0x9'),attributes,{'tableName':_0x2add('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bc4=['../../config/logger','moment','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util'];(function(_0x1d51c7,_0xf0e8e4){var _0x53aff9=function(_0x408dd0){while(--_0x408dd0){_0x1d51c7['push'](_0x1d51c7['shift']());}};_0x53aff9(++_0xf0e8e4);}(_0x3bc4,0xda));var _0x43bc=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x3bc4[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var logger=require(_0x43bc('0x2'))('api');var moment=require(_0x43bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x43bc('0x4'));var fs=require('fs');var path=require(_0x43bc('0x5'));var rimraf=require('rimraf');var config=require(_0x43bc('0x6'));var attributes=require(_0x43bc('0x7'));module[_0x43bc('0x8')]=function(_0x5813a4,_0x538761){return _0x5813a4[_0x43bc('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x43bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index b457eca..c3b6d22 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed0e=['request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','VoiceQueueId','body','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','SwapAdditionalPhones','ContactId','ListId','waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','transaction','update','IncrementPreviewCounters','field','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x3a96bc,_0x2db635){var _0x42f0f3=function(_0x43e538){while(--_0x43e538){_0x3a96bc['push'](_0x3a96bc['shift']());}};_0x42f0f3(++_0x2db635);}(_0xed0e,0x95));var _0xeed0=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xed0e[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require(_0xeed0('0x0'));var moment=require('moment');var BPromise=require(_0xeed0('0x1'));var rs=require(_0xeed0('0x2'));var fs=require('fs');var Redis=require(_0xeed0('0x3'));var db=require(_0xeed0('0x4'))['db'];var utils=require(_0xeed0('0x5'));var logger=require(_0xeed0('0x6'))('rpc');var config=require(_0xeed0('0x7'));var jayson=require(_0xeed0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcbca,_0xc4e061,_0x30e9d1){return new BPromise(function(_0x41a38e,_0xf4860f){return client[_0xeed0('0x9')](_0x4fcbca,_0x30e9d1)[_0xeed0('0xa')](function(_0x16c6f5){logger[_0xeed0('0xb')](_0xeed0('0xc'),_0xc4e061,_0xeed0('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xc4e061,_0xeed0('0xd'),JSON[_0xeed0('0xe')](_0x16c6f5));if(_0x16c6f5[_0xeed0('0xf')]){if(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x10')]===0x1f4){logger[_0xeed0('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xc4e061,_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);return _0xf4860f(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);}logger[_0xeed0('0xf')](_0xeed0('0xc'),_0xc4e061,_0x16c6f5[_0xeed0('0xf')]['message']);return _0x41a38e(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xc4e061,_0xeed0('0xd'));_0x41a38e(_0x16c6f5[_0xeed0('0x12')][_0xeed0('0x11')]);}})[_0xeed0('0x13')](function(_0x10d707){logger['error'](_0xeed0('0xc'),_0xc4e061,_0x10d707);_0xf4860f(_0x10d707);});});}exports[_0xeed0('0x14')]=function(_0x5977ce){var _0x3db5cc=this;return new Promise(function(_0x287d31,_0x15b865){return db[_0xeed0('0x15')][_0xeed0('0x16')]({'raw':!![],'where':{'ContactId':_0x5977ce['body']['ContactId'],'ListId':_0x5977ce['body']['ListId'],'VoiceQueueId':_0x5977ce['body'][_0xeed0('0x17')]===undefined?null:_0x5977ce[_0xeed0('0x18')][_0xeed0('0x17')],'CampaignId':_0x5977ce[_0xeed0('0x18')]['CampaignId']===undefined?null:_0x5977ce['body'][_0xeed0('0x19')]}})[_0xeed0('0xa')](function(_0x2a5721){if(_0x2a5721!=null){return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a5721['id'],'OrderBy':{'$gt':_0x2a5721[_0xeed0('0x1b')]}},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x11a716){var _0x2e5194=0x0;if(_0x11a716){if(_0x11a716['countbusyretry']+_0x11a716[_0xeed0('0x1d')]+_0x11a716[_0xeed0('0x1e')]+_0x11a716[_0xeed0('0x1f')]+_0x11a716[_0xeed0('0x20')]+_0x11a716[_0xeed0('0x21')]+_0x11a716[_0xeed0('0x22')]+_0x11a716[_0xeed0('0x23')]<_0x5977ce['entity'][_0xeed0('0x24')])_0x2e5194=0x1;_0x287d31({'additional':_0x2e5194});}else{return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a5721['id']},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x47cf9){var _0x200c0f=0x0;if(_0x47cf9){if(_0x47cf9[_0xeed0('0x25')]+_0x47cf9[_0xeed0('0x1d')]+_0x47cf9[_0xeed0('0x1e')]+_0x47cf9[_0xeed0('0x1f')]+_0x47cf9['countdropretry']+_0x47cf9['countabandonedretry']+_0x47cf9[_0xeed0('0x22')]+_0x47cf9[_0xeed0('0x23')]<_0x5977ce['entity'][_0xeed0('0x24')])_0x200c0f=0x1;_0x287d31({'additional':_0x200c0f});}else{_0x287d31({'additional':0x0});}})[_0xeed0('0x13')](function(_0x485ec1){logger[_0xeed0('0xf')](_0xeed0('0x14'),_0x485ec1['message']);_0x15b865(_0x3db5cc[_0xeed0('0xf')](0x1f4,_0x485ec1['message']));});}})[_0xeed0('0x13')](function(_0x3ae7bd){logger['error'](_0xeed0('0x14'),_0x3ae7bd['message']);_0x15b865(_0x3db5cc[_0xeed0('0xf')](0x1f4,_0x3ae7bd[_0xeed0('0x11')]));});}else _0x287d31({'additional':0x0});});});};exports[_0xeed0('0x26')]=function(_0x5c70c4){var _0x1ac5da=this;return new Promise(function(_0x21181c,_0x11c177){return db[_0xeed0('0x15')][_0xeed0('0x16')]({'raw':!![],'where':{'ContactId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x27')],'ListId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x28')],'VoiceQueueId':_0x5c70c4['body']['VoiceQueueId']===undefined?null:_0x5c70c4[_0xeed0('0x18')]['VoiceQueueId'],'CampaignId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x19')]===undefined?null:_0x5c70c4[_0xeed0('0x18')]['CampaignId']}})[_0xeed0('0xa')](function(_0x1d0285){if(_0x1d0285!=null){return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1d0285['id'],'OrderBy':{'$gte':_0x1d0285[_0xeed0('0x1b')]}},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0xb4c892){if(_0xb4c892)return activateAdditionalPhone(_0x1d0285,_0x5c70c4['body'],_0xb4c892,_0x5c70c4['duration'],_0x5c70c4[_0xeed0('0x29')])['then'](function(_0x21e2a8){_0x21181c(_0x21e2a8);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d0285['id']},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x4cc2f4){if(_0x4cc2f4)return activateAdditionalPhone(_0x1d0285,_0x5c70c4[_0xeed0('0x18')],_0x4cc2f4,_0x5c70c4[_0xeed0('0x2a')],_0x5c70c4[_0xeed0('0x29')])['then'](function(_0x40b9e7){_0x21181c(_0x40b9e7);});else{_0x21181c({'id':_0x1d0285['id'],'phone':''});}})[_0xeed0('0x13')](function(_0x21d310){logger['error']('VerifyAdditionalPhones',_0x21d310[_0xeed0('0x11')]);_0x11c177(_0x1ac5da[_0xeed0('0xf')](0x1f4,_0x21d310['message']));});}})[_0xeed0('0x13')](function(_0x3d6ed9){logger[_0xeed0('0xf')](_0xeed0('0x14'),_0x3d6ed9[_0xeed0('0x11')]);_0x11c177(_0x1ac5da[_0xeed0('0xf')](0x1f4,_0x3d6ed9['message']));});}else _0x21181c(0x1);});});};function activateAdditionalPhone(_0x4ba76b,_0x10843d,_0x43246e,_0x46f838,_0x3dbf87){return new Promise(function(_0x55f6fb,_0x17ce22){var _0x103bd8;if(_['isNil'](_0x43246e[_0xeed0('0x2b')])){_0x43246e[_0xeed0('0x2b')]=moment();}if(moment()>moment(_0x43246e[_0xeed0('0x2b')])){_0x103bd8=moment()[_0xeed0('0x2c')](_0x3dbf87||0x3,_0xeed0('0x2d'));}else{if(_0x43246e[_0xeed0('0x1b')]==0x0){_0x103bd8=moment(_0x43246e[_0xeed0('0x2b')]);}else{_0x103bd8=moment()['add'](_0x3dbf87||0x3,'minutes');}}if(_[_0xeed0('0x2e')](_0x103bd8)){_0x103bd8=moment()['add'](_0x3dbf87||0x3,_0xeed0('0x2d'));}var _0x55166b={'phone':_0x4ba76b[_0xeed0('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x4ba76b[_0xeed0('0x1b')])?0x0:_0x4ba76b[_0xeed0('0x1b')],'scheduledat':moment()[_0xeed0('0x2c')](_0x46f838||0x1,_0xeed0('0x2d')),'countbusyretry':_0x10843d[_0xeed0('0x25')],'countcongestionretry':_0x10843d[_0xeed0('0x1d')],'countnoanswerretry':_0x10843d[_0xeed0('0x1e')],'countnosuchnumberretry':_0x10843d[_0xeed0('0x1f')],'countdropretry':_0x10843d[_0xeed0('0x20')],'countabandonedretry':_0x10843d[_0xeed0('0x21')],'countmachineretry':_0x10843d[_0xeed0('0x22')],'countagentrejectretry':_0x10843d[_0xeed0('0x23')],'createdAt':_0x10843d[_0xeed0('0x30')],'updatedAt':_0x10843d[_0xeed0('0x31')]};var _0x4c3863={'CmHopperId':_0x4ba76b['id'],'phone':_0x43246e['phone'],'active':0x0,'OrderBy':_[_0xeed0('0x2e')](_0x43246e[_0xeed0('0x1b')])?0x0:_0x43246e[_0xeed0('0x1b')],'scheduledat':_0x103bd8,'countbusyretry':_0x43246e[_0xeed0('0x25')],'countcongestionretry':_0x43246e[_0xeed0('0x1d')],'countnoanswerretry':_0x43246e[_0xeed0('0x1e')],'countnosuchnumberretry':_0x43246e[_0xeed0('0x1f')],'countdropretry':_0x43246e[_0xeed0('0x20')],'countabandonedretry':_0x43246e[_0xeed0('0x21')],'countmachineretry':_0x43246e['countmachineretry'],'countagentrejectretry':_0x43246e['countagentrejectretry'],'createdAt':_0x43246e[_0xeed0('0x30')],'updatedAt':_0x43246e[_0xeed0('0x31')]};return db['sequelize'][_0xeed0('0x32')](function(_0x1b8a74){return db[_0xeed0('0x1a')][_0xeed0('0x33')](_0x55166b,{'where':{'id':_0x43246e['id']}},{'transaction':_0x1b8a74})['then'](function(){return db[_0xeed0('0x15')][_0xeed0('0x33')](_0x4c3863,{'where':{'id':_0x4ba76b['id']}},{'transaction':_0x1b8a74});});})['then'](function(_0xe49950){_0x55f6fb({'id':_0x4ba76b['id'],'phone':_0x43246e['phone']});})[_0xeed0('0x13')](function(_0x49f14b){logger['error']('activateAdditionalPhone',_0x49f14b[_0xeed0('0x11')]);_0x17ce22({'error':_0x49f14b['message']});});});}exports[_0xeed0('0x34')]=function(_0x5b22fc){var _0x307642=this;return new Promise(function(_0x531434,_0x4ea7cc){return db[_0xeed0('0x15')]['update'](_0x5b22fc[_0xeed0('0x18')][_0xeed0('0x35')],{'where':{'id':_0x5b22fc[_0xeed0('0x18')]['id']}})['then'](function(_0x3f11d6){_0x531434(_0x3f11d6);})[_0xeed0('0x13')](function(_0x569711){logger[_0xeed0('0xf')](_0xeed0('0x34'),_0x569711[_0xeed0('0x11')]);_0x4ea7cc(_0x307642[_0xeed0('0xf')](0x1f4,_0x569711[_0xeed0('0x11')]));});});}; \ No newline at end of file +var _0xf030=['ASC','countdropretry','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','minutes','add','phone','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf030,0x1e3));var _0x0f03=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf030[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0f03('0x0'));var util=require(_0x0f03('0x1'));var moment=require(_0x0f03('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f03('0x3'));var fs=require('fs');var Redis=require(_0x0f03('0x4'));var db=require(_0x0f03('0x5'))['db'];var utils=require(_0x0f03('0x6'));var logger=require(_0x0f03('0x7'))('rpc');var config=require(_0x0f03('0x8'));var jayson=require(_0x0f03('0x9'));var client=jayson[_0x0f03('0xa')][_0x0f03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d0002,_0x294c64,_0x438976){return new BPromise(function(_0xe2d6cd,_0x554a9c){return client[_0x0f03('0xc')](_0x2d0002,_0x438976)[_0x0f03('0xd')](function(_0x5b1d4d){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x294c64,_0x0f03('0xe'));logger['debug'](_0x0f03('0xf'),_0x294c64,'request\x20sent',JSON[_0x0f03('0x10')](_0x5b1d4d));if(_0x5b1d4d[_0x0f03('0x11')]){if(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x12')]===0x1f4){logger[_0x0f03('0x11')](_0x0f03('0x13'),_0x294c64,_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);return _0x554a9c(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);}logger[_0x0f03('0x11')](_0x0f03('0x13'),_0x294c64,_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);return _0xe2d6cd(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x294c64,_0x0f03('0xe'));_0xe2d6cd(_0x5b1d4d[_0x0f03('0x15')][_0x0f03('0x14')]);}})[_0x0f03('0x16')](function(_0x30bac2){logger['error'](_0x0f03('0x13'),_0x294c64,_0x30bac2);_0x554a9c(_0x30bac2);});});}exports[_0x0f03('0x17')]=function(_0x15b9c0){var _0x1c1c32=this;return new Promise(function(_0x50d0ce,_0xcf06dc){return db[_0x0f03('0x18')][_0x0f03('0x19')]({'raw':!![],'where':{'ContactId':_0x15b9c0['body'][_0x0f03('0x1a')],'ListId':_0x15b9c0['body'][_0x0f03('0x1b')],'VoiceQueueId':_0x15b9c0[_0x0f03('0x1c')]['VoiceQueueId']===undefined?null:_0x15b9c0['body'][_0x0f03('0x1d')],'CampaignId':_0x15b9c0[_0x0f03('0x1c')][_0x0f03('0x1e')]===undefined?null:_0x15b9c0[_0x0f03('0x1c')]['CampaignId']}})[_0x0f03('0xd')](function(_0x8da287){if(_0x8da287!=null){return db['CmHopperAdditionalPhone'][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x8da287['id'],'OrderBy':{'$gt':_0x8da287[_0x0f03('0x1f')]}},'order':[[_0x0f03('0x1f'),'ASC']]})[_0x0f03('0xd')](function(_0x1fe4cd){var _0x1b9ed5=0x0;if(_0x1fe4cd){if(_0x1fe4cd[_0x0f03('0x20')]+_0x1fe4cd[_0x0f03('0x21')]+_0x1fe4cd[_0x0f03('0x22')]+_0x1fe4cd[_0x0f03('0x23')]+_0x1fe4cd['countdropretry']+_0x1fe4cd[_0x0f03('0x24')]+_0x1fe4cd[_0x0f03('0x25')]+_0x1fe4cd['countagentrejectretry']<_0x15b9c0[_0x0f03('0x26')]['dialGlobalMaxRetry'])_0x1b9ed5=0x1;_0x50d0ce({'additional':_0x1b9ed5});}else{return db['CmHopperAdditionalPhone'][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x8da287['id']},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0x26e2d5){var _0x7008e5=0x0;if(_0x26e2d5){if(_0x26e2d5[_0x0f03('0x20')]+_0x26e2d5[_0x0f03('0x21')]+_0x26e2d5[_0x0f03('0x22')]+_0x26e2d5[_0x0f03('0x23')]+_0x26e2d5[_0x0f03('0x28')]+_0x26e2d5[_0x0f03('0x24')]+_0x26e2d5[_0x0f03('0x25')]+_0x26e2d5['countagentrejectretry']<_0x15b9c0[_0x0f03('0x26')][_0x0f03('0x29')])_0x7008e5=0x1;_0x50d0ce({'additional':_0x7008e5});}else{_0x50d0ce({'additional':0x0});}})[_0x0f03('0x16')](function(_0x2aae20){logger['error'](_0x0f03('0x17'),_0x2aae20['message']);_0xcf06dc(_0x1c1c32[_0x0f03('0x11')](0x1f4,_0x2aae20[_0x0f03('0x14')]));});}})[_0x0f03('0x16')](function(_0x16fd08){logger[_0x0f03('0x11')](_0x0f03('0x17'),_0x16fd08[_0x0f03('0x14')]);_0xcf06dc(_0x1c1c32['error'](0x1f4,_0x16fd08[_0x0f03('0x14')]));});}else _0x50d0ce({'additional':0x0});});});};exports[_0x0f03('0x2a')]=function(_0x3d87a3){var _0x1cea71=this;return new Promise(function(_0xe96862,_0x23462f){return db[_0x0f03('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1a')],'ListId':_0x3d87a3[_0x0f03('0x1c')]['ListId'],'VoiceQueueId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1d')]===undefined?null:_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1d')],'CampaignId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1e')]===undefined?null:_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1e')]}})[_0x0f03('0xd')](function(_0x3a2950){if(_0x3a2950!=null){return db[_0x0f03('0x2b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3a2950['id'],'OrderBy':{'$gte':_0x3a2950['OrderBy']}},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0xd64c44){if(_0xd64c44)return activateAdditionalPhone(_0x3a2950,_0x3d87a3[_0x0f03('0x1c')],_0xd64c44,_0x3d87a3[_0x0f03('0x2c')],_0x3d87a3['waitTime'])[_0x0f03('0xd')](function(_0x133151){_0xe96862(_0x133151);});else{return db[_0x0f03('0x2b')][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3a2950['id']},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0x256d0f){if(_0x256d0f)return activateAdditionalPhone(_0x3a2950,_0x3d87a3[_0x0f03('0x1c')],_0x256d0f,_0x3d87a3['duration'],_0x3d87a3[_0x0f03('0x2d')])[_0x0f03('0xd')](function(_0x333ce2){_0xe96862(_0x333ce2);});else{_0xe96862({'id':_0x3a2950['id'],'phone':''});}})['catch'](function(_0x2f096e){logger[_0x0f03('0x11')]('VerifyAdditionalPhones',_0x2f096e[_0x0f03('0x14')]);_0x23462f(_0x1cea71[_0x0f03('0x11')](0x1f4,_0x2f096e[_0x0f03('0x14')]));});}})[_0x0f03('0x16')](function(_0x5d51d4){logger[_0x0f03('0x11')](_0x0f03('0x17'),_0x5d51d4[_0x0f03('0x14')]);_0x23462f(_0x1cea71[_0x0f03('0x11')](0x1f4,_0x5d51d4[_0x0f03('0x14')]));});}else _0xe96862(0x1);});});};function activateAdditionalPhone(_0x57d04c,_0x4e6e93,_0x3cd841,_0x12827e,_0x50fa2f){return new Promise(function(_0x26e288,_0x1ff91a){var _0x5767fa;if(_[_0x0f03('0x2e')](_0x3cd841['scheduledat'])){_0x3cd841[_0x0f03('0x2f')]=moment();}if(moment()>moment(_0x3cd841[_0x0f03('0x2f')])){_0x5767fa=moment()['add'](_0x50fa2f||0x3,_0x0f03('0x30'));}else{if(_0x3cd841[_0x0f03('0x1f')]==0x0){_0x5767fa=moment(_0x3cd841[_0x0f03('0x2f')]);}else{_0x5767fa=moment()[_0x0f03('0x31')](_0x50fa2f||0x3,_0x0f03('0x30'));}}if(_[_0x0f03('0x2e')](_0x5767fa)){_0x5767fa=moment()['add'](_0x50fa2f||0x3,_0x0f03('0x30'));}var _0x45859d={'phone':_0x57d04c[_0x0f03('0x32')],'active':0x0,'OrderBy':_[_0x0f03('0x2e')](_0x57d04c[_0x0f03('0x1f')])?0x0:_0x57d04c['OrderBy'],'scheduledat':moment()[_0x0f03('0x31')](_0x12827e||0x1,_0x0f03('0x30')),'countbusyretry':_0x4e6e93[_0x0f03('0x20')],'countcongestionretry':_0x4e6e93[_0x0f03('0x21')],'countnoanswerretry':_0x4e6e93[_0x0f03('0x22')],'countnosuchnumberretry':_0x4e6e93[_0x0f03('0x23')],'countdropretry':_0x4e6e93[_0x0f03('0x28')],'countabandonedretry':_0x4e6e93['countabandonedretry'],'countmachineretry':_0x4e6e93[_0x0f03('0x25')],'countagentrejectretry':_0x4e6e93[_0x0f03('0x33')],'createdAt':_0x4e6e93[_0x0f03('0x34')],'updatedAt':_0x4e6e93[_0x0f03('0x35')]};var _0xf5892c={'CmHopperId':_0x57d04c['id'],'phone':_0x3cd841[_0x0f03('0x32')],'active':0x0,'OrderBy':_[_0x0f03('0x2e')](_0x3cd841['OrderBy'])?0x0:_0x3cd841[_0x0f03('0x1f')],'scheduledat':_0x5767fa,'countbusyretry':_0x3cd841[_0x0f03('0x20')],'countcongestionretry':_0x3cd841[_0x0f03('0x21')],'countnoanswerretry':_0x3cd841[_0x0f03('0x22')],'countnosuchnumberretry':_0x3cd841[_0x0f03('0x23')],'countdropretry':_0x3cd841[_0x0f03('0x28')],'countabandonedretry':_0x3cd841[_0x0f03('0x24')],'countmachineretry':_0x3cd841[_0x0f03('0x25')],'countagentrejectretry':_0x3cd841[_0x0f03('0x33')],'createdAt':_0x3cd841[_0x0f03('0x34')],'updatedAt':_0x3cd841[_0x0f03('0x35')]};return db[_0x0f03('0x36')][_0x0f03('0x37')](function(_0x352fe1){return db[_0x0f03('0x2b')]['update'](_0x45859d,{'where':{'id':_0x3cd841['id']}},{'transaction':_0x352fe1})[_0x0f03('0xd')](function(){return db[_0x0f03('0x18')][_0x0f03('0x38')](_0xf5892c,{'where':{'id':_0x57d04c['id']}},{'transaction':_0x352fe1});});})['then'](function(_0x37a51c){_0x26e288({'id':_0x57d04c['id'],'phone':_0x3cd841[_0x0f03('0x32')]});})['catch'](function(_0x39044a){logger['error']('activateAdditionalPhone',_0x39044a[_0x0f03('0x14')]);_0x1ff91a({'error':_0x39044a[_0x0f03('0x14')]});});});}exports[_0x0f03('0x39')]=function(_0x3e4572){var _0xb79cc8=this;return new Promise(function(_0x44e183,_0x481a23){return db[_0x0f03('0x18')]['update'](_0x3e4572['body']['field'],{'where':{'id':_0x3e4572['body']['id']}})[_0x0f03('0xd')](function(_0x8b189b){_0x44e183(_0x8b189b);})[_0x0f03('0x16')](function(_0x4ca701){logger['error']('IncrementPreviewCounters',_0x4ca701[_0x0f03('0x14')]);_0x481a23(_0xb79cc8[_0x0f03('0x11')](0x1f4,_0x4ca701['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 2d4acfc..5c200fe 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0123=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2d2ef0,_0x2ed0b7){var _0x3f85c0=function(_0xf98fc4){while(--_0xf98fc4){_0x2d2ef0['push'](_0x2d2ef0['shift']());}};_0x3f85c0(++_0x2ed0b7);}(_0x0123,0x191));var _0x3012=function(_0x391df5,_0xa08526){_0x391df5=_0x391df5-0x0;var _0x33f4c2=_0x0123[_0x391df5];return _0x33f4c2;};'use strict';var multer=require('multer');var util=require(_0x3012('0x0'));var path=require(_0x3012('0x1'));var timeout=require(_0x3012('0x2'));var express=require(_0x3012('0x3'));var router=express[_0x3012('0x4')]();var fs_extra=require(_0x3012('0x5'));var auth=require(_0x3012('0x6'));var interaction=require(_0x3012('0x7'));var config=require(_0x3012('0x8'));var controller=require(_0x3012('0x9'));router[_0x3012('0xa')]('/',auth[_0x3012('0xb')](),controller[_0x3012('0xc')]);router[_0x3012('0xa')](_0x3012('0xd'),auth[_0x3012('0xb')](),controller[_0x3012('0xe')]);router[_0x3012('0xf')]('/',auth[_0x3012('0xb')](),controller[_0x3012('0x10')]);router[_0x3012('0x11')](_0x3012('0xd'),auth[_0x3012('0xb')](),controller[_0x3012('0x12')]);router[_0x3012('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3012('0x14')]);module[_0x3012('0x15')]=router; \ No newline at end of file +var _0xd87e=['express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4c5276,_0x29c86c){var _0x17d86a=function(_0x4afd9b){while(--_0x4afd9b){_0x4c5276['push'](_0x4c5276['shift']());}};_0x17d86a(++_0x29c86c);}(_0xd87e,0x1bf));var _0xed87=function(_0x2ec9a3,_0x4c511d){_0x2ec9a3=_0x2ec9a3-0x0;var _0x245fc0=_0xd87e[_0x2ec9a3];return _0x245fc0;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/',auth['isAuthenticated'](),controller[_0xed87('0xc')]);router[_0xed87('0xd')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')](_0xed87('0x9'),auth['isAuthenticated'](),controller[_0xed87('0x10')]);module[_0xed87('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 29c56e9..6f479bd 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 _0xcff4=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x1635a4,_0x47ff86){var _0x59dc0b=function(_0x2f17d1){while(--_0x2f17d1){_0x1635a4['push'](_0x1635a4['shift']());}};_0x59dc0b(++_0x47ff86);}(_0xcff4,0x11e));var _0x4cff=function(_0x20f2d9,_0x2f0cb2){_0x20f2d9=_0x20f2d9-0x0;var _0x448821=_0xcff4[_0x20f2d9];return _0x448821;};'use strict';var moment=require(_0x4cff('0x0'));var Sequelize=require(_0x4cff('0x1'));module[_0x4cff('0x2')]={'phone':{'type':Sequelize[_0x4cff('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4cff('0x4')],'unique':_0x4cff('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4cff('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x4cff('0x5')}}; \ No newline at end of file +var _0x984b=['STRING','contactListQueue','moment','sequelize','exports'];(function(_0x57e479,_0x52aeb5){var _0x2788f7=function(_0x4d8435){while(--_0x4d8435){_0x57e479['push'](_0x57e479['shift']());}};_0x2788f7(++_0x52aeb5);}(_0x984b,0x15b));var _0xb984=function(_0x19980c,_0x1ea0f7){_0x19980c=_0x19980c-0x0;var _0x19c53c=_0x984b[_0x19980c];return _0x19c53c;};'use strict';var moment=require(_0xb984('0x0'));var Sequelize=require(_0xb984('0x1'));module[_0xb984('0x2')]={'phone':{'type':Sequelize[_0xb984('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f71bf23..0ca3e73 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 _0x7a9d=['includeAll','include','rows','show','params','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options'];(function(_0x6ba805,_0x34e8a9){var _0x2baf16=function(_0x2d702f){while(--_0x2d702f){_0x6ba805['push'](_0x6ba805['shift']());}};_0x2baf16(++_0x34e8a9);}(_0x7a9d,0xf9));var _0xd7a9=function(_0x3a64f6,_0x1d8dfd){_0x3a64f6=_0x3a64f6-0x0;var _0x10335c=_0x7a9d[_0x3a64f6];return _0x10335c;};'use strict';var emlformat=require(_0xd7a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7a9('0x1'));var jsonpatch=require(_0xd7a9('0x2'));var rp=require('request-promise');var moment=require(_0xd7a9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd7a9('0x4'));var util=require('util');var path=require(_0xd7a9('0x5'));var sox=require(_0xd7a9('0x6'));var csv=require(_0xd7a9('0x7'));var ejs=require(_0xd7a9('0x8'));var fs=require('fs');var fs_extra=require(_0xd7a9('0x9'));var _=require(_0xd7a9('0xa'));var squel=require(_0xd7a9('0xb'));var crypto=require(_0xd7a9('0xc'));var jsforce=require(_0xd7a9('0xd'));var deskjs=require(_0xd7a9('0xe'));var toCsv=require(_0xd7a9('0x7'));var querystring=require(_0xd7a9('0xf'));var Papa=require(_0xd7a9('0x10'));var Redis=require(_0xd7a9('0x11'));var authService=require(_0xd7a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd7a9('0x13'));var hardwareService=require(_0xd7a9('0x14'));var logger=require(_0xd7a9('0x15'))(_0xd7a9('0x16'));var utils=require(_0xd7a9('0x17'));var config=require(_0xd7a9('0x18'));var licenseUtil=require(_0xd7a9('0x19'));var db=require(_0xd7a9('0x1a'))['db'];function respondWithStatusCode(_0x456979,_0x3f5de8){_0x3f5de8=_0x3f5de8||0xcc;return function(_0x3ef915){if(_0x3ef915){return _0x456979['sendStatus'](_0x3f5de8);}return _0x456979[_0xd7a9('0x1b')](_0x3f5de8)[_0xd7a9('0x1c')]();};}function respondWithResult(_0xdce765,_0x56d018){_0x56d018=_0x56d018||0xc8;return function(_0x45cc71){if(_0x45cc71){return _0xdce765[_0xd7a9('0x1b')](_0x56d018)[_0xd7a9('0x1d')](_0x45cc71);}};}function respondWithFilteredResult(_0x17b8bf,_0x546604){return function(_0x583735){if(_0x583735){var _0x3e3402=typeof _0x546604[_0xd7a9('0x1e')]===_0xd7a9('0x1f')&&typeof _0x546604[_0xd7a9('0x20')]===_0xd7a9('0x1f');var _0x30fc30=_0x583735['count'];var _0x53cf75=_0x3e3402?0x0:_0x546604[_0xd7a9('0x1e')];var _0x1d62a0=_0x3e3402?_0x583735[_0xd7a9('0x21')]:_0x546604[_0xd7a9('0x1e')]+_0x546604[_0xd7a9('0x20')];var _0xebb35d;if(_0x1d62a0>=_0x30fc30){_0x1d62a0=_0x30fc30;_0xebb35d=0xc8;}else{_0xebb35d=0xce;}_0x17b8bf['status'](_0xebb35d);return _0x17b8bf[_0xd7a9('0x22')](_0xd7a9('0x23'),_0x53cf75+'-'+_0x1d62a0+'/'+_0x30fc30)[_0xd7a9('0x1d')](_0x583735);}return null;};}function patchUpdates(_0x45d19e){return function(_0x14dee0){try{jsonpatch[_0xd7a9('0x24')](_0x14dee0,_0x45d19e,!![]);}catch(_0x32e1bf){return BPromise[_0xd7a9('0x25')](_0x32e1bf);}return _0x14dee0[_0xd7a9('0x26')]();};}function saveUpdates(_0x169c77,_0x15e368){return function(_0x351bf6){if(_0x351bf6){return _0x351bf6[_0xd7a9('0x27')](_0x169c77)['then'](function(_0x3febe3){return _0x3febe3;});}return null;};}function removeEntity(_0x3436b5,_0x4b687f){return function(_0x3e6c12){if(_0x3e6c12){return _0x3e6c12[_0xd7a9('0x28')]()[_0xd7a9('0x29')](function(){_0x3436b5[_0xd7a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3914ca,_0x4daff4){return function(_0xb39c57){if(!_0xb39c57){_0x3914ca[_0xd7a9('0x2a')](0x194);}return _0xb39c57;};}function handleError(_0x43de7e,_0x227977){_0x227977=_0x227977||0x1f4;return function(_0x3ed862){logger['error'](_0x3ed862[_0xd7a9('0x2b')]);if(_0x3ed862[_0xd7a9('0x2c')]){delete _0x3ed862[_0xd7a9('0x2c')];}_0x43de7e[_0xd7a9('0x1b')](_0x227977)[_0xd7a9('0x2d')](_0x3ed862);};}exports[_0xd7a9('0x2e')]=function(_0x5d6dba,_0x2a8702){var _0x13b5f7={},_0xde64d2={},_0x1ee548={'count':0x0,'rows':[]};var _0x491347=_['map'](db[_0xd7a9('0x2f')][_0xd7a9('0x30')],function(_0x1a00bf){return{'name':_0x1a00bf[_0xd7a9('0x31')],'type':_0x1a00bf[_0xd7a9('0x32')][_0xd7a9('0x33')]};});_0xde64d2[_0xd7a9('0x34')]=_['map'](_0x491347,_0xd7a9('0x2c'));_0xde64d2[_0xd7a9('0x35')]=_[_0xd7a9('0x36')](_0x5d6dba[_0xd7a9('0x35')]);_0xde64d2[_0xd7a9('0x37')]=_['intersection'](_0xde64d2[_0xd7a9('0x34')],_0xde64d2['query']);_0x13b5f7[_0xd7a9('0x38')]=_[_0xd7a9('0x39')](_0xde64d2[_0xd7a9('0x34')],qs[_0xd7a9('0x3a')](_0x5d6dba['query']['fields']));_0x13b5f7[_0xd7a9('0x38')]=_0x13b5f7[_0xd7a9('0x38')][_0xd7a9('0x3b')]?_0x13b5f7[_0xd7a9('0x38')]:_0xde64d2[_0xd7a9('0x34')];if(!_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x3c')](_0xd7a9('0x3d'))){_0x13b5f7[_0xd7a9('0x20')]=qs[_0xd7a9('0x20')](_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x20')]);_0x13b5f7[_0xd7a9('0x1e')]=qs['offset'](_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x1e')]);}_0x13b5f7[_0xd7a9('0x3e')]=qs[_0xd7a9('0x3f')](_0x5d6dba[_0xd7a9('0x35')]['sort']);_0x13b5f7[_0xd7a9('0x40')]=qs[_0xd7a9('0x37')](_[_0xd7a9('0x41')](_0x5d6dba['query'],_0xde64d2['filters']),_0x491347);if(_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x42')]){_0x13b5f7['where']=_['merge'](_0x13b5f7[_0xd7a9('0x40')],{'$or':_[_0xd7a9('0x43')](_0x491347,function(_0x359979){if(_0x359979[_0xd7a9('0x32')]!==_0xd7a9('0x44')){var _0x1cdbcc={};_0x1cdbcc[_0x359979[_0xd7a9('0x2c')]]={'$like':'%'+_0x5d6dba['query'][_0xd7a9('0x42')]+'%'};return _0x1cdbcc;}})});}_0x13b5f7=_[_0xd7a9('0x45')]({},_0x13b5f7,_0x5d6dba[_0xd7a9('0x46')]);var _0x2e596c={'where':_0x13b5f7[_0xd7a9('0x40')]};return db[_0xd7a9('0x2f')][_0xd7a9('0x21')](_0x2e596c)['then'](function(_0x21242d){_0x1ee548[_0xd7a9('0x21')]=_0x21242d;if(_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x47')]){_0x13b5f7[_0xd7a9('0x48')]=[{'all':!![]}];}return db[_0xd7a9('0x2f')]['findAll'](_0x13b5f7);})[_0xd7a9('0x29')](function(_0x5bf323){_0x1ee548[_0xd7a9('0x49')]=_0x5bf323;return _0x1ee548;})['then'](respondWithFilteredResult(_0x2a8702,_0x13b5f7))['catch'](handleError(_0x2a8702,null));};exports[_0xd7a9('0x4a')]=function(_0x477622,_0xb7baf6){var _0x43291f={'raw':!![],'where':{'id':_0x477622[_0xd7a9('0x4b')]['id']}},_0x92dc9d={};_0x92dc9d[_0xd7a9('0x34')]=_['keys'](db[_0xd7a9('0x2f')][_0xd7a9('0x30')]);_0x92dc9d['query']=_[_0xd7a9('0x36')](_0x477622[_0xd7a9('0x35')]);_0x92dc9d[_0xd7a9('0x37')]=_[_0xd7a9('0x39')](_0x92dc9d[_0xd7a9('0x34')],_0x92dc9d[_0xd7a9('0x35')]);_0x43291f[_0xd7a9('0x38')]=_[_0xd7a9('0x39')](_0x92dc9d['model'],qs[_0xd7a9('0x3a')](_0x477622[_0xd7a9('0x35')][_0xd7a9('0x3a')]));_0x43291f['attributes']=_0x43291f[_0xd7a9('0x38')][_0xd7a9('0x3b')]?_0x43291f[_0xd7a9('0x38')]:_0x92dc9d['model'];if(_0x477622[_0xd7a9('0x35')][_0xd7a9('0x47')]){_0x43291f[_0xd7a9('0x48')]=[{'all':!![]}];}_0x43291f=_[_0xd7a9('0x45')]({},_0x43291f,_0x477622['options']);return db[_0xd7a9('0x2f')][_0xd7a9('0x4c')](_0x43291f)['then'](handleEntityNotFound(_0xb7baf6,null))[_0xd7a9('0x29')](respondWithResult(_0xb7baf6,null))[_0xd7a9('0x4d')](handleError(_0xb7baf6,null));};exports[_0xd7a9('0x27')]=function(_0x375492,_0x51a87d){if(_0x375492[_0xd7a9('0x4e')]['id']){delete _0x375492[_0xd7a9('0x4e')]['id'];}return db[_0xd7a9('0x2f')][_0xd7a9('0x4c')]({'where':{'id':_0x375492['params']['id']}})['then'](handleEntityNotFound(_0x51a87d,null))['then'](saveUpdates(_0x375492[_0xd7a9('0x4e')],null))[_0xd7a9('0x29')](respondWithResult(_0x51a87d,null))[_0xd7a9('0x4d')](handleError(_0x51a87d,null));};exports['destroy']=function(_0x2708e3,_0x8f8ca5){return db['CmHopperBlack']['find']({'where':{'id':_0x2708e3[_0xd7a9('0x4b')]['id']}})[_0xd7a9('0x29')](handleEntityNotFound(_0x8f8ca5,null))['then'](removeEntity(_0x8f8ca5,null))['catch'](handleError(_0x8f8ca5,null));};exports['describe']=function(_0x5aadc8,_0x35160e){return db['CmHopperBlack'][_0xd7a9('0x4f')]()[_0xd7a9('0x29')](respondWithResult(_0x35160e,null))['catch'](handleError(_0x35160e,null));}; \ No newline at end of file +var _0x82d8=['model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','type','VIRTUAL','CmHopperBlack','includeAll','include','rows','rawAttributes','merge','options','find','catch','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','fieldName'];(function(_0x4ce479,_0x116f2a){var _0x38bb9d=function(_0x50ddf4){while(--_0x50ddf4){_0x4ce479['push'](_0x4ce479['shift']());}};_0x38bb9d(++_0x116f2a);}(_0x82d8,0x19e));var _0x882d=function(_0x49dba5,_0x41d504){_0x49dba5=_0x49dba5-0x0;var _0x1460a7=_0x82d8[_0x49dba5];return _0x1460a7;};'use strict';var emlformat=require(_0x882d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x882d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882d('0x2'));var moment=require(_0x882d('0x3'));var BPromise=require(_0x882d('0x4'));var Mustache=require('mustache');var util=require(_0x882d('0x5'));var path=require('path');var sox=require(_0x882d('0x6'));var csv=require(_0x882d('0x7'));var ejs=require(_0x882d('0x8'));var fs=require('fs');var fs_extra=require(_0x882d('0x9'));var _=require('lodash');var squel=require(_0x882d('0xa'));var crypto=require(_0x882d('0xb'));var jsforce=require(_0x882d('0xc'));var deskjs=require(_0x882d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x882d('0xe'));var Papa=require(_0x882d('0xf'));var Redis=require(_0x882d('0x10'));var authService=require(_0x882d('0x11'));var qs=require(_0x882d('0x12'));var as=require(_0x882d('0x13'));var hardwareService=require(_0x882d('0x14'));var logger=require(_0x882d('0x15'))(_0x882d('0x16'));var utils=require(_0x882d('0x17'));var config=require(_0x882d('0x18'));var licenseUtil=require(_0x882d('0x19'));var db=require(_0x882d('0x1a'))['db'];function respondWithStatusCode(_0x21e2ca,_0x2f3e00){_0x2f3e00=_0x2f3e00||0xcc;return function(_0x329363){if(_0x329363){return _0x21e2ca['sendStatus'](_0x2f3e00);}return _0x21e2ca[_0x882d('0x1b')](_0x2f3e00)[_0x882d('0x1c')]();};}function respondWithResult(_0x3a74ce,_0x15f5cb){_0x15f5cb=_0x15f5cb||0xc8;return function(_0x9d4973){if(_0x9d4973){return _0x3a74ce['status'](_0x15f5cb)['json'](_0x9d4973);}};}function respondWithFilteredResult(_0x49b9c5,_0x55ef5b){return function(_0x57ad18){if(_0x57ad18){var _0x58ea6e=typeof _0x55ef5b[_0x882d('0x1d')]===_0x882d('0x1e')&&typeof _0x55ef5b[_0x882d('0x1f')]==='undefined';var _0x587300=_0x57ad18['count'];var _0x1b3bfa=_0x58ea6e?0x0:_0x55ef5b[_0x882d('0x1d')];var _0xcd03cf=_0x58ea6e?_0x57ad18[_0x882d('0x20')]:_0x55ef5b[_0x882d('0x1d')]+_0x55ef5b[_0x882d('0x1f')];var _0x331d46;if(_0xcd03cf>=_0x587300){_0xcd03cf=_0x587300;_0x331d46=0xc8;}else{_0x331d46=0xce;}_0x49b9c5[_0x882d('0x1b')](_0x331d46);return _0x49b9c5[_0x882d('0x21')](_0x882d('0x22'),_0x1b3bfa+'-'+_0xcd03cf+'/'+_0x587300)[_0x882d('0x23')](_0x57ad18);}return null;};}function patchUpdates(_0x50b9d5){return function(_0x38bba1){try{jsonpatch[_0x882d('0x24')](_0x38bba1,_0x50b9d5,!![]);}catch(_0x32323a){return BPromise[_0x882d('0x25')](_0x32323a);}return _0x38bba1[_0x882d('0x26')]();};}function saveUpdates(_0x34f374,_0x8b2002){return function(_0x22d8f8){if(_0x22d8f8){return _0x22d8f8[_0x882d('0x27')](_0x34f374)[_0x882d('0x28')](function(_0x2691ce){return _0x2691ce;});}return null;};}function removeEntity(_0x22bb33,_0x53846f){return function(_0x38d3cb){if(_0x38d3cb){return _0x38d3cb['destroy']()[_0x882d('0x28')](function(){_0x22bb33[_0x882d('0x1b')](0xcc)[_0x882d('0x1c')]();});}};}function handleEntityNotFound(_0x20e7d4,_0xd4dafe){return function(_0x513e72){if(!_0x513e72){_0x20e7d4[_0x882d('0x29')](0x194);}return _0x513e72;};}function handleError(_0x153307,_0x32b865){_0x32b865=_0x32b865||0x1f4;return function(_0x3031cd){logger[_0x882d('0x2a')](_0x3031cd[_0x882d('0x2b')]);if(_0x3031cd[_0x882d('0x2c')]){delete _0x3031cd[_0x882d('0x2c')];}_0x153307[_0x882d('0x1b')](_0x32b865)['send'](_0x3031cd);};}exports[_0x882d('0x2d')]=function(_0x3bce2d,_0x4f6400){var _0x2f225d={},_0x1c4b9d={},_0x2648d3={'count':0x0,'rows':[]};var _0x53ff78=_[_0x882d('0x2e')](db['CmHopperBlack']['rawAttributes'],function(_0x38eb5c){return{'name':_0x38eb5c[_0x882d('0x2f')],'type':_0x38eb5c['type']['key']};});_0x1c4b9d[_0x882d('0x30')]=_[_0x882d('0x2e')](_0x53ff78,_0x882d('0x2c'));_0x1c4b9d['query']=_[_0x882d('0x31')](_0x3bce2d['query']);_0x1c4b9d['filters']=_[_0x882d('0x32')](_0x1c4b9d[_0x882d('0x30')],_0x1c4b9d[_0x882d('0x33')]);_0x2f225d[_0x882d('0x34')]=_['intersection'](_0x1c4b9d[_0x882d('0x30')],qs['fields'](_0x3bce2d[_0x882d('0x33')][_0x882d('0x35')]));_0x2f225d['attributes']=_0x2f225d['attributes'][_0x882d('0x36')]?_0x2f225d['attributes']:_0x1c4b9d[_0x882d('0x30')];if(!_0x3bce2d['query'][_0x882d('0x37')](_0x882d('0x38'))){_0x2f225d['limit']=qs[_0x882d('0x1f')](_0x3bce2d['query'][_0x882d('0x1f')]);_0x2f225d[_0x882d('0x1d')]=qs[_0x882d('0x1d')](_0x3bce2d['query']['offset']);}_0x2f225d[_0x882d('0x39')]=qs['sort'](_0x3bce2d['query']['sort']);_0x2f225d[_0x882d('0x3a')]=qs[_0x882d('0x3b')](_[_0x882d('0x3c')](_0x3bce2d[_0x882d('0x33')],_0x1c4b9d[_0x882d('0x3b')]),_0x53ff78);if(_0x3bce2d[_0x882d('0x33')][_0x882d('0x3d')]){_0x2f225d[_0x882d('0x3a')]=_['merge'](_0x2f225d[_0x882d('0x3a')],{'$or':_[_0x882d('0x2e')](_0x53ff78,function(_0x39a4e6){if(_0x39a4e6[_0x882d('0x3e')]!==_0x882d('0x3f')){var _0x15fbd1={};_0x15fbd1[_0x39a4e6[_0x882d('0x2c')]]={'$like':'%'+_0x3bce2d[_0x882d('0x33')][_0x882d('0x3d')]+'%'};return _0x15fbd1;}})});}_0x2f225d=_['merge']({},_0x2f225d,_0x3bce2d['options']);var _0x3241b9={'where':_0x2f225d[_0x882d('0x3a')]};return db[_0x882d('0x40')][_0x882d('0x20')](_0x3241b9)[_0x882d('0x28')](function(_0x35e188){_0x2648d3['count']=_0x35e188;if(_0x3bce2d[_0x882d('0x33')][_0x882d('0x41')]){_0x2f225d[_0x882d('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2f225d);})[_0x882d('0x28')](function(_0x41b874){_0x2648d3[_0x882d('0x43')]=_0x41b874;return _0x2648d3;})[_0x882d('0x28')](respondWithFilteredResult(_0x4f6400,_0x2f225d))['catch'](handleError(_0x4f6400,null));};exports['show']=function(_0x249532,_0x439f2f){var _0x2c7d26={'raw':!![],'where':{'id':_0x249532['params']['id']}},_0x421f0e={};_0x421f0e[_0x882d('0x30')]=_[_0x882d('0x31')](db[_0x882d('0x40')][_0x882d('0x44')]);_0x421f0e['query']=_[_0x882d('0x31')](_0x249532[_0x882d('0x33')]);_0x421f0e[_0x882d('0x3b')]=_[_0x882d('0x32')](_0x421f0e[_0x882d('0x30')],_0x421f0e[_0x882d('0x33')]);_0x2c7d26[_0x882d('0x34')]=_[_0x882d('0x32')](_0x421f0e['model'],qs[_0x882d('0x35')](_0x249532[_0x882d('0x33')][_0x882d('0x35')]));_0x2c7d26[_0x882d('0x34')]=_0x2c7d26['attributes'][_0x882d('0x36')]?_0x2c7d26[_0x882d('0x34')]:_0x421f0e['model'];if(_0x249532[_0x882d('0x33')][_0x882d('0x41')]){_0x2c7d26[_0x882d('0x42')]=[{'all':!![]}];}_0x2c7d26=_[_0x882d('0x45')]({},_0x2c7d26,_0x249532[_0x882d('0x46')]);return db[_0x882d('0x40')][_0x882d('0x47')](_0x2c7d26)[_0x882d('0x28')](handleEntityNotFound(_0x439f2f,null))['then'](respondWithResult(_0x439f2f,null))[_0x882d('0x48')](handleError(_0x439f2f,null));};exports['update']=function(_0x2d1de7,_0x37c175){if(_0x2d1de7[_0x882d('0x49')]['id']){delete _0x2d1de7['body']['id'];}return db['CmHopperBlack'][_0x882d('0x47')]({'where':{'id':_0x2d1de7[_0x882d('0x4a')]['id']}})[_0x882d('0x28')](handleEntityNotFound(_0x37c175,null))['then'](saveUpdates(_0x2d1de7[_0x882d('0x49')],null))[_0x882d('0x28')](respondWithResult(_0x37c175,null))[_0x882d('0x48')](handleError(_0x37c175,null));};exports[_0x882d('0x4b')]=function(_0x525992,_0x358b7c){return db['CmHopperBlack']['find']({'where':{'id':_0x525992[_0x882d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x358b7c,null))[_0x882d('0x28')](removeEntity(_0x358b7c,null))['catch'](handleError(_0x358b7c,null));};exports[_0x882d('0x4c')]=function(_0xfc440c,_0xa7837e){return db[_0x882d('0x40')]['describe']()[_0x882d('0x28')](respondWithResult(_0xa7837e,null))[_0x882d('0x48')](handleError(_0xa7837e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bce76e0..f6ea347 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 _0x3b34=['cm_hopper_black','lodash','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x52a8a8,_0x5147b4){var _0x5f0770=function(_0x37f452){while(--_0x37f452){_0x52a8a8['push'](_0x52a8a8['shift']());}};_0x5f0770(++_0x5147b4);}(_0x3b34,0xd2));var _0x43b3=function(_0x25865d,_0x2ffb6b){_0x25865d=_0x25865d-0x0;var _0x13927c=_0x3b34[_0x25865d];return _0x13927c;};'use strict';var _=require(_0x43b3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x43b3('0x1'));var BPromise=require(_0x43b3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b3('0x3'));var rimraf=require(_0x43b3('0x4'));var config=require(_0x43b3('0x5'));var attributes=require(_0x43b3('0x6'));module[_0x43b3('0x7')]=function(_0x29b1cb,_0x21f129){return _0x29b1cb[_0x43b3('0x8')](_0x43b3('0x9'),attributes,{'tableName':_0x43b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d00=['CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2f1650,_0x3b0ab5){var _0x4d829e=function(_0x301986){while(--_0x301986){_0x2f1650['push'](_0x2f1650['shift']());}};_0x4d829e(++_0x3b0ab5);}(_0x0d00,0x6d));var _0x00d0=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x0d00[_0x25248b];return _0x509939;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require('moment');var BPromise=require(_0x00d0('0x4'));var rp=require(_0x00d0('0x5'));var fs=require('fs');var path=require(_0x00d0('0x6'));var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x00d0('0x9')]=function(_0x463edb,_0x391b6f){return _0x463edb[_0x00d0('0xa')](_0x00d0('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index aedd20d..a13792f 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 _0xaea0=['options','where','limit','include','map','attributes','model','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll'];(function(_0x20a8a1,_0x4b961b){var _0x28ec54=function(_0x153804){while(--_0x153804){_0x20a8a1['push'](_0x20a8a1['shift']());}};_0x28ec54(++_0x4b961b);}(_0xaea0,0xe5));var _0x0aea=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xaea0[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x0aea('0x0'));var util=require(_0x0aea('0x1'));var moment=require(_0x0aea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aea('0x3'));var db=require(_0x0aea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0aea('0x5'))('rpc');var config=require(_0x0aea('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0aea('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d639,_0x1139e5,_0x33681d){return new BPromise(function(_0x4484ad,_0x43a134){return client['request'](_0x32d639,_0x33681d)[_0x0aea('0x8')](function(_0x42ac3c){logger[_0x0aea('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x0aea('0xa'));logger[_0x0aea('0xb')](_0x0aea('0xc'),_0x1139e5,_0x0aea('0xa'),JSON[_0x0aea('0xd')](_0x42ac3c));if(_0x42ac3c[_0x0aea('0xe')]){if(_0x42ac3c['error'][_0x0aea('0xf')]===0x1f4){logger[_0x0aea('0xe')](_0x0aea('0x10'),_0x1139e5,_0x42ac3c[_0x0aea('0xe')]['message']);return _0x43a134(_0x42ac3c[_0x0aea('0xe')]['message']);}logger[_0x0aea('0xe')](_0x0aea('0x10'),_0x1139e5,_0x42ac3c[_0x0aea('0xe')][_0x0aea('0x11')]);return _0x4484ad(_0x42ac3c[_0x0aea('0xe')]['message']);}else{logger[_0x0aea('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x0aea('0xa'));_0x4484ad(_0x42ac3c[_0x0aea('0x12')]['message']);}})[_0x0aea('0x13')](function(_0x400ccb){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x400ccb);_0x43a134(_0x400ccb);});});}exports[_0x0aea('0x14')]=function(_0x4d807f){var _0x3c685f=this;return new Promise(function(_0x106ca8,_0x43d3cd){return db[_0x0aea('0x15')][_0x0aea('0x16')]({'raw':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')][_0x0aea('0x18')]||null:null,'attributes':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')]['attributes']||null:null,'limit':_0x4d807f[_0x0aea('0x17')]?_0x4d807f['options'][_0x0aea('0x19')]||null:null,'include':_0x4d807f['options']?_0x4d807f[_0x0aea('0x17')][_0x0aea('0x1a')]?_[_0x0aea('0x1b')](_0x4d807f[_0x0aea('0x17')][_0x0aea('0x1a')],function(_0x6b8edf){return{'model':db[_0x6b8edf['model']],'as':_0x6b8edf['as'],'attributes':_0x6b8edf[_0x0aea('0x1c')],'include':_0x6b8edf['include']?_[_0x0aea('0x1b')](_0x6b8edf['include'],function(_0x51fcfc){return{'model':db[_0x51fcfc['model']],'as':_0x51fcfc['as'],'attributes':_0x51fcfc[_0x0aea('0x1c')],'include':_0x51fcfc['include']?_[_0x0aea('0x1b')](_0x51fcfc[_0x0aea('0x1a')],function(_0x5846ff){return{'model':db[_0x5846ff[_0x0aea('0x1d')]],'as':_0x5846ff['as'],'attributes':_0x5846ff[_0x0aea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0aea('0x8')](function(_0x152abd){logger[_0x0aea('0x9')]('GetCmHopperBlack',_0x4d807f);logger['debug'](_0x0aea('0x14'),_0x4d807f,JSON[_0x0aea('0xd')](_0x152abd));_0x106ca8(_0x152abd);})['catch'](function(_0x309f0f){logger[_0x0aea('0xe')]('GetCmHopperBlack',_0x309f0f[_0x0aea('0x11')],_0x4d807f);_0x43d3cd(_0x3c685f[_0x0aea('0xe')](0x1f4,_0x309f0f['message']));});});};exports[_0x0aea('0x1e')]=function(_0x3b18ce){var _0x186920=this;return new Promise(function(_0x5ca094,_0x398937){return db[_0x0aea('0x15')][_0x0aea('0x1f')](_0x3b18ce[_0x0aea('0x20')],{'raw':_0x3b18ce[_0x0aea('0x17')]?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b18ce['options']?_0x3b18ce['options'][_0x0aea('0x18')]||null:null,'attributes':_0x3b18ce['options']?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x1c')]||null:null,'limit':_0x3b18ce[_0x0aea('0x17')]?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x19')]||null:null})[_0x0aea('0x8')](function(_0x27318e){logger[_0x0aea('0x9')](_0x0aea('0x1e'),_0x3b18ce);logger[_0x0aea('0xb')](_0x0aea('0x1e'),_0x3b18ce,JSON[_0x0aea('0xd')](_0x27318e));_0x5ca094(_0x27318e);})['catch'](function(_0x3819a8){logger['error']('UpdateCmHopperBlack',_0x3819a8[_0x0aea('0x11')],_0x3b18ce);_0x398937(_0x186920[_0x0aea('0xe')](0x1f4,_0x3819a8[_0x0aea('0x11')]));});});};exports[_0x0aea('0x22')]=function(_0x38bae5){var _0x5e1e75=this;return new Promise(function(_0x1afa52,_0x3ddc2d){return db[_0x0aea('0x15')][_0x0aea('0x23')]({'where':_0x38bae5[_0x0aea('0x17')]?_0x38bae5[_0x0aea('0x17')]['where']||null:null})['then'](function(_0x5c410e){logger['info'](_0x0aea('0x22'),_0x38bae5);logger['debug'](_0x0aea('0x22'),_0x38bae5,JSON[_0x0aea('0xd')](_0x5c410e));_0x1afa52(_0x5c410e);})[_0x0aea('0x13')](function(_0x5f1b06){logger[_0x0aea('0xe')](_0x0aea('0x22'),_0x5f1b06[_0x0aea('0x11')],_0x38bae5);_0x3ddc2d(_0x5e1e75['error'](0x1f4,_0x5f1b06[_0x0aea('0x11')]));});});}; \ No newline at end of file +var _0x8da3=['destroy','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update'];(function(_0x46ffa8,_0x3f3d11){var _0x380693=function(_0x10f32b){while(--_0x10f32b){_0x46ffa8['push'](_0x46ffa8['shift']());}};_0x380693(++_0x3f3d11);}(_0x8da3,0x71));var _0x38da=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8da3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x38da('0x0'));var util=require(_0x38da('0x1'));var moment=require(_0x38da('0x2'));var BPromise=require('bluebird');var rs=require(_0x38da('0x3'));var fs=require('fs');var Redis=require(_0x38da('0x4'));var db=require(_0x38da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38da('0x6'))(_0x38da('0x7'));var config=require(_0x38da('0x8'));var jayson=require(_0x38da('0x9'));var client=jayson[_0x38da('0xa')][_0x38da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51a1d7,_0x13aab3,_0x2f67db){return new BPromise(function(_0x1f0a9e,_0x2b6574){return client[_0x38da('0xc')](_0x51a1d7,_0x2f67db)[_0x38da('0xd')](function(_0x267901){logger[_0x38da('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x38da('0xf'));logger[_0x38da('0x10')](_0x38da('0x11'),_0x13aab3,_0x38da('0xf'),JSON[_0x38da('0x12')](_0x267901));if(_0x267901[_0x38da('0x13')]){if(_0x267901[_0x38da('0x13')]['code']===0x1f4){logger[_0x38da('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x267901[_0x38da('0x13')][_0x38da('0x14')]);return _0x2b6574(_0x267901[_0x38da('0x13')][_0x38da('0x14')]);}logger[_0x38da('0x13')](_0x38da('0x15'),_0x13aab3,_0x267901[_0x38da('0x13')][_0x38da('0x14')]);return _0x1f0a9e(_0x267901['error'][_0x38da('0x14')]);}else{logger[_0x38da('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x38da('0xf'));_0x1f0a9e(_0x267901[_0x38da('0x16')]['message']);}})[_0x38da('0x17')](function(_0x3d9f8c){logger['error'](_0x38da('0x15'),_0x13aab3,_0x3d9f8c);_0x2b6574(_0x3d9f8c);});});}exports[_0x38da('0x18')]=function(_0x333a77){var _0x605b9=this;return new Promise(function(_0x533c3c,_0x225cd6){return db['CmHopperBlack']['findAll']({'raw':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')][_0x38da('0x1a')]===undefined?!![]:![]:!![],'where':_0x333a77[_0x38da('0x19')]?_0x333a77['options'][_0x38da('0x1b')]||null:null,'attributes':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')][_0x38da('0x1c')]||null:null,'limit':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')]['limit']||null:null,'include':_0x333a77[_0x38da('0x19')]?_0x333a77['options'][_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x333a77[_0x38da('0x19')][_0x38da('0x1d')],function(_0x254afd){return{'model':db[_0x254afd[_0x38da('0x1f')]],'as':_0x254afd['as'],'attributes':_0x254afd['attributes'],'include':_0x254afd[_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x254afd[_0x38da('0x1d')],function(_0x16bb5b){return{'model':db[_0x16bb5b[_0x38da('0x1f')]],'as':_0x16bb5b['as'],'attributes':_0x16bb5b[_0x38da('0x1c')],'include':_0x16bb5b[_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x16bb5b[_0x38da('0x1d')],function(_0xf9c1ad){return{'model':db[_0xf9c1ad[_0x38da('0x1f')]],'as':_0xf9c1ad['as'],'attributes':_0xf9c1ad[_0x38da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc83933){logger['info'](_0x38da('0x18'),_0x333a77);logger['debug'](_0x38da('0x18'),_0x333a77,JSON[_0x38da('0x12')](_0xc83933));_0x533c3c(_0xc83933);})[_0x38da('0x17')](function(_0x2f839a){logger[_0x38da('0x13')]('GetCmHopperBlack',_0x2f839a[_0x38da('0x14')],_0x333a77);_0x225cd6(_0x605b9[_0x38da('0x13')](0x1f4,_0x2f839a[_0x38da('0x14')]));});});};exports[_0x38da('0x20')]=function(_0xa21df3){var _0x56fc60=this;return new Promise(function(_0x1c93d4,_0x17e8ab){return db[_0x38da('0x21')][_0x38da('0x22')](_0xa21df3['body'],{'raw':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')][_0x38da('0x1b')]||null:null,'attributes':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')][_0x38da('0x1c')]||null:null,'limit':_0xa21df3['options']?_0xa21df3[_0x38da('0x19')]['limit']||null:null})[_0x38da('0xd')](function(_0x1a174c){logger[_0x38da('0xe')](_0x38da('0x20'),_0xa21df3);logger[_0x38da('0x10')](_0x38da('0x20'),_0xa21df3,JSON['stringify'](_0x1a174c));_0x1c93d4(_0x1a174c);})['catch'](function(_0x50a8aa){logger['error']('UpdateCmHopperBlack',_0x50a8aa[_0x38da('0x14')],_0xa21df3);_0x17e8ab(_0x56fc60[_0x38da('0x13')](0x1f4,_0x50a8aa[_0x38da('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x5e6c03){var _0x19bdda=this;return new Promise(function(_0x4ef807,_0x4c5742){return db[_0x38da('0x21')][_0x38da('0x23')]({'where':_0x5e6c03[_0x38da('0x19')]?_0x5e6c03[_0x38da('0x19')][_0x38da('0x1b')]||null:null})[_0x38da('0xd')](function(_0x2f8f45){logger[_0x38da('0xe')](_0x38da('0x24'),_0x5e6c03);logger['debug'](_0x38da('0x24'),_0x5e6c03,JSON[_0x38da('0x12')](_0x2f8f45));_0x4ef807(_0x2f8f45);})[_0x38da('0x17')](function(_0x11ba5d){logger[_0x38da('0x13')](_0x38da('0x24'),_0x11ba5d[_0x38da('0x14')],_0x5e6c03);_0x4c5742(_0x19bdda['error'](0x1f4,_0x11ba5d[_0x38da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 65d8f74..01d778c 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 _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x2fb72d,_0x507cc1){var _0x2c1152=function(_0x250556){while(--_0x250556){_0x2fb72d['push'](_0x2fb72d['shift']());}};_0x2c1152(++_0x507cc1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d687cc6..356ffcc 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 _0xc7d6=['DATE','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x12506b,_0x1e2146){var _0x267aaf=function(_0x11a42f){while(--_0x11a42f){_0x12506b['push'](_0x12506b['shift']());}};_0x267aaf(++_0x1e2146);}(_0xc7d6,0x132));var _0x6c7d=function(_0x22587f,_0x1fd6ce){_0x22587f=_0x22587f-0x0;var _0x109ba4=_0xc7d6[_0x22587f];return _0x109ba4;};'use strict';var Sequelize=require(_0x6c7d('0x0'));var moment=require(_0x6c7d('0x1'));module['exports']={'state':{'type':Sequelize[_0x6c7d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6c7d('0x3')]},'scheduledat':{'type':Sequelize[_0x6c7d('0x4')]},'countbusyretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6c7d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6c7d('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6c7d('0x3')]},'calleridnum':{'type':Sequelize[_0x6c7d('0x3')]},'calleridname':{'type':Sequelize[_0x6c7d('0x3')]},'starttime':{'type':Sequelize[_0x6c7d('0x4')]},'responsetime':{'type':Sequelize[_0x6c7d('0x4')]},'answertime':{'type':Sequelize[_0x6c7d('0x4')]},'droptime':{'type':Sequelize[_0x6c7d('0x4')]},'endtime':{'type':Sequelize[_0x6c7d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6c7d('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6c7d('0x3')]},'membername':{'type':Sequelize[_0x6c7d('0x3')]},'reason':{'type':Sequelize[_0x6c7d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6c7d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6c7d('0x3')]},'dispositionat':{'type':Sequelize[_0x6c7d('0x4')],'set':function(_0x2c5179){var _0x381ff6=this[_0x6c7d('0x5')]('endtime');if(_0x381ff6&&_0x2c5179){this[_0x6c7d('0x6')](_0x6c7d('0x7'),moment(_0x2c5179)['diff'](moment(_0x381ff6),_0x6c7d('0x8')));}}},'amd':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6c7d('0x4')]},'deleted':{'type':Sequelize[_0x6c7d('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6c7d('0x4')]},'recallme':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6c7d('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf50d=['diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime'];(function(_0x57c701,_0x18ee4d){var _0xd624f1=function(_0x1231c5){while(--_0x1231c5){_0x57c701['push'](_0x57c701['shift']());}};_0xd624f1(++_0x18ee4d);}(_0xf50d,0xdf));var _0xdf50=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf50d[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdf50('0x0'));module[_0xdf50('0x1')]={'state':{'type':Sequelize[_0xdf50('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdf50('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf50('0x3')]},'starttime':{'type':Sequelize[_0xdf50('0x4')]},'responsetime':{'type':Sequelize[_0xdf50('0x4')]},'answertime':{'type':Sequelize[_0xdf50('0x4')]},'droptime':{'type':Sequelize[_0xdf50('0x4')]},'endtime':{'type':Sequelize[_0xdf50('0x4')]},'ringtime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xdf50('0x3')]},'campaigntype':{'type':Sequelize[_0xdf50('0x3')]},'membername':{'type':Sequelize[_0xdf50('0x3')]},'reason':{'type':Sequelize[_0xdf50('0x3')]},'disposition':{'type':Sequelize[_0xdf50('0x3')]},'secondDisposition':{'type':Sequelize[_0xdf50('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xdf50('0x4')],'set':function(_0x59c7e0){var _0x253a13=this[_0xdf50('0x5')](_0xdf50('0x6'));if(_0x253a13&&_0x59c7e0){this['setDataValue'](_0xdf50('0x7'),moment(_0x59c7e0)[_0xdf50('0x8')](moment(_0x253a13),_0xdf50('0x9')));}}},'amd':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdf50('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdf50('0x4')]},'deleted':{'type':Sequelize[_0xdf50('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 532508a..814d697 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 _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','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','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x245683,_0xd10784){var _0x3c7789=function(_0xbf8cc9){while(--_0xbf8cc9){_0x245683['push'](_0x245683['shift']());}};_0x3c7789(++_0xd10784);}(_0x1261,0x144));var _0x1126=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x1261[_0x371b64];return _0x3cf3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));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=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d20f772..5b55437 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 _0xea05=['util','api','moment','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xea05,0x9b));var _0x5ea0=function(_0x22c353,_0x15ee55){_0x22c353=_0x22c353-0x0;var _0x54d388=_0xea05[_0x22c353];return _0x54d388;};'use strict';var _=require(_0x5ea0('0x0'));var util=require(_0x5ea0('0x1'));var logger=require('../../config/logger')(_0x5ea0('0x2'));var moment=require(_0x5ea0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ea0('0x4'));var rimraf=require(_0x5ea0('0x5'));var config=require(_0x5ea0('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x5ea0('0x7')]=function(_0x48f0d6,_0x5c1d84){return _0x48f0d6[_0x5ea0('0x8')](_0x5ea0('0x9'),attributes,{'tableName':_0x5ea0('0xa'),'paranoid':![],'indexes':[{'name':_0x5ea0('0xb'),'fields':[_0x5ea0('0xb')]},{'name':_0x5ea0('0xc'),'fields':[_0x5ea0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14e4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid'];(function(_0x15bae1,_0x5b6b10){var _0x30b043=function(_0x4c9607){while(--_0x4c9607){_0x15bae1['push'](_0x15bae1['shift']());}};_0x30b043(++_0x5b6b10);}(_0x14e4,0x11d));var _0x414e=function(_0x3b7c8b,_0x2d4027){_0x3b7c8b=_0x3b7c8b-0x0;var _0x5055ff=_0x14e4[_0x3b7c8b];return _0x5055ff;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var logger=require(_0x414e('0x2'))(_0x414e('0x3'));var moment=require(_0x414e('0x4'));var BPromise=require(_0x414e('0x5'));var rp=require(_0x414e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x414e('0x7'));var config=require(_0x414e('0x8'));var attributes=require(_0x414e('0x9'));module[_0x414e('0xa')]=function(_0x5bba41,_0x2a7b84){return _0x5bba41[_0x414e('0xb')](_0x414e('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x414e('0xd'),'fields':[_0x414e('0xd')]},{'name':_0x414e('0xe'),'fields':[_0x414e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 93e23fa..bb4e8b4 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1908c1,_0x5e6c18){var _0x2be77f=function(_0x5ecffd){while(--_0x5ecffd){_0x1908c1['push'](_0x1908c1['shift']());}};_0x2be77f(++_0x5e6c18);}(_0x7a54,0x106));var _0x47a5=function(_0x2d7230,_0x3f5ff0){_0x2d7230=_0x2d7230-0x0;var _0x2855d3=_0x7a54[_0x2d7230];return _0x2855d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4b512b,_0x599ece){var _0x2d4fb2=function(_0x554ea6){while(--_0x554ea6){_0x4b512b['push'](_0x4b512b['shift']());}};_0x2d4fb2(++_0x599ece);}(_0xb10b,0x12a));var _0xbb10=function(_0x43cba5,_0x4a2f83){_0x43cba5=_0x43cba5-0x0;var _0x359d1a=_0xb10b[_0x43cba5];return _0x359d1a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 89f0a0b..970475d 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 _0x4dd9=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','/voice/queue/countAttributes/:id'];(function(_0x52f189,_0x222a76){var _0x417d4f=function(_0xcaeedb){while(--_0xcaeedb){_0x52f189['push'](_0x52f189['shift']());}};_0x417d4f(++_0x222a76);}(_0x4dd9,0x1f2));var _0x94dd=function(_0x4cfcbf,_0x7804a2){_0x4cfcbf=_0x4cfcbf-0x0;var _0x152d90=_0x4dd9[_0x4cfcbf];return _0x152d90;};'use strict';var multer=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var path=require(_0x94dd('0x2'));var timeout=require(_0x94dd('0x3'));var express=require(_0x94dd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x94dd('0x5'));var interaction=require(_0x94dd('0x6'));var config=require(_0x94dd('0x7'));var controller=require(_0x94dd('0x8'));router['get']('/',auth[_0x94dd('0x9')](),controller['index']);router[_0x94dd('0xa')](_0x94dd('0xb'),auth[_0x94dd('0x9')](),controller[_0x94dd('0xc')]);router[_0x94dd('0xa')](_0x94dd('0xd'),auth[_0x94dd('0x9')](),controller['show']);router[_0x94dd('0xa')](_0x94dd('0xe'),auth['isAuthenticated'](),controller[_0x94dd('0xf')]);router[_0x94dd('0xa')](_0x94dd('0x10'),auth['isAuthenticated'](),controller[_0x94dd('0x11')]);router[_0x94dd('0x12')](_0x94dd('0x13'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x14')]);router['post'](_0x94dd('0x15'),auth[_0x94dd('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x94dd('0x12')](_0x94dd('0x16'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x17')]);router[_0x94dd('0x18')](_0x94dd('0xd'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x19')]);module[_0x94dd('0x1a')]=router; \ No newline at end of file +var _0xb728=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x1e6e48,_0x560970){var _0x2bba7f=function(_0x2bf481){while(--_0x2bf481){_0x1e6e48['push'](_0x1e6e48['shift']());}};_0x2bba7f(++_0x560970);}(_0xb728,0xe2));var _0x8b72=function(_0x3e83b8,_0x48e291){_0x3e83b8=_0x3e83b8-0x0;var _0x834930=_0xb728[_0x3e83b8];return _0x834930;};'use strict';var multer=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var path=require(_0x8b72('0x2'));var timeout=require(_0x8b72('0x3'));var express=require('express');var router=express[_0x8b72('0x4')]();var fs_extra=require(_0x8b72('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b72('0x6'));var config=require(_0x8b72('0x7'));var controller=require(_0x8b72('0x8'));router[_0x8b72('0x9')]('/',auth[_0x8b72('0xa')](),controller[_0x8b72('0xb')]);router[_0x8b72('0x9')](_0x8b72('0xc'),auth[_0x8b72('0xa')](),controller[_0x8b72('0xd')]);router['get'](_0x8b72('0xe'),auth[_0x8b72('0xa')](),controller[_0x8b72('0xf')]);router[_0x8b72('0x9')](_0x8b72('0x10'),auth[_0x8b72('0xa')](),controller[_0x8b72('0x11')]);router[_0x8b72('0x9')](_0x8b72('0x12'),auth[_0x8b72('0xa')](),controller[_0x8b72('0x13')]);router[_0x8b72('0x14')](_0x8b72('0x15'),auth[_0x8b72('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x8b72('0x16'),auth[_0x8b72('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8b72('0x14')]('/checkContactHopper',auth[_0x8b72('0xa')](),controller[_0x8b72('0x17')]);router[_0x8b72('0x18')]('/:id',auth[_0x8b72('0xa')](),controller[_0x8b72('0x19')]);module[_0x8b72('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 50408d5..9e7b627 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 _0x3525=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x4aba11,_0x22e531){var _0x8808aa=function(_0x30967c){while(--_0x30967c){_0x4aba11['push'](_0x4aba11['shift']());}};_0x8808aa(++_0x22e531);}(_0x3525,0x16a));var _0x5352=function(_0x4ec7d1,_0x1cb648){_0x4ec7d1=_0x4ec7d1-0x0;var _0x147f03=_0x3525[_0x4ec7d1];return _0x147f03;};'use strict';var Sequelize=require(_0x5352('0x0'));module[_0x5352('0x1')]={'state':{'type':Sequelize[_0x5352('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5352('0x3')]},'scheduledat':{'type':Sequelize[_0x5352('0x4')]},'countbusyretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5352('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5352('0x3')]},'calleridnum':{'type':Sequelize[_0x5352('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5352('0x4')]},'answertime':{'type':Sequelize[_0x5352('0x4')]},'droptime':{'type':Sequelize[_0x5352('0x4')]},'endtime':{'type':Sequelize[_0x5352('0x4')]},'ringtime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5352('0x3')]},'campaigntype':{'type':Sequelize[_0x5352('0x3')]},'membername':{'type':Sequelize[_0x5352('0x3')]},'reason':{'type':Sequelize[_0x5352('0x3')]},'amd':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5352('0x4')]},'edited':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5352('0x3')]}}; \ No newline at end of file +var _0x3c50=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x42179f,_0x421858){var _0x3b3ccd=function(_0x3e45a4){while(--_0x3e45a4){_0x42179f['push'](_0x42179f['shift']());}};_0x3b3ccd(++_0x421858);}(_0x3c50,0x132));var _0x03c5=function(_0x4477c9,_0x14b3cb){_0x4477c9=_0x4477c9-0x0;var _0x2bf7b3=_0x3c50[_0x4477c9];return _0x2bf7b3;};'use strict';var Sequelize=require(_0x03c5('0x0'));module['exports']={'state':{'type':Sequelize[_0x03c5('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x03c5('0x2')]},'countbusyretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x03c5('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x03c5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x03c5('0x3')]},'starttime':{'type':Sequelize[_0x03c5('0x2')]},'responsetime':{'type':Sequelize[_0x03c5('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x03c5('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x03c5('0x3')]},'campaigntype':{'type':Sequelize[_0x03c5('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x03c5('0x3')]},'amd':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x03c5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x03c5('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x03c5('0x2')]},'edited':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d01a623..81fa1c7 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 _0xc89f=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x149e78,_0x46a344){var _0xe7834d=function(_0xdf06f9){while(--_0xdf06f9){_0x149e78['push'](_0x149e78['shift']());}};_0xe7834d(++_0x46a344);}(_0xc89f,0x8f));var _0xfc89=function(_0x4214ae,_0x2dd218){_0x4214ae=_0x4214ae-0x0;var _0x1f15ec=_0xc89f[_0x4214ae];return _0x1f15ec;};'use strict';var emlformat=require(_0xfc89('0x0'));var rimraf=require(_0xfc89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc89('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc89('0x3'));var Mustache=require(_0xfc89('0x4'));var util=require(_0xfc89('0x5'));var path=require(_0xfc89('0x6'));var sox=require(_0xfc89('0x7'));var csv=require(_0xfc89('0x8'));var ejs=require(_0xfc89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc89('0xa'));var squel=require(_0xfc89('0xb'));var crypto=require(_0xfc89('0xc'));var jsforce=require(_0xfc89('0xd'));var deskjs=require(_0xfc89('0xe'));var toCsv=require(_0xfc89('0x8'));var querystring=require(_0xfc89('0xf'));var Papa=require(_0xfc89('0x10'));var Redis=require(_0xfc89('0x11'));var authService=require(_0xfc89('0x12'));var qs=require(_0xfc89('0x13'));var as=require(_0xfc89('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc89('0x15'))(_0xfc89('0x16'));var utils=require(_0xfc89('0x17'));var config=require(_0xfc89('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc89('0x19'))['db'];function respondWithStatusCode(_0x2cc076,_0x472290){_0x472290=_0x472290||0xcc;return function(_0x200b8c){if(_0x200b8c){return _0x2cc076[_0xfc89('0x1a')](_0x472290);}return _0x2cc076[_0xfc89('0x1b')](_0x472290)[_0xfc89('0x1c')]();};}function respondWithResult(_0x27a4b2,_0x332ea2){_0x332ea2=_0x332ea2||0xc8;return function(_0x55c937){if(_0x55c937){return _0x27a4b2[_0xfc89('0x1b')](_0x332ea2)[_0xfc89('0x1d')](_0x55c937);}};}function respondWithFilteredResult(_0x56cdf,_0x2ff777){return function(_0x1cb4e7){if(_0x1cb4e7){var _0x3018e5=typeof _0x2ff777[_0xfc89('0x1e')]===_0xfc89('0x1f')&&typeof _0x2ff777['limit']==='undefined';var _0xe869a9=_0x1cb4e7['count'];var _0x5ed477=_0x3018e5?0x0:_0x2ff777[_0xfc89('0x1e')];var _0x4bc3f0=_0x3018e5?_0x1cb4e7[_0xfc89('0x20')]:_0x2ff777[_0xfc89('0x1e')]+_0x2ff777[_0xfc89('0x21')];var _0x27a4e0;if(_0x4bc3f0>=_0xe869a9){_0x4bc3f0=_0xe869a9;_0x27a4e0=0xc8;}else{_0x27a4e0=0xce;}_0x56cdf['status'](_0x27a4e0);return _0x56cdf[_0xfc89('0x22')](_0xfc89('0x23'),_0x5ed477+'-'+_0x4bc3f0+'/'+_0xe869a9)[_0xfc89('0x1d')](_0x1cb4e7);}return null;};}function patchUpdates(_0x186f49){return function(_0x33cad0){try{jsonpatch['apply'](_0x33cad0,_0x186f49,!![]);}catch(_0x6af972){return BPromise[_0xfc89('0x24')](_0x6af972);}return _0x33cad0[_0xfc89('0x25')]();};}function saveUpdates(_0x3239d5,_0x198913){return function(_0x57bd33){if(_0x57bd33){return _0x57bd33[_0xfc89('0x26')](_0x3239d5)['then'](function(_0x3d357a){return _0x3d357a;});}return null;};}function removeEntity(_0x28ca1f,_0x2dbe8c){return function(_0x5a113d){if(_0x5a113d){return _0x5a113d['destroy']()[_0xfc89('0x27')](function(){_0x28ca1f[_0xfc89('0x1b')](0xcc)[_0xfc89('0x1c')]();});}};}function handleEntityNotFound(_0x27940b,_0x1cf396){return function(_0x203445){if(!_0x203445){_0x27940b[_0xfc89('0x1a')](0x194);}return _0x203445;};}function handleError(_0x3ecc58,_0x5630af){_0x5630af=_0x5630af||0x1f4;return function(_0x556a99){logger[_0xfc89('0x28')](_0x556a99[_0xfc89('0x29')]);if(_0x556a99[_0xfc89('0x2a')]){delete _0x556a99[_0xfc89('0x2a')];}_0x3ecc58[_0xfc89('0x1b')](_0x5630af)[_0xfc89('0x2b')](_0x556a99);};}exports[_0xfc89('0x2c')]=function(_0x45d2e7,_0x15feb0){var _0x146211={},_0x3d2188={},_0xfa8310={'count':0x0,'rows':[]};var _0x2c9ffb=_[_0xfc89('0x2d')](db[_0xfc89('0x2e')][_0xfc89('0x2f')],function(_0x52281b){return{'name':_0x52281b['fieldName'],'type':_0x52281b[_0xfc89('0x30')][_0xfc89('0x31')]};});_0x3d2188[_0xfc89('0x32')]=_[_0xfc89('0x2d')](_0x2c9ffb,_0xfc89('0x2a'));_0x3d2188[_0xfc89('0x33')]=_[_0xfc89('0x34')](_0x45d2e7['query']);_0x3d2188[_0xfc89('0x35')]=_[_0xfc89('0x36')](_0x3d2188[_0xfc89('0x32')],_0x3d2188[_0xfc89('0x33')]);_0x146211[_0xfc89('0x37')]=_['intersection'](_0x3d2188[_0xfc89('0x32')],qs[_0xfc89('0x38')](_0x45d2e7['query'][_0xfc89('0x38')]));_0x146211[_0xfc89('0x37')]=_0x146211[_0xfc89('0x37')]['length']?_0x146211['attributes']:_0x3d2188['model'];if(!_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x39')]('nolimit')){_0x146211[_0xfc89('0x21')]=qs['limit'](_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x21')]);_0x146211['offset']=qs[_0xfc89('0x1e')](_0x45d2e7['query'][_0xfc89('0x1e')]);}_0x146211[_0xfc89('0x3a')]=qs['sort'](_0x45d2e7['query'][_0xfc89('0x3b')]);_0x146211[_0xfc89('0x3c')]=qs[_0xfc89('0x35')](_[_0xfc89('0x3d')](_0x45d2e7[_0xfc89('0x33')],_0x3d2188[_0xfc89('0x35')]),_0x2c9ffb);if(_0x45d2e7[_0xfc89('0x33')]['filter']){_0x146211[_0xfc89('0x3c')]=_[_0xfc89('0x3e')](_0x146211[_0xfc89('0x3c')],{'$or':_[_0xfc89('0x2d')](_0x2c9ffb,function(_0xe49f22){if(_0xe49f22[_0xfc89('0x30')]!==_0xfc89('0x3f')){var _0x31337f={};_0x31337f[_0xe49f22[_0xfc89('0x2a')]]={'$like':'%'+_0x45d2e7['query'][_0xfc89('0x40')]+'%'};return _0x31337f;}})});}_0x146211=_[_0xfc89('0x3e')]({},_0x146211,_0x45d2e7[_0xfc89('0x41')]);var _0x1363c5={'where':_0x146211['where']};return db[_0xfc89('0x2e')][_0xfc89('0x20')](_0x1363c5)[_0xfc89('0x27')](function(_0x3d8e59){_0xfa8310['count']=_0x3d8e59;if(_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x42')]){_0x146211[_0xfc89('0x43')]=[{'all':!![]}];}return db[_0xfc89('0x2e')][_0xfc89('0x44')](_0x146211);})[_0xfc89('0x27')](function(_0x4bf28f){_0xfa8310['rows']=_0x4bf28f;return _0xfa8310;})[_0xfc89('0x27')](respondWithFilteredResult(_0x15feb0,_0x146211))[_0xfc89('0x45')](handleError(_0x15feb0,null));};exports['show']=function(_0x19c537,_0x4c30f1){var _0x28af8b={'raw':!![],'where':{'id':_0x19c537[_0xfc89('0x46')]['id']}},_0x4a61a9={};_0x4a61a9[_0xfc89('0x32')]=_['keys'](db['CmHopperHistory'][_0xfc89('0x2f')]);_0x4a61a9[_0xfc89('0x33')]=_['keys'](_0x19c537[_0xfc89('0x33')]);_0x4a61a9[_0xfc89('0x35')]=_['intersection'](_0x4a61a9[_0xfc89('0x32')],_0x4a61a9[_0xfc89('0x33')]);_0x28af8b[_0xfc89('0x37')]=_[_0xfc89('0x36')](_0x4a61a9[_0xfc89('0x32')],qs[_0xfc89('0x38')](_0x19c537[_0xfc89('0x33')][_0xfc89('0x38')]));_0x28af8b[_0xfc89('0x37')]=_0x28af8b['attributes'][_0xfc89('0x47')]?_0x28af8b['attributes']:_0x4a61a9['model'];if(_0x19c537[_0xfc89('0x33')][_0xfc89('0x42')]){_0x28af8b[_0xfc89('0x43')]=[{'all':!![]}];}_0x28af8b=_[_0xfc89('0x3e')]({},_0x28af8b,_0x19c537[_0xfc89('0x41')]);return db[_0xfc89('0x2e')][_0xfc89('0x48')](_0x28af8b)[_0xfc89('0x27')](handleEntityNotFound(_0x4c30f1,null))[_0xfc89('0x27')](respondWithResult(_0x4c30f1,null))[_0xfc89('0x45')](handleError(_0x4c30f1,null));};exports[_0xfc89('0x49')]=function(_0x1ee40e,_0x11a8af){return db[_0xfc89('0x2e')]['create'](_0x1ee40e['body'],{})[_0xfc89('0x27')](respondWithResult(_0x11a8af,0xc9))[_0xfc89('0x45')](handleError(_0x11a8af,null));};exports[_0xfc89('0x4a')]=function(_0x4e4bad,_0x2403cd){return db[_0xfc89('0x2e')][_0xfc89('0x4a')]()[_0xfc89('0x27')](respondWithResult(_0x2403cd,null))[_0xfc89('0x45')](handleError(_0x2403cd,null));};exports[_0xfc89('0x26')]=function(_0xfa0372,_0x57c1dc){if(_0xfa0372[_0xfc89('0x4b')][_0xfc89('0x4c')]){delete _0xfa0372[_0xfc89('0x4b')][_0xfc89('0x4c')];}return db[_0xfc89('0x2e')]['find']({'where':{'uniqueid':_0xfa0372[_0xfc89('0x46')]['id']}})[_0xfc89('0x27')](handleEntityNotFound(_0x57c1dc,null))['then'](saveUpdates(_0xfa0372[_0xfc89('0x4b')],null))[_0xfc89('0x27')](respondWithResult(_0x57c1dc,null))['catch'](handleError(_0x57c1dc,null));}; \ No newline at end of file +var _0x3012=['name','send','index','CmHopperHistory','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack'];(function(_0x555dc8,_0x466aa7){var _0xd41589=function(_0x528d22){while(--_0x528d22){_0x555dc8['push'](_0x555dc8['shift']());}};_0xd41589(++_0x466aa7);}(_0x3012,0x1e1));var _0x2301=function(_0x487ed4,_0x312026){_0x487ed4=_0x487ed4-0x0;var _0xa1193e=_0x3012[_0x487ed4];return _0xa1193e;};'use strict';var emlformat=require(_0x2301('0x0'));var rimraf=require(_0x2301('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2301('0x2'));var rp=require(_0x2301('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2301('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2301('0x5'));var ejs=require(_0x2301('0x6'));var fs=require('fs');var fs_extra=require(_0x2301('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2301('0x8'));var jsforce=require(_0x2301('0x9'));var deskjs=require(_0x2301('0xa'));var toCsv=require(_0x2301('0x5'));var querystring=require(_0x2301('0xb'));var Papa=require(_0x2301('0xc'));var Redis=require(_0x2301('0xd'));var authService=require(_0x2301('0xe'));var qs=require(_0x2301('0xf'));var as=require(_0x2301('0x10'));var hardwareService=require(_0x2301('0x11'));var logger=require(_0x2301('0x12'))(_0x2301('0x13'));var utils=require('../../config/utils');var config=require(_0x2301('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5111e0,_0x114e46){_0x114e46=_0x114e46||0xcc;return function(_0x35f69e){if(_0x35f69e){return _0x5111e0[_0x2301('0x15')](_0x114e46);}return _0x5111e0[_0x2301('0x16')](_0x114e46)[_0x2301('0x17')]();};}function respondWithResult(_0x141eb4,_0x359c69){_0x359c69=_0x359c69||0xc8;return function(_0x342c31){if(_0x342c31){return _0x141eb4[_0x2301('0x16')](_0x359c69)[_0x2301('0x18')](_0x342c31);}};}function respondWithFilteredResult(_0x4f7d89,_0x9cd73e){return function(_0x2362b4){if(_0x2362b4){var _0x1d06a5=typeof _0x9cd73e[_0x2301('0x19')]===_0x2301('0x1a')&&typeof _0x9cd73e['limit']===_0x2301('0x1a');var _0x2505c6=_0x2362b4[_0x2301('0x1b')];var _0x191318=_0x1d06a5?0x0:_0x9cd73e['offset'];var _0x2faf74=_0x1d06a5?_0x2362b4['count']:_0x9cd73e['offset']+_0x9cd73e[_0x2301('0x1c')];var _0x3ec712;if(_0x2faf74>=_0x2505c6){_0x2faf74=_0x2505c6;_0x3ec712=0xc8;}else{_0x3ec712=0xce;}_0x4f7d89[_0x2301('0x16')](_0x3ec712);return _0x4f7d89[_0x2301('0x1d')]('Content-Range',_0x191318+'-'+_0x2faf74+'/'+_0x2505c6)[_0x2301('0x18')](_0x2362b4);}return null;};}function patchUpdates(_0xbdfe31){return function(_0x246363){try{jsonpatch['apply'](_0x246363,_0xbdfe31,!![]);}catch(_0x35677a){return BPromise[_0x2301('0x1e')](_0x35677a);}return _0x246363[_0x2301('0x1f')]();};}function saveUpdates(_0x3b219a,_0x18fd0b){return function(_0x532891){if(_0x532891){return _0x532891[_0x2301('0x20')](_0x3b219a)[_0x2301('0x21')](function(_0x36fdf7){return _0x36fdf7;});}return null;};}function removeEntity(_0x55638f,_0x1feaf1){return function(_0x21d8e7){if(_0x21d8e7){return _0x21d8e7[_0x2301('0x22')]()[_0x2301('0x21')](function(){_0x55638f[_0x2301('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9ba0,_0x2db20a){return function(_0x5a0bdc){if(!_0x5a0bdc){_0x2b9ba0[_0x2301('0x15')](0x194);}return _0x5a0bdc;};}function handleError(_0x1f6c46,_0x272a53){_0x272a53=_0x272a53||0x1f4;return function(_0x12bcae){logger[_0x2301('0x23')](_0x12bcae[_0x2301('0x24')]);if(_0x12bcae[_0x2301('0x25')]){delete _0x12bcae[_0x2301('0x25')];}_0x1f6c46['status'](_0x272a53)[_0x2301('0x26')](_0x12bcae);};}exports[_0x2301('0x27')]=function(_0x33d320,_0x4e0439){var _0x2c2e31={},_0x5078ad={},_0x597e12={'count':0x0,'rows':[]};var _0x163134=_['map'](db[_0x2301('0x28')][_0x2301('0x29')],function(_0x10d5b5){return{'name':_0x10d5b5['fieldName'],'type':_0x10d5b5[_0x2301('0x2a')][_0x2301('0x2b')]};});_0x5078ad['model']=_[_0x2301('0x2c')](_0x163134,'name');_0x5078ad[_0x2301('0x2d')]=_['keys'](_0x33d320[_0x2301('0x2d')]);_0x5078ad[_0x2301('0x2e')]=_['intersection'](_0x5078ad[_0x2301('0x2f')],_0x5078ad['query']);_0x2c2e31[_0x2301('0x30')]=_[_0x2301('0x31')](_0x5078ad[_0x2301('0x2f')],qs[_0x2301('0x32')](_0x33d320[_0x2301('0x2d')]['fields']));_0x2c2e31['attributes']=_0x2c2e31[_0x2301('0x30')][_0x2301('0x33')]?_0x2c2e31[_0x2301('0x30')]:_0x5078ad['model'];if(!_0x33d320[_0x2301('0x2d')][_0x2301('0x34')](_0x2301('0x35'))){_0x2c2e31[_0x2301('0x1c')]=qs['limit'](_0x33d320[_0x2301('0x2d')][_0x2301('0x1c')]);_0x2c2e31['offset']=qs['offset'](_0x33d320['query'][_0x2301('0x19')]);}_0x2c2e31[_0x2301('0x36')]=qs['sort'](_0x33d320['query'][_0x2301('0x37')]);_0x2c2e31[_0x2301('0x38')]=qs['filters'](_[_0x2301('0x39')](_0x33d320['query'],_0x5078ad[_0x2301('0x2e')]),_0x163134);if(_0x33d320[_0x2301('0x2d')][_0x2301('0x3a')]){_0x2c2e31['where']=_[_0x2301('0x3b')](_0x2c2e31[_0x2301('0x38')],{'$or':_['map'](_0x163134,function(_0x3c1a56){if(_0x3c1a56[_0x2301('0x2a')]!==_0x2301('0x3c')){var _0xafba9f={};_0xafba9f[_0x3c1a56[_0x2301('0x25')]]={'$like':'%'+_0x33d320[_0x2301('0x2d')][_0x2301('0x3a')]+'%'};return _0xafba9f;}})});}_0x2c2e31=_[_0x2301('0x3b')]({},_0x2c2e31,_0x33d320['options']);var _0x457e87={'where':_0x2c2e31[_0x2301('0x38')]};return db[_0x2301('0x28')][_0x2301('0x1b')](_0x457e87)[_0x2301('0x21')](function(_0x34034c){_0x597e12[_0x2301('0x1b')]=_0x34034c;if(_0x33d320['query'][_0x2301('0x3d')]){_0x2c2e31[_0x2301('0x3e')]=[{'all':!![]}];}return db[_0x2301('0x28')][_0x2301('0x3f')](_0x2c2e31);})['then'](function(_0x35eb25){_0x597e12['rows']=_0x35eb25;return _0x597e12;})[_0x2301('0x21')](respondWithFilteredResult(_0x4e0439,_0x2c2e31))[_0x2301('0x40')](handleError(_0x4e0439,null));};exports[_0x2301('0x41')]=function(_0x3df80e,_0x4795a3){var _0x28ae30={'raw':!![],'where':{'id':_0x3df80e[_0x2301('0x42')]['id']}},_0x33aaa2={};_0x33aaa2[_0x2301('0x2f')]=_[_0x2301('0x43')](db[_0x2301('0x28')][_0x2301('0x29')]);_0x33aaa2[_0x2301('0x2d')]=_[_0x2301('0x43')](_0x3df80e[_0x2301('0x2d')]);_0x33aaa2[_0x2301('0x2e')]=_[_0x2301('0x31')](_0x33aaa2[_0x2301('0x2f')],_0x33aaa2[_0x2301('0x2d')]);_0x28ae30[_0x2301('0x30')]=_['intersection'](_0x33aaa2[_0x2301('0x2f')],qs[_0x2301('0x32')](_0x3df80e[_0x2301('0x2d')]['fields']));_0x28ae30[_0x2301('0x30')]=_0x28ae30[_0x2301('0x30')][_0x2301('0x33')]?_0x28ae30[_0x2301('0x30')]:_0x33aaa2[_0x2301('0x2f')];if(_0x3df80e[_0x2301('0x2d')][_0x2301('0x3d')]){_0x28ae30[_0x2301('0x3e')]=[{'all':!![]}];}_0x28ae30=_[_0x2301('0x3b')]({},_0x28ae30,_0x3df80e[_0x2301('0x44')]);return db[_0x2301('0x28')][_0x2301('0x45')](_0x28ae30)[_0x2301('0x21')](handleEntityNotFound(_0x4795a3,null))[_0x2301('0x21')](respondWithResult(_0x4795a3,null))[_0x2301('0x40')](handleError(_0x4795a3,null));};exports[_0x2301('0x46')]=function(_0x1f38f0,_0x4f16fa){return db[_0x2301('0x28')]['create'](_0x1f38f0['body'],{})[_0x2301('0x21')](respondWithResult(_0x4f16fa,0xc9))[_0x2301('0x40')](handleError(_0x4f16fa,null));};exports['describe']=function(_0x1cef54,_0x49abdc){return db['CmHopperHistory'][_0x2301('0x47')]()[_0x2301('0x21')](respondWithResult(_0x49abdc,null))[_0x2301('0x40')](handleError(_0x49abdc,null));};exports[_0x2301('0x20')]=function(_0x551750,_0x40e164){if(_0x551750[_0x2301('0x48')][_0x2301('0x49')]){delete _0x551750['body'][_0x2301('0x49')];}return db[_0x2301('0x28')][_0x2301('0x45')]({'where':{'uniqueid':_0x551750[_0x2301('0x42')]['id']}})[_0x2301('0x21')](handleEntityNotFound(_0x40e164,null))['then'](saveUpdates(_0x551750[_0x2301('0x48')],null))['then'](respondWithResult(_0x40e164,null))[_0x2301('0x40')](handleError(_0x40e164,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b265e25..81f0d56 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 _0xa5c9=['define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','request-promise','path','exports'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xa5c9,0x143));var _0x9a5c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa5c9[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a5c('0x4'));var fs=require('fs');var path=require(_0x9a5c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x9a5c('0x6')]=function(_0x2a697c,_0x2cac2a){return _0x2a697c[_0x9a5c('0x7')]('CmHopperHistory',attributes,{'tableName':_0x9a5c('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9a5c('0x9')]},{'name':_0x9a5c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5df=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','request-promise','path'];(function(_0x4f217f,_0x313163){var _0x3b583a=function(_0x334971){while(--_0x334971){_0x4f217f['push'](_0x4f217f['shift']());}};_0x3b583a(++_0x313163);}(_0xc5df,0x80));var _0xfc5d=function(_0x5ee925,_0x5041f6){_0x5ee925=_0x5ee925-0x0;var _0x1cb2a2=_0xc5df[_0x5ee925];return _0x1cb2a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));module['exports']=function(_0x1c8057,_0x2df24e){return _0x1c8057[_0xfc5d('0x7')](_0xfc5d('0x8'),attributes,{'tableName':_0xfc5d('0x9'),'paranoid':![],'indexes':[{'name':_0xfc5d('0xa'),'fields':['endtime']},{'name':_0xfc5d('0xb'),'fields':[_0xfc5d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 96ecdcb..947822b 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 _0xc874=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','catch','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x2982db,_0x2f0901){var _0x127f47=function(_0x30b1fb){while(--_0x30b1fb){_0x2982db['push'](_0x2982db['shift']());}};_0x127f47(++_0x2f0901);}(_0xc874,0x154));var _0x4c87=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xc874[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')](_0x547d92[_0x4c87('0x16')],{'raw':_0x547d92['options']?_0x547d92[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![]})[_0x4c87('0x19')](function(_0x3f27d4){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x3f27d4));_0x561441(_0x3f27d4);})[_0x4c87('0x1a')](function(_0x33aafd){logger['error'](_0x4c87('0x13'),_0x33aafd[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144['error'](0x1f4,_0x33aafd[_0x4c87('0x11')]));});});};exports[_0x4c87('0x1b')]=function(_0x40a413){var _0x3b4399=this;return new Promise(function(_0x5cd58d,_0x4735f2){return db[_0x4c87('0x14')][_0x4c87('0x1c')]({'raw':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![],'where':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')]['where']||null:null,'attributes':[[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')][_0x4c87('0x1e')]('id')),_0x4c87('0x1f')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x22')))),_0x4c87('0x23')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x24')))),_0x4c87('0x25')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4c87('0x1d')]['fn']('AVG',db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x27')))),_0x4c87('0x28')],[db[_0x4c87('0x1d')]['fn']('AVG',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x4c87('0x19')](function(_0x32d0f2){logger[_0x4c87('0xa')](_0x4c87('0x1b'),_0x40a413);logger['debug'](_0x4c87('0x1b'),_0x40a413,JSON[_0x4c87('0xe')](_0x32d0f2));_0x5cd58d(_0x32d0f2);})[_0x4c87('0x1a')](function(_0x24197d){logger['error']('AvgHandleTime',_0x24197d[_0x4c87('0x11')],_0x40a413);_0x4735f2(_0x3b4399['error'](0x1f4,_0x24197d[_0x4c87('0x11')]));});});};exports[_0x4c87('0x2a')]=function(_0x217141){var _0x66e7f6=this;return new Promise(function(_0x100ca5,_0x5aea33){return db[_0x4c87('0x14')][_0x4c87('0x1c')]({'raw':_0x217141[_0x4c87('0x17')]?_0x217141['options']['raw']===undefined?!![]:![]:!![],'where':_0x217141[_0x4c87('0x17')]?_0x217141[_0x4c87('0x17')][_0x4c87('0x2b')]||null:null,'attributes':[['campaign',_0x4c87('0x2c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db[_0x4c87('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x4c87('0x2e')],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x22')))),'outboundAnswerCallsDay'],[db[_0x4c87('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4c87('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4c87('0x2f')],[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x30')))),'outboundCongestionCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')]['literal'](_0x4c87('0x31')))),_0x4c87('0x32')],[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x4c87('0x34')))),_0x4c87('0x35')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x36')))),_0x4c87('0x37')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x38')))),_0x4c87('0x39')],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4c87('0x3a')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x3b')))),'outboundAnswerAgiCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x4c87('0x3c')))),_0x4c87('0x3d')]],'group':[_0x4c87('0x3e')]})[_0x4c87('0x19')](function(_0x31c1e2){logger[_0x4c87('0xa')](_0x4c87('0x2a'),_0x217141);logger[_0x4c87('0xd')]('GetVoiceQueueHopperHistory',_0x217141,JSON['stringify'](_0x31c1e2));_0x100ca5(_0x31c1e2);})[_0x4c87('0x1a')](function(_0x4debb0){logger[_0x4c87('0xf')](_0x4c87('0x2a'),_0x4debb0[_0x4c87('0x11')],_0x217141);_0x5aea33(_0x66e7f6[_0x4c87('0xf')](0x1f4,_0x4debb0[_0x4c87('0x11')]));});});};exports[_0x4c87('0x3f')]=function(_0x1b13e3){var _0x2a4bf1=this;return new Promise(function(_0x4aa6e3,_0x57f1c9){return db[_0x4c87('0x14')]['findAll']({'raw':_0x1b13e3[_0x4c87('0x17')]?_0x1b13e3[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![],'where':_0x1b13e3['options']?_0x1b13e3[_0x4c87('0x17')][_0x4c87('0x2b')]||null:null,'attributes':[[_0x4c87('0x3e'),_0x4c87('0x2c')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['col']('id')),'ivrTotalCallsDays'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x22')))),_0x4c87('0x40')]],'group':[_0x4c87('0x3e')]})[_0x4c87('0x19')](function(_0x133d03){logger[_0x4c87('0xa')](_0x4c87('0x3f'),_0x1b13e3);logger[_0x4c87('0xd')]('GetCampaignHopperHistory',_0x1b13e3,JSON[_0x4c87('0xe')](_0x133d03));_0x4aa6e3(_0x133d03);})[_0x4c87('0x1a')](function(_0x114dac){logger[_0x4c87('0xf')](_0x4c87('0x3f'),_0x114dac[_0x4c87('0x11')],_0x1b13e3);_0x57f1c9(_0x2a4bf1[_0x4c87('0xf')](0x1f4,_0x114dac['message']));});});}; \ No newline at end of file +var _0x0b96=['stringify','AvgHandleTime','CmHopperHistory','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','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','campaign','GetCampaignHopperHistory','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','create','body','options','raw'];(function(_0xbc4241,_0x362f9e){var _0x3c32eb=function(_0x38242b){while(--_0x38242b){_0xbc4241['push'](_0xbc4241['shift']());}};_0x3c32eb(++_0x362f9e);}(_0x0b96,0xc2));var _0x60b9=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x0b96[_0x1ebb10];return _0x20d709;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60b9('0x0'));var BPromise=require(_0x60b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b9('0x2'));var db=require(_0x60b9('0x3'))['db'];var utils=require(_0x60b9('0x4'));var logger=require(_0x60b9('0x5'))('rpc');var config=require(_0x60b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x60b9('0x7')][_0x60b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122342,_0x57e464,_0x5e71f0){return new BPromise(function(_0x51d50a,_0x3162cc){return client[_0x60b9('0x9')](_0x122342,_0x5e71f0)[_0x60b9('0xa')](function(_0x54ef39){logger[_0x60b9('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x57e464,'request\x20sent');logger[_0x60b9('0xc')](_0x60b9('0xd'),_0x57e464,_0x60b9('0xe'),JSON['stringify'](_0x54ef39));if(_0x54ef39['error']){if(_0x54ef39['error']['code']===0x1f4){logger['error'](_0x60b9('0xf'),_0x57e464,_0x54ef39['error']['message']);return _0x3162cc(_0x54ef39['error']['message']);}logger[_0x60b9('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x57e464,_0x54ef39['error']['message']);return _0x51d50a(_0x54ef39[_0x60b9('0x10')][_0x60b9('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x57e464,_0x60b9('0xe'));_0x51d50a(_0x54ef39[_0x60b9('0x12')][_0x60b9('0x11')]);}})[_0x60b9('0x13')](function(_0x341e49){logger[_0x60b9('0x10')](_0x60b9('0xf'),_0x57e464,_0x341e49);_0x3162cc(_0x341e49);});});}exports[_0x60b9('0x14')]=function(_0x767b4f){var _0x16a7c7=this;return new Promise(function(_0xe62516,_0x51e84b){return db['CmHopperHistory'][_0x60b9('0x15')](_0x767b4f[_0x60b9('0x16')],{'raw':_0x767b4f[_0x60b9('0x17')]?_0x767b4f[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![]})[_0x60b9('0xa')](function(_0x155c87){logger['info'](_0x60b9('0x14'),_0x767b4f);logger[_0x60b9('0xc')]('CreateCmHopperHistory',_0x767b4f,JSON[_0x60b9('0x19')](_0x155c87));_0xe62516(_0x155c87);})[_0x60b9('0x13')](function(_0x37e4df){logger['error'](_0x60b9('0x14'),_0x37e4df[_0x60b9('0x11')],_0x767b4f);_0x51e84b(_0x16a7c7[_0x60b9('0x10')](0x1f4,_0x37e4df[_0x60b9('0x11')]));});});};exports[_0x60b9('0x1a')]=function(_0xb39049){var _0x1e2658=this;return new Promise(function(_0x6ab6c6,_0x503b73){return db[_0x60b9('0x1b')][_0x60b9('0x1c')]({'raw':_0xb39049['options']?_0xb39049['options']['raw']===undefined?!![]:![]:!![],'where':_0xb39049[_0x60b9('0x17')]?_0xb39049[_0x60b9('0x17')][_0x60b9('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')][_0x60b9('0x20')]('id')),_0x60b9('0x21')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x23')))),_0x60b9('0x24')],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x25')))),_0x60b9('0x26')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x27')))),_0x60b9('0x28')],[db['sequelize']['fn']('AVG',db[_0x60b9('0x1f')]['fn']('IF',db['sequelize'][_0x60b9('0x22')](_0x60b9('0x29')))),_0x60b9('0x2a')],[db['sequelize']['fn'](_0x60b9('0x2b'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x2c')))),_0x60b9('0x2d')]]})[_0x60b9('0xa')](function(_0x6c38ba){logger[_0x60b9('0xb')](_0x60b9('0x1a'),_0xb39049);logger['debug'](_0x60b9('0x1a'),_0xb39049,JSON[_0x60b9('0x19')](_0x6c38ba));_0x6ab6c6(_0x6c38ba);})[_0x60b9('0x13')](function(_0x3ce5cd){logger[_0x60b9('0x10')](_0x60b9('0x1a'),_0x3ce5cd[_0x60b9('0x11')],_0xb39049);_0x503b73(_0x1e2658['error'](0x1f4,_0x3ce5cd[_0x60b9('0x11')]));});});};exports[_0x60b9('0x2e')]=function(_0x211c50){var _0x603491=this;return new Promise(function(_0x47d6c8,_0xf41f50){return db['CmHopperHistory']['findAll']({'raw':_0x211c50[_0x60b9('0x17')]?_0x211c50[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![],'where':_0x211c50['options']?_0x211c50[_0x60b9('0x17')][_0x60b9('0x1d')]||null:null,'attributes':[['campaign',_0x60b9('0x2f')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x30')))),_0x60b9('0x31')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x32')))),_0x60b9('0x33')],[db['sequelize']['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x60b9('0x34')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db['sequelize'][_0x60b9('0x22')](_0x60b9('0x35')))),'outboundBusyCallsDay'],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x36')))),_0x60b9('0x37')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x38')))),_0x60b9('0x39')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x3a')))),'outboundDropCallsDayCallersExit'],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x60b9('0x3b')))),_0x60b9('0x3c')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x60b9('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x60b9('0x3e')))),_0x60b9('0x3f')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x40')))),_0x60b9('0x41')],[db[_0x60b9('0x1f')]['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x42')))),_0x60b9('0x43')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x44')))),_0x60b9('0x41')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x45')))),_0x60b9('0x46')]],'group':[_0x60b9('0x47')]})[_0x60b9('0xa')](function(_0x2ec1cf){logger[_0x60b9('0xb')]('GetVoiceQueueHopperHistory',_0x211c50);logger[_0x60b9('0xc')](_0x60b9('0x2e'),_0x211c50,JSON[_0x60b9('0x19')](_0x2ec1cf));_0x47d6c8(_0x2ec1cf);})['catch'](function(_0x29be83){logger[_0x60b9('0x10')]('GetVoiceQueueHopperHistory',_0x29be83[_0x60b9('0x11')],_0x211c50);_0xf41f50(_0x603491[_0x60b9('0x10')](0x1f4,_0x29be83[_0x60b9('0x11')]));});});};exports[_0x60b9('0x48')]=function(_0xbfb79f){var _0x5c3eae=this;return new Promise(function(_0xba48d5,_0x583d2e){return db['CmHopperHistory'][_0x60b9('0x1c')]({'raw':_0xbfb79f['options']?_0xbfb79f[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![],'where':_0xbfb79f[_0x60b9('0x17')]?_0xbfb79f[_0x60b9('0x17')]['where']||null:null,'attributes':[['campaign',_0x60b9('0x2f')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x23')))),'ivrAnswerCallsDay']],'group':[_0x60b9('0x47')]})[_0x60b9('0xa')](function(_0x97676d){logger[_0x60b9('0xb')](_0x60b9('0x48'),_0xbfb79f);logger[_0x60b9('0xc')]('GetCampaignHopperHistory',_0xbfb79f,JSON[_0x60b9('0x19')](_0x97676d));_0xba48d5(_0x97676d);})['catch'](function(_0x5ad249){logger[_0x60b9('0x10')](_0x60b9('0x48'),_0x5ad249[_0x60b9('0x11')],_0xbfb79f);_0x583d2e(_0x5c3eae['error'](0x1f4,_0x5ad249[_0x60b9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index caea972..66588d3 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 _0x57c3=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','post','create'];(function(_0x1057ce,_0x2be3d6){var _0x29e85a=function(_0x59cb1b){while(--_0x59cb1b){_0x1057ce['push'](_0x1057ce['shift']());}};_0x29e85a(++_0x2be3d6);}(_0x57c3,0x1b6));var _0x357c=function(_0x1011fa,_0x398703){_0x1011fa=_0x1011fa-0x0;var _0x5db6e6=_0x57c3[_0x1011fa];return _0x5db6e6;};'use strict';var multer=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var path=require(_0x357c('0x2'));var timeout=require(_0x357c('0x3'));var express=require(_0x357c('0x4'));var router=express[_0x357c('0x5')]();var fs_extra=require(_0x357c('0x6'));var auth=require(_0x357c('0x7'));var interaction=require(_0x357c('0x8'));var config=require(_0x357c('0x9'));var controller=require(_0x357c('0xa'));router[_0x357c('0xb')]('/',auth[_0x357c('0xc')](),controller['index']);router[_0x357c('0xb')](_0x357c('0xd'),auth[_0x357c('0xc')](),controller[_0x357c('0xe')]);router[_0x357c('0xb')](_0x357c('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x357c('0x10')]('/',auth[_0x357c('0xc')](),controller[_0x357c('0x11')]);router['put'](_0x357c('0xf'),auth[_0x357c('0xc')](),controller[_0x357c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x477d=['util','path','connect-timeout','express','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x40906f,_0x3fe187){var _0x4f612e=function(_0x1819df){while(--_0x1819df){_0x40906f['push'](_0x40906f['shift']());}};_0x4f612e(++_0x3fe187);}(_0x477d,0x138));var _0xd477=function(_0x1ebbce,_0x42ee90){_0x1ebbce=_0x1ebbce-0x0;var _0x3f8638=_0x477d[_0x1ebbce];return _0x3f8638;};'use strict';var multer=require('multer');var util=require(_0xd477('0x0'));var path=require(_0xd477('0x1'));var timeout=require(_0xd477('0x2'));var express=require(_0xd477('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd477('0x4'));var controller=require(_0xd477('0x5'));router[_0xd477('0x6')]('/',auth[_0xd477('0x7')](),controller[_0xd477('0x8')]);router[_0xd477('0x6')]('/describe',auth[_0xd477('0x7')](),controller['describe']);router[_0xd477('0x6')](_0xd477('0x9'),auth[_0xd477('0x7')](),controller['show']);router[_0xd477('0xa')]('/',auth[_0xd477('0x7')](),controller['create']);router[_0xd477('0xb')](_0xd477('0x9'),auth[_0xd477('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 535c178..7c4e7c8 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 _0xaced=['sequelize','exports','STRING','name'];(function(_0x5d3a21,_0x249fc2){var _0x30b5f7=function(_0x26244b){while(--_0x26244b){_0x5d3a21['push'](_0x5d3a21['shift']());}};_0x30b5f7(++_0x249fc2);}(_0xaced,0x18c));var _0xdace=function(_0x4fe345,_0x2d0f1f){_0x4fe345=_0x4fe345-0x0;var _0x8b92fb=_0xaced[_0x4fe345];return _0x8b92fb;};'use strict';var Sequelize=require(_0xdace('0x0'));module[_0xdace('0x1')]={'name':{'type':Sequelize[_0xdace('0x2')],'unique':_0xdace('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdace('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x448b=['name','sequelize','exports','STRING'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x448b,0x125));var _0xb448=function(_0x17e109,_0x4881a8){_0x17e109=_0x17e109-0x0;var _0x4c0657=_0x448b[_0x17e109];return _0x4c0657;};'use strict';var Sequelize=require(_0xb448('0x0'));module[_0xb448('0x1')]={'name':{'type':Sequelize[_0xb448('0x2')],'unique':_0xb448('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb448('0x2')]},'dialPrefix':{'type':Sequelize[_0xb448('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fe9489a..b08055d 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 _0x2145=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Lists','destroy','status','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','nolimit','sort','ListId','options','removeDispositions','ids','addContacts','tags','isArray','CmContact','omit','success','push','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','from','CmContactId\x20=\x20c.id','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus'];(function(_0x3b449c,_0x1b2e0d){var _0x14aa36=function(_0x1819c1){while(--_0x1819c1){_0x3b449c['push'](_0x3b449c['shift']());}};_0x14aa36(++_0x1b2e0d);}(_0x2145,0x1d6));var _0x5214=function(_0x4da624,_0x1b192b){_0x4da624=_0x4da624-0x0;var _0x5caba0=_0x2145[_0x4da624];return _0x5caba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5214('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5214('0x1'));var rp=require(_0x5214('0x2'));var moment=require(_0x5214('0x3'));var BPromise=require(_0x5214('0x4'));var Mustache=require(_0x5214('0x5'));var util=require(_0x5214('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5214('0x7'));var _=require(_0x5214('0x8'));var squel=require(_0x5214('0x9'));var crypto=require(_0x5214('0xa'));var jsforce=require(_0x5214('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5214('0xc'));var querystring=require(_0x5214('0xd'));var Papa=require(_0x5214('0xe'));var Redis=require(_0x5214('0xf'));var authService=require(_0x5214('0x10'));var qs=require(_0x5214('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5214('0x12'));var logger=require(_0x5214('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5214('0x14'));var licenseUtil=require(_0x5214('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x5214('0x16')]=_['defaults'](config[_0x5214('0x16')],{'host':_0x5214('0x17'),'port':0x18eb});var socket=require(_0x5214('0x18'))(new Redis(config[_0x5214('0x16')]));require(_0x5214('0x19'))[_0x5214('0x1a')](socket);function respondWithStatusCode(_0xc3aef9,_0x3e7d24){_0x3e7d24=_0x3e7d24||0xcc;return function(_0x26fce2){if(_0x26fce2){return _0xc3aef9[_0x5214('0x1b')](_0x3e7d24);}return _0xc3aef9['status'](_0x3e7d24)['end']();};}function respondWithResult(_0x17ee10,_0x2b1565){_0x2b1565=_0x2b1565||0xc8;return function(_0x513d0e){if(_0x513d0e){return _0x17ee10['status'](_0x2b1565)[_0x5214('0x1c')](_0x513d0e);}};}function respondWithFilteredResult(_0x3283a0,_0x4c6180){return function(_0x20ada2){if(_0x20ada2){var _0x429550=typeof _0x4c6180[_0x5214('0x1d')]==='undefined'&&typeof _0x4c6180[_0x5214('0x1e')]===_0x5214('0x1f');var _0xcf53d9=_0x20ada2[_0x5214('0x20')];var _0x3f6b4c=_0x429550?0x0:_0x4c6180[_0x5214('0x1d')];var _0x4a5f29=_0x429550?_0x20ada2[_0x5214('0x20')]:_0x4c6180[_0x5214('0x1d')]+_0x4c6180[_0x5214('0x1e')];var _0x4e6d3e;if(_0x4a5f29>=_0xcf53d9){_0x4a5f29=_0xcf53d9;_0x4e6d3e=0xc8;}else{_0x4e6d3e=0xce;}_0x3283a0['status'](_0x4e6d3e);return _0x3283a0[_0x5214('0x21')](_0x5214('0x22'),_0x3f6b4c+'-'+_0x4a5f29+'/'+_0xcf53d9)[_0x5214('0x1c')](_0x20ada2);}return null;};}function patchUpdates(_0x305f3b){return function(_0x573d7c){try{jsonpatch[_0x5214('0x23')](_0x573d7c,_0x305f3b,!![]);}catch(_0x124745){return BPromise[_0x5214('0x24')](_0x124745);}return _0x573d7c[_0x5214('0x25')]();};}function saveUpdates(_0x4838ca,_0x4585ef){return function(_0x49abaf){if(_0x49abaf){return _0x49abaf[_0x5214('0x26')](_0x4838ca)[_0x5214('0x27')](function(_0x2bb832){return _0x2bb832;});}return null;};}function removeEntity(_0x36dfea,_0x38d917){return function(_0x448711){if(_0x448711){return _0x448711['destroy']()[_0x5214('0x27')](function(){var _0xed75ec=_0x448711[_0x5214('0x28')]({'plain':!![]});var _0x39466f=_0x5214('0x29');return db['UserProfileResource'][_0x5214('0x2a')]({'where':{'type':_0x39466f,'resourceId':_0xed75ec['id']}})[_0x5214('0x27')](function(){return _0x448711;});})['then'](function(){_0x36dfea[_0x5214('0x2b')](0xcc)[_0x5214('0x2c')]();});}};}function handleEntityNotFound(_0x3d9f08,_0x4836f8){return function(_0x220d15){if(!_0x220d15){_0x3d9f08[_0x5214('0x1b')](0x194);}return _0x220d15;};}function handleError(_0x1c55f9,_0x1db2a1){_0x1db2a1=_0x1db2a1||0x1f4;return function(_0x1fcc34){logger[_0x5214('0x2d')](_0x1fcc34[_0x5214('0x2e')]);if(_0x1fcc34[_0x5214('0x2f')]){delete _0x1fcc34[_0x5214('0x2f')];}_0x1c55f9[_0x5214('0x2b')](_0x1db2a1)[_0x5214('0x30')](_0x1fcc34);};}exports[_0x5214('0x31')]=function(_0x2b69f,_0x39e5da){var _0x5a08c8={},_0xe235df={},_0x24a764={'count':0x0,'rows':[]};var _0x55a2c2=_[_0x5214('0x32')](db[_0x5214('0x33')][_0x5214('0x34')],function(_0x3ff336){return{'name':_0x3ff336[_0x5214('0x35')],'type':_0x3ff336[_0x5214('0x36')][_0x5214('0x37')]};});_0xe235df[_0x5214('0x38')]=_[_0x5214('0x32')](_0x55a2c2,_0x5214('0x2f'));_0xe235df[_0x5214('0x39')]=_['keys'](_0x2b69f[_0x5214('0x39')]);_0xe235df[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0xe235df['model'],_0xe235df[_0x5214('0x39')]);_0x5a08c8['attributes']=_['intersection'](_0xe235df[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x2b69f[_0x5214('0x39')][_0x5214('0x3c')]));_0x5a08c8['attributes']=_0x5a08c8[_0x5214('0x3d')][_0x5214('0x3e')]?_0x5a08c8[_0x5214('0x3d')]:_0xe235df[_0x5214('0x38')];if(!_0x2b69f[_0x5214('0x39')][_0x5214('0x3f')]('nolimit')){_0x5a08c8[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x2b69f['query'][_0x5214('0x1e')]);_0x5a08c8[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x2b69f[_0x5214('0x39')][_0x5214('0x1d')]);}_0x5a08c8[_0x5214('0x40')]=qs['sort'](_0x2b69f['query']['sort']);_0x5a08c8[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x2b69f[_0x5214('0x39')],_0xe235df[_0x5214('0x3a')]),_0x55a2c2);if(_0x2b69f[_0x5214('0x39')][_0x5214('0x43')]){_0x5a08c8[_0x5214('0x41')]=_[_0x5214('0x44')](_0x5a08c8[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x55a2c2,function(_0x32b48e){if(_0x32b48e['type']!==_0x5214('0x45')){var _0x28befc={};_0x28befc[_0x32b48e[_0x5214('0x2f')]]={'$like':'%'+_0x2b69f['query'][_0x5214('0x43')]+'%'};return _0x28befc;}})});}_0x5a08c8=_[_0x5214('0x44')]({},_0x5a08c8,_0x2b69f['options']);var _0x56bf8e={'where':_0x5a08c8['where']};return db['CmList'][_0x5214('0x20')](_0x56bf8e)[_0x5214('0x27')](function(_0x202af6){_0x24a764['count']=_0x202af6;if(_0x2b69f[_0x5214('0x39')][_0x5214('0x46')]){_0x5a08c8[_0x5214('0x47')]=[{'all':!![]}];}return db[_0x5214('0x33')][_0x5214('0x48')](_0x5a08c8);})[_0x5214('0x27')](function(_0x2d02ea){_0x24a764[_0x5214('0x49')]=_0x2d02ea;return _0x24a764;})['then'](respondWithFilteredResult(_0x39e5da,_0x5a08c8))[_0x5214('0x4a')](handleError(_0x39e5da,null));};exports[_0x5214('0x4b')]=function(_0x3cc59f,_0x263b0f){var _0x1a1844={'raw':![],'where':{'id':_0x3cc59f['params']['id']}},_0x1a7348={};_0x1a7348[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0x33')][_0x5214('0x34')]);_0x1a7348[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x3cc59f[_0x5214('0x39')]);_0x1a7348[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0x1a7348['model'],_0x1a7348[_0x5214('0x39')]);_0x1a1844[_0x5214('0x3d')]=_[_0x5214('0x3b')](_0x1a7348[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x3cc59f[_0x5214('0x39')]['fields']));_0x1a1844['attributes']=_0x1a1844[_0x5214('0x3d')]['length']?_0x1a1844['attributes']:_0x1a7348[_0x5214('0x38')];if(_0x3cc59f['query'][_0x5214('0x46')]){_0x1a1844['include']=[{'all':!![]}];}_0x1a1844=_['merge']({},_0x1a1844,_0x3cc59f['options']);return db['CmList'][_0x5214('0x4d')](_0x1a1844)[_0x5214('0x27')](handleEntityNotFound(_0x263b0f,null))['then'](respondWithResult(_0x263b0f,null))['catch'](handleError(_0x263b0f,null));};exports[_0x5214('0x4e')]=function(_0x5a50ce,_0x37beb9){return db['CmList']['create'](_0x5a50ce[_0x5214('0x4f')],{})[_0x5214('0x27')](function(_0x163fe2){var _0x2d7a8c=_0x5a50ce[_0x5214('0x50')]['get']({'plain':!![]});if(!_0x2d7a8c)throw new Error(_0x5214('0x51'));if(_0x2d7a8c[_0x5214('0x52')]==='user'){var _0x3dbb2a=_0x163fe2[_0x5214('0x28')]({'plain':!![]});var _0x5277fc='Lists';return db[_0x5214('0x53')]['find']({'where':{'name':_0x5277fc,'userProfileId':_0x2d7a8c[_0x5214('0x54')]},'raw':!![]})[_0x5214('0x27')](function(_0x27a17d){if(_0x27a17d&&_0x27a17d[_0x5214('0x55')]===0x0){return db[_0x5214('0x56')][_0x5214('0x4e')]({'name':_0x3dbb2a['name'],'resourceId':_0x3dbb2a['id'],'type':_0x27a17d[_0x5214('0x2f')],'sectionId':_0x27a17d['id']},{})[_0x5214('0x27')](function(){return _0x163fe2;});}else{return _0x163fe2;}})[_0x5214('0x4a')](function(_0x466c43){logger['error'](_0x5214('0x57'),_0x466c43);throw _0x466c43;});}return _0x163fe2;})['then'](respondWithResult(_0x37beb9,0xc9))[_0x5214('0x4a')](handleError(_0x37beb9,null));};exports[_0x5214('0x26')]=function(_0x56aa83,_0x56a65e){if(_0x56aa83[_0x5214('0x4f')]['id']){delete _0x56aa83['body']['id'];}return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x56aa83[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x56a65e,null))[_0x5214('0x27')](saveUpdates(_0x56aa83[_0x5214('0x4f')],null))['then'](respondWithResult(_0x56a65e,null))[_0x5214('0x4a')](handleError(_0x56a65e,null));};exports[_0x5214('0x2a')]=function(_0x15a613,_0xd4443e){return db[_0x5214('0x33')]['find']({'where':{'id':_0x15a613[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0xd4443e,null))[_0x5214('0x27')](removeEntity(_0xd4443e,null))[_0x5214('0x4a')](handleError(_0xd4443e,null));};exports[_0x5214('0x59')]=function(_0x33c85a,_0x3c4846){return db[_0x5214('0x33')]['describe']()['then'](respondWithResult(_0x3c4846,null))[_0x5214('0x4a')](handleError(_0x3c4846,null));};exports['addDisposition']=function(_0x2f8f3d,_0x33924e,_0x1aaf5a){if(_0x2f8f3d['body']['id']){delete _0x2f8f3d[_0x5214('0x4f')]['id'];}return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x2f8f3d[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x33924e,null))['then'](function(_0x18e000){if(_0x18e000){_0x2f8f3d[_0x5214('0x4f')]['ListId']=_0x18e000['id'];return db[_0x5214('0x5a')][_0x5214('0x4e')](_0x2f8f3d['body']);}})['then'](respondWithResult(_0x33924e,null))['catch'](handleError(_0x33924e,null));};exports[_0x5214('0x5b')]=function(_0x175b12,_0x32c15c,_0x42964c){var _0x461ead={'raw':![],'where':{}};var _0x19696a={};var _0x527e62={'count':0x0,'rows':[]};return db['CmList'][_0x5214('0x5c')]({'where':{'id':_0x175b12[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x32c15c,null))[_0x5214('0x27')](function(_0x21eaf9){if(_0x21eaf9){_0x19696a[_0x5214('0x38')]=_['keys'](db['Disposition'][_0x5214('0x34')]);_0x19696a[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x175b12[_0x5214('0x39')]);_0x19696a[_0x5214('0x3a')]=_['intersection'](_0x19696a[_0x5214('0x38')],_0x19696a[_0x5214('0x39')]);_0x461ead[_0x5214('0x3d')]=_['intersection'](_0x19696a[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x175b12[_0x5214('0x39')]['fields']));_0x461ead[_0x5214('0x3d')]=_0x461ead[_0x5214('0x3d')][_0x5214('0x3e')]?_0x461ead['attributes']:_0x19696a[_0x5214('0x38')];if(!_0x175b12['query'][_0x5214('0x3f')](_0x5214('0x5d'))){_0x461ead[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x175b12[_0x5214('0x39')][_0x5214('0x1e')]);_0x461ead['offset']=qs[_0x5214('0x1d')](_0x175b12['query'][_0x5214('0x1d')]);}_0x461ead['order']=qs[_0x5214('0x5e')](_0x175b12['query'][_0x5214('0x5e')]);_0x461ead[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x175b12[_0x5214('0x39')],_0x19696a[_0x5214('0x3a')]));_0x461ead[_0x5214('0x41')][_0x5214('0x5f')]=_0x21eaf9['id'];if(_0x175b12[_0x5214('0x39')][_0x5214('0x43')]){_0x461ead[_0x5214('0x41')]=_['merge'](_0x461ead[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x461ead[_0x5214('0x3d')],function(_0x28c00f){var _0x2f05c0={};_0x2f05c0[_0x28c00f]={'$like':'%'+_0x175b12['query'][_0x5214('0x43')]+'%'};return _0x2f05c0;})});}_0x461ead=_['merge']({},_0x461ead,_0x175b12[_0x5214('0x60')]);return db['Disposition'][_0x5214('0x20')]({'where':_0x461ead['where']})[_0x5214('0x27')](function(_0x47a56c){_0x527e62[_0x5214('0x20')]=_0x47a56c;if(_0x175b12[_0x5214('0x39')][_0x5214('0x46')]){_0x461ead[_0x5214('0x47')]=[{'all':!![]}];}return db[_0x5214('0x5a')][_0x5214('0x48')](_0x461ead);})[_0x5214('0x27')](function(_0x29e9a3){_0x527e62[_0x5214('0x49')]=_0x29e9a3;return _0x527e62;});}})['then'](respondWithFilteredResult(_0x32c15c,_0x461ead))[_0x5214('0x4a')](handleError(_0x32c15c,null));};exports[_0x5214('0x61')]=function(_0x1b13c1,_0x32c0cd,_0x413589){return db['CmList']['find']({'where':{'id':_0x1b13c1[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x32c0cd,null))['then'](function(_0xaafa1){if(_0xaafa1){return _0xaafa1[_0x5214('0x61')](_0x1b13c1['query'][_0x5214('0x62')]);}})[_0x5214('0x27')](respondWithStatusCode(_0x32c0cd,null))[_0x5214('0x4a')](handleError(_0x32c0cd,null));};exports[_0x5214('0x63')]=function(_0x4f6ec8,_0x2871f0,_0x269e41){return db[_0x5214('0x33')]['find']({'where':{'id':_0x4f6ec8[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x2871f0,null))['then'](function(_0x125bce){if(_0x125bce){var _0x46ddf7=[];var _0x1ade5a={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x371107){if(_0x4f6ec8['body'][_0x5214('0x64')]&&_[_0x5214('0x65')](_0x4f6ec8['body'][_0x5214('0x64')])){if(_0x4f6ec8[_0x5214('0x4f')]['tags'][_0x5214('0x3e')]){_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x64')]=_0x4f6ec8[_0x5214('0x4f')]['tags']['join'](';')+';';}else{_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x64')]=null;}}else{_0x4f6ec8[_0x5214('0x4f')]['tags']=null;}if(_0x4f6ec8[_0x5214('0x4f')]&&_[_0x5214('0x65')](_0x4f6ec8[_0x5214('0x4f')])){for(var _0x37fb9c=0x0;_0x37fb9c<_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x3e')];_0x37fb9c+=0x1){_0x4f6ec8[_0x5214('0x4f')][_0x37fb9c][_0x5214('0x5f')]=_0x4f6ec8[_0x5214('0x58')]['id'];_0x46ddf7['push'](_0x4f6ec8[_0x5214('0x4f')][_0x37fb9c]);}return BPromise['each'](_0x46ddf7,function(_0x516923){return db[_0x5214('0x66')][_0x5214('0x4e')](_[_0x5214('0x67')](_0x516923,[_0x5214('0x62'),'id'])||{},{'fields':_[_0x5214('0x4c')](_0x371107),'raw':!![]})[_0x5214('0x27')](function(_0x117fc9){_0x1ade5a[_0x5214('0x68')][_0x5214('0x69')](_0x117fc9['dataValues']);})[_0x5214('0x4a')](function(_0x48a8a9){_0x1ade5a[_0x5214('0x6a')][_0x5214('0x69')]({'data':_0x516923,'error':_0x48a8a9[_0x5214('0x6b')]});});})[_0x5214('0x27')](function(_0xe02f82){return _0x1ade5a;})['catch'](function(_0x56d656){return _0x56d656;});}else{_0x2871f0[_0x5214('0x2b')](0x190)[_0x5214('0x1c')]({'message':_0x5214('0x6c')});}});}})[_0x5214('0x27')](respondWithResult(_0x2871f0,null))[_0x5214('0x4a')](handleError(_0x2871f0,null));};exports[_0x5214('0x6d')]=function(_0x1a5a23,_0x8f1308,_0x4e6752){var _0x165729;return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x1a5a23[_0x5214('0x58')]['id']},'include':[{'model':db[_0x5214('0x6e')],'as':'CustomFields'}]})[_0x5214('0x27')](handleEntityNotFound(_0x8f1308,null))[_0x5214('0x27')](function(_0x168ae1){if(_0x168ae1){_0x165729=_0x168ae1;return db[_0x5214('0x66')][_0x5214('0x34')];}})[_0x5214('0x27')](function(_0x227a48){if(_0x227a48){var _0x1a08bb={};var _0x16afbb={};_0x16afbb[_0x5214('0x38')]=_[_0x5214('0x6f')](_[_0x5214('0x4c')](_0x227a48),_[_0x5214('0x32')](_0x165729[_0x5214('0x70')],function(_0x5fc4ef){return util['format'](_0x5214('0x71'),_0x5fc4ef['id']);}));_0x16afbb['query']=_['keys'](_0x1a5a23[_0x5214('0x39')]);_0x16afbb['filters']=_[_0x5214('0x3b')](_0x16afbb[_0x5214('0x38')],_0x16afbb[_0x5214('0x39')]);_0x1a08bb[_0x5214('0x3d')]=_['intersection'](_0x16afbb[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x1a5a23[_0x5214('0x39')][_0x5214('0x3c')]));_0x1a08bb[_0x5214('0x3d')]=_0x1a08bb[_0x5214('0x3d')][_0x5214('0x3e')]?_0x1a08bb[_0x5214('0x3d')]:_0x16afbb[_0x5214('0x38')];if(!_0x1a5a23['query'][_0x5214('0x3f')]('nolimit')){_0x1a08bb[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x1a5a23['query'][_0x5214('0x1e')]);_0x1a08bb[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x1a5a23[_0x5214('0x39')]['offset']);}_0x1a08bb[_0x5214('0x40')]=qs['sort'](_0x1a5a23['query'][_0x5214('0x5e')]);_0x1a08bb[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x1a5a23['query'],_0x16afbb[_0x5214('0x3a')]));_0x1a08bb[_0x5214('0x72')]=!![];if(_0x1a5a23[_0x5214('0x39')][_0x5214('0x43')]){_0x1a08bb[_0x5214('0x41')]=_[_0x5214('0x44')](_0x1a08bb[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x1a08bb['attributes'],function(_0x1fd496){var _0x49ae9d={};_0x49ae9d[_0x1fd496]={'$like':'%'+_0x1a5a23[_0x5214('0x39')][_0x5214('0x43')]+'%'};return _0x49ae9d;})});}_0x1a08bb=_[_0x5214('0x44')]({},_0x1a08bb,_0x1a5a23[_0x5214('0x60')]);return _0x165729['getContacts'](_0x1a08bb);}})[_0x5214('0x27')](respondWithResult(_0x8f1308,null))[_0x5214('0x4a')](handleError(_0x8f1308,null));};exports[_0x5214('0x73')]=function(_0x349ce1,_0x470f21,_0x52845c){var _0x241553;var _0xbcfa06;var _0x2c6eac;var _0x4aac1a=_0x349ce1['params']['id'];csv_results=[];return db[_0x5214('0x74')]['findAll']({'attributes':['id',_0x5214('0x2f')],'raw':!![],'order':[_0x5214('0x75')]})[_0x5214('0x27')](function(_0x444e6d){_0x241553=_0x444e6d;var _0x2fc61d=_[_0x5214('0x4c')](db[_0x5214('0x66')][_0x5214('0x34')]);return db[_0x5214('0x6e')][_0x5214('0x48')]({'raw':!![],'attributes':['id',_0x5214('0x76')]})[_0x5214('0x27')](function(_0xfd6526){_0xbcfa06=_0xfd6526;var _0xfa6d90=squel[_0x5214('0x77')]()[_0x5214('0x3c')](_0x2fc61d)['from'](_0x5214('0x78'),'c')[_0x5214('0x41')]('c.ListId\x20=\x20?',_0x4aac1a)[_0x5214('0x41')]('c.deletedAt\x20is\x20null')[_0x5214('0x79')]();for(var _0xd7ac27=0x0;_0xd7ac27<_0xbcfa06['length'];_0xd7ac27++){_0xfa6d90[_0x5214('0x7a')](_0x5214('0x7b')+_0xbcfa06[_0xd7ac27]['id'],'customField_'+_0xbcfa06[_0xd7ac27][_0x5214('0x76')]);}for(var _0xd7ac27=0x0;_0xd7ac27<_0x241553[_0x5214('0x3e')];_0xd7ac27++){_0xfa6d90['field'](squel[_0x5214('0x77')]()[_0x5214('0x7a')](_0x5214('0x7c'))['from'](_0x5214('0x7d'))['where'](_0x5214('0x7e'),_0x241553[_0xd7ac27]['id'])[_0x5214('0x41')]('CmContactId\x20=\x20c.id'),_0x5214('0x7f')+_0x241553[_0xd7ac27][_0x5214('0x2f')]);_0xfa6d90[_0x5214('0x7a')](squel[_0x5214('0x77')]()['field']('description')[_0x5214('0x80')](_0x5214('0x7d'))['where'](_0x5214('0x7e'),_0x241553[_0xd7ac27]['id'])[_0x5214('0x41')](_0x5214('0x81')),'description_additionalPhone_'+_0x241553[_0xd7ac27][_0x5214('0x2f')]);}var _0x3aaa61=[];_0x3aaa61[_0x5214('0x69')](_0xfa6d90[_0x5214('0x82')]());BPromise['each'](_0x3aaa61,handleQuery)['then'](function(_0x3a4426){handleQuery(_0xfa6d90[_0x5214('0x82')]());var _0x198cdd=csv_results[0x0];if(!_[_0x5214('0x83')](_0x198cdd)){var _0x85e283=toCsv(_0x198cdd);var _0x55f758=Date['now']();fs[_0x5214('0x84')](util[_0x5214('0x85')](_0x5214('0x86'),_0x4aac1a,_0x55f758),_0x85e283);_0x470f21['setHeader'](_0x5214('0x87'),_0x5214('0x88')+util[_0x5214('0x85')](_0x5214('0x89'),_0x4aac1a,_0x55f758));_0x470f21[_0x5214('0x8a')](_0x5214('0x8b'),_0x5214('0x8c'));return _0x470f21[_0x5214('0x8d')](util[_0x5214('0x85')]('/tmp/list_%d_%s.csv',_0x4aac1a,_0x55f758));}else{return _0x470f21[_0x5214('0x1b')](0xcc);}});});});};exports[_0x5214('0x8e')]=function(_0x47585f,_0x5815f4,_0x2d5464){var _0x254517;delete _0x47585f[_0x5214('0x4f')]['id'];return db[_0x5214('0x33')][_0x5214('0x5c')]({'where':{'id':_0x47585f[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x5815f4,null))[_0x5214('0x27')](function(_0x1a9c4b){if(_0x1a9c4b){return db[_0x5214('0x8f')][_0x5214('0x90')](function(_0x336bf7){return db[_0x5214('0x6e')]['create'](_0x47585f['body'],{'transaction':_0x336bf7})['then'](function(_0x2094a7){_0x254517=_0x2094a7;return _0x1a9c4b[_0x5214('0x91')](_0x2094a7,{'transaction':_0x336bf7});})['then'](function(){var _0x46da6c={'type':db[_0x5214('0x92')][_0x5214('0x93')],'transaction':_0x336bf7};switch(_0x47585f[_0x5214('0x4f')][_0x5214('0x36')]){case'text':_0x46da6c[_0x5214('0x36')]=db['Sequelize']['TEXT'];break;case'number':_0x46da6c[_0x5214('0x36')]=db[_0x5214('0x92')][_0x5214('0x94')];break;case _0x5214('0x95'):_0x46da6c['type']=db[_0x5214('0x92')][_0x5214('0x96')];_0x46da6c[_0x5214('0x97')]=![];break;default:}return db['sequelize'][_0x5214('0x98')][_0x5214('0x99')](_0x5214('0x78'),util[_0x5214('0x85')]('cf_%s',_0x254517['id']),_0x46da6c);})[_0x5214('0x27')](function(){return _0x254517;});});}})[_0x5214('0x27')](respondWithResult(_0x5815f4,null))[_0x5214('0x4a')](handleError(_0x5815f4,null));};exports[_0x5214('0x9a')]=function(_0x8431cc,_0x51f1e4,_0x2a48b2){var _0x394ae0={};var _0xb4ea87={};var _0x5b8169;var _0x27d146;return db['CmList'][_0x5214('0x5c')]({'where':{'id':_0x8431cc[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x51f1e4,null))[_0x5214('0x27')](function(_0xde6e20){if(_0xde6e20){_0x5b8169=_0xde6e20;_0xb4ea87[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0x6e')][_0x5214('0x34')]);_0xb4ea87[_0x5214('0x39')]=_['keys'](_0x8431cc[_0x5214('0x39')]);_0xb4ea87[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0xb4ea87[_0x5214('0x38')],_0xb4ea87['query']);_0x394ae0['attributes']=_[_0x5214('0x3b')](_0xb4ea87['model'],qs[_0x5214('0x3c')](_0x8431cc[_0x5214('0x39')][_0x5214('0x3c')]));_0x394ae0[_0x5214('0x3d')]=_0x394ae0['attributes'][_0x5214('0x3e')]?_0x394ae0[_0x5214('0x3d')]:_0xb4ea87[_0x5214('0x38')];_0x394ae0[_0x5214('0x40')]=qs[_0x5214('0x5e')](_0x8431cc[_0x5214('0x39')][_0x5214('0x5e')]);_0x394ae0[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x8431cc[_0x5214('0x39')],_0xb4ea87[_0x5214('0x3a')]));_0x394ae0[_0x5214('0x41')]=_['merge'](_0x394ae0[_0x5214('0x41')],{'$or':[{'ListId':_0xde6e20['id']},{'ListId':null}]});if(_0x8431cc['query']['filter']){_0x394ae0['where']=_[_0x5214('0x44')](_0x394ae0[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x394ae0['attributes'],function(_0x2e9de1){var _0x2ab280={};_0x2ab280[_0x2e9de1]={'$like':'%'+_0x8431cc['query'][_0x5214('0x43')]+'%'};return _0x2ab280;})});}_0x394ae0=_[_0x5214('0x44')]({},_0x394ae0,_0x8431cc[_0x5214('0x60')]);return db[_0x5214('0x6e')][_0x5214('0x9b')](_0x394ae0);}})[_0x5214('0x27')](respondWithResult(_0x51f1e4,null))['catch'](handleError(_0x51f1e4,null));};exports[_0x5214('0x9c')]=function(_0x1fe8e8,_0x43780d){return db['CmCustomField'][_0x5214('0x9b')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x43780d,null))[_0x5214('0x27')](function(_0x323bec){return _0x323bec;})[_0x5214('0x27')](respondWithResult(_0x43780d,null))[_0x5214('0x4a')](handleError(_0x43780d,null));};exports['addAgents']=function(_0x182f50,_0x15735d,_0x48c36f){return db[_0x5214('0x33')]['find']({'where':{'id':_0x182f50[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x15735d,null))[_0x5214('0x27')](function(_0x324cad){if(_0x324cad){return _0x324cad[_0x5214('0x9d')](_0x182f50[_0x5214('0x4f')]['ids'],_[_0x5214('0x67')](_0x182f50[_0x5214('0x4f')],['ids','id'])||{})[_0x5214('0x9e')](function(_0x57514a){for(var _0x2ea670=0x0;_0x2ea670<_0x182f50[_0x5214('0x4f')]['ids'][_0x5214('0x3e')];_0x2ea670+=0x1){socket[_0x5214('0x9f')](_0x5214('0xa0'),{'UserId':Number(_0x182f50['body'][_0x5214('0x62')][_0x2ea670]),'CmListId':Number(_0x182f50[_0x5214('0x58')]['id'])});}return _0x57514a;});}})['then'](respondWithResult(_0x15735d,null))['catch'](handleError(_0x15735d,null));};exports[_0x5214('0xa1')]=function(_0x20b290,_0x46b294,_0x4151a2){return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x20b290[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x46b294,null))['then'](function(_0x2f921d){if(_0x2f921d){return _0x2f921d['removeAgents'](_0x20b290[_0x5214('0x39')][_0x5214('0x62')])[_0x5214('0x27')](function(){if(_[_0x5214('0x65')](_0x20b290[_0x5214('0x39')][_0x5214('0x62')])){for(var _0x153d8a=0x0;_0x153d8a<_0x20b290[_0x5214('0x39')][_0x5214('0x62')][_0x5214('0x3e')];_0x153d8a+=0x1){socket[_0x5214('0x9f')](_0x5214('0xa2'),{'UserId':Number(_0x20b290[_0x5214('0x39')]['ids'][_0x153d8a]),'CmListId':Number(_0x20b290[_0x5214('0x58')]['id'])});}}else{socket[_0x5214('0x9f')]('userCmList:remove',{'UserId':Number(_0x20b290[_0x5214('0x39')][_0x5214('0x62')]),'CmListId':Number(_0x20b290[_0x5214('0x58')]['id'])});}});}})[_0x5214('0x27')](respondWithStatusCode(_0x46b294,null))[_0x5214('0x4a')](handleError(_0x46b294,null));};exports[_0x5214('0xa3')]=function(_0x48befb,_0x6218de,_0x4caa38){var _0x54e4f7={};var _0x2cccbd={};var _0x196484;var _0x39c4c2;return db[_0x5214('0x33')][_0x5214('0x5c')]({'where':{'id':_0x48befb[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x6218de,null))[_0x5214('0x27')](function(_0x15ef56){if(_0x15ef56){_0x196484=_0x15ef56;_0x2cccbd[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0xa4')]['rawAttributes']);_0x2cccbd[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x48befb[_0x5214('0x39')]);_0x2cccbd[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0x2cccbd[_0x5214('0x38')],_0x2cccbd[_0x5214('0x39')]);_0x54e4f7[_0x5214('0x3d')]=_[_0x5214('0x3b')](_0x2cccbd['model'],qs['fields'](_0x48befb[_0x5214('0x39')][_0x5214('0x3c')]));_0x54e4f7[_0x5214('0x3d')]=_0x54e4f7[_0x5214('0x3d')]['length']?_0x54e4f7['attributes']:_0x2cccbd[_0x5214('0x38')];_0x54e4f7[_0x5214('0x40')]=qs[_0x5214('0x5e')](_0x48befb[_0x5214('0x39')][_0x5214('0x5e')]);_0x54e4f7[_0x5214('0x41')]=qs[_0x5214('0x3a')](_['pick'](_0x48befb[_0x5214('0x39')],_0x2cccbd[_0x5214('0x3a')]));if(_0x48befb[_0x5214('0x39')][_0x5214('0x43')]){_0x54e4f7[_0x5214('0x41')]=_['merge'](_0x54e4f7['where'],{'$or':_[_0x5214('0x32')](_0x54e4f7[_0x5214('0x3d')],function(_0x4e1e1f){var _0x44aa42={};_0x44aa42[_0x4e1e1f]={'$like':'%'+_0x48befb[_0x5214('0x39')][_0x5214('0x43')]+'%'};return _0x44aa42;})});}_0x54e4f7=_[_0x5214('0x44')]({},_0x54e4f7,_0x48befb['options']);return _0x196484[_0x5214('0xa3')](_0x54e4f7);}})[_0x5214('0x27')](function(_0x598f0e){if(_0x598f0e){_0x39c4c2=_0x598f0e[_0x5214('0x3e')];if(!_0x48befb['query'][_0x5214('0x3f')](_0x5214('0x5d'))){_0x54e4f7['limit']=qs[_0x5214('0x1e')](_0x48befb['query'][_0x5214('0x1e')]);_0x54e4f7[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x48befb[_0x5214('0x39')][_0x5214('0x1d')]);}return _0x196484[_0x5214('0xa3')](_0x54e4f7);}})[_0x5214('0x27')](function(_0x178425){if(_0x178425){return _0x178425?{'count':_0x39c4c2,'rows':_0x178425}:null;}})[_0x5214('0x27')](respondWithResult(_0x6218de,null))[_0x5214('0x4a')](handleError(_0x6218de,null));};function handleQuery(_0x3b7fab){logger[_0x5214('0xa5')](_0x3b7fab);return db[_0x5214('0x8f')][_0x5214('0x39')](_0x3b7fab)['spread'](function(_0x13e673){csv_results[_0x5214('0x69')](_0x13e673);})['catch'](function(_0x48ef0a){logger[_0x5214('0x2d')](_0x48ef0a[_0x5214('0x6b')]);});} \ No newline at end of file +var _0x2cb6=['distinct','field','c.cf_','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','addCustomFields','TEXT','text','number','INTEGER','switch','Sequelize','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','name','send','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','type','options','where','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','pick','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null'];(function(_0x94c91b,_0x2267cf){var _0x1a01b8=function(_0x2a3917){while(--_0x2a3917){_0x94c91b['push'](_0x94c91b['shift']());}};_0x1a01b8(++_0x2267cf);}(_0x2cb6,0xce));var _0x62cb=function(_0x2866c0,_0x3eb131){_0x2866c0=_0x2866c0-0x0;var _0x45d798=_0x2cb6[_0x2866c0];return _0x45d798;};'use strict';var emlformat=require(_0x62cb('0x0'));var rimraf=require(_0x62cb('0x1'));var zipdir=require(_0x62cb('0x2'));var jsonpatch=require(_0x62cb('0x3'));var rp=require(_0x62cb('0x4'));var moment=require('moment');var BPromise=require(_0x62cb('0x5'));var Mustache=require(_0x62cb('0x6'));var util=require(_0x62cb('0x7'));var path=require(_0x62cb('0x8'));var sox=require(_0x62cb('0x9'));var csv=require(_0x62cb('0xa'));var ejs=require(_0x62cb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62cb('0xc'));var squel=require(_0x62cb('0xd'));var crypto=require(_0x62cb('0xe'));var jsforce=require(_0x62cb('0xf'));var deskjs=require(_0x62cb('0x10'));var toCsv=require(_0x62cb('0xa'));var querystring=require('querystring');var Papa=require(_0x62cb('0x11'));var Redis=require(_0x62cb('0x12'));var authService=require(_0x62cb('0x13'));var qs=require(_0x62cb('0x14'));var as=require(_0x62cb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x62cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62cb('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x62cb('0x18')]=_[_0x62cb('0x19')](config[_0x62cb('0x18')],{'host':_0x62cb('0x1a'),'port':0x18eb});var socket=require(_0x62cb('0x1b'))(new Redis(config[_0x62cb('0x18')]));require(_0x62cb('0x1c'))[_0x62cb('0x1d')](socket);function respondWithStatusCode(_0x45cfd7,_0x13c412){_0x13c412=_0x13c412||0xcc;return function(_0x252141){if(_0x252141){return _0x45cfd7[_0x62cb('0x1e')](_0x13c412);}return _0x45cfd7[_0x62cb('0x1f')](_0x13c412)['end']();};}function respondWithResult(_0x23ae25,_0x70ffe1){_0x70ffe1=_0x70ffe1||0xc8;return function(_0x1f8eb2){if(_0x1f8eb2){return _0x23ae25[_0x62cb('0x1f')](_0x70ffe1)[_0x62cb('0x20')](_0x1f8eb2);}};}function respondWithFilteredResult(_0x19bdb3,_0x26bd89){return function(_0x595770){if(_0x595770){var _0x1d520e=typeof _0x26bd89[_0x62cb('0x21')]===_0x62cb('0x22')&&typeof _0x26bd89[_0x62cb('0x23')]===_0x62cb('0x22');var _0x441fc9=_0x595770[_0x62cb('0x24')];var _0x4fb7ae=_0x1d520e?0x0:_0x26bd89['offset'];var _0x13aa02=_0x1d520e?_0x595770[_0x62cb('0x24')]:_0x26bd89[_0x62cb('0x21')]+_0x26bd89[_0x62cb('0x23')];var _0x4c8321;if(_0x13aa02>=_0x441fc9){_0x13aa02=_0x441fc9;_0x4c8321=0xc8;}else{_0x4c8321=0xce;}_0x19bdb3['status'](_0x4c8321);return _0x19bdb3[_0x62cb('0x25')](_0x62cb('0x26'),_0x4fb7ae+'-'+_0x13aa02+'/'+_0x441fc9)[_0x62cb('0x20')](_0x595770);}return null;};}function patchUpdates(_0x1bfd65){return function(_0x1c3243){try{jsonpatch[_0x62cb('0x27')](_0x1c3243,_0x1bfd65,!![]);}catch(_0x2b2c76){return BPromise[_0x62cb('0x28')](_0x2b2c76);}return _0x1c3243[_0x62cb('0x29')]();};}function saveUpdates(_0x570ad9,_0x468d70){return function(_0x2614e6){if(_0x2614e6){return _0x2614e6[_0x62cb('0x2a')](_0x570ad9)['then'](function(_0x1a3cb5){return _0x1a3cb5;});}return null;};}function removeEntity(_0x487890,_0x16e5a7){return function(_0x542fbe){if(_0x542fbe){return _0x542fbe['destroy']()[_0x62cb('0x2b')](function(){var _0x433c88=_0x542fbe['get']({'plain':!![]});var _0x470030='Lists';return db[_0x62cb('0x2c')][_0x62cb('0x2d')]({'where':{'type':_0x470030,'resourceId':_0x433c88['id']}})[_0x62cb('0x2b')](function(){return _0x542fbe;});})[_0x62cb('0x2b')](function(){_0x487890['status'](0xcc)[_0x62cb('0x2e')]();});}};}function handleEntityNotFound(_0xa818ef,_0x28ea8b){return function(_0x1f0c69){if(!_0x1f0c69){_0xa818ef[_0x62cb('0x1e')](0x194);}return _0x1f0c69;};}function handleError(_0x23b8bd,_0x4bd286){_0x4bd286=_0x4bd286||0x1f4;return function(_0x525b0d){logger[_0x62cb('0x2f')](_0x525b0d['stack']);if(_0x525b0d['name']){delete _0x525b0d[_0x62cb('0x30')];}_0x23b8bd[_0x62cb('0x1f')](_0x4bd286)[_0x62cb('0x31')](_0x525b0d);};}exports['index']=function(_0x1aa3f5,_0x4f1150){var _0x3e2448={},_0x5f36ad={},_0xef3d96={'count':0x0,'rows':[]};var _0x2b2211=_[_0x62cb('0x32')](db[_0x62cb('0x33')][_0x62cb('0x34')],function(_0x2ca34a){return{'name':_0x2ca34a[_0x62cb('0x35')],'type':_0x2ca34a['type'][_0x62cb('0x36')]};});_0x5f36ad[_0x62cb('0x37')]=_[_0x62cb('0x32')](_0x2b2211,_0x62cb('0x30'));_0x5f36ad[_0x62cb('0x38')]=_['keys'](_0x1aa3f5[_0x62cb('0x38')]);_0x5f36ad[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x5f36ad[_0x62cb('0x37')],_0x5f36ad[_0x62cb('0x38')]);_0x3e2448[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0x5f36ad['model'],qs['fields'](_0x1aa3f5['query'][_0x62cb('0x3c')]));_0x3e2448[_0x62cb('0x3b')]=_0x3e2448[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x3e2448[_0x62cb('0x3b')]:_0x5f36ad['model'];if(!_0x1aa3f5['query'][_0x62cb('0x3e')]('nolimit')){_0x3e2448[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x23')]);_0x3e2448[_0x62cb('0x21')]=qs[_0x62cb('0x21')](_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x21')]);}_0x3e2448[_0x62cb('0x3f')]=qs['sort'](_0x1aa3f5['query'][_0x62cb('0x40')]);_0x3e2448['where']=qs[_0x62cb('0x39')](_['pick'](_0x1aa3f5[_0x62cb('0x38')],_0x5f36ad[_0x62cb('0x39')]),_0x2b2211);if(_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x41')]){_0x3e2448['where']=_[_0x62cb('0x42')](_0x3e2448['where'],{'$or':_[_0x62cb('0x32')](_0x2b2211,function(_0x36c237){if(_0x36c237[_0x62cb('0x43')]!=='VIRTUAL'){var _0x2a8181={};_0x2a8181[_0x36c237[_0x62cb('0x30')]]={'$like':'%'+_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x2a8181;}})});}_0x3e2448=_[_0x62cb('0x42')]({},_0x3e2448,_0x1aa3f5[_0x62cb('0x44')]);var _0x33ca1d={'where':_0x3e2448[_0x62cb('0x45')]};return db['CmList'][_0x62cb('0x24')](_0x33ca1d)['then'](function(_0x4571a4){_0xef3d96[_0x62cb('0x24')]=_0x4571a4;if(_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x46')]){_0x3e2448[_0x62cb('0x47')]=[{'all':!![]}];}return db['CmList'][_0x62cb('0x48')](_0x3e2448);})['then'](function(_0x228f40){_0xef3d96[_0x62cb('0x49')]=_0x228f40;return _0xef3d96;})['then'](respondWithFilteredResult(_0x4f1150,_0x3e2448))[_0x62cb('0x4a')](handleError(_0x4f1150,null));};exports[_0x62cb('0x4b')]=function(_0x58e8bc,_0x55ffba){var _0x5540d5={'raw':![],'where':{'id':_0x58e8bc[_0x62cb('0x4c')]['id']}},_0xc5dd0e={};_0xc5dd0e[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db[_0x62cb('0x33')][_0x62cb('0x34')]);_0xc5dd0e[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x58e8bc[_0x62cb('0x38')]);_0xc5dd0e['filters']=_[_0x62cb('0x3a')](_0xc5dd0e[_0x62cb('0x37')],_0xc5dd0e[_0x62cb('0x38')]);_0x5540d5[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0xc5dd0e[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x58e8bc[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x5540d5[_0x62cb('0x3b')]=_0x5540d5[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x5540d5[_0x62cb('0x3b')]:_0xc5dd0e[_0x62cb('0x37')];if(_0x58e8bc[_0x62cb('0x38')][_0x62cb('0x46')]){_0x5540d5[_0x62cb('0x47')]=[{'all':!![]}];}_0x5540d5=_[_0x62cb('0x42')]({},_0x5540d5,_0x58e8bc['options']);return db[_0x62cb('0x33')][_0x62cb('0x4e')](_0x5540d5)['then'](handleEntityNotFound(_0x55ffba,null))['then'](respondWithResult(_0x55ffba,null))[_0x62cb('0x4a')](handleError(_0x55ffba,null));};exports[_0x62cb('0x4f')]=function(_0x34863d,_0x479bfe){return db[_0x62cb('0x33')][_0x62cb('0x4f')](_0x34863d['body'],{})['then'](function(_0x4af93e){var _0x518935=_0x34863d[_0x62cb('0x50')][_0x62cb('0x51')]({'plain':!![]});if(!_0x518935)throw new Error(_0x62cb('0x52'));if(_0x518935[_0x62cb('0x53')]==='user'){var _0x355cdb=_0x4af93e[_0x62cb('0x51')]({'plain':!![]});var _0x486fb8=_0x62cb('0x54');return db[_0x62cb('0x55')][_0x62cb('0x4e')]({'where':{'name':_0x486fb8,'userProfileId':_0x518935['userProfileId']},'raw':!![]})[_0x62cb('0x2b')](function(_0xf929a1){if(_0xf929a1&&_0xf929a1[_0x62cb('0x56')]===0x0){return db[_0x62cb('0x2c')][_0x62cb('0x4f')]({'name':_0x355cdb['name'],'resourceId':_0x355cdb['id'],'type':_0xf929a1[_0x62cb('0x30')],'sectionId':_0xf929a1['id']},{})['then'](function(){return _0x4af93e;});}else{return _0x4af93e;}})['catch'](function(_0x41356f){logger['error'](_0x62cb('0x57'),_0x41356f);throw _0x41356f;});}return _0x4af93e;})[_0x62cb('0x2b')](respondWithResult(_0x479bfe,0xc9))[_0x62cb('0x4a')](handleError(_0x479bfe,null));};exports[_0x62cb('0x2a')]=function(_0x3dfb04,_0x4a424d){if(_0x3dfb04[_0x62cb('0x58')]['id']){delete _0x3dfb04[_0x62cb('0x58')]['id'];}return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x3dfb04[_0x62cb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a424d,null))['then'](saveUpdates(_0x3dfb04['body'],null))[_0x62cb('0x2b')](respondWithResult(_0x4a424d,null))[_0x62cb('0x4a')](handleError(_0x4a424d,null));};exports[_0x62cb('0x2d')]=function(_0x5062aa,_0x59e77f){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x5062aa[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x59e77f,null))[_0x62cb('0x2b')](removeEntity(_0x59e77f,null))[_0x62cb('0x4a')](handleError(_0x59e77f,null));};exports['describe']=function(_0x188b63,_0x457bad){return db[_0x62cb('0x33')][_0x62cb('0x59')]()[_0x62cb('0x2b')](respondWithResult(_0x457bad,null))[_0x62cb('0x4a')](handleError(_0x457bad,null));};exports[_0x62cb('0x5a')]=function(_0x5a590f,_0xbb6ca1,_0x241fd2){if(_0x5a590f[_0x62cb('0x58')]['id']){delete _0x5a590f[_0x62cb('0x58')]['id'];}return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x5a590f[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0xbb6ca1,null))[_0x62cb('0x2b')](function(_0x25116c){if(_0x25116c){_0x5a590f[_0x62cb('0x58')]['ListId']=_0x25116c['id'];return db[_0x62cb('0x5b')]['create'](_0x5a590f[_0x62cb('0x58')]);}})[_0x62cb('0x2b')](respondWithResult(_0xbb6ca1,null))[_0x62cb('0x4a')](handleError(_0xbb6ca1,null));};exports[_0x62cb('0x5c')]=function(_0x32f085,_0x11bf97,_0x414b63){var _0x4fc2f9={'raw':![],'where':{}};var _0x524977={};var _0x349131={'count':0x0,'rows':[]};return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x32f085['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x11bf97,null))[_0x62cb('0x2b')](function(_0x2e15ca){if(_0x2e15ca){_0x524977[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db['Disposition'][_0x62cb('0x34')]);_0x524977[_0x62cb('0x38')]=_['keys'](_0x32f085[_0x62cb('0x38')]);_0x524977['filters']=_[_0x62cb('0x3a')](_0x524977[_0x62cb('0x37')],_0x524977[_0x62cb('0x38')]);_0x4fc2f9[_0x62cb('0x3b')]=_['intersection'](_0x524977['model'],qs[_0x62cb('0x3c')](_0x32f085[_0x62cb('0x38')]['fields']));_0x4fc2f9[_0x62cb('0x3b')]=_0x4fc2f9[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x4fc2f9[_0x62cb('0x3b')]:_0x524977[_0x62cb('0x37')];if(!_0x32f085[_0x62cb('0x38')][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x4fc2f9[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x32f085['query'][_0x62cb('0x23')]);_0x4fc2f9['offset']=qs[_0x62cb('0x21')](_0x32f085['query'][_0x62cb('0x21')]);}_0x4fc2f9[_0x62cb('0x3f')]=qs[_0x62cb('0x40')](_0x32f085[_0x62cb('0x38')][_0x62cb('0x40')]);_0x4fc2f9[_0x62cb('0x45')]=qs['filters'](_[_0x62cb('0x5f')](_0x32f085[_0x62cb('0x38')],_0x524977[_0x62cb('0x39')]));_0x4fc2f9[_0x62cb('0x45')][_0x62cb('0x60')]=_0x2e15ca['id'];if(_0x32f085[_0x62cb('0x38')][_0x62cb('0x41')]){_0x4fc2f9[_0x62cb('0x45')]=_[_0x62cb('0x42')](_0x4fc2f9[_0x62cb('0x45')],{'$or':_[_0x62cb('0x32')](_0x4fc2f9[_0x62cb('0x3b')],function(_0x3e206a){var _0x1b7de3={};_0x1b7de3[_0x3e206a]={'$like':'%'+_0x32f085[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x1b7de3;})});}_0x4fc2f9=_[_0x62cb('0x42')]({},_0x4fc2f9,_0x32f085['options']);return db['Disposition'][_0x62cb('0x24')]({'where':_0x4fc2f9[_0x62cb('0x45')]})[_0x62cb('0x2b')](function(_0x5abedb){_0x349131[_0x62cb('0x24')]=_0x5abedb;if(_0x32f085[_0x62cb('0x38')]['includeAll']){_0x4fc2f9[_0x62cb('0x47')]=[{'all':!![]}];}return db[_0x62cb('0x5b')][_0x62cb('0x48')](_0x4fc2f9);})[_0x62cb('0x2b')](function(_0x307817){_0x349131[_0x62cb('0x49')]=_0x307817;return _0x349131;});}})['then'](respondWithFilteredResult(_0x11bf97,_0x4fc2f9))[_0x62cb('0x4a')](handleError(_0x11bf97,null));};exports[_0x62cb('0x61')]=function(_0x1489ec,_0x375882,_0xf66e4d){return db[_0x62cb('0x33')]['find']({'where':{'id':_0x1489ec[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x375882,null))[_0x62cb('0x2b')](function(_0x132785){if(_0x132785){return _0x132785[_0x62cb('0x61')](_0x1489ec[_0x62cb('0x38')][_0x62cb('0x62')]);}})[_0x62cb('0x2b')](respondWithStatusCode(_0x375882,null))[_0x62cb('0x4a')](handleError(_0x375882,null));};exports[_0x62cb('0x63')]=function(_0x2e71ce,_0x3c9c91,_0x354e2c){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x2e71ce[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x3c9c91,null))[_0x62cb('0x2b')](function(_0x2ebd47){if(_0x2ebd47){var _0x1ccc88=[];var _0x63659b={'success':[],'errors':[]};return db[_0x62cb('0x64')][_0x62cb('0x59')]()[_0x62cb('0x2b')](function(_0x4ebc6c){if(_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]&&_[_0x62cb('0x66')](_0x2e71ce['body'][_0x62cb('0x65')])){if(_0x2e71ce['body'][_0x62cb('0x65')][_0x62cb('0x3d')]){_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')][_0x62cb('0x67')](';')+';';}else{_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=null;}}else{_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=null;}if(_0x2e71ce[_0x62cb('0x58')]&&_[_0x62cb('0x66')](_0x2e71ce[_0x62cb('0x58')])){for(var _0x5ceffc=0x0;_0x5ceffc<_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x3d')];_0x5ceffc+=0x1){_0x2e71ce['body'][_0x5ceffc]['ListId']=_0x2e71ce['params']['id'];_0x1ccc88[_0x62cb('0x68')](_0x2e71ce['body'][_0x5ceffc]);}return BPromise[_0x62cb('0x69')](_0x1ccc88,function(_0x110246){return db[_0x62cb('0x64')][_0x62cb('0x4f')](_[_0x62cb('0x6a')](_0x110246,[_0x62cb('0x62'),'id'])||{},{'fields':_[_0x62cb('0x4d')](_0x4ebc6c),'raw':!![]})[_0x62cb('0x2b')](function(_0x3b06c6){_0x63659b[_0x62cb('0x6b')]['push'](_0x3b06c6[_0x62cb('0x6c')]);})[_0x62cb('0x4a')](function(_0x430f5e){_0x63659b[_0x62cb('0x6d')][_0x62cb('0x68')]({'data':_0x110246,'error':_0x430f5e[_0x62cb('0x6e')]});});})[_0x62cb('0x2b')](function(_0xf7ba04){return _0x63659b;})[_0x62cb('0x4a')](function(_0x1ae0b7){return _0x1ae0b7;});}else{_0x3c9c91['status'](0x190)[_0x62cb('0x20')]({'message':_0x62cb('0x6f')});}});}})[_0x62cb('0x2b')](respondWithResult(_0x3c9c91,null))[_0x62cb('0x4a')](handleError(_0x3c9c91,null));};exports['getContacts']=function(_0x5d67a2,_0x1a3ff3,_0x213041){var _0x5287fc;return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x5d67a2['params']['id']},'include':[{'model':db[_0x62cb('0x70')],'as':'CustomFields'}]})[_0x62cb('0x2b')](handleEntityNotFound(_0x1a3ff3,null))[_0x62cb('0x2b')](function(_0x2832d2){if(_0x2832d2){_0x5287fc=_0x2832d2;return db[_0x62cb('0x64')][_0x62cb('0x34')];}})[_0x62cb('0x2b')](function(_0x4a1ba9){if(_0x4a1ba9){var _0x18263c={};var _0xbbe86a={};_0xbbe86a[_0x62cb('0x37')]=_[_0x62cb('0x71')](_['keys'](_0x4a1ba9),_['map'](_0x5287fc[_0x62cb('0x72')],function(_0x4e762a){return util[_0x62cb('0x73')]('cf_%d',_0x4e762a['id']);}));_0xbbe86a[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x5d67a2['query']);_0xbbe86a['filters']=_[_0x62cb('0x3a')](_0xbbe86a['model'],_0xbbe86a['query']);_0x18263c[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0xbbe86a[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x18263c[_0x62cb('0x3b')]=_0x18263c[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x18263c[_0x62cb('0x3b')]:_0xbbe86a[_0x62cb('0x37')];if(!_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x18263c[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x23')]);_0x18263c['offset']=qs[_0x62cb('0x21')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x21')]);}_0x18263c[_0x62cb('0x3f')]=qs['sort'](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x40')]);_0x18263c[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_[_0x62cb('0x5f')](_0x5d67a2[_0x62cb('0x38')],_0xbbe86a[_0x62cb('0x39')]));_0x18263c[_0x62cb('0x74')]=!![];if(_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x41')]){_0x18263c['where']=_['merge'](_0x18263c[_0x62cb('0x45')],{'$or':_['map'](_0x18263c['attributes'],function(_0x3270b6){var _0xeff238={};_0xeff238[_0x3270b6]={'$like':'%'+_0x5d67a2['query'][_0x62cb('0x41')]+'%'};return _0xeff238;})});}_0x18263c=_[_0x62cb('0x42')]({},_0x18263c,_0x5d67a2[_0x62cb('0x44')]);return _0x5287fc[_0x62cb('0x75')](_0x18263c);}})['then'](respondWithResult(_0x1a3ff3,null))[_0x62cb('0x4a')](handleError(_0x1a3ff3,null));};exports['getContactsCsv']=function(_0x4ecc43,_0xe63bf3,_0x50c852){var _0x217789;var _0x474a6f;var _0x139555;var _0x28ede3=_0x4ecc43['params']['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x62cb('0x30')],'raw':!![],'order':[_0x62cb('0x76')]})[_0x62cb('0x2b')](function(_0x4057d4){_0x217789=_0x4057d4;var _0x3e235d=_[_0x62cb('0x4d')](db[_0x62cb('0x64')]['rawAttributes']);return db[_0x62cb('0x70')][_0x62cb('0x48')]({'raw':!![],'attributes':['id',_0x62cb('0x77')]})[_0x62cb('0x2b')](function(_0x574ca6){_0x474a6f=_0x574ca6;var _0xf7d7c7=squel['select']()[_0x62cb('0x3c')](_0x3e235d)[_0x62cb('0x78')](_0x62cb('0x79'),'c')[_0x62cb('0x45')](_0x62cb('0x7a'),_0x28ede3)[_0x62cb('0x45')](_0x62cb('0x7b'))[_0x62cb('0x7c')]();for(var _0x5df4e6=0x0;_0x5df4e6<_0x474a6f[_0x62cb('0x3d')];_0x5df4e6++){_0xf7d7c7[_0x62cb('0x7d')](_0x62cb('0x7e')+_0x474a6f[_0x5df4e6]['id'],_0x62cb('0x7f')+_0x474a6f[_0x5df4e6][_0x62cb('0x77')]);}for(var _0x5df4e6=0x0;_0x5df4e6<_0x217789['length'];_0x5df4e6++){_0xf7d7c7['field'](squel[_0x62cb('0x80')]()[_0x62cb('0x7d')](_0x62cb('0x81'))[_0x62cb('0x78')](_0x62cb('0x82'))[_0x62cb('0x45')](_0x62cb('0x83'),_0x217789[_0x5df4e6]['id'])[_0x62cb('0x45')](_0x62cb('0x84')),_0x62cb('0x85')+_0x217789[_0x5df4e6][_0x62cb('0x30')]);_0xf7d7c7['field'](squel[_0x62cb('0x80')]()[_0x62cb('0x7d')]('description')[_0x62cb('0x78')](_0x62cb('0x82'))[_0x62cb('0x45')](_0x62cb('0x83'),_0x217789[_0x5df4e6]['id'])[_0x62cb('0x45')](_0x62cb('0x84')),_0x62cb('0x86')+_0x217789[_0x5df4e6]['name']);}var _0x311a40=[];_0x311a40[_0x62cb('0x68')](_0xf7d7c7[_0x62cb('0x87')]());BPromise['each'](_0x311a40,handleQuery)[_0x62cb('0x2b')](function(_0x1f45bb){handleQuery(_0xf7d7c7[_0x62cb('0x87')]());var _0x4c2eb5=csv_results[0x0];if(!_['isEmpty'](_0x4c2eb5)){var _0x1c56db=toCsv(_0x4c2eb5);var _0x476335=Date[_0x62cb('0x88')]();fs['writeFileSync'](util['format'](_0x62cb('0x89'),_0x28ede3,_0x476335),_0x1c56db);_0xe63bf3[_0x62cb('0x8a')](_0x62cb('0x8b'),_0x62cb('0x8c')+util[_0x62cb('0x73')](_0x62cb('0x8d'),_0x28ede3,_0x476335));_0xe63bf3[_0x62cb('0x8a')](_0x62cb('0x8e'),_0x62cb('0x8f'));return _0xe63bf3['download'](util[_0x62cb('0x73')](_0x62cb('0x89'),_0x28ede3,_0x476335));}else{return _0xe63bf3[_0x62cb('0x1e')](0xcc);}});});});};exports['addCustomField']=function(_0x15ffb8,_0x33424e,_0x554b30){var _0x218777;delete _0x15ffb8[_0x62cb('0x58')]['id'];return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x15ffb8[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x33424e,null))[_0x62cb('0x2b')](function(_0x33b86a){if(_0x33b86a){return db[_0x62cb('0x90')]['transaction'](function(_0x591fbd){return db[_0x62cb('0x70')][_0x62cb('0x4f')](_0x15ffb8['body'],{'transaction':_0x591fbd})['then'](function(_0x5ea886){_0x218777=_0x5ea886;return _0x33b86a[_0x62cb('0x91')](_0x5ea886,{'transaction':_0x591fbd});})[_0x62cb('0x2b')](function(){var _0x167fc9={'type':db['Sequelize'][_0x62cb('0x92')],'transaction':_0x591fbd};switch(_0x15ffb8['body'][_0x62cb('0x43')]){case _0x62cb('0x93'):_0x167fc9[_0x62cb('0x43')]=db['Sequelize']['TEXT'];break;case _0x62cb('0x94'):_0x167fc9[_0x62cb('0x43')]=db['Sequelize'][_0x62cb('0x95')];break;case _0x62cb('0x96'):_0x167fc9[_0x62cb('0x43')]=db[_0x62cb('0x97')][_0x62cb('0x98')];_0x167fc9[_0x62cb('0x99')]=![];break;default:}return db['sequelize'][_0x62cb('0x9a')]['addColumn'](_0x62cb('0x79'),util[_0x62cb('0x73')](_0x62cb('0x9b'),_0x218777['id']),_0x167fc9);})['then'](function(){return _0x218777;});});}})[_0x62cb('0x2b')](respondWithResult(_0x33424e,null))[_0x62cb('0x4a')](handleError(_0x33424e,null));};exports[_0x62cb('0x9c')]=function(_0x1dc021,_0x1badb1,_0x6d4bf){var _0xb87245={};var _0x418e69={};var _0x2fc10d;var _0x3828c9;return db[_0x62cb('0x33')]['findOne']({'where':{'id':_0x1dc021[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x1badb1,null))[_0x62cb('0x2b')](function(_0xe627c3){if(_0xe627c3){_0x2fc10d=_0xe627c3;_0x418e69[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db[_0x62cb('0x70')][_0x62cb('0x34')]);_0x418e69[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x1dc021[_0x62cb('0x38')]);_0x418e69[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x418e69[_0x62cb('0x37')],_0x418e69[_0x62cb('0x38')]);_0xb87245[_0x62cb('0x3b')]=_['intersection'](_0x418e69[_0x62cb('0x37')],qs['fields'](_0x1dc021[_0x62cb('0x38')][_0x62cb('0x3c')]));_0xb87245['attributes']=_0xb87245['attributes'][_0x62cb('0x3d')]?_0xb87245['attributes']:_0x418e69['model'];_0xb87245[_0x62cb('0x3f')]=qs['sort'](_0x1dc021['query']['sort']);_0xb87245[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_['pick'](_0x1dc021[_0x62cb('0x38')],_0x418e69[_0x62cb('0x39')]));_0xb87245[_0x62cb('0x45')]=_[_0x62cb('0x42')](_0xb87245['where'],{'$or':[{'ListId':_0xe627c3['id']},{'ListId':null}]});if(_0x1dc021[_0x62cb('0x38')]['filter']){_0xb87245[_0x62cb('0x45')]=_['merge'](_0xb87245[_0x62cb('0x45')],{'$or':_['map'](_0xb87245[_0x62cb('0x3b')],function(_0x22c078){var _0x30f82f={};_0x30f82f[_0x22c078]={'$like':'%'+_0x1dc021[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x30f82f;})});}_0xb87245=_[_0x62cb('0x42')]({},_0xb87245,_0x1dc021[_0x62cb('0x44')]);return db['CmCustomField'][_0x62cb('0x9d')](_0xb87245);}})[_0x62cb('0x2b')](respondWithResult(_0x1badb1,null))['catch'](handleError(_0x1badb1,null));};exports[_0x62cb('0x9e')]=function(_0x256226,_0x1ddbd2){return db[_0x62cb('0x70')][_0x62cb('0x9d')]({'where':{'ListId':null}})[_0x62cb('0x2b')](handleEntityNotFound(_0x1ddbd2,null))[_0x62cb('0x2b')](function(_0x426485){return _0x426485;})[_0x62cb('0x2b')](respondWithResult(_0x1ddbd2,null))['catch'](handleError(_0x1ddbd2,null));};exports[_0x62cb('0x9f')]=function(_0x55a2eb,_0x370d60,_0x48a5ec){return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x55a2eb['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x370d60,null))[_0x62cb('0x2b')](function(_0x5221b9){if(_0x5221b9){return _0x5221b9[_0x62cb('0x9f')](_0x55a2eb['body'][_0x62cb('0x62')],_['omit'](_0x55a2eb[_0x62cb('0x58')],[_0x62cb('0x62'),'id'])||{})['spread'](function(_0x508e29){for(var _0x160edc=0x0;_0x160edc<_0x55a2eb['body'][_0x62cb('0x62')][_0x62cb('0x3d')];_0x160edc+=0x1){socket['emit'](_0x62cb('0xa0'),{'UserId':Number(_0x55a2eb[_0x62cb('0x58')][_0x62cb('0x62')][_0x160edc]),'CmListId':Number(_0x55a2eb['params']['id'])});}return _0x508e29;});}})['then'](respondWithResult(_0x370d60,null))[_0x62cb('0x4a')](handleError(_0x370d60,null));};exports[_0x62cb('0xa1')]=function(_0xf07cc3,_0x3b5273,_0x5d96a9){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0xf07cc3[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x3b5273,null))[_0x62cb('0x2b')](function(_0x5c5bea){if(_0x5c5bea){return _0x5c5bea['removeAgents'](_0xf07cc3['query']['ids'])[_0x62cb('0x2b')](function(){if(_[_0x62cb('0x66')](_0xf07cc3[_0x62cb('0x38')][_0x62cb('0x62')])){for(var _0x3bbe9c=0x0;_0x3bbe9c<_0xf07cc3['query'][_0x62cb('0x62')][_0x62cb('0x3d')];_0x3bbe9c+=0x1){socket['emit'](_0x62cb('0xa2'),{'UserId':Number(_0xf07cc3[_0x62cb('0x38')]['ids'][_0x3bbe9c]),'CmListId':Number(_0xf07cc3['params']['id'])});}}else{socket['emit'](_0x62cb('0xa2'),{'UserId':Number(_0xf07cc3[_0x62cb('0x38')]['ids']),'CmListId':Number(_0xf07cc3[_0x62cb('0x4c')]['id'])});}});}})[_0x62cb('0x2b')](respondWithStatusCode(_0x3b5273,null))['catch'](handleError(_0x3b5273,null));};exports[_0x62cb('0xa3')]=function(_0x157136,_0x11b24c,_0x490809){var _0x31cb26={};var _0x2feb4d={};var _0x4cccb3;var _0x54bd41;return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x157136['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x11b24c,null))[_0x62cb('0x2b')](function(_0x1e4f37){if(_0x1e4f37){_0x4cccb3=_0x1e4f37;_0x2feb4d[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db['User'][_0x62cb('0x34')]);_0x2feb4d[_0x62cb('0x38')]=_['keys'](_0x157136[_0x62cb('0x38')]);_0x2feb4d[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x2feb4d[_0x62cb('0x37')],_0x2feb4d[_0x62cb('0x38')]);_0x31cb26[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0x2feb4d[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x157136[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x31cb26[_0x62cb('0x3b')]=_0x31cb26[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x31cb26[_0x62cb('0x3b')]:_0x2feb4d[_0x62cb('0x37')];_0x31cb26[_0x62cb('0x3f')]=qs['sort'](_0x157136[_0x62cb('0x38')][_0x62cb('0x40')]);_0x31cb26[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_['pick'](_0x157136[_0x62cb('0x38')],_0x2feb4d[_0x62cb('0x39')]));if(_0x157136['query']['filter']){_0x31cb26[_0x62cb('0x45')]=_['merge'](_0x31cb26[_0x62cb('0x45')],{'$or':_[_0x62cb('0x32')](_0x31cb26['attributes'],function(_0x561473){var _0x14721a={};_0x14721a[_0x561473]={'$like':'%'+_0x157136[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x14721a;})});}_0x31cb26=_[_0x62cb('0x42')]({},_0x31cb26,_0x157136[_0x62cb('0x44')]);return _0x4cccb3[_0x62cb('0xa3')](_0x31cb26);}})[_0x62cb('0x2b')](function(_0x4c7b53){if(_0x4c7b53){_0x54bd41=_0x4c7b53[_0x62cb('0x3d')];if(!_0x157136['query'][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x31cb26[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x157136[_0x62cb('0x38')][_0x62cb('0x23')]);_0x31cb26[_0x62cb('0x21')]=qs[_0x62cb('0x21')](_0x157136['query'][_0x62cb('0x21')]);}return _0x4cccb3[_0x62cb('0xa3')](_0x31cb26);}})['then'](function(_0x336e93){if(_0x336e93){return _0x336e93?{'count':_0x54bd41,'rows':_0x336e93}:null;}})[_0x62cb('0x2b')](respondWithResult(_0x11b24c,null))[_0x62cb('0x4a')](handleError(_0x11b24c,null));};function handleQuery(_0x14e4bc){logger[_0x62cb('0xa4')](_0x14e4bc);return db[_0x62cb('0x90')][_0x62cb('0x38')](_0x14e4bc)['spread'](function(_0x5b41b5){csv_results[_0x62cb('0x68')](_0x5b41b5);})[_0x62cb('0x4a')](function(_0x47ecbd){logger['error'](_0x47ecbd[_0x62cb('0x6e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d2f84ee..102a4c9 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x2341ca,_0x55b639){_0x2341ca=_0x2341ca-0x0;var _0x44c530=_0xe14b[_0x2341ca];return _0x44c530;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2e59e7,_0x138dc1){_0x2e59e7=_0x2e59e7-0x0;var _0x3b64e3=_0x3e74[_0x2e59e7];return _0x3b64e3;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a1e6d85..71b79ba 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x3defa2,_0x5e93db){var _0x506528=function(_0x28a9bd){while(--_0x28a9bd){_0x3defa2['push'](_0x3defa2['shift']());}};_0x506528(++_0x5e93db);}(_0xdace,0xc5));var _0xedac=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xdace[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x3e5304,_0x17887f){var _0x4b4e65=function(_0x4bdd73){while(--_0x4bdd73){_0x3e5304['push'](_0x3e5304['shift']());}};_0x4b4e65(++_0x17887f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4b9392,_0xe7d36e){_0x4b9392=_0x4b9392-0x0;var _0x21a7c8=_0xa8a8[_0x4b9392];return _0x21a7c8;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 5872350..fb5487b 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 _0x3b89=['localhost','socket.io-emitter','./cmList.socket','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3b89,0x167));var _0x93b8=function(_0xd03fed,_0x1bc7b1){_0xd03fed=_0xd03fed-0x0;var _0x578077=_0x3b89[_0xd03fed];return _0x578077;};'use strict';var _=require(_0x93b8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93b8('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x93b8('0x2'))(_0x93b8('0x3'));var config=require(_0x93b8('0x4'));var jayson=require(_0x93b8('0x5'));var client=jayson[_0x93b8('0x6')][_0x93b8('0x7')]({'port':0x232a});config[_0x93b8('0x8')]=_['defaults'](config[_0x93b8('0x8')],{'host':_0x93b8('0x9'),'port':0x18eb});var socket=require(_0x93b8('0xa'))(new Redis(config['redis']));require(_0x93b8('0xb'))[_0x93b8('0xc')](socket);function respondWithRpcPromise(_0xa043ab,_0x4adea6,_0x24d266){return new BPromise(function(_0xdd8593,_0x3320df){return client[_0x93b8('0xd')](_0xa043ab,_0x24d266)[_0x93b8('0xe')](function(_0xc8ce5c){logger[_0x93b8('0xf')]('CmList,\x20%s,\x20%s',_0x4adea6,'request\x20sent');logger[_0x93b8('0x10')](_0x93b8('0x11'),_0x4adea6,_0x93b8('0x12'),JSON[_0x93b8('0x13')](_0xc8ce5c));if(_0xc8ce5c[_0x93b8('0x14')]){if(_0xc8ce5c[_0x93b8('0x14')]['code']===0x1f4){logger[_0x93b8('0x14')](_0x93b8('0x15'),_0x4adea6,_0xc8ce5c[_0x93b8('0x14')]['message']);return _0x3320df(_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);}logger[_0x93b8('0x14')](_0x93b8('0x15'),_0x4adea6,_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);return _0xdd8593(_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);}else{logger[_0x93b8('0xf')](_0x93b8('0x15'),_0x4adea6,_0x93b8('0x12'));_0xdd8593(_0xc8ce5c['result']['message']);}})['catch'](function(_0x3b13b7){logger[_0x93b8('0x14')]('CmList,\x20%s,\x20%s',_0x4adea6,_0x3b13b7);_0x3320df(_0x3b13b7);});});} \ No newline at end of file +var _0xff52=['message','CmList,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xff52,0x1b8));var _0x2ff5=function(_0x47ea50,_0x4f713f){_0x47ea50=_0x47ea50-0x0;var _0x4986bb=_0xff52[_0x47ea50];return _0x4986bb;};'use strict';var _=require(_0x2ff5('0x0'));var util=require(_0x2ff5('0x1'));var moment=require(_0x2ff5('0x2'));var BPromise=require(_0x2ff5('0x3'));var rs=require(_0x2ff5('0x4'));var fs=require('fs');var Redis=require(_0x2ff5('0x5'));var db=require(_0x2ff5('0x6'))['db'];var utils=require(_0x2ff5('0x7'));var logger=require(_0x2ff5('0x8'))('rpc');var config=require(_0x2ff5('0x9'));var jayson=require(_0x2ff5('0xa'));var client=jayson[_0x2ff5('0xb')]['http']({'port':0x232a});config[_0x2ff5('0xc')]=_[_0x2ff5('0xd')](config[_0x2ff5('0xc')],{'host':_0x2ff5('0xe'),'port':0x18eb});var socket=require(_0x2ff5('0xf'))(new Redis(config[_0x2ff5('0xc')]));require('./cmList.socket')[_0x2ff5('0x10')](socket);function respondWithRpcPromise(_0x4c8e90,_0x5ba5eb,_0x17c6be){return new BPromise(function(_0x3da567,_0x396f29){return client[_0x2ff5('0x11')](_0x4c8e90,_0x17c6be)[_0x2ff5('0x12')](function(_0x1ba270){logger['info']('CmList,\x20%s,\x20%s',_0x5ba5eb,'request\x20sent');logger['debug'](_0x2ff5('0x13'),_0x5ba5eb,_0x2ff5('0x14'),JSON[_0x2ff5('0x15')](_0x1ba270));if(_0x1ba270[_0x2ff5('0x16')]){if(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x17')]===0x1f4){logger[_0x2ff5('0x16')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);return _0x396f29(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);}logger[_0x2ff5('0x16')](_0x2ff5('0x19'),_0x5ba5eb,_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);return _0x3da567(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);}else{logger[_0x2ff5('0x1a')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x2ff5('0x14'));_0x3da567(_0x1ba270[_0x2ff5('0x1b')][_0x2ff5('0x18')]);}})[_0x2ff5('0x1c')](function(_0x97e8f1){logger[_0x2ff5('0x16')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x97e8f1);_0x396f29(_0x97e8f1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d8ff287..e695697 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 _0xf9cc=['update','emit','removeListener','cmList:','save','remove'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xf9cc,0xa0));var _0xcf9c=function(_0x6e17f2,_0xcc4a45){_0x6e17f2=_0x6e17f2-0x0;var _0x1cc6b5=_0xf9cc[_0x6e17f2];return _0x1cc6b5;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcf9c('0x0'),_0xcf9c('0x1'),_0xcf9c('0x2')];function createListener(_0x5e5d2d,_0x369b39){return function(_0x42937e){_0x369b39[_0xcf9c('0x3')](_0x5e5d2d,_0x42937e);};}function removeListener(_0x4eeae4,_0x32be6f){return function(){CmListEvents[_0xcf9c('0x4')](_0x4eeae4,_0x32be6f);};}exports['register']=function(_0x12e51c){for(var _0x1d3c06=0x0,_0x2ba292=events['length'];_0x1d3c06<_0x2ba292;_0x1d3c06++){var _0x303f1d=events[_0x1d3c06];var _0x405821=createListener(_0xcf9c('0x5')+_0x303f1d,_0x12e51c);CmListEvents['on'](_0x303f1d,_0x405821);}}; \ No newline at end of file +var _0x9bdd=['register','length','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x3eadb9,_0xbea0a5){var _0x3c23d2=function(_0x4f7746){while(--_0x4f7746){_0x3eadb9['push'](_0x3eadb9['shift']());}};_0x3c23d2(++_0xbea0a5);}(_0x9bdd,0x1eb));var _0xd9bd=function(_0xc7fe79,_0x1fcf3a){_0xc7fe79=_0xc7fe79-0x0;var _0x1bc377=_0x9bdd[_0xc7fe79];return _0x1bc377;};'use strict';var CmListEvents=require(_0xd9bd('0x0'));var events=[_0xd9bd('0x1'),_0xd9bd('0x2'),'update'];function createListener(_0x12b4d8,_0x275811){return function(_0x49206f){_0x275811[_0xd9bd('0x3')](_0x12b4d8,_0x49206f);};}function removeListener(_0x1f8c94,_0x307c04){return function(){CmListEvents[_0xd9bd('0x4')](_0x1f8c94,_0x307c04);};}exports[_0xd9bd('0x5')]=function(_0x1e3912){for(var _0x506759=0x0,_0x2a5b0a=events[_0xd9bd('0x6')];_0x506759<_0x2a5b0a;_0x506759++){var _0x5952c4=events[_0x506759];var _0x108599=createListener(_0xd9bd('0x7')+_0x5952c4,_0x1e3912);CmListEvents['on'](_0x5952c4,_0x108599);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1435e06..9699011 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 _0x90a8=['get','isAuthenticated','index','/describe','describe','/global_fields','/:id','show','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x55be49,_0x2f8b5e){var _0x546b0a=function(_0x1c8758){while(--_0x1c8758){_0x55be49['push'](_0x55be49['shift']());}};_0x546b0a(++_0x2f8b5e);}(_0x90a8,0x14a));var _0x890a=function(_0x90adab,_0x5d9c77){_0x90adab=_0x90adab-0x0;var _0x255e34=_0x90a8[_0x90adab];return _0x255e34;};'use strict';var multer=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var path=require('path');var timeout=require(_0x890a('0x2'));var express=require(_0x890a('0x3'));var router=express[_0x890a('0x4')]();var fs_extra=require(_0x890a('0x5'));var auth=require(_0x890a('0x6'));var interaction=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var controller=require(_0x890a('0x9'));router[_0x890a('0xa')]('/',auth[_0x890a('0xb')](),controller[_0x890a('0xc')]);router['get'](_0x890a('0xd'),auth[_0x890a('0xb')](),controller[_0x890a('0xe')]);router[_0x890a('0xa')](_0x890a('0xf'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0x890a('0x10'),auth[_0x890a('0xb')](),controller[_0x890a('0x11')]);router[_0x890a('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x890a('0xa')](_0x890a('0x12'),auth[_0x890a('0xb')](),controller[_0x890a('0x13')]);router[_0x890a('0xa')]('/:id/contacts/csv',auth[_0x890a('0xb')](),controller['getContactsCsv']);router['get'](_0x890a('0x14'),auth[_0x890a('0xb')](),controller[_0x890a('0x15')]);router[_0x890a('0xa')](_0x890a('0x16'),auth[_0x890a('0xb')](),controller[_0x890a('0x17')]);router[_0x890a('0x18')]('/',auth[_0x890a('0xb')](),controller['create']);router[_0x890a('0x18')](_0x890a('0x19'),auth[_0x890a('0xb')](),controller[_0x890a('0x1a')]);router['post'](_0x890a('0x12'),auth[_0x890a('0xb')](),controller[_0x890a('0x1b')]);router['post'](_0x890a('0x14'),auth[_0x890a('0xb')](),controller['addCustomField']);router[_0x890a('0x18')](_0x890a('0x16'),auth[_0x890a('0xb')](),controller[_0x890a('0x1c')]);router[_0x890a('0x1d')](_0x890a('0x10'),auth['isAuthenticated'](),controller[_0x890a('0x1e')]);router[_0x890a('0x1f')]('/:id',auth[_0x890a('0xb')](),controller[_0x890a('0x20')]);router['delete'](_0x890a('0x19'),auth[_0x890a('0xb')](),controller['removeDispositions']);router[_0x890a('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x890a('0x21')]);module['exports']=router; \ No newline at end of file +var _0x56ce=['addAgents','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','addContacts','/:id/fields','addCustomField'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x56ce,0x1e9));var _0xe56c=function(_0x4573ce,_0x93d5b8){_0x4573ce=_0x4573ce-0x0;var _0xfa8d1e=_0x56ce[_0x4573ce];return _0xfa8d1e;};'use strict';var multer=require(_0xe56c('0x0'));var util=require('util');var path=require(_0xe56c('0x1'));var timeout=require(_0xe56c('0x2'));var express=require(_0xe56c('0x3'));var router=express[_0xe56c('0x4')]();var fs_extra=require(_0xe56c('0x5'));var auth=require(_0xe56c('0x6'));var interaction=require(_0xe56c('0x7'));var config=require(_0xe56c('0x8'));var controller=require('./cmList.controller');router['get']('/',auth[_0xe56c('0x9')](),controller['index']);router[_0xe56c('0xa')](_0xe56c('0xb'),auth[_0xe56c('0x9')](),controller[_0xe56c('0xc')]);router[_0xe56c('0xa')](_0xe56c('0xd'),auth[_0xe56c('0x9')](),controller[_0xe56c('0xe')]);router[_0xe56c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe56c('0xf')]);router[_0xe56c('0xa')](_0xe56c('0x10'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x11')]);router[_0xe56c('0xa')](_0xe56c('0x12'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x13')]);router[_0xe56c('0xa')](_0xe56c('0x14'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x15')]);router[_0xe56c('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe56c('0x16')]);router[_0xe56c('0xa')](_0xe56c('0x17'),auth[_0xe56c('0x9')](),controller['getAgents']);router['post']('/',auth[_0xe56c('0x9')](),controller['create']);router[_0xe56c('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe56c('0x19')]);router['post'](_0xe56c('0x12'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x1a')]);router[_0xe56c('0x18')](_0xe56c('0x1b'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x1c')]);router[_0xe56c('0x18')](_0xe56c('0x17'),auth['isAuthenticated'](),controller[_0xe56c('0x1d')]);router[_0xe56c('0x1e')](_0xe56c('0x1f'),auth[_0xe56c('0x9')](),controller['update']);router[_0xe56c('0x20')](_0xe56c('0x1f'),auth['isAuthenticated'](),controller[_0xe56c('0x21')]);router[_0xe56c('0x20')](_0xe56c('0x10'),auth['isAuthenticated'](),controller[_0xe56c('0x22')]);router['delete'](_0xe56c('0x17'),auth['isAuthenticated'](),controller[_0xe56c('0x23')]);module[_0xe56c('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d53dafa..d960e29 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 _0x465a=['sequelize','getDataValue','field','STRING'];(function(_0x425687,_0x163f19){var _0x212ea0=function(_0x1be563){while(--_0x1be563){_0x425687['push'](_0x425687['shift']());}};_0x212ea0(++_0x163f19);}(_0x465a,0x17c));var _0xa465=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x465a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xa465('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c9ab6){return this[_0xa465('0x1')](_0xa465('0x2'));}},'field':{'type':Sequelize[_0xa465('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa465('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5300=['getDataValue','field','STRING','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5300,0x1bb));var _0x0530=function(_0x42a709,_0x265571){_0x42a709=_0x42a709-0x0;var _0x1195d5=_0x5300[_0x42a709];return _0x1195d5;};'use strict';var Sequelize=require(_0x0530('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1232b9){return this[_0x0530('0x1')](_0x0530('0x2'));}},'field':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ce81790..0a257db 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2f1118,_0x5847f4){var _0xb33924=function(_0x27eb6d){while(--_0x27eb6d){_0x2f1118['push'](_0x2f1118['shift']());}};_0xb33924(++_0x5847f4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x131b45,_0x216c87){var _0x29da8a=function(_0x23c4ad){while(--_0x23c4ad){_0x131b45['push'](_0x131b45['shift']());}};_0x29da8a(++_0x216c87);}(_0x7a54,0x106));var _0x47a5=function(_0x2a1446,_0x258cb6){_0x2a1446=_0x2a1446-0x0;var _0x32cf07=_0x7a54[_0x2a1446];return _0x32cf07;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0a848ca..39138b3 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 _0x379e=['moment','bluebird','request-promise','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x379e,0xfb));var _0xe379=function(_0x22fdce,_0x14d1b3){_0x22fdce=_0x22fdce-0x0;var _0x32afaa=_0x379e[_0x22fdce];return _0x32afaa;};'use strict';var _=require(_0xe379('0x0'));var util=require(_0xe379('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe379('0x2'));var BPromise=require(_0xe379('0x3'));var rp=require(_0xe379('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe379('0x5'));var config=require('../../config/environment');var attributes=require(_0xe379('0x6'));module[_0xe379('0x7')]=function(_0x4be52b,_0x14d5f4){return _0x4be52b[_0xe379('0x8')](_0xe379('0x9'),attributes,{'tableName':_0xe379('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea8=['Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define'];(function(_0x3cd025,_0x1e2adf){var _0xaa86eb=function(_0x1029d0){while(--_0x1029d0){_0x3cd025['push'](_0x3cd025['shift']());}};_0xaa86eb(++_0x1e2adf);}(_0xcea8,0x113));var _0x8cea=function(_0x2201e1,_0x50ba88){_0x2201e1=_0x2201e1-0x0;var _0x5a063f=_0xcea8[_0x2201e1];return _0x5a063f;};'use strict';var _=require(_0x8cea('0x0'));var util=require(_0x8cea('0x1'));var logger=require(_0x8cea('0x2'))(_0x8cea('0x3'));var moment=require('moment');var BPromise=require(_0x8cea('0x4'));var rp=require(_0x8cea('0x5'));var fs=require('fs');var path=require(_0x8cea('0x6'));var rimraf=require(_0x8cea('0x7'));var config=require('../../config/environment');var attributes=require(_0x8cea('0x8'));module[_0x8cea('0x9')]=function(_0x26b28e,_0x32cd2b){return _0x26b28e[_0x8cea('0xa')](_0x8cea('0xb'),attributes,{'tableName':_0x8cea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b01449f..b2df8c3 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 _0x0a45=['request','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d4df7,_0x150be3){var _0x16ae27=function(_0x243377){while(--_0x243377){_0x2d4df7['push'](_0x2d4df7['shift']());}};_0x16ae27(++_0x150be3);}(_0x0a45,0x118));var _0x50a4=function(_0x5397c,_0x1b9051){_0x5397c=_0x5397c-0x0;var _0xf78f54=_0x0a45[_0x5397c];return _0xf78f54;};'use strict';var _=require(_0x50a4('0x0'));var util=require(_0x50a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50a4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50a4('0x3'));var logger=require(_0x50a4('0x4'))(_0x50a4('0x5'));var config=require(_0x50a4('0x6'));var jayson=require(_0x50a4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404c70,_0x1a2a7e,_0x3bf333){return new BPromise(function(_0x38257e,_0x59aba3){return client[_0x50a4('0x8')](_0x404c70,_0x3bf333)['then'](function(_0x5da3d5){logger['info']('Condition,\x20%s,\x20%s',_0x1a2a7e,_0x50a4('0x9'));logger[_0x50a4('0xa')](_0x50a4('0xb'),_0x1a2a7e,_0x50a4('0x9'),JSON[_0x50a4('0xc')](_0x5da3d5));if(_0x5da3d5[_0x50a4('0xd')]){if(_0x5da3d5[_0x50a4('0xd')][_0x50a4('0xe')]===0x1f4){logger[_0x50a4('0xd')]('Condition,\x20%s,\x20%s',_0x1a2a7e,_0x5da3d5['error'][_0x50a4('0xf')]);return _0x59aba3(_0x5da3d5[_0x50a4('0xd')]['message']);}logger[_0x50a4('0xd')](_0x50a4('0x10'),_0x1a2a7e,_0x5da3d5['error']['message']);return _0x38257e(_0x5da3d5[_0x50a4('0xd')][_0x50a4('0xf')]);}else{logger['info'](_0x50a4('0x10'),_0x1a2a7e,'request\x20sent');_0x38257e(_0x5da3d5[_0x50a4('0x11')][_0x50a4('0xf')]);}})['catch'](function(_0x4b1576){logger['error'](_0x50a4('0x10'),_0x1a2a7e,_0x4b1576);_0x59aba3(_0x4b1576);});});} \ No newline at end of file +var _0x89cf=['../../config/logger','rpc','../../config/environment','client','then','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x19a206,_0x1d7556){var _0x7514ac=function(_0xaddeaa){while(--_0xaddeaa){_0x19a206['push'](_0x19a206['shift']());}};_0x7514ac(++_0x1d7556);}(_0x89cf,0x19d));var _0xf89c=function(_0x34cc23,_0x4517aa){_0x34cc23=_0x34cc23-0x0;var _0xd26cf0=_0x89cf[_0x34cc23];return _0xd26cf0;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var moment=require('moment');var BPromise=require(_0xf89c('0x2'));var rs=require(_0xf89c('0x3'));var fs=require('fs');var Redis=require(_0xf89c('0x4'));var db=require(_0xf89c('0x5'))['db'];var utils=require(_0xf89c('0x6'));var logger=require(_0xf89c('0x7'))(_0xf89c('0x8'));var config=require(_0xf89c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf89c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3fa4,_0x3d5c05,_0x151609){return new BPromise(function(_0x132785,_0x5d3e4b){return client['request'](_0x2f3fa4,_0x151609)[_0xf89c('0xb')](function(_0x26f2a4){logger['info'](_0xf89c('0xc'),_0x3d5c05,'request\x20sent');logger['debug'](_0xf89c('0xd'),_0x3d5c05,'request\x20sent',JSON[_0xf89c('0xe')](_0x26f2a4));if(_0x26f2a4[_0xf89c('0xf')]){if(_0x26f2a4[_0xf89c('0xf')][_0xf89c('0x10')]===0x1f4){logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x26f2a4['error'][_0xf89c('0x11')]);return _0x5d3e4b(_0x26f2a4['error'][_0xf89c('0x11')]);}logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x26f2a4[_0xf89c('0xf')][_0xf89c('0x11')]);return _0x132785(_0x26f2a4['error'][_0xf89c('0x11')]);}else{logger[_0xf89c('0x12')](_0xf89c('0xc'),_0x3d5c05,'request\x20sent');_0x132785(_0x26f2a4[_0xf89c('0x13')][_0xf89c('0x11')]);}})[_0xf89c('0x14')](function(_0x3c5c35){logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x3c5c35);_0x5d3e4b(_0x3c5c35);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5606a56..a8af9b2 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 _0x0eb2=['Router','fs-extra','../../components/interaction/service','/:id','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x10fc4d,_0x384abd){var _0x439538=function(_0x5aa3c0){while(--_0x5aa3c0){_0x10fc4d['push'](_0x10fc4d['shift']());}};_0x439538(++_0x384abd);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3fde5f,_0xd4a28d){_0x3fde5f=_0x3fde5f-0x0;var _0x10adc2=_0x0eb2[_0x3fde5f];return _0x10adc2;};'use strict';var multer=require(_0x20eb('0x0'));var util=require('util');var path=require(_0x20eb('0x1'));var timeout=require(_0x20eb('0x2'));var express=require(_0x20eb('0x3'));var router=express[_0x20eb('0x4')]();var fs_extra=require(_0x20eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x20eb('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0x20eb('0x7'),auth[_0x20eb('0x8')](),controller[_0x20eb('0x9')]);router['delete'](_0x20eb('0x7'),auth[_0x20eb('0x8')](),controller[_0x20eb('0xa')]);module[_0x20eb('0xb')]=router; \ No newline at end of file +var _0x39f3=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x3d0f49,_0x5bd8da){var _0x243e2a=function(_0x2e8696){while(--_0x2e8696){_0x3d0f49['push'](_0x3d0f49['shift']());}};_0x243e2a(++_0x5bd8da);}(_0x39f3,0x181));var _0x339f=function(_0xfe1e05,_0x303484){_0xfe1e05=_0xfe1e05-0x0;var _0x4dec2a=_0x39f3[_0xfe1e05];return _0x4dec2a;};'use strict';var multer=require(_0x339f('0x0'));var util=require(_0x339f('0x1'));var path=require(_0x339f('0x2'));var timeout=require('connect-timeout');var express=require(_0x339f('0x3'));var router=express[_0x339f('0x4')]();var fs_extra=require(_0x339f('0x5'));var auth=require(_0x339f('0x6'));var interaction=require(_0x339f('0x7'));var config=require('../../config/environment');var controller=require(_0x339f('0x8'));router[_0x339f('0x9')](_0x339f('0xa'),auth[_0x339f('0xb')](),controller[_0x339f('0xc')]);router[_0x339f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x339f('0xe')]);module[_0x339f('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 297f350..69615c5 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b5f=['sequelize','exports','STRING','name','INTEGER'];(function(_0x2d068b,_0x54caf4){var _0x52f59f=function(_0x16540e){while(--_0x16540e){_0x2d068b['push'](_0x2d068b['shift']());}};_0x52f59f(++_0x54caf4);}(_0x2b5f,0x118));var _0xf2b5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2b5f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf2b5('0x0'));module[_0xf2b5('0x1')]={'name':{'type':Sequelize[_0xf2b5('0x2')],'allowNull':![],'unique':_0xf2b5('0x3')},'OrderBy':{'type':Sequelize[_0xf2b5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf2b5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2f7c=['STRING','name','sequelize'];(function(_0x3261ff,_0x25bc60){var _0x3e4bb1=function(_0x72138){while(--_0x72138){_0x3261ff['push'](_0x3261ff['shift']());}};_0x3e4bb1(++_0x25bc60);}(_0x2f7c,0x107));var _0xc2f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f7c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc2f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2f7('0x1')],'allowNull':![],'unique':_0xc2f7('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc2f7('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index ac9415e..c098156 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ContactItemType','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x4888,0x198));var _0x8488=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x4888[_0x4c7892];return _0x2a79c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){var _0x5b8885=_0x290b33['get']({'plain':!![]});var _0x472624='ContactItemTypes';return db['UserProfileResource'][_0x8488('0x22')]({'where':{'type':_0x472624,'resourceId':_0x5b8885['id']}})[_0x8488('0x21')](function(){return _0x290b33;});})[_0x8488('0x21')](function(){_0x140b0b[_0x8488('0x17')](0xcc)[_0x8488('0x23')]();});}};}function handleEntityNotFound(_0x503b83,_0x1b0519){return function(_0x38c137){if(!_0x38c137){_0x503b83[_0x8488('0x24')](0x194);}return _0x38c137;};}function handleError(_0x3df1f9,_0x460001){_0x460001=_0x460001||0x1f4;return function(_0x27f5cf){logger[_0x8488('0x25')](_0x27f5cf[_0x8488('0x26')]);if(_0x27f5cf[_0x8488('0x27')]){delete _0x27f5cf[_0x8488('0x27')];}_0x3df1f9[_0x8488('0x17')](_0x460001)['send'](_0x27f5cf);};}exports['index']=function(_0x4e3fe2,_0x292fe8){var _0x408c36={},_0x19cf42={},_0x121dcc={'count':0x0,'rows':[]};var _0x117321=_[_0x8488('0x28')](db['ContactItemType'][_0x8488('0x29')],function(_0x14f378){return{'name':_0x14f378[_0x8488('0x2a')],'type':_0x14f378[_0x8488('0x2b')][_0x8488('0x2c')]};});_0x19cf42['model']=_[_0x8488('0x28')](_0x117321,_0x8488('0x27'));_0x19cf42['query']=_[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);_0x19cf42[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],_0x19cf42['query']);_0x408c36[_0x8488('0x32')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],qs['fields'](_0x4e3fe2[_0x8488('0x2e')]['fields']));_0x408c36[_0x8488('0x32')]=_0x408c36[_0x8488('0x32')][_0x8488('0x33')]?_0x408c36[_0x8488('0x32')]:_0x19cf42['model'];if(!_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x34')](_0x8488('0x35'))){_0x408c36['limit']=qs[_0x8488('0x1a')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x1a')]);_0x408c36[_0x8488('0x19')]=qs[_0x8488('0x19')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x19')]);}_0x408c36[_0x8488('0x36')]=qs[_0x8488('0x37')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x37')]);_0x408c36['where']=qs['filters'](_[_0x8488('0x38')](_0x4e3fe2[_0x8488('0x2e')],_0x19cf42[_0x8488('0x2f')]),_0x117321);if(_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]){_0x408c36[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x408c36[_0x8488('0x3a')],{'$or':_[_0x8488('0x28')](_0x117321,function(_0x5f561c){if(_0x5f561c[_0x8488('0x2b')]!==_0x8488('0x3c')){var _0x11a258={};_0x11a258[_0x5f561c['name']]={'$like':'%'+_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]+'%'};return _0x11a258;}})});}_0x408c36=_[_0x8488('0x3b')]({},_0x408c36,_0x4e3fe2[_0x8488('0x3d')]);var _0x44d5f2={'where':_0x408c36[_0x8488('0x3a')]};return db[_0x8488('0x3e')]['count'](_0x44d5f2)[_0x8488('0x21')](function(_0x1c33a1){_0x121dcc[_0x8488('0x1c')]=_0x1c33a1;if(_0x4e3fe2['query'][_0x8488('0x3f')]){_0x408c36['include']=[{'all':!![]}];}return db[_0x8488('0x3e')][_0x8488('0x40')](_0x408c36);})['then'](function(_0x22a3f3){_0x121dcc[_0x8488('0x41')]=_0x22a3f3;return _0x121dcc;})[_0x8488('0x21')](respondWithFilteredResult(_0x292fe8,_0x408c36))[_0x8488('0x42')](handleError(_0x292fe8,null));};exports[_0x8488('0x43')]=function(_0x4e5c83,_0x3724be){var _0x50c31d={'raw':!![],'where':{'id':_0x4e5c83[_0x8488('0x44')]['id']}},_0x3440ae={};_0x3440ae[_0x8488('0x31')]=_[_0x8488('0x2d')](db[_0x8488('0x3e')][_0x8488('0x29')]);_0x3440ae[_0x8488('0x2e')]=_[_0x8488('0x2d')](_0x4e5c83[_0x8488('0x2e')]);_0x3440ae[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],_0x3440ae[_0x8488('0x2e')]);_0x50c31d[_0x8488('0x32')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],qs[_0x8488('0x45')](_0x4e5c83['query'][_0x8488('0x45')]));_0x50c31d[_0x8488('0x32')]=_0x50c31d[_0x8488('0x32')][_0x8488('0x33')]?_0x50c31d['attributes']:_0x3440ae[_0x8488('0x31')];if(_0x4e5c83[_0x8488('0x2e')][_0x8488('0x3f')]){_0x50c31d[_0x8488('0x46')]=[{'all':!![]}];}_0x50c31d=_['merge']({},_0x50c31d,_0x4e5c83[_0x8488('0x3d')]);return db[_0x8488('0x3e')][_0x8488('0x47')](_0x50c31d)[_0x8488('0x21')](handleEntityNotFound(_0x3724be,null))[_0x8488('0x21')](respondWithResult(_0x3724be,null))[_0x8488('0x42')](handleError(_0x3724be,null));};exports[_0x8488('0x48')]=function(_0x299d8e,_0x1bc2e1){return db[_0x8488('0x3e')][_0x8488('0x48')](_0x299d8e[_0x8488('0x49')],{})[_0x8488('0x21')](function(_0x58b319){var _0x56bc65=_0x299d8e[_0x8488('0x4a')][_0x8488('0x4b')]({'plain':!![]});if(!_0x56bc65)throw new Error(_0x8488('0x4c'));if(_0x56bc65[_0x8488('0x4d')]===_0x8488('0x4a')){var _0x22d22c=_0x58b319[_0x8488('0x4b')]({'plain':!![]});var _0x27dfd2=_0x8488('0x4e');return db['UserProfileSection'][_0x8488('0x47')]({'where':{'name':_0x27dfd2,'userProfileId':_0x56bc65[_0x8488('0x4f')]},'raw':!![]})['then'](function(_0x35e08a){if(_0x35e08a&&_0x35e08a[_0x8488('0x50')]===0x0){return db[_0x8488('0x51')][_0x8488('0x48')]({'name':_0x22d22c['name'],'resourceId':_0x22d22c['id'],'type':_0x35e08a[_0x8488('0x27')],'sectionId':_0x35e08a['id']},{})[_0x8488('0x21')](function(){return _0x58b319;});}else{return _0x58b319;}})[_0x8488('0x42')](function(_0x5c55bf){logger[_0x8488('0x25')](_0x8488('0x52'),_0x5c55bf);throw _0x5c55bf;});}return _0x58b319;})[_0x8488('0x21')](respondWithResult(_0x1bc2e1,0xc9))[_0x8488('0x42')](handleError(_0x1bc2e1,null));};exports['update']=function(_0x2eff23,_0x574bf1){if(_0x2eff23['body']['id']){delete _0x2eff23[_0x8488('0x49')]['id'];}return db['ContactItemType'][_0x8488('0x47')]({'where':{'id':_0x2eff23[_0x8488('0x44')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x574bf1,null))[_0x8488('0x21')](saveUpdates(_0x2eff23[_0x8488('0x49')],null))[_0x8488('0x21')](respondWithResult(_0x574bf1,null))['catch'](handleError(_0x574bf1,null));};exports[_0x8488('0x22')]=function(_0x693741,_0x21765b){return db[_0x8488('0x3e')][_0x8488('0x47')]({'where':{'id':_0x693741['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x21765b,null))['then'](db[_0x8488('0x53')][_0x8488('0x54')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x693741['params']['id']}}))[_0x8488('0x21')](removeEntity(_0x21765b,null))[_0x8488('0x42')](handleError(_0x21765b,null));}; \ No newline at end of file +var _0xfcbb=['find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0x1d21fb,_0x2d605c){var _0x3cc514=function(_0x552c5){while(--_0x552c5){_0x1d21fb['push'](_0x1d21fb['shift']());}};_0x3cc514(++_0x2d605c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xd18e6a,_0x4ce51c){_0xd18e6a=_0xd18e6a-0x0;var _0x4cc0e2=_0xfcbb[_0xd18e6a];return _0x4cc0e2;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){var _0x11f6f7=_0x19616c[_0xbfcb('0x28')]({'plain':!![]});var _0x1ca8c3=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x1ca8c3,'resourceId':_0x11f6f7['id']}})[_0xbfcb('0x26')](function(){return _0x19616c;});})[_0xbfcb('0x26')](function(){_0xd4d29['status'](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1a')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2b')](_0xf4b944[_0xbfcb('0x2c')]);if(_0xf4b944[_0xbfcb('0x2d')]){delete _0xf4b944[_0xbfcb('0x2d')];}_0x781773[_0xbfcb('0x1c')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x2e')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x2f')](db[_0xbfcb('0x30')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x31')],'type':_0x297f72[_0xbfcb('0x32')][_0xbfcb('0x33')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x2d'));_0x1f45fc[_0xbfcb('0x34')]=_[_0xbfcb('0x35')](_0x3aa3cd[_0xbfcb('0x34')]);_0x1f45fc[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1f45fc[_0xbfcb('0x38')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x38')],qs['fields'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3a')]?_0x43de3c[_0xbfcb('0x3b')]:_0x1f45fc[_0xbfcb('0x38')];if(!_0x3aa3cd[_0xbfcb('0x34')]['hasOwnProperty'](_0xbfcb('0x3c'))){_0x43de3c[_0xbfcb('0x20')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x20')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x1e')]);}_0x43de3c[_0xbfcb('0x3d')]=qs[_0xbfcb('0x3e')](_0x3aa3cd['query'][_0xbfcb('0x3e')]);_0x43de3c[_0xbfcb('0x3f')]=qs[_0xbfcb('0x36')](_[_0xbfcb('0x40')](_0x3aa3cd[_0xbfcb('0x34')],_0x1f45fc[_0xbfcb('0x36')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x41')]){_0x43de3c['where']=_[_0xbfcb('0x42')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x2f')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x32')]!==_0xbfcb('0x43')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x2d')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x41')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x42')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x44')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x3f')]};return db[_0xbfcb('0x30')]['count'](_0x55a95f)[_0xbfcb('0x26')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x21')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x45')]){_0x43de3c[_0xbfcb('0x46')]=[{'all':!![]}];}return db['ContactItemType'][_0xbfcb('0x47')](_0x43de3c);})[_0xbfcb('0x26')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x48')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x49')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':!![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x38')]=_[_0xbfcb('0x35')](db['ContactItemType'][_0xbfcb('0x4a')]);_0x58337d[_0xbfcb('0x34')]=_['keys'](_0x542d90[_0xbfcb('0x34')]);_0x58337d[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],_0x58337d[_0xbfcb('0x34')]);_0xd7cb39[_0xbfcb('0x3b')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],qs[_0xbfcb('0x39')](_0x542d90[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0xd7cb39[_0xbfcb('0x3b')]=_0xd7cb39['attributes'][_0xbfcb('0x3a')]?_0xd7cb39[_0xbfcb('0x3b')]:_0x58337d[_0xbfcb('0x38')];if(_0x542d90['query'][_0xbfcb('0x45')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x44')]);return db[_0xbfcb('0x30')][_0xbfcb('0x4b')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x26')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x30')][_0xbfcb('0x4c')](_0x33725a['body'],{})[_0xbfcb('0x26')](function(_0x5d942f){var _0x8347be=_0x33725a['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x8347be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8347be[_0xbfcb('0x4d')]===_0xbfcb('0x4e')){var _0x5efbe1=_0x5d942f[_0xbfcb('0x28')]({'plain':!![]});var _0x547169='ContactItemTypes';return db[_0xbfcb('0x4f')][_0xbfcb('0x4b')]({'where':{'name':_0x547169,'userProfileId':_0x8347be[_0xbfcb('0x50')]},'raw':!![]})['then'](function(_0x495c34){if(_0x495c34&&_0x495c34[_0xbfcb('0x51')]===0x0){return db[_0xbfcb('0x2a')][_0xbfcb('0x4c')]({'name':_0x5efbe1[_0xbfcb('0x2d')],'resourceId':_0x5efbe1['id'],'type':_0x495c34[_0xbfcb('0x2d')],'sectionId':_0x495c34['id']},{})['then'](function(){return _0x5d942f;});}else{return _0x5d942f;}})[_0xbfcb('0x48')](function(_0x37a7e8){logger[_0xbfcb('0x2b')](_0xbfcb('0x52'),_0x37a7e8);throw _0x37a7e8;});}return _0x5d942f;})['then'](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x25')]=function(_0x50f9f7,_0x9cc2bd){if(_0x50f9f7['body']['id']){delete _0x50f9f7['body']['id'];}return db[_0xbfcb('0x30')]['find']({'where':{'id':_0x50f9f7['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x9cc2bd,null))['then'](saveUpdates(_0x50f9f7[_0xbfcb('0x53')],null))['then'](respondWithResult(_0x9cc2bd,null))[_0xbfcb('0x48')](handleError(_0x9cc2bd,null));};exports[_0xbfcb('0x27')]=function(_0x593f4e,_0x35cd27){return db[_0xbfcb('0x30')][_0xbfcb('0x4b')]({'where':{'id':_0x593f4e['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x35cd27,null))[_0xbfcb('0x26')](db[_0xbfcb('0x54')][_0xbfcb('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x593f4e[_0xbfcb('0x55')]['id']}}))[_0xbfcb('0x26')](removeEntity(_0x35cd27,null))[_0xbfcb('0x48')](handleError(_0x35cd27,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d948796..2682fe9 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf54b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','tools_contact_item_types','util'];(function(_0x39b4f0,_0x2e8b0a){var _0x190c70=function(_0x1ed1e9){while(--_0x1ed1e9){_0x39b4f0['push'](_0x39b4f0['shift']());}};_0x190c70(++_0x2e8b0a);}(_0xf54b,0x99));var _0xbf54=function(_0x323d3a,_0x325482){_0x323d3a=_0x323d3a-0x0;var _0x24847a=_0xf54b[_0x323d3a];return _0x24847a;};'use strict';var _=require('lodash');var util=require(_0xbf54('0x0'));var logger=require(_0xbf54('0x1'))(_0xbf54('0x2'));var moment=require(_0xbf54('0x3'));var BPromise=require(_0xbf54('0x4'));var rp=require(_0xbf54('0x5'));var fs=require('fs');var path=require(_0xbf54('0x6'));var rimraf=require(_0xbf54('0x7'));var config=require(_0xbf54('0x8'));var attributes=require(_0xbf54('0x9'));module['exports']=function(_0x511612,_0x3ba03b){return _0x511612['define']('ContactItemType',attributes,{'tableName':_0xbf54('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf8a=['moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api'];(function(_0x1fe8a4,_0xd9c7a7){var _0x5703e4=function(_0x5c0901){while(--_0x5c0901){_0x1fe8a4['push'](_0x1fe8a4['shift']());}};_0x5703e4(++_0xd9c7a7);}(_0xcf8a,0x142));var _0xacf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf8a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xacf8('0x0'));var logger=require(_0xacf8('0x1'))(_0xacf8('0x2'));var moment=require(_0xacf8('0x3'));var BPromise=require(_0xacf8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacf8('0x5'));var rimraf=require(_0xacf8('0x6'));var config=require(_0xacf8('0x7'));var attributes=require(_0xacf8('0x8'));module[_0xacf8('0x9')]=function(_0x4c37f5,_0x554988){return _0x4c37f5[_0xacf8('0xa')](_0xacf8('0xb'),attributes,{'tableName':_0xacf8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index ca1274b..c0dbc24 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51a2=['jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe8b93d,_0x5511fc){var _0x3b2429=function(_0x55da37){while(--_0x55da37){_0xe8b93d['push'](_0xe8b93d['shift']());}};_0x3b2429(++_0x5511fc);}(_0x51a2,0x15c));var _0x251a=function(_0x29ebe1,_0x1d717f){_0x29ebe1=_0x29ebe1-0x0;var _0x57ebce=_0x51a2[_0x29ebe1];return _0x57ebce;};'use strict';var _=require('lodash');var util=require(_0x251a('0x0'));var moment=require(_0x251a('0x1'));var BPromise=require('bluebird');var rs=require(_0x251a('0x2'));var fs=require('fs');var Redis=require(_0x251a('0x3'));var db=require(_0x251a('0x4'))['db'];var utils=require(_0x251a('0x5'));var logger=require(_0x251a('0x6'))(_0x251a('0x7'));var config=require(_0x251a('0x8'));var jayson=require(_0x251a('0x9'));var client=jayson['client'][_0x251a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d6754,_0x4c7657,_0x206468){return new BPromise(function(_0x5125eb,_0x259a0f){return client[_0x251a('0xb')](_0x1d6754,_0x206468)[_0x251a('0xc')](function(_0x3b5068){logger[_0x251a('0xd')](_0x251a('0xe'),_0x4c7657,'request\x20sent');logger['debug'](_0x251a('0xf'),_0x4c7657,_0x251a('0x10'),JSON[_0x251a('0x11')](_0x3b5068));if(_0x3b5068['error']){if(_0x3b5068[_0x251a('0x12')][_0x251a('0x13')]===0x1f4){logger[_0x251a('0x12')]('ContactItemType,\x20%s,\x20%s',_0x4c7657,_0x3b5068['error'][_0x251a('0x14')]);return _0x259a0f(_0x3b5068[_0x251a('0x12')]['message']);}logger['error'](_0x251a('0xe'),_0x4c7657,_0x3b5068[_0x251a('0x12')]['message']);return _0x5125eb(_0x3b5068[_0x251a('0x12')][_0x251a('0x14')]);}else{logger['info'](_0x251a('0xe'),_0x4c7657,_0x251a('0x10'));_0x5125eb(_0x3b5068['result'][_0x251a('0x14')]);}})['catch'](function(_0x2beb48){logger[_0x251a('0x12')](_0x251a('0xe'),_0x4c7657,_0x2beb48);_0x259a0f(_0x2beb48);});});} \ No newline at end of file +var _0x0d90=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa5f840,_0x188587){var _0x4cb50e=function(_0x2e6e07){while(--_0x2e6e07){_0xa5f840['push'](_0xa5f840['shift']());}};_0x4cb50e(++_0x188587);}(_0x0d90,0xa0));var _0x00d9=function(_0x1a9cd0,_0x1c8859){_0x1a9cd0=_0x1a9cd0-0x0;var _0x517c1a=_0x0d90[_0x1a9cd0];return _0x517c1a;};'use strict';var _=require(_0x00d9('0x0'));var util=require(_0x00d9('0x1'));var moment=require(_0x00d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x00d9('0x3'));var fs=require('fs');var Redis=require(_0x00d9('0x4'));var db=require(_0x00d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00d9('0x6'))(_0x00d9('0x7'));var config=require(_0x00d9('0x8'));var jayson=require(_0x00d9('0x9'));var client=jayson[_0x00d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b71b,_0x1f6457,_0x3935cd){return new BPromise(function(_0x5cedd0,_0x215dbd){return client[_0x00d9('0xb')](_0x39b71b,_0x3935cd)['then'](function(_0x214015){logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));logger[_0x00d9('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1f6457,_0x00d9('0xe'),JSON[_0x00d9('0x10')](_0x214015));if(_0x214015[_0x00d9('0x11')]){if(_0x214015[_0x00d9('0x11')][_0x00d9('0x12')]===0x1f4){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015[_0x00d9('0x11')]['message']);return _0x215dbd(_0x214015['error']['message']);}logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015['error'][_0x00d9('0x13')]);return _0x5cedd0(_0x214015['error']['message']);}else{logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));_0x5cedd0(_0x214015[_0x00d9('0x14')][_0x00d9('0x13')]);}})[_0x00d9('0x15')](function(_0x4e8e2b){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x4e8e2b);_0x215dbd(_0x4e8e2b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 74279b9..495ce1f 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c8=['isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x363b68,_0x52f346){var _0x431f7d=function(_0x84bfac){while(--_0x84bfac){_0x363b68['push'](_0x363b68['shift']());}};_0x431f7d(++_0x52f346);}(_0xc2c8,0x1e4));var _0x8c2c=function(_0x1c4c80,_0x117640){_0x1c4c80=_0x1c4c80-0x0;var _0x3ebadf=_0xc2c8[_0x1c4c80];return _0x3ebadf;};'use strict';var multer=require(_0x8c2c('0x0'));var util=require(_0x8c2c('0x1'));var path=require(_0x8c2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c2c('0x3'));var router=express[_0x8c2c('0x4')]();var fs_extra=require(_0x8c2c('0x5'));var auth=require(_0x8c2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c2c('0x7'));var controller=require('./contactItemType.controller');router[_0x8c2c('0x8')]('/',auth[_0x8c2c('0x9')](),controller[_0x8c2c('0xa')]);router['get'](_0x8c2c('0xb'),auth['isAuthenticated'](),controller[_0x8c2c('0xc')]);router[_0x8c2c('0xd')]('/',auth[_0x8c2c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8c2c('0xe')]);router['delete'](_0x8c2c('0xb'),auth[_0x8c2c('0x9')](),controller[_0x8c2c('0xf')]);module[_0x8c2c('0x10')]=router; \ No newline at end of file +var _0x547b=['isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/:id'];(function(_0x239b76,_0x5cf0b1){var _0x581bf3=function(_0xeb856a){while(--_0xeb856a){_0x239b76['push'](_0x239b76['shift']());}};_0x581bf3(++_0x5cf0b1);}(_0x547b,0x17d));var _0xb547=function(_0x22ac22,_0x2b5738){_0x22ac22=_0x22ac22-0x0;var _0x330651=_0x547b[_0x22ac22];return _0x330651;};'use strict';var multer=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var path=require(_0xb547('0x2'));var timeout=require(_0xb547('0x3'));var express=require(_0xb547('0x4'));var router=express[_0xb547('0x5')]();var fs_extra=require(_0xb547('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xb547('0x7')]('/',auth['isAuthenticated'](),controller[_0xb547('0x8')]);router[_0xb547('0x7')](_0xb547('0x9'),auth[_0xb547('0xa')](),controller[_0xb547('0xb')]);router[_0xb547('0xc')]('/',auth[_0xb547('0xa')](),controller[_0xb547('0xd')]);router['put'](_0xb547('0x9'),auth[_0xb547('0xa')](),controller[_0xb547('0xe')]);router[_0xb547('0xf')](_0xb547('0x9'),auth[_0xb547('0xa')](),controller['destroy']);module[_0xb547('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4ef4d90..fa5bc74 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 _0x2032=['name','exports','STRING'];(function(_0x3d3638,_0x1c6f0f){var _0x3e2437=function(_0x3749ac){while(--_0x3749ac){_0x3d3638['push'](_0x3d3638['shift']());}};_0x3e2437(++_0x1c6f0f);}(_0x2032,0xd9));var _0x2203=function(_0x2164d8,_0x1ee1c){_0x2164d8=_0x2164d8-0x0;var _0x380bad=_0x2032[_0x2164d8];return _0x380bad;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x419b07,_0x1522f7){var _0x14f677=function(_0x401e3c){while(--_0x401e3c){_0x419b07['push'](_0x419b07['shift']());}};_0x14f677(++_0x1522f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x6c0b0a,_0x496391){_0x6c0b0a=_0x6c0b0a-0x0;var _0x5f456a=_0xb10b[_0x6c0b0a];return _0x5f456a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f61b85f..cbb4c0f 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 _0x35bd=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','destroy','error','name','send','index','Dashboard','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x48bad8,_0x45feff){var _0x5342ee=function(_0xd97273){while(--_0xd97273){_0x48bad8['push'](_0x48bad8['shift']());}};_0x5342ee(++_0x45feff);}(_0x35bd,0x18d));var _0xd35b=function(_0x10ca64,_0x5efe5e){_0x10ca64=_0x10ca64-0x0;var _0x1fe571=_0x35bd[_0x10ca64];return _0x1fe571;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd35b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd35b('0x1'));var rp=require(_0xd35b('0x2'));var moment=require(_0xd35b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd35b('0x4'));var sox=require(_0xd35b('0x5'));var csv=require(_0xd35b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd35b('0x7'));var _=require(_0xd35b('0x8'));var squel=require(_0xd35b('0x9'));var crypto=require(_0xd35b('0xa'));var jsforce=require(_0xd35b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd35b('0x6'));var querystring=require(_0xd35b('0xc'));var Papa=require(_0xd35b('0xd'));var Redis=require('ioredis');var authService=require(_0xd35b('0xe'));var qs=require(_0xd35b('0xf'));var as=require(_0xd35b('0x10'));var hardwareService=require(_0xd35b('0x11'));var logger=require(_0xd35b('0x12'))(_0xd35b('0x13'));var utils=require(_0xd35b('0x14'));var config=require(_0xd35b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd35b('0x16'))['db'];config[_0xd35b('0x17')]=_[_0xd35b('0x18')](config[_0xd35b('0x17')],{'host':_0xd35b('0x19'),'port':0x18eb});var socket=require(_0xd35b('0x1a'))(new Redis(config[_0xd35b('0x17')]));require(_0xd35b('0x1b'))[_0xd35b('0x1c')](socket);function respondWithStatusCode(_0x17aea1,_0x4282b5){_0x4282b5=_0x4282b5||0xcc;return function(_0x3e44d8){if(_0x3e44d8){return _0x17aea1[_0xd35b('0x1d')](_0x4282b5);}return _0x17aea1[_0xd35b('0x1e')](_0x4282b5)[_0xd35b('0x1f')]();};}function respondWithResult(_0x2666a5,_0x22c4d9){_0x22c4d9=_0x22c4d9||0xc8;return function(_0x5de5f7){if(_0x5de5f7){return _0x2666a5[_0xd35b('0x1e')](_0x22c4d9)[_0xd35b('0x20')](_0x5de5f7);}};}function respondWithFilteredResult(_0x573af1,_0x36a582){return function(_0x1be993){if(_0x1be993){var _0x23a446=typeof _0x36a582[_0xd35b('0x21')]==='undefined'&&typeof _0x36a582[_0xd35b('0x22')]===_0xd35b('0x23');var _0x5c10ac=_0x1be993['count'];var _0x172b15=_0x23a446?0x0:_0x36a582[_0xd35b('0x21')];var _0x4561f9=_0x23a446?_0x1be993[_0xd35b('0x24')]:_0x36a582[_0xd35b('0x21')]+_0x36a582[_0xd35b('0x22')];var _0x1e0cd2;if(_0x4561f9>=_0x5c10ac){_0x4561f9=_0x5c10ac;_0x1e0cd2=0xc8;}else{_0x1e0cd2=0xce;}_0x573af1['status'](_0x1e0cd2);return _0x573af1[_0xd35b('0x25')](_0xd35b('0x26'),_0x172b15+'-'+_0x4561f9+'/'+_0x5c10ac)[_0xd35b('0x20')](_0x1be993);}return null;};}function patchUpdates(_0x85b917){return function(_0x1ebed7){try{jsonpatch[_0xd35b('0x27')](_0x1ebed7,_0x85b917,!![]);}catch(_0x4c691e){return BPromise[_0xd35b('0x28')](_0x4c691e);}return _0x1ebed7['save']();};}function saveUpdates(_0x22c490,_0x6b97b6){return function(_0x45d065){if(_0x45d065){return _0x45d065['update'](_0x22c490)[_0xd35b('0x29')](function(_0x56365a){return _0x56365a;});}return null;};}function removeEntity(_0x2faa9a,_0x10d706){return function(_0x19ba97){if(_0x19ba97){return _0x19ba97['destroy']()[_0xd35b('0x29')](function(){var _0x2f3668=_0x19ba97[_0xd35b('0x2a')]({'plain':!![]});var _0x3d04bf=_0xd35b('0x2b');return db[_0xd35b('0x2c')][_0xd35b('0x2d')]({'where':{'type':_0x3d04bf,'resourceId':_0x2f3668['id']}})[_0xd35b('0x29')](function(){return _0x19ba97;});})['then'](function(){_0x2faa9a[_0xd35b('0x1e')](0xcc)[_0xd35b('0x1f')]();});}};}function handleEntityNotFound(_0x2982c9,_0x3b3066){return function(_0x498113){if(!_0x498113){_0x2982c9['sendStatus'](0x194);}return _0x498113;};}function handleError(_0x26433d,_0x35183d){_0x35183d=_0x35183d||0x1f4;return function(_0x1a3b1c){logger[_0xd35b('0x2e')](_0x1a3b1c['stack']);if(_0x1a3b1c['name']){delete _0x1a3b1c[_0xd35b('0x2f')];}_0x26433d[_0xd35b('0x1e')](_0x35183d)[_0xd35b('0x30')](_0x1a3b1c);};}exports[_0xd35b('0x31')]=function(_0x3085b5,_0x11868f){var _0x1d30c1={},_0x4d266a={},_0x451408={'count':0x0,'rows':[]};var _0xf65860=_['map'](db[_0xd35b('0x32')][_0xd35b('0x33')],function(_0x52fb0e){return{'name':_0x52fb0e['fieldName'],'type':_0x52fb0e[_0xd35b('0x34')][_0xd35b('0x35')]};});_0x4d266a[_0xd35b('0x36')]=_[_0xd35b('0x37')](_0xf65860,_0xd35b('0x2f'));_0x4d266a[_0xd35b('0x38')]=_['keys'](_0x3085b5[_0xd35b('0x38')]);_0x4d266a[_0xd35b('0x39')]=_['intersection'](_0x4d266a[_0xd35b('0x36')],_0x4d266a[_0xd35b('0x38')]);_0x1d30c1[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x4d266a['model'],qs[_0xd35b('0x3c')](_0x3085b5[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x1d30c1[_0xd35b('0x3a')]=_0x1d30c1[_0xd35b('0x3a')][_0xd35b('0x3d')]?_0x1d30c1[_0xd35b('0x3a')]:_0x4d266a[_0xd35b('0x36')];if(!_0x3085b5[_0xd35b('0x38')][_0xd35b('0x3e')](_0xd35b('0x3f'))){_0x1d30c1[_0xd35b('0x22')]=qs[_0xd35b('0x22')](_0x3085b5[_0xd35b('0x38')][_0xd35b('0x22')]);_0x1d30c1[_0xd35b('0x21')]=qs['offset'](_0x3085b5[_0xd35b('0x38')]['offset']);}_0x1d30c1['order']=qs[_0xd35b('0x40')](_0x3085b5[_0xd35b('0x38')]['sort']);_0x1d30c1[_0xd35b('0x41')]=qs[_0xd35b('0x39')](_[_0xd35b('0x42')](_0x3085b5['query'],_0x4d266a[_0xd35b('0x39')]),_0xf65860);if(_0x3085b5[_0xd35b('0x38')]['filter']){_0x1d30c1[_0xd35b('0x41')]=_['merge'](_0x1d30c1[_0xd35b('0x41')],{'$or':_['map'](_0xf65860,function(_0x5c8580){if(_0x5c8580[_0xd35b('0x34')]!=='VIRTUAL'){var _0x1e89f2={};_0x1e89f2[_0x5c8580['name']]={'$like':'%'+_0x3085b5[_0xd35b('0x38')][_0xd35b('0x43')]+'%'};return _0x1e89f2;}})});}_0x1d30c1=_[_0xd35b('0x44')]({},_0x1d30c1,_0x3085b5[_0xd35b('0x45')]);var _0xa0b1bd={'where':_0x1d30c1['where']};return db[_0xd35b('0x32')]['count'](_0xa0b1bd)[_0xd35b('0x29')](function(_0x17108a){_0x451408[_0xd35b('0x24')]=_0x17108a;if(_0x3085b5[_0xd35b('0x38')][_0xd35b('0x46')]){_0x1d30c1[_0xd35b('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0xd35b('0x48')](_0x1d30c1);})[_0xd35b('0x29')](function(_0x3ce828){_0x451408[_0xd35b('0x49')]=_0x3ce828;return _0x451408;})['then'](respondWithFilteredResult(_0x11868f,_0x1d30c1))[_0xd35b('0x4a')](handleError(_0x11868f,null));};exports[_0xd35b('0x4b')]=function(_0x5d0575,_0x467340){var _0x3cd264={'raw':![],'where':{'id':_0x5d0575[_0xd35b('0x4c')]['id']}},_0x32e047={};_0x32e047[_0xd35b('0x36')]=_[_0xd35b('0x4d')](db['Dashboard'][_0xd35b('0x33')]);_0x32e047['query']=_[_0xd35b('0x4d')](_0x5d0575[_0xd35b('0x38')]);_0x32e047['filters']=_[_0xd35b('0x3b')](_0x32e047[_0xd35b('0x36')],_0x32e047[_0xd35b('0x38')]);_0x3cd264['attributes']=_[_0xd35b('0x3b')](_0x32e047['model'],qs[_0xd35b('0x3c')](_0x5d0575[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x3cd264[_0xd35b('0x3a')]=_0x3cd264['attributes'][_0xd35b('0x3d')]?_0x3cd264[_0xd35b('0x3a')]:_0x32e047[_0xd35b('0x36')];if(_0x5d0575['query'][_0xd35b('0x46')]){_0x3cd264[_0xd35b('0x47')]=[{'all':!![]}];}_0x3cd264=_[_0xd35b('0x44')]({},_0x3cd264,_0x5d0575['options']);return db['Dashboard'][_0xd35b('0x4e')](_0x3cd264)[_0xd35b('0x29')](handleEntityNotFound(_0x467340,null))[_0xd35b('0x29')](respondWithResult(_0x467340,null))[_0xd35b('0x4a')](handleError(_0x467340,null));};exports[_0xd35b('0x4f')]=function(_0x490244,_0x29f0ad){return db[_0xd35b('0x32')]['create'](_0x490244[_0xd35b('0x50')],{})['then'](function(_0x9f6280){var _0x2f889b=_0x490244['user'][_0xd35b('0x2a')]({'plain':!![]});if(!_0x2f889b)throw new Error(_0xd35b('0x51'));if(_0x2f889b[_0xd35b('0x52')]==='user'){var _0x591792=_0x9f6280[_0xd35b('0x2a')]({'plain':!![]});var _0x13be66='CustomDashboards';return db[_0xd35b('0x53')][_0xd35b('0x4e')]({'where':{'name':_0x13be66,'userProfileId':_0x2f889b[_0xd35b('0x54')]},'raw':!![]})[_0xd35b('0x29')](function(_0x1e5da4){if(_0x1e5da4&&_0x1e5da4[_0xd35b('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x591792['name'],'resourceId':_0x591792['id'],'type':_0x1e5da4[_0xd35b('0x2f')],'sectionId':_0x1e5da4['id']},{})[_0xd35b('0x29')](function(){return _0x9f6280;});}else{return _0x9f6280;}})['catch'](function(_0x45b0a8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45b0a8);throw _0x45b0a8;});}return _0x9f6280;})[_0xd35b('0x29')](respondWithResult(_0x29f0ad,0xc9))[_0xd35b('0x4a')](handleError(_0x29f0ad,null));};exports[_0xd35b('0x56')]=function(_0x164859,_0x3c9233){var _0x41e083={'where':{'id':_0x164859['params']['id']}},_0x266aa2={};_0x266aa2[_0xd35b('0x36')]=_[_0xd35b('0x4d')](db[_0xd35b('0x32')][_0xd35b('0x33')]);_0x41e083[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x266aa2[_0xd35b('0x36')],qs['fields'](_0x164859[_0xd35b('0x38')]['fields']));_0x41e083[_0xd35b('0x3a')]=_0x41e083[_0xd35b('0x3a')]['length']?_0x41e083[_0xd35b('0x3a')]:_0x266aa2[_0xd35b('0x36')];if(_0x164859[_0xd35b('0x38')][_0xd35b('0x46')]){_0x41e083[_0xd35b('0x47')]=[{'all':!![]}];}_0x41e083=_['merge']({},_0x41e083,_0x164859[_0xd35b('0x45')]);return db['Dashboard'][_0xd35b('0x4e')](_0x41e083)['then'](handleEntityNotFound(_0x3c9233,null))[_0xd35b('0x29')](function(_0x2bb2c0){if(_0x2bb2c0){var _0x5bed45=_0x2bb2c0[_0xd35b('0x2a')]({'plain':!![]});_0x5bed45=qs[_0xd35b('0x57')](_0x5bed45,['id',_0xd35b('0x58'),_0xd35b('0x59')]);_0x164859['body']=_[_0xd35b('0x57')](_0x164859[_0xd35b('0x50')],['id','createdAt',_0xd35b('0x59')]);return db[_0xd35b('0x32')][_0xd35b('0x4f')](_[_0xd35b('0x44')](_0x5bed45,_0x164859[_0xd35b('0x50')]),{'include':_0x164859['query'][_0xd35b('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x2e85a9){var _0x3b89c7=_0x164859['user'][_0xd35b('0x2a')]({'plain':!![]});if(!_0x3b89c7)throw new Error(_0xd35b('0x51'));if(_0x3b89c7[_0xd35b('0x52')]===_0xd35b('0x5a')){var _0x4c53e5=_0x2e85a9['get']({'plain':!![]});var _0x55190a=_0xd35b('0x2b');return db[_0xd35b('0x53')]['find']({'where':{'name':_0x55190a,'userProfileId':_0x3b89c7[_0xd35b('0x54')]},'raw':!![]})[_0xd35b('0x29')](function(_0x2b2c49){if(_0x2b2c49&&_0x2b2c49[_0xd35b('0x55')]===0x0){return db[_0xd35b('0x2c')][_0xd35b('0x4f')]({'name':_0x4c53e5[_0xd35b('0x2f')],'resourceId':_0x4c53e5['id'],'type':_0x2b2c49[_0xd35b('0x2f')],'sectionId':_0x2b2c49['id']},{})[_0xd35b('0x29')](function(){return _0x2e85a9;});}else{return _0x2e85a9;}})['catch'](function(_0x58f981){logger[_0xd35b('0x2e')](_0xd35b('0x5b'),_0x58f981);throw _0x58f981;});}return _0x2e85a9;});}})[_0xd35b('0x29')](respondWithResult(_0x3c9233,0xc9))[_0xd35b('0x4a')](handleError(_0x3c9233,null));};exports[_0xd35b('0x5c')]=function(_0x13253d,_0x41a063){if(_0x13253d[_0xd35b('0x50')]['id']){delete _0x13253d[_0xd35b('0x50')]['id'];}return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0x13253d[_0xd35b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41a063,null))[_0xd35b('0x29')](saveUpdates(_0x13253d[_0xd35b('0x50')],null))[_0xd35b('0x29')](respondWithResult(_0x41a063,null))['catch'](handleError(_0x41a063,null));};exports[_0xd35b('0x2d')]=function(_0xdaba24,_0x3ac8ee){return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0xdaba24[_0xd35b('0x4c')]['id']}})[_0xd35b('0x29')](handleEntityNotFound(_0x3ac8ee,null))[_0xd35b('0x29')](removeEntity(_0x3ac8ee,null))['catch'](handleError(_0x3ac8ee,null));};function widgetAttributes(_0x988a92){try{switch(_0x988a92[_0xd35b('0x34')]){case _0xd35b('0x5d'):return[{'name':_0xd35b('0x5e'),'value':_0x988a92[_0xd35b('0x5e')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92['attrs'][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x61')}];case _0xd35b('0x62'):return[{'name':_0xd35b('0x63'),'value':_0x988a92[_0xd35b('0x63')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||''}];case _0xd35b('0x64'):return[{'name':'attrHourFormat','value':_0x988a92[_0xd35b('0x65')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0]['value']:undefined)||_0xd35b('0x66')},{'name':_0xd35b('0x67'),'value':_0x988a92['attrTimezone']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||'0.00'},{'name':_0xd35b('0x68'),'value':_0x988a92['attrFontSize']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||0xc}];case _0xd35b('0x69'):return[{'name':_0xd35b('0x6a'),'value':_0x988a92['attrMetric']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x6b')},{'name':_0xd35b('0x6c'),'value':_0x988a92[_0xd35b('0x6c')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||[]},{'name':_0xd35b('0x68'),'value':_0x988a92[_0xd35b('0x68')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||0x14},{'name':_0xd35b('0x6d'),'value':_0x988a92[_0xd35b('0x6d')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x3]?_0x988a92[_0xd35b('0x5f')][0x3][_0xd35b('0x60')]:undefined)||_0xd35b('0x6e')},{'name':_0xd35b('0x6f'),'value':_0x988a92[_0xd35b('0x6f')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x4]?_0x988a92[_0xd35b('0x5f')][0x4][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x70'),'value':_0x988a92['attrFaxAccounts']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x5]?_0x988a92[_0xd35b('0x5f')][0x5][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x71'),'value':_0x988a92[_0xd35b('0x71')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x6]?_0x988a92['attrs'][0x6][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x72'),'value':_0x988a92[_0xd35b('0x72')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x7]?_0x988a92[_0xd35b('0x5f')][0x7][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x73'),'value':_0x988a92['attrWhatsappAccounts']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x8]?_0x988a92[_0xd35b('0x5f')][0x8][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x74'),'value':_0x988a92[_0xd35b('0x74')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x9]?_0x988a92[_0xd35b('0x5f')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xd35b('0x75'),'value':_0x988a92[_0xd35b('0x75')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x6b')},{'name':_0xd35b('0x76'),'value':_0x988a92[_0xd35b('0x76')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1]['value']:undefined)||null},{'name':_0xd35b('0x77'),'value':_0x988a92['attrSerie3']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||null},{'name':_0xd35b('0x6c'),'value':_0x988a92[_0xd35b('0x6c')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x3]?_0x988a92['attrs'][0x3][_0xd35b('0x60')]:undefined)||[]},{'name':_0xd35b('0x6d'),'value':_0x988a92[_0xd35b('0x6d')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x4]?_0x988a92[_0xd35b('0x5f')][0x4][_0xd35b('0x60')]:undefined)||'voice'},{'name':_0xd35b('0x6f'),'value':_0x988a92[_0xd35b('0x6f')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x5]?_0x988a92[_0xd35b('0x5f')][0x5][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x70'),'value':_0x988a92[_0xd35b('0x70')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x6]?_0x988a92['attrs'][0x6][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x71'),'value':_0x988a92[_0xd35b('0x71')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x7]?_0x988a92[_0xd35b('0x5f')][0x7][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x72'),'value':_0x988a92[_0xd35b('0x72')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x8]?_0x988a92['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x988a92['attrWhatsappAccounts']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x9]?_0x988a92[_0xd35b('0x5f')][0x9][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x74'),'value':_0x988a92['attrChatWebsites']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0xa]?_0x988a92['attrs'][0xa][_0xd35b('0x60')]:undefined)||''}];case _0xd35b('0x78'):return[{'name':_0xd35b('0x79'),'type':_0x988a92['reportType']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x34')]:undefined)||null,'value':_0x988a92[_0xd35b('0x79')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0]['value']:undefined)||null},{'name':_0xd35b('0x7a'),'value':_0x988a92[_0xd35b('0x7a')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x40020a){logger[_0xd35b('0x2e')](_0xd35b('0x7b'),JSON['stringify'](_0x40020a));return[];}}exports[_0xd35b('0x7c')]=function(_0x57f9ff,_0x585b78,_0x536f7b){if(_0x57f9ff[_0xd35b('0x50')]['id']){delete _0x57f9ff['body']['id'];}return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0x57f9ff['params']['id']}})['then'](handleEntityNotFound(_0x585b78,null))['then'](function(_0x35aac9){if(_0x35aac9){_0x57f9ff[_0xd35b('0x50')]['DashboardId']=_0x35aac9['id'];_0x57f9ff[_0xd35b('0x50')][_0xd35b('0x5f')]=widgetAttributes(_0x57f9ff['body']);return db[_0xd35b('0x7d')][_0xd35b('0x4f')](_0x57f9ff[_0xd35b('0x50')]);}})[_0xd35b('0x29')](respondWithResult(_0x585b78,null))[_0xd35b('0x4a')](handleError(_0x585b78,null));};exports[_0xd35b('0x7e')]=function(_0x13e0c8,_0x3fabae,_0x4d7503){var _0x544d10={};var _0x11121a={};var _0x3dc73b;var _0x3a9d26;return db[_0xd35b('0x32')][_0xd35b('0x7f')]({'where':{'id':_0x13e0c8[_0xd35b('0x4c')]['id']}})[_0xd35b('0x29')](handleEntityNotFound(_0x3fabae,null))['then'](function(_0xe0978e){if(_0xe0978e){_0x3dc73b=_0xe0978e;_0x11121a['model']=_[_0xd35b('0x4d')](db[_0xd35b('0x7d')]['rawAttributes']);_0x11121a['query']=_['keys'](_0x13e0c8['query']);_0x11121a['filters']=_[_0xd35b('0x3b')](_0x11121a[_0xd35b('0x36')],_0x11121a['query']);_0x544d10[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x11121a[_0xd35b('0x36')],qs[_0xd35b('0x3c')](_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x544d10[_0xd35b('0x3a')]=_0x544d10[_0xd35b('0x3a')][_0xd35b('0x3d')]?_0x544d10[_0xd35b('0x3a')]:_0x11121a['model'];_0x544d10['order']=qs[_0xd35b('0x40')](_0x13e0c8['query'][_0xd35b('0x40')]);_0x544d10[_0xd35b('0x41')]=qs[_0xd35b('0x39')](_[_0xd35b('0x42')](_0x13e0c8[_0xd35b('0x38')],_0x11121a[_0xd35b('0x39')]));if(_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x43')]){_0x544d10['where']=_[_0xd35b('0x44')](_0x544d10['where'],{'$or':_[_0xd35b('0x37')](_0x544d10[_0xd35b('0x3a')],function(_0x39940c){var _0x5c48b3={};_0x5c48b3[_0x39940c]={'$like':'%'+_0x13e0c8['query'][_0xd35b('0x43')]+'%'};return _0x5c48b3;})});}_0x544d10=_[_0xd35b('0x44')]({},_0x544d10,_0x13e0c8[_0xd35b('0x45')]);return _0x3dc73b[_0xd35b('0x7e')](_0x544d10);}})[_0xd35b('0x29')](function(_0x3d213d){if(_0x3d213d){_0x3a9d26=_0x3d213d[_0xd35b('0x3d')];if(!_0x13e0c8['query'][_0xd35b('0x3e')](_0xd35b('0x3f'))){_0x544d10[_0xd35b('0x22')]=qs[_0xd35b('0x22')](_0x13e0c8['query'][_0xd35b('0x22')]);_0x544d10['offset']=qs[_0xd35b('0x21')](_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x21')]);}return _0x3dc73b[_0xd35b('0x7e')](_0x544d10);}})[_0xd35b('0x29')](function(_0x41171d){if(_0x41171d){return _0x41171d?{'count':_0x3a9d26,'rows':_0x41171d}:null;}})['then'](respondWithResult(_0x3fabae,null))[_0xd35b('0x4a')](handleError(_0x3fabae,null));}; \ No newline at end of file +var _0x25bc=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','filter','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x16af6f,_0x18ba0a){var _0x37e1d3=function(_0x3173c7){while(--_0x3173c7){_0x16af6f['push'](_0x16af6f['shift']());}};_0x37e1d3(++_0x18ba0a);}(_0x25bc,0x16e));var _0xc25b=function(_0x589414,_0x43b57a){_0x589414=_0x589414-0x0;var _0x17f55=_0x25bc[_0x589414];return _0x17f55;};'use strict';var emlformat=require(_0xc25b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc25b('0x1'));var jsonpatch=require(_0xc25b('0x2'));var rp=require(_0xc25b('0x3'));var moment=require(_0xc25b('0x4'));var BPromise=require(_0xc25b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc25b('0x6'));var csv=require('to-csv');var ejs=require(_0xc25b('0x7'));var fs=require('fs');var fs_extra=require(_0xc25b('0x8'));var _=require(_0xc25b('0x9'));var squel=require('squel');var crypto=require(_0xc25b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc25b('0xb'));var toCsv=require(_0xc25b('0xc'));var querystring=require(_0xc25b('0xd'));var Papa=require(_0xc25b('0xe'));var Redis=require(_0xc25b('0xf'));var authService=require(_0xc25b('0x10'));var qs=require(_0xc25b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc25b('0x12'));var logger=require(_0xc25b('0x13'))(_0xc25b('0x14'));var utils=require(_0xc25b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc25b('0x16'));var db=require(_0xc25b('0x17'))['db'];config[_0xc25b('0x18')]=_[_0xc25b('0x19')](config[_0xc25b('0x18')],{'host':_0xc25b('0x1a'),'port':0x18eb});var socket=require(_0xc25b('0x1b'))(new Redis(config['redis']));require(_0xc25b('0x1c'))['register'](socket);function respondWithStatusCode(_0x5c5fc5,_0x4c10fd){_0x4c10fd=_0x4c10fd||0xcc;return function(_0x4b7b76){if(_0x4b7b76){return _0x5c5fc5[_0xc25b('0x1d')](_0x4c10fd);}return _0x5c5fc5[_0xc25b('0x1e')](_0x4c10fd)[_0xc25b('0x1f')]();};}function respondWithResult(_0xc47398,_0x2d5286){_0x2d5286=_0x2d5286||0xc8;return function(_0x34a321){if(_0x34a321){return _0xc47398[_0xc25b('0x1e')](_0x2d5286)[_0xc25b('0x20')](_0x34a321);}};}function respondWithFilteredResult(_0x32ad5f,_0x3bb669){return function(_0x267da1){if(_0x267da1){var _0x119286=typeof _0x3bb669[_0xc25b('0x21')]==='undefined'&&typeof _0x3bb669[_0xc25b('0x22')]==='undefined';var _0x1fa94f=_0x267da1[_0xc25b('0x23')];var _0x2681d6=_0x119286?0x0:_0x3bb669['offset'];var _0x40f2d9=_0x119286?_0x267da1[_0xc25b('0x23')]:_0x3bb669[_0xc25b('0x21')]+_0x3bb669[_0xc25b('0x22')];var _0x271220;if(_0x40f2d9>=_0x1fa94f){_0x40f2d9=_0x1fa94f;_0x271220=0xc8;}else{_0x271220=0xce;}_0x32ad5f[_0xc25b('0x1e')](_0x271220);return _0x32ad5f['set']('Content-Range',_0x2681d6+'-'+_0x40f2d9+'/'+_0x1fa94f)[_0xc25b('0x20')](_0x267da1);}return null;};}function patchUpdates(_0xf41c56){return function(_0x4b3ab4){try{jsonpatch[_0xc25b('0x24')](_0x4b3ab4,_0xf41c56,!![]);}catch(_0x1f9b6d){return BPromise[_0xc25b('0x25')](_0x1f9b6d);}return _0x4b3ab4['save']();};}function saveUpdates(_0x1cf162,_0x919a79){return function(_0x3e44af){if(_0x3e44af){return _0x3e44af[_0xc25b('0x26')](_0x1cf162)[_0xc25b('0x27')](function(_0x30b2f3){return _0x30b2f3;});}return null;};}function removeEntity(_0x1c902e,_0x44d55f){return function(_0x25d366){if(_0x25d366){return _0x25d366[_0xc25b('0x28')]()[_0xc25b('0x27')](function(){var _0x3f3d18=_0x25d366[_0xc25b('0x29')]({'plain':!![]});var _0x4e09ed='CustomDashboards';return db[_0xc25b('0x2a')]['destroy']({'where':{'type':_0x4e09ed,'resourceId':_0x3f3d18['id']}})[_0xc25b('0x27')](function(){return _0x25d366;});})[_0xc25b('0x27')](function(){_0x1c902e[_0xc25b('0x1e')](0xcc)[_0xc25b('0x1f')]();});}};}function handleEntityNotFound(_0x634bd3,_0x54e881){return function(_0x47886d){if(!_0x47886d){_0x634bd3['sendStatus'](0x194);}return _0x47886d;};}function handleError(_0x2262df,_0x3bc049){_0x3bc049=_0x3bc049||0x1f4;return function(_0x1ddd51){logger[_0xc25b('0x2b')](_0x1ddd51[_0xc25b('0x2c')]);if(_0x1ddd51[_0xc25b('0x2d')]){delete _0x1ddd51['name'];}_0x2262df['status'](_0x3bc049)[_0xc25b('0x2e')](_0x1ddd51);};}exports['index']=function(_0x505496,_0x1a53d5){var _0x3b2fdb={},_0x449b79={},_0x2cd3e4={'count':0x0,'rows':[]};var _0x142d1e=_[_0xc25b('0x2f')](db[_0xc25b('0x30')][_0xc25b('0x31')],function(_0xeb36d){return{'name':_0xeb36d[_0xc25b('0x32')],'type':_0xeb36d[_0xc25b('0x33')][_0xc25b('0x34')]};});_0x449b79[_0xc25b('0x35')]=_[_0xc25b('0x2f')](_0x142d1e,_0xc25b('0x2d'));_0x449b79[_0xc25b('0x36')]=_[_0xc25b('0x37')](_0x505496[_0xc25b('0x36')]);_0x449b79[_0xc25b('0x38')]=_[_0xc25b('0x39')](_0x449b79[_0xc25b('0x35')],_0x449b79['query']);_0x3b2fdb[_0xc25b('0x3a')]=_[_0xc25b('0x39')](_0x449b79[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x505496[_0xc25b('0x36')][_0xc25b('0x3b')]));_0x3b2fdb[_0xc25b('0x3a')]=_0x3b2fdb[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0x3b2fdb[_0xc25b('0x3a')]:_0x449b79[_0xc25b('0x35')];if(!_0x505496[_0xc25b('0x36')][_0xc25b('0x3d')](_0xc25b('0x3e'))){_0x3b2fdb[_0xc25b('0x22')]=qs['limit'](_0x505496['query'][_0xc25b('0x22')]);_0x3b2fdb[_0xc25b('0x21')]=qs[_0xc25b('0x21')](_0x505496[_0xc25b('0x36')][_0xc25b('0x21')]);}_0x3b2fdb['order']=qs['sort'](_0x505496[_0xc25b('0x36')][_0xc25b('0x3f')]);_0x3b2fdb[_0xc25b('0x40')]=qs[_0xc25b('0x38')](_[_0xc25b('0x41')](_0x505496[_0xc25b('0x36')],_0x449b79[_0xc25b('0x38')]),_0x142d1e);if(_0x505496[_0xc25b('0x36')]['filter']){_0x3b2fdb[_0xc25b('0x40')]=_[_0xc25b('0x42')](_0x3b2fdb['where'],{'$or':_[_0xc25b('0x2f')](_0x142d1e,function(_0x13243f){if(_0x13243f[_0xc25b('0x33')]!==_0xc25b('0x43')){var _0x56a4bd={};_0x56a4bd[_0x13243f[_0xc25b('0x2d')]]={'$like':'%'+_0x505496[_0xc25b('0x36')]['filter']+'%'};return _0x56a4bd;}})});}_0x3b2fdb=_['merge']({},_0x3b2fdb,_0x505496['options']);var _0x5b99fc={'where':_0x3b2fdb[_0xc25b('0x40')]};return db[_0xc25b('0x30')][_0xc25b('0x23')](_0x5b99fc)[_0xc25b('0x27')](function(_0x2dfe6e){_0x2cd3e4['count']=_0x2dfe6e;if(_0x505496['query'][_0xc25b('0x44')]){_0x3b2fdb[_0xc25b('0x45')]=[{'all':!![]}];}return db[_0xc25b('0x30')][_0xc25b('0x46')](_0x3b2fdb);})['then'](function(_0x57db7c){_0x2cd3e4[_0xc25b('0x47')]=_0x57db7c;return _0x2cd3e4;})[_0xc25b('0x27')](respondWithFilteredResult(_0x1a53d5,_0x3b2fdb))[_0xc25b('0x48')](handleError(_0x1a53d5,null));};exports[_0xc25b('0x49')]=function(_0xf36f2f,_0x5374c5){var _0x3d0d9c={'raw':![],'where':{'id':_0xf36f2f[_0xc25b('0x4a')]['id']}},_0xae144a={};_0xae144a['model']=_['keys'](db['Dashboard'][_0xc25b('0x31')]);_0xae144a[_0xc25b('0x36')]=_['keys'](_0xf36f2f[_0xc25b('0x36')]);_0xae144a[_0xc25b('0x38')]=_[_0xc25b('0x39')](_0xae144a['model'],_0xae144a['query']);_0x3d0d9c['attributes']=_[_0xc25b('0x39')](_0xae144a[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0xf36f2f['query'][_0xc25b('0x3b')]));_0x3d0d9c[_0xc25b('0x3a')]=_0x3d0d9c[_0xc25b('0x3a')]['length']?_0x3d0d9c[_0xc25b('0x3a')]:_0xae144a[_0xc25b('0x35')];if(_0xf36f2f[_0xc25b('0x36')][_0xc25b('0x44')]){_0x3d0d9c[_0xc25b('0x45')]=[{'all':!![]}];}_0x3d0d9c=_[_0xc25b('0x42')]({},_0x3d0d9c,_0xf36f2f[_0xc25b('0x4b')]);return db['Dashboard'][_0xc25b('0x4c')](_0x3d0d9c)[_0xc25b('0x27')](handleEntityNotFound(_0x5374c5,null))[_0xc25b('0x27')](respondWithResult(_0x5374c5,null))[_0xc25b('0x48')](handleError(_0x5374c5,null));};exports[_0xc25b('0x4d')]=function(_0x4de3c8,_0x5e4e60){return db[_0xc25b('0x30')][_0xc25b('0x4d')](_0x4de3c8[_0xc25b('0x4e')],{})['then'](function(_0x20528e){var _0x332afa=_0x4de3c8[_0xc25b('0x4f')][_0xc25b('0x29')]({'plain':!![]});if(!_0x332afa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x332afa[_0xc25b('0x50')]==='user'){var _0x12d0a4=_0x20528e[_0xc25b('0x29')]({'plain':!![]});var _0x2bdbb1='CustomDashboards';return db[_0xc25b('0x51')][_0xc25b('0x4c')]({'where':{'name':_0x2bdbb1,'userProfileId':_0x332afa['userProfileId']},'raw':!![]})['then'](function(_0x3d82d2){if(_0x3d82d2&&_0x3d82d2[_0xc25b('0x52')]===0x0){return db[_0xc25b('0x2a')][_0xc25b('0x4d')]({'name':_0x12d0a4[_0xc25b('0x2d')],'resourceId':_0x12d0a4['id'],'type':_0x3d82d2[_0xc25b('0x2d')],'sectionId':_0x3d82d2['id']},{})[_0xc25b('0x27')](function(){return _0x20528e;});}else{return _0x20528e;}})[_0xc25b('0x48')](function(_0x4bf393){logger[_0xc25b('0x2b')](_0xc25b('0x53'),_0x4bf393);throw _0x4bf393;});}return _0x20528e;})['then'](respondWithResult(_0x5e4e60,0xc9))['catch'](handleError(_0x5e4e60,null));};exports[_0xc25b('0x54')]=function(_0x336644,_0x6dba24){var _0xdb140a={'where':{'id':_0x336644[_0xc25b('0x4a')]['id']}},_0x4d0efd={};_0x4d0efd['model']=_[_0xc25b('0x37')](db[_0xc25b('0x30')][_0xc25b('0x31')]);_0xdb140a['attributes']=_[_0xc25b('0x39')](_0x4d0efd[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x336644[_0xc25b('0x36')][_0xc25b('0x3b')]));_0xdb140a[_0xc25b('0x3a')]=_0xdb140a[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0xdb140a[_0xc25b('0x3a')]:_0x4d0efd[_0xc25b('0x35')];if(_0x336644[_0xc25b('0x36')][_0xc25b('0x44')]){_0xdb140a['include']=[{'all':!![]}];}_0xdb140a=_[_0xc25b('0x42')]({},_0xdb140a,_0x336644[_0xc25b('0x4b')]);return db['Dashboard'][_0xc25b('0x4c')](_0xdb140a)[_0xc25b('0x27')](handleEntityNotFound(_0x6dba24,null))[_0xc25b('0x27')](function(_0x4a41d0){if(_0x4a41d0){var _0x3a0e52=_0x4a41d0[_0xc25b('0x29')]({'plain':!![]});_0x3a0e52=qs[_0xc25b('0x55')](_0x3a0e52,['id',_0xc25b('0x56'),'updatedAt']);_0x336644[_0xc25b('0x4e')]=_['omit'](_0x336644[_0xc25b('0x4e')],['id',_0xc25b('0x56'),_0xc25b('0x57')]);return db['Dashboard'][_0xc25b('0x4d')](_[_0xc25b('0x42')](_0x3a0e52,_0x336644[_0xc25b('0x4e')]),{'include':_0x336644[_0xc25b('0x36')][_0xc25b('0x44')]?[{'all':!![]}]:undefined})[_0xc25b('0x27')](function(_0x3c9146){var _0x41f2d5=_0x336644[_0xc25b('0x4f')]['get']({'plain':!![]});if(!_0x41f2d5)throw new Error(_0xc25b('0x58'));if(_0x41f2d5[_0xc25b('0x50')]==='user'){var _0x4815d2=_0x3c9146[_0xc25b('0x29')]({'plain':!![]});var _0x2338ec=_0xc25b('0x59');return db[_0xc25b('0x51')][_0xc25b('0x4c')]({'where':{'name':_0x2338ec,'userProfileId':_0x41f2d5[_0xc25b('0x5a')]},'raw':!![]})[_0xc25b('0x27')](function(_0x48645e){if(_0x48645e&&_0x48645e[_0xc25b('0x52')]===0x0){return db[_0xc25b('0x2a')][_0xc25b('0x4d')]({'name':_0x4815d2[_0xc25b('0x2d')],'resourceId':_0x4815d2['id'],'type':_0x48645e[_0xc25b('0x2d')],'sectionId':_0x48645e['id']},{})[_0xc25b('0x27')](function(){return _0x3c9146;});}else{return _0x3c9146;}})[_0xc25b('0x48')](function(_0x3576de){logger[_0xc25b('0x2b')](_0xc25b('0x53'),_0x3576de);throw _0x3576de;});}return _0x3c9146;});}})[_0xc25b('0x27')](respondWithResult(_0x6dba24,0xc9))['catch'](handleError(_0x6dba24,null));};exports[_0xc25b('0x26')]=function(_0x3595bb,_0x2fcfbf){if(_0x3595bb[_0xc25b('0x4e')]['id']){delete _0x3595bb[_0xc25b('0x4e')]['id'];}return db[_0xc25b('0x30')][_0xc25b('0x4c')]({'where':{'id':_0x3595bb[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x2fcfbf,null))[_0xc25b('0x27')](saveUpdates(_0x3595bb['body'],null))[_0xc25b('0x27')](respondWithResult(_0x2fcfbf,null))[_0xc25b('0x48')](handleError(_0x2fcfbf,null));};exports[_0xc25b('0x28')]=function(_0xf9eb23,_0x54f07e){return db[_0xc25b('0x30')][_0xc25b('0x4c')]({'where':{'id':_0xf9eb23[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x54f07e,null))[_0xc25b('0x27')](removeEntity(_0x54f07e,null))['catch'](handleError(_0x54f07e,null));};function widgetAttributes(_0x49498f){try{switch(_0x49498f['type']){case _0xc25b('0x5b'):return[{'name':_0xc25b('0x5c'),'value':_0x49498f[_0xc25b('0x5c')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||_0xc25b('0x5f')}];case _0xc25b('0x60'):return[{'name':_0xc25b('0x61'),'value':_0x49498f[_0xc25b('0x61')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x62'):return[{'name':_0xc25b('0x63'),'value':_0x49498f[_0xc25b('0x63')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f['attrs'][0x0]['value']:undefined)||_0xc25b('0x64')},{'name':_0xc25b('0x65'),'value':_0x49498f[_0xc25b('0x65')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||_0xc25b('0x66')},{'name':_0xc25b('0x67'),'value':_0x49498f[_0xc25b('0x67')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||0xc}];case _0xc25b('0x68'):return[{'name':_0xc25b('0x69'),'value':_0x49498f[_0xc25b('0x69')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||'total'},{'name':_0xc25b('0x6a'),'value':_0x49498f[_0xc25b('0x6a')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x1]?_0x49498f['attrs'][0x1][_0xc25b('0x5e')]:undefined)||[]},{'name':_0xc25b('0x67'),'value':_0x49498f[_0xc25b('0x67')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x49498f[_0xc25b('0x6b')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x3]?_0x49498f[_0xc25b('0x5d')][0x3][_0xc25b('0x5e')]:undefined)||_0xc25b('0x6c')},{'name':'attrEmailAccounts','value':_0x49498f[_0xc25b('0x6d')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x4]?_0x49498f['attrs'][0x4]['value']:undefined)||''},{'name':_0xc25b('0x6e'),'value':_0x49498f['attrFaxAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x5]?_0x49498f[_0xc25b('0x5d')][0x5][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x6f'),'value':_0x49498f[_0xc25b('0x6f')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x6]?_0x49498f[_0xc25b('0x5d')][0x6][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x70'),'value':_0x49498f[_0xc25b('0x70')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x7]?_0x49498f[_0xc25b('0x5d')][0x7][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x71'),'value':_0x49498f['attrWhatsappAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x8]?_0x49498f[_0xc25b('0x5d')][0x8][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x72'),'value':_0x49498f[_0xc25b('0x72')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x9]?_0x49498f['attrs'][0x9][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x73'):case _0xc25b('0x74'):return[{'name':_0xc25b('0x75'),'value':_0x49498f[_0xc25b('0x75')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0xc25b('0x76'),'value':_0x49498f[_0xc25b('0x76')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x77'),'value':_0x49498f[_0xc25b('0x77')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x6a'),'value':_0x49498f['attrVoiceQueues']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x3]?_0x49498f[_0xc25b('0x5d')][0x3][_0xc25b('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x49498f[_0xc25b('0x6b')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x4]?_0x49498f[_0xc25b('0x5d')][0x4]['value']:undefined)||'voice'},{'name':_0xc25b('0x6d'),'value':_0x49498f['attrEmailAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x5]?_0x49498f['attrs'][0x5][_0xc25b('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x49498f['attrFaxAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x6]?_0x49498f[_0xc25b('0x5d')][0x6][_0xc25b('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x49498f[_0xc25b('0x6f')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x7]?_0x49498f[_0xc25b('0x5d')][0x7]['value']:undefined)||''},{'name':_0xc25b('0x70'),'value':_0x49498f[_0xc25b('0x70')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x8]?_0x49498f[_0xc25b('0x5d')][0x8][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x71'),'value':_0x49498f[_0xc25b('0x71')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x9]?_0x49498f[_0xc25b('0x5d')][0x9][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x72'),'value':_0x49498f[_0xc25b('0x72')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0xa]?_0x49498f['attrs'][0xa][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x78'):return[{'name':_0xc25b('0x79'),'type':_0x49498f[_0xc25b('0x7a')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x33')]:undefined)||null,'value':_0x49498f[_0xc25b('0x79')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x7b'),'value':_0x49498f['attrRefresh']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x49c5b5){logger[_0xc25b('0x2b')]('widgetAttributes:\x20%s',JSON[_0xc25b('0x7c')](_0x49c5b5));return[];}}exports[_0xc25b('0x7d')]=function(_0x33f65c,_0x1cbf13,_0x5c4ce2){if(_0x33f65c[_0xc25b('0x4e')]['id']){delete _0x33f65c[_0xc25b('0x4e')]['id'];}return db[_0xc25b('0x30')]['find']({'where':{'id':_0x33f65c[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x1cbf13,null))[_0xc25b('0x27')](function(_0x5edcd2){if(_0x5edcd2){_0x33f65c['body'][_0xc25b('0x7e')]=_0x5edcd2['id'];_0x33f65c[_0xc25b('0x4e')][_0xc25b('0x5d')]=widgetAttributes(_0x33f65c[_0xc25b('0x4e')]);return db[_0xc25b('0x7f')][_0xc25b('0x4d')](_0x33f65c[_0xc25b('0x4e')]);}})[_0xc25b('0x27')](respondWithResult(_0x1cbf13,null))[_0xc25b('0x48')](handleError(_0x1cbf13,null));};exports[_0xc25b('0x80')]=function(_0x4b3307,_0x51da69,_0x46d6e9){var _0x3f7e27={};var _0x1d0645={};var _0x486a6d;var _0x2a1aad;return db[_0xc25b('0x30')]['findOne']({'where':{'id':_0x4b3307[_0xc25b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51da69,null))['then'](function(_0x17556b){if(_0x17556b){_0x486a6d=_0x17556b;_0x1d0645[_0xc25b('0x35')]=_[_0xc25b('0x37')](db[_0xc25b('0x7f')]['rawAttributes']);_0x1d0645['query']=_['keys'](_0x4b3307[_0xc25b('0x36')]);_0x1d0645['filters']=_['intersection'](_0x1d0645[_0xc25b('0x35')],_0x1d0645[_0xc25b('0x36')]);_0x3f7e27[_0xc25b('0x3a')]=_['intersection'](_0x1d0645[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x4b3307[_0xc25b('0x36')][_0xc25b('0x3b')]));_0x3f7e27[_0xc25b('0x3a')]=_0x3f7e27[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0x3f7e27[_0xc25b('0x3a')]:_0x1d0645['model'];_0x3f7e27['order']=qs['sort'](_0x4b3307[_0xc25b('0x36')]['sort']);_0x3f7e27['where']=qs[_0xc25b('0x38')](_[_0xc25b('0x41')](_0x4b3307[_0xc25b('0x36')],_0x1d0645[_0xc25b('0x38')]));if(_0x4b3307[_0xc25b('0x36')][_0xc25b('0x81')]){_0x3f7e27[_0xc25b('0x40')]=_['merge'](_0x3f7e27[_0xc25b('0x40')],{'$or':_[_0xc25b('0x2f')](_0x3f7e27[_0xc25b('0x3a')],function(_0x2e320b){var _0x8b01a0={};_0x8b01a0[_0x2e320b]={'$like':'%'+_0x4b3307[_0xc25b('0x36')][_0xc25b('0x81')]+'%'};return _0x8b01a0;})});}_0x3f7e27=_[_0xc25b('0x42')]({},_0x3f7e27,_0x4b3307[_0xc25b('0x4b')]);return _0x486a6d[_0xc25b('0x80')](_0x3f7e27);}})[_0xc25b('0x27')](function(_0x989aa4){if(_0x989aa4){_0x2a1aad=_0x989aa4[_0xc25b('0x3c')];if(!_0x4b3307[_0xc25b('0x36')]['hasOwnProperty'](_0xc25b('0x3e'))){_0x3f7e27[_0xc25b('0x22')]=qs[_0xc25b('0x22')](_0x4b3307[_0xc25b('0x36')]['limit']);_0x3f7e27[_0xc25b('0x21')]=qs['offset'](_0x4b3307[_0xc25b('0x36')][_0xc25b('0x21')]);}return _0x486a6d[_0xc25b('0x80')](_0x3f7e27);}})[_0xc25b('0x27')](function(_0x3bf5b7){if(_0x3bf5b7){return _0x3bf5b7?{'count':_0x2a1aad,'rows':_0x3bf5b7}:null;}})[_0xc25b('0x27')](respondWithResult(_0x51da69,null))[_0xc25b('0x48')](handleError(_0x51da69,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 62f445d..38a3155 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 _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','emit'];(function(_0x2c35b4,_0x5e1e1d){var _0x320eb7=function(_0x2d4c9d){while(--_0x2d4c9d){_0x2c35b4['push'](_0x2c35b4['shift']());}};_0x320eb7(++_0x5e1e1d);}(_0x0f80,0x108));var _0x00f8=function(_0x1c5541,_0x5937a){_0x1c5541=_0x1c5541-0x0;var _0x5acd40=_0x0f80[_0x1c5541];return _0x5acd40;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){DashboardEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);DashboardEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];Dashboard[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('0x8')]=DashboardEvents; \ No newline at end of file +var _0x6cb2=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x6cb2,0xfa));var _0x26cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6cb2[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x26cb('0x0'));var Dashboard=require(_0x26cb('0x1'))['db'][_0x26cb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x26cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26cb('0x4'),'afterDestroy':_0x26cb('0x5')};function emitEvent(_0x40a63d){return function(_0x5daebc,_0x4044f3,_0x3a86b5){DashboardEvents[_0x26cb('0x6')](_0x40a63d+':'+_0x5daebc['id'],_0x5daebc);DashboardEvents[_0x26cb('0x6')](_0x40a63d,_0x5daebc);_0x3a86b5(null);};}for(var e in events){if(events[_0x26cb('0x7')](e)){var event=events[e];Dashboard[_0x26cb('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a36caf5..2b090f8 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 _0xb000=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','moment','bluebird'];(function(_0x482115,_0x5550f5){var _0x40afb4=function(_0x44ce30){while(--_0x44ce30){_0x482115['push'](_0x482115['shift']());}};_0x40afb4(++_0x5550f5);}(_0xb000,0x8b));var _0x0b00=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xb000[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x0b00('0x0'));var util=require(_0x0b00('0x1'));var logger=require(_0x0b00('0x2'))('api');var moment=require(_0x0b00('0x3'));var BPromise=require(_0x0b00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b00('0x5'));var rimraf=require(_0x0b00('0x6'));var config=require(_0x0b00('0x7'));var attributes=require(_0x0b00('0x8'));module[_0x0b00('0x9')]=function(_0x516915,_0x5d4e06){return _0x516915[_0x0b00('0xa')]('Dashboard',attributes,{'tableName':_0x0b00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca0a=['../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','api','moment','request-promise','path'];(function(_0x14457b,_0x55cb3d){var _0x4a9ed8=function(_0x2bbbf0){while(--_0x2bbbf0){_0x14457b['push'](_0x14457b['shift']());}};_0x4a9ed8(++_0x55cb3d);}(_0xca0a,0xf5));var _0xaca0=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xca0a[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xaca0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaca0('0x1'));var moment=require(_0xaca0('0x2'));var BPromise=require('bluebird');var rp=require(_0xaca0('0x3'));var fs=require('fs');var path=require(_0xaca0('0x4'));var rimraf=require('rimraf');var config=require(_0xaca0('0x5'));var attributes=require(_0xaca0('0x6'));module[_0xaca0('0x7')]=function(_0x56541f,_0x1f8510){return _0x56541f['define'](_0xaca0('0x8'),attributes,{'tableName':_0xaca0('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 eead01a..882042f 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 _0x8b6d=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b6d,0x124));var _0xd8b6=function(_0x453baa,_0x46c17a){_0x453baa=_0x453baa-0x0;var _0x39825=_0x8b6d[_0x453baa];return _0x39825;};'use strict';var _=require(_0xd8b6('0x0'));var util=require('util');var moment=require(_0xd8b6('0x1'));var BPromise=require(_0xd8b6('0x2'));var rs=require(_0xd8b6('0x3'));var fs=require('fs');var Redis=require(_0xd8b6('0x4'));var db=require(_0xd8b6('0x5'))['db'];var utils=require(_0xd8b6('0x6'));var logger=require('../../config/logger')(_0xd8b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8b6('0x8'));var client=jayson[_0xd8b6('0x9')][_0xd8b6('0xa')]({'port':0x232a});config['redis']=_[_0xd8b6('0xb')](config['redis'],{'host':_0xd8b6('0xc'),'port':0x18eb});var socket=require(_0xd8b6('0xd'))(new Redis(config[_0xd8b6('0xe')]));require(_0xd8b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x104137,_0x5502b4,_0x1eeb9b){return new BPromise(function(_0x3ed5fc,_0x502676){return client['request'](_0x104137,_0x1eeb9b)['then'](function(_0x52f0b8){logger['info']('Dashboard,\x20%s,\x20%s',_0x5502b4,_0xd8b6('0x10'));logger[_0xd8b6('0x11')](_0xd8b6('0x12'),_0x5502b4,_0xd8b6('0x10'),JSON[_0xd8b6('0x13')](_0x52f0b8));if(_0x52f0b8[_0xd8b6('0x14')]){if(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x15')]===0x1f4){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x502676(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}logger[_0xd8b6('0x14')](_0xd8b6('0x17'),_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x3ed5fc(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}else{logger['info'](_0xd8b6('0x17'),_0x5502b4,_0xd8b6('0x10'));_0x3ed5fc(_0x52f0b8[_0xd8b6('0x18')]['message']);}})['catch'](function(_0x382ac5){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x382ac5);_0x502676(_0x382ac5);});});} \ No newline at end of file +var _0xc156=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc156,0xa2));var _0x6c15=function(_0x32d07c,_0x266921){_0x32d07c=_0x32d07c-0x0;var _0x53c25b=_0xc156[_0x32d07c];return _0x53c25b;};'use strict';var _=require('lodash');var util=require(_0x6c15('0x0'));var moment=require(_0x6c15('0x1'));var BPromise=require(_0x6c15('0x2'));var rs=require(_0x6c15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c15('0x4'))['db'];var utils=require(_0x6c15('0x5'));var logger=require('../../config/logger')(_0x6c15('0x6'));var config=require(_0x6c15('0x7'));var jayson=require(_0x6c15('0x8'));var client=jayson[_0x6c15('0x9')][_0x6c15('0xa')]({'port':0x232a});config[_0x6c15('0xb')]=_[_0x6c15('0xc')](config[_0x6c15('0xb')],{'host':_0x6c15('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0x6c15('0xe')](socket);function respondWithRpcPromise(_0x1beed1,_0x1743dc,_0x13420f){return new BPromise(function(_0x11e129,_0x301809){return client['request'](_0x1beed1,_0x13420f)[_0x6c15('0xf')](function(_0x9c6d70){logger[_0x6c15('0x10')](_0x6c15('0x11'),_0x1743dc,_0x6c15('0x12'));logger[_0x6c15('0x13')](_0x6c15('0x14'),_0x1743dc,_0x6c15('0x12'),JSON[_0x6c15('0x15')](_0x9c6d70));if(_0x9c6d70[_0x6c15('0x16')]){if(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x17')]===0x1f4){logger[_0x6c15('0x16')](_0x6c15('0x11'),_0x1743dc,_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);return _0x301809(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);}logger['error'](_0x6c15('0x11'),_0x1743dc,_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);return _0x11e129(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);}else{logger[_0x6c15('0x10')](_0x6c15('0x11'),_0x1743dc,_0x6c15('0x12'));_0x11e129(_0x9c6d70[_0x6c15('0x19')][_0x6c15('0x18')]);}})[_0x6c15('0x1a')](function(_0x1704e2){logger['error']('Dashboard,\x20%s,\x20%s',_0x1743dc,_0x1704e2);_0x301809(_0x1704e2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 7975dc0..bd29b4a 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 _0x0faf=['remove','update','emit','removeListener','register','length','save'];(function(_0x121469,_0x131521){var _0x1390eb=function(_0x399511){while(--_0x399511){_0x121469['push'](_0x121469['shift']());}};_0x1390eb(++_0x131521);}(_0x0faf,0x148));var _0xf0fa=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x0faf[_0x10d670];return _0x20d6f8;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xf0fa('0x0'),_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x571ff2,_0x22069e){return function(_0x291e2d){_0x22069e[_0xf0fa('0x3')](_0x571ff2,_0x291e2d);};}function removeListener(_0x4d8e54,_0x29ed7a){return function(){DashboardEvents[_0xf0fa('0x4')](_0x4d8e54,_0x29ed7a);};}exports[_0xf0fa('0x5')]=function(_0x3c3925){for(var _0x4c9749=0x0,_0x3e863d=events[_0xf0fa('0x6')];_0x4c9749<_0x3e863d;_0x4c9749++){var _0x11d902=events[_0x4c9749];var _0x3d95aa=createListener('dashboard:'+_0x11d902,_0x3c3925);DashboardEvents['on'](_0x11d902,_0x3d95aa);}}; \ No newline at end of file +var _0xd4bd=['register','length','remove','update'];(function(_0x2537a2,_0x28e184){var _0x31c55e=function(_0x42f55b){while(--_0x42f55b){_0x2537a2['push'](_0x2537a2['shift']());}};_0x31c55e(++_0x28e184);}(_0xd4bd,0x1ee));var _0xdd4b=function(_0x55cd82,_0x111a93){_0x55cd82=_0x55cd82-0x0;var _0x59aee1=_0xd4bd[_0x55cd82];return _0x59aee1;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xdd4b('0x0'),_0xdd4b('0x1')];function createListener(_0x34f8dd,_0x4cf62e){return function(_0x295094){_0x4cf62e['emit'](_0x34f8dd,_0x295094);};}function removeListener(_0x36ee29,_0x26b3ee){return function(){DashboardEvents['removeListener'](_0x36ee29,_0x26b3ee);};}exports[_0xdd4b('0x2')]=function(_0x570ea9){for(var _0xa087f7=0x0,_0x33eb39=events[_0xdd4b('0x3')];_0xa087f7<_0x33eb39;_0xa087f7++){var _0x3eb63b=events[_0xa087f7];var _0x2f80b4=createListener('dashboard:'+_0x3eb63b,_0x570ea9);DashboardEvents['on'](_0x3eb63b,_0x2f80b4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d1346ec..80c07ef 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 _0x7826=['/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get'];(function(_0x3080cd,_0x21a4ea){var _0x2ffe11=function(_0x571203){while(--_0x571203){_0x3080cd['push'](_0x3080cd['shift']());}};_0x2ffe11(++_0x21a4ea);}(_0x7826,0xfd));var _0x6782=function(_0x4971ca,_0x2ae39a){_0x4971ca=_0x4971ca-0x0;var _0x10c18e=_0x7826[_0x4971ca];return _0x10c18e;};'use strict';var multer=require('multer');var util=require(_0x6782('0x0'));var path=require(_0x6782('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6782('0x2')]();var fs_extra=require(_0x6782('0x3'));var auth=require(_0x6782('0x4'));var interaction=require(_0x6782('0x5'));var config=require(_0x6782('0x6'));var controller=require(_0x6782('0x7'));router['get']('/',auth[_0x6782('0x8')](),controller[_0x6782('0x9')]);router[_0x6782('0xa')](_0x6782('0xb'),auth[_0x6782('0x8')](),controller[_0x6782('0xc')]);router['get'](_0x6782('0xd'),auth['isAuthenticated'](),controller[_0x6782('0xe')]);router['post']('/',auth[_0x6782('0x8')](),controller[_0x6782('0xf')]);router[_0x6782('0x10')](_0x6782('0x11'),auth[_0x6782('0x8')](),controller['clone']);router['post'](_0x6782('0xd'),auth[_0x6782('0x8')](),controller[_0x6782('0x12')]);router['put'](_0x6782('0xb'),auth[_0x6782('0x8')](),controller[_0x6782('0x13')]);router[_0x6782('0x14')](_0x6782('0xb'),auth['isAuthenticated'](),controller[_0x6782('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe152=['isAuthenticated','index','get','/:id','show','getItems','post','/:id/clone','clone','/:id/items','put','update','delete','destroy','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d4f0a,_0x122ff2){var _0x4ab64e=function(_0x665450){while(--_0x665450){_0x3d4f0a['push'](_0x3d4f0a['shift']());}};_0x4ab64e(++_0x122ff2);}(_0xe152,0x118));var _0x2e15=function(_0x3977dc,_0x53d367){_0x3977dc=_0x3977dc-0x0;var _0x417846=_0xe152[_0x3977dc];return _0x417846;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2e15('0x0')]();var fs_extra=require(_0x2e15('0x1'));var auth=require(_0x2e15('0x2'));var interaction=require(_0x2e15('0x3'));var config=require(_0x2e15('0x4'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x2e15('0x5')](),controller[_0x2e15('0x6')]);router[_0x2e15('0x7')](_0x2e15('0x8'),auth['isAuthenticated'](),controller[_0x2e15('0x9')]);router[_0x2e15('0x7')]('/:id/items',auth['isAuthenticated'](),controller[_0x2e15('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2e15('0xb')](_0x2e15('0xc'),auth['isAuthenticated'](),controller[_0x2e15('0xd')]);router[_0x2e15('0xb')](_0x2e15('0xe'),auth[_0x2e15('0x5')](),controller['addItem']);router[_0x2e15('0xf')](_0x2e15('0x8'),auth[_0x2e15('0x5')](),controller[_0x2e15('0x10')]);router[_0x2e15('0x11')]('/:id',auth[_0x2e15('0x5')](),controller[_0x2e15('0x12')]);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 acefa7a..8eca14e 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 _0xc6ac=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0xf5eaa0,_0x5bfa29){var _0x47039e=function(_0x4b47a6){while(--_0x4b47a6){_0xf5eaa0['push'](_0xf5eaa0['shift']());}};_0x47039e(++_0x5bfa29);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4331ea,_0x49c700){_0x4331ea=_0x4331ea-0x0;var _0x4335a8=_0xc6ac[_0x4331ea];return _0x4335a8;};'use strict';var Sequelize=require(_0xcc6a('0x0'));var squel=require(_0xcc6a('0x1'));var _=require(_0xcc6a('0x2'));module[_0xcc6a('0x3')]={'title':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xcc6a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xcc6a('0x5')](_0xcc6a('0x6')),'get':function(){try{return JSON[_0xcc6a('0x7')](this[_0xcc6a('0x8')](_0xcc6a('0x9')));}catch(_0x188b05){return[];}},'set':function(_0x12330e){try{this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')](_0x12330e));}catch(_0x11b919){this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcc6a('0xc')]},'col':{'type':Sequelize[_0xcc6a('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc6a('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![],'defaultValue':_0xcc6a('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xcc6a('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5496,0x175));var _0x6549=function(_0x1c1f31,_0x18330f){_0x1c1f31=_0x1c1f31-0x0;var _0x417fb6=_0x5496[_0x1c1f31];return _0x417fb6;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8815f99..65a7233 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 _0xf03a=['pie-chart','attrSerie1','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','length','attributes','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart'];(function(_0x156458,_0x3e0f5e){var _0xc81ae7=function(_0x1600fc){while(--_0x1600fc){_0x156458['push'](_0x156458['shift']());}};_0xc81ae7(++_0x3e0f5e);}(_0xf03a,0x1a0));var _0xaf03=function(_0x309b59,_0x4eceb6){_0x309b59=_0x309b59-0x0;var _0x369c42=_0xf03a[_0x309b59];return _0x369c42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf03('0x0'));var zipdir=require(_0xaf03('0x1'));var jsonpatch=require(_0xaf03('0x2'));var rp=require(_0xaf03('0x3'));var moment=require('moment');var BPromise=require(_0xaf03('0x4'));var Mustache=require(_0xaf03('0x5'));var util=require('util');var path=require(_0xaf03('0x6'));var sox=require(_0xaf03('0x7'));var csv=require(_0xaf03('0x8'));var ejs=require(_0xaf03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf03('0xa'));var squel=require('squel');var crypto=require(_0xaf03('0xb'));var jsforce=require(_0xaf03('0xc'));var deskjs=require(_0xaf03('0xd'));var toCsv=require(_0xaf03('0x8'));var querystring=require(_0xaf03('0xe'));var Papa=require(_0xaf03('0xf'));var Redis=require('ioredis');var authService=require(_0xaf03('0x10'));var qs=require(_0xaf03('0x11'));var as=require(_0xaf03('0x12'));var hardwareService=require(_0xaf03('0x13'));var logger=require(_0xaf03('0x14'))('api');var utils=require(_0xaf03('0x15'));var config=require(_0xaf03('0x16'));var licenseUtil=require(_0xaf03('0x17'));var db=require(_0xaf03('0x18'))['db'];config[_0xaf03('0x19')]=_[_0xaf03('0x1a')](config[_0xaf03('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf03('0x19')]));require(_0xaf03('0x1b'))[_0xaf03('0x1c')](socket);function respondWithStatusCode(_0x550e22,_0x50bbf6){_0x50bbf6=_0x50bbf6||0xcc;return function(_0x38ae35){if(_0x38ae35){return _0x550e22[_0xaf03('0x1d')](_0x50bbf6);}return _0x550e22[_0xaf03('0x1e')](_0x50bbf6)[_0xaf03('0x1f')]();};}function respondWithResult(_0x342f7a,_0x3902d7){_0x3902d7=_0x3902d7||0xc8;return function(_0x533699){if(_0x533699){return _0x342f7a[_0xaf03('0x1e')](_0x3902d7)[_0xaf03('0x20')](_0x533699);}};}function respondWithFilteredResult(_0x12bd6,_0x3620c6){return function(_0x24a074){if(_0x24a074){var _0x27e625=typeof _0x3620c6['offset']==='undefined'&&typeof _0x3620c6[_0xaf03('0x21')]===_0xaf03('0x22');var _0x3f5064=_0x24a074[_0xaf03('0x23')];var _0xfc2e57=_0x27e625?0x0:_0x3620c6['offset'];var _0x43a4a4=_0x27e625?_0x24a074['count']:_0x3620c6[_0xaf03('0x24')]+_0x3620c6[_0xaf03('0x21')];var _0x9e28b4;if(_0x43a4a4>=_0x3f5064){_0x43a4a4=_0x3f5064;_0x9e28b4=0xc8;}else{_0x9e28b4=0xce;}_0x12bd6[_0xaf03('0x1e')](_0x9e28b4);return _0x12bd6[_0xaf03('0x25')](_0xaf03('0x26'),_0xfc2e57+'-'+_0x43a4a4+'/'+_0x3f5064)[_0xaf03('0x20')](_0x24a074);}return null;};}function patchUpdates(_0x1cefca){return function(_0x32370d){try{jsonpatch[_0xaf03('0x27')](_0x32370d,_0x1cefca,!![]);}catch(_0x1e8cac){return BPromise['reject'](_0x1e8cac);}return _0x32370d[_0xaf03('0x28')]();};}function saveUpdates(_0x1ab68b,_0x2bc68d){return function(_0x21b865){if(_0x21b865){return _0x21b865['update'](_0x1ab68b)['then'](function(_0x38aa61){return _0x38aa61;});}return null;};}function removeEntity(_0x382e43,_0x4db61b){return function(_0x245ad7){if(_0x245ad7){return _0x245ad7[_0xaf03('0x29')]()[_0xaf03('0x2a')](function(){_0x382e43[_0xaf03('0x1e')](0xcc)[_0xaf03('0x1f')]();});}};}function handleEntityNotFound(_0x148227,_0x5bb6a7){return function(_0x50ec36){if(!_0x50ec36){_0x148227[_0xaf03('0x1d')](0x194);}return _0x50ec36;};}function handleError(_0x385aa9,_0xe104c2){_0xe104c2=_0xe104c2||0x1f4;return function(_0x166a23){logger[_0xaf03('0x2b')](_0x166a23[_0xaf03('0x2c')]);if(_0x166a23[_0xaf03('0x2d')]){delete _0x166a23[_0xaf03('0x2d')];}_0x385aa9[_0xaf03('0x1e')](_0xe104c2)[_0xaf03('0x2e')](_0x166a23);};}exports[_0xaf03('0x2f')]=function(_0x1d75f5,_0xe05319){var _0x5be2ab={'raw':![],'where':{'id':_0x1d75f5[_0xaf03('0x30')]['id']}},_0x38f1ea={};_0x38f1ea['model']=_[_0xaf03('0x31')](db['DashboardItem'][_0xaf03('0x32')]);_0x38f1ea[_0xaf03('0x33')]=_[_0xaf03('0x31')](_0x1d75f5[_0xaf03('0x33')]);_0x38f1ea[_0xaf03('0x34')]=_[_0xaf03('0x35')](_0x38f1ea['model'],_0x38f1ea[_0xaf03('0x33')]);_0x5be2ab['attributes']=_[_0xaf03('0x35')](_0x38f1ea[_0xaf03('0x36')],qs[_0xaf03('0x37')](_0x1d75f5[_0xaf03('0x33')]['fields']));_0x5be2ab['attributes']=_0x5be2ab['attributes'][_0xaf03('0x38')]?_0x5be2ab[_0xaf03('0x39')]:_0x38f1ea[_0xaf03('0x36')];if(_0x1d75f5[_0xaf03('0x33')]['includeAll']){_0x5be2ab[_0xaf03('0x3a')]=[{'all':!![]}];}_0x5be2ab=_[_0xaf03('0x3b')]({},_0x5be2ab,_0x1d75f5[_0xaf03('0x3c')]);return db[_0xaf03('0x3d')]['find'](_0x5be2ab)[_0xaf03('0x2a')](handleEntityNotFound(_0xe05319,null))['then'](respondWithResult(_0xe05319,null))[_0xaf03('0x3e')](handleError(_0xe05319,null));};exports[_0xaf03('0x29')]=function(_0xd08544,_0x4e29c2){return db[_0xaf03('0x3d')][_0xaf03('0x3f')]({'where':{'id':_0xd08544[_0xaf03('0x30')]['id']}})[_0xaf03('0x2a')](handleEntityNotFound(_0x4e29c2,null))[_0xaf03('0x2a')](removeEntity(_0x4e29c2,null))['catch'](handleError(_0x4e29c2,null));};function widgetAttributes(_0x2a72fd){try{switch(_0x2a72fd[_0xaf03('0x40')]){case _0xaf03('0x41'):return[{'name':_0xaf03('0x42'),'value':_0x2a72fd[_0xaf03('0x42')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd['attrs'][0x0][_0xaf03('0x44')]:undefined)||_0xaf03('0x45')}];case _0xaf03('0x46'):return[{'name':_0xaf03('0x47'),'value':_0x2a72fd['attrPath']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x48'):return[{'name':_0xaf03('0x49'),'value':_0x2a72fd[_0xaf03('0x49')]||(_0x2a72fd['attrs']&&_0x2a72fd['attrs'][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['value']:undefined)||_0xaf03('0x4a')},{'name':_0xaf03('0x4b'),'value':_0x2a72fd[_0xaf03('0x4b')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1][_0xaf03('0x44')]:undefined)||_0xaf03('0x4c')},{'name':_0xaf03('0x4d'),'value':_0x2a72fd[_0xaf03('0x4d')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xaf03('0x4e'),'value':_0x2a72fd[_0xaf03('0x4e')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd['attrs'][0x0][_0xaf03('0x44')]:undefined)||_0xaf03('0x4f')},{'name':_0xaf03('0x50'),'value':_0x2a72fd[_0xaf03('0x50')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1][_0xaf03('0x44')]:undefined)||[]},{'name':_0xaf03('0x4d'),'value':_0x2a72fd[_0xaf03('0x4d')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||0x14},{'name':_0xaf03('0x51'),'value':_0x2a72fd[_0xaf03('0x51')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x3]?_0x2a72fd[_0xaf03('0x43')][0x3]['value']:undefined)||_0xaf03('0x52')},{'name':_0xaf03('0x53'),'value':_0x2a72fd[_0xaf03('0x53')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x4]?_0x2a72fd[_0xaf03('0x43')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2a72fd[_0xaf03('0x54')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x5]?_0x2a72fd['attrs'][0x5][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x55'),'value':_0x2a72fd['attrSmsAccounts']||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x6]?_0x2a72fd[_0xaf03('0x43')][0x6][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x56'),'value':_0x2a72fd[_0xaf03('0x56')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x7]?_0x2a72fd['attrs'][0x7][_0xaf03('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2a72fd['attrWhatsappAccounts']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x8]?_0x2a72fd[_0xaf03('0x43')][0x8][_0xaf03('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2a72fd[_0xaf03('0x57')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x9]?_0x2a72fd[_0xaf03('0x43')][0x9][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x58'):case _0xaf03('0x59'):return[{'name':_0xaf03('0x5a'),'value':_0x2a72fd[_0xaf03('0x5a')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['value']:undefined)||_0xaf03('0x4f')},{'name':'attrSerie2','value':_0x2a72fd['attrSerie2']||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1]['value']:undefined)||null},{'name':_0xaf03('0x5b'),'value':_0x2a72fd[_0xaf03('0x5b')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||null},{'name':_0xaf03('0x50'),'value':_0x2a72fd[_0xaf03('0x50')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x3]?_0x2a72fd[_0xaf03('0x43')][0x3][_0xaf03('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x2a72fd[_0xaf03('0x51')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x4]?_0x2a72fd[_0xaf03('0x43')][0x4]['value']:undefined)||_0xaf03('0x52')},{'name':_0xaf03('0x53'),'value':_0x2a72fd['attrEmailAccounts']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x5]?_0x2a72fd[_0xaf03('0x43')][0x5]['value']:undefined)||''},{'name':_0xaf03('0x54'),'value':_0x2a72fd[_0xaf03('0x54')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x6]?_0x2a72fd[_0xaf03('0x43')][0x6]['value']:undefined)||''},{'name':_0xaf03('0x55'),'value':_0x2a72fd[_0xaf03('0x55')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x7]?_0x2a72fd['attrs'][0x7][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x56'),'value':_0x2a72fd[_0xaf03('0x56')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x8]?_0x2a72fd[_0xaf03('0x43')][0x8]['value']:undefined)||''},{'name':_0xaf03('0x5c'),'value':_0x2a72fd[_0xaf03('0x5c')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x9]?_0x2a72fd['attrs'][0x9][_0xaf03('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2a72fd[_0xaf03('0x57')]||(_0x2a72fd['attrs']&&_0x2a72fd['attrs'][0xa]?_0x2a72fd[_0xaf03('0x43')][0xa][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x5d'):return[{'name':_0xaf03('0x5e'),'type':_0x2a72fd[_0xaf03('0x5f')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['type']:undefined)||null,'value':_0x2a72fd[_0xaf03('0x5e')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x0]?_0x2a72fd['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x2a72fd[_0xaf03('0x60')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd[_0xaf03('0x43')][0x1][_0xaf03('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x49a9fc){logger[_0xaf03('0x2b')]('widgetAttributes:\x20%s',JSON[_0xaf03('0x61')](_0x49a9fc));return[];}}exports[_0xaf03('0x62')]=function(_0x56880c,_0x2b8b39){if(_0x56880c[_0xaf03('0x63')]){_0x56880c[_0xaf03('0x63')]['attrs']=widgetAttributes(_0x56880c[_0xaf03('0x63')]);}return db[_0xaf03('0x3d')]['create'](_0x56880c[_0xaf03('0x63')],{})['then'](respondWithResult(_0x2b8b39,0xc9))[_0xaf03('0x3e')](handleError(_0x2b8b39,null));};exports[_0xaf03('0x64')]=function(_0x13c9b9,_0x199523){if(_0x13c9b9['body']['id']){delete _0x13c9b9['body']['id'];}_0x13c9b9[_0xaf03('0x63')]['attrs']=widgetAttributes(_0x13c9b9[_0xaf03('0x63')]);return db[_0xaf03('0x3d')][_0xaf03('0x3f')]({'where':{'id':_0x13c9b9[_0xaf03('0x30')]['id']}})['then'](handleEntityNotFound(_0x199523,null))['then'](saveUpdates(_0x13c9b9['body'],null))[_0xaf03('0x2a')](respondWithResult(_0x199523,null))[_0xaf03('0x3e')](handleError(_0x199523,null));}; \ No newline at end of file +var _0x9d76=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','show','params','model','DashboardItem','rawAttributes','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9d76,0x76));var _0x69d7=function(_0x366248,_0x263507){_0x366248=_0x366248-0x0;var _0xc39d81=_0x9d76[_0x366248];return _0xc39d81;};'use strict';var emlformat=require(_0x69d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69d7('0x1'));var jsonpatch=require(_0x69d7('0x2'));var rp=require(_0x69d7('0x3'));var moment=require(_0x69d7('0x4'));var BPromise=require(_0x69d7('0x5'));var Mustache=require(_0x69d7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69d7('0x7'));var csv=require(_0x69d7('0x8'));var ejs=require(_0x69d7('0x9'));var fs=require('fs');var fs_extra=require(_0x69d7('0xa'));var _=require('lodash');var squel=require(_0x69d7('0xb'));var crypto=require(_0x69d7('0xc'));var jsforce=require(_0x69d7('0xd'));var deskjs=require(_0x69d7('0xe'));var toCsv=require(_0x69d7('0x8'));var querystring=require(_0x69d7('0xf'));var Papa=require(_0x69d7('0x10'));var Redis=require(_0x69d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69d7('0x12'));var as=require(_0x69d7('0x13'));var hardwareService=require(_0x69d7('0x14'));var logger=require(_0x69d7('0x15'))(_0x69d7('0x16'));var utils=require(_0x69d7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69d7('0x18'))['db'];config[_0x69d7('0x19')]=_['defaults'](config[_0x69d7('0x19')],{'host':_0x69d7('0x1a'),'port':0x18eb});var socket=require(_0x69d7('0x1b'))(new Redis(config[_0x69d7('0x19')]));require(_0x69d7('0x1c'))[_0x69d7('0x1d')](socket);function respondWithStatusCode(_0x5aa44c,_0xa49c1e){_0xa49c1e=_0xa49c1e||0xcc;return function(_0x1269b7){if(_0x1269b7){return _0x5aa44c[_0x69d7('0x1e')](_0xa49c1e);}return _0x5aa44c[_0x69d7('0x1f')](_0xa49c1e)['end']();};}function respondWithResult(_0x545c85,_0x3f2937){_0x3f2937=_0x3f2937||0xc8;return function(_0xb6b940){if(_0xb6b940){return _0x545c85[_0x69d7('0x1f')](_0x3f2937)[_0x69d7('0x20')](_0xb6b940);}};}function respondWithFilteredResult(_0x215715,_0x392b64){return function(_0x1056de){if(_0x1056de){var _0x162c9f=typeof _0x392b64[_0x69d7('0x21')]==='undefined'&&typeof _0x392b64[_0x69d7('0x22')]===_0x69d7('0x23');var _0x1edfd2=_0x1056de['count'];var _0x46d908=_0x162c9f?0x0:_0x392b64[_0x69d7('0x21')];var _0x5832d6=_0x162c9f?_0x1056de['count']:_0x392b64[_0x69d7('0x21')]+_0x392b64[_0x69d7('0x22')];var _0x1c9c1f;if(_0x5832d6>=_0x1edfd2){_0x5832d6=_0x1edfd2;_0x1c9c1f=0xc8;}else{_0x1c9c1f=0xce;}_0x215715[_0x69d7('0x1f')](_0x1c9c1f);return _0x215715['set'](_0x69d7('0x24'),_0x46d908+'-'+_0x5832d6+'/'+_0x1edfd2)[_0x69d7('0x20')](_0x1056de);}return null;};}function patchUpdates(_0x229e8e){return function(_0x14af4b){try{jsonpatch[_0x69d7('0x25')](_0x14af4b,_0x229e8e,!![]);}catch(_0x1218d8){return BPromise[_0x69d7('0x26')](_0x1218d8);}return _0x14af4b[_0x69d7('0x27')]();};}function saveUpdates(_0x393613,_0x4da434){return function(_0x1a7cf9){if(_0x1a7cf9){return _0x1a7cf9[_0x69d7('0x28')](_0x393613)[_0x69d7('0x29')](function(_0x4b8cbe){return _0x4b8cbe;});}return null;};}function removeEntity(_0x2b188c,_0x52435a){return function(_0xee939c){if(_0xee939c){return _0xee939c[_0x69d7('0x2a')]()[_0x69d7('0x29')](function(){_0x2b188c['status'](0xcc)[_0x69d7('0x2b')]();});}};}function handleEntityNotFound(_0x2b44d9,_0x3c261e){return function(_0x182153){if(!_0x182153){_0x2b44d9[_0x69d7('0x1e')](0x194);}return _0x182153;};}function handleError(_0x118c61,_0x2e0f99){_0x2e0f99=_0x2e0f99||0x1f4;return function(_0x285922){logger[_0x69d7('0x2c')](_0x285922[_0x69d7('0x2d')]);if(_0x285922[_0x69d7('0x2e')]){delete _0x285922['name'];}_0x118c61['status'](_0x2e0f99)['send'](_0x285922);};}exports[_0x69d7('0x2f')]=function(_0x5d602e,_0x3d5b7c){var _0x7d86b={'raw':![],'where':{'id':_0x5d602e[_0x69d7('0x30')]['id']}},_0x5d9ae0={};_0x5d9ae0[_0x69d7('0x31')]=_['keys'](db[_0x69d7('0x32')][_0x69d7('0x33')]);_0x5d9ae0['query']=_[_0x69d7('0x34')](_0x5d602e[_0x69d7('0x35')]);_0x5d9ae0[_0x69d7('0x36')]=_[_0x69d7('0x37')](_0x5d9ae0[_0x69d7('0x31')],_0x5d9ae0['query']);_0x7d86b['attributes']=_[_0x69d7('0x37')](_0x5d9ae0[_0x69d7('0x31')],qs[_0x69d7('0x38')](_0x5d602e[_0x69d7('0x35')]['fields']));_0x7d86b['attributes']=_0x7d86b[_0x69d7('0x39')][_0x69d7('0x3a')]?_0x7d86b[_0x69d7('0x39')]:_0x5d9ae0[_0x69d7('0x31')];if(_0x5d602e[_0x69d7('0x35')][_0x69d7('0x3b')]){_0x7d86b['include']=[{'all':!![]}];}_0x7d86b=_[_0x69d7('0x3c')]({},_0x7d86b,_0x5d602e[_0x69d7('0x3d')]);return db[_0x69d7('0x32')][_0x69d7('0x3e')](_0x7d86b)[_0x69d7('0x29')](handleEntityNotFound(_0x3d5b7c,null))[_0x69d7('0x29')](respondWithResult(_0x3d5b7c,null))[_0x69d7('0x3f')](handleError(_0x3d5b7c,null));};exports['destroy']=function(_0x51823e,_0x2d88d1){return db['DashboardItem']['find']({'where':{'id':_0x51823e['params']['id']}})[_0x69d7('0x29')](handleEntityNotFound(_0x2d88d1,null))[_0x69d7('0x29')](removeEntity(_0x2d88d1,null))[_0x69d7('0x3f')](handleError(_0x2d88d1,null));};function widgetAttributes(_0x18d68b){try{switch(_0x18d68b[_0x69d7('0x40')]){case _0x69d7('0x41'):return[{'name':_0x69d7('0x42'),'value':_0x18d68b[_0x69d7('0x42')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||'https://'}];case _0x69d7('0x45'):return[{'name':_0x69d7('0x46'),'value':_0x18d68b[_0x69d7('0x46')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||''}];case'clock':return[{'name':_0x69d7('0x47'),'value':_0x18d68b[_0x69d7('0x47')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x69d7('0x48'),'value':_0x18d68b['attrTimezone']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1][_0x69d7('0x44')]:undefined)||_0x69d7('0x49')},{'name':_0x69d7('0x4a'),'value':_0x18d68b[_0x69d7('0x4a')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x2]?_0x18d68b['attrs'][0x2][_0x69d7('0x44')]:undefined)||0xc}];case _0x69d7('0x4b'):return[{'name':_0x69d7('0x4c'),'value':_0x18d68b[_0x69d7('0x4c')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x0]?_0x18d68b['attrs'][0x0]['value']:undefined)||_0x69d7('0x4d')},{'name':'attrVoiceQueues','value':_0x18d68b[_0x69d7('0x4e')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1][_0x69d7('0x44')]:undefined)||[]},{'name':_0x69d7('0x4a'),'value':_0x18d68b['attrFontSize']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x2]?_0x18d68b[_0x69d7('0x43')][0x2][_0x69d7('0x44')]:undefined)||0x14},{'name':_0x69d7('0x4f'),'value':_0x18d68b[_0x69d7('0x4f')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x3]?_0x18d68b[_0x69d7('0x43')][0x3][_0x69d7('0x44')]:undefined)||'voice'},{'name':_0x69d7('0x50'),'value':_0x18d68b[_0x69d7('0x50')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x4]?_0x18d68b[_0x69d7('0x43')][0x4][_0x69d7('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x18d68b[_0x69d7('0x51')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x5]?_0x18d68b[_0x69d7('0x43')][0x5]['value']:undefined)||''},{'name':_0x69d7('0x52'),'value':_0x18d68b[_0x69d7('0x52')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x6]?_0x18d68b[_0x69d7('0x43')][0x6][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x53'),'value':_0x18d68b['attrOpenchannelAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x7]?_0x18d68b[_0x69d7('0x43')][0x7][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x54'),'value':_0x18d68b['attrWhatsappAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x8]?_0x18d68b[_0x69d7('0x43')][0x8][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x55'),'value':_0x18d68b[_0x69d7('0x55')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x9]?_0x18d68b[_0x69d7('0x43')][0x9][_0x69d7('0x44')]:undefined)||''}];case _0x69d7('0x56'):case _0x69d7('0x57'):return[{'name':_0x69d7('0x58'),'value':_0x18d68b[_0x69d7('0x58')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||_0x69d7('0x4d')},{'name':_0x69d7('0x59'),'value':_0x18d68b[_0x69d7('0x59')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b['attrs'][0x1][_0x69d7('0x44')]:undefined)||null},{'name':_0x69d7('0x5a'),'value':_0x18d68b[_0x69d7('0x5a')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x2]?_0x18d68b[_0x69d7('0x43')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x18d68b['attrVoiceQueues']||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x3]?_0x18d68b[_0x69d7('0x43')][0x3][_0x69d7('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x18d68b[_0x69d7('0x4f')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x4]?_0x18d68b[_0x69d7('0x43')][0x4]['value']:undefined)||_0x69d7('0x5b')},{'name':'attrEmailAccounts','value':_0x18d68b[_0x69d7('0x50')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x5]?_0x18d68b[_0x69d7('0x43')][0x5][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x51'),'value':_0x18d68b['attrFaxAccounts']||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x6]?_0x18d68b[_0x69d7('0x43')][0x6][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x52'),'value':_0x18d68b['attrSmsAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x7]?_0x18d68b[_0x69d7('0x43')][0x7]['value']:undefined)||''},{'name':_0x69d7('0x53'),'value':_0x18d68b[_0x69d7('0x53')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x8]?_0x18d68b['attrs'][0x8][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x54'),'value':_0x18d68b['attrWhatsappAccounts']||(_0x18d68b['attrs']&&_0x18d68b['attrs'][0x9]?_0x18d68b[_0x69d7('0x43')][0x9][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x55'),'value':_0x18d68b[_0x69d7('0x55')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0xa]?_0x18d68b[_0x69d7('0x43')][0xa][_0x69d7('0x44')]:undefined)||''}];case _0x69d7('0x5c'):return[{'name':_0x69d7('0x5d'),'type':_0x18d68b[_0x69d7('0x5e')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b['attrs'][0x0][_0x69d7('0x40')]:undefined)||null,'value':_0x18d68b[_0x69d7('0x5d')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x18d68b[_0x69d7('0x5f')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x364f94){logger[_0x69d7('0x2c')](_0x69d7('0x60'),JSON[_0x69d7('0x61')](_0x364f94));return[];}}exports['create']=function(_0x1d33ab,_0x5bacf5){if(_0x1d33ab[_0x69d7('0x62')]){_0x1d33ab[_0x69d7('0x62')][_0x69d7('0x43')]=widgetAttributes(_0x1d33ab[_0x69d7('0x62')]);}return db[_0x69d7('0x32')][_0x69d7('0x63')](_0x1d33ab[_0x69d7('0x62')],{})[_0x69d7('0x29')](respondWithResult(_0x5bacf5,0xc9))['catch'](handleError(_0x5bacf5,null));};exports[_0x69d7('0x28')]=function(_0x301f29,_0x219421){if(_0x301f29[_0x69d7('0x62')]['id']){delete _0x301f29[_0x69d7('0x62')]['id'];}_0x301f29[_0x69d7('0x62')][_0x69d7('0x43')]=widgetAttributes(_0x301f29['body']);return db[_0x69d7('0x32')][_0x69d7('0x3e')]({'where':{'id':_0x301f29['params']['id']}})['then'](handleEntityNotFound(_0x219421,null))[_0x69d7('0x29')](saveUpdates(_0x301f29[_0x69d7('0x62')],null))['then'](respondWithResult(_0x219421,null))['catch'](handleError(_0x219421,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0bd8869..95d9900 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 _0x8b06=['DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b06,0xb2));var _0x68b0=function(_0x15fe00,_0x128d18){_0x15fe00=_0x15fe00-0x0;var _0x3043dc=_0x8b06[_0x15fe00];return _0x3043dc;};'use strict';var EventEmitter=require(_0x68b0('0x0'));var DashboardItem=require(_0x68b0('0x1'))['db'][_0x68b0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x68b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x68b0('0x4'),'afterDestroy':_0x68b0('0x5')};function emitEvent(_0x11af49){return function(_0x20b28e,_0x2926f7,_0x5ca64f){DashboardItemEvents[_0x68b0('0x6')](_0x11af49+':'+_0x20b28e['id'],_0x20b28e);DashboardItemEvents['emit'](_0x11af49,_0x20b28e);_0x5ca64f(null);};}for(var e in events){if(events[_0x68b0('0x7')](e)){var event=events[e];DashboardItem[_0x68b0('0x8')](e,emitEvent(event));}}module[_0x68b0('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xaaee=['save','update','remove','emit','hook','exports','events','setMaxListeners'];(function(_0x1e90f9,_0xae6d06){var _0xc272e1=function(_0x1d253d){while(--_0x1d253d){_0x1e90f9['push'](_0x1e90f9['shift']());}};_0xc272e1(++_0xae6d06);}(_0xaaee,0x1be));var _0xeaae=function(_0x10f474,_0x5c3ff0){_0x10f474=_0x10f474-0x0;var _0x1d38c5=_0xaaee[_0x10f474];return _0x1d38c5;};'use strict';var EventEmitter=require(_0xeaae('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xeaae('0x1')](0x0);var events={'afterCreate':_0xeaae('0x2'),'afterUpdate':_0xeaae('0x3'),'afterDestroy':_0xeaae('0x4')};function emitEvent(_0x40ac77){return function(_0x5a9956,_0x27af19,_0x208458){DashboardItemEvents[_0xeaae('0x5')](_0x40ac77+':'+_0x5a9956['id'],_0x5a9956);DashboardItemEvents['emit'](_0x40ac77,_0x5a9956);_0x208458(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xeaae('0x6')](e,emitEvent(event));}}module[_0xeaae('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a039a6a..aed38b9 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 _0xf5a7=['rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','path'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xf5a7,0xba));var _0x7f5a=function(_0x4640a9,_0x130a84){_0x4640a9=_0x4640a9-0x0;var _0x13736b=_0xf5a7[_0x4640a9];return _0x13736b;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var logger=require('../../config/logger')(_0x7f5a('0x2'));var moment=require(_0x7f5a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f5a('0x4'));var fs=require('fs');var path=require(_0x7f5a('0x5'));var rimraf=require(_0x7f5a('0x6'));var config=require(_0x7f5a('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x7f5a('0x8')]=function(_0x194472,_0x3e0463){return _0x194472[_0x7f5a('0x9')](_0x7f5a('0xa'),attributes,{'tableName':_0x7f5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1502=['bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0x1b99eb,_0x3904e9){var _0x273e88=function(_0x36ab0d){while(--_0x36ab0d){_0x1b99eb['push'](_0x1b99eb['shift']());}};_0x273e88(++_0x3904e9);}(_0x1502,0x1c3));var _0x2150=function(_0x1b5032,_0x2a7e0e){_0x1b5032=_0x1b5032-0x0;var _0x3cb991=_0x1502[_0x1b5032];return _0x3cb991;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));module['exports']=function(_0x2e34e9,_0x38dbdf){return _0x2e34e9['define'](_0x2150('0xa'),attributes,{'tableName':_0x2150('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0e613bb..c70938b 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 _0x3932=['redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x4f081c,_0x14893d){var _0x557963=function(_0x238c22){while(--_0x238c22){_0x4f081c['push'](_0x4f081c['shift']());}};_0x557963(++_0x14893d);}(_0x3932,0x13b));var _0x2393=function(_0x1c501a,_0x164378){_0x1c501a=_0x1c501a-0x0;var _0x38b65f=_0x3932[_0x1c501a];return _0x38b65f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2393('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2393('0x1'));var db=require(_0x2393('0x2'))['db'];var utils=require(_0x2393('0x3'));var logger=require('../../config/logger')(_0x2393('0x4'));var config=require('../../config/environment');var jayson=require(_0x2393('0x5'));var client=jayson['client'][_0x2393('0x6')]({'port':0x232a});config[_0x2393('0x7')]=_['defaults'](config[_0x2393('0x7')],{'host':_0x2393('0x8'),'port':0x18eb});var socket=require(_0x2393('0x9'))(new Redis(config[_0x2393('0x7')]));require(_0x2393('0xa'))[_0x2393('0xb')](socket);function respondWithRpcPromise(_0x145155,_0x130a8c,_0x5782a5){return new BPromise(function(_0x6b04c2,_0x2586b2){return client[_0x2393('0xc')](_0x145155,_0x5782a5)[_0x2393('0xd')](function(_0x18b5a2){logger['info'](_0x2393('0xe'),_0x130a8c,_0x2393('0xf'));logger[_0x2393('0x10')](_0x2393('0x11'),_0x130a8c,_0x2393('0xf'),JSON[_0x2393('0x12')](_0x18b5a2));if(_0x18b5a2[_0x2393('0x13')]){if(_0x18b5a2[_0x2393('0x13')][_0x2393('0x14')]===0x1f4){logger[_0x2393('0x13')](_0x2393('0xe'),_0x130a8c,_0x18b5a2['error'][_0x2393('0x15')]);return _0x2586b2(_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);}logger[_0x2393('0x13')]('DashboardItem,\x20%s,\x20%s',_0x130a8c,_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);return _0x6b04c2(_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);}else{logger['info'](_0x2393('0xe'),_0x130a8c,_0x2393('0xf'));_0x6b04c2(_0x18b5a2[_0x2393('0x16')][_0x2393('0x15')]);}})['catch'](function(_0x47ff79){logger[_0x2393('0x13')]('DashboardItem,\x20%s,\x20%s',_0x130a8c,_0x47ff79);_0x2586b2(_0x47ff79);});});} \ No newline at end of file +var _0x66ae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','catch'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x66ae,0x91));var _0xe66a=function(_0x1fea66,_0x621fdb){_0x1fea66=_0x1fea66-0x0;var _0x112af3=_0x66ae[_0x1fea66];return _0x112af3;};'use strict';var _=require(_0xe66a('0x0'));var util=require('util');var moment=require(_0xe66a('0x1'));var BPromise=require(_0xe66a('0x2'));var rs=require(_0xe66a('0x3'));var fs=require('fs');var Redis=require(_0xe66a('0x4'));var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')][_0xe66a('0xc')]({'port':0x232a});config['redis']=_[_0xe66a('0xd')](config['redis'],{'host':_0xe66a('0xe'),'port':0x18eb});var socket=require(_0xe66a('0xf'))(new Redis(config['redis']));require(_0xe66a('0x10'))[_0xe66a('0x11')](socket);function respondWithRpcPromise(_0x3383b3,_0x1a373b,_0x3dbca7){return new BPromise(function(_0x38d33d,_0x459e95){return client[_0xe66a('0x12')](_0x3383b3,_0x3dbca7)['then'](function(_0x2bee53){logger['info']('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'));logger[_0xe66a('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'),JSON[_0xe66a('0x15')](_0x2bee53));if(_0x2bee53[_0xe66a('0x16')]){if(_0x2bee53[_0xe66a('0x16')][_0xe66a('0x17')]===0x1f4){logger[_0xe66a('0x16')](_0xe66a('0x18'),_0x1a373b,_0x2bee53['error'][_0xe66a('0x19')]);return _0x459e95(_0x2bee53['error'][_0xe66a('0x19')]);}logger[_0xe66a('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0x2bee53['error'][_0xe66a('0x19')]);return _0x38d33d(_0x2bee53[_0xe66a('0x16')][_0xe66a('0x19')]);}else{logger[_0xe66a('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'));_0x38d33d(_0x2bee53[_0xe66a('0x1b')][_0xe66a('0x19')]);}})[_0xe66a('0x1c')](function(_0x183fd8){logger['error'](_0xe66a('0x18'),_0x1a373b,_0x183fd8);_0x459e95(_0x183fd8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index bcbc516..6e95f98 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 _0x4ea9=['dashboardItem:','./dashboardItem.events','update','emit','removeListener','register','length'];(function(_0x18e333,_0x1caf42){var _0x41c26e=function(_0x3e3606){while(--_0x3e3606){_0x18e333['push'](_0x18e333['shift']());}};_0x41c26e(++_0x1caf42);}(_0x4ea9,0x190));var _0x94ea=function(_0xc6afb3,_0x458ba5){_0xc6afb3=_0xc6afb3-0x0;var _0x25fb64=_0x4ea9[_0xc6afb3];return _0x25fb64;};'use strict';var DashboardItemEvents=require(_0x94ea('0x0'));var events=['save','remove',_0x94ea('0x1')];function createListener(_0x3a50b5,_0x4e535b){return function(_0x4b641c){_0x4e535b[_0x94ea('0x2')](_0x3a50b5,_0x4b641c);};}function removeListener(_0x3ab7ee,_0x5bbe5d){return function(){DashboardItemEvents[_0x94ea('0x3')](_0x3ab7ee,_0x5bbe5d);};}exports[_0x94ea('0x4')]=function(_0x5cf69a){for(var _0x3d2494=0x0,_0x2fd38d=events[_0x94ea('0x5')];_0x3d2494<_0x2fd38d;_0x3d2494++){var _0x3c022d=events[_0x3d2494];var _0x14c947=createListener(_0x94ea('0x6')+_0x3c022d,_0x5cf69a);DashboardItemEvents['on'](_0x3c022d,_0x14c947);}}; \ No newline at end of file +var _0xe5d7=['dashboardItem:','./dashboardItem.events','remove','update','register'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe5d7,0x7e));var _0x7e5d=function(_0x7a6f6f,_0x201cb9){_0x7a6f6f=_0x7a6f6f-0x0;var _0x404b3e=_0xe5d7[_0x7a6f6f];return _0x404b3e;};'use strict';var DashboardItemEvents=require(_0x7e5d('0x0'));var events=['save',_0x7e5d('0x1'),_0x7e5d('0x2')];function createListener(_0x2b43cb,_0x50a057){return function(_0x49c8bc){_0x50a057['emit'](_0x2b43cb,_0x49c8bc);};}function removeListener(_0x29fce9,_0x2d1a96){return function(){DashboardItemEvents['removeListener'](_0x29fce9,_0x2d1a96);};}exports[_0x7e5d('0x3')]=function(_0x53646e){for(var _0x3feeb7=0x0,_0x265189=events['length'];_0x3feeb7<_0x265189;_0x3feeb7++){var _0x39068b=events[_0x3feeb7];var _0x4cd133=createListener(_0x7e5d('0x4')+_0x39068b,_0x53646e);DashboardItemEvents['on'](_0x39068b,_0x4cd133);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4c36e33..9fc0464 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 _0xb3ab=['update','destroy','multer','path','connect-timeout','express','Router','fs-extra','./dashboardItem.controller','get','/:id','isAuthenticated','post','put'];(function(_0x59b419,_0x2b03d9){var _0x3b7aae=function(_0x1fe574){while(--_0x1fe574){_0x59b419['push'](_0x59b419['shift']());}};_0x3b7aae(++_0x2b03d9);}(_0xb3ab,0x11a));var _0xbb3a=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xb3ab[_0x1ebeea];return _0x576465;};'use strict';var multer=require(_0xbb3a('0x0'));var util=require('util');var path=require(_0xbb3a('0x1'));var timeout=require(_0xbb3a('0x2'));var express=require(_0xbb3a('0x3'));var router=express[_0xbb3a('0x4')]();var fs_extra=require(_0xbb3a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb3a('0x6'));router[_0xbb3a('0x7')](_0xbb3a('0x8'),auth[_0xbb3a('0x9')](),controller['show']);router[_0xbb3a('0xa')]('/',auth[_0xbb3a('0x9')](),controller['create']);router[_0xbb3a('0xb')](_0xbb3a('0x8'),auth[_0xbb3a('0x9')](),controller[_0xbb3a('0xc')]);router['delete']('/:id',auth[_0xbb3a('0x9')](),controller[_0xbb3a('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe419=['update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create','put','/:id'];(function(_0x35470d,_0x17c425){var _0x1b243a=function(_0x5a786c){while(--_0x5a786c){_0x35470d['push'](_0x35470d['shift']());}};_0x1b243a(++_0x17c425);}(_0xe419,0x69));var _0x9e41=function(_0x2de593,_0x56ff10){_0x2de593=_0x2de593-0x0;var _0x2b5492=_0xe419[_0x2de593];return _0x2b5492;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e41('0x0'));var timeout=require(_0x9e41('0x1'));var express=require(_0x9e41('0x2'));var router=express[_0x9e41('0x3')]();var fs_extra=require(_0x9e41('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e41('0x5'));var config=require(_0x9e41('0x6'));var controller=require(_0x9e41('0x7'));router['get']('/:id',auth[_0x9e41('0x8')](),controller[_0x9e41('0x9')]);router[_0x9e41('0xa')]('/',auth[_0x9e41('0x8')](),controller[_0x9e41('0xb')]);router[_0x9e41('0xc')](_0x9e41('0xd'),auth['isAuthenticated'](),controller[_0x9e41('0xe')]);router['delete']('/:id',auth[_0x9e41('0x8')](),controller[_0x9e41('0xf')]);module[_0x9e41('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6c4dcf3..eed7b26 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 _0x1057=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x392b0e,_0x4ad359){var _0x147ea3=function(_0x225250){while(--_0x225250){_0x392b0e['push'](_0x392b0e['shift']());}};_0x147ea3(++_0x4ad359);}(_0x1057,0x193));var _0x7105=function(_0x1332d5,_0x3da1df){_0x1332d5=_0x1332d5-0x0;var _0x34b1cd=_0x1057[_0x1332d5];return _0x34b1cd;};'use strict';var Sequelize=require(_0x7105('0x0'));module[_0x7105('0x1')]={'name':{'type':Sequelize[_0x7105('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7105('0x3')](_0x7105('0x4'),_0x7105('0x5'),_0x7105('0x6')),'allowNull':![],'defaultValue':_0x7105('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x57ed=['ENUM','first','second','STRING','sequelize','exports'];(function(_0x384dfd,_0x54bc76){var _0x5e232c=function(_0x218405){while(--_0x218405){_0x384dfd['push'](_0x384dfd['shift']());}};_0x5e232c(++_0x54bc76);}(_0x57ed,0xfa));var _0xd57e=function(_0x59de83,_0x6fa077){_0x59de83=_0x59de83-0x0;var _0x2bbf39=_0x57ed[_0x59de83];return _0x2bbf39;};'use strict';var Sequelize=require(_0xd57e('0x0'));module[_0xd57e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd57e('0x2')](_0xd57e('0x3'),_0xd57e('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xd57e('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e61034e..55584e0 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 _0xe958=['apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','error','name','send','index','Disposition','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xe958,0x191));var _0x8e95=function(_0x3b77fb,_0x2e2b07){_0x3b77fb=_0x3b77fb-0x0;var _0x4f4b14=_0xe958[_0x3b77fb];return _0x4f4b14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e95('0x0'));var zipdir=require(_0x8e95('0x1'));var jsonpatch=require(_0x8e95('0x2'));var rp=require(_0x8e95('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e95('0x4'));var util=require('util');var path=require(_0x8e95('0x5'));var sox=require(_0x8e95('0x6'));var csv=require(_0x8e95('0x7'));var ejs=require(_0x8e95('0x8'));var fs=require('fs');var fs_extra=require(_0x8e95('0x9'));var _=require(_0x8e95('0xa'));var squel=require(_0x8e95('0xb'));var crypto=require(_0x8e95('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e95('0xd'));var toCsv=require(_0x8e95('0x7'));var querystring=require(_0x8e95('0xe'));var Papa=require(_0x8e95('0xf'));var Redis=require(_0x8e95('0x10'));var authService=require(_0x8e95('0x11'));var qs=require(_0x8e95('0x12'));var as=require(_0x8e95('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e95('0x14'))(_0x8e95('0x15'));var utils=require(_0x8e95('0x16'));var config=require(_0x8e95('0x17'));var licenseUtil=require(_0x8e95('0x18'));var db=require(_0x8e95('0x19'))['db'];function respondWithStatusCode(_0x1834dc,_0x3f6f56){_0x3f6f56=_0x3f6f56||0xcc;return function(_0xba3b09){if(_0xba3b09){return _0x1834dc['sendStatus'](_0x3f6f56);}return _0x1834dc[_0x8e95('0x1a')](_0x3f6f56)[_0x8e95('0x1b')]();};}function respondWithResult(_0x1d60b6,_0x2a373d){_0x2a373d=_0x2a373d||0xc8;return function(_0x2e65e7){if(_0x2e65e7){return _0x1d60b6[_0x8e95('0x1a')](_0x2a373d)['json'](_0x2e65e7);}};}function respondWithFilteredResult(_0x8fd58e,_0x1dc931){return function(_0x326530){if(_0x326530){var _0x1e9883=typeof _0x1dc931[_0x8e95('0x1c')]===_0x8e95('0x1d')&&typeof _0x1dc931['limit']==='undefined';var _0x58ea7e=_0x326530[_0x8e95('0x1e')];var _0x126cc1=_0x1e9883?0x0:_0x1dc931['offset'];var _0x2b486c=_0x1e9883?_0x326530[_0x8e95('0x1e')]:_0x1dc931['offset']+_0x1dc931['limit'];var _0x1fb250;if(_0x2b486c>=_0x58ea7e){_0x2b486c=_0x58ea7e;_0x1fb250=0xc8;}else{_0x1fb250=0xce;}_0x8fd58e['status'](_0x1fb250);return _0x8fd58e[_0x8e95('0x1f')](_0x8e95('0x20'),_0x126cc1+'-'+_0x2b486c+'/'+_0x58ea7e)[_0x8e95('0x21')](_0x326530);}return null;};}function patchUpdates(_0x1be100){return function(_0x566f41){try{jsonpatch[_0x8e95('0x22')](_0x566f41,_0x1be100,!![]);}catch(_0x575b57){return BPromise[_0x8e95('0x23')](_0x575b57);}return _0x566f41[_0x8e95('0x24')]();};}function saveUpdates(_0x1d2bdb,_0x3834b6){return function(_0x5a3f93){if(_0x5a3f93){return _0x5a3f93[_0x8e95('0x25')](_0x1d2bdb)[_0x8e95('0x26')](function(_0x11b6da){return _0x11b6da;});}return null;};}function removeEntity(_0x239b6b,_0x2053af){return function(_0x3001c9){if(_0x3001c9){return _0x3001c9[_0x8e95('0x27')]()['then'](function(){var _0x1b9613=_0x3001c9['get']({'plain':!![]});var _0x5beaf4=_0x8e95('0x28');return db[_0x8e95('0x29')][_0x8e95('0x27')]({'where':{'type':_0x5beaf4,'resourceId':_0x1b9613['id']}})[_0x8e95('0x26')](function(){return _0x3001c9;});})[_0x8e95('0x26')](function(){_0x239b6b[_0x8e95('0x1a')](0xcc)[_0x8e95('0x1b')]();});}};}function handleEntityNotFound(_0x27b2fc,_0x32a544){return function(_0x3b24d4){if(!_0x3b24d4){_0x27b2fc[_0x8e95('0x2a')](0x194);}return _0x3b24d4;};}function handleError(_0x372edf,_0x7a155e){_0x7a155e=_0x7a155e||0x1f4;return function(_0x45dc6b){logger[_0x8e95('0x2b')](_0x45dc6b['stack']);if(_0x45dc6b[_0x8e95('0x2c')]){delete _0x45dc6b[_0x8e95('0x2c')];}_0x372edf[_0x8e95('0x1a')](_0x7a155e)[_0x8e95('0x2d')](_0x45dc6b);};}exports[_0x8e95('0x2e')]=function(_0x100c6e,_0x162423){var _0x10c9c8={},_0x19a79e={},_0x23fdd1={'count':0x0,'rows':[]};var _0x3eeb53=_['map'](db[_0x8e95('0x2f')]['rawAttributes'],function(_0xcb96eb){return{'name':_0xcb96eb[_0x8e95('0x30')],'type':_0xcb96eb['type']['key']};});_0x19a79e[_0x8e95('0x31')]=_[_0x8e95('0x32')](_0x3eeb53,_0x8e95('0x2c'));_0x19a79e[_0x8e95('0x33')]=_[_0x8e95('0x34')](_0x100c6e[_0x8e95('0x33')]);_0x19a79e['filters']=_[_0x8e95('0x35')](_0x19a79e[_0x8e95('0x31')],_0x19a79e[_0x8e95('0x33')]);_0x10c9c8[_0x8e95('0x36')]=_[_0x8e95('0x35')](_0x19a79e[_0x8e95('0x31')],qs[_0x8e95('0x37')](_0x100c6e[_0x8e95('0x33')]['fields']));_0x10c9c8[_0x8e95('0x36')]=_0x10c9c8[_0x8e95('0x36')][_0x8e95('0x38')]?_0x10c9c8[_0x8e95('0x36')]:_0x19a79e['model'];if(!_0x100c6e[_0x8e95('0x33')][_0x8e95('0x39')](_0x8e95('0x3a'))){_0x10c9c8['limit']=qs['limit'](_0x100c6e[_0x8e95('0x33')][_0x8e95('0x3b')]);_0x10c9c8['offset']=qs['offset'](_0x100c6e[_0x8e95('0x33')]['offset']);}_0x10c9c8[_0x8e95('0x3c')]=qs[_0x8e95('0x3d')](_0x100c6e['query'][_0x8e95('0x3d')]);_0x10c9c8[_0x8e95('0x3e')]=qs[_0x8e95('0x3f')](_['pick'](_0x100c6e[_0x8e95('0x33')],_0x19a79e['filters']),_0x3eeb53);if(_0x100c6e[_0x8e95('0x33')]['filter']){_0x10c9c8['where']=_['merge'](_0x10c9c8[_0x8e95('0x3e')],{'$or':_['map'](_0x3eeb53,function(_0x534987){if(_0x534987[_0x8e95('0x40')]!==_0x8e95('0x41')){var _0x49e0f3={};_0x49e0f3[_0x534987['name']]={'$like':'%'+_0x100c6e[_0x8e95('0x33')][_0x8e95('0x42')]+'%'};return _0x49e0f3;}})});}_0x10c9c8=_[_0x8e95('0x43')]({},_0x10c9c8,_0x100c6e[_0x8e95('0x44')]);var _0x9f70b9={'where':_0x10c9c8[_0x8e95('0x3e')]};return db[_0x8e95('0x2f')][_0x8e95('0x1e')](_0x9f70b9)[_0x8e95('0x26')](function(_0x42871a){_0x23fdd1['count']=_0x42871a;if(_0x100c6e[_0x8e95('0x33')][_0x8e95('0x45')]){_0x10c9c8[_0x8e95('0x46')]=[{'all':!![]}];}return db[_0x8e95('0x2f')][_0x8e95('0x47')](_0x10c9c8);})[_0x8e95('0x26')](function(_0x33d523){_0x23fdd1[_0x8e95('0x48')]=_0x33d523;return _0x23fdd1;})[_0x8e95('0x26')](respondWithFilteredResult(_0x162423,_0x10c9c8))['catch'](handleError(_0x162423,null));};exports['show']=function(_0x1cae35,_0x318a8a){var _0x1bce4a={'raw':!![],'where':{'id':_0x1cae35[_0x8e95('0x49')]['id']}},_0xbbd3e3={};_0xbbd3e3[_0x8e95('0x31')]=_[_0x8e95('0x34')](db[_0x8e95('0x2f')][_0x8e95('0x4a')]);_0xbbd3e3[_0x8e95('0x33')]=_[_0x8e95('0x34')](_0x1cae35[_0x8e95('0x33')]);_0xbbd3e3[_0x8e95('0x3f')]=_[_0x8e95('0x35')](_0xbbd3e3[_0x8e95('0x31')],_0xbbd3e3[_0x8e95('0x33')]);_0x1bce4a[_0x8e95('0x36')]=_[_0x8e95('0x35')](_0xbbd3e3[_0x8e95('0x31')],qs[_0x8e95('0x37')](_0x1cae35[_0x8e95('0x33')][_0x8e95('0x37')]));_0x1bce4a['attributes']=_0x1bce4a[_0x8e95('0x36')][_0x8e95('0x38')]?_0x1bce4a[_0x8e95('0x36')]:_0xbbd3e3[_0x8e95('0x31')];if(_0x1cae35[_0x8e95('0x33')][_0x8e95('0x45')]){_0x1bce4a[_0x8e95('0x46')]=[{'all':!![]}];}_0x1bce4a=_[_0x8e95('0x43')]({},_0x1bce4a,_0x1cae35['options']);return db[_0x8e95('0x2f')]['find'](_0x1bce4a)[_0x8e95('0x26')](handleEntityNotFound(_0x318a8a,null))[_0x8e95('0x26')](respondWithResult(_0x318a8a,null))[_0x8e95('0x4b')](handleError(_0x318a8a,null));};exports[_0x8e95('0x4c')]=function(_0xf41b5f,_0x2d8e72){return db[_0x8e95('0x2f')][_0x8e95('0x4c')](_0xf41b5f[_0x8e95('0x4d')],{})[_0x8e95('0x26')](function(_0x42110e){var _0x437045=_0xf41b5f[_0x8e95('0x4e')][_0x8e95('0x4f')]({'plain':!![]});if(!_0x437045)throw new Error(_0x8e95('0x50'));if(_0x437045[_0x8e95('0x51')]===_0x8e95('0x4e')){var _0x383c1f=_0x42110e[_0x8e95('0x4f')]({'plain':!![]});var _0x14b118=_0x8e95('0x28');return db[_0x8e95('0x52')][_0x8e95('0x53')]({'where':{'name':_0x14b118,'userProfileId':_0x437045[_0x8e95('0x54')]},'raw':!![]})[_0x8e95('0x26')](function(_0x1f83e){if(_0x1f83e&&_0x1f83e[_0x8e95('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x383c1f['name'],'resourceId':_0x383c1f['id'],'type':_0x1f83e[_0x8e95('0x2c')],'sectionId':_0x1f83e['id']},{})[_0x8e95('0x26')](function(){return _0x42110e;});}else{return _0x42110e;}})[_0x8e95('0x4b')](function(_0x21d4f9){logger['error'](_0x8e95('0x56'),_0x21d4f9);throw _0x21d4f9;});}return _0x42110e;})[_0x8e95('0x26')](respondWithResult(_0x2d8e72,0xc9))['catch'](handleError(_0x2d8e72,null));};exports['update']=function(_0x5317db,_0x1c11dd){if(_0x5317db['body']['id']){delete _0x5317db[_0x8e95('0x4d')]['id'];}return db[_0x8e95('0x2f')]['find']({'where':{'id':_0x5317db[_0x8e95('0x49')]['id']}})[_0x8e95('0x26')](handleEntityNotFound(_0x1c11dd,null))[_0x8e95('0x26')](saveUpdates(_0x5317db[_0x8e95('0x4d')],null))['then'](respondWithResult(_0x1c11dd,null))['catch'](handleError(_0x1c11dd,null));};exports[_0x8e95('0x27')]=function(_0x5f3eaf,_0x4db44a){return db['Disposition'][_0x8e95('0x53')]({'where':{'id':_0x5f3eaf['params']['id']}})[_0x8e95('0x26')](handleEntityNotFound(_0x4db44a,null))[_0x8e95('0x26')](removeEntity(_0x4db44a,null))['catch'](handleError(_0x4db44a,null));}; \ No newline at end of file +var _0x975a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','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','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x5bda2b,_0xe30db7){var _0x18e8dc=function(_0x51d82d){while(--_0x51d82d){_0x5bda2b['push'](_0x5bda2b['shift']());}};_0x18e8dc(++_0xe30db7);}(_0x975a,0x142));var _0xa975=function(_0xb46401,_0xfa6588){_0xb46401=_0xb46401-0x0;var _0x2d40be=_0x975a[_0xb46401];return _0x2d40be;};'use strict';var emlformat=require(_0xa975('0x0'));var rimraf=require(_0xa975('0x1'));var zipdir=require(_0xa975('0x2'));var jsonpatch=require(_0xa975('0x3'));var rp=require('request-promise');var moment=require(_0xa975('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa975('0x5'));var util=require('util');var path=require(_0xa975('0x6'));var sox=require(_0xa975('0x7'));var csv=require(_0xa975('0x8'));var ejs=require(_0xa975('0x9'));var fs=require('fs');var fs_extra=require(_0xa975('0xa'));var _=require(_0xa975('0xb'));var squel=require(_0xa975('0xc'));var crypto=require(_0xa975('0xd'));var jsforce=require(_0xa975('0xe'));var deskjs=require(_0xa975('0xf'));var toCsv=require(_0xa975('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa975('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa975('0x11'));var as=require(_0xa975('0x12'));var hardwareService=require(_0xa975('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa975('0x14'));var config=require(_0xa975('0x15'));var licenseUtil=require(_0xa975('0x16'));var db=require(_0xa975('0x17'))['db'];function respondWithStatusCode(_0x4f9626,_0x19b451){_0x19b451=_0x19b451||0xcc;return function(_0x3ed765){if(_0x3ed765){return _0x4f9626['sendStatus'](_0x19b451);}return _0x4f9626['status'](_0x19b451)[_0xa975('0x18')]();};}function respondWithResult(_0x427102,_0xb7d0b3){_0xb7d0b3=_0xb7d0b3||0xc8;return function(_0x4f0c75){if(_0x4f0c75){return _0x427102[_0xa975('0x19')](_0xb7d0b3)['json'](_0x4f0c75);}};}function respondWithFilteredResult(_0x4f9b61,_0x3e0972){return function(_0x34cd3b){if(_0x34cd3b){var _0xdd0415=typeof _0x3e0972[_0xa975('0x1a')]===_0xa975('0x1b')&&typeof _0x3e0972['limit']===_0xa975('0x1b');var _0x3fd5bd=_0x34cd3b[_0xa975('0x1c')];var _0x43d3b5=_0xdd0415?0x0:_0x3e0972[_0xa975('0x1a')];var _0xc5a6f3=_0xdd0415?_0x34cd3b[_0xa975('0x1c')]:_0x3e0972[_0xa975('0x1a')]+_0x3e0972['limit'];var _0x14550a;if(_0xc5a6f3>=_0x3fd5bd){_0xc5a6f3=_0x3fd5bd;_0x14550a=0xc8;}else{_0x14550a=0xce;}_0x4f9b61['status'](_0x14550a);return _0x4f9b61[_0xa975('0x1d')](_0xa975('0x1e'),_0x43d3b5+'-'+_0xc5a6f3+'/'+_0x3fd5bd)[_0xa975('0x1f')](_0x34cd3b);}return null;};}function patchUpdates(_0x589dae){return function(_0x3f2404){try{jsonpatch[_0xa975('0x20')](_0x3f2404,_0x589dae,!![]);}catch(_0x2d2e63){return BPromise['reject'](_0x2d2e63);}return _0x3f2404[_0xa975('0x21')]();};}function saveUpdates(_0x5434a1,_0x1ce90b){return function(_0x2c0773){if(_0x2c0773){return _0x2c0773[_0xa975('0x22')](_0x5434a1)[_0xa975('0x23')](function(_0x35e486){return _0x35e486;});}return null;};}function removeEntity(_0xebc0a,_0x403faa){return function(_0x2dcc8e){if(_0x2dcc8e){return _0x2dcc8e[_0xa975('0x24')]()[_0xa975('0x23')](function(){var _0x561d9b=_0x2dcc8e[_0xa975('0x25')]({'plain':!![]});var _0x2de4c4=_0xa975('0x26');return db[_0xa975('0x27')]['destroy']({'where':{'type':_0x2de4c4,'resourceId':_0x561d9b['id']}})[_0xa975('0x23')](function(){return _0x2dcc8e;});})[_0xa975('0x23')](function(){_0xebc0a[_0xa975('0x19')](0xcc)[_0xa975('0x18')]();});}};}function handleEntityNotFound(_0x406cd5,_0x384fad){return function(_0x1b7ced){if(!_0x1b7ced){_0x406cd5['sendStatus'](0x194);}return _0x1b7ced;};}function handleError(_0x56a780,_0x5d4479){_0x5d4479=_0x5d4479||0x1f4;return function(_0x1d0359){logger[_0xa975('0x28')](_0x1d0359[_0xa975('0x29')]);if(_0x1d0359[_0xa975('0x2a')]){delete _0x1d0359[_0xa975('0x2a')];}_0x56a780[_0xa975('0x19')](_0x5d4479)[_0xa975('0x2b')](_0x1d0359);};}exports['index']=function(_0x3c5777,_0x1600f5){var _0x2138a3={},_0xa5aba4={},_0x2752e0={'count':0x0,'rows':[]};var _0x3aeab7=_[_0xa975('0x2c')](db[_0xa975('0x2d')][_0xa975('0x2e')],function(_0x1559a6){return{'name':_0x1559a6[_0xa975('0x2f')],'type':_0x1559a6[_0xa975('0x30')][_0xa975('0x31')]};});_0xa5aba4[_0xa975('0x32')]=_[_0xa975('0x2c')](_0x3aeab7,_0xa975('0x2a'));_0xa5aba4[_0xa975('0x33')]=_[_0xa975('0x34')](_0x3c5777['query']);_0xa5aba4[_0xa975('0x35')]=_[_0xa975('0x36')](_0xa5aba4[_0xa975('0x32')],_0xa5aba4[_0xa975('0x33')]);_0x2138a3['attributes']=_[_0xa975('0x36')](_0xa5aba4[_0xa975('0x32')],qs[_0xa975('0x37')](_0x3c5777[_0xa975('0x33')][_0xa975('0x37')]));_0x2138a3[_0xa975('0x38')]=_0x2138a3[_0xa975('0x38')]['length']?_0x2138a3[_0xa975('0x38')]:_0xa5aba4[_0xa975('0x32')];if(!_0x3c5777['query'][_0xa975('0x39')](_0xa975('0x3a'))){_0x2138a3[_0xa975('0x3b')]=qs[_0xa975('0x3b')](_0x3c5777[_0xa975('0x33')]['limit']);_0x2138a3['offset']=qs[_0xa975('0x1a')](_0x3c5777['query']['offset']);}_0x2138a3['order']=qs[_0xa975('0x3c')](_0x3c5777[_0xa975('0x33')][_0xa975('0x3c')]);_0x2138a3[_0xa975('0x3d')]=qs[_0xa975('0x35')](_[_0xa975('0x3e')](_0x3c5777[_0xa975('0x33')],_0xa5aba4[_0xa975('0x35')]),_0x3aeab7);if(_0x3c5777[_0xa975('0x33')][_0xa975('0x3f')]){_0x2138a3[_0xa975('0x3d')]=_['merge'](_0x2138a3[_0xa975('0x3d')],{'$or':_['map'](_0x3aeab7,function(_0x3ebc5d){if(_0x3ebc5d['type']!==_0xa975('0x40')){var _0x51f774={};_0x51f774[_0x3ebc5d[_0xa975('0x2a')]]={'$like':'%'+_0x3c5777[_0xa975('0x33')][_0xa975('0x3f')]+'%'};return _0x51f774;}})});}_0x2138a3=_['merge']({},_0x2138a3,_0x3c5777[_0xa975('0x41')]);var _0x3b082e={'where':_0x2138a3[_0xa975('0x3d')]};return db[_0xa975('0x2d')][_0xa975('0x1c')](_0x3b082e)[_0xa975('0x23')](function(_0x4a67d2){_0x2752e0[_0xa975('0x1c')]=_0x4a67d2;if(_0x3c5777[_0xa975('0x33')]['includeAll']){_0x2138a3[_0xa975('0x42')]=[{'all':!![]}];}return db[_0xa975('0x2d')][_0xa975('0x43')](_0x2138a3);})['then'](function(_0x4daf1e){_0x2752e0['rows']=_0x4daf1e;return _0x2752e0;})[_0xa975('0x23')](respondWithFilteredResult(_0x1600f5,_0x2138a3))[_0xa975('0x44')](handleError(_0x1600f5,null));};exports['show']=function(_0x4df9c2,_0x3f4815){var _0x395f29={'raw':!![],'where':{'id':_0x4df9c2[_0xa975('0x45')]['id']}},_0x2bcbda={};_0x2bcbda[_0xa975('0x32')]=_[_0xa975('0x34')](db[_0xa975('0x2d')][_0xa975('0x2e')]);_0x2bcbda['query']=_[_0xa975('0x34')](_0x4df9c2[_0xa975('0x33')]);_0x2bcbda[_0xa975('0x35')]=_['intersection'](_0x2bcbda[_0xa975('0x32')],_0x2bcbda[_0xa975('0x33')]);_0x395f29[_0xa975('0x38')]=_['intersection'](_0x2bcbda[_0xa975('0x32')],qs[_0xa975('0x37')](_0x4df9c2[_0xa975('0x33')]['fields']));_0x395f29[_0xa975('0x38')]=_0x395f29['attributes']['length']?_0x395f29[_0xa975('0x38')]:_0x2bcbda[_0xa975('0x32')];if(_0x4df9c2[_0xa975('0x33')][_0xa975('0x46')]){_0x395f29[_0xa975('0x42')]=[{'all':!![]}];}_0x395f29=_[_0xa975('0x47')]({},_0x395f29,_0x4df9c2[_0xa975('0x41')]);return db['Disposition'][_0xa975('0x48')](_0x395f29)[_0xa975('0x23')](handleEntityNotFound(_0x3f4815,null))[_0xa975('0x23')](respondWithResult(_0x3f4815,null))[_0xa975('0x44')](handleError(_0x3f4815,null));};exports[_0xa975('0x49')]=function(_0xb6c8a8,_0x2ecb31){return db[_0xa975('0x2d')][_0xa975('0x49')](_0xb6c8a8[_0xa975('0x4a')],{})[_0xa975('0x23')](function(_0xf9cfb3){var _0x462244=_0xb6c8a8[_0xa975('0x4b')][_0xa975('0x25')]({'plain':!![]});if(!_0x462244)throw new Error(_0xa975('0x4c'));if(_0x462244[_0xa975('0x4d')]===_0xa975('0x4b')){var _0x203411=_0xf9cfb3[_0xa975('0x25')]({'plain':!![]});var _0x3129e8=_0xa975('0x26');return db[_0xa975('0x4e')][_0xa975('0x48')]({'where':{'name':_0x3129e8,'userProfileId':_0x462244[_0xa975('0x4f')]},'raw':!![]})[_0xa975('0x23')](function(_0x385363){if(_0x385363&&_0x385363[_0xa975('0x50')]===0x0){return db['UserProfileResource'][_0xa975('0x49')]({'name':_0x203411[_0xa975('0x2a')],'resourceId':_0x203411['id'],'type':_0x385363[_0xa975('0x2a')],'sectionId':_0x385363['id']},{})[_0xa975('0x23')](function(){return _0xf9cfb3;});}else{return _0xf9cfb3;}})[_0xa975('0x44')](function(_0x4de7c7){logger[_0xa975('0x28')](_0xa975('0x51'),_0x4de7c7);throw _0x4de7c7;});}return _0xf9cfb3;})['then'](respondWithResult(_0x2ecb31,0xc9))['catch'](handleError(_0x2ecb31,null));};exports[_0xa975('0x22')]=function(_0x547992,_0x2a4cfa){if(_0x547992[_0xa975('0x4a')]['id']){delete _0x547992[_0xa975('0x4a')]['id'];}return db[_0xa975('0x2d')][_0xa975('0x48')]({'where':{'id':_0x547992['params']['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x2a4cfa,null))['then'](saveUpdates(_0x547992['body'],null))[_0xa975('0x23')](respondWithResult(_0x2a4cfa,null))[_0xa975('0x44')](handleError(_0x2a4cfa,null));};exports[_0xa975('0x24')]=function(_0x38c0f5,_0x41c520){return db['Disposition']['find']({'where':{'id':_0x38c0f5[_0xa975('0x45')]['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x41c520,null))[_0xa975('0x23')](removeEntity(_0x41c520,null))[_0xa975('0x44')](handleError(_0x41c520,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f690a48..7ed92d8 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 _0x034b=['request-promise','exports','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird'];(function(_0x4c9a6a,_0x5e9a4f){var _0x58f916=function(_0x35f8ee){while(--_0x35f8ee){_0x4c9a6a['push'](_0x4c9a6a['shift']());}};_0x58f916(++_0x5e9a4f);}(_0x034b,0x1b4));var _0xb034=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x034b[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb034('0x0'));var logger=require(_0xb034('0x1'))(_0xb034('0x2'));var moment=require('moment');var BPromise=require(_0xb034('0x3'));var rp=require(_0xb034('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xb034('0x5')]=function(_0x201fb2,_0x48ae7b){return _0x201fb2['define'](_0xb034('0x6'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xb034('0x7'),'fields':[_0xb034('0x8'),_0xb034('0x9')]},{'unique':!![],'name':'name_chat','fields':['name',_0xb034('0xa')]},{'unique':!![],'name':_0xb034('0xb'),'fields':[_0xb034('0x8'),'MailAccountId']},{'unique':!![],'name':_0xb034('0xc'),'fields':['name',_0xb034('0xd')]},{'unique':!![],'name':_0xb034('0xe'),'fields':[_0xb034('0x8'),_0xb034('0xf')]},{'unique':!![],'name':_0xb034('0x10'),'fields':['name',_0xb034('0x11')]},{'unique':!![],'name':_0xb034('0x12'),'fields':[_0xb034('0x8'),_0xb034('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c75=['exports','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x5c75,0xca));var _0x55c7=function(_0x111c6c,_0x5ac573){_0x111c6c=_0x111c6c-0x0;var _0x2e983a=_0x5c75[_0x111c6c];return _0x2e983a;};'use strict';var _=require(_0x55c7('0x0'));var util=require(_0x55c7('0x1'));var logger=require(_0x55c7('0x2'))('api');var moment=require(_0x55c7('0x3'));var BPromise=require(_0x55c7('0x4'));var rp=require(_0x55c7('0x5'));var fs=require('fs');var path=require(_0x55c7('0x6'));var rimraf=require(_0x55c7('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x55c7('0x8')]=function(_0x3093cf,_0x5be4c3){return _0x3093cf[_0x55c7('0x9')](_0x55c7('0xa'),attributes,{'tableName':_0x55c7('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x55c7('0xc'),'ListId']},{'unique':!![],'name':_0x55c7('0xd'),'fields':[_0x55c7('0xc'),_0x55c7('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x55c7('0xf')]},{'unique':!![],'name':_0x55c7('0x10'),'fields':[_0x55c7('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x55c7('0x11'),'fields':['name',_0x55c7('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x55c7('0xc'),_0x55c7('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x55c7('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f8001e2..dbb7a75 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc6da03,_0x2de580){var _0x2b0a5e=function(_0x46ee5b){while(--_0x46ee5b){_0xc6da03['push'](_0xc6da03['shift']());}};_0x2b0a5e(++_0x2de580);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15faae,_0x4bfb0f){var _0x4cfa11=function(_0x56f404){while(--_0x56f404){_0x15faae['push'](_0x15faae['shift']());}};_0x4cfa11(++_0x4bfb0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index d3bff77..470d8ca 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 _0xfecf=['put','update','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create'];(function(_0x2ad871,_0xbbf73b){var _0x504ce9=function(_0x1b3c33){while(--_0x1b3c33){_0x2ad871['push'](_0x2ad871['shift']());}};_0x504ce9(++_0xbbf73b);}(_0xfecf,0x1f2));var _0xffec=function(_0x2c0ac3,_0x4b6520){_0x2c0ac3=_0x2c0ac3-0x0;var _0x56cb65=_0xfecf[_0x2c0ac3];return _0x56cb65;};'use strict';var multer=require('multer');var util=require(_0xffec('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffec('0x1')]();var fs_extra=require(_0xffec('0x2'));var auth=require(_0xffec('0x3'));var interaction=require(_0xffec('0x4'));var config=require(_0xffec('0x5'));var controller=require('./disposition.controller');router[_0xffec('0x6')]('/',auth['isAuthenticated'](),controller[_0xffec('0x7')]);router[_0xffec('0x6')](_0xffec('0x8'),auth[_0xffec('0x9')](),controller['show']);router[_0xffec('0xa')]('/',auth[_0xffec('0x9')](),controller[_0xffec('0xb')]);router[_0xffec('0xc')](_0xffec('0x8'),auth[_0xffec('0x9')](),controller[_0xffec('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xffec('0xe')]);module['exports']=router; \ No newline at end of file +var _0x833e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x49cdd0,_0x2508f9){var _0x13daaa=function(_0x341627){while(--_0x341627){_0x49cdd0['push'](_0x49cdd0['shift']());}};_0x13daaa(++_0x2508f9);}(_0x833e,0x189));var _0xe833=function(_0x50aacc,_0x219e8b){_0x50aacc=_0x50aacc-0x0;var _0x2d9d6b=_0x833e[_0x50aacc];return _0x2d9d6b;};'use strict';var multer=require(_0xe833('0x0'));var util=require(_0xe833('0x1'));var path=require(_0xe833('0x2'));var timeout=require(_0xe833('0x3'));var express=require(_0xe833('0x4'));var router=express[_0xe833('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe833('0x6'));var interaction=require(_0xe833('0x7'));var config=require(_0xe833('0x8'));var controller=require(_0xe833('0x9'));router[_0xe833('0xa')]('/',auth[_0xe833('0xb')](),controller[_0xe833('0xc')]);router[_0xe833('0xa')](_0xe833('0xd'),auth[_0xe833('0xb')](),controller[_0xe833('0xe')]);router[_0xe833('0xf')]('/',auth[_0xe833('0xb')](),controller[_0xe833('0x10')]);router[_0xe833('0x11')](_0xe833('0xd'),auth[_0xe833('0xb')](),controller[_0xe833('0x12')]);router[_0xe833('0x13')]('/:id',auth[_0xe833('0xb')](),controller['destroy']);module[_0xe833('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0455f63..1afa998 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 _0x9bd9=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x9bd9[_0x209511];return _0x39b937;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x99bd('0x2')]},'ecm':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':_0x99bd('0x7')},'maxrate':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x99bd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x99bd('0x3')]('SIP',_0x99bd('0xd'),'DADHI',_0x99bd('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x99bd('0xf')],'defaultValue':function(){return _0x99bd('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99bd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x99bd('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x99bd('0x13'),'set':function(_0x442702){if(!_0x442702)this[_0x99bd('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x99bd('0x15'),_0x442702);}}}; \ No newline at end of file +var _0xbff5=['v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400'];(function(_0x30d54e,_0x4ed409){var _0x23e334=function(_0xe51c0a){while(--_0xe51c0a){_0x30d54e['push'](_0x30d54e['shift']());}};_0x23e334(++_0x4ed409);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2e8795,_0x3b86dd){_0x2e8795=_0x2e8795-0x0;var _0x27ee08=_0xbff5[_0x2e8795];return _0x27ee08;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5bff('0x2')]},'ecm':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'no'),'defaultValue':_0x5bff('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x6'),_0x5bff('0x7'),_0x5bff('0x8'),_0x5bff('0x9'),_0x5bff('0xa'),_0x5bff('0xb')),'defaultValue':_0x5bff('0x7')},'maxrate':{'type':Sequelize[_0x5bff('0x3')]('2400',_0x5bff('0x7'),'7200',_0x5bff('0x9'),_0x5bff('0xa'),'14400'),'defaultValue':_0x5bff('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5bff('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5bff('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5bff('0xe'),'IAX',_0x5bff('0xf'),_0x5bff('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5bff('0x11')],'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[_0x5bff('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5bff('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![],'comment':_0x5bff('0x14'),'set':function(_0x546351){if(!_0x546351)this[_0x5bff('0x15')](_0x5bff('0x16'),null);this[_0x5bff('0x15')](_0x5bff('0x17'),_0x546351);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 273a5cd..5cffb04 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 _0x2392=['ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','modem','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','transaction','VoiceExtension','updateAccountApplications','bulkCreate','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','path','from','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','Pause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','FaxAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','options','rows','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','Transaction'];(function(_0x142382,_0x1e373e){var _0x3b1008=function(_0x156da3){while(--_0x156da3){_0x142382['push'](_0x142382['shift']());}};_0x3b1008(++_0x1e373e);}(_0x2392,0x1ce));var _0x2239=function(_0x492d19,_0x53db70){_0x492d19=_0x492d19-0x0;var _0x2ab50b=_0x2392[_0x492d19];return _0x2ab50b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2239('0x0'));var jsonpatch=require(_0x2239('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2239('0x2'));var path=require('path');var sox=require(_0x2239('0x3'));var csv=require(_0x2239('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2239('0x5'));var _=require(_0x2239('0x6'));var squel=require(_0x2239('0x7'));var crypto=require(_0x2239('0x8'));var jsforce=require(_0x2239('0x9'));var deskjs=require(_0x2239('0xa'));var toCsv=require(_0x2239('0x4'));var querystring=require(_0x2239('0xb'));var Papa=require(_0x2239('0xc'));var Redis=require(_0x2239('0xd'));var authService=require(_0x2239('0xe'));var qs=require(_0x2239('0xf'));var as=require(_0x2239('0x10'));var hardwareService=require(_0x2239('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2239('0x12'));var config=require(_0x2239('0x13'));var licenseUtil=require(_0x2239('0x14'));var db=require('../../mysqldb')['db'];config[_0x2239('0x15')]=_[_0x2239('0x16')](config[_0x2239('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2239('0x17'))(new Redis(config[_0x2239('0x15')]));require('./faxAccount.socket')[_0x2239('0x18')](socket);var jayson=require(_0x2239('0x19'));var client=jayson[_0x2239('0x1a')][_0x2239('0x1b')]({'port':0x232c});var client9002=jayson[_0x2239('0x1a')][_0x2239('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x399189,_0x3a230c,_0xf29fa0,_0x54be9b){return new BPromise(function(_0x43fd08,_0x1b5947){var _0x58aa57=_0x54be9b||client;return _0x58aa57[_0x2239('0x1c')](_0x399189,_0xf29fa0)[_0x2239('0x1d')](function(_0x177d65){logger[_0x2239('0x1e')](_0x2239('0x1f'),_0x3a230c,_0x2239('0x20'));logger[_0x2239('0x21')](_0x2239('0x22'),_0x3a230c,_0x2239('0x20'),JSON[_0x2239('0x23')](_0x177d65));if(_0x177d65[_0x2239('0x24')]){if(_0x177d65['error'][_0x2239('0x25')]===0x1f4){logger['error'](_0x2239('0x1f'),_0x3a230c,_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);return _0x1b5947(_0x177d65['error'][_0x2239('0x26')]);}logger[_0x2239('0x24')](_0x2239('0x1f'),_0x3a230c,_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);return _0x43fd08(_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);}else{logger[_0x2239('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x3a230c,'request\x20sent');_0x43fd08(_0x177d65[_0x2239('0x27')][_0x2239('0x26')]);}})[_0x2239('0x28')](function(_0x24e6d4){logger[_0x2239('0x24')](_0x2239('0x1f'),_0x3a230c,_0x24e6d4);_0x1b5947(_0x24e6d4);});});}function respondWithStatusCode(_0xa3595f,_0x41eb69){_0x41eb69=_0x41eb69||0xcc;return function(_0xa41ef1){if(_0xa41ef1){return _0xa3595f['sendStatus'](_0x41eb69);}return _0xa3595f[_0x2239('0x29')](_0x41eb69)['end']();};}function respondWithResult(_0x3c92fe,_0xd6ba78){_0xd6ba78=_0xd6ba78||0xc8;return function(_0x45c145){if(_0x45c145){return _0x3c92fe[_0x2239('0x29')](_0xd6ba78)[_0x2239('0x2a')](_0x45c145);}};}function respondWithFilteredResult(_0x1a9539,_0x1ce25a){return function(_0x24b29c){if(_0x24b29c){var _0x30e594=typeof _0x1ce25a[_0x2239('0x2b')]===_0x2239('0x2c')&&typeof _0x1ce25a['limit']===_0x2239('0x2c');var _0x44a3a2=_0x24b29c[_0x2239('0x2d')];var _0x766736=_0x30e594?0x0:_0x1ce25a[_0x2239('0x2b')];var _0x2b0057=_0x30e594?_0x24b29c[_0x2239('0x2d')]:_0x1ce25a['offset']+_0x1ce25a[_0x2239('0x2e')];var _0x38ccb2;if(_0x2b0057>=_0x44a3a2){_0x2b0057=_0x44a3a2;_0x38ccb2=0xc8;}else{_0x38ccb2=0xce;}_0x1a9539[_0x2239('0x29')](_0x38ccb2);return _0x1a9539[_0x2239('0x2f')](_0x2239('0x30'),_0x766736+'-'+_0x2b0057+'/'+_0x44a3a2)[_0x2239('0x2a')](_0x24b29c);}return null;};}function patchUpdates(_0x5ed657){return function(_0x6b51ca){try{jsonpatch[_0x2239('0x31')](_0x6b51ca,_0x5ed657,!![]);}catch(_0xabf8d5){return BPromise[_0x2239('0x32')](_0xabf8d5);}return _0x6b51ca[_0x2239('0x33')]();};}function saveUpdates(_0x3202d0,_0x27b5bc){return function(_0x12b0db){if(_0x12b0db){return _0x12b0db[_0x2239('0x34')](_0x3202d0)[_0x2239('0x1d')](function(_0x58f783){return _0x58f783;});}return null;};}function removeEntity(_0x88eda9,_0x4b1080){return function(_0x1d35c5){if(_0x1d35c5){return _0x1d35c5[_0x2239('0x35')]()['then'](function(){var _0x4700f4=_0x1d35c5[_0x2239('0x36')]({'plain':!![]});var _0x3dc071=_0x2239('0x37');return db[_0x2239('0x38')][_0x2239('0x35')]({'where':{'type':_0x3dc071,'resourceId':_0x4700f4['id']}})[_0x2239('0x1d')](function(){return _0x1d35c5;});})[_0x2239('0x1d')](function(){_0x88eda9[_0x2239('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd79,_0x35680e){return function(_0x3c21bf){if(!_0x3c21bf){_0x46cd79[_0x2239('0x39')](0x194);}return _0x3c21bf;};}function handleError(_0x3e14b0,_0x2c7aeb){_0x2c7aeb=_0x2c7aeb||0x1f4;return function(_0x53c5de){logger[_0x2239('0x24')](_0x53c5de['stack']);if(_0x53c5de[_0x2239('0x3a')]){delete _0x53c5de[_0x2239('0x3a')];}_0x3e14b0[_0x2239('0x29')](_0x2c7aeb)[_0x2239('0x3b')](_0x53c5de);};}exports[_0x2239('0x3c')]=function(_0x96b02,_0x39a812){var _0x841031={'include':[{'model':db[_0x2239('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1f28d1={},_0x73a1b5={'count':0x0,'rows':[]};var _0x203df5=_[_0x2239('0x3e')](db['FaxAccount'][_0x2239('0x3f')],function(_0x4614b0){return{'name':_0x4614b0['fieldName'],'type':_0x4614b0[_0x2239('0x40')]['key']};});_0x1f28d1[_0x2239('0x41')]=_['map'](_0x203df5,_0x2239('0x3a'));_0x1f28d1[_0x2239('0x42')]=_[_0x2239('0x43')](_0x96b02[_0x2239('0x42')]);_0x1f28d1[_0x2239('0x44')]=_[_0x2239('0x45')](_0x1f28d1[_0x2239('0x41')],_0x1f28d1[_0x2239('0x42')]);_0x841031[_0x2239('0x46')]=_[_0x2239('0x45')](_0x1f28d1[_0x2239('0x41')],qs[_0x2239('0x47')](_0x96b02[_0x2239('0x42')][_0x2239('0x47')]));_0x841031[_0x2239('0x46')]=_0x841031[_0x2239('0x46')][_0x2239('0x48')]?_0x841031[_0x2239('0x46')]:_0x1f28d1[_0x2239('0x41')];if(!_0x96b02[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x841031['limit']=qs['limit'](_0x96b02['query'][_0x2239('0x2e')]);_0x841031[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x96b02['query']['offset']);}_0x841031[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x96b02[_0x2239('0x42')][_0x2239('0x4b')]);_0x841031[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x96b02[_0x2239('0x42')],_0x1f28d1[_0x2239('0x44')]),_0x203df5);if(_0x96b02[_0x2239('0x42')][_0x2239('0x4e')]){_0x841031[_0x2239('0x4c')]=_['merge'](_0x841031[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x203df5,function(_0x4faa00){if(_0x4faa00[_0x2239('0x40')]!==_0x2239('0x4f')){var _0x9588d3={};_0x9588d3[_0x4faa00[_0x2239('0x3a')]]={'$like':'%'+_0x96b02[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x9588d3;}})});}_0x841031=_[_0x2239('0x50')]({},_0x841031,_0x96b02['options']);var _0x2e377f={'where':_0x841031[_0x2239('0x4c')]};return db[_0x2239('0x51')][_0x2239('0x2d')](_0x2e377f)[_0x2239('0x1d')](function(_0x118be7){_0x73a1b5['count']=_0x118be7;if(_0x96b02['query'][_0x2239('0x52')]){_0x841031[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x51')][_0x2239('0x54')](_0x841031);})['then'](function(_0x37cbcf){_0x73a1b5['rows']=_0x37cbcf;return _0x73a1b5;})['then'](respondWithFilteredResult(_0x39a812,_0x841031))[_0x2239('0x28')](handleError(_0x39a812,null));};exports[_0x2239('0x55')]=function(_0x878b1f,_0x39cc77){var _0x2c7a35={'raw':![],'where':{'id':_0x878b1f[_0x2239('0x56')]['id']},'include':[{'model':db[_0x2239('0x3d')],'as':_0x2239('0x57')}]},_0x8e35e0={};_0x8e35e0[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x51')][_0x2239('0x3f')]);_0x8e35e0[_0x2239('0x42')]=_['keys'](_0x878b1f[_0x2239('0x42')]);_0x8e35e0[_0x2239('0x44')]=_['intersection'](_0x8e35e0[_0x2239('0x41')],_0x8e35e0['query']);_0x2c7a35['attributes']=_[_0x2239('0x45')](_0x8e35e0['model'],qs[_0x2239('0x47')](_0x878b1f['query'][_0x2239('0x47')]));_0x2c7a35['attributes']=_0x2c7a35['attributes'][_0x2239('0x48')]?_0x2c7a35[_0x2239('0x46')]:_0x8e35e0[_0x2239('0x41')];if(_0x878b1f[_0x2239('0x42')]['includeAll']){_0x2c7a35['include']=[{'all':!![]}];}_0x2c7a35=_['merge']({},_0x2c7a35,_0x878b1f['options']);return db['FaxAccount'][_0x2239('0x58')](_0x2c7a35)[_0x2239('0x1d')](handleEntityNotFound(_0x39cc77,null))[_0x2239('0x1d')](respondWithResult(_0x39cc77,null))[_0x2239('0x28')](handleError(_0x39cc77,null));};exports[_0x2239('0x59')]=function(_0x791bf4,_0xec5139){return db['FaxAccount']['create'](_0x791bf4[_0x2239('0x5a')],{})['then'](function(_0x4e4296){var _0x2d882d=_0x791bf4['user']['get']({'plain':!![]});if(!_0x2d882d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d882d['role']===_0x2239('0x5b')){var _0x49944a=_0x4e4296[_0x2239('0x36')]({'plain':!![]});var _0xa395e3=_0x2239('0x37');return db[_0x2239('0x5c')][_0x2239('0x58')]({'where':{'name':_0xa395e3,'userProfileId':_0x2d882d[_0x2239('0x5d')]},'raw':!![]})[_0x2239('0x1d')](function(_0x43808a){if(_0x43808a&&_0x43808a['autoAssociation']===0x0){return db[_0x2239('0x38')][_0x2239('0x59')]({'name':_0x49944a['name'],'resourceId':_0x49944a['id'],'type':_0x43808a[_0x2239('0x3a')],'sectionId':_0x43808a['id']},{})['then'](function(){return _0x4e4296;});}else{return _0x4e4296;}})['catch'](function(_0x4b4ba7){logger[_0x2239('0x24')](_0x2239('0x5e'),_0x4b4ba7);throw _0x4b4ba7;});}return _0x4e4296;})[_0x2239('0x1d')](respondWithResult(_0xec5139,0xc9))[_0x2239('0x28')](handleError(_0xec5139,null));};exports[_0x2239('0x34')]=function(_0x10c7e9,_0x462228){if(_0x10c7e9[_0x2239('0x5a')]['id']){delete _0x10c7e9['body']['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x10c7e9['params']['id']},'include':[{'model':db[_0x2239('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x2239('0x1d')](handleEntityNotFound(_0x462228,null))[_0x2239('0x1d')](saveUpdates(_0x10c7e9[_0x2239('0x5a')],null))[_0x2239('0x1d')](respondWithResult(_0x462228,null))['catch'](handleError(_0x462228,null));};exports[_0x2239('0x35')]=function(_0x1960ee,_0xbfdcdd){return db['FaxAccount']['find']({'where':{'id':_0x1960ee[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0xbfdcdd,null))['then'](removeEntity(_0xbfdcdd,null))['catch'](handleError(_0xbfdcdd,null));};exports[_0x2239('0x5f')]=function(_0x3948a9,_0xa38b7f){return db[_0x2239('0x51')][_0x2239('0x5f')]()['then'](respondWithResult(_0xa38b7f,null))[_0x2239('0x28')](handleError(_0xa38b7f,null));};exports[_0x2239('0x60')]=function(_0x4dc2c8,_0x465f50,_0x9914f){if(_0x4dc2c8['body']['id']){delete _0x4dc2c8[_0x2239('0x5a')]['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x4dc2c8['params']['id']}})['then'](handleEntityNotFound(_0x465f50,null))[_0x2239('0x1d')](function(_0x4e301b){if(_0x4e301b){_0x4dc2c8['body'][_0x2239('0x61')]=_0x4e301b['id'];return db[_0x2239('0x62')][_0x2239('0x59')](_0x4dc2c8[_0x2239('0x5a')]);}})[_0x2239('0x1d')](respondWithResult(_0x465f50,null))[_0x2239('0x28')](handleError(_0x465f50,null));};exports[_0x2239('0x63')]=function(_0x399ae1,_0x370b70,_0x27d26d){var _0x10281d={'raw':![],'where':{}};var _0xc8f93e={};var _0x272eb5={'count':0x0,'rows':[]};return db[_0x2239('0x51')][_0x2239('0x64')]({'where':{'id':_0x399ae1[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x370b70,null))[_0x2239('0x1d')](function(_0x5d4c6b){if(_0x5d4c6b){_0xc8f93e[_0x2239('0x41')]=_['keys'](db[_0x2239('0x62')]['rawAttributes']);_0xc8f93e['query']=_[_0x2239('0x43')](_0x399ae1[_0x2239('0x42')]);_0xc8f93e[_0x2239('0x44')]=_[_0x2239('0x45')](_0xc8f93e[_0x2239('0x41')],_0xc8f93e[_0x2239('0x42')]);_0x10281d['attributes']=_[_0x2239('0x45')](_0xc8f93e[_0x2239('0x41')],qs[_0x2239('0x47')](_0x399ae1[_0x2239('0x42')][_0x2239('0x47')]));_0x10281d[_0x2239('0x46')]=_0x10281d[_0x2239('0x46')][_0x2239('0x48')]?_0x10281d[_0x2239('0x46')]:_0xc8f93e[_0x2239('0x41')];if(!_0x399ae1[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x10281d[_0x2239('0x2e')]=qs['limit'](_0x399ae1[_0x2239('0x42')]['limit']);_0x10281d[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x399ae1[_0x2239('0x42')]['offset']);}_0x10281d[_0x2239('0x4a')]=qs['sort'](_0x399ae1[_0x2239('0x42')][_0x2239('0x4b')]);_0x10281d['where']=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x399ae1[_0x2239('0x42')],_0xc8f93e['filters']));_0x10281d[_0x2239('0x4c')]['FaxAccountId']=_0x5d4c6b['id'];if(_0x399ae1[_0x2239('0x42')][_0x2239('0x4e')]){_0x10281d['where']=_[_0x2239('0x50')](_0x10281d[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x10281d[_0x2239('0x46')],function(_0xca5164){var _0x222267={};_0x222267[_0xca5164]={'$like':'%'+_0x399ae1[_0x2239('0x42')]['filter']+'%'};return _0x222267;})});}_0x10281d=_['merge']({},_0x10281d,_0x399ae1[_0x2239('0x65')]);return db[_0x2239('0x62')][_0x2239('0x2d')]({'where':_0x10281d['where']})[_0x2239('0x1d')](function(_0x504207){_0x272eb5[_0x2239('0x2d')]=_0x504207;if(_0x399ae1[_0x2239('0x42')][_0x2239('0x52')]){_0x10281d[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x62')][_0x2239('0x54')](_0x10281d);})[_0x2239('0x1d')](function(_0x39ef3c){_0x272eb5[_0x2239('0x66')]=_0x39ef3c;return _0x272eb5;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x370b70,_0x10281d))[_0x2239('0x28')](handleError(_0x370b70,null));};exports['removeDispositions']=function(_0x50b689,_0x5b0a1e,_0x4a344d){return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x50b689[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x5b0a1e,null))[_0x2239('0x1d')](function(_0x3c952c){if(_0x3c952c){return _0x3c952c['removeDispositions'](_0x50b689[_0x2239('0x42')][_0x2239('0x67')]);}})['then'](respondWithStatusCode(_0x5b0a1e,null))[_0x2239('0x28')](handleError(_0x5b0a1e,null));};exports[_0x2239('0x68')]=function(_0x68a7b,_0x3199a7,_0x30a929){if(_0x68a7b[_0x2239('0x5a')]['id']){delete _0x68a7b['body']['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x68a7b['params']['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x3199a7,null))['then'](function(_0x2563fd){if(_0x2563fd){_0x68a7b[_0x2239('0x5a')][_0x2239('0x61')]=_0x2563fd['id'];return db[_0x2239('0x69')][_0x2239('0x59')](_0x68a7b[_0x2239('0x5a')]);}})[_0x2239('0x1d')](respondWithResult(_0x3199a7,null))[_0x2239('0x28')](handleError(_0x3199a7,null));};exports[_0x2239('0x6a')]=function(_0x103ebc,_0x25edf5,_0x1534e3){var _0x35b3b1={'raw':![],'where':{}};var _0x23aec3={};var _0x4cc72a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x103ebc[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x25edf5,null))[_0x2239('0x1d')](function(_0x1dde69){if(_0x1dde69){_0x23aec3[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x69')]['rawAttributes']);_0x23aec3[_0x2239('0x42')]=_[_0x2239('0x43')](_0x103ebc['query']);_0x23aec3[_0x2239('0x44')]=_[_0x2239('0x45')](_0x23aec3[_0x2239('0x41')],_0x23aec3[_0x2239('0x42')]);_0x35b3b1[_0x2239('0x46')]=_[_0x2239('0x45')](_0x23aec3[_0x2239('0x41')],qs[_0x2239('0x47')](_0x103ebc['query'][_0x2239('0x47')]));_0x35b3b1['attributes']=_0x35b3b1[_0x2239('0x46')][_0x2239('0x48')]?_0x35b3b1[_0x2239('0x46')]:_0x23aec3[_0x2239('0x41')];if(!_0x103ebc['query']['hasOwnProperty'](_0x2239('0x6b'))){_0x35b3b1['limit']=qs['limit'](_0x103ebc[_0x2239('0x42')][_0x2239('0x2e')]);_0x35b3b1['offset']=qs['offset'](_0x103ebc['query'][_0x2239('0x2b')]);}_0x35b3b1[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x103ebc[_0x2239('0x42')]['sort']);_0x35b3b1['where']=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x103ebc[_0x2239('0x42')],_0x23aec3[_0x2239('0x44')]));_0x35b3b1[_0x2239('0x4c')][_0x2239('0x61')]=_0x1dde69['id'];if(_0x103ebc[_0x2239('0x42')]['filter']){_0x35b3b1[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x35b3b1[_0x2239('0x4c')],{'$or':_['map'](_0x35b3b1[_0x2239('0x46')],function(_0x4044e7){var _0x1ab4be={};_0x1ab4be[_0x4044e7]={'$like':'%'+_0x103ebc[_0x2239('0x42')]['filter']+'%'};return _0x1ab4be;})});}_0x35b3b1=_[_0x2239('0x50')]({},_0x35b3b1,_0x103ebc[_0x2239('0x65')]);return db[_0x2239('0x69')]['count']({'where':_0x35b3b1['where']})[_0x2239('0x1d')](function(_0x3fa74b){_0x4cc72a[_0x2239('0x2d')]=_0x3fa74b;if(_0x103ebc[_0x2239('0x42')][_0x2239('0x52')]){_0x35b3b1[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x69')][_0x2239('0x54')](_0x35b3b1);})[_0x2239('0x1d')](function(_0xb7336a){_0x4cc72a[_0x2239('0x66')]=_0xb7336a;return _0x4cc72a;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x25edf5,_0x35b3b1))[_0x2239('0x28')](handleError(_0x25edf5,null));};exports[_0x2239('0x6c')]=function(_0x455266,_0xa13a5b,_0x11af1b){return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x455266[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0xa13a5b,null))[_0x2239('0x1d')](function(_0x53b164){if(_0x53b164){return _0x53b164[_0x2239('0x6c')](_0x455266[_0x2239('0x42')][_0x2239('0x67')]);}})[_0x2239('0x1d')](respondWithStatusCode(_0xa13a5b,null))[_0x2239('0x28')](handleError(_0xa13a5b,null));};exports['addInteraction']=function(_0x2ca60b,_0x296175,_0x4edbcc){return db['FaxInteraction'][_0x2239('0x58')]({'where':{'id':_0x2ca60b[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x296175,null))[_0x2239('0x1d')](function(_0x5b22e2){if(_0x5b22e2){return _0x5b22e2[_0x2239('0x6d')](_0x2ca60b['body'][_0x2239('0x67')],_[_0x2239('0x6e')](_0x2ca60b[_0x2239('0x5a')],[_0x2239('0x67'),'id'])||{});}})[_0x2239('0x1d')](respondWithResult(_0x296175,null))[_0x2239('0x28')](handleError(_0x296175,null));};exports['getInteractions']=function(_0xda8df4,_0x19cd8d,_0x3962fd){var _0x370e0f={'raw':![],'where':{}};var _0x3ab5b7={};var _0x1c5032={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xda8df4[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x19cd8d,null))[_0x2239('0x1d')](function(_0x278955){if(_0x278955){_0x3ab5b7[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x6f')][_0x2239('0x3f')]);_0x3ab5b7[_0x2239('0x42')]=_[_0x2239('0x43')](_0xda8df4[_0x2239('0x42')]);_0x3ab5b7[_0x2239('0x44')]=_[_0x2239('0x45')](_0x3ab5b7[_0x2239('0x41')],_0x3ab5b7[_0x2239('0x42')]);_0x370e0f[_0x2239('0x46')]=_[_0x2239('0x45')](_0x3ab5b7[_0x2239('0x41')],qs['fields'](_0xda8df4[_0x2239('0x42')][_0x2239('0x47')]));_0x370e0f[_0x2239('0x46')]=_0x370e0f['attributes'][_0x2239('0x48')]?_0x370e0f[_0x2239('0x46')]:_0x3ab5b7['model'];if(!_0xda8df4[_0x2239('0x42')]['hasOwnProperty'](_0x2239('0x6b'))){_0x370e0f[_0x2239('0x2e')]=qs['limit'](_0xda8df4[_0x2239('0x42')][_0x2239('0x2e')]);_0x370e0f[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0xda8df4[_0x2239('0x42')][_0x2239('0x2b')]);}_0x370e0f[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0xda8df4[_0x2239('0x42')][_0x2239('0x4b')]);_0x370e0f[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0xda8df4['query'],_0x3ab5b7['filters']));_0x370e0f[_0x2239('0x4c')][_0x2239('0x61')]=_0x278955['id'];if(_0xda8df4['query'][_0x2239('0x4e')]){_0x370e0f[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x370e0f['where'],{'$or':_[_0x2239('0x3e')](_0x370e0f[_0x2239('0x46')],function(_0x17b829){var _0x18064d={};_0x18064d[_0x17b829]={'$like':'%'+_0xda8df4[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x18064d;})});}_0x370e0f=_[_0x2239('0x50')]({},_0x370e0f,_0xda8df4[_0x2239('0x65')]);return db[_0x2239('0x6f')][_0x2239('0x2d')]({'where':_0x370e0f[_0x2239('0x4c')]})[_0x2239('0x1d')](function(_0x31e9f5){_0x1c5032['count']=_0x31e9f5;if(_0xda8df4[_0x2239('0x42')][_0x2239('0x52')]){_0x370e0f['include']=[{'model':db[_0x2239('0x70')],'as':_0x2239('0x71'),'required':![]},{'model':db[_0x2239('0x72')],'as':_0x2239('0x73'),'attributes':[_0x2239('0x3a'),'fullname',_0x2239('0x74')],'required':![]},{'model':db[_0x2239('0x75')],'as':'Tags','attributes':['id',_0x2239('0x3a'),_0x2239('0x76')],'where':_0xda8df4['query'][_0x2239('0x77')]?{'id':_0xda8df4[_0x2239('0x42')]['tag']}:undefined,'required':_0xda8df4['query']['tag']?!![]:![]}];}return db[_0x2239('0x6f')][_0x2239('0x54')](_0x370e0f);})[_0x2239('0x1d')](function(_0x567690){_0x1c5032[_0x2239('0x66')]=_0x567690;return _0x1c5032;});}})['then'](respondWithFilteredResult(_0x19cd8d,_0x370e0f))[_0x2239('0x28')](handleError(_0x19cd8d,null));};exports[_0x2239('0x78')]=function(_0x50a150,_0x5381fc){var _0x216915=_0x50a150[_0x2239('0x56')]['id'];var _0x392f4a=_0x50a150['body'];var _0x397952=0xc8;var _0x4ba953=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2239('0x79')][_0x2239('0x7a')][_0x2239('0x7b')][_0x2239('0x7c')]},function(_0xb1dc1b){return db[_0x2239('0x51')][_0x2239('0x64')]({'where':{'id':_0x216915},'transaction':_0xb1dc1b})[_0x2239('0x1d')](function(_0x5d0156){if(_0x5d0156){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x216915},'transaction':_0xb1dc1b})[_0x2239('0x1d')](function(){var _0x57b3a4=_[_0x2239('0x3e')](_0x392f4a,function(_0xcc1d14){_0xcc1d14[_0x2239('0x61')]=_0x216915;return _0xcc1d14;});return db[_0x2239('0x7d')]['bulkCreate'](_0x57b3a4,{'transaction':_0xb1dc1b});});}else{_0x397952=0x194;_0x4ba953=[];}});})[_0x2239('0x1d')](function(){if(_0x397952!==0x194){return db['FaxApplication'][_0x2239('0x7e')]({'where':{'FaxAccountId':_0x216915},'order':_0x2239('0x7f')})[_0x2239('0x1d')](function(_0x3e51b5){_0x4ba953=_0x3e51b5;});}})[_0x2239('0x28')](function(_0xeb4878){_0x397952=0x1f4;logger['error'](_0xeb4878[_0x2239('0x80')]);if(_0xeb4878[_0x2239('0x3a')]){delete _0xeb4878[_0x2239('0x3a')];}_0x4ba953=_0xeb4878;})[_0x2239('0x81')](function(){if(_0x4ba953===null){_0x5381fc[_0x2239('0x39')](_0x397952);}else{if(_0x397952===0x1f4){_0x5381fc[_0x2239('0x29')](_0x397952)[_0x2239('0x3b')](_0x4ba953);}else{_0x5381fc[_0x2239('0x29')](_0x397952)[_0x2239('0x2a')](_0x4ba953);}}});};exports['getApplications']=function(_0x30eea6,_0x1b8e83,_0x1843b7){var _0x218eab={};var _0x324c83={};var _0x4a4e96;var _0x785bed;return db['FaxAccount']['findOne']({'where':{'id':_0x30eea6[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b8e83,null))[_0x2239('0x1d')](function(_0x5288be){if(_0x5288be){_0x4a4e96=_0x5288be;_0x324c83[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x7d')][_0x2239('0x3f')]);_0x324c83[_0x2239('0x42')]=_['keys'](_0x30eea6[_0x2239('0x42')]);_0x324c83['filters']=_[_0x2239('0x45')](_0x324c83[_0x2239('0x41')],_0x324c83[_0x2239('0x42')]);_0x218eab[_0x2239('0x46')]=_[_0x2239('0x45')](_0x324c83[_0x2239('0x41')],qs[_0x2239('0x47')](_0x30eea6['query'][_0x2239('0x47')]));_0x218eab['attributes']=_0x218eab[_0x2239('0x46')][_0x2239('0x48')]?_0x218eab[_0x2239('0x46')]:_0x324c83['model'];_0x218eab[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x30eea6[_0x2239('0x42')][_0x2239('0x4b')]);_0x218eab['where']=qs['filters'](_[_0x2239('0x4d')](_0x30eea6['query'],_0x324c83[_0x2239('0x44')]));if(_0x30eea6[_0x2239('0x42')]['filter']){_0x218eab[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x218eab[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x218eab[_0x2239('0x46')],function(_0x194c36){var _0x1343b8={};_0x1343b8[_0x194c36]={'$like':'%'+_0x30eea6[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x1343b8;})});}_0x218eab=_['merge']({},_0x218eab,_0x30eea6[_0x2239('0x65')]);return _0x4a4e96[_0x2239('0x82')](_0x218eab);}})['then'](function(_0x22889e){if(_0x22889e){_0x785bed=_0x22889e[_0x2239('0x48')];if(!_0x30eea6[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x218eab[_0x2239('0x2e')]=qs[_0x2239('0x2e')](_0x30eea6[_0x2239('0x42')][_0x2239('0x2e')]);_0x218eab[_0x2239('0x2b')]=qs['offset'](_0x30eea6['query'][_0x2239('0x2b')]);}return _0x4a4e96[_0x2239('0x82')](_0x218eab);}})[_0x2239('0x1d')](function(_0x33c982){if(_0x33c982){return _0x33c982?{'count':_0x785bed,'rows':_0x33c982}:null;}})[_0x2239('0x1d')](respondWithResult(_0x1b8e83,null))[_0x2239('0x28')](handleError(_0x1b8e83,null));};function Extension(_0x288cb3,_0x4eabda,_0x21ac9a,_0x2d21fb){this[_0x2239('0x83')]=_0x2239('0x84');this[_0x2239('0x85')]=_0x288cb3[_0x2239('0x86')];this[_0x2239('0x87')]=_0x2d21fb;this['type']=_0x2239('0x88');this[_0x2239('0x89')]=_0x2239('0x8a');this[_0x2239('0x61')]=_0x288cb3['id'];this['priority']=_0x4eabda;this[_0x2239('0x8b')]=_0x21ac9a;}function createExtensionsReciveFax(_0x57ca3f){var _0x29acd7=0x1;var _0x299ff1=[];_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,'','Answer'));_0x29acd7+=0x1;_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x8d'),_0x2239('0x8e')));_0x29acd7+=0x1;for(var _0x1aacc6 in _0x57ca3f){if(_0x57ca3f[_0x2239('0x49')](_0x1aacc6)&&(_0x1aacc6===_0x2239('0x8f')||_0x1aacc6===_0x2239('0x86')||_0x1aacc6===_0x2239('0x90')||_0x1aacc6==='faxdetect'||_0x1aacc6===_0x2239('0x91')||_0x1aacc6===_0x2239('0x92')||_0x1aacc6==='minrate'||_0x1aacc6===_0x2239('0x93')||_0x1aacc6==='t38timeout')){_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x94')+_0x1aacc6+')='+_0x57ca3f[_0x1aacc6],_0x2239('0x8e')));_0x29acd7+=0x1;}}_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,'6',_0x2239('0x95')));_0x29acd7+=0x1;_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x96'),_0x2239('0x97')));_0x29acd7=0x0;return _0x299ff1;}exports['addAccountApplications']=function(_0x4758db,_0x4bcd62,_0x1e48df){var _0x283ebc;return db[_0x2239('0x79')][_0x2239('0x98')](function(_0x2e76d1){return db['FaxAccount'][_0x2239('0x59')](_0x4758db['body'],{'transaction':_0x2e76d1})[_0x2239('0x1d')](function(_0x108b7e){_0x283ebc=_0x108b7e[_0x2239('0x36')]({'plain':!![]});return db[_0x2239('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x283ebc),{'transaction':_0x2e76d1});});})[_0x2239('0x1d')](function(){return _0x283ebc;})['then'](respondWithResult(_0x4bcd62,null))[_0x2239('0x28')](handleError(_0x4bcd62,null));};exports[_0x2239('0x9a')]=function(_0x33529f,_0x532967,_0x569e11){var _0xd7c82f;return db[_0x2239('0x79')][_0x2239('0x98')](function(_0x49cd9b){return db['FaxAccount'][_0x2239('0x34')](_0x33529f[_0x2239('0x5a')],{'where':{'id':_0x33529f[_0x2239('0x5a')]['id']},'transaction':_0x49cd9b})[_0x2239('0x1d')](function(_0x2d46f3){return db[_0x2239('0x99')][_0x2239('0x35')]({'where':{'FaxAccountId':_0x33529f[_0x2239('0x5a')]['id']},'transaction':_0x49cd9b})[_0x2239('0x1d')](function(_0x3ee524){return db[_0x2239('0x99')][_0x2239('0x9b')](createExtensionsReciveFax(_[_0x2239('0x6e')](_0x33529f[_0x2239('0x5a')],['tech','key',_0x2239('0x9c'),'updatedAt',_0x2239('0x9d'),_0x2239('0x9e')])),{'transaction':_0x49cd9b});});});})[_0x2239('0x1d')](function(){return db[_0x2239('0x51')][_0x2239('0x9f')](_0x33529f[_0x2239('0x5a')]['id']);})[_0x2239('0x1d')](respondWithResult(_0x532967,null))['catch'](handleError(_0x532967,null));};exports[_0x2239('0xa0')]=function(_0x4f35c1,_0x23a769,_0x34ee5a){var _0x2a1573={'raw':!![],'where':{}};var _0x2e6b44={};var _0x2116a1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2239('0x64')]({'where':{'id':_0x4f35c1[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x23a769,null))[_0x2239('0x1d')](function(_0x2fcba7){if(_0x2fcba7){_0x2e6b44[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0xa1')][_0x2239('0x3f')]);_0x2e6b44['query']=_[_0x2239('0x43')](_0x4f35c1['query']);_0x2e6b44['filters']=_[_0x2239('0x45')](_0x2e6b44[_0x2239('0x41')],_0x2e6b44[_0x2239('0x42')]);_0x2a1573['attributes']=_['intersection'](_0x2e6b44[_0x2239('0x41')],qs[_0x2239('0x47')](_0x4f35c1['query'][_0x2239('0x47')]));_0x2a1573[_0x2239('0x46')]=_0x2a1573['attributes'][_0x2239('0x48')]?_0x2a1573[_0x2239('0x46')]:_0x2e6b44[_0x2239('0x41')];if(!_0x4f35c1[_0x2239('0x42')][_0x2239('0x49')](_0x2239('0x6b'))){_0x2a1573['limit']=qs[_0x2239('0x2e')](_0x4f35c1['query'][_0x2239('0x2e')]);_0x2a1573[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x4f35c1[_0x2239('0x42')]['offset']);}_0x2a1573[_0x2239('0x4a')]=qs['sort'](_0x4f35c1[_0x2239('0x42')]['sort']);_0x2a1573[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x4f35c1[_0x2239('0x42')],_0x2e6b44[_0x2239('0x44')]));_0x2a1573[_0x2239('0x4c')][_0x2239('0x61')]=_0x2fcba7['id'];if(_0x4f35c1[_0x2239('0x42')][_0x2239('0x4e')]){_0x2a1573[_0x2239('0x4c')]=_['merge'](_0x2a1573[_0x2239('0x4c')],{'$or':_['map'](_0x2a1573[_0x2239('0x46')],function(_0x4e7c73){var _0x533571={};_0x533571[_0x4e7c73]={'$like':'%'+_0x4f35c1[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x533571;})});}if(_0x4f35c1[_0x2239('0x42')][_0x2239('0xa2')]){var _0xd51fae=_0x4f35c1['query']['$gte'][_0x2239('0xa3')](',');var _0x29ce21={};_0x29ce21[_0xd51fae[0x0]]={'$gte':moment(_0xd51fae[0x1])['format'](_0x2239('0xa4'))};_0x2a1573[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x2a1573[_0x2239('0x4c')],_0x29ce21);}_0x2a1573=_[_0x2239('0x50')]({},_0x2a1573,_0x4f35c1[_0x2239('0x65')]);return db[_0x2239('0xa1')][_0x2239('0x2d')]({'where':_0x2a1573[_0x2239('0x4c')]})[_0x2239('0x1d')](function(_0x2df373){_0x2116a1['count']=_0x2df373;if(_0x4f35c1['query']['includeAll']){_0x2a1573[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0xa1')]['findAll'](_0x2a1573);})[_0x2239('0x1d')](function(_0x244e51){_0x2116a1[_0x2239('0x66')]=_0x244e51;return _0x2116a1;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x23a769,_0x2a1573))['catch'](handleError(_0x23a769,null));};exports['send']=function(_0x6c94bb,_0x325228,_0xaf5526){var _0x12b22e,_0x41feb6={},_0x28a348;if(_0x6c94bb[_0x2239('0x5a')]['to']){_0x28a348=_0x6c94bb[_0x2239('0x5a')]['to'][0x0];}return db[_0x2239('0x51')]['find']({'where':{'id':_0x6c94bb[_0x2239('0x56')]['id']},'include':[{'model':db[_0x2239('0xa5')],'as':_0x2239('0xa6'),'include':[{'model':db['CmContact'],'as':_0x2239('0xa7'),'where':{'fax':_0x28a348},'limit':0x1,'order':[[_0x2239('0xa8'),_0x2239('0xa9')]]}]}]})[_0x2239('0x1d')](handleEntityNotFound(_0x325228,null))[_0x2239('0x1d')](function(_0x1ca3a5){_0x12b22e=_0x1ca3a5;if(_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')]&&_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')]['length']){for(var _0x4e4369=0x0;_0x4e4369<_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][_0x2239('0x48')];_0x4e4369+=0x1){_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][_0x4e4369]={'filename':_0x6c94bb['body'][_0x2239('0xaa')][_0x4e4369][_0x2239('0x3a')],'id':_0x6c94bb[_0x2239('0x5a')]['attachments'][_0x4e4369]['id'],'path':path['join'](config[_0x2239('0xab')],_0x2239('0xac'),_0x6c94bb[_0x2239('0x5a')]['attachments'][_0x4e4369]['basename'])};}}return respondWithRpcPromise(_0x2239('0xad'),_0x2239('0xad'),{'FaxAccountId':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x56')]['id'])?undefined:_0x6c94bb['params']['id'],'path':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['path'])?undefined:_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0][_0x2239('0xaf')],'fax':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')]['to'][0x0])?undefined:_0x6c94bb[_0x2239('0x5a')]['to'][0x0]},client9002);})[_0x2239('0x1d')](function(){if(_0x12b22e){if(_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')]['from'])){_0x6c94bb[_0x2239('0x5a')][_0x2239('0xb0')]=util['format']('\x22%s\x22\x20<%s>',_0x12b22e[_0x2239('0x3a')],_0x12b22e[_0x2239('0xb1')]);}if(_0x12b22e[_0x2239('0xa6')]){if(_0x12b22e[_0x2239('0xa6')][_0x2239('0xa7')][_0x2239('0x48')]){return _0x12b22e[_0x2239('0xa6')][_0x2239('0xa7')][0x0];}else{return db['CmContact'][_0x2239('0x59')](_[_0x2239('0x16')](_0x6c94bb[_0x2239('0x5a')],{'firstName':_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'phone':_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'fax':_0x6c94bb['body']['to'][0x0],'ListId':_0x12b22e[_0x2239('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x2239('0xb2'));}})['then'](function(_0x55ff78){if(_0x55ff78){return db['FaxInteraction'][_0x2239('0x58')]({'where':{'ContactId':_0x55ff78['id'],'closed':![],'FaxAccountId':_0x12b22e['id']}})[_0x2239('0x1d')](function(_0x4707a9){if(_0x4707a9){return[_0x4707a9,![]];}return db[_0x2239('0x6f')][_0x2239('0x59')]({'UserId':_0x6c94bb[_0x2239('0x5b')]['id'],'ContactId':_0x55ff78['id'],'FaxAccountId':_0x12b22e['id'],'fax':_0x6c94bb['body']['to'][0x0],'firstMsgDirection':_0x2239('0xb3'),'Messages':[_[_0x2239('0x50')](_0x6c94bb[_0x2239('0x5a')],{'read':![],'body':_0x6c94bb['body']['attachments'][0x0][_0x2239('0xb4')],'FaxAccountId':_0x12b22e['id'],'UserId':_0x6c94bb['user']['id'],'ContactId':_0x55ff78['id'],'AttachmentId':_0x6c94bb[_0x2239('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2239('0xa1')],'as':_0x2239('0xb5')}]})['then'](function(_0x694156){return[_0x694156,!![]];});});}else{throw new Error(_0x2239('0xb6'));}})[_0x2239('0xb7')](function(_0x29825b,_0x3f07ae){if(_0x3f07ae){return _0x29825b;}return db[_0x2239('0xa1')][_0x2239('0x59')]({'direction':_0x2239('0xb3'),'read':![],'body':_0x6c94bb['body']['attachments'][0x0][_0x2239('0xb4')],'FaxAccountId':_0x12b22e['id'],'FaxInteractionId':_0x29825b['id'],'UserId':_0x6c94bb[_0x2239('0x5b')]['id'],'ContactId':_0x29825b[_0x2239('0xb8')],'AttachmentId':_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['id']})[_0x2239('0x1d')](function(_0x482b4a){_0x29825b[_0x2239('0xb9')][_0x2239('0xb5')]=[];_0x29825b[_0x2239('0xb9')][_0x2239('0xb5')][_0x2239('0x8c')](_0x482b4a[_0x2239('0xb9')]);return _0x29825b;});})['then'](function(_0x56339d){respondWithRpcPromise('SendFax',_0x2239('0xba'),{'FaxAccountId':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x56')]['id'])?undefined:_0x6c94bb[_0x2239('0x56')]['id'],'path':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0][_0x2239('0xaf')])?undefined:_0x6c94bb['body'][_0x2239('0xaa')][0x0][_0x2239('0xaf')],'fax':_[_0x2239('0xae')](_0x6c94bb['body']['to'][0x0])?undefined:_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'AttachmentId':_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['id']},client9002)[_0x2239('0x1d')](function(_0x422926){logger['info'](_0x2239('0xbb'),_0x422926);})[_0x2239('0x28')](function(_0x29d86d){logger[_0x2239('0x1e')](_0x2239('0xbb'),_0x29d86d);});return _0x56339d;})[_0x2239('0x1d')](respondWithResult(_0x325228,null))['catch'](handleError(_0x325228,null));};exports[_0x2239('0xbc')]=function(_0x52556c,_0x232651,_0x1dc97d){return db[_0x2239('0x51')]['find']({'where':{'id':_0x52556c[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x232651,null))[_0x2239('0x1d')](function(_0x58a773){if(_0x58a773){return _0x58a773['addAgents'](_0x52556c[_0x2239('0x5a')]['ids'],_[_0x2239('0x6e')](_0x52556c[_0x2239('0x5a')],[_0x2239('0x67'),'id'])||{})[_0x2239('0xb7')](function(_0x5ec216){for(var _0x32e064=0x0;_0x32e064<_0x52556c['body'][_0x2239('0x67')][_0x2239('0x48')];_0x32e064+=0x1){socket[_0x2239('0xbd')](_0x2239('0xbe'),{'UserId':Number(_0x52556c[_0x2239('0x5a')][_0x2239('0x67')][_0x32e064]),'FaxAccountId':Number(_0x52556c['params']['id'])});}return _0x5ec216;});}})[_0x2239('0x1d')](respondWithResult(_0x232651,null))[_0x2239('0x28')](handleError(_0x232651,null));};exports[_0x2239('0xbf')]=function(_0x41b5f3,_0x3ca1fe,_0x272b60){return db['FaxAccount'][_0x2239('0x58')]({'where':{'id':_0x41b5f3[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x3ca1fe,null))[_0x2239('0x1d')](function(_0x5efe55){if(_0x5efe55){return _0x5efe55['removeAgents'](_0x41b5f3['query'][_0x2239('0x67')])[_0x2239('0x1d')](function(){if(_[_0x2239('0xc0')](_0x41b5f3[_0x2239('0x42')][_0x2239('0x67')])){for(var _0x150832=0x0;_0x150832<_0x41b5f3[_0x2239('0x42')]['ids'][_0x2239('0x48')];_0x150832+=0x1){socket[_0x2239('0xbd')](_0x2239('0xc1'),{'UserId':Number(_0x41b5f3[_0x2239('0x42')]['ids'][_0x150832]),'FaxAccountId':Number(_0x41b5f3[_0x2239('0x56')]['id'])});}}else{socket[_0x2239('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x41b5f3[_0x2239('0x42')][_0x2239('0x67')]),'FaxAccountId':Number(_0x41b5f3[_0x2239('0x56')]['id'])});}});}})[_0x2239('0x1d')](respondWithStatusCode(_0x3ca1fe,null))[_0x2239('0x28')](handleError(_0x3ca1fe,null));};exports[_0x2239('0xc2')]=function(_0x42100f,_0x5ca0c7,_0x57cec1){var _0xc980d4={};var _0x3d91a3={};var _0x24b68e;var _0x522e95;return db[_0x2239('0x51')]['findOne']({'where':{'id':_0x42100f['params']['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x5ca0c7,null))[_0x2239('0x1d')](function(_0x1bc358){if(_0x1bc358){_0x24b68e=_0x1bc358;_0x3d91a3[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x72')]['rawAttributes']);_0x3d91a3['query']=_['keys'](_0x42100f['query']);_0x3d91a3[_0x2239('0x44')]=_['intersection'](_0x3d91a3[_0x2239('0x41')],_0x3d91a3[_0x2239('0x42')]);_0xc980d4[_0x2239('0x46')]=_[_0x2239('0x45')](_0x3d91a3['model'],qs[_0x2239('0x47')](_0x42100f['query'][_0x2239('0x47')]));_0xc980d4[_0x2239('0x46')]=_0xc980d4[_0x2239('0x46')][_0x2239('0x48')]?_0xc980d4[_0x2239('0x46')]:_0x3d91a3[_0x2239('0x41')];_0xc980d4[_0x2239('0x4a')]=qs['sort'](_0x42100f[_0x2239('0x42')][_0x2239('0x4b')]);_0xc980d4[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x42100f[_0x2239('0x42')],_0x3d91a3[_0x2239('0x44')]));if(_0x42100f[_0x2239('0x42')][_0x2239('0x4e')]){_0xc980d4[_0x2239('0x4c')]=_[_0x2239('0x50')](_0xc980d4[_0x2239('0x4c')],{'$or':_['map'](_0xc980d4[_0x2239('0x46')],function(_0x3d7546){var _0x4c997a={};_0x4c997a[_0x3d7546]={'$like':'%'+_0x42100f[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x4c997a;})});}_0xc980d4=_['merge']({},_0xc980d4,_0x42100f[_0x2239('0x65')]);return _0x24b68e[_0x2239('0xc2')](_0xc980d4);}})[_0x2239('0x1d')](function(_0x3dc52f){if(_0x3dc52f){_0x522e95=_0x3dc52f[_0x2239('0x48')];if(!_0x42100f[_0x2239('0x42')][_0x2239('0x49')](_0x2239('0x6b'))){_0xc980d4[_0x2239('0x2e')]=qs[_0x2239('0x2e')](_0x42100f[_0x2239('0x42')][_0x2239('0x2e')]);_0xc980d4['offset']=qs[_0x2239('0x2b')](_0x42100f['query'][_0x2239('0x2b')]);}return _0x24b68e['getAgents'](_0xc980d4);}})[_0x2239('0x1d')](function(_0x419c11){if(_0x419c11){return _0x419c11?{'count':_0x522e95,'rows':_0x419c11}:null;}})['then'](respondWithResult(_0x5ca0c7,null))[_0x2239('0x28')](handleError(_0x5ca0c7,null));}; \ No newline at end of file +var _0x4d01=['stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxAccount','findAll','rows','show','Pause','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','FaxAccountId','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','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','VoiceExtension','updateAccountApplications','transaction','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','end'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4d01,0x15d));var _0x14d0=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x4d01[_0x4f4d19];return _0x27a258;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14d0('0x0'));var zipdir=require(_0x14d0('0x1'));var jsonpatch=require(_0x14d0('0x2'));var rp=require(_0x14d0('0x3'));var moment=require('moment');var BPromise=require(_0x14d0('0x4'));var Mustache=require(_0x14d0('0x5'));var util=require(_0x14d0('0x6'));var path=require(_0x14d0('0x7'));var sox=require(_0x14d0('0x8'));var csv=require('to-csv');var ejs=require(_0x14d0('0x9'));var fs=require('fs');var fs_extra=require(_0x14d0('0xa'));var _=require(_0x14d0('0xb'));var squel=require(_0x14d0('0xc'));var crypto=require(_0x14d0('0xd'));var jsforce=require(_0x14d0('0xe'));var deskjs=require(_0x14d0('0xf'));var toCsv=require(_0x14d0('0x10'));var querystring=require('querystring');var Papa=require(_0x14d0('0x11'));var Redis=require(_0x14d0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14d0('0x13'));var hardwareService=require(_0x14d0('0x14'));var logger=require(_0x14d0('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x14d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x14d0('0x17'))['db'];config[_0x14d0('0x18')]=_[_0x14d0('0x19')](config[_0x14d0('0x18')],{'host':_0x14d0('0x1a'),'port':0x18eb});var socket=require(_0x14d0('0x1b'))(new Redis(config[_0x14d0('0x18')]));require(_0x14d0('0x1c'))['register'](socket);var jayson=require(_0x14d0('0x1d'));var client=jayson['client'][_0x14d0('0x1e')]({'port':0x232c});var client9002=jayson[_0x14d0('0x1f')][_0x14d0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5e884f,_0x14eece,_0x45b365,_0x593060){return new BPromise(function(_0x9d20d5,_0x5117cf){var _0x101d94=_0x593060||client;return _0x101d94['request'](_0x5e884f,_0x45b365)[_0x14d0('0x20')](function(_0x3e3b73){logger['info'](_0x14d0('0x21'),_0x14eece,_0x14d0('0x22'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x14eece,_0x14d0('0x22'),JSON[_0x14d0('0x23')](_0x3e3b73));if(_0x3e3b73[_0x14d0('0x24')]){if(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x25')]===0x1f4){logger[_0x14d0('0x24')](_0x14d0('0x21'),_0x14eece,_0x3e3b73['error'][_0x14d0('0x26')]);return _0x5117cf(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x14eece,_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);return _0x9d20d5(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x14eece,'request\x20sent');_0x9d20d5(_0x3e3b73[_0x14d0('0x27')][_0x14d0('0x26')]);}})['catch'](function(_0x5f77a6){logger[_0x14d0('0x24')](_0x14d0('0x21'),_0x14eece,_0x5f77a6);_0x5117cf(_0x5f77a6);});});}function respondWithStatusCode(_0x5dafbd,_0x50cd17){_0x50cd17=_0x50cd17||0xcc;return function(_0x2bb049){if(_0x2bb049){return _0x5dafbd[_0x14d0('0x28')](_0x50cd17);}return _0x5dafbd[_0x14d0('0x29')](_0x50cd17)['end']();};}function respondWithResult(_0x58919c,_0x58d949){_0x58d949=_0x58d949||0xc8;return function(_0x209858){if(_0x209858){return _0x58919c['status'](_0x58d949)[_0x14d0('0x2a')](_0x209858);}};}function respondWithFilteredResult(_0x435ca0,_0x21a7b9){return function(_0x53d5ff){if(_0x53d5ff){var _0x425401=typeof _0x21a7b9['offset']==='undefined'&&typeof _0x21a7b9[_0x14d0('0x2b')]===_0x14d0('0x2c');var _0xfb55ff=_0x53d5ff[_0x14d0('0x2d')];var _0x38c0aa=_0x425401?0x0:_0x21a7b9['offset'];var _0x261da4=_0x425401?_0x53d5ff[_0x14d0('0x2d')]:_0x21a7b9['offset']+_0x21a7b9[_0x14d0('0x2b')];var _0x573e42;if(_0x261da4>=_0xfb55ff){_0x261da4=_0xfb55ff;_0x573e42=0xc8;}else{_0x573e42=0xce;}_0x435ca0[_0x14d0('0x29')](_0x573e42);return _0x435ca0['set'](_0x14d0('0x2e'),_0x38c0aa+'-'+_0x261da4+'/'+_0xfb55ff)[_0x14d0('0x2a')](_0x53d5ff);}return null;};}function patchUpdates(_0x2cf22b){return function(_0x4cc867){try{jsonpatch[_0x14d0('0x2f')](_0x4cc867,_0x2cf22b,!![]);}catch(_0x58fe29){return BPromise[_0x14d0('0x30')](_0x58fe29);}return _0x4cc867[_0x14d0('0x31')]();};}function saveUpdates(_0xe17c90,_0x10f739){return function(_0xb54efe){if(_0xb54efe){return _0xb54efe[_0x14d0('0x32')](_0xe17c90)[_0x14d0('0x20')](function(_0x70883e){return _0x70883e;});}return null;};}function removeEntity(_0x493f92,_0x7d001f){return function(_0x39c0ae){if(_0x39c0ae){return _0x39c0ae[_0x14d0('0x33')]()['then'](function(){var _0x31b2ea=_0x39c0ae['get']({'plain':!![]});var _0x1eaf8f='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x1eaf8f,'resourceId':_0x31b2ea['id']}})['then'](function(){return _0x39c0ae;});})[_0x14d0('0x20')](function(){_0x493f92[_0x14d0('0x29')](0xcc)[_0x14d0('0x34')]();});}};}function handleEntityNotFound(_0x38547c,_0x1fbe16){return function(_0x41fd23){if(!_0x41fd23){_0x38547c[_0x14d0('0x28')](0x194);}return _0x41fd23;};}function handleError(_0x2c6bf8,_0x3ae994){_0x3ae994=_0x3ae994||0x1f4;return function(_0x181b0b){logger[_0x14d0('0x24')](_0x181b0b[_0x14d0('0x35')]);if(_0x181b0b[_0x14d0('0x36')]){delete _0x181b0b[_0x14d0('0x36')];}_0x2c6bf8[_0x14d0('0x29')](_0x3ae994)[_0x14d0('0x37')](_0x181b0b);};}exports[_0x14d0('0x38')]=function(_0x41a60d,_0x4a063b){var _0x469fee={'include':[{'model':db['Pause'],'as':_0x14d0('0x39')}]},_0x1f179f={},_0x509b22={'count':0x0,'rows':[]};var _0x4c5abe=_[_0x14d0('0x3a')](db['FaxAccount'][_0x14d0('0x3b')],function(_0x16ca3a){return{'name':_0x16ca3a[_0x14d0('0x3c')],'type':_0x16ca3a['type'][_0x14d0('0x3d')]};});_0x1f179f[_0x14d0('0x3e')]=_[_0x14d0('0x3a')](_0x4c5abe,_0x14d0('0x36'));_0x1f179f[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x41a60d['query']);_0x1f179f[_0x14d0('0x41')]=_['intersection'](_0x1f179f[_0x14d0('0x3e')],_0x1f179f[_0x14d0('0x3f')]);_0x469fee[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x1f179f[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x469fee[_0x14d0('0x42')]=_0x469fee[_0x14d0('0x42')][_0x14d0('0x45')]?_0x469fee[_0x14d0('0x42')]:_0x1f179f[_0x14d0('0x3e')];if(!_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x46')]('nolimit')){_0x469fee['limit']=qs[_0x14d0('0x2b')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x469fee[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x469fee[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x469fee[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x41a60d['query'],_0x1f179f[_0x14d0('0x41')]),_0x4c5abe);if(_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x469fee['where']=_[_0x14d0('0x4d')](_0x469fee[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x4c5abe,function(_0x33e2e6){if(_0x33e2e6['type']!==_0x14d0('0x4e')){var _0x5e4192={};_0x5e4192[_0x33e2e6[_0x14d0('0x36')]]={'$like':'%'+_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x5e4192;}})});}_0x469fee=_[_0x14d0('0x4d')]({},_0x469fee,_0x41a60d[_0x14d0('0x4f')]);var _0x4fe731={'where':_0x469fee[_0x14d0('0x4a')]};return db['FaxAccount']['count'](_0x4fe731)[_0x14d0('0x20')](function(_0x2e6ce6){_0x509b22[_0x14d0('0x2d')]=_0x2e6ce6;if(_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x469fee[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x52')][_0x14d0('0x53')](_0x469fee);})['then'](function(_0x5f12b7){_0x509b22[_0x14d0('0x54')]=_0x5f12b7;return _0x509b22;})[_0x14d0('0x20')](respondWithFilteredResult(_0x4a063b,_0x469fee))['catch'](handleError(_0x4a063b,null));};exports[_0x14d0('0x55')]=function(_0x306ba7,_0x554385){var _0x5d684f={'raw':![],'where':{'id':_0x306ba7['params']['id']},'include':[{'model':db[_0x14d0('0x56')],'as':_0x14d0('0x39')}]},_0x4d9f01={};_0x4d9f01[_0x14d0('0x3e')]=_['keys'](db[_0x14d0('0x52')][_0x14d0('0x3b')]);_0x4d9f01['query']=_[_0x14d0('0x40')](_0x306ba7[_0x14d0('0x3f')]);_0x4d9f01['filters']=_['intersection'](_0x4d9f01[_0x14d0('0x3e')],_0x4d9f01[_0x14d0('0x3f')]);_0x5d684f[_0x14d0('0x42')]=_['intersection'](_0x4d9f01[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x306ba7['query'][_0x14d0('0x44')]));_0x5d684f[_0x14d0('0x42')]=_0x5d684f[_0x14d0('0x42')][_0x14d0('0x45')]?_0x5d684f['attributes']:_0x4d9f01['model'];if(_0x306ba7['query'][_0x14d0('0x50')]){_0x5d684f['include']=[{'all':!![]}];}_0x5d684f=_[_0x14d0('0x4d')]({},_0x5d684f,_0x306ba7[_0x14d0('0x4f')]);return db['FaxAccount'][_0x14d0('0x57')](_0x5d684f)[_0x14d0('0x20')](handleEntityNotFound(_0x554385,null))[_0x14d0('0x20')](respondWithResult(_0x554385,null))[_0x14d0('0x58')](handleError(_0x554385,null));};exports['create']=function(_0x4b31a4,_0x38afb6){return db[_0x14d0('0x52')][_0x14d0('0x59')](_0x4b31a4[_0x14d0('0x5a')],{})[_0x14d0('0x20')](function(_0x3c3f51){var _0x2c3e9f=_0x4b31a4['user'][_0x14d0('0x5b')]({'plain':!![]});if(!_0x2c3e9f)throw new Error(_0x14d0('0x5c'));if(_0x2c3e9f[_0x14d0('0x5d')]===_0x14d0('0x5e')){var _0x71b858=_0x3c3f51[_0x14d0('0x5b')]({'plain':!![]});var _0x5ae4b9='FaxAccounts';return db['UserProfileSection'][_0x14d0('0x57')]({'where':{'name':_0x5ae4b9,'userProfileId':_0x2c3e9f[_0x14d0('0x5f')]},'raw':!![]})[_0x14d0('0x20')](function(_0x4c9522){if(_0x4c9522&&_0x4c9522[_0x14d0('0x60')]===0x0){return db[_0x14d0('0x61')][_0x14d0('0x59')]({'name':_0x71b858[_0x14d0('0x36')],'resourceId':_0x71b858['id'],'type':_0x4c9522['name'],'sectionId':_0x4c9522['id']},{})['then'](function(){return _0x3c3f51;});}else{return _0x3c3f51;}})['catch'](function(_0x8fb82f){logger['error'](_0x14d0('0x62'),_0x8fb82f);throw _0x8fb82f;});}return _0x3c3f51;})[_0x14d0('0x20')](respondWithResult(_0x38afb6,0xc9))[_0x14d0('0x58')](handleError(_0x38afb6,null));};exports[_0x14d0('0x32')]=function(_0x3bd62a,_0x148b59){if(_0x3bd62a[_0x14d0('0x5a')]['id']){delete _0x3bd62a[_0x14d0('0x5a')]['id'];}return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0x3bd62a['params']['id']},'include':[{'model':db[_0x14d0('0x56')],'as':_0x14d0('0x39')}]})['then'](handleEntityNotFound(_0x148b59,null))['then'](saveUpdates(_0x3bd62a['body'],null))[_0x14d0('0x20')](respondWithResult(_0x148b59,null))['catch'](handleError(_0x148b59,null));};exports[_0x14d0('0x33')]=function(_0xc818e4,_0x402dd5){return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0xc818e4[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x402dd5,null))[_0x14d0('0x20')](removeEntity(_0x402dd5,null))[_0x14d0('0x58')](handleError(_0x402dd5,null));};exports[_0x14d0('0x64')]=function(_0x581f1a,_0xe76e30){return db[_0x14d0('0x52')]['describe']()['then'](respondWithResult(_0xe76e30,null))['catch'](handleError(_0xe76e30,null));};exports[_0x14d0('0x65')]=function(_0x5d28fd,_0x3a399a,_0x49ff1b){if(_0x5d28fd[_0x14d0('0x5a')]['id']){delete _0x5d28fd[_0x14d0('0x5a')]['id'];}return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x5d28fd['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x3a399a,null))[_0x14d0('0x20')](function(_0x324f7f){if(_0x324f7f){_0x5d28fd[_0x14d0('0x5a')]['FaxAccountId']=_0x324f7f['id'];return db[_0x14d0('0x66')][_0x14d0('0x59')](_0x5d28fd['body']);}})[_0x14d0('0x20')](respondWithResult(_0x3a399a,null))[_0x14d0('0x58')](handleError(_0x3a399a,null));};exports[_0x14d0('0x67')]=function(_0x208d1b,_0x2be460,_0x180306){var _0x838ed5={'raw':![],'where':{}};var _0x57602a={};var _0x59ce43={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x208d1b['params']['id']}})['then'](handleEntityNotFound(_0x2be460,null))[_0x14d0('0x20')](function(_0x1b041a){if(_0x1b041a){_0x57602a[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0x66')][_0x14d0('0x3b')]);_0x57602a[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x208d1b[_0x14d0('0x3f')]);_0x57602a['filters']=_[_0x14d0('0x43')](_0x57602a[_0x14d0('0x3e')],_0x57602a[_0x14d0('0x3f')]);_0x838ed5['attributes']=_[_0x14d0('0x43')](_0x57602a[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x838ed5[_0x14d0('0x42')]=_0x838ed5[_0x14d0('0x42')][_0x14d0('0x45')]?_0x838ed5['attributes']:_0x57602a[_0x14d0('0x3e')];if(!_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x838ed5[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x838ed5[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x208d1b['query']['offset']);}_0x838ed5['order']=qs['sort'](_0x208d1b['query'][_0x14d0('0x49')]);_0x838ed5[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x208d1b['query'],_0x57602a[_0x14d0('0x41')]));_0x838ed5['where'][_0x14d0('0x6a')]=_0x1b041a['id'];if(_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x838ed5[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x838ed5[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x838ed5[_0x14d0('0x42')],function(_0x4c3aad){var _0x4e9729={};_0x4e9729[_0x4c3aad]={'$like':'%'+_0x208d1b[_0x14d0('0x3f')]['filter']+'%'};return _0x4e9729;})});}_0x838ed5=_['merge']({},_0x838ed5,_0x208d1b[_0x14d0('0x4f')]);return db[_0x14d0('0x66')][_0x14d0('0x2d')]({'where':_0x838ed5[_0x14d0('0x4a')]})['then'](function(_0x4de1db){_0x59ce43[_0x14d0('0x2d')]=_0x4de1db;if(_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x838ed5[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x66')][_0x14d0('0x53')](_0x838ed5);})[_0x14d0('0x20')](function(_0x113cf4){_0x59ce43[_0x14d0('0x54')]=_0x113cf4;return _0x59ce43;});}})['then'](respondWithFilteredResult(_0x2be460,_0x838ed5))[_0x14d0('0x58')](handleError(_0x2be460,null));};exports[_0x14d0('0x6b')]=function(_0x2e07f1,_0x1b9187,_0x5d1371){return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x2e07f1[_0x14d0('0x63')]['id']}})['then'](handleEntityNotFound(_0x1b9187,null))[_0x14d0('0x20')](function(_0x16b995){if(_0x16b995){return _0x16b995[_0x14d0('0x6b')](_0x2e07f1[_0x14d0('0x3f')]['ids']);}})[_0x14d0('0x20')](respondWithStatusCode(_0x1b9187,null))[_0x14d0('0x58')](handleError(_0x1b9187,null));};exports['addAnswer']=function(_0x5451a9,_0x415c95,_0x6252d2){if(_0x5451a9[_0x14d0('0x5a')]['id']){delete _0x5451a9[_0x14d0('0x5a')]['id'];}return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x5451a9[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x415c95,null))[_0x14d0('0x20')](function(_0x13c499){if(_0x13c499){_0x5451a9[_0x14d0('0x5a')][_0x14d0('0x6a')]=_0x13c499['id'];return db['CannedAnswer'][_0x14d0('0x59')](_0x5451a9[_0x14d0('0x5a')]);}})[_0x14d0('0x20')](respondWithResult(_0x415c95,null))[_0x14d0('0x58')](handleError(_0x415c95,null));};exports[_0x14d0('0x6c')]=function(_0x27d45b,_0x49b153,_0x3de209){var _0x113725={'raw':![],'where':{}};var _0x5db329={};var _0xbcfeb8={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x27d45b[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x49b153,null))[_0x14d0('0x20')](function(_0x179ca9){if(_0x179ca9){_0x5db329[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0x6d')]['rawAttributes']);_0x5db329['query']=_[_0x14d0('0x40')](_0x27d45b[_0x14d0('0x3f')]);_0x5db329[_0x14d0('0x41')]=_[_0x14d0('0x43')](_0x5db329[_0x14d0('0x3e')],_0x5db329['query']);_0x113725['attributes']=_[_0x14d0('0x43')](_0x5db329[_0x14d0('0x3e')],qs['fields'](_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x113725[_0x14d0('0x42')]=_0x113725[_0x14d0('0x42')]['length']?_0x113725[_0x14d0('0x42')]:_0x5db329[_0x14d0('0x3e')];if(!_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x113725[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x27d45b[_0x14d0('0x3f')]['limit']);_0x113725['offset']=qs[_0x14d0('0x47')](_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x113725[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x27d45b[_0x14d0('0x3f')]['sort']);_0x113725['where']=qs['filters'](_[_0x14d0('0x4b')](_0x27d45b[_0x14d0('0x3f')],_0x5db329['filters']));_0x113725[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0x179ca9['id'];if(_0x27d45b[_0x14d0('0x3f')]['filter']){_0x113725[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x113725['where'],{'$or':_['map'](_0x113725[_0x14d0('0x42')],function(_0x506684){var _0x43fe64={};_0x43fe64[_0x506684]={'$like':'%'+_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x43fe64;})});}_0x113725=_[_0x14d0('0x4d')]({},_0x113725,_0x27d45b['options']);return db[_0x14d0('0x6d')][_0x14d0('0x2d')]({'where':_0x113725['where']})[_0x14d0('0x20')](function(_0x596787){_0xbcfeb8[_0x14d0('0x2d')]=_0x596787;if(_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x113725[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x6d')]['findAll'](_0x113725);})[_0x14d0('0x20')](function(_0x3c1727){_0xbcfeb8[_0x14d0('0x54')]=_0x3c1727;return _0xbcfeb8;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0x49b153,_0x113725))[_0x14d0('0x58')](handleError(_0x49b153,null));};exports[_0x14d0('0x6e')]=function(_0x2d1b26,_0x43bcf0,_0x4e1604){return db['FaxAccount']['find']({'where':{'id':_0x2d1b26[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x43bcf0,null))[_0x14d0('0x20')](function(_0x236163){if(_0x236163){return _0x236163[_0x14d0('0x6e')](_0x2d1b26[_0x14d0('0x3f')][_0x14d0('0x6f')]);}})['then'](respondWithStatusCode(_0x43bcf0,null))['catch'](handleError(_0x43bcf0,null));};exports['addInteraction']=function(_0x479802,_0x30190a,_0x2663af){return db[_0x14d0('0x70')][_0x14d0('0x57')]({'where':{'id':_0x479802[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x30190a,null))[_0x14d0('0x20')](function(_0x277396){if(_0x277396){return _0x277396[_0x14d0('0x71')](_0x479802[_0x14d0('0x5a')][_0x14d0('0x6f')],_[_0x14d0('0x72')](_0x479802['body'],['ids','id'])||{});}})[_0x14d0('0x20')](respondWithResult(_0x30190a,null))[_0x14d0('0x58')](handleError(_0x30190a,null));};exports[_0x14d0('0x73')]=function(_0x2a56ec,_0x235fea,_0x52ee6f){var _0x46d7ac={'raw':![],'where':{}};var _0x2245d5={};var _0x4ff608={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x2a56ec[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x235fea,null))[_0x14d0('0x20')](function(_0x59b87a){if(_0x59b87a){_0x2245d5['model']=_['keys'](db[_0x14d0('0x70')]['rawAttributes']);_0x2245d5[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x2a56ec['query']);_0x2245d5[_0x14d0('0x41')]=_['intersection'](_0x2245d5[_0x14d0('0x3e')],_0x2245d5['query']);_0x46d7ac['attributes']=_[_0x14d0('0x43')](_0x2245d5[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x46d7ac[_0x14d0('0x42')]=_0x46d7ac[_0x14d0('0x42')][_0x14d0('0x45')]?_0x46d7ac['attributes']:_0x2245d5[_0x14d0('0x3e')];if(!_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x46d7ac[_0x14d0('0x2b')]=qs['limit'](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x46d7ac['offset']=qs[_0x14d0('0x47')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x46d7ac[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x46d7ac[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_['pick'](_0x2a56ec['query'],_0x2245d5[_0x14d0('0x41')]));_0x46d7ac[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0x59b87a['id'];if(_0x2a56ec['query'][_0x14d0('0x4c')]){_0x46d7ac[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x46d7ac[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x46d7ac[_0x14d0('0x42')],function(_0x5bbbca){var _0x3fbd29={};_0x3fbd29[_0x5bbbca]={'$like':'%'+_0x2a56ec['query'][_0x14d0('0x4c')]+'%'};return _0x3fbd29;})});}_0x46d7ac=_['merge']({},_0x46d7ac,_0x2a56ec['options']);return db['FaxInteraction'][_0x14d0('0x2d')]({'where':_0x46d7ac[_0x14d0('0x4a')]})[_0x14d0('0x20')](function(_0x3c804d){_0x4ff608[_0x14d0('0x2d')]=_0x3c804d;if(_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x46d7ac[_0x14d0('0x51')]=[{'model':db[_0x14d0('0x74')],'as':_0x14d0('0x75'),'required':![]},{'model':db[_0x14d0('0x76')],'as':'Owner','attributes':[_0x14d0('0x36'),_0x14d0('0x77'),_0x14d0('0x78')],'required':![]},{'model':db[_0x14d0('0x79')],'as':_0x14d0('0x7a'),'attributes':['id',_0x14d0('0x36'),_0x14d0('0x7b')],'where':_0x2a56ec['query']['tag']?{'id':_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x7c')]}:undefined,'required':_0x2a56ec['query'][_0x14d0('0x7c')]?!![]:![]}];}return db[_0x14d0('0x70')][_0x14d0('0x53')](_0x46d7ac);})[_0x14d0('0x20')](function(_0x2c0a56){_0x4ff608[_0x14d0('0x54')]=_0x2c0a56;return _0x4ff608;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0x235fea,_0x46d7ac))[_0x14d0('0x58')](handleError(_0x235fea,null));};exports[_0x14d0('0x7d')]=function(_0x2cff5a,_0x3a848e){var _0x117b82=_0x2cff5a['params']['id'];var _0x28e1d1=_0x2cff5a[_0x14d0('0x5a')];var _0x1151a8=0xc8;var _0x57db5c=null;return db[_0x14d0('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x14d0('0x7f')][_0x14d0('0x80')][_0x14d0('0x81')]},function(_0x4c51fc){return db[_0x14d0('0x52')]['findOne']({'where':{'id':_0x117b82},'transaction':_0x4c51fc})['then'](function(_0x1e70c4){if(_0x1e70c4){return db[_0x14d0('0x82')][_0x14d0('0x33')]({'where':{'FaxAccountId':_0x117b82},'transaction':_0x4c51fc})[_0x14d0('0x20')](function(){var _0x54031d=_['map'](_0x28e1d1,function(_0x3a6aca){_0x3a6aca[_0x14d0('0x6a')]=_0x117b82;return _0x3a6aca;});return db[_0x14d0('0x82')][_0x14d0('0x83')](_0x54031d,{'transaction':_0x4c51fc});});}else{_0x1151a8=0x194;_0x57db5c=[];}});})['then'](function(){if(_0x1151a8!==0x194){return db[_0x14d0('0x82')][_0x14d0('0x84')]({'where':{'FaxAccountId':_0x117b82},'order':_0x14d0('0x85')})[_0x14d0('0x20')](function(_0x321a93){_0x57db5c=_0x321a93;});}})['catch'](function(_0x2a4e40){_0x1151a8=0x1f4;logger[_0x14d0('0x24')](_0x2a4e40[_0x14d0('0x35')]);if(_0x2a4e40['name']){delete _0x2a4e40[_0x14d0('0x36')];}_0x57db5c=_0x2a4e40;})[_0x14d0('0x86')](function(){if(_0x57db5c===null){_0x3a848e['sendStatus'](_0x1151a8);}else{if(_0x1151a8===0x1f4){_0x3a848e[_0x14d0('0x29')](_0x1151a8)[_0x14d0('0x37')](_0x57db5c);}else{_0x3a848e[_0x14d0('0x29')](_0x1151a8)[_0x14d0('0x2a')](_0x57db5c);}}});};exports[_0x14d0('0x87')]=function(_0x3e0d7a,_0xcfd75e,_0x292451){var _0xe187a0={};var _0xbe2042={};var _0x2bb3e4;var _0x4d68fe;return db['FaxAccount'][_0x14d0('0x68')]({'where':{'id':_0x3e0d7a['params']['id']}})['then'](handleEntityNotFound(_0xcfd75e,null))[_0x14d0('0x20')](function(_0xa2567c){if(_0xa2567c){_0x2bb3e4=_0xa2567c;_0xbe2042['model']=_[_0x14d0('0x40')](db[_0x14d0('0x82')][_0x14d0('0x3b')]);_0xbe2042[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x3e0d7a[_0x14d0('0x3f')]);_0xbe2042[_0x14d0('0x41')]=_[_0x14d0('0x43')](_0xbe2042[_0x14d0('0x3e')],_0xbe2042['query']);_0xe187a0['attributes']=_[_0x14d0('0x43')](_0xbe2042[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x3e0d7a[_0x14d0('0x3f')]['fields']));_0xe187a0[_0x14d0('0x42')]=_0xe187a0[_0x14d0('0x42')][_0x14d0('0x45')]?_0xe187a0[_0x14d0('0x42')]:_0xbe2042[_0x14d0('0x3e')];_0xe187a0[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x3e0d7a['query']['sort']);_0xe187a0['where']=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x3e0d7a['query'],_0xbe2042[_0x14d0('0x41')]));if(_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0xe187a0[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0xe187a0['where'],{'$or':_[_0x14d0('0x3a')](_0xe187a0[_0x14d0('0x42')],function(_0x5baab8){var _0x336f39={};_0x336f39[_0x5baab8]={'$like':'%'+_0x3e0d7a['query'][_0x14d0('0x4c')]+'%'};return _0x336f39;})});}_0xe187a0=_[_0x14d0('0x4d')]({},_0xe187a0,_0x3e0d7a[_0x14d0('0x4f')]);return _0x2bb3e4[_0x14d0('0x87')](_0xe187a0);}})[_0x14d0('0x20')](function(_0x42e896){if(_0x42e896){_0x4d68fe=_0x42e896['length'];if(!_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x46')]('nolimit')){_0xe187a0[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0xe187a0[_0x14d0('0x47')]=qs['offset'](_0x3e0d7a['query'][_0x14d0('0x47')]);}return _0x2bb3e4[_0x14d0('0x87')](_0xe187a0);}})[_0x14d0('0x20')](function(_0x40ea82){if(_0x40ea82){return _0x40ea82?{'count':_0x4d68fe,'rows':_0x40ea82}:null;}})['then'](respondWithResult(_0xcfd75e,null))[_0x14d0('0x58')](handleError(_0xcfd75e,null));};function Extension(_0x5919fc,_0x583ba0,_0x49c0b6,_0x5c51e3){this['context']=_0x14d0('0x88');this[_0x14d0('0x89')]=_0x5919fc[_0x14d0('0x8a')];this[_0x14d0('0x8b')]=_0x5c51e3;this['type']='system';this[_0x14d0('0x8c')]=_0x14d0('0x8d');this[_0x14d0('0x6a')]=_0x5919fc['id'];this[_0x14d0('0x85')]=_0x583ba0;this[_0x14d0('0x8e')]=_0x49c0b6;}function createExtensionsReciveFax(_0x59aeba){var _0x23c3c6=0x1;var _0x195339=[];_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,'',_0x14d0('0x8f')));_0x23c3c6+=0x1;_0x195339[_0x14d0('0x90')](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x91'),_0x14d0('0x92')));_0x23c3c6+=0x1;for(var _0x53d3b0 in _0x59aeba){if(_0x59aeba[_0x14d0('0x46')](_0x53d3b0)&&(_0x53d3b0===_0x14d0('0x93')||_0x53d3b0===_0x14d0('0x8a')||_0x53d3b0===_0x14d0('0x94')||_0x53d3b0===_0x14d0('0x95')||_0x53d3b0===_0x14d0('0x96')||_0x53d3b0===_0x14d0('0x97')||_0x53d3b0===_0x14d0('0x98')||_0x53d3b0==='modem'||_0x53d3b0===_0x14d0('0x99'))){_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x9a')+_0x53d3b0+')='+_0x59aeba[_0x53d3b0],'Set'));_0x23c3c6+=0x1;}}_0x195339[_0x14d0('0x90')](new Extension(_0x59aeba,_0x23c3c6,'6',_0x14d0('0x9b')));_0x23c3c6+=0x1;_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x9c'),_0x14d0('0x9d')));_0x23c3c6=0x0;return _0x195339;}exports[_0x14d0('0x9e')]=function(_0x555ef1,_0x1c27c0,_0x5e8395){var _0x44e673;return db['sequelize']['transaction'](function(_0x435fb4){return db[_0x14d0('0x52')]['create'](_0x555ef1[_0x14d0('0x5a')],{'transaction':_0x435fb4})[_0x14d0('0x20')](function(_0xadf728){_0x44e673=_0xadf728[_0x14d0('0x5b')]({'plain':!![]});return db[_0x14d0('0x9f')][_0x14d0('0x83')](createExtensionsReciveFax(_0x44e673),{'transaction':_0x435fb4});});})[_0x14d0('0x20')](function(){return _0x44e673;})[_0x14d0('0x20')](respondWithResult(_0x1c27c0,null))['catch'](handleError(_0x1c27c0,null));};exports[_0x14d0('0xa0')]=function(_0x54b3ac,_0x1d18ca,_0xd8ebe7){var _0x31d129;return db[_0x14d0('0x7e')][_0x14d0('0xa1')](function(_0x442c68){return db['FaxAccount']['update'](_0x54b3ac['body'],{'where':{'id':_0x54b3ac[_0x14d0('0x5a')]['id']},'transaction':_0x442c68})[_0x14d0('0x20')](function(_0x5a2c84){return db[_0x14d0('0x9f')][_0x14d0('0x33')]({'where':{'FaxAccountId':_0x54b3ac[_0x14d0('0x5a')]['id']},'transaction':_0x442c68})[_0x14d0('0x20')](function(_0x1f4a80){return db[_0x14d0('0x9f')][_0x14d0('0x83')](createExtensionsReciveFax(_[_0x14d0('0x72')](_0x54b3ac[_0x14d0('0x5a')],[_0x14d0('0xa2'),_0x14d0('0x3d'),_0x14d0('0xa3'),_0x14d0('0xa4'),_0x14d0('0xa5'),_0x14d0('0xa6')])),{'transaction':_0x442c68});});});})[_0x14d0('0x20')](function(){return db[_0x14d0('0x52')][_0x14d0('0xa7')](_0x54b3ac[_0x14d0('0x5a')]['id']);})[_0x14d0('0x20')](respondWithResult(_0x1d18ca,null))['catch'](handleError(_0x1d18ca,null));};exports['getMessages']=function(_0x1e2826,_0xf30955,_0x221078){var _0x191989={'raw':!![],'where':{}};var _0x307b8e={};var _0x5261a9={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x1e2826[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0xf30955,null))[_0x14d0('0x20')](function(_0xb5c6a4){if(_0xb5c6a4){_0x307b8e[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0xa8')][_0x14d0('0x3b')]);_0x307b8e[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x1e2826['query']);_0x307b8e['filters']=_[_0x14d0('0x43')](_0x307b8e['model'],_0x307b8e[_0x14d0('0x3f')]);_0x191989[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x307b8e[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x191989[_0x14d0('0x42')]=_0x191989[_0x14d0('0x42')]['length']?_0x191989['attributes']:_0x307b8e[_0x14d0('0x3e')];if(!_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x191989['limit']=qs['limit'](_0x1e2826[_0x14d0('0x3f')]['limit']);_0x191989[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x1e2826['query']['offset']);}_0x191989[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x191989[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x1e2826['query'],_0x307b8e[_0x14d0('0x41')]));_0x191989[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0xb5c6a4['id'];if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x191989[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x191989['where'],{'$or':_[_0x14d0('0x3a')](_0x191989[_0x14d0('0x42')],function(_0x5b6871){var _0x292ba2={};_0x292ba2[_0x5b6871]={'$like':'%'+_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x292ba2;})});}if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0xa9')]){var _0x5b1809=_0x1e2826['query']['$gte'][_0x14d0('0xaa')](',');var _0x107992={};_0x107992[_0x5b1809[0x0]]={'$gte':moment(_0x5b1809[0x1])[_0x14d0('0xab')](_0x14d0('0xac'))};_0x191989[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x191989[_0x14d0('0x4a')],_0x107992);}_0x191989=_[_0x14d0('0x4d')]({},_0x191989,_0x1e2826['options']);return db[_0x14d0('0xa8')][_0x14d0('0x2d')]({'where':_0x191989[_0x14d0('0x4a')]})['then'](function(_0x375004){_0x5261a9[_0x14d0('0x2d')]=_0x375004;if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x191989[_0x14d0('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x14d0('0x53')](_0x191989);})[_0x14d0('0x20')](function(_0x4dad95){_0x5261a9[_0x14d0('0x54')]=_0x4dad95;return _0x5261a9;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0xf30955,_0x191989))['catch'](handleError(_0xf30955,null));};exports[_0x14d0('0x37')]=function(_0x18e255,_0x485870,_0x140255){var _0x406cd7,_0x54aeb7={},_0x3d03fb;if(_0x18e255['body']['to']){_0x3d03fb=_0x18e255['body']['to'][0x0];}return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0x18e255['params']['id']},'include':[{'model':db[_0x14d0('0xad')],'as':_0x14d0('0xae'),'include':[{'model':db[_0x14d0('0x74')],'as':_0x14d0('0xaf'),'where':{'fax':_0x3d03fb},'limit':0x1,'order':[[_0x14d0('0xa4'),_0x14d0('0xb0')]]}]}]})[_0x14d0('0x20')](handleEntityNotFound(_0x485870,null))[_0x14d0('0x20')](function(_0x598b3d){_0x406cd7=_0x598b3d;if(_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')]&&_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][_0x14d0('0x45')]){for(var _0xd77d3f=0x0;_0xd77d3f<_0x18e255['body'][_0x14d0('0xb1')][_0x14d0('0x45')];_0xd77d3f+=0x1){_0x18e255['body'][_0x14d0('0xb1')][_0xd77d3f]={'filename':_0x18e255['body']['attachments'][_0xd77d3f][_0x14d0('0x36')],'id':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][_0xd77d3f]['id'],'path':path[_0x14d0('0xb2')](config[_0x14d0('0xb3')],_0x14d0('0xb4'),_0x18e255['body'][_0x14d0('0xb1')][_0xd77d3f][_0x14d0('0xb5')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x63')]['id'])?undefined:_0x18e255[_0x14d0('0x63')]['id'],'path':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0x7')])?undefined:_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0][_0x14d0('0x7')],'fax':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['to'][0x0])?undefined:_0x18e255[_0x14d0('0x5a')]['to'][0x0]},client9002);})[_0x14d0('0x20')](function(){if(_0x406cd7){if(_[_0x14d0('0xb6')](_0x18e255['body'][_0x14d0('0xb7')])){_0x18e255['body'][_0x14d0('0xb7')]=util[_0x14d0('0xab')](_0x14d0('0xb8'),_0x406cd7[_0x14d0('0x36')],_0x406cd7[_0x14d0('0xb9')]);}if(_0x406cd7['List']){if(_0x406cd7[_0x14d0('0xae')][_0x14d0('0xaf')][_0x14d0('0x45')]){return _0x406cd7[_0x14d0('0xae')][_0x14d0('0xaf')][0x0];}else{return db[_0x14d0('0x74')][_0x14d0('0x59')](_[_0x14d0('0x19')](_0x18e255[_0x14d0('0x5a')],{'firstName':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'phone':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'fax':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'ListId':_0x406cd7['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x14d0('0x20')](function(_0x50cfe7){if(_0x50cfe7){return db[_0x14d0('0x70')][_0x14d0('0x57')]({'where':{'ContactId':_0x50cfe7['id'],'closed':![],'FaxAccountId':_0x406cd7['id']}})['then'](function(_0x3446b7){if(_0x3446b7){return[_0x3446b7,![]];}return db['FaxInteraction'][_0x14d0('0x59')]({'UserId':_0x18e255['user']['id'],'ContactId':_0x50cfe7['id'],'FaxAccountId':_0x406cd7['id'],'fax':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'firstMsgDirection':_0x14d0('0xba'),'Messages':[_['merge'](_0x18e255[_0x14d0('0x5a')],{'read':![],'body':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0][_0x14d0('0xbb')],'FaxAccountId':_0x406cd7['id'],'UserId':_0x18e255[_0x14d0('0x5e')]['id'],'ContactId':_0x50cfe7['id'],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x14d0('0x20')](function(_0x1b6312){return[_0x1b6312,!![]];});});}else{throw new Error(_0x14d0('0xbc'));}})[_0x14d0('0xbd')](function(_0x798f35,_0x5235a8){if(_0x5235a8){return _0x798f35;}return db['FaxMessage'][_0x14d0('0x59')]({'direction':_0x14d0('0xba'),'read':![],'body':_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0xbb')],'FaxAccountId':_0x406cd7['id'],'FaxInteractionId':_0x798f35['id'],'UserId':_0x18e255[_0x14d0('0x5e')]['id'],'ContactId':_0x798f35[_0x14d0('0xbe')],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']})[_0x14d0('0x20')](function(_0x135d2a){_0x798f35[_0x14d0('0xbf')][_0x14d0('0xc0')]=[];_0x798f35[_0x14d0('0xbf')]['Messages']['push'](_0x135d2a[_0x14d0('0xbf')]);return _0x798f35;});})[_0x14d0('0x20')](function(_0x35aa78){respondWithRpcPromise('SendFax',_0x14d0('0xc1'),{'FaxAccountId':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x63')]['id'])?undefined:_0x18e255[_0x14d0('0x63')]['id'],'path':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0x7')])?undefined:_0x18e255['body'][_0x14d0('0xb1')][0x0][_0x14d0('0x7')],'fax':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['to'][0x0])?undefined:_0x18e255[_0x14d0('0x5a')]['to'][0x0],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']},client9002)[_0x14d0('0x20')](function(_0x5a305f){logger['info'](_0x14d0('0xc2'),_0x5a305f);})[_0x14d0('0x58')](function(_0x5586e7){logger['info'](_0x14d0('0xc2'),_0x5586e7);});return _0x35aa78;})['then'](respondWithResult(_0x485870,null))[_0x14d0('0x58')](handleError(_0x485870,null));};exports['addAgents']=function(_0x4e3961,_0x3ee58a,_0xbaee9f){return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x4e3961['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x3ee58a,null))[_0x14d0('0x20')](function(_0x1a4c46){if(_0x1a4c46){return _0x1a4c46['addAgents'](_0x4e3961[_0x14d0('0x5a')][_0x14d0('0x6f')],_['omit'](_0x4e3961[_0x14d0('0x5a')],[_0x14d0('0x6f'),'id'])||{})['spread'](function(_0x3edbd2){for(var _0x3b4c1a=0x0;_0x3b4c1a<_0x4e3961[_0x14d0('0x5a')]['ids'][_0x14d0('0x45')];_0x3b4c1a+=0x1){socket[_0x14d0('0xc3')](_0x14d0('0xc4'),{'UserId':Number(_0x4e3961[_0x14d0('0x5a')][_0x14d0('0x6f')][_0x3b4c1a]),'FaxAccountId':Number(_0x4e3961[_0x14d0('0x63')]['id'])});}return _0x3edbd2;});}})[_0x14d0('0x20')](respondWithResult(_0x3ee58a,null))[_0x14d0('0x58')](handleError(_0x3ee58a,null));};exports[_0x14d0('0xc5')]=function(_0x2dd67d,_0x1c83fa,_0x54a20d){return db[_0x14d0('0x52')]['find']({'where':{'id':_0x2dd67d[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x1c83fa,null))[_0x14d0('0x20')](function(_0x4ac2bd){if(_0x4ac2bd){return _0x4ac2bd['removeAgents'](_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')])[_0x14d0('0x20')](function(){if(_[_0x14d0('0xc6')](_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')])){for(var _0x36725c=0x0;_0x36725c<_0x2dd67d[_0x14d0('0x3f')]['ids'][_0x14d0('0x45')];_0x36725c+=0x1){socket['emit'](_0x14d0('0xc7'),{'UserId':Number(_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')][_0x36725c]),'FaxAccountId':Number(_0x2dd67d[_0x14d0('0x63')]['id'])});}}else{socket['emit'](_0x14d0('0xc7'),{'UserId':Number(_0x2dd67d[_0x14d0('0x3f')]['ids']),'FaxAccountId':Number(_0x2dd67d[_0x14d0('0x63')]['id'])});}});}})[_0x14d0('0x20')](respondWithStatusCode(_0x1c83fa,null))[_0x14d0('0x58')](handleError(_0x1c83fa,null));};exports[_0x14d0('0xc8')]=function(_0x197bb2,_0x25951d,_0x423818){var _0x1270dd={};var _0x4de661={};var _0x3f843c;var _0x4af78e;return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x197bb2['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x25951d,null))[_0x14d0('0x20')](function(_0x409404){if(_0x409404){_0x3f843c=_0x409404;_0x4de661[_0x14d0('0x3e')]=_['keys'](db['User'][_0x14d0('0x3b')]);_0x4de661[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x197bb2[_0x14d0('0x3f')]);_0x4de661[_0x14d0('0x41')]=_['intersection'](_0x4de661['model'],_0x4de661[_0x14d0('0x3f')]);_0x1270dd[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x4de661['model'],qs['fields'](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x1270dd['attributes']=_0x1270dd[_0x14d0('0x42')][_0x14d0('0x45')]?_0x1270dd[_0x14d0('0x42')]:_0x4de661['model'];_0x1270dd['order']=qs[_0x14d0('0x49')](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x1270dd[_0x14d0('0x4a')]=qs['filters'](_['pick'](_0x197bb2[_0x14d0('0x3f')],_0x4de661[_0x14d0('0x41')]));if(_0x197bb2[_0x14d0('0x3f')]['filter']){_0x1270dd[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x1270dd[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x1270dd[_0x14d0('0x42')],function(_0x58daa8){var _0x22bc55={};_0x22bc55[_0x58daa8]={'$like':'%'+_0x197bb2[_0x14d0('0x3f')]['filter']+'%'};return _0x22bc55;})});}_0x1270dd=_['merge']({},_0x1270dd,_0x197bb2['options']);return _0x3f843c['getAgents'](_0x1270dd);}})[_0x14d0('0x20')](function(_0x3c1377){if(_0x3c1377){_0x4af78e=_0x3c1377[_0x14d0('0x45')];if(!_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x1270dd[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x197bb2[_0x14d0('0x3f')]['limit']);_0x1270dd[_0x14d0('0x47')]=qs['offset'](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x47')]);}return _0x3f843c[_0x14d0('0xc8')](_0x1270dd);}})[_0x14d0('0x20')](function(_0x5aec1a){if(_0x5aec1a){return _0x5aec1a?{'count':_0x4af78e,'rows':_0x5aec1a}:null;}})['then'](respondWithResult(_0x25951d,null))['catch'](handleError(_0x25951d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b65c196..7cd5532 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 _0x2801=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','remove'];(function(_0x45cd39,_0x33d895){var _0x149af5=function(_0x525493){while(--_0x525493){_0x45cd39['push'](_0x45cd39['shift']());}};_0x149af5(++_0x33d895);}(_0x2801,0xeb));var _0x1280=function(_0x243b6d,_0x5dcb94){_0x243b6d=_0x243b6d-0x0;var _0x52c5ce=_0x2801[_0x243b6d];return _0x52c5ce;};'use strict';var EventEmitter=require(_0x1280('0x0'));var FaxAccount=require(_0x1280('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1280('0x2')};function emitEvent(_0x5cf49){return function(_0x124087,_0x3e049f,_0x32b9e2){FaxAccountEvents[_0x1280('0x3')](_0x5cf49+':'+_0x124087['id'],_0x124087);FaxAccountEvents['emit'](_0x5cf49,_0x124087);_0x32b9e2(null);};}for(var e in events){if(events[_0x1280('0x4')](e)){var event=events[e];FaxAccount[_0x1280('0x5')](e,emitEvent(event));}}module[_0x1280('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x664b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','FaxAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x664b,0x66));var _0xb664=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x664b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xb664('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xb664('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb664('0x2')](0x0);var events={'afterCreate':_0xb664('0x3'),'afterUpdate':'update','afterDestroy':_0xb664('0x4')};function emitEvent(_0x45d86b){return function(_0x3937cb,_0x45efee,_0x208fa0){FaxAccountEvents[_0xb664('0x5')](_0x45d86b+':'+_0x3937cb['id'],_0x3937cb);FaxAccountEvents['emit'](_0x45d86b,_0x3937cb);_0x208fa0(null);};}for(var e in events){if(events[_0xb664('0x6')](e)){var event=events[e];FaxAccount[_0xb664('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b82cefb..a70988b 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 _0xb1b3=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes'];(function(_0x47a50a,_0x11cb7a){var _0x341c34=function(_0x1fce7f){while(--_0x1fce7f){_0x47a50a['push'](_0x47a50a['shift']());}};_0x341c34(++_0x11cb7a);}(_0xb1b3,0xe4));var _0x3b1b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb1b3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3b1b('0x0'));var util=require(_0x3b1b('0x1'));var logger=require(_0x3b1b('0x2'))(_0x3b1b('0x3'));var moment=require(_0x3b1b('0x4'));var BPromise=require(_0x3b1b('0x5'));var rp=require(_0x3b1b('0x6'));var fs=require('fs');var path=require(_0x3b1b('0x7'));var rimraf=require('rimraf');var config=require(_0x3b1b('0x8'));var attributes=require(_0x3b1b('0x9'));module[_0x3b1b('0xa')]=function(_0x408f1f,_0x1d7e2e){return _0x408f1f[_0x3b1b('0xb')](_0x3b1b('0xc'),attributes,{'tableName':_0x3b1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa73e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts','lodash','util'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xa73e,0x106));var _0xea73=function(_0x33749c,_0x26f380){_0x33749c=_0x33749c-0x0;var _0x4865a0=_0xa73e[_0x33749c];return _0x4865a0;};'use strict';var _=require(_0xea73('0x0'));var util=require(_0xea73('0x1'));var logger=require(_0xea73('0x2'))('api');var moment=require(_0xea73('0x3'));var BPromise=require(_0xea73('0x4'));var rp=require(_0xea73('0x5'));var fs=require('fs');var path=require(_0xea73('0x6'));var rimraf=require(_0xea73('0x7'));var config=require('../../config/environment');var attributes=require(_0xea73('0x8'));module[_0xea73('0x9')]=function(_0x49e489,_0x4bc525){return _0x49e489[_0xea73('0xa')]('FaxAccount',attributes,{'tableName':_0xea73('0xb'),'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 5b248b0..e12a022 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 _0x1788=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','Contacts','FaxApplication','Applications','List','get','applications','orderBy','priority','asc','account','length','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','limit','include','map','attributes','model','info','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x923e53,_0x2cc867){var _0x4d0120=function(_0x5995e1){while(--_0x5995e1){_0x923e53['push'](_0x923e53['shift']());}};_0x4d0120(++_0x2cc867);}(_0x1788,0xde));var _0x8178=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1788[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x8178('0x0'));var util=require('util');var moment=require(_0x8178('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8178('0x2'));var db=require(_0x8178('0x3'))['db'];var utils=require(_0x8178('0x4'));var logger=require(_0x8178('0x5'))(_0x8178('0x6'));var config=require(_0x8178('0x7'));var jayson=require(_0x8178('0x8'));var client=jayson[_0x8178('0x9')]['http']({'port':0x232c});config[_0x8178('0xa')]=_[_0x8178('0xb')](config['redis'],{'host':_0x8178('0xc'),'port':0x18eb});var socket=require(_0x8178('0xd'))(new Redis(config[_0x8178('0xa')]));require(_0x8178('0xe'))[_0x8178('0xf')](socket);function respondWithRpcPromise(_0x11fbcb,_0x2e3a15,_0x2de69a){return new BPromise(function(_0x14de83,_0x8fd9c6){return client[_0x8178('0x10')](_0x11fbcb,_0x2de69a)[_0x8178('0x11')](function(_0x5fa9c6){logger['info'](_0x8178('0x12'),_0x2e3a15,_0x8178('0x13'));logger[_0x8178('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2e3a15,_0x8178('0x13'),JSON[_0x8178('0x15')](_0x5fa9c6));if(_0x5fa9c6['error']){if(_0x5fa9c6[_0x8178('0x16')][_0x8178('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2e3a15,_0x5fa9c6[_0x8178('0x16')]['message']);return _0x8fd9c6(_0x5fa9c6[_0x8178('0x16')]['message']);}logger[_0x8178('0x16')](_0x8178('0x12'),_0x2e3a15,_0x5fa9c6[_0x8178('0x16')][_0x8178('0x18')]);return _0x14de83(_0x5fa9c6[_0x8178('0x16')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x2e3a15,_0x8178('0x13'));_0x14de83(_0x5fa9c6[_0x8178('0x19')]['message']);}})[_0x8178('0x1a')](function(_0x51ff9a){logger[_0x8178('0x16')](_0x8178('0x12'),_0x2e3a15,_0x51ff9a);_0x8fd9c6(_0x51ff9a);});});}exports[_0x8178('0x1b')]=function(_0x134719){var _0x463192=this;return new Promise(function(_0x396f96,_0xf148e9){return db[_0x8178('0x1c')][_0x8178('0x1d')]({'raw':_0x134719['options']?_0x134719[_0x8178('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')][_0x8178('0x1f')]||null:null,'attributes':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')]['attributes']||null:null,'limit':_0x134719['options']?_0x134719[_0x8178('0x1e')][_0x8178('0x20')]||null:null,'include':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')][_0x8178('0x21')]?_[_0x8178('0x22')](_0x134719[_0x8178('0x1e')][_0x8178('0x21')],function(_0xe60c63){return{'model':db[_0xe60c63['model']],'as':_0xe60c63['as'],'attributes':_0xe60c63[_0x8178('0x23')],'include':_0xe60c63['include']?_[_0x8178('0x22')](_0xe60c63[_0x8178('0x21')],function(_0x251ebc){return{'model':db[_0x251ebc[_0x8178('0x24')]],'as':_0x251ebc['as'],'attributes':_0x251ebc[_0x8178('0x23')],'include':_0x251ebc[_0x8178('0x21')]?_[_0x8178('0x22')](_0x251ebc[_0x8178('0x21')],function(_0x394440){return{'model':db[_0x394440[_0x8178('0x24')]],'as':_0x394440['as'],'attributes':_0x394440['attributes']};}):[]};}):[]};}):[]:[]})[_0x8178('0x11')](function(_0x2e6fb5){logger[_0x8178('0x25')](_0x8178('0x1b'),_0x134719);logger[_0x8178('0x14')](_0x8178('0x1b'),_0x134719,JSON[_0x8178('0x15')](_0x2e6fb5));_0x396f96(_0x2e6fb5);})['catch'](function(_0x2fff1e){logger[_0x8178('0x16')]('GetFaxAccount',_0x2fff1e['message'],_0x134719);_0xf148e9(_0x463192[_0x8178('0x16')](0x1f4,_0x2fff1e[_0x8178('0x18')]));});});};exports[_0x8178('0x26')]=function(_0xcfc17a,_0x4832a2,_0x40d728){var _0x4c1f88=this;return new Promise(function(_0x4548f8,_0x69d4ad){var _0x1e1213={'body':_0xcfc17a[_0x8178('0x27')],'channel':_0x8178('0x28')};var _0x5475a8=[];var _0x33bd9c=[];var _0x10082e={};return db[_0x8178('0x29')]['describe']()[_0x8178('0x11')](function(_0x39ee5a){if(!_0x39ee5a){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x2c'));}_0x5475a8=_[_0x8178('0x2d')](_[_0x8178('0x2e')](_0x39ee5a),[_0x8178('0x2f'),'updatedAt']);_0x33bd9c=_[_0x8178('0x2d')](_[_0x8178('0x2e')](_0x39ee5a),[_0x8178('0x2f'),_0x8178('0x30'),'CompanyId',_0x8178('0x31')]);if(_0xcfc17a[_0x8178('0x27')]['id']){delete _0xcfc17a[_0x8178('0x27')]['id'];}if(_[_0x8178('0x32')](_0xcfc17a['body'][_0x8178('0x33')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x34'));}if(_['isNil'](_0xcfc17a[_0x8178('0x27')]['body'])||_0xcfc17a[_0x8178('0x27')][_0x8178('0x27')]===''){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x35'));}if(_['isNil'](_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x37')+_0x33bd9c);}if(!_['includes'](_0x33bd9c,_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x38')+_0x33bd9c);}_0x10082e[_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')]]=_0xcfc17a['body'][_0x8178('0x33')];})['then'](function(){return db[_0x8178('0x1c')][_0x8178('0x39')]({'where':{'id':_0xcfc17a['account']['id']},'include':[{'model':db[_0x8178('0x3a')],'as':'List','include':[{'model':db[_0x8178('0x29')],'as':_0x8178('0x3b'),'where':_0x10082e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8178('0x3c')],'as':_0x8178('0x3d')}]});})[_0x8178('0x11')](function(_0x4c97e9){if(_0x4c97e9&&_0x4c97e9[_0x8178('0x3e')]){var _0x4ac60e=_0x4c97e9[_0x8178('0x3f')]({'plain':!![]});_0x1e1213['account']=_0x4ac60e;_0x1e1213[_0x8178('0x40')]=_0x4ac60e['Applications'];_0x1e1213['list']=_0x4ac60e['List'];_0x1e1213[_0x8178('0x40')]=_[_0x8178('0x41')](_0x1e1213[_0x8178('0x40')],[_0x8178('0x42')],[_0x8178('0x43')]);if(_0x1e1213[_0x8178('0x44')][_0x8178('0x3d')]){delete _0x1e1213[_0x8178('0x44')]['Applications'];}if(_0x1e1213['account'][_0x8178('0x3e')]&&_0x1e1213[_0x8178('0x44')][_0x8178('0x3e')]['Contacts'][_0x8178('0x45')]){return _0x1e1213['account'][_0x8178('0x3e')][_0x8178('0x3b')][0x0];}var _0x3ebc38=_['defaults'](_0xcfc17a['body'],{'firstName':_0xcfc17a['body']['from'],'ListId':_0x4ac60e[_0x8178('0x31')]});_0x3ebc38[_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')]]=_0xcfc17a[_0x8178('0x27')]['from'];return db[_0x8178('0x29')][_0x8178('0x46')](_0x3ebc38,{'fields':_0x5475a8,'raw':!![]});}})['then'](function(_0x531b51){_0x1e1213[_0x8178('0x47')]=_0x531b51;if(_0x531b51){var _0xa8f411={'ContactId':_0x531b51['id'],'FaxAccountId':_0xcfc17a[_0x8178('0x44')]['id'],'fax':_0x531b51['fax']};return db['FaxInteraction'][_0x8178('0x39')]({'where':{'ContactId':_0x531b51['id'],'closed':![],'FaxAccountId':_0xcfc17a[_0x8178('0x44')]['id']}})[_0x8178('0x11')](function(_0x4ead39){if(_0x4ead39){return[_0x4ead39,![]];}return db[_0x8178('0x48')][_0x8178('0x46')](_0xa8f411)[_0x8178('0x11')](function(_0xa2573e){return[_0xa2573e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8178('0x49')](function(_0x5ac3a6,_0x1aaec3){var _0x2db81f=_0x5ac3a6[_0x8178('0x3f')]({'plain':!![]});if(_0x1aaec3){if(_0x1e1213[_0x8178('0x44')][_0x8178('0x4a')]){_0x1e1213[_0x8178('0x40')][_0x8178('0x4b')]({'id':0x0,'priority':_0x1e1213[_0x8178('0x40')][_0x8178('0x45')]+0x1,'app':_0x8178('0x4c'),'appdata':_0x8178('0x4d'),'interval':_0x8178('0x4e')});}_0x2db81f[_0x8178('0x4f')]=!![];}else{_0x2db81f[_0x8178('0x4f')]=![];}_0x1e1213[_0x8178('0x50')]=_0x2db81f;return db['FaxMessage'][_0x8178('0x46')]({'body':_0xcfc17a[_0x8178('0x27')]['body'],'FaxAccountId':_0xcfc17a['account']['id'],'FaxInteractionId':_0x5ac3a6['id'],'direction':'in','ContactId':_0x5ac3a6[_0x8178('0x51')],'AttachmentId':_0xcfc17a['body'][_0x8178('0x52')]});})[_0x8178('0x11')](function(_0x4ea6a6){_0x1e1213[_0x8178('0x18')]=_0x4ea6a6;if(!_0x1e1213[_0x8178('0x50')][_0x8178('0x53')])return;return db['User']['find']({'attributes':['id',_0x8178('0x54')],'where':{'id':_0x1e1213[_0x8178('0x50')][_0x8178('0x53')]}});})['then'](function(_0x888698){if(_0x888698){_0x1e1213['applications'][_0x8178('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x888698[_0x8178('0x54')]+','+(_0x1e1213[_0x8178('0x44')][_0x8178('0x56')]||0xa),'interval':_0x8178('0x4e')});}if(!_0x1e1213[_0x8178('0x50')][_0x8178('0x57')])return;return db[_0x8178('0x58')][_0x8178('0x39')]({'attributes':['id',_0x8178('0x54')],'where':{'id':_0x1e1213[_0x8178('0x50')][_0x8178('0x57')]}});})['then'](function(_0x34630e){if(_0x34630e){_0x1e1213[_0x8178('0x40')][_0x8178('0x55')]({'id':0x0,'priority':0x1,'app':_0x8178('0x59'),'appdata':_0x34630e['name']+','+(_0x1e1213[_0x8178('0x44')][_0x8178('0x5a')]||0x12c),'interval':_0x8178('0x4e')});}return respondWithRpcPromise(_0x8178('0x5b'),'startRouting',_0x1e1213);})[_0x8178('0x11')](function(_0x5eb61b){_0x4548f8(_0x5eb61b);})[_0x8178('0x1a')](function(_0x2d82f7){_0x69d4ad(_0x4c1f88[_0x8178('0x16')](0x1f4,_0x2d82f7[_0x8178('0x18')]));});});}; \ No newline at end of file +var _0x5847=['Contact\x20not\x20found','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','FaxQueue','name','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','CmContact','Contacts','Applications','get','list','applications','orderBy','priority','ListId','create','contact'];(function(_0x35d537,_0x660101){var _0x1c6b31=function(_0x44ca96){while(--_0x44ca96){_0x35d537['push'](_0x35d537['shift']());}};_0x1c6b31(++_0x660101);}(_0x5847,0x196));var _0x7584=function(_0x578cd4,_0x359493){_0x578cd4=_0x578cd4-0x0;var _0x53606b=_0x5847[_0x578cd4];return _0x53606b;};'use strict';var _=require(_0x7584('0x0'));var util=require('util');var moment=require(_0x7584('0x1'));var BPromise=require(_0x7584('0x2'));var rs=require(_0x7584('0x3'));var fs=require('fs');var Redis=require(_0x7584('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7584('0x5'));var logger=require(_0x7584('0x6'))(_0x7584('0x7'));var config=require(_0x7584('0x8'));var jayson=require(_0x7584('0x9'));var client=jayson[_0x7584('0xa')][_0x7584('0xb')]({'port':0x232c});config[_0x7584('0xc')]=_[_0x7584('0xd')](config[_0x7584('0xc')],{'host':_0x7584('0xe'),'port':0x18eb});var socket=require(_0x7584('0xf'))(new Redis(config[_0x7584('0xc')]));require(_0x7584('0x10'))[_0x7584('0x11')](socket);function respondWithRpcPromise(_0x4dadfb,_0x2caa0e,_0x35cc0c){return new BPromise(function(_0xd957b7,_0x45034a){return client['request'](_0x4dadfb,_0x35cc0c)[_0x7584('0x12')](function(_0xc7bda2){logger[_0x7584('0x13')](_0x7584('0x14'),_0x2caa0e,_0x7584('0x15'));logger[_0x7584('0x16')](_0x7584('0x17'),_0x2caa0e,_0x7584('0x15'),JSON[_0x7584('0x18')](_0xc7bda2));if(_0xc7bda2['error']){if(_0xc7bda2[_0x7584('0x19')][_0x7584('0x1a')]===0x1f4){logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0xc7bda2[_0x7584('0x19')]['message']);return _0x45034a(_0xc7bda2[_0x7584('0x19')]['message']);}logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0xc7bda2['error'][_0x7584('0x1b')]);return _0xd957b7(_0xc7bda2['error'][_0x7584('0x1b')]);}else{logger[_0x7584('0x13')](_0x7584('0x14'),_0x2caa0e,'request\x20sent');_0xd957b7(_0xc7bda2[_0x7584('0x1c')][_0x7584('0x1b')]);}})['catch'](function(_0x4881db){logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0x4881db);_0x45034a(_0x4881db);});});}exports['GetFaxAccount']=function(_0x1148ff){var _0x400b58=this;return new Promise(function(_0x47ed15,_0x260ffb){return db['FaxAccount'][_0x7584('0x1d')]({'raw':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x1f')]===undefined?!![]:![]:!![],'where':_0x1148ff[_0x7584('0x1e')]?_0x1148ff[_0x7584('0x1e')][_0x7584('0x20')]||null:null,'attributes':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x21')]||null:null,'limit':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x22')]||null:null,'include':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x23')]?_[_0x7584('0x24')](_0x1148ff[_0x7584('0x1e')][_0x7584('0x23')],function(_0x2e8e74){return{'model':db[_0x2e8e74[_0x7584('0x25')]],'as':_0x2e8e74['as'],'attributes':_0x2e8e74[_0x7584('0x21')],'include':_0x2e8e74[_0x7584('0x23')]?_[_0x7584('0x24')](_0x2e8e74['include'],function(_0x25e979){return{'model':db[_0x25e979[_0x7584('0x25')]],'as':_0x25e979['as'],'attributes':_0x25e979[_0x7584('0x21')],'include':_0x25e979[_0x7584('0x23')]?_['map'](_0x25e979[_0x7584('0x23')],function(_0x373574){return{'model':db[_0x373574[_0x7584('0x25')]],'as':_0x373574['as'],'attributes':_0x373574[_0x7584('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7584('0x12')](function(_0x1f4a84){logger[_0x7584('0x13')]('GetFaxAccount',_0x1148ff);logger[_0x7584('0x16')](_0x7584('0x26'),_0x1148ff,JSON[_0x7584('0x18')](_0x1f4a84));_0x47ed15(_0x1f4a84);})[_0x7584('0x27')](function(_0x330d78){logger[_0x7584('0x19')](_0x7584('0x26'),_0x330d78['message'],_0x1148ff);_0x260ffb(_0x400b58[_0x7584('0x19')](0x1f4,_0x330d78[_0x7584('0x1b')]));});});};exports[_0x7584('0x28')]=function(_0x5ee3f0,_0x30fe73,_0x2588e0){var _0x54cee6=this;return new Promise(function(_0x116aef,_0xcc1ef7){var _0xf5f4e4={'body':_0x5ee3f0[_0x7584('0x29')],'channel':_0x7584('0x2a')};var _0x3bc4d0=[];var _0xd72206=[];var _0x515bd3={};return db['CmContact']['describe']()[_0x7584('0x12')](function(_0x5a7e9b){if(!_0x5a7e9b){throw new db['Sequelize'][(_0x7584('0x2b'))](_0x7584('0x2c'));}_0x3bc4d0=_['difference'](_[_0x7584('0x2d')](_0x5a7e9b),[_0x7584('0x2e'),_0x7584('0x2f')]);_0xd72206=_[_0x7584('0x30')](_[_0x7584('0x2d')](_0x5a7e9b),[_0x7584('0x2e'),'updatedAt',_0x7584('0x31'),'ListId']);if(_0x5ee3f0[_0x7584('0x29')]['id']){delete _0x5ee3f0[_0x7584('0x29')]['id'];}if(_['isNil'](_0x5ee3f0[_0x7584('0x29')][_0x7584('0x32')])){throw new db[(_0x7584('0x33'))][(_0x7584('0x2b'))](_0x7584('0x34'));}if(_[_0x7584('0x35')](_0x5ee3f0[_0x7584('0x29')]['body'])||_0x5ee3f0[_0x7584('0x29')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')])){throw new db['Sequelize']['ValidationError'](_0x7584('0x37')+_0xd72206);}if(!_[_0x7584('0x38')](_0xd72206,_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')])){throw new db['Sequelize'][(_0x7584('0x2b'))](_0x7584('0x39')+_0xd72206);}_0x515bd3[_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')]]=_0x5ee3f0[_0x7584('0x29')]['from'];})['then'](function(){return db[_0x7584('0x3a')][_0x7584('0x3b')]({'where':{'id':_0x5ee3f0[_0x7584('0x3c')]['id']},'include':[{'model':db[_0x7584('0x3d')],'as':_0x7584('0x3e'),'include':[{'model':db[_0x7584('0x3f')],'as':_0x7584('0x40'),'where':_0x515bd3,'limit':0x1,'order':[[_0x7584('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x7584('0x41')}]});})[_0x7584('0x12')](function(_0x5bc962){if(_0x5bc962&&_0x5bc962[_0x7584('0x3e')]){var _0x3f2ed9=_0x5bc962[_0x7584('0x42')]({'plain':!![]});_0xf5f4e4[_0x7584('0x3c')]=_0x3f2ed9;_0xf5f4e4['applications']=_0x3f2ed9[_0x7584('0x41')];_0xf5f4e4[_0x7584('0x43')]=_0x3f2ed9[_0x7584('0x3e')];_0xf5f4e4[_0x7584('0x44')]=_[_0x7584('0x45')](_0xf5f4e4[_0x7584('0x44')],[_0x7584('0x46')],['asc']);if(_0xf5f4e4['account'][_0x7584('0x41')]){delete _0xf5f4e4[_0x7584('0x3c')]['Applications'];}if(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x3e')]&&_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x3e')][_0x7584('0x40')]['length']){return _0xf5f4e4[_0x7584('0x3c')]['List']['Contacts'][0x0];}var _0x460ab4=_[_0x7584('0xd')](_0x5ee3f0[_0x7584('0x29')],{'firstName':_0x5ee3f0[_0x7584('0x29')]['from'],'ListId':_0x3f2ed9[_0x7584('0x47')]});_0x460ab4[_0x5ee3f0['body'][_0x7584('0x36')]]=_0x5ee3f0[_0x7584('0x29')][_0x7584('0x32')];return db[_0x7584('0x3f')][_0x7584('0x48')](_0x460ab4,{'fields':_0x3bc4d0,'raw':!![]});}})['then'](function(_0x3656cc){_0xf5f4e4[_0x7584('0x49')]=_0x3656cc;if(_0x3656cc){var _0x8f3aa4={'ContactId':_0x3656cc['id'],'FaxAccountId':_0x5ee3f0['account']['id'],'fax':_0x3656cc[_0x7584('0x2a')]};return db['FaxInteraction'][_0x7584('0x3b')]({'where':{'ContactId':_0x3656cc['id'],'closed':![],'FaxAccountId':_0x5ee3f0[_0x7584('0x3c')]['id']}})[_0x7584('0x12')](function(_0x5bc5fa){if(_0x5bc5fa){return[_0x5bc5fa,![]];}return db['FaxInteraction'][_0x7584('0x48')](_0x8f3aa4)['then'](function(_0xa3f12){return[_0xa3f12,!![]];});});}else{throw new Error(_0x7584('0x4a'));}})['spread'](function(_0x12f5ca,_0x3688e2){var _0x455142=_0x12f5ca[_0x7584('0x42')]({'plain':!![]});if(_0x3688e2){if(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x4b')]){_0xf5f4e4[_0x7584('0x44')]['push']({'id':0x0,'priority':_0xf5f4e4[_0x7584('0x44')][_0x7584('0x4c')]+0x1,'app':_0x7584('0x4d'),'appdata':_0x7584('0x4e'),'interval':_0x7584('0x4f')});}_0x455142[_0x7584('0x50')]=!![];}else{_0x455142[_0x7584('0x50')]=![];}_0xf5f4e4[_0x7584('0x51')]=_0x455142;return db[_0x7584('0x52')][_0x7584('0x48')]({'body':_0x5ee3f0[_0x7584('0x29')][_0x7584('0x29')],'FaxAccountId':_0x5ee3f0[_0x7584('0x3c')]['id'],'FaxInteractionId':_0x12f5ca['id'],'direction':'in','ContactId':_0x12f5ca[_0x7584('0x53')],'AttachmentId':_0x5ee3f0['body'][_0x7584('0x54')]});})['then'](function(_0x16003d){_0xf5f4e4[_0x7584('0x1b')]=_0x16003d;if(!_0xf5f4e4[_0x7584('0x51')]['UserId'])return;return db[_0x7584('0x55')][_0x7584('0x3b')]({'attributes':['id','name'],'where':{'id':_0xf5f4e4[_0x7584('0x51')][_0x7584('0x56')]}});})[_0x7584('0x12')](function(_0xe3f167){if(_0xe3f167){_0xf5f4e4['applications'][_0x7584('0x57')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe3f167['name']+','+(_0xf5f4e4['account'][_0x7584('0x58')]||0xa),'interval':_0x7584('0x4f')});}if(!_0xf5f4e4[_0x7584('0x51')][_0x7584('0x59')])return;return db[_0x7584('0x5a')]['find']({'attributes':['id',_0x7584('0x5b')],'where':{'id':_0xf5f4e4['interaction'][_0x7584('0x59')]}});})[_0x7584('0x12')](function(_0x488527){if(_0x488527){_0xf5f4e4[_0x7584('0x44')][_0x7584('0x57')]({'id':0x0,'priority':0x1,'app':_0x7584('0x5c'),'appdata':_0x488527[_0x7584('0x5b')]+','+(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x5d')]||0x12c),'interval':_0x7584('0x4f')});}return respondWithRpcPromise(_0x7584('0x5e'),_0x7584('0x5f'),_0xf5f4e4);})[_0x7584('0x12')](function(_0x22ea5e){_0x116aef(_0x22ea5e);})[_0x7584('0x27')](function(_0x9316c3){_0xcc1ef7(_0x54cee6['error'](0x1f4,_0x9316c3[_0x7584('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9d4a078..519457d 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 _0xccf6=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x5c847e,_0x3fa827){var _0x17988b=function(_0x5224ff){while(--_0x5224ff){_0x5c847e['push'](_0x5c847e['shift']());}};_0x17988b(++_0x3fa827);}(_0xccf6,0xab));var _0x6ccf=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xccf6[_0xa388a2];return _0x7ce7f6;};'use strict';var FaxAccountEvents=require(_0x6ccf('0x0'));var events=[_0x6ccf('0x1'),_0x6ccf('0x2'),_0x6ccf('0x3')];function createListener(_0x569211,_0x48eaf0){return function(_0x420d7f){_0x48eaf0[_0x6ccf('0x4')](_0x569211,_0x420d7f);};}function removeListener(_0x1b33e3,_0x3b1894){return function(){FaxAccountEvents[_0x6ccf('0x5')](_0x1b33e3,_0x3b1894);};}exports['register']=function(_0x3541e7){for(var _0x63c0a3=0x0,_0x28567c=events[_0x6ccf('0x6')];_0x63c0a3<_0x28567c;_0x63c0a3++){var _0x2903a8=events[_0x63c0a3];var _0x3b4299=createListener(_0x6ccf('0x7')+_0x2903a8,_0x3541e7);FaxAccountEvents['on'](_0x2903a8,_0x3b4299);}}; \ No newline at end of file +var _0x54e6=['length','faxAccount:','./faxAccount.events','remove','update','register'];(function(_0x23bf67,_0x564d3d){var _0x8f2df5=function(_0x5e31b1){while(--_0x5e31b1){_0x23bf67['push'](_0x23bf67['shift']());}};_0x8f2df5(++_0x564d3d);}(_0x54e6,0x9e));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var FaxAccountEvents=require(_0x654e('0x0'));var events=['save',_0x654e('0x1'),_0x654e('0x2')];function createListener(_0x4e5771,_0xa81aec){return function(_0x4d300d){_0xa81aec['emit'](_0x4e5771,_0x4d300d);};}function removeListener(_0x114412,_0x42cd5d){return function(){FaxAccountEvents['removeListener'](_0x114412,_0x42cd5d);};}exports[_0x654e('0x3')]=function(_0x27a76e){for(var _0x3942ba=0x0,_0x47c9a2=events[_0x654e('0x4')];_0x3942ba<_0x47c9a2;_0x3942ba++){var _0x3cb9a0=events[_0x3942ba];var _0x34f9ea=createListener(_0x654e('0x5')+_0x3cb9a0,_0x27a76e);FaxAccountEvents['on'](_0x3cb9a0,_0x34f9ea);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index cff5b05..0f3ada9 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 _0x72d7=['getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/interactions','getInteractions','/:id/applications','getMessages'];(function(_0x24371e,_0x43c47b){var _0x581a8e=function(_0x488019){while(--_0x488019){_0x24371e['push'](_0x24371e['shift']());}};_0x581a8e(++_0x43c47b);}(_0x72d7,0x81));var _0x772d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x72d7[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x772d('0x0'));var util=require('util');var path=require(_0x772d('0x1'));var timeout=require(_0x772d('0x2'));var express=require(_0x772d('0x3'));var router=express[_0x772d('0x4')]();var fs_extra=require(_0x772d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x772d('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x772d('0x7')]('/',auth[_0x772d('0x8')](),controller['index']);router[_0x772d('0x7')]('/describe',auth[_0x772d('0x8')](),controller['describe']);router[_0x772d('0x7')](_0x772d('0x9'),auth['isAuthenticated'](),controller[_0x772d('0xa')]);router[_0x772d('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x772d('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x772d('0xb'),auth[_0x772d('0x8')](),controller[_0x772d('0xc')]);router[_0x772d('0x7')](_0x772d('0xd'),auth[_0x772d('0x8')](),controller['getApplications']);router[_0x772d('0x7')]('/:id/messages',auth[_0x772d('0x8')](),controller[_0x772d('0xe')]);router[_0x772d('0x7')]('/:id/users',auth[_0x772d('0x8')](),controller[_0x772d('0xf')]);router[_0x772d('0x10')]('/',auth['isAuthenticated'](),controller[_0x772d('0x11')]);router['post']('/:id/dispositions',auth[_0x772d('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x772d('0x8')](),controller[_0x772d('0x12')]);router[_0x772d('0x10')](_0x772d('0xb'),auth[_0x772d('0x8')](),controller[_0x772d('0x13')]);router[_0x772d('0x10')]('/:id/applications',auth[_0x772d('0x8')](),controller[_0x772d('0x14')]);router[_0x772d('0x10')](_0x772d('0x15'),auth['isAuthenticated'](),controller[_0x772d('0x16')]);router[_0x772d('0x10')]('/updateaccountapplications',auth[_0x772d('0x8')](),controller['updateAccountApplications']);router[_0x772d('0x10')](_0x772d('0x17'),auth[_0x772d('0x8')](),controller[_0x772d('0x18')]);router[_0x772d('0x10')](_0x772d('0x19'),auth[_0x772d('0x8')](),controller[_0x772d('0x1a')]);router[_0x772d('0x1b')](_0x772d('0x9'),auth[_0x772d('0x8')](),controller[_0x772d('0x1c')]);router[_0x772d('0x1d')](_0x772d('0x9'),auth[_0x772d('0x8')](),controller[_0x772d('0x1e')]);router[_0x772d('0x1d')](_0x772d('0x1f'),auth[_0x772d('0x8')](),controller[_0x772d('0x20')]);router[_0x772d('0x1d')](_0x772d('0x21'),auth[_0x772d('0x8')](),controller['removeAnswers']);router[_0x772d('0x1d')]('/:id/users',auth[_0x772d('0x8')](),controller[_0x772d('0x22')]);module[_0x772d('0x23')]=router; \ No newline at end of file +var _0x0651=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a19e7,_0x53aa4d){var _0xdb7b37=function(_0x13396c){while(--_0x13396c){_0x2a19e7['push'](_0x2a19e7['shift']());}};_0xdb7b37(++_0x53aa4d);}(_0x0651,0x1d8));var _0x1065=function(_0x153db7,_0x270de5){_0x153db7=_0x153db7-0x0;var _0x4116e1=_0x0651[_0x153db7];return _0x4116e1;};'use strict';var multer=require(_0x1065('0x0'));var util=require(_0x1065('0x1'));var path=require(_0x1065('0x2'));var timeout=require(_0x1065('0x3'));var express=require(_0x1065('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1065('0x5'));var interaction=require(_0x1065('0x6'));var config=require(_0x1065('0x7'));var controller=require('./faxAccount.controller');router[_0x1065('0x8')]('/',auth[_0x1065('0x9')](),controller[_0x1065('0xa')]);router['get'](_0x1065('0xb'),auth[_0x1065('0x9')](),controller[_0x1065('0xc')]);router[_0x1065('0x8')](_0x1065('0xd'),auth['isAuthenticated'](),controller[_0x1065('0xe')]);router[_0x1065('0x8')](_0x1065('0xf'),auth[_0x1065('0x9')](),controller['getDispositions']);router[_0x1065('0x8')](_0x1065('0x10'),auth[_0x1065('0x9')](),controller[_0x1065('0x11')]);router[_0x1065('0x8')](_0x1065('0x12'),auth['isAuthenticated'](),controller[_0x1065('0x13')]);router[_0x1065('0x8')](_0x1065('0x14'),auth[_0x1065('0x9')](),controller[_0x1065('0x15')]);router[_0x1065('0x8')]('/:id/messages',auth[_0x1065('0x9')](),controller[_0x1065('0x16')]);router[_0x1065('0x8')](_0x1065('0x17'),auth[_0x1065('0x9')](),controller['getAgents']);router[_0x1065('0x18')]('/',auth[_0x1065('0x9')](),controller['create']);router[_0x1065('0x18')]('/:id/dispositions',auth[_0x1065('0x9')](),controller[_0x1065('0x19')]);router[_0x1065('0x18')](_0x1065('0x10'),auth[_0x1065('0x9')](),controller[_0x1065('0x1a')]);router[_0x1065('0x18')]('/:id/interactions',auth[_0x1065('0x9')](),controller['addInteraction']);router['post'](_0x1065('0x14'),auth[_0x1065('0x9')](),controller[_0x1065('0x1b')]);router[_0x1065('0x18')](_0x1065('0x1c'),auth[_0x1065('0x9')](),controller[_0x1065('0x1d')]);router[_0x1065('0x18')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x1065('0x1e')]);router['post'](_0x1065('0x1f'),auth[_0x1065('0x9')](),controller[_0x1065('0x20')]);router[_0x1065('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x1065('0x21')](_0x1065('0xd'),auth['isAuthenticated'](),controller[_0x1065('0x22')]);router[_0x1065('0x23')]('/:id',auth[_0x1065('0x9')](),controller[_0x1065('0x24')]);router['delete']('/:id/dispositions',auth[_0x1065('0x9')](),controller[_0x1065('0x25')]);router[_0x1065('0x23')](_0x1065('0x10'),auth['isAuthenticated'](),controller[_0x1065('0x26')]);router[_0x1065('0x23')]('/:id/users',auth[_0x1065('0x9')](),controller['removeAgents']);module[_0x1065('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 197b72f..8fee4b9 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 _0x83d6=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x3b7ace,_0x4a4abb){var _0x45b29c=function(_0x5b003b){while(--_0x5b003b){_0x3b7ace['push'](_0x3b7ace['shift']());}};_0x45b29c(++_0x4a4abb);}(_0x83d6,0xe9));var _0x683d=function(_0x17f0fb,_0x320fef){_0x17f0fb=_0x17f0fb-0x0;var _0x24f2c8=_0x83d6[_0x17f0fb];return _0x24f2c8;};'use strict';var Sequelize=require(_0x683d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x683d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x683d('0x2')},'appdata':{'type':Sequelize[_0x683d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x683d('0x4')],'defaultValue':_0x683d('0x5')}}; \ No newline at end of file +var _0x43ed=['*,*,*,*','STRING','TEXT'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0x43ed,0xd0));var _0xd43e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x43ed[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd43e('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd43e('0x1')]()},'description':{'type':Sequelize[_0xd43e('0x0')]},'interval':{'type':Sequelize[_0xd43e('0x0')],'defaultValue':_0xd43e('0x2')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c1dbb1c..fa82b79 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 _0x4b50=['error','stack','name','send','FaxApplication','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','filters','include','find','create','body','destroy','eml-format','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0xd8e357,_0x5ca985){var _0x1148c4=function(_0x133ebb){while(--_0x133ebb){_0xd8e357['push'](_0xd8e357['shift']());}};_0x1148c4(++_0x5ca985);}(_0x4b50,0xaf));var _0x04b5=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x4b50[_0x2d61ac];return _0x3f7d3c;};'use strict';var emlformat=require(_0x04b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x04b5('0x1'));var moment=require(_0x04b5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x04b5('0x3'));var util=require(_0x04b5('0x4'));var path=require(_0x04b5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x04b5('0x6'));var fs=require('fs');var fs_extra=require(_0x04b5('0x7'));var _=require(_0x04b5('0x8'));var squel=require(_0x04b5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04b5('0xa'));var querystring=require('querystring');var Papa=require(_0x04b5('0xb'));var Redis=require('ioredis');var authService=require(_0x04b5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x04b5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x04b5('0xe'));var utils=require(_0x04b5('0xf'));var config=require(_0x04b5('0x10'));var licenseUtil=require(_0x04b5('0x11'));var db=require(_0x04b5('0x12'))['db'];function respondWithStatusCode(_0x473f64,_0x3d1ad5){_0x3d1ad5=_0x3d1ad5||0xcc;return function(_0x302267){if(_0x302267){return _0x473f64[_0x04b5('0x13')](_0x3d1ad5);}return _0x473f64[_0x04b5('0x14')](_0x3d1ad5)[_0x04b5('0x15')]();};}function respondWithResult(_0x5e3614,_0x20889f){_0x20889f=_0x20889f||0xc8;return function(_0x2dd0c1){if(_0x2dd0c1){return _0x5e3614[_0x04b5('0x14')](_0x20889f)[_0x04b5('0x16')](_0x2dd0c1);}};}function respondWithFilteredResult(_0x38e66f,_0x4f0cb0){return function(_0x5723f2){if(_0x5723f2){var _0x1aed30=typeof _0x4f0cb0['offset']===_0x04b5('0x17')&&typeof _0x4f0cb0[_0x04b5('0x18')]===_0x04b5('0x17');var _0x1ba37b=_0x5723f2[_0x04b5('0x19')];var _0x1533e6=_0x1aed30?0x0:_0x4f0cb0['offset'];var _0x377a92=_0x1aed30?_0x5723f2['count']:_0x4f0cb0['offset']+_0x4f0cb0[_0x04b5('0x18')];var _0x463e6c;if(_0x377a92>=_0x1ba37b){_0x377a92=_0x1ba37b;_0x463e6c=0xc8;}else{_0x463e6c=0xce;}_0x38e66f['status'](_0x463e6c);return _0x38e66f[_0x04b5('0x1a')](_0x04b5('0x1b'),_0x1533e6+'-'+_0x377a92+'/'+_0x1ba37b)['json'](_0x5723f2);}return null;};}function patchUpdates(_0x3583c9){return function(_0x32cde6){try{jsonpatch['apply'](_0x32cde6,_0x3583c9,!![]);}catch(_0x2983a3){return BPromise[_0x04b5('0x1c')](_0x2983a3);}return _0x32cde6[_0x04b5('0x1d')]();};}function saveUpdates(_0x541a8c,_0x11d1a5){return function(_0x4dfbc0){if(_0x4dfbc0){return _0x4dfbc0[_0x04b5('0x1e')](_0x541a8c)[_0x04b5('0x1f')](function(_0x4ec056){return _0x4ec056;});}return null;};}function removeEntity(_0x589c98,_0x441888){return function(_0x3c4d11){if(_0x3c4d11){return _0x3c4d11['destroy']()['then'](function(){_0x589c98[_0x04b5('0x14')](0xcc)[_0x04b5('0x15')]();});}};}function handleEntityNotFound(_0x5d9df1,_0x4cdce3){return function(_0x49acc8){if(!_0x49acc8){_0x5d9df1[_0x04b5('0x13')](0x194);}return _0x49acc8;};}function handleError(_0x177017,_0xd7701b){_0xd7701b=_0xd7701b||0x1f4;return function(_0x40a3c4){logger[_0x04b5('0x20')](_0x40a3c4[_0x04b5('0x21')]);if(_0x40a3c4[_0x04b5('0x22')]){delete _0x40a3c4[_0x04b5('0x22')];}_0x177017['status'](_0xd7701b)[_0x04b5('0x23')](_0x40a3c4);};}exports['index']=function(_0x3ad63d,_0x1a787c){var _0x55b060={},_0x357c47={},_0x2de686={'count':0x0,'rows':[]};var _0x3782a9=_['map'](db[_0x04b5('0x24')][_0x04b5('0x25')],function(_0x4c39ec){return{'name':_0x4c39ec['fieldName'],'type':_0x4c39ec[_0x04b5('0x26')][_0x04b5('0x27')]};});_0x357c47[_0x04b5('0x28')]=_[_0x04b5('0x29')](_0x3782a9,_0x04b5('0x22'));_0x357c47[_0x04b5('0x2a')]=_[_0x04b5('0x2b')](_0x3ad63d[_0x04b5('0x2a')]);_0x357c47['filters']=_[_0x04b5('0x2c')](_0x357c47['model'],_0x357c47[_0x04b5('0x2a')]);_0x55b060[_0x04b5('0x2d')]=_[_0x04b5('0x2c')](_0x357c47[_0x04b5('0x28')],qs[_0x04b5('0x2e')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x2e')]));_0x55b060[_0x04b5('0x2d')]=_0x55b060[_0x04b5('0x2d')][_0x04b5('0x2f')]?_0x55b060[_0x04b5('0x2d')]:_0x357c47[_0x04b5('0x28')];if(!_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x30')](_0x04b5('0x31'))){_0x55b060[_0x04b5('0x18')]=qs[_0x04b5('0x18')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x18')]);_0x55b060[_0x04b5('0x32')]=qs[_0x04b5('0x32')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x32')]);}_0x55b060['order']=qs[_0x04b5('0x33')](_0x3ad63d[_0x04b5('0x2a')]['sort']);_0x55b060[_0x04b5('0x34')]=qs['filters'](_[_0x04b5('0x35')](_0x3ad63d[_0x04b5('0x2a')],_0x357c47['filters']),_0x3782a9);if(_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x36')]){_0x55b060[_0x04b5('0x34')]=_[_0x04b5('0x37')](_0x55b060[_0x04b5('0x34')],{'$or':_[_0x04b5('0x29')](_0x3782a9,function(_0x45deea){if(_0x45deea[_0x04b5('0x26')]!==_0x04b5('0x38')){var _0x17fc94={};_0x17fc94[_0x45deea[_0x04b5('0x22')]]={'$like':'%'+_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x36')]+'%'};return _0x17fc94;}})});}_0x55b060=_[_0x04b5('0x37')]({},_0x55b060,_0x3ad63d[_0x04b5('0x39')]);var _0x4d6fbf={'where':_0x55b060[_0x04b5('0x34')]};return db['FaxApplication']['count'](_0x4d6fbf)[_0x04b5('0x1f')](function(_0x7a89ea){_0x2de686['count']=_0x7a89ea;if(_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x3a')]){_0x55b060['include']=[{'all':!![]}];}return db[_0x04b5('0x24')]['findAll'](_0x55b060);})[_0x04b5('0x1f')](function(_0x64f835){_0x2de686[_0x04b5('0x3b')]=_0x64f835;return _0x2de686;})['then'](respondWithFilteredResult(_0x1a787c,_0x55b060))[_0x04b5('0x3c')](handleError(_0x1a787c,null));};exports[_0x04b5('0x3d')]=function(_0x1c1786,_0x5336bc){var _0xd4a07c={'raw':!![],'where':{'id':_0x1c1786[_0x04b5('0x3e')]['id']}},_0x43799a={};_0x43799a[_0x04b5('0x28')]=_[_0x04b5('0x2b')](db['FaxApplication'][_0x04b5('0x25')]);_0x43799a[_0x04b5('0x2a')]=_['keys'](_0x1c1786[_0x04b5('0x2a')]);_0x43799a[_0x04b5('0x3f')]=_[_0x04b5('0x2c')](_0x43799a['model'],_0x43799a['query']);_0xd4a07c[_0x04b5('0x2d')]=_[_0x04b5('0x2c')](_0x43799a[_0x04b5('0x28')],qs[_0x04b5('0x2e')](_0x1c1786[_0x04b5('0x2a')]['fields']));_0xd4a07c['attributes']=_0xd4a07c[_0x04b5('0x2d')][_0x04b5('0x2f')]?_0xd4a07c[_0x04b5('0x2d')]:_0x43799a[_0x04b5('0x28')];if(_0x1c1786['query'][_0x04b5('0x3a')]){_0xd4a07c[_0x04b5('0x40')]=[{'all':!![]}];}_0xd4a07c=_['merge']({},_0xd4a07c,_0x1c1786['options']);return db[_0x04b5('0x24')][_0x04b5('0x41')](_0xd4a07c)[_0x04b5('0x1f')](handleEntityNotFound(_0x5336bc,null))['then'](respondWithResult(_0x5336bc,null))[_0x04b5('0x3c')](handleError(_0x5336bc,null));};exports[_0x04b5('0x42')]=function(_0x2eae85,_0x103e96){return db['FaxApplication'][_0x04b5('0x42')](_0x2eae85['body'],{})[_0x04b5('0x1f')](respondWithResult(_0x103e96,0xc9))[_0x04b5('0x3c')](handleError(_0x103e96,null));};exports[_0x04b5('0x1e')]=function(_0x26d73d,_0xaee6b2){if(_0x26d73d[_0x04b5('0x43')]['id']){delete _0x26d73d[_0x04b5('0x43')]['id'];}return db[_0x04b5('0x24')][_0x04b5('0x41')]({'where':{'id':_0x26d73d[_0x04b5('0x3e')]['id']}})['then'](handleEntityNotFound(_0xaee6b2,null))['then'](saveUpdates(_0x26d73d[_0x04b5('0x43')],null))[_0x04b5('0x1f')](respondWithResult(_0xaee6b2,null))[_0x04b5('0x3c')](handleError(_0xaee6b2,null));};exports[_0x04b5('0x44')]=function(_0x247ac0,_0x3e46ed){return db[_0x04b5('0x24')]['find']({'where':{'id':_0x247ac0[_0x04b5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e46ed,null))[_0x04b5('0x1f')](removeEntity(_0x3e46ed,null))[_0x04b5('0x3c')](handleError(_0x3e46ed,null));}; \ No newline at end of file +var _0xfea6=['crypto','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxApplication','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','create','body','catch','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x395127,_0x12c853){var _0x2092da=function(_0x3ed91f){while(--_0x3ed91f){_0x395127['push'](_0x395127['shift']());}};_0x2092da(++_0x12c853);}(_0xfea6,0x12c));var _0x6fea=function(_0x90b017,_0x54bdeb){_0x90b017=_0x90b017-0x0;var _0x4cf8d8=_0xfea6[_0x90b017];return _0x4cf8d8;};'use strict';var emlformat=require(_0x6fea('0x0'));var rimraf=require(_0x6fea('0x1'));var zipdir=require(_0x6fea('0x2'));var jsonpatch=require(_0x6fea('0x3'));var rp=require(_0x6fea('0x4'));var moment=require(_0x6fea('0x5'));var BPromise=require(_0x6fea('0x6'));var Mustache=require(_0x6fea('0x7'));var util=require(_0x6fea('0x8'));var path=require(_0x6fea('0x9'));var sox=require(_0x6fea('0xa'));var csv=require(_0x6fea('0xb'));var ejs=require(_0x6fea('0xc'));var fs=require('fs');var fs_extra=require(_0x6fea('0xd'));var _=require(_0x6fea('0xe'));var squel=require(_0x6fea('0xf'));var crypto=require(_0x6fea('0x10'));var jsforce=require(_0x6fea('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6fea('0x12'));var Redis=require(_0x6fea('0x13'));var authService=require(_0x6fea('0x14'));var qs=require(_0x6fea('0x15'));var as=require(_0x6fea('0x16'));var hardwareService=require(_0x6fea('0x17'));var logger=require(_0x6fea('0x18'))(_0x6fea('0x19'));var utils=require(_0x6fea('0x1a'));var config=require(_0x6fea('0x1b'));var licenseUtil=require(_0x6fea('0x1c'));var db=require(_0x6fea('0x1d'))['db'];function respondWithStatusCode(_0xec4228,_0x27f1a7){_0x27f1a7=_0x27f1a7||0xcc;return function(_0x3b8bba){if(_0x3b8bba){return _0xec4228[_0x6fea('0x1e')](_0x27f1a7);}return _0xec4228[_0x6fea('0x1f')](_0x27f1a7)[_0x6fea('0x20')]();};}function respondWithResult(_0xd39f90,_0x2c041f){_0x2c041f=_0x2c041f||0xc8;return function(_0xf57c39){if(_0xf57c39){return _0xd39f90['status'](_0x2c041f)[_0x6fea('0x21')](_0xf57c39);}};}function respondWithFilteredResult(_0x1cd05c,_0x4226f5){return function(_0x3accaa){if(_0x3accaa){var _0x2410b5=typeof _0x4226f5[_0x6fea('0x22')]===_0x6fea('0x23')&&typeof _0x4226f5[_0x6fea('0x24')]===_0x6fea('0x23');var _0x2ccd92=_0x3accaa['count'];var _0x370e93=_0x2410b5?0x0:_0x4226f5[_0x6fea('0x22')];var _0x29327e=_0x2410b5?_0x3accaa[_0x6fea('0x25')]:_0x4226f5[_0x6fea('0x22')]+_0x4226f5['limit'];var _0x6846a1;if(_0x29327e>=_0x2ccd92){_0x29327e=_0x2ccd92;_0x6846a1=0xc8;}else{_0x6846a1=0xce;}_0x1cd05c['status'](_0x6846a1);return _0x1cd05c[_0x6fea('0x26')](_0x6fea('0x27'),_0x370e93+'-'+_0x29327e+'/'+_0x2ccd92)[_0x6fea('0x21')](_0x3accaa);}return null;};}function patchUpdates(_0x34c423){return function(_0x1a930d){try{jsonpatch[_0x6fea('0x28')](_0x1a930d,_0x34c423,!![]);}catch(_0x189f54){return BPromise[_0x6fea('0x29')](_0x189f54);}return _0x1a930d[_0x6fea('0x2a')]();};}function saveUpdates(_0x5575b2,_0x449c6f){return function(_0x5db16f){if(_0x5db16f){return _0x5db16f[_0x6fea('0x2b')](_0x5575b2)[_0x6fea('0x2c')](function(_0x2bdb84){return _0x2bdb84;});}return null;};}function removeEntity(_0x123872,_0x1e59d8){return function(_0x46de04){if(_0x46de04){return _0x46de04['destroy']()[_0x6fea('0x2c')](function(){_0x123872[_0x6fea('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386e23,_0x26e77a){return function(_0x11e16e){if(!_0x11e16e){_0x386e23[_0x6fea('0x1e')](0x194);}return _0x11e16e;};}function handleError(_0x4a3822,_0x3f1926){_0x3f1926=_0x3f1926||0x1f4;return function(_0x3f9960){logger[_0x6fea('0x2d')](_0x3f9960['stack']);if(_0x3f9960[_0x6fea('0x2e')]){delete _0x3f9960[_0x6fea('0x2e')];}_0x4a3822['status'](_0x3f1926)[_0x6fea('0x2f')](_0x3f9960);};}exports[_0x6fea('0x30')]=function(_0x512c4b,_0x5e58d1){var _0x38c9d5={},_0xe38f48={},_0x165892={'count':0x0,'rows':[]};var _0x36e6ed=_['map'](db[_0x6fea('0x31')][_0x6fea('0x32')],function(_0x3bb10c){return{'name':_0x3bb10c['fieldName'],'type':_0x3bb10c[_0x6fea('0x33')][_0x6fea('0x34')]};});_0xe38f48[_0x6fea('0x35')]=_[_0x6fea('0x36')](_0x36e6ed,_0x6fea('0x2e'));_0xe38f48['query']=_[_0x6fea('0x37')](_0x512c4b[_0x6fea('0x38')]);_0xe38f48['filters']=_[_0x6fea('0x39')](_0xe38f48[_0x6fea('0x35')],_0xe38f48[_0x6fea('0x38')]);_0x38c9d5[_0x6fea('0x3a')]=_['intersection'](_0xe38f48[_0x6fea('0x35')],qs[_0x6fea('0x3b')](_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3b')]));_0x38c9d5['attributes']=_0x38c9d5[_0x6fea('0x3a')][_0x6fea('0x3c')]?_0x38c9d5['attributes']:_0xe38f48[_0x6fea('0x35')];if(!_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3d')](_0x6fea('0x3e'))){_0x38c9d5[_0x6fea('0x24')]=qs[_0x6fea('0x24')](_0x512c4b[_0x6fea('0x38')]['limit']);_0x38c9d5[_0x6fea('0x22')]=qs[_0x6fea('0x22')](_0x512c4b['query']['offset']);}_0x38c9d5['order']=qs[_0x6fea('0x3f')](_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3f')]);_0x38c9d5[_0x6fea('0x40')]=qs[_0x6fea('0x41')](_['pick'](_0x512c4b[_0x6fea('0x38')],_0xe38f48[_0x6fea('0x41')]),_0x36e6ed);if(_0x512c4b[_0x6fea('0x38')][_0x6fea('0x42')]){_0x38c9d5[_0x6fea('0x40')]=_[_0x6fea('0x43')](_0x38c9d5[_0x6fea('0x40')],{'$or':_[_0x6fea('0x36')](_0x36e6ed,function(_0x30e9c1){if(_0x30e9c1[_0x6fea('0x33')]!==_0x6fea('0x44')){var _0x472959={};_0x472959[_0x30e9c1[_0x6fea('0x2e')]]={'$like':'%'+_0x512c4b['query']['filter']+'%'};return _0x472959;}})});}_0x38c9d5=_[_0x6fea('0x43')]({},_0x38c9d5,_0x512c4b['options']);var _0x499910={'where':_0x38c9d5[_0x6fea('0x40')]};return db[_0x6fea('0x31')]['count'](_0x499910)[_0x6fea('0x2c')](function(_0x105cad){_0x165892[_0x6fea('0x25')]=_0x105cad;if(_0x512c4b[_0x6fea('0x38')][_0x6fea('0x45')]){_0x38c9d5['include']=[{'all':!![]}];}return db['FaxApplication'][_0x6fea('0x46')](_0x38c9d5);})['then'](function(_0x19b311){_0x165892[_0x6fea('0x47')]=_0x19b311;return _0x165892;})[_0x6fea('0x2c')](respondWithFilteredResult(_0x5e58d1,_0x38c9d5))['catch'](handleError(_0x5e58d1,null));};exports[_0x6fea('0x48')]=function(_0x26ed42,_0x697d86){var _0x6c8b95={'raw':!![],'where':{'id':_0x26ed42[_0x6fea('0x49')]['id']}},_0x3b9944={};_0x3b9944[_0x6fea('0x35')]=_[_0x6fea('0x37')](db[_0x6fea('0x31')]['rawAttributes']);_0x3b9944['query']=_[_0x6fea('0x37')](_0x26ed42[_0x6fea('0x38')]);_0x3b9944[_0x6fea('0x41')]=_[_0x6fea('0x39')](_0x3b9944[_0x6fea('0x35')],_0x3b9944['query']);_0x6c8b95['attributes']=_['intersection'](_0x3b9944['model'],qs[_0x6fea('0x3b')](_0x26ed42[_0x6fea('0x38')][_0x6fea('0x3b')]));_0x6c8b95[_0x6fea('0x3a')]=_0x6c8b95['attributes'][_0x6fea('0x3c')]?_0x6c8b95[_0x6fea('0x3a')]:_0x3b9944[_0x6fea('0x35')];if(_0x26ed42[_0x6fea('0x38')][_0x6fea('0x45')]){_0x6c8b95['include']=[{'all':!![]}];}_0x6c8b95=_[_0x6fea('0x43')]({},_0x6c8b95,_0x26ed42['options']);return db[_0x6fea('0x31')]['find'](_0x6c8b95)[_0x6fea('0x2c')](handleEntityNotFound(_0x697d86,null))[_0x6fea('0x2c')](respondWithResult(_0x697d86,null))['catch'](handleError(_0x697d86,null));};exports[_0x6fea('0x4a')]=function(_0x561774,_0x1ae71b){return db[_0x6fea('0x31')][_0x6fea('0x4a')](_0x561774[_0x6fea('0x4b')],{})[_0x6fea('0x2c')](respondWithResult(_0x1ae71b,0xc9))[_0x6fea('0x4c')](handleError(_0x1ae71b,null));};exports[_0x6fea('0x2b')]=function(_0x485677,_0x42e503){if(_0x485677[_0x6fea('0x4b')]['id']){delete _0x485677[_0x6fea('0x4b')]['id'];}return db[_0x6fea('0x31')][_0x6fea('0x4d')]({'where':{'id':_0x485677[_0x6fea('0x49')]['id']}})[_0x6fea('0x2c')](handleEntityNotFound(_0x42e503,null))[_0x6fea('0x2c')](saveUpdates(_0x485677[_0x6fea('0x4b')],null))[_0x6fea('0x2c')](respondWithResult(_0x42e503,null))[_0x6fea('0x4c')](handleError(_0x42e503,null));};exports[_0x6fea('0x4e')]=function(_0x5d0a6a,_0x20f92b){return db[_0x6fea('0x31')][_0x6fea('0x4d')]({'where':{'id':_0x5d0a6a[_0x6fea('0x49')]['id']}})[_0x6fea('0x2c')](handleEntityNotFound(_0x20f92b,null))[_0x6fea('0x2c')](removeEntity(_0x20f92b,null))[_0x6fea('0x4c')](handleError(_0x20f92b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 61a1b42..5fa1ca8 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 _0xf36a=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xf36a,0x13c));var _0xaf36=function(_0x4a25c0,_0x85d4ba){_0x4a25c0=_0x4a25c0-0x0;var _0x34adda=_0xf36a[_0x4a25c0];return _0x34adda;};'use strict';var _=require(_0xaf36('0x0'));var util=require(_0xaf36('0x1'));var logger=require(_0xaf36('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaf36('0x3'));var rp=require(_0xaf36('0x4'));var fs=require('fs');var path=require(_0xaf36('0x5'));var rimraf=require(_0xaf36('0x6'));var config=require(_0xaf36('0x7'));var attributes=require('./faxApplication.attributes');module[_0xaf36('0x8')]=function(_0x5e709e,_0x1adaee){return _0x5e709e[_0xaf36('0x9')]('FaxApplication',attributes,{'tableName':_0xaf36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf36('0xb'),'collate':_0xaf36('0xc')});}; \ No newline at end of file +var _0x19cc=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x19cc,0xbc));var _0xc19c=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x19cc[_0x446208];return _0xe49563;};'use strict';var _=require(_0xc19c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc19c('0x1'));var moment=require('moment');var BPromise=require(_0xc19c('0x2'));var rp=require(_0xc19c('0x3'));var fs=require('fs');var path=require(_0xc19c('0x4'));var rimraf=require(_0xc19c('0x5'));var config=require(_0xc19c('0x6'));var attributes=require(_0xc19c('0x7'));module[_0xc19c('0x8')]=function(_0x355ba9,_0x2c725b){return _0x355ba9['define'](_0xc19c('0x9'),attributes,{'tableName':_0xc19c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc19c('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e6bf488..417074c 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 _0x4cbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','update','body','options','raw','attributes','limit','UpdateFaxApplication'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x4cbc,0x1f0));var _0xc4cb=function(_0x1394e7,_0xb1001a){_0x1394e7=_0x1394e7-0x0;var _0x296d52=_0x4cbc[_0x1394e7];return _0x296d52;};'use strict';var _=require(_0xc4cb('0x0'));var util=require(_0xc4cb('0x1'));var moment=require(_0xc4cb('0x2'));var BPromise=require(_0xc4cb('0x3'));var rs=require(_0xc4cb('0x4'));var fs=require('fs');var Redis=require(_0xc4cb('0x5'));var db=require(_0xc4cb('0x6'))['db'];var utils=require(_0xc4cb('0x7'));var logger=require(_0xc4cb('0x8'))(_0xc4cb('0x9'));var config=require(_0xc4cb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc4cb('0xb')][_0xc4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1da76d,_0x44369b,_0x4a8ad9){return new BPromise(function(_0x545af8,_0x27b804){return client[_0xc4cb('0xd')](_0x1da76d,_0x4a8ad9)[_0xc4cb('0xe')](function(_0x4a6792){logger['info'](_0xc4cb('0xf'),_0x44369b,_0xc4cb('0x10'));logger[_0xc4cb('0x11')](_0xc4cb('0x12'),_0x44369b,_0xc4cb('0x10'),JSON['stringify'](_0x4a6792));if(_0x4a6792[_0xc4cb('0x13')]){if(_0x4a6792[_0xc4cb('0x13')]['code']===0x1f4){logger[_0xc4cb('0x13')](_0xc4cb('0xf'),_0x44369b,_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);return _0x27b804(_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);}logger[_0xc4cb('0x13')]('FaxApplication,\x20%s,\x20%s',_0x44369b,_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);return _0x545af8(_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);}else{logger[_0xc4cb('0x15')]('FaxApplication,\x20%s,\x20%s',_0x44369b,_0xc4cb('0x10'));_0x545af8(_0x4a6792[_0xc4cb('0x16')][_0xc4cb('0x14')]);}})[_0xc4cb('0x17')](function(_0x317cbd){logger['error']('FaxApplication,\x20%s,\x20%s',_0x44369b,_0x317cbd);_0x27b804(_0x317cbd);});});}exports['UpdateFaxApplication']=function(_0x51b052){var _0x3fe01b=this;return new Promise(function(_0x2f2507,_0x13d9cf){return db['FaxApplication'][_0xc4cb('0x18')](_0x51b052[_0xc4cb('0x19')],{'raw':_0x51b052[_0xc4cb('0x1a')]?_0x51b052[_0xc4cb('0x1a')][_0xc4cb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b052[_0xc4cb('0x1a')]?_0x51b052['options']['where']||null:null,'attributes':_0x51b052[_0xc4cb('0x1a')]?_0x51b052[_0xc4cb('0x1a')][_0xc4cb('0x1c')]||null:null,'limit':_0x51b052['options']?_0x51b052['options'][_0xc4cb('0x1d')]||null:null})['then'](function(_0xbbe09d){logger[_0xc4cb('0x15')](_0xc4cb('0x1e'),_0x51b052);logger[_0xc4cb('0x11')](_0xc4cb('0x1e'),_0x51b052,JSON['stringify'](_0xbbe09d));_0x2f2507(_0xbbe09d);})[_0xc4cb('0x17')](function(_0x27305a){logger[_0xc4cb('0x13')](_0xc4cb('0x1e'),_0x27305a[_0xc4cb('0x14')],_0x51b052);_0x13d9cf(_0x3fe01b[_0xc4cb('0x13')](0x1f4,_0x27305a['message']));});});}; \ No newline at end of file +var _0x7378=['FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x3549c4,_0x159994){var _0x1bf9b4=function(_0x795ccd){while(--_0x795ccd){_0x3549c4['push'](_0x3549c4['shift']());}};_0x1bf9b4(++_0x159994);}(_0x7378,0xbd));var _0x8737=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7378[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x8737('0x0'));var moment=require(_0x8737('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8737('0x2'));var db=require(_0x8737('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8737('0x4'))(_0x8737('0x5'));var config=require(_0x8737('0x6'));var jayson=require(_0x8737('0x7'));var client=jayson[_0x8737('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1cdd,_0x2d536c,_0x4de10b){return new BPromise(function(_0x10530a,_0xfc04dc){return client[_0x8737('0x9')](_0x1b1cdd,_0x4de10b)['then'](function(_0x3a1fbc){logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,'request\x20sent');logger[_0x8737('0xc')](_0x8737('0xd'),_0x2d536c,_0x8737('0xe'),JSON[_0x8737('0xf')](_0x3a1fbc));if(_0x3a1fbc['error']){if(_0x3a1fbc[_0x8737('0x10')]['code']===0x1f4){logger[_0x8737('0x10')](_0x8737('0xb'),_0x2d536c,_0x3a1fbc[_0x8737('0x10')][_0x8737('0x11')]);return _0xfc04dc(_0x3a1fbc[_0x8737('0x10')]['message']);}logger['error'](_0x8737('0xb'),_0x2d536c,_0x3a1fbc['error'][_0x8737('0x11')]);return _0x10530a(_0x3a1fbc['error'][_0x8737('0x11')]);}else{logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,_0x8737('0xe'));_0x10530a(_0x3a1fbc[_0x8737('0x12')][_0x8737('0x11')]);}})['catch'](function(_0x2b27ac){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d536c,_0x2b27ac);_0xfc04dc(_0x2b27ac);});});}exports[_0x8737('0x13')]=function(_0x522d5e){var _0x1873e4=this;return new Promise(function(_0xa0c78d,_0x237843){return db[_0x8737('0x14')]['update'](_0x522d5e[_0x8737('0x15')],{'raw':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')][_0x8737('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['where']||null:null,'attributes':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['attributes']||null:null,'limit':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['limit']||null:null})['then'](function(_0x4ebfe5){logger[_0x8737('0xa')]('UpdateFaxApplication',_0x522d5e);logger[_0x8737('0xc')]('UpdateFaxApplication',_0x522d5e,JSON['stringify'](_0x4ebfe5));_0xa0c78d(_0x4ebfe5);})[_0x8737('0x18')](function(_0x281593){logger[_0x8737('0x10')](_0x8737('0x13'),_0x281593[_0x8737('0x11')],_0x522d5e);_0x237843(_0x1873e4[_0x8737('0x10')](0x1f4,_0x281593[_0x8737('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 79188cd..95f9f28 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x955f,0x1eb));var _0xf955=function(_0x30fedb,_0x38183f){_0x30fedb=_0x30fedb-0x0;var _0x36360a=_0x955f[_0x30fedb];return _0x36360a;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x47ee1b,_0x2114db){var _0x8077a0=function(_0x20962c){while(--_0x20962c){_0x47ee1b['push'](_0x47ee1b['shift']());}};_0x8077a0(++_0x2114db);}(_0xed3c,0x1a6));var _0xced3=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xed3c[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 459d4d1..d6bbc7c 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 _0xa30a=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x307a3e,_0x25ae81){var _0x2ee135=function(_0x5e17d9){while(--_0x5e17d9){_0x307a3e['push'](_0x307a3e['shift']());}};_0x2ee135(++_0x25ae81);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'closed':{'type':Sequelize[_0xaa30('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa30('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa30('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa30('0x3')]},'note':{'type':Sequelize[_0xaa30('0x3')]},'read1stAt':{'type':Sequelize[_0xaa30('0x4')]},'fax':{'type':Sequelize[_0xaa30('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa30('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa30('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa30('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xaa30('0x7')]}}; \ No newline at end of file +var _0xed1c=['DATE','ENUM','out','INTEGER','sequelize','exports','STRING'];(function(_0x315b5a,_0x35a000){var _0x4047a5=function(_0x3b25f1){while(--_0x3b25f1){_0x315b5a['push'](_0x315b5a['shift']());}};_0x4047a5(++_0x35a000);}(_0xed1c,0xe4));var _0xced1=function(_0x35a008,_0x475984){_0x35a008=_0x35a008-0x0;var _0x5d9db1=_0xed1c[_0x35a008];return _0x5d9db1;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xced1('0x2')]},'note':{'type':Sequelize[_0xced1('0x2')]},'read1stAt':{'type':Sequelize[_0xced1('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in',_0xced1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xced1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xced1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 830a124..188c447 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 _0xa308=['name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','user','catch','show','params','model','keys','query','filters','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','removeTags','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','resolve','download','log','err','unlinkSync','rimraf','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','count','offset','limit','set','update','destroy','then','end','error','stack'];(function(_0x13c1e9,_0x4496c8){var _0x4b6e75=function(_0x2618af){while(--_0x2618af){_0x13c1e9['push'](_0x13c1e9['shift']());}};_0x4b6e75(++_0x4496c8);}(_0xa308,0x1ce));var _0x8a30=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xa308[_0x2637ac];return _0x4a5758;};'use strict';var rimraf=require(_0x8a30('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8a30('0x1'));var BPromise=require('bluebird');var util=require(_0x8a30('0x2'));var path=require(_0x8a30('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8a30('0x4'));var interaction=require(_0x8a30('0x5'));var qs=require(_0x8a30('0x6'));var logger=require('../../config/logger')(_0x8a30('0x7'));var config=require(_0x8a30('0x8'));var db=require(_0x8a30('0x9'))['db'];config['redis']=_['defaults'](config[_0x8a30('0xa')],{'host':_0x8a30('0xb'),'port':0x18eb});var socket=require(_0x8a30('0xc'))(new Redis(config[_0x8a30('0xa')]));require(_0x8a30('0xd'))[_0x8a30('0xe')](socket);function respondWithStatusCode(_0x12b87f,_0x161ed5){_0x161ed5=_0x161ed5||0xcc;return function(_0x494156){if(_0x494156){return _0x12b87f['sendStatus'](_0x161ed5);}return _0x12b87f['status'](_0x161ed5)['end']();};}function respondWithResult(_0xc0f5b2,_0x2809cc){_0x2809cc=_0x2809cc||0xc8;return function(_0xf19ddc){if(_0xf19ddc){return _0xc0f5b2[_0x8a30('0xf')](_0x2809cc)[_0x8a30('0x10')](_0xf19ddc);}};}function respondWithFilteredResult(_0x509ae9,_0x2c633b){return function(_0x2a6e45){if(_0x2a6e45){var _0x5ae765=typeof _0x2c633b['offset']===_0x8a30('0x11')&&typeof _0x2c633b['limit']===_0x8a30('0x11');var _0x4403f2=_0x2a6e45[_0x8a30('0x12')];var _0x361d46=_0x5ae765?0x0:_0x2c633b[_0x8a30('0x13')];var _0x44fce3=_0x5ae765?_0x2a6e45[_0x8a30('0x12')]:_0x2c633b[_0x8a30('0x13')]+_0x2c633b[_0x8a30('0x14')];var _0x577c2d;if(_0x44fce3>=_0x4403f2){_0x44fce3=_0x4403f2;_0x577c2d=0xc8;}else{_0x577c2d=0xce;}_0x509ae9['status'](_0x577c2d);return _0x509ae9[_0x8a30('0x15')]('Content-Range',_0x361d46+'-'+_0x44fce3+'/'+_0x4403f2)[_0x8a30('0x10')](_0x2a6e45);}return null;};}function saveUpdates(_0x242ea5){return function(_0x2ca16f){if(_0x2ca16f){return _0x2ca16f[_0x8a30('0x16')](_0x242ea5)['then'](function(_0x3c5db3){return _0x3c5db3;});}return null;};}function removeEntity(_0x2e2fa9){return function(_0x1c9fa4){if(_0x1c9fa4){return _0x1c9fa4[_0x8a30('0x17')]()[_0x8a30('0x18')](function(){_0x2e2fa9[_0x8a30('0xf')](0xcc)[_0x8a30('0x19')]();});}};}function handleEntityNotFound(_0x327405){return function(_0x205b40){if(!_0x205b40){_0x327405['sendStatus'](0x194);}return _0x205b40;};}function handleError(_0x3a7844,_0x1a32bd){_0x1a32bd=_0x1a32bd||0x1f4;return function(_0x594357){logger[_0x8a30('0x1a')](_0x594357[_0x8a30('0x1b')]);if(_0x594357['name']){delete _0x594357[_0x8a30('0x1c')];}_0x3a7844['status'](_0x1a32bd)[_0x8a30('0x1d')](_0x594357);};}exports['index']=function(_0x45dbb8,_0x38ac70){var _0x56a066={};var _0x40c389=_[_0x8a30('0x1e')](db[_0x8a30('0x1f')][_0x8a30('0x20')],function(_0x14174d){return{'name':_0x14174d[_0x8a30('0x21')],'type':_0x14174d[_0x8a30('0x22')][_0x8a30('0x23')]};});_0x56a066=qs[_0x8a30('0x24')](_0x40c389,_0x45dbb8);return interaction['findAll']('fax',_0x45dbb8['query'],_0x45dbb8[_0x8a30('0x25')],_0x56a066,_0x40c389)['then'](respondWithFilteredResult(_0x38ac70,_0x56a066))[_0x8a30('0x26')](handleError(_0x38ac70,null));};exports[_0x8a30('0x27')]=function(_0x33511d,_0x5b02d7){var _0x1656d4={'raw':![],'where':{'id':_0x33511d[_0x8a30('0x28')]['id']}},_0x25d2d4={};_0x25d2d4[_0x8a30('0x29')]=_[_0x8a30('0x2a')](db[_0x8a30('0x1f')][_0x8a30('0x20')]);_0x25d2d4[_0x8a30('0x2b')]=_[_0x8a30('0x2a')](_0x33511d[_0x8a30('0x2b')]);_0x25d2d4[_0x8a30('0x2c')]=_[_0x8a30('0x2d')](_0x25d2d4[_0x8a30('0x29')],_0x25d2d4[_0x8a30('0x2b')]);_0x1656d4['attributes']=_[_0x8a30('0x2d')](_0x25d2d4['model'],qs['fields'](_0x33511d[_0x8a30('0x2b')][_0x8a30('0x2e')]));_0x1656d4['attributes']=_0x1656d4['attributes'][_0x8a30('0x2f')]?_0x1656d4['attributes']:_0x25d2d4[_0x8a30('0x29')];if(_0x33511d[_0x8a30('0x2b')][_0x8a30('0x30')]){_0x1656d4[_0x8a30('0x31')]=[{'all':!![]}];}_0x1656d4=_[_0x8a30('0x32')]({},_0x1656d4,_0x33511d[_0x8a30('0x33')]);return db[_0x8a30('0x1f')][_0x8a30('0x34')](_0x1656d4)[_0x8a30('0x18')](handleEntityNotFound(_0x5b02d7,null))[_0x8a30('0x18')](respondWithResult(_0x5b02d7,null))[_0x8a30('0x26')](handleError(_0x5b02d7,null));};exports[_0x8a30('0x35')]=function(_0x581bbc,_0x4c0b17){return db['FaxInteraction'][_0x8a30('0x35')](_0x581bbc[_0x8a30('0x36')],{})[_0x8a30('0x18')](respondWithResult(_0x4c0b17,0xc9))[_0x8a30('0x26')](handleError(_0x4c0b17,null));};exports[_0x8a30('0x16')]=function(_0x10327e,_0xc6ddf2){if(_0x10327e[_0x8a30('0x36')]['id']){delete _0x10327e[_0x8a30('0x36')]['id'];}return db[_0x8a30('0x1f')]['find']({'where':{'id':_0x10327e[_0x8a30('0x28')]['id']}})['then'](handleEntityNotFound(_0xc6ddf2,null))[_0x8a30('0x18')](saveUpdates(_0x10327e[_0x8a30('0x36')],null))[_0x8a30('0x18')](respondWithResult(_0xc6ddf2,null))[_0x8a30('0x26')](handleError(_0xc6ddf2,null));};exports[_0x8a30('0x17')]=function(_0x25f7b5,_0xd21fe1){return db['FaxInteraction']['find']({'where':{'id':_0x25f7b5['params']['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0xd21fe1,null))[_0x8a30('0x18')](removeEntity(_0xd21fe1,null))[_0x8a30('0x26')](handleError(_0xd21fe1,null));};exports[_0x8a30('0x37')]=function(_0x623041,_0x3983b0){return db[_0x8a30('0x1f')]['describe']()[_0x8a30('0x18')](respondWithResult(_0x3983b0,null))[_0x8a30('0x26')](handleError(_0x3983b0,null));};exports[_0x8a30('0x38')]=function(_0x4b1018,_0xac9175){return db[_0x8a30('0x39')][_0x8a30('0x34')]({'where':{'id':_0x4b1018[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0xac9175,null))[_0x8a30('0x18')](function(_0x5350a0){if(_0x5350a0){return _0x5350a0['addMessage'](_0x4b1018[_0x8a30('0x36')][_0x8a30('0x3a')],_[_0x8a30('0x3b')](_0x4b1018[_0x8a30('0x36')],[_0x8a30('0x3a'),'id'])||{});}})['then'](respondWithResult(_0xac9175,null))[_0x8a30('0x26')](handleError(_0xac9175,null));};exports[_0x8a30('0x3c')]=function(_0x177934,_0x4057d0){var _0x3a7267={'raw':![],'where':{}};var _0x1f8093={};var _0x594d16={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x177934[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0x4057d0,null))['then'](function(_0x55585c){if(_0x55585c){_0x1f8093[_0x8a30('0x29')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x1f8093[_0x8a30('0x2b')]=_[_0x8a30('0x2a')](_0x177934[_0x8a30('0x2b')]);_0x1f8093[_0x8a30('0x2c')]=_[_0x8a30('0x2d')](_0x1f8093[_0x8a30('0x29')],_0x1f8093[_0x8a30('0x2b')]);_0x3a7267[_0x8a30('0x3d')]=_[_0x8a30('0x2d')](_0x1f8093[_0x8a30('0x29')],qs[_0x8a30('0x2e')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x2e')]));_0x3a7267[_0x8a30('0x3d')]=_0x3a7267[_0x8a30('0x3d')]['length']?_0x3a7267[_0x8a30('0x3d')]:_0x1f8093['model'];if(!_0x177934[_0x8a30('0x2b')][_0x8a30('0x3e')](_0x8a30('0x3f'))){_0x3a7267[_0x8a30('0x14')]=qs['limit'](_0x177934[_0x8a30('0x2b')]['limit']);_0x3a7267[_0x8a30('0x13')]=qs[_0x8a30('0x13')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x13')]);}_0x3a7267[_0x8a30('0x40')]=qs[_0x8a30('0x41')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x41')]);_0x3a7267[_0x8a30('0x42')]=qs[_0x8a30('0x2c')](_[_0x8a30('0x43')](_0x177934[_0x8a30('0x2b')],_0x1f8093['filters']));_0x3a7267[_0x8a30('0x42')]['FaxInteractionId']=_0x55585c['id'];if(_0x177934['query']['filter']){_0x3a7267[_0x8a30('0x42')]=_['merge'](_0x3a7267[_0x8a30('0x42')],{'$or':_['map'](_0x3a7267[_0x8a30('0x3d')],function(_0x15319e){var _0x17e3d2={};_0x17e3d2[_0x15319e]={'$like':'%'+_0x177934['query'][_0x8a30('0x44')]+'%'};return _0x17e3d2;})});}if(_0x177934[_0x8a30('0x2b')]['$gte']){var _0x5b488b=_0x177934[_0x8a30('0x2b')][_0x8a30('0x45')][_0x8a30('0x46')](',');var _0x514274={};_0x514274[_0x5b488b[0x0]]={'$gte':moment(_0x5b488b[0x1])[_0x8a30('0x47')](_0x8a30('0x48'))};_0x3a7267[_0x8a30('0x42')]=_[_0x8a30('0x32')](_0x3a7267[_0x8a30('0x42')],_0x514274);}_0x3a7267=_[_0x8a30('0x32')]({},_0x3a7267,_0x177934[_0x8a30('0x33')]);return db[_0x8a30('0x39')]['count']({'where':_0x3a7267[_0x8a30('0x42')]})[_0x8a30('0x18')](function(_0x4f3d72){_0x594d16[_0x8a30('0x12')]=_0x4f3d72;if(_0x177934[_0x8a30('0x2b')][_0x8a30('0x30')]){_0x3a7267[_0x8a30('0x31')]=[{'all':!![]}];}return db[_0x8a30('0x39')]['findAll'](_0x3a7267);})[_0x8a30('0x18')](function(_0x2bd6a1){_0x594d16[_0x8a30('0x49')]=_0x2bd6a1;return _0x594d16;});}})[_0x8a30('0x18')](respondWithFilteredResult(_0x4057d0,_0x3a7267))[_0x8a30('0x26')](handleError(_0x4057d0,null));};exports[_0x8a30('0x4a')]=function(_0xa5e9e6,_0x1f3a92){return db[_0x8a30('0x1f')][_0x8a30('0x34')]({'where':{'id':_0xa5e9e6[_0x8a30('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f3a92,null))[_0x8a30('0x18')](function(_0x37d871){if(_0x37d871){return _0x37d871[_0x8a30('0x4b')](_0xa5e9e6[_0x8a30('0x36')][_0x8a30('0x3a')],_[_0x8a30('0x3b')](_0xa5e9e6[_0x8a30('0x36')],[_0x8a30('0x3a'),'id'])||{})[_0x8a30('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8a30('0x1c'),'color'],'where':{'id':_0xa5e9e6[_0x8a30('0x36')][_0x8a30('0x3a')]}});})['then'](function(_0x2302c4){socket['emit']('faxInteractionTags:save',{'id':Number(_0xa5e9e6[_0x8a30('0x28')]['id']),'tags':_0x2302c4||[]});return{'id':Number(_0xa5e9e6['params']['id']),'tags':_0x2302c4||[]};});}})['then'](respondWithResult(_0x1f3a92,null))[_0x8a30('0x26')](handleError(_0x1f3a92,null));};exports[_0x8a30('0x4d')]=function(_0x1ee60d,_0x5aaf67){return db[_0x8a30('0x1f')]['find']({'where':{'id':_0x1ee60d[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0x5aaf67,null))[_0x8a30('0x18')](function(_0x59b881){if(_0x59b881){return _0x59b881[_0x8a30('0x4d')](_0x1ee60d[_0x8a30('0x2b')][_0x8a30('0x3a')]);}})['then'](respondWithStatusCode(_0x5aaf67,null))['catch'](handleError(_0x5aaf67,null));};exports['download']=function(_0x47749f,_0x4c1e41){var _0x2e2844=moment()[_0x8a30('0x4e')]()['toString']();var _0x1aaeb0=path[_0x8a30('0x4f')](config[_0x8a30('0x50')],_0x8a30('0x51'),'files',_0x8a30('0x52'));var _0x351ed5=path['join'](config['root'],'server','files',_0x8a30('0x53'));var _0x3bee7c=path[_0x8a30('0x4f')](_0x1aaeb0,_0x2e2844);var _0x2cd5ec=util[_0x8a30('0x47')](_0x8a30('0x54'),_0x47749f['params']['id'],_0x2e2844);var _0xc76227=path[_0x8a30('0x4f')](_0x1aaeb0,_0x2cd5ec);var _0x5e8d29=[];_0x5e8d29[_0x8a30('0x55')]({'model':db[_0x8a30('0x56')],'as':'Attachment','raw':!![]});var _0x3b7184=[{'model':db[_0x8a30('0x39')],'as':_0x8a30('0x57'),'attributes':['id',_0x8a30('0x36'),'createdAt'],'include':_0x5e8d29}];return db['FaxInteraction'][_0x8a30('0x34')]({'where':{'id':_0x47749f[_0x8a30('0x28')]['id']},'include':_0x3b7184})[_0x8a30('0x18')](handleEntityNotFound(_0x4c1e41,null))['then'](function(_0x1737dd){if(_0x1737dd&&_0x1737dd[_0x8a30('0x57')]){var _0x1ec67b=_0x1737dd[_0x8a30('0x58')]({'plain':!![]});fs['mkdirSync'](_0x3bee7c);for(var _0x505386=0x0;_0x505386<_0x1ec67b[_0x8a30('0x57')][_0x8a30('0x2f')];_0x505386++){var _0x2c93e3=_0x1ec67b[_0x8a30('0x57')][_0x505386][_0x8a30('0x56')];if(_0x2c93e3){var _0x10d682=path[_0x8a30('0x4f')](_0x351ed5,_0x2c93e3[_0x8a30('0x59')]);if(fs['existsSync'](_0x10d682)){fs[_0x8a30('0x5a')](_0x10d682)[_0x8a30('0x5b')](fs[_0x8a30('0x5c')](path['join'](_0x3bee7c,_0x2c93e3[_0x8a30('0x59')])));}}}return BPromise[_0x8a30('0x5d')]()[_0x8a30('0x18')](function(){return new BPromise(function(_0x198173,_0x1eb7ec){zipdir(_0x3bee7c,{'saveTo':_0xc76227},function(_0x5f0e08,_0x2e3ba5){if(_0x5f0e08)return _0x1eb7ec(_0x5f0e08);return _0x198173(_0x2e3ba5);});})[_0x8a30('0x18')](function(){return new BPromise(function(_0x491a75,_0x1850b4){rimraf(_0x3bee7c,function(_0x1e08ee){if(_0x1e08ee)_0x1850b4(_0x1e08ee);return _0x491a75();});});})['then'](function(){return _0x4c1e41[_0x8a30('0x5e')](_0xc76227,_0x2cd5ec,function(_0x2a392d){if(_0x2a392d){console[_0x8a30('0x5f')](_0x8a30('0x60'),_0x2a392d);}else{fs[_0x8a30('0x61')](_0xc76227);}});});});}else{return _0x4c1e41['sendStatus'](0xc8);}})[_0x8a30('0x26')](handleError(_0x4c1e41,null));}; \ No newline at end of file +var _0x4b70=['tmp','push','Attachment','Messages','basename','existsSync','createReadStream','pipe','resolve','log','err','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','create','body','params','describe','addMessage','omit','ids','getMessages','FaxMessage','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x4b70,0x19f));var _0x04b7=function(_0x25a762,_0x101bb8){_0x25a762=_0x25a762-0x0;var _0x2e24e4=_0x4b70[_0x25a762];return _0x2e24e4;};'use strict';var rimraf=require(_0x04b7('0x0'));var zipdir=require('zip-dir');var moment=require(_0x04b7('0x1'));var BPromise=require(_0x04b7('0x2'));var util=require(_0x04b7('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x04b7('0x4'));var Redis=require(_0x04b7('0x5'));var interaction=require(_0x04b7('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x04b7('0x7'));var config=require(_0x04b7('0x8'));var db=require(_0x04b7('0x9'))['db'];config['redis']=_['defaults'](config[_0x04b7('0xa')],{'host':_0x04b7('0xb'),'port':0x18eb});var socket=require(_0x04b7('0xc'))(new Redis(config[_0x04b7('0xa')]));require(_0x04b7('0xd'))[_0x04b7('0xe')](socket);function respondWithStatusCode(_0x59130e,_0x10cea2){_0x10cea2=_0x10cea2||0xcc;return function(_0x205992){if(_0x205992){return _0x59130e[_0x04b7('0xf')](_0x10cea2);}return _0x59130e[_0x04b7('0x10')](_0x10cea2)[_0x04b7('0x11')]();};}function respondWithResult(_0x15627f,_0x242915){_0x242915=_0x242915||0xc8;return function(_0x416eb3){if(_0x416eb3){return _0x15627f[_0x04b7('0x10')](_0x242915)['json'](_0x416eb3);}};}function respondWithFilteredResult(_0x55c864,_0x4ff150){return function(_0x549e7f){if(_0x549e7f){var _0x33a7e4=typeof _0x4ff150[_0x04b7('0x12')]===_0x04b7('0x13')&&typeof _0x4ff150[_0x04b7('0x14')]==='undefined';var _0x2dfe48=_0x549e7f[_0x04b7('0x15')];var _0x37248f=_0x33a7e4?0x0:_0x4ff150[_0x04b7('0x12')];var _0x5f1e50=_0x33a7e4?_0x549e7f['count']:_0x4ff150[_0x04b7('0x12')]+_0x4ff150[_0x04b7('0x14')];var _0x905e9f;if(_0x5f1e50>=_0x2dfe48){_0x5f1e50=_0x2dfe48;_0x905e9f=0xc8;}else{_0x905e9f=0xce;}_0x55c864[_0x04b7('0x10')](_0x905e9f);return _0x55c864['set'](_0x04b7('0x16'),_0x37248f+'-'+_0x5f1e50+'/'+_0x2dfe48)['json'](_0x549e7f);}return null;};}function saveUpdates(_0x3b06e4){return function(_0x1d4362){if(_0x1d4362){return _0x1d4362[_0x04b7('0x17')](_0x3b06e4)[_0x04b7('0x18')](function(_0x4fee61){return _0x4fee61;});}return null;};}function removeEntity(_0x2d69d7){return function(_0x413f0c){if(_0x413f0c){return _0x413f0c[_0x04b7('0x19')]()['then'](function(){_0x2d69d7[_0x04b7('0x10')](0xcc)[_0x04b7('0x11')]();});}};}function handleEntityNotFound(_0x2adb6c){return function(_0x3ed86a){if(!_0x3ed86a){_0x2adb6c['sendStatus'](0x194);}return _0x3ed86a;};}function handleError(_0x15f5ef,_0x1a5c23){_0x1a5c23=_0x1a5c23||0x1f4;return function(_0x2cf119){logger[_0x04b7('0x1a')](_0x2cf119[_0x04b7('0x1b')]);if(_0x2cf119[_0x04b7('0x1c')]){delete _0x2cf119[_0x04b7('0x1c')];}_0x15f5ef['status'](_0x1a5c23)[_0x04b7('0x1d')](_0x2cf119);};}exports[_0x04b7('0x1e')]=function(_0x54ac20,_0x545f7c){var _0x2677e5={};var _0x29704d=_[_0x04b7('0x1f')](db[_0x04b7('0x20')][_0x04b7('0x21')],function(_0x23407b){return{'name':_0x23407b[_0x04b7('0x22')],'type':_0x23407b[_0x04b7('0x23')][_0x04b7('0x24')]};});_0x2677e5=qs[_0x04b7('0x25')](_0x29704d,_0x54ac20);return interaction[_0x04b7('0x26')](_0x04b7('0x27'),_0x54ac20[_0x04b7('0x28')],_0x54ac20[_0x04b7('0x29')],_0x2677e5,_0x29704d)['then'](respondWithFilteredResult(_0x545f7c,_0x2677e5))['catch'](handleError(_0x545f7c,null));};exports[_0x04b7('0x2a')]=function(_0x1bd8fb,_0x40f634){var _0x30af16={'raw':![],'where':{'id':_0x1bd8fb['params']['id']}},_0x16b765={};_0x16b765[_0x04b7('0x2b')]=_[_0x04b7('0x2c')](db[_0x04b7('0x20')][_0x04b7('0x21')]);_0x16b765[_0x04b7('0x28')]=_[_0x04b7('0x2c')](_0x1bd8fb[_0x04b7('0x28')]);_0x16b765[_0x04b7('0x2d')]=_[_0x04b7('0x2e')](_0x16b765[_0x04b7('0x2b')],_0x16b765[_0x04b7('0x28')]);_0x30af16['attributes']=_[_0x04b7('0x2e')](_0x16b765[_0x04b7('0x2b')],qs[_0x04b7('0x2f')](_0x1bd8fb[_0x04b7('0x28')][_0x04b7('0x2f')]));_0x30af16[_0x04b7('0x30')]=_0x30af16['attributes'][_0x04b7('0x31')]?_0x30af16[_0x04b7('0x30')]:_0x16b765['model'];if(_0x1bd8fb[_0x04b7('0x28')][_0x04b7('0x32')]){_0x30af16[_0x04b7('0x33')]=[{'all':!![]}];}_0x30af16=_['merge']({},_0x30af16,_0x1bd8fb[_0x04b7('0x34')]);return db[_0x04b7('0x20')][_0x04b7('0x35')](_0x30af16)[_0x04b7('0x18')](handleEntityNotFound(_0x40f634,null))[_0x04b7('0x18')](respondWithResult(_0x40f634,null))[_0x04b7('0x36')](handleError(_0x40f634,null));};exports[_0x04b7('0x37')]=function(_0x423bf4,_0x4bb11a){return db['FaxInteraction'][_0x04b7('0x37')](_0x423bf4['body'],{})['then'](respondWithResult(_0x4bb11a,0xc9))[_0x04b7('0x36')](handleError(_0x4bb11a,null));};exports[_0x04b7('0x17')]=function(_0x39e433,_0x570f50){if(_0x39e433[_0x04b7('0x38')]['id']){delete _0x39e433[_0x04b7('0x38')]['id'];}return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x39e433[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x570f50,null))[_0x04b7('0x18')](saveUpdates(_0x39e433[_0x04b7('0x38')],null))[_0x04b7('0x18')](respondWithResult(_0x570f50,null))['catch'](handleError(_0x570f50,null));};exports['destroy']=function(_0x27e9aa,_0x287183){return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x27e9aa[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x287183,null))[_0x04b7('0x18')](removeEntity(_0x287183,null))[_0x04b7('0x36')](handleError(_0x287183,null));};exports[_0x04b7('0x3a')]=function(_0x59ecb1,_0x2a7845){return db[_0x04b7('0x20')][_0x04b7('0x3a')]()['then'](respondWithResult(_0x2a7845,null))[_0x04b7('0x36')](handleError(_0x2a7845,null));};exports['addMessage']=function(_0x4dc353,_0x2342de){return db['FaxMessage'][_0x04b7('0x35')]({'where':{'id':_0x4dc353[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x2342de,null))[_0x04b7('0x18')](function(_0x57b8a6){if(_0x57b8a6){return _0x57b8a6[_0x04b7('0x3b')](_0x4dc353[_0x04b7('0x38')]['ids'],_[_0x04b7('0x3c')](_0x4dc353['body'],[_0x04b7('0x3d'),'id'])||{});}})[_0x04b7('0x18')](respondWithResult(_0x2342de,null))['catch'](handleError(_0x2342de,null));};exports[_0x04b7('0x3e')]=function(_0x30943a,_0x42f2d8){var _0x4283b4={'raw':![],'where':{}};var _0x380d16={};var _0x357111={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x30943a[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x42f2d8,null))[_0x04b7('0x18')](function(_0x2e9717){if(_0x2e9717){_0x380d16[_0x04b7('0x2b')]=_[_0x04b7('0x2c')](db[_0x04b7('0x3f')][_0x04b7('0x21')]);_0x380d16[_0x04b7('0x28')]=_['keys'](_0x30943a[_0x04b7('0x28')]);_0x380d16[_0x04b7('0x2d')]=_[_0x04b7('0x2e')](_0x380d16[_0x04b7('0x2b')],_0x380d16['query']);_0x4283b4[_0x04b7('0x30')]=_['intersection'](_0x380d16['model'],qs[_0x04b7('0x2f')](_0x30943a[_0x04b7('0x28')][_0x04b7('0x2f')]));_0x4283b4[_0x04b7('0x30')]=_0x4283b4[_0x04b7('0x30')][_0x04b7('0x31')]?_0x4283b4['attributes']:_0x380d16['model'];if(!_0x30943a[_0x04b7('0x28')][_0x04b7('0x40')](_0x04b7('0x41'))){_0x4283b4[_0x04b7('0x14')]=qs[_0x04b7('0x14')](_0x30943a['query']['limit']);_0x4283b4[_0x04b7('0x12')]=qs['offset'](_0x30943a[_0x04b7('0x28')]['offset']);}_0x4283b4[_0x04b7('0x42')]=qs[_0x04b7('0x43')](_0x30943a[_0x04b7('0x28')][_0x04b7('0x43')]);_0x4283b4[_0x04b7('0x44')]=qs[_0x04b7('0x2d')](_[_0x04b7('0x45')](_0x30943a[_0x04b7('0x28')],_0x380d16[_0x04b7('0x2d')]));_0x4283b4['where'][_0x04b7('0x46')]=_0x2e9717['id'];if(_0x30943a[_0x04b7('0x28')][_0x04b7('0x47')]){_0x4283b4[_0x04b7('0x44')]=_[_0x04b7('0x48')](_0x4283b4[_0x04b7('0x44')],{'$or':_[_0x04b7('0x1f')](_0x4283b4[_0x04b7('0x30')],function(_0x21c8fc){var _0x2cd34a={};_0x2cd34a[_0x21c8fc]={'$like':'%'+_0x30943a[_0x04b7('0x28')]['filter']+'%'};return _0x2cd34a;})});}if(_0x30943a['query'][_0x04b7('0x49')]){var _0x5ae90e=_0x30943a['query'][_0x04b7('0x49')][_0x04b7('0x4a')](',');var _0x1dbef1={};_0x1dbef1[_0x5ae90e[0x0]]={'$gte':moment(_0x5ae90e[0x1])[_0x04b7('0x4b')](_0x04b7('0x4c'))};_0x4283b4['where']=_[_0x04b7('0x48')](_0x4283b4['where'],_0x1dbef1);}_0x4283b4=_[_0x04b7('0x48')]({},_0x4283b4,_0x30943a[_0x04b7('0x34')]);return db[_0x04b7('0x3f')][_0x04b7('0x15')]({'where':_0x4283b4[_0x04b7('0x44')]})[_0x04b7('0x18')](function(_0x3ec505){_0x357111[_0x04b7('0x15')]=_0x3ec505;if(_0x30943a['query']['includeAll']){_0x4283b4[_0x04b7('0x33')]=[{'all':!![]}];}return db[_0x04b7('0x3f')][_0x04b7('0x26')](_0x4283b4);})[_0x04b7('0x18')](function(_0x672c01){_0x357111[_0x04b7('0x4d')]=_0x672c01;return _0x357111;});}})[_0x04b7('0x18')](respondWithFilteredResult(_0x42f2d8,_0x4283b4))[_0x04b7('0x36')](handleError(_0x42f2d8,null));};exports['addTags']=function(_0x50c6e2,_0x3ddc79){return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x50c6e2[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x3ddc79,null))[_0x04b7('0x18')](function(_0x4bd20f){if(_0x4bd20f){return _0x4bd20f[_0x04b7('0x4e')](_0x50c6e2['body']['ids'],_['omit'](_0x50c6e2[_0x04b7('0x38')],[_0x04b7('0x3d'),'id'])||{})[_0x04b7('0x4f')](function(){return db[_0x04b7('0x50')][_0x04b7('0x26')]({'attributes':['id',_0x04b7('0x1c'),_0x04b7('0x51')],'where':{'id':_0x50c6e2[_0x04b7('0x38')]['ids']}});})['then'](function(_0x2b32fa){socket[_0x04b7('0x52')](_0x04b7('0x53'),{'id':Number(_0x50c6e2[_0x04b7('0x39')]['id']),'tags':_0x2b32fa||[]});return{'id':Number(_0x50c6e2['params']['id']),'tags':_0x2b32fa||[]};});}})['then'](respondWithResult(_0x3ddc79,null))[_0x04b7('0x36')](handleError(_0x3ddc79,null));};exports[_0x04b7('0x54')]=function(_0x72a409,_0x47a687){return db['FaxInteraction'][_0x04b7('0x35')]({'where':{'id':_0x72a409[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x47a687,null))[_0x04b7('0x18')](function(_0xd52c16){if(_0xd52c16){return _0xd52c16['removeTags'](_0x72a409['query'][_0x04b7('0x3d')]);}})[_0x04b7('0x18')](respondWithStatusCode(_0x47a687,null))[_0x04b7('0x36')](handleError(_0x47a687,null));};exports[_0x04b7('0x55')]=function(_0xdc778f,_0x46cc2a){var _0x43c078=moment()['unix']()['toString']();var _0x1643b4=path[_0x04b7('0x56')](config[_0x04b7('0x57')],_0x04b7('0x58'),_0x04b7('0x59'),_0x04b7('0x5a'));var _0x287675=path['join'](config['root'],_0x04b7('0x58'),_0x04b7('0x59'),'attachments');var _0x1e5106=path[_0x04b7('0x56')](_0x1643b4,_0x43c078);var _0x3ffe1d=util['format']('transcript-%d-%s.zip',_0xdc778f[_0x04b7('0x39')]['id'],_0x43c078);var _0x44f0c3=path[_0x04b7('0x56')](_0x1643b4,_0x3ffe1d);var _0xd3707d=[];_0xd3707d[_0x04b7('0x5b')]({'model':db[_0x04b7('0x5c')],'as':_0x04b7('0x5c'),'raw':!![]});var _0x333161=[{'model':db[_0x04b7('0x3f')],'as':_0x04b7('0x5d'),'attributes':['id',_0x04b7('0x38'),'createdAt'],'include':_0xd3707d}];return db[_0x04b7('0x20')]['find']({'where':{'id':_0xdc778f[_0x04b7('0x39')]['id']},'include':_0x333161})['then'](handleEntityNotFound(_0x46cc2a,null))[_0x04b7('0x18')](function(_0x2012ca){if(_0x2012ca&&_0x2012ca[_0x04b7('0x5d')]){var _0xc4d720=_0x2012ca['get']({'plain':!![]});fs['mkdirSync'](_0x1e5106);for(var _0x12f92b=0x0;_0x12f92b<_0xc4d720[_0x04b7('0x5d')][_0x04b7('0x31')];_0x12f92b++){var _0x425963=_0xc4d720[_0x04b7('0x5d')][_0x12f92b][_0x04b7('0x5c')];if(_0x425963){var _0xdc5b3=path[_0x04b7('0x56')](_0x287675,_0x425963[_0x04b7('0x5e')]);if(fs[_0x04b7('0x5f')](_0xdc5b3)){fs[_0x04b7('0x60')](_0xdc5b3)[_0x04b7('0x61')](fs['createWriteStream'](path['join'](_0x1e5106,_0x425963[_0x04b7('0x5e')])));}}}return BPromise[_0x04b7('0x62')]()[_0x04b7('0x18')](function(){return new BPromise(function(_0x5729a6,_0x5ae11e){zipdir(_0x1e5106,{'saveTo':_0x44f0c3},function(_0x3f17fc,_0x549500){if(_0x3f17fc)return _0x5ae11e(_0x3f17fc);return _0x5729a6(_0x549500);});})[_0x04b7('0x18')](function(){return new BPromise(function(_0x31b9bf,_0xdb5e12){rimraf(_0x1e5106,function(_0xc93f8b){if(_0xc93f8b)_0xdb5e12(_0xc93f8b);return _0x31b9bf();});});})[_0x04b7('0x18')](function(){return _0x46cc2a[_0x04b7('0x55')](_0x44f0c3,_0x3ffe1d,function(_0x44f4a1){if(_0x44f4a1){console[_0x04b7('0x63')](_0x04b7('0x64'),_0x44f4a1);}else{fs['unlinkSync'](_0x44f0c3);}});});});}else{return _0x46cc2a[_0x04b7('0xf')](0xc8);}})[_0x04b7('0x36')](handleError(_0x46cc2a,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9748e96..31592a0 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 _0x1701=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1701,0x9c));var _0x1170=function(_0x235282,_0x350d6f){_0x235282=_0x235282-0x0;var _0x128e15=_0x1701[_0x235282];return _0x128e15;};'use strict';var EventEmitter=require(_0x1170('0x0'));var FaxInteraction=require(_0x1170('0x1'))['db'][_0x1170('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x1170('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1170('0x4'),'afterUpdate':_0x1170('0x5'),'afterDestroy':_0x1170('0x6')};function emitEvent(_0x9d4b21){return function(_0x2381e2,_0x21dd6d,_0x2b06ee){_0x2381e2[_0x1170('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3de5ee){_0x2381e2[_0x1170('0x8')](_0x1170('0x9'),_0x3de5ee[_0x1170('0xa')](function(_0xeaeabc){return{'id':_0xeaeabc['id']};}));return FaxMessage[_0x1170('0xb')]({'where':{'FaxInteractionId':_0x2381e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1170('0xc')](function(_0x4f2c09){_0x2381e2[_0x1170('0x8')](_0x1170('0xd'),_0x4f2c09[_0x1170('0xe')]);FaxInteractionEvents['emit'](_0x9d4b21+':'+_0x2381e2['id'],_0x2381e2);FaxInteractionEvents['emit'](_0x9d4b21,_0x2381e2);_0x2b06ee(null);})[_0x1170('0xf')](_0x2b06ee(null));};}for(var e in events){if(events[_0x1170('0x10')](e)){var event=events[e];FaxInteraction[_0x1170('0x11')](e,emitEvent(event));}}module[_0x1170('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x5089=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x218a4d,_0x10a963){var _0x594420=function(_0x17c36e){while(--_0x17c36e){_0x218a4d['push'](_0x218a4d['shift']());}};_0x594420(++_0x10a963);}(_0x5089,0x88));var _0x9508=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x5089[_0x2bb66c];return _0x1e0f98;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x9508('0x0'))['db'][_0x9508('0x1')];var FaxMessage=require(_0x9508('0x0'))['db'][_0x9508('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9508('0x3')](0x0);var events={'afterCreate':_0x9508('0x4'),'afterUpdate':_0x9508('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfdc26c){return function(_0x5aedaa,_0x448dd9,_0x561625){_0x5aedaa[_0x9508('0x6')]({'attributes':['id'],'raw':!![]})[_0x9508('0x7')](function(_0x2af98d){_0x5aedaa[_0x9508('0x8')](_0x9508('0x9'),_0x2af98d['map'](function(_0x1fe073){return{'id':_0x1fe073['id']};}));return FaxMessage[_0x9508('0xa')]({'where':{'FaxInteractionId':_0x5aedaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9508('0x7')](function(_0x1529b5){_0x5aedaa[_0x9508('0x8')](_0x9508('0xb'),_0x1529b5[_0x9508('0xc')]);FaxInteractionEvents[_0x9508('0xd')](_0xfdc26c+':'+_0x5aedaa['id'],_0x5aedaa);FaxInteractionEvents[_0x9508('0xd')](_0xfdc26c,_0x5aedaa);_0x561625(null);})[_0x9508('0xe')](_0x561625(null));};}for(var e in events){if(events[_0x9508('0xf')](e)){var event=events[e];FaxInteraction[_0x9508('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5d717c6..450d714 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 _0x803d=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxInteraction'];(function(_0x3d5356,_0x10e41a){var _0x40c6b6=function(_0x2babe5){while(--_0x2babe5){_0x3d5356['push'](_0x3d5356['shift']());}};_0x40c6b6(++_0x10e41a);}(_0x803d,0x15a));var _0xd803=function(_0x2d5938,_0x1fc643){_0x2d5938=_0x2d5938-0x0;var _0x4c76b9=_0x803d[_0x2d5938];return _0x4c76b9;};'use strict';var _=require(_0xd803('0x0'));var util=require('util');var logger=require(_0xd803('0x1'))(_0xd803('0x2'));var moment=require(_0xd803('0x3'));var BPromise=require(_0xd803('0x4'));var rp=require(_0xd803('0x5'));var fs=require('fs');var path=require(_0xd803('0x6'));var rimraf=require('rimraf');var config=require(_0xd803('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xd803('0x8')]=function(_0x6106e5,_0x6e439e){return _0x6106e5[_0xd803('0x9')](_0xd803('0xa'),attributes,{'tableName':_0xd803('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f4973,_0x186345,_0x1edf1b){if(_0x4f4973[_0xd803('0xc')](_0xd803('0xd'))){_0x4f4973[_0xd803('0xe')]=moment()[_0xd803('0xf')](_0xd803('0x10'));}_0x1edf1b(null,_0x4f4973);}}});}; \ No newline at end of file +var _0xb1fc=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x471b69,_0x38e3b6){var _0x3e1854=function(_0x2dab9d){while(--_0x2dab9d){_0x471b69['push'](_0x471b69['shift']());}};_0x3e1854(++_0x38e3b6);}(_0xb1fc,0xf2));var _0xcb1f=function(_0x4fbb78,_0x273eae){_0x4fbb78=_0x4fbb78-0x0;var _0x5eb3a3=_0xb1fc[_0x4fbb78];return _0x5eb3a3;};'use strict';var _=require(_0xcb1f('0x0'));var util=require(_0xcb1f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcb1f('0x2'));var BPromise=require('bluebird');var rp=require(_0xcb1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb1f('0x4'));var config=require(_0xcb1f('0x5'));var attributes=require(_0xcb1f('0x6'));module['exports']=function(_0x48f9c5,_0xede29c){return _0x48f9c5[_0xcb1f('0x7')](_0xcb1f('0x8'),attributes,{'tableName':_0xcb1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd21c9e,_0x1849e0,_0xe62505){if(_0xd21c9e[_0xcb1f('0xa')](_0xcb1f('0xb'))){_0xd21c9e[_0xcb1f('0xc')]=moment()[_0xcb1f('0xd')](_0xcb1f('0xe'));}_0xe62505(null,_0xd21c9e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 8eb0c95..48a206b 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 _0xb879=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xfa9eea,_0x2d1cf6){var _0x3d252f=function(_0x479699){while(--_0x479699){_0xfa9eea['push'](_0xfa9eea['shift']());}};_0x3d252f(++_0x2d1cf6);}(_0xb879,0x1bd));var _0x9b87=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb879[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x9b87('0x0'));var moment=require(_0x9b87('0x1'));var BPromise=require(_0x9b87('0x2'));var rs=require(_0x9b87('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b87('0x4'))['db'];var utils=require(_0x9b87('0x5'));var logger=require(_0x9b87('0x6'))(_0x9b87('0x7'));var config=require(_0x9b87('0x8'));var jayson=require(_0x9b87('0x9'));var client=jayson[_0x9b87('0xa')][_0x9b87('0xb')]({'port':0x232a});config[_0x9b87('0xc')]=_[_0x9b87('0xd')](config['redis'],{'host':_0x9b87('0xe'),'port':0x18eb});var socket=require(_0x9b87('0xf'))(new Redis(config[_0x9b87('0xc')]));require(_0x9b87('0x10'))[_0x9b87('0x11')](socket);function respondWithRpcPromise(_0x13b0ac,_0x1aa913,_0x4d629c){return new BPromise(function(_0x94cf14,_0x3b4eb1){return client[_0x9b87('0x12')](_0x13b0ac,_0x4d629c)[_0x9b87('0x13')](function(_0x1fb59a){logger[_0x9b87('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x9b87('0x15'));logger[_0x9b87('0x16')](_0x9b87('0x17'),_0x1aa913,'request\x20sent',JSON[_0x9b87('0x18')](_0x1fb59a));if(_0x1fb59a[_0x9b87('0x19')]){if(_0x1fb59a['error'][_0x9b87('0x1a')]===0x1f4){logger[_0x9b87('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x1fb59a[_0x9b87('0x19')][_0x9b87('0x1b')]);return _0x3b4eb1(_0x1fb59a['error'][_0x9b87('0x1b')]);}logger[_0x9b87('0x19')](_0x9b87('0x1c'),_0x1aa913,_0x1fb59a[_0x9b87('0x19')][_0x9b87('0x1b')]);return _0x94cf14(_0x1fb59a[_0x9b87('0x19')]['message']);}else{logger[_0x9b87('0x14')](_0x9b87('0x1c'),_0x1aa913,_0x9b87('0x15'));_0x94cf14(_0x1fb59a[_0x9b87('0x1d')]['message']);}})[_0x9b87('0x1e')](function(_0x5a70b0){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x5a70b0);_0x3b4eb1(_0x5a70b0);});});}exports[_0x9b87('0x1f')]=function(_0xc52056){var _0x33720b=this;return new Promise(function(_0x39d32f,_0x4d79f7){return db[_0x9b87('0x20')][_0x9b87('0x21')](_0xc52056[_0x9b87('0x22')],{'raw':_0xc52056['options']?_0xc52056['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')]['where']||null:null,'attributes':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')][_0x9b87('0x24')]||null:null,'limit':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')][_0x9b87('0x25')]||null:null})[_0x9b87('0x13')](function(_0x59db01){logger['info'](_0x9b87('0x1f'),_0xc52056);logger[_0x9b87('0x16')]('UpdateFaxInteraction',_0xc52056,JSON['stringify'](_0x59db01));_0x39d32f(_0x59db01);})[_0x9b87('0x1e')](function(_0x12a0c1){logger[_0x9b87('0x19')](_0x9b87('0x1f'),_0x12a0c1[_0x9b87('0x1b')],_0xc52056);_0x4d79f7(_0x33720b['error'](0x1f4,_0x12a0c1[_0x9b87('0x1b')]));});});};exports['AddTagsToFaxInteraction']=function(_0x48f9be){return new Promise(function(_0x4f9462,_0x1bf945){return db[_0x9b87('0x20')][_0x9b87('0x26')]({'where':_0x48f9be[_0x9b87('0x23')]?_0x48f9be[_0x9b87('0x23')][_0x9b87('0x27')]||null:null})[_0x9b87('0x13')](function(_0x375f79){if(_0x375f79){return _0x375f79[_0x9b87('0x28')](_0x48f9be[_0x9b87('0x22')][_0x9b87('0x29')],_[_0x9b87('0x2a')](_0x48f9be['body'],['ids','id'])||{});}})[_0x9b87('0x2b')](function(_0x5024a7){logger[_0x9b87('0x14')](_0x9b87('0x2c'),_0x48f9be);logger['debug'](_0x9b87('0x2c'),_0x48f9be,JSON['stringify'](_0x5024a7));_0x4f9462(_0x5024a7);})[_0x9b87('0x1e')](function(_0x240d0d){logger[_0x9b87('0x19')]('AddTags',_0x240d0d['message'],_0x48f9be);_0x1bf945(_this[_0x9b87('0x19')](0x1f4,_0x240d0d[_0x9b87('0x1b')]));});});}; \ No newline at end of file +var _0x76cc=['result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','find','then','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info'];(function(_0x35e33c,_0x16dd60){var _0x2f854c=function(_0x71410f){while(--_0x71410f){_0x35e33c['push'](_0x35e33c['shift']());}};_0x2f854c(++_0x16dd60);}(_0x76cc,0x130));var _0xc76c=function(_0x5794db,_0x2ee0d4){_0x5794db=_0x5794db-0x0;var _0x1dbfd6=_0x76cc[_0x5794db];return _0x1dbfd6;};'use strict';var _=require(_0xc76c('0x0'));var util=require('util');var moment=require(_0xc76c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc76c('0x2'));var fs=require('fs');var Redis=require(_0xc76c('0x3'));var db=require(_0xc76c('0x4'))['db'];var utils=require(_0xc76c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc76c('0x6'));var jayson=require(_0xc76c('0x7'));var client=jayson[_0xc76c('0x8')][_0xc76c('0x9')]({'port':0x232a});config[_0xc76c('0xa')]=_['defaults'](config['redis'],{'host':_0xc76c('0xb'),'port':0x18eb});var socket=require(_0xc76c('0xc'))(new Redis(config[_0xc76c('0xa')]));require(_0xc76c('0xd'))[_0xc76c('0xe')](socket);function respondWithRpcPromise(_0x1bce86,_0x120c68,_0x3c65d4){return new BPromise(function(_0x3a395f,_0x185c8e){return client['request'](_0x1bce86,_0x3c65d4)['then'](function(_0x3fde55){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x120c68,_0xc76c('0xf'));logger[_0xc76c('0x10')](_0xc76c('0x11'),_0x120c68,_0xc76c('0xf'),JSON[_0xc76c('0x12')](_0x3fde55));if(_0x3fde55[_0xc76c('0x13')]){if(_0x3fde55[_0xc76c('0x13')][_0xc76c('0x14')]===0x1f4){logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x3fde55[_0xc76c('0x13')][_0xc76c('0x16')]);return _0x185c8e(_0x3fde55[_0xc76c('0x13')]['message']);}logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x3fde55['error']['message']);return _0x3a395f(_0x3fde55[_0xc76c('0x13')][_0xc76c('0x16')]);}else{logger[_0xc76c('0x17')](_0xc76c('0x15'),_0x120c68,_0xc76c('0xf'));_0x3a395f(_0x3fde55[_0xc76c('0x18')]['message']);}})[_0xc76c('0x19')](function(_0x1177f3){logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x1177f3);_0x185c8e(_0x1177f3);});});}exports[_0xc76c('0x1a')]=function(_0x34c031){var _0x4b8c9c=this;return new Promise(function(_0x47f55f,_0x349abb){return db[_0xc76c('0x1b')][_0xc76c('0x1c')](_0x34c031[_0xc76c('0x1d')],{'raw':_0x34c031[_0xc76c('0x1e')]?_0x34c031['options'][_0xc76c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34c031[_0xc76c('0x1e')]?_0x34c031[_0xc76c('0x1e')][_0xc76c('0x20')]||null:null,'attributes':_0x34c031[_0xc76c('0x1e')]?_0x34c031[_0xc76c('0x1e')][_0xc76c('0x21')]||null:null,'limit':_0x34c031['options']?_0x34c031['options'][_0xc76c('0x22')]||null:null})['then'](function(_0x5e5ccf){logger[_0xc76c('0x17')](_0xc76c('0x1a'),_0x34c031);logger[_0xc76c('0x10')](_0xc76c('0x1a'),_0x34c031,JSON[_0xc76c('0x12')](_0x5e5ccf));_0x47f55f(_0x5e5ccf);})[_0xc76c('0x19')](function(_0x5c27cf){logger[_0xc76c('0x13')](_0xc76c('0x1a'),_0x5c27cf[_0xc76c('0x16')],_0x34c031);_0x349abb(_0x4b8c9c[_0xc76c('0x13')](0x1f4,_0x5c27cf['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x102ab4){return new Promise(function(_0x26fce0,_0x665f37){return db[_0xc76c('0x1b')][_0xc76c('0x23')]({'where':_0x102ab4[_0xc76c('0x1e')]?_0x102ab4[_0xc76c('0x1e')][_0xc76c('0x20')]||null:null})[_0xc76c('0x24')](function(_0x34d3b2){if(_0x34d3b2){return _0x34d3b2['addTags'](_0x102ab4[_0xc76c('0x1d')][_0xc76c('0x25')],_[_0xc76c('0x26')](_0x102ab4[_0xc76c('0x1d')],[_0xc76c('0x25'),'id'])||{});}})[_0xc76c('0x27')](function(_0x2a629d){logger[_0xc76c('0x17')](_0xc76c('0x28'),_0x102ab4);logger[_0xc76c('0x10')](_0xc76c('0x28'),_0x102ab4,JSON[_0xc76c('0x12')](_0x2a629d));_0x26fce0(_0x2a629d);})[_0xc76c('0x19')](function(_0xc4f208){logger[_0xc76c('0x13')](_0xc76c('0x28'),_0xc4f208[_0xc76c('0x16')],_0x102ab4);_0x665f37(_this[_0xc76c('0x13')](0x1f4,_0xc4f208[_0xc76c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3e07f17..9ded1dc 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 _0xef29=['faxInteraction:','./faxInteraction.events','save','update','emit','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xef29,0x1c3));var _0x9ef2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xef29[_0x40a045];return _0x1a687c;};'use strict';var FaxInteractionEvents=require(_0x9ef2('0x0'));var events=[_0x9ef2('0x1'),'remove',_0x9ef2('0x2')];function createListener(_0x1ddab1,_0x394d01){return function(_0x2f88b3){_0x394d01[_0x9ef2('0x3')](_0x1ddab1,_0x2f88b3);};}function removeListener(_0x4e0ce3,_0x1948ac){return function(){FaxInteractionEvents['removeListener'](_0x4e0ce3,_0x1948ac);};}exports[_0x9ef2('0x4')]=function(_0x3cb50a){for(var _0x398553=0x0,_0x4f99df=events['length'];_0x398553<_0x4f99df;_0x398553++){var _0x496f58=events[_0x398553];var _0x20b509=createListener(_0x9ef2('0x5')+_0x496f58,_0x3cb50a);FaxInteractionEvents['on'](_0x496f58,_0x20b509);}}; \ No newline at end of file +var _0xf105=['update','removeListener','register','length','./faxInteraction.events','save','remove'];(function(_0x1754db,_0x3e32f7){var _0x273e77=function(_0x2c71c3){while(--_0x2c71c3){_0x1754db['push'](_0x1754db['shift']());}};_0x273e77(++_0x3e32f7);}(_0xf105,0x185));var _0x5f10=function(_0x3a955f,_0x1a57f6){_0x3a955f=_0x3a955f-0x0;var _0x4dccc9=_0xf105[_0x3a955f];return _0x4dccc9;};'use strict';var FaxInteractionEvents=require(_0x5f10('0x0'));var events=[_0x5f10('0x1'),_0x5f10('0x2'),_0x5f10('0x3')];function createListener(_0x4e05cb,_0x4cd87c){return function(_0x4029e6){_0x4cd87c['emit'](_0x4e05cb,_0x4029e6);};}function removeListener(_0x1ace41,_0x15b59d){return function(){FaxInteractionEvents[_0x5f10('0x4')](_0x1ace41,_0x15b59d);};}exports[_0x5f10('0x5')]=function(_0x31a4d5){for(var _0x444dc4=0x0,_0x54a3e8=events[_0x5f10('0x6')];_0x444dc4<_0x54a3e8;_0x444dc4++){var _0x1109cb=events[_0x444dc4];var _0x325831=createListener('faxInteraction:'+_0x1109cb,_0x31a4d5);FaxInteractionEvents['on'](_0x1109cb,_0x325831);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 95851a3..2d61f77 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 _0xf596=['addTags','put','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags'];(function(_0x3cc90b,_0x1b69d9){var _0x34051b=function(_0x1f01f7){while(--_0x1f01f7){_0x3cc90b['push'](_0x3cc90b['shift']());}};_0x34051b(++_0x1b69d9);}(_0xf596,0xd3));var _0x6f59=function(_0x356719,_0x1be5ac){_0x356719=_0x356719-0x0;var _0xee4c46=_0xf596[_0x356719];return _0xee4c46;};'use strict';var multer=require(_0x6f59('0x0'));var util=require(_0x6f59('0x1'));var path=require(_0x6f59('0x2'));var timeout=require(_0x6f59('0x3'));var express=require(_0x6f59('0x4'));var router=express[_0x6f59('0x5')]();var fs_extra=require(_0x6f59('0x6'));var auth=require(_0x6f59('0x7'));var interaction=require(_0x6f59('0x8'));var config=require(_0x6f59('0x9'));var controller=require(_0x6f59('0xa'));router[_0x6f59('0xb')]('/',auth[_0x6f59('0xc')](),controller[_0x6f59('0xd')]);router[_0x6f59('0xb')]('/describe',auth[_0x6f59('0xc')](),controller['describe']);router[_0x6f59('0xb')](_0x6f59('0xe'),auth[_0x6f59('0xc')](),controller[_0x6f59('0xf')]);router['get'](_0x6f59('0x10'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x11')]);router[_0x6f59('0xb')](_0x6f59('0x12'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x13')]);router[_0x6f59('0x14')]('/',auth[_0x6f59('0xc')](),controller[_0x6f59('0x15')]);router[_0x6f59('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6f59('0x16')]);router['post'](_0x6f59('0x17'),auth[_0x6f59('0xc')](),interaction[_0x6f59('0x18')](_0x6f59('0x19'),_0x6f59('0x1a')),controller[_0x6f59('0x1b')]);router[_0x6f59('0x1c')]('/:id',auth[_0x6f59('0xc')](),interaction[_0x6f59('0x18')](_0x6f59('0x19'),'faxinteraction:update'),controller[_0x6f59('0x1d')]);router[_0x6f59('0x1e')](_0x6f59('0xe'),auth[_0x6f59('0xc')](),interaction['tracked'](_0x6f59('0x19'),_0x6f59('0x1f')),controller['destroy']);router[_0x6f59('0x1e')](_0x6f59('0x17'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x20')]);module[_0x6f59('0x21')]=router; \ No newline at end of file +var _0xe594=['../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','addTags','put','faxinteraction:update','update','fax','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x458d79,_0x5c8a15){var _0x516b05=function(_0xb2f030){while(--_0xb2f030){_0x458d79['push'](_0x458d79['shift']());}};_0x516b05(++_0x5c8a15);}(_0xe594,0x66));var _0x4e59=function(_0x15a6e7,_0x25ca23){_0x15a6e7=_0x15a6e7-0x0;var _0x242f62=_0xe594[_0x15a6e7];return _0x242f62;};'use strict';var multer=require(_0x4e59('0x0'));var util=require('util');var path=require(_0x4e59('0x1'));var timeout=require(_0x4e59('0x2'));var express=require(_0x4e59('0x3'));var router=express[_0x4e59('0x4')]();var fs_extra=require(_0x4e59('0x5'));var auth=require(_0x4e59('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4e59('0x7'));var controller=require(_0x4e59('0x8'));router[_0x4e59('0x9')]('/',auth[_0x4e59('0xa')](),controller['index']);router[_0x4e59('0x9')]('/describe',auth[_0x4e59('0xa')](),controller['describe']);router[_0x4e59('0x9')](_0x4e59('0xb'),auth[_0x4e59('0xa')](),controller[_0x4e59('0xc')]);router[_0x4e59('0x9')](_0x4e59('0xd'),auth[_0x4e59('0xa')](),controller['getMessages']);router[_0x4e59('0x9')](_0x4e59('0xe'),auth[_0x4e59('0xa')](),controller['download']);router[_0x4e59('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e59('0x10')]);router['post'](_0x4e59('0xd'),auth[_0x4e59('0xa')](),controller[_0x4e59('0x11')]);router['post'](_0x4e59('0x12'),auth['isAuthenticated'](),interaction[_0x4e59('0x13')]('fax','faxinteraction:addtags'),controller[_0x4e59('0x14')]);router[_0x4e59('0x15')](_0x4e59('0xb'),auth[_0x4e59('0xa')](),interaction[_0x4e59('0x13')]('fax',_0x4e59('0x16')),controller[_0x4e59('0x17')]);router['delete'](_0x4e59('0xb'),auth[_0x4e59('0xa')](),interaction[_0x4e59('0x13')](_0x4e59('0x18'),'faxinteraction:destroy'),controller[_0x4e59('0x19')]);router['delete']('/:id/tags',auth[_0x4e59('0xa')](),controller[_0x4e59('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0a2d81c..22e58d5 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 _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xc73e,0x1e9));var _0xec73=function(_0x2a43c5,_0x143472){_0x2a43c5=_0x2a43c5-0x0;var _0x14902f=_0xc73e[_0x2a43c5];return _0x14902f;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file +var _0x3248=['exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x33dd5f,_0x4cbe7c){var _0x5c3713=function(_0x1093d3){while(--_0x1093d3){_0x33dd5f['push'](_0x33dd5f['shift']());}};_0x5c3713(++_0x4cbe7c);}(_0x3248,0x1bc));var _0x8324=function(_0x4ab1ba,_0x161a41){_0x4ab1ba=_0x4ab1ba-0x0;var _0x1042c9=_0x3248[_0x4ab1ba];return _0x1042c9;};'use strict';var Sequelize=require('sequelize');module[_0x8324('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8324('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8324('0x2')]('in',_0x8324('0x3')),'defaultValue':_0x8324('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8324('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8324('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b51d5e6..753c209 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 _0x5d65=['rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','fields','find','body','describe','accept','sms','fax','acceptMessage','reject','UserId','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','format','SIP/%s','channel','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','attachments','Attachment','download','join','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','fax-interactions','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','FaxMessage'];(function(_0x21ff1b,_0xc206e1){var _0x525131=function(_0xc9c53e){while(--_0xc9c53e){_0x21ff1b['push'](_0x21ff1b['shift']());}};_0x525131(++_0xc206e1);}(_0x5d65,0xc4));var _0x55d6=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5d65[_0x33032e];return _0x13316b;};'use strict';var util=require(_0x55d6('0x0'));var path=require('path');var _=require(_0x55d6('0x1'));var Redis=require(_0x55d6('0x2'));var interactionService=require(_0x55d6('0x3'));var qs=require(_0x55d6('0x4'));var logger=require(_0x55d6('0x5'))(_0x55d6('0x6'));var config=require(_0x55d6('0x7'));var db=require(_0x55d6('0x8'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x55d6('0x9'))(new Redis(config['redis']));require(_0x55d6('0xa'))['register'](socket);var jayson=require(_0x55d6('0xb'));var client=jayson[_0x55d6('0xc')][_0x55d6('0xd')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x55d6('0xe'));function respondWithRpcPromise(_0x2101ca,_0x672b27,_0x4be8ee,_0x4b5f9a){return new Promise(function(_0x43074a,_0x36c554){var _0x2b30bf=_0x4b5f9a||client;return _0x2b30bf[_0x55d6('0xf')](_0x2101ca,_0x4be8ee)[_0x55d6('0x10')](function(_0x461835){logger['info']('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x55d6('0x11'));logger[_0x55d6('0x12')](_0x55d6('0x13'),_0x672b27,_0x55d6('0x11'),JSON[_0x55d6('0x14')](_0x461835));if(_0x461835[_0x55d6('0x15')]){if(_0x461835[_0x55d6('0x15')][_0x55d6('0x16')]===0x1f4){logger[_0x55d6('0x15')]('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x461835[_0x55d6('0x15')][_0x55d6('0x17')]);return _0x36c554(_0x461835[_0x55d6('0x15')]['message']);}logger[_0x55d6('0x15')]('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x461835[_0x55d6('0x15')]['message']);return _0x43074a(_0x461835[_0x55d6('0x15')][_0x55d6('0x17')]);}else{logger[_0x55d6('0x18')](_0x55d6('0x19'),_0x672b27,_0x55d6('0x11'));_0x43074a(_0x461835[_0x55d6('0x1a')]['message']);}})[_0x55d6('0x1b')](function(_0x24664c){logger[_0x55d6('0x15')](_0x55d6('0x19'),_0x672b27,_0x24664c);_0x36c554(_0x24664c);});});}function respondWithResult(_0x381156,_0x440852){_0x440852=_0x440852||0xc8;return function(_0x25b765){if(_0x25b765){return _0x381156[_0x55d6('0x1c')](_0x440852)[_0x55d6('0x1d')](_0x25b765);}};}function respondWithFilteredResult(_0x66897c,_0x4b2a7a){return function(_0x1764c0){if(_0x1764c0){var _0x25e069=typeof _0x4b2a7a[_0x55d6('0x1e')]===_0x55d6('0x1f')&&typeof _0x4b2a7a[_0x55d6('0x20')]===_0x55d6('0x1f');var _0x5dd400=_0x1764c0['count'];var _0xcfe9f5=_0x25e069?0x0:_0x4b2a7a[_0x55d6('0x1e')];var _0x3b2dde=_0x25e069?_0x1764c0[_0x55d6('0x21')]:_0x4b2a7a[_0x55d6('0x1e')]+_0x4b2a7a[_0x55d6('0x20')];var _0xe5e03e;if(_0x3b2dde>=_0x5dd400){_0x3b2dde=_0x5dd400;_0xe5e03e=0xc8;}else{_0xe5e03e=0xce;}_0x66897c[_0x55d6('0x1c')](_0xe5e03e);return _0x66897c[_0x55d6('0x22')](_0x55d6('0x23'),_0xcfe9f5+'-'+_0x3b2dde+'/'+_0x5dd400)['json'](_0x1764c0);}return null;};}function saveUpdates(_0x44e63e){return function(_0x2f8028){if(_0x2f8028){return _0x2f8028[_0x55d6('0x24')](_0x44e63e)['then'](function(_0x319500){return _0x319500;});}return null;};}function removeEntity(_0x3acb34){return function(_0x56ddb1){if(_0x56ddb1){return _0x56ddb1[_0x55d6('0x25')]()['then'](function(){_0x3acb34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5784e9){return function(_0x44e9a1){if(!_0x44e9a1){_0x5784e9['sendStatus'](0x194);}return _0x44e9a1;};}function handleError(_0x46cb8a,_0x4b7f81){_0x4b7f81=_0x4b7f81||0x1f4;return function(_0x1bee32){logger[_0x55d6('0x15')](_0x1bee32[_0x55d6('0x26')]);if(_0x1bee32[_0x55d6('0x27')]){delete _0x1bee32[_0x55d6('0x27')];}_0x46cb8a[_0x55d6('0x1c')](_0x4b7f81)[_0x55d6('0x28')](_0x1bee32);};}exports['index']=function(_0x3f0726,_0x580173){var _0x560947={},_0x4d539e={},_0x412a57={'count':0x0,'rows':[]};var _0x4ad535=_['map'](db[_0x55d6('0x29')][_0x55d6('0x2a')],function(_0x1f39e9){return{'name':_0x1f39e9[_0x55d6('0x2b')],'type':_0x1f39e9[_0x55d6('0x2c')][_0x55d6('0x2d')]};});_0x4d539e['model']=_[_0x55d6('0x2e')](_0x4ad535,_0x55d6('0x27'));_0x4d539e['query']=_[_0x55d6('0x2f')](_0x3f0726[_0x55d6('0x30')]);_0x4d539e[_0x55d6('0x31')]=_[_0x55d6('0x32')](_0x4d539e['model'],_0x4d539e['query']);_0x560947[_0x55d6('0x33')]=_['intersection'](_0x4d539e[_0x55d6('0x34')],qs['fields'](_0x3f0726['query']['fields']));_0x560947[_0x55d6('0x33')]=_0x560947[_0x55d6('0x33')][_0x55d6('0x35')]?_0x560947[_0x55d6('0x33')]:_0x4d539e[_0x55d6('0x34')];if(!_0x3f0726[_0x55d6('0x30')][_0x55d6('0x36')](_0x55d6('0x37'))){_0x560947[_0x55d6('0x20')]=qs['limit'](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x20')]);_0x560947[_0x55d6('0x1e')]=qs[_0x55d6('0x1e')](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x1e')]);}_0x560947['order']=qs['sort'](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x38')]);_0x560947[_0x55d6('0x39')]=qs[_0x55d6('0x31')](_[_0x55d6('0x3a')](_0x3f0726[_0x55d6('0x30')],_0x4d539e['filters']),_0x4ad535);if(_0x3f0726[_0x55d6('0x30')][_0x55d6('0x3b')]){_0x560947[_0x55d6('0x39')]=_['merge'](_0x560947[_0x55d6('0x39')],{'$or':_['map'](_0x4ad535,function(_0x4057ad){if(_0x4057ad['type']!==_0x55d6('0x3c')){var _0x4dc9a7={};_0x4dc9a7[_0x4057ad[_0x55d6('0x27')]]={'$like':'%'+_0x3f0726[_0x55d6('0x30')][_0x55d6('0x3b')]+'%'};return _0x4dc9a7;}})});}_0x560947=_[_0x55d6('0x3d')]({},_0x560947,_0x3f0726['options']);var _0x550b7f={'where':_0x560947[_0x55d6('0x39')]};return db[_0x55d6('0x29')][_0x55d6('0x21')](_0x550b7f)[_0x55d6('0x10')](function(_0x5241a2){_0x412a57[_0x55d6('0x21')]=_0x5241a2;if(_0x3f0726['query'][_0x55d6('0x3e')]){_0x560947[_0x55d6('0x3f')]=[{'all':!![]}];}return db[_0x55d6('0x29')][_0x55d6('0x40')](_0x560947);})[_0x55d6('0x10')](function(_0x5427ef){_0x412a57[_0x55d6('0x41')]=_0x5427ef;return _0x412a57;})['then'](respondWithFilteredResult(_0x580173,_0x560947))[_0x55d6('0x1b')](handleError(_0x580173,null));};exports[_0x55d6('0x42')]=function(_0x4f8aaa,_0x1b40b2){var _0x2ac2d3={'raw':!![],'where':{'id':_0x4f8aaa[_0x55d6('0x43')]['id']}},_0x234276={};_0x234276[_0x55d6('0x34')]=_['keys'](db[_0x55d6('0x29')]['rawAttributes']);_0x234276[_0x55d6('0x30')]=_[_0x55d6('0x2f')](_0x4f8aaa['query']);_0x234276[_0x55d6('0x31')]=_['intersection'](_0x234276[_0x55d6('0x34')],_0x234276[_0x55d6('0x30')]);_0x2ac2d3[_0x55d6('0x33')]=_['intersection'](_0x234276[_0x55d6('0x34')],qs['fields'](_0x4f8aaa[_0x55d6('0x30')][_0x55d6('0x44')]));_0x2ac2d3[_0x55d6('0x33')]=_0x2ac2d3[_0x55d6('0x33')]['length']?_0x2ac2d3[_0x55d6('0x33')]:_0x234276[_0x55d6('0x34')];if(_0x4f8aaa[_0x55d6('0x30')][_0x55d6('0x3e')]){_0x2ac2d3['include']=[{'all':!![]}];}_0x2ac2d3=_[_0x55d6('0x3d')]({},_0x2ac2d3,_0x4f8aaa['options']);return db[_0x55d6('0x29')][_0x55d6('0x45')](_0x2ac2d3)[_0x55d6('0x10')](handleEntityNotFound(_0x1b40b2,null))[_0x55d6('0x10')](respondWithResult(_0x1b40b2,null))[_0x55d6('0x1b')](handleError(_0x1b40b2,null));};exports[_0x55d6('0x24')]=function(_0x163a77,_0x387d5b){if(_0x163a77['body']['id']){delete _0x163a77[_0x55d6('0x46')]['id'];}return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x163a77[_0x55d6('0x43')]['id']}})[_0x55d6('0x10')](handleEntityNotFound(_0x387d5b,null))['then'](saveUpdates(_0x163a77[_0x55d6('0x46')],null))[_0x55d6('0x10')](respondWithResult(_0x387d5b,null))['catch'](handleError(_0x387d5b,null));};exports['destroy']=function(_0x361f7e,_0x410ed2){return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x361f7e[_0x55d6('0x43')]['id']}})[_0x55d6('0x10')](handleEntityNotFound(_0x410ed2,null))[_0x55d6('0x10')](removeEntity(_0x410ed2,null))[_0x55d6('0x1b')](handleError(_0x410ed2,null));};exports[_0x55d6('0x47')]=function(_0x1e1c3c,_0x562b5d){return db[_0x55d6('0x29')]['describe']()[_0x55d6('0x10')](respondWithResult(_0x562b5d,null))[_0x55d6('0x1b')](handleError(_0x562b5d,null));};exports[_0x55d6('0x48')]=function(_0x415bfa,_0x42cc86){var _0x271f0f=_0x55d6('0x49');return interactionService['acceptMessage'](_0x415bfa,_0x271f0f)['then'](respondWithResult(_0x42cc86,null))[_0x55d6('0x1b')](handleError(_0x42cc86,null));};exports[_0x55d6('0x48')]=function(_0xd6b55a,_0x14b7af){var _0x36b20e=_0x55d6('0x4a');return interactionService[_0x55d6('0x4b')](_0xd6b55a,_0x36b20e)[_0x55d6('0x10')](respondWithResult(_0x14b7af,null))[_0x55d6('0x1b')](handleError(_0x14b7af,null));};exports[_0x55d6('0x4c')]=function(_0x6974f7,_0x53298e){var _0x57def9={'agent':{},'channel':_0x55d6('0x4a')};if(_0x6974f7['body']['id']){delete _0x6974f7[_0x55d6('0x46')]['id'];}_0x6974f7[_0x55d6('0x46')]['UserId']=_0x6974f7[_0x55d6('0x46')][_0x55d6('0x4d')]||_0x6974f7['user']['id'];_0x57def9['agent']['id']=_0x6974f7[_0x55d6('0x46')]['UserId'];return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x6974f7['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53298e,null))[_0x55d6('0x10')](function(_0x16ef8f){if(_0x16ef8f){_0x57def9[_0x55d6('0x17')]=_0x16ef8f[_0x55d6('0x4e')]({'plain':!![]});return db[_0x55d6('0x4f')][_0x55d6('0x45')]({'where':{'id':_0x16ef8f[_0x55d6('0x50')]}});}return null;})['then'](handleEntityNotFound(_0x53298e,null))[_0x55d6('0x10')](function(_0x3f83bf){if(_0x3f83bf){_0x57def9[_0x55d6('0x51')]=_0x3f83bf[_0x55d6('0x4e')]({'plain':!![]});interaction_log[_0x55d6('0x18')](_0x55d6('0x52'),_0x6974f7[_0x55d6('0x53')]['id'],_0x6974f7[_0x55d6('0x53')]['name'],_0x6974f7[_0x55d6('0x53')][_0x55d6('0x54')],_0x57def9[_0x55d6('0x51')]['id'],_0x6974f7[_0x55d6('0x46')]?JSON[_0x55d6('0x14')](_0x6974f7[_0x55d6('0x46')]):_0x55d6('0x55'));return respondWithRpcPromise(_0x55d6('0x56'),_0x55d6('0x57'),_0x57def9);}return null;})[_0x55d6('0x10')](function(_0x4df1d3){var _0x2d0959='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df1d3['message'][_0x55d6('0x58')];return db[_0x55d6('0x59')]['query'](_0x2d0959,{'type':db[_0x55d6('0x5a')][_0x55d6('0x5b')][_0x55d6('0x5c')],'raw':!![]})[_0x55d6('0x10')](function(_0x5cf599){return _0x5cf599;});})['then'](function(_0x2f14df){if(_0x2f14df){_0x57def9['message'][_0x55d6('0x5d')]=_0x2f14df[0x0];if(!_0x6974f7[_0x55d6('0x46')][_0x55d6('0x4d')])return;return db[_0x55d6('0x5e')][_0x55d6('0x45')]({'where':{'id':_0x6974f7[_0x55d6('0x46')]['UserId'],'role':_0x55d6('0x5f')},'attributes':['id',_0x55d6('0x27'),_0x55d6('0x60'),_0x55d6('0x61'),_0x55d6('0x62')],'raw':!![]});}return null;})[_0x55d6('0x10')](function(_0x53b816){if(!_0x53b816)return null;_0x57def9[_0x55d6('0x17')][_0x55d6('0x5f')]=_0x53b816;return _0x57def9;})[_0x55d6('0x10')](function(_0x38de7e){if(_0x38de7e){_0x38de7e[_0x55d6('0x17')]['interface']=util[_0x55d6('0x63')](_0x55d6('0x64'),_0x6974f7[_0x55d6('0x53')][_0x55d6('0x27')]);_0x38de7e[_0x55d6('0x17')][_0x55d6('0x65')]=_0x57def9[_0x55d6('0x65')];_0x38de7e['message']['motionChannel']=_0x57def9[_0x55d6('0x65')];_0x38de7e[_0x55d6('0x17')]['event']=_0x55d6('0x4c');respondWithRpcPromise(_0x55d6('0x66'),_0x55d6('0x66'),{'event':_0x55d6('0x67'),'message':_0x38de7e[_0x55d6('0x17')]},client9002);return _0x57def9;}return null;})[_0x55d6('0x10')](respondWithResult(_0x53298e,null))[_0x55d6('0x1b')](handleError(_0x53298e,null));};exports[_0x55d6('0x68')]=function(_0x49f335,_0x22e8b5){var _0x4953c9;return db[_0x55d6('0x29')][_0x55d6('0x68')](_0x49f335['body'],{})['then'](function(_0x49e2ce){_0x4953c9=_0x49e2ce;return db[_0x55d6('0x69')][_0x55d6('0x6a')]({'where':{'id':_0x4953c9[_0x55d6('0x58')]}});})[_0x55d6('0x10')](function(_0xdfb3f){if(_[_0x55d6('0x6b')](_0xdfb3f)){return;}else{_0x4953c9[_0x55d6('0x4a')]=_0xdfb3f[_0x55d6('0x4a')];return db['Attachment']['findOne']({'where':{'id':_0x4953c9[_0x55d6('0x6c')]}});}})['then'](function(_0x23ea4f){return respondWithRpcPromise(_0x55d6('0x6d'),'SendFax',{'FaxAccountId':_[_0x55d6('0x6b')](_0x49f335[_0x55d6('0x46')])?undefined:_0x49f335[_0x55d6('0x46')][_0x55d6('0x6e')],'path':_[_0x55d6('0x6b')](_0x23ea4f)?undefined:util[_0x55d6('0x63')](_0x55d6('0x6f'),_0x23ea4f[_0x55d6('0x70')]),'fax':_[_0x55d6('0x6b')](_0x4953c9[_0x55d6('0x4a')])?undefined:_0x4953c9[_0x55d6('0x4a')],'AttachmentId':_0x4953c9[_0x55d6('0x6c')]},client9002);})['then'](respondWithResult(_0x22e8b5,0xc9))['catch'](handleError(_0x22e8b5,null));};exports['download']=function(_0xd1e9e9,_0x7de6f1){var _0xe65d61=path['join'](config[_0x55d6('0x71')],_0x55d6('0x72'),'files',_0x55d6('0x73'));return db['FaxMessage'][_0x55d6('0x45')]({'where':{'id':_0xd1e9e9['params']['id']},'include':[{'model':db[_0x55d6('0x74')],'as':_0x55d6('0x74')}]})[_0x55d6('0x10')](handleEntityNotFound(_0x7de6f1,null))[_0x55d6('0x10')](function(_0x4fc46f){if(_0x4fc46f){return _0x7de6f1[_0x55d6('0x75')](path[_0x55d6('0x76')](_0xe65d61,_0x4fc46f['Attachment']['basename']));}})[_0x55d6('0x1b')](handleError(_0x7de6f1,null));}; \ No newline at end of file +var _0x158a=['isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','util','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','undefined','offset','count','status','set','Content-Range','update','destroy','end','stack','name','send','index','FaxMessage','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','find','body','describe','accept','sms','acceptMessage','fax','reject','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax'];(function(_0xd34c38,_0x455c59){var _0xd180d6=function(_0x4a9cd4){while(--_0x4a9cd4){_0xd34c38['push'](_0xd34c38['shift']());}};_0xd180d6(++_0x455c59);}(_0x158a,0x7c));var _0xa158=function(_0x277651,_0x22fb4f){_0x277651=_0x277651-0x0;var _0x4a3eb1=_0x158a[_0x277651];return _0x4a3eb1;};'use strict';var util=require(_0xa158('0x0'));var path=require('path');var _=require('lodash');var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xa158('0x1'))('api');var config=require(_0xa158('0x2'));var db=require(_0xa158('0x3'))['db'];config[_0xa158('0x4')]=_[_0xa158('0x5')](config['redis'],{'host':_0xa158('0x6'),'port':0x18eb});var socket=require(_0xa158('0x7'))(new Redis(config[_0xa158('0x4')]));require(_0xa158('0x8'))['register'](socket);var jayson=require(_0xa158('0x9'));var client=jayson[_0xa158('0xa')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa158('0xb')]({'port':0x232a});var interaction_log=require(_0xa158('0x1'))('fax-interactions');function respondWithRpcPromise(_0x6a2c7b,_0x29d575,_0x36e490,_0x486f18){return new Promise(function(_0x1fc7f1,_0x42dc68){var _0x1277bd=_0x486f18||client;return _0x1277bd['request'](_0x6a2c7b,_0x36e490)[_0xa158('0xc')](function(_0x1f727e){logger['info'](_0xa158('0xd'),_0x29d575,_0xa158('0xe'));logger['debug'](_0xa158('0xf'),_0x29d575,_0xa158('0xe'),JSON[_0xa158('0x10')](_0x1f727e));if(_0x1f727e[_0xa158('0x11')]){if(_0x1f727e[_0xa158('0x11')][_0xa158('0x12')]===0x1f4){logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);return _0x42dc68(_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);}logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);return _0x1fc7f1(_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);}else{logger[_0xa158('0x14')](_0xa158('0xd'),_0x29d575,_0xa158('0xe'));_0x1fc7f1(_0x1f727e[_0xa158('0x15')]['message']);}})[_0xa158('0x16')](function(_0x4835e5){logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x4835e5);_0x42dc68(_0x4835e5);});});}function respondWithResult(_0x1c4bb2,_0x372bc5){_0x372bc5=_0x372bc5||0xc8;return function(_0x58125c){if(_0x58125c){return _0x1c4bb2['status'](_0x372bc5)[_0xa158('0x17')](_0x58125c);}};}function respondWithFilteredResult(_0x1dd414,_0x44823d){return function(_0x21c8ed){if(_0x21c8ed){var _0x104d04=typeof _0x44823d['offset']===_0xa158('0x18')&&typeof _0x44823d['limit']===_0xa158('0x18');var _0x853475=_0x21c8ed['count'];var _0x22f251=_0x104d04?0x0:_0x44823d[_0xa158('0x19')];var _0x443dbf=_0x104d04?_0x21c8ed[_0xa158('0x1a')]:_0x44823d[_0xa158('0x19')]+_0x44823d['limit'];var _0x344492;if(_0x443dbf>=_0x853475){_0x443dbf=_0x853475;_0x344492=0xc8;}else{_0x344492=0xce;}_0x1dd414[_0xa158('0x1b')](_0x344492);return _0x1dd414[_0xa158('0x1c')](_0xa158('0x1d'),_0x22f251+'-'+_0x443dbf+'/'+_0x853475)[_0xa158('0x17')](_0x21c8ed);}return null;};}function saveUpdates(_0xa8b5d){return function(_0x14e470){if(_0x14e470){return _0x14e470[_0xa158('0x1e')](_0xa8b5d)[_0xa158('0xc')](function(_0x469944){return _0x469944;});}return null;};}function removeEntity(_0x1b1bd3){return function(_0x1aa606){if(_0x1aa606){return _0x1aa606[_0xa158('0x1f')]()[_0xa158('0xc')](function(){_0x1b1bd3[_0xa158('0x1b')](0xcc)[_0xa158('0x20')]();});}};}function handleEntityNotFound(_0x49ebf1){return function(_0xcafedc){if(!_0xcafedc){_0x49ebf1['sendStatus'](0x194);}return _0xcafedc;};}function handleError(_0x4ccf3f,_0x3a18a5){_0x3a18a5=_0x3a18a5||0x1f4;return function(_0x3c716f){logger[_0xa158('0x11')](_0x3c716f[_0xa158('0x21')]);if(_0x3c716f[_0xa158('0x22')]){delete _0x3c716f['name'];}_0x4ccf3f['status'](_0x3a18a5)[_0xa158('0x23')](_0x3c716f);};}exports[_0xa158('0x24')]=function(_0x510437,_0x5a4a82){var _0x42fe6e={},_0x5a5dee={},_0x54e1e0={'count':0x0,'rows':[]};var _0x51aee2=_['map'](db[_0xa158('0x25')]['rawAttributes'],function(_0x4066c9){return{'name':_0x4066c9['fieldName'],'type':_0x4066c9[_0xa158('0x26')]['key']};});_0x5a5dee[_0xa158('0x27')]=_['map'](_0x51aee2,'name');_0x5a5dee[_0xa158('0x28')]=_[_0xa158('0x29')](_0x510437[_0xa158('0x28')]);_0x5a5dee[_0xa158('0x2a')]=_[_0xa158('0x2b')](_0x5a5dee['model'],_0x5a5dee[_0xa158('0x28')]);_0x42fe6e['attributes']=_[_0xa158('0x2b')](_0x5a5dee[_0xa158('0x27')],qs['fields'](_0x510437[_0xa158('0x28')][_0xa158('0x2c')]));_0x42fe6e[_0xa158('0x2d')]=_0x42fe6e[_0xa158('0x2d')][_0xa158('0x2e')]?_0x42fe6e[_0xa158('0x2d')]:_0x5a5dee[_0xa158('0x27')];if(!_0x510437[_0xa158('0x28')][_0xa158('0x2f')](_0xa158('0x30'))){_0x42fe6e[_0xa158('0x31')]=qs[_0xa158('0x31')](_0x510437[_0xa158('0x28')][_0xa158('0x31')]);_0x42fe6e['offset']=qs['offset'](_0x510437[_0xa158('0x28')]['offset']);}_0x42fe6e[_0xa158('0x32')]=qs[_0xa158('0x33')](_0x510437[_0xa158('0x28')]['sort']);_0x42fe6e['where']=qs[_0xa158('0x2a')](_['pick'](_0x510437['query'],_0x5a5dee[_0xa158('0x2a')]),_0x51aee2);if(_0x510437[_0xa158('0x28')]['filter']){_0x42fe6e[_0xa158('0x34')]=_[_0xa158('0x35')](_0x42fe6e[_0xa158('0x34')],{'$or':_['map'](_0x51aee2,function(_0x653f4){if(_0x653f4[_0xa158('0x26')]!==_0xa158('0x36')){var _0x6047e={};_0x6047e[_0x653f4[_0xa158('0x22')]]={'$like':'%'+_0x510437['query'][_0xa158('0x37')]+'%'};return _0x6047e;}})});}_0x42fe6e=_[_0xa158('0x35')]({},_0x42fe6e,_0x510437[_0xa158('0x38')]);var _0x197847={'where':_0x42fe6e[_0xa158('0x34')]};return db['FaxMessage'][_0xa158('0x1a')](_0x197847)[_0xa158('0xc')](function(_0x590f18){_0x54e1e0[_0xa158('0x1a')]=_0x590f18;if(_0x510437[_0xa158('0x28')][_0xa158('0x39')]){_0x42fe6e['include']=[{'all':!![]}];}return db[_0xa158('0x25')][_0xa158('0x3a')](_0x42fe6e);})[_0xa158('0xc')](function(_0x54f3b7){_0x54e1e0[_0xa158('0x3b')]=_0x54f3b7;return _0x54e1e0;})[_0xa158('0xc')](respondWithFilteredResult(_0x5a4a82,_0x42fe6e))[_0xa158('0x16')](handleError(_0x5a4a82,null));};exports[_0xa158('0x3c')]=function(_0x4db40e,_0xd44f3e){var _0xf8e5d8={'raw':!![],'where':{'id':_0x4db40e[_0xa158('0x3d')]['id']}},_0x2020f3={};_0x2020f3['model']=_[_0xa158('0x29')](db[_0xa158('0x25')][_0xa158('0x3e')]);_0x2020f3['query']=_['keys'](_0x4db40e['query']);_0x2020f3['filters']=_[_0xa158('0x2b')](_0x2020f3[_0xa158('0x27')],_0x2020f3[_0xa158('0x28')]);_0xf8e5d8[_0xa158('0x2d')]=_[_0xa158('0x2b')](_0x2020f3[_0xa158('0x27')],qs['fields'](_0x4db40e[_0xa158('0x28')]['fields']));_0xf8e5d8[_0xa158('0x2d')]=_0xf8e5d8[_0xa158('0x2d')][_0xa158('0x2e')]?_0xf8e5d8[_0xa158('0x2d')]:_0x2020f3[_0xa158('0x27')];if(_0x4db40e[_0xa158('0x28')][_0xa158('0x39')]){_0xf8e5d8['include']=[{'all':!![]}];}_0xf8e5d8=_['merge']({},_0xf8e5d8,_0x4db40e[_0xa158('0x38')]);return db[_0xa158('0x25')][_0xa158('0x3f')](_0xf8e5d8)['then'](handleEntityNotFound(_0xd44f3e,null))[_0xa158('0xc')](respondWithResult(_0xd44f3e,null))[_0xa158('0x16')](handleError(_0xd44f3e,null));};exports[_0xa158('0x1e')]=function(_0x2f8d28,_0xeefd81){if(_0x2f8d28[_0xa158('0x40')]['id']){delete _0x2f8d28[_0xa158('0x40')]['id'];}return db['FaxMessage'][_0xa158('0x3f')]({'where':{'id':_0x2f8d28[_0xa158('0x3d')]['id']}})[_0xa158('0xc')](handleEntityNotFound(_0xeefd81,null))['then'](saveUpdates(_0x2f8d28[_0xa158('0x40')],null))[_0xa158('0xc')](respondWithResult(_0xeefd81,null))[_0xa158('0x16')](handleError(_0xeefd81,null));};exports[_0xa158('0x1f')]=function(_0x14f754,_0x5aa72f){return db[_0xa158('0x25')]['find']({'where':{'id':_0x14f754[_0xa158('0x3d')]['id']}})[_0xa158('0xc')](handleEntityNotFound(_0x5aa72f,null))[_0xa158('0xc')](removeEntity(_0x5aa72f,null))['catch'](handleError(_0x5aa72f,null));};exports[_0xa158('0x41')]=function(_0x305c31,_0x5ec2ff){return db[_0xa158('0x25')]['describe']()[_0xa158('0xc')](respondWithResult(_0x5ec2ff,null))[_0xa158('0x16')](handleError(_0x5ec2ff,null));};exports[_0xa158('0x42')]=function(_0x4205ec,_0x435a11){var _0x49f338=_0xa158('0x43');return interactionService[_0xa158('0x44')](_0x4205ec,_0x49f338)['then'](respondWithResult(_0x435a11,null))[_0xa158('0x16')](handleError(_0x435a11,null));};exports[_0xa158('0x42')]=function(_0x10cbc2,_0x46029b){var _0x3b81f5=_0xa158('0x45');return interactionService[_0xa158('0x44')](_0x10cbc2,_0x3b81f5)['then'](respondWithResult(_0x46029b,null))[_0xa158('0x16')](handleError(_0x46029b,null));};exports[_0xa158('0x46')]=function(_0x17f06c,_0x2c5997){var _0x50d50d={'agent':{},'channel':'fax'};if(_0x17f06c[_0xa158('0x40')]['id']){delete _0x17f06c[_0xa158('0x40')]['id'];}_0x17f06c[_0xa158('0x40')][_0xa158('0x47')]=_0x17f06c['body']['UserId']||_0x17f06c[_0xa158('0x48')]['id'];_0x50d50d[_0xa158('0x49')]['id']=_0x17f06c[_0xa158('0x40')][_0xa158('0x47')];return db[_0xa158('0x25')][_0xa158('0x3f')]({'where':{'id':_0x17f06c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c5997,null))[_0xa158('0xc')](function(_0x3ef98a){if(_0x3ef98a){_0x50d50d[_0xa158('0x13')]=_0x3ef98a[_0xa158('0x4a')]({'plain':!![]});return db[_0xa158('0x4b')][_0xa158('0x3f')]({'where':{'id':_0x3ef98a[_0xa158('0x4c')]}});}return null;})[_0xa158('0xc')](handleEntityNotFound(_0x2c5997,null))['then'](function(_0x4ccc76){if(_0x4ccc76){_0x50d50d[_0xa158('0x4d')]=_0x4ccc76[_0xa158('0x4a')]({'plain':!![]});interaction_log[_0xa158('0x14')](_0xa158('0x4e'),_0x17f06c[_0xa158('0x48')]['id'],_0x17f06c['user']['name'],_0x17f06c['user'][_0xa158('0x4f')],_0x50d50d[_0xa158('0x4d')]['id'],_0x17f06c[_0xa158('0x40')]?JSON[_0xa158('0x10')](_0x17f06c['body']):'null');return respondWithRpcPromise(_0xa158('0x50'),'rejectMessage',_0x50d50d);}return null;})[_0xa158('0xc')](function(_0x2c68fc){var _0x2b8fe1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c68fc['message'][_0xa158('0x51')];return db[_0xa158('0x52')]['query'](_0x2b8fe1,{'type':db['Sequelize'][_0xa158('0x53')][_0xa158('0x54')],'raw':!![]})[_0xa158('0xc')](function(_0x3db176){return _0x3db176;});})[_0xa158('0xc')](function(_0x32b937){if(_0x32b937){_0x50d50d[_0xa158('0x13')][_0xa158('0x55')]=_0x32b937[0x0];if(!_0x17f06c['body'][_0xa158('0x47')])return;return db[_0xa158('0x56')][_0xa158('0x3f')]({'where':{'id':_0x17f06c[_0xa158('0x40')]['UserId'],'role':_0xa158('0x49')},'attributes':['id',_0xa158('0x22'),_0xa158('0x57'),_0xa158('0x58'),_0xa158('0x59')],'raw':!![]});}return null;})['then'](function(_0xa409ac){if(!_0xa409ac)return null;_0x50d50d[_0xa158('0x13')][_0xa158('0x49')]=_0xa409ac;return _0x50d50d;})[_0xa158('0xc')](function(_0x51c598){if(_0x51c598){_0x51c598[_0xa158('0x13')][_0xa158('0x5a')]=util[_0xa158('0x5b')](_0xa158('0x5c'),_0x17f06c['user']['name']);_0x51c598[_0xa158('0x13')][_0xa158('0x5d')]=_0x50d50d['channel'];_0x51c598[_0xa158('0x13')][_0xa158('0x5e')]=_0x50d50d[_0xa158('0x5d')];_0x51c598[_0xa158('0x13')][_0xa158('0x5f')]=_0xa158('0x46');respondWithRpcPromise(_0xa158('0x60'),'EventManager',{'event':_0xa158('0x61'),'message':_0x51c598[_0xa158('0x13')]},client9002);return _0x50d50d;}return null;})[_0xa158('0xc')](respondWithResult(_0x2c5997,null))[_0xa158('0x16')](handleError(_0x2c5997,null));};exports[_0xa158('0x62')]=function(_0x4e4067,_0x5a7a66){var _0xcd5704;return db[_0xa158('0x25')][_0xa158('0x62')](_0x4e4067[_0xa158('0x40')],{})[_0xa158('0xc')](function(_0x52c161){_0xcd5704=_0x52c161;return db['CmContact'][_0xa158('0x63')]({'where':{'id':_0xcd5704[_0xa158('0x51')]}});})['then'](function(_0x132aa7){if(_['isNil'](_0x132aa7)){return;}else{_0xcd5704[_0xa158('0x45')]=_0x132aa7['fax'];return db['Attachment'][_0xa158('0x63')]({'where':{'id':_0xcd5704[_0xa158('0x64')]}});}})[_0xa158('0xc')](function(_0x323d33){return respondWithRpcPromise(_0xa158('0x65'),_0xa158('0x65'),{'FaxAccountId':_[_0xa158('0x66')](_0x4e4067[_0xa158('0x40')])?undefined:_0x4e4067[_0xa158('0x40')][_0xa158('0x67')],'path':_[_0xa158('0x66')](_0x323d33)?undefined:util['format'](_0xa158('0x68'),_0x323d33[_0xa158('0x69')]),'fax':_[_0xa158('0x66')](_0xcd5704[_0xa158('0x45')])?undefined:_0xcd5704[_0xa158('0x45')],'AttachmentId':_0xcd5704[_0xa158('0x64')]},client9002);})[_0xa158('0xc')](respondWithResult(_0x5a7a66,0xc9))[_0xa158('0x16')](handleError(_0x5a7a66,null));};exports[_0xa158('0x6a')]=function(_0x2f8103,_0x5d6ca1){var _0x575d40=path[_0xa158('0x6b')](config[_0xa158('0x6c')],_0xa158('0x6d'),_0xa158('0x6e'),_0xa158('0x6f'));return db[_0xa158('0x25')][_0xa158('0x3f')]({'where':{'id':_0x2f8103[_0xa158('0x3d')]['id']},'include':[{'model':db[_0xa158('0x70')],'as':_0xa158('0x70')}]})[_0xa158('0xc')](handleEntityNotFound(_0x5d6ca1,null))['then'](function(_0x33dd30){if(_0x33dd30){return _0x5d6ca1[_0xa158('0x6a')](path['join'](_0x575d40,_0x33dd30[_0xa158('0x70')][_0xa158('0x69')]));}})['catch'](handleError(_0x5d6ca1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3c0fe84..ef51a9d 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 _0x88b0=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x5225a0,_0x1d3783){var _0x1c6627=function(_0x9e0229){while(--_0x9e0229){_0x5225a0['push'](_0x5225a0['shift']());}};_0x1c6627(++_0x1d3783);}(_0x88b0,0x1cb));var _0x088b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x88b0[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x088b('0x0'));var FaxMessage=require(_0x088b('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x088b('0x2'),'afterUpdate':_0x088b('0x3'),'afterDestroy':_0x088b('0x4')};function emitEvent(_0x2a301b){return function(_0x49e80b,_0x211dfb,_0x2d19c3){FaxMessageEvents[_0x088b('0x5')](_0x2a301b+':'+_0x49e80b['id'],_0x49e80b);FaxMessageEvents['emit'](_0x2a301b,_0x49e80b);_0x2d19c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x088b('0x6')](e,emitEvent(event));}}module[_0x088b('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x8d0a=['exports','events','../../mysqldb','FaxMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x4053a4,_0x476631){var _0x14a6e1=function(_0x4a9438){while(--_0x4a9438){_0x4053a4['push'](_0x4053a4['shift']());}};_0x14a6e1(++_0x476631);}(_0x8d0a,0x172));var _0xa8d0=function(_0x514cae,_0x36be87){_0x514cae=_0x514cae-0x0;var _0x4299d5=_0x8d0a[_0x514cae];return _0x4299d5;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var FaxMessage=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8d0('0x3'),'afterUpdate':_0xa8d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8cc4){return function(_0x3812b4,_0x33c4b1,_0x55bc97){FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4+':'+_0x3812b4['id'],_0x3812b4);FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4,_0x3812b4);_0x55bc97(null);};}for(var e in events){if(events[_0xa8d0('0x6')](e)){var event=events[e];FaxMessage[_0xa8d0('0x7')](e,emitEvent(event));}}module[_0xa8d0('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e43b7a3..28e65b0 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 _0x6baf=['path','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','FaxInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x51a2a9,_0x3ebb9c){var _0x383733=function(_0x2a44fe){while(--_0x2a44fe){_0x51a2a9['push'](_0x51a2a9['shift']());}};_0x383733(++_0x3ebb9c);}(_0x6baf,0x1d7));var _0xf6ba=function(_0x515f47,_0x35329d){_0x515f47=_0x515f47-0x0;var _0x104a91=_0x6baf[_0x515f47];return _0x104a91;};'use strict';var _=require(_0xf6ba('0x0'));var util=require(_0xf6ba('0x1'));var logger=require(_0xf6ba('0x2'))('api');var moment=require(_0xf6ba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6ba('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x5ed925,_0x10b316){return _0x5ed925[_0xf6ba('0x5')](_0xf6ba('0x6'),attributes,{'tableName':_0xf6ba('0x7'),'paranoid':![],'indexes':[{'name':_0xf6ba('0x8'),'fields':[_0xf6ba('0x9')],'type':_0xf6ba('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b3f22,_0x11969b,_0x5b8fe2){var _0x3ee719=_0x5ed925[_0xf6ba('0xb')];var _0x4a433f=_0x2b3f22[_0xf6ba('0xc')]({'plain':!![]});if(_0x4a433f['direction'][_0xf6ba('0xd')]()==='in'||_0x4a433f[_0xf6ba('0xe')][_0xf6ba('0xd')]()===_0xf6ba('0xf')&&!_0x4a433f[_0xf6ba('0x10')]&&!_['isNil'](_0x4a433f['UserId'])){_0x3ee719[_0xf6ba('0x11')][_0xf6ba('0x12')]({'where':{'id':_0x4a433f['FaxInteractionId']}})[_0xf6ba('0x13')](function(_0x2d6cd1){if(_0x2d6cd1){_0x2d6cd1[_0xf6ba('0x14')]({'lastMsgAt':_0x4a433f[_0xf6ba('0x15')],'lastMsgDirection':_0x4a433f[_0xf6ba('0xe')][_0xf6ba('0xd')]()});}})[_0xf6ba('0x16')](function(_0x73b228){console[_0xf6ba('0x17')](_0x73b228);});}_0x5b8fe2();}},'charset':_0xf6ba('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4b5a=['toLowerCase','out','secret','UserId','FaxInteraction','findOne','then','update','createdAt','catch','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','models','direction'];(function(_0x1c2e8e,_0x168e8a){var _0x3db1ab=function(_0x2c285b){while(--_0x2c285b){_0x1c2e8e['push'](_0x1c2e8e['shift']());}};_0x3db1ab(++_0x168e8a);}(_0x4b5a,0x1bf));var _0xa4b5=function(_0x59e641,_0x12be10){_0x59e641=_0x59e641-0x0;var _0x292422=_0x4b5a[_0x59e641];return _0x292422;};'use strict';var _=require(_0xa4b5('0x0'));var util=require(_0xa4b5('0x1'));var logger=require(_0xa4b5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa4b5('0x3'));var rp=require(_0xa4b5('0x4'));var fs=require('fs');var path=require(_0xa4b5('0x5'));var rimraf=require(_0xa4b5('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4b5('0x7'));module['exports']=function(_0x1f4f07,_0x45071a){return _0x1f4f07[_0xa4b5('0x8')](_0xa4b5('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xa4b5('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbe91cc,_0x5ace5c,_0x1d316c){var _0x166aaf=_0x1f4f07[_0xa4b5('0xb')];var _0x4a6d29=_0xbe91cc['get']({'plain':!![]});if(_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()==='in'||_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()===_0xa4b5('0xe')&&!_0x4a6d29[_0xa4b5('0xf')]&&!_['isNil'](_0x4a6d29[_0xa4b5('0x10')])){_0x166aaf[_0xa4b5('0x11')][_0xa4b5('0x12')]({'where':{'id':_0x4a6d29['FaxInteractionId']}})[_0xa4b5('0x13')](function(_0x1f4f03){if(_0x1f4f03){_0x1f4f03[_0xa4b5('0x14')]({'lastMsgAt':_0x4a6d29[_0xa4b5('0x15')],'lastMsgDirection':_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()});}})[_0xa4b5('0x16')](function(_0x5b6419){console['error'](_0x5b6419);});}_0x1d316c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 585dfdc..7bcf6df 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 _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x298291,_0x140ada){var _0x563d83=function(_0x2cf691){while(--_0x2cf691){_0x298291['push'](_0x298291['shift']());}};_0x563d83(++_0x140ada);}(_0x008c,0x188));var _0xc008=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x008c[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x317382,_0x50ffc8){var _0x34a5f8=function(_0x5c3b92){while(--_0x5c3b92){_0x317382['push'](_0x317382['shift']());}};_0x34a5f8(++_0x50ffc8);}(_0x54ef,0x112));var _0xf54e=function(_0x3cc22b,_0x4e8a1e){_0x3cc22b=_0x3cc22b-0x0;var _0x3d6383=_0x54ef[_0x3cc22b];return _0x3d6383;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 23e958e..753a33c 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 _0x1209=['remove','emit','register','length','./faxMessage.events'];(function(_0x47e648,_0x15e1bf){var _0xf8bd16=function(_0x35345f){while(--_0x35345f){_0x47e648['push'](_0x47e648['shift']());}};_0xf8bd16(++_0x15e1bf);}(_0x1209,0x103));var _0x9120=function(_0x560a3b,_0x3cd259){_0x560a3b=_0x560a3b-0x0;var _0x2f8888=_0x1209[_0x560a3b];return _0x2f8888;};'use strict';var FaxMessageEvents=require(_0x9120('0x0'));var events=['save',_0x9120('0x1'),'update'];function createListener(_0x93709b,_0x4a073e){return function(_0x4d0fc8){_0x4a073e[_0x9120('0x2')](_0x93709b,_0x4d0fc8);};}function removeListener(_0x3b6635,_0x2df7a6){return function(){FaxMessageEvents['removeListener'](_0x3b6635,_0x2df7a6);};}exports[_0x9120('0x3')]=function(_0x5ef730){for(var _0x2bfbed=0x0,_0x498988=events[_0x9120('0x4')];_0x2bfbed<_0x498988;_0x2bfbed++){var _0x41d282=events[_0x2bfbed];var _0x374a89=createListener('faxMessage:'+_0x41d282,_0x5ef730);FaxMessageEvents['on'](_0x41d282,_0x374a89);}}; \ No newline at end of file +var _0xb151=['removeListener','register','length','./faxMessage.events','remove','update','emit'];(function(_0x424458,_0x45ec38){var _0x4610cf=function(_0x55a2f5){while(--_0x55a2f5){_0x424458['push'](_0x424458['shift']());}};_0x4610cf(++_0x45ec38);}(_0xb151,0xb2));var _0x1b15=function(_0x86cce3,_0x5ed5ff){_0x86cce3=_0x86cce3-0x0;var _0x2fca37=_0xb151[_0x86cce3];return _0x2fca37;};'use strict';var FaxMessageEvents=require(_0x1b15('0x0'));var events=['save',_0x1b15('0x1'),_0x1b15('0x2')];function createListener(_0x395793,_0x46ade5){return function(_0x19e65f){_0x46ade5[_0x1b15('0x3')](_0x395793,_0x19e65f);};}function removeListener(_0x4c0499,_0x58b851){return function(){FaxMessageEvents[_0x1b15('0x4')](_0x4c0499,_0x58b851);};}exports[_0x1b15('0x5')]=function(_0xcb8371){for(var _0x3d5905=0x0,_0x571ac8=events[_0x1b15('0x6')];_0x3d5905<_0x571ac8;_0x3d5905++){var _0x48fe3b=events[_0x3d5905];var _0x416d62=createListener('faxMessage:'+_0x48fe3b,_0xcb8371);FaxMessageEvents['on'](_0x48fe3b,_0x416d62);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4d5f640..8a9789c 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 _0xd8b0=['tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/download','download','post'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0d8b('0x10')]('fax',_0x0d8b('0x11')),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x13')](_0x0d8b('0x17'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x19')]);module[_0x0d8b('0x1a')]=router; \ No newline at end of file +var _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0102,0x186));var _0x2010=function(_0x2fa3cb,_0x4a57fa){_0x2fa3cb=_0x2fa3cb-0x0;var _0x29f704=_0x0102[_0x2fa3cb];return _0x29f704;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 94b0388..fc59691 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 _0xad99=['beepall','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xad99,0xa9));var _0x9ad9=function(_0x178442,_0x300791){_0x178442=_0x178442-0x0;var _0x3f870a=_0xad99[_0x178442];return _0x3f870a;};'use strict';var Sequelize=require('sequelize');module[_0x9ad9('0x0')]={'name':{'type':Sequelize[_0x9ad9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9ad9('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ad9('0x3')](_0x9ad9('0x4'),_0x9ad9('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9ad9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7726=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x7726,0x107));var _0x6772=function(_0x5967df,_0x4c334f){_0x5967df=_0x5967df-0x0;var _0x43d062=_0x7726[_0x5967df];return _0x43d062;};'use strict';var Sequelize=require(_0x6772('0x0'));module[_0x6772('0x1')]={'name':{'type':Sequelize[_0x6772('0x2')],'unique':_0x6772('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6772('0x2')]},'timeout':{'type':Sequelize[_0x6772('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6772('0x5')]('rrmemory',_0x6772('0x6'),_0x6772('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6772('0x4')],'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 09505a1..b493593 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 _0xfc65=['ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','getOptions','where','include','query','FaxQueue','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','options','User','findAndCountAll','faxPause','createdAt','rows','findOne','Team','pick','getTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x2840d4,_0x3e8883){_0x2840d4=_0x2840d4-0x0;var _0x1c7e0e=_0xfc65[_0x2840d4];return _0x1c7e0e;};'use strict';var BPromise=require(_0x5fc6('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x5fc6('0x1'));var Redis=require(_0x5fc6('0x2'));var qs=require(_0x5fc6('0x3'));var logger=require(_0x5fc6('0x4'))(_0x5fc6('0x5'));var config=require(_0x5fc6('0x6'));var db=require(_0x5fc6('0x7'))['db'];config[_0x5fc6('0x8')]=_[_0x5fc6('0x9')](config[_0x5fc6('0x8')],{'host':_0x5fc6('0xa'),'port':0x18eb});var socket=require(_0x5fc6('0xb'))(new Redis(config[_0x5fc6('0x8')]));require('./faxQueue.socket')[_0x5fc6('0xc')](socket);function respondWithStatusCode(_0x1f1409,_0x2d10be){_0x2d10be=_0x2d10be||0xcc;return function(_0x3d9a11){if(_0x3d9a11){return _0x1f1409[_0x5fc6('0xd')](_0x2d10be);}return _0x1f1409[_0x5fc6('0xe')](_0x2d10be)[_0x5fc6('0xf')]();};}function respondWithResult(_0x27cad8,_0x3d8781){_0x3d8781=_0x3d8781||0xc8;return function(_0x29781f){if(_0x29781f){return _0x27cad8['status'](_0x3d8781)[_0x5fc6('0x10')](_0x29781f);}};}function respondWithFilteredResult(_0x51ad7e,_0x2a2ff4){return function(_0x132fd0){if(_0x132fd0){var _0x454a44=typeof _0x2a2ff4[_0x5fc6('0x11')]==='undefined'&&typeof _0x2a2ff4[_0x5fc6('0x12')]===_0x5fc6('0x13');var _0x2f9062=_0x132fd0[_0x5fc6('0x14')];var _0x436a0c=_0x454a44?0x0:_0x2a2ff4[_0x5fc6('0x11')];var _0x23424e=_0x454a44?_0x132fd0[_0x5fc6('0x14')]:_0x2a2ff4[_0x5fc6('0x11')]+_0x2a2ff4[_0x5fc6('0x12')];var _0x54f153;if(_0x23424e>=_0x2f9062){_0x23424e=_0x2f9062;_0x54f153=0xc8;}else{_0x54f153=0xce;}_0x51ad7e['status'](_0x54f153);return _0x51ad7e[_0x5fc6('0x15')](_0x5fc6('0x16'),_0x436a0c+'-'+_0x23424e+'/'+_0x2f9062)['json'](_0x132fd0);}return null;};}function saveUpdates(_0x26d2ba){return function(_0x168119){if(_0x168119){return _0x168119[_0x5fc6('0x17')](_0x26d2ba)[_0x5fc6('0x18')](function(_0x241bfb){return _0x241bfb;});}return null;};}function removeEntity(_0x29e82f){return function(_0x569bbc){if(_0x569bbc){return _0x569bbc[_0x5fc6('0x19')]()[_0x5fc6('0x18')](function(){var _0x303995=_0x569bbc[_0x5fc6('0x1a')]({'plain':!![]});var _0x5c76e7=_0x5fc6('0x1b');return db[_0x5fc6('0x1c')][_0x5fc6('0x19')]({'where':{'type':_0x5c76e7,'resourceId':_0x303995['id']}})[_0x5fc6('0x18')](function(){return _0x569bbc;});})[_0x5fc6('0x18')](function(){_0x29e82f[_0x5fc6('0xe')](0xcc)[_0x5fc6('0xf')]();});}};}function handleEntityNotFound(_0x17fcb1){return function(_0xfd8379){if(!_0xfd8379){_0x17fcb1[_0x5fc6('0xd')](0x194);}return _0xfd8379;};}function handleError(_0x5ed932,_0x1a3c0d){_0x1a3c0d=_0x1a3c0d||0x1f4;return function(_0x3e0585){logger[_0x5fc6('0x1d')](_0x3e0585[_0x5fc6('0x1e')]);if(_0x3e0585[_0x5fc6('0x1f')]){delete _0x3e0585[_0x5fc6('0x1f')];}_0x5ed932[_0x5fc6('0xe')](_0x1a3c0d)[_0x5fc6('0x20')](_0x3e0585);};}exports['index']=function(_0x122890,_0x18e553){var _0x1db1f0={};var _0x3f384a={'count':0x0,'rows':[]};var _0x391392=_[_0x5fc6('0x21')](db['FaxQueue'][_0x5fc6('0x22')],function(_0xd31fa1){return{'name':_0xd31fa1['fieldName'],'type':_0xd31fa1[_0x5fc6('0x23')][_0x5fc6('0x24')]};});_0x1db1f0=qs[_0x5fc6('0x25')](_0x391392,_0x122890);var _0x19d630={'where':_0x1db1f0[_0x5fc6('0x26')]};return db['FaxQueue'][_0x5fc6('0x14')](_0x19d630)[_0x5fc6('0x18')](function(_0x21066b){_0x3f384a[_0x5fc6('0x14')]=_0x21066b;_0x1db1f0[_0x5fc6('0x27')]=qs[_0x5fc6('0x27')](_0x122890[_0x5fc6('0x28')]);return db[_0x5fc6('0x29')][_0x5fc6('0x2a')](_0x1db1f0);})['then'](function(_0x11d7fc){_0x3f384a['rows']=_0x11d7fc;return _0x3f384a;})[_0x5fc6('0x18')](respondWithFilteredResult(_0x18e553,_0x1db1f0))[_0x5fc6('0x2b')](handleError(_0x18e553,null));};exports[_0x5fc6('0x2c')]=function(_0x18ddf,_0x331c2b){var _0x479e96={'raw':!![],'where':{'id':_0x18ddf[_0x5fc6('0x2d')]['id']}},_0x1dbb8c={};_0x1dbb8c[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x29')][_0x5fc6('0x22')]);_0x1dbb8c[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x18ddf['query']);_0x1dbb8c[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x1dbb8c['model'],_0x1dbb8c['query']);_0x479e96[_0x5fc6('0x32')]=_[_0x5fc6('0x31')](_0x1dbb8c['model'],qs[_0x5fc6('0x33')](_0x18ddf[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x479e96[_0x5fc6('0x32')]=_0x479e96['attributes']['length']?_0x479e96[_0x5fc6('0x32')]:_0x1dbb8c[_0x5fc6('0x2e')];if(_0x18ddf['query']['includeAll']){_0x479e96[_0x5fc6('0x27')]=[{'all':!![]}];}_0x479e96=_[_0x5fc6('0x34')]({},_0x479e96,_0x18ddf['options']);return db[_0x5fc6('0x29')]['find'](_0x479e96)[_0x5fc6('0x18')](handleEntityNotFound(_0x331c2b,null))[_0x5fc6('0x18')](respondWithResult(_0x331c2b,null))[_0x5fc6('0x2b')](handleError(_0x331c2b,null));};exports[_0x5fc6('0x35')]=function(_0x51fe4f,_0x3ccb5){return db[_0x5fc6('0x29')][_0x5fc6('0x35')](_0x51fe4f[_0x5fc6('0x36')],{})[_0x5fc6('0x18')](function(_0x3f786e){var _0x58e67c=_0x51fe4f[_0x5fc6('0x37')]['get']({'plain':!![]});if(!_0x58e67c)throw new Error(_0x5fc6('0x38'));if(_0x58e67c[_0x5fc6('0x39')]==='user'){var _0x179598=_0x3f786e[_0x5fc6('0x1a')]({'plain':!![]});var _0x4bfb73='FaxQueues';return db[_0x5fc6('0x3a')][_0x5fc6('0x3b')]({'where':{'name':_0x4bfb73,'userProfileId':_0x58e67c[_0x5fc6('0x3c')]},'raw':!![]})[_0x5fc6('0x18')](function(_0x370bc4){if(_0x370bc4&&_0x370bc4[_0x5fc6('0x3d')]===0x0){return db[_0x5fc6('0x1c')][_0x5fc6('0x35')]({'name':_0x179598[_0x5fc6('0x1f')],'resourceId':_0x179598['id'],'type':_0x370bc4[_0x5fc6('0x1f')],'sectionId':_0x370bc4['id']},{})[_0x5fc6('0x18')](function(){return _0x3f786e;});}else{return _0x3f786e;}})['catch'](function(_0xa5a2a8){logger[_0x5fc6('0x1d')](_0x5fc6('0x3e'),_0xa5a2a8);throw _0xa5a2a8;});}return _0x3f786e;})[_0x5fc6('0x18')](respondWithResult(_0x3ccb5,0xc9))[_0x5fc6('0x2b')](handleError(_0x3ccb5,null));};exports['update']=function(_0x56dd97,_0x485d8e){if(_0x56dd97[_0x5fc6('0x36')]['id']){delete _0x56dd97[_0x5fc6('0x36')]['id'];}return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x56dd97['params']['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x485d8e,null))[_0x5fc6('0x18')](saveUpdates(_0x56dd97[_0x5fc6('0x36')],null))[_0x5fc6('0x18')](respondWithResult(_0x485d8e,null))[_0x5fc6('0x2b')](handleError(_0x485d8e,null));};exports[_0x5fc6('0x19')]=function(_0x5d6667,_0xb7e7f9){return db['FaxQueue']['find']({'where':{'id':_0x5d6667['params']['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0xb7e7f9,null))['then'](removeEntity(_0xb7e7f9,null))[_0x5fc6('0x2b')](handleError(_0xb7e7f9,null));};exports[_0x5fc6('0x3f')]=function(_0x1e2dfc,_0x5381ef){return db[_0x5fc6('0x29')]['describe']()[_0x5fc6('0x18')](respondWithResult(_0x5381ef,null))[_0x5fc6('0x2b')](handleError(_0x5381ef,null));};exports['getMembers']=function(_0x1cfa42,_0x4c98f3){var _0x193f32={'raw':!![],'where':{}},_0x26857b={},_0x32164c;return db[_0x5fc6('0x29')]['findOne']({'where':{'id':_0x1cfa42[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x4c98f3,null))[_0x5fc6('0x18')](function(_0x37f30d){if(_0x37f30d){_0x32164c=_0x37f30d['get']({'plain':!![]});_0x26857b[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x40')][_0x5fc6('0x22')]);_0x26857b[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x1cfa42[_0x5fc6('0x28')]);_0x26857b['filters']=_[_0x5fc6('0x31')](_0x26857b[_0x5fc6('0x2e')],_0x26857b[_0x5fc6('0x28')]);_0x193f32['attributes']=_[_0x5fc6('0x31')](_0x26857b[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x193f32[_0x5fc6('0x32')]=_0x193f32[_0x5fc6('0x32')][_0x5fc6('0x41')]?_0x193f32[_0x5fc6('0x32')]:_0x26857b['model'];if(!_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x42')](_0x5fc6('0x43'))){_0x193f32[_0x5fc6('0x12')]=qs[_0x5fc6('0x12')](_0x1cfa42['query'][_0x5fc6('0x12')]);_0x193f32[_0x5fc6('0x11')]=qs['offset'](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x11')]);}_0x193f32[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x45')]);_0x193f32[_0x5fc6('0x26')]=qs['filters'](_['pick'](_0x1cfa42['query'],_0x26857b[_0x5fc6('0x30')]));_0x193f32[_0x5fc6('0x26')][_0x5fc6('0x46')]=_0x37f30d['id'];if(_0x1cfa42['query'][_0x5fc6('0x47')]){_0x193f32[_0x5fc6('0x26')]=_['merge'](_0x193f32[_0x5fc6('0x26')],{'$or':_[_0x5fc6('0x21')](_0x193f32[_0x5fc6('0x32')],function(_0x53e146){var _0x2acc84={};_0x2acc84[_0x53e146]={'$like':'%'+_0x1cfa42[_0x5fc6('0x28')]['filter']+'%'};return _0x2acc84;})});}_0x193f32=_[_0x5fc6('0x34')]({},_0x193f32,_0x1cfa42[_0x5fc6('0x48')]);return db[_0x5fc6('0x40')][_0x5fc6('0x2a')](_0x193f32);}})[_0x5fc6('0x18')](function(_0x2a664c){if(_0x2a664c){return db[_0x5fc6('0x49')][_0x5fc6('0x4a')]({'where':{'id':_[_0x5fc6('0x21')](_0x2a664c,'UserId'),'role':'agent'},'attributes':['id','name',_0x5fc6('0x4b'),'updatedAt',_0x5fc6('0x4c')]});}})[_0x5fc6('0x18')](function(_0x3d586c){if(_0x3d586c){return{'count':_0x3d586c['count'],'rows':_[_0x5fc6('0x21')](_0x3d586c[_0x5fc6('0x4d')],function(_0xc696aa){return{'membername':_0xc696aa[_0x5fc6('0x1f')],'UserId':_0xc696aa['id'],'queue_name':_0x32164c[_0x5fc6('0x1f')],'FaxQueueId':_0x32164c['id'],'interface':util['format']('%s/%s','SIP',_0xc696aa['name']),'penalty':0x0,'paused':_0xc696aa[_0x5fc6('0x4b')],'createdAt':_0xc696aa[_0x5fc6('0x4c')],'updatedAt':_0xc696aa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5fc6('0x18')](respondWithFilteredResult(_0x4c98f3,_0x193f32))['catch'](handleError(_0x4c98f3,null));};exports['getTeams']=function(_0x4d1b47,_0x3efb2e){var _0x4a94cb={};var _0x2a6280={};var _0x24c73f;var _0x377097;return db['FaxQueue'][_0x5fc6('0x4e')]({'where':{'id':_0x4d1b47[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x3efb2e,null))['then'](function(_0x19df78){if(_0x19df78){_0x24c73f=_0x19df78;_0x2a6280[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x4f')][_0x5fc6('0x22')]);_0x2a6280[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x4d1b47[_0x5fc6('0x28')]);_0x2a6280[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x2a6280[_0x5fc6('0x2e')],_0x2a6280[_0x5fc6('0x28')]);_0x4a94cb[_0x5fc6('0x32')]=_['intersection'](_0x2a6280[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x4a94cb[_0x5fc6('0x32')]=_0x4a94cb[_0x5fc6('0x32')]['length']?_0x4a94cb['attributes']:_0x2a6280[_0x5fc6('0x2e')];_0x4a94cb[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x4d1b47[_0x5fc6('0x28')]['sort']);_0x4a94cb[_0x5fc6('0x26')]=qs[_0x5fc6('0x30')](_[_0x5fc6('0x50')](_0x4d1b47[_0x5fc6('0x28')],_0x2a6280[_0x5fc6('0x30')]));if(_0x4d1b47[_0x5fc6('0x28')]['filter']){_0x4a94cb[_0x5fc6('0x26')]=_[_0x5fc6('0x34')](_0x4a94cb[_0x5fc6('0x26')],{'$or':_[_0x5fc6('0x21')](_0x4a94cb[_0x5fc6('0x32')],function(_0x50bf18){var _0xbb348a={};_0xbb348a[_0x50bf18]={'$like':'%'+_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x47')]+'%'};return _0xbb348a;})});}_0x4a94cb=_['merge']({},_0x4a94cb,_0x4d1b47[_0x5fc6('0x48')]);return _0x24c73f[_0x5fc6('0x51')](_0x4a94cb);}})['then'](function(_0x39190f){if(_0x39190f){_0x377097=_0x39190f[_0x5fc6('0x41')];if(!_0x4d1b47['query'][_0x5fc6('0x42')](_0x5fc6('0x43'))){_0x4a94cb['limit']=qs[_0x5fc6('0x12')](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x12')]);_0x4a94cb[_0x5fc6('0x11')]=qs['offset'](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x11')]);}return _0x24c73f[_0x5fc6('0x51')](_0x4a94cb);}})[_0x5fc6('0x18')](function(_0x2067dd){if(_0x2067dd){return _0x2067dd?{'count':_0x377097,'rows':_0x2067dd}:null;}})[_0x5fc6('0x18')](respondWithResult(_0x3efb2e,null))[_0x5fc6('0x2b')](handleError(_0x3efb2e,null));};exports['addTeams']=function(_0x4c6e4e,_0x2f8953){var _0x11ee25=_0x4c6e4e[_0x5fc6('0x36')][_0x5fc6('0x52')];return db[_0x5fc6('0x4f')]['findAll']({'where':{'id':_0x11ee25},'attributes':['id'],'include':[{'model':db[_0x5fc6('0x49')],'as':_0x5fc6('0x53'),'attributes':['id',_0x5fc6('0x1f'),_0x5fc6('0x54'),'voicePause',_0x5fc6('0x55')],'raw':!![]}]})[_0x5fc6('0x18')](function(_0x2713bb){if(_0x2713bb){var _0x5609e4=_[_0x5fc6('0x56')](_0x2713bb,function(_0x279c74){var _0x210b76=_0x279c74[_0x5fc6('0x1a')]({'plain':!![]});return _0x210b76[_0x5fc6('0x53')];});return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x4c6e4e[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](function(_0x57e4ff){return db[_0x5fc6('0x57')]['transaction'](function(_0x437e81){return _0x57e4ff['addTeams'](_0x11ee25,{'transaction':_0x437e81})[_0x5fc6('0x18')](function(){return BPromise[_0x5fc6('0x58')](_0x5609e4,function(_0x21519c){return db[_0x5fc6('0x40')][_0x5fc6('0x59')]({'where':{'UserId':_0x21519c['id'],'FaxQueueId':_0x4c6e4e[_0x5fc6('0x2d')]['id']},'transaction':_0x437e81});});})[_0x5fc6('0x18')](function(){_0x5609e4[_0x5fc6('0x5a')](function(_0x4c0c5a){socket[_0x5fc6('0x5b')]('userFaxQueue:save',{'UserId':_0x4c0c5a['id'],'FaxQueueId':_0x57e4ff['id']});});});});});}})['then'](respondWithStatusCode(_0x2f8953,null))['catch'](handleError(_0x2f8953,null));};exports[_0x5fc6('0x5c')]=function(_0x24bff8,_0x412733){return db[_0x5fc6('0x4f')][_0x5fc6('0x2a')]({'where':{'id':_0x24bff8[_0x5fc6('0x28')][_0x5fc6('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5fc6('0x53'),'attributes':['id'],'raw':!![]}]})[_0x5fc6('0x18')](handleEntityNotFound(_0x412733,null))[_0x5fc6('0x18')](function(_0x2a5dd9){var _0x103f7f=_['map'](_0x2a5dd9,'id');var _0x5dfab6=[];var _0x42eef4=[];var _0x3282bc=squel['select']();_0x3282bc['field'](_0x5fc6('0x5d'))['from'](_0x5fc6('0x5e'),'tq')[_0x5fc6('0x5f')]('user_has_teams','ut',_0x5fc6('0x60'))[_0x5fc6('0x26')](_0x5fc6('0x61'),_0x24bff8[_0x5fc6('0x2d')]['id']);for(var _0x564c58=0x0;_0x564c58<_0x2a5dd9[_0x5fc6('0x41')];_0x564c58+=0x1){let _0x36bf0f=_0x2a5dd9[_0x564c58];for(var _0x41f43e=0x0;_0x41f43e<_0x36bf0f['Agents'][_0x5fc6('0x41')];_0x41f43e+=0x1){let _0x161347=_0x36bf0f[_0x5fc6('0x53')][_0x41f43e];var _0x3c3c57=_0x3282bc[_0x5fc6('0x62')]();_0x3c3c57['where'](_0x5fc6('0x63'),_0x161347['id']);_0x42eef4[_0x5fc6('0x64')](db[_0x5fc6('0x57')][_0x5fc6('0x28')](_0x3c3c57['toString'](),{'type':db[_0x5fc6('0x57')][_0x5fc6('0x65')][_0x5fc6('0x66')]})['then'](function(_0x542995){if(_0x542995[_0x5fc6('0x41')]===0x1){return _0x161347['id'];}else{var _0x3d1711=_[_0x5fc6('0x67')](_['map'](_0x542995,_0x5fc6('0x68')),function(_0x1d13d9){return _['includes'](_0x103f7f,_0x1d13d9);});if(_0x3d1711){return _0x161347['id'];}}}));}}return BPromise[_0x5fc6('0x69')](_0x42eef4)[_0x5fc6('0x18')](function(_0x358e04){_0x5dfab6=_(_0x5dfab6)[_0x5fc6('0x6a')](_0x358e04)[_0x5fc6('0x6b')]()['value']();return db[_0x5fc6('0x29')]['find']({'where':{'id':_0x24bff8[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](function(_0x5d962d){return db[_0x5fc6('0x57')][_0x5fc6('0x6c')](function(_0x116af8){return _0x5d962d[_0x5fc6('0x5c')](_0x24bff8['query'][_0x5fc6('0x52')],{'transaction':_0x116af8})[_0x5fc6('0x18')](function(){if(!_[_0x5fc6('0x6d')](_0x5dfab6)){return _0x5d962d[_0x5fc6('0x6e')](_0x5dfab6,{'transaction':_0x116af8});}})['then'](function(){_0x5dfab6[_0x5fc6('0x5a')](function(_0x3ecf69){socket[_0x5fc6('0x5b')](_0x5fc6('0x6f'),{'UserId':_0x3ecf69,'FaxQueueId':_0x5d962d['id']});});});});});});})['then'](respondWithStatusCode(_0x412733,null))['catch'](handleError(_0x412733,null));};exports[_0x5fc6('0x70')]=function(_0x455c45,_0x353e56){return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x455c45[_0x5fc6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x353e56,null))['then'](function(_0x5534c5){if(_0x5534c5){return _0x5534c5[_0x5fc6('0x70')](_0x455c45['body'][_0x5fc6('0x52')],_[_0x5fc6('0x71')](_0x455c45[_0x5fc6('0x36')],['ids','id'])||{})['spread'](function(_0x39946d){for(var _0x38d105=0x0;_0x38d105<_0x455c45['body']['ids'][_0x5fc6('0x41')];_0x38d105+=0x1){socket[_0x5fc6('0x5b')](_0x5fc6('0x72'),{'UserId':Number(_0x455c45[_0x5fc6('0x36')][_0x5fc6('0x52')][_0x38d105]),'FaxQueueId':Number(_0x455c45[_0x5fc6('0x2d')]['id'])});}return _0x39946d;});}})[_0x5fc6('0x18')](respondWithResult(_0x353e56,null))[_0x5fc6('0x2b')](handleError(_0x353e56,null));};exports['removeAgents']=function(_0xd6ec5c,_0x4e4c67){return db['FaxQueue'][_0x5fc6('0x3b')]({'where':{'id':_0xd6ec5c[_0x5fc6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4e4c67,null))[_0x5fc6('0x18')](function(_0x326de4){if(_0x326de4){return _0x326de4[_0x5fc6('0x6e')](_0xd6ec5c['query'][_0x5fc6('0x52')])[_0x5fc6('0x18')](function(){if(_['isArray'](_0xd6ec5c[_0x5fc6('0x28')]['ids'])){for(var _0x12f042=0x0;_0x12f042<_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')][_0x5fc6('0x41')];_0x12f042+=0x1){socket[_0x5fc6('0x5b')](_0x5fc6('0x6f'),{'UserId':Number(_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')][_0x12f042]),'FaxQueueId':Number(_0xd6ec5c['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')]),'FaxQueueId':Number(_0xd6ec5c[_0x5fc6('0x2d')]['id'])});}});}})[_0x5fc6('0x18')](respondWithStatusCode(_0x4e4c67,null))[_0x5fc6('0x2b')](handleError(_0x4e4c67,null));};exports[_0x5fc6('0x73')]=function(_0x13732c,_0x4bb35d){var _0x515b00={};var _0x305ce5={};var _0x4b02eb;var _0x7c1ae5;return db[_0x5fc6('0x29')][_0x5fc6('0x4e')]({'where':{'id':_0x13732c[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x4bb35d,null))[_0x5fc6('0x18')](function(_0x191fc0){if(_0x191fc0){_0x4b02eb=_0x191fc0;_0x305ce5[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x49')]['rawAttributes']);_0x305ce5[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x13732c[_0x5fc6('0x28')]);_0x305ce5[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x305ce5[_0x5fc6('0x2e')],_0x305ce5[_0x5fc6('0x28')]);_0x515b00[_0x5fc6('0x32')]=_[_0x5fc6('0x31')](_0x305ce5[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x13732c[_0x5fc6('0x28')]['fields']));_0x515b00[_0x5fc6('0x32')]=_0x515b00['attributes'][_0x5fc6('0x41')]?_0x515b00[_0x5fc6('0x32')]:_0x305ce5[_0x5fc6('0x2e')];_0x515b00[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x13732c['query']['sort']);_0x515b00[_0x5fc6('0x26')]=qs['filters'](_['pick'](_0x13732c[_0x5fc6('0x28')],_0x305ce5[_0x5fc6('0x30')]));if(_0x13732c[_0x5fc6('0x28')][_0x5fc6('0x47')]){_0x515b00['where']=_[_0x5fc6('0x34')](_0x515b00[_0x5fc6('0x26')],{'$or':_['map'](_0x515b00[_0x5fc6('0x32')],function(_0xc3848a){var _0x20f2ec={};_0x20f2ec[_0xc3848a]={'$like':'%'+_0x13732c[_0x5fc6('0x28')][_0x5fc6('0x47')]+'%'};return _0x20f2ec;})});}_0x515b00=_[_0x5fc6('0x34')]({},_0x515b00,_0x13732c[_0x5fc6('0x48')]);return _0x4b02eb[_0x5fc6('0x73')](_0x515b00);}})['then'](function(_0x316b19){if(_0x316b19){_0x7c1ae5=_0x316b19[_0x5fc6('0x41')];if(!_0x13732c[_0x5fc6('0x28')]['hasOwnProperty'](_0x5fc6('0x43'))){_0x515b00['limit']=qs[_0x5fc6('0x12')](_0x13732c[_0x5fc6('0x28')]['limit']);_0x515b00[_0x5fc6('0x11')]=qs[_0x5fc6('0x11')](_0x13732c[_0x5fc6('0x28')]['offset']);}return _0x4b02eb['getAgents'](_0x515b00);}})[_0x5fc6('0x18')](function(_0x1c6bc6){if(_0x1c6bc6){return _0x1c6bc6?{'count':_0x7c1ae5,'rows':_0x1c6bc6}:null;}})[_0x5fc6('0x18')](respondWithResult(_0x4bb35d,null))[_0x5fc6('0x2b')](handleError(_0x4bb35d,null));}; \ No newline at end of file +var _0x68b3=['FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','Team','filter','getTeams','length','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map'];(function(_0x40069a,_0x23a64a){var _0x1f45e2=function(_0x367c56){while(--_0x367c56){_0x40069a['push'](_0x40069a['shift']());}};_0x1f45e2(++_0x23a64a);}(_0x68b3,0x1d8));var _0x368b=function(_0x501dae,_0x377a9d){_0x501dae=_0x501dae-0x0;var _0x36b040=_0x68b3[_0x501dae];return _0x36b040;};'use strict';var BPromise=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var _=require(_0x368b('0x2'));var squel=require(_0x368b('0x3'));var Redis=require(_0x368b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x368b('0x5'))(_0x368b('0x6'));var config=require(_0x368b('0x7'));var db=require(_0x368b('0x8'))['db'];config['redis']=_[_0x368b('0x9')](config[_0x368b('0xa')],{'host':_0x368b('0xb'),'port':0x18eb});var socket=require(_0x368b('0xc'))(new Redis(config[_0x368b('0xa')]));require(_0x368b('0xd'))[_0x368b('0xe')](socket);function respondWithStatusCode(_0x142d05,_0x23622f){_0x23622f=_0x23622f||0xcc;return function(_0x1f64d8){if(_0x1f64d8){return _0x142d05[_0x368b('0xf')](_0x23622f);}return _0x142d05['status'](_0x23622f)[_0x368b('0x10')]();};}function respondWithResult(_0xdbd344,_0x34a110){_0x34a110=_0x34a110||0xc8;return function(_0x51d513){if(_0x51d513){return _0xdbd344[_0x368b('0x11')](_0x34a110)[_0x368b('0x12')](_0x51d513);}};}function respondWithFilteredResult(_0x253e4b,_0x5924a6){return function(_0x41fbfd){if(_0x41fbfd){var _0x847dcb=typeof _0x5924a6['offset']===_0x368b('0x13')&&typeof _0x5924a6[_0x368b('0x14')]===_0x368b('0x13');var _0x4015fe=_0x41fbfd[_0x368b('0x15')];var _0x4fffe5=_0x847dcb?0x0:_0x5924a6[_0x368b('0x16')];var _0x40faa0=_0x847dcb?_0x41fbfd['count']:_0x5924a6[_0x368b('0x16')]+_0x5924a6[_0x368b('0x14')];var _0x30c245;if(_0x40faa0>=_0x4015fe){_0x40faa0=_0x4015fe;_0x30c245=0xc8;}else{_0x30c245=0xce;}_0x253e4b['status'](_0x30c245);return _0x253e4b[_0x368b('0x17')](_0x368b('0x18'),_0x4fffe5+'-'+_0x40faa0+'/'+_0x4015fe)[_0x368b('0x12')](_0x41fbfd);}return null;};}function saveUpdates(_0x4d6d9d){return function(_0x102407){if(_0x102407){return _0x102407[_0x368b('0x19')](_0x4d6d9d)[_0x368b('0x1a')](function(_0x540f57){return _0x540f57;});}return null;};}function removeEntity(_0x5d543e){return function(_0x3e2e9f){if(_0x3e2e9f){return _0x3e2e9f[_0x368b('0x1b')]()[_0x368b('0x1a')](function(){var _0x1e632a=_0x3e2e9f[_0x368b('0x1c')]({'plain':!![]});var _0x4b8fb7=_0x368b('0x1d');return db[_0x368b('0x1e')][_0x368b('0x1b')]({'where':{'type':_0x4b8fb7,'resourceId':_0x1e632a['id']}})[_0x368b('0x1a')](function(){return _0x3e2e9f;});})[_0x368b('0x1a')](function(){_0x5d543e[_0x368b('0x11')](0xcc)[_0x368b('0x10')]();});}};}function handleEntityNotFound(_0x1d8066){return function(_0x508e48){if(!_0x508e48){_0x1d8066[_0x368b('0xf')](0x194);}return _0x508e48;};}function handleError(_0x2f08d9,_0x18869a){_0x18869a=_0x18869a||0x1f4;return function(_0xc0f7af){logger[_0x368b('0x1f')](_0xc0f7af['stack']);if(_0xc0f7af[_0x368b('0x20')]){delete _0xc0f7af[_0x368b('0x20')];}_0x2f08d9[_0x368b('0x11')](_0x18869a)[_0x368b('0x21')](_0xc0f7af);};}exports[_0x368b('0x22')]=function(_0x85515f,_0x430e16){var _0x11ea2d={};var _0x3123c1={'count':0x0,'rows':[]};var _0x3f7f89=_[_0x368b('0x23')](db[_0x368b('0x24')][_0x368b('0x25')],function(_0x376e61){return{'name':_0x376e61[_0x368b('0x26')],'type':_0x376e61[_0x368b('0x27')][_0x368b('0x28')]};});_0x11ea2d=qs[_0x368b('0x29')](_0x3f7f89,_0x85515f);var _0x39ef94={'where':_0x11ea2d[_0x368b('0x2a')]};return db[_0x368b('0x24')][_0x368b('0x15')](_0x39ef94)[_0x368b('0x1a')](function(_0x3c80b5){_0x3123c1['count']=_0x3c80b5;_0x11ea2d['include']=qs[_0x368b('0x2b')](_0x85515f[_0x368b('0x2c')]);return db[_0x368b('0x24')][_0x368b('0x2d')](_0x11ea2d);})['then'](function(_0x12ae59){_0x3123c1[_0x368b('0x2e')]=_0x12ae59;return _0x3123c1;})[_0x368b('0x1a')](respondWithFilteredResult(_0x430e16,_0x11ea2d))[_0x368b('0x2f')](handleError(_0x430e16,null));};exports[_0x368b('0x30')]=function(_0x4d8410,_0x22ada9){var _0x424fab={'raw':!![],'where':{'id':_0x4d8410[_0x368b('0x31')]['id']}},_0x239536={};_0x239536['model']=_['keys'](db['FaxQueue'][_0x368b('0x25')]);_0x239536[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x4d8410[_0x368b('0x2c')]);_0x239536[_0x368b('0x33')]=_['intersection'](_0x239536[_0x368b('0x34')],_0x239536[_0x368b('0x2c')]);_0x424fab['attributes']=_[_0x368b('0x35')](_0x239536[_0x368b('0x34')],qs['fields'](_0x4d8410[_0x368b('0x2c')][_0x368b('0x36')]));_0x424fab['attributes']=_0x424fab[_0x368b('0x37')]['length']?_0x424fab['attributes']:_0x239536['model'];if(_0x4d8410[_0x368b('0x2c')][_0x368b('0x38')]){_0x424fab[_0x368b('0x2b')]=[{'all':!![]}];}_0x424fab=_[_0x368b('0x39')]({},_0x424fab,_0x4d8410[_0x368b('0x3a')]);return db[_0x368b('0x24')][_0x368b('0x3b')](_0x424fab)[_0x368b('0x1a')](handleEntityNotFound(_0x22ada9,null))[_0x368b('0x1a')](respondWithResult(_0x22ada9,null))[_0x368b('0x2f')](handleError(_0x22ada9,null));};exports['create']=function(_0x204c52,_0x1f60ea){return db['FaxQueue'][_0x368b('0x3c')](_0x204c52[_0x368b('0x3d')],{})[_0x368b('0x1a')](function(_0x231d84){var _0x248b2b=_0x204c52['user'][_0x368b('0x1c')]({'plain':!![]});if(!_0x248b2b)throw new Error(_0x368b('0x3e'));if(_0x248b2b[_0x368b('0x3f')]===_0x368b('0x40')){var _0x4e44d0=_0x231d84['get']({'plain':!![]});var _0x7ba60d=_0x368b('0x1d');return db[_0x368b('0x41')][_0x368b('0x3b')]({'where':{'name':_0x7ba60d,'userProfileId':_0x248b2b[_0x368b('0x42')]},'raw':!![]})[_0x368b('0x1a')](function(_0x1d990c){if(_0x1d990c&&_0x1d990c[_0x368b('0x43')]===0x0){return db[_0x368b('0x1e')][_0x368b('0x3c')]({'name':_0x4e44d0['name'],'resourceId':_0x4e44d0['id'],'type':_0x1d990c[_0x368b('0x20')],'sectionId':_0x1d990c['id']},{})[_0x368b('0x1a')](function(){return _0x231d84;});}else{return _0x231d84;}})['catch'](function(_0x25e713){logger[_0x368b('0x1f')](_0x368b('0x44'),_0x25e713);throw _0x25e713;});}return _0x231d84;})[_0x368b('0x1a')](respondWithResult(_0x1f60ea,0xc9))['catch'](handleError(_0x1f60ea,null));};exports[_0x368b('0x19')]=function(_0x151711,_0x4a0275){if(_0x151711[_0x368b('0x3d')]['id']){delete _0x151711[_0x368b('0x3d')]['id'];}return db[_0x368b('0x24')]['find']({'where':{'id':_0x151711[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4a0275,null))[_0x368b('0x1a')](saveUpdates(_0x151711['body'],null))['then'](respondWithResult(_0x4a0275,null))[_0x368b('0x2f')](handleError(_0x4a0275,null));};exports[_0x368b('0x1b')]=function(_0x568ee5,_0x2bb15a){return db[_0x368b('0x24')][_0x368b('0x3b')]({'where':{'id':_0x568ee5[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x2bb15a,null))[_0x368b('0x1a')](removeEntity(_0x2bb15a,null))[_0x368b('0x2f')](handleError(_0x2bb15a,null));};exports[_0x368b('0x45')]=function(_0x5db559,_0x33914c){return db[_0x368b('0x24')][_0x368b('0x45')]()[_0x368b('0x1a')](respondWithResult(_0x33914c,null))['catch'](handleError(_0x33914c,null));};exports[_0x368b('0x46')]=function(_0x1fff8e,_0xe79f4c){var _0xf95817={'raw':!![],'where':{}},_0x2d59fe={},_0x5a827e;return db['FaxQueue'][_0x368b('0x47')]({'where':{'id':_0x1fff8e[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0xe79f4c,null))['then'](function(_0x378510){if(_0x378510){_0x5a827e=_0x378510[_0x368b('0x1c')]({'plain':!![]});_0x2d59fe[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x48')][_0x368b('0x25')]);_0x2d59fe[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x1fff8e[_0x368b('0x2c')]);_0x2d59fe[_0x368b('0x33')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],_0x2d59fe['query']);_0xf95817[_0x368b('0x37')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],qs['fields'](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x36')]));_0xf95817[_0x368b('0x37')]=_0xf95817[_0x368b('0x37')]['length']?_0xf95817[_0x368b('0x37')]:_0x2d59fe[_0x368b('0x34')];if(!_0x1fff8e[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0xf95817[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x14')]);_0xf95817['offset']=qs[_0x368b('0x16')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x16')]);}_0xf95817[_0x368b('0x4b')]=qs[_0x368b('0x4c')](_0x1fff8e['query'][_0x368b('0x4c')]);_0xf95817[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x1fff8e[_0x368b('0x2c')],_0x2d59fe[_0x368b('0x33')]));_0xf95817[_0x368b('0x2a')]['FaxQueueId']=_0x378510['id'];if(_0x1fff8e['query']['filter']){_0xf95817['where']=_[_0x368b('0x39')](_0xf95817['where'],{'$or':_[_0x368b('0x23')](_0xf95817[_0x368b('0x37')],function(_0x509dd4){var _0x5711ee={};_0x5711ee[_0x509dd4]={'$like':'%'+_0x1fff8e[_0x368b('0x2c')]['filter']+'%'};return _0x5711ee;})});}_0xf95817=_[_0x368b('0x39')]({},_0xf95817,_0x1fff8e[_0x368b('0x3a')]);return db['UserFaxQueue'][_0x368b('0x2d')](_0xf95817);}})[_0x368b('0x1a')](function(_0x58eb4a){if(_0x58eb4a){return db[_0x368b('0x4e')]['findAndCountAll']({'where':{'id':_[_0x368b('0x23')](_0x58eb4a,_0x368b('0x4f')),'role':_0x368b('0x50')},'attributes':['id',_0x368b('0x20'),'faxPause',_0x368b('0x51'),_0x368b('0x52')]});}})[_0x368b('0x1a')](function(_0x14974e){if(_0x14974e){return{'count':_0x14974e['count'],'rows':_[_0x368b('0x23')](_0x14974e['rows'],function(_0xa320cc){return{'membername':_0xa320cc[_0x368b('0x20')],'UserId':_0xa320cc['id'],'queue_name':_0x5a827e['name'],'FaxQueueId':_0x5a827e['id'],'interface':util['format'](_0x368b('0x53'),_0x368b('0x54'),_0xa320cc[_0x368b('0x20')]),'penalty':0x0,'paused':_0xa320cc[_0x368b('0x55')],'createdAt':_0xa320cc[_0x368b('0x52')],'updatedAt':_0xa320cc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x368b('0x1a')](respondWithFilteredResult(_0xe79f4c,_0xf95817))[_0x368b('0x2f')](handleError(_0xe79f4c,null));};exports['getTeams']=function(_0x2e5827,_0x19d5cc){var _0x472507={};var _0x302b06={};var _0x5ef40c;var _0x3d66fe;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x2e5827[_0x368b('0x31')]['id']}})['then'](handleEntityNotFound(_0x19d5cc,null))['then'](function(_0x5c8438){if(_0x5c8438){_0x5ef40c=_0x5c8438;_0x302b06['model']=_[_0x368b('0x32')](db[_0x368b('0x56')]['rawAttributes']);_0x302b06['query']=_['keys'](_0x2e5827['query']);_0x302b06['filters']=_[_0x368b('0x35')](_0x302b06[_0x368b('0x34')],_0x302b06[_0x368b('0x2c')]);_0x472507['attributes']=_[_0x368b('0x35')](_0x302b06['model'],qs['fields'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x36')]));_0x472507[_0x368b('0x37')]=_0x472507[_0x368b('0x37')]['length']?_0x472507[_0x368b('0x37')]:_0x302b06[_0x368b('0x34')];_0x472507[_0x368b('0x4b')]=qs['sort'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x4c')]);_0x472507['where']=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x2e5827['query'],_0x302b06[_0x368b('0x33')]));if(_0x2e5827['query'][_0x368b('0x57')]){_0x472507[_0x368b('0x2a')]=_['merge'](_0x472507[_0x368b('0x2a')],{'$or':_[_0x368b('0x23')](_0x472507[_0x368b('0x37')],function(_0x46d394){var _0x281023={};_0x281023[_0x46d394]={'$like':'%'+_0x2e5827['query'][_0x368b('0x57')]+'%'};return _0x281023;})});}_0x472507=_[_0x368b('0x39')]({},_0x472507,_0x2e5827[_0x368b('0x3a')]);return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0x1c9cce){if(_0x1c9cce){_0x3d66fe=_0x1c9cce[_0x368b('0x59')];if(!_0x2e5827[_0x368b('0x2c')]['hasOwnProperty'](_0x368b('0x4a'))){_0x472507[_0x368b('0x14')]=qs['limit'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x14')]);_0x472507[_0x368b('0x16')]=qs['offset'](_0x2e5827['query'][_0x368b('0x16')]);}return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0xb7cef7){if(_0xb7cef7){return _0xb7cef7?{'count':_0x3d66fe,'rows':_0xb7cef7}:null;}})['then'](respondWithResult(_0x19d5cc,null))[_0x368b('0x2f')](handleError(_0x19d5cc,null));};exports['addTeams']=function(_0x19d3b4,_0x2af914){var _0x3eb462=_0x19d3b4['body'][_0x368b('0x5a')];return db[_0x368b('0x56')][_0x368b('0x2d')]({'where':{'id':_0x3eb462},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x368b('0x5b'),_0x368b('0x5c'),_0x368b('0x5d')],'raw':!![]}]})[_0x368b('0x1a')](function(_0x321112){if(_0x321112){var _0x5c338d=_[_0x368b('0x5e')](_0x321112,function(_0x3abf65){var _0x49e2fc=_0x3abf65[_0x368b('0x1c')]({'plain':!![]});return _0x49e2fc['Agents'];});return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x19d3b4[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](function(_0x21bfb3){return db[_0x368b('0x5f')][_0x368b('0x60')](function(_0x4921b0){return _0x21bfb3[_0x368b('0x61')](_0x3eb462,{'transaction':_0x4921b0})[_0x368b('0x1a')](function(){return BPromise[_0x368b('0x62')](_0x5c338d,function(_0x5d4179){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x5d4179['id'],'FaxQueueId':_0x19d3b4['params']['id']},'transaction':_0x4921b0});});})[_0x368b('0x1a')](function(){_0x5c338d['forEach'](function(_0x5ab241){socket[_0x368b('0x63')](_0x368b('0x64'),{'UserId':_0x5ab241['id'],'FaxQueueId':_0x21bfb3['id']});});});});});}})[_0x368b('0x1a')](respondWithStatusCode(_0x2af914,null))[_0x368b('0x2f')](handleError(_0x2af914,null));};exports[_0x368b('0x65')]=function(_0xbfdde2,_0x67794e){return db[_0x368b('0x56')]['findAll']({'where':{'id':_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x368b('0x66'),'attributes':['id'],'raw':!![]}]})[_0x368b('0x1a')](handleEntityNotFound(_0x67794e,null))[_0x368b('0x1a')](function(_0xb49743){var _0x152962=_[_0x368b('0x23')](_0xb49743,'id');var _0x1ac79c=[];var _0x41e848=[];var _0x26013b=squel[_0x368b('0x67')]();_0x26013b[_0x368b('0x68')](_0x368b('0x69'))[_0x368b('0x6a')](_0x368b('0x6b'),'tq')['join']('user_has_teams','ut',_0x368b('0x6c'))[_0x368b('0x2a')](_0x368b('0x6d'),_0xbfdde2['params']['id']);for(var _0x208cbb=0x0;_0x208cbb<_0xb49743[_0x368b('0x59')];_0x208cbb+=0x1){let _0x2350b5=_0xb49743[_0x208cbb];for(var _0x480af7=0x0;_0x480af7<_0x2350b5[_0x368b('0x66')][_0x368b('0x59')];_0x480af7+=0x1){let _0x5053b3=_0x2350b5[_0x368b('0x66')][_0x480af7];var _0x318be2=_0x26013b[_0x368b('0x6e')]();_0x318be2['where']('ut.UserId\x20=\x20?',_0x5053b3['id']);_0x41e848[_0x368b('0x6f')](db['sequelize'][_0x368b('0x2c')](_0x318be2[_0x368b('0x70')](),{'type':db[_0x368b('0x5f')][_0x368b('0x71')]['SELECT']})[_0x368b('0x1a')](function(_0x1a35c9){if(_0x1a35c9[_0x368b('0x59')]===0x1){return _0x5053b3['id'];}else{var _0x54c95a=_[_0x368b('0x72')](_[_0x368b('0x23')](_0x1a35c9,_0x368b('0x73')),function(_0x252bbd){return _['includes'](_0x152962,_0x252bbd);});if(_0x54c95a){return _0x5053b3['id'];}}}));}}return BPromise[_0x368b('0x74')](_0x41e848)['then'](function(_0x1740a6){_0x1ac79c=_(_0x1ac79c)[_0x368b('0x75')](_0x1740a6)[_0x368b('0x76')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0xbfdde2['params']['id']}})[_0x368b('0x1a')](function(_0x3146a9){return db['sequelize']['transaction'](function(_0x1bde0a){return _0x3146a9['removeTeams'](_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')],{'transaction':_0x1bde0a})['then'](function(){if(!_[_0x368b('0x77')](_0x1ac79c)){return _0x3146a9['removeAgents'](_0x1ac79c,{'transaction':_0x1bde0a});}})[_0x368b('0x1a')](function(){_0x1ac79c['forEach'](function(_0x1dd4a7){socket[_0x368b('0x63')]('userFaxQueue:remove',{'UserId':_0x1dd4a7,'FaxQueueId':_0x3146a9['id']});});});});});});})[_0x368b('0x1a')](respondWithStatusCode(_0x67794e,null))['catch'](handleError(_0x67794e,null));};exports[_0x368b('0x78')]=function(_0x2798e1,_0x51c695){return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x2798e1['params']['id']}})['then'](handleEntityNotFound(_0x51c695,null))[_0x368b('0x1a')](function(_0x54c442){if(_0x54c442){return _0x54c442['addAgents'](_0x2798e1['body']['ids'],_[_0x368b('0x79')](_0x2798e1['body'],[_0x368b('0x5a'),'id'])||{})[_0x368b('0x7a')](function(_0x4861d9){for(var _0x302d6d=0x0;_0x302d6d<_0x2798e1[_0x368b('0x3d')]['ids'][_0x368b('0x59')];_0x302d6d+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2798e1[_0x368b('0x3d')][_0x368b('0x5a')][_0x302d6d]),'FaxQueueId':Number(_0x2798e1['params']['id'])});}return _0x4861d9;});}})[_0x368b('0x1a')](respondWithResult(_0x51c695,null))['catch'](handleError(_0x51c695,null));};exports['removeAgents']=function(_0x379dc9,_0x4d7151){return db[_0x368b('0x24')]['find']({'where':{'id':_0x379dc9['params']['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4d7151,null))['then'](function(_0x30235b){if(_0x30235b){return _0x30235b[_0x368b('0x7b')](_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')])[_0x368b('0x1a')](function(){if(_[_0x368b('0x7c')](_0x379dc9['query'][_0x368b('0x5a')])){for(var _0x11ed4b=0x0;_0x11ed4b<_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x368b('0x59')];_0x11ed4b+=0x1){socket['emit'](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x11ed4b]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}}else{socket[_0x368b('0x63')](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}});}})[_0x368b('0x1a')](respondWithStatusCode(_0x4d7151,null))[_0x368b('0x2f')](handleError(_0x4d7151,null));};exports[_0x368b('0x7e')]=function(_0x14f666,_0x509092){var _0x4136e6={};var _0x42d423={};var _0x142868;var _0x179c33;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x14f666[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x509092,null))[_0x368b('0x1a')](function(_0x30e6c3){if(_0x30e6c3){_0x142868=_0x30e6c3;_0x42d423[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x4e')]['rawAttributes']);_0x42d423[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x14f666['query']);_0x42d423['filters']=_['intersection'](_0x42d423[_0x368b('0x34')],_0x42d423['query']);_0x4136e6['attributes']=_[_0x368b('0x35')](_0x42d423[_0x368b('0x34')],qs[_0x368b('0x36')](_0x14f666[_0x368b('0x2c')]['fields']));_0x4136e6[_0x368b('0x37')]=_0x4136e6[_0x368b('0x37')][_0x368b('0x59')]?_0x4136e6[_0x368b('0x37')]:_0x42d423[_0x368b('0x34')];_0x4136e6[_0x368b('0x4b')]=qs['sort'](_0x14f666[_0x368b('0x2c')][_0x368b('0x4c')]);_0x4136e6[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x14f666['query'],_0x42d423[_0x368b('0x33')]));if(_0x14f666['query'][_0x368b('0x57')]){_0x4136e6['where']=_[_0x368b('0x39')](_0x4136e6['where'],{'$or':_[_0x368b('0x23')](_0x4136e6['attributes'],function(_0x381226){var _0x145cf5={};_0x145cf5[_0x381226]={'$like':'%'+_0x14f666['query'][_0x368b('0x57')]+'%'};return _0x145cf5;})});}_0x4136e6=_[_0x368b('0x39')]({},_0x4136e6,_0x14f666[_0x368b('0x3a')]);return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x3273ae){if(_0x3273ae){_0x179c33=_0x3273ae[_0x368b('0x59')];if(!_0x14f666[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0x4136e6[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x14f666[_0x368b('0x2c')]['limit']);_0x4136e6[_0x368b('0x16')]=qs['offset'](_0x14f666[_0x368b('0x2c')]['offset']);}return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x37ecf7){if(_0x37ecf7){return _0x37ecf7?{'count':_0x179c33,'rows':_0x37ecf7}:null;}})['then'](respondWithResult(_0x509092,null))[_0x368b('0x2f')](handleError(_0x509092,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8fcc070..c84b773 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 _0x7170=['events','FaxQueue','save','emit','hasOwnProperty','hook','exports'];(function(_0x4e69d9,_0x44b22a){var _0x2d0709=function(_0x2dbe53){while(--_0x2dbe53){_0x4e69d9['push'](_0x4e69d9['shift']());}};_0x2d0709(++_0x44b22a);}(_0x7170,0xf5));var _0x0717=function(_0x1ffb53,_0x22ac1f){_0x1ffb53=_0x1ffb53-0x0;var _0x5e6b2b=_0x7170[_0x1ffb53];return _0x5e6b2b;};'use strict';var EventEmitter=require(_0x0717('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0717('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0717('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35cab1){return function(_0x3970f3,_0x458d9a,_0x8bfc64){FaxQueueEvents[_0x0717('0x3')](_0x35cab1+':'+_0x3970f3['id'],_0x3970f3);FaxQueueEvents[_0x0717('0x3')](_0x35cab1,_0x3970f3);_0x8bfc64(null);};}for(var e in events){if(events[_0x0717('0x4')](e)){var event=events[e];FaxQueue[_0x0717('0x5')](e,emitEvent(event));}}module[_0x0717('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xeb27=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x20f7d2,_0x41678d){var _0x3c6e14=function(_0x183896){while(--_0x183896){_0x20f7d2['push'](_0x20f7d2['shift']());}};_0x3c6e14(++_0x41678d);}(_0xeb27,0x78));var _0x7eb2=function(_0x3d0942,_0x5771c7){_0x3d0942=_0x3d0942-0x0;var _0x337d47=_0xeb27[_0x3d0942];return _0x337d47;};'use strict';var EventEmitter=require(_0x7eb2('0x0'));var FaxQueue=require(_0x7eb2('0x1'))['db'][_0x7eb2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7eb2('0x3')](0x0);var events={'afterCreate':_0x7eb2('0x4'),'afterUpdate':_0x7eb2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e6144){return function(_0xa2a368,_0x16aebb,_0x17e713){FaxQueueEvents['emit'](_0x3e6144+':'+_0xa2a368['id'],_0xa2a368);FaxQueueEvents[_0x7eb2('0x6')](_0x3e6144,_0xa2a368);_0x17e713(null);};}for(var e in events){if(events[_0x7eb2('0x7')](e)){var event=events[e];FaxQueue[_0x7eb2('0x8')](e,emitEvent(event));}}module[_0x7eb2('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 26de6a9..a90d1c5 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 _0xca04=['../../config/environment','exports','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca04,0x118));var _0x4ca0=function(_0x497874,_0x2cf98b){_0x497874=_0x497874-0x0;var _0x34e0ab=_0xca04[_0x497874];return _0x34e0ab;};'use strict';var _=require(_0x4ca0('0x0'));var util=require(_0x4ca0('0x1'));var logger=require(_0x4ca0('0x2'))(_0x4ca0('0x3'));var moment=require(_0x4ca0('0x4'));var BPromise=require(_0x4ca0('0x5'));var rp=require(_0x4ca0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ca0('0x7'));var config=require(_0x4ca0('0x8'));var attributes=require('./faxQueue.attributes');module[_0x4ca0('0x9')]=function(_0x379e98,_0x595335){return _0x379e98[_0x4ca0('0xa')]('FaxQueue',attributes,{'tableName':_0x4ca0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69cd=['fax_queues','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x2c2d99,_0x1a61ce){var _0xc9af40=function(_0x4bc502){while(--_0x4bc502){_0x2c2d99['push'](_0x2c2d99['shift']());}};_0xc9af40(++_0x1a61ce);}(_0x69cd,0x16c));var _0xd69c=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x69cd[_0x64aff8];return _0x5488a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd69c('0x0'));var moment=require(_0xd69c('0x1'));var BPromise=require(_0xd69c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd69c('0x3'));var rimraf=require(_0xd69c('0x4'));var config=require(_0xd69c('0x5'));var attributes=require(_0xd69c('0x6'));module[_0xd69c('0x7')]=function(_0x47560c,_0x4cedca){return _0x47560c[_0xd69c('0x8')](_0xd69c('0x9'),attributes,{'tableName':_0xd69c('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 1135ff3..7763a4e 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 _0x8b95=['then','debug','stringify','ShowFaxQueue','FaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','findAll','options','raw','limit','include','model','map','attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b95,0xef));var _0x58b9=function(_0x510840,_0x17ac89){_0x510840=_0x510840-0x0;var _0x1a9260=_0x8b95[_0x510840];return _0x1a9260;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58b9('0x0'));var BPromise=require(_0x58b9('0x1'));var rs=require(_0x58b9('0x2'));var fs=require('fs');var Redis=require(_0x58b9('0x3'));var db=require(_0x58b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x58b9('0x5'))(_0x58b9('0x6'));var config=require(_0x58b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x58b9('0x8')][_0x58b9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x58b9('0xa')],{'host':_0x58b9('0xb'),'port':0x18eb});var socket=require(_0x58b9('0xc'))(new Redis(config[_0x58b9('0xa')]));require(_0x58b9('0xd'))[_0x58b9('0xe')](socket);function respondWithRpcPromise(_0x29bd78,_0x68d068,_0x29bc04){return new BPromise(function(_0x35c05f,_0x5eb923){return client[_0x58b9('0xf')](_0x29bd78,_0x29bc04)['then'](function(_0x1b9a05){logger[_0x58b9('0x10')]('FaxQueue,\x20%s,\x20%s',_0x68d068,_0x58b9('0x11'));logger['debug'](_0x58b9('0x12'),_0x68d068,_0x58b9('0x11'),JSON['stringify'](_0x1b9a05));if(_0x1b9a05[_0x58b9('0x13')]){if(_0x1b9a05[_0x58b9('0x13')][_0x58b9('0x14')]===0x1f4){logger[_0x58b9('0x13')](_0x58b9('0x15'),_0x68d068,_0x1b9a05[_0x58b9('0x13')][_0x58b9('0x16')]);return _0x5eb923(_0x1b9a05['error'][_0x58b9('0x16')]);}logger['error'](_0x58b9('0x15'),_0x68d068,_0x1b9a05[_0x58b9('0x13')]['message']);return _0x35c05f(_0x1b9a05['error'][_0x58b9('0x16')]);}else{logger[_0x58b9('0x10')](_0x58b9('0x15'),_0x68d068,_0x58b9('0x11'));_0x35c05f(_0x1b9a05[_0x58b9('0x17')]['message']);}})[_0x58b9('0x18')](function(_0xf51f00){logger[_0x58b9('0x13')]('FaxQueue,\x20%s,\x20%s',_0x68d068,_0xf51f00);_0x5eb923(_0xf51f00);});});}exports[_0x58b9('0x19')]=function(_0x21d081){var _0x5ac718=this;return new Promise(function(_0x43eda0,_0x5acda5){return db['FaxQueue'][_0x58b9('0x1a')]({'raw':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')]['where']||null:null,'attributes':_0x21d081[_0x58b9('0x1b')]?_0x21d081['options']['attributes']||null:null,'limit':_0x21d081['options']?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1d')]||null:null,'include':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1e')]?_['map'](_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1e')],function(_0x49f504){return{'model':db[_0x49f504[_0x58b9('0x1f')]],'as':_0x49f504['as'],'attributes':_0x49f504['attributes'],'include':_0x49f504[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x49f504[_0x58b9('0x1e')],function(_0x2c6cb5){return{'model':db[_0x2c6cb5[_0x58b9('0x1f')]],'as':_0x2c6cb5['as'],'attributes':_0x2c6cb5[_0x58b9('0x21')],'include':_0x2c6cb5[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x2c6cb5['include'],function(_0x28303f){return{'model':db[_0x28303f['model']],'as':_0x28303f['as'],'attributes':_0x28303f[_0x58b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x58b9('0x22')](function(_0x5c025a){logger[_0x58b9('0x10')](_0x58b9('0x19'),_0x21d081);logger[_0x58b9('0x23')]('GetFaxQueue',_0x21d081,JSON[_0x58b9('0x24')](_0x5c025a));_0x43eda0(_0x5c025a);})[_0x58b9('0x18')](function(_0x156861){logger[_0x58b9('0x13')]('GetFaxQueue',_0x156861[_0x58b9('0x16')],_0x21d081);_0x5acda5(_0x5ac718[_0x58b9('0x13')](0x1f4,_0x156861[_0x58b9('0x16')]));});});};exports[_0x58b9('0x25')]=function(_0x1399bd){var _0x186451=this;return new Promise(function(_0x58aa68,_0x4eaa7d){return db[_0x58b9('0x26')]['find']({'raw':_0x1399bd['options']?_0x1399bd[_0x58b9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd['options']['where']||null:null,'attributes':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x21')]||null:null,'include':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x1e')],function(_0x402a28){return{'model':db[_0x402a28[_0x58b9('0x1f')]],'as':_0x402a28['as'],'attributes':_0x402a28[_0x58b9('0x21')],'include':_0x402a28[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x402a28[_0x58b9('0x1e')],function(_0x213a34){return{'model':db[_0x213a34['model']],'as':_0x213a34['as'],'attributes':_0x213a34['attributes'],'include':_0x213a34[_0x58b9('0x1e')]?_['map'](_0x213a34[_0x58b9('0x1e')],function(_0x2f61ef){return{'model':db[_0x2f61ef['model']],'as':_0x2f61ef['as'],'attributes':_0x2f61ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x58b9('0x22')](function(_0x38073e){logger[_0x58b9('0x10')](_0x58b9('0x25'),_0x1399bd);logger[_0x58b9('0x23')]('ShowFaxQueue',_0x1399bd,JSON[_0x58b9('0x24')](_0x38073e));_0x58aa68(_0x38073e);})[_0x58b9('0x18')](function(_0x3fa6bb){logger[_0x58b9('0x13')](_0x58b9('0x25'),_0x3fa6bb[_0x58b9('0x16')],_0x1399bd);_0x4eaa7d(_0x186451[_0x58b9('0x13')](0x1f4,_0x3fa6bb[_0x58b9('0x16')]));});});}; \ No newline at end of file +var _0x67de=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','include','map','model','then','ShowFaxQueue','FaxQueue','find'];(function(_0x4cc198,_0x11a598){var _0x3e8858=function(_0x226554){while(--_0x226554){_0x4cc198['push'](_0x4cc198['shift']());}};_0x3e8858(++_0x11a598);}(_0x67de,0xa0));var _0xe67d=function(_0x213919,_0x31ca13){_0x213919=_0x213919-0x0;var _0x1cb2c3=_0x67de[_0x213919];return _0x1cb2c3;};'use strict';var _=require(_0xe67d('0x0'));var util=require(_0xe67d('0x1'));var moment=require(_0xe67d('0x2'));var BPromise=require(_0xe67d('0x3'));var rs=require(_0xe67d('0x4'));var fs=require('fs');var Redis=require(_0xe67d('0x5'));var db=require(_0xe67d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe67d('0x7'))(_0xe67d('0x8'));var config=require('../../config/environment');var jayson=require(_0xe67d('0x9'));var client=jayson[_0xe67d('0xa')][_0xe67d('0xb')]({'port':0x232a});config[_0xe67d('0xc')]=_[_0xe67d('0xd')](config[_0xe67d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe67d('0xe'))(new Redis(config['redis']));require(_0xe67d('0xf'))['register'](socket);function respondWithRpcPromise(_0x12f4c9,_0x3b1a20,_0x4e4b78){return new BPromise(function(_0x4bb57b,_0xce10df){return client[_0xe67d('0x10')](_0x12f4c9,_0x4e4b78)['then'](function(_0x4338fc){logger[_0xe67d('0x11')](_0xe67d('0x12'),_0x3b1a20,_0xe67d('0x13'));logger[_0xe67d('0x14')](_0xe67d('0x15'),_0x3b1a20,_0xe67d('0x13'),JSON[_0xe67d('0x16')](_0x4338fc));if(_0x4338fc[_0xe67d('0x17')]){if(_0x4338fc[_0xe67d('0x17')][_0xe67d('0x18')]===0x1f4){logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x4338fc[_0xe67d('0x17')][_0xe67d('0x19')]);return _0xce10df(_0x4338fc[_0xe67d('0x17')]['message']);}logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x4338fc['error'][_0xe67d('0x19')]);return _0x4bb57b(_0x4338fc[_0xe67d('0x17')][_0xe67d('0x19')]);}else{logger[_0xe67d('0x11')](_0xe67d('0x12'),_0x3b1a20,_0xe67d('0x13'));_0x4bb57b(_0x4338fc[_0xe67d('0x1a')][_0xe67d('0x19')]);}})[_0xe67d('0x1b')](function(_0x3ec7e7){logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x3ec7e7);_0xce10df(_0x3ec7e7);});});}exports[_0xe67d('0x1c')]=function(_0x14e098){var _0x3c2ca4=this;return new Promise(function(_0x5cb23f,_0x4f2b62){return db['FaxQueue'][_0xe67d('0x1d')]({'raw':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x1f')]===undefined?!![]:![]:!![],'where':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')]['where']||null:null,'attributes':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x20')]||null:null,'limit':_0x14e098['options']?_0x14e098[_0xe67d('0x1e')]['limit']||null:null,'include':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x14e098[_0xe67d('0x1e')][_0xe67d('0x21')],function(_0x1d14eb){return{'model':db[_0x1d14eb[_0xe67d('0x23')]],'as':_0x1d14eb['as'],'attributes':_0x1d14eb[_0xe67d('0x20')],'include':_0x1d14eb['include']?_['map'](_0x1d14eb[_0xe67d('0x21')],function(_0x4740e0){return{'model':db[_0x4740e0[_0xe67d('0x23')]],'as':_0x4740e0['as'],'attributes':_0x4740e0['attributes'],'include':_0x4740e0['include']?_['map'](_0x4740e0[_0xe67d('0x21')],function(_0x5de1e4){return{'model':db[_0x5de1e4[_0xe67d('0x23')]],'as':_0x5de1e4['as'],'attributes':_0x5de1e4[_0xe67d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe67d('0x24')](function(_0x5ace22){logger['info']('GetFaxQueue',_0x14e098);logger[_0xe67d('0x14')](_0xe67d('0x1c'),_0x14e098,JSON[_0xe67d('0x16')](_0x5ace22));_0x5cb23f(_0x5ace22);})[_0xe67d('0x1b')](function(_0x2cc1b4){logger[_0xe67d('0x17')](_0xe67d('0x1c'),_0x2cc1b4[_0xe67d('0x19')],_0x14e098);_0x4f2b62(_0x3c2ca4['error'](0x1f4,_0x2cc1b4[_0xe67d('0x19')]));});});};exports[_0xe67d('0x25')]=function(_0x42f259){var _0x2d0050=this;return new Promise(function(_0x44e4ec,_0x37ed28){return db[_0xe67d('0x26')][_0xe67d('0x27')]({'raw':_0x42f259['options']?_0x42f259[_0xe67d('0x1e')][_0xe67d('0x1f')]===undefined?!![]:![]:!![],'where':_0x42f259[_0xe67d('0x1e')]?_0x42f259[_0xe67d('0x1e')]['where']||null:null,'attributes':_0x42f259[_0xe67d('0x1e')]?_0x42f259['options'][_0xe67d('0x20')]||null:null,'include':_0x42f259['options']?_0x42f259['options'][_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x42f259[_0xe67d('0x1e')][_0xe67d('0x21')],function(_0x285fd9){return{'model':db[_0x285fd9[_0xe67d('0x23')]],'as':_0x285fd9['as'],'attributes':_0x285fd9[_0xe67d('0x20')],'include':_0x285fd9['include']?_[_0xe67d('0x22')](_0x285fd9[_0xe67d('0x21')],function(_0x5021f7){return{'model':db[_0x5021f7[_0xe67d('0x23')]],'as':_0x5021f7['as'],'attributes':_0x5021f7['attributes'],'include':_0x5021f7[_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x5021f7[_0xe67d('0x21')],function(_0x1b62a9){return{'model':db[_0x1b62a9[_0xe67d('0x23')]],'as':_0x1b62a9['as'],'attributes':_0x1b62a9[_0xe67d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fe10a){logger['info'](_0xe67d('0x25'),_0x42f259);logger[_0xe67d('0x14')](_0xe67d('0x25'),_0x42f259,JSON['stringify'](_0x2fe10a));_0x44e4ec(_0x2fe10a);})[_0xe67d('0x1b')](function(_0x8151b7){logger[_0xe67d('0x17')](_0xe67d('0x25'),_0x8151b7[_0xe67d('0x19')],_0x42f259);_0x37ed28(_0x2d0050[_0xe67d('0x17')](0x1f4,_0x8151b7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 9b411b3..ee4e26b 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 _0xa60e=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2f34d3,_0x38d3f7){var _0x10cf63=function(_0x6c528){while(--_0x6c528){_0x2f34d3['push'](_0x2f34d3['shift']());}};_0x10cf63(++_0x38d3f7);}(_0xa60e,0x1c3));var _0xea60=function(_0x15b336,_0x382b8e){_0x15b336=_0x15b336-0x0;var _0x33dcbf=_0xa60e[_0x15b336];return _0x33dcbf;};'use strict';var FaxQueueEvents=require(_0xea60('0x0'));var events=[_0xea60('0x1'),_0xea60('0x2'),_0xea60('0x3')];function createListener(_0x2d51b7,_0x195ab2){return function(_0x220015){_0x195ab2[_0xea60('0x4')](_0x2d51b7,_0x220015);};}function removeListener(_0x2a39c9,_0x5b8fdb){return function(){FaxQueueEvents[_0xea60('0x5')](_0x2a39c9,_0x5b8fdb);};}exports[_0xea60('0x6')]=function(_0x4e205d){for(var _0x47f55b=0x0,_0x27f68c=events[_0xea60('0x7')];_0x47f55b<_0x27f68c;_0x47f55b++){var _0xa6b458=events[_0x47f55b];var _0x381ec3=createListener(_0xea60('0x8')+_0xa6b458,_0x4e205d);FaxQueueEvents['on'](_0xa6b458,_0x381ec3);}}; \ No newline at end of file +var _0xf897=['emit','removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x5770dc,_0x3da745){var _0x425e9a=function(_0x9ffb99){while(--_0x9ffb99){_0x5770dc['push'](_0x5770dc['shift']());}};_0x425e9a(++_0x3da745);}(_0xf897,0xe4));var _0x7f89=function(_0x827744,_0x23b9c0){_0x827744=_0x827744-0x0;var _0x8b1d96=_0xf897[_0x827744];return _0x8b1d96;};'use strict';var FaxQueueEvents=require(_0x7f89('0x0'));var events=[_0x7f89('0x1'),_0x7f89('0x2'),_0x7f89('0x3')];function createListener(_0x27c0e4,_0x192b44){return function(_0x1f8d54){_0x192b44[_0x7f89('0x4')](_0x27c0e4,_0x1f8d54);};}function removeListener(_0x1b4c56,_0x3b5e37){return function(){FaxQueueEvents[_0x7f89('0x5')](_0x1b4c56,_0x3b5e37);};}exports[_0x7f89('0x6')]=function(_0x338dae){for(var _0x47f87d=0x0,_0x2d14d2=events[_0x7f89('0x7')];_0x47f87d<_0x2d14d2;_0x47f87d++){var _0x5ef009=events[_0x47f87d];var _0x48e30a=createListener('faxQueue:'+_0x5ef009,_0x338dae);FaxQueueEvents['on'](_0x5ef009,_0x48e30a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c78981f..f9ac1b5 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 _0x7046=['../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xf5276f,_0x1387b7){var _0x4e7834=function(_0x25cb10){while(--_0x25cb10){_0xf5276f['push'](_0xf5276f['shift']());}};_0x4e7834(++_0x1387b7);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['getTeams']);router[_0x6704('0x9')](_0x6704('0x11'),auth['isAuthenticated'](),controller[_0x6704('0x12')]);router[_0x6704('0x13')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0x14')]);router[_0x6704('0x13')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x15')]);router[_0x6704('0x13')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x16')]);router[_0x6704('0x17')]('/:id',auth[_0x6704('0xa')](),controller[_0x6704('0x18')]);router[_0x6704('0x19')](_0x6704('0x1a'),auth[_0x6704('0xa')](),controller['destroy']);router[_0x6704('0x19')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x1b')]);router[_0x6704('0x19')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x1c')]);module[_0x6704('0x1d')]=router; \ No newline at end of file +var _0x27a0=['/:id/users','getAgents','post','addTeams','addAgents','update','destroy','delete','exports','util','path','connect-timeout','express','Router','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x27a0,0xbf));var _0x027a=function(_0x3e67c7,_0x33fb73){_0x3e67c7=_0x3e67c7-0x0;var _0x4a20b2=_0x27a0[_0x3e67c7];return _0x4a20b2;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0x6')](_0x027a('0xd'),auth['isAuthenticated'](),controller[_0x027a('0xe')]);router[_0x027a('0x6')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller[_0x027a('0x10')]);router[_0x027a('0x6')](_0x027a('0x11'),auth[_0x027a('0x7')](),controller[_0x027a('0x12')]);router[_0x027a('0x13')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0x13')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller[_0x027a('0x14')]);router[_0x027a('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x027a('0x15')]);router['put'](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x027a('0x17')]);router[_0x027a('0x18')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller['removeTeams']);router[_0x027a('0x18')](_0x027a('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x027a('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 72042ee..35d3ebb 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 _0x4d61=['STRING','DATE','moment','sequelize','exports'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x4d61,0x147));var _0x14d6=function(_0x26cc37,_0x1c49d2){_0x26cc37=_0x26cc37-0x0;var _0x244e5c=_0x4d61[_0x26cc37];return _0x244e5c;};'use strict';var moment=require(_0x14d6('0x0'));var Sequelize=require(_0x14d6('0x1'));module[_0x14d6('0x2')]={'uniqueid':{'type':Sequelize[_0x14d6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x14d6('0x3')]},'joinAt':{'type':Sequelize[_0x14d6('0x4')]},'leaveAt':{'type':Sequelize[_0x14d6('0x4')]},'acceptAt':{'type':Sequelize[_0x14d6('0x4')]},'exitAt':{'type':Sequelize[_0x14d6('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac03=['DATE','exports','STRING'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xac03,0x181));var _0x3ac0=function(_0x1c01d8,_0x2ff6d3){_0x1c01d8=_0x1c01d8-0x0;var _0x1a368d=_0xac03[_0x1c01d8];return _0x1a368d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3ac0('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3ac0('0x1')]},'joinAt':{'type':Sequelize[_0x3ac0('0x2')]},'leaveAt':{'type':Sequelize[_0x3ac0('0x2')]},'acceptAt':{'type':Sequelize[_0x3ac0('0x2')]},'exitAt':{'type':Sequelize[_0x3ac0('0x2')]},'reason':{'type':Sequelize[_0x3ac0('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 937c74b..8d7f4d4 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 _0x2a41=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','FaxQueueReport','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js'];(function(_0x276b15,_0x3cfe67){var _0x33e64b=function(_0x4fb9cb){while(--_0x4fb9cb){_0x276b15['push'](_0x276b15['shift']());}};_0x33e64b(++_0x3cfe67);}(_0x2a41,0x126));var _0x12a4=function(_0x1d16fc,_0xe56c15){_0x1d16fc=_0x1d16fc-0x0;var _0x2c84bc=_0x2a41[_0x1d16fc];return _0x2c84bc;};'use strict';var emlformat=require(_0x12a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12a4('0x1'));var jsonpatch=require(_0x12a4('0x2'));var rp=require(_0x12a4('0x3'));var moment=require(_0x12a4('0x4'));var BPromise=require(_0x12a4('0x5'));var Mustache=require(_0x12a4('0x6'));var util=require(_0x12a4('0x7'));var path=require(_0x12a4('0x8'));var sox=require(_0x12a4('0x9'));var csv=require('to-csv');var ejs=require(_0x12a4('0xa'));var fs=require('fs');var fs_extra=require(_0x12a4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x12a4('0xd'));var toCsv=require(_0x12a4('0xe'));var querystring=require(_0x12a4('0xf'));var Papa=require(_0x12a4('0x10'));var Redis=require(_0x12a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x12a4('0x12'));var as=require(_0x12a4('0x13'));var hardwareService=require(_0x12a4('0x14'));var logger=require(_0x12a4('0x15'))(_0x12a4('0x16'));var utils=require(_0x12a4('0x17'));var config=require(_0x12a4('0x18'));var licenseUtil=require(_0x12a4('0x19'));var db=require(_0x12a4('0x1a'))['db'];function respondWithStatusCode(_0x197554,_0x28059a){_0x28059a=_0x28059a||0xcc;return function(_0x2c939e){if(_0x2c939e){return _0x197554['sendStatus'](_0x28059a);}return _0x197554[_0x12a4('0x1b')](_0x28059a)[_0x12a4('0x1c')]();};}function respondWithResult(_0x1af5f8,_0x22cfde){_0x22cfde=_0x22cfde||0xc8;return function(_0x2b6e72){if(_0x2b6e72){return _0x1af5f8['status'](_0x22cfde)['json'](_0x2b6e72);}};}function respondWithFilteredResult(_0x257d27,_0x2ccfce){return function(_0x2428ba){if(_0x2428ba){var _0x1cce66=typeof _0x2ccfce['offset']===_0x12a4('0x1d')&&typeof _0x2ccfce[_0x12a4('0x1e')]===_0x12a4('0x1d');var _0x25d54f=_0x2428ba[_0x12a4('0x1f')];var _0xe274e1=_0x1cce66?0x0:_0x2ccfce['offset'];var _0x1a6bbe=_0x1cce66?_0x2428ba[_0x12a4('0x1f')]:_0x2ccfce[_0x12a4('0x20')]+_0x2ccfce['limit'];var _0x569763;if(_0x1a6bbe>=_0x25d54f){_0x1a6bbe=_0x25d54f;_0x569763=0xc8;}else{_0x569763=0xce;}_0x257d27[_0x12a4('0x1b')](_0x569763);return _0x257d27[_0x12a4('0x21')](_0x12a4('0x22'),_0xe274e1+'-'+_0x1a6bbe+'/'+_0x25d54f)[_0x12a4('0x23')](_0x2428ba);}return null;};}function patchUpdates(_0x1a35d3){return function(_0x5c92e8){try{jsonpatch[_0x12a4('0x24')](_0x5c92e8,_0x1a35d3,!![]);}catch(_0x5617d6){return BPromise[_0x12a4('0x25')](_0x5617d6);}return _0x5c92e8[_0x12a4('0x26')]();};}function saveUpdates(_0x40bf8e,_0x475939){return function(_0x17a4cc){if(_0x17a4cc){return _0x17a4cc['update'](_0x40bf8e)[_0x12a4('0x27')](function(_0x188930){return _0x188930;});}return null;};}function removeEntity(_0x35e966,_0x1c4255){return function(_0x499b22){if(_0x499b22){return _0x499b22[_0x12a4('0x28')]()[_0x12a4('0x27')](function(){_0x35e966[_0x12a4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395749,_0x2f3cae){return function(_0x5950fe){if(!_0x5950fe){_0x395749[_0x12a4('0x29')](0x194);}return _0x5950fe;};}function handleError(_0xcb5f1f,_0x4f1c77){_0x4f1c77=_0x4f1c77||0x1f4;return function(_0x5e952f){logger['error'](_0x5e952f[_0x12a4('0x2a')]);if(_0x5e952f[_0x12a4('0x2b')]){delete _0x5e952f[_0x12a4('0x2b')];}_0xcb5f1f[_0x12a4('0x1b')](_0x4f1c77)['send'](_0x5e952f);};}exports[_0x12a4('0x2c')]=function(_0x56c3da,_0x1979d1){var _0x3c5584={},_0x377466={},_0x15adb7={'count':0x0,'rows':[]};var _0x56df0f=_[_0x12a4('0x2d')](db[_0x12a4('0x2e')]['rawAttributes'],function(_0x283668){return{'name':_0x283668['fieldName'],'type':_0x283668[_0x12a4('0x2f')][_0x12a4('0x30')]};});_0x377466['model']=_[_0x12a4('0x2d')](_0x56df0f,_0x12a4('0x2b'));_0x377466[_0x12a4('0x31')]=_['keys'](_0x56c3da[_0x12a4('0x31')]);_0x377466['filters']=_[_0x12a4('0x32')](_0x377466[_0x12a4('0x33')],_0x377466[_0x12a4('0x31')]);_0x3c5584[_0x12a4('0x34')]=_[_0x12a4('0x32')](_0x377466[_0x12a4('0x33')],qs['fields'](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x35')]));_0x3c5584[_0x12a4('0x34')]=_0x3c5584['attributes']['length']?_0x3c5584[_0x12a4('0x34')]:_0x377466['model'];if(!_0x56c3da[_0x12a4('0x31')][_0x12a4('0x36')]('nolimit')){_0x3c5584[_0x12a4('0x1e')]=qs[_0x12a4('0x1e')](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x1e')]);_0x3c5584['offset']=qs[_0x12a4('0x20')](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x20')]);}_0x3c5584[_0x12a4('0x37')]=qs[_0x12a4('0x38')](_0x56c3da['query']['sort']);_0x3c5584[_0x12a4('0x39')]=qs['filters'](_[_0x12a4('0x3a')](_0x56c3da[_0x12a4('0x31')],_0x377466[_0x12a4('0x3b')]),_0x56df0f);if(_0x56c3da[_0x12a4('0x31')][_0x12a4('0x3c')]){_0x3c5584[_0x12a4('0x39')]=_[_0x12a4('0x3d')](_0x3c5584[_0x12a4('0x39')],{'$or':_[_0x12a4('0x2d')](_0x56df0f,function(_0x31e9bb){if(_0x31e9bb['type']!=='VIRTUAL'){var _0x4bba08={};_0x4bba08[_0x31e9bb[_0x12a4('0x2b')]]={'$like':'%'+_0x56c3da[_0x12a4('0x31')]['filter']+'%'};return _0x4bba08;}})});}_0x3c5584=_[_0x12a4('0x3d')]({},_0x3c5584,_0x56c3da[_0x12a4('0x3e')]);var _0x487d89={'where':_0x3c5584[_0x12a4('0x39')]};return db[_0x12a4('0x2e')][_0x12a4('0x1f')](_0x487d89)[_0x12a4('0x27')](function(_0x22f6c1){_0x15adb7[_0x12a4('0x1f')]=_0x22f6c1;if(_0x56c3da['query'][_0x12a4('0x3f')]){_0x3c5584['include']=[{'all':!![]}];}return db[_0x12a4('0x2e')][_0x12a4('0x40')](_0x3c5584);})[_0x12a4('0x27')](function(_0x2826fb){_0x15adb7[_0x12a4('0x41')]=_0x2826fb;return _0x15adb7;})['then'](respondWithFilteredResult(_0x1979d1,_0x3c5584))[_0x12a4('0x42')](handleError(_0x1979d1,null));};exports[_0x12a4('0x43')]=function(_0x201755,_0x8a1643){var _0x466df1={'raw':!![],'where':{'id':_0x201755[_0x12a4('0x44')]['id']}},_0xf2751e={};_0xf2751e['model']=_[_0x12a4('0x45')](db[_0x12a4('0x2e')][_0x12a4('0x46')]);_0xf2751e[_0x12a4('0x31')]=_[_0x12a4('0x45')](_0x201755[_0x12a4('0x31')]);_0xf2751e[_0x12a4('0x3b')]=_[_0x12a4('0x32')](_0xf2751e[_0x12a4('0x33')],_0xf2751e[_0x12a4('0x31')]);_0x466df1[_0x12a4('0x34')]=_['intersection'](_0xf2751e[_0x12a4('0x33')],qs[_0x12a4('0x35')](_0x201755[_0x12a4('0x31')]['fields']));_0x466df1['attributes']=_0x466df1[_0x12a4('0x34')][_0x12a4('0x47')]?_0x466df1[_0x12a4('0x34')]:_0xf2751e['model'];if(_0x201755[_0x12a4('0x31')][_0x12a4('0x3f')]){_0x466df1[_0x12a4('0x48')]=[{'all':!![]}];}_0x466df1=_[_0x12a4('0x3d')]({},_0x466df1,_0x201755['options']);return db['FaxQueueReport']['find'](_0x466df1)['then'](handleEntityNotFound(_0x8a1643,null))[_0x12a4('0x27')](respondWithResult(_0x8a1643,null))[_0x12a4('0x42')](handleError(_0x8a1643,null));};exports[_0x12a4('0x49')]=function(_0x1568b8,_0x4348ba){return db['FaxQueueReport'][_0x12a4('0x49')](_0x1568b8[_0x12a4('0x4a')],{})[_0x12a4('0x27')](respondWithResult(_0x4348ba,0xc9))['catch'](handleError(_0x4348ba,null));};exports['update']=function(_0x41516b,_0x11ef07){if(_0x41516b['body']['id']){delete _0x41516b['body']['id'];}return db['FaxQueueReport'][_0x12a4('0x4b')]({'where':{'id':_0x41516b[_0x12a4('0x44')]['id']}})[_0x12a4('0x27')](handleEntityNotFound(_0x11ef07,null))['then'](saveUpdates(_0x41516b[_0x12a4('0x4a')],null))[_0x12a4('0x27')](respondWithResult(_0x11ef07,null))['catch'](handleError(_0x11ef07,null));};exports[_0x12a4('0x28')]=function(_0x10f12e,_0x29598b){return db[_0x12a4('0x2e')][_0x12a4('0x4b')]({'where':{'id':_0x10f12e[_0x12a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x29598b,null))[_0x12a4('0x27')](removeEntity(_0x29598b,null))['catch'](handleError(_0x29598b,null));};exports[_0x12a4('0x4c')]=function(_0x30eabd,_0x86f964){return db[_0x12a4('0x2e')][_0x12a4('0x4c')]()[_0x12a4('0x27')](respondWithResult(_0x86f964,null))[_0x12a4('0x42')](handleError(_0x86f964,null));}; \ No newline at end of file +var _0xf996=['limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count'];(function(_0x1f5458,_0x3d32a0){var _0x5d05b6=function(_0x1ffa32){while(--_0x1ffa32){_0x1f5458['push'](_0x1f5458['shift']());}};_0x5d05b6(++_0x3d32a0);}(_0xf996,0x74));var _0x6f99=function(_0xdad312,_0x46fdb7){_0xdad312=_0xdad312-0x0;var _0x196872=_0xf996[_0xdad312];return _0x196872;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x4'));var util=require(_0x6f99('0x5'));var path=require(_0x6f99('0x6'));var sox=require(_0x6f99('0x7'));var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require(_0x6f99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f99('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f99('0xf'));var Papa=require(_0x6f99('0x10'));var Redis=require(_0x6f99('0x11'));var authService=require(_0x6f99('0x12'));var qs=require(_0x6f99('0x13'));var as=require(_0x6f99('0x14'));var hardwareService=require(_0x6f99('0x15'));var logger=require(_0x6f99('0x16'))(_0x6f99('0x17'));var utils=require('../../config/utils');var config=require(_0x6f99('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e7f0,_0x12081d){_0x12081d=_0x12081d||0xcc;return function(_0xa1af95){if(_0xa1af95){return _0x55e7f0[_0x6f99('0x19')](_0x12081d);}return _0x55e7f0[_0x6f99('0x1a')](_0x12081d)[_0x6f99('0x1b')]();};}function respondWithResult(_0x7aea00,_0xf5d4df){_0xf5d4df=_0xf5d4df||0xc8;return function(_0xb9874a){if(_0xb9874a){return _0x7aea00[_0x6f99('0x1a')](_0xf5d4df)[_0x6f99('0x1c')](_0xb9874a);}};}function respondWithFilteredResult(_0x1534e9,_0x1c7733){return function(_0x537f3d){if(_0x537f3d){var _0x293937=typeof _0x1c7733[_0x6f99('0x1d')]==='undefined'&&typeof _0x1c7733['limit']===_0x6f99('0x1e');var _0x5b3638=_0x537f3d[_0x6f99('0x1f')];var _0x210360=_0x293937?0x0:_0x1c7733[_0x6f99('0x1d')];var _0x25d50b=_0x293937?_0x537f3d[_0x6f99('0x1f')]:_0x1c7733['offset']+_0x1c7733[_0x6f99('0x20')];var _0x5377cb;if(_0x25d50b>=_0x5b3638){_0x25d50b=_0x5b3638;_0x5377cb=0xc8;}else{_0x5377cb=0xce;}_0x1534e9[_0x6f99('0x1a')](_0x5377cb);return _0x1534e9[_0x6f99('0x21')](_0x6f99('0x22'),_0x210360+'-'+_0x25d50b+'/'+_0x5b3638)[_0x6f99('0x1c')](_0x537f3d);}return null;};}function patchUpdates(_0x1dc9e5){return function(_0xf66bde){try{jsonpatch['apply'](_0xf66bde,_0x1dc9e5,!![]);}catch(_0x4c4d00){return BPromise[_0x6f99('0x23')](_0x4c4d00);}return _0xf66bde[_0x6f99('0x24')]();};}function saveUpdates(_0x4974ff,_0x497fd7){return function(_0x1d4dc3){if(_0x1d4dc3){return _0x1d4dc3[_0x6f99('0x25')](_0x4974ff)[_0x6f99('0x26')](function(_0xe3e6ab){return _0xe3e6ab;});}return null;};}function removeEntity(_0x290c88,_0x1174a2){return function(_0x2e7b94){if(_0x2e7b94){return _0x2e7b94[_0x6f99('0x27')]()[_0x6f99('0x26')](function(){_0x290c88[_0x6f99('0x1a')](0xcc)[_0x6f99('0x1b')]();});}};}function handleEntityNotFound(_0x1f8078,_0x21a5c8){return function(_0x381e92){if(!_0x381e92){_0x1f8078['sendStatus'](0x194);}return _0x381e92;};}function handleError(_0x1aff24,_0x201070){_0x201070=_0x201070||0x1f4;return function(_0x4c9572){logger['error'](_0x4c9572[_0x6f99('0x28')]);if(_0x4c9572[_0x6f99('0x29')]){delete _0x4c9572['name'];}_0x1aff24[_0x6f99('0x1a')](_0x201070)[_0x6f99('0x2a')](_0x4c9572);};}exports['index']=function(_0x45fe22,_0x3c1012){var _0x513519={},_0x21eb46={},_0x3ef6c5={'count':0x0,'rows':[]};var _0x5e10e2=_[_0x6f99('0x2b')](db[_0x6f99('0x2c')][_0x6f99('0x2d')],function(_0x4aa40c){return{'name':_0x4aa40c[_0x6f99('0x2e')],'type':_0x4aa40c[_0x6f99('0x2f')]['key']};});_0x21eb46['model']=_[_0x6f99('0x2b')](_0x5e10e2,_0x6f99('0x29'));_0x21eb46[_0x6f99('0x30')]=_[_0x6f99('0x31')](_0x45fe22[_0x6f99('0x30')]);_0x21eb46[_0x6f99('0x32')]=_['intersection'](_0x21eb46['model'],_0x21eb46[_0x6f99('0x30')]);_0x513519[_0x6f99('0x33')]=_[_0x6f99('0x34')](_0x21eb46[_0x6f99('0x35')],qs[_0x6f99('0x36')](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x36')]));_0x513519[_0x6f99('0x33')]=_0x513519[_0x6f99('0x33')][_0x6f99('0x37')]?_0x513519[_0x6f99('0x33')]:_0x21eb46['model'];if(!_0x45fe22[_0x6f99('0x30')][_0x6f99('0x38')](_0x6f99('0x39'))){_0x513519[_0x6f99('0x20')]=qs[_0x6f99('0x20')](_0x45fe22['query'][_0x6f99('0x20')]);_0x513519[_0x6f99('0x1d')]=qs['offset'](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x1d')]);}_0x513519[_0x6f99('0x3a')]=qs[_0x6f99('0x3b')](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3b')]);_0x513519[_0x6f99('0x3c')]=qs[_0x6f99('0x32')](_['pick'](_0x45fe22[_0x6f99('0x30')],_0x21eb46['filters']),_0x5e10e2);if(_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3d')]){_0x513519[_0x6f99('0x3c')]=_[_0x6f99('0x3e')](_0x513519['where'],{'$or':_[_0x6f99('0x2b')](_0x5e10e2,function(_0x4ee7ce){if(_0x4ee7ce[_0x6f99('0x2f')]!==_0x6f99('0x3f')){var _0x2c26a1={};_0x2c26a1[_0x4ee7ce[_0x6f99('0x29')]]={'$like':'%'+_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3d')]+'%'};return _0x2c26a1;}})});}_0x513519=_[_0x6f99('0x3e')]({},_0x513519,_0x45fe22['options']);var _0x35fb0a={'where':_0x513519[_0x6f99('0x3c')]};return db[_0x6f99('0x2c')]['count'](_0x35fb0a)[_0x6f99('0x26')](function(_0x327e98){_0x3ef6c5[_0x6f99('0x1f')]=_0x327e98;if(_0x45fe22[_0x6f99('0x30')][_0x6f99('0x40')]){_0x513519[_0x6f99('0x41')]=[{'all':!![]}];}return db[_0x6f99('0x2c')][_0x6f99('0x42')](_0x513519);})['then'](function(_0x206bc8){_0x3ef6c5['rows']=_0x206bc8;return _0x3ef6c5;})[_0x6f99('0x26')](respondWithFilteredResult(_0x3c1012,_0x513519))[_0x6f99('0x43')](handleError(_0x3c1012,null));};exports['show']=function(_0x26e091,_0x27ae7f){var _0x1934c4={'raw':!![],'where':{'id':_0x26e091['params']['id']}},_0x1fd388={};_0x1fd388[_0x6f99('0x35')]=_[_0x6f99('0x31')](db[_0x6f99('0x2c')]['rawAttributes']);_0x1fd388[_0x6f99('0x30')]=_[_0x6f99('0x31')](_0x26e091[_0x6f99('0x30')]);_0x1fd388[_0x6f99('0x32')]=_[_0x6f99('0x34')](_0x1fd388[_0x6f99('0x35')],_0x1fd388[_0x6f99('0x30')]);_0x1934c4[_0x6f99('0x33')]=_['intersection'](_0x1fd388[_0x6f99('0x35')],qs['fields'](_0x26e091[_0x6f99('0x30')]['fields']));_0x1934c4[_0x6f99('0x33')]=_0x1934c4[_0x6f99('0x33')][_0x6f99('0x37')]?_0x1934c4[_0x6f99('0x33')]:_0x1fd388[_0x6f99('0x35')];if(_0x26e091[_0x6f99('0x30')][_0x6f99('0x40')]){_0x1934c4['include']=[{'all':!![]}];}_0x1934c4=_[_0x6f99('0x3e')]({},_0x1934c4,_0x26e091[_0x6f99('0x44')]);return db['FaxQueueReport'][_0x6f99('0x45')](_0x1934c4)[_0x6f99('0x26')](handleEntityNotFound(_0x27ae7f,null))[_0x6f99('0x26')](respondWithResult(_0x27ae7f,null))[_0x6f99('0x43')](handleError(_0x27ae7f,null));};exports[_0x6f99('0x46')]=function(_0x51fd93,_0x118e87){return db[_0x6f99('0x2c')][_0x6f99('0x46')](_0x51fd93[_0x6f99('0x47')],{})[_0x6f99('0x26')](respondWithResult(_0x118e87,0xc9))[_0x6f99('0x43')](handleError(_0x118e87,null));};exports[_0x6f99('0x25')]=function(_0x20c80d,_0x2c6cd8){if(_0x20c80d[_0x6f99('0x47')]['id']){delete _0x20c80d[_0x6f99('0x47')]['id'];}return db[_0x6f99('0x2c')]['find']({'where':{'id':_0x20c80d[_0x6f99('0x48')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x2c6cd8,null))[_0x6f99('0x26')](saveUpdates(_0x20c80d[_0x6f99('0x47')],null))[_0x6f99('0x26')](respondWithResult(_0x2c6cd8,null))[_0x6f99('0x43')](handleError(_0x2c6cd8,null));};exports['destroy']=function(_0x321944,_0x2ee25e){return db['FaxQueueReport'][_0x6f99('0x45')]({'where':{'id':_0x321944[_0x6f99('0x48')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x2ee25e,null))[_0x6f99('0x26')](removeEntity(_0x2ee25e,null))[_0x6f99('0x43')](handleError(_0x2ee25e,null));};exports['describe']=function(_0x572aea,_0x3d82c4){return db['FaxQueueReport'][_0x6f99('0x49')]()[_0x6f99('0x26')](respondWithResult(_0x3d82c4,null))[_0x6f99('0x43')](handleError(_0x3d82c4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9f39dd4..663c2dc 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x303cf0,_0x57c61b){var _0x5b2a31=function(_0x98dce0){while(--_0x98dce0){_0x303cf0['push'](_0x303cf0['shift']());}};_0x5b2a31(++_0x57c61b);}(_0xf494,0x1c6));var _0x4f49=function(_0x491680,_0x3b8248){_0x491680=_0x491680-0x0;var _0x6e699=_0xf494[_0x491680];return _0x6e699;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x26bfd5,_0x7801fb){var _0xc8e3=function(_0x5c5998){while(--_0x5c5998){_0x26bfd5['push'](_0x26bfd5['shift']());}};_0xc8e3(++_0x7801fb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b64c842..fdef048 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 _0x7b96=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch','UpdateFaxQueueReport','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3a2fb8,_0x4b17ab){var _0x10fa41=function(_0x5dee97){while(--_0x5dee97){_0x3a2fb8['push'](_0x3a2fb8['shift']());}};_0x10fa41(++_0x4b17ab);}(_0x7b96,0x170));var _0x67b9=function(_0x35ce2b,_0x3b81fd){_0x35ce2b=_0x35ce2b-0x0;var _0x39e935=_0x7b96[_0x35ce2b];return _0x39e935;};'use strict';var _=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var moment=require(_0x67b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67b9('0x3'));var db=require(_0x67b9('0x4'))['db'];var utils=require(_0x67b9('0x5'));var logger=require(_0x67b9('0x6'))(_0x67b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x67b9('0x8'));var client=jayson[_0x67b9('0x9')][_0x67b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10fa97,_0x185a0a,_0x54e649){return new BPromise(function(_0x21aedf,_0x2910ab){return client[_0x67b9('0xb')](_0x10fa97,_0x54e649)['then'](function(_0x5a9e86){logger[_0x67b9('0xc')](_0x67b9('0xd'),_0x185a0a,_0x67b9('0xe'));logger[_0x67b9('0xf')](_0x67b9('0x10'),_0x185a0a,'request\x20sent',JSON[_0x67b9('0x11')](_0x5a9e86));if(_0x5a9e86[_0x67b9('0x12')]){if(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x13')]===0x1f4){logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x5a9e86[_0x67b9('0x12')]['message']);return _0x2910ab(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);}logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);return _0x21aedf(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);}else{logger[_0x67b9('0xc')](_0x67b9('0xd'),_0x185a0a,_0x67b9('0xe'));_0x21aedf(_0x5a9e86[_0x67b9('0x15')][_0x67b9('0x14')]);}})['catch'](function(_0x14c8b5){logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x14c8b5);_0x2910ab(_0x14c8b5);});});}exports[_0x67b9('0x16')]=function(_0x4b7e5e){var _0x332587=this;return new Promise(function(_0x29aff3,_0x177d06){return db[_0x67b9('0x17')][_0x67b9('0x18')](_0x4b7e5e[_0x67b9('0x19')],{'raw':_0x4b7e5e[_0x67b9('0x1a')]?_0x4b7e5e[_0x67b9('0x1a')][_0x67b9('0x1b')]===undefined?!![]:![]:!![]})[_0x67b9('0x1c')](function(_0x4d23e6){logger[_0x67b9('0xc')](_0x67b9('0x16'),_0x4b7e5e);logger[_0x67b9('0xf')]('CreateFaxQueueReport',_0x4b7e5e,JSON[_0x67b9('0x11')](_0x4d23e6));_0x29aff3(_0x4d23e6);})[_0x67b9('0x1d')](function(_0x3bc353){logger[_0x67b9('0x12')](_0x67b9('0x16'),_0x3bc353['message'],_0x4b7e5e);_0x177d06(_0x332587['error'](0x1f4,_0x3bc353['message']));});});};exports[_0x67b9('0x1e')]=function(_0x1fca83){var _0x250a48=this;return new Promise(function(_0x4dee13,_0x19f4ff){return db[_0x67b9('0x17')]['update'](_0x1fca83['body'],{'raw':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')][_0x67b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')]['where']||null:null,'attributes':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83['options'][_0x67b9('0x1f')]||null:null,'limit':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')]['limit']||null:null})[_0x67b9('0x1c')](function(_0x59f100){logger[_0x67b9('0xc')]('UpdateFaxQueueReport',_0x1fca83);logger[_0x67b9('0xf')](_0x67b9('0x1e'),_0x1fca83,JSON[_0x67b9('0x11')](_0x59f100));_0x4dee13(_0x59f100);})['catch'](function(_0x365f5d){logger['error']('UpdateFaxQueueReport',_0x365f5d[_0x67b9('0x14')],_0x1fca83);_0x19f4ff(_0x250a48[_0x67b9('0x12')](0x1f4,_0x365f5d[_0x67b9('0x14')]));});});}; \ No newline at end of file +var _0xccf6=['update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../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','UpdateFaxQueueReport','FaxQueueReport'];(function(_0x124b12,_0x50a849){var _0x4ba566=function(_0x4a778a){while(--_0x4a778a){_0x124b12['push'](_0x124b12['shift']());}};_0x4ba566(++_0x50a849);}(_0xccf6,0x19e));var _0x6ccf=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xccf6[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x6ccf('0x0'));var util=require(_0x6ccf('0x1'));var moment=require(_0x6ccf('0x2'));var BPromise=require(_0x6ccf('0x3'));var rs=require(_0x6ccf('0x4'));var fs=require('fs');var Redis=require(_0x6ccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ccf('0x6'));var logger=require(_0x6ccf('0x7'))(_0x6ccf('0x8'));var config=require(_0x6ccf('0x9'));var jayson=require(_0x6ccf('0xa'));var client=jayson[_0x6ccf('0xb')][_0x6ccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29f0e3,_0x3a5188,_0x5680c5){return new BPromise(function(_0x54437b,_0x3831bb){return client[_0x6ccf('0xd')](_0x29f0e3,_0x5680c5)[_0x6ccf('0xe')](function(_0x4aaa29){logger[_0x6ccf('0xf')](_0x6ccf('0x10'),_0x3a5188,_0x6ccf('0x11'));logger[_0x6ccf('0x12')](_0x6ccf('0x13'),_0x3a5188,_0x6ccf('0x11'),JSON[_0x6ccf('0x14')](_0x4aaa29));if(_0x4aaa29[_0x6ccf('0x15')]){if(_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x16')]===0x1f4){logger[_0x6ccf('0x15')](_0x6ccf('0x10'),_0x3a5188,_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);return _0x3831bb(_0x4aaa29[_0x6ccf('0x15')]['message']);}logger[_0x6ccf('0x15')](_0x6ccf('0x10'),_0x3a5188,_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);return _0x54437b(_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);}else{logger['info'](_0x6ccf('0x10'),_0x3a5188,_0x6ccf('0x11'));_0x54437b(_0x4aaa29[_0x6ccf('0x18')][_0x6ccf('0x17')]);}})[_0x6ccf('0x19')](function(_0xe39454){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3a5188,_0xe39454);_0x3831bb(_0xe39454);});});}exports[_0x6ccf('0x1a')]=function(_0x54bed0){var _0xfa7a05=this;return new Promise(function(_0x59cf08,_0xd1bf5f){return db['FaxQueueReport'][_0x6ccf('0x1b')](_0x54bed0['body'],{'raw':_0x54bed0['options']?_0x54bed0['options']['raw']===undefined?!![]:![]:!![]})[_0x6ccf('0xe')](function(_0x299ba0){logger[_0x6ccf('0xf')](_0x6ccf('0x1a'),_0x54bed0);logger[_0x6ccf('0x12')](_0x6ccf('0x1a'),_0x54bed0,JSON[_0x6ccf('0x14')](_0x299ba0));_0x59cf08(_0x299ba0);})['catch'](function(_0x24b9f3){logger[_0x6ccf('0x15')](_0x6ccf('0x1a'),_0x24b9f3['message'],_0x54bed0);_0xd1bf5f(_0xfa7a05[_0x6ccf('0x15')](0x1f4,_0x24b9f3['message']));});});};exports[_0x6ccf('0x1c')]=function(_0x1985b2){var _0x3a9553=this;return new Promise(function(_0x323d0b,_0x53b4b0){return db[_0x6ccf('0x1d')][_0x6ccf('0x1e')](_0x1985b2[_0x6ccf('0x1f')],{'raw':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2['options'][_0x6ccf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2['options'][_0x6ccf('0x22')]||null:null,'attributes':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2[_0x6ccf('0x20')][_0x6ccf('0x23')]||null:null,'limit':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2[_0x6ccf('0x20')][_0x6ccf('0x24')]||null:null})['then'](function(_0x5553e8){logger[_0x6ccf('0xf')]('UpdateFaxQueueReport',_0x1985b2);logger['debug'](_0x6ccf('0x1c'),_0x1985b2,JSON['stringify'](_0x5553e8));_0x323d0b(_0x5553e8);})['catch'](function(_0x347298){logger[_0x6ccf('0x15')](_0x6ccf('0x1c'),_0x347298[_0x6ccf('0x17')],_0x1985b2);_0x53b4b0(_0x3a9553[_0x6ccf('0x15')](0x1f4,_0x347298[_0x6ccf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3ac1071..137c3c0 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 _0xd61a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x569942,_0x591910){var _0x2c491c=function(_0x9f2b6e){while(--_0x9f2b6e){_0x569942['push'](_0x569942['shift']());}};_0x2c491c(++_0x591910);}(_0xd61a,0x90));var _0xad61=function(_0x549a09,_0x2fe584){_0x549a09=_0x549a09-0x0;var _0x3ef978=_0xd61a[_0x549a09];return _0x3ef978;};'use strict';var multer=require('multer');var util=require(_0xad61('0x0'));var path=require(_0xad61('0x1'));var timeout=require(_0xad61('0x2'));var express=require(_0xad61('0x3'));var router=express[_0xad61('0x4')]();var fs_extra=require(_0xad61('0x5'));var auth=require(_0xad61('0x6'));var interaction=require(_0xad61('0x7'));var config=require(_0xad61('0x8'));var controller=require(_0xad61('0x9'));router[_0xad61('0xa')]('/',auth[_0xad61('0xb')](),controller[_0xad61('0xc')]);router[_0xad61('0xa')](_0xad61('0xd'),auth[_0xad61('0xb')](),controller[_0xad61('0xe')]);router['get'](_0xad61('0xf'),auth[_0xad61('0xb')](),controller['show']);router[_0xad61('0x10')]('/',auth[_0xad61('0xb')](),controller[_0xad61('0x11')]);router['put'](_0xad61('0xf'),auth[_0xad61('0xb')](),controller[_0xad61('0x12')]);router['delete'](_0xad61('0xf'),auth['isAuthenticated'](),controller[_0xad61('0x13')]);module[_0xad61('0x14')]=router; \ No newline at end of file +var _0x7dcd=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x40fdc6,_0x2b2b60){var _0x59c30c=function(_0x5404e0){while(--_0x5404e0){_0x40fdc6['push'](_0x40fdc6['shift']());}};_0x59c30c(++_0x2b2b60);}(_0x7dcd,0x143));var _0xd7dc=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x7dcd[_0x300b26];return _0x5cb1ae;};'use strict';var multer=require(_0xd7dc('0x0'));var util=require(_0xd7dc('0x1'));var path=require(_0xd7dc('0x2'));var timeout=require(_0xd7dc('0x3'));var express=require(_0xd7dc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd7dc('0x5'));var interaction=require(_0xd7dc('0x6'));var config=require(_0xd7dc('0x7'));var controller=require('./faxQueueReport.controller');router[_0xd7dc('0x8')]('/',auth[_0xd7dc('0x9')](),controller['index']);router[_0xd7dc('0x8')](_0xd7dc('0xa'),auth[_0xd7dc('0x9')](),controller[_0xd7dc('0xb')]);router['get'](_0xd7dc('0xc'),auth[_0xd7dc('0x9')](),controller[_0xd7dc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd7dc('0xe')]);router[_0xd7dc('0xf')](_0xd7dc('0xc'),auth[_0xd7dc('0x9')](),controller['update']);router[_0xd7dc('0x10')](_0xd7dc('0xc'),auth['isAuthenticated'](),controller[_0xd7dc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3225eea..e0729b6 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4a787c,_0x129bdb){var _0xf4aff6=function(_0x338500){while(--_0x338500){_0x4a787c['push'](_0x4a787c['shift']());}};_0xf4aff6(++_0x129bdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x41e0b0,_0x3c454f){var _0x48f801=function(_0x560535){while(--_0x560535){_0x41e0b0['push'](_0x41e0b0['shift']());}};_0x48f801(++_0x3c454f);}(_0x70e0,0x17b));var _0x070e=function(_0x14b71f,_0x2a51ee){_0x14b71f=_0x14b71f-0x0;var _0x569e51=_0x70e0[_0x14b71f];return _0x569e51;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4c379e8..5128164 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 _0xfab7=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','type','key','map','query','filters','attributes','model','fields'];(function(_0x240f64,_0xf518e1){var _0x75d513=function(_0x2b3257){while(--_0x2b3257){_0x240f64['push'](_0x240f64['shift']());}};_0x75d513(++_0xf518e1);}(_0xfab7,0x1c1));var _0x7fab=function(_0x528d8d,_0x3d64ff){_0x528d8d=_0x528d8d-0x0;var _0x35c2f8=_0xfab7[_0x528d8d];return _0x35c2f8;};'use strict';var emlformat=require(_0x7fab('0x0'));var rimraf=require(_0x7fab('0x1'));var zipdir=require(_0x7fab('0x2'));var jsonpatch=require(_0x7fab('0x3'));var rp=require(_0x7fab('0x4'));var moment=require(_0x7fab('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7fab('0x6'));var csv=require(_0x7fab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fab('0x8'));var squel=require(_0x7fab('0x9'));var crypto=require(_0x7fab('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7fab('0xb'));var toCsv=require(_0x7fab('0x7'));var querystring=require(_0x7fab('0xc'));var Papa=require(_0x7fab('0xd'));var Redis=require(_0x7fab('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7fab('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fab('0x10'))(_0x7fab('0x11'));var utils=require(_0x7fab('0x12'));var config=require(_0x7fab('0x13'));var licenseUtil=require(_0x7fab('0x14'));var db=require(_0x7fab('0x15'))['db'];function respondWithStatusCode(_0x170e5a,_0x2caba3){_0x2caba3=_0x2caba3||0xcc;return function(_0x2383b1){if(_0x2383b1){return _0x170e5a['sendStatus'](_0x2caba3);}return _0x170e5a[_0x7fab('0x16')](_0x2caba3)[_0x7fab('0x17')]();};}function respondWithResult(_0x5e5043,_0x50460e){_0x50460e=_0x50460e||0xc8;return function(_0x28ac98){if(_0x28ac98){return _0x5e5043[_0x7fab('0x16')](_0x50460e)[_0x7fab('0x18')](_0x28ac98);}};}function respondWithFilteredResult(_0x5a2bb7,_0x35d035){return function(_0x8c68c9){if(_0x8c68c9){var _0x55249c=typeof _0x35d035[_0x7fab('0x19')]===_0x7fab('0x1a')&&typeof _0x35d035[_0x7fab('0x1b')]===_0x7fab('0x1a');var _0x20ba30=_0x8c68c9['count'];var _0x137a6b=_0x55249c?0x0:_0x35d035['offset'];var _0x5ec741=_0x55249c?_0x8c68c9[_0x7fab('0x1c')]:_0x35d035[_0x7fab('0x19')]+_0x35d035[_0x7fab('0x1b')];var _0x116e97;if(_0x5ec741>=_0x20ba30){_0x5ec741=_0x20ba30;_0x116e97=0xc8;}else{_0x116e97=0xce;}_0x5a2bb7[_0x7fab('0x16')](_0x116e97);return _0x5a2bb7['set']('Content-Range',_0x137a6b+'-'+_0x5ec741+'/'+_0x20ba30)[_0x7fab('0x18')](_0x8c68c9);}return null;};}function patchUpdates(_0x4f0303){return function(_0x1706da){try{jsonpatch[_0x7fab('0x1d')](_0x1706da,_0x4f0303,!![]);}catch(_0x2fb93d){return BPromise['reject'](_0x2fb93d);}return _0x1706da[_0x7fab('0x1e')]();};}function saveUpdates(_0x47e3b5,_0x823965){return function(_0x204dd2){if(_0x204dd2){return _0x204dd2[_0x7fab('0x1f')](_0x47e3b5)[_0x7fab('0x20')](function(_0x595c6f){return _0x595c6f;});}return null;};}function removeEntity(_0x3920dc,_0x3494c5){return function(_0x38260b){if(_0x38260b){return _0x38260b[_0x7fab('0x21')]()[_0x7fab('0x20')](function(){_0x3920dc[_0x7fab('0x16')](0xcc)[_0x7fab('0x17')]();});}};}function handleEntityNotFound(_0x205f4f,_0x2208ea){return function(_0x4efba5){if(!_0x4efba5){_0x205f4f['sendStatus'](0x194);}return _0x4efba5;};}function handleError(_0x1cd3c9,_0x53d297){_0x53d297=_0x53d297||0x1f4;return function(_0x1e96e8){logger[_0x7fab('0x22')](_0x1e96e8[_0x7fab('0x23')]);if(_0x1e96e8[_0x7fab('0x24')]){delete _0x1e96e8[_0x7fab('0x24')];}_0x1cd3c9[_0x7fab('0x16')](_0x53d297)[_0x7fab('0x25')](_0x1e96e8);};}exports['index']=function(_0x32f0e1,_0x15b695){var _0x3ad6bf={},_0x52b740={},_0x2bf053={'count':0x0,'rows':[]};var _0x373d97=_['map'](db[_0x7fab('0x26')][_0x7fab('0x27')],function(_0x5685d9){return{'name':_0x5685d9['fieldName'],'type':_0x5685d9[_0x7fab('0x28')][_0x7fab('0x29')]};});_0x52b740['model']=_[_0x7fab('0x2a')](_0x373d97,_0x7fab('0x24'));_0x52b740[_0x7fab('0x2b')]=_['keys'](_0x32f0e1['query']);_0x52b740[_0x7fab('0x2c')]=_['intersection'](_0x52b740['model'],_0x52b740['query']);_0x3ad6bf[_0x7fab('0x2d')]=_['intersection'](_0x52b740[_0x7fab('0x2e')],qs[_0x7fab('0x2f')](_0x32f0e1['query'][_0x7fab('0x2f')]));_0x3ad6bf[_0x7fab('0x2d')]=_0x3ad6bf[_0x7fab('0x2d')][_0x7fab('0x30')]?_0x3ad6bf[_0x7fab('0x2d')]:_0x52b740[_0x7fab('0x2e')];if(!_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x31')](_0x7fab('0x32'))){_0x3ad6bf[_0x7fab('0x1b')]=qs[_0x7fab('0x1b')](_0x32f0e1[_0x7fab('0x2b')]['limit']);_0x3ad6bf[_0x7fab('0x19')]=qs['offset'](_0x32f0e1['query'][_0x7fab('0x19')]);}_0x3ad6bf[_0x7fab('0x33')]=qs[_0x7fab('0x34')](_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x34')]);_0x3ad6bf[_0x7fab('0x35')]=qs[_0x7fab('0x2c')](_[_0x7fab('0x36')](_0x32f0e1[_0x7fab('0x2b')],_0x52b740[_0x7fab('0x2c')]),_0x373d97);if(_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x37')]){_0x3ad6bf[_0x7fab('0x35')]=_[_0x7fab('0x38')](_0x3ad6bf[_0x7fab('0x35')],{'$or':_[_0x7fab('0x2a')](_0x373d97,function(_0x2eaa70){if(_0x2eaa70['type']!==_0x7fab('0x39')){var _0x399fe1={};_0x399fe1[_0x2eaa70['name']]={'$like':'%'+_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x37')]+'%'};return _0x399fe1;}})});}_0x3ad6bf=_[_0x7fab('0x38')]({},_0x3ad6bf,_0x32f0e1[_0x7fab('0x3a')]);var _0x3c5351={'where':_0x3ad6bf[_0x7fab('0x35')]};return db[_0x7fab('0x26')]['count'](_0x3c5351)[_0x7fab('0x20')](function(_0x332890){_0x2bf053['count']=_0x332890;if(_0x32f0e1['query'][_0x7fab('0x3b')]){_0x3ad6bf[_0x7fab('0x3c')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x3ad6bf);})[_0x7fab('0x20')](function(_0x1b37f3){_0x2bf053[_0x7fab('0x3d')]=_0x1b37f3;return _0x2bf053;})[_0x7fab('0x20')](respondWithFilteredResult(_0x15b695,_0x3ad6bf))[_0x7fab('0x3e')](handleError(_0x15b695,null));};exports[_0x7fab('0x3f')]=function(_0x5753fd,_0x374812){var _0x3f29ae={'raw':!![],'where':{'id':_0x5753fd[_0x7fab('0x40')]['id']}},_0x536739={};_0x536739[_0x7fab('0x2e')]=_['keys'](db['FaxTransferReport'][_0x7fab('0x27')]);_0x536739[_0x7fab('0x2b')]=_[_0x7fab('0x41')](_0x5753fd['query']);_0x536739[_0x7fab('0x2c')]=_[_0x7fab('0x42')](_0x536739[_0x7fab('0x2e')],_0x536739['query']);_0x3f29ae[_0x7fab('0x2d')]=_[_0x7fab('0x42')](_0x536739['model'],qs['fields'](_0x5753fd[_0x7fab('0x2b')][_0x7fab('0x2f')]));_0x3f29ae[_0x7fab('0x2d')]=_0x3f29ae[_0x7fab('0x2d')][_0x7fab('0x30')]?_0x3f29ae[_0x7fab('0x2d')]:_0x536739[_0x7fab('0x2e')];if(_0x5753fd['query']['includeAll']){_0x3f29ae[_0x7fab('0x3c')]=[{'all':!![]}];}_0x3f29ae=_[_0x7fab('0x38')]({},_0x3f29ae,_0x5753fd[_0x7fab('0x3a')]);return db[_0x7fab('0x26')][_0x7fab('0x43')](_0x3f29ae)['then'](handleEntityNotFound(_0x374812,null))[_0x7fab('0x20')](respondWithResult(_0x374812,null))[_0x7fab('0x3e')](handleError(_0x374812,null));};exports[_0x7fab('0x44')]=function(_0x58d769,_0x33ab28){return db[_0x7fab('0x26')][_0x7fab('0x44')](_0x58d769[_0x7fab('0x45')],{})['then'](respondWithResult(_0x33ab28,0xc9))[_0x7fab('0x3e')](handleError(_0x33ab28,null));};exports['update']=function(_0x4a7539,_0x4590a8){if(_0x4a7539[_0x7fab('0x45')]['id']){delete _0x4a7539[_0x7fab('0x45')]['id'];}return db[_0x7fab('0x26')][_0x7fab('0x43')]({'where':{'id':_0x4a7539[_0x7fab('0x40')]['id']}})[_0x7fab('0x20')](handleEntityNotFound(_0x4590a8,null))[_0x7fab('0x20')](saveUpdates(_0x4a7539[_0x7fab('0x45')],null))['then'](respondWithResult(_0x4590a8,null))[_0x7fab('0x3e')](handleError(_0x4590a8,null));};exports[_0x7fab('0x21')]=function(_0x476d9f,_0x2dc90c){return db['FaxTransferReport'][_0x7fab('0x43')]({'where':{'id':_0x476d9f['params']['id']}})['then'](handleEntityNotFound(_0x2dc90c,null))[_0x7fab('0x20')](removeEntity(_0x2dc90c,null))[_0x7fab('0x3e')](handleError(_0x2dc90c,null));};exports[_0x7fab('0x46')]=function(_0x522252,_0x34153b){return db['FaxTransferReport'][_0x7fab('0x46')]()['then'](respondWithResult(_0x34153b,null))['catch'](handleError(_0x34153b,null));}; \ No newline at end of file +var _0x23d2=['VIRTUAL','filter','then','include','findAll','catch','show','params','includeAll','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','status','end','json','offset','limit','count','set','reject','save','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x23d2,0x13a));var _0x223d=function(_0x15939a,_0x51d592){_0x15939a=_0x15939a-0x0;var _0x22f7ba=_0x23d2[_0x15939a];return _0x22f7ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x223d('0x0'));var zipdir=require(_0x223d('0x1'));var jsonpatch=require(_0x223d('0x2'));var rp=require(_0x223d('0x3'));var moment=require(_0x223d('0x4'));var BPromise=require(_0x223d('0x5'));var Mustache=require(_0x223d('0x6'));var util=require(_0x223d('0x7'));var path=require(_0x223d('0x8'));var sox=require('sox');var csv=require(_0x223d('0x9'));var ejs=require(_0x223d('0xa'));var fs=require('fs');var fs_extra=require(_0x223d('0xb'));var _=require('lodash');var squel=require(_0x223d('0xc'));var crypto=require(_0x223d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x223d('0xe'));var toCsv=require(_0x223d('0x9'));var querystring=require('querystring');var Papa=require(_0x223d('0xf'));var Redis=require('ioredis');var authService=require(_0x223d('0x10'));var qs=require(_0x223d('0x11'));var as=require(_0x223d('0x12'));var hardwareService=require(_0x223d('0x13'));var logger=require(_0x223d('0x14'))(_0x223d('0x15'));var utils=require(_0x223d('0x16'));var config=require(_0x223d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x223d('0x18'))['db'];function respondWithStatusCode(_0x523aa2,_0x27c484){_0x27c484=_0x27c484||0xcc;return function(_0x1af9eb){if(_0x1af9eb){return _0x523aa2['sendStatus'](_0x27c484);}return _0x523aa2[_0x223d('0x19')](_0x27c484)[_0x223d('0x1a')]();};}function respondWithResult(_0xf9ccef,_0x2d0a97){_0x2d0a97=_0x2d0a97||0xc8;return function(_0x1e0dbb){if(_0x1e0dbb){return _0xf9ccef[_0x223d('0x19')](_0x2d0a97)[_0x223d('0x1b')](_0x1e0dbb);}};}function respondWithFilteredResult(_0x104f0a,_0x43c58d){return function(_0x33b212){if(_0x33b212){var _0x5c8eaa=typeof _0x43c58d[_0x223d('0x1c')]==='undefined'&&typeof _0x43c58d[_0x223d('0x1d')]==='undefined';var _0xeb1a28=_0x33b212['count'];var _0xe6a3f8=_0x5c8eaa?0x0:_0x43c58d[_0x223d('0x1c')];var _0xe65ef3=_0x5c8eaa?_0x33b212[_0x223d('0x1e')]:_0x43c58d['offset']+_0x43c58d[_0x223d('0x1d')];var _0x44caf3;if(_0xe65ef3>=_0xeb1a28){_0xe65ef3=_0xeb1a28;_0x44caf3=0xc8;}else{_0x44caf3=0xce;}_0x104f0a['status'](_0x44caf3);return _0x104f0a[_0x223d('0x1f')]('Content-Range',_0xe6a3f8+'-'+_0xe65ef3+'/'+_0xeb1a28)[_0x223d('0x1b')](_0x33b212);}return null;};}function patchUpdates(_0x466bc3){return function(_0x2a05a3){try{jsonpatch['apply'](_0x2a05a3,_0x466bc3,!![]);}catch(_0x2ff22f){return BPromise[_0x223d('0x20')](_0x2ff22f);}return _0x2a05a3[_0x223d('0x21')]();};}function saveUpdates(_0x59e071,_0x466620){return function(_0x431f07){if(_0x431f07){return _0x431f07['update'](_0x59e071)['then'](function(_0x4b7058){return _0x4b7058;});}return null;};}function removeEntity(_0x453a1b,_0x2bcbd1){return function(_0x4c5376){if(_0x4c5376){return _0x4c5376[_0x223d('0x22')]()['then'](function(){_0x453a1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d374,_0x45f66f){return function(_0x2558f3){if(!_0x2558f3){_0x55d374[_0x223d('0x23')](0x194);}return _0x2558f3;};}function handleError(_0x8c9c86,_0x1e1cf2){_0x1e1cf2=_0x1e1cf2||0x1f4;return function(_0x22dc31){logger['error'](_0x22dc31[_0x223d('0x24')]);if(_0x22dc31[_0x223d('0x25')]){delete _0x22dc31[_0x223d('0x25')];}_0x8c9c86[_0x223d('0x19')](_0x1e1cf2)[_0x223d('0x26')](_0x22dc31);};}exports[_0x223d('0x27')]=function(_0x14a964,_0x46852c){var _0x53e983={},_0x35d099={},_0x2d3ea5={'count':0x0,'rows':[]};var _0xaee4b6=_[_0x223d('0x28')](db[_0x223d('0x29')][_0x223d('0x2a')],function(_0x5cab3f){return{'name':_0x5cab3f[_0x223d('0x2b')],'type':_0x5cab3f[_0x223d('0x2c')][_0x223d('0x2d')]};});_0x35d099[_0x223d('0x2e')]=_['map'](_0xaee4b6,_0x223d('0x25'));_0x35d099[_0x223d('0x2f')]=_[_0x223d('0x30')](_0x14a964[_0x223d('0x2f')]);_0x35d099[_0x223d('0x31')]=_[_0x223d('0x32')](_0x35d099[_0x223d('0x2e')],_0x35d099[_0x223d('0x2f')]);_0x53e983[_0x223d('0x33')]=_[_0x223d('0x32')](_0x35d099['model'],qs[_0x223d('0x34')](_0x14a964[_0x223d('0x2f')]['fields']));_0x53e983[_0x223d('0x33')]=_0x53e983[_0x223d('0x33')][_0x223d('0x35')]?_0x53e983['attributes']:_0x35d099['model'];if(!_0x14a964[_0x223d('0x2f')][_0x223d('0x36')](_0x223d('0x37'))){_0x53e983['limit']=qs[_0x223d('0x1d')](_0x14a964['query'][_0x223d('0x1d')]);_0x53e983['offset']=qs[_0x223d('0x1c')](_0x14a964[_0x223d('0x2f')][_0x223d('0x1c')]);}_0x53e983[_0x223d('0x38')]=qs['sort'](_0x14a964[_0x223d('0x2f')][_0x223d('0x39')]);_0x53e983[_0x223d('0x3a')]=qs[_0x223d('0x31')](_[_0x223d('0x3b')](_0x14a964[_0x223d('0x2f')],_0x35d099['filters']),_0xaee4b6);if(_0x14a964['query']['filter']){_0x53e983[_0x223d('0x3a')]=_[_0x223d('0x3c')](_0x53e983['where'],{'$or':_['map'](_0xaee4b6,function(_0x4ece24){if(_0x4ece24['type']!==_0x223d('0x3d')){var _0x198258={};_0x198258[_0x4ece24[_0x223d('0x25')]]={'$like':'%'+_0x14a964[_0x223d('0x2f')][_0x223d('0x3e')]+'%'};return _0x198258;}})});}_0x53e983=_[_0x223d('0x3c')]({},_0x53e983,_0x14a964['options']);var _0x3cfe9d={'where':_0x53e983[_0x223d('0x3a')]};return db['FaxTransferReport'][_0x223d('0x1e')](_0x3cfe9d)[_0x223d('0x3f')](function(_0x33394d){_0x2d3ea5[_0x223d('0x1e')]=_0x33394d;if(_0x14a964['query']['includeAll']){_0x53e983[_0x223d('0x40')]=[{'all':!![]}];}return db[_0x223d('0x29')][_0x223d('0x41')](_0x53e983);})[_0x223d('0x3f')](function(_0x24f638){_0x2d3ea5['rows']=_0x24f638;return _0x2d3ea5;})[_0x223d('0x3f')](respondWithFilteredResult(_0x46852c,_0x53e983))[_0x223d('0x42')](handleError(_0x46852c,null));};exports[_0x223d('0x43')]=function(_0x48fb39,_0x58b5d7){var _0x2eb8be={'raw':!![],'where':{'id':_0x48fb39[_0x223d('0x44')]['id']}},_0x396ab4={};_0x396ab4[_0x223d('0x2e')]=_[_0x223d('0x30')](db[_0x223d('0x29')][_0x223d('0x2a')]);_0x396ab4[_0x223d('0x2f')]=_[_0x223d('0x30')](_0x48fb39[_0x223d('0x2f')]);_0x396ab4['filters']=_[_0x223d('0x32')](_0x396ab4[_0x223d('0x2e')],_0x396ab4['query']);_0x2eb8be[_0x223d('0x33')]=_[_0x223d('0x32')](_0x396ab4['model'],qs[_0x223d('0x34')](_0x48fb39[_0x223d('0x2f')][_0x223d('0x34')]));_0x2eb8be[_0x223d('0x33')]=_0x2eb8be[_0x223d('0x33')][_0x223d('0x35')]?_0x2eb8be[_0x223d('0x33')]:_0x396ab4[_0x223d('0x2e')];if(_0x48fb39[_0x223d('0x2f')][_0x223d('0x45')]){_0x2eb8be[_0x223d('0x40')]=[{'all':!![]}];}_0x2eb8be=_[_0x223d('0x3c')]({},_0x2eb8be,_0x48fb39['options']);return db['FaxTransferReport'][_0x223d('0x46')](_0x2eb8be)[_0x223d('0x3f')](handleEntityNotFound(_0x58b5d7,null))[_0x223d('0x3f')](respondWithResult(_0x58b5d7,null))[_0x223d('0x42')](handleError(_0x58b5d7,null));};exports['create']=function(_0x58b702,_0x48641f){return db['FaxTransferReport'][_0x223d('0x47')](_0x58b702[_0x223d('0x48')],{})['then'](respondWithResult(_0x48641f,0xc9))[_0x223d('0x42')](handleError(_0x48641f,null));};exports[_0x223d('0x49')]=function(_0x5141ae,_0x2215ea){if(_0x5141ae['body']['id']){delete _0x5141ae['body']['id'];}return db[_0x223d('0x29')][_0x223d('0x46')]({'where':{'id':_0x5141ae[_0x223d('0x44')]['id']}})[_0x223d('0x3f')](handleEntityNotFound(_0x2215ea,null))[_0x223d('0x3f')](saveUpdates(_0x5141ae[_0x223d('0x48')],null))['then'](respondWithResult(_0x2215ea,null))[_0x223d('0x42')](handleError(_0x2215ea,null));};exports[_0x223d('0x22')]=function(_0x55b4e3,_0x5512ac){return db[_0x223d('0x29')]['find']({'where':{'id':_0x55b4e3[_0x223d('0x44')]['id']}})[_0x223d('0x3f')](handleEntityNotFound(_0x5512ac,null))[_0x223d('0x3f')](removeEntity(_0x5512ac,null))[_0x223d('0x42')](handleError(_0x5512ac,null));};exports[_0x223d('0x4a')]=function(_0x507c63,_0xdd9698){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0xdd9698,null))[_0x223d('0x42')](handleError(_0xdd9698,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a22341f..063e5b0 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 _0x0608=['api','moment','path','rimraf','../../config/environment','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x4934b5,_0x12110e){var _0x308a9e=function(_0x2933cc){while(--_0x2933cc){_0x4934b5['push'](_0x4934b5['shift']());}};_0x308a9e(++_0x12110e);}(_0x0608,0x1d6));var _0x8060=function(_0x4689f9,_0x210b35){_0x4689f9=_0x4689f9-0x0;var _0x4baade=_0x0608[_0x4689f9];return _0x4baade;};'use strict';var _=require(_0x8060('0x0'));var util=require(_0x8060('0x1'));var logger=require(_0x8060('0x2'))(_0x8060('0x3'));var moment=require(_0x8060('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8060('0x5'));var rimraf=require(_0x8060('0x6'));var config=require(_0x8060('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x449870,_0x2fe793){return _0x449870[_0x8060('0x8')](_0x8060('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x8060('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x63f4=['../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x401f9d,_0x72b876){var _0x42ed00=function(_0x2ddf0d){while(--_0x2ddf0d){_0x401f9d['push'](_0x401f9d['shift']());}};_0x42ed00(++_0x72b876);}(_0x63f4,0xcb));var _0x463f=function(_0x4ef673,_0x223308){_0x4ef673=_0x4ef673-0x0;var _0x3574d7=_0x63f4[_0x4ef673];return _0x3574d7;};'use strict';var _=require(_0x463f('0x0'));var util=require(_0x463f('0x1'));var logger=require(_0x463f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x463f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x463f('0x4'));var rimraf=require(_0x463f('0x5'));var config=require(_0x463f('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x5703d4,_0x4f468e){return _0x5703d4[_0x463f('0x7')](_0x463f('0x8'),attributes,{'tableName':_0x463f('0x9'),'paranoid':![],'indexes':[{'name':_0x463f('0xa'),'fields':[_0x463f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 189bf1a..2b9c512 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 _0xe9c0=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe9c0,0x172));var _0x0e9c=function(_0x3ffb34,_0x969b13){_0x3ffb34=_0x3ffb34-0x0;var _0x57e2f1=_0xe9c0[_0x3ffb34];return _0x57e2f1;};'use strict';var _=require(_0x0e9c('0x0'));var util=require('util');var moment=require(_0x0e9c('0x1'));var BPromise=require(_0x0e9c('0x2'));var rs=require(_0x0e9c('0x3'));var fs=require('fs');var Redis=require(_0x0e9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e9c('0x5'));var logger=require('../../config/logger')(_0x0e9c('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e9c('0x7'));var client=jayson[_0x0e9c('0x8')][_0x0e9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36a04c,_0x40fe7c,_0x453c2c){return new BPromise(function(_0x1c2311,_0x5149b2){return client[_0x0e9c('0xa')](_0x36a04c,_0x453c2c)[_0x0e9c('0xb')](function(_0xf4cc3f){logger[_0x0e9c('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0x0e9c('0xd'));logger['debug'](_0x0e9c('0xe'),_0x40fe7c,'request\x20sent',JSON[_0x0e9c('0xf')](_0xf4cc3f));if(_0xf4cc3f[_0x0e9c('0x10')]){if(_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x11')]===0x1f4){logger[_0x0e9c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);return _0x5149b2(_0xf4cc3f[_0x0e9c('0x10')]['message']);}logger[_0x0e9c('0x10')](_0x0e9c('0x13'),_0x40fe7c,_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);return _0x1c2311(_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);}else{logger[_0x0e9c('0xc')](_0x0e9c('0x13'),_0x40fe7c,_0x0e9c('0xd'));_0x1c2311(_0xf4cc3f[_0x0e9c('0x14')][_0x0e9c('0x12')]);}})[_0x0e9c('0x15')](function(_0x559a6b){logger[_0x0e9c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0x559a6b);_0x5149b2(_0x559a6b);});});} \ No newline at end of file +var _0x8582=['rpc','../../config/environment','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11503f,_0x30de86){var _0x34caab=function(_0x16e6a6){while(--_0x16e6a6){_0x11503f['push'](_0x11503f['shift']());}};_0x34caab(++_0x30de86);}(_0x8582,0x149));var _0x2858=function(_0x4b71ff,_0x5a1802){_0x4b71ff=_0x4b71ff-0x0;var _0x3791bc=_0x8582[_0x4b71ff];return _0x3791bc;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var moment=require(_0x2858('0x2'));var BPromise=require('bluebird');var rs=require(_0x2858('0x3'));var fs=require('fs');var Redis=require(_0x2858('0x4'));var db=require(_0x2858('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2858('0x6'))(_0x2858('0x7'));var config=require(_0x2858('0x8'));var jayson=require(_0x2858('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1797fc,_0xd83c25,_0x5a5d21){return new BPromise(function(_0x2bde02,_0x372553){return client[_0x2858('0xa')](_0x1797fc,_0x5a5d21)[_0x2858('0xb')](function(_0x494f1b){logger[_0x2858('0xc')](_0x2858('0xd'),_0xd83c25,_0x2858('0xe'));logger['debug'](_0x2858('0xf'),_0xd83c25,'request\x20sent',JSON[_0x2858('0x10')](_0x494f1b));if(_0x494f1b[_0x2858('0x11')]){if(_0x494f1b[_0x2858('0x11')]['code']===0x1f4){logger['error'](_0x2858('0xd'),_0xd83c25,_0x494f1b['error']['message']);return _0x372553(_0x494f1b[_0x2858('0x11')][_0x2858('0x12')]);}logger[_0x2858('0x11')](_0x2858('0xd'),_0xd83c25,_0x494f1b['error']['message']);return _0x2bde02(_0x494f1b[_0x2858('0x11')][_0x2858('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xd83c25,_0x2858('0xe'));_0x2bde02(_0x494f1b[_0x2858('0x13')]['message']);}})[_0x2858('0x14')](function(_0x7f516d){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xd83c25,_0x7f516d);_0x372553(_0x7f516d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c9c5c42..206ce71 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 _0xef15=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xef15,0xbe));var _0x5ef1=function(_0x30b094,_0x555417){_0x30b094=_0x30b094-0x0;var _0x4337f3=_0xef15[_0x30b094];return _0x4337f3;};'use strict';var multer=require(_0x5ef1('0x0'));var util=require('util');var path=require(_0x5ef1('0x1'));var timeout=require(_0x5ef1('0x2'));var express=require(_0x5ef1('0x3'));var router=express[_0x5ef1('0x4')]();var fs_extra=require(_0x5ef1('0x5'));var auth=require(_0x5ef1('0x6'));var interaction=require(_0x5ef1('0x7'));var config=require(_0x5ef1('0x8'));var controller=require(_0x5ef1('0x9'));router[_0x5ef1('0xa')]('/',auth[_0x5ef1('0xb')](),controller[_0x5ef1('0xc')]);router[_0x5ef1('0xa')](_0x5ef1('0xd'),auth[_0x5ef1('0xb')](),controller[_0x5ef1('0xe')]);router[_0x5ef1('0xa')](_0x5ef1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x5ef1('0x10')]('/',auth[_0x5ef1('0xb')](),controller[_0x5ef1('0x11')]);router[_0x5ef1('0x12')](_0x5ef1('0xf'),auth[_0x5ef1('0xb')](),controller['update']);router[_0x5ef1('0x13')](_0x5ef1('0xf'),auth[_0x5ef1('0xb')](),controller[_0x5ef1('0x14')]);module[_0x5ef1('0x15')]=router; \ No newline at end of file +var _0x537f=['isAuthenticated','/describe','/:id','show','post','put','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x114c38,_0x2c6970){var _0x53e6bb=function(_0x2e1c37){while(--_0x2e1c37){_0x114c38['push'](_0x114c38['shift']());}};_0x53e6bb(++_0x2c6970);}(_0x537f,0x1db));var _0xf537=function(_0x414491,_0x14f4e9){_0x414491=_0x414491-0x0;var _0x5cda0d=_0x537f[_0x414491];return _0x5cda0d;};'use strict';var multer=require('multer');var util=require(_0xf537('0x0'));var path=require(_0xf537('0x1'));var timeout=require(_0xf537('0x2'));var express=require(_0xf537('0x3'));var router=express[_0xf537('0x4')]();var fs_extra=require(_0xf537('0x5'));var auth=require(_0xf537('0x6'));var interaction=require(_0xf537('0x7'));var config=require(_0xf537('0x8'));var controller=require(_0xf537('0x9'));router[_0xf537('0xa')]('/',auth[_0xf537('0xb')](),controller['index']);router['get'](_0xf537('0xc'),auth[_0xf537('0xb')](),controller['describe']);router[_0xf537('0xa')](_0xf537('0xd'),auth['isAuthenticated'](),controller[_0xf537('0xe')]);router[_0xf537('0xf')]('/',auth[_0xf537('0xb')](),controller['create']);router[_0xf537('0x10')](_0xf537('0xd'),auth[_0xf537('0xb')](),controller['update']);router['delete']('/:id',auth[_0xf537('0xb')](),controller['destroy']);module[_0xf537('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 4258f2f..1ccbd8f 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 _0xe5ca=['create','addConfiguration','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5ca,0xcf));var _0xae5c=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xe5ca[_0x17928f];return _0x500b63;};'use strict';var multer=require('multer');var util=require(_0xae5c('0x0'));var path=require(_0xae5c('0x1'));var timeout=require(_0xae5c('0x2'));var express=require(_0xae5c('0x3'));var router=express[_0xae5c('0x4')]();var fs_extra=require(_0xae5c('0x5'));var auth=require(_0xae5c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae5c('0x7'));var controller=require(_0xae5c('0x8'));router[_0xae5c('0x9')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xb')]);router[_0xae5c('0x9')]('/:id',auth[_0xae5c('0xa')](),controller[_0xae5c('0xc')]);router[_0xae5c('0x9')](_0xae5c('0xd'),auth[_0xae5c('0xa')](),controller[_0xae5c('0xe')]);router[_0xae5c('0x9')](_0xae5c('0xf'),auth[_0xae5c('0xa')](),controller[_0xae5c('0x10')]);router[_0xae5c('0x11')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0x12')]);router[_0xae5c('0x11')]('/:id/configurations',auth[_0xae5c('0xa')](),controller[_0xae5c('0x13')]);router[_0xae5c('0x14')](_0xae5c('0x15'),auth[_0xae5c('0xa')](),controller[_0xae5c('0x16')]);router[_0xae5c('0x17')](_0xae5c('0x15'),auth[_0xae5c('0xa')](),controller['destroy']);module[_0xae5c('0x18')]=router; \ No newline at end of file +var _0x33d4=['/:id/configurations','getConfigurations','/:id/fields','post','put','update','/:id','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show'];(function(_0xa56f49,_0x2056fc){var _0x5eba32=function(_0xc1e00a){while(--_0xc1e00a){_0xa56f49['push'](_0xa56f49['shift']());}};_0x5eba32(++_0x2056fc);}(_0x33d4,0x120));var _0x433d=function(_0x1f1908,_0x4ef383){_0x1f1908=_0x1f1908-0x0;var _0x9ff033=_0x33d4[_0x1f1908];return _0x9ff033;};'use strict';var multer=require('multer');var util=require(_0x433d('0x0'));var path=require(_0x433d('0x1'));var timeout=require(_0x433d('0x2'));var express=require('express');var router=express[_0x433d('0x3')]();var fs_extra=require(_0x433d('0x4'));var auth=require(_0x433d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x433d('0x6'));var controller=require(_0x433d('0x7'));router[_0x433d('0x8')]('/',auth[_0x433d('0x9')](),controller[_0x433d('0xa')]);router[_0x433d('0x8')]('/:id',auth[_0x433d('0x9')](),controller[_0x433d('0xb')]);router[_0x433d('0x8')](_0x433d('0xc'),auth[_0x433d('0x9')](),controller[_0x433d('0xd')]);router[_0x433d('0x8')](_0x433d('0xe'),auth[_0x433d('0x9')](),controller['getFields']);router[_0x433d('0xf')]('/',auth[_0x433d('0x9')](),controller['create']);router[_0x433d('0xf')](_0x433d('0xc'),auth[_0x433d('0x9')](),controller['addConfiguration']);router[_0x433d('0x10')]('/:id',auth[_0x433d('0x9')](),controller[_0x433d('0x11')]);router['delete'](_0x433d('0x12'),auth[_0x433d('0x9')](),controller[_0x433d('0x13')]);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 331035d..1cf7c2e 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 _0x4cf7=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cf7,0x12e));var _0x74cf=function(_0x16b3b9,_0x2cf9cb){_0x16b3b9=_0x16b3b9-0x0;var _0x1b4337=_0x4cf7[_0x16b3b9];return _0x1b4337;};'use strict';var Sequelize=require(_0x74cf('0x0'));module[_0x74cf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x74cf('0x2')]},'username':{'type':Sequelize[_0x74cf('0x2')]},'remoteUri':{'type':Sequelize[_0x74cf('0x2')]},'authType':{'type':Sequelize[_0x74cf('0x3')](_0x74cf('0x4')),'defaultValue':_0x74cf('0x4')},'password':{'type':Sequelize[_0x74cf('0x2')]},'consumerKey':{'type':Sequelize[_0x74cf('0x2')]},'consumerSecret':{'type':Sequelize[_0x74cf('0x2')]},'token':{'type':Sequelize[_0x74cf('0x2')]},'tokenSecret':{'type':Sequelize[_0x74cf('0x2')]},'serverUrl':{'type':Sequelize[_0x74cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x74cf('0x3')](_0x74cf('0x5'),_0x74cf('0x6')),'defaultValue':_0x74cf('0x5')}}; \ No newline at end of file +var _0xfd01=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x26a984,_0x5cfec4){var _0x4254e9=function(_0xb1502f){while(--_0xb1502f){_0x26a984['push'](_0x26a984['shift']());}};_0x4254e9(++_0x5cfec4);}(_0xfd01,0x196));var _0x1fd0=function(_0x192a34,_0x4ab66d){_0x192a34=_0x192a34-0x0;var _0x19ed42=_0xfd01[_0x192a34];return _0x19ed42;};'use strict';var Sequelize=require(_0x1fd0('0x0'));module[_0x1fd0('0x1')]={'name':{'type':Sequelize[_0x1fd0('0x2')]},'description':{'type':Sequelize[_0x1fd0('0x2')]},'username':{'type':Sequelize[_0x1fd0('0x2')]},'remoteUri':{'type':Sequelize[_0x1fd0('0x2')]},'authType':{'type':Sequelize[_0x1fd0('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x1fd0('0x2')]},'token':{'type':Sequelize[_0x1fd0('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1fd0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1fd0('0x3')](_0x1fd0('0x4'),_0x1fd0('0x5')),'defaultValue':_0x1fd0('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index ebb21e3..bdd8b21 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 _0x3c46=['getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','entries','active','statusCode','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','save','destroy','then','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','find','create','body','update','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions'];(function(_0x1b8310,_0x241270){var _0x11a850=function(_0x3576b1){while(--_0x3576b1){_0x1b8310['push'](_0x1b8310['shift']());}};_0x11a850(++_0x241270);}(_0x3c46,0x8a));var _0x63c4=function(_0x2aec85,_0x59c8b6){_0x2aec85=_0x2aec85-0x0;var _0x1214ce=_0x3c46[_0x2aec85];return _0x1214ce;};'use strict';var emlformat=require(_0x63c4('0x0'));var rimraf=require(_0x63c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x63c4('0x2'));var Mustache=require(_0x63c4('0x3'));var util=require(_0x63c4('0x4'));var path=require(_0x63c4('0x5'));var sox=require(_0x63c4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63c4('0x7'));var _=require(_0x63c4('0x8'));var squel=require(_0x63c4('0x9'));var crypto=require('crypto');var jsforce=require(_0x63c4('0xa'));var deskjs=require(_0x63c4('0xb'));var toCsv=require(_0x63c4('0xc'));var querystring=require(_0x63c4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63c4('0xe'));var as=require(_0x63c4('0xf'));var hardwareService=require(_0x63c4('0x10'));var logger=require('../../config/logger')(_0x63c4('0x11'));var utils=require(_0x63c4('0x12'));var config=require(_0x63c4('0x13'));var licenseUtil=require(_0x63c4('0x14'));var db=require(_0x63c4('0x15'))['db'];var integrations=require(_0x63c4('0x16'));function respondWithStatusCode(_0x11c467,_0x2450b1){_0x2450b1=_0x2450b1||0xcc;return function(_0x19372c){if(_0x19372c){return _0x11c467[_0x63c4('0x17')](_0x2450b1);}return _0x11c467['status'](_0x2450b1)[_0x63c4('0x18')]();};}function respondWithResult(_0x4024fc,_0x5a9aa9){_0x5a9aa9=_0x5a9aa9||0xc8;return function(_0x2988f3){if(_0x2988f3){return _0x4024fc[_0x63c4('0x19')](_0x5a9aa9)[_0x63c4('0x1a')](_0x2988f3);}};}function respondWithFilteredResult(_0x4d3c3e,_0x1cfed7){return function(_0xac9a08){if(_0xac9a08){var _0x241825=typeof _0x1cfed7['offset']===_0x63c4('0x1b')&&typeof _0x1cfed7['limit']===_0x63c4('0x1b');var _0x17a3cd=_0xac9a08[_0x63c4('0x1c')];var _0x8ecbe0=_0x241825?0x0:_0x1cfed7[_0x63c4('0x1d')];var _0xba3534=_0x241825?_0xac9a08[_0x63c4('0x1c')]:_0x1cfed7[_0x63c4('0x1d')]+_0x1cfed7[_0x63c4('0x1e')];var _0x4c45ec;if(_0xba3534>=_0x17a3cd){_0xba3534=_0x17a3cd;_0x4c45ec=0xc8;}else{_0x4c45ec=0xce;}_0x4d3c3e[_0x63c4('0x19')](_0x4c45ec);return _0x4d3c3e[_0x63c4('0x1f')]('Content-Range',_0x8ecbe0+'-'+_0xba3534+'/'+_0x17a3cd)[_0x63c4('0x1a')](_0xac9a08);}return null;};}function patchUpdates(_0x30a5ae){return function(_0x4fdc1b){try{jsonpatch['apply'](_0x4fdc1b,_0x30a5ae,!![]);}catch(_0x4efd37){return BPromise[_0x63c4('0x20')](_0x4efd37);}return _0x4fdc1b[_0x63c4('0x21')]();};}function saveUpdates(_0xfe7a4f,_0x56f529){return function(_0x5293cd){if(_0x5293cd){return _0x5293cd['update'](_0xfe7a4f)['then'](function(_0x26462b){return _0x26462b;});}return null;};}function removeEntity(_0x3beb4e,_0x4f56cd){return function(_0x58685c){if(_0x58685c){return _0x58685c[_0x63c4('0x22')]()[_0x63c4('0x23')](function(){_0x3beb4e[_0x63c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597ec7,_0x2d0089){return function(_0x5ca229){if(!_0x5ca229){_0x597ec7[_0x63c4('0x17')](0x194);}return _0x5ca229;};}function handleError(_0x1b5215,_0x5cbd83){_0x5cbd83=_0x5cbd83||0x1f4;return function(_0x45e65b){logger[_0x63c4('0x24')](_0x45e65b[_0x63c4('0x25')]);if(_0x45e65b[_0x63c4('0x26')]){delete _0x45e65b['name'];}_0x1b5215[_0x63c4('0x19')](_0x5cbd83)['send'](_0x45e65b);};}exports[_0x63c4('0x27')]=function(_0x41c4c1,_0x5f07bf){var _0x19b4a7={},_0x5102ff={},_0x3b465e={'count':0x0,'rows':[]};var _0x23be11=_[_0x63c4('0x28')](db[_0x63c4('0x29')][_0x63c4('0x2a')],function(_0x5f1515){return{'name':_0x5f1515[_0x63c4('0x2b')],'type':_0x5f1515[_0x63c4('0x2c')]['key']};});_0x5102ff[_0x63c4('0x2d')]=_[_0x63c4('0x28')](_0x23be11,_0x63c4('0x26'));_0x5102ff[_0x63c4('0x2e')]=_[_0x63c4('0x2f')](_0x41c4c1[_0x63c4('0x2e')]);_0x5102ff['filters']=_['intersection'](_0x5102ff[_0x63c4('0x2d')],_0x5102ff[_0x63c4('0x2e')]);_0x19b4a7[_0x63c4('0x30')]=_['intersection'](_0x5102ff[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x41c4c1['query']['fields']));_0x19b4a7['attributes']=_0x19b4a7[_0x63c4('0x30')][_0x63c4('0x32')]?_0x19b4a7[_0x63c4('0x30')]:_0x5102ff[_0x63c4('0x2d')];if(!_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x33')](_0x63c4('0x34'))){_0x19b4a7[_0x63c4('0x1e')]=qs['limit'](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x1e')]);_0x19b4a7[_0x63c4('0x1d')]=qs[_0x63c4('0x1d')](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x1d')]);}_0x19b4a7[_0x63c4('0x35')]=qs[_0x63c4('0x36')](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x36')]);_0x19b4a7['where']=qs['filters'](_[_0x63c4('0x37')](_0x41c4c1[_0x63c4('0x2e')],_0x5102ff[_0x63c4('0x38')]),_0x23be11);if(_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x39')]){_0x19b4a7[_0x63c4('0x3a')]=_[_0x63c4('0x3b')](_0x19b4a7[_0x63c4('0x3a')],{'$or':_[_0x63c4('0x28')](_0x23be11,function(_0x567f40){if(_0x567f40['type']!==_0x63c4('0x3c')){var _0x85e11d={};_0x85e11d[_0x567f40[_0x63c4('0x26')]]={'$like':'%'+_0x41c4c1[_0x63c4('0x2e')]['filter']+'%'};return _0x85e11d;}})});}_0x19b4a7=_[_0x63c4('0x3b')]({},_0x19b4a7,_0x41c4c1[_0x63c4('0x3d')]);var _0x275fdc={'where':_0x19b4a7[_0x63c4('0x3a')]};return db['DeskAccount']['count'](_0x275fdc)[_0x63c4('0x23')](function(_0x47c92e){_0x3b465e['count']=_0x47c92e;if(_0x41c4c1['query']['includeAll']){_0x19b4a7[_0x63c4('0x3e')]=[{'all':!![]}];}return db[_0x63c4('0x29')][_0x63c4('0x3f')](_0x19b4a7);})[_0x63c4('0x23')](function(_0x77faa6){_0x3b465e['rows']=_0x77faa6;return _0x3b465e;})[_0x63c4('0x23')](respondWithFilteredResult(_0x5f07bf,_0x19b4a7))[_0x63c4('0x40')](handleError(_0x5f07bf,null));};exports[_0x63c4('0x41')]=function(_0x149fa4,_0x4b2f02){var _0x4a8628={'raw':![],'where':{'id':_0x149fa4[_0x63c4('0x42')]['id']}},_0x4ed312={};_0x4ed312[_0x63c4('0x2d')]=_['keys'](db['DeskAccount']['rawAttributes']);_0x4ed312['query']=_[_0x63c4('0x2f')](_0x149fa4[_0x63c4('0x2e')]);_0x4ed312['filters']=_['intersection'](_0x4ed312['model'],_0x4ed312['query']);_0x4a8628['attributes']=_[_0x63c4('0x43')](_0x4ed312[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x149fa4[_0x63c4('0x2e')]['fields']));_0x4a8628[_0x63c4('0x30')]=_0x4a8628[_0x63c4('0x30')][_0x63c4('0x32')]?_0x4a8628[_0x63c4('0x30')]:_0x4ed312[_0x63c4('0x2d')];if(_0x149fa4[_0x63c4('0x2e')]['includeAll']){_0x4a8628[_0x63c4('0x3e')]=[{'all':!![]}];}_0x4a8628=_[_0x63c4('0x3b')]({},_0x4a8628,_0x149fa4[_0x63c4('0x3d')]);return db[_0x63c4('0x29')][_0x63c4('0x44')](_0x4a8628)['then'](handleEntityNotFound(_0x4b2f02,null))['then'](respondWithResult(_0x4b2f02,null))['catch'](handleError(_0x4b2f02,null));};exports[_0x63c4('0x45')]=function(_0x586b65,_0x1354e6){return db[_0x63c4('0x29')][_0x63c4('0x45')](_0x586b65[_0x63c4('0x46')],{})[_0x63c4('0x23')](respondWithResult(_0x1354e6,0xc9))[_0x63c4('0x40')](handleError(_0x1354e6,null));};exports[_0x63c4('0x47')]=function(_0x15acb6,_0x5df2e7){if(_0x15acb6['body']['id']){delete _0x15acb6[_0x63c4('0x46')]['id'];}return db['DeskAccount'][_0x63c4('0x44')]({'where':{'id':_0x15acb6[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x5df2e7,null))[_0x63c4('0x23')](saveUpdates(_0x15acb6['body'],null))[_0x63c4('0x23')](respondWithResult(_0x5df2e7,null))[_0x63c4('0x40')](handleError(_0x5df2e7,null));};exports[_0x63c4('0x22')]=function(_0x266838,_0xbab834){return db[_0x63c4('0x29')]['find']({'where':{'id':_0x266838['params']['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0xbab834,null))['then'](removeEntity(_0xbab834,null))[_0x63c4('0x40')](handleError(_0xbab834,null));};exports['getConfigurations']=function(_0x2c7376,_0x2852c5,_0x5464b5){var _0x4d7cd2={};var _0x26df32={};var _0x40d149;var _0x308e22;return db[_0x63c4('0x29')][_0x63c4('0x48')]({'where':{'id':_0x2c7376[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x2852c5,null))['then'](function(_0x132b3){if(_0x132b3){_0x40d149=_0x132b3;_0x26df32[_0x63c4('0x2d')]=_[_0x63c4('0x2f')](db[_0x63c4('0x49')][_0x63c4('0x2a')]);_0x26df32[_0x63c4('0x2e')]=_[_0x63c4('0x2f')](_0x2c7376[_0x63c4('0x2e')]);_0x26df32[_0x63c4('0x38')]=_[_0x63c4('0x43')](_0x26df32['model'],_0x26df32[_0x63c4('0x2e')]);_0x4d7cd2[_0x63c4('0x30')]=_[_0x63c4('0x43')](_0x26df32[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x2c7376['query'][_0x63c4('0x31')]));_0x4d7cd2[_0x63c4('0x30')]=_0x4d7cd2[_0x63c4('0x30')]['length']?_0x4d7cd2['attributes']:_0x26df32[_0x63c4('0x2d')];_0x4d7cd2[_0x63c4('0x35')]=qs[_0x63c4('0x36')](_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x36')]);_0x4d7cd2[_0x63c4('0x3a')]=qs[_0x63c4('0x38')](_[_0x63c4('0x37')](_0x2c7376[_0x63c4('0x2e')],_0x26df32['filters']));if(_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x39')]){_0x4d7cd2[_0x63c4('0x3a')]=_[_0x63c4('0x3b')](_0x4d7cd2[_0x63c4('0x3a')],{'$or':_[_0x63c4('0x28')](_0x4d7cd2[_0x63c4('0x30')],function(_0x2ca56f){var _0x515301={};_0x515301[_0x2ca56f]={'$like':'%'+_0x2c7376[_0x63c4('0x2e')]['filter']+'%'};return _0x515301;})});}_0x4d7cd2=_[_0x63c4('0x3b')]({},_0x4d7cd2,_0x2c7376[_0x63c4('0x3d')]);return _0x40d149[_0x63c4('0x4a')](_0x4d7cd2);}})[_0x63c4('0x23')](function(_0x2c413a){if(_0x2c413a){_0x308e22=_0x2c413a[_0x63c4('0x32')];if(!_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x33')](_0x63c4('0x34'))){_0x4d7cd2['limit']=qs[_0x63c4('0x1e')](_0x2c7376['query'][_0x63c4('0x1e')]);_0x4d7cd2[_0x63c4('0x1d')]=qs['offset'](_0x2c7376['query'][_0x63c4('0x1d')]);}return _0x40d149[_0x63c4('0x4a')](_0x4d7cd2);}})[_0x63c4('0x23')](function(_0x183e66){if(_0x183e66){return _0x183e66?{'count':_0x308e22,'rows':_0x183e66}:null;}})['then'](respondWithResult(_0x2852c5,null))[_0x63c4('0x40')](handleError(_0x2852c5,null));};exports[_0x63c4('0x4b')]=function(_0x33f466,_0x942b93,_0x15e52a){if(_0x33f466[_0x63c4('0x46')]['id']){delete _0x33f466[_0x63c4('0x46')]['id'];}return db[_0x63c4('0x29')][_0x63c4('0x48')]({'where':{'id':_0x33f466[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x942b93,null))['then'](function(_0x2ecc98){if(_0x2ecc98){_0x33f466[_0x63c4('0x46')]['AccountId']=_0x2ecc98['id'];_0x33f466[_0x63c4('0x46')][_0x63c4('0x4c')]=integrations[_0x63c4('0x4d')](_0x33f466['body'][_0x63c4('0x4e')],_0x33f466[_0x63c4('0x46')]['type']);_0x33f466[_0x63c4('0x46')][_0x63c4('0x4f')]=integrations[_0x63c4('0x50')](_0x33f466[_0x63c4('0x46')]['channel'],_0x33f466[_0x63c4('0x46')][_0x63c4('0x2c')]);return db['DeskConfiguration']['create'](_0x33f466['body'],{'include':[{'model':db[_0x63c4('0x51')],'as':_0x63c4('0x4c')},{'model':db[_0x63c4('0x51')],'as':'Descriptions'}]});}return null;})[_0x63c4('0x23')](respondWithResult(_0x942b93,null))[_0x63c4('0x40')](handleError(_0x942b93,null));};exports[_0x63c4('0x52')]=function(_0x471a0c,_0x15e012,_0x2122a2){var _0xbad155=[{'name':_0x63c4('0x53'),'label':_0x63c4('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4277e7='';return db['DeskAccount'][_0x63c4('0x48')]({'where':{'id':_0x471a0c['params']['id']},'attributes':['id',_0x63c4('0x54'),_0x63c4('0x55'),_0x63c4('0x56'),_0x63c4('0x57'),_0x63c4('0x58'),'consumerSecret',_0x63c4('0x59'),_0x63c4('0x5a')]})[_0x63c4('0x23')](handleEntityNotFound(_0x15e012,null))[_0x63c4('0x23')](function(_0x571d61){if(_0x571d61){_0x4277e7=_0x571d61['remoteUri'];var _0x10470b=_0x4277e7['slice'](-0x1);if(_0x10470b==='/'){_0x4277e7=_0x4277e7[_0x63c4('0x5b')](0x0,_0x4277e7[_0x63c4('0x5c')](_0x10470b));}var _0x34f7aa={'method':_0x63c4('0x5d'),'uri':util[_0x63c4('0x5e')](_0x63c4('0x5f'),_0x4277e7),'headers':{'Content-Type':_0x63c4('0x60'),'Accept':'application/json'},'json':!![]};if(_0x571d61['authType']==='basic'){_0x34f7aa[_0x63c4('0x61')][_0x63c4('0x62')]=util[_0x63c4('0x5e')](_0x63c4('0x63'),new Buffer(util[_0x63c4('0x5e')](_0x63c4('0x64'),_0x571d61[_0x63c4('0x56')],_0x571d61[_0x63c4('0x57')]))[_0x63c4('0x65')]('base64'));}return rp(_0x34f7aa)[_0x63c4('0x23')](function(_0x34b021){return _0xbad155['concat'](_[_0x63c4('0x28')](_0x34b021['_embedded'][_0x63c4('0x66')],function(_0x24c044){return{'id':_0x24c044[_0x63c4('0x26')],'name':_0x24c044[_0x63c4('0x26')],'type':_0x24c044[_0x63c4('0x2c')],'active':_0x24c044[_0x63c4('0x67')],'label':_0x24c044['label'],'custom':!![]};}));});}})[_0x63c4('0x23')](function(_0x15c48c){return{'count':_0x15c48c[_0x63c4('0x32')],'rows':_0x15c48c};})[_0x63c4('0x23')](respondWithResult(_0x15e012,null))[_0x63c4('0x40')](function(_0x72e7d4){var _0x8d3c90=_0x471a0c[_0x63c4('0x2e')]['test']?0x1f4:_0x72e7d4[_0x63c4('0x68')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x8d3c90,JSON[_0x63c4('0x69')](_0x72e7d4));delete _0x72e7d4[_0x63c4('0x26')];if(_0x8d3c90===0x191){_0x8d3c90=0x190;}_0x15e012[_0x63c4('0x19')](_0x8d3c90)[_0x63c4('0x6a')](_0x471a0c[_0x63c4('0x2e')][_0x63c4('0x6b')]?{'message':_0x63c4('0x6c'),'statusCode':_0x72e7d4[_0x63c4('0x68')]}:_0x72e7d4);});}; \ No newline at end of file +var _0x7c67=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','type','VIRTUAL','DeskAccount','include','rows','catch','show','includeAll','merge','options','find','create','update','body','params','getConfigurations','DeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e1434,_0x4950e6){var _0x57b6ae=function(_0x9ea757){while(--_0x9ea757){_0x1e1434['push'](_0x1e1434['shift']());}};_0x57b6ae(++_0x4950e6);}(_0x7c67,0x1b2));var _0x77c6=function(_0x57f622,_0x3fee36){_0x57f622=_0x57f622-0x0;var _0x348911=_0x7c67[_0x57f622];return _0x348911;};'use strict';var emlformat=require(_0x77c6('0x0'));var rimraf=require(_0x77c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77c6('0x2'));var BPromise=require(_0x77c6('0x3'));var Mustache=require(_0x77c6('0x4'));var util=require(_0x77c6('0x5'));var path=require(_0x77c6('0x6'));var sox=require(_0x77c6('0x7'));var csv=require('to-csv');var ejs=require(_0x77c6('0x8'));var fs=require('fs');var fs_extra=require(_0x77c6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x77c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x77c6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x77c6('0xc'));var Papa=require(_0x77c6('0xd'));var Redis=require(_0x77c6('0xe'));var authService=require(_0x77c6('0xf'));var qs=require(_0x77c6('0x10'));var as=require(_0x77c6('0x11'));var hardwareService=require(_0x77c6('0x12'));var logger=require(_0x77c6('0x13'))(_0x77c6('0x14'));var utils=require(_0x77c6('0x15'));var config=require(_0x77c6('0x16'));var licenseUtil=require(_0x77c6('0x17'));var db=require(_0x77c6('0x18'))['db'];var integrations=require(_0x77c6('0x19'));function respondWithStatusCode(_0x39cf07,_0x20dc58){_0x20dc58=_0x20dc58||0xcc;return function(_0x20d992){if(_0x20d992){return _0x39cf07[_0x77c6('0x1a')](_0x20dc58);}return _0x39cf07[_0x77c6('0x1b')](_0x20dc58)['end']();};}function respondWithResult(_0x41d3f6,_0x445bda){_0x445bda=_0x445bda||0xc8;return function(_0x3b87c9){if(_0x3b87c9){return _0x41d3f6[_0x77c6('0x1b')](_0x445bda)[_0x77c6('0x1c')](_0x3b87c9);}};}function respondWithFilteredResult(_0x42a59d,_0x3bae5d){return function(_0x1713d4){if(_0x1713d4){var _0x5cbbb0=typeof _0x3bae5d[_0x77c6('0x1d')]===_0x77c6('0x1e')&&typeof _0x3bae5d[_0x77c6('0x1f')]===_0x77c6('0x1e');var _0x44b3ce=_0x1713d4[_0x77c6('0x20')];var _0x16e5ea=_0x5cbbb0?0x0:_0x3bae5d['offset'];var _0x548bcd=_0x5cbbb0?_0x1713d4[_0x77c6('0x20')]:_0x3bae5d['offset']+_0x3bae5d[_0x77c6('0x1f')];var _0x55d721;if(_0x548bcd>=_0x44b3ce){_0x548bcd=_0x44b3ce;_0x55d721=0xc8;}else{_0x55d721=0xce;}_0x42a59d['status'](_0x55d721);return _0x42a59d[_0x77c6('0x21')]('Content-Range',_0x16e5ea+'-'+_0x548bcd+'/'+_0x44b3ce)['json'](_0x1713d4);}return null;};}function patchUpdates(_0x36d5b4){return function(_0x21cc38){try{jsonpatch['apply'](_0x21cc38,_0x36d5b4,!![]);}catch(_0x3b108b){return BPromise[_0x77c6('0x22')](_0x3b108b);}return _0x21cc38[_0x77c6('0x23')]();};}function saveUpdates(_0xbb8dc5,_0x14d6da){return function(_0x30d179){if(_0x30d179){return _0x30d179['update'](_0xbb8dc5)[_0x77c6('0x24')](function(_0x30d604){return _0x30d604;});}return null;};}function removeEntity(_0x42c4c0,_0xc827d1){return function(_0x387621){if(_0x387621){return _0x387621[_0x77c6('0x25')]()[_0x77c6('0x24')](function(){_0x42c4c0['status'](0xcc)[_0x77c6('0x26')]();});}};}function handleEntityNotFound(_0x3bc254,_0x457439){return function(_0x12d930){if(!_0x12d930){_0x3bc254[_0x77c6('0x1a')](0x194);}return _0x12d930;};}function handleError(_0x40c642,_0x2959c4){_0x2959c4=_0x2959c4||0x1f4;return function(_0x468f55){logger[_0x77c6('0x27')](_0x468f55[_0x77c6('0x28')]);if(_0x468f55[_0x77c6('0x29')]){delete _0x468f55['name'];}_0x40c642[_0x77c6('0x1b')](_0x2959c4)['send'](_0x468f55);};}exports[_0x77c6('0x2a')]=function(_0x33416e,_0x523143){var _0x4317b6={},_0x59c84a={},_0x44a57b={'count':0x0,'rows':[]};var _0x17ed5d=_[_0x77c6('0x2b')](db['DeskAccount'][_0x77c6('0x2c')],function(_0x56d06a){return{'name':_0x56d06a[_0x77c6('0x2d')],'type':_0x56d06a['type'][_0x77c6('0x2e')]};});_0x59c84a[_0x77c6('0x2f')]=_['map'](_0x17ed5d,_0x77c6('0x29'));_0x59c84a[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0x33416e[_0x77c6('0x30')]);_0x59c84a[_0x77c6('0x32')]=_[_0x77c6('0x33')](_0x59c84a[_0x77c6('0x2f')],_0x59c84a['query']);_0x4317b6[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x59c84a[_0x77c6('0x2f')],qs[_0x77c6('0x35')](_0x33416e[_0x77c6('0x30')][_0x77c6('0x35')]));_0x4317b6[_0x77c6('0x34')]=_0x4317b6[_0x77c6('0x34')][_0x77c6('0x36')]?_0x4317b6[_0x77c6('0x34')]:_0x59c84a[_0x77c6('0x2f')];if(!_0x33416e['query']['hasOwnProperty']('nolimit')){_0x4317b6['limit']=qs['limit'](_0x33416e[_0x77c6('0x30')][_0x77c6('0x1f')]);_0x4317b6[_0x77c6('0x1d')]=qs[_0x77c6('0x1d')](_0x33416e[_0x77c6('0x30')][_0x77c6('0x1d')]);}_0x4317b6['order']=qs[_0x77c6('0x37')](_0x33416e[_0x77c6('0x30')]['sort']);_0x4317b6[_0x77c6('0x38')]=qs[_0x77c6('0x32')](_[_0x77c6('0x39')](_0x33416e[_0x77c6('0x30')],_0x59c84a[_0x77c6('0x32')]),_0x17ed5d);if(_0x33416e[_0x77c6('0x30')][_0x77c6('0x3a')]){_0x4317b6[_0x77c6('0x38')]=_['merge'](_0x4317b6[_0x77c6('0x38')],{'$or':_[_0x77c6('0x2b')](_0x17ed5d,function(_0x4a48ec){if(_0x4a48ec[_0x77c6('0x3b')]!==_0x77c6('0x3c')){var _0x371308={};_0x371308[_0x4a48ec[_0x77c6('0x29')]]={'$like':'%'+_0x33416e[_0x77c6('0x30')][_0x77c6('0x3a')]+'%'};return _0x371308;}})});}_0x4317b6=_['merge']({},_0x4317b6,_0x33416e['options']);var _0x4e4339={'where':_0x4317b6[_0x77c6('0x38')]};return db[_0x77c6('0x3d')][_0x77c6('0x20')](_0x4e4339)['then'](function(_0x5b25ca){_0x44a57b['count']=_0x5b25ca;if(_0x33416e[_0x77c6('0x30')]['includeAll']){_0x4317b6[_0x77c6('0x3e')]=[{'all':!![]}];}return db[_0x77c6('0x3d')]['findAll'](_0x4317b6);})['then'](function(_0x398be9){_0x44a57b[_0x77c6('0x3f')]=_0x398be9;return _0x44a57b;})['then'](respondWithFilteredResult(_0x523143,_0x4317b6))[_0x77c6('0x40')](handleError(_0x523143,null));};exports[_0x77c6('0x41')]=function(_0x31f00a,_0x3750a3){var _0x4cb6b2={'raw':![],'where':{'id':_0x31f00a['params']['id']}},_0x56a837={};_0x56a837[_0x77c6('0x2f')]=_[_0x77c6('0x31')](db[_0x77c6('0x3d')][_0x77c6('0x2c')]);_0x56a837[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0x31f00a[_0x77c6('0x30')]);_0x56a837['filters']=_[_0x77c6('0x33')](_0x56a837[_0x77c6('0x2f')],_0x56a837[_0x77c6('0x30')]);_0x4cb6b2[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x56a837[_0x77c6('0x2f')],qs[_0x77c6('0x35')](_0x31f00a[_0x77c6('0x30')][_0x77c6('0x35')]));_0x4cb6b2[_0x77c6('0x34')]=_0x4cb6b2[_0x77c6('0x34')][_0x77c6('0x36')]?_0x4cb6b2[_0x77c6('0x34')]:_0x56a837['model'];if(_0x31f00a[_0x77c6('0x30')][_0x77c6('0x42')]){_0x4cb6b2[_0x77c6('0x3e')]=[{'all':!![]}];}_0x4cb6b2=_[_0x77c6('0x43')]({},_0x4cb6b2,_0x31f00a[_0x77c6('0x44')]);return db[_0x77c6('0x3d')][_0x77c6('0x45')](_0x4cb6b2)[_0x77c6('0x24')](handleEntityNotFound(_0x3750a3,null))[_0x77c6('0x24')](respondWithResult(_0x3750a3,null))[_0x77c6('0x40')](handleError(_0x3750a3,null));};exports[_0x77c6('0x46')]=function(_0x7a571a,_0x25324b){return db[_0x77c6('0x3d')][_0x77c6('0x46')](_0x7a571a['body'],{})[_0x77c6('0x24')](respondWithResult(_0x25324b,0xc9))[_0x77c6('0x40')](handleError(_0x25324b,null));};exports[_0x77c6('0x47')]=function(_0x4c783a,_0xc191a9){if(_0x4c783a[_0x77c6('0x48')]['id']){delete _0x4c783a[_0x77c6('0x48')]['id'];}return db[_0x77c6('0x3d')][_0x77c6('0x45')]({'where':{'id':_0x4c783a['params']['id']}})[_0x77c6('0x24')](handleEntityNotFound(_0xc191a9,null))[_0x77c6('0x24')](saveUpdates(_0x4c783a['body'],null))[_0x77c6('0x24')](respondWithResult(_0xc191a9,null))[_0x77c6('0x40')](handleError(_0xc191a9,null));};exports['destroy']=function(_0x50a5bf,_0x82c8fb){return db[_0x77c6('0x3d')][_0x77c6('0x45')]({'where':{'id':_0x50a5bf[_0x77c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x82c8fb,null))[_0x77c6('0x24')](removeEntity(_0x82c8fb,null))[_0x77c6('0x40')](handleError(_0x82c8fb,null));};exports[_0x77c6('0x4a')]=function(_0xd9803f,_0x57e346,_0x266d3d){var _0x57d276={};var _0x836dc7={};var _0x4c8a6e;var _0x36a747;return db[_0x77c6('0x3d')]['findOne']({'where':{'id':_0xd9803f['params']['id']}})[_0x77c6('0x24')](handleEntityNotFound(_0x57e346,null))[_0x77c6('0x24')](function(_0x4c797f){if(_0x4c797f){_0x4c8a6e=_0x4c797f;_0x836dc7[_0x77c6('0x2f')]=_[_0x77c6('0x31')](db[_0x77c6('0x4b')]['rawAttributes']);_0x836dc7[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0xd9803f[_0x77c6('0x30')]);_0x836dc7[_0x77c6('0x32')]=_[_0x77c6('0x33')](_0x836dc7[_0x77c6('0x2f')],_0x836dc7[_0x77c6('0x30')]);_0x57d276[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x836dc7[_0x77c6('0x2f')],qs['fields'](_0xd9803f['query']['fields']));_0x57d276[_0x77c6('0x34')]=_0x57d276[_0x77c6('0x34')][_0x77c6('0x36')]?_0x57d276[_0x77c6('0x34')]:_0x836dc7[_0x77c6('0x2f')];_0x57d276[_0x77c6('0x4c')]=qs[_0x77c6('0x37')](_0xd9803f[_0x77c6('0x30')][_0x77c6('0x37')]);_0x57d276[_0x77c6('0x38')]=qs[_0x77c6('0x32')](_[_0x77c6('0x39')](_0xd9803f[_0x77c6('0x30')],_0x836dc7[_0x77c6('0x32')]));if(_0xd9803f[_0x77c6('0x30')][_0x77c6('0x3a')]){_0x57d276[_0x77c6('0x38')]=_[_0x77c6('0x43')](_0x57d276['where'],{'$or':_[_0x77c6('0x2b')](_0x57d276['attributes'],function(_0x28dc98){var _0x5c810c={};_0x5c810c[_0x28dc98]={'$like':'%'+_0xd9803f[_0x77c6('0x30')][_0x77c6('0x3a')]+'%'};return _0x5c810c;})});}_0x57d276=_['merge']({},_0x57d276,_0xd9803f['options']);return _0x4c8a6e[_0x77c6('0x4a')](_0x57d276);}})['then'](function(_0x3304ef){if(_0x3304ef){_0x36a747=_0x3304ef['length'];if(!_0xd9803f['query'][_0x77c6('0x4d')]('nolimit')){_0x57d276[_0x77c6('0x1f')]=qs[_0x77c6('0x1f')](_0xd9803f[_0x77c6('0x30')]['limit']);_0x57d276[_0x77c6('0x1d')]=qs[_0x77c6('0x1d')](_0xd9803f[_0x77c6('0x30')]['offset']);}return _0x4c8a6e[_0x77c6('0x4a')](_0x57d276);}})[_0x77c6('0x24')](function(_0x29982d){if(_0x29982d){return _0x29982d?{'count':_0x36a747,'rows':_0x29982d}:null;}})[_0x77c6('0x24')](respondWithResult(_0x57e346,null))['catch'](handleError(_0x57e346,null));};exports[_0x77c6('0x4e')]=function(_0x6939f4,_0x2e315e,_0x444124){if(_0x6939f4['body']['id']){delete _0x6939f4[_0x77c6('0x48')]['id'];}return db[_0x77c6('0x3d')]['findOne']({'where':{'id':_0x6939f4['params']['id']}})['then'](handleEntityNotFound(_0x2e315e,null))[_0x77c6('0x24')](function(_0x1a7703){if(_0x1a7703){_0x6939f4['body'][_0x77c6('0x4f')]=_0x1a7703['id'];_0x6939f4['body'][_0x77c6('0x50')]=integrations[_0x77c6('0x51')](_0x6939f4[_0x77c6('0x48')]['channel'],_0x6939f4[_0x77c6('0x48')]['type']);_0x6939f4[_0x77c6('0x48')][_0x77c6('0x52')]=integrations['getDescriptions'](_0x6939f4[_0x77c6('0x48')][_0x77c6('0x53')],_0x6939f4[_0x77c6('0x48')][_0x77c6('0x3b')]);return db[_0x77c6('0x4b')][_0x77c6('0x46')](_0x6939f4[_0x77c6('0x48')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x77c6('0x24')](respondWithResult(_0x2e315e,null))[_0x77c6('0x40')](handleError(_0x2e315e,null));};exports[_0x77c6('0x54')]=function(_0x3712bf,_0x206449,_0x37adba){var _0x49d89a=[{'name':_0x77c6('0x55'),'label':_0x77c6('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4d303c='';return db[_0x77c6('0x3d')][_0x77c6('0x56')]({'where':{'id':_0x3712bf[_0x77c6('0x49')]['id']},'attributes':['id',_0x77c6('0x57'),_0x77c6('0x58'),'username',_0x77c6('0x59'),_0x77c6('0x5a'),_0x77c6('0x5b'),_0x77c6('0x5c'),_0x77c6('0x5d')]})[_0x77c6('0x24')](handleEntityNotFound(_0x206449,null))['then'](function(_0xe85649){if(_0xe85649){_0x4d303c=_0xe85649[_0x77c6('0x57')];var _0x6e0d1f=_0x4d303c[_0x77c6('0x5e')](-0x1);if(_0x6e0d1f==='/'){_0x4d303c=_0x4d303c[_0x77c6('0x5f')](0x0,_0x4d303c['lastIndexOf'](_0x6e0d1f));}var _0xa3c828={'method':_0x77c6('0x60'),'uri':util[_0x77c6('0x61')](_0x77c6('0x62'),_0x4d303c),'headers':{'Content-Type':_0x77c6('0x63'),'Accept':_0x77c6('0x63')},'json':!![]};if(_0xe85649['authType']==='basic'){_0xa3c828[_0x77c6('0x64')][_0x77c6('0x65')]=util[_0x77c6('0x61')](_0x77c6('0x66'),new Buffer(util[_0x77c6('0x61')]('%s:%s',_0xe85649['username'],_0xe85649['password']))['toString'](_0x77c6('0x67')));}return rp(_0xa3c828)[_0x77c6('0x24')](function(_0x1ce68d){return _0x49d89a['concat'](_[_0x77c6('0x2b')](_0x1ce68d[_0x77c6('0x68')]['entries'],function(_0x56426c){return{'id':_0x56426c[_0x77c6('0x29')],'name':_0x56426c[_0x77c6('0x29')],'type':_0x56426c[_0x77c6('0x3b')],'active':_0x56426c[_0x77c6('0x69')],'label':_0x56426c[_0x77c6('0x6a')],'custom':!![]};}));});}})[_0x77c6('0x24')](function(_0x22b4cc){return{'count':_0x22b4cc[_0x77c6('0x36')],'rows':_0x22b4cc};})[_0x77c6('0x24')](respondWithResult(_0x206449,null))['catch'](function(_0x39c9c1){var _0x55ce68=_0x3712bf[_0x77c6('0x30')][_0x77c6('0x6b')]?0x1f4:_0x39c9c1[_0x77c6('0x6c')]||0x1f4;logger['error'](_0x77c6('0x6d'),'getFields',_0x55ce68,JSON[_0x77c6('0x6e')](_0x39c9c1));delete _0x39c9c1[_0x77c6('0x29')];if(_0x55ce68===0x191){_0x55ce68=0x190;}_0x206449['status'](_0x55ce68)[_0x77c6('0x6f')](_0x3712bf[_0x77c6('0x30')][_0x77c6('0x6b')]?{'message':_0x77c6('0x70'),'statusCode':_0x39c9c1[_0x77c6('0x6c')]}:_0x39c9c1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1a37859..f70e9cb 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 _0x0aa9=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x50cec9,_0x252ff5){var _0x3cabb9=function(_0x30a547){while(--_0x30a547){_0x50cec9['push'](_0x50cec9['shift']());}};_0x3cabb9(++_0x252ff5);}(_0x0aa9,0x1c1));var _0x90aa=function(_0x4e4ff2,_0x30c8e7){_0x4e4ff2=_0x4e4ff2-0x0;var _0x49a1c7=_0x0aa9[_0x4e4ff2];return _0x49a1c7;};'use strict';var _=require(_0x90aa('0x0'));var util=require(_0x90aa('0x1'));var logger=require(_0x90aa('0x2'))(_0x90aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90aa('0x4'));var fs=require('fs');var path=require(_0x90aa('0x5'));var rimraf=require(_0x90aa('0x6'));var config=require('../../config/environment');var attributes=require(_0x90aa('0x7'));var integrations=require(_0x90aa('0x8'));module[_0x90aa('0x9')]=function(_0x51bc1b,_0xad75dd){return _0x51bc1b['define'](_0x90aa('0xa'),attributes,{'tableName':_0x90aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8632=['request-promise','path','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x38d4ce,_0x2988dd){var _0x73330e=function(_0x32a14e){while(--_0x32a14e){_0x38d4ce['push'](_0x38d4ce['shift']());}};_0x73330e(++_0x2988dd);}(_0x8632,0x193));var _0x2863=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x8632[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x2863('0x0'));var util=require('util');var logger=require(_0x2863('0x1'))('api');var moment=require(_0x2863('0x2'));var BPromise=require(_0x2863('0x3'));var rp=require(_0x2863('0x4'));var fs=require('fs');var path=require(_0x2863('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2863('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x2863('0x7')]=function(_0x2b967d,_0x56133e){return _0x2b967d[_0x2863('0x8')](_0x2863('0x9'),attributes,{'tableName':_0x2863('0xa'),'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 7e569dc..457021b 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 _0x8645=['include','map','model','ShowDeskAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit'];(function(_0x3411a2,_0x37d6d7){var _0x3861f0=function(_0x42b182){while(--_0x42b182){_0x3411a2['push'](_0x3411a2['shift']());}};_0x3861f0(++_0x37d6d7);}(_0x8645,0x1e1));var _0x5864=function(_0x2c985c,_0x1e59db){_0x2c985c=_0x2c985c-0x0;var _0x3fb09a=_0x8645[_0x2c985c];return _0x3fb09a;};'use strict';var _=require(_0x5864('0x0'));var util=require('util');var moment=require(_0x5864('0x1'));var BPromise=require(_0x5864('0x2'));var rs=require(_0x5864('0x3'));var fs=require('fs');var Redis=require(_0x5864('0x4'));var db=require(_0x5864('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5864('0x6'));var config=require(_0x5864('0x7'));var jayson=require(_0x5864('0x8'));var client=jayson[_0x5864('0x9')][_0x5864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ab013,_0x408e06,_0x1af882){return new BPromise(function(_0xd4ff5f,_0x57704b){return client[_0x5864('0xb')](_0x2ab013,_0x1af882)[_0x5864('0xc')](function(_0x4b5aec){logger[_0x5864('0xd')]('DeskAccount,\x20%s,\x20%s',_0x408e06,'request\x20sent');logger[_0x5864('0xe')](_0x5864('0xf'),_0x408e06,'request\x20sent',JSON[_0x5864('0x10')](_0x4b5aec));if(_0x4b5aec[_0x5864('0x11')]){if(_0x4b5aec[_0x5864('0x11')][_0x5864('0x12')]===0x1f4){logger[_0x5864('0x11')](_0x5864('0x13'),_0x408e06,_0x4b5aec[_0x5864('0x11')]['message']);return _0x57704b(_0x4b5aec[_0x5864('0x11')]['message']);}logger['error'](_0x5864('0x13'),_0x408e06,_0x4b5aec[_0x5864('0x11')][_0x5864('0x14')]);return _0xd4ff5f(_0x4b5aec[_0x5864('0x11')][_0x5864('0x14')]);}else{logger[_0x5864('0xd')](_0x5864('0x13'),_0x408e06,'request\x20sent');_0xd4ff5f(_0x4b5aec[_0x5864('0x15')][_0x5864('0x14')]);}})[_0x5864('0x16')](function(_0x1c7f64){logger[_0x5864('0x11')](_0x5864('0x13'),_0x408e06,_0x1c7f64);_0x57704b(_0x1c7f64);});});}exports[_0x5864('0x17')]=function(_0x57b527){var _0x13a5cc=this;return new Promise(function(_0x202f6f,_0xf944ff){return db[_0x5864('0x18')]['findAll']({'raw':_0x57b527[_0x5864('0x19')]?_0x57b527['options']['raw']===undefined?!![]:![]:!![],'where':_0x57b527[_0x5864('0x19')]?_0x57b527[_0x5864('0x19')][_0x5864('0x1a')]||null:null,'attributes':_0x57b527[_0x5864('0x19')]?_0x57b527['options'][_0x5864('0x1b')]||null:null,'limit':_0x57b527[_0x5864('0x19')]?_0x57b527['options'][_0x5864('0x1c')]||null:null,'include':_0x57b527[_0x5864('0x19')]?_0x57b527[_0x5864('0x19')][_0x5864('0x1d')]?_['map'](_0x57b527[_0x5864('0x19')][_0x5864('0x1d')],function(_0x22d206){return{'model':db[_0x22d206['model']],'as':_0x22d206['as'],'attributes':_0x22d206['attributes'],'include':_0x22d206[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x22d206['include'],function(_0x28c569){return{'model':db[_0x28c569[_0x5864('0x1f')]],'as':_0x28c569['as'],'attributes':_0x28c569['attributes'],'include':_0x28c569[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x28c569[_0x5864('0x1d')],function(_0x3e035c){return{'model':db[_0x3e035c['model']],'as':_0x3e035c['as'],'attributes':_0x3e035c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5864('0xc')](function(_0x402676){logger[_0x5864('0xd')](_0x5864('0x17'),_0x57b527);logger[_0x5864('0xe')](_0x5864('0x17'),_0x57b527,JSON[_0x5864('0x10')](_0x402676));_0x202f6f(_0x402676);})[_0x5864('0x16')](function(_0xbecc0e){logger[_0x5864('0x11')](_0x5864('0x17'),_0xbecc0e[_0x5864('0x14')],_0x57b527);_0xf944ff(_0x13a5cc['error'](0x1f4,_0xbecc0e[_0x5864('0x14')]));});});};exports[_0x5864('0x20')]=function(_0x573349){var _0x2cd2e9=this;return new Promise(function(_0x465135,_0x7f3178){return db[_0x5864('0x18')]['find']({'raw':_0x573349[_0x5864('0x19')]?_0x573349[_0x5864('0x19')][_0x5864('0x21')]===undefined?!![]:![]:!![],'where':_0x573349[_0x5864('0x19')]?_0x573349[_0x5864('0x19')][_0x5864('0x1a')]||null:null,'attributes':_0x573349['options']?_0x573349[_0x5864('0x19')][_0x5864('0x1b')]||null:null,'include':_0x573349['options']?_0x573349[_0x5864('0x19')][_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x573349[_0x5864('0x19')][_0x5864('0x1d')],function(_0x4d94b5){return{'model':db[_0x4d94b5[_0x5864('0x1f')]],'as':_0x4d94b5['as'],'attributes':_0x4d94b5[_0x5864('0x1b')],'include':_0x4d94b5['include']?_[_0x5864('0x1e')](_0x4d94b5[_0x5864('0x1d')],function(_0x428761){return{'model':db[_0x428761['model']],'as':_0x428761['as'],'attributes':_0x428761['attributes'],'include':_0x428761[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x428761[_0x5864('0x1d')],function(_0xe4c016){return{'model':db[_0xe4c016[_0x5864('0x1f')]],'as':_0xe4c016['as'],'attributes':_0xe4c016[_0x5864('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5864('0xc')](function(_0x180551){logger[_0x5864('0xd')](_0x5864('0x20'),_0x573349);logger[_0x5864('0xe')]('ShowDeskAccount',_0x573349,JSON[_0x5864('0x10')](_0x180551));_0x465135(_0x180551);})['catch'](function(_0x48571c){logger['error'](_0x5864('0x20'),_0x48571c[_0x5864('0x14')],_0x573349);_0x7f3178(_0x2cd2e9['error'](0x1f4,_0x48571c['message']));});});}; \ No newline at end of file +var _0x937d=['code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowDeskAccount','find','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x421b14,_0xee05a0){var _0x4b7b57=function(_0x433da3){while(--_0x433da3){_0x421b14['push'](_0x421b14['shift']());}};_0x4b7b57(++_0xee05a0);}(_0x937d,0x74));var _0xd937=function(_0x92107d,_0x581552){_0x92107d=_0x92107d-0x0;var _0x4cb9d8=_0x937d[_0x92107d];return _0x4cb9d8;};'use strict';var _=require(_0xd937('0x0'));var util=require(_0xd937('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd937('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd937('0x4'));var config=require(_0xd937('0x5'));var jayson=require(_0xd937('0x6'));var client=jayson['client'][_0xd937('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x170165,_0x363a91,_0x2c82eb){return new BPromise(function(_0x40b034,_0x39e7f6){return client[_0xd937('0x8')](_0x170165,_0x2c82eb)[_0xd937('0x9')](function(_0x39d912){logger[_0xd937('0xa')]('DeskAccount,\x20%s,\x20%s',_0x363a91,_0xd937('0xb'));logger[_0xd937('0xc')](_0xd937('0xd'),_0x363a91,_0xd937('0xb'),JSON[_0xd937('0xe')](_0x39d912));if(_0x39d912[_0xd937('0xf')]){if(_0x39d912['error'][_0xd937('0x10')]===0x1f4){logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x39d912['error'][_0xd937('0x12')]);return _0x39e7f6(_0x39d912[_0xd937('0xf')]['message']);}logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x39d912['error']['message']);return _0x40b034(_0x39d912[_0xd937('0xf')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x11'),_0x363a91,_0xd937('0xb'));_0x40b034(_0x39d912[_0xd937('0x13')][_0xd937('0x12')]);}})['catch'](function(_0x3edaf4){logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x3edaf4);_0x39e7f6(_0x3edaf4);});});}exports[_0xd937('0x14')]=function(_0x246aa4){var _0x1472b1=this;return new Promise(function(_0xc3c4d7,_0x30060d){return db['DeskAccount'][_0xd937('0x15')]({'raw':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x17')]===undefined?!![]:![]:!![],'where':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x18')]||null:null,'attributes':_0x246aa4['options']?_0x246aa4['options'][_0xd937('0x19')]||null:null,'limit':_0x246aa4['options']?_0x246aa4[_0xd937('0x16')][_0xd937('0x1a')]||null:null,'include':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x1b')]?_[_0xd937('0x1c')](_0x246aa4['options'][_0xd937('0x1b')],function(_0xdb8724){return{'model':db[_0xdb8724[_0xd937('0x1d')]],'as':_0xdb8724['as'],'attributes':_0xdb8724[_0xd937('0x19')],'include':_0xdb8724[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0xdb8724[_0xd937('0x1b')],function(_0xffd629){return{'model':db[_0xffd629['model']],'as':_0xffd629['as'],'attributes':_0xffd629['attributes'],'include':_0xffd629[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0xffd629[_0xd937('0x1b')],function(_0x544ab6){return{'model':db[_0x544ab6['model']],'as':_0x544ab6['as'],'attributes':_0x544ab6[_0xd937('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54a8ed){logger[_0xd937('0xa')]('GetDeskAccount',_0x246aa4);logger['debug'](_0xd937('0x14'),_0x246aa4,JSON[_0xd937('0xe')](_0x54a8ed));_0xc3c4d7(_0x54a8ed);})[_0xd937('0x1e')](function(_0x2ca83d){logger['error'](_0xd937('0x14'),_0x2ca83d['message'],_0x246aa4);_0x30060d(_0x1472b1[_0xd937('0xf')](0x1f4,_0x2ca83d[_0xd937('0x12')]));});});};exports[_0xd937('0x1f')]=function(_0x23ad83){var _0x1997a4=this;return new Promise(function(_0x3d03d3,_0x59a5cc){return db['DeskAccount'][_0xd937('0x20')]({'raw':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')][_0xd937('0x18')]||null:null,'attributes':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')][_0xd937('0x19')]||null:null,'include':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')]['include']?_[_0xd937('0x1c')](_0x23ad83[_0xd937('0x16')][_0xd937('0x1b')],function(_0x3f7b55){return{'model':db[_0x3f7b55['model']],'as':_0x3f7b55['as'],'attributes':_0x3f7b55[_0xd937('0x19')],'include':_0x3f7b55[_0xd937('0x1b')]?_['map'](_0x3f7b55['include'],function(_0x75ed5b){return{'model':db[_0x75ed5b['model']],'as':_0x75ed5b['as'],'attributes':_0x75ed5b['attributes'],'include':_0x75ed5b[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0x75ed5b[_0xd937('0x1b')],function(_0xff550e){return{'model':db[_0xff550e[_0xd937('0x1d')]],'as':_0xff550e['as'],'attributes':_0xff550e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd937('0x9')](function(_0x490e22){logger[_0xd937('0xa')](_0xd937('0x1f'),_0x23ad83);logger[_0xd937('0xc')](_0xd937('0x1f'),_0x23ad83,JSON['stringify'](_0x490e22));_0x3d03d3(_0x490e22);})['catch'](function(_0x5acfb1){logger[_0xd937('0xf')]('ShowDeskAccount',_0x5acfb1[_0xd937('0x12')],_0x23ad83);_0x59a5cc(_0x1997a4[_0xd937('0xf')](0x1f4,_0x5acfb1[_0xd937('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b90d2ae..4e26d3c 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x492d17,_0x53e5c2){var _0xfe07eb=function(_0x43b2f2){while(--_0x43b2f2){_0x492d17['push'](_0x492d17['shift']());}};_0xfe07eb(++_0x53e5c2);}(_0x008c,0x188));var _0xc008=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x008c[_0x1795df];return _0x3f13c0;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d00f7,_0x38d2c1){var _0x4b58a2=function(_0x5e12f5){while(--_0x5e12f5){_0x5d00f7['push'](_0x5d00f7['shift']());}};_0x4b58a2(++_0x38d2c1);}(_0x34e8,0x12c));var _0x834e=function(_0x1652fe,_0x489231){_0x1652fe=_0x1652fe-0x0;var _0x49cea1=_0x34e8[_0x1652fe];return _0x49cea1;};'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 fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 0a46961..9ee48ad 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 _0xb6ec=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb6ec,0x164));var _0xcb6e=function(_0x24f498,_0x3d93a3){_0x24f498=_0x24f498-0x0;var _0xa9c070=_0xb6ec[_0x24f498];return _0xa9c070;};'use strict';var Sequelize=require(_0xcb6e('0x0'));module[_0xcb6e('0x1')]={'name':{'type':Sequelize[_0xcb6e('0x2')]},'description':{'type':Sequelize[_0xcb6e('0x2')]}}; \ No newline at end of file +var _0xe848=['sequelize','exports','STRING'];(function(_0x5058eb,_0x3e6668){var _0x1a6fb2=function(_0x2de6bd){while(--_0x2de6bd){_0x5058eb['push'](_0x5058eb['shift']());}};_0x1a6fb2(++_0x3e6668);}(_0xe848,0x1c5));var _0x8e84=function(_0x3b52f8,_0x8ffcc9){_0x3b52f8=_0x3b52f8-0x0;var _0x55e0b3=_0xe848[_0x3b52f8];return _0x55e0b3;};'use strict';var Sequelize=require(_0x8e84('0x0'));module[_0x8e84('0x1')]={'name':{'type':Sequelize[_0x8e84('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b9e5ecb..3b0761b 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 _0x7c84=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','find','create','body','getFields','findOne','params','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','status','error','send','rawAttributes','type','key','model','map','name'];(function(_0x55e32d,_0x2164d9){var _0x183313=function(_0x33ee7f){while(--_0x33ee7f){_0x55e32d['push'](_0x55e32d['shift']());}};_0x183313(++_0x2164d9);}(_0x7c84,0x1aa));var _0x47c8=function(_0xe4a4ae,_0x3b960b){_0xe4a4ae=_0xe4a4ae-0x0;var _0x4aa22c=_0x7c84[_0xe4a4ae];return _0x4aa22c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47c8('0x1'));var rp=require(_0x47c8('0x2'));var moment=require(_0x47c8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47c8('0x4'));var path=require(_0x47c8('0x5'));var sox=require(_0x47c8('0x6'));var csv=require(_0x47c8('0x7'));var ejs=require(_0x47c8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47c8('0x9'));var squel=require('squel');var crypto=require(_0x47c8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47c8('0x7'));var querystring=require(_0x47c8('0xb'));var Papa=require(_0x47c8('0xc'));var Redis=require(_0x47c8('0xd'));var authService=require(_0x47c8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47c8('0xf'));var logger=require(_0x47c8('0x10'))(_0x47c8('0x11'));var utils=require('../../config/utils');var config=require(_0x47c8('0x12'));var licenseUtil=require(_0x47c8('0x13'));var db=require(_0x47c8('0x14'))['db'];function respondWithStatusCode(_0x145869,_0x1a5400){_0x1a5400=_0x1a5400||0xcc;return function(_0x40d3c3){if(_0x40d3c3){return _0x145869[_0x47c8('0x15')](_0x1a5400);}return _0x145869['status'](_0x1a5400)[_0x47c8('0x16')]();};}function respondWithResult(_0x21450a,_0x399e00){_0x399e00=_0x399e00||0xc8;return function(_0x3456bd){if(_0x3456bd){return _0x21450a['status'](_0x399e00)[_0x47c8('0x17')](_0x3456bd);}};}function respondWithFilteredResult(_0x569fb2,_0x7d70dd){return function(_0x4f7c9e){if(_0x4f7c9e){var _0x30119b=typeof _0x7d70dd[_0x47c8('0x18')]===_0x47c8('0x19')&&typeof _0x7d70dd[_0x47c8('0x1a')]===_0x47c8('0x19');var _0x53a06d=_0x4f7c9e['count'];var _0x146cb6=_0x30119b?0x0:_0x7d70dd[_0x47c8('0x18')];var _0x23ab04=_0x30119b?_0x4f7c9e[_0x47c8('0x1b')]:_0x7d70dd[_0x47c8('0x18')]+_0x7d70dd[_0x47c8('0x1a')];var _0xaaca56;if(_0x23ab04>=_0x53a06d){_0x23ab04=_0x53a06d;_0xaaca56=0xc8;}else{_0xaaca56=0xce;}_0x569fb2['status'](_0xaaca56);return _0x569fb2['set']('Content-Range',_0x146cb6+'-'+_0x23ab04+'/'+_0x53a06d)['json'](_0x4f7c9e);}return null;};}function patchUpdates(_0x551b59){return function(_0x3754f6){try{jsonpatch['apply'](_0x3754f6,_0x551b59,!![]);}catch(_0x7c2291){return BPromise[_0x47c8('0x1c')](_0x7c2291);}return _0x3754f6[_0x47c8('0x1d')]();};}function saveUpdates(_0x365122,_0x4601af){return function(_0x51caed){if(_0x51caed){return _0x51caed[_0x47c8('0x1e')](_0x365122)[_0x47c8('0x1f')](function(_0x7199d6){return _0x7199d6;});}return null;};}function removeEntity(_0x2c7073,_0x255e7c){return function(_0x1fe88d){if(_0x1fe88d){return _0x1fe88d[_0x47c8('0x20')]()[_0x47c8('0x1f')](function(){_0x2c7073[_0x47c8('0x21')](0xcc)[_0x47c8('0x16')]();});}};}function handleEntityNotFound(_0x5961ea,_0x439f55){return function(_0xe4a1db){if(!_0xe4a1db){_0x5961ea['sendStatus'](0x194);}return _0xe4a1db;};}function handleError(_0x47f0fa,_0x45f57c){_0x45f57c=_0x45f57c||0x1f4;return function(_0x56504e){logger[_0x47c8('0x22')](_0x56504e['stack']);if(_0x56504e['name']){delete _0x56504e['name'];}_0x47f0fa[_0x47c8('0x21')](_0x45f57c)[_0x47c8('0x23')](_0x56504e);};}exports['index']=function(_0x5fe772,_0xf9c583){var _0x4acbf5={},_0xb05664={},_0x33e116={'count':0x0,'rows':[]};var _0x57c32a=_['map'](db['DeskConfiguration'][_0x47c8('0x24')],function(_0x2245ff){return{'name':_0x2245ff['fieldName'],'type':_0x2245ff[_0x47c8('0x25')][_0x47c8('0x26')]};});_0xb05664[_0x47c8('0x27')]=_[_0x47c8('0x28')](_0x57c32a,_0x47c8('0x29'));_0xb05664['query']=_[_0x47c8('0x2a')](_0x5fe772[_0x47c8('0x2b')]);_0xb05664[_0x47c8('0x2c')]=_[_0x47c8('0x2d')](_0xb05664[_0x47c8('0x27')],_0xb05664[_0x47c8('0x2b')]);_0x4acbf5[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0xb05664['model'],qs['fields'](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x4acbf5[_0x47c8('0x2e')]=_0x4acbf5[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x4acbf5[_0x47c8('0x2e')]:_0xb05664['model'];if(!_0x5fe772['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x4acbf5[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x4acbf5[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x5fe772['query']['offset']);}_0x4acbf5['order']=qs[_0x47c8('0x33')](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x4acbf5[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x5fe772[_0x47c8('0x2b')],_0xb05664[_0x47c8('0x2c')]),_0x57c32a);if(_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x4acbf5[_0x47c8('0x34')]=_[_0x47c8('0x37')](_0x4acbf5[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x57c32a,function(_0x39446c){if(_0x39446c[_0x47c8('0x25')]!==_0x47c8('0x38')){var _0x3eceaf={};_0x3eceaf[_0x39446c['name']]={'$like':'%'+_0x5fe772[_0x47c8('0x2b')]['filter']+'%'};return _0x3eceaf;}})});}_0x4acbf5=_[_0x47c8('0x37')]({},_0x4acbf5,_0x5fe772[_0x47c8('0x39')]);var _0x480f4f={'where':_0x4acbf5[_0x47c8('0x34')]};return db[_0x47c8('0x3a')][_0x47c8('0x1b')](_0x480f4f)[_0x47c8('0x1f')](function(_0x2efeba){_0x33e116[_0x47c8('0x1b')]=_0x2efeba;if(_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x3b')]){_0x4acbf5[_0x47c8('0x3c')]=[{'all':!![]}];}return db[_0x47c8('0x3a')][_0x47c8('0x3d')](_0x4acbf5);})[_0x47c8('0x1f')](function(_0x214812){_0x33e116[_0x47c8('0x3e')]=_0x214812;return _0x33e116;})[_0x47c8('0x1f')](respondWithFilteredResult(_0xf9c583,_0x4acbf5))[_0x47c8('0x3f')](handleError(_0xf9c583,null));};exports['show']=function(_0x4cd316,_0x3359ed){var _0x49e4a6={'raw':![],'where':{'id':_0x4cd316['params']['id']}},_0x10436a={};_0x10436a[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x3a')][_0x47c8('0x24')]);_0x10436a[_0x47c8('0x2b')]=_[_0x47c8('0x2a')](_0x4cd316[_0x47c8('0x2b')]);_0x10436a['filters']=_['intersection'](_0x10436a[_0x47c8('0x27')],_0x10436a['query']);_0x49e4a6[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0x10436a[_0x47c8('0x27')],qs['fields'](_0x4cd316[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x49e4a6[_0x47c8('0x2e')]=_0x49e4a6[_0x47c8('0x2e')]['length']?_0x49e4a6[_0x47c8('0x2e')]:_0x10436a['model'];if(_0x4cd316[_0x47c8('0x2b')][_0x47c8('0x3b')]){_0x49e4a6[_0x47c8('0x3c')]=[{'all':!![]}];}_0x49e4a6=_[_0x47c8('0x37')]({},_0x49e4a6,_0x4cd316[_0x47c8('0x39')]);return db['DeskConfiguration'][_0x47c8('0x40')](_0x49e4a6)[_0x47c8('0x1f')](handleEntityNotFound(_0x3359ed,null))[_0x47c8('0x1f')](respondWithResult(_0x3359ed,null))['catch'](handleError(_0x3359ed,null));};exports[_0x47c8('0x41')]=function(_0x248e48,_0x59ee96){return db['DeskConfiguration'][_0x47c8('0x41')](_0x248e48[_0x47c8('0x42')],{})[_0x47c8('0x1f')](respondWithResult(_0x59ee96,0xc9))[_0x47c8('0x3f')](handleError(_0x59ee96,null));};exports[_0x47c8('0x1e')]=function(_0x5c882b,_0x377d3b){if(_0x5c882b[_0x47c8('0x42')]['id']){delete _0x5c882b[_0x47c8('0x42')]['id'];}return db[_0x47c8('0x3a')][_0x47c8('0x40')]({'where':{'id':_0x5c882b['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x377d3b,null))[_0x47c8('0x1f')](saveUpdates(_0x5c882b[_0x47c8('0x42')],null))[_0x47c8('0x1f')](respondWithResult(_0x377d3b,null))[_0x47c8('0x3f')](handleError(_0x377d3b,null));};exports['destroy']=function(_0x5eadfa,_0x14c0b9){return db[_0x47c8('0x3a')][_0x47c8('0x40')]({'where':{'id':_0x5eadfa['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x14c0b9,null))[_0x47c8('0x1f')](removeEntity(_0x14c0b9,null))['catch'](handleError(_0x14c0b9,null));};exports[_0x47c8('0x43')]=function(_0x541a58,_0x2ea7d9,_0xc90624){var _0x228fe8={};var _0x4fea75={};var _0x3fa35e;var _0x3c09bf;return db['DeskConfiguration'][_0x47c8('0x44')]({'where':{'id':_0x541a58[_0x47c8('0x45')]['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x2ea7d9,null))[_0x47c8('0x1f')](function(_0xa3a5c4){if(_0xa3a5c4){_0x3fa35e=_0xa3a5c4;_0x4fea75['model']=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x4fea75['query']=_['keys'](_0x541a58['query']);_0x4fea75[_0x47c8('0x2c')]=_[_0x47c8('0x2d')](_0x4fea75[_0x47c8('0x27')],_0x4fea75[_0x47c8('0x2b')]);_0x228fe8[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0x4fea75[_0x47c8('0x27')],qs['fields'](_0x541a58[_0x47c8('0x2b')]['fields']));_0x228fe8[_0x47c8('0x2e')]=_0x228fe8[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x228fe8['attributes']:_0x4fea75[_0x47c8('0x27')];_0x228fe8[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x541a58[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x228fe8[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x541a58[_0x47c8('0x2b')],_0x4fea75['filters']));if(_0x541a58[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x228fe8[_0x47c8('0x34')]=_[_0x47c8('0x37')](_0x228fe8[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x228fe8[_0x47c8('0x2e')],function(_0xd2e670){var _0x25cba4={};_0x25cba4[_0xd2e670]={'$like':'%'+_0x541a58[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x25cba4;})});}_0x228fe8=_['merge']({},_0x228fe8,_0x541a58[_0x47c8('0x39')]);return _0x3fa35e[_0x47c8('0x43')](_0x228fe8);}})[_0x47c8('0x1f')](function(_0x2c0adc){if(_0x2c0adc){_0x3c09bf=_0x2c0adc[_0x47c8('0x30')];if(!_0x541a58['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x228fe8['limit']=qs[_0x47c8('0x1a')](_0x541a58['query'][_0x47c8('0x1a')]);_0x228fe8[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x541a58[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x3fa35e['getFields'](_0x228fe8);}})[_0x47c8('0x1f')](function(_0x24ab03){if(_0x24ab03){return _0x24ab03?{'count':_0x3c09bf,'rows':_0x24ab03}:null;}})[_0x47c8('0x1f')](respondWithResult(_0x2ea7d9,null))[_0x47c8('0x3f')](handleError(_0x2ea7d9,null));};exports[_0x47c8('0x48')]=function(_0x57aab3,_0x4d3664,_0x18e4c8){var _0x117b9b={};var _0x4276a4={};var _0x5700ab;var _0x260e3b;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x57aab3[_0x47c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d3664,null))[_0x47c8('0x1f')](function(_0x151740){if(_0x151740){_0x5700ab=_0x151740;_0x4276a4[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x4276a4['query']=_[_0x47c8('0x2a')](_0x57aab3['query']);_0x4276a4['filters']=_[_0x47c8('0x2d')](_0x4276a4[_0x47c8('0x27')],_0x4276a4[_0x47c8('0x2b')]);_0x117b9b['attributes']=_['intersection'](_0x4276a4[_0x47c8('0x27')],qs[_0x47c8('0x2f')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x117b9b[_0x47c8('0x2e')]=_0x117b9b['attributes'][_0x47c8('0x30')]?_0x117b9b['attributes']:_0x4276a4[_0x47c8('0x27')];_0x117b9b[_0x47c8('0x47')]=qs['sort'](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x117b9b['where']=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x57aab3[_0x47c8('0x2b')],_0x4276a4[_0x47c8('0x2c')]));if(_0x57aab3['query'][_0x47c8('0x36')]){_0x117b9b['where']=_[_0x47c8('0x37')](_0x117b9b['where'],{'$or':_[_0x47c8('0x28')](_0x117b9b['attributes'],function(_0x152072){var _0x5d5e54={};_0x5d5e54[_0x152072]={'$like':'%'+_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x5d5e54;})});}_0x117b9b=_[_0x47c8('0x37')]({},_0x117b9b,_0x57aab3['options']);return _0x5700ab['getSubjects'](_0x117b9b);}})['then'](function(_0x151043){if(_0x151043){_0x260e3b=_0x151043[_0x47c8('0x30')];if(!_0x57aab3['query'][_0x47c8('0x31')]('nolimit')){_0x117b9b['limit']=qs[_0x47c8('0x1a')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x117b9b[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x5700ab['getSubjects'](_0x117b9b);}})['then'](function(_0x16d831){if(_0x16d831){return _0x16d831?{'count':_0x260e3b,'rows':_0x16d831}:null;}})[_0x47c8('0x1f')](respondWithResult(_0x4d3664,null))[_0x47c8('0x3f')](handleError(_0x4d3664,null));};exports[_0x47c8('0x49')]=function(_0x586b97,_0x596aab,_0x561bd5){var _0x2df343={};var _0x1f3e9e={};var _0x5a6b16;var _0xb15cec;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x586b97[_0x47c8('0x45')]['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x596aab,null))[_0x47c8('0x1f')](function(_0x26d4e9){if(_0x26d4e9){_0x5a6b16=_0x26d4e9;_0x1f3e9e[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x1f3e9e[_0x47c8('0x2b')]=_['keys'](_0x586b97[_0x47c8('0x2b')]);_0x1f3e9e['filters']=_['intersection'](_0x1f3e9e['model'],_0x1f3e9e[_0x47c8('0x2b')]);_0x2df343['attributes']=_[_0x47c8('0x2d')](_0x1f3e9e[_0x47c8('0x27')],qs['fields'](_0x586b97[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x2df343[_0x47c8('0x2e')]=_0x2df343[_0x47c8('0x2e')]['length']?_0x2df343['attributes']:_0x1f3e9e[_0x47c8('0x27')];_0x2df343[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x586b97[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x2df343[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x586b97[_0x47c8('0x2b')],_0x1f3e9e[_0x47c8('0x2c')]));if(_0x586b97[_0x47c8('0x2b')]['filter']){_0x2df343['where']=_[_0x47c8('0x37')](_0x2df343[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x2df343[_0x47c8('0x2e')],function(_0x1ee08e){var _0x2ba2d8={};_0x2ba2d8[_0x1ee08e]={'$like':'%'+_0x586b97[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x2ba2d8;})});}_0x2df343=_[_0x47c8('0x37')]({},_0x2df343,_0x586b97[_0x47c8('0x39')]);return _0x5a6b16[_0x47c8('0x49')](_0x2df343);}})[_0x47c8('0x1f')](function(_0x4bc299){if(_0x4bc299){_0xb15cec=_0x4bc299[_0x47c8('0x30')];if(!_0x586b97['query']['hasOwnProperty'](_0x47c8('0x32'))){_0x2df343[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x586b97[_0x47c8('0x2b')]['limit']);_0x2df343[_0x47c8('0x18')]=qs['offset'](_0x586b97['query'][_0x47c8('0x18')]);}return _0x5a6b16['getDescriptions'](_0x2df343);}})[_0x47c8('0x1f')](function(_0x19fb57){if(_0x19fb57){return _0x19fb57?{'count':_0xb15cec,'rows':_0x19fb57}:null;}})['then'](respondWithResult(_0x596aab,null))['catch'](handleError(_0x596aab,null));};exports[_0x47c8('0x4a')]=function(_0x2b686e,_0xa59f95,_0x3ffd13){var _0x4f8639={};var _0x2f82e6={};var _0x32b154;var _0x2f2408;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x2b686e['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0xa59f95,null))[_0x47c8('0x1f')](function(_0x5570dd){if(_0x5570dd){_0x32b154=_0x5570dd;_0x2f82e6[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x4b')][_0x47c8('0x24')]);_0x2f82e6[_0x47c8('0x2b')]=_[_0x47c8('0x2a')](_0x2b686e['query']);_0x2f82e6[_0x47c8('0x2c')]=_['intersection'](_0x2f82e6[_0x47c8('0x27')],_0x2f82e6['query']);_0x4f8639[_0x47c8('0x2e')]=_['intersection'](_0x2f82e6[_0x47c8('0x27')],qs[_0x47c8('0x2f')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x4f8639['attributes']=_0x4f8639[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x4f8639[_0x47c8('0x2e')]:_0x2f82e6[_0x47c8('0x27')];_0x4f8639[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x2b686e[_0x47c8('0x2b')]['sort']);_0x4f8639['where']=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x2b686e[_0x47c8('0x2b')],_0x2f82e6[_0x47c8('0x2c')]));if(_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x4f8639['where']=_[_0x47c8('0x37')](_0x4f8639[_0x47c8('0x34')],{'$or':_['map'](_0x4f8639[_0x47c8('0x2e')],function(_0x5819ad){var _0x48f91b={};_0x48f91b[_0x5819ad]={'$like':'%'+_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x48f91b;})});}_0x4f8639=_['merge']({},_0x4f8639,_0x2b686e[_0x47c8('0x39')]);return _0x32b154[_0x47c8('0x4a')](_0x4f8639);}})[_0x47c8('0x1f')](function(_0x436eaf){if(_0x436eaf){_0x2f2408=_0x436eaf[_0x47c8('0x30')];if(!_0x2b686e['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x4f8639[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x4f8639['offset']=qs[_0x47c8('0x18')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x32b154[_0x47c8('0x4a')](_0x4f8639);}})[_0x47c8('0x1f')](function(_0x487d36){if(_0x487d36){return _0x487d36?{'count':_0x2f2408,'rows':_0x487d36}:null;}})[_0x47c8('0x1f')](respondWithResult(_0xa59f95,null))[_0x47c8('0x3f')](handleError(_0xa59f95,null));};exports[_0x47c8('0x4c')]=function(_0x362c2a,_0x2d3046,_0x387934){if(_0x362c2a[_0x47c8('0x42')]['id']){delete _0x362c2a[_0x47c8('0x42')]['id'];}return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x362c2a[_0x47c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d3046,null))['then'](function(_0xb9f622){if(_0xb9f622){return _0xb9f622[_0x47c8('0x4c')](_0x362c2a['body'][_0x47c8('0x4d')]||[]);}return null;})[_0x47c8('0x1f')](respondWithResult(_0x2d3046,null))[_0x47c8('0x3f')](handleError(_0x2d3046,null));}; \ No newline at end of file +var _0x6112=['include','findAll','rows','catch','show','params','options','find','create','body','getFields','getSubjects','findOne','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll'];(function(_0x5a3cfe,_0x100847){var _0x5960d5=function(_0x2728fc){while(--_0x2728fc){_0x5a3cfe['push'](_0x5a3cfe['shift']());}};_0x5960d5(++_0x100847);}(_0x6112,0x153));var _0x2611=function(_0xb5ba89,_0x15691a){_0xb5ba89=_0xb5ba89-0x0;var _0x52a19a=_0x6112[_0xb5ba89];return _0x52a19a;};'use strict';var emlformat=require(_0x2611('0x0'));var rimraf=require(_0x2611('0x1'));var zipdir=require(_0x2611('0x2'));var jsonpatch=require(_0x2611('0x3'));var rp=require(_0x2611('0x4'));var moment=require('moment');var BPromise=require(_0x2611('0x5'));var Mustache=require(_0x2611('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2611('0x7'));var csv=require(_0x2611('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2611('0x9'));var _=require('lodash');var squel=require(_0x2611('0xa'));var crypto=require('crypto');var jsforce=require(_0x2611('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2611('0x8'));var querystring=require(_0x2611('0xc'));var Papa=require('papaparse');var Redis=require(_0x2611('0xd'));var authService=require(_0x2611('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2611('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2611('0x10'));var licenseUtil=require(_0x2611('0x11'));var db=require(_0x2611('0x12'))['db'];function respondWithStatusCode(_0x351d30,_0x585af4){_0x585af4=_0x585af4||0xcc;return function(_0x457749){if(_0x457749){return _0x351d30[_0x2611('0x13')](_0x585af4);}return _0x351d30['status'](_0x585af4)['end']();};}function respondWithResult(_0x575e1,_0x5a3a4b){_0x5a3a4b=_0x5a3a4b||0xc8;return function(_0x149bf1){if(_0x149bf1){return _0x575e1[_0x2611('0x14')](_0x5a3a4b)[_0x2611('0x15')](_0x149bf1);}};}function respondWithFilteredResult(_0x4a06ca,_0x1f2f31){return function(_0x341b5f){if(_0x341b5f){var _0x519485=typeof _0x1f2f31[_0x2611('0x16')]===_0x2611('0x17')&&typeof _0x1f2f31['limit']==='undefined';var _0x1e6141=_0x341b5f[_0x2611('0x18')];var _0x2c8835=_0x519485?0x0:_0x1f2f31[_0x2611('0x16')];var _0x281090=_0x519485?_0x341b5f[_0x2611('0x18')]:_0x1f2f31[_0x2611('0x16')]+_0x1f2f31['limit'];var _0x194daa;if(_0x281090>=_0x1e6141){_0x281090=_0x1e6141;_0x194daa=0xc8;}else{_0x194daa=0xce;}_0x4a06ca[_0x2611('0x14')](_0x194daa);return _0x4a06ca[_0x2611('0x19')](_0x2611('0x1a'),_0x2c8835+'-'+_0x281090+'/'+_0x1e6141)[_0x2611('0x15')](_0x341b5f);}return null;};}function patchUpdates(_0x2d4885){return function(_0x5aa716){try{jsonpatch[_0x2611('0x1b')](_0x5aa716,_0x2d4885,!![]);}catch(_0x4f2e9d){return BPromise[_0x2611('0x1c')](_0x4f2e9d);}return _0x5aa716[_0x2611('0x1d')]();};}function saveUpdates(_0x4547bb,_0x411098){return function(_0x1226d0){if(_0x1226d0){return _0x1226d0[_0x2611('0x1e')](_0x4547bb)[_0x2611('0x1f')](function(_0x1a739f){return _0x1a739f;});}return null;};}function removeEntity(_0x4f3710,_0x4d4bf0){return function(_0x36a58c){if(_0x36a58c){return _0x36a58c[_0x2611('0x20')]()['then'](function(){_0x4f3710[_0x2611('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6a49,_0x151370){return function(_0x4909ca){if(!_0x4909ca){_0x1a6a49[_0x2611('0x13')](0x194);}return _0x4909ca;};}function handleError(_0x2f1fe2,_0x1fcb52){_0x1fcb52=_0x1fcb52||0x1f4;return function(_0x5958a4){logger['error'](_0x5958a4[_0x2611('0x21')]);if(_0x5958a4['name']){delete _0x5958a4[_0x2611('0x22')];}_0x2f1fe2[_0x2611('0x14')](_0x1fcb52)['send'](_0x5958a4);};}exports[_0x2611('0x23')]=function(_0x43337d,_0x245b90){var _0x1cb75d={},_0x36ef82={},_0x22ca6d={'count':0x0,'rows':[]};var _0x534e18=_[_0x2611('0x24')](db[_0x2611('0x25')][_0x2611('0x26')],function(_0x19b712){return{'name':_0x19b712[_0x2611('0x27')],'type':_0x19b712[_0x2611('0x28')][_0x2611('0x29')]};});_0x36ef82[_0x2611('0x2a')]=_[_0x2611('0x24')](_0x534e18,_0x2611('0x22'));_0x36ef82[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x43337d[_0x2611('0x2b')]);_0x36ef82[_0x2611('0x2d')]=_[_0x2611('0x2e')](_0x36ef82[_0x2611('0x2a')],_0x36ef82['query']);_0x1cb75d[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x36ef82[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x43337d['query']['fields']));_0x1cb75d[_0x2611('0x2f')]=_0x1cb75d[_0x2611('0x2f')][_0x2611('0x31')]?_0x1cb75d[_0x2611('0x2f')]:_0x36ef82[_0x2611('0x2a')];if(!_0x43337d[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x1cb75d[_0x2611('0x34')]=qs['limit'](_0x43337d[_0x2611('0x2b')]['limit']);_0x1cb75d['offset']=qs[_0x2611('0x16')](_0x43337d[_0x2611('0x2b')]['offset']);}_0x1cb75d[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x43337d['query']['sort']);_0x1cb75d[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x43337d[_0x2611('0x2b')],_0x36ef82[_0x2611('0x2d')]),_0x534e18);if(_0x43337d[_0x2611('0x2b')]['filter']){_0x1cb75d[_0x2611('0x37')]=_[_0x2611('0x39')](_0x1cb75d['where'],{'$or':_[_0x2611('0x24')](_0x534e18,function(_0x2d85e9){if(_0x2d85e9[_0x2611('0x28')]!==_0x2611('0x3a')){var _0x3a3cfe={};_0x3a3cfe[_0x2d85e9[_0x2611('0x22')]]={'$like':'%'+_0x43337d['query'][_0x2611('0x3b')]+'%'};return _0x3a3cfe;}})});}_0x1cb75d=_[_0x2611('0x39')]({},_0x1cb75d,_0x43337d['options']);var _0x4f6a2e={'where':_0x1cb75d[_0x2611('0x37')]};return db[_0x2611('0x25')][_0x2611('0x18')](_0x4f6a2e)[_0x2611('0x1f')](function(_0x3ed951){_0x22ca6d['count']=_0x3ed951;if(_0x43337d[_0x2611('0x2b')][_0x2611('0x3c')]){_0x1cb75d[_0x2611('0x3d')]=[{'all':!![]}];}return db[_0x2611('0x25')][_0x2611('0x3e')](_0x1cb75d);})[_0x2611('0x1f')](function(_0x22271d){_0x22ca6d[_0x2611('0x3f')]=_0x22271d;return _0x22ca6d;})[_0x2611('0x1f')](respondWithFilteredResult(_0x245b90,_0x1cb75d))[_0x2611('0x40')](handleError(_0x245b90,null));};exports[_0x2611('0x41')]=function(_0x5b155e,_0x4d3e43){var _0x3a4c00={'raw':![],'where':{'id':_0x5b155e[_0x2611('0x42')]['id']}},_0x516b36={};_0x516b36['model']=_[_0x2611('0x2c')](db['DeskConfiguration'][_0x2611('0x26')]);_0x516b36[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x5b155e[_0x2611('0x2b')]);_0x516b36['filters']=_[_0x2611('0x2e')](_0x516b36[_0x2611('0x2a')],_0x516b36[_0x2611('0x2b')]);_0x3a4c00[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x516b36[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x5b155e[_0x2611('0x2b')]['fields']));_0x3a4c00[_0x2611('0x2f')]=_0x3a4c00['attributes'][_0x2611('0x31')]?_0x3a4c00[_0x2611('0x2f')]:_0x516b36[_0x2611('0x2a')];if(_0x5b155e[_0x2611('0x2b')]['includeAll']){_0x3a4c00['include']=[{'all':!![]}];}_0x3a4c00=_['merge']({},_0x3a4c00,_0x5b155e[_0x2611('0x43')]);return db[_0x2611('0x25')][_0x2611('0x44')](_0x3a4c00)[_0x2611('0x1f')](handleEntityNotFound(_0x4d3e43,null))[_0x2611('0x1f')](respondWithResult(_0x4d3e43,null))[_0x2611('0x40')](handleError(_0x4d3e43,null));};exports['create']=function(_0xdbc3bf,_0x10ba5a){return db[_0x2611('0x25')][_0x2611('0x45')](_0xdbc3bf[_0x2611('0x46')],{})[_0x2611('0x1f')](respondWithResult(_0x10ba5a,0xc9))[_0x2611('0x40')](handleError(_0x10ba5a,null));};exports[_0x2611('0x1e')]=function(_0x318a9a,_0xda0843){if(_0x318a9a[_0x2611('0x46')]['id']){delete _0x318a9a[_0x2611('0x46')]['id'];}return db[_0x2611('0x25')][_0x2611('0x44')]({'where':{'id':_0x318a9a[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0xda0843,null))[_0x2611('0x1f')](saveUpdates(_0x318a9a['body'],null))[_0x2611('0x1f')](respondWithResult(_0xda0843,null))['catch'](handleError(_0xda0843,null));};exports[_0x2611('0x20')]=function(_0x1b4321,_0x416256){return db['DeskConfiguration']['find']({'where':{'id':_0x1b4321[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x416256,null))[_0x2611('0x1f')](removeEntity(_0x416256,null))[_0x2611('0x40')](handleError(_0x416256,null));};exports[_0x2611('0x47')]=function(_0x1d8ea3,_0x31c0ed,_0x24846e){var _0x3b4869={};var _0x42cde0={};var _0x499a33;var _0x162109;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1d8ea3[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x31c0ed,null))[_0x2611('0x1f')](function(_0x28d04e){if(_0x28d04e){_0x499a33=_0x28d04e;_0x42cde0[_0x2611('0x2a')]=_[_0x2611('0x2c')](db['DeskField']['rawAttributes']);_0x42cde0[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x1d8ea3[_0x2611('0x2b')]);_0x42cde0['filters']=_[_0x2611('0x2e')](_0x42cde0[_0x2611('0x2a')],_0x42cde0[_0x2611('0x2b')]);_0x3b4869['attributes']=_[_0x2611('0x2e')](_0x42cde0[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x1d8ea3[_0x2611('0x2b')][_0x2611('0x30')]));_0x3b4869[_0x2611('0x2f')]=_0x3b4869['attributes'][_0x2611('0x31')]?_0x3b4869[_0x2611('0x2f')]:_0x42cde0[_0x2611('0x2a')];_0x3b4869[_0x2611('0x35')]=qs['sort'](_0x1d8ea3[_0x2611('0x2b')]['sort']);_0x3b4869[_0x2611('0x37')]=qs['filters'](_[_0x2611('0x38')](_0x1d8ea3['query'],_0x42cde0['filters']));if(_0x1d8ea3['query'][_0x2611('0x3b')]){_0x3b4869[_0x2611('0x37')]=_['merge'](_0x3b4869[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x3b4869[_0x2611('0x2f')],function(_0x2a151e){var _0x5d9ec8={};_0x5d9ec8[_0x2a151e]={'$like':'%'+_0x1d8ea3[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x5d9ec8;})});}_0x3b4869=_[_0x2611('0x39')]({},_0x3b4869,_0x1d8ea3['options']);return _0x499a33['getFields'](_0x3b4869);}})[_0x2611('0x1f')](function(_0x3d4707){if(_0x3d4707){_0x162109=_0x3d4707[_0x2611('0x31')];if(!_0x1d8ea3[_0x2611('0x2b')]['hasOwnProperty'](_0x2611('0x33'))){_0x3b4869[_0x2611('0x34')]=qs[_0x2611('0x34')](_0x1d8ea3['query'][_0x2611('0x34')]);_0x3b4869['offset']=qs[_0x2611('0x16')](_0x1d8ea3['query'][_0x2611('0x16')]);}return _0x499a33['getFields'](_0x3b4869);}})['then'](function(_0x39c77d){if(_0x39c77d){return _0x39c77d?{'count':_0x162109,'rows':_0x39c77d}:null;}})[_0x2611('0x1f')](respondWithResult(_0x31c0ed,null))[_0x2611('0x40')](handleError(_0x31c0ed,null));};exports[_0x2611('0x48')]=function(_0x5d12a0,_0x1dc43f,_0x5a732a){var _0x2c229e={};var _0x245016={};var _0x39018b;var _0x1f56c6;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x5d12a0['params']['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x1dc43f,null))[_0x2611('0x1f')](function(_0x58d4a6){if(_0x58d4a6){_0x39018b=_0x58d4a6;_0x245016[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4a')][_0x2611('0x26')]);_0x245016[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x5d12a0[_0x2611('0x2b')]);_0x245016[_0x2611('0x2d')]=_['intersection'](_0x245016[_0x2611('0x2a')],_0x245016[_0x2611('0x2b')]);_0x2c229e[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x245016['model'],qs[_0x2611('0x30')](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x30')]));_0x2c229e[_0x2611('0x2f')]=_0x2c229e[_0x2611('0x2f')][_0x2611('0x31')]?_0x2c229e[_0x2611('0x2f')]:_0x245016['model'];_0x2c229e[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x5d12a0['query'][_0x2611('0x36')]);_0x2c229e[_0x2611('0x37')]=qs[_0x2611('0x2d')](_['pick'](_0x5d12a0[_0x2611('0x2b')],_0x245016[_0x2611('0x2d')]));if(_0x5d12a0[_0x2611('0x2b')]['filter']){_0x2c229e[_0x2611('0x37')]=_[_0x2611('0x39')](_0x2c229e['where'],{'$or':_[_0x2611('0x24')](_0x2c229e[_0x2611('0x2f')],function(_0x4341fd){var _0x2774aa={};_0x2774aa[_0x4341fd]={'$like':'%'+_0x5d12a0[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x2774aa;})});}_0x2c229e=_[_0x2611('0x39')]({},_0x2c229e,_0x5d12a0[_0x2611('0x43')]);return _0x39018b[_0x2611('0x48')](_0x2c229e);}})[_0x2611('0x1f')](function(_0x3bed8e){if(_0x3bed8e){_0x1f56c6=_0x3bed8e[_0x2611('0x31')];if(!_0x5d12a0[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x2c229e[_0x2611('0x34')]=qs['limit'](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x34')]);_0x2c229e[_0x2611('0x16')]=qs[_0x2611('0x16')](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x16')]);}return _0x39018b['getSubjects'](_0x2c229e);}})[_0x2611('0x1f')](function(_0x3c01e8){if(_0x3c01e8){return _0x3c01e8?{'count':_0x1f56c6,'rows':_0x3c01e8}:null;}})[_0x2611('0x1f')](respondWithResult(_0x1dc43f,null))['catch'](handleError(_0x1dc43f,null));};exports[_0x2611('0x4b')]=function(_0x19fcdd,_0x3cfeb2,_0x52fe45){var _0x50a4fc={};var _0x339816={};var _0x3bab45;var _0x10197c;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x19fcdd['params']['id']}})['then'](handleEntityNotFound(_0x3cfeb2,null))['then'](function(_0xfb2efd){if(_0xfb2efd){_0x3bab45=_0xfb2efd;_0x339816[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4a')][_0x2611('0x26')]);_0x339816[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x19fcdd[_0x2611('0x2b')]);_0x339816[_0x2611('0x2d')]=_['intersection'](_0x339816[_0x2611('0x2a')],_0x339816[_0x2611('0x2b')]);_0x50a4fc[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x339816[_0x2611('0x2a')],qs['fields'](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x30')]));_0x50a4fc[_0x2611('0x2f')]=_0x50a4fc[_0x2611('0x2f')]['length']?_0x50a4fc[_0x2611('0x2f')]:_0x339816[_0x2611('0x2a')];_0x50a4fc[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x36')]);_0x50a4fc[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x19fcdd['query'],_0x339816[_0x2611('0x2d')]));if(_0x19fcdd[_0x2611('0x2b')][_0x2611('0x3b')]){_0x50a4fc[_0x2611('0x37')]=_[_0x2611('0x39')](_0x50a4fc[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x50a4fc[_0x2611('0x2f')],function(_0x2ad777){var _0x8b8342={};_0x8b8342[_0x2ad777]={'$like':'%'+_0x19fcdd[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x8b8342;})});}_0x50a4fc=_[_0x2611('0x39')]({},_0x50a4fc,_0x19fcdd['options']);return _0x3bab45[_0x2611('0x4b')](_0x50a4fc);}})[_0x2611('0x1f')](function(_0x249c87){if(_0x249c87){_0x10197c=_0x249c87['length'];if(!_0x19fcdd[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x50a4fc['limit']=qs[_0x2611('0x34')](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x34')]);_0x50a4fc[_0x2611('0x16')]=qs['offset'](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x16')]);}return _0x3bab45[_0x2611('0x4b')](_0x50a4fc);}})[_0x2611('0x1f')](function(_0x131ae5){if(_0x131ae5){return _0x131ae5?{'count':_0x10197c,'rows':_0x131ae5}:null;}})[_0x2611('0x1f')](respondWithResult(_0x3cfeb2,null))['catch'](handleError(_0x3cfeb2,null));};exports[_0x2611('0x4c')]=function(_0x39a3d2,_0x2c0525,_0x3d0c3f){var _0x42a792={};var _0x2a50d1={};var _0x56f7ec;var _0x571c29;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x39a3d2[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x2c0525,null))[_0x2611('0x1f')](function(_0x4f00ec){if(_0x4f00ec){_0x56f7ec=_0x4f00ec;_0x2a50d1[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4d')][_0x2611('0x26')]);_0x2a50d1[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x39a3d2[_0x2611('0x2b')]);_0x2a50d1[_0x2611('0x2d')]=_[_0x2611('0x2e')](_0x2a50d1[_0x2611('0x2a')],_0x2a50d1[_0x2611('0x2b')]);_0x42a792['attributes']=_[_0x2611('0x2e')](_0x2a50d1[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x30')]));_0x42a792['attributes']=_0x42a792[_0x2611('0x2f')][_0x2611('0x31')]?_0x42a792[_0x2611('0x2f')]:_0x2a50d1[_0x2611('0x2a')];_0x42a792[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x36')]);_0x42a792[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x39a3d2[_0x2611('0x2b')],_0x2a50d1['filters']));if(_0x39a3d2[_0x2611('0x2b')][_0x2611('0x3b')]){_0x42a792[_0x2611('0x37')]=_[_0x2611('0x39')](_0x42a792[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x42a792[_0x2611('0x2f')],function(_0x5a00a7){var _0x2b6be4={};_0x2b6be4[_0x5a00a7]={'$like':'%'+_0x39a3d2[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x2b6be4;})});}_0x42a792=_[_0x2611('0x39')]({},_0x42a792,_0x39a3d2[_0x2611('0x43')]);return _0x56f7ec[_0x2611('0x4c')](_0x42a792);}})[_0x2611('0x1f')](function(_0x44254e){if(_0x44254e){_0x571c29=_0x44254e[_0x2611('0x31')];if(!_0x39a3d2['query'][_0x2611('0x32')]('nolimit')){_0x42a792[_0x2611('0x34')]=qs['limit'](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x34')]);_0x42a792['offset']=qs[_0x2611('0x16')](_0x39a3d2['query'][_0x2611('0x16')]);}return _0x56f7ec['getTags'](_0x42a792);}})[_0x2611('0x1f')](function(_0xf92eb5){if(_0xf92eb5){return _0xf92eb5?{'count':_0x571c29,'rows':_0xf92eb5}:null;}})[_0x2611('0x1f')](respondWithResult(_0x2c0525,null))[_0x2611('0x40')](handleError(_0x2c0525,null));};exports[_0x2611('0x4e')]=function(_0x24d929,_0x392c4e,_0x1628f3){if(_0x24d929['body']['id']){delete _0x24d929[_0x2611('0x46')]['id'];}return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x24d929[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x392c4e,null))['then'](function(_0x2e4620){if(_0x2e4620){return _0x2e4620[_0x2611('0x4e')](_0x24d929[_0x2611('0x46')][_0x2611('0x4f')]||[]);}return null;})[_0x2611('0x1f')](respondWithResult(_0x392c4e,null))[_0x2611('0x40')](handleError(_0x392c4e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ee81cda..4862389 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 _0x8d6b=['../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8d6b,0x124));var _0xb8d6=function(_0xc67a64,_0x5edc72){_0xc67a64=_0xc67a64-0x0;var _0xe4e1d2=_0x8d6b[_0xc67a64];return _0xe4e1d2;};'use strict';var _=require(_0xb8d6('0x0'));var util=require(_0xb8d6('0x1'));var logger=require(_0xb8d6('0x2'))(_0xb8d6('0x3'));var moment=require(_0xb8d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8d6('0x5'));var fs=require('fs');var path=require(_0xb8d6('0x6'));var rimraf=require(_0xb8d6('0x7'));var config=require(_0xb8d6('0x8'));var attributes=require(_0xb8d6('0x9'));module['exports']=function(_0x2a40a2,_0x1b38fa){return _0x2a40a2['define'](_0xb8d6('0xa'),attributes,{'tableName':_0xb8d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc86f=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xc86f,0xb3));var _0xfc86=function(_0x1ff171,_0x4012af){_0x1ff171=_0x1ff171-0x0;var _0x456656=_0xc86f[_0x1ff171];return _0x456656;};'use strict';var _=require('lodash');var util=require(_0xfc86('0x0'));var logger=require(_0xfc86('0x1'))(_0xfc86('0x2'));var moment=require(_0xfc86('0x3'));var BPromise=require(_0xfc86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc86('0x5'));var rimraf=require('rimraf');var config=require(_0xfc86('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xfc86('0x7')]=function(_0x419040,_0x487c9e){return _0x419040['define'](_0xfc86('0x8'),attributes,{'tableName':_0xfc86('0x9'),'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 1e0fa7b..3568593 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 _0x00f4=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x00f4,0x137));var _0x400f=function(_0x576737,_0x25aa7f){_0x576737=_0x576737-0x0;var _0x4995eb=_0x00f4[_0x576737];return _0x4995eb;};'use strict';var _=require(_0x400f('0x0'));var util=require('util');var moment=require(_0x400f('0x1'));var BPromise=require(_0x400f('0x2'));var rs=require(_0x400f('0x3'));var fs=require('fs');var Redis=require(_0x400f('0x4'));var db=require(_0x400f('0x5'))['db'];var utils=require(_0x400f('0x6'));var logger=require(_0x400f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x400f('0x8'));var client=jayson['client'][_0x400f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360f0e,_0x2efbc4,_0x1b9b4f){return new BPromise(function(_0x32a24e,_0x3e2cfb){return client[_0x400f('0xa')](_0x360f0e,_0x1b9b4f)['then'](function(_0x4c4174){logger[_0x400f('0xb')](_0x400f('0xc'),_0x2efbc4,_0x400f('0xd'));logger['debug'](_0x400f('0xe'),_0x2efbc4,_0x400f('0xd'),JSON['stringify'](_0x4c4174));if(_0x4c4174[_0x400f('0xf')]){if(_0x4c4174['error'][_0x400f('0x10')]===0x1f4){logger[_0x400f('0xf')](_0x400f('0xc'),_0x2efbc4,_0x4c4174[_0x400f('0xf')]['message']);return _0x3e2cfb(_0x4c4174['error']['message']);}logger[_0x400f('0xf')](_0x400f('0xc'),_0x2efbc4,_0x4c4174[_0x400f('0xf')][_0x400f('0x11')]);return _0x32a24e(_0x4c4174['error'][_0x400f('0x11')]);}else{logger[_0x400f('0xb')](_0x400f('0xc'),_0x2efbc4,_0x400f('0xd'));_0x32a24e(_0x4c4174[_0x400f('0x12')]['message']);}})[_0x400f('0x13')](function(_0x133f24){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2efbc4,_0x133f24);_0x3e2cfb(_0x133f24);});});} \ No newline at end of file +var _0x2d08=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x2d08,0x129));var _0x82d0=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x2d08[_0x41382c];return _0x4da35b;};'use strict';var _=require(_0x82d0('0x0'));var util=require(_0x82d0('0x1'));var moment=require(_0x82d0('0x2'));var BPromise=require(_0x82d0('0x3'));var rs=require(_0x82d0('0x4'));var fs=require('fs');var Redis=require(_0x82d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82d0('0x6'));var logger=require(_0x82d0('0x7'))('rpc');var config=require(_0x82d0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2715c7,_0x38d8bf,_0x4ef5ec){return new BPromise(function(_0x503cc3,_0x259f8f){return client[_0x82d0('0x9')](_0x2715c7,_0x4ef5ec)['then'](function(_0x1bb0ca){logger[_0x82d0('0xa')](_0x82d0('0xb'),_0x38d8bf,_0x82d0('0xc'));logger[_0x82d0('0xd')](_0x82d0('0xe'),_0x38d8bf,_0x82d0('0xc'),JSON[_0x82d0('0xf')](_0x1bb0ca));if(_0x1bb0ca[_0x82d0('0x10')]){if(_0x1bb0ca['error']['code']===0x1f4){logger[_0x82d0('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x38d8bf,_0x1bb0ca[_0x82d0('0x10')]['message']);return _0x259f8f(_0x1bb0ca['error'][_0x82d0('0x11')]);}logger[_0x82d0('0x10')](_0x82d0('0xb'),_0x38d8bf,_0x1bb0ca[_0x82d0('0x10')]['message']);return _0x503cc3(_0x1bb0ca[_0x82d0('0x10')][_0x82d0('0x11')]);}else{logger['info'](_0x82d0('0xb'),_0x38d8bf,_0x82d0('0xc'));_0x503cc3(_0x1bb0ca[_0x82d0('0x12')]['message']);}})[_0x82d0('0x13')](function(_0x59e46d){logger[_0x82d0('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x38d8bf,_0x59e46d);_0x259f8f(_0x59e46d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5fd2002..b7d3ec2 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 _0xb506=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb506,0x10c));var _0x6b50=function(_0x228a72,_0x486368){_0x228a72=_0x228a72-0x0;var _0x44c0d1=_0xb506[_0x228a72];return _0x44c0d1;};'use strict';var multer=require(_0x6b50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b50('0x1'));var express=require(_0x6b50('0x2'));var router=express[_0x6b50('0x3')]();var fs_extra=require(_0x6b50('0x4'));var auth=require(_0x6b50('0x5'));var interaction=require(_0x6b50('0x6'));var config=require('../../config/environment');var controller=require(_0x6b50('0x7'));router['get']('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0x9')]);router[_0x6b50('0xa')](_0x6b50('0xb'),auth['isAuthenticated'](),controller[_0x6b50('0xc')]);router[_0x6b50('0xd')]('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0xe')]);router['put'](_0x6b50('0xb'),auth[_0x6b50('0x8')](),controller['update']);router[_0x6b50('0xf')](_0x6b50('0xb'),auth['isAuthenticated'](),controller[_0x6b50('0x10')]);module[_0x6b50('0x11')]=router; \ No newline at end of file +var _0xf5b6=['delete','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','show','isAuthenticated','create','put'];(function(_0x1637e0,_0x1c956b){var _0x46ce9c=function(_0x44e0a1){while(--_0x44e0a1){_0x1637e0['push'](_0x1637e0['shift']());}};_0x46ce9c(++_0x1c956b);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x5ded4c,_0x2e3cb7){_0x5ded4c=_0x5ded4c-0x0;var _0xe188f5=_0xf5b6[_0x5ded4c];return _0xe188f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f5b('0x0'));var timeout=require(_0x6f5b('0x1'));var express=require(_0x6f5b('0x2'));var router=express[_0x6f5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f5b('0x4'));var interaction=require(_0x6f5b('0x5'));var config=require(_0x6f5b('0x6'));var controller=require(_0x6f5b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6f5b('0x8')]);router[_0x6f5b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f5b('0xa')]);router['post']('/',auth[_0x6f5b('0xb')](),controller[_0x6f5b('0xc')]);router[_0x6f5b('0xd')]('/:id',auth[_0x6f5b('0xb')](),controller['update']);router[_0x6f5b('0xe')](_0x6f5b('0xf'),auth[_0x6f5b('0xb')](),controller[_0x6f5b('0x10')]);module[_0x6f5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fdbfa7a..7c93717 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 _0x82d5=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x37b7a5,_0x5deea0){var _0x3e68d5=function(_0x50af6b){while(--_0x50af6b){_0x37b7a5['push'](_0x37b7a5['shift']());}};_0x3e68d5(++_0x5deea0);}(_0x82d5,0x144));var _0x582d=function(_0x282442,_0x185644){_0x282442=_0x282442-0x0;var _0x244748=_0x82d5[_0x282442];return _0x244748;};'use strict';var Sequelize=require(_0x582d('0x0'));module[_0x582d('0x1')]={'type':{'type':Sequelize[_0x582d('0x2')](_0x582d('0x3'),_0x582d('0x4'),_0x582d('0x5'),_0x582d('0x6'),_0x582d('0x7')),'defaultValue':_0x582d('0x3')},'content':{'type':Sequelize[_0x582d('0x8')]},'key':{'type':Sequelize[_0x582d('0x8')]},'keyType':{'type':Sequelize[_0x582d('0x2')](_0x582d('0x3'),_0x582d('0x4'),_0x582d('0x5'))},'keyContent':{'type':Sequelize[_0x582d('0x8')]},'idField':{'type':Sequelize[_0x582d('0x8')]},'nameField':{'type':Sequelize[_0x582d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa18a=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xa18a,0xfc));var _0xaa18=function(_0x513629,_0x2757a9){_0x513629=_0x513629-0x0;var _0x475bc7=_0xa18a[_0x513629];return _0x475bc7;};'use strict';var Sequelize=require(_0xaa18('0x0'));module['exports']={'type':{'type':Sequelize[_0xaa18('0x1')](_0xaa18('0x2'),_0xaa18('0x3'),_0xaa18('0x4'),_0xaa18('0x5'),_0xaa18('0x6')),'defaultValue':_0xaa18('0x2')},'content':{'type':Sequelize[_0xaa18('0x7')]},'key':{'type':Sequelize[_0xaa18('0x7')]},'keyType':{'type':Sequelize[_0xaa18('0x1')](_0xaa18('0x2'),_0xaa18('0x3'),_0xaa18('0x4'))},'keyContent':{'type':Sequelize[_0xaa18('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa18('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa18('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7bc6288..681d82b 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 _0xc16d=['length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','count','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','apply','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x1a605a,_0x5aa4aa){var _0x193a35=function(_0x343340){while(--_0x343340){_0x1a605a['push'](_0x1a605a['shift']());}};_0x193a35(++_0x5aa4aa);}(_0xc16d,0x145));var _0xdc16=function(_0x33c497,_0x5d7fb5){_0x33c497=_0x33c497-0x0;var _0x35179e=_0xc16d[_0x33c497];return _0x35179e;};'use strict';var emlformat=require(_0xdc16('0x0'));var rimraf=require(_0xdc16('0x1'));var zipdir=require(_0xdc16('0x2'));var jsonpatch=require(_0xdc16('0x3'));var rp=require(_0xdc16('0x4'));var moment=require(_0xdc16('0x5'));var BPromise=require(_0xdc16('0x6'));var Mustache=require('mustache');var util=require(_0xdc16('0x7'));var path=require(_0xdc16('0x8'));var sox=require(_0xdc16('0x9'));var csv=require(_0xdc16('0xa'));var ejs=require(_0xdc16('0xb'));var fs=require('fs');var fs_extra=require(_0xdc16('0xc'));var _=require(_0xdc16('0xd'));var squel=require(_0xdc16('0xe'));var crypto=require(_0xdc16('0xf'));var jsforce=require(_0xdc16('0x10'));var deskjs=require(_0xdc16('0x11'));var toCsv=require(_0xdc16('0xa'));var querystring=require(_0xdc16('0x12'));var Papa=require(_0xdc16('0x13'));var Redis=require(_0xdc16('0x14'));var authService=require(_0xdc16('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xdc16('0x16'));var hardwareService=require(_0xdc16('0x17'));var logger=require(_0xdc16('0x18'))(_0xdc16('0x19'));var utils=require('../../config/utils');var config=require(_0xdc16('0x1a'));var licenseUtil=require(_0xdc16('0x1b'));var db=require(_0xdc16('0x1c'))['db'];function respondWithStatusCode(_0x1224c6,_0x5137db){_0x5137db=_0x5137db||0xcc;return function(_0x42ce38){if(_0x42ce38){return _0x1224c6['sendStatus'](_0x5137db);}return _0x1224c6['status'](_0x5137db)[_0xdc16('0x1d')]();};}function respondWithResult(_0x50d023,_0x12bef5){_0x12bef5=_0x12bef5||0xc8;return function(_0x42b482){if(_0x42b482){return _0x50d023[_0xdc16('0x1e')](_0x12bef5)['json'](_0x42b482);}};}function respondWithFilteredResult(_0xd7ff38,_0x5a2b26){return function(_0x33d3e7){if(_0x33d3e7){var _0x13742b=typeof _0x5a2b26[_0xdc16('0x1f')]===_0xdc16('0x20')&&typeof _0x5a2b26['limit']===_0xdc16('0x20');var _0xc00f29=_0x33d3e7['count'];var _0x37b627=_0x13742b?0x0:_0x5a2b26[_0xdc16('0x1f')];var _0x1fc714=_0x13742b?_0x33d3e7['count']:_0x5a2b26['offset']+_0x5a2b26[_0xdc16('0x21')];var _0x5d9519;if(_0x1fc714>=_0xc00f29){_0x1fc714=_0xc00f29;_0x5d9519=0xc8;}else{_0x5d9519=0xce;}_0xd7ff38[_0xdc16('0x1e')](_0x5d9519);return _0xd7ff38['set']('Content-Range',_0x37b627+'-'+_0x1fc714+'/'+_0xc00f29)['json'](_0x33d3e7);}return null;};}function patchUpdates(_0x524949){return function(_0x192f74){try{jsonpatch[_0xdc16('0x22')](_0x192f74,_0x524949,!![]);}catch(_0x471522){return BPromise['reject'](_0x471522);}return _0x192f74['save']();};}function saveUpdates(_0x504c04,_0x1fdec0){return function(_0x50d974){if(_0x50d974){return _0x50d974[_0xdc16('0x23')](_0x504c04)[_0xdc16('0x24')](function(_0x1c0419){return _0x1c0419;});}return null;};}function removeEntity(_0x4ae7fc,_0x5c4b4a){return function(_0x46ee55){if(_0x46ee55){return _0x46ee55[_0xdc16('0x25')]()[_0xdc16('0x24')](function(){_0x4ae7fc[_0xdc16('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525789,_0x48747a){return function(_0x1efa8f){if(!_0x1efa8f){_0x525789[_0xdc16('0x26')](0x194);}return _0x1efa8f;};}function handleError(_0x14fc27,_0x4964a7){_0x4964a7=_0x4964a7||0x1f4;return function(_0x235f78){logger[_0xdc16('0x27')](_0x235f78[_0xdc16('0x28')]);if(_0x235f78[_0xdc16('0x29')]){delete _0x235f78['name'];}_0x14fc27['status'](_0x4964a7)[_0xdc16('0x2a')](_0x235f78);};}exports[_0xdc16('0x2b')]=function(_0x563f5b,_0x44f7b3){var _0x597a1c={},_0x338f7a={},_0x2da8ad={'count':0x0,'rows':[]};var _0x247392=_['map'](db[_0xdc16('0x2c')][_0xdc16('0x2d')],function(_0x224965){return{'name':_0x224965['fieldName'],'type':_0x224965[_0xdc16('0x2e')][_0xdc16('0x2f')]};});_0x338f7a[_0xdc16('0x30')]=_['map'](_0x247392,_0xdc16('0x29'));_0x338f7a[_0xdc16('0x31')]=_[_0xdc16('0x32')](_0x563f5b[_0xdc16('0x31')]);_0x338f7a[_0xdc16('0x33')]=_['intersection'](_0x338f7a[_0xdc16('0x30')],_0x338f7a[_0xdc16('0x31')]);_0x597a1c[_0xdc16('0x34')]=_[_0xdc16('0x35')](_0x338f7a[_0xdc16('0x30')],qs['fields'](_0x563f5b[_0xdc16('0x31')][_0xdc16('0x36')]));_0x597a1c[_0xdc16('0x34')]=_0x597a1c['attributes'][_0xdc16('0x37')]?_0x597a1c[_0xdc16('0x34')]:_0x338f7a[_0xdc16('0x30')];if(!_0x563f5b['query'][_0xdc16('0x38')]('nolimit')){_0x597a1c[_0xdc16('0x21')]=qs[_0xdc16('0x21')](_0x563f5b[_0xdc16('0x31')]['limit']);_0x597a1c['offset']=qs['offset'](_0x563f5b['query'][_0xdc16('0x1f')]);}_0x597a1c[_0xdc16('0x39')]=qs[_0xdc16('0x3a')](_0x563f5b[_0xdc16('0x31')]['sort']);_0x597a1c[_0xdc16('0x3b')]=qs[_0xdc16('0x33')](_[_0xdc16('0x3c')](_0x563f5b['query'],_0x338f7a['filters']),_0x247392);if(_0x563f5b[_0xdc16('0x31')]['filter']){_0x597a1c[_0xdc16('0x3b')]=_[_0xdc16('0x3d')](_0x597a1c[_0xdc16('0x3b')],{'$or':_[_0xdc16('0x3e')](_0x247392,function(_0x3167e7){if(_0x3167e7[_0xdc16('0x2e')]!==_0xdc16('0x3f')){var _0x599c2c={};_0x599c2c[_0x3167e7[_0xdc16('0x29')]]={'$like':'%'+_0x563f5b['query']['filter']+'%'};return _0x599c2c;}})});}_0x597a1c=_[_0xdc16('0x3d')]({},_0x597a1c,_0x563f5b['options']);var _0x4f5e8a={'where':_0x597a1c[_0xdc16('0x3b')]};return db[_0xdc16('0x2c')][_0xdc16('0x40')](_0x4f5e8a)[_0xdc16('0x24')](function(_0x3b67bf){_0x2da8ad[_0xdc16('0x40')]=_0x3b67bf;if(_0x563f5b[_0xdc16('0x31')]['includeAll']){_0x597a1c[_0xdc16('0x41')]=[{'all':!![]}];}return db['DeskField'][_0xdc16('0x42')](_0x597a1c);})['then'](function(_0x52386d){_0x2da8ad[_0xdc16('0x43')]=_0x52386d;return _0x2da8ad;})[_0xdc16('0x24')](respondWithFilteredResult(_0x44f7b3,_0x597a1c))[_0xdc16('0x44')](handleError(_0x44f7b3,null));};exports[_0xdc16('0x45')]=function(_0x1036f3,_0x2e8964){var _0x34af1b={'raw':!![],'where':{'id':_0x1036f3['params']['id']}},_0x4de320={};_0x4de320[_0xdc16('0x30')]=_[_0xdc16('0x32')](db[_0xdc16('0x2c')][_0xdc16('0x2d')]);_0x4de320[_0xdc16('0x31')]=_[_0xdc16('0x32')](_0x1036f3[_0xdc16('0x31')]);_0x4de320[_0xdc16('0x33')]=_[_0xdc16('0x35')](_0x4de320[_0xdc16('0x30')],_0x4de320[_0xdc16('0x31')]);_0x34af1b[_0xdc16('0x34')]=_[_0xdc16('0x35')](_0x4de320[_0xdc16('0x30')],qs[_0xdc16('0x36')](_0x1036f3[_0xdc16('0x31')]['fields']));_0x34af1b[_0xdc16('0x34')]=_0x34af1b['attributes']['length']?_0x34af1b[_0xdc16('0x34')]:_0x4de320[_0xdc16('0x30')];if(_0x1036f3[_0xdc16('0x31')][_0xdc16('0x46')]){_0x34af1b[_0xdc16('0x41')]=[{'all':!![]}];}_0x34af1b=_[_0xdc16('0x3d')]({},_0x34af1b,_0x1036f3[_0xdc16('0x47')]);return db[_0xdc16('0x2c')][_0xdc16('0x48')](_0x34af1b)['then'](handleEntityNotFound(_0x2e8964,null))[_0xdc16('0x24')](respondWithResult(_0x2e8964,null))[_0xdc16('0x44')](handleError(_0x2e8964,null));};exports[_0xdc16('0x49')]=function(_0x33f50e,_0x2061a4){return db[_0xdc16('0x2c')][_0xdc16('0x49')](_0x33f50e['body'],{})[_0xdc16('0x24')](respondWithResult(_0x2061a4,0xc9))[_0xdc16('0x44')](handleError(_0x2061a4,null));};exports[_0xdc16('0x23')]=function(_0x4f6455,_0x1fbb49){if(_0x4f6455[_0xdc16('0x4a')]['id']){delete _0x4f6455[_0xdc16('0x4a')]['id'];}return db['DeskField'][_0xdc16('0x48')]({'where':{'id':_0x4f6455[_0xdc16('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1fbb49,null))[_0xdc16('0x24')](saveUpdates(_0x4f6455['body'],null))[_0xdc16('0x24')](respondWithResult(_0x1fbb49,null))[_0xdc16('0x44')](handleError(_0x1fbb49,null));};exports[_0xdc16('0x25')]=function(_0x2a1d0d,_0x2a2521){return db[_0xdc16('0x2c')][_0xdc16('0x48')]({'where':{'id':_0x2a1d0d[_0xdc16('0x4b')]['id']}})[_0xdc16('0x24')](handleEntityNotFound(_0x2a2521,null))[_0xdc16('0x24')](removeEntity(_0x2a2521,null))[_0xdc16('0x44')](handleError(_0x2a2521,null));}; \ No newline at end of file +var _0x3f96=['includeAll','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3f96,0x1d3));var _0x63f9=function(_0x4c9fc2,_0x3dd29e){_0x4c9fc2=_0x4c9fc2-0x0;var _0x234f26=_0x3f96[_0x4c9fc2];return _0x234f26;};'use strict';var emlformat=require(_0x63f9('0x0'));var rimraf=require(_0x63f9('0x1'));var zipdir=require(_0x63f9('0x2'));var jsonpatch=require(_0x63f9('0x3'));var rp=require(_0x63f9('0x4'));var moment=require('moment');var BPromise=require(_0x63f9('0x5'));var Mustache=require(_0x63f9('0x6'));var util=require(_0x63f9('0x7'));var path=require(_0x63f9('0x8'));var sox=require(_0x63f9('0x9'));var csv=require('to-csv');var ejs=require(_0x63f9('0xa'));var fs=require('fs');var fs_extra=require(_0x63f9('0xb'));var _=require(_0x63f9('0xc'));var squel=require(_0x63f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x63f9('0xe'));var deskjs=require(_0x63f9('0xf'));var toCsv=require(_0x63f9('0x10'));var querystring=require(_0x63f9('0x11'));var Papa=require(_0x63f9('0x12'));var Redis=require(_0x63f9('0x13'));var authService=require(_0x63f9('0x14'));var qs=require(_0x63f9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f9('0x16'));var logger=require(_0x63f9('0x17'))('api');var utils=require(_0x63f9('0x18'));var config=require(_0x63f9('0x19'));var licenseUtil=require(_0x63f9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45881b,_0x376780){_0x376780=_0x376780||0xcc;return function(_0x7025cc){if(_0x7025cc){return _0x45881b[_0x63f9('0x1b')](_0x376780);}return _0x45881b[_0x63f9('0x1c')](_0x376780)[_0x63f9('0x1d')]();};}function respondWithResult(_0x31997c,_0x51ec79){_0x51ec79=_0x51ec79||0xc8;return function(_0x19b409){if(_0x19b409){return _0x31997c['status'](_0x51ec79)[_0x63f9('0x1e')](_0x19b409);}};}function respondWithFilteredResult(_0x52be5e,_0x47050b){return function(_0x1fa6dd){if(_0x1fa6dd){var _0x37fc43=typeof _0x47050b[_0x63f9('0x1f')]===_0x63f9('0x20')&&typeof _0x47050b[_0x63f9('0x21')]===_0x63f9('0x20');var _0x5e25ae=_0x1fa6dd[_0x63f9('0x22')];var _0x4475d9=_0x37fc43?0x0:_0x47050b[_0x63f9('0x1f')];var _0x41d3a3=_0x37fc43?_0x1fa6dd[_0x63f9('0x22')]:_0x47050b['offset']+_0x47050b[_0x63f9('0x21')];var _0x30aa4d;if(_0x41d3a3>=_0x5e25ae){_0x41d3a3=_0x5e25ae;_0x30aa4d=0xc8;}else{_0x30aa4d=0xce;}_0x52be5e[_0x63f9('0x1c')](_0x30aa4d);return _0x52be5e['set'](_0x63f9('0x23'),_0x4475d9+'-'+_0x41d3a3+'/'+_0x5e25ae)[_0x63f9('0x1e')](_0x1fa6dd);}return null;};}function patchUpdates(_0x170f4){return function(_0x262b43){try{jsonpatch[_0x63f9('0x24')](_0x262b43,_0x170f4,!![]);}catch(_0x537a11){return BPromise['reject'](_0x537a11);}return _0x262b43[_0x63f9('0x25')]();};}function saveUpdates(_0x3926a2,_0x3c0589){return function(_0x39c2d4){if(_0x39c2d4){return _0x39c2d4[_0x63f9('0x26')](_0x3926a2)[_0x63f9('0x27')](function(_0x3720c9){return _0x3720c9;});}return null;};}function removeEntity(_0x549454,_0x5994c1){return function(_0x33092b){if(_0x33092b){return _0x33092b[_0x63f9('0x28')]()[_0x63f9('0x27')](function(){_0x549454[_0x63f9('0x1c')](0xcc)[_0x63f9('0x1d')]();});}};}function handleEntityNotFound(_0x62c363,_0x3e3c14){return function(_0xbb9716){if(!_0xbb9716){_0x62c363['sendStatus'](0x194);}return _0xbb9716;};}function handleError(_0x4abbf2,_0x5cf43d){_0x5cf43d=_0x5cf43d||0x1f4;return function(_0x1fcb7c){logger[_0x63f9('0x29')](_0x1fcb7c[_0x63f9('0x2a')]);if(_0x1fcb7c['name']){delete _0x1fcb7c[_0x63f9('0x2b')];}_0x4abbf2['status'](_0x5cf43d)[_0x63f9('0x2c')](_0x1fcb7c);};}exports[_0x63f9('0x2d')]=function(_0x25f5f0,_0x51c84b){var _0x1b56bd={},_0x3e6728={},_0x271872={'count':0x0,'rows':[]};var _0x22a82a=_[_0x63f9('0x2e')](db[_0x63f9('0x2f')]['rawAttributes'],function(_0x32f2d5){return{'name':_0x32f2d5[_0x63f9('0x30')],'type':_0x32f2d5[_0x63f9('0x31')][_0x63f9('0x32')]};});_0x3e6728[_0x63f9('0x33')]=_[_0x63f9('0x2e')](_0x22a82a,_0x63f9('0x2b'));_0x3e6728[_0x63f9('0x34')]=_[_0x63f9('0x35')](_0x25f5f0['query']);_0x3e6728[_0x63f9('0x36')]=_['intersection'](_0x3e6728[_0x63f9('0x33')],_0x3e6728[_0x63f9('0x34')]);_0x1b56bd[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x3e6728[_0x63f9('0x33')],qs['fields'](_0x25f5f0[_0x63f9('0x34')]['fields']));_0x1b56bd['attributes']=_0x1b56bd[_0x63f9('0x37')][_0x63f9('0x39')]?_0x1b56bd[_0x63f9('0x37')]:_0x3e6728['model'];if(!_0x25f5f0[_0x63f9('0x34')]['hasOwnProperty'](_0x63f9('0x3a'))){_0x1b56bd[_0x63f9('0x21')]=qs[_0x63f9('0x21')](_0x25f5f0['query']['limit']);_0x1b56bd[_0x63f9('0x1f')]=qs[_0x63f9('0x1f')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x1f')]);}_0x1b56bd['order']=qs[_0x63f9('0x3b')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3b')]);_0x1b56bd[_0x63f9('0x3c')]=qs['filters'](_[_0x63f9('0x3d')](_0x25f5f0[_0x63f9('0x34')],_0x3e6728[_0x63f9('0x36')]),_0x22a82a);if(_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]){_0x1b56bd[_0x63f9('0x3c')]=_[_0x63f9('0x3f')](_0x1b56bd[_0x63f9('0x3c')],{'$or':_[_0x63f9('0x2e')](_0x22a82a,function(_0x54f4d0){if(_0x54f4d0[_0x63f9('0x31')]!==_0x63f9('0x40')){var _0x110aa1={};_0x110aa1[_0x54f4d0[_0x63f9('0x2b')]]={'$like':'%'+_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]+'%'};return _0x110aa1;}})});}_0x1b56bd=_['merge']({},_0x1b56bd,_0x25f5f0[_0x63f9('0x41')]);var _0x2f1202={'where':_0x1b56bd[_0x63f9('0x3c')]};return db[_0x63f9('0x2f')][_0x63f9('0x22')](_0x2f1202)[_0x63f9('0x27')](function(_0x1d733a){_0x271872[_0x63f9('0x22')]=_0x1d733a;if(_0x25f5f0['query']['includeAll']){_0x1b56bd['include']=[{'all':!![]}];}return db['DeskField'][_0x63f9('0x42')](_0x1b56bd);})[_0x63f9('0x27')](function(_0x19a603){_0x271872[_0x63f9('0x43')]=_0x19a603;return _0x271872;})[_0x63f9('0x27')](respondWithFilteredResult(_0x51c84b,_0x1b56bd))[_0x63f9('0x44')](handleError(_0x51c84b,null));};exports[_0x63f9('0x45')]=function(_0x16a1f3,_0x388261){var _0x5f53ab={'raw':!![],'where':{'id':_0x16a1f3['params']['id']}},_0x23ee18={};_0x23ee18[_0x63f9('0x33')]=_['keys'](db[_0x63f9('0x2f')][_0x63f9('0x46')]);_0x23ee18[_0x63f9('0x34')]=_['keys'](_0x16a1f3[_0x63f9('0x34')]);_0x23ee18[_0x63f9('0x36')]=_[_0x63f9('0x38')](_0x23ee18['model'],_0x23ee18['query']);_0x5f53ab[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x23ee18[_0x63f9('0x33')],qs[_0x63f9('0x47')](_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x47')]));_0x5f53ab['attributes']=_0x5f53ab[_0x63f9('0x37')][_0x63f9('0x39')]?_0x5f53ab['attributes']:_0x23ee18[_0x63f9('0x33')];if(_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x48')]){_0x5f53ab['include']=[{'all':!![]}];}_0x5f53ab=_['merge']({},_0x5f53ab,_0x16a1f3[_0x63f9('0x41')]);return db[_0x63f9('0x2f')]['find'](_0x5f53ab)[_0x63f9('0x27')](handleEntityNotFound(_0x388261,null))[_0x63f9('0x27')](respondWithResult(_0x388261,null))[_0x63f9('0x44')](handleError(_0x388261,null));};exports[_0x63f9('0x49')]=function(_0x119b8e,_0x51d818){return db[_0x63f9('0x2f')][_0x63f9('0x49')](_0x119b8e[_0x63f9('0x4a')],{})['then'](respondWithResult(_0x51d818,0xc9))['catch'](handleError(_0x51d818,null));};exports['update']=function(_0x4e6466,_0x13803d){if(_0x4e6466[_0x63f9('0x4a')]['id']){delete _0x4e6466[_0x63f9('0x4a')]['id'];}return db['DeskField']['find']({'where':{'id':_0x4e6466[_0x63f9('0x4b')]['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x13803d,null))[_0x63f9('0x27')](saveUpdates(_0x4e6466[_0x63f9('0x4a')],null))[_0x63f9('0x27')](respondWithResult(_0x13803d,null))[_0x63f9('0x44')](handleError(_0x13803d,null));};exports[_0x63f9('0x28')]=function(_0x387aa5,_0x53f06f){return db[_0x63f9('0x2f')][_0x63f9('0x4c')]({'where':{'id':_0x387aa5['params']['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x53f06f,null))[_0x63f9('0x27')](removeEntity(_0x53f06f,null))['catch'](handleError(_0x53f06f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bc875d3..f04f104 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 _0xc1a3=['exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./intDeskField.attributes'];(function(_0x3c2ccc,_0x44120d){var _0x306570=function(_0x4200d2){while(--_0x4200d2){_0x3c2ccc['push'](_0x3c2ccc['shift']());}};_0x306570(++_0x44120d);}(_0xc1a3,0x7b));var _0x3c1a=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xc1a3[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x3c1a('0x0'));var util=require(_0x3c1a('0x1'));var logger=require(_0x3c1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c1a('0x3'));var rp=require(_0x3c1a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c1a('0x5'));var config=require('../../config/environment');var attributes=require(_0x3c1a('0x6'));module[_0x3c1a('0x7')]=function(_0xeef068,_0x175394){return _0xeef068[_0x3c1a('0x8')](_0x3c1a('0x9'),attributes,{'tableName':_0x3c1a('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x3c1a('0xb'),_0x3c1a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe11c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x269463,_0x100559){var _0x46fbe9=function(_0x5511e8){while(--_0x5511e8){_0x269463['push'](_0x269463['shift']());}};_0x46fbe9(++_0x100559);}(_0xe11c,0x161));var _0xce11=function(_0x5156b9,_0x415e08){_0x5156b9=_0x5156b9-0x0;var _0x227fd7=_0xe11c[_0x5156b9];return _0x227fd7;};'use strict';var _=require(_0xce11('0x0'));var util=require(_0xce11('0x1'));var logger=require(_0xce11('0x2'))(_0xce11('0x3'));var moment=require(_0xce11('0x4'));var BPromise=require(_0xce11('0x5'));var rp=require(_0xce11('0x6'));var fs=require('fs');var path=require(_0xce11('0x7'));var rimraf=require(_0xce11('0x8'));var config=require(_0xce11('0x9'));var attributes=require(_0xce11('0xa'));module[_0xce11('0xb')]=function(_0x54c12f,_0xee7777){return _0x54c12f[_0xce11('0xc')](_0xce11('0xd'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xce11('0xe'),'fields':[_0xce11('0xf'),_0xce11('0x10')],'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 f5a1f17..a45d555 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 _0x0100=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug'];(function(_0x434d7c,_0x270614){var _0x512c7c=function(_0x4920d6){while(--_0x4920d6){_0x434d7c['push'](_0x434d7c['shift']());}};_0x512c7c(++_0x270614);}(_0x0100,0xcc));var _0x0010=function(_0x36f0d4,_0x59d034){_0x36f0d4=_0x36f0d4-0x0;var _0x4d3c56=_0x0100[_0x36f0d4];return _0x4d3c56;};'use strict';var _=require(_0x0010('0x0'));var util=require(_0x0010('0x1'));var moment=require(_0x0010('0x2'));var BPromise=require('bluebird');var rs=require(_0x0010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0010('0x4'))['db'];var utils=require(_0x0010('0x5'));var logger=require(_0x0010('0x6'))(_0x0010('0x7'));var config=require('../../config/environment');var jayson=require(_0x0010('0x8'));var client=jayson[_0x0010('0x9')][_0x0010('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370640,_0x41ffdc,_0x58b1c6){return new BPromise(function(_0x556f9c,_0x29613d){return client[_0x0010('0xb')](_0x370640,_0x58b1c6)[_0x0010('0xc')](function(_0x88888){logger[_0x0010('0xd')](_0x0010('0xe'),_0x41ffdc,'request\x20sent');logger[_0x0010('0xf')](_0x0010('0x10'),_0x41ffdc,_0x0010('0x11'),JSON['stringify'](_0x88888));if(_0x88888['error']){if(_0x88888[_0x0010('0x12')][_0x0010('0x13')]===0x1f4){logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0x88888[_0x0010('0x12')]['message']);return _0x29613d(_0x88888[_0x0010('0x12')]['message']);}logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0x88888[_0x0010('0x12')][_0x0010('0x14')]);return _0x556f9c(_0x88888[_0x0010('0x12')][_0x0010('0x14')]);}else{logger[_0x0010('0xd')](_0x0010('0xe'),_0x41ffdc,_0x0010('0x11'));_0x556f9c(_0x88888['result'][_0x0010('0x14')]);}})[_0x0010('0x15')](function(_0xb5a788){logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0xb5a788);_0x29613d(_0xb5a788);});});} \ No newline at end of file +var _0x7d36=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2fad50,_0x2fd2a6){var _0x314179=function(_0x50b284){while(--_0x50b284){_0x2fad50['push'](_0x2fad50['shift']());}};_0x314179(++_0x2fd2a6);}(_0x7d36,0x6c));var _0x67d3=function(_0x4fdf54,_0x38d439){_0x4fdf54=_0x4fdf54-0x0;var _0x3610cd=_0x7d36[_0x4fdf54];return _0x3610cd;};'use strict';var _=require(_0x67d3('0x0'));var util=require(_0x67d3('0x1'));var moment=require(_0x67d3('0x2'));var BPromise=require(_0x67d3('0x3'));var rs=require(_0x67d3('0x4'));var fs=require('fs');var Redis=require(_0x67d3('0x5'));var db=require(_0x67d3('0x6'))['db'];var utils=require(_0x67d3('0x7'));var logger=require(_0x67d3('0x8'))(_0x67d3('0x9'));var config=require(_0x67d3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x67d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53c426,_0x539fa2,_0x450dbe){return new BPromise(function(_0x593e97,_0x5417a3){return client[_0x67d3('0xc')](_0x53c426,_0x450dbe)['then'](function(_0x5616d8){logger['info'](_0x67d3('0xd'),_0x539fa2,_0x67d3('0xe'));logger[_0x67d3('0xf')](_0x67d3('0x10'),_0x539fa2,_0x67d3('0xe'),JSON[_0x67d3('0x11')](_0x5616d8));if(_0x5616d8[_0x67d3('0x12')]){if(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x13')]===0x1f4){logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);return _0x5417a3(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);}logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);return _0x593e97(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x539fa2,_0x67d3('0xe'));_0x593e97(_0x5616d8[_0x67d3('0x15')][_0x67d3('0x14')]);}})[_0x67d3('0x16')](function(_0x24f4ed){logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x24f4ed);_0x5417a3(_0x24f4ed);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 08bab67..1a397cb 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 _0xeae4=['/:id/fields','getFields','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x1f7075,_0x3ca810){var _0x14562d=function(_0x14edb5){while(--_0x14edb5){_0x1f7075['push'](_0x1f7075['shift']());}};_0x14562d(++_0x3ca810);}(_0xeae4,0x17c));var _0x4eae=function(_0x4e82e8,_0x27866c){_0x4e82e8=_0x4e82e8-0x0;var _0x39aa22=_0xeae4[_0x4e82e8];return _0x39aa22;};'use strict';var multer=require(_0x4eae('0x0'));var util=require(_0x4eae('0x1'));var path=require(_0x4eae('0x2'));var timeout=require(_0x4eae('0x3'));var express=require(_0x4eae('0x4'));var router=express[_0x4eae('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4eae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eae('0x7'));var controller=require(_0x4eae('0x8'));router[_0x4eae('0x9')]('/',auth[_0x4eae('0xa')](),controller[_0x4eae('0xb')]);router['get'](_0x4eae('0xc'),auth[_0x4eae('0xa')](),controller[_0x4eae('0xd')]);router[_0x4eae('0x9')](_0x4eae('0xe'),auth[_0x4eae('0xa')](),controller[_0x4eae('0xf')]);router[_0x4eae('0x9')](_0x4eae('0x10'),auth[_0x4eae('0xa')](),controller[_0x4eae('0x11')]);router[_0x4eae('0x12')]('/',auth[_0x4eae('0xa')](),controller['create']);router[_0x4eae('0x12')](_0x4eae('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x4eae('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4eae('0x13')](_0x4eae('0xc'),auth['isAuthenticated'](),controller[_0x4eae('0x14')]);module[_0x4eae('0x15')]=router; \ No newline at end of file +var _0x4748=['addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4748,0x14e));var _0x8474=function(_0x2ebe8d,_0x4150a3){_0x2ebe8d=_0x2ebe8d-0x0;var _0x2c8de4=_0x4748[_0x2ebe8d];return _0x2c8de4;};'use strict';var multer=require(_0x8474('0x0'));var util=require('util');var path=require(_0x8474('0x1'));var timeout=require(_0x8474('0x2'));var express=require(_0x8474('0x3'));var router=express[_0x8474('0x4')]();var fs_extra=require(_0x8474('0x5'));var auth=require(_0x8474('0x6'));var interaction=require(_0x8474('0x7'));var config=require('../../config/environment');var controller=require(_0x8474('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8474('0x9')]);router[_0x8474('0xa')](_0x8474('0xb'),auth[_0x8474('0xc')](),controller[_0x8474('0xd')]);router['get'](_0x8474('0xe'),auth[_0x8474('0xc')](),controller[_0x8474('0xf')]);router['get'](_0x8474('0x10'),auth[_0x8474('0xc')](),controller['getFields']);router[_0x8474('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8474('0x11')](_0x8474('0xe'),auth[_0x8474('0xc')](),controller[_0x8474('0x12')]);router['put'](_0x8474('0xb'),auth[_0x8474('0xc')](),controller['update']);router[_0x8474('0x13')](_0x8474('0xb'),auth[_0x8474('0xc')](),controller[_0x8474('0x14')]);module[_0x8474('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1038d4d..d837341 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 _0x280b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x13ad2f,_0x2f99cb){var _0x509efd=function(_0x5a1c0e){while(--_0x5a1c0e){_0x13ad2f['push'](_0x13ad2f['shift']());}};_0x509efd(++_0x2f99cb);}(_0x280b,0xce));var _0xb280=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x280b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xb280('0x0'));module[_0xb280('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb280('0x2')]},'password':{'type':Sequelize[_0xb280('0x2')]},'remoteUri':{'type':Sequelize[_0xb280('0x2')]},'tenantId':{'type':Sequelize[_0xb280('0x2')]},'clientId':{'type':Sequelize[_0xb280('0x2')]},'clientSecret':{'type':Sequelize[_0xb280('0x2')]},'serverUrl':{'type':Sequelize[_0xb280('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb280('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb280('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6808=['BOOLEAN','sequelize','exports','STRING'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x6808,0xd1));var _0x8680=function(_0x3451ce,_0x4463ac){_0x3451ce=_0x3451ce-0x0;var _0xb78cfd=_0x6808[_0x3451ce];return _0xb78cfd;};'use strict';var Sequelize=require(_0x8680('0x0'));module[_0x8680('0x1')]={'name':{'type':Sequelize[_0x8680('0x2')]},'username':{'type':Sequelize[_0x8680('0x2')]},'password':{'type':Sequelize[_0x8680('0x2')]},'remoteUri':{'type':Sequelize[_0x8680('0x2')]},'tenantId':{'type':Sequelize[_0x8680('0x2')]},'clientId':{'type':Sequelize[_0x8680('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8680('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8680('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8680('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f9b4983..317a7b4 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 _0xcfa3=['getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','tenantId','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','catch','create','body','params','find','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','Subjects'];(function(_0x28ab78,_0x1b3462){var _0x2abc34=function(_0x5ef548){while(--_0x5ef548){_0x28ab78['push'](_0x28ab78['shift']());}};_0x2abc34(++_0x1b3462);}(_0xcfa3,0x88));var _0x3cfa=function(_0x2732b6,_0x39e5a1){_0x2732b6=_0x2732b6-0x0;var _0xd95214=_0xcfa3[_0x2732b6];return _0xd95214;};'use strict';var rp=require('request-promise');var util=require(_0x3cfa('0x0'));var _=require('lodash');var qs=require(_0x3cfa('0x1'));var logger=require(_0x3cfa('0x2'))('api');var db=require(_0x3cfa('0x3'))['db'];var integrations=require(_0x3cfa('0x4'));function respondWithResult(_0xb7434a,_0x156845){_0x156845=_0x156845||0xc8;return function(_0x1b98a3){if(_0x1b98a3){return _0xb7434a[_0x3cfa('0x5')](_0x156845)[_0x3cfa('0x6')](_0x1b98a3);}};}function respondWithFilteredResult(_0x454773,_0x568844){return function(_0x162ee7){if(_0x162ee7){var _0x3a7790=typeof _0x568844['offset']===_0x3cfa('0x7')&&typeof _0x568844['limit']==='undefined';var _0x870fa3=_0x162ee7[_0x3cfa('0x8')];var _0x3e1a35=_0x3a7790?0x0:_0x568844[_0x3cfa('0x9')];var _0x91dcae=_0x3a7790?_0x162ee7[_0x3cfa('0x8')]:_0x568844[_0x3cfa('0x9')]+_0x568844['limit'];var _0xc4c3a5;if(_0x91dcae>=_0x870fa3){_0x91dcae=_0x870fa3;_0xc4c3a5=0xc8;}else{_0xc4c3a5=0xce;}_0x454773[_0x3cfa('0x5')](_0xc4c3a5);return _0x454773['set'](_0x3cfa('0xa'),_0x3e1a35+'-'+_0x91dcae+'/'+_0x870fa3)[_0x3cfa('0x6')](_0x162ee7);}return null;};}function saveUpdates(_0x295f21){return function(_0x5e6d84){if(_0x5e6d84){return _0x5e6d84[_0x3cfa('0xb')](_0x295f21)[_0x3cfa('0xc')](function(_0x4c2044){return _0x4c2044;});}return null;};}function removeEntity(_0x223212){return function(_0x17ba2a){if(_0x17ba2a){return _0x17ba2a[_0x3cfa('0xd')]()[_0x3cfa('0xc')](function(){_0x223212[_0x3cfa('0x5')](0xcc)[_0x3cfa('0xe')]();});}};}function handleEntityNotFound(_0x3e7cf3){return function(_0x40ef51){if(!_0x40ef51){_0x3e7cf3[_0x3cfa('0xf')](0x194);}return _0x40ef51;};}function handleError(_0x254fd5,_0x176906){_0x176906=_0x176906||0x1f4;return function(_0xc16ce5){logger[_0x3cfa('0x10')](_0xc16ce5[_0x3cfa('0x11')]);if(_0xc16ce5[_0x3cfa('0x12')]){delete _0xc16ce5[_0x3cfa('0x12')];}_0x254fd5[_0x3cfa('0x5')](_0x176906)[_0x3cfa('0x13')](_0xc16ce5);};}exports[_0x3cfa('0x14')]=function(_0x42754a,_0x3d8ace){var _0x405414={},_0x1f655a={},_0x23c7b0={'count':0x0,'rows':[]};var _0x51699a=_[_0x3cfa('0x15')](db[_0x3cfa('0x16')]['rawAttributes'],function(_0x45ee11){return{'name':_0x45ee11['fieldName'],'type':_0x45ee11[_0x3cfa('0x17')][_0x3cfa('0x18')]};});_0x1f655a[_0x3cfa('0x19')]=_['map'](_0x51699a,'name');_0x1f655a[_0x3cfa('0x1a')]=_[_0x3cfa('0x1b')](_0x42754a[_0x3cfa('0x1a')]);_0x1f655a[_0x3cfa('0x1c')]=_['intersection'](_0x1f655a[_0x3cfa('0x19')],_0x1f655a[_0x3cfa('0x1a')]);_0x405414['attributes']=_[_0x3cfa('0x1d')](_0x1f655a[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x42754a['query']['fields']));_0x405414[_0x3cfa('0x1f')]=_0x405414[_0x3cfa('0x1f')][_0x3cfa('0x20')]?_0x405414[_0x3cfa('0x1f')]:_0x1f655a['model'];if(!_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x21')](_0x3cfa('0x22'))){_0x405414['limit']=qs[_0x3cfa('0x23')](_0x42754a['query'][_0x3cfa('0x23')]);_0x405414[_0x3cfa('0x9')]=qs['offset'](_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x9')]);}_0x405414[_0x3cfa('0x24')]=qs[_0x3cfa('0x25')](_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x25')]);_0x405414[_0x3cfa('0x26')]=qs[_0x3cfa('0x1c')](_[_0x3cfa('0x27')](_0x42754a[_0x3cfa('0x1a')],_0x1f655a[_0x3cfa('0x1c')]),_0x51699a);if(_0x42754a['query'][_0x3cfa('0x28')]){_0x405414[_0x3cfa('0x26')]=_[_0x3cfa('0x29')](_0x405414['where'],{'$or':_[_0x3cfa('0x15')](_0x51699a,function(_0x5b9184){if(_0x5b9184[_0x3cfa('0x17')]!==_0x3cfa('0x2a')){var _0x9f7d78={};_0x9f7d78[_0x5b9184[_0x3cfa('0x12')]]={'$like':'%'+_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x28')]+'%'};return _0x9f7d78;}})});}_0x405414=_[_0x3cfa('0x29')]({},_0x405414,_0x42754a[_0x3cfa('0x2b')]);var _0x246659={'where':_0x405414[_0x3cfa('0x26')]};return db[_0x3cfa('0x16')][_0x3cfa('0x8')](_0x246659)[_0x3cfa('0xc')](function(_0x38fc42){_0x23c7b0[_0x3cfa('0x8')]=_0x38fc42;if(_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x2c')]){_0x405414[_0x3cfa('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3cfa('0x2e')](_0x405414);})[_0x3cfa('0xc')](function(_0x561618){_0x23c7b0[_0x3cfa('0x2f')]=_0x561618;return _0x23c7b0;})[_0x3cfa('0xc')](respondWithFilteredResult(_0x3d8ace,_0x405414))['catch'](handleError(_0x3d8ace,null));};exports['show']=function(_0x45b7a7,_0x43ab5a){var _0x43a948={'raw':![],'where':{'id':_0x45b7a7['params']['id']}},_0x4c72fb={};_0x4c72fb[_0x3cfa('0x19')]=_[_0x3cfa('0x1b')](db['Dynamics365Account'][_0x3cfa('0x30')]);_0x4c72fb[_0x3cfa('0x1a')]=_['keys'](_0x45b7a7[_0x3cfa('0x1a')]);_0x4c72fb[_0x3cfa('0x1c')]=_[_0x3cfa('0x1d')](_0x4c72fb[_0x3cfa('0x19')],_0x4c72fb['query']);_0x43a948[_0x3cfa('0x1f')]=_[_0x3cfa('0x1d')](_0x4c72fb[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x45b7a7[_0x3cfa('0x1a')]['fields']));_0x43a948['attributes']=_0x43a948[_0x3cfa('0x1f')]['length']?_0x43a948[_0x3cfa('0x1f')]:_0x4c72fb[_0x3cfa('0x19')];if(_0x45b7a7[_0x3cfa('0x1a')][_0x3cfa('0x2c')]){_0x43a948['include']=[{'all':!![]}];}_0x43a948=_[_0x3cfa('0x29')]({},_0x43a948,_0x45b7a7[_0x3cfa('0x2b')]);return db['Dynamics365Account']['find'](_0x43a948)[_0x3cfa('0xc')](handleEntityNotFound(_0x43ab5a,null))[_0x3cfa('0xc')](respondWithResult(_0x43ab5a,null))[_0x3cfa('0x31')](handleError(_0x43ab5a,null));};exports[_0x3cfa('0x32')]=function(_0x30b018,_0x10937e){return db[_0x3cfa('0x16')]['create'](_0x30b018[_0x3cfa('0x33')],{})[_0x3cfa('0xc')](respondWithResult(_0x10937e,0xc9))[_0x3cfa('0x31')](handleError(_0x10937e,null));};exports[_0x3cfa('0xb')]=function(_0x5d60ec,_0x4b6bd5){if(_0x5d60ec['body']['id']){delete _0x5d60ec[_0x3cfa('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5d60ec[_0x3cfa('0x34')]['id']}})['then'](handleEntityNotFound(_0x4b6bd5,null))[_0x3cfa('0xc')](saveUpdates(_0x5d60ec['body'],null))[_0x3cfa('0xc')](respondWithResult(_0x4b6bd5,null))[_0x3cfa('0x31')](handleError(_0x4b6bd5,null));};exports[_0x3cfa('0xd')]=function(_0x5f47b9,_0x14ecb4){return db[_0x3cfa('0x16')][_0x3cfa('0x35')]({'where':{'id':_0x5f47b9['params']['id']}})['then'](handleEntityNotFound(_0x14ecb4,null))['then'](removeEntity(_0x14ecb4,null))[_0x3cfa('0x31')](handleError(_0x14ecb4,null));};exports[_0x3cfa('0x36')]=function(_0x5ace98,_0x3c926a){var _0x40e3fe={};var _0x25523d={};var _0x2cc825;var _0x3a057f;return db[_0x3cfa('0x16')]['findOne']({'where':{'id':_0x5ace98[_0x3cfa('0x34')]['id']}})[_0x3cfa('0xc')](handleEntityNotFound(_0x3c926a,null))[_0x3cfa('0xc')](function(_0x55fa89){if(_0x55fa89){_0x2cc825=_0x55fa89;_0x25523d[_0x3cfa('0x19')]=_[_0x3cfa('0x1b')](db[_0x3cfa('0x37')][_0x3cfa('0x30')]);_0x25523d[_0x3cfa('0x1a')]=_['keys'](_0x5ace98[_0x3cfa('0x1a')]);_0x25523d[_0x3cfa('0x1c')]=_[_0x3cfa('0x1d')](_0x25523d[_0x3cfa('0x19')],_0x25523d[_0x3cfa('0x1a')]);_0x40e3fe[_0x3cfa('0x1f')]=_['intersection'](_0x25523d[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x5ace98[_0x3cfa('0x1a')]['fields']));_0x40e3fe['attributes']=_0x40e3fe['attributes']['length']?_0x40e3fe[_0x3cfa('0x1f')]:_0x25523d[_0x3cfa('0x19')];_0x40e3fe['order']=qs['sort'](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x25')]);_0x40e3fe[_0x3cfa('0x26')]=qs[_0x3cfa('0x1c')](_['pick'](_0x5ace98[_0x3cfa('0x1a')],_0x25523d[_0x3cfa('0x1c')]));if(_0x5ace98['query'][_0x3cfa('0x28')]){_0x40e3fe['where']=_[_0x3cfa('0x29')](_0x40e3fe[_0x3cfa('0x26')],{'$or':_['map'](_0x40e3fe[_0x3cfa('0x1f')],function(_0x458cdb){var _0x5a0c47={};_0x5a0c47[_0x458cdb]={'$like':'%'+_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x28')]+'%'};return _0x5a0c47;})});}_0x40e3fe=_[_0x3cfa('0x29')]({},_0x40e3fe,_0x5ace98[_0x3cfa('0x2b')]);return _0x2cc825[_0x3cfa('0x36')](_0x40e3fe);}})[_0x3cfa('0xc')](function(_0x14fb3e){if(_0x14fb3e){_0x3a057f=_0x14fb3e[_0x3cfa('0x20')];if(!_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x21')]('nolimit')){_0x40e3fe[_0x3cfa('0x23')]=qs['limit'](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x23')]);_0x40e3fe['offset']=qs[_0x3cfa('0x9')](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x9')]);}return _0x2cc825[_0x3cfa('0x36')](_0x40e3fe);}})[_0x3cfa('0xc')](function(_0x5251fa){if(_0x5251fa){return _0x5251fa?{'count':_0x3a057f,'rows':_0x5251fa}:null;}})[_0x3cfa('0xc')](respondWithResult(_0x3c926a,null))[_0x3cfa('0x31')](handleError(_0x3c926a,null));};exports[_0x3cfa('0x38')]=function(_0xe400a1,_0x19ec34){if(_0xe400a1[_0x3cfa('0x33')]['id']){delete _0xe400a1[_0x3cfa('0x33')]['id'];}return db['Dynamics365Account'][_0x3cfa('0x39')]({'where':{'id':_0xe400a1[_0x3cfa('0x34')]['id']}})[_0x3cfa('0xc')](handleEntityNotFound(_0x19ec34,null))[_0x3cfa('0xc')](function(_0x219341){if(_0x219341){_0xe400a1['body']['AccountId']=_0x219341['id'];_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3a')]=integrations[_0x3cfa('0x3b')](_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3c')],_0xe400a1['body']['type']);_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3d')]=integrations[_0x3cfa('0x3e')](_0xe400a1['body'][_0x3cfa('0x3c')],_0xe400a1[_0x3cfa('0x33')]['type']);return db[_0x3cfa('0x37')][_0x3cfa('0x32')](_0xe400a1[_0x3cfa('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3cfa('0x3a')},{'model':db[_0x3cfa('0x3f')],'as':_0x3cfa('0x3d')}]});}return null;})[_0x3cfa('0xc')](respondWithResult(_0x19ec34,null))[_0x3cfa('0x31')](handleError(_0x19ec34,null));};function sanitizeRemoteUri(_0x1727a3){var _0x41e085=_0x1727a3[_0x3cfa('0x40')](-0x1);if(_0x41e085==='/')return _0x1727a3[_0x3cfa('0x41')](0x0,_0x1727a3[_0x3cfa('0x42')](_0x41e085));return _0x1727a3;}function getWebApiUrl(_0x83ebb9){return util[_0x3cfa('0x43')](_0x3cfa('0x44'),_0x83ebb9);}exports[_0x3cfa('0x45')]=function(_0x225bd6,_0x3a6863){var _0x240237=_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0x46')];var _0x2749a3=_0x240237===_0x3cfa('0x47')?_0x3cfa('0x48'):_0x3cfa('0x49');var _0xf4ae1a='';var _0x4aba90='';var _0x34f1a0='';var _0xcfa233='';var _0x5c2335='';var _0x262420='';var _0x261236='';var _0x34ea17='';var _0x2a6d9b=[_0x3cfa('0x4a'),_0x3cfa('0x4b'),_0x3cfa('0x4c'),_0x3cfa('0x4d'),'caseorigincode',_0x3cfa('0x4e'),_0x3cfa('0x4f'),_0x3cfa('0x50'),_0x3cfa('0x51'),_0x3cfa('0x52')];var _0x24686b=[_0x3cfa('0x53'),_0x3cfa('0x54'),'actualserviceunits',_0x3cfa('0x55'),_0x3cfa('0x56'),_0x3cfa('0x57'),_0x3cfa('0x58'),_0x3cfa('0x59'),_0x3cfa('0x5a'),'createdbyexternalpartyyominame',_0x3cfa('0x5b'),_0x3cfa('0x5c'),_0x3cfa('0x5d'),_0x3cfa('0x5e'),'createdonbehalfbyyominame',_0x3cfa('0x5f'),_0x3cfa('0x60'),_0x3cfa('0x61'),_0x3cfa('0x62'),_0x3cfa('0x63'),_0x3cfa('0x64'),'entityimage_url',_0x3cfa('0x65'),_0x3cfa('0x66'),_0x3cfa('0x67'),_0x3cfa('0x68'),'importsequencenumber','influencescore',_0x3cfa('0x69'),_0x3cfa('0x6a'),_0x3cfa('0x6b'),_0x3cfa('0x6c'),_0x3cfa('0x6d'),_0x3cfa('0x6e'),_0x3cfa('0x6f'),_0x3cfa('0x70'),_0x3cfa('0x71'),_0x3cfa('0x72'),'msdyn_incidenttypename','msdyn_iotalertname',_0x3cfa('0x73'),_0x3cfa('0x74'),'overriddencreatedon',_0x3cfa('0x75'),_0x3cfa('0x76'),_0x3cfa('0x77'),_0x3cfa('0x78'),_0x3cfa('0x79'),_0x3cfa('0x7a'),'prioritycodename',_0x3cfa('0x7b'),_0x3cfa('0x7c'),_0x3cfa('0x7d'),_0x3cfa('0x7e'),'responseby',_0x3cfa('0x7f'),_0x3cfa('0x80'),'sentimentvalue',_0x3cfa('0x81'),_0x3cfa('0x82'),_0x3cfa('0x83'),_0x3cfa('0x84'),'statuscode',_0x3cfa('0x85'),_0x3cfa('0x86'),_0x3cfa('0x87'),_0x3cfa('0x88'),_0x3cfa('0x89'),_0x3cfa('0x8a'),_0x3cfa('0x8b')];var _0x117f04=_0x2a6d9b[_0x3cfa('0x8c')](_0x24686b);return db[_0x3cfa('0x16')][_0x3cfa('0x39')]({'where':{'id':_0x225bd6[_0x3cfa('0x34')]['id']},'attributes':['id',_0x3cfa('0x8d'),_0x3cfa('0x8e'),_0x3cfa('0x8f'),'tenantId','clientId',_0x3cfa('0x90'),_0x3cfa('0x91')],'include':[{'model':db[_0x3cfa('0x92')],'as':_0x3cfa('0x92'),'attributes':['id','data5',_0x3cfa('0x93')]}]})[_0x3cfa('0xc')](handleEntityNotFound(_0x3a6863,null))[_0x3cfa('0xc')](function(_0x83b1fb){if(_0x83b1fb){if(_0x83b1fb[_0x3cfa('0x91')]){_0x83b1fb['access_token']=_0x83b1fb['CloudProvider'][_0x3cfa('0x94')];_0x34ea17=sanitizeRemoteUri(_0x83b1fb[_0x3cfa('0x92')]['data7']);_0x261236=getWebApiUrl(_0x34ea17);return _0x83b1fb;}_0x34ea17=sanitizeRemoteUri(_0x83b1fb[_0x3cfa('0x8f')]);_0x261236=getWebApiUrl(_0x34ea17);var _0x48a06f={'method':_0x3cfa('0x95'),'uri':'https://login.microsoftonline.com/'+_0x83b1fb[_0x3cfa('0x96')]+'/oauth2/token','form':{'client_id':_0x83b1fb[_0x3cfa('0x97')],'resource':_0x34ea17,'username':_0x83b1fb['username'],'password':_0x83b1fb[_0x3cfa('0x8e')],'grant_type':_0x3cfa('0x8e'),'client_secret':_0x83b1fb[_0x3cfa('0x90')]},'json':!![]};return rp(_0x48a06f);}})[_0x3cfa('0xc')](function(_0x36eb23){_0x262420=_0x36eb23[_0x3cfa('0x98')];var _0x144e82={'method':_0x3cfa('0x99'),'uri':encodeURI(_0x261236+_0x3cfa('0x9a')+_0x2749a3+'\x27'),'headers':{'Authorization':_0x3cfa('0x9b')+_0x262420,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x144e82);})[_0x3cfa('0xc')](function(_0x12b302){var _0x2c4245=_0x12b302[_0x3cfa('0x9d')][0x0];var _0x557637=_0x2c4245[_0x3cfa('0x9e')];var _0x3204fb={'method':_0x3cfa('0x99'),'uri':_0x261236+'EntityDefinitions('+_0x557637+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3cfa('0x9b')+_0x262420,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x3204fb);})[_0x3cfa('0xc')](function(_0x57d7c3){_0xf4ae1a=_0x57d7c3;_0x4aba90=_0xf4ae1a[_0x3cfa('0x9f')];_0x4aba90=_[_0x3cfa('0xa0')](_0x4aba90,function(_0x4804bc){return!_0x117f04[_0x3cfa('0xa1')](_0x4804bc['LogicalName']);});var _0x257321=[];var _0x4c6cce=[];_0x4aba90['forEach'](function(_0x7b5bf1){if(_0x7b5bf1[_0x3cfa('0xa2')]){var _0xd74b01=_0x7b5bf1['@odata.type'][_0x3cfa('0x41')](_0x7b5bf1[_0x3cfa('0xa2')]['lastIndexOf']('.')+0x1);if(_0xd74b01===_0x3cfa('0xa3')){_0x257321[_0x3cfa('0xa4')](getSelectList(_0x261236,_0x240237,_0x4c6cce,_0xf4ae1a[_0x3cfa('0x9e')],_0x7b5bf1[_0x3cfa('0x9e')],_0x262420));}}});return Promise[_0x3cfa('0xa5')](_0x257321);})[_0x3cfa('0xc')](function(_0xfec8a5){_0x34f1a0=_0xfec8a5[0x0];var _0x51f217=[];var _0x5a3079=[];_0x4aba90[_0x3cfa('0xa6')](function(_0x56a9de){if(!_['isNil'](_0x56a9de[_0x3cfa('0xa2')])){var _0x1cdd97=_0x56a9de[_0x3cfa('0xa2')]['substring'](_0x56a9de[_0x3cfa('0xa2')][_0x3cfa('0x42')]('.')+0x1);if(_0x1cdd97===_0x3cfa('0xa7')){_0x51f217['push'](getBooleanList(_0x261236,_0x240237,_0x5a3079,_0xf4ae1a[_0x3cfa('0x9e')],_0x56a9de['MetadataId'],_0x262420));}}});return Promise['all'](_0x51f217);})[_0x3cfa('0xc')](function(_0x1dcef0){_0xcfa233=_0x1dcef0[0x0];var _0x37406e=[];var _0x491e5d=[];_0x4aba90['forEach'](function(_0x27d3a4){if(_0x27d3a4[_0x3cfa('0xa2')]){var _0x32653b=_0x27d3a4['@odata.type']['substring'](_0x27d3a4[_0x3cfa('0xa2')][_0x3cfa('0x42')]('.')+0x1);if(_0x32653b===_0x3cfa('0xa8')||_0x32653b===_0x3cfa('0xa9')||_0x32653b===_0x3cfa('0xaa')||_0x32653b===_0x3cfa('0xab')||_0x32653b===_0x3cfa('0xac')||_0x32653b===_0x3cfa('0xad')||_0x32653b===_0x3cfa('0xae')||_0x32653b===_0x3cfa('0xaf')||_0x32653b===_0x3cfa('0xb0')||_0x32653b===_0x3cfa('0xb1')){_0x37406e['push'](getInputList(_0x261236,_0x240237,_0x32653b,_0x491e5d,_0xf4ae1a[_0x3cfa('0x9e')],_0x27d3a4[_0x3cfa('0x9e')],_0x262420));}}});return Promise['all'](_0x37406e);})[_0x3cfa('0xc')](function(_0x3242dd){_0x5c2335=_0x3242dd[0x0];var _0x4c5758=_0x34f1a0['concat'](_0xcfa233)[_0x3cfa('0x8c')](_0x5c2335);var _0x371aa6={'count':_0x4c5758[_0x3cfa('0x20')],'rows':_0x4c5758};return _0x371aa6;})[_0x3cfa('0xc')](respondWithResult(_0x3a6863,null))['catch'](function(_0x126330){var _0x138638=_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0xb2')]?0x1f4:_0x126330[_0x3cfa('0xb3')]||0x1f4;logger[_0x3cfa('0x10')](_0x126330[_0x3cfa('0x11')]);delete _0x126330[_0x3cfa('0x12')];if(_0x138638===0x191){_0x138638=0x190;}_0x3a6863['status'](_0x138638)[_0x3cfa('0x13')](_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x126330[_0x3cfa('0xb3')]}:_0x126330);});};function getSelectList(_0x2089fe,_0xb7253e,_0x27faf2,_0x4c4bc5,_0x5891b3,_0xfeb0ff){var _0x3d11bc={'method':'GET','uri':_0x2089fe+_0x3cfa('0xb4')+_0x4c4bc5+_0x3cfa('0xb5')+_0x5891b3+_0x3cfa('0xb6')+_0x3cfa('0xb7'),'headers':{'Authorization':_0x3cfa('0x9b')+_0xfeb0ff,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d11bc)[_0x3cfa('0xc')](function(_0x2b10c0){var _0x132e4c=[];var _0x2dddac=_0x2b10c0[_0x3cfa('0xb8')][_0x3cfa('0xb9')];_0x2dddac[_0x3cfa('0xa6')](function(_0x4c46f7){_0x132e4c[_0x3cfa('0xa4')]({'name':_0x4c46f7['Label'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':String(_0x4c46f7[_0x3cfa('0xbc')])});});var _0x556a28={'id':_0xb7253e+'_'+_0x2b10c0[_0x3cfa('0xbd')],'name':_0x2b10c0['DisplayName'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'custom':![],'options':_0x132e4c};_0x27faf2[_0x3cfa('0xa4')](_0x556a28);return _0x27faf2;});}function getBooleanList(_0x4f72ef,_0x1a0a56,_0x34f533,_0x22529d,_0x26f19d,_0x5f1295){var _0x5f0f16={'method':_0x3cfa('0x99'),'uri':_0x4f72ef+_0x3cfa('0xb4')+_0x22529d+')/Attributes('+_0x26f19d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x5f1295,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f0f16)['then'](function(_0x5ea596){var _0x1f0c82=[];_0x1f0c82[_0x3cfa('0xa4')]({'name':_0x5ea596[_0x3cfa('0xb8')][_0x3cfa('0xbe')][_0x3cfa('0xbb')][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':_0x3cfa('0xbf')},{'name':_0x5ea596[_0x3cfa('0xb8')]['FalseOption']['Label'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':'false'});var _0x10a744={'id':_0x1a0a56+'_'+_0x5ea596[_0x3cfa('0xbd')],'name':_0x5ea596[_0x3cfa('0xc0')][_0x3cfa('0xba')][_0x3cfa('0xbb')],'custom':![],'options':_0x1f0c82};_0x34f533[_0x3cfa('0xa4')](_0x10a744);return _0x34f533;});}function getInputList(_0x8dda45,_0x5d9977,_0x17d65f,_0x2cc024,_0x302f42,_0x54cbce,_0x274486){var _0x3c69dc={'method':'GET','uri':_0x8dda45+_0x3cfa('0xb4')+_0x302f42+')/Attributes('+_0x54cbce+_0x3cfa('0xc1')+_0x17d65f+_0x3cfa('0xc2'),'headers':{'Authorization':_0x3cfa('0x9b')+_0x274486,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x3c69dc)[_0x3cfa('0xc')](function(_0x5170b1){var _0x5d96fa={'id':_0x5d9977+'_'+_0x5170b1[_0x3cfa('0xbd')],'name':_0x5170b1['DisplayName'][_0x3cfa('0xba')]?_0x5170b1[_0x3cfa('0xc0')]['UserLocalizedLabel'][_0x3cfa('0xbb')]:_0x5170b1[_0x3cfa('0xbd')],'custom':![],'options':[]};_0x2cc024['push'](_0x5d96fa);return _0x2cc024;});} \ No newline at end of file +var _0xb0cb=['accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','followupby','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','remoteUri','https://login.microsoftonline.com/','tenantId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','error',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','stack','name','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','slice','format','%s/api/data/v9.0/','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0x24853d,_0x16931f){var _0x4c5cff=function(_0x5cdd14){while(--_0x5cdd14){_0x24853d['push'](_0x24853d['shift']());}};_0x4c5cff(++_0x16931f);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb0cb[_0x5d6456];return _0x4d66c1;};'use strict';var rp=require(_0xbb0c('0x0'));var util=require('util');var _=require(_0xbb0c('0x1'));var qs=require(_0xbb0c('0x2'));var logger=require(_0xbb0c('0x3'))(_0xbb0c('0x4'));var db=require(_0xbb0c('0x5'))['db'];var integrations=require(_0xbb0c('0x6'));function respondWithResult(_0x41f616,_0x22784f){_0x22784f=_0x22784f||0xc8;return function(_0xedba45){if(_0xedba45){return _0x41f616[_0xbb0c('0x7')](_0x22784f)[_0xbb0c('0x8')](_0xedba45);}};}function respondWithFilteredResult(_0x10a1f3,_0x2cdeae){return function(_0x3c6062){if(_0x3c6062){var _0x5c02ad=typeof _0x2cdeae[_0xbb0c('0x9')]===_0xbb0c('0xa')&&typeof _0x2cdeae['limit']===_0xbb0c('0xa');var _0x41f9bb=_0x3c6062[_0xbb0c('0xb')];var _0x5e8169=_0x5c02ad?0x0:_0x2cdeae[_0xbb0c('0x9')];var _0x716f71=_0x5c02ad?_0x3c6062['count']:_0x2cdeae[_0xbb0c('0x9')]+_0x2cdeae[_0xbb0c('0xc')];var _0x4701a9;if(_0x716f71>=_0x41f9bb){_0x716f71=_0x41f9bb;_0x4701a9=0xc8;}else{_0x4701a9=0xce;}_0x10a1f3[_0xbb0c('0x7')](_0x4701a9);return _0x10a1f3['set']('Content-Range',_0x5e8169+'-'+_0x716f71+'/'+_0x41f9bb)[_0xbb0c('0x8')](_0x3c6062);}return null;};}function saveUpdates(_0x22ca6c){return function(_0x2a2a89){if(_0x2a2a89){return _0x2a2a89[_0xbb0c('0xd')](_0x22ca6c)[_0xbb0c('0xe')](function(_0xcbe86b){return _0xcbe86b;});}return null;};}function removeEntity(_0x5c1262){return function(_0x13ff65){if(_0x13ff65){return _0x13ff65[_0xbb0c('0xf')]()[_0xbb0c('0xe')](function(){_0x5c1262[_0xbb0c('0x7')](0xcc)[_0xbb0c('0x10')]();});}};}function handleEntityNotFound(_0x5176c9){return function(_0x2d9ad5){if(!_0x2d9ad5){_0x5176c9[_0xbb0c('0x11')](0x194);}return _0x2d9ad5;};}function handleError(_0xf52e84,_0x1ecbfe){_0x1ecbfe=_0x1ecbfe||0x1f4;return function(_0x2987e9){logger['error'](_0x2987e9[_0xbb0c('0x12')]);if(_0x2987e9[_0xbb0c('0x13')]){delete _0x2987e9['name'];}_0xf52e84['status'](_0x1ecbfe)['send'](_0x2987e9);};}exports['index']=function(_0x19c53c,_0x3b9982){var _0x5460b1={},_0x5e6d75={},_0x1f9d90={'count':0x0,'rows':[]};var _0x5cef56=_[_0xbb0c('0x14')](db[_0xbb0c('0x15')][_0xbb0c('0x16')],function(_0x42ba2e){return{'name':_0x42ba2e[_0xbb0c('0x17')],'type':_0x42ba2e['type'][_0xbb0c('0x18')]};});_0x5e6d75[_0xbb0c('0x19')]=_['map'](_0x5cef56,_0xbb0c('0x13'));_0x5e6d75[_0xbb0c('0x1a')]=_[_0xbb0c('0x1b')](_0x19c53c[_0xbb0c('0x1a')]);_0x5e6d75[_0xbb0c('0x1c')]=_['intersection'](_0x5e6d75['model'],_0x5e6d75['query']);_0x5460b1[_0xbb0c('0x1d')]=_[_0xbb0c('0x1e')](_0x5e6d75['model'],qs['fields'](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x1f')]));_0x5460b1[_0xbb0c('0x1d')]=_0x5460b1[_0xbb0c('0x1d')][_0xbb0c('0x20')]?_0x5460b1['attributes']:_0x5e6d75[_0xbb0c('0x19')];if(!_0x19c53c[_0xbb0c('0x1a')]['hasOwnProperty'](_0xbb0c('0x21'))){_0x5460b1['limit']=qs['limit'](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0xc')]);_0x5460b1[_0xbb0c('0x9')]=qs[_0xbb0c('0x9')](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x9')]);}_0x5460b1[_0xbb0c('0x22')]=qs[_0xbb0c('0x23')](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x23')]);_0x5460b1['where']=qs[_0xbb0c('0x1c')](_[_0xbb0c('0x24')](_0x19c53c['query'],_0x5e6d75[_0xbb0c('0x1c')]),_0x5cef56);if(_0x19c53c[_0xbb0c('0x1a')]['filter']){_0x5460b1[_0xbb0c('0x25')]=_[_0xbb0c('0x26')](_0x5460b1['where'],{'$or':_[_0xbb0c('0x14')](_0x5cef56,function(_0x52eb5b){if(_0x52eb5b[_0xbb0c('0x27')]!==_0xbb0c('0x28')){var _0x1ba82f={};_0x1ba82f[_0x52eb5b[_0xbb0c('0x13')]]={'$like':'%'+_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x29')]+'%'};return _0x1ba82f;}})});}_0x5460b1=_[_0xbb0c('0x26')]({},_0x5460b1,_0x19c53c['options']);var _0x156d78={'where':_0x5460b1[_0xbb0c('0x25')]};return db[_0xbb0c('0x15')][_0xbb0c('0xb')](_0x156d78)[_0xbb0c('0xe')](function(_0x2ebc5c){_0x1f9d90[_0xbb0c('0xb')]=_0x2ebc5c;if(_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x2a')]){_0x5460b1[_0xbb0c('0x2b')]=[{'all':!![]}];}return db[_0xbb0c('0x15')]['findAll'](_0x5460b1);})[_0xbb0c('0xe')](function(_0x42e818){_0x1f9d90[_0xbb0c('0x2c')]=_0x42e818;return _0x1f9d90;})['then'](respondWithFilteredResult(_0x3b9982,_0x5460b1))[_0xbb0c('0x2d')](handleError(_0x3b9982,null));};exports[_0xbb0c('0x2e')]=function(_0x284dc0,_0x2d4f87){var _0x558fa4={'raw':![],'where':{'id':_0x284dc0[_0xbb0c('0x2f')]['id']}},_0x56883e={};_0x56883e['model']=_[_0xbb0c('0x1b')](db[_0xbb0c('0x15')][_0xbb0c('0x16')]);_0x56883e['query']=_[_0xbb0c('0x1b')](_0x284dc0[_0xbb0c('0x1a')]);_0x56883e[_0xbb0c('0x1c')]=_[_0xbb0c('0x1e')](_0x56883e[_0xbb0c('0x19')],_0x56883e['query']);_0x558fa4['attributes']=_[_0xbb0c('0x1e')](_0x56883e['model'],qs[_0xbb0c('0x1f')](_0x284dc0['query']['fields']));_0x558fa4[_0xbb0c('0x1d')]=_0x558fa4['attributes'][_0xbb0c('0x20')]?_0x558fa4[_0xbb0c('0x1d')]:_0x56883e[_0xbb0c('0x19')];if(_0x284dc0[_0xbb0c('0x1a')][_0xbb0c('0x2a')]){_0x558fa4['include']=[{'all':!![]}];}_0x558fa4=_[_0xbb0c('0x26')]({},_0x558fa4,_0x284dc0[_0xbb0c('0x30')]);return db['Dynamics365Account'][_0xbb0c('0x31')](_0x558fa4)[_0xbb0c('0xe')](handleEntityNotFound(_0x2d4f87,null))[_0xbb0c('0xe')](respondWithResult(_0x2d4f87,null))[_0xbb0c('0x2d')](handleError(_0x2d4f87,null));};exports['create']=function(_0x3c595f,_0x481a21){return db[_0xbb0c('0x15')][_0xbb0c('0x32')](_0x3c595f[_0xbb0c('0x33')],{})['then'](respondWithResult(_0x481a21,0xc9))[_0xbb0c('0x2d')](handleError(_0x481a21,null));};exports[_0xbb0c('0xd')]=function(_0x2eaa01,_0x399069){if(_0x2eaa01[_0xbb0c('0x33')]['id']){delete _0x2eaa01[_0xbb0c('0x33')]['id'];}return db[_0xbb0c('0x15')]['find']({'where':{'id':_0x2eaa01[_0xbb0c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x399069,null))[_0xbb0c('0xe')](saveUpdates(_0x2eaa01['body'],null))[_0xbb0c('0xe')](respondWithResult(_0x399069,null))[_0xbb0c('0x2d')](handleError(_0x399069,null));};exports['destroy']=function(_0x42e87f,_0x446596){return db['Dynamics365Account'][_0xbb0c('0x31')]({'where':{'id':_0x42e87f[_0xbb0c('0x2f')]['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x446596,null))[_0xbb0c('0xe')](removeEntity(_0x446596,null))[_0xbb0c('0x2d')](handleError(_0x446596,null));};exports[_0xbb0c('0x34')]=function(_0x5cdedd,_0x5b842a){var _0x1a1577={};var _0x235789={};var _0x2d1440;var _0x114814;return db[_0xbb0c('0x15')][_0xbb0c('0x35')]({'where':{'id':_0x5cdedd['params']['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x5b842a,null))[_0xbb0c('0xe')](function(_0x51007c){if(_0x51007c){_0x2d1440=_0x51007c;_0x235789[_0xbb0c('0x19')]=_[_0xbb0c('0x1b')](db[_0xbb0c('0x36')]['rawAttributes']);_0x235789[_0xbb0c('0x1a')]=_[_0xbb0c('0x1b')](_0x5cdedd[_0xbb0c('0x1a')]);_0x235789['filters']=_[_0xbb0c('0x1e')](_0x235789['model'],_0x235789[_0xbb0c('0x1a')]);_0x1a1577['attributes']=_['intersection'](_0x235789[_0xbb0c('0x19')],qs[_0xbb0c('0x1f')](_0x5cdedd[_0xbb0c('0x1a')]['fields']));_0x1a1577[_0xbb0c('0x1d')]=_0x1a1577[_0xbb0c('0x1d')][_0xbb0c('0x20')]?_0x1a1577[_0xbb0c('0x1d')]:_0x235789[_0xbb0c('0x19')];_0x1a1577['order']=qs[_0xbb0c('0x23')](_0x5cdedd['query']['sort']);_0x1a1577[_0xbb0c('0x25')]=qs['filters'](_[_0xbb0c('0x24')](_0x5cdedd[_0xbb0c('0x1a')],_0x235789[_0xbb0c('0x1c')]));if(_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x29')]){_0x1a1577[_0xbb0c('0x25')]=_[_0xbb0c('0x26')](_0x1a1577['where'],{'$or':_[_0xbb0c('0x14')](_0x1a1577[_0xbb0c('0x1d')],function(_0x55a825){var _0x493b2f={};_0x493b2f[_0x55a825]={'$like':'%'+_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x29')]+'%'};return _0x493b2f;})});}_0x1a1577=_['merge']({},_0x1a1577,_0x5cdedd[_0xbb0c('0x30')]);return _0x2d1440[_0xbb0c('0x34')](_0x1a1577);}})['then'](function(_0x33201f){if(_0x33201f){_0x114814=_0x33201f[_0xbb0c('0x20')];if(!_0x5cdedd[_0xbb0c('0x1a')]['hasOwnProperty'](_0xbb0c('0x21'))){_0x1a1577[_0xbb0c('0xc')]=qs[_0xbb0c('0xc')](_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0xc')]);_0x1a1577[_0xbb0c('0x9')]=qs[_0xbb0c('0x9')](_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x9')]);}return _0x2d1440[_0xbb0c('0x34')](_0x1a1577);}})[_0xbb0c('0xe')](function(_0x33a718){if(_0x33a718){return _0x33a718?{'count':_0x114814,'rows':_0x33a718}:null;}})[_0xbb0c('0xe')](respondWithResult(_0x5b842a,null))[_0xbb0c('0x2d')](handleError(_0x5b842a,null));};exports[_0xbb0c('0x37')]=function(_0x264312,_0x58a94e){if(_0x264312[_0xbb0c('0x33')]['id']){delete _0x264312['body']['id'];}return db[_0xbb0c('0x15')]['findOne']({'where':{'id':_0x264312[_0xbb0c('0x2f')]['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x58a94e,null))['then'](function(_0x166b35){if(_0x166b35){_0x264312[_0xbb0c('0x33')][_0xbb0c('0x38')]=_0x166b35['id'];_0x264312[_0xbb0c('0x33')]['Subjects']=integrations['getSubjects'](_0x264312[_0xbb0c('0x33')][_0xbb0c('0x39')],_0x264312[_0xbb0c('0x33')][_0xbb0c('0x27')]);_0x264312[_0xbb0c('0x33')][_0xbb0c('0x3a')]=integrations[_0xbb0c('0x3b')](_0x264312[_0xbb0c('0x33')][_0xbb0c('0x39')],_0x264312[_0xbb0c('0x33')][_0xbb0c('0x27')]);return db[_0xbb0c('0x36')]['create'](_0x264312[_0xbb0c('0x33')],{'include':[{'model':db[_0xbb0c('0x3c')],'as':'Subjects'},{'model':db[_0xbb0c('0x3c')],'as':_0xbb0c('0x3a')}]});}return null;})['then'](respondWithResult(_0x58a94e,null))[_0xbb0c('0x2d')](handleError(_0x58a94e,null));};function sanitizeRemoteUri(_0x565e17){var _0x332b90=_0x565e17[_0xbb0c('0x3d')](-0x1);if(_0x332b90==='/')return _0x565e17['substring'](0x0,_0x565e17['lastIndexOf'](_0x332b90));return _0x565e17;}function getWebApiUrl(_0xb997bf){return util[_0xbb0c('0x3e')](_0xbb0c('0x3f'),_0xb997bf);}exports[_0xbb0c('0x40')]=function(_0x5f3f12,_0x166984){var _0x1bc471=_0x5f3f12[_0xbb0c('0x1a')][_0xbb0c('0x41')];var _0x2454ce=_0x1bc471===_0xbb0c('0x42')?'Incident':'PhoneCall';var _0x199a8e='';var _0x104a3d='';var _0x3bf2f0='';var _0x467990='';var _0x90b48f='';var _0x2de891='';var _0x4655d8='';var _0x2b5954='';var _0x57f4a2=[_0xbb0c('0x43'),_0xbb0c('0x44'),_0xbb0c('0x45'),_0xbb0c('0x46'),_0xbb0c('0x47'),'subject',_0xbb0c('0x48'),_0xbb0c('0x49'),_0xbb0c('0x4a'),_0xbb0c('0x4b')];var _0x3b8235=['accountidname',_0xbb0c('0x4c'),_0xbb0c('0x4d'),'billedserviceunits',_0xbb0c('0x4e'),'contactidyominame',_0xbb0c('0x4f'),_0xbb0c('0x50'),_0xbb0c('0x51'),_0xbb0c('0x52'),_0xbb0c('0x53'),'createdbyyominame',_0xbb0c('0x54'),_0xbb0c('0x55'),_0xbb0c('0x56'),_0xbb0c('0x57'),_0xbb0c('0x58'),_0xbb0c('0x59'),_0xbb0c('0x5a'),'entitlementidname',_0xbb0c('0x5b'),_0xbb0c('0x5c'),_0xbb0c('0x5d'),'exchangerate','firstresponsebykpiidname',_0xbb0c('0x5e'),'importsequencenumber','influencescore',_0xbb0c('0x5f'),'lastonholdtime',_0xbb0c('0x60'),'modifiedbyexternalpartyname',_0xbb0c('0x61'),_0xbb0c('0x62'),_0xbb0c('0x63'),_0xbb0c('0x64'),_0xbb0c('0x65'),_0xbb0c('0x66'),_0xbb0c('0x67'),_0xbb0c('0x68'),'numberofchildincidents',_0xbb0c('0x69'),'overriddencreatedon',_0xbb0c('0x6a'),_0xbb0c('0x6b'),'owneridyominame',_0xbb0c('0x6c'),_0xbb0c('0x6d'),_0xbb0c('0x6e'),_0xbb0c('0x6f'),_0xbb0c('0x70'),_0xbb0c('0x71'),_0xbb0c('0x72'),_0xbb0c('0x73'),_0xbb0c('0x74'),'responsiblecontactidname',_0xbb0c('0x75'),_0xbb0c('0x76'),_0xbb0c('0x77'),_0xbb0c('0x78'),_0xbb0c('0x79'),_0xbb0c('0x7a'),_0xbb0c('0x7b'),'subjectidname','ticketnumber',_0xbb0c('0x7c'),_0xbb0c('0x7d'),'traversedpath',_0xbb0c('0x7e'),_0xbb0c('0x7f')];var _0x33bdc7=_0x57f4a2['concat'](_0x3b8235);return db['Dynamics365Account'][_0xbb0c('0x35')]({'where':{'id':_0x5f3f12['params']['id']},'attributes':['id',_0xbb0c('0x80'),_0xbb0c('0x81'),'remoteUri','tenantId',_0xbb0c('0x82'),_0xbb0c('0x83'),_0xbb0c('0x84')],'include':[{'model':db[_0xbb0c('0x85')],'as':_0xbb0c('0x85'),'attributes':['id',_0xbb0c('0x86'),_0xbb0c('0x87')]}]})[_0xbb0c('0xe')](handleEntityNotFound(_0x166984,null))[_0xbb0c('0xe')](function(_0x99417c){if(_0x99417c){if(_0x99417c[_0xbb0c('0x84')]){_0x99417c['access_token']=_0x99417c[_0xbb0c('0x85')]['data5'];_0x2b5954=sanitizeRemoteUri(_0x99417c['CloudProvider'][_0xbb0c('0x87')]);_0x4655d8=getWebApiUrl(_0x2b5954);return _0x99417c;}_0x2b5954=sanitizeRemoteUri(_0x99417c[_0xbb0c('0x88')]);_0x4655d8=getWebApiUrl(_0x2b5954);var _0x1aad06={'method':'POST','uri':_0xbb0c('0x89')+_0x99417c[_0xbb0c('0x8a')]+'/oauth2/token','form':{'client_id':_0x99417c[_0xbb0c('0x82')],'resource':_0x2b5954,'username':_0x99417c[_0xbb0c('0x80')],'password':_0x99417c['password'],'grant_type':'password','client_secret':_0x99417c[_0xbb0c('0x83')]},'json':!![]};return rp(_0x1aad06);}})[_0xbb0c('0xe')](function(_0xeb99db){_0x2de891=_0xeb99db[_0xbb0c('0x8b')];var _0x132cb5={'method':_0xbb0c('0x8c'),'uri':encodeURI(_0x4655d8+_0xbb0c('0x8d')+_0x2454ce+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2de891,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x132cb5);})[_0xbb0c('0xe')](function(_0x124956){var _0x9369f=_0x124956['value'][0x0];var _0x379d44=_0x9369f[_0xbb0c('0x8f')];var _0x21375a={'method':_0xbb0c('0x8c'),'uri':_0x4655d8+_0xbb0c('0x90')+_0x379d44+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xbb0c('0x91')+_0x2de891,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21375a);})[_0xbb0c('0xe')](function(_0x4fad06){_0x199a8e=_0x4fad06;_0x104a3d=_0x199a8e[_0xbb0c('0x92')];_0x104a3d=_[_0xbb0c('0x93')](_0x104a3d,function(_0x2e8102){return!_0x33bdc7['includes'](_0x2e8102[_0xbb0c('0x94')]);});var _0x330591=[];var _0x37b924=[];_0x104a3d[_0xbb0c('0x95')](function(_0x359f25){if(_0x359f25[_0xbb0c('0x96')]){var _0x1ef8ed=_0x359f25['@odata.type'][_0xbb0c('0x97')](_0x359f25['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1ef8ed===_0xbb0c('0x98')){_0x330591[_0xbb0c('0x99')](getSelectList(_0x4655d8,_0x1bc471,_0x37b924,_0x199a8e['MetadataId'],_0x359f25[_0xbb0c('0x8f')],_0x2de891));}}});return Promise[_0xbb0c('0x9a')](_0x330591);})['then'](function(_0x3ec26f){_0x3bf2f0=_0x3ec26f[0x0];var _0x1d7016=[];var _0xa9910d=[];_0x104a3d['forEach'](function(_0xa1ee27){if(!_[_0xbb0c('0x9b')](_0xa1ee27[_0xbb0c('0x96')])){var _0x245ef1=_0xa1ee27[_0xbb0c('0x96')][_0xbb0c('0x97')](_0xa1ee27['@odata.type']['lastIndexOf']('.')+0x1);if(_0x245ef1==='BooleanAttributeMetadata'){_0x1d7016['push'](getBooleanList(_0x4655d8,_0x1bc471,_0xa9910d,_0x199a8e[_0xbb0c('0x8f')],_0xa1ee27['MetadataId'],_0x2de891));}}});return Promise['all'](_0x1d7016);})[_0xbb0c('0xe')](function(_0x3f500c){_0x467990=_0x3f500c[0x0];var _0x526e05=[];var _0x10c2e0=[];_0x104a3d[_0xbb0c('0x95')](function(_0x11d814){if(_0x11d814[_0xbb0c('0x96')]){var _0x1e702f=_0x11d814[_0xbb0c('0x96')]['substring'](_0x11d814[_0xbb0c('0x96')][_0xbb0c('0x9c')]('.')+0x1);if(_0x1e702f===_0xbb0c('0x9d')||_0x1e702f===_0xbb0c('0x9e')||_0x1e702f===_0xbb0c('0x9f')||_0x1e702f==='IntegerAttributeMetadata'||_0x1e702f==='MemoAttributeMetadata'||_0x1e702f===_0xbb0c('0xa0')||_0x1e702f==='StatusAttributeMetadata'||_0x1e702f===_0xbb0c('0xa1')||_0x1e702f===_0xbb0c('0xa2')||_0x1e702f==='DecimalAttributeMetadata'){_0x526e05[_0xbb0c('0x99')](getInputList(_0x4655d8,_0x1bc471,_0x1e702f,_0x10c2e0,_0x199a8e[_0xbb0c('0x8f')],_0x11d814['MetadataId'],_0x2de891));}}});return Promise[_0xbb0c('0x9a')](_0x526e05);})[_0xbb0c('0xe')](function(_0x5433fd){_0x90b48f=_0x5433fd[0x0];var _0xd3e82b=_0x3bf2f0[_0xbb0c('0xa3')](_0x467990)[_0xbb0c('0xa3')](_0x90b48f);var _0x4851f6={'count':_0xd3e82b['length'],'rows':_0xd3e82b};return _0x4851f6;})['then'](respondWithResult(_0x166984,null))[_0xbb0c('0x2d')](function(_0x2a381c){var _0x15b8f8=_0x5f3f12['query'][_0xbb0c('0xa4')]?0x1f4:_0x2a381c[_0xbb0c('0xa5')]||0x1f4;logger[_0xbb0c('0xa6')](_0x2a381c[_0xbb0c('0x12')]);delete _0x2a381c[_0xbb0c('0x13')];if(_0x15b8f8===0x191){_0x15b8f8=0x190;}_0x166984[_0xbb0c('0x7')](_0x15b8f8)['send'](_0x5f3f12[_0xbb0c('0x1a')][_0xbb0c('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x2a381c[_0xbb0c('0xa5')]}:_0x2a381c);});};function getSelectList(_0x4a657b,_0x485bb4,_0x2590ce,_0x16e129,_0x5ed15c,_0x1a807e){var _0x166514={'method':_0xbb0c('0x8c'),'uri':_0x4a657b+'EntityDefinitions('+_0x16e129+')/Attributes('+_0x5ed15c+_0xbb0c('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1a807e,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x166514)[_0xbb0c('0xe')](function(_0x9b0fc2){var _0x2edea9=[];var _0x99a4ef=_0x9b0fc2[_0xbb0c('0xa8')]['Options'];_0x99a4ef[_0xbb0c('0x95')](function(_0x1673c8){_0x2edea9['push']({'name':_0x1673c8[_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':String(_0x1673c8['Value'])});});var _0x5c444a={'id':_0x485bb4+'_'+_0x9b0fc2[_0xbb0c('0x94')],'name':_0x9b0fc2['DisplayName']['UserLocalizedLabel'][_0xbb0c('0xa9')],'custom':![],'options':_0x2edea9};_0x2590ce[_0xbb0c('0x99')](_0x5c444a);return _0x2590ce;});}function getBooleanList(_0x570ee1,_0x9e4254,_0x5cb773,_0x2270b2,_0x2446cc,_0x187af3){var _0x32ad14={'method':_0xbb0c('0x8c'),'uri':_0x570ee1+'EntityDefinitions('+_0x2270b2+_0xbb0c('0xab')+_0x2446cc+_0xbb0c('0xac'),'headers':{'Authorization':_0xbb0c('0x91')+_0x187af3,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x32ad14)['then'](function(_0x3edc1e){var _0x396e2b=[];_0x396e2b[_0xbb0c('0x99')]({'name':_0x3edc1e[_0xbb0c('0xa8')][_0xbb0c('0xad')][_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':_0xbb0c('0xae')},{'name':_0x3edc1e['OptionSet'][_0xbb0c('0xaf')][_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':_0xbb0c('0xb0')});var _0x3fdd48={'id':_0x9e4254+'_'+_0x3edc1e[_0xbb0c('0x94')],'name':_0x3edc1e[_0xbb0c('0xb1')][_0xbb0c('0xaa')]['Label'],'custom':![],'options':_0x396e2b};_0x5cb773['push'](_0x3fdd48);return _0x5cb773;});}function getInputList(_0x21cd51,_0x59f75e,_0x317d2a,_0x268cbb,_0x412eea,_0x1a7fd3,_0x2bb7ce){var _0x7b9da1={'method':_0xbb0c('0x8c'),'uri':_0x21cd51+_0xbb0c('0x90')+_0x412eea+_0xbb0c('0xab')+_0x1a7fd3+_0xbb0c('0xb2')+_0x317d2a+_0xbb0c('0xb3'),'headers':{'Authorization':_0xbb0c('0x91')+_0x2bb7ce,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7b9da1)[_0xbb0c('0xe')](function(_0x44f609){var _0x58e497={'id':_0x59f75e+'_'+_0x44f609[_0xbb0c('0x94')],'name':_0x44f609[_0xbb0c('0xb1')][_0xbb0c('0xaa')]?_0x44f609['DisplayName']['UserLocalizedLabel']['Label']:_0x44f609[_0xbb0c('0x94')],'custom':![],'options':[]};_0x268cbb['push'](_0x58e497);return _0x268cbb;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 8c24278..7b2324c 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0xfa15e1,_0x5dd0d1){var _0x18b362=function(_0x2203af){while(--_0x2203af){_0xfa15e1['push'](_0xfa15e1['shift']());}};_0x18b362(++_0x5dd0d1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e8094,_0x30333e){var _0x5cc14d=function(_0xa15352){while(--_0xa15352){_0x1e8094['push'](_0x1e8094['shift']());}};_0x5cc14d(++_0x30333e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 75062f1..9d6472b 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 _0xb34b=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowDynamics365Account','lodash'];(function(_0x386bbe,_0x525293){var _0x22ab48=function(_0x13605a){while(--_0x13605a){_0x386bbe['push'](_0x386bbe['shift']());}};_0x22ab48(++_0x525293);}(_0xb34b,0x1e9));var _0xbb34=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb34b[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xbb34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbb34('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb34('0x2'));var db=require(_0xbb34('0x3'))['db'];var utils=require(_0xbb34('0x4'));var logger=require('../../config/logger')(_0xbb34('0x5'));var config=require(_0xbb34('0x6'));var jayson=require(_0xbb34('0x7'));var client=jayson[_0xbb34('0x8')][_0xbb34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5488f9,_0x56d00b,_0x1854b7){return new BPromise(function(_0x37e05f,_0x1d0730){return client[_0xbb34('0xa')](_0x5488f9,_0x1854b7)[_0xbb34('0xb')](function(_0x1b5e30){logger[_0xbb34('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x56d00b,'request\x20sent');logger[_0xbb34('0xd')](_0xbb34('0xe'),_0x56d00b,_0xbb34('0xf'),JSON[_0xbb34('0x10')](_0x1b5e30));if(_0x1b5e30[_0xbb34('0x11')]){if(_0x1b5e30['error']['code']===0x1f4){logger[_0xbb34('0x11')](_0xbb34('0x12'),_0x56d00b,_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);return _0x1d0730(_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);}logger[_0xbb34('0x11')](_0xbb34('0x12'),_0x56d00b,_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);return _0x37e05f(_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);}else{logger[_0xbb34('0xc')](_0xbb34('0x12'),_0x56d00b,_0xbb34('0xf'));_0x37e05f(_0x1b5e30[_0xbb34('0x14')]['message']);}})[_0xbb34('0x15')](function(_0x51107b){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x56d00b,_0x51107b);_0x1d0730(_0x51107b);});});}exports[_0xbb34('0x16')]=function(_0x5bade6){var _0x4f6019=this;return new Promise(function(_0x4a5cc1,_0x4a397e){return db[_0xbb34('0x17')][_0xbb34('0x18')]({'raw':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')]['where']||null:null,'attributes':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1b')]||null:null,'limit':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1c')]||null:null,'include':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1d')],function(_0x8b4ec0){return{'model':db[_0x8b4ec0[_0xbb34('0x1f')]],'as':_0x8b4ec0['as'],'attributes':_0x8b4ec0[_0xbb34('0x1b')],'include':_0x8b4ec0[_0xbb34('0x1d')]?_['map'](_0x8b4ec0[_0xbb34('0x1d')],function(_0x160753){return{'model':db[_0x160753[_0xbb34('0x1f')]],'as':_0x160753['as'],'attributes':_0x160753['attributes'],'include':_0x160753['include']?_['map'](_0x160753[_0xbb34('0x1d')],function(_0x31cf1d){return{'model':db[_0x31cf1d['model']],'as':_0x31cf1d['as'],'attributes':_0x31cf1d[_0xbb34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb34('0xb')](function(_0x1c5527){logger[_0xbb34('0xc')](_0xbb34('0x16'),_0x5bade6);logger[_0xbb34('0xd')](_0xbb34('0x16'),_0x5bade6,JSON['stringify'](_0x1c5527));_0x4a5cc1(_0x1c5527);})['catch'](function(_0x30cd69){logger['error'](_0xbb34('0x16'),_0x30cd69['message'],_0x5bade6);_0x4a397e(_0x4f6019[_0xbb34('0x11')](0x1f4,_0x30cd69[_0xbb34('0x13')]));});});};exports['ShowDynamics365Account']=function(_0xa4e4b3){var _0x19bc8c=this;return new Promise(function(_0x684908,_0x18124e){return db[_0xbb34('0x17')][_0xbb34('0x20')]({'raw':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1a')]===undefined?!![]:![]:!![],'where':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3[_0xbb34('0x19')][_0xbb34('0x21')]||null:null,'attributes':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1b')]||null:null,'include':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0xa4e4b3['options'][_0xbb34('0x1d')],function(_0x56bbfd){return{'model':db[_0x56bbfd[_0xbb34('0x1f')]],'as':_0x56bbfd['as'],'attributes':_0x56bbfd[_0xbb34('0x1b')],'include':_0x56bbfd[_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0x56bbfd['include'],function(_0x53ef0c){return{'model':db[_0x53ef0c['model']],'as':_0x53ef0c['as'],'attributes':_0x53ef0c[_0xbb34('0x1b')],'include':_0x53ef0c['include']?_['map'](_0x53ef0c['include'],function(_0x599869){return{'model':db[_0x599869[_0xbb34('0x1f')]],'as':_0x599869['as'],'attributes':_0x599869[_0xbb34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb34('0xb')](function(_0x9e1cbc){logger[_0xbb34('0xc')]('ShowDynamics365Account',_0xa4e4b3);logger[_0xbb34('0xd')](_0xbb34('0x22'),_0xa4e4b3,JSON['stringify'](_0x9e1cbc));_0x684908(_0x9e1cbc);})[_0xbb34('0x15')](function(_0x3b436e){logger[_0xbb34('0x11')](_0xbb34('0x22'),_0x3b436e[_0xbb34('0x13')],_0xa4e4b3);_0x18124e(_0x19bc8c[_0xbb34('0x11')](0x1f4,_0x3b436e[_0xbb34('0x13')]));});});}; \ No newline at end of file +var _0xfc5b=['stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','map','include','model','attributes','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0xfeb6b8,_0x516beb){var _0x37e8ed=function(_0x1aefa5){while(--_0x1aefa5){_0xfeb6b8['push'](_0xfeb6b8['shift']());}};_0x37e8ed(++_0x516beb);}(_0xfc5b,0x1f3));var _0xbfc5=function(_0x447726,_0x499774){_0x447726=_0x447726-0x0;var _0x4f17ec=_0xfc5b[_0x447726];return _0x4f17ec;};'use strict';var _=require(_0xbfc5('0x0'));var util=require(_0xbfc5('0x1'));var moment=require(_0xbfc5('0x2'));var BPromise=require(_0xbfc5('0x3'));var rs=require(_0xbfc5('0x4'));var fs=require('fs');var Redis=require(_0xbfc5('0x5'));var db=require(_0xbfc5('0x6'))['db'];var utils=require(_0xbfc5('0x7'));var logger=require(_0xbfc5('0x8'))(_0xbfc5('0x9'));var config=require(_0xbfc5('0xa'));var jayson=require(_0xbfc5('0xb'));var client=jayson[_0xbfc5('0xc')][_0xbfc5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfd3ab8,_0x56ca42,_0x16f342){return new BPromise(function(_0x4b15e6,_0x25e5d6){return client[_0xbfc5('0xe')](_0xfd3ab8,_0x16f342)[_0xbfc5('0xf')](function(_0x248490){logger[_0xbfc5('0x10')](_0xbfc5('0x11'),_0x56ca42,_0xbfc5('0x12'));logger[_0xbfc5('0x13')](_0xbfc5('0x14'),_0x56ca42,_0xbfc5('0x12'),JSON[_0xbfc5('0x15')](_0x248490));if(_0x248490[_0xbfc5('0x16')]){if(_0x248490[_0xbfc5('0x16')][_0xbfc5('0x17')]===0x1f4){logger['error'](_0xbfc5('0x11'),_0x56ca42,_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);return _0x25e5d6(_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);}logger[_0xbfc5('0x16')](_0xbfc5('0x11'),_0x56ca42,_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);return _0x4b15e6(_0x248490['error']['message']);}else{logger[_0xbfc5('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x56ca42,'request\x20sent');_0x4b15e6(_0x248490[_0xbfc5('0x19')][_0xbfc5('0x18')]);}})[_0xbfc5('0x1a')](function(_0x2b7e8c){logger[_0xbfc5('0x16')](_0xbfc5('0x11'),_0x56ca42,_0x2b7e8c);_0x25e5d6(_0x2b7e8c);});});}exports[_0xbfc5('0x1b')]=function(_0x417c2d){var _0x97e01c=this;return new Promise(function(_0x17f9ae,_0x41e4f6){return db[_0xbfc5('0x1c')][_0xbfc5('0x1d')]({'raw':_0x417c2d[_0xbfc5('0x1e')]?_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x1f')]===undefined?!![]:![]:!![],'where':_0x417c2d[_0xbfc5('0x1e')]?_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x20')]||null:null,'attributes':_0x417c2d['options']?_0x417c2d[_0xbfc5('0x1e')]['attributes']||null:null,'limit':_0x417c2d['options']?_0x417c2d['options'][_0xbfc5('0x21')]||null:null,'include':_0x417c2d['options']?_0x417c2d[_0xbfc5('0x1e')]['include']?_[_0xbfc5('0x22')](_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x23')],function(_0x54b374){return{'model':db[_0x54b374[_0xbfc5('0x24')]],'as':_0x54b374['as'],'attributes':_0x54b374[_0xbfc5('0x25')],'include':_0x54b374[_0xbfc5('0x23')]?_[_0xbfc5('0x22')](_0x54b374['include'],function(_0x5abf6d){return{'model':db[_0x5abf6d[_0xbfc5('0x24')]],'as':_0x5abf6d['as'],'attributes':_0x5abf6d[_0xbfc5('0x25')],'include':_0x5abf6d[_0xbfc5('0x23')]?_[_0xbfc5('0x22')](_0x5abf6d[_0xbfc5('0x23')],function(_0x40bd2d){return{'model':db[_0x40bd2d[_0xbfc5('0x24')]],'as':_0x40bd2d['as'],'attributes':_0x40bd2d['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfc5('0xf')](function(_0x2664d3){logger[_0xbfc5('0x10')]('GetDynamics365Account',_0x417c2d);logger[_0xbfc5('0x13')](_0xbfc5('0x1b'),_0x417c2d,JSON['stringify'](_0x2664d3));_0x17f9ae(_0x2664d3);})[_0xbfc5('0x1a')](function(_0x1ef5d2){logger['error'](_0xbfc5('0x1b'),_0x1ef5d2[_0xbfc5('0x18')],_0x417c2d);_0x41e4f6(_0x97e01c['error'](0x1f4,_0x1ef5d2[_0xbfc5('0x18')]));});});};exports[_0xbfc5('0x26')]=function(_0x458a9b){var _0x5e543d=this;return new Promise(function(_0x409950,_0x1eeb48){return db[_0xbfc5('0x1c')][_0xbfc5('0x27')]({'raw':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b['options'][_0xbfc5('0x1f')]===undefined?!![]:![]:!![],'where':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x20')]||null:null,'attributes':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x25')]||null:null,'include':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x23')]?_['map'](_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x23')],function(_0x575096){return{'model':db[_0x575096[_0xbfc5('0x24')]],'as':_0x575096['as'],'attributes':_0x575096['attributes'],'include':_0x575096['include']?_['map'](_0x575096[_0xbfc5('0x23')],function(_0x2f0144){return{'model':db[_0x2f0144[_0xbfc5('0x24')]],'as':_0x2f0144['as'],'attributes':_0x2f0144['attributes'],'include':_0x2f0144[_0xbfc5('0x23')]?_['map'](_0x2f0144[_0xbfc5('0x23')],function(_0x5ac4b3){return{'model':db[_0x5ac4b3[_0xbfc5('0x24')]],'as':_0x5ac4b3['as'],'attributes':_0x5ac4b3[_0xbfc5('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40cbfb){logger[_0xbfc5('0x10')](_0xbfc5('0x26'),_0x458a9b);logger[_0xbfc5('0x13')](_0xbfc5('0x26'),_0x458a9b,JSON[_0xbfc5('0x15')](_0x40cbfb));_0x409950(_0x40cbfb);})['catch'](function(_0x21237e){logger[_0xbfc5('0x16')]('ShowDynamics365Account',_0x21237e[_0xbfc5('0x18')],_0x458a9b);_0x1eeb48(_0x5e543d['error'](0x1f4,_0x21237e[_0xbfc5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 99da826..9b84738 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 _0xd9b4=['/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','isAuthenticated','index','get'];(function(_0x20c512,_0x36c198){var _0x25236e=function(_0x418ec3){while(--_0x418ec3){_0x20c512['push'](_0x20c512['shift']());}};_0x25236e(++_0x36c198);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x4661ea,_0x2abbad){_0x4661ea=_0x4661ea-0x0;var _0x400aaf=_0xd9b4[_0x4661ea];return _0x400aaf;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d9b('0x8'));router['get']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xa')]);router[_0x4d9b('0xb')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xd')]);router['get'](_0x4d9b('0xe'),auth['isAuthenticated'](),controller[_0x4d9b('0xf')]);router['get']('/:id/subjects',auth[_0x4d9b('0x9')](),controller['getSubjects']);router[_0x4d9b('0xb')](_0x4d9b('0x10'),auth['isAuthenticated'](),controller[_0x4d9b('0x11')]);router['post']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x12')]);router[_0x4d9b('0x13')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller['update']);router[_0x4d9b('0x14')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x15')]);module[_0x4d9b('0x16')]=router; \ No newline at end of file +var _0x0b70=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0x0b70,0x159));var _0x00b7=function(_0x21faf8,_0x3cae65){_0x21faf8=_0x21faf8-0x0;var _0x265ebc=_0x0b70[_0x21faf8];return _0x265ebc;};'use strict';var multer=require('multer');var util=require(_0x00b7('0x0'));var path=require('path');var timeout=require(_0x00b7('0x1'));var express=require(_0x00b7('0x2'));var router=express['Router']();var fs_extra=require(_0x00b7('0x3'));var auth=require(_0x00b7('0x4'));var interaction=require(_0x00b7('0x5'));var config=require('../../config/environment');var controller=require(_0x00b7('0x6'));router['get']('/',auth[_0x00b7('0x7')](),controller['index']);router[_0x00b7('0x8')]('/:id',auth[_0x00b7('0x7')](),controller['show']);router[_0x00b7('0x8')](_0x00b7('0x9'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xa')]);router['get'](_0x00b7('0xb'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xc')]);router['get'](_0x00b7('0xd'),auth['isAuthenticated'](),controller[_0x00b7('0xe')]);router[_0x00b7('0xf')]('/',auth[_0x00b7('0x7')](),controller[_0x00b7('0x10')]);router[_0x00b7('0x11')](_0x00b7('0x12'),auth[_0x00b7('0x7')](),controller[_0x00b7('0x13')]);router[_0x00b7('0x14')](_0x00b7('0x12'),auth['isAuthenticated'](),controller[_0x00b7('0x15')]);module[_0x00b7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0567a20..7be56f8 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 _0x7c0a=['nothing','contact','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x558050,_0x174ec4){var _0x3ee149=function(_0x22be0f){while(--_0x22be0f){_0x558050['push'](_0x558050['shift']());}};_0x3ee149(++_0x174ec4);}(_0x7c0a,0x19b));var _0xa7c0=function(_0x193302,_0x31c981){_0x193302=_0x193302-0x0;var _0x56ab6b=_0x7c0a[_0x193302];return _0x56ab6b;};'use strict';var Sequelize=require(_0xa7c0('0x0'));module[_0xa7c0('0x1')]={'name':{'type':Sequelize[_0xa7c0('0x2')]},'description':{'type':Sequelize[_0xa7c0('0x2')]},'ticketType':{'type':Sequelize[_0xa7c0('0x3')](_0xa7c0('0x4'),'phonecall'),'defaultValue':_0xa7c0('0x4')},'moduleCreate':{'type':Sequelize[_0xa7c0('0x3')]('contact',_0xa7c0('0x5')),'defaultValue':_0xa7c0('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa7c0('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa7c0('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5567=['nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact'];(function(_0x47c1e9,_0x5026c9){var _0x2227c0=function(_0x2053a2){while(--_0x2053a2){_0x47c1e9['push'](_0x47c1e9['shift']());}};_0x2227c0(++_0x5026c9);}(_0x5567,0x16a));var _0x7556=function(_0x31af51,_0x256874){_0x31af51=_0x31af51-0x0;var _0x505c77=_0x5567[_0x31af51];return _0x505c77;};'use strict';var Sequelize=require(_0x7556('0x0'));module[_0x7556('0x1')]={'name':{'type':Sequelize[_0x7556('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7556('0x3'),_0x7556('0x4')),'defaultValue':_0x7556('0x3')},'moduleCreate':{'type':Sequelize[_0x7556('0x5')](_0x7556('0x6'),_0x7556('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7556('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7556('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ee58455..c9228f3 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 _0x1db8=['getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','then','catch','params','length','find','create','body','getFields','findOne','Dynamics365Field','pick','options','nolimit','getSubjects'];(function(_0xf68a38,_0x8ac731){var _0x1c07bc=function(_0x446365){while(--_0x446365){_0xf68a38['push'](_0xf68a38['shift']());}};_0x1c07bc(++_0x8ac731);}(_0x1db8,0x145));var _0x81db=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1db8[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x81db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81db('0x1'));var jsonpatch=require(_0x81db('0x2'));var rp=require(_0x81db('0x3'));var moment=require(_0x81db('0x4'));var BPromise=require(_0x81db('0x5'));var Mustache=require(_0x81db('0x6'));var util=require(_0x81db('0x7'));var path=require(_0x81db('0x8'));var sox=require(_0x81db('0x9'));var csv=require(_0x81db('0xa'));var ejs=require(_0x81db('0xb'));var fs=require('fs');var fs_extra=require(_0x81db('0xc'));var _=require(_0x81db('0xd'));var squel=require('squel');var crypto=require(_0x81db('0xe'));var jsforce=require(_0x81db('0xf'));var deskjs=require(_0x81db('0x10'));var toCsv=require(_0x81db('0xa'));var querystring=require(_0x81db('0x11'));var Papa=require(_0x81db('0x12'));var Redis=require(_0x81db('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x81db('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81db('0x15'));var logger=require(_0x81db('0x16'))(_0x81db('0x17'));var utils=require('../../config/utils');var config=require(_0x81db('0x18'));var licenseUtil=require(_0x81db('0x19'));var db=require(_0x81db('0x1a'))['db'];function respondWithStatusCode(_0x392a4d,_0x501c91){_0x501c91=_0x501c91||0xcc;return function(_0x5aac39){if(_0x5aac39){return _0x392a4d[_0x81db('0x1b')](_0x501c91);}return _0x392a4d[_0x81db('0x1c')](_0x501c91)[_0x81db('0x1d')]();};}function respondWithResult(_0x1dd59e,_0x1f2940){_0x1f2940=_0x1f2940||0xc8;return function(_0x2741a1){if(_0x2741a1){return _0x1dd59e[_0x81db('0x1c')](_0x1f2940)[_0x81db('0x1e')](_0x2741a1);}};}function respondWithFilteredResult(_0x5b8c57,_0x52187a){return function(_0x1251e8){if(_0x1251e8){var _0x288690=typeof _0x52187a[_0x81db('0x1f')]==='undefined'&&typeof _0x52187a[_0x81db('0x20')]==='undefined';var _0xcfe102=_0x1251e8['count'];var _0x4a3764=_0x288690?0x0:_0x52187a[_0x81db('0x1f')];var _0x3bdd31=_0x288690?_0x1251e8['count']:_0x52187a[_0x81db('0x1f')]+_0x52187a[_0x81db('0x20')];var _0x17de66;if(_0x3bdd31>=_0xcfe102){_0x3bdd31=_0xcfe102;_0x17de66=0xc8;}else{_0x17de66=0xce;}_0x5b8c57[_0x81db('0x1c')](_0x17de66);return _0x5b8c57[_0x81db('0x21')]('Content-Range',_0x4a3764+'-'+_0x3bdd31+'/'+_0xcfe102)[_0x81db('0x1e')](_0x1251e8);}return null;};}function patchUpdates(_0x4220fa){return function(_0x5f251a){try{jsonpatch[_0x81db('0x22')](_0x5f251a,_0x4220fa,!![]);}catch(_0x5c4477){return BPromise['reject'](_0x5c4477);}return _0x5f251a[_0x81db('0x23')]();};}function saveUpdates(_0x4617a6,_0x52ddd3){return function(_0x5c6e6e){if(_0x5c6e6e){return _0x5c6e6e[_0x81db('0x24')](_0x4617a6)['then'](function(_0x5d95e1){return _0x5d95e1;});}return null;};}function removeEntity(_0x32d1b9,_0x3a7b28){return function(_0x45fa2a){if(_0x45fa2a){return _0x45fa2a[_0x81db('0x25')]()['then'](function(){_0x32d1b9[_0x81db('0x1c')](0xcc)[_0x81db('0x1d')]();});}};}function handleEntityNotFound(_0x16c27b,_0x5d014c){return function(_0x445d47){if(!_0x445d47){_0x16c27b['sendStatus'](0x194);}return _0x445d47;};}function handleError(_0x3c7883,_0x22bbb2){_0x22bbb2=_0x22bbb2||0x1f4;return function(_0x45196b){logger[_0x81db('0x26')](_0x45196b[_0x81db('0x27')]);if(_0x45196b[_0x81db('0x28')]){delete _0x45196b[_0x81db('0x28')];}_0x3c7883['status'](_0x22bbb2)['send'](_0x45196b);};}exports[_0x81db('0x29')]=function(_0x3b90f7,_0x3bc485){var _0xd2dd13={},_0x557f18={},_0x892975={'count':0x0,'rows':[]};var _0x1cdab4=_[_0x81db('0x2a')](db[_0x81db('0x2b')][_0x81db('0x2c')],function(_0x5ad674){return{'name':_0x5ad674[_0x81db('0x2d')],'type':_0x5ad674[_0x81db('0x2e')][_0x81db('0x2f')]};});_0x557f18['model']=_[_0x81db('0x2a')](_0x1cdab4,_0x81db('0x28'));_0x557f18[_0x81db('0x30')]=_[_0x81db('0x31')](_0x3b90f7[_0x81db('0x30')]);_0x557f18[_0x81db('0x32')]=_['intersection'](_0x557f18['model'],_0x557f18[_0x81db('0x30')]);_0xd2dd13[_0x81db('0x33')]=_[_0x81db('0x34')](_0x557f18[_0x81db('0x35')],qs['fields'](_0x3b90f7[_0x81db('0x30')][_0x81db('0x36')]));_0xd2dd13['attributes']=_0xd2dd13['attributes']['length']?_0xd2dd13[_0x81db('0x33')]:_0x557f18[_0x81db('0x35')];if(!_0x3b90f7[_0x81db('0x30')][_0x81db('0x37')]('nolimit')){_0xd2dd13[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x3b90f7[_0x81db('0x30')]['limit']);_0xd2dd13[_0x81db('0x1f')]=qs[_0x81db('0x1f')](_0x3b90f7[_0x81db('0x30')][_0x81db('0x1f')]);}_0xd2dd13[_0x81db('0x38')]=qs['sort'](_0x3b90f7[_0x81db('0x30')][_0x81db('0x39')]);_0xd2dd13[_0x81db('0x3a')]=qs[_0x81db('0x32')](_['pick'](_0x3b90f7[_0x81db('0x30')],_0x557f18[_0x81db('0x32')]),_0x1cdab4);if(_0x3b90f7[_0x81db('0x30')][_0x81db('0x3b')]){_0xd2dd13[_0x81db('0x3a')]=_[_0x81db('0x3c')](_0xd2dd13[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x1cdab4,function(_0x1e18f3){if(_0x1e18f3[_0x81db('0x2e')]!==_0x81db('0x3d')){var _0x103a7e={};_0x103a7e[_0x1e18f3['name']]={'$like':'%'+_0x3b90f7['query']['filter']+'%'};return _0x103a7e;}})});}_0xd2dd13=_[_0x81db('0x3c')]({},_0xd2dd13,_0x3b90f7['options']);var _0x1350d1={'where':_0xd2dd13['where']};return db['Dynamics365Configuration']['count'](_0x1350d1)['then'](function(_0x4302ee){_0x892975[_0x81db('0x3e')]=_0x4302ee;if(_0x3b90f7[_0x81db('0x30')][_0x81db('0x3f')]){_0xd2dd13[_0x81db('0x40')]=[{'all':!![]}];}return db[_0x81db('0x2b')][_0x81db('0x41')](_0xd2dd13);})[_0x81db('0x42')](function(_0x573a8a){_0x892975['rows']=_0x573a8a;return _0x892975;})[_0x81db('0x42')](respondWithFilteredResult(_0x3bc485,_0xd2dd13))[_0x81db('0x43')](handleError(_0x3bc485,null));};exports['show']=function(_0x22d994,_0x162e71){var _0xce6ffa={'raw':![],'where':{'id':_0x22d994[_0x81db('0x44')]['id']}},_0x5db30d={};_0x5db30d[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x2b')]['rawAttributes']);_0x5db30d['query']=_[_0x81db('0x31')](_0x22d994[_0x81db('0x30')]);_0x5db30d[_0x81db('0x32')]=_['intersection'](_0x5db30d[_0x81db('0x35')],_0x5db30d[_0x81db('0x30')]);_0xce6ffa['attributes']=_['intersection'](_0x5db30d[_0x81db('0x35')],qs[_0x81db('0x36')](_0x22d994[_0x81db('0x30')][_0x81db('0x36')]));_0xce6ffa[_0x81db('0x33')]=_0xce6ffa[_0x81db('0x33')][_0x81db('0x45')]?_0xce6ffa[_0x81db('0x33')]:_0x5db30d[_0x81db('0x35')];if(_0x22d994[_0x81db('0x30')]['includeAll']){_0xce6ffa[_0x81db('0x40')]=[{'all':!![]}];}_0xce6ffa=_[_0x81db('0x3c')]({},_0xce6ffa,_0x22d994['options']);return db[_0x81db('0x2b')][_0x81db('0x46')](_0xce6ffa)['then'](handleEntityNotFound(_0x162e71,null))[_0x81db('0x42')](respondWithResult(_0x162e71,null))['catch'](handleError(_0x162e71,null));};exports['create']=function(_0x55cbbe,_0x294688){return db[_0x81db('0x2b')][_0x81db('0x47')](_0x55cbbe[_0x81db('0x48')],{})[_0x81db('0x42')](respondWithResult(_0x294688,0xc9))[_0x81db('0x43')](handleError(_0x294688,null));};exports[_0x81db('0x24')]=function(_0x128196,_0x3795d4){if(_0x128196[_0x81db('0x48')]['id']){delete _0x128196[_0x81db('0x48')]['id'];}return db[_0x81db('0x2b')][_0x81db('0x46')]({'where':{'id':_0x128196[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x3795d4,null))['then'](saveUpdates(_0x128196['body'],null))[_0x81db('0x42')](respondWithResult(_0x3795d4,null))[_0x81db('0x43')](handleError(_0x3795d4,null));};exports[_0x81db('0x25')]=function(_0x18a771,_0x25e61c){return db[_0x81db('0x2b')][_0x81db('0x46')]({'where':{'id':_0x18a771[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x25e61c,null))[_0x81db('0x42')](removeEntity(_0x25e61c,null))[_0x81db('0x43')](handleError(_0x25e61c,null));};exports[_0x81db('0x49')]=function(_0x2a9b69,_0x572f4b,_0x49bed6){var _0x3549b2={};var _0x29e9f1={};var _0x1011e9;var _0x55b685;return db[_0x81db('0x2b')][_0x81db('0x4a')]({'where':{'id':_0x2a9b69[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x572f4b,null))[_0x81db('0x42')](function(_0x2e7d55){if(_0x2e7d55){_0x1011e9=_0x2e7d55;_0x29e9f1[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')][_0x81db('0x2c')]);_0x29e9f1[_0x81db('0x30')]=_[_0x81db('0x31')](_0x2a9b69[_0x81db('0x30')]);_0x29e9f1[_0x81db('0x32')]=_[_0x81db('0x34')](_0x29e9f1[_0x81db('0x35')],_0x29e9f1['query']);_0x3549b2[_0x81db('0x33')]=_[_0x81db('0x34')](_0x29e9f1[_0x81db('0x35')],qs[_0x81db('0x36')](_0x2a9b69['query'][_0x81db('0x36')]));_0x3549b2[_0x81db('0x33')]=_0x3549b2[_0x81db('0x33')][_0x81db('0x45')]?_0x3549b2['attributes']:_0x29e9f1[_0x81db('0x35')];_0x3549b2[_0x81db('0x38')]=qs[_0x81db('0x39')](_0x2a9b69['query'][_0x81db('0x39')]);_0x3549b2[_0x81db('0x3a')]=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x2a9b69[_0x81db('0x30')],_0x29e9f1['filters']));if(_0x2a9b69[_0x81db('0x30')][_0x81db('0x3b')]){_0x3549b2['where']=_[_0x81db('0x3c')](_0x3549b2[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x3549b2[_0x81db('0x33')],function(_0x3223a3){var _0x54c6cc={};_0x54c6cc[_0x3223a3]={'$like':'%'+_0x2a9b69[_0x81db('0x30')][_0x81db('0x3b')]+'%'};return _0x54c6cc;})});}_0x3549b2=_[_0x81db('0x3c')]({},_0x3549b2,_0x2a9b69[_0x81db('0x4d')]);return _0x1011e9[_0x81db('0x49')](_0x3549b2);}})['then'](function(_0x23e27c){if(_0x23e27c){_0x55b685=_0x23e27c['length'];if(!_0x2a9b69[_0x81db('0x30')][_0x81db('0x37')](_0x81db('0x4e'))){_0x3549b2[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x2a9b69[_0x81db('0x30')]['limit']);_0x3549b2['offset']=qs[_0x81db('0x1f')](_0x2a9b69[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x1011e9['getFields'](_0x3549b2);}})[_0x81db('0x42')](function(_0x568c51){if(_0x568c51){return _0x568c51?{'count':_0x55b685,'rows':_0x568c51}:null;}})[_0x81db('0x42')](respondWithResult(_0x572f4b,null))['catch'](handleError(_0x572f4b,null));};exports[_0x81db('0x4f')]=function(_0x15da7e,_0x3a7d20,_0x19e37b){var _0x5592f5={};var _0x3932c0={};var _0x50c893;var _0x184b05;return db[_0x81db('0x2b')][_0x81db('0x4a')]({'where':{'id':_0x15da7e['params']['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x3a7d20,null))[_0x81db('0x42')](function(_0x60b794){if(_0x60b794){_0x50c893=_0x60b794;_0x3932c0[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')][_0x81db('0x2c')]);_0x3932c0['query']=_['keys'](_0x15da7e[_0x81db('0x30')]);_0x3932c0[_0x81db('0x32')]=_[_0x81db('0x34')](_0x3932c0[_0x81db('0x35')],_0x3932c0[_0x81db('0x30')]);_0x5592f5[_0x81db('0x33')]=_['intersection'](_0x3932c0[_0x81db('0x35')],qs[_0x81db('0x36')](_0x15da7e[_0x81db('0x30')][_0x81db('0x36')]));_0x5592f5[_0x81db('0x33')]=_0x5592f5[_0x81db('0x33')][_0x81db('0x45')]?_0x5592f5[_0x81db('0x33')]:_0x3932c0[_0x81db('0x35')];_0x5592f5['order']=qs[_0x81db('0x39')](_0x15da7e[_0x81db('0x30')]['sort']);_0x5592f5[_0x81db('0x3a')]=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x15da7e[_0x81db('0x30')],_0x3932c0[_0x81db('0x32')]));if(_0x15da7e[_0x81db('0x30')]['filter']){_0x5592f5[_0x81db('0x3a')]=_[_0x81db('0x3c')](_0x5592f5[_0x81db('0x3a')],{'$or':_['map'](_0x5592f5[_0x81db('0x33')],function(_0x593161){var _0x1da515={};_0x1da515[_0x593161]={'$like':'%'+_0x15da7e[_0x81db('0x30')][_0x81db('0x3b')]+'%'};return _0x1da515;})});}_0x5592f5=_['merge']({},_0x5592f5,_0x15da7e[_0x81db('0x4d')]);return _0x50c893[_0x81db('0x4f')](_0x5592f5);}})[_0x81db('0x42')](function(_0x2d73fe){if(_0x2d73fe){_0x184b05=_0x2d73fe['length'];if(!_0x15da7e[_0x81db('0x30')][_0x81db('0x37')]('nolimit')){_0x5592f5['limit']=qs[_0x81db('0x20')](_0x15da7e[_0x81db('0x30')]['limit']);_0x5592f5['offset']=qs[_0x81db('0x1f')](_0x15da7e[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x50c893[_0x81db('0x4f')](_0x5592f5);}})[_0x81db('0x42')](function(_0x199880){if(_0x199880){return _0x199880?{'count':_0x184b05,'rows':_0x199880}:null;}})[_0x81db('0x42')](respondWithResult(_0x3a7d20,null))['catch'](handleError(_0x3a7d20,null));};exports[_0x81db('0x50')]=function(_0x1a2b6e,_0x37e4f2,_0x55693e){var _0x5b594c={};var _0x397bd0={};var _0x2acf2d;var _0x24188f;return db[_0x81db('0x2b')]['findOne']({'where':{'id':_0x1a2b6e[_0x81db('0x44')]['id']}})['then'](handleEntityNotFound(_0x37e4f2,null))[_0x81db('0x42')](function(_0x4f147c){if(_0x4f147c){_0x2acf2d=_0x4f147c;_0x397bd0[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')]['rawAttributes']);_0x397bd0[_0x81db('0x30')]=_[_0x81db('0x31')](_0x1a2b6e['query']);_0x397bd0['filters']=_[_0x81db('0x34')](_0x397bd0[_0x81db('0x35')],_0x397bd0['query']);_0x5b594c[_0x81db('0x33')]=_[_0x81db('0x34')](_0x397bd0['model'],qs[_0x81db('0x36')](_0x1a2b6e['query']['fields']));_0x5b594c[_0x81db('0x33')]=_0x5b594c[_0x81db('0x33')][_0x81db('0x45')]?_0x5b594c[_0x81db('0x33')]:_0x397bd0[_0x81db('0x35')];_0x5b594c[_0x81db('0x38')]=qs[_0x81db('0x39')](_0x1a2b6e[_0x81db('0x30')][_0x81db('0x39')]);_0x5b594c['where']=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x1a2b6e[_0x81db('0x30')],_0x397bd0[_0x81db('0x32')]));if(_0x1a2b6e[_0x81db('0x30')]['filter']){_0x5b594c['where']=_[_0x81db('0x3c')](_0x5b594c[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x5b594c[_0x81db('0x33')],function(_0x202b05){var _0x2a8250={};_0x2a8250[_0x202b05]={'$like':'%'+_0x1a2b6e['query']['filter']+'%'};return _0x2a8250;})});}_0x5b594c=_[_0x81db('0x3c')]({},_0x5b594c,_0x1a2b6e[_0x81db('0x4d')]);return _0x2acf2d[_0x81db('0x50')](_0x5b594c);}})[_0x81db('0x42')](function(_0x20de2e){if(_0x20de2e){_0x24188f=_0x20de2e['length'];if(!_0x1a2b6e[_0x81db('0x30')]['hasOwnProperty'](_0x81db('0x4e'))){_0x5b594c[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x1a2b6e[_0x81db('0x30')]['limit']);_0x5b594c[_0x81db('0x1f')]=qs[_0x81db('0x1f')](_0x1a2b6e[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x2acf2d[_0x81db('0x50')](_0x5b594c);}})[_0x81db('0x42')](function(_0x16bad7){if(_0x16bad7){return _0x16bad7?{'count':_0x24188f,'rows':_0x16bad7}:null;}})[_0x81db('0x42')](respondWithResult(_0x37e4f2,null))[_0x81db('0x43')](handleError(_0x37e4f2,null));}; \ No newline at end of file +var _0xc4eb=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','catch','include','options','find','create','body','params','getFields','Dynamics365Field','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0xc4eb,0xd4));var _0xbc4e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc4eb[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xbc4e('0x0'));var rimraf=require(_0xbc4e('0x1'));var zipdir=require(_0xbc4e('0x2'));var jsonpatch=require(_0xbc4e('0x3'));var rp=require(_0xbc4e('0x4'));var moment=require(_0xbc4e('0x5'));var BPromise=require(_0xbc4e('0x6'));var Mustache=require(_0xbc4e('0x7'));var util=require('util');var path=require(_0xbc4e('0x8'));var sox=require(_0xbc4e('0x9'));var csv=require(_0xbc4e('0xa'));var ejs=require(_0xbc4e('0xb'));var fs=require('fs');var fs_extra=require(_0xbc4e('0xc'));var _=require(_0xbc4e('0xd'));var squel=require(_0xbc4e('0xe'));var crypto=require(_0xbc4e('0xf'));var jsforce=require(_0xbc4e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbc4e('0xa'));var querystring=require(_0xbc4e('0x11'));var Papa=require(_0xbc4e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc4e('0x13'));var as=require(_0xbc4e('0x14'));var hardwareService=require(_0xbc4e('0x15'));var logger=require(_0xbc4e('0x16'))(_0xbc4e('0x17'));var utils=require(_0xbc4e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x458694,_0x501081){_0x501081=_0x501081||0xcc;return function(_0x51c79b){if(_0x51c79b){return _0x458694[_0xbc4e('0x19')](_0x501081);}return _0x458694[_0xbc4e('0x1a')](_0x501081)[_0xbc4e('0x1b')]();};}function respondWithResult(_0x17a6b5,_0x57316a){_0x57316a=_0x57316a||0xc8;return function(_0x514c50){if(_0x514c50){return _0x17a6b5['status'](_0x57316a)[_0xbc4e('0x1c')](_0x514c50);}};}function respondWithFilteredResult(_0x4eb486,_0x29555d){return function(_0x3d8bd8){if(_0x3d8bd8){var _0xb12edb=typeof _0x29555d[_0xbc4e('0x1d')]===_0xbc4e('0x1e')&&typeof _0x29555d[_0xbc4e('0x1f')]===_0xbc4e('0x1e');var _0x1d884d=_0x3d8bd8[_0xbc4e('0x20')];var _0x2320e0=_0xb12edb?0x0:_0x29555d[_0xbc4e('0x1d')];var _0x44d0de=_0xb12edb?_0x3d8bd8['count']:_0x29555d[_0xbc4e('0x1d')]+_0x29555d['limit'];var _0x5a56c9;if(_0x44d0de>=_0x1d884d){_0x44d0de=_0x1d884d;_0x5a56c9=0xc8;}else{_0x5a56c9=0xce;}_0x4eb486[_0xbc4e('0x1a')](_0x5a56c9);return _0x4eb486[_0xbc4e('0x21')](_0xbc4e('0x22'),_0x2320e0+'-'+_0x44d0de+'/'+_0x1d884d)[_0xbc4e('0x1c')](_0x3d8bd8);}return null;};}function patchUpdates(_0x47497e){return function(_0x231f52){try{jsonpatch[_0xbc4e('0x23')](_0x231f52,_0x47497e,!![]);}catch(_0x58133a){return BPromise[_0xbc4e('0x24')](_0x58133a);}return _0x231f52['save']();};}function saveUpdates(_0x331f9a,_0x2874e6){return function(_0x45bfe2){if(_0x45bfe2){return _0x45bfe2[_0xbc4e('0x25')](_0x331f9a)[_0xbc4e('0x26')](function(_0x43705f){return _0x43705f;});}return null;};}function removeEntity(_0x482355,_0x4c7d19){return function(_0x3fe0ca){if(_0x3fe0ca){return _0x3fe0ca[_0xbc4e('0x27')]()[_0xbc4e('0x26')](function(){_0x482355['status'](0xcc)[_0xbc4e('0x1b')]();});}};}function handleEntityNotFound(_0x4038f4,_0x272ddc){return function(_0x54124e){if(!_0x54124e){_0x4038f4['sendStatus'](0x194);}return _0x54124e;};}function handleError(_0x1169cf,_0xc3e42a){_0xc3e42a=_0xc3e42a||0x1f4;return function(_0x3b9193){logger[_0xbc4e('0x28')](_0x3b9193['stack']);if(_0x3b9193['name']){delete _0x3b9193[_0xbc4e('0x29')];}_0x1169cf[_0xbc4e('0x1a')](_0xc3e42a)[_0xbc4e('0x2a')](_0x3b9193);};}exports[_0xbc4e('0x2b')]=function(_0x3f58ad,_0x250eaf){var _0x25a3c7={},_0x131f75={},_0x2b1e27={'count':0x0,'rows':[]};var _0x11fad3=_[_0xbc4e('0x2c')](db[_0xbc4e('0x2d')][_0xbc4e('0x2e')],function(_0xcf581d){return{'name':_0xcf581d[_0xbc4e('0x2f')],'type':_0xcf581d[_0xbc4e('0x30')][_0xbc4e('0x31')]};});_0x131f75[_0xbc4e('0x32')]=_[_0xbc4e('0x2c')](_0x11fad3,_0xbc4e('0x29'));_0x131f75['query']=_[_0xbc4e('0x33')](_0x3f58ad[_0xbc4e('0x34')]);_0x131f75['filters']=_[_0xbc4e('0x35')](_0x131f75[_0xbc4e('0x32')],_0x131f75[_0xbc4e('0x34')]);_0x25a3c7['attributes']=_['intersection'](_0x131f75[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x25a3c7[_0xbc4e('0x37')]=_0x25a3c7[_0xbc4e('0x37')][_0xbc4e('0x38')]?_0x25a3c7['attributes']:_0x131f75[_0xbc4e('0x32')];if(!_0x3f58ad['query'][_0xbc4e('0x39')](_0xbc4e('0x3a'))){_0x25a3c7['limit']=qs['limit'](_0x3f58ad['query']['limit']);_0x25a3c7[_0xbc4e('0x1d')]=qs['offset'](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}_0x25a3c7[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x25a3c7['where']=qs[_0xbc4e('0x3d')](_['pick'](_0x3f58ad[_0xbc4e('0x34')],_0x131f75[_0xbc4e('0x3d')]),_0x11fad3);if(_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x25a3c7[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x25a3c7[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x11fad3,function(_0x2a3b89){if(_0x2a3b89[_0xbc4e('0x30')]!==_0xbc4e('0x41')){var _0x5d7903={};_0x5d7903[_0x2a3b89[_0xbc4e('0x29')]]={'$like':'%'+_0x3f58ad['query'][_0xbc4e('0x3e')]+'%'};return _0x5d7903;}})});}_0x25a3c7=_[_0xbc4e('0x40')]({},_0x25a3c7,_0x3f58ad['options']);var _0x1a3b99={'where':_0x25a3c7[_0xbc4e('0x3f')]};return db[_0xbc4e('0x2d')][_0xbc4e('0x20')](_0x1a3b99)[_0xbc4e('0x26')](function(_0x298fa7){_0x2b1e27[_0xbc4e('0x20')]=_0x298fa7;if(_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x42')]){_0x25a3c7['include']=[{'all':!![]}];}return db[_0xbc4e('0x2d')]['findAll'](_0x25a3c7);})[_0xbc4e('0x26')](function(_0x607c2e){_0x2b1e27['rows']=_0x607c2e;return _0x2b1e27;})[_0xbc4e('0x26')](respondWithFilteredResult(_0x250eaf,_0x25a3c7))[_0xbc4e('0x43')](handleError(_0x250eaf,null));};exports['show']=function(_0x4949c7,_0x397d2d){var _0x556530={'raw':![],'where':{'id':_0x4949c7['params']['id']}},_0x54a02b={};_0x54a02b[_0xbc4e('0x32')]=_['keys'](db[_0xbc4e('0x2d')][_0xbc4e('0x2e')]);_0x54a02b[_0xbc4e('0x34')]=_['keys'](_0x4949c7[_0xbc4e('0x34')]);_0x54a02b[_0xbc4e('0x3d')]=_[_0xbc4e('0x35')](_0x54a02b['model'],_0x54a02b[_0xbc4e('0x34')]);_0x556530['attributes']=_[_0xbc4e('0x35')](_0x54a02b[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x4949c7[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x556530[_0xbc4e('0x37')]=_0x556530[_0xbc4e('0x37')][_0xbc4e('0x38')]?_0x556530[_0xbc4e('0x37')]:_0x54a02b[_0xbc4e('0x32')];if(_0x4949c7[_0xbc4e('0x34')][_0xbc4e('0x42')]){_0x556530[_0xbc4e('0x44')]=[{'all':!![]}];}_0x556530=_[_0xbc4e('0x40')]({},_0x556530,_0x4949c7[_0xbc4e('0x45')]);return db[_0xbc4e('0x2d')][_0xbc4e('0x46')](_0x556530)['then'](handleEntityNotFound(_0x397d2d,null))[_0xbc4e('0x26')](respondWithResult(_0x397d2d,null))['catch'](handleError(_0x397d2d,null));};exports[_0xbc4e('0x47')]=function(_0x3ebe4b,_0x343626){return db[_0xbc4e('0x2d')][_0xbc4e('0x47')](_0x3ebe4b[_0xbc4e('0x48')],{})[_0xbc4e('0x26')](respondWithResult(_0x343626,0xc9))['catch'](handleError(_0x343626,null));};exports['update']=function(_0x125d0b,_0x5e29d5){if(_0x125d0b[_0xbc4e('0x48')]['id']){delete _0x125d0b[_0xbc4e('0x48')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x125d0b[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x5e29d5,null))[_0xbc4e('0x26')](saveUpdates(_0x125d0b[_0xbc4e('0x48')],null))[_0xbc4e('0x26')](respondWithResult(_0x5e29d5,null))[_0xbc4e('0x43')](handleError(_0x5e29d5,null));};exports[_0xbc4e('0x27')]=function(_0x522a46,_0x1ddb92){return db[_0xbc4e('0x2d')][_0xbc4e('0x46')]({'where':{'id':_0x522a46[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x1ddb92,null))['then'](removeEntity(_0x1ddb92,null))['catch'](handleError(_0x1ddb92,null));};exports[_0xbc4e('0x4a')]=function(_0x457c98,_0x365180,_0x2e5184){var _0x399a0a={};var _0x576a38={};var _0x34d3ff;var _0x41a875;return db[_0xbc4e('0x2d')]['findOne']({'where':{'id':_0x457c98[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x365180,null))[_0xbc4e('0x26')](function(_0x32933f){if(_0x32933f){_0x34d3ff=_0x32933f;_0x576a38[_0xbc4e('0x32')]=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')][_0xbc4e('0x2e')]);_0x576a38[_0xbc4e('0x34')]=_[_0xbc4e('0x33')](_0x457c98[_0xbc4e('0x34')]);_0x576a38[_0xbc4e('0x3d')]=_['intersection'](_0x576a38[_0xbc4e('0x32')],_0x576a38[_0xbc4e('0x34')]);_0x399a0a['attributes']=_[_0xbc4e('0x35')](_0x576a38[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x399a0a['attributes']=_0x399a0a['attributes'][_0xbc4e('0x38')]?_0x399a0a['attributes']:_0x576a38[_0xbc4e('0x32')];_0x399a0a[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x399a0a[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_['pick'](_0x457c98[_0xbc4e('0x34')],_0x576a38[_0xbc4e('0x3d')]));if(_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x399a0a[_0xbc4e('0x3f')]=_['merge'](_0x399a0a[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x399a0a[_0xbc4e('0x37')],function(_0x356d86){var _0x527197={};_0x527197[_0x356d86]={'$like':'%'+_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3e')]+'%'};return _0x527197;})});}_0x399a0a=_[_0xbc4e('0x40')]({},_0x399a0a,_0x457c98[_0xbc4e('0x45')]);return _0x34d3ff[_0xbc4e('0x4a')](_0x399a0a);}})['then'](function(_0x259b4f){if(_0x259b4f){_0x41a875=_0x259b4f[_0xbc4e('0x38')];if(!_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x39')]('nolimit')){_0x399a0a['limit']=qs[_0xbc4e('0x1f')](_0x457c98[_0xbc4e('0x34')]['limit']);_0x399a0a['offset']=qs['offset'](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x34d3ff['getFields'](_0x399a0a);}})[_0xbc4e('0x26')](function(_0x27ab37){if(_0x27ab37){return _0x27ab37?{'count':_0x41a875,'rows':_0x27ab37}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x365180,null))[_0xbc4e('0x43')](handleError(_0x365180,null));};exports[_0xbc4e('0x4c')]=function(_0x432a19,_0x2b6fc8,_0x50eb51){var _0x279e91={};var _0xf2deae={};var _0x88700f;var _0x1b4918;return db[_0xbc4e('0x2d')][_0xbc4e('0x4d')]({'where':{'id':_0x432a19[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x2b6fc8,null))['then'](function(_0x42aac9){if(_0x42aac9){_0x88700f=_0x42aac9;_0xf2deae[_0xbc4e('0x32')]=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')]['rawAttributes']);_0xf2deae['query']=_['keys'](_0x432a19[_0xbc4e('0x34')]);_0xf2deae['filters']=_[_0xbc4e('0x35')](_0xf2deae[_0xbc4e('0x32')],_0xf2deae['query']);_0x279e91['attributes']=_[_0xbc4e('0x35')](_0xf2deae[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x279e91['attributes']=_0x279e91['attributes'][_0xbc4e('0x38')]?_0x279e91['attributes']:_0xf2deae[_0xbc4e('0x32')];_0x279e91[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x279e91[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_[_0xbc4e('0x4e')](_0x432a19[_0xbc4e('0x34')],_0xf2deae['filters']));if(_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x279e91[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x279e91[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x279e91[_0xbc4e('0x37')],function(_0x2e9295){var _0x2ccce6={};_0x2ccce6[_0x2e9295]={'$like':'%'+_0x432a19['query'][_0xbc4e('0x3e')]+'%'};return _0x2ccce6;})});}_0x279e91=_[_0xbc4e('0x40')]({},_0x279e91,_0x432a19['options']);return _0x88700f['getSubjects'](_0x279e91);}})['then'](function(_0x1c57e1){if(_0x1c57e1){_0x1b4918=_0x1c57e1['length'];if(!_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x39')](_0xbc4e('0x3a'))){_0x279e91[_0xbc4e('0x1f')]=qs[_0xbc4e('0x1f')](_0x432a19[_0xbc4e('0x34')]['limit']);_0x279e91[_0xbc4e('0x1d')]=qs[_0xbc4e('0x1d')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x88700f[_0xbc4e('0x4c')](_0x279e91);}})[_0xbc4e('0x26')](function(_0x2c9660){if(_0x2c9660){return _0x2c9660?{'count':_0x1b4918,'rows':_0x2c9660}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x2b6fc8,null))['catch'](handleError(_0x2b6fc8,null));};exports[_0xbc4e('0x4f')]=function(_0x41c90b,_0x2241a4,_0x46039f){var _0x5f3196={};var _0x1e959a={};var _0x33a28d;var _0x5e0e6e;return db['Dynamics365Configuration'][_0xbc4e('0x4d')]({'where':{'id':_0x41c90b[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x2241a4,null))[_0xbc4e('0x26')](function(_0x3ea9ee){if(_0x3ea9ee){_0x33a28d=_0x3ea9ee;_0x1e959a['model']=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')]['rawAttributes']);_0x1e959a['query']=_['keys'](_0x41c90b[_0xbc4e('0x34')]);_0x1e959a['filters']=_[_0xbc4e('0x35')](_0x1e959a[_0xbc4e('0x32')],_0x1e959a[_0xbc4e('0x34')]);_0x5f3196[_0xbc4e('0x37')]=_['intersection'](_0x1e959a[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x5f3196['attributes']=_0x5f3196[_0xbc4e('0x37')]['length']?_0x5f3196[_0xbc4e('0x37')]:_0x1e959a['model'];_0x5f3196['order']=qs[_0xbc4e('0x3c')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x5f3196[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_[_0xbc4e('0x4e')](_0x41c90b[_0xbc4e('0x34')],_0x1e959a[_0xbc4e('0x3d')]));if(_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x5f3196[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x5f3196[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x5f3196[_0xbc4e('0x37')],function(_0x23d981){var _0x5e1490={};_0x5e1490[_0x23d981]={'$like':'%'+_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3e')]+'%'};return _0x5e1490;})});}_0x5f3196=_[_0xbc4e('0x40')]({},_0x5f3196,_0x41c90b[_0xbc4e('0x45')]);return _0x33a28d[_0xbc4e('0x4f')](_0x5f3196);}})[_0xbc4e('0x26')](function(_0x390c0a){if(_0x390c0a){_0x5e0e6e=_0x390c0a['length'];if(!_0x41c90b[_0xbc4e('0x34')]['hasOwnProperty']('nolimit')){_0x5f3196[_0xbc4e('0x1f')]=qs[_0xbc4e('0x1f')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x1f')]);_0x5f3196[_0xbc4e('0x1d')]=qs[_0xbc4e('0x1d')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x33a28d[_0xbc4e('0x4f')](_0x5f3196);}})[_0xbc4e('0x26')](function(_0x3960d8){if(_0x3960d8){return _0x3960d8?{'count':_0x5e0e6e,'rows':_0x3960d8}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x2241a4,null))[_0xbc4e('0x43')](handleError(_0x2241a4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ac5d1e0..15b9a6f 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x2638c7,_0x3e2ff3){var _0x3af4d2=function(_0x409c87){while(--_0x409c87){_0x2638c7['push'](_0x2638c7['shift']());}};_0x3af4d2(++_0x3e2ff3);}(_0xb821,0xa7));var _0x1b82=function(_0x16a20b,_0x57d4c1){_0x16a20b=_0x16a20b-0x0;var _0x3e86c2=_0xb821[_0x16a20b];return _0x3e86c2;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40ccb2,_0x393b29){var _0x40d81a=function(_0x562ff5){while(--_0x562ff5){_0x40ccb2['push'](_0x40ccb2['shift']());}};_0x40d81a(++_0x393b29);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0xf3cd[_0x2595a6];return _0x460197;};'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('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 5d3b9b1..03d812a 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 _0xcfea=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x21ecf3,_0x3b4b99){var _0x3cf63a=function(_0x536c67){while(--_0x536c67){_0x21ecf3['push'](_0x21ecf3['shift']());}};_0x3cf63a(++_0x3b4b99);}(_0xcfea,0x134));var _0xacfe=function(_0x136b43,_0x32bae0){_0x136b43=_0x136b43-0x0;var _0x2449a6=_0xcfea[_0x136b43];return _0x2449a6;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var moment=require(_0xacfe('0x2'));var BPromise=require(_0xacfe('0x3'));var rs=require(_0xacfe('0x4'));var fs=require('fs');var Redis=require(_0xacfe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xacfe('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xacfe('0x7'));var client=jayson[_0xacfe('0x8')][_0xacfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d13ec,_0x5c56d2,_0x324a5b){return new BPromise(function(_0x358a9d,_0x4e077a){return client[_0xacfe('0xa')](_0x3d13ec,_0x324a5b)[_0xacfe('0xb')](function(_0x404c68){logger[_0xacfe('0xc')](_0xacfe('0xd'),_0x5c56d2,'request\x20sent');logger[_0xacfe('0xe')](_0xacfe('0xf'),_0x5c56d2,_0xacfe('0x10'),JSON['stringify'](_0x404c68));if(_0x404c68[_0xacfe('0x11')]){if(_0x404c68['error'][_0xacfe('0x12')]===0x1f4){logger[_0xacfe('0x11')](_0xacfe('0xd'),_0x5c56d2,_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x4e077a(_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c56d2,_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x358a9d(_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c56d2,_0xacfe('0x10'));_0x358a9d(_0x404c68[_0xacfe('0x14')]['message']);}})[_0xacfe('0x15')](function(_0xc5180c){logger[_0xacfe('0x11')](_0xacfe('0xd'),_0x5c56d2,_0xc5180c);_0x4e077a(_0xc5180c);});});} \ No newline at end of file +var _0xc44b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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','catch','lodash','util'];(function(_0x5dec5d,_0x3e9854){var _0x335653=function(_0x543b37){while(--_0x543b37){_0x5dec5d['push'](_0x5dec5d['shift']());}};_0x335653(++_0x3e9854);}(_0xc44b,0xb4));var _0xbc44=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xc44b[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var moment=require(_0xbc44('0x2'));var BPromise=require(_0xbc44('0x3'));var rs=require(_0xbc44('0x4'));var fs=require('fs');var Redis=require(_0xbc44('0x5'));var db=require(_0xbc44('0x6'))['db'];var utils=require(_0xbc44('0x7'));var logger=require(_0xbc44('0x8'))(_0xbc44('0x9'));var config=require(_0xbc44('0xa'));var jayson=require(_0xbc44('0xb'));var client=jayson[_0xbc44('0xc')][_0xbc44('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x50327f,_0xc1acd7,_0x18aa36){return new BPromise(function(_0x24de1d,_0x243b50){return client['request'](_0x50327f,_0x18aa36)[_0xbc44('0xe')](function(_0x420424){logger[_0xbc44('0xf')](_0xbc44('0x10'),_0xc1acd7,_0xbc44('0x11'));logger[_0xbc44('0x12')](_0xbc44('0x13'),_0xc1acd7,'request\x20sent',JSON[_0xbc44('0x14')](_0x420424));if(_0x420424[_0xbc44('0x15')]){if(_0x420424[_0xbc44('0x15')][_0xbc44('0x16')]===0x1f4){logger['error'](_0xbc44('0x10'),_0xc1acd7,_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);return _0x243b50(_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xc1acd7,_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);return _0x24de1d(_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);}else{logger[_0xbc44('0xf')](_0xbc44('0x10'),_0xc1acd7,'request\x20sent');_0x24de1d(_0x420424[_0xbc44('0x18')]['message']);}})[_0xbc44('0x19')](function(_0xf9d041){logger[_0xbc44('0x15')](_0xbc44('0x10'),_0xc1acd7,_0xf9d041);_0x243b50(_0xf9d041);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index dbce0bd..71b53d1 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 _0xbe70=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer'];(function(_0x1b45b0,_0x2cd9dc){var _0x2c206c=function(_0x1c2f84){while(--_0x1c2f84){_0x1b45b0['push'](_0x1b45b0['shift']());}};_0x2c206c(++_0x2cd9dc);}(_0xbe70,0x12f));var _0x0be7=function(_0x273963,_0x3aeb6e){_0x273963=_0x273963-0x0;var _0x3cf7de=_0xbe70[_0x273963];return _0x3cf7de;};'use strict';var multer=require(_0x0be7('0x0'));var util=require(_0x0be7('0x1'));var path=require(_0x0be7('0x2'));var timeout=require(_0x0be7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0be7('0x4'));var auth=require(_0x0be7('0x5'));var interaction=require(_0x0be7('0x6'));var config=require(_0x0be7('0x7'));var controller=require(_0x0be7('0x8'));router[_0x0be7('0x9')]('/',auth['isAuthenticated'](),controller[_0x0be7('0xa')]);router[_0x0be7('0x9')](_0x0be7('0xb'),auth[_0x0be7('0xc')](),controller[_0x0be7('0xd')]);router[_0x0be7('0xe')]('/',auth['isAuthenticated'](),controller[_0x0be7('0xf')]);router[_0x0be7('0x10')](_0x0be7('0xb'),auth[_0x0be7('0xc')](),controller[_0x0be7('0x11')]);router['delete'](_0x0be7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0be7('0x12')]=router; \ No newline at end of file +var _0x0714=['/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intDynamics365Field.controller','get','index'];(function(_0xceee14,_0x445318){var _0x5139df=function(_0x5b7727){while(--_0x5b7727){_0xceee14['push'](_0xceee14['shift']());}};_0x5139df(++_0x445318);}(_0x0714,0x177));var _0x4071=function(_0x144ba0,_0x1e7b98){_0x144ba0=_0x144ba0-0x0;var _0x3b95c1=_0x0714[_0x144ba0];return _0x3b95c1;};'use strict';var multer=require(_0x4071('0x0'));var util=require(_0x4071('0x1'));var path=require(_0x4071('0x2'));var timeout=require(_0x4071('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4071('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4071('0x5'));var controller=require(_0x4071('0x6'));router[_0x4071('0x7')]('/',auth['isAuthenticated'](),controller[_0x4071('0x8')]);router[_0x4071('0x7')](_0x4071('0x9'),auth[_0x4071('0xa')](),controller[_0x4071('0xb')]);router[_0x4071('0xc')]('/',auth[_0x4071('0xa')](),controller['create']);router['put'](_0x4071('0x9'),auth[_0x4071('0xa')](),controller[_0x4071('0xd')]);router['delete'](_0x4071('0x9'),auth['isAuthenticated'](),controller[_0x4071('0xe')]);module[_0x4071('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 eae1efe..34eee1d 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 _0x035c=['keyValue','picklist','STRING','string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x035c,0x1a0));var _0xc035=function(_0x44ec86,_0x2c6106){_0x44ec86=_0x44ec86-0x0;var _0xbf55cd=_0x035c[_0x44ec86];return _0xbf55cd;};'use strict';var Sequelize=require(_0xc035('0x0'));module[_0xc035('0x1')]={'type':{'type':Sequelize[_0xc035('0x2')]('string','variable',_0xc035('0x3'),_0xc035('0x4'),_0xc035('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc035('0x6')]},'keyType':{'type':Sequelize[_0xc035('0x2')](_0xc035('0x7'),_0xc035('0x8'),_0xc035('0x3'))},'keyContent':{'type':Sequelize[_0xc035('0x6')]},'idField':{'type':Sequelize[_0xc035('0x6')]},'nameField':{'type':Sequelize[_0xc035('0x6')]},'customField':{'type':Sequelize[_0xc035('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc035('0x6')]}}; \ No newline at end of file +var _0x6cbc=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x5a7de2,_0x2c0c67){var _0x4c5a8e=function(_0x123d79){while(--_0x123d79){_0x5a7de2['push'](_0x5a7de2['shift']());}};_0x4c5a8e(++_0x2c0c67);}(_0x6cbc,0x1d0));var _0xc6cb=function(_0x42693d,_0x434c1c){_0x42693d=_0x42693d-0x0;var _0x57f95f=_0x6cbc[_0x42693d];return _0x57f95f;};'use strict';var Sequelize=require(_0xc6cb('0x0'));module[_0xc6cb('0x1')]={'type':{'type':Sequelize[_0xc6cb('0x2')]('string',_0xc6cb('0x3'),_0xc6cb('0x4'),_0xc6cb('0x5'),_0xc6cb('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6cb('0x7')]},'keyType':{'type':Sequelize[_0xc6cb('0x2')]('string',_0xc6cb('0x3'),_0xc6cb('0x4'))},'keyContent':{'type':Sequelize[_0xc6cb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc6cb('0x7')]},'customField':{'type':Sequelize[_0xc6cb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6cb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 70eb2cf..487236c 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 _0x8be8=['catch','keys','includeAll','include','options','find','create','body','params','eml-format','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','findAll'];(function(_0x5f2bd3,_0xa1da97){var _0x15134b=function(_0x46a88d){while(--_0x46a88d){_0x5f2bd3['push'](_0x5f2bd3['shift']());}};_0x15134b(++_0xa1da97);}(_0x8be8,0xd8));var _0x88be=function(_0x239394,_0x55e733){_0x239394=_0x239394-0x0;var _0x596491=_0x8be8[_0x239394];return _0x596491;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x88be('0x1'));var Mustache=require(_0x88be('0x2'));var util=require(_0x88be('0x3'));var path=require(_0x88be('0x4'));var sox=require(_0x88be('0x5'));var csv=require(_0x88be('0x6'));var ejs=require(_0x88be('0x7'));var fs=require('fs');var fs_extra=require(_0x88be('0x8'));var _=require(_0x88be('0x9'));var squel=require('squel');var crypto=require(_0x88be('0xa'));var jsforce=require(_0x88be('0xb'));var deskjs=require(_0x88be('0xc'));var toCsv=require(_0x88be('0x6'));var querystring=require('querystring');var Papa=require(_0x88be('0xd'));var Redis=require('ioredis');var authService=require(_0x88be('0xe'));var qs=require(_0x88be('0xf'));var as=require(_0x88be('0x10'));var hardwareService=require(_0x88be('0x11'));var logger=require(_0x88be('0x12'))(_0x88be('0x13'));var utils=require('../../config/utils');var config=require(_0x88be('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x88be('0x15'))['db'];function respondWithStatusCode(_0x2ef7b2,_0x4db065){_0x4db065=_0x4db065||0xcc;return function(_0x4d752d){if(_0x4d752d){return _0x2ef7b2[_0x88be('0x16')](_0x4db065);}return _0x2ef7b2[_0x88be('0x17')](_0x4db065)[_0x88be('0x18')]();};}function respondWithResult(_0xaff36,_0x1a0b8d){_0x1a0b8d=_0x1a0b8d||0xc8;return function(_0x374c6c){if(_0x374c6c){return _0xaff36[_0x88be('0x17')](_0x1a0b8d)['json'](_0x374c6c);}};}function respondWithFilteredResult(_0x4a9f72,_0x388db9){return function(_0xd80131){if(_0xd80131){var _0x26fb4e=typeof _0x388db9[_0x88be('0x19')]===_0x88be('0x1a')&&typeof _0x388db9[_0x88be('0x1b')]===_0x88be('0x1a');var _0x168aa7=_0xd80131[_0x88be('0x1c')];var _0x5e6c61=_0x26fb4e?0x0:_0x388db9['offset'];var _0x5695df=_0x26fb4e?_0xd80131[_0x88be('0x1c')]:_0x388db9['offset']+_0x388db9['limit'];var _0x1a5299;if(_0x5695df>=_0x168aa7){_0x5695df=_0x168aa7;_0x1a5299=0xc8;}else{_0x1a5299=0xce;}_0x4a9f72['status'](_0x1a5299);return _0x4a9f72[_0x88be('0x1d')](_0x88be('0x1e'),_0x5e6c61+'-'+_0x5695df+'/'+_0x168aa7)[_0x88be('0x1f')](_0xd80131);}return null;};}function patchUpdates(_0x42ff87){return function(_0x1ee492){try{jsonpatch[_0x88be('0x20')](_0x1ee492,_0x42ff87,!![]);}catch(_0x53b6a7){return BPromise['reject'](_0x53b6a7);}return _0x1ee492[_0x88be('0x21')]();};}function saveUpdates(_0x4daa49,_0xef7b95){return function(_0x53cf29){if(_0x53cf29){return _0x53cf29[_0x88be('0x22')](_0x4daa49)[_0x88be('0x23')](function(_0x1f702e){return _0x1f702e;});}return null;};}function removeEntity(_0x202d04,_0x4b35a5){return function(_0x2c0524){if(_0x2c0524){return _0x2c0524['destroy']()['then'](function(){_0x202d04[_0x88be('0x17')](0xcc)[_0x88be('0x18')]();});}};}function handleEntityNotFound(_0x50d4b5,_0x4cd010){return function(_0x442c7d){if(!_0x442c7d){_0x50d4b5['sendStatus'](0x194);}return _0x442c7d;};}function handleError(_0x4ff860,_0x2dc363){_0x2dc363=_0x2dc363||0x1f4;return function(_0xe96d9d){logger['error'](_0xe96d9d[_0x88be('0x24')]);if(_0xe96d9d[_0x88be('0x25')]){delete _0xe96d9d[_0x88be('0x25')];}_0x4ff860[_0x88be('0x17')](_0x2dc363)[_0x88be('0x26')](_0xe96d9d);};}exports[_0x88be('0x27')]=function(_0x5d6f40,_0x13da1c){var _0x162313={},_0x26c1ca={},_0x50fb8c={'count':0x0,'rows':[]};var _0x461832=_[_0x88be('0x28')](db[_0x88be('0x29')][_0x88be('0x2a')],function(_0x3347b6){return{'name':_0x3347b6[_0x88be('0x2b')],'type':_0x3347b6[_0x88be('0x2c')][_0x88be('0x2d')]};});_0x26c1ca[_0x88be('0x2e')]=_['map'](_0x461832,_0x88be('0x25'));_0x26c1ca[_0x88be('0x2f')]=_['keys'](_0x5d6f40[_0x88be('0x2f')]);_0x26c1ca[_0x88be('0x30')]=_['intersection'](_0x26c1ca[_0x88be('0x2e')],_0x26c1ca[_0x88be('0x2f')]);_0x162313[_0x88be('0x31')]=_[_0x88be('0x32')](_0x26c1ca[_0x88be('0x2e')],qs[_0x88be('0x33')](_0x5d6f40['query']['fields']));_0x162313[_0x88be('0x31')]=_0x162313[_0x88be('0x31')][_0x88be('0x34')]?_0x162313[_0x88be('0x31')]:_0x26c1ca[_0x88be('0x2e')];if(!_0x5d6f40[_0x88be('0x2f')]['hasOwnProperty'](_0x88be('0x35'))){_0x162313[_0x88be('0x1b')]=qs[_0x88be('0x1b')](_0x5d6f40[_0x88be('0x2f')]['limit']);_0x162313['offset']=qs[_0x88be('0x19')](_0x5d6f40[_0x88be('0x2f')]['offset']);}_0x162313['order']=qs[_0x88be('0x36')](_0x5d6f40[_0x88be('0x2f')][_0x88be('0x36')]);_0x162313[_0x88be('0x37')]=qs[_0x88be('0x30')](_[_0x88be('0x38')](_0x5d6f40[_0x88be('0x2f')],_0x26c1ca[_0x88be('0x30')]),_0x461832);if(_0x5d6f40['query'][_0x88be('0x39')]){_0x162313[_0x88be('0x37')]=_[_0x88be('0x3a')](_0x162313[_0x88be('0x37')],{'$or':_[_0x88be('0x28')](_0x461832,function(_0x4bab94){if(_0x4bab94[_0x88be('0x2c')]!=='VIRTUAL'){var _0x294052={};_0x294052[_0x4bab94['name']]={'$like':'%'+_0x5d6f40['query'][_0x88be('0x39')]+'%'};return _0x294052;}})});}_0x162313=_['merge']({},_0x162313,_0x5d6f40['options']);var _0x409fa5={'where':_0x162313[_0x88be('0x37')]};return db['Dynamics365Field']['count'](_0x409fa5)[_0x88be('0x23')](function(_0x3dd5ac){_0x50fb8c[_0x88be('0x1c')]=_0x3dd5ac;if(_0x5d6f40[_0x88be('0x2f')]['includeAll']){_0x162313['include']=[{'all':!![]}];}return db[_0x88be('0x29')][_0x88be('0x3b')](_0x162313);})['then'](function(_0x37dff2){_0x50fb8c['rows']=_0x37dff2;return _0x50fb8c;})['then'](respondWithFilteredResult(_0x13da1c,_0x162313))[_0x88be('0x3c')](handleError(_0x13da1c,null));};exports['show']=function(_0x527083,_0x35b215){var _0x4d20a6={'raw':!![],'where':{'id':_0x527083['params']['id']}},_0x13b274={};_0x13b274['model']=_[_0x88be('0x3d')](db['Dynamics365Field'][_0x88be('0x2a')]);_0x13b274[_0x88be('0x2f')]=_['keys'](_0x527083['query']);_0x13b274[_0x88be('0x30')]=_[_0x88be('0x32')](_0x13b274['model'],_0x13b274['query']);_0x4d20a6[_0x88be('0x31')]=_[_0x88be('0x32')](_0x13b274['model'],qs[_0x88be('0x33')](_0x527083[_0x88be('0x2f')][_0x88be('0x33')]));_0x4d20a6[_0x88be('0x31')]=_0x4d20a6[_0x88be('0x31')]['length']?_0x4d20a6[_0x88be('0x31')]:_0x13b274[_0x88be('0x2e')];if(_0x527083[_0x88be('0x2f')][_0x88be('0x3e')]){_0x4d20a6[_0x88be('0x3f')]=[{'all':!![]}];}_0x4d20a6=_[_0x88be('0x3a')]({},_0x4d20a6,_0x527083[_0x88be('0x40')]);return db[_0x88be('0x29')][_0x88be('0x41')](_0x4d20a6)[_0x88be('0x23')](handleEntityNotFound(_0x35b215,null))[_0x88be('0x23')](respondWithResult(_0x35b215,null))['catch'](handleError(_0x35b215,null));};exports[_0x88be('0x42')]=function(_0x484bbc,_0x2631a5){return db[_0x88be('0x29')]['create'](_0x484bbc[_0x88be('0x43')],{})['then'](respondWithResult(_0x2631a5,0xc9))[_0x88be('0x3c')](handleError(_0x2631a5,null));};exports[_0x88be('0x22')]=function(_0x2d80f6,_0x1aa59b){if(_0x2d80f6['body']['id']){delete _0x2d80f6[_0x88be('0x43')]['id'];}return db[_0x88be('0x29')][_0x88be('0x41')]({'where':{'id':_0x2d80f6[_0x88be('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aa59b,null))[_0x88be('0x23')](saveUpdates(_0x2d80f6['body'],null))[_0x88be('0x23')](respondWithResult(_0x1aa59b,null))[_0x88be('0x3c')](handleError(_0x1aa59b,null));};exports['destroy']=function(_0xafe236,_0xd2e0e0){return db[_0x88be('0x29')][_0x88be('0x41')]({'where':{'id':_0xafe236[_0x88be('0x44')]['id']}})[_0x88be('0x23')](handleEntityNotFound(_0xd2e0e0,null))[_0x88be('0x23')](removeEntity(_0xd2e0e0,null))[_0x88be('0x3c')](handleError(_0xd2e0e0,null));}; \ No newline at end of file +var _0xd853=['sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Field','findAll','catch','params','find','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','offset','limit','count','status','set','json','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x476341,_0x498228){var _0x27b6d5=function(_0x192d23){while(--_0x192d23){_0x476341['push'](_0x476341['shift']());}};_0x27b6d5(++_0x498228);}(_0xd853,0xd9));var _0x3d85=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xd853[_0x54d52];return _0x968345;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d85('0x0'));var jsonpatch=require(_0x3d85('0x1'));var rp=require('request-promise');var moment=require(_0x3d85('0x2'));var BPromise=require(_0x3d85('0x3'));var Mustache=require(_0x3d85('0x4'));var util=require('util');var path=require(_0x3d85('0x5'));var sox=require('sox');var csv=require(_0x3d85('0x6'));var ejs=require(_0x3d85('0x7'));var fs=require('fs');var fs_extra=require(_0x3d85('0x8'));var _=require(_0x3d85('0x9'));var squel=require('squel');var crypto=require(_0x3d85('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3d85('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3d85('0xc'));var Papa=require('papaparse');var Redis=require(_0x3d85('0xd'));var authService=require(_0x3d85('0xe'));var qs=require(_0x3d85('0xf'));var as=require(_0x3d85('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d85('0x11'))(_0x3d85('0x12'));var utils=require(_0x3d85('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3d85('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7efef9,_0x1476b6){_0x1476b6=_0x1476b6||0xcc;return function(_0x4903bd){if(_0x4903bd){return _0x7efef9[_0x3d85('0x15')](_0x1476b6);}return _0x7efef9['status'](_0x1476b6)['end']();};}function respondWithResult(_0x29f1e2,_0x487422){_0x487422=_0x487422||0xc8;return function(_0x48afa6){if(_0x48afa6){return _0x29f1e2['status'](_0x487422)['json'](_0x48afa6);}};}function respondWithFilteredResult(_0x203755,_0x41dd35){return function(_0x43bcb1){if(_0x43bcb1){var _0x7f4847=typeof _0x41dd35[_0x3d85('0x16')]==='undefined'&&typeof _0x41dd35[_0x3d85('0x17')]==='undefined';var _0x4eb11f=_0x43bcb1[_0x3d85('0x18')];var _0x11e040=_0x7f4847?0x0:_0x41dd35[_0x3d85('0x16')];var _0x19225a=_0x7f4847?_0x43bcb1[_0x3d85('0x18')]:_0x41dd35[_0x3d85('0x16')]+_0x41dd35['limit'];var _0x45a872;if(_0x19225a>=_0x4eb11f){_0x19225a=_0x4eb11f;_0x45a872=0xc8;}else{_0x45a872=0xce;}_0x203755[_0x3d85('0x19')](_0x45a872);return _0x203755[_0x3d85('0x1a')]('Content-Range',_0x11e040+'-'+_0x19225a+'/'+_0x4eb11f)[_0x3d85('0x1b')](_0x43bcb1);}return null;};}function patchUpdates(_0x48b100){return function(_0x4515c6){try{jsonpatch[_0x3d85('0x1c')](_0x4515c6,_0x48b100,!![]);}catch(_0x428ab7){return BPromise[_0x3d85('0x1d')](_0x428ab7);}return _0x4515c6['save']();};}function saveUpdates(_0x130e66,_0x1cda9e){return function(_0x4e57d8){if(_0x4e57d8){return _0x4e57d8[_0x3d85('0x1e')](_0x130e66)[_0x3d85('0x1f')](function(_0x63e108){return _0x63e108;});}return null;};}function removeEntity(_0x48a761,_0x2964e6){return function(_0x4621c2){if(_0x4621c2){return _0x4621c2['destroy']()[_0x3d85('0x1f')](function(){_0x48a761[_0x3d85('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37489a,_0xbad17f){return function(_0x36c299){if(!_0x36c299){_0x37489a[_0x3d85('0x15')](0x194);}return _0x36c299;};}function handleError(_0x37569c,_0x4f785d){_0x4f785d=_0x4f785d||0x1f4;return function(_0x3315f1){logger[_0x3d85('0x20')](_0x3315f1[_0x3d85('0x21')]);if(_0x3315f1[_0x3d85('0x22')]){delete _0x3315f1['name'];}_0x37569c[_0x3d85('0x19')](_0x4f785d)['send'](_0x3315f1);};}exports[_0x3d85('0x23')]=function(_0x2cc11d,_0x16df29){var _0x2250fc={},_0x2a7d2f={},_0x1c9b7d={'count':0x0,'rows':[]};var _0x3549dc=_[_0x3d85('0x24')](db['Dynamics365Field'][_0x3d85('0x25')],function(_0x5896c5){return{'name':_0x5896c5[_0x3d85('0x26')],'type':_0x5896c5[_0x3d85('0x27')][_0x3d85('0x28')]};});_0x2a7d2f[_0x3d85('0x29')]=_['map'](_0x3549dc,_0x3d85('0x22'));_0x2a7d2f[_0x3d85('0x2a')]=_[_0x3d85('0x2b')](_0x2cc11d[_0x3d85('0x2a')]);_0x2a7d2f[_0x3d85('0x2c')]=_['intersection'](_0x2a7d2f[_0x3d85('0x29')],_0x2a7d2f[_0x3d85('0x2a')]);_0x2250fc[_0x3d85('0x2d')]=_[_0x3d85('0x2e')](_0x2a7d2f[_0x3d85('0x29')],qs[_0x3d85('0x2f')](_0x2cc11d['query']['fields']));_0x2250fc[_0x3d85('0x2d')]=_0x2250fc['attributes'][_0x3d85('0x30')]?_0x2250fc['attributes']:_0x2a7d2f['model'];if(!_0x2cc11d['query'][_0x3d85('0x31')](_0x3d85('0x32'))){_0x2250fc['limit']=qs[_0x3d85('0x17')](_0x2cc11d[_0x3d85('0x2a')][_0x3d85('0x17')]);_0x2250fc[_0x3d85('0x16')]=qs[_0x3d85('0x16')](_0x2cc11d[_0x3d85('0x2a')]['offset']);}_0x2250fc['order']=qs[_0x3d85('0x33')](_0x2cc11d[_0x3d85('0x2a')]['sort']);_0x2250fc[_0x3d85('0x34')]=qs['filters'](_[_0x3d85('0x35')](_0x2cc11d['query'],_0x2a7d2f[_0x3d85('0x2c')]),_0x3549dc);if(_0x2cc11d['query'][_0x3d85('0x36')]){_0x2250fc[_0x3d85('0x34')]=_['merge'](_0x2250fc['where'],{'$or':_[_0x3d85('0x24')](_0x3549dc,function(_0x21d32e){if(_0x21d32e[_0x3d85('0x27')]!=='VIRTUAL'){var _0x4318e2={};_0x4318e2[_0x21d32e[_0x3d85('0x22')]]={'$like':'%'+_0x2cc11d['query'][_0x3d85('0x36')]+'%'};return _0x4318e2;}})});}_0x2250fc=_[_0x3d85('0x37')]({},_0x2250fc,_0x2cc11d[_0x3d85('0x38')]);var _0x2cbf4b={'where':_0x2250fc['where']};return db['Dynamics365Field'][_0x3d85('0x18')](_0x2cbf4b)[_0x3d85('0x1f')](function(_0x481697){_0x1c9b7d['count']=_0x481697;if(_0x2cc11d[_0x3d85('0x2a')][_0x3d85('0x39')]){_0x2250fc[_0x3d85('0x3a')]=[{'all':!![]}];}return db[_0x3d85('0x3b')][_0x3d85('0x3c')](_0x2250fc);})[_0x3d85('0x1f')](function(_0x448545){_0x1c9b7d['rows']=_0x448545;return _0x1c9b7d;})['then'](respondWithFilteredResult(_0x16df29,_0x2250fc))[_0x3d85('0x3d')](handleError(_0x16df29,null));};exports['show']=function(_0x7ad832,_0x3c31d8){var _0x169570={'raw':!![],'where':{'id':_0x7ad832[_0x3d85('0x3e')]['id']}},_0x497bfc={};_0x497bfc[_0x3d85('0x29')]=_[_0x3d85('0x2b')](db[_0x3d85('0x3b')][_0x3d85('0x25')]);_0x497bfc[_0x3d85('0x2a')]=_[_0x3d85('0x2b')](_0x7ad832[_0x3d85('0x2a')]);_0x497bfc['filters']=_[_0x3d85('0x2e')](_0x497bfc[_0x3d85('0x29')],_0x497bfc[_0x3d85('0x2a')]);_0x169570['attributes']=_['intersection'](_0x497bfc['model'],qs[_0x3d85('0x2f')](_0x7ad832['query'][_0x3d85('0x2f')]));_0x169570[_0x3d85('0x2d')]=_0x169570['attributes'][_0x3d85('0x30')]?_0x169570[_0x3d85('0x2d')]:_0x497bfc[_0x3d85('0x29')];if(_0x7ad832[_0x3d85('0x2a')][_0x3d85('0x39')]){_0x169570['include']=[{'all':!![]}];}_0x169570=_['merge']({},_0x169570,_0x7ad832['options']);return db['Dynamics365Field'][_0x3d85('0x3f')](_0x169570)[_0x3d85('0x1f')](handleEntityNotFound(_0x3c31d8,null))[_0x3d85('0x1f')](respondWithResult(_0x3c31d8,null))[_0x3d85('0x3d')](handleError(_0x3c31d8,null));};exports['create']=function(_0x20e0c1,_0x24a012){return db[_0x3d85('0x3b')][_0x3d85('0x40')](_0x20e0c1[_0x3d85('0x41')],{})[_0x3d85('0x1f')](respondWithResult(_0x24a012,0xc9))[_0x3d85('0x3d')](handleError(_0x24a012,null));};exports[_0x3d85('0x1e')]=function(_0x3495ba,_0x4a445c){if(_0x3495ba[_0x3d85('0x41')]['id']){delete _0x3495ba['body']['id'];}return db[_0x3d85('0x3b')][_0x3d85('0x3f')]({'where':{'id':_0x3495ba[_0x3d85('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a445c,null))['then'](saveUpdates(_0x3495ba[_0x3d85('0x41')],null))['then'](respondWithResult(_0x4a445c,null))[_0x3d85('0x3d')](handleError(_0x4a445c,null));};exports[_0x3d85('0x42')]=function(_0x2ea40b,_0x4938d7){return db[_0x3d85('0x3b')]['find']({'where':{'id':_0x2ea40b[_0x3d85('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4938d7,null))['then'](removeEntity(_0x4938d7,null))[_0x3d85('0x3d')](handleError(_0x4938d7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index cf7c5b1..5dd7385 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 _0xa18c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x59e932,_0x2c522c){var _0xebd075=function(_0x486ad4){while(--_0x486ad4){_0x59e932['push'](_0x59e932['shift']());}};_0xebd075(++_0x2c522c);}(_0xa18c,0x165));var _0xca18=function(_0x101e6b,_0x57fe42){_0x101e6b=_0x101e6b-0x0;var _0x37b281=_0xa18c[_0x101e6b];return _0x37b281;};'use strict';var _=require(_0xca18('0x0'));var util=require(_0xca18('0x1'));var logger=require('../../config/logger')(_0xca18('0x2'));var moment=require(_0xca18('0x3'));var BPromise=require(_0xca18('0x4'));var rp=require(_0xca18('0x5'));var fs=require('fs');var path=require(_0xca18('0x6'));var rimraf=require(_0xca18('0x7'));var config=require(_0xca18('0x8'));var attributes=require(_0xca18('0x9'));module[_0xca18('0xa')]=function(_0x15c84e,_0x2bf859){return _0x15c84e[_0xca18('0xb')](_0xca18('0xc'),attributes,{'tableName':_0xca18('0xd'),'paranoid':![],'indexes':[{'name':_0xca18('0xe'),'fields':[_0xca18('0xf'),_0xca18('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f88=['exports','define','Dynamics365Field','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x494c32,_0x26498e){var _0x520865=function(_0x4cdb2f){while(--_0x4cdb2f){_0x494c32['push'](_0x494c32['shift']());}};_0x520865(++_0x26498e);}(_0x3f88,0x14a));var _0x83f8=function(_0x499ea6,_0x105051){_0x499ea6=_0x499ea6-0x0;var _0x43cdc8=_0x3f88[_0x499ea6];return _0x43cdc8;};'use strict';var _=require(_0x83f8('0x0'));var util=require('util');var logger=require(_0x83f8('0x1'))(_0x83f8('0x2'));var moment=require('moment');var BPromise=require(_0x83f8('0x3'));var rp=require(_0x83f8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83f8('0x5'));var config=require(_0x83f8('0x6'));var attributes=require(_0x83f8('0x7'));module[_0x83f8('0x8')]=function(_0x2304d4,_0x28a5fe){return _0x2304d4[_0x83f8('0x9')](_0x83f8('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x83f8('0xb'),_0x83f8('0xc')],'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 cca3598..6f9daa6 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 _0xc988=['rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41925c,_0x14b681){var _0x5db3a0=function(_0x7a498a){while(--_0x7a498a){_0x41925c['push'](_0x41925c['shift']());}};_0x5db3a0(++_0x14b681);}(_0xc988,0x189));var _0x8c98=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xc988[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x8c98('0x0'));var util=require(_0x8c98('0x1'));var moment=require(_0x8c98('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c98('0x3'));var fs=require('fs');var Redis=require(_0x8c98('0x4'));var db=require(_0x8c98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c98('0x6'))(_0x8c98('0x7'));var config=require(_0x8c98('0x8'));var jayson=require(_0x8c98('0x9'));var client=jayson['client'][_0x8c98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b9e1,_0x2bb342,_0xfca4c4){return new BPromise(function(_0x2a6a63,_0x26b299){return client[_0x8c98('0xb')](_0x49b9e1,_0xfca4c4)[_0x8c98('0xc')](function(_0x574b21){logger[_0x8c98('0xd')](_0x8c98('0xe'),_0x2bb342,_0x8c98('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2bb342,_0x8c98('0xf'),JSON[_0x8c98('0x10')](_0x574b21));if(_0x574b21[_0x8c98('0x11')]){if(_0x574b21[_0x8c98('0x11')][_0x8c98('0x12')]===0x1f4){logger[_0x8c98('0x11')](_0x8c98('0xe'),_0x2bb342,_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);return _0x26b299(_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);}logger[_0x8c98('0x11')](_0x8c98('0xe'),_0x2bb342,_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);return _0x2a6a63(_0x574b21['error'][_0x8c98('0x13')]);}else{logger[_0x8c98('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x2bb342,_0x8c98('0xf'));_0x2a6a63(_0x574b21['result'][_0x8c98('0x13')]);}})['catch'](function(_0x10b450){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2bb342,_0x10b450);_0x26b299(_0x10b450);});});} \ No newline at end of file +var _0xd4d9=['Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4aad6c,_0x52dd30){var _0x304519=function(_0x2468ea){while(--_0x2468ea){_0x4aad6c['push'](_0x4aad6c['shift']());}};_0x304519(++_0x52dd30);}(_0xd4d9,0x1a6));var _0x9d4d=function(_0x42a13c,_0xd252c1){_0x42a13c=_0x42a13c-0x0;var _0x3e6ca8=_0xd4d9[_0x42a13c];return _0x3e6ca8;};'use strict';var _=require(_0x9d4d('0x0'));var util=require(_0x9d4d('0x1'));var moment=require(_0x9d4d('0x2'));var BPromise=require(_0x9d4d('0x3'));var rs=require(_0x9d4d('0x4'));var fs=require('fs');var Redis=require(_0x9d4d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d4d('0x6'));var logger=require(_0x9d4d('0x7'))(_0x9d4d('0x8'));var config=require(_0x9d4d('0x9'));var jayson=require(_0x9d4d('0xa'));var client=jayson[_0x9d4d('0xb')][_0x9d4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x405bd9,_0x54a638,_0x4ea11d){return new BPromise(function(_0x27b816,_0x26c239){return client[_0x9d4d('0xd')](_0x405bd9,_0x4ea11d)[_0x9d4d('0xe')](function(_0x2a3f27){logger['info'](_0x9d4d('0xf'),_0x54a638,'request\x20sent');logger[_0x9d4d('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x54a638,_0x9d4d('0x11'),JSON['stringify'](_0x2a3f27));if(_0x2a3f27[_0x9d4d('0x12')]){if(_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x13')]===0x1f4){logger[_0x9d4d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x54a638,_0x2a3f27['error']['message']);return _0x26c239(_0x2a3f27[_0x9d4d('0x12')]['message']);}logger[_0x9d4d('0x12')](_0x9d4d('0xf'),_0x54a638,_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x14')]);return _0x27b816(_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x14')]);}else{logger[_0x9d4d('0x15')](_0x9d4d('0xf'),_0x54a638,'request\x20sent');_0x27b816(_0x2a3f27['result'][_0x9d4d('0x14')]);}})[_0x9d4d('0x16')](function(_0x4953b8){logger[_0x9d4d('0x12')](_0x9d4d('0xf'),_0x54a638,_0x4953b8);_0x26c239(_0x4953b8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 699dcd4..f7e4fe8 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 _0x3e5d=['isAuthenticated','index','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x26e7fc,_0x49ca39){var _0x3230ca=function(_0x51d88c){while(--_0x51d88c){_0x26e7fc['push'](_0x26e7fc['shift']());}};_0x3230ca(++_0x49ca39);}(_0x3e5d,0x81));var _0xd3e5=function(_0x45ff85,_0x14adde){_0x45ff85=_0x45ff85-0x0;var _0x73c5fc=_0x3e5d[_0x45ff85];return _0x73c5fc;};'use strict';var multer=require(_0xd3e5('0x0'));var util=require(_0xd3e5('0x1'));var path=require(_0xd3e5('0x2'));var timeout=require(_0xd3e5('0x3'));var express=require(_0xd3e5('0x4'));var router=express[_0xd3e5('0x5')]();var fs_extra=require(_0xd3e5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3e5('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xd3e5('0x8')]('/',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0xa')]);router[_0xd3e5('0x8')]('/:id',auth[_0xd3e5('0x9')](),controller['show']);router[_0xd3e5('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd3e5('0xb')]);router[_0xd3e5('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd3e5('0xc')]);router[_0xd3e5('0xd')]('/',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0xe')]);router[_0xd3e5('0xd')](_0xd3e5('0xf'),auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x10')]);router[_0xd3e5('0x11')]('/:id',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x12')]);router[_0xd3e5('0x13')](_0xd3e5('0x14'),auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x15')]);module[_0xd3e5('0x16')]=router; \ No newline at end of file +var _0x2bab=['./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','/:id/fields','post','create','put','update','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d22e5,_0x4a72a6){var _0x2a6aa2=function(_0x16a3bd){while(--_0x16a3bd){_0x3d22e5['push'](_0x3d22e5['shift']());}};_0x2a6aa2(++_0x4a72a6);}(_0x2bab,0x189));var _0xb2ba=function(_0x365f08,_0x542bb8){_0x365f08=_0x365f08-0x0;var _0x516494=_0x2bab[_0x365f08];return _0x516494;};'use strict';var multer=require(_0xb2ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2ba('0x1'));var express=require(_0xb2ba('0x2'));var router=express['Router']();var fs_extra=require(_0xb2ba('0x3'));var auth=require(_0xb2ba('0x4'));var interaction=require(_0xb2ba('0x5'));var config=require(_0xb2ba('0x6'));var controller=require(_0xb2ba('0x7'));router['get']('/',auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x9')]);router['get'](_0xb2ba('0xa'),auth[_0xb2ba('0x8')](),controller[_0xb2ba('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb2ba('0xc')]);router[_0xb2ba('0xd')](_0xb2ba('0xe'),auth[_0xb2ba('0x8')](),controller['getFields']);router[_0xb2ba('0xf')]('/',auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x10')]);router[_0xb2ba('0xf')]('/:id/configurations',auth[_0xb2ba('0x8')](),controller['addConfiguration']);router[_0xb2ba('0x11')](_0xb2ba('0xa'),auth['isAuthenticated'](),controller[_0xb2ba('0x12')]);router['delete'](_0xb2ba('0xa'),auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x13')]);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 1a7df6d..186753c 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 _0x2272=['sequelize','exports','STRING','remoteUri'];(function(_0x1f4e09,_0x1fc591){var _0x10deec=function(_0x5c1fb9){while(--_0x5c1fb9){_0x1f4e09['push'](_0x1f4e09['shift']());}};_0x10deec(++_0x1fc591);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':_0x2227('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x44e577,_0x16a38d){var _0x2ff124=function(_0x266893){while(--_0x266893){_0x44e577['push'](_0x44e577['shift']());}};_0x2ff124(++_0x16a38d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cad1a,_0x4a92c5){_0x3cad1a=_0x3cad1a-0x0;var _0x4b768d=_0xb10b[_0x3cad1a];return _0x4b768d;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a33d9ce..6ba9b6b 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 _0x7980=['include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll'];(function(_0x2481f9,_0x2bd8dd){var _0x2f1da3=function(_0x3eaff9){while(--_0x3eaff9){_0x2481f9['push'](_0x2481f9['shift']());}};_0x2f1da3(++_0x2bd8dd);}(_0x7980,0xab));var _0x0798=function(_0x3a0840,_0x54c20c){_0x3a0840=_0x3a0840-0x0;var _0x407e44=_0x7980[_0x3a0840];return _0x407e44;};'use strict';var emlformat=require(_0x0798('0x0'));var rimraf=require(_0x0798('0x1'));var zipdir=require(_0x0798('0x2'));var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require('to-csv');var ejs=require(_0x0798('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0798('0xb'));var squel=require(_0x0798('0xc'));var crypto=require(_0x0798('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0798('0xe'));var querystring=require(_0x0798('0xf'));var Papa=require(_0x0798('0x10'));var Redis=require(_0x0798('0x11'));var authService=require(_0x0798('0x12'));var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require('../../config/utils');var config=require(_0x0798('0x18'));var licenseUtil=require(_0x0798('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x588f9d,_0x376a60){_0x376a60=_0x376a60||0xcc;return function(_0x27a0d5){if(_0x27a0d5){return _0x588f9d[_0x0798('0x1a')](_0x376a60);}return _0x588f9d[_0x0798('0x1b')](_0x376a60)[_0x0798('0x1c')]();};}function respondWithResult(_0xfd88af,_0x5f1640){_0x5f1640=_0x5f1640||0xc8;return function(_0x486bcf){if(_0x486bcf){return _0xfd88af[_0x0798('0x1b')](_0x5f1640)[_0x0798('0x1d')](_0x486bcf);}};}function respondWithFilteredResult(_0x47be56,_0x555c45){return function(_0x21c30b){if(_0x21c30b){var _0x45cae6=typeof _0x555c45[_0x0798('0x1e')]==='undefined'&&typeof _0x555c45['limit']===_0x0798('0x1f');var _0x502635=_0x21c30b[_0x0798('0x20')];var _0x46e74c=_0x45cae6?0x0:_0x555c45[_0x0798('0x1e')];var _0x145197=_0x45cae6?_0x21c30b['count']:_0x555c45[_0x0798('0x1e')]+_0x555c45[_0x0798('0x21')];var _0x4f3f01;if(_0x145197>=_0x502635){_0x145197=_0x502635;_0x4f3f01=0xc8;}else{_0x4f3f01=0xce;}_0x47be56[_0x0798('0x1b')](_0x4f3f01);return _0x47be56[_0x0798('0x22')](_0x0798('0x23'),_0x46e74c+'-'+_0x145197+'/'+_0x502635)[_0x0798('0x1d')](_0x21c30b);}return null;};}function patchUpdates(_0xfbb4a5){return function(_0x273ba8){try{jsonpatch[_0x0798('0x24')](_0x273ba8,_0xfbb4a5,!![]);}catch(_0x212ad5){return BPromise[_0x0798('0x25')](_0x212ad5);}return _0x273ba8['save']();};}function saveUpdates(_0x2aaabf,_0x35c141){return function(_0x3bca45){if(_0x3bca45){return _0x3bca45[_0x0798('0x26')](_0x2aaabf)[_0x0798('0x27')](function(_0x23f283){return _0x23f283;});}return null;};}function removeEntity(_0x52037c,_0x3f66e2){return function(_0x3e80d7){if(_0x3e80d7){return _0x3e80d7[_0x0798('0x28')]()[_0x0798('0x27')](function(){_0x52037c[_0x0798('0x1b')](0xcc)[_0x0798('0x1c')]();});}};}function handleEntityNotFound(_0x4f648a,_0x43d99f){return function(_0x14f828){if(!_0x14f828){_0x4f648a[_0x0798('0x1a')](0x194);}return _0x14f828;};}function handleError(_0x4d4e0a,_0x4bc3f3){_0x4bc3f3=_0x4bc3f3||0x1f4;return function(_0x5e7246){logger['error'](_0x5e7246[_0x0798('0x29')]);if(_0x5e7246[_0x0798('0x2a')]){delete _0x5e7246[_0x0798('0x2a')];}_0x4d4e0a[_0x0798('0x1b')](_0x4bc3f3)[_0x0798('0x2b')](_0x5e7246);};}exports[_0x0798('0x2c')]=function(_0x30bec,_0x23e770){var _0x5bbe3d={},_0x167960={},_0x4f5d1d={'count':0x0,'rows':[]};var _0x5f1780=_[_0x0798('0x2d')](db['FreshdeskAccount'][_0x0798('0x2e')],function(_0x4a5fb1){return{'name':_0x4a5fb1[_0x0798('0x2f')],'type':_0x4a5fb1[_0x0798('0x30')][_0x0798('0x31')]};});_0x167960[_0x0798('0x32')]=_[_0x0798('0x2d')](_0x5f1780,_0x0798('0x2a'));_0x167960[_0x0798('0x33')]=_[_0x0798('0x34')](_0x30bec[_0x0798('0x33')]);_0x167960[_0x0798('0x35')]=_[_0x0798('0x36')](_0x167960[_0x0798('0x32')],_0x167960['query']);_0x5bbe3d[_0x0798('0x37')]=_['intersection'](_0x167960['model'],qs[_0x0798('0x38')](_0x30bec[_0x0798('0x33')]['fields']));_0x5bbe3d['attributes']=_0x5bbe3d[_0x0798('0x37')][_0x0798('0x39')]?_0x5bbe3d[_0x0798('0x37')]:_0x167960[_0x0798('0x32')];if(!_0x30bec[_0x0798('0x33')][_0x0798('0x3a')]('nolimit')){_0x5bbe3d['limit']=qs[_0x0798('0x21')](_0x30bec[_0x0798('0x33')][_0x0798('0x21')]);_0x5bbe3d['offset']=qs['offset'](_0x30bec['query'][_0x0798('0x1e')]);}_0x5bbe3d[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x30bec[_0x0798('0x33')][_0x0798('0x3c')]);_0x5bbe3d[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x30bec['query'],_0x167960[_0x0798('0x35')]),_0x5f1780);if(_0x30bec['query'][_0x0798('0x3f')]){_0x5bbe3d[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x5bbe3d['where'],{'$or':_[_0x0798('0x2d')](_0x5f1780,function(_0x591862){if(_0x591862[_0x0798('0x30')]!==_0x0798('0x41')){var _0x223751={};_0x223751[_0x591862['name']]={'$like':'%'+_0x30bec[_0x0798('0x33')][_0x0798('0x3f')]+'%'};return _0x223751;}})});}_0x5bbe3d=_['merge']({},_0x5bbe3d,_0x30bec[_0x0798('0x42')]);var _0x5cb953={'where':_0x5bbe3d['where']};return db[_0x0798('0x43')][_0x0798('0x20')](_0x5cb953)['then'](function(_0x4ddbca){_0x4f5d1d[_0x0798('0x20')]=_0x4ddbca;if(_0x30bec[_0x0798('0x33')][_0x0798('0x44')]){_0x5bbe3d[_0x0798('0x45')]=[{'all':!![]}];}return db[_0x0798('0x43')][_0x0798('0x46')](_0x5bbe3d);})[_0x0798('0x27')](function(_0x521829){_0x4f5d1d[_0x0798('0x47')]=_0x521829;return _0x4f5d1d;})[_0x0798('0x27')](respondWithFilteredResult(_0x23e770,_0x5bbe3d))[_0x0798('0x48')](handleError(_0x23e770,null));};exports[_0x0798('0x49')]=function(_0x3a8a14,_0x26e9cb){var _0x4c2d8a={'raw':![],'where':{'id':_0x3a8a14[_0x0798('0x4a')]['id']}},_0x192e15={};_0x192e15[_0x0798('0x32')]=_[_0x0798('0x34')](db[_0x0798('0x43')][_0x0798('0x2e')]);_0x192e15[_0x0798('0x33')]=_[_0x0798('0x34')](_0x3a8a14[_0x0798('0x33')]);_0x192e15[_0x0798('0x35')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],_0x192e15['query']);_0x4c2d8a[_0x0798('0x37')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],qs[_0x0798('0x38')](_0x3a8a14['query']['fields']));_0x4c2d8a[_0x0798('0x37')]=_0x4c2d8a[_0x0798('0x37')][_0x0798('0x39')]?_0x4c2d8a[_0x0798('0x37')]:_0x192e15['model'];if(_0x3a8a14[_0x0798('0x33')]['includeAll']){_0x4c2d8a['include']=[{'all':!![]}];}_0x4c2d8a=_[_0x0798('0x40')]({},_0x4c2d8a,_0x3a8a14[_0x0798('0x42')]);return db[_0x0798('0x43')][_0x0798('0x4b')](_0x4c2d8a)[_0x0798('0x27')](handleEntityNotFound(_0x26e9cb,null))[_0x0798('0x27')](respondWithResult(_0x26e9cb,null))[_0x0798('0x48')](handleError(_0x26e9cb,null));};exports[_0x0798('0x4c')]=function(_0x182e3b,_0x580bcd){return db[_0x0798('0x43')]['create'](_0x182e3b[_0x0798('0x4d')],{})[_0x0798('0x27')](respondWithResult(_0x580bcd,0xc9))[_0x0798('0x48')](handleError(_0x580bcd,null));};exports['update']=function(_0x9dea1f,_0x275e6e){if(_0x9dea1f[_0x0798('0x4d')]['id']){delete _0x9dea1f[_0x0798('0x4d')]['id'];}return db['FreshdeskAccount'][_0x0798('0x4b')]({'where':{'id':_0x9dea1f[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x275e6e,null))[_0x0798('0x27')](saveUpdates(_0x9dea1f[_0x0798('0x4d')],null))['then'](respondWithResult(_0x275e6e,null))[_0x0798('0x48')](handleError(_0x275e6e,null));};exports[_0x0798('0x28')]=function(_0x2679b1,_0x10173d){return db[_0x0798('0x43')][_0x0798('0x4b')]({'where':{'id':_0x2679b1[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x10173d,null))[_0x0798('0x27')](removeEntity(_0x10173d,null))['catch'](handleError(_0x10173d,null));};exports['getConfigurations']=function(_0x450fb2,_0x499073,_0x375f11){var _0x17967e={};var _0x40b3d6={};var _0x2cc9a5;var _0x3fa571;return db['FreshdeskAccount'][_0x0798('0x4e')]({'where':{'id':_0x450fb2['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x499073,null))[_0x0798('0x27')](function(_0x3a3cc7){if(_0x3a3cc7){_0x2cc9a5=_0x3a3cc7;_0x40b3d6['model']=_['keys'](db['FreshdeskConfiguration'][_0x0798('0x2e')]);_0x40b3d6['query']=_['keys'](_0x450fb2[_0x0798('0x33')]);_0x40b3d6[_0x0798('0x35')]=_[_0x0798('0x36')](_0x40b3d6['model'],_0x40b3d6[_0x0798('0x33')]);_0x17967e[_0x0798('0x37')]=_[_0x0798('0x36')](_0x40b3d6[_0x0798('0x32')],qs['fields'](_0x450fb2['query'][_0x0798('0x38')]));_0x17967e[_0x0798('0x37')]=_0x17967e[_0x0798('0x37')]['length']?_0x17967e['attributes']:_0x40b3d6[_0x0798('0x32')];_0x17967e[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x450fb2[_0x0798('0x33')][_0x0798('0x3c')]);_0x17967e[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x450fb2['query'],_0x40b3d6[_0x0798('0x35')]));if(_0x450fb2[_0x0798('0x33')]['filter']){_0x17967e[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x17967e['where'],{'$or':_[_0x0798('0x2d')](_0x17967e[_0x0798('0x37')],function(_0x445872){var _0x257c8d={};_0x257c8d[_0x445872]={'$like':'%'+_0x450fb2[_0x0798('0x33')]['filter']+'%'};return _0x257c8d;})});}_0x17967e=_[_0x0798('0x40')]({},_0x17967e,_0x450fb2[_0x0798('0x42')]);return _0x2cc9a5[_0x0798('0x4f')](_0x17967e);}})['then'](function(_0x1135d5){if(_0x1135d5){_0x3fa571=_0x1135d5['length'];if(!_0x450fb2[_0x0798('0x33')][_0x0798('0x3a')](_0x0798('0x50'))){_0x17967e[_0x0798('0x21')]=qs[_0x0798('0x21')](_0x450fb2[_0x0798('0x33')]['limit']);_0x17967e[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x450fb2[_0x0798('0x33')][_0x0798('0x1e')]);}return _0x2cc9a5['getConfigurations'](_0x17967e);}})[_0x0798('0x27')](function(_0x105f88){if(_0x105f88){return _0x105f88?{'count':_0x3fa571,'rows':_0x105f88}:null;}})[_0x0798('0x27')](respondWithResult(_0x499073,null))[_0x0798('0x48')](handleError(_0x499073,null));};exports[_0x0798('0x51')]=function(_0x523a2b,_0x3ad6d9,_0x3d933a){if(_0x523a2b['body']['id']){delete _0x523a2b[_0x0798('0x4d')]['id'];}return db[_0x0798('0x43')][_0x0798('0x4e')]({'where':{'id':_0x523a2b['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x3ad6d9,null))[_0x0798('0x27')](function(_0x3c218b){if(_0x3c218b){_0x523a2b[_0x0798('0x4d')][_0x0798('0x52')]=_0x3c218b['id'];_0x523a2b[_0x0798('0x4d')][_0x0798('0x53')]=integrations[_0x0798('0x54')](_0x523a2b['body'][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);_0x523a2b[_0x0798('0x4d')]['Descriptions']=integrations[_0x0798('0x56')](_0x523a2b[_0x0798('0x4d')][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);return db[_0x0798('0x57')][_0x0798('0x4c')](_0x523a2b[_0x0798('0x4d')],{'include':[{'model':db['FreshdeskField'],'as':_0x0798('0x53')},{'model':db['FreshdeskField'],'as':_0x0798('0x58')}]});}return null;})[_0x0798('0x27')](respondWithResult(_0x3ad6d9,null))[_0x0798('0x48')](handleError(_0x3ad6d9,null));};exports['getFields']=function(_0x1fad8c,_0x15eb2b,_0x540703){var _0x11dcc6='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x1fad8c[_0x0798('0x4a')]['id']},'attributes':['id',_0x0798('0x59'),_0x0798('0x5a')]})[_0x0798('0x27')](handleEntityNotFound(_0x15eb2b,null))['then'](function(_0x3ebb8e){if(_0x3ebb8e){_0x11dcc6=_0x3ebb8e[_0x0798('0x59')];var _0x4750f8=_0x11dcc6[_0x0798('0x5b')](-0x1);if(_0x4750f8==='/'){_0x11dcc6=_0x11dcc6[_0x0798('0x5c')](0x0,_0x11dcc6[_0x0798('0x5d')](_0x4750f8));}return rp({'method':_0x0798('0x5e'),'uri':util['format']('%s/%s',_0x11dcc6,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x0798('0x5f')](_0x0798('0x60'),new Buffer(util[_0x0798('0x5f')](_0x0798('0x61'),_0x3ebb8e['apiKey']))[_0x0798('0x62')](_0x0798('0x63')))},'json':!![]});}})['then'](function(_0x12393b){if(_0x12393b){var _0x5c46aa=[_0x0798('0x64'),'subject',_0x0798('0x65'),_0x0798('0x66'),_0x0798('0x1b'),_0x0798('0x67'),_0x0798('0x68'),_0x0798('0x69'),_0x0798('0x6a'),_0x0798('0x68'),'company'];_[_0x0798('0x6b')](_0x12393b,function(_0x47e5bd){return _0x5c46aa[_0x0798('0x6c')](_0x47e5bd[_0x0798('0x2a')])||!_0x47e5bd['default']&&_0x47e5bd[_0x0798('0x30')]!==_0x0798('0x6d')&&_0x47e5bd['type']!==_0x0798('0x6e');});return{'count':_0x12393b['length'],'rows':_[_0x0798('0x2d')](_0x12393b,function(_0x447d3c){return{'id':_0x447d3c[_0x0798('0x2a')],'name':_0x447d3c['label'],'custom':!_0x447d3c[_0x0798('0x6f')],'options':_0x447d3c[_0x0798('0x70')]?_[_0x0798('0x2d')](_0x447d3c[_0x0798('0x70')],function(_0x530e1f){return{'name':_[_0x0798('0x71')](_0x530e1f),'value':_0x530e1f};}):[]};})};}})[_0x0798('0x27')](respondWithResult(_0x15eb2b,null))[_0x0798('0x48')](function(_0x1c9a79){var _0x389452=_0x1fad8c[_0x0798('0x33')]['test']?0x1f4:_0x1c9a79['statusCode']||0x1f4;logger[_0x0798('0x72')](_0x0798('0x73'),_0x0798('0x74'),_0x389452,JSON[_0x0798('0x75')](_0x1c9a79));delete _0x1c9a79[_0x0798('0x2a')];if(_0x389452===0x191){_0x389452=0x190;}_0x15eb2b[_0x0798('0x1b')](_0x389452)['send'](_0x1fad8c['query'][_0x0798('0x76')]?{'message':_0x0798('0x77'),'statusCode':_0x1c9a79['statusCode']}:_0x1c9a79);});}; \ No newline at end of file +var _0xb43b=['Content-Range','json','save','then','end','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','catch','create','body','update','find','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31250b,_0x44b7a3){_0x31250b=_0x31250b-0x0;var _0x4ac9c8=_0xb43b[_0x31250b];return _0x4ac9c8;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x578392,_0x41e7e5){_0x41e7e5=_0x41e7e5||0xcc;return function(_0x4a3714){if(_0x4a3714){return _0x578392['sendStatus'](_0x41e7e5);}return _0x578392[_0xbb43('0x19')](_0x41e7e5)['end']();};}function respondWithResult(_0x68d45d,_0x43021d){_0x43021d=_0x43021d||0xc8;return function(_0x55926f){if(_0x55926f){return _0x68d45d['status'](_0x43021d)['json'](_0x55926f);}};}function respondWithFilteredResult(_0x338120,_0x2abce0){return function(_0x57bd1d){if(_0x57bd1d){var _0x526330=typeof _0x2abce0[_0xbb43('0x1a')]==='undefined'&&typeof _0x2abce0['limit']===_0xbb43('0x1b');var _0x8242ab=_0x57bd1d[_0xbb43('0x1c')];var _0x55dd73=_0x526330?0x0:_0x2abce0[_0xbb43('0x1a')];var _0x4f28b8=_0x526330?_0x57bd1d[_0xbb43('0x1c')]:_0x2abce0[_0xbb43('0x1a')]+_0x2abce0['limit'];var _0x5d765b;if(_0x4f28b8>=_0x8242ab){_0x4f28b8=_0x8242ab;_0x5d765b=0xc8;}else{_0x5d765b=0xce;}_0x338120[_0xbb43('0x19')](_0x5d765b);return _0x338120[_0xbb43('0x1d')](_0xbb43('0x1e'),_0x55dd73+'-'+_0x4f28b8+'/'+_0x8242ab)[_0xbb43('0x1f')](_0x57bd1d);}return null;};}function patchUpdates(_0x5bcce7){return function(_0x40a650){try{jsonpatch['apply'](_0x40a650,_0x5bcce7,!![]);}catch(_0x3a257d){return BPromise['reject'](_0x3a257d);}return _0x40a650[_0xbb43('0x20')]();};}function saveUpdates(_0x565256,_0x3f323e){return function(_0x451cbd){if(_0x451cbd){return _0x451cbd['update'](_0x565256)[_0xbb43('0x21')](function(_0x4dfb7f){return _0x4dfb7f;});}return null;};}function removeEntity(_0xf24e60,_0x298ce2){return function(_0x16384e){if(_0x16384e){return _0x16384e['destroy']()['then'](function(){_0xf24e60['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x32d7f0,_0x5d8310){return function(_0x3b3083){if(!_0x3b3083){_0x32d7f0[_0xbb43('0x23')](0x194);}return _0x3b3083;};}function handleError(_0x226827,_0x3874fb){_0x3874fb=_0x3874fb||0x1f4;return function(_0x4ed43f){logger['error'](_0x4ed43f[_0xbb43('0x24')]);if(_0x4ed43f[_0xbb43('0x25')]){delete _0x4ed43f[_0xbb43('0x25')];}_0x226827[_0xbb43('0x19')](_0x3874fb)[_0xbb43('0x26')](_0x4ed43f);};}exports[_0xbb43('0x27')]=function(_0x21d386,_0x473828){var _0x539730={},_0x2ad6da={},_0x56fe33={'count':0x0,'rows':[]};var _0x31fbc8=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x555b99){return{'name':_0x555b99[_0xbb43('0x2b')],'type':_0x555b99['type']['key']};});_0x2ad6da['model']=_[_0xbb43('0x28')](_0x31fbc8,'name');_0x2ad6da[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x21d386[_0xbb43('0x2c')]);_0x2ad6da['filters']=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],_0x2ad6da[_0xbb43('0x2c')]);_0x539730[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x21d386[_0xbb43('0x2c')]['fields']));_0x539730[_0xbb43('0x30')]=_0x539730[_0xbb43('0x30')][_0xbb43('0x32')]?_0x539730[_0xbb43('0x30')]:_0x2ad6da[_0xbb43('0x2f')];if(!_0x21d386[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0x539730[_0xbb43('0x35')]=qs[_0xbb43('0x35')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x35')]);_0x539730[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x1a')]);}_0x539730['order']=qs[_0xbb43('0x36')](_0x21d386[_0xbb43('0x2c')]['sort']);_0x539730[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x21d386['query'],_0x2ad6da['filters']),_0x31fbc8);if(_0x21d386['query'][_0xbb43('0x3a')]){_0x539730[_0xbb43('0x37')]=_['merge'](_0x539730['where'],{'$or':_[_0xbb43('0x28')](_0x31fbc8,function(_0x275425){if(_0x275425[_0xbb43('0x3b')]!==_0xbb43('0x3c')){var _0x3f9e7f={};_0x3f9e7f[_0x275425['name']]={'$like':'%'+_0x21d386[_0xbb43('0x2c')][_0xbb43('0x3a')]+'%'};return _0x3f9e7f;}})});}_0x539730=_[_0xbb43('0x3d')]({},_0x539730,_0x21d386[_0xbb43('0x3e')]);var _0x22fccc={'where':_0x539730['where']};return db[_0xbb43('0x29')]['count'](_0x22fccc)[_0xbb43('0x21')](function(_0x93aa1c){_0x56fe33['count']=_0x93aa1c;if(_0x21d386[_0xbb43('0x2c')]['includeAll']){_0x539730[_0xbb43('0x3f')]=[{'all':!![]}];}return db[_0xbb43('0x29')][_0xbb43('0x40')](_0x539730);})[_0xbb43('0x21')](function(_0x5d864a){_0x56fe33[_0xbb43('0x41')]=_0x5d864a;return _0x56fe33;})[_0xbb43('0x21')](respondWithFilteredResult(_0x473828,_0x539730))['catch'](handleError(_0x473828,null));};exports[_0xbb43('0x42')]=function(_0x5198a2,_0x42b965){var _0x14285d={'raw':![],'where':{'id':_0x5198a2[_0xbb43('0x43')]['id']}},_0xcb5000={};_0xcb5000[_0xbb43('0x2f')]=_[_0xbb43('0x2d')](db['FreshdeskAccount'][_0xbb43('0x2a')]);_0xcb5000['query']=_[_0xbb43('0x2d')](_0x5198a2[_0xbb43('0x2c')]);_0xcb5000[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0xcb5000['model'],_0xcb5000[_0xbb43('0x2c')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0xcb5000[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x5198a2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0x14285d[_0xbb43('0x30')]=_0x14285d['attributes'][_0xbb43('0x32')]?_0x14285d[_0xbb43('0x30')]:_0xcb5000['model'];if(_0x5198a2[_0xbb43('0x2c')]['includeAll']){_0x14285d['include']=[{'all':!![]}];}_0x14285d=_['merge']({},_0x14285d,_0x5198a2['options']);return db[_0xbb43('0x29')]['find'](_0x14285d)[_0xbb43('0x21')](handleEntityNotFound(_0x42b965,null))['then'](respondWithResult(_0x42b965,null))[_0xbb43('0x44')](handleError(_0x42b965,null));};exports[_0xbb43('0x45')]=function(_0x1f3fb4,_0x4a0755){return db[_0xbb43('0x29')]['create'](_0x1f3fb4[_0xbb43('0x46')],{})[_0xbb43('0x21')](respondWithResult(_0x4a0755,0xc9))[_0xbb43('0x44')](handleError(_0x4a0755,null));};exports[_0xbb43('0x47')]=function(_0x417ad9,_0x13d0a5){if(_0x417ad9[_0xbb43('0x46')]['id']){delete _0x417ad9['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x417ad9[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x13d0a5,null))['then'](saveUpdates(_0x417ad9[_0xbb43('0x46')],null))[_0xbb43('0x21')](respondWithResult(_0x13d0a5,null))[_0xbb43('0x44')](handleError(_0x13d0a5,null));};exports[_0xbb43('0x49')]=function(_0x4b7712,_0x3206c0){return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x4b7712['params']['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x3206c0,null))[_0xbb43('0x21')](removeEntity(_0x3206c0,null))[_0xbb43('0x44')](handleError(_0x3206c0,null));};exports[_0xbb43('0x4a')]=function(_0x3402f2,_0x59c805,_0x4cd4cd){var _0xb44557={};var _0x5c75ba={};var _0xf5d5c;var _0xe0cdba;return db['FreshdeskAccount'][_0xbb43('0x4b')]({'where':{'id':_0x3402f2[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x59c805,null))[_0xbb43('0x21')](function(_0x1dfbb9){if(_0x1dfbb9){_0xf5d5c=_0x1dfbb9;_0x5c75ba['model']=_[_0xbb43('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x5c75ba[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x3402f2[_0xbb43('0x2c')]);_0x5c75ba[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0x5c75ba['model'],_0x5c75ba['query']);_0xb44557[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x5c75ba[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0xb44557[_0xbb43('0x30')]=_0xb44557[_0xbb43('0x30')][_0xbb43('0x32')]?_0xb44557['attributes']:_0x5c75ba[_0xbb43('0x2f')];_0xb44557[_0xbb43('0x4c')]=qs[_0xbb43('0x36')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x36')]);_0xb44557[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x3402f2[_0xbb43('0x2c')],_0x5c75ba['filters']));if(_0x3402f2['query'][_0xbb43('0x3a')]){_0xb44557[_0xbb43('0x37')]=_[_0xbb43('0x3d')](_0xb44557[_0xbb43('0x37')],{'$or':_[_0xbb43('0x28')](_0xb44557[_0xbb43('0x30')],function(_0x2e01fb){var _0x51d702={};_0x51d702[_0x2e01fb]={'$like':'%'+_0x3402f2[_0xbb43('0x2c')]['filter']+'%'};return _0x51d702;})});}_0xb44557=_['merge']({},_0xb44557,_0x3402f2[_0xbb43('0x3e')]);return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x22ce17){if(_0x22ce17){_0xe0cdba=_0x22ce17[_0xbb43('0x32')];if(!_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0xb44557['limit']=qs['limit'](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x35')]);_0xb44557[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x1a')]);}return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x3ca6ad){if(_0x3ca6ad){return _0x3ca6ad?{'count':_0xe0cdba,'rows':_0x3ca6ad}:null;}})['then'](respondWithResult(_0x59c805,null))[_0xbb43('0x44')](handleError(_0x59c805,null));};exports[_0xbb43('0x4d')]=function(_0x234bc7,_0x8aaf33,_0x2612be){if(_0x234bc7[_0xbb43('0x46')]['id']){delete _0x234bc7['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x234bc7[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x8aaf33,null))[_0xbb43('0x21')](function(_0x4ec63a){if(_0x4ec63a){_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4e')]=_0x4ec63a['id'];_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4f')]=integrations[_0xbb43('0x50')](_0x234bc7[_0xbb43('0x46')][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);_0x234bc7[_0xbb43('0x46')]['Descriptions']=integrations[_0xbb43('0x52')](_0x234bc7['body'][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);return db[_0xbb43('0x53')][_0xbb43('0x45')](_0x234bc7['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xbb43('0x4f')},{'model':db[_0xbb43('0x54')],'as':'Descriptions'}]});}return null;})[_0xbb43('0x21')](respondWithResult(_0x8aaf33,null))[_0xbb43('0x44')](handleError(_0x8aaf33,null));};exports[_0xbb43('0x55')]=function(_0x52ca51,_0x333ded,_0x298a77){var _0x3b89ec='';return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x52ca51[_0xbb43('0x43')]['id']},'attributes':['id',_0xbb43('0x56'),_0xbb43('0x57')]})[_0xbb43('0x21')](handleEntityNotFound(_0x333ded,null))[_0xbb43('0x21')](function(_0x566268){if(_0x566268){_0x3b89ec=_0x566268['remoteUri'];var _0x21d610=_0x3b89ec[_0xbb43('0x58')](-0x1);if(_0x21d610==='/'){_0x3b89ec=_0x3b89ec[_0xbb43('0x59')](0x0,_0x3b89ec['lastIndexOf'](_0x21d610));}return rp({'method':_0xbb43('0x5a'),'uri':util[_0xbb43('0x5b')](_0xbb43('0x5c'),_0x3b89ec,_0xbb43('0x5d')),'headers':{'Authorization':util[_0xbb43('0x5b')]('Basic\x20%s',new Buffer(util[_0xbb43('0x5b')](_0xbb43('0x5e'),_0x566268[_0xbb43('0x57')]))['toString'](_0xbb43('0x5f')))},'json':!![]});}})[_0xbb43('0x21')](function(_0x3e4619){if(_0x3e4619){var _0x38f301=[_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x63'),_0xbb43('0x19'),_0xbb43('0x64'),_0xbb43('0x65'),'source',_0xbb43('0x66'),_0xbb43('0x65'),_0xbb43('0x67')];_[_0xbb43('0x68')](_0x3e4619,function(_0x34c1cd){return _0x38f301['includes'](_0x34c1cd['name'])||!_0x34c1cd['default']&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x69')&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x6a');});return{'count':_0x3e4619[_0xbb43('0x32')],'rows':_[_0xbb43('0x28')](_0x3e4619,function(_0x53cd0b){return{'id':_0x53cd0b['name'],'name':_0x53cd0b[_0xbb43('0x6b')],'custom':!_0x53cd0b[_0xbb43('0x6c')],'options':_0x53cd0b[_0xbb43('0x6d')]?_['map'](_0x53cd0b[_0xbb43('0x6d')],function(_0x5e43b4){return{'name':_[_0xbb43('0x6e')](_0x5e43b4),'value':_0x5e43b4};}):[]};})};}})['then'](respondWithResult(_0x333ded,null))[_0xbb43('0x44')](function(_0x17e939){var _0x41b9cd=_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?0x1f4:_0x17e939[_0xbb43('0x70')]||0x1f4;logger[_0xbb43('0x71')](_0xbb43('0x72'),'getFields',_0x41b9cd,JSON[_0xbb43('0x73')](_0x17e939));delete _0x17e939[_0xbb43('0x25')];if(_0x41b9cd===0x191){_0x41b9cd=0x190;}_0x333ded['status'](_0x41b9cd)[_0xbb43('0x26')](_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x17e939[_0xbb43('0x70')]}:_0x17e939);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 810465e..4ef724e 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 _0x017f=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x368f42,_0x14ed6e){var _0x4b3cf6=function(_0x4a3320){while(--_0x4a3320){_0x368f42['push'](_0x368f42['shift']());}};_0x4b3cf6(++_0x14ed6e);}(_0x017f,0x1a8));var _0xf017=function(_0x14e220,_0x57056){_0x14e220=_0x14e220-0x0;var _0x746d60=_0x017f[_0x14e220];return _0x746d60;};'use strict';var _=require('lodash');var util=require(_0xf017('0x0'));var logger=require(_0xf017('0x1'))(_0xf017('0x2'));var moment=require('moment');var BPromise=require(_0xf017('0x3'));var rp=require(_0xf017('0x4'));var fs=require('fs');var path=require(_0xf017('0x5'));var rimraf=require(_0xf017('0x6'));var config=require(_0xf017('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf017('0x8'));module[_0xf017('0x9')]=function(_0x46751e,_0x14ce4f){return _0x46751e[_0xf017('0xa')](_0xf017('0xb'),attributes,{'tableName':_0xf017('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15dd=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x15dd,0x72));var _0xd15d=function(_0x14f959,_0x47f64d){_0x14f959=_0x14f959-0x0;var _0x31de4c=_0x15dd[_0x14f959];return _0x31de4c;};'use strict';var _=require(_0xd15d('0x0'));var util=require(_0xd15d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd15d('0x2'));var BPromise=require(_0xd15d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd15d('0x4'));var rimraf=require(_0xd15d('0x5'));var config=require('../../config/environment');var attributes=require(_0xd15d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xd15d('0x7')]=function(_0x24f061,_0x507a87){return _0x24f061[_0xd15d('0x8')](_0xd15d('0x9'),attributes,{'tableName':_0xd15d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f07d8f0..f72dd6a 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 _0x79d6=['error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x79d6,0x166));var _0x679d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x679d('0x0'));var moment=require(_0x679d('0x1'));var BPromise=require(_0x679d('0x2'));var rs=require(_0x679d('0x3'));var fs=require('fs');var Redis=require(_0x679d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x679d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x679d('0x6'));var client=jayson[_0x679d('0x7')][_0x679d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36637e,_0x2ebef0,_0x2c9352){return new BPromise(function(_0x141cf4,_0x567b7c){return client['request'](_0x36637e,_0x2c9352)[_0x679d('0x9')](function(_0x263fd9){logger[_0x679d('0xa')](_0x679d('0xb'),_0x2ebef0,_0x679d('0xc'));logger[_0x679d('0xd')](_0x679d('0xe'),_0x2ebef0,_0x679d('0xc'),JSON[_0x679d('0xf')](_0x263fd9));if(_0x263fd9[_0x679d('0x10')]){if(_0x263fd9[_0x679d('0x10')][_0x679d('0x11')]===0x1f4){logger[_0x679d('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ebef0,_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);return _0x567b7c(_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);}logger[_0x679d('0x10')](_0x679d('0xb'),_0x2ebef0,_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);return _0x141cf4(_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);}else{logger[_0x679d('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ebef0,_0x679d('0xc'));_0x141cf4(_0x263fd9[_0x679d('0x13')][_0x679d('0x12')]);}})['catch'](function(_0x57119d){logger[_0x679d('0x10')](_0x679d('0xb'),_0x2ebef0,_0x57119d);_0x567b7c(_0x57119d);});});}exports[_0x679d('0x14')]=function(_0x324183){var _0x31dfd5=this;return new Promise(function(_0x432722,_0x479c56){return db[_0x679d('0x15')][_0x679d('0x16')]({'raw':_0x324183[_0x679d('0x17')]?_0x324183['options'][_0x679d('0x18')]===undefined?!![]:![]:!![],'where':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x19')]||null:null,'attributes':_0x324183['options']?_0x324183[_0x679d('0x17')][_0x679d('0x1a')]||null:null,'limit':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x1b')]||null:null,'include':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x324183[_0x679d('0x17')][_0x679d('0x1c')],function(_0x869962){return{'model':db[_0x869962[_0x679d('0x1e')]],'as':_0x869962['as'],'attributes':_0x869962[_0x679d('0x1a')],'include':_0x869962[_0x679d('0x1c')]?_['map'](_0x869962['include'],function(_0x59d3ae){return{'model':db[_0x59d3ae[_0x679d('0x1e')]],'as':_0x59d3ae['as'],'attributes':_0x59d3ae[_0x679d('0x1a')],'include':_0x59d3ae[_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x59d3ae[_0x679d('0x1c')],function(_0x4e9a0d){return{'model':db[_0x4e9a0d[_0x679d('0x1e')]],'as':_0x4e9a0d['as'],'attributes':_0x4e9a0d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x83a0c8){logger[_0x679d('0xa')]('GetFreshdeskAccount',_0x324183);logger[_0x679d('0xd')](_0x679d('0x14'),_0x324183,JSON['stringify'](_0x83a0c8));_0x432722(_0x83a0c8);})[_0x679d('0x1f')](function(_0x34fab3){logger[_0x679d('0x10')](_0x679d('0x14'),_0x34fab3[_0x679d('0x12')],_0x324183);_0x479c56(_0x31dfd5[_0x679d('0x10')](0x1f4,_0x34fab3['message']));});});};exports[_0x679d('0x20')]=function(_0x2254bf){var _0x1ed7a2=this;return new Promise(function(_0xa373b7,_0x4e2a10){return db[_0x679d('0x15')][_0x679d('0x21')]({'raw':_0x2254bf['options']?_0x2254bf['options'][_0x679d('0x18')]===undefined?!![]:![]:!![],'where':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x19')]||null:null,'attributes':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x1a')]||null:null,'include':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x2254bf[_0x679d('0x17')][_0x679d('0x1c')],function(_0x7b1d12){return{'model':db[_0x7b1d12[_0x679d('0x1e')]],'as':_0x7b1d12['as'],'attributes':_0x7b1d12[_0x679d('0x1a')],'include':_0x7b1d12[_0x679d('0x1c')]?_['map'](_0x7b1d12[_0x679d('0x1c')],function(_0x36e5c6){return{'model':db[_0x36e5c6[_0x679d('0x1e')]],'as':_0x36e5c6['as'],'attributes':_0x36e5c6[_0x679d('0x1a')],'include':_0x36e5c6[_0x679d('0x1c')]?_['map'](_0x36e5c6[_0x679d('0x1c')],function(_0x8471b6){return{'model':db[_0x8471b6['model']],'as':_0x8471b6['as'],'attributes':_0x8471b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1751c2){logger[_0x679d('0xa')](_0x679d('0x20'),_0x2254bf);logger[_0x679d('0xd')](_0x679d('0x20'),_0x2254bf,JSON['stringify'](_0x1751c2));_0xa373b7(_0x1751c2);})['catch'](function(_0x147edc){logger[_0x679d('0x10')](_0x679d('0x20'),_0x147edc[_0x679d('0x12')],_0x2254bf);_0x4e2a10(_0x1ed7a2[_0x679d('0x10')](0x1f4,_0x147edc[_0x679d('0x12')]));});});}; \ No newline at end of file +var _0x385f=['attributes','limit','include','model','map','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where'];(function(_0xb3c4bb,_0x26d57d){var _0x2a575f=function(_0x29d834){while(--_0x29d834){_0xb3c4bb['push'](_0xb3c4bb['shift']());}};_0x2a575f(++_0x26d57d);}(_0x385f,0x7d));var _0xf385=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x385f[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var moment=require(_0xf385('0x2'));var BPromise=require(_0xf385('0x3'));var rs=require(_0xf385('0x4'));var fs=require('fs');var Redis=require(_0xf385('0x5'));var db=require(_0xf385('0x6'))['db'];var utils=require(_0xf385('0x7'));var logger=require(_0xf385('0x8'))(_0xf385('0x9'));var config=require(_0xf385('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf385('0xb')][_0xf385('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e4e5,_0x55b4fc,_0x216e4b){return new BPromise(function(_0x4d9036,_0x4c2332){return client[_0xf385('0xd')](_0x53e4e5,_0x216e4b)[_0xf385('0xe')](function(_0xc57701){logger['info'](_0xf385('0xf'),_0x55b4fc,_0xf385('0x10'));logger[_0xf385('0x11')](_0xf385('0x12'),_0x55b4fc,_0xf385('0x10'),JSON[_0xf385('0x13')](_0xc57701));if(_0xc57701['error']){if(_0xc57701[_0xf385('0x14')][_0xf385('0x15')]===0x1f4){logger[_0xf385('0x14')](_0xf385('0xf'),_0x55b4fc,_0xc57701[_0xf385('0x14')][_0xf385('0x16')]);return _0x4c2332(_0xc57701['error'][_0xf385('0x16')]);}logger[_0xf385('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0xc57701[_0xf385('0x14')][_0xf385('0x16')]);return _0x4d9036(_0xc57701['error'][_0xf385('0x16')]);}else{logger[_0xf385('0x17')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0xf385('0x10'));_0x4d9036(_0xc57701[_0xf385('0x18')][_0xf385('0x16')]);}})[_0xf385('0x19')](function(_0x275464){logger[_0xf385('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0x275464);_0x4c2332(_0x275464);});});}exports[_0xf385('0x1a')]=function(_0x1c3286){var _0x52dd83=this;return new Promise(function(_0x18727f,_0x5bbd8b){return db[_0xf385('0x1b')][_0xf385('0x1c')]({'raw':_0x1c3286[_0xf385('0x1d')]?_0x1c3286['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c3286['options']?_0x1c3286[_0xf385('0x1d')][_0xf385('0x1e')]||null:null,'attributes':_0x1c3286[_0xf385('0x1d')]?_0x1c3286[_0xf385('0x1d')][_0xf385('0x1f')]||null:null,'limit':_0x1c3286[_0xf385('0x1d')]?_0x1c3286[_0xf385('0x1d')][_0xf385('0x20')]||null:null,'include':_0x1c3286['options']?_0x1c3286[_0xf385('0x1d')][_0xf385('0x21')]?_['map'](_0x1c3286[_0xf385('0x1d')][_0xf385('0x21')],function(_0x12ea7c){return{'model':db[_0x12ea7c[_0xf385('0x22')]],'as':_0x12ea7c['as'],'attributes':_0x12ea7c[_0xf385('0x1f')],'include':_0x12ea7c[_0xf385('0x21')]?_[_0xf385('0x23')](_0x12ea7c[_0xf385('0x21')],function(_0x542460){return{'model':db[_0x542460['model']],'as':_0x542460['as'],'attributes':_0x542460['attributes'],'include':_0x542460[_0xf385('0x21')]?_['map'](_0x542460[_0xf385('0x21')],function(_0x4f9d68){return{'model':db[_0x4f9d68[_0xf385('0x22')]],'as':_0x4f9d68['as'],'attributes':_0x4f9d68[_0xf385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47af36){logger['info']('GetFreshdeskAccount',_0x1c3286);logger[_0xf385('0x11')]('GetFreshdeskAccount',_0x1c3286,JSON[_0xf385('0x13')](_0x47af36));_0x18727f(_0x47af36);})[_0xf385('0x19')](function(_0x244121){logger[_0xf385('0x14')](_0xf385('0x1a'),_0x244121['message'],_0x1c3286);_0x5bbd8b(_0x52dd83[_0xf385('0x14')](0x1f4,_0x244121['message']));});});};exports[_0xf385('0x24')]=function(_0x477c11){var _0x13de9e=this;return new Promise(function(_0x5d1f63,_0x533a61){return db[_0xf385('0x1b')][_0xf385('0x25')]({'raw':_0x477c11[_0xf385('0x1d')]?_0x477c11[_0xf385('0x1d')][_0xf385('0x26')]===undefined?!![]:![]:!![],'where':_0x477c11[_0xf385('0x1d')]?_0x477c11['options'][_0xf385('0x1e')]||null:null,'attributes':_0x477c11[_0xf385('0x1d')]?_0x477c11[_0xf385('0x1d')]['attributes']||null:null,'include':_0x477c11[_0xf385('0x1d')]?_0x477c11['options']['include']?_[_0xf385('0x23')](_0x477c11[_0xf385('0x1d')][_0xf385('0x21')],function(_0x5eef9a){return{'model':db[_0x5eef9a[_0xf385('0x22')]],'as':_0x5eef9a['as'],'attributes':_0x5eef9a[_0xf385('0x1f')],'include':_0x5eef9a['include']?_[_0xf385('0x23')](_0x5eef9a[_0xf385('0x21')],function(_0x3015cb){return{'model':db[_0x3015cb['model']],'as':_0x3015cb['as'],'attributes':_0x3015cb[_0xf385('0x1f')],'include':_0x3015cb[_0xf385('0x21')]?_['map'](_0x3015cb[_0xf385('0x21')],function(_0x19fa0e){return{'model':db[_0x19fa0e[_0xf385('0x22')]],'as':_0x19fa0e['as'],'attributes':_0x19fa0e[_0xf385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21bbe5){logger[_0xf385('0x17')](_0xf385('0x24'),_0x477c11);logger[_0xf385('0x11')](_0xf385('0x24'),_0x477c11,JSON[_0xf385('0x13')](_0x21bbe5));_0x5d1f63(_0x21bbe5);})[_0xf385('0x19')](function(_0x308e77){logger[_0xf385('0x14')](_0xf385('0x24'),_0x308e77[_0xf385('0x16')],_0x477c11);_0x533a61(_0x13de9e[_0xf385('0x14')](0x1f4,_0x308e77[_0xf385('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 93202dc..c517709 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 _0x25dc=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','delete','destroy','multer'];(function(_0x554a83,_0x4f0604){var _0x5c3d02=function(_0x51ba44){while(--_0x51ba44){_0x554a83['push'](_0x554a83['shift']());}};_0x5c3d02(++_0x4f0604);}(_0x25dc,0x125));var _0xc25d=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x25dc[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0xc25d('0x0'));var util=require(_0xc25d('0x1'));var path=require(_0xc25d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc25d('0x3')]();var fs_extra=require(_0xc25d('0x4'));var auth=require(_0xc25d('0x5'));var interaction=require(_0xc25d('0x6'));var config=require(_0xc25d('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xc25d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc25d('0x9')]);router[_0xc25d('0x8')](_0xc25d('0xa'),auth[_0xc25d('0xb')](),controller['show']);router[_0xc25d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc25d('0xc')]);router['get'](_0xc25d('0xd'),auth['isAuthenticated'](),controller[_0xc25d('0xe')]);router[_0xc25d('0x8')](_0xc25d('0xf'),auth[_0xc25d('0xb')](),controller['getDescriptions']);router[_0xc25d('0x8')]('/:id/tags',auth[_0xc25d('0xb')](),controller['getTags']);router[_0xc25d('0x10')]('/',auth[_0xc25d('0xb')](),controller['create']);router['post']('/:id/tags',auth[_0xc25d('0xb')](),controller[_0xc25d('0x11')]);router[_0xc25d('0x12')](_0xc25d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc25d('0x13')](_0xc25d('0xa'),auth[_0xc25d('0xb')](),controller[_0xc25d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x828b=['isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x1b9326,_0x238147){var _0x554927=function(_0x33eea1){while(--_0x33eea1){_0x1b9326['push'](_0x1b9326['shift']());}};_0x554927(++_0x238147);}(_0x828b,0x147));var _0xb828=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0x828b[_0x2bb82d];return _0x5e0b92;};'use strict';var multer=require('multer');var util=require(_0xb828('0x0'));var path=require(_0xb828('0x1'));var timeout=require(_0xb828('0x2'));var express=require(_0xb828('0x3'));var router=express['Router']();var fs_extra=require(_0xb828('0x4'));var auth=require(_0xb828('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb828('0x6'));var controller=require(_0xb828('0x7'));router[_0xb828('0x8')]('/',auth[_0xb828('0x9')](),controller['index']);router[_0xb828('0x8')]('/:id',auth[_0xb828('0x9')](),controller[_0xb828('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xb828('0xb'),auth[_0xb828('0x9')](),controller[_0xb828('0xc')]);router[_0xb828('0x8')](_0xb828('0xd'),auth[_0xb828('0x9')](),controller[_0xb828('0xe')]);router[_0xb828('0x8')](_0xb828('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0xb828('0x10')]('/',auth[_0xb828('0x9')](),controller[_0xb828('0x11')]);router[_0xb828('0x10')](_0xb828('0xf'),auth[_0xb828('0x9')](),controller[_0xb828('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb828('0x9')](),controller[_0xb828('0x13')]);module[_0xb828('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index cc96c7d..48c6b6d 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 _0x2df3=['STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x2df3,0x171));var _0x32df=function(_0x319d75,_0x5b5e7f){_0x319d75=_0x319d75-0x0;var _0x5882bb=_0x2df3[_0x319d75];return _0x5882bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32df('0x0')]},'description':{'type':Sequelize[_0x32df('0x0')]}}; \ No newline at end of file +var _0x9892=['STRING','sequelize'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x9892,0xf7));var _0x2989=function(_0x77ed4b,_0x507f99){_0x77ed4b=_0x77ed4b-0x0;var _0x448455=_0x9892[_0x77ed4b];return _0x448455;};'use strict';var Sequelize=require(_0x2989('0x0'));module['exports']={'name':{'type':Sequelize[_0x2989('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 88244f9..401d8ea 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 _0xd6b3=['getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','json','undefined','count','offset','status','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','getFields','findOne','FreshdeskField'];(function(_0xf6e99f,_0x58daf8){var _0x34f260=function(_0x297d26){while(--_0x297d26){_0xf6e99f['push'](_0xf6e99f['shift']());}};_0x34f260(++_0x58daf8);}(_0xd6b3,0xf7));var _0x3d6b=function(_0x269b7c,_0x367d59){_0x269b7c=_0x269b7c-0x0;var _0x128643=_0xd6b3[_0x269b7c];return _0x128643;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d6b('0x0'));var jsonpatch=require(_0x3d6b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d6b('0x2'));var Mustache=require(_0x3d6b('0x3'));var util=require(_0x3d6b('0x4'));var path=require(_0x3d6b('0x5'));var sox=require(_0x3d6b('0x6'));var csv=require(_0x3d6b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d6b('0x8'));var _=require(_0x3d6b('0x9'));var squel=require(_0x3d6b('0xa'));var crypto=require(_0x3d6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d6b('0x7'));var querystring=require('querystring');var Papa=require(_0x3d6b('0xc'));var Redis=require('ioredis');var authService=require(_0x3d6b('0xd'));var qs=require(_0x3d6b('0xe'));var as=require(_0x3d6b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6b('0x10'))(_0x3d6b('0x11'));var utils=require(_0x3d6b('0x12'));var config=require(_0x3d6b('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x210829,_0x1840ae){_0x1840ae=_0x1840ae||0xcc;return function(_0x1fba22){if(_0x1fba22){return _0x210829['sendStatus'](_0x1840ae);}return _0x210829['status'](_0x1840ae)[_0x3d6b('0x14')]();};}function respondWithResult(_0x84a530,_0x387fb3){_0x387fb3=_0x387fb3||0xc8;return function(_0x357575){if(_0x357575){return _0x84a530['status'](_0x387fb3)[_0x3d6b('0x15')](_0x357575);}};}function respondWithFilteredResult(_0x410bdf,_0x14eab3){return function(_0xfd4086){if(_0xfd4086){var _0x535013=typeof _0x14eab3['offset']===_0x3d6b('0x16')&&typeof _0x14eab3['limit']===_0x3d6b('0x16');var _0x2cf4e2=_0xfd4086[_0x3d6b('0x17')];var _0x30b735=_0x535013?0x0:_0x14eab3[_0x3d6b('0x18')];var _0x160807=_0x535013?_0xfd4086[_0x3d6b('0x17')]:_0x14eab3[_0x3d6b('0x18')]+_0x14eab3['limit'];var _0x1a045c;if(_0x160807>=_0x2cf4e2){_0x160807=_0x2cf4e2;_0x1a045c=0xc8;}else{_0x1a045c=0xce;}_0x410bdf[_0x3d6b('0x19')](_0x1a045c);return _0x410bdf['set'](_0x3d6b('0x1a'),_0x30b735+'-'+_0x160807+'/'+_0x2cf4e2)[_0x3d6b('0x15')](_0xfd4086);}return null;};}function patchUpdates(_0x35706a){return function(_0x276942){try{jsonpatch[_0x3d6b('0x1b')](_0x276942,_0x35706a,!![]);}catch(_0x2b3722){return BPromise[_0x3d6b('0x1c')](_0x2b3722);}return _0x276942['save']();};}function saveUpdates(_0x9cad6c,_0x4f54f0){return function(_0x4f9160){if(_0x4f9160){return _0x4f9160[_0x3d6b('0x1d')](_0x9cad6c)[_0x3d6b('0x1e')](function(_0x4194ff){return _0x4194ff;});}return null;};}function removeEntity(_0x3c4143,_0x3ae8fc){return function(_0x41efe4){if(_0x41efe4){return _0x41efe4[_0x3d6b('0x1f')]()[_0x3d6b('0x1e')](function(){_0x3c4143[_0x3d6b('0x19')](0xcc)[_0x3d6b('0x14')]();});}};}function handleEntityNotFound(_0x1aafd3,_0x101b8b){return function(_0x252271){if(!_0x252271){_0x1aafd3[_0x3d6b('0x20')](0x194);}return _0x252271;};}function handleError(_0x367268,_0x297c12){_0x297c12=_0x297c12||0x1f4;return function(_0x54ecf3){logger[_0x3d6b('0x21')](_0x54ecf3[_0x3d6b('0x22')]);if(_0x54ecf3[_0x3d6b('0x23')]){delete _0x54ecf3[_0x3d6b('0x23')];}_0x367268['status'](_0x297c12)[_0x3d6b('0x24')](_0x54ecf3);};}exports[_0x3d6b('0x25')]=function(_0x573ead,_0x3d3310){var _0x2c814e={},_0x866e04={},_0x1f1e7f={'count':0x0,'rows':[]};var _0x3a88bd=_[_0x3d6b('0x26')](db[_0x3d6b('0x27')][_0x3d6b('0x28')],function(_0x57ec5f){return{'name':_0x57ec5f['fieldName'],'type':_0x57ec5f[_0x3d6b('0x29')][_0x3d6b('0x2a')]};});_0x866e04[_0x3d6b('0x2b')]=_[_0x3d6b('0x26')](_0x3a88bd,_0x3d6b('0x23'));_0x866e04[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x573ead['query']);_0x866e04[_0x3d6b('0x2e')]=_['intersection'](_0x866e04[_0x3d6b('0x2b')],_0x866e04[_0x3d6b('0x2c')]);_0x2c814e['attributes']=_['intersection'](_0x866e04['model'],qs[_0x3d6b('0x2f')](_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x2c814e['attributes']=_0x2c814e[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0x2c814e[_0x3d6b('0x30')]:_0x866e04[_0x3d6b('0x2b')];if(!_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x32')]('nolimit')){_0x2c814e[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x573ead['query']['limit']);_0x2c814e[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}_0x2c814e[_0x3d6b('0x34')]=qs[_0x3d6b('0x35')](_0x573ead['query'][_0x3d6b('0x35')]);_0x2c814e['where']=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x573ead[_0x3d6b('0x2c')],_0x866e04[_0x3d6b('0x2e')]),_0x3a88bd);if(_0x573ead['query'][_0x3d6b('0x37')]){_0x2c814e[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x2c814e[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x3a88bd,function(_0x427486){if(_0x427486[_0x3d6b('0x29')]!==_0x3d6b('0x3a')){var _0x3bb84a={};_0x3bb84a[_0x427486[_0x3d6b('0x23')]]={'$like':'%'+_0x573ead['query'][_0x3d6b('0x37')]+'%'};return _0x3bb84a;}})});}_0x2c814e=_[_0x3d6b('0x39')]({},_0x2c814e,_0x573ead[_0x3d6b('0x3b')]);var _0x22789b={'where':_0x2c814e[_0x3d6b('0x38')]};return db[_0x3d6b('0x27')]['count'](_0x22789b)['then'](function(_0x292222){_0x1f1e7f[_0x3d6b('0x17')]=_0x292222;if(_0x573ead[_0x3d6b('0x2c')]['includeAll']){_0x2c814e[_0x3d6b('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x3d6b('0x3d')](_0x2c814e);})['then'](function(_0x173e21){_0x1f1e7f['rows']=_0x173e21;return _0x1f1e7f;})[_0x3d6b('0x1e')](respondWithFilteredResult(_0x3d3310,_0x2c814e))[_0x3d6b('0x3e')](handleError(_0x3d3310,null));};exports[_0x3d6b('0x3f')]=function(_0x5cac92,_0x4b7f23){var _0x5510a9={'raw':![],'where':{'id':_0x5cac92[_0x3d6b('0x40')]['id']}},_0x305427={};_0x305427[_0x3d6b('0x2b')]=_[_0x3d6b('0x2d')](db[_0x3d6b('0x27')][_0x3d6b('0x28')]);_0x305427[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x5cac92['query']);_0x305427[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x305427[_0x3d6b('0x2b')],_0x305427['query']);_0x5510a9[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x305427[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x5cac92[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x5510a9[_0x3d6b('0x30')]=_0x5510a9[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0x5510a9[_0x3d6b('0x30')]:_0x305427[_0x3d6b('0x2b')];if(_0x5cac92[_0x3d6b('0x2c')][_0x3d6b('0x42')]){_0x5510a9[_0x3d6b('0x3c')]=[{'all':!![]}];}_0x5510a9=_['merge']({},_0x5510a9,_0x5cac92[_0x3d6b('0x3b')]);return db[_0x3d6b('0x27')][_0x3d6b('0x43')](_0x5510a9)[_0x3d6b('0x1e')](handleEntityNotFound(_0x4b7f23,null))['then'](respondWithResult(_0x4b7f23,null))['catch'](handleError(_0x4b7f23,null));};exports['create']=function(_0x4f6b6f,_0x373a28){return db[_0x3d6b('0x27')][_0x3d6b('0x44')](_0x4f6b6f[_0x3d6b('0x45')],{})[_0x3d6b('0x1e')](respondWithResult(_0x373a28,0xc9))['catch'](handleError(_0x373a28,null));};exports[_0x3d6b('0x1d')]=function(_0x369b7d,_0x136904){if(_0x369b7d[_0x3d6b('0x45')]['id']){delete _0x369b7d[_0x3d6b('0x45')]['id'];}return db[_0x3d6b('0x27')][_0x3d6b('0x43')]({'where':{'id':_0x369b7d['params']['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x136904,null))[_0x3d6b('0x1e')](saveUpdates(_0x369b7d[_0x3d6b('0x45')],null))[_0x3d6b('0x1e')](respondWithResult(_0x136904,null))[_0x3d6b('0x3e')](handleError(_0x136904,null));};exports[_0x3d6b('0x1f')]=function(_0x4cf960,_0x50775d){return db['FreshdeskConfiguration'][_0x3d6b('0x43')]({'where':{'id':_0x4cf960[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x50775d,null))[_0x3d6b('0x1e')](removeEntity(_0x50775d,null))[_0x3d6b('0x3e')](handleError(_0x50775d,null));};exports[_0x3d6b('0x46')]=function(_0x255d4b,_0x258dab,_0x52ad24){var _0x52be1e={};var _0x21eff5={};var _0x45c032;var _0x1006e5;return db['FreshdeskConfiguration'][_0x3d6b('0x47')]({'where':{'id':_0x255d4b[_0x3d6b('0x40')]['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x258dab,null))['then'](function(_0x10914d){if(_0x10914d){_0x45c032=_0x10914d;_0x21eff5['model']=_[_0x3d6b('0x2d')](db[_0x3d6b('0x48')]['rawAttributes']);_0x21eff5[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x255d4b[_0x3d6b('0x2c')]);_0x21eff5[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x21eff5[_0x3d6b('0x2b')],_0x21eff5[_0x3d6b('0x2c')]);_0x52be1e['attributes']=_['intersection'](_0x21eff5[_0x3d6b('0x2b')],qs['fields'](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x52be1e[_0x3d6b('0x30')]=_0x52be1e['attributes'][_0x3d6b('0x31')]?_0x52be1e[_0x3d6b('0x30')]:_0x21eff5['model'];_0x52be1e['order']=qs['sort'](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0x52be1e[_0x3d6b('0x38')]=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x255d4b[_0x3d6b('0x2c')],_0x21eff5[_0x3d6b('0x2e')]));if(_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x52be1e[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x52be1e[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x52be1e[_0x3d6b('0x30')],function(_0x3deca9){var _0x55aa32={};_0x55aa32[_0x3deca9]={'$like':'%'+_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x55aa32;})});}_0x52be1e=_[_0x3d6b('0x39')]({},_0x52be1e,_0x255d4b[_0x3d6b('0x3b')]);return _0x45c032['getFields'](_0x52be1e);}})[_0x3d6b('0x1e')](function(_0x4ed98b){if(_0x4ed98b){_0x1006e5=_0x4ed98b[_0x3d6b('0x31')];if(!_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x32')]('nolimit')){_0x52be1e[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x52be1e[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}return _0x45c032[_0x3d6b('0x46')](_0x52be1e);}})[_0x3d6b('0x1e')](function(_0x437c41){if(_0x437c41){return _0x437c41?{'count':_0x1006e5,'rows':_0x437c41}:null;}})[_0x3d6b('0x1e')](respondWithResult(_0x258dab,null))[_0x3d6b('0x3e')](handleError(_0x258dab,null));};exports[_0x3d6b('0x49')]=function(_0x4d20c8,_0x41a876,_0x52e9d0){var _0xddb9ba={};var _0x49ee79={};var _0x4a5ee3;var _0x52b14c;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x4d20c8[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x41a876,null))['then'](function(_0x3fe363){if(_0x3fe363){_0x4a5ee3=_0x3fe363;_0x49ee79[_0x3d6b('0x2b')]=_[_0x3d6b('0x2d')](db[_0x3d6b('0x48')]['rawAttributes']);_0x49ee79[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x4d20c8[_0x3d6b('0x2c')]);_0x49ee79[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x49ee79['model'],_0x49ee79[_0x3d6b('0x2c')]);_0xddb9ba[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x49ee79[_0x3d6b('0x2b')],qs['fields'](_0x4d20c8[_0x3d6b('0x2c')]['fields']));_0xddb9ba[_0x3d6b('0x30')]=_0xddb9ba[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0xddb9ba[_0x3d6b('0x30')]:_0x49ee79[_0x3d6b('0x2b')];_0xddb9ba['order']=qs['sort'](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0xddb9ba['where']=qs[_0x3d6b('0x2e')](_['pick'](_0x4d20c8['query'],_0x49ee79['filters']));if(_0x4d20c8['query'][_0x3d6b('0x37')]){_0xddb9ba[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0xddb9ba[_0x3d6b('0x38')],{'$or':_['map'](_0xddb9ba['attributes'],function(_0x1d2f6f){var _0x500cef={};_0x500cef[_0x1d2f6f]={'$like':'%'+_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x500cef;})});}_0xddb9ba=_['merge']({},_0xddb9ba,_0x4d20c8[_0x3d6b('0x3b')]);return _0x4a5ee3['getSubjects'](_0xddb9ba);}})[_0x3d6b('0x1e')](function(_0x1ff550){if(_0x1ff550){_0x52b14c=_0x1ff550[_0x3d6b('0x31')];if(!_0x4d20c8['query'][_0x3d6b('0x32')](_0x3d6b('0x4a'))){_0xddb9ba[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0xddb9ba[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}return _0x4a5ee3[_0x3d6b('0x49')](_0xddb9ba);}})[_0x3d6b('0x1e')](function(_0x1a0f0b){if(_0x1a0f0b){return _0x1a0f0b?{'count':_0x52b14c,'rows':_0x1a0f0b}:null;}})['then'](respondWithResult(_0x41a876,null))[_0x3d6b('0x3e')](handleError(_0x41a876,null));};exports[_0x3d6b('0x4b')]=function(_0x3ac81f,_0x4a2150,_0x53a846){var _0x31fe9c={};var _0xf7fa34={};var _0x7e1211;var _0x2c319d;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x3ac81f['params']['id']}})['then'](handleEntityNotFound(_0x4a2150,null))['then'](function(_0x4d6b60){if(_0x4d6b60){_0x7e1211=_0x4d6b60;_0xf7fa34[_0x3d6b('0x2b')]=_['keys'](db[_0x3d6b('0x48')]['rawAttributes']);_0xf7fa34[_0x3d6b('0x2c')]=_['keys'](_0x3ac81f[_0x3d6b('0x2c')]);_0xf7fa34[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0xf7fa34[_0x3d6b('0x2b')],_0xf7fa34['query']);_0x31fe9c[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0xf7fa34[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x31fe9c[_0x3d6b('0x30')]=_0x31fe9c[_0x3d6b('0x30')]['length']?_0x31fe9c['attributes']:_0xf7fa34[_0x3d6b('0x2b')];_0x31fe9c[_0x3d6b('0x34')]=qs[_0x3d6b('0x35')](_0x3ac81f[_0x3d6b('0x2c')]['sort']);_0x31fe9c[_0x3d6b('0x38')]=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x3ac81f[_0x3d6b('0x2c')],_0xf7fa34[_0x3d6b('0x2e')]));if(_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x31fe9c[_0x3d6b('0x38')]=_['merge'](_0x31fe9c[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x31fe9c['attributes'],function(_0x13767a){var _0x103151={};_0x103151[_0x13767a]={'$like':'%'+_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x103151;})});}_0x31fe9c=_[_0x3d6b('0x39')]({},_0x31fe9c,_0x3ac81f[_0x3d6b('0x3b')]);return _0x7e1211['getDescriptions'](_0x31fe9c);}})[_0x3d6b('0x1e')](function(_0x4ccb29){if(_0x4ccb29){_0x2c319d=_0x4ccb29[_0x3d6b('0x31')];if(!_0x3ac81f[_0x3d6b('0x2c')]['hasOwnProperty'](_0x3d6b('0x4a'))){_0x31fe9c[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x31fe9c['offset']=qs[_0x3d6b('0x18')](_0x3ac81f[_0x3d6b('0x2c')]['offset']);}return _0x7e1211['getDescriptions'](_0x31fe9c);}})[_0x3d6b('0x1e')](function(_0x32d8ed){if(_0x32d8ed){return _0x32d8ed?{'count':_0x2c319d,'rows':_0x32d8ed}:null;}})[_0x3d6b('0x1e')](respondWithResult(_0x4a2150,null))[_0x3d6b('0x3e')](handleError(_0x4a2150,null));};exports[_0x3d6b('0x4c')]=function(_0x36160a,_0x5e9428,_0x18bc8f){var _0x3133bd={};var _0x516230={};var _0x429c1f;var _0x36685a;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x36160a[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e9428,null))[_0x3d6b('0x1e')](function(_0x53c591){if(_0x53c591){_0x429c1f=_0x53c591;_0x516230[_0x3d6b('0x2b')]=_['keys'](db[_0x3d6b('0x4d')][_0x3d6b('0x28')]);_0x516230[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x36160a[_0x3d6b('0x2c')]);_0x516230['filters']=_['intersection'](_0x516230[_0x3d6b('0x2b')],_0x516230[_0x3d6b('0x2c')]);_0x3133bd[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x516230[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x3133bd[_0x3d6b('0x30')]=_0x3133bd[_0x3d6b('0x30')]['length']?_0x3133bd['attributes']:_0x516230[_0x3d6b('0x2b')];_0x3133bd['order']=qs[_0x3d6b('0x35')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0x3133bd['where']=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x36160a[_0x3d6b('0x2c')],_0x516230['filters']));if(_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x3133bd[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x3133bd[_0x3d6b('0x38')],{'$or':_['map'](_0x3133bd[_0x3d6b('0x30')],function(_0x39f75a){var _0x4c4a57={};_0x4c4a57[_0x39f75a]={'$like':'%'+_0x36160a['query'][_0x3d6b('0x37')]+'%'};return _0x4c4a57;})});}_0x3133bd=_[_0x3d6b('0x39')]({},_0x3133bd,_0x36160a[_0x3d6b('0x3b')]);return _0x429c1f[_0x3d6b('0x4c')](_0x3133bd);}})['then'](function(_0x34619a){if(_0x34619a){_0x36685a=_0x34619a[_0x3d6b('0x31')];if(!_0x36160a[_0x3d6b('0x2c')]['hasOwnProperty'](_0x3d6b('0x4a'))){_0x3133bd[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x3133bd[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x36160a[_0x3d6b('0x2c')]['offset']);}return _0x429c1f[_0x3d6b('0x4c')](_0x3133bd);}})[_0x3d6b('0x1e')](function(_0x1ad04e){if(_0x1ad04e){return _0x1ad04e?{'count':_0x36685a,'rows':_0x1ad04e}:null;}})['then'](respondWithResult(_0x5e9428,null))[_0x3d6b('0x3e')](handleError(_0x5e9428,null));};exports[_0x3d6b('0x4e')]=function(_0x944756,_0x55972c,_0x2c315b){if(_0x944756[_0x3d6b('0x45')]['id']){delete _0x944756['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x944756['params']['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x55972c,null))[_0x3d6b('0x1e')](function(_0x1f7d31){if(_0x1f7d31){return _0x1f7d31['setTags'](_0x944756[_0x3d6b('0x45')][_0x3d6b('0x4f')]||[]);}return null;})[_0x3d6b('0x1e')](respondWithResult(_0x55972c,null))[_0x3d6b('0x3e')](handleError(_0x55972c,null));}; \ No newline at end of file +var _0xbc5d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','FreshdeskConfiguration','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','length','merge','find','create','body','params','getFields','findOne','FreshdeskField','pick','getSubjects','rawAttributes','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0xbc5d,0x1ef));var _0xdbc5=function(_0x3eb7d5,_0x244971){_0x3eb7d5=_0x3eb7d5-0x0;var _0x512416=_0xbc5d[_0x3eb7d5];return _0x512416;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbc5('0x0'));var zipdir=require(_0xdbc5('0x1'));var jsonpatch=require(_0xdbc5('0x2'));var rp=require(_0xdbc5('0x3'));var moment=require(_0xdbc5('0x4'));var BPromise=require(_0xdbc5('0x5'));var Mustache=require('mustache');var util=require(_0xdbc5('0x6'));var path=require(_0xdbc5('0x7'));var sox=require(_0xdbc5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbc5('0x9'));var _=require(_0xdbc5('0xa'));var squel=require(_0xdbc5('0xb'));var crypto=require(_0xdbc5('0xc'));var jsforce=require(_0xdbc5('0xd'));var deskjs=require(_0xdbc5('0xe'));var toCsv=require(_0xdbc5('0xf'));var querystring=require(_0xdbc5('0x10'));var Papa=require(_0xdbc5('0x11'));var Redis=require('ioredis');var authService=require(_0xdbc5('0x12'));var qs=require(_0xdbc5('0x13'));var as=require(_0xdbc5('0x14'));var hardwareService=require(_0xdbc5('0x15'));var logger=require(_0xdbc5('0x16'))(_0xdbc5('0x17'));var utils=require(_0xdbc5('0x18'));var config=require(_0xdbc5('0x19'));var licenseUtil=require(_0xdbc5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d163,_0xb07066){_0xb07066=_0xb07066||0xcc;return function(_0x3db7b5){if(_0x3db7b5){return _0x17d163[_0xdbc5('0x1b')](_0xb07066);}return _0x17d163[_0xdbc5('0x1c')](_0xb07066)[_0xdbc5('0x1d')]();};}function respondWithResult(_0xbabb15,_0xfbf2b8){_0xfbf2b8=_0xfbf2b8||0xc8;return function(_0x3b37c5){if(_0x3b37c5){return _0xbabb15[_0xdbc5('0x1c')](_0xfbf2b8)['json'](_0x3b37c5);}};}function respondWithFilteredResult(_0x1cf387,_0x58bf8c){return function(_0x3110f3){if(_0x3110f3){var _0x3da042=typeof _0x58bf8c[_0xdbc5('0x1e')]===_0xdbc5('0x1f')&&typeof _0x58bf8c['limit']===_0xdbc5('0x1f');var _0x489874=_0x3110f3[_0xdbc5('0x20')];var _0x42ff3a=_0x3da042?0x0:_0x58bf8c[_0xdbc5('0x1e')];var _0x36cc76=_0x3da042?_0x3110f3[_0xdbc5('0x20')]:_0x58bf8c[_0xdbc5('0x1e')]+_0x58bf8c[_0xdbc5('0x21')];var _0x19b0a6;if(_0x36cc76>=_0x489874){_0x36cc76=_0x489874;_0x19b0a6=0xc8;}else{_0x19b0a6=0xce;}_0x1cf387[_0xdbc5('0x1c')](_0x19b0a6);return _0x1cf387['set'](_0xdbc5('0x22'),_0x42ff3a+'-'+_0x36cc76+'/'+_0x489874)[_0xdbc5('0x23')](_0x3110f3);}return null;};}function patchUpdates(_0x3f82eb){return function(_0x4fbc7a){try{jsonpatch[_0xdbc5('0x24')](_0x4fbc7a,_0x3f82eb,!![]);}catch(_0x21dbf5){return BPromise[_0xdbc5('0x25')](_0x21dbf5);}return _0x4fbc7a[_0xdbc5('0x26')]();};}function saveUpdates(_0x45c444,_0x221d07){return function(_0x5e38b1){if(_0x5e38b1){return _0x5e38b1[_0xdbc5('0x27')](_0x45c444)[_0xdbc5('0x28')](function(_0x1b78bb){return _0x1b78bb;});}return null;};}function removeEntity(_0xa69b33,_0x48b892){return function(_0x142308){if(_0x142308){return _0x142308[_0xdbc5('0x29')]()[_0xdbc5('0x28')](function(){_0xa69b33[_0xdbc5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ae0a,_0x39d28a){return function(_0xf1bc8f){if(!_0xf1bc8f){_0x41ae0a['sendStatus'](0x194);}return _0xf1bc8f;};}function handleError(_0x4b27b6,_0x27dac6){_0x27dac6=_0x27dac6||0x1f4;return function(_0x4cb1f5){logger[_0xdbc5('0x2a')](_0x4cb1f5[_0xdbc5('0x2b')]);if(_0x4cb1f5[_0xdbc5('0x2c')]){delete _0x4cb1f5['name'];}_0x4b27b6[_0xdbc5('0x1c')](_0x27dac6)['send'](_0x4cb1f5);};}exports['index']=function(_0x47ae15,_0xfec24b){var _0x264052={},_0x2fb350={},_0x15e58b={'count':0x0,'rows':[]};var _0x585f80=_[_0xdbc5('0x2d')](db[_0xdbc5('0x2e')]['rawAttributes'],function(_0x19551d){return{'name':_0x19551d[_0xdbc5('0x2f')],'type':_0x19551d[_0xdbc5('0x30')]['key']};});_0x2fb350[_0xdbc5('0x31')]=_[_0xdbc5('0x2d')](_0x585f80,_0xdbc5('0x2c'));_0x2fb350[_0xdbc5('0x32')]=_[_0xdbc5('0x33')](_0x47ae15['query']);_0x2fb350['filters']=_['intersection'](_0x2fb350[_0xdbc5('0x31')],_0x2fb350[_0xdbc5('0x32')]);_0x264052[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x2fb350[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x264052[_0xdbc5('0x34')]=_0x264052[_0xdbc5('0x34')]['length']?_0x264052[_0xdbc5('0x34')]:_0x2fb350[_0xdbc5('0x31')];if(!_0x47ae15['query'][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x264052['limit']=qs['limit'](_0x47ae15[_0xdbc5('0x32')]['limit']);_0x264052[_0xdbc5('0x1e')]=qs[_0xdbc5('0x1e')](_0x47ae15[_0xdbc5('0x32')]['offset']);}_0x264052[_0xdbc5('0x39')]=qs['sort'](_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x264052['where']=qs[_0xdbc5('0x3b')](_['pick'](_0x47ae15[_0xdbc5('0x32')],_0x2fb350[_0xdbc5('0x3b')]),_0x585f80);if(_0x47ae15['query']['filter']){_0x264052[_0xdbc5('0x3c')]=_['merge'](_0x264052[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x585f80,function(_0x3861a3){if(_0x3861a3[_0xdbc5('0x30')]!==_0xdbc5('0x3d')){var _0x21fac3={};_0x21fac3[_0x3861a3['name']]={'$like':'%'+_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x21fac3;}})});}_0x264052=_['merge']({},_0x264052,_0x47ae15[_0xdbc5('0x3f')]);var _0x104a0e={'where':_0x264052[_0xdbc5('0x3c')]};return db[_0xdbc5('0x2e')][_0xdbc5('0x20')](_0x104a0e)[_0xdbc5('0x28')](function(_0xfc1722){_0x15e58b['count']=_0xfc1722;if(_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x40')]){_0x264052[_0xdbc5('0x41')]=[{'all':!![]}];}return db[_0xdbc5('0x2e')][_0xdbc5('0x42')](_0x264052);})[_0xdbc5('0x28')](function(_0x161b5c){_0x15e58b[_0xdbc5('0x43')]=_0x161b5c;return _0x15e58b;})['then'](respondWithFilteredResult(_0xfec24b,_0x264052))[_0xdbc5('0x44')](handleError(_0xfec24b,null));};exports['show']=function(_0x490a13,_0x1541e9){var _0x4d70b7={'raw':![],'where':{'id':_0x490a13['params']['id']}},_0x465b96={};_0x465b96[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db['FreshdeskConfiguration']['rawAttributes']);_0x465b96['query']=_['keys'](_0x490a13[_0xdbc5('0x32')]);_0x465b96[_0xdbc5('0x3b')]=_['intersection'](_0x465b96[_0xdbc5('0x31')],_0x465b96[_0xdbc5('0x32')]);_0x4d70b7[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x465b96[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x490a13['query'][_0xdbc5('0x36')]));_0x4d70b7[_0xdbc5('0x34')]=_0x4d70b7[_0xdbc5('0x34')][_0xdbc5('0x45')]?_0x4d70b7['attributes']:_0x465b96[_0xdbc5('0x31')];if(_0x490a13[_0xdbc5('0x32')][_0xdbc5('0x40')]){_0x4d70b7['include']=[{'all':!![]}];}_0x4d70b7=_[_0xdbc5('0x46')]({},_0x4d70b7,_0x490a13[_0xdbc5('0x3f')]);return db[_0xdbc5('0x2e')][_0xdbc5('0x47')](_0x4d70b7)['then'](handleEntityNotFound(_0x1541e9,null))['then'](respondWithResult(_0x1541e9,null))['catch'](handleError(_0x1541e9,null));};exports[_0xdbc5('0x48')]=function(_0x3207e7,_0x17078c){return db[_0xdbc5('0x2e')]['create'](_0x3207e7[_0xdbc5('0x49')],{})['then'](respondWithResult(_0x17078c,0xc9))[_0xdbc5('0x44')](handleError(_0x17078c,null));};exports[_0xdbc5('0x27')]=function(_0x5f2a72,_0xfb2537){if(_0x5f2a72[_0xdbc5('0x49')]['id']){delete _0x5f2a72['body']['id'];}return db[_0xdbc5('0x2e')][_0xdbc5('0x47')]({'where':{'id':_0x5f2a72[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0xfb2537,null))[_0xdbc5('0x28')](saveUpdates(_0x5f2a72[_0xdbc5('0x49')],null))[_0xdbc5('0x28')](respondWithResult(_0xfb2537,null))['catch'](handleError(_0xfb2537,null));};exports[_0xdbc5('0x29')]=function(_0x353d4b,_0xacc0cf){return db[_0xdbc5('0x2e')]['find']({'where':{'id':_0x353d4b['params']['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0xacc0cf,null))[_0xdbc5('0x28')](removeEntity(_0xacc0cf,null))['catch'](handleError(_0xacc0cf,null));};exports[_0xdbc5('0x4b')]=function(_0x4833b4,_0x19691b,_0x5a7d55){var _0x10f3d1={};var _0x3f8662={};var _0x372d3e;var _0xd92241;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x4833b4[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x19691b,null))[_0xdbc5('0x28')](function(_0x11e6c6){if(_0x11e6c6){_0x372d3e=_0x11e6c6;_0x3f8662[_0xdbc5('0x31')]=_['keys'](db[_0xdbc5('0x4d')]['rawAttributes']);_0x3f8662['query']=_[_0xdbc5('0x33')](_0x4833b4[_0xdbc5('0x32')]);_0x3f8662[_0xdbc5('0x3b')]=_[_0xdbc5('0x35')](_0x3f8662['model'],_0x3f8662[_0xdbc5('0x32')]);_0x10f3d1[_0xdbc5('0x34')]=_['intersection'](_0x3f8662[_0xdbc5('0x31')],qs['fields'](_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x10f3d1[_0xdbc5('0x34')]=_0x10f3d1['attributes'][_0xdbc5('0x45')]?_0x10f3d1[_0xdbc5('0x34')]:_0x3f8662[_0xdbc5('0x31')];_0x10f3d1[_0xdbc5('0x39')]=qs['sort'](_0x4833b4['query'][_0xdbc5('0x3a')]);_0x10f3d1['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x4833b4['query'],_0x3f8662['filters']));if(_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x3e')]){_0x10f3d1[_0xdbc5('0x3c')]=_[_0xdbc5('0x46')](_0x10f3d1['where'],{'$or':_[_0xdbc5('0x2d')](_0x10f3d1['attributes'],function(_0x5dc9d7){var _0x3cfd98={};_0x3cfd98[_0x5dc9d7]={'$like':'%'+_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x3cfd98;})});}_0x10f3d1=_[_0xdbc5('0x46')]({},_0x10f3d1,_0x4833b4[_0xdbc5('0x3f')]);return _0x372d3e[_0xdbc5('0x4b')](_0x10f3d1);}})[_0xdbc5('0x28')](function(_0xd336a2){if(_0xd336a2){_0xd92241=_0xd336a2[_0xdbc5('0x45')];if(!_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x10f3d1[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x4833b4['query'][_0xdbc5('0x21')]);_0x10f3d1['offset']=qs['offset'](_0x4833b4['query'][_0xdbc5('0x1e')]);}return _0x372d3e['getFields'](_0x10f3d1);}})['then'](function(_0x53ce37){if(_0x53ce37){return _0x53ce37?{'count':_0xd92241,'rows':_0x53ce37}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x19691b,null))[_0xdbc5('0x44')](handleError(_0x19691b,null));};exports[_0xdbc5('0x4f')]=function(_0x5b7e61,_0x137f29,_0x574e2d){var _0x618b3={};var _0x30216f={};var _0x3e482f;var _0x26137c;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x5b7e61[_0xdbc5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137f29,null))['then'](function(_0x3fdd89){if(_0x3fdd89){_0x3e482f=_0x3fdd89;_0x30216f[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db[_0xdbc5('0x4d')][_0xdbc5('0x50')]);_0x30216f[_0xdbc5('0x32')]=_['keys'](_0x5b7e61['query']);_0x30216f[_0xdbc5('0x3b')]=_['intersection'](_0x30216f[_0xdbc5('0x31')],_0x30216f[_0xdbc5('0x32')]);_0x618b3[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x30216f[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x5b7e61[_0xdbc5('0x32')]['fields']));_0x618b3[_0xdbc5('0x34')]=_0x618b3[_0xdbc5('0x34')][_0xdbc5('0x45')]?_0x618b3[_0xdbc5('0x34')]:_0x30216f[_0xdbc5('0x31')];_0x618b3[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x618b3['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x5b7e61[_0xdbc5('0x32')],_0x30216f[_0xdbc5('0x3b')]));if(_0x5b7e61[_0xdbc5('0x32')]['filter']){_0x618b3[_0xdbc5('0x3c')]=_[_0xdbc5('0x46')](_0x618b3[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x618b3[_0xdbc5('0x34')],function(_0x5a5cc8){var _0x2589b3={};_0x2589b3[_0x5a5cc8]={'$like':'%'+_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x2589b3;})});}_0x618b3=_['merge']({},_0x618b3,_0x5b7e61[_0xdbc5('0x3f')]);return _0x3e482f['getSubjects'](_0x618b3);}})['then'](function(_0x19b2e9){if(_0x19b2e9){_0x26137c=_0x19b2e9[_0xdbc5('0x45')];if(!_0x5b7e61['query'][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x618b3[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x21')]);_0x618b3['offset']=qs[_0xdbc5('0x1e')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x3e482f[_0xdbc5('0x4f')](_0x618b3);}})[_0xdbc5('0x28')](function(_0x343518){if(_0x343518){return _0x343518?{'count':_0x26137c,'rows':_0x343518}:null;}})['then'](respondWithResult(_0x137f29,null))[_0xdbc5('0x44')](handleError(_0x137f29,null));};exports[_0xdbc5('0x51')]=function(_0x179602,_0x15eb10,_0x14f285){var _0xe32f9b={};var _0x8741ff={};var _0x23ec27;var _0x4a13ab;return db['FreshdeskConfiguration'][_0xdbc5('0x4c')]({'where':{'id':_0x179602[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x15eb10,null))[_0xdbc5('0x28')](function(_0x45fce5){if(_0x45fce5){_0x23ec27=_0x45fce5;_0x8741ff[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db[_0xdbc5('0x4d')][_0xdbc5('0x50')]);_0x8741ff[_0xdbc5('0x32')]=_['keys'](_0x179602['query']);_0x8741ff['filters']=_[_0xdbc5('0x35')](_0x8741ff['model'],_0x8741ff['query']);_0xe32f9b['attributes']=_[_0xdbc5('0x35')](_0x8741ff[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0xe32f9b[_0xdbc5('0x34')]=_0xe32f9b['attributes'][_0xdbc5('0x45')]?_0xe32f9b['attributes']:_0x8741ff['model'];_0xe32f9b[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0xe32f9b[_0xdbc5('0x3c')]=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x179602[_0xdbc5('0x32')],_0x8741ff['filters']));if(_0x179602[_0xdbc5('0x32')][_0xdbc5('0x3e')]){_0xe32f9b['where']=_[_0xdbc5('0x46')](_0xe32f9b[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0xe32f9b[_0xdbc5('0x34')],function(_0x311bed){var _0x5abcf8={};_0x5abcf8[_0x311bed]={'$like':'%'+_0x179602['query'][_0xdbc5('0x3e')]+'%'};return _0x5abcf8;})});}_0xe32f9b=_[_0xdbc5('0x46')]({},_0xe32f9b,_0x179602[_0xdbc5('0x3f')]);return _0x23ec27[_0xdbc5('0x51')](_0xe32f9b);}})[_0xdbc5('0x28')](function(_0xd2ca6a){if(_0xd2ca6a){_0x4a13ab=_0xd2ca6a[_0xdbc5('0x45')];if(!_0x179602[_0xdbc5('0x32')][_0xdbc5('0x37')]('nolimit')){_0xe32f9b[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x179602['query'][_0xdbc5('0x21')]);_0xe32f9b['offset']=qs[_0xdbc5('0x1e')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x23ec27[_0xdbc5('0x51')](_0xe32f9b);}})[_0xdbc5('0x28')](function(_0x38b504){if(_0x38b504){return _0x38b504?{'count':_0x4a13ab,'rows':_0x38b504}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x15eb10,null))[_0xdbc5('0x44')](handleError(_0x15eb10,null));};exports['getTags']=function(_0x287ff7,_0x883bd9,_0x4b029a){var _0x136a67={};var _0x2e9144={};var _0x1aa204;var _0xa61ef3;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x287ff7[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x883bd9,null))[_0xdbc5('0x28')](function(_0x32e2dd){if(_0x32e2dd){_0x1aa204=_0x32e2dd;_0x2e9144['model']=_['keys'](db['Tag'][_0xdbc5('0x50')]);_0x2e9144[_0xdbc5('0x32')]=_[_0xdbc5('0x33')](_0x287ff7[_0xdbc5('0x32')]);_0x2e9144[_0xdbc5('0x3b')]=_[_0xdbc5('0x35')](_0x2e9144[_0xdbc5('0x31')],_0x2e9144[_0xdbc5('0x32')]);_0x136a67[_0xdbc5('0x34')]=_['intersection'](_0x2e9144[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x136a67[_0xdbc5('0x34')]=_0x136a67['attributes'][_0xdbc5('0x45')]?_0x136a67['attributes']:_0x2e9144[_0xdbc5('0x31')];_0x136a67[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x136a67['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x287ff7[_0xdbc5('0x32')],_0x2e9144[_0xdbc5('0x3b')]));if(_0x287ff7['query'][_0xdbc5('0x3e')]){_0x136a67['where']=_['merge'](_0x136a67[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x136a67['attributes'],function(_0x174b82){var _0x5cba36={};_0x5cba36[_0x174b82]={'$like':'%'+_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x5cba36;})});}_0x136a67=_[_0xdbc5('0x46')]({},_0x136a67,_0x287ff7[_0xdbc5('0x3f')]);return _0x1aa204[_0xdbc5('0x52')](_0x136a67);}})['then'](function(_0x98ea06){if(_0x98ea06){_0xa61ef3=_0x98ea06['length'];if(!_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x136a67[_0xdbc5('0x21')]=qs['limit'](_0x287ff7['query'][_0xdbc5('0x21')]);_0x136a67['offset']=qs['offset'](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x1aa204['getTags'](_0x136a67);}})['then'](function(_0x4d9aa8){if(_0x4d9aa8){return _0x4d9aa8?{'count':_0xa61ef3,'rows':_0x4d9aa8}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x883bd9,null))[_0xdbc5('0x44')](handleError(_0x883bd9,null));};exports[_0xdbc5('0x53')]=function(_0x4b734a,_0x3a52af,_0x1acfb4){if(_0x4b734a[_0xdbc5('0x49')]['id']){delete _0x4b734a[_0xdbc5('0x49')]['id'];}return db[_0xdbc5('0x2e')]['findOne']({'where':{'id':_0x4b734a['params']['id']}})['then'](handleEntityNotFound(_0x3a52af,null))['then'](function(_0x111fb0){if(_0x111fb0){return _0x111fb0['setTags'](_0x4b734a[_0xdbc5('0x49')]['ids']||[]);}return null;})[_0xdbc5('0x28')](respondWithResult(_0x3a52af,null))[_0xdbc5('0x44')](handleError(_0x3a52af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3b591eb..98b1f84 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 _0xf03f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x33673f,_0x1a9f86){var _0x172f00=function(_0x942fb5){while(--_0x942fb5){_0x33673f['push'](_0x33673f['shift']());}};_0x172f00(++_0x1a9f86);}(_0xf03f,0x104));var _0xff03=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xf03f[_0x9b7a64];return _0x33fd98;};'use strict';var _=require(_0xff03('0x0'));var util=require(_0xff03('0x1'));var logger=require(_0xff03('0x2'))(_0xff03('0x3'));var moment=require(_0xff03('0x4'));var BPromise=require(_0xff03('0x5'));var rp=require(_0xff03('0x6'));var fs=require('fs');var path=require(_0xff03('0x7'));var rimraf=require(_0xff03('0x8'));var config=require(_0xff03('0x9'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xff03('0xa')]=function(_0x27e16d,_0x3810c5){return _0x27e16d['define'](_0xff03('0xb'),attributes,{'tableName':_0xff03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c1d=['api','bluebird','request-promise','path','../../config/environment','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x1c1d,0x13d));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var util=require(_0xd1c1('0x1'));var logger=require(_0xd1c1('0x2'))(_0xd1c1('0x3'));var moment=require('moment');var BPromise=require(_0xd1c1('0x4'));var rp=require(_0xd1c1('0x5'));var fs=require('fs');var path=require(_0xd1c1('0x6'));var rimraf=require('rimraf');var config=require(_0xd1c1('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4d5e32,_0x56b0b0){return _0x4d5e32[_0xd1c1('0x8')](_0xd1c1('0x9'),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 9c47b6a..ba7fb20 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 _0xe0fa=['result','catch','lodash','randomstring','../../config/logger','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x56d7b2,_0x2ca43e){var _0x4a114c=function(_0x5080bb){while(--_0x5080bb){_0x56d7b2['push'](_0x56d7b2['shift']());}};_0x4a114c(++_0x2ca43e);}(_0xe0fa,0x18e));var _0xae0f=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xe0fa[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xae0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae0f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae0f('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae0f('0x3'));var client=jayson['client'][_0xae0f('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x291dd1,_0xb07dfc,_0x5b1e5d){return new BPromise(function(_0x2ceeb7,_0x4db3bf){return client[_0xae0f('0x5')](_0x291dd1,_0x5b1e5d)[_0xae0f('0x6')](function(_0x15d519){logger['info'](_0xae0f('0x7'),_0xb07dfc,'request\x20sent');logger[_0xae0f('0x8')](_0xae0f('0x9'),_0xb07dfc,'request\x20sent',JSON[_0xae0f('0xa')](_0x15d519));if(_0x15d519[_0xae0f('0xb')]){if(_0x15d519[_0xae0f('0xb')][_0xae0f('0xc')]===0x1f4){logger['error'](_0xae0f('0x7'),_0xb07dfc,_0x15d519['error'][_0xae0f('0xd')]);return _0x4db3bf(_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xb07dfc,_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);return _0x2ceeb7(_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);}else{logger[_0xae0f('0xe')](_0xae0f('0x7'),_0xb07dfc,_0xae0f('0xf'));_0x2ceeb7(_0x15d519[_0xae0f('0x10')][_0xae0f('0xd')]);}})[_0xae0f('0x11')](function(_0x551103){logger[_0xae0f('0xb')](_0xae0f('0x7'),_0xb07dfc,_0x551103);_0x4db3bf(_0x551103);});});} \ No newline at end of file +var _0x857f=['error','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','message'];(function(_0xada87a,_0x16223c){var _0x7ad44c=function(_0x341535){while(--_0x341535){_0xada87a['push'](_0xada87a['shift']());}};_0x7ad44c(++_0x16223c);}(_0x857f,0xad));var _0xf857=function(_0xf7ee71,_0x786ff4){_0xf7ee71=_0xf7ee71-0x0;var _0x2341d3=_0x857f[_0xf7ee71];return _0x2341d3;};'use strict';var _=require(_0xf857('0x0'));var util=require(_0xf857('0x1'));var moment=require(_0xf857('0x2'));var BPromise=require(_0xf857('0x3'));var rs=require(_0xf857('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf857('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf857('0x6'))(_0xf857('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf857('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e1ce1,_0x5d5498,_0x341092){return new BPromise(function(_0x5602fb,_0x46fe97){return client[_0xf857('0x9')](_0x4e1ce1,_0x341092)[_0xf857('0xa')](function(_0x2c754c){logger[_0xf857('0xb')](_0xf857('0xc'),_0x5d5498,_0xf857('0xd'));logger[_0xf857('0xe')](_0xf857('0xf'),_0x5d5498,_0xf857('0xd'),JSON['stringify'](_0x2c754c));if(_0x2c754c['error']){if(_0x2c754c['error']['code']===0x1f4){logger['error'](_0xf857('0xc'),_0x5d5498,_0x2c754c['error'][_0xf857('0x10')]);return _0x46fe97(_0x2c754c[_0xf857('0x11')][_0xf857('0x10')]);}logger[_0xf857('0x11')](_0xf857('0xc'),_0x5d5498,_0x2c754c[_0xf857('0x11')]['message']);return _0x5602fb(_0x2c754c[_0xf857('0x11')][_0xf857('0x10')]);}else{logger[_0xf857('0xb')](_0xf857('0xc'),_0x5d5498,_0xf857('0xd'));_0x5602fb(_0x2c754c['result'][_0xf857('0x10')]);}})[_0xf857('0x12')](function(_0xfd003e){logger[_0xf857('0x11')](_0xf857('0xc'),_0x5d5498,_0xfd003e);_0x46fe97(_0xfd003e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f40abd2..796608f 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 _0x958a=['get','isAuthenticated','/:id','show','create','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x958a,0x138));var _0xa958=function(_0x5870af,_0x1b8655){_0x5870af=_0x5870af-0x0;var _0xe14a42=_0x958a[_0x5870af];return _0xe14a42;};'use strict';var multer=require('multer');var util=require(_0xa958('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa958('0x1'));var router=express[_0xa958('0x2')]();var fs_extra=require(_0xa958('0x3'));var auth=require(_0xa958('0x4'));var interaction=require(_0xa958('0x5'));var config=require(_0xa958('0x6'));var controller=require(_0xa958('0x7'));router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller['index']);router[_0xa958('0x8')](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa958('0xc')]);router['put'](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router['delete'](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xe')]);module[_0xa958('0xf')]=router; \ No newline at end of file +var _0xf744=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','/:id','show','post','create','put'];(function(_0x49192,_0x2fc6fb){var _0x57d8e8=function(_0xc4ed8d){while(--_0xc4ed8d){_0x49192['push'](_0x49192['shift']());}};_0x57d8e8(++_0x2fc6fb);}(_0xf744,0x1a5));var _0x4f74=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf744[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x4f74('0x0'));var util=require(_0x4f74('0x1'));var path=require(_0x4f74('0x2'));var timeout=require(_0x4f74('0x3'));var express=require(_0x4f74('0x4'));var router=express['Router']();var fs_extra=require(_0x4f74('0x5'));var auth=require(_0x4f74('0x6'));var interaction=require(_0x4f74('0x7'));var config=require(_0x4f74('0x8'));var controller=require(_0x4f74('0x9'));router['get']('/',auth[_0x4f74('0xa')](),controller['index']);router['get'](_0x4f74('0xb'),auth['isAuthenticated'](),controller[_0x4f74('0xc')]);router[_0x4f74('0xd')]('/',auth[_0x4f74('0xa')](),controller[_0x4f74('0xe')]);router[_0x4f74('0xf')](_0x4f74('0xb'),auth['isAuthenticated'](),controller[_0x4f74('0x10')]);router[_0x4f74('0x11')]('/:id',auth[_0x4f74('0xa')](),controller[_0x4f74('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6b61a0d..d946e63 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 _0x37de=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x5a2340,_0x3b7fad){var _0x1c5331=function(_0x3972db){while(--_0x3972db){_0x5a2340['push'](_0x5a2340['shift']());}};_0x1c5331(++_0x3b7fad);}(_0x37de,0x144));var _0xe37d=function(_0x20048c,_0x337690){_0x20048c=_0x20048c-0x0;var _0x1d7f4b=_0x37de[_0x20048c];return _0x1d7f4b;};'use strict';var Sequelize=require(_0xe37d('0x0'));module[_0xe37d('0x1')]={'type':{'type':Sequelize[_0xe37d('0x2')](_0xe37d('0x3'),_0xe37d('0x4'),_0xe37d('0x5'),'keyValue',_0xe37d('0x6')),'defaultValue':_0xe37d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe37d('0x7')]},'keyType':{'type':Sequelize[_0xe37d('0x2')]('string',_0xe37d('0x4'),_0xe37d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe37d('0x7')]},'nameField':{'type':Sequelize[_0xe37d('0x7')]},'customField':{'type':Sequelize[_0xe37d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf277=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xb3cc02,_0x21f195){var _0x1fe499=function(_0x2891f4){while(--_0x2891f4){_0xb3cc02['push'](_0xb3cc02['shift']());}};_0x1fe499(++_0x21f195);}(_0xf277,0xe9));var _0x7f27=function(_0x4c094e,_0x5c790f){_0x4c094e=_0x4c094e-0x0;var _0x13a283=_0xf277[_0x4c094e];return _0x13a283;};'use strict';var Sequelize=require(_0x7f27('0x0'));module[_0x7f27('0x1')]={'type':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x3'),_0x7f27('0x4'),_0x7f27('0x5'),_0x7f27('0x6'),_0x7f27('0x7')),'defaultValue':_0x7f27('0x3')},'content':{'type':Sequelize[_0x7f27('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x3'),_0x7f27('0x4'),_0x7f27('0x5'))},'keyContent':{'type':Sequelize[_0x7f27('0x8')]},'idField':{'type':Sequelize[_0x7f27('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7f27('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f27('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 46f2602..cc3bca7 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 _0x1306=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x1306,0x17a));var _0x6130=function(_0x1d1c3a,_0x257980){_0x1d1c3a=_0x1d1c3a-0x0;var _0x352825=_0x1306[_0x1d1c3a];return _0x352825;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var moment=require(_0x6130('0x5'));var BPromise=require(_0x6130('0x6'));var Mustache=require(_0x6130('0x7'));var util=require(_0x6130('0x8'));var path=require(_0x6130('0x9'));var sox=require(_0x6130('0xa'));var csv=require(_0x6130('0xb'));var ejs=require(_0x6130('0xc'));var fs=require('fs');var fs_extra=require(_0x6130('0xd'));var _=require(_0x6130('0xe'));var squel=require(_0x6130('0xf'));var crypto=require(_0x6130('0x10'));var jsforce=require(_0x6130('0x11'));var deskjs=require(_0x6130('0x12'));var toCsv=require(_0x6130('0xb'));var querystring=require(_0x6130('0x13'));var Papa=require(_0x6130('0x14'));var Redis=require(_0x6130('0x15'));var authService=require(_0x6130('0x16'));var qs=require(_0x6130('0x17'));var as=require(_0x6130('0x18'));var hardwareService=require(_0x6130('0x19'));var logger=require(_0x6130('0x1a'))(_0x6130('0x1b'));var utils=require('../../config/utils');var config=require(_0x6130('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x6130('0x1d'))['db'];function respondWithStatusCode(_0x2fbf3d,_0x5e0234){_0x5e0234=_0x5e0234||0xcc;return function(_0x1c0339){if(_0x1c0339){return _0x2fbf3d[_0x6130('0x1e')](_0x5e0234);}return _0x2fbf3d[_0x6130('0x1f')](_0x5e0234)[_0x6130('0x20')]();};}function respondWithResult(_0x1d736c,_0x3470e8){_0x3470e8=_0x3470e8||0xc8;return function(_0x4cdac6){if(_0x4cdac6){return _0x1d736c[_0x6130('0x1f')](_0x3470e8)[_0x6130('0x21')](_0x4cdac6);}};}function respondWithFilteredResult(_0x3ef4c1,_0x401a70){return function(_0x4626a2){if(_0x4626a2){var _0x39b444=typeof _0x401a70[_0x6130('0x22')]===_0x6130('0x23')&&typeof _0x401a70[_0x6130('0x24')]==='undefined';var _0x4b9a20=_0x4626a2[_0x6130('0x25')];var _0x49803e=_0x39b444?0x0:_0x401a70[_0x6130('0x22')];var _0xb6575d=_0x39b444?_0x4626a2[_0x6130('0x25')]:_0x401a70[_0x6130('0x22')]+_0x401a70[_0x6130('0x24')];var _0x4b4b35;if(_0xb6575d>=_0x4b9a20){_0xb6575d=_0x4b9a20;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x3ef4c1[_0x6130('0x1f')](_0x4b4b35);return _0x3ef4c1['set'](_0x6130('0x26'),_0x49803e+'-'+_0xb6575d+'/'+_0x4b9a20)[_0x6130('0x21')](_0x4626a2);}return null;};}function patchUpdates(_0x18bb78){return function(_0x1839db){try{jsonpatch[_0x6130('0x27')](_0x1839db,_0x18bb78,!![]);}catch(_0x5c8b08){return BPromise['reject'](_0x5c8b08);}return _0x1839db[_0x6130('0x28')]();};}function saveUpdates(_0x534390,_0x30b4f2){return function(_0x289c7b){if(_0x289c7b){return _0x289c7b['update'](_0x534390)['then'](function(_0x54fc67){return _0x54fc67;});}return null;};}function removeEntity(_0x2a8aad,_0x5369e3){return function(_0x371b84){if(_0x371b84){return _0x371b84['destroy']()['then'](function(){_0x2a8aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5069bf,_0x140468){return function(_0x1ba07d){if(!_0x1ba07d){_0x5069bf['sendStatus'](0x194);}return _0x1ba07d;};}function handleError(_0x188657,_0x552c54){_0x552c54=_0x552c54||0x1f4;return function(_0x306935){logger['error'](_0x306935['stack']);if(_0x306935[_0x6130('0x29')]){delete _0x306935[_0x6130('0x29')];}_0x188657[_0x6130('0x1f')](_0x552c54)[_0x6130('0x2a')](_0x306935);};}exports[_0x6130('0x2b')]=function(_0x392386,_0x2aa0e3){var _0x19eb47={},_0x14dff0={},_0x5809e4={'count':0x0,'rows':[]};var _0x5363cc=_[_0x6130('0x2c')](db[_0x6130('0x2d')][_0x6130('0x2e')],function(_0x4345ac){return{'name':_0x4345ac[_0x6130('0x2f')],'type':_0x4345ac['type'][_0x6130('0x30')]};});_0x14dff0[_0x6130('0x31')]=_[_0x6130('0x2c')](_0x5363cc,_0x6130('0x29'));_0x14dff0[_0x6130('0x32')]=_['keys'](_0x392386[_0x6130('0x32')]);_0x14dff0[_0x6130('0x33')]=_[_0x6130('0x34')](_0x14dff0['model'],_0x14dff0[_0x6130('0x32')]);_0x19eb47[_0x6130('0x35')]=_[_0x6130('0x34')](_0x14dff0[_0x6130('0x31')],qs[_0x6130('0x36')](_0x392386[_0x6130('0x32')][_0x6130('0x36')]));_0x19eb47[_0x6130('0x35')]=_0x19eb47[_0x6130('0x35')]['length']?_0x19eb47[_0x6130('0x35')]:_0x14dff0['model'];if(!_0x392386['query']['hasOwnProperty'](_0x6130('0x37'))){_0x19eb47[_0x6130('0x24')]=qs[_0x6130('0x24')](_0x392386[_0x6130('0x32')][_0x6130('0x24')]);_0x19eb47[_0x6130('0x22')]=qs[_0x6130('0x22')](_0x392386[_0x6130('0x32')]['offset']);}_0x19eb47[_0x6130('0x38')]=qs[_0x6130('0x39')](_0x392386['query'][_0x6130('0x39')]);_0x19eb47[_0x6130('0x3a')]=qs[_0x6130('0x33')](_['pick'](_0x392386[_0x6130('0x32')],_0x14dff0[_0x6130('0x33')]),_0x5363cc);if(_0x392386['query']['filter']){_0x19eb47[_0x6130('0x3a')]=_[_0x6130('0x3b')](_0x19eb47[_0x6130('0x3a')],{'$or':_['map'](_0x5363cc,function(_0x596c98){if(_0x596c98[_0x6130('0x3c')]!==_0x6130('0x3d')){var _0x3c6aac={};_0x3c6aac[_0x596c98[_0x6130('0x29')]]={'$like':'%'+_0x392386[_0x6130('0x32')][_0x6130('0x3e')]+'%'};return _0x3c6aac;}})});}_0x19eb47=_[_0x6130('0x3b')]({},_0x19eb47,_0x392386['options']);var _0x45bfe0={'where':_0x19eb47[_0x6130('0x3a')]};return db[_0x6130('0x2d')][_0x6130('0x25')](_0x45bfe0)[_0x6130('0x3f')](function(_0x3249f2){_0x5809e4[_0x6130('0x25')]=_0x3249f2;if(_0x392386['query'][_0x6130('0x40')]){_0x19eb47[_0x6130('0x41')]=[{'all':!![]}];}return db[_0x6130('0x2d')][_0x6130('0x42')](_0x19eb47);})[_0x6130('0x3f')](function(_0x142385){_0x5809e4[_0x6130('0x43')]=_0x142385;return _0x5809e4;})[_0x6130('0x3f')](respondWithFilteredResult(_0x2aa0e3,_0x19eb47))['catch'](handleError(_0x2aa0e3,null));};exports[_0x6130('0x44')]=function(_0x154891,_0x6eebc6){var _0x4c727b={'raw':!![],'where':{'id':_0x154891[_0x6130('0x45')]['id']}},_0x176506={};_0x176506[_0x6130('0x31')]=_['keys'](db['FreshdeskField'][_0x6130('0x2e')]);_0x176506[_0x6130('0x32')]=_[_0x6130('0x46')](_0x154891[_0x6130('0x32')]);_0x176506[_0x6130('0x33')]=_['intersection'](_0x176506[_0x6130('0x31')],_0x176506[_0x6130('0x32')]);_0x4c727b['attributes']=_[_0x6130('0x34')](_0x176506[_0x6130('0x31')],qs[_0x6130('0x36')](_0x154891[_0x6130('0x32')][_0x6130('0x36')]));_0x4c727b[_0x6130('0x35')]=_0x4c727b[_0x6130('0x35')][_0x6130('0x47')]?_0x4c727b['attributes']:_0x176506['model'];if(_0x154891[_0x6130('0x32')]['includeAll']){_0x4c727b[_0x6130('0x41')]=[{'all':!![]}];}_0x4c727b=_[_0x6130('0x3b')]({},_0x4c727b,_0x154891[_0x6130('0x48')]);return db[_0x6130('0x2d')][_0x6130('0x49')](_0x4c727b)[_0x6130('0x3f')](handleEntityNotFound(_0x6eebc6,null))[_0x6130('0x3f')](respondWithResult(_0x6eebc6,null))[_0x6130('0x4a')](handleError(_0x6eebc6,null));};exports[_0x6130('0x4b')]=function(_0x19dcb7,_0x3936a8){return db['FreshdeskField'][_0x6130('0x4b')](_0x19dcb7[_0x6130('0x4c')],{})[_0x6130('0x3f')](respondWithResult(_0x3936a8,0xc9))[_0x6130('0x4a')](handleError(_0x3936a8,null));};exports[_0x6130('0x4d')]=function(_0x13f591,_0x35939b){if(_0x13f591[_0x6130('0x4c')]['id']){delete _0x13f591[_0x6130('0x4c')]['id'];}return db[_0x6130('0x2d')]['find']({'where':{'id':_0x13f591[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x35939b,null))[_0x6130('0x3f')](saveUpdates(_0x13f591[_0x6130('0x4c')],null))[_0x6130('0x3f')](respondWithResult(_0x35939b,null))[_0x6130('0x4a')](handleError(_0x35939b,null));};exports[_0x6130('0x4e')]=function(_0x37ee0c,_0x3a64ef){return db['FreshdeskField'][_0x6130('0x49')]({'where':{'id':_0x37ee0c[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x3a64ef,null))[_0x6130('0x3f')](removeEntity(_0x3a64ef,null))[_0x6130('0x4a')](handleError(_0x3a64ef,null));}; \ No newline at end of file +var _0x7d98=['pick','filter','merge','where','include','FreshdeskField','findAll','rows','show','rawAttributes','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7d98,0xe7));var _0x87d9=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x7d98[_0x39cf70];return _0x580424;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['index']=function(_0x21916a,_0x3c0283){var _0x501c5={},_0x5e1b55={},_0x1d04a9={'count':0x0,'rows':[]};var _0x22a401=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x31122b){return{'name':_0x31122b[_0x87d9('0x2a')],'type':_0x31122b['type'][_0x87d9('0x2b')]};});_0x5e1b55['model']=_[_0x87d9('0x2c')](_0x22a401,'name');_0x5e1b55[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2f')]=_['intersection'](_0x5e1b55[_0x87d9('0x30')],_0x5e1b55[_0x87d9('0x2d')]);_0x501c5[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x5e1b55[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x21916a['query'][_0x87d9('0x33')]));_0x501c5[_0x87d9('0x31')]=_0x501c5[_0x87d9('0x31')][_0x87d9('0x34')]?_0x501c5[_0x87d9('0x31')]:_0x5e1b55[_0x87d9('0x30')];if(!_0x21916a[_0x87d9('0x2d')][_0x87d9('0x35')](_0x87d9('0x36'))){_0x501c5['limit']=qs[_0x87d9('0x1d')](_0x21916a[_0x87d9('0x2d')][_0x87d9('0x1d')]);_0x501c5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x21916a['query'][_0x87d9('0x1f')]);}_0x501c5[_0x87d9('0x37')]=qs[_0x87d9('0x38')](_0x21916a['query'][_0x87d9('0x38')]);_0x501c5['where']=qs[_0x87d9('0x2f')](_[_0x87d9('0x39')](_0x21916a[_0x87d9('0x2d')],_0x5e1b55[_0x87d9('0x2f')]),_0x22a401);if(_0x21916a['query'][_0x87d9('0x3a')]){_0x501c5['where']=_[_0x87d9('0x3b')](_0x501c5[_0x87d9('0x3c')],{'$or':_[_0x87d9('0x2c')](_0x22a401,function(_0x1af8eb){if(_0x1af8eb['type']!=='VIRTUAL'){var _0x2063de={};_0x2063de[_0x1af8eb['name']]={'$like':'%'+_0x21916a[_0x87d9('0x2d')]['filter']+'%'};return _0x2063de;}})});}_0x501c5=_[_0x87d9('0x3b')]({},_0x501c5,_0x21916a['options']);var _0xdf56e8={'where':_0x501c5[_0x87d9('0x3c')]};return db['FreshdeskField'][_0x87d9('0x1e')](_0xdf56e8)['then'](function(_0x4bc1ba){_0x1d04a9['count']=_0x4bc1ba;if(_0x21916a[_0x87d9('0x2d')]['includeAll']){_0x501c5[_0x87d9('0x3d')]=[{'all':!![]}];}return db[_0x87d9('0x3e')][_0x87d9('0x3f')](_0x501c5);})['then'](function(_0x915f05){_0x1d04a9[_0x87d9('0x40')]=_0x915f05;return _0x1d04a9;})[_0x87d9('0x25')](respondWithFilteredResult(_0x3c0283,_0x501c5))['catch'](handleError(_0x3c0283,null));};exports[_0x87d9('0x41')]=function(_0x58ec85,_0x5c2db5){var _0x59338e={'raw':!![],'where':{'id':_0x58ec85['params']['id']}},_0x39e807={};_0x39e807['model']=_[_0x87d9('0x2e')](db[_0x87d9('0x3e')][_0x87d9('0x42')]);_0x39e807[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x58ec85['query']);_0x39e807[_0x87d9('0x2f')]=_[_0x87d9('0x32')](_0x39e807['model'],_0x39e807['query']);_0x59338e[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x39e807[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x58ec85[_0x87d9('0x2d')][_0x87d9('0x33')]));_0x59338e[_0x87d9('0x31')]=_0x59338e[_0x87d9('0x31')]['length']?_0x59338e[_0x87d9('0x31')]:_0x39e807[_0x87d9('0x30')];if(_0x58ec85['query']['includeAll']){_0x59338e[_0x87d9('0x3d')]=[{'all':!![]}];}_0x59338e=_[_0x87d9('0x3b')]({},_0x59338e,_0x58ec85['options']);return db[_0x87d9('0x3e')]['find'](_0x59338e)['then'](handleEntityNotFound(_0x5c2db5,null))['then'](respondWithResult(_0x5c2db5,null))['catch'](handleError(_0x5c2db5,null));};exports[_0x87d9('0x43')]=function(_0x101446,_0x533a74){return db[_0x87d9('0x3e')][_0x87d9('0x43')](_0x101446[_0x87d9('0x44')],{})['then'](respondWithResult(_0x533a74,0xc9))[_0x87d9('0x45')](handleError(_0x533a74,null));};exports[_0x87d9('0x24')]=function(_0x2d4766,_0x384273){if(_0x2d4766[_0x87d9('0x44')]['id']){delete _0x2d4766[_0x87d9('0x44')]['id'];}return db['FreshdeskField'][_0x87d9('0x46')]({'where':{'id':_0x2d4766['params']['id']}})['then'](handleEntityNotFound(_0x384273,null))[_0x87d9('0x25')](saveUpdates(_0x2d4766[_0x87d9('0x44')],null))[_0x87d9('0x25')](respondWithResult(_0x384273,null))[_0x87d9('0x45')](handleError(_0x384273,null));};exports[_0x87d9('0x26')]=function(_0x4fdfa9,_0x4558f5){return db[_0x87d9('0x3e')][_0x87d9('0x46')]({'where':{'id':_0x4fdfa9[_0x87d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4558f5,null))[_0x87d9('0x25')](removeEntity(_0x4558f5,null))[_0x87d9('0x45')](handleError(_0x4558f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3d3194d..0392774 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 _0xa58e=['util','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0xa58e,0x1d3));var _0xea58=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa58e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xea58('0x0'));var util=require(_0xea58('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea58('0x2'));var fs=require('fs');var path=require(_0xea58('0x3'));var rimraf=require(_0xea58('0x4'));var config=require(_0xea58('0x5'));var attributes=require(_0xea58('0x6'));module['exports']=function(_0x34d83f,_0x56968f){return _0x34d83f[_0xea58('0x7')]('FreshdeskField',attributes,{'tableName':_0xea58('0x8'),'paranoid':![],'indexes':[{'name':_0xea58('0x9'),'fields':[_0xea58('0xa'),_0xea58('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b5=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x483c8a,_0x56dfed){var _0x305cb2=function(_0x350147){while(--_0x350147){_0x483c8a['push'](_0x483c8a['shift']());}};_0x305cb2(++_0x56dfed);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x14835f,_0x2fb8ce){_0x14835f=_0x14835f-0x0;var _0x1958ce=_0xd0b5[_0x14835f];return _0x1958ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var moment=require('moment');var BPromise=require(_0x5d0b('0x2'));var rp=require(_0x5d0b('0x3'));var fs=require('fs');var path=require(_0x5d0b('0x4'));var rimraf=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var attributes=require(_0x5d0b('0x7'));module[_0x5d0b('0x8')]=function(_0x41b7c1,_0xd514d0){return _0x41b7c1[_0x5d0b('0x9')](_0x5d0b('0xa'),attributes,{'tableName':_0x5d0b('0xb'),'paranoid':![],'indexes':[{'name':_0x5d0b('0xc'),'fields':['idField',_0x5d0b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 695a8a6..ac1e65a 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 _0xbf06=['../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x159cb0,_0x4c9113){var _0x250c11=function(_0x25e1ea){while(--_0x25e1ea){_0x159cb0['push'](_0x159cb0['shift']());}};_0x250c11(++_0x4c9113);}(_0xbf06,0x101));var _0x6bf0=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xbf06[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0x6bf0('0x0'));var moment=require(_0x6bf0('0x1'));var BPromise=require(_0x6bf0('0x2'));var rs=require(_0x6bf0('0x3'));var fs=require('fs');var Redis=require(_0x6bf0('0x4'));var db=require(_0x6bf0('0x5'))['db'];var utils=require(_0x6bf0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6bf0('0x7'));var jayson=require(_0x6bf0('0x8'));var client=jayson[_0x6bf0('0x9')][_0x6bf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc26f,_0x77d107,_0x29f59d){return new BPromise(function(_0x1db2a7,_0xfa0ba8){return client[_0x6bf0('0xb')](_0x4fc26f,_0x29f59d)['then'](function(_0x3a3e12){logger[_0x6bf0('0xc')](_0x6bf0('0xd'),_0x77d107,_0x6bf0('0xe'));logger[_0x6bf0('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x77d107,'request\x20sent',JSON[_0x6bf0('0x10')](_0x3a3e12));if(_0x3a3e12[_0x6bf0('0x11')]){if(_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x12')]===0x1f4){logger[_0x6bf0('0x11')](_0x6bf0('0xd'),_0x77d107,_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x13')]);return _0xfa0ba8(_0x3a3e12[_0x6bf0('0x11')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x77d107,_0x3a3e12['error'][_0x6bf0('0x13')]);return _0x1db2a7(_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x13')]);}else{logger[_0x6bf0('0xc')](_0x6bf0('0xd'),_0x77d107,_0x6bf0('0xe'));_0x1db2a7(_0x3a3e12[_0x6bf0('0x14')]['message']);}})[_0x6bf0('0x15')](function(_0x3e0b2b){logger[_0x6bf0('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x77d107,_0x3e0b2b);_0xfa0ba8(_0x3e0b2b);});});} \ No newline at end of file +var _0x6333=['FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4f803c,_0x42ca79){var _0x2227f3=function(_0x1a580b){while(--_0x1a580b){_0x4f803c['push'](_0x4f803c['shift']());}};_0x2227f3(++_0x42ca79);}(_0x6333,0x159));var _0x3633=function(_0x4e38a3,_0x33419d){_0x4e38a3=_0x4e38a3-0x0;var _0x5ba931=_0x6333[_0x4e38a3];return _0x5ba931;};'use strict';var _=require(_0x3633('0x0'));var util=require(_0x3633('0x1'));var moment=require(_0x3633('0x2'));var BPromise=require(_0x3633('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3633('0x4'));var db=require(_0x3633('0x5'))['db'];var utils=require(_0x3633('0x6'));var logger=require(_0x3633('0x7'))(_0x3633('0x8'));var config=require(_0x3633('0x9'));var jayson=require(_0x3633('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34c4fc,_0xbd74db,_0x536895){return new BPromise(function(_0x66477e,_0x828361){return client['request'](_0x34c4fc,_0x536895)[_0x3633('0xb')](function(_0x12d461){logger['info'](_0x3633('0xc'),_0xbd74db,_0x3633('0xd'));logger['debug'](_0x3633('0xe'),_0xbd74db,_0x3633('0xd'),JSON[_0x3633('0xf')](_0x12d461));if(_0x12d461['error']){if(_0x12d461[_0x3633('0x10')][_0x3633('0x11')]===0x1f4){logger['error'](_0x3633('0xc'),_0xbd74db,_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);return _0x828361(_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);}logger[_0x3633('0x10')](_0x3633('0xc'),_0xbd74db,_0x12d461[_0x3633('0x10')]['message']);return _0x66477e(_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);}else{logger[_0x3633('0x13')](_0x3633('0xc'),_0xbd74db,_0x3633('0xd'));_0x66477e(_0x12d461['result'][_0x3633('0x12')]);}})[_0x3633('0x14')](function(_0x2cc77d){logger[_0x3633('0x10')]('FreshdeskField,\x20%s,\x20%s',_0xbd74db,_0x2cc77d);_0x828361(_0x2cc77d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 25cc92a..dd291d2 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 _0x9348=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x9348,0x10d));var _0x8934=function(_0x5d60a8,_0x5db4ad){_0x5d60a8=_0x5d60a8-0x0;var _0x32cc7a=_0x9348[_0x5d60a8];return _0x32cc7a;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0xf')](_0x8934('0x11'),auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['put'](_0x8934('0x13'),auth[_0x8934('0xa')](),controller[_0x8934('0x14')]);router[_0x8934('0x15')](_0x8934('0x13'),auth[_0x8934('0xa')](),controller['destroy']);module[_0x8934('0x16')]=router; \ No newline at end of file +var _0xb9a7=['addConfiguration','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x35f1bd,_0x405be7){var _0x27e215=function(_0x2a6201){while(--_0x2a6201){_0x35f1bd['push'](_0x35f1bd['shift']());}};_0x27e215(++_0x405be7);}(_0xb9a7,0x112));var _0x7b9a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb9a7[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['show']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['getFields']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b9a('0xd')]);router['post'](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0xe')]);router['put'](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xf')](_0x7b9a('0x9'),auth['isAuthenticated'](),controller[_0x7b9a('0x10')]);module[_0x7b9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e5eb447..5ae64b2 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 _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x1399,0x16c));var _0x9139=function(_0x14dcc5,_0x163ab7){_0x14dcc5=_0x14dcc5-0x0;var _0x35d6cc=_0x1399[_0x14dcc5];return _0x35d6cc;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x5b12,0xa3));var _0x25b1=function(_0x5d1c85,_0x4a56eb){_0x5d1c85=_0x5d1c85-0x0;var _0xe6d2bd=_0x5b12[_0x5d1c85];return _0xe6d2bd;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('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 7e096d2..8755500 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 _0xbf95=['email','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','options','FreshsalesAccount','include','findAll','rows','params','length','includeAll','find','catch','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xbf95,0x68));var _0x5bf9=function(_0x3be775,_0x90c2da){_0x3be775=_0x3be775-0x0;var _0x345b11=_0xbf95[_0x3be775];return _0x345b11;};'use strict';var emlformat=require(_0x5bf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf9('0x1'));var jsonpatch=require(_0x5bf9('0x2'));var rp=require('request-promise');var moment=require(_0x5bf9('0x3'));var BPromise=require(_0x5bf9('0x4'));var Mustache=require('mustache');var util=require(_0x5bf9('0x5'));var path=require(_0x5bf9('0x6'));var sox=require(_0x5bf9('0x7'));var csv=require(_0x5bf9('0x8'));var ejs=require(_0x5bf9('0x9'));var fs=require('fs');var fs_extra=require(_0x5bf9('0xa'));var _=require(_0x5bf9('0xb'));var squel=require(_0x5bf9('0xc'));var crypto=require(_0x5bf9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bf9('0x8'));var querystring=require(_0x5bf9('0xe'));var Papa=require(_0x5bf9('0xf'));var Redis=require('ioredis');var authService=require(_0x5bf9('0x10'));var qs=require(_0x5bf9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bf9('0x12'));var logger=require(_0x5bf9('0x13'))(_0x5bf9('0x14'));var utils=require(_0x5bf9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bf9('0x16'))['db'];var integrations=require(_0x5bf9('0x17'));function respondWithStatusCode(_0x3bd1d2,_0x3adff5){_0x3adff5=_0x3adff5||0xcc;return function(_0x36e9e4){if(_0x36e9e4){return _0x3bd1d2[_0x5bf9('0x18')](_0x3adff5);}return _0x3bd1d2['status'](_0x3adff5)[_0x5bf9('0x19')]();};}function respondWithResult(_0xbfb606,_0x350f45){_0x350f45=_0x350f45||0xc8;return function(_0x525753){if(_0x525753){return _0xbfb606['status'](_0x350f45)[_0x5bf9('0x1a')](_0x525753);}};}function respondWithFilteredResult(_0x29ba25,_0x223a40){return function(_0x4d67d6){if(_0x4d67d6){var _0x16d630=typeof _0x223a40[_0x5bf9('0x1b')]==='undefined'&&typeof _0x223a40[_0x5bf9('0x1c')]===_0x5bf9('0x1d');var _0x262eea=_0x4d67d6[_0x5bf9('0x1e')];var _0x40d4c2=_0x16d630?0x0:_0x223a40[_0x5bf9('0x1b')];var _0x29c919=_0x16d630?_0x4d67d6[_0x5bf9('0x1e')]:_0x223a40['offset']+_0x223a40[_0x5bf9('0x1c')];var _0x48ec7e;if(_0x29c919>=_0x262eea){_0x29c919=_0x262eea;_0x48ec7e=0xc8;}else{_0x48ec7e=0xce;}_0x29ba25[_0x5bf9('0x1f')](_0x48ec7e);return _0x29ba25[_0x5bf9('0x20')](_0x5bf9('0x21'),_0x40d4c2+'-'+_0x29c919+'/'+_0x262eea)[_0x5bf9('0x1a')](_0x4d67d6);}return null;};}function patchUpdates(_0x53e940){return function(_0x262b58){try{jsonpatch[_0x5bf9('0x22')](_0x262b58,_0x53e940,!![]);}catch(_0x33aacb){return BPromise[_0x5bf9('0x23')](_0x33aacb);}return _0x262b58['save']();};}function saveUpdates(_0x9af01a,_0x50c5d9){return function(_0x36991d){if(_0x36991d){return _0x36991d['update'](_0x9af01a)[_0x5bf9('0x24')](function(_0x520c3d){return _0x520c3d;});}return null;};}function removeEntity(_0x5cc371,_0x43e074){return function(_0x1cb5f3){if(_0x1cb5f3){return _0x1cb5f3[_0x5bf9('0x25')]()[_0x5bf9('0x24')](function(){_0x5cc371['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25622d,_0x2be179){return function(_0x56fa5d){if(!_0x56fa5d){_0x25622d[_0x5bf9('0x18')](0x194);}return _0x56fa5d;};}function handleError(_0x3e9fc4,_0x5ba4f1){_0x5ba4f1=_0x5ba4f1||0x1f4;return function(_0x268c33){logger[_0x5bf9('0x26')](_0x268c33[_0x5bf9('0x27')]);if(_0x268c33[_0x5bf9('0x28')]){delete _0x268c33[_0x5bf9('0x28')];}_0x3e9fc4[_0x5bf9('0x1f')](_0x5ba4f1)[_0x5bf9('0x29')](_0x268c33);};}exports[_0x5bf9('0x2a')]=function(_0x276888,_0x5b86d3){var _0x259768={},_0x3e47ea={},_0x5b5109={'count':0x0,'rows':[]};var _0x4689af=_[_0x5bf9('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x3404a3){return{'name':_0x3404a3[_0x5bf9('0x2c')],'type':_0x3404a3[_0x5bf9('0x2d')][_0x5bf9('0x2e')]};});_0x3e47ea['model']=_[_0x5bf9('0x2b')](_0x4689af,_0x5bf9('0x28'));_0x3e47ea[_0x5bf9('0x2f')]=_[_0x5bf9('0x30')](_0x276888[_0x5bf9('0x2f')]);_0x3e47ea[_0x5bf9('0x31')]=_['intersection'](_0x3e47ea[_0x5bf9('0x32')],_0x3e47ea[_0x5bf9('0x2f')]);_0x259768[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x3e47ea['model'],qs[_0x5bf9('0x35')](_0x276888['query'][_0x5bf9('0x35')]));_0x259768[_0x5bf9('0x33')]=_0x259768[_0x5bf9('0x33')]['length']?_0x259768[_0x5bf9('0x33')]:_0x3e47ea['model'];if(!_0x276888[_0x5bf9('0x2f')]['hasOwnProperty'](_0x5bf9('0x36'))){_0x259768[_0x5bf9('0x1c')]=qs['limit'](_0x276888[_0x5bf9('0x2f')]['limit']);_0x259768['offset']=qs[_0x5bf9('0x1b')](_0x276888['query']['offset']);}_0x259768[_0x5bf9('0x37')]=qs[_0x5bf9('0x38')](_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x38')]);_0x259768[_0x5bf9('0x39')]=qs[_0x5bf9('0x31')](_['pick'](_0x276888[_0x5bf9('0x2f')],_0x3e47ea['filters']),_0x4689af);if(_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x3a')]){_0x259768[_0x5bf9('0x39')]=_[_0x5bf9('0x3b')](_0x259768[_0x5bf9('0x39')],{'$or':_[_0x5bf9('0x2b')](_0x4689af,function(_0x1e1184){if(_0x1e1184[_0x5bf9('0x2d')]!=='VIRTUAL'){var _0x4ccdc0={};_0x4ccdc0[_0x1e1184[_0x5bf9('0x28')]]={'$like':'%'+_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x3a')]+'%'};return _0x4ccdc0;}})});}_0x259768=_[_0x5bf9('0x3b')]({},_0x259768,_0x276888[_0x5bf9('0x3c')]);var _0x3618e5={'where':_0x259768[_0x5bf9('0x39')]};return db[_0x5bf9('0x3d')][_0x5bf9('0x1e')](_0x3618e5)['then'](function(_0x2e00c0){_0x5b5109[_0x5bf9('0x1e')]=_0x2e00c0;if(_0x276888[_0x5bf9('0x2f')]['includeAll']){_0x259768[_0x5bf9('0x3e')]=[{'all':!![]}];}return db[_0x5bf9('0x3d')][_0x5bf9('0x3f')](_0x259768);})[_0x5bf9('0x24')](function(_0x31c096){_0x5b5109[_0x5bf9('0x40')]=_0x31c096;return _0x5b5109;})['then'](respondWithFilteredResult(_0x5b86d3,_0x259768))['catch'](handleError(_0x5b86d3,null));};exports['show']=function(_0x5ee2da,_0x37743e){var _0x2fdb33={'raw':![],'where':{'id':_0x5ee2da[_0x5bf9('0x41')]['id']}},_0x32b6f9={};_0x32b6f9['model']=_[_0x5bf9('0x30')](db['FreshsalesAccount']['rawAttributes']);_0x32b6f9[_0x5bf9('0x2f')]=_[_0x5bf9('0x30')](_0x5ee2da['query']);_0x32b6f9[_0x5bf9('0x31')]=_[_0x5bf9('0x34')](_0x32b6f9['model'],_0x32b6f9[_0x5bf9('0x2f')]);_0x2fdb33[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x32b6f9[_0x5bf9('0x32')],qs[_0x5bf9('0x35')](_0x5ee2da['query'][_0x5bf9('0x35')]));_0x2fdb33[_0x5bf9('0x33')]=_0x2fdb33[_0x5bf9('0x33')][_0x5bf9('0x42')]?_0x2fdb33[_0x5bf9('0x33')]:_0x32b6f9[_0x5bf9('0x32')];if(_0x5ee2da['query'][_0x5bf9('0x43')]){_0x2fdb33['include']=[{'all':!![]}];}_0x2fdb33=_[_0x5bf9('0x3b')]({},_0x2fdb33,_0x5ee2da[_0x5bf9('0x3c')]);return db[_0x5bf9('0x3d')][_0x5bf9('0x44')](_0x2fdb33)[_0x5bf9('0x24')](handleEntityNotFound(_0x37743e,null))[_0x5bf9('0x24')](respondWithResult(_0x37743e,null))[_0x5bf9('0x45')](handleError(_0x37743e,null));};exports[_0x5bf9('0x46')]=function(_0x211249,_0x233fab){return db[_0x5bf9('0x3d')][_0x5bf9('0x46')](_0x211249[_0x5bf9('0x47')],{})[_0x5bf9('0x24')](respondWithResult(_0x233fab,0xc9))[_0x5bf9('0x45')](handleError(_0x233fab,null));};exports[_0x5bf9('0x48')]=function(_0x5cfc4c,_0x2ec961){if(_0x5cfc4c[_0x5bf9('0x47')]['id']){delete _0x5cfc4c[_0x5bf9('0x47')]['id'];}return db[_0x5bf9('0x3d')][_0x5bf9('0x44')]({'where':{'id':_0x5cfc4c['params']['id']}})[_0x5bf9('0x24')](handleEntityNotFound(_0x2ec961,null))[_0x5bf9('0x24')](saveUpdates(_0x5cfc4c[_0x5bf9('0x47')],null))['then'](respondWithResult(_0x2ec961,null))[_0x5bf9('0x45')](handleError(_0x2ec961,null));};exports[_0x5bf9('0x25')]=function(_0x55f39e,_0x3764b2){return db[_0x5bf9('0x3d')][_0x5bf9('0x44')]({'where':{'id':_0x55f39e[_0x5bf9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3764b2,null))[_0x5bf9('0x24')](removeEntity(_0x3764b2,null))[_0x5bf9('0x45')](handleError(_0x3764b2,null));};exports[_0x5bf9('0x49')]=function(_0x584049,_0xe3b359,_0x3f8c97){var _0x4b051b={};var _0x7c7a4b={};var _0x550f5f;var _0x52ad16;return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x584049[_0x5bf9('0x41')]['id']}})[_0x5bf9('0x24')](handleEntityNotFound(_0xe3b359,null))[_0x5bf9('0x24')](function(_0x26098c){if(_0x26098c){_0x550f5f=_0x26098c;_0x7c7a4b[_0x5bf9('0x32')]=_[_0x5bf9('0x30')](db[_0x5bf9('0x4b')]['rawAttributes']);_0x7c7a4b['query']=_[_0x5bf9('0x30')](_0x584049[_0x5bf9('0x2f')]);_0x7c7a4b[_0x5bf9('0x31')]=_['intersection'](_0x7c7a4b[_0x5bf9('0x32')],_0x7c7a4b[_0x5bf9('0x2f')]);_0x4b051b[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x7c7a4b[_0x5bf9('0x32')],qs[_0x5bf9('0x35')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x35')]));_0x4b051b[_0x5bf9('0x33')]=_0x4b051b['attributes'][_0x5bf9('0x42')]?_0x4b051b[_0x5bf9('0x33')]:_0x7c7a4b[_0x5bf9('0x32')];_0x4b051b[_0x5bf9('0x37')]=qs[_0x5bf9('0x38')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x38')]);_0x4b051b['where']=qs[_0x5bf9('0x31')](_[_0x5bf9('0x4c')](_0x584049[_0x5bf9('0x2f')],_0x7c7a4b[_0x5bf9('0x31')]));if(_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x3a')]){_0x4b051b['where']=_[_0x5bf9('0x3b')](_0x4b051b[_0x5bf9('0x39')],{'$or':_[_0x5bf9('0x2b')](_0x4b051b[_0x5bf9('0x33')],function(_0x1f3e76){var _0x1b8e46={};_0x1b8e46[_0x1f3e76]={'$like':'%'+_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x3a')]+'%'};return _0x1b8e46;})});}_0x4b051b=_['merge']({},_0x4b051b,_0x584049['options']);return _0x550f5f[_0x5bf9('0x49')](_0x4b051b);}})[_0x5bf9('0x24')](function(_0x489e61){if(_0x489e61){_0x52ad16=_0x489e61[_0x5bf9('0x42')];if(!_0x584049['query'][_0x5bf9('0x4d')](_0x5bf9('0x36'))){_0x4b051b[_0x5bf9('0x1c')]=qs['limit'](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x1c')]);_0x4b051b['offset']=qs[_0x5bf9('0x1b')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x1b')]);}return _0x550f5f[_0x5bf9('0x49')](_0x4b051b);}})[_0x5bf9('0x24')](function(_0x3a9e1e){if(_0x3a9e1e){return _0x3a9e1e?{'count':_0x52ad16,'rows':_0x3a9e1e}:null;}})[_0x5bf9('0x24')](respondWithResult(_0xe3b359,null))['catch'](handleError(_0xe3b359,null));};exports[_0x5bf9('0x4e')]=function(_0x3d07b5,_0x450fd1,_0x1ca4d3){if(_0x3d07b5['body']['id']){delete _0x3d07b5[_0x5bf9('0x47')]['id'];}return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x3d07b5['params']['id']}})['then'](handleEntityNotFound(_0x450fd1,null))[_0x5bf9('0x24')](function(_0x1c9946){if(_0x1c9946){_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x4f')]=_0x1c9946['id'];_0x3d07b5['body']['Subjects']=integrations[_0x5bf9('0x50')](_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x51')],_0x3d07b5['body'][_0x5bf9('0x2d')]);_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x52')]=integrations['getDescriptions'](_0x3d07b5[_0x5bf9('0x47')]['channel'],_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x2d')]);return db['FreshsalesConfiguration'][_0x5bf9('0x46')](_0x3d07b5[_0x5bf9('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x5bf9('0x53')},{'model':db[_0x5bf9('0x54')],'as':_0x5bf9('0x52')}]});}return null;})[_0x5bf9('0x24')](respondWithResult(_0x450fd1,null))[_0x5bf9('0x45')](handleError(_0x450fd1,null));};exports['getFields']=function(_0x46a34e,_0x573ca0,_0x191a81){var _0x378aff='';var _0x46cb4d='';return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x46a34e[_0x5bf9('0x41')]['id']},'attributes':['id',_0x5bf9('0x55'),_0x5bf9('0x56'),_0x5bf9('0x57')]})[_0x5bf9('0x24')](handleEntityNotFound(_0x573ca0,null))['then'](function(_0x39c3e7){if(_0x39c3e7){_0x46cb4d=_0x39c3e7[_0x5bf9('0x55')];_0x378aff=_0x39c3e7[_0x5bf9('0x56')];var _0x5d961a=_0x39c3e7[_0x5bf9('0x56')][_0x5bf9('0x58')](-0x1);if(_0x5d961a==='/'){_0x378aff=_0x378aff[_0x5bf9('0x59')](0x0,_0x378aff[_0x5bf9('0x5a')](_0x5d961a));}return rp({'method':'GET','uri':util[_0x5bf9('0x5b')](_0x5bf9('0x5c'),_0x378aff,_0x5bf9('0x5d')),'headers':{'Authorization':_0x5bf9('0x5e')+_0x39c3e7[_0x5bf9('0x57')]},'json':!![]});}})[_0x5bf9('0x24')](function(_0x5887ac){if(_0x5887ac){var _0x5d667c=_0x5887ac[_0x5bf9('0x5f')];var _0x469dff=![];var _0x4692e4=null;for(_0x4692e4=0x0;_0x4692e4<_0x5d667c[_0x5bf9('0x42')];_0x4692e4++){if(_0x5d667c[_0x4692e4][_0x5bf9('0x60')]===_0x46cb4d){_0x469dff=!![];}}if(_0x469dff){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5bf9('0x24')](respondWithResult(_0x573ca0,null))[_0x5bf9('0x45')](function(_0x372936){var _0x51b8ad=_0x46a34e[_0x5bf9('0x2f')][_0x5bf9('0x61')]?0x1f4:_0x372936[_0x5bf9('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x51b8ad,JSON['stringify'](_0x372936));delete _0x372936[_0x5bf9('0x28')];if(_0x51b8ad===0x191){_0x51b8ad=0x190;}_0x573ca0[_0x5bf9('0x1f')](_0x51b8ad)[_0x5bf9('0x29')](_0x46a34e['query'][_0x5bf9('0x61')]?{'message':_0x5bf9('0x63'),'statusCode':_0x372936[_0x5bf9('0x62')]}:_0x372936);});}; \ No newline at end of file +var _0xf933=['error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','lastIndexOf','GET','format','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0xf933,0x136));var _0x3f93=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xf933[_0xd0cd0b];return _0x59cced;};'use strict';var emlformat=require(_0x3f93('0x0'));var rimraf=require(_0x3f93('0x1'));var zipdir=require(_0x3f93('0x2'));var jsonpatch=require(_0x3f93('0x3'));var rp=require('request-promise');var moment=require(_0x3f93('0x4'));var BPromise=require(_0x3f93('0x5'));var Mustache=require(_0x3f93('0x6'));var util=require(_0x3f93('0x7'));var path=require(_0x3f93('0x8'));var sox=require(_0x3f93('0x9'));var csv=require(_0x3f93('0xa'));var ejs=require(_0x3f93('0xb'));var fs=require('fs');var fs_extra=require(_0x3f93('0xc'));var _=require(_0x3f93('0xd'));var squel=require('squel');var crypto=require(_0x3f93('0xe'));var jsforce=require(_0x3f93('0xf'));var deskjs=require(_0x3f93('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f93('0x11'));var Papa=require('papaparse');var Redis=require(_0x3f93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f93('0x14'));var logger=require(_0x3f93('0x15'))('api');var utils=require(_0x3f93('0x16'));var config=require(_0x3f93('0x17'));var licenseUtil=require(_0x3f93('0x18'));var db=require(_0x3f93('0x19'))['db'];var integrations=require(_0x3f93('0x1a'));function respondWithStatusCode(_0x28fa04,_0x2b2efc){_0x2b2efc=_0x2b2efc||0xcc;return function(_0x1f0529){if(_0x1f0529){return _0x28fa04[_0x3f93('0x1b')](_0x2b2efc);}return _0x28fa04[_0x3f93('0x1c')](_0x2b2efc)[_0x3f93('0x1d')]();};}function respondWithResult(_0x4537c6,_0x203294){_0x203294=_0x203294||0xc8;return function(_0x4597a5){if(_0x4597a5){return _0x4537c6['status'](_0x203294)[_0x3f93('0x1e')](_0x4597a5);}};}function respondWithFilteredResult(_0xf97d8c,_0x36ab6f){return function(_0x3488ba){if(_0x3488ba){var _0xcb88d4=typeof _0x36ab6f[_0x3f93('0x1f')]===_0x3f93('0x20')&&typeof _0x36ab6f[_0x3f93('0x21')]===_0x3f93('0x20');var _0x15272c=_0x3488ba[_0x3f93('0x22')];var _0x15c451=_0xcb88d4?0x0:_0x36ab6f[_0x3f93('0x1f')];var _0x4f2ac5=_0xcb88d4?_0x3488ba['count']:_0x36ab6f[_0x3f93('0x1f')]+_0x36ab6f[_0x3f93('0x21')];var _0x19a4da;if(_0x4f2ac5>=_0x15272c){_0x4f2ac5=_0x15272c;_0x19a4da=0xc8;}else{_0x19a4da=0xce;}_0xf97d8c['status'](_0x19a4da);return _0xf97d8c[_0x3f93('0x23')](_0x3f93('0x24'),_0x15c451+'-'+_0x4f2ac5+'/'+_0x15272c)[_0x3f93('0x1e')](_0x3488ba);}return null;};}function patchUpdates(_0x2c033a){return function(_0x1954dc){try{jsonpatch[_0x3f93('0x25')](_0x1954dc,_0x2c033a,!![]);}catch(_0x57a3f9){return BPromise['reject'](_0x57a3f9);}return _0x1954dc[_0x3f93('0x26')]();};}function saveUpdates(_0x5f5482,_0x17c2fa){return function(_0x28a83c){if(_0x28a83c){return _0x28a83c[_0x3f93('0x27')](_0x5f5482)[_0x3f93('0x28')](function(_0x1c781d){return _0x1c781d;});}return null;};}function removeEntity(_0x2b5f35,_0xafd0cd){return function(_0x45c74a){if(_0x45c74a){return _0x45c74a[_0x3f93('0x29')]()[_0x3f93('0x28')](function(){_0x2b5f35['status'](0xcc)[_0x3f93('0x1d')]();});}};}function handleEntityNotFound(_0x36db5b,_0x1c4a1b){return function(_0x1c0ef0){if(!_0x1c0ef0){_0x36db5b[_0x3f93('0x1b')](0x194);}return _0x1c0ef0;};}function handleError(_0x17a59f,_0x1d8b3b){_0x1d8b3b=_0x1d8b3b||0x1f4;return function(_0x2ea0b7){logger['error'](_0x2ea0b7[_0x3f93('0x2a')]);if(_0x2ea0b7[_0x3f93('0x2b')]){delete _0x2ea0b7[_0x3f93('0x2b')];}_0x17a59f[_0x3f93('0x1c')](_0x1d8b3b)['send'](_0x2ea0b7);};}exports[_0x3f93('0x2c')]=function(_0x3021e4,_0x76800d){var _0x38550c={},_0x8180d4={},_0x5e9d7a={'count':0x0,'rows':[]};var _0x56c043=_['map'](db[_0x3f93('0x2d')][_0x3f93('0x2e')],function(_0x52f859){return{'name':_0x52f859[_0x3f93('0x2f')],'type':_0x52f859['type'][_0x3f93('0x30')]};});_0x8180d4[_0x3f93('0x31')]=_[_0x3f93('0x32')](_0x56c043,_0x3f93('0x2b'));_0x8180d4[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x3021e4[_0x3f93('0x33')]);_0x8180d4[_0x3f93('0x35')]=_['intersection'](_0x8180d4['model'],_0x8180d4[_0x3f93('0x33')]);_0x38550c[_0x3f93('0x36')]=_[_0x3f93('0x37')](_0x8180d4[_0x3f93('0x31')],qs['fields'](_0x3021e4[_0x3f93('0x33')][_0x3f93('0x38')]));_0x38550c[_0x3f93('0x36')]=_0x38550c['attributes'][_0x3f93('0x39')]?_0x38550c[_0x3f93('0x36')]:_0x8180d4['model'];if(!_0x3021e4['query'][_0x3f93('0x3a')](_0x3f93('0x3b'))){_0x38550c[_0x3f93('0x21')]=qs[_0x3f93('0x21')](_0x3021e4[_0x3f93('0x33')]['limit']);_0x38550c[_0x3f93('0x1f')]=qs[_0x3f93('0x1f')](_0x3021e4[_0x3f93('0x33')]['offset']);}_0x38550c[_0x3f93('0x3c')]=qs[_0x3f93('0x3d')](_0x3021e4[_0x3f93('0x33')][_0x3f93('0x3d')]);_0x38550c['where']=qs[_0x3f93('0x35')](_['pick'](_0x3021e4[_0x3f93('0x33')],_0x8180d4[_0x3f93('0x35')]),_0x56c043);if(_0x3021e4[_0x3f93('0x33')]['filter']){_0x38550c[_0x3f93('0x3e')]=_[_0x3f93('0x3f')](_0x38550c[_0x3f93('0x3e')],{'$or':_[_0x3f93('0x32')](_0x56c043,function(_0x1b1323){if(_0x1b1323[_0x3f93('0x40')]!=='VIRTUAL'){var _0x5503cd={};_0x5503cd[_0x1b1323['name']]={'$like':'%'+_0x3021e4['query'][_0x3f93('0x41')]+'%'};return _0x5503cd;}})});}_0x38550c=_[_0x3f93('0x3f')]({},_0x38550c,_0x3021e4[_0x3f93('0x42')]);var _0x56d5a9={'where':_0x38550c[_0x3f93('0x3e')]};return db[_0x3f93('0x2d')]['count'](_0x56d5a9)[_0x3f93('0x28')](function(_0x310ab9){_0x5e9d7a[_0x3f93('0x22')]=_0x310ab9;if(_0x3021e4['query'][_0x3f93('0x43')]){_0x38550c[_0x3f93('0x44')]=[{'all':!![]}];}return db[_0x3f93('0x2d')][_0x3f93('0x45')](_0x38550c);})[_0x3f93('0x28')](function(_0x3d3138){_0x5e9d7a[_0x3f93('0x46')]=_0x3d3138;return _0x5e9d7a;})[_0x3f93('0x28')](respondWithFilteredResult(_0x76800d,_0x38550c))[_0x3f93('0x47')](handleError(_0x76800d,null));};exports[_0x3f93('0x48')]=function(_0x840712,_0x302126){var _0xf00b13={'raw':![],'where':{'id':_0x840712[_0x3f93('0x49')]['id']}},_0x3ab71c={};_0x3ab71c[_0x3f93('0x31')]=_[_0x3f93('0x34')](db[_0x3f93('0x2d')][_0x3f93('0x2e')]);_0x3ab71c[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x840712[_0x3f93('0x33')]);_0x3ab71c[_0x3f93('0x35')]=_[_0x3f93('0x37')](_0x3ab71c['model'],_0x3ab71c[_0x3f93('0x33')]);_0xf00b13['attributes']=_['intersection'](_0x3ab71c[_0x3f93('0x31')],qs[_0x3f93('0x38')](_0x840712[_0x3f93('0x33')][_0x3f93('0x38')]));_0xf00b13[_0x3f93('0x36')]=_0xf00b13['attributes']['length']?_0xf00b13[_0x3f93('0x36')]:_0x3ab71c[_0x3f93('0x31')];if(_0x840712['query'][_0x3f93('0x43')]){_0xf00b13[_0x3f93('0x44')]=[{'all':!![]}];}_0xf00b13=_[_0x3f93('0x3f')]({},_0xf00b13,_0x840712[_0x3f93('0x42')]);return db[_0x3f93('0x2d')]['find'](_0xf00b13)['then'](handleEntityNotFound(_0x302126,null))[_0x3f93('0x28')](respondWithResult(_0x302126,null))[_0x3f93('0x47')](handleError(_0x302126,null));};exports['create']=function(_0x1d1722,_0x5bd31c){return db[_0x3f93('0x2d')][_0x3f93('0x4a')](_0x1d1722[_0x3f93('0x4b')],{})['then'](respondWithResult(_0x5bd31c,0xc9))['catch'](handleError(_0x5bd31c,null));};exports[_0x3f93('0x27')]=function(_0x444982,_0x39a901){if(_0x444982[_0x3f93('0x4b')]['id']){delete _0x444982['body']['id'];}return db[_0x3f93('0x2d')][_0x3f93('0x4c')]({'where':{'id':_0x444982[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x39a901,null))[_0x3f93('0x28')](saveUpdates(_0x444982[_0x3f93('0x4b')],null))['then'](respondWithResult(_0x39a901,null))[_0x3f93('0x47')](handleError(_0x39a901,null));};exports[_0x3f93('0x29')]=function(_0x32db2f,_0x50ccaa){return db[_0x3f93('0x2d')]['find']({'where':{'id':_0x32db2f[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x50ccaa,null))[_0x3f93('0x28')](removeEntity(_0x50ccaa,null))[_0x3f93('0x47')](handleError(_0x50ccaa,null));};exports[_0x3f93('0x4d')]=function(_0x12a4a1,_0x4ffa6e,_0x5d3b43){var _0x25bbea={};var _0x72c587={};var _0x41b32c;var _0x55104e;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x12a4a1[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x4ffa6e,null))['then'](function(_0x54cb8a){if(_0x54cb8a){_0x41b32c=_0x54cb8a;_0x72c587['model']=_[_0x3f93('0x34')](db[_0x3f93('0x4e')][_0x3f93('0x2e')]);_0x72c587[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x12a4a1[_0x3f93('0x33')]);_0x72c587['filters']=_['intersection'](_0x72c587[_0x3f93('0x31')],_0x72c587[_0x3f93('0x33')]);_0x25bbea[_0x3f93('0x36')]=_['intersection'](_0x72c587[_0x3f93('0x31')],qs['fields'](_0x12a4a1[_0x3f93('0x33')]['fields']));_0x25bbea[_0x3f93('0x36')]=_0x25bbea['attributes'][_0x3f93('0x39')]?_0x25bbea['attributes']:_0x72c587[_0x3f93('0x31')];_0x25bbea[_0x3f93('0x3c')]=qs[_0x3f93('0x3d')](_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x3d')]);_0x25bbea[_0x3f93('0x3e')]=qs[_0x3f93('0x35')](_['pick'](_0x12a4a1[_0x3f93('0x33')],_0x72c587[_0x3f93('0x35')]));if(_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x41')]){_0x25bbea['where']=_[_0x3f93('0x3f')](_0x25bbea['where'],{'$or':_[_0x3f93('0x32')](_0x25bbea[_0x3f93('0x36')],function(_0x37a0d4){var _0x31d2c7={};_0x31d2c7[_0x37a0d4]={'$like':'%'+_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x41')]+'%'};return _0x31d2c7;})});}_0x25bbea=_[_0x3f93('0x3f')]({},_0x25bbea,_0x12a4a1[_0x3f93('0x42')]);return _0x41b32c[_0x3f93('0x4d')](_0x25bbea);}})[_0x3f93('0x28')](function(_0x3f1fa7){if(_0x3f1fa7){_0x55104e=_0x3f1fa7[_0x3f93('0x39')];if(!_0x12a4a1[_0x3f93('0x33')]['hasOwnProperty'](_0x3f93('0x3b'))){_0x25bbea[_0x3f93('0x21')]=qs[_0x3f93('0x21')](_0x12a4a1[_0x3f93('0x33')]['limit']);_0x25bbea[_0x3f93('0x1f')]=qs['offset'](_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x1f')]);}return _0x41b32c[_0x3f93('0x4d')](_0x25bbea);}})['then'](function(_0x5878ed){if(_0x5878ed){return _0x5878ed?{'count':_0x55104e,'rows':_0x5878ed}:null;}})[_0x3f93('0x28')](respondWithResult(_0x4ffa6e,null))[_0x3f93('0x47')](handleError(_0x4ffa6e,null));};exports[_0x3f93('0x4f')]=function(_0x422a80,_0x591787,_0x1ff1ef){if(_0x422a80[_0x3f93('0x4b')]['id']){delete _0x422a80[_0x3f93('0x4b')]['id'];}return db['FreshsalesAccount'][_0x3f93('0x50')]({'where':{'id':_0x422a80[_0x3f93('0x49')]['id']}})['then'](handleEntityNotFound(_0x591787,null))[_0x3f93('0x28')](function(_0x1996e0){if(_0x1996e0){_0x422a80[_0x3f93('0x4b')]['AccountId']=_0x1996e0['id'];_0x422a80[_0x3f93('0x4b')][_0x3f93('0x51')]=integrations[_0x3f93('0x52')](_0x422a80[_0x3f93('0x4b')][_0x3f93('0x53')],_0x422a80[_0x3f93('0x4b')]['type']);_0x422a80['body']['Descriptions']=integrations['getDescriptions'](_0x422a80['body'][_0x3f93('0x53')],_0x422a80[_0x3f93('0x4b')][_0x3f93('0x40')]);return db[_0x3f93('0x4e')]['create'](_0x422a80[_0x3f93('0x4b')],{'include':[{'model':db[_0x3f93('0x54')],'as':_0x3f93('0x51')},{'model':db[_0x3f93('0x54')],'as':_0x3f93('0x55')}]});}return null;})[_0x3f93('0x28')](respondWithResult(_0x591787,null))['catch'](handleError(_0x591787,null));};exports[_0x3f93('0x56')]=function(_0x34f817,_0x1597be,_0x1cbde9){var _0x3ca185='';var _0x41f1a4='';return db[_0x3f93('0x2d')][_0x3f93('0x50')]({'where':{'id':_0x34f817[_0x3f93('0x49')]['id']},'attributes':['id','username',_0x3f93('0x57'),_0x3f93('0x58')]})[_0x3f93('0x28')](handleEntityNotFound(_0x1597be,null))[_0x3f93('0x28')](function(_0x21e045){if(_0x21e045){_0x41f1a4=_0x21e045[_0x3f93('0x59')];_0x3ca185=_0x21e045[_0x3f93('0x57')];var _0x1dba95=_0x21e045[_0x3f93('0x57')][_0x3f93('0x5a')](-0x1);if(_0x1dba95==='/'){_0x3ca185=_0x3ca185['substring'](0x0,_0x3ca185[_0x3f93('0x5b')](_0x1dba95));}return rp({'method':_0x3f93('0x5c'),'uri':util[_0x3f93('0x5d')]('%s%s',_0x3ca185,'/api/selector/owners'),'headers':{'Authorization':_0x3f93('0x5e')+_0x21e045[_0x3f93('0x58')]},'json':!![]});}})[_0x3f93('0x28')](function(_0x2532c5){if(_0x2532c5){var _0x36eaad=_0x2532c5['users'];var _0x1572b8=![];var _0x34b074=null;for(_0x34b074=0x0;_0x34b074<_0x36eaad[_0x3f93('0x39')];_0x34b074++){if(_0x36eaad[_0x34b074][_0x3f93('0x5f')]===_0x41f1a4){_0x1572b8=!![];}}if(_0x1572b8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3f93('0x60')});}}})[_0x3f93('0x28')](respondWithResult(_0x1597be,null))['catch'](function(_0x7fc218){var _0x2f8d02=_0x34f817[_0x3f93('0x33')][_0x3f93('0x61')]?0x1f4:_0x7fc218['statusCode']||0x1f4;logger[_0x3f93('0x62')](_0x3f93('0x63'),_0x3f93('0x56'),_0x2f8d02,JSON['stringify'](_0x7fc218));delete _0x7fc218[_0x3f93('0x2b')];if(_0x2f8d02===0x191){_0x2f8d02=0x190;}_0x1597be[_0x3f93('0x1c')](_0x2f8d02)[_0x3f93('0x64')](_0x34f817[_0x3f93('0x33')][_0x3f93('0x61')]?{'message':_0x3f93('0x65'),'statusCode':_0x7fc218['statusCode']}:_0x7fc218);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8cb5e1a..2310edf 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 _0x4975=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1532e5,_0x342ea7){var _0x3b82bd=function(_0x1a8ab9){while(--_0x1a8ab9){_0x1532e5['push'](_0x1532e5['shift']());}};_0x3b82bd(++_0x342ea7);}(_0x4975,0x86));var _0x5497=function(_0x5da0e0,_0x5ddd63){_0x5da0e0=_0x5da0e0-0x0;var _0x2f0a21=_0x4975[_0x5da0e0];return _0x2f0a21;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));var integrations=require(_0x5497('0xa'));module['exports']=function(_0x37e48d,_0x4f563d){return _0x37e48d[_0x5497('0xb')](_0x5497('0xc'),attributes,{'tableName':_0x5497('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1ed2e4,_0xa4238a){var _0xea070c=function(_0x56746f){while(--_0x56746f){_0x1ed2e4['push'](_0x1ed2e4['shift']());}};_0xea070c(++_0xa4238a);}(_0x323f,0x1ee));var _0xf323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x323f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));var integrations=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x5d7d60,_0xb9a667){return _0x5d7d60[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'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 63dabc8..92db6d5 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 _0x896e=['limit','include','model','attributes','map','ShowFreshsalesAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0xf5dce0,_0x40632b){var _0x8d3881=function(_0x4a0284){while(--_0x4a0284){_0xf5dce0['push'](_0xf5dce0['shift']());}};_0x8d3881(++_0x40632b);}(_0x896e,0x1e9));var _0xe896=function(_0x2be3b7,_0x30e912){_0x2be3b7=_0x2be3b7-0x0;var _0x313d1c=_0x896e[_0x2be3b7];return _0x313d1c;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}exports[_0xe896('0x18')]=function(_0x32f86d){var _0x2d4cf0=this;return new Promise(function(_0x5dc89d,_0x782813){return db[_0xe896('0x19')][_0xe896('0x1a')]({'raw':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')][_0xe896('0x1c')]===undefined?!![]:![]:!![],'where':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')]['where']||null:null,'attributes':_0x32f86d[_0xe896('0x1b')]?_0x32f86d['options']['attributes']||null:null,'limit':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')][_0xe896('0x1d')]||null:null,'include':_0x32f86d[_0xe896('0x1b')]?_0x32f86d['options'][_0xe896('0x1e')]?_['map'](_0x32f86d['options'][_0xe896('0x1e')],function(_0x41e689){return{'model':db[_0x41e689[_0xe896('0x1f')]],'as':_0x41e689['as'],'attributes':_0x41e689[_0xe896('0x20')],'include':_0x41e689[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x41e689[_0xe896('0x1e')],function(_0x4b71cc){return{'model':db[_0x4b71cc[_0xe896('0x1f')]],'as':_0x4b71cc['as'],'attributes':_0x4b71cc[_0xe896('0x20')],'include':_0x4b71cc[_0xe896('0x1e')]?_['map'](_0x4b71cc[_0xe896('0x1e')],function(_0xd50fe2){return{'model':db[_0xd50fe2[_0xe896('0x1f')]],'as':_0xd50fe2['as'],'attributes':_0xd50fe2[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe896('0xe')](function(_0x3f8ceb){logger['info'](_0xe896('0x18'),_0x32f86d);logger[_0xe896('0x10')](_0xe896('0x18'),_0x32f86d,JSON[_0xe896('0x12')](_0x3f8ceb));_0x5dc89d(_0x3f8ceb);})[_0xe896('0x17')](function(_0x5e0d9b){logger['error']('GetFreshsalesAccount',_0x5e0d9b['message'],_0x32f86d);_0x782813(_0x2d4cf0['error'](0x1f4,_0x5e0d9b[_0xe896('0x15')]));});});};exports[_0xe896('0x22')]=function(_0x10fd26){var _0x76c781=this;return new Promise(function(_0x3cd88e,_0x1a6090){return db[_0xe896('0x19')][_0xe896('0x23')]({'raw':_0x10fd26['options']?_0x10fd26['options'][_0xe896('0x1c')]===undefined?!![]:![]:!![],'where':_0x10fd26[_0xe896('0x1b')]?_0x10fd26[_0xe896('0x1b')][_0xe896('0x24')]||null:null,'attributes':_0x10fd26['options']?_0x10fd26[_0xe896('0x1b')]['attributes']||null:null,'include':_0x10fd26['options']?_0x10fd26[_0xe896('0x1b')][_0xe896('0x1e')]?_[_0xe896('0x21')](_0x10fd26['options']['include'],function(_0x567589){return{'model':db[_0x567589[_0xe896('0x1f')]],'as':_0x567589['as'],'attributes':_0x567589[_0xe896('0x20')],'include':_0x567589[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x567589[_0xe896('0x1e')],function(_0x486eb5){return{'model':db[_0x486eb5[_0xe896('0x1f')]],'as':_0x486eb5['as'],'attributes':_0x486eb5[_0xe896('0x20')],'include':_0x486eb5[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x486eb5[_0xe896('0x1e')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xe896('0x1f')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42f3fb){logger[_0xe896('0x16')]('ShowFreshsalesAccount',_0x10fd26);logger[_0xe896('0x10')]('ShowFreshsalesAccount',_0x10fd26,JSON[_0xe896('0x12')](_0x42f3fb));_0x3cd88e(_0x42f3fb);})['catch'](function(_0x42f445){logger['error'](_0xe896('0x22'),_0x42f445[_0xe896('0x15')],_0x10fd26);_0x1a6090(_0x76c781[_0xe896('0x13')](0x1f4,_0x42f445[_0xe896('0x15')]));});});}; \ No newline at end of file +var _0x5464=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug'];(function(_0x21643c,_0x230532){var _0x58bfb6=function(_0x60c8eb){while(--_0x60c8eb){_0x21643c['push'](_0x21643c['shift']());}};_0x58bfb6(++_0x230532);}(_0x5464,0x15d));var _0x4546=function(_0x2ff5d5,_0x3b7db5){_0x2ff5d5=_0x2ff5d5-0x0;var _0x47be60=_0x5464[_0x2ff5d5];return _0x47be60;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')]({'raw':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x19')]||null:null,'attributes':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1a')]||null:null,'limit':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1b')]||null:null,'include':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x57d8de[_0x4546('0x17')]['include'],function(_0x3dab5c){return{'model':db[_0x3dab5c[_0x4546('0x1e')]],'as':_0x3dab5c['as'],'attributes':_0x3dab5c['attributes'],'include':_0x3dab5c[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x3dab5c[_0x4546('0x1c')],function(_0x4467ee){return{'model':db[_0x4467ee[_0x4546('0x1e')]],'as':_0x4467ee['as'],'attributes':_0x4467ee['attributes'],'include':_0x4467ee[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x4467ee[_0x4546('0x1c')],function(_0x48fc36){return{'model':db[_0x48fc36['model']],'as':_0x48fc36['as'],'attributes':_0x48fc36[_0x4546('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x15611c){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger[_0x4546('0xd')](_0x4546('0x14'),_0x57d8de,JSON['stringify'](_0x15611c));_0x5780a7(_0x15611c);})[_0x4546('0x13')](function(_0x52c546){logger[_0x4546('0x10')](_0x4546('0x14'),_0x52c546['message'],_0x57d8de);_0x330235(_0x4ffd6b['error'](0x1f4,_0x52c546[_0x4546('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x3c7c7d){var _0x58b69=this;return new Promise(function(_0x480d8e,_0x5f0226){return db[_0x4546('0x15')][_0x4546('0x1f')]({'raw':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x19')]||null:null,'attributes':_0x3c7c7d['options']?_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1a')]||null:null,'include':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d[_0x4546('0x17')]['include']?_[_0x4546('0x1d')](_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1c')],function(_0x298bef){return{'model':db[_0x298bef[_0x4546('0x1e')]],'as':_0x298bef['as'],'attributes':_0x298bef[_0x4546('0x1a')],'include':_0x298bef['include']?_[_0x4546('0x1d')](_0x298bef[_0x4546('0x1c')],function(_0x549f48){return{'model':db[_0x549f48['model']],'as':_0x549f48['as'],'attributes':_0x549f48[_0x4546('0x1a')],'include':_0x549f48[_0x4546('0x1c')]?_['map'](_0x549f48[_0x4546('0x1c')],function(_0x25066c){return{'model':db[_0x25066c['model']],'as':_0x25066c['as'],'attributes':_0x25066c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x141fe8){logger[_0x4546('0xb')](_0x4546('0x20'),_0x3c7c7d);logger[_0x4546('0xd')](_0x4546('0x20'),_0x3c7c7d,JSON['stringify'](_0x141fe8));_0x480d8e(_0x141fe8);})[_0x4546('0x13')](function(_0x33307f){logger['error'](_0x4546('0x20'),_0x33307f['message'],_0x3c7c7d);_0x5f0226(_0x58b69[_0x4546('0x10')](0x1f4,_0x33307f[_0x4546('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index af6caac..a5ea1eb 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 _0xbcfb=['get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcfb,0xcf));var _0xbbcf=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xbcfb[_0x46111d];return _0xe82586;};'use strict';var multer=require(_0xbbcf('0x0'));var util=require(_0xbbcf('0x1'));var path=require(_0xbbcf('0x2'));var timeout=require(_0xbbcf('0x3'));var express=require('express');var router=express[_0xbbcf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbbcf('0x5'));var interaction=require(_0xbbcf('0x6'));var config=require(_0xbbcf('0x7'));var controller=require(_0xbbcf('0x8'));router[_0xbbcf('0x9')]('/',auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xb')]);router[_0xbbcf('0x9')](_0xbbcf('0xc'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xd')]);router[_0xbbcf('0x9')](_0xbbcf('0xe'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xf')]);router[_0xbbcf('0x9')](_0xbbcf('0x10'),auth['isAuthenticated'](),controller[_0xbbcf('0x11')]);router[_0xbbcf('0x9')](_0xbbcf('0x12'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0x13')]);router[_0xbbcf('0x14')]('/',auth[_0xbbcf('0xa')](),controller['create']);router[_0xbbcf('0x15')]('/:id',auth[_0xbbcf('0xa')](),controller['update']);router[_0xbbcf('0x16')]('/:id',auth[_0xbbcf('0xa')](),controller['destroy']);module[_0xbbcf('0x17')]=router; \ No newline at end of file +var _0xab96=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x53ed2a,_0x1721a9){var _0x4a2c6e=function(_0x2d215c){while(--_0x2d215c){_0x53ed2a['push'](_0x53ed2a['shift']());}};_0x4a2c6e(++_0x1721a9);}(_0xab96,0x15a));var _0x6ab9=function(_0xded1e4,_0x55da9c){_0xded1e4=_0xded1e4-0x0;var _0x29dc2b=_0xab96[_0xded1e4];return _0x29dc2b;};'use strict';var multer=require(_0x6ab9('0x0'));var util=require(_0x6ab9('0x1'));var path=require(_0x6ab9('0x2'));var timeout=require(_0x6ab9('0x3'));var express=require(_0x6ab9('0x4'));var router=express['Router']();var fs_extra=require(_0x6ab9('0x5'));var auth=require(_0x6ab9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab9('0x7'));var controller=require(_0x6ab9('0x8'));router[_0x6ab9('0x9')]('/',auth[_0x6ab9('0xa')](),controller['index']);router['get'](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xc')]);router[_0x6ab9('0x9')](_0x6ab9('0xd'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xe')]);router[_0x6ab9('0x9')]('/:id/descriptions',auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xf')]);router[_0x6ab9('0x9')](_0x6ab9('0x10'),auth[_0x6ab9('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ab9('0x11')]);router[_0x6ab9('0x12')](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0x13')]);router['delete'](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0x14')]);module[_0x6ab9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 863fc22..6439d9c 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 _0xac84=['sequelize','exports','STRING'];(function(_0x1b8ff4,_0x8ea99c){var _0x1f4acd=function(_0x41beb0){while(--_0x41beb0){_0x1b8ff4['push'](_0x1b8ff4['shift']());}};_0x1f4acd(++_0x8ea99c);}(_0xac84,0x16b));var _0x4ac8=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0xac84[_0x53417c];return _0x49407d;};'use strict';var Sequelize=require(_0x4ac8('0x0'));module[_0x4ac8('0x1')]={'name':{'type':Sequelize[_0x4ac8('0x2')]},'description':{'type':Sequelize[_0x4ac8('0x2')]}}; \ No newline at end of file +var _0x301a=['sequelize'];(function(_0x57c82b,_0x508042){var _0x3bec5c=function(_0x6fefc4){while(--_0x6fefc4){_0x57c82b['push'](_0x57c82b['shift']());}};_0x3bec5c(++_0x508042);}(_0x301a,0x1cf));var _0xa301=function(_0x261b5c,_0x16c5ae){_0x261b5c=_0x261b5c-0x0;var _0x4e0eab=_0x301a[_0x261b5c];return _0x4e0eab;};'use strict';var Sequelize=require(_0xa301('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1e66040..2dcee38 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 _0xa9ea=['stack','name','send','index','FreshsalesConfiguration','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','options','find','create','body','update','getSubjects','FreshsalesField','rawAttributes','order','pick','getDescriptions','findOne','getFields','eml-format','rimraf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end'];(function(_0x4d3774,_0x12f7a8){var _0x23cb6d=function(_0x3876eb){while(--_0x3876eb){_0x4d3774['push'](_0x4d3774['shift']());}};_0x23cb6d(++_0x12f7a8);}(_0xa9ea,0x7b));var _0xaa9e=function(_0x2563e4,_0x456262){_0x2563e4=_0x2563e4-0x0;var _0x53e6d8=_0xa9ea[_0x2563e4];return _0x53e6d8;};'use strict';var emlformat=require(_0xaa9e('0x0'));var rimraf=require(_0xaa9e('0x1'));var zipdir=require(_0xaa9e('0x2'));var jsonpatch=require(_0xaa9e('0x3'));var rp=require(_0xaa9e('0x4'));var moment=require(_0xaa9e('0x5'));var BPromise=require(_0xaa9e('0x6'));var Mustache=require(_0xaa9e('0x7'));var util=require(_0xaa9e('0x8'));var path=require(_0xaa9e('0x9'));var sox=require('sox');var csv=require(_0xaa9e('0xa'));var ejs=require(_0xaa9e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa9e('0xc'));var squel=require(_0xaa9e('0xd'));var crypto=require(_0xaa9e('0xe'));var jsforce=require(_0xaa9e('0xf'));var deskjs=require(_0xaa9e('0x10'));var toCsv=require(_0xaa9e('0xa'));var querystring=require(_0xaa9e('0x11'));var Papa=require(_0xaa9e('0x12'));var Redis=require(_0xaa9e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xaa9e('0x14'));var as=require(_0xaa9e('0x15'));var hardwareService=require(_0xaa9e('0x16'));var logger=require(_0xaa9e('0x17'))(_0xaa9e('0x18'));var utils=require(_0xaa9e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa9e('0x1a'))['db'];function respondWithStatusCode(_0x4218b2,_0x334ce5){_0x334ce5=_0x334ce5||0xcc;return function(_0x52c273){if(_0x52c273){return _0x4218b2[_0xaa9e('0x1b')](_0x334ce5);}return _0x4218b2[_0xaa9e('0x1c')](_0x334ce5)['end']();};}function respondWithResult(_0x6e7b66,_0xaa229d){_0xaa229d=_0xaa229d||0xc8;return function(_0x2421e5){if(_0x2421e5){return _0x6e7b66[_0xaa9e('0x1c')](_0xaa229d)[_0xaa9e('0x1d')](_0x2421e5);}};}function respondWithFilteredResult(_0x2a1a60,_0x41e6df){return function(_0x1ec317){if(_0x1ec317){var _0x1a0efb=typeof _0x41e6df[_0xaa9e('0x1e')]===_0xaa9e('0x1f')&&typeof _0x41e6df[_0xaa9e('0x20')]===_0xaa9e('0x1f');var _0x1cc07b=_0x1ec317[_0xaa9e('0x21')];var _0x78b7a2=_0x1a0efb?0x0:_0x41e6df['offset'];var _0x52a538=_0x1a0efb?_0x1ec317[_0xaa9e('0x21')]:_0x41e6df[_0xaa9e('0x1e')]+_0x41e6df['limit'];var _0x1d153f;if(_0x52a538>=_0x1cc07b){_0x52a538=_0x1cc07b;_0x1d153f=0xc8;}else{_0x1d153f=0xce;}_0x2a1a60[_0xaa9e('0x1c')](_0x1d153f);return _0x2a1a60[_0xaa9e('0x22')]('Content-Range',_0x78b7a2+'-'+_0x52a538+'/'+_0x1cc07b)[_0xaa9e('0x1d')](_0x1ec317);}return null;};}function patchUpdates(_0xbd5162){return function(_0x426b54){try{jsonpatch[_0xaa9e('0x23')](_0x426b54,_0xbd5162,!![]);}catch(_0x4458bd){return BPromise[_0xaa9e('0x24')](_0x4458bd);}return _0x426b54[_0xaa9e('0x25')]();};}function saveUpdates(_0x3b4b95,_0x413675){return function(_0x21c4c7){if(_0x21c4c7){return _0x21c4c7['update'](_0x3b4b95)[_0xaa9e('0x26')](function(_0x39d2aa){return _0x39d2aa;});}return null;};}function removeEntity(_0x9906d8,_0x2ed3b9){return function(_0x5bf58e){if(_0x5bf58e){return _0x5bf58e[_0xaa9e('0x27')]()[_0xaa9e('0x26')](function(){_0x9906d8[_0xaa9e('0x1c')](0xcc)[_0xaa9e('0x28')]();});}};}function handleEntityNotFound(_0x154673,_0x1813b7){return function(_0x349c55){if(!_0x349c55){_0x154673[_0xaa9e('0x1b')](0x194);}return _0x349c55;};}function handleError(_0xae5501,_0x202b6b){_0x202b6b=_0x202b6b||0x1f4;return function(_0x3c18c5){logger['error'](_0x3c18c5[_0xaa9e('0x29')]);if(_0x3c18c5['name']){delete _0x3c18c5[_0xaa9e('0x2a')];}_0xae5501[_0xaa9e('0x1c')](_0x202b6b)[_0xaa9e('0x2b')](_0x3c18c5);};}exports[_0xaa9e('0x2c')]=function(_0x27e2be,_0x44aac7){var _0xd00ecf={},_0x4aa028={},_0x4f057e={'count':0x0,'rows':[]};var _0x1b163a=_['map'](db[_0xaa9e('0x2d')]['rawAttributes'],function(_0x5f4783){return{'name':_0x5f4783[_0xaa9e('0x2e')],'type':_0x5f4783[_0xaa9e('0x2f')]['key']};});_0x4aa028[_0xaa9e('0x30')]=_[_0xaa9e('0x31')](_0x1b163a,_0xaa9e('0x2a'));_0x4aa028['query']=_['keys'](_0x27e2be[_0xaa9e('0x32')]);_0x4aa028[_0xaa9e('0x33')]=_['intersection'](_0x4aa028[_0xaa9e('0x30')],_0x4aa028[_0xaa9e('0x32')]);_0xd00ecf[_0xaa9e('0x34')]=_[_0xaa9e('0x35')](_0x4aa028[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x27e2be['query'][_0xaa9e('0x36')]));_0xd00ecf[_0xaa9e('0x34')]=_0xd00ecf[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0xd00ecf['attributes']:_0x4aa028[_0xaa9e('0x30')];if(!_0x27e2be['query'][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0xd00ecf[_0xaa9e('0x20')]=qs['limit'](_0x27e2be['query']['limit']);_0xd00ecf[_0xaa9e('0x1e')]=qs[_0xaa9e('0x1e')](_0x27e2be['query'][_0xaa9e('0x1e')]);}_0xd00ecf['order']=qs[_0xaa9e('0x3a')](_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0xd00ecf[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_['pick'](_0x27e2be['query'],_0x4aa028['filters']),_0x1b163a);if(_0x27e2be['query'][_0xaa9e('0x3c')]){_0xd00ecf[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0xd00ecf[_0xaa9e('0x3b')],{'$or':_[_0xaa9e('0x31')](_0x1b163a,function(_0x58c162){if(_0x58c162[_0xaa9e('0x2f')]!==_0xaa9e('0x3e')){var _0x424a1c={};_0x424a1c[_0x58c162[_0xaa9e('0x2a')]]={'$like':'%'+_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3c')]+'%'};return _0x424a1c;}})});}_0xd00ecf=_[_0xaa9e('0x3d')]({},_0xd00ecf,_0x27e2be['options']);var _0x3d1b3c={'where':_0xd00ecf[_0xaa9e('0x3b')]};return db[_0xaa9e('0x2d')][_0xaa9e('0x21')](_0x3d1b3c)[_0xaa9e('0x26')](function(_0x3daf0d){_0x4f057e[_0xaa9e('0x21')]=_0x3daf0d;if(_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3f')]){_0xd00ecf[_0xaa9e('0x40')]=[{'all':!![]}];}return db[_0xaa9e('0x2d')]['findAll'](_0xd00ecf);})['then'](function(_0x17cd5b){_0x4f057e[_0xaa9e('0x41')]=_0x17cd5b;return _0x4f057e;})[_0xaa9e('0x26')](respondWithFilteredResult(_0x44aac7,_0xd00ecf))[_0xaa9e('0x42')](handleError(_0x44aac7,null));};exports['show']=function(_0x5eefc9,_0x428de6){var _0x22517e={'raw':![],'where':{'id':_0x5eefc9[_0xaa9e('0x43')]['id']}},_0x48fb0f={};_0x48fb0f[_0xaa9e('0x30')]=_[_0xaa9e('0x44')](db['FreshsalesConfiguration']['rawAttributes']);_0x48fb0f[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5eefc9[_0xaa9e('0x32')]);_0x48fb0f[_0xaa9e('0x33')]=_[_0xaa9e('0x35')](_0x48fb0f[_0xaa9e('0x30')],_0x48fb0f['query']);_0x22517e[_0xaa9e('0x34')]=_['intersection'](_0x48fb0f[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5eefc9[_0xaa9e('0x32')][_0xaa9e('0x36')]));_0x22517e[_0xaa9e('0x34')]=_0x22517e[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x22517e[_0xaa9e('0x34')]:_0x48fb0f['model'];if(_0x5eefc9[_0xaa9e('0x32')][_0xaa9e('0x3f')]){_0x22517e['include']=[{'all':!![]}];}_0x22517e=_[_0xaa9e('0x3d')]({},_0x22517e,_0x5eefc9[_0xaa9e('0x45')]);return db[_0xaa9e('0x2d')][_0xaa9e('0x46')](_0x22517e)[_0xaa9e('0x26')](handleEntityNotFound(_0x428de6,null))['then'](respondWithResult(_0x428de6,null))['catch'](handleError(_0x428de6,null));};exports[_0xaa9e('0x47')]=function(_0x2867f3,_0x5d4407){return db[_0xaa9e('0x2d')][_0xaa9e('0x47')](_0x2867f3[_0xaa9e('0x48')],{})[_0xaa9e('0x26')](respondWithResult(_0x5d4407,0xc9))[_0xaa9e('0x42')](handleError(_0x5d4407,null));};exports[_0xaa9e('0x49')]=function(_0x12be09,_0x51d374){if(_0x12be09[_0xaa9e('0x48')]['id']){delete _0x12be09['body']['id'];}return db[_0xaa9e('0x2d')][_0xaa9e('0x46')]({'where':{'id':_0x12be09[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x51d374,null))[_0xaa9e('0x26')](saveUpdates(_0x12be09[_0xaa9e('0x48')],null))[_0xaa9e('0x26')](respondWithResult(_0x51d374,null))[_0xaa9e('0x42')](handleError(_0x51d374,null));};exports[_0xaa9e('0x27')]=function(_0x16e3ee,_0x371b7d){return db[_0xaa9e('0x2d')]['find']({'where':{'id':_0x16e3ee['params']['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x371b7d,null))[_0xaa9e('0x26')](removeEntity(_0x371b7d,null))['catch'](handleError(_0x371b7d,null));};exports[_0xaa9e('0x4a')]=function(_0x5c54e2,_0x139f69,_0x470bbd){var _0x17c32d={};var _0xac5f80={};var _0x3ff7b9;var _0x1d6ea1;return db[_0xaa9e('0x2d')]['findOne']({'where':{'id':_0x5c54e2[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x139f69,null))[_0xaa9e('0x26')](function(_0x30d616){if(_0x30d616){_0x3ff7b9=_0x30d616;_0xac5f80['model']=_[_0xaa9e('0x44')](db[_0xaa9e('0x4b')][_0xaa9e('0x4c')]);_0xac5f80[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5c54e2[_0xaa9e('0x32')]);_0xac5f80['filters']=_['intersection'](_0xac5f80[_0xaa9e('0x30')],_0xac5f80[_0xaa9e('0x32')]);_0x17c32d[_0xaa9e('0x34')]=_['intersection'](_0xac5f80[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x36')]));_0x17c32d[_0xaa9e('0x34')]=_0x17c32d[_0xaa9e('0x34')]['length']?_0x17c32d[_0xaa9e('0x34')]:_0xac5f80[_0xaa9e('0x30')];_0x17c32d[_0xaa9e('0x4d')]=qs[_0xaa9e('0x3a')](_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0x17c32d[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_[_0xaa9e('0x4e')](_0x5c54e2['query'],_0xac5f80['filters']));if(_0x5c54e2['query'][_0xaa9e('0x3c')]){_0x17c32d[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0x17c32d['where'],{'$or':_[_0xaa9e('0x31')](_0x17c32d[_0xaa9e('0x34')],function(_0x5ea305){var _0x6cc721={};_0x6cc721[_0x5ea305]={'$like':'%'+_0x5c54e2['query'][_0xaa9e('0x3c')]+'%'};return _0x6cc721;})});}_0x17c32d=_['merge']({},_0x17c32d,_0x5c54e2[_0xaa9e('0x45')]);return _0x3ff7b9['getSubjects'](_0x17c32d);}})[_0xaa9e('0x26')](function(_0x3c0704){if(_0x3c0704){_0x1d6ea1=_0x3c0704[_0xaa9e('0x37')];if(!_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x38')]('nolimit')){_0x17c32d[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x5c54e2['query'][_0xaa9e('0x20')]);_0x17c32d['offset']=qs[_0xaa9e('0x1e')](_0x5c54e2['query'][_0xaa9e('0x1e')]);}return _0x3ff7b9[_0xaa9e('0x4a')](_0x17c32d);}})[_0xaa9e('0x26')](function(_0x193095){if(_0x193095){return _0x193095?{'count':_0x1d6ea1,'rows':_0x193095}:null;}})['then'](respondWithResult(_0x139f69,null))['catch'](handleError(_0x139f69,null));};exports[_0xaa9e('0x4f')]=function(_0x13c5f3,_0x3b6fc3,_0x9ef3a0){var _0x25a107={};var _0x4b2a57={};var _0x5d9404;var _0x38d148;return db[_0xaa9e('0x2d')][_0xaa9e('0x50')]({'where':{'id':_0x13c5f3[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x3b6fc3,null))[_0xaa9e('0x26')](function(_0x5928c8){if(_0x5928c8){_0x5d9404=_0x5928c8;_0x4b2a57[_0xaa9e('0x30')]=_[_0xaa9e('0x44')](db[_0xaa9e('0x4b')][_0xaa9e('0x4c')]);_0x4b2a57[_0xaa9e('0x32')]=_['keys'](_0x13c5f3[_0xaa9e('0x32')]);_0x4b2a57['filters']=_['intersection'](_0x4b2a57['model'],_0x4b2a57['query']);_0x25a107[_0xaa9e('0x34')]=_['intersection'](_0x4b2a57[_0xaa9e('0x30')],qs['fields'](_0x13c5f3['query']['fields']));_0x25a107['attributes']=_0x25a107[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x25a107[_0xaa9e('0x34')]:_0x4b2a57[_0xaa9e('0x30')];_0x25a107[_0xaa9e('0x4d')]=qs[_0xaa9e('0x3a')](_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0x25a107[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_[_0xaa9e('0x4e')](_0x13c5f3['query'],_0x4b2a57[_0xaa9e('0x33')]));if(_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x3c')]){_0x25a107[_0xaa9e('0x3b')]=_['merge'](_0x25a107[_0xaa9e('0x3b')],{'$or':_[_0xaa9e('0x31')](_0x25a107[_0xaa9e('0x34')],function(_0x71e63){var _0x20afe5={};_0x20afe5[_0x71e63]={'$like':'%'+_0x13c5f3[_0xaa9e('0x32')]['filter']+'%'};return _0x20afe5;})});}_0x25a107=_[_0xaa9e('0x3d')]({},_0x25a107,_0x13c5f3[_0xaa9e('0x45')]);return _0x5d9404['getDescriptions'](_0x25a107);}})[_0xaa9e('0x26')](function(_0xa41933){if(_0xa41933){_0x38d148=_0xa41933['length'];if(!_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0x25a107[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x20')]);_0x25a107['offset']=qs['offset'](_0x13c5f3['query']['offset']);}return _0x5d9404[_0xaa9e('0x4f')](_0x25a107);}})[_0xaa9e('0x26')](function(_0x38be4d){if(_0x38be4d){return _0x38be4d?{'count':_0x38d148,'rows':_0x38be4d}:null;}})[_0xaa9e('0x26')](respondWithResult(_0x3b6fc3,null))[_0xaa9e('0x42')](handleError(_0x3b6fc3,null));};exports[_0xaa9e('0x51')]=function(_0x5bdb96,_0x322791,_0x192509){var _0x58a8ba={};var _0x472c85={};var _0x1ad5e5;var _0x14d72c;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5bdb96[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x322791,null))['then'](function(_0xa2751d){if(_0xa2751d){_0x1ad5e5=_0xa2751d;_0x472c85['model']=_[_0xaa9e('0x44')](db['FreshsalesField'][_0xaa9e('0x4c')]);_0x472c85[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5bdb96[_0xaa9e('0x32')]);_0x472c85[_0xaa9e('0x33')]=_[_0xaa9e('0x35')](_0x472c85[_0xaa9e('0x30')],_0x472c85['query']);_0x58a8ba[_0xaa9e('0x34')]=_[_0xaa9e('0x35')](_0x472c85[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5bdb96['query'][_0xaa9e('0x36')]));_0x58a8ba[_0xaa9e('0x34')]=_0x58a8ba[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x58a8ba[_0xaa9e('0x34')]:_0x472c85[_0xaa9e('0x30')];_0x58a8ba[_0xaa9e('0x4d')]=qs['sort'](_0x5bdb96[_0xaa9e('0x32')]['sort']);_0x58a8ba[_0xaa9e('0x3b')]=qs['filters'](_['pick'](_0x5bdb96[_0xaa9e('0x32')],_0x472c85[_0xaa9e('0x33')]));if(_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x3c')]){_0x58a8ba[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0x58a8ba[_0xaa9e('0x3b')],{'$or':_['map'](_0x58a8ba[_0xaa9e('0x34')],function(_0x4ad239){var _0x4d9685={};_0x4d9685[_0x4ad239]={'$like':'%'+_0x5bdb96['query'][_0xaa9e('0x3c')]+'%'};return _0x4d9685;})});}_0x58a8ba=_[_0xaa9e('0x3d')]({},_0x58a8ba,_0x5bdb96[_0xaa9e('0x45')]);return _0x1ad5e5[_0xaa9e('0x51')](_0x58a8ba);}})[_0xaa9e('0x26')](function(_0x190848){if(_0x190848){_0x14d72c=_0x190848[_0xaa9e('0x37')];if(!_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0x58a8ba[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x5bdb96['query'][_0xaa9e('0x20')]);_0x58a8ba['offset']=qs[_0xaa9e('0x1e')](_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x1e')]);}return _0x1ad5e5[_0xaa9e('0x51')](_0x58a8ba);}})['then'](function(_0x1bb98c){if(_0x1bb98c){return _0x1bb98c?{'count':_0x14d72c,'rows':_0x1bb98c}:null;}})[_0xaa9e('0x26')](respondWithResult(_0x322791,null))[_0xaa9e('0x42')](handleError(_0x322791,null));}; \ No newline at end of file +var _0x7112=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','include','rows','catch','show','FreshsalesConfiguration','includeAll','find','create','body','params','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x7f0f0e,_0x41c39b){var _0x5a3ac8=function(_0x50b86e){while(--_0x50b86e){_0x7f0f0e['push'](_0x7f0f0e['shift']());}};_0x5a3ac8(++_0x41c39b);}(_0x7112,0x1d3));var _0x2711=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7112[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2711('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2711('0x1'));var jsonpatch=require(_0x2711('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2711('0x3'));var Mustache=require(_0x2711('0x4'));var util=require('util');var path=require(_0x2711('0x5'));var sox=require('sox');var csv=require(_0x2711('0x6'));var ejs=require(_0x2711('0x7'));var fs=require('fs');var fs_extra=require(_0x2711('0x8'));var _=require('lodash');var squel=require(_0x2711('0x9'));var crypto=require(_0x2711('0xa'));var jsforce=require(_0x2711('0xb'));var deskjs=require(_0x2711('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2711('0xd'));var Papa=require(_0x2711('0xe'));var Redis=require('ioredis');var authService=require(_0x2711('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2711('0x10'));var logger=require(_0x2711('0x11'))(_0x2711('0x12'));var utils=require(_0x2711('0x13'));var config=require(_0x2711('0x14'));var licenseUtil=require(_0x2711('0x15'));var db=require(_0x2711('0x16'))['db'];function respondWithStatusCode(_0x3a94fd,_0x3936d2){_0x3936d2=_0x3936d2||0xcc;return function(_0x3d62f0){if(_0x3d62f0){return _0x3a94fd[_0x2711('0x17')](_0x3936d2);}return _0x3a94fd[_0x2711('0x18')](_0x3936d2)[_0x2711('0x19')]();};}function respondWithResult(_0x5eeac9,_0x1594e2){_0x1594e2=_0x1594e2||0xc8;return function(_0x7c2d6d){if(_0x7c2d6d){return _0x5eeac9[_0x2711('0x18')](_0x1594e2)[_0x2711('0x1a')](_0x7c2d6d);}};}function respondWithFilteredResult(_0x9ec76d,_0x648aab){return function(_0x2544fe){if(_0x2544fe){var _0x3c2f02=typeof _0x648aab[_0x2711('0x1b')]===_0x2711('0x1c')&&typeof _0x648aab[_0x2711('0x1d')]===_0x2711('0x1c');var _0x2fc7a6=_0x2544fe[_0x2711('0x1e')];var _0x2aecc7=_0x3c2f02?0x0:_0x648aab[_0x2711('0x1b')];var _0x21885d=_0x3c2f02?_0x2544fe[_0x2711('0x1e')]:_0x648aab[_0x2711('0x1b')]+_0x648aab[_0x2711('0x1d')];var _0x29454a;if(_0x21885d>=_0x2fc7a6){_0x21885d=_0x2fc7a6;_0x29454a=0xc8;}else{_0x29454a=0xce;}_0x9ec76d[_0x2711('0x18')](_0x29454a);return _0x9ec76d[_0x2711('0x1f')](_0x2711('0x20'),_0x2aecc7+'-'+_0x21885d+'/'+_0x2fc7a6)[_0x2711('0x1a')](_0x2544fe);}return null;};}function patchUpdates(_0x1ee9df){return function(_0x14cf6c){try{jsonpatch[_0x2711('0x21')](_0x14cf6c,_0x1ee9df,!![]);}catch(_0xc0b4ec){return BPromise[_0x2711('0x22')](_0xc0b4ec);}return _0x14cf6c[_0x2711('0x23')]();};}function saveUpdates(_0x3bc5f8,_0x398cf8){return function(_0x15e5f3){if(_0x15e5f3){return _0x15e5f3[_0x2711('0x24')](_0x3bc5f8)[_0x2711('0x25')](function(_0x3fa4b6){return _0x3fa4b6;});}return null;};}function removeEntity(_0x3c231c,_0x155255){return function(_0xa898e4){if(_0xa898e4){return _0xa898e4[_0x2711('0x26')]()[_0x2711('0x25')](function(){_0x3c231c[_0x2711('0x18')](0xcc)[_0x2711('0x19')]();});}};}function handleEntityNotFound(_0x5c91f3,_0x1d4c69){return function(_0x4f0f24){if(!_0x4f0f24){_0x5c91f3[_0x2711('0x17')](0x194);}return _0x4f0f24;};}function handleError(_0x1f04ad,_0x4677ea){_0x4677ea=_0x4677ea||0x1f4;return function(_0xdc5a19){logger['error'](_0xdc5a19[_0x2711('0x27')]);if(_0xdc5a19[_0x2711('0x28')]){delete _0xdc5a19[_0x2711('0x28')];}_0x1f04ad[_0x2711('0x18')](_0x4677ea)[_0x2711('0x29')](_0xdc5a19);};}exports[_0x2711('0x2a')]=function(_0x5c0f63,_0x5e7285){var _0x120497={},_0x38d9bd={},_0x5bca6f={'count':0x0,'rows':[]};var _0x9e836c=_[_0x2711('0x2b')](db['FreshsalesConfiguration'][_0x2711('0x2c')],function(_0x2e1893){return{'name':_0x2e1893[_0x2711('0x2d')],'type':_0x2e1893['type'][_0x2711('0x2e')]};});_0x38d9bd[_0x2711('0x2f')]=_[_0x2711('0x2b')](_0x9e836c,_0x2711('0x28'));_0x38d9bd[_0x2711('0x30')]=_[_0x2711('0x31')](_0x5c0f63[_0x2711('0x30')]);_0x38d9bd[_0x2711('0x32')]=_['intersection'](_0x38d9bd[_0x2711('0x2f')],_0x38d9bd[_0x2711('0x30')]);_0x120497[_0x2711('0x33')]=_[_0x2711('0x34')](_0x38d9bd[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x5c0f63[_0x2711('0x30')]['fields']));_0x120497[_0x2711('0x33')]=_0x120497[_0x2711('0x33')][_0x2711('0x36')]?_0x120497[_0x2711('0x33')]:_0x38d9bd[_0x2711('0x2f')];if(!_0x5c0f63[_0x2711('0x30')][_0x2711('0x37')](_0x2711('0x38'))){_0x120497[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x5c0f63[_0x2711('0x30')][_0x2711('0x1d')]);_0x120497['offset']=qs[_0x2711('0x1b')](_0x5c0f63[_0x2711('0x30')]['offset']);}_0x120497['order']=qs[_0x2711('0x39')](_0x5c0f63['query'][_0x2711('0x39')]);_0x120497['where']=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x5c0f63[_0x2711('0x30')],_0x38d9bd[_0x2711('0x32')]),_0x9e836c);if(_0x5c0f63[_0x2711('0x30')][_0x2711('0x3b')]){_0x120497[_0x2711('0x3c')]=_['merge'](_0x120497[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x9e836c,function(_0x54e31b){if(_0x54e31b[_0x2711('0x3d')]!==_0x2711('0x3e')){var _0x4b4ae3={};_0x4b4ae3[_0x54e31b[_0x2711('0x28')]]={'$like':'%'+_0x5c0f63[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x4b4ae3;}})});}_0x120497=_[_0x2711('0x3f')]({},_0x120497,_0x5c0f63[_0x2711('0x40')]);var _0x169a09={'where':_0x120497[_0x2711('0x3c')]};return db['FreshsalesConfiguration']['count'](_0x169a09)[_0x2711('0x25')](function(_0x31f0af){_0x5bca6f[_0x2711('0x1e')]=_0x31f0af;if(_0x5c0f63[_0x2711('0x30')]['includeAll']){_0x120497[_0x2711('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x120497);})['then'](function(_0x1d15bf){_0x5bca6f[_0x2711('0x42')]=_0x1d15bf;return _0x5bca6f;})[_0x2711('0x25')](respondWithFilteredResult(_0x5e7285,_0x120497))[_0x2711('0x43')](handleError(_0x5e7285,null));};exports[_0x2711('0x44')]=function(_0x45ad67,_0x5403e6){var _0x5a851d={'raw':![],'where':{'id':_0x45ad67['params']['id']}},_0x2e18a5={};_0x2e18a5[_0x2711('0x2f')]=_['keys'](db[_0x2711('0x45')]['rawAttributes']);_0x2e18a5[_0x2711('0x30')]=_[_0x2711('0x31')](_0x45ad67[_0x2711('0x30')]);_0x2e18a5[_0x2711('0x32')]=_[_0x2711('0x34')](_0x2e18a5['model'],_0x2e18a5[_0x2711('0x30')]);_0x5a851d['attributes']=_[_0x2711('0x34')](_0x2e18a5[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x45ad67['query'][_0x2711('0x35')]));_0x5a851d['attributes']=_0x5a851d[_0x2711('0x33')]['length']?_0x5a851d[_0x2711('0x33')]:_0x2e18a5['model'];if(_0x45ad67[_0x2711('0x30')][_0x2711('0x46')]){_0x5a851d[_0x2711('0x41')]=[{'all':!![]}];}_0x5a851d=_[_0x2711('0x3f')]({},_0x5a851d,_0x45ad67[_0x2711('0x40')]);return db[_0x2711('0x45')][_0x2711('0x47')](_0x5a851d)['then'](handleEntityNotFound(_0x5403e6,null))[_0x2711('0x25')](respondWithResult(_0x5403e6,null))[_0x2711('0x43')](handleError(_0x5403e6,null));};exports['create']=function(_0x350e5f,_0x4b7b1e){return db[_0x2711('0x45')][_0x2711('0x48')](_0x350e5f[_0x2711('0x49')],{})['then'](respondWithResult(_0x4b7b1e,0xc9))[_0x2711('0x43')](handleError(_0x4b7b1e,null));};exports[_0x2711('0x24')]=function(_0x2f8f55,_0x455744){if(_0x2f8f55[_0x2711('0x49')]['id']){delete _0x2f8f55[_0x2711('0x49')]['id'];}return db[_0x2711('0x45')]['find']({'where':{'id':_0x2f8f55['params']['id']}})['then'](handleEntityNotFound(_0x455744,null))['then'](saveUpdates(_0x2f8f55[_0x2711('0x49')],null))['then'](respondWithResult(_0x455744,null))[_0x2711('0x43')](handleError(_0x455744,null));};exports[_0x2711('0x26')]=function(_0x4b7c0c,_0x1f2308){return db[_0x2711('0x45')][_0x2711('0x47')]({'where':{'id':_0x4b7c0c[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x1f2308,null))[_0x2711('0x25')](removeEntity(_0x1f2308,null))[_0x2711('0x43')](handleError(_0x1f2308,null));};exports[_0x2711('0x4b')]=function(_0x174830,_0x269039,_0x3b890d){var _0x49ffac={};var _0x1bdbfb={};var _0x1ddee6;var _0x3f4ab3;return db[_0x2711('0x45')][_0x2711('0x4c')]({'where':{'id':_0x174830[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x269039,null))['then'](function(_0xe4a2ad){if(_0xe4a2ad){_0x1ddee6=_0xe4a2ad;_0x1bdbfb[_0x2711('0x2f')]=_['keys'](db[_0x2711('0x4d')]['rawAttributes']);_0x1bdbfb[_0x2711('0x30')]=_[_0x2711('0x31')](_0x174830['query']);_0x1bdbfb[_0x2711('0x32')]=_[_0x2711('0x34')](_0x1bdbfb['model'],_0x1bdbfb[_0x2711('0x30')]);_0x49ffac['attributes']=_[_0x2711('0x34')](_0x1bdbfb[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x174830['query']['fields']));_0x49ffac[_0x2711('0x33')]=_0x49ffac[_0x2711('0x33')]['length']?_0x49ffac[_0x2711('0x33')]:_0x1bdbfb[_0x2711('0x2f')];_0x49ffac[_0x2711('0x4e')]=qs[_0x2711('0x39')](_0x174830[_0x2711('0x30')]['sort']);_0x49ffac['where']=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x174830[_0x2711('0x30')],_0x1bdbfb[_0x2711('0x32')]));if(_0x174830[_0x2711('0x30')][_0x2711('0x3b')]){_0x49ffac['where']=_[_0x2711('0x3f')](_0x49ffac[_0x2711('0x3c')],{'$or':_['map'](_0x49ffac[_0x2711('0x33')],function(_0x1c0a2a){var _0x454030={};_0x454030[_0x1c0a2a]={'$like':'%'+_0x174830['query'][_0x2711('0x3b')]+'%'};return _0x454030;})});}_0x49ffac=_[_0x2711('0x3f')]({},_0x49ffac,_0x174830[_0x2711('0x40')]);return _0x1ddee6[_0x2711('0x4b')](_0x49ffac);}})[_0x2711('0x25')](function(_0x10bb72){if(_0x10bb72){_0x3f4ab3=_0x10bb72[_0x2711('0x36')];if(!_0x174830[_0x2711('0x30')][_0x2711('0x37')]('nolimit')){_0x49ffac[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x174830[_0x2711('0x30')][_0x2711('0x1d')]);_0x49ffac['offset']=qs['offset'](_0x174830[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x1ddee6[_0x2711('0x4b')](_0x49ffac);}})[_0x2711('0x25')](function(_0x2f0578){if(_0x2f0578){return _0x2f0578?{'count':_0x3f4ab3,'rows':_0x2f0578}:null;}})[_0x2711('0x25')](respondWithResult(_0x269039,null))[_0x2711('0x43')](handleError(_0x269039,null));};exports['getDescriptions']=function(_0x1e8df8,_0x2ec374,_0x540006){var _0x5e82b9={};var _0x48510d={};var _0x4a427e;var _0x121d1e;return db[_0x2711('0x45')][_0x2711('0x4c')]({'where':{'id':_0x1e8df8[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x2ec374,null))[_0x2711('0x25')](function(_0x430c51){if(_0x430c51){_0x4a427e=_0x430c51;_0x48510d['model']=_[_0x2711('0x31')](db[_0x2711('0x4d')]['rawAttributes']);_0x48510d[_0x2711('0x30')]=_['keys'](_0x1e8df8[_0x2711('0x30')]);_0x48510d[_0x2711('0x32')]=_[_0x2711('0x34')](_0x48510d[_0x2711('0x2f')],_0x48510d[_0x2711('0x30')]);_0x5e82b9[_0x2711('0x33')]=_[_0x2711('0x34')](_0x48510d[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x35')]));_0x5e82b9[_0x2711('0x33')]=_0x5e82b9['attributes']['length']?_0x5e82b9['attributes']:_0x48510d[_0x2711('0x2f')];_0x5e82b9[_0x2711('0x4e')]=qs[_0x2711('0x39')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x39')]);_0x5e82b9[_0x2711('0x3c')]=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x1e8df8[_0x2711('0x30')],_0x48510d[_0x2711('0x32')]));if(_0x1e8df8[_0x2711('0x30')][_0x2711('0x3b')]){_0x5e82b9[_0x2711('0x3c')]=_[_0x2711('0x3f')](_0x5e82b9[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x5e82b9[_0x2711('0x33')],function(_0x27d901){var _0x215542={};_0x215542[_0x27d901]={'$like':'%'+_0x1e8df8[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x215542;})});}_0x5e82b9=_[_0x2711('0x3f')]({},_0x5e82b9,_0x1e8df8[_0x2711('0x40')]);return _0x4a427e[_0x2711('0x4f')](_0x5e82b9);}})[_0x2711('0x25')](function(_0x5a996d){if(_0x5a996d){_0x121d1e=_0x5a996d[_0x2711('0x36')];if(!_0x1e8df8['query'][_0x2711('0x37')]('nolimit')){_0x5e82b9[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x1d')]);_0x5e82b9[_0x2711('0x1b')]=qs[_0x2711('0x1b')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x4a427e[_0x2711('0x4f')](_0x5e82b9);}})['then'](function(_0x14e08a){if(_0x14e08a){return _0x14e08a?{'count':_0x121d1e,'rows':_0x14e08a}:null;}})[_0x2711('0x25')](respondWithResult(_0x2ec374,null))[_0x2711('0x43')](handleError(_0x2ec374,null));};exports[_0x2711('0x50')]=function(_0x33420e,_0x3605c2,_0x721e16){var _0x40bdd7={};var _0x2ad33e={};var _0x540a5a;var _0x41d968;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x33420e['params']['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x3605c2,null))[_0x2711('0x25')](function(_0xd69448){if(_0xd69448){_0x540a5a=_0xd69448;_0x2ad33e[_0x2711('0x2f')]=_['keys'](db['FreshsalesField'][_0x2711('0x2c')]);_0x2ad33e[_0x2711('0x30')]=_[_0x2711('0x31')](_0x33420e[_0x2711('0x30')]);_0x2ad33e[_0x2711('0x32')]=_['intersection'](_0x2ad33e[_0x2711('0x2f')],_0x2ad33e[_0x2711('0x30')]);_0x40bdd7[_0x2711('0x33')]=_[_0x2711('0x34')](_0x2ad33e['model'],qs[_0x2711('0x35')](_0x33420e[_0x2711('0x30')][_0x2711('0x35')]));_0x40bdd7[_0x2711('0x33')]=_0x40bdd7[_0x2711('0x33')]['length']?_0x40bdd7[_0x2711('0x33')]:_0x2ad33e[_0x2711('0x2f')];_0x40bdd7['order']=qs[_0x2711('0x39')](_0x33420e['query'][_0x2711('0x39')]);_0x40bdd7[_0x2711('0x3c')]=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x33420e[_0x2711('0x30')],_0x2ad33e['filters']));if(_0x33420e[_0x2711('0x30')][_0x2711('0x3b')]){_0x40bdd7['where']=_[_0x2711('0x3f')](_0x40bdd7[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x40bdd7[_0x2711('0x33')],function(_0x44bff4){var _0x286669={};_0x286669[_0x44bff4]={'$like':'%'+_0x33420e[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x286669;})});}_0x40bdd7=_['merge']({},_0x40bdd7,_0x33420e[_0x2711('0x40')]);return _0x540a5a[_0x2711('0x50')](_0x40bdd7);}})[_0x2711('0x25')](function(_0x5bd974){if(_0x5bd974){_0x41d968=_0x5bd974['length'];if(!_0x33420e['query']['hasOwnProperty']('nolimit')){_0x40bdd7[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x33420e[_0x2711('0x30')]['limit']);_0x40bdd7[_0x2711('0x1b')]=qs[_0x2711('0x1b')](_0x33420e[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x540a5a[_0x2711('0x50')](_0x40bdd7);}})[_0x2711('0x25')](function(_0x4827fd){if(_0x4827fd){return _0x4827fd?{'count':_0x41d968,'rows':_0x4827fd}:null;}})[_0x2711('0x25')](respondWithResult(_0x3605c2,null))['catch'](handleError(_0x3605c2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4241c37..44b643e 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 _0x3c9e=['moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x3c9e,0x1d1));var _0xe3c9=function(_0x3e1ffb,_0x16d000){_0x3e1ffb=_0x3e1ffb-0x0;var _0x4a28c6=_0x3c9e[_0x3e1ffb];return _0x4a28c6;};'use strict';var _=require(_0xe3c9('0x0'));var util=require(_0xe3c9('0x1'));var logger=require(_0xe3c9('0x2'))('api');var moment=require(_0xe3c9('0x3'));var BPromise=require(_0xe3c9('0x4'));var rp=require(_0xe3c9('0x5'));var fs=require('fs');var path=require(_0xe3c9('0x6'));var rimraf=require('rimraf');var config=require(_0xe3c9('0x7'));var attributes=require(_0xe3c9('0x8'));module[_0xe3c9('0x9')]=function(_0xfb73c1,_0x305246){return _0xfb73c1[_0xe3c9('0xa')](_0xe3c9('0xb'),attributes,{'tableName':_0xe3c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9493=['request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','api','moment','bluebird'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9493,0xee));var _0x3949=function(_0x1e5631,_0x2fe6f2){_0x1e5631=_0x1e5631-0x0;var _0x3e1c7d=_0x9493[_0x1e5631];return _0x3e1c7d;};'use strict';var _=require(_0x3949('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3949('0x1'));var moment=require(_0x3949('0x2'));var BPromise=require(_0x3949('0x3'));var rp=require(_0x3949('0x4'));var fs=require('fs');var path=require(_0x3949('0x5'));var rimraf=require(_0x3949('0x6'));var config=require('../../config/environment');var attributes=require(_0x3949('0x7'));module[_0x3949('0x8')]=function(_0x11de4c,_0x4bca10){return _0x11de4c['define'](_0x3949('0x9'),attributes,{'tableName':_0x3949('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index dc3806a..68830aa 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 _0x6c49=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0x6c49,0xd4));var _0x96c4=function(_0x228ab8,_0x5098c9){_0x228ab8=_0x228ab8-0x0;var _0xb73004=_0x6c49[_0x228ab8];return _0xb73004;};'use strict';var _=require(_0x96c4('0x0'));var util=require(_0x96c4('0x1'));var moment=require(_0x96c4('0x2'));var BPromise=require(_0x96c4('0x3'));var rs=require(_0x96c4('0x4'));var fs=require('fs');var Redis=require(_0x96c4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96c4('0x6'));var logger=require(_0x96c4('0x7'))(_0x96c4('0x8'));var config=require(_0x96c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96c4('0xa')][_0x96c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3707da,_0x43d223,_0x58fd27){return new BPromise(function(_0x42b279,_0x4a9405){return client['request'](_0x3707da,_0x58fd27)[_0x96c4('0xc')](function(_0x2daaa1){logger[_0x96c4('0xd')](_0x96c4('0xe'),_0x43d223,_0x96c4('0xf'));logger[_0x96c4('0x10')](_0x96c4('0x11'),_0x43d223,_0x96c4('0xf'),JSON[_0x96c4('0x12')](_0x2daaa1));if(_0x2daaa1[_0x96c4('0x13')]){if(_0x2daaa1['error'][_0x96c4('0x14')]===0x1f4){logger[_0x96c4('0x13')](_0x96c4('0xe'),_0x43d223,_0x2daaa1['error'][_0x96c4('0x15')]);return _0x4a9405(_0x2daaa1[_0x96c4('0x13')][_0x96c4('0x15')]);}logger['error'](_0x96c4('0xe'),_0x43d223,_0x2daaa1[_0x96c4('0x13')]['message']);return _0x42b279(_0x2daaa1[_0x96c4('0x13')]['message']);}else{logger[_0x96c4('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x43d223,_0x96c4('0xf'));_0x42b279(_0x2daaa1[_0x96c4('0x16')][_0x96c4('0x15')]);}})[_0x96c4('0x17')](function(_0x5822d0){logger[_0x96c4('0x13')](_0x96c4('0xe'),_0x43d223,_0x5822d0);_0x4a9405(_0x5822d0);});});} \ No newline at end of file +var _0x86a7=['rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x86a7,0x6b));var _0x786a=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x86a7[_0x371b64];return _0x3cf3b1;};'use strict';var _=require(_0x786a('0x0'));var util=require(_0x786a('0x1'));var moment=require(_0x786a('0x2'));var BPromise=require(_0x786a('0x3'));var rs=require(_0x786a('0x4'));var fs=require('fs');var Redis=require(_0x786a('0x5'));var db=require(_0x786a('0x6'))['db'];var utils=require(_0x786a('0x7'));var logger=require('../../config/logger')(_0x786a('0x8'));var config=require('../../config/environment');var jayson=require(_0x786a('0x9'));var client=jayson[_0x786a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f987,_0x2f1be8,_0x4f39d6){return new BPromise(function(_0xad5d68,_0x4e8c4a){return client[_0x786a('0xb')](_0x41f987,_0x4f39d6)[_0x786a('0xc')](function(_0x3f1416){logger['info'](_0x786a('0xd'),_0x2f1be8,'request\x20sent');logger[_0x786a('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2f1be8,_0x786a('0xf'),JSON[_0x786a('0x10')](_0x3f1416));if(_0x3f1416[_0x786a('0x11')]){if(_0x3f1416[_0x786a('0x11')][_0x786a('0x12')]===0x1f4){logger[_0x786a('0x11')](_0x786a('0xd'),_0x2f1be8,_0x3f1416['error'][_0x786a('0x13')]);return _0x4e8c4a(_0x3f1416['error']['message']);}logger['error'](_0x786a('0xd'),_0x2f1be8,_0x3f1416[_0x786a('0x11')][_0x786a('0x13')]);return _0xad5d68(_0x3f1416[_0x786a('0x11')]['message']);}else{logger[_0x786a('0x14')](_0x786a('0xd'),_0x2f1be8,_0x786a('0xf'));_0xad5d68(_0x3f1416[_0x786a('0x15')][_0x786a('0x13')]);}})[_0x786a('0x16')](function(_0x106692){logger['error'](_0x786a('0xd'),_0x2f1be8,_0x106692);_0x4e8c4a(_0x106692);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5f3411f..b57aa33 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 _0x9099=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x5ac682,_0x40927){var _0x40218e=function(_0x710a6f){while(--_0x710a6f){_0x5ac682['push'](_0x5ac682['shift']());}};_0x40218e(++_0x40927);}(_0x9099,0x1ac));var _0x9909=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x9099[_0x7feb90];return _0x3c5b33;};'use strict';var multer=require(_0x9909('0x0'));var util=require('util');var path=require(_0x9909('0x1'));var timeout=require(_0x9909('0x2'));var express=require(_0x9909('0x3'));var router=express[_0x9909('0x4')]();var fs_extra=require(_0x9909('0x5'));var auth=require(_0x9909('0x6'));var interaction=require(_0x9909('0x7'));var config=require(_0x9909('0x8'));var controller=require(_0x9909('0x9'));router[_0x9909('0xa')]('/',auth[_0x9909('0xb')](),controller[_0x9909('0xc')]);router[_0x9909('0xa')](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0xf')]);router[_0x9909('0x10')](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0x11')]);module['exports']=router; \ No newline at end of file +var _0x063c=['/:id','show','post','create','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x40dc59,_0x542c9b){var _0x4b7854=function(_0x2f67b8){while(--_0x2f67b8){_0x40dc59['push'](_0x40dc59['shift']());}};_0x4b7854(++_0x542c9b);}(_0x063c,0xba));var _0xc063=function(_0x256e76,_0x2486ac){_0x256e76=_0x256e76-0x0;var _0x5adecf=_0x063c[_0x256e76];return _0x5adecf;};'use strict';var multer=require('multer');var util=require(_0xc063('0x0'));var path=require(_0xc063('0x1'));var timeout=require(_0xc063('0x2'));var express=require(_0xc063('0x3'));var router=express[_0xc063('0x4')]();var fs_extra=require(_0xc063('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc063('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xc063('0x7')](),controller[_0xc063('0x8')]);router['get'](_0xc063('0x9'),auth[_0xc063('0x7')](),controller[_0xc063('0xa')]);router[_0xc063('0xb')]('/',auth['isAuthenticated'](),controller[_0xc063('0xc')]);router[_0xc063('0xd')]('/:id',auth[_0xc063('0x7')](),controller[_0xc063('0xe')]);router['delete'](_0xc063('0x9'),auth['isAuthenticated'](),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 096a29a..db2d1b9 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 _0xccf1=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xccf1,0x1e6));var _0x1ccf=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xccf1[_0x1ee351];return _0x245aaf;};'use strict';var Sequelize=require('sequelize');module[_0x1ccf('0x0')]={'type':{'type':Sequelize[_0x1ccf('0x1')](_0x1ccf('0x2'),_0x1ccf('0x3'),_0x1ccf('0x4'),_0x1ccf('0x5'),_0x1ccf('0x6')),'defaultValue':_0x1ccf('0x2')},'content':{'type':Sequelize[_0x1ccf('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1ccf('0x1')]('string',_0x1ccf('0x3'),_0x1ccf('0x4'))},'keyContent':{'type':Sequelize[_0x1ccf('0x7')]},'idField':{'type':Sequelize[_0x1ccf('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1ccf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b0b=['keyValue','picklist','STRING','variable','exports','ENUM','string','customVariable'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9b0b,0x144));var _0xb9b0=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x9b0b[_0x8e8ca7];return _0x561381;};'use strict';var Sequelize=require('sequelize');module[_0xb9b0('0x0')]={'type':{'type':Sequelize[_0xb9b0('0x1')](_0xb9b0('0x2'),'variable',_0xb9b0('0x3'),_0xb9b0('0x4'),_0xb9b0('0x5')),'defaultValue':_0xb9b0('0x2')},'content':{'type':Sequelize[_0xb9b0('0x6')]},'key':{'type':Sequelize[_0xb9b0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb9b0('0x2'),_0xb9b0('0x7'),_0xb9b0('0x3'))},'keyContent':{'type':Sequelize[_0xb9b0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb9b0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9b0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 87faa7e..a9994d3 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 _0xab40=['send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','FreshsalesField','includeAll','include','rows','catch','show','params','find','create','body','request-promise','bluebird','mustache','util','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name'];(function(_0x29b35c,_0x2001c5){var _0x5ab131=function(_0x4afc0a){while(--_0x4afc0a){_0x29b35c['push'](_0x29b35c['shift']());}};_0x5ab131(++_0x2001c5);}(_0xab40,0x135));var _0x0ab4=function(_0x649db,_0x54de3a){_0x649db=_0x649db-0x0;var _0x513406=_0xab40[_0x649db];return _0x513406;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab4('0x0'));var moment=require('moment');var BPromise=require(_0x0ab4('0x1'));var Mustache=require(_0x0ab4('0x2'));var util=require(_0x0ab4('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x4'));var fs=require('fs');var fs_extra=require(_0x0ab4('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ab4('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ab4('0x7'));var Papa=require(_0x0ab4('0x8'));var Redis=require('ioredis');var authService=require(_0x0ab4('0x9'));var qs=require(_0x0ab4('0xa'));var as=require(_0x0ab4('0xb'));var hardwareService=require(_0x0ab4('0xc'));var logger=require(_0x0ab4('0xd'))(_0x0ab4('0xe'));var utils=require(_0x0ab4('0xf'));var config=require(_0x0ab4('0x10'));var licenseUtil=require(_0x0ab4('0x11'));var db=require(_0x0ab4('0x12'))['db'];function respondWithStatusCode(_0x571645,_0x118d2f){_0x118d2f=_0x118d2f||0xcc;return function(_0x48af0a){if(_0x48af0a){return _0x571645[_0x0ab4('0x13')](_0x118d2f);}return _0x571645['status'](_0x118d2f)['end']();};}function respondWithResult(_0x45672c,_0x2a717e){_0x2a717e=_0x2a717e||0xc8;return function(_0x13b7dd){if(_0x13b7dd){return _0x45672c[_0x0ab4('0x14')](_0x2a717e)['json'](_0x13b7dd);}};}function respondWithFilteredResult(_0x5aa99a,_0x13c071){return function(_0x22dede){if(_0x22dede){var _0x13999a=typeof _0x13c071[_0x0ab4('0x15')]===_0x0ab4('0x16')&&typeof _0x13c071[_0x0ab4('0x17')]==='undefined';var _0x5bebb8=_0x22dede[_0x0ab4('0x18')];var _0x486659=_0x13999a?0x0:_0x13c071[_0x0ab4('0x15')];var _0x563750=_0x13999a?_0x22dede['count']:_0x13c071[_0x0ab4('0x15')]+_0x13c071[_0x0ab4('0x17')];var _0xb01023;if(_0x563750>=_0x5bebb8){_0x563750=_0x5bebb8;_0xb01023=0xc8;}else{_0xb01023=0xce;}_0x5aa99a[_0x0ab4('0x14')](_0xb01023);return _0x5aa99a[_0x0ab4('0x19')](_0x0ab4('0x1a'),_0x486659+'-'+_0x563750+'/'+_0x5bebb8)[_0x0ab4('0x1b')](_0x22dede);}return null;};}function patchUpdates(_0x4ce39b){return function(_0x105994){try{jsonpatch[_0x0ab4('0x1c')](_0x105994,_0x4ce39b,!![]);}catch(_0x41bbf9){return BPromise['reject'](_0x41bbf9);}return _0x105994[_0x0ab4('0x1d')]();};}function saveUpdates(_0x29cadd,_0x42ab42){return function(_0x1337d6){if(_0x1337d6){return _0x1337d6[_0x0ab4('0x1e')](_0x29cadd)[_0x0ab4('0x1f')](function(_0x164c38){return _0x164c38;});}return null;};}function removeEntity(_0x12873d,_0x21376d){return function(_0x7b8d98){if(_0x7b8d98){return _0x7b8d98[_0x0ab4('0x20')]()['then'](function(){_0x12873d[_0x0ab4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5afa74,_0x27e9be){return function(_0x3256b6){if(!_0x3256b6){_0x5afa74[_0x0ab4('0x13')](0x194);}return _0x3256b6;};}function handleError(_0x5d4ee3,_0x1491b0){_0x1491b0=_0x1491b0||0x1f4;return function(_0x16a81d){logger[_0x0ab4('0x21')](_0x16a81d[_0x0ab4('0x22')]);if(_0x16a81d['name']){delete _0x16a81d[_0x0ab4('0x23')];}_0x5d4ee3[_0x0ab4('0x14')](_0x1491b0)[_0x0ab4('0x24')](_0x16a81d);};}exports[_0x0ab4('0x25')]=function(_0x35c90e,_0x3f80ec){var _0x57ab4a={},_0x4e4607={},_0x5ec76a={'count':0x0,'rows':[]};var _0x30683c=_[_0x0ab4('0x26')](db['FreshsalesField'][_0x0ab4('0x27')],function(_0x33b94c){return{'name':_0x33b94c[_0x0ab4('0x28')],'type':_0x33b94c[_0x0ab4('0x29')]['key']};});_0x4e4607[_0x0ab4('0x2a')]=_[_0x0ab4('0x26')](_0x30683c,_0x0ab4('0x23'));_0x4e4607['query']=_[_0x0ab4('0x2b')](_0x35c90e[_0x0ab4('0x2c')]);_0x4e4607['filters']=_[_0x0ab4('0x2d')](_0x4e4607[_0x0ab4('0x2a')],_0x4e4607[_0x0ab4('0x2c')]);_0x57ab4a['attributes']=_[_0x0ab4('0x2d')](_0x4e4607[_0x0ab4('0x2a')],qs[_0x0ab4('0x2e')](_0x35c90e[_0x0ab4('0x2c')][_0x0ab4('0x2e')]));_0x57ab4a[_0x0ab4('0x2f')]=_0x57ab4a[_0x0ab4('0x2f')][_0x0ab4('0x30')]?_0x57ab4a[_0x0ab4('0x2f')]:_0x4e4607[_0x0ab4('0x2a')];if(!_0x35c90e['query'][_0x0ab4('0x31')](_0x0ab4('0x32'))){_0x57ab4a['limit']=qs[_0x0ab4('0x17')](_0x35c90e['query']['limit']);_0x57ab4a['offset']=qs[_0x0ab4('0x15')](_0x35c90e['query'][_0x0ab4('0x15')]);}_0x57ab4a[_0x0ab4('0x33')]=qs[_0x0ab4('0x34')](_0x35c90e['query'][_0x0ab4('0x34')]);_0x57ab4a['where']=qs[_0x0ab4('0x35')](_[_0x0ab4('0x36')](_0x35c90e[_0x0ab4('0x2c')],_0x4e4607[_0x0ab4('0x35')]),_0x30683c);if(_0x35c90e['query'][_0x0ab4('0x37')]){_0x57ab4a['where']=_[_0x0ab4('0x38')](_0x57ab4a[_0x0ab4('0x39')],{'$or':_['map'](_0x30683c,function(_0xc1b688){if(_0xc1b688['type']!=='VIRTUAL'){var _0xce0aa7={};_0xce0aa7[_0xc1b688[_0x0ab4('0x23')]]={'$like':'%'+_0x35c90e[_0x0ab4('0x2c')]['filter']+'%'};return _0xce0aa7;}})});}_0x57ab4a=_['merge']({},_0x57ab4a,_0x35c90e[_0x0ab4('0x3a')]);var _0x4140b6={'where':_0x57ab4a[_0x0ab4('0x39')]};return db[_0x0ab4('0x3b')][_0x0ab4('0x18')](_0x4140b6)[_0x0ab4('0x1f')](function(_0x2d7e2d){_0x5ec76a[_0x0ab4('0x18')]=_0x2d7e2d;if(_0x35c90e['query'][_0x0ab4('0x3c')]){_0x57ab4a[_0x0ab4('0x3d')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x57ab4a);})[_0x0ab4('0x1f')](function(_0x3ea4ce){_0x5ec76a[_0x0ab4('0x3e')]=_0x3ea4ce;return _0x5ec76a;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3f80ec,_0x57ab4a))[_0x0ab4('0x3f')](handleError(_0x3f80ec,null));};exports[_0x0ab4('0x40')]=function(_0x97a36a,_0x56db79){var _0x529a9c={'raw':!![],'where':{'id':_0x97a36a[_0x0ab4('0x41')]['id']}},_0xf57d10={};_0xf57d10['model']=_[_0x0ab4('0x2b')](db[_0x0ab4('0x3b')][_0x0ab4('0x27')]);_0xf57d10['query']=_['keys'](_0x97a36a['query']);_0xf57d10[_0x0ab4('0x35')]=_[_0x0ab4('0x2d')](_0xf57d10[_0x0ab4('0x2a')],_0xf57d10[_0x0ab4('0x2c')]);_0x529a9c[_0x0ab4('0x2f')]=_[_0x0ab4('0x2d')](_0xf57d10[_0x0ab4('0x2a')],qs[_0x0ab4('0x2e')](_0x97a36a[_0x0ab4('0x2c')]['fields']));_0x529a9c[_0x0ab4('0x2f')]=_0x529a9c['attributes'][_0x0ab4('0x30')]?_0x529a9c[_0x0ab4('0x2f')]:_0xf57d10[_0x0ab4('0x2a')];if(_0x97a36a[_0x0ab4('0x2c')][_0x0ab4('0x3c')]){_0x529a9c['include']=[{'all':!![]}];}_0x529a9c=_[_0x0ab4('0x38')]({},_0x529a9c,_0x97a36a['options']);return db[_0x0ab4('0x3b')][_0x0ab4('0x42')](_0x529a9c)['then'](handleEntityNotFound(_0x56db79,null))[_0x0ab4('0x1f')](respondWithResult(_0x56db79,null))[_0x0ab4('0x3f')](handleError(_0x56db79,null));};exports[_0x0ab4('0x43')]=function(_0x2e419f,_0x21665d){return db['FreshsalesField'][_0x0ab4('0x43')](_0x2e419f['body'],{})[_0x0ab4('0x1f')](respondWithResult(_0x21665d,0xc9))['catch'](handleError(_0x21665d,null));};exports['update']=function(_0x5ccd84,_0x4e38f1){if(_0x5ccd84[_0x0ab4('0x44')]['id']){delete _0x5ccd84[_0x0ab4('0x44')]['id'];}return db[_0x0ab4('0x3b')][_0x0ab4('0x42')]({'where':{'id':_0x5ccd84['params']['id']}})['then'](handleEntityNotFound(_0x4e38f1,null))[_0x0ab4('0x1f')](saveUpdates(_0x5ccd84[_0x0ab4('0x44')],null))['then'](respondWithResult(_0x4e38f1,null))[_0x0ab4('0x3f')](handleError(_0x4e38f1,null));};exports[_0x0ab4('0x20')]=function(_0x3ce2ad,_0x83c954){return db[_0x0ab4('0x3b')]['find']({'where':{'id':_0x3ce2ad[_0x0ab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x83c954,null))[_0x0ab4('0x1f')](removeEntity(_0x83c954,null))['catch'](handleError(_0x83c954,null));}; \ No newline at end of file +var _0x116c=['index','map','FreshsalesField','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send'];(function(_0x4c1777,_0x36722e){var _0xe1c938=function(_0x56cbb5){while(--_0x56cbb5){_0x4c1777['push'](_0x4c1777['shift']());}};_0xe1c938(++_0x36722e);}(_0x116c,0x73));var _0xc116=function(_0x1c15bc,_0x22a6af){_0x1c15bc=_0x1c15bc-0x0;var _0x1cfa66=_0x116c[_0x1c15bc];return _0x1cfa66;};'use strict';var emlformat=require(_0xc116('0x0'));var rimraf=require(_0xc116('0x1'));var zipdir=require(_0xc116('0x2'));var jsonpatch=require(_0xc116('0x3'));var rp=require(_0xc116('0x4'));var moment=require(_0xc116('0x5'));var BPromise=require(_0xc116('0x6'));var Mustache=require('mustache');var util=require(_0xc116('0x7'));var path=require('path');var sox=require(_0xc116('0x8'));var csv=require(_0xc116('0x9'));var ejs=require(_0xc116('0xa'));var fs=require('fs');var fs_extra=require(_0xc116('0xb'));var _=require(_0xc116('0xc'));var squel=require(_0xc116('0xd'));var crypto=require('crypto');var jsforce=require(_0xc116('0xe'));var deskjs=require(_0xc116('0xf'));var toCsv=require(_0xc116('0x9'));var querystring=require(_0xc116('0x10'));var Papa=require(_0xc116('0x11'));var Redis=require('ioredis');var authService=require(_0xc116('0x12'));var qs=require(_0xc116('0x13'));var as=require(_0xc116('0x14'));var hardwareService=require(_0xc116('0x15'));var logger=require(_0xc116('0x16'))(_0xc116('0x17'));var utils=require(_0xc116('0x18'));var config=require(_0xc116('0x19'));var licenseUtil=require(_0xc116('0x1a'));var db=require(_0xc116('0x1b'))['db'];function respondWithStatusCode(_0x108424,_0x3c002b){_0x3c002b=_0x3c002b||0xcc;return function(_0x9da3ac){if(_0x9da3ac){return _0x108424[_0xc116('0x1c')](_0x3c002b);}return _0x108424[_0xc116('0x1d')](_0x3c002b)[_0xc116('0x1e')]();};}function respondWithResult(_0x572284,_0x269b22){_0x269b22=_0x269b22||0xc8;return function(_0xfe8c8d){if(_0xfe8c8d){return _0x572284[_0xc116('0x1d')](_0x269b22)[_0xc116('0x1f')](_0xfe8c8d);}};}function respondWithFilteredResult(_0x25d2f3,_0xaf37cf){return function(_0x458e27){if(_0x458e27){var _0x167848=typeof _0xaf37cf['offset']===_0xc116('0x20')&&typeof _0xaf37cf[_0xc116('0x21')]===_0xc116('0x20');var _0x1624f9=_0x458e27[_0xc116('0x22')];var _0x15501a=_0x167848?0x0:_0xaf37cf[_0xc116('0x23')];var _0x152a1e=_0x167848?_0x458e27[_0xc116('0x22')]:_0xaf37cf[_0xc116('0x23')]+_0xaf37cf[_0xc116('0x21')];var _0x2413a;if(_0x152a1e>=_0x1624f9){_0x152a1e=_0x1624f9;_0x2413a=0xc8;}else{_0x2413a=0xce;}_0x25d2f3[_0xc116('0x1d')](_0x2413a);return _0x25d2f3[_0xc116('0x24')](_0xc116('0x25'),_0x15501a+'-'+_0x152a1e+'/'+_0x1624f9)['json'](_0x458e27);}return null;};}function patchUpdates(_0xdd027b){return function(_0x5650d8){try{jsonpatch[_0xc116('0x26')](_0x5650d8,_0xdd027b,!![]);}catch(_0x5559f9){return BPromise[_0xc116('0x27')](_0x5559f9);}return _0x5650d8[_0xc116('0x28')]();};}function saveUpdates(_0x53eaeb,_0x1093a8){return function(_0x3a240d){if(_0x3a240d){return _0x3a240d['update'](_0x53eaeb)['then'](function(_0x3a4fb0){return _0x3a4fb0;});}return null;};}function removeEntity(_0x55268a,_0xb85607){return function(_0x5e7bef){if(_0x5e7bef){return _0x5e7bef[_0xc116('0x29')]()[_0xc116('0x2a')](function(){_0x55268a[_0xc116('0x1d')](0xcc)[_0xc116('0x1e')]();});}};}function handleEntityNotFound(_0x42ad65,_0x10011e){return function(_0x4e877f){if(!_0x4e877f){_0x42ad65[_0xc116('0x1c')](0x194);}return _0x4e877f;};}function handleError(_0x4e5b09,_0x4ca614){_0x4ca614=_0x4ca614||0x1f4;return function(_0x4cb21b){logger[_0xc116('0x2b')](_0x4cb21b[_0xc116('0x2c')]);if(_0x4cb21b[_0xc116('0x2d')]){delete _0x4cb21b[_0xc116('0x2d')];}_0x4e5b09[_0xc116('0x1d')](_0x4ca614)[_0xc116('0x2e')](_0x4cb21b);};}exports[_0xc116('0x2f')]=function(_0x4a0d11,_0x3a0050){var _0x514c29={},_0x427b4f={},_0x394d24={'count':0x0,'rows':[]};var _0x20243a=_[_0xc116('0x30')](db[_0xc116('0x31')][_0xc116('0x32')],function(_0x12fcf8){return{'name':_0x12fcf8[_0xc116('0x33')],'type':_0x12fcf8['type'][_0xc116('0x34')]};});_0x427b4f['model']=_['map'](_0x20243a,_0xc116('0x2d'));_0x427b4f['query']=_[_0xc116('0x35')](_0x4a0d11[_0xc116('0x36')]);_0x427b4f['filters']=_[_0xc116('0x37')](_0x427b4f['model'],_0x427b4f['query']);_0x514c29[_0xc116('0x38')]=_[_0xc116('0x37')](_0x427b4f[_0xc116('0x39')],qs[_0xc116('0x3a')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x3a')]));_0x514c29[_0xc116('0x38')]=_0x514c29[_0xc116('0x38')][_0xc116('0x3b')]?_0x514c29['attributes']:_0x427b4f['model'];if(!_0x4a0d11[_0xc116('0x36')][_0xc116('0x3c')](_0xc116('0x3d'))){_0x514c29['limit']=qs[_0xc116('0x21')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x21')]);_0x514c29[_0xc116('0x23')]=qs[_0xc116('0x23')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x23')]);}_0x514c29['order']=qs[_0xc116('0x3e')](_0x4a0d11[_0xc116('0x36')]['sort']);_0x514c29['where']=qs['filters'](_[_0xc116('0x3f')](_0x4a0d11[_0xc116('0x36')],_0x427b4f[_0xc116('0x40')]),_0x20243a);if(_0x4a0d11['query'][_0xc116('0x41')]){_0x514c29[_0xc116('0x42')]=_[_0xc116('0x43')](_0x514c29[_0xc116('0x42')],{'$or':_['map'](_0x20243a,function(_0x34f5d1){if(_0x34f5d1[_0xc116('0x44')]!=='VIRTUAL'){var _0x1a6d4d={};_0x1a6d4d[_0x34f5d1[_0xc116('0x2d')]]={'$like':'%'+_0x4a0d11[_0xc116('0x36')][_0xc116('0x41')]+'%'};return _0x1a6d4d;}})});}_0x514c29=_[_0xc116('0x43')]({},_0x514c29,_0x4a0d11[_0xc116('0x45')]);var _0x28c3dc={'where':_0x514c29[_0xc116('0x42')]};return db[_0xc116('0x31')][_0xc116('0x22')](_0x28c3dc)[_0xc116('0x2a')](function(_0x3824aa){_0x394d24[_0xc116('0x22')]=_0x3824aa;if(_0x4a0d11[_0xc116('0x36')][_0xc116('0x46')]){_0x514c29[_0xc116('0x47')]=[{'all':!![]}];}return db[_0xc116('0x31')][_0xc116('0x48')](_0x514c29);})[_0xc116('0x2a')](function(_0x13b76d){_0x394d24[_0xc116('0x49')]=_0x13b76d;return _0x394d24;})['then'](respondWithFilteredResult(_0x3a0050,_0x514c29))[_0xc116('0x4a')](handleError(_0x3a0050,null));};exports[_0xc116('0x4b')]=function(_0x3fc989,_0x463b7c){var _0x5754a3={'raw':!![],'where':{'id':_0x3fc989[_0xc116('0x4c')]['id']}},_0x3fabe5={};_0x3fabe5['model']=_['keys'](db[_0xc116('0x31')][_0xc116('0x32')]);_0x3fabe5[_0xc116('0x36')]=_['keys'](_0x3fc989[_0xc116('0x36')]);_0x3fabe5['filters']=_[_0xc116('0x37')](_0x3fabe5['model'],_0x3fabe5[_0xc116('0x36')]);_0x5754a3['attributes']=_[_0xc116('0x37')](_0x3fabe5[_0xc116('0x39')],qs[_0xc116('0x3a')](_0x3fc989[_0xc116('0x36')]['fields']));_0x5754a3[_0xc116('0x38')]=_0x5754a3[_0xc116('0x38')][_0xc116('0x3b')]?_0x5754a3[_0xc116('0x38')]:_0x3fabe5[_0xc116('0x39')];if(_0x3fc989[_0xc116('0x36')][_0xc116('0x46')]){_0x5754a3[_0xc116('0x47')]=[{'all':!![]}];}_0x5754a3=_[_0xc116('0x43')]({},_0x5754a3,_0x3fc989[_0xc116('0x45')]);return db[_0xc116('0x31')][_0xc116('0x4d')](_0x5754a3)[_0xc116('0x2a')](handleEntityNotFound(_0x463b7c,null))['then'](respondWithResult(_0x463b7c,null))['catch'](handleError(_0x463b7c,null));};exports[_0xc116('0x4e')]=function(_0x368a59,_0xf4e8c7){return db[_0xc116('0x31')][_0xc116('0x4e')](_0x368a59[_0xc116('0x4f')],{})[_0xc116('0x2a')](respondWithResult(_0xf4e8c7,0xc9))[_0xc116('0x4a')](handleError(_0xf4e8c7,null));};exports[_0xc116('0x50')]=function(_0x37cfbd,_0x2596a9){if(_0x37cfbd['body']['id']){delete _0x37cfbd[_0xc116('0x4f')]['id'];}return db[_0xc116('0x31')][_0xc116('0x4d')]({'where':{'id':_0x37cfbd[_0xc116('0x4c')]['id']}})[_0xc116('0x2a')](handleEntityNotFound(_0x2596a9,null))[_0xc116('0x2a')](saveUpdates(_0x37cfbd[_0xc116('0x4f')],null))[_0xc116('0x2a')](respondWithResult(_0x2596a9,null))[_0xc116('0x4a')](handleError(_0x2596a9,null));};exports[_0xc116('0x29')]=function(_0x7eafdf,_0x4ab340){return db[_0xc116('0x31')]['find']({'where':{'id':_0x7eafdf[_0xc116('0x4c')]['id']}})[_0xc116('0x2a')](handleEntityNotFound(_0x4ab340,null))[_0xc116('0x2a')](removeEntity(_0x4ab340,null))[_0xc116('0x4a')](handleError(_0x4ab340,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0c9fb44..42059a3 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 _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x5dd71d,_0x849e85){var _0x510182=function(_0x47defe){while(--_0x47defe){_0x5dd71d['push'](_0x5dd71d['shift']());}};_0x510182(++_0x849e85);}(_0x5464,0x15d));var _0x4546=function(_0x4a7fed,_0x3a3d7a){_0x4a7fed=_0x4a7fed-0x0;var _0x270075=_0x5464[_0x4a7fed];return _0x270075;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fea=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x7fea,0x149));var _0xa7fe=function(_0x47c11f,_0x325d7c){_0x47c11f=_0x47c11f-0x0;var _0x1cf0ed=_0x7fea[_0x47c11f];return _0x1cf0ed;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rp=require(_0xa7fe('0x3'));var fs=require('fs');var path=require(_0xa7fe('0x4'));var rimraf=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xa7fe('0x7')]=function(_0x2bcfad,_0x1fbc99){return _0x2bcfad[_0xa7fe('0x8')](_0xa7fe('0x9'),attributes,{'tableName':_0xa7fe('0xa'),'paranoid':![],'indexes':[{'name':_0xa7fe('0xb'),'fields':[_0xa7fe('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index a979f54..fd91da0 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x56deef,_0x1c92d3){var _0x336bc8=function(_0x59e4c8){while(--_0x59e4c8){_0x56deef['push'](_0x56deef['shift']());}};_0x336bc8(++_0x1c92d3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x26d097,_0x44bf71){_0x26d097=_0x26d097-0x0;var _0x44d762=_0xdbf5[_0x26d097];return _0x44d762;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x410830,_0x1554a7){var _0x496bfc=function(_0x30494b){while(--_0x30494b){_0x410830['push'](_0x410830['shift']());}};_0x496bfc(++_0x1554a7);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 10c5974..00fb107 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x26db6c,_0x1f5699){var _0x17972a=function(_0x16f749){while(--_0x16f749){_0x26db6c['push'](_0x26db6c['shift']());}};_0x17972a(++_0x1f5699);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1314fa,_0x12447e){var _0x59a9b0=function(_0x59ad9c){while(--_0x59ad9c){_0x1314fa['push'](_0x1314fa['shift']());}};_0x59a9b0(++_0x12447e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4366a0e..ae69c54 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 _0x1a21=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x526ab1,_0x137bfa){var _0x411007=function(_0x4e0dff){while(--_0x4e0dff){_0x526ab1['push'](_0x526ab1['shift']());}};_0x411007(++_0x137bfa);}(_0x1a21,0x1d9));var _0x11a2=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x1a21[_0x50cd41];return _0x399475;};'use strict';var Sequelize=require(_0x11a2('0x0'));module[_0x11a2('0x1')]={'name':{'type':Sequelize[_0x11a2('0x2')]},'description':{'type':Sequelize[_0x11a2('0x2')]},'username':{'type':Sequelize[_0x11a2('0x2')],'unique':_0x11a2('0x3')},'remoteUri':{'type':Sequelize[_0x11a2('0x2')]},'password':{'type':Sequelize[_0x11a2('0x2')]},'clientId':{'type':Sequelize[_0x11a2('0x2')]},'clientSecret':{'type':Sequelize[_0x11a2('0x2')]},'securityToken':{'type':Sequelize[_0x11a2('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x11a2('0x4')](_0x11a2('0x5'),_0x11a2('0x6')),'defaultValue':_0x11a2('0x5')}}; \ No newline at end of file +var _0xbaef=['ENUM','newTab','STRING','username'];(function(_0x2b17cf,_0x3e620e){var _0x1feeb5=function(_0x2ee26d){while(--_0x2ee26d){_0x2b17cf['push'](_0x2b17cf['shift']());}};_0x1feeb5(++_0x3e620e);}(_0xbaef,0xae));var _0xfbae=function(_0x19d920,_0x4300b4){_0x19d920=_0x19d920-0x0;var _0x7ad1d5=_0xbaef[_0x19d920];return _0x7ad1d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfbae('0x0')]},'description':{'type':Sequelize[_0xfbae('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xfbae('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfbae('0x0')]},'clientId':{'type':Sequelize[_0xfbae('0x0')]},'clientSecret':{'type':Sequelize[_0xfbae('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfbae('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfbae('0x2')]('integrationTab',_0xfbae('0x3')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 88eb98e..746d820 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 _0x5714=['key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','Task','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','concat','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Description','int','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type'];(function(_0x1da33a,_0x3b20a0){var _0x2a2e78=function(_0x17f0ee){while(--_0x17f0ee){_0x1da33a['push'](_0x1da33a['shift']());}};_0x2a2e78(++_0x3b20a0);}(_0x5714,0xc3));var _0x4571=function(_0x434498,_0x2110c3){_0x434498=_0x434498-0x0;var _0x36e62a=_0x5714[_0x434498];return _0x36e62a;};'use strict';var emlformat=require(_0x4571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4571('0x1'));var jsonpatch=require(_0x4571('0x2'));var rp=require(_0x4571('0x3'));var moment=require(_0x4571('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4571('0x5'));var path=require(_0x4571('0x6'));var sox=require(_0x4571('0x7'));var csv=require('to-csv');var ejs=require(_0x4571('0x8'));var fs=require('fs');var fs_extra=require(_0x4571('0x9'));var _=require(_0x4571('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4571('0xb'));var deskjs=require(_0x4571('0xc'));var toCsv=require(_0x4571('0xd'));var querystring=require(_0x4571('0xe'));var Papa=require(_0x4571('0xf'));var Redis=require(_0x4571('0x10'));var authService=require(_0x4571('0x11'));var qs=require(_0x4571('0x12'));var as=require(_0x4571('0x13'));var hardwareService=require(_0x4571('0x14'));var logger=require('../../config/logger')(_0x4571('0x15'));var utils=require('../../config/utils');var config=require(_0x4571('0x16'));var licenseUtil=require(_0x4571('0x17'));var db=require(_0x4571('0x18'))['db'];var integrations=require(_0x4571('0x19'));function respondWithStatusCode(_0x113510,_0x3eff1a){_0x3eff1a=_0x3eff1a||0xcc;return function(_0x2753b3){if(_0x2753b3){return _0x113510[_0x4571('0x1a')](_0x3eff1a);}return _0x113510[_0x4571('0x1b')](_0x3eff1a)[_0x4571('0x1c')]();};}function respondWithResult(_0x12f6fa,_0x564c99){_0x564c99=_0x564c99||0xc8;return function(_0x323165){if(_0x323165){return _0x12f6fa[_0x4571('0x1b')](_0x564c99)[_0x4571('0x1d')](_0x323165);}};}function respondWithFilteredResult(_0x298e50,_0x36c014){return function(_0x52ddbd){if(_0x52ddbd){var _0x1bbf20=typeof _0x36c014[_0x4571('0x1e')]===_0x4571('0x1f')&&typeof _0x36c014[_0x4571('0x20')]==='undefined';var _0x5879e6=_0x52ddbd[_0x4571('0x21')];var _0x147f24=_0x1bbf20?0x0:_0x36c014[_0x4571('0x1e')];var _0x169c2a=_0x1bbf20?_0x52ddbd[_0x4571('0x21')]:_0x36c014[_0x4571('0x1e')]+_0x36c014['limit'];var _0x4d0fb3;if(_0x169c2a>=_0x5879e6){_0x169c2a=_0x5879e6;_0x4d0fb3=0xc8;}else{_0x4d0fb3=0xce;}_0x298e50[_0x4571('0x1b')](_0x4d0fb3);return _0x298e50[_0x4571('0x22')]('Content-Range',_0x147f24+'-'+_0x169c2a+'/'+_0x5879e6)[_0x4571('0x1d')](_0x52ddbd);}return null;};}function patchUpdates(_0x45a5b7){return function(_0x53190b){try{jsonpatch[_0x4571('0x23')](_0x53190b,_0x45a5b7,!![]);}catch(_0x182601){return BPromise['reject'](_0x182601);}return _0x53190b[_0x4571('0x24')]();};}function saveUpdates(_0x1e122f,_0x5e6a32){return function(_0x1e92a8){if(_0x1e92a8){return _0x1e92a8[_0x4571('0x25')](_0x1e122f)[_0x4571('0x26')](function(_0x5ba437){return _0x5ba437;});}return null;};}function removeEntity(_0x5592e1,_0x15d0e2){return function(_0x3f8959){if(_0x3f8959){return _0x3f8959[_0x4571('0x27')]()[_0x4571('0x26')](function(){_0x5592e1[_0x4571('0x1b')](0xcc)[_0x4571('0x1c')]();});}};}function handleEntityNotFound(_0xd7dc85,_0x5075e0){return function(_0x114e73){if(!_0x114e73){_0xd7dc85[_0x4571('0x1a')](0x194);}return _0x114e73;};}function handleError(_0x2d6d98,_0x3a26a7){_0x3a26a7=_0x3a26a7||0x1f4;return function(_0x43011a){logger[_0x4571('0x28')](_0x43011a[_0x4571('0x29')]);if(_0x43011a[_0x4571('0x2a')]){delete _0x43011a[_0x4571('0x2a')];}_0x2d6d98[_0x4571('0x1b')](_0x3a26a7)[_0x4571('0x2b')](_0x43011a);};}exports[_0x4571('0x2c')]=function(_0x4e572b,_0x3cb9b6){var _0x1196e5={},_0x1a0d08={},_0x5b2782={'count':0x0,'rows':[]};var _0x17a356=_[_0x4571('0x2d')](db[_0x4571('0x2e')]['rawAttributes'],function(_0x1466ef){return{'name':_0x1466ef[_0x4571('0x2f')],'type':_0x1466ef[_0x4571('0x30')][_0x4571('0x31')]};});_0x1a0d08[_0x4571('0x32')]=_['map'](_0x17a356,'name');_0x1a0d08[_0x4571('0x33')]=_[_0x4571('0x34')](_0x4e572b[_0x4571('0x33')]);_0x1a0d08[_0x4571('0x35')]=_[_0x4571('0x36')](_0x1a0d08[_0x4571('0x32')],_0x1a0d08[_0x4571('0x33')]);_0x1196e5[_0x4571('0x37')]=_[_0x4571('0x36')](_0x1a0d08[_0x4571('0x32')],qs[_0x4571('0x38')](_0x4e572b[_0x4571('0x33')][_0x4571('0x38')]));_0x1196e5[_0x4571('0x37')]=_0x1196e5[_0x4571('0x37')]['length']?_0x1196e5['attributes']:_0x1a0d08[_0x4571('0x32')];if(!_0x4e572b[_0x4571('0x33')]['hasOwnProperty'](_0x4571('0x39'))){_0x1196e5['limit']=qs[_0x4571('0x20')](_0x4e572b[_0x4571('0x33')][_0x4571('0x20')]);_0x1196e5['offset']=qs['offset'](_0x4e572b[_0x4571('0x33')]['offset']);}_0x1196e5[_0x4571('0x3a')]=qs[_0x4571('0x3b')](_0x4e572b['query']['sort']);_0x1196e5[_0x4571('0x3c')]=qs[_0x4571('0x35')](_[_0x4571('0x3d')](_0x4e572b['query'],_0x1a0d08['filters']),_0x17a356);if(_0x4e572b[_0x4571('0x33')][_0x4571('0x3e')]){_0x1196e5[_0x4571('0x3c')]=_[_0x4571('0x3f')](_0x1196e5[_0x4571('0x3c')],{'$or':_[_0x4571('0x2d')](_0x17a356,function(_0x5d90ec){if(_0x5d90ec[_0x4571('0x30')]!==_0x4571('0x40')){var _0x14773b={};_0x14773b[_0x5d90ec['name']]={'$like':'%'+_0x4e572b[_0x4571('0x33')][_0x4571('0x3e')]+'%'};return _0x14773b;}})});}_0x1196e5=_['merge']({},_0x1196e5,_0x4e572b[_0x4571('0x41')]);var _0x3390de={'where':_0x1196e5['where']};return db[_0x4571('0x2e')][_0x4571('0x21')](_0x3390de)[_0x4571('0x26')](function(_0x8ad232){_0x5b2782['count']=_0x8ad232;if(_0x4e572b[_0x4571('0x33')][_0x4571('0x42')]){_0x1196e5[_0x4571('0x43')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x1196e5);})[_0x4571('0x26')](function(_0x555156){_0x5b2782[_0x4571('0x44')]=_0x555156;return _0x5b2782;})[_0x4571('0x26')](respondWithFilteredResult(_0x3cb9b6,_0x1196e5))[_0x4571('0x45')](handleError(_0x3cb9b6,null));};exports[_0x4571('0x46')]=function(_0x2a56b6,_0x3f82bc){var _0x2f6ed7={'raw':![],'where':{'id':_0x2a56b6[_0x4571('0x47')]['id']}},_0x3e99e0={};_0x3e99e0[_0x4571('0x32')]=_[_0x4571('0x34')](db[_0x4571('0x2e')][_0x4571('0x48')]);_0x3e99e0[_0x4571('0x33')]=_[_0x4571('0x34')](_0x2a56b6[_0x4571('0x33')]);_0x3e99e0['filters']=_[_0x4571('0x36')](_0x3e99e0[_0x4571('0x32')],_0x3e99e0[_0x4571('0x33')]);_0x2f6ed7[_0x4571('0x37')]=_[_0x4571('0x36')](_0x3e99e0['model'],qs[_0x4571('0x38')](_0x2a56b6[_0x4571('0x33')]['fields']));_0x2f6ed7[_0x4571('0x37')]=_0x2f6ed7['attributes']['length']?_0x2f6ed7['attributes']:_0x3e99e0[_0x4571('0x32')];if(_0x2a56b6[_0x4571('0x33')][_0x4571('0x42')]){_0x2f6ed7[_0x4571('0x43')]=[{'all':!![]}];}_0x2f6ed7=_[_0x4571('0x3f')]({},_0x2f6ed7,_0x2a56b6[_0x4571('0x41')]);return db[_0x4571('0x2e')][_0x4571('0x49')](_0x2f6ed7)['then'](handleEntityNotFound(_0x3f82bc,null))['then'](respondWithResult(_0x3f82bc,null))[_0x4571('0x45')](handleError(_0x3f82bc,null));};exports[_0x4571('0x4a')]=function(_0x5b55a4,_0xab151c){return db[_0x4571('0x2e')][_0x4571('0x4a')](_0x5b55a4[_0x4571('0x4b')],{})[_0x4571('0x26')](respondWithResult(_0xab151c,0xc9))[_0x4571('0x45')](handleError(_0xab151c,null));};exports[_0x4571('0x25')]=function(_0x570f6a,_0x559093){if(_0x570f6a[_0x4571('0x4b')]['id']){delete _0x570f6a[_0x4571('0x4b')]['id'];}return db[_0x4571('0x2e')][_0x4571('0x49')]({'where':{'id':_0x570f6a['params']['id']}})['then'](handleEntityNotFound(_0x559093,null))[_0x4571('0x26')](saveUpdates(_0x570f6a[_0x4571('0x4b')],null))[_0x4571('0x26')](respondWithResult(_0x559093,null))['catch'](handleError(_0x559093,null));};exports[_0x4571('0x27')]=function(_0x486434,_0x25af5c){return db[_0x4571('0x2e')]['find']({'where':{'id':_0x486434[_0x4571('0x47')]['id']}})[_0x4571('0x26')](handleEntityNotFound(_0x25af5c,null))[_0x4571('0x26')](removeEntity(_0x25af5c,null))[_0x4571('0x45')](handleError(_0x25af5c,null));};exports[_0x4571('0x4c')]=function(_0x571c61,_0x4579c7,_0x13e909){var _0x1f2ee2={};var _0x513176={};var _0xf57919;var _0x3b185d;return db[_0x4571('0x2e')][_0x4571('0x4d')]({'where':{'id':_0x571c61[_0x4571('0x47')]['id']}})[_0x4571('0x26')](handleEntityNotFound(_0x4579c7,null))[_0x4571('0x26')](function(_0x105e21){if(_0x105e21){_0xf57919=_0x105e21;_0x513176['model']=_['keys'](db[_0x4571('0x4e')][_0x4571('0x48')]);_0x513176[_0x4571('0x33')]=_[_0x4571('0x34')](_0x571c61[_0x4571('0x33')]);_0x513176[_0x4571('0x35')]=_['intersection'](_0x513176[_0x4571('0x32')],_0x513176[_0x4571('0x33')]);_0x1f2ee2['attributes']=_['intersection'](_0x513176[_0x4571('0x32')],qs[_0x4571('0x38')](_0x571c61[_0x4571('0x33')][_0x4571('0x38')]));_0x1f2ee2[_0x4571('0x37')]=_0x1f2ee2[_0x4571('0x37')][_0x4571('0x4f')]?_0x1f2ee2['attributes']:_0x513176[_0x4571('0x32')];_0x1f2ee2[_0x4571('0x3a')]=qs[_0x4571('0x3b')](_0x571c61['query']['sort']);_0x1f2ee2[_0x4571('0x3c')]=qs[_0x4571('0x35')](_['pick'](_0x571c61[_0x4571('0x33')],_0x513176['filters']));if(_0x571c61[_0x4571('0x33')][_0x4571('0x3e')]){_0x1f2ee2[_0x4571('0x3c')]=_[_0x4571('0x3f')](_0x1f2ee2[_0x4571('0x3c')],{'$or':_[_0x4571('0x2d')](_0x1f2ee2[_0x4571('0x37')],function(_0x51b207){var _0x6f0f98={};_0x6f0f98[_0x51b207]={'$like':'%'+_0x571c61[_0x4571('0x33')][_0x4571('0x3e')]+'%'};return _0x6f0f98;})});}_0x1f2ee2=_[_0x4571('0x3f')]({},_0x1f2ee2,_0x571c61[_0x4571('0x41')]);return _0xf57919[_0x4571('0x4c')](_0x1f2ee2);}})[_0x4571('0x26')](function(_0x535c39){if(_0x535c39){_0x3b185d=_0x535c39[_0x4571('0x4f')];if(!_0x571c61[_0x4571('0x33')][_0x4571('0x50')](_0x4571('0x39'))){_0x1f2ee2[_0x4571('0x20')]=qs[_0x4571('0x20')](_0x571c61[_0x4571('0x33')][_0x4571('0x20')]);_0x1f2ee2[_0x4571('0x1e')]=qs[_0x4571('0x1e')](_0x571c61[_0x4571('0x33')][_0x4571('0x1e')]);}return _0xf57919[_0x4571('0x4c')](_0x1f2ee2);}})[_0x4571('0x26')](function(_0x120ea9){if(_0x120ea9){return _0x120ea9?{'count':_0x3b185d,'rows':_0x120ea9}:null;}})[_0x4571('0x26')](respondWithResult(_0x4579c7,null))[_0x4571('0x45')](handleError(_0x4579c7,null));};exports['addConfiguration']=function(_0x33d1d7,_0x560e37,_0x252064){if(_0x33d1d7[_0x4571('0x4b')]['id']){delete _0x33d1d7['body']['id'];}return db[_0x4571('0x2e')][_0x4571('0x4d')]({'where':{'id':_0x33d1d7['params']['id']}})['then'](handleEntityNotFound(_0x560e37,null))[_0x4571('0x26')](function(_0x537a9e){if(_0x537a9e){_0x33d1d7['body'][_0x4571('0x51')]=_0x537a9e['id'];_0x33d1d7[_0x4571('0x4b')][_0x4571('0x52')]=integrations[_0x4571('0x53')](_0x33d1d7['body'][_0x4571('0x54')],_0x33d1d7[_0x4571('0x4b')][_0x4571('0x30')]);_0x33d1d7[_0x4571('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x33d1d7['body'][_0x4571('0x54')],_0x33d1d7[_0x4571('0x4b')][_0x4571('0x30')]);return db[_0x4571('0x4e')][_0x4571('0x4a')](_0x33d1d7[_0x4571('0x4b')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x4571('0x55')}]});}return null;})[_0x4571('0x26')](respondWithResult(_0x560e37,null))[_0x4571('0x45')](handleError(_0x560e37,null));};exports[_0x4571('0x56')]=function(_0x49d70c,_0x3cf147,_0x29145f){var _0x5b9d58;var _0x4174ee='';var _0x1141ba=_0x4571('0x57');return db['SalesforceAccount'][_0x4571('0x4d')]({'where':{'id':_0x49d70c[_0x4571('0x47')]['id']},'attributes':['id',_0x4571('0x58'),_0x4571('0x59'),'clientSecret',_0x4571('0x5a'),_0x4571('0x5b'),_0x4571('0x5c')]})[_0x4571('0x26')](handleEntityNotFound(_0x3cf147,null))[_0x4571('0x26')](function(_0x1a8c08){if(_0x1a8c08){_0x4174ee=_0x1a8c08[_0x4571('0x58')];var _0x454670=_0x4174ee['slice'](-0x1);if(_0x454670==='/'){_0x4174ee=_0x4174ee[_0x4571('0x5d')](0x0,_0x4174ee[_0x4571('0x5e')](_0x454670));}_0x5b9d58=new jsforce[(_0x4571('0x5f'))]({'oauth2':{'loginUrl':_0x4174ee,'clientId':_0x1a8c08[_0x4571('0x59')],'clientSecret':_0x1a8c08[_0x4571('0x60')]}});return _0x5b9d58['login'](_0x1a8c08[_0x4571('0x5a')],_0x1a8c08[_0x4571('0x5b')][_0x4571('0x61')](_0x1a8c08[_0x4571('0x5c')]));}})[_0x4571('0x26')](function(_0x17c3fd){if(_0x17c3fd){if(!_['isNil'](_0x49d70c[_0x4571('0x33')][_0x4571('0x62')])){_0x1141ba=_0x49d70c[_0x4571('0x33')]['ticketType'];}return _0x5b9d58['sobject'](_0x1141ba)[_0x4571('0x63')]();}})['then'](function(_0x5715dc){var _0x4a2f23=[_0x4571('0x64'),_0x4571('0x65'),_0x4571('0x66'),'IsRecurrence','Subject',_0x4571('0x67')];var _0x3f882d=['string',_0x4571('0x68'),'picklist',_0x4571('0x69'),_0x4571('0x6a'),'textarea',_0x4571('0x6b')];if(_0x5715dc){_[_0x4571('0x6c')](_0x5715dc[_0x4571('0x38')],function(_0x5a07f9){return _0x4a2f23[_0x4571('0x6d')](_0x5a07f9[_0x4571('0x2a')])||!_0x3f882d[_0x4571('0x6d')](_0x5a07f9[_0x4571('0x30')]);});return{'count':_0x5715dc[_0x4571('0x38')][_0x4571('0x4f')],'rows':_['map'](_0x5715dc[_0x4571('0x38')],function(_0x6f058b){return{'id':_0x6f058b[_0x4571('0x2a')],'name':_0x6f058b[_0x4571('0x6e')],'custom':_0x6f058b[_0x4571('0x6f')],'options':_0x6f058b[_0x4571('0x70')][_0x4571('0x4f')]>0x0?_[_0x4571('0x2d')](_0x6f058b['picklistValues'],function(_0x4a72bb){return{'name':_0x4a72bb['label'],'value':_0x4a72bb[_0x4571('0x71')]};}):_0x6f058b[_0x4571('0x30')]==_0x4571('0x69')?[{'name':_0x4571('0x72'),'value':_0x4571('0x73')},{'name':_0x4571('0x74'),'value':_0x4571('0x75')}]:[]};})};}})[_0x4571('0x26')](respondWithResult(_0x3cf147,null))[_0x4571('0x45')](function(_0x1bab3f){var _0x175b0e=_0x49d70c[_0x4571('0x33')][_0x4571('0x76')]?0x1f4:_0x1bab3f['statusCode']||0x1f4;logger[_0x4571('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x4571('0x56'),_0x175b0e,JSON[_0x4571('0x77')](_0x1bab3f));delete _0x1bab3f['name'];if(_0x175b0e===0x191){_0x175b0e=0x190;}_0x3cf147[_0x4571('0x1b')](_0x175b0e)[_0x4571('0x2b')](_0x49d70c[_0x4571('0x33')][_0x4571('0x76')]?{'message':_0x4571('0x78'),'statusCode':_0x1bab3f[_0x4571('0x79')]}:_0x1bab3f);});}; \ No newline at end of file +var _0xa00d=['True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','sort','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','picklist','boolean','email','phone','includes','label','custom','picklistValues','value'];(function(_0x18bdef,_0xd178e0){var _0x17fe81=function(_0x5db684){while(--_0x5db684){_0x18bdef['push'](_0x18bdef['shift']());}};_0x17fe81(++_0xd178e0);}(_0xa00d,0x16c));var _0xda00=function(_0x325e9b,_0x33e076){_0x325e9b=_0x325e9b-0x0;var _0x8b1f6=_0xa00d[_0x325e9b];return _0x8b1f6;};'use strict';var emlformat=require(_0xda00('0x0'));var rimraf=require(_0xda00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda00('0x2'));var rp=require(_0xda00('0x3'));var moment=require('moment');var BPromise=require(_0xda00('0x4'));var Mustache=require(_0xda00('0x5'));var util=require(_0xda00('0x6'));var path=require(_0xda00('0x7'));var sox=require(_0xda00('0x8'));var csv=require(_0xda00('0x9'));var ejs=require(_0xda00('0xa'));var fs=require('fs');var fs_extra=require(_0xda00('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xda00('0xc'));var jsforce=require(_0xda00('0xd'));var deskjs=require(_0xda00('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda00('0xf'));var Papa=require(_0xda00('0x10'));var Redis=require(_0xda00('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda00('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda00('0x13'))(_0xda00('0x14'));var utils=require('../../config/utils');var config=require(_0xda00('0x15'));var licenseUtil=require(_0xda00('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xda00('0x17'));function respondWithStatusCode(_0x39eee2,_0x4265db){_0x4265db=_0x4265db||0xcc;return function(_0x213af2){if(_0x213af2){return _0x39eee2['sendStatus'](_0x4265db);}return _0x39eee2[_0xda00('0x18')](_0x4265db)[_0xda00('0x19')]();};}function respondWithResult(_0x3cc950,_0x2e7561){_0x2e7561=_0x2e7561||0xc8;return function(_0x135b36){if(_0x135b36){return _0x3cc950[_0xda00('0x18')](_0x2e7561)[_0xda00('0x1a')](_0x135b36);}};}function respondWithFilteredResult(_0x27e94e,_0x430b3e){return function(_0x383390){if(_0x383390){var _0xc1d268=typeof _0x430b3e[_0xda00('0x1b')]==='undefined'&&typeof _0x430b3e[_0xda00('0x1c')]==='undefined';var _0x32ed50=_0x383390[_0xda00('0x1d')];var _0x1a5367=_0xc1d268?0x0:_0x430b3e[_0xda00('0x1b')];var _0x305499=_0xc1d268?_0x383390[_0xda00('0x1d')]:_0x430b3e[_0xda00('0x1b')]+_0x430b3e['limit'];var _0x41494b;if(_0x305499>=_0x32ed50){_0x305499=_0x32ed50;_0x41494b=0xc8;}else{_0x41494b=0xce;}_0x27e94e[_0xda00('0x18')](_0x41494b);return _0x27e94e[_0xda00('0x1e')](_0xda00('0x1f'),_0x1a5367+'-'+_0x305499+'/'+_0x32ed50)[_0xda00('0x1a')](_0x383390);}return null;};}function patchUpdates(_0x30ea48){return function(_0xc57607){try{jsonpatch[_0xda00('0x20')](_0xc57607,_0x30ea48,!![]);}catch(_0x38bac8){return BPromise[_0xda00('0x21')](_0x38bac8);}return _0xc57607['save']();};}function saveUpdates(_0x4ef0c8,_0x2e0174){return function(_0x537e48){if(_0x537e48){return _0x537e48[_0xda00('0x22')](_0x4ef0c8)[_0xda00('0x23')](function(_0x4a6e17){return _0x4a6e17;});}return null;};}function removeEntity(_0xf5d199,_0x301ff9){return function(_0x339531){if(_0x339531){return _0x339531[_0xda00('0x24')]()[_0xda00('0x23')](function(){_0xf5d199[_0xda00('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5a5e,_0x5c3d76){return function(_0x1e74e1){if(!_0x1e74e1){_0x4e5a5e['sendStatus'](0x194);}return _0x1e74e1;};}function handleError(_0x55cca8,_0x769eb9){_0x769eb9=_0x769eb9||0x1f4;return function(_0xf60e37){logger[_0xda00('0x25')](_0xf60e37[_0xda00('0x26')]);if(_0xf60e37['name']){delete _0xf60e37[_0xda00('0x27')];}_0x55cca8['status'](_0x769eb9)[_0xda00('0x28')](_0xf60e37);};}exports['index']=function(_0x10434d,_0x45a459){var _0x1fd28c={},_0x3fd18c={},_0x53ff5c={'count':0x0,'rows':[]};var _0x49e301=_['map'](db['SalesforceAccount'][_0xda00('0x29')],function(_0x1a2e0d){return{'name':_0x1a2e0d[_0xda00('0x2a')],'type':_0x1a2e0d[_0xda00('0x2b')][_0xda00('0x2c')]};});_0x3fd18c['model']=_[_0xda00('0x2d')](_0x49e301,'name');_0x3fd18c[_0xda00('0x2e')]=_[_0xda00('0x2f')](_0x10434d[_0xda00('0x2e')]);_0x3fd18c[_0xda00('0x30')]=_[_0xda00('0x31')](_0x3fd18c['model'],_0x3fd18c['query']);_0x1fd28c[_0xda00('0x32')]=_[_0xda00('0x31')](_0x3fd18c[_0xda00('0x33')],qs['fields'](_0x10434d[_0xda00('0x2e')][_0xda00('0x34')]));_0x1fd28c[_0xda00('0x32')]=_0x1fd28c[_0xda00('0x32')][_0xda00('0x35')]?_0x1fd28c[_0xda00('0x32')]:_0x3fd18c[_0xda00('0x33')];if(!_0x10434d['query'][_0xda00('0x36')]('nolimit')){_0x1fd28c[_0xda00('0x1c')]=qs['limit'](_0x10434d['query'][_0xda00('0x1c')]);_0x1fd28c[_0xda00('0x1b')]=qs['offset'](_0x10434d[_0xda00('0x2e')][_0xda00('0x1b')]);}_0x1fd28c[_0xda00('0x37')]=qs['sort'](_0x10434d[_0xda00('0x2e')]['sort']);_0x1fd28c[_0xda00('0x38')]=qs[_0xda00('0x30')](_['pick'](_0x10434d[_0xda00('0x2e')],_0x3fd18c[_0xda00('0x30')]),_0x49e301);if(_0x10434d[_0xda00('0x2e')][_0xda00('0x39')]){_0x1fd28c['where']=_[_0xda00('0x3a')](_0x1fd28c['where'],{'$or':_[_0xda00('0x2d')](_0x49e301,function(_0x23c475){if(_0x23c475[_0xda00('0x2b')]!==_0xda00('0x3b')){var _0x133842={};_0x133842[_0x23c475[_0xda00('0x27')]]={'$like':'%'+_0x10434d['query'][_0xda00('0x39')]+'%'};return _0x133842;}})});}_0x1fd28c=_[_0xda00('0x3a')]({},_0x1fd28c,_0x10434d[_0xda00('0x3c')]);var _0x1b69d1={'where':_0x1fd28c['where']};return db[_0xda00('0x3d')][_0xda00('0x1d')](_0x1b69d1)[_0xda00('0x23')](function(_0xbb60c9){_0x53ff5c['count']=_0xbb60c9;if(_0x10434d[_0xda00('0x2e')][_0xda00('0x3e')]){_0x1fd28c[_0xda00('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xda00('0x40')](_0x1fd28c);})[_0xda00('0x23')](function(_0x32172c){_0x53ff5c[_0xda00('0x41')]=_0x32172c;return _0x53ff5c;})[_0xda00('0x23')](respondWithFilteredResult(_0x45a459,_0x1fd28c))[_0xda00('0x42')](handleError(_0x45a459,null));};exports[_0xda00('0x43')]=function(_0x3bbaad,_0x53cad5){var _0x2e864d={'raw':![],'where':{'id':_0x3bbaad[_0xda00('0x44')]['id']}},_0x43b874={};_0x43b874[_0xda00('0x33')]=_['keys'](db[_0xda00('0x3d')][_0xda00('0x29')]);_0x43b874[_0xda00('0x2e')]=_[_0xda00('0x2f')](_0x3bbaad[_0xda00('0x2e')]);_0x43b874[_0xda00('0x30')]=_[_0xda00('0x31')](_0x43b874[_0xda00('0x33')],_0x43b874[_0xda00('0x2e')]);_0x2e864d[_0xda00('0x32')]=_[_0xda00('0x31')](_0x43b874[_0xda00('0x33')],qs[_0xda00('0x34')](_0x3bbaad[_0xda00('0x2e')][_0xda00('0x34')]));_0x2e864d['attributes']=_0x2e864d[_0xda00('0x32')]['length']?_0x2e864d[_0xda00('0x32')]:_0x43b874['model'];if(_0x3bbaad[_0xda00('0x2e')][_0xda00('0x3e')]){_0x2e864d[_0xda00('0x3f')]=[{'all':!![]}];}_0x2e864d=_[_0xda00('0x3a')]({},_0x2e864d,_0x3bbaad[_0xda00('0x3c')]);return db['SalesforceAccount']['find'](_0x2e864d)[_0xda00('0x23')](handleEntityNotFound(_0x53cad5,null))[_0xda00('0x23')](respondWithResult(_0x53cad5,null))[_0xda00('0x42')](handleError(_0x53cad5,null));};exports[_0xda00('0x45')]=function(_0x542885,_0x79622b){return db[_0xda00('0x3d')][_0xda00('0x45')](_0x542885[_0xda00('0x46')],{})[_0xda00('0x23')](respondWithResult(_0x79622b,0xc9))[_0xda00('0x42')](handleError(_0x79622b,null));};exports['update']=function(_0x12facc,_0x514523){if(_0x12facc['body']['id']){delete _0x12facc['body']['id'];}return db[_0xda00('0x3d')]['find']({'where':{'id':_0x12facc[_0xda00('0x44')]['id']}})['then'](handleEntityNotFound(_0x514523,null))[_0xda00('0x23')](saveUpdates(_0x12facc[_0xda00('0x46')],null))[_0xda00('0x23')](respondWithResult(_0x514523,null))[_0xda00('0x42')](handleError(_0x514523,null));};exports[_0xda00('0x24')]=function(_0x4c429b,_0x243930){return db['SalesforceAccount'][_0xda00('0x47')]({'where':{'id':_0x4c429b[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x243930,null))[_0xda00('0x23')](removeEntity(_0x243930,null))[_0xda00('0x42')](handleError(_0x243930,null));};exports['getConfigurations']=function(_0x4562f1,_0x1af522,_0xa74099){var _0x29f273={};var _0x2d4c6d={};var _0x488015;var _0xc73313;return db[_0xda00('0x3d')][_0xda00('0x48')]({'where':{'id':_0x4562f1[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x1af522,null))[_0xda00('0x23')](function(_0x28d0e3){if(_0x28d0e3){_0x488015=_0x28d0e3;_0x2d4c6d['model']=_[_0xda00('0x2f')](db['SalesforceConfiguration']['rawAttributes']);_0x2d4c6d[_0xda00('0x2e')]=_['keys'](_0x4562f1[_0xda00('0x2e')]);_0x2d4c6d[_0xda00('0x30')]=_['intersection'](_0x2d4c6d[_0xda00('0x33')],_0x2d4c6d[_0xda00('0x2e')]);_0x29f273[_0xda00('0x32')]=_[_0xda00('0x31')](_0x2d4c6d[_0xda00('0x33')],qs[_0xda00('0x34')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x34')]));_0x29f273[_0xda00('0x32')]=_0x29f273[_0xda00('0x32')][_0xda00('0x35')]?_0x29f273[_0xda00('0x32')]:_0x2d4c6d[_0xda00('0x33')];_0x29f273[_0xda00('0x37')]=qs[_0xda00('0x49')](_0x4562f1[_0xda00('0x2e')]['sort']);_0x29f273[_0xda00('0x38')]=qs[_0xda00('0x30')](_[_0xda00('0x4a')](_0x4562f1[_0xda00('0x2e')],_0x2d4c6d[_0xda00('0x30')]));if(_0x4562f1['query'][_0xda00('0x39')]){_0x29f273['where']=_[_0xda00('0x3a')](_0x29f273['where'],{'$or':_[_0xda00('0x2d')](_0x29f273['attributes'],function(_0x471a2c){var _0xd8003f={};_0xd8003f[_0x471a2c]={'$like':'%'+_0x4562f1[_0xda00('0x2e')]['filter']+'%'};return _0xd8003f;})});}_0x29f273=_['merge']({},_0x29f273,_0x4562f1[_0xda00('0x3c')]);return _0x488015[_0xda00('0x4b')](_0x29f273);}})['then'](function(_0x314605){if(_0x314605){_0xc73313=_0x314605['length'];if(!_0x4562f1[_0xda00('0x2e')][_0xda00('0x36')]('nolimit')){_0x29f273[_0xda00('0x1c')]=qs[_0xda00('0x1c')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x1c')]);_0x29f273[_0xda00('0x1b')]=qs[_0xda00('0x1b')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x1b')]);}return _0x488015[_0xda00('0x4b')](_0x29f273);}})['then'](function(_0x26be94){if(_0x26be94){return _0x26be94?{'count':_0xc73313,'rows':_0x26be94}:null;}})[_0xda00('0x23')](respondWithResult(_0x1af522,null))[_0xda00('0x42')](handleError(_0x1af522,null));};exports[_0xda00('0x4c')]=function(_0x7d3601,_0x4717b4,_0x5d02b3){if(_0x7d3601[_0xda00('0x46')]['id']){delete _0x7d3601[_0xda00('0x46')]['id'];}return db[_0xda00('0x3d')][_0xda00('0x48')]({'where':{'id':_0x7d3601[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x4717b4,null))['then'](function(_0x68dfe2){if(_0x68dfe2){_0x7d3601['body']['AccountId']=_0x68dfe2['id'];_0x7d3601[_0xda00('0x46')][_0xda00('0x4d')]=integrations[_0xda00('0x4e')](_0x7d3601[_0xda00('0x46')][_0xda00('0x4f')],_0x7d3601[_0xda00('0x46')][_0xda00('0x2b')]);_0x7d3601[_0xda00('0x46')][_0xda00('0x50')]=integrations[_0xda00('0x51')](_0x7d3601[_0xda00('0x46')]['channel'],_0x7d3601[_0xda00('0x46')][_0xda00('0x2b')]);return db[_0xda00('0x52')][_0xda00('0x45')](_0x7d3601['body'],{'include':[{'model':db['SalesforceField'],'as':_0xda00('0x4d')},{'model':db['SalesforceField'],'as':_0xda00('0x50')}]});}return null;})[_0xda00('0x23')](respondWithResult(_0x4717b4,null))[_0xda00('0x42')](handleError(_0x4717b4,null));};exports[_0xda00('0x53')]=function(_0x36cc6c,_0x5bffa1,_0x4966ed){var _0x324094;var _0x1684b7='';var _0x15ff29=_0xda00('0x54');return db['SalesforceAccount'][_0xda00('0x48')]({'where':{'id':_0x36cc6c[_0xda00('0x44')]['id']},'attributes':['id',_0xda00('0x55'),_0xda00('0x56'),_0xda00('0x57'),_0xda00('0x58'),_0xda00('0x59'),'securityToken']})[_0xda00('0x23')](handleEntityNotFound(_0x5bffa1,null))[_0xda00('0x23')](function(_0x57c5b2){if(_0x57c5b2){_0x1684b7=_0x57c5b2[_0xda00('0x55')];var _0x2c4d45=_0x1684b7[_0xda00('0x5a')](-0x1);if(_0x2c4d45==='/'){_0x1684b7=_0x1684b7[_0xda00('0x5b')](0x0,_0x1684b7[_0xda00('0x5c')](_0x2c4d45));}_0x324094=new jsforce[(_0xda00('0x5d'))]({'oauth2':{'loginUrl':_0x1684b7,'clientId':_0x57c5b2[_0xda00('0x56')],'clientSecret':_0x57c5b2[_0xda00('0x57')]}});return _0x324094[_0xda00('0x5e')](_0x57c5b2['username'],_0x57c5b2[_0xda00('0x59')][_0xda00('0x5f')](_0x57c5b2['securityToken']));}})['then'](function(_0x37c505){if(_0x37c505){if(!_['isNil'](_0x36cc6c[_0xda00('0x2e')][_0xda00('0x60')])){_0x15ff29=_0x36cc6c[_0xda00('0x2e')][_0xda00('0x60')];}return _0x324094['sobject'](_0x15ff29)[_0xda00('0x61')]();}})['then'](function(_0x20b1d4){var _0x372491=[_0xda00('0x62'),_0xda00('0x63'),'IsReminderSet',_0xda00('0x64'),_0xda00('0x65'),'Description'];var _0x35defc=[_0xda00('0x66'),'int',_0xda00('0x67'),_0xda00('0x68'),_0xda00('0x69'),'textarea',_0xda00('0x6a')];if(_0x20b1d4){_['remove'](_0x20b1d4['fields'],function(_0x530a47){return _0x372491[_0xda00('0x6b')](_0x530a47['name'])||!_0x35defc[_0xda00('0x6b')](_0x530a47[_0xda00('0x2b')]);});return{'count':_0x20b1d4[_0xda00('0x34')][_0xda00('0x35')],'rows':_['map'](_0x20b1d4[_0xda00('0x34')],function(_0x26ef6b){return{'id':_0x26ef6b['name'],'name':_0x26ef6b[_0xda00('0x6c')],'custom':_0x26ef6b[_0xda00('0x6d')],'options':_0x26ef6b[_0xda00('0x6e')][_0xda00('0x35')]>0x0?_['map'](_0x26ef6b[_0xda00('0x6e')],function(_0x3dc9a7){return{'name':_0x3dc9a7['label'],'value':_0x3dc9a7[_0xda00('0x6f')]};}):_0x26ef6b[_0xda00('0x2b')]=='boolean'?[{'name':_0xda00('0x70'),'value':'true'},{'name':_0xda00('0x71'),'value':_0xda00('0x72')}]:[]};})};}})['then'](respondWithResult(_0x5bffa1,null))[_0xda00('0x42')](function(_0x32dfa7){var _0x4fdb02=_0x36cc6c['query'][_0xda00('0x73')]?0x1f4:_0x32dfa7[_0xda00('0x74')]||0x1f4;logger[_0xda00('0x25')](_0xda00('0x75'),_0xda00('0x53'),_0x4fdb02,JSON['stringify'](_0x32dfa7));delete _0x32dfa7[_0xda00('0x27')];if(_0x4fdb02===0x191){_0x4fdb02=0x190;}_0x5bffa1[_0xda00('0x18')](_0x4fdb02)[_0xda00('0x28')](_0x36cc6c[_0xda00('0x2e')][_0xda00('0x73')]?{'message':_0xda00('0x76'),'statusCode':_0x32dfa7[_0xda00('0x74')]}:_0x32dfa7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3c1ea76..ee7e27d 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 _0x8c32=['path','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8c32,0x89));var _0x28c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c32[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var logger=require(_0x28c3('0x2'))(_0x28c3('0x3'));var moment=require('moment');var BPromise=require(_0x28c3('0x4'));var rp=require(_0x28c3('0x5'));var fs=require('fs');var path=require(_0x28c3('0x6'));var rimraf=require('rimraf');var config=require(_0x28c3('0x7'));var attributes=require(_0x28c3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x28c3('0x9')]=function(_0x32a8aa,_0x40bb2c){return _0x32a8aa[_0x28c3('0xa')](_0x28c3('0xb'),attributes,{'tableName':_0x28c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b70=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b70,0xa7));var _0x01b7=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x1b70[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var logger=require(_0x01b7('0x2'))(_0x01b7('0x3'));var moment=require(_0x01b7('0x4'));var BPromise=require(_0x01b7('0x5'));var rp=require(_0x01b7('0x6'));var fs=require('fs');var path=require(_0x01b7('0x7'));var rimraf=require(_0x01b7('0x8'));var config=require(_0x01b7('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x01b7('0xa'));module[_0x01b7('0xb')]=function(_0x13564b,_0x5a2976){return _0x13564b[_0x01b7('0xc')]('SalesforceAccount',attributes,{'tableName':_0x01b7('0xd'),'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 366855d..4c66f68 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 _0x30d8=['SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSalesforceAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x30d8,0x187));var _0x830d=function(_0x12d0e5,_0x1d1209){_0x12d0e5=_0x12d0e5-0x0;var _0x20d304=_0x30d8[_0x12d0e5];return _0x20d304;};'use strict';var _=require(_0x830d('0x0'));var util=require('util');var moment=require(_0x830d('0x1'));var BPromise=require('bluebird');var rs=require(_0x830d('0x2'));var fs=require('fs');var Redis=require(_0x830d('0x3'));var db=require(_0x830d('0x4'))['db'];var utils=require(_0x830d('0x5'));var logger=require(_0x830d('0x6'))(_0x830d('0x7'));var config=require(_0x830d('0x8'));var jayson=require(_0x830d('0x9'));var client=jayson['client'][_0x830d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50981f,_0x1b2bdb,_0x199c1c){return new BPromise(function(_0x34650e,_0x24555d){return client[_0x830d('0xb')](_0x50981f,_0x199c1c)[_0x830d('0xc')](function(_0x1a3334){logger['info'](_0x830d('0xd'),_0x1b2bdb,_0x830d('0xe'));logger[_0x830d('0xf')](_0x830d('0x10'),_0x1b2bdb,'request\x20sent',JSON[_0x830d('0x11')](_0x1a3334));if(_0x1a3334[_0x830d('0x12')]){if(_0x1a3334[_0x830d('0x12')][_0x830d('0x13')]===0x1f4){logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);return _0x24555d(_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);}logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);return _0x34650e(_0x1a3334['error'][_0x830d('0x14')]);}else{logger[_0x830d('0x15')](_0x830d('0xd'),_0x1b2bdb,_0x830d('0xe'));_0x34650e(_0x1a3334[_0x830d('0x16')][_0x830d('0x14')]);}})[_0x830d('0x17')](function(_0x3d8220){logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x3d8220);_0x24555d(_0x3d8220);});});}exports[_0x830d('0x18')]=function(_0x28b3cc){var _0x2daa2a=this;return new Promise(function(_0x5d91f6,_0x4d8228){return db[_0x830d('0x19')][_0x830d('0x1a')]({'raw':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1c')]===undefined?!![]:![]:!![],'where':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc['options'][_0x830d('0x1d')]||null:null,'attributes':_0x28b3cc['options']?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1e')]||null:null,'limit':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1f')]||null:null,'include':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x20')]?_[_0x830d('0x21')](_0x28b3cc[_0x830d('0x1b')][_0x830d('0x20')],function(_0x572f54){return{'model':db[_0x572f54[_0x830d('0x22')]],'as':_0x572f54['as'],'attributes':_0x572f54[_0x830d('0x1e')],'include':_0x572f54[_0x830d('0x20')]?_[_0x830d('0x21')](_0x572f54[_0x830d('0x20')],function(_0x517d97){return{'model':db[_0x517d97[_0x830d('0x22')]],'as':_0x517d97['as'],'attributes':_0x517d97[_0x830d('0x1e')],'include':_0x517d97[_0x830d('0x20')]?_[_0x830d('0x21')](_0x517d97[_0x830d('0x20')],function(_0x51452d){return{'model':db[_0x51452d['model']],'as':_0x51452d['as'],'attributes':_0x51452d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17ad12){logger[_0x830d('0x15')](_0x830d('0x18'),_0x28b3cc);logger['debug'](_0x830d('0x18'),_0x28b3cc,JSON[_0x830d('0x11')](_0x17ad12));_0x5d91f6(_0x17ad12);})['catch'](function(_0x6cc2c5){logger[_0x830d('0x12')](_0x830d('0x18'),_0x6cc2c5[_0x830d('0x14')],_0x28b3cc);_0x4d8228(_0x2daa2a[_0x830d('0x12')](0x1f4,_0x6cc2c5['message']));});});};exports['ShowSalesforceAccount']=function(_0x371f6b){var _0x7ec706=this;return new Promise(function(_0x293cdd,_0x22531b){return db[_0x830d('0x19')][_0x830d('0x23')]({'raw':_0x371f6b[_0x830d('0x1b')]?_0x371f6b[_0x830d('0x1b')][_0x830d('0x1c')]===undefined?!![]:![]:!![],'where':_0x371f6b['options']?_0x371f6b[_0x830d('0x1b')]['where']||null:null,'attributes':_0x371f6b[_0x830d('0x1b')]?_0x371f6b[_0x830d('0x1b')][_0x830d('0x1e')]||null:null,'include':_0x371f6b['options']?_0x371f6b['options']['include']?_[_0x830d('0x21')](_0x371f6b['options'][_0x830d('0x20')],function(_0x482ee7){return{'model':db[_0x482ee7[_0x830d('0x22')]],'as':_0x482ee7['as'],'attributes':_0x482ee7[_0x830d('0x1e')],'include':_0x482ee7[_0x830d('0x20')]?_['map'](_0x482ee7['include'],function(_0x3067cb){return{'model':db[_0x3067cb['model']],'as':_0x3067cb['as'],'attributes':_0x3067cb['attributes'],'include':_0x3067cb[_0x830d('0x20')]?_[_0x830d('0x21')](_0x3067cb['include'],function(_0x30622f){return{'model':db[_0x30622f[_0x830d('0x22')]],'as':_0x30622f['as'],'attributes':_0x30622f[_0x830d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x830d('0xc')](function(_0x53bff3){logger[_0x830d('0x15')](_0x830d('0x24'),_0x371f6b);logger[_0x830d('0xf')](_0x830d('0x24'),_0x371f6b,JSON['stringify'](_0x53bff3));_0x293cdd(_0x53bff3);})['catch'](function(_0x1c8b8f){logger[_0x830d('0x12')](_0x830d('0x24'),_0x1c8b8f[_0x830d('0x14')],_0x371f6b);_0x22531b(_0x7ec706[_0x830d('0x12')](0x1f4,_0x1c8b8f[_0x830d('0x14')]));});});}; \ No newline at end of file +var _0xb2d2=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','limit','include','model','map','attributes','ShowSalesforceAccount','find','raw'];(function(_0x499cfe,_0x439165){var _0x549efb=function(_0x41ea79){while(--_0x41ea79){_0x499cfe['push'](_0x499cfe['shift']());}};_0x549efb(++_0x439165);}(_0xb2d2,0x1ef));var _0x2b2d=function(_0x1d9442,_0x5dc3ea){_0x1d9442=_0x1d9442-0x0;var _0x326649=_0xb2d2[_0x1d9442];return _0x326649;};'use strict';var _=require('lodash');var util=require(_0x2b2d('0x0'));var moment=require('moment');var BPromise=require(_0x2b2d('0x1'));var rs=require(_0x2b2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b2d('0x3'))['db'];var utils=require(_0x2b2d('0x4'));var logger=require('../../config/logger')(_0x2b2d('0x5'));var config=require(_0x2b2d('0x6'));var jayson=require(_0x2b2d('0x7'));var client=jayson['client'][_0x2b2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x546a1f,_0x102950,_0x419ef5){return new BPromise(function(_0x5776f6,_0x2d5692){return client[_0x2b2d('0x9')](_0x546a1f,_0x419ef5)[_0x2b2d('0xa')](function(_0x3d92da){logger[_0x2b2d('0xb')](_0x2b2d('0xc'),_0x102950,'request\x20sent');logger[_0x2b2d('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x102950,_0x2b2d('0xe'),JSON[_0x2b2d('0xf')](_0x3d92da));if(_0x3d92da[_0x2b2d('0x10')]){if(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x11')]===0x1f4){logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);return _0x2d5692(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);}logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x3d92da['error']['message']);return _0x5776f6(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);}else{logger[_0x2b2d('0xb')](_0x2b2d('0xc'),_0x102950,_0x2b2d('0xe'));_0x5776f6(_0x3d92da[_0x2b2d('0x13')]['message']);}})[_0x2b2d('0x14')](function(_0x5d8e6e){logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x5d8e6e);_0x2d5692(_0x5d8e6e);});});}exports[_0x2b2d('0x15')]=function(_0x18501d){var _0x515363=this;return new Promise(function(_0x2a49be,_0x2c482f){return db[_0x2b2d('0x16')]['findAll']({'raw':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x18')]||null:null,'attributes':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')]['attributes']||null:null,'limit':_0x18501d[_0x2b2d('0x17')]?_0x18501d['options'][_0x2b2d('0x19')]||null:null,'include':_0x18501d['options']?_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x1a')]?_['map'](_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x1a')],function(_0x55c0b7){return{'model':db[_0x55c0b7[_0x2b2d('0x1b')]],'as':_0x55c0b7['as'],'attributes':_0x55c0b7['attributes'],'include':_0x55c0b7[_0x2b2d('0x1a')]?_['map'](_0x55c0b7[_0x2b2d('0x1a')],function(_0x5ea1ca){return{'model':db[_0x5ea1ca[_0x2b2d('0x1b')]],'as':_0x5ea1ca['as'],'attributes':_0x5ea1ca['attributes'],'include':_0x5ea1ca[_0x2b2d('0x1a')]?_[_0x2b2d('0x1c')](_0x5ea1ca[_0x2b2d('0x1a')],function(_0x1e125e){return{'model':db[_0x1e125e[_0x2b2d('0x1b')]],'as':_0x1e125e['as'],'attributes':_0x1e125e[_0x2b2d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b2d('0xa')](function(_0x2a3898){logger[_0x2b2d('0xb')](_0x2b2d('0x15'),_0x18501d);logger['debug']('GetSalesforceAccount',_0x18501d,JSON[_0x2b2d('0xf')](_0x2a3898));_0x2a49be(_0x2a3898);})[_0x2b2d('0x14')](function(_0xd672f9){logger[_0x2b2d('0x10')](_0x2b2d('0x15'),_0xd672f9[_0x2b2d('0x12')],_0x18501d);_0x2c482f(_0x515363['error'](0x1f4,_0xd672f9[_0x2b2d('0x12')]));});});};exports[_0x2b2d('0x1e')]=function(_0x449e8c){var _0xbb12aa=this;return new Promise(function(_0x12ceaf,_0x138cfc){return db[_0x2b2d('0x16')][_0x2b2d('0x1f')]({'raw':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c[_0x2b2d('0x17')][_0x2b2d('0x20')]===undefined?!![]:![]:!![],'where':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options'][_0x2b2d('0x18')]||null:null,'attributes':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options']['attributes']||null:null,'include':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options'][_0x2b2d('0x1a')]?_[_0x2b2d('0x1c')](_0x449e8c['options'][_0x2b2d('0x1a')],function(_0x9c4dae){return{'model':db[_0x9c4dae[_0x2b2d('0x1b')]],'as':_0x9c4dae['as'],'attributes':_0x9c4dae[_0x2b2d('0x1d')],'include':_0x9c4dae['include']?_[_0x2b2d('0x1c')](_0x9c4dae[_0x2b2d('0x1a')],function(_0x1d73ea){return{'model':db[_0x1d73ea[_0x2b2d('0x1b')]],'as':_0x1d73ea['as'],'attributes':_0x1d73ea[_0x2b2d('0x1d')],'include':_0x1d73ea['include']?_[_0x2b2d('0x1c')](_0x1d73ea[_0x2b2d('0x1a')],function(_0x3e4cb4){return{'model':db[_0x3e4cb4[_0x2b2d('0x1b')]],'as':_0x3e4cb4['as'],'attributes':_0x3e4cb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b2d('0xa')](function(_0x1b3fa5){logger[_0x2b2d('0xb')](_0x2b2d('0x1e'),_0x449e8c);logger[_0x2b2d('0xd')](_0x2b2d('0x1e'),_0x449e8c,JSON[_0x2b2d('0xf')](_0x1b3fa5));_0x12ceaf(_0x1b3fa5);})[_0x2b2d('0x14')](function(_0x2f590c){logger['error'](_0x2b2d('0x1e'),_0x2f590c[_0x2b2d('0x12')],_0x449e8c);_0x138cfc(_0xbb12aa[_0x2b2d('0x10')](0x1f4,_0x2f590c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2b4adcc..feab32e 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x12c414,_0x44036e){var _0x3e9087=function(_0x50136c){while(--_0x50136c){_0x12c414['push'](_0x12c414['shift']());}};_0x3e9087(++_0x44036e);}(_0xadb5,0xad));var _0x5adb=function(_0x3da727,_0x102cb4){_0x3da727=_0x3da727-0x0;var _0x2710b2=_0xadb5[_0x3da727];return _0x2710b2;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x0b0e[_0x3712e2];return _0x1faff4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 617ffa0..7e81c37 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 _0xa531=['account','lead','sequelize','exports','STRING','Task','ENUM','contact_lead','contact','account_contact_lead'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xa531,0x12e));var _0x1a53=function(_0x128970,_0xc69c78){_0x128970=_0x128970-0x0;var _0x399724=_0xa531[_0x128970];return _0x399724;};'use strict';var Sequelize=require(_0x1a53('0x0'));module[_0x1a53('0x1')]={'name':{'type':Sequelize[_0x1a53('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x1a53('0x3'),'Case'),'defaultValue':_0x1a53('0x3')},'moduleSearch':{'type':Sequelize[_0x1a53('0x4')](_0x1a53('0x5'),_0x1a53('0x6'),'lead',_0x1a53('0x7'),_0x1a53('0x8')),'defaultValue':_0x1a53('0x5')},'moduleCreate':{'type':Sequelize[_0x1a53('0x4')]('nothing','contact',_0x1a53('0x9'),_0x1a53('0x8')),'defaultValue':_0x1a53('0x9')},'leadId':{'type':Sequelize[_0x1a53('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1a53('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1a53('0x2')]}}; \ No newline at end of file +var _0x4d3b=['ENUM','Task','Case','contact_lead','lead','account_contact_lead','nothing','contact','account','exports','STRING'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x4d3b,0x1ab));var _0xb4d3=function(_0x15b64c,_0x439a5d){_0x15b64c=_0x15b64c-0x0;var _0x3318ce=_0x4d3b[_0x15b64c];return _0x3318ce;};'use strict';var Sequelize=require('sequelize');module[_0xb4d3('0x0')]={'name':{'type':Sequelize[_0xb4d3('0x1')]},'description':{'type':Sequelize[_0xb4d3('0x1')]},'ticketType':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x3'),_0xb4d3('0x4')),'defaultValue':_0xb4d3('0x3')},'moduleSearch':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x5'),'contact',_0xb4d3('0x6'),_0xb4d3('0x7'),'account'),'defaultValue':_0xb4d3('0x5')},'moduleCreate':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x8'),_0xb4d3('0x9'),_0xb4d3('0x6'),_0xb4d3('0xa')),'defaultValue':_0xb4d3('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xb4d3('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xb4d3('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f3d4c7a..4042522 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 _0x78d3=['hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','length','create','update','body','find','destroy','findOne','SalesforceField','rawAttributes','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','stack','index','key','map','name','query','filters','intersection','model','fields','attributes'];(function(_0x4193ec,_0x2623d0){var _0x722f00=function(_0x52957b){while(--_0x52957b){_0x4193ec['push'](_0x4193ec['shift']());}};_0x722f00(++_0x2623d0);}(_0x78d3,0x73));var _0x378d=function(_0xbadd3c,_0x2d770a){_0xbadd3c=_0xbadd3c-0x0;var _0x46e363=_0x78d3[_0xbadd3c];return _0x46e363;};'use strict';var emlformat=require(_0x378d('0x0'));var rimraf=require(_0x378d('0x1'));var zipdir=require(_0x378d('0x2'));var jsonpatch=require(_0x378d('0x3'));var rp=require(_0x378d('0x4'));var moment=require(_0x378d('0x5'));var BPromise=require(_0x378d('0x6'));var Mustache=require(_0x378d('0x7'));var util=require(_0x378d('0x8'));var path=require(_0x378d('0x9'));var sox=require(_0x378d('0xa'));var csv=require(_0x378d('0xb'));var ejs=require(_0x378d('0xc'));var fs=require('fs');var fs_extra=require(_0x378d('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x378d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x378d('0xf'));var toCsv=require(_0x378d('0xb'));var querystring=require(_0x378d('0x10'));var Papa=require(_0x378d('0x11'));var Redis=require(_0x378d('0x12'));var authService=require(_0x378d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x378d('0x14'));var hardwareService=require(_0x378d('0x15'));var logger=require(_0x378d('0x16'))('api');var utils=require(_0x378d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x378d('0x18'))['db'];function respondWithStatusCode(_0x184383,_0x5a1c1f){_0x5a1c1f=_0x5a1c1f||0xcc;return function(_0x43785f){if(_0x43785f){return _0x184383[_0x378d('0x19')](_0x5a1c1f);}return _0x184383[_0x378d('0x1a')](_0x5a1c1f)['end']();};}function respondWithResult(_0x4609b7,_0x5bf43f){_0x5bf43f=_0x5bf43f||0xc8;return function(_0x756450){if(_0x756450){return _0x4609b7[_0x378d('0x1a')](_0x5bf43f)[_0x378d('0x1b')](_0x756450);}};}function respondWithFilteredResult(_0x40c4fb,_0x209292){return function(_0x5f48db){if(_0x5f48db){var _0x46856f=typeof _0x209292['offset']===_0x378d('0x1c')&&typeof _0x209292[_0x378d('0x1d')]===_0x378d('0x1c');var _0x254ff5=_0x5f48db[_0x378d('0x1e')];var _0x50ce98=_0x46856f?0x0:_0x209292[_0x378d('0x1f')];var _0x4b54c7=_0x46856f?_0x5f48db[_0x378d('0x1e')]:_0x209292[_0x378d('0x1f')]+_0x209292[_0x378d('0x1d')];var _0x1d2852;if(_0x4b54c7>=_0x254ff5){_0x4b54c7=_0x254ff5;_0x1d2852=0xc8;}else{_0x1d2852=0xce;}_0x40c4fb[_0x378d('0x1a')](_0x1d2852);return _0x40c4fb[_0x378d('0x20')](_0x378d('0x21'),_0x50ce98+'-'+_0x4b54c7+'/'+_0x254ff5)['json'](_0x5f48db);}return null;};}function patchUpdates(_0x5a936c){return function(_0x238f30){try{jsonpatch[_0x378d('0x22')](_0x238f30,_0x5a936c,!![]);}catch(_0x48b7f9){return BPromise[_0x378d('0x23')](_0x48b7f9);}return _0x238f30[_0x378d('0x24')]();};}function saveUpdates(_0x2d6c8f,_0x1339fb){return function(_0x3acdf9){if(_0x3acdf9){return _0x3acdf9['update'](_0x2d6c8f)[_0x378d('0x25')](function(_0x4f43a6){return _0x4f43a6;});}return null;};}function removeEntity(_0x17bbf2,_0x402913){return function(_0x3f2ebc){if(_0x3f2ebc){return _0x3f2ebc['destroy']()[_0x378d('0x25')](function(){_0x17bbf2[_0x378d('0x1a')](0xcc)[_0x378d('0x26')]();});}};}function handleEntityNotFound(_0x5e515d,_0x20e5e6){return function(_0x22fee7){if(!_0x22fee7){_0x5e515d[_0x378d('0x19')](0x194);}return _0x22fee7;};}function handleError(_0x1c302a,_0xb65852){_0xb65852=_0xb65852||0x1f4;return function(_0x2ed3ed){logger[_0x378d('0x27')](_0x2ed3ed[_0x378d('0x28')]);if(_0x2ed3ed['name']){delete _0x2ed3ed['name'];}_0x1c302a[_0x378d('0x1a')](_0xb65852)['send'](_0x2ed3ed);};}exports[_0x378d('0x29')]=function(_0x292b73,_0x3f2d5b){var _0x17f952={},_0x53637f={},_0x59945b={'count':0x0,'rows':[]};var _0x3de1af=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x3e1dac){return{'name':_0x3e1dac['fieldName'],'type':_0x3e1dac['type'][_0x378d('0x2a')]};});_0x53637f['model']=_[_0x378d('0x2b')](_0x3de1af,_0x378d('0x2c'));_0x53637f[_0x378d('0x2d')]=_['keys'](_0x292b73[_0x378d('0x2d')]);_0x53637f[_0x378d('0x2e')]=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],_0x53637f[_0x378d('0x2d')]);_0x17f952['attributes']=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],qs[_0x378d('0x31')](_0x292b73[_0x378d('0x2d')]['fields']));_0x17f952[_0x378d('0x32')]=_0x17f952['attributes']['length']?_0x17f952[_0x378d('0x32')]:_0x53637f[_0x378d('0x30')];if(!_0x292b73['query'][_0x378d('0x33')]('nolimit')){_0x17f952['limit']=qs['limit'](_0x292b73[_0x378d('0x2d')][_0x378d('0x1d')]);_0x17f952[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x292b73[_0x378d('0x2d')]['offset']);}_0x17f952[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x292b73[_0x378d('0x2d')]['sort']);_0x17f952[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x292b73['query'],_0x53637f[_0x378d('0x2e')]),_0x3de1af);if(_0x292b73['query'][_0x378d('0x38')]){_0x17f952['where']=_['merge'](_0x17f952[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x3de1af,function(_0x43a0d7){if(_0x43a0d7[_0x378d('0x39')]!==_0x378d('0x3a')){var _0x7f668c={};_0x7f668c[_0x43a0d7['name']]={'$like':'%'+_0x292b73['query'][_0x378d('0x38')]+'%'};return _0x7f668c;}})});}_0x17f952=_[_0x378d('0x3b')]({},_0x17f952,_0x292b73[_0x378d('0x3c')]);var _0x1b039d={'where':_0x17f952[_0x378d('0x36')]};return db[_0x378d('0x3d')][_0x378d('0x1e')](_0x1b039d)[_0x378d('0x25')](function(_0x32c4f6){_0x59945b[_0x378d('0x1e')]=_0x32c4f6;if(_0x292b73[_0x378d('0x2d')][_0x378d('0x3e')]){_0x17f952[_0x378d('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x378d('0x40')](_0x17f952);})['then'](function(_0x5e1b33){_0x59945b[_0x378d('0x41')]=_0x5e1b33;return _0x59945b;})['then'](respondWithFilteredResult(_0x3f2d5b,_0x17f952))[_0x378d('0x42')](handleError(_0x3f2d5b,null));};exports[_0x378d('0x43')]=function(_0x514c6d,_0x480835){var _0x5c3e1e={'raw':![],'where':{'id':_0x514c6d[_0x378d('0x44')]['id']}},_0x2d2ee2={};_0x2d2ee2[_0x378d('0x30')]=_['keys'](db[_0x378d('0x3d')]['rawAttributes']);_0x2d2ee2[_0x378d('0x2d')]=_[_0x378d('0x45')](_0x514c6d[_0x378d('0x2d')]);_0x2d2ee2[_0x378d('0x2e')]=_['intersection'](_0x2d2ee2[_0x378d('0x30')],_0x2d2ee2['query']);_0x5c3e1e[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x2d2ee2[_0x378d('0x30')],qs[_0x378d('0x31')](_0x514c6d[_0x378d('0x2d')][_0x378d('0x31')]));_0x5c3e1e['attributes']=_0x5c3e1e['attributes'][_0x378d('0x46')]?_0x5c3e1e[_0x378d('0x32')]:_0x2d2ee2[_0x378d('0x30')];if(_0x514c6d['query']['includeAll']){_0x5c3e1e[_0x378d('0x3f')]=[{'all':!![]}];}_0x5c3e1e=_['merge']({},_0x5c3e1e,_0x514c6d['options']);return db['SalesforceConfiguration']['find'](_0x5c3e1e)[_0x378d('0x25')](handleEntityNotFound(_0x480835,null))[_0x378d('0x25')](respondWithResult(_0x480835,null))[_0x378d('0x42')](handleError(_0x480835,null));};exports[_0x378d('0x47')]=function(_0x404176,_0x5c5733){return db[_0x378d('0x3d')][_0x378d('0x47')](_0x404176['body'],{})['then'](respondWithResult(_0x5c5733,0xc9))[_0x378d('0x42')](handleError(_0x5c5733,null));};exports[_0x378d('0x48')]=function(_0x50a8a0,_0x3e6275){if(_0x50a8a0[_0x378d('0x49')]['id']){delete _0x50a8a0[_0x378d('0x49')]['id'];}return db[_0x378d('0x3d')][_0x378d('0x4a')]({'where':{'id':_0x50a8a0[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x3e6275,null))['then'](saveUpdates(_0x50a8a0[_0x378d('0x49')],null))[_0x378d('0x25')](respondWithResult(_0x3e6275,null))[_0x378d('0x42')](handleError(_0x3e6275,null));};exports[_0x378d('0x4b')]=function(_0x509bf1,_0x2e4cd0){return db[_0x378d('0x3d')]['find']({'where':{'id':_0x509bf1[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x2e4cd0,null))['then'](removeEntity(_0x2e4cd0,null))[_0x378d('0x42')](handleError(_0x2e4cd0,null));};exports['getFields']=function(_0x31b959,_0x5562d8,_0x20d37a){var _0x1a8733={};var _0x15f52f={};var _0xcd6f22;var _0x4b6f16;return db[_0x378d('0x3d')][_0x378d('0x4c')]({'where':{'id':_0x31b959[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x5562d8,null))[_0x378d('0x25')](function(_0x4daccc){if(_0x4daccc){_0xcd6f22=_0x4daccc;_0x15f52f[_0x378d('0x30')]=_[_0x378d('0x45')](db[_0x378d('0x4d')][_0x378d('0x4e')]);_0x15f52f[_0x378d('0x2d')]=_['keys'](_0x31b959[_0x378d('0x2d')]);_0x15f52f['filters']=_['intersection'](_0x15f52f[_0x378d('0x30')],_0x15f52f[_0x378d('0x2d')]);_0x1a8733[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x15f52f[_0x378d('0x30')],qs['fields'](_0x31b959[_0x378d('0x2d')][_0x378d('0x31')]));_0x1a8733[_0x378d('0x32')]=_0x1a8733[_0x378d('0x32')][_0x378d('0x46')]?_0x1a8733[_0x378d('0x32')]:_0x15f52f[_0x378d('0x30')];_0x1a8733[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x31b959[_0x378d('0x2d')]['sort']);_0x1a8733[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x31b959[_0x378d('0x2d')],_0x15f52f['filters']));if(_0x31b959[_0x378d('0x2d')]['filter']){_0x1a8733[_0x378d('0x36')]=_[_0x378d('0x3b')](_0x1a8733[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x1a8733['attributes'],function(_0x206af4){var _0x2a55c3={};_0x2a55c3[_0x206af4]={'$like':'%'+_0x31b959[_0x378d('0x2d')][_0x378d('0x38')]+'%'};return _0x2a55c3;})});}_0x1a8733=_[_0x378d('0x3b')]({},_0x1a8733,_0x31b959['options']);return _0xcd6f22[_0x378d('0x4f')](_0x1a8733);}})[_0x378d('0x25')](function(_0x573256){if(_0x573256){_0x4b6f16=_0x573256[_0x378d('0x46')];if(!_0x31b959[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x1a8733[_0x378d('0x1d')]=qs['limit'](_0x31b959[_0x378d('0x2d')]['limit']);_0x1a8733[_0x378d('0x1f')]=qs['offset'](_0x31b959[_0x378d('0x2d')][_0x378d('0x1f')]);}return _0xcd6f22[_0x378d('0x4f')](_0x1a8733);}})['then'](function(_0x5bc1db){if(_0x5bc1db){return _0x5bc1db?{'count':_0x4b6f16,'rows':_0x5bc1db}:null;}})[_0x378d('0x25')](respondWithResult(_0x5562d8,null))[_0x378d('0x42')](handleError(_0x5562d8,null));};exports[_0x378d('0x51')]=function(_0x2796c7,_0x293329,_0x448502){var _0x13c681={};var _0x483a9e={};var _0x19dfaa;var _0x207c53;return db['SalesforceConfiguration'][_0x378d('0x4c')]({'where':{'id':_0x2796c7[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x293329,null))['then'](function(_0x5adcf9){if(_0x5adcf9){_0x19dfaa=_0x5adcf9;_0x483a9e['model']=_[_0x378d('0x45')](db['SalesforceField']['rawAttributes']);_0x483a9e[_0x378d('0x2d')]=_[_0x378d('0x45')](_0x2796c7[_0x378d('0x2d')]);_0x483a9e[_0x378d('0x2e')]=_[_0x378d('0x2f')](_0x483a9e[_0x378d('0x30')],_0x483a9e[_0x378d('0x2d')]);_0x13c681[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x483a9e[_0x378d('0x30')],qs[_0x378d('0x31')](_0x2796c7['query'][_0x378d('0x31')]));_0x13c681[_0x378d('0x32')]=_0x13c681[_0x378d('0x32')][_0x378d('0x46')]?_0x13c681['attributes']:_0x483a9e[_0x378d('0x30')];_0x13c681[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x2796c7[_0x378d('0x2d')][_0x378d('0x35')]);_0x13c681[_0x378d('0x36')]=qs[_0x378d('0x2e')](_['pick'](_0x2796c7[_0x378d('0x2d')],_0x483a9e[_0x378d('0x2e')]));if(_0x2796c7[_0x378d('0x2d')]['filter']){_0x13c681[_0x378d('0x36')]=_['merge'](_0x13c681[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x13c681[_0x378d('0x32')],function(_0x1817fe){var _0x4c7c12={};_0x4c7c12[_0x1817fe]={'$like':'%'+_0x2796c7['query'][_0x378d('0x38')]+'%'};return _0x4c7c12;})});}_0x13c681=_[_0x378d('0x3b')]({},_0x13c681,_0x2796c7[_0x378d('0x3c')]);return _0x19dfaa[_0x378d('0x51')](_0x13c681);}})[_0x378d('0x25')](function(_0x511f13){if(_0x511f13){_0x207c53=_0x511f13[_0x378d('0x46')];if(!_0x2796c7[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x13c681[_0x378d('0x1d')]=qs['limit'](_0x2796c7[_0x378d('0x2d')]['limit']);_0x13c681[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x2796c7['query'][_0x378d('0x1f')]);}return _0x19dfaa[_0x378d('0x51')](_0x13c681);}})[_0x378d('0x25')](function(_0x47c57e){if(_0x47c57e){return _0x47c57e?{'count':_0x207c53,'rows':_0x47c57e}:null;}})['then'](respondWithResult(_0x293329,null))[_0x378d('0x42')](handleError(_0x293329,null));};exports[_0x378d('0x52')]=function(_0x42559d,_0x3ee8d3,_0x4e93d7){var _0x44c830={};var _0x5ea6ea={};var _0x1ee712;var _0x2f6e9e;return db['SalesforceConfiguration'][_0x378d('0x4c')]({'where':{'id':_0x42559d[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x3ee8d3,null))[_0x378d('0x25')](function(_0x4d13a1){if(_0x4d13a1){_0x1ee712=_0x4d13a1;_0x5ea6ea[_0x378d('0x30')]=_[_0x378d('0x45')](db[_0x378d('0x4d')][_0x378d('0x4e')]);_0x5ea6ea['query']=_[_0x378d('0x45')](_0x42559d['query']);_0x5ea6ea['filters']=_[_0x378d('0x2f')](_0x5ea6ea['model'],_0x5ea6ea[_0x378d('0x2d')]);_0x44c830[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x5ea6ea[_0x378d('0x30')],qs['fields'](_0x42559d['query'][_0x378d('0x31')]));_0x44c830['attributes']=_0x44c830[_0x378d('0x32')]['length']?_0x44c830['attributes']:_0x5ea6ea[_0x378d('0x30')];_0x44c830[_0x378d('0x34')]=qs['sort'](_0x42559d[_0x378d('0x2d')]['sort']);_0x44c830[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x42559d[_0x378d('0x2d')],_0x5ea6ea['filters']));if(_0x42559d[_0x378d('0x2d')][_0x378d('0x38')]){_0x44c830[_0x378d('0x36')]=_[_0x378d('0x3b')](_0x44c830['where'],{'$or':_[_0x378d('0x2b')](_0x44c830['attributes'],function(_0x543aca){var _0x1e0d23={};_0x1e0d23[_0x543aca]={'$like':'%'+_0x42559d['query']['filter']+'%'};return _0x1e0d23;})});}_0x44c830=_['merge']({},_0x44c830,_0x42559d[_0x378d('0x3c')]);return _0x1ee712[_0x378d('0x52')](_0x44c830);}})[_0x378d('0x25')](function(_0x4c8c9e){if(_0x4c8c9e){_0x2f6e9e=_0x4c8c9e[_0x378d('0x46')];if(!_0x42559d[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x44c830[_0x378d('0x1d')]=qs[_0x378d('0x1d')](_0x42559d['query'][_0x378d('0x1d')]);_0x44c830[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x42559d[_0x378d('0x2d')][_0x378d('0x1f')]);}return _0x1ee712[_0x378d('0x52')](_0x44c830);}})[_0x378d('0x25')](function(_0x100ced){if(_0x100ced){return _0x100ced?{'count':_0x2f6e9e,'rows':_0x100ced}:null;}})['then'](respondWithResult(_0x3ee8d3,null))[_0x378d('0x42')](handleError(_0x3ee8d3,null));}; \ No newline at end of file +var _0xdb15=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','length','options','find','create','body','update','getFields','findOne','SalesforceField','filter','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x46b932,_0x55a512){var _0x3489b0=function(_0x5a1cb3){while(--_0x5a1cb3){_0x46b932['push'](_0x46b932['shift']());}};_0x3489b0(++_0x55a512);}(_0xdb15,0x94));var _0x5db1=function(_0x466f5d,_0x1bd5ba){_0x466f5d=_0x466f5d-0x0;var _0x383b2b=_0xdb15[_0x466f5d];return _0x383b2b;};'use strict';var emlformat=require(_0x5db1('0x0'));var rimraf=require(_0x5db1('0x1'));var zipdir=require(_0x5db1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5db1('0x3'));var moment=require(_0x5db1('0x4'));var BPromise=require(_0x5db1('0x5'));var Mustache=require(_0x5db1('0x6'));var util=require('util');var path=require(_0x5db1('0x7'));var sox=require(_0x5db1('0x8'));var csv=require(_0x5db1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db1('0xa'));var _=require(_0x5db1('0xb'));var squel=require(_0x5db1('0xc'));var crypto=require(_0x5db1('0xd'));var jsforce=require(_0x5db1('0xe'));var deskjs=require(_0x5db1('0xf'));var toCsv=require(_0x5db1('0x9'));var querystring=require(_0x5db1('0x10'));var Papa=require(_0x5db1('0x11'));var Redis=require('ioredis');var authService=require(_0x5db1('0x12'));var qs=require(_0x5db1('0x13'));var as=require(_0x5db1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5db1('0x15'));var utils=require(_0x5db1('0x16'));var config=require(_0x5db1('0x17'));var licenseUtil=require(_0x5db1('0x18'));var db=require(_0x5db1('0x19'))['db'];function respondWithStatusCode(_0x5141a1,_0x1c696f){_0x1c696f=_0x1c696f||0xcc;return function(_0x1ad17d){if(_0x1ad17d){return _0x5141a1['sendStatus'](_0x1c696f);}return _0x5141a1[_0x5db1('0x1a')](_0x1c696f)[_0x5db1('0x1b')]();};}function respondWithResult(_0x52acd3,_0x30867b){_0x30867b=_0x30867b||0xc8;return function(_0x59cf6d){if(_0x59cf6d){return _0x52acd3[_0x5db1('0x1a')](_0x30867b)[_0x5db1('0x1c')](_0x59cf6d);}};}function respondWithFilteredResult(_0x3c7115,_0x30d7a){return function(_0x315f9e){if(_0x315f9e){var _0x1e660e=typeof _0x30d7a['offset']===_0x5db1('0x1d')&&typeof _0x30d7a[_0x5db1('0x1e')]===_0x5db1('0x1d');var _0x382a3a=_0x315f9e[_0x5db1('0x1f')];var _0x5d40e6=_0x1e660e?0x0:_0x30d7a[_0x5db1('0x20')];var _0x5c4f82=_0x1e660e?_0x315f9e[_0x5db1('0x1f')]:_0x30d7a[_0x5db1('0x20')]+_0x30d7a[_0x5db1('0x1e')];var _0x2154db;if(_0x5c4f82>=_0x382a3a){_0x5c4f82=_0x382a3a;_0x2154db=0xc8;}else{_0x2154db=0xce;}_0x3c7115[_0x5db1('0x1a')](_0x2154db);return _0x3c7115[_0x5db1('0x21')](_0x5db1('0x22'),_0x5d40e6+'-'+_0x5c4f82+'/'+_0x382a3a)[_0x5db1('0x1c')](_0x315f9e);}return null;};}function patchUpdates(_0x443afe){return function(_0x4f7ea8){try{jsonpatch['apply'](_0x4f7ea8,_0x443afe,!![]);}catch(_0x257a91){return BPromise[_0x5db1('0x23')](_0x257a91);}return _0x4f7ea8[_0x5db1('0x24')]();};}function saveUpdates(_0x5486b3,_0x2e9590){return function(_0x252393){if(_0x252393){return _0x252393['update'](_0x5486b3)[_0x5db1('0x25')](function(_0x1ea2ff){return _0x1ea2ff;});}return null;};}function removeEntity(_0x1a5728,_0x59e18e){return function(_0x508a69){if(_0x508a69){return _0x508a69[_0x5db1('0x26')]()[_0x5db1('0x25')](function(){_0x1a5728[_0x5db1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5f61,_0x3c8aca){return function(_0x5d16ca){if(!_0x5d16ca){_0x5b5f61[_0x5db1('0x27')](0x194);}return _0x5d16ca;};}function handleError(_0x463675,_0x487a6d){_0x487a6d=_0x487a6d||0x1f4;return function(_0x536329){logger[_0x5db1('0x28')](_0x536329['stack']);if(_0x536329[_0x5db1('0x29')]){delete _0x536329[_0x5db1('0x29')];}_0x463675[_0x5db1('0x1a')](_0x487a6d)['send'](_0x536329);};}exports[_0x5db1('0x2a')]=function(_0x58aabb,_0x5cc5dc){var _0x36b7d6={},_0x3d2338={},_0x8eb242={'count':0x0,'rows':[]};var _0x229a63=_[_0x5db1('0x2b')](db['SalesforceConfiguration'][_0x5db1('0x2c')],function(_0x5e395c){return{'name':_0x5e395c[_0x5db1('0x2d')],'type':_0x5e395c[_0x5db1('0x2e')][_0x5db1('0x2f')]};});_0x3d2338['model']=_[_0x5db1('0x2b')](_0x229a63,_0x5db1('0x29'));_0x3d2338['query']=_[_0x5db1('0x30')](_0x58aabb[_0x5db1('0x31')]);_0x3d2338['filters']=_[_0x5db1('0x32')](_0x3d2338['model'],_0x3d2338[_0x5db1('0x31')]);_0x36b7d6[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0x3d2338[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x35')]));_0x36b7d6[_0x5db1('0x33')]=_0x36b7d6[_0x5db1('0x33')]['length']?_0x36b7d6[_0x5db1('0x33')]:_0x3d2338['model'];if(!_0x58aabb['query']['hasOwnProperty'](_0x5db1('0x36'))){_0x36b7d6[_0x5db1('0x1e')]=qs[_0x5db1('0x1e')](_0x58aabb['query']['limit']);_0x36b7d6['offset']=qs[_0x5db1('0x20')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x20')]);}_0x36b7d6[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x38')]);_0x36b7d6[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_[_0x5db1('0x3b')](_0x58aabb['query'],_0x3d2338[_0x5db1('0x3a')]),_0x229a63);if(_0x58aabb[_0x5db1('0x31')]['filter']){_0x36b7d6[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x36b7d6[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x229a63,function(_0x3505e5){if(_0x3505e5[_0x5db1('0x2e')]!==_0x5db1('0x3d')){var _0x5373e1={};_0x5373e1[_0x3505e5[_0x5db1('0x29')]]={'$like':'%'+_0x58aabb[_0x5db1('0x31')]['filter']+'%'};return _0x5373e1;}})});}_0x36b7d6=_[_0x5db1('0x3c')]({},_0x36b7d6,_0x58aabb['options']);var _0x5eb389={'where':_0x36b7d6[_0x5db1('0x39')]};return db[_0x5db1('0x3e')][_0x5db1('0x1f')](_0x5eb389)[_0x5db1('0x25')](function(_0x4fe7d7){_0x8eb242[_0x5db1('0x1f')]=_0x4fe7d7;if(_0x58aabb['query'][_0x5db1('0x3f')]){_0x36b7d6[_0x5db1('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x5db1('0x41')](_0x36b7d6);})[_0x5db1('0x25')](function(_0x14769b){_0x8eb242['rows']=_0x14769b;return _0x8eb242;})[_0x5db1('0x25')](respondWithFilteredResult(_0x5cc5dc,_0x36b7d6))[_0x5db1('0x42')](handleError(_0x5cc5dc,null));};exports[_0x5db1('0x43')]=function(_0x4e0848,_0x16f0b6){var _0xf6ea1={'raw':![],'where':{'id':_0x4e0848[_0x5db1('0x44')]['id']}},_0xa347ab={};_0xa347ab[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x3e')][_0x5db1('0x2c')]);_0xa347ab['query']=_['keys'](_0x4e0848['query']);_0xa347ab['filters']=_['intersection'](_0xa347ab[_0x5db1('0x34')],_0xa347ab[_0x5db1('0x31')]);_0xf6ea1[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0xa347ab['model'],qs[_0x5db1('0x35')](_0x4e0848[_0x5db1('0x31')][_0x5db1('0x35')]));_0xf6ea1['attributes']=_0xf6ea1['attributes'][_0x5db1('0x45')]?_0xf6ea1['attributes']:_0xa347ab[_0x5db1('0x34')];if(_0x4e0848[_0x5db1('0x31')]['includeAll']){_0xf6ea1[_0x5db1('0x40')]=[{'all':!![]}];}_0xf6ea1=_[_0x5db1('0x3c')]({},_0xf6ea1,_0x4e0848[_0x5db1('0x46')]);return db['SalesforceConfiguration'][_0x5db1('0x47')](_0xf6ea1)[_0x5db1('0x25')](handleEntityNotFound(_0x16f0b6,null))[_0x5db1('0x25')](respondWithResult(_0x16f0b6,null))[_0x5db1('0x42')](handleError(_0x16f0b6,null));};exports[_0x5db1('0x48')]=function(_0x5853e2,_0x4020f3){return db[_0x5db1('0x3e')][_0x5db1('0x48')](_0x5853e2[_0x5db1('0x49')],{})['then'](respondWithResult(_0x4020f3,0xc9))['catch'](handleError(_0x4020f3,null));};exports[_0x5db1('0x4a')]=function(_0x3c164c,_0xb1a473){if(_0x3c164c['body']['id']){delete _0x3c164c[_0x5db1('0x49')]['id'];}return db[_0x5db1('0x3e')][_0x5db1('0x47')]({'where':{'id':_0x3c164c['params']['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0xb1a473,null))['then'](saveUpdates(_0x3c164c[_0x5db1('0x49')],null))['then'](respondWithResult(_0xb1a473,null))[_0x5db1('0x42')](handleError(_0xb1a473,null));};exports['destroy']=function(_0x4b0654,_0x16da4e){return db['SalesforceConfiguration'][_0x5db1('0x47')]({'where':{'id':_0x4b0654[_0x5db1('0x44')]['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0x16da4e,null))[_0x5db1('0x25')](removeEntity(_0x16da4e,null))[_0x5db1('0x42')](handleError(_0x16da4e,null));};exports[_0x5db1('0x4b')]=function(_0x4cc53f,_0x1bee12,_0x2f6a20){var _0x247835={};var _0x2fdf79={};var _0x2e4e81;var _0x155348;return db[_0x5db1('0x3e')][_0x5db1('0x4c')]({'where':{'id':_0x4cc53f[_0x5db1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bee12,null))[_0x5db1('0x25')](function(_0x25ace6){if(_0x25ace6){_0x2e4e81=_0x25ace6;_0x2fdf79[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x4d')][_0x5db1('0x2c')]);_0x2fdf79[_0x5db1('0x31')]=_['keys'](_0x4cc53f['query']);_0x2fdf79[_0x5db1('0x3a')]=_[_0x5db1('0x32')](_0x2fdf79['model'],_0x2fdf79[_0x5db1('0x31')]);_0x247835[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0x2fdf79[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x4cc53f['query'][_0x5db1('0x35')]));_0x247835[_0x5db1('0x33')]=_0x247835[_0x5db1('0x33')][_0x5db1('0x45')]?_0x247835[_0x5db1('0x33')]:_0x2fdf79[_0x5db1('0x34')];_0x247835[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x38')]);_0x247835[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_[_0x5db1('0x3b')](_0x4cc53f[_0x5db1('0x31')],_0x2fdf79[_0x5db1('0x3a')]));if(_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x4e')]){_0x247835['where']=_['merge'](_0x247835[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x247835['attributes'],function(_0x2cfd06){var _0x49afcb={};_0x49afcb[_0x2cfd06]={'$like':'%'+_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x4e')]+'%'};return _0x49afcb;})});}_0x247835=_['merge']({},_0x247835,_0x4cc53f[_0x5db1('0x46')]);return _0x2e4e81['getFields'](_0x247835);}})[_0x5db1('0x25')](function(_0x5e3d3a){if(_0x5e3d3a){_0x155348=_0x5e3d3a['length'];if(!_0x4cc53f['query']['hasOwnProperty'](_0x5db1('0x36'))){_0x247835['limit']=qs[_0x5db1('0x1e')](_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x1e')]);_0x247835[_0x5db1('0x20')]=qs[_0x5db1('0x20')](_0x4cc53f[_0x5db1('0x31')]['offset']);}return _0x2e4e81['getFields'](_0x247835);}})[_0x5db1('0x25')](function(_0x2cf4aa){if(_0x2cf4aa){return _0x2cf4aa?{'count':_0x155348,'rows':_0x2cf4aa}:null;}})[_0x5db1('0x25')](respondWithResult(_0x1bee12,null))['catch'](handleError(_0x1bee12,null));};exports[_0x5db1('0x4f')]=function(_0x190135,_0x32c6df,_0x1f7076){var _0x447e25={};var _0x1650be={};var _0x42ec5a;var _0x41bb68;return db['SalesforceConfiguration'][_0x5db1('0x4c')]({'where':{'id':_0x190135[_0x5db1('0x44')]['id']}})['then'](handleEntityNotFound(_0x32c6df,null))[_0x5db1('0x25')](function(_0x262a4a){if(_0x262a4a){_0x42ec5a=_0x262a4a;_0x1650be[_0x5db1('0x34')]=_[_0x5db1('0x30')](db['SalesforceField'][_0x5db1('0x2c')]);_0x1650be['query']=_[_0x5db1('0x30')](_0x190135['query']);_0x1650be[_0x5db1('0x3a')]=_[_0x5db1('0x32')](_0x1650be['model'],_0x1650be[_0x5db1('0x31')]);_0x447e25['attributes']=_[_0x5db1('0x32')](_0x1650be[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x190135[_0x5db1('0x31')][_0x5db1('0x35')]));_0x447e25[_0x5db1('0x33')]=_0x447e25[_0x5db1('0x33')][_0x5db1('0x45')]?_0x447e25[_0x5db1('0x33')]:_0x1650be[_0x5db1('0x34')];_0x447e25[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x190135[_0x5db1('0x31')][_0x5db1('0x38')]);_0x447e25[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_['pick'](_0x190135[_0x5db1('0x31')],_0x1650be[_0x5db1('0x3a')]));if(_0x190135['query'][_0x5db1('0x4e')]){_0x447e25[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x447e25[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x447e25['attributes'],function(_0x475f0e){var _0x1bbe4={};_0x1bbe4[_0x475f0e]={'$like':'%'+_0x190135[_0x5db1('0x31')]['filter']+'%'};return _0x1bbe4;})});}_0x447e25=_[_0x5db1('0x3c')]({},_0x447e25,_0x190135[_0x5db1('0x46')]);return _0x42ec5a['getSubjects'](_0x447e25);}})[_0x5db1('0x25')](function(_0x18e0b6){if(_0x18e0b6){_0x41bb68=_0x18e0b6[_0x5db1('0x45')];if(!_0x190135[_0x5db1('0x31')][_0x5db1('0x50')]('nolimit')){_0x447e25[_0x5db1('0x1e')]=qs[_0x5db1('0x1e')](_0x190135[_0x5db1('0x31')]['limit']);_0x447e25['offset']=qs['offset'](_0x190135[_0x5db1('0x31')]['offset']);}return _0x42ec5a['getSubjects'](_0x447e25);}})['then'](function(_0x19f32b){if(_0x19f32b){return _0x19f32b?{'count':_0x41bb68,'rows':_0x19f32b}:null;}})[_0x5db1('0x25')](respondWithResult(_0x32c6df,null))['catch'](handleError(_0x32c6df,null));};exports['getDescriptions']=function(_0x21893d,_0x113f7e,_0x3513d9){var _0x3fe5eb={};var _0x23dd1c={};var _0x2b8cf0;var _0x277b41;return db[_0x5db1('0x3e')][_0x5db1('0x4c')]({'where':{'id':_0x21893d[_0x5db1('0x44')]['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0x113f7e,null))[_0x5db1('0x25')](function(_0x507553){if(_0x507553){_0x2b8cf0=_0x507553;_0x23dd1c[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x4d')][_0x5db1('0x2c')]);_0x23dd1c[_0x5db1('0x31')]=_['keys'](_0x21893d['query']);_0x23dd1c['filters']=_[_0x5db1('0x32')](_0x23dd1c['model'],_0x23dd1c[_0x5db1('0x31')]);_0x3fe5eb['attributes']=_[_0x5db1('0x32')](_0x23dd1c[_0x5db1('0x34')],qs['fields'](_0x21893d[_0x5db1('0x31')]['fields']));_0x3fe5eb['attributes']=_0x3fe5eb[_0x5db1('0x33')][_0x5db1('0x45')]?_0x3fe5eb['attributes']:_0x23dd1c[_0x5db1('0x34')];_0x3fe5eb['order']=qs['sort'](_0x21893d[_0x5db1('0x31')][_0x5db1('0x38')]);_0x3fe5eb[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_['pick'](_0x21893d['query'],_0x23dd1c['filters']));if(_0x21893d[_0x5db1('0x31')][_0x5db1('0x4e')]){_0x3fe5eb[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x3fe5eb['where'],{'$or':_['map'](_0x3fe5eb[_0x5db1('0x33')],function(_0x150c9d){var _0x436316={};_0x436316[_0x150c9d]={'$like':'%'+_0x21893d[_0x5db1('0x31')][_0x5db1('0x4e')]+'%'};return _0x436316;})});}_0x3fe5eb=_[_0x5db1('0x3c')]({},_0x3fe5eb,_0x21893d[_0x5db1('0x46')]);return _0x2b8cf0[_0x5db1('0x51')](_0x3fe5eb);}})['then'](function(_0x33ba7f){if(_0x33ba7f){_0x277b41=_0x33ba7f[_0x5db1('0x45')];if(!_0x21893d['query'][_0x5db1('0x50')](_0x5db1('0x36'))){_0x3fe5eb['limit']=qs[_0x5db1('0x1e')](_0x21893d[_0x5db1('0x31')][_0x5db1('0x1e')]);_0x3fe5eb[_0x5db1('0x20')]=qs[_0x5db1('0x20')](_0x21893d[_0x5db1('0x31')][_0x5db1('0x20')]);}return _0x2b8cf0[_0x5db1('0x51')](_0x3fe5eb);}})[_0x5db1('0x25')](function(_0x15297c){if(_0x15297c){return _0x15297c?{'count':_0x277b41,'rows':_0x15297c}:null;}})[_0x5db1('0x25')](respondWithResult(_0x113f7e,null))[_0x5db1('0x42')](handleError(_0x113f7e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fac4aba..99bd717 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 _0x9ead=['path','../../config/environment','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ef412,_0x5267bb){var _0x386df5=function(_0x1f8334){while(--_0x1f8334){_0x5ef412['push'](_0x5ef412['shift']());}};_0x386df5(++_0x5267bb);}(_0x9ead,0xdd));var _0xd9ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9ead[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xd9ea('0x0'));var util=require(_0xd9ea('0x1'));var logger=require(_0xd9ea('0x2'))(_0xd9ea('0x3'));var moment=require(_0xd9ea('0x4'));var BPromise=require(_0xd9ea('0x5'));var rp=require(_0xd9ea('0x6'));var fs=require('fs');var path=require(_0xd9ea('0x7'));var rimraf=require('rimraf');var config=require(_0xd9ea('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd9ea('0x9')]=function(_0x5638bc,_0x2be0d7){return _0x5638bc[_0xd9ea('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xd9ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa767=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger'];(function(_0x381ffb,_0x396e53){var _0x1ca01f=function(_0x43a41e){while(--_0x43a41e){_0x381ffb['push'](_0x381ffb['shift']());}};_0x1ca01f(++_0x396e53);}(_0xa767,0x12a));var _0x7a76=function(_0x3fb289,_0x1029ae){_0x3fb289=_0x3fb289-0x0;var _0x2dd044=_0xa767[_0x3fb289];return _0x2dd044;};'use strict';var _=require('lodash');var util=require(_0x7a76('0x0'));var logger=require(_0x7a76('0x1'))(_0x7a76('0x2'));var moment=require(_0x7a76('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a76('0x4'));var fs=require('fs');var path=require(_0x7a76('0x5'));var rimraf=require(_0x7a76('0x6'));var config=require(_0x7a76('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x7a76('0x8')]=function(_0x2c9de4,_0x439cb6){return _0x2c9de4[_0x7a76('0x9')](_0x7a76('0xa'),attributes,{'tableName':_0x7a76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 234b97f..bf77f9e 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 _0x15dd=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x518d69,_0x3c4d7c){var _0x15079d=function(_0x17422c){while(--_0x17422c){_0x518d69['push'](_0x518d69['shift']());}};_0x15079d(++_0x3c4d7c);}(_0x15dd,0x1d9));var _0xd15d=function(_0xef9d03,_0x37617a){_0xef9d03=_0xef9d03-0x0;var _0x393bec=_0x15dd[_0xef9d03];return _0x393bec;};'use strict';var _=require('lodash');var util=require(_0xd15d('0x0'));var moment=require(_0xd15d('0x1'));var BPromise=require('bluebird');var rs=require(_0xd15d('0x2'));var fs=require('fs');var Redis=require(_0xd15d('0x3'));var db=require(_0xd15d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd15d('0x5'))(_0xd15d('0x6'));var config=require(_0xd15d('0x7'));var jayson=require(_0xd15d('0x8'));var client=jayson[_0xd15d('0x9')][_0xd15d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9beb,_0x52cd08,_0x4690a5){return new BPromise(function(_0x2bc795,_0x22c995){return client[_0xd15d('0xb')](_0x4a9beb,_0x4690a5)[_0xd15d('0xc')](function(_0x1c1b51){logger[_0xd15d('0xd')](_0xd15d('0xe'),_0x52cd08,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x52cd08,_0xd15d('0xf'),JSON[_0xd15d('0x10')](_0x1c1b51));if(_0x1c1b51[_0xd15d('0x11')]){if(_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x52cd08,_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);return _0x22c995(_0x1c1b51['error']['message']);}logger[_0xd15d('0x11')](_0xd15d('0xe'),_0x52cd08,_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);return _0x2bc795(_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);}else{logger[_0xd15d('0xd')](_0xd15d('0xe'),_0x52cd08,_0xd15d('0xf'));_0x2bc795(_0x1c1b51['result'][_0xd15d('0x13')]);}})[_0xd15d('0x14')](function(_0x464d21){logger[_0xd15d('0x11')](_0xd15d('0xe'),_0x52cd08,_0x464d21);_0x22c995(_0x464d21);});});} \ No newline at end of file +var _0x3737=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x16f590,_0xf51f45){var _0x32f4ea=function(_0x486e3e){while(--_0x486e3e){_0x16f590['push'](_0x16f590['shift']());}};_0x32f4ea(++_0xf51f45);}(_0x3737,0x162));var _0x7373=function(_0x29f716,_0x4c551e){_0x29f716=_0x29f716-0x0;var _0x1ae1e1=_0x3737[_0x29f716];return _0x1ae1e1;};'use strict';var _=require('lodash');var util=require(_0x7373('0x0'));var moment=require(_0x7373('0x1'));var BPromise=require(_0x7373('0x2'));var rs=require(_0x7373('0x3'));var fs=require('fs');var Redis=require(_0x7373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7373('0x5'));var logger=require(_0x7373('0x6'))(_0x7373('0x7'));var config=require(_0x7373('0x8'));var jayson=require(_0x7373('0x9'));var client=jayson[_0x7373('0xa')][_0x7373('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb138,_0x1bd10b,_0x252a9c){return new BPromise(function(_0x4c5055,_0x279126){return client[_0x7373('0xc')](_0x3eb138,_0x252a9c)[_0x7373('0xd')](function(_0x1d6d49){logger['info'](_0x7373('0xe'),_0x1bd10b,_0x7373('0xf'));logger[_0x7373('0x10')](_0x7373('0x11'),_0x1bd10b,_0x7373('0xf'),JSON[_0x7373('0x12')](_0x1d6d49));if(_0x1d6d49[_0x7373('0x13')]){if(_0x1d6d49[_0x7373('0x13')][_0x7373('0x14')]===0x1f4){logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x1d6d49[_0x7373('0x13')]['message']);return _0x279126(_0x1d6d49['error'][_0x7373('0x15')]);}logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x1d6d49[_0x7373('0x13')][_0x7373('0x15')]);return _0x4c5055(_0x1d6d49[_0x7373('0x13')][_0x7373('0x15')]);}else{logger[_0x7373('0x16')](_0x7373('0xe'),_0x1bd10b,_0x7373('0xf'));_0x4c5055(_0x1d6d49['result']['message']);}})[_0x7373('0x17')](function(_0x306f1a){logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x306f1a);_0x279126(_0x306f1a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 60e2806..9583340 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 _0x042d=['post','create','put','update','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0x042d,0x15e));var _0xd042=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x042d[_0x57d13b];return _0x467696;};'use strict';var multer=require(_0xd042('0x0'));var util=require('util');var path=require(_0xd042('0x1'));var timeout=require('connect-timeout');var express=require(_0xd042('0x2'));var router=express[_0xd042('0x3')]();var fs_extra=require(_0xd042('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd042('0x5'));var config=require(_0xd042('0x6'));var controller=require(_0xd042('0x7'));router[_0xd042('0x8')]('/',auth[_0xd042('0x9')](),controller[_0xd042('0xa')]);router[_0xd042('0x8')]('/:id',auth[_0xd042('0x9')](),controller['show']);router[_0xd042('0xb')]('/',auth[_0xd042('0x9')](),controller[_0xd042('0xc')]);router[_0xd042('0xd')]('/:id',auth[_0xd042('0x9')](),controller[_0xd042('0xe')]);router[_0xd042('0xf')](_0xd042('0x10'),auth['isAuthenticated'](),controller[_0xd042('0x11')]);module[_0xd042('0x12')]=router; \ No newline at end of file +var _0x8425=['create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4c6a55,_0x773327){var _0xdfd921=function(_0x5d3e51){while(--_0x5d3e51){_0x4c6a55['push'](_0x4c6a55['shift']());}};_0xdfd921(++_0x773327);}(_0x8425,0x147));var _0x5842=function(_0x175485,_0x47ca08){_0x175485=_0x175485-0x0;var _0x5c205f=_0x8425[_0x175485];return _0x5c205f;};'use strict';var multer=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var path=require('path');var timeout=require(_0x5842('0x2'));var express=require(_0x5842('0x3'));var router=express[_0x5842('0x4')]();var fs_extra=require(_0x5842('0x5'));var auth=require(_0x5842('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5842('0x7'));var controller=require(_0x5842('0x8'));router[_0x5842('0x9')]('/',auth[_0x5842('0xa')](),controller[_0x5842('0xb')]);router[_0x5842('0x9')](_0x5842('0xc'),auth[_0x5842('0xa')](),controller[_0x5842('0xd')]);router[_0x5842('0xe')]('/',auth[_0x5842('0xa')](),controller[_0x5842('0xf')]);router['put'](_0x5842('0xc'),auth[_0x5842('0xa')](),controller[_0x5842('0x10')]);router['delete'](_0x5842('0xc'),auth[_0x5842('0xa')](),controller['destroy']);module[_0x5842('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5a2228d..473b281 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 _0x8932=['customVariable','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x3a9213,_0x307da3){var _0x221236=function(_0x1824cf){while(--_0x1824cf){_0x3a9213['push'](_0x3a9213['shift']());}};_0x221236(++_0x307da3);}(_0x8932,0x101));var _0x2893=function(_0x358e42,_0x88ec74){_0x358e42=_0x358e42-0x0;var _0x5b14a4=_0x8932[_0x358e42];return _0x5b14a4;};'use strict';var Sequelize=require('sequelize');module[_0x2893('0x0')]={'type':{'type':Sequelize[_0x2893('0x1')](_0x2893('0x2'),_0x2893('0x3'),'customVariable',_0x2893('0x4'),_0x2893('0x5')),'defaultValue':_0x2893('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2893('0x6')]},'keyType':{'type':Sequelize[_0x2893('0x1')](_0x2893('0x2'),_0x2893('0x3'),_0x2893('0x7'))},'keyContent':{'type':Sequelize[_0x2893('0x6')]},'idField':{'type':Sequelize[_0x2893('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9848=['STRING','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x178824,_0x47690d){var _0x35e45c=function(_0x4f67b2){while(--_0x4f67b2){_0x178824['push'](_0x178824['shift']());}};_0x35e45c(++_0x47690d);}(_0x9848,0x139));var _0x8984=function(_0x3e462f,_0x3c35ac){_0x3e462f=_0x3e462f-0x0;var _0x1213bf=_0x9848[_0x3e462f];return _0x1213bf;};'use strict';var Sequelize=require('sequelize');module[_0x8984('0x0')]={'type':{'type':Sequelize[_0x8984('0x1')](_0x8984('0x2'),_0x8984('0x3'),_0x8984('0x4'),_0x8984('0x5'),_0x8984('0x6')),'defaultValue':_0x8984('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8984('0x7')]},'keyType':{'type':Sequelize[_0x8984('0x1')]('string',_0x8984('0x3'),_0x8984('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8984('0x7')]},'variableName':{'type':Sequelize[_0x8984('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d09b6a4..ac5e029 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 _0x06ca=['fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceField','includeAll','include','findAll','show','params','rawAttributes','length','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x3ead25,_0x456c38){var _0x45a399=function(_0x6b1524){while(--_0x6b1524){_0x3ead25['push'](_0x3ead25['shift']());}};_0x45a399(++_0x456c38);}(_0x06ca,0x101));var _0xa06c=function(_0x4dc46a,_0x4c8f59){_0x4dc46a=_0x4dc46a-0x0;var _0x304a3c=_0x06ca[_0x4dc46a];return _0x304a3c;};'use strict';var emlformat=require(_0xa06c('0x0'));var rimraf=require(_0xa06c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa06c('0x2'));var rp=require(_0xa06c('0x3'));var moment=require(_0xa06c('0x4'));var BPromise=require(_0xa06c('0x5'));var Mustache=require(_0xa06c('0x6'));var util=require(_0xa06c('0x7'));var path=require(_0xa06c('0x8'));var sox=require(_0xa06c('0x9'));var csv=require(_0xa06c('0xa'));var ejs=require(_0xa06c('0xb'));var fs=require('fs');var fs_extra=require(_0xa06c('0xc'));var _=require(_0xa06c('0xd'));var squel=require(_0xa06c('0xe'));var crypto=require(_0xa06c('0xf'));var jsforce=require(_0xa06c('0x10'));var deskjs=require(_0xa06c('0x11'));var toCsv=require(_0xa06c('0xa'));var querystring=require(_0xa06c('0x12'));var Papa=require(_0xa06c('0x13'));var Redis=require(_0xa06c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa06c('0x15'));var hardwareService=require(_0xa06c('0x16'));var logger=require(_0xa06c('0x17'))('api');var utils=require(_0xa06c('0x18'));var config=require(_0xa06c('0x19'));var licenseUtil=require(_0xa06c('0x1a'));var db=require(_0xa06c('0x1b'))['db'];function respondWithStatusCode(_0x21d192,_0xb4d06f){_0xb4d06f=_0xb4d06f||0xcc;return function(_0x226e59){if(_0x226e59){return _0x21d192[_0xa06c('0x1c')](_0xb4d06f);}return _0x21d192[_0xa06c('0x1d')](_0xb4d06f)[_0xa06c('0x1e')]();};}function respondWithResult(_0x39d24e,_0x460512){_0x460512=_0x460512||0xc8;return function(_0x14e088){if(_0x14e088){return _0x39d24e[_0xa06c('0x1d')](_0x460512)[_0xa06c('0x1f')](_0x14e088);}};}function respondWithFilteredResult(_0x3c3575,_0x531a05){return function(_0x427869){if(_0x427869){var _0x4b449f=typeof _0x531a05[_0xa06c('0x20')]===_0xa06c('0x21')&&typeof _0x531a05[_0xa06c('0x22')]===_0xa06c('0x21');var _0x72ab53=_0x427869[_0xa06c('0x23')];var _0x5a103b=_0x4b449f?0x0:_0x531a05['offset'];var _0x17bdba=_0x4b449f?_0x427869[_0xa06c('0x23')]:_0x531a05['offset']+_0x531a05[_0xa06c('0x22')];var _0x22882a;if(_0x17bdba>=_0x72ab53){_0x17bdba=_0x72ab53;_0x22882a=0xc8;}else{_0x22882a=0xce;}_0x3c3575[_0xa06c('0x1d')](_0x22882a);return _0x3c3575[_0xa06c('0x24')](_0xa06c('0x25'),_0x5a103b+'-'+_0x17bdba+'/'+_0x72ab53)[_0xa06c('0x1f')](_0x427869);}return null;};}function patchUpdates(_0x4d1246){return function(_0x5b4d61){try{jsonpatch[_0xa06c('0x26')](_0x5b4d61,_0x4d1246,!![]);}catch(_0x590549){return BPromise['reject'](_0x590549);}return _0x5b4d61[_0xa06c('0x27')]();};}function saveUpdates(_0x3bfdc1,_0x5437b5){return function(_0x5e75d2){if(_0x5e75d2){return _0x5e75d2[_0xa06c('0x28')](_0x3bfdc1)[_0xa06c('0x29')](function(_0x47d601){return _0x47d601;});}return null;};}function removeEntity(_0x29077f,_0x16f9f7){return function(_0x2293a3){if(_0x2293a3){return _0x2293a3[_0xa06c('0x2a')]()[_0xa06c('0x29')](function(){_0x29077f[_0xa06c('0x1d')](0xcc)[_0xa06c('0x1e')]();});}};}function handleEntityNotFound(_0x4ab976,_0x437613){return function(_0x4bb46c){if(!_0x4bb46c){_0x4ab976[_0xa06c('0x1c')](0x194);}return _0x4bb46c;};}function handleError(_0x49aecc,_0x250760){_0x250760=_0x250760||0x1f4;return function(_0xe2311f){logger['error'](_0xe2311f[_0xa06c('0x2b')]);if(_0xe2311f[_0xa06c('0x2c')]){delete _0xe2311f[_0xa06c('0x2c')];}_0x49aecc[_0xa06c('0x1d')](_0x250760)[_0xa06c('0x2d')](_0xe2311f);};}exports[_0xa06c('0x2e')]=function(_0x3958a4,_0x5c8969){var _0x1a8cb4={},_0x5012eb={},_0xd690d5={'count':0x0,'rows':[]};var _0x1f9daa=_[_0xa06c('0x2f')](db['SalesforceField']['rawAttributes'],function(_0x2b4430){return{'name':_0x2b4430['fieldName'],'type':_0x2b4430['type'][_0xa06c('0x30')]};});_0x5012eb[_0xa06c('0x31')]=_[_0xa06c('0x2f')](_0x1f9daa,'name');_0x5012eb[_0xa06c('0x32')]=_[_0xa06c('0x33')](_0x3958a4['query']);_0x5012eb[_0xa06c('0x34')]=_[_0xa06c('0x35')](_0x5012eb[_0xa06c('0x31')],_0x5012eb[_0xa06c('0x32')]);_0x1a8cb4[_0xa06c('0x36')]=_['intersection'](_0x5012eb[_0xa06c('0x31')],qs[_0xa06c('0x37')](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x37')]));_0x1a8cb4[_0xa06c('0x36')]=_0x1a8cb4['attributes']['length']?_0x1a8cb4[_0xa06c('0x36')]:_0x5012eb[_0xa06c('0x31')];if(!_0x3958a4['query']['hasOwnProperty'](_0xa06c('0x38'))){_0x1a8cb4[_0xa06c('0x22')]=qs[_0xa06c('0x22')](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x22')]);_0x1a8cb4['offset']=qs[_0xa06c('0x20')](_0x3958a4[_0xa06c('0x32')]['offset']);}_0x1a8cb4[_0xa06c('0x39')]=qs['sort'](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x3a')]);_0x1a8cb4[_0xa06c('0x3b')]=qs[_0xa06c('0x34')](_[_0xa06c('0x3c')](_0x3958a4[_0xa06c('0x32')],_0x5012eb[_0xa06c('0x34')]),_0x1f9daa);if(_0x3958a4[_0xa06c('0x32')][_0xa06c('0x3d')]){_0x1a8cb4[_0xa06c('0x3b')]=_[_0xa06c('0x3e')](_0x1a8cb4[_0xa06c('0x3b')],{'$or':_[_0xa06c('0x2f')](_0x1f9daa,function(_0x265912){if(_0x265912[_0xa06c('0x3f')]!==_0xa06c('0x40')){var _0x352695={};_0x352695[_0x265912[_0xa06c('0x2c')]]={'$like':'%'+_0x3958a4['query'][_0xa06c('0x3d')]+'%'};return _0x352695;}})});}_0x1a8cb4=_[_0xa06c('0x3e')]({},_0x1a8cb4,_0x3958a4['options']);var _0x1c4184={'where':_0x1a8cb4[_0xa06c('0x3b')]};return db[_0xa06c('0x41')]['count'](_0x1c4184)[_0xa06c('0x29')](function(_0x43df71){_0xd690d5[_0xa06c('0x23')]=_0x43df71;if(_0x3958a4[_0xa06c('0x32')][_0xa06c('0x42')]){_0x1a8cb4[_0xa06c('0x43')]=[{'all':!![]}];}return db[_0xa06c('0x41')][_0xa06c('0x44')](_0x1a8cb4);})[_0xa06c('0x29')](function(_0x4ace2b){_0xd690d5['rows']=_0x4ace2b;return _0xd690d5;})[_0xa06c('0x29')](respondWithFilteredResult(_0x5c8969,_0x1a8cb4))['catch'](handleError(_0x5c8969,null));};exports[_0xa06c('0x45')]=function(_0x5c1896,_0x3e69de){var _0x3efd00={'raw':!![],'where':{'id':_0x5c1896[_0xa06c('0x46')]['id']}},_0x7ce069={};_0x7ce069[_0xa06c('0x31')]=_['keys'](db[_0xa06c('0x41')][_0xa06c('0x47')]);_0x7ce069[_0xa06c('0x32')]=_[_0xa06c('0x33')](_0x5c1896[_0xa06c('0x32')]);_0x7ce069['filters']=_['intersection'](_0x7ce069['model'],_0x7ce069[_0xa06c('0x32')]);_0x3efd00[_0xa06c('0x36')]=_[_0xa06c('0x35')](_0x7ce069['model'],qs['fields'](_0x5c1896[_0xa06c('0x32')][_0xa06c('0x37')]));_0x3efd00[_0xa06c('0x36')]=_0x3efd00[_0xa06c('0x36')][_0xa06c('0x48')]?_0x3efd00[_0xa06c('0x36')]:_0x7ce069['model'];if(_0x5c1896[_0xa06c('0x32')][_0xa06c('0x42')]){_0x3efd00[_0xa06c('0x43')]=[{'all':!![]}];}_0x3efd00=_['merge']({},_0x3efd00,_0x5c1896[_0xa06c('0x49')]);return db[_0xa06c('0x41')][_0xa06c('0x4a')](_0x3efd00)[_0xa06c('0x29')](handleEntityNotFound(_0x3e69de,null))[_0xa06c('0x29')](respondWithResult(_0x3e69de,null))[_0xa06c('0x4b')](handleError(_0x3e69de,null));};exports[_0xa06c('0x4c')]=function(_0x20fd86,_0xafa18e){return db[_0xa06c('0x41')][_0xa06c('0x4c')](_0x20fd86[_0xa06c('0x4d')],{})[_0xa06c('0x29')](respondWithResult(_0xafa18e,0xc9))[_0xa06c('0x4b')](handleError(_0xafa18e,null));};exports[_0xa06c('0x28')]=function(_0x309dcd,_0x8fe5e7){if(_0x309dcd[_0xa06c('0x4d')]['id']){delete _0x309dcd[_0xa06c('0x4d')]['id'];}return db[_0xa06c('0x41')]['find']({'where':{'id':_0x309dcd[_0xa06c('0x46')]['id']}})[_0xa06c('0x29')](handleEntityNotFound(_0x8fe5e7,null))[_0xa06c('0x29')](saveUpdates(_0x309dcd[_0xa06c('0x4d')],null))[_0xa06c('0x29')](respondWithResult(_0x8fe5e7,null))[_0xa06c('0x4b')](handleError(_0x8fe5e7,null));};exports['destroy']=function(_0x478361,_0x20bbd8){return db[_0xa06c('0x41')]['find']({'where':{'id':_0x478361['params']['id']}})[_0xa06c('0x29')](handleEntityNotFound(_0x20bbd8,null))['then'](removeEntity(_0x20bbd8,null))[_0xa06c('0x4b')](handleError(_0x20bbd8,null));}; \ No newline at end of file +var _0xf229=['error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','find','create','body','destroy','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf229,0xb1));var _0x9f22=function(_0x4f712b,_0x5688ed){_0x4f712b=_0x4f712b-0x0;var _0x35370a=_0xf229[_0x4f712b];return _0x35370a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f22('0x0'));var rp=require(_0x9f22('0x1'));var moment=require('moment');var BPromise=require(_0x9f22('0x2'));var Mustache=require(_0x9f22('0x3'));var util=require(_0x9f22('0x4'));var path=require(_0x9f22('0x5'));var sox=require('sox');var csv=require(_0x9f22('0x6'));var ejs=require(_0x9f22('0x7'));var fs=require('fs');var fs_extra=require(_0x9f22('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f22('0x9'));var jsforce=require(_0x9f22('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9f22('0x6'));var querystring=require(_0x9f22('0xb'));var Papa=require(_0x9f22('0xc'));var Redis=require(_0x9f22('0xd'));var authService=require(_0x9f22('0xe'));var qs=require(_0x9f22('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f22('0x10'));var logger=require(_0x9f22('0x11'))(_0x9f22('0x12'));var utils=require(_0x9f22('0x13'));var config=require(_0x9f22('0x14'));var licenseUtil=require(_0x9f22('0x15'));var db=require(_0x9f22('0x16'))['db'];function respondWithStatusCode(_0x4ed461,_0x387cf6){_0x387cf6=_0x387cf6||0xcc;return function(_0x55f769){if(_0x55f769){return _0x4ed461[_0x9f22('0x17')](_0x387cf6);}return _0x4ed461[_0x9f22('0x18')](_0x387cf6)[_0x9f22('0x19')]();};}function respondWithResult(_0x416a86,_0x5ddd9b){_0x5ddd9b=_0x5ddd9b||0xc8;return function(_0x1d3a9c){if(_0x1d3a9c){return _0x416a86[_0x9f22('0x18')](_0x5ddd9b)[_0x9f22('0x1a')](_0x1d3a9c);}};}function respondWithFilteredResult(_0x28f650,_0x1ae8fa){return function(_0x2c9d4f){if(_0x2c9d4f){var _0x4110eb=typeof _0x1ae8fa[_0x9f22('0x1b')]===_0x9f22('0x1c')&&typeof _0x1ae8fa[_0x9f22('0x1d')]===_0x9f22('0x1c');var _0x4a84db=_0x2c9d4f[_0x9f22('0x1e')];var _0x204628=_0x4110eb?0x0:_0x1ae8fa[_0x9f22('0x1b')];var _0x4044bc=_0x4110eb?_0x2c9d4f[_0x9f22('0x1e')]:_0x1ae8fa[_0x9f22('0x1b')]+_0x1ae8fa[_0x9f22('0x1d')];var _0x362b3f;if(_0x4044bc>=_0x4a84db){_0x4044bc=_0x4a84db;_0x362b3f=0xc8;}else{_0x362b3f=0xce;}_0x28f650[_0x9f22('0x18')](_0x362b3f);return _0x28f650[_0x9f22('0x1f')]('Content-Range',_0x204628+'-'+_0x4044bc+'/'+_0x4a84db)[_0x9f22('0x1a')](_0x2c9d4f);}return null;};}function patchUpdates(_0x2f4377){return function(_0x3c592b){try{jsonpatch['apply'](_0x3c592b,_0x2f4377,!![]);}catch(_0x2cbf6d){return BPromise[_0x9f22('0x20')](_0x2cbf6d);}return _0x3c592b[_0x9f22('0x21')]();};}function saveUpdates(_0x487374,_0x2e8035){return function(_0x48633c){if(_0x48633c){return _0x48633c[_0x9f22('0x22')](_0x487374)[_0x9f22('0x23')](function(_0x2f527b){return _0x2f527b;});}return null;};}function removeEntity(_0x431153,_0x22293a){return function(_0x344c82){if(_0x344c82){return _0x344c82['destroy']()[_0x9f22('0x23')](function(){_0x431153[_0x9f22('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237288,_0x2ed18b){return function(_0x7f706d){if(!_0x7f706d){_0x237288[_0x9f22('0x17')](0x194);}return _0x7f706d;};}function handleError(_0x2f7603,_0x319518){_0x319518=_0x319518||0x1f4;return function(_0x30f78a){logger[_0x9f22('0x24')](_0x30f78a[_0x9f22('0x25')]);if(_0x30f78a[_0x9f22('0x26')]){delete _0x30f78a[_0x9f22('0x26')];}_0x2f7603[_0x9f22('0x18')](_0x319518)[_0x9f22('0x27')](_0x30f78a);};}exports[_0x9f22('0x28')]=function(_0x25c66b,_0xf2cf36){var _0x4409a4={},_0x1beab8={},_0x29371b={'count':0x0,'rows':[]};var _0x480904=_['map'](db[_0x9f22('0x29')][_0x9f22('0x2a')],function(_0x2d7b86){return{'name':_0x2d7b86[_0x9f22('0x2b')],'type':_0x2d7b86[_0x9f22('0x2c')][_0x9f22('0x2d')]};});_0x1beab8['model']=_[_0x9f22('0x2e')](_0x480904,'name');_0x1beab8[_0x9f22('0x2f')]=_[_0x9f22('0x30')](_0x25c66b['query']);_0x1beab8[_0x9f22('0x31')]=_[_0x9f22('0x32')](_0x1beab8[_0x9f22('0x33')],_0x1beab8['query']);_0x4409a4[_0x9f22('0x34')]=_[_0x9f22('0x32')](_0x1beab8['model'],qs[_0x9f22('0x35')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x35')]));_0x4409a4['attributes']=_0x4409a4[_0x9f22('0x34')][_0x9f22('0x36')]?_0x4409a4[_0x9f22('0x34')]:_0x1beab8['model'];if(!_0x25c66b['query'][_0x9f22('0x37')]('nolimit')){_0x4409a4[_0x9f22('0x1d')]=qs['limit'](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x1d')]);_0x4409a4[_0x9f22('0x1b')]=qs[_0x9f22('0x1b')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x1b')]);}_0x4409a4[_0x9f22('0x38')]=qs[_0x9f22('0x39')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x39')]);_0x4409a4[_0x9f22('0x3a')]=qs[_0x9f22('0x31')](_['pick'](_0x25c66b[_0x9f22('0x2f')],_0x1beab8[_0x9f22('0x31')]),_0x480904);if(_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x3b')]){_0x4409a4[_0x9f22('0x3a')]=_[_0x9f22('0x3c')](_0x4409a4['where'],{'$or':_[_0x9f22('0x2e')](_0x480904,function(_0xa8478f){if(_0xa8478f[_0x9f22('0x2c')]!=='VIRTUAL'){var _0x43efd7={};_0x43efd7[_0xa8478f[_0x9f22('0x26')]]={'$like':'%'+_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x3b')]+'%'};return _0x43efd7;}})});}_0x4409a4=_[_0x9f22('0x3c')]({},_0x4409a4,_0x25c66b[_0x9f22('0x3d')]);var _0x3c6f7c={'where':_0x4409a4[_0x9f22('0x3a')]};return db[_0x9f22('0x29')][_0x9f22('0x1e')](_0x3c6f7c)[_0x9f22('0x23')](function(_0x55c759){_0x29371b[_0x9f22('0x1e')]=_0x55c759;if(_0x25c66b['query'][_0x9f22('0x3e')]){_0x4409a4[_0x9f22('0x3f')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x4409a4);})['then'](function(_0x4a1b61){_0x29371b['rows']=_0x4a1b61;return _0x29371b;})[_0x9f22('0x23')](respondWithFilteredResult(_0xf2cf36,_0x4409a4))[_0x9f22('0x40')](handleError(_0xf2cf36,null));};exports[_0x9f22('0x41')]=function(_0x90ea82,_0x5a2a6e){var _0x89892f={'raw':!![],'where':{'id':_0x90ea82[_0x9f22('0x42')]['id']}},_0x2edbfa={};_0x2edbfa['model']=_[_0x9f22('0x30')](db[_0x9f22('0x29')][_0x9f22('0x2a')]);_0x2edbfa['query']=_[_0x9f22('0x30')](_0x90ea82[_0x9f22('0x2f')]);_0x2edbfa[_0x9f22('0x31')]=_[_0x9f22('0x32')](_0x2edbfa[_0x9f22('0x33')],_0x2edbfa[_0x9f22('0x2f')]);_0x89892f[_0x9f22('0x34')]=_['intersection'](_0x2edbfa['model'],qs[_0x9f22('0x35')](_0x90ea82[_0x9f22('0x2f')]['fields']));_0x89892f[_0x9f22('0x34')]=_0x89892f[_0x9f22('0x34')][_0x9f22('0x36')]?_0x89892f[_0x9f22('0x34')]:_0x2edbfa[_0x9f22('0x33')];if(_0x90ea82[_0x9f22('0x2f')][_0x9f22('0x3e')]){_0x89892f[_0x9f22('0x3f')]=[{'all':!![]}];}_0x89892f=_[_0x9f22('0x3c')]({},_0x89892f,_0x90ea82[_0x9f22('0x3d')]);return db[_0x9f22('0x29')][_0x9f22('0x43')](_0x89892f)[_0x9f22('0x23')](handleEntityNotFound(_0x5a2a6e,null))['then'](respondWithResult(_0x5a2a6e,null))[_0x9f22('0x40')](handleError(_0x5a2a6e,null));};exports[_0x9f22('0x44')]=function(_0x5e9ad1,_0x1b61fb){return db[_0x9f22('0x29')]['create'](_0x5e9ad1[_0x9f22('0x45')],{})['then'](respondWithResult(_0x1b61fb,0xc9))[_0x9f22('0x40')](handleError(_0x1b61fb,null));};exports[_0x9f22('0x22')]=function(_0x1bfa7d,_0x487c51){if(_0x1bfa7d[_0x9f22('0x45')]['id']){delete _0x1bfa7d[_0x9f22('0x45')]['id'];}return db[_0x9f22('0x29')][_0x9f22('0x43')]({'where':{'id':_0x1bfa7d[_0x9f22('0x42')]['id']}})['then'](handleEntityNotFound(_0x487c51,null))[_0x9f22('0x23')](saveUpdates(_0x1bfa7d[_0x9f22('0x45')],null))[_0x9f22('0x23')](respondWithResult(_0x487c51,null))[_0x9f22('0x40')](handleError(_0x487c51,null));};exports[_0x9f22('0x46')]=function(_0x390d22,_0x45acc6){return db[_0x9f22('0x29')][_0x9f22('0x43')]({'where':{'id':_0x390d22['params']['id']}})[_0x9f22('0x23')](handleEntityNotFound(_0x45acc6,null))[_0x9f22('0x23')](removeEntity(_0x45acc6,null))[_0x9f22('0x40')](handleError(_0x45acc6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7b7be31..6e3968a 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 _0x4f1a=['salesforce_unique_index','FieldId','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields'];(function(_0x4805a8,_0x48aa94){var _0x5e1b2f=function(_0x2571ee){while(--_0x2571ee){_0x4805a8['push'](_0x4805a8['shift']());}};_0x5e1b2f(++_0x48aa94);}(_0x4f1a,0x154));var _0xa4f1=function(_0x1aab33,_0x327f92){_0x1aab33=_0x1aab33-0x0;var _0x4bf0df=_0x4f1a[_0x1aab33];return _0x4bf0df;};'use strict';var _=require(_0xa4f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4f1('0x1'));var moment=require(_0xa4f1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4f1('0x3'));var fs=require('fs');var path=require(_0xa4f1('0x4'));var rimraf=require(_0xa4f1('0x5'));var config=require(_0xa4f1('0x6'));var attributes=require(_0xa4f1('0x7'));module[_0xa4f1('0x8')]=function(_0xe46783,_0x1fbdfc){return _0xe46783['define'](_0xa4f1('0x9'),attributes,{'tableName':_0xa4f1('0xa'),'paranoid':![],'indexes':[{'name':_0xa4f1('0xb'),'fields':['idField',_0xa4f1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58ad=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x28bd58,_0x462a34){var _0x5c1ba6=function(_0x5a30c0){while(--_0x5a30c0){_0x28bd58['push'](_0x28bd58['shift']());}};_0x5c1ba6(++_0x462a34);}(_0x58ad,0x7d));var _0xd58a=function(_0x3e0950,_0xa74ab3){_0x3e0950=_0x3e0950-0x0;var _0x1a6bb4=_0x58ad[_0x3e0950];return _0x1a6bb4;};'use strict';var _=require(_0xd58a('0x0'));var util=require(_0xd58a('0x1'));var logger=require(_0xd58a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd58a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd58a('0x4'));var config=require(_0xd58a('0x5'));var attributes=require(_0xd58a('0x6'));module[_0xd58a('0x7')]=function(_0x5145bd,_0x5d0838){return _0x5145bd[_0xd58a('0x8')](_0xd58a('0x9'),attributes,{'tableName':_0xd58a('0xa'),'paranoid':![],'indexes':[{'name':_0xd58a('0xb'),'fields':['idField','FieldId'],'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 d4a6431..289868f 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 _0x089f=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5c0bed,_0x178478){var _0x603226=function(_0xe97300){while(--_0xe97300){_0x5c0bed['push'](_0x5c0bed['shift']());}};_0x603226(++_0x178478);}(_0x089f,0x168));var _0xf089=function(_0x2b57e7,_0x2501ec){_0x2b57e7=_0x2b57e7-0x0;var _0x3f27c2=_0x089f[_0x2b57e7];return _0x3f27c2;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var moment=require('moment');var BPromise=require(_0xf089('0x2'));var rs=require(_0xf089('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf089('0x4'))['db'];var utils=require(_0xf089('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf089('0x6'));var jayson=require(_0xf089('0x7'));var client=jayson['client'][_0xf089('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4110e8,_0x21aae8,_0x240a94){return new BPromise(function(_0x5504eb,_0x20ea72){return client[_0xf089('0x9')](_0x4110e8,_0x240a94)['then'](function(_0x4d3fb1){logger[_0xf089('0xa')](_0xf089('0xb'),_0x21aae8,_0xf089('0xc'));logger['debug'](_0xf089('0xd'),_0x21aae8,_0xf089('0xc'),JSON[_0xf089('0xe')](_0x4d3fb1));if(_0x4d3fb1[_0xf089('0xf')]){if(_0x4d3fb1[_0xf089('0xf')][_0xf089('0x10')]===0x1f4){logger[_0xf089('0xf')](_0xf089('0xb'),_0x21aae8,_0x4d3fb1['error'][_0xf089('0x11')]);return _0x20ea72(_0x4d3fb1[_0xf089('0xf')]['message']);}logger[_0xf089('0xf')](_0xf089('0xb'),_0x21aae8,_0x4d3fb1[_0xf089('0xf')][_0xf089('0x11')]);return _0x5504eb(_0x4d3fb1['error'][_0xf089('0x11')]);}else{logger[_0xf089('0xa')](_0xf089('0xb'),_0x21aae8,_0xf089('0xc'));_0x5504eb(_0x4d3fb1['result'][_0xf089('0x11')]);}})[_0xf089('0x12')](function(_0x43e94a){logger[_0xf089('0xf')]('SalesforceField,\x20%s,\x20%s',_0x21aae8,_0x43e94a);_0x20ea72(_0x43e94a);});});} \ No newline at end of file +var _0xc41c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a9468,_0x2b6266){var _0x1d2345=function(_0x499728){while(--_0x499728){_0x3a9468['push'](_0x3a9468['shift']());}};_0x1d2345(++_0x2b6266);}(_0xc41c,0xca));var _0xcc41=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xc41c[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0xcc41('0x0'));var util=require('util');var moment=require(_0xcc41('0x1'));var BPromise=require(_0xcc41('0x2'));var rs=require(_0xcc41('0x3'));var fs=require('fs');var Redis=require(_0xcc41('0x4'));var db=require(_0xcc41('0x5'))['db'];var utils=require(_0xcc41('0x6'));var logger=require(_0xcc41('0x7'))(_0xcc41('0x8'));var config=require(_0xcc41('0x9'));var jayson=require(_0xcc41('0xa'));var client=jayson[_0xcc41('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6533d,_0x3141bf,_0x7bf412){return new BPromise(function(_0x3c726c,_0x3a0039){return client[_0xcc41('0xc')](_0xe6533d,_0x7bf412)[_0xcc41('0xd')](function(_0x54a391){logger['info'](_0xcc41('0xe'),_0x3141bf,_0xcc41('0xf'));logger['debug'](_0xcc41('0x10'),_0x3141bf,'request\x20sent',JSON[_0xcc41('0x11')](_0x54a391));if(_0x54a391['error']){if(_0x54a391[_0xcc41('0x12')][_0xcc41('0x13')]===0x1f4){logger[_0xcc41('0x12')](_0xcc41('0xe'),_0x3141bf,_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);return _0x3a0039(_0x54a391['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x3141bf,_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);return _0x3c726c(_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);}else{logger['info'](_0xcc41('0xe'),_0x3141bf,'request\x20sent');_0x3c726c(_0x54a391[_0xcc41('0x15')][_0xcc41('0x14')]);}})[_0xcc41('0x16')](function(_0x5d736b){logger[_0xcc41('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3141bf,_0x5d736b);_0x3a0039(_0x5d736b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 852a421..bfcbafa 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 _0x47c2=['create','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x27b397,_0x445a20){var _0x34f616=function(_0x326bf7){while(--_0x326bf7){_0x27b397['push'](_0x27b397['shift']());}};_0x34f616(++_0x445a20);}(_0x47c2,0x1ae));var _0x247c=function(_0x460614,_0x18baf4){_0x460614=_0x460614-0x0;var _0x4685f1=_0x47c2[_0x460614];return _0x4685f1;};'use strict';var multer=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var path=require(_0x247c('0x2'));var timeout=require(_0x247c('0x3'));var express=require(_0x247c('0x4'));var router=express[_0x247c('0x5')]();var fs_extra=require(_0x247c('0x6'));var auth=require(_0x247c('0x7'));var interaction=require(_0x247c('0x8'));var config=require(_0x247c('0x9'));var controller=require(_0x247c('0xa'));router[_0x247c('0xb')]('/',auth[_0x247c('0xc')](),controller[_0x247c('0xd')]);router[_0x247c('0xb')](_0x247c('0xe'),auth['isAuthenticated'](),controller[_0x247c('0xf')]);router['get'](_0x247c('0x10'),auth[_0x247c('0xc')](),controller['getConfigurations']);router[_0x247c('0xb')](_0x247c('0x11'),auth['isAuthenticated'](),controller[_0x247c('0x12')]);router[_0x247c('0x13')]('/',auth[_0x247c('0xc')](),controller[_0x247c('0x14')]);router[_0x247c('0x13')](_0x247c('0x10'),auth['isAuthenticated'](),controller[_0x247c('0x15')]);router['put'](_0x247c('0xe'),auth[_0x247c('0xc')](),controller[_0x247c('0x16')]);router[_0x247c('0x17')](_0x247c('0xe'),auth[_0x247c('0xc')](),controller[_0x247c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6aa0=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x41c6cb,_0x2bb776){var _0x35ab01=function(_0x1d84d5){while(--_0x1d84d5){_0x41c6cb['push'](_0x41c6cb['shift']());}};_0x35ab01(++_0x2bb776);}(_0x6aa0,0xb8));var _0x06aa=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x6aa0[_0x20aadb];return _0x520018;};'use strict';var multer=require('multer');var util=require(_0x06aa('0x0'));var path=require(_0x06aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x06aa('0x2'));var router=express['Router']();var fs_extra=require(_0x06aa('0x3'));var auth=require(_0x06aa('0x4'));var interaction=require(_0x06aa('0x5'));var config=require('../../config/environment');var controller=require(_0x06aa('0x6'));router[_0x06aa('0x7')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0x9')]);router[_0x06aa('0x7')]('/:id',auth[_0x06aa('0x8')](),controller[_0x06aa('0xa')]);router['get'](_0x06aa('0xb'),auth[_0x06aa('0x8')](),controller['getConfigurations']);router['get'](_0x06aa('0xc'),auth[_0x06aa('0x8')](),controller[_0x06aa('0xd')]);router[_0x06aa('0xe')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0xf')]);router['post'](_0x06aa('0xb'),auth['isAuthenticated'](),controller[_0x06aa('0x10')]);router[_0x06aa('0x11')](_0x06aa('0x12'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x13')]);router[_0x06aa('0x14')](_0x06aa('0x12'),auth['isAuthenticated'](),controller[_0x06aa('0x15')]);module[_0x06aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5e9897a..e3a9eec 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 _0x89f7=['exports','STRING','username'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x89f7,0x1e9));var _0x789f=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x89f7[_0x39157f];return _0x1ae4e2;};'use strict';var Sequelize=require('sequelize');module[_0x789f('0x0')]={'name':{'type':Sequelize[_0x789f('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x789f('0x1')],'unique':_0x789f('0x2')},'password':{'type':Sequelize[_0x789f('0x1')]},'email':{'type':Sequelize[_0x789f('0x1')]},'remoteUri':{'type':Sequelize[_0x789f('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x06a9=['remoteUri','sequelize','exports','STRING'];(function(_0x3c56f3,_0x58e0be){var _0x356929=function(_0x169508){while(--_0x169508){_0x3c56f3['push'](_0x3c56f3['shift']());}};_0x356929(++_0x58e0be);}(_0x06a9,0xd1));var _0x906a=function(_0x3828d2,_0x2bab59){_0x3828d2=_0x3828d2-0x0;var _0x469d22=_0x06a9[_0x3828d2];return _0x469d22;};'use strict';var Sequelize=require(_0x906a('0x0'));module[_0x906a('0x1')]={'name':{'type':Sequelize[_0x906a('0x2')]},'description':{'type':Sequelize[_0x906a('0x2')]},'username':{'type':Sequelize[_0x906a('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x906a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x906a('0x3')},'serverUrl':{'type':Sequelize[_0x906a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 764b7eb..c8c739f 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 _0x29c7=['getConfigurations','findOne','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','contact_type','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','remove','includes','internalType','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','statusCode','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ServicenowAccount','type','key','model','query','filters','intersection','fields','attributes','length','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body'];(function(_0x444432,_0x8279f7){var _0x4bacbb=function(_0x2e5c0e){while(--_0x2e5c0e){_0x444432['push'](_0x444432['shift']());}};_0x4bacbb(++_0x8279f7);}(_0x29c7,0x1ee));var _0x729c=function(_0x32d233,_0x3348ba){_0x32d233=_0x32d233-0x0;var _0x3afc58=_0x29c7[_0x32d233];return _0x3afc58;};'use strict';var emlformat=require(_0x729c('0x0'));var rimraf=require(_0x729c('0x1'));var zipdir=require(_0x729c('0x2'));var jsonpatch=require(_0x729c('0x3'));var rp=require(_0x729c('0x4'));var moment=require(_0x729c('0x5'));var BPromise=require(_0x729c('0x6'));var Mustache=require(_0x729c('0x7'));var util=require(_0x729c('0x8'));var path=require(_0x729c('0x9'));var sox=require(_0x729c('0xa'));var csv=require(_0x729c('0xb'));var ejs=require(_0x729c('0xc'));var fs=require('fs');var fs_extra=require(_0x729c('0xd'));var _=require(_0x729c('0xe'));var squel=require(_0x729c('0xf'));var crypto=require(_0x729c('0x10'));var jsforce=require(_0x729c('0x11'));var deskjs=require(_0x729c('0x12'));var toCsv=require(_0x729c('0xb'));var querystring=require('querystring');var Papa=require(_0x729c('0x13'));var Redis=require(_0x729c('0x14'));var authService=require(_0x729c('0x15'));var qs=require(_0x729c('0x16'));var as=require(_0x729c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x729c('0x18'));var utils=require(_0x729c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x729c('0x1a'));var db=require(_0x729c('0x1b'))['db'];var integrations=require(_0x729c('0x1c'));function respondWithStatusCode(_0x24f238,_0x25305b){_0x25305b=_0x25305b||0xcc;return function(_0x667eaa){if(_0x667eaa){return _0x24f238[_0x729c('0x1d')](_0x25305b);}return _0x24f238[_0x729c('0x1e')](_0x25305b)[_0x729c('0x1f')]();};}function respondWithResult(_0x3f442f,_0x326274){_0x326274=_0x326274||0xc8;return function(_0x3d879f){if(_0x3d879f){return _0x3f442f['status'](_0x326274)[_0x729c('0x20')](_0x3d879f);}};}function respondWithFilteredResult(_0x127b73,_0x34da91){return function(_0x20fd35){if(_0x20fd35){var _0x419df7=typeof _0x34da91[_0x729c('0x21')]===_0x729c('0x22')&&typeof _0x34da91['limit']==='undefined';var _0x35f94e=_0x20fd35[_0x729c('0x23')];var _0x2d338e=_0x419df7?0x0:_0x34da91[_0x729c('0x21')];var _0x1ca2b2=_0x419df7?_0x20fd35[_0x729c('0x23')]:_0x34da91[_0x729c('0x21')]+_0x34da91['limit'];var _0x5589d6;if(_0x1ca2b2>=_0x35f94e){_0x1ca2b2=_0x35f94e;_0x5589d6=0xc8;}else{_0x5589d6=0xce;}_0x127b73['status'](_0x5589d6);return _0x127b73['set'](_0x729c('0x24'),_0x2d338e+'-'+_0x1ca2b2+'/'+_0x35f94e)[_0x729c('0x20')](_0x20fd35);}return null;};}function patchUpdates(_0x26e8b1){return function(_0x2abb48){try{jsonpatch[_0x729c('0x25')](_0x2abb48,_0x26e8b1,!![]);}catch(_0x46c3fd){return BPromise[_0x729c('0x26')](_0x46c3fd);}return _0x2abb48[_0x729c('0x27')]();};}function saveUpdates(_0x31d314,_0x20bcb6){return function(_0x88c196){if(_0x88c196){return _0x88c196[_0x729c('0x28')](_0x31d314)['then'](function(_0x5d056f){return _0x5d056f;});}return null;};}function removeEntity(_0x383ad2,_0x201087){return function(_0x5ac2d1){if(_0x5ac2d1){return _0x5ac2d1[_0x729c('0x29')]()[_0x729c('0x2a')](function(){_0x383ad2[_0x729c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525997,_0x3e23e5){return function(_0x32192e){if(!_0x32192e){_0x525997[_0x729c('0x1d')](0x194);}return _0x32192e;};}function handleError(_0x4f1ebb,_0x1a736b){_0x1a736b=_0x1a736b||0x1f4;return function(_0x58de39){logger[_0x729c('0x2b')](_0x58de39[_0x729c('0x2c')]);if(_0x58de39[_0x729c('0x2d')]){delete _0x58de39[_0x729c('0x2d')];}_0x4f1ebb[_0x729c('0x1e')](_0x1a736b)['send'](_0x58de39);};}exports[_0x729c('0x2e')]=function(_0x31800f,_0x201da1){var _0x329578={},_0x1edb22={},_0x438fbd={'count':0x0,'rows':[]};var _0x35c6ef=_[_0x729c('0x2f')](db[_0x729c('0x30')]['rawAttributes'],function(_0x48cf6d){return{'name':_0x48cf6d['fieldName'],'type':_0x48cf6d[_0x729c('0x31')][_0x729c('0x32')]};});_0x1edb22[_0x729c('0x33')]=_[_0x729c('0x2f')](_0x35c6ef,'name');_0x1edb22['query']=_['keys'](_0x31800f[_0x729c('0x34')]);_0x1edb22[_0x729c('0x35')]=_[_0x729c('0x36')](_0x1edb22['model'],_0x1edb22[_0x729c('0x34')]);_0x329578['attributes']=_[_0x729c('0x36')](_0x1edb22['model'],qs[_0x729c('0x37')](_0x31800f[_0x729c('0x34')][_0x729c('0x37')]));_0x329578[_0x729c('0x38')]=_0x329578[_0x729c('0x38')][_0x729c('0x39')]?_0x329578['attributes']:_0x1edb22[_0x729c('0x33')];if(!_0x31800f[_0x729c('0x34')]['hasOwnProperty']('nolimit')){_0x329578['limit']=qs[_0x729c('0x3a')](_0x31800f[_0x729c('0x34')][_0x729c('0x3a')]);_0x329578[_0x729c('0x21')]=qs['offset'](_0x31800f[_0x729c('0x34')][_0x729c('0x21')]);}_0x329578[_0x729c('0x3b')]=qs[_0x729c('0x3c')](_0x31800f[_0x729c('0x34')][_0x729c('0x3c')]);_0x329578[_0x729c('0x3d')]=qs[_0x729c('0x35')](_['pick'](_0x31800f[_0x729c('0x34')],_0x1edb22[_0x729c('0x35')]),_0x35c6ef);if(_0x31800f[_0x729c('0x34')][_0x729c('0x3e')]){_0x329578['where']=_[_0x729c('0x3f')](_0x329578[_0x729c('0x3d')],{'$or':_[_0x729c('0x2f')](_0x35c6ef,function(_0x139cbe){if(_0x139cbe[_0x729c('0x31')]!=='VIRTUAL'){var _0x30c76f={};_0x30c76f[_0x139cbe['name']]={'$like':'%'+_0x31800f[_0x729c('0x34')][_0x729c('0x3e')]+'%'};return _0x30c76f;}})});}_0x329578=_[_0x729c('0x3f')]({},_0x329578,_0x31800f[_0x729c('0x40')]);var _0x536138={'where':_0x329578[_0x729c('0x3d')]};return db['ServicenowAccount'][_0x729c('0x23')](_0x536138)[_0x729c('0x2a')](function(_0x576356){_0x438fbd[_0x729c('0x23')]=_0x576356;if(_0x31800f[_0x729c('0x34')][_0x729c('0x41')]){_0x329578[_0x729c('0x42')]=[{'all':!![]}];}return db[_0x729c('0x30')][_0x729c('0x43')](_0x329578);})['then'](function(_0x5ac5ca){_0x438fbd[_0x729c('0x44')]=_0x5ac5ca;return _0x438fbd;})[_0x729c('0x2a')](respondWithFilteredResult(_0x201da1,_0x329578))[_0x729c('0x45')](handleError(_0x201da1,null));};exports['show']=function(_0x33c362,_0xe59a35){var _0x3f953c={'raw':![],'where':{'id':_0x33c362[_0x729c('0x46')]['id']}},_0x4a3b29={};_0x4a3b29['model']=_[_0x729c('0x47')](db[_0x729c('0x30')][_0x729c('0x48')]);_0x4a3b29[_0x729c('0x34')]=_[_0x729c('0x47')](_0x33c362[_0x729c('0x34')]);_0x4a3b29[_0x729c('0x35')]=_[_0x729c('0x36')](_0x4a3b29[_0x729c('0x33')],_0x4a3b29[_0x729c('0x34')]);_0x3f953c[_0x729c('0x38')]=_[_0x729c('0x36')](_0x4a3b29['model'],qs[_0x729c('0x37')](_0x33c362['query']['fields']));_0x3f953c[_0x729c('0x38')]=_0x3f953c[_0x729c('0x38')][_0x729c('0x39')]?_0x3f953c[_0x729c('0x38')]:_0x4a3b29['model'];if(_0x33c362['query'][_0x729c('0x41')]){_0x3f953c[_0x729c('0x42')]=[{'all':!![]}];}_0x3f953c=_[_0x729c('0x3f')]({},_0x3f953c,_0x33c362[_0x729c('0x40')]);return db[_0x729c('0x30')][_0x729c('0x49')](_0x3f953c)[_0x729c('0x2a')](handleEntityNotFound(_0xe59a35,null))['then'](respondWithResult(_0xe59a35,null))['catch'](handleError(_0xe59a35,null));};exports[_0x729c('0x4a')]=function(_0x4d1233,_0xade872){return db[_0x729c('0x30')][_0x729c('0x4a')](_0x4d1233[_0x729c('0x4b')],{})[_0x729c('0x2a')](respondWithResult(_0xade872,0xc9))[_0x729c('0x45')](handleError(_0xade872,null));};exports['update']=function(_0x3a157a,_0x540976){if(_0x3a157a[_0x729c('0x4b')]['id']){delete _0x3a157a[_0x729c('0x4b')]['id'];}return db[_0x729c('0x30')]['find']({'where':{'id':_0x3a157a['params']['id']}})['then'](handleEntityNotFound(_0x540976,null))[_0x729c('0x2a')](saveUpdates(_0x3a157a[_0x729c('0x4b')],null))[_0x729c('0x2a')](respondWithResult(_0x540976,null))[_0x729c('0x45')](handleError(_0x540976,null));};exports[_0x729c('0x29')]=function(_0x8168b,_0xf822ad){return db[_0x729c('0x30')]['find']({'where':{'id':_0x8168b['params']['id']}})['then'](handleEntityNotFound(_0xf822ad,null))[_0x729c('0x2a')](removeEntity(_0xf822ad,null))['catch'](handleError(_0xf822ad,null));};exports[_0x729c('0x4c')]=function(_0x497389,_0x5b6f1e,_0x438f9a){var _0xc538f9={};var _0x987adb={};var _0x42c18c;var _0x2d0f5c;return db[_0x729c('0x30')][_0x729c('0x4d')]({'where':{'id':_0x497389['params']['id']}})[_0x729c('0x2a')](handleEntityNotFound(_0x5b6f1e,null))[_0x729c('0x2a')](function(_0xa8c3e8){if(_0xa8c3e8){_0x42c18c=_0xa8c3e8;_0x987adb[_0x729c('0x33')]=_[_0x729c('0x47')](db['ServicenowConfiguration'][_0x729c('0x48')]);_0x987adb['query']=_['keys'](_0x497389['query']);_0x987adb[_0x729c('0x35')]=_[_0x729c('0x36')](_0x987adb[_0x729c('0x33')],_0x987adb[_0x729c('0x34')]);_0xc538f9['attributes']=_[_0x729c('0x36')](_0x987adb[_0x729c('0x33')],qs[_0x729c('0x37')](_0x497389[_0x729c('0x34')][_0x729c('0x37')]));_0xc538f9['attributes']=_0xc538f9['attributes'][_0x729c('0x39')]?_0xc538f9[_0x729c('0x38')]:_0x987adb[_0x729c('0x33')];_0xc538f9[_0x729c('0x3b')]=qs[_0x729c('0x3c')](_0x497389[_0x729c('0x34')][_0x729c('0x3c')]);_0xc538f9[_0x729c('0x3d')]=qs[_0x729c('0x35')](_[_0x729c('0x4e')](_0x497389[_0x729c('0x34')],_0x987adb['filters']));if(_0x497389[_0x729c('0x34')][_0x729c('0x3e')]){_0xc538f9['where']=_[_0x729c('0x3f')](_0xc538f9[_0x729c('0x3d')],{'$or':_[_0x729c('0x2f')](_0xc538f9[_0x729c('0x38')],function(_0x1dc57a){var _0xb06c14={};_0xb06c14[_0x1dc57a]={'$like':'%'+_0x497389['query'][_0x729c('0x3e')]+'%'};return _0xb06c14;})});}_0xc538f9=_[_0x729c('0x3f')]({},_0xc538f9,_0x497389['options']);return _0x42c18c[_0x729c('0x4c')](_0xc538f9);}})[_0x729c('0x2a')](function(_0x1e1ad9){if(_0x1e1ad9){_0x2d0f5c=_0x1e1ad9[_0x729c('0x39')];if(!_0x497389[_0x729c('0x34')]['hasOwnProperty'](_0x729c('0x4f'))){_0xc538f9[_0x729c('0x3a')]=qs['limit'](_0x497389[_0x729c('0x34')][_0x729c('0x3a')]);_0xc538f9[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x497389[_0x729c('0x34')][_0x729c('0x21')]);}return _0x42c18c[_0x729c('0x4c')](_0xc538f9);}})[_0x729c('0x2a')](function(_0x33166e){if(_0x33166e){return _0x33166e?{'count':_0x2d0f5c,'rows':_0x33166e}:null;}})[_0x729c('0x2a')](respondWithResult(_0x5b6f1e,null))['catch'](handleError(_0x5b6f1e,null));};exports[_0x729c('0x50')]=function(_0x1480f6,_0x4981ff,_0x5f602a){if(_0x1480f6['body']['id']){delete _0x1480f6[_0x729c('0x4b')]['id'];}return db[_0x729c('0x30')][_0x729c('0x4d')]({'where':{'id':_0x1480f6[_0x729c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4981ff,null))[_0x729c('0x2a')](function(_0xeefd24){if(_0xeefd24){_0x1480f6[_0x729c('0x4b')][_0x729c('0x51')]=_0xeefd24['id'];_0x1480f6['body'][_0x729c('0x52')]=integrations[_0x729c('0x53')](_0x1480f6[_0x729c('0x4b')][_0x729c('0x54')],_0x1480f6['body']['type']);_0x1480f6[_0x729c('0x4b')][_0x729c('0x55')]=integrations[_0x729c('0x56')](_0x1480f6[_0x729c('0x4b')][_0x729c('0x54')],_0x1480f6['body'][_0x729c('0x31')]);return db[_0x729c('0x57')][_0x729c('0x4a')](_0x1480f6['body'],{'include':[{'model':db[_0x729c('0x58')],'as':_0x729c('0x52')},{'model':db[_0x729c('0x58')],'as':_0x729c('0x55')}]});}return null;})[_0x729c('0x2a')](respondWithResult(_0x4981ff,null))[_0x729c('0x45')](handleError(_0x4981ff,null));};exports[_0x729c('0x59')]=function(_0x559f87,_0x21a6e1,_0x4101a6){var _0x4f09b5=[_0x729c('0x5a'),_0x729c('0x5b'),_0x729c('0x5c'),_0x729c('0x5d'),_0x729c('0x5e'),_0x729c('0x5f'),_0x729c('0x60'),_0x729c('0x61'),_0x729c('0x62')];var _0x5e3142=[_0x729c('0x63'),_0x729c('0x5a'),_0x729c('0x64'),_0x729c('0x65'),_0x729c('0x66'),'sys_updated_on',_0x729c('0x67'),'hold_reason',_0x729c('0x68'),_0x729c('0x69'),_0x729c('0x6a'),_0x729c('0x6b'),_0x729c('0x6c'),'user_input',_0x729c('0x6d'),_0x729c('0x6e'),_0x729c('0x6f'),_0x729c('0x70'),_0x729c('0x5c'),'order',_0x729c('0x71'),_0x729c('0x72'),_0x729c('0x73'),_0x729c('0x74'),'impact',_0x729c('0x75'),_0x729c('0x76'),_0x729c('0x77'),_0x729c('0x78'),_0x729c('0x79'),'rfc',_0x729c('0x7a'),'expected_start','opened_at','business_duration',_0x729c('0x7b'),_0x729c('0x7c'),_0x729c('0x7d'),'resolved_at','caller_id',_0x729c('0x7e'),_0x729c('0x5d'),_0x729c('0x7f'),_0x729c('0x80'),_0x729c('0x5e'),_0x729c('0x81'),_0x729c('0x82'),_0x729c('0x83'),_0x729c('0x84'),'business_stc',_0x729c('0x85'),_0x729c('0x86'),_0x729c('0x87'),_0x729c('0x5f'),_0x729c('0x88'),'close_notes','closed_by',_0x729c('0x89'),'parent_incident','sys_id',_0x729c('0x8a'),_0x729c('0x8b'),_0x729c('0x60'),'urgency',_0x729c('0x8c'),'company',_0x729c('0x8d'),_0x729c('0x8e'),_0x729c('0x8f'),'severity','comments',_0x729c('0x90'),_0x729c('0x91'),_0x729c('0x92'),_0x729c('0x93'),_0x729c('0x94'),_0x729c('0x95'),_0x729c('0x96'),_0x729c('0x97'),'upon_approval',_0x729c('0x98'),_0x729c('0x99'),_0x729c('0x62')];var _0x360e0f='';var _0x37457d='';var _0x1e6075=[];var _0x52127d='';var _0x2981dc='';var _0x111505=[];var _0x305803='';var _0x55de78='';var _0x1d8a04={};var _0x2fd609='';return db['ServicenowAccount'][_0x729c('0x4d')]({'where':{'id':_0x559f87[_0x729c('0x46')]['id']},'attributes':['id','username',_0x729c('0x9a'),_0x729c('0x9b'),_0x729c('0x9c'),_0x729c('0x9d')]})[_0x729c('0x2a')](handleEntityNotFound(_0x21a6e1,null))[_0x729c('0x2a')](function(_0x617a3){if(_0x617a3){_0x2fd609=_0x617a3[_0x729c('0x9c')];var _0xa515c3=_0x2fd609[_0x729c('0x9e')](-0x1);if(_0xa515c3==='/'){_0x2fd609=_0x2fd609[_0x729c('0x9f')](0x0,_0x2fd609['lastIndexOf'](_0xa515c3));}_0x55de78=util[_0x729c('0xa0')](_0x729c('0xa1'),_0x2fd609);_0x305803=util[_0x729c('0xa0')](_0x729c('0xa2'),_0x2fd609);_0x1d8a04={'user':_0x617a3[_0x729c('0xa3')],'pass':_0x617a3[_0x729c('0x9a')]};var _0x7fb23b={'method':_0x729c('0xa4'),'uri':_0x55de78+_0x729c('0xa5'),'auth':_0x1d8a04,'json':!![]};return rp(_0x7fb23b);}})[_0x729c('0x2a')](function(_0x25d6d4){if(_0x25d6d4[_0x729c('0xa6')][_0x729c('0x39')]>0x0){_0x360e0f=_0x25d6d4[_0x729c('0xa6')];}console[_0x729c('0xa7')]('incident\x20table\x20objects',_0x360e0f);_0x111505=[];_0x37457d=Object['assign']([],_0x360e0f);_[_0x729c('0xa8')](_0x37457d,function(_0x18e540){return!_0x4f09b5[_0x729c('0xa9')](_0x18e540[_0x729c('0x2d')]);});_0x37457d['forEach'](function(_0x4b2dcd){var _0x3d703f=createFieldObject(_0x305803,_0x1d8a04,_0x4b2dcd[_0x729c('0xaa')],_0x4b2dcd[_0x729c('0x2d')],_0x4b2dcd['label'],![]);_0x111505[_0x729c('0xab')](_0x3d703f);});return Promise[_0x729c('0xac')](_0x111505);})[_0x729c('0x2a')](function(_0x2df819){_0x1e6075=_0x2df819;_0x52127d=Object[_0x729c('0xad')]([],_0x360e0f);console[_0x729c('0xa7')](_0x729c('0xae'),_0x360e0f);_[_0x729c('0xa8')](_0x52127d,function(_0x51401e){return _0x5e3142[_0x729c('0xa9')](_0x51401e[_0x729c('0x2d')]);});console[_0x729c('0xa7')](_0x729c('0xaf'),_0x52127d);_0x111505=[];_0x52127d['forEach'](function(_0x2aad47){var _0x35bc9d=createFieldObject(_0x305803,_0x1d8a04,_0x2aad47['internalType'],_0x2aad47['name'],_0x2aad47[_0x729c('0xb0')],!![]);_0x111505[_0x729c('0xab')](_0x35bc9d);});return Promise[_0x729c('0xac')](_0x111505);})['then'](function(_0x35fc43){_0x2981dc=_0x35fc43;var _0x3b0356=_0x1e6075[_0x729c('0xb1')](_0x2981dc);return{'count':_0x3b0356['length'],'rows':_0x3b0356};})[_0x729c('0x2a')](respondWithResult(_0x21a6e1,null))[_0x729c('0x45')](function(_0x224490){console[_0x729c('0xa7')](_0x729c('0xb2')+_0x224490);var _0x4c5235=_0x559f87[_0x729c('0x34')][_0x729c('0xb3')]?0x1f4:_0x224490['statusCode']||0x1f4;logger['error'](_0x224490[_0x729c('0x2c')]);delete _0x224490[_0x729c('0x2d')];if(_0x4c5235===0x191){_0x4c5235=0x190;}_0x21a6e1[_0x729c('0x1e')](_0x4c5235)[_0x729c('0xb4')](_0x559f87['query']['test']?{'message':_0x729c('0xb5'),'statusCode':_0x224490[_0x729c('0xb6')]}:_0x224490);});};function createFieldObject(_0x811215,_0x1b62ba,_0x1d2a25,_0x81be10,_0xb6c4ae,_0x3eb295){return new Promise(function(_0x10b9b9,_0x63d5da){var _0x817fc0={'id':_0x81be10,'name':_0xb6c4ae,'custom':_0x3eb295};if(_0x1d2a25===_0x729c('0xb7')){_0x817fc0['options']=[{'name':_0x729c('0xb8'),'value':'true'},{'name':_0x729c('0xb9'),'value':'false'}];_0x10b9b9(_0x817fc0);}else{var _0x289aee={'method':_0x729c('0xa4'),'uri':_0x811215+_0x729c('0xba')+_0x81be10,'auth':_0x1b62ba,'json':!![]};return rp(_0x289aee)[_0x729c('0x2a')](function(_0x5093f5){var _0x46a577=[];if(_0x5093f5[_0x729c('0xa6')][_0x729c('0x39')]>0x0){_0x5093f5[_0x729c('0xa6')][_0x729c('0xbb')](function(_0x1c2c55){if(_0x1c2c55[_0x729c('0xbc')]==='false'){var _0x10b49d={'name':_0x1c2c55[_0x729c('0xb0')],'value':_0x1c2c55[_0x729c('0xbd')]};_0x46a577[_0x729c('0xab')](_0x10b49d);}});}_0x817fc0[_0x729c('0x40')]=_0x46a577;if(_0x817fc0['options'][_0x729c('0x39')]>0x0){_0x10b9b9(_0x817fc0);}else{if(_0x3eb295==![]){_0x10b9b9();}else{_0x10b9b9(_0x817fc0);}}});}});} \ No newline at end of file +var _0x31ed=['offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','severity','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','log','TCL:\x20_object','forEach','concat','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','undefined','limit','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31ed,0x9c));var _0xd31e=function(_0x445ec0,_0x13e103){_0x445ec0=_0x445ec0-0x0;var _0x451bce=_0x31ed[_0x445ec0];return _0x451bce;};'use strict';var emlformat=require(_0xd31e('0x0'));var rimraf=require(_0xd31e('0x1'));var zipdir=require(_0xd31e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd31e('0x3'));var moment=require(_0xd31e('0x4'));var BPromise=require(_0xd31e('0x5'));var Mustache=require(_0xd31e('0x6'));var util=require(_0xd31e('0x7'));var path=require(_0xd31e('0x8'));var sox=require(_0xd31e('0x9'));var csv=require('to-csv');var ejs=require(_0xd31e('0xa'));var fs=require('fs');var fs_extra=require(_0xd31e('0xb'));var _=require(_0xd31e('0xc'));var squel=require(_0xd31e('0xd'));var crypto=require(_0xd31e('0xe'));var jsforce=require(_0xd31e('0xf'));var deskjs=require(_0xd31e('0x10'));var toCsv=require(_0xd31e('0x11'));var querystring=require(_0xd31e('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd31e('0x13'));var qs=require(_0xd31e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd31e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd31e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd31e('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4af2ba,_0x1ef1f7){_0x1ef1f7=_0x1ef1f7||0xcc;return function(_0x28d791){if(_0x28d791){return _0x4af2ba['sendStatus'](_0x1ef1f7);}return _0x4af2ba[_0xd31e('0x18')](_0x1ef1f7)[_0xd31e('0x19')]();};}function respondWithResult(_0x57289a,_0xf96b6b){_0xf96b6b=_0xf96b6b||0xc8;return function(_0x5c2657){if(_0x5c2657){return _0x57289a[_0xd31e('0x18')](_0xf96b6b)['json'](_0x5c2657);}};}function respondWithFilteredResult(_0x138f8e,_0x5f42ed){return function(_0x1d739a){if(_0x1d739a){var _0x2035b7=typeof _0x5f42ed['offset']===_0xd31e('0x1a')&&typeof _0x5f42ed[_0xd31e('0x1b')]===_0xd31e('0x1a');var _0x33c9c4=_0x1d739a[_0xd31e('0x1c')];var _0x38edd7=_0x2035b7?0x0:_0x5f42ed['offset'];var _0x1c0dcc=_0x2035b7?_0x1d739a[_0xd31e('0x1c')]:_0x5f42ed[_0xd31e('0x1d')]+_0x5f42ed[_0xd31e('0x1b')];var _0x4dec6b;if(_0x1c0dcc>=_0x33c9c4){_0x1c0dcc=_0x33c9c4;_0x4dec6b=0xc8;}else{_0x4dec6b=0xce;}_0x138f8e[_0xd31e('0x18')](_0x4dec6b);return _0x138f8e[_0xd31e('0x1e')](_0xd31e('0x1f'),_0x38edd7+'-'+_0x1c0dcc+'/'+_0x33c9c4)[_0xd31e('0x20')](_0x1d739a);}return null;};}function patchUpdates(_0x28ef90){return function(_0x15399c){try{jsonpatch[_0xd31e('0x21')](_0x15399c,_0x28ef90,!![]);}catch(_0x461bfe){return BPromise['reject'](_0x461bfe);}return _0x15399c[_0xd31e('0x22')]();};}function saveUpdates(_0x2d925d,_0x45e78c){return function(_0x4bddd8){if(_0x4bddd8){return _0x4bddd8[_0xd31e('0x23')](_0x2d925d)[_0xd31e('0x24')](function(_0x368155){return _0x368155;});}return null;};}function removeEntity(_0x49ab5d,_0x57c86e){return function(_0x3b3564){if(_0x3b3564){return _0x3b3564[_0xd31e('0x25')]()[_0xd31e('0x24')](function(){_0x49ab5d[_0xd31e('0x18')](0xcc)[_0xd31e('0x19')]();});}};}function handleEntityNotFound(_0x106f49,_0xe2b73){return function(_0x46a5dc){if(!_0x46a5dc){_0x106f49[_0xd31e('0x26')](0x194);}return _0x46a5dc;};}function handleError(_0x5307d6,_0x3942ae){_0x3942ae=_0x3942ae||0x1f4;return function(_0x169c96){logger[_0xd31e('0x27')](_0x169c96[_0xd31e('0x28')]);if(_0x169c96[_0xd31e('0x29')]){delete _0x169c96[_0xd31e('0x29')];}_0x5307d6[_0xd31e('0x18')](_0x3942ae)[_0xd31e('0x2a')](_0x169c96);};}exports[_0xd31e('0x2b')]=function(_0x1c485e,_0x2f104f){var _0x1f4017={},_0x3482dd={},_0x480a22={'count':0x0,'rows':[]};var _0x186191=_[_0xd31e('0x2c')](db['ServicenowAccount'][_0xd31e('0x2d')],function(_0x277819){return{'name':_0x277819[_0xd31e('0x2e')],'type':_0x277819[_0xd31e('0x2f')][_0xd31e('0x30')]};});_0x3482dd[_0xd31e('0x31')]=_[_0xd31e('0x2c')](_0x186191,_0xd31e('0x29'));_0x3482dd['query']=_[_0xd31e('0x32')](_0x1c485e[_0xd31e('0x33')]);_0x3482dd[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x3482dd[_0xd31e('0x31')],_0x3482dd[_0xd31e('0x33')]);_0x1f4017[_0xd31e('0x36')]=_['intersection'](_0x3482dd[_0xd31e('0x31')],qs[_0xd31e('0x37')](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x37')]));_0x1f4017[_0xd31e('0x36')]=_0x1f4017[_0xd31e('0x36')][_0xd31e('0x38')]?_0x1f4017[_0xd31e('0x36')]:_0x3482dd[_0xd31e('0x31')];if(!_0x1c485e[_0xd31e('0x33')]['hasOwnProperty']('nolimit')){_0x1f4017[_0xd31e('0x1b')]=qs['limit'](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x1b')]);_0x1f4017[_0xd31e('0x1d')]=qs[_0xd31e('0x1d')](_0x1c485e[_0xd31e('0x33')]['offset']);}_0x1f4017[_0xd31e('0x39')]=qs[_0xd31e('0x3a')](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x3a')]);_0x1f4017[_0xd31e('0x3b')]=qs['filters'](_[_0xd31e('0x3c')](_0x1c485e[_0xd31e('0x33')],_0x3482dd[_0xd31e('0x34')]),_0x186191);if(_0x1c485e[_0xd31e('0x33')][_0xd31e('0x3d')]){_0x1f4017[_0xd31e('0x3b')]=_['merge'](_0x1f4017['where'],{'$or':_['map'](_0x186191,function(_0x398ad4){if(_0x398ad4[_0xd31e('0x2f')]!=='VIRTUAL'){var _0x2e1dfc={};_0x2e1dfc[_0x398ad4[_0xd31e('0x29')]]={'$like':'%'+_0x1c485e[_0xd31e('0x33')]['filter']+'%'};return _0x2e1dfc;}})});}_0x1f4017=_[_0xd31e('0x3e')]({},_0x1f4017,_0x1c485e[_0xd31e('0x3f')]);var _0x3edd3d={'where':_0x1f4017[_0xd31e('0x3b')]};return db[_0xd31e('0x40')]['count'](_0x3edd3d)[_0xd31e('0x24')](function(_0x32ffd6){_0x480a22[_0xd31e('0x1c')]=_0x32ffd6;if(_0x1c485e[_0xd31e('0x33')][_0xd31e('0x41')]){_0x1f4017[_0xd31e('0x42')]=[{'all':!![]}];}return db[_0xd31e('0x40')][_0xd31e('0x43')](_0x1f4017);})['then'](function(_0x13f27f){_0x480a22[_0xd31e('0x44')]=_0x13f27f;return _0x480a22;})['then'](respondWithFilteredResult(_0x2f104f,_0x1f4017))[_0xd31e('0x45')](handleError(_0x2f104f,null));};exports['show']=function(_0x23ff07,_0x645df1){var _0x72d4f6={'raw':![],'where':{'id':_0x23ff07[_0xd31e('0x46')]['id']}},_0x3c3d82={};_0x3c3d82[_0xd31e('0x31')]=_[_0xd31e('0x32')](db[_0xd31e('0x40')][_0xd31e('0x2d')]);_0x3c3d82[_0xd31e('0x33')]=_[_0xd31e('0x32')](_0x23ff07[_0xd31e('0x33')]);_0x3c3d82[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x3c3d82[_0xd31e('0x31')],_0x3c3d82[_0xd31e('0x33')]);_0x72d4f6[_0xd31e('0x36')]=_[_0xd31e('0x35')](_0x3c3d82[_0xd31e('0x31')],qs[_0xd31e('0x37')](_0x23ff07[_0xd31e('0x33')][_0xd31e('0x37')]));_0x72d4f6[_0xd31e('0x36')]=_0x72d4f6[_0xd31e('0x36')][_0xd31e('0x38')]?_0x72d4f6[_0xd31e('0x36')]:_0x3c3d82['model'];if(_0x23ff07[_0xd31e('0x33')][_0xd31e('0x41')]){_0x72d4f6[_0xd31e('0x42')]=[{'all':!![]}];}_0x72d4f6=_[_0xd31e('0x3e')]({},_0x72d4f6,_0x23ff07[_0xd31e('0x3f')]);return db[_0xd31e('0x40')][_0xd31e('0x47')](_0x72d4f6)[_0xd31e('0x24')](handleEntityNotFound(_0x645df1,null))[_0xd31e('0x24')](respondWithResult(_0x645df1,null))[_0xd31e('0x45')](handleError(_0x645df1,null));};exports[_0xd31e('0x48')]=function(_0x5600f1,_0xdaa278){return db['ServicenowAccount'][_0xd31e('0x48')](_0x5600f1['body'],{})['then'](respondWithResult(_0xdaa278,0xc9))[_0xd31e('0x45')](handleError(_0xdaa278,null));};exports['update']=function(_0x102306,_0x137000){if(_0x102306[_0xd31e('0x49')]['id']){delete _0x102306['body']['id'];}return db[_0xd31e('0x40')]['find']({'where':{'id':_0x102306[_0xd31e('0x46')]['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0x137000,null))['then'](saveUpdates(_0x102306[_0xd31e('0x49')],null))[_0xd31e('0x24')](respondWithResult(_0x137000,null))['catch'](handleError(_0x137000,null));};exports[_0xd31e('0x25')]=function(_0x4ac574,_0xc3ae99){return db['ServicenowAccount'][_0xd31e('0x47')]({'where':{'id':_0x4ac574[_0xd31e('0x46')]['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0xc3ae99,null))[_0xd31e('0x24')](removeEntity(_0xc3ae99,null))[_0xd31e('0x45')](handleError(_0xc3ae99,null));};exports[_0xd31e('0x4a')]=function(_0x431d0c,_0x2979ae,_0x43e18f){var _0x3a8db4={};var _0x55b500={};var _0x222db9;var _0x4c78fd;return db[_0xd31e('0x40')][_0xd31e('0x4b')]({'where':{'id':_0x431d0c[_0xd31e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2979ae,null))[_0xd31e('0x24')](function(_0x3f1914){if(_0x3f1914){_0x222db9=_0x3f1914;_0x55b500[_0xd31e('0x31')]=_[_0xd31e('0x32')](db[_0xd31e('0x4c')][_0xd31e('0x2d')]);_0x55b500['query']=_[_0xd31e('0x32')](_0x431d0c[_0xd31e('0x33')]);_0x55b500[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x55b500[_0xd31e('0x31')],_0x55b500[_0xd31e('0x33')]);_0x3a8db4[_0xd31e('0x36')]=_[_0xd31e('0x35')](_0x55b500[_0xd31e('0x31')],qs['fields'](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x37')]));_0x3a8db4['attributes']=_0x3a8db4['attributes'][_0xd31e('0x38')]?_0x3a8db4['attributes']:_0x55b500[_0xd31e('0x31')];_0x3a8db4[_0xd31e('0x39')]=qs[_0xd31e('0x3a')](_0x431d0c['query'][_0xd31e('0x3a')]);_0x3a8db4['where']=qs['filters'](_[_0xd31e('0x3c')](_0x431d0c[_0xd31e('0x33')],_0x55b500['filters']));if(_0x431d0c[_0xd31e('0x33')][_0xd31e('0x3d')]){_0x3a8db4[_0xd31e('0x3b')]=_[_0xd31e('0x3e')](_0x3a8db4[_0xd31e('0x3b')],{'$or':_['map'](_0x3a8db4[_0xd31e('0x36')],function(_0x50cf0d){var _0x237e18={};_0x237e18[_0x50cf0d]={'$like':'%'+_0x431d0c[_0xd31e('0x33')][_0xd31e('0x3d')]+'%'};return _0x237e18;})});}_0x3a8db4=_[_0xd31e('0x3e')]({},_0x3a8db4,_0x431d0c['options']);return _0x222db9[_0xd31e('0x4a')](_0x3a8db4);}})[_0xd31e('0x24')](function(_0x3e5de0){if(_0x3e5de0){_0x4c78fd=_0x3e5de0[_0xd31e('0x38')];if(!_0x431d0c[_0xd31e('0x33')][_0xd31e('0x4d')](_0xd31e('0x4e'))){_0x3a8db4['limit']=qs[_0xd31e('0x1b')](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x1b')]);_0x3a8db4['offset']=qs[_0xd31e('0x1d')](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x1d')]);}return _0x222db9['getConfigurations'](_0x3a8db4);}})[_0xd31e('0x24')](function(_0x1536a2){if(_0x1536a2){return _0x1536a2?{'count':_0x4c78fd,'rows':_0x1536a2}:null;}})[_0xd31e('0x24')](respondWithResult(_0x2979ae,null))[_0xd31e('0x45')](handleError(_0x2979ae,null));};exports[_0xd31e('0x4f')]=function(_0x7df4ea,_0x22870a,_0x5a8fe4){if(_0x7df4ea['body']['id']){delete _0x7df4ea[_0xd31e('0x49')]['id'];}return db[_0xd31e('0x40')]['findOne']({'where':{'id':_0x7df4ea['params']['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0x22870a,null))[_0xd31e('0x24')](function(_0x55a0fa){if(_0x55a0fa){_0x7df4ea[_0xd31e('0x49')][_0xd31e('0x50')]=_0x55a0fa['id'];_0x7df4ea['body'][_0xd31e('0x51')]=integrations[_0xd31e('0x52')](_0x7df4ea['body'][_0xd31e('0x53')],_0x7df4ea[_0xd31e('0x49')][_0xd31e('0x2f')]);_0x7df4ea[_0xd31e('0x49')]['Descriptions']=integrations[_0xd31e('0x54')](_0x7df4ea[_0xd31e('0x49')]['channel'],_0x7df4ea[_0xd31e('0x49')]['type']);return db['ServicenowConfiguration'][_0xd31e('0x48')](_0x7df4ea['body'],{'include':[{'model':db[_0xd31e('0x55')],'as':_0xd31e('0x51')},{'model':db['ServicenowField'],'as':_0xd31e('0x56')}]});}return null;})[_0xd31e('0x24')](respondWithResult(_0x22870a,null))[_0xd31e('0x45')](handleError(_0x22870a,null));};exports['getFields']=function(_0x5bf63d,_0x265eab,_0xb81a12){var _0x146e5e=[_0xd31e('0x57'),_0xd31e('0x58'),_0xd31e('0x59'),_0xd31e('0x5a'),_0xd31e('0x5b'),'notify',_0xd31e('0x5c'),'severity',_0xd31e('0x5d')];var _0x30a188=[_0xd31e('0x5e'),'made_sla',_0xd31e('0x5f'),_0xd31e('0x60'),_0xd31e('0x61'),_0xd31e('0x62'),_0xd31e('0x63'),_0xd31e('0x58'),'approval_history',_0xd31e('0x64'),'resolved_by','sys_updated_by',_0xd31e('0x65'),_0xd31e('0x66'),_0xd31e('0x67'),_0xd31e('0x68'),_0xd31e('0x69'),_0xd31e('0x6a'),_0xd31e('0x59'),'order',_0xd31e('0x6b'),'closed_at','cmdb_ci',_0xd31e('0x6c'),_0xd31e('0x6d'),_0xd31e('0x6e'),_0xd31e('0x6f'),_0xd31e('0x70'),_0xd31e('0x71'),_0xd31e('0x72'),'rfc','time_worked',_0xd31e('0x73'),_0xd31e('0x74'),'business_duration','group_list',_0xd31e('0x75'),'reopened_time',_0xd31e('0x76'),_0xd31e('0x77'),_0xd31e('0x78'),_0xd31e('0x5a'),_0xd31e('0x79'),_0xd31e('0x7a'),_0xd31e('0x5b'),_0xd31e('0x7b'),_0xd31e('0x7c'),_0xd31e('0x7d'),_0xd31e('0x7e'),'business_stc',_0xd31e('0x7f'),_0xd31e('0x80'),_0xd31e('0x81'),_0xd31e('0x82'),_0xd31e('0x83'),_0xd31e('0x84'),_0xd31e('0x85'),_0xd31e('0x86'),_0xd31e('0x87'),_0xd31e('0x88'),_0xd31e('0x89'),_0xd31e('0x8a'),_0xd31e('0x5c'),'urgency',_0xd31e('0x8b'),_0xd31e('0x8c'),_0xd31e('0x8d'),_0xd31e('0x8e'),'assigned_to',_0xd31e('0x8f'),'comments','sla_due','approval',_0xd31e('0x90'),_0xd31e('0x91'),_0xd31e('0x92'),_0xd31e('0x93'),_0xd31e('0x94'),_0xd31e('0x95'),'upon_approval',_0xd31e('0x96'),_0xd31e('0x97'),_0xd31e('0x5d')];var _0x2c5b6e='';var _0x113e1f='';var _0x26b5c2=[];var _0x4de25a='';var _0x1ecdc4='';var _0x11bc09=[];var _0x37843c='';var _0x5643c6='';var _0xe837b2={};var _0x310e85='';return db[_0xd31e('0x40')][_0xd31e('0x4b')]({'where':{'id':_0x5bf63d[_0xd31e('0x46')]['id']},'attributes':['id',_0xd31e('0x98'),_0xd31e('0x99'),'email',_0xd31e('0x9a'),_0xd31e('0x9b')]})['then'](handleEntityNotFound(_0x265eab,null))['then'](function(_0x146cad){if(_0x146cad){_0x310e85=_0x146cad[_0xd31e('0x9a')];var _0x69199d=_0x310e85['slice'](-0x1);if(_0x69199d==='/'){_0x310e85=_0x310e85[_0xd31e('0x9c')](0x0,_0x310e85[_0xd31e('0x9d')](_0x69199d));}_0x5643c6=util['format'](_0xd31e('0x9e'),_0x310e85);_0x37843c=util[_0xd31e('0x9f')](_0xd31e('0xa0'),_0x310e85);_0xe837b2={'user':_0x146cad[_0xd31e('0x98')],'pass':_0x146cad[_0xd31e('0x99')]};var _0x14cb5b={'method':_0xd31e('0xa1'),'uri':_0x5643c6+_0xd31e('0xa2'),'auth':_0xe837b2,'json':!![]};return rp(_0x14cb5b);}})[_0xd31e('0x24')](function(_0x51feb8){if(_0x51feb8[_0xd31e('0xa3')][_0xd31e('0x38')]>0x0){_0x2c5b6e=_0x51feb8[_0xd31e('0xa3')];}console['log'](_0xd31e('0xa4'),_0x2c5b6e);_0x11bc09=[];_0x113e1f=Object[_0xd31e('0xa5')]([],_0x2c5b6e);_[_0xd31e('0xa6')](_0x113e1f,function(_0x52e4a4){return!_0x146e5e[_0xd31e('0xa7')](_0x52e4a4[_0xd31e('0x29')]);});_0x113e1f['forEach'](function(_0x72dae4){var _0x2e5cde=createFieldObject(_0x37843c,_0xe837b2,_0x72dae4[_0xd31e('0xa8')],_0x72dae4['name'],_0x72dae4[_0xd31e('0xa9')],![]);_0x11bc09[_0xd31e('0xaa')](_0x2e5cde);});return Promise[_0xd31e('0xab')](_0x11bc09);})[_0xd31e('0x24')](function(_0x140242){_0x26b5c2=_0x140242;_0x4de25a=Object['assign']([],_0x2c5b6e);console[_0xd31e('0xac')](_0xd31e('0xad'),_0x2c5b6e);_['remove'](_0x4de25a,function(_0x32653b){return _0x30a188['includes'](_0x32653b['name']);});console[_0xd31e('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4de25a);_0x11bc09=[];_0x4de25a[_0xd31e('0xae')](function(_0x59bb74){var _0x14c7fe=createFieldObject(_0x37843c,_0xe837b2,_0x59bb74[_0xd31e('0xa8')],_0x59bb74[_0xd31e('0x29')],_0x59bb74[_0xd31e('0xa9')],!![]);_0x11bc09[_0xd31e('0xaa')](_0x14c7fe);});return Promise[_0xd31e('0xab')](_0x11bc09);})[_0xd31e('0x24')](function(_0x327708){_0x1ecdc4=_0x327708;var _0x566a92=_0x26b5c2[_0xd31e('0xaf')](_0x1ecdc4);return{'count':_0x566a92['length'],'rows':_0x566a92};})[_0xd31e('0x24')](respondWithResult(_0x265eab,null))['catch'](function(_0xcb150d){console[_0xd31e('0xac')]('ServiceNow\x20error:\x20'+_0xcb150d);var _0xb2831b=_0x5bf63d[_0xd31e('0x33')]['test']?0x1f4:_0xcb150d[_0xd31e('0xb0')]||0x1f4;logger[_0xd31e('0x27')](_0xcb150d[_0xd31e('0x28')]);delete _0xcb150d[_0xd31e('0x29')];if(_0xb2831b===0x191){_0xb2831b=0x190;}_0x265eab[_0xd31e('0x18')](_0xb2831b)[_0xd31e('0x2a')](_0x5bf63d[_0xd31e('0x33')]['test']?{'message':_0xd31e('0xb1'),'statusCode':_0xcb150d[_0xd31e('0xb0')]}:_0xcb150d);});};function createFieldObject(_0x2a9172,_0x24d497,_0x41fec4,_0x4f812a,_0x125d4f,_0x294760){return new Promise(function(_0x4ccc61,_0x45f72e){var _0x6527e1={'id':_0x4f812a,'name':_0x125d4f,'custom':_0x294760};if(_0x41fec4===_0xd31e('0xb2')){_0x6527e1['options']=[{'name':_0xd31e('0xb3'),'value':_0xd31e('0xb4')},{'name':_0xd31e('0xb5'),'value':_0xd31e('0xb6')}];_0x4ccc61(_0x6527e1);}else{var _0x1a02bb={'method':_0xd31e('0xa1'),'uri':_0x2a9172+_0xd31e('0xb7')+_0x4f812a,'auth':_0x24d497,'json':!![]};return rp(_0x1a02bb)[_0xd31e('0x24')](function(_0xbf39cb){var _0x1f45a6=[];if(_0xbf39cb[_0xd31e('0xa3')]['length']>0x0){_0xbf39cb[_0xd31e('0xa3')][_0xd31e('0xae')](function(_0x4292eb){if(_0x4292eb[_0xd31e('0xb8')]===_0xd31e('0xb6')){var _0x122b95={'name':_0x4292eb[_0xd31e('0xa9')],'value':_0x4292eb['value']};_0x1f45a6[_0xd31e('0xaa')](_0x122b95);}});}_0x6527e1[_0xd31e('0x3f')]=_0x1f45a6;if(_0x6527e1[_0xd31e('0x3f')][_0xd31e('0x38')]>0x0){_0x4ccc61(_0x6527e1);}else{if(_0x294760==![]){_0x4ccc61();}else{_0x4ccc61(_0x6527e1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 03da060..b15d69c 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 _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xe11c54,_0x389280){var _0x476a3f=function(_0x1f25b7){while(--_0x1f25b7){_0xe11c54['push'](_0xe11c54['shift']());}};_0x476a3f(++_0x389280);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'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 dee89cc..e53c2ee 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 _0x368d=['map','ShowServicenowAccount','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','limit','include','model','attributes'];(function(_0x39e374,_0x3c8ea3){var _0x153283=function(_0x587aeb){while(--_0x587aeb){_0x39e374['push'](_0x39e374['shift']());}};_0x153283(++_0x3c8ea3);}(_0x368d,0xf1));var _0xd368=function(_0x5081bc,_0x242a1a){_0x5081bc=_0x5081bc-0x0;var _0x2fe221=_0x368d[_0x5081bc];return _0x2fe221;};'use strict';var _=require('lodash');var util=require(_0xd368('0x0'));var moment=require(_0xd368('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd368('0x2'))['db'];var utils=require(_0xd368('0x3'));var logger=require(_0xd368('0x4'))(_0xd368('0x5'));var config=require(_0xd368('0x6'));var jayson=require(_0xd368('0x7'));var client=jayson[_0xd368('0x8')][_0xd368('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11923e,_0x3a8fb0,_0x542619){return new BPromise(function(_0x409a95,_0x4f6980){return client[_0xd368('0xa')](_0x11923e,_0x542619)[_0xd368('0xb')](function(_0x2f2f90){logger[_0xd368('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x3a8fb0,'request\x20sent');logger[_0xd368('0xd')](_0xd368('0xe'),_0x3a8fb0,_0xd368('0xf'),JSON[_0xd368('0x10')](_0x2f2f90));if(_0x2f2f90[_0xd368('0x11')]){if(_0x2f2f90[_0xd368('0x11')][_0xd368('0x12')]===0x1f4){logger['error'](_0xd368('0x13'),_0x3a8fb0,_0x2f2f90['error'][_0xd368('0x14')]);return _0x4f6980(_0x2f2f90[_0xd368('0x11')]['message']);}logger[_0xd368('0x11')](_0xd368('0x13'),_0x3a8fb0,_0x2f2f90[_0xd368('0x11')][_0xd368('0x14')]);return _0x409a95(_0x2f2f90[_0xd368('0x11')][_0xd368('0x14')]);}else{logger[_0xd368('0xc')](_0xd368('0x13'),_0x3a8fb0,_0xd368('0xf'));_0x409a95(_0x2f2f90[_0xd368('0x15')][_0xd368('0x14')]);}})[_0xd368('0x16')](function(_0x1546c6){logger[_0xd368('0x11')](_0xd368('0x13'),_0x3a8fb0,_0x1546c6);_0x4f6980(_0x1546c6);});});}exports[_0xd368('0x17')]=function(_0x3c484b){var _0x3586c0=this;return new Promise(function(_0x1ef42b,_0x33ec95){return db[_0xd368('0x18')]['findAll']({'raw':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c484b[_0xd368('0x19')]?_0x3c484b[_0xd368('0x19')][_0xd368('0x1a')]||null:null,'attributes':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')]['attributes']||null:null,'limit':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')][_0xd368('0x1b')]||null:null,'include':_0x3c484b[_0xd368('0x19')]?_0x3c484b['options'][_0xd368('0x1c')]?_['map'](_0x3c484b[_0xd368('0x19')][_0xd368('0x1c')],function(_0xbc2505){return{'model':db[_0xbc2505[_0xd368('0x1d')]],'as':_0xbc2505['as'],'attributes':_0xbc2505[_0xd368('0x1e')],'include':_0xbc2505['include']?_[_0xd368('0x1f')](_0xbc2505[_0xd368('0x1c')],function(_0xee735c){return{'model':db[_0xee735c[_0xd368('0x1d')]],'as':_0xee735c['as'],'attributes':_0xee735c[_0xd368('0x1e')],'include':_0xee735c[_0xd368('0x1c')]?_[_0xd368('0x1f')](_0xee735c[_0xd368('0x1c')],function(_0x308d52){return{'model':db[_0x308d52[_0xd368('0x1d')]],'as':_0x308d52['as'],'attributes':_0x308d52[_0xd368('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd368('0xb')](function(_0x506b38){logger[_0xd368('0xc')](_0xd368('0x17'),_0x3c484b);logger[_0xd368('0xd')]('GetServicenowAccount',_0x3c484b,JSON[_0xd368('0x10')](_0x506b38));_0x1ef42b(_0x506b38);})[_0xd368('0x16')](function(_0x3012b6){logger[_0xd368('0x11')]('GetServicenowAccount',_0x3012b6['message'],_0x3c484b);_0x33ec95(_0x3586c0['error'](0x1f4,_0x3012b6[_0xd368('0x14')]));});});};exports[_0xd368('0x20')]=function(_0x3512f7){var _0x3040e8=this;return new Promise(function(_0xe5f847,_0x15853c){return db['ServicenowAccount']['find']({'raw':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')][_0xd368('0x21')]===undefined?!![]:![]:!![],'where':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')]['where']||null:null,'attributes':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')]['attributes']||null:null,'include':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')][_0xd368('0x1c')]?_['map'](_0x3512f7[_0xd368('0x19')][_0xd368('0x1c')],function(_0x215a71){return{'model':db[_0x215a71[_0xd368('0x1d')]],'as':_0x215a71['as'],'attributes':_0x215a71['attributes'],'include':_0x215a71['include']?_['map'](_0x215a71[_0xd368('0x1c')],function(_0x52c7f1){return{'model':db[_0x52c7f1[_0xd368('0x1d')]],'as':_0x52c7f1['as'],'attributes':_0x52c7f1[_0xd368('0x1e')],'include':_0x52c7f1['include']?_[_0xd368('0x1f')](_0x52c7f1['include'],function(_0x132993){return{'model':db[_0x132993[_0xd368('0x1d')]],'as':_0x132993['as'],'attributes':_0x132993[_0xd368('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319960){logger[_0xd368('0xc')]('ShowServicenowAccount',_0x3512f7);logger[_0xd368('0xd')](_0xd368('0x20'),_0x3512f7,JSON[_0xd368('0x10')](_0x319960));_0xe5f847(_0x319960);})[_0xd368('0x16')](function(_0x26d87b){logger[_0xd368('0x11')](_0xd368('0x20'),_0x26d87b[_0xd368('0x14')],_0x3512f7);_0x15853c(_0x3040e8[_0xd368('0x11')](0x1f4,_0x26d87b[_0xd368('0x14')]));});});}; \ No newline at end of file +var _0x86e5=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','include','model','map','then','ShowServicenowAccount','find','raw','util'];(function(_0x51bd64,_0x1c8850){var _0x2c7ee4=function(_0x20d60e){while(--_0x20d60e){_0x51bd64['push'](_0x51bd64['shift']());}};_0x2c7ee4(++_0x1c8850);}(_0x86e5,0x15d));var _0x586e=function(_0x472862,_0x56d13d){_0x472862=_0x472862-0x0;var _0x2db55f=_0x86e5[_0x472862];return _0x2db55f;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var moment=require(_0x586e('0x1'));var BPromise=require(_0x586e('0x2'));var rs=require(_0x586e('0x3'));var fs=require('fs');var Redis=require(_0x586e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x586e('0x5'));var logger=require(_0x586e('0x6'))(_0x586e('0x7'));var config=require('../../config/environment');var jayson=require(_0x586e('0x8'));var client=jayson[_0x586e('0x9')][_0x586e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5916c9,_0x18727a,_0x664dac){return new BPromise(function(_0x35578e,_0x4a6b15){return client[_0x586e('0xb')](_0x5916c9,_0x664dac)['then'](function(_0x1617bb){logger[_0x586e('0xc')](_0x586e('0xd'),_0x18727a,_0x586e('0xe'));logger[_0x586e('0xf')](_0x586e('0x10'),_0x18727a,_0x586e('0xe'),JSON[_0x586e('0x11')](_0x1617bb));if(_0x1617bb[_0x586e('0x12')]){if(_0x1617bb['error'][_0x586e('0x13')]===0x1f4){logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x1617bb[_0x586e('0x12')]['message']);return _0x4a6b15(_0x1617bb[_0x586e('0x12')][_0x586e('0x14')]);}logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x1617bb[_0x586e('0x12')][_0x586e('0x14')]);return _0x35578e(_0x1617bb['error']['message']);}else{logger[_0x586e('0xc')](_0x586e('0xd'),_0x18727a,_0x586e('0xe'));_0x35578e(_0x1617bb[_0x586e('0x15')][_0x586e('0x14')]);}})[_0x586e('0x16')](function(_0x2aeeac){logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x2aeeac);_0x4a6b15(_0x2aeeac);});});}exports[_0x586e('0x17')]=function(_0x1f739a){var _0x100fc1=this;return new Promise(function(_0x2a8c43,_0x2e1bc1){return db[_0x586e('0x18')]['findAll']({'raw':_0x1f739a[_0x586e('0x19')]?_0x1f739a[_0x586e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')][_0x586e('0x1a')]||null:null,'attributes':_0x1f739a[_0x586e('0x19')]?_0x1f739a[_0x586e('0x19')][_0x586e('0x1b')]||null:null,'limit':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')]['limit']||null:null,'include':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')][_0x586e('0x1c')]?_['map'](_0x1f739a['options']['include'],function(_0x2eebad){return{'model':db[_0x2eebad[_0x586e('0x1d')]],'as':_0x2eebad['as'],'attributes':_0x2eebad[_0x586e('0x1b')],'include':_0x2eebad['include']?_[_0x586e('0x1e')](_0x2eebad['include'],function(_0xa5a5c3){return{'model':db[_0xa5a5c3[_0x586e('0x1d')]],'as':_0xa5a5c3['as'],'attributes':_0xa5a5c3[_0x586e('0x1b')],'include':_0xa5a5c3[_0x586e('0x1c')]?_[_0x586e('0x1e')](_0xa5a5c3[_0x586e('0x1c')],function(_0x5eeb34){return{'model':db[_0x5eeb34[_0x586e('0x1d')]],'as':_0x5eeb34['as'],'attributes':_0x5eeb34[_0x586e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x586e('0x1f')](function(_0x2f5687){logger[_0x586e('0xc')](_0x586e('0x17'),_0x1f739a);logger[_0x586e('0xf')](_0x586e('0x17'),_0x1f739a,JSON[_0x586e('0x11')](_0x2f5687));_0x2a8c43(_0x2f5687);})[_0x586e('0x16')](function(_0x586cd8){logger[_0x586e('0x12')](_0x586e('0x17'),_0x586cd8[_0x586e('0x14')],_0x1f739a);_0x2e1bc1(_0x100fc1['error'](0x1f4,_0x586cd8[_0x586e('0x14')]));});});};exports[_0x586e('0x20')]=function(_0x2c35b8){var _0x5a26c0=this;return new Promise(function(_0x37665f,_0x53a437){return db[_0x586e('0x18')][_0x586e('0x21')]({'raw':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8[_0x586e('0x19')][_0x586e('0x22')]===undefined?!![]:![]:!![],'where':_0x2c35b8['options']?_0x2c35b8[_0x586e('0x19')][_0x586e('0x1a')]||null:null,'attributes':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8['options'][_0x586e('0x1b')]||null:null,'include':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8['options'][_0x586e('0x1c')]?_[_0x586e('0x1e')](_0x2c35b8['options'][_0x586e('0x1c')],function(_0x3785fb){return{'model':db[_0x3785fb[_0x586e('0x1d')]],'as':_0x3785fb['as'],'attributes':_0x3785fb[_0x586e('0x1b')],'include':_0x3785fb[_0x586e('0x1c')]?_['map'](_0x3785fb[_0x586e('0x1c')],function(_0x5842fe){return{'model':db[_0x5842fe[_0x586e('0x1d')]],'as':_0x5842fe['as'],'attributes':_0x5842fe[_0x586e('0x1b')],'include':_0x5842fe['include']?_[_0x586e('0x1e')](_0x5842fe[_0x586e('0x1c')],function(_0x2514b0){return{'model':db[_0x2514b0[_0x586e('0x1d')]],'as':_0x2514b0['as'],'attributes':_0x2514b0[_0x586e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x586e('0x1f')](function(_0x372af4){logger[_0x586e('0xc')](_0x586e('0x20'),_0x2c35b8);logger[_0x586e('0xf')]('ShowServicenowAccount',_0x2c35b8,JSON[_0x586e('0x11')](_0x372af4));_0x37665f(_0x372af4);})[_0x586e('0x16')](function(_0x5bf2ec){logger['error'](_0x586e('0x20'),_0x5bf2ec[_0x586e('0x14')],_0x2c35b8);_0x53a437(_0x5a26c0[_0x586e('0x12')](0x1f4,_0x5bf2ec['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7925075..74af9fe 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 _0xc33c=['/:id/subjects','getSubjects','post','create','put','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xc33c,0xb2));var _0xcc33=function(_0x2f6db1,_0x3b140e){_0x2f6db1=_0x2f6db1-0x0;var _0x54184b=_0xc33c[_0x2f6db1];return _0x54184b;};'use strict';var multer=require(_0xcc33('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc33('0x1'));var router=express[_0xcc33('0x2')]();var fs_extra=require(_0xcc33('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc33('0x4'));var controller=require(_0xcc33('0x5'));router[_0xcc33('0x6')]('/',auth[_0xcc33('0x7')](),controller[_0xcc33('0x8')]);router[_0xcc33('0x6')]('/:id',auth[_0xcc33('0x7')](),controller['show']);router[_0xcc33('0x6')](_0xcc33('0x9'),auth['isAuthenticated'](),controller[_0xcc33('0xa')]);router[_0xcc33('0x6')](_0xcc33('0xb'),auth[_0xcc33('0x7')](),controller[_0xcc33('0xc')]);router[_0xcc33('0x6')]('/:id/descriptions',auth[_0xcc33('0x7')](),controller['getDescriptions']);router[_0xcc33('0xd')]('/',auth['isAuthenticated'](),controller[_0xcc33('0xe')]);router[_0xcc33('0xf')](_0xcc33('0x10'),auth[_0xcc33('0x7')](),controller[_0xcc33('0x11')]);router[_0xcc33('0x12')](_0xcc33('0x10'),auth['isAuthenticated'](),controller[_0xcc33('0x13')]);module[_0xcc33('0x14')]=router; \ No newline at end of file +var _0xf818=['getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xf818,0xa7));var _0x8f81=function(_0xdcdcf5,_0x4ed0d6){_0xdcdcf5=_0xdcdcf5-0x0;var _0x17e2ce=_0xf818[_0xdcdcf5];return _0x17e2ce;};'use strict';var multer=require(_0x8f81('0x0'));var util=require('util');var path=require(_0x8f81('0x1'));var timeout=require(_0x8f81('0x2'));var express=require(_0x8f81('0x3'));var router=express[_0x8f81('0x4')]();var fs_extra=require(_0x8f81('0x5'));var auth=require(_0x8f81('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x8f81('0x7')]('/',auth[_0x8f81('0x8')](),controller[_0x8f81('0x9')]);router['get'](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0xb')]);router['get'](_0x8f81('0xc'),auth[_0x8f81('0x8')](),controller[_0x8f81('0xd')]);router[_0x8f81('0x7')](_0x8f81('0xe'),auth['isAuthenticated'](),controller[_0x8f81('0xf')]);router[_0x8f81('0x7')](_0x8f81('0x10'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x11')]);router['post']('/',auth[_0x8f81('0x8')](),controller['create']);router[_0x8f81('0x12')](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x13')]);router[_0x8f81('0x14')](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x15')]);module[_0x8f81('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index dcaaa14..1566f7b 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 _0x5e0b=['STRING','sequelize'];(function(_0x3b65b7,_0x1756e2){var _0x186695=function(_0x1c8e92){while(--_0x1c8e92){_0x3b65b7['push'](_0x3b65b7['shift']());}};_0x186695(++_0x1756e2);}(_0x5e0b,0x89));var _0xb5e0=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x5e0b[_0x2ac71a];return _0x3ee904;};'use strict';var Sequelize=require(_0xb5e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5e0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7229=['sequelize','exports','STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7229,0xd2));var _0x9722=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x7229[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require(_0x9722('0x0'));module[_0x9722('0x1')]={'name':{'type':Sequelize[_0x9722('0x2')]},'description':{'type':Sequelize[_0x9722('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 66e5d2a..90b249d 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 _0x5d3c=['undefined','count','limit','set','reject','save','update','then','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','keys','includeAll','create','body','params','destroy','find','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset'];(function(_0x5b96c1,_0x404402){var _0x3aea56=function(_0x484600){while(--_0x484600){_0x5b96c1['push'](_0x5b96c1['shift']());}};_0x3aea56(++_0x404402);}(_0x5d3c,0x124));var _0xc5d3=function(_0x39342b,_0x30ee8c){_0x39342b=_0x39342b-0x0;var _0x3c7f3f=_0x5d3c[_0x39342b];return _0x3c7f3f;};'use strict';var emlformat=require(_0xc5d3('0x0'));var rimraf=require(_0xc5d3('0x1'));var zipdir=require(_0xc5d3('0x2'));var jsonpatch=require(_0xc5d3('0x3'));var rp=require(_0xc5d3('0x4'));var moment=require('moment');var BPromise=require(_0xc5d3('0x5'));var Mustache=require(_0xc5d3('0x6'));var util=require(_0xc5d3('0x7'));var path=require('path');var sox=require(_0xc5d3('0x8'));var csv=require(_0xc5d3('0x9'));var ejs=require(_0xc5d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5d3('0xb'));var squel=require(_0xc5d3('0xc'));var crypto=require('crypto');var jsforce=require(_0xc5d3('0xd'));var deskjs=require(_0xc5d3('0xe'));var toCsv=require(_0xc5d3('0x9'));var querystring=require(_0xc5d3('0xf'));var Papa=require(_0xc5d3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5d3('0x11'));var qs=require(_0xc5d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5d3('0x13'));var logger=require(_0xc5d3('0x14'))(_0xc5d3('0x15'));var utils=require(_0xc5d3('0x16'));var config=require(_0xc5d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5d3('0x18'))['db'];function respondWithStatusCode(_0x4f5feb,_0x548f98){_0x548f98=_0x548f98||0xcc;return function(_0x13d8e8){if(_0x13d8e8){return _0x4f5feb[_0xc5d3('0x19')](_0x548f98);}return _0x4f5feb[_0xc5d3('0x1a')](_0x548f98)['end']();};}function respondWithResult(_0x3de5c4,_0x15c68e){_0x15c68e=_0x15c68e||0xc8;return function(_0x270052){if(_0x270052){return _0x3de5c4[_0xc5d3('0x1a')](_0x15c68e)['json'](_0x270052);}};}function respondWithFilteredResult(_0x343a4d,_0x25dd5c){return function(_0x9e9b4b){if(_0x9e9b4b){var _0x5ca405=typeof _0x25dd5c[_0xc5d3('0x1b')]===_0xc5d3('0x1c')&&typeof _0x25dd5c['limit']==='undefined';var _0x400384=_0x9e9b4b['count'];var _0x239150=_0x5ca405?0x0:_0x25dd5c[_0xc5d3('0x1b')];var _0x52299a=_0x5ca405?_0x9e9b4b[_0xc5d3('0x1d')]:_0x25dd5c[_0xc5d3('0x1b')]+_0x25dd5c[_0xc5d3('0x1e')];var _0x3d609f;if(_0x52299a>=_0x400384){_0x52299a=_0x400384;_0x3d609f=0xc8;}else{_0x3d609f=0xce;}_0x343a4d[_0xc5d3('0x1a')](_0x3d609f);return _0x343a4d[_0xc5d3('0x1f')]('Content-Range',_0x239150+'-'+_0x52299a+'/'+_0x400384)['json'](_0x9e9b4b);}return null;};}function patchUpdates(_0x9bbe1){return function(_0x2859a2){try{jsonpatch['apply'](_0x2859a2,_0x9bbe1,!![]);}catch(_0x2a766b){return BPromise[_0xc5d3('0x20')](_0x2a766b);}return _0x2859a2[_0xc5d3('0x21')]();};}function saveUpdates(_0x189a11,_0x30faa0){return function(_0x44920a){if(_0x44920a){return _0x44920a[_0xc5d3('0x22')](_0x189a11)[_0xc5d3('0x23')](function(_0x29e117){return _0x29e117;});}return null;};}function removeEntity(_0x5247ec,_0x848d3d){return function(_0x16b534){if(_0x16b534){return _0x16b534['destroy']()['then'](function(){_0x5247ec['status'](0xcc)[_0xc5d3('0x24')]();});}};}function handleEntityNotFound(_0x936ff5,_0x348bb6){return function(_0x1e54d9){if(!_0x1e54d9){_0x936ff5[_0xc5d3('0x19')](0x194);}return _0x1e54d9;};}function handleError(_0x57a580,_0x3d089e){_0x3d089e=_0x3d089e||0x1f4;return function(_0x1d7303){logger['error'](_0x1d7303[_0xc5d3('0x25')]);if(_0x1d7303['name']){delete _0x1d7303[_0xc5d3('0x26')];}_0x57a580['status'](_0x3d089e)[_0xc5d3('0x27')](_0x1d7303);};}exports[_0xc5d3('0x28')]=function(_0x18f293,_0x1c2442){var _0x4001e7={},_0x3fcbef={},_0x9cd55b={'count':0x0,'rows':[]};var _0x3c4a99=_[_0xc5d3('0x29')](db[_0xc5d3('0x2a')][_0xc5d3('0x2b')],function(_0x3c2276){return{'name':_0x3c2276[_0xc5d3('0x2c')],'type':_0x3c2276[_0xc5d3('0x2d')][_0xc5d3('0x2e')]};});_0x3fcbef[_0xc5d3('0x2f')]=_[_0xc5d3('0x29')](_0x3c4a99,_0xc5d3('0x26'));_0x3fcbef['query']=_['keys'](_0x18f293[_0xc5d3('0x30')]);_0x3fcbef[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x3fcbef[_0xc5d3('0x2f')],_0x3fcbef[_0xc5d3('0x30')]);_0x4001e7[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x3fcbef[_0xc5d3('0x2f')],qs['fields'](_0x18f293[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x4001e7[_0xc5d3('0x33')]=_0x4001e7[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x4001e7['attributes']:_0x3fcbef[_0xc5d3('0x2f')];if(!_0x18f293['query']['hasOwnProperty']('nolimit')){_0x4001e7[_0xc5d3('0x1e')]=qs['limit'](_0x18f293[_0xc5d3('0x30')]['limit']);_0x4001e7['offset']=qs[_0xc5d3('0x1b')](_0x18f293[_0xc5d3('0x30')]['offset']);}_0x4001e7[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x18f293['query'][_0xc5d3('0x37')]);_0x4001e7['where']=qs[_0xc5d3('0x31')](_[_0xc5d3('0x38')](_0x18f293[_0xc5d3('0x30')],_0x3fcbef['filters']),_0x3c4a99);if(_0x18f293['query']['filter']){_0x4001e7[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x4001e7[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x3c4a99,function(_0x371895){if(_0x371895[_0xc5d3('0x2d')]!==_0xc5d3('0x3b')){var _0x4c5840={};_0x4c5840[_0x371895[_0xc5d3('0x26')]]={'$like':'%'+_0x18f293['query'][_0xc5d3('0x3c')]+'%'};return _0x4c5840;}})});}_0x4001e7=_['merge']({},_0x4001e7,_0x18f293[_0xc5d3('0x3d')]);var _0x3b8639={'where':_0x4001e7['where']};return db[_0xc5d3('0x2a')][_0xc5d3('0x1d')](_0x3b8639)[_0xc5d3('0x23')](function(_0xb676ba){_0x9cd55b[_0xc5d3('0x1d')]=_0xb676ba;if(_0x18f293[_0xc5d3('0x30')]['includeAll']){_0x4001e7[_0xc5d3('0x3e')]=[{'all':!![]}];}return db[_0xc5d3('0x2a')][_0xc5d3('0x3f')](_0x4001e7);})[_0xc5d3('0x23')](function(_0x35d589){_0x9cd55b[_0xc5d3('0x40')]=_0x35d589;return _0x9cd55b;})[_0xc5d3('0x23')](respondWithFilteredResult(_0x1c2442,_0x4001e7))[_0xc5d3('0x41')](handleError(_0x1c2442,null));};exports['show']=function(_0x17d225,_0x158414){var _0x2fa7cf={'raw':![],'where':{'id':_0x17d225['params']['id']}},_0x43ad86={};_0x43ad86['model']=_['keys'](db['ServicenowConfiguration'][_0xc5d3('0x2b')]);_0x43ad86['query']=_[_0xc5d3('0x42')](_0x17d225[_0xc5d3('0x30')]);_0x43ad86[_0xc5d3('0x31')]=_['intersection'](_0x43ad86[_0xc5d3('0x2f')],_0x43ad86[_0xc5d3('0x30')]);_0x2fa7cf[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x43ad86['model'],qs['fields'](_0x17d225[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x2fa7cf[_0xc5d3('0x33')]=_0x2fa7cf[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x2fa7cf[_0xc5d3('0x33')]:_0x43ad86[_0xc5d3('0x2f')];if(_0x17d225[_0xc5d3('0x30')][_0xc5d3('0x43')]){_0x2fa7cf[_0xc5d3('0x3e')]=[{'all':!![]}];}_0x2fa7cf=_['merge']({},_0x2fa7cf,_0x17d225[_0xc5d3('0x3d')]);return db[_0xc5d3('0x2a')]['find'](_0x2fa7cf)['then'](handleEntityNotFound(_0x158414,null))[_0xc5d3('0x23')](respondWithResult(_0x158414,null))['catch'](handleError(_0x158414,null));};exports[_0xc5d3('0x44')]=function(_0x5579fa,_0x4236b6){return db[_0xc5d3('0x2a')]['create'](_0x5579fa['body'],{})['then'](respondWithResult(_0x4236b6,0xc9))['catch'](handleError(_0x4236b6,null));};exports[_0xc5d3('0x22')]=function(_0x46776a,_0x1b5575){if(_0x46776a[_0xc5d3('0x45')]['id']){delete _0x46776a[_0xc5d3('0x45')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x46776a[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b5575,null))['then'](saveUpdates(_0x46776a['body'],null))[_0xc5d3('0x23')](respondWithResult(_0x1b5575,null))['catch'](handleError(_0x1b5575,null));};exports[_0xc5d3('0x47')]=function(_0x33716c,_0x21a4cd){return db[_0xc5d3('0x2a')][_0xc5d3('0x48')]({'where':{'id':_0x33716c[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x21a4cd,null))['then'](removeEntity(_0x21a4cd,null))[_0xc5d3('0x41')](handleError(_0x21a4cd,null));};exports[_0xc5d3('0x49')]=function(_0x2d1de2,_0x301070,_0x37bda9){var _0x1ada53={};var _0x53993d={};var _0x4f2460;var _0x392e7a;return db[_0xc5d3('0x2a')][_0xc5d3('0x4a')]({'where':{'id':_0x2d1de2[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x301070,null))[_0xc5d3('0x23')](function(_0x56de05){if(_0x56de05){_0x4f2460=_0x56de05;_0x53993d['model']=_[_0xc5d3('0x42')](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x53993d[_0xc5d3('0x30')]=_[_0xc5d3('0x42')](_0x2d1de2[_0xc5d3('0x30')]);_0x53993d[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x53993d[_0xc5d3('0x2f')],_0x53993d[_0xc5d3('0x30')]);_0x1ada53[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x53993d['model'],qs[_0xc5d3('0x34')](_0x2d1de2['query'][_0xc5d3('0x34')]));_0x1ada53[_0xc5d3('0x33')]=_0x1ada53[_0xc5d3('0x33')]['length']?_0x1ada53[_0xc5d3('0x33')]:_0x53993d[_0xc5d3('0x2f')];_0x1ada53[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x37')]);_0x1ada53[_0xc5d3('0x39')]=qs[_0xc5d3('0x31')](_['pick'](_0x2d1de2[_0xc5d3('0x30')],_0x53993d[_0xc5d3('0x31')]));if(_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x3c')]){_0x1ada53['where']=_[_0xc5d3('0x3a')](_0x1ada53[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x1ada53[_0xc5d3('0x33')],function(_0x43ad98){var _0x15b3b8={};_0x15b3b8[_0x43ad98]={'$like':'%'+_0x2d1de2[_0xc5d3('0x30')]['filter']+'%'};return _0x15b3b8;})});}_0x1ada53=_[_0xc5d3('0x3a')]({},_0x1ada53,_0x2d1de2[_0xc5d3('0x3d')]);return _0x4f2460['getFields'](_0x1ada53);}})[_0xc5d3('0x23')](function(_0x2d2573){if(_0x2d2573){_0x392e7a=_0x2d2573[_0xc5d3('0x35')];if(!_0x2d1de2[_0xc5d3('0x30')]['hasOwnProperty'](_0xc5d3('0x4c'))){_0x1ada53[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x2d1de2['query'][_0xc5d3('0x1e')]);_0x1ada53[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x4f2460[_0xc5d3('0x49')](_0x1ada53);}})[_0xc5d3('0x23')](function(_0x2eb477){if(_0x2eb477){return _0x2eb477?{'count':_0x392e7a,'rows':_0x2eb477}:null;}})[_0xc5d3('0x23')](respondWithResult(_0x301070,null))[_0xc5d3('0x41')](handleError(_0x301070,null));};exports['getSubjects']=function(_0x3fd561,_0x163d7b,_0x6e666d){var _0x15f211={};var _0x3bede5={};var _0x41f24f;var _0x40ea8c;return db[_0xc5d3('0x2a')][_0xc5d3('0x4a')]({'where':{'id':_0x3fd561[_0xc5d3('0x46')]['id']}})[_0xc5d3('0x23')](handleEntityNotFound(_0x163d7b,null))[_0xc5d3('0x23')](function(_0x567dc6){if(_0x567dc6){_0x41f24f=_0x567dc6;_0x3bede5[_0xc5d3('0x2f')]=_['keys'](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x3bede5[_0xc5d3('0x30')]=_['keys'](_0x3fd561[_0xc5d3('0x30')]);_0x3bede5[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x3bede5['model'],_0x3bede5[_0xc5d3('0x30')]);_0x15f211[_0xc5d3('0x33')]=_['intersection'](_0x3bede5[_0xc5d3('0x2f')],qs[_0xc5d3('0x34')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x15f211[_0xc5d3('0x33')]=_0x15f211[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x15f211['attributes']:_0x3bede5[_0xc5d3('0x2f')];_0x15f211[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x37')]);_0x15f211[_0xc5d3('0x39')]=qs['filters'](_[_0xc5d3('0x38')](_0x3fd561[_0xc5d3('0x30')],_0x3bede5['filters']));if(_0x3fd561['query'][_0xc5d3('0x3c')]){_0x15f211[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x15f211[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x15f211['attributes'],function(_0x5e5959){var _0x6bdd1b={};_0x6bdd1b[_0x5e5959]={'$like':'%'+_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x3c')]+'%'};return _0x6bdd1b;})});}_0x15f211=_[_0xc5d3('0x3a')]({},_0x15f211,_0x3fd561[_0xc5d3('0x3d')]);return _0x41f24f['getSubjects'](_0x15f211);}})[_0xc5d3('0x23')](function(_0x3836dc){if(_0x3836dc){_0x40ea8c=_0x3836dc[_0xc5d3('0x35')];if(!_0x3fd561['query']['hasOwnProperty'](_0xc5d3('0x4c'))){_0x15f211[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x1e')]);_0x15f211[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x41f24f[_0xc5d3('0x4d')](_0x15f211);}})[_0xc5d3('0x23')](function(_0x7a5869){if(_0x7a5869){return _0x7a5869?{'count':_0x40ea8c,'rows':_0x7a5869}:null;}})['then'](respondWithResult(_0x163d7b,null))[_0xc5d3('0x41')](handleError(_0x163d7b,null));};exports['getDescriptions']=function(_0x288419,_0xeaf374,_0xeb69c3){var _0x5870d={};var _0x867fc5={};var _0x2e25c5;var _0x541d0d;return db['ServicenowConfiguration'][_0xc5d3('0x4a')]({'where':{'id':_0x288419[_0xc5d3('0x46')]['id']}})[_0xc5d3('0x23')](handleEntityNotFound(_0xeaf374,null))[_0xc5d3('0x23')](function(_0x32b212){if(_0x32b212){_0x2e25c5=_0x32b212;_0x867fc5['model']=_[_0xc5d3('0x42')](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x867fc5['query']=_['keys'](_0x288419[_0xc5d3('0x30')]);_0x867fc5[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x867fc5[_0xc5d3('0x2f')],_0x867fc5[_0xc5d3('0x30')]);_0x5870d[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x867fc5[_0xc5d3('0x2f')],qs[_0xc5d3('0x34')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x5870d[_0xc5d3('0x33')]=_0x5870d[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x5870d[_0xc5d3('0x33')]:_0x867fc5[_0xc5d3('0x2f')];_0x5870d[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x288419['query']['sort']);_0x5870d[_0xc5d3('0x39')]=qs[_0xc5d3('0x31')](_[_0xc5d3('0x38')](_0x288419['query'],_0x867fc5[_0xc5d3('0x31')]));if(_0x288419[_0xc5d3('0x30')][_0xc5d3('0x3c')]){_0x5870d[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x5870d[_0xc5d3('0x39')],{'$or':_['map'](_0x5870d[_0xc5d3('0x33')],function(_0x325b75){var _0x4f666d={};_0x4f666d[_0x325b75]={'$like':'%'+_0x288419[_0xc5d3('0x30')][_0xc5d3('0x3c')]+'%'};return _0x4f666d;})});}_0x5870d=_['merge']({},_0x5870d,_0x288419[_0xc5d3('0x3d')]);return _0x2e25c5[_0xc5d3('0x4e')](_0x5870d);}})[_0xc5d3('0x23')](function(_0x40ef89){if(_0x40ef89){_0x541d0d=_0x40ef89[_0xc5d3('0x35')];if(!_0x288419[_0xc5d3('0x30')][_0xc5d3('0x4f')](_0xc5d3('0x4c'))){_0x5870d[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x1e')]);_0x5870d[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x2e25c5[_0xc5d3('0x4e')](_0x5870d);}})[_0xc5d3('0x23')](function(_0x2fb6b2){if(_0x2fb6b2){return _0x2fb6b2?{'count':_0x541d0d,'rows':_0x2fb6b2}:null;}})['then'](respondWithResult(_0xeaf374,null))[_0xc5d3('0x41')](handleError(_0xeaf374,null));}; \ No newline at end of file +var _0x8241=['stack','name','send','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowConfiguration','includeAll','findAll','catch','show','params','fields','include','options','find','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','error'];(function(_0x3d30e9,_0x1482dc){var _0x536a7=function(_0x37b0cd){while(--_0x37b0cd){_0x3d30e9['push'](_0x3d30e9['shift']());}};_0x536a7(++_0x1482dc);}(_0x8241,0x116));var _0x1824=function(_0x1fadc9,_0x4dc488){_0x1fadc9=_0x1fadc9-0x0;var _0x516b58=_0x8241[_0x1fadc9];return _0x516b58;};'use strict';var emlformat=require(_0x1824('0x0'));var rimraf=require(_0x1824('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1824('0x2'));var moment=require(_0x1824('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1824('0x4'));var util=require(_0x1824('0x5'));var path=require('path');var sox=require(_0x1824('0x6'));var csv=require(_0x1824('0x7'));var ejs=require(_0x1824('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1824('0x9'));var squel=require('squel');var crypto=require(_0x1824('0xa'));var jsforce=require(_0x1824('0xb'));var deskjs=require(_0x1824('0xc'));var toCsv=require(_0x1824('0x7'));var querystring=require(_0x1824('0xd'));var Papa=require(_0x1824('0xe'));var Redis=require(_0x1824('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1824('0x10'));var hardwareService=require(_0x1824('0x11'));var logger=require(_0x1824('0x12'))(_0x1824('0x13'));var utils=require('../../config/utils');var config=require(_0x1824('0x14'));var licenseUtil=require(_0x1824('0x15'));var db=require(_0x1824('0x16'))['db'];function respondWithStatusCode(_0x546866,_0x5a87bd){_0x5a87bd=_0x5a87bd||0xcc;return function(_0x13bd21){if(_0x13bd21){return _0x546866[_0x1824('0x17')](_0x5a87bd);}return _0x546866[_0x1824('0x18')](_0x5a87bd)[_0x1824('0x19')]();};}function respondWithResult(_0x2e4441,_0x2a5dfa){_0x2a5dfa=_0x2a5dfa||0xc8;return function(_0x3fa4fc){if(_0x3fa4fc){return _0x2e4441['status'](_0x2a5dfa)[_0x1824('0x1a')](_0x3fa4fc);}};}function respondWithFilteredResult(_0x32ff1c,_0xaa17dc){return function(_0x52762d){if(_0x52762d){var _0x50bd9c=typeof _0xaa17dc['offset']==='undefined'&&typeof _0xaa17dc[_0x1824('0x1b')]===_0x1824('0x1c');var _0x2c88a5=_0x52762d[_0x1824('0x1d')];var _0x4ffd6e=_0x50bd9c?0x0:_0xaa17dc['offset'];var _0x26640a=_0x50bd9c?_0x52762d[_0x1824('0x1d')]:_0xaa17dc[_0x1824('0x1e')]+_0xaa17dc[_0x1824('0x1b')];var _0x4ca85b;if(_0x26640a>=_0x2c88a5){_0x26640a=_0x2c88a5;_0x4ca85b=0xc8;}else{_0x4ca85b=0xce;}_0x32ff1c[_0x1824('0x18')](_0x4ca85b);return _0x32ff1c[_0x1824('0x1f')](_0x1824('0x20'),_0x4ffd6e+'-'+_0x26640a+'/'+_0x2c88a5)[_0x1824('0x1a')](_0x52762d);}return null;};}function patchUpdates(_0x3a5c35){return function(_0x55a2fe){try{jsonpatch['apply'](_0x55a2fe,_0x3a5c35,!![]);}catch(_0x18a40c){return BPromise[_0x1824('0x21')](_0x18a40c);}return _0x55a2fe[_0x1824('0x22')]();};}function saveUpdates(_0xe6525a,_0x31238c){return function(_0x4a338b){if(_0x4a338b){return _0x4a338b[_0x1824('0x23')](_0xe6525a)[_0x1824('0x24')](function(_0x108287){return _0x108287;});}return null;};}function removeEntity(_0x237f6c,_0x38d83c){return function(_0x35d115){if(_0x35d115){return _0x35d115['destroy']()['then'](function(){_0x237f6c[_0x1824('0x18')](0xcc)[_0x1824('0x19')]();});}};}function handleEntityNotFound(_0xd66394,_0x5a36aa){return function(_0x1075b7){if(!_0x1075b7){_0xd66394[_0x1824('0x17')](0x194);}return _0x1075b7;};}function handleError(_0x59b15d,_0xcce7c9){_0xcce7c9=_0xcce7c9||0x1f4;return function(_0x5b061b){logger[_0x1824('0x25')](_0x5b061b[_0x1824('0x26')]);if(_0x5b061b[_0x1824('0x27')]){delete _0x5b061b['name'];}_0x59b15d[_0x1824('0x18')](_0xcce7c9)[_0x1824('0x28')](_0x5b061b);};}exports[_0x1824('0x29')]=function(_0x4f5ef7,_0x570c6b){var _0x3b57a4={},_0x1eb6c3={},_0xa059af={'count':0x0,'rows':[]};var _0x3d376e=_[_0x1824('0x2a')](db['ServicenowConfiguration'][_0x1824('0x2b')],function(_0x56d61f){return{'name':_0x56d61f['fieldName'],'type':_0x56d61f[_0x1824('0x2c')]['key']};});_0x1eb6c3[_0x1824('0x2d')]=_['map'](_0x3d376e,_0x1824('0x27'));_0x1eb6c3['query']=_[_0x1824('0x2e')](_0x4f5ef7['query']);_0x1eb6c3[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x1eb6c3['model'],_0x1eb6c3[_0x1824('0x31')]);_0x3b57a4[_0x1824('0x32')]=_[_0x1824('0x30')](_0x1eb6c3[_0x1824('0x2d')],qs['fields'](_0x4f5ef7[_0x1824('0x31')]['fields']));_0x3b57a4[_0x1824('0x32')]=_0x3b57a4[_0x1824('0x32')][_0x1824('0x33')]?_0x3b57a4['attributes']:_0x1eb6c3[_0x1824('0x2d')];if(!_0x4f5ef7[_0x1824('0x31')][_0x1824('0x34')](_0x1824('0x35'))){_0x3b57a4['limit']=qs[_0x1824('0x1b')](_0x4f5ef7[_0x1824('0x31')]['limit']);_0x3b57a4[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x4f5ef7[_0x1824('0x31')][_0x1824('0x1e')]);}_0x3b57a4[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x4f5ef7[_0x1824('0x31')][_0x1824('0x37')]);_0x3b57a4[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x4f5ef7[_0x1824('0x31')],_0x1eb6c3['filters']),_0x3d376e);if(_0x4f5ef7['query'][_0x1824('0x3a')]){_0x3b57a4[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x3b57a4['where'],{'$or':_[_0x1824('0x2a')](_0x3d376e,function(_0x2a5258){if(_0x2a5258['type']!==_0x1824('0x3c')){var _0x16f24c={};_0x16f24c[_0x2a5258[_0x1824('0x27')]]={'$like':'%'+_0x4f5ef7[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x16f24c;}})});}_0x3b57a4=_[_0x1824('0x3b')]({},_0x3b57a4,_0x4f5ef7['options']);var _0x2467e1={'where':_0x3b57a4[_0x1824('0x38')]};return db[_0x1824('0x3d')][_0x1824('0x1d')](_0x2467e1)[_0x1824('0x24')](function(_0xf737ca){_0xa059af[_0x1824('0x1d')]=_0xf737ca;if(_0x4f5ef7[_0x1824('0x31')][_0x1824('0x3e')]){_0x3b57a4['include']=[{'all':!![]}];}return db[_0x1824('0x3d')][_0x1824('0x3f')](_0x3b57a4);})[_0x1824('0x24')](function(_0x22c8e2){_0xa059af['rows']=_0x22c8e2;return _0xa059af;})['then'](respondWithFilteredResult(_0x570c6b,_0x3b57a4))[_0x1824('0x40')](handleError(_0x570c6b,null));};exports[_0x1824('0x41')]=function(_0x1ff17c,_0x2be2f8){var _0x1880c9={'raw':![],'where':{'id':_0x1ff17c[_0x1824('0x42')]['id']}},_0x40e43b={};_0x40e43b['model']=_[_0x1824('0x2e')](db[_0x1824('0x3d')][_0x1824('0x2b')]);_0x40e43b[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x1ff17c[_0x1824('0x31')]);_0x40e43b[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x40e43b[_0x1824('0x2d')],_0x40e43b[_0x1824('0x31')]);_0x1880c9['attributes']=_[_0x1824('0x30')](_0x40e43b[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x1ff17c[_0x1824('0x31')][_0x1824('0x43')]));_0x1880c9[_0x1824('0x32')]=_0x1880c9['attributes'][_0x1824('0x33')]?_0x1880c9[_0x1824('0x32')]:_0x40e43b[_0x1824('0x2d')];if(_0x1ff17c[_0x1824('0x31')][_0x1824('0x3e')]){_0x1880c9[_0x1824('0x44')]=[{'all':!![]}];}_0x1880c9=_[_0x1824('0x3b')]({},_0x1880c9,_0x1ff17c[_0x1824('0x45')]);return db[_0x1824('0x3d')][_0x1824('0x46')](_0x1880c9)[_0x1824('0x24')](handleEntityNotFound(_0x2be2f8,null))[_0x1824('0x24')](respondWithResult(_0x2be2f8,null))[_0x1824('0x40')](handleError(_0x2be2f8,null));};exports[_0x1824('0x47')]=function(_0x43731d,_0x34b378){return db[_0x1824('0x3d')]['create'](_0x43731d[_0x1824('0x48')],{})[_0x1824('0x24')](respondWithResult(_0x34b378,0xc9))[_0x1824('0x40')](handleError(_0x34b378,null));};exports[_0x1824('0x23')]=function(_0x4d0f32,_0x4df08c){if(_0x4d0f32[_0x1824('0x48')]['id']){delete _0x4d0f32[_0x1824('0x48')]['id'];}return db[_0x1824('0x3d')][_0x1824('0x46')]({'where':{'id':_0x4d0f32[_0x1824('0x42')]['id']}})['then'](handleEntityNotFound(_0x4df08c,null))[_0x1824('0x24')](saveUpdates(_0x4d0f32['body'],null))[_0x1824('0x24')](respondWithResult(_0x4df08c,null))[_0x1824('0x40')](handleError(_0x4df08c,null));};exports[_0x1824('0x49')]=function(_0x437a77,_0x5650b6){return db[_0x1824('0x3d')][_0x1824('0x46')]({'where':{'id':_0x437a77[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x5650b6,null))['then'](removeEntity(_0x5650b6,null))['catch'](handleError(_0x5650b6,null));};exports[_0x1824('0x4a')]=function(_0x236683,_0x5da7df,_0x277081){var _0x1eefcd={};var _0x231a5b={};var _0x10346a;var _0x33e7c2;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x236683[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x5da7df,null))[_0x1824('0x24')](function(_0x2c77dc){if(_0x2c77dc){_0x10346a=_0x2c77dc;_0x231a5b[_0x1824('0x2d')]=_[_0x1824('0x2e')](db[_0x1824('0x4c')][_0x1824('0x2b')]);_0x231a5b[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x236683['query']);_0x231a5b['filters']=_[_0x1824('0x30')](_0x231a5b[_0x1824('0x2d')],_0x231a5b[_0x1824('0x31')]);_0x1eefcd[_0x1824('0x32')]=_[_0x1824('0x30')](_0x231a5b[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x236683[_0x1824('0x31')][_0x1824('0x43')]));_0x1eefcd[_0x1824('0x32')]=_0x1eefcd[_0x1824('0x32')]['length']?_0x1eefcd[_0x1824('0x32')]:_0x231a5b[_0x1824('0x2d')];_0x1eefcd[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x236683[_0x1824('0x31')][_0x1824('0x37')]);_0x1eefcd[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x236683[_0x1824('0x31')],_0x231a5b[_0x1824('0x2f')]));if(_0x236683['query'][_0x1824('0x3a')]){_0x1eefcd[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x1eefcd[_0x1824('0x38')],{'$or':_['map'](_0x1eefcd[_0x1824('0x32')],function(_0x5484ad){var _0x3ddfc1={};_0x3ddfc1[_0x5484ad]={'$like':'%'+_0x236683[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x3ddfc1;})});}_0x1eefcd=_[_0x1824('0x3b')]({},_0x1eefcd,_0x236683[_0x1824('0x45')]);return _0x10346a[_0x1824('0x4a')](_0x1eefcd);}})[_0x1824('0x24')](function(_0x174659){if(_0x174659){_0x33e7c2=_0x174659[_0x1824('0x33')];if(!_0x236683[_0x1824('0x31')]['hasOwnProperty']('nolimit')){_0x1eefcd[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x236683[_0x1824('0x31')]['limit']);_0x1eefcd[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x236683[_0x1824('0x31')][_0x1824('0x1e')]);}return _0x10346a[_0x1824('0x4a')](_0x1eefcd);}})[_0x1824('0x24')](function(_0x432e56){if(_0x432e56){return _0x432e56?{'count':_0x33e7c2,'rows':_0x432e56}:null;}})['then'](respondWithResult(_0x5da7df,null))[_0x1824('0x40')](handleError(_0x5da7df,null));};exports[_0x1824('0x4d')]=function(_0x35d1ef,_0x320a69,_0x380150){var _0x5363d5={};var _0x457783={};var _0x24b617;var _0x385298;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x35d1ef[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x320a69,null))[_0x1824('0x24')](function(_0x1eb53d){if(_0x1eb53d){_0x24b617=_0x1eb53d;_0x457783[_0x1824('0x2d')]=_[_0x1824('0x2e')](db['ServicenowField']['rawAttributes']);_0x457783[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x35d1ef[_0x1824('0x31')]);_0x457783[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x457783[_0x1824('0x2d')],_0x457783['query']);_0x5363d5['attributes']=_['intersection'](_0x457783[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x35d1ef[_0x1824('0x31')]['fields']));_0x5363d5['attributes']=_0x5363d5['attributes'][_0x1824('0x33')]?_0x5363d5[_0x1824('0x32')]:_0x457783[_0x1824('0x2d')];_0x5363d5['order']=qs[_0x1824('0x37')](_0x35d1ef['query']['sort']);_0x5363d5[_0x1824('0x38')]=qs['filters'](_['pick'](_0x35d1ef[_0x1824('0x31')],_0x457783[_0x1824('0x2f')]));if(_0x35d1ef[_0x1824('0x31')][_0x1824('0x3a')]){_0x5363d5[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x5363d5[_0x1824('0x38')],{'$or':_['map'](_0x5363d5[_0x1824('0x32')],function(_0x21ac3c){var _0x5d5f91={};_0x5d5f91[_0x21ac3c]={'$like':'%'+_0x35d1ef[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x5d5f91;})});}_0x5363d5=_['merge']({},_0x5363d5,_0x35d1ef['options']);return _0x24b617[_0x1824('0x4d')](_0x5363d5);}})[_0x1824('0x24')](function(_0x5d3520){if(_0x5d3520){_0x385298=_0x5d3520['length'];if(!_0x35d1ef[_0x1824('0x31')]['hasOwnProperty'](_0x1824('0x35'))){_0x5363d5[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x35d1ef['query'][_0x1824('0x1b')]);_0x5363d5[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x35d1ef['query'][_0x1824('0x1e')]);}return _0x24b617[_0x1824('0x4d')](_0x5363d5);}})[_0x1824('0x24')](function(_0x4f3832){if(_0x4f3832){return _0x4f3832?{'count':_0x385298,'rows':_0x4f3832}:null;}})[_0x1824('0x24')](respondWithResult(_0x320a69,null))[_0x1824('0x40')](handleError(_0x320a69,null));};exports[_0x1824('0x4e')]=function(_0x21a21d,_0x14ff72,_0x3072d5){var _0x4a61ca={};var _0x54ff42={};var _0x1371bd;var _0x12195f;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x21a21d['params']['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x14ff72,null))['then'](function(_0x1c3f92){if(_0x1c3f92){_0x1371bd=_0x1c3f92;_0x54ff42[_0x1824('0x2d')]=_[_0x1824('0x2e')](db[_0x1824('0x4c')][_0x1824('0x2b')]);_0x54ff42[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x21a21d[_0x1824('0x31')]);_0x54ff42[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x54ff42[_0x1824('0x2d')],_0x54ff42[_0x1824('0x31')]);_0x4a61ca['attributes']=_[_0x1824('0x30')](_0x54ff42[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x21a21d[_0x1824('0x31')]['fields']));_0x4a61ca[_0x1824('0x32')]=_0x4a61ca['attributes'][_0x1824('0x33')]?_0x4a61ca[_0x1824('0x32')]:_0x54ff42['model'];_0x4a61ca[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x21a21d[_0x1824('0x31')][_0x1824('0x37')]);_0x4a61ca[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x21a21d['query'],_0x54ff42[_0x1824('0x2f')]));if(_0x21a21d['query'][_0x1824('0x3a')]){_0x4a61ca[_0x1824('0x38')]=_['merge'](_0x4a61ca['where'],{'$or':_['map'](_0x4a61ca['attributes'],function(_0xf952fe){var _0x53a111={};_0x53a111[_0xf952fe]={'$like':'%'+_0x21a21d[_0x1824('0x31')]['filter']+'%'};return _0x53a111;})});}_0x4a61ca=_[_0x1824('0x3b')]({},_0x4a61ca,_0x21a21d[_0x1824('0x45')]);return _0x1371bd['getDescriptions'](_0x4a61ca);}})[_0x1824('0x24')](function(_0x1fe6cb){if(_0x1fe6cb){_0x12195f=_0x1fe6cb[_0x1824('0x33')];if(!_0x21a21d[_0x1824('0x31')]['hasOwnProperty'](_0x1824('0x35'))){_0x4a61ca[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x21a21d[_0x1824('0x31')][_0x1824('0x1b')]);_0x4a61ca[_0x1824('0x1e')]=qs['offset'](_0x21a21d[_0x1824('0x31')][_0x1824('0x1e')]);}return _0x1371bd[_0x1824('0x4e')](_0x4a61ca);}})[_0x1824('0x24')](function(_0xb776b5){if(_0xb776b5){return _0xb776b5?{'count':_0x12195f,'rows':_0xb776b5}:null;}})[_0x1824('0x24')](respondWithResult(_0x14ff72,null))[_0x1824('0x40')](handleError(_0x14ff72,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 71bba74..0c60edd 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 _0x4f2f=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','../../config/logger','api','bluebird'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x4f2f[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d2d=['int_servicenow_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x438446,_0x320e62){var _0x485211=function(_0x5c245f){while(--_0x5c245f){_0x438446['push'](_0x438446['shift']());}};_0x485211(++_0x320e62);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x28ee93,_0x4fd48c){_0x28ee93=_0x28ee93-0x0;var _0x8a9703=_0x6d2d[_0x28ee93];return _0x8a9703;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6d2('0x0'))(_0xd6d2('0x1'));var moment=require(_0xd6d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6d2('0x3'));var fs=require('fs');var path=require(_0xd6d2('0x4'));var rimraf=require(_0xd6d2('0x5'));var config=require(_0xd6d2('0x6'));var attributes=require(_0xd6d2('0x7'));module[_0xd6d2('0x8')]=function(_0x32ebf,_0x2265d5){return _0x32ebf['define'](_0xd6d2('0x9'),attributes,{'tableName':_0xd6d2('0xa'),'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 18f9656..e8b33cc 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 _0xc122=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x51e94c,_0x31a80b){var _0x27663=function(_0x2bb9c0){while(--_0x2bb9c0){_0x51e94c['push'](_0x51e94c['shift']());}};_0x27663(++_0x31a80b);}(_0xc122,0x66));var _0x2c12=function(_0x1b1444,_0x2591c1){_0x1b1444=_0x1b1444-0x0;var _0x58ba7d=_0xc122[_0x1b1444];return _0x58ba7d;};'use strict';var _=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var moment=require(_0x2c12('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c12('0x3'));var fs=require('fs');var Redis=require(_0x2c12('0x4'));var db=require(_0x2c12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c12('0x6'))(_0x2c12('0x7'));var config=require(_0x2c12('0x8'));var jayson=require(_0x2c12('0x9'));var client=jayson[_0x2c12('0xa')][_0x2c12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59ef32,_0x5d4508,_0x1aa8cb){return new BPromise(function(_0x29f4e4,_0x55af81){return client[_0x2c12('0xc')](_0x59ef32,_0x1aa8cb)[_0x2c12('0xd')](function(_0x55b4a0){logger[_0x2c12('0xe')](_0x2c12('0xf'),_0x5d4508,_0x2c12('0x10'));logger[_0x2c12('0x11')](_0x2c12('0x12'),_0x5d4508,'request\x20sent',JSON['stringify'](_0x55b4a0));if(_0x55b4a0['error']){if(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x14')]===0x1f4){logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x55b4a0['error'][_0x2c12('0x15')]);return _0x55af81(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);}logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);return _0x29f4e4(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);}else{logger[_0x2c12('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5d4508,'request\x20sent');_0x29f4e4(_0x55b4a0['result'][_0x2c12('0x15')]);}})[_0x2c12('0x16')](function(_0x3f6a61){logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x3f6a61);_0x55af81(_0x3f6a61);});});} \ No newline at end of file +var _0x9d67=['client','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x9d67,0xe8));var _0x79d6=function(_0x5a44b2,_0x285bee){_0x5a44b2=_0x5a44b2-0x0;var _0x147ab9=_0x9d67[_0x5a44b2];return _0x147ab9;};'use strict';var _=require(_0x79d6('0x0'));var util=require(_0x79d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79d6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x79d6('0x3'));var logger=require(_0x79d6('0x4'))(_0x79d6('0x5'));var config=require(_0x79d6('0x6'));var jayson=require(_0x79d6('0x7'));var client=jayson[_0x79d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351205,_0x4ee47,_0x35e5cf){return new BPromise(function(_0x293343,_0x538c8e){return client['request'](_0x351205,_0x35e5cf)[_0x79d6('0x9')](function(_0x423cf9){logger['info'](_0x79d6('0xa'),_0x4ee47,_0x79d6('0xb'));logger[_0x79d6('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4ee47,_0x79d6('0xb'),JSON[_0x79d6('0xd')](_0x423cf9));if(_0x423cf9[_0x79d6('0xe')]){if(_0x423cf9[_0x79d6('0xe')][_0x79d6('0xf')]===0x1f4){logger[_0x79d6('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ee47,_0x423cf9[_0x79d6('0xe')]['message']);return _0x538c8e(_0x423cf9['error']['message']);}logger[_0x79d6('0xe')](_0x79d6('0xa'),_0x4ee47,_0x423cf9['error'][_0x79d6('0x10')]);return _0x293343(_0x423cf9['error'][_0x79d6('0x10')]);}else{logger[_0x79d6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ee47,_0x79d6('0xb'));_0x293343(_0x423cf9[_0x79d6('0x12')][_0x79d6('0x10')]);}})[_0x79d6('0x13')](function(_0x468cc1){logger[_0x79d6('0xe')](_0x79d6('0xa'),_0x4ee47,_0x468cc1);_0x538c8e(_0x468cc1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 50832d8..a0fcde3 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 _0x6d34=['isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x6d34,0x1dc));var _0x46d3=function(_0x59a9cc,_0x55eeca){_0x59a9cc=_0x59a9cc-0x0;var _0x18ec70=_0x6d34[_0x59a9cc];return _0x18ec70;};'use strict';var multer=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var path=require(_0x46d3('0x2'));var timeout=require(_0x46d3('0x3'));var express=require(_0x46d3('0x4'));var router=express['Router']();var fs_extra=require(_0x46d3('0x5'));var auth=require(_0x46d3('0x6'));var interaction=require(_0x46d3('0x7'));var config=require('../../config/environment');var controller=require(_0x46d3('0x8'));router[_0x46d3('0x9')]('/',auth[_0x46d3('0xa')](),controller['index']);router[_0x46d3('0x9')](_0x46d3('0xb'),auth[_0x46d3('0xa')](),controller[_0x46d3('0xc')]);router[_0x46d3('0xd')]('/',auth[_0x46d3('0xa')](),controller[_0x46d3('0xe')]);router[_0x46d3('0xf')](_0x46d3('0xb'),auth[_0x46d3('0xa')](),controller[_0x46d3('0x10')]);router['delete']('/:id',auth[_0x46d3('0xa')](),controller[_0x46d3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x17d9=['isAuthenticated','index','show','post','create','put','update','/:id','exports','multer','util','path','express','Router','fs-extra','./intServicenowField.controller','get'];(function(_0x5ba380,_0x1a5f46){var _0xac5b1=function(_0x239f3d){while(--_0x239f3d){_0x5ba380['push'](_0x5ba380['shift']());}};_0xac5b1(++_0x1a5f46);}(_0x17d9,0x6f));var _0x917d=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x17d9[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require(_0x917d('0x0'));var util=require(_0x917d('0x1'));var path=require(_0x917d('0x2'));var timeout=require('connect-timeout');var express=require(_0x917d('0x3'));var router=express[_0x917d('0x4')]();var fs_extra=require(_0x917d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x917d('0x6'));router[_0x917d('0x7')]('/',auth[_0x917d('0x8')](),controller[_0x917d('0x9')]);router[_0x917d('0x7')]('/:id',auth[_0x917d('0x8')](),controller[_0x917d('0xa')]);router[_0x917d('0xb')]('/',auth['isAuthenticated'](),controller[_0x917d('0xc')]);router[_0x917d('0xd')]('/:id',auth[_0x917d('0x8')](),controller[_0x917d('0xe')]);router['delete'](_0x917d('0xf'),auth[_0x917d('0x8')](),controller['destroy']);module[_0x917d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6da0e0d..34b3d7b 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 _0x5491=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x5491,0x15c));var _0x1549=function(_0x5bb322,_0x20d5cd){_0x5bb322=_0x5bb322-0x0;var _0x2c6953=_0x5491[_0x5bb322];return _0x2c6953;};'use strict';var Sequelize=require(_0x1549('0x0'));module[_0x1549('0x1')]={'type':{'type':Sequelize[_0x1549('0x2')](_0x1549('0x3'),_0x1549('0x4'),'customVariable',_0x1549('0x5'),_0x1549('0x6')),'defaultValue':_0x1549('0x3')},'content':{'type':Sequelize[_0x1549('0x7')]},'key':{'type':Sequelize[_0x1549('0x7')]},'keyType':{'type':Sequelize[_0x1549('0x2')](_0x1549('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1549('0x7')]},'customField':{'type':Sequelize[_0x1549('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1549('0x7')]}}; \ No newline at end of file +var _0xa5ae=['exports','ENUM','variable','picklist','STRING','string','customVariable','BOOLEAN'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa5ae,0x1f0));var _0xea5a=function(_0x2de9de,_0xd46ad){_0x2de9de=_0x2de9de-0x0;var _0x34be8c=_0xa5ae[_0x2de9de];return _0x34be8c;};'use strict';var Sequelize=require('sequelize');module[_0xea5a('0x0')]={'type':{'type':Sequelize[_0xea5a('0x1')]('string',_0xea5a('0x2'),'customVariable','keyValue',_0xea5a('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xea5a('0x4')]},'keyType':{'type':Sequelize[_0xea5a('0x1')](_0xea5a('0x5'),_0xea5a('0x2'),_0xea5a('0x6'))},'keyContent':{'type':Sequelize[_0xea5a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xea5a('0x4')]},'customField':{'type':Sequelize[_0xea5a('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 41b91f5..6b0d4dd 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 _0x27a7=['filter','where','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','catch','show','create','body','params','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x3820a1,_0xf8fac6){var _0x364e9c=function(_0x4e47b1){while(--_0x4e47b1){_0x3820a1['push'](_0x3820a1['shift']());}};_0x364e9c(++_0xf8fac6);}(_0x27a7,0x1b9));var _0x727a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x27a7[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0x727a('0x0'));var rimraf=require(_0x727a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x727a('0x2'));var rp=require('request-promise');var moment=require(_0x727a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x727a('0x4'));var util=require(_0x727a('0x5'));var path=require(_0x727a('0x6'));var sox=require(_0x727a('0x7'));var csv=require(_0x727a('0x8'));var ejs=require(_0x727a('0x9'));var fs=require('fs');var fs_extra=require(_0x727a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x727a('0xb'));var jsforce=require(_0x727a('0xc'));var deskjs=require(_0x727a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x727a('0xe'));var Redis=require('ioredis');var authService=require(_0x727a('0xf'));var qs=require(_0x727a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x727a('0x11'));var logger=require(_0x727a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x727a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x727a('0x14'))['db'];function respondWithStatusCode(_0x110382,_0x47ff86){_0x47ff86=_0x47ff86||0xcc;return function(_0x700535){if(_0x700535){return _0x110382[_0x727a('0x15')](_0x47ff86);}return _0x110382[_0x727a('0x16')](_0x47ff86)[_0x727a('0x17')]();};}function respondWithResult(_0x5c850c,_0x47ed3a){_0x47ed3a=_0x47ed3a||0xc8;return function(_0x1514d4){if(_0x1514d4){return _0x5c850c[_0x727a('0x16')](_0x47ed3a)[_0x727a('0x18')](_0x1514d4);}};}function respondWithFilteredResult(_0x16fdd4,_0x60a9c8){return function(_0x319419){if(_0x319419){var _0x30acba=typeof _0x60a9c8['offset']==='undefined'&&typeof _0x60a9c8[_0x727a('0x19')]===_0x727a('0x1a');var _0x3b2abb=_0x319419[_0x727a('0x1b')];var _0x390bfa=_0x30acba?0x0:_0x60a9c8['offset'];var _0x244834=_0x30acba?_0x319419[_0x727a('0x1b')]:_0x60a9c8[_0x727a('0x1c')]+_0x60a9c8[_0x727a('0x19')];var _0x23589b;if(_0x244834>=_0x3b2abb){_0x244834=_0x3b2abb;_0x23589b=0xc8;}else{_0x23589b=0xce;}_0x16fdd4[_0x727a('0x16')](_0x23589b);return _0x16fdd4[_0x727a('0x1d')](_0x727a('0x1e'),_0x390bfa+'-'+_0x244834+'/'+_0x3b2abb)[_0x727a('0x18')](_0x319419);}return null;};}function patchUpdates(_0xa3311){return function(_0xdfb140){try{jsonpatch[_0x727a('0x1f')](_0xdfb140,_0xa3311,!![]);}catch(_0x4bef56){return BPromise[_0x727a('0x20')](_0x4bef56);}return _0xdfb140['save']();};}function saveUpdates(_0x3bfcbc,_0x5ce09f){return function(_0xa96ecc){if(_0xa96ecc){return _0xa96ecc[_0x727a('0x21')](_0x3bfcbc)[_0x727a('0x22')](function(_0x21cd27){return _0x21cd27;});}return null;};}function removeEntity(_0x429316,_0x50b9a5){return function(_0x38787e){if(_0x38787e){return _0x38787e['destroy']()['then'](function(){_0x429316[_0x727a('0x16')](0xcc)[_0x727a('0x17')]();});}};}function handleEntityNotFound(_0x511351,_0x44d317){return function(_0x1f2618){if(!_0x1f2618){_0x511351[_0x727a('0x15')](0x194);}return _0x1f2618;};}function handleError(_0x26bf39,_0x531816){_0x531816=_0x531816||0x1f4;return function(_0x27dd4a){logger[_0x727a('0x23')](_0x27dd4a['stack']);if(_0x27dd4a[_0x727a('0x24')]){delete _0x27dd4a['name'];}_0x26bf39[_0x727a('0x16')](_0x531816)[_0x727a('0x25')](_0x27dd4a);};}exports[_0x727a('0x26')]=function(_0x387517,_0x2e1bdc){var _0x42195b={},_0x4ef71d={},_0x161302={'count':0x0,'rows':[]};var _0x316931=_['map'](db['ServicenowField'][_0x727a('0x27')],function(_0x3f1813){return{'name':_0x3f1813[_0x727a('0x28')],'type':_0x3f1813[_0x727a('0x29')][_0x727a('0x2a')]};});_0x4ef71d['model']=_[_0x727a('0x2b')](_0x316931,_0x727a('0x24'));_0x4ef71d[_0x727a('0x2c')]=_[_0x727a('0x2d')](_0x387517['query']);_0x4ef71d[_0x727a('0x2e')]=_['intersection'](_0x4ef71d[_0x727a('0x2f')],_0x4ef71d[_0x727a('0x2c')]);_0x42195b[_0x727a('0x30')]=_[_0x727a('0x31')](_0x4ef71d[_0x727a('0x2f')],qs[_0x727a('0x32')](_0x387517[_0x727a('0x2c')]['fields']));_0x42195b[_0x727a('0x30')]=_0x42195b[_0x727a('0x30')][_0x727a('0x33')]?_0x42195b[_0x727a('0x30')]:_0x4ef71d[_0x727a('0x2f')];if(!_0x387517[_0x727a('0x2c')][_0x727a('0x34')](_0x727a('0x35'))){_0x42195b[_0x727a('0x19')]=qs['limit'](_0x387517[_0x727a('0x2c')][_0x727a('0x19')]);_0x42195b[_0x727a('0x1c')]=qs[_0x727a('0x1c')](_0x387517['query'][_0x727a('0x1c')]);}_0x42195b['order']=qs[_0x727a('0x36')](_0x387517[_0x727a('0x2c')][_0x727a('0x36')]);_0x42195b['where']=qs[_0x727a('0x2e')](_[_0x727a('0x37')](_0x387517[_0x727a('0x2c')],_0x4ef71d[_0x727a('0x2e')]),_0x316931);if(_0x387517[_0x727a('0x2c')][_0x727a('0x38')]){_0x42195b[_0x727a('0x39')]=_[_0x727a('0x3a')](_0x42195b[_0x727a('0x39')],{'$or':_['map'](_0x316931,function(_0xa03611){if(_0xa03611[_0x727a('0x29')]!==_0x727a('0x3b')){var _0x494a8d={};_0x494a8d[_0xa03611['name']]={'$like':'%'+_0x387517[_0x727a('0x2c')][_0x727a('0x38')]+'%'};return _0x494a8d;}})});}_0x42195b=_['merge']({},_0x42195b,_0x387517[_0x727a('0x3c')]);var _0x375c35={'where':_0x42195b['where']};return db[_0x727a('0x3d')][_0x727a('0x1b')](_0x375c35)[_0x727a('0x22')](function(_0x10834b){_0x161302['count']=_0x10834b;if(_0x387517[_0x727a('0x2c')][_0x727a('0x3e')]){_0x42195b[_0x727a('0x3f')]=[{'all':!![]}];}return db[_0x727a('0x3d')][_0x727a('0x40')](_0x42195b);})[_0x727a('0x22')](function(_0x227c56){_0x161302['rows']=_0x227c56;return _0x161302;})['then'](respondWithFilteredResult(_0x2e1bdc,_0x42195b))[_0x727a('0x41')](handleError(_0x2e1bdc,null));};exports[_0x727a('0x42')]=function(_0x5b3af5,_0x4f1f58){var _0x4d2564={'raw':!![],'where':{'id':_0x5b3af5['params']['id']}},_0x46acdf={};_0x46acdf[_0x727a('0x2f')]=_[_0x727a('0x2d')](db[_0x727a('0x3d')][_0x727a('0x27')]);_0x46acdf[_0x727a('0x2c')]=_['keys'](_0x5b3af5[_0x727a('0x2c')]);_0x46acdf[_0x727a('0x2e')]=_['intersection'](_0x46acdf[_0x727a('0x2f')],_0x46acdf[_0x727a('0x2c')]);_0x4d2564[_0x727a('0x30')]=_[_0x727a('0x31')](_0x46acdf[_0x727a('0x2f')],qs[_0x727a('0x32')](_0x5b3af5[_0x727a('0x2c')][_0x727a('0x32')]));_0x4d2564['attributes']=_0x4d2564['attributes'][_0x727a('0x33')]?_0x4d2564[_0x727a('0x30')]:_0x46acdf[_0x727a('0x2f')];if(_0x5b3af5[_0x727a('0x2c')][_0x727a('0x3e')]){_0x4d2564['include']=[{'all':!![]}];}_0x4d2564=_[_0x727a('0x3a')]({},_0x4d2564,_0x5b3af5[_0x727a('0x3c')]);return db[_0x727a('0x3d')]['find'](_0x4d2564)[_0x727a('0x22')](handleEntityNotFound(_0x4f1f58,null))[_0x727a('0x22')](respondWithResult(_0x4f1f58,null))[_0x727a('0x41')](handleError(_0x4f1f58,null));};exports['create']=function(_0x512a3c,_0x3e6cdd){return db[_0x727a('0x3d')][_0x727a('0x43')](_0x512a3c['body'],{})[_0x727a('0x22')](respondWithResult(_0x3e6cdd,0xc9))[_0x727a('0x41')](handleError(_0x3e6cdd,null));};exports[_0x727a('0x21')]=function(_0x134a87,_0x5bb895){if(_0x134a87[_0x727a('0x44')]['id']){delete _0x134a87[_0x727a('0x44')]['id'];}return db[_0x727a('0x3d')]['find']({'where':{'id':_0x134a87[_0x727a('0x45')]['id']}})[_0x727a('0x22')](handleEntityNotFound(_0x5bb895,null))[_0x727a('0x22')](saveUpdates(_0x134a87[_0x727a('0x44')],null))[_0x727a('0x22')](respondWithResult(_0x5bb895,null))['catch'](handleError(_0x5bb895,null));};exports[_0x727a('0x46')]=function(_0x45f570,_0x51cb89){return db[_0x727a('0x3d')]['find']({'where':{'id':_0x45f570[_0x727a('0x45')]['id']}})[_0x727a('0x22')](handleEntityNotFound(_0x51cb89,null))['then'](removeEntity(_0x51cb89,null))['catch'](handleError(_0x51cb89,null));}; \ No newline at end of file +var _0xcf0e=['count','reject','update','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowField','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x3e534d,_0x34ebe6){var _0x5666c8=function(_0x1187b3){while(--_0x1187b3){_0x3e534d['push'](_0x3e534d['shift']());}};_0x5666c8(++_0x34ebe6);}(_0xcf0e,0x70));var _0xecf0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xcf0e[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0xecf0('0x0'));var rimraf=require(_0xecf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecf0('0x2'));var rp=require('request-promise');var moment=require(_0xecf0('0x3'));var BPromise=require(_0xecf0('0x4'));var Mustache=require(_0xecf0('0x5'));var util=require(_0xecf0('0x6'));var path=require(_0xecf0('0x7'));var sox=require('sox');var csv=require(_0xecf0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecf0('0x9'));var _=require(_0xecf0('0xa'));var squel=require(_0xecf0('0xb'));var crypto=require(_0xecf0('0xc'));var jsforce=require(_0xecf0('0xd'));var deskjs=require(_0xecf0('0xe'));var toCsv=require(_0xecf0('0x8'));var querystring=require('querystring');var Papa=require(_0xecf0('0xf'));var Redis=require(_0xecf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xecf0('0x11'));var as=require(_0xecf0('0x12'));var hardwareService=require(_0xecf0('0x13'));var logger=require('../../config/logger')(_0xecf0('0x14'));var utils=require(_0xecf0('0x15'));var config=require(_0xecf0('0x16'));var licenseUtil=require(_0xecf0('0x17'));var db=require(_0xecf0('0x18'))['db'];function respondWithStatusCode(_0x48d9e4,_0x266f93){_0x266f93=_0x266f93||0xcc;return function(_0x324897){if(_0x324897){return _0x48d9e4['sendStatus'](_0x266f93);}return _0x48d9e4[_0xecf0('0x19')](_0x266f93)['end']();};}function respondWithResult(_0x19f288,_0x4f3174){_0x4f3174=_0x4f3174||0xc8;return function(_0x1b08a0){if(_0x1b08a0){return _0x19f288[_0xecf0('0x19')](_0x4f3174)[_0xecf0('0x1a')](_0x1b08a0);}};}function respondWithFilteredResult(_0x88b7c,_0xd1ff1b){return function(_0x1f1af1){if(_0x1f1af1){var _0x4ffab2=typeof _0xd1ff1b[_0xecf0('0x1b')]===_0xecf0('0x1c')&&typeof _0xd1ff1b[_0xecf0('0x1d')]===_0xecf0('0x1c');var _0x58c184=_0x1f1af1['count'];var _0x5317b3=_0x4ffab2?0x0:_0xd1ff1b['offset'];var _0x2e490b=_0x4ffab2?_0x1f1af1[_0xecf0('0x1e')]:_0xd1ff1b['offset']+_0xd1ff1b[_0xecf0('0x1d')];var _0x4ff00c;if(_0x2e490b>=_0x58c184){_0x2e490b=_0x58c184;_0x4ff00c=0xc8;}else{_0x4ff00c=0xce;}_0x88b7c[_0xecf0('0x19')](_0x4ff00c);return _0x88b7c['set']('Content-Range',_0x5317b3+'-'+_0x2e490b+'/'+_0x58c184)[_0xecf0('0x1a')](_0x1f1af1);}return null;};}function patchUpdates(_0x1448f8){return function(_0x8890c5){try{jsonpatch['apply'](_0x8890c5,_0x1448f8,!![]);}catch(_0x1cb00){return BPromise[_0xecf0('0x1f')](_0x1cb00);}return _0x8890c5['save']();};}function saveUpdates(_0x35138f,_0x5c4fd7){return function(_0x4f724e){if(_0x4f724e){return _0x4f724e[_0xecf0('0x20')](_0x35138f)['then'](function(_0x32b77f){return _0x32b77f;});}return null;};}function removeEntity(_0x21d433,_0xdf5991){return function(_0x51f88b){if(_0x51f88b){return _0x51f88b['destroy']()[_0xecf0('0x21')](function(){_0x21d433['status'](0xcc)[_0xecf0('0x22')]();});}};}function handleEntityNotFound(_0x2c6f0b,_0xeb3784){return function(_0x430812){if(!_0x430812){_0x2c6f0b[_0xecf0('0x23')](0x194);}return _0x430812;};}function handleError(_0x551720,_0x1febba){_0x1febba=_0x1febba||0x1f4;return function(_0xc7631){logger[_0xecf0('0x24')](_0xc7631['stack']);if(_0xc7631['name']){delete _0xc7631[_0xecf0('0x25')];}_0x551720['status'](_0x1febba)['send'](_0xc7631);};}exports[_0xecf0('0x26')]=function(_0x41d36b,_0x3c1c7c){var _0x2a6afd={},_0xe61273={},_0x581e6d={'count':0x0,'rows':[]};var _0xa02551=_[_0xecf0('0x27')](db['ServicenowField'][_0xecf0('0x28')],function(_0x3b24e3){return{'name':_0x3b24e3[_0xecf0('0x29')],'type':_0x3b24e3[_0xecf0('0x2a')][_0xecf0('0x2b')]};});_0xe61273[_0xecf0('0x2c')]=_[_0xecf0('0x27')](_0xa02551,'name');_0xe61273[_0xecf0('0x2d')]=_['keys'](_0x41d36b[_0xecf0('0x2d')]);_0xe61273[_0xecf0('0x2e')]=_[_0xecf0('0x2f')](_0xe61273['model'],_0xe61273[_0xecf0('0x2d')]);_0x2a6afd[_0xecf0('0x30')]=_['intersection'](_0xe61273[_0xecf0('0x2c')],qs[_0xecf0('0x31')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x31')]));_0x2a6afd[_0xecf0('0x30')]=_0x2a6afd[_0xecf0('0x30')][_0xecf0('0x32')]?_0x2a6afd[_0xecf0('0x30')]:_0xe61273[_0xecf0('0x2c')];if(!_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x33')]('nolimit')){_0x2a6afd[_0xecf0('0x1d')]=qs[_0xecf0('0x1d')](_0x41d36b[_0xecf0('0x2d')]['limit']);_0x2a6afd['offset']=qs[_0xecf0('0x1b')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x1b')]);}_0x2a6afd['order']=qs[_0xecf0('0x34')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x34')]);_0x2a6afd[_0xecf0('0x35')]=qs[_0xecf0('0x2e')](_[_0xecf0('0x36')](_0x41d36b[_0xecf0('0x2d')],_0xe61273['filters']),_0xa02551);if(_0x41d36b[_0xecf0('0x2d')]['filter']){_0x2a6afd[_0xecf0('0x35')]=_['merge'](_0x2a6afd[_0xecf0('0x35')],{'$or':_[_0xecf0('0x27')](_0xa02551,function(_0x548b5a){if(_0x548b5a['type']!==_0xecf0('0x37')){var _0xb95d5c={};_0xb95d5c[_0x548b5a[_0xecf0('0x25')]]={'$like':'%'+_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x38')]+'%'};return _0xb95d5c;}})});}_0x2a6afd=_[_0xecf0('0x39')]({},_0x2a6afd,_0x41d36b[_0xecf0('0x3a')]);var _0x462a2d={'where':_0x2a6afd[_0xecf0('0x35')]};return db[_0xecf0('0x3b')][_0xecf0('0x1e')](_0x462a2d)[_0xecf0('0x21')](function(_0x261c35){_0x581e6d['count']=_0x261c35;if(_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x3c')]){_0x2a6afd[_0xecf0('0x3d')]=[{'all':!![]}];}return db[_0xecf0('0x3b')][_0xecf0('0x3e')](_0x2a6afd);})[_0xecf0('0x21')](function(_0x559d35){_0x581e6d['rows']=_0x559d35;return _0x581e6d;})[_0xecf0('0x21')](respondWithFilteredResult(_0x3c1c7c,_0x2a6afd))[_0xecf0('0x3f')](handleError(_0x3c1c7c,null));};exports[_0xecf0('0x40')]=function(_0x4f0464,_0x3dc441){var _0x487003={'raw':!![],'where':{'id':_0x4f0464[_0xecf0('0x41')]['id']}},_0x54d4e9={};_0x54d4e9['model']=_['keys'](db[_0xecf0('0x3b')][_0xecf0('0x28')]);_0x54d4e9['query']=_[_0xecf0('0x42')](_0x4f0464[_0xecf0('0x2d')]);_0x54d4e9['filters']=_['intersection'](_0x54d4e9[_0xecf0('0x2c')],_0x54d4e9['query']);_0x487003[_0xecf0('0x30')]=_[_0xecf0('0x2f')](_0x54d4e9[_0xecf0('0x2c')],qs[_0xecf0('0x31')](_0x4f0464[_0xecf0('0x2d')]['fields']));_0x487003[_0xecf0('0x30')]=_0x487003[_0xecf0('0x30')]['length']?_0x487003[_0xecf0('0x30')]:_0x54d4e9[_0xecf0('0x2c')];if(_0x4f0464[_0xecf0('0x2d')]['includeAll']){_0x487003[_0xecf0('0x3d')]=[{'all':!![]}];}_0x487003=_['merge']({},_0x487003,_0x4f0464['options']);return db['ServicenowField'][_0xecf0('0x43')](_0x487003)[_0xecf0('0x21')](handleEntityNotFound(_0x3dc441,null))[_0xecf0('0x21')](respondWithResult(_0x3dc441,null))[_0xecf0('0x3f')](handleError(_0x3dc441,null));};exports['create']=function(_0x4fc5a0,_0x531e6d){return db['ServicenowField'][_0xecf0('0x44')](_0x4fc5a0[_0xecf0('0x45')],{})[_0xecf0('0x21')](respondWithResult(_0x531e6d,0xc9))[_0xecf0('0x3f')](handleError(_0x531e6d,null));};exports['update']=function(_0x320eed,_0x1c9158){if(_0x320eed[_0xecf0('0x45')]['id']){delete _0x320eed['body']['id'];}return db[_0xecf0('0x3b')][_0xecf0('0x43')]({'where':{'id':_0x320eed[_0xecf0('0x41')]['id']}})[_0xecf0('0x21')](handleEntityNotFound(_0x1c9158,null))[_0xecf0('0x21')](saveUpdates(_0x320eed['body'],null))[_0xecf0('0x21')](respondWithResult(_0x1c9158,null))[_0xecf0('0x3f')](handleError(_0x1c9158,null));};exports[_0xecf0('0x46')]=function(_0x3d5c4e,_0x48eb04){return db[_0xecf0('0x3b')][_0xecf0('0x43')]({'where':{'id':_0x3d5c4e[_0xecf0('0x41')]['id']}})[_0xecf0('0x21')](handleEntityNotFound(_0x48eb04,null))[_0xecf0('0x21')](removeEntity(_0x48eb04,null))[_0xecf0('0x3f')](handleError(_0x48eb04,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 7aaf9d0..a3a9e05 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 _0x2ba1=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x39f8b4,_0x492452){var _0x2e8275=function(_0x189436){while(--_0x189436){_0x39f8b4['push'](_0x39f8b4['shift']());}};_0x2e8275(++_0x492452);}(_0x2ba1,0xa8));var _0x12ba=function(_0x3246a9,_0x49e5b6){_0x3246a9=_0x3246a9-0x0;var _0x7fcfc5=_0x2ba1[_0x3246a9];return _0x7fcfc5;};'use strict';var _=require(_0x12ba('0x0'));var util=require(_0x12ba('0x1'));var logger=require('../../config/logger')(_0x12ba('0x2'));var moment=require(_0x12ba('0x3'));var BPromise=require(_0x12ba('0x4'));var rp=require(_0x12ba('0x5'));var fs=require('fs');var path=require(_0x12ba('0x6'));var rimraf=require('rimraf');var config=require(_0x12ba('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x12ba('0x8')]=function(_0x324871,_0x2db68a){return _0x324871[_0x12ba('0x9')](_0x12ba('0xa'),attributes,{'tableName':_0x12ba('0xb'),'paranoid':![],'indexes':[{'name':_0x12ba('0xc'),'fields':[_0x12ba('0xd'),_0x12ba('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa54c=['bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','FieldId','../../config/logger','moment'];(function(_0x305473,_0x392471){var _0x4de111=function(_0x354e46){while(--_0x354e46){_0x305473['push'](_0x305473['shift']());}};_0x4de111(++_0x392471);}(_0xa54c,0x172));var _0xca54=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xa54c[_0x235482];return _0x5f5bea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca54('0x0'))('api');var moment=require(_0xca54('0x1'));var BPromise=require(_0xca54('0x2'));var rp=require(_0xca54('0x3'));var fs=require('fs');var path=require(_0xca54('0x4'));var rimraf=require(_0xca54('0x5'));var config=require('../../config/environment');var attributes=require(_0xca54('0x6'));module[_0xca54('0x7')]=function(_0x27d7a5,_0x26927c){return _0x27d7a5['define'](_0xca54('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xca54('0x9'),'fields':[_0xca54('0xa'),_0xca54('0xb')],'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 68d8c13..c9730a1 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x30463a,_0x154f4b){var _0x2b556b=function(_0x5b0207){while(--_0x5b0207){_0x30463a['push'](_0x30463a['shift']());}};_0x2b556b(++_0x154f4b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x38f050,_0x4b80de){_0x38f050=_0x38f050-0x0;var _0x1e03e1=_0x9ffd[_0x38f050];return _0x1e03e1;};'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']('ServicenowField,\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')]('ServicenowField,\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')]('ServicenowField,\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 +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5a3a40,_0x7d5c99){var _0x362cb9=function(_0x4c510c){while(--_0x4c510c){_0x5a3a40['push'](_0x5a3a40['shift']());}};_0x362cb9(++_0x7d5c99);}(_0x70e0,0x17b));var _0x070e=function(_0xc3c45a,_0x15d1da){_0xc3c45a=_0xc3c45a-0x0;var _0x4b5829=_0x70e0[_0xc3c45a];return _0x4b5829;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 303201b..810030b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2cf420,_0x2d9df0){var _0x45d73c=function(_0x19a347){while(--_0x19a347){_0x2cf420['push'](_0x2cf420['shift']());}};_0x45d73c(++_0x2d9df0);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4c01fd,_0x178a95){var _0x159d41=function(_0x2ee3e1){while(--_0x2ee3e1){_0x4c01fd['push'](_0x4c01fd['shift']());}};_0x159d41(++_0x178a95);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 282dfcb..d222fb6 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x36151f,_0x14bb59){var _0xb04487=function(_0x3060b8){while(--_0x3060b8){_0x36151f['push'](_0x36151f['shift']());}};_0xb04487(++_0x14bb59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x46dde1,_0x2e7e0c){var _0x2db19f=function(_0x32be00){while(--_0x32be00){_0x46dde1['push'](_0x46dde1['shift']());}};_0x2db19f(++_0x2e7e0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 57d4356..4ffd5b4 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 _0xd6b2=['POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','Calls','module_fields','remove','label','endsWith','values','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','fields','length','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring'];(function(_0x2baf85,_0x2a59a1){var _0x2ca44f=function(_0x4f3121){while(--_0x4f3121){_0x2baf85['push'](_0x2baf85['shift']());}};_0x2ca44f(++_0x2a59a1);}(_0xd6b2,0x18f));var _0x2d6b=function(_0x463167,_0x82bb2c){_0x463167=_0x463167-0x0;var _0x80b722=_0xd6b2[_0x463167];return _0x80b722;};'use strict';var emlformat=require(_0x2d6b('0x0'));var rimraf=require(_0x2d6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6b('0x2'));var rp=require('request-promise');var moment=require(_0x2d6b('0x3'));var BPromise=require(_0x2d6b('0x4'));var Mustache=require(_0x2d6b('0x5'));var util=require(_0x2d6b('0x6'));var path=require(_0x2d6b('0x7'));var sox=require(_0x2d6b('0x8'));var csv=require(_0x2d6b('0x9'));var ejs=require(_0x2d6b('0xa'));var fs=require('fs');var fs_extra=require(_0x2d6b('0xb'));var _=require('lodash');var squel=require(_0x2d6b('0xc'));var crypto=require(_0x2d6b('0xd'));var jsforce=require(_0x2d6b('0xe'));var deskjs=require(_0x2d6b('0xf'));var toCsv=require(_0x2d6b('0x9'));var querystring=require(_0x2d6b('0x10'));var Papa=require(_0x2d6b('0x11'));var Redis=require(_0x2d6b('0x12'));var authService=require(_0x2d6b('0x13'));var qs=require(_0x2d6b('0x14'));var as=require(_0x2d6b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d6b('0x16'))(_0x2d6b('0x17'));var utils=require(_0x2d6b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d6b('0x19'))['db'];var integrations=require(_0x2d6b('0x1a'));function respondWithStatusCode(_0x22d94e,_0x504096){_0x504096=_0x504096||0xcc;return function(_0x5d4e16){if(_0x5d4e16){return _0x22d94e[_0x2d6b('0x1b')](_0x504096);}return _0x22d94e[_0x2d6b('0x1c')](_0x504096)[_0x2d6b('0x1d')]();};}function respondWithResult(_0x951b7a,_0x4d7d9e){_0x4d7d9e=_0x4d7d9e||0xc8;return function(_0x3d2194){if(_0x3d2194){return _0x951b7a[_0x2d6b('0x1c')](_0x4d7d9e)[_0x2d6b('0x1e')](_0x3d2194);}};}function respondWithFilteredResult(_0x15da00,_0x4ab769){return function(_0x755167){if(_0x755167){var _0x57f56c=typeof _0x4ab769[_0x2d6b('0x1f')]==='undefined'&&typeof _0x4ab769[_0x2d6b('0x20')]===_0x2d6b('0x21');var _0x12e026=_0x755167[_0x2d6b('0x22')];var _0x18275b=_0x57f56c?0x0:_0x4ab769[_0x2d6b('0x1f')];var _0xcd0a4d=_0x57f56c?_0x755167[_0x2d6b('0x22')]:_0x4ab769[_0x2d6b('0x1f')]+_0x4ab769[_0x2d6b('0x20')];var _0x38a831;if(_0xcd0a4d>=_0x12e026){_0xcd0a4d=_0x12e026;_0x38a831=0xc8;}else{_0x38a831=0xce;}_0x15da00['status'](_0x38a831);return _0x15da00[_0x2d6b('0x23')]('Content-Range',_0x18275b+'-'+_0xcd0a4d+'/'+_0x12e026)[_0x2d6b('0x1e')](_0x755167);}return null;};}function patchUpdates(_0x921fd4){return function(_0x3cc943){try{jsonpatch[_0x2d6b('0x24')](_0x3cc943,_0x921fd4,!![]);}catch(_0x21e871){return BPromise[_0x2d6b('0x25')](_0x21e871);}return _0x3cc943[_0x2d6b('0x26')]();};}function saveUpdates(_0x23a671,_0x566697){return function(_0x4f9a6d){if(_0x4f9a6d){return _0x4f9a6d['update'](_0x23a671)['then'](function(_0x5b7412){return _0x5b7412;});}return null;};}function removeEntity(_0x37fdfe,_0x49885a){return function(_0x309991){if(_0x309991){return _0x309991[_0x2d6b('0x27')]()[_0x2d6b('0x28')](function(){_0x37fdfe[_0x2d6b('0x1c')](0xcc)[_0x2d6b('0x1d')]();});}};}function handleEntityNotFound(_0x179a91,_0x15c8c3){return function(_0x59fcee){if(!_0x59fcee){_0x179a91['sendStatus'](0x194);}return _0x59fcee;};}function handleError(_0x520c27,_0x2e4d3d){_0x2e4d3d=_0x2e4d3d||0x1f4;return function(_0x1105f6){logger[_0x2d6b('0x29')](_0x1105f6[_0x2d6b('0x2a')]);if(_0x1105f6[_0x2d6b('0x2b')]){delete _0x1105f6['name'];}_0x520c27[_0x2d6b('0x1c')](_0x2e4d3d)[_0x2d6b('0x2c')](_0x1105f6);};}exports[_0x2d6b('0x2d')]=function(_0x2598b2,_0x4578da){var _0x31bf1c={},_0x4e460b={},_0x21d571={'count':0x0,'rows':[]};var _0x58967a=_[_0x2d6b('0x2e')](db[_0x2d6b('0x2f')][_0x2d6b('0x30')],function(_0x255c6e){return{'name':_0x255c6e[_0x2d6b('0x31')],'type':_0x255c6e[_0x2d6b('0x32')][_0x2d6b('0x33')]};});_0x4e460b[_0x2d6b('0x34')]=_[_0x2d6b('0x2e')](_0x58967a,'name');_0x4e460b['query']=_[_0x2d6b('0x35')](_0x2598b2[_0x2d6b('0x36')]);_0x4e460b[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x4e460b[_0x2d6b('0x34')],_0x4e460b[_0x2d6b('0x36')]);_0x31bf1c[_0x2d6b('0x39')]=_['intersection'](_0x4e460b['model'],qs['fields'](_0x2598b2[_0x2d6b('0x36')]['fields']));_0x31bf1c['attributes']=_0x31bf1c['attributes']['length']?_0x31bf1c[_0x2d6b('0x39')]:_0x4e460b[_0x2d6b('0x34')];if(!_0x2598b2[_0x2d6b('0x36')]['hasOwnProperty'](_0x2d6b('0x3a'))){_0x31bf1c['limit']=qs[_0x2d6b('0x20')](_0x2598b2['query'][_0x2d6b('0x20')]);_0x31bf1c[_0x2d6b('0x1f')]=qs[_0x2d6b('0x1f')](_0x2598b2[_0x2d6b('0x36')]['offset']);}_0x31bf1c[_0x2d6b('0x3b')]=qs[_0x2d6b('0x3c')](_0x2598b2[_0x2d6b('0x36')][_0x2d6b('0x3c')]);_0x31bf1c[_0x2d6b('0x3d')]=qs[_0x2d6b('0x37')](_['pick'](_0x2598b2[_0x2d6b('0x36')],_0x4e460b[_0x2d6b('0x37')]),_0x58967a);if(_0x2598b2['query'][_0x2d6b('0x3e')]){_0x31bf1c[_0x2d6b('0x3d')]=_[_0x2d6b('0x3f')](_0x31bf1c[_0x2d6b('0x3d')],{'$or':_[_0x2d6b('0x2e')](_0x58967a,function(_0x349fe7){if(_0x349fe7[_0x2d6b('0x32')]!==_0x2d6b('0x40')){var _0x430651={};_0x430651[_0x349fe7[_0x2d6b('0x2b')]]={'$like':'%'+_0x2598b2[_0x2d6b('0x36')]['filter']+'%'};return _0x430651;}})});}_0x31bf1c=_[_0x2d6b('0x3f')]({},_0x31bf1c,_0x2598b2['options']);var _0x450579={'where':_0x31bf1c[_0x2d6b('0x3d')]};return db[_0x2d6b('0x2f')][_0x2d6b('0x22')](_0x450579)['then'](function(_0x2ef871){_0x21d571[_0x2d6b('0x22')]=_0x2ef871;if(_0x2598b2[_0x2d6b('0x36')][_0x2d6b('0x41')]){_0x31bf1c[_0x2d6b('0x42')]=[{'all':!![]}];}return db[_0x2d6b('0x2f')]['findAll'](_0x31bf1c);})[_0x2d6b('0x28')](function(_0x2a9b11){_0x21d571[_0x2d6b('0x43')]=_0x2a9b11;return _0x21d571;})['then'](respondWithFilteredResult(_0x4578da,_0x31bf1c))[_0x2d6b('0x44')](handleError(_0x4578da,null));};exports[_0x2d6b('0x45')]=function(_0x7b74ac,_0x239039){var _0x479153={'raw':![],'where':{'id':_0x7b74ac[_0x2d6b('0x46')]['id']}},_0x212809={};_0x212809[_0x2d6b('0x34')]=_['keys'](db[_0x2d6b('0x2f')][_0x2d6b('0x30')]);_0x212809[_0x2d6b('0x36')]=_[_0x2d6b('0x35')](_0x7b74ac[_0x2d6b('0x36')]);_0x212809[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x212809[_0x2d6b('0x34')],_0x212809[_0x2d6b('0x36')]);_0x479153[_0x2d6b('0x39')]=_[_0x2d6b('0x38')](_0x212809[_0x2d6b('0x34')],qs[_0x2d6b('0x47')](_0x7b74ac[_0x2d6b('0x36')][_0x2d6b('0x47')]));_0x479153[_0x2d6b('0x39')]=_0x479153[_0x2d6b('0x39')][_0x2d6b('0x48')]?_0x479153[_0x2d6b('0x39')]:_0x212809['model'];if(_0x7b74ac[_0x2d6b('0x36')][_0x2d6b('0x41')]){_0x479153['include']=[{'all':!![]}];}_0x479153=_['merge']({},_0x479153,_0x7b74ac[_0x2d6b('0x49')]);return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')](_0x479153)[_0x2d6b('0x28')](handleEntityNotFound(_0x239039,null))[_0x2d6b('0x28')](respondWithResult(_0x239039,null))[_0x2d6b('0x44')](handleError(_0x239039,null));};exports[_0x2d6b('0x4b')]=function(_0xdfe5b7,_0x4513e4){return db['SugarcrmAccount']['create'](_0xdfe5b7[_0x2d6b('0x4c')],{})['then'](respondWithResult(_0x4513e4,0xc9))[_0x2d6b('0x44')](handleError(_0x4513e4,null));};exports[_0x2d6b('0x4d')]=function(_0x139736,_0x19079b){if(_0x139736[_0x2d6b('0x4c')]['id']){delete _0x139736[_0x2d6b('0x4c')]['id'];}return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')]({'where':{'id':_0x139736[_0x2d6b('0x46')]['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x19079b,null))[_0x2d6b('0x28')](saveUpdates(_0x139736['body'],null))[_0x2d6b('0x28')](respondWithResult(_0x19079b,null))[_0x2d6b('0x44')](handleError(_0x19079b,null));};exports[_0x2d6b('0x27')]=function(_0x907a6c,_0x264a3b){return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')]({'where':{'id':_0x907a6c['params']['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x264a3b,null))[_0x2d6b('0x28')](removeEntity(_0x264a3b,null))[_0x2d6b('0x44')](handleError(_0x264a3b,null));};exports[_0x2d6b('0x4e')]=function(_0x47ab7c,_0x5292df,_0x5bde75){var _0x16d397={};var _0x537091={};var _0x1f18e7;var _0x4f2de7;return db[_0x2d6b('0x2f')][_0x2d6b('0x4f')]({'where':{'id':_0x47ab7c['params']['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x5292df,null))[_0x2d6b('0x28')](function(_0x3f0e00){if(_0x3f0e00){_0x1f18e7=_0x3f0e00;_0x537091['model']=_[_0x2d6b('0x35')](db[_0x2d6b('0x50')]['rawAttributes']);_0x537091[_0x2d6b('0x36')]=_['keys'](_0x47ab7c[_0x2d6b('0x36')]);_0x537091[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x537091[_0x2d6b('0x34')],_0x537091['query']);_0x16d397[_0x2d6b('0x39')]=_['intersection'](_0x537091['model'],qs['fields'](_0x47ab7c[_0x2d6b('0x36')]['fields']));_0x16d397[_0x2d6b('0x39')]=_0x16d397[_0x2d6b('0x39')][_0x2d6b('0x48')]?_0x16d397['attributes']:_0x537091[_0x2d6b('0x34')];_0x16d397[_0x2d6b('0x3b')]=qs['sort'](_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x3c')]);_0x16d397[_0x2d6b('0x3d')]=qs[_0x2d6b('0x37')](_[_0x2d6b('0x51')](_0x47ab7c[_0x2d6b('0x36')],_0x537091[_0x2d6b('0x37')]));if(_0x47ab7c['query'][_0x2d6b('0x3e')]){_0x16d397[_0x2d6b('0x3d')]=_['merge'](_0x16d397[_0x2d6b('0x3d')],{'$or':_[_0x2d6b('0x2e')](_0x16d397['attributes'],function(_0x2180ac){var _0x3b3ceb={};_0x3b3ceb[_0x2180ac]={'$like':'%'+_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x3e')]+'%'};return _0x3b3ceb;})});}_0x16d397=_[_0x2d6b('0x3f')]({},_0x16d397,_0x47ab7c[_0x2d6b('0x49')]);return _0x1f18e7['getConfigurations'](_0x16d397);}})['then'](function(_0xee1832){if(_0xee1832){_0x4f2de7=_0xee1832[_0x2d6b('0x48')];if(!_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x52')]('nolimit')){_0x16d397[_0x2d6b('0x20')]=qs['limit'](_0x47ab7c['query'][_0x2d6b('0x20')]);_0x16d397[_0x2d6b('0x1f')]=qs[_0x2d6b('0x1f')](_0x47ab7c[_0x2d6b('0x36')]['offset']);}return _0x1f18e7[_0x2d6b('0x4e')](_0x16d397);}})['then'](function(_0x4687e9){if(_0x4687e9){return _0x4687e9?{'count':_0x4f2de7,'rows':_0x4687e9}:null;}})['then'](respondWithResult(_0x5292df,null))[_0x2d6b('0x44')](handleError(_0x5292df,null));};exports[_0x2d6b('0x53')]=function(_0x2c5026,_0xc031c1,_0x44c22e){if(_0x2c5026[_0x2d6b('0x4c')]['id']){delete _0x2c5026['body']['id'];}return db[_0x2d6b('0x2f')][_0x2d6b('0x4f')]({'where':{'id':_0x2c5026[_0x2d6b('0x46')]['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0xc031c1,null))[_0x2d6b('0x28')](function(_0x5e2ffa){if(_0x5e2ffa){_0x2c5026['body'][_0x2d6b('0x54')]=_0x5e2ffa['id'];_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x55')]=integrations[_0x2d6b('0x56')](_0x2c5026['body'][_0x2d6b('0x57')],_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x32')]);_0x2c5026[_0x2d6b('0x4c')]['Descriptions']=integrations[_0x2d6b('0x58')](_0x2c5026['body'][_0x2d6b('0x57')],_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x32')]);return db['SugarcrmConfiguration'][_0x2d6b('0x4b')](_0x2c5026[_0x2d6b('0x4c')],{'include':[{'model':db[_0x2d6b('0x59')],'as':_0x2d6b('0x55')},{'model':db[_0x2d6b('0x59')],'as':_0x2d6b('0x5a')}]});}return null;})[_0x2d6b('0x28')](respondWithResult(_0xc031c1,null))[_0x2d6b('0x44')](handleError(_0xc031c1,null));};exports[_0x2d6b('0x5b')]=function(_0x1b92c9,_0x5aaaa3,_0x253743){var _0x26b225='';var _0x4a282b=['id',_0x2d6b('0x2b'),_0x2d6b('0x5c'),_0x2d6b('0x5d'),_0x2d6b('0x5e'),_0x2d6b('0x5f'),_0x2d6b('0x60'),_0x2d6b('0x61'),'parent_id',_0x2d6b('0x62'),_0x2d6b('0x63'),_0x2d6b('0x64')];return db['SugarcrmAccount'][_0x2d6b('0x4f')]({'where':{'id':_0x1b92c9[_0x2d6b('0x46')]['id']},'attributes':['id','username',_0x2d6b('0x65'),_0x2d6b('0x66')]})[_0x2d6b('0x28')](handleEntityNotFound(_0x5aaaa3,null))[_0x2d6b('0x28')](function(_0x39fbc1){if(_0x39fbc1){_0x26b225=_0x39fbc1[_0x2d6b('0x66')];var _0x3acde3=_0x26b225[_0x2d6b('0x67')](-0x1);if(_0x3acde3==='/'){_0x26b225=_0x26b225[_0x2d6b('0x68')](0x0,_0x26b225['lastIndexOf'](_0x3acde3));}return rp({'method':_0x2d6b('0x69'),'uri':util[_0x2d6b('0x6a')]('%s%s',_0x26b225,_0x2d6b('0x6b')),'json':!![],'form':{'method':_0x2d6b('0x6c'),'input_type':_0x2d6b('0x6d'),'response_type':'JSON','rest_data':JSON[_0x2d6b('0x6e')]({'user_auth':{'user_name':_0x39fbc1['username'],'password':_0x39fbc1['password'],'encryption':_0x2d6b('0x6f')},'application':_0x2d6b('0x70')})}});}})['then'](function(_0x52f8ed){if(_0x52f8ed&&_0x52f8ed[_0x2d6b('0x2b')]!==_0x2d6b('0x71')&&_0x52f8ed[_0x2d6b('0x2b')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x2d6b('0x6a')](_0x2d6b('0x72'),_0x26b225,_0x2d6b('0x6b')),'json':!![],'form':{'method':_0x2d6b('0x73'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2d6b('0x6e')]({'session':_0x52f8ed['id'],'module_name':_0x2d6b('0x74')})}})[_0x2d6b('0x28')](function(_0x353e67){if(_0x353e67){var _0x2d0ec0=_['values'](_0x353e67[_0x2d6b('0x75')]);_[_0x2d6b('0x76')](_0x2d0ec0,function(_0x452277){return _0x4a282b['includes'](_0x452277[_0x2d6b('0x2b')]);});return{'count':_0x2d0ec0['length'],'rows':_[_0x2d6b('0x2e')](_0x2d0ec0,function(_0x295b6c){return{'id':_0x295b6c[_0x2d6b('0x2b')],'name':_0x295b6c[_0x2d6b('0x77')],'custom':_[_0x2d6b('0x78')](_0x295b6c[_0x2d6b('0x2b')],'_c')?!![]:![],'options':_0x295b6c[_0x2d6b('0x49')]?_[_0x2d6b('0x2e')](_[_0x2d6b('0x79')](_0x295b6c[_0x2d6b('0x49')]),function(_0x431fe0){return{'name':_0x431fe0[_0x2d6b('0x7a')],'value':_0x431fe0[_0x2d6b('0x2b')]};}):[]};})};}})[_0x2d6b('0x28')](respondWithResult(_0x5aaaa3,null))['catch'](function(_0x43212f){var _0x24114f=_0x1b92c9['query'][_0x2d6b('0x7b')]?0x1f4:_0x43212f[_0x2d6b('0x7c')]||0x1f4;logger[_0x2d6b('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x24114f,JSON[_0x2d6b('0x6e')](_0x43212f));delete _0x43212f[_0x2d6b('0x2b')];if(_0x24114f===0x191){_0x24114f=0x190;}_0x5aaaa3['status'](_0x24114f)[_0x2d6b('0x2c')](_0x1b92c9[_0x2d6b('0x36')][_0x2d6b('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x43212f['statusCode']}:_0x43212f);});}else{var _0x5ef5dd=0x1f4;_0x5aaaa3[_0x2d6b('0x1c')](_0x5ef5dd)['send']({'message':_0x2d6b('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x801e=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x816b8d,_0x38a0c6){var _0x55e47c=function(_0x5c9769){while(--_0x5c9769){_0x816b8d['push'](_0x816b8d['shift']());}};_0x55e47c(++_0x38a0c6);}(_0x801e,0x15d));var _0xe801=function(_0x5c3a6b,_0x2a0d95){_0x5c3a6b=_0x5c3a6b-0x0;var _0x1cadef=_0x801e[_0x5c3a6b];return _0x1cadef;};'use strict';var emlformat=require(_0xe801('0x0'));var rimraf=require(_0xe801('0x1'));var zipdir=require(_0xe801('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe801('0x3'));var moment=require('moment');var BPromise=require(_0xe801('0x4'));var Mustache=require(_0xe801('0x5'));var util=require(_0xe801('0x6'));var path=require(_0xe801('0x7'));var sox=require(_0xe801('0x8'));var csv=require(_0xe801('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe801('0xa'));var _=require('lodash');var squel=require(_0xe801('0xb'));var crypto=require(_0xe801('0xc'));var jsforce=require(_0xe801('0xd'));var deskjs=require(_0xe801('0xe'));var toCsv=require(_0xe801('0x9'));var querystring=require(_0xe801('0xf'));var Papa=require('papaparse');var Redis=require(_0xe801('0x10'));var authService=require(_0xe801('0x11'));var qs=require(_0xe801('0x12'));var as=require(_0xe801('0x13'));var hardwareService=require(_0xe801('0x14'));var logger=require('../../config/logger')(_0xe801('0x15'));var utils=require('../../config/utils');var config=require(_0xe801('0x16'));var licenseUtil=require(_0xe801('0x17'));var db=require(_0xe801('0x18'))['db'];var integrations=require(_0xe801('0x19'));function respondWithStatusCode(_0x131757,_0x51847e){_0x51847e=_0x51847e||0xcc;return function(_0x266eff){if(_0x266eff){return _0x131757[_0xe801('0x1a')](_0x51847e);}return _0x131757[_0xe801('0x1b')](_0x51847e)['end']();};}function respondWithResult(_0x2f0879,_0x30418a){_0x30418a=_0x30418a||0xc8;return function(_0xa9bc48){if(_0xa9bc48){return _0x2f0879[_0xe801('0x1b')](_0x30418a)[_0xe801('0x1c')](_0xa9bc48);}};}function respondWithFilteredResult(_0x203256,_0x5a68fc){return function(_0x473935){if(_0x473935){var _0x45f49a=typeof _0x5a68fc[_0xe801('0x1d')]===_0xe801('0x1e')&&typeof _0x5a68fc[_0xe801('0x1f')]===_0xe801('0x1e');var _0x51bb06=_0x473935[_0xe801('0x20')];var _0x111ba9=_0x45f49a?0x0:_0x5a68fc[_0xe801('0x1d')];var _0x326519=_0x45f49a?_0x473935['count']:_0x5a68fc[_0xe801('0x1d')]+_0x5a68fc[_0xe801('0x1f')];var _0x1a5c29;if(_0x326519>=_0x51bb06){_0x326519=_0x51bb06;_0x1a5c29=0xc8;}else{_0x1a5c29=0xce;}_0x203256[_0xe801('0x1b')](_0x1a5c29);return _0x203256[_0xe801('0x21')](_0xe801('0x22'),_0x111ba9+'-'+_0x326519+'/'+_0x51bb06)['json'](_0x473935);}return null;};}function patchUpdates(_0x531510){return function(_0x48cf27){try{jsonpatch[_0xe801('0x23')](_0x48cf27,_0x531510,!![]);}catch(_0xb86fb6){return BPromise['reject'](_0xb86fb6);}return _0x48cf27[_0xe801('0x24')]();};}function saveUpdates(_0x5aca07,_0x33a2d4){return function(_0x57e3a4){if(_0x57e3a4){return _0x57e3a4[_0xe801('0x25')](_0x5aca07)[_0xe801('0x26')](function(_0x57dfa8){return _0x57dfa8;});}return null;};}function removeEntity(_0x47ad1b,_0x15d713){return function(_0x308f00){if(_0x308f00){return _0x308f00['destroy']()[_0xe801('0x26')](function(){_0x47ad1b[_0xe801('0x1b')](0xcc)[_0xe801('0x27')]();});}};}function handleEntityNotFound(_0x5ec908,_0x514c5e){return function(_0x3dbf64){if(!_0x3dbf64){_0x5ec908[_0xe801('0x1a')](0x194);}return _0x3dbf64;};}function handleError(_0x385a3c,_0x120134){_0x120134=_0x120134||0x1f4;return function(_0x3680f6){logger['error'](_0x3680f6[_0xe801('0x28')]);if(_0x3680f6['name']){delete _0x3680f6[_0xe801('0x29')];}_0x385a3c[_0xe801('0x1b')](_0x120134)[_0xe801('0x2a')](_0x3680f6);};}exports[_0xe801('0x2b')]=function(_0x4be325,_0x1b8a9a){var _0x4b12ea={},_0x21f0d5={},_0x547625={'count':0x0,'rows':[]};var _0x57d813=_[_0xe801('0x2c')](db[_0xe801('0x2d')][_0xe801('0x2e')],function(_0x4d2d1f){return{'name':_0x4d2d1f[_0xe801('0x2f')],'type':_0x4d2d1f['type'][_0xe801('0x30')]};});_0x21f0d5['model']=_[_0xe801('0x2c')](_0x57d813,_0xe801('0x29'));_0x21f0d5['query']=_[_0xe801('0x31')](_0x4be325[_0xe801('0x32')]);_0x21f0d5[_0xe801('0x33')]=_[_0xe801('0x34')](_0x21f0d5[_0xe801('0x35')],_0x21f0d5[_0xe801('0x32')]);_0x4b12ea[_0xe801('0x36')]=_[_0xe801('0x34')](_0x21f0d5[_0xe801('0x35')],qs[_0xe801('0x37')](_0x4be325[_0xe801('0x32')][_0xe801('0x37')]));_0x4b12ea[_0xe801('0x36')]=_0x4b12ea[_0xe801('0x36')]['length']?_0x4b12ea[_0xe801('0x36')]:_0x21f0d5[_0xe801('0x35')];if(!_0x4be325[_0xe801('0x32')][_0xe801('0x38')](_0xe801('0x39'))){_0x4b12ea['limit']=qs[_0xe801('0x1f')](_0x4be325['query'][_0xe801('0x1f')]);_0x4b12ea[_0xe801('0x1d')]=qs[_0xe801('0x1d')](_0x4be325[_0xe801('0x32')][_0xe801('0x1d')]);}_0x4b12ea['order']=qs[_0xe801('0x3a')](_0x4be325[_0xe801('0x32')][_0xe801('0x3a')]);_0x4b12ea['where']=qs['filters'](_[_0xe801('0x3b')](_0x4be325[_0xe801('0x32')],_0x21f0d5[_0xe801('0x33')]),_0x57d813);if(_0x4be325['query'][_0xe801('0x3c')]){_0x4b12ea[_0xe801('0x3d')]=_[_0xe801('0x3e')](_0x4b12ea['where'],{'$or':_[_0xe801('0x2c')](_0x57d813,function(_0x57a368){if(_0x57a368[_0xe801('0x3f')]!=='VIRTUAL'){var _0x475798={};_0x475798[_0x57a368[_0xe801('0x29')]]={'$like':'%'+_0x4be325[_0xe801('0x32')][_0xe801('0x3c')]+'%'};return _0x475798;}})});}_0x4b12ea=_['merge']({},_0x4b12ea,_0x4be325['options']);var _0x82d256={'where':_0x4b12ea['where']};return db[_0xe801('0x2d')]['count'](_0x82d256)['then'](function(_0x164763){_0x547625[_0xe801('0x20')]=_0x164763;if(_0x4be325[_0xe801('0x32')][_0xe801('0x40')]){_0x4b12ea[_0xe801('0x41')]=[{'all':!![]}];}return db[_0xe801('0x2d')][_0xe801('0x42')](_0x4b12ea);})['then'](function(_0x4fcaf6){_0x547625[_0xe801('0x43')]=_0x4fcaf6;return _0x547625;})['then'](respondWithFilteredResult(_0x1b8a9a,_0x4b12ea))[_0xe801('0x44')](handleError(_0x1b8a9a,null));};exports['show']=function(_0x33b9e8,_0x231095){var _0x17e56c={'raw':![],'where':{'id':_0x33b9e8[_0xe801('0x45')]['id']}},_0x22fe7f={};_0x22fe7f[_0xe801('0x35')]=_[_0xe801('0x31')](db[_0xe801('0x2d')][_0xe801('0x2e')]);_0x22fe7f[_0xe801('0x32')]=_[_0xe801('0x31')](_0x33b9e8[_0xe801('0x32')]);_0x22fe7f[_0xe801('0x33')]=_[_0xe801('0x34')](_0x22fe7f[_0xe801('0x35')],_0x22fe7f[_0xe801('0x32')]);_0x17e56c[_0xe801('0x36')]=_[_0xe801('0x34')](_0x22fe7f[_0xe801('0x35')],qs[_0xe801('0x37')](_0x33b9e8[_0xe801('0x32')][_0xe801('0x37')]));_0x17e56c[_0xe801('0x36')]=_0x17e56c['attributes'][_0xe801('0x46')]?_0x17e56c[_0xe801('0x36')]:_0x22fe7f[_0xe801('0x35')];if(_0x33b9e8[_0xe801('0x32')][_0xe801('0x40')]){_0x17e56c['include']=[{'all':!![]}];}_0x17e56c=_[_0xe801('0x3e')]({},_0x17e56c,_0x33b9e8[_0xe801('0x47')]);return db[_0xe801('0x2d')][_0xe801('0x48')](_0x17e56c)['then'](handleEntityNotFound(_0x231095,null))[_0xe801('0x26')](respondWithResult(_0x231095,null))['catch'](handleError(_0x231095,null));};exports['create']=function(_0x3a6ed9,_0x19db7d){return db[_0xe801('0x2d')][_0xe801('0x49')](_0x3a6ed9[_0xe801('0x4a')],{})[_0xe801('0x26')](respondWithResult(_0x19db7d,0xc9))[_0xe801('0x44')](handleError(_0x19db7d,null));};exports[_0xe801('0x25')]=function(_0x1d2a3e,_0x148442){if(_0x1d2a3e[_0xe801('0x4a')]['id']){delete _0x1d2a3e[_0xe801('0x4a')]['id'];}return db[_0xe801('0x2d')][_0xe801('0x48')]({'where':{'id':_0x1d2a3e['params']['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x148442,null))['then'](saveUpdates(_0x1d2a3e[_0xe801('0x4a')],null))['then'](respondWithResult(_0x148442,null))[_0xe801('0x44')](handleError(_0x148442,null));};exports[_0xe801('0x4b')]=function(_0x51a25c,_0x321f35){return db[_0xe801('0x2d')]['find']({'where':{'id':_0x51a25c[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x321f35,null))['then'](removeEntity(_0x321f35,null))['catch'](handleError(_0x321f35,null));};exports[_0xe801('0x4c')]=function(_0x4672ad,_0x3347a4,_0x1e4ded){var _0x362ca7={};var _0x4aac45={};var _0x1628ee;var _0x279e92;return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x4672ad[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x3347a4,null))[_0xe801('0x26')](function(_0x5123a5){if(_0x5123a5){_0x1628ee=_0x5123a5;_0x4aac45[_0xe801('0x35')]=_[_0xe801('0x31')](db[_0xe801('0x4e')][_0xe801('0x2e')]);_0x4aac45['query']=_[_0xe801('0x31')](_0x4672ad[_0xe801('0x32')]);_0x4aac45[_0xe801('0x33')]=_[_0xe801('0x34')](_0x4aac45['model'],_0x4aac45[_0xe801('0x32')]);_0x362ca7[_0xe801('0x36')]=_[_0xe801('0x34')](_0x4aac45['model'],qs[_0xe801('0x37')](_0x4672ad[_0xe801('0x32')][_0xe801('0x37')]));_0x362ca7[_0xe801('0x36')]=_0x362ca7[_0xe801('0x36')][_0xe801('0x46')]?_0x362ca7[_0xe801('0x36')]:_0x4aac45[_0xe801('0x35')];_0x362ca7[_0xe801('0x4f')]=qs[_0xe801('0x3a')](_0x4672ad[_0xe801('0x32')][_0xe801('0x3a')]);_0x362ca7[_0xe801('0x3d')]=qs['filters'](_[_0xe801('0x3b')](_0x4672ad[_0xe801('0x32')],_0x4aac45[_0xe801('0x33')]));if(_0x4672ad[_0xe801('0x32')]['filter']){_0x362ca7['where']=_[_0xe801('0x3e')](_0x362ca7[_0xe801('0x3d')],{'$or':_[_0xe801('0x2c')](_0x362ca7[_0xe801('0x36')],function(_0x3a553f){var _0x10077c={};_0x10077c[_0x3a553f]={'$like':'%'+_0x4672ad[_0xe801('0x32')][_0xe801('0x3c')]+'%'};return _0x10077c;})});}_0x362ca7=_['merge']({},_0x362ca7,_0x4672ad[_0xe801('0x47')]);return _0x1628ee[_0xe801('0x4c')](_0x362ca7);}})[_0xe801('0x26')](function(_0x374520){if(_0x374520){_0x279e92=_0x374520[_0xe801('0x46')];if(!_0x4672ad['query']['hasOwnProperty'](_0xe801('0x39'))){_0x362ca7[_0xe801('0x1f')]=qs[_0xe801('0x1f')](_0x4672ad[_0xe801('0x32')]['limit']);_0x362ca7['offset']=qs['offset'](_0x4672ad['query']['offset']);}return _0x1628ee[_0xe801('0x4c')](_0x362ca7);}})[_0xe801('0x26')](function(_0x9d635e){if(_0x9d635e){return _0x9d635e?{'count':_0x279e92,'rows':_0x9d635e}:null;}})[_0xe801('0x26')](respondWithResult(_0x3347a4,null))[_0xe801('0x44')](handleError(_0x3347a4,null));};exports[_0xe801('0x50')]=function(_0x317ca1,_0x536390,_0x3f5218){if(_0x317ca1[_0xe801('0x4a')]['id']){delete _0x317ca1[_0xe801('0x4a')]['id'];}return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x317ca1[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x536390,null))[_0xe801('0x26')](function(_0x352668){if(_0x352668){_0x317ca1['body'][_0xe801('0x51')]=_0x352668['id'];_0x317ca1[_0xe801('0x4a')][_0xe801('0x52')]=integrations[_0xe801('0x53')](_0x317ca1[_0xe801('0x4a')]['channel'],_0x317ca1[_0xe801('0x4a')][_0xe801('0x3f')]);_0x317ca1[_0xe801('0x4a')][_0xe801('0x54')]=integrations[_0xe801('0x55')](_0x317ca1[_0xe801('0x4a')][_0xe801('0x56')],_0x317ca1[_0xe801('0x4a')][_0xe801('0x3f')]);return db[_0xe801('0x4e')][_0xe801('0x49')](_0x317ca1[_0xe801('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0xe801('0x52')},{'model':db[_0xe801('0x57')],'as':_0xe801('0x54')}]});}return null;})[_0xe801('0x26')](respondWithResult(_0x536390,null))[_0xe801('0x44')](handleError(_0x536390,null));};exports[_0xe801('0x58')]=function(_0x1fb222,_0xe3de4e,_0x3f8f3e){var _0x2ac71c='';var _0x5359a5=['id',_0xe801('0x29'),_0xe801('0x59'),'created_by',_0xe801('0x5a'),_0xe801('0x5b'),_0xe801('0x5c'),'duration_minutes','parent_id','parent_type',_0xe801('0x5d'),_0xe801('0x5e')];return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x1fb222['params']['id']},'attributes':['id',_0xe801('0x5f'),_0xe801('0x60'),_0xe801('0x61')]})[_0xe801('0x26')](handleEntityNotFound(_0xe3de4e,null))['then'](function(_0x2a39c1){if(_0x2a39c1){_0x2ac71c=_0x2a39c1[_0xe801('0x61')];var _0x215501=_0x2ac71c[_0xe801('0x62')](-0x1);if(_0x215501==='/'){_0x2ac71c=_0x2ac71c[_0xe801('0x63')](0x0,_0x2ac71c[_0xe801('0x64')](_0x215501));}return rp({'method':_0xe801('0x65'),'uri':util[_0xe801('0x66')](_0xe801('0x67'),_0x2ac71c,_0xe801('0x68')),'json':!![],'form':{'method':_0xe801('0x69'),'input_type':'JSON','response_type':_0xe801('0x6a'),'rest_data':JSON[_0xe801('0x6b')]({'user_auth':{'user_name':_0x2a39c1[_0xe801('0x5f')],'password':_0x2a39c1[_0xe801('0x60')],'encryption':_0xe801('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe801('0x26')](function(_0x48017c){if(_0x48017c&&_0x48017c['name']!==_0xe801('0x6d')&&_0x48017c['name']!==_0xe801('0x6e')){return rp({'method':_0xe801('0x65'),'uri':util['format'](_0xe801('0x67'),_0x2ac71c,_0xe801('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe801('0x6a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x48017c['id'],'module_name':_0xe801('0x6f')})}})[_0xe801('0x26')](function(_0x276907){if(_0x276907){var _0x39f19e=_['values'](_0x276907[_0xe801('0x70')]);_[_0xe801('0x71')](_0x39f19e,function(_0x39d86f){return _0x5359a5[_0xe801('0x72')](_0x39d86f[_0xe801('0x29')]);});return{'count':_0x39f19e[_0xe801('0x46')],'rows':_['map'](_0x39f19e,function(_0x1b8ec3){return{'id':_0x1b8ec3[_0xe801('0x29')],'name':_0x1b8ec3[_0xe801('0x73')],'custom':_[_0xe801('0x74')](_0x1b8ec3[_0xe801('0x29')],'_c')?!![]:![],'options':_0x1b8ec3['options']?_['map'](_[_0xe801('0x75')](_0x1b8ec3[_0xe801('0x47')]),function(_0x1025b8){return{'name':_0x1025b8[_0xe801('0x76')],'value':_0x1025b8[_0xe801('0x29')]};}):[]};})};}})['then'](respondWithResult(_0xe3de4e,null))[_0xe801('0x44')](function(_0x1dff54){var _0x440f4d=_0x1fb222[_0xe801('0x32')][_0xe801('0x77')]?0x1f4:_0x1dff54[_0xe801('0x78')]||0x1f4;logger[_0xe801('0x79')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x440f4d,JSON[_0xe801('0x6b')](_0x1dff54));delete _0x1dff54[_0xe801('0x29')];if(_0x440f4d===0x191){_0x440f4d=0x190;}_0xe3de4e['status'](_0x440f4d)['send'](_0x1fb222[_0xe801('0x32')][_0xe801('0x77')]?{'message':_0xe801('0x7a'),'statusCode':_0x1dff54[_0xe801('0x78')]}:_0x1dff54);});}else{var _0x376a58=0x1f4;_0xe3de4e['status'](_0x376a58)[_0xe801('0x2a')]({'message':_0xe801('0x7a'),'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 b14293c..7a26ef5 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 _0x9dbf=['api','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x116b52,_0x503a4b){var _0x3793e2=function(_0x5159ed){while(--_0x5159ed){_0x116b52['push'](_0x116b52['shift']());}};_0x3793e2(++_0x503a4b);}(_0x9dbf,0x1ab));var _0xf9db=function(_0x46782d,_0x144988){_0x46782d=_0x46782d-0x0;var _0x21da92=_0x9dbf[_0x46782d];return _0x21da92;};'use strict';var _=require('lodash');var util=require(_0xf9db('0x0'));var logger=require(_0xf9db('0x1'))(_0xf9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9db('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9db('0x4'));var config=require(_0xf9db('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf9db('0x6'));module[_0xf9db('0x7')]=function(_0x3c6011,_0xb20b42){return _0x3c6011[_0xf9db('0x8')](_0xf9db('0x9'),attributes,{'tableName':_0xf9db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66d4=['bluebird','request-promise','path','./intSugarcrmAccount.attributes','exports','define','util','api','moment'];(function(_0x306481,_0x20527a){var _0x33d816=function(_0x4fee0e){while(--_0x4fee0e){_0x306481['push'](_0x306481['shift']());}};_0x33d816(++_0x20527a);}(_0x66d4,0x10b));var _0x466d=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x66d4[_0x54c9dd];return _0x855156;};'use strict';var _=require('lodash');var util=require(_0x466d('0x0'));var logger=require('../../config/logger')(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require(_0x466d('0x3'));var rp=require(_0x466d('0x4'));var fs=require('fs');var path=require(_0x466d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x466d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x466d('0x7')]=function(_0x201317,_0x3c00e6){return _0x201317[_0x466d('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 19434f4..3e0a727 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 _0xa0f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowSugarcrmAccount','find','moment'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa0f5,0x180));var _0x5a0f=function(_0x593d08,_0x124ecc){_0x593d08=_0x593d08-0x0;var _0x48eab9=_0xa0f5[_0x593d08];return _0x48eab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a0f('0x0'));var BPromise=require(_0x5a0f('0x1'));var rs=require(_0x5a0f('0x2'));var fs=require('fs');var Redis=require(_0x5a0f('0x3'));var db=require(_0x5a0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a0f('0x5'))(_0x5a0f('0x6'));var config=require(_0x5a0f('0x7'));var jayson=require(_0x5a0f('0x8'));var client=jayson[_0x5a0f('0x9')][_0x5a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf59e12,_0x5d1ac3,_0x405011){return new BPromise(function(_0x351637,_0x38c5fc){return client[_0x5a0f('0xb')](_0xf59e12,_0x405011)[_0x5a0f('0xc')](function(_0x3b1afe){logger[_0x5a0f('0xd')](_0x5a0f('0xe'),_0x5d1ac3,_0x5a0f('0xf'));logger[_0x5a0f('0x10')](_0x5a0f('0x11'),_0x5d1ac3,_0x5a0f('0xf'),JSON['stringify'](_0x3b1afe));if(_0x3b1afe[_0x5a0f('0x12')]){if(_0x3b1afe[_0x5a0f('0x12')]['code']===0x1f4){logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x3b1afe['error'][_0x5a0f('0x13')]);return _0x38c5fc(_0x3b1afe[_0x5a0f('0x12')][_0x5a0f('0x13')]);}logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x3b1afe['error'][_0x5a0f('0x13')]);return _0x351637(_0x3b1afe[_0x5a0f('0x12')][_0x5a0f('0x13')]);}else{logger['info'](_0x5a0f('0xe'),_0x5d1ac3,_0x5a0f('0xf'));_0x351637(_0x3b1afe[_0x5a0f('0x14')][_0x5a0f('0x13')]);}})[_0x5a0f('0x15')](function(_0x273494){logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x273494);_0x38c5fc(_0x273494);});});}exports[_0x5a0f('0x16')]=function(_0x3b19f3){var _0x4f9090=this;return new Promise(function(_0x3620c8,_0x4432b9){return db[_0x5a0f('0x17')][_0x5a0f('0x18')]({'raw':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1b')]||null:null,'attributes':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1c')]||null:null,'limit':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')]['limit']||null:null,'include':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3['options'][_0x5a0f('0x1d')]?_['map'](_0x3b19f3['options'][_0x5a0f('0x1d')],function(_0xac811b){return{'model':db[_0xac811b['model']],'as':_0xac811b['as'],'attributes':_0xac811b[_0x5a0f('0x1c')],'include':_0xac811b[_0x5a0f('0x1d')]?_[_0x5a0f('0x1e')](_0xac811b[_0x5a0f('0x1d')],function(_0x2832b2){return{'model':db[_0x2832b2['model']],'as':_0x2832b2['as'],'attributes':_0x2832b2[_0x5a0f('0x1c')],'include':_0x2832b2[_0x5a0f('0x1d')]?_['map'](_0x2832b2[_0x5a0f('0x1d')],function(_0x16f5d3){return{'model':db[_0x16f5d3[_0x5a0f('0x1f')]],'as':_0x16f5d3['as'],'attributes':_0x16f5d3[_0x5a0f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42b0cf){logger[_0x5a0f('0xd')](_0x5a0f('0x16'),_0x3b19f3);logger[_0x5a0f('0x10')](_0x5a0f('0x16'),_0x3b19f3,JSON[_0x5a0f('0x20')](_0x42b0cf));_0x3620c8(_0x42b0cf);})['catch'](function(_0x241525){logger['error'](_0x5a0f('0x16'),_0x241525[_0x5a0f('0x13')],_0x3b19f3);_0x4432b9(_0x4f9090[_0x5a0f('0x12')](0x1f4,_0x241525[_0x5a0f('0x13')]));});});};exports[_0x5a0f('0x21')]=function(_0x10680c){var _0x4fee69=this;return new Promise(function(_0x3fbc85,_0x5dfb86){return db[_0x5a0f('0x17')][_0x5a0f('0x22')]({'raw':_0x10680c[_0x5a0f('0x19')]?_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x10680c['options']?_0x10680c[_0x5a0f('0x19')]['where']||null:null,'attributes':_0x10680c[_0x5a0f('0x19')]?_0x10680c['options']['attributes']||null:null,'include':_0x10680c[_0x5a0f('0x19')]?_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1d')]?_[_0x5a0f('0x1e')](_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1d')],function(_0x320674){return{'model':db[_0x320674['model']],'as':_0x320674['as'],'attributes':_0x320674['attributes'],'include':_0x320674[_0x5a0f('0x1d')]?_['map'](_0x320674[_0x5a0f('0x1d')],function(_0x158d43){return{'model':db[_0x158d43[_0x5a0f('0x1f')]],'as':_0x158d43['as'],'attributes':_0x158d43[_0x5a0f('0x1c')],'include':_0x158d43['include']?_[_0x5a0f('0x1e')](_0x158d43[_0x5a0f('0x1d')],function(_0x1fb82d){return{'model':db[_0x1fb82d[_0x5a0f('0x1f')]],'as':_0x1fb82d['as'],'attributes':_0x1fb82d[_0x5a0f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5a0f('0xc')](function(_0x2ed3d4){logger[_0x5a0f('0xd')](_0x5a0f('0x21'),_0x10680c);logger['debug'](_0x5a0f('0x21'),_0x10680c,JSON[_0x5a0f('0x20')](_0x2ed3d4));_0x3fbc85(_0x2ed3d4);})[_0x5a0f('0x15')](function(_0x758655){logger[_0x5a0f('0x12')](_0x5a0f('0x21'),_0x758655[_0x5a0f('0x13')],_0x10680c);_0x5dfb86(_0x4fee69[_0x5a0f('0x12')](0x1f4,_0x758655[_0x5a0f('0x13')]));});});}; \ No newline at end of file +var _0x047b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','attributes','limit','model','include','map','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','randomstring'];(function(_0x19a54f,_0x1429df){var _0x22729f=function(_0x2f3f2a){while(--_0x2f3f2a){_0x19a54f['push'](_0x19a54f['shift']());}};_0x22729f(++_0x1429df);}(_0x047b,0x64));var _0xb047=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x047b[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xb047('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb047('0x1'));var fs=require('fs');var Redis=require(_0xb047('0x2'));var db=require(_0xb047('0x3'))['db'];var utils=require(_0xb047('0x4'));var logger=require(_0xb047('0x5'))(_0xb047('0x6'));var config=require(_0xb047('0x7'));var jayson=require(_0xb047('0x8'));var client=jayson[_0xb047('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32a32b,_0x27bd7b,_0x508766){return new BPromise(function(_0x215dc8,_0x2a9df1){return client[_0xb047('0xa')](_0x32a32b,_0x508766)[_0xb047('0xb')](function(_0x3f5947){logger[_0xb047('0xc')](_0xb047('0xd'),_0x27bd7b,_0xb047('0xe'));logger[_0xb047('0xf')](_0xb047('0x10'),_0x27bd7b,'request\x20sent',JSON[_0xb047('0x11')](_0x3f5947));if(_0x3f5947[_0xb047('0x12')]){if(_0x3f5947[_0xb047('0x12')][_0xb047('0x13')]===0x1f4){logger[_0xb047('0x12')](_0xb047('0xd'),_0x27bd7b,_0x3f5947[_0xb047('0x12')]['message']);return _0x2a9df1(_0x3f5947[_0xb047('0x12')]['message']);}logger[_0xb047('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x27bd7b,_0x3f5947[_0xb047('0x12')]['message']);return _0x215dc8(_0x3f5947[_0xb047('0x12')][_0xb047('0x14')]);}else{logger[_0xb047('0xc')](_0xb047('0xd'),_0x27bd7b,_0xb047('0xe'));_0x215dc8(_0x3f5947['result'][_0xb047('0x14')]);}})[_0xb047('0x15')](function(_0x2cd3ae){logger[_0xb047('0x12')](_0xb047('0xd'),_0x27bd7b,_0x2cd3ae);_0x2a9df1(_0x2cd3ae);});});}exports['GetSugarcrmAccount']=function(_0x35c01f){var _0x49bd0d=this;return new Promise(function(_0x1cf1c7,_0x337abc){return db['SugarcrmAccount']['findAll']({'raw':_0x35c01f['options']?_0x35c01f[_0xb047('0x16')][_0xb047('0x17')]===undefined?!![]:![]:!![],'where':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options']['where']||null:null,'attributes':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options'][_0xb047('0x18')]||null:null,'limit':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options'][_0xb047('0x19')]||null:null,'include':_0x35c01f['options']?_0x35c01f['options']['include']?_['map'](_0x35c01f[_0xb047('0x16')]['include'],function(_0x2dd628){return{'model':db[_0x2dd628[_0xb047('0x1a')]],'as':_0x2dd628['as'],'attributes':_0x2dd628[_0xb047('0x18')],'include':_0x2dd628[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0x2dd628[_0xb047('0x1b')],function(_0xee53fe){return{'model':db[_0xee53fe[_0xb047('0x1a')]],'as':_0xee53fe['as'],'attributes':_0xee53fe[_0xb047('0x18')],'include':_0xee53fe[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0xee53fe[_0xb047('0x1b')],function(_0x427b74){return{'model':db[_0x427b74[_0xb047('0x1a')]],'as':_0x427b74['as'],'attributes':_0x427b74[_0xb047('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa4b3ad){logger[_0xb047('0xc')](_0xb047('0x1d'),_0x35c01f);logger[_0xb047('0xf')]('GetSugarcrmAccount',_0x35c01f,JSON['stringify'](_0xa4b3ad));_0x1cf1c7(_0xa4b3ad);})[_0xb047('0x15')](function(_0x4c13eb){logger[_0xb047('0x12')]('GetSugarcrmAccount',_0x4c13eb[_0xb047('0x14')],_0x35c01f);_0x337abc(_0x49bd0d[_0xb047('0x12')](0x1f4,_0x4c13eb[_0xb047('0x14')]));});});};exports[_0xb047('0x1e')]=function(_0xa803e1){var _0x4dd620=this;return new Promise(function(_0x3adc4c,_0x46919a){return db[_0xb047('0x1f')][_0xb047('0x20')]({'raw':_0xa803e1['options']?_0xa803e1['options'][_0xb047('0x17')]===undefined?!![]:![]:!![],'where':_0xa803e1['options']?_0xa803e1[_0xb047('0x16')][_0xb047('0x21')]||null:null,'attributes':_0xa803e1[_0xb047('0x16')]?_0xa803e1[_0xb047('0x16')]['attributes']||null:null,'include':_0xa803e1[_0xb047('0x16')]?_0xa803e1[_0xb047('0x16')][_0xb047('0x1b')]?_[_0xb047('0x1c')](_0xa803e1[_0xb047('0x16')][_0xb047('0x1b')],function(_0x2ee5ea){return{'model':db[_0x2ee5ea[_0xb047('0x1a')]],'as':_0x2ee5ea['as'],'attributes':_0x2ee5ea['attributes'],'include':_0x2ee5ea[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0x2ee5ea[_0xb047('0x1b')],function(_0x591582){return{'model':db[_0x591582['model']],'as':_0x591582['as'],'attributes':_0x591582[_0xb047('0x18')],'include':_0x591582[_0xb047('0x1b')]?_['map'](_0x591582[_0xb047('0x1b')],function(_0x55f056){return{'model':db[_0x55f056[_0xb047('0x1a')]],'as':_0x55f056['as'],'attributes':_0x55f056['attributes']};}):[]};}):[]};}):[]:[]})[_0xb047('0xb')](function(_0x46d06){logger[_0xb047('0xc')](_0xb047('0x1e'),_0xa803e1);logger['debug'](_0xb047('0x1e'),_0xa803e1,JSON[_0xb047('0x11')](_0x46d06));_0x3adc4c(_0x46d06);})[_0xb047('0x15')](function(_0x3a3e00){logger[_0xb047('0x12')](_0xb047('0x1e'),_0x3a3e00[_0xb047('0x14')],_0xa803e1);_0x46919a(_0x4dd620['error'](0x1f4,_0x3a3e00['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4eba59c..bba6d3c 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 _0x2593=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports'];(function(_0x44774d,_0x27fe98){var _0x282b23=function(_0x3b05d4){while(--_0x3b05d4){_0x44774d['push'](_0x44774d['shift']());}};_0x282b23(++_0x27fe98);}(_0x2593,0x7d));var _0x3259=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x2593[_0xa1e3ca];return _0x5005ab;};'use strict';var multer=require(_0x3259('0x0'));var util=require(_0x3259('0x1'));var path=require('path');var timeout=require(_0x3259('0x2'));var express=require(_0x3259('0x3'));var router=express[_0x3259('0x4')]();var fs_extra=require(_0x3259('0x5'));var auth=require(_0x3259('0x6'));var interaction=require(_0x3259('0x7'));var config=require(_0x3259('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x3259('0x9')]('/',auth[_0x3259('0xa')](),controller[_0x3259('0xb')]);router[_0x3259('0x9')](_0x3259('0xc'),auth['isAuthenticated'](),controller[_0x3259('0xd')]);router['get'](_0x3259('0xe'),auth['isAuthenticated'](),controller[_0x3259('0xf')]);router['get'](_0x3259('0x10'),auth[_0x3259('0xa')](),controller[_0x3259('0x11')]);router[_0x3259('0x9')](_0x3259('0x12'),auth[_0x3259('0xa')](),controller[_0x3259('0x13')]);router[_0x3259('0x14')]('/',auth[_0x3259('0xa')](),controller['create']);router[_0x3259('0x15')](_0x3259('0xc'),auth[_0x3259('0xa')](),controller[_0x3259('0x16')]);router['delete']('/:id',auth[_0x3259('0xa')](),controller[_0x3259('0x17')]);module[_0x3259('0x18')]=router; \ No newline at end of file +var _0xefe2=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x37b9ab,_0x8cdef0){var _0x2b2115=function(_0x19f6b9){while(--_0x19f6b9){_0x37b9ab['push'](_0x37b9ab['shift']());}};_0x2b2115(++_0x8cdef0);}(_0xefe2,0xe6));var _0x2efe=function(_0x3bb942,_0xd54c44){_0x3bb942=_0x3bb942-0x0;var _0x2c9be2=_0xefe2[_0x3bb942];return _0x2c9be2;};'use strict';var multer=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var path=require(_0x2efe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2efe('0x3'));var router=express[_0x2efe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2efe('0x5'));var interaction=require(_0x2efe('0x6'));var config=require(_0x2efe('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x2efe('0x8')]('/',auth[_0x2efe('0x9')](),controller[_0x2efe('0xa')]);router[_0x2efe('0x8')](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller[_0x2efe('0xc')]);router[_0x2efe('0x8')]('/:id/fields',auth[_0x2efe('0x9')](),controller[_0x2efe('0xd')]);router['get'](_0x2efe('0xe'),auth[_0x2efe('0x9')](),controller[_0x2efe('0xf')]);router[_0x2efe('0x8')](_0x2efe('0x10'),auth[_0x2efe('0x9')](),controller[_0x2efe('0x11')]);router[_0x2efe('0x12')]('/',auth[_0x2efe('0x9')](),controller[_0x2efe('0x13')]);router['put'](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller[_0x2efe('0x14')]);router['delete'](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller['destroy']);module[_0x2efe('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 903b101..04f9560 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 _0xa585=['exports','STRING','sequelize'];(function(_0x28035f,_0x294b64){var _0xfdb879=function(_0x4d24cf){while(--_0x4d24cf){_0x28035f['push'](_0x28035f['shift']());}};_0xfdb879(++_0x294b64);}(_0xa585,0xa7));var _0x5a58=function(_0x2408cc,_0x394561){_0x2408cc=_0x2408cc-0x0;var _0x22174d=_0xa585[_0x2408cc];return _0x22174d;};'use strict';var Sequelize=require(_0x5a58('0x0'));module[_0x5a58('0x1')]={'name':{'type':Sequelize[_0x5a58('0x2')]},'description':{'type':Sequelize[_0x5a58('0x2')]}}; \ No newline at end of file +var _0xa09b=['STRING','sequelize','exports'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xa09b,0x1c6));var _0xba09=function(_0x5d8ef7,_0x5373aa){_0x5d8ef7=_0x5d8ef7-0x0;var _0x5c35d6=_0xa09b[_0x5d8ef7];return _0x5c35d6;};'use strict';var Sequelize=require(_0xba09('0x0'));module[_0xba09('0x1')]={'name':{'type':Sequelize[_0xba09('0x2')]},'description':{'type':Sequelize[_0xba09('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c1511dd..117b0f8 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 _0x5ae9=['sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x58a2c4,_0xd7a4ce){var _0x3f9068=function(_0x133740){while(--_0x133740){_0x58a2c4['push'](_0x58a2c4['shift']());}};_0x3f9068(++_0xd7a4ce);}(_0x5ae9,0xc6));var _0x95ae=function(_0x3c719e,_0x19719d){_0x3c719e=_0x3c719e-0x0;var _0x2d09af=_0x5ae9[_0x3c719e];return _0x2d09af;};'use strict';var emlformat=require(_0x95ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95ae('0x1'));var jsonpatch=require(_0x95ae('0x2'));var rp=require(_0x95ae('0x3'));var moment=require(_0x95ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x95ae('0x5'));var util=require(_0x95ae('0x6'));var path=require(_0x95ae('0x7'));var sox=require(_0x95ae('0x8'));var csv=require(_0x95ae('0x9'));var ejs=require(_0x95ae('0xa'));var fs=require('fs');var fs_extra=require(_0x95ae('0xb'));var _=require(_0x95ae('0xc'));var squel=require(_0x95ae('0xd'));var crypto=require(_0x95ae('0xe'));var jsforce=require(_0x95ae('0xf'));var deskjs=require(_0x95ae('0x10'));var toCsv=require('to-csv');var querystring=require(_0x95ae('0x11'));var Papa=require(_0x95ae('0x12'));var Redis=require(_0x95ae('0x13'));var authService=require(_0x95ae('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95ae('0x15'));var logger=require(_0x95ae('0x16'))(_0x95ae('0x17'));var utils=require(_0x95ae('0x18'));var config=require(_0x95ae('0x19'));var licenseUtil=require(_0x95ae('0x1a'));var db=require(_0x95ae('0x1b'))['db'];function respondWithStatusCode(_0x24cb9f,_0x32f55a){_0x32f55a=_0x32f55a||0xcc;return function(_0x2d71a9){if(_0x2d71a9){return _0x24cb9f[_0x95ae('0x1c')](_0x32f55a);}return _0x24cb9f[_0x95ae('0x1d')](_0x32f55a)[_0x95ae('0x1e')]();};}function respondWithResult(_0x4750c2,_0x2092cd){_0x2092cd=_0x2092cd||0xc8;return function(_0xffc87d){if(_0xffc87d){return _0x4750c2[_0x95ae('0x1d')](_0x2092cd)[_0x95ae('0x1f')](_0xffc87d);}};}function respondWithFilteredResult(_0x364c22,_0x3992e2){return function(_0x4f538e){if(_0x4f538e){var _0x3d3ab6=typeof _0x3992e2[_0x95ae('0x20')]===_0x95ae('0x21')&&typeof _0x3992e2['limit']===_0x95ae('0x21');var _0xe93f22=_0x4f538e[_0x95ae('0x22')];var _0x44e69f=_0x3d3ab6?0x0:_0x3992e2[_0x95ae('0x20')];var _0x194ee8=_0x3d3ab6?_0x4f538e[_0x95ae('0x22')]:_0x3992e2[_0x95ae('0x20')]+_0x3992e2[_0x95ae('0x23')];var _0x4dd485;if(_0x194ee8>=_0xe93f22){_0x194ee8=_0xe93f22;_0x4dd485=0xc8;}else{_0x4dd485=0xce;}_0x364c22['status'](_0x4dd485);return _0x364c22[_0x95ae('0x24')](_0x95ae('0x25'),_0x44e69f+'-'+_0x194ee8+'/'+_0xe93f22)['json'](_0x4f538e);}return null;};}function patchUpdates(_0x1d250e){return function(_0x431994){try{jsonpatch[_0x95ae('0x26')](_0x431994,_0x1d250e,!![]);}catch(_0x15f092){return BPromise['reject'](_0x15f092);}return _0x431994[_0x95ae('0x27')]();};}function saveUpdates(_0x5c00bb,_0x7622d5){return function(_0x1098be){if(_0x1098be){return _0x1098be['update'](_0x5c00bb)['then'](function(_0x5d4e94){return _0x5d4e94;});}return null;};}function removeEntity(_0x1c1545,_0xd9c5ea){return function(_0x4dcf17){if(_0x4dcf17){return _0x4dcf17[_0x95ae('0x28')]()[_0x95ae('0x29')](function(){_0x1c1545['status'](0xcc)[_0x95ae('0x1e')]();});}};}function handleEntityNotFound(_0x2afa06,_0x45a3ae){return function(_0x41a240){if(!_0x41a240){_0x2afa06[_0x95ae('0x1c')](0x194);}return _0x41a240;};}function handleError(_0x134b88,_0x5dca72){_0x5dca72=_0x5dca72||0x1f4;return function(_0x167d88){logger['error'](_0x167d88[_0x95ae('0x2a')]);if(_0x167d88['name']){delete _0x167d88[_0x95ae('0x2b')];}_0x134b88[_0x95ae('0x1d')](_0x5dca72)[_0x95ae('0x2c')](_0x167d88);};}exports[_0x95ae('0x2d')]=function(_0x5a1b45,_0x7fa1eb){var _0x4ccf80={},_0x5241e8={},_0x1ebe5a={'count':0x0,'rows':[]};var _0x1a5e5b=_['map'](db[_0x95ae('0x2e')][_0x95ae('0x2f')],function(_0x446130){return{'name':_0x446130[_0x95ae('0x30')],'type':_0x446130['type'][_0x95ae('0x31')]};});_0x5241e8[_0x95ae('0x32')]=_['map'](_0x1a5e5b,_0x95ae('0x2b'));_0x5241e8[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0x5a1b45[_0x95ae('0x33')]);_0x5241e8[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x5241e8[_0x95ae('0x32')],_0x5241e8[_0x95ae('0x33')]);_0x4ccf80['attributes']=_[_0x95ae('0x36')](_0x5241e8[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x37')]));_0x4ccf80[_0x95ae('0x38')]=_0x4ccf80['attributes'][_0x95ae('0x39')]?_0x4ccf80[_0x95ae('0x38')]:_0x5241e8[_0x95ae('0x32')];if(!_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x3a')](_0x95ae('0x3b'))){_0x4ccf80['limit']=qs[_0x95ae('0x23')](_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x23')]);_0x4ccf80['offset']=qs[_0x95ae('0x20')](_0x5a1b45['query'][_0x95ae('0x20')]);}_0x4ccf80['order']=qs[_0x95ae('0x3c')](_0x5a1b45['query'][_0x95ae('0x3c')]);_0x4ccf80[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0x5a1b45[_0x95ae('0x33')],_0x5241e8[_0x95ae('0x35')]),_0x1a5e5b);if(_0x5a1b45['query'][_0x95ae('0x3f')]){_0x4ccf80['where']=_[_0x95ae('0x40')](_0x4ccf80['where'],{'$or':_[_0x95ae('0x41')](_0x1a5e5b,function(_0x1903b7){if(_0x1903b7[_0x95ae('0x42')]!==_0x95ae('0x43')){var _0x3e7ff1={};_0x3e7ff1[_0x1903b7['name']]={'$like':'%'+_0x5a1b45['query'][_0x95ae('0x3f')]+'%'};return _0x3e7ff1;}})});}_0x4ccf80=_['merge']({},_0x4ccf80,_0x5a1b45[_0x95ae('0x44')]);var _0x3c08c2={'where':_0x4ccf80[_0x95ae('0x3d')]};return db[_0x95ae('0x2e')]['count'](_0x3c08c2)['then'](function(_0x426421){_0x1ebe5a['count']=_0x426421;if(_0x5a1b45[_0x95ae('0x33')]['includeAll']){_0x4ccf80[_0x95ae('0x45')]=[{'all':!![]}];}return db[_0x95ae('0x2e')][_0x95ae('0x46')](_0x4ccf80);})['then'](function(_0x2e3136){_0x1ebe5a[_0x95ae('0x47')]=_0x2e3136;return _0x1ebe5a;})[_0x95ae('0x29')](respondWithFilteredResult(_0x7fa1eb,_0x4ccf80))[_0x95ae('0x48')](handleError(_0x7fa1eb,null));};exports[_0x95ae('0x49')]=function(_0x48d4fa,_0x67aede){var _0x367b7a={'raw':![],'where':{'id':_0x48d4fa[_0x95ae('0x4a')]['id']}},_0x4687f6={};_0x4687f6[_0x95ae('0x32')]=_[_0x95ae('0x34')](db[_0x95ae('0x2e')]['rawAttributes']);_0x4687f6[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0x48d4fa[_0x95ae('0x33')]);_0x4687f6['filters']=_['intersection'](_0x4687f6[_0x95ae('0x32')],_0x4687f6[_0x95ae('0x33')]);_0x367b7a['attributes']=_[_0x95ae('0x36')](_0x4687f6['model'],qs[_0x95ae('0x37')](_0x48d4fa[_0x95ae('0x33')][_0x95ae('0x37')]));_0x367b7a['attributes']=_0x367b7a[_0x95ae('0x38')][_0x95ae('0x39')]?_0x367b7a[_0x95ae('0x38')]:_0x4687f6[_0x95ae('0x32')];if(_0x48d4fa[_0x95ae('0x33')][_0x95ae('0x4b')]){_0x367b7a[_0x95ae('0x45')]=[{'all':!![]}];}_0x367b7a=_[_0x95ae('0x40')]({},_0x367b7a,_0x48d4fa['options']);return db['SugarcrmConfiguration']['find'](_0x367b7a)[_0x95ae('0x29')](handleEntityNotFound(_0x67aede,null))['then'](respondWithResult(_0x67aede,null))[_0x95ae('0x48')](handleError(_0x67aede,null));};exports[_0x95ae('0x4c')]=function(_0x257b38,_0x4dbb38){return db[_0x95ae('0x2e')][_0x95ae('0x4c')](_0x257b38[_0x95ae('0x4d')],{})[_0x95ae('0x29')](respondWithResult(_0x4dbb38,0xc9))[_0x95ae('0x48')](handleError(_0x4dbb38,null));};exports[_0x95ae('0x4e')]=function(_0x2668fe,_0x4f9a44){if(_0x2668fe[_0x95ae('0x4d')]['id']){delete _0x2668fe['body']['id'];}return db[_0x95ae('0x2e')]['find']({'where':{'id':_0x2668fe[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x4f9a44,null))['then'](saveUpdates(_0x2668fe[_0x95ae('0x4d')],null))['then'](respondWithResult(_0x4f9a44,null))['catch'](handleError(_0x4f9a44,null));};exports[_0x95ae('0x28')]=function(_0x397f7e,_0x3085f1){return db[_0x95ae('0x2e')][_0x95ae('0x4f')]({'where':{'id':_0x397f7e[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x3085f1,null))[_0x95ae('0x29')](removeEntity(_0x3085f1,null))[_0x95ae('0x48')](handleError(_0x3085f1,null));};exports[_0x95ae('0x50')]=function(_0x572318,_0x3fb5b7,_0x92506b){var _0x201571={};var _0x4d9f23={};var _0x37ce1d;var _0x1097b1;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0x572318['params']['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x3fb5b7,null))[_0x95ae('0x29')](function(_0x763c4b){if(_0x763c4b){_0x37ce1d=_0x763c4b;_0x4d9f23[_0x95ae('0x32')]=_['keys'](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x4d9f23[_0x95ae('0x33')]=_['keys'](_0x572318[_0x95ae('0x33')]);_0x4d9f23['filters']=_['intersection'](_0x4d9f23[_0x95ae('0x32')],_0x4d9f23[_0x95ae('0x33')]);_0x201571[_0x95ae('0x38')]=_['intersection'](_0x4d9f23[_0x95ae('0x32')],qs['fields'](_0x572318['query'][_0x95ae('0x37')]));_0x201571[_0x95ae('0x38')]=_0x201571[_0x95ae('0x38')]['length']?_0x201571[_0x95ae('0x38')]:_0x4d9f23['model'];_0x201571[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0x572318[_0x95ae('0x33')][_0x95ae('0x3c')]);_0x201571[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0x572318[_0x95ae('0x33')],_0x4d9f23['filters']));if(_0x572318['query'][_0x95ae('0x3f')]){_0x201571[_0x95ae('0x3d')]=_[_0x95ae('0x40')](_0x201571[_0x95ae('0x3d')],{'$or':_['map'](_0x201571[_0x95ae('0x38')],function(_0x3ab660){var _0x15da17={};_0x15da17[_0x3ab660]={'$like':'%'+_0x572318[_0x95ae('0x33')][_0x95ae('0x3f')]+'%'};return _0x15da17;})});}_0x201571=_['merge']({},_0x201571,_0x572318['options']);return _0x37ce1d[_0x95ae('0x50')](_0x201571);}})['then'](function(_0x47fd55){if(_0x47fd55){_0x1097b1=_0x47fd55[_0x95ae('0x39')];if(!_0x572318['query'][_0x95ae('0x3a')]('nolimit')){_0x201571[_0x95ae('0x23')]=qs[_0x95ae('0x23')](_0x572318[_0x95ae('0x33')][_0x95ae('0x23')]);_0x201571[_0x95ae('0x20')]=qs['offset'](_0x572318[_0x95ae('0x33')]['offset']);}return _0x37ce1d[_0x95ae('0x50')](_0x201571);}})[_0x95ae('0x29')](function(_0xf10aff){if(_0xf10aff){return _0xf10aff?{'count':_0x1097b1,'rows':_0xf10aff}:null;}})[_0x95ae('0x29')](respondWithResult(_0x3fb5b7,null))[_0x95ae('0x48')](handleError(_0x3fb5b7,null));};exports[_0x95ae('0x54')]=function(_0xddedb6,_0x34ef78,_0x1dc55a){var _0x22a6fc={};var _0x103638={};var _0x305ad5;var _0x3f8e52;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0xddedb6[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x34ef78,null))[_0x95ae('0x29')](function(_0x489ff7){if(_0x489ff7){_0x305ad5=_0x489ff7;_0x103638[_0x95ae('0x32')]=_[_0x95ae('0x34')](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x103638[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0xddedb6['query']);_0x103638[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x103638[_0x95ae('0x32')],_0x103638[_0x95ae('0x33')]);_0x22a6fc[_0x95ae('0x38')]=_['intersection'](_0x103638[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0xddedb6[_0x95ae('0x33')]['fields']));_0x22a6fc['attributes']=_0x22a6fc[_0x95ae('0x38')][_0x95ae('0x39')]?_0x22a6fc[_0x95ae('0x38')]:_0x103638[_0x95ae('0x32')];_0x22a6fc[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0xddedb6[_0x95ae('0x33')]['sort']);_0x22a6fc[_0x95ae('0x3d')]=qs['filters'](_[_0x95ae('0x3e')](_0xddedb6[_0x95ae('0x33')],_0x103638[_0x95ae('0x35')]));if(_0xddedb6[_0x95ae('0x33')][_0x95ae('0x3f')]){_0x22a6fc[_0x95ae('0x3d')]=_['merge'](_0x22a6fc[_0x95ae('0x3d')],{'$or':_[_0x95ae('0x41')](_0x22a6fc[_0x95ae('0x38')],function(_0x4f9e45){var _0x2fdcd3={};_0x2fdcd3[_0x4f9e45]={'$like':'%'+_0xddedb6['query'][_0x95ae('0x3f')]+'%'};return _0x2fdcd3;})});}_0x22a6fc=_[_0x95ae('0x40')]({},_0x22a6fc,_0xddedb6[_0x95ae('0x44')]);return _0x305ad5[_0x95ae('0x54')](_0x22a6fc);}})[_0x95ae('0x29')](function(_0x528fd1){if(_0x528fd1){_0x3f8e52=_0x528fd1[_0x95ae('0x39')];if(!_0xddedb6[_0x95ae('0x33')][_0x95ae('0x3a')](_0x95ae('0x3b'))){_0x22a6fc[_0x95ae('0x23')]=qs[_0x95ae('0x23')](_0xddedb6['query'][_0x95ae('0x23')]);_0x22a6fc[_0x95ae('0x20')]=qs['offset'](_0xddedb6['query'][_0x95ae('0x20')]);}return _0x305ad5[_0x95ae('0x54')](_0x22a6fc);}})[_0x95ae('0x29')](function(_0x49c879){if(_0x49c879){return _0x49c879?{'count':_0x3f8e52,'rows':_0x49c879}:null;}})['then'](respondWithResult(_0x34ef78,null))[_0x95ae('0x48')](handleError(_0x34ef78,null));};exports[_0x95ae('0x55')]=function(_0xcd21df,_0x4162d3,_0x31e99e){var _0x2d18f4={};var _0x5f3823={};var _0x5779fb;var _0x12d001;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0xcd21df[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x4162d3,null))[_0x95ae('0x29')](function(_0x4fa9d7){if(_0x4fa9d7){_0x5779fb=_0x4fa9d7;_0x5f3823['model']=_['keys'](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x5f3823[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0xcd21df['query']);_0x5f3823[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x5f3823[_0x95ae('0x32')],_0x5f3823[_0x95ae('0x33')]);_0x2d18f4[_0x95ae('0x38')]=_[_0x95ae('0x36')](_0x5f3823[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0xcd21df['query']['fields']));_0x2d18f4['attributes']=_0x2d18f4[_0x95ae('0x38')]['length']?_0x2d18f4['attributes']:_0x5f3823['model'];_0x2d18f4[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0xcd21df['query'][_0x95ae('0x3c')]);_0x2d18f4[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0xcd21df['query'],_0x5f3823[_0x95ae('0x35')]));if(_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3f')]){_0x2d18f4[_0x95ae('0x3d')]=_[_0x95ae('0x40')](_0x2d18f4[_0x95ae('0x3d')],{'$or':_['map'](_0x2d18f4[_0x95ae('0x38')],function(_0x244c4f){var _0x11daba={};_0x11daba[_0x244c4f]={'$like':'%'+_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3f')]+'%'};return _0x11daba;})});}_0x2d18f4=_[_0x95ae('0x40')]({},_0x2d18f4,_0xcd21df[_0x95ae('0x44')]);return _0x5779fb[_0x95ae('0x55')](_0x2d18f4);}})['then'](function(_0x253512){if(_0x253512){_0x12d001=_0x253512[_0x95ae('0x39')];if(!_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3a')]('nolimit')){_0x2d18f4[_0x95ae('0x23')]=qs['limit'](_0xcd21df[_0x95ae('0x33')][_0x95ae('0x23')]);_0x2d18f4[_0x95ae('0x20')]=qs[_0x95ae('0x20')](_0xcd21df[_0x95ae('0x33')][_0x95ae('0x20')]);}return _0x5779fb[_0x95ae('0x55')](_0x2d18f4);}})['then'](function(_0x1f456a){if(_0x1f456a){return _0x1f456a?{'count':_0x12d001,'rows':_0x1f456a}:null;}})[_0x95ae('0x29')](respondWithResult(_0x4162d3,null))[_0x95ae('0x48')](handleError(_0x4162d3,null));}; \ No newline at end of file +var _0x3c1c=['map','SugarcrmConfiguration','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','getFields','findOne','order','getSubjects','SugarcrmField','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index'];(function(_0x1c691e,_0xa229){var _0x1eb9e3=function(_0x4b9bc2){while(--_0x4b9bc2){_0x1c691e['push'](_0x1c691e['shift']());}};_0x1eb9e3(++_0xa229);}(_0x3c1c,0x1ef));var _0xc3c1=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0x3c1c[_0x1caf3f];return _0x1905f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c1('0x0'));var zipdir=require(_0xc3c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc3c1('0x2'));var BPromise=require(_0xc3c1('0x3'));var Mustache=require(_0xc3c1('0x4'));var util=require(_0xc3c1('0x5'));var path=require(_0xc3c1('0x6'));var sox=require('sox');var csv=require(_0xc3c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3c1('0x8'));var _=require(_0xc3c1('0x9'));var squel=require(_0xc3c1('0xa'));var crypto=require(_0xc3c1('0xb'));var jsforce=require(_0xc3c1('0xc'));var deskjs=require(_0xc3c1('0xd'));var toCsv=require(_0xc3c1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3c1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc3c1('0xf'));var hardwareService=require(_0xc3c1('0x10'));var logger=require(_0xc3c1('0x11'))('api');var utils=require(_0xc3c1('0x12'));var config=require(_0xc3c1('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3c1('0x14'))['db'];function respondWithStatusCode(_0xe84f07,_0x1f807d){_0x1f807d=_0x1f807d||0xcc;return function(_0x2ea93c){if(_0x2ea93c){return _0xe84f07[_0xc3c1('0x15')](_0x1f807d);}return _0xe84f07['status'](_0x1f807d)['end']();};}function respondWithResult(_0x3c003e,_0x56e38a){_0x56e38a=_0x56e38a||0xc8;return function(_0x9c636d){if(_0x9c636d){return _0x3c003e[_0xc3c1('0x16')](_0x56e38a)[_0xc3c1('0x17')](_0x9c636d);}};}function respondWithFilteredResult(_0x143d9a,_0x5372c7){return function(_0x16f697){if(_0x16f697){var _0x3b4548=typeof _0x5372c7[_0xc3c1('0x18')]===_0xc3c1('0x19')&&typeof _0x5372c7['limit']===_0xc3c1('0x19');var _0x5382f1=_0x16f697[_0xc3c1('0x1a')];var _0x182899=_0x3b4548?0x0:_0x5372c7[_0xc3c1('0x18')];var _0x33f481=_0x3b4548?_0x16f697['count']:_0x5372c7[_0xc3c1('0x18')]+_0x5372c7[_0xc3c1('0x1b')];var _0x178793;if(_0x33f481>=_0x5382f1){_0x33f481=_0x5382f1;_0x178793=0xc8;}else{_0x178793=0xce;}_0x143d9a['status'](_0x178793);return _0x143d9a['set'](_0xc3c1('0x1c'),_0x182899+'-'+_0x33f481+'/'+_0x5382f1)[_0xc3c1('0x17')](_0x16f697);}return null;};}function patchUpdates(_0x5b0bf7){return function(_0x439b19){try{jsonpatch[_0xc3c1('0x1d')](_0x439b19,_0x5b0bf7,!![]);}catch(_0x25c389){return BPromise[_0xc3c1('0x1e')](_0x25c389);}return _0x439b19['save']();};}function saveUpdates(_0x193a6f,_0x346853){return function(_0x3bae43){if(_0x3bae43){return _0x3bae43[_0xc3c1('0x1f')](_0x193a6f)[_0xc3c1('0x20')](function(_0x1f745b){return _0x1f745b;});}return null;};}function removeEntity(_0x242680,_0x458a4f){return function(_0x5cca1d){if(_0x5cca1d){return _0x5cca1d['destroy']()[_0xc3c1('0x20')](function(){_0x242680['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31caf0,_0x1852e2){return function(_0x490af5){if(!_0x490af5){_0x31caf0[_0xc3c1('0x15')](0x194);}return _0x490af5;};}function handleError(_0x388989,_0x2d61b2){_0x2d61b2=_0x2d61b2||0x1f4;return function(_0xb9e5ad){logger['error'](_0xb9e5ad[_0xc3c1('0x21')]);if(_0xb9e5ad[_0xc3c1('0x22')]){delete _0xb9e5ad[_0xc3c1('0x22')];}_0x388989['status'](_0x2d61b2)[_0xc3c1('0x23')](_0xb9e5ad);};}exports[_0xc3c1('0x24')]=function(_0x29f00b,_0x12f1ed){var _0x13c451={},_0x424507={},_0x5390bd={'count':0x0,'rows':[]};var _0x21e324=_[_0xc3c1('0x25')](db[_0xc3c1('0x26')][_0xc3c1('0x27')],function(_0x32185a){return{'name':_0x32185a['fieldName'],'type':_0x32185a[_0xc3c1('0x28')][_0xc3c1('0x29')]};});_0x424507['model']=_[_0xc3c1('0x25')](_0x21e324,_0xc3c1('0x22'));_0x424507[_0xc3c1('0x2a')]=_['keys'](_0x29f00b[_0xc3c1('0x2a')]);_0x424507[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x424507[_0xc3c1('0x2d')],_0x424507['query']);_0x13c451['attributes']=_[_0xc3c1('0x2c')](_0x424507['model'],qs[_0xc3c1('0x2e')](_0x29f00b['query'][_0xc3c1('0x2e')]));_0x13c451[_0xc3c1('0x2f')]=_0x13c451[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x13c451[_0xc3c1('0x2f')]:_0x424507[_0xc3c1('0x2d')];if(!_0x29f00b[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x13c451[_0xc3c1('0x1b')]=qs['limit'](_0x29f00b['query'][_0xc3c1('0x1b')]);_0x13c451[_0xc3c1('0x18')]=qs[_0xc3c1('0x18')](_0x29f00b[_0xc3c1('0x2a')][_0xc3c1('0x18')]);}_0x13c451['order']=qs[_0xc3c1('0x33')](_0x29f00b['query'][_0xc3c1('0x33')]);_0x13c451[_0xc3c1('0x34')]=qs['filters'](_[_0xc3c1('0x35')](_0x29f00b[_0xc3c1('0x2a')],_0x424507[_0xc3c1('0x2b')]),_0x21e324);if(_0x29f00b['query'][_0xc3c1('0x36')]){_0x13c451[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x13c451[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x21e324,function(_0x383253){if(_0x383253[_0xc3c1('0x28')]!==_0xc3c1('0x38')){var _0xb972ad={};_0xb972ad[_0x383253[_0xc3c1('0x22')]]={'$like':'%'+_0x29f00b['query'][_0xc3c1('0x36')]+'%'};return _0xb972ad;}})});}_0x13c451=_['merge']({},_0x13c451,_0x29f00b[_0xc3c1('0x39')]);var _0x2ec82c={'where':_0x13c451[_0xc3c1('0x34')]};return db['SugarcrmConfiguration'][_0xc3c1('0x1a')](_0x2ec82c)[_0xc3c1('0x20')](function(_0x1de98b){_0x5390bd[_0xc3c1('0x1a')]=_0x1de98b;if(_0x29f00b[_0xc3c1('0x2a')]['includeAll']){_0x13c451[_0xc3c1('0x3a')]=[{'all':!![]}];}return db[_0xc3c1('0x26')][_0xc3c1('0x3b')](_0x13c451);})[_0xc3c1('0x20')](function(_0x1ec3e7){_0x5390bd[_0xc3c1('0x3c')]=_0x1ec3e7;return _0x5390bd;})[_0xc3c1('0x20')](respondWithFilteredResult(_0x12f1ed,_0x13c451))[_0xc3c1('0x3d')](handleError(_0x12f1ed,null));};exports[_0xc3c1('0x3e')]=function(_0x31e822,_0x2eb607){var _0x514107={'raw':![],'where':{'id':_0x31e822[_0xc3c1('0x3f')]['id']}},_0x8f4ac1={};_0x8f4ac1['model']=_[_0xc3c1('0x40')](db[_0xc3c1('0x26')][_0xc3c1('0x27')]);_0x8f4ac1[_0xc3c1('0x2a')]=_[_0xc3c1('0x40')](_0x31e822[_0xc3c1('0x2a')]);_0x8f4ac1[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x8f4ac1[_0xc3c1('0x2d')],_0x8f4ac1[_0xc3c1('0x2a')]);_0x514107[_0xc3c1('0x2f')]=_['intersection'](_0x8f4ac1[_0xc3c1('0x2d')],qs[_0xc3c1('0x2e')](_0x31e822[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x514107[_0xc3c1('0x2f')]=_0x514107[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x514107['attributes']:_0x8f4ac1[_0xc3c1('0x2d')];if(_0x31e822[_0xc3c1('0x2a')][_0xc3c1('0x41')]){_0x514107[_0xc3c1('0x3a')]=[{'all':!![]}];}_0x514107=_[_0xc3c1('0x37')]({},_0x514107,_0x31e822[_0xc3c1('0x39')]);return db['SugarcrmConfiguration'][_0xc3c1('0x42')](_0x514107)[_0xc3c1('0x20')](handleEntityNotFound(_0x2eb607,null))[_0xc3c1('0x20')](respondWithResult(_0x2eb607,null))[_0xc3c1('0x3d')](handleError(_0x2eb607,null));};exports[_0xc3c1('0x43')]=function(_0x273e19,_0xc8aebb){return db['SugarcrmConfiguration'][_0xc3c1('0x43')](_0x273e19[_0xc3c1('0x44')],{})[_0xc3c1('0x20')](respondWithResult(_0xc8aebb,0xc9))[_0xc3c1('0x3d')](handleError(_0xc8aebb,null));};exports[_0xc3c1('0x1f')]=function(_0x7ad4d7,_0xce8e6a){if(_0x7ad4d7[_0xc3c1('0x44')]['id']){delete _0x7ad4d7[_0xc3c1('0x44')]['id'];}return db[_0xc3c1('0x26')][_0xc3c1('0x42')]({'where':{'id':_0x7ad4d7[_0xc3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0xce8e6a,null))['then'](saveUpdates(_0x7ad4d7[_0xc3c1('0x44')],null))[_0xc3c1('0x20')](respondWithResult(_0xce8e6a,null))['catch'](handleError(_0xce8e6a,null));};exports[_0xc3c1('0x45')]=function(_0x2bc9f5,_0x3e54f5){return db[_0xc3c1('0x26')][_0xc3c1('0x42')]({'where':{'id':_0x2bc9f5[_0xc3c1('0x3f')]['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x3e54f5,null))[_0xc3c1('0x20')](removeEntity(_0x3e54f5,null))['catch'](handleError(_0x3e54f5,null));};exports[_0xc3c1('0x46')]=function(_0x66dc03,_0x3129b5,_0x393e49){var _0x467689={};var _0x207bd7={};var _0x40edaa;var _0x25610c;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x66dc03[_0xc3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3129b5,null))[_0xc3c1('0x20')](function(_0x229dd0){if(_0x229dd0){_0x40edaa=_0x229dd0;_0x207bd7[_0xc3c1('0x2d')]=_[_0xc3c1('0x40')](db['SugarcrmField']['rawAttributes']);_0x207bd7['query']=_['keys'](_0x66dc03[_0xc3c1('0x2a')]);_0x207bd7[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x207bd7[_0xc3c1('0x2d')],_0x207bd7['query']);_0x467689[_0xc3c1('0x2f')]=_['intersection'](_0x207bd7['model'],qs[_0xc3c1('0x2e')](_0x66dc03['query'][_0xc3c1('0x2e')]));_0x467689[_0xc3c1('0x2f')]=_0x467689[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x467689[_0xc3c1('0x2f')]:_0x207bd7[_0xc3c1('0x2d')];_0x467689[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x467689[_0xc3c1('0x34')]=qs[_0xc3c1('0x2b')](_[_0xc3c1('0x35')](_0x66dc03[_0xc3c1('0x2a')],_0x207bd7[_0xc3c1('0x2b')]));if(_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x36')]){_0x467689[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x467689[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x467689[_0xc3c1('0x2f')],function(_0x330c8f){var _0x2c27ea={};_0x2c27ea[_0x330c8f]={'$like':'%'+_0x66dc03['query'][_0xc3c1('0x36')]+'%'};return _0x2c27ea;})});}_0x467689=_[_0xc3c1('0x37')]({},_0x467689,_0x66dc03['options']);return _0x40edaa['getFields'](_0x467689);}})[_0xc3c1('0x20')](function(_0x33b6c7){if(_0x33b6c7){_0x25610c=_0x33b6c7[_0xc3c1('0x30')];if(!_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x467689[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x66dc03[_0xc3c1('0x2a')]['limit']);_0x467689[_0xc3c1('0x18')]=qs['offset'](_0x66dc03[_0xc3c1('0x2a')]['offset']);}return _0x40edaa[_0xc3c1('0x46')](_0x467689);}})[_0xc3c1('0x20')](function(_0x2f1aa9){if(_0x2f1aa9){return _0x2f1aa9?{'count':_0x25610c,'rows':_0x2f1aa9}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x3129b5,null))['catch'](handleError(_0x3129b5,null));};exports[_0xc3c1('0x49')]=function(_0x1e4698,_0x80b706,_0x9f93dd){var _0x34f4d8={};var _0x1d9794={};var _0x679df3;var _0x4c5b49;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x1e4698['params']['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x80b706,null))[_0xc3c1('0x20')](function(_0x4a9eb6){if(_0x4a9eb6){_0x679df3=_0x4a9eb6;_0x1d9794['model']=_['keys'](db[_0xc3c1('0x4a')][_0xc3c1('0x27')]);_0x1d9794['query']=_[_0xc3c1('0x40')](_0x1e4698[_0xc3c1('0x2a')]);_0x1d9794[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x1d9794[_0xc3c1('0x2d')],_0x1d9794['query']);_0x34f4d8[_0xc3c1('0x2f')]=_[_0xc3c1('0x2c')](_0x1d9794['model'],qs[_0xc3c1('0x2e')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x34f4d8[_0xc3c1('0x2f')]=_0x34f4d8[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x34f4d8[_0xc3c1('0x2f')]:_0x1d9794[_0xc3c1('0x2d')];_0x34f4d8[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x34f4d8[_0xc3c1('0x34')]=qs['filters'](_['pick'](_0x1e4698['query'],_0x1d9794[_0xc3c1('0x2b')]));if(_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x36')]){_0x34f4d8[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x34f4d8[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x34f4d8[_0xc3c1('0x2f')],function(_0x2be4ec){var _0x3612f5={};_0x3612f5[_0x2be4ec]={'$like':'%'+_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x36')]+'%'};return _0x3612f5;})});}_0x34f4d8=_[_0xc3c1('0x37')]({},_0x34f4d8,_0x1e4698[_0xc3c1('0x39')]);return _0x679df3['getSubjects'](_0x34f4d8);}})[_0xc3c1('0x20')](function(_0x1c66e9){if(_0x1c66e9){_0x4c5b49=_0x1c66e9[_0xc3c1('0x30')];if(!_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x34f4d8[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x1b')]);_0x34f4d8['offset']=qs['offset'](_0x1e4698['query'][_0xc3c1('0x18')]);}return _0x679df3[_0xc3c1('0x49')](_0x34f4d8);}})[_0xc3c1('0x20')](function(_0x4e0208){if(_0x4e0208){return _0x4e0208?{'count':_0x4c5b49,'rows':_0x4e0208}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x80b706,null))[_0xc3c1('0x3d')](handleError(_0x80b706,null));};exports[_0xc3c1('0x4b')]=function(_0x525837,_0x2b1293,_0x10a585){var _0x34772e={};var _0x1ee7e8={};var _0x460612;var _0x16a24f;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x525837[_0xc3c1('0x3f')]['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x2b1293,null))[_0xc3c1('0x20')](function(_0x5a1e87){if(_0x5a1e87){_0x460612=_0x5a1e87;_0x1ee7e8[_0xc3c1('0x2d')]=_[_0xc3c1('0x40')](db['SugarcrmField'][_0xc3c1('0x27')]);_0x1ee7e8[_0xc3c1('0x2a')]=_[_0xc3c1('0x40')](_0x525837[_0xc3c1('0x2a')]);_0x1ee7e8[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x1ee7e8[_0xc3c1('0x2d')],_0x1ee7e8[_0xc3c1('0x2a')]);_0x34772e[_0xc3c1('0x2f')]=_[_0xc3c1('0x2c')](_0x1ee7e8[_0xc3c1('0x2d')],qs[_0xc3c1('0x2e')](_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x34772e[_0xc3c1('0x2f')]=_0x34772e['attributes'][_0xc3c1('0x30')]?_0x34772e['attributes']:_0x1ee7e8[_0xc3c1('0x2d')];_0x34772e[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x34772e[_0xc3c1('0x34')]=qs[_0xc3c1('0x2b')](_['pick'](_0x525837[_0xc3c1('0x2a')],_0x1ee7e8[_0xc3c1('0x2b')]));if(_0x525837[_0xc3c1('0x2a')]['filter']){_0x34772e[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x34772e[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x34772e[_0xc3c1('0x2f')],function(_0x2d49af){var _0x2de2e6={};_0x2de2e6[_0x2d49af]={'$like':'%'+_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x36')]+'%'};return _0x2de2e6;})});}_0x34772e=_[_0xc3c1('0x37')]({},_0x34772e,_0x525837[_0xc3c1('0x39')]);return _0x460612[_0xc3c1('0x4b')](_0x34772e);}})['then'](function(_0x155eb3){if(_0x155eb3){_0x16a24f=_0x155eb3[_0xc3c1('0x30')];if(!_0x525837[_0xc3c1('0x2a')]['hasOwnProperty'](_0xc3c1('0x32'))){_0x34772e[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x525837[_0xc3c1('0x2a')]['limit']);_0x34772e['offset']=qs['offset'](_0x525837[_0xc3c1('0x2a')]['offset']);}return _0x460612[_0xc3c1('0x4b')](_0x34772e);}})[_0xc3c1('0x20')](function(_0x5bd915){if(_0x5bd915){return _0x5bd915?{'count':_0x16a24f,'rows':_0x5bd915}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x2b1293,null))['catch'](handleError(_0x2b1293,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ca34e54..2c5b291 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 _0x5a87=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a87,0x17e));var _0x75a8=function(_0x56fb7d,_0x539ea1){_0x56fb7d=_0x56fb7d-0x0;var _0x3be1c3=_0x5a87[_0x56fb7d];return _0x3be1c3;};'use strict';var _=require(_0x75a8('0x0'));var util=require(_0x75a8('0x1'));var logger=require('../../config/logger')(_0x75a8('0x2'));var moment=require(_0x75a8('0x3'));var BPromise=require(_0x75a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75a8('0x5'));var rimraf=require(_0x75a8('0x6'));var config=require(_0x75a8('0x7'));var attributes=require(_0x75a8('0x8'));module[_0x75a8('0x9')]=function(_0x29439a,_0x5f489e){return _0x29439a[_0x75a8('0xa')](_0x75a8('0xb'),attributes,{'tableName':_0x75a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb915=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x6bb814,_0x17196b){var _0x3c4bf6=function(_0x5bf6b9){while(--_0x5bf6b9){_0x6bb814['push'](_0x6bb814['shift']());}};_0x3c4bf6(++_0x17196b);}(_0xb915,0x166));var _0x5b91=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb915[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x5b91('0x0'));var util=require(_0x5b91('0x1'));var logger=require(_0x5b91('0x2'))(_0x5b91('0x3'));var moment=require(_0x5b91('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b91('0x5'));var fs=require('fs');var path=require(_0x5b91('0x6'));var rimraf=require(_0x5b91('0x7'));var config=require(_0x5b91('0x8'));var attributes=require(_0x5b91('0x9'));module[_0x5b91('0xa')]=function(_0xd7ef41,_0x540a16){return _0xd7ef41[_0x5b91('0xb')](_0x5b91('0xc'),attributes,{'tableName':_0x5b91('0xd'),'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 c99013f..47f0c47 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 _0xd491=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2df220,_0x24caf9){var _0x41a0d6=function(_0xb26fc1){while(--_0xb26fc1){_0x2df220['push'](_0x2df220['shift']());}};_0x41a0d6(++_0x24caf9);}(_0xd491,0x179));var _0x1d49=function(_0x12688b,_0x18768b){_0x12688b=_0x12688b-0x0;var _0x413662=_0xd491[_0x12688b];return _0x413662;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d49('0x0'));var BPromise=require(_0x1d49('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d49('0x2'));var db=require(_0x1d49('0x3'))['db'];var utils=require(_0x1d49('0x4'));var logger=require(_0x1d49('0x5'))(_0x1d49('0x6'));var config=require(_0x1d49('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d49('0x8')][_0x1d49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fdbf4,_0x4bf996,_0x267c4e){return new BPromise(function(_0x345cca,_0xb35399){return client[_0x1d49('0xa')](_0x4fdbf4,_0x267c4e)[_0x1d49('0xb')](function(_0x47cce5){logger['info'](_0x1d49('0xc'),_0x4bf996,_0x1d49('0xd'));logger[_0x1d49('0xe')](_0x1d49('0xf'),_0x4bf996,_0x1d49('0xd'),JSON[_0x1d49('0x10')](_0x47cce5));if(_0x47cce5[_0x1d49('0x11')]){if(_0x47cce5[_0x1d49('0x11')][_0x1d49('0x12')]===0x1f4){logger['error'](_0x1d49('0xc'),_0x4bf996,_0x47cce5[_0x1d49('0x11')][_0x1d49('0x13')]);return _0xb35399(_0x47cce5[_0x1d49('0x11')]['message']);}logger['error'](_0x1d49('0xc'),_0x4bf996,_0x47cce5[_0x1d49('0x11')][_0x1d49('0x13')]);return _0x345cca(_0x47cce5[_0x1d49('0x11')]['message']);}else{logger[_0x1d49('0x14')](_0x1d49('0xc'),_0x4bf996,_0x1d49('0xd'));_0x345cca(_0x47cce5[_0x1d49('0x15')][_0x1d49('0x13')]);}})[_0x1d49('0x16')](function(_0x5957c7){logger[_0x1d49('0x11')](_0x1d49('0xc'),_0x4bf996,_0x5957c7);_0xb35399(_0x5957c7);});});} \ No newline at end of file +var _0x8bbc=['http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3bb6f6,_0x1e642c){var _0x53f34e=function(_0x31c4de){while(--_0x31c4de){_0x3bb6f6['push'](_0x3bb6f6['shift']());}};_0x53f34e(++_0x1e642c);}(_0x8bbc,0x1c4));var _0xc8bb=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x8bbc[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0xc8bb('0x0'));var util=require(_0xc8bb('0x1'));var moment=require('moment');var BPromise=require(_0xc8bb('0x2'));var rs=require(_0xc8bb('0x3'));var fs=require('fs');var Redis=require(_0xc8bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8bb('0x5'));var logger=require(_0xc8bb('0x6'))(_0xc8bb('0x7'));var config=require(_0xc8bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc8bb('0x9')][_0xc8bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x287006,_0x320328,_0x11363e){return new BPromise(function(_0x4ddfda,_0x4c3a71){return client['request'](_0x287006,_0x11363e)[_0xc8bb('0xb')](function(_0x4146fd){logger[_0xc8bb('0xc')](_0xc8bb('0xd'),_0x320328,_0xc8bb('0xe'));logger[_0xc8bb('0xf')](_0xc8bb('0x10'),_0x320328,_0xc8bb('0xe'),JSON['stringify'](_0x4146fd));if(_0x4146fd[_0xc8bb('0x11')]){if(_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x12')]===0x1f4){logger[_0xc8bb('0x11')](_0xc8bb('0xd'),_0x320328,_0x4146fd[_0xc8bb('0x11')]['message']);return _0x4c3a71(_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x13')]);}logger['error'](_0xc8bb('0xd'),_0x320328,_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x13')]);return _0x4ddfda(_0x4146fd['error'][_0xc8bb('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x320328,_0xc8bb('0xe'));_0x4ddfda(_0x4146fd[_0xc8bb('0x14')][_0xc8bb('0x13')]);}})[_0xc8bb('0x15')](function(_0x4b38b3){logger[_0xc8bb('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x320328,_0x4b38b3);_0x4c3a71(_0x4b38b3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2f39522..25ed630 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 _0xbd1c=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x231544,_0x592bab){var _0x3a96df=function(_0x542502){while(--_0x542502){_0x231544['push'](_0x231544['shift']());}};_0x3a96df(++_0x592bab);}(_0xbd1c,0xad));var _0xcbd1=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xbd1c[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd1('0x2'));var router=express[_0xcbd1('0x3')]();var fs_extra=require(_0xcbd1('0x4'));var auth=require(_0xcbd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbd1('0x6'));var controller=require(_0xcbd1('0x7'));router[_0xcbd1('0x8')]('/',auth[_0xcbd1('0x9')](),controller[_0xcbd1('0xa')]);router['get'](_0xcbd1('0xb'),auth['isAuthenticated'](),controller[_0xcbd1('0xc')]);router[_0xcbd1('0xd')]('/',auth[_0xcbd1('0x9')](),controller['create']);router[_0xcbd1('0xe')]('/:id',auth[_0xcbd1('0x9')](),controller[_0xcbd1('0xf')]);router['delete'](_0xcbd1('0xb'),auth[_0xcbd1('0x9')](),controller[_0xcbd1('0x10')]);module[_0xcbd1('0x11')]=router; \ No newline at end of file +var _0x48f2=['show','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id'];(function(_0x1a9881,_0x177c92){var _0x5838cc=function(_0x25f20e){while(--_0x25f20e){_0x1a9881['push'](_0x1a9881['shift']());}};_0x5838cc(++_0x177c92);}(_0x48f2,0xc2));var _0x248f=function(_0x349535,_0x1b13ce){_0x349535=_0x349535-0x0;var _0x31dcda=_0x48f2[_0x349535];return _0x31dcda;};'use strict';var multer=require(_0x248f('0x0'));var util=require(_0x248f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x248f('0x2')]();var fs_extra=require(_0x248f('0x3'));var auth=require(_0x248f('0x4'));var interaction=require(_0x248f('0x5'));var config=require('../../config/environment');var controller=require(_0x248f('0x6'));router[_0x248f('0x7')]('/',auth[_0x248f('0x8')](),controller['index']);router['get'](_0x248f('0x9'),auth['isAuthenticated'](),controller[_0x248f('0xa')]);router['post']('/',auth[_0x248f('0x8')](),controller[_0x248f('0xb')]);router[_0x248f('0xc')]('/:id',auth[_0x248f('0x8')](),controller[_0x248f('0xd')]);router[_0x248f('0xe')](_0x248f('0x9'),auth[_0x248f('0x8')](),controller[_0x248f('0xf')]);module[_0x248f('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 9dcd21f..694ae6d 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 _0xb696=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x1064db,_0x3a6f4b){var _0x1e7444=function(_0x14b284){while(--_0x14b284){_0x1064db['push'](_0x1064db['shift']());}};_0x1e7444(++_0x3a6f4b);}(_0xb696,0x104));var _0x6b69=function(_0x11e857,_0x44d6cd){_0x11e857=_0x11e857-0x0;var _0x10508c=_0xb696[_0x11e857];return _0x10508c;};'use strict';var Sequelize=require(_0x6b69('0x0'));module[_0x6b69('0x1')]={'type':{'type':Sequelize[_0x6b69('0x2')](_0x6b69('0x3'),_0x6b69('0x4'),_0x6b69('0x5'),'keyValue',_0x6b69('0x6')),'defaultValue':_0x6b69('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6b69('0x2')]('string',_0x6b69('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6b69('0x7')]},'nameField':{'type':Sequelize[_0x6b69('0x7')]},'customField':{'type':Sequelize[_0x6b69('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b69('0x7')]}}; \ No newline at end of file +var _0xa7a6=['ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN','sequelize'];(function(_0x5f3065,_0x3327fd){var _0x2aed2b=function(_0x2975b9){while(--_0x2975b9){_0x5f3065['push'](_0x5f3065['shift']());}};_0x2aed2b(++_0x3327fd);}(_0xa7a6,0xa7));var _0x6a7a=function(_0x28f0dd,_0x4cddd2){_0x28f0dd=_0x28f0dd-0x0;var _0x4f73cd=_0xa7a6[_0x28f0dd];return _0x4f73cd;};'use strict';var Sequelize=require(_0x6a7a('0x0'));module['exports']={'type':{'type':Sequelize[_0x6a7a('0x1')]('string','variable',_0x6a7a('0x2'),_0x6a7a('0x3'),'picklist'),'defaultValue':_0x6a7a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6a7a('0x5')]},'keyType':{'type':Sequelize[_0x6a7a('0x1')](_0x6a7a('0x4'),_0x6a7a('0x6'),_0x6a7a('0x2'))},'keyContent':{'type':Sequelize[_0x6a7a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6a7a('0x5')]},'customField':{'type':Sequelize[_0x6a7a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a7a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e1d708d..3b9f3d3 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 _0xf1ef=['offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmField','include','findAll','rows','catch','show','keys','includeAll','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x38fb1b,_0x297586){var _0x212b60=function(_0x7dc197){while(--_0x7dc197){_0x38fb1b['push'](_0x38fb1b['shift']());}};_0x212b60(++_0x297586);}(_0xf1ef,0x1e3));var _0xff1e=function(_0x299bf3,_0x5c2955){_0x299bf3=_0x299bf3-0x0;var _0x13301e=_0xf1ef[_0x299bf3];return _0x13301e;};'use strict';var emlformat=require(_0xff1e('0x0'));var rimraf=require(_0xff1e('0x1'));var zipdir=require(_0xff1e('0x2'));var jsonpatch=require(_0xff1e('0x3'));var rp=require(_0xff1e('0x4'));var moment=require(_0xff1e('0x5'));var BPromise=require(_0xff1e('0x6'));var Mustache=require('mustache');var util=require(_0xff1e('0x7'));var path=require('path');var sox=require(_0xff1e('0x8'));var csv=require(_0xff1e('0x9'));var ejs=require(_0xff1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff1e('0xb'));var crypto=require(_0xff1e('0xc'));var jsforce=require(_0xff1e('0xd'));var deskjs=require(_0xff1e('0xe'));var toCsv=require(_0xff1e('0x9'));var querystring=require(_0xff1e('0xf'));var Papa=require(_0xff1e('0x10'));var Redis=require('ioredis');var authService=require(_0xff1e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff1e('0x12'));var hardwareService=require(_0xff1e('0x13'));var logger=require(_0xff1e('0x14'))(_0xff1e('0x15'));var utils=require(_0xff1e('0x16'));var config=require(_0xff1e('0x17'));var licenseUtil=require(_0xff1e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fcb95,_0x5e12a3){_0x5e12a3=_0x5e12a3||0xcc;return function(_0x3d3706){if(_0x3d3706){return _0x2fcb95[_0xff1e('0x19')](_0x5e12a3);}return _0x2fcb95['status'](_0x5e12a3)[_0xff1e('0x1a')]();};}function respondWithResult(_0x253034,_0x278f87){_0x278f87=_0x278f87||0xc8;return function(_0x56d9cb){if(_0x56d9cb){return _0x253034[_0xff1e('0x1b')](_0x278f87)[_0xff1e('0x1c')](_0x56d9cb);}};}function respondWithFilteredResult(_0x3123b1,_0x13cfe8){return function(_0x2176fa){if(_0x2176fa){var _0x4363b2=typeof _0x13cfe8['offset']===_0xff1e('0x1d')&&typeof _0x13cfe8[_0xff1e('0x1e')]===_0xff1e('0x1d');var _0x455f56=_0x2176fa[_0xff1e('0x1f')];var _0x51abec=_0x4363b2?0x0:_0x13cfe8['offset'];var _0x4426f4=_0x4363b2?_0x2176fa[_0xff1e('0x1f')]:_0x13cfe8['offset']+_0x13cfe8[_0xff1e('0x1e')];var _0xed4f79;if(_0x4426f4>=_0x455f56){_0x4426f4=_0x455f56;_0xed4f79=0xc8;}else{_0xed4f79=0xce;}_0x3123b1[_0xff1e('0x1b')](_0xed4f79);return _0x3123b1['set'](_0xff1e('0x20'),_0x51abec+'-'+_0x4426f4+'/'+_0x455f56)['json'](_0x2176fa);}return null;};}function patchUpdates(_0x27c5a1){return function(_0x39c8f6){try{jsonpatch[_0xff1e('0x21')](_0x39c8f6,_0x27c5a1,!![]);}catch(_0x3b7abb){return BPromise[_0xff1e('0x22')](_0x3b7abb);}return _0x39c8f6[_0xff1e('0x23')]();};}function saveUpdates(_0x1a08fc,_0x4ce74a){return function(_0x41d260){if(_0x41d260){return _0x41d260[_0xff1e('0x24')](_0x1a08fc)[_0xff1e('0x25')](function(_0x2d7496){return _0x2d7496;});}return null;};}function removeEntity(_0x207f59,_0x14024b){return function(_0x364524){if(_0x364524){return _0x364524[_0xff1e('0x26')]()['then'](function(){_0x207f59['status'](0xcc)[_0xff1e('0x1a')]();});}};}function handleEntityNotFound(_0x59b0e3,_0x3d3f8b){return function(_0x5a740a){if(!_0x5a740a){_0x59b0e3[_0xff1e('0x19')](0x194);}return _0x5a740a;};}function handleError(_0x105e08,_0x38f05a){_0x38f05a=_0x38f05a||0x1f4;return function(_0x4c0c72){logger[_0xff1e('0x27')](_0x4c0c72[_0xff1e('0x28')]);if(_0x4c0c72[_0xff1e('0x29')]){delete _0x4c0c72[_0xff1e('0x29')];}_0x105e08[_0xff1e('0x1b')](_0x38f05a)[_0xff1e('0x2a')](_0x4c0c72);};}exports[_0xff1e('0x2b')]=function(_0x13ac42,_0x1b1f03){var _0x417b7f={},_0x3bb8eb={},_0x1d3c47={'count':0x0,'rows':[]};var _0x17c559=_['map'](db['SugarcrmField'][_0xff1e('0x2c')],function(_0x81f2d4){return{'name':_0x81f2d4[_0xff1e('0x2d')],'type':_0x81f2d4[_0xff1e('0x2e')][_0xff1e('0x2f')]};});_0x3bb8eb[_0xff1e('0x30')]=_['map'](_0x17c559,'name');_0x3bb8eb[_0xff1e('0x31')]=_['keys'](_0x13ac42[_0xff1e('0x31')]);_0x3bb8eb[_0xff1e('0x32')]=_[_0xff1e('0x33')](_0x3bb8eb[_0xff1e('0x30')],_0x3bb8eb[_0xff1e('0x31')]);_0x417b7f[_0xff1e('0x34')]=_[_0xff1e('0x33')](_0x3bb8eb[_0xff1e('0x30')],qs[_0xff1e('0x35')](_0x13ac42[_0xff1e('0x31')][_0xff1e('0x35')]));_0x417b7f[_0xff1e('0x34')]=_0x417b7f['attributes'][_0xff1e('0x36')]?_0x417b7f[_0xff1e('0x34')]:_0x3bb8eb[_0xff1e('0x30')];if(!_0x13ac42[_0xff1e('0x31')][_0xff1e('0x37')]('nolimit')){_0x417b7f[_0xff1e('0x1e')]=qs['limit'](_0x13ac42['query'][_0xff1e('0x1e')]);_0x417b7f['offset']=qs['offset'](_0x13ac42[_0xff1e('0x31')][_0xff1e('0x38')]);}_0x417b7f[_0xff1e('0x39')]=qs[_0xff1e('0x3a')](_0x13ac42[_0xff1e('0x31')]['sort']);_0x417b7f[_0xff1e('0x3b')]=qs[_0xff1e('0x32')](_[_0xff1e('0x3c')](_0x13ac42[_0xff1e('0x31')],_0x3bb8eb['filters']),_0x17c559);if(_0x13ac42[_0xff1e('0x31')][_0xff1e('0x3d')]){_0x417b7f[_0xff1e('0x3b')]=_[_0xff1e('0x3e')](_0x417b7f[_0xff1e('0x3b')],{'$or':_[_0xff1e('0x3f')](_0x17c559,function(_0x1bc7c5){if(_0x1bc7c5[_0xff1e('0x2e')]!==_0xff1e('0x40')){var _0x240e66={};_0x240e66[_0x1bc7c5[_0xff1e('0x29')]]={'$like':'%'+_0x13ac42[_0xff1e('0x31')]['filter']+'%'};return _0x240e66;}})});}_0x417b7f=_['merge']({},_0x417b7f,_0x13ac42[_0xff1e('0x41')]);var _0x52a68e={'where':_0x417b7f['where']};return db[_0xff1e('0x42')]['count'](_0x52a68e)[_0xff1e('0x25')](function(_0xded21b){_0x1d3c47[_0xff1e('0x1f')]=_0xded21b;if(_0x13ac42[_0xff1e('0x31')]['includeAll']){_0x417b7f[_0xff1e('0x43')]=[{'all':!![]}];}return db[_0xff1e('0x42')][_0xff1e('0x44')](_0x417b7f);})[_0xff1e('0x25')](function(_0x31cd11){_0x1d3c47[_0xff1e('0x45')]=_0x31cd11;return _0x1d3c47;})['then'](respondWithFilteredResult(_0x1b1f03,_0x417b7f))[_0xff1e('0x46')](handleError(_0x1b1f03,null));};exports[_0xff1e('0x47')]=function(_0x2886e0,_0x5d646d){var _0x5f5550={'raw':!![],'where':{'id':_0x2886e0['params']['id']}},_0x2c1949={};_0x2c1949[_0xff1e('0x30')]=_[_0xff1e('0x48')](db[_0xff1e('0x42')][_0xff1e('0x2c')]);_0x2c1949['query']=_[_0xff1e('0x48')](_0x2886e0[_0xff1e('0x31')]);_0x2c1949[_0xff1e('0x32')]=_['intersection'](_0x2c1949[_0xff1e('0x30')],_0x2c1949[_0xff1e('0x31')]);_0x5f5550[_0xff1e('0x34')]=_['intersection'](_0x2c1949[_0xff1e('0x30')],qs[_0xff1e('0x35')](_0x2886e0[_0xff1e('0x31')]['fields']));_0x5f5550[_0xff1e('0x34')]=_0x5f5550[_0xff1e('0x34')]['length']?_0x5f5550[_0xff1e('0x34')]:_0x2c1949[_0xff1e('0x30')];if(_0x2886e0[_0xff1e('0x31')][_0xff1e('0x49')]){_0x5f5550[_0xff1e('0x43')]=[{'all':!![]}];}_0x5f5550=_[_0xff1e('0x3e')]({},_0x5f5550,_0x2886e0[_0xff1e('0x41')]);return db[_0xff1e('0x42')]['find'](_0x5f5550)[_0xff1e('0x25')](handleEntityNotFound(_0x5d646d,null))[_0xff1e('0x25')](respondWithResult(_0x5d646d,null))[_0xff1e('0x46')](handleError(_0x5d646d,null));};exports[_0xff1e('0x4a')]=function(_0x20149c,_0x497bff){return db[_0xff1e('0x42')]['create'](_0x20149c[_0xff1e('0x4b')],{})[_0xff1e('0x25')](respondWithResult(_0x497bff,0xc9))['catch'](handleError(_0x497bff,null));};exports[_0xff1e('0x24')]=function(_0x34fc22,_0x295ff7){if(_0x34fc22[_0xff1e('0x4b')]['id']){delete _0x34fc22['body']['id'];}return db[_0xff1e('0x42')]['find']({'where':{'id':_0x34fc22[_0xff1e('0x4c')]['id']}})[_0xff1e('0x25')](handleEntityNotFound(_0x295ff7,null))['then'](saveUpdates(_0x34fc22['body'],null))['then'](respondWithResult(_0x295ff7,null))[_0xff1e('0x46')](handleError(_0x295ff7,null));};exports[_0xff1e('0x26')]=function(_0x2d67a5,_0x3557ee){return db[_0xff1e('0x42')]['find']({'where':{'id':_0x2d67a5[_0xff1e('0x4c')]['id']}})[_0xff1e('0x25')](handleEntityNotFound(_0x3557ee,null))[_0xff1e('0x25')](removeEntity(_0x3557ee,null))[_0xff1e('0x46')](handleError(_0x3557ee,null));}; \ No newline at end of file +var _0xabe9=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','then','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','eml-format','rimraf','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x565889,_0x5825ab){var _0x2e24c8=function(_0x639718){while(--_0x639718){_0x565889['push'](_0x565889['shift']());}};_0x2e24c8(++_0x5825ab);}(_0xabe9,0x1b1));var _0x9abe=function(_0x2c7918,_0x464fd0){_0x2c7918=_0x2c7918-0x0;var _0x55a141=_0xabe9[_0x2c7918];return _0x55a141;};'use strict';var emlformat=require(_0x9abe('0x0'));var rimraf=require(_0x9abe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9abe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9abe('0x3'));var util=require(_0x9abe('0x4'));var path=require('path');var sox=require(_0x9abe('0x5'));var csv=require('to-csv');var ejs=require(_0x9abe('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9abe('0x7'));var squel=require('squel');var crypto=require(_0x9abe('0x8'));var jsforce=require(_0x9abe('0x9'));var deskjs=require(_0x9abe('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9abe('0xb'));var Papa=require(_0x9abe('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9abe('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9abe('0xe'));var logger=require(_0x9abe('0xf'))('api');var utils=require(_0x9abe('0x10'));var config=require(_0x9abe('0x11'));var licenseUtil=require(_0x9abe('0x12'));var db=require(_0x9abe('0x13'))['db'];function respondWithStatusCode(_0x548379,_0xe7f9ed){_0xe7f9ed=_0xe7f9ed||0xcc;return function(_0x495720){if(_0x495720){return _0x548379['sendStatus'](_0xe7f9ed);}return _0x548379['status'](_0xe7f9ed)[_0x9abe('0x14')]();};}function respondWithResult(_0x4bc6ef,_0xfee143){_0xfee143=_0xfee143||0xc8;return function(_0x1b0c95){if(_0x1b0c95){return _0x4bc6ef[_0x9abe('0x15')](_0xfee143)[_0x9abe('0x16')](_0x1b0c95);}};}function respondWithFilteredResult(_0x4d9e68,_0x8b32e3){return function(_0x2cb4ae){if(_0x2cb4ae){var _0x29b2da=typeof _0x8b32e3[_0x9abe('0x17')]===_0x9abe('0x18')&&typeof _0x8b32e3['limit']==='undefined';var _0x78e74f=_0x2cb4ae[_0x9abe('0x19')];var _0x297d94=_0x29b2da?0x0:_0x8b32e3[_0x9abe('0x17')];var _0x1b0845=_0x29b2da?_0x2cb4ae[_0x9abe('0x19')]:_0x8b32e3['offset']+_0x8b32e3['limit'];var _0x394c11;if(_0x1b0845>=_0x78e74f){_0x1b0845=_0x78e74f;_0x394c11=0xc8;}else{_0x394c11=0xce;}_0x4d9e68[_0x9abe('0x15')](_0x394c11);return _0x4d9e68[_0x9abe('0x1a')](_0x9abe('0x1b'),_0x297d94+'-'+_0x1b0845+'/'+_0x78e74f)[_0x9abe('0x16')](_0x2cb4ae);}return null;};}function patchUpdates(_0x68906e){return function(_0x5aca9c){try{jsonpatch[_0x9abe('0x1c')](_0x5aca9c,_0x68906e,!![]);}catch(_0x315544){return BPromise[_0x9abe('0x1d')](_0x315544);}return _0x5aca9c[_0x9abe('0x1e')]();};}function saveUpdates(_0x2dd389,_0x1ffc21){return function(_0x476471){if(_0x476471){return _0x476471[_0x9abe('0x1f')](_0x2dd389)['then'](function(_0xbf1a13){return _0xbf1a13;});}return null;};}function removeEntity(_0x39c7be,_0x3a25f2){return function(_0x58ace7){if(_0x58ace7){return _0x58ace7[_0x9abe('0x20')]()['then'](function(){_0x39c7be['status'](0xcc)[_0x9abe('0x14')]();});}};}function handleEntityNotFound(_0x3c3f1e,_0x2f6409){return function(_0x3577bc){if(!_0x3577bc){_0x3c3f1e[_0x9abe('0x21')](0x194);}return _0x3577bc;};}function handleError(_0x1fd973,_0x19e2a2){_0x19e2a2=_0x19e2a2||0x1f4;return function(_0x202bd2){logger[_0x9abe('0x22')](_0x202bd2[_0x9abe('0x23')]);if(_0x202bd2[_0x9abe('0x24')]){delete _0x202bd2[_0x9abe('0x24')];}_0x1fd973['status'](_0x19e2a2)[_0x9abe('0x25')](_0x202bd2);};}exports[_0x9abe('0x26')]=function(_0x54495f,_0x35850a){var _0x3942dd={},_0x3d5208={},_0x3c23d7={'count':0x0,'rows':[]};var _0x4a9fef=_[_0x9abe('0x27')](db[_0x9abe('0x28')][_0x9abe('0x29')],function(_0x562c49){return{'name':_0x562c49[_0x9abe('0x2a')],'type':_0x562c49[_0x9abe('0x2b')][_0x9abe('0x2c')]};});_0x3d5208[_0x9abe('0x2d')]=_[_0x9abe('0x27')](_0x4a9fef,_0x9abe('0x24'));_0x3d5208[_0x9abe('0x2e')]=_['keys'](_0x54495f[_0x9abe('0x2e')]);_0x3d5208[_0x9abe('0x2f')]=_[_0x9abe('0x30')](_0x3d5208[_0x9abe('0x2d')],_0x3d5208[_0x9abe('0x2e')]);_0x3942dd['attributes']=_['intersection'](_0x3d5208[_0x9abe('0x2d')],qs[_0x9abe('0x31')](_0x54495f[_0x9abe('0x2e')][_0x9abe('0x31')]));_0x3942dd[_0x9abe('0x32')]=_0x3942dd['attributes'][_0x9abe('0x33')]?_0x3942dd[_0x9abe('0x32')]:_0x3d5208[_0x9abe('0x2d')];if(!_0x54495f[_0x9abe('0x2e')][_0x9abe('0x34')](_0x9abe('0x35'))){_0x3942dd[_0x9abe('0x36')]=qs[_0x9abe('0x36')](_0x54495f[_0x9abe('0x2e')]['limit']);_0x3942dd[_0x9abe('0x17')]=qs['offset'](_0x54495f[_0x9abe('0x2e')]['offset']);}_0x3942dd[_0x9abe('0x37')]=qs['sort'](_0x54495f[_0x9abe('0x2e')]['sort']);_0x3942dd[_0x9abe('0x38')]=qs[_0x9abe('0x2f')](_[_0x9abe('0x39')](_0x54495f[_0x9abe('0x2e')],_0x3d5208[_0x9abe('0x2f')]),_0x4a9fef);if(_0x54495f[_0x9abe('0x2e')]['filter']){_0x3942dd[_0x9abe('0x38')]=_[_0x9abe('0x3a')](_0x3942dd[_0x9abe('0x38')],{'$or':_[_0x9abe('0x27')](_0x4a9fef,function(_0x52d0fa){if(_0x52d0fa[_0x9abe('0x2b')]!==_0x9abe('0x3b')){var _0x26f67b={};_0x26f67b[_0x52d0fa[_0x9abe('0x24')]]={'$like':'%'+_0x54495f['query'][_0x9abe('0x3c')]+'%'};return _0x26f67b;}})});}_0x3942dd=_[_0x9abe('0x3a')]({},_0x3942dd,_0x54495f['options']);var _0x28aec4={'where':_0x3942dd['where']};return db['SugarcrmField']['count'](_0x28aec4)[_0x9abe('0x3d')](function(_0x37f901){_0x3c23d7[_0x9abe('0x19')]=_0x37f901;if(_0x54495f[_0x9abe('0x2e')]['includeAll']){_0x3942dd[_0x9abe('0x3e')]=[{'all':!![]}];}return db[_0x9abe('0x28')][_0x9abe('0x3f')](_0x3942dd);})[_0x9abe('0x3d')](function(_0x84c101){_0x3c23d7[_0x9abe('0x40')]=_0x84c101;return _0x3c23d7;})[_0x9abe('0x3d')](respondWithFilteredResult(_0x35850a,_0x3942dd))[_0x9abe('0x41')](handleError(_0x35850a,null));};exports[_0x9abe('0x42')]=function(_0x3cf6ec,_0x50524a){var _0x149c53={'raw':!![],'where':{'id':_0x3cf6ec[_0x9abe('0x43')]['id']}},_0x178034={};_0x178034[_0x9abe('0x2d')]=_['keys'](db[_0x9abe('0x28')][_0x9abe('0x29')]);_0x178034[_0x9abe('0x2e')]=_[_0x9abe('0x44')](_0x3cf6ec[_0x9abe('0x2e')]);_0x178034[_0x9abe('0x2f')]=_[_0x9abe('0x30')](_0x178034[_0x9abe('0x2d')],_0x178034[_0x9abe('0x2e')]);_0x149c53[_0x9abe('0x32')]=_['intersection'](_0x178034[_0x9abe('0x2d')],qs[_0x9abe('0x31')](_0x3cf6ec['query']['fields']));_0x149c53[_0x9abe('0x32')]=_0x149c53[_0x9abe('0x32')][_0x9abe('0x33')]?_0x149c53['attributes']:_0x178034['model'];if(_0x3cf6ec['query'][_0x9abe('0x45')]){_0x149c53[_0x9abe('0x3e')]=[{'all':!![]}];}_0x149c53=_[_0x9abe('0x3a')]({},_0x149c53,_0x3cf6ec[_0x9abe('0x46')]);return db[_0x9abe('0x28')]['find'](_0x149c53)[_0x9abe('0x3d')](handleEntityNotFound(_0x50524a,null))[_0x9abe('0x3d')](respondWithResult(_0x50524a,null))[_0x9abe('0x41')](handleError(_0x50524a,null));};exports['create']=function(_0x53cbd5,_0x36c9eb){return db[_0x9abe('0x28')][_0x9abe('0x47')](_0x53cbd5[_0x9abe('0x48')],{})['then'](respondWithResult(_0x36c9eb,0xc9))[_0x9abe('0x41')](handleError(_0x36c9eb,null));};exports[_0x9abe('0x1f')]=function(_0x43154d,_0x361026){if(_0x43154d[_0x9abe('0x48')]['id']){delete _0x43154d[_0x9abe('0x48')]['id'];}return db[_0x9abe('0x28')][_0x9abe('0x49')]({'where':{'id':_0x43154d[_0x9abe('0x43')]['id']}})[_0x9abe('0x3d')](handleEntityNotFound(_0x361026,null))[_0x9abe('0x3d')](saveUpdates(_0x43154d[_0x9abe('0x48')],null))[_0x9abe('0x3d')](respondWithResult(_0x361026,null))[_0x9abe('0x41')](handleError(_0x361026,null));};exports[_0x9abe('0x20')]=function(_0x1f1462,_0x1bd9eb){return db[_0x9abe('0x28')][_0x9abe('0x49')]({'where':{'id':_0x1f1462[_0x9abe('0x43')]['id']}})[_0x9abe('0x3d')](handleEntityNotFound(_0x1bd9eb,null))[_0x9abe('0x3d')](removeEntity(_0x1bd9eb,null))[_0x9abe('0x41')](handleError(_0x1bd9eb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0771af9..16e5299 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 _0x51d4=['int_sugarcrm_fields','sugarcrm_unique_index','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x385380,_0x1a8069){var _0x1cfcd3=function(_0x516f91){while(--_0x516f91){_0x385380['push'](_0x385380['shift']());}};_0x1cfcd3(++_0x1a8069);}(_0x51d4,0x16a));var _0x451d=function(_0x557acc,_0x2bf699){_0x557acc=_0x557acc-0x0;var _0xb965f=_0x51d4[_0x557acc];return _0xb965f;};'use strict';var _=require('lodash');var util=require(_0x451d('0x0'));var logger=require(_0x451d('0x1'))(_0x451d('0x2'));var moment=require('moment');var BPromise=require(_0x451d('0x3'));var rp=require(_0x451d('0x4'));var fs=require('fs');var path=require(_0x451d('0x5'));var rimraf=require(_0x451d('0x6'));var config=require('../../config/environment');var attributes=require(_0x451d('0x7'));module[_0x451d('0x8')]=function(_0x252be7,_0x5b617f){return _0x252be7['define'](_0x451d('0x9'),attributes,{'tableName':_0x451d('0xa'),'paranoid':![],'indexes':[{'name':_0x451d('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x692f=['moment','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger'];(function(_0x1c05d,_0x116e78){var _0x1968d4=function(_0x3dd58b){while(--_0x3dd58b){_0x1c05d['push'](_0x1c05d['shift']());}};_0x1968d4(++_0x116e78);}(_0x692f,0x196));var _0xf692=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x692f[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require('lodash');var util=require(_0xf692('0x0'));var logger=require(_0xf692('0x1'))('api');var moment=require(_0xf692('0x2'));var BPromise=require(_0xf692('0x3'));var rp=require(_0xf692('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf692('0x5'));var attributes=require(_0xf692('0x6'));module[_0xf692('0x7')]=function(_0x3f0e08,_0x2e0ae0){return _0x3f0e08[_0xf692('0x8')]('SugarcrmField',attributes,{'tableName':_0xf692('0x9'),'paranoid':![],'indexes':[{'name':_0xf692('0xa'),'fields':['idField',_0xf692('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f5b4a7c..926fb5d 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 _0x7142=['SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1a5a3c,_0x5c0c48){var _0x1a02fa=function(_0x40bec2){while(--_0x40bec2){_0x1a5a3c['push'](_0x1a5a3c['shift']());}};_0x1a02fa(++_0x5c0c48);}(_0x7142,0xf9));var _0x2714=function(_0x4aeb4f,_0x581549){_0x4aeb4f=_0x4aeb4f-0x0;var _0x5311bb=_0x7142[_0x4aeb4f];return _0x5311bb;};'use strict';var _=require(_0x2714('0x0'));var util=require(_0x2714('0x1'));var moment=require('moment');var BPromise=require(_0x2714('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2714('0x3'))['db'];var utils=require(_0x2714('0x4'));var logger=require('../../config/logger')(_0x2714('0x5'));var config=require(_0x2714('0x6'));var jayson=require(_0x2714('0x7'));var client=jayson[_0x2714('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f54fa,_0x36ff44,_0x5dcdf2){return new BPromise(function(_0x59cd4b,_0xde5fe2){return client[_0x2714('0x9')](_0x4f54fa,_0x5dcdf2)[_0x2714('0xa')](function(_0x4b0c5a){logger['info'](_0x2714('0xb'),_0x36ff44,_0x2714('0xc'));logger['debug'](_0x2714('0xd'),_0x36ff44,_0x2714('0xc'),JSON[_0x2714('0xe')](_0x4b0c5a));if(_0x4b0c5a[_0x2714('0xf')]){if(_0x4b0c5a[_0x2714('0xf')][_0x2714('0x10')]===0x1f4){logger['error'](_0x2714('0xb'),_0x36ff44,_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);return _0xde5fe2(_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);}logger[_0x2714('0xf')](_0x2714('0xb'),_0x36ff44,_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);return _0x59cd4b(_0x4b0c5a['error'][_0x2714('0x11')]);}else{logger[_0x2714('0x12')](_0x2714('0xb'),_0x36ff44,_0x2714('0xc'));_0x59cd4b(_0x4b0c5a[_0x2714('0x13')][_0x2714('0x11')]);}})['catch'](function(_0x534f84){logger['error'](_0x2714('0xb'),_0x36ff44,_0x534f84);_0xde5fe2(_0x534f84);});});} \ No newline at end of file +var _0x1ee1=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x1ee1,0xa6));var _0x11ee=function(_0x4722d8,_0xb14907){_0x4722d8=_0x4722d8-0x0;var _0x38b2d4=_0x1ee1[_0x4722d8];return _0x38b2d4;};'use strict';var _=require(_0x11ee('0x0'));var util=require('util');var moment=require(_0x11ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ee('0x2'));var fs=require('fs');var Redis=require(_0x11ee('0x3'));var db=require(_0x11ee('0x4'))['db'];var utils=require(_0x11ee('0x5'));var logger=require('../../config/logger')(_0x11ee('0x6'));var config=require(_0x11ee('0x7'));var jayson=require(_0x11ee('0x8'));var client=jayson['client'][_0x11ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b2b,_0x4f15f8,_0x5d8cb9){return new BPromise(function(_0x38de62,_0x9f4420){return client[_0x11ee('0xa')](_0x5f1b2b,_0x5d8cb9)[_0x11ee('0xb')](function(_0x1110d8){logger[_0x11ee('0xc')](_0x11ee('0xd'),_0x4f15f8,_0x11ee('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4f15f8,_0x11ee('0xe'),JSON[_0x11ee('0xf')](_0x1110d8));if(_0x1110d8['error']){if(_0x1110d8[_0x11ee('0x10')]['code']===0x1f4){logger[_0x11ee('0x10')](_0x11ee('0xd'),_0x4f15f8,_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);return _0x9f4420(_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);}logger['error'](_0x11ee('0xd'),_0x4f15f8,_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);return _0x38de62(_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);}else{logger[_0x11ee('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x4f15f8,'request\x20sent');_0x38de62(_0x1110d8['result'][_0x11ee('0x11')]);}})[_0x11ee('0x12')](function(_0x3f2128){logger[_0x11ee('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4f15f8,_0x3f2128);_0x9f4420(_0x3f2128);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9982981..f301c62 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 _0x0dba=['/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0dba,0x136));var _0xa0db=function(_0x3e0d9b,_0x1e4467){_0x3e0d9b=_0x3e0d9b-0x0;var _0x1c8716=_0x0dba[_0x3e0d9b];return _0x1c8716;};'use strict';var multer=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var path=require(_0xa0db('0x2'));var timeout=require(_0xa0db('0x3'));var express=require(_0xa0db('0x4'));var router=express[_0xa0db('0x5')]();var fs_extra=require(_0xa0db('0x6'));var auth=require(_0xa0db('0x7'));var interaction=require(_0xa0db('0x8'));var config=require(_0xa0db('0x9'));var controller=require(_0xa0db('0xa'));router[_0xa0db('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0xe')]);router['get'](_0xa0db('0xf'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x10')]);router[_0xa0db('0xb')]('/:id/fields',auth[_0xa0db('0xd')](),controller[_0xa0db('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0db('0x12')]);router[_0xa0db('0x13')](_0xa0db('0xf'),auth[_0xa0db('0xd')](),controller['addConfiguration']);router[_0xa0db('0x14')](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x15')]);router[_0xa0db('0x16')](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x17')]);module[_0xa0db('0x18')]=router; \ No newline at end of file +var _0x4780=['get','isAuthenticated','index','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x4780,0xbe));var _0x0478=function(_0x4a8da8,_0x362222){_0x4a8da8=_0x4a8da8-0x0;var _0x326719=_0x4780[_0x4a8da8];return _0x326719;};'use strict';var multer=require(_0x0478('0x0'));var util=require(_0x0478('0x1'));var path=require('path');var timeout=require(_0x0478('0x2'));var express=require(_0x0478('0x3'));var router=express['Router']();var fs_extra=require(_0x0478('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0478('0x5'));var config=require(_0x0478('0x6'));var controller=require(_0x0478('0x7'));router[_0x0478('0x8')]('/',auth[_0x0478('0x9')](),controller[_0x0478('0xa')]);router[_0x0478('0x8')]('/:id',auth[_0x0478('0x9')](),controller['show']);router[_0x0478('0x8')](_0x0478('0xb'),auth[_0x0478('0x9')](),controller[_0x0478('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x0478('0xd')]);router[_0x0478('0xe')]('/',auth[_0x0478('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x0478('0x9')](),controller[_0x0478('0xf')]);router[_0x0478('0x10')](_0x0478('0x11'),auth['isAuthenticated'](),controller[_0x0478('0x12')]);router[_0x0478('0x13')](_0x0478('0x11'),auth['isAuthenticated'](),controller[_0x0478('0x14')]);module[_0x0478('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d902eb8..97b19c3 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 _0x88e4=['exports','STRING','sequelize'];(function(_0x2f71a0,_0x29f6b4){var _0x25a4cd=function(_0x10abe6){while(--_0x10abe6){_0x2f71a0['push'](_0x2f71a0['shift']());}};_0x25a4cd(++_0x29f6b4);}(_0x88e4,0xa7));var _0x488e=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x88e4[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require(_0x488e('0x0'));module[_0x488e('0x1')]={'name':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x488e('0x2')]},'username':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x488e('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdc00=['STRING','HelpDesk','exports'];(function(_0x652911,_0x3b8615){var _0xb34610=function(_0x56a350){while(--_0x56a350){_0x652911['push'](_0x652911['shift']());}};_0xb34610(++_0x3b8615);}(_0xdc00,0x1ac));var _0x0dc0=function(_0x59e7d5,_0x209fca){_0x59e7d5=_0x59e7d5-0x0;var _0x4eaa4f=_0xdc00[_0x59e7d5];return _0x4eaa4f;};'use strict';var Sequelize=require('sequelize');module[_0x0dc0('0x0')]={'name':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0dc0('0x1')]},'username':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0dc0('0x2')},'remoteUri':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0dc0('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 a951e69..795db1e 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 _0xa910=['picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VtigerAccount','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','POST','result','describe','sessionName','autogenerated','remove','includes','editable','false','label','startsWith','cf_'];(function(_0x2ee368,_0x935ce3){var _0x4cd5d3=function(_0x210a90){while(--_0x210a90){_0x2ee368['push'](_0x2ee368['shift']());}};_0x4cd5d3(++_0x935ce3);}(_0xa910,0x1d5));var _0x0a91=function(_0x5a6fc3,_0x314aa8){_0x5a6fc3=_0x5a6fc3-0x0;var _0x4d3f32=_0xa910[_0x5a6fc3];return _0x4d3f32;};'use strict';var emlformat=require(_0x0a91('0x0'));var rimraf=require(_0x0a91('0x1'));var zipdir=require(_0x0a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a91('0x3'));var moment=require(_0x0a91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a91('0x5'));var util=require(_0x0a91('0x6'));var path=require(_0x0a91('0x7'));var sox=require(_0x0a91('0x8'));var csv=require(_0x0a91('0x9'));var ejs=require(_0x0a91('0xa'));var fs=require('fs');var fs_extra=require(_0x0a91('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a91('0xc'));var jsforce=require(_0x0a91('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a91('0x9'));var querystring=require(_0x0a91('0xe'));var Papa=require(_0x0a91('0xf'));var Redis=require(_0x0a91('0x10'));var authService=require(_0x0a91('0x11'));var qs=require(_0x0a91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a91('0x13'));var logger=require('../../config/logger')(_0x0a91('0x14'));var utils=require('../../config/utils');var config=require(_0x0a91('0x15'));var licenseUtil=require(_0x0a91('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0a91('0x17'));function respondWithStatusCode(_0x2c4885,_0x201473){_0x201473=_0x201473||0xcc;return function(_0x59f2ae){if(_0x59f2ae){return _0x2c4885['sendStatus'](_0x201473);}return _0x2c4885[_0x0a91('0x18')](_0x201473)['end']();};}function respondWithResult(_0x576c21,_0x3d944c){_0x3d944c=_0x3d944c||0xc8;return function(_0x4d31de){if(_0x4d31de){return _0x576c21[_0x0a91('0x18')](_0x3d944c)[_0x0a91('0x19')](_0x4d31de);}};}function respondWithFilteredResult(_0x2987da,_0x343094){return function(_0x1d8769){if(_0x1d8769){var _0x35c628=typeof _0x343094[_0x0a91('0x1a')]===_0x0a91('0x1b')&&typeof _0x343094[_0x0a91('0x1c')]===_0x0a91('0x1b');var _0x4373c6=_0x1d8769[_0x0a91('0x1d')];var _0x3e155d=_0x35c628?0x0:_0x343094[_0x0a91('0x1a')];var _0x3dc9bc=_0x35c628?_0x1d8769['count']:_0x343094[_0x0a91('0x1a')]+_0x343094[_0x0a91('0x1c')];var _0x57d0af;if(_0x3dc9bc>=_0x4373c6){_0x3dc9bc=_0x4373c6;_0x57d0af=0xc8;}else{_0x57d0af=0xce;}_0x2987da[_0x0a91('0x18')](_0x57d0af);return _0x2987da['set'](_0x0a91('0x1e'),_0x3e155d+'-'+_0x3dc9bc+'/'+_0x4373c6)[_0x0a91('0x19')](_0x1d8769);}return null;};}function patchUpdates(_0x888fa4){return function(_0x4642ce){try{jsonpatch[_0x0a91('0x1f')](_0x4642ce,_0x888fa4,!![]);}catch(_0x1de1db){return BPromise[_0x0a91('0x20')](_0x1de1db);}return _0x4642ce[_0x0a91('0x21')]();};}function saveUpdates(_0x471bbb,_0x579730){return function(_0x441635){if(_0x441635){return _0x441635[_0x0a91('0x22')](_0x471bbb)[_0x0a91('0x23')](function(_0x48cb44){return _0x48cb44;});}return null;};}function removeEntity(_0xeb1692,_0x4a6e72){return function(_0x55cd13){if(_0x55cd13){return _0x55cd13[_0x0a91('0x24')]()[_0x0a91('0x23')](function(){_0xeb1692[_0x0a91('0x18')](0xcc)[_0x0a91('0x25')]();});}};}function handleEntityNotFound(_0x42eb6c,_0xee7239){return function(_0x39e75a){if(!_0x39e75a){_0x42eb6c['sendStatus'](0x194);}return _0x39e75a;};}function handleError(_0x4e1389,_0x496d2e){_0x496d2e=_0x496d2e||0x1f4;return function(_0x1173a3){logger[_0x0a91('0x26')](_0x1173a3['stack']);if(_0x1173a3[_0x0a91('0x27')]){delete _0x1173a3[_0x0a91('0x27')];}_0x4e1389['status'](_0x496d2e)[_0x0a91('0x28')](_0x1173a3);};}exports[_0x0a91('0x29')]=function(_0x30a25e,_0x5ee291){var _0x163eb1={},_0x969fbb={},_0x5bf789={'count':0x0,'rows':[]};var _0x3420ef=_[_0x0a91('0x2a')](db[_0x0a91('0x2b')]['rawAttributes'],function(_0x66e3af){return{'name':_0x66e3af['fieldName'],'type':_0x66e3af[_0x0a91('0x2c')]['key']};});_0x969fbb[_0x0a91('0x2d')]=_[_0x0a91('0x2a')](_0x3420ef,_0x0a91('0x27'));_0x969fbb[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x30a25e[_0x0a91('0x2e')]);_0x969fbb['filters']=_['intersection'](_0x969fbb[_0x0a91('0x2d')],_0x969fbb['query']);_0x163eb1['attributes']=_[_0x0a91('0x30')](_0x969fbb[_0x0a91('0x2d')],qs[_0x0a91('0x31')](_0x30a25e['query']['fields']));_0x163eb1[_0x0a91('0x32')]=_0x163eb1[_0x0a91('0x32')][_0x0a91('0x33')]?_0x163eb1['attributes']:_0x969fbb['model'];if(!_0x30a25e['query'][_0x0a91('0x34')](_0x0a91('0x35'))){_0x163eb1['limit']=qs[_0x0a91('0x1c')](_0x30a25e[_0x0a91('0x2e')][_0x0a91('0x1c')]);_0x163eb1['offset']=qs[_0x0a91('0x1a')](_0x30a25e['query']['offset']);}_0x163eb1[_0x0a91('0x36')]=qs[_0x0a91('0x37')](_0x30a25e[_0x0a91('0x2e')][_0x0a91('0x37')]);_0x163eb1[_0x0a91('0x38')]=qs['filters'](_[_0x0a91('0x39')](_0x30a25e['query'],_0x969fbb[_0x0a91('0x3a')]),_0x3420ef);if(_0x30a25e['query']['filter']){_0x163eb1['where']=_[_0x0a91('0x3b')](_0x163eb1[_0x0a91('0x38')],{'$or':_[_0x0a91('0x2a')](_0x3420ef,function(_0x2e9af3){if(_0x2e9af3[_0x0a91('0x2c')]!=='VIRTUAL'){var _0x2fd91f={};_0x2fd91f[_0x2e9af3[_0x0a91('0x27')]]={'$like':'%'+_0x30a25e['query'][_0x0a91('0x3c')]+'%'};return _0x2fd91f;}})});}_0x163eb1=_[_0x0a91('0x3b')]({},_0x163eb1,_0x30a25e['options']);var _0x29e61c={'where':_0x163eb1[_0x0a91('0x38')]};return db[_0x0a91('0x2b')][_0x0a91('0x1d')](_0x29e61c)[_0x0a91('0x23')](function(_0x58492b){_0x5bf789[_0x0a91('0x1d')]=_0x58492b;if(_0x30a25e['query'][_0x0a91('0x3d')]){_0x163eb1[_0x0a91('0x3e')]=[{'all':!![]}];}return db[_0x0a91('0x2b')][_0x0a91('0x3f')](_0x163eb1);})['then'](function(_0x2422cc){_0x5bf789[_0x0a91('0x40')]=_0x2422cc;return _0x5bf789;})[_0x0a91('0x23')](respondWithFilteredResult(_0x5ee291,_0x163eb1))[_0x0a91('0x41')](handleError(_0x5ee291,null));};exports[_0x0a91('0x42')]=function(_0x56634d,_0x27dea3){var _0x48b58e={'raw':![],'where':{'id':_0x56634d[_0x0a91('0x43')]['id']}},_0x38711c={};_0x38711c['model']=_['keys'](db[_0x0a91('0x2b')][_0x0a91('0x44')]);_0x38711c['query']=_[_0x0a91('0x2f')](_0x56634d[_0x0a91('0x2e')]);_0x38711c[_0x0a91('0x3a')]=_[_0x0a91('0x30')](_0x38711c[_0x0a91('0x2d')],_0x38711c[_0x0a91('0x2e')]);_0x48b58e[_0x0a91('0x32')]=_['intersection'](_0x38711c[_0x0a91('0x2d')],qs[_0x0a91('0x31')](_0x56634d[_0x0a91('0x2e')]['fields']));_0x48b58e[_0x0a91('0x32')]=_0x48b58e[_0x0a91('0x32')][_0x0a91('0x33')]?_0x48b58e[_0x0a91('0x32')]:_0x38711c['model'];if(_0x56634d['query'][_0x0a91('0x3d')]){_0x48b58e[_0x0a91('0x3e')]=[{'all':!![]}];}_0x48b58e=_[_0x0a91('0x3b')]({},_0x48b58e,_0x56634d[_0x0a91('0x45')]);return db[_0x0a91('0x2b')]['find'](_0x48b58e)['then'](handleEntityNotFound(_0x27dea3,null))[_0x0a91('0x23')](respondWithResult(_0x27dea3,null))[_0x0a91('0x41')](handleError(_0x27dea3,null));};exports['create']=function(_0x28bd40,_0x2d42e1){return db[_0x0a91('0x2b')][_0x0a91('0x46')](_0x28bd40[_0x0a91('0x47')],{})['then'](respondWithResult(_0x2d42e1,0xc9))[_0x0a91('0x41')](handleError(_0x2d42e1,null));};exports[_0x0a91('0x22')]=function(_0x2b6e73,_0x1299ac){if(_0x2b6e73[_0x0a91('0x47')]['id']){delete _0x2b6e73[_0x0a91('0x47')]['id'];}return db[_0x0a91('0x2b')]['find']({'where':{'id':_0x2b6e73[_0x0a91('0x43')]['id']}})['then'](handleEntityNotFound(_0x1299ac,null))['then'](saveUpdates(_0x2b6e73[_0x0a91('0x47')],null))[_0x0a91('0x23')](respondWithResult(_0x1299ac,null))[_0x0a91('0x41')](handleError(_0x1299ac,null));};exports[_0x0a91('0x24')]=function(_0x12d44d,_0x212051){return db['VtigerAccount'][_0x0a91('0x48')]({'where':{'id':_0x12d44d['params']['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x212051,null))['then'](removeEntity(_0x212051,null))['catch'](handleError(_0x212051,null));};exports[_0x0a91('0x49')]=function(_0x1368ab,_0xed7211,_0x5193cd){var _0xe9c2dd={};var _0x3d8010={};var _0x13a8f7;var _0x947e99;return db[_0x0a91('0x2b')][_0x0a91('0x4a')]({'where':{'id':_0x1368ab[_0x0a91('0x43')]['id']}})['then'](handleEntityNotFound(_0xed7211,null))[_0x0a91('0x23')](function(_0x167acc){if(_0x167acc){_0x13a8f7=_0x167acc;_0x3d8010[_0x0a91('0x2d')]=_['keys'](db[_0x0a91('0x4b')][_0x0a91('0x44')]);_0x3d8010[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x1368ab[_0x0a91('0x2e')]);_0x3d8010[_0x0a91('0x3a')]=_[_0x0a91('0x30')](_0x3d8010['model'],_0x3d8010[_0x0a91('0x2e')]);_0xe9c2dd[_0x0a91('0x32')]=_[_0x0a91('0x30')](_0x3d8010['model'],qs['fields'](_0x1368ab[_0x0a91('0x2e')]['fields']));_0xe9c2dd[_0x0a91('0x32')]=_0xe9c2dd[_0x0a91('0x32')][_0x0a91('0x33')]?_0xe9c2dd['attributes']:_0x3d8010['model'];_0xe9c2dd[_0x0a91('0x36')]=qs[_0x0a91('0x37')](_0x1368ab['query'][_0x0a91('0x37')]);_0xe9c2dd['where']=qs[_0x0a91('0x3a')](_[_0x0a91('0x39')](_0x1368ab['query'],_0x3d8010[_0x0a91('0x3a')]));if(_0x1368ab['query'][_0x0a91('0x3c')]){_0xe9c2dd[_0x0a91('0x38')]=_[_0x0a91('0x3b')](_0xe9c2dd['where'],{'$or':_[_0x0a91('0x2a')](_0xe9c2dd[_0x0a91('0x32')],function(_0x21783a){var _0x4a8823={};_0x4a8823[_0x21783a]={'$like':'%'+_0x1368ab['query'][_0x0a91('0x3c')]+'%'};return _0x4a8823;})});}_0xe9c2dd=_['merge']({},_0xe9c2dd,_0x1368ab[_0x0a91('0x45')]);return _0x13a8f7[_0x0a91('0x49')](_0xe9c2dd);}})[_0x0a91('0x23')](function(_0x1709a6){if(_0x1709a6){_0x947e99=_0x1709a6[_0x0a91('0x33')];if(!_0x1368ab['query']['hasOwnProperty'](_0x0a91('0x35'))){_0xe9c2dd[_0x0a91('0x1c')]=qs[_0x0a91('0x1c')](_0x1368ab[_0x0a91('0x2e')][_0x0a91('0x1c')]);_0xe9c2dd[_0x0a91('0x1a')]=qs[_0x0a91('0x1a')](_0x1368ab[_0x0a91('0x2e')][_0x0a91('0x1a')]);}return _0x13a8f7[_0x0a91('0x49')](_0xe9c2dd);}})[_0x0a91('0x23')](function(_0x1dbb7c){if(_0x1dbb7c){return _0x1dbb7c?{'count':_0x947e99,'rows':_0x1dbb7c}:null;}})[_0x0a91('0x23')](respondWithResult(_0xed7211,null))[_0x0a91('0x41')](handleError(_0xed7211,null));};exports[_0x0a91('0x4c')]=function(_0x2cb87c,_0x363b37,_0x5c52c6){if(_0x2cb87c[_0x0a91('0x47')]['id']){delete _0x2cb87c[_0x0a91('0x47')]['id'];}return db['VtigerAccount'][_0x0a91('0x4a')]({'where':{'id':_0x2cb87c[_0x0a91('0x43')]['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x363b37,null))[_0x0a91('0x23')](function(_0x17eb54){if(_0x17eb54){_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x4d')]=_0x17eb54['id'];_0x2cb87c['body'][_0x0a91('0x4e')]=integrations[_0x0a91('0x4f')](_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x50')],_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x2c')]);_0x2cb87c[_0x0a91('0x47')]['Descriptions']=integrations['getDescriptions'](_0x2cb87c['body'][_0x0a91('0x50')],_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x2c')]);return db[_0x0a91('0x4b')]['create'](_0x2cb87c[_0x0a91('0x47')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x0a91('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x363b37,null))['catch'](handleError(_0x363b37,null));};var md5=require('md5');exports['getFields']=function(_0x48e97a,_0x3cb384,_0x1152d1){var _0x2094b2=null;var _0xfa3198=null;var _0x17de21=null;var _0x17b206=null;var _0x129bce='';return db[_0x0a91('0x2b')][_0x0a91('0x4a')]({'where':{'id':_0x48e97a['params']['id']},'attributes':['id',_0x0a91('0x27'),_0x0a91('0x52'),_0x0a91('0x53'),_0x0a91('0x54'),_0x0a91('0x55'),_0x0a91('0x56'),'accessKey']})[_0x0a91('0x23')](handleEntityNotFound(_0x3cb384,null))['then'](function(_0x4bf2c0){if(_0x4bf2c0){_0x2094b2=_0x4bf2c0[_0x0a91('0x52')];_0xfa3198=_0x4bf2c0[_0x0a91('0x57')];_0x17de21=_0x4bf2c0['moduleName'];_0x129bce=_0x4bf2c0[_0x0a91('0x55')];var _0x2b1a00=_0x129bce[_0x0a91('0x58')](-0x1);if(_0x2b1a00==='/'){_0x129bce=_0x129bce[_0x0a91('0x59')](0x0,_0x129bce[_0x0a91('0x5a')](_0x2b1a00));}_0x17b206=util['format']('%s/webservice.php',_0x129bce);var _0x72f9c1={'method':_0x0a91('0x5b'),'uri':_0x17b206,'qs':{'operation':_0x0a91('0x5c'),'username':_0x4bf2c0['username']},'json':!![]};return rp(_0x72f9c1);}})[_0x0a91('0x23')](function(_0x47df84){if(_0x47df84[_0x0a91('0x5d')]){var _0x5c36d2={'method':_0x0a91('0x5e'),'uri':_0x17b206,'form':{'operation':'login','username':_0x2094b2,'accessKey':md5(_0x47df84[_0x0a91('0x5f')]['token']+_0xfa3198)},'json':!![]};return rp(_0x5c36d2);}})[_0x0a91('0x23')](function(_0x11badb){if(_0x11badb['success']){var _0x157704={'method':'GET','uri':_0x17b206,'qs':{'operation':_0x0a91('0x60'),'username':_0x2094b2,'sessionName':_0x11badb[_0x0a91('0x5f')][_0x0a91('0x61')],'elementType':_0x17de21},'json':!![]};return rp(_0x157704);}})[_0x0a91('0x23')](function(_0x324b8e){if(_0x324b8e[_0x0a91('0x5d')]){var _0x4a2c21=[_0x0a91('0x62'),'reference','owner'];_[_0x0a91('0x63')](_0x324b8e[_0x0a91('0x5f')]['fields'],function(_0x3180d3){return _0x4a2c21[_0x0a91('0x64')](_0x3180d3[_0x0a91('0x2c')]['name']);});_['remove'](_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')],function(_0x6db0a6){return _0x6db0a6[_0x0a91('0x65')]===_0x0a91('0x66');});return{'count':_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')][_0x0a91('0x33')],'rows':_[_0x0a91('0x2a')](_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')],function(_0x4f16cb){return{'id':_0x4f16cb[_0x0a91('0x27')],'name':_0x4f16cb[_0x0a91('0x67')],'custom':_[_0x0a91('0x68')](_0x4f16cb[_0x0a91('0x27')],_0x0a91('0x69'))?!![]:![],'options':_0x4f16cb[_0x0a91('0x2c')][_0x0a91('0x27')]==='picklist'&&_0x4f16cb[_0x0a91('0x2c')]['picklistValues'][_0x0a91('0x33')]>0x0?_[_0x0a91('0x2a')](_0x4f16cb[_0x0a91('0x2c')][_0x0a91('0x6a')],function(_0x8edf6f){return{'name':_0x8edf6f[_0x0a91('0x67')],'value':_0x8edf6f[_0x0a91('0x6b')]};}):[]};})};}})[_0x0a91('0x23')](respondWithResult(_0x3cb384,null))[_0x0a91('0x41')](function(_0x45be8e){console['log'](_0x0a91('0x6c')+_0x45be8e);var _0x2d741a=_0x48e97a[_0x0a91('0x2e')][_0x0a91('0x6d')]?0x1f4:_0x45be8e[_0x0a91('0x6e')]||0x1f4;logger['error'](_0x0a91('0x6f'),_0x0a91('0x70'),_0x2d741a,JSON[_0x0a91('0x71')](_0x45be8e));delete _0x45be8e['name'];if(_0x2d741a===0x191){_0x2d741a=0x190;}_0x3cb384[_0x0a91('0x18')](_0x2d741a)[_0x0a91('0x28')](_0x48e97a[_0x0a91('0x2e')][_0x0a91('0x6d')]?{'message':_0x0a91('0x72'),'statusCode':_0x45be8e[_0x0a91('0x6e')]}:_0x45be8e);});}; \ No newline at end of file +var _0x622f=['vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','VtigerAccount','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','VtigerConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','getchallenge','success','POST','login','result','GET','describe','sessionName','autogenerated','owner','includes','remove','false','label','startsWith','cf_','picklistValues','value','log'];(function(_0x44fa9d,_0x22010f){var _0x3bacab=function(_0x244765){while(--_0x244765){_0x44fa9d['push'](_0x44fa9d['shift']());}};_0x3bacab(++_0x22010f);}(_0x622f,0x16f));var _0xf622=function(_0x3ef180,_0x4fd7f8){_0x3ef180=_0x3ef180-0x0;var _0x3c78f5=_0x622f[_0x3ef180];return _0x3c78f5;};'use strict';var emlformat=require(_0xf622('0x0'));var rimraf=require(_0xf622('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf622('0x2'));var moment=require(_0xf622('0x3'));var BPromise=require(_0xf622('0x4'));var Mustache=require('mustache');var util=require(_0xf622('0x5'));var path=require(_0xf622('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf622('0x7'));var fs=require('fs');var fs_extra=require(_0xf622('0x8'));var _=require(_0xf622('0x9'));var squel=require(_0xf622('0xa'));var crypto=require(_0xf622('0xb'));var jsforce=require(_0xf622('0xc'));var deskjs=require(_0xf622('0xd'));var toCsv=require(_0xf622('0xe'));var querystring=require('querystring');var Papa=require(_0xf622('0xf'));var Redis=require(_0xf622('0x10'));var authService=require(_0xf622('0x11'));var qs=require(_0xf622('0x12'));var as=require(_0xf622('0x13'));var hardwareService=require(_0xf622('0x14'));var logger=require(_0xf622('0x15'))(_0xf622('0x16'));var utils=require(_0xf622('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf622('0x18'));var db=require(_0xf622('0x19'))['db'];var integrations=require(_0xf622('0x1a'));function respondWithStatusCode(_0x32331d,_0x176616){_0x176616=_0x176616||0xcc;return function(_0x1122cf){if(_0x1122cf){return _0x32331d[_0xf622('0x1b')](_0x176616);}return _0x32331d['status'](_0x176616)[_0xf622('0x1c')]();};}function respondWithResult(_0x4aa35a,_0x53d922){_0x53d922=_0x53d922||0xc8;return function(_0xe58c9c){if(_0xe58c9c){return _0x4aa35a['status'](_0x53d922)[_0xf622('0x1d')](_0xe58c9c);}};}function respondWithFilteredResult(_0x4ef915,_0x51b10a){return function(_0x256167){if(_0x256167){var _0x2c61cb=typeof _0x51b10a[_0xf622('0x1e')]===_0xf622('0x1f')&&typeof _0x51b10a[_0xf622('0x20')]===_0xf622('0x1f');var _0x23065f=_0x256167['count'];var _0x563ec4=_0x2c61cb?0x0:_0x51b10a['offset'];var _0x2cf62c=_0x2c61cb?_0x256167[_0xf622('0x21')]:_0x51b10a[_0xf622('0x1e')]+_0x51b10a['limit'];var _0x5eb4d6;if(_0x2cf62c>=_0x23065f){_0x2cf62c=_0x23065f;_0x5eb4d6=0xc8;}else{_0x5eb4d6=0xce;}_0x4ef915[_0xf622('0x22')](_0x5eb4d6);return _0x4ef915['set']('Content-Range',_0x563ec4+'-'+_0x2cf62c+'/'+_0x23065f)[_0xf622('0x1d')](_0x256167);}return null;};}function patchUpdates(_0x1fbb1d){return function(_0x2cfe1d){try{jsonpatch[_0xf622('0x23')](_0x2cfe1d,_0x1fbb1d,!![]);}catch(_0x59b916){return BPromise[_0xf622('0x24')](_0x59b916);}return _0x2cfe1d[_0xf622('0x25')]();};}function saveUpdates(_0x331b29,_0x5ddbd7){return function(_0x488597){if(_0x488597){return _0x488597[_0xf622('0x26')](_0x331b29)[_0xf622('0x27')](function(_0x2fc894){return _0x2fc894;});}return null;};}function removeEntity(_0x48910e,_0x22d13c){return function(_0x41cb63){if(_0x41cb63){return _0x41cb63[_0xf622('0x28')]()[_0xf622('0x27')](function(){_0x48910e[_0xf622('0x22')](0xcc)[_0xf622('0x1c')]();});}};}function handleEntityNotFound(_0x2ba92a,_0x3935ff){return function(_0x5088d1){if(!_0x5088d1){_0x2ba92a[_0xf622('0x1b')](0x194);}return _0x5088d1;};}function handleError(_0x90281,_0x31170c){_0x31170c=_0x31170c||0x1f4;return function(_0x3aea6c){logger[_0xf622('0x29')](_0x3aea6c[_0xf622('0x2a')]);if(_0x3aea6c['name']){delete _0x3aea6c[_0xf622('0x2b')];}_0x90281[_0xf622('0x22')](_0x31170c)['send'](_0x3aea6c);};}exports['index']=function(_0x512156,_0x648ee7){var _0x148bd9={},_0x4d0462={},_0x125cb2={'count':0x0,'rows':[]};var _0x4febc3=_['map'](db[_0xf622('0x2c')][_0xf622('0x2d')],function(_0xb95f90){return{'name':_0xb95f90['fieldName'],'type':_0xb95f90[_0xf622('0x2e')][_0xf622('0x2f')]};});_0x4d0462['model']=_[_0xf622('0x30')](_0x4febc3,'name');_0x4d0462[_0xf622('0x31')]=_['keys'](_0x512156[_0xf622('0x31')]);_0x4d0462[_0xf622('0x32')]=_[_0xf622('0x33')](_0x4d0462[_0xf622('0x34')],_0x4d0462['query']);_0x148bd9[_0xf622('0x35')]=_[_0xf622('0x33')](_0x4d0462[_0xf622('0x34')],qs[_0xf622('0x36')](_0x512156['query'][_0xf622('0x36')]));_0x148bd9[_0xf622('0x35')]=_0x148bd9[_0xf622('0x35')]['length']?_0x148bd9['attributes']:_0x4d0462['model'];if(!_0x512156[_0xf622('0x31')][_0xf622('0x37')](_0xf622('0x38'))){_0x148bd9[_0xf622('0x20')]=qs[_0xf622('0x20')](_0x512156[_0xf622('0x31')][_0xf622('0x20')]);_0x148bd9[_0xf622('0x1e')]=qs[_0xf622('0x1e')](_0x512156[_0xf622('0x31')][_0xf622('0x1e')]);}_0x148bd9[_0xf622('0x39')]=qs['sort'](_0x512156['query'][_0xf622('0x3a')]);_0x148bd9['where']=qs[_0xf622('0x32')](_[_0xf622('0x3b')](_0x512156[_0xf622('0x31')],_0x4d0462[_0xf622('0x32')]),_0x4febc3);if(_0x512156[_0xf622('0x31')][_0xf622('0x3c')]){_0x148bd9[_0xf622('0x3d')]=_[_0xf622('0x3e')](_0x148bd9[_0xf622('0x3d')],{'$or':_['map'](_0x4febc3,function(_0x1cc428){if(_0x1cc428[_0xf622('0x2e')]!==_0xf622('0x3f')){var _0x28c597={};_0x28c597[_0x1cc428['name']]={'$like':'%'+_0x512156['query'][_0xf622('0x3c')]+'%'};return _0x28c597;}})});}_0x148bd9=_[_0xf622('0x3e')]({},_0x148bd9,_0x512156['options']);var _0x1bf3bc={'where':_0x148bd9['where']};return db['VtigerAccount'][_0xf622('0x21')](_0x1bf3bc)['then'](function(_0x2d954b){_0x125cb2[_0xf622('0x21')]=_0x2d954b;if(_0x512156[_0xf622('0x31')][_0xf622('0x40')]){_0x148bd9[_0xf622('0x41')]=[{'all':!![]}];}return db[_0xf622('0x2c')][_0xf622('0x42')](_0x148bd9);})[_0xf622('0x27')](function(_0x56d01e){_0x125cb2[_0xf622('0x43')]=_0x56d01e;return _0x125cb2;})['then'](respondWithFilteredResult(_0x648ee7,_0x148bd9))[_0xf622('0x44')](handleError(_0x648ee7,null));};exports[_0xf622('0x45')]=function(_0x2769ea,_0x3d7cb5){var _0x58ef78={'raw':![],'where':{'id':_0x2769ea[_0xf622('0x46')]['id']}},_0x3df207={};_0x3df207[_0xf622('0x34')]=_['keys'](db['VtigerAccount'][_0xf622('0x2d')]);_0x3df207[_0xf622('0x31')]=_[_0xf622('0x47')](_0x2769ea[_0xf622('0x31')]);_0x3df207[_0xf622('0x32')]=_[_0xf622('0x33')](_0x3df207[_0xf622('0x34')],_0x3df207['query']);_0x58ef78[_0xf622('0x35')]=_[_0xf622('0x33')](_0x3df207['model'],qs[_0xf622('0x36')](_0x2769ea[_0xf622('0x31')][_0xf622('0x36')]));_0x58ef78['attributes']=_0x58ef78['attributes'][_0xf622('0x48')]?_0x58ef78['attributes']:_0x3df207['model'];if(_0x2769ea[_0xf622('0x31')][_0xf622('0x40')]){_0x58ef78[_0xf622('0x41')]=[{'all':!![]}];}_0x58ef78=_['merge']({},_0x58ef78,_0x2769ea[_0xf622('0x49')]);return db['VtigerAccount'][_0xf622('0x4a')](_0x58ef78)[_0xf622('0x27')](handleEntityNotFound(_0x3d7cb5,null))[_0xf622('0x27')](respondWithResult(_0x3d7cb5,null))[_0xf622('0x44')](handleError(_0x3d7cb5,null));};exports[_0xf622('0x4b')]=function(_0x33aaa2,_0x25da23){return db[_0xf622('0x2c')][_0xf622('0x4b')](_0x33aaa2['body'],{})['then'](respondWithResult(_0x25da23,0xc9))[_0xf622('0x44')](handleError(_0x25da23,null));};exports['update']=function(_0x99ed84,_0x291300){if(_0x99ed84['body']['id']){delete _0x99ed84[_0xf622('0x4c')]['id'];}return db[_0xf622('0x2c')][_0xf622('0x4a')]({'where':{'id':_0x99ed84[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x291300,null))['then'](saveUpdates(_0x99ed84[_0xf622('0x4c')],null))['then'](respondWithResult(_0x291300,null))[_0xf622('0x44')](handleError(_0x291300,null));};exports[_0xf622('0x28')]=function(_0x12f373,_0x144821){return db[_0xf622('0x2c')][_0xf622('0x4a')]({'where':{'id':_0x12f373[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x144821,null))['then'](removeEntity(_0x144821,null))[_0xf622('0x44')](handleError(_0x144821,null));};exports['getConfigurations']=function(_0x1feaca,_0x5aeb41,_0x418dd1){var _0x4b0539={};var _0x50be5d={};var _0x57f432;var _0x27198c;return db[_0xf622('0x2c')]['findOne']({'where':{'id':_0x1feaca[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aeb41,null))[_0xf622('0x27')](function(_0x447e92){if(_0x447e92){_0x57f432=_0x447e92;_0x50be5d[_0xf622('0x34')]=_['keys'](db[_0xf622('0x4d')][_0xf622('0x2d')]);_0x50be5d[_0xf622('0x31')]=_[_0xf622('0x47')](_0x1feaca[_0xf622('0x31')]);_0x50be5d['filters']=_['intersection'](_0x50be5d[_0xf622('0x34')],_0x50be5d[_0xf622('0x31')]);_0x4b0539[_0xf622('0x35')]=_[_0xf622('0x33')](_0x50be5d['model'],qs[_0xf622('0x36')](_0x1feaca[_0xf622('0x31')][_0xf622('0x36')]));_0x4b0539[_0xf622('0x35')]=_0x4b0539[_0xf622('0x35')][_0xf622('0x48')]?_0x4b0539['attributes']:_0x50be5d[_0xf622('0x34')];_0x4b0539['order']=qs[_0xf622('0x3a')](_0x1feaca[_0xf622('0x31')][_0xf622('0x3a')]);_0x4b0539['where']=qs[_0xf622('0x32')](_['pick'](_0x1feaca[_0xf622('0x31')],_0x50be5d[_0xf622('0x32')]));if(_0x1feaca[_0xf622('0x31')][_0xf622('0x3c')]){_0x4b0539[_0xf622('0x3d')]=_['merge'](_0x4b0539[_0xf622('0x3d')],{'$or':_['map'](_0x4b0539[_0xf622('0x35')],function(_0xa8a47a){var _0x589962={};_0x589962[_0xa8a47a]={'$like':'%'+_0x1feaca[_0xf622('0x31')]['filter']+'%'};return _0x589962;})});}_0x4b0539=_[_0xf622('0x3e')]({},_0x4b0539,_0x1feaca[_0xf622('0x49')]);return _0x57f432[_0xf622('0x4e')](_0x4b0539);}})[_0xf622('0x27')](function(_0x29084c){if(_0x29084c){_0x27198c=_0x29084c[_0xf622('0x48')];if(!_0x1feaca[_0xf622('0x31')][_0xf622('0x37')](_0xf622('0x38'))){_0x4b0539[_0xf622('0x20')]=qs[_0xf622('0x20')](_0x1feaca[_0xf622('0x31')][_0xf622('0x20')]);_0x4b0539[_0xf622('0x1e')]=qs[_0xf622('0x1e')](_0x1feaca['query'][_0xf622('0x1e')]);}return _0x57f432[_0xf622('0x4e')](_0x4b0539);}})[_0xf622('0x27')](function(_0x2a155c){if(_0x2a155c){return _0x2a155c?{'count':_0x27198c,'rows':_0x2a155c}:null;}})[_0xf622('0x27')](respondWithResult(_0x5aeb41,null))[_0xf622('0x44')](handleError(_0x5aeb41,null));};exports[_0xf622('0x4f')]=function(_0x5831e0,_0x5544b8,_0x125101){if(_0x5831e0[_0xf622('0x4c')]['id']){delete _0x5831e0[_0xf622('0x4c')]['id'];}return db[_0xf622('0x2c')][_0xf622('0x50')]({'where':{'id':_0x5831e0['params']['id']}})[_0xf622('0x27')](handleEntityNotFound(_0x5544b8,null))['then'](function(_0x4c622d){if(_0x4c622d){_0x5831e0[_0xf622('0x4c')][_0xf622('0x51')]=_0x4c622d['id'];_0x5831e0[_0xf622('0x4c')][_0xf622('0x52')]=integrations['getSubjects'](_0x5831e0[_0xf622('0x4c')][_0xf622('0x53')],_0x5831e0['body'][_0xf622('0x2e')]);_0x5831e0['body'][_0xf622('0x54')]=integrations[_0xf622('0x55')](_0x5831e0[_0xf622('0x4c')][_0xf622('0x53')],_0x5831e0[_0xf622('0x4c')][_0xf622('0x2e')]);return db[_0xf622('0x4d')][_0xf622('0x4b')](_0x5831e0[_0xf622('0x4c')],{'include':[{'model':db[_0xf622('0x56')],'as':_0xf622('0x52')},{'model':db[_0xf622('0x56')],'as':_0xf622('0x54')}]});}return null;})[_0xf622('0x27')](respondWithResult(_0x5544b8,null))[_0xf622('0x44')](handleError(_0x5544b8,null));};var md5=require(_0xf622('0x57'));exports[_0xf622('0x58')]=function(_0x3473c5,_0x47ac7e,_0x443512){var _0x25939d=null;var _0x7e58e8=null;var _0x325e03=null;var _0x1cdcb6=null;var _0x2a125f='';return db['VtigerAccount'][_0xf622('0x50')]({'where':{'id':_0x3473c5[_0xf622('0x46')]['id']},'attributes':['id',_0xf622('0x2b'),_0xf622('0x59'),_0xf622('0x5a'),_0xf622('0x5b'),_0xf622('0x5c'),_0xf622('0x5d'),_0xf622('0x5e')]})[_0xf622('0x27')](handleEntityNotFound(_0x47ac7e,null))['then'](function(_0x30a57c){if(_0x30a57c){_0x25939d=_0x30a57c[_0xf622('0x59')];_0x7e58e8=_0x30a57c['accessKey'];_0x325e03=_0x30a57c[_0xf622('0x5b')];_0x2a125f=_0x30a57c[_0xf622('0x5c')];var _0x549287=_0x2a125f[_0xf622('0x5f')](-0x1);if(_0x549287==='/'){_0x2a125f=_0x2a125f[_0xf622('0x60')](0x0,_0x2a125f['lastIndexOf'](_0x549287));}_0x1cdcb6=util['format'](_0xf622('0x61'),_0x2a125f);var _0x49399a={'method':'GET','uri':_0x1cdcb6,'qs':{'operation':_0xf622('0x62'),'username':_0x30a57c[_0xf622('0x59')]},'json':!![]};return rp(_0x49399a);}})[_0xf622('0x27')](function(_0x3643dc){if(_0x3643dc[_0xf622('0x63')]){var _0x15bbf5={'method':_0xf622('0x64'),'uri':_0x1cdcb6,'form':{'operation':_0xf622('0x65'),'username':_0x25939d,'accessKey':md5(_0x3643dc[_0xf622('0x66')]['token']+_0x7e58e8)},'json':!![]};return rp(_0x15bbf5);}})[_0xf622('0x27')](function(_0x12e548){if(_0x12e548[_0xf622('0x63')]){var _0x1e1ecd={'method':_0xf622('0x67'),'uri':_0x1cdcb6,'qs':{'operation':_0xf622('0x68'),'username':_0x25939d,'sessionName':_0x12e548[_0xf622('0x66')][_0xf622('0x69')],'elementType':_0x325e03},'json':!![]};return rp(_0x1e1ecd);}})[_0xf622('0x27')](function(_0x59ba0c){if(_0x59ba0c[_0xf622('0x63')]){var _0x356b6a=[_0xf622('0x6a'),'reference',_0xf622('0x6b')];_['remove'](_0x59ba0c[_0xf622('0x66')]['fields'],function(_0x442247){return _0x356b6a[_0xf622('0x6c')](_0x442247[_0xf622('0x2e')]['name']);});_[_0xf622('0x6d')](_0x59ba0c[_0xf622('0x66')]['fields'],function(_0x552bd1){return _0x552bd1['editable']===_0xf622('0x6e');});return{'count':_0x59ba0c[_0xf622('0x66')][_0xf622('0x36')][_0xf622('0x48')],'rows':_[_0xf622('0x30')](_0x59ba0c[_0xf622('0x66')][_0xf622('0x36')],function(_0x16fb1a){return{'id':_0x16fb1a['name'],'name':_0x16fb1a[_0xf622('0x6f')],'custom':_[_0xf622('0x70')](_0x16fb1a[_0xf622('0x2b')],_0xf622('0x71'))?!![]:![],'options':_0x16fb1a['type'][_0xf622('0x2b')]==='picklist'&&_0x16fb1a[_0xf622('0x2e')][_0xf622('0x72')][_0xf622('0x48')]>0x0?_[_0xf622('0x30')](_0x16fb1a['type']['picklistValues'],function(_0x4b1af8){return{'name':_0x4b1af8[_0xf622('0x6f')],'value':_0x4b1af8[_0xf622('0x73')]};}):[]};})};}})[_0xf622('0x27')](respondWithResult(_0x47ac7e,null))['catch'](function(_0x386b0e){console[_0xf622('0x74')](_0xf622('0x75')+_0x386b0e);var _0x23bfd4=_0x3473c5['query'][_0xf622('0x76')]?0x1f4:_0x386b0e['statusCode']||0x1f4;logger[_0xf622('0x29')](_0xf622('0x77'),_0xf622('0x58'),_0x23bfd4,JSON['stringify'](_0x386b0e));delete _0x386b0e[_0xf622('0x2b')];if(_0x23bfd4===0x191){_0x23bfd4=0x190;}_0x47ac7e[_0xf622('0x22')](_0x23bfd4)['send'](_0x3473c5['query'][_0xf622('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x386b0e[_0xf622('0x78')]}:_0x386b0e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 13855e5..e37e88a 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 _0xb9ab=['VtigerAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa88736,_0x3a1108){var _0x2a1c1b=function(_0x5acd73){while(--_0x5acd73){_0xa88736['push'](_0xa88736['shift']());}};_0x2a1c1b(++_0x3a1108);}(_0xb9ab,0x1c9));var _0xbb9a=function(_0x5e56db,_0x2cf1ad){_0x5e56db=_0x5e56db-0x0;var _0x1750e5=_0xb9ab[_0x5e56db];return _0x1750e5;};'use strict';var _=require(_0xbb9a('0x0'));var util=require(_0xbb9a('0x1'));var logger=require(_0xbb9a('0x2'))(_0xbb9a('0x3'));var moment=require('moment');var BPromise=require(_0xbb9a('0x4'));var rp=require(_0xbb9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb9a('0x6'));var config=require(_0xbb9a('0x7'));var attributes=require(_0xbb9a('0x8'));var integrations=require(_0xbb9a('0x9'));module[_0xbb9a('0xa')]=function(_0x401003,_0x23536a){return _0x401003['define'](_0xbb9a('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4f0=['int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x567cca,_0x416716){var _0x408b16=function(_0x32a220){while(--_0x32a220){_0x567cca['push'](_0x567cca['shift']());}};_0x408b16(++_0x416716);}(_0xa4f0,0x119));var _0x0a4f=function(_0x2f4b13,_0x1193b2){_0x2f4b13=_0x2f4b13-0x0;var _0x3bff04=_0xa4f0[_0x2f4b13];return _0x3bff04;};'use strict';var _=require('lodash');var util=require(_0x0a4f('0x0'));var logger=require(_0x0a4f('0x1'))(_0x0a4f('0x2'));var moment=require('moment');var BPromise=require(_0x0a4f('0x3'));var rp=require(_0x0a4f('0x4'));var fs=require('fs');var path=require(_0x0a4f('0x5'));var rimraf=require(_0x0a4f('0x6'));var config=require(_0x0a4f('0x7'));var attributes=require(_0x0a4f('0x8'));var integrations=require(_0x0a4f('0x9'));module[_0x0a4f('0xa')]=function(_0x4ce0f9,_0x12b4c6){return _0x4ce0f9[_0x0a4f('0xb')](_0x0a4f('0xc'),attributes,{'tableName':_0x0a4f('0xd'),'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 3fcacf3..0067382 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 _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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')]('VtigerAccount,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0x2e54=['error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','map','include','model','ShowVtigerAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4fdf74,_0x14cc37){var _0x5dd711=function(_0x3d2754){while(--_0x3d2754){_0x4fdf74['push'](_0x4fdf74['shift']());}};_0x5dd711(++_0x14cc37);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4658ec,_0x6744b8){_0x4658ec=_0x4658ec-0x0;var _0x1bb2ba=_0x2e54[_0x4658ec];return _0x1bb2ba;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 455af6f..682a191 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 _0xeafd=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeafd,0x14b));var _0xdeaf=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xeafd[_0x261e29];return _0x25ef43;};'use strict';var multer=require('multer');var util=require(_0xdeaf('0x0'));var path=require(_0xdeaf('0x1'));var timeout=require('connect-timeout');var express=require(_0xdeaf('0x2'));var router=express[_0xdeaf('0x3')]();var fs_extra=require(_0xdeaf('0x4'));var auth=require(_0xdeaf('0x5'));var interaction=require(_0xdeaf('0x6'));var config=require(_0xdeaf('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x9')]);router[_0xdeaf('0xa')](_0xdeaf('0xb'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0xc')]);router[_0xdeaf('0xa')](_0xdeaf('0xd'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0xe')]);router['get'](_0xdeaf('0xf'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x10')]);router[_0xdeaf('0xa')](_0xdeaf('0x11'),auth['isAuthenticated'](),controller[_0xdeaf('0x12')]);router[_0xdeaf('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdeaf('0x14')]('/:id',auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x15')]);router['delete'](_0xdeaf('0xb'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x16')]);module[_0xdeaf('0x17')]=router; \ No newline at end of file +var _0xde2d=['Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1f60ed,_0x3fa9d8){var _0x3ccb8d=function(_0x2d1840){while(--_0x2d1840){_0x1f60ed['push'](_0x1f60ed['shift']());}};_0x3ccb8d(++_0x3fa9d8);}(_0xde2d,0x67));var _0xdde2=function(_0x5b3c61,_0x3eb2aa){_0x5b3c61=_0x5b3c61-0x0;var _0x153389=_0xde2d[_0x5b3c61];return _0x153389;};'use strict';var multer=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var path=require(_0xdde2('0x2'));var timeout=require(_0xdde2('0x3'));var express=require(_0xdde2('0x4'));var router=express[_0xdde2('0x5')]();var fs_extra=require(_0xdde2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdde2('0x7'));var config=require('../../config/environment');var controller=require(_0xdde2('0x8'));router[_0xdde2('0x9')]('/',auth[_0xdde2('0xa')](),controller[_0xdde2('0xb')]);router['get'](_0xdde2('0xc'),auth['isAuthenticated'](),controller[_0xdde2('0xd')]);router[_0xdde2('0x9')](_0xdde2('0xe'),auth['isAuthenticated'](),controller[_0xdde2('0xf')]);router[_0xdde2('0x9')](_0xdde2('0x10'),auth[_0xdde2('0xa')](),controller[_0xdde2('0x11')]);router[_0xdde2('0x9')](_0xdde2('0x12'),auth['isAuthenticated'](),controller[_0xdde2('0x13')]);router[_0xdde2('0x14')]('/',auth[_0xdde2('0xa')](),controller[_0xdde2('0x15')]);router[_0xdde2('0x16')]('/:id',auth[_0xdde2('0xa')](),controller[_0xdde2('0x17')]);router[_0xdde2('0x18')]('/:id',auth[_0xdde2('0xa')](),controller[_0xdde2('0x19')]);module[_0xdde2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c35bdbc..cc05c22 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 _0x7737=['sequelize'];(function(_0x44fd6b,_0x338098){var _0x7cba12=function(_0x5a6bb5){while(--_0x5a6bb5){_0x44fd6b['push'](_0x44fd6b['shift']());}};_0x7cba12(++_0x338098);}(_0x7737,0xb1));var _0x7773=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x7737[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x7773('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe83c=['STRING','sequelize','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xe83c,0x91));var _0xce83=function(_0x580a59,_0x21266c){_0x580a59=_0x580a59-0x0;var _0x19da51=_0xe83c[_0x580a59];return _0x19da51;};'use strict';var Sequelize=require(_0xce83('0x0'));module[_0xce83('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce83('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e08a88f..b2c0261 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 _0x239c=['json','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','where','options','include','findAll','rows','show','params','keys','length','includeAll','find','catch','create','body','getFields','VtigerField','order','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range'];(function(_0x3fa594,_0x3c8e74){var _0x5c5c62=function(_0x1d26ca){while(--_0x1d26ca){_0x3fa594['push'](_0x3fa594['shift']());}};_0x5c5c62(++_0x3c8e74);}(_0x239c,0x7b));var _0xc239=function(_0x4780cc,_0x4c3674){_0x4780cc=_0x4780cc-0x0;var _0x4ee746=_0x239c[_0x4780cc];return _0x4ee746;};'use strict';var emlformat=require(_0xc239('0x0'));var rimraf=require(_0xc239('0x1'));var zipdir=require(_0xc239('0x2'));var jsonpatch=require(_0xc239('0x3'));var rp=require(_0xc239('0x4'));var moment=require(_0xc239('0x5'));var BPromise=require(_0xc239('0x6'));var Mustache=require(_0xc239('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc239('0x8'));var csv=require(_0xc239('0x9'));var ejs=require(_0xc239('0xa'));var fs=require('fs');var fs_extra=require(_0xc239('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc239('0xc'));var toCsv=require(_0xc239('0x9'));var querystring=require('querystring');var Papa=require(_0xc239('0xd'));var Redis=require('ioredis');var authService=require(_0xc239('0xe'));var qs=require(_0xc239('0xf'));var as=require(_0xc239('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc239('0x11'))('api');var utils=require(_0xc239('0x12'));var config=require(_0xc239('0x13'));var licenseUtil=require(_0xc239('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8b47,_0x374cfa){_0x374cfa=_0x374cfa||0xcc;return function(_0x520b90){if(_0x520b90){return _0x3f8b47['sendStatus'](_0x374cfa);}return _0x3f8b47[_0xc239('0x15')](_0x374cfa)['end']();};}function respondWithResult(_0xe0ed18,_0x2dfed4){_0x2dfed4=_0x2dfed4||0xc8;return function(_0x186b95){if(_0x186b95){return _0xe0ed18['status'](_0x2dfed4)['json'](_0x186b95);}};}function respondWithFilteredResult(_0x1a6e26,_0x39a9ba){return function(_0x1a99ec){if(_0x1a99ec){var _0x31dc9e=typeof _0x39a9ba[_0xc239('0x16')]===_0xc239('0x17')&&typeof _0x39a9ba[_0xc239('0x18')]===_0xc239('0x17');var _0x44f1d5=_0x1a99ec[_0xc239('0x19')];var _0x4fa436=_0x31dc9e?0x0:_0x39a9ba['offset'];var _0x2d17af=_0x31dc9e?_0x1a99ec[_0xc239('0x19')]:_0x39a9ba['offset']+_0x39a9ba[_0xc239('0x18')];var _0x2de5a3;if(_0x2d17af>=_0x44f1d5){_0x2d17af=_0x44f1d5;_0x2de5a3=0xc8;}else{_0x2de5a3=0xce;}_0x1a6e26[_0xc239('0x15')](_0x2de5a3);return _0x1a6e26['set'](_0xc239('0x1a'),_0x4fa436+'-'+_0x2d17af+'/'+_0x44f1d5)[_0xc239('0x1b')](_0x1a99ec);}return null;};}function patchUpdates(_0x26d1a1){return function(_0x34a3bc){try{jsonpatch[_0xc239('0x1c')](_0x34a3bc,_0x26d1a1,!![]);}catch(_0x3e4408){return BPromise[_0xc239('0x1d')](_0x3e4408);}return _0x34a3bc[_0xc239('0x1e')]();};}function saveUpdates(_0x286ec5,_0x1c6acb){return function(_0x59f60f){if(_0x59f60f){return _0x59f60f['update'](_0x286ec5)['then'](function(_0x34f163){return _0x34f163;});}return null;};}function removeEntity(_0xea633,_0x1aa6a7){return function(_0xcef68f){if(_0xcef68f){return _0xcef68f[_0xc239('0x1f')]()[_0xc239('0x20')](function(){_0xea633[_0xc239('0x15')](0xcc)[_0xc239('0x21')]();});}};}function handleEntityNotFound(_0x1da673,_0x2c293d){return function(_0x55ba42){if(!_0x55ba42){_0x1da673[_0xc239('0x22')](0x194);}return _0x55ba42;};}function handleError(_0xc7e4fc,_0x12f2b6){_0x12f2b6=_0x12f2b6||0x1f4;return function(_0x334c81){logger[_0xc239('0x23')](_0x334c81[_0xc239('0x24')]);if(_0x334c81[_0xc239('0x25')]){delete _0x334c81['name'];}_0xc7e4fc[_0xc239('0x15')](_0x12f2b6)['send'](_0x334c81);};}exports['index']=function(_0x4368a9,_0x11fafa){var _0xeebf19={},_0x3803e3={},_0x5546c7={'count':0x0,'rows':[]};var _0x34dd0b=_[_0xc239('0x26')](db[_0xc239('0x27')][_0xc239('0x28')],function(_0x195a81){return{'name':_0x195a81[_0xc239('0x29')],'type':_0x195a81[_0xc239('0x2a')]['key']};});_0x3803e3[_0xc239('0x2b')]=_[_0xc239('0x26')](_0x34dd0b,_0xc239('0x25'));_0x3803e3['query']=_['keys'](_0x4368a9[_0xc239('0x2c')]);_0x3803e3[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x3803e3[_0xc239('0x2b')],_0x3803e3[_0xc239('0x2c')]);_0xeebf19[_0xc239('0x2f')]=_['intersection'](_0x3803e3[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x4368a9[_0xc239('0x2c')]['fields']));_0xeebf19[_0xc239('0x2f')]=_0xeebf19[_0xc239('0x2f')]['length']?_0xeebf19[_0xc239('0x2f')]:_0x3803e3['model'];if(!_0x4368a9[_0xc239('0x2c')][_0xc239('0x31')]('nolimit')){_0xeebf19[_0xc239('0x18')]=qs[_0xc239('0x18')](_0x4368a9[_0xc239('0x2c')]['limit']);_0xeebf19['offset']=qs[_0xc239('0x16')](_0x4368a9[_0xc239('0x2c')][_0xc239('0x16')]);}_0xeebf19['order']=qs[_0xc239('0x32')](_0x4368a9[_0xc239('0x2c')][_0xc239('0x32')]);_0xeebf19['where']=qs[_0xc239('0x2d')](_[_0xc239('0x33')](_0x4368a9[_0xc239('0x2c')],_0x3803e3[_0xc239('0x2d')]),_0x34dd0b);if(_0x4368a9['query'][_0xc239('0x34')]){_0xeebf19['where']=_[_0xc239('0x35')](_0xeebf19[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x34dd0b,function(_0x2c3515){if(_0x2c3515[_0xc239('0x2a')]!=='VIRTUAL'){var _0x11b918={};_0x11b918[_0x2c3515['name']]={'$like':'%'+_0x4368a9['query']['filter']+'%'};return _0x11b918;}})});}_0xeebf19=_[_0xc239('0x35')]({},_0xeebf19,_0x4368a9[_0xc239('0x37')]);var _0x3565fb={'where':_0xeebf19['where']};return db[_0xc239('0x27')][_0xc239('0x19')](_0x3565fb)[_0xc239('0x20')](function(_0x578f77){_0x5546c7[_0xc239('0x19')]=_0x578f77;if(_0x4368a9[_0xc239('0x2c')]['includeAll']){_0xeebf19[_0xc239('0x38')]=[{'all':!![]}];}return db[_0xc239('0x27')][_0xc239('0x39')](_0xeebf19);})[_0xc239('0x20')](function(_0x45b860){_0x5546c7[_0xc239('0x3a')]=_0x45b860;return _0x5546c7;})[_0xc239('0x20')](respondWithFilteredResult(_0x11fafa,_0xeebf19))['catch'](handleError(_0x11fafa,null));};exports[_0xc239('0x3b')]=function(_0x305fb1,_0x463e7d){var _0x197f14={'raw':![],'where':{'id':_0x305fb1[_0xc239('0x3c')]['id']}},_0x10901c={};_0x10901c[_0xc239('0x2b')]=_[_0xc239('0x3d')](db['VtigerConfiguration'][_0xc239('0x28')]);_0x10901c[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x305fb1[_0xc239('0x2c')]);_0x10901c[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x10901c[_0xc239('0x2b')],_0x10901c[_0xc239('0x2c')]);_0x197f14[_0xc239('0x2f')]=_[_0xc239('0x2e')](_0x10901c[_0xc239('0x2b')],qs['fields'](_0x305fb1[_0xc239('0x2c')]['fields']));_0x197f14[_0xc239('0x2f')]=_0x197f14['attributes'][_0xc239('0x3e')]?_0x197f14['attributes']:_0x10901c[_0xc239('0x2b')];if(_0x305fb1['query'][_0xc239('0x3f')]){_0x197f14[_0xc239('0x38')]=[{'all':!![]}];}_0x197f14=_[_0xc239('0x35')]({},_0x197f14,_0x305fb1['options']);return db[_0xc239('0x27')][_0xc239('0x40')](_0x197f14)['then'](handleEntityNotFound(_0x463e7d,null))[_0xc239('0x20')](respondWithResult(_0x463e7d,null))[_0xc239('0x41')](handleError(_0x463e7d,null));};exports[_0xc239('0x42')]=function(_0x5bfb15,_0x441c11){return db[_0xc239('0x27')][_0xc239('0x42')](_0x5bfb15[_0xc239('0x43')],{})['then'](respondWithResult(_0x441c11,0xc9))[_0xc239('0x41')](handleError(_0x441c11,null));};exports['update']=function(_0x53aba0,_0x13ce1b){if(_0x53aba0[_0xc239('0x43')]['id']){delete _0x53aba0[_0xc239('0x43')]['id'];}return db[_0xc239('0x27')][_0xc239('0x40')]({'where':{'id':_0x53aba0[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x13ce1b,null))[_0xc239('0x20')](saveUpdates(_0x53aba0['body'],null))[_0xc239('0x20')](respondWithResult(_0x13ce1b,null))['catch'](handleError(_0x13ce1b,null));};exports['destroy']=function(_0x36c6f3,_0x28a2bf){return db[_0xc239('0x27')][_0xc239('0x40')]({'where':{'id':_0x36c6f3[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x28a2bf,null))[_0xc239('0x20')](removeEntity(_0x28a2bf,null))[_0xc239('0x41')](handleError(_0x28a2bf,null));};exports[_0xc239('0x44')]=function(_0x3c94c3,_0x2a9c1d,_0xa9e53){var _0x42f8af={};var _0x3f6558={};var _0x11305b;var _0xc1d627;return db[_0xc239('0x27')]['findOne']({'where':{'id':_0x3c94c3[_0xc239('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a9c1d,null))[_0xc239('0x20')](function(_0x387a09){if(_0x387a09){_0x11305b=_0x387a09;_0x3f6558[_0xc239('0x2b')]=_[_0xc239('0x3d')](db[_0xc239('0x45')][_0xc239('0x28')]);_0x3f6558[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x3c94c3['query']);_0x3f6558[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x3f6558[_0xc239('0x2b')],_0x3f6558[_0xc239('0x2c')]);_0x42f8af['attributes']=_[_0xc239('0x2e')](_0x3f6558['model'],qs[_0xc239('0x30')](_0x3c94c3[_0xc239('0x2c')][_0xc239('0x30')]));_0x42f8af[_0xc239('0x2f')]=_0x42f8af[_0xc239('0x2f')][_0xc239('0x3e')]?_0x42f8af['attributes']:_0x3f6558[_0xc239('0x2b')];_0x42f8af[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x3c94c3[_0xc239('0x2c')]['sort']);_0x42f8af[_0xc239('0x36')]=qs['filters'](_[_0xc239('0x33')](_0x3c94c3[_0xc239('0x2c')],_0x3f6558[_0xc239('0x2d')]));if(_0x3c94c3[_0xc239('0x2c')][_0xc239('0x34')]){_0x42f8af[_0xc239('0x36')]=_[_0xc239('0x35')](_0x42f8af[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x42f8af[_0xc239('0x2f')],function(_0x25f142){var _0x16820a={};_0x16820a[_0x25f142]={'$like':'%'+_0x3c94c3[_0xc239('0x2c')][_0xc239('0x34')]+'%'};return _0x16820a;})});}_0x42f8af=_[_0xc239('0x35')]({},_0x42f8af,_0x3c94c3['options']);return _0x11305b[_0xc239('0x44')](_0x42f8af);}})['then'](function(_0xa84bc4){if(_0xa84bc4){_0xc1d627=_0xa84bc4['length'];if(!_0x3c94c3[_0xc239('0x2c')]['hasOwnProperty'](_0xc239('0x47'))){_0x42f8af[_0xc239('0x18')]=qs['limit'](_0x3c94c3[_0xc239('0x2c')][_0xc239('0x18')]);_0x42f8af['offset']=qs[_0xc239('0x16')](_0x3c94c3[_0xc239('0x2c')]['offset']);}return _0x11305b[_0xc239('0x44')](_0x42f8af);}})['then'](function(_0x2258fe){if(_0x2258fe){return _0x2258fe?{'count':_0xc1d627,'rows':_0x2258fe}:null;}})['then'](respondWithResult(_0x2a9c1d,null))[_0xc239('0x41')](handleError(_0x2a9c1d,null));};exports['getSubjects']=function(_0x39874a,_0x4b925e,_0x5631f6){var _0x3ec333={};var _0x4a0e26={};var _0x47d0d6;var _0x42ac2e;return db[_0xc239('0x27')][_0xc239('0x48')]({'where':{'id':_0x39874a[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x4b925e,null))[_0xc239('0x20')](function(_0x526fa8){if(_0x526fa8){_0x47d0d6=_0x526fa8;_0x4a0e26[_0xc239('0x2b')]=_[_0xc239('0x3d')](db[_0xc239('0x45')][_0xc239('0x28')]);_0x4a0e26[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x39874a[_0xc239('0x2c')]);_0x4a0e26[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x4a0e26[_0xc239('0x2b')],_0x4a0e26[_0xc239('0x2c')]);_0x3ec333['attributes']=_[_0xc239('0x2e')](_0x4a0e26[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x39874a[_0xc239('0x2c')][_0xc239('0x30')]));_0x3ec333[_0xc239('0x2f')]=_0x3ec333[_0xc239('0x2f')][_0xc239('0x3e')]?_0x3ec333['attributes']:_0x4a0e26['model'];_0x3ec333[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x39874a[_0xc239('0x2c')][_0xc239('0x32')]);_0x3ec333[_0xc239('0x36')]=qs[_0xc239('0x2d')](_['pick'](_0x39874a[_0xc239('0x2c')],_0x4a0e26[_0xc239('0x2d')]));if(_0x39874a['query'][_0xc239('0x34')]){_0x3ec333['where']=_[_0xc239('0x35')](_0x3ec333[_0xc239('0x36')],{'$or':_['map'](_0x3ec333['attributes'],function(_0x5e2bd8){var _0x560b7d={};_0x560b7d[_0x5e2bd8]={'$like':'%'+_0x39874a['query'][_0xc239('0x34')]+'%'};return _0x560b7d;})});}_0x3ec333=_[_0xc239('0x35')]({},_0x3ec333,_0x39874a[_0xc239('0x37')]);return _0x47d0d6[_0xc239('0x49')](_0x3ec333);}})[_0xc239('0x20')](function(_0x16749d){if(_0x16749d){_0x42ac2e=_0x16749d[_0xc239('0x3e')];if(!_0x39874a[_0xc239('0x2c')][_0xc239('0x31')](_0xc239('0x47'))){_0x3ec333[_0xc239('0x18')]=qs['limit'](_0x39874a[_0xc239('0x2c')][_0xc239('0x18')]);_0x3ec333[_0xc239('0x16')]=qs[_0xc239('0x16')](_0x39874a[_0xc239('0x2c')][_0xc239('0x16')]);}return _0x47d0d6[_0xc239('0x49')](_0x3ec333);}})['then'](function(_0x2f1bb8){if(_0x2f1bb8){return _0x2f1bb8?{'count':_0x42ac2e,'rows':_0x2f1bb8}:null;}})[_0xc239('0x20')](respondWithResult(_0x4b925e,null))['catch'](handleError(_0x4b925e,null));};exports[_0xc239('0x4a')]=function(_0x105557,_0x4708ce,_0xaa3fa8){var _0x358f45={};var _0x311829={};var _0x7e31f9;var _0x202f17;return db['VtigerConfiguration'][_0xc239('0x48')]({'where':{'id':_0x105557['params']['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x4708ce,null))[_0xc239('0x20')](function(_0x5c9588){if(_0x5c9588){_0x7e31f9=_0x5c9588;_0x311829['model']=_['keys'](db[_0xc239('0x45')]['rawAttributes']);_0x311829[_0xc239('0x2c')]=_['keys'](_0x105557[_0xc239('0x2c')]);_0x311829[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x311829[_0xc239('0x2b')],_0x311829[_0xc239('0x2c')]);_0x358f45[_0xc239('0x2f')]=_[_0xc239('0x2e')](_0x311829[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x105557[_0xc239('0x2c')][_0xc239('0x30')]));_0x358f45[_0xc239('0x2f')]=_0x358f45['attributes'][_0xc239('0x3e')]?_0x358f45[_0xc239('0x2f')]:_0x311829['model'];_0x358f45[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x105557[_0xc239('0x2c')][_0xc239('0x32')]);_0x358f45['where']=qs[_0xc239('0x2d')](_['pick'](_0x105557[_0xc239('0x2c')],_0x311829[_0xc239('0x2d')]));if(_0x105557['query'][_0xc239('0x34')]){_0x358f45['where']=_[_0xc239('0x35')](_0x358f45[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x358f45['attributes'],function(_0x2e73c0){var _0x141d80={};_0x141d80[_0x2e73c0]={'$like':'%'+_0x105557['query'][_0xc239('0x34')]+'%'};return _0x141d80;})});}_0x358f45=_[_0xc239('0x35')]({},_0x358f45,_0x105557[_0xc239('0x37')]);return _0x7e31f9[_0xc239('0x4a')](_0x358f45);}})['then'](function(_0x5c7fd2){if(_0x5c7fd2){_0x202f17=_0x5c7fd2[_0xc239('0x3e')];if(!_0x105557['query']['hasOwnProperty'](_0xc239('0x47'))){_0x358f45['limit']=qs['limit'](_0x105557[_0xc239('0x2c')]['limit']);_0x358f45[_0xc239('0x16')]=qs[_0xc239('0x16')](_0x105557[_0xc239('0x2c')][_0xc239('0x16')]);}return _0x7e31f9[_0xc239('0x4a')](_0x358f45);}})[_0xc239('0x20')](function(_0x26a3e5){if(_0x26a3e5){return _0x26a3e5?{'count':_0x202f17,'rows':_0x26a3e5}:null;}})[_0xc239('0x20')](respondWithResult(_0x4708ce,null))['catch'](handleError(_0x4708ce,null));}; \ No newline at end of file +var _0xd82a=['merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','update','getFields','findOne','VtigerField','sort','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd82a,0xbd));var _0xad82=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd82a[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0xad82('0x0'));var rimraf=require(_0xad82('0x1'));var zipdir=require(_0xad82('0x2'));var jsonpatch=require(_0xad82('0x3'));var rp=require('request-promise');var moment=require(_0xad82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad82('0x5'));var util=require(_0xad82('0x6'));var path=require(_0xad82('0x7'));var sox=require(_0xad82('0x8'));var csv=require(_0xad82('0x9'));var ejs=require(_0xad82('0xa'));var fs=require('fs');var fs_extra=require(_0xad82('0xb'));var _=require(_0xad82('0xc'));var squel=require(_0xad82('0xd'));var crypto=require(_0xad82('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad82('0xf'));var toCsv=require(_0xad82('0x9'));var querystring=require(_0xad82('0x10'));var Papa=require(_0xad82('0x11'));var Redis=require(_0xad82('0x12'));var authService=require(_0xad82('0x13'));var qs=require(_0xad82('0x14'));var as=require(_0xad82('0x15'));var hardwareService=require(_0xad82('0x16'));var logger=require(_0xad82('0x17'))(_0xad82('0x18'));var utils=require(_0xad82('0x19'));var config=require(_0xad82('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xad82('0x1b'))['db'];function respondWithStatusCode(_0x557bc9,_0x21cc8d){_0x21cc8d=_0x21cc8d||0xcc;return function(_0x5b265f){if(_0x5b265f){return _0x557bc9[_0xad82('0x1c')](_0x21cc8d);}return _0x557bc9[_0xad82('0x1d')](_0x21cc8d)[_0xad82('0x1e')]();};}function respondWithResult(_0x26921d,_0xb6c3ab){_0xb6c3ab=_0xb6c3ab||0xc8;return function(_0x1646e4){if(_0x1646e4){return _0x26921d['status'](_0xb6c3ab)[_0xad82('0x1f')](_0x1646e4);}};}function respondWithFilteredResult(_0x4cc267,_0x6871ec){return function(_0x433f8a){if(_0x433f8a){var _0x37cb6a=typeof _0x6871ec[_0xad82('0x20')]===_0xad82('0x21')&&typeof _0x6871ec[_0xad82('0x22')]===_0xad82('0x21');var _0x3f682d=_0x433f8a[_0xad82('0x23')];var _0x3c95d8=_0x37cb6a?0x0:_0x6871ec[_0xad82('0x20')];var _0x130aa3=_0x37cb6a?_0x433f8a[_0xad82('0x23')]:_0x6871ec[_0xad82('0x20')]+_0x6871ec[_0xad82('0x22')];var _0x1d0218;if(_0x130aa3>=_0x3f682d){_0x130aa3=_0x3f682d;_0x1d0218=0xc8;}else{_0x1d0218=0xce;}_0x4cc267['status'](_0x1d0218);return _0x4cc267[_0xad82('0x24')](_0xad82('0x25'),_0x3c95d8+'-'+_0x130aa3+'/'+_0x3f682d)['json'](_0x433f8a);}return null;};}function patchUpdates(_0x43c86e){return function(_0x5080dd){try{jsonpatch[_0xad82('0x26')](_0x5080dd,_0x43c86e,!![]);}catch(_0x11ab07){return BPromise['reject'](_0x11ab07);}return _0x5080dd[_0xad82('0x27')]();};}function saveUpdates(_0x1ab491,_0x261bb4){return function(_0x5bb38b){if(_0x5bb38b){return _0x5bb38b['update'](_0x1ab491)[_0xad82('0x28')](function(_0x1857d7){return _0x1857d7;});}return null;};}function removeEntity(_0x4be179,_0x19de41){return function(_0x822821){if(_0x822821){return _0x822821[_0xad82('0x29')]()[_0xad82('0x28')](function(){_0x4be179['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3661ca,_0x1630a7){return function(_0x4157d5){if(!_0x4157d5){_0x3661ca[_0xad82('0x1c')](0x194);}return _0x4157d5;};}function handleError(_0xad7f3b,_0x531bce){_0x531bce=_0x531bce||0x1f4;return function(_0xac5104){logger[_0xad82('0x2a')](_0xac5104['stack']);if(_0xac5104[_0xad82('0x2b')]){delete _0xac5104['name'];}_0xad7f3b[_0xad82('0x1d')](_0x531bce)['send'](_0xac5104);};}exports[_0xad82('0x2c')]=function(_0x3443f4,_0x9ddc72){var _0x4036dd={},_0x5b127e={},_0x1fcb5f={'count':0x0,'rows':[]};var _0x54891b=_[_0xad82('0x2d')](db[_0xad82('0x2e')][_0xad82('0x2f')],function(_0x858e8){return{'name':_0x858e8['fieldName'],'type':_0x858e8[_0xad82('0x30')][_0xad82('0x31')]};});_0x5b127e[_0xad82('0x32')]=_[_0xad82('0x2d')](_0x54891b,_0xad82('0x2b'));_0x5b127e[_0xad82('0x33')]=_['keys'](_0x3443f4[_0xad82('0x33')]);_0x5b127e[_0xad82('0x34')]=_['intersection'](_0x5b127e[_0xad82('0x32')],_0x5b127e['query']);_0x4036dd['attributes']=_[_0xad82('0x35')](_0x5b127e[_0xad82('0x32')],qs[_0xad82('0x36')](_0x3443f4['query'][_0xad82('0x36')]));_0x4036dd[_0xad82('0x37')]=_0x4036dd[_0xad82('0x37')]['length']?_0x4036dd['attributes']:_0x5b127e[_0xad82('0x32')];if(!_0x3443f4[_0xad82('0x33')][_0xad82('0x38')]('nolimit')){_0x4036dd[_0xad82('0x22')]=qs['limit'](_0x3443f4[_0xad82('0x33')][_0xad82('0x22')]);_0x4036dd[_0xad82('0x20')]=qs['offset'](_0x3443f4['query'][_0xad82('0x20')]);}_0x4036dd[_0xad82('0x39')]=qs['sort'](_0x3443f4[_0xad82('0x33')]['sort']);_0x4036dd[_0xad82('0x3a')]=qs['filters'](_[_0xad82('0x3b')](_0x3443f4[_0xad82('0x33')],_0x5b127e[_0xad82('0x34')]),_0x54891b);if(_0x3443f4[_0xad82('0x33')]['filter']){_0x4036dd['where']=_[_0xad82('0x3c')](_0x4036dd[_0xad82('0x3a')],{'$or':_[_0xad82('0x2d')](_0x54891b,function(_0x29ab7b){if(_0x29ab7b[_0xad82('0x30')]!==_0xad82('0x3d')){var _0x333528={};_0x333528[_0x29ab7b[_0xad82('0x2b')]]={'$like':'%'+_0x3443f4[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x333528;}})});}_0x4036dd=_['merge']({},_0x4036dd,_0x3443f4['options']);var _0x5d16dd={'where':_0x4036dd['where']};return db['VtigerConfiguration'][_0xad82('0x23')](_0x5d16dd)[_0xad82('0x28')](function(_0x3aa4e0){_0x1fcb5f[_0xad82('0x23')]=_0x3aa4e0;if(_0x3443f4[_0xad82('0x33')][_0xad82('0x3f')]){_0x4036dd[_0xad82('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x4036dd);})[_0xad82('0x28')](function(_0x5ee57c){_0x1fcb5f[_0xad82('0x41')]=_0x5ee57c;return _0x1fcb5f;})[_0xad82('0x28')](respondWithFilteredResult(_0x9ddc72,_0x4036dd))[_0xad82('0x42')](handleError(_0x9ddc72,null));};exports[_0xad82('0x43')]=function(_0x4809ad,_0x402314){var _0x7bd093={'raw':![],'where':{'id':_0x4809ad[_0xad82('0x44')]['id']}},_0x3d1f6f={};_0x3d1f6f['model']=_['keys'](db[_0xad82('0x2e')]['rawAttributes']);_0x3d1f6f[_0xad82('0x33')]=_[_0xad82('0x45')](_0x4809ad[_0xad82('0x33')]);_0x3d1f6f['filters']=_['intersection'](_0x3d1f6f[_0xad82('0x32')],_0x3d1f6f[_0xad82('0x33')]);_0x7bd093['attributes']=_[_0xad82('0x35')](_0x3d1f6f[_0xad82('0x32')],qs[_0xad82('0x36')](_0x4809ad['query']['fields']));_0x7bd093['attributes']=_0x7bd093[_0xad82('0x37')][_0xad82('0x46')]?_0x7bd093['attributes']:_0x3d1f6f[_0xad82('0x32')];if(_0x4809ad[_0xad82('0x33')][_0xad82('0x3f')]){_0x7bd093[_0xad82('0x40')]=[{'all':!![]}];}_0x7bd093=_['merge']({},_0x7bd093,_0x4809ad[_0xad82('0x47')]);return db[_0xad82('0x2e')][_0xad82('0x48')](_0x7bd093)['then'](handleEntityNotFound(_0x402314,null))[_0xad82('0x28')](respondWithResult(_0x402314,null))[_0xad82('0x42')](handleError(_0x402314,null));};exports[_0xad82('0x49')]=function(_0x472f12,_0x373ef0){return db[_0xad82('0x2e')]['create'](_0x472f12[_0xad82('0x4a')],{})[_0xad82('0x28')](respondWithResult(_0x373ef0,0xc9))[_0xad82('0x42')](handleError(_0x373ef0,null));};exports[_0xad82('0x4b')]=function(_0x4bf2e3,_0x1433d9){if(_0x4bf2e3[_0xad82('0x4a')]['id']){delete _0x4bf2e3[_0xad82('0x4a')]['id'];}return db[_0xad82('0x2e')][_0xad82('0x48')]({'where':{'id':_0x4bf2e3[_0xad82('0x44')]['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x1433d9,null))[_0xad82('0x28')](saveUpdates(_0x4bf2e3['body'],null))[_0xad82('0x28')](respondWithResult(_0x1433d9,null))[_0xad82('0x42')](handleError(_0x1433d9,null));};exports[_0xad82('0x29')]=function(_0x1b91b3,_0x360407){return db[_0xad82('0x2e')][_0xad82('0x48')]({'where':{'id':_0x1b91b3[_0xad82('0x44')]['id']}})['then'](handleEntityNotFound(_0x360407,null))['then'](removeEntity(_0x360407,null))[_0xad82('0x42')](handleError(_0x360407,null));};exports[_0xad82('0x4c')]=function(_0x251455,_0x4b1a36,_0x265361){var _0x58b7c3={};var _0x625aab={};var _0x3ca594;var _0xae8a3a;return db[_0xad82('0x2e')][_0xad82('0x4d')]({'where':{'id':_0x251455['params']['id']}})['then'](handleEntityNotFound(_0x4b1a36,null))[_0xad82('0x28')](function(_0xc708c9){if(_0xc708c9){_0x3ca594=_0xc708c9;_0x625aab[_0xad82('0x32')]=_['keys'](db[_0xad82('0x4e')]['rawAttributes']);_0x625aab['query']=_[_0xad82('0x45')](_0x251455[_0xad82('0x33')]);_0x625aab[_0xad82('0x34')]=_[_0xad82('0x35')](_0x625aab['model'],_0x625aab['query']);_0x58b7c3['attributes']=_[_0xad82('0x35')](_0x625aab[_0xad82('0x32')],qs[_0xad82('0x36')](_0x251455[_0xad82('0x33')][_0xad82('0x36')]));_0x58b7c3[_0xad82('0x37')]=_0x58b7c3[_0xad82('0x37')]['length']?_0x58b7c3[_0xad82('0x37')]:_0x625aab['model'];_0x58b7c3['order']=qs[_0xad82('0x4f')](_0x251455[_0xad82('0x33')][_0xad82('0x4f')]);_0x58b7c3[_0xad82('0x3a')]=qs['filters'](_[_0xad82('0x3b')](_0x251455[_0xad82('0x33')],_0x625aab[_0xad82('0x34')]));if(_0x251455[_0xad82('0x33')][_0xad82('0x3e')]){_0x58b7c3[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x58b7c3[_0xad82('0x3a')],{'$or':_['map'](_0x58b7c3[_0xad82('0x37')],function(_0x4b8b37){var _0x5421d8={};_0x5421d8[_0x4b8b37]={'$like':'%'+_0x251455[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x5421d8;})});}_0x58b7c3=_[_0xad82('0x3c')]({},_0x58b7c3,_0x251455['options']);return _0x3ca594['getFields'](_0x58b7c3);}})[_0xad82('0x28')](function(_0x5ea297){if(_0x5ea297){_0xae8a3a=_0x5ea297[_0xad82('0x46')];if(!_0x251455[_0xad82('0x33')][_0xad82('0x38')]('nolimit')){_0x58b7c3[_0xad82('0x22')]=qs[_0xad82('0x22')](_0x251455['query']['limit']);_0x58b7c3[_0xad82('0x20')]=qs[_0xad82('0x20')](_0x251455[_0xad82('0x33')][_0xad82('0x20')]);}return _0x3ca594[_0xad82('0x4c')](_0x58b7c3);}})[_0xad82('0x28')](function(_0x71d804){if(_0x71d804){return _0x71d804?{'count':_0xae8a3a,'rows':_0x71d804}:null;}})[_0xad82('0x28')](respondWithResult(_0x4b1a36,null))[_0xad82('0x42')](handleError(_0x4b1a36,null));};exports[_0xad82('0x50')]=function(_0x29b7dd,_0x259593,_0xf6154c){var _0x126d58={};var _0x45efae={};var _0x4d34eb;var _0x3bc004;return db[_0xad82('0x2e')][_0xad82('0x4d')]({'where':{'id':_0x29b7dd['params']['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x259593,null))['then'](function(_0x5c9b98){if(_0x5c9b98){_0x4d34eb=_0x5c9b98;_0x45efae[_0xad82('0x32')]=_[_0xad82('0x45')](db[_0xad82('0x4e')][_0xad82('0x2f')]);_0x45efae[_0xad82('0x33')]=_[_0xad82('0x45')](_0x29b7dd[_0xad82('0x33')]);_0x45efae[_0xad82('0x34')]=_[_0xad82('0x35')](_0x45efae[_0xad82('0x32')],_0x45efae[_0xad82('0x33')]);_0x126d58[_0xad82('0x37')]=_[_0xad82('0x35')](_0x45efae[_0xad82('0x32')],qs['fields'](_0x29b7dd['query']['fields']));_0x126d58[_0xad82('0x37')]=_0x126d58[_0xad82('0x37')][_0xad82('0x46')]?_0x126d58['attributes']:_0x45efae[_0xad82('0x32')];_0x126d58[_0xad82('0x39')]=qs[_0xad82('0x4f')](_0x29b7dd['query'][_0xad82('0x4f')]);_0x126d58['where']=qs[_0xad82('0x34')](_[_0xad82('0x3b')](_0x29b7dd['query'],_0x45efae[_0xad82('0x34')]));if(_0x29b7dd['query'][_0xad82('0x3e')]){_0x126d58[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x126d58[_0xad82('0x3a')],{'$or':_['map'](_0x126d58[_0xad82('0x37')],function(_0xb36926){var _0x46c059={};_0x46c059[_0xb36926]={'$like':'%'+_0x29b7dd['query'][_0xad82('0x3e')]+'%'};return _0x46c059;})});}_0x126d58=_[_0xad82('0x3c')]({},_0x126d58,_0x29b7dd['options']);return _0x4d34eb[_0xad82('0x50')](_0x126d58);}})[_0xad82('0x28')](function(_0x19d177){if(_0x19d177){_0x3bc004=_0x19d177[_0xad82('0x46')];if(!_0x29b7dd[_0xad82('0x33')][_0xad82('0x38')](_0xad82('0x51'))){_0x126d58[_0xad82('0x22')]=qs[_0xad82('0x22')](_0x29b7dd['query'][_0xad82('0x22')]);_0x126d58['offset']=qs[_0xad82('0x20')](_0x29b7dd[_0xad82('0x33')]['offset']);}return _0x4d34eb[_0xad82('0x50')](_0x126d58);}})['then'](function(_0x1d7698){if(_0x1d7698){return _0x1d7698?{'count':_0x3bc004,'rows':_0x1d7698}:null;}})['then'](respondWithResult(_0x259593,null))[_0xad82('0x42')](handleError(_0x259593,null));};exports[_0xad82('0x52')]=function(_0x3ecee3,_0x59e5a7,_0x127cdb){var _0x1a2ca7={};var _0x570fae={};var _0x5d23fe;var _0x248f6c;return db[_0xad82('0x2e')]['findOne']({'where':{'id':_0x3ecee3['params']['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x59e5a7,null))[_0xad82('0x28')](function(_0x45ddca){if(_0x45ddca){_0x5d23fe=_0x45ddca;_0x570fae['model']=_['keys'](db[_0xad82('0x4e')][_0xad82('0x2f')]);_0x570fae['query']=_[_0xad82('0x45')](_0x3ecee3[_0xad82('0x33')]);_0x570fae[_0xad82('0x34')]=_[_0xad82('0x35')](_0x570fae[_0xad82('0x32')],_0x570fae[_0xad82('0x33')]);_0x1a2ca7[_0xad82('0x37')]=_[_0xad82('0x35')](_0x570fae[_0xad82('0x32')],qs[_0xad82('0x36')](_0x3ecee3['query'][_0xad82('0x36')]));_0x1a2ca7[_0xad82('0x37')]=_0x1a2ca7[_0xad82('0x37')][_0xad82('0x46')]?_0x1a2ca7[_0xad82('0x37')]:_0x570fae[_0xad82('0x32')];_0x1a2ca7[_0xad82('0x39')]=qs[_0xad82('0x4f')](_0x3ecee3[_0xad82('0x33')][_0xad82('0x4f')]);_0x1a2ca7[_0xad82('0x3a')]=qs[_0xad82('0x34')](_[_0xad82('0x3b')](_0x3ecee3[_0xad82('0x33')],_0x570fae[_0xad82('0x34')]));if(_0x3ecee3[_0xad82('0x33')][_0xad82('0x3e')]){_0x1a2ca7[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x1a2ca7['where'],{'$or':_[_0xad82('0x2d')](_0x1a2ca7[_0xad82('0x37')],function(_0x4c9e6f){var _0x394f73={};_0x394f73[_0x4c9e6f]={'$like':'%'+_0x3ecee3[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x394f73;})});}_0x1a2ca7=_[_0xad82('0x3c')]({},_0x1a2ca7,_0x3ecee3['options']);return _0x5d23fe[_0xad82('0x52')](_0x1a2ca7);}})[_0xad82('0x28')](function(_0x237115){if(_0x237115){_0x248f6c=_0x237115[_0xad82('0x46')];if(!_0x3ecee3['query'][_0xad82('0x38')](_0xad82('0x51'))){_0x1a2ca7['limit']=qs[_0xad82('0x22')](_0x3ecee3[_0xad82('0x33')][_0xad82('0x22')]);_0x1a2ca7[_0xad82('0x20')]=qs[_0xad82('0x20')](_0x3ecee3['query']['offset']);}return _0x5d23fe[_0xad82('0x52')](_0x1a2ca7);}})[_0xad82('0x28')](function(_0xe1b688){if(_0xe1b688){return _0xe1b688?{'count':_0x248f6c,'rows':_0xe1b688}:null;}})[_0xad82('0x28')](respondWithResult(_0x59e5a7,null))[_0xad82('0x42')](handleError(_0x59e5a7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a481fa5..bb66194 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 _0x451d=['lodash','util','../../config/logger','moment','path','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations'];(function(_0x3211db,_0x13503d){var _0xb565fb=function(_0x521a42){while(--_0x521a42){_0x3211db['push'](_0x3211db['shift']());}};_0xb565fb(++_0x13503d);}(_0x451d,0xbd));var _0xd451=function(_0x2b2520,_0x315cd0){_0x2b2520=_0x2b2520-0x0;var _0x25d74e=_0x451d[_0x2b2520];return _0x25d74e;};'use strict';var _=require(_0xd451('0x0'));var util=require(_0xd451('0x1'));var logger=require(_0xd451('0x2'))('api');var moment=require(_0xd451('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd451('0x4'));var rimraf=require('rimraf');var config=require(_0xd451('0x5'));var attributes=require(_0xd451('0x6'));module['exports']=function(_0x1054dc,_0x26378f){return _0x1054dc[_0xd451('0x7')]('VtigerConfiguration',attributes,{'tableName':_0xd451('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec79=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x6d13ac,_0x418c22){var _0x56c1a0=function(_0x10797a){while(--_0x10797a){_0x6d13ac['push'](_0x6d13ac['shift']());}};_0x56c1a0(++_0x418c22);}(_0xec79,0x14e));var _0x9ec7=function(_0x386688,_0x29d853){_0x386688=_0x386688-0x0;var _0x139544=_0xec79[_0x386688];return _0x139544;};'use strict';var _=require(_0x9ec7('0x0'));var util=require(_0x9ec7('0x1'));var logger=require(_0x9ec7('0x2'))(_0x9ec7('0x3'));var moment=require(_0x9ec7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ec7('0x5'));var fs=require('fs');var path=require(_0x9ec7('0x6'));var rimraf=require(_0x9ec7('0x7'));var config=require(_0x9ec7('0x8'));var attributes=require(_0x9ec7('0x9'));module[_0x9ec7('0xa')]=function(_0x3878d9,_0x2834e3){return _0x3878d9['define'](_0x9ec7('0xb'),attributes,{'tableName':_0x9ec7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 01cd9d2..7277c52 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 _0xef4c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x296af4,_0x289930){var _0x55b14c=function(_0x2c5dbf){while(--_0x2c5dbf){_0x296af4['push'](_0x296af4['shift']());}};_0x55b14c(++_0x289930);}(_0xef4c,0x11c));var _0xcef4=function(_0x3c2fb6,_0x3c4520){_0x3c2fb6=_0x3c2fb6-0x0;var _0xb69e10=_0xef4c[_0x3c2fb6];return _0xb69e10;};'use strict';var _=require(_0xcef4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcef4('0x1'));var fs=require('fs');var Redis=require(_0xcef4('0x2'));var db=require(_0xcef4('0x3'))['db'];var utils=require(_0xcef4('0x4'));var logger=require(_0xcef4('0x5'))('rpc');var config=require(_0xcef4('0x6'));var jayson=require(_0xcef4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58e483,_0x339a97,_0x5633c9){return new BPromise(function(_0x56efa4,_0x2f5433){return client[_0xcef4('0x8')](_0x58e483,_0x5633c9)[_0xcef4('0x9')](function(_0x59ed57){logger[_0xcef4('0xa')](_0xcef4('0xb'),_0x339a97,_0xcef4('0xc'));logger[_0xcef4('0xd')](_0xcef4('0xe'),_0x339a97,_0xcef4('0xc'),JSON['stringify'](_0x59ed57));if(_0x59ed57[_0xcef4('0xf')]){if(_0x59ed57[_0xcef4('0xf')]['code']===0x1f4){logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x59ed57[_0xcef4('0xf')][_0xcef4('0x10')]);return _0x2f5433(_0x59ed57[_0xcef4('0xf')]['message']);}logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x59ed57[_0xcef4('0xf')][_0xcef4('0x10')]);return _0x56efa4(_0x59ed57['error'][_0xcef4('0x10')]);}else{logger[_0xcef4('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x339a97,_0xcef4('0xc'));_0x56efa4(_0x59ed57[_0xcef4('0x11')]['message']);}})[_0xcef4('0x12')](function(_0x4abc13){logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x4abc13);_0x2f5433(_0x4abc13);});});} \ No newline at end of file +var _0x45f7=['result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4279e1,_0x39cda4){var _0x1e33ea=function(_0x5b00ea){while(--_0x5b00ea){_0x4279e1['push'](_0x4279e1['shift']());}};_0x1e33ea(++_0x39cda4);}(_0x45f7,0x1bb));var _0x745f=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x45f7[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0x745f('0x0'));var util=require(_0x745f('0x1'));var moment=require(_0x745f('0x2'));var BPromise=require('bluebird');var rs=require(_0x745f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x745f('0x4'));var logger=require('../../config/logger')(_0x745f('0x5'));var config=require(_0x745f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x745f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f8aa1,_0x4478e6,_0xbf9bf5){return new BPromise(function(_0x284d82,_0x19925a){return client[_0x745f('0x8')](_0x3f8aa1,_0xbf9bf5)[_0x745f('0x9')](function(_0x2bb5bc){logger[_0x745f('0xa')](_0x745f('0xb'),_0x4478e6,_0x745f('0xc'));logger[_0x745f('0xd')](_0x745f('0xe'),_0x4478e6,_0x745f('0xc'),JSON[_0x745f('0xf')](_0x2bb5bc));if(_0x2bb5bc[_0x745f('0x10')]){if(_0x2bb5bc[_0x745f('0x10')][_0x745f('0x11')]===0x1f4){logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);return _0x19925a(_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);}logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);return _0x284d82(_0x2bb5bc[_0x745f('0x10')]['message']);}else{logger[_0x745f('0xa')](_0x745f('0xb'),_0x4478e6,_0x745f('0xc'));_0x284d82(_0x2bb5bc[_0x745f('0x13')][_0x745f('0x12')]);}})[_0x745f('0x14')](function(_0x3a5d52){logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x3a5d52);_0x19925a(_0x3a5d52);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c315c23..7b21723 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 _0x0039=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0039,0x158));var _0x9003=function(_0x201d19,_0x41595b){_0x201d19=_0x201d19-0x0;var _0x25d546=_0x0039[_0x201d19];return _0x25d546;};'use strict';var multer=require('multer');var util=require(_0x9003('0x0'));var path=require(_0x9003('0x1'));var timeout=require(_0x9003('0x2'));var express=require('express');var router=express[_0x9003('0x3')]();var fs_extra=require(_0x9003('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9003('0x5'));var config=require(_0x9003('0x6'));var controller=require(_0x9003('0x7'));router[_0x9003('0x8')]('/',auth[_0x9003('0x9')](),controller[_0x9003('0xa')]);router['get'](_0x9003('0xb'),auth[_0x9003('0x9')](),controller[_0x9003('0xc')]);router[_0x9003('0xd')]('/',auth[_0x9003('0x9')](),controller[_0x9003('0xe')]);router[_0x9003('0xf')](_0x9003('0xb'),auth[_0x9003('0x9')](),controller[_0x9003('0x10')]);router[_0x9003('0x11')](_0x9003('0xb'),auth['isAuthenticated'](),controller[_0x9003('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe4b4=['isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x203e90,_0x44beb9){var _0x72c990=function(_0x4b5f6d){while(--_0x4b5f6d){_0x203e90['push'](_0x203e90['shift']());}};_0x72c990(++_0x44beb9);}(_0xe4b4,0x79));var _0x4e4b=function(_0x47d42f,_0x478095){_0x47d42f=_0x47d42f-0x0;var _0x17a186=_0xe4b4[_0x47d42f];return _0x17a186;};'use strict';var multer=require(_0x4e4b('0x0'));var util=require(_0x4e4b('0x1'));var path=require(_0x4e4b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e4b('0x3'));var interaction=require(_0x4e4b('0x4'));var config=require(_0x4e4b('0x5'));var controller=require(_0x4e4b('0x6'));router['get']('/',auth[_0x4e4b('0x7')](),controller[_0x4e4b('0x8')]);router[_0x4e4b('0x9')](_0x4e4b('0xa'),auth[_0x4e4b('0x7')](),controller[_0x4e4b('0xb')]);router[_0x4e4b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e4b('0xd')](_0x4e4b('0xa'),auth[_0x4e4b('0x7')](),controller['update']);router[_0x4e4b('0xe')](_0x4e4b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e4b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 153c507..994345e 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 _0xa390=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x461228,_0x56edbd){var _0x6cb437=function(_0x85aca7){while(--_0x85aca7){_0x461228['push'](_0x461228['shift']());}};_0x6cb437(++_0x56edbd);}(_0xa390,0xcb));var _0x0a39=function(_0x32c013,_0x2e2793){_0x32c013=_0x32c013-0x0;var _0x5532ac=_0xa390[_0x32c013];return _0x5532ac;};'use strict';var Sequelize=require(_0x0a39('0x0'));module[_0x0a39('0x1')]={'type':{'type':Sequelize[_0x0a39('0x2')](_0x0a39('0x3'),'variable',_0x0a39('0x4'),_0x0a39('0x5'),_0x0a39('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0a39('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0a39('0x3'),_0x0a39('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0a39('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a39('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a39('0x7')]}}; \ No newline at end of file +var _0xde43=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xde43,0x92));var _0x3de4=function(_0x126acb,_0x55ddec){_0x126acb=_0x126acb-0x0;var _0x58853a=_0xde43[_0x126acb];return _0x58853a;};'use strict';var Sequelize=require(_0x3de4('0x0'));module[_0x3de4('0x1')]={'type':{'type':Sequelize[_0x3de4('0x2')](_0x3de4('0x3'),_0x3de4('0x4'),_0x3de4('0x5'),'keyValue',_0x3de4('0x6')),'defaultValue':_0x3de4('0x3')},'content':{'type':Sequelize[_0x3de4('0x7')]},'key':{'type':Sequelize[_0x3de4('0x7')]},'keyType':{'type':Sequelize[_0x3de4('0x2')]('string',_0x3de4('0x4'),_0x3de4('0x5'))},'keyContent':{'type':Sequelize[_0x3de4('0x7')]},'idField':{'type':Sequelize[_0x3de4('0x7')]},'nameField':{'type':Sequelize[_0x3de4('0x7')]},'customField':{'type':Sequelize[_0x3de4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0e2bcaa..92c38f2 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 _0xb98c=['then','destroy','sendStatus','stack','send','index','VtigerField','rawAttributes','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','map','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','eml-format','fast-json-patch','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb98c,0x199));var _0xcb98=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb98c[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0xcb98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb98('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb98('0x2'));var util=require(_0xcb98('0x3'));var path=require('path');var sox=require(_0xcb98('0x4'));var csv=require('to-csv');var ejs=require(_0xcb98('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb98('0x6'));var squel=require(_0xcb98('0x7'));var crypto=require('crypto');var jsforce=require(_0xcb98('0x8'));var deskjs=require(_0xcb98('0x9'));var toCsv=require(_0xcb98('0xa'));var querystring=require(_0xcb98('0xb'));var Papa=require(_0xcb98('0xc'));var Redis=require('ioredis');var authService=require(_0xcb98('0xd'));var qs=require(_0xcb98('0xe'));var as=require(_0xcb98('0xf'));var hardwareService=require(_0xcb98('0x10'));var logger=require(_0xcb98('0x11'))(_0xcb98('0x12'));var utils=require(_0xcb98('0x13'));var config=require(_0xcb98('0x14'));var licenseUtil=require(_0xcb98('0x15'));var db=require(_0xcb98('0x16'))['db'];function respondWithStatusCode(_0x10ac3d,_0x3dcb0e){_0x3dcb0e=_0x3dcb0e||0xcc;return function(_0x493fa0){if(_0x493fa0){return _0x10ac3d['sendStatus'](_0x3dcb0e);}return _0x10ac3d[_0xcb98('0x17')](_0x3dcb0e)[_0xcb98('0x18')]();};}function respondWithResult(_0x548ca0,_0x1afa00){_0x1afa00=_0x1afa00||0xc8;return function(_0xc9803d){if(_0xc9803d){return _0x548ca0[_0xcb98('0x17')](_0x1afa00)['json'](_0xc9803d);}};}function respondWithFilteredResult(_0x50fd3a,_0x5390da){return function(_0x396abc){if(_0x396abc){var _0x12c355=typeof _0x5390da[_0xcb98('0x19')]===_0xcb98('0x1a')&&typeof _0x5390da[_0xcb98('0x1b')]===_0xcb98('0x1a');var _0x1e6ee6=_0x396abc[_0xcb98('0x1c')];var _0x1b857c=_0x12c355?0x0:_0x5390da['offset'];var _0x4a6c30=_0x12c355?_0x396abc[_0xcb98('0x1c')]:_0x5390da[_0xcb98('0x19')]+_0x5390da[_0xcb98('0x1b')];var _0x25f71d;if(_0x4a6c30>=_0x1e6ee6){_0x4a6c30=_0x1e6ee6;_0x25f71d=0xc8;}else{_0x25f71d=0xce;}_0x50fd3a[_0xcb98('0x17')](_0x25f71d);return _0x50fd3a[_0xcb98('0x1d')](_0xcb98('0x1e'),_0x1b857c+'-'+_0x4a6c30+'/'+_0x1e6ee6)[_0xcb98('0x1f')](_0x396abc);}return null;};}function patchUpdates(_0x3b00cb){return function(_0x4211f4){try{jsonpatch['apply'](_0x4211f4,_0x3b00cb,!![]);}catch(_0x414043){return BPromise[_0xcb98('0x20')](_0x414043);}return _0x4211f4[_0xcb98('0x21')]();};}function saveUpdates(_0x2bd375,_0x4057d2){return function(_0x47a3a8){if(_0x47a3a8){return _0x47a3a8[_0xcb98('0x22')](_0x2bd375)[_0xcb98('0x23')](function(_0x16b1fa){return _0x16b1fa;});}return null;};}function removeEntity(_0xa5d859,_0x3772dc){return function(_0x1fa5ef){if(_0x1fa5ef){return _0x1fa5ef[_0xcb98('0x24')]()[_0xcb98('0x23')](function(){_0xa5d859[_0xcb98('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376597,_0x54f5bc){return function(_0x3dfdcf){if(!_0x3dfdcf){_0x376597[_0xcb98('0x25')](0x194);}return _0x3dfdcf;};}function handleError(_0x1cd893,_0x255bbf){_0x255bbf=_0x255bbf||0x1f4;return function(_0x46b378){logger['error'](_0x46b378[_0xcb98('0x26')]);if(_0x46b378['name']){delete _0x46b378['name'];}_0x1cd893[_0xcb98('0x17')](_0x255bbf)[_0xcb98('0x27')](_0x46b378);};}exports[_0xcb98('0x28')]=function(_0x1a7e39,_0x2fbea3){var _0x306eee={},_0x77214c={},_0x5b14da={'count':0x0,'rows':[]};var _0xf6b572=_['map'](db[_0xcb98('0x29')][_0xcb98('0x2a')],function(_0x516f57){return{'name':_0x516f57[_0xcb98('0x2b')],'type':_0x516f57[_0xcb98('0x2c')][_0xcb98('0x2d')]};});_0x77214c[_0xcb98('0x2e')]=_['map'](_0xf6b572,_0xcb98('0x2f'));_0x77214c['query']=_[_0xcb98('0x30')](_0x1a7e39['query']);_0x77214c['filters']=_[_0xcb98('0x31')](_0x77214c[_0xcb98('0x2e')],_0x77214c[_0xcb98('0x32')]);_0x306eee[_0xcb98('0x33')]=_[_0xcb98('0x31')](_0x77214c[_0xcb98('0x2e')],qs[_0xcb98('0x34')](_0x1a7e39[_0xcb98('0x32')]['fields']));_0x306eee[_0xcb98('0x33')]=_0x306eee[_0xcb98('0x33')][_0xcb98('0x35')]?_0x306eee['attributes']:_0x77214c[_0xcb98('0x2e')];if(!_0x1a7e39['query'][_0xcb98('0x36')](_0xcb98('0x37'))){_0x306eee[_0xcb98('0x1b')]=qs['limit'](_0x1a7e39[_0xcb98('0x32')]['limit']);_0x306eee[_0xcb98('0x19')]=qs[_0xcb98('0x19')](_0x1a7e39[_0xcb98('0x32')]['offset']);}_0x306eee[_0xcb98('0x38')]=qs[_0xcb98('0x39')](_0x1a7e39['query']['sort']);_0x306eee[_0xcb98('0x3a')]=qs['filters'](_['pick'](_0x1a7e39[_0xcb98('0x32')],_0x77214c[_0xcb98('0x3b')]),_0xf6b572);if(_0x1a7e39['query']['filter']){_0x306eee[_0xcb98('0x3a')]=_['merge'](_0x306eee[_0xcb98('0x3a')],{'$or':_[_0xcb98('0x3c')](_0xf6b572,function(_0x14c782){if(_0x14c782[_0xcb98('0x2c')]!==_0xcb98('0x3d')){var _0x1ac1e9={};_0x1ac1e9[_0x14c782['name']]={'$like':'%'+_0x1a7e39[_0xcb98('0x32')][_0xcb98('0x3e')]+'%'};return _0x1ac1e9;}})});}_0x306eee=_[_0xcb98('0x3f')]({},_0x306eee,_0x1a7e39[_0xcb98('0x40')]);var _0x1cabbd={'where':_0x306eee[_0xcb98('0x3a')]};return db[_0xcb98('0x29')][_0xcb98('0x1c')](_0x1cabbd)['then'](function(_0x4ed914){_0x5b14da[_0xcb98('0x1c')]=_0x4ed914;if(_0x1a7e39[_0xcb98('0x32')][_0xcb98('0x41')]){_0x306eee['include']=[{'all':!![]}];}return db['VtigerField'][_0xcb98('0x42')](_0x306eee);})['then'](function(_0x2c8f38){_0x5b14da[_0xcb98('0x43')]=_0x2c8f38;return _0x5b14da;})['then'](respondWithFilteredResult(_0x2fbea3,_0x306eee))[_0xcb98('0x44')](handleError(_0x2fbea3,null));};exports['show']=function(_0x3e959a,_0x5ac50e){var _0xc65d44={'raw':!![],'where':{'id':_0x3e959a[_0xcb98('0x45')]['id']}},_0x27a35a={};_0x27a35a[_0xcb98('0x2e')]=_['keys'](db[_0xcb98('0x29')][_0xcb98('0x2a')]);_0x27a35a[_0xcb98('0x32')]=_[_0xcb98('0x30')](_0x3e959a[_0xcb98('0x32')]);_0x27a35a[_0xcb98('0x3b')]=_['intersection'](_0x27a35a[_0xcb98('0x2e')],_0x27a35a[_0xcb98('0x32')]);_0xc65d44['attributes']=_['intersection'](_0x27a35a['model'],qs['fields'](_0x3e959a[_0xcb98('0x32')][_0xcb98('0x34')]));_0xc65d44[_0xcb98('0x33')]=_0xc65d44[_0xcb98('0x33')][_0xcb98('0x35')]?_0xc65d44[_0xcb98('0x33')]:_0x27a35a[_0xcb98('0x2e')];if(_0x3e959a[_0xcb98('0x32')]['includeAll']){_0xc65d44[_0xcb98('0x46')]=[{'all':!![]}];}_0xc65d44=_[_0xcb98('0x3f')]({},_0xc65d44,_0x3e959a[_0xcb98('0x40')]);return db['VtigerField']['find'](_0xc65d44)[_0xcb98('0x23')](handleEntityNotFound(_0x5ac50e,null))[_0xcb98('0x23')](respondWithResult(_0x5ac50e,null))[_0xcb98('0x44')](handleError(_0x5ac50e,null));};exports[_0xcb98('0x47')]=function(_0x2a1d57,_0x463f16){return db[_0xcb98('0x29')][_0xcb98('0x47')](_0x2a1d57[_0xcb98('0x48')],{})[_0xcb98('0x23')](respondWithResult(_0x463f16,0xc9))[_0xcb98('0x44')](handleError(_0x463f16,null));};exports[_0xcb98('0x22')]=function(_0xabd7cf,_0x34fbbb){if(_0xabd7cf[_0xcb98('0x48')]['id']){delete _0xabd7cf['body']['id'];}return db[_0xcb98('0x29')][_0xcb98('0x49')]({'where':{'id':_0xabd7cf[_0xcb98('0x45')]['id']}})[_0xcb98('0x23')](handleEntityNotFound(_0x34fbbb,null))[_0xcb98('0x23')](saveUpdates(_0xabd7cf[_0xcb98('0x48')],null))[_0xcb98('0x23')](respondWithResult(_0x34fbbb,null))[_0xcb98('0x44')](handleError(_0x34fbbb,null));};exports['destroy']=function(_0x29e936,_0x14e14d){return db[_0xcb98('0x29')][_0xcb98('0x49')]({'where':{'id':_0x29e936[_0xcb98('0x45')]['id']}})[_0xcb98('0x23')](handleEntityNotFound(_0x14e14d,null))['then'](removeEntity(_0x14e14d,null))[_0xcb98('0x44')](handleError(_0x14e14d,null));}; \ No newline at end of file +var _0x7b6f=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','VtigerField','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7b6f,0xee));var _0xf7b6=function(_0x1e0152,_0x1693d9){_0x1e0152=_0x1e0152-0x0;var _0x36be50=_0x7b6f[_0x1e0152];return _0x36be50;};'use strict';var emlformat=require(_0xf7b6('0x0'));var rimraf=require(_0xf7b6('0x1'));var zipdir=require(_0xf7b6('0x2'));var jsonpatch=require(_0xf7b6('0x3'));var rp=require(_0xf7b6('0x4'));var moment=require(_0xf7b6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf7b6('0x7'));var csv=require(_0xf7b6('0x8'));var ejs=require(_0xf7b6('0x9'));var fs=require('fs');var fs_extra=require(_0xf7b6('0xa'));var _=require('lodash');var squel=require(_0xf7b6('0xb'));var crypto=require(_0xf7b6('0xc'));var jsforce=require(_0xf7b6('0xd'));var deskjs=require(_0xf7b6('0xe'));var toCsv=require(_0xf7b6('0x8'));var querystring=require('querystring');var Papa=require(_0xf7b6('0xf'));var Redis=require(_0xf7b6('0x10'));var authService=require(_0xf7b6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b6('0x12'));var logger=require('../../config/logger')(_0xf7b6('0x13'));var utils=require(_0xf7b6('0x14'));var config=require(_0xf7b6('0x15'));var licenseUtil=require(_0xf7b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3915a5,_0x228577){_0x228577=_0x228577||0xcc;return function(_0x3d721c){if(_0x3d721c){return _0x3915a5['sendStatus'](_0x228577);}return _0x3915a5[_0xf7b6('0x17')](_0x228577)[_0xf7b6('0x18')]();};}function respondWithResult(_0x11cdf8,_0x27e797){_0x27e797=_0x27e797||0xc8;return function(_0xda54ba){if(_0xda54ba){return _0x11cdf8['status'](_0x27e797)[_0xf7b6('0x19')](_0xda54ba);}};}function respondWithFilteredResult(_0x3bea9b,_0x4fcf69){return function(_0x291d02){if(_0x291d02){var _0x4398a7=typeof _0x4fcf69[_0xf7b6('0x1a')]===_0xf7b6('0x1b')&&typeof _0x4fcf69['limit']===_0xf7b6('0x1b');var _0x3fab26=_0x291d02['count'];var _0xa4fb8d=_0x4398a7?0x0:_0x4fcf69[_0xf7b6('0x1a')];var _0x33c727=_0x4398a7?_0x291d02[_0xf7b6('0x1c')]:_0x4fcf69[_0xf7b6('0x1a')]+_0x4fcf69['limit'];var _0x419ecb;if(_0x33c727>=_0x3fab26){_0x33c727=_0x3fab26;_0x419ecb=0xc8;}else{_0x419ecb=0xce;}_0x3bea9b[_0xf7b6('0x17')](_0x419ecb);return _0x3bea9b['set'](_0xf7b6('0x1d'),_0xa4fb8d+'-'+_0x33c727+'/'+_0x3fab26)[_0xf7b6('0x19')](_0x291d02);}return null;};}function patchUpdates(_0x479480){return function(_0x4afee5){try{jsonpatch[_0xf7b6('0x1e')](_0x4afee5,_0x479480,!![]);}catch(_0x36b5e8){return BPromise[_0xf7b6('0x1f')](_0x36b5e8);}return _0x4afee5[_0xf7b6('0x20')]();};}function saveUpdates(_0x5689dd,_0x344e8d){return function(_0x109e58){if(_0x109e58){return _0x109e58[_0xf7b6('0x21')](_0x5689dd)[_0xf7b6('0x22')](function(_0x391c4f){return _0x391c4f;});}return null;};}function removeEntity(_0x575f42,_0x2512cd){return function(_0x3864b7){if(_0x3864b7){return _0x3864b7['destroy']()[_0xf7b6('0x22')](function(){_0x575f42[_0xf7b6('0x17')](0xcc)[_0xf7b6('0x18')]();});}};}function handleEntityNotFound(_0xbff169,_0x5ae1e1){return function(_0x283441){if(!_0x283441){_0xbff169[_0xf7b6('0x23')](0x194);}return _0x283441;};}function handleError(_0x1e8108,_0x5c9945){_0x5c9945=_0x5c9945||0x1f4;return function(_0x55dc38){logger['error'](_0x55dc38[_0xf7b6('0x24')]);if(_0x55dc38[_0xf7b6('0x25')]){delete _0x55dc38[_0xf7b6('0x25')];}_0x1e8108[_0xf7b6('0x17')](_0x5c9945)['send'](_0x55dc38);};}exports[_0xf7b6('0x26')]=function(_0x5da665,_0x1f393e){var _0x1d59be={},_0x427681={},_0xc3782b={'count':0x0,'rows':[]};var _0x1aeb09=_[_0xf7b6('0x27')](db[_0xf7b6('0x28')]['rawAttributes'],function(_0x27c9f0){return{'name':_0x27c9f0[_0xf7b6('0x29')],'type':_0x27c9f0[_0xf7b6('0x2a')][_0xf7b6('0x2b')]};});_0x427681[_0xf7b6('0x2c')]=_[_0xf7b6('0x27')](_0x1aeb09,_0xf7b6('0x25'));_0x427681['query']=_[_0xf7b6('0x2d')](_0x5da665[_0xf7b6('0x2e')]);_0x427681[_0xf7b6('0x2f')]=_[_0xf7b6('0x30')](_0x427681[_0xf7b6('0x2c')],_0x427681['query']);_0x1d59be[_0xf7b6('0x31')]=_[_0xf7b6('0x30')](_0x427681[_0xf7b6('0x2c')],qs[_0xf7b6('0x32')](_0x5da665['query'][_0xf7b6('0x32')]));_0x1d59be[_0xf7b6('0x31')]=_0x1d59be[_0xf7b6('0x31')][_0xf7b6('0x33')]?_0x1d59be[_0xf7b6('0x31')]:_0x427681[_0xf7b6('0x2c')];if(!_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x34')](_0xf7b6('0x35'))){_0x1d59be[_0xf7b6('0x36')]=qs['limit'](_0x5da665['query']['limit']);_0x1d59be[_0xf7b6('0x1a')]=qs[_0xf7b6('0x1a')](_0x5da665[_0xf7b6('0x2e')]['offset']);}_0x1d59be[_0xf7b6('0x37')]=qs['sort'](_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x38')]);_0x1d59be[_0xf7b6('0x39')]=qs[_0xf7b6('0x2f')](_['pick'](_0x5da665['query'],_0x427681[_0xf7b6('0x2f')]),_0x1aeb09);if(_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x3a')]){_0x1d59be[_0xf7b6('0x39')]=_['merge'](_0x1d59be[_0xf7b6('0x39')],{'$or':_[_0xf7b6('0x27')](_0x1aeb09,function(_0x580525){if(_0x580525['type']!==_0xf7b6('0x3b')){var _0x1b5974={};_0x1b5974[_0x580525[_0xf7b6('0x25')]]={'$like':'%'+_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x3a')]+'%'};return _0x1b5974;}})});}_0x1d59be=_['merge']({},_0x1d59be,_0x5da665[_0xf7b6('0x3c')]);var _0x2edb48={'where':_0x1d59be[_0xf7b6('0x39')]};return db[_0xf7b6('0x28')]['count'](_0x2edb48)[_0xf7b6('0x22')](function(_0x420d88){_0xc3782b[_0xf7b6('0x1c')]=_0x420d88;if(_0x5da665[_0xf7b6('0x2e')]['includeAll']){_0x1d59be[_0xf7b6('0x3d')]=[{'all':!![]}];}return db[_0xf7b6('0x28')]['findAll'](_0x1d59be);})[_0xf7b6('0x22')](function(_0x5a3560){_0xc3782b[_0xf7b6('0x3e')]=_0x5a3560;return _0xc3782b;})[_0xf7b6('0x22')](respondWithFilteredResult(_0x1f393e,_0x1d59be))[_0xf7b6('0x3f')](handleError(_0x1f393e,null));};exports[_0xf7b6('0x40')]=function(_0x160631,_0x3696e3){var _0x4604da={'raw':!![],'where':{'id':_0x160631[_0xf7b6('0x41')]['id']}},_0x1dd04c={};_0x1dd04c['model']=_['keys'](db['VtigerField'][_0xf7b6('0x42')]);_0x1dd04c[_0xf7b6('0x2e')]=_[_0xf7b6('0x2d')](_0x160631[_0xf7b6('0x2e')]);_0x1dd04c['filters']=_[_0xf7b6('0x30')](_0x1dd04c[_0xf7b6('0x2c')],_0x1dd04c[_0xf7b6('0x2e')]);_0x4604da['attributes']=_['intersection'](_0x1dd04c[_0xf7b6('0x2c')],qs[_0xf7b6('0x32')](_0x160631[_0xf7b6('0x2e')][_0xf7b6('0x32')]));_0x4604da['attributes']=_0x4604da[_0xf7b6('0x31')][_0xf7b6('0x33')]?_0x4604da[_0xf7b6('0x31')]:_0x1dd04c[_0xf7b6('0x2c')];if(_0x160631[_0xf7b6('0x2e')][_0xf7b6('0x43')]){_0x4604da[_0xf7b6('0x3d')]=[{'all':!![]}];}_0x4604da=_[_0xf7b6('0x44')]({},_0x4604da,_0x160631['options']);return db[_0xf7b6('0x28')][_0xf7b6('0x45')](_0x4604da)[_0xf7b6('0x22')](handleEntityNotFound(_0x3696e3,null))[_0xf7b6('0x22')](respondWithResult(_0x3696e3,null))[_0xf7b6('0x3f')](handleError(_0x3696e3,null));};exports[_0xf7b6('0x46')]=function(_0x2a00a0,_0x3560ca){return db[_0xf7b6('0x28')]['create'](_0x2a00a0['body'],{})['then'](respondWithResult(_0x3560ca,0xc9))[_0xf7b6('0x3f')](handleError(_0x3560ca,null));};exports['update']=function(_0x39e10d,_0x439037){if(_0x39e10d['body']['id']){delete _0x39e10d[_0xf7b6('0x47')]['id'];}return db[_0xf7b6('0x28')][_0xf7b6('0x45')]({'where':{'id':_0x39e10d['params']['id']}})[_0xf7b6('0x22')](handleEntityNotFound(_0x439037,null))['then'](saveUpdates(_0x39e10d['body'],null))[_0xf7b6('0x22')](respondWithResult(_0x439037,null))[_0xf7b6('0x3f')](handleError(_0x439037,null));};exports['destroy']=function(_0x437d2b,_0x2b9476){return db[_0xf7b6('0x28')][_0xf7b6('0x45')]({'where':{'id':_0x437d2b[_0xf7b6('0x41')]['id']}})[_0xf7b6('0x22')](handleEntityNotFound(_0x2b9476,null))[_0xf7b6('0x22')](removeEntity(_0x2b9476,null))[_0xf7b6('0x3f')](handleError(_0x2b9476,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ae38ec0..68f2b40 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 _0x5c59=['path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x24bba0,_0x6d581f){var _0x11b8cd=function(_0x55893f){while(--_0x55893f){_0x24bba0['push'](_0x24bba0['shift']());}};_0x11b8cd(++_0x6d581f);}(_0x5c59,0xd8));var _0x95c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c59[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x95c5('0x0'));var logger=require(_0x95c5('0x1'))(_0x95c5('0x2'));var moment=require(_0x95c5('0x3'));var BPromise=require(_0x95c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95c5('0x5'));var rimraf=require(_0x95c5('0x6'));var config=require(_0x95c5('0x7'));var attributes=require(_0x95c5('0x8'));module['exports']=function(_0x8562eb,_0x2d0236){return _0x8562eb['define'](_0x95c5('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x95c5('0xa'),'fields':[_0x95c5('0xb'),_0x95c5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79c1=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','idField'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x79c1,0x169));var _0x179c=function(_0x450678,_0x2b6600){_0x450678=_0x450678-0x0;var _0xb0d108=_0x79c1[_0x450678];return _0xb0d108;};'use strict';var _=require(_0x179c('0x0'));var util=require(_0x179c('0x1'));var logger=require(_0x179c('0x2'))(_0x179c('0x3'));var moment=require(_0x179c('0x4'));var BPromise=require('bluebird');var rp=require(_0x179c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x179c('0x6'));var config=require(_0x179c('0x7'));var attributes=require(_0x179c('0x8'));module[_0x179c('0x9')]=function(_0xda7420,_0x3209c5){return _0xda7420['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x179c('0xa'),_0x179c('0xb')],'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 447ae48..cda10a8 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 _0x91e3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','util','bluebird'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x91e3,0x1d2));var _0x391e=function(_0x582689,_0x256d34){_0x582689=_0x582689-0x0;var _0x5dc6d6=_0x91e3[_0x582689];return _0x5dc6d6;};'use strict';var _=require('lodash');var util=require(_0x391e('0x0'));var moment=require('moment');var BPromise=require(_0x391e('0x1'));var rs=require(_0x391e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x391e('0x3'))['db'];var utils=require(_0x391e('0x4'));var logger=require(_0x391e('0x5'))(_0x391e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x391e('0x7')][_0x391e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562869,_0x4ba71b,_0x1ca983){return new BPromise(function(_0x5e8384,_0x75d1d2){return client['request'](_0x562869,_0x1ca983)[_0x391e('0x9')](function(_0xd97418){logger[_0x391e('0xa')]('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'),JSON[_0x391e('0xc')](_0xd97418));if(_0xd97418['error']){if(_0xd97418['error'][_0x391e('0xd')]===0x1f4){logger[_0x391e('0xe')](_0x391e('0xf'),_0x4ba71b,_0xd97418['error'][_0x391e('0x10')]);return _0x75d1d2(_0xd97418['error'][_0x391e('0x10')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0xd97418['error'][_0x391e('0x10')]);return _0x5e8384(_0xd97418[_0x391e('0xe')][_0x391e('0x10')]);}else{logger[_0x391e('0xa')]('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'));_0x5e8384(_0xd97418[_0x391e('0x11')][_0x391e('0x10')]);}})['catch'](function(_0x230c16){logger[_0x391e('0xe')](_0x391e('0xf'),_0x4ba71b,_0x230c16);_0x75d1d2(_0x230c16);});});} \ No newline at end of file +var _0xc0d8=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0xf2fa19,_0x1fdd4f){var _0x1e1366=function(_0x396e7a){while(--_0x396e7a){_0xf2fa19['push'](_0xf2fa19['shift']());}};_0x1e1366(++_0x1fdd4f);}(_0xc0d8,0x131));var _0x8c0d=function(_0x3ae2cc,_0x4c8e57){_0x3ae2cc=_0x3ae2cc-0x0;var _0x49bed5=_0xc0d8[_0x3ae2cc];return _0x49bed5;};'use strict';var _=require(_0x8c0d('0x0'));var util=require(_0x8c0d('0x1'));var moment=require(_0x8c0d('0x2'));var BPromise=require(_0x8c0d('0x3'));var rs=require(_0x8c0d('0x4'));var fs=require('fs');var Redis=require(_0x8c0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c0d('0x6'));var config=require(_0x8c0d('0x7'));var jayson=require(_0x8c0d('0x8'));var client=jayson['client'][_0x8c0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f8c89,_0x3f008f,_0x1ebd91){return new BPromise(function(_0x4c5c54,_0x1b18d5){return client[_0x8c0d('0xa')](_0x2f8c89,_0x1ebd91)[_0x8c0d('0xb')](function(_0x390f30){logger[_0x8c0d('0xc')](_0x8c0d('0xd'),_0x3f008f,_0x8c0d('0xe'));logger[_0x8c0d('0xf')](_0x8c0d('0x10'),_0x3f008f,_0x8c0d('0xe'),JSON['stringify'](_0x390f30));if(_0x390f30['error']){if(_0x390f30['error']['code']===0x1f4){logger[_0x8c0d('0x11')]('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x390f30[_0x8c0d('0x11')][_0x8c0d('0x12')]);return _0x1b18d5(_0x390f30[_0x8c0d('0x11')][_0x8c0d('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x390f30[_0x8c0d('0x11')]['message']);return _0x4c5c54(_0x390f30['error']['message']);}else{logger[_0x8c0d('0xc')]('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x8c0d('0xe'));_0x4c5c54(_0x390f30[_0x8c0d('0x13')]['message']);}})[_0x8c0d('0x14')](function(_0x32fc75){logger[_0x8c0d('0x11')](_0x8c0d('0xd'),_0x3f008f,_0x32fc75);_0x1b18d5(_0x32fc75);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5eacf6e..f717cb6 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 _0x7d8a=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x7d8a[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var timeout=require(_0xa7d8('0x3'));var express=require(_0xa7d8('0x4'));var router=express['Router']();var fs_extra=require(_0xa7d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7d8('0x6'));var config=require('../../config/environment');var controller=require(_0xa7d8('0x7'));router[_0xa7d8('0x8')]('/',auth[_0xa7d8('0x9')](),controller['index']);router[_0xa7d8('0x8')](_0xa7d8('0xa'),auth[_0xa7d8('0x9')](),controller['show']);router['get'](_0xa7d8('0xb'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xc')]);router['get'](_0xa7d8('0xd'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xe')]);router[_0xa7d8('0xf')]('/',auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x10')]);router[_0xa7d8('0xf')](_0xa7d8('0xb'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x11')]);router[_0xa7d8('0x12')](_0xa7d8('0xa'),auth['isAuthenticated'](),controller[_0xa7d8('0x13')]);router[_0xa7d8('0x14')](_0xa7d8('0xa'),auth['isAuthenticated'](),controller[_0xa7d8('0x15')]);module[_0xa7d8('0x16')]=router; \ No newline at end of file +var _0x69d2=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x34e5f8,_0x7b17f7){var _0x2d9b29=function(_0x51ce83){while(--_0x51ce83){_0x34e5f8['push'](_0x34e5f8['shift']());}};_0x2d9b29(++_0x7b17f7);}(_0x69d2,0x1a6));var _0x269d=function(_0xdaef52,_0x5269a2){_0xdaef52=_0xdaef52-0x0;var _0x55208c=_0x69d2[_0xdaef52];return _0x55208c;};'use strict';var multer=require(_0x269d('0x0'));var util=require(_0x269d('0x1'));var path=require('path');var timeout=require(_0x269d('0x2'));var express=require(_0x269d('0x3'));var router=express['Router']();var fs_extra=require(_0x269d('0x4'));var auth=require(_0x269d('0x5'));var interaction=require(_0x269d('0x6'));var config=require(_0x269d('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x269d('0x8')]('/',auth[_0x269d('0x9')](),controller[_0x269d('0xa')]);router[_0x269d('0x8')](_0x269d('0xb'),auth[_0x269d('0x9')](),controller[_0x269d('0xc')]);router[_0x269d('0x8')](_0x269d('0xd'),auth['isAuthenticated'](),controller[_0x269d('0xe')]);router[_0x269d('0x8')](_0x269d('0xf'),auth[_0x269d('0x9')](),controller[_0x269d('0x10')]);router[_0x269d('0x11')]('/',auth[_0x269d('0x9')](),controller['create']);router[_0x269d('0x11')](_0x269d('0xd'),auth[_0x269d('0x9')](),controller[_0x269d('0x12')]);router[_0x269d('0x13')](_0x269d('0xb'),auth['isAuthenticated'](),controller[_0x269d('0x14')]);router[_0x269d('0x15')](_0x269d('0xb'),auth[_0x269d('0x9')](),controller[_0x269d('0x16')]);module[_0x269d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index c951783..e7e1562 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 _0xdec3=['newTab','sequelize','STRING','remoteUri','password','token','ENUM','integrationTab'];(function(_0x238098,_0xc099cd){var _0x495bac=function(_0x3f43c6){while(--_0x3f43c6){_0x238098['push'](_0x238098['shift']());}};_0x495bac(++_0xc099cd);}(_0xdec3,0x89));var _0x3dec=function(_0x56bd4c,_0x3cd91d){_0x56bd4c=_0x56bd4c-0x0;var _0x462287=_0xdec3[_0x56bd4c];return _0x462287;};'use strict';var Sequelize=require(_0x3dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x3dec('0x1')]},'description':{'type':Sequelize[_0x3dec('0x1')]},'username':{'type':Sequelize[_0x3dec('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x3dec('0x1')]},'token':{'type':Sequelize[_0x3dec('0x1')]},'remoteUri':{'type':Sequelize[_0x3dec('0x1')],'unique':_0x3dec('0x2')},'authType':{'type':Sequelize['ENUM'](_0x3dec('0x3'),_0x3dec('0x4')),'defaultValue':_0x3dec('0x3')},'serverUrl':{'type':Sequelize[_0x3dec('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3dec('0x5')](_0x3dec('0x6'),_0x3dec('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x8aad=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token','password'];(function(_0x4b0418,_0x317d48){var _0x195071=function(_0x36ca91){while(--_0x36ca91){_0x4b0418['push'](_0x4b0418['shift']());}};_0x195071(++_0x317d48);}(_0x8aad,0x146));var _0xd8aa=function(_0x111304,_0x5356d1){_0x111304=_0x111304-0x0;var _0x2c7c07=_0x8aad[_0x111304];return _0x2c7c07;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'password':{'type':Sequelize[_0xd8aa('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xd8aa('0x5')),'defaultValue':_0xd8aa('0x6')},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8aa('0x7'),_0xd8aa('0x8')),'defaultValue':_0xd8aa('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bf8351a..f99b5cf 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 _0x757a=['rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x757a,0xde));var _0xa757=function(_0x477eda,_0x1140d0){_0x477eda=_0x477eda-0x0;var _0x3cc690=_0x757a[_0x477eda];return _0x3cc690;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x421040,_0x544b45){_0x544b45=_0x544b45||0xcc;return function(_0x564187){if(_0x564187){return _0x421040[_0xa757('0x15')](_0x544b45);}return _0x421040['status'](_0x544b45)['end']();};}function respondWithResult(_0x32112b,_0x1b670e){_0x1b670e=_0x1b670e||0xc8;return function(_0x355f0a){if(_0x355f0a){return _0x32112b[_0xa757('0x16')](_0x1b670e)[_0xa757('0x17')](_0x355f0a);}};}function respondWithFilteredResult(_0x31cfd2,_0xf12b68){return function(_0x2f7947){if(_0x2f7947){var _0x185011=typeof _0xf12b68[_0xa757('0x18')]==='undefined'&&typeof _0xf12b68[_0xa757('0x19')]===_0xa757('0x1a');var _0xde8248=_0x2f7947['count'];var _0x54b305=_0x185011?0x0:_0xf12b68[_0xa757('0x18')];var _0x468d45=_0x185011?_0x2f7947[_0xa757('0x1b')]:_0xf12b68[_0xa757('0x18')]+_0xf12b68[_0xa757('0x19')];var _0xe2d567;if(_0x468d45>=_0xde8248){_0x468d45=_0xde8248;_0xe2d567=0xc8;}else{_0xe2d567=0xce;}_0x31cfd2['status'](_0xe2d567);return _0x31cfd2[_0xa757('0x1c')]('Content-Range',_0x54b305+'-'+_0x468d45+'/'+_0xde8248)[_0xa757('0x17')](_0x2f7947);}return null;};}function patchUpdates(_0x167640){return function(_0x14014c){try{jsonpatch[_0xa757('0x1d')](_0x14014c,_0x167640,!![]);}catch(_0x4d598c){return BPromise['reject'](_0x4d598c);}return _0x14014c[_0xa757('0x1e')]();};}function saveUpdates(_0x2159cf,_0x2ba923){return function(_0x8d121f){if(_0x8d121f){return _0x8d121f[_0xa757('0x1f')](_0x2159cf)[_0xa757('0x20')](function(_0x2ca10d){return _0x2ca10d;});}return null;};}function removeEntity(_0x21f1af,_0x2bf276){return function(_0x59fae6){if(_0x59fae6){return _0x59fae6[_0xa757('0x21')]()['then'](function(){_0x21f1af[_0xa757('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(!_0x37c7e6){_0x40551d['sendStatus'](0x194);}return _0x37c7e6;};}function handleError(_0x2b19d5,_0xcd98bd){_0xcd98bd=_0xcd98bd||0x1f4;return function(_0x471e84){logger[_0xa757('0x22')](_0x471e84['stack']);if(_0x471e84[_0xa757('0x23')]){delete _0x471e84['name'];}_0x2b19d5['status'](_0xcd98bd)['send'](_0x471e84);};}exports['index']=function(_0xfdf69d,_0x596ae2){var _0x2208f9={},_0x3bc24c={},_0x55c5f8={'count':0x0,'rows':[]};var _0x2a0c9a=_['map'](db[_0xa757('0x24')][_0xa757('0x25')],function(_0x5307c3){return{'name':_0x5307c3[_0xa757('0x26')],'type':_0x5307c3['type'][_0xa757('0x27')]};});_0x3bc24c[_0xa757('0x28')]=_[_0xa757('0x29')](_0x2a0c9a,_0xa757('0x23'));_0x3bc24c[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0xfdf69d[_0xa757('0x2a')]);_0x3bc24c[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],_0x3bc24c[_0xa757('0x2a')]);_0x2208f9[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],qs[_0xa757('0x2f')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x2f')]));_0x2208f9[_0xa757('0x2e')]=_0x2208f9[_0xa757('0x2e')][_0xa757('0x30')]?_0x2208f9[_0xa757('0x2e')]:_0x3bc24c[_0xa757('0x28')];if(!_0xfdf69d[_0xa757('0x2a')][_0xa757('0x31')]('nolimit')){_0x2208f9[_0xa757('0x19')]=qs[_0xa757('0x19')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x19')]);_0x2208f9[_0xa757('0x18')]=qs['offset'](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x18')]);}_0x2208f9[_0xa757('0x32')]=qs[_0xa757('0x33')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x33')]);_0x2208f9['where']=qs[_0xa757('0x2c')](_[_0xa757('0x34')](_0xfdf69d[_0xa757('0x2a')],_0x3bc24c[_0xa757('0x2c')]),_0x2a0c9a);if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x35')]){_0x2208f9[_0xa757('0x36')]=_[_0xa757('0x37')](_0x2208f9[_0xa757('0x36')],{'$or':_['map'](_0x2a0c9a,function(_0x300be4){if(_0x300be4[_0xa757('0x38')]!==_0xa757('0x39')){var _0x35c15a={};_0x35c15a[_0x300be4[_0xa757('0x23')]]={'$like':'%'+_0xfdf69d[_0xa757('0x2a')]['filter']+'%'};return _0x35c15a;}})});}_0x2208f9=_[_0xa757('0x37')]({},_0x2208f9,_0xfdf69d[_0xa757('0x3a')]);var _0x48cde9={'where':_0x2208f9['where']};return db[_0xa757('0x24')][_0xa757('0x1b')](_0x48cde9)['then'](function(_0x51c3d1){_0x55c5f8[_0xa757('0x1b')]=_0x51c3d1;if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x3b')]){_0x2208f9['include']=[{'all':!![]}];}return db[_0xa757('0x24')][_0xa757('0x3c')](_0x2208f9);})[_0xa757('0x20')](function(_0x1ba399){_0x55c5f8[_0xa757('0x3d')]=_0x1ba399;return _0x55c5f8;})['then'](respondWithFilteredResult(_0x596ae2,_0x2208f9))[_0xa757('0x3e')](handleError(_0x596ae2,null));};exports['show']=function(_0x564d40,_0x43329c){var _0x57298b={'raw':![],'where':{'id':_0x564d40[_0xa757('0x3f')]['id']}},_0x373747={};_0x373747[_0xa757('0x28')]=_['keys'](db['ZendeskAccount'][_0xa757('0x25')]);_0x373747[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x564d40[_0xa757('0x2a')]);_0x373747[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x373747['model'],_0x373747[_0xa757('0x2a')]);_0x57298b[_0xa757('0x2e')]=_['intersection'](_0x373747[_0xa757('0x28')],qs['fields'](_0x564d40[_0xa757('0x2a')][_0xa757('0x2f')]));_0x57298b['attributes']=_0x57298b[_0xa757('0x2e')][_0xa757('0x30')]?_0x57298b['attributes']:_0x373747[_0xa757('0x28')];if(_0x564d40[_0xa757('0x2a')][_0xa757('0x3b')]){_0x57298b[_0xa757('0x40')]=[{'all':!![]}];}_0x57298b=_['merge']({},_0x57298b,_0x564d40[_0xa757('0x3a')]);return db[_0xa757('0x24')][_0xa757('0x41')](_0x57298b)[_0xa757('0x20')](handleEntityNotFound(_0x43329c,null))['then'](respondWithResult(_0x43329c,null))[_0xa757('0x3e')](handleError(_0x43329c,null));};exports['create']=function(_0x50c131,_0x2acf88){return db[_0xa757('0x24')][_0xa757('0x42')](_0x50c131['body'],{})[_0xa757('0x20')](respondWithResult(_0x2acf88,0xc9))['catch'](handleError(_0x2acf88,null));};exports[_0xa757('0x1f')]=function(_0x151cc3,_0x265793){if(_0x151cc3[_0xa757('0x43')]['id']){delete _0x151cc3[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x151cc3[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265793,null))[_0xa757('0x20')](saveUpdates(_0x151cc3[_0xa757('0x43')],null))[_0xa757('0x20')](respondWithResult(_0x265793,null))[_0xa757('0x3e')](handleError(_0x265793,null));};exports[_0xa757('0x21')]=function(_0x1f10cf,_0x15bad7){return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x1f10cf[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x15bad7,null))[_0xa757('0x20')](removeEntity(_0x15bad7,null))[_0xa757('0x3e')](handleError(_0x15bad7,null));};exports[_0xa757('0x44')]=function(_0x388573,_0x23caca,_0x492e7e){var _0x3b5116={};var _0x51157e={};var _0x48af6e;var _0x311c25;return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x388573['params']['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x23caca,null))[_0xa757('0x20')](function(_0x8614f9){if(_0x8614f9){_0x48af6e=_0x8614f9;_0x51157e[_0xa757('0x28')]=_['keys'](db[_0xa757('0x46')][_0xa757('0x25')]);_0x51157e[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x388573[_0xa757('0x2a')]);_0x51157e[_0xa757('0x2c')]=_['intersection'](_0x51157e['model'],_0x51157e['query']);_0x3b5116['attributes']=_[_0xa757('0x2d')](_0x51157e[_0xa757('0x28')],qs[_0xa757('0x2f')](_0x388573[_0xa757('0x2a')][_0xa757('0x2f')]));_0x3b5116[_0xa757('0x2e')]=_0x3b5116['attributes'][_0xa757('0x30')]?_0x3b5116[_0xa757('0x2e')]:_0x51157e[_0xa757('0x28')];_0x3b5116[_0xa757('0x32')]=qs['sort'](_0x388573[_0xa757('0x2a')][_0xa757('0x33')]);_0x3b5116['where']=qs[_0xa757('0x2c')](_['pick'](_0x388573[_0xa757('0x2a')],_0x51157e['filters']));if(_0x388573[_0xa757('0x2a')]['filter']){_0x3b5116['where']=_[_0xa757('0x37')](_0x3b5116[_0xa757('0x36')],{'$or':_[_0xa757('0x29')](_0x3b5116[_0xa757('0x2e')],function(_0x14e226){var _0xc5ae37={};_0xc5ae37[_0x14e226]={'$like':'%'+_0x388573['query']['filter']+'%'};return _0xc5ae37;})});}_0x3b5116=_[_0xa757('0x37')]({},_0x3b5116,_0x388573[_0xa757('0x3a')]);return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})['then'](function(_0x55a7d2){if(_0x55a7d2){_0x311c25=_0x55a7d2[_0xa757('0x30')];if(!_0x388573[_0xa757('0x2a')][_0xa757('0x31')](_0xa757('0x47'))){_0x3b5116[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x388573['query'][_0xa757('0x19')]);_0x3b5116[_0xa757('0x18')]=qs[_0xa757('0x18')](_0x388573[_0xa757('0x2a')][_0xa757('0x18')]);}return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})[_0xa757('0x20')](function(_0x13dd81){if(_0x13dd81){return _0x13dd81?{'count':_0x311c25,'rows':_0x13dd81}:null;}})[_0xa757('0x20')](respondWithResult(_0x23caca,null))[_0xa757('0x3e')](handleError(_0x23caca,null));};exports['addConfiguration']=function(_0x9e96e6,_0x5c803a,_0x5851fd){if(_0x9e96e6[_0xa757('0x43')]['id']){delete _0x9e96e6[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x9e96e6[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x20')](function(_0x32e0b9){if(_0x32e0b9){_0x9e96e6[_0xa757('0x43')][_0xa757('0x48')]=_0x32e0b9['id'];_0x9e96e6[_0xa757('0x43')]['Subjects']=integrations[_0xa757('0x49')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')][_0xa757('0x38')]);_0x9e96e6[_0xa757('0x43')][_0xa757('0x4a')]=integrations[_0xa757('0x4b')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')]['type']);return db[_0xa757('0x46')][_0xa757('0x42')](_0x9e96e6[_0xa757('0x43')],{'include':[{'model':db[_0xa757('0x4c')],'as':_0xa757('0x4d')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xa757('0x20')](respondWithResult(_0x5c803a,null))[_0xa757('0x3e')](handleError(_0x5c803a,null));};exports[_0xa757('0x4e')]=function(_0x5f450f,_0x115a94,_0x55bc0f){var _0x34982a='';return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x5f450f[_0xa757('0x3f')]['id']},'attributes':['id',_0xa757('0x4f'),_0xa757('0x50'),'token',_0xa757('0x51'),_0xa757('0x52')]})[_0xa757('0x20')](handleEntityNotFound(_0x115a94,null))[_0xa757('0x20')](function(_0x1c35bc){if(_0x1c35bc){_0x34982a=_0x1c35bc['remoteUri'];var _0x2586f9=_0x34982a[_0xa757('0x53')](-0x1);if(_0x2586f9==='/'){_0x34982a=_0x34982a[_0xa757('0x54')](0x0,_0x34982a[_0xa757('0x55')](_0x2586f9));}var _0x43cc0a={'method':'GET','uri':util[_0xa757('0x56')](_0xa757('0x57'),_0x34982a,_0xa757('0x58')),'json':!![]};switch(_0x1c35bc['authType']){case _0xa757('0x50'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util[_0xa757('0x56')](_0xa757('0x5b'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc[_0xa757('0x50')]))[_0xa757('0x5c')](_0xa757('0x5d')))};break;case _0xa757('0x5e'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util['format'](_0xa757('0x5f'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc['token']))[_0xa757('0x5c')](_0xa757('0x5d')))};break;default:throw new db['Sequelize'][(_0xa757('0x60'))](_0xa757('0x61'));}return rp(_0x43cc0a);}})[_0xa757('0x20')](function(_0x2e1198){if(_0x2e1198){var _0x3a00ef=[_0xa757('0x62'),_0xa757('0x63'),_0xa757('0x64'),_0xa757('0x65')];_[_0xa757('0x66')](_0x2e1198[_0xa757('0x58')],function(_0x189195){return _0x3a00ef[_0xa757('0x67')](_0x189195[_0xa757('0x38')]);});return{'count':_0x2e1198[_0xa757('0x58')][_0xa757('0x30')],'rows':_['map'](_0x2e1198[_0xa757('0x58')],function(_0x56ba75){return{'id':_0x56ba75['id'],'name':_0x56ba75[_0xa757('0x68')]>0x7?_0x56ba75[_0xa757('0x69')]:_0x56ba75[_0xa757('0x38')],'custom':_0x56ba75[_0xa757('0x68')]>0x7?!![]:![],'options':_0x56ba75[_0xa757('0x6a')]?_0x56ba75['system_field_options']:_0x56ba75[_0xa757('0x6b')]?_0x56ba75[_0xa757('0x6b')]:[]};})};}})[_0xa757('0x20')](respondWithResult(_0x115a94,null))['catch'](function(_0x3317d8){var _0x3619ec=_0x5f450f[_0xa757('0x2a')]['test']?0x1f4:_0x3317d8['statusCode']||0x1f4;logger[_0xa757('0x22')](_0xa757('0x6c'),_0xa757('0x4e'),_0x3619ec,JSON['stringify'](_0x3317d8));delete _0x3317d8[_0xa757('0x23')];if(_0x3619ec===0x191){_0x3619ec=0x190;}_0x115a94['status'](_0x3619ec)['send'](_0x5f450f[_0xa757('0x2a')][_0xa757('0x6d')]?{'message':_0xa757('0x6e'),'statusCode':_0x3317d8['statusCode']}:_0x3317d8);});}; \ No newline at end of file +var _0x58a4=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','map','type'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x58a4,0xbf));var _0x458a=function(_0x39092c,_0x167f0c){_0x39092c=_0x39092c-0x0;var _0x7e47a=_0x58a4[_0x39092c];return _0x7e47a;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['ZendeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['ZendeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','username',_0x458a('0x57'),_0x458a('0x58'),'authType',_0x458a('0x59')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))[_0x458a('0x27')](function(_0x494710){if(_0x494710){_0x3948aa=_0x494710[_0x458a('0x59')];var _0xed002=_0x3948aa[_0x458a('0x5a')](-0x1);if(_0xed002==='/'){_0x3948aa=_0x3948aa[_0x458a('0x5b')](0x0,_0x3948aa[_0x458a('0x5c')](_0xed002));}var _0x42f213={'method':'GET','uri':util[_0x458a('0x5d')]('%s/%s',_0x3948aa,'ticket_fields'),'json':!![]};switch(_0x494710[_0x458a('0x5e')]){case _0x458a('0x57'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')](_0x458a('0x60'),new Buffer(util[_0x458a('0x5d')](_0x458a('0x61'),_0x494710[_0x458a('0x62')],_0x494710[_0x458a('0x57')]))[_0x458a('0x63')](_0x458a('0x64')))};break;case _0x458a('0x58'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x494710[_0x458a('0x62')],_0x494710['token']))[_0x458a('0x63')](_0x458a('0x64')))};break;default:throw new db[(_0x458a('0x65'))][(_0x458a('0x66'))](_0x458a('0x67'));}return rp(_0x42f213);}})[_0x458a('0x27')](function(_0x46df7c){if(_0x46df7c){var _0x49f3ee=[_0x458a('0x68'),_0x458a('0x69'),'group',_0x458a('0x6a')];_['remove'](_0x46df7c[_0x458a('0x6b')],function(_0x58d29d){return _0x49f3ee[_0x458a('0x6c')](_0x58d29d[_0x458a('0x2e')]);});return{'count':_0x46df7c[_0x458a('0x6b')][_0x458a('0x35')],'rows':_['map'](_0x46df7c[_0x458a('0x6b')],function(_0x14b95e){return{'id':_0x14b95e['id'],'name':_0x14b95e[_0x458a('0x6d')]>0x7?_0x14b95e[_0x458a('0x6e')]:_0x14b95e[_0x458a('0x2e')],'custom':_0x14b95e[_0x458a('0x6d')]>0x7?!![]:![],'options':_0x14b95e[_0x458a('0x6f')]?_0x14b95e[_0x458a('0x6f')]:_0x14b95e['custom_field_options']?_0x14b95e[_0x458a('0x70')]:[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))[_0x458a('0x45')](function(_0x4212af){var _0x591dbb=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x4212af['statusCode']||0x1f4;logger[_0x458a('0x72')](_0x458a('0x73'),_0x458a('0x56'),_0x591dbb,JSON[_0x458a('0x74')](_0x4212af));delete _0x4212af[_0x458a('0x2b')];if(_0x591dbb===0x191){_0x591dbb=0x190;}_0x11bbba['status'](_0x591dbb)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?{'message':_0x458a('0x75'),'statusCode':_0x4212af[_0x458a('0x76')]}:_0x4212af);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 579a7e0..bfcf195 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 _0xd3e7=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash'];(function(_0x53e5ca,_0x3742a1){var _0x5926c5=function(_0x2cd9a2){while(--_0x2cd9a2){_0x53e5ca['push'](_0x53e5ca['shift']());}};_0x5926c5(++_0x3742a1);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d3e('0x0'));var util=require('util');var logger=require(_0x7d3e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d3e('0x2'));var rp=require(_0x7d3e('0x3'));var fs=require('fs');var path=require(_0x7d3e('0x4'));var rimraf=require(_0x7d3e('0x5'));var config=require(_0x7d3e('0x6'));var attributes=require(_0x7d3e('0x7'));var integrations=require(_0x7d3e('0x8'));module[_0x7d3e('0x9')]=function(_0x506bf,_0xe3fb9c){return _0x506bf[_0x7d3e('0xa')](_0x7d3e('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88fa=['exports','define','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x88fa,0x18e));var _0xa88f=function(_0x2f6b21,_0x2f8725){_0x2f6b21=_0x2f6b21-0x0;var _0x5c74b0=_0x88fa[_0x2f6b21];return _0x5c74b0;};'use strict';var _=require(_0xa88f('0x0'));var util=require(_0xa88f('0x1'));var logger=require(_0xa88f('0x2'))('api');var moment=require(_0xa88f('0x3'));var BPromise=require(_0xa88f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa88f('0x5'));var rimraf=require(_0xa88f('0x6'));var config=require(_0xa88f('0x7'));var attributes=require(_0xa88f('0x8'));var integrations=require(_0xa88f('0x9'));module[_0xa88f('0xa')]=function(_0x2a44c7,_0x5f22cc){return _0x2a44c7[_0xa88f('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 4968f71..06070a4 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 _0xdf77=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetZendeskAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird'];(function(_0xaf4e3b,_0x3527ac){var _0x37a1e1=function(_0x49dc7f){while(--_0x49dc7f){_0xaf4e3b['push'](_0xaf4e3b['shift']());}};_0x37a1e1(++_0x3527ac);}(_0xdf77,0x138));var _0x7df7=function(_0x524815,_0x18a7d4){_0x524815=_0x524815-0x0;var _0x4c7a2c=_0xdf77[_0x524815];return _0x4c7a2c;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var moment=require('moment');var BPromise=require(_0x7df7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df7('0x3'));var db=require(_0x7df7('0x4'))['db'];var utils=require(_0x7df7('0x5'));var logger=require(_0x7df7('0x6'))(_0x7df7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7df7('0x8')][_0x7df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310812,_0xefd18d,_0x3ab668){return new BPromise(function(_0x5a376b,_0xc95091){return client[_0x7df7('0xa')](_0x310812,_0x3ab668)[_0x7df7('0xb')](function(_0x1bfde6){logger['info'](_0x7df7('0xc'),_0xefd18d,_0x7df7('0xd'));logger['debug'](_0x7df7('0xe'),_0xefd18d,_0x7df7('0xd'),JSON[_0x7df7('0xf')](_0x1bfde6));if(_0x1bfde6['error']){if(_0x1bfde6['error'][_0x7df7('0x10')]===0x1f4){logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0x1bfde6[_0x7df7('0x11')][_0x7df7('0x12')]);return _0xc95091(_0x1bfde6[_0x7df7('0x11')]['message']);}logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0x1bfde6['error']['message']);return _0x5a376b(_0x1bfde6[_0x7df7('0x11')][_0x7df7('0x12')]);}else{logger[_0x7df7('0x13')](_0x7df7('0xc'),_0xefd18d,_0x7df7('0xd'));_0x5a376b(_0x1bfde6[_0x7df7('0x14')][_0x7df7('0x12')]);}})[_0x7df7('0x15')](function(_0xdc6dff){logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0xdc6dff);_0xc95091(_0xdc6dff);});});}exports[_0x7df7('0x16')]=function(_0x277375){var _0xb9dc70=this;return new Promise(function(_0x45c8a4,_0x19f270){return db['ZendeskAccount'][_0x7df7('0x17')]({'raw':_0x277375[_0x7df7('0x18')]?_0x277375['options']['raw']===undefined?!![]:![]:!![],'where':_0x277375[_0x7df7('0x18')]?_0x277375[_0x7df7('0x18')][_0x7df7('0x19')]||null:null,'attributes':_0x277375['options']?_0x277375[_0x7df7('0x18')][_0x7df7('0x1a')]||null:null,'limit':_0x277375[_0x7df7('0x18')]?_0x277375['options'][_0x7df7('0x1b')]||null:null,'include':_0x277375['options']?_0x277375[_0x7df7('0x18')][_0x7df7('0x1c')]?_['map'](_0x277375[_0x7df7('0x18')][_0x7df7('0x1c')],function(_0xf556cd){return{'model':db[_0xf556cd[_0x7df7('0x1d')]],'as':_0xf556cd['as'],'attributes':_0xf556cd[_0x7df7('0x1a')],'include':_0xf556cd[_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0xf556cd[_0x7df7('0x1c')],function(_0x108e89){return{'model':db[_0x108e89['model']],'as':_0x108e89['as'],'attributes':_0x108e89[_0x7df7('0x1a')],'include':_0x108e89['include']?_[_0x7df7('0x1e')](_0x108e89[_0x7df7('0x1c')],function(_0x55f132){return{'model':db[_0x55f132['model']],'as':_0x55f132['as'],'attributes':_0x55f132['attributes']};}):[]};}):[]};}):[]:[]})[_0x7df7('0xb')](function(_0x557ede){logger[_0x7df7('0x13')](_0x7df7('0x16'),_0x277375);logger[_0x7df7('0x1f')](_0x7df7('0x16'),_0x277375,JSON['stringify'](_0x557ede));_0x45c8a4(_0x557ede);})[_0x7df7('0x15')](function(_0x58b105){logger['error'](_0x7df7('0x16'),_0x58b105[_0x7df7('0x12')],_0x277375);_0x19f270(_0xb9dc70[_0x7df7('0x11')](0x1f4,_0x58b105[_0x7df7('0x12')]));});});};exports[_0x7df7('0x20')]=function(_0x4c43f8){var _0x1bbd01=this;return new Promise(function(_0x698605,_0x4281b6){return db[_0x7df7('0x21')][_0x7df7('0x22')]({'raw':_0x4c43f8['options']?_0x4c43f8[_0x7df7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')]['where']||null:null,'attributes':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')]['attributes']||null:null,'include':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')][_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0x4c43f8['options']['include'],function(_0x20fe65){return{'model':db[_0x20fe65[_0x7df7('0x1d')]],'as':_0x20fe65['as'],'attributes':_0x20fe65[_0x7df7('0x1a')],'include':_0x20fe65[_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0x20fe65[_0x7df7('0x1c')],function(_0x15ebea){return{'model':db[_0x15ebea[_0x7df7('0x1d')]],'as':_0x15ebea['as'],'attributes':_0x15ebea['attributes'],'include':_0x15ebea[_0x7df7('0x1c')]?_['map'](_0x15ebea[_0x7df7('0x1c')],function(_0x5171cd){return{'model':db[_0x5171cd[_0x7df7('0x1d')]],'as':_0x5171cd['as'],'attributes':_0x5171cd[_0x7df7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7df7('0xb')](function(_0x56605d){logger[_0x7df7('0x13')](_0x7df7('0x20'),_0x4c43f8);logger[_0x7df7('0x1f')](_0x7df7('0x20'),_0x4c43f8,JSON['stringify'](_0x56605d));_0x698605(_0x56605d);})['catch'](function(_0x1f0549){logger[_0x7df7('0x11')](_0x7df7('0x20'),_0x1f0549[_0x7df7('0x12')],_0x4c43f8);_0x4281b6(_0x1bbd01[_0x7df7('0x11')](0x1f4,_0x1f0549['message']));});});}; \ No newline at end of file +var _0xf4b6=['raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','limit','include','map','model','ShowZendeskAccount'];(function(_0x47ffd8,_0xa610e8){var _0x2e4c7f=function(_0x4a25af){while(--_0x4a25af){_0x47ffd8['push'](_0x47ffd8['shift']());}};_0x2e4c7f(++_0xa610e8);}(_0xf4b6,0x85));var _0x6f4b=function(_0x509b10,_0x2058ac){_0x509b10=_0x509b10-0x0;var _0x38cf01=_0xf4b6[_0x509b10];return _0x38cf01;};'use strict';var _=require('lodash');var util=require(_0x6f4b('0x0'));var moment=require(_0x6f4b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f4b('0x2'));var fs=require('fs');var Redis=require(_0x6f4b('0x3'));var db=require(_0x6f4b('0x4'))['db'];var utils=require(_0x6f4b('0x5'));var logger=require(_0x6f4b('0x6'))('rpc');var config=require(_0x6f4b('0x7'));var jayson=require(_0x6f4b('0x8'));var client=jayson[_0x6f4b('0x9')][_0x6f4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b6061,_0x22e83b,_0xc84edc){return new BPromise(function(_0x464f59,_0x478123){return client['request'](_0x2b6061,_0xc84edc)[_0x6f4b('0xb')](function(_0x27e429){logger['info'](_0x6f4b('0xc'),_0x22e83b,_0x6f4b('0xd'));logger[_0x6f4b('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x22e83b,_0x6f4b('0xd'),JSON[_0x6f4b('0xf')](_0x27e429));if(_0x27e429['error']){if(_0x27e429[_0x6f4b('0x10')][_0x6f4b('0x11')]===0x1f4){logger[_0x6f4b('0x10')](_0x6f4b('0xc'),_0x22e83b,_0x27e429[_0x6f4b('0x10')][_0x6f4b('0x12')]);return _0x478123(_0x27e429[_0x6f4b('0x10')]['message']);}logger[_0x6f4b('0x10')](_0x6f4b('0xc'),_0x22e83b,_0x27e429[_0x6f4b('0x10')]['message']);return _0x464f59(_0x27e429['error'][_0x6f4b('0x12')]);}else{logger[_0x6f4b('0x13')](_0x6f4b('0xc'),_0x22e83b,_0x6f4b('0xd'));_0x464f59(_0x27e429[_0x6f4b('0x14')][_0x6f4b('0x12')]);}})[_0x6f4b('0x15')](function(_0x26b4f0){logger['error'](_0x6f4b('0xc'),_0x22e83b,_0x26b4f0);_0x478123(_0x26b4f0);});});}exports[_0x6f4b('0x16')]=function(_0x444ea4){var _0xaf3000=this;return new Promise(function(_0x5e6ed3,_0x56bf4a){return db[_0x6f4b('0x17')]['findAll']({'raw':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4['options']['raw']===undefined?!![]:![]:!![],'where':_0x444ea4['options']?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x19')]||null:null,'attributes':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1a')]||null:null,'limit':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1b')]||null:null,'include':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x444ea4[_0x6f4b('0x18')]['include'],function(_0x1f9717){return{'model':db[_0x1f9717['model']],'as':_0x1f9717['as'],'attributes':_0x1f9717['attributes'],'include':_0x1f9717[_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x1f9717[_0x6f4b('0x1c')],function(_0x38d413){return{'model':db[_0x38d413[_0x6f4b('0x1e')]],'as':_0x38d413['as'],'attributes':_0x38d413[_0x6f4b('0x1a')],'include':_0x38d413[_0x6f4b('0x1c')]?_['map'](_0x38d413[_0x6f4b('0x1c')],function(_0x545c77){return{'model':db[_0x545c77[_0x6f4b('0x1e')]],'as':_0x545c77['as'],'attributes':_0x545c77['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26bbf1){logger[_0x6f4b('0x13')]('GetZendeskAccount',_0x444ea4);logger['debug'](_0x6f4b('0x16'),_0x444ea4,JSON[_0x6f4b('0xf')](_0x26bbf1));_0x5e6ed3(_0x26bbf1);})[_0x6f4b('0x15')](function(_0x50117f){logger[_0x6f4b('0x10')](_0x6f4b('0x16'),_0x50117f[_0x6f4b('0x12')],_0x444ea4);_0x56bf4a(_0xaf3000[_0x6f4b('0x10')](0x1f4,_0x50117f[_0x6f4b('0x12')]));});});};exports[_0x6f4b('0x1f')]=function(_0x5094af){var _0x35bd04=this;return new Promise(function(_0x34310d,_0x1321a8){return db['ZendeskAccount']['find']({'raw':_0x5094af['options']?_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x20')]===undefined?!![]:![]:!![],'where':_0x5094af['options']?_0x5094af['options'][_0x6f4b('0x19')]||null:null,'attributes':_0x5094af[_0x6f4b('0x18')]?_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x1a')]||null:null,'include':_0x5094af[_0x6f4b('0x18')]?_0x5094af['options'][_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x1c')],function(_0x3dbc8b){return{'model':db[_0x3dbc8b[_0x6f4b('0x1e')]],'as':_0x3dbc8b['as'],'attributes':_0x3dbc8b['attributes'],'include':_0x3dbc8b[_0x6f4b('0x1c')]?_['map'](_0x3dbc8b[_0x6f4b('0x1c')],function(_0x2b3c0a){return{'model':db[_0x2b3c0a[_0x6f4b('0x1e')]],'as':_0x2b3c0a['as'],'attributes':_0x2b3c0a['attributes'],'include':_0x2b3c0a[_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x2b3c0a[_0x6f4b('0x1c')],function(_0x1cdd9f){return{'model':db[_0x1cdd9f[_0x6f4b('0x1e')]],'as':_0x1cdd9f['as'],'attributes':_0x1cdd9f[_0x6f4b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6f4b('0xb')](function(_0x2dd32e){logger['info']('ShowZendeskAccount',_0x5094af);logger[_0x6f4b('0xe')](_0x6f4b('0x1f'),_0x5094af,JSON[_0x6f4b('0xf')](_0x2dd32e));_0x34310d(_0x2dd32e);})['catch'](function(_0x5b72be){logger[_0x6f4b('0x10')](_0x6f4b('0x1f'),_0x5b72be[_0x6f4b('0x12')],_0x5094af);_0x1321a8(_0x35bd04['error'](0x1f4,_0x5b72be[_0x6f4b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 526cab3..68aa9e2 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 _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x56f8aa,_0x2d0904){var _0x25d055=function(_0x5baab0){while(--_0x5baab0){_0x56f8aa['push'](_0x56f8aa['shift']());}};_0x25d055(++_0x2d0904);}(_0x757a,0xde));var _0xa757=function(_0x5eb91c,_0x3bfea1){_0x5eb91c=_0x5eb91c-0x0;var _0x552baa=_0x757a[_0x5eb91c];return _0x552baa;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x28806e,_0x5ee1ff){var _0x21362f=function(_0x4adbcc){while(--_0x4adbcc){_0x28806e['push'](_0x28806e['shift']());}};_0x21362f(++_0x5ee1ff);}(_0x0bb5,0x148));var _0x50bb=function(_0x46c648,_0x597f1c){_0x46c648=_0x46c648-0x0;var _0x12bbb0=_0x0bb5[_0x46c648];return _0x12bbb0;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e73770b..29ba455 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 _0x71a3=['STRING','exports'];(function(_0x382879,_0x2ef53d){var _0x3944e3=function(_0x8c4cf0){while(--_0x8c4cf0){_0x382879['push'](_0x382879['shift']());}};_0x3944e3(++_0x2ef53d);}(_0x71a3,0x18b));var _0x371a=function(_0x2e1f26,_0x7e95c2){_0x2e1f26=_0x2e1f26-0x0;var _0x1717d2=_0x71a3[_0x2e1f26];return _0x1717d2;};'use strict';var Sequelize=require('sequelize');module[_0x371a('0x0')]={'name':{'type':Sequelize[_0x371a('0x1')]},'description':{'type':Sequelize[_0x371a('0x1')]}}; \ No newline at end of file +var _0xbab8=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbab8,0x154));var _0x8bab=function(_0x5b1394,_0x17f08d){_0x5b1394=_0x5b1394-0x0;var _0x483150=_0xbab8[_0x5b1394];return _0x483150;};'use strict';var Sequelize=require('sequelize');module[_0x8bab('0x0')]={'name':{'type':Sequelize[_0x8bab('0x1')]},'description':{'type':Sequelize[_0x8bab('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0a54acc..e4429fe 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 _0xc0ea=['error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','update','body','getFields','findOne','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xc0ea,0x185));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac0e('0x1'));var rp=require(_0xac0e('0x2'));var moment=require('moment');var BPromise=require(_0xac0e('0x3'));var Mustache=require(_0xac0e('0x4'));var util=require(_0xac0e('0x5'));var path=require(_0xac0e('0x6'));var sox=require(_0xac0e('0x7'));var csv=require(_0xac0e('0x8'));var ejs=require(_0xac0e('0x9'));var fs=require('fs');var fs_extra=require(_0xac0e('0xa'));var _=require(_0xac0e('0xb'));var squel=require(_0xac0e('0xc'));var crypto=require(_0xac0e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xac0e('0xe'));var toCsv=require(_0xac0e('0x8'));var querystring=require(_0xac0e('0xf'));var Papa=require(_0xac0e('0x10'));var Redis=require(_0xac0e('0x11'));var authService=require(_0xac0e('0x12'));var qs=require(_0xac0e('0x13'));var as=require(_0xac0e('0x14'));var hardwareService=require(_0xac0e('0x15'));var logger=require(_0xac0e('0x16'))(_0xac0e('0x17'));var utils=require(_0xac0e('0x18'));var config=require(_0xac0e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xac0e('0x1a'))['db'];function respondWithStatusCode(_0x2fe338,_0x46fdb8){_0x46fdb8=_0x46fdb8||0xcc;return function(_0x2bfc04){if(_0x2bfc04){return _0x2fe338[_0xac0e('0x1b')](_0x46fdb8);}return _0x2fe338[_0xac0e('0x1c')](_0x46fdb8)[_0xac0e('0x1d')]();};}function respondWithResult(_0x4a9bb7,_0xf072ce){_0xf072ce=_0xf072ce||0xc8;return function(_0x256958){if(_0x256958){return _0x4a9bb7[_0xac0e('0x1c')](_0xf072ce)['json'](_0x256958);}};}function respondWithFilteredResult(_0x361b25,_0x49501d){return function(_0x1feb52){if(_0x1feb52){var _0xb40d41=typeof _0x49501d['offset']==='undefined'&&typeof _0x49501d[_0xac0e('0x1e')]===_0xac0e('0x1f');var _0x125e22=_0x1feb52[_0xac0e('0x20')];var _0x5119e9=_0xb40d41?0x0:_0x49501d[_0xac0e('0x21')];var _0x1db95e=_0xb40d41?_0x1feb52['count']:_0x49501d[_0xac0e('0x21')]+_0x49501d[_0xac0e('0x1e')];var _0x1b050f;if(_0x1db95e>=_0x125e22){_0x1db95e=_0x125e22;_0x1b050f=0xc8;}else{_0x1b050f=0xce;}_0x361b25[_0xac0e('0x1c')](_0x1b050f);return _0x361b25[_0xac0e('0x22')](_0xac0e('0x23'),_0x5119e9+'-'+_0x1db95e+'/'+_0x125e22)[_0xac0e('0x24')](_0x1feb52);}return null;};}function patchUpdates(_0x3b4ee7){return function(_0x38f34e){try{jsonpatch[_0xac0e('0x25')](_0x38f34e,_0x3b4ee7,!![]);}catch(_0x31c422){return BPromise[_0xac0e('0x26')](_0x31c422);}return _0x38f34e['save']();};}function saveUpdates(_0x30c842,_0x318bc3){return function(_0x4c024a){if(_0x4c024a){return _0x4c024a['update'](_0x30c842)[_0xac0e('0x27')](function(_0x475b5c){return _0x475b5c;});}return null;};}function removeEntity(_0x1ede31,_0x2c7fc6){return function(_0x1f8735){if(_0x1f8735){return _0x1f8735[_0xac0e('0x28')]()[_0xac0e('0x27')](function(){_0x1ede31[_0xac0e('0x1c')](0xcc)[_0xac0e('0x1d')]();});}};}function handleEntityNotFound(_0x223d31,_0xdb17a3){return function(_0x278ad3){if(!_0x278ad3){_0x223d31['sendStatus'](0x194);}return _0x278ad3;};}function handleError(_0x3c6679,_0x10f8bb){_0x10f8bb=_0x10f8bb||0x1f4;return function(_0x4d2a2e){logger[_0xac0e('0x29')](_0x4d2a2e[_0xac0e('0x2a')]);if(_0x4d2a2e['name']){delete _0x4d2a2e[_0xac0e('0x2b')];}_0x3c6679[_0xac0e('0x1c')](_0x10f8bb)[_0xac0e('0x2c')](_0x4d2a2e);};}exports[_0xac0e('0x2d')]=function(_0x1022a3,_0x27e4b1){var _0x2960f5={},_0x80a025={},_0x2d2703={'count':0x0,'rows':[]};var _0x4377b0=_[_0xac0e('0x2e')](db[_0xac0e('0x2f')][_0xac0e('0x30')],function(_0x43d4e7){return{'name':_0x43d4e7['fieldName'],'type':_0x43d4e7['type'][_0xac0e('0x31')]};});_0x80a025[_0xac0e('0x32')]=_[_0xac0e('0x2e')](_0x4377b0,_0xac0e('0x2b'));_0x80a025[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x1022a3[_0xac0e('0x33')]);_0x80a025[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x80a025[_0xac0e('0x32')],_0x80a025[_0xac0e('0x33')]);_0x2960f5['attributes']=_[_0xac0e('0x36')](_0x80a025[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x1022a3[_0xac0e('0x33')][_0xac0e('0x37')]));_0x2960f5[_0xac0e('0x38')]=_0x2960f5[_0xac0e('0x38')][_0xac0e('0x39')]?_0x2960f5[_0xac0e('0x38')]:_0x80a025[_0xac0e('0x32')];if(!_0x1022a3['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x2960f5[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x1022a3['query']['limit']);_0x2960f5[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x1022a3['query'][_0xac0e('0x21')]);}_0x2960f5[_0xac0e('0x3c')]=qs['sort'](_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x2960f5['where']=qs['filters'](_[_0xac0e('0x3e')](_0x1022a3[_0xac0e('0x33')],_0x80a025[_0xac0e('0x35')]),_0x4377b0);if(_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3f')]){_0x2960f5['where']=_[_0xac0e('0x40')](_0x2960f5[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x4377b0,function(_0x18f9fb){if(_0x18f9fb[_0xac0e('0x42')]!==_0xac0e('0x43')){var _0x412423={};_0x412423[_0x18f9fb[_0xac0e('0x2b')]]={'$like':'%'+_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3f')]+'%'};return _0x412423;}})});}_0x2960f5=_[_0xac0e('0x40')]({},_0x2960f5,_0x1022a3[_0xac0e('0x44')]);var _0x4f3139={'where':_0x2960f5[_0xac0e('0x41')]};return db[_0xac0e('0x2f')]['count'](_0x4f3139)['then'](function(_0x1292e0){_0x2d2703[_0xac0e('0x20')]=_0x1292e0;if(_0x1022a3['query'][_0xac0e('0x45')]){_0x2960f5[_0xac0e('0x46')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xac0e('0x47')](_0x2960f5);})[_0xac0e('0x27')](function(_0x128cfa){_0x2d2703[_0xac0e('0x48')]=_0x128cfa;return _0x2d2703;})[_0xac0e('0x27')](respondWithFilteredResult(_0x27e4b1,_0x2960f5))[_0xac0e('0x49')](handleError(_0x27e4b1,null));};exports['show']=function(_0x3e0a5c,_0x3081bc){var _0x36d933={'raw':![],'where':{'id':_0x3e0a5c[_0xac0e('0x4a')]['id']}},_0xe3060c={};_0xe3060c['model']=_['keys'](db['ZendeskConfiguration'][_0xac0e('0x30')]);_0xe3060c[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x3e0a5c[_0xac0e('0x33')]);_0xe3060c[_0xac0e('0x35')]=_['intersection'](_0xe3060c[_0xac0e('0x32')],_0xe3060c[_0xac0e('0x33')]);_0x36d933[_0xac0e('0x38')]=_[_0xac0e('0x36')](_0xe3060c[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x3e0a5c['query'][_0xac0e('0x37')]));_0x36d933[_0xac0e('0x38')]=_0x36d933[_0xac0e('0x38')][_0xac0e('0x39')]?_0x36d933[_0xac0e('0x38')]:_0xe3060c[_0xac0e('0x32')];if(_0x3e0a5c[_0xac0e('0x33')]['includeAll']){_0x36d933[_0xac0e('0x46')]=[{'all':!![]}];}_0x36d933=_[_0xac0e('0x40')]({},_0x36d933,_0x3e0a5c[_0xac0e('0x44')]);return db['ZendeskConfiguration'][_0xac0e('0x4b')](_0x36d933)[_0xac0e('0x27')](handleEntityNotFound(_0x3081bc,null))[_0xac0e('0x27')](respondWithResult(_0x3081bc,null))['catch'](handleError(_0x3081bc,null));};exports['create']=function(_0x16b61b,_0x1ebab3){return db['ZendeskConfiguration']['create'](_0x16b61b['body'],{})[_0xac0e('0x27')](respondWithResult(_0x1ebab3,0xc9))['catch'](handleError(_0x1ebab3,null));};exports[_0xac0e('0x4c')]=function(_0x4cde4b,_0x4b7a90){if(_0x4cde4b[_0xac0e('0x4d')]['id']){delete _0x4cde4b[_0xac0e('0x4d')]['id'];}return db[_0xac0e('0x2f')][_0xac0e('0x4b')]({'where':{'id':_0x4cde4b[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b7a90,null))['then'](saveUpdates(_0x4cde4b[_0xac0e('0x4d')],null))[_0xac0e('0x27')](respondWithResult(_0x4b7a90,null))['catch'](handleError(_0x4b7a90,null));};exports[_0xac0e('0x28')]=function(_0x533ec0,_0x42f51c){return db[_0xac0e('0x2f')]['find']({'where':{'id':_0x533ec0[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f51c,null))['then'](removeEntity(_0x42f51c,null))['catch'](handleError(_0x42f51c,null));};exports[_0xac0e('0x4e')]=function(_0x451c5f,_0x4d5ba8,_0x126d8d){var _0x1cc155={};var _0x218181={};var _0xf87e26;var _0x40f854;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x451c5f[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x4d5ba8,null))['then'](function(_0x2deed1){if(_0x2deed1){_0xf87e26=_0x2deed1;_0x218181[_0xac0e('0x32')]=_['keys'](db['ZendeskField'][_0xac0e('0x30')]);_0x218181[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x451c5f['query']);_0x218181[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x218181[_0xac0e('0x32')],_0x218181[_0xac0e('0x33')]);_0x1cc155[_0xac0e('0x38')]=_[_0xac0e('0x36')](_0x218181[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x451c5f[_0xac0e('0x33')]['fields']));_0x1cc155[_0xac0e('0x38')]=_0x1cc155[_0xac0e('0x38')][_0xac0e('0x39')]?_0x1cc155[_0xac0e('0x38')]:_0x218181[_0xac0e('0x32')];_0x1cc155[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x451c5f[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x1cc155['where']=qs[_0xac0e('0x35')](_[_0xac0e('0x3e')](_0x451c5f[_0xac0e('0x33')],_0x218181['filters']));if(_0x451c5f[_0xac0e('0x33')][_0xac0e('0x3f')]){_0x1cc155[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x1cc155[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x1cc155[_0xac0e('0x38')],function(_0x4302cd){var _0x1ba2b2={};_0x1ba2b2[_0x4302cd]={'$like':'%'+_0x451c5f['query'][_0xac0e('0x3f')]+'%'};return _0x1ba2b2;})});}_0x1cc155=_[_0xac0e('0x40')]({},_0x1cc155,_0x451c5f[_0xac0e('0x44')]);return _0xf87e26[_0xac0e('0x4e')](_0x1cc155);}})[_0xac0e('0x27')](function(_0x12e8d4){if(_0x12e8d4){_0x40f854=_0x12e8d4[_0xac0e('0x39')];if(!_0x451c5f['query'][_0xac0e('0x3a')]('nolimit')){_0x1cc155[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x451c5f[_0xac0e('0x33')][_0xac0e('0x1e')]);_0x1cc155[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x451c5f[_0xac0e('0x33')]['offset']);}return _0xf87e26['getFields'](_0x1cc155);}})[_0xac0e('0x27')](function(_0x1bcb7b){if(_0x1bcb7b){return _0x1bcb7b?{'count':_0x40f854,'rows':_0x1bcb7b}:null;}})[_0xac0e('0x27')](respondWithResult(_0x4d5ba8,null))[_0xac0e('0x49')](handleError(_0x4d5ba8,null));};exports[_0xac0e('0x50')]=function(_0x10ae3f,_0x5d2d58,_0x19961a){var _0x5ad375={};var _0x2bb14b={};var _0x3e290c;var _0x1655b5;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x10ae3f[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x5d2d58,null))[_0xac0e('0x27')](function(_0x2364f2){if(_0x2364f2){_0x3e290c=_0x2364f2;_0x2bb14b['model']=_[_0xac0e('0x34')](db[_0xac0e('0x51')][_0xac0e('0x30')]);_0x2bb14b[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x10ae3f['query']);_0x2bb14b[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x2bb14b[_0xac0e('0x32')],_0x2bb14b[_0xac0e('0x33')]);_0x5ad375[_0xac0e('0x38')]=_['intersection'](_0x2bb14b[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x10ae3f[_0xac0e('0x33')][_0xac0e('0x37')]));_0x5ad375['attributes']=_0x5ad375[_0xac0e('0x38')]['length']?_0x5ad375[_0xac0e('0x38')]:_0x2bb14b[_0xac0e('0x32')];_0x5ad375[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x10ae3f[_0xac0e('0x33')]['sort']);_0x5ad375[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_[_0xac0e('0x3e')](_0x10ae3f[_0xac0e('0x33')],_0x2bb14b[_0xac0e('0x35')]));if(_0x10ae3f['query']['filter']){_0x5ad375['where']=_[_0xac0e('0x40')](_0x5ad375['where'],{'$or':_[_0xac0e('0x2e')](_0x5ad375[_0xac0e('0x38')],function(_0x36ca43){var _0x47a3ec={};_0x47a3ec[_0x36ca43]={'$like':'%'+_0x10ae3f[_0xac0e('0x33')]['filter']+'%'};return _0x47a3ec;})});}_0x5ad375=_[_0xac0e('0x40')]({},_0x5ad375,_0x10ae3f[_0xac0e('0x44')]);return _0x3e290c[_0xac0e('0x50')](_0x5ad375);}})[_0xac0e('0x27')](function(_0x10a8ae){if(_0x10a8ae){_0x1655b5=_0x10a8ae[_0xac0e('0x39')];if(!_0x10ae3f['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x5ad375['limit']=qs[_0xac0e('0x1e')](_0x10ae3f['query'][_0xac0e('0x1e')]);_0x5ad375[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x10ae3f[_0xac0e('0x33')][_0xac0e('0x21')]);}return _0x3e290c[_0xac0e('0x50')](_0x5ad375);}})[_0xac0e('0x27')](function(_0x412fbd){if(_0x412fbd){return _0x412fbd?{'count':_0x1655b5,'rows':_0x412fbd}:null;}})[_0xac0e('0x27')](respondWithResult(_0x5d2d58,null))['catch'](handleError(_0x5d2d58,null));};exports[_0xac0e('0x52')]=function(_0x1e6ba9,_0x33388a,_0x229f7a){var _0x338492={};var _0x2f2aaa={};var _0x55a9dc;var _0x5874ff;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x1e6ba9[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x33388a,null))[_0xac0e('0x27')](function(_0x1057a6){if(_0x1057a6){_0x55a9dc=_0x1057a6;_0x2f2aaa['model']=_[_0xac0e('0x34')](db[_0xac0e('0x51')]['rawAttributes']);_0x2f2aaa[_0xac0e('0x33')]=_['keys'](_0x1e6ba9[_0xac0e('0x33')]);_0x2f2aaa['filters']=_[_0xac0e('0x36')](_0x2f2aaa['model'],_0x2f2aaa['query']);_0x338492[_0xac0e('0x38')]=_['intersection'](_0x2f2aaa[_0xac0e('0x32')],qs['fields'](_0x1e6ba9[_0xac0e('0x33')][_0xac0e('0x37')]));_0x338492[_0xac0e('0x38')]=_0x338492[_0xac0e('0x38')][_0xac0e('0x39')]?_0x338492[_0xac0e('0x38')]:_0x2f2aaa[_0xac0e('0x32')];_0x338492['order']=qs[_0xac0e('0x3d')](_0x1e6ba9[_0xac0e('0x33')]['sort']);_0x338492[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_['pick'](_0x1e6ba9[_0xac0e('0x33')],_0x2f2aaa[_0xac0e('0x35')]));if(_0x1e6ba9['query'][_0xac0e('0x3f')]){_0x338492[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x338492['where'],{'$or':_[_0xac0e('0x2e')](_0x338492[_0xac0e('0x38')],function(_0x5e055d){var _0x27b4d3={};_0x27b4d3[_0x5e055d]={'$like':'%'+_0x1e6ba9[_0xac0e('0x33')][_0xac0e('0x3f')]+'%'};return _0x27b4d3;})});}_0x338492=_['merge']({},_0x338492,_0x1e6ba9['options']);return _0x55a9dc['getDescriptions'](_0x338492);}})[_0xac0e('0x27')](function(_0x716da1){if(_0x716da1){_0x5874ff=_0x716da1['length'];if(!_0x1e6ba9['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x338492[_0xac0e('0x1e')]=qs['limit'](_0x1e6ba9[_0xac0e('0x33')]['limit']);_0x338492['offset']=qs[_0xac0e('0x21')](_0x1e6ba9['query'][_0xac0e('0x21')]);}return _0x55a9dc[_0xac0e('0x52')](_0x338492);}})[_0xac0e('0x27')](function(_0xde1d9f){if(_0xde1d9f){return _0xde1d9f?{'count':_0x5874ff,'rows':_0xde1d9f}:null;}})['then'](respondWithResult(_0x33388a,null))[_0xac0e('0x49')](handleError(_0x33388a,null));};exports[_0xac0e('0x53')]=function(_0x3b80ab,_0x13bebb,_0x222c35){var _0x216452={};var _0x5db5e0={};var _0x296aeb;var _0x52704f;return db['ZendeskConfiguration'][_0xac0e('0x4f')]({'where':{'id':_0x3b80ab[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x13bebb,null))[_0xac0e('0x27')](function(_0x1c17a9){if(_0x1c17a9){_0x296aeb=_0x1c17a9;_0x5db5e0[_0xac0e('0x32')]=_[_0xac0e('0x34')](db[_0xac0e('0x54')][_0xac0e('0x30')]);_0x5db5e0['query']=_[_0xac0e('0x34')](_0x3b80ab[_0xac0e('0x33')]);_0x5db5e0[_0xac0e('0x35')]=_['intersection'](_0x5db5e0[_0xac0e('0x32')],_0x5db5e0['query']);_0x216452[_0xac0e('0x38')]=_['intersection'](_0x5db5e0['model'],qs[_0xac0e('0x37')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x37')]));_0x216452[_0xac0e('0x38')]=_0x216452[_0xac0e('0x38')][_0xac0e('0x39')]?_0x216452[_0xac0e('0x38')]:_0x5db5e0[_0xac0e('0x32')];_0x216452[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x216452[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_['pick'](_0x3b80ab[_0xac0e('0x33')],_0x5db5e0[_0xac0e('0x35')]));if(_0x3b80ab[_0xac0e('0x33')]['filter']){_0x216452[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x216452[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x216452[_0xac0e('0x38')],function(_0x19ec51){var _0x2c4e81={};_0x2c4e81[_0x19ec51]={'$like':'%'+_0x3b80ab['query'][_0xac0e('0x3f')]+'%'};return _0x2c4e81;})});}_0x216452=_[_0xac0e('0x40')]({},_0x216452,_0x3b80ab[_0xac0e('0x44')]);return _0x296aeb['getTags'](_0x216452);}})[_0xac0e('0x27')](function(_0x170ba1){if(_0x170ba1){_0x52704f=_0x170ba1['length'];if(!_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x216452[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x1e')]);_0x216452[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x21')]);}return _0x296aeb[_0xac0e('0x53')](_0x216452);}})[_0xac0e('0x27')](function(_0x483df4){if(_0x483df4){return _0x483df4?{'count':_0x52704f,'rows':_0x483df4}:null;}})[_0xac0e('0x27')](respondWithResult(_0x13bebb,null))[_0xac0e('0x49')](handleError(_0x13bebb,null));};exports[_0xac0e('0x55')]=function(_0x2e40f7,_0x2a8e76,_0x526f30){if(_0x2e40f7[_0xac0e('0x4d')]['id']){delete _0x2e40f7[_0xac0e('0x4d')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2e40f7[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8e76,null))[_0xac0e('0x27')](function(_0x56985a){if(_0x56985a){return _0x56985a[_0xac0e('0x55')](_0x2e40f7[_0xac0e('0x4d')]['ids']||[]);}return null;})[_0xac0e('0x27')](respondWithResult(_0x2a8e76,null))[_0xac0e('0x49')](handleError(_0x2a8e76,null));}; \ No newline at end of file +var _0x30ea=['include','catch','create','body','find','params','ZendeskField','order','pick','merge','getFields','getSubjects','findOne','nolimit','getDescriptions','getTags','setTags','rimraf','zip-dir','moment','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','then','destroy','sendStatus','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','VIRTUAL','options','show','includeAll'];(function(_0xa8090b,_0x3f0cdd){var _0x30dd72=function(_0x13534c){while(--_0x13534c){_0xa8090b['push'](_0xa8090b['shift']());}};_0x30dd72(++_0x3f0cdd);}(_0x30ea,0x188));var _0xa30e=function(_0x5d4a34,_0x22e791){_0x5d4a34=_0x5d4a34-0x0;var _0x45279b=_0x30ea[_0x5d4a34];return _0x45279b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa30e('0x0'));var zipdir=require(_0xa30e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa30e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa30e('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa30e('0x4'));var ejs=require(_0xa30e('0x5'));var fs=require('fs');var fs_extra=require(_0xa30e('0x6'));var _=require('lodash');var squel=require(_0xa30e('0x7'));var crypto=require('crypto');var jsforce=require(_0xa30e('0x8'));var deskjs=require(_0xa30e('0x9'));var toCsv=require(_0xa30e('0x4'));var querystring=require(_0xa30e('0xa'));var Papa=require(_0xa30e('0xb'));var Redis=require(_0xa30e('0xc'));var authService=require(_0xa30e('0xd'));var qs=require(_0xa30e('0xe'));var as=require(_0xa30e('0xf'));var hardwareService=require(_0xa30e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa30e('0x11'));var config=require(_0xa30e('0x12'));var licenseUtil=require(_0xa30e('0x13'));var db=require(_0xa30e('0x14'))['db'];function respondWithStatusCode(_0x2087db,_0x2af378){_0x2af378=_0x2af378||0xcc;return function(_0x56c9b7){if(_0x56c9b7){return _0x2087db['sendStatus'](_0x2af378);}return _0x2087db[_0xa30e('0x15')](_0x2af378)[_0xa30e('0x16')]();};}function respondWithResult(_0x17c24c,_0xa56699){_0xa56699=_0xa56699||0xc8;return function(_0x338bf9){if(_0x338bf9){return _0x17c24c[_0xa30e('0x15')](_0xa56699)[_0xa30e('0x17')](_0x338bf9);}};}function respondWithFilteredResult(_0x17b99b,_0x30eff5){return function(_0x1dfd22){if(_0x1dfd22){var _0x13b4c3=typeof _0x30eff5[_0xa30e('0x18')]===_0xa30e('0x19')&&typeof _0x30eff5['limit']===_0xa30e('0x19');var _0x5ac607=_0x1dfd22[_0xa30e('0x1a')];var _0x573e14=_0x13b4c3?0x0:_0x30eff5[_0xa30e('0x18')];var _0x3e78fb=_0x13b4c3?_0x1dfd22[_0xa30e('0x1a')]:_0x30eff5[_0xa30e('0x18')]+_0x30eff5[_0xa30e('0x1b')];var _0x3cc93d;if(_0x3e78fb>=_0x5ac607){_0x3e78fb=_0x5ac607;_0x3cc93d=0xc8;}else{_0x3cc93d=0xce;}_0x17b99b['status'](_0x3cc93d);return _0x17b99b['set']('Content-Range',_0x573e14+'-'+_0x3e78fb+'/'+_0x5ac607)[_0xa30e('0x17')](_0x1dfd22);}return null;};}function patchUpdates(_0x2b8df4){return function(_0x1b2f25){try{jsonpatch['apply'](_0x1b2f25,_0x2b8df4,!![]);}catch(_0x46f68d){return BPromise[_0xa30e('0x1c')](_0x46f68d);}return _0x1b2f25[_0xa30e('0x1d')]();};}function saveUpdates(_0x5f319a,_0x59ed14){return function(_0x278696){if(_0x278696){return _0x278696['update'](_0x5f319a)[_0xa30e('0x1e')](function(_0x4c3a04){return _0x4c3a04;});}return null;};}function removeEntity(_0xff5f0a,_0x5dca94){return function(_0x4eddc0){if(_0x4eddc0){return _0x4eddc0[_0xa30e('0x1f')]()[_0xa30e('0x1e')](function(){_0xff5f0a[_0xa30e('0x15')](0xcc)[_0xa30e('0x16')]();});}};}function handleEntityNotFound(_0x1d0df8,_0x13fece){return function(_0x4fe0b6){if(!_0x4fe0b6){_0x1d0df8[_0xa30e('0x20')](0x194);}return _0x4fe0b6;};}function handleError(_0x4ac00a,_0x2e142d){_0x2e142d=_0x2e142d||0x1f4;return function(_0x244782){logger['error'](_0x244782[_0xa30e('0x21')]);if(_0x244782['name']){delete _0x244782[_0xa30e('0x22')];}_0x4ac00a[_0xa30e('0x15')](_0x2e142d)[_0xa30e('0x23')](_0x244782);};}exports['index']=function(_0x463826,_0x40025e){var _0x115d95={},_0x1f64af={},_0x1e800b={'count':0x0,'rows':[]};var _0x3ea3ba=_[_0xa30e('0x24')](db[_0xa30e('0x25')][_0xa30e('0x26')],function(_0x4d944a){return{'name':_0x4d944a[_0xa30e('0x27')],'type':_0x4d944a[_0xa30e('0x28')][_0xa30e('0x29')]};});_0x1f64af[_0xa30e('0x2a')]=_[_0xa30e('0x24')](_0x3ea3ba,_0xa30e('0x22'));_0x1f64af['query']=_[_0xa30e('0x2b')](_0x463826[_0xa30e('0x2c')]);_0x1f64af[_0xa30e('0x2d')]=_['intersection'](_0x1f64af[_0xa30e('0x2a')],_0x1f64af['query']);_0x115d95['attributes']=_[_0xa30e('0x2e')](_0x1f64af['model'],qs['fields'](_0x463826['query'][_0xa30e('0x2f')]));_0x115d95['attributes']=_0x115d95['attributes'][_0xa30e('0x30')]?_0x115d95[_0xa30e('0x31')]:_0x1f64af[_0xa30e('0x2a')];if(!_0x463826[_0xa30e('0x2c')][_0xa30e('0x32')]('nolimit')){_0x115d95[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0x463826['query']['limit']);_0x115d95[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x463826[_0xa30e('0x2c')]['offset']);}_0x115d95['order']=qs[_0xa30e('0x33')](_0x463826['query'][_0xa30e('0x33')]);_0x115d95[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_['pick'](_0x463826[_0xa30e('0x2c')],_0x1f64af['filters']),_0x3ea3ba);if(_0x463826['query'][_0xa30e('0x35')]){_0x115d95[_0xa30e('0x34')]=_['merge'](_0x115d95[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x3ea3ba,function(_0x77459a){if(_0x77459a[_0xa30e('0x28')]!==_0xa30e('0x36')){var _0x578fd4={};_0x578fd4[_0x77459a[_0xa30e('0x22')]]={'$like':'%'+_0x463826[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x578fd4;}})});}_0x115d95=_['merge']({},_0x115d95,_0x463826[_0xa30e('0x37')]);var _0x66fb={'where':_0x115d95[_0xa30e('0x34')]};return db[_0xa30e('0x25')]['count'](_0x66fb)[_0xa30e('0x1e')](function(_0x203072){_0x1e800b['count']=_0x203072;if(_0x463826[_0xa30e('0x2c')]['includeAll']){_0x115d95['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x115d95);})[_0xa30e('0x1e')](function(_0x48de91){_0x1e800b['rows']=_0x48de91;return _0x1e800b;})[_0xa30e('0x1e')](respondWithFilteredResult(_0x40025e,_0x115d95))['catch'](handleError(_0x40025e,null));};exports[_0xa30e('0x38')]=function(_0x22be4c,_0x44508f){var _0x520f9a={'raw':![],'where':{'id':_0x22be4c['params']['id']}},_0x3d7a85={};_0x3d7a85[_0xa30e('0x2a')]=_[_0xa30e('0x2b')](db[_0xa30e('0x25')][_0xa30e('0x26')]);_0x3d7a85[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x22be4c[_0xa30e('0x2c')]);_0x3d7a85[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x3d7a85[_0xa30e('0x2a')],_0x3d7a85['query']);_0x520f9a[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x3d7a85['model'],qs[_0xa30e('0x2f')](_0x22be4c['query'][_0xa30e('0x2f')]));_0x520f9a[_0xa30e('0x31')]=_0x520f9a[_0xa30e('0x31')]['length']?_0x520f9a['attributes']:_0x3d7a85[_0xa30e('0x2a')];if(_0x22be4c[_0xa30e('0x2c')][_0xa30e('0x39')]){_0x520f9a[_0xa30e('0x3a')]=[{'all':!![]}];}_0x520f9a=_['merge']({},_0x520f9a,_0x22be4c[_0xa30e('0x37')]);return db[_0xa30e('0x25')]['find'](_0x520f9a)[_0xa30e('0x1e')](handleEntityNotFound(_0x44508f,null))['then'](respondWithResult(_0x44508f,null))[_0xa30e('0x3b')](handleError(_0x44508f,null));};exports[_0xa30e('0x3c')]=function(_0x38f690,_0x578549){return db[_0xa30e('0x25')][_0xa30e('0x3c')](_0x38f690[_0xa30e('0x3d')],{})[_0xa30e('0x1e')](respondWithResult(_0x578549,0xc9))[_0xa30e('0x3b')](handleError(_0x578549,null));};exports['update']=function(_0x55d1cb,_0x39fe06){if(_0x55d1cb[_0xa30e('0x3d')]['id']){delete _0x55d1cb[_0xa30e('0x3d')]['id'];}return db[_0xa30e('0x25')][_0xa30e('0x3e')]({'where':{'id':_0x55d1cb[_0xa30e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x39fe06,null))['then'](saveUpdates(_0x55d1cb[_0xa30e('0x3d')],null))[_0xa30e('0x1e')](respondWithResult(_0x39fe06,null))[_0xa30e('0x3b')](handleError(_0x39fe06,null));};exports[_0xa30e('0x1f')]=function(_0x503690,_0x1d1f01){return db['ZendeskConfiguration'][_0xa30e('0x3e')]({'where':{'id':_0x503690[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x1d1f01,null))['then'](removeEntity(_0x1d1f01,null))[_0xa30e('0x3b')](handleError(_0x1d1f01,null));};exports['getFields']=function(_0x872c9a,_0x58252b,_0x56ef8c){var _0x19337b={};var _0x404940={};var _0x4e5d0b;var _0x2945cc;return db[_0xa30e('0x25')]['findOne']({'where':{'id':_0x872c9a[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x58252b,null))[_0xa30e('0x1e')](function(_0x2fae6e){if(_0x2fae6e){_0x4e5d0b=_0x2fae6e;_0x404940['model']=_[_0xa30e('0x2b')](db[_0xa30e('0x40')][_0xa30e('0x26')]);_0x404940[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x872c9a[_0xa30e('0x2c')]);_0x404940[_0xa30e('0x2d')]=_['intersection'](_0x404940[_0xa30e('0x2a')],_0x404940['query']);_0x19337b['attributes']=_[_0xa30e('0x2e')](_0x404940[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0x872c9a[_0xa30e('0x2c')]['fields']));_0x19337b['attributes']=_0x19337b['attributes'][_0xa30e('0x30')]?_0x19337b['attributes']:_0x404940[_0xa30e('0x2a')];_0x19337b[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x19337b[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0x872c9a['query'],_0x404940[_0xa30e('0x2d')]));if(_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x19337b[_0xa30e('0x34')]=_[_0xa30e('0x43')](_0x19337b['where'],{'$or':_[_0xa30e('0x24')](_0x19337b['attributes'],function(_0x286947){var _0x5026b9={};_0x5026b9[_0x286947]={'$like':'%'+_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x5026b9;})});}_0x19337b=_['merge']({},_0x19337b,_0x872c9a[_0xa30e('0x37')]);return _0x4e5d0b[_0xa30e('0x44')](_0x19337b);}})[_0xa30e('0x1e')](function(_0x331435){if(_0x331435){_0x2945cc=_0x331435[_0xa30e('0x30')];if(!_0x872c9a['query'][_0xa30e('0x32')]('nolimit')){_0x19337b[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0x872c9a['query'][_0xa30e('0x1b')]);_0x19337b[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x18')]);}return _0x4e5d0b[_0xa30e('0x44')](_0x19337b);}})[_0xa30e('0x1e')](function(_0x5940be){if(_0x5940be){return _0x5940be?{'count':_0x2945cc,'rows':_0x5940be}:null;}})[_0xa30e('0x1e')](respondWithResult(_0x58252b,null))[_0xa30e('0x3b')](handleError(_0x58252b,null));};exports[_0xa30e('0x45')]=function(_0xa4986d,_0x55be73,_0x165b30){var _0x25ded9={};var _0x5345a3={};var _0x4ef4ec;var _0x47ce90;return db[_0xa30e('0x25')][_0xa30e('0x46')]({'where':{'id':_0xa4986d[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x55be73,null))[_0xa30e('0x1e')](function(_0x1a0c6b){if(_0x1a0c6b){_0x4ef4ec=_0x1a0c6b;_0x5345a3['model']=_[_0xa30e('0x2b')](db['ZendeskField']['rawAttributes']);_0x5345a3[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0xa4986d[_0xa30e('0x2c')]);_0x5345a3[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x5345a3[_0xa30e('0x2a')],_0x5345a3['query']);_0x25ded9[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x5345a3[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x2f')]));_0x25ded9[_0xa30e('0x31')]=_0x25ded9[_0xa30e('0x31')][_0xa30e('0x30')]?_0x25ded9[_0xa30e('0x31')]:_0x5345a3[_0xa30e('0x2a')];_0x25ded9[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0xa4986d['query'][_0xa30e('0x33')]);_0x25ded9['where']=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0xa4986d[_0xa30e('0x2c')],_0x5345a3[_0xa30e('0x2d')]));if(_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x25ded9['where']=_[_0xa30e('0x43')](_0x25ded9[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x25ded9[_0xa30e('0x31')],function(_0x1ec0c6){var _0x4045ed={};_0x4045ed[_0x1ec0c6]={'$like':'%'+_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x4045ed;})});}_0x25ded9=_[_0xa30e('0x43')]({},_0x25ded9,_0xa4986d[_0xa30e('0x37')]);return _0x4ef4ec[_0xa30e('0x45')](_0x25ded9);}})[_0xa30e('0x1e')](function(_0x2261be){if(_0x2261be){_0x47ce90=_0x2261be['length'];if(!_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x32')](_0xa30e('0x47'))){_0x25ded9[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x1b')]);_0x25ded9[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0xa4986d['query'][_0xa30e('0x18')]);}return _0x4ef4ec[_0xa30e('0x45')](_0x25ded9);}})['then'](function(_0x1075a2){if(_0x1075a2){return _0x1075a2?{'count':_0x47ce90,'rows':_0x1075a2}:null;}})[_0xa30e('0x1e')](respondWithResult(_0x55be73,null))[_0xa30e('0x3b')](handleError(_0x55be73,null));};exports[_0xa30e('0x48')]=function(_0xf4b7d5,_0x388307,_0x34d054){var _0x33918c={};var _0x1c4786={};var _0x42f9b5;var _0x3082ed;return db[_0xa30e('0x25')]['findOne']({'where':{'id':_0xf4b7d5['params']['id']}})['then'](handleEntityNotFound(_0x388307,null))[_0xa30e('0x1e')](function(_0x50f792){if(_0x50f792){_0x42f9b5=_0x50f792;_0x1c4786['model']=_[_0xa30e('0x2b')](db[_0xa30e('0x40')][_0xa30e('0x26')]);_0x1c4786[_0xa30e('0x2c')]=_['keys'](_0xf4b7d5[_0xa30e('0x2c')]);_0x1c4786['filters']=_[_0xa30e('0x2e')](_0x1c4786[_0xa30e('0x2a')],_0x1c4786['query']);_0x33918c[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x1c4786[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0xf4b7d5[_0xa30e('0x2c')]['fields']));_0x33918c[_0xa30e('0x31')]=_0x33918c['attributes'][_0xa30e('0x30')]?_0x33918c[_0xa30e('0x31')]:_0x1c4786[_0xa30e('0x2a')];_0x33918c[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x33918c[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0xf4b7d5['query'],_0x1c4786['filters']));if(_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x33918c['where']=_[_0xa30e('0x43')](_0x33918c[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x33918c[_0xa30e('0x31')],function(_0x36f17b){var _0x155a2e={};_0x155a2e[_0x36f17b]={'$like':'%'+_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x155a2e;})});}_0x33918c=_[_0xa30e('0x43')]({},_0x33918c,_0xf4b7d5[_0xa30e('0x37')]);return _0x42f9b5['getDescriptions'](_0x33918c);}})[_0xa30e('0x1e')](function(_0x1aca13){if(_0x1aca13){_0x3082ed=_0x1aca13[_0xa30e('0x30')];if(!_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x32')](_0xa30e('0x47'))){_0x33918c['limit']=qs['limit'](_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x1b')]);_0x33918c[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0xf4b7d5['query'][_0xa30e('0x18')]);}return _0x42f9b5['getDescriptions'](_0x33918c);}})[_0xa30e('0x1e')](function(_0x1fcd8c){if(_0x1fcd8c){return _0x1fcd8c?{'count':_0x3082ed,'rows':_0x1fcd8c}:null;}})['then'](respondWithResult(_0x388307,null))[_0xa30e('0x3b')](handleError(_0x388307,null));};exports[_0xa30e('0x49')]=function(_0x603545,_0x32a460,_0x294325){var _0x9cea2={};var _0x38200e={};var _0x30d5ce;var _0x5cd577;return db['ZendeskConfiguration'][_0xa30e('0x46')]({'where':{'id':_0x603545[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x32a460,null))[_0xa30e('0x1e')](function(_0x20bf3c){if(_0x20bf3c){_0x30d5ce=_0x20bf3c;_0x38200e[_0xa30e('0x2a')]=_[_0xa30e('0x2b')](db['Tag'][_0xa30e('0x26')]);_0x38200e[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x603545['query']);_0x38200e[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x38200e[_0xa30e('0x2a')],_0x38200e[_0xa30e('0x2c')]);_0x9cea2['attributes']=_[_0xa30e('0x2e')](_0x38200e[_0xa30e('0x2a')],qs['fields'](_0x603545['query'][_0xa30e('0x2f')]));_0x9cea2[_0xa30e('0x31')]=_0x9cea2[_0xa30e('0x31')][_0xa30e('0x30')]?_0x9cea2[_0xa30e('0x31')]:_0x38200e[_0xa30e('0x2a')];_0x9cea2[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0x603545[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x9cea2[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0x603545['query'],_0x38200e['filters']));if(_0x603545[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x9cea2[_0xa30e('0x34')]=_[_0xa30e('0x43')](_0x9cea2[_0xa30e('0x34')],{'$or':_['map'](_0x9cea2[_0xa30e('0x31')],function(_0xc136c3){var _0x5855ea={};_0x5855ea[_0xc136c3]={'$like':'%'+_0x603545['query'][_0xa30e('0x35')]+'%'};return _0x5855ea;})});}_0x9cea2=_['merge']({},_0x9cea2,_0x603545[_0xa30e('0x37')]);return _0x30d5ce[_0xa30e('0x49')](_0x9cea2);}})[_0xa30e('0x1e')](function(_0x4f9e7b){if(_0x4f9e7b){_0x5cd577=_0x4f9e7b[_0xa30e('0x30')];if(!_0x603545[_0xa30e('0x2c')]['hasOwnProperty']('nolimit')){_0x9cea2[_0xa30e('0x1b')]=qs['limit'](_0x603545[_0xa30e('0x2c')]['limit']);_0x9cea2[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x603545[_0xa30e('0x2c')][_0xa30e('0x18')]);}return _0x30d5ce['getTags'](_0x9cea2);}})[_0xa30e('0x1e')](function(_0x4b6c2c){if(_0x4b6c2c){return _0x4b6c2c?{'count':_0x5cd577,'rows':_0x4b6c2c}:null;}})['then'](respondWithResult(_0x32a460,null))[_0xa30e('0x3b')](handleError(_0x32a460,null));};exports['setTags']=function(_0x2265f2,_0x1c333c,_0xf5a344){if(_0x2265f2[_0xa30e('0x3d')]['id']){delete _0x2265f2[_0xa30e('0x3d')]['id'];}return db[_0xa30e('0x25')][_0xa30e('0x46')]({'where':{'id':_0x2265f2[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x1c333c,null))[_0xa30e('0x1e')](function(_0x44f8bc){if(_0x44f8bc){return _0x44f8bc[_0xa30e('0x4a')](_0x2265f2[_0xa30e('0x3d')]['ids']||[]);}return null;})[_0xa30e('0x1e')](respondWithResult(_0x1c333c,null))[_0xa30e('0x3b')](handleError(_0x1c333c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e77a3f8..e40e886 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x562d4b,_0x3b7f1c){var _0x3f6615=function(_0x44d64a){while(--_0x44d64a){_0x562d4b['push'](_0x562d4b['shift']());}};_0x3f6615(++_0x3b7f1c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x43c3f9,_0x1861cb){_0x43c3f9=_0x43c3f9-0x0;var _0x4f4f54=_0x5eb8[_0x43c3f9];return _0x4f4f54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x52d14a,_0x34d93b){var _0x62585c=function(_0x5098b8){while(--_0x5098b8){_0x52d14a['push'](_0x52d14a['shift']());}};_0x62585c(++_0x34d93b);}(_0xe820,0xd2));var _0x0e82=function(_0x935e60,_0x26870d){_0x935e60=_0x935e60-0x0;var _0x4430bd=_0xe820[_0x935e60];return _0x4430bd;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),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 1fba935..ccb1b9b 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 _0xe1d2=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0xe1d2,0x194));var _0x2e1d=function(_0x3fd6b6,_0x4ea38b){_0x3fd6b6=_0x3fd6b6-0x0;var _0x474fd4=_0xe1d2[_0x3fd6b6];return _0x474fd4;};'use strict';var _=require(_0x2e1d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e1d('0x1'));var rs=require(_0x2e1d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e1d('0x3'))['db'];var utils=require(_0x2e1d('0x4'));var logger=require('../../config/logger')(_0x2e1d('0x5'));var config=require(_0x2e1d('0x6'));var jayson=require(_0x2e1d('0x7'));var client=jayson[_0x2e1d('0x8')][_0x2e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe09354,_0x2cd4a9,_0x683a7c){return new BPromise(function(_0x28cc54,_0x53a0ec){return client[_0x2e1d('0xa')](_0xe09354,_0x683a7c)['then'](function(_0x5f32c6){logger[_0x2e1d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2cd4a9,_0x2e1d('0xc'));logger[_0x2e1d('0xd')](_0x2e1d('0xe'),_0x2cd4a9,_0x2e1d('0xc'),JSON[_0x2e1d('0xf')](_0x5f32c6));if(_0x5f32c6['error']){if(_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x11')]===0x1f4){logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);return _0x53a0ec(_0x5f32c6[_0x2e1d('0x10')]['message']);}logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);return _0x28cc54(_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);}else{logger[_0x2e1d('0xb')](_0x2e1d('0x12'),_0x2cd4a9,'request\x20sent');_0x28cc54(_0x5f32c6[_0x2e1d('0x14')][_0x2e1d('0x13')]);}})[_0x2e1d('0x15')](function(_0x25a6ff){logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x25a6ff);_0x53a0ec(_0x25a6ff);});});} \ No newline at end of file +var _0x9254=['jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1c0ea0,_0x13adda){var _0x5384d3=function(_0x29fea6){while(--_0x29fea6){_0x1c0ea0['push'](_0x1c0ea0['shift']());}};_0x5384d3(++_0x13adda);}(_0x9254,0xfd));var _0x4925=function(_0x159e29,_0x53d9ca){_0x159e29=_0x159e29-0x0;var _0x429903=_0x9254[_0x159e29];return _0x429903;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4925('0x0'));var BPromise=require(_0x4925('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4925('0x2'));var db=require(_0x4925('0x3'))['db'];var utils=require(_0x4925('0x4'));var logger=require('../../config/logger')(_0x4925('0x5'));var config=require(_0x4925('0x6'));var jayson=require(_0x4925('0x7'));var client=jayson['client'][_0x4925('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eb20f,_0x45e5f6,_0x499796){return new BPromise(function(_0x480fa1,_0x2abbb8){return client['request'](_0x4eb20f,_0x499796)[_0x4925('0x9')](function(_0x598ce3){logger[_0x4925('0xa')](_0x4925('0xb'),_0x45e5f6,'request\x20sent');logger[_0x4925('0xc')](_0x4925('0xd'),_0x45e5f6,_0x4925('0xe'),JSON[_0x4925('0xf')](_0x598ce3));if(_0x598ce3[_0x4925('0x10')]){if(_0x598ce3['error']['code']===0x1f4){logger[_0x4925('0x10')](_0x4925('0xb'),_0x45e5f6,_0x598ce3['error'][_0x4925('0x11')]);return _0x2abbb8(_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x45e5f6,_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);return _0x480fa1(_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);}else{logger['info'](_0x4925('0xb'),_0x45e5f6,'request\x20sent');_0x480fa1(_0x598ce3[_0x4925('0x12')]['message']);}})[_0x4925('0x13')](function(_0x1d20dc){logger[_0x4925('0x10')](_0x4925('0xb'),_0x45e5f6,_0x1d20dc);_0x2abbb8(_0x1d20dc);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 80ce672..327154c 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 _0x1baa=['post','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x417303,_0x50bac5){var _0x458fa5=function(_0x10ebaa){while(--_0x10ebaa){_0x417303['push'](_0x417303['shift']());}};_0x458fa5(++_0x50bac5);}(_0x1baa,0xeb));var _0xa1ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1baa[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xa1ba('0x0'));var util=require(_0xa1ba('0x1'));var path=require(_0xa1ba('0x2'));var timeout=require(_0xa1ba('0x3'));var express=require(_0xa1ba('0x4'));var router=express[_0xa1ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa1ba('0x6'));var interaction=require(_0xa1ba('0x7'));var config=require(_0xa1ba('0x8'));var controller=require('./intZendeskField.controller');router[_0xa1ba('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1ba('0xa')]);router['get'](_0xa1ba('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa1ba('0xc')]('/',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0xe')]);router['put']('/:id',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0xf')]);router[_0xa1ba('0x10')]('/:id',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0x11')]);module[_0xa1ba('0x12')]=router; \ No newline at end of file +var _0x4dfb=['isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4dfb,0x19a));var _0xb4df=function(_0x28d56e,_0x2a1935){_0x28d56e=_0x28d56e-0x0;var _0x2dc10d=_0x4dfb[_0x28d56e];return _0x2dc10d;};'use strict';var multer=require(_0xb4df('0x0'));var util=require('util');var path=require(_0xb4df('0x1'));var timeout=require(_0xb4df('0x2'));var express=require(_0xb4df('0x3'));var router=express[_0xb4df('0x4')]();var fs_extra=require(_0xb4df('0x5'));var auth=require(_0xb4df('0x6'));var interaction=require(_0xb4df('0x7'));var config=require(_0xb4df('0x8'));var controller=require(_0xb4df('0x9'));router['get']('/',auth[_0xb4df('0xa')](),controller[_0xb4df('0xb')]);router[_0xb4df('0xc')](_0xb4df('0xd'),auth['isAuthenticated'](),controller[_0xb4df('0xe')]);router[_0xb4df('0xf')]('/',auth[_0xb4df('0xa')](),controller[_0xb4df('0x10')]);router['put'](_0xb4df('0xd'),auth[_0xb4df('0xa')](),controller['update']);router[_0xb4df('0x11')](_0xb4df('0xd'),auth[_0xb4df('0xa')](),controller[_0xb4df('0x12')]);module[_0xb4df('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0b8b0fb..2366a0a 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 _0x4015=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4015,0x1e2));var _0x5401=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x4015[_0x254076];return _0x21a93e;};'use strict';var Sequelize=require(_0x5401('0x0'));module[_0x5401('0x1')]={'type':{'type':Sequelize[_0x5401('0x2')](_0x5401('0x3'),'variable',_0x5401('0x4'),_0x5401('0x5'),_0x5401('0x6')),'defaultValue':_0x5401('0x3')},'content':{'type':Sequelize[_0x5401('0x7')]},'key':{'type':Sequelize[_0x5401('0x7')]},'keyType':{'type':Sequelize[_0x5401('0x2')](_0x5401('0x3'),_0x5401('0x8'),_0x5401('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5401('0x7')]},'nameField':{'type':Sequelize[_0x5401('0x7')]},'customField':{'type':Sequelize[_0x5401('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5401('0x7')]}}; \ No newline at end of file +var _0xcd78=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2ccb91,_0xa2c1b4){var _0x4136ca=function(_0x4326f0){while(--_0x4326f0){_0x2ccb91['push'](_0x2ccb91['shift']());}};_0x4136ca(++_0xa2c1b4);}(_0xcd78,0xf9));var _0x8cd7=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xcd78[_0x3b90ab];return _0x206e92;};'use strict';var Sequelize=require(_0x8cd7('0x0'));module[_0x8cd7('0x1')]={'type':{'type':Sequelize[_0x8cd7('0x2')](_0x8cd7('0x3'),_0x8cd7('0x4'),_0x8cd7('0x5'),_0x8cd7('0x6'),_0x8cd7('0x7')),'defaultValue':_0x8cd7('0x3')},'content':{'type':Sequelize[_0x8cd7('0x8')]},'key':{'type':Sequelize[_0x8cd7('0x8')]},'keyType':{'type':Sequelize[_0x8cd7('0x2')](_0x8cd7('0x3'),_0x8cd7('0x4'),_0x8cd7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8cd7('0x8')]},'nameField':{'type':Sequelize[_0x8cd7('0x8')]},'customField':{'type':Sequelize[_0x8cd7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8cd7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ee1eb46..1ce715a 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 _0xc8bf=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x43d558,_0x4bae4f){var _0x2cb7a9=function(_0x33dd08){while(--_0x33dd08){_0x43d558['push'](_0x43d558['shift']());}};_0x2cb7a9(++_0x4bae4f);}(_0xc8bf,0x181));var _0xfc8b=function(_0x313e7c,_0x52f808){_0x313e7c=_0x313e7c-0x0;var _0x3ea27f=_0xc8bf[_0x313e7c];return _0x3ea27f;};'use strict';var emlformat=require(_0xfc8b('0x0'));var rimraf=require(_0xfc8b('0x1'));var zipdir=require(_0xfc8b('0x2'));var jsonpatch=require(_0xfc8b('0x3'));var rp=require(_0xfc8b('0x4'));var moment=require(_0xfc8b('0x5'));var BPromise=require(_0xfc8b('0x6'));var Mustache=require(_0xfc8b('0x7'));var util=require('util');var path=require(_0xfc8b('0x8'));var sox=require(_0xfc8b('0x9'));var csv=require(_0xfc8b('0xa'));var ejs=require(_0xfc8b('0xb'));var fs=require('fs');var fs_extra=require(_0xfc8b('0xc'));var _=require('lodash');var squel=require(_0xfc8b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfc8b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc8b('0xa'));var querystring=require('querystring');var Papa=require(_0xfc8b('0xf'));var Redis=require(_0xfc8b('0x10'));var authService=require(_0xfc8b('0x11'));var qs=require(_0xfc8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc8b('0x13'));var logger=require('../../config/logger')(_0xfc8b('0x14'));var utils=require(_0xfc8b('0x15'));var config=require(_0xfc8b('0x16'));var licenseUtil=require(_0xfc8b('0x17'));var db=require(_0xfc8b('0x18'))['db'];function respondWithStatusCode(_0x2d16a2,_0x36c122){_0x36c122=_0x36c122||0xcc;return function(_0x15a126){if(_0x15a126){return _0x2d16a2[_0xfc8b('0x19')](_0x36c122);}return _0x2d16a2['status'](_0x36c122)[_0xfc8b('0x1a')]();};}function respondWithResult(_0x1a9572,_0x5c7958){_0x5c7958=_0x5c7958||0xc8;return function(_0x78eb76){if(_0x78eb76){return _0x1a9572[_0xfc8b('0x1b')](_0x5c7958)[_0xfc8b('0x1c')](_0x78eb76);}};}function respondWithFilteredResult(_0x1c3141,_0x206039){return function(_0x1a32a0){if(_0x1a32a0){var _0x4bfee8=typeof _0x206039[_0xfc8b('0x1d')]===_0xfc8b('0x1e')&&typeof _0x206039['limit']===_0xfc8b('0x1e');var _0x3e4bc5=_0x1a32a0[_0xfc8b('0x1f')];var _0x49a80f=_0x4bfee8?0x0:_0x206039[_0xfc8b('0x1d')];var _0x3ef7c5=_0x4bfee8?_0x1a32a0['count']:_0x206039[_0xfc8b('0x1d')]+_0x206039[_0xfc8b('0x20')];var _0x36f38a;if(_0x3ef7c5>=_0x3e4bc5){_0x3ef7c5=_0x3e4bc5;_0x36f38a=0xc8;}else{_0x36f38a=0xce;}_0x1c3141[_0xfc8b('0x1b')](_0x36f38a);return _0x1c3141[_0xfc8b('0x21')]('Content-Range',_0x49a80f+'-'+_0x3ef7c5+'/'+_0x3e4bc5)['json'](_0x1a32a0);}return null;};}function patchUpdates(_0x8af353){return function(_0x348b06){try{jsonpatch[_0xfc8b('0x22')](_0x348b06,_0x8af353,!![]);}catch(_0x40bbc3){return BPromise[_0xfc8b('0x23')](_0x40bbc3);}return _0x348b06[_0xfc8b('0x24')]();};}function saveUpdates(_0x1da466,_0x3ad123){return function(_0x50ac51){if(_0x50ac51){return _0x50ac51['update'](_0x1da466)[_0xfc8b('0x25')](function(_0x5f3afd){return _0x5f3afd;});}return null;};}function removeEntity(_0x9ca658,_0x416f04){return function(_0x38add3){if(_0x38add3){return _0x38add3['destroy']()[_0xfc8b('0x25')](function(){_0x9ca658['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50dd73,_0x59b2bf){return function(_0x5345ed){if(!_0x5345ed){_0x50dd73[_0xfc8b('0x19')](0x194);}return _0x5345ed;};}function handleError(_0x29e056,_0x44514c){_0x44514c=_0x44514c||0x1f4;return function(_0x59c0dd){logger[_0xfc8b('0x26')](_0x59c0dd[_0xfc8b('0x27')]);if(_0x59c0dd[_0xfc8b('0x28')]){delete _0x59c0dd[_0xfc8b('0x28')];}_0x29e056['status'](_0x44514c)[_0xfc8b('0x29')](_0x59c0dd);};}exports[_0xfc8b('0x2a')]=function(_0x52b3ba,_0x346578){var _0x2f468c={},_0x5837bb={},_0x75ff72={'count':0x0,'rows':[]};var _0x108d66=_['map'](db['ZendeskField'][_0xfc8b('0x2b')],function(_0x5821e0){return{'name':_0x5821e0[_0xfc8b('0x2c')],'type':_0x5821e0[_0xfc8b('0x2d')][_0xfc8b('0x2e')]};});_0x5837bb[_0xfc8b('0x2f')]=_['map'](_0x108d66,_0xfc8b('0x28'));_0x5837bb['query']=_[_0xfc8b('0x30')](_0x52b3ba[_0xfc8b('0x31')]);_0x5837bb[_0xfc8b('0x32')]=_[_0xfc8b('0x33')](_0x5837bb[_0xfc8b('0x2f')],_0x5837bb[_0xfc8b('0x31')]);_0x2f468c['attributes']=_['intersection'](_0x5837bb[_0xfc8b('0x2f')],qs[_0xfc8b('0x34')](_0x52b3ba['query'][_0xfc8b('0x34')]));_0x2f468c['attributes']=_0x2f468c[_0xfc8b('0x35')]['length']?_0x2f468c[_0xfc8b('0x35')]:_0x5837bb[_0xfc8b('0x2f')];if(!_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x36')](_0xfc8b('0x37'))){_0x2f468c[_0xfc8b('0x20')]=qs[_0xfc8b('0x20')](_0x52b3ba[_0xfc8b('0x31')]['limit']);_0x2f468c[_0xfc8b('0x1d')]=qs[_0xfc8b('0x1d')](_0x52b3ba['query'][_0xfc8b('0x1d')]);}_0x2f468c[_0xfc8b('0x38')]=qs[_0xfc8b('0x39')](_0x52b3ba['query']['sort']);_0x2f468c[_0xfc8b('0x3a')]=qs[_0xfc8b('0x32')](_[_0xfc8b('0x3b')](_0x52b3ba['query'],_0x5837bb[_0xfc8b('0x32')]),_0x108d66);if(_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x3c')]){_0x2f468c[_0xfc8b('0x3a')]=_['merge'](_0x2f468c[_0xfc8b('0x3a')],{'$or':_[_0xfc8b('0x3d')](_0x108d66,function(_0x2d4b3b){if(_0x2d4b3b[_0xfc8b('0x2d')]!==_0xfc8b('0x3e')){var _0x28d963={};_0x28d963[_0x2d4b3b['name']]={'$like':'%'+_0x52b3ba[_0xfc8b('0x31')]['filter']+'%'};return _0x28d963;}})});}_0x2f468c=_[_0xfc8b('0x3f')]({},_0x2f468c,_0x52b3ba[_0xfc8b('0x40')]);var _0xb5a348={'where':_0x2f468c['where']};return db[_0xfc8b('0x41')]['count'](_0xb5a348)[_0xfc8b('0x25')](function(_0x4ffc3d){_0x75ff72[_0xfc8b('0x1f')]=_0x4ffc3d;if(_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x42')]){_0x2f468c['include']=[{'all':!![]}];}return db['ZendeskField'][_0xfc8b('0x43')](_0x2f468c);})[_0xfc8b('0x25')](function(_0x1cbd4e){_0x75ff72[_0xfc8b('0x44')]=_0x1cbd4e;return _0x75ff72;})[_0xfc8b('0x25')](respondWithFilteredResult(_0x346578,_0x2f468c))[_0xfc8b('0x45')](handleError(_0x346578,null));};exports[_0xfc8b('0x46')]=function(_0x52f6a2,_0x475781){var _0x5c9d7d={'raw':!![],'where':{'id':_0x52f6a2[_0xfc8b('0x47')]['id']}},_0x287b2c={};_0x287b2c['model']=_[_0xfc8b('0x30')](db[_0xfc8b('0x41')]['rawAttributes']);_0x287b2c['query']=_[_0xfc8b('0x30')](_0x52f6a2[_0xfc8b('0x31')]);_0x287b2c['filters']=_['intersection'](_0x287b2c[_0xfc8b('0x2f')],_0x287b2c[_0xfc8b('0x31')]);_0x5c9d7d[_0xfc8b('0x35')]=_[_0xfc8b('0x33')](_0x287b2c[_0xfc8b('0x2f')],qs[_0xfc8b('0x34')](_0x52f6a2[_0xfc8b('0x31')][_0xfc8b('0x34')]));_0x5c9d7d['attributes']=_0x5c9d7d[_0xfc8b('0x35')]['length']?_0x5c9d7d[_0xfc8b('0x35')]:_0x287b2c[_0xfc8b('0x2f')];if(_0x52f6a2[_0xfc8b('0x31')][_0xfc8b('0x42')]){_0x5c9d7d[_0xfc8b('0x48')]=[{'all':!![]}];}_0x5c9d7d=_['merge']({},_0x5c9d7d,_0x52f6a2['options']);return db[_0xfc8b('0x41')][_0xfc8b('0x49')](_0x5c9d7d)[_0xfc8b('0x25')](handleEntityNotFound(_0x475781,null))[_0xfc8b('0x25')](respondWithResult(_0x475781,null))['catch'](handleError(_0x475781,null));};exports[_0xfc8b('0x4a')]=function(_0x4916d4,_0x3360cd){return db['ZendeskField'][_0xfc8b('0x4a')](_0x4916d4[_0xfc8b('0x4b')],{})[_0xfc8b('0x25')](respondWithResult(_0x3360cd,0xc9))[_0xfc8b('0x45')](handleError(_0x3360cd,null));};exports[_0xfc8b('0x4c')]=function(_0x19146a,_0x310bbd){if(_0x19146a[_0xfc8b('0x4b')]['id']){delete _0x19146a['body']['id'];}return db['ZendeskField'][_0xfc8b('0x49')]({'where':{'id':_0x19146a[_0xfc8b('0x47')]['id']}})[_0xfc8b('0x25')](handleEntityNotFound(_0x310bbd,null))[_0xfc8b('0x25')](saveUpdates(_0x19146a[_0xfc8b('0x4b')],null))[_0xfc8b('0x25')](respondWithResult(_0x310bbd,null))[_0xfc8b('0x45')](handleError(_0x310bbd,null));};exports[_0xfc8b('0x4d')]=function(_0x5cac2a,_0x20fc8b){return db['ZendeskField'][_0xfc8b('0x49')]({'where':{'id':_0x5cac2a[_0xfc8b('0x47')]['id']}})[_0xfc8b('0x25')](handleEntityNotFound(_0x20fc8b,null))['then'](removeEntity(_0x20fc8b,null))[_0xfc8b('0x45')](handleError(_0x20fc8b,null));}; \ No newline at end of file +var _0xa080=['create','body','update','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','ZendeskField','key','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','intersection','length','find'];(function(_0x3c3712,_0x4cdd0d){var _0x51e3fc=function(_0x1926a5){while(--_0x1926a5){_0x3c3712['push'](_0x3c3712['shift']());}};_0x51e3fc(++_0x4cdd0d);}(_0xa080,0x12c));var _0x0a08=function(_0x4713fe,_0x24caa0){_0x4713fe=_0x4713fe-0x0;var _0x14cc0a=_0xa080[_0x4713fe];return _0x14cc0a;};'use strict';var emlformat=require(_0x0a08('0x0'));var rimraf=require(_0x0a08('0x1'));var zipdir=require(_0x0a08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a08('0x3'));var BPromise=require(_0x0a08('0x4'));var Mustache=require('mustache');var util=require(_0x0a08('0x5'));var path=require('path');var sox=require(_0x0a08('0x6'));var csv=require(_0x0a08('0x7'));var ejs=require(_0x0a08('0x8'));var fs=require('fs');var fs_extra=require(_0x0a08('0x9'));var _=require(_0x0a08('0xa'));var squel=require(_0x0a08('0xb'));var crypto=require(_0x0a08('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0a08('0xd'));var toCsv=require(_0x0a08('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a08('0xe'));var authService=require(_0x0a08('0xf'));var qs=require(_0x0a08('0x10'));var as=require(_0x0a08('0x11'));var hardwareService=require(_0x0a08('0x12'));var logger=require(_0x0a08('0x13'))('api');var utils=require(_0x0a08('0x14'));var config=require(_0x0a08('0x15'));var licenseUtil=require(_0x0a08('0x16'));var db=require(_0x0a08('0x17'))['db'];function respondWithStatusCode(_0x48fd8d,_0x3c047b){_0x3c047b=_0x3c047b||0xcc;return function(_0x4e7f87){if(_0x4e7f87){return _0x48fd8d['sendStatus'](_0x3c047b);}return _0x48fd8d[_0x0a08('0x18')](_0x3c047b)['end']();};}function respondWithResult(_0x49265e,_0x20a11b){_0x20a11b=_0x20a11b||0xc8;return function(_0x76e5ee){if(_0x76e5ee){return _0x49265e['status'](_0x20a11b)['json'](_0x76e5ee);}};}function respondWithFilteredResult(_0x5c420f,_0x16f9e6){return function(_0x43e26f){if(_0x43e26f){var _0x1ddfb3=typeof _0x16f9e6[_0x0a08('0x19')]===_0x0a08('0x1a')&&typeof _0x16f9e6[_0x0a08('0x1b')]===_0x0a08('0x1a');var _0x50d61c=_0x43e26f[_0x0a08('0x1c')];var _0x12ebbb=_0x1ddfb3?0x0:_0x16f9e6[_0x0a08('0x19')];var _0x482675=_0x1ddfb3?_0x43e26f['count']:_0x16f9e6[_0x0a08('0x19')]+_0x16f9e6[_0x0a08('0x1b')];var _0x33756c;if(_0x482675>=_0x50d61c){_0x482675=_0x50d61c;_0x33756c=0xc8;}else{_0x33756c=0xce;}_0x5c420f['status'](_0x33756c);return _0x5c420f[_0x0a08('0x1d')](_0x0a08('0x1e'),_0x12ebbb+'-'+_0x482675+'/'+_0x50d61c)['json'](_0x43e26f);}return null;};}function patchUpdates(_0x12524a){return function(_0x35fb76){try{jsonpatch[_0x0a08('0x1f')](_0x35fb76,_0x12524a,!![]);}catch(_0x3018f2){return BPromise[_0x0a08('0x20')](_0x3018f2);}return _0x35fb76[_0x0a08('0x21')]();};}function saveUpdates(_0x2dcba7,_0x7c5738){return function(_0x20808b){if(_0x20808b){return _0x20808b['update'](_0x2dcba7)[_0x0a08('0x22')](function(_0x3b7adc){return _0x3b7adc;});}return null;};}function removeEntity(_0x17cf25,_0x15634a){return function(_0x4fe986){if(_0x4fe986){return _0x4fe986[_0x0a08('0x23')]()[_0x0a08('0x22')](function(){_0x17cf25['status'](0xcc)[_0x0a08('0x24')]();});}};}function handleEntityNotFound(_0x33e06d,_0x45170f){return function(_0x4c5e2b){if(!_0x4c5e2b){_0x33e06d['sendStatus'](0x194);}return _0x4c5e2b;};}function handleError(_0x566451,_0x378a5e){_0x378a5e=_0x378a5e||0x1f4;return function(_0x16ea10){logger[_0x0a08('0x25')](_0x16ea10[_0x0a08('0x26')]);if(_0x16ea10[_0x0a08('0x27')]){delete _0x16ea10[_0x0a08('0x27')];}_0x566451[_0x0a08('0x18')](_0x378a5e)[_0x0a08('0x28')](_0x16ea10);};}exports['index']=function(_0x2b8c51,_0x20ef3d){var _0x53f82c={},_0x525344={},_0x3acad7={'count':0x0,'rows':[]};var _0x3816e2=_[_0x0a08('0x29')](db[_0x0a08('0x2a')]['rawAttributes'],function(_0x1b0cca){return{'name':_0x1b0cca['fieldName'],'type':_0x1b0cca['type'][_0x0a08('0x2b')]};});_0x525344['model']=_[_0x0a08('0x29')](_0x3816e2,_0x0a08('0x27'));_0x525344['query']=_[_0x0a08('0x2c')](_0x2b8c51[_0x0a08('0x2d')]);_0x525344[_0x0a08('0x2e')]=_['intersection'](_0x525344[_0x0a08('0x2f')],_0x525344[_0x0a08('0x2d')]);_0x53f82c['attributes']=_['intersection'](_0x525344['model'],qs[_0x0a08('0x30')](_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x30')]));_0x53f82c[_0x0a08('0x31')]=_0x53f82c[_0x0a08('0x31')]['length']?_0x53f82c[_0x0a08('0x31')]:_0x525344[_0x0a08('0x2f')];if(!_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x32')](_0x0a08('0x33'))){_0x53f82c['limit']=qs[_0x0a08('0x1b')](_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x1b')]);_0x53f82c[_0x0a08('0x19')]=qs['offset'](_0x2b8c51[_0x0a08('0x2d')]['offset']);}_0x53f82c[_0x0a08('0x34')]=qs[_0x0a08('0x35')](_0x2b8c51['query'][_0x0a08('0x35')]);_0x53f82c[_0x0a08('0x36')]=qs[_0x0a08('0x2e')](_[_0x0a08('0x37')](_0x2b8c51[_0x0a08('0x2d')],_0x525344[_0x0a08('0x2e')]),_0x3816e2);if(_0x2b8c51[_0x0a08('0x2d')]['filter']){_0x53f82c['where']=_[_0x0a08('0x38')](_0x53f82c[_0x0a08('0x36')],{'$or':_[_0x0a08('0x29')](_0x3816e2,function(_0x40df18){if(_0x40df18[_0x0a08('0x39')]!==_0x0a08('0x3a')){var _0x560686={};_0x560686[_0x40df18['name']]={'$like':'%'+_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x3b')]+'%'};return _0x560686;}})});}_0x53f82c=_['merge']({},_0x53f82c,_0x2b8c51[_0x0a08('0x3c')]);var _0x1bcedc={'where':_0x53f82c[_0x0a08('0x36')]};return db[_0x0a08('0x2a')][_0x0a08('0x1c')](_0x1bcedc)[_0x0a08('0x22')](function(_0x5a4790){_0x3acad7['count']=_0x5a4790;if(_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x3d')]){_0x53f82c[_0x0a08('0x3e')]=[{'all':!![]}];}return db[_0x0a08('0x2a')][_0x0a08('0x3f')](_0x53f82c);})['then'](function(_0x115f9e){_0x3acad7['rows']=_0x115f9e;return _0x3acad7;})[_0x0a08('0x22')](respondWithFilteredResult(_0x20ef3d,_0x53f82c))[_0x0a08('0x40')](handleError(_0x20ef3d,null));};exports[_0x0a08('0x41')]=function(_0x3d6c15,_0x17633d){var _0x4b6cc7={'raw':!![],'where':{'id':_0x3d6c15['params']['id']}},_0x3e63de={};_0x3e63de['model']=_[_0x0a08('0x2c')](db[_0x0a08('0x2a')][_0x0a08('0x42')]);_0x3e63de[_0x0a08('0x2d')]=_[_0x0a08('0x2c')](_0x3d6c15[_0x0a08('0x2d')]);_0x3e63de[_0x0a08('0x2e')]=_[_0x0a08('0x43')](_0x3e63de['model'],_0x3e63de['query']);_0x4b6cc7['attributes']=_[_0x0a08('0x43')](_0x3e63de[_0x0a08('0x2f')],qs[_0x0a08('0x30')](_0x3d6c15['query'][_0x0a08('0x30')]));_0x4b6cc7[_0x0a08('0x31')]=_0x4b6cc7[_0x0a08('0x31')][_0x0a08('0x44')]?_0x4b6cc7[_0x0a08('0x31')]:_0x3e63de[_0x0a08('0x2f')];if(_0x3d6c15[_0x0a08('0x2d')]['includeAll']){_0x4b6cc7[_0x0a08('0x3e')]=[{'all':!![]}];}_0x4b6cc7=_[_0x0a08('0x38')]({},_0x4b6cc7,_0x3d6c15[_0x0a08('0x3c')]);return db[_0x0a08('0x2a')][_0x0a08('0x45')](_0x4b6cc7)[_0x0a08('0x22')](handleEntityNotFound(_0x17633d,null))[_0x0a08('0x22')](respondWithResult(_0x17633d,null))[_0x0a08('0x40')](handleError(_0x17633d,null));};exports[_0x0a08('0x46')]=function(_0x1079ad,_0x55dd61){return db['ZendeskField'][_0x0a08('0x46')](_0x1079ad[_0x0a08('0x47')],{})[_0x0a08('0x22')](respondWithResult(_0x55dd61,0xc9))[_0x0a08('0x40')](handleError(_0x55dd61,null));};exports[_0x0a08('0x48')]=function(_0x170e63,_0xdb62bc){if(_0x170e63[_0x0a08('0x47')]['id']){delete _0x170e63[_0x0a08('0x47')]['id'];}return db[_0x0a08('0x2a')]['find']({'where':{'id':_0x170e63[_0x0a08('0x49')]['id']}})[_0x0a08('0x22')](handleEntityNotFound(_0xdb62bc,null))[_0x0a08('0x22')](saveUpdates(_0x170e63[_0x0a08('0x47')],null))[_0x0a08('0x22')](respondWithResult(_0xdb62bc,null))[_0x0a08('0x40')](handleError(_0xdb62bc,null));};exports[_0x0a08('0x23')]=function(_0x51b74f,_0x3f5b25){return db[_0x0a08('0x2a')]['find']({'where':{'id':_0x51b74f[_0x0a08('0x49')]['id']}})[_0x0a08('0x22')](handleEntityNotFound(_0x3f5b25,null))[_0x0a08('0x22')](removeEntity(_0x3f5b25,null))[_0x0a08('0x40')](handleError(_0x3f5b25,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 07b4b76..a1b6bc9 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 _0x19d9=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19d9,0x113));var _0x919d=function(_0x2055e5,_0x560bf1){_0x2055e5=_0x2055e5-0x0;var _0x3d509c=_0x19d9[_0x2055e5];return _0x3d509c;};'use strict';var _=require(_0x919d('0x0'));var util=require(_0x919d('0x1'));var logger=require(_0x919d('0x2'))(_0x919d('0x3'));var moment=require(_0x919d('0x4'));var BPromise=require(_0x919d('0x5'));var rp=require(_0x919d('0x6'));var fs=require('fs');var path=require(_0x919d('0x7'));var rimraf=require(_0x919d('0x8'));var config=require('../../config/environment');var attributes=require(_0x919d('0x9'));module[_0x919d('0xa')]=function(_0x5ba2aa,_0x35a623){return _0x5ba2aa[_0x919d('0xb')](_0x919d('0xc'),attributes,{'tableName':_0x919d('0xd'),'paranoid':![],'indexes':[{'name':_0x919d('0xe'),'fields':[_0x919d('0xf'),_0x919d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43ed=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','lodash','util','api','bluebird','path','rimraf','./intZendeskField.attributes','exports'];(function(_0x11cad2,_0x12034b){var _0x1f142f=function(_0xa0d2d9){while(--_0xa0d2d9){_0x11cad2['push'](_0x11cad2['shift']());}};_0x1f142f(++_0x12034b);}(_0x43ed,0xc4));var _0xd43e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x43ed[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xd43e('0x0'));var util=require(_0xd43e('0x1'));var logger=require('../../config/logger')(_0xd43e('0x2'));var moment=require('moment');var BPromise=require(_0xd43e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43e('0x4'));var rimraf=require(_0xd43e('0x5'));var config=require('../../config/environment');var attributes=require(_0xd43e('0x6'));module[_0xd43e('0x7')]=function(_0x368bfa,_0x466e36){return _0x368bfa[_0xd43e('0x8')](_0xd43e('0x9'),attributes,{'tableName':_0xd43e('0xa'),'paranoid':![],'indexes':[{'name':_0xd43e('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 485d603..0c0ca94 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 _0x1cec=['ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3a4fd1,_0x3a81f8){var _0x51c3fd=function(_0x2c49fe){while(--_0x2c49fe){_0x3a4fd1['push'](_0x3a4fd1['shift']());}};_0x51c3fd(++_0x3a81f8);}(_0x1cec,0x180));var _0xc1ce=function(_0x20401d,_0x2d3125){_0x20401d=_0x20401d-0x0;var _0x2a63c4=_0x1cec[_0x20401d];return _0x2a63c4;};'use strict';var _=require(_0xc1ce('0x0'));var util=require('util');var moment=require(_0xc1ce('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1ce('0x2'));var fs=require('fs');var Redis=require(_0xc1ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1ce('0x4'));var logger=require(_0xc1ce('0x5'))(_0xc1ce('0x6'));var config=require(_0xc1ce('0x7'));var jayson=require(_0xc1ce('0x8'));var client=jayson[_0xc1ce('0x9')][_0xc1ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x466c0f,_0x5db52b,_0x2cdda1){return new BPromise(function(_0x7dec61,_0xe2494d){return client[_0xc1ce('0xb')](_0x466c0f,_0x2cdda1)[_0xc1ce('0xc')](function(_0x1e4c35){logger['info'](_0xc1ce('0xd'),_0x5db52b,_0xc1ce('0xe'));logger['debug'](_0xc1ce('0xf'),_0x5db52b,_0xc1ce('0xe'),JSON['stringify'](_0x1e4c35));if(_0x1e4c35[_0xc1ce('0x10')]){if(_0x1e4c35['error'][_0xc1ce('0x11')]===0x1f4){logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x1e4c35[_0xc1ce('0x10')][_0xc1ce('0x12')]);return _0xe2494d(_0x1e4c35['error'][_0xc1ce('0x12')]);}logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x1e4c35[_0xc1ce('0x10')][_0xc1ce('0x12')]);return _0x7dec61(_0x1e4c35[_0xc1ce('0x10')]['message']);}else{logger[_0xc1ce('0x13')](_0xc1ce('0xd'),_0x5db52b,'request\x20sent');_0x7dec61(_0x1e4c35['result'][_0xc1ce('0x12')]);}})[_0xc1ce('0x14')](function(_0x36c427){logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x36c427);_0xe2494d(_0x36c427);});});} \ No newline at end of file +var _0xb4c9=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xb4c9,0x124));var _0x9b4c=function(_0x58fba2,_0xca1fdb){_0x58fba2=_0x58fba2-0x0;var _0x36a16f=_0xb4c9[_0x58fba2];return _0x36a16f;};'use strict';var _=require(_0x9b4c('0x0'));var util=require(_0x9b4c('0x1'));var moment=require(_0x9b4c('0x2'));var BPromise=require(_0x9b4c('0x3'));var rs=require(_0x9b4c('0x4'));var fs=require('fs');var Redis=require(_0x9b4c('0x5'));var db=require(_0x9b4c('0x6'))['db'];var utils=require(_0x9b4c('0x7'));var logger=require(_0x9b4c('0x8'))('rpc');var config=require(_0x9b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9b4c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a49cd,_0x26696f,_0x49ca4d){return new BPromise(function(_0x2418a2,_0x219830){return client[_0x9b4c('0xb')](_0x2a49cd,_0x49ca4d)[_0x9b4c('0xc')](function(_0x5b85bf){logger['info'](_0x9b4c('0xd'),_0x26696f,_0x9b4c('0xe'));logger[_0x9b4c('0xf')](_0x9b4c('0x10'),_0x26696f,_0x9b4c('0xe'),JSON[_0x9b4c('0x11')](_0x5b85bf));if(_0x5b85bf[_0x9b4c('0x12')]){if(_0x5b85bf[_0x9b4c('0x12')][_0x9b4c('0x13')]===0x1f4){logger[_0x9b4c('0x12')](_0x9b4c('0xd'),_0x26696f,_0x5b85bf[_0x9b4c('0x12')]['message']);return _0x219830(_0x5b85bf['error']['message']);}logger[_0x9b4c('0x12')](_0x9b4c('0xd'),_0x26696f,_0x5b85bf['error'][_0x9b4c('0x14')]);return _0x2418a2(_0x5b85bf[_0x9b4c('0x12')][_0x9b4c('0x14')]);}else{logger[_0x9b4c('0x15')](_0x9b4c('0xd'),_0x26696f,_0x9b4c('0xe'));_0x2418a2(_0x5b85bf[_0x9b4c('0x16')][_0x9b4c('0x14')]);}})[_0x9b4c('0x17')](function(_0xf17197){logger['error'](_0x9b4c('0xd'),_0x26696f,_0xf17197);_0x219830(_0xf17197);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b54f0b8..c4b1cf8 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 _0xfae1=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x440319,_0x33e0c1){var _0x377d9d=function(_0x4a684c){while(--_0x4a684c){_0x440319['push'](_0x440319['shift']());}};_0x377d9d(++_0x33e0c1);}(_0xfae1,0x69));var _0x1fae=function(_0x3b264c,_0x45707b){_0x3b264c=_0x3b264c-0x0;var _0x51994e=_0xfae1[_0x3b264c];return _0x51994e;};'use strict';var multer=require(_0x1fae('0x0'));var util=require(_0x1fae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1fae('0x2'));var router=express[_0x1fae('0x3')]();var fs_extra=require(_0x1fae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1fae('0x5'));var config=require(_0x1fae('0x6'));var controller=require(_0x1fae('0x7'));router[_0x1fae('0x8')]('/',auth[_0x1fae('0x9')](),controller[_0x1fae('0xa')]);router[_0x1fae('0x8')](_0x1fae('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1fae('0xc'),auth['isAuthenticated'](),controller[_0x1fae('0xd')]);router[_0x1fae('0x8')](_0x1fae('0xe'),auth[_0x1fae('0x9')](),controller['getFields']);router[_0x1fae('0xf')]('/',auth[_0x1fae('0x9')](),controller[_0x1fae('0x10')]);router[_0x1fae('0xf')](_0x1fae('0xc'),auth[_0x1fae('0x9')](),controller[_0x1fae('0x11')]);router[_0x1fae('0x12')](_0x1fae('0xb'),auth[_0x1fae('0x9')](),controller[_0x1fae('0x13')]);router[_0x1fae('0x14')]('/:id',auth[_0x1fae('0x9')](),controller['destroy']);module[_0x1fae('0x15')]=router; \ No newline at end of file +var _0x1a52=['post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x1a52,0x127));var _0x21a5=function(_0x5b027e,_0x96d5bc){_0x5b027e=_0x5b027e-0x0;var _0x4f96c4=_0x1a52[_0x5b027e];return _0x4f96c4;};'use strict';var multer=require(_0x21a5('0x0'));var util=require(_0x21a5('0x1'));var path=require(_0x21a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x21a5('0x3'));var router=express['Router']();var fs_extra=require(_0x21a5('0x4'));var auth=require(_0x21a5('0x5'));var interaction=require(_0x21a5('0x6'));var config=require(_0x21a5('0x7'));var controller=require(_0x21a5('0x8'));router['get']('/',auth[_0x21a5('0x9')](),controller['index']);router[_0x21a5('0xa')](_0x21a5('0xb'),auth[_0x21a5('0x9')](),controller[_0x21a5('0xc')]);router[_0x21a5('0xa')](_0x21a5('0xd'),auth[_0x21a5('0x9')](),controller[_0x21a5('0xe')]);router['get'](_0x21a5('0xf'),auth[_0x21a5('0x9')](),controller[_0x21a5('0x10')]);router[_0x21a5('0x11')]('/',auth[_0x21a5('0x9')](),controller[_0x21a5('0x12')]);router[_0x21a5('0x11')]('/:id/configurations',auth[_0x21a5('0x9')](),controller[_0x21a5('0x13')]);router['put'](_0x21a5('0xb'),auth['isAuthenticated'](),controller[_0x21a5('0x14')]);router[_0x21a5('0x15')](_0x21a5('0xb'),auth[_0x21a5('0x9')](),controller[_0x21a5('0x16')]);module[_0x21a5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b93c8b6..0280f65 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 _0x34e8=['sequelize','exports','STRING'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x34e8,0x12c));var _0x834e=function(_0x53bb62,_0x138655){_0x53bb62=_0x53bb62-0x0;var _0x455833=_0x34e8[_0x53bb62];return _0x455833;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0xdace=['STRING','sequelize'];(function(_0xbbdfcb,_0x262d85){var _0x4e047b=function(_0x30a153){while(--_0x30a153){_0xbbdfcb['push'](_0xbbdfcb['shift']());}};_0x4e047b(++_0x262d85);}(_0xdace,0xc5));var _0xedac=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xdace[_0x5b740b];return _0x6f8f4e;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9a1880f..854cacb 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 _0x6103=['includes','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','fields','include','find','create','body','getConfigurations','ZohoConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','host','zoho.eu','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','Call_Result','Call_Start_Time','Call_Type'];(function(_0x158733,_0x11c9d6){var _0x4cf0f5=function(_0x181d15){while(--_0x181d15){_0x158733['push'](_0x158733['shift']());}};_0x4cf0f5(++_0x11c9d6);}(_0x6103,0x182));var _0x3610=function(_0x5c725c,_0x2106b5){_0x5c725c=_0x5c725c-0x0;var _0x59a1e2=_0x6103[_0x5c725c];return _0x59a1e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3610('0x0'));var zipdir=require(_0x3610('0x1'));var jsonpatch=require(_0x3610('0x2'));var rp=require(_0x3610('0x3'));var moment=require(_0x3610('0x4'));var BPromise=require(_0x3610('0x5'));var Mustache=require('mustache');var util=require(_0x3610('0x6'));var path=require(_0x3610('0x7'));var sox=require(_0x3610('0x8'));var csv=require(_0x3610('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3610('0xa'));var _=require('lodash');var squel=require(_0x3610('0xb'));var crypto=require(_0x3610('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3610('0x9'));var querystring=require(_0x3610('0xd'));var Papa=require(_0x3610('0xe'));var Redis=require(_0x3610('0xf'));var authService=require(_0x3610('0x10'));var qs=require(_0x3610('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3610('0x12'));var logger=require(_0x3610('0x13'))(_0x3610('0x14'));var utils=require(_0x3610('0x15'));var config=require(_0x3610('0x16'));var licenseUtil=require(_0x3610('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x575654,_0x34e51a){_0x34e51a=_0x34e51a||0xcc;return function(_0x32d756){if(_0x32d756){return _0x575654[_0x3610('0x18')](_0x34e51a);}return _0x575654['status'](_0x34e51a)['end']();};}function respondWithResult(_0x25beba,_0x318c24){_0x318c24=_0x318c24||0xc8;return function(_0x66db83){if(_0x66db83){return _0x25beba[_0x3610('0x19')](_0x318c24)['json'](_0x66db83);}};}function respondWithFilteredResult(_0x5381cf,_0x396670){return function(_0x1c751a){if(_0x1c751a){var _0x171533=typeof _0x396670[_0x3610('0x1a')]===_0x3610('0x1b')&&typeof _0x396670[_0x3610('0x1c')]===_0x3610('0x1b');var _0x48ea4c=_0x1c751a[_0x3610('0x1d')];var _0x497f4c=_0x171533?0x0:_0x396670[_0x3610('0x1a')];var _0xc14a37=_0x171533?_0x1c751a[_0x3610('0x1d')]:_0x396670[_0x3610('0x1a')]+_0x396670[_0x3610('0x1c')];var _0x24358e;if(_0xc14a37>=_0x48ea4c){_0xc14a37=_0x48ea4c;_0x24358e=0xc8;}else{_0x24358e=0xce;}_0x5381cf[_0x3610('0x19')](_0x24358e);return _0x5381cf[_0x3610('0x1e')](_0x3610('0x1f'),_0x497f4c+'-'+_0xc14a37+'/'+_0x48ea4c)[_0x3610('0x20')](_0x1c751a);}return null;};}function patchUpdates(_0x57622f){return function(_0x328e58){try{jsonpatch[_0x3610('0x21')](_0x328e58,_0x57622f,!![]);}catch(_0x2eab53){return BPromise['reject'](_0x2eab53);}return _0x328e58[_0x3610('0x22')]();};}function saveUpdates(_0x579bf8,_0x4f712c){return function(_0x1d398c){if(_0x1d398c){return _0x1d398c[_0x3610('0x23')](_0x579bf8)[_0x3610('0x24')](function(_0x5d5488){return _0x5d5488;});}return null;};}function removeEntity(_0x589174,_0x5a98a8){return function(_0x1c3695){if(_0x1c3695){return _0x1c3695[_0x3610('0x25')]()[_0x3610('0x24')](function(){_0x589174[_0x3610('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef6c9,_0x5f5261){return function(_0x4d5d9f){if(!_0x4d5d9f){_0x5ef6c9[_0x3610('0x18')](0x194);}return _0x4d5d9f;};}function handleError(_0x388517,_0x44d98b){_0x44d98b=_0x44d98b||0x1f4;return function(_0x4e6850){logger[_0x3610('0x26')](_0x4e6850[_0x3610('0x27')]);if(_0x4e6850[_0x3610('0x28')]){delete _0x4e6850[_0x3610('0x28')];}_0x388517[_0x3610('0x19')](_0x44d98b)[_0x3610('0x29')](_0x4e6850);};}exports['index']=function(_0xd8cc1,_0x15f3f1){var _0xf880dd={},_0x190d9a={},_0xf2b6b6={'count':0x0,'rows':[]};var _0x19aa4e=_[_0x3610('0x2a')](db[_0x3610('0x2b')]['rawAttributes'],function(_0x2e41c1){return{'name':_0x2e41c1[_0x3610('0x2c')],'type':_0x2e41c1[_0x3610('0x2d')][_0x3610('0x2e')]};});_0x190d9a[_0x3610('0x2f')]=_[_0x3610('0x2a')](_0x19aa4e,_0x3610('0x28'));_0x190d9a[_0x3610('0x30')]=_[_0x3610('0x31')](_0xd8cc1[_0x3610('0x30')]);_0x190d9a[_0x3610('0x32')]=_[_0x3610('0x33')](_0x190d9a[_0x3610('0x2f')],_0x190d9a[_0x3610('0x30')]);_0xf880dd['attributes']=_[_0x3610('0x33')](_0x190d9a['model'],qs['fields'](_0xd8cc1[_0x3610('0x30')]['fields']));_0xf880dd[_0x3610('0x34')]=_0xf880dd[_0x3610('0x34')][_0x3610('0x35')]?_0xf880dd[_0x3610('0x34')]:_0x190d9a[_0x3610('0x2f')];if(!_0xd8cc1[_0x3610('0x30')]['hasOwnProperty'](_0x3610('0x36'))){_0xf880dd['limit']=qs[_0x3610('0x1c')](_0xd8cc1['query'][_0x3610('0x1c')]);_0xf880dd[_0x3610('0x1a')]=qs[_0x3610('0x1a')](_0xd8cc1[_0x3610('0x30')]['offset']);}_0xf880dd[_0x3610('0x37')]=qs[_0x3610('0x38')](_0xd8cc1[_0x3610('0x30')]['sort']);_0xf880dd[_0x3610('0x39')]=qs[_0x3610('0x32')](_[_0x3610('0x3a')](_0xd8cc1[_0x3610('0x30')],_0x190d9a[_0x3610('0x32')]),_0x19aa4e);if(_0xd8cc1[_0x3610('0x30')]['filter']){_0xf880dd[_0x3610('0x39')]=_[_0x3610('0x3b')](_0xf880dd[_0x3610('0x39')],{'$or':_[_0x3610('0x2a')](_0x19aa4e,function(_0x56f504){if(_0x56f504['type']!==_0x3610('0x3c')){var _0x3c441b={};_0x3c441b[_0x56f504[_0x3610('0x28')]]={'$like':'%'+_0xd8cc1[_0x3610('0x30')][_0x3610('0x3d')]+'%'};return _0x3c441b;}})});}_0xf880dd=_[_0x3610('0x3b')]({},_0xf880dd,_0xd8cc1[_0x3610('0x3e')]);var _0x2cfc72={'where':_0xf880dd[_0x3610('0x39')]};return db['ZohoAccount'][_0x3610('0x1d')](_0x2cfc72)[_0x3610('0x24')](function(_0x1ab356){_0xf2b6b6[_0x3610('0x1d')]=_0x1ab356;if(_0xd8cc1[_0x3610('0x30')][_0x3610('0x3f')]){_0xf880dd['include']=[{'all':!![]}];}return db[_0x3610('0x2b')][_0x3610('0x40')](_0xf880dd);})[_0x3610('0x24')](function(_0x166a6e){_0xf2b6b6['rows']=_0x166a6e;return _0xf2b6b6;})['then'](respondWithFilteredResult(_0x15f3f1,_0xf880dd))[_0x3610('0x41')](handleError(_0x15f3f1,null));};exports[_0x3610('0x42')]=function(_0x2122eb,_0x5e6ca3){var _0x300c22={'raw':![],'where':{'id':_0x2122eb[_0x3610('0x43')]['id']}},_0x57965b={};_0x57965b[_0x3610('0x2f')]=_[_0x3610('0x31')](db[_0x3610('0x2b')][_0x3610('0x44')]);_0x57965b[_0x3610('0x30')]=_[_0x3610('0x31')](_0x2122eb['query']);_0x57965b['filters']=_[_0x3610('0x33')](_0x57965b['model'],_0x57965b[_0x3610('0x30')]);_0x300c22[_0x3610('0x34')]=_[_0x3610('0x33')](_0x57965b['model'],qs[_0x3610('0x45')](_0x2122eb[_0x3610('0x30')]['fields']));_0x300c22['attributes']=_0x300c22[_0x3610('0x34')][_0x3610('0x35')]?_0x300c22[_0x3610('0x34')]:_0x57965b[_0x3610('0x2f')];if(_0x2122eb['query'][_0x3610('0x3f')]){_0x300c22[_0x3610('0x46')]=[{'all':!![]}];}_0x300c22=_[_0x3610('0x3b')]({},_0x300c22,_0x2122eb[_0x3610('0x3e')]);return db[_0x3610('0x2b')][_0x3610('0x47')](_0x300c22)[_0x3610('0x24')](handleEntityNotFound(_0x5e6ca3,null))[_0x3610('0x24')](respondWithResult(_0x5e6ca3,null))[_0x3610('0x41')](handleError(_0x5e6ca3,null));};exports[_0x3610('0x48')]=function(_0x33652e,_0x3f8074){return db[_0x3610('0x2b')][_0x3610('0x48')](_0x33652e[_0x3610('0x49')],{})[_0x3610('0x24')](respondWithResult(_0x3f8074,0xc9))[_0x3610('0x41')](handleError(_0x3f8074,null));};exports['update']=function(_0x48ebdf,_0x3722ba){if(_0x48ebdf[_0x3610('0x49')]['id']){delete _0x48ebdf[_0x3610('0x49')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x48ebdf['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x3722ba,null))['then'](saveUpdates(_0x48ebdf[_0x3610('0x49')],null))[_0x3610('0x24')](respondWithResult(_0x3722ba,null))[_0x3610('0x41')](handleError(_0x3722ba,null));};exports['destroy']=function(_0x25d1e7,_0x33c0c6){return db[_0x3610('0x2b')]['find']({'where':{'id':_0x25d1e7[_0x3610('0x43')]['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x33c0c6,null))[_0x3610('0x24')](removeEntity(_0x33c0c6,null))[_0x3610('0x41')](handleError(_0x33c0c6,null));};exports[_0x3610('0x4a')]=function(_0x47c5dd,_0x29ba89,_0x37de40){var _0x1be932={};var _0x4047df={};var _0x2f920c;var _0x4b766b;return db[_0x3610('0x2b')]['findOne']({'where':{'id':_0x47c5dd['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x29ba89,null))[_0x3610('0x24')](function(_0x1cbea3){if(_0x1cbea3){_0x2f920c=_0x1cbea3;_0x4047df[_0x3610('0x2f')]=_[_0x3610('0x31')](db[_0x3610('0x4b')][_0x3610('0x44')]);_0x4047df[_0x3610('0x30')]=_[_0x3610('0x31')](_0x47c5dd[_0x3610('0x30')]);_0x4047df['filters']=_[_0x3610('0x33')](_0x4047df[_0x3610('0x2f')],_0x4047df[_0x3610('0x30')]);_0x1be932[_0x3610('0x34')]=_[_0x3610('0x33')](_0x4047df[_0x3610('0x2f')],qs[_0x3610('0x45')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x45')]));_0x1be932[_0x3610('0x34')]=_0x1be932[_0x3610('0x34')][_0x3610('0x35')]?_0x1be932[_0x3610('0x34')]:_0x4047df[_0x3610('0x2f')];_0x1be932[_0x3610('0x37')]=qs['sort'](_0x47c5dd['query']['sort']);_0x1be932[_0x3610('0x39')]=qs[_0x3610('0x32')](_[_0x3610('0x3a')](_0x47c5dd[_0x3610('0x30')],_0x4047df[_0x3610('0x32')]));if(_0x47c5dd[_0x3610('0x30')][_0x3610('0x3d')]){_0x1be932[_0x3610('0x39')]=_[_0x3610('0x3b')](_0x1be932[_0x3610('0x39')],{'$or':_[_0x3610('0x2a')](_0x1be932[_0x3610('0x34')],function(_0x5a003b){var _0x565a92={};_0x565a92[_0x5a003b]={'$like':'%'+_0x47c5dd['query'][_0x3610('0x3d')]+'%'};return _0x565a92;})});}_0x1be932=_['merge']({},_0x1be932,_0x47c5dd[_0x3610('0x3e')]);return _0x2f920c[_0x3610('0x4a')](_0x1be932);}})['then'](function(_0x487cd9){if(_0x487cd9){_0x4b766b=_0x487cd9['length'];if(!_0x47c5dd['query'][_0x3610('0x4c')](_0x3610('0x36'))){_0x1be932[_0x3610('0x1c')]=qs[_0x3610('0x1c')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x1c')]);_0x1be932[_0x3610('0x1a')]=qs[_0x3610('0x1a')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x1a')]);}return _0x2f920c['getConfigurations'](_0x1be932);}})[_0x3610('0x24')](function(_0x5cebd2){if(_0x5cebd2){return _0x5cebd2?{'count':_0x4b766b,'rows':_0x5cebd2}:null;}})[_0x3610('0x24')](respondWithResult(_0x29ba89,null))[_0x3610('0x41')](handleError(_0x29ba89,null));};exports[_0x3610('0x4d')]=function(_0x5092f3,_0x5dc9d9,_0x254d36){if(_0x5092f3[_0x3610('0x49')]['id']){delete _0x5092f3['body']['id'];}return db[_0x3610('0x2b')]['findOne']({'where':{'id':_0x5092f3['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x5dc9d9,null))[_0x3610('0x24')](function(_0xab7eba){if(_0xab7eba){_0x5092f3['body']['AccountId']=_0xab7eba['id'];_0x5092f3['body'][_0x3610('0x4e')]=integrations[_0x3610('0x4f')](_0x5092f3['body'][_0x3610('0x50')],_0x5092f3['body']['type']);_0x5092f3[_0x3610('0x49')][_0x3610('0x51')]=integrations[_0x3610('0x52')](_0x5092f3[_0x3610('0x49')]['channel'],_0x5092f3[_0x3610('0x49')][_0x3610('0x2d')]);return db['ZohoConfiguration'][_0x3610('0x48')](_0x5092f3[_0x3610('0x49')],{'include':[{'model':db['ZohoField'],'as':_0x3610('0x4e')},{'model':db[_0x3610('0x53')],'as':_0x3610('0x51')}]});}return null;})[_0x3610('0x24')](respondWithResult(_0x5dc9d9,null))[_0x3610('0x41')](handleError(_0x5dc9d9,null));};function getAccessToken(_0x3b8944){return new Promise(function(_0x129d10,_0x57cb11){var _0x125cd1;switch(_0x3b8944[_0x3610('0x54')]){case'US':_0x125cd1='https://accounts.zoho.com';break;case'AU':_0x125cd1=_0x3610('0x55');break;case'EU':_0x125cd1=_0x3610('0x56');break;case'IN':_0x125cd1=_0x3610('0x57');break;case'CN':_0x125cd1='https://accounts.zoho.com.cn';break;default:_0x125cd1='https://accounts.zoho.eu';break;}var _0x25c16c={'method':_0x3610('0x58'),'uri':_0x125cd1+_0x3610('0x59'),'qs':{'refresh_token':_0x3b8944[_0x3610('0x5a')],'client_id':_0x3b8944[_0x3610('0x5b')],'client_secret':_0x3b8944['clientSecret'],'grant_type':_0x3610('0x5c')},'json':!![]};return rp(_0x25c16c)[_0x3610('0x24')](function(_0x2f2ab6){if(_0x2f2ab6[_0x3610('0x5d')]){_0x129d10(_0x2f2ab6['access_token']);}else{_0x57cb11(_0x3610('0x5e'));}})['catch'](function(_0x574c74){_0x57cb11(_0x574c74);});});}exports[_0x3610('0x5f')]=function(_0x51429f,_0x3eeee0,_0x585bdb){var _0x5c44f9,_0x53ce80,_0x36ca43,_0x3faef6,_0x2d6469;return db['ZohoAccount']['findOne']({'where':{'id':_0x51429f[_0x3610('0x43')]['id']},'attributes':['id','host',_0x3610('0x54'),'clientId',_0x3610('0x60'),'serverUrl','code',_0x3610('0x5a')]})['then'](handleEntityNotFound(_0x3eeee0,null))[_0x3610('0x24')](function(_0x1a19ae){_0x2d6469=_0x1a19ae;_0x5c44f9=_0x2d6469[_0x3610('0x61')];_0x53ce80=_0x5c44f9===_0x3610('0x62')?'eu':_0x3610('0x63');_0x36ca43=_0x2d6469['serverUrl'];var _0x2c8d8=_0x36ca43['slice'](-0x1);if(_0x2c8d8==='/'||_0x2c8d8==='\x5c'||_0x2c8d8===':'){_0x36ca43=_0x36ca43[_0x3610('0x64')](0x0,_0x36ca43[_0x3610('0x65')](_0x2c8d8));}if(!_0x2d6469[_0x3610('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2d6469);})[_0x3610('0x24')](function(_0x3d624a){if(_0x3d624a){return rp({'method':_0x3610('0x66'),'uri':util[_0x3610('0x67')](_0x3610('0x68'),_0x53ce80),'qs':{'module':_0x3610('0x69')},'headers':{'Authorization':_0x3610('0x6a')+_0x3d624a},'json':!![]});}})[_0x3610('0x24')](function(_0x520ad5){if(_0x520ad5){if(_0x520ad5[_0x3610('0x6b')]&&_0x520ad5[_0x3610('0x6b')]['error']){throw new Error(_0x520ad5['response'][_0x3610('0x26')][_0x3610('0x6c')]);}var _0x31f24f=[];var _0x4a2d8f=[];var _0x2db672=['Owner',_0x3610('0x6d'),_0x3610('0x6e'),'WhoId','Call_Duration',_0x3610('0x6f'),_0x3610('0x70'),_0x3610('0x71')];_0x4a2d8f=_['remove'](_0x520ad5[_0x3610('0x45')],function(_0x2f992c){return _0x2db672[_0x3610('0x72')](_0x2f992c[_0x3610('0x73')]);});for(var _0x125d52=0x0;_0x125d52<_0x4a2d8f[_0x3610('0x35')];_0x125d52++){if(_0x4a2d8f[_0x125d52][_0x3610('0x74')]===![]){_0x31f24f[_0x3610('0x75')]({'id':_0x4a2d8f[_0x125d52]['id'],'name':_0x4a2d8f[_0x125d52]['display_label'],'custom':_0x4a2d8f[_0x125d52]['custom_field'],'options':_0x4a2d8f[_0x125d52]['data_type']===_0x3610('0x76')&&_0x4a2d8f[_0x125d52][_0x3610('0x77')][_0x3610('0x35')]>-0x1?_[_0x3610('0x2a')](_0x4a2d8f[_0x125d52][_0x3610('0x77')],function(_0xc45c5){return{'name':_0xc45c5,'value':_0xc45c5};}):[]});}}return{'count':_0x31f24f['length'],'rows':_0x31f24f};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3eeee0,null))['catch'](function(_0x61f97){var _0x382155=_0x51429f[_0x3610('0x30')][_0x3610('0x78')]?0x1f4:_0x61f97[_0x3610('0x79')]||0x1f4;logger[_0x3610('0x26')](_0x3610('0x7a'),'getFields',_0x382155,JSON[_0x3610('0x7b')](_0x61f97));delete _0x61f97['name'];if(_0x382155===0x191){_0x382155=0x190;}_0x3eeee0[_0x3610('0x19')](_0x382155)[_0x3610('0x29')](_0x51429f[_0x3610('0x30')][_0x3610('0x78')]?{'message':_0x3610('0x7c'),'statusCode':_0x61f97[_0x3610('0x79')]}:_0x61f97);});}; \ No newline at end of file +var _0x5725=['com','serverUrl','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','ZohoAccount','includeAll','include','rows','catch','show','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','access_token','code','host','zoho.eu'];(function(_0x9f7bfd,_0x2fc934){var _0x5680bd=function(_0x3135cd){while(--_0x3135cd){_0x9f7bfd['push'](_0x9f7bfd['shift']());}};_0x5680bd(++_0x2fc934);}(_0x5725,0xa1));var _0x5572=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5725[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x5572('0x0'));var rimraf=require(_0x5572('0x1'));var zipdir=require(_0x5572('0x2'));var jsonpatch=require(_0x5572('0x3'));var rp=require(_0x5572('0x4'));var moment=require(_0x5572('0x5'));var BPromise=require(_0x5572('0x6'));var Mustache=require(_0x5572('0x7'));var util=require(_0x5572('0x8'));var path=require(_0x5572('0x9'));var sox=require(_0x5572('0xa'));var csv=require(_0x5572('0xb'));var ejs=require(_0x5572('0xc'));var fs=require('fs');var fs_extra=require(_0x5572('0xd'));var _=require(_0x5572('0xe'));var squel=require(_0x5572('0xf'));var crypto=require(_0x5572('0x10'));var jsforce=require(_0x5572('0x11'));var deskjs=require(_0x5572('0x12'));var toCsv=require(_0x5572('0xb'));var querystring=require(_0x5572('0x13'));var Papa=require(_0x5572('0x14'));var Redis=require('ioredis');var authService=require(_0x5572('0x15'));var qs=require(_0x5572('0x16'));var as=require(_0x5572('0x17'));var hardwareService=require(_0x5572('0x18'));var logger=require(_0x5572('0x19'))(_0x5572('0x1a'));var utils=require('../../config/utils');var config=require(_0x5572('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5572('0x1c'))['db'];var integrations=require(_0x5572('0x1d'));function respondWithStatusCode(_0x4bd501,_0x4aca4c){_0x4aca4c=_0x4aca4c||0xcc;return function(_0x209c17){if(_0x209c17){return _0x4bd501['sendStatus'](_0x4aca4c);}return _0x4bd501['status'](_0x4aca4c)[_0x5572('0x1e')]();};}function respondWithResult(_0x148bd9,_0x13ad11){_0x13ad11=_0x13ad11||0xc8;return function(_0x374002){if(_0x374002){return _0x148bd9['status'](_0x13ad11)[_0x5572('0x1f')](_0x374002);}};}function respondWithFilteredResult(_0xd02bcc,_0x5a8230){return function(_0x3a761f){if(_0x3a761f){var _0x53fc14=typeof _0x5a8230[_0x5572('0x20')]===_0x5572('0x21')&&typeof _0x5a8230[_0x5572('0x22')]===_0x5572('0x21');var _0x45728a=_0x3a761f[_0x5572('0x23')];var _0x2af5e3=_0x53fc14?0x0:_0x5a8230[_0x5572('0x20')];var _0x47f257=_0x53fc14?_0x3a761f['count']:_0x5a8230[_0x5572('0x20')]+_0x5a8230['limit'];var _0x5bcfd9;if(_0x47f257>=_0x45728a){_0x47f257=_0x45728a;_0x5bcfd9=0xc8;}else{_0x5bcfd9=0xce;}_0xd02bcc[_0x5572('0x24')](_0x5bcfd9);return _0xd02bcc[_0x5572('0x25')](_0x5572('0x26'),_0x2af5e3+'-'+_0x47f257+'/'+_0x45728a)[_0x5572('0x1f')](_0x3a761f);}return null;};}function patchUpdates(_0x208eb3){return function(_0x3b88a2){try{jsonpatch['apply'](_0x3b88a2,_0x208eb3,!![]);}catch(_0x5971fa){return BPromise[_0x5572('0x27')](_0x5971fa);}return _0x3b88a2['save']();};}function saveUpdates(_0x63bb8d,_0x3b5395){return function(_0x293039){if(_0x293039){return _0x293039[_0x5572('0x28')](_0x63bb8d)[_0x5572('0x29')](function(_0x5c1e30){return _0x5c1e30;});}return null;};}function removeEntity(_0x19cc2b,_0x51f693){return function(_0x1955a4){if(_0x1955a4){return _0x1955a4[_0x5572('0x2a')]()['then'](function(){_0x19cc2b['status'](0xcc)[_0x5572('0x1e')]();});}};}function handleEntityNotFound(_0x104743,_0x588a62){return function(_0xc5449d){if(!_0xc5449d){_0x104743['sendStatus'](0x194);}return _0xc5449d;};}function handleError(_0x276f02,_0x52675b){_0x52675b=_0x52675b||0x1f4;return function(_0x3d4524){logger[_0x5572('0x2b')](_0x3d4524[_0x5572('0x2c')]);if(_0x3d4524[_0x5572('0x2d')]){delete _0x3d4524[_0x5572('0x2d')];}_0x276f02['status'](_0x52675b)[_0x5572('0x2e')](_0x3d4524);};}exports['index']=function(_0x26b388,_0x466513){var _0x14d265={},_0x3ae448={},_0x34f512={'count':0x0,'rows':[]};var _0x5e3a47=_['map'](db['ZohoAccount'][_0x5572('0x2f')],function(_0x5e6412){return{'name':_0x5e6412[_0x5572('0x30')],'type':_0x5e6412[_0x5572('0x31')][_0x5572('0x32')]};});_0x3ae448[_0x5572('0x33')]=_['map'](_0x5e3a47,'name');_0x3ae448['query']=_[_0x5572('0x34')](_0x26b388[_0x5572('0x35')]);_0x3ae448[_0x5572('0x36')]=_['intersection'](_0x3ae448['model'],_0x3ae448[_0x5572('0x35')]);_0x14d265[_0x5572('0x37')]=_[_0x5572('0x38')](_0x3ae448[_0x5572('0x33')],qs[_0x5572('0x39')](_0x26b388[_0x5572('0x35')][_0x5572('0x39')]));_0x14d265[_0x5572('0x37')]=_0x14d265[_0x5572('0x37')][_0x5572('0x3a')]?_0x14d265[_0x5572('0x37')]:_0x3ae448[_0x5572('0x33')];if(!_0x26b388[_0x5572('0x35')][_0x5572('0x3b')](_0x5572('0x3c'))){_0x14d265[_0x5572('0x22')]=qs[_0x5572('0x22')](_0x26b388[_0x5572('0x35')][_0x5572('0x22')]);_0x14d265[_0x5572('0x20')]=qs[_0x5572('0x20')](_0x26b388[_0x5572('0x35')][_0x5572('0x20')]);}_0x14d265['order']=qs[_0x5572('0x3d')](_0x26b388[_0x5572('0x35')][_0x5572('0x3d')]);_0x14d265[_0x5572('0x3e')]=qs['filters'](_[_0x5572('0x3f')](_0x26b388[_0x5572('0x35')],_0x3ae448[_0x5572('0x36')]),_0x5e3a47);if(_0x26b388['query'][_0x5572('0x40')]){_0x14d265[_0x5572('0x3e')]=_['merge'](_0x14d265[_0x5572('0x3e')],{'$or':_[_0x5572('0x41')](_0x5e3a47,function(_0x17adc4){if(_0x17adc4[_0x5572('0x31')]!==_0x5572('0x42')){var _0x5a6a06={};_0x5a6a06[_0x17adc4['name']]={'$like':'%'+_0x26b388[_0x5572('0x35')][_0x5572('0x40')]+'%'};return _0x5a6a06;}})});}_0x14d265=_[_0x5572('0x43')]({},_0x14d265,_0x26b388[_0x5572('0x44')]);var _0x40ad05={'where':_0x14d265[_0x5572('0x3e')]};return db[_0x5572('0x45')][_0x5572('0x23')](_0x40ad05)[_0x5572('0x29')](function(_0xe65e2b){_0x34f512['count']=_0xe65e2b;if(_0x26b388[_0x5572('0x35')][_0x5572('0x46')]){_0x14d265[_0x5572('0x47')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x14d265);})['then'](function(_0x3aa99f){_0x34f512[_0x5572('0x48')]=_0x3aa99f;return _0x34f512;})['then'](respondWithFilteredResult(_0x466513,_0x14d265))[_0x5572('0x49')](handleError(_0x466513,null));};exports[_0x5572('0x4a')]=function(_0x54b307,_0x633bc3){var _0x3278cf={'raw':![],'where':{'id':_0x54b307['params']['id']}},_0x3114f5={};_0x3114f5[_0x5572('0x33')]=_[_0x5572('0x34')](db[_0x5572('0x45')]['rawAttributes']);_0x3114f5[_0x5572('0x35')]=_['keys'](_0x54b307[_0x5572('0x35')]);_0x3114f5[_0x5572('0x36')]=_[_0x5572('0x38')](_0x3114f5[_0x5572('0x33')],_0x3114f5['query']);_0x3278cf[_0x5572('0x37')]=_[_0x5572('0x38')](_0x3114f5[_0x5572('0x33')],qs[_0x5572('0x39')](_0x54b307[_0x5572('0x35')][_0x5572('0x39')]));_0x3278cf[_0x5572('0x37')]=_0x3278cf['attributes'][_0x5572('0x3a')]?_0x3278cf[_0x5572('0x37')]:_0x3114f5[_0x5572('0x33')];if(_0x54b307[_0x5572('0x35')][_0x5572('0x46')]){_0x3278cf['include']=[{'all':!![]}];}_0x3278cf=_[_0x5572('0x43')]({},_0x3278cf,_0x54b307[_0x5572('0x44')]);return db[_0x5572('0x45')][_0x5572('0x4b')](_0x3278cf)['then'](handleEntityNotFound(_0x633bc3,null))['then'](respondWithResult(_0x633bc3,null))['catch'](handleError(_0x633bc3,null));};exports[_0x5572('0x4c')]=function(_0x409f01,_0x4547f1){return db[_0x5572('0x45')][_0x5572('0x4c')](_0x409f01[_0x5572('0x4d')],{})['then'](respondWithResult(_0x4547f1,0xc9))[_0x5572('0x49')](handleError(_0x4547f1,null));};exports['update']=function(_0x358488,_0x345df0){if(_0x358488[_0x5572('0x4d')]['id']){delete _0x358488['body']['id'];}return db['ZohoAccount'][_0x5572('0x4b')]({'where':{'id':_0x358488[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x345df0,null))[_0x5572('0x29')](saveUpdates(_0x358488[_0x5572('0x4d')],null))[_0x5572('0x29')](respondWithResult(_0x345df0,null))[_0x5572('0x49')](handleError(_0x345df0,null));};exports['destroy']=function(_0x5b3214,_0x57f4e0){return db['ZohoAccount']['find']({'where':{'id':_0x5b3214[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x57f4e0,null))[_0x5572('0x29')](removeEntity(_0x57f4e0,null))[_0x5572('0x49')](handleError(_0x57f4e0,null));};exports['getConfigurations']=function(_0x5d0c5f,_0x16e9fd,_0x3bf735){var _0x5c4789={};var _0x1f6e6c={};var _0x3037ba;var _0xb41520;return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x5d0c5f[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x16e9fd,null))[_0x5572('0x29')](function(_0x32f389){if(_0x32f389){_0x3037ba=_0x32f389;_0x1f6e6c['model']=_[_0x5572('0x34')](db[_0x5572('0x50')]['rawAttributes']);_0x1f6e6c[_0x5572('0x35')]=_[_0x5572('0x34')](_0x5d0c5f[_0x5572('0x35')]);_0x1f6e6c[_0x5572('0x36')]=_[_0x5572('0x38')](_0x1f6e6c[_0x5572('0x33')],_0x1f6e6c[_0x5572('0x35')]);_0x5c4789[_0x5572('0x37')]=_[_0x5572('0x38')](_0x1f6e6c[_0x5572('0x33')],qs[_0x5572('0x39')](_0x5d0c5f[_0x5572('0x35')]['fields']));_0x5c4789[_0x5572('0x37')]=_0x5c4789['attributes'][_0x5572('0x3a')]?_0x5c4789[_0x5572('0x37')]:_0x1f6e6c[_0x5572('0x33')];_0x5c4789['order']=qs[_0x5572('0x3d')](_0x5d0c5f[_0x5572('0x35')][_0x5572('0x3d')]);_0x5c4789[_0x5572('0x3e')]=qs[_0x5572('0x36')](_[_0x5572('0x3f')](_0x5d0c5f[_0x5572('0x35')],_0x1f6e6c['filters']));if(_0x5d0c5f['query'][_0x5572('0x40')]){_0x5c4789['where']=_[_0x5572('0x43')](_0x5c4789[_0x5572('0x3e')],{'$or':_['map'](_0x5c4789['attributes'],function(_0x1f152f){var _0x81ab58={};_0x81ab58[_0x1f152f]={'$like':'%'+_0x5d0c5f[_0x5572('0x35')]['filter']+'%'};return _0x81ab58;})});}_0x5c4789=_[_0x5572('0x43')]({},_0x5c4789,_0x5d0c5f['options']);return _0x3037ba[_0x5572('0x51')](_0x5c4789);}})[_0x5572('0x29')](function(_0xfda743){if(_0xfda743){_0xb41520=_0xfda743[_0x5572('0x3a')];if(!_0x5d0c5f['query']['hasOwnProperty'](_0x5572('0x3c'))){_0x5c4789[_0x5572('0x22')]=qs[_0x5572('0x22')](_0x5d0c5f[_0x5572('0x35')][_0x5572('0x22')]);_0x5c4789[_0x5572('0x20')]=qs[_0x5572('0x20')](_0x5d0c5f[_0x5572('0x35')]['offset']);}return _0x3037ba[_0x5572('0x51')](_0x5c4789);}})[_0x5572('0x29')](function(_0x263f47){if(_0x263f47){return _0x263f47?{'count':_0xb41520,'rows':_0x263f47}:null;}})[_0x5572('0x29')](respondWithResult(_0x16e9fd,null))[_0x5572('0x49')](handleError(_0x16e9fd,null));};exports[_0x5572('0x52')]=function(_0x2617bf,_0x23ec99,_0x1ca628){if(_0x2617bf[_0x5572('0x4d')]['id']){delete _0x2617bf[_0x5572('0x4d')]['id'];}return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x2617bf['params']['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x23ec99,null))[_0x5572('0x29')](function(_0x176c41){if(_0x176c41){_0x2617bf[_0x5572('0x4d')][_0x5572('0x53')]=_0x176c41['id'];_0x2617bf['body'][_0x5572('0x54')]=integrations[_0x5572('0x55')](_0x2617bf[_0x5572('0x4d')][_0x5572('0x56')],_0x2617bf[_0x5572('0x4d')][_0x5572('0x31')]);_0x2617bf['body'][_0x5572('0x57')]=integrations['getDescriptions'](_0x2617bf[_0x5572('0x4d')]['channel'],_0x2617bf[_0x5572('0x4d')][_0x5572('0x31')]);return db[_0x5572('0x50')][_0x5572('0x4c')](_0x2617bf[_0x5572('0x4d')],{'include':[{'model':db[_0x5572('0x58')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x5572('0x57')}]});}return null;})[_0x5572('0x29')](respondWithResult(_0x23ec99,null))[_0x5572('0x49')](handleError(_0x23ec99,null));};function getAccessToken(_0x9db04e){return new Promise(function(_0x2fa4c7,_0x55ccb6){var _0x38ce72;switch(_0x9db04e['zone']){case'US':_0x38ce72=_0x5572('0x59');break;case'AU':_0x38ce72=_0x5572('0x5a');break;case'EU':_0x38ce72=_0x5572('0x5b');break;case'IN':_0x38ce72=_0x5572('0x5c');break;case'CN':_0x38ce72=_0x5572('0x5d');break;default:_0x38ce72='https://accounts.zoho.eu';break;}var _0xbb3b4e={'method':'POST','uri':_0x38ce72+'/oauth/v2/token','qs':{'refresh_token':_0x9db04e['refreshToken'],'client_id':_0x9db04e[_0x5572('0x5e')],'client_secret':_0x9db04e[_0x5572('0x5f')],'grant_type':_0x5572('0x60')},'json':!![]};return rp(_0xbb3b4e)[_0x5572('0x29')](function(_0x49dcb4){if(_0x49dcb4[_0x5572('0x61')]){_0x2fa4c7(_0x49dcb4[_0x5572('0x61')]);}else{_0x55ccb6('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x27c001){_0x55ccb6(_0x27c001);});});}exports['getFields']=function(_0x501c86,_0x4005a0,_0x21d37c){var _0x1bf32b,_0x52a593,_0x22e8eb,_0x49f4d2,_0x4a2e76;return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x501c86['params']['id']},'attributes':['id','host','zone',_0x5572('0x5e'),_0x5572('0x5f'),'serverUrl',_0x5572('0x62'),'refreshToken']})[_0x5572('0x29')](handleEntityNotFound(_0x4005a0,null))[_0x5572('0x29')](function(_0x2dab62){_0x4a2e76=_0x2dab62;_0x1bf32b=_0x4a2e76[_0x5572('0x63')];_0x52a593=_0x1bf32b===_0x5572('0x64')?'eu':_0x5572('0x65');_0x22e8eb=_0x4a2e76[_0x5572('0x66')];var _0x4991eb=_0x22e8eb['slice'](-0x1);if(_0x4991eb==='/'||_0x4991eb==='\x5c'||_0x4991eb===':'){_0x22e8eb=_0x22e8eb['substring'](0x0,_0x22e8eb[_0x5572('0x67')](_0x4991eb));}if(!_0x4a2e76[_0x5572('0x68')]){throw new Error(_0x5572('0x69'));}return getAccessToken(_0x4a2e76);})[_0x5572('0x29')](function(_0x222777){if(_0x222777){return rp({'method':_0x5572('0x6a'),'uri':util[_0x5572('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x52a593),'qs':{'module':_0x5572('0x6c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x222777},'json':!![]});}})[_0x5572('0x29')](function(_0x49156b){if(_0x49156b){if(_0x49156b[_0x5572('0x6d')]&&_0x49156b[_0x5572('0x6d')][_0x5572('0x2b')]){throw new Error(_0x49156b[_0x5572('0x6d')]['error'][_0x5572('0x6e')]);}var _0x1aad74=[];var _0x4022b3=[];var _0x384de4=[_0x5572('0x6f'),_0x5572('0x70'),_0x5572('0x71'),'WhoId',_0x5572('0x72'),_0x5572('0x73'),_0x5572('0x74'),_0x5572('0x75')];_0x4022b3=_[_0x5572('0x76')](_0x49156b[_0x5572('0x39')],function(_0x162d62){return _0x384de4[_0x5572('0x77')](_0x162d62[_0x5572('0x78')]);});for(var _0x254348=0x0;_0x254348<_0x4022b3[_0x5572('0x3a')];_0x254348++){if(_0x4022b3[_0x254348][_0x5572('0x79')]===![]){_0x1aad74[_0x5572('0x7a')]({'id':_0x4022b3[_0x254348]['id'],'name':_0x4022b3[_0x254348][_0x5572('0x7b')],'custom':_0x4022b3[_0x254348][_0x5572('0x7c')],'options':_0x4022b3[_0x254348]['data_type']===_0x5572('0x7d')&&_0x4022b3[_0x254348][_0x5572('0x7e')][_0x5572('0x3a')]>-0x1?_['map'](_0x4022b3[_0x254348][_0x5572('0x7e')],function(_0x17cd28){return{'name':_0x17cd28,'value':_0x17cd28};}):[]});}}return{'count':_0x1aad74[_0x5572('0x3a')],'rows':_0x1aad74};}else{return{'count':0x0,'rows':[]};}})[_0x5572('0x29')](respondWithResult(_0x4005a0,null))[_0x5572('0x49')](function(_0x4f514d){var _0x33f231=_0x501c86[_0x5572('0x35')]['test']?0x1f4:_0x4f514d[_0x5572('0x7f')]||0x1f4;logger['error'](_0x5572('0x80'),_0x5572('0x81'),_0x33f231,JSON['stringify'](_0x4f514d));delete _0x4f514d[_0x5572('0x2d')];if(_0x33f231===0x191){_0x33f231=0x190;}_0x4005a0[_0x5572('0x24')](_0x33f231)[_0x5572('0x2e')](_0x501c86['query']['test']?{'message':_0x5572('0x82'),'statusCode':_0x4f514d[_0x5572('0x7f')]}:_0x4f514d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0a771b8..b09c772 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 _0x19ba=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','slice','https://accounts.zoho.com.au','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','serverUrl','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','error'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0x19ba,0x150));var _0xa19b=function(_0x1f4a62,_0x24192a){_0x1f4a62=_0x1f4a62-0x0;var _0x2a9fe7=_0x19ba[_0x1f4a62];return _0x2a9fe7;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var logger=require(_0xa19b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa19b('0x3'));var rp=require(_0xa19b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19b('0x5'));var config=require(_0xa19b('0x6'));var attributes=require(_0xa19b('0x7'));var integrations=require(_0xa19b('0x8'));module[_0xa19b('0x9')]=function(_0xae383,_0x36beee){return _0xae383[_0xa19b('0xa')](_0xa19b('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d234c,_0x3cfb59,_0x279c58){if(_0x1d234c[_0xa19b('0xc')](_0xa19b('0xd'))||_0x1d234c[_0xa19b('0xc')]('serverUrl')||_0x1d234c[_0xa19b('0xc')](_0xa19b('0xe'))||_0x1d234c[_0xa19b('0xc')](_0xa19b('0xf'))||_0x1d234c[_0xa19b('0xc')]('code')||_0x1d234c[_0xa19b('0xc')]('host')){var _0x5a16da,_0x346833;_0x5a16da=_0x1d234c[_0xa19b('0x10')];var _0x2325e4=_0x5a16da['slice'](-0x1);if(_0x2325e4==='/'||_0x2325e4==='\x5c'||_0x2325e4===':'){_0x5a16da=_0x5a16da[_0xa19b('0x11')](0x0,_0x5a16da['lastIndexOf'](_0x2325e4));}switch(_0x1d234c[_0xa19b('0xd')]){case'US':_0x346833=_0xa19b('0x12');break;case'AU':_0x346833='https://accounts.zoho.com.au';break;case'IN':_0x346833=_0xa19b('0x13');break;case'CN':_0x346833=_0xa19b('0x14');break;default:_0x346833=_0xa19b('0x15');break;}var _0x2d38fe={'method':_0xa19b('0x16'),'uri':_0x346833+_0xa19b('0x17'),'form':{'grant_type':_0xa19b('0x18'),'client_id':_0x1d234c[_0xa19b('0xe')],'client_secret':_0x1d234c[_0xa19b('0xf')],'redirect_uri':_0x1d234c['serverUrl'],'code':_0x1d234c[_0xa19b('0x19')]},'headers':{'Content-Type':_0xa19b('0x1a')}};return rp(_0x2d38fe)[_0xa19b('0x1b')](function(_0xdfed70){var _0x1b1edc=JSON[_0xa19b('0x1c')](_0xdfed70);if(_0x1b1edc[_0xa19b('0x1d')]){_0x1d234c['refreshToken']=_0x1b1edc[_0xa19b('0x1d')];logger[_0xa19b('0x1e')](util[_0xa19b('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d234c['name'],_0x1d234c['id']));}else{logger[_0xa19b('0x20')](util[_0xa19b('0x1f')](_0xa19b('0x21'),_0x1d234c['name'],_0x1d234c['id']),util['inspect'](_0x1b1edc,{'showHidden':![],'depth':null}));}return _0x279c58(null,_0x3cfb59);})[_0xa19b('0x22')](function(_0x23ee7b){logger['error'](util[_0xa19b('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d234c['name'],_0x1d234c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x279c58(_0x23ee7b);});}else{return _0x279c58(null,_0x3cfb59);}},'beforeUpdate':function(_0x467dc8,_0x5c45ad,_0x8756af){if(_0x467dc8[_0xa19b('0xc')]('zone')||_0x467dc8['changed'](_0xa19b('0x10'))||_0x467dc8['changed'](_0xa19b('0xe'))||_0x467dc8['changed']('clientSecret')||_0x467dc8[_0xa19b('0xc')]('code')||_0x467dc8[_0xa19b('0xc')]('host')){var _0x1385a8,_0x4c01f1;_0x1385a8=_0x467dc8[_0xa19b('0x10')];var _0x26a825=_0x1385a8[_0xa19b('0x23')](-0x1);if(_0x26a825==='/'||_0x26a825==='\x5c'||_0x26a825===':'){_0x1385a8=_0x1385a8[_0xa19b('0x11')](0x0,_0x1385a8['lastIndexOf'](_0x26a825));}switch(_0x467dc8[_0xa19b('0xd')]){case'US':_0x4c01f1=_0xa19b('0x12');break;case'AU':_0x4c01f1=_0xa19b('0x24');break;case'IN':_0x4c01f1='https://accounts.zoho.in';break;case'CN':_0x4c01f1=_0xa19b('0x14');break;default:_0x4c01f1=_0xa19b('0x15');break;}var _0x19a0dd={'method':_0xa19b('0x16'),'uri':_0x4c01f1+'/oauth/v2/token','form':{'grant_type':_0xa19b('0x18'),'client_id':_0x467dc8[_0xa19b('0xe')],'client_secret':_0x467dc8['clientSecret'],'redirect_uri':_0x467dc8['serverUrl'],'code':_0x467dc8['code']},'headers':{'Content-Type':_0xa19b('0x1a')}};return rp(_0x19a0dd)[_0xa19b('0x1b')](function(_0x5e537e){var _0x214ef7=JSON[_0xa19b('0x1c')](_0x5e537e);if(_0x214ef7['refresh_token']){_0x467dc8[_0xa19b('0x25')]=_0x214ef7[_0xa19b('0x1d')];logger[_0xa19b('0x1e')](util[_0xa19b('0x1f')](_0xa19b('0x26'),_0x467dc8[_0xa19b('0x27')],_0x467dc8['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x467dc8[_0xa19b('0x27')],_0x467dc8['id']),util[_0xa19b('0x28')](_0x214ef7,{'showHidden':![],'depth':null}));}return _0x8756af(null,_0x5c45ad);})[_0xa19b('0x22')](function(_0x15eb64){logger[_0xa19b('0x20')](util['format'](_0xa19b('0x21'),_0x467dc8['name'],_0x467dc8['id']),util[_0xa19b('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x8756af(_0x15eb64);});}else{return _0x8756af(null,_0x5c45ad);}}}});}; \ No newline at end of file +var _0xdaf0=['inspect','slice','/oauth/v2/token','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format'];(function(_0x430c06,_0x554ad6){var _0x5c8e8d=function(_0x41a6b3){while(--_0x41a6b3){_0x430c06['push'](_0x430c06['shift']());}};_0x5c8e8d(++_0x554ad6);}(_0xdaf0,0xfa));var _0x0daf=function(_0x5992bc,_0x459818){_0x5992bc=_0x5992bc-0x0;var _0x5dae8c=_0xdaf0[_0x5992bc];return _0x5dae8c;};'use strict';var _=require('lodash');var util=require(_0x0daf('0x0'));var logger=require('../../config/logger')(_0x0daf('0x1'));var moment=require(_0x0daf('0x2'));var BPromise=require(_0x0daf('0x3'));var rp=require(_0x0daf('0x4'));var fs=require('fs');var path=require(_0x0daf('0x5'));var rimraf=require(_0x0daf('0x6'));var config=require(_0x0daf('0x7'));var attributes=require(_0x0daf('0x8'));var integrations=require(_0x0daf('0x9'));module[_0x0daf('0xa')]=function(_0x51c744,_0x247ff0){return _0x51c744['define'](_0x0daf('0xb'),attributes,{'tableName':_0x0daf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x345216,_0x545bb9,_0x5db94e){if(_0x345216[_0x0daf('0xd')](_0x0daf('0xe'))||_0x345216[_0x0daf('0xd')](_0x0daf('0xf'))||_0x345216['changed'](_0x0daf('0x10'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x11'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x12'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x13'))){var _0xb48400,_0x468240;_0xb48400=_0x345216[_0x0daf('0xf')];var _0x456328=_0xb48400['slice'](-0x1);if(_0x456328==='/'||_0x456328==='\x5c'||_0x456328===':'){_0xb48400=_0xb48400[_0x0daf('0x14')](0x0,_0xb48400[_0x0daf('0x15')](_0x456328));}switch(_0x345216[_0x0daf('0xe')]){case'US':_0x468240='https://accounts.zoho.com';break;case'AU':_0x468240=_0x0daf('0x16');break;case'IN':_0x468240=_0x0daf('0x17');break;case'CN':_0x468240=_0x0daf('0x18');break;default:_0x468240=_0x0daf('0x19');break;}var _0x26fe9d={'method':'POST','uri':_0x468240+'/oauth/v2/token','form':{'grant_type':_0x0daf('0x1a'),'client_id':_0x345216['clientId'],'client_secret':_0x345216[_0x0daf('0x11')],'redirect_uri':_0x345216[_0x0daf('0xf')],'code':_0x345216[_0x0daf('0x12')]},'headers':{'Content-Type':_0x0daf('0x1b')}};return rp(_0x26fe9d)[_0x0daf('0x1c')](function(_0x2b35f9){var _0xcf9576=JSON[_0x0daf('0x1d')](_0x2b35f9);if(_0xcf9576[_0x0daf('0x1e')]){_0x345216[_0x0daf('0x1f')]=_0xcf9576[_0x0daf('0x1e')];logger[_0x0daf('0x20')](util['format'](_0x0daf('0x21'),_0x345216[_0x0daf('0x22')],_0x345216['id']));}else{logger[_0x0daf('0x23')](util[_0x0daf('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345216[_0x0daf('0x22')],_0x345216['id']),util[_0x0daf('0x25')](_0xcf9576,{'showHidden':![],'depth':null}));}return _0x5db94e(null,_0x545bb9);})['catch'](function(_0x3b815c){logger[_0x0daf('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345216['name'],_0x345216['id']),util[_0x0daf('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5db94e(_0x3b815c);});}else{return _0x5db94e(null,_0x545bb9);}},'beforeUpdate':function(_0x63704e,_0x218e75,_0x3fe934){if(_0x63704e[_0x0daf('0xd')]('zone')||_0x63704e[_0x0daf('0xd')](_0x0daf('0xf'))||_0x63704e[_0x0daf('0xd')]('clientId')||_0x63704e[_0x0daf('0xd')](_0x0daf('0x11'))||_0x63704e[_0x0daf('0xd')]('code')||_0x63704e[_0x0daf('0xd')](_0x0daf('0x13'))){var _0x51f560,_0x2bacde;_0x51f560=_0x63704e[_0x0daf('0xf')];var _0x31c876=_0x51f560[_0x0daf('0x26')](-0x1);if(_0x31c876==='/'||_0x31c876==='\x5c'||_0x31c876===':'){_0x51f560=_0x51f560[_0x0daf('0x14')](0x0,_0x51f560[_0x0daf('0x15')](_0x31c876));}switch(_0x63704e[_0x0daf('0xe')]){case'US':_0x2bacde='https://accounts.zoho.com';break;case'AU':_0x2bacde='https://accounts.zoho.com.au';break;case'IN':_0x2bacde=_0x0daf('0x17');break;case'CN':_0x2bacde='https://accounts.zoho.com.cn';break;default:_0x2bacde=_0x0daf('0x19');break;}var _0x30e330={'method':'POST','uri':_0x2bacde+_0x0daf('0x27'),'form':{'grant_type':_0x0daf('0x1a'),'client_id':_0x63704e[_0x0daf('0x10')],'client_secret':_0x63704e['clientSecret'],'redirect_uri':_0x63704e[_0x0daf('0xf')],'code':_0x63704e['code']},'headers':{'Content-Type':_0x0daf('0x1b')}};return rp(_0x30e330)[_0x0daf('0x1c')](function(_0x18c5d0){var _0x17c000=JSON['parse'](_0x18c5d0);if(_0x17c000[_0x0daf('0x1e')]){_0x63704e[_0x0daf('0x1f')]=_0x17c000[_0x0daf('0x1e')];logger[_0x0daf('0x20')](util[_0x0daf('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x63704e[_0x0daf('0x22')],_0x63704e['id']));}else{logger[_0x0daf('0x23')](util[_0x0daf('0x24')](_0x0daf('0x28'),_0x63704e[_0x0daf('0x22')],_0x63704e['id']),util[_0x0daf('0x25')](_0x17c000,{'showHidden':![],'depth':null}));}return _0x3fe934(null,_0x218e75);})['catch'](function(_0x39a010){logger['error'](util[_0x0daf('0x24')](_0x0daf('0x28'),_0x63704e['name'],_0x63704e['id']),util[_0x0daf('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3fe934(_0x39a010);});}else{return _0x3fe934(null,_0x218e75);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 538fbb7..b346cd1 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 _0xb90a=['limit','include','map','model','attributes','debug','find','ShowZohoAccount','lodash','util','bluebird','rpc','../../config/environment','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','ZohoAccount','options','raw','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb90a,0x12a));var _0xab90=function(_0x3ac9c8,_0x1eb17f){_0x3ac9c8=_0x3ac9c8-0x0;var _0xa4e42f=_0xb90a[_0x3ac9c8];return _0xa4e42f;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require('moment');var BPromise=require(_0xab90('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')(_0xab90('0x3'));var config=require(_0xab90('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab90('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x426588,_0x275bf7,_0x4b28a6){return new BPromise(function(_0x2406e1,_0xc5ca04){return client[_0xab90('0x6')](_0x426588,_0x4b28a6)[_0xab90('0x7')](function(_0x93af2f){logger[_0xab90('0x8')](_0xab90('0x9'),_0x275bf7,_0xab90('0xa'));logger['debug'](_0xab90('0xb'),_0x275bf7,_0xab90('0xa'),JSON[_0xab90('0xc')](_0x93af2f));if(_0x93af2f[_0xab90('0xd')]){if(_0x93af2f[_0xab90('0xd')]['code']===0x1f4){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0xc5ca04(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0x2406e1(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}else{logger[_0xab90('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x275bf7,_0xab90('0xa'));_0x2406e1(_0x93af2f['result'][_0xab90('0xe')]);}})[_0xab90('0xf')](function(_0x526bee){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x526bee);_0xc5ca04(_0x526bee);});});}exports[_0xab90('0x10')]=function(_0x58cc79){var _0x2ab85c=this;return new Promise(function(_0x18323a,_0x1d5222){return db[_0xab90('0x11')]['findAll']({'raw':_0x58cc79[_0xab90('0x12')]?_0x58cc79['options'][_0xab90('0x13')]===undefined?!![]:![]:!![],'where':_0x58cc79['options']?_0x58cc79[_0xab90('0x12')][_0xab90('0x14')]||null:null,'attributes':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')]['attributes']||null:null,'limit':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')][_0xab90('0x15')]||null:null,'include':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')][_0xab90('0x16')]?_[_0xab90('0x17')](_0x58cc79[_0xab90('0x12')][_0xab90('0x16')],function(_0x2cdc7f){return{'model':db[_0x2cdc7f[_0xab90('0x18')]],'as':_0x2cdc7f['as'],'attributes':_0x2cdc7f[_0xab90('0x19')],'include':_0x2cdc7f[_0xab90('0x16')]?_[_0xab90('0x17')](_0x2cdc7f['include'],function(_0x7e141c){return{'model':db[_0x7e141c[_0xab90('0x18')]],'as':_0x7e141c['as'],'attributes':_0x7e141c[_0xab90('0x19')],'include':_0x7e141c[_0xab90('0x16')]?_[_0xab90('0x17')](_0x7e141c[_0xab90('0x16')],function(_0x2cad38){return{'model':db[_0x2cad38[_0xab90('0x18')]],'as':_0x2cad38['as'],'attributes':_0x2cad38[_0xab90('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38b3ae){logger[_0xab90('0x8')]('GetZohoAccount',_0x58cc79);logger[_0xab90('0x1a')](_0xab90('0x10'),_0x58cc79,JSON[_0xab90('0xc')](_0x38b3ae));_0x18323a(_0x38b3ae);})[_0xab90('0xf')](function(_0x24e562){logger[_0xab90('0xd')](_0xab90('0x10'),_0x24e562[_0xab90('0xe')],_0x58cc79);_0x1d5222(_0x2ab85c[_0xab90('0xd')](0x1f4,_0x24e562[_0xab90('0xe')]));});});};exports['ShowZohoAccount']=function(_0x59ed30){var _0x5671c2=this;return new Promise(function(_0x215c4b,_0x5f1359){return db[_0xab90('0x11')][_0xab90('0x1b')]({'raw':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')][_0xab90('0x14')]||null:null,'attributes':_0x59ed30['options']?_0x59ed30['options'][_0xab90('0x19')]||null:null,'include':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')][_0xab90('0x16')]?_[_0xab90('0x17')](_0x59ed30[_0xab90('0x12')][_0xab90('0x16')],function(_0x1523bf){return{'model':db[_0x1523bf[_0xab90('0x18')]],'as':_0x1523bf['as'],'attributes':_0x1523bf[_0xab90('0x19')],'include':_0x1523bf[_0xab90('0x16')]?_['map'](_0x1523bf[_0xab90('0x16')],function(_0x1eb4d0){return{'model':db[_0x1eb4d0[_0xab90('0x18')]],'as':_0x1eb4d0['as'],'attributes':_0x1eb4d0[_0xab90('0x19')],'include':_0x1eb4d0[_0xab90('0x16')]?_['map'](_0x1eb4d0[_0xab90('0x16')],function(_0x30cea9){return{'model':db[_0x30cea9[_0xab90('0x18')]],'as':_0x30cea9['as'],'attributes':_0x30cea9['attributes']};}):[]};}):[]};}):[]:[]})[_0xab90('0x7')](function(_0x127d21){logger[_0xab90('0x8')](_0xab90('0x1c'),_0x59ed30);logger[_0xab90('0x1a')](_0xab90('0x1c'),_0x59ed30,JSON['stringify'](_0x127d21));_0x215c4b(_0x127d21);})[_0xab90('0xf')](function(_0x47e71b){logger[_0xab90('0xd')](_0xab90('0x1c'),_0x47e71b['message'],_0x59ed30);_0x5f1359(_0x5671c2[_0xab90('0xd')](0x1f4,_0x47e71b['message']));});});}; \ No newline at end of file +var _0xf61e=['include','map','then','ShowZohoAccount','ZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','model'];(function(_0x38a035,_0x117208){var _0x246052=function(_0x833020){while(--_0x833020){_0x38a035['push'](_0x38a035['shift']());}};_0x246052(++_0x117208);}(_0xf61e,0x191));var _0xef61=function(_0x5cbf1a,_0x52fa2e){_0x5cbf1a=_0x5cbf1a-0x0;var _0x25fc20=_0xf61e[_0x5cbf1a];return _0x25fc20;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['ZohoAccount'][_0xef61('0x18')]({'raw':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b['options'][_0xef61('0x1a')]===undefined?!![]:![]:!![],'where':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1b')]||null:null,'attributes':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1c')]||null:null,'limit':_0x22dc1b['options']?_0x22dc1b['options'][_0xef61('0x1d')]||null:null,'include':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x19')]['include']?_['map'](_0x22dc1b[_0xef61('0x19')]['include'],function(_0x53181b){return{'model':db[_0x53181b[_0xef61('0x1e')]],'as':_0x53181b['as'],'attributes':_0x53181b[_0xef61('0x1c')],'include':_0x53181b[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x53181b['include'],function(_0x16b144){return{'model':db[_0x16b144['model']],'as':_0x16b144['as'],'attributes':_0x16b144[_0xef61('0x1c')],'include':_0x16b144[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x16b144[_0xef61('0x1f')],function(_0x2155f1){return{'model':db[_0x2155f1[_0xef61('0x1e')]],'as':_0x2155f1['as'],'attributes':_0x2155f1[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef61('0x21')](function(_0x297df7){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')](_0xef61('0x17'),_0x22dc1b,JSON[_0xef61('0x12')](_0x297df7));_0x28315a(_0x297df7);})[_0xef61('0x16')](function(_0x85978){logger[_0xef61('0x13')](_0xef61('0x17'),_0x85978[_0xef61('0x15')],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x85978[_0xef61('0x15')]));});});};exports[_0xef61('0x22')]=function(_0x4f35ad){var _0x51d5d1=this;return new Promise(function(_0x38b522,_0x36713e){return db[_0xef61('0x23')]['find']({'raw':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad[_0xef61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options']['where']||null:null,'attributes':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options'][_0xef61('0x1c')]||null:null,'include':_0x4f35ad['options']?_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')]?_[_0xef61('0x20')](_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')],function(_0x1bdcb9){return{'model':db[_0x1bdcb9[_0xef61('0x1e')]],'as':_0x1bdcb9['as'],'attributes':_0x1bdcb9[_0xef61('0x1c')],'include':_0x1bdcb9[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x1bdcb9['include'],function(_0x569db6){return{'model':db[_0x569db6[_0xef61('0x1e')]],'as':_0x569db6['as'],'attributes':_0x569db6[_0xef61('0x1c')],'include':_0x569db6[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x569db6['include'],function(_0x1c38dc){return{'model':db[_0x1c38dc[_0xef61('0x1e')]],'as':_0x1c38dc['as'],'attributes':_0x1c38dc[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b97b){logger['info'](_0xef61('0x22'),_0x4f35ad);logger['debug']('ShowZohoAccount',_0x4f35ad,JSON['stringify'](_0x59b97b));_0x38b522(_0x59b97b);})[_0xef61('0x16')](function(_0x294063){logger[_0xef61('0x13')]('ShowZohoAccount',_0x294063['message'],_0x4f35ad);_0x36713e(_0x51d5d1['error'](0x1f4,_0x294063[_0xef61('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0c73ca1..cecd9cb 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 _0x508b=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x52af87,_0x3325da){var _0x33ea01=function(_0x4d83f6){while(--_0x4d83f6){_0x52af87['push'](_0x52af87['shift']());}};_0x33ea01(++_0x3325da);}(_0x508b,0x19a));var _0xb508=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0x508b[_0x112147];return _0x3ba744;};'use strict';var multer=require(_0xb508('0x0'));var util=require(_0xb508('0x1'));var path=require(_0xb508('0x2'));var timeout=require(_0xb508('0x3'));var express=require('express');var router=express[_0xb508('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb508('0x5'));var interaction=require(_0xb508('0x6'));var config=require(_0xb508('0x7'));var controller=require(_0xb508('0x8'));router[_0xb508('0x9')]('/',auth[_0xb508('0xa')](),controller[_0xb508('0xb')]);router['get'](_0xb508('0xc'),auth[_0xb508('0xa')](),controller['show']);router['get'](_0xb508('0xd'),auth[_0xb508('0xa')](),controller[_0xb508('0xe')]);router[_0xb508('0x9')](_0xb508('0xf'),auth[_0xb508('0xa')](),controller[_0xb508('0x10')]);router[_0xb508('0x9')](_0xb508('0x11'),auth[_0xb508('0xa')](),controller['getDescriptions']);router[_0xb508('0x12')]('/',auth[_0xb508('0xa')](),controller[_0xb508('0x13')]);router[_0xb508('0x14')](_0xb508('0xc'),auth['isAuthenticated'](),controller[_0xb508('0x15')]);router[_0xb508('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb508('0x17')]);module[_0xb508('0x18')]=router; \ No newline at end of file +var _0x9a36=['/:id','isAuthenticated','show','/:id/descriptions','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x9a36,0x9c));var _0x69a3=function(_0xcc7ae9,_0x246c42){_0xcc7ae9=_0xcc7ae9-0x0;var _0x47719f=_0x9a36[_0xcc7ae9];return _0x47719f;};'use strict';var multer=require(_0x69a3('0x0'));var util=require('util');var path=require(_0x69a3('0x1'));var timeout=require(_0x69a3('0x2'));var express=require(_0x69a3('0x3'));var router=express[_0x69a3('0x4')]();var fs_extra=require(_0x69a3('0x5'));var auth=require(_0x69a3('0x6'));var interaction=require(_0x69a3('0x7'));var config=require(_0x69a3('0x8'));var controller=require(_0x69a3('0x9'));router[_0x69a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x69a3('0xb')]);router[_0x69a3('0xa')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller[_0x69a3('0xe')]);router[_0x69a3('0xa')]('/:id/fields',auth[_0x69a3('0xd')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x69a3('0xa')](_0x69a3('0xf'),auth[_0x69a3('0xd')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x69a3('0x10')]);router[_0x69a3('0x11')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller['update']);router[_0x69a3('0x12')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller[_0x69a3('0x13')]);module[_0x69a3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2eef262..15ad6fd 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 _0xa9c4=['exports','STRING','nothing','lead','ENUM','contact_lead','contact','sequelize'];(function(_0x50decd,_0x2996a9){var _0x17f379=function(_0x2f72b0){while(--_0x2f72b0){_0x50decd['push'](_0x50decd['shift']());}};_0x17f379(++_0x2996a9);}(_0xa9c4,0x18f));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4a9c('0x0'));module[_0x4a9c('0x1')]={'name':{'type':Sequelize[_0x4a9c('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0x4a9c('0x3')),'defaultValue':_0x4a9c('0x4')},'moduleSearch':{'type':Sequelize[_0x4a9c('0x5')](_0x4a9c('0x6'),_0x4a9c('0x7'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3754=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead'];(function(_0x1e7e07,_0x31634a){var _0x550c35=function(_0x348706){while(--_0x348706){_0x1e7e07['push'](_0x1e7e07['shift']());}};_0x550c35(++_0x31634a);}(_0x3754,0x72));var _0x4375=function(_0x339e7d,_0x290717){_0x339e7d=_0x339e7d-0x0;var _0x2414a9=_0x3754[_0x339e7d];return _0x2414a9;};'use strict';var Sequelize=require(_0x4375('0x0'));module[_0x4375('0x1')]={'name':{'type':Sequelize[_0x4375('0x2')]},'moduleCreate':{'type':Sequelize[_0x4375('0x3')]('lead','contact','nothing'),'defaultValue':_0x4375('0x4')},'moduleSearch':{'type':Sequelize[_0x4375('0x3')](_0x4375('0x5'),_0x4375('0x6'),_0x4375('0x4')),'defaultValue':_0x4375('0x5')},'description':{'type':Sequelize[_0x4375('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0da08d1..5dee0dd 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 _0x8a73=['ejs','fs-extra','lodash','squel','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','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','ZohoConfiguration','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','getFields','ZohoField','sort','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x8a73,0xe4));var _0x38a7=function(_0x12c5ad,_0x586102){_0x12c5ad=_0x12c5ad-0x0;var _0xf7c02d=_0x8a73[_0x12c5ad];return _0xf7c02d;};'use strict';var emlformat=require(_0x38a7('0x0'));var rimraf=require(_0x38a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38a7('0x2'));var rp=require('request-promise');var moment=require(_0x38a7('0x3'));var BPromise=require(_0x38a7('0x4'));var Mustache=require('mustache');var util=require(_0x38a7('0x5'));var path=require(_0x38a7('0x6'));var sox=require(_0x38a7('0x7'));var csv=require(_0x38a7('0x8'));var ejs=require(_0x38a7('0x9'));var fs=require('fs');var fs_extra=require(_0x38a7('0xa'));var _=require(_0x38a7('0xb'));var squel=require(_0x38a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x38a7('0xd'));var deskjs=require(_0x38a7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x38a7('0xf'));var Papa=require(_0x38a7('0x10'));var Redis=require(_0x38a7('0x11'));var authService=require(_0x38a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x38a7('0x13'));var hardwareService=require(_0x38a7('0x14'));var logger=require('../../config/logger')(_0x38a7('0x15'));var utils=require(_0x38a7('0x16'));var config=require(_0x38a7('0x17'));var licenseUtil=require(_0x38a7('0x18'));var db=require(_0x38a7('0x19'))['db'];function respondWithStatusCode(_0x10ad94,_0x272980){_0x272980=_0x272980||0xcc;return function(_0x1e37ea){if(_0x1e37ea){return _0x10ad94['sendStatus'](_0x272980);}return _0x10ad94[_0x38a7('0x1a')](_0x272980)[_0x38a7('0x1b')]();};}function respondWithResult(_0xb4a79b,_0x5f12c5){_0x5f12c5=_0x5f12c5||0xc8;return function(_0x517e2d){if(_0x517e2d){return _0xb4a79b[_0x38a7('0x1a')](_0x5f12c5)[_0x38a7('0x1c')](_0x517e2d);}};}function respondWithFilteredResult(_0x4bb564,_0x23a89a){return function(_0x3b6a7f){if(_0x3b6a7f){var _0xade49e=typeof _0x23a89a[_0x38a7('0x1d')]===_0x38a7('0x1e')&&typeof _0x23a89a[_0x38a7('0x1f')]===_0x38a7('0x1e');var _0x3184bc=_0x3b6a7f[_0x38a7('0x20')];var _0x489456=_0xade49e?0x0:_0x23a89a['offset'];var _0x3b2fea=_0xade49e?_0x3b6a7f[_0x38a7('0x20')]:_0x23a89a[_0x38a7('0x1d')]+_0x23a89a[_0x38a7('0x1f')];var _0x294bb5;if(_0x3b2fea>=_0x3184bc){_0x3b2fea=_0x3184bc;_0x294bb5=0xc8;}else{_0x294bb5=0xce;}_0x4bb564[_0x38a7('0x1a')](_0x294bb5);return _0x4bb564[_0x38a7('0x21')]('Content-Range',_0x489456+'-'+_0x3b2fea+'/'+_0x3184bc)[_0x38a7('0x1c')](_0x3b6a7f);}return null;};}function patchUpdates(_0x3a2fa3){return function(_0x13f8fd){try{jsonpatch[_0x38a7('0x22')](_0x13f8fd,_0x3a2fa3,!![]);}catch(_0x3f75f0){return BPromise['reject'](_0x3f75f0);}return _0x13f8fd[_0x38a7('0x23')]();};}function saveUpdates(_0x2e0919,_0x1d3403){return function(_0x39bdc7){if(_0x39bdc7){return _0x39bdc7[_0x38a7('0x24')](_0x2e0919)[_0x38a7('0x25')](function(_0x41b654){return _0x41b654;});}return null;};}function removeEntity(_0xf9c039,_0x2e9d99){return function(_0xcdf946){if(_0xcdf946){return _0xcdf946[_0x38a7('0x26')]()[_0x38a7('0x25')](function(){_0xf9c039['status'](0xcc)[_0x38a7('0x1b')]();});}};}function handleEntityNotFound(_0x20d95d,_0x1cc275){return function(_0x44730d){if(!_0x44730d){_0x20d95d['sendStatus'](0x194);}return _0x44730d;};}function handleError(_0x267301,_0x5726b8){_0x5726b8=_0x5726b8||0x1f4;return function(_0x38ee9d){logger['error'](_0x38ee9d[_0x38a7('0x27')]);if(_0x38ee9d[_0x38a7('0x28')]){delete _0x38ee9d['name'];}_0x267301[_0x38a7('0x1a')](_0x5726b8)['send'](_0x38ee9d);};}exports[_0x38a7('0x29')]=function(_0x2c1990,_0x1cc6e4){var _0x4038d7={},_0x24173c={},_0x27df0d={'count':0x0,'rows':[]};var _0x4c0669=_[_0x38a7('0x2a')](db['ZohoConfiguration'][_0x38a7('0x2b')],function(_0x555cc1){return{'name':_0x555cc1[_0x38a7('0x2c')],'type':_0x555cc1[_0x38a7('0x2d')]['key']};});_0x24173c[_0x38a7('0x2e')]=_['map'](_0x4c0669,_0x38a7('0x28'));_0x24173c['query']=_[_0x38a7('0x2f')](_0x2c1990[_0x38a7('0x30')]);_0x24173c[_0x38a7('0x31')]=_['intersection'](_0x24173c[_0x38a7('0x2e')],_0x24173c[_0x38a7('0x30')]);_0x4038d7[_0x38a7('0x32')]=_[_0x38a7('0x33')](_0x24173c[_0x38a7('0x2e')],qs['fields'](_0x2c1990[_0x38a7('0x30')][_0x38a7('0x34')]));_0x4038d7[_0x38a7('0x32')]=_0x4038d7[_0x38a7('0x32')][_0x38a7('0x35')]?_0x4038d7[_0x38a7('0x32')]:_0x24173c[_0x38a7('0x2e')];if(!_0x2c1990[_0x38a7('0x30')][_0x38a7('0x36')]('nolimit')){_0x4038d7[_0x38a7('0x1f')]=qs['limit'](_0x2c1990['query'][_0x38a7('0x1f')]);_0x4038d7[_0x38a7('0x1d')]=qs[_0x38a7('0x1d')](_0x2c1990[_0x38a7('0x30')][_0x38a7('0x1d')]);}_0x4038d7[_0x38a7('0x37')]=qs['sort'](_0x2c1990[_0x38a7('0x30')]['sort']);_0x4038d7[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x2c1990[_0x38a7('0x30')],_0x24173c[_0x38a7('0x31')]),_0x4c0669);if(_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x4038d7[_0x38a7('0x38')]=_['merge'](_0x4038d7[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0x4c0669,function(_0x18b202){if(_0x18b202[_0x38a7('0x2d')]!=='VIRTUAL'){var _0x8bd713={};_0x8bd713[_0x18b202[_0x38a7('0x28')]]={'$like':'%'+_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x8bd713;}})});}_0x4038d7=_[_0x38a7('0x3b')]({},_0x4038d7,_0x2c1990['options']);var _0x277d7c={'where':_0x4038d7[_0x38a7('0x38')]};return db[_0x38a7('0x3c')]['count'](_0x277d7c)['then'](function(_0x12dbbe){_0x27df0d[_0x38a7('0x20')]=_0x12dbbe;if(_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3d')]){_0x4038d7[_0x38a7('0x3e')]=[{'all':!![]}];}return db[_0x38a7('0x3c')][_0x38a7('0x3f')](_0x4038d7);})[_0x38a7('0x25')](function(_0x434481){_0x27df0d[_0x38a7('0x40')]=_0x434481;return _0x27df0d;})[_0x38a7('0x25')](respondWithFilteredResult(_0x1cc6e4,_0x4038d7))['catch'](handleError(_0x1cc6e4,null));};exports[_0x38a7('0x41')]=function(_0xd8bc6f,_0x1802e7){var _0x4f1987={'raw':![],'where':{'id':_0xd8bc6f[_0x38a7('0x42')]['id']}},_0xa1ce66={};_0xa1ce66[_0x38a7('0x2e')]=_[_0x38a7('0x2f')](db[_0x38a7('0x3c')]['rawAttributes']);_0xa1ce66['query']=_[_0x38a7('0x2f')](_0xd8bc6f[_0x38a7('0x30')]);_0xa1ce66['filters']=_['intersection'](_0xa1ce66[_0x38a7('0x2e')],_0xa1ce66[_0x38a7('0x30')]);_0x4f1987['attributes']=_[_0x38a7('0x33')](_0xa1ce66['model'],qs[_0x38a7('0x34')](_0xd8bc6f[_0x38a7('0x30')][_0x38a7('0x34')]));_0x4f1987['attributes']=_0x4f1987[_0x38a7('0x32')][_0x38a7('0x35')]?_0x4f1987[_0x38a7('0x32')]:_0xa1ce66[_0x38a7('0x2e')];if(_0xd8bc6f['query'][_0x38a7('0x3d')]){_0x4f1987['include']=[{'all':!![]}];}_0x4f1987=_['merge']({},_0x4f1987,_0xd8bc6f[_0x38a7('0x43')]);return db['ZohoConfiguration'][_0x38a7('0x44')](_0x4f1987)['then'](handleEntityNotFound(_0x1802e7,null))['then'](respondWithResult(_0x1802e7,null))['catch'](handleError(_0x1802e7,null));};exports[_0x38a7('0x45')]=function(_0x34ff5e,_0x5b6b9c){return db[_0x38a7('0x3c')][_0x38a7('0x45')](_0x34ff5e[_0x38a7('0x46')],{})[_0x38a7('0x25')](respondWithResult(_0x5b6b9c,0xc9))['catch'](handleError(_0x5b6b9c,null));};exports[_0x38a7('0x24')]=function(_0x2dcfee,_0xa56f4b){if(_0x2dcfee['body']['id']){delete _0x2dcfee['body']['id'];}return db[_0x38a7('0x3c')]['find']({'where':{'id':_0x2dcfee[_0x38a7('0x42')]['id']}})['then'](handleEntityNotFound(_0xa56f4b,null))[_0x38a7('0x25')](saveUpdates(_0x2dcfee['body'],null))[_0x38a7('0x25')](respondWithResult(_0xa56f4b,null))[_0x38a7('0x47')](handleError(_0xa56f4b,null));};exports[_0x38a7('0x26')]=function(_0x3be564,_0x844e6e){return db['ZohoConfiguration'][_0x38a7('0x44')]({'where':{'id':_0x3be564[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x844e6e,null))[_0x38a7('0x25')](removeEntity(_0x844e6e,null))[_0x38a7('0x47')](handleError(_0x844e6e,null));};exports[_0x38a7('0x48')]=function(_0x140e95,_0x2d72e6,_0x38a62a){var _0x524c79={};var _0x56f939={};var _0x3b02cb;var _0x26e31b;return db[_0x38a7('0x3c')]['findOne']({'where':{'id':_0x140e95[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x2d72e6,null))[_0x38a7('0x25')](function(_0x71d74){if(_0x71d74){_0x3b02cb=_0x71d74;_0x56f939[_0x38a7('0x2e')]=_[_0x38a7('0x2f')](db[_0x38a7('0x49')][_0x38a7('0x2b')]);_0x56f939['query']=_[_0x38a7('0x2f')](_0x140e95[_0x38a7('0x30')]);_0x56f939[_0x38a7('0x31')]=_['intersection'](_0x56f939[_0x38a7('0x2e')],_0x56f939['query']);_0x524c79['attributes']=_[_0x38a7('0x33')](_0x56f939['model'],qs[_0x38a7('0x34')](_0x140e95[_0x38a7('0x30')][_0x38a7('0x34')]));_0x524c79[_0x38a7('0x32')]=_0x524c79[_0x38a7('0x32')]['length']?_0x524c79[_0x38a7('0x32')]:_0x56f939[_0x38a7('0x2e')];_0x524c79[_0x38a7('0x37')]=qs[_0x38a7('0x4a')](_0x140e95[_0x38a7('0x30')][_0x38a7('0x4a')]);_0x524c79[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x140e95[_0x38a7('0x30')],_0x56f939[_0x38a7('0x31')]));if(_0x140e95[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x524c79[_0x38a7('0x38')]=_[_0x38a7('0x3b')](_0x524c79[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0x524c79['attributes'],function(_0x5d38cf){var _0x256b9c={};_0x256b9c[_0x5d38cf]={'$like':'%'+_0x140e95[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x256b9c;})});}_0x524c79=_[_0x38a7('0x3b')]({},_0x524c79,_0x140e95[_0x38a7('0x43')]);return _0x3b02cb[_0x38a7('0x48')](_0x524c79);}})[_0x38a7('0x25')](function(_0x43aed2){if(_0x43aed2){_0x26e31b=_0x43aed2[_0x38a7('0x35')];if(!_0x140e95[_0x38a7('0x30')][_0x38a7('0x36')](_0x38a7('0x4b'))){_0x524c79[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x140e95['query'][_0x38a7('0x1f')]);_0x524c79['offset']=qs[_0x38a7('0x1d')](_0x140e95['query'][_0x38a7('0x1d')]);}return _0x3b02cb['getFields'](_0x524c79);}})[_0x38a7('0x25')](function(_0x4be296){if(_0x4be296){return _0x4be296?{'count':_0x26e31b,'rows':_0x4be296}:null;}})[_0x38a7('0x25')](respondWithResult(_0x2d72e6,null))[_0x38a7('0x47')](handleError(_0x2d72e6,null));};exports[_0x38a7('0x4c')]=function(_0x52c33b,_0x28c070,_0x561e5f){var _0x593d3a={};var _0x11cb1b={};var _0x11215b;var _0x2b2c79;return db[_0x38a7('0x3c')][_0x38a7('0x4d')]({'where':{'id':_0x52c33b[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x28c070,null))[_0x38a7('0x25')](function(_0xa16431){if(_0xa16431){_0x11215b=_0xa16431;_0x11cb1b[_0x38a7('0x2e')]=_['keys'](db['ZohoField']['rawAttributes']);_0x11cb1b[_0x38a7('0x30')]=_['keys'](_0x52c33b[_0x38a7('0x30')]);_0x11cb1b[_0x38a7('0x31')]=_[_0x38a7('0x33')](_0x11cb1b[_0x38a7('0x2e')],_0x11cb1b[_0x38a7('0x30')]);_0x593d3a[_0x38a7('0x32')]=_[_0x38a7('0x33')](_0x11cb1b['model'],qs[_0x38a7('0x34')](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x34')]));_0x593d3a[_0x38a7('0x32')]=_0x593d3a[_0x38a7('0x32')][_0x38a7('0x35')]?_0x593d3a['attributes']:_0x11cb1b[_0x38a7('0x2e')];_0x593d3a[_0x38a7('0x37')]=qs['sort'](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x4a')]);_0x593d3a[_0x38a7('0x38')]=qs['filters'](_[_0x38a7('0x39')](_0x52c33b['query'],_0x11cb1b['filters']));if(_0x52c33b[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x593d3a['where']=_['merge'](_0x593d3a[_0x38a7('0x38')],{'$or':_['map'](_0x593d3a[_0x38a7('0x32')],function(_0x247aed){var _0x5208bd={};_0x5208bd[_0x247aed]={'$like':'%'+_0x52c33b[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x5208bd;})});}_0x593d3a=_['merge']({},_0x593d3a,_0x52c33b[_0x38a7('0x43')]);return _0x11215b[_0x38a7('0x4c')](_0x593d3a);}})[_0x38a7('0x25')](function(_0xbae555){if(_0xbae555){_0x2b2c79=_0xbae555['length'];if(!_0x52c33b[_0x38a7('0x30')][_0x38a7('0x36')]('nolimit')){_0x593d3a[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x52c33b[_0x38a7('0x30')]['limit']);_0x593d3a[_0x38a7('0x1d')]=qs[_0x38a7('0x1d')](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x1d')]);}return _0x11215b[_0x38a7('0x4c')](_0x593d3a);}})[_0x38a7('0x25')](function(_0x196a50){if(_0x196a50){return _0x196a50?{'count':_0x2b2c79,'rows':_0x196a50}:null;}})[_0x38a7('0x25')](respondWithResult(_0x28c070,null))[_0x38a7('0x47')](handleError(_0x28c070,null));};exports['getDescriptions']=function(_0x3a3009,_0x2152f0,_0x4393df){var _0xc98fc4={};var _0x4cdf6a={};var _0x57520d;var _0x487850;return db[_0x38a7('0x3c')][_0x38a7('0x4d')]({'where':{'id':_0x3a3009[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x2152f0,null))[_0x38a7('0x25')](function(_0x4a2a2e){if(_0x4a2a2e){_0x57520d=_0x4a2a2e;_0x4cdf6a[_0x38a7('0x2e')]=_['keys'](db[_0x38a7('0x49')][_0x38a7('0x2b')]);_0x4cdf6a[_0x38a7('0x30')]=_[_0x38a7('0x2f')](_0x3a3009[_0x38a7('0x30')]);_0x4cdf6a[_0x38a7('0x31')]=_[_0x38a7('0x33')](_0x4cdf6a[_0x38a7('0x2e')],_0x4cdf6a[_0x38a7('0x30')]);_0xc98fc4['attributes']=_[_0x38a7('0x33')](_0x4cdf6a[_0x38a7('0x2e')],qs[_0x38a7('0x34')](_0x3a3009['query'][_0x38a7('0x34')]));_0xc98fc4[_0x38a7('0x32')]=_0xc98fc4[_0x38a7('0x32')][_0x38a7('0x35')]?_0xc98fc4[_0x38a7('0x32')]:_0x4cdf6a[_0x38a7('0x2e')];_0xc98fc4['order']=qs[_0x38a7('0x4a')](_0x3a3009[_0x38a7('0x30')][_0x38a7('0x4a')]);_0xc98fc4[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x3a3009[_0x38a7('0x30')],_0x4cdf6a[_0x38a7('0x31')]));if(_0x3a3009[_0x38a7('0x30')][_0x38a7('0x3a')]){_0xc98fc4['where']=_[_0x38a7('0x3b')](_0xc98fc4[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0xc98fc4[_0x38a7('0x32')],function(_0xc6c642){var _0x37150c={};_0x37150c[_0xc6c642]={'$like':'%'+_0x3a3009[_0x38a7('0x30')]['filter']+'%'};return _0x37150c;})});}_0xc98fc4=_[_0x38a7('0x3b')]({},_0xc98fc4,_0x3a3009[_0x38a7('0x43')]);return _0x57520d[_0x38a7('0x4e')](_0xc98fc4);}})[_0x38a7('0x25')](function(_0x3d623b){if(_0x3d623b){_0x487850=_0x3d623b[_0x38a7('0x35')];if(!_0x3a3009[_0x38a7('0x30')]['hasOwnProperty'](_0x38a7('0x4b'))){_0xc98fc4[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x3a3009[_0x38a7('0x30')]['limit']);_0xc98fc4['offset']=qs[_0x38a7('0x1d')](_0x3a3009[_0x38a7('0x30')]['offset']);}return _0x57520d['getDescriptions'](_0xc98fc4);}})[_0x38a7('0x25')](function(_0x169978){if(_0x169978){return _0x169978?{'count':_0x487850,'rows':_0x169978}:null;}})[_0x38a7('0x25')](respondWithResult(_0x2152f0,null))[_0x38a7('0x47')](handleError(_0x2152f0,null));}; \ No newline at end of file +var _0x1ec4=['json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','error','stack','name','send','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','ZohoConfiguration','include','findAll','rows','catch','show','includeAll','find','create','body','params','getFields','order','options','hasOwnProperty','nolimit','getSubjects','ZohoField','rawAttributes','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x5846b8,_0x2983a7){var _0x2c2e27=function(_0x129cc5){while(--_0x129cc5){_0x5846b8['push'](_0x5846b8['shift']());}};_0x2c2e27(++_0x2983a7);}(_0x1ec4,0xd6));var _0x41ec=function(_0x2dbfa3,_0x3c4261){_0x2dbfa3=_0x2dbfa3-0x0;var _0x1f6e73=_0x1ec4[_0x2dbfa3];return _0x1f6e73;};'use strict';var emlformat=require(_0x41ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41ec('0x1'));var jsonpatch=require(_0x41ec('0x2'));var rp=require('request-promise');var moment=require(_0x41ec('0x3'));var BPromise=require(_0x41ec('0x4'));var Mustache=require(_0x41ec('0x5'));var util=require(_0x41ec('0x6'));var path=require(_0x41ec('0x7'));var sox=require(_0x41ec('0x8'));var csv=require(_0x41ec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41ec('0xa'));var _=require(_0x41ec('0xb'));var squel=require(_0x41ec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x41ec('0xd'));var toCsv=require(_0x41ec('0x9'));var querystring=require(_0x41ec('0xe'));var Papa=require(_0x41ec('0xf'));var Redis=require(_0x41ec('0x10'));var authService=require(_0x41ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41ec('0x12'));var hardwareService=require(_0x41ec('0x13'));var logger=require('../../config/logger')(_0x41ec('0x14'));var utils=require('../../config/utils');var config=require(_0x41ec('0x15'));var licenseUtil=require(_0x41ec('0x16'));var db=require(_0x41ec('0x17'))['db'];function respondWithStatusCode(_0x3c0a76,_0x44c02a){_0x44c02a=_0x44c02a||0xcc;return function(_0x4a9c6f){if(_0x4a9c6f){return _0x3c0a76[_0x41ec('0x18')](_0x44c02a);}return _0x3c0a76['status'](_0x44c02a)[_0x41ec('0x19')]();};}function respondWithResult(_0x39e828,_0x308e7a){_0x308e7a=_0x308e7a||0xc8;return function(_0x3f6505){if(_0x3f6505){return _0x39e828['status'](_0x308e7a)[_0x41ec('0x1a')](_0x3f6505);}};}function respondWithFilteredResult(_0x3f6c8e,_0x5ec1c8){return function(_0xe3c8be){if(_0xe3c8be){var _0x2cae5b=typeof _0x5ec1c8[_0x41ec('0x1b')]===_0x41ec('0x1c')&&typeof _0x5ec1c8[_0x41ec('0x1d')]===_0x41ec('0x1c');var _0x52b3b3=_0xe3c8be[_0x41ec('0x1e')];var _0x48184c=_0x2cae5b?0x0:_0x5ec1c8[_0x41ec('0x1b')];var _0x49f143=_0x2cae5b?_0xe3c8be[_0x41ec('0x1e')]:_0x5ec1c8[_0x41ec('0x1b')]+_0x5ec1c8[_0x41ec('0x1d')];var _0x3443bf;if(_0x49f143>=_0x52b3b3){_0x49f143=_0x52b3b3;_0x3443bf=0xc8;}else{_0x3443bf=0xce;}_0x3f6c8e[_0x41ec('0x1f')](_0x3443bf);return _0x3f6c8e[_0x41ec('0x20')]('Content-Range',_0x48184c+'-'+_0x49f143+'/'+_0x52b3b3)[_0x41ec('0x1a')](_0xe3c8be);}return null;};}function patchUpdates(_0x582852){return function(_0x55c65f){try{jsonpatch[_0x41ec('0x21')](_0x55c65f,_0x582852,!![]);}catch(_0x1c7cf2){return BPromise[_0x41ec('0x22')](_0x1c7cf2);}return _0x55c65f['save']();};}function saveUpdates(_0x445a2a,_0x1bf010){return function(_0x3c260c){if(_0x3c260c){return _0x3c260c[_0x41ec('0x23')](_0x445a2a)[_0x41ec('0x24')](function(_0x2db89f){return _0x2db89f;});}return null;};}function removeEntity(_0x5e8aec,_0x558e7d){return function(_0x32fc16){if(_0x32fc16){return _0x32fc16[_0x41ec('0x25')]()[_0x41ec('0x24')](function(){_0x5e8aec['status'](0xcc)[_0x41ec('0x19')]();});}};}function handleEntityNotFound(_0x5590c7,_0x58d6fe){return function(_0x279646){if(!_0x279646){_0x5590c7[_0x41ec('0x18')](0x194);}return _0x279646;};}function handleError(_0x24cd5f,_0x370a3b){_0x370a3b=_0x370a3b||0x1f4;return function(_0x447b28){logger[_0x41ec('0x26')](_0x447b28[_0x41ec('0x27')]);if(_0x447b28[_0x41ec('0x28')]){delete _0x447b28[_0x41ec('0x28')];}_0x24cd5f[_0x41ec('0x1f')](_0x370a3b)[_0x41ec('0x29')](_0x447b28);};}exports['index']=function(_0x1b6d88,_0x5289aa){var _0x572a0f={},_0x3c020b={},_0x1ffc16={'count':0x0,'rows':[]};var _0x1451ec=_[_0x41ec('0x2a')](db['ZohoConfiguration']['rawAttributes'],function(_0xb4cb){return{'name':_0xb4cb['fieldName'],'type':_0xb4cb[_0x41ec('0x2b')][_0x41ec('0x2c')]};});_0x3c020b[_0x41ec('0x2d')]=_['map'](_0x1451ec,_0x41ec('0x28'));_0x3c020b['query']=_[_0x41ec('0x2e')](_0x1b6d88[_0x41ec('0x2f')]);_0x3c020b[_0x41ec('0x30')]=_[_0x41ec('0x31')](_0x3c020b[_0x41ec('0x2d')],_0x3c020b[_0x41ec('0x2f')]);_0x572a0f[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x3c020b[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x572a0f[_0x41ec('0x32')]=_0x572a0f['attributes'][_0x41ec('0x34')]?_0x572a0f[_0x41ec('0x32')]:_0x3c020b['model'];if(!_0x1b6d88[_0x41ec('0x2f')]['hasOwnProperty']('nolimit')){_0x572a0f[_0x41ec('0x1d')]=qs[_0x41ec('0x1d')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x1d')]);_0x572a0f['offset']=qs[_0x41ec('0x1b')](_0x1b6d88['query'][_0x41ec('0x1b')]);}_0x572a0f['order']=qs[_0x41ec('0x35')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x35')]);_0x572a0f[_0x41ec('0x36')]=qs['filters'](_[_0x41ec('0x37')](_0x1b6d88[_0x41ec('0x2f')],_0x3c020b['filters']),_0x1451ec);if(_0x1b6d88['query'][_0x41ec('0x38')]){_0x572a0f[_0x41ec('0x36')]=_[_0x41ec('0x39')](_0x572a0f['where'],{'$or':_[_0x41ec('0x2a')](_0x1451ec,function(_0x4198c4){if(_0x4198c4[_0x41ec('0x2b')]!==_0x41ec('0x3a')){var _0x5c17b1={};_0x5c17b1[_0x4198c4['name']]={'$like':'%'+_0x1b6d88[_0x41ec('0x2f')]['filter']+'%'};return _0x5c17b1;}})});}_0x572a0f=_[_0x41ec('0x39')]({},_0x572a0f,_0x1b6d88['options']);var _0x9fd6f0={'where':_0x572a0f[_0x41ec('0x36')]};return db[_0x41ec('0x3b')][_0x41ec('0x1e')](_0x9fd6f0)[_0x41ec('0x24')](function(_0xc95ad3){_0x1ffc16['count']=_0xc95ad3;if(_0x1b6d88[_0x41ec('0x2f')]['includeAll']){_0x572a0f[_0x41ec('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x41ec('0x3d')](_0x572a0f);})[_0x41ec('0x24')](function(_0x3b3fdd){_0x1ffc16[_0x41ec('0x3e')]=_0x3b3fdd;return _0x1ffc16;})['then'](respondWithFilteredResult(_0x5289aa,_0x572a0f))[_0x41ec('0x3f')](handleError(_0x5289aa,null));};exports[_0x41ec('0x40')]=function(_0x2c65ea,_0x2e9138){var _0x400304={'raw':![],'where':{'id':_0x2c65ea['params']['id']}},_0x172c6e={};_0x172c6e[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x3b')]['rawAttributes']);_0x172c6e[_0x41ec('0x2f')]=_[_0x41ec('0x2e')](_0x2c65ea[_0x41ec('0x2f')]);_0x172c6e[_0x41ec('0x30')]=_['intersection'](_0x172c6e[_0x41ec('0x2d')],_0x172c6e[_0x41ec('0x2f')]);_0x400304[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x172c6e[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x2c65ea['query'][_0x41ec('0x33')]));_0x400304['attributes']=_0x400304['attributes'][_0x41ec('0x34')]?_0x400304[_0x41ec('0x32')]:_0x172c6e[_0x41ec('0x2d')];if(_0x2c65ea[_0x41ec('0x2f')][_0x41ec('0x41')]){_0x400304['include']=[{'all':!![]}];}_0x400304=_[_0x41ec('0x39')]({},_0x400304,_0x2c65ea['options']);return db[_0x41ec('0x3b')][_0x41ec('0x42')](_0x400304)[_0x41ec('0x24')](handleEntityNotFound(_0x2e9138,null))[_0x41ec('0x24')](respondWithResult(_0x2e9138,null))[_0x41ec('0x3f')](handleError(_0x2e9138,null));};exports[_0x41ec('0x43')]=function(_0x2022c9,_0x19b326){return db[_0x41ec('0x3b')]['create'](_0x2022c9[_0x41ec('0x44')],{})[_0x41ec('0x24')](respondWithResult(_0x19b326,0xc9))[_0x41ec('0x3f')](handleError(_0x19b326,null));};exports[_0x41ec('0x23')]=function(_0x371479,_0x4f1ef5){if(_0x371479['body']['id']){delete _0x371479[_0x41ec('0x44')]['id'];}return db[_0x41ec('0x3b')][_0x41ec('0x42')]({'where':{'id':_0x371479[_0x41ec('0x45')]['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x4f1ef5,null))[_0x41ec('0x24')](saveUpdates(_0x371479['body'],null))['then'](respondWithResult(_0x4f1ef5,null))[_0x41ec('0x3f')](handleError(_0x4f1ef5,null));};exports[_0x41ec('0x25')]=function(_0x464e11,_0x5433e6){return db['ZohoConfiguration'][_0x41ec('0x42')]({'where':{'id':_0x464e11['params']['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x5433e6,null))[_0x41ec('0x24')](removeEntity(_0x5433e6,null))[_0x41ec('0x3f')](handleError(_0x5433e6,null));};exports[_0x41ec('0x46')]=function(_0x1bf3e1,_0xbea4fa,_0x5167e1){var _0x2506b2={};var _0x179426={};var _0x562e7b;var _0x292aa6;return db[_0x41ec('0x3b')]['findOne']({'where':{'id':_0x1bf3e1['params']['id']}})['then'](handleEntityNotFound(_0xbea4fa,null))[_0x41ec('0x24')](function(_0x3c3621){if(_0x3c3621){_0x562e7b=_0x3c3621;_0x179426[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db['ZohoField']['rawAttributes']);_0x179426['query']=_[_0x41ec('0x2e')](_0x1bf3e1['query']);_0x179426['filters']=_[_0x41ec('0x31')](_0x179426[_0x41ec('0x2d')],_0x179426[_0x41ec('0x2f')]);_0x2506b2[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x179426['model'],qs[_0x41ec('0x33')](_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x2506b2[_0x41ec('0x32')]=_0x2506b2[_0x41ec('0x32')][_0x41ec('0x34')]?_0x2506b2[_0x41ec('0x32')]:_0x179426[_0x41ec('0x2d')];_0x2506b2[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x1bf3e1['query'][_0x41ec('0x35')]);_0x2506b2[_0x41ec('0x36')]=qs['filters'](_['pick'](_0x1bf3e1[_0x41ec('0x2f')],_0x179426[_0x41ec('0x30')]));if(_0x1bf3e1[_0x41ec('0x2f')]['filter']){_0x2506b2['where']=_[_0x41ec('0x39')](_0x2506b2['where'],{'$or':_[_0x41ec('0x2a')](_0x2506b2['attributes'],function(_0x5d0174){var _0x5b73ed={};_0x5b73ed[_0x5d0174]={'$like':'%'+_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x38')]+'%'};return _0x5b73ed;})});}_0x2506b2=_[_0x41ec('0x39')]({},_0x2506b2,_0x1bf3e1[_0x41ec('0x48')]);return _0x562e7b[_0x41ec('0x46')](_0x2506b2);}})[_0x41ec('0x24')](function(_0x55a451){if(_0x55a451){_0x292aa6=_0x55a451[_0x41ec('0x34')];if(!_0x1bf3e1['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0x2506b2['limit']=qs[_0x41ec('0x1d')](_0x1bf3e1[_0x41ec('0x2f')]['limit']);_0x2506b2[_0x41ec('0x1b')]=qs[_0x41ec('0x1b')](_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x1b')]);}return _0x562e7b[_0x41ec('0x46')](_0x2506b2);}})['then'](function(_0x351f3e){if(_0x351f3e){return _0x351f3e?{'count':_0x292aa6,'rows':_0x351f3e}:null;}})[_0x41ec('0x24')](respondWithResult(_0xbea4fa,null))['catch'](handleError(_0xbea4fa,null));};exports[_0x41ec('0x4b')]=function(_0x451a25,_0x268bcd,_0x33a607){var _0x39c801={};var _0xa7f724={};var _0x4a36cb;var _0x3f193a;return db[_0x41ec('0x3b')]['findOne']({'where':{'id':_0x451a25[_0x41ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x268bcd,null))[_0x41ec('0x24')](function(_0x22851f){if(_0x22851f){_0x4a36cb=_0x22851f;_0xa7f724[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x4c')][_0x41ec('0x4d')]);_0xa7f724['query']=_['keys'](_0x451a25[_0x41ec('0x2f')]);_0xa7f724[_0x41ec('0x30')]=_['intersection'](_0xa7f724[_0x41ec('0x2d')],_0xa7f724[_0x41ec('0x2f')]);_0x39c801[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0xa7f724[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x39c801[_0x41ec('0x32')]=_0x39c801[_0x41ec('0x32')][_0x41ec('0x34')]?_0x39c801['attributes']:_0xa7f724[_0x41ec('0x2d')];_0x39c801[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x451a25['query']['sort']);_0x39c801[_0x41ec('0x36')]=qs[_0x41ec('0x30')](_[_0x41ec('0x37')](_0x451a25[_0x41ec('0x2f')],_0xa7f724[_0x41ec('0x30')]));if(_0x451a25[_0x41ec('0x2f')]['filter']){_0x39c801[_0x41ec('0x36')]=_[_0x41ec('0x39')](_0x39c801[_0x41ec('0x36')],{'$or':_[_0x41ec('0x2a')](_0x39c801[_0x41ec('0x32')],function(_0xfb9434){var _0x2e43de={};_0x2e43de[_0xfb9434]={'$like':'%'+_0x451a25[_0x41ec('0x2f')]['filter']+'%'};return _0x2e43de;})});}_0x39c801=_[_0x41ec('0x39')]({},_0x39c801,_0x451a25[_0x41ec('0x48')]);return _0x4a36cb[_0x41ec('0x4b')](_0x39c801);}})[_0x41ec('0x24')](function(_0x4b6e72){if(_0x4b6e72){_0x3f193a=_0x4b6e72['length'];if(!_0x451a25['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0x39c801['limit']=qs[_0x41ec('0x1d')](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x1d')]);_0x39c801[_0x41ec('0x1b')]=qs['offset'](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x1b')]);}return _0x4a36cb['getSubjects'](_0x39c801);}})[_0x41ec('0x24')](function(_0x4e1071){if(_0x4e1071){return _0x4e1071?{'count':_0x3f193a,'rows':_0x4e1071}:null;}})[_0x41ec('0x24')](respondWithResult(_0x268bcd,null))['catch'](handleError(_0x268bcd,null));};exports[_0x41ec('0x4e')]=function(_0x2be5a5,_0x29856a,_0x45d679){var _0xcd32d5={};var _0x3e37fa={};var _0x5b1780;var _0x1721ff;return db[_0x41ec('0x3b')][_0x41ec('0x4f')]({'where':{'id':_0x2be5a5[_0x41ec('0x45')]['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x29856a,null))[_0x41ec('0x24')](function(_0x1aa4b9){if(_0x1aa4b9){_0x5b1780=_0x1aa4b9;_0x3e37fa[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x4c')][_0x41ec('0x4d')]);_0x3e37fa[_0x41ec('0x2f')]=_[_0x41ec('0x2e')](_0x2be5a5['query']);_0x3e37fa[_0x41ec('0x30')]=_['intersection'](_0x3e37fa['model'],_0x3e37fa[_0x41ec('0x2f')]);_0xcd32d5[_0x41ec('0x32')]=_['intersection'](_0x3e37fa['model'],qs['fields'](_0x2be5a5[_0x41ec('0x2f')][_0x41ec('0x33')]));_0xcd32d5[_0x41ec('0x32')]=_0xcd32d5[_0x41ec('0x32')][_0x41ec('0x34')]?_0xcd32d5['attributes']:_0x3e37fa[_0x41ec('0x2d')];_0xcd32d5[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x2be5a5[_0x41ec('0x2f')]['sort']);_0xcd32d5[_0x41ec('0x36')]=qs[_0x41ec('0x30')](_['pick'](_0x2be5a5[_0x41ec('0x2f')],_0x3e37fa[_0x41ec('0x30')]));if(_0x2be5a5[_0x41ec('0x2f')]['filter']){_0xcd32d5['where']=_[_0x41ec('0x39')](_0xcd32d5[_0x41ec('0x36')],{'$or':_[_0x41ec('0x2a')](_0xcd32d5[_0x41ec('0x32')],function(_0x395a45){var _0x280eb0={};_0x280eb0[_0x395a45]={'$like':'%'+_0x2be5a5['query']['filter']+'%'};return _0x280eb0;})});}_0xcd32d5=_[_0x41ec('0x39')]({},_0xcd32d5,_0x2be5a5[_0x41ec('0x48')]);return _0x5b1780[_0x41ec('0x4e')](_0xcd32d5);}})['then'](function(_0x21fb12){if(_0x21fb12){_0x1721ff=_0x21fb12[_0x41ec('0x34')];if(!_0x2be5a5['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0xcd32d5['limit']=qs[_0x41ec('0x1d')](_0x2be5a5[_0x41ec('0x2f')]['limit']);_0xcd32d5[_0x41ec('0x1b')]=qs[_0x41ec('0x1b')](_0x2be5a5['query'][_0x41ec('0x1b')]);}return _0x5b1780[_0x41ec('0x4e')](_0xcd32d5);}})[_0x41ec('0x24')](function(_0x53efab){if(_0x53efab){return _0x53efab?{'count':_0x1721ff,'rows':_0x53efab}:null;}})['then'](respondWithResult(_0x29856a,null))['catch'](handleError(_0x29856a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bb9e665..e150bd2 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 _0xcae9=['api','bluebird','path','rimraf','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x6ca07c,_0x5cc954){var _0x32f9b7=function(_0x33ab17){while(--_0x33ab17){_0x6ca07c['push'](_0x6ca07c['shift']());}};_0x32f9b7(++_0x5cc954);}(_0xcae9,0xfa));var _0x9cae=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xcae9[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x9cae('0x0'));var util=require(_0x9cae('0x1'));var logger=require(_0x9cae('0x2'))(_0x9cae('0x3'));var moment=require('moment');var BPromise=require(_0x9cae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cae('0x5'));var rimraf=require(_0x9cae('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x9cae('0x7')]=function(_0x31ea64,_0x334329){return _0x31ea64[_0x9cae('0x8')](_0x9cae('0x9'),attributes,{'tableName':_0x9cae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc10b=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations'];(function(_0x4b903f,_0x3e3acf){var _0x47385a=function(_0x573075){while(--_0x573075){_0x4b903f['push'](_0x4b903f['shift']());}};_0x47385a(++_0x3e3acf);}(_0xc10b,0x108));var _0xbc10=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xc10b[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc10('0x0'))(_0xbc10('0x1'));var moment=require('moment');var BPromise=require(_0xbc10('0x2'));var rp=require(_0xbc10('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc10('0x4'));var attributes=require(_0xbc10('0x5'));module[_0xbc10('0x6')]=function(_0x4cd5c9,_0x3b94a0){return _0x4cd5c9['define']('ZohoConfiguration',attributes,{'tableName':_0xbc10('0x7'),'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 3e6ace6..964ef48 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 _0xe487=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x3500c3,_0x398aea){var _0x2e0c59=function(_0x18b718){while(--_0x18b718){_0x3500c3['push'](_0x3500c3['shift']());}};_0x2e0c59(++_0x398aea);}(_0xe487,0xb3));var _0x7e48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe487[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e48('0x0'));var util=require(_0x7e48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7e48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e48('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e48('0x4'));var config=require(_0x7e48('0x5'));var jayson=require(_0x7e48('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394c5b,_0xae5215,_0x25696d){return new BPromise(function(_0x59cc49,_0x3ab4e6){return client[_0x7e48('0x7')](_0x394c5b,_0x25696d)[_0x7e48('0x8')](function(_0x4a60ef){logger[_0x7e48('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0xae5215,_0x7e48('0xa'));logger[_0x7e48('0xb')](_0x7e48('0xc'),_0xae5215,_0x7e48('0xa'),JSON['stringify'](_0x4a60ef));if(_0x4a60ef[_0x7e48('0xd')]){if(_0x4a60ef['error'][_0x7e48('0xe')]===0x1f4){logger[_0x7e48('0xd')](_0x7e48('0xf'),_0xae5215,_0x4a60ef['error'][_0x7e48('0x10')]);return _0x3ab4e6(_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);}logger[_0x7e48('0xd')](_0x7e48('0xf'),_0xae5215,_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);return _0x59cc49(_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);}else{logger[_0x7e48('0x9')](_0x7e48('0xf'),_0xae5215,_0x7e48('0xa'));_0x59cc49(_0x4a60ef[_0x7e48('0x11')][_0x7e48('0x10')]);}})[_0x7e48('0x12')](function(_0x49ee67){logger[_0x7e48('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0xae5215,_0x49ee67);_0x3ab4e6(_0x49ee67);});});} \ No newline at end of file +var _0x81ce=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40bcf4,_0x33383b){var _0x2a3e25=function(_0x224e88){while(--_0x224e88){_0x40bcf4['push'](_0x40bcf4['shift']());}};_0x2a3e25(++_0x33383b);}(_0x81ce,0x11a));var _0xe81c=function(_0x366408,_0x247b31){_0x366408=_0x366408-0x0;var _0x2435ee=_0x81ce[_0x366408];return _0x2435ee;};'use strict';var _=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var moment=require('moment');var BPromise=require(_0xe81c('0x2'));var rs=require(_0xe81c('0x3'));var fs=require('fs');var Redis=require(_0xe81c('0x4'));var db=require(_0xe81c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe81c('0x6'))(_0xe81c('0x7'));var config=require(_0xe81c('0x8'));var jayson=require(_0xe81c('0x9'));var client=jayson[_0xe81c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e856,_0x509131,_0x56be04){return new BPromise(function(_0x1d6a53,_0x1f56d9){return client[_0xe81c('0xb')](_0x23e856,_0x56be04)[_0xe81c('0xc')](function(_0x35e698){logger[_0xe81c('0xd')](_0xe81c('0xe'),_0x509131,_0xe81c('0xf'));logger[_0xe81c('0x10')](_0xe81c('0x11'),_0x509131,_0xe81c('0xf'),JSON[_0xe81c('0x12')](_0x35e698));if(_0x35e698[_0xe81c('0x13')]){if(_0x35e698[_0xe81c('0x13')][_0xe81c('0x14')]===0x1f4){logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x35e698[_0xe81c('0x13')][_0xe81c('0x15')]);return _0x1f56d9(_0x35e698[_0xe81c('0x13')]['message']);}logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x35e698['error'][_0xe81c('0x15')]);return _0x1d6a53(_0x35e698['error']['message']);}else{logger[_0xe81c('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x509131,_0xe81c('0xf'));_0x1d6a53(_0x35e698[_0xe81c('0x16')][_0xe81c('0x15')]);}})['catch'](function(_0x56094e){logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x56094e);_0x1f56d9(_0x56094e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5eeb16e..340ba5a 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 _0xa830=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5212bf,_0x51d007){var _0x1c426c=function(_0x1dc20d){while(--_0x1dc20d){_0x5212bf['push'](_0x5212bf['shift']());}};_0x1c426c(++_0x51d007);}(_0xa830,0xb7));var _0x0a83=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xa830[_0x2c3255];return _0x282aba;};'use strict';var multer=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var path=require(_0x0a83('0x2'));var timeout=require(_0x0a83('0x3'));var express=require('express');var router=express[_0x0a83('0x4')]();var fs_extra=require(_0x0a83('0x5'));var auth=require(_0x0a83('0x6'));var interaction=require(_0x0a83('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x0a83('0x8')]('/',auth[_0x0a83('0x9')](),controller[_0x0a83('0xa')]);router[_0x0a83('0x8')](_0x0a83('0xb'),auth[_0x0a83('0x9')](),controller[_0x0a83('0xc')]);router['post']('/',auth[_0x0a83('0x9')](),controller['create']);router[_0x0a83('0xd')](_0x0a83('0xb'),auth[_0x0a83('0x9')](),controller[_0x0a83('0xe')]);router['delete']('/:id',auth[_0x0a83('0x9')](),controller[_0x0a83('0xf')]);module[_0x0a83('0x10')]=router; \ No newline at end of file +var _0xaa73=['update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intZohoField.controller','get','index','/:id','isAuthenticated','post','put'];(function(_0x55cd28,_0x13830a){var _0x2e6506=function(_0xcf08a1){while(--_0xcf08a1){_0x55cd28['push'](_0x55cd28['shift']());}};_0x2e6506(++_0x13830a);}(_0xaa73,0xe2));var _0x3aa7=function(_0x43f104,_0x5320cb){_0x43f104=_0x43f104-0x0;var _0x2435e4=_0xaa73[_0x43f104];return _0x2435e4;};'use strict';var multer=require(_0x3aa7('0x0'));var util=require(_0x3aa7('0x1'));var path=require(_0x3aa7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3aa7('0x3'));var router=express[_0x3aa7('0x4')]();var fs_extra=require(_0x3aa7('0x5'));var auth=require(_0x3aa7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3aa7('0x7'));router[_0x3aa7('0x8')]('/',auth['isAuthenticated'](),controller[_0x3aa7('0x9')]);router['get'](_0x3aa7('0xa'),auth[_0x3aa7('0xb')](),controller['show']);router[_0x3aa7('0xc')]('/',auth[_0x3aa7('0xb')](),controller['create']);router[_0x3aa7('0xd')]('/:id',auth[_0x3aa7('0xb')](),controller[_0x3aa7('0xe')]);router[_0x3aa7('0xf')](_0x3aa7('0xa'),auth[_0x3aa7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 9f56b25..12cf745 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 _0x47fa=['STRING','ENUM','customVariable','BOOLEAN','sequelize','string','variable','keyValue','picklist'];(function(_0x126cee,_0x218a7c){var _0x5337a2=function(_0x41b22b){while(--_0x41b22b){_0x126cee['push'](_0x126cee['shift']());}};_0x5337a2(++_0x218a7c);}(_0x47fa,0x1ea));var _0xa47f=function(_0x5ca784,_0x28bea2){_0x5ca784=_0x5ca784-0x0;var _0x5aa579=_0x47fa[_0x5ca784];return _0x5aa579;};'use strict';var Sequelize=require(_0xa47f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa47f('0x1'),_0xa47f('0x2'),'customVariable',_0xa47f('0x3'),_0xa47f('0x4')),'defaultValue':_0xa47f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa47f('0x5')]},'keyType':{'type':Sequelize[_0xa47f('0x6')](_0xa47f('0x1'),_0xa47f('0x2'),_0xa47f('0x7'))},'keyContent':{'type':Sequelize[_0xa47f('0x5')]},'idField':{'type':Sequelize[_0xa47f('0x5')]},'nameField':{'type':Sequelize[_0xa47f('0x5')]},'customField':{'type':Sequelize[_0xa47f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa47f('0x5')]}}; \ No newline at end of file +var _0xd24c=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','customVariable'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0xd24c,0x106));var _0xcd24=function(_0xda3d33,_0x19aaee){_0xda3d33=_0xda3d33-0x0;var _0x5eba77=_0xd24c[_0xda3d33];return _0x5eba77;};'use strict';var Sequelize=require(_0xcd24('0x0'));module[_0xcd24('0x1')]={'type':{'type':Sequelize[_0xcd24('0x2')](_0xcd24('0x3'),'variable','customVariable',_0xcd24('0x4'),_0xcd24('0x5')),'defaultValue':_0xcd24('0x3')},'content':{'type':Sequelize[_0xcd24('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcd24('0x2')]('string','variable',_0xcd24('0x7'))},'keyContent':{'type':Sequelize[_0xcd24('0x6')]},'idField':{'type':Sequelize[_0xcd24('0x6')]},'nameField':{'type':Sequelize[_0xcd24('0x6')]},'customField':{'type':Sequelize[_0xcd24('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd24('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ed77fa3..7d362fb 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 _0xa44c=['params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','send','index','map','ZohoField','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x3c3e20,_0x50ec3f){var _0x5e43e9=function(_0x169eec){while(--_0x169eec){_0x3c3e20['push'](_0x3c3e20['shift']());}};_0x5e43e9(++_0x50ec3f);}(_0xa44c,0x18d));var _0xca44=function(_0x59b0ba,_0x2a0c73){_0x59b0ba=_0x59b0ba-0x0;var _0x50fa2e=_0xa44c[_0x59b0ba];return _0x50fa2e;};'use strict';var emlformat=require(_0xca44('0x0'));var rimraf=require(_0xca44('0x1'));var zipdir=require(_0xca44('0x2'));var jsonpatch=require(_0xca44('0x3'));var rp=require(_0xca44('0x4'));var moment=require('moment');var BPromise=require(_0xca44('0x5'));var Mustache=require(_0xca44('0x6'));var util=require(_0xca44('0x7'));var path=require(_0xca44('0x8'));var sox=require('sox');var csv=require(_0xca44('0x9'));var ejs=require(_0xca44('0xa'));var fs=require('fs');var fs_extra=require(_0xca44('0xb'));var _=require('lodash');var squel=require(_0xca44('0xc'));var crypto=require(_0xca44('0xd'));var jsforce=require(_0xca44('0xe'));var deskjs=require(_0xca44('0xf'));var toCsv=require(_0xca44('0x9'));var querystring=require(_0xca44('0x10'));var Papa=require(_0xca44('0x11'));var Redis=require(_0xca44('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xca44('0x13'));var as=require(_0xca44('0x14'));var hardwareService=require(_0xca44('0x15'));var logger=require(_0xca44('0x16'))(_0xca44('0x17'));var utils=require(_0xca44('0x18'));var config=require(_0xca44('0x19'));var licenseUtil=require(_0xca44('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa43cfe,_0x4865c6){_0x4865c6=_0x4865c6||0xcc;return function(_0x1dc22f){if(_0x1dc22f){return _0xa43cfe[_0xca44('0x1b')](_0x4865c6);}return _0xa43cfe[_0xca44('0x1c')](_0x4865c6)['end']();};}function respondWithResult(_0x380cce,_0x4c20bd){_0x4c20bd=_0x4c20bd||0xc8;return function(_0xf00ec7){if(_0xf00ec7){return _0x380cce[_0xca44('0x1c')](_0x4c20bd)[_0xca44('0x1d')](_0xf00ec7);}};}function respondWithFilteredResult(_0x1a21a5,_0x2fcb08){return function(_0x5bb0f8){if(_0x5bb0f8){var _0x2c765b=typeof _0x2fcb08[_0xca44('0x1e')]===_0xca44('0x1f')&&typeof _0x2fcb08[_0xca44('0x20')]===_0xca44('0x1f');var _0x46221c=_0x5bb0f8[_0xca44('0x21')];var _0x53e8cc=_0x2c765b?0x0:_0x2fcb08[_0xca44('0x1e')];var _0x222f78=_0x2c765b?_0x5bb0f8['count']:_0x2fcb08[_0xca44('0x1e')]+_0x2fcb08[_0xca44('0x20')];var _0x3f5bb0;if(_0x222f78>=_0x46221c){_0x222f78=_0x46221c;_0x3f5bb0=0xc8;}else{_0x3f5bb0=0xce;}_0x1a21a5[_0xca44('0x1c')](_0x3f5bb0);return _0x1a21a5[_0xca44('0x22')]('Content-Range',_0x53e8cc+'-'+_0x222f78+'/'+_0x46221c)['json'](_0x5bb0f8);}return null;};}function patchUpdates(_0xb49965){return function(_0x48c16a){try{jsonpatch[_0xca44('0x23')](_0x48c16a,_0xb49965,!![]);}catch(_0x533781){return BPromise['reject'](_0x533781);}return _0x48c16a[_0xca44('0x24')]();};}function saveUpdates(_0x201bc3,_0x20a0ef){return function(_0x1b78c8){if(_0x1b78c8){return _0x1b78c8[_0xca44('0x25')](_0x201bc3)[_0xca44('0x26')](function(_0x4e9c95){return _0x4e9c95;});}return null;};}function removeEntity(_0x4d1da0,_0x212af5){return function(_0x18b06c){if(_0x18b06c){return _0x18b06c[_0xca44('0x27')]()[_0xca44('0x26')](function(){_0x4d1da0[_0xca44('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee0574,_0x45eb27){return function(_0x3612aa){if(!_0x3612aa){_0xee0574['sendStatus'](0x194);}return _0x3612aa;};}function handleError(_0x24a6d7,_0x412a05){_0x412a05=_0x412a05||0x1f4;return function(_0x3f8a71){logger[_0xca44('0x28')](_0x3f8a71[_0xca44('0x29')]);if(_0x3f8a71['name']){delete _0x3f8a71['name'];}_0x24a6d7[_0xca44('0x1c')](_0x412a05)[_0xca44('0x2a')](_0x3f8a71);};}exports[_0xca44('0x2b')]=function(_0x3b3e12,_0xb8a63a){var _0x3513c6={},_0x4d5fad={},_0x1e25dd={'count':0x0,'rows':[]};var _0x89dc66=_[_0xca44('0x2c')](db[_0xca44('0x2d')]['rawAttributes'],function(_0x3e995c){return{'name':_0x3e995c[_0xca44('0x2e')],'type':_0x3e995c[_0xca44('0x2f')][_0xca44('0x30')]};});_0x4d5fad['model']=_[_0xca44('0x2c')](_0x89dc66,_0xca44('0x31'));_0x4d5fad[_0xca44('0x32')]=_[_0xca44('0x33')](_0x3b3e12[_0xca44('0x32')]);_0x4d5fad[_0xca44('0x34')]=_[_0xca44('0x35')](_0x4d5fad[_0xca44('0x36')],_0x4d5fad[_0xca44('0x32')]);_0x3513c6[_0xca44('0x37')]=_[_0xca44('0x35')](_0x4d5fad['model'],qs[_0xca44('0x38')](_0x3b3e12['query']['fields']));_0x3513c6['attributes']=_0x3513c6['attributes']['length']?_0x3513c6[_0xca44('0x37')]:_0x4d5fad[_0xca44('0x36')];if(!_0x3b3e12[_0xca44('0x32')]['hasOwnProperty'](_0xca44('0x39'))){_0x3513c6[_0xca44('0x20')]=qs[_0xca44('0x20')](_0x3b3e12[_0xca44('0x32')]['limit']);_0x3513c6[_0xca44('0x1e')]=qs[_0xca44('0x1e')](_0x3b3e12[_0xca44('0x32')][_0xca44('0x1e')]);}_0x3513c6[_0xca44('0x3a')]=qs[_0xca44('0x3b')](_0x3b3e12[_0xca44('0x32')][_0xca44('0x3b')]);_0x3513c6['where']=qs['filters'](_[_0xca44('0x3c')](_0x3b3e12[_0xca44('0x32')],_0x4d5fad[_0xca44('0x34')]),_0x89dc66);if(_0x3b3e12[_0xca44('0x32')][_0xca44('0x3d')]){_0x3513c6['where']=_[_0xca44('0x3e')](_0x3513c6[_0xca44('0x3f')],{'$or':_[_0xca44('0x2c')](_0x89dc66,function(_0x2d7d24){if(_0x2d7d24[_0xca44('0x2f')]!==_0xca44('0x40')){var _0x4aa32a={};_0x4aa32a[_0x2d7d24[_0xca44('0x31')]]={'$like':'%'+_0x3b3e12[_0xca44('0x32')][_0xca44('0x3d')]+'%'};return _0x4aa32a;}})});}_0x3513c6=_[_0xca44('0x3e')]({},_0x3513c6,_0x3b3e12[_0xca44('0x41')]);var _0x53fdbe={'where':_0x3513c6[_0xca44('0x3f')]};return db['ZohoField'][_0xca44('0x21')](_0x53fdbe)[_0xca44('0x26')](function(_0x163ed1){_0x1e25dd['count']=_0x163ed1;if(_0x3b3e12[_0xca44('0x32')][_0xca44('0x42')]){_0x3513c6[_0xca44('0x43')]=[{'all':!![]}];}return db[_0xca44('0x2d')][_0xca44('0x44')](_0x3513c6);})[_0xca44('0x26')](function(_0x22d2d3){_0x1e25dd[_0xca44('0x45')]=_0x22d2d3;return _0x1e25dd;})[_0xca44('0x26')](respondWithFilteredResult(_0xb8a63a,_0x3513c6))['catch'](handleError(_0xb8a63a,null));};exports[_0xca44('0x46')]=function(_0x3502b2,_0x2cf6b4){var _0x3b3f44={'raw':!![],'where':{'id':_0x3502b2[_0xca44('0x47')]['id']}},_0x2de870={};_0x2de870['model']=_[_0xca44('0x33')](db['ZohoField'][_0xca44('0x48')]);_0x2de870[_0xca44('0x32')]=_[_0xca44('0x33')](_0x3502b2[_0xca44('0x32')]);_0x2de870[_0xca44('0x34')]=_['intersection'](_0x2de870[_0xca44('0x36')],_0x2de870[_0xca44('0x32')]);_0x3b3f44[_0xca44('0x37')]=_[_0xca44('0x35')](_0x2de870[_0xca44('0x36')],qs[_0xca44('0x38')](_0x3502b2[_0xca44('0x32')]['fields']));_0x3b3f44['attributes']=_0x3b3f44[_0xca44('0x37')][_0xca44('0x49')]?_0x3b3f44[_0xca44('0x37')]:_0x2de870[_0xca44('0x36')];if(_0x3502b2[_0xca44('0x32')]['includeAll']){_0x3b3f44[_0xca44('0x43')]=[{'all':!![]}];}_0x3b3f44=_[_0xca44('0x3e')]({},_0x3b3f44,_0x3502b2['options']);return db['ZohoField'][_0xca44('0x4a')](_0x3b3f44)[_0xca44('0x26')](handleEntityNotFound(_0x2cf6b4,null))[_0xca44('0x26')](respondWithResult(_0x2cf6b4,null))[_0xca44('0x4b')](handleError(_0x2cf6b4,null));};exports[_0xca44('0x4c')]=function(_0x43092b,_0x2ba788){return db['ZohoField'][_0xca44('0x4c')](_0x43092b[_0xca44('0x4d')],{})[_0xca44('0x26')](respondWithResult(_0x2ba788,0xc9))[_0xca44('0x4b')](handleError(_0x2ba788,null));};exports[_0xca44('0x25')]=function(_0x8e77ac,_0x1964ec){if(_0x8e77ac[_0xca44('0x4d')]['id']){delete _0x8e77ac[_0xca44('0x4d')]['id'];}return db['ZohoField'][_0xca44('0x4a')]({'where':{'id':_0x8e77ac[_0xca44('0x47')]['id']}})['then'](handleEntityNotFound(_0x1964ec,null))[_0xca44('0x26')](saveUpdates(_0x8e77ac[_0xca44('0x4d')],null))[_0xca44('0x26')](respondWithResult(_0x1964ec,null))['catch'](handleError(_0x1964ec,null));};exports[_0xca44('0x27')]=function(_0x150332,_0x5908dd){return db['ZohoField'][_0xca44('0x4a')]({'where':{'id':_0x150332[_0xca44('0x47')]['id']}})[_0xca44('0x26')](handleEntityNotFound(_0x5908dd,null))['then'](removeEntity(_0x5908dd,null))[_0xca44('0x4b')](handleError(_0x5908dd,null));}; \ No newline at end of file +var _0x1f0b=['error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','sendStatus'];(function(_0x242cb9,_0x1ef332){var _0x58737f=function(_0x6bf943){while(--_0x6bf943){_0x242cb9['push'](_0x242cb9['shift']());}};_0x58737f(++_0x1ef332);}(_0x1f0b,0x100));var _0xb1f0=function(_0x4a1b3c,_0x20aa97){_0x4a1b3c=_0x4a1b3c-0x0;var _0xe314d7=_0x1f0b[_0x4a1b3c];return _0xe314d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f0('0x0'));var zipdir=require(_0xb1f0('0x1'));var jsonpatch=require(_0xb1f0('0x2'));var rp=require(_0xb1f0('0x3'));var moment=require(_0xb1f0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1f0('0x5'));var util=require(_0xb1f0('0x6'));var path=require('path');var sox=require(_0xb1f0('0x7'));var csv=require(_0xb1f0('0x8'));var ejs=require(_0xb1f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1f0('0xa'));var squel=require('squel');var crypto=require(_0xb1f0('0xb'));var jsforce=require(_0xb1f0('0xc'));var deskjs=require(_0xb1f0('0xd'));var toCsv=require(_0xb1f0('0x8'));var querystring=require(_0xb1f0('0xe'));var Papa=require('papaparse');var Redis=require(_0xb1f0('0xf'));var authService=require(_0xb1f0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb1f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1f0('0x12'))(_0xb1f0('0x13'));var utils=require(_0xb1f0('0x14'));var config=require(_0xb1f0('0x15'));var licenseUtil=require(_0xb1f0('0x16'));var db=require(_0xb1f0('0x17'))['db'];function respondWithStatusCode(_0x3f7a3c,_0x3bc9dd){_0x3bc9dd=_0x3bc9dd||0xcc;return function(_0x25e8d1){if(_0x25e8d1){return _0x3f7a3c['sendStatus'](_0x3bc9dd);}return _0x3f7a3c[_0xb1f0('0x18')](_0x3bc9dd)['end']();};}function respondWithResult(_0x52c46f,_0x5f0362){_0x5f0362=_0x5f0362||0xc8;return function(_0x516e04){if(_0x516e04){return _0x52c46f[_0xb1f0('0x18')](_0x5f0362)[_0xb1f0('0x19')](_0x516e04);}};}function respondWithFilteredResult(_0x3f4b2f,_0x45140a){return function(_0x4f2180){if(_0x4f2180){var _0xfc2271=typeof _0x45140a[_0xb1f0('0x1a')]===_0xb1f0('0x1b')&&typeof _0x45140a[_0xb1f0('0x1c')]===_0xb1f0('0x1b');var _0x2a41a0=_0x4f2180['count'];var _0x851c0c=_0xfc2271?0x0:_0x45140a[_0xb1f0('0x1a')];var _0x39f687=_0xfc2271?_0x4f2180[_0xb1f0('0x1d')]:_0x45140a[_0xb1f0('0x1a')]+_0x45140a[_0xb1f0('0x1c')];var _0x42d31b;if(_0x39f687>=_0x2a41a0){_0x39f687=_0x2a41a0;_0x42d31b=0xc8;}else{_0x42d31b=0xce;}_0x3f4b2f[_0xb1f0('0x18')](_0x42d31b);return _0x3f4b2f['set'](_0xb1f0('0x1e'),_0x851c0c+'-'+_0x39f687+'/'+_0x2a41a0)[_0xb1f0('0x19')](_0x4f2180);}return null;};}function patchUpdates(_0x20bc21){return function(_0x1b4477){try{jsonpatch[_0xb1f0('0x1f')](_0x1b4477,_0x20bc21,!![]);}catch(_0x5bb3c3){return BPromise[_0xb1f0('0x20')](_0x5bb3c3);}return _0x1b4477['save']();};}function saveUpdates(_0x49a8f3,_0x447493){return function(_0x1218f1){if(_0x1218f1){return _0x1218f1['update'](_0x49a8f3)['then'](function(_0x47899e){return _0x47899e;});}return null;};}function removeEntity(_0x2be2fe,_0xafaefc){return function(_0x402309){if(_0x402309){return _0x402309[_0xb1f0('0x21')]()[_0xb1f0('0x22')](function(){_0x2be2fe[_0xb1f0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5707da,_0x3b0dc5){return function(_0x2f12d0){if(!_0x2f12d0){_0x5707da[_0xb1f0('0x23')](0x194);}return _0x2f12d0;};}function handleError(_0xbb9169,_0x12e06f){_0x12e06f=_0x12e06f||0x1f4;return function(_0x2c6c71){logger[_0xb1f0('0x24')](_0x2c6c71[_0xb1f0('0x25')]);if(_0x2c6c71['name']){delete _0x2c6c71[_0xb1f0('0x26')];}_0xbb9169['status'](_0x12e06f)[_0xb1f0('0x27')](_0x2c6c71);};}exports[_0xb1f0('0x28')]=function(_0x2b224c,_0x268671){var _0x2a8b58={},_0x2c989e={},_0x4c309a={'count':0x0,'rows':[]};var _0x3dc4e8=_[_0xb1f0('0x29')](db[_0xb1f0('0x2a')][_0xb1f0('0x2b')],function(_0x268998){return{'name':_0x268998[_0xb1f0('0x2c')],'type':_0x268998[_0xb1f0('0x2d')][_0xb1f0('0x2e')]};});_0x2c989e[_0xb1f0('0x2f')]=_['map'](_0x3dc4e8,_0xb1f0('0x26'));_0x2c989e[_0xb1f0('0x30')]=_['keys'](_0x2b224c[_0xb1f0('0x30')]);_0x2c989e[_0xb1f0('0x31')]=_[_0xb1f0('0x32')](_0x2c989e[_0xb1f0('0x2f')],_0x2c989e[_0xb1f0('0x30')]);_0x2a8b58['attributes']=_[_0xb1f0('0x32')](_0x2c989e['model'],qs['fields'](_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x33')]));_0x2a8b58[_0xb1f0('0x34')]=_0x2a8b58['attributes'][_0xb1f0('0x35')]?_0x2a8b58[_0xb1f0('0x34')]:_0x2c989e[_0xb1f0('0x2f')];if(!_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x36')](_0xb1f0('0x37'))){_0x2a8b58[_0xb1f0('0x1c')]=qs[_0xb1f0('0x1c')](_0x2b224c[_0xb1f0('0x30')]['limit']);_0x2a8b58[_0xb1f0('0x1a')]=qs[_0xb1f0('0x1a')](_0x2b224c['query'][_0xb1f0('0x1a')]);}_0x2a8b58['order']=qs[_0xb1f0('0x38')](_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x38')]);_0x2a8b58[_0xb1f0('0x39')]=qs[_0xb1f0('0x31')](_[_0xb1f0('0x3a')](_0x2b224c[_0xb1f0('0x30')],_0x2c989e[_0xb1f0('0x31')]),_0x3dc4e8);if(_0x2b224c['query'][_0xb1f0('0x3b')]){_0x2a8b58[_0xb1f0('0x39')]=_[_0xb1f0('0x3c')](_0x2a8b58[_0xb1f0('0x39')],{'$or':_[_0xb1f0('0x29')](_0x3dc4e8,function(_0x32bacc){if(_0x32bacc[_0xb1f0('0x2d')]!=='VIRTUAL'){var _0x5b8beb={};_0x5b8beb[_0x32bacc['name']]={'$like':'%'+_0x2b224c['query'][_0xb1f0('0x3b')]+'%'};return _0x5b8beb;}})});}_0x2a8b58=_[_0xb1f0('0x3c')]({},_0x2a8b58,_0x2b224c[_0xb1f0('0x3d')]);var _0x31f01b={'where':_0x2a8b58['where']};return db[_0xb1f0('0x2a')][_0xb1f0('0x1d')](_0x31f01b)[_0xb1f0('0x22')](function(_0x39fc50){_0x4c309a['count']=_0x39fc50;if(_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x3e')]){_0x2a8b58[_0xb1f0('0x3f')]=[{'all':!![]}];}return db[_0xb1f0('0x2a')][_0xb1f0('0x40')](_0x2a8b58);})[_0xb1f0('0x22')](function(_0x2ba6fc){_0x4c309a[_0xb1f0('0x41')]=_0x2ba6fc;return _0x4c309a;})[_0xb1f0('0x22')](respondWithFilteredResult(_0x268671,_0x2a8b58))[_0xb1f0('0x42')](handleError(_0x268671,null));};exports['show']=function(_0x5dce81,_0x33b3da){var _0x1b5042={'raw':!![],'where':{'id':_0x5dce81[_0xb1f0('0x43')]['id']}},_0x2b5af5={};_0x2b5af5['model']=_[_0xb1f0('0x44')](db['ZohoField'][_0xb1f0('0x2b')]);_0x2b5af5[_0xb1f0('0x30')]=_['keys'](_0x5dce81[_0xb1f0('0x30')]);_0x2b5af5[_0xb1f0('0x31')]=_[_0xb1f0('0x32')](_0x2b5af5['model'],_0x2b5af5[_0xb1f0('0x30')]);_0x1b5042[_0xb1f0('0x34')]=_[_0xb1f0('0x32')](_0x2b5af5[_0xb1f0('0x2f')],qs[_0xb1f0('0x33')](_0x5dce81['query'][_0xb1f0('0x33')]));_0x1b5042[_0xb1f0('0x34')]=_0x1b5042[_0xb1f0('0x34')]['length']?_0x1b5042[_0xb1f0('0x34')]:_0x2b5af5[_0xb1f0('0x2f')];if(_0x5dce81['query'][_0xb1f0('0x3e')]){_0x1b5042['include']=[{'all':!![]}];}_0x1b5042=_[_0xb1f0('0x3c')]({},_0x1b5042,_0x5dce81[_0xb1f0('0x3d')]);return db[_0xb1f0('0x2a')][_0xb1f0('0x45')](_0x1b5042)[_0xb1f0('0x22')](handleEntityNotFound(_0x33b3da,null))[_0xb1f0('0x22')](respondWithResult(_0x33b3da,null))['catch'](handleError(_0x33b3da,null));};exports[_0xb1f0('0x46')]=function(_0x2d76c3,_0x43159b){return db[_0xb1f0('0x2a')][_0xb1f0('0x46')](_0x2d76c3[_0xb1f0('0x47')],{})[_0xb1f0('0x22')](respondWithResult(_0x43159b,0xc9))['catch'](handleError(_0x43159b,null));};exports[_0xb1f0('0x48')]=function(_0x208a9f,_0x32e883){if(_0x208a9f[_0xb1f0('0x47')]['id']){delete _0x208a9f[_0xb1f0('0x47')]['id'];}return db[_0xb1f0('0x2a')][_0xb1f0('0x45')]({'where':{'id':_0x208a9f[_0xb1f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x32e883,null))[_0xb1f0('0x22')](saveUpdates(_0x208a9f[_0xb1f0('0x47')],null))['then'](respondWithResult(_0x32e883,null))[_0xb1f0('0x42')](handleError(_0x32e883,null));};exports[_0xb1f0('0x21')]=function(_0x6f7a6d,_0x6e9b92){return db['ZohoField'][_0xb1f0('0x45')]({'where':{'id':_0x6f7a6d[_0xb1f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x6e9b92,null))[_0xb1f0('0x22')](removeEntity(_0x6e9b92,null))[_0xb1f0('0x42')](handleError(_0x6e9b92,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7c2ca41..236c713 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 _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intZohoField.attributes','define','ZohoField','zoho_unique_index','idField','lodash'];(function(_0xa39eb6,_0x54efa2){var _0x130015=function(_0x482304){while(--_0x482304){_0xa39eb6['push'](_0xa39eb6['shift']());}};_0x130015(++_0x54efa2);}(_0x583c,0x12b));var _0xc583=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x583c[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc583('0xa'),'fields':[_0xc583('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaf2=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x124e0f,_0x474f63){var _0x54c56b=function(_0xf57d3e){while(--_0xf57d3e){_0x124e0f['push'](_0x124e0f['shift']());}};_0x54c56b(++_0x474f63);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0xcaf2[_0x2dd628];return _0x2e138c;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'paranoid':![],'indexes':[{'name':_0x2caf('0xb'),'fields':['idField',_0x2caf('0xc')],'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 291edae..bb97fc2 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 _0xe176=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xe176,0x69));var _0x6e17=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xe176[_0x333798];return _0x389f4e;};'use strict';var _=require(_0x6e17('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6e17('0x1'));var rs=require(_0x6e17('0x2'));var fs=require('fs');var Redis=require(_0x6e17('0x3'));var db=require(_0x6e17('0x4'))['db'];var utils=require(_0x6e17('0x5'));var logger=require(_0x6e17('0x6'))(_0x6e17('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e17('0x8'));var client=jayson[_0x6e17('0x9')][_0x6e17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x319d3a,_0x165cb2,_0x4a24c1){return new BPromise(function(_0x2f1bc4,_0x3bf14a){return client[_0x6e17('0xb')](_0x319d3a,_0x4a24c1)[_0x6e17('0xc')](function(_0x538636){logger[_0x6e17('0xd')](_0x6e17('0xe'),_0x165cb2,_0x6e17('0xf'));logger[_0x6e17('0x10')](_0x6e17('0x11'),_0x165cb2,'request\x20sent',JSON[_0x6e17('0x12')](_0x538636));if(_0x538636[_0x6e17('0x13')]){if(_0x538636['error']['code']===0x1f4){logger[_0x6e17('0x13')](_0x6e17('0xe'),_0x165cb2,_0x538636[_0x6e17('0x13')][_0x6e17('0x14')]);return _0x3bf14a(_0x538636[_0x6e17('0x13')][_0x6e17('0x14')]);}logger['error'](_0x6e17('0xe'),_0x165cb2,_0x538636['error'][_0x6e17('0x14')]);return _0x2f1bc4(_0x538636[_0x6e17('0x13')]['message']);}else{logger[_0x6e17('0xd')](_0x6e17('0xe'),_0x165cb2,_0x6e17('0xf'));_0x2f1bc4(_0x538636['result'][_0x6e17('0x14')]);}})[_0x6e17('0x15')](function(_0x104e08){logger[_0x6e17('0x13')](_0x6e17('0xe'),_0x165cb2,_0x104e08);_0x3bf14a(_0x104e08);});});} \ No newline at end of file +var _0x403f=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x34d9d6,_0x181fbe){var _0x307d84=function(_0x538ea4){while(--_0x538ea4){_0x34d9d6['push'](_0x34d9d6['shift']());}};_0x307d84(++_0x181fbe);}(_0x403f,0xe3));var _0xf403=function(_0x2ea601,_0x4c3eaf){_0x2ea601=_0x2ea601-0x0;var _0x24b31c=_0x403f[_0x2ea601];return _0x24b31c;};'use strict';var _=require(_0xf403('0x0'));var util=require(_0xf403('0x1'));var moment=require('moment');var BPromise=require(_0xf403('0x2'));var rs=require(_0xf403('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf403('0x4'))['db'];var utils=require(_0xf403('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf403('0x6'));var jayson=require(_0xf403('0x7'));var client=jayson[_0xf403('0x8')][_0xf403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15b7af,_0xce5740,_0x47a34d){return new BPromise(function(_0x489415,_0x3270eb){return client[_0xf403('0xa')](_0x15b7af,_0x47a34d)['then'](function(_0x4fc5dc){logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));logger['debug'](_0xf403('0xe'),_0xce5740,_0xf403('0xd'),JSON[_0xf403('0xf')](_0x4fc5dc));if(_0x4fc5dc['error']){if(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x11')]===0x1f4){logger[_0xf403('0x10')]('ZohoField,\x20%s,\x20%s',_0xce5740,_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);return _0x3270eb(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}logger['error'](_0xf403('0xc'),_0xce5740,_0x4fc5dc[_0xf403('0x10')]['message']);return _0x489415(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}else{logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));_0x489415(_0x4fc5dc[_0xf403('0x13')][_0xf403('0x12')]);}})[_0xf403('0x14')](function(_0x27745b){logger[_0xf403('0x10')](_0xf403('0xc'),_0xce5740,_0x27745b);_0x3270eb(_0x27745b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d4274b1..7f18e1c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x33ef8f,_0x559e8e){var _0x164226=function(_0x11691d){while(--_0x11691d){_0x33ef8f['push'](_0x33ef8f['shift']());}};_0x164226(++_0x559e8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4dec26,_0x1357ce){var _0x23a93a=function(_0xbb67f9){while(--_0xbb67f9){_0x4dec26['push'](_0x4dec26['shift']());}};_0x23a93a(++_0x1357ce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b9f1e4e..250d548 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 _0xe3db=['sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe3db,0xc8));var _0xbe3d=function(_0x1c18b8,_0x205298){_0x1c18b8=_0x1c18b8-0x0;var _0x9f6e8=_0xe3db[_0x1c18b8];return _0x9f6e8;};'use strict';var Sequelize=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbe3d('0x2')},'version':{'type':Sequelize[_0xbe3d('0x3')],'allowNull':![],'unique':_0xbe3d('0x2')},'main':{'type':Sequelize[_0xbe3d('0x3')],'defaultValue':_0xbe3d('0x4')},'filename':{'type':Sequelize[_0xbe3d('0x3')]},'path':{'type':Sequelize[_0xbe3d('0x3')]},'type':{'type':Sequelize[_0xbe3d('0x3')]},'size':{'type':Sequelize[_0xbe3d('0x5')]},'active':{'type':Sequelize[_0xbe3d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xbe3d('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xbe3d('0x3')],'unique':_0xbe3d('0x7')},'description':{'type':Sequelize[_0xbe3d('0x3')]},'title':{'type':Sequelize[_0xbe3d('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xbe3d('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf3f9=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x430795,_0x35d23d){var _0x2c5a86=function(_0x1e7eed){while(--_0x1e7eed){_0x430795['push'](_0x430795['shift']());}};_0x2c5a86(++_0x35d23d);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x1736bf,_0x21ff3b){_0x1736bf=_0x1736bf-0x0;var _0x9cc7b3=_0xf3f9[_0x1736bf];return _0x9cc7b3;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f3f('0x1')],'allowNull':![],'unique':_0x9f3f('0x2')},'version':{'type':Sequelize[_0x9f3f('0x1')],'allowNull':![],'unique':_0x9f3f('0x2')},'main':{'type':Sequelize[_0x9f3f('0x1')],'defaultValue':_0x9f3f('0x3')},'filename':{'type':Sequelize[_0x9f3f('0x1')]},'path':{'type':Sequelize[_0x9f3f('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x9f3f('0x4')]},'active':{'type':Sequelize[_0x9f3f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9f3f('0x1')]},'logo':{'type':Sequelize[_0x9f3f('0x1')]},'state':{'type':Sequelize[_0x9f3f('0x1')],'unique':_0x9f3f('0x6')},'description':{'type':Sequelize[_0x9f3f('0x1')]},'title':{'type':Sequelize[_0x9f3f('0x1')]},'remoteUri':{'type':Sequelize[_0x9f3f('0x1')]},'link':{'type':Sequelize[_0x9f3f('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6fc4d0d..c4209a4 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 _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2a07,0x74));var _0x72a0=function(_0x576d5b,_0x1b8b7b){_0x576d5b=_0x576d5b-0x0;var _0x5b1f5e=_0x2a07[_0x576d5b];return _0x5b1f5e;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x5496,0x175));var _0x6549=function(_0x449a76,_0x5eff44){_0x449a76=_0x449a76-0x0;var _0x26c604=_0x5496[_0x449a76];return _0x26c604;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a8a3034..1a1f0aa 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 _0x342d=['Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define'];(function(_0x16795f,_0x533662){var _0x328f13=function(_0x5b8e28){while(--_0x5b8e28){_0x16795f['push'](_0x16795f['shift']());}};_0x328f13(++_0x533662);}(_0x342d,0x144));var _0xd342=function(_0x1f3b9d,_0x487f0e){_0x1f3b9d=_0x1f3b9d-0x0;var _0x4440fc=_0x342d[_0x1f3b9d];return _0x4440fc;};'use strict';var _=require(_0xd342('0x0'));var util=require(_0xd342('0x1'));var logger=require(_0xd342('0x2'))(_0xd342('0x3'));var moment=require(_0xd342('0x4'));var BPromise=require(_0xd342('0x5'));var rp=require(_0xd342('0x6'));var fs=require('fs');var path=require(_0xd342('0x7'));var rimraf=require(_0xd342('0x8'));var config=require('../../config/environment');var attributes=require(_0xd342('0x9'));module[_0xd342('0xa')]=function(_0x90618b,_0x27928d){return _0x90618b[_0xd342('0xb')](_0xd342('0xc'),attributes,{'tableName':_0xd342('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf47=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf47,0x175));var _0x7cf4=function(_0x4e5a73,_0xb07f56){_0x4e5a73=_0x4e5a73-0x0;var _0x548c2d=_0xcf47[_0x4e5a73];return _0x548c2d;};'use strict';var _=require('lodash');var util=require(_0x7cf4('0x0'));var logger=require(_0x7cf4('0x1'))(_0x7cf4('0x2'));var moment=require('moment');var BPromise=require(_0x7cf4('0x3'));var rp=require(_0x7cf4('0x4'));var fs=require('fs');var path=require(_0x7cf4('0x5'));var rimraf=require('rimraf');var config=require(_0x7cf4('0x6'));var attributes=require(_0x7cf4('0x7'));module[_0x7cf4('0x8')]=function(_0x57ad4f,_0x1262b6){return _0x57ad4f[_0x7cf4('0x9')](_0x7cf4('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a5761c4..01776d2 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x13c8f6,_0x2cd8db){var _0x233878=function(_0xfac740){while(--_0xfac740){_0x13c8f6['push'](_0x13c8f6['shift']());}};_0x233878(++_0x2cd8db);}(_0x66fa,0x117));var _0xa66f=function(_0x2f25b3,_0x254ccd){_0x2f25b3=_0x2f25b3-0x0;var _0x2d0c41=_0x66fa[_0x2f25b3];return _0x2d0c41;};'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')]('Integration,\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')]('Integration,\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);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2baa28,_0x30ea5e){var _0x909465=function(_0xebc686){while(--_0xebc686){_0x2baa28['push'](_0x2baa28['shift']());}};_0x909465(++_0x30ea5e);}(_0x57ca,0x108));var _0xa57c=function(_0x2f145c,_0x1667ae){_0x2f145c=_0x2f145c-0x0;var _0x54f781=_0x57ca[_0x2f145c];return _0x54f781;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e901a4b..6aca91e 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0xb9fa7d,_0x124334){var _0xb96b2=function(_0x5c6dbd){while(--_0x5c6dbd){_0xb9fa7d['push'](_0xb9fa7d['shift']());}};_0xb96b2(++_0x124334);}(_0x2542,0x169));var _0x2254=function(_0x32b78e,_0x2e665c){_0x32b78e=_0x32b78e-0x0;var _0x5ac668=_0x2542[_0x32b78e];return _0x5ac668;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1fcae9,_0x4ae6f8){_0x1fcae9=_0x1fcae9-0x0;var _0x400596=_0x9f0e[_0x1fcae9];return _0x400596;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index dca11b9..0b0239b 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 _0x2ac1=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x158cdc,_0x4cd428){var _0x32fe85=function(_0x5da864){while(--_0x5da864){_0x158cdc['push'](_0x158cdc['shift']());}};_0x32fe85(++_0x4cd428);}(_0x2ac1,0x7a));var _0x12ac=function(_0x11c72b,_0x8ca977){_0x11c72b=_0x11c72b-0x0;var _0x488f26=_0x2ac1[_0x11c72b];return _0x488f26;};'use strict';var Sequelize=require(_0x12ac('0x0'));module['exports']={'integration':{'type':Sequelize[_0x12ac('0x1')]},'eventChannel':{'type':Sequelize[_0x12ac('0x1')]},'exitStatus':{'type':Sequelize[_0x12ac('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x12ac('0x2')]},'contacts':{'type':Sequelize[_0x12ac('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x12ac('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x12ac('0x1')]},'membername':{'type':Sequelize[_0x12ac('0x1')]},'agentcalledAt':{'type':Sequelize[_0x12ac('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x12ac('0x2')]},'agentcomplete':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x12ac('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x12ac('0x2')]},'reason':{'type':Sequelize[_0x12ac('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x12ac('0x3')]},'agentdump':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x12ac('0x1')]},'channel':{'type':Sequelize[_0x12ac('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x12ac('0x1')]},'connectedlinenum':{'type':Sequelize[_0x12ac('0x1')]},'connectedlinename':{'type':Sequelize[_0x12ac('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x12ac('0x1')]},'context':{'type':Sequelize[_0x12ac('0x1')]},'exten':{'type':Sequelize[_0x12ac('0x1')]},'priority':{'type':Sequelize[_0x12ac('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x12ac('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x12ac('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x12ac('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x12ac('0x1')]},'destcontext':{'type':Sequelize[_0x12ac('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x12ac('0x1')]},'destuniqueid':{'type':Sequelize[_0x12ac('0x1')]},'messageId':{'type':Sequelize[_0x12ac('0x1')]},'inReplyTo':{'type':Sequelize[_0x12ac('0x1')]},'subject':{'type':Sequelize[_0x12ac('0x1')]},'from':{'type':Sequelize[_0x12ac('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x12ac('0x1')]},'attachment':{'type':Sequelize[_0x12ac('0x5')]},'html':{'type':Sequelize[_0x12ac('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x12ac('0x6')](_0x12ac('0x7'),_0x12ac('0x8'),_0x12ac('0x9'),_0x12ac('0xa'))},'url':{'type':Sequelize[_0x12ac('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x12ac('0x1')]},'projectId':{'type':Sequelize[_0x12ac('0x2')]}}; \ No newline at end of file +var _0x7552=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x20191f,_0x23ad69){var _0x4d0294=function(_0x48b127){while(--_0x48b127){_0x20191f['push'](_0x20191f['shift']());}};_0x4d0294(++_0x23ad69);}(_0x7552,0xe4));var _0x2755=function(_0x399a4f,_0x28d3f8){_0x399a4f=_0x399a4f-0x0;var _0x806c48=_0x7552[_0x399a4f];return _0x806c48;};'use strict';var Sequelize=require(_0x2755('0x0'));module[_0x2755('0x1')]={'integration':{'type':Sequelize[_0x2755('0x2')]},'eventChannel':{'type':Sequelize[_0x2755('0x2')]},'exitStatus':{'type':Sequelize[_0x2755('0x2')]},'ticketId':{'type':Sequelize[_0x2755('0x2')]},'integrationId':{'type':Sequelize[_0x2755('0x3')]},'contacts':{'type':Sequelize[_0x2755('0x2')]},'uniqueid':{'type':Sequelize[_0x2755('0x2')]},'calleridnum':{'type':Sequelize[_0x2755('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2755('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2755('0x3')]},'agentcomplete':{'type':Sequelize[_0x2755('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2755('0x4')]},'talktime':{'type':Sequelize[_0x2755('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2755('0x3')]},'reason':{'type':Sequelize[_0x2755('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2755('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2755('0x4')]},'lastevent':{'type':Sequelize[_0x2755('0x2')]},'channel':{'type':Sequelize[_0x2755('0x2')]},'channelstate':{'type':Sequelize[_0x2755('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2755('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2755('0x2')]},'connectedlinename':{'type':Sequelize[_0x2755('0x2')]},'language':{'type':Sequelize[_0x2755('0x2')]},'accountcode':{'type':Sequelize[_0x2755('0x2')]},'context':{'type':Sequelize[_0x2755('0x2')]},'exten':{'type':Sequelize[_0x2755('0x2')]},'priority':{'type':Sequelize[_0x2755('0x2')]},'destchannel':{'type':Sequelize[_0x2755('0x2')]},'destchannelstate':{'type':Sequelize[_0x2755('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2755('0x2')]},'destcalleridname':{'type':Sequelize[_0x2755('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2755('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2755('0x2')]},'destaccountcode':{'type':Sequelize[_0x2755('0x2')]},'destcontext':{'type':Sequelize[_0x2755('0x2')]},'destexten':{'type':Sequelize[_0x2755('0x2')]},'destpriority':{'type':Sequelize[_0x2755('0x2')]},'destuniqueid':{'type':Sequelize[_0x2755('0x2')]},'messageId':{'type':Sequelize[_0x2755('0x2')]},'inReplyTo':{'type':Sequelize[_0x2755('0x2')]},'subject':{'type':Sequelize[_0x2755('0x2')]},'from':{'type':Sequelize[_0x2755('0x2')]},'to':{'type':Sequelize[_0x2755('0x2')]},'cc':{'type':Sequelize[_0x2755('0x2')]},'attachment':{'type':Sequelize[_0x2755('0x6')]},'html':{'type':Sequelize[_0x2755('0x6')]},'text':{'type':Sequelize[_0x2755('0x6')]},'status':{'type':Sequelize[_0x2755('0x7')]('SENT',_0x2755('0x8'),_0x2755('0x9'),_0x2755('0xa'))},'url':{'type':Sequelize[_0x2755('0x2')]},'app':{'type':Sequelize[_0x2755('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x2755('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b9dd03a..36cf274 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 _0xadc9=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','sendStatus','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','IntegrationReport','then','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x368113,_0x244119){var _0x475e26=function(_0x301a02){while(--_0x301a02){_0x368113['push'](_0x368113['shift']());}};_0x475e26(++_0x244119);}(_0xadc9,0x111));var _0x9adc=function(_0x5a530d,_0x1f6d75){_0x5a530d=_0x5a530d-0x0;var _0x9476d9=_0xadc9[_0x5a530d];return _0x9476d9;};'use strict';var emlformat=require(_0x9adc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9adc('0x1'));var rp=require(_0x9adc('0x2'));var moment=require(_0x9adc('0x3'));var BPromise=require(_0x9adc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9adc('0x5'));var sox=require(_0x9adc('0x6'));var csv=require(_0x9adc('0x7'));var ejs=require(_0x9adc('0x8'));var fs=require('fs');var fs_extra=require(_0x9adc('0x9'));var _=require('lodash');var squel=require(_0x9adc('0xa'));var crypto=require('crypto');var jsforce=require(_0x9adc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9adc('0xc'));var Papa=require('papaparse');var Redis=require(_0x9adc('0xd'));var authService=require(_0x9adc('0xe'));var qs=require(_0x9adc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9adc('0x10'));var logger=require(_0x9adc('0x11'))('api');var utils=require(_0x9adc('0x12'));var config=require(_0x9adc('0x13'));var licenseUtil=require(_0x9adc('0x14'));var db=require(_0x9adc('0x15'))['db'];function respondWithStatusCode(_0x117ca1,_0x3d0fc2){_0x3d0fc2=_0x3d0fc2||0xcc;return function(_0x3fbd90){if(_0x3fbd90){return _0x117ca1['sendStatus'](_0x3d0fc2);}return _0x117ca1['status'](_0x3d0fc2)['end']();};}function respondWithResult(_0x4387be,_0x185a7b){_0x185a7b=_0x185a7b||0xc8;return function(_0x364928){if(_0x364928){return _0x4387be[_0x9adc('0x16')](_0x185a7b)['json'](_0x364928);}};}function respondWithFilteredResult(_0x2c4846,_0x3619d2){return function(_0x25840b){if(_0x25840b){var _0x18e357=typeof _0x3619d2[_0x9adc('0x17')]===_0x9adc('0x18')&&typeof _0x3619d2[_0x9adc('0x19')]===_0x9adc('0x18');var _0x5d380b=_0x25840b[_0x9adc('0x1a')];var _0x48fbc8=_0x18e357?0x0:_0x3619d2[_0x9adc('0x17')];var _0x35f6e7=_0x18e357?_0x25840b[_0x9adc('0x1a')]:_0x3619d2['offset']+_0x3619d2[_0x9adc('0x19')];var _0x232133;if(_0x35f6e7>=_0x5d380b){_0x35f6e7=_0x5d380b;_0x232133=0xc8;}else{_0x232133=0xce;}_0x2c4846['status'](_0x232133);return _0x2c4846[_0x9adc('0x1b')](_0x9adc('0x1c'),_0x48fbc8+'-'+_0x35f6e7+'/'+_0x5d380b)['json'](_0x25840b);}return null;};}function patchUpdates(_0x33b7ea){return function(_0x49fc2c){try{jsonpatch[_0x9adc('0x1d')](_0x49fc2c,_0x33b7ea,!![]);}catch(_0x58aa6e){return BPromise[_0x9adc('0x1e')](_0x58aa6e);}return _0x49fc2c['save']();};}function saveUpdates(_0x26b12f,_0x2aa0c8){return function(_0xb1334a){if(_0xb1334a){return _0xb1334a['update'](_0x26b12f)['then'](function(_0x306461){return _0x306461;});}return null;};}function removeEntity(_0x28aa70,_0x12d0e0){return function(_0x399a70){if(_0x399a70){return _0x399a70[_0x9adc('0x1f')]()['then'](function(){_0x28aa70[_0x9adc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea0df,_0x45db54){return function(_0x1ff372){if(!_0x1ff372){_0x3ea0df[_0x9adc('0x20')](0x194);}return _0x1ff372;};}function handleError(_0x3b9def,_0x55838f){_0x55838f=_0x55838f||0x1f4;return function(_0x32c1e2){logger[_0x9adc('0x21')](_0x32c1e2[_0x9adc('0x22')]);if(_0x32c1e2[_0x9adc('0x23')]){delete _0x32c1e2['name'];}_0x3b9def[_0x9adc('0x16')](_0x55838f)[_0x9adc('0x24')](_0x32c1e2);};}exports[_0x9adc('0x25')]=function(_0xe3d9e,_0x26c713){var _0x4913e3={},_0x5e9870={},_0x5c5c4a={'count':0x0,'rows':[]};var _0x2537ed=_[_0x9adc('0x26')](db['IntegrationReport']['rawAttributes'],function(_0x3fe0bf){return{'name':_0x3fe0bf['fieldName'],'type':_0x3fe0bf[_0x9adc('0x27')][_0x9adc('0x28')]};});_0x5e9870[_0x9adc('0x29')]=_['map'](_0x2537ed,_0x9adc('0x23'));_0x5e9870[_0x9adc('0x2a')]=_['keys'](_0xe3d9e[_0x9adc('0x2a')]);_0x5e9870[_0x9adc('0x2b')]=_[_0x9adc('0x2c')](_0x5e9870[_0x9adc('0x29')],_0x5e9870['query']);_0x4913e3[_0x9adc('0x2d')]=_['intersection'](_0x5e9870['model'],qs[_0x9adc('0x2e')](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x2e')]));_0x4913e3[_0x9adc('0x2d')]=_0x4913e3[_0x9adc('0x2d')][_0x9adc('0x2f')]?_0x4913e3[_0x9adc('0x2d')]:_0x5e9870[_0x9adc('0x29')];if(!_0xe3d9e[_0x9adc('0x2a')]['hasOwnProperty'](_0x9adc('0x30'))){_0x4913e3['limit']=qs[_0x9adc('0x19')](_0xe3d9e['query'][_0x9adc('0x19')]);_0x4913e3[_0x9adc('0x17')]=qs[_0x9adc('0x17')](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x17')]);}_0x4913e3[_0x9adc('0x31')]=qs['sort'](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x32')]);_0x4913e3[_0x9adc('0x33')]=qs[_0x9adc('0x2b')](_['pick'](_0xe3d9e[_0x9adc('0x2a')],_0x5e9870[_0x9adc('0x2b')]),_0x2537ed);if(_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x34')]){_0x4913e3[_0x9adc('0x33')]=_[_0x9adc('0x35')](_0x4913e3[_0x9adc('0x33')],{'$or':_[_0x9adc('0x26')](_0x2537ed,function(_0x8933a6){if(_0x8933a6[_0x9adc('0x27')]!==_0x9adc('0x36')){var _0x3a6cfa={};_0x3a6cfa[_0x8933a6[_0x9adc('0x23')]]={'$like':'%'+_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x34')]+'%'};return _0x3a6cfa;}})});}_0x4913e3=_[_0x9adc('0x35')]({},_0x4913e3,_0xe3d9e['options']);var _0xc2151={'where':_0x4913e3['where']};return db[_0x9adc('0x37')][_0x9adc('0x1a')](_0xc2151)[_0x9adc('0x38')](function(_0x14fd38){_0x5c5c4a['count']=_0x14fd38;if(_0xe3d9e['query'][_0x9adc('0x39')]){_0x4913e3['include']=[{'all':!![]}];}return db[_0x9adc('0x37')][_0x9adc('0x3a')](_0x4913e3);})[_0x9adc('0x38')](function(_0xdd5965){_0x5c5c4a[_0x9adc('0x3b')]=_0xdd5965;return _0x5c5c4a;})['then'](respondWithFilteredResult(_0x26c713,_0x4913e3))[_0x9adc('0x3c')](handleError(_0x26c713,null));};exports[_0x9adc('0x3d')]=function(_0xe8bd19,_0x59ea6b){var _0x52f8cc={'raw':![],'where':{'id':_0xe8bd19[_0x9adc('0x3e')]['id']}},_0x3c858b={};_0x3c858b[_0x9adc('0x29')]=_[_0x9adc('0x3f')](db[_0x9adc('0x37')][_0x9adc('0x40')]);_0x3c858b[_0x9adc('0x2a')]=_[_0x9adc('0x3f')](_0xe8bd19['query']);_0x3c858b[_0x9adc('0x2b')]=_[_0x9adc('0x2c')](_0x3c858b[_0x9adc('0x29')],_0x3c858b[_0x9adc('0x2a')]);_0x52f8cc['attributes']=_[_0x9adc('0x2c')](_0x3c858b[_0x9adc('0x29')],qs['fields'](_0xe8bd19[_0x9adc('0x2a')][_0x9adc('0x2e')]));_0x52f8cc[_0x9adc('0x2d')]=_0x52f8cc['attributes'][_0x9adc('0x2f')]?_0x52f8cc[_0x9adc('0x2d')]:_0x3c858b[_0x9adc('0x29')];if(_0xe8bd19[_0x9adc('0x2a')][_0x9adc('0x39')]){_0x52f8cc[_0x9adc('0x41')]=[{'all':!![]}];}_0x52f8cc=_['merge']({},_0x52f8cc,_0xe8bd19[_0x9adc('0x42')]);return db['IntegrationReport'][_0x9adc('0x43')](_0x52f8cc)[_0x9adc('0x38')](handleEntityNotFound(_0x59ea6b,null))[_0x9adc('0x38')](respondWithResult(_0x59ea6b,null))[_0x9adc('0x3c')](handleError(_0x59ea6b,null));};exports['create']=function(_0x2e97bd,_0x4e6600){return db[_0x9adc('0x37')][_0x9adc('0x44')](_0x2e97bd[_0x9adc('0x45')],{})['then'](respondWithResult(_0x4e6600,0xc9))['catch'](handleError(_0x4e6600,null));};exports[_0x9adc('0x46')]=function(_0x31baeb,_0x1526b3){if(_0x31baeb[_0x9adc('0x45')]['id']){delete _0x31baeb[_0x9adc('0x45')]['id'];}return db['IntegrationReport'][_0x9adc('0x43')]({'where':{'id':_0x31baeb[_0x9adc('0x3e')]['id']}})[_0x9adc('0x38')](handleEntityNotFound(_0x1526b3,null))[_0x9adc('0x38')](saveUpdates(_0x31baeb[_0x9adc('0x45')],null))[_0x9adc('0x38')](respondWithResult(_0x1526b3,null))[_0x9adc('0x3c')](handleError(_0x1526b3,null));};exports[_0x9adc('0x1f')]=function(_0x24989f,_0x2b0c02){return db[_0x9adc('0x37')][_0x9adc('0x43')]({'where':{'id':_0x24989f[_0x9adc('0x3e')]['id']}})[_0x9adc('0x38')](handleEntityNotFound(_0x2b0c02,null))[_0x9adc('0x38')](removeEntity(_0x2b0c02,null))['catch'](handleError(_0x2b0c02,null));};exports[_0x9adc('0x47')]=function(_0x456367,_0x2e83af){return db[_0x9adc('0x37')]['describe']()['then'](respondWithResult(_0x2e83af,null))['catch'](handleError(_0x2e83af,null));}; \ No newline at end of file +var _0xa32e=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','update','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa32e,0x95));var _0xea32=function(_0xaf326d,_0xc3a37c){_0xaf326d=_0xaf326d-0x0;var _0x4aacda=_0xa32e[_0xaf326d];return _0x4aacda;};'use strict';var emlformat=require(_0xea32('0x0'));var rimraf=require(_0xea32('0x1'));var zipdir=require(_0xea32('0x2'));var jsonpatch=require(_0xea32('0x3'));var rp=require(_0xea32('0x4'));var moment=require(_0xea32('0x5'));var BPromise=require(_0xea32('0x6'));var Mustache=require(_0xea32('0x7'));var util=require(_0xea32('0x8'));var path=require(_0xea32('0x9'));var sox=require(_0xea32('0xa'));var csv=require(_0xea32('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea32('0xc'));var _=require(_0xea32('0xd'));var squel=require(_0xea32('0xe'));var crypto=require(_0xea32('0xf'));var jsforce=require(_0xea32('0x10'));var deskjs=require(_0xea32('0x11'));var toCsv=require(_0xea32('0xb'));var querystring=require(_0xea32('0x12'));var Papa=require(_0xea32('0x13'));var Redis=require(_0xea32('0x14'));var authService=require(_0xea32('0x15'));var qs=require(_0xea32('0x16'));var as=require(_0xea32('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea32('0x18'));var utils=require(_0xea32('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xea32('0x1a'));var db=require(_0xea32('0x1b'))['db'];function respondWithStatusCode(_0x2229f3,_0x1c0ebb){_0x1c0ebb=_0x1c0ebb||0xcc;return function(_0x5f1aae){if(_0x5f1aae){return _0x2229f3['sendStatus'](_0x1c0ebb);}return _0x2229f3[_0xea32('0x1c')](_0x1c0ebb)[_0xea32('0x1d')]();};}function respondWithResult(_0x58200a,_0x1bf3eb){_0x1bf3eb=_0x1bf3eb||0xc8;return function(_0x59006d){if(_0x59006d){return _0x58200a[_0xea32('0x1c')](_0x1bf3eb)[_0xea32('0x1e')](_0x59006d);}};}function respondWithFilteredResult(_0x180b9e,_0x4f9fb7){return function(_0x2e52f0){if(_0x2e52f0){var _0x397385=typeof _0x4f9fb7[_0xea32('0x1f')]===_0xea32('0x20')&&typeof _0x4f9fb7[_0xea32('0x21')]==='undefined';var _0x4ea20e=_0x2e52f0[_0xea32('0x22')];var _0x248ba4=_0x397385?0x0:_0x4f9fb7[_0xea32('0x1f')];var _0x3d1b63=_0x397385?_0x2e52f0['count']:_0x4f9fb7[_0xea32('0x1f')]+_0x4f9fb7['limit'];var _0x1b1fc5;if(_0x3d1b63>=_0x4ea20e){_0x3d1b63=_0x4ea20e;_0x1b1fc5=0xc8;}else{_0x1b1fc5=0xce;}_0x180b9e['status'](_0x1b1fc5);return _0x180b9e[_0xea32('0x23')](_0xea32('0x24'),_0x248ba4+'-'+_0x3d1b63+'/'+_0x4ea20e)[_0xea32('0x1e')](_0x2e52f0);}return null;};}function patchUpdates(_0x2ba5bb){return function(_0x2af315){try{jsonpatch[_0xea32('0x25')](_0x2af315,_0x2ba5bb,!![]);}catch(_0x1cca36){return BPromise[_0xea32('0x26')](_0x1cca36);}return _0x2af315[_0xea32('0x27')]();};}function saveUpdates(_0xcfc2c,_0x2fd430){return function(_0x433315){if(_0x433315){return _0x433315['update'](_0xcfc2c)[_0xea32('0x28')](function(_0x51f1f1){return _0x51f1f1;});}return null;};}function removeEntity(_0x4d9890,_0x49a2fa){return function(_0x3a08c7){if(_0x3a08c7){return _0x3a08c7['destroy']()[_0xea32('0x28')](function(){_0x4d9890[_0xea32('0x1c')](0xcc)[_0xea32('0x1d')]();});}};}function handleEntityNotFound(_0x388d39,_0x114bf1){return function(_0x348442){if(!_0x348442){_0x388d39[_0xea32('0x29')](0x194);}return _0x348442;};}function handleError(_0xdac2da,_0x44c0ab){_0x44c0ab=_0x44c0ab||0x1f4;return function(_0x51ad89){logger[_0xea32('0x2a')](_0x51ad89[_0xea32('0x2b')]);if(_0x51ad89[_0xea32('0x2c')]){delete _0x51ad89[_0xea32('0x2c')];}_0xdac2da[_0xea32('0x1c')](_0x44c0ab)['send'](_0x51ad89);};}exports['index']=function(_0x3e8cc8,_0x162df6){var _0x39fb12={},_0x235efe={},_0x1b4c58={'count':0x0,'rows':[]};var _0x41023d=_[_0xea32('0x2d')](db[_0xea32('0x2e')][_0xea32('0x2f')],function(_0x584e3e){return{'name':_0x584e3e[_0xea32('0x30')],'type':_0x584e3e[_0xea32('0x31')][_0xea32('0x32')]};});_0x235efe[_0xea32('0x33')]=_[_0xea32('0x2d')](_0x41023d,_0xea32('0x2c'));_0x235efe[_0xea32('0x34')]=_[_0xea32('0x35')](_0x3e8cc8['query']);_0x235efe['filters']=_[_0xea32('0x36')](_0x235efe[_0xea32('0x33')],_0x235efe['query']);_0x39fb12[_0xea32('0x37')]=_[_0xea32('0x36')](_0x235efe['model'],qs[_0xea32('0x38')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x38')]));_0x39fb12[_0xea32('0x37')]=_0x39fb12[_0xea32('0x37')]['length']?_0x39fb12['attributes']:_0x235efe[_0xea32('0x33')];if(!_0x3e8cc8[_0xea32('0x34')]['hasOwnProperty']('nolimit')){_0x39fb12['limit']=qs[_0xea32('0x21')](_0x3e8cc8['query']['limit']);_0x39fb12[_0xea32('0x1f')]=qs[_0xea32('0x1f')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x1f')]);}_0x39fb12[_0xea32('0x39')]=qs[_0xea32('0x3a')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x3a')]);_0x39fb12[_0xea32('0x3b')]=qs[_0xea32('0x3c')](_[_0xea32('0x3d')](_0x3e8cc8[_0xea32('0x34')],_0x235efe[_0xea32('0x3c')]),_0x41023d);if(_0x3e8cc8[_0xea32('0x34')]['filter']){_0x39fb12[_0xea32('0x3b')]=_['merge'](_0x39fb12[_0xea32('0x3b')],{'$or':_[_0xea32('0x2d')](_0x41023d,function(_0x20c096){if(_0x20c096[_0xea32('0x31')]!==_0xea32('0x3e')){var _0x18ac44={};_0x18ac44[_0x20c096[_0xea32('0x2c')]]={'$like':'%'+_0x3e8cc8[_0xea32('0x34')][_0xea32('0x3f')]+'%'};return _0x18ac44;}})});}_0x39fb12=_[_0xea32('0x40')]({},_0x39fb12,_0x3e8cc8[_0xea32('0x41')]);var _0x5f4409={'where':_0x39fb12[_0xea32('0x3b')]};return db[_0xea32('0x2e')][_0xea32('0x22')](_0x5f4409)[_0xea32('0x28')](function(_0x1cbf27){_0x1b4c58['count']=_0x1cbf27;if(_0x3e8cc8[_0xea32('0x34')][_0xea32('0x42')]){_0x39fb12['include']=[{'all':!![]}];}return db[_0xea32('0x2e')][_0xea32('0x43')](_0x39fb12);})[_0xea32('0x28')](function(_0x3c61eb){_0x1b4c58[_0xea32('0x44')]=_0x3c61eb;return _0x1b4c58;})[_0xea32('0x28')](respondWithFilteredResult(_0x162df6,_0x39fb12))[_0xea32('0x45')](handleError(_0x162df6,null));};exports[_0xea32('0x46')]=function(_0x5e792e,_0x3a82e6){var _0x4d5f35={'raw':![],'where':{'id':_0x5e792e[_0xea32('0x47')]['id']}},_0x2726bc={};_0x2726bc['model']=_[_0xea32('0x35')](db[_0xea32('0x2e')][_0xea32('0x2f')]);_0x2726bc[_0xea32('0x34')]=_['keys'](_0x5e792e['query']);_0x2726bc[_0xea32('0x3c')]=_[_0xea32('0x36')](_0x2726bc[_0xea32('0x33')],_0x2726bc[_0xea32('0x34')]);_0x4d5f35[_0xea32('0x37')]=_[_0xea32('0x36')](_0x2726bc[_0xea32('0x33')],qs[_0xea32('0x38')](_0x5e792e[_0xea32('0x34')]['fields']));_0x4d5f35[_0xea32('0x37')]=_0x4d5f35['attributes'][_0xea32('0x48')]?_0x4d5f35[_0xea32('0x37')]:_0x2726bc['model'];if(_0x5e792e['query'][_0xea32('0x42')]){_0x4d5f35[_0xea32('0x49')]=[{'all':!![]}];}_0x4d5f35=_[_0xea32('0x40')]({},_0x4d5f35,_0x5e792e[_0xea32('0x41')]);return db[_0xea32('0x2e')]['find'](_0x4d5f35)[_0xea32('0x28')](handleEntityNotFound(_0x3a82e6,null))[_0xea32('0x28')](respondWithResult(_0x3a82e6,null))[_0xea32('0x45')](handleError(_0x3a82e6,null));};exports[_0xea32('0x4a')]=function(_0x2c82fa,_0x334d84){return db[_0xea32('0x2e')][_0xea32('0x4a')](_0x2c82fa[_0xea32('0x4b')],{})[_0xea32('0x28')](respondWithResult(_0x334d84,0xc9))[_0xea32('0x45')](handleError(_0x334d84,null));};exports[_0xea32('0x4c')]=function(_0x4df22f,_0x3028d3){if(_0x4df22f[_0xea32('0x4b')]['id']){delete _0x4df22f[_0xea32('0x4b')]['id'];}return db['IntegrationReport'][_0xea32('0x4d')]({'where':{'id':_0x4df22f['params']['id']}})[_0xea32('0x28')](handleEntityNotFound(_0x3028d3,null))[_0xea32('0x28')](saveUpdates(_0x4df22f[_0xea32('0x4b')],null))[_0xea32('0x28')](respondWithResult(_0x3028d3,null))[_0xea32('0x45')](handleError(_0x3028d3,null));};exports[_0xea32('0x4e')]=function(_0x366268,_0x491ff0){return db['IntegrationReport'][_0xea32('0x4d')]({'where':{'id':_0x366268[_0xea32('0x47')]['id']}})[_0xea32('0x28')](handleEntityNotFound(_0x491ff0,null))[_0xea32('0x28')](removeEntity(_0x491ff0,null))[_0xea32('0x45')](handleError(_0x491ff0,null));};exports[_0xea32('0x4f')]=function(_0x52ae9a,_0x1ba86c){return db[_0xea32('0x2e')][_0xea32('0x4f')]()['then'](respondWithResult(_0x1ba86c,null))['catch'](handleError(_0x1ba86c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 846b848..7c44d9c 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 _0x19b5=['path','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x19b5,0x66));var _0x519b=function(_0x2f2310,_0x18f54e){_0x2f2310=_0x2f2310-0x0;var _0x2fbb39=_0x19b5[_0x2f2310];return _0x2fbb39;};'use strict';var _=require(_0x519b('0x0'));var util=require(_0x519b('0x1'));var logger=require(_0x519b('0x2'))('api');var moment=require(_0x519b('0x3'));var BPromise=require(_0x519b('0x4'));var rp=require(_0x519b('0x5'));var fs=require('fs');var path=require(_0x519b('0x6'));var rimraf=require(_0x519b('0x7'));var config=require(_0x519b('0x8'));var attributes=require('./integrationReport.attributes');module[_0x519b('0x9')]=function(_0x3c374e,_0x1ee6d9){return _0x3c374e['define'](_0x519b('0xa'),attributes,{'tableName':_0x519b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x568f=['report_integration','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x3db82,_0xc56e5b){var _0x1e21cf=function(_0x16202c){while(--_0x16202c){_0x3db82['push'](_0x3db82['shift']());}};_0x1e21cf(++_0xc56e5b);}(_0x568f,0x187));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf568('0x0'));var logger=require(_0xf568('0x1'))(_0xf568('0x2'));var moment=require('moment');var BPromise=require(_0xf568('0x3'));var rp=require(_0xf568('0x4'));var fs=require('fs');var path=require(_0xf568('0x5'));var rimraf=require(_0xf568('0x6'));var config=require(_0xf568('0x7'));var attributes=require(_0xf568('0x8'));module[_0xf568('0x9')]=function(_0x2ed43f,_0x54ef7d){return _0x2ed43f[_0xf568('0xa')](_0xf568('0xb'),attributes,{'tableName':_0xf568('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 cb930df..66c7ab9 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x687b,0x14a));var _0xb687=function(_0x31db02,_0x330986){_0x31db02=_0x31db02-0x0;var _0x1b2e55=_0x687b[_0x31db02];return _0x1b2e55;};'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});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xf494,0x1c6));var _0x4f49=function(_0x2c8823,_0xf4e892){_0x2c8823=_0x2c8823-0x0;var _0x2ea1a4=_0xf494[_0x2c8823];return _0x2ea1a4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 21406ca..1365fa4 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 _0x237b=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3ff749,_0x574a33){var _0x4e1683=function(_0x50c1ea){while(--_0x50c1ea){_0x3ff749['push'](_0x3ff749['shift']());}};_0x4e1683(++_0x574a33);}(_0x237b,0x1a7));var _0xb237=function(_0xa4a005,_0x1053f0){_0xa4a005=_0xa4a005-0x0;var _0x38d3f5=_0x237b[_0xa4a005];return _0x38d3f5;};'use strict';var multer=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var path=require(_0xb237('0x2'));var timeout=require(_0xb237('0x3'));var express=require('express');var router=express[_0xb237('0x4')]();var fs_extra=require(_0xb237('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb237('0x6'));var config=require(_0xb237('0x7'));var controller=require(_0xb237('0x8'));router[_0xb237('0x9')]('/',auth['isAuthenticated'](),controller[_0xb237('0xa')]);router[_0xb237('0x9')]('/:id',auth[_0xb237('0xb')](),controller['show']);router[_0xb237('0x9')](_0xb237('0xc'),auth[_0xb237('0xb')](),controller[_0xb237('0xd')]);router[_0xb237('0xe')]('/',auth[_0xb237('0xb')](),controller[_0xb237('0xf')]);router['post'](_0xb237('0xc'),auth[_0xb237('0xb')](),controller[_0xb237('0x10')]);router[_0xb237('0xe')](_0xb237('0x11'),auth[_0xb237('0xb')](),controller[_0xb237('0x12')]);router[_0xb237('0x13')](_0xb237('0x14'),auth[_0xb237('0xb')](),controller[_0xb237('0x15')]);router[_0xb237('0x16')]('/:id',auth[_0xb237('0xb')](),controller[_0xb237('0x17')]);module[_0xb237('0x18')]=router; \ No newline at end of file +var _0x7e4b=['/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index'];(function(_0x4d0f1c,_0x314943){var _0x33a5ec=function(_0x5bed1b){while(--_0x5bed1b){_0x4d0f1c['push'](_0x4d0f1c['shift']());}};_0x33a5ec(++_0x314943);}(_0x7e4b,0x84));var _0xb7e4=function(_0x2ea378,_0x44d2f1){_0x2ea378=_0x2ea378-0x0;var _0x490513=_0x7e4b[_0x2ea378];return _0x490513;};'use strict';var multer=require(_0xb7e4('0x0'));var util=require(_0xb7e4('0x1'));var path=require('path');var timeout=require(_0xb7e4('0x2'));var express=require(_0xb7e4('0x3'));var router=express['Router']();var fs_extra=require(_0xb7e4('0x4'));var auth=require(_0xb7e4('0x5'));var interaction=require(_0xb7e4('0x6'));var config=require(_0xb7e4('0x7'));var controller=require(_0xb7e4('0x8'));router[_0xb7e4('0x9')]('/',auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xb')]);router[_0xb7e4('0x9')]('/:id',auth[_0xb7e4('0xa')](),controller['show']);router[_0xb7e4('0x9')](_0xb7e4('0xc'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xd')]);router[_0xb7e4('0xe')]('/',auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xf')]);router[_0xb7e4('0xe')](_0xb7e4('0xc'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0x10')]);router[_0xb7e4('0xe')](_0xb7e4('0x11'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xb7e4('0x12')](_0xb7e4('0x13'),auth['isAuthenticated'](),controller[_0xb7e4('0x14')]);router[_0xb7e4('0x15')](_0xb7e4('0x13'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0x16')]);module[_0xb7e4('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 09d4550..55b8712 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 _0x57cf=['STRING','sequelize','exports'];(function(_0x487f51,_0x268f8f){var _0xaf1452=function(_0x228ab7){while(--_0x228ab7){_0x487f51['push'](_0x487f51['shift']());}};_0xaf1452(++_0x268f8f);}(_0x57cf,0x187));var _0xf57c=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x57cf[_0x508685];return _0x976a76;};'use strict';var Sequelize=require(_0xf57c('0x0'));module[_0xf57c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf57c('0x2')]},'interval':{'type':Sequelize[_0xf57c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7af1=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7af1,0x9f));var _0x17af=function(_0xa14730,_0x33609a){_0xa14730=_0xa14730-0x0;var _0x182727=_0x7af1[_0xa14730];return _0x182727;};'use strict';var Sequelize=require(_0x17af('0x0'));module[_0x17af('0x1')]={'name':{'type':Sequelize[_0x17af('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index ad991b7..713cd65 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 _0x0586=['json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','error','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','Interval','include','findAll','catch','show','params','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','IntervalId','getIntervals','findOne','sort','addIntervals','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x0586,0x1a5));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6058('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6058('0x1'));var rp=require(_0x6058('0x2'));var moment=require(_0x6058('0x3'));var BPromise=require(_0x6058('0x4'));var Mustache=require('mustache');var util=require(_0x6058('0x5'));var path=require(_0x6058('0x6'));var sox=require(_0x6058('0x7'));var csv=require(_0x6058('0x8'));var ejs=require(_0x6058('0x9'));var fs=require('fs');var fs_extra=require(_0x6058('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6058('0xb'));var jsforce=require(_0x6058('0xc'));var deskjs=require(_0x6058('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6058('0xe'));var Redis=require('ioredis');var authService=require(_0x6058('0xf'));var qs=require(_0x6058('0x10'));var as=require(_0x6058('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6058('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6058('0x13'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6058('0x14'));function respondWithStatusCode(_0x462d6d,_0x2a96f7){_0x2a96f7=_0x2a96f7||0xcc;return function(_0xce695c){if(_0xce695c){return _0x462d6d[_0x6058('0x15')](_0x2a96f7);}return _0x462d6d[_0x6058('0x16')](_0x2a96f7)[_0x6058('0x17')]();};}function respondWithResult(_0x13bb06,_0x581bfe){_0x581bfe=_0x581bfe||0xc8;return function(_0x35eb9f){if(_0x35eb9f){return _0x13bb06[_0x6058('0x16')](_0x581bfe)[_0x6058('0x18')](_0x35eb9f);}};}function respondWithFilteredResult(_0x5ded28,_0x14f412){return function(_0x43b990){if(_0x43b990){var _0xd10e47=typeof _0x14f412['offset']===_0x6058('0x19')&&typeof _0x14f412['limit']===_0x6058('0x19');var _0x38f35c=_0x43b990[_0x6058('0x1a')];var _0x485597=_0xd10e47?0x0:_0x14f412[_0x6058('0x1b')];var _0xc63531=_0xd10e47?_0x43b990[_0x6058('0x1a')]:_0x14f412[_0x6058('0x1b')]+_0x14f412['limit'];var _0x5a93bb;if(_0xc63531>=_0x38f35c){_0xc63531=_0x38f35c;_0x5a93bb=0xc8;}else{_0x5a93bb=0xce;}_0x5ded28['status'](_0x5a93bb);return _0x5ded28[_0x6058('0x1c')](_0x6058('0x1d'),_0x485597+'-'+_0xc63531+'/'+_0x38f35c)[_0x6058('0x18')](_0x43b990);}return null;};}function patchUpdates(_0x32541f){return function(_0x435634){try{jsonpatch[_0x6058('0x1e')](_0x435634,_0x32541f,!![]);}catch(_0x195136){return BPromise[_0x6058('0x1f')](_0x195136);}return _0x435634[_0x6058('0x20')]();};}function saveUpdates(_0x428ea4,_0x1f639a){return function(_0x5c0e4f){if(_0x5c0e4f){return _0x5c0e4f[_0x6058('0x21')](_0x428ea4)[_0x6058('0x22')](function(_0x49286b){return _0x49286b;});}return null;};}function removeEntity(_0x52f075,_0x132a97){return function(_0xef10eb){if(_0xef10eb){return _0xef10eb['destroy']()[_0x6058('0x22')](function(){var _0x30bcf7=_0xef10eb[_0x6058('0x23')]({'plain':!![]});var _0x6c4b32=_0x6058('0x24');return db[_0x6058('0x25')]['destroy']({'where':{'type':_0x6c4b32,'resourceId':_0x30bcf7['id']}})['then'](function(){return _0xef10eb;});})[_0x6058('0x22')](function(){_0x52f075[_0x6058('0x16')](0xcc)[_0x6058('0x17')]();});}};}function handleEntityNotFound(_0x4a70f0,_0x5a2aca){return function(_0x266654){if(!_0x266654){_0x4a70f0[_0x6058('0x15')](0x194);}return _0x266654;};}function handleError(_0x1afd6b,_0x46c53c){_0x46c53c=_0x46c53c||0x1f4;return function(_0x4d5331){logger[_0x6058('0x26')](_0x4d5331['stack']);if(_0x4d5331['name']){delete _0x4d5331[_0x6058('0x27')];}_0x1afd6b[_0x6058('0x16')](_0x46c53c)[_0x6058('0x28')](_0x4d5331);};}exports['index']=function(_0x2077c3,_0x53bc09){var _0x5ba20f={},_0x2175a4={},_0x144861={'count':0x0,'rows':[]};var _0x18b50a=_['map'](db['Interval'][_0x6058('0x29')],function(_0xff0eee){return{'name':_0xff0eee[_0x6058('0x2a')],'type':_0xff0eee[_0x6058('0x2b')][_0x6058('0x2c')]};});_0x2175a4[_0x6058('0x2d')]=_[_0x6058('0x2e')](_0x18b50a,_0x6058('0x27'));_0x2175a4[_0x6058('0x2f')]=_['keys'](_0x2077c3[_0x6058('0x2f')]);_0x2175a4[_0x6058('0x30')]=_['intersection'](_0x2175a4[_0x6058('0x2d')],_0x2175a4[_0x6058('0x2f')]);_0x5ba20f[_0x6058('0x31')]=_['intersection'](_0x2175a4[_0x6058('0x2d')],qs['fields'](_0x2077c3[_0x6058('0x2f')][_0x6058('0x32')]));_0x5ba20f[_0x6058('0x31')]=_0x5ba20f[_0x6058('0x31')][_0x6058('0x33')]?_0x5ba20f[_0x6058('0x31')]:_0x2175a4[_0x6058('0x2d')];if(!_0x2077c3[_0x6058('0x2f')][_0x6058('0x34')](_0x6058('0x35'))){_0x5ba20f[_0x6058('0x36')]=qs['limit'](_0x2077c3['query'][_0x6058('0x36')]);_0x5ba20f[_0x6058('0x1b')]=qs[_0x6058('0x1b')](_0x2077c3[_0x6058('0x2f')][_0x6058('0x1b')]);}_0x5ba20f[_0x6058('0x37')]=qs['sort'](_0x2077c3[_0x6058('0x2f')]['sort']);_0x5ba20f[_0x6058('0x38')]=qs[_0x6058('0x30')](_[_0x6058('0x39')](_0x2077c3['query'],_0x2175a4['filters']),_0x18b50a);if(_0x2077c3['query']['filter']){_0x5ba20f[_0x6058('0x38')]=_[_0x6058('0x3a')](_0x5ba20f[_0x6058('0x38')],{'$or':_[_0x6058('0x2e')](_0x18b50a,function(_0x58a866){if(_0x58a866[_0x6058('0x2b')]!==_0x6058('0x3b')){var _0x54f002={};_0x54f002[_0x58a866[_0x6058('0x27')]]={'$like':'%'+_0x2077c3['query'][_0x6058('0x3c')]+'%'};return _0x54f002;}})});}_0x5ba20f=_[_0x6058('0x3a')]({},_0x5ba20f,_0x2077c3[_0x6058('0x3d')]);var _0x3cc69f={'where':_0x5ba20f[_0x6058('0x38')]};return db[_0x6058('0x3e')][_0x6058('0x1a')](_0x3cc69f)['then'](function(_0x4678ff){_0x144861[_0x6058('0x1a')]=_0x4678ff;if(_0x2077c3[_0x6058('0x2f')]['includeAll']){_0x5ba20f[_0x6058('0x3f')]=[{'all':!![]}];}return db['Interval'][_0x6058('0x40')](_0x5ba20f);})['then'](function(_0x1503a8){_0x144861['rows']=_0x1503a8;return _0x144861;})[_0x6058('0x22')](respondWithFilteredResult(_0x53bc09,_0x5ba20f))[_0x6058('0x41')](handleError(_0x53bc09,null));};exports[_0x6058('0x42')]=function(_0x413fc1,_0x44c18d){var _0x27e4c5={'raw':!![],'where':{'id':_0x413fc1[_0x6058('0x43')]['id']}},_0x32feea={};_0x32feea['model']=_[_0x6058('0x44')](db['Interval'][_0x6058('0x29')]);_0x32feea[_0x6058('0x2f')]=_['keys'](_0x413fc1['query']);_0x32feea[_0x6058('0x30')]=_[_0x6058('0x45')](_0x32feea[_0x6058('0x2d')],_0x32feea['query']);_0x27e4c5['attributes']=_[_0x6058('0x45')](_0x32feea[_0x6058('0x2d')],qs['fields'](_0x413fc1[_0x6058('0x2f')]['fields']));_0x27e4c5[_0x6058('0x31')]=_0x27e4c5['attributes']['length']?_0x27e4c5[_0x6058('0x31')]:_0x32feea[_0x6058('0x2d')];if(_0x413fc1['query'][_0x6058('0x46')]){_0x27e4c5[_0x6058('0x3f')]=[{'all':!![]}];}_0x27e4c5=_[_0x6058('0x3a')]({},_0x27e4c5,_0x413fc1[_0x6058('0x3d')]);return db[_0x6058('0x3e')][_0x6058('0x47')](_0x27e4c5)[_0x6058('0x22')](handleEntityNotFound(_0x44c18d,null))[_0x6058('0x22')](respondWithResult(_0x44c18d,null))[_0x6058('0x41')](handleError(_0x44c18d,null));};exports['create']=function(_0x140279,_0x31e0e9){return db['Interval'][_0x6058('0x48')](_0x140279[_0x6058('0x49')],{})[_0x6058('0x22')](function(_0x2192b1){var _0x4fd6ef=_0x140279[_0x6058('0x4a')][_0x6058('0x23')]({'plain':!![]});if(!_0x4fd6ef)throw new Error(_0x6058('0x4b'));if(_0x4fd6ef[_0x6058('0x4c')]===_0x6058('0x4a')){var _0x297446=_0x2192b1['get']({'plain':!![]});var _0x2b3609=_0x6058('0x24');return db[_0x6058('0x4d')][_0x6058('0x47')]({'where':{'name':_0x2b3609,'userProfileId':_0x4fd6ef[_0x6058('0x4e')]},'raw':!![]})[_0x6058('0x22')](function(_0x1bc75c){if(_0x1bc75c&&_0x1bc75c['autoAssociation']===0x0){return db[_0x6058('0x25')][_0x6058('0x48')]({'name':_0x297446['name'],'resourceId':_0x297446['id'],'type':_0x1bc75c[_0x6058('0x27')],'sectionId':_0x1bc75c['id']},{})['then'](function(){return _0x2192b1;});}else{return _0x2192b1;}})['catch'](function(_0x36acc){logger['error'](_0x6058('0x4f'),_0x36acc);throw _0x36acc;});}return _0x2192b1;})[_0x6058('0x22')](respondWithResult(_0x31e0e9,0xc9))[_0x6058('0x41')](handleError(_0x31e0e9,null));};exports[_0x6058('0x21')]=function(_0x20790f,_0xeedb43){if(_0x20790f[_0x6058('0x49')]['id']){delete _0x20790f[_0x6058('0x49')]['id'];}return db[_0x6058('0x3e')][_0x6058('0x47')]({'where':{'id':_0x20790f[_0x6058('0x43')]['id']}})['then'](handleEntityNotFound(_0xeedb43,null))[_0x6058('0x22')](saveUpdates(_0x20790f['body'],null))[_0x6058('0x22')](respondWithResult(_0xeedb43,null))[_0x6058('0x41')](handleError(_0xeedb43,null));};exports[_0x6058('0x50')]=function(_0x1864cf,_0xdb392){return db[_0x6058('0x3e')][_0x6058('0x47')]({'where':{'id':_0x1864cf['params']['id']}})[_0x6058('0x22')](handleEntityNotFound(_0xdb392,null))[_0x6058('0x22')](removeEntity(_0xdb392,null))[_0x6058('0x41')](handleError(_0xdb392,null));};exports['addInterval']=function(_0x2a2dd0,_0x4f9b48,_0x5bc91a){if(_0x2a2dd0['body']['id']){delete _0x2a2dd0[_0x6058('0x49')]['id'];}return db['Interval'][_0x6058('0x47')]({'where':{'id':_0x2a2dd0[_0x6058('0x43')]['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4f9b48,null))['then'](function(_0x3f62c3){if(_0x3f62c3){_0x2a2dd0[_0x6058('0x49')][_0x6058('0x51')]=_0x3f62c3['id'];return db[_0x6058('0x3e')][_0x6058('0x48')](_0x2a2dd0[_0x6058('0x49')]);}})[_0x6058('0x22')](respondWithResult(_0x4f9b48,null))[_0x6058('0x41')](handleError(_0x4f9b48,null));};exports[_0x6058('0x52')]=function(_0x50d998,_0x4456b7,_0x1145b5){var _0x54b822={};var _0x234cda={};var _0x289e45;var _0x59900d;return db[_0x6058('0x3e')][_0x6058('0x53')]({'where':{'id':_0x50d998[_0x6058('0x43')]['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4456b7,null))[_0x6058('0x22')](function(_0x1bab83){if(_0x1bab83){_0x289e45=_0x1bab83;_0x234cda[_0x6058('0x2d')]=_[_0x6058('0x44')](db[_0x6058('0x3e')][_0x6058('0x29')]);_0x234cda[_0x6058('0x2f')]=_[_0x6058('0x44')](_0x50d998[_0x6058('0x2f')]);_0x234cda[_0x6058('0x30')]=_[_0x6058('0x45')](_0x234cda['model'],_0x234cda[_0x6058('0x2f')]);_0x54b822[_0x6058('0x31')]=_['intersection'](_0x234cda['model'],qs[_0x6058('0x32')](_0x50d998[_0x6058('0x2f')]['fields']));_0x54b822[_0x6058('0x31')]=_0x54b822['attributes'][_0x6058('0x33')]?_0x54b822['attributes']:_0x234cda['model'];_0x54b822[_0x6058('0x37')]=qs[_0x6058('0x54')](_0x50d998['query']['sort']);_0x54b822[_0x6058('0x38')]=qs[_0x6058('0x30')](_['pick'](_0x50d998[_0x6058('0x2f')],_0x234cda['filters']));if(_0x50d998['query'][_0x6058('0x3c')]){_0x54b822[_0x6058('0x38')]=_[_0x6058('0x3a')](_0x54b822[_0x6058('0x38')],{'$or':_['map'](_0x54b822[_0x6058('0x31')],function(_0x10a0ca){var _0x321078={};_0x321078[_0x10a0ca]={'$like':'%'+_0x50d998[_0x6058('0x2f')][_0x6058('0x3c')]+'%'};return _0x321078;})});}_0x54b822=_[_0x6058('0x3a')]({},_0x54b822,_0x50d998[_0x6058('0x3d')]);return _0x289e45[_0x6058('0x52')](_0x54b822);}})[_0x6058('0x22')](function(_0x1bd894){if(_0x1bd894){_0x59900d=_0x1bd894[_0x6058('0x33')];if(!_0x50d998[_0x6058('0x2f')]['hasOwnProperty'](_0x6058('0x35'))){_0x54b822[_0x6058('0x36')]=qs[_0x6058('0x36')](_0x50d998['query'][_0x6058('0x36')]);_0x54b822[_0x6058('0x1b')]=qs['offset'](_0x50d998['query'][_0x6058('0x1b')]);}return _0x289e45[_0x6058('0x52')](_0x54b822);}})[_0x6058('0x22')](function(_0x4d9692){if(_0x4d9692){return _0x4d9692?{'count':_0x59900d,'rows':_0x4d9692}:null;}})[_0x6058('0x22')](respondWithResult(_0x4456b7,null))['catch'](handleError(_0x4456b7,null));};exports[_0x6058('0x55')]=function(_0x5adae4,_0x4596fa,_0x8d8ab5){return db[_0x6058('0x3e')][_0x6058('0x53')]({'where':{'id':_0x5adae4['params']['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4596fa,null))[_0x6058('0x22')](function(_0x4d431e){if(_0x4d431e){return db[_0x6058('0x56')][_0x6058('0x57')](function(_0x3e7a75){return db[_0x6058('0x3e')]['destroy']({'where':{'IntervalId':_0x5adae4['params']['id']},'transaction':_0x3e7a75})[_0x6058('0x22')](function(_0x49b9f8){var _0x382918=_[_0x6058('0x2e')](_0x5adae4[_0x6058('0x49')],function(_0x33403b){delete _0x33403b['id'];_0x33403b[_0x6058('0x51')]=_0x5adae4[_0x6058('0x43')]['id'];return _0x33403b;});return db['Interval'][_0x6058('0x58')](_0x382918,{'transaction':_0x3e7a75});});})[_0x6058('0x22')](function(){return db[_0x6058('0x3e')][_0x6058('0x40')]({'where':{'IntervalId':_0x5adae4[_0x6058('0x43')]['id']}});});}})[_0x6058('0x22')](respondWithResult(_0x4596fa,null))['catch'](handleError(_0x4596fa,null));}; \ No newline at end of file +var _0x4716=['index','Interval','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','Intervals','UserProfileResource','error','stack','name','send'];(function(_0x3edc9f,_0x52d3eb){var _0x42d5dc=function(_0x267012){while(--_0x267012){_0x3edc9f['push'](_0x3edc9f['shift']());}};_0x42d5dc(++_0x52d3eb);}(_0x4716,0x8c));var _0x6471=function(_0x23bfbb,_0x3b0fa2){_0x23bfbb=_0x23bfbb-0x0;var _0x383576=_0x4716[_0x23bfbb];return _0x383576;};'use strict';var emlformat=require(_0x6471('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6471('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6471('0x2'));var moment=require(_0x6471('0x3'));var BPromise=require(_0x6471('0x4'));var Mustache=require(_0x6471('0x5'));var util=require(_0x6471('0x6'));var path=require(_0x6471('0x7'));var sox=require('sox');var csv=require(_0x6471('0x8'));var ejs=require(_0x6471('0x9'));var fs=require('fs');var fs_extra=require(_0x6471('0xa'));var _=require(_0x6471('0xb'));var squel=require(_0x6471('0xc'));var crypto=require(_0x6471('0xd'));var jsforce=require(_0x6471('0xe'));var deskjs=require(_0x6471('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6471('0x10'));var Papa=require('papaparse');var Redis=require(_0x6471('0x11'));var authService=require(_0x6471('0x12'));var qs=require(_0x6471('0x13'));var as=require(_0x6471('0x14'));var hardwareService=require(_0x6471('0x15'));var logger=require(_0x6471('0x16'))(_0x6471('0x17'));var utils=require(_0x6471('0x18'));var config=require(_0x6471('0x19'));var licenseUtil=require(_0x6471('0x1a'));var db=require(_0x6471('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x65f76a,_0x41d83b){_0x41d83b=_0x41d83b||0xcc;return function(_0x3de97b){if(_0x3de97b){return _0x65f76a[_0x6471('0x1c')](_0x41d83b);}return _0x65f76a[_0x6471('0x1d')](_0x41d83b)[_0x6471('0x1e')]();};}function respondWithResult(_0x1987c1,_0x1103ec){_0x1103ec=_0x1103ec||0xc8;return function(_0x513354){if(_0x513354){return _0x1987c1['status'](_0x1103ec)['json'](_0x513354);}};}function respondWithFilteredResult(_0x360eea,_0x150cff){return function(_0x189876){if(_0x189876){var _0x3a8b68=typeof _0x150cff[_0x6471('0x1f')]===_0x6471('0x20')&&typeof _0x150cff[_0x6471('0x21')]==='undefined';var _0xe66a09=_0x189876['count'];var _0x3bf38b=_0x3a8b68?0x0:_0x150cff[_0x6471('0x1f')];var _0x466956=_0x3a8b68?_0x189876[_0x6471('0x22')]:_0x150cff[_0x6471('0x1f')]+_0x150cff[_0x6471('0x21')];var _0x3513bc;if(_0x466956>=_0xe66a09){_0x466956=_0xe66a09;_0x3513bc=0xc8;}else{_0x3513bc=0xce;}_0x360eea[_0x6471('0x1d')](_0x3513bc);return _0x360eea[_0x6471('0x23')](_0x6471('0x24'),_0x3bf38b+'-'+_0x466956+'/'+_0xe66a09)[_0x6471('0x25')](_0x189876);}return null;};}function patchUpdates(_0x431986){return function(_0x2041c3){try{jsonpatch[_0x6471('0x26')](_0x2041c3,_0x431986,!![]);}catch(_0x55eb44){return BPromise[_0x6471('0x27')](_0x55eb44);}return _0x2041c3[_0x6471('0x28')]();};}function saveUpdates(_0x2442ad,_0x4b61ba){return function(_0x4a1ae7){if(_0x4a1ae7){return _0x4a1ae7[_0x6471('0x29')](_0x2442ad)['then'](function(_0x18f9ec){return _0x18f9ec;});}return null;};}function removeEntity(_0x2bae17,_0x3aef5d){return function(_0x112034){if(_0x112034){return _0x112034[_0x6471('0x2a')]()[_0x6471('0x2b')](function(){var _0x4b5129=_0x112034['get']({'plain':!![]});var _0x38edd1=_0x6471('0x2c');return db[_0x6471('0x2d')][_0x6471('0x2a')]({'where':{'type':_0x38edd1,'resourceId':_0x4b5129['id']}})['then'](function(){return _0x112034;});})[_0x6471('0x2b')](function(){_0x2bae17[_0x6471('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0b65,_0x58f4a8){return function(_0x3a9ca7){if(!_0x3a9ca7){_0x4d0b65[_0x6471('0x1c')](0x194);}return _0x3a9ca7;};}function handleError(_0x5a5f2a,_0x774510){_0x774510=_0x774510||0x1f4;return function(_0x34009d){logger[_0x6471('0x2e')](_0x34009d[_0x6471('0x2f')]);if(_0x34009d['name']){delete _0x34009d[_0x6471('0x30')];}_0x5a5f2a[_0x6471('0x1d')](_0x774510)[_0x6471('0x31')](_0x34009d);};}exports[_0x6471('0x32')]=function(_0x541da8,_0x2d7505){var _0x235240={},_0x26810d={},_0x313b4d={'count':0x0,'rows':[]};var _0x1eb375=_['map'](db[_0x6471('0x33')][_0x6471('0x34')],function(_0x4c7e3f){return{'name':_0x4c7e3f['fieldName'],'type':_0x4c7e3f[_0x6471('0x35')][_0x6471('0x36')]};});_0x26810d[_0x6471('0x37')]=_[_0x6471('0x38')](_0x1eb375,'name');_0x26810d[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x541da8[_0x6471('0x39')]);_0x26810d[_0x6471('0x3b')]=_[_0x6471('0x3c')](_0x26810d['model'],_0x26810d[_0x6471('0x39')]);_0x235240[_0x6471('0x3d')]=_['intersection'](_0x26810d[_0x6471('0x37')],qs[_0x6471('0x3e')](_0x541da8[_0x6471('0x39')][_0x6471('0x3e')]));_0x235240[_0x6471('0x3d')]=_0x235240[_0x6471('0x3d')]['length']?_0x235240[_0x6471('0x3d')]:_0x26810d[_0x6471('0x37')];if(!_0x541da8['query'][_0x6471('0x3f')](_0x6471('0x40'))){_0x235240[_0x6471('0x21')]=qs[_0x6471('0x21')](_0x541da8['query']['limit']);_0x235240[_0x6471('0x1f')]=qs[_0x6471('0x1f')](_0x541da8['query'][_0x6471('0x1f')]);}_0x235240['order']=qs[_0x6471('0x41')](_0x541da8[_0x6471('0x39')]['sort']);_0x235240[_0x6471('0x42')]=qs[_0x6471('0x3b')](_[_0x6471('0x43')](_0x541da8[_0x6471('0x39')],_0x26810d[_0x6471('0x3b')]),_0x1eb375);if(_0x541da8['query'][_0x6471('0x44')]){_0x235240[_0x6471('0x42')]=_[_0x6471('0x45')](_0x235240[_0x6471('0x42')],{'$or':_[_0x6471('0x38')](_0x1eb375,function(_0x1f7afc){if(_0x1f7afc[_0x6471('0x35')]!==_0x6471('0x46')){var _0x31b69c={};_0x31b69c[_0x1f7afc['name']]={'$like':'%'+_0x541da8['query']['filter']+'%'};return _0x31b69c;}})});}_0x235240=_[_0x6471('0x45')]({},_0x235240,_0x541da8[_0x6471('0x47')]);var _0x219422={'where':_0x235240[_0x6471('0x42')]};return db[_0x6471('0x33')][_0x6471('0x22')](_0x219422)['then'](function(_0x47f81c){_0x313b4d['count']=_0x47f81c;if(_0x541da8['query'][_0x6471('0x48')]){_0x235240[_0x6471('0x49')]=[{'all':!![]}];}return db[_0x6471('0x33')][_0x6471('0x4a')](_0x235240);})[_0x6471('0x2b')](function(_0xdc4e9b){_0x313b4d['rows']=_0xdc4e9b;return _0x313b4d;})[_0x6471('0x2b')](respondWithFilteredResult(_0x2d7505,_0x235240))[_0x6471('0x4b')](handleError(_0x2d7505,null));};exports[_0x6471('0x4c')]=function(_0x114fa7,_0x4aa12c){var _0x27fcbc={'raw':!![],'where':{'id':_0x114fa7[_0x6471('0x4d')]['id']}},_0x44402b={};_0x44402b[_0x6471('0x37')]=_[_0x6471('0x3a')](db[_0x6471('0x33')][_0x6471('0x34')]);_0x44402b[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x114fa7[_0x6471('0x39')]);_0x44402b[_0x6471('0x3b')]=_[_0x6471('0x3c')](_0x44402b[_0x6471('0x37')],_0x44402b['query']);_0x27fcbc[_0x6471('0x3d')]=_[_0x6471('0x3c')](_0x44402b[_0x6471('0x37')],qs[_0x6471('0x3e')](_0x114fa7[_0x6471('0x39')]['fields']));_0x27fcbc[_0x6471('0x3d')]=_0x27fcbc[_0x6471('0x3d')][_0x6471('0x4e')]?_0x27fcbc[_0x6471('0x3d')]:_0x44402b[_0x6471('0x37')];if(_0x114fa7[_0x6471('0x39')][_0x6471('0x48')]){_0x27fcbc[_0x6471('0x49')]=[{'all':!![]}];}_0x27fcbc=_[_0x6471('0x45')]({},_0x27fcbc,_0x114fa7[_0x6471('0x47')]);return db[_0x6471('0x33')]['find'](_0x27fcbc)['then'](handleEntityNotFound(_0x4aa12c,null))['then'](respondWithResult(_0x4aa12c,null))[_0x6471('0x4b')](handleError(_0x4aa12c,null));};exports[_0x6471('0x4f')]=function(_0x16b8a0,_0x263ad2){return db[_0x6471('0x33')]['create'](_0x16b8a0[_0x6471('0x50')],{})['then'](function(_0x1254e2){var _0x4c02da=_0x16b8a0['user']['get']({'plain':!![]});if(!_0x4c02da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c02da['role']===_0x6471('0x51')){var _0x9a2b84=_0x1254e2[_0x6471('0x52')]({'plain':!![]});var _0x272ee9=_0x6471('0x2c');return db[_0x6471('0x53')][_0x6471('0x54')]({'where':{'name':_0x272ee9,'userProfileId':_0x4c02da[_0x6471('0x55')]},'raw':!![]})[_0x6471('0x2b')](function(_0x2d9f8c){if(_0x2d9f8c&&_0x2d9f8c[_0x6471('0x56')]===0x0){return db[_0x6471('0x2d')][_0x6471('0x4f')]({'name':_0x9a2b84[_0x6471('0x30')],'resourceId':_0x9a2b84['id'],'type':_0x2d9f8c[_0x6471('0x30')],'sectionId':_0x2d9f8c['id']},{})[_0x6471('0x2b')](function(){return _0x1254e2;});}else{return _0x1254e2;}})[_0x6471('0x4b')](function(_0x10f733){logger['error'](_0x6471('0x57'),_0x10f733);throw _0x10f733;});}return _0x1254e2;})[_0x6471('0x2b')](respondWithResult(_0x263ad2,0xc9))['catch'](handleError(_0x263ad2,null));};exports[_0x6471('0x29')]=function(_0x44856c,_0x50b754){if(_0x44856c[_0x6471('0x50')]['id']){delete _0x44856c[_0x6471('0x50')]['id'];}return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x44856c['params']['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x50b754,null))[_0x6471('0x2b')](saveUpdates(_0x44856c['body'],null))[_0x6471('0x2b')](respondWithResult(_0x50b754,null))[_0x6471('0x4b')](handleError(_0x50b754,null));};exports[_0x6471('0x2a')]=function(_0x49ff06,_0x31ec9b){return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x49ff06['params']['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x31ec9b,null))[_0x6471('0x2b')](removeEntity(_0x31ec9b,null))['catch'](handleError(_0x31ec9b,null));};exports[_0x6471('0x58')]=function(_0x5cf6f5,_0x35a515,_0xf92ef){if(_0x5cf6f5['body']['id']){delete _0x5cf6f5[_0x6471('0x50')]['id'];}return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x5cf6f5[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x35a515,null))[_0x6471('0x2b')](function(_0x304c45){if(_0x304c45){_0x5cf6f5[_0x6471('0x50')]['IntervalId']=_0x304c45['id'];return db[_0x6471('0x33')]['create'](_0x5cf6f5['body']);}})[_0x6471('0x2b')](respondWithResult(_0x35a515,null))[_0x6471('0x4b')](handleError(_0x35a515,null));};exports[_0x6471('0x59')]=function(_0x443895,_0x44f96b,_0x5d8a17){var _0x3ee88c={};var _0x52a94e={};var _0x42dace;var _0x7fddb9;return db[_0x6471('0x33')][_0x6471('0x5a')]({'where':{'id':_0x443895[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x44f96b,null))[_0x6471('0x2b')](function(_0x1ac8b0){if(_0x1ac8b0){_0x42dace=_0x1ac8b0;_0x52a94e[_0x6471('0x37')]=_[_0x6471('0x3a')](db[_0x6471('0x33')][_0x6471('0x34')]);_0x52a94e[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x443895[_0x6471('0x39')]);_0x52a94e['filters']=_['intersection'](_0x52a94e[_0x6471('0x37')],_0x52a94e[_0x6471('0x39')]);_0x3ee88c[_0x6471('0x3d')]=_[_0x6471('0x3c')](_0x52a94e['model'],qs[_0x6471('0x3e')](_0x443895[_0x6471('0x39')][_0x6471('0x3e')]));_0x3ee88c[_0x6471('0x3d')]=_0x3ee88c[_0x6471('0x3d')][_0x6471('0x4e')]?_0x3ee88c[_0x6471('0x3d')]:_0x52a94e[_0x6471('0x37')];_0x3ee88c['order']=qs[_0x6471('0x41')](_0x443895[_0x6471('0x39')]['sort']);_0x3ee88c['where']=qs[_0x6471('0x3b')](_['pick'](_0x443895[_0x6471('0x39')],_0x52a94e['filters']));if(_0x443895['query'][_0x6471('0x44')]){_0x3ee88c['where']=_[_0x6471('0x45')](_0x3ee88c[_0x6471('0x42')],{'$or':_[_0x6471('0x38')](_0x3ee88c[_0x6471('0x3d')],function(_0x3835e6){var _0x456cbb={};_0x456cbb[_0x3835e6]={'$like':'%'+_0x443895[_0x6471('0x39')][_0x6471('0x44')]+'%'};return _0x456cbb;})});}_0x3ee88c=_['merge']({},_0x3ee88c,_0x443895[_0x6471('0x47')]);return _0x42dace[_0x6471('0x59')](_0x3ee88c);}})['then'](function(_0x267ca1){if(_0x267ca1){_0x7fddb9=_0x267ca1['length'];if(!_0x443895[_0x6471('0x39')][_0x6471('0x3f')](_0x6471('0x40'))){_0x3ee88c['limit']=qs[_0x6471('0x21')](_0x443895[_0x6471('0x39')]['limit']);_0x3ee88c[_0x6471('0x1f')]=qs[_0x6471('0x1f')](_0x443895[_0x6471('0x39')][_0x6471('0x1f')]);}return _0x42dace[_0x6471('0x59')](_0x3ee88c);}})[_0x6471('0x2b')](function(_0x467a5e){if(_0x467a5e){return _0x467a5e?{'count':_0x7fddb9,'rows':_0x467a5e}:null;}})[_0x6471('0x2b')](respondWithResult(_0x44f96b,null))[_0x6471('0x4b')](handleError(_0x44f96b,null));};exports[_0x6471('0x5b')]=function(_0x3ff426,_0x37d039,_0x5aacc5){return db[_0x6471('0x33')]['findOne']({'where':{'id':_0x3ff426[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x37d039,null))[_0x6471('0x2b')](function(_0x2f74d0){if(_0x2f74d0){return db[_0x6471('0x5c')][_0x6471('0x5d')](function(_0x4a38ce){return db['Interval'][_0x6471('0x2a')]({'where':{'IntervalId':_0x3ff426[_0x6471('0x4d')]['id']},'transaction':_0x4a38ce})['then'](function(_0x197bcc){var _0x447aec=_['map'](_0x3ff426['body'],function(_0x76f099){delete _0x76f099['id'];_0x76f099[_0x6471('0x5e')]=_0x3ff426['params']['id'];return _0x76f099;});return db[_0x6471('0x33')]['bulkCreate'](_0x447aec,{'transaction':_0x4a38ce});});})[_0x6471('0x2b')](function(){return db[_0x6471('0x33')]['findAll']({'where':{'IntervalId':_0x3ff426[_0x6471('0x4d')]['id']}});});}})[_0x6471('0x2b')](respondWithResult(_0x37d039,null))[_0x6471('0x4b')](handleError(_0x37d039,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f938118..138ae54 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 _0x93b8=['interval','getIntervals','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define','Interval','rewrite'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x93b8,0xde));var _0x893b=function(_0x2206fc,_0x1c184c){_0x2206fc=_0x2206fc-0x0;var _0x1861f1=_0x93b8[_0x2206fc];return _0x1861f1;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x893b('0x0'));var iftime=require(_0x893b('0x1'))[_0x893b('0x2')];module['exports']=function(_0xc4236f){return _0xc4236f[_0x893b('0x3')](_0x893b('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x174f06){extensions[_0x893b('0x5')](_0xc4236f,_0x174f06);},'afterBulkCreate':function(_0x3817fb,_0x5c6429,_0x47b07c){_0x47b07c();extensions['rewrite'](_0xc4236f,_0x3817fb[0x0]);},'afterUpdate':function(_0xb512cb){extensions['rewrite'](_0xc4236f,_0xb512cb);},'afterDestroy':function(_0x486903){extensions[_0x893b('0x5')](_0xc4236f,_0x486903);}},'instanceMethods':{'ifTime':function(_0x5f3b92=undefined,_0x49de2e=new Date()){if(typeof this[_0x893b('0x6')]==='string'){return iftime(this['interval'],_0x5f3b92,_0x49de2e);}else{return this[_0x893b('0x7')]()['then'](function(_0x147226){return Promise[_0x893b('0x8')](_0x147226[_0x893b('0x9')](function(_0x1d4a37){return _0x1d4a37[_0x893b('0xa')](_0x5f3b92,_0x49de2e);}));})['then'](function(_0x165c82){return _0x165c82[_0x893b('0xb')](function(_0x1737a2,_0x59afdb){return _0x1737a2||_0x59afdb;},![]);});}}}});}; \ No newline at end of file +var _0xa73d=['map','ifTime','then','../../components/extensions/rewrite','iftime','define','tools_intervals','rewrite','interval','getIntervals'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0xa73d,0xad));var _0xda73=function(_0x4c437f,_0x380c6e){_0x4c437f=_0x4c437f-0x0;var _0xad9c0e=_0xa73d[_0x4c437f];return _0xad9c0e;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xda73('0x0'));var iftime=require('../../utils/iftime')[_0xda73('0x1')];module['exports']=function(_0x13dbfd){return _0x13dbfd[_0xda73('0x2')]('Interval',attributes,{'tableName':_0xda73('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x230f8a){extensions[_0xda73('0x4')](_0x13dbfd,_0x230f8a);},'afterBulkCreate':function(_0x434f48,_0x3fbcf8,_0x5d6719){_0x5d6719();extensions[_0xda73('0x4')](_0x13dbfd,_0x434f48[0x0]);},'afterUpdate':function(_0x540546){extensions[_0xda73('0x4')](_0x13dbfd,_0x540546);},'afterDestroy':function(_0x323a71){extensions[_0xda73('0x4')](_0x13dbfd,_0x323a71);}},'instanceMethods':{'ifTime':function(_0x2f5c19=undefined,_0x2dbfcc=new Date()){if(typeof this[_0xda73('0x5')]==='string'){return iftime(this[_0xda73('0x5')],_0x2f5c19,_0x2dbfcc);}else{return this[_0xda73('0x6')]()['then'](function(_0x44cfbf){return Promise['all'](_0x44cfbf[_0xda73('0x7')](function(_0x4424d8){return _0x4424d8[_0xda73('0x8')](_0x2f5c19,_0x2dbfcc);}));})[_0xda73('0x9')](function(_0x3305e9){return _0x3305e9['reduce'](function(_0x3408d5,_0x5747b0){return _0x3408d5||_0x5747b0;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f37d8b9..756d641 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 _0x97bf=['format','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','IntervalIftime','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','options','where','attributes','include','map','model','then','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','find','raw','all','ifTime','reduce','name','join','findById'];(function(_0x19ecd5,_0x3098f6){var _0x5b8ec5=function(_0x20d35f){while(--_0x20d35f){_0x19ecd5['push'](_0x19ecd5['shift']());}};_0x5b8ec5(++_0x3098f6);}(_0x97bf,0xd8));var _0xf97b=function(_0x322a9e,_0x85f73f){_0x322a9e=_0x322a9e-0x0;var _0x2df1eb=_0x97bf[_0x322a9e];return _0x2df1eb;};'use strict';var _=require(_0xf97b('0x0'));var util=require(_0xf97b('0x1'));var db=require(_0xf97b('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xf97b('0x3')];var logger=require(_0xf97b('0x4'))(_0xf97b('0x5'));exports['GetInterval']=function(_0x1735ab){var _0x63b16a=this;return new Promise(function(_0x3578f3,_0x44eb13){return db[_0xf97b('0x6')]['findAll']({'raw':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')][_0xf97b('0x8')]||null:null,'attributes':_0x1735ab['options']?_0x1735ab[_0xf97b('0x7')][_0xf97b('0x9')]||null:null,'limit':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')]['limit']||null:null,'include':_0x1735ab['options']?_0x1735ab['options'][_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x1735ab[_0xf97b('0x7')][_0xf97b('0xa')],function(_0x1206f7){return{'model':db[_0x1206f7[_0xf97b('0xc')]],'as':_0x1206f7['as'],'attributes':_0x1206f7[_0xf97b('0x9')],'include':_0x1206f7['include']?_[_0xf97b('0xb')](_0x1206f7[_0xf97b('0xa')],function(_0x10ff5d){return{'model':db[_0x10ff5d[_0xf97b('0xc')]],'as':_0x10ff5d['as'],'attributes':_0x10ff5d['attributes'],'include':_0x10ff5d[_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x10ff5d['include'],function(_0x3f3e8b){return{'model':db[_0x3f3e8b[_0xf97b('0xc')]],'as':_0x3f3e8b['as'],'attributes':_0x3f3e8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf97b('0xd')](function(_0xac703d){logger[_0xf97b('0xe')](_0xf97b('0xf'),_0x1735ab);logger[_0xf97b('0x10')](_0xf97b('0xf'),_0x1735ab,JSON[_0xf97b('0x11')](_0xac703d));_0x3578f3(_0xac703d);})[_0xf97b('0x12')](function(_0xb9e6d9){logger[_0xf97b('0x13')](_0xf97b('0xf'),_0xb9e6d9['message'],_0x1735ab);_0x44eb13(_0x63b16a[_0xf97b('0x13')](0x1f4,_0xb9e6d9[_0xf97b('0x14')]));});});};exports[_0xf97b('0x15')]=function(_0x129f00){var _0x3020a5=this;return new Promise(function(_0x1e97c4,_0x2fc6a8){return db['Interval'][_0xf97b('0x16')]({'raw':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0x17')]===undefined?!![]:![]:!![],'where':_0x129f00[_0xf97b('0x7')]?_0x129f00['options'][_0xf97b('0x8')]||null:null,'attributes':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0x9')]||null:null,'include':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x129f00['options']['include'],function(_0x5a8199){return{'model':db[_0x5a8199[_0xf97b('0xc')]],'as':_0x5a8199['as'],'attributes':_0x5a8199[_0xf97b('0x9')],'include':_0x5a8199[_0xf97b('0xa')]?_['map'](_0x5a8199[_0xf97b('0xa')],function(_0xc7dc0){return{'model':db[_0xc7dc0['model']],'as':_0xc7dc0['as'],'attributes':_0xc7dc0[_0xf97b('0x9')],'include':_0xc7dc0[_0xf97b('0xa')]?_[_0xf97b('0xb')](_0xc7dc0['include'],function(_0x547a01){return{'model':db[_0x547a01[_0xf97b('0xc')]],'as':_0x547a01['as'],'attributes':_0x547a01['attributes']};}):[]};}):[]};}):[]:[]})[_0xf97b('0xd')](function(_0x41c65d){logger['info'](_0xf97b('0x15'),_0x129f00);logger[_0xf97b('0x10')](_0xf97b('0x15'),_0x129f00,JSON[_0xf97b('0x11')](_0x41c65d));_0x1e97c4(_0x41c65d);})[_0xf97b('0x12')](function(_0x58305e){logger[_0xf97b('0x13')](_0xf97b('0x15'),_0x58305e[_0xf97b('0x14')],_0x129f00);_0x2fc6a8(_0x3020a5[_0xf97b('0x13')](0x1f4,_0x58305e[_0xf97b('0x14')]));});});};function checkArrayOfIntervals(_0x5cbc48,_0x1c341e){var _0x6f6203=[];return db['Interval']['findAll']({'where':{'id':_0x5cbc48}})[_0xf97b('0xd')](function(_0x561db0){_0x6f6203=_0x561db0;return Promise[_0xf97b('0x18')](_0x6f6203['map'](function(_0x22fcd6){return _0x22fcd6[_0xf97b('0x19')](_0x1c341e);}));})['then'](function(_0x13246b){var _0x1ae196=_0x13246b[_0xf97b('0x1a')](function(_0x147fab,_0x5b6b4a){return _0x147fab||_0x5b6b4a;},![]);logger['info'](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x6f6203[_0xf97b('0xb')](function(_0x350de6){return _0x350de6[_0xf97b('0x1b')];})[_0xf97b('0x1c')](',\x20'),_0x6f6203[_0xf97b('0xb')](function(_0x1f6316){return _0x1f6316['id'];})[_0xf97b('0x1c')](',\x20')));return _0x1ae196;});}function checkSingleInterval(_0x409406,_0x3bdc43){return db[_0xf97b('0x6')][_0xf97b('0x1d')](_0x409406)[_0xf97b('0xd')](function(_0x1e346c){if(_0x1e346c){logger[_0xf97b('0xe')](util[_0xf97b('0x1e')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x1e346c['name'],_0x1e346c['id']));return _0x1e346c[_0xf97b('0x19')](_0x3bdc43);}});}exports['IntervalIftime']=function(_0x19f072){var _0x22b321=_0x19f072[_0xf97b('0x1f')];var _0x4ff4f3=Array[_0xf97b('0x20')](_0x19f072['intervals'])?_0x19f072[_0xf97b('0x21')]:typeof _0x19f072[_0xf97b('0x21')]===_0xf97b('0x22')?[_0x19f072[_0xf97b('0x21')]]:[];var _0x2c675e=_0x19f072[_0xf97b('0x23')]||undefined;var _0x156f7c=![];if(_0x4ff4f3[_0xf97b('0x24')]){logger[_0xf97b('0xe')](util[_0xf97b('0x1e')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x4ff4f3[_0xf97b('0x1c')](';\x20')));}if(_0x2c675e){logger[_0xf97b('0xe')](util['format'](_0xf97b('0x25'),_0x2c675e));}logger[_0xf97b('0x10')](_0xf97b('0x26'),_0x156f7c);logger['silly']('IntervalIftime',_0x19f072);return Promise[_0xf97b('0x27')]()['then'](function(){if(Array['isArray'](_0x22b321)){return checkArrayOfIntervals(_0x22b321,_0x2c675e);}else if(_0x22b321){return checkSingleInterval(_0x22b321,_0x2c675e);}})['then'](function(_0x4fb6d5){var _0x2fe15d=_0x4ff4f3[_0xf97b('0x1a')](function(_0x1e7c32,_0x5b54fb){return _0x1e7c32||iftime(_0x5b54fb,_0x2c675e);},![]);_0x156f7c=_0x4fb6d5||_0x2fe15d;return _0x156f7c;})[_0xf97b('0x12')](function(_0x1bffec){logger[_0xf97b('0x13')](_0xf97b('0x28'),_0x19f072,_0x1bffec);throw this[_0xf97b('0x13')](0x1f4,_0x1bffec['message']);});}; \ No newline at end of file +var _0x394f=['options','raw','where','attributes','include','map','model','then','info','debug','catch','error','message','ShowInterval','find','stringify','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','name','IntervalIftime','isArray','intervals','timezone','length','Iftime','silly','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll'];(function(_0x18e30f,_0x6b27a6){var _0x5846a9=function(_0x3d2d5c){while(--_0x3d2d5c){_0x18e30f['push'](_0x18e30f['shift']());}};_0x5846a9(++_0x6b27a6);}(_0x394f,0x108));var _0xf394=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x394f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf394('0x0'));var util=require('util');var db=require(_0xf394('0x1'))['db'];var iftime=require(_0xf394('0x2'))[_0xf394('0x3')];var logger=require(_0xf394('0x4'))(_0xf394('0x5'));exports[_0xf394('0x6')]=function(_0x456c1b){var _0xf4bee6=this;return new Promise(function(_0x3c97d3,_0x18f28d){return db[_0xf394('0x7')][_0xf394('0x8')]({'raw':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xa')]===undefined?!![]:![]:!![],'where':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xb')]||null:null,'attributes':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xc')]||null:null,'limit':_0x456c1b['options']?_0x456c1b[_0xf394('0x9')]['limit']||null:null,'include':_0x456c1b['options']?_0x456c1b[_0xf394('0x9')][_0xf394('0xd')]?_[_0xf394('0xe')](_0x456c1b[_0xf394('0x9')][_0xf394('0xd')],function(_0x49c819){return{'model':db[_0x49c819[_0xf394('0xf')]],'as':_0x49c819['as'],'attributes':_0x49c819['attributes'],'include':_0x49c819[_0xf394('0xd')]?_['map'](_0x49c819[_0xf394('0xd')],function(_0x43776a){return{'model':db[_0x43776a['model']],'as':_0x43776a['as'],'attributes':_0x43776a['attributes'],'include':_0x43776a[_0xf394('0xd')]?_[_0xf394('0xe')](_0x43776a[_0xf394('0xd')],function(_0xfb0e7b){return{'model':db[_0xfb0e7b['model']],'as':_0xfb0e7b['as'],'attributes':_0xfb0e7b[_0xf394('0xc')]};}):[]};}):[]};}):[]:[]})[_0xf394('0x10')](function(_0x2a6504){logger[_0xf394('0x11')](_0xf394('0x6'),_0x456c1b);logger[_0xf394('0x12')]('GetInterval',_0x456c1b,JSON['stringify'](_0x2a6504));_0x3c97d3(_0x2a6504);})[_0xf394('0x13')](function(_0x11fe8e){logger[_0xf394('0x14')](_0xf394('0x6'),_0x11fe8e[_0xf394('0x15')],_0x456c1b);_0x18f28d(_0xf4bee6[_0xf394('0x14')](0x1f4,_0x11fe8e['message']));});});};exports[_0xf394('0x16')]=function(_0x368a9f){var _0x22fc69=this;return new Promise(function(_0x4d5191,_0x1e0ef3){return db['Interval'][_0xf394('0x17')]({'raw':_0x368a9f[_0xf394('0x9')]?_0x368a9f['options'][_0xf394('0xa')]===undefined?!![]:![]:!![],'where':_0x368a9f[_0xf394('0x9')]?_0x368a9f['options'][_0xf394('0xb')]||null:null,'attributes':_0x368a9f['options']?_0x368a9f[_0xf394('0x9')][_0xf394('0xc')]||null:null,'include':_0x368a9f[_0xf394('0x9')]?_0x368a9f[_0xf394('0x9')]['include']?_['map'](_0x368a9f[_0xf394('0x9')][_0xf394('0xd')],function(_0x35fcfe){return{'model':db[_0x35fcfe['model']],'as':_0x35fcfe['as'],'attributes':_0x35fcfe['attributes'],'include':_0x35fcfe['include']?_[_0xf394('0xe')](_0x35fcfe['include'],function(_0x1073a4){return{'model':db[_0x1073a4[_0xf394('0xf')]],'as':_0x1073a4['as'],'attributes':_0x1073a4[_0xf394('0xc')],'include':_0x1073a4[_0xf394('0xd')]?_[_0xf394('0xe')](_0x1073a4[_0xf394('0xd')],function(_0x2a330f){return{'model':db[_0x2a330f[_0xf394('0xf')]],'as':_0x2a330f['as'],'attributes':_0x2a330f[_0xf394('0xc')]};}):[]};}):[]};}):[]:[]})[_0xf394('0x10')](function(_0x1fa376){logger['info']('ShowInterval',_0x368a9f);logger['debug']('ShowInterval',_0x368a9f,JSON[_0xf394('0x18')](_0x1fa376));_0x4d5191(_0x1fa376);})[_0xf394('0x13')](function(_0x5f53bf){logger['error'](_0xf394('0x16'),_0x5f53bf[_0xf394('0x15')],_0x368a9f);_0x1e0ef3(_0x22fc69['error'](0x1f4,_0x5f53bf[_0xf394('0x15')]));});});};function checkArrayOfIntervals(_0x4e3499,_0x3e6bd2){var _0x55ea65=[];return db[_0xf394('0x7')][_0xf394('0x8')]({'where':{'id':_0x4e3499}})[_0xf394('0x10')](function(_0x3b8048){_0x55ea65=_0x3b8048;return Promise['all'](_0x55ea65[_0xf394('0xe')](function(_0x374e32){return _0x374e32[_0xf394('0x19')](_0x3e6bd2);}));})[_0xf394('0x10')](function(_0x2fe05e){var _0x14904a=_0x2fe05e['reduce'](function(_0x5955d6,_0x5c26b6){return _0x5955d6||_0x5c26b6;},![]);logger[_0xf394('0x11')](util[_0xf394('0x1a')](_0xf394('0x1b'),_0x55ea65['map'](function(_0x444ade){return _0x444ade['name'];})['join'](',\x20'),_0x55ea65[_0xf394('0xe')](function(_0x34c0c4){return _0x34c0c4['id'];})[_0xf394('0x1c')](',\x20')));return _0x14904a;});}function checkSingleInterval(_0x1c8a80,_0x1944e0){return db[_0xf394('0x7')]['findById'](_0x1c8a80)[_0xf394('0x10')](function(_0x3e241c){if(_0x3e241c){logger['info'](util[_0xf394('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3e241c[_0xf394('0x1d')],_0x3e241c['id']));return _0x3e241c['ifTime'](_0x1944e0);}});}exports[_0xf394('0x1e')]=function(_0x32de6c){var _0x4f1501=_0x32de6c['intervalIds'];var _0x57643f=Array[_0xf394('0x1f')](_0x32de6c[_0xf394('0x20')])?_0x32de6c[_0xf394('0x20')]:typeof _0x32de6c[_0xf394('0x20')]==='string'?[_0x32de6c[_0xf394('0x20')]]:[];var _0x53d191=_0x32de6c[_0xf394('0x21')]||undefined;var _0x2b0e0a=![];if(_0x57643f[_0xf394('0x22')]){logger['info'](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x57643f[_0xf394('0x1c')](';\x20')));}if(_0x53d191){logger[_0xf394('0x11')](util[_0xf394('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x53d191));}logger['debug'](_0xf394('0x23'),_0x2b0e0a);logger[_0xf394('0x24')](_0xf394('0x1e'),_0x32de6c);return Promise[_0xf394('0x25')]()[_0xf394('0x10')](function(){if(Array['isArray'](_0x4f1501)){return checkArrayOfIntervals(_0x4f1501,_0x53d191);}else if(_0x4f1501){return checkSingleInterval(_0x4f1501,_0x53d191);}})[_0xf394('0x10')](function(_0x3bdcde){var _0x267176=_0x57643f[_0xf394('0x26')](function(_0x577daa,_0x3676f2){return _0x577daa||iftime(_0x3676f2,_0x53d191);},![]);_0x2b0e0a=_0x3bdcde||_0x267176;return _0x2b0e0a;})['catch'](function(_0x576b68){logger[_0xf394('0x14')](_0xf394('0x1e'),_0x32de6c,_0x576b68);throw this[_0xf394('0x14')](0x1f4,_0x576b68['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 05ce37b..1a62acb 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x3beb12,_0x98fdd){var _0x2251b3=function(_0xc445ab){while(--_0xc445ab){_0x3beb12['push'](_0x3beb12['shift']());}};_0x2251b3(++_0x98fdd);}(_0xdb28,0x106));var _0x8db2=function(_0x52f623,_0xfb3019){_0x52f623=_0x52f623-0x0;var _0x386b35=_0xdb28[_0x52f623];return _0x386b35;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbd09cb,_0x5c001d){_0xbd09cb=_0xbd09cb-0x0;var _0x13695b=_0x5f2f[_0xbd09cb];return _0x13695b;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 10f7c2c..b7e99cf 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 _0xdd6b=['fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','customfield_11504','customfield_10102','POST','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','headers','x-forwarded-for','remoteAddress','socket','connection','body','https','support','3eAmWpBVP0','summary','\x20from\x20','issuetype','Bug'];(function(_0x58de43,_0xcb8233){var _0x2ec8e4=function(_0x1249f6){while(--_0x1249f6){_0x58de43['push'](_0x58de43['shift']());}};_0x2ec8e4(++_0xcb8233);}(_0xdd6b,0x146));var _0xbdd6=function(_0x3a911e,_0xa48044){_0x3a911e=_0x3a911e-0x0;var _0x42d517=_0xdd6b[_0x3a911e];return _0x42d517;};'use strict';var BPromise=require('bluebird');var https=require(_0xbdd6('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0xbdd6('0x1');var PASSWORD=_0xbdd6('0x2');function openIssue(_0x4c5c15,_0x4bcd39){var _0x40659d={'fields':{'project':{'key':_0x4c5c15['key']||'MOTGUI'},'summary':(_0x4c5c15[_0xbdd6('0x3')]||'Report')+_0xbdd6('0x4')+_0x4c5c15['ip'],'description':_0x4c5c15['description']||JSON['stringify'](_0x4c5c15),'issuetype':{'name':_0x4c5c15[_0xbdd6('0x5')]||_0xbdd6('0x6')}}};_0x40659d[_0xbdd6('0x7')][_0xbdd6('0x8')]=_0x4c5c15[_0xbdd6('0x9')];_0x40659d[_0xbdd6('0x7')]['customfield_11501']=_0x4c5c15[_0xbdd6('0xa')];_0x40659d[_0xbdd6('0x7')][_0xbdd6('0xb')]=_0x4c5c15['newToken'];_0x40659d['fields'][_0xbdd6('0xc')]=_0x4c5c15['name'];_0x40659d['fields'][_0xbdd6('0xd')]=_0x4c5c15['reason'];_0x40659d[_0xbdd6('0x7')][_0xbdd6('0xe')]=_0x4c5c15['ip'];var _0x58884d={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xbdd6('0xf'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xbdd6('0x10')+new Buffer(USERNAME+':'+PASSWORD)[_0xbdd6('0x11')](_0xbdd6('0x12'))}};var _0x1b86e2=JSON[_0xbdd6('0x13')](_0x40659d);var _0x58ec5a=https[_0xbdd6('0x14')](_0x58884d,function(_0x4be38b){_0x4be38b[_0xbdd6('0x15')](_0xbdd6('0x16'));var _0x1a89d1='';_0x4be38b['on'](_0xbdd6('0x17'),function(_0x4c8a9d){_0x1a89d1+=_0x4c8a9d;});_0x4be38b['on'](_0xbdd6('0x18'),function(){if(_0x4bcd39){return _0x4bcd39[_0xbdd6('0x19')](_0x4be38b['statusCode'])['json'](JSON[_0xbdd6('0x1a')](_0x1a89d1));}});});_0x58ec5a['on']('error',function(_0x1ee476){if(_0x4bcd39){return _0x4bcd39[_0xbdd6('0x19')](0x1f4)[_0xbdd6('0x1b')]({'errors':[{'message':_0xbdd6('0x1c'),'type':_0xbdd6('0x1d')}]});}});_0x58ec5a['write'](_0x1b86e2);_0x58ec5a[_0xbdd6('0x18')]();}exports['openIssue']=openIssue;exports[_0xbdd6('0x1e')]=function(_0x5d912b,_0x2fc00d){_0x5d912b['body']['ip']=_0x5d912b[_0xbdd6('0x1f')][_0xbdd6('0x20')]||_0x5d912b['connection'][_0xbdd6('0x21')]||_0x5d912b[_0xbdd6('0x22')][_0xbdd6('0x21')]||_0x5d912b[_0xbdd6('0x23')]['socket']['remoteAddress'];return openIssue(_0x5d912b[_0xbdd6('0x24')],_0x2fc00d);}; \ No newline at end of file +var _0x6b16=['customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','end','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','connection','socket','remoteAddress','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email'];(function(_0x30d0d2,_0x1acda7){var _0x18bda9=function(_0x1e25c4){while(--_0x1e25c4){_0x30d0d2['push'](_0x30d0d2['shift']());}};_0x18bda9(++_0x1acda7);}(_0x6b16,0x71));var _0x66b1=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x6b16[_0x3da612];return _0x1a9d1d;};'use strict';var BPromise=require(_0x66b1('0x0'));var https=require('https');var logger=require(_0x66b1('0x1'))(_0x66b1('0x2'));var USERNAME='support';var PASSWORD=_0x66b1('0x3');function openIssue(_0x5f0a2f,_0x1eca6d){var _0x184f88={'fields':{'project':{'key':_0x5f0a2f[_0x66b1('0x4')]||_0x66b1('0x5')},'summary':(_0x5f0a2f[_0x66b1('0x6')]||_0x66b1('0x7'))+_0x66b1('0x8')+_0x5f0a2f['ip'],'description':_0x5f0a2f[_0x66b1('0x9')]||JSON[_0x66b1('0xa')](_0x5f0a2f),'issuetype':{'name':_0x5f0a2f[_0x66b1('0xb')]||_0x66b1('0xc')}}};_0x184f88[_0x66b1('0xd')][_0x66b1('0xe')]=_0x5f0a2f[_0x66b1('0xf')];_0x184f88[_0x66b1('0xd')][_0x66b1('0x10')]=_0x5f0a2f[_0x66b1('0x11')];_0x184f88[_0x66b1('0xd')][_0x66b1('0x12')]=_0x5f0a2f['newToken'];_0x184f88[_0x66b1('0xd')][_0x66b1('0x13')]=_0x5f0a2f['name'];_0x184f88['fields'][_0x66b1('0x14')]=_0x5f0a2f[_0x66b1('0x15')];_0x184f88['fields']['customfield_10102']=_0x5f0a2f['ip'];var _0x68d65d={'host':_0x66b1('0x16'),'port':0x1bb,'path':_0x66b1('0x17'),'method':_0x66b1('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x66b1('0x19')](_0x66b1('0x1a'))}};var _0x4e2ea9=JSON[_0x66b1('0xa')](_0x184f88);var _0x3893e1=https[_0x66b1('0x1b')](_0x68d65d,function(_0x57bf7b){_0x57bf7b[_0x66b1('0x1c')](_0x66b1('0x1d'));var _0x20e54b='';_0x57bf7b['on'](_0x66b1('0x1e'),function(_0x4b74f6){_0x20e54b+=_0x4b74f6;});_0x57bf7b['on'](_0x66b1('0x1f'),function(){if(_0x1eca6d){return _0x1eca6d['status'](_0x57bf7b['statusCode'])[_0x66b1('0x20')](JSON[_0x66b1('0x21')](_0x20e54b));}});});_0x3893e1['on']('error',function(_0x5b5a5e){if(_0x1eca6d){return _0x1eca6d['status'](0x1f4)[_0x66b1('0x20')]({'errors':[{'message':_0x66b1('0x22'),'type':_0x66b1('0x23')}]});}});_0x3893e1[_0x66b1('0x24')](_0x4e2ea9);_0x3893e1[_0x66b1('0x1f')]();}exports[_0x66b1('0x25')]=openIssue;exports['send']=function(_0x51317c,_0x492bdf){_0x51317c[_0x66b1('0x26')]['ip']=_0x51317c[_0x66b1('0x27')]['x-forwarded-for']||_0x51317c[_0x66b1('0x28')]['remoteAddress']||_0x51317c[_0x66b1('0x29')]['remoteAddress']||_0x51317c[_0x66b1('0x28')][_0x66b1('0x29')][_0x66b1('0x2a')];return openIssue(_0x51317c['body'],_0x492bdf);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cb0d011..84c9263 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 _0xb58b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x1c1312,_0x3b96d6){var _0x4a0144=function(_0x1fb411){while(--_0x1fb411){_0x1c1312['push'](_0x1c1312['shift']());}};_0x4a0144(++_0x3b96d6);}(_0xb58b,0x1f1));var _0xbb58=function(_0x169755,_0x3f50fa){_0x169755=_0x169755-0x0;var _0x582cc3=_0xb58b[_0x169755];return _0x582cc3;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')]('/',auth[_0xbb58('0x8')](),controller[_0xbb58('0xe')]);router['put'](_0xbb58('0xb'),auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0x10')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['destroy']);module[_0xbb58('0x11')]=router; \ No newline at end of file +var _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x1a7c8c,_0x419397){var _0x542dac=function(_0x4c6d1f){while(--_0x4c6d1f){_0x1a7c8c['push'](_0x1a7c8c['shift']());}};_0x542dac(++_0x419397);}(_0x5ff3,0x17d));var _0x35ff=function(_0xb55998,_0x57f17b){_0xb55998=_0xb55998-0x0;var _0x17a289=_0x5ff3[_0xb55998];return _0x17a289;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 93788f3..034ceea 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x932e99,_0x4fc584){_0x932e99=_0x932e99-0x0;var _0x3b1b60=_0x7a54[_0x932e99];return _0x3b1b60;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0xcba1d2,_0x4e170d){_0xcba1d2=_0xcba1d2-0x0;var _0x24d6e9=_0x7a54[_0xcba1d2];return _0x24d6e9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 28f66d8..a20aa8d 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 _0x9505=['save','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x9505,0x1e5));var _0x5950=function(_0xc1fd9e,_0x238c0c){_0xc1fd9e=_0xc1fd9e-0x0;var _0x122271=_0x9505[_0xc1fd9e];return _0x122271;};'use strict';var emlformat=require(_0x5950('0x0'));var rimraf=require(_0x5950('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5950('0x2'));var rp=require(_0x5950('0x3'));var moment=require(_0x5950('0x4'));var BPromise=require(_0x5950('0x5'));var Mustache=require(_0x5950('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5950('0x7'));var csv=require(_0x5950('0x8'));var ejs=require(_0x5950('0x9'));var fs=require('fs');var fs_extra=require(_0x5950('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5950('0xb'));var jsforce=require(_0x5950('0xc'));var deskjs=require(_0x5950('0xd'));var toCsv=require(_0x5950('0x8'));var querystring=require(_0x5950('0xe'));var Papa=require(_0x5950('0xf'));var Redis=require(_0x5950('0x10'));var authService=require(_0x5950('0x11'));var qs=require(_0x5950('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5950('0x13'));var logger=require(_0x5950('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5950('0x15'));var licenseUtil=require(_0x5950('0x16'));var db=require(_0x5950('0x17'))['db'];function respondWithStatusCode(_0x5f0e26,_0x1a7df6){_0x1a7df6=_0x1a7df6||0xcc;return function(_0x2bf7ae){if(_0x2bf7ae){return _0x5f0e26[_0x5950('0x18')](_0x1a7df6);}return _0x5f0e26[_0x5950('0x19')](_0x1a7df6)[_0x5950('0x1a')]();};}function respondWithResult(_0x384e80,_0x40fe84){_0x40fe84=_0x40fe84||0xc8;return function(_0x3ace79){if(_0x3ace79){return _0x384e80[_0x5950('0x19')](_0x40fe84)[_0x5950('0x1b')](_0x3ace79);}};}function respondWithFilteredResult(_0x5e9dd5,_0xa6c598){return function(_0x4ad4d8){if(_0x4ad4d8){var _0x3c469d=typeof _0xa6c598[_0x5950('0x1c')]===_0x5950('0x1d')&&typeof _0xa6c598[_0x5950('0x1e')]==='undefined';var _0x5a99e8=_0x4ad4d8[_0x5950('0x1f')];var _0x40f50c=_0x3c469d?0x0:_0xa6c598[_0x5950('0x1c')];var _0x5a9530=_0x3c469d?_0x4ad4d8[_0x5950('0x1f')]:_0xa6c598['offset']+_0xa6c598['limit'];var _0x119f1f;if(_0x5a9530>=_0x5a99e8){_0x5a9530=_0x5a99e8;_0x119f1f=0xc8;}else{_0x119f1f=0xce;}_0x5e9dd5[_0x5950('0x19')](_0x119f1f);return _0x5e9dd5[_0x5950('0x20')]('Content-Range',_0x40f50c+'-'+_0x5a9530+'/'+_0x5a99e8)[_0x5950('0x1b')](_0x4ad4d8);}return null;};}function patchUpdates(_0x3ea879){return function(_0x4aa0c2){try{jsonpatch['apply'](_0x4aa0c2,_0x3ea879,!![]);}catch(_0x53fdfe){return BPromise['reject'](_0x53fdfe);}return _0x4aa0c2[_0x5950('0x21')]();};}function saveUpdates(_0x110a57,_0x66c416){return function(_0x388ad0){if(_0x388ad0){return _0x388ad0['update'](_0x110a57)[_0x5950('0x22')](function(_0x3c58f4){return _0x3c58f4;});}return null;};}function removeEntity(_0x255243,_0x1bd0ad){return function(_0x4757fd){if(_0x4757fd){return _0x4757fd[_0x5950('0x23')]()[_0x5950('0x22')](function(){_0x255243['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2265,_0x32c197){return function(_0x545354){if(!_0x545354){_0x1b2265[_0x5950('0x18')](0x194);}return _0x545354;};}function handleError(_0x128241,_0x58167b){_0x58167b=_0x58167b||0x1f4;return function(_0x4a7b22){logger['error'](_0x4a7b22[_0x5950('0x24')]);if(_0x4a7b22[_0x5950('0x25')]){delete _0x4a7b22[_0x5950('0x25')];}_0x128241[_0x5950('0x19')](_0x58167b)[_0x5950('0x26')](_0x4a7b22);};}exports[_0x5950('0x27')]=function(_0x2ff8a3,_0x2dfd08){var _0x179b24={},_0x3a3cc0={},_0x24db8b={'count':0x0,'rows':[]};var _0x3ab143=_[_0x5950('0x28')](db[_0x5950('0x29')][_0x5950('0x2a')],function(_0x24fd58){return{'name':_0x24fd58[_0x5950('0x2b')],'type':_0x24fd58[_0x5950('0x2c')][_0x5950('0x2d')]};});_0x3a3cc0[_0x5950('0x2e')]=_[_0x5950('0x28')](_0x3ab143,_0x5950('0x25'));_0x3a3cc0[_0x5950('0x2f')]=_[_0x5950('0x30')](_0x2ff8a3[_0x5950('0x2f')]);_0x3a3cc0[_0x5950('0x31')]=_[_0x5950('0x32')](_0x3a3cc0[_0x5950('0x2e')],_0x3a3cc0['query']);_0x179b24[_0x5950('0x33')]=_[_0x5950('0x32')](_0x3a3cc0[_0x5950('0x2e')],qs[_0x5950('0x34')](_0x2ff8a3[_0x5950('0x2f')]['fields']));_0x179b24['attributes']=_0x179b24[_0x5950('0x33')][_0x5950('0x35')]?_0x179b24['attributes']:_0x3a3cc0[_0x5950('0x2e')];if(!_0x2ff8a3['query'][_0x5950('0x36')](_0x5950('0x37'))){_0x179b24[_0x5950('0x1e')]=qs['limit'](_0x2ff8a3[_0x5950('0x2f')]['limit']);_0x179b24[_0x5950('0x1c')]=qs[_0x5950('0x1c')](_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x1c')]);}_0x179b24['order']=qs[_0x5950('0x38')](_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x38')]);_0x179b24['where']=qs[_0x5950('0x31')](_[_0x5950('0x39')](_0x2ff8a3['query'],_0x3a3cc0['filters']),_0x3ab143);if(_0x2ff8a3['query'][_0x5950('0x3a')]){_0x179b24[_0x5950('0x3b')]=_[_0x5950('0x3c')](_0x179b24[_0x5950('0x3b')],{'$or':_[_0x5950('0x28')](_0x3ab143,function(_0x487f7e){if(_0x487f7e['type']!=='VIRTUAL'){var _0x4b534a={};_0x4b534a[_0x487f7e[_0x5950('0x25')]]={'$like':'%'+_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x3a')]+'%'};return _0x4b534a;}})});}_0x179b24=_[_0x5950('0x3c')]({},_0x179b24,_0x2ff8a3['options']);var _0x3fef7e={'where':_0x179b24[_0x5950('0x3b')]};return db['JscriptyAnswerReport'][_0x5950('0x1f')](_0x3fef7e)[_0x5950('0x22')](function(_0x537141){_0x24db8b[_0x5950('0x1f')]=_0x537141;if(_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x3d')]){_0x179b24[_0x5950('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5950('0x3f')](_0x179b24);})['then'](function(_0x27b4b2){_0x24db8b[_0x5950('0x40')]=_0x27b4b2;return _0x24db8b;})['then'](respondWithFilteredResult(_0x2dfd08,_0x179b24))[_0x5950('0x41')](handleError(_0x2dfd08,null));};exports[_0x5950('0x42')]=function(_0x3540d6,_0x2e9950){var _0x487a98={'raw':!![],'where':{'id':_0x3540d6[_0x5950('0x43')]['id']}},_0x18d31f={};_0x18d31f[_0x5950('0x2e')]=_[_0x5950('0x30')](db['JscriptyAnswerReport'][_0x5950('0x2a')]);_0x18d31f[_0x5950('0x2f')]=_[_0x5950('0x30')](_0x3540d6['query']);_0x18d31f[_0x5950('0x31')]=_['intersection'](_0x18d31f[_0x5950('0x2e')],_0x18d31f[_0x5950('0x2f')]);_0x487a98[_0x5950('0x33')]=_[_0x5950('0x32')](_0x18d31f[_0x5950('0x2e')],qs[_0x5950('0x34')](_0x3540d6[_0x5950('0x2f')]['fields']));_0x487a98[_0x5950('0x33')]=_0x487a98[_0x5950('0x33')][_0x5950('0x35')]?_0x487a98[_0x5950('0x33')]:_0x18d31f[_0x5950('0x2e')];if(_0x3540d6['query']['includeAll']){_0x487a98[_0x5950('0x3e')]=[{'all':!![]}];}_0x487a98=_[_0x5950('0x3c')]({},_0x487a98,_0x3540d6[_0x5950('0x44')]);return db['JscriptyAnswerReport'][_0x5950('0x45')](_0x487a98)[_0x5950('0x22')](handleEntityNotFound(_0x2e9950,null))[_0x5950('0x22')](respondWithResult(_0x2e9950,null))['catch'](handleError(_0x2e9950,null));};exports['create']=function(_0x49f202,_0x19eb55){return db[_0x5950('0x29')][_0x5950('0x46')](_0x49f202[_0x5950('0x47')],{})[_0x5950('0x22')](respondWithResult(_0x19eb55,0xc9))[_0x5950('0x41')](handleError(_0x19eb55,null));};exports[_0x5950('0x48')]=function(_0x18c744,_0x25d749){if(_0x18c744['body']['id']){delete _0x18c744[_0x5950('0x47')]['id'];}return db[_0x5950('0x29')][_0x5950('0x45')]({'where':{'id':_0x18c744[_0x5950('0x43')]['id']}})[_0x5950('0x22')](handleEntityNotFound(_0x25d749,null))[_0x5950('0x22')](saveUpdates(_0x18c744[_0x5950('0x47')],null))[_0x5950('0x22')](respondWithResult(_0x25d749,null))[_0x5950('0x41')](handleError(_0x25d749,null));};exports[_0x5950('0x23')]=function(_0x5a8c22,_0x5aaa8){return db[_0x5950('0x29')][_0x5950('0x45')]({'where':{'id':_0x5a8c22[_0x5950('0x43')]['id']}})['then'](handleEntityNotFound(_0x5aaa8,null))['then'](removeEntity(_0x5aaa8,null))[_0x5950('0x41')](handleError(_0x5aaa8,null));};exports[_0x5950('0x49')]=function(_0x4a40b3,_0x2aff57){return db[_0x5950('0x29')][_0x5950('0x49')]()[_0x5950('0x22')](respondWithResult(_0x2aff57,null))[_0x5950('0x41')](handleError(_0x2aff57,null));}; \ No newline at end of file +var _0xbacd=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xa63c7e,_0x2b8b9e){var _0x536a27=function(_0x35d05c){while(--_0x35d05c){_0xa63c7e['push'](_0xa63c7e['shift']());}};_0x536a27(++_0x2b8b9e);}(_0xbacd,0x1c5));var _0xdbac=function(_0xc418fc,_0x19bb95){_0xc418fc=_0xc418fc-0x0;var _0x2b137c=_0xbacd[_0xc418fc];return _0x2b137c;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x2b4cda,_0x3a0f3f){return function(_0x15653d){if(!_0x15653d){_0x2b4cda[_0xdbac('0x1b')](0x194);}return _0x15653d;};}function handleError(_0x175ebc,_0x2cb8b4){_0x2cb8b4=_0x2cb8b4||0x1f4;return function(_0x1ea3c3){logger[_0xdbac('0x29')](_0x1ea3c3[_0xdbac('0x2a')]);if(_0x1ea3c3[_0xdbac('0x2b')]){delete _0x1ea3c3[_0xdbac('0x2b')];}_0x175ebc[_0xdbac('0x1d')](_0x2cb8b4)[_0xdbac('0x2c')](_0x1ea3c3);};}exports[_0xdbac('0x2d')]=function(_0xe744cc,_0x1caa18){var _0x4e7ef9={},_0x446a32={},_0x397f3d={'count':0x0,'rows':[]};var _0x43c0a3=_[_0xdbac('0x2e')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x10c3c8){return{'name':_0x10c3c8[_0xdbac('0x2f')],'type':_0x10c3c8[_0xdbac('0x30')][_0xdbac('0x31')]};});_0x446a32['model']=_[_0xdbac('0x2e')](_0x43c0a3,_0xdbac('0x2b'));_0x446a32[_0xdbac('0x32')]=_[_0xdbac('0x33')](_0xe744cc[_0xdbac('0x32')]);_0x446a32[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],_0x446a32['query']);_0x4e7ef9['attributes']=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0xe744cc[_0xdbac('0x32')]['fields']));_0x4e7ef9['attributes']=_0x4e7ef9[_0xdbac('0x38')][_0xdbac('0x39')]?_0x4e7ef9[_0xdbac('0x38')]:_0x446a32[_0xdbac('0x36')];if(!_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3a')](_0xdbac('0x3b'))){_0x4e7ef9[_0xdbac('0x22')]=qs[_0xdbac('0x22')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x22')]);_0x4e7ef9[_0xdbac('0x1f')]=qs[_0xdbac('0x1f')](_0xe744cc['query'][_0xdbac('0x1f')]);}_0x4e7ef9['order']=qs[_0xdbac('0x3c')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3c')]);_0x4e7ef9[_0xdbac('0x3d')]=qs['filters'](_[_0xdbac('0x3e')](_0xe744cc[_0xdbac('0x32')],_0x446a32['filters']),_0x43c0a3);if(_0xe744cc['query'][_0xdbac('0x3f')]){_0x4e7ef9['where']=_['merge'](_0x4e7ef9[_0xdbac('0x3d')],{'$or':_[_0xdbac('0x2e')](_0x43c0a3,function(_0x6c5ecc){if(_0x6c5ecc['type']!==_0xdbac('0x40')){var _0x35f8b7={};_0x35f8b7[_0x6c5ecc[_0xdbac('0x2b')]]={'$like':'%'+_0xe744cc[_0xdbac('0x32')]['filter']+'%'};return _0x35f8b7;}})});}_0x4e7ef9=_['merge']({},_0x4e7ef9,_0xe744cc[_0xdbac('0x41')]);var _0x124904={'where':_0x4e7ef9[_0xdbac('0x3d')]};return db[_0xdbac('0x42')][_0xdbac('0x21')](_0x124904)['then'](function(_0x1a27a4){_0x397f3d[_0xdbac('0x21')]=_0x1a27a4;if(_0xe744cc['query'][_0xdbac('0x43')]){_0x4e7ef9[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x42')][_0xdbac('0x45')](_0x4e7ef9);})[_0xdbac('0x27')](function(_0x575b59){_0x397f3d[_0xdbac('0x46')]=_0x575b59;return _0x397f3d;})[_0xdbac('0x27')](respondWithFilteredResult(_0x1caa18,_0x4e7ef9))[_0xdbac('0x47')](handleError(_0x1caa18,null));};exports[_0xdbac('0x48')]=function(_0x726ba4,_0x25344a){var _0x2589e1={'raw':!![],'where':{'id':_0x726ba4[_0xdbac('0x49')]['id']}},_0x3c1894={};_0x3c1894[_0xdbac('0x36')]=_[_0xdbac('0x33')](db[_0xdbac('0x42')]['rawAttributes']);_0x3c1894['query']=_['keys'](_0x726ba4['query']);_0x3c1894[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],_0x3c1894[_0xdbac('0x32')]);_0x2589e1[_0xdbac('0x38')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0x726ba4[_0xdbac('0x32')]['fields']));_0x2589e1['attributes']=_0x2589e1['attributes'][_0xdbac('0x39')]?_0x2589e1[_0xdbac('0x38')]:_0x3c1894['model'];if(_0x726ba4['query']['includeAll']){_0x2589e1[_0xdbac('0x44')]=[{'all':!![]}];}_0x2589e1=_[_0xdbac('0x4a')]({},_0x2589e1,_0x726ba4[_0xdbac('0x41')]);return db['JscriptyAnswerReport'][_0xdbac('0x4b')](_0x2589e1)[_0xdbac('0x27')](handleEntityNotFound(_0x25344a,null))[_0xdbac('0x27')](respondWithResult(_0x25344a,null))[_0xdbac('0x47')](handleError(_0x25344a,null));};exports[_0xdbac('0x4c')]=function(_0x5b8aca,_0x35696f){return db[_0xdbac('0x42')][_0xdbac('0x4c')](_0x5b8aca[_0xdbac('0x4d')],{})['then'](respondWithResult(_0x35696f,0xc9))[_0xdbac('0x47')](handleError(_0x35696f,null));};exports[_0xdbac('0x26')]=function(_0x1463ca,_0x5d6e86){if(_0x1463ca[_0xdbac('0x4d')]['id']){delete _0x1463ca[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x42')][_0xdbac('0x4b')]({'where':{'id':_0x1463ca[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x5d6e86,null))['then'](saveUpdates(_0x1463ca[_0xdbac('0x4d')],null))[_0xdbac('0x27')](respondWithResult(_0x5d6e86,null))['catch'](handleError(_0x5d6e86,null));};exports[_0xdbac('0x28')]=function(_0x12b600,_0x26ee2e){return db[_0xdbac('0x42')]['find']({'where':{'id':_0x12b600['params']['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x26ee2e,null))[_0xdbac('0x27')](removeEntity(_0x26ee2e,null))['catch'](handleError(_0x26ee2e,null));};exports['describe']=function(_0x3f0b35,_0x538747){return db[_0xdbac('0x42')][_0xdbac('0x4e')]()[_0xdbac('0x27')](respondWithResult(_0x538747,null))['catch'](handleError(_0x538747,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index beeee7a..a5c4690 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 _0x3ab5=['bluebird','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','util','../../config/logger','moment'];(function(_0x4818e9,_0x55551f){var _0x1c8338=function(_0x34ce26){while(--_0x34ce26){_0x4818e9['push'](_0x4818e9['shift']());}};_0x1c8338(++_0x55551f);}(_0x3ab5,0x1ab));var _0x53ab=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3ab5[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require(_0x53ab('0x0'));var logger=require(_0x53ab('0x1'))('api');var moment=require(_0x53ab('0x2'));var BPromise=require(_0x53ab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53ab('0x4'));var rimraf=require(_0x53ab('0x5'));var config=require(_0x53ab('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x53ab('0x7')]=function(_0x1a9af5,_0x3672af){return _0x1a9af5[_0x53ab('0x8')](_0x53ab('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac8c=['path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird','request-promise'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xac8c,0x1b3));var _0xcac8=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0xac8c[_0x5224ba];return _0x459bd2;};'use strict';var _=require(_0xcac8('0x0'));var util=require(_0xcac8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcac8('0x2'));var BPromise=require(_0xcac8('0x3'));var rp=require(_0xcac8('0x4'));var fs=require('fs');var path=require(_0xcac8('0x5'));var rimraf=require(_0xcac8('0x6'));var config=require('../../config/environment');var attributes=require(_0xcac8('0x7'));module[_0xcac8('0x8')]=function(_0x50a2e5,_0x53ea85){return _0x50a2e5['define'](_0xcac8('0x9'),attributes,{'tableName':_0xcac8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 9a78e52..59dfdad 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 _0x81f1=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81f1,0x12e));var _0x181f=function(_0x49114c,_0x52691a){_0x49114c=_0x49114c-0x0;var _0x2dc558=_0x81f1[_0x49114c];return _0x2dc558;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require(_0x181f('0x4'));var fs=require('fs');var Redis=require(_0x181f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x181f('0x6'));var logger=require('../../config/logger')(_0x181f('0x7'));var config=require(_0x181f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7bb2,_0x238223,_0x45efc0){return new BPromise(function(_0x4da494,_0xf99901){return client[_0x181f('0x9')](_0x2c7bb2,_0x45efc0)['then'](function(_0x41d94b){logger[_0x181f('0xa')](_0x181f('0xb'),_0x238223,'request\x20sent');logger[_0x181f('0xc')](_0x181f('0xd'),_0x238223,_0x181f('0xe'),JSON[_0x181f('0xf')](_0x41d94b));if(_0x41d94b['error']){if(_0x41d94b[_0x181f('0x10')][_0x181f('0x11')]===0x1f4){logger[_0x181f('0x10')](_0x181f('0xb'),_0x238223,_0x41d94b['error'][_0x181f('0x12')]);return _0xf99901(_0x41d94b[_0x181f('0x10')][_0x181f('0x12')]);}logger[_0x181f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x238223,_0x41d94b[_0x181f('0x10')]['message']);return _0x4da494(_0x41d94b['error'][_0x181f('0x12')]);}else{logger['info'](_0x181f('0xb'),_0x238223,_0x181f('0xe'));_0x4da494(_0x41d94b[_0x181f('0x13')]['message']);}})[_0x181f('0x14')](function(_0x371cb2){logger[_0x181f('0x10')](_0x181f('0xb'),_0x238223,_0x371cb2);_0xf99901(_0x371cb2);});});} \ No newline at end of file +var _0x57cc=['jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x29e8e8,_0x5813cd){var _0xcb01bb=function(_0x480047){while(--_0x480047){_0x29e8e8['push'](_0x29e8e8['shift']());}};_0xcb01bb(++_0x5813cd);}(_0x57cc,0x15f));var _0xc57c=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x57cc[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xc57c('0x0'));var util=require(_0xc57c('0x1'));var moment=require(_0xc57c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc57c('0x3'));var fs=require('fs');var Redis=require(_0xc57c('0x4'));var db=require(_0xc57c('0x5'))['db'];var utils=require(_0xc57c('0x6'));var logger=require(_0xc57c('0x7'))('rpc');var config=require(_0xc57c('0x8'));var jayson=require(_0xc57c('0x9'));var client=jayson[_0xc57c('0xa')][_0xc57c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x355427,_0x27577b,_0x52abdf){return new BPromise(function(_0x1762eb,_0xc9417f){return client[_0xc57c('0xc')](_0x355427,_0x52abdf)['then'](function(_0x467be4){logger['info'](_0xc57c('0xd'),_0x27577b,_0xc57c('0xe'));logger[_0xc57c('0xf')](_0xc57c('0x10'),_0x27577b,_0xc57c('0xe'),JSON[_0xc57c('0x11')](_0x467be4));if(_0x467be4[_0xc57c('0x12')]){if(_0x467be4[_0xc57c('0x12')][_0xc57c('0x13')]===0x1f4){logger[_0xc57c('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27577b,_0x467be4['error'][_0xc57c('0x14')]);return _0xc9417f(_0x467be4[_0xc57c('0x12')][_0xc57c('0x14')]);}logger[_0xc57c('0x12')](_0xc57c('0xd'),_0x27577b,_0x467be4['error'][_0xc57c('0x14')]);return _0x1762eb(_0x467be4[_0xc57c('0x12')]['message']);}else{logger[_0xc57c('0x15')](_0xc57c('0xd'),_0x27577b,'request\x20sent');_0x1762eb(_0x467be4[_0xc57c('0x16')][_0xc57c('0x14')]);}})[_0xc57c('0x17')](function(_0x3c80e7){logger[_0xc57c('0x12')](_0xc57c('0xd'),_0x27577b,_0x3c80e7);_0xc9417f(_0x3c80e7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index fc8b3cc..e2a4fa0 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 _0xeccb=['/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b0cec,_0x3b1c8b){var _0x15d2c5=function(_0x196651){while(--_0x196651){_0x4b0cec['push'](_0x4b0cec['shift']());}};_0x15d2c5(++_0x3b1c8b);}(_0xeccb,0x175));var _0xbecc=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xeccb[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xbecc('0x0'));var util=require(_0xbecc('0x1'));var path=require(_0xbecc('0x2'));var timeout=require(_0xbecc('0x3'));var express=require('express');var router=express[_0xbecc('0x4')]();var fs_extra=require(_0xbecc('0x5'));var auth=require(_0xbecc('0x6'));var interaction=require(_0xbecc('0x7'));var config=require(_0xbecc('0x8'));var controller=require('./jscriptyProject.controller');router[_0xbecc('0x9')]('/',auth[_0xbecc('0xa')](),controller['index']);router[_0xbecc('0x9')](_0xbecc('0xb'),auth[_0xbecc('0xa')](),controller[_0xbecc('0xc')]);router[_0xbecc('0x9')](_0xbecc('0xd'),auth['isAuthenticated'](),controller[_0xbecc('0xe')]);router['get'](_0xbecc('0xf'),auth[_0xbecc('0xa')](),controller[_0xbecc('0x10')]);router['get'](_0xbecc('0x11'),auth[_0xbecc('0xa')](),timeout(_0xbecc('0x12')),controller['getSummary']);router['post']('/',auth[_0xbecc('0xa')](),controller[_0xbecc('0x13')]);router[_0xbecc('0x14')](_0xbecc('0x15'),auth[_0xbecc('0xa')](),controller['clone']);router['put'](_0xbecc('0xb'),auth[_0xbecc('0xa')](),controller[_0xbecc('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbecc('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb5c0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','put','/:id','update','delete'];(function(_0x51085f,_0x1cb2f0){var _0x455c86=function(_0x1eae65){while(--_0x1eae65){_0x51085f['push'](_0x51085f['shift']());}};_0x455c86(++_0x1cb2f0);}(_0xb5c0,0x113));var _0x0b5c=function(_0x925f25,_0x20b4ee){_0x925f25=_0x925f25-0x0;var _0x3d0ded=_0xb5c0[_0x925f25];return _0x3d0ded;};'use strict';var multer=require(_0x0b5c('0x0'));var util=require(_0x0b5c('0x1'));var path=require(_0x0b5c('0x2'));var timeout=require(_0x0b5c('0x3'));var express=require(_0x0b5c('0x4'));var router=express[_0x0b5c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0b5c('0x6'));var interaction=require(_0x0b5c('0x7'));var config=require('../../config/environment');var controller=require(_0x0b5c('0x8'));router[_0x0b5c('0x9')]('/',auth[_0x0b5c('0xa')](),controller[_0x0b5c('0xb')]);router[_0x0b5c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0b5c('0xc')]);router[_0x0b5c('0x9')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x0b5c('0xd')]);router['get'](_0x0b5c('0xe'),auth[_0x0b5c('0xa')](),controller[_0x0b5c('0xf')]);router['get'](_0x0b5c('0x10'),auth['isAuthenticated'](),timeout('30s'),controller[_0x0b5c('0x11')]);router['post']('/',auth[_0x0b5c('0xa')](),controller['create']);router[_0x0b5c('0x12')](_0x0b5c('0x13'),auth[_0x0b5c('0xa')](),controller[_0x0b5c('0x14')]);router[_0x0b5c('0x15')](_0x0b5c('0x16'),auth['isAuthenticated'](),controller[_0x0b5c('0x17')]);router[_0x0b5c('0x18')](_0x0b5c('0x16'),auth[_0x0b5c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7524a77..0439efc 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 _0xa2b1=['name','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util'];(function(_0x3bca95,_0x4c9622){var _0x4225cb=function(_0x19451c){while(--_0x19451c){_0x3bca95['push'](_0x3bca95['shift']());}};_0x4225cb(++_0x4c9622);}(_0xa2b1,0x86));var _0x1a2b=function(_0x37de67,_0x167daa){_0x37de67=_0x37de67-0x0;var _0x5ea429=_0xa2b1[_0x37de67];return _0x5ea429;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x1a2b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1a2b('0x1')},'description':{'type':Sequelize[_0x1a2b('0x2')]},'formData':{'type':Sequelize[_0x1a2b('0x3')](_0x1a2b('0x4')),'set':function(_0x5ded77){if(_[_0x1a2b('0x5')](_0x5ded77)){this['setDataValue'](_0x1a2b('0x6'),JSON[_0x1a2b('0x7')](_0x5ded77));}else if(_[_0x1a2b('0x8')](_0x5ded77)){this[_0x1a2b('0x9')](_0x1a2b('0x6'),_0x5ded77);}else{this[_0x1a2b('0x9')](_0x1a2b('0x6'),util[_0x1a2b('0xa')](_0x1a2b('0xb'),this[_0x1a2b('0xc')]('name')||'',this[_0x1a2b('0xc')](_0x1a2b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1a2b('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x2dd4=['isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long'];(function(_0x17ae70,_0x4c408b){var _0x44986f=function(_0x270cb2){while(--_0x270cb2){_0x17ae70['push'](_0x17ae70['shift']());}};_0x44986f(++_0x4c408b);}(_0x2dd4,0xe8));var _0x42dd=function(_0x121135,_0x2ebaa6){_0x121135=_0x121135-0x0;var _0x5a594a=_0x2dd4[_0x121135];return _0x5a594a;};'use strict';var Sequelize=require(_0x42dd('0x0'));var _=require(_0x42dd('0x1'));var util=require(_0x42dd('0x2'));module[_0x42dd('0x3')]={'name':{'type':Sequelize[_0x42dd('0x4')],'unique':_0x42dd('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x42dd('0x6')](_0x42dd('0x7')),'set':function(_0x88371b){if(_[_0x42dd('0x8')](_0x88371b)){this[_0x42dd('0x9')]('formData',JSON[_0x42dd('0xa')](_0x88371b));}else if(_[_0x42dd('0xb')](_0x88371b)){this['setDataValue'](_0x42dd('0xc'),_0x88371b);}else{this[_0x42dd('0x9')]('formData',util[_0x42dd('0xd')](_0x42dd('0xe'),this['getDataValue'](_0x42dd('0x5'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x42dd('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x42dd('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cfef04f..fd50804 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 _0x95af=['SessionId','answer','push','now','format','attachment;\x20filename=','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','clone','updatedAt','body','omit','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','JscriptySessionReport','where','pick','ProjectId','getAnswers','findOne','JscriptyAnswerReport','length','hasOwnProperty','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x95af,0x173));var _0xf95a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x95af[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xf95a('0x0'));var rimraf=require(_0xf95a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf95a('0x2'));var rp=require(_0xf95a('0x3'));var moment=require(_0xf95a('0x4'));var BPromise=require(_0xf95a('0x5'));var Mustache=require(_0xf95a('0x6'));var util=require(_0xf95a('0x7'));var path=require(_0xf95a('0x8'));var sox=require('sox');var csv=require(_0xf95a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf95a('0xa'));var _=require('lodash');var squel=require(_0xf95a('0xb'));var crypto=require(_0xf95a('0xc'));var jsforce=require(_0xf95a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf95a('0x9'));var querystring=require(_0xf95a('0xe'));var Papa=require('papaparse');var Redis=require(_0xf95a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf95a('0x10'));var as=require(_0xf95a('0x11'));var hardwareService=require(_0xf95a('0x12'));var logger=require(_0xf95a('0x13'))(_0xf95a('0x14'));var utils=require(_0xf95a('0x15'));var config=require(_0xf95a('0x16'));var licenseUtil=require(_0xf95a('0x17'));var db=require(_0xf95a('0x18'))['db'];function respondWithStatusCode(_0xc428f7,_0x2d9d0a){_0x2d9d0a=_0x2d9d0a||0xcc;return function(_0x22e042){if(_0x22e042){return _0xc428f7['sendStatus'](_0x2d9d0a);}return _0xc428f7[_0xf95a('0x19')](_0x2d9d0a)[_0xf95a('0x1a')]();};}function respondWithResult(_0x3b43d1,_0x570be5){_0x570be5=_0x570be5||0xc8;return function(_0x5449a0){if(_0x5449a0){return _0x3b43d1['status'](_0x570be5)[_0xf95a('0x1b')](_0x5449a0);}};}function respondWithFilteredResult(_0x54b9bc,_0x210561){return function(_0x2848b6){if(_0x2848b6){var _0x30fb30=typeof _0x210561['offset']===_0xf95a('0x1c')&&typeof _0x210561[_0xf95a('0x1d')]===_0xf95a('0x1c');var _0x3b47dc=_0x2848b6[_0xf95a('0x1e')];var _0x2991d1=_0x30fb30?0x0:_0x210561[_0xf95a('0x1f')];var _0x2144e4=_0x30fb30?_0x2848b6['count']:_0x210561[_0xf95a('0x1f')]+_0x210561[_0xf95a('0x1d')];var _0x2aefd7;if(_0x2144e4>=_0x3b47dc){_0x2144e4=_0x3b47dc;_0x2aefd7=0xc8;}else{_0x2aefd7=0xce;}_0x54b9bc[_0xf95a('0x19')](_0x2aefd7);return _0x54b9bc[_0xf95a('0x20')](_0xf95a('0x21'),_0x2991d1+'-'+_0x2144e4+'/'+_0x3b47dc)[_0xf95a('0x1b')](_0x2848b6);}return null;};}function patchUpdates(_0x53ffb1){return function(_0x57f0dd){try{jsonpatch[_0xf95a('0x22')](_0x57f0dd,_0x53ffb1,!![]);}catch(_0x3fea2f){return BPromise[_0xf95a('0x23')](_0x3fea2f);}return _0x57f0dd[_0xf95a('0x24')]();};}function saveUpdates(_0xdf912c,_0x3f3e07){return function(_0xc8cf5b){if(_0xc8cf5b){return _0xc8cf5b['update'](_0xdf912c)[_0xf95a('0x25')](function(_0x1c9a37){return _0x1c9a37;});}return null;};}function removeEntity(_0xaa985e,_0x4bbcca){return function(_0x3822f4){if(_0x3822f4){return _0x3822f4[_0xf95a('0x26')]()[_0xf95a('0x25')](function(){var _0x2a3de2=_0x3822f4[_0xf95a('0x27')]({'plain':!![]});var _0x43d3c3=_0xf95a('0x28');return db[_0xf95a('0x29')][_0xf95a('0x26')]({'where':{'type':_0x43d3c3,'resourceId':_0x2a3de2['id']}})[_0xf95a('0x25')](function(){return _0x3822f4;});})[_0xf95a('0x25')](function(){_0xaa985e['status'](0xcc)[_0xf95a('0x1a')]();});}};}function handleEntityNotFound(_0x555ba6,_0x37d4fc){return function(_0x50bdac){if(!_0x50bdac){_0x555ba6[_0xf95a('0x2a')](0x194);}return _0x50bdac;};}function handleError(_0x2cdef2,_0x2b0c26){_0x2b0c26=_0x2b0c26||0x1f4;return function(_0x495f46){logger[_0xf95a('0x2b')](_0x495f46['stack']);if(_0x495f46[_0xf95a('0x2c')]){delete _0x495f46[_0xf95a('0x2c')];}_0x2cdef2[_0xf95a('0x19')](_0x2b0c26)[_0xf95a('0x2d')](_0x495f46);};}exports[_0xf95a('0x2e')]=function(_0x3ff248,_0x1e1bf6){var _0x26f60b={},_0x30254c={},_0x525aca={'count':0x0,'rows':[]};var _0x24cf92=_[_0xf95a('0x2f')](db[_0xf95a('0x30')][_0xf95a('0x31')],function(_0x8269dd){return{'name':_0x8269dd['fieldName'],'type':_0x8269dd[_0xf95a('0x32')][_0xf95a('0x33')]};});_0x30254c[_0xf95a('0x34')]=_[_0xf95a('0x2f')](_0x24cf92,'name');_0x30254c[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x3ff248[_0xf95a('0x35')]);_0x30254c[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x30254c[_0xf95a('0x34')],_0x30254c[_0xf95a('0x35')]);_0x26f60b[_0xf95a('0x39')]=_['intersection'](_0x30254c[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3a')]));_0x26f60b['attributes']=_0x26f60b[_0xf95a('0x39')]['length']?_0x26f60b[_0xf95a('0x39')]:_0x30254c['model'];if(!_0x3ff248[_0xf95a('0x35')]['hasOwnProperty'](_0xf95a('0x3b'))){_0x26f60b['limit']=qs[_0xf95a('0x1d')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x26f60b[_0xf95a('0x1f')]=qs[_0xf95a('0x1f')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x1f')]);}_0x26f60b[_0xf95a('0x3c')]=qs[_0xf95a('0x3d')](_0x3ff248[_0xf95a('0x35')]['sort']);_0x26f60b['where']=qs['filters'](_['pick'](_0x3ff248[_0xf95a('0x35')],_0x30254c[_0xf95a('0x37')]),_0x24cf92);if(_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x26f60b['where']=_[_0xf95a('0x3f')](_0x26f60b['where'],{'$or':_['map'](_0x24cf92,function(_0x5f480c){if(_0x5f480c['type']!=='VIRTUAL'){var _0x55f9cd={};_0x55f9cd[_0x5f480c['name']]={'$like':'%'+_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x55f9cd;}})});}_0x26f60b=_[_0xf95a('0x3f')]({},_0x26f60b,_0x3ff248[_0xf95a('0x40')]);var _0x346c07={'where':_0x26f60b['where']};return db[_0xf95a('0x30')][_0xf95a('0x1e')](_0x346c07)[_0xf95a('0x25')](function(_0x229a43){_0x525aca[_0xf95a('0x1e')]=_0x229a43;if(_0x3ff248[_0xf95a('0x35')][_0xf95a('0x41')]){_0x26f60b[_0xf95a('0x42')]=[{'all':!![]}];}return db[_0xf95a('0x30')][_0xf95a('0x43')](_0x26f60b);})[_0xf95a('0x25')](function(_0x21ac65){_0x525aca[_0xf95a('0x44')]=_0x21ac65;return _0x525aca;})[_0xf95a('0x25')](respondWithFilteredResult(_0x1e1bf6,_0x26f60b))[_0xf95a('0x45')](handleError(_0x1e1bf6,null));};exports[_0xf95a('0x46')]=function(_0x335cdb,_0xae7d03){var _0x161009={'raw':![],'where':{'id':_0x335cdb[_0xf95a('0x47')]['id']}},_0x3fa445={};_0x3fa445['model']=_[_0xf95a('0x36')](db[_0xf95a('0x30')]['rawAttributes']);_0x3fa445[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x335cdb['query']);_0x3fa445[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x3fa445[_0xf95a('0x34')],_0x3fa445[_0xf95a('0x35')]);_0x161009[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x3fa445[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x335cdb[_0xf95a('0x35')]['fields']));_0x161009['attributes']=_0x161009[_0xf95a('0x39')]['length']?_0x161009[_0xf95a('0x39')]:_0x3fa445[_0xf95a('0x34')];if(_0x335cdb[_0xf95a('0x35')][_0xf95a('0x41')]){_0x161009[_0xf95a('0x42')]=[{'all':!![]}];}_0x161009=_[_0xf95a('0x3f')]({},_0x161009,_0x335cdb[_0xf95a('0x40')]);return db[_0xf95a('0x30')][_0xf95a('0x48')](_0x161009)[_0xf95a('0x25')](handleEntityNotFound(_0xae7d03,null))[_0xf95a('0x25')](respondWithResult(_0xae7d03,null))['catch'](handleError(_0xae7d03,null));};exports[_0xf95a('0x49')]=function(_0x50fe90,_0x444941){return db[_0xf95a('0x30')][_0xf95a('0x49')](_0x50fe90['body'],{})['then'](function(_0x591b93){var _0x313f00=_0x50fe90['user'][_0xf95a('0x27')]({'plain':!![]});if(!_0x313f00)throw new Error(_0xf95a('0x4a'));if(_0x313f00[_0xf95a('0x4b')]===_0xf95a('0x4c')){var _0x3ee09b=_0x591b93[_0xf95a('0x27')]({'plain':!![]});var _0x333430=_0xf95a('0x28');return db['UserProfileSection'][_0xf95a('0x48')]({'where':{'name':_0x333430,'userProfileId':_0x313f00[_0xf95a('0x4d')]},'raw':!![]})[_0xf95a('0x25')](function(_0x4e21da){if(_0x4e21da&&_0x4e21da[_0xf95a('0x4e')]===0x0){return db['UserProfileResource'][_0xf95a('0x49')]({'name':_0x3ee09b[_0xf95a('0x2c')],'resourceId':_0x3ee09b['id'],'type':_0x4e21da[_0xf95a('0x2c')],'sectionId':_0x4e21da['id']},{})['then'](function(){return _0x591b93;});}else{return _0x591b93;}})['catch'](function(_0x421603){logger[_0xf95a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x421603);throw _0x421603;});}return _0x591b93;})[_0xf95a('0x25')](respondWithResult(_0x444941,0xc9))[_0xf95a('0x45')](handleError(_0x444941,null));};exports[_0xf95a('0x4f')]=function(_0x4848e3,_0x496e19){var _0x34ee1e={'where':{'id':_0x4848e3[_0xf95a('0x47')]['id']}},_0x4ce528={};_0x4ce528[_0xf95a('0x34')]=_[_0xf95a('0x36')](db[_0xf95a('0x30')]['rawAttributes']);_0x34ee1e[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x4ce528[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x4848e3['query'][_0xf95a('0x3a')]));_0x34ee1e['attributes']=_0x34ee1e[_0xf95a('0x39')]['length']?_0x34ee1e[_0xf95a('0x39')]:_0x4ce528['model'];if(_0x4848e3['query']['includeAll']){_0x34ee1e[_0xf95a('0x42')]=[{'all':!![]}];}_0x34ee1e=_[_0xf95a('0x3f')]({},_0x34ee1e,_0x4848e3[_0xf95a('0x40')]);return db[_0xf95a('0x30')][_0xf95a('0x48')](_0x34ee1e)[_0xf95a('0x25')](handleEntityNotFound(_0x496e19,null))['then'](function(_0x169927){if(_0x169927){var _0x4e742f=_0x169927[_0xf95a('0x27')]({'plain':!![]});_0x4e742f=qs['omit'](_0x4e742f,['id','createdAt',_0xf95a('0x50')]);_0x4848e3[_0xf95a('0x51')]=_[_0xf95a('0x52')](_0x4848e3[_0xf95a('0x51')],['id',_0xf95a('0x53'),_0xf95a('0x50')]);return db[_0xf95a('0x30')]['create'](_[_0xf95a('0x3f')](_0x4e742f,_0x4848e3[_0xf95a('0x51')]),{'include':_0x4848e3['query'][_0xf95a('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x1bbee1){var _0x5cc442=_0x4848e3[_0xf95a('0x4c')][_0xf95a('0x27')]({'plain':!![]});if(!_0x5cc442)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc442[_0xf95a('0x4b')]==='user'){var _0x2dc4a0=_0x1bbee1[_0xf95a('0x27')]({'plain':!![]});var _0x4a6d18=_0xf95a('0x28');return db[_0xf95a('0x54')][_0xf95a('0x48')]({'where':{'name':_0x4a6d18,'userProfileId':_0x5cc442[_0xf95a('0x4d')]},'raw':!![]})['then'](function(_0x193d1b){if(_0x193d1b&&_0x193d1b[_0xf95a('0x4e')]===0x0){return db[_0xf95a('0x29')][_0xf95a('0x49')]({'name':_0x2dc4a0[_0xf95a('0x2c')],'resourceId':_0x2dc4a0['id'],'type':_0x193d1b[_0xf95a('0x2c')],'sectionId':_0x193d1b['id']},{})[_0xf95a('0x25')](function(){return _0x1bbee1;});}else{return _0x1bbee1;}})[_0xf95a('0x45')](function(_0x506081){logger[_0xf95a('0x2b')](_0xf95a('0x55'),_0x506081);throw _0x506081;});}return _0x1bbee1;});}})[_0xf95a('0x25')](respondWithResult(_0x496e19,0xc9))['catch'](handleError(_0x496e19,null));};exports[_0xf95a('0x56')]=function(_0x358fcf,_0x1a1c74){if(_0x358fcf[_0xf95a('0x51')]['id']){delete _0x358fcf[_0xf95a('0x51')]['id'];}return db[_0xf95a('0x30')][_0xf95a('0x48')]({'where':{'id':_0x358fcf[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x1a1c74,null))['then'](saveUpdates(_0x358fcf[_0xf95a('0x51')],null))[_0xf95a('0x25')](respondWithResult(_0x1a1c74,null))[_0xf95a('0x45')](handleError(_0x1a1c74,null));};exports[_0xf95a('0x26')]=function(_0x350405,_0x57cf44){return db['JscriptyProject']['find']({'where':{'id':_0x350405[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x57cf44,null))['then'](removeEntity(_0x57cf44,null))[_0xf95a('0x45')](handleError(_0x57cf44,null));};exports[_0xf95a('0x57')]=function(_0x540280,_0x7dbc40,_0x1a285d){var _0x51b58a={'raw':!![],'where':{}};var _0x537da6={};var _0x5d8ad2={'count':0x0,'rows':[]};return db[_0xf95a('0x30')]['findOne']({'where':{'id':_0x540280[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x7dbc40,null))[_0xf95a('0x25')](function(_0x3166b7){if(_0x3166b7){_0x537da6[_0xf95a('0x34')]=_[_0xf95a('0x36')](db[_0xf95a('0x58')][_0xf95a('0x31')]);_0x537da6[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x540280[_0xf95a('0x35')]);_0x537da6[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x537da6[_0xf95a('0x34')],_0x537da6[_0xf95a('0x35')]);_0x51b58a['attributes']=_[_0xf95a('0x38')](_0x537da6[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x540280['query'][_0xf95a('0x3a')]));_0x51b58a[_0xf95a('0x39')]=_0x51b58a[_0xf95a('0x39')]['length']?_0x51b58a[_0xf95a('0x39')]:_0x537da6['model'];if(!_0x540280['query']['hasOwnProperty'](_0xf95a('0x3b'))){_0x51b58a[_0xf95a('0x1d')]=qs[_0xf95a('0x1d')](_0x540280[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x51b58a[_0xf95a('0x1f')]=qs['offset'](_0x540280[_0xf95a('0x35')][_0xf95a('0x1f')]);}_0x51b58a[_0xf95a('0x3c')]=qs[_0xf95a('0x3d')](_0x540280[_0xf95a('0x35')]['sort']);_0x51b58a[_0xf95a('0x59')]=qs[_0xf95a('0x37')](_[_0xf95a('0x5a')](_0x540280[_0xf95a('0x35')],_0x537da6[_0xf95a('0x37')]));_0x51b58a[_0xf95a('0x59')][_0xf95a('0x5b')]=_0x3166b7['id'];if(_0x540280[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x51b58a[_0xf95a('0x59')]=_[_0xf95a('0x3f')](_0x51b58a[_0xf95a('0x59')],{'$or':_[_0xf95a('0x2f')](_0x51b58a[_0xf95a('0x39')],function(_0x3561b7){var _0x27d81d={};_0x27d81d[_0x3561b7]={'$like':'%'+_0x540280[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x27d81d;})});}_0x51b58a=_[_0xf95a('0x3f')]({},_0x51b58a,_0x540280[_0xf95a('0x40')]);return db[_0xf95a('0x58')]['count']({'where':_0x51b58a[_0xf95a('0x59')]})['then'](function(_0x163f7d){_0x5d8ad2[_0xf95a('0x1e')]=_0x163f7d;if(_0x540280[_0xf95a('0x35')][_0xf95a('0x41')]){_0x51b58a[_0xf95a('0x42')]=[{'all':!![]}];}return db[_0xf95a('0x58')][_0xf95a('0x43')](_0x51b58a);})[_0xf95a('0x25')](function(_0x558ba7){_0x5d8ad2[_0xf95a('0x44')]=_0x558ba7;return _0x5d8ad2;});}})['then'](respondWithFilteredResult(_0x7dbc40,_0x51b58a))[_0xf95a('0x45')](handleError(_0x7dbc40,null));};exports[_0xf95a('0x5c')]=function(_0x3783be,_0xce7022,_0xbd0c0a){var _0x3fbc67={'raw':!![],'where':{}};var _0x5cfc5b={};var _0x37f6f8={'count':0x0,'rows':[]};return db[_0xf95a('0x30')][_0xf95a('0x5d')]({'where':{'id':_0x3783be['params']['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0xce7022,null))[_0xf95a('0x25')](function(_0xde4606){if(_0xde4606){_0x5cfc5b['model']=_[_0xf95a('0x36')](db[_0xf95a('0x5e')][_0xf95a('0x31')]);_0x5cfc5b[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x3783be[_0xf95a('0x35')]);_0x5cfc5b[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x5cfc5b['model'],_0x5cfc5b[_0xf95a('0x35')]);_0x3fbc67[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x5cfc5b[_0xf95a('0x34')],qs['fields'](_0x3783be[_0xf95a('0x35')]['fields']));_0x3fbc67[_0xf95a('0x39')]=_0x3fbc67[_0xf95a('0x39')][_0xf95a('0x5f')]?_0x3fbc67['attributes']:_0x5cfc5b[_0xf95a('0x34')];if(!_0x3783be[_0xf95a('0x35')][_0xf95a('0x60')](_0xf95a('0x3b'))){_0x3fbc67[_0xf95a('0x1d')]=qs[_0xf95a('0x1d')](_0x3783be[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x3fbc67[_0xf95a('0x1f')]=qs['offset'](_0x3783be['query'][_0xf95a('0x1f')]);}_0x3fbc67[_0xf95a('0x3c')]=qs['sort'](_0x3783be[_0xf95a('0x35')][_0xf95a('0x3d')]);_0x3fbc67['where']=qs['filters'](_[_0xf95a('0x5a')](_0x3783be['query'],_0x5cfc5b[_0xf95a('0x37')]));_0x3fbc67['where'][_0xf95a('0x5b')]=_0xde4606['id'];if(_0x3783be[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x3fbc67['where']=_[_0xf95a('0x3f')](_0x3fbc67[_0xf95a('0x59')],{'$or':_[_0xf95a('0x2f')](_0x3fbc67[_0xf95a('0x39')],function(_0x34e22c){var _0x30dd29={};_0x30dd29[_0x34e22c]={'$like':'%'+_0x3783be[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x30dd29;})});}_0x3fbc67=_[_0xf95a('0x3f')]({},_0x3fbc67,_0x3783be[_0xf95a('0x40')]);return db[_0xf95a('0x5e')]['count']({'where':_0x3fbc67[_0xf95a('0x59')]})[_0xf95a('0x25')](function(_0x377907){_0x37f6f8[_0xf95a('0x1e')]=_0x377907;if(_0x3783be['query']['includeAll']){_0x3fbc67['include']=[{'all':!![]}];}return db[_0xf95a('0x5e')]['findAll'](_0x3fbc67);})[_0xf95a('0x25')](function(_0x328d07){_0x37f6f8[_0xf95a('0x44')]=_0x328d07;return _0x37f6f8;});}})[_0xf95a('0x25')](respondWithFilteredResult(_0xce7022,_0x3fbc67))[_0xf95a('0x45')](handleError(_0xce7022,null));};function char(_0x212a91){return'number'===typeof _0x212a91?String[_0xf95a('0x61')][_0xf95a('0x22')](null,arguments):_0x212a91;}function needsEncapsulation(_0xec0bd6){return!!_0xec0bd6&&(_0xec0bd6[_0xf95a('0x62')]()['indexOf'](char(0xd))>=0x0||_0xec0bd6[_0xf95a('0x62')]()[_0xf95a('0x63')](char(0xa))>=0x0||_0xec0bd6[_0xf95a('0x62')]()[_0xf95a('0x63')](char(0x2c))>=0x0||_0xec0bd6[_0xf95a('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x434b9e){var _0x58a1fa=char(0x22),_0x3919f8='\x5c'+char(0x22),_0xd218d7=_0x434b9e[_0xf95a('0x62')]()['replace'](new RegExp(_0x58a1fa,'g'),_0x3919f8);return _0x58a1fa+_0xd218d7+_0x58a1fa;}exports[_0xf95a('0x64')]=function(_0x4faf15,_0x16c6b1,_0x2675ad){var _0x17991b,_0x38126f;var _0x5b4954={'where':{'ProjectId':_0x4faf15[_0xf95a('0x47')]['id']}};if(_0x4faf15[_0xf95a('0x35')][_0xf95a('0x65')]){_0x5b4954[_0xf95a('0x59')]['starttime']=JSON[_0xf95a('0x66')](_0x4faf15[_0xf95a('0x35')]['startTime']);}return db['JscriptySessionReport'][_0xf95a('0x43')](_0x5b4954)['then'](handleEntityNotFound(_0x16c6b1,null))[_0xf95a('0x25')](function(_0x8ad125){if(_0x8ad125){_0x17991b=_0x8ad125;return db[_0xf95a('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0xf95a('0x2f')](_0x17991b,'id')},'ProjectId':_0x4faf15['params']['id']},'order':_0xf95a('0x68')});}})[_0xf95a('0x25')](handleEntityNotFound(_0x16c6b1,null))[_0xf95a('0x25')](function(_0x27aa3e){if(_0x27aa3e){_0x38126f=_0x27aa3e;var _0x580da8={};for(var _0x4cba66=0x0,_0x26b60c=_0x38126f['length'];_0x4cba66<_0x26b60c;_0x4cba66++){if(!_0x580da8['hasOwnProperty'](_0x38126f[_0x4cba66][_0xf95a('0x69')])){_0x580da8[_0x38126f[_0x4cba66][_0xf95a('0x69')]]=needsEncapsulation(_0x38126f[_0x4cba66][_0xf95a('0x6a')])?encapsulate(_0x38126f[_0x4cba66][_0xf95a('0x6a')]):_0x38126f[_0x4cba66]['question'];}}var _0x4aa07d=[],_0x1d68ca={};for(var _0x521e4=0x0,_0x4755d0=_0x17991b[_0xf95a('0x5f')];_0x521e4<_0x4755d0;_0x521e4++){_0x1d68ca={'ProjectId':_0x4faf15[_0xf95a('0x47')]['id'],'SessionId':_0x17991b[_0x521e4]['id'],'StartTime':moment(_0x17991b[_0x521e4][_0xf95a('0x6b')])['format'](_0xf95a('0x6c'))};for(var _0x3b5d66=0x0,_0xf97ddc=_0x38126f[_0xf95a('0x5f')];_0x3b5d66<_0xf97ddc;_0x3b5d66++){if(_0x38126f[_0x3b5d66][_0xf95a('0x6d')]==_0x17991b[_0x521e4]['id']&&_0x580da8[_0xf95a('0x60')](_0x38126f[_0x3b5d66][_0xf95a('0x69')])){_0x1d68ca[_0x580da8[_0x38126f[_0x3b5d66][_0xf95a('0x69')]]]=_0x38126f[_0x3b5d66][_0xf95a('0x6e')];}}for(var _0x554291 in _0x580da8){if(!_0x1d68ca[_0xf95a('0x60')](_0x580da8[_0x554291])){_0x1d68ca[_0x580da8[_0x554291]]=null;}}_0x4aa07d[_0xf95a('0x6f')](_0x1d68ca);}return _0x4aa07d;}})[_0xf95a('0x25')](function(_0x3f7c77){if(!_['isEmpty'](_0x3f7c77)){var _0x2fc802=toCsv(_0x3f7c77);var _0x44c898=Date[_0xf95a('0x70')]();fs['writeFileSync'](util[_0xf95a('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898),_0x2fc802);_0x16c6b1['setHeader']('Content-disposition',_0xf95a('0x72')+util[_0xf95a('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898));_0x16c6b1[_0xf95a('0x73')](_0xf95a('0x74'),_0xf95a('0x75'));return _0x16c6b1[_0xf95a('0x76')](util[_0xf95a('0x71')](_0xf95a('0x77'),_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898));}else{return _0x16c6b1['sendStatus'](0xcc);}})[_0xf95a('0x45')](handleError(_0x16c6b1,null));}; \ No newline at end of file +var _0x8227=['undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','order','ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3ae3af,_0x423ded){var _0x3cec82=function(_0x4bfdfe){while(--_0x4bfdfe){_0x3ae3af['push'](_0x3ae3af['shift']());}};_0x3cec82(++_0x423ded);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7822('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7822('0x1'));var rp=require(_0x7822('0x2'));var moment=require(_0x7822('0x3'));var BPromise=require(_0x7822('0x4'));var Mustache=require('mustache');var util=require(_0x7822('0x5'));var path=require(_0x7822('0x6'));var sox=require(_0x7822('0x7'));var csv=require(_0x7822('0x8'));var ejs=require(_0x7822('0x9'));var fs=require('fs');var fs_extra=require(_0x7822('0xa'));var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x8'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var licenseUtil=require(_0x7822('0x16'));var db=require(_0x7822('0x17'))['db'];function respondWithStatusCode(_0x2c21d0,_0x3f6355){_0x3f6355=_0x3f6355||0xcc;return function(_0x5e4623){if(_0x5e4623){return _0x2c21d0['sendStatus'](_0x3f6355);}return _0x2c21d0[_0x7822('0x18')](_0x3f6355)[_0x7822('0x19')]();};}function respondWithResult(_0x5bd7e0,_0x30d3d5){_0x30d3d5=_0x30d3d5||0xc8;return function(_0xe46f15){if(_0xe46f15){return _0x5bd7e0[_0x7822('0x18')](_0x30d3d5)[_0x7822('0x1a')](_0xe46f15);}};}function respondWithFilteredResult(_0x411d99,_0x5c13de){return function(_0x4a8b06){if(_0x4a8b06){var _0x154c49=typeof _0x5c13de[_0x7822('0x1b')]===_0x7822('0x1c')&&typeof _0x5c13de[_0x7822('0x1d')]===_0x7822('0x1c');var _0x9ec4ee=_0x4a8b06[_0x7822('0x1e')];var _0x3f1f94=_0x154c49?0x0:_0x5c13de[_0x7822('0x1b')];var _0x4343b8=_0x154c49?_0x4a8b06[_0x7822('0x1e')]:_0x5c13de[_0x7822('0x1b')]+_0x5c13de[_0x7822('0x1d')];var _0x18ae02;if(_0x4343b8>=_0x9ec4ee){_0x4343b8=_0x9ec4ee;_0x18ae02=0xc8;}else{_0x18ae02=0xce;}_0x411d99[_0x7822('0x18')](_0x18ae02);return _0x411d99[_0x7822('0x1f')]('Content-Range',_0x3f1f94+'-'+_0x4343b8+'/'+_0x9ec4ee)[_0x7822('0x1a')](_0x4a8b06);}return null;};}function patchUpdates(_0x2a25e2){return function(_0x1780c6){try{jsonpatch[_0x7822('0x20')](_0x1780c6,_0x2a25e2,!![]);}catch(_0x171173){return BPromise['reject'](_0x171173);}return _0x1780c6[_0x7822('0x21')]();};}function saveUpdates(_0x497e04,_0x509ee8){return function(_0x275e99){if(_0x275e99){return _0x275e99[_0x7822('0x22')](_0x497e04)[_0x7822('0x23')](function(_0x12a6bd){return _0x12a6bd;});}return null;};}function removeEntity(_0x5599f8,_0x53269e){return function(_0xf0f816){if(_0xf0f816){return _0xf0f816[_0x7822('0x24')]()[_0x7822('0x23')](function(){var _0x53f827=_0xf0f816[_0x7822('0x25')]({'plain':!![]});var _0x202c97='Projects';return db[_0x7822('0x26')][_0x7822('0x24')]({'where':{'type':_0x202c97,'resourceId':_0x53f827['id']}})[_0x7822('0x23')](function(){return _0xf0f816;});})['then'](function(){_0x5599f8[_0x7822('0x18')](0xcc)[_0x7822('0x19')]();});}};}function handleEntityNotFound(_0x30d46d,_0x470dcd){return function(_0x26ef14){if(!_0x26ef14){_0x30d46d[_0x7822('0x27')](0x194);}return _0x26ef14;};}function handleError(_0x54aa99,_0x2dd015){_0x2dd015=_0x2dd015||0x1f4;return function(_0x190cb2){logger[_0x7822('0x28')](_0x190cb2[_0x7822('0x29')]);if(_0x190cb2[_0x7822('0x2a')]){delete _0x190cb2[_0x7822('0x2a')];}_0x54aa99[_0x7822('0x18')](_0x2dd015)[_0x7822('0x2b')](_0x190cb2);};}exports[_0x7822('0x2c')]=function(_0x51da51,_0x4d7d6b){var _0x52865b={},_0x1838cb={},_0x2fe314={'count':0x0,'rows':[]};var _0x53e41a=_[_0x7822('0x2d')](db[_0x7822('0x2e')]['rawAttributes'],function(_0x25aadd){return{'name':_0x25aadd[_0x7822('0x2f')],'type':_0x25aadd[_0x7822('0x30')]['key']};});_0x1838cb['model']=_[_0x7822('0x2d')](_0x53e41a,'name');_0x1838cb['query']=_[_0x7822('0x31')](_0x51da51['query']);_0x1838cb[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],_0x1838cb['query']);_0x52865b[_0x7822('0x35')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51da51[_0x7822('0x37')][_0x7822('0x36')]));_0x52865b[_0x7822('0x35')]=_0x52865b['attributes'][_0x7822('0x38')]?_0x52865b[_0x7822('0x35')]:_0x1838cb[_0x7822('0x34')];if(!_0x51da51[_0x7822('0x37')][_0x7822('0x39')]('nolimit')){_0x52865b['limit']=qs[_0x7822('0x1d')](_0x51da51['query'][_0x7822('0x1d')]);_0x52865b[_0x7822('0x1b')]=qs[_0x7822('0x1b')](_0x51da51[_0x7822('0x37')]['offset']);}_0x52865b['order']=qs[_0x7822('0x3a')](_0x51da51[_0x7822('0x37')]['sort']);_0x52865b[_0x7822('0x3b')]=qs[_0x7822('0x32')](_['pick'](_0x51da51['query'],_0x1838cb[_0x7822('0x32')]),_0x53e41a);if(_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]){_0x52865b['where']=_[_0x7822('0x3d')](_0x52865b[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x53e41a,function(_0x82a582){if(_0x82a582[_0x7822('0x30')]!==_0x7822('0x3e')){var _0x5b2476={};_0x5b2476[_0x82a582[_0x7822('0x2a')]]={'$like':'%'+_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x5b2476;}})});}_0x52865b=_[_0x7822('0x3d')]({},_0x52865b,_0x51da51[_0x7822('0x3f')]);var _0x55731c={'where':_0x52865b[_0x7822('0x3b')]};return db[_0x7822('0x2e')][_0x7822('0x1e')](_0x55731c)[_0x7822('0x23')](function(_0x5c7b50){_0x2fe314[_0x7822('0x1e')]=_0x5c7b50;if(_0x51da51[_0x7822('0x37')]['includeAll']){_0x52865b[_0x7822('0x40')]=[{'all':!![]}];}return db[_0x7822('0x2e')][_0x7822('0x41')](_0x52865b);})[_0x7822('0x23')](function(_0x45ae4c){_0x2fe314[_0x7822('0x42')]=_0x45ae4c;return _0x2fe314;})['then'](respondWithFilteredResult(_0x4d7d6b,_0x52865b))[_0x7822('0x43')](handleError(_0x4d7d6b,null));};exports[_0x7822('0x44')]=function(_0x51fd88,_0x3b0355){var _0x5800cc={'raw':![],'where':{'id':_0x51fd88[_0x7822('0x45')]['id']}},_0x1cdd37={};_0x1cdd37[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x2e')][_0x7822('0x46')]);_0x1cdd37[_0x7822('0x37')]=_[_0x7822('0x31')](_0x51fd88[_0x7822('0x37')]);_0x1cdd37['filters']=_['intersection'](_0x1cdd37[_0x7822('0x34')],_0x1cdd37['query']);_0x5800cc['attributes']=_[_0x7822('0x33')](_0x1cdd37[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51fd88[_0x7822('0x37')][_0x7822('0x36')]));_0x5800cc[_0x7822('0x35')]=_0x5800cc[_0x7822('0x35')][_0x7822('0x38')]?_0x5800cc[_0x7822('0x35')]:_0x1cdd37['model'];if(_0x51fd88[_0x7822('0x37')][_0x7822('0x47')]){_0x5800cc[_0x7822('0x40')]=[{'all':!![]}];}_0x5800cc=_[_0x7822('0x3d')]({},_0x5800cc,_0x51fd88[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x5800cc)[_0x7822('0x23')](handleEntityNotFound(_0x3b0355,null))[_0x7822('0x23')](respondWithResult(_0x3b0355,null))[_0x7822('0x43')](handleError(_0x3b0355,null));};exports[_0x7822('0x48')]=function(_0x3b6848,_0x3d8b69){return db[_0x7822('0x2e')][_0x7822('0x48')](_0x3b6848['body'],{})['then'](function(_0x28736e){var _0x5010f1=_0x3b6848[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x5010f1)throw new Error(_0x7822('0x4a'));if(_0x5010f1[_0x7822('0x4b')]==='user'){var _0x740904=_0x28736e[_0x7822('0x25')]({'plain':!![]});var _0x127e08='Projects';return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x127e08,'userProfileId':_0x5010f1[_0x7822('0x4e')]},'raw':!![]})[_0x7822('0x23')](function(_0x5ceee9){if(_0x5ceee9&&_0x5ceee9['autoAssociation']===0x0){return db['UserProfileResource'][_0x7822('0x48')]({'name':_0x740904[_0x7822('0x2a')],'resourceId':_0x740904['id'],'type':_0x5ceee9[_0x7822('0x2a')],'sectionId':_0x5ceee9['id']},{})[_0x7822('0x23')](function(){return _0x28736e;});}else{return _0x28736e;}})[_0x7822('0x43')](function(_0x4f61da){logger[_0x7822('0x28')](_0x7822('0x4f'),_0x4f61da);throw _0x4f61da;});}return _0x28736e;})[_0x7822('0x23')](respondWithResult(_0x3d8b69,0xc9))[_0x7822('0x43')](handleError(_0x3d8b69,null));};exports[_0x7822('0x50')]=function(_0x2ad56d,_0x1c3dab){var _0x1f8eb7={'where':{'id':_0x2ad56d[_0x7822('0x45')]['id']}},_0xd2ed80={};_0xd2ed80[_0x7822('0x34')]=_[_0x7822('0x31')](db['JscriptyProject']['rawAttributes']);_0x1f8eb7['attributes']=_[_0x7822('0x33')](_0xd2ed80[_0x7822('0x34')],qs['fields'](_0x2ad56d[_0x7822('0x37')][_0x7822('0x36')]));_0x1f8eb7[_0x7822('0x35')]=_0x1f8eb7[_0x7822('0x35')][_0x7822('0x38')]?_0x1f8eb7[_0x7822('0x35')]:_0xd2ed80['model'];if(_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]){_0x1f8eb7[_0x7822('0x40')]=[{'all':!![]}];}_0x1f8eb7=_['merge']({},_0x1f8eb7,_0x2ad56d[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x1f8eb7)[_0x7822('0x23')](handleEntityNotFound(_0x1c3dab,null))[_0x7822('0x23')](function(_0x5e0a3c){if(_0x5e0a3c){var _0x165b58=_0x5e0a3c[_0x7822('0x25')]({'plain':!![]});_0x165b58=qs[_0x7822('0x51')](_0x165b58,['id',_0x7822('0x52'),_0x7822('0x53')]);_0x2ad56d[_0x7822('0x54')]=_[_0x7822('0x51')](_0x2ad56d[_0x7822('0x54')],['id',_0x7822('0x52'),'updatedAt']);return db[_0x7822('0x2e')][_0x7822('0x48')](_[_0x7822('0x3d')](_0x165b58,_0x2ad56d[_0x7822('0x54')]),{'include':_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x3497f7){var _0x4da82b=_0x2ad56d[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x4da82b)throw new Error(_0x7822('0x4a'));if(_0x4da82b[_0x7822('0x4b')]===_0x7822('0x49')){var _0x3fb6a6=_0x3497f7['get']({'plain':!![]});var _0x2df6cf=_0x7822('0x55');return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x2df6cf,'userProfileId':_0x4da82b['userProfileId']},'raw':!![]})[_0x7822('0x23')](function(_0x90971a){if(_0x90971a&&_0x90971a[_0x7822('0x56')]===0x0){return db[_0x7822('0x26')][_0x7822('0x48')]({'name':_0x3fb6a6['name'],'resourceId':_0x3fb6a6['id'],'type':_0x90971a[_0x7822('0x2a')],'sectionId':_0x90971a['id']},{})[_0x7822('0x23')](function(){return _0x3497f7;});}else{return _0x3497f7;}})[_0x7822('0x43')](function(_0x2e3a2c){logger[_0x7822('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3a2c);throw _0x2e3a2c;});}return _0x3497f7;});}})[_0x7822('0x23')](respondWithResult(_0x1c3dab,0xc9))[_0x7822('0x43')](handleError(_0x1c3dab,null));};exports[_0x7822('0x22')]=function(_0x3f4e7e,_0x283386){if(_0x3f4e7e[_0x7822('0x54')]['id']){delete _0x3f4e7e[_0x7822('0x54')]['id'];}return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x3f4e7e[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x283386,null))[_0x7822('0x23')](saveUpdates(_0x3f4e7e['body'],null))['then'](respondWithResult(_0x283386,null))[_0x7822('0x43')](handleError(_0x283386,null));};exports[_0x7822('0x24')]=function(_0x41bf9a,_0x180440){return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x41bf9a[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x180440,null))[_0x7822('0x23')](removeEntity(_0x180440,null))[_0x7822('0x43')](handleError(_0x180440,null));};exports[_0x7822('0x57')]=function(_0x17d51f,_0x56bf33,_0x4812d1){var _0x21ea26={'raw':!![],'where':{}};var _0x195d92={};var _0x508cef={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7822('0x58')]({'where':{'id':_0x17d51f[_0x7822('0x45')]['id']}})['then'](handleEntityNotFound(_0x56bf33,null))['then'](function(_0x39dcff){if(_0x39dcff){_0x195d92[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x59')]['rawAttributes']);_0x195d92[_0x7822('0x37')]=_[_0x7822('0x31')](_0x17d51f[_0x7822('0x37')]);_0x195d92[_0x7822('0x32')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],_0x195d92[_0x7822('0x37')]);_0x21ea26[_0x7822('0x35')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],qs['fields'](_0x17d51f['query'][_0x7822('0x36')]));_0x21ea26[_0x7822('0x35')]=_0x21ea26[_0x7822('0x35')][_0x7822('0x38')]?_0x21ea26[_0x7822('0x35')]:_0x195d92[_0x7822('0x34')];if(!_0x17d51f[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x21ea26[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x17d51f['query'][_0x7822('0x1d')]);_0x21ea26[_0x7822('0x1b')]=qs['offset'](_0x17d51f[_0x7822('0x37')]['offset']);}_0x21ea26['order']=qs[_0x7822('0x3a')](_0x17d51f[_0x7822('0x37')][_0x7822('0x3a')]);_0x21ea26[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x17d51f[_0x7822('0x37')],_0x195d92[_0x7822('0x32')]));_0x21ea26[_0x7822('0x3b')]['ProjectId']=_0x39dcff['id'];if(_0x17d51f['query'][_0x7822('0x3c')]){_0x21ea26['where']=_['merge'](_0x21ea26[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x21ea26[_0x7822('0x35')],function(_0x411c2d){var _0xa872ed={};_0xa872ed[_0x411c2d]={'$like':'%'+_0x17d51f[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0xa872ed;})});}_0x21ea26=_[_0x7822('0x3d')]({},_0x21ea26,_0x17d51f['options']);return db['JscriptySessionReport']['count']({'where':_0x21ea26[_0x7822('0x3b')]})[_0x7822('0x23')](function(_0x4840a2){_0x508cef[_0x7822('0x1e')]=_0x4840a2;if(_0x17d51f[_0x7822('0x37')][_0x7822('0x47')]){_0x21ea26[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7822('0x41')](_0x21ea26);})[_0x7822('0x23')](function(_0x47a7e4){_0x508cef['rows']=_0x47a7e4;return _0x508cef;});}})[_0x7822('0x23')](respondWithFilteredResult(_0x56bf33,_0x21ea26))[_0x7822('0x43')](handleError(_0x56bf33,null));};exports[_0x7822('0x5c')]=function(_0x13f536,_0x8d56d,_0x487a7a){var _0x5d3daa={'raw':!![],'where':{}};var _0x1bc318={};var _0x2ca09a={'count':0x0,'rows':[]};return db[_0x7822('0x2e')][_0x7822('0x58')]({'where':{'id':_0x13f536['params']['id']}})['then'](handleEntityNotFound(_0x8d56d,null))[_0x7822('0x23')](function(_0x20b978){if(_0x20b978){_0x1bc318['model']=_['keys'](db[_0x7822('0x5d')][_0x7822('0x46')]);_0x1bc318[_0x7822('0x37')]=_[_0x7822('0x31')](_0x13f536['query']);_0x1bc318[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1bc318[_0x7822('0x34')],_0x1bc318[_0x7822('0x37')]);_0x5d3daa[_0x7822('0x35')]=_['intersection'](_0x1bc318[_0x7822('0x34')],qs[_0x7822('0x36')](_0x13f536[_0x7822('0x37')][_0x7822('0x36')]));_0x5d3daa[_0x7822('0x35')]=_0x5d3daa[_0x7822('0x35')][_0x7822('0x38')]?_0x5d3daa['attributes']:_0x1bc318[_0x7822('0x34')];if(!_0x13f536[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x5d3daa[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x13f536['query'][_0x7822('0x1d')]);_0x5d3daa['offset']=qs['offset'](_0x13f536[_0x7822('0x37')]['offset']);}_0x5d3daa[_0x7822('0x5e')]=qs[_0x7822('0x3a')](_0x13f536[_0x7822('0x37')][_0x7822('0x3a')]);_0x5d3daa[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x13f536[_0x7822('0x37')],_0x1bc318['filters']));_0x5d3daa['where'][_0x7822('0x5f')]=_0x20b978['id'];if(_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]){_0x5d3daa[_0x7822('0x3b')]=_[_0x7822('0x3d')](_0x5d3daa[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x5d3daa[_0x7822('0x35')],function(_0x2dfd6d){var _0x13f7c4={};_0x13f7c4[_0x2dfd6d]={'$like':'%'+_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x13f7c4;})});}_0x5d3daa=_[_0x7822('0x3d')]({},_0x5d3daa,_0x13f536[_0x7822('0x3f')]);return db['JscriptyAnswerReport'][_0x7822('0x1e')]({'where':_0x5d3daa['where']})['then'](function(_0x4e6aae){_0x2ca09a['count']=_0x4e6aae;if(_0x13f536[_0x7822('0x37')][_0x7822('0x47')]){_0x5d3daa[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7822('0x41')](_0x5d3daa);})[_0x7822('0x23')](function(_0x3e72a6){_0x2ca09a[_0x7822('0x42')]=_0x3e72a6;return _0x2ca09a;});}})['then'](respondWithFilteredResult(_0x8d56d,_0x5d3daa))['catch'](handleError(_0x8d56d,null));};function char(_0x322b4f){return _0x7822('0x60')===typeof _0x322b4f?String[_0x7822('0x61')][_0x7822('0x20')](null,arguments):_0x322b4f;}function needsEncapsulation(_0x273958){return!!_0x273958&&(_0x273958[_0x7822('0x62')]()['indexOf'](char(0xd))>=0x0||_0x273958['toString']()[_0x7822('0x63')](char(0xa))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x2c))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5f594f){var _0x3a4f59=char(0x22),_0x254584='\x5c'+char(0x22),_0x2a8340=_0x5f594f['toString']()['replace'](new RegExp(_0x3a4f59,'g'),_0x254584);return _0x3a4f59+_0x2a8340+_0x3a4f59;}exports[_0x7822('0x64')]=function(_0x44ba9a,_0xb0f424,_0xbe4da0){var _0x2d3ecb,_0x4ed263;var _0x2e6292={'where':{'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']}};if(_0x44ba9a[_0x7822('0x37')][_0x7822('0x65')]){_0x2e6292['where'][_0x7822('0x66')]=JSON[_0x7822('0x67')](_0x44ba9a[_0x7822('0x37')]['startTime']);}return db[_0x7822('0x59')]['findAll'](_0x2e6292)[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x70a6fb){if(_0x70a6fb){_0x2d3ecb=_0x70a6fb;return db['JscriptyQuestionReport'][_0x7822('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x2d3ecb,'id')},'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']},'order':_0x7822('0x68')});}})[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x5e2344){if(_0x5e2344){_0x4ed263=_0x5e2344;var _0x2507d4={};for(var _0x1c7a59=0x0,_0x38ac3e=_0x4ed263[_0x7822('0x38')];_0x1c7a59<_0x38ac3e;_0x1c7a59++){if(!_0x2507d4[_0x7822('0x39')](_0x4ed263[_0x1c7a59][_0x7822('0x69')])){_0x2507d4[_0x4ed263[_0x1c7a59][_0x7822('0x69')]]=needsEncapsulation(_0x4ed263[_0x1c7a59][_0x7822('0x6a')])?encapsulate(_0x4ed263[_0x1c7a59][_0x7822('0x6a')]):_0x4ed263[_0x1c7a59][_0x7822('0x6a')];}}var _0x33a3ca=[],_0x29854d={};for(var _0x4996a5=0x0,_0x59340c=_0x2d3ecb[_0x7822('0x38')];_0x4996a5<_0x59340c;_0x4996a5++){_0x29854d={'ProjectId':_0x44ba9a['params']['id'],'SessionId':_0x2d3ecb[_0x4996a5]['id'],'StartTime':moment(_0x2d3ecb[_0x4996a5][_0x7822('0x66')])['format'](_0x7822('0x6b'))};for(var _0x34788f=0x0,_0x351823=_0x4ed263['length'];_0x34788f<_0x351823;_0x34788f++){if(_0x4ed263[_0x34788f][_0x7822('0x6c')]==_0x2d3ecb[_0x4996a5]['id']&&_0x2507d4['hasOwnProperty'](_0x4ed263[_0x34788f][_0x7822('0x69')])){_0x29854d[_0x2507d4[_0x4ed263[_0x34788f]['questionId']]]=_0x4ed263[_0x34788f]['answer'];}}for(var _0x1fc5b7 in _0x2507d4){if(!_0x29854d[_0x7822('0x39')](_0x2507d4[_0x1fc5b7])){_0x29854d[_0x2507d4[_0x1fc5b7]]=null;}}_0x33a3ca[_0x7822('0x6d')](_0x29854d);}return _0x33a3ca;}})['then'](function(_0x311a05){if(!_[_0x7822('0x6e')](_0x311a05)){var _0x3ecea6=toCsv(_0x311a05);var _0x64d5e=Date[_0x7822('0x6f')]();fs[_0x7822('0x70')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e),_0x3ecea6);_0xb0f424[_0x7822('0x73')]('Content-disposition','attachment;\x20filename='+util['format'](_0x7822('0x74'),_0x44ba9a[_0x7822('0x45')]['id'],_0x64d5e));_0xb0f424['setHeader']('Content-type','text/csv');return _0xb0f424[_0x7822('0x75')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e));}else{return _0xb0f424[_0x7822('0x27')](0xcc);}})['catch'](handleError(_0xb0f424,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4272c06..ae7ea36 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 _0x6379=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x4046fb,_0x1c2e7b){var _0x8e2d6d=function(_0x1b008f){while(--_0x1b008f){_0x4046fb['push'](_0x4046fb['shift']());}};_0x8e2d6d(++_0x1c2e7b);}(_0x6379,0x84));var _0x9637=function(_0xdb3c1b,_0x2a339b){_0xdb3c1b=_0xdb3c1b-0x0;var _0x3e23e0=_0x6379[_0xdb3c1b];return _0x3e23e0;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5636=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x138a26,_0x526219){var _0x5cccae=function(_0x3e2888){while(--_0x3e2888){_0x138a26['push'](_0x138a26['shift']());}};_0x5cccae(++_0x526219);}(_0x5636,0x102));var _0x6563=function(_0x1750b2,_0x8f284a){_0x1750b2=_0x1750b2-0x0;var _0x444b44=_0x5636[_0x1750b2];return _0x444b44;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0ec1f2e..c190c61 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xbdb7[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27da15,_0x272d0a){var _0x5042ff=function(_0x1d005f){while(--_0x1d005f){_0x27da15['push'](_0x27da15['shift']());}};_0x5042ff(++_0x272d0a);}(_0xe706,0xa3));var _0x6e70=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0xe706[_0x1b0c08];return _0x123dbf;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e96c271..ae77842 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 _0xa664=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','exports','multer','path'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xa664,0x139));var _0x4a66=function(_0x1b203a,_0x47ea6d){_0x1b203a=_0x1b203a-0x0;var _0x193f17=_0xa664[_0x1b203a];return _0x193f17;};'use strict';var multer=require(_0x4a66('0x0'));var util=require('util');var path=require(_0x4a66('0x1'));var timeout=require(_0x4a66('0x2'));var express=require(_0x4a66('0x3'));var router=express[_0x4a66('0x4')]();var fs_extra=require(_0x4a66('0x5'));var auth=require(_0x4a66('0x6'));var interaction=require(_0x4a66('0x7'));var config=require(_0x4a66('0x8'));var controller=require(_0x4a66('0x9'));router[_0x4a66('0xa')]('/',auth['isAuthenticated'](),controller[_0x4a66('0xb')]);router[_0x4a66('0xa')](_0x4a66('0xc'),auth[_0x4a66('0xd')](),controller[_0x4a66('0xe')]);router[_0x4a66('0xa')](_0x4a66('0xf'),auth[_0x4a66('0xd')](),controller[_0x4a66('0x10')]);router[_0x4a66('0x11')]('/',auth[_0x4a66('0xd')](),controller['create']);router[_0x4a66('0x12')](_0x4a66('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4a66('0x13')](_0x4a66('0xf'),auth[_0x4a66('0xd')](),controller['destroy']);module[_0x4a66('0x14')]=router; \ No newline at end of file +var _0x17cd=['../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x560ad4,_0x30238d){var _0x167c9c=function(_0x4004e1){while(--_0x4004e1){_0x560ad4['push'](_0x560ad4['shift']());}};_0x167c9c(++_0x30238d);}(_0x17cd,0x160));var _0xd17c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x17cd[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xd17c('0x0'));var util=require(_0xd17c('0x1'));var path=require(_0xd17c('0x2'));var timeout=require(_0xd17c('0x3'));var express=require(_0xd17c('0x4'));var router=express[_0xd17c('0x5')]();var fs_extra=require(_0xd17c('0x6'));var auth=require(_0xd17c('0x7'));var interaction=require(_0xd17c('0x8'));var config=require(_0xd17c('0x9'));var controller=require('./jscriptyQuestionReport.controller');router[_0xd17c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xd17c('0xb')](),controller[_0xd17c('0xc')]);router[_0xd17c('0xa')](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller[_0xd17c('0xe')]);router[_0xd17c('0xf')]('/',auth['isAuthenticated'](),controller[_0xd17c('0x10')]);router['put'](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller['update']);router[_0xd17c('0x11')](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller[_0xd17c('0x12')]);module[_0xd17c('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ccec549..365bd71 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x14f4ea,_0x362fae){_0x14f4ea=_0x14f4ea-0x0;var _0x1b9f2a=_0x7a54[_0x14f4ea];return _0x1b9f2a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x3fd2f7,_0x5c582c){_0x3fd2f7=_0x3fd2f7-0x0;var _0x5e4500=_0x7a54[_0x3fd2f7];return _0x5e4500;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 524e291..7d2ac50 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 _0xa54e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','rows','catch','show','params','keys','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x33dcc9,_0x1d0476){var _0x455bab=function(_0x27030e){while(--_0x27030e){_0x33dcc9['push'](_0x33dcc9['shift']());}};_0x455bab(++_0x1d0476);}(_0xa54e,0xcd));var _0xea54=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xa54e[_0x4fb1b8];return _0x146c71;};'use strict';var emlformat=require(_0xea54('0x0'));var rimraf=require(_0xea54('0x1'));var zipdir=require(_0xea54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea54('0x3'));var BPromise=require(_0xea54('0x4'));var Mustache=require(_0xea54('0x5'));var util=require(_0xea54('0x6'));var path=require(_0xea54('0x7'));var sox=require('sox');var csv=require(_0xea54('0x8'));var ejs=require(_0xea54('0x9'));var fs=require('fs');var fs_extra=require(_0xea54('0xa'));var _=require(_0xea54('0xb'));var squel=require(_0xea54('0xc'));var crypto=require('crypto');var jsforce=require(_0xea54('0xd'));var deskjs=require(_0xea54('0xe'));var toCsv=require(_0xea54('0x8'));var querystring=require(_0xea54('0xf'));var Papa=require(_0xea54('0x10'));var Redis=require(_0xea54('0x11'));var authService=require(_0xea54('0x12'));var qs=require(_0xea54('0x13'));var as=require(_0xea54('0x14'));var hardwareService=require(_0xea54('0x15'));var logger=require(_0xea54('0x16'))(_0xea54('0x17'));var utils=require('../../config/utils');var config=require(_0xea54('0x18'));var licenseUtil=require(_0xea54('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108229,_0x41664c){_0x41664c=_0x41664c||0xcc;return function(_0x39f5fc){if(_0x39f5fc){return _0x108229[_0xea54('0x1a')](_0x41664c);}return _0x108229[_0xea54('0x1b')](_0x41664c)['end']();};}function respondWithResult(_0x472213,_0x5b5c54){_0x5b5c54=_0x5b5c54||0xc8;return function(_0x5789c2){if(_0x5789c2){return _0x472213[_0xea54('0x1b')](_0x5b5c54)[_0xea54('0x1c')](_0x5789c2);}};}function respondWithFilteredResult(_0x4f007f,_0x168d61){return function(_0xb1b4c5){if(_0xb1b4c5){var _0x40204b=typeof _0x168d61[_0xea54('0x1d')]==='undefined'&&typeof _0x168d61[_0xea54('0x1e')]===_0xea54('0x1f');var _0x5b91c7=_0xb1b4c5[_0xea54('0x20')];var _0x5813ad=_0x40204b?0x0:_0x168d61[_0xea54('0x1d')];var _0x5cfb83=_0x40204b?_0xb1b4c5['count']:_0x168d61[_0xea54('0x1d')]+_0x168d61['limit'];var _0x1ce964;if(_0x5cfb83>=_0x5b91c7){_0x5cfb83=_0x5b91c7;_0x1ce964=0xc8;}else{_0x1ce964=0xce;}_0x4f007f[_0xea54('0x1b')](_0x1ce964);return _0x4f007f['set'](_0xea54('0x21'),_0x5813ad+'-'+_0x5cfb83+'/'+_0x5b91c7)['json'](_0xb1b4c5);}return null;};}function patchUpdates(_0x298c2b){return function(_0x342472){try{jsonpatch['apply'](_0x342472,_0x298c2b,!![]);}catch(_0x41f67e){return BPromise[_0xea54('0x22')](_0x41f67e);}return _0x342472[_0xea54('0x23')]();};}function saveUpdates(_0x266c89,_0x2e5a54){return function(_0x421e42){if(_0x421e42){return _0x421e42['update'](_0x266c89)[_0xea54('0x24')](function(_0x4e18bf){return _0x4e18bf;});}return null;};}function removeEntity(_0x22effd,_0x439298){return function(_0x16af8f){if(_0x16af8f){return _0x16af8f[_0xea54('0x25')]()[_0xea54('0x24')](function(){_0x22effd[_0xea54('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca54a,_0x3b4aa5){return function(_0x111bea){if(!_0x111bea){_0x2ca54a[_0xea54('0x1a')](0x194);}return _0x111bea;};}function handleError(_0x8d3327,_0x2a4f24){_0x2a4f24=_0x2a4f24||0x1f4;return function(_0x330411){logger['error'](_0x330411['stack']);if(_0x330411['name']){delete _0x330411[_0xea54('0x26')];}_0x8d3327[_0xea54('0x1b')](_0x2a4f24)['send'](_0x330411);};}exports[_0xea54('0x27')]=function(_0x20ff2b,_0x15d4ce){var _0x4774c8={},_0x5cc70a={},_0x33a2d3={'count':0x0,'rows':[]};var _0xe51c21=_[_0xea54('0x28')](db[_0xea54('0x29')][_0xea54('0x2a')],function(_0x1b7f5b){return{'name':_0x1b7f5b[_0xea54('0x2b')],'type':_0x1b7f5b[_0xea54('0x2c')][_0xea54('0x2d')]};});_0x5cc70a[_0xea54('0x2e')]=_[_0xea54('0x28')](_0xe51c21,_0xea54('0x26'));_0x5cc70a['query']=_['keys'](_0x20ff2b[_0xea54('0x2f')]);_0x5cc70a[_0xea54('0x30')]=_[_0xea54('0x31')](_0x5cc70a[_0xea54('0x2e')],_0x5cc70a[_0xea54('0x2f')]);_0x4774c8['attributes']=_['intersection'](_0x5cc70a[_0xea54('0x2e')],qs[_0xea54('0x32')](_0x20ff2b[_0xea54('0x2f')][_0xea54('0x32')]));_0x4774c8[_0xea54('0x33')]=_0x4774c8['attributes'][_0xea54('0x34')]?_0x4774c8['attributes']:_0x5cc70a[_0xea54('0x2e')];if(!_0x20ff2b['query'][_0xea54('0x35')](_0xea54('0x36'))){_0x4774c8[_0xea54('0x1e')]=qs[_0xea54('0x1e')](_0x20ff2b[_0xea54('0x2f')]['limit']);_0x4774c8[_0xea54('0x1d')]=qs[_0xea54('0x1d')](_0x20ff2b[_0xea54('0x2f')][_0xea54('0x1d')]);}_0x4774c8['order']=qs[_0xea54('0x37')](_0x20ff2b['query'][_0xea54('0x37')]);_0x4774c8[_0xea54('0x38')]=qs[_0xea54('0x30')](_[_0xea54('0x39')](_0x20ff2b[_0xea54('0x2f')],_0x5cc70a[_0xea54('0x30')]),_0xe51c21);if(_0x20ff2b['query']['filter']){_0x4774c8[_0xea54('0x38')]=_[_0xea54('0x3a')](_0x4774c8[_0xea54('0x38')],{'$or':_[_0xea54('0x28')](_0xe51c21,function(_0x5ddbba){if(_0x5ddbba[_0xea54('0x2c')]!=='VIRTUAL'){var _0x2d69be={};_0x2d69be[_0x5ddbba[_0xea54('0x26')]]={'$like':'%'+_0x20ff2b[_0xea54('0x2f')][_0xea54('0x3b')]+'%'};return _0x2d69be;}})});}_0x4774c8=_[_0xea54('0x3a')]({},_0x4774c8,_0x20ff2b[_0xea54('0x3c')]);var _0x408fb5={'where':_0x4774c8['where']};return db[_0xea54('0x29')][_0xea54('0x20')](_0x408fb5)[_0xea54('0x24')](function(_0x5703e2){_0x33a2d3[_0xea54('0x20')]=_0x5703e2;if(_0x20ff2b['query']['includeAll']){_0x4774c8[_0xea54('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4774c8);})['then'](function(_0x532d93){_0x33a2d3[_0xea54('0x3e')]=_0x532d93;return _0x33a2d3;})[_0xea54('0x24')](respondWithFilteredResult(_0x15d4ce,_0x4774c8))[_0xea54('0x3f')](handleError(_0x15d4ce,null));};exports[_0xea54('0x40')]=function(_0x11766d,_0x26462d){var _0x5757f4={'raw':!![],'where':{'id':_0x11766d[_0xea54('0x41')]['id']}},_0x5f4af8={};_0x5f4af8[_0xea54('0x2e')]=_[_0xea54('0x42')](db[_0xea54('0x29')][_0xea54('0x2a')]);_0x5f4af8[_0xea54('0x2f')]=_[_0xea54('0x42')](_0x11766d[_0xea54('0x2f')]);_0x5f4af8[_0xea54('0x30')]=_[_0xea54('0x31')](_0x5f4af8[_0xea54('0x2e')],_0x5f4af8[_0xea54('0x2f')]);_0x5757f4[_0xea54('0x33')]=_['intersection'](_0x5f4af8[_0xea54('0x2e')],qs[_0xea54('0x32')](_0x11766d[_0xea54('0x2f')][_0xea54('0x32')]));_0x5757f4[_0xea54('0x33')]=_0x5757f4[_0xea54('0x33')][_0xea54('0x34')]?_0x5757f4['attributes']:_0x5f4af8[_0xea54('0x2e')];if(_0x11766d[_0xea54('0x2f')][_0xea54('0x43')]){_0x5757f4[_0xea54('0x3d')]=[{'all':!![]}];}_0x5757f4=_[_0xea54('0x3a')]({},_0x5757f4,_0x11766d[_0xea54('0x3c')]);return db[_0xea54('0x29')][_0xea54('0x44')](_0x5757f4)[_0xea54('0x24')](handleEntityNotFound(_0x26462d,null))[_0xea54('0x24')](respondWithResult(_0x26462d,null))[_0xea54('0x3f')](handleError(_0x26462d,null));};exports[_0xea54('0x45')]=function(_0x52f7f5,_0x157612){return db[_0xea54('0x29')][_0xea54('0x45')](_0x52f7f5['body'],{})[_0xea54('0x24')](respondWithResult(_0x157612,0xc9))[_0xea54('0x3f')](handleError(_0x157612,null));};exports[_0xea54('0x46')]=function(_0xbf5042,_0x16ac27){if(_0xbf5042[_0xea54('0x47')]['id']){delete _0xbf5042[_0xea54('0x47')]['id'];}return db[_0xea54('0x29')]['find']({'where':{'id':_0xbf5042[_0xea54('0x41')]['id']}})['then'](handleEntityNotFound(_0x16ac27,null))['then'](saveUpdates(_0xbf5042[_0xea54('0x47')],null))[_0xea54('0x24')](respondWithResult(_0x16ac27,null))[_0xea54('0x3f')](handleError(_0x16ac27,null));};exports['destroy']=function(_0x42e580,_0x213e2a){return db[_0xea54('0x29')][_0xea54('0x44')]({'where':{'id':_0x42e580[_0xea54('0x41')]['id']}})[_0xea54('0x24')](handleEntityNotFound(_0x213e2a,null))['then'](removeEntity(_0x213e2a,null))[_0xea54('0x3f')](handleError(_0x213e2a,null));};exports[_0xea54('0x48')]=function(_0x233f5e,_0x592edd){return db[_0xea54('0x29')][_0xea54('0x48')]()[_0xea54('0x24')](respondWithResult(_0x592edd,null))[_0xea54('0x3f')](handleError(_0x592edd,null));}; \ No newline at end of file +var _0x4a53=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','includeAll','create','body','find','params','describe','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2f1b35,_0x4e02c8){var _0x4597c6=function(_0x2cedd9){while(--_0x2cedd9){_0x2f1b35['push'](_0x2f1b35['shift']());}};_0x4597c6(++_0x4e02c8);}(_0x4a53,0x19a));var _0x34a5=function(_0xeeb659,_0x2952f9){_0xeeb659=_0xeeb659-0x0;var _0x39f8fd=_0x4a53[_0xeeb659];return _0x39f8fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34a5('0x0'));var rp=require(_0x34a5('0x1'));var moment=require(_0x34a5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x34a5('0x3'));var util=require(_0x34a5('0x4'));var path=require(_0x34a5('0x5'));var sox=require('sox');var csv=require(_0x34a5('0x6'));var ejs=require(_0x34a5('0x7'));var fs=require('fs');var fs_extra=require(_0x34a5('0x8'));var _=require(_0x34a5('0x9'));var squel=require(_0x34a5('0xa'));var crypto=require('crypto');var jsforce=require(_0x34a5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34a5('0x6'));var querystring=require(_0x34a5('0xc'));var Papa=require(_0x34a5('0xd'));var Redis=require('ioredis');var authService=require(_0x34a5('0xe'));var qs=require(_0x34a5('0xf'));var as=require(_0x34a5('0x10'));var hardwareService=require(_0x34a5('0x11'));var logger=require(_0x34a5('0x12'))(_0x34a5('0x13'));var utils=require(_0x34a5('0x14'));var config=require(_0x34a5('0x15'));var licenseUtil=require(_0x34a5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162b0c,_0xbc5cc6){_0xbc5cc6=_0xbc5cc6||0xcc;return function(_0x5907fa){if(_0x5907fa){return _0x162b0c[_0x34a5('0x17')](_0xbc5cc6);}return _0x162b0c[_0x34a5('0x18')](_0xbc5cc6)[_0x34a5('0x19')]();};}function respondWithResult(_0x1cb447,_0x3d1857){_0x3d1857=_0x3d1857||0xc8;return function(_0x239089){if(_0x239089){return _0x1cb447[_0x34a5('0x18')](_0x3d1857)['json'](_0x239089);}};}function respondWithFilteredResult(_0x495522,_0x4477c3){return function(_0x58b751){if(_0x58b751){var _0x8f7219=typeof _0x4477c3['offset']==='undefined'&&typeof _0x4477c3[_0x34a5('0x1a')]===_0x34a5('0x1b');var _0x2dfb03=_0x58b751[_0x34a5('0x1c')];var _0x4f7f5f=_0x8f7219?0x0:_0x4477c3['offset'];var _0x27da44=_0x8f7219?_0x58b751[_0x34a5('0x1c')]:_0x4477c3[_0x34a5('0x1d')]+_0x4477c3[_0x34a5('0x1a')];var _0x23998f;if(_0x27da44>=_0x2dfb03){_0x27da44=_0x2dfb03;_0x23998f=0xc8;}else{_0x23998f=0xce;}_0x495522[_0x34a5('0x18')](_0x23998f);return _0x495522[_0x34a5('0x1e')](_0x34a5('0x1f'),_0x4f7f5f+'-'+_0x27da44+'/'+_0x2dfb03)[_0x34a5('0x20')](_0x58b751);}return null;};}function patchUpdates(_0x5bd91c){return function(_0x3b986e){try{jsonpatch['apply'](_0x3b986e,_0x5bd91c,!![]);}catch(_0x6701ba){return BPromise[_0x34a5('0x21')](_0x6701ba);}return _0x3b986e[_0x34a5('0x22')]();};}function saveUpdates(_0x57d680,_0xd13627){return function(_0x72bf68){if(_0x72bf68){return _0x72bf68[_0x34a5('0x23')](_0x57d680)[_0x34a5('0x24')](function(_0x403244){return _0x403244;});}return null;};}function removeEntity(_0x5cd0fd,_0xf30276){return function(_0x48901c){if(_0x48901c){return _0x48901c[_0x34a5('0x25')]()[_0x34a5('0x24')](function(){_0x5cd0fd[_0x34a5('0x18')](0xcc)[_0x34a5('0x19')]();});}};}function handleEntityNotFound(_0x474a0a,_0xf0336d){return function(_0x2ebb84){if(!_0x2ebb84){_0x474a0a[_0x34a5('0x17')](0x194);}return _0x2ebb84;};}function handleError(_0x16c30d,_0x147e59){_0x147e59=_0x147e59||0x1f4;return function(_0x532b8d){logger[_0x34a5('0x26')](_0x532b8d[_0x34a5('0x27')]);if(_0x532b8d['name']){delete _0x532b8d[_0x34a5('0x28')];}_0x16c30d['status'](_0x147e59)[_0x34a5('0x29')](_0x532b8d);};}exports[_0x34a5('0x2a')]=function(_0x37071d,_0x384e77){var _0x3a73ff={},_0x234cf1={},_0x48f5a0={'count':0x0,'rows':[]};var _0x43303c=_[_0x34a5('0x2b')](db[_0x34a5('0x2c')][_0x34a5('0x2d')],function(_0x5e3ecb){return{'name':_0x5e3ecb[_0x34a5('0x2e')],'type':_0x5e3ecb[_0x34a5('0x2f')][_0x34a5('0x30')]};});_0x234cf1[_0x34a5('0x31')]=_[_0x34a5('0x2b')](_0x43303c,_0x34a5('0x28'));_0x234cf1[_0x34a5('0x32')]=_[_0x34a5('0x33')](_0x37071d[_0x34a5('0x32')]);_0x234cf1[_0x34a5('0x34')]=_[_0x34a5('0x35')](_0x234cf1[_0x34a5('0x31')],_0x234cf1[_0x34a5('0x32')]);_0x3a73ff[_0x34a5('0x36')]=_['intersection'](_0x234cf1['model'],qs[_0x34a5('0x37')](_0x37071d['query'][_0x34a5('0x37')]));_0x3a73ff['attributes']=_0x3a73ff[_0x34a5('0x36')][_0x34a5('0x38')]?_0x3a73ff['attributes']:_0x234cf1[_0x34a5('0x31')];if(!_0x37071d[_0x34a5('0x32')][_0x34a5('0x39')](_0x34a5('0x3a'))){_0x3a73ff[_0x34a5('0x1a')]=qs[_0x34a5('0x1a')](_0x37071d[_0x34a5('0x32')]['limit']);_0x3a73ff['offset']=qs[_0x34a5('0x1d')](_0x37071d['query'][_0x34a5('0x1d')]);}_0x3a73ff[_0x34a5('0x3b')]=qs[_0x34a5('0x3c')](_0x37071d['query'][_0x34a5('0x3c')]);_0x3a73ff['where']=qs[_0x34a5('0x34')](_[_0x34a5('0x3d')](_0x37071d[_0x34a5('0x32')],_0x234cf1[_0x34a5('0x34')]),_0x43303c);if(_0x37071d[_0x34a5('0x32')]['filter']){_0x3a73ff[_0x34a5('0x3e')]=_['merge'](_0x3a73ff[_0x34a5('0x3e')],{'$or':_[_0x34a5('0x2b')](_0x43303c,function(_0x37e27d){if(_0x37e27d['type']!==_0x34a5('0x3f')){var _0x1ae86b={};_0x1ae86b[_0x37e27d[_0x34a5('0x28')]]={'$like':'%'+_0x37071d['query'][_0x34a5('0x40')]+'%'};return _0x1ae86b;}})});}_0x3a73ff=_[_0x34a5('0x41')]({},_0x3a73ff,_0x37071d[_0x34a5('0x42')]);var _0x1f67b4={'where':_0x3a73ff[_0x34a5('0x3e')]};return db[_0x34a5('0x2c')][_0x34a5('0x1c')](_0x1f67b4)[_0x34a5('0x24')](function(_0xe5ffa2){_0x48f5a0[_0x34a5('0x1c')]=_0xe5ffa2;if(_0x37071d['query']['includeAll']){_0x3a73ff[_0x34a5('0x43')]=[{'all':!![]}];}return db[_0x34a5('0x2c')][_0x34a5('0x44')](_0x3a73ff);})[_0x34a5('0x24')](function(_0x302407){_0x48f5a0[_0x34a5('0x45')]=_0x302407;return _0x48f5a0;})[_0x34a5('0x24')](respondWithFilteredResult(_0x384e77,_0x3a73ff))[_0x34a5('0x46')](handleError(_0x384e77,null));};exports['show']=function(_0x3e9cd9,_0x3c5964){var _0x5a56b9={'raw':!![],'where':{'id':_0x3e9cd9['params']['id']}},_0x1c7ff2={};_0x1c7ff2['model']=_[_0x34a5('0x33')](db[_0x34a5('0x2c')][_0x34a5('0x2d')]);_0x1c7ff2[_0x34a5('0x32')]=_[_0x34a5('0x33')](_0x3e9cd9[_0x34a5('0x32')]);_0x1c7ff2['filters']=_['intersection'](_0x1c7ff2[_0x34a5('0x31')],_0x1c7ff2[_0x34a5('0x32')]);_0x5a56b9[_0x34a5('0x36')]=_[_0x34a5('0x35')](_0x1c7ff2['model'],qs[_0x34a5('0x37')](_0x3e9cd9[_0x34a5('0x32')]['fields']));_0x5a56b9[_0x34a5('0x36')]=_0x5a56b9[_0x34a5('0x36')][_0x34a5('0x38')]?_0x5a56b9[_0x34a5('0x36')]:_0x1c7ff2['model'];if(_0x3e9cd9['query'][_0x34a5('0x47')]){_0x5a56b9[_0x34a5('0x43')]=[{'all':!![]}];}_0x5a56b9=_[_0x34a5('0x41')]({},_0x5a56b9,_0x3e9cd9[_0x34a5('0x42')]);return db[_0x34a5('0x2c')]['find'](_0x5a56b9)[_0x34a5('0x24')](handleEntityNotFound(_0x3c5964,null))[_0x34a5('0x24')](respondWithResult(_0x3c5964,null))[_0x34a5('0x46')](handleError(_0x3c5964,null));};exports[_0x34a5('0x48')]=function(_0x34007,_0x22513e){return db[_0x34a5('0x2c')][_0x34a5('0x48')](_0x34007[_0x34a5('0x49')],{})[_0x34a5('0x24')](respondWithResult(_0x22513e,0xc9))[_0x34a5('0x46')](handleError(_0x22513e,null));};exports[_0x34a5('0x23')]=function(_0xf654c5,_0xe31385){if(_0xf654c5[_0x34a5('0x49')]['id']){delete _0xf654c5[_0x34a5('0x49')]['id'];}return db[_0x34a5('0x2c')][_0x34a5('0x4a')]({'where':{'id':_0xf654c5[_0x34a5('0x4b')]['id']}})[_0x34a5('0x24')](handleEntityNotFound(_0xe31385,null))[_0x34a5('0x24')](saveUpdates(_0xf654c5[_0x34a5('0x49')],null))[_0x34a5('0x24')](respondWithResult(_0xe31385,null))[_0x34a5('0x46')](handleError(_0xe31385,null));};exports['destroy']=function(_0x1f3f48,_0x532793){return db[_0x34a5('0x2c')][_0x34a5('0x4a')]({'where':{'id':_0x1f3f48[_0x34a5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x532793,null))[_0x34a5('0x24')](removeEntity(_0x532793,null))[_0x34a5('0x46')](handleError(_0x532793,null));};exports['describe']=function(_0x21635a,_0x59241c){return db[_0x34a5('0x2c')][_0x34a5('0x4c')]()[_0x34a5('0x24')](respondWithResult(_0x59241c,null))[_0x34a5('0x46')](handleError(_0x59241c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7e654d1..7b9383e 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 _0x6eb1=['report_jscripty_questions','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x5a09e9,_0x391256){var _0x5e4735=function(_0x23d780){while(--_0x23d780){_0x5a09e9['push'](_0x5a09e9['shift']());}};_0x5e4735(++_0x391256);}(_0x6eb1,0xc4));var _0x16eb=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x6eb1[_0x23a8ba];return _0x468389;};'use strict';var _=require(_0x16eb('0x0'));var util=require(_0x16eb('0x1'));var logger=require('../../config/logger')(_0x16eb('0x2'));var moment=require('moment');var BPromise=require(_0x16eb('0x3'));var rp=require(_0x16eb('0x4'));var fs=require('fs');var path=require(_0x16eb('0x5'));var rimraf=require(_0x16eb('0x6'));var config=require(_0x16eb('0x7'));var attributes=require(_0x16eb('0x8'));module[_0x16eb('0x9')]=function(_0x336f51,_0x482659){return _0x336f51[_0x16eb('0xa')](_0x16eb('0xb'),attributes,{'tableName':_0x16eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e3b=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','lodash','../../config/logger','api','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5e3b,0xc2));var _0xb5e3=function(_0x17ff62,_0x407c95){_0x17ff62=_0x17ff62-0x0;var _0x3ec97b=_0x5e3b[_0x17ff62];return _0x3ec97b;};'use strict';var _=require(_0xb5e3('0x0'));var util=require('util');var logger=require(_0xb5e3('0x1'))(_0xb5e3('0x2'));var moment=require(_0xb5e3('0x3'));var BPromise=require(_0xb5e3('0x4'));var rp=require(_0xb5e3('0x5'));var fs=require('fs');var path=require(_0xb5e3('0x6'));var rimraf=require(_0xb5e3('0x7'));var config=require(_0xb5e3('0x8'));var attributes=require(_0xb5e3('0x9'));module[_0xb5e3('0xa')]=function(_0x2e25b9,_0x348f02){return _0x2e25b9['define']('JscriptyQuestionReport',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 8bf39e3..f0cef6e 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 _0xb925=['../../mysqldb','../../config/logger','rpc','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','moment','bluebird','ioredis'];(function(_0x214d8f,_0x4d08fa){var _0x2c22ec=function(_0xcc545c){while(--_0xcc545c){_0x214d8f['push'](_0x214d8f['shift']());}};_0x2c22ec(++_0x4d08fa);}(_0xb925,0xce));var _0x5b92=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xb925[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0x5b92('0x0'));var util=require('util');var moment=require(_0x5b92('0x1'));var BPromise=require(_0x5b92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b92('0x3'));var db=require(_0x5b92('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b92('0x5'))(_0x5b92('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5b92('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1669f1,_0x35ce75,_0x5bf29f){return new BPromise(function(_0x2159eb,_0x10137b){return client['request'](_0x1669f1,_0x5bf29f)['then'](function(_0x2d44d1){logger[_0x5b92('0x8')](_0x5b92('0x9'),_0x35ce75,_0x5b92('0xa'));logger[_0x5b92('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x35ce75,_0x5b92('0xa'),JSON['stringify'](_0x2d44d1));if(_0x2d44d1[_0x5b92('0xc')]){if(_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xd')]===0x1f4){logger[_0x5b92('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x35ce75,_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xe')]);return _0x10137b(_0x2d44d1['error']['message']);}logger[_0x5b92('0xc')](_0x5b92('0x9'),_0x35ce75,_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xe')]);return _0x2159eb(_0x2d44d1['error'][_0x5b92('0xe')]);}else{logger[_0x5b92('0x8')](_0x5b92('0x9'),_0x35ce75,_0x5b92('0xa'));_0x2159eb(_0x2d44d1['result']['message']);}})['catch'](function(_0x22f566){logger[_0x5b92('0xc')](_0x5b92('0x9'),_0x35ce75,_0x22f566);_0x10137b(_0x22f566);});});} \ No newline at end of file +var _0x30c6=['client','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x11e76b,_0x2aef59){var _0xa0e8ec=function(_0x2a77b5){while(--_0x2a77b5){_0x11e76b['push'](_0x11e76b['shift']());}};_0xa0e8ec(++_0x2aef59);}(_0x30c6,0x96));var _0x630c=function(_0x3e1625,_0x1ff01b){_0x3e1625=_0x3e1625-0x0;var _0x2ac686=_0x30c6[_0x3e1625];return _0x2ac686;};'use strict';var _=require(_0x630c('0x0'));var util=require(_0x630c('0x1'));var moment=require(_0x630c('0x2'));var BPromise=require(_0x630c('0x3'));var rs=require(_0x630c('0x4'));var fs=require('fs');var Redis=require(_0x630c('0x5'));var db=require(_0x630c('0x6'))['db'];var utils=require(_0x630c('0x7'));var logger=require('../../config/logger')(_0x630c('0x8'));var config=require(_0x630c('0x9'));var jayson=require(_0x630c('0xa'));var client=jayson[_0x630c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2d7d,_0x538bf3,_0x27e356){return new BPromise(function(_0x199dd8,_0x14822c){return client['request'](_0x2d2d7d,_0x27e356)[_0x630c('0xc')](function(_0x6a557a){logger[_0x630c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x538bf3,_0x630c('0xe'));logger[_0x630c('0xf')](_0x630c('0x10'),_0x538bf3,'request\x20sent',JSON[_0x630c('0x11')](_0x6a557a));if(_0x6a557a[_0x630c('0x12')]){if(_0x6a557a['error'][_0x630c('0x13')]===0x1f4){logger[_0x630c('0x12')](_0x630c('0x14'),_0x538bf3,_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);return _0x14822c(_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);}logger[_0x630c('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x538bf3,_0x6a557a[_0x630c('0x12')]['message']);return _0x199dd8(_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);}else{logger['info'](_0x630c('0x14'),_0x538bf3,_0x630c('0xe'));_0x199dd8(_0x6a557a['result']['message']);}})[_0x630c('0x16')](function(_0x194e53){logger['error'](_0x630c('0x14'),_0x538bf3,_0x194e53);_0x14822c(_0x194e53);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f6356a3..a854836 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 _0x2be0=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/questions','getQuestions','post','create'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0x2be0,0xe9));var _0x02be=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2be0[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x02be('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x02be('0x1'));var express=require(_0x02be('0x2'));var router=express[_0x02be('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x02be('0x4'));var config=require(_0x02be('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0x02be('0x6')]('/',auth[_0x02be('0x7')](),controller[_0x02be('0x8')]);router[_0x02be('0x6')]('/describe',auth[_0x02be('0x7')](),controller['describe']);router[_0x02be('0x6')](_0x02be('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x02be('0x6')](_0x02be('0xa'),auth[_0x02be('0x7')](),controller[_0x02be('0xb')]);router[_0x02be('0xc')]('/',auth[_0x02be('0x7')](),controller[_0x02be('0xd')]);router[_0x02be('0xe')](_0x02be('0x9'),auth[_0x02be('0x7')](),controller[_0x02be('0xf')]);router[_0x02be('0x10')]('/:id',auth[_0x02be('0x7')](),controller[_0x02be('0x11')]);module[_0x02be('0x12')]=router; \ No newline at end of file +var _0x741c=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','post','create','put','update','delete','exports','multer','util'];(function(_0x4ae024,_0x2e3bfc){var _0x1b0f81=function(_0x52417d){while(--_0x52417d){_0x4ae024['push'](_0x4ae024['shift']());}};_0x1b0f81(++_0x2e3bfc);}(_0x741c,0x67));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require('connect-timeout');var express=require(_0xc741('0x3'));var router=express[_0xc741('0x4')]();var fs_extra=require(_0xc741('0x5'));var auth=require(_0xc741('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xc741('0x8')]('/',auth['isAuthenticated'](),controller[_0xc741('0x9')]);router['get'](_0xc741('0xa'),auth[_0xc741('0xb')](),controller['describe']);router['get'](_0xc741('0xc'),auth[_0xc741('0xb')](),controller[_0xc741('0xd')]);router['get'](_0xc741('0xe'),auth[_0xc741('0xb')](),controller['getQuestions']);router[_0xc741('0xf')]('/',auth['isAuthenticated'](),controller[_0xc741('0x10')]);router[_0xc741('0x11')]('/:id',auth[_0xc741('0xb')](),controller[_0xc741('0x12')]);router[_0xc741('0x13')](_0xc741('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc741('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c0f3f50..004279f 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 _0x3fe9=['format','STRING','BOOLEAN','moment','sequelize','DATE','starttime','endtime'];(function(_0x45a2ee,_0x3a2e2b){var _0x5e310e=function(_0x1b52fd){while(--_0x1b52fd){_0x45a2ee['push'](_0x45a2ee['shift']());}};_0x5e310e(++_0x3a2e2b);}(_0x3fe9,0x133));var _0x93fe=function(_0x17db19,_0x5de4f4){_0x17db19=_0x17db19-0x0;var _0x2b5370=_0x3fe9[_0x17db19];return _0x2b5370;};'use strict';var moment=require(_0x93fe('0x0'));var Sequelize=require(_0x93fe('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x93fe('0x2')],'set':function(_0x308158){this['setDataValue'](_0x93fe('0x3'),_0x308158);this['setDataValue'](_0x93fe('0x4'),moment()[_0x93fe('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x93fe('0x2')]},'membername':{'type':Sequelize[_0x93fe('0x6')]},'projectname':{'type':Sequelize[_0x93fe('0x6')]},'queue':{'type':Sequelize[_0x93fe('0x6')]},'uniqueid':{'type':Sequelize[_0x93fe('0x6')]},'calleridname':{'type':Sequelize[_0x93fe('0x6')]},'calleridnum':{'type':Sequelize[_0x93fe('0x6')]},'completed':{'type':Sequelize[_0x93fe('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c97=['DATE','starttime','setDataValue','endtime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x45f66c,_0x4f1479){var _0x437493=function(_0x5a72c3){while(--_0x5a72c3){_0x45f66c['push'](_0x45f66c['shift']());}};_0x437493(++_0x4f1479);}(_0x0c97,0x9f));var _0x70c9=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x0c97[_0x12b8ec];return _0x21af77;};'use strict';var moment=require(_0x70c9('0x0'));var Sequelize=require(_0x70c9('0x1'));module[_0x70c9('0x2')]={'starttime':{'type':Sequelize[_0x70c9('0x3')],'set':function(_0x3df8dc){this['setDataValue'](_0x70c9('0x4'),_0x3df8dc);this[_0x70c9('0x5')](_0x70c9('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x70c9('0x3')]},'membername':{'type':Sequelize[_0x70c9('0x7')]},'projectname':{'type':Sequelize[_0x70c9('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x70c9('0x7')]},'calleridnum':{'type':Sequelize[_0x70c9('0x7')]},'completed':{'type':Sequelize[_0x70c9('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9e5c51b..8af6064 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 _0xadf1=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','name','index','map','rawAttributes','fieldName','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','find','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','moment'];(function(_0x4ea427,_0xbd2445){var _0x28cbae=function(_0x562ec5){while(--_0x562ec5){_0x4ea427['push'](_0x4ea427['shift']());}};_0x28cbae(++_0xbd2445);}(_0xadf1,0xf5));var _0x1adf=function(_0x39a1da,_0x2d9008){_0x39a1da=_0x39a1da-0x0;var _0x1cc7e3=_0xadf1[_0x39a1da];return _0x1cc7e3;};'use strict';var emlformat=require(_0x1adf('0x0'));var rimraf=require(_0x1adf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1adf('0x2'));var rp=require('request-promise');var moment=require(_0x1adf('0x3'));var BPromise=require(_0x1adf('0x4'));var Mustache=require(_0x1adf('0x5'));var util=require('util');var path=require(_0x1adf('0x6'));var sox=require(_0x1adf('0x7'));var csv=require(_0x1adf('0x8'));var ejs=require(_0x1adf('0x9'));var fs=require('fs');var fs_extra=require(_0x1adf('0xa'));var _=require('lodash');var squel=require(_0x1adf('0xb'));var crypto=require(_0x1adf('0xc'));var jsforce=require(_0x1adf('0xd'));var deskjs=require(_0x1adf('0xe'));var toCsv=require(_0x1adf('0x8'));var querystring=require(_0x1adf('0xf'));var Papa=require('papaparse');var Redis=require(_0x1adf('0x10'));var authService=require(_0x1adf('0x11'));var qs=require(_0x1adf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1adf('0x13'));var logger=require(_0x1adf('0x14'))(_0x1adf('0x15'));var utils=require(_0x1adf('0x16'));var config=require(_0x1adf('0x17'));var licenseUtil=require(_0x1adf('0x18'));var db=require(_0x1adf('0x19'))['db'];function respondWithStatusCode(_0x38df53,_0x451824){_0x451824=_0x451824||0xcc;return function(_0x3371fb){if(_0x3371fb){return _0x38df53[_0x1adf('0x1a')](_0x451824);}return _0x38df53[_0x1adf('0x1b')](_0x451824)['end']();};}function respondWithResult(_0x4d5ee7,_0x3db0b7){_0x3db0b7=_0x3db0b7||0xc8;return function(_0x10c73d){if(_0x10c73d){return _0x4d5ee7[_0x1adf('0x1b')](_0x3db0b7)['json'](_0x10c73d);}};}function respondWithFilteredResult(_0x261a17,_0x13099c){return function(_0x1e6c17){if(_0x1e6c17){var _0x130f1f=typeof _0x13099c[_0x1adf('0x1c')]==='undefined'&&typeof _0x13099c[_0x1adf('0x1d')]===_0x1adf('0x1e');var _0x5d5297=_0x1e6c17['count'];var _0x14d2ae=_0x130f1f?0x0:_0x13099c[_0x1adf('0x1c')];var _0x1db6e2=_0x130f1f?_0x1e6c17[_0x1adf('0x1f')]:_0x13099c['offset']+_0x13099c[_0x1adf('0x1d')];var _0x3610ef;if(_0x1db6e2>=_0x5d5297){_0x1db6e2=_0x5d5297;_0x3610ef=0xc8;}else{_0x3610ef=0xce;}_0x261a17[_0x1adf('0x1b')](_0x3610ef);return _0x261a17[_0x1adf('0x20')](_0x1adf('0x21'),_0x14d2ae+'-'+_0x1db6e2+'/'+_0x5d5297)[_0x1adf('0x22')](_0x1e6c17);}return null;};}function patchUpdates(_0x5a66f9){return function(_0x197211){try{jsonpatch[_0x1adf('0x23')](_0x197211,_0x5a66f9,!![]);}catch(_0x363ae2){return BPromise[_0x1adf('0x24')](_0x363ae2);}return _0x197211[_0x1adf('0x25')]();};}function saveUpdates(_0x16989a,_0x3fd784){return function(_0x54b62b){if(_0x54b62b){return _0x54b62b[_0x1adf('0x26')](_0x16989a)['then'](function(_0x1a01b7){return _0x1a01b7;});}return null;};}function removeEntity(_0x3ce3b0,_0x5ef823){return function(_0x167d59){if(_0x167d59){return _0x167d59[_0x1adf('0x27')]()[_0x1adf('0x28')](function(){_0x3ce3b0[_0x1adf('0x1b')](0xcc)[_0x1adf('0x29')]();});}};}function handleEntityNotFound(_0x491f78,_0x565191){return function(_0x55cde2){if(!_0x55cde2){_0x491f78[_0x1adf('0x1a')](0x194);}return _0x55cde2;};}function handleError(_0x4615af,_0x5e2dfe){_0x5e2dfe=_0x5e2dfe||0x1f4;return function(_0x43c6ed){logger[_0x1adf('0x2a')](_0x43c6ed['stack']);if(_0x43c6ed[_0x1adf('0x2b')]){delete _0x43c6ed[_0x1adf('0x2b')];}_0x4615af['status'](_0x5e2dfe)['send'](_0x43c6ed);};}exports[_0x1adf('0x2c')]=function(_0x5ac496,_0x22aff1){var _0x45ef06={},_0x15f0fd={},_0x388312={'count':0x0,'rows':[]};var _0xd402a1=_[_0x1adf('0x2d')](db['JscriptySessionReport'][_0x1adf('0x2e')],function(_0x3e167b){return{'name':_0x3e167b[_0x1adf('0x2f')],'type':_0x3e167b['type']['key']};});_0x15f0fd['model']=_[_0x1adf('0x2d')](_0xd402a1,'name');_0x15f0fd[_0x1adf('0x30')]=_[_0x1adf('0x31')](_0x5ac496[_0x1adf('0x30')]);_0x15f0fd[_0x1adf('0x32')]=_['intersection'](_0x15f0fd[_0x1adf('0x33')],_0x15f0fd['query']);_0x45ef06['attributes']=_['intersection'](_0x15f0fd['model'],qs[_0x1adf('0x34')](_0x5ac496['query']['fields']));_0x45ef06[_0x1adf('0x35')]=_0x45ef06[_0x1adf('0x35')]['length']?_0x45ef06[_0x1adf('0x35')]:_0x15f0fd['model'];if(!_0x5ac496[_0x1adf('0x30')][_0x1adf('0x36')](_0x1adf('0x37'))){_0x45ef06[_0x1adf('0x1d')]=qs[_0x1adf('0x1d')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x1d')]);_0x45ef06[_0x1adf('0x1c')]=qs[_0x1adf('0x1c')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x1c')]);}_0x45ef06[_0x1adf('0x38')]=qs[_0x1adf('0x39')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x39')]);_0x45ef06[_0x1adf('0x3a')]=qs[_0x1adf('0x32')](_[_0x1adf('0x3b')](_0x5ac496['query'],_0x15f0fd['filters']),_0xd402a1);if(_0x5ac496[_0x1adf('0x30')][_0x1adf('0x3c')]){_0x45ef06[_0x1adf('0x3a')]=_['merge'](_0x45ef06[_0x1adf('0x3a')],{'$or':_[_0x1adf('0x2d')](_0xd402a1,function(_0x4aefcd){if(_0x4aefcd[_0x1adf('0x3d')]!==_0x1adf('0x3e')){var _0x2b9853={};_0x2b9853[_0x4aefcd[_0x1adf('0x2b')]]={'$like':'%'+_0x5ac496[_0x1adf('0x30')][_0x1adf('0x3c')]+'%'};return _0x2b9853;}})});}_0x45ef06=_[_0x1adf('0x3f')]({},_0x45ef06,_0x5ac496[_0x1adf('0x40')]);var _0x9de5f4={'where':_0x45ef06[_0x1adf('0x3a')]};return db[_0x1adf('0x41')]['count'](_0x9de5f4)[_0x1adf('0x28')](function(_0x57ba61){_0x388312['count']=_0x57ba61;if(_0x5ac496[_0x1adf('0x30')][_0x1adf('0x42')]){_0x45ef06[_0x1adf('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1adf('0x44')](_0x45ef06);})[_0x1adf('0x28')](function(_0x3545f8){_0x388312[_0x1adf('0x45')]=_0x3545f8;return _0x388312;})['then'](respondWithFilteredResult(_0x22aff1,_0x45ef06))[_0x1adf('0x46')](handleError(_0x22aff1,null));};exports[_0x1adf('0x47')]=function(_0x8b6149,_0x1c7a59){var _0x215cef={'raw':!![],'where':{'id':_0x8b6149[_0x1adf('0x48')]['id']}},_0x2ca300={};_0x2ca300['model']=_[_0x1adf('0x31')](db[_0x1adf('0x41')][_0x1adf('0x2e')]);_0x2ca300[_0x1adf('0x30')]=_['keys'](_0x8b6149[_0x1adf('0x30')]);_0x2ca300[_0x1adf('0x32')]=_[_0x1adf('0x49')](_0x2ca300[_0x1adf('0x33')],_0x2ca300[_0x1adf('0x30')]);_0x215cef[_0x1adf('0x35')]=_[_0x1adf('0x49')](_0x2ca300['model'],qs[_0x1adf('0x34')](_0x8b6149[_0x1adf('0x30')][_0x1adf('0x34')]));_0x215cef[_0x1adf('0x35')]=_0x215cef['attributes'][_0x1adf('0x4a')]?_0x215cef[_0x1adf('0x35')]:_0x2ca300[_0x1adf('0x33')];if(_0x8b6149['query'][_0x1adf('0x42')]){_0x215cef[_0x1adf('0x43')]=[{'all':!![]}];}_0x215cef=_['merge']({},_0x215cef,_0x8b6149[_0x1adf('0x40')]);return db[_0x1adf('0x41')]['find'](_0x215cef)[_0x1adf('0x28')](handleEntityNotFound(_0x1c7a59,null))[_0x1adf('0x28')](respondWithResult(_0x1c7a59,null))[_0x1adf('0x46')](handleError(_0x1c7a59,null));};exports[_0x1adf('0x4b')]=function(_0x32b0ed,_0x3aa8e9){return db['JscriptySessionReport'][_0x1adf('0x4b')](_0x32b0ed['body'],{})[_0x1adf('0x28')](respondWithResult(_0x3aa8e9,0xc9))['catch'](handleError(_0x3aa8e9,null));};exports[_0x1adf('0x26')]=function(_0x5db005,_0x19f69a){if(_0x5db005[_0x1adf('0x4c')]['id']){delete _0x5db005[_0x1adf('0x4c')]['id'];}return db['JscriptySessionReport'][_0x1adf('0x4d')]({'where':{'id':_0x5db005[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x19f69a,null))[_0x1adf('0x28')](saveUpdates(_0x5db005[_0x1adf('0x4c')],null))['then'](respondWithResult(_0x19f69a,null))[_0x1adf('0x46')](handleError(_0x19f69a,null));};exports[_0x1adf('0x27')]=function(_0x4f47e8,_0x3d7905){return db['JscriptySessionReport'][_0x1adf('0x4d')]({'where':{'id':_0x4f47e8[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x3d7905,null))[_0x1adf('0x28')](removeEntity(_0x3d7905,null))[_0x1adf('0x46')](handleError(_0x3d7905,null));};exports[_0x1adf('0x4e')]=function(_0x5f5750,_0x288b0e){return db['JscriptySessionReport']['describe']()[_0x1adf('0x28')](respondWithResult(_0x288b0e,null))[_0x1adf('0x46')](handleError(_0x288b0e,null));};exports[_0x1adf('0x4f')]=function(_0x3df99c,_0x335d58,_0x497d80){var _0x465317={'raw':!![],'where':{}};var _0xc3b54e={};var _0x563fcc={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1adf('0x50')]({'where':{'id':_0x3df99c[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x335d58,null))[_0x1adf('0x28')](function(_0x18ee32){if(_0x18ee32){_0xc3b54e[_0x1adf('0x33')]=_[_0x1adf('0x31')](db['JscriptyQuestionReport']['rawAttributes']);_0xc3b54e[_0x1adf('0x30')]=_[_0x1adf('0x31')](_0x3df99c['query']);_0xc3b54e['filters']=_[_0x1adf('0x49')](_0xc3b54e[_0x1adf('0x33')],_0xc3b54e[_0x1adf('0x30')]);_0x465317['attributes']=_[_0x1adf('0x49')](_0xc3b54e[_0x1adf('0x33')],qs['fields'](_0x3df99c[_0x1adf('0x30')][_0x1adf('0x34')]));_0x465317['attributes']=_0x465317[_0x1adf('0x35')]['length']?_0x465317[_0x1adf('0x35')]:_0xc3b54e[_0x1adf('0x33')];if(!_0x3df99c[_0x1adf('0x30')][_0x1adf('0x36')](_0x1adf('0x37'))){_0x465317['limit']=qs['limit'](_0x3df99c[_0x1adf('0x30')]['limit']);_0x465317[_0x1adf('0x1c')]=qs[_0x1adf('0x1c')](_0x3df99c[_0x1adf('0x30')][_0x1adf('0x1c')]);}_0x465317['order']=qs[_0x1adf('0x39')](_0x3df99c['query'][_0x1adf('0x39')]);_0x465317[_0x1adf('0x3a')]=qs[_0x1adf('0x32')](_['pick'](_0x3df99c[_0x1adf('0x30')],_0xc3b54e[_0x1adf('0x32')]));_0x465317[_0x1adf('0x3a')][_0x1adf('0x51')]=_0x18ee32['id'];if(_0x3df99c[_0x1adf('0x30')][_0x1adf('0x3c')]){_0x465317[_0x1adf('0x3a')]=_['merge'](_0x465317[_0x1adf('0x3a')],{'$or':_[_0x1adf('0x2d')](_0x465317[_0x1adf('0x35')],function(_0x473e81){var _0x2ee81={};_0x2ee81[_0x473e81]={'$like':'%'+_0x3df99c[_0x1adf('0x30')][_0x1adf('0x3c')]+'%'};return _0x2ee81;})});}_0x465317=_[_0x1adf('0x3f')]({},_0x465317,_0x3df99c[_0x1adf('0x40')]);return db['JscriptyQuestionReport'][_0x1adf('0x1f')]({'where':_0x465317[_0x1adf('0x3a')]})[_0x1adf('0x28')](function(_0x103d8d){_0x563fcc['count']=_0x103d8d;if(_0x3df99c[_0x1adf('0x30')][_0x1adf('0x42')]){_0x465317[_0x1adf('0x43')]=[{'all':!![]}];}return db[_0x1adf('0x52')][_0x1adf('0x44')](_0x465317);})[_0x1adf('0x28')](function(_0x25f478){_0x563fcc[_0x1adf('0x45')]=_0x25f478;return _0x563fcc;});}})[_0x1adf('0x28')](respondWithFilteredResult(_0x335d58,_0x465317))[_0x1adf('0x46')](handleError(_0x335d58,null));}; \ No newline at end of file +var _0xb7c6=['hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x53c506,_0x1c0fe8){var _0x165888=function(_0x46f0b6){while(--_0x46f0b6){_0x53c506['push'](_0x53c506['shift']());}};_0x165888(++_0x1c0fe8);}(_0xb7c6,0xb3));var _0x6b7c=function(_0x18d4b8,_0x46f7fd){_0x18d4b8=_0x18d4b8-0x0;var _0x39f157=_0xb7c6[_0x18d4b8];return _0x39f157;};'use strict';var emlformat=require(_0x6b7c('0x0'));var rimraf=require(_0x6b7c('0x1'));var zipdir=require(_0x6b7c('0x2'));var jsonpatch=require(_0x6b7c('0x3'));var rp=require(_0x6b7c('0x4'));var moment=require(_0x6b7c('0x5'));var BPromise=require(_0x6b7c('0x6'));var Mustache=require(_0x6b7c('0x7'));var util=require(_0x6b7c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6b7c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6b7c('0xa'));var crypto=require(_0x6b7c('0xb'));var jsforce=require(_0x6b7c('0xc'));var deskjs=require(_0x6b7c('0xd'));var toCsv=require(_0x6b7c('0x9'));var querystring=require(_0x6b7c('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b7c('0xf'));var authService=require(_0x6b7c('0x10'));var qs=require(_0x6b7c('0x11'));var as=require(_0x6b7c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b7c('0x13'))('api');var utils=require(_0x6b7c('0x14'));var config=require(_0x6b7c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b7c('0x16'))['db'];function respondWithStatusCode(_0x494d50,_0x5ef6e1){_0x5ef6e1=_0x5ef6e1||0xcc;return function(_0x4f769e){if(_0x4f769e){return _0x494d50[_0x6b7c('0x17')](_0x5ef6e1);}return _0x494d50[_0x6b7c('0x18')](_0x5ef6e1)[_0x6b7c('0x19')]();};}function respondWithResult(_0x33fbd1,_0x4fe0d3){_0x4fe0d3=_0x4fe0d3||0xc8;return function(_0x151d0a){if(_0x151d0a){return _0x33fbd1[_0x6b7c('0x18')](_0x4fe0d3)[_0x6b7c('0x1a')](_0x151d0a);}};}function respondWithFilteredResult(_0x4e6dc2,_0x326c4e){return function(_0x45dc5c){if(_0x45dc5c){var _0xf8d2d=typeof _0x326c4e['offset']===_0x6b7c('0x1b')&&typeof _0x326c4e[_0x6b7c('0x1c')]==='undefined';var _0x333e6e=_0x45dc5c[_0x6b7c('0x1d')];var _0x590821=_0xf8d2d?0x0:_0x326c4e[_0x6b7c('0x1e')];var _0x2913d1=_0xf8d2d?_0x45dc5c[_0x6b7c('0x1d')]:_0x326c4e[_0x6b7c('0x1e')]+_0x326c4e['limit'];var _0x488c51;if(_0x2913d1>=_0x333e6e){_0x2913d1=_0x333e6e;_0x488c51=0xc8;}else{_0x488c51=0xce;}_0x4e6dc2[_0x6b7c('0x18')](_0x488c51);return _0x4e6dc2[_0x6b7c('0x1f')](_0x6b7c('0x20'),_0x590821+'-'+_0x2913d1+'/'+_0x333e6e)[_0x6b7c('0x1a')](_0x45dc5c);}return null;};}function patchUpdates(_0x2dbf60){return function(_0x56f27d){try{jsonpatch[_0x6b7c('0x21')](_0x56f27d,_0x2dbf60,!![]);}catch(_0x5398ca){return BPromise[_0x6b7c('0x22')](_0x5398ca);}return _0x56f27d[_0x6b7c('0x23')]();};}function saveUpdates(_0x6d7323,_0x1d9f8e){return function(_0x520aae){if(_0x520aae){return _0x520aae['update'](_0x6d7323)[_0x6b7c('0x24')](function(_0x1de31d){return _0x1de31d;});}return null;};}function removeEntity(_0x10f799,_0x4da0e5){return function(_0x427ab1){if(_0x427ab1){return _0x427ab1[_0x6b7c('0x25')]()[_0x6b7c('0x24')](function(){_0x10f799['status'](0xcc)[_0x6b7c('0x19')]();});}};}function handleEntityNotFound(_0x222904,_0x5e80b2){return function(_0x57d94e){if(!_0x57d94e){_0x222904[_0x6b7c('0x17')](0x194);}return _0x57d94e;};}function handleError(_0x1cbd70,_0x1e3156){_0x1e3156=_0x1e3156||0x1f4;return function(_0x3468db){logger[_0x6b7c('0x26')](_0x3468db['stack']);if(_0x3468db[_0x6b7c('0x27')]){delete _0x3468db[_0x6b7c('0x27')];}_0x1cbd70[_0x6b7c('0x18')](_0x1e3156)[_0x6b7c('0x28')](_0x3468db);};}exports['index']=function(_0x2d9d37,_0x29c1f3){var _0x521127={},_0x320204={},_0x1d4239={'count':0x0,'rows':[]};var _0x52273a=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x3128a0){return{'name':_0x3128a0[_0x6b7c('0x29')],'type':_0x3128a0[_0x6b7c('0x2a')]['key']};});_0x320204[_0x6b7c('0x2b')]=_[_0x6b7c('0x2c')](_0x52273a,'name');_0x320204[_0x6b7c('0x2d')]=_[_0x6b7c('0x2e')](_0x2d9d37['query']);_0x320204[_0x6b7c('0x2f')]=_[_0x6b7c('0x30')](_0x320204[_0x6b7c('0x2b')],_0x320204[_0x6b7c('0x2d')]);_0x521127['attributes']=_['intersection'](_0x320204[_0x6b7c('0x2b')],qs[_0x6b7c('0x31')](_0x2d9d37[_0x6b7c('0x2d')]['fields']));_0x521127[_0x6b7c('0x32')]=_0x521127[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x521127[_0x6b7c('0x32')]:_0x320204[_0x6b7c('0x2b')];if(!_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x34')](_0x6b7c('0x35'))){_0x521127[_0x6b7c('0x1c')]=qs[_0x6b7c('0x1c')](_0x2d9d37['query']['limit']);_0x521127[_0x6b7c('0x1e')]=qs[_0x6b7c('0x1e')](_0x2d9d37[_0x6b7c('0x2d')]['offset']);}_0x521127[_0x6b7c('0x36')]=qs[_0x6b7c('0x37')](_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x37')]);_0x521127['where']=qs[_0x6b7c('0x2f')](_[_0x6b7c('0x38')](_0x2d9d37['query'],_0x320204[_0x6b7c('0x2f')]),_0x52273a);if(_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x39')]){_0x521127['where']=_[_0x6b7c('0x3a')](_0x521127[_0x6b7c('0x3b')],{'$or':_['map'](_0x52273a,function(_0x45bc7d){if(_0x45bc7d[_0x6b7c('0x2a')]!==_0x6b7c('0x3c')){var _0x2c4b9c={};_0x2c4b9c[_0x45bc7d[_0x6b7c('0x27')]]={'$like':'%'+_0x2d9d37['query']['filter']+'%'};return _0x2c4b9c;}})});}_0x521127=_[_0x6b7c('0x3a')]({},_0x521127,_0x2d9d37['options']);var _0x442840={'where':_0x521127['where']};return db[_0x6b7c('0x3d')][_0x6b7c('0x1d')](_0x442840)['then'](function(_0x5997b8){_0x1d4239[_0x6b7c('0x1d')]=_0x5997b8;if(_0x2d9d37['query'][_0x6b7c('0x3e')]){_0x521127[_0x6b7c('0x3f')]=[{'all':!![]}];}return db[_0x6b7c('0x3d')][_0x6b7c('0x40')](_0x521127);})[_0x6b7c('0x24')](function(_0x3ad775){_0x1d4239[_0x6b7c('0x41')]=_0x3ad775;return _0x1d4239;})['then'](respondWithFilteredResult(_0x29c1f3,_0x521127))[_0x6b7c('0x42')](handleError(_0x29c1f3,null));};exports[_0x6b7c('0x43')]=function(_0x21716f,_0xd2f408){var _0x45333b={'raw':!![],'where':{'id':_0x21716f[_0x6b7c('0x44')]['id']}},_0x105661={};_0x105661[_0x6b7c('0x2b')]=_[_0x6b7c('0x2e')](db[_0x6b7c('0x3d')][_0x6b7c('0x45')]);_0x105661['query']=_[_0x6b7c('0x2e')](_0x21716f['query']);_0x105661['filters']=_[_0x6b7c('0x30')](_0x105661[_0x6b7c('0x2b')],_0x105661[_0x6b7c('0x2d')]);_0x45333b['attributes']=_[_0x6b7c('0x30')](_0x105661[_0x6b7c('0x2b')],qs[_0x6b7c('0x31')](_0x21716f['query'][_0x6b7c('0x31')]));_0x45333b[_0x6b7c('0x32')]=_0x45333b[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x45333b[_0x6b7c('0x32')]:_0x105661[_0x6b7c('0x2b')];if(_0x21716f[_0x6b7c('0x2d')][_0x6b7c('0x3e')]){_0x45333b[_0x6b7c('0x3f')]=[{'all':!![]}];}_0x45333b=_[_0x6b7c('0x3a')]({},_0x45333b,_0x21716f[_0x6b7c('0x46')]);return db[_0x6b7c('0x3d')][_0x6b7c('0x47')](_0x45333b)['then'](handleEntityNotFound(_0xd2f408,null))[_0x6b7c('0x24')](respondWithResult(_0xd2f408,null))[_0x6b7c('0x42')](handleError(_0xd2f408,null));};exports[_0x6b7c('0x48')]=function(_0x220c5c,_0x3c2b44){return db[_0x6b7c('0x3d')][_0x6b7c('0x48')](_0x220c5c[_0x6b7c('0x49')],{})['then'](respondWithResult(_0x3c2b44,0xc9))[_0x6b7c('0x42')](handleError(_0x3c2b44,null));};exports[_0x6b7c('0x4a')]=function(_0x66577f,_0x59299f){if(_0x66577f['body']['id']){delete _0x66577f[_0x6b7c('0x49')]['id'];}return db['JscriptySessionReport'][_0x6b7c('0x47')]({'where':{'id':_0x66577f[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x59299f,null))[_0x6b7c('0x24')](saveUpdates(_0x66577f['body'],null))['then'](respondWithResult(_0x59299f,null))['catch'](handleError(_0x59299f,null));};exports[_0x6b7c('0x25')]=function(_0x48ca8f,_0x572fee){return db[_0x6b7c('0x3d')][_0x6b7c('0x47')]({'where':{'id':_0x48ca8f[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x572fee,null))[_0x6b7c('0x24')](removeEntity(_0x572fee,null))[_0x6b7c('0x42')](handleError(_0x572fee,null));};exports[_0x6b7c('0x4b')]=function(_0x5b6dc4,_0x496a7d){return db[_0x6b7c('0x3d')]['describe']()[_0x6b7c('0x24')](respondWithResult(_0x496a7d,null))[_0x6b7c('0x42')](handleError(_0x496a7d,null));};exports['getQuestions']=function(_0xc1ed8a,_0x4fdacb,_0x155589){var _0x52c377={'raw':!![],'where':{}};var _0x11a4c5={};var _0x3ecf27={'count':0x0,'rows':[]};return db[_0x6b7c('0x3d')]['findOne']({'where':{'id':_0xc1ed8a[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x4fdacb,null))[_0x6b7c('0x24')](function(_0x350d10){if(_0x350d10){_0x11a4c5[_0x6b7c('0x2b')]=_['keys'](db['JscriptyQuestionReport'][_0x6b7c('0x45')]);_0x11a4c5['query']=_['keys'](_0xc1ed8a[_0x6b7c('0x2d')]);_0x11a4c5['filters']=_[_0x6b7c('0x30')](_0x11a4c5[_0x6b7c('0x2b')],_0x11a4c5[_0x6b7c('0x2d')]);_0x52c377[_0x6b7c('0x32')]=_[_0x6b7c('0x30')](_0x11a4c5['model'],qs[_0x6b7c('0x31')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x31')]));_0x52c377[_0x6b7c('0x32')]=_0x52c377[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x52c377['attributes']:_0x11a4c5[_0x6b7c('0x2b')];if(!_0xc1ed8a['query'][_0x6b7c('0x34')](_0x6b7c('0x35'))){_0x52c377[_0x6b7c('0x1c')]=qs[_0x6b7c('0x1c')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x1c')]);_0x52c377[_0x6b7c('0x1e')]=qs[_0x6b7c('0x1e')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x1e')]);}_0x52c377['order']=qs[_0x6b7c('0x37')](_0xc1ed8a[_0x6b7c('0x2d')]['sort']);_0x52c377[_0x6b7c('0x3b')]=qs[_0x6b7c('0x2f')](_['pick'](_0xc1ed8a['query'],_0x11a4c5[_0x6b7c('0x2f')]));_0x52c377['where'][_0x6b7c('0x4c')]=_0x350d10['id'];if(_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x39')]){_0x52c377[_0x6b7c('0x3b')]=_[_0x6b7c('0x3a')](_0x52c377[_0x6b7c('0x3b')],{'$or':_[_0x6b7c('0x2c')](_0x52c377['attributes'],function(_0x58ad10){var _0x13b6ad={};_0x13b6ad[_0x58ad10]={'$like':'%'+_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x39')]+'%'};return _0x13b6ad;})});}_0x52c377=_[_0x6b7c('0x3a')]({},_0x52c377,_0xc1ed8a[_0x6b7c('0x46')]);return db['JscriptyQuestionReport'][_0x6b7c('0x1d')]({'where':_0x52c377[_0x6b7c('0x3b')]})['then'](function(_0x4fab72){_0x3ecf27[_0x6b7c('0x1d')]=_0x4fab72;if(_0xc1ed8a['query']['includeAll']){_0x52c377['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6b7c('0x40')](_0x52c377);})[_0x6b7c('0x24')](function(_0x40fb8e){_0x3ecf27[_0x6b7c('0x41')]=_0x40fb8e;return _0x3ecf27;});}})[_0x6b7c('0x24')](respondWithFilteredResult(_0x4fdacb,_0x52c377))[_0x6b7c('0x42')](handleError(_0x4fdacb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e223904..0fce448 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 _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x4f4056,_0x28c21c){var _0x17f578=function(_0x46b44e){while(--_0x46b44e){_0x4f4056['push'](_0x4f4056['shift']());}};_0x17f578(++_0x28c21c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5ed659,_0x53e8b3){_0x5ed659=_0x5ed659-0x0;var _0x459a1e=_0xc1c6[_0x5ed659];return _0x459a1e;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9a5a,0x194));var _0xa9a5=function(_0x2b7f11,_0x31ef61){_0x2b7f11=_0x2b7f11-0x0;var _0xb3d97=_0x9a5a[_0x2b7f11];return _0xb3d97;};'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('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'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 d58f5f4..b29954f 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 _0x77e6=['client','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4e1981,_0x17e766){var _0x2d0085=function(_0x3ce7b0){while(--_0x3ce7b0){_0x4e1981['push'](_0x4e1981['shift']());}};_0x2d0085(++_0x17e766);}(_0x77e6,0x1a6));var _0x677e=function(_0x498d20,_0x3458c6){_0x498d20=_0x498d20-0x0;var _0x2e4020=_0x77e6[_0x498d20];return _0x2e4020;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file +var _0x0adf=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x43c1a1,_0x5d2620){_0x43c1a1=_0x43c1a1-0x0;var _0x3d28f5=_0x0adf[_0x43c1a1];return _0x3d28f5;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2d7376d..a7a56e0 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 _0x5267=['index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get'];(function(_0x1a8adb,_0x40b6b0){var _0x222790=function(_0x139118){while(--_0x139118){_0x1a8adb['push'](_0x1a8adb['shift']());}};_0x222790(++_0x40b6b0);}(_0x5267,0x8d));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7526('0x0'));var util=require(_0x7526('0x1'));var path=require(_0x7526('0x2'));var timeout=require(_0x7526('0x3'));var express=require(_0x7526('0x4'));var router=express[_0x7526('0x5')]();var fs_extra=require(_0x7526('0x6'));var auth=require(_0x7526('0x7'));var interaction=require(_0x7526('0x8'));var config=require('../../config/environment');var controller=require(_0x7526('0x9'));router[_0x7526('0xa')]('/',controller[_0x7526('0xb')]);router[_0x7526('0xc')](_0x7526('0xd'),auth['isAuthenticated'](),controller[_0x7526('0xe')]);router[_0x7526('0xa')](_0x7526('0xf'),auth[_0x7526('0x10')](),controller[_0x7526('0x11')]);module[_0x7526('0x12')]=router; \ No newline at end of file +var _0x1e6f=['/:id','/download_log_file','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','get','index'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x1e6f,0x70));var _0xf1e6=function(_0x891779,_0x1cf07b){_0x891779=_0x891779-0x0;var _0x1b7975=_0x1e6f[_0x891779];return _0x1b7975;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require(_0xf1e6('0x1'));var path=require(_0xf1e6('0x2'));var timeout=require(_0xf1e6('0x3'));var express=require(_0xf1e6('0x4'));var router=express[_0xf1e6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0xf1e6('0x6')]('/',controller[_0xf1e6('0x7')]);router['put'](_0xf1e6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf1e6('0x6')](_0xf1e6('0x9'),auth[_0xf1e6('0xa')](),controller['downloadLogFile']);module[_0xf1e6('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6fecb08..a20e5b9 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 _0x367c=['STRING','exports'];(function(_0x3a4549,_0x42524a){var _0x4582ea=function(_0x241887){while(--_0x241887){_0x3a4549['push'](_0x3a4549['shift']());}};_0x4582ea(++_0x42524a);}(_0x367c,0xfd));var _0xc367=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x367c[_0x25e109];return _0xc0f7d6;};'use strict';var Sequelize=require('sequelize');module[_0xc367('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xc367('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd732=['TEXT','STRING','INTEGER','exports'];(function(_0x33afc1,_0x9b3caf){var _0x585b01=function(_0x3278e3){while(--_0x3278e3){_0x33afc1['push'](_0x33afc1['shift']());}};_0x585b01(++_0x9b3caf);}(_0xd732,0x17f));var _0x2d73=function(_0x59e905,_0x308e79){_0x59e905=_0x59e905-0x0;var _0xa9e9d9=_0xd732[_0x59e905];return _0xa9e9d9;};'use strict';var Sequelize=require('sequelize');module[_0x2d73('0x0')]={'license':{'type':Sequelize[_0x2d73('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2d73('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 1eb1fce..90262ac 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 _0xe6ed=['text/plain','download','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','query','intersection','attributes','fields','merge','options','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-Type'];(function(_0x344ec5,_0x5c2f51){var _0x2bc076=function(_0x18d638){while(--_0x18d638){_0x344ec5['push'](_0x344ec5['shift']());}};_0x2bc076(++_0x5c2f51);}(_0xe6ed,0xfe));var _0xde6e=function(_0x531ee2,_0x35fe93){_0x531ee2=_0x531ee2-0x0;var _0x50c437=_0xe6ed[_0x531ee2];return _0x50c437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6e('0x0'));var zipdir=require(_0xde6e('0x1'));var jsonpatch=require(_0xde6e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde6e('0x3'));var Mustache=require(_0xde6e('0x4'));var util=require(_0xde6e('0x5'));var path=require(_0xde6e('0x6'));var sox=require(_0xde6e('0x7'));var csv=require(_0xde6e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde6e('0x9'));var _=require('lodash');var squel=require(_0xde6e('0xa'));var crypto=require(_0xde6e('0xb'));var jsforce=require(_0xde6e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xde6e('0xd'));var Redis=require(_0xde6e('0xe'));var authService=require(_0xde6e('0xf'));var qs=require(_0xde6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde6e('0x11'));var logger=require('../../config/logger')(_0xde6e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115d9a,_0x454bd7){_0x454bd7=_0x454bd7||0xcc;return function(_0x4cfa26){if(_0x4cfa26){return _0x115d9a[_0xde6e('0x13')](_0x454bd7);}return _0x115d9a[_0xde6e('0x14')](_0x454bd7)[_0xde6e('0x15')]();};}function respondWithResult(_0x5d5345,_0xb2bca2){_0xb2bca2=_0xb2bca2||0xc8;return function(_0x5d6c74){if(_0x5d6c74){return _0x5d5345[_0xde6e('0x14')](_0xb2bca2)[_0xde6e('0x16')](_0x5d6c74);}};}function respondWithFilteredResult(_0x80648e,_0x12474c){return function(_0x571e5f){if(_0x571e5f){var _0x2e4be1=typeof _0x12474c[_0xde6e('0x17')]===_0xde6e('0x18')&&typeof _0x12474c[_0xde6e('0x19')]===_0xde6e('0x18');var _0x1bb450=_0x571e5f[_0xde6e('0x1a')];var _0x5b6533=_0x2e4be1?0x0:_0x12474c[_0xde6e('0x17')];var _0x2bdffb=_0x2e4be1?_0x571e5f[_0xde6e('0x1a')]:_0x12474c[_0xde6e('0x17')]+_0x12474c[_0xde6e('0x19')];var _0x2b0bd6;if(_0x2bdffb>=_0x1bb450){_0x2bdffb=_0x1bb450;_0x2b0bd6=0xc8;}else{_0x2b0bd6=0xce;}_0x80648e[_0xde6e('0x14')](_0x2b0bd6);return _0x80648e[_0xde6e('0x1b')]('Content-Range',_0x5b6533+'-'+_0x2bdffb+'/'+_0x1bb450)[_0xde6e('0x16')](_0x571e5f);}return null;};}function patchUpdates(_0x2e8110){return function(_0x461c38){try{jsonpatch['apply'](_0x461c38,_0x2e8110,!![]);}catch(_0x4b03ee){return BPromise[_0xde6e('0x1c')](_0x4b03ee);}return _0x461c38[_0xde6e('0x1d')]();};}function saveUpdates(_0x278a95,_0x323ac5){return function(_0x51feee){if(_0x51feee){return _0x51feee[_0xde6e('0x1e')](_0x278a95)[_0xde6e('0x1f')](function(_0x5dc570){return _0x5dc570;});}return null;};}function removeEntity(_0xaedeae,_0x273bfb){return function(_0x3776e3){if(_0x3776e3){return _0x3776e3[_0xde6e('0x20')]()[_0xde6e('0x1f')](function(){_0xaedeae['status'](0xcc)[_0xde6e('0x15')]();});}};}function handleEntityNotFound(_0x245932,_0x592bbd){return function(_0xc0f554){if(!_0xc0f554){_0x245932[_0xde6e('0x13')](0x194);}return _0xc0f554;};}function handleError(_0x207b61,_0x451d12){_0x451d12=_0x451d12||0x1f4;return function(_0x25e9ce){logger[_0xde6e('0x21')](_0x25e9ce[_0xde6e('0x22')]);if(_0x25e9ce[_0xde6e('0x23')]){delete _0x25e9ce[_0xde6e('0x23')];}_0x207b61[_0xde6e('0x14')](_0x451d12)[_0xde6e('0x24')](_0x25e9ce);};}var utilLicense=require('../../config/license/util');exports[_0xde6e('0x25')]=function(_0x28ad94,_0x35fac6){var _0x4b554f={'raw':!![],'where':{'id':0x1}},_0x205119={};_0x205119[_0xde6e('0x26')]=_[_0xde6e('0x27')](db['License']['rawAttributes']);_0x205119[_0xde6e('0x28')]=_['keys'](_0x28ad94[_0xde6e('0x28')]);_0x205119['filters']=_[_0xde6e('0x29')](_0x205119['model'],_0x205119[_0xde6e('0x28')]);_0x4b554f[_0xde6e('0x2a')]=_[_0xde6e('0x29')](_0x205119[_0xde6e('0x26')],qs[_0xde6e('0x2b')](_0x28ad94[_0xde6e('0x28')][_0xde6e('0x2b')]));_0x4b554f[_0xde6e('0x2a')]=_0x4b554f[_0xde6e('0x2a')]['length']?_0x4b554f[_0xde6e('0x2a')]:_0x205119['model'];_0x4b554f=_[_0xde6e('0x2c')]({},_0x4b554f,_0x28ad94[_0xde6e('0x2d')]);return utilLicense['getLicense'](_0x4b554f)[_0xde6e('0x1f')](respondWithResult(_0x35fac6,null))['catch'](handleError(_0x35fac6,null));};exports['update']=function(_0x5192d4,_0x473944){if(_0x5192d4[_0xde6e('0x2e')]['id']){delete _0x5192d4['body']['id'];}return db[_0xde6e('0x2f')][_0xde6e('0x30')]({'where':{'id':_0x5192d4[_0xde6e('0x31')]['id']}})[_0xde6e('0x1f')](handleEntityNotFound(_0x473944,null))[_0xde6e('0x1f')](function(_0x4db4fe){var _0x2c0d7b=_0x4db4fe[_0xde6e('0x32')]({'plain':!![]});return utilLicense[_0xde6e('0x33')](_0x2c0d7b,_0x5192d4[_0xde6e('0x2e')][_0xde6e('0x34')]);})['then'](function(_0x1f9fe8){if(!_0x1f9fe8[_0xde6e('0x35')]){return saveUpdates(_0x5192d4['body'],null);}return _0x1f9fe8;})['then'](respondWithResult(_0x473944,null))['catch'](handleError(_0x473944,null));};exports[_0xde6e('0x36')]=function(_0x2885b2,_0x34cdac){var _0x769d8d='license-info.log';var _0x17f415=path[_0xde6e('0x37')](_0xde6e('0x38'),_0xde6e('0x39'),_0xde6e('0x3a'),_0x769d8d);_0x34cdac[_0xde6e('0x3b')]('Content-disposition','attachment;\x20filename='+_0x769d8d);_0x34cdac[_0xde6e('0x1b')](_0xde6e('0x3c'),_0xde6e('0x3d'));_0x34cdac[_0xde6e('0x3e')](_0x17f415);}; \ No newline at end of file +var _0xff3e=['../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','License','rawAttributes','query','keys','filters','model','attributes','fields','merge','options','getLicense','catch','body','params','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','setHeader','Content-disposition','Content-Type','text/plain','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x2aae31,_0x1014a2){var _0x379006=function(_0x5345ae){while(--_0x5345ae){_0x2aae31['push'](_0x2aae31['shift']());}};_0x379006(++_0x1014a2);}(_0xff3e,0x1d9));var _0xeff3=function(_0x555f36,_0x31c3d3){_0x555f36=_0x555f36-0x0;var _0xa879fd=_0xff3e[_0x555f36];return _0xa879fd;};'use strict';var emlformat=require(_0xeff3('0x0'));var rimraf=require(_0xeff3('0x1'));var zipdir=require(_0xeff3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeff3('0x3'));var BPromise=require(_0xeff3('0x4'));var Mustache=require('mustache');var util=require(_0xeff3('0x5'));var path=require(_0xeff3('0x6'));var sox=require(_0xeff3('0x7'));var csv=require('to-csv');var ejs=require(_0xeff3('0x8'));var fs=require('fs');var fs_extra=require(_0xeff3('0x9'));var _=require(_0xeff3('0xa'));var squel=require(_0xeff3('0xb'));var crypto=require(_0xeff3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeff3('0xd'));var toCsv=require(_0xeff3('0xe'));var querystring=require(_0xeff3('0xf'));var Papa=require(_0xeff3('0x10'));var Redis=require(_0xeff3('0x11'));var authService=require(_0xeff3('0x12'));var qs=require(_0xeff3('0x13'));var as=require(_0xeff3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeff3('0x15'))(_0xeff3('0x16'));var utils=require('../../config/utils');var config=require(_0xeff3('0x17'));var licenseUtil=require(_0xeff3('0x18'));var db=require(_0xeff3('0x19'))['db'];function respondWithStatusCode(_0x19250c,_0x2257a2){_0x2257a2=_0x2257a2||0xcc;return function(_0x398c61){if(_0x398c61){return _0x19250c[_0xeff3('0x1a')](_0x2257a2);}return _0x19250c['status'](_0x2257a2)[_0xeff3('0x1b')]();};}function respondWithResult(_0x69a510,_0xd92f0e){_0xd92f0e=_0xd92f0e||0xc8;return function(_0x16b9bc){if(_0x16b9bc){return _0x69a510[_0xeff3('0x1c')](_0xd92f0e)['json'](_0x16b9bc);}};}function respondWithFilteredResult(_0x2d6b4e,_0x2b2e70){return function(_0x4830b5){if(_0x4830b5){var _0x2ad384=typeof _0x2b2e70[_0xeff3('0x1d')]==='undefined'&&typeof _0x2b2e70[_0xeff3('0x1e')]===_0xeff3('0x1f');var _0x4f42e1=_0x4830b5[_0xeff3('0x20')];var _0x51a498=_0x2ad384?0x0:_0x2b2e70['offset'];var _0x197add=_0x2ad384?_0x4830b5[_0xeff3('0x20')]:_0x2b2e70[_0xeff3('0x1d')]+_0x2b2e70['limit'];var _0x14d142;if(_0x197add>=_0x4f42e1){_0x197add=_0x4f42e1;_0x14d142=0xc8;}else{_0x14d142=0xce;}_0x2d6b4e[_0xeff3('0x1c')](_0x14d142);return _0x2d6b4e[_0xeff3('0x21')](_0xeff3('0x22'),_0x51a498+'-'+_0x197add+'/'+_0x4f42e1)[_0xeff3('0x23')](_0x4830b5);}return null;};}function patchUpdates(_0x3efa9c){return function(_0x2f7751){try{jsonpatch[_0xeff3('0x24')](_0x2f7751,_0x3efa9c,!![]);}catch(_0x4361d4){return BPromise[_0xeff3('0x25')](_0x4361d4);}return _0x2f7751[_0xeff3('0x26')]();};}function saveUpdates(_0xf96fba,_0x437a06){return function(_0x4b6a42){if(_0x4b6a42){return _0x4b6a42[_0xeff3('0x27')](_0xf96fba)[_0xeff3('0x28')](function(_0x39d081){return _0x39d081;});}return null;};}function removeEntity(_0x25e4dc,_0x2d17f5){return function(_0x11c9f4){if(_0x11c9f4){return _0x11c9f4[_0xeff3('0x29')]()[_0xeff3('0x28')](function(){_0x25e4dc[_0xeff3('0x1c')](0xcc)[_0xeff3('0x1b')]();});}};}function handleEntityNotFound(_0x1e0cd9,_0x4445f6){return function(_0x3548b6){if(!_0x3548b6){_0x1e0cd9['sendStatus'](0x194);}return _0x3548b6;};}function handleError(_0x2a3853,_0x322cdf){_0x322cdf=_0x322cdf||0x1f4;return function(_0x273632){logger[_0xeff3('0x2a')](_0x273632['stack']);if(_0x273632[_0xeff3('0x2b')]){delete _0x273632['name'];}_0x2a3853[_0xeff3('0x1c')](_0x322cdf)[_0xeff3('0x2c')](_0x273632);};}var utilLicense=require(_0xeff3('0x18'));exports[_0xeff3('0x2d')]=function(_0x9d5ed6,_0x4b37ac){var _0x3156f8={'raw':!![],'where':{'id':0x1}},_0x3d3e31={};_0x3d3e31['model']=_['keys'](db[_0xeff3('0x2e')][_0xeff3('0x2f')]);_0x3d3e31[_0xeff3('0x30')]=_[_0xeff3('0x31')](_0x9d5ed6[_0xeff3('0x30')]);_0x3d3e31[_0xeff3('0x32')]=_['intersection'](_0x3d3e31[_0xeff3('0x33')],_0x3d3e31[_0xeff3('0x30')]);_0x3156f8[_0xeff3('0x34')]=_['intersection'](_0x3d3e31[_0xeff3('0x33')],qs[_0xeff3('0x35')](_0x9d5ed6[_0xeff3('0x30')][_0xeff3('0x35')]));_0x3156f8[_0xeff3('0x34')]=_0x3156f8[_0xeff3('0x34')]['length']?_0x3156f8[_0xeff3('0x34')]:_0x3d3e31[_0xeff3('0x33')];_0x3156f8=_[_0xeff3('0x36')]({},_0x3156f8,_0x9d5ed6[_0xeff3('0x37')]);return utilLicense[_0xeff3('0x38')](_0x3156f8)['then'](respondWithResult(_0x4b37ac,null))[_0xeff3('0x39')](handleError(_0x4b37ac,null));};exports[_0xeff3('0x27')]=function(_0x3f1e82,_0x5da142){if(_0x3f1e82['body']['id']){delete _0x3f1e82[_0xeff3('0x3a')]['id'];}return db['License']['find']({'where':{'id':_0x3f1e82[_0xeff3('0x3b')]['id']}})[_0xeff3('0x28')](handleEntityNotFound(_0x5da142,null))[_0xeff3('0x28')](function(_0x3f20b5){var _0x4164d4=_0x3f20b5['get']({'plain':!![]});return utilLicense[_0xeff3('0x3c')](_0x4164d4,_0x3f1e82['body'][_0xeff3('0x3d')]);})[_0xeff3('0x28')](function(_0x2d1349){if(!_0x2d1349[_0xeff3('0x3e')]){return saveUpdates(_0x3f1e82[_0xeff3('0x3a')],null);}return _0x2d1349;})[_0xeff3('0x28')](respondWithResult(_0x5da142,null))['catch'](handleError(_0x5da142,null));};exports[_0xeff3('0x3f')]=function(_0x1cd1d2,_0x46b5c9){var _0x2bc19f=_0xeff3('0x40');var _0x3b1f43=path['join'](_0xeff3('0x41'),_0xeff3('0x42'),'xcally',_0x2bc19f);_0x46b5c9[_0xeff3('0x43')](_0xeff3('0x44'),'attachment;\x20filename='+_0x2bc19f);_0x46b5c9[_0xeff3('0x21')](_0xeff3('0x45'),_0xeff3('0x46'));_0x46b5c9['download'](_0x3b1f43);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 95e8535..c64a1ee 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 _0xa31e=['exports','define','License','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./license.attributes'];(function(_0x194207,_0x14e634){var _0x5791d1=function(_0x39b4c1){while(--_0x39b4c1){_0x194207['push'](_0x194207['shift']());}};_0x5791d1(++_0x14e634);}(_0xa31e,0x1b1));var _0xea31=function(_0x3edf53,_0xfcd5d){_0x3edf53=_0x3edf53-0x0;var _0x4e7f9e=_0xa31e[_0x3edf53];return _0x4e7f9e;};'use strict';var _=require(_0xea31('0x0'));var util=require('util');var logger=require(_0xea31('0x1'))('api');var moment=require(_0xea31('0x2'));var BPromise=require(_0xea31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea31('0x4'));var config=require(_0xea31('0x5'));var attributes=require(_0xea31('0x6'));module[_0xea31('0x7')]=function(_0x332e79,_0x937c7a){return _0x332e79[_0xea31('0x8')](_0xea31('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfad2=['../../config/environment','./license.attributes','define','License','license','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5d789c,_0x2a5732){var _0xfcbde3=function(_0x291246){while(--_0x291246){_0x5d789c['push'](_0x5d789c['shift']());}};_0xfcbde3(++_0x2a5732);}(_0xfad2,0x1a7));var _0x2fad=function(_0x35d91f,_0x28881a){_0x35d91f=_0x35d91f-0x0;var _0x200910=_0xfad2[_0x35d91f];return _0x200910;};'use strict';var _=require('lodash');var util=require(_0x2fad('0x0'));var logger=require(_0x2fad('0x1'))('api');var moment=require(_0x2fad('0x2'));var BPromise=require(_0x2fad('0x3'));var rp=require(_0x2fad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fad('0x5'));var config=require(_0x2fad('0x6'));var attributes=require(_0x2fad('0x7'));module['exports']=function(_0x47ef9e,_0x486c89){return _0x47ef9e[_0x2fad('0x8')](_0x2fad('0x9'),attributes,{'tableName':_0x2fad('0xa'),'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 6f49630..ac99304 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 _0x03e4=['http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x40ed66,_0x88c5c6){var _0x129952=function(_0x445c7a){while(--_0x445c7a){_0x40ed66['push'](_0x40ed66['shift']());}};_0x129952(++_0x88c5c6);}(_0x03e4,0xfe));var _0x403e=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x03e4[_0x21c601];return _0xd423f;};'use strict';var _=require(_0x403e('0x0'));var util=require('util');var moment=require(_0x403e('0x1'));var BPromise=require(_0x403e('0x2'));var rs=require(_0x403e('0x3'));var fs=require('fs');var Redis=require(_0x403e('0x4'));var db=require(_0x403e('0x5'))['db'];var utils=require(_0x403e('0x6'));var logger=require(_0x403e('0x7'))('rpc');var config=require(_0x403e('0x8'));var jayson=require(_0x403e('0x9'));var client=jayson['client'][_0x403e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291e9a,_0x10d43b,_0x81d9f2){return new BPromise(function(_0x4d9cfe,_0x4ca2a8){return client[_0x403e('0xb')](_0x291e9a,_0x81d9f2)[_0x403e('0xc')](function(_0x2833a6){logger['info'](_0x403e('0xd'),_0x10d43b,'request\x20sent');logger[_0x403e('0xe')](_0x403e('0xf'),_0x10d43b,_0x403e('0x10'),JSON[_0x403e('0x11')](_0x2833a6));if(_0x2833a6['error']){if(_0x2833a6['error'][_0x403e('0x12')]===0x1f4){logger[_0x403e('0x13')](_0x403e('0xd'),_0x10d43b,_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);return _0x4ca2a8(_0x2833a6[_0x403e('0x13')]['message']);}logger['error'](_0x403e('0xd'),_0x10d43b,_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);return _0x4d9cfe(_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);}else{logger[_0x403e('0x15')](_0x403e('0xd'),_0x10d43b,_0x403e('0x10'));_0x4d9cfe(_0x2833a6[_0x403e('0x16')]['message']);}})[_0x403e('0x17')](function(_0x2f9c7f){logger['error']('License,\x20%s,\x20%s',_0x10d43b,_0x2f9c7f);_0x4ca2a8(_0x2f9c7f);});});} \ No newline at end of file +var _0xca9f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xca9f,0xfb));var _0xfca9=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xca9f[_0x4d6ac0];return _0x5296c4;};'use strict';var _=require(_0xfca9('0x0'));var util=require(_0xfca9('0x1'));var moment=require(_0xfca9('0x2'));var BPromise=require(_0xfca9('0x3'));var rs=require(_0xfca9('0x4'));var fs=require('fs');var Redis=require(_0xfca9('0x5'));var db=require(_0xfca9('0x6'))['db'];var utils=require(_0xfca9('0x7'));var logger=require(_0xfca9('0x8'))(_0xfca9('0x9'));var config=require(_0xfca9('0xa'));var jayson=require(_0xfca9('0xb'));var client=jayson['client'][_0xfca9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40c9d5,_0x3fb006,_0x51f23d){return new BPromise(function(_0x42abff,_0x1f0430){return client['request'](_0x40c9d5,_0x51f23d)[_0xfca9('0xd')](function(_0x3b33be){logger[_0xfca9('0xe')](_0xfca9('0xf'),_0x3fb006,'request\x20sent');logger[_0xfca9('0x10')](_0xfca9('0x11'),_0x3fb006,'request\x20sent',JSON[_0xfca9('0x12')](_0x3b33be));if(_0x3b33be[_0xfca9('0x13')]){if(_0x3b33be['error']['code']===0x1f4){logger[_0xfca9('0x13')](_0xfca9('0xf'),_0x3fb006,_0x3b33be[_0xfca9('0x13')][_0xfca9('0x14')]);return _0x1f0430(_0x3b33be[_0xfca9('0x13')][_0xfca9('0x14')]);}logger[_0xfca9('0x13')](_0xfca9('0xf'),_0x3fb006,_0x3b33be['error']['message']);return _0x42abff(_0x3b33be[_0xfca9('0x13')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x3fb006,'request\x20sent');_0x42abff(_0x3b33be[_0xfca9('0x15')]['message']);}})[_0xfca9('0x16')](function(_0xd6e0fd){logger['error'](_0xfca9('0xf'),_0x3fb006,_0xd6e0fd);_0x1f0430(_0xd6e0fd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2858944..4c4edc1 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 _0x9100=['addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','/describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents'];(function(_0xacdd48,_0x5e5120){var _0x49dfb2=function(_0x1927bc){while(--_0x1927bc){_0xacdd48['push'](_0xacdd48['shift']());}};_0x49dfb2(++_0x5e5120);}(_0x9100,0x195));var _0x0910=function(_0x2ab6ee,_0x521774){_0x2ab6ee=_0x2ab6ee-0x0;var _0x2bff37=_0x9100[_0x2ab6ee];return _0x2bff37;};'use strict';var multer=require(_0x0910('0x0'));var util=require(_0x0910('0x1'));var path=require(_0x0910('0x2'));var timeout=require(_0x0910('0x3'));var express=require(_0x0910('0x4'));var router=express[_0x0910('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0910('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0910('0x7'));var controller=require(_0x0910('0x8'));router['get']('/',auth[_0x0910('0x9')](),controller['index']);router['get'](_0x0910('0xa'),auth[_0x0910('0x9')](),controller['describe']);router[_0x0910('0xb')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0xd')]);router[_0x0910('0xb')](_0x0910('0xe'),auth[_0x0910('0x9')](),controller['getDispositions']);router[_0x0910('0xb')](_0x0910('0xf'),auth[_0x0910('0x9')](),controller['getAnswers']);router[_0x0910('0xb')](_0x0910('0x10'),auth[_0x0910('0x9')](),controller['getImap']);router[_0x0910('0xb')](_0x0910('0x11'),auth[_0x0910('0x9')](),controller[_0x0910('0x12')]);router[_0x0910('0xb')](_0x0910('0x13'),auth[_0x0910('0x9')](),controller[_0x0910('0x14')]);router[_0x0910('0xb')](_0x0910('0x15'),auth[_0x0910('0x9')](),controller[_0x0910('0x16')]);router[_0x0910('0xb')](_0x0910('0x17'),auth[_0x0910('0x9')](),controller['getMessages']);router[_0x0910('0xb')](_0x0910('0x18'),auth['isAuthenticated'](),controller[_0x0910('0x19')]);router[_0x0910('0xb')]('/:id/users',auth[_0x0910('0x9')](),controller[_0x0910('0x1a')]);router['post']('/:id/dispositions',auth[_0x0910('0x9')](),controller[_0x0910('0x1b')]);router[_0x0910('0x1c')](_0x0910('0xf'),auth[_0x0910('0x9')](),controller[_0x0910('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0910('0x1e')]);router['post'](_0x0910('0x10'),auth[_0x0910('0x9')](),controller[_0x0910('0x1f')]);router[_0x0910('0x1c')](_0x0910('0x11'),auth['isAuthenticated'](),controller[_0x0910('0x20')]);router['post'](_0x0910('0x13'),auth[_0x0910('0x9')](),controller[_0x0910('0x21')]);router[_0x0910('0x1c')]('/:id/applications',auth[_0x0910('0x9')](),controller[_0x0910('0x22')]);router['post']('/:id/send',auth[_0x0910('0x9')](),controller[_0x0910('0x23')]);router[_0x0910('0x1c')](_0x0910('0x24'),auth['isAuthenticated'](),controller[_0x0910('0x25')]);router[_0x0910('0x26')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0x27')]);router[_0x0910('0x28')](_0x0910('0xe'),auth[_0x0910('0x9')](),controller[_0x0910('0x29')]);router[_0x0910('0x28')](_0x0910('0xf'),auth['isAuthenticated'](),controller[_0x0910('0x2a')]);router['delete'](_0x0910('0x10'),auth[_0x0910('0x9')](),controller[_0x0910('0x2b')]);router[_0x0910('0x28')](_0x0910('0x11'),auth[_0x0910('0x9')](),controller[_0x0910('0x2c')]);router[_0x0910('0x28')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0x2d')]);router[_0x0910('0x28')](_0x0910('0x24'),auth[_0x0910('0x9')](),controller[_0x0910('0x2e')]);module[_0x0910('0x2f')]=router; \ No newline at end of file +var _0x598a=['addDisposition','create','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','post'];(function(_0x39fcba,_0x556e27){var _0x2a05c4=function(_0x5254ff){while(--_0x5254ff){_0x39fcba['push'](_0x39fcba['shift']());}};_0x2a05c4(++_0x556e27);}(_0x598a,0xce));var _0xa598=function(_0xa91ed3,_0x2329f0){_0xa91ed3=_0xa91ed3-0x0;var _0x2e6620=_0x598a[_0xa91ed3];return _0x2e6620;};'use strict';var multer=require(_0xa598('0x0'));var util=require('util');var path=require(_0xa598('0x1'));var timeout=require(_0xa598('0x2'));var express=require(_0xa598('0x3'));var router=express[_0xa598('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa598('0x5'));var interaction=require(_0xa598('0x6'));var config=require(_0xa598('0x7'));var controller=require(_0xa598('0x8'));router[_0xa598('0x9')]('/',auth[_0xa598('0xa')](),controller[_0xa598('0xb')]);router['get'](_0xa598('0xc'),auth[_0xa598('0xa')](),controller[_0xa598('0xd')]);router[_0xa598('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa598('0xe')]);router['get'](_0xa598('0xf'),auth[_0xa598('0xa')](),controller[_0xa598('0x10')]);router['get'](_0xa598('0x11'),auth[_0xa598('0xa')](),controller['getAnswers']);router['get'](_0xa598('0x12'),auth[_0xa598('0xa')](),controller[_0xa598('0x13')]);router[_0xa598('0x9')](_0xa598('0x14'),auth[_0xa598('0xa')](),controller[_0xa598('0x15')]);router['get']('/:id/interactions',auth[_0xa598('0xa')](),controller[_0xa598('0x16')]);router[_0xa598('0x9')](_0xa598('0x17'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa598('0x9')](_0xa598('0x18'),auth['isAuthenticated'](),controller[_0xa598('0x19')]);router[_0xa598('0x9')](_0xa598('0x1a'),auth[_0xa598('0xa')](),controller['verifySmtp']);router['get'](_0xa598('0x1b'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa598('0x1c')](_0xa598('0xf'),auth[_0xa598('0xa')](),controller[_0xa598('0x1d')]);router['post']('/:id/canned_answers',auth[_0xa598('0xa')](),controller['addAnswer']);router[_0xa598('0x1c')]('/',auth[_0xa598('0xa')](),controller[_0xa598('0x1e')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa598('0x1f')]);router[_0xa598('0x1c')](_0xa598('0x14'),auth['isAuthenticated'](),controller[_0xa598('0x20')]);router[_0xa598('0x1c')](_0xa598('0x21'),auth[_0xa598('0xa')](),controller['addInteraction']);router[_0xa598('0x1c')](_0xa598('0x17'),auth[_0xa598('0xa')](),controller[_0xa598('0x22')]);router[_0xa598('0x1c')](_0xa598('0x23'),auth[_0xa598('0xa')](),controller[_0xa598('0x24')]);router[_0xa598('0x1c')]('/:id/users',auth[_0xa598('0xa')](),controller[_0xa598('0x25')]);router['put']('/:id',auth[_0xa598('0xa')](),controller[_0xa598('0x26')]);router[_0xa598('0x27')](_0xa598('0xf'),auth['isAuthenticated'](),controller[_0xa598('0x28')]);router[_0xa598('0x27')]('/:id/canned_answers',auth[_0xa598('0xa')](),controller[_0xa598('0x29')]);router[_0xa598('0x27')](_0xa598('0x12'),auth[_0xa598('0xa')](),controller[_0xa598('0x2a')]);router[_0xa598('0x27')](_0xa598('0x14'),auth[_0xa598('0xa')](),controller[_0xa598('0x2b')]);router['delete'](_0xa598('0x2c'),auth[_0xa598('0xa')](),controller[_0xa598('0x2d')]);router['delete']('/:id/users',auth[_0xa598('0xa')](),controller[_0xa598('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 40a9be2..ffd22f0 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 _0xdbae=['yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail'];(function(_0x1218a5,_0x3e8923){var _0x524641=function(_0x4267ad){while(--_0x4267ad){_0x1218a5['push'](_0x1218a5['shift']());}};_0x524641(++_0x3e8923);}(_0xdbae,0x15b));var _0xedba=function(_0x5f2e51,_0x5e4a48){_0x5f2e51=_0x5f2e51-0x0;var _0x3f1815=_0xdbae[_0x5f2e51];return _0x3f1815;};'use strict';var Sequelize=require(_0xedba('0x0'));module[_0xedba('0x1')]={'description':{'type':Sequelize[_0xedba('0x2')]},'name':{'type':Sequelize[_0xedba('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xedba('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xedba('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xedba('0x4')]},'markAsUnread':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xedba('0x2')],'allowNull':![],'defaultValue':_0xedba('0x5')},'fontSize':{'type':Sequelize[_0xedba('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xedba('0x4')],'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[_0xedba('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xedba('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![],'comment':_0xedba('0x7'),'set':function(_0x401269){if(!_0x401269)this[_0xedba('0x8')](_0xedba('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x401269);}},'provider':{'type':Sequelize[_0xedba('0xa')](_0xedba('0xb'),_0xedba('0xc'),_0xedba('0xd'),_0xedba('0xe')),'defaultValue':null,'get':function(){var _0x3e5b83=this[_0xedba('0xf')](_0xedba('0x10'));return _0x3e5b83||_0xedba('0x11');},'set':function(_0x4ec40a){if(_0x4ec40a==='custom'){_0x4ec40a=null;}return this[_0xedba('0x8')]('provider',_0x4ec40a);}}}; \ No newline at end of file +var _0x9aba=['provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','ENUM','hotmail','yahoo','outlook365','getDataValue'];(function(_0x37215d,_0x6942ad){var _0x5f21c4=function(_0x2c87cc){while(--_0x2c87cc){_0x37215d['push'](_0x37215d['shift']());}};_0x5f21c4(++_0x6942ad);}(_0x9aba,0x156));var _0xa9ab=function(_0x3884f7,_0x1e27e4){_0x3884f7=_0x3884f7-0x0;var _0x3d8cfb=_0x9aba[_0x3884f7];return _0x3d8cfb;};'use strict';var Sequelize=require(_0xa9ab('0x0'));module[_0xa9ab('0x1')]={'description':{'type':Sequelize[_0xa9ab('0x2')]},'name':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa9ab('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa9ab('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa9ab('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![],'defaultValue':_0xa9ab('0x5')},'fontSize':{'type':Sequelize[_0xa9ab('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa9ab('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9ab('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9ab('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa9ab('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2aaec2){if(!_0x2aaec2)this[_0xa9ab('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x2aaec2);}},'provider':{'type':Sequelize[_0xa9ab('0xa')]('gmail',_0xa9ab('0xb'),_0xa9ab('0xc'),_0xa9ab('0xd')),'defaultValue':null,'get':function(){var _0x23c75d=this[_0xa9ab('0xe')](_0xa9ab('0xf'));return _0x23c75d||_0xa9ab('0x10');},'set':function(_0x328d2e){if(_0x328d2e==='custom'){_0x328d2e=null;}return this['setDataValue']('provider',_0x328d2e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5a059bd..0777369 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 _0x1431=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','get','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerIn','find','update','body','provider','custom','secure','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','autoAssociation','getImap','addImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Tag','Tags','tag','addApplications','transaction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1431,0x1c6));var _0x1143=function(_0x54a207,_0x447f90){_0x54a207=_0x54a207-0x0;var _0x3b999f=_0x1431[_0x54a207];return _0x3b999f;};'use strict';var moment=require(_0x1143('0x0'));var BPromise=require(_0x1143('0x1'));var util=require(_0x1143('0x2'));var path=require(_0x1143('0x3'));var _=require(_0x1143('0x4'));var juice=require(_0x1143('0x5'));var Redis=require(_0x1143('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1143('0x7'));var config=require(_0x1143('0x8'));var db=require(_0x1143('0x9'))['db'];config[_0x1143('0xa')]=_['defaults'](config[_0x1143('0xa')],{'host':_0x1143('0xb'),'port':0x18eb});var socket=require(_0x1143('0xc'))(new Redis(config['redis']));require(_0x1143('0xd'))[_0x1143('0xe')](socket);var jayson=require(_0x1143('0xf'));var client=jayson[_0x1143('0x10')][_0x1143('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x2539a6,_0xf5bbd8,_0x2372c5,_0x1efa31){return new BPromise(function(_0x2a1d37,_0x40d912){var _0x346df6=_0x1efa31||client;return _0x346df6['request'](_0x2539a6,_0x2372c5)['then'](function(_0x16ffda){logger['info'](_0x1143('0x12'),_0xf5bbd8,_0x1143('0x13'));logger[_0x1143('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xf5bbd8,_0x1143('0x13'),JSON[_0x1143('0x15')](_0x16ffda));if(_0x16ffda[_0x1143('0x16')]){if(_0x16ffda[_0x1143('0x16')][_0x1143('0x17')]===0x1f4){logger[_0x1143('0x16')]('MailAccount,\x20%s,\x20%s',_0xf5bbd8,_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);return _0x40d912(_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);}logger[_0x1143('0x16')](_0x1143('0x12'),_0xf5bbd8,_0x16ffda['error'][_0x1143('0x18')]);return _0x2a1d37(_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);}else{logger['info'](_0x1143('0x12'),_0xf5bbd8,'request\x20sent');_0x2a1d37(_0x16ffda[_0x1143('0x19')][_0x1143('0x18')]);}})[_0x1143('0x1a')](function(_0x25f0ee){logger[_0x1143('0x16')](_0x1143('0x12'),_0xf5bbd8,_0x25f0ee);_0x40d912(_0x25f0ee);});});}function respondWithStatusCode(_0x3d5df1,_0x3befa6){_0x3befa6=_0x3befa6||0xcc;return function(_0x4dd8ab){if(_0x4dd8ab){return _0x3d5df1[_0x1143('0x1b')](_0x3befa6);}return _0x3d5df1[_0x1143('0x1c')](_0x3befa6)[_0x1143('0x1d')]();};}function respondWithResult(_0x23f64d,_0x2d7356){_0x2d7356=_0x2d7356||0xc8;return function(_0x316819){if(_0x316819){return _0x23f64d['status'](_0x2d7356)['json'](_0x316819);}};}function respondWithFilteredResult(_0x1c145f,_0x1af2fa){return function(_0x425653){if(_0x425653){var _0x524a45=typeof _0x1af2fa['offset']===_0x1143('0x1e')&&typeof _0x1af2fa[_0x1143('0x1f')]===_0x1143('0x1e');var _0x29bbd2=_0x425653['count'];var _0x5b1ec9=_0x524a45?0x0:_0x1af2fa['offset'];var _0x527e8d=_0x524a45?_0x425653[_0x1143('0x20')]:_0x1af2fa[_0x1143('0x21')]+_0x1af2fa[_0x1143('0x1f')];var _0x2fb15b;if(_0x527e8d>=_0x29bbd2){_0x527e8d=_0x29bbd2;_0x2fb15b=0xc8;}else{_0x2fb15b=0xce;}_0x1c145f['status'](_0x2fb15b);return _0x1c145f[_0x1143('0x22')](_0x1143('0x23'),_0x5b1ec9+'-'+_0x527e8d+'/'+_0x29bbd2)[_0x1143('0x24')](_0x425653);}return null;};}function saveUpdates(_0x61139e){return function(_0x5f334c){if(_0x5f334c){return _0x5f334c['update'](_0x61139e)['then'](function(_0x2d6e1f){return _0x2d6e1f;});}return null;};}function removeEntity(_0x27c98b){return function(_0x565e01){if(_0x565e01){return _0x565e01[_0x1143('0x25')]()[_0x1143('0x26')](function(){var _0x2fa8c8=_0x565e01[_0x1143('0x27')]({'plain':!![]});var _0x438191='MailAccounts';return db[_0x1143('0x28')][_0x1143('0x25')]({'where':{'type':_0x438191,'resourceId':_0x2fa8c8['id']}})['then'](function(){return _0x565e01;});})[_0x1143('0x26')](function(){_0x27c98b[_0x1143('0x1c')](0xcc)[_0x1143('0x1d')]();});}};}function handleEntityNotFound(_0x5cec4d){return function(_0x13ff01){if(!_0x13ff01){_0x5cec4d['sendStatus'](0x194);}return _0x13ff01;};}function handleError(_0x25f4f5,_0xfe6b91){_0xfe6b91=_0xfe6b91||0x1f4;return function(_0x4c6512){logger[_0x1143('0x16')](_0x4c6512['stack']);if(_0x4c6512['name']){delete _0x4c6512[_0x1143('0x29')];}_0x25f4f5['status'](_0xfe6b91)[_0x1143('0x2a')](_0x4c6512);};}function getImapHost(_0x8ef87){switch(_0x8ef87){case _0x1143('0x2b'):return _0x1143('0x2c');case _0x1143('0x2d'):return _0x1143('0x2e');case _0x1143('0x2f'):return _0x1143('0x30');case _0x1143('0x31'):return _0x1143('0x32');}throw new Error(_0x1143('0x33'),_0x8ef87);}function getSmtpHost(_0x523ac4){switch(_0x523ac4){case _0x1143('0x2b'):return _0x1143('0x34');case'yahoo':return _0x1143('0x35');case _0x1143('0x2f'):return _0x1143('0x36');case _0x1143('0x31'):return _0x1143('0x37');}throw new Error(_0x1143('0x33'),_0x523ac4);}function getAuthenticationOptions(_0x5b06bc,_0x3d5fff){var _0xd34497={};var _0x5f3f9e={};if(_0x5b06bc){_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=_0x3d5fff[_0x1143('0x39')];_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=_0x3d5fff['password'];if(_0x3d5fff[_0x1143('0x3c')]){_0xd34497[_0x1143('0x3c')]=_0x5f3f9e[_0x1143('0x3c')]=!![];_0xd34497[_0x1143('0x3d')]=_0x5f3f9e[_0x1143('0x3d')]=_0x3d5fff[_0x1143('0x3d')];_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=null;}else{_0xd34497[_0x1143('0x3d')]=_0x5f3f9e['CloudProviderId']=null;}_0xd34497[_0x1143('0x3e')]=getImapHost(_0x5b06bc);_0xd34497[_0x1143('0x3f')]=0x3e1;_0x5f3f9e['host']=getSmtpHost(_0x5b06bc);_0x5f3f9e[_0x1143('0x3f')]=0x24b;_0x5f3f9e['secure']=![];_0xd34497[_0x1143('0x40')]=_0x5f3f9e['service']=null;}else{if(_0x3d5fff[_0x1143('0x41')]){_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=_0x3d5fff['username'];_0xd34497['password']=_0x5f3f9e[_0x1143('0x3b')]=_0x3d5fff[_0x1143('0x3a')];}else{_0xd34497[_0x1143('0x41')]=_0x5f3f9e['authentication']=![];_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=null;_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=null;}_0xd34497[_0x1143('0x3e')]=_0x3d5fff['Imap'][_0x1143('0x3e')];_0xd34497[_0x1143('0x3f')]=_0x3d5fff[_0x1143('0x42')]['port'];_0x5f3f9e['host']=_0x3d5fff[_0x1143('0x43')][_0x1143('0x3e')];_0x5f3f9e[_0x1143('0x3f')]=_0x3d5fff[_0x1143('0x43')][_0x1143('0x3f')];}return{'Imap':_0xd34497,'Smtp':_0x5f3f9e};}exports[_0x1143('0x44')]=function(_0x20185c,_0x11a9ce){var _0x9e3146={'include':[{'model':db['MailServerIn'],'as':_0x1143('0x42')},{'model':db[_0x1143('0x45')],'as':'Smtp'},{'model':db[_0x1143('0x46')],'as':_0x1143('0x47')}]},_0x57b5c0={},_0x382ce1={'count':0x0,'rows':[]};var _0x74930a=_['map'](db[_0x1143('0x48')][_0x1143('0x49')],function(_0x427b8c){return{'name':_0x427b8c[_0x1143('0x4a')],'type':_0x427b8c[_0x1143('0x4b')][_0x1143('0x4c')]};});_0x57b5c0[_0x1143('0x4d')]=_[_0x1143('0x4e')](_0x74930a,_0x1143('0x29'));_0x57b5c0['query']=_[_0x1143('0x4f')](_0x20185c[_0x1143('0x50')]);_0x57b5c0[_0x1143('0x51')]=_['intersection'](_0x57b5c0['model'],_0x57b5c0[_0x1143('0x50')]);_0x9e3146['attributes']=_[_0x1143('0x52')](_0x57b5c0['model'],qs[_0x1143('0x53')](_0x20185c[_0x1143('0x50')][_0x1143('0x53')]));_0x9e3146[_0x1143('0x54')]=_0x9e3146[_0x1143('0x54')][_0x1143('0x55')]?_0x9e3146[_0x1143('0x54')]:_0x57b5c0[_0x1143('0x4d')];if(!_0x20185c['query'][_0x1143('0x56')](_0x1143('0x57'))){_0x9e3146[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x20185c['query'][_0x1143('0x1f')]);_0x9e3146[_0x1143('0x21')]=qs[_0x1143('0x21')](_0x20185c[_0x1143('0x50')][_0x1143('0x21')]);}_0x9e3146[_0x1143('0x58')]=qs[_0x1143('0x59')](_0x20185c[_0x1143('0x50')][_0x1143('0x59')]);_0x9e3146[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x20185c[_0x1143('0x50')],_0x57b5c0[_0x1143('0x51')]),_0x74930a);if(_0x20185c[_0x1143('0x50')][_0x1143('0x5c')]){_0x9e3146[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x9e3146[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x74930a,function(_0x1ebd0d){if(_0x1ebd0d[_0x1143('0x4b')]!==_0x1143('0x5e')){var _0x443a09={};_0x443a09[_0x1ebd0d['name']]={'$like':'%'+_0x20185c[_0x1143('0x50')]['filter']+'%'};return _0x443a09;}})});}_0x9e3146=_[_0x1143('0x5d')]({},_0x9e3146,_0x20185c[_0x1143('0x5f')]);var _0x115028={'where':_0x9e3146['where']};return db[_0x1143('0x48')]['count'](_0x115028)[_0x1143('0x26')](function(_0xc5a39d){_0x382ce1[_0x1143('0x20')]=_0xc5a39d;if(_0x20185c[_0x1143('0x50')][_0x1143('0x60')]){_0x9e3146[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x48')][_0x1143('0x62')](_0x9e3146);})[_0x1143('0x26')](function(_0x2a4fc5){_0x382ce1[_0x1143('0x63')]=_0x2a4fc5;return _0x382ce1;})['then'](respondWithFilteredResult(_0x11a9ce,_0x9e3146))[_0x1143('0x1a')](handleError(_0x11a9ce,null));};exports[_0x1143('0x64')]=function(_0x215b52,_0x49cd29){var _0x1b01c3={'raw':![],'where':{'id':_0x215b52[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1143('0x46')],'as':'mandatoryDispositionPause'}]},_0x385b8a={};_0x385b8a[_0x1143('0x4d')]=_[_0x1143('0x4f')](db['MailAccount'][_0x1143('0x49')]);_0x385b8a[_0x1143('0x50')]=_['keys'](_0x215b52['query']);_0x385b8a['filters']=_[_0x1143('0x52')](_0x385b8a[_0x1143('0x4d')],_0x385b8a[_0x1143('0x50')]);_0x1b01c3[_0x1143('0x54')]=_[_0x1143('0x52')](_0x385b8a[_0x1143('0x4d')],qs[_0x1143('0x53')](_0x215b52['query'][_0x1143('0x53')]));_0x1b01c3['attributes']=_0x1b01c3['attributes']['length']?_0x1b01c3[_0x1143('0x54')]:_0x385b8a['model'];if(_0x215b52[_0x1143('0x50')][_0x1143('0x60')]){_0x1b01c3[_0x1143('0x61')]=[{'all':!![]}];}_0x1b01c3=_[_0x1143('0x5d')]({},_0x1b01c3,_0x215b52['options']);return db[_0x1143('0x48')][_0x1143('0x67')](_0x1b01c3)[_0x1143('0x26')](handleEntityNotFound(_0x49cd29,null))[_0x1143('0x26')](respondWithResult(_0x49cd29,null))['catch'](handleError(_0x49cd29,null));};exports[_0x1143('0x68')]=function(_0x30b68e,_0x1ab187){if(_0x30b68e[_0x1143('0x69')]['id']){delete _0x30b68e['body']['id'];}var _0x34d08a=_0x30b68e[_0x1143('0x69')][_0x1143('0x6a')]===_0x1143('0x6b')?null:_0x30b68e['body'][_0x1143('0x6a')];var _0x12a34f=_0x30b68e[_0x1143('0x69')][_0x1143('0x42')]||{};var _0x38ac32=_0x30b68e[_0x1143('0x69')][_0x1143('0x43')]||{};if(_0x34d08a){_0x12a34f['host']=getImapHost(_0x34d08a);_0x12a34f['port']=0x3e1;_0x38ac32['host']=getSmtpHost(_0x34d08a);_0x38ac32[_0x1143('0x3f')]=0x24b;_0x38ac32[_0x1143('0x6c')]=![];}if(_0x38ac32[_0x1143('0x3c')]){_0x38ac32[_0x1143('0x6c')]=![];}else{_0x38ac32[_0x1143('0x3d')]=null;}if(!_0x12a34f[_0x1143('0x3c')])_0x12a34f[_0x1143('0x3d')]=null;_0x30b68e[_0x1143('0x69')][_0x1143('0x42')]=_0x12a34f;_0x30b68e[_0x1143('0x69')][_0x1143('0x43')]=_0x38ac32;return db[_0x1143('0x48')]['find']({'where':{'id':_0x30b68e[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')},{'model':db[_0x1143('0x45')],'as':_0x1143('0x43')},{'model':db[_0x1143('0x46')],'as':_0x1143('0x47')}]})['then'](handleEntityNotFound(_0x1ab187,null))[_0x1143('0x26')](function(_0x3fcc28){if(!_0x3fcc28)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3fcc28['service'])delete _0x30b68e[_0x1143('0x69')][_0x1143('0x42')];return _0x3fcc28;})[_0x1143('0x26')](saveUpdates(_0x30b68e[_0x1143('0x69')],null))[_0x1143('0x26')](function(_0x43d7ea){if(!_0x30b68e['body'][_0x1143('0x42')])return _0x43d7ea;return db['MailServerIn'][_0x1143('0x68')](_0x30b68e[_0x1143('0x69')][_0x1143('0x42')],{'where':{'MailAccountId':_0x43d7ea['id']}})[_0x1143('0x26')](function(){return _0x43d7ea;});})[_0x1143('0x26')](function(_0x4ac064){if(!_0x30b68e[_0x1143('0x69')][_0x1143('0x43')])return _0x4ac064;return db[_0x1143('0x45')]['update'](_0x30b68e[_0x1143('0x69')][_0x1143('0x43')],{'where':{'MailAccountId':_0x4ac064['id']}})['then'](function(){return _0x4ac064;});})['then'](respondWithResult(_0x1ab187,null))[_0x1143('0x1a')](handleError(_0x1ab187,null));};exports[_0x1143('0x6d')]=function(_0x24618e,_0x3f0b1f){return db[_0x1143('0x48')][_0x1143('0x6d')]()[_0x1143('0x26')](respondWithResult(_0x3f0b1f,null))[_0x1143('0x1a')](handleError(_0x3f0b1f,null));};exports[_0x1143('0x6e')]=function(_0x55f431,_0x19c41c){if(_0x55f431[_0x1143('0x69')]['id']){delete _0x55f431[_0x1143('0x69')]['id'];}return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x55f431['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x19c41c,null))[_0x1143('0x26')](function(_0x3b6caf){if(_0x3b6caf){_0x55f431['body'][_0x1143('0x6f')]=_0x3b6caf['id'];return db[_0x1143('0x70')][_0x1143('0x71')](_0x55f431[_0x1143('0x69')]);}})['then'](respondWithResult(_0x19c41c,null))[_0x1143('0x1a')](handleError(_0x19c41c,null));};exports[_0x1143('0x72')]=function(_0x1b0e31,_0x2bc689){var _0x2a0a0b={'raw':![],'where':{}};var _0x135a1e={};var _0xc4da91={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x1b0e31['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2bc689,null))[_0x1143('0x26')](function(_0x2480a9){if(_0x2480a9){_0x135a1e['model']=_[_0x1143('0x4f')](db[_0x1143('0x70')]['rawAttributes']);_0x135a1e[_0x1143('0x50')]=_[_0x1143('0x4f')](_0x1b0e31[_0x1143('0x50')]);_0x135a1e[_0x1143('0x51')]=_[_0x1143('0x52')](_0x135a1e[_0x1143('0x4d')],_0x135a1e[_0x1143('0x50')]);_0x2a0a0b[_0x1143('0x54')]=_[_0x1143('0x52')](_0x135a1e[_0x1143('0x4d')],qs[_0x1143('0x53')](_0x1b0e31[_0x1143('0x50')]['fields']));_0x2a0a0b[_0x1143('0x54')]=_0x2a0a0b[_0x1143('0x54')]['length']?_0x2a0a0b[_0x1143('0x54')]:_0x135a1e['model'];if(!_0x1b0e31[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x2a0a0b['limit']=qs['limit'](_0x1b0e31['query'][_0x1143('0x1f')]);_0x2a0a0b[_0x1143('0x21')]=qs['offset'](_0x1b0e31[_0x1143('0x50')]['offset']);}_0x2a0a0b[_0x1143('0x58')]=qs['sort'](_0x1b0e31['query']['sort']);_0x2a0a0b[_0x1143('0x5a')]=qs['filters'](_[_0x1143('0x5b')](_0x1b0e31[_0x1143('0x50')],_0x135a1e['filters']));_0x2a0a0b[_0x1143('0x5a')][_0x1143('0x6f')]=_0x2480a9['id'];if(_0x1b0e31[_0x1143('0x50')][_0x1143('0x5c')]){_0x2a0a0b[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x2a0a0b[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x2a0a0b[_0x1143('0x54')],function(_0x5adf84){var _0x1a143e={};_0x1a143e[_0x5adf84]={'$like':'%'+_0x1b0e31[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x1a143e;})});}_0x2a0a0b=_['merge']({},_0x2a0a0b,_0x1b0e31[_0x1143('0x5f')]);return db[_0x1143('0x70')][_0x1143('0x20')]({'where':_0x2a0a0b[_0x1143('0x5a')]})['then'](function(_0x25c8f6){_0xc4da91['count']=_0x25c8f6;if(_0x1b0e31[_0x1143('0x50')][_0x1143('0x60')]){_0x2a0a0b[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x70')]['findAll'](_0x2a0a0b);})['then'](function(_0x3f5c9a){_0xc4da91[_0x1143('0x63')]=_0x3f5c9a;return _0xc4da91;});}})[_0x1143('0x26')](respondWithFilteredResult(_0x2bc689,_0x2a0a0b))[_0x1143('0x1a')](handleError(_0x2bc689,null));};exports[_0x1143('0x74')]=function(_0x5ecf97,_0x3b4c2e){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x5ecf97[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b4c2e,null))[_0x1143('0x26')](function(_0x4defe0){if(_0x4defe0){return _0x4defe0[_0x1143('0x74')](_0x5ecf97[_0x1143('0x50')]['ids']);}})[_0x1143('0x26')](respondWithStatusCode(_0x3b4c2e,null))[_0x1143('0x1a')](handleError(_0x3b4c2e,null));};exports['addAnswer']=function(_0x2b9df,_0x486f5a){if(_0x2b9df['body']['id']){delete _0x2b9df[_0x1143('0x69')]['id'];}return db[_0x1143('0x48')]['find']({'where':{'id':_0x2b9df[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x486f5a,null))['then'](function(_0x517d6f){if(_0x517d6f){_0x2b9df[_0x1143('0x69')][_0x1143('0x6f')]=_0x517d6f['id'];return db[_0x1143('0x75')]['create'](_0x2b9df[_0x1143('0x69')]);}})[_0x1143('0x26')](respondWithResult(_0x486f5a,null))[_0x1143('0x1a')](handleError(_0x486f5a,null));};exports[_0x1143('0x76')]=function(_0x57d745,_0xd3096e){var _0x5af555={'raw':![],'where':{}};var _0x39cf71={};var _0x49e77b={'count':0x0,'rows':[]};return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x57d745[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0xd3096e,null))[_0x1143('0x26')](function(_0x41c002){if(_0x41c002){_0x39cf71['model']=_['keys'](db[_0x1143('0x75')][_0x1143('0x49')]);_0x39cf71['query']=_[_0x1143('0x4f')](_0x57d745[_0x1143('0x50')]);_0x39cf71[_0x1143('0x51')]=_[_0x1143('0x52')](_0x39cf71[_0x1143('0x4d')],_0x39cf71[_0x1143('0x50')]);_0x5af555['attributes']=_[_0x1143('0x52')](_0x39cf71['model'],qs['fields'](_0x57d745[_0x1143('0x50')][_0x1143('0x53')]));_0x5af555[_0x1143('0x54')]=_0x5af555[_0x1143('0x54')][_0x1143('0x55')]?_0x5af555[_0x1143('0x54')]:_0x39cf71[_0x1143('0x4d')];if(!_0x57d745[_0x1143('0x50')]['hasOwnProperty'](_0x1143('0x57'))){_0x5af555['limit']=qs[_0x1143('0x1f')](_0x57d745[_0x1143('0x50')][_0x1143('0x1f')]);_0x5af555['offset']=qs[_0x1143('0x21')](_0x57d745[_0x1143('0x50')][_0x1143('0x21')]);}_0x5af555['order']=qs[_0x1143('0x59')](_0x57d745['query'][_0x1143('0x59')]);_0x5af555[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x57d745[_0x1143('0x50')],_0x39cf71[_0x1143('0x51')]));_0x5af555['where'][_0x1143('0x6f')]=_0x41c002['id'];if(_0x57d745[_0x1143('0x50')][_0x1143('0x5c')]){_0x5af555[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x5af555[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x5af555[_0x1143('0x54')],function(_0xdb3607){var _0x58b495={};_0x58b495[_0xdb3607]={'$like':'%'+_0x57d745[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x58b495;})});}_0x5af555=_[_0x1143('0x5d')]({},_0x5af555,_0x57d745[_0x1143('0x5f')]);return db[_0x1143('0x75')][_0x1143('0x20')]({'where':_0x5af555[_0x1143('0x5a')]})[_0x1143('0x26')](function(_0x586ee3){_0x49e77b[_0x1143('0x20')]=_0x586ee3;if(_0x57d745[_0x1143('0x50')]['includeAll']){_0x5af555[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x75')][_0x1143('0x62')](_0x5af555);})[_0x1143('0x26')](function(_0x4cbf32){_0x49e77b[_0x1143('0x63')]=_0x4cbf32;return _0x49e77b;});}})[_0x1143('0x26')](respondWithFilteredResult(_0xd3096e,_0x5af555))['catch'](handleError(_0xd3096e,null));};exports[_0x1143('0x77')]=function(_0x278384,_0x56faa3){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x278384[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x56faa3,null))[_0x1143('0x26')](function(_0x4e5725){if(_0x4e5725){return _0x4e5725[_0x1143('0x77')](_0x278384['query'][_0x1143('0x78')]);}})[_0x1143('0x26')](respondWithStatusCode(_0x56faa3,null))[_0x1143('0x1a')](handleError(_0x56faa3,null));};exports[_0x1143('0x71')]=function(_0x321a70,_0x4d9174){var _0x3e7fdf={'name':_0x321a70['body'][_0x1143('0x29')],'key':_0x321a70[_0x1143('0x69')]['key'],'provider':_0x321a70['body'][_0x1143('0x6a')]===_0x1143('0x6b')?null:_0x321a70['body'][_0x1143('0x6a')],'email':_0x321a70[_0x1143('0x69')][_0x1143('0x79')],'ListId':_0x321a70[_0x1143('0x69')][_0x1143('0x7a')],'active':!_[_0x1143('0x7b')](_0x321a70[_0x1143('0x69')][_0x1143('0x7c')])?_0x321a70[_0x1143('0x69')][_0x1143('0x7c')]:!![],'description':_0x321a70[_0x1143('0x69')][_0x1143('0x7d')]||null};var _0x477bdf=getAuthenticationOptions(_0x3e7fdf[_0x1143('0x6a')],_0x321a70['body']);_0x3e7fdf['Imap']=_0x477bdf[_0x1143('0x42')];_0x3e7fdf['Smtp']=_0x477bdf[_0x1143('0x43')];return db[_0x1143('0x48')][_0x1143('0x71')](_0x3e7fdf,{'include':[{'model':db[_0x1143('0x45')],'as':'Smtp'},{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')}]})['then'](function(_0x58a81f){var _0x4a352b=_0x321a70[_0x1143('0x38')][_0x1143('0x27')]({'plain':!![]});if(!_0x4a352b)throw new Error(_0x1143('0x7e'));if(_0x4a352b[_0x1143('0x7f')]===_0x1143('0x38')){var _0x581725=_0x58a81f[_0x1143('0x27')]({'plain':!![]});return db[_0x1143('0x80')]['find']({'where':{'name':_0x1143('0x81'),'userProfileId':_0x4a352b['userProfileId']},'raw':!![]})[_0x1143('0x26')](function(_0x20ce12){if(_0x20ce12&&_0x20ce12[_0x1143('0x82')]===0x0){return db[_0x1143('0x28')][_0x1143('0x71')]({'name':_0x581725[_0x1143('0x29')],'resourceId':_0x581725['id'],'type':_0x20ce12[_0x1143('0x29')],'sectionId':_0x20ce12['id']},{})[_0x1143('0x26')](function(){return _0x58a81f;});}else{return _0x58a81f;}})['catch'](function(_0x53a8f9){logger[_0x1143('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53a8f9);throw _0x53a8f9;});}return _0x58a81f;})[_0x1143('0x26')](respondWithResult(_0x4d9174,0xc9))['catch'](handleError(_0x4d9174,null));};exports[_0x1143('0x83')]=function(_0x46533f,_0x2ce9d1){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x46533f[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x2ce9d1,null))[_0x1143('0x26')](function(_0x74c172){if(_0x74c172){return _0x74c172['getImap']();}return null;})[_0x1143('0x26')](respondWithResult(_0x2ce9d1,null))[_0x1143('0x1a')](handleError(_0x2ce9d1,null));};exports[_0x1143('0x84')]=function(_0x1d8451,_0x2a98ed){if(_0x1d8451['body']['id']){delete _0x1d8451['body']['id'];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x1d8451[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2a98ed,null))[_0x1143('0x26')](function(_0x20ec5b){if(_0x20ec5b){_0x1d8451[_0x1143('0x69')][_0x1143('0x6f')]=_0x20ec5b['id'];return db[_0x1143('0x66')]['create'](_0x1d8451[_0x1143('0x69')]);}})['then'](respondWithResult(_0x2a98ed,null))[_0x1143('0x1a')](handleError(_0x2a98ed,null));};exports['removeImap']=function(_0x5c6299,_0x26d1ba){return db['MailAccount'][_0x1143('0x73')]({'where':{'id':_0x5c6299['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x26d1ba,null))[_0x1143('0x26')](function(_0xa2686f){if(_0xa2686f){return _0xa2686f['setImap'](null);}return null;})[_0x1143('0x26')](respondWithStatusCode(_0x26d1ba,null))[_0x1143('0x1a')](handleError(_0x26d1ba,null));};exports[_0x1143('0x85')]=function(_0x17e745,_0x3c445a){return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x17e745['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x3c445a,null))[_0x1143('0x26')](function(_0x5a7271){if(_0x5a7271){return _0x5a7271[_0x1143('0x85')]();}return null;})[_0x1143('0x26')](respondWithResult(_0x3c445a,null))[_0x1143('0x1a')](handleError(_0x3c445a,null));};exports[_0x1143('0x86')]=function(_0x1d9316,_0x9dac87){if(_0x1d9316[_0x1143('0x69')]['id']){delete _0x1d9316[_0x1143('0x69')]['id'];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x1d9316[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x9dac87,null))[_0x1143('0x26')](function(_0x148baa){if(_0x148baa){_0x1d9316[_0x1143('0x69')]['MailAccountId']=_0x148baa['id'];return db['MailServerOut'][_0x1143('0x71')](_0x1d9316[_0x1143('0x69')]);}})[_0x1143('0x26')](respondWithResult(_0x9dac87,null))[_0x1143('0x1a')](handleError(_0x9dac87,null));};exports[_0x1143('0x87')]=function(_0x289d59,_0x49244e){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x289d59[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x49244e,null))[_0x1143('0x26')](function(_0x4fe1dd){if(_0x4fe1dd){return _0x4fe1dd[_0x1143('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x49244e,null))[_0x1143('0x1a')](handleError(_0x49244e,null));};exports[_0x1143('0x89')]=function(_0x171fbc,_0x52d883){return db[_0x1143('0x8a')][_0x1143('0x67')]({'where':{'id':_0x171fbc[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x52d883,null))[_0x1143('0x26')](function(_0x4ebbd6){if(_0x4ebbd6){return _0x4ebbd6[_0x1143('0x89')](_0x171fbc[_0x1143('0x69')]['ids'],_[_0x1143('0x8b')](_0x171fbc[_0x1143('0x69')],[_0x1143('0x78'),'id'])||{});}})['then'](respondWithResult(_0x52d883,null))['catch'](handleError(_0x52d883,null));};exports[_0x1143('0x8c')]=function(_0xae5e2f,_0x388993){var _0x4f7b98={'raw':![],'where':{}};var _0x587170={};var _0x3dabe9={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0xae5e2f[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x388993,null))[_0x1143('0x26')](function(_0x29b137){if(_0x29b137){_0x587170[_0x1143('0x4d')]=_['keys'](db[_0x1143('0x8a')][_0x1143('0x49')]);_0x587170[_0x1143('0x50')]=_['keys'](_0xae5e2f[_0x1143('0x50')]);_0x587170[_0x1143('0x51')]=_[_0x1143('0x52')](_0x587170[_0x1143('0x4d')],_0x587170[_0x1143('0x50')]);_0x4f7b98[_0x1143('0x54')]=_[_0x1143('0x52')](_0x587170[_0x1143('0x4d')],qs[_0x1143('0x53')](_0xae5e2f['query']['fields']));_0x4f7b98[_0x1143('0x54')]=_0x4f7b98[_0x1143('0x54')][_0x1143('0x55')]?_0x4f7b98[_0x1143('0x54')]:_0x587170['model'];if(!_0xae5e2f[_0x1143('0x50')]['hasOwnProperty'](_0x1143('0x57'))){_0x4f7b98[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0xae5e2f[_0x1143('0x50')][_0x1143('0x1f')]);_0x4f7b98['offset']=qs[_0x1143('0x21')](_0xae5e2f[_0x1143('0x50')][_0x1143('0x21')]);}_0x4f7b98[_0x1143('0x58')]=qs['sort'](_0xae5e2f[_0x1143('0x50')][_0x1143('0x59')]);_0x4f7b98[_0x1143('0x5a')]=qs['filters'](_[_0x1143('0x5b')](_0xae5e2f[_0x1143('0x50')],_0x587170['filters']));_0x4f7b98[_0x1143('0x5a')][_0x1143('0x6f')]=_0x29b137['id'];if(_0xae5e2f[_0x1143('0x50')][_0x1143('0x5c')]){_0x4f7b98[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x4f7b98[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x4f7b98['attributes'],function(_0x52556a){var _0x29d329={};_0x29d329[_0x52556a]={'$like':'%'+_0xae5e2f[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x29d329;})});}_0x4f7b98=_['merge']({},_0x4f7b98,_0xae5e2f['options']);return db[_0x1143('0x8a')][_0x1143('0x20')]({'where':_0x4f7b98[_0x1143('0x5a')]})[_0x1143('0x26')](function(_0x1c3375){_0x3dabe9['count']=_0x1c3375;if(_0xae5e2f[_0x1143('0x50')]['includeAll']){_0x4f7b98[_0x1143('0x61')]=[{'model':db[_0x1143('0x8d')],'as':_0x1143('0x8e'),'required':![]},{'model':db[_0x1143('0x8f')],'as':'Owner','attributes':[_0x1143('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x1143('0x90')],'as':_0x1143('0x91'),'attributes':['id',_0x1143('0x29'),'color'],'where':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]?{'id':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]}:undefined,'required':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]?!![]:![]}];}return db[_0x1143('0x8a')][_0x1143('0x62')](_0x4f7b98);})[_0x1143('0x26')](function(_0x11f3bb){_0x3dabe9[_0x1143('0x63')]=_0x11f3bb;return _0x3dabe9;});}})[_0x1143('0x26')](respondWithFilteredResult(_0x388993,_0x4f7b98))['catch'](handleError(_0x388993,null));};exports[_0x1143('0x93')]=function addApplications(_0x495182,_0x5c378d){var _0x7e2f6e=_0x495182[_0x1143('0x65')]['id'];var _0x578d73=_0x495182['body'];var _0x100611=0xc8;var _0x5ec2b2=null;return db['sequelize'][_0x1143('0x94')]({'isolationLevel':db['sequelize'][_0x1143('0x95')][_0x1143('0x96')][_0x1143('0x97')]},function(_0x573652){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x7e2f6e},'transaction':_0x573652})[_0x1143('0x26')](function(_0x59da8e){if(_0x59da8e){return db[_0x1143('0x98')][_0x1143('0x25')]({'where':{'MailAccountId':_0x7e2f6e},'transaction':_0x573652})['then'](function(){var _0x1851d1=_[_0x1143('0x4e')](_0x578d73,function(_0x456e3e){_0x456e3e[_0x1143('0x6f')]=_0x7e2f6e;return _0x456e3e;});return db[_0x1143('0x98')][_0x1143('0x99')](_0x1851d1,{'transaction':_0x573652});});}else{_0x100611=0x194;_0x5ec2b2=[];}});})[_0x1143('0x26')](function(){if(_0x100611!==0x194){return db[_0x1143('0x98')][_0x1143('0x9a')]({'where':{'MailAccountId':_0x7e2f6e},'order':_0x1143('0x9b')})[_0x1143('0x26')](function(_0x4fef8f){_0x5ec2b2=_0x4fef8f;});}})[_0x1143('0x1a')](function(_0x2181c3){_0x100611=0x1f4;logger[_0x1143('0x16')](_0x2181c3[_0x1143('0x9c')]);if(_0x2181c3[_0x1143('0x29')]){delete _0x2181c3[_0x1143('0x29')];}_0x5ec2b2=_0x2181c3;})[_0x1143('0x9d')](function(){if(_0x5ec2b2===null){_0x5c378d[_0x1143('0x1b')](_0x100611);}else{if(_0x100611===0x1f4){_0x5c378d[_0x1143('0x1c')](_0x100611)[_0x1143('0x2a')](_0x5ec2b2);}else{_0x5c378d[_0x1143('0x1c')](_0x100611)[_0x1143('0x24')](_0x5ec2b2);}}});};exports[_0x1143('0x9e')]=function(_0x320383,_0x202f3f){var _0x2f075e={};var _0xa39cb9={};var _0x33ac46;var _0xee7e57;return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x320383[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x202f3f,null))[_0x1143('0x26')](function(_0x31aa85){if(_0x31aa85){_0x33ac46=_0x31aa85;_0xa39cb9[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0x98')][_0x1143('0x49')]);_0xa39cb9[_0x1143('0x50')]=_[_0x1143('0x4f')](_0x320383['query']);_0xa39cb9[_0x1143('0x51')]=_['intersection'](_0xa39cb9[_0x1143('0x4d')],_0xa39cb9[_0x1143('0x50')]);_0x2f075e[_0x1143('0x54')]=_[_0x1143('0x52')](_0xa39cb9['model'],qs['fields'](_0x320383[_0x1143('0x50')][_0x1143('0x53')]));_0x2f075e[_0x1143('0x54')]=_0x2f075e[_0x1143('0x54')][_0x1143('0x55')]?_0x2f075e[_0x1143('0x54')]:_0xa39cb9[_0x1143('0x4d')];_0x2f075e['order']=qs['sort'](_0x320383['query'][_0x1143('0x59')]);_0x2f075e[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x320383[_0x1143('0x50')],_0xa39cb9[_0x1143('0x51')]));if(_0x320383[_0x1143('0x50')][_0x1143('0x5c')]){_0x2f075e[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x2f075e[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x2f075e[_0x1143('0x54')],function(_0x2119a7){var _0x5618ac={};_0x5618ac[_0x2119a7]={'$like':'%'+_0x320383['query'][_0x1143('0x5c')]+'%'};return _0x5618ac;})});}_0x2f075e=_[_0x1143('0x5d')]({},_0x2f075e,_0x320383[_0x1143('0x5f')]);return _0x33ac46[_0x1143('0x9e')](_0x2f075e);}})[_0x1143('0x26')](function(_0x1b8452){if(_0x1b8452){_0xee7e57=_0x1b8452[_0x1143('0x55')];if(!_0x320383[_0x1143('0x50')][_0x1143('0x56')]('nolimit')){_0x2f075e[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x320383[_0x1143('0x50')][_0x1143('0x1f')]);_0x2f075e[_0x1143('0x21')]=qs['offset'](_0x320383['query']['offset']);}return _0x33ac46[_0x1143('0x9e')](_0x2f075e);}})[_0x1143('0x26')](function(_0x26ee7e){if(_0x26ee7e){return _0x26ee7e?{'count':_0xee7e57,'rows':_0x26ee7e}:null;}})[_0x1143('0x26')](respondWithResult(_0x202f3f,null))[_0x1143('0x1a')](handleError(_0x202f3f,null));};exports[_0x1143('0x9f')]=function(_0xe06715,_0x48a3c6){var _0x4c8549={'raw':!![],'where':{}};var _0x4d9d15={};var _0x13ee10={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0xe06715['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x48a3c6,null))[_0x1143('0x26')](function(_0x432d15){if(_0x432d15){_0x4d9d15[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0xa0')][_0x1143('0x49')]);_0x4d9d15[_0x1143('0x50')]=_[_0x1143('0x4f')](_0xe06715[_0x1143('0x50')]);_0x4d9d15['filters']=_['intersection'](_0x4d9d15[_0x1143('0x4d')],_0x4d9d15['query']);_0x4c8549[_0x1143('0x54')]=_['intersection'](_0x4d9d15[_0x1143('0x4d')],qs[_0x1143('0x53')](_0xe06715[_0x1143('0x50')][_0x1143('0x53')]));_0x4c8549[_0x1143('0x54')]=_0x4c8549[_0x1143('0x54')]['length']?_0x4c8549[_0x1143('0x54')]:_0x4d9d15[_0x1143('0x4d')];if(!_0xe06715[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x4c8549[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0xe06715[_0x1143('0x50')][_0x1143('0x1f')]);_0x4c8549[_0x1143('0x21')]=qs[_0x1143('0x21')](_0xe06715[_0x1143('0x50')]['offset']);}_0x4c8549[_0x1143('0x58')]=qs[_0x1143('0x59')](_0xe06715[_0x1143('0x50')][_0x1143('0x59')]);_0x4c8549[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0xe06715[_0x1143('0x50')],_0x4d9d15['filters']));_0x4c8549[_0x1143('0x5a')][_0x1143('0x6f')]=_0x432d15['id'];if(_0xe06715[_0x1143('0x50')][_0x1143('0x5c')]){_0x4c8549[_0x1143('0x5a')]=_['merge'](_0x4c8549[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x4c8549[_0x1143('0x54')],function(_0x5c4e84){var _0x3a19d5={};_0x3a19d5[_0x5c4e84]={'$like':'%'+_0xe06715['query']['filter']+'%'};return _0x3a19d5;})});}if(_0xe06715[_0x1143('0x50')][_0x1143('0xa1')]){var _0x2deccd=_0xe06715[_0x1143('0x50')]['$gte'][_0x1143('0xa2')](',');var _0x3c5cf8={};_0x3c5cf8[_0x2deccd[0x0]]={'$gte':moment(_0x2deccd[0x1])[_0x1143('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4c8549[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x4c8549[_0x1143('0x5a')],_0x3c5cf8);}_0x4c8549=_[_0x1143('0x5d')]({},_0x4c8549,_0xe06715['options']);return db[_0x1143('0xa0')][_0x1143('0x20')]({'where':_0x4c8549['where']})['then'](function(_0x21a597){_0x13ee10[_0x1143('0x20')]=_0x21a597;if(_0xe06715[_0x1143('0x50')][_0x1143('0x60')]){_0x4c8549[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0xa0')][_0x1143('0x62')](_0x4c8549);})[_0x1143('0x26')](function(_0x51cc90){if(_0xe06715[_0x1143('0x50')][_0x1143('0xa4')]===_0x1143('0xa5')){for(var _0x6415d0=0x0;_0x6415d0<_0x51cc90[_0x1143('0x55')];_0x6415d0++){_0x51cc90[_0x6415d0][_0x1143('0x69')]=juice(_0x51cc90[_0x6415d0][_0x1143('0x69')]);}}_0x13ee10['rows']=_0x51cc90;return _0x13ee10;});}})['then'](respondWithFilteredResult(_0x48a3c6,_0x4c8549))[_0x1143('0x1a')](handleError(_0x48a3c6,null));};exports[_0x1143('0x2a')]=function(_0x2d0a28,_0x4e9484){var _0x42e3a6,_0x5dcfe1={},_0x3349d0;if(_0x2d0a28['body']['to']){_0x3349d0=_0x2d0a28[_0x1143('0x69')]['to'][_0x1143('0xa2')](',')[0x0];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x2d0a28[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0xa6')],'as':_0x1143('0xa7'),'include':[{'model':db['CmContact'],'as':_0x1143('0xa8'),'where':{'email':_0x3349d0},'limit':0x1,'order':[[_0x1143('0xa9'),_0x1143('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0x1143('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1143('0xab'),'raw':!![]}]}]})[_0x1143('0x26')](handleEntityNotFound(_0x4e9484,null))[_0x1143('0x26')](function(_0x5bc856){if(!_0x5bc856)return;_0x42e3a6=_0x5bc856;if(!_0x5bc856['Smtp'])throw new Error(_0x1143('0xac'));if(_[_0x1143('0x7b')](_0x2d0a28['body'][_0x1143('0xad')])){_0x2d0a28[_0x1143('0x69')][_0x1143('0xad')]=util['format'](_0x1143('0xae'),_0x5bc856['name'],_0x5bc856[_0x1143('0x79')]||_0x5bc856[_0x1143('0x43')][_0x1143('0x38')]);}if(_0x2d0a28[_0x1143('0x69')]['attachments']&&_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')]['length']){for(var _0x33b03d=0x0;_0x33b03d<_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x1143('0x55')];_0x33b03d+=0x1){_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x33b03d]={'filename':_0x2d0a28['body'][_0x1143('0xaf')][_0x33b03d][_0x1143('0x29')],'path':path['join'](config[_0x1143('0xb0')],_0x1143('0xb1'),_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x33b03d]['basename'])};}}var _0x4a29a1=_0x5bc856[_0x1143('0xb2')]();return respondWithRpcPromise(_0x1143('0xb3'),_0x1143('0xb4'),{'account':_0x4a29a1,'message':_0x2d0a28[_0x1143('0x69')]});})[_0x1143('0x26')](function(_0xd4beb5){if(!_0xd4beb5)return;_0x5dcfe1=_0xd4beb5;if(!_0x42e3a6[_0x1143('0xa7')])throw new Error(_0x1143('0xb5'));if(_0x42e3a6[_0x1143('0xa7')]['Contacts'][_0x1143('0x55')])return _0x42e3a6[_0x1143('0xa7')]['Contacts'][0x0];return db[_0x1143('0x8d')][_0x1143('0x71')](_[_0x1143('0xb6')](_0x2d0a28[_0x1143('0x69')],{'firstName':_0x2d0a28[_0x1143('0x69')]['to'],'email':_0x2d0a28[_0x1143('0x69')]['to'],'phone':_0x2d0a28[_0x1143('0x69')]['to'],'ListId':_0x42e3a6[_0x1143('0x7a')]}));})[_0x1143('0x26')](function(_0x49d5c9){if(!_0x49d5c9)return;var _0x50e89f={'UserId':_0x2d0a28[_0x1143('0x38')]['id'],'ContactId':_0x49d5c9['id'],'MailAccountId':_0x42e3a6['id'],'inReplyTo':_0x5dcfe1[_0x1143('0xb7')],'to':_0x2d0a28['body']['from'],'cc':_0x2d0a28[_0x1143('0x69')]['cc'],'subject':_0x2d0a28[_0x1143('0x69')][_0x1143('0xb8')],'attach':_0x2d0a28[_0x1143('0x69')][_0x1143('0xb9')],'firstMsgDirection':_0x1143('0xba'),'lastMsgAt':moment()[_0x1143('0xa3')](_0x1143('0xbb')),'lastMsgDirection':'out','Messages':[_[_0x1143('0x5d')](_0x2d0a28[_0x1143('0x69')],{'messageId':_0x5dcfe1[_0x1143('0xb7')],'sentAt':moment()['format'](_0x1143('0xbb')),'read':!![],'MailAccountId':_0x42e3a6['id'],'UserId':_0x2d0a28[_0x1143('0x38')]['id'],'ContactId':_0x49d5c9['id']})]};if(_0x2d0a28['body'][_0x1143('0xbc')]){_0x50e89f=_['merge'](_0x50e89f,_0x2d0a28[_0x1143('0x69')][_0x1143('0xbc')]);}return db[_0x1143('0x8a')][_0x1143('0x71')](_0x50e89f,{'include':[{'model':db[_0x1143('0xa0')],'as':_0x1143('0xbd')}]});})[_0x1143('0x26')](respondWithResult(_0x4e9484,null))[_0x1143('0x1a')](handleError(_0x4e9484,null));};exports['verifySmtp']=function(_0x5a7ba2,_0x594937){return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x5a7ba2[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x45')],'as':_0x1143('0x43'),'raw':!![],'include':[{'model':db[_0x1143('0xab')],'as':_0x1143('0xab'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x594937,null))['then'](function(_0x1005bd){if(!_0x1005bd['Smtp'])return;var _0x4fdd58=_0x1005bd[_0x1143('0xb2')]();return respondWithRpcPromise(_0x1143('0xbe'),_0x1143('0xbf'),{'account':_0x4fdd58});})[_0x1143('0x26')](respondWithResult(_0x594937,null))['catch'](handleError(_0x594937,null));};exports[_0x1143('0x25')]=function(_0x2c8900,_0x4af50c){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x2c8900[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x4af50c,null))['then'](function(_0x118f8a){if(_0x118f8a&&_0x118f8a[_0x1143('0x40')]){throw new db['Sequelize'][(_0x1143('0xc0'))](_0x1143('0xc1'));}return _0x118f8a;})[_0x1143('0x26')](removeEntity(_0x4af50c,null))[_0x1143('0x1a')](handleError(_0x4af50c,null));};exports['addAgents']=function(_0x59f4cb,_0x2abf9e){return db[_0x1143('0x48')]['find']({'where':{'id':_0x59f4cb['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2abf9e,null))[_0x1143('0x26')](function(_0x274a47){if(_0x274a47){return _0x274a47[_0x1143('0xc2')](_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')],_['omit'](_0x59f4cb['body'],[_0x1143('0x78'),'id'])||{})[_0x1143('0xc3')](function(_0x3711ef){for(var _0x191ec2=0x0;_0x191ec2<_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')][_0x1143('0x55')];_0x191ec2+=0x1){socket[_0x1143('0xc4')]('userMailAccount:save',{'UserId':Number(_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')][_0x191ec2]),'MailAccountId':Number(_0x59f4cb[_0x1143('0x65')]['id'])});}return _0x3711ef;});}})[_0x1143('0x26')](respondWithResult(_0x2abf9e,null))[_0x1143('0x1a')](handleError(_0x2abf9e,null));};exports[_0x1143('0xc5')]=function(_0x54dc78,_0x43c845){return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x54dc78[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x43c845,null))[_0x1143('0x26')](function(_0x4284a0){if(_0x4284a0){return _0x4284a0[_0x1143('0xc5')](_0x54dc78['query'][_0x1143('0x78')])[_0x1143('0x26')](function(){if(_[_0x1143('0xc6')](_0x54dc78[_0x1143('0x50')]['ids'])){for(var _0x58bfd1=0x0;_0x58bfd1<_0x54dc78[_0x1143('0x50')][_0x1143('0x78')][_0x1143('0x55')];_0x58bfd1+=0x1){socket[_0x1143('0xc4')](_0x1143('0xc7'),{'UserId':Number(_0x54dc78['query'][_0x1143('0x78')][_0x58bfd1]),'MailAccountId':Number(_0x54dc78['params']['id'])});}}else{socket[_0x1143('0xc4')](_0x1143('0xc7'),{'UserId':Number(_0x54dc78['query'][_0x1143('0x78')]),'MailAccountId':Number(_0x54dc78[_0x1143('0x65')]['id'])});}});}})[_0x1143('0x26')](respondWithStatusCode(_0x43c845,null))[_0x1143('0x1a')](handleError(_0x43c845,null));};exports[_0x1143('0xc8')]=function(_0x22a6cd,_0x107a18){var _0x33c0e2={};var _0x1b373f={};var _0x20460f;var _0xa9bbf0;return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x22a6cd[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x107a18,null))['then'](function(_0x544fc6){if(_0x544fc6){_0x20460f=_0x544fc6;_0x1b373f[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0x8f')]['rawAttributes']);_0x1b373f['query']=_[_0x1143('0x4f')](_0x22a6cd[_0x1143('0x50')]);_0x1b373f[_0x1143('0x51')]=_[_0x1143('0x52')](_0x1b373f[_0x1143('0x4d')],_0x1b373f['query']);_0x33c0e2[_0x1143('0x54')]=_['intersection'](_0x1b373f['model'],qs[_0x1143('0x53')](_0x22a6cd[_0x1143('0x50')][_0x1143('0x53')]));_0x33c0e2[_0x1143('0x54')]=_0x33c0e2[_0x1143('0x54')][_0x1143('0x55')]?_0x33c0e2['attributes']:_0x1b373f[_0x1143('0x4d')];_0x33c0e2['order']=qs[_0x1143('0x59')](_0x22a6cd[_0x1143('0x50')][_0x1143('0x59')]);_0x33c0e2['where']=qs[_0x1143('0x51')](_['pick'](_0x22a6cd[_0x1143('0x50')],_0x1b373f[_0x1143('0x51')]));if(_0x22a6cd[_0x1143('0x50')][_0x1143('0x5c')]){_0x33c0e2[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x33c0e2[_0x1143('0x5a')],{'$or':_['map'](_0x33c0e2[_0x1143('0x54')],function(_0x405255){var _0x2b9bba={};_0x2b9bba[_0x405255]={'$like':'%'+_0x22a6cd[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x2b9bba;})});}_0x33c0e2=_[_0x1143('0x5d')]({},_0x33c0e2,_0x22a6cd[_0x1143('0x5f')]);return _0x20460f[_0x1143('0xc8')](_0x33c0e2);}})[_0x1143('0x26')](function(_0xeba26d){if(_0xeba26d){_0xa9bbf0=_0xeba26d[_0x1143('0x55')];if(!_0x22a6cd[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x33c0e2[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x22a6cd['query']['limit']);_0x33c0e2[_0x1143('0x21')]=qs['offset'](_0x22a6cd[_0x1143('0x50')][_0x1143('0x21')]);}return _0x20460f['getAgents'](_0x33c0e2);}})[_0x1143('0x26')](function(_0x3e1c79){if(_0x3e1c79){return _0x3e1c79?{'count':_0xa9bbf0,'rows':_0x3e1c79}:null;}})[_0x1143('0x26')](respondWithResult(_0x107a18,null))['catch'](handleError(_0x107a18,null));}; \ No newline at end of file +var _0x2cc1=['pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','show','params','MailServerIn','rawAttributes','includeAll','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','create','findOne','removeAnswers','email','ListId','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','send','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','server/files/attachments','SendMail','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','request','then','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','update','get','UserProfileResource','sendStatus','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x2cc1,0x8d));var _0x12cc=function(_0x99405c,_0x445476){_0x99405c=_0x99405c-0x0;var _0x3daed0=_0x2cc1[_0x99405c];return _0x3daed0;};'use strict';var moment=require('moment');var BPromise=require(_0x12cc('0x0'));var util=require('util');var path=require('path');var _=require(_0x12cc('0x1'));var juice=require(_0x12cc('0x2'));var Redis=require(_0x12cc('0x3'));var qs=require(_0x12cc('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x12cc('0x5'))['db'];config['redis']=_[_0x12cc('0x6')](config[_0x12cc('0x7')],{'host':_0x12cc('0x8'),'port':0x18eb});var socket=require(_0x12cc('0x9'))(new Redis(config[_0x12cc('0x7')]));require('./mailAccount.socket')[_0x12cc('0xa')](socket);var jayson=require('jayson/promise');var client=jayson[_0x12cc('0xb')]['http']({'port':0x232b});function respondWithRpcPromise(_0x1a00aa,_0x27eb42,_0xc55783,_0xd0c606){return new BPromise(function(_0x5ca8cc,_0x12dcc3){var _0x197b96=_0xd0c606||client;return _0x197b96[_0x12cc('0xc')](_0x1a00aa,_0xc55783)[_0x12cc('0xd')](function(_0x551284){logger['info']('MailAccount,\x20%s,\x20%s',_0x27eb42,_0x12cc('0xe'));logger[_0x12cc('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x27eb42,_0x12cc('0xe'),JSON[_0x12cc('0x10')](_0x551284));if(_0x551284[_0x12cc('0x11')]){if(_0x551284['error']['code']===0x1f4){logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x551284[_0x12cc('0x11')][_0x12cc('0x13')]);return _0x12dcc3(_0x551284[_0x12cc('0x11')]['message']);}logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x551284['error'][_0x12cc('0x13')]);return _0x5ca8cc(_0x551284[_0x12cc('0x11')][_0x12cc('0x13')]);}else{logger['info'](_0x12cc('0x12'),_0x27eb42,_0x12cc('0xe'));_0x5ca8cc(_0x551284[_0x12cc('0x14')][_0x12cc('0x13')]);}})[_0x12cc('0x15')](function(_0x3186f0){logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x3186f0);_0x12dcc3(_0x3186f0);});});}function respondWithStatusCode(_0x231355,_0x5bc343){_0x5bc343=_0x5bc343||0xcc;return function(_0x586a01){if(_0x586a01){return _0x231355['sendStatus'](_0x5bc343);}return _0x231355[_0x12cc('0x16')](_0x5bc343)['end']();};}function respondWithResult(_0x47ec6a,_0x51218c){_0x51218c=_0x51218c||0xc8;return function(_0x4947d3){if(_0x4947d3){return _0x47ec6a[_0x12cc('0x16')](_0x51218c)['json'](_0x4947d3);}};}function respondWithFilteredResult(_0x1a99e3,_0x42807e){return function(_0x16a1fe){if(_0x16a1fe){var _0x1ff345=typeof _0x42807e['offset']===_0x12cc('0x17')&&typeof _0x42807e[_0x12cc('0x18')]==='undefined';var _0x37efb2=_0x16a1fe[_0x12cc('0x19')];var _0x2440be=_0x1ff345?0x0:_0x42807e[_0x12cc('0x1a')];var _0x4f7c91=_0x1ff345?_0x16a1fe[_0x12cc('0x19')]:_0x42807e[_0x12cc('0x1a')]+_0x42807e[_0x12cc('0x18')];var _0x5905d6;if(_0x4f7c91>=_0x37efb2){_0x4f7c91=_0x37efb2;_0x5905d6=0xc8;}else{_0x5905d6=0xce;}_0x1a99e3[_0x12cc('0x16')](_0x5905d6);return _0x1a99e3[_0x12cc('0x1b')](_0x12cc('0x1c'),_0x2440be+'-'+_0x4f7c91+'/'+_0x37efb2)[_0x12cc('0x1d')](_0x16a1fe);}return null;};}function saveUpdates(_0xfe242a){return function(_0x5f27cd){if(_0x5f27cd){return _0x5f27cd[_0x12cc('0x1e')](_0xfe242a)['then'](function(_0x3b3466){return _0x3b3466;});}return null;};}function removeEntity(_0x41d9ee){return function(_0x1bd539){if(_0x1bd539){return _0x1bd539['destroy']()[_0x12cc('0xd')](function(){var _0x1e60d5=_0x1bd539[_0x12cc('0x1f')]({'plain':!![]});var _0x3ea142='MailAccounts';return db[_0x12cc('0x20')]['destroy']({'where':{'type':_0x3ea142,'resourceId':_0x1e60d5['id']}})['then'](function(){return _0x1bd539;});})[_0x12cc('0xd')](function(){_0x41d9ee[_0x12cc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1810){return function(_0x18e1a2){if(!_0x18e1a2){_0x3f1810[_0x12cc('0x21')](0x194);}return _0x18e1a2;};}function handleError(_0x37aca5,_0xfa7380){_0xfa7380=_0xfa7380||0x1f4;return function(_0x2a0756){logger[_0x12cc('0x11')](_0x2a0756[_0x12cc('0x22')]);if(_0x2a0756['name']){delete _0x2a0756[_0x12cc('0x23')];}_0x37aca5[_0x12cc('0x16')](_0xfa7380)['send'](_0x2a0756);};}function getImapHost(_0x31a45c){switch(_0x31a45c){case'gmail':return _0x12cc('0x24');case _0x12cc('0x25'):return _0x12cc('0x26');case _0x12cc('0x27'):return _0x12cc('0x28');case _0x12cc('0x29'):return _0x12cc('0x2a');}throw new Error('Unknown\x20email\x20service\x20provider',_0x31a45c);}function getSmtpHost(_0x298f5c){switch(_0x298f5c){case _0x12cc('0x2b'):return'smtp.gmail.com';case _0x12cc('0x25'):return _0x12cc('0x2c');case _0x12cc('0x27'):return _0x12cc('0x2d');case _0x12cc('0x29'):return _0x12cc('0x2e');}throw new Error(_0x12cc('0x2f'),_0x298f5c);}function getAuthenticationOptions(_0xb3617f,_0x22acd1){var _0x74bcf0={};var _0x194064={};if(_0xb3617f){_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=_0x22acd1[_0x12cc('0x31')];_0x74bcf0[_0x12cc('0x32')]=_0x194064[_0x12cc('0x33')]=_0x22acd1['password'];if(_0x22acd1['modernAuthentication']){_0x74bcf0[_0x12cc('0x34')]=_0x194064['modernAuthentication']=!![];_0x74bcf0[_0x12cc('0x35')]=_0x194064[_0x12cc('0x35')]=_0x22acd1[_0x12cc('0x35')];_0x74bcf0[_0x12cc('0x32')]=_0x194064['pass']=null;}else{_0x74bcf0[_0x12cc('0x35')]=_0x194064[_0x12cc('0x35')]=null;}_0x74bcf0[_0x12cc('0x36')]=getImapHost(_0xb3617f);_0x74bcf0[_0x12cc('0x37')]=0x3e1;_0x194064['host']=getSmtpHost(_0xb3617f);_0x194064[_0x12cc('0x37')]=0x24b;_0x194064[_0x12cc('0x38')]=![];_0x74bcf0['service']=_0x194064[_0x12cc('0x39')]=null;}else{if(_0x22acd1[_0x12cc('0x3a')]){_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=_0x22acd1[_0x12cc('0x31')];_0x74bcf0['password']=_0x194064[_0x12cc('0x33')]=_0x22acd1[_0x12cc('0x32')];}else{_0x74bcf0['authentication']=_0x194064[_0x12cc('0x3a')]=![];_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=null;_0x74bcf0['password']=_0x194064[_0x12cc('0x33')]=null;}_0x74bcf0[_0x12cc('0x36')]=_0x22acd1[_0x12cc('0x3b')][_0x12cc('0x36')];_0x74bcf0['port']=_0x22acd1[_0x12cc('0x3b')][_0x12cc('0x37')];_0x194064[_0x12cc('0x36')]=_0x22acd1['Smtp'][_0x12cc('0x36')];_0x194064[_0x12cc('0x37')]=_0x22acd1[_0x12cc('0x3c')][_0x12cc('0x37')];}return{'Imap':_0x74bcf0,'Smtp':_0x194064};}exports['index']=function(_0x5f42e7,_0x37388d){var _0x156a58={'include':[{'model':db['MailServerIn'],'as':_0x12cc('0x3b')},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db[_0x12cc('0x3e')],'as':_0x12cc('0x3f')}]},_0x159e59={},_0x476e97={'count':0x0,'rows':[]};var _0x3865d1=_[_0x12cc('0x40')](db[_0x12cc('0x41')]['rawAttributes'],function(_0x2af017){return{'name':_0x2af017['fieldName'],'type':_0x2af017[_0x12cc('0x42')][_0x12cc('0x43')]};});_0x159e59[_0x12cc('0x44')]=_['map'](_0x3865d1,_0x12cc('0x23'));_0x159e59[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0x5f42e7[_0x12cc('0x45')]);_0x159e59[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x159e59[_0x12cc('0x44')],_0x159e59[_0x12cc('0x45')]);_0x156a58[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x159e59['model'],qs[_0x12cc('0x4a')](_0x5f42e7[_0x12cc('0x45')]['fields']));_0x156a58[_0x12cc('0x49')]=_0x156a58[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x156a58[_0x12cc('0x49')]:_0x159e59[_0x12cc('0x44')];if(!_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x156a58['limit']=qs[_0x12cc('0x18')](_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x18')]);_0x156a58[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x156a58[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x5f42e7[_0x12cc('0x45')]['sort']);_0x156a58[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_['pick'](_0x5f42e7[_0x12cc('0x45')],_0x159e59[_0x12cc('0x47')]),_0x3865d1);if(_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x51')]){_0x156a58['where']=_[_0x12cc('0x52')](_0x156a58['where'],{'$or':_[_0x12cc('0x40')](_0x3865d1,function(_0x344530){if(_0x344530[_0x12cc('0x42')]!==_0x12cc('0x53')){var _0x94d4a4={};_0x94d4a4[_0x344530[_0x12cc('0x23')]]={'$like':'%'+_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x94d4a4;}})});}_0x156a58=_[_0x12cc('0x52')]({},_0x156a58,_0x5f42e7['options']);var _0x475fa7={'where':_0x156a58[_0x12cc('0x50')]};return db[_0x12cc('0x41')][_0x12cc('0x19')](_0x475fa7)[_0x12cc('0xd')](function(_0x164c6d){_0x476e97['count']=_0x164c6d;if(_0x5f42e7[_0x12cc('0x45')]['includeAll']){_0x156a58[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x41')]['findAll'](_0x156a58);})[_0x12cc('0xd')](function(_0x158925){_0x476e97[_0x12cc('0x55')]=_0x158925;return _0x476e97;})[_0x12cc('0xd')](respondWithFilteredResult(_0x37388d,_0x156a58))[_0x12cc('0x15')](handleError(_0x37388d,null));};exports[_0x12cc('0x56')]=function(_0x4f4cdf,_0x963b4c){var _0x2e4178={'raw':![],'where':{'id':_0x4f4cdf[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x58')],'as':_0x12cc('0x3b')},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db['Pause'],'as':_0x12cc('0x3f')}]},_0x176fd9={};_0x176fd9[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x41')][_0x12cc('0x59')]);_0x176fd9[_0x12cc('0x45')]=_['keys'](_0x4f4cdf['query']);_0x176fd9['filters']=_[_0x12cc('0x48')](_0x176fd9[_0x12cc('0x44')],_0x176fd9[_0x12cc('0x45')]);_0x2e4178[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x176fd9[_0x12cc('0x44')],qs[_0x12cc('0x4a')](_0x4f4cdf[_0x12cc('0x45')]['fields']));_0x2e4178[_0x12cc('0x49')]=_0x2e4178[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x2e4178[_0x12cc('0x49')]:_0x176fd9[_0x12cc('0x44')];if(_0x4f4cdf['query'][_0x12cc('0x5a')]){_0x2e4178[_0x12cc('0x54')]=[{'all':!![]}];}_0x2e4178=_[_0x12cc('0x52')]({},_0x2e4178,_0x4f4cdf[_0x12cc('0x5b')]);return db['MailAccount'][_0x12cc('0x5c')](_0x2e4178)[_0x12cc('0xd')](handleEntityNotFound(_0x963b4c,null))[_0x12cc('0xd')](respondWithResult(_0x963b4c,null))[_0x12cc('0x15')](handleError(_0x963b4c,null));};exports[_0x12cc('0x1e')]=function(_0x3e3b9b,_0x2cd12c){if(_0x3e3b9b[_0x12cc('0x5d')]['id']){delete _0x3e3b9b[_0x12cc('0x5d')]['id'];}var _0x308c6b=_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x5e')]===_0x12cc('0x5f')?null:_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x5e')];var _0x3100de=_0x3e3b9b['body']['Imap']||{};var _0x22126e=_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')]||{};if(_0x308c6b){_0x3100de[_0x12cc('0x36')]=getImapHost(_0x308c6b);_0x3100de[_0x12cc('0x37')]=0x3e1;_0x22126e[_0x12cc('0x36')]=getSmtpHost(_0x308c6b);_0x22126e[_0x12cc('0x37')]=0x24b;_0x22126e[_0x12cc('0x38')]=![];}if(_0x22126e['modernAuthentication']){_0x22126e[_0x12cc('0x38')]=![];}else{_0x22126e[_0x12cc('0x35')]=null;}if(!_0x3100de[_0x12cc('0x34')])_0x3100de[_0x12cc('0x35')]=null;_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')]=_0x3100de;_0x3e3b9b['body'][_0x12cc('0x3c')]=_0x22126e;return db['MailAccount'][_0x12cc('0x5c')]({'where':{'id':_0x3e3b9b[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x58')],'as':'Imap'},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db[_0x12cc('0x3e')],'as':_0x12cc('0x3f')}]})[_0x12cc('0xd')](handleEntityNotFound(_0x2cd12c,null))[_0x12cc('0xd')](function(_0x4becc1){if(!_0x4becc1)throw new Error(_0x12cc('0x60'));if(_0x4becc1['service'])delete _0x3e3b9b['body'][_0x12cc('0x3b')];return _0x4becc1;})[_0x12cc('0xd')](saveUpdates(_0x3e3b9b['body'],null))[_0x12cc('0xd')](function(_0x33ff9b){if(!_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')])return _0x33ff9b;return db[_0x12cc('0x58')][_0x12cc('0x1e')](_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')],{'where':{'MailAccountId':_0x33ff9b['id']}})['then'](function(){return _0x33ff9b;});})['then'](function(_0x48a589){if(!_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')])return _0x48a589;return db[_0x12cc('0x3d')][_0x12cc('0x1e')](_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')],{'where':{'MailAccountId':_0x48a589['id']}})[_0x12cc('0xd')](function(){return _0x48a589;});})[_0x12cc('0xd')](respondWithResult(_0x2cd12c,null))[_0x12cc('0x15')](handleError(_0x2cd12c,null));};exports['describe']=function(_0x355356,_0x5e2f8b){return db['MailAccount'][_0x12cc('0x61')]()[_0x12cc('0xd')](respondWithResult(_0x5e2f8b,null))[_0x12cc('0x15')](handleError(_0x5e2f8b,null));};exports[_0x12cc('0x62')]=function(_0xb764aa,_0x5d52eb){if(_0xb764aa[_0x12cc('0x5d')]['id']){delete _0xb764aa[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')]['find']({'where':{'id':_0xb764aa[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x5d52eb,null))[_0x12cc('0xd')](function(_0x17a29b){if(_0x17a29b){_0xb764aa['body'][_0x12cc('0x63')]=_0x17a29b['id'];return db[_0x12cc('0x64')]['create'](_0xb764aa[_0x12cc('0x5d')]);}})[_0x12cc('0xd')](respondWithResult(_0x5d52eb,null))[_0x12cc('0x15')](handleError(_0x5d52eb,null));};exports[_0x12cc('0x65')]=function(_0xbf8acc,_0x263d9e){var _0x26478b={'raw':![],'where':{}};var _0xed4f04={};var _0x6c29db={'count':0x0,'rows':[]};return db[_0x12cc('0x41')]['findOne']({'where':{'id':_0xbf8acc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x263d9e,null))[_0x12cc('0xd')](function(_0x2e9526){if(_0x2e9526){_0xed4f04[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x64')][_0x12cc('0x59')]);_0xed4f04[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0xbf8acc[_0x12cc('0x45')]);_0xed4f04[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0xed4f04[_0x12cc('0x44')],_0xed4f04[_0x12cc('0x45')]);_0x26478b[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0xed4f04[_0x12cc('0x44')],qs[_0x12cc('0x4a')](_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x4a')]));_0x26478b[_0x12cc('0x49')]=_0x26478b['attributes']['length']?_0x26478b[_0x12cc('0x49')]:_0xed4f04[_0x12cc('0x44')];if(!_0xbf8acc['query'][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x26478b[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x18')]);_0x26478b[_0x12cc('0x1a')]=qs['offset'](_0xbf8acc['query'][_0x12cc('0x1a')]);}_0x26478b[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0xbf8acc['query'][_0x12cc('0x4f')]);_0x26478b[_0x12cc('0x50')]=qs['filters'](_[_0x12cc('0x66')](_0xbf8acc[_0x12cc('0x45')],_0xed4f04[_0x12cc('0x47')]));_0x26478b[_0x12cc('0x50')]['MailAccountId']=_0x2e9526['id'];if(_0xbf8acc['query'][_0x12cc('0x51')]){_0x26478b[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x26478b[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x26478b[_0x12cc('0x49')],function(_0xe2a600){var _0x5ef633={};_0x5ef633[_0xe2a600]={'$like':'%'+_0xbf8acc['query']['filter']+'%'};return _0x5ef633;})});}_0x26478b=_[_0x12cc('0x52')]({},_0x26478b,_0xbf8acc['options']);return db['Disposition'][_0x12cc('0x19')]({'where':_0x26478b[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x14f939){_0x6c29db[_0x12cc('0x19')]=_0x14f939;if(_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x26478b[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x64')][_0x12cc('0x67')](_0x26478b);})['then'](function(_0x31ed5e){_0x6c29db[_0x12cc('0x55')]=_0x31ed5e;return _0x6c29db;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x263d9e,_0x26478b))['catch'](handleError(_0x263d9e,null));};exports[_0x12cc('0x68')]=function(_0x3ebaf6,_0x43eb91){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x3ebaf6[_0x12cc('0x57')]['id']}})['then'](handleEntityNotFound(_0x43eb91,null))['then'](function(_0x340b98){if(_0x340b98){return _0x340b98[_0x12cc('0x68')](_0x3ebaf6[_0x12cc('0x45')][_0x12cc('0x69')]);}})[_0x12cc('0xd')](respondWithStatusCode(_0x43eb91,null))[_0x12cc('0x15')](handleError(_0x43eb91,null));};exports[_0x12cc('0x6a')]=function(_0x35766f,_0x56fb3f){if(_0x35766f['body']['id']){delete _0x35766f[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x35766f[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x56fb3f,null))[_0x12cc('0xd')](function(_0x20095a){if(_0x20095a){_0x35766f[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x20095a['id'];return db[_0x12cc('0x6b')][_0x12cc('0x6c')](_0x35766f[_0x12cc('0x5d')]);}})[_0x12cc('0xd')](respondWithResult(_0x56fb3f,null))[_0x12cc('0x15')](handleError(_0x56fb3f,null));};exports['getAnswers']=function(_0x1c7d5c,_0x11bc0c){var _0x599233={'raw':![],'where':{}};var _0x1a3b98={};var _0x5698cc={'count':0x0,'rows':[]};return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x1c7d5c[_0x12cc('0x57')]['id']}})['then'](handleEntityNotFound(_0x11bc0c,null))['then'](function(_0x417a0f){if(_0x417a0f){_0x1a3b98[_0x12cc('0x44')]=_[_0x12cc('0x46')](db['CannedAnswer'][_0x12cc('0x59')]);_0x1a3b98[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0x1c7d5c[_0x12cc('0x45')]);_0x1a3b98[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x1a3b98[_0x12cc('0x44')],_0x1a3b98['query']);_0x599233[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x1a3b98['model'],qs[_0x12cc('0x4a')](_0x1c7d5c['query']['fields']));_0x599233[_0x12cc('0x49')]=_0x599233['attributes'][_0x12cc('0x4b')]?_0x599233['attributes']:_0x1a3b98[_0x12cc('0x44')];if(!_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x4c')]('nolimit')){_0x599233[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x18')]);_0x599233[_0x12cc('0x1a')]=qs['offset'](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x599233['order']=qs[_0x12cc('0x4f')](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x599233[_0x12cc('0x50')]=qs['filters'](_[_0x12cc('0x66')](_0x1c7d5c[_0x12cc('0x45')],_0x1a3b98[_0x12cc('0x47')]));_0x599233['where'][_0x12cc('0x63')]=_0x417a0f['id'];if(_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x51')]){_0x599233['where']=_['merge'](_0x599233['where'],{'$or':_[_0x12cc('0x40')](_0x599233['attributes'],function(_0x39846e){var _0x32adf3={};_0x32adf3[_0x39846e]={'$like':'%'+_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x32adf3;})});}_0x599233=_[_0x12cc('0x52')]({},_0x599233,_0x1c7d5c['options']);return db['CannedAnswer']['count']({'where':_0x599233[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x562d76){_0x5698cc[_0x12cc('0x19')]=_0x562d76;if(_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x599233[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x6b')]['findAll'](_0x599233);})[_0x12cc('0xd')](function(_0x1bb71c){_0x5698cc[_0x12cc('0x55')]=_0x1bb71c;return _0x5698cc;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x11bc0c,_0x599233))[_0x12cc('0x15')](handleError(_0x11bc0c,null));};exports[_0x12cc('0x6e')]=function(_0x469d78,_0x41fb8e){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x469d78[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x41fb8e,null))['then'](function(_0x37bc35){if(_0x37bc35){return _0x37bc35['removeAnswers'](_0x469d78[_0x12cc('0x45')]['ids']);}})[_0x12cc('0xd')](respondWithStatusCode(_0x41fb8e,null))['catch'](handleError(_0x41fb8e,null));};exports[_0x12cc('0x6c')]=function(_0x25b7f6,_0x2ae479){var _0x8096e7={'name':_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x23')],'key':_0x25b7f6['body'][_0x12cc('0x43')],'provider':_0x25b7f6['body'][_0x12cc('0x5e')]===_0x12cc('0x5f')?null:_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x5e')],'email':_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x6f')],'ListId':_0x25b7f6['body'][_0x12cc('0x70')],'active':!_['isNil'](_0x25b7f6['body']['active'])?_0x25b7f6['body']['active']:!![],'description':_0x25b7f6['body'][_0x12cc('0x71')]||null};var _0xd6025f=getAuthenticationOptions(_0x8096e7[_0x12cc('0x5e')],_0x25b7f6[_0x12cc('0x5d')]);_0x8096e7[_0x12cc('0x3b')]=_0xd6025f[_0x12cc('0x3b')];_0x8096e7[_0x12cc('0x3c')]=_0xd6025f[_0x12cc('0x3c')];return db[_0x12cc('0x41')][_0x12cc('0x6c')](_0x8096e7,{'include':[{'model':db[_0x12cc('0x3d')],'as':'Smtp'},{'model':db[_0x12cc('0x58')],'as':_0x12cc('0x3b')}]})[_0x12cc('0xd')](function(_0x227d64){var _0x5b5ea0=_0x25b7f6['user'][_0x12cc('0x1f')]({'plain':!![]});if(!_0x5b5ea0)throw new Error(_0x12cc('0x72'));if(_0x5b5ea0['role']===_0x12cc('0x30')){var _0xf90341=_0x227d64[_0x12cc('0x1f')]({'plain':!![]});return db['UserProfileSection'][_0x12cc('0x5c')]({'where':{'name':_0x12cc('0x73'),'userProfileId':_0x5b5ea0[_0x12cc('0x74')]},'raw':!![]})[_0x12cc('0xd')](function(_0x1e958b){if(_0x1e958b&&_0x1e958b[_0x12cc('0x75')]===0x0){return db[_0x12cc('0x20')][_0x12cc('0x6c')]({'name':_0xf90341[_0x12cc('0x23')],'resourceId':_0xf90341['id'],'type':_0x1e958b['name'],'sectionId':_0x1e958b['id']},{})['then'](function(){return _0x227d64;});}else{return _0x227d64;}})[_0x12cc('0x15')](function(_0x59cdac){logger['error'](_0x12cc('0x76'),_0x59cdac);throw _0x59cdac;});}return _0x227d64;})[_0x12cc('0xd')](respondWithResult(_0x2ae479,0xc9))[_0x12cc('0x15')](handleError(_0x2ae479,null));};exports[_0x12cc('0x77')]=function(_0xbb560d,_0x4958a6){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0xbb560d[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4958a6,null))[_0x12cc('0xd')](function(_0x29b530){if(_0x29b530){return _0x29b530[_0x12cc('0x77')]();}return null;})[_0x12cc('0xd')](respondWithResult(_0x4958a6,null))[_0x12cc('0x15')](handleError(_0x4958a6,null));};exports[_0x12cc('0x78')]=function(_0x1aca45,_0x540bbb){if(_0x1aca45['body']['id']){delete _0x1aca45[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x1aca45['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x540bbb,null))[_0x12cc('0xd')](function(_0x35a67e){if(_0x35a67e){_0x1aca45[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x35a67e['id'];return db[_0x12cc('0x58')][_0x12cc('0x6c')](_0x1aca45[_0x12cc('0x5d')]);}})['then'](respondWithResult(_0x540bbb,null))[_0x12cc('0x15')](handleError(_0x540bbb,null));};exports[_0x12cc('0x79')]=function(_0x26cedc,_0x23f643){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x26cedc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x23f643,null))[_0x12cc('0xd')](function(_0x353dd2){if(_0x353dd2){return _0x353dd2[_0x12cc('0x7a')](null);}return null;})[_0x12cc('0xd')](respondWithStatusCode(_0x23f643,null))[_0x12cc('0x15')](handleError(_0x23f643,null));};exports[_0x12cc('0x7b')]=function(_0x3a91e0,_0x5b69e4){return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x3a91e0[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x5b69e4,null))[_0x12cc('0xd')](function(_0x229f8c){if(_0x229f8c){return _0x229f8c[_0x12cc('0x7b')]();}return null;})[_0x12cc('0xd')](respondWithResult(_0x5b69e4,null))['catch'](handleError(_0x5b69e4,null));};exports[_0x12cc('0x7c')]=function(_0x1eb78f,_0x4a3c2c){if(_0x1eb78f[_0x12cc('0x5d')]['id']){delete _0x1eb78f[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x1eb78f['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4a3c2c,null))[_0x12cc('0xd')](function(_0x2cadfa){if(_0x2cadfa){_0x1eb78f[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x2cadfa['id'];return db['MailServerOut'][_0x12cc('0x6c')](_0x1eb78f['body']);}})[_0x12cc('0xd')](respondWithResult(_0x4a3c2c,null))[_0x12cc('0x15')](handleError(_0x4a3c2c,null));};exports[_0x12cc('0x7d')]=function(_0x338bcb,_0x2a09a8){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x338bcb[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x2a09a8,null))[_0x12cc('0xd')](function(_0x94b40b){if(_0x94b40b){return _0x94b40b[_0x12cc('0x7e')](null);}return null;})[_0x12cc('0xd')](respondWithStatusCode(_0x2a09a8,null))[_0x12cc('0x15')](handleError(_0x2a09a8,null));};exports[_0x12cc('0x7f')]=function(_0x43b47b,_0x52035a){return db[_0x12cc('0x80')]['find']({'where':{'id':_0x43b47b[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x52035a,null))['then'](function(_0x25d3b9){if(_0x25d3b9){return _0x25d3b9['addInteraction'](_0x43b47b[_0x12cc('0x5d')]['ids'],_[_0x12cc('0x81')](_0x43b47b['body'],['ids','id'])||{});}})[_0x12cc('0xd')](respondWithResult(_0x52035a,null))[_0x12cc('0x15')](handleError(_0x52035a,null));};exports[_0x12cc('0x82')]=function(_0x30ddeb,_0x4c65a6){var _0x445842={'raw':![],'where':{}};var _0x21f504={};var _0x189d9d={'count':0x0,'rows':[]};return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x30ddeb[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4c65a6,null))[_0x12cc('0xd')](function(_0x34bb56){if(_0x34bb56){_0x21f504[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x80')]['rawAttributes']);_0x21f504['query']=_[_0x12cc('0x46')](_0x30ddeb[_0x12cc('0x45')]);_0x21f504[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x21f504[_0x12cc('0x44')],_0x21f504[_0x12cc('0x45')]);_0x445842[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x21f504[_0x12cc('0x44')],qs['fields'](_0x30ddeb['query'][_0x12cc('0x4a')]));_0x445842['attributes']=_0x445842[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x445842[_0x12cc('0x49')]:_0x21f504[_0x12cc('0x44')];if(!_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x445842[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0x30ddeb['query'][_0x12cc('0x18')]);_0x445842[_0x12cc('0x1a')]=qs['offset'](_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x445842[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x445842[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_['pick'](_0x30ddeb[_0x12cc('0x45')],_0x21f504[_0x12cc('0x47')]));_0x445842[_0x12cc('0x50')][_0x12cc('0x63')]=_0x34bb56['id'];if(_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x51')]){_0x445842[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x445842[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x445842['attributes'],function(_0x4d76b6){var _0x486e50={};_0x486e50[_0x4d76b6]={'$like':'%'+_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x486e50;})});}_0x445842=_[_0x12cc('0x52')]({},_0x445842,_0x30ddeb[_0x12cc('0x5b')]);return db[_0x12cc('0x80')][_0x12cc('0x19')]({'where':_0x445842[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x29d6d4){_0x189d9d[_0x12cc('0x19')]=_0x29d6d4;if(_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x445842[_0x12cc('0x54')]=[{'model':db[_0x12cc('0x83')],'as':_0x12cc('0x84'),'required':![]},{'model':db[_0x12cc('0x85')],'as':_0x12cc('0x86'),'attributes':['name',_0x12cc('0x87'),_0x12cc('0x88')],'required':![]},{'model':db[_0x12cc('0x89')],'as':'Tags','attributes':['id','name','color'],'where':_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x8a')]?{'id':_0x30ddeb['query'][_0x12cc('0x8a')]}:undefined,'required':_0x30ddeb['query'][_0x12cc('0x8a')]?!![]:![]}];}return db[_0x12cc('0x80')]['findAll'](_0x445842);})[_0x12cc('0xd')](function(_0x3dfd62){_0x189d9d[_0x12cc('0x55')]=_0x3dfd62;return _0x189d9d;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x4c65a6,_0x445842))[_0x12cc('0x15')](handleError(_0x4c65a6,null));};exports[_0x12cc('0x8b')]=function addApplications(_0x1f18e2,_0x5473cb){var _0x9d9c90=_0x1f18e2[_0x12cc('0x57')]['id'];var _0x32a073=_0x1f18e2['body'];var _0x4dc5b7=0xc8;var _0x1c69f7=null;return db['sequelize'][_0x12cc('0x8c')]({'isolationLevel':db[_0x12cc('0x8d')][_0x12cc('0x8e')][_0x12cc('0x8f')][_0x12cc('0x90')]},function(_0x55c353){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x9d9c90},'transaction':_0x55c353})[_0x12cc('0xd')](function(_0x32a30a){if(_0x32a30a){return db[_0x12cc('0x91')][_0x12cc('0x92')]({'where':{'MailAccountId':_0x9d9c90},'transaction':_0x55c353})[_0x12cc('0xd')](function(){var _0x45e151=_[_0x12cc('0x40')](_0x32a073,function(_0x2bda2d){_0x2bda2d['MailAccountId']=_0x9d9c90;return _0x2bda2d;});return db[_0x12cc('0x91')][_0x12cc('0x93')](_0x45e151,{'transaction':_0x55c353});});}else{_0x4dc5b7=0x194;_0x1c69f7=[];}});})[_0x12cc('0xd')](function(){if(_0x4dc5b7!==0x194){return db[_0x12cc('0x91')][_0x12cc('0x94')]({'where':{'MailAccountId':_0x9d9c90},'order':_0x12cc('0x95')})[_0x12cc('0xd')](function(_0x571041){_0x1c69f7=_0x571041;});}})[_0x12cc('0x15')](function(_0x173877){_0x4dc5b7=0x1f4;logger[_0x12cc('0x11')](_0x173877['stack']);if(_0x173877[_0x12cc('0x23')]){delete _0x173877[_0x12cc('0x23')];}_0x1c69f7=_0x173877;})[_0x12cc('0x96')](function(){if(_0x1c69f7===null){_0x5473cb['sendStatus'](_0x4dc5b7);}else{if(_0x4dc5b7===0x1f4){_0x5473cb[_0x12cc('0x16')](_0x4dc5b7)['send'](_0x1c69f7);}else{_0x5473cb[_0x12cc('0x16')](_0x4dc5b7)[_0x12cc('0x1d')](_0x1c69f7);}}});};exports[_0x12cc('0x97')]=function(_0x5004e5,_0x4d9ae6){var _0x51dbd2={};var _0xe23b0d={};var _0x12c944;var _0x4daa57;return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x5004e5[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4d9ae6,null))[_0x12cc('0xd')](function(_0xf53cfb){if(_0xf53cfb){_0x12c944=_0xf53cfb;_0xe23b0d[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x91')]['rawAttributes']);_0xe23b0d['query']=_['keys'](_0x5004e5[_0x12cc('0x45')]);_0xe23b0d[_0x12cc('0x47')]=_['intersection'](_0xe23b0d[_0x12cc('0x44')],_0xe23b0d['query']);_0x51dbd2[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0xe23b0d[_0x12cc('0x44')],qs['fields'](_0x5004e5['query']['fields']));_0x51dbd2[_0x12cc('0x49')]=_0x51dbd2['attributes'][_0x12cc('0x4b')]?_0x51dbd2[_0x12cc('0x49')]:_0xe23b0d[_0x12cc('0x44')];_0x51dbd2[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x5004e5[_0x12cc('0x45')]['sort']);_0x51dbd2['where']=qs['filters'](_[_0x12cc('0x66')](_0x5004e5[_0x12cc('0x45')],_0xe23b0d['filters']));if(_0x5004e5['query'][_0x12cc('0x51')]){_0x51dbd2[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x51dbd2[_0x12cc('0x50')],{'$or':_['map'](_0x51dbd2[_0x12cc('0x49')],function(_0x13630d){var _0x3b3467={};_0x3b3467[_0x13630d]={'$like':'%'+_0x5004e5[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x3b3467;})});}_0x51dbd2=_[_0x12cc('0x52')]({},_0x51dbd2,_0x5004e5[_0x12cc('0x5b')]);return _0x12c944['getApplications'](_0x51dbd2);}})[_0x12cc('0xd')](function(_0x2771a7){if(_0x2771a7){_0x4daa57=_0x2771a7[_0x12cc('0x4b')];if(!_0x5004e5[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x51dbd2['limit']=qs[_0x12cc('0x18')](_0x5004e5[_0x12cc('0x45')][_0x12cc('0x18')]);_0x51dbd2['offset']=qs[_0x12cc('0x1a')](_0x5004e5['query'][_0x12cc('0x1a')]);}return _0x12c944[_0x12cc('0x97')](_0x51dbd2);}})[_0x12cc('0xd')](function(_0x42c975){if(_0x42c975){return _0x42c975?{'count':_0x4daa57,'rows':_0x42c975}:null;}})['then'](respondWithResult(_0x4d9ae6,null))['catch'](handleError(_0x4d9ae6,null));};exports[_0x12cc('0x98')]=function(_0x148ad1,_0x2cbd2d){var _0x3f5b09={'raw':!![],'where':{}};var _0x148104={};var _0x43f576={'count':0x0,'rows':[]};return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x148ad1['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x2cbd2d,null))['then'](function(_0x5c2f3b){if(_0x5c2f3b){_0x148104['model']=_[_0x12cc('0x46')](db[_0x12cc('0x99')][_0x12cc('0x59')]);_0x148104[_0x12cc('0x45')]=_['keys'](_0x148ad1[_0x12cc('0x45')]);_0x148104[_0x12cc('0x47')]=_['intersection'](_0x148104['model'],_0x148104[_0x12cc('0x45')]);_0x3f5b09[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x148104[_0x12cc('0x44')],qs['fields'](_0x148ad1['query'][_0x12cc('0x4a')]));_0x3f5b09[_0x12cc('0x49')]=_0x3f5b09[_0x12cc('0x49')]['length']?_0x3f5b09[_0x12cc('0x49')]:_0x148104[_0x12cc('0x44')];if(!_0x148ad1[_0x12cc('0x45')][_0x12cc('0x4c')]('nolimit')){_0x3f5b09[_0x12cc('0x18')]=qs['limit'](_0x148ad1[_0x12cc('0x45')][_0x12cc('0x18')]);_0x3f5b09[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x148ad1[_0x12cc('0x45')]['offset']);}_0x3f5b09[_0x12cc('0x4e')]=qs['sort'](_0x148ad1[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x3f5b09[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_[_0x12cc('0x66')](_0x148ad1[_0x12cc('0x45')],_0x148104['filters']));_0x3f5b09[_0x12cc('0x50')][_0x12cc('0x63')]=_0x5c2f3b['id'];if(_0x148ad1[_0x12cc('0x45')]['filter']){_0x3f5b09[_0x12cc('0x50')]=_['merge'](_0x3f5b09[_0x12cc('0x50')],{'$or':_['map'](_0x3f5b09[_0x12cc('0x49')],function(_0x340d76){var _0x534205={};_0x534205[_0x340d76]={'$like':'%'+_0x148ad1['query'][_0x12cc('0x51')]+'%'};return _0x534205;})});}if(_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9a')]){var _0x3ff5ae=_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9a')][_0x12cc('0x9b')](',');var _0x4125c8={};_0x4125c8[_0x3ff5ae[0x0]]={'$gte':moment(_0x3ff5ae[0x1])[_0x12cc('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f5b09['where']=_['merge'](_0x3f5b09[_0x12cc('0x50')],_0x4125c8);}_0x3f5b09=_[_0x12cc('0x52')]({},_0x3f5b09,_0x148ad1['options']);return db[_0x12cc('0x99')][_0x12cc('0x19')]({'where':_0x3f5b09[_0x12cc('0x50')]})['then'](function(_0x5a1536){_0x43f576[_0x12cc('0x19')]=_0x5a1536;if(_0x148ad1[_0x12cc('0x45')]['includeAll']){_0x3f5b09['include']=[{'all':!![]}];}return db[_0x12cc('0x99')][_0x12cc('0x67')](_0x3f5b09);})['then'](function(_0x46f34e){if(_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9d')]===_0x12cc('0x9e')){for(var _0x26887e=0x0;_0x26887e<_0x46f34e['length'];_0x26887e++){_0x46f34e[_0x26887e][_0x12cc('0x5d')]=juice(_0x46f34e[_0x26887e]['body']);}}_0x43f576['rows']=_0x46f34e;return _0x43f576;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x2cbd2d,_0x3f5b09))[_0x12cc('0x15')](handleError(_0x2cbd2d,null));};exports[_0x12cc('0x9f')]=function(_0x3515e5,_0x58d2fa){var _0x31f206,_0x41b040={},_0x4f4967;if(_0x3515e5['body']['to']){_0x4f4967=_0x3515e5[_0x12cc('0x5d')]['to'][_0x12cc('0x9b')](',')[0x0];}return db['MailAccount'][_0x12cc('0x5c')]({'where':{'id':_0x3515e5['params']['id']},'include':[{'model':db['CmList'],'as':_0x12cc('0xa0'),'include':[{'model':db[_0x12cc('0x83')],'as':_0x12cc('0xa1'),'where':{'email':_0x4f4967},'limit':0x1,'order':[['updatedAt',_0x12cc('0xa2')]]}]},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c'),'raw':!![],'include':[{'model':db[_0x12cc('0xa3')],'as':_0x12cc('0xa3'),'raw':!![]}]}]})[_0x12cc('0xd')](handleEntityNotFound(_0x58d2fa,null))['then'](function(_0x4cb014){if(!_0x4cb014)return;_0x31f206=_0x4cb014;if(!_0x4cb014[_0x12cc('0x3c')])throw new Error(_0x12cc('0xa4'));if(_[_0x12cc('0xa5')](_0x3515e5['body'][_0x12cc('0xa6')])){_0x3515e5[_0x12cc('0x5d')]['from']=util[_0x12cc('0x9c')](_0x12cc('0xa7'),_0x4cb014[_0x12cc('0x23')],_0x4cb014[_0x12cc('0x6f')]||_0x4cb014[_0x12cc('0x3c')]['user']);}if(_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')]&&_0x3515e5['body'][_0x12cc('0xa8')][_0x12cc('0x4b')]){for(var _0x1c3842=0x0;_0x1c3842<_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')][_0x12cc('0x4b')];_0x1c3842+=0x1){_0x3515e5['body'][_0x12cc('0xa8')][_0x1c3842]={'filename':_0x3515e5['body'][_0x12cc('0xa8')][_0x1c3842][_0x12cc('0x23')],'path':path[_0x12cc('0xa9')](config['root'],_0x12cc('0xaa'),_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')][_0x1c3842]['basename'])};}}var _0x16c4d7=_0x4cb014['getSmtpOptions']();return respondWithRpcPromise(_0x12cc('0xab'),_0x12cc('0xac'),{'account':_0x16c4d7,'message':_0x3515e5[_0x12cc('0x5d')]});})['then'](function(_0x35170b){if(!_0x35170b)return;_0x41b040=_0x35170b;if(!_0x31f206['List'])throw new Error(_0x12cc('0xad'));if(_0x31f206['List']['Contacts']['length'])return _0x31f206[_0x12cc('0xa0')]['Contacts'][0x0];return db[_0x12cc('0x83')]['create'](_[_0x12cc('0x6')](_0x3515e5['body'],{'firstName':_0x3515e5[_0x12cc('0x5d')]['to'],'email':_0x3515e5[_0x12cc('0x5d')]['to'],'phone':_0x3515e5['body']['to'],'ListId':_0x31f206['ListId']}));})[_0x12cc('0xd')](function(_0xa5e5a8){if(!_0xa5e5a8)return;var _0x4e190b={'UserId':_0x3515e5[_0x12cc('0x30')]['id'],'ContactId':_0xa5e5a8['id'],'MailAccountId':_0x31f206['id'],'inReplyTo':_0x41b040['messageId'],'to':_0x3515e5['body'][_0x12cc('0xa6')],'cc':_0x3515e5[_0x12cc('0x5d')]['cc'],'subject':_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xae')],'attach':_0x3515e5['body'][_0x12cc('0xaf')],'firstMsgDirection':_0x12cc('0xb0'),'lastMsgAt':moment()[_0x12cc('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x12cc('0xb0'),'Messages':[_[_0x12cc('0x52')](_0x3515e5['body'],{'messageId':_0x41b040['messageId'],'sentAt':moment()[_0x12cc('0x9c')](_0x12cc('0xb1')),'read':!![],'MailAccountId':_0x31f206['id'],'UserId':_0x3515e5['user']['id'],'ContactId':_0xa5e5a8['id']})]};if(_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xb2')]){_0x4e190b=_[_0x12cc('0x52')](_0x4e190b,_0x3515e5[_0x12cc('0x5d')]['Interaction']);}return db[_0x12cc('0x80')][_0x12cc('0x6c')](_0x4e190b,{'include':[{'model':db[_0x12cc('0x99')],'as':_0x12cc('0xb3')}]});})[_0x12cc('0xd')](respondWithResult(_0x58d2fa,null))[_0x12cc('0x15')](handleError(_0x58d2fa,null));};exports[_0x12cc('0xb4')]=function(_0x1f9198,_0x585976){return db[_0x12cc('0x41')]['find']({'where':{'id':_0x1f9198[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c'),'raw':!![],'include':[{'model':db[_0x12cc('0xa3')],'as':_0x12cc('0xa3'),'raw':!![]}]}]})[_0x12cc('0xd')](handleEntityNotFound(_0x585976,null))[_0x12cc('0xd')](function(_0x20b345){if(!_0x20b345[_0x12cc('0x3c')])return;var _0x5c6368=_0x20b345[_0x12cc('0xb5')]();return respondWithRpcPromise(_0x12cc('0xb6'),_0x12cc('0xb4'),{'account':_0x5c6368});})[_0x12cc('0xd')](respondWithResult(_0x585976,null))['catch'](handleError(_0x585976,null));};exports[_0x12cc('0x92')]=function(_0x166cfc,_0x437eab){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x166cfc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x437eab,null))[_0x12cc('0xd')](function(_0x5d13dd){if(_0x5d13dd&&_0x5d13dd['service']){throw new db[(_0x12cc('0xb7'))][(_0x12cc('0xb8'))](_0x12cc('0xb9'));}return _0x5d13dd;})['then'](removeEntity(_0x437eab,null))[_0x12cc('0x15')](handleError(_0x437eab,null));};exports[_0x12cc('0xba')]=function(_0x2b589a,_0x461a45){return db[_0x12cc('0x41')]['find']({'where':{'id':_0x2b589a[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x461a45,null))[_0x12cc('0xd')](function(_0x14d634){if(_0x14d634){return _0x14d634['addAgents'](_0x2b589a[_0x12cc('0x5d')][_0x12cc('0x69')],_[_0x12cc('0x81')](_0x2b589a['body'],[_0x12cc('0x69'),'id'])||{})['spread'](function(_0x5a3cdb){for(var _0xb6854c=0x0;_0xb6854c<_0x2b589a[_0x12cc('0x5d')][_0x12cc('0x69')][_0x12cc('0x4b')];_0xb6854c+=0x1){socket[_0x12cc('0xbb')](_0x12cc('0xbc'),{'UserId':Number(_0x2b589a['body'][_0x12cc('0x69')][_0xb6854c]),'MailAccountId':Number(_0x2b589a[_0x12cc('0x57')]['id'])});}return _0x5a3cdb;});}})[_0x12cc('0xd')](respondWithResult(_0x461a45,null))[_0x12cc('0x15')](handleError(_0x461a45,null));};exports[_0x12cc('0xbd')]=function(_0xe68371,_0xba498c){return db[_0x12cc('0x41')]['find']({'where':{'id':_0xe68371['params']['id']}})['then'](handleEntityNotFound(_0xba498c,null))[_0x12cc('0xd')](function(_0x1470e6){if(_0x1470e6){return _0x1470e6[_0x12cc('0xbd')](_0xe68371[_0x12cc('0x45')]['ids'])['then'](function(){if(_['isArray'](_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')])){for(var _0x7406d9=0x0;_0x7406d9<_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')][_0x12cc('0x4b')];_0x7406d9+=0x1){socket['emit'](_0x12cc('0xbe'),{'UserId':Number(_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')][_0x7406d9]),'MailAccountId':Number(_0xe68371['params']['id'])});}}else{socket['emit'](_0x12cc('0xbe'),{'UserId':Number(_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')]),'MailAccountId':Number(_0xe68371['params']['id'])});}});}})[_0x12cc('0xd')](respondWithStatusCode(_0xba498c,null))[_0x12cc('0x15')](handleError(_0xba498c,null));};exports[_0x12cc('0xbf')]=function(_0x2f17b9,_0x3ceaaf){var _0x2cefc7={};var _0xc74312={};var _0x5e4320;var _0x36568e;return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x2f17b9[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x3ceaaf,null))[_0x12cc('0xd')](function(_0xfaa4ed){if(_0xfaa4ed){_0x5e4320=_0xfaa4ed;_0xc74312[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x85')][_0x12cc('0x59')]);_0xc74312['query']=_[_0x12cc('0x46')](_0x2f17b9[_0x12cc('0x45')]);_0xc74312['filters']=_[_0x12cc('0x48')](_0xc74312[_0x12cc('0x44')],_0xc74312[_0x12cc('0x45')]);_0x2cefc7[_0x12cc('0x49')]=_['intersection'](_0xc74312['model'],qs[_0x12cc('0x4a')](_0x2f17b9[_0x12cc('0x45')]['fields']));_0x2cefc7['attributes']=_0x2cefc7['attributes'][_0x12cc('0x4b')]?_0x2cefc7[_0x12cc('0x49')]:_0xc74312['model'];_0x2cefc7[_0x12cc('0x4e')]=qs['sort'](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x2cefc7[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_[_0x12cc('0x66')](_0x2f17b9[_0x12cc('0x45')],_0xc74312['filters']));if(_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x51')]){_0x2cefc7['where']=_[_0x12cc('0x52')](_0x2cefc7[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x2cefc7['attributes'],function(_0x1c39c0){var _0x36f1f5={};_0x36f1f5[_0x1c39c0]={'$like':'%'+_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x36f1f5;})});}_0x2cefc7=_[_0x12cc('0x52')]({},_0x2cefc7,_0x2f17b9[_0x12cc('0x5b')]);return _0x5e4320[_0x12cc('0xbf')](_0x2cefc7);}})[_0x12cc('0xd')](function(_0x532e98){if(_0x532e98){_0x36568e=_0x532e98['length'];if(!_0x2f17b9[_0x12cc('0x45')]['hasOwnProperty'](_0x12cc('0x4d'))){_0x2cefc7[_0x12cc('0x18')]=qs['limit'](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x18')]);_0x2cefc7[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x1a')]);}return _0x5e4320['getAgents'](_0x2cefc7);}})[_0x12cc('0xd')](function(_0x29afef){if(_0x29afef){return _0x29afef?{'count':_0x36568e,'rows':_0x29afef}:null;}})[_0x12cc('0xd')](respondWithResult(_0x3ceaaf,null))[_0x12cc('0x15')](handleError(_0x3ceaaf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0a53d93..cbeb0d8 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 _0x2a8e=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0x2bd20a,_0x53be0d){var _0x199a13=function(_0x58060f){while(--_0x58060f){_0x2bd20a['push'](_0x2bd20a['shift']());}};_0x199a13(++_0x53be0d);}(_0x2a8e,0x132));var _0xe2a8=function(_0x1d2cd5,_0x56dd51){_0x1d2cd5=_0x1d2cd5-0x0;var _0x12d99f=_0x2a8e[_0x1d2cd5];return _0x12d99f;};'use strict';var EventEmitter=require(_0xe2a8('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe2a8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe2a8('0x2')](0x0);var events={'afterCreate':_0xe2a8('0x3'),'afterUpdate':_0xe2a8('0x4'),'afterDestroy':_0xe2a8('0x5')};function emitEvent(_0x23bce4){return function(_0x35d881,_0x3331f3,_0x1baf49){MailAccountEvents['emit'](_0x23bce4+':'+_0x35d881['id'],_0x35d881);MailAccountEvents[_0xe2a8('0x6')](_0x23bce4,_0x35d881);_0x1baf49(null);};}for(var e in events){if(events[_0xe2a8('0x7')](e)){var event=events[e];MailAccount[_0xe2a8('0x8')](e,emitEvent(event));}}module[_0xe2a8('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xe829=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x249338,_0x361061){var _0x4ed489=function(_0x2ff360){while(--_0x2ff360){_0x249338['push'](_0x249338['shift']());}};_0x4ed489(++_0x361061);}(_0xe829,0xde));var _0x9e82=function(_0x3295b6,_0x1bc521){_0x3295b6=_0x3295b6-0x0;var _0x4e7914=_0xe829[_0x3295b6];return _0x4e7914;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9e82('0x0'))['db'][_0x9e82('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9e82('0x2')](0x0);var events={'afterCreate':_0x9e82('0x3'),'afterUpdate':_0x9e82('0x4'),'afterDestroy':_0x9e82('0x5')};function emitEvent(_0x487d2d){return function(_0xc8aec1,_0x19ece0,_0x4bd524){MailAccountEvents['emit'](_0x487d2d+':'+_0xc8aec1['id'],_0xc8aec1);MailAccountEvents['emit'](_0x487d2d,_0xc8aec1);_0x4bd524(null);};}for(var e in events){if(events[_0x9e82('0x6')](e)){var event=events[e];MailAccount[_0x9e82('0x7')](e,emitEvent(event));}}module[_0x9e82('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index cf72489..aee2f99 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 _0x62f9=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','./mailAccount.attributes','exports','define','mail_accounts','provider','service'];(function(_0x1fb99e,_0x6afedb){var _0x4b9b71=function(_0x28ba49){while(--_0x28ba49){_0x1fb99e['push'](_0x1fb99e['shift']());}};_0x4b9b71(++_0x6afedb);}(_0x62f9,0x190));var _0x962f=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x62f9[_0x511bd1];return _0x4c48ec;};'use strict';var attributes=require(_0x962f('0x0'));module[_0x962f('0x1')]=function(_0x384e89){return _0x384e89[_0x962f('0x2')]('MailAccount',attributes,{'tableName':_0x962f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x51b8d6=this;var _0x39fc1d={'id':_0x51b8d6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51b8d6[_0x962f('0x4')]!=='custom'){_0x39fc1d[_0x962f('0x5')]=_0x51b8d6[_0x962f('0x4')];}else{_0x39fc1d['host']=_0x51b8d6[_0x962f('0x6')]['host'];_0x39fc1d[_0x962f('0x7')]=_0x51b8d6[_0x962f('0x6')][_0x962f('0x7')];_0x39fc1d[_0x962f('0x8')]=_0x51b8d6[_0x962f('0x6')][_0x962f('0x8')];}if(_0x51b8d6[_0x962f('0x6')][_0x962f('0x9')]){if(_0x51b8d6[_0x962f('0x6')][_0x962f('0xa')]){if(!_0x51b8d6[_0x962f('0x6')][_0x962f('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x39fc1d['auth']={'type':_0x962f('0xc'),'user':_0x51b8d6[_0x962f('0x6')][_0x962f('0xd')],'accessToken':_0x51b8d6[_0x962f('0x6')][_0x962f('0xb')]['data5']};}else{_0x39fc1d['auth']={'user':_0x51b8d6['Smtp'][_0x962f('0xd')],'pass':_0x51b8d6[_0x962f('0x6')]['pass']};}}return _0x39fc1d;}}});}; \ No newline at end of file +var _0xb4ef=['OAuth2','user','./mailAccount.attributes','exports','define','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x5188fb,_0x4f2f72){var _0x538115=function(_0x230502){while(--_0x230502){_0x5188fb['push'](_0x5188fb['shift']());}};_0x538115(++_0x4f2f72);}(_0xb4ef,0x1a2));var _0xfb4e=function(_0x366799,_0x5c5e0e){_0x366799=_0x366799-0x0;var _0x3cd74d=_0xb4ef[_0x366799];return _0x3cd74d;};'use strict';var attributes=require(_0xfb4e('0x0'));module[_0xfb4e('0x1')]=function(_0xcd2b79){return _0xcd2b79[_0xfb4e('0x2')]('MailAccount',attributes,{'tableName':_0xfb4e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x384832=this;var _0x1291b7={'id':_0x384832['id'],'tls':{'rejectUnauthorized':![]}};if(_0x384832[_0xfb4e('0x4')]!=='custom'){_0x1291b7[_0xfb4e('0x5')]=_0x384832[_0xfb4e('0x4')];}else{_0x1291b7[_0xfb4e('0x6')]=_0x384832[_0xfb4e('0x7')]['host'];_0x1291b7[_0xfb4e('0x8')]=_0x384832[_0xfb4e('0x7')]['port'];_0x1291b7[_0xfb4e('0x9')]=_0x384832[_0xfb4e('0x7')][_0xfb4e('0x9')];}if(_0x384832['Smtp'][_0xfb4e('0xa')]){if(_0x384832[_0xfb4e('0x7')][_0xfb4e('0xb')]){if(!_0x384832[_0xfb4e('0x7')][_0xfb4e('0xc')])throw new Error(_0xfb4e('0xd'));_0x1291b7['auth']={'type':_0xfb4e('0xe'),'user':_0x384832[_0xfb4e('0x7')][_0xfb4e('0xf')],'accessToken':_0x384832[_0xfb4e('0x7')][_0xfb4e('0xc')]['data5']};}else{_0x1291b7['auth']={'user':_0x384832['Smtp']['user'],'pass':_0x384832['Smtp']['pass']};}}return _0x1291b7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f4a8353..d674dcb 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 _0x8958=['Applications','Smtp','CloudProvider','List','get','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','ListId','List\x20not\x20found','generate','messageId','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','bcc','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','moment','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','DESC','MailApplication'];(function(_0x5bf315,_0x194eaa){var _0x49b222=function(_0x33359c){while(--_0x33359c){_0x5bf315['push'](_0x5bf315['shift']());}};_0x49b222(++_0x194eaa);}(_0x8958,0x93));var _0x8895=function(_0x31aab1,_0x3ad60a){_0x31aab1=_0x31aab1-0x0;var _0x15b9a8=_0x8958[_0x31aab1];return _0x15b9a8;};'use strict';var _=require('lodash');var moment=require(_0x8895('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x8895('0x1'))('rpc');var config=require(_0x8895('0x2'));var jayson=require(_0x8895('0x3'));var client=jayson[_0x8895('0x4')]['http']({'port':0x232c});config[_0x8895('0x5')]=_[_0x8895('0x6')](config[_0x8895('0x5')],{'host':_0x8895('0x7'),'port':0x18eb});var socket=require(_0x8895('0x8'))(new Redis(config['redis']));require(_0x8895('0x9'))[_0x8895('0xa')](socket);function respondWithRpcPromise(_0x408d4b,_0x24fe49,_0x6eab1e){return new BPromise(function(_0x29c126,_0x22a12b){return client[_0x8895('0xb')](_0x408d4b,_0x6eab1e)[_0x8895('0xc')](function(_0x107d86){logger['info'](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));logger[_0x8895('0xf')](_0x8895('0x10'),_0x24fe49,_0x8895('0xe'),JSON[_0x8895('0x11')](_0x107d86));if(_0x107d86['error']){if(_0x107d86[_0x8895('0x12')][_0x8895('0x13')]===0x1f4){logger[_0x8895('0x12')]('MailAccount,\x20%s,\x20%s',_0x24fe49,_0x107d86['error'][_0x8895('0x14')]);return _0x22a12b(_0x107d86['error'][_0x8895('0x14')]);}logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x107d86[_0x8895('0x12')][_0x8895('0x14')]);return _0x29c126(_0x107d86['error'][_0x8895('0x14')]);}else{logger[_0x8895('0x15')](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));_0x29c126(_0x107d86[_0x8895('0x16')][_0x8895('0x14')]);}})[_0x8895('0x17')](function(_0x26cee0){logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x26cee0);_0x22a12b(_0x26cee0);});});}exports[_0x8895('0x18')]=function(_0x6b8a16){var _0x2df795=this;return new Promise(function(_0x54e6d4,_0x522a4e){return db['MailAccount'][_0x8895('0x19')]({'raw':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1b')]===undefined?!![]:![]:!![],'where':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options'][_0x8895('0x1d')]||null:null,'limit':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1e')]||null:null,'include':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options']['include']?_[_0x8895('0x1f')](_0x6b8a16[_0x8895('0x1a')][_0x8895('0x20')],function(_0x24a376){return{'model':db[_0x24a376['model']],'as':_0x24a376['as'],'attributes':_0x24a376[_0x8895('0x1d')],'include':_0x24a376[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x24a376['include'],function(_0x4aee03){return{'model':db[_0x4aee03[_0x8895('0x21')]],'as':_0x4aee03['as'],'attributes':_0x4aee03['attributes'],'include':_0x4aee03[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x4aee03[_0x8895('0x20')],function(_0xf5fb66){return{'model':db[_0xf5fb66[_0x8895('0x21')]],'as':_0xf5fb66['as'],'attributes':_0xf5fb66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6e449d){logger[_0x8895('0x15')](_0x8895('0x18'),_0x6b8a16);logger[_0x8895('0xf')](_0x8895('0x18'),_0x6b8a16,JSON['stringify'](_0x6e449d));_0x54e6d4(_0x6e449d);})['catch'](function(_0x46ae32){logger[_0x8895('0x12')](_0x8895('0x18'),_0x46ae32[_0x8895('0x14')],_0x6b8a16);_0x522a4e(_0x2df795[_0x8895('0x12')](0x1f4,_0x46ae32['message']));});});};exports[_0x8895('0x22')]=function(_0x5d2f33){var _0x3f055a=this;return new Promise(function(_0x5b2b19,_0x40ba14){return db[_0x8895('0x23')][_0x8895('0x24')]({'raw':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['attributes']||null:null,'include':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33['options'][_0x8895('0x20')]?_['map'](_0x5d2f33[_0x8895('0x1a')][_0x8895('0x20')],function(_0x20907a){return{'model':db[_0x20907a[_0x8895('0x21')]],'as':_0x20907a['as'],'attributes':_0x20907a[_0x8895('0x1d')],'include':_0x20907a['include']?_[_0x8895('0x1f')](_0x20907a['include'],function(_0x57f58a){return{'model':db[_0x57f58a[_0x8895('0x21')]],'as':_0x57f58a['as'],'attributes':_0x57f58a[_0x8895('0x1d')],'include':_0x57f58a[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x57f58a[_0x8895('0x20')],function(_0x4b7fe0){return{'model':db[_0x4b7fe0[_0x8895('0x21')]],'as':_0x4b7fe0['as'],'attributes':_0x4b7fe0[_0x8895('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2557fc){if(_0x5d2f33['options'][_0x8895('0x25')]===!![])_0x2557fc[_0x8895('0x26')]('smtpOptions',_0x2557fc[_0x8895('0x27')]());logger[_0x8895('0x15')]('ShowMailAccount',_0x5d2f33);logger['debug'](_0x8895('0x22'),_0x5d2f33,JSON[_0x8895('0x11')](_0x2557fc));_0x5b2b19(_0x2557fc);})[_0x8895('0x17')](function(_0x331a9e){logger[_0x8895('0x12')]('ShowMailAccount',_0x331a9e[_0x8895('0x14')],_0x5d2f33);_0x40ba14(_0x3f055a[_0x8895('0x12')](0x1f4,_0x331a9e[_0x8895('0x14')]));});});};exports[_0x8895('0x28')]=function(_0x1d9e26){var _0x534876=this;return new Promise(function(_0x4a7e22,_0x174be1){var _0x5ebfc4={'body':_0x1d9e26[_0x8895('0x29')],'channel':_0x8895('0x2a')};var _0x526d90=_[_0x8895('0x2b')](_['keys'](db[_0x8895('0x2c')]['rawAttributes']),['createdAt','updatedAt','CompanyId','ListId']);var _0x47cf10=![];if(_0x1d9e26[_0x8895('0x29')]['id']){delete _0x1d9e26[_0x8895('0x29')]['id'];}if(_['isNil'](_0x1d9e26['body'][_0x8895('0x2d')])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8895('0x2e')](_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')])||_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')]===''){return _0x174be1(_0x534876['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x2f')+_0x526d90));}if(!_[_0x8895('0x30')](_0x526d90,_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x31')+_0x526d90));}var _0x3413cd={};_0x3413cd[_0x1d9e26[_0x8895('0x29')][_0x8895('0x32')]]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x23')]['find']({'where':{'id':_0x1d9e26[_0x8895('0x33')]['id']},'include':[{'model':db[_0x8895('0x34')],'as':'List','include':[{'model':db[_0x8895('0x2c')],'as':'Contacts','where':_0x3413cd,'limit':0x1,'order':[['updatedAt',_0x8895('0x35')]]}]},{'model':db[_0x8895('0x36')],'as':_0x8895('0x37')},{'model':db['MailServerOut'],'as':_0x8895('0x38'),'include':[{'model':db['CloudProvider'],'as':_0x8895('0x39')}]}]})[_0x8895('0xc')](function(_0xb3ecd6){if(_0xb3ecd6&&_0xb3ecd6[_0x8895('0x3a')]){var _0x2f3bf1=_0xb3ecd6[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x33')]=_['omit'](_0x2f3bf1,['Applications',_0x8895('0x3a')]);_0x5ebfc4[_0x8895('0x33')]['smtpOptions']=_0xb3ecd6[_0x8895('0x27')]();_0x5ebfc4['applications']=_0x2f3bf1['Applications'];_0x5ebfc4[_0x8895('0x3c')]=_0x2f3bf1['List'];_0x5ebfc4[_0x8895('0x3d')]=_[_0x8895('0x3e')](_0x5ebfc4[_0x8895('0x3d')],[_0x8895('0x3f')],[_0x8895('0x40')]);if(_0x5ebfc4[_0x8895('0x33')]&&_0x5ebfc4[_0x8895('0x33')][_0x8895('0x41')]){_0x5ebfc4['applications'][_0x8895('0x42')]({'id':0x0,'priority':_0x5ebfc4[_0x8895('0x3d')][_0x8895('0x43')]+0x1,'app':'close','appdata':_0x8895('0x41'),'interval':_0x8895('0x44')});}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')];}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')];}if(_0x2f3bf1['List'][_0x8895('0x45')][_0x8895('0x43')]){return _0x2f3bf1[_0x8895('0x3a')][_0x8895('0x45')][0x0];}var _0x3c8a97=_['defaults'](_0x1d9e26[_0x8895('0x29')],{'firstName':_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')],'ListId':_0x2f3bf1[_0x8895('0x46')]});_0x3c8a97[_0x1d9e26[_0x8895('0x29')]['mapKey']]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x2c')]['create'](_0x3c8a97);}else{throw new Error(_0x8895('0x47'));}})[_0x8895('0xc')](function(_0x2c777b){_0x5ebfc4['contact']=_0x2c777b;if(_0x2c777b){if(!_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']){_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']=rs[_0x8895('0x48')]()+'\x20'+_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x2d')];}var _0x545f13={'ContactId':_0x2c777b['id'],'MailAccountId':_0x1d9e26['account']['id'],'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x2d')],'cc':_0x1d9e26['body'][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4b')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x8895('0x4c')][_0x8895('0x24')]({'where':{'closed':![],'MailAccountId':_0x1d9e26['account']['id']},'include':[{'model':db[_0x8895('0x4d')],'as':_0x8895('0x4e'),'attributes':[_0x8895('0x49')],'where':{'messageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4f')]}}]})[_0x8895('0xc')](function(_0x1b1bc0){if(_0x1b1bc0){return[_0x1b1bc0,![]];}return db[_0x8895('0x4c')][_0x8895('0x50')](_0x545f13)[_0x8895('0xc')](function(_0x261d4b){return[_0x261d4b,!![]];});});}else{throw new Error(_0x8895('0x51'));}})[_0x8895('0x52')](function(_0x21c7bb,_0xb903d8){if(_0x21c7bb){_0x47cf10=_0xb903d8;if(!_0xb903d8){return _0x21c7bb[_0x8895('0x53')]({'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body']['message']['from'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x21c7bb['attach']?_0x21c7bb[_0x8895('0x4b')]:_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4b')],'substatus':null,'substatusAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgDirection':'in'});}else{return _0x21c7bb;}}})['then'](function(_0x6440ea){_0x5ebfc4[_0x8895('0x56')]=_0x6440ea[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x56')][_0x8895('0x57')]=_0x47cf10;return db[_0x8895('0x4d')][_0x8895('0x50')]({'body':_0x1d9e26['body'][_0x8895('0x29')],'MailAccountId':_0x1d9e26[_0x8895('0x33')]['id'],'MailInteractionId':_0x6440ea['id'],'direction':'in','ContactId':_0x5ebfc4['contact']['id'],'messageId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'from':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['from'],'to':_0x1d9e26[_0x8895('0x29')]['message']['to'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['attach'],'Attachments':_0x1d9e26[_0x8895('0x29')]['message']['attachments'],'originTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x58')],'originCc':_0x1d9e26['body'][_0x8895('0x14')]['originCc'],'bcc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x59')],'ChatWebsiteId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['ChatWebsiteId']||null,'originChannel':_0x1d9e26['body'][_0x8895('0x14')]['originChannel']||_0x8895('0x5a'),'ChatOfflineMessageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x5b')]||null},{'include':[{'model':db[_0x8895('0x5c')],'as':_0x8895('0x5d')}]});})[_0x8895('0xc')](function(_0x166e9a){_0x5ebfc4['message']=_0x166e9a;if(!_0x5ebfc4[_0x8895('0x56')]['UserId']){return;}return db['User'][_0x8895('0x24')]({'attributes':['id','name'],'where':{'id':_0x5ebfc4[_0x8895('0x56')][_0x8895('0x5e')]}});})[_0x8895('0xc')](function(_0x39f5e5){if(_0x39f5e5){_0x5ebfc4['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x39f5e5[_0x8895('0x5f')]+','+(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x60')]||0xa),'interval':_0x8895('0x44')});}if(!_0x5ebfc4[_0x8895('0x56')][_0x8895('0x61')]){return;}return db['MailQueue'][_0x8895('0x24')]({'attributes':['id',_0x8895('0x5f')],'where':{'id':_0x5ebfc4[_0x8895('0x56')]['queueId']}});})[_0x8895('0xc')](function(_0x565bb8){if(_0x565bb8){_0x5ebfc4[_0x8895('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8895('0x62'),'appdata':_0x565bb8[_0x8895('0x5f')]+','+(_0x5ebfc4['account'][_0x8895('0x63')]||0x12c),'interval':_0x8895('0x44')});}return respondWithRpcPromise('Start',_0x8895('0x64'),_0x5ebfc4);})[_0x8895('0xc')](function(_0x2af98f){_0x4a7e22(_0x2af98f);})[_0x8895('0x17')](function(_0x214730){_0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x214730[_0x8895('0x14')]));});});}; \ No newline at end of file +var _0x1670=['priority','asc','push','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','subject','attach','interaction','get','created','attachments','originTo','originCc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','catch','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','Applications','MailServerOut','account','omit','list','applications','orderBy'];(function(_0x1a7957,_0x19cd9b){var _0x57493e=function(_0xbf9e27){while(--_0xbf9e27){_0x1a7957['push'](_0x1a7957['shift']());}};_0x57493e(++_0x19cd9b);}(_0x1670,0x9a));var _0x0167=function(_0x40225e,_0x5c981a){_0x40225e=_0x40225e-0x0;var _0x326c2b=_0x1670[_0x40225e];return _0x326c2b;};'use strict';var _=require(_0x0167('0x0'));var moment=require(_0x0167('0x1'));var BPromise=require('bluebird');var rs=require(_0x0167('0x2'));var Redis=require('ioredis');var db=require(_0x0167('0x3'))['db'];var logger=require(_0x0167('0x4'))(_0x0167('0x5'));var config=require(_0x0167('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0167('0x7')]({'port':0x232c});config[_0x0167('0x8')]=_[_0x0167('0x9')](config[_0x0167('0x8')],{'host':_0x0167('0xa'),'port':0x18eb});var socket=require(_0x0167('0xb'))(new Redis(config[_0x0167('0x8')]));require(_0x0167('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c6b78,_0x146dad,_0x178f5f){return new BPromise(function(_0x2b88ec,_0x1632d4){return client[_0x0167('0xd')](_0x4c6b78,_0x178f5f)[_0x0167('0xe')](function(_0x2257a8){logger[_0x0167('0xf')](_0x0167('0x10'),_0x146dad,_0x0167('0x11'));logger[_0x0167('0x12')](_0x0167('0x13'),_0x146dad,_0x0167('0x11'),JSON[_0x0167('0x14')](_0x2257a8));if(_0x2257a8['error']){if(_0x2257a8[_0x0167('0x15')]['code']===0x1f4){logger[_0x0167('0x15')]('MailAccount,\x20%s,\x20%s',_0x146dad,_0x2257a8[_0x0167('0x15')][_0x0167('0x16')]);return _0x1632d4(_0x2257a8[_0x0167('0x15')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x146dad,_0x2257a8[_0x0167('0x15')][_0x0167('0x16')]);return _0x2b88ec(_0x2257a8['error'][_0x0167('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x146dad,_0x0167('0x11'));_0x2b88ec(_0x2257a8['result'][_0x0167('0x16')]);}})['catch'](function(_0x16094a){logger[_0x0167('0x15')](_0x0167('0x10'),_0x146dad,_0x16094a);_0x1632d4(_0x16094a);});});}exports[_0x0167('0x17')]=function(_0xc3f9fe){var _0x45dfe1=this;return new Promise(function(_0xa384d9,_0x3cd14f){return db[_0x0167('0x18')][_0x0167('0x19')]({'raw':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1b')]||null:null,'attributes':_0xc3f9fe['options']?_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1c')]||null:null,'limit':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')]['limit']||null:null,'include':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe['options'][_0x0167('0x1d')]?_[_0x0167('0x1e')](_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1d')],function(_0x46231b){return{'model':db[_0x46231b[_0x0167('0x1f')]],'as':_0x46231b['as'],'attributes':_0x46231b[_0x0167('0x1c')],'include':_0x46231b['include']?_[_0x0167('0x1e')](_0x46231b[_0x0167('0x1d')],function(_0x23a863){return{'model':db[_0x23a863['model']],'as':_0x23a863['as'],'attributes':_0x23a863[_0x0167('0x1c')],'include':_0x23a863[_0x0167('0x1d')]?_['map'](_0x23a863[_0x0167('0x1d')],function(_0x3f4071){return{'model':db[_0x3f4071['model']],'as':_0x3f4071['as'],'attributes':_0x3f4071[_0x0167('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0167('0xe')](function(_0x4179d4){logger['info'](_0x0167('0x17'),_0xc3f9fe);logger[_0x0167('0x12')]('GetMailAccount',_0xc3f9fe,JSON['stringify'](_0x4179d4));_0xa384d9(_0x4179d4);})[_0x0167('0x20')](function(_0x124763){logger[_0x0167('0x15')](_0x0167('0x17'),_0x124763['message'],_0xc3f9fe);_0x3cd14f(_0x45dfe1['error'](0x1f4,_0x124763[_0x0167('0x16')]));});});};exports['ShowMailAccount']=function(_0x4b42a2){var _0x4a4b87=this;return new Promise(function(_0x10fd32,_0x178803){return db[_0x0167('0x18')][_0x0167('0x21')]({'raw':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2[_0x0167('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b42a2['options']?_0x4b42a2[_0x0167('0x1a')][_0x0167('0x1b')]||null:null,'attributes':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2[_0x0167('0x1a')][_0x0167('0x1c')]||null:null,'include':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2['options'][_0x0167('0x1d')]?_['map'](_0x4b42a2['options'][_0x0167('0x1d')],function(_0x140130){return{'model':db[_0x140130[_0x0167('0x1f')]],'as':_0x140130['as'],'attributes':_0x140130['attributes'],'include':_0x140130[_0x0167('0x1d')]?_[_0x0167('0x1e')](_0x140130[_0x0167('0x1d')],function(_0xb0cc5c){return{'model':db[_0xb0cc5c['model']],'as':_0xb0cc5c['as'],'attributes':_0xb0cc5c[_0x0167('0x1c')],'include':_0xb0cc5c[_0x0167('0x1d')]?_[_0x0167('0x1e')](_0xb0cc5c['include'],function(_0x2ba723){return{'model':db[_0x2ba723[_0x0167('0x1f')]],'as':_0x2ba723['as'],'attributes':_0x2ba723[_0x0167('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0167('0xe')](function(_0x3abff6){if(_0x4b42a2['options'][_0x0167('0x22')]===!![])_0x3abff6[_0x0167('0x23')]('smtpOptions',_0x3abff6[_0x0167('0x24')]());logger[_0x0167('0xf')](_0x0167('0x25'),_0x4b42a2);logger[_0x0167('0x12')](_0x0167('0x25'),_0x4b42a2,JSON[_0x0167('0x14')](_0x3abff6));_0x10fd32(_0x3abff6);})['catch'](function(_0x298bcc){logger[_0x0167('0x15')](_0x0167('0x25'),_0x298bcc[_0x0167('0x16')],_0x4b42a2);_0x178803(_0x4a4b87['error'](0x1f4,_0x298bcc[_0x0167('0x16')]));});});};exports[_0x0167('0x26')]=function(_0x599caf){var _0x18de15=this;return new Promise(function(_0x3c393a,_0x3a22f7){var _0x4aec07={'body':_0x599caf[_0x0167('0x27')],'channel':_0x0167('0x28')};var _0x2b56d6=_[_0x0167('0x29')](_[_0x0167('0x2a')](db[_0x0167('0x2b')][_0x0167('0x2c')]),[_0x0167('0x2d'),'updatedAt',_0x0167('0x2e'),'ListId']);var _0x45f0d5=![];if(_0x599caf[_0x0167('0x27')]['id']){delete _0x599caf[_0x0167('0x27')]['id'];}if(_['isNil'](_0x599caf['body']['from'])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x2f')));}if(_[_0x0167('0x30')](_0x599caf[_0x0167('0x27')][_0x0167('0x27')])||_0x599caf[_0x0167('0x27')]['body']===''){return _0x3a22f7(_0x18de15['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0167('0x30')](_0x599caf['body'][_0x0167('0x31')])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x32')+_0x2b56d6));}if(!_[_0x0167('0x33')](_0x2b56d6,_0x599caf['body'][_0x0167('0x31')])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x34')+_0x2b56d6));}var _0x431cb7={};_0x431cb7[_0x599caf[_0x0167('0x27')][_0x0167('0x31')]]=_0x599caf[_0x0167('0x27')][_0x0167('0x35')];return db[_0x0167('0x18')][_0x0167('0x21')]({'where':{'id':_0x599caf['account']['id']},'include':[{'model':db['CmList'],'as':_0x0167('0x36'),'include':[{'model':db['CmContact'],'as':_0x0167('0x37'),'where':_0x431cb7,'limit':0x1,'order':[['updatedAt',_0x0167('0x38')]]}]},{'model':db['MailApplication'],'as':_0x0167('0x39')},{'model':db[_0x0167('0x3a')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x0167('0xe')](function(_0x55aaa0){if(_0x55aaa0&&_0x55aaa0['List']){var _0x18d29d=_0x55aaa0['get']({'plain':!![]});_0x4aec07[_0x0167('0x3b')]=_[_0x0167('0x3c')](_0x18d29d,[_0x0167('0x39'),'List']);_0x4aec07[_0x0167('0x3b')]['smtpOptions']=_0x55aaa0['getSmtpOptions']();_0x4aec07['applications']=_0x18d29d[_0x0167('0x39')];_0x4aec07[_0x0167('0x3d')]=_0x18d29d[_0x0167('0x36')];_0x4aec07[_0x0167('0x3e')]=_[_0x0167('0x3f')](_0x4aec07['applications'],[_0x0167('0x40')],[_0x0167('0x41')]);if(_0x4aec07[_0x0167('0x3b')]&&_0x4aec07[_0x0167('0x3b')]['autoclose']){_0x4aec07['applications'][_0x0167('0x42')]({'id':0x0,'priority':_0x4aec07['applications'][_0x0167('0x43')]+0x1,'app':_0x0167('0x44'),'appdata':_0x0167('0x45'),'interval':_0x0167('0x46')});}if(_0x4aec07[_0x0167('0x3b')][_0x0167('0x39')]){delete _0x4aec07[_0x0167('0x3b')][_0x0167('0x39')];}if(_0x4aec07[_0x0167('0x3b')][_0x0167('0x36')]){delete _0x4aec07['account']['List'];}if(_0x18d29d[_0x0167('0x36')]['Contacts'][_0x0167('0x43')]){return _0x18d29d[_0x0167('0x36')]['Contacts'][0x0];}var _0xb31427=_[_0x0167('0x9')](_0x599caf['body'],{'firstName':_0x599caf[_0x0167('0x27')][_0x0167('0x35')],'ListId':_0x18d29d[_0x0167('0x47')]});_0xb31427[_0x599caf[_0x0167('0x27')]['mapKey']]=_0x599caf[_0x0167('0x27')][_0x0167('0x35')];return db[_0x0167('0x2b')]['create'](_0xb31427);}else{throw new Error(_0x0167('0x48'));}})[_0x0167('0xe')](function(_0x423af6){_0x4aec07[_0x0167('0x49')]=_0x423af6;if(_0x423af6){if(!_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x4a')]){_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['messageId']=rs[_0x0167('0x4b')]()+'\x20'+_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x35')];}var _0x15a544={'ContactId':_0x423af6['id'],'MailAccountId':_0x599caf[_0x0167('0x3b')]['id'],'inReplyTo':_0x599caf['body'][_0x0167('0x16')]['messageId'],'to':_0x599caf['body']['message'][_0x0167('0x35')],'cc':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['cc'],'subject':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['subject'],'attach':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['attach'],'lastMsgAt':moment()[_0x0167('0x4c')](_0x0167('0x4d')),'lastMsgDirection':'in'};return db[_0x0167('0x4e')][_0x0167('0x21')]({'where':{'closed':![],'MailAccountId':_0x599caf['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x0167('0x4f'),'attributes':[_0x0167('0x4a')],'where':{'messageId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x50')]}}]})[_0x0167('0xe')](function(_0x8af33d){if(_0x8af33d){return[_0x8af33d,![]];}return db[_0x0167('0x4e')][_0x0167('0x51')](_0x15a544)[_0x0167('0xe')](function(_0x5ed240){return[_0x5ed240,!![]];});});}else{throw new Error(_0x0167('0x52'));}})[_0x0167('0x53')](function(_0x44fd93,_0x3cd485){if(_0x44fd93){_0x45f0d5=_0x3cd485;if(!_0x3cd485){return _0x44fd93[_0x0167('0x54')]({'inReplyTo':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['messageId'],'to':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['from'],'cc':_0x599caf[_0x0167('0x27')]['message']['cc'],'subject':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x55')],'attach':_0x44fd93['attach']?_0x44fd93[_0x0167('0x56')]:_0x599caf[_0x0167('0x27')]['message'][_0x0167('0x56')],'substatus':null,'substatusAt':moment()['format'](_0x0167('0x4d')),'lastMsgAt':moment()['format'](_0x0167('0x4d')),'lastMsgDirection':'in'});}else{return _0x44fd93;}}})[_0x0167('0xe')](function(_0x50b6e9){_0x4aec07[_0x0167('0x57')]=_0x50b6e9[_0x0167('0x58')]({'plain':!![]});_0x4aec07[_0x0167('0x57')][_0x0167('0x59')]=_0x45f0d5;return db['MailMessage']['create']({'body':_0x599caf[_0x0167('0x27')][_0x0167('0x27')],'MailAccountId':_0x599caf[_0x0167('0x3b')]['id'],'MailInteractionId':_0x50b6e9['id'],'direction':'in','ContactId':_0x4aec07[_0x0167('0x49')]['id'],'messageId':_0x599caf['body'][_0x0167('0x16')]['messageId'],'from':_0x599caf[_0x0167('0x27')]['message']['from'],'to':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['to'],'cc':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['cc'],'subject':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x55')],'attach':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x56')],'Attachments':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x5a')],'originTo':_0x599caf[_0x0167('0x27')]['message'][_0x0167('0x5b')],'originCc':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x5c')],'bcc':_0x599caf['body']['message']['bcc'],'ChatWebsiteId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['ChatWebsiteId']||null,'originChannel':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x5d')]||'Email','ChatOfflineMessageId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x5e')]||null},{'include':[{'model':db[_0x0167('0x5f')],'as':_0x0167('0x60')}]});})[_0x0167('0xe')](function(_0x54a216){_0x4aec07[_0x0167('0x16')]=_0x54a216;if(!_0x4aec07[_0x0167('0x57')]['UserId']){return;}return db[_0x0167('0x61')][_0x0167('0x21')]({'attributes':['id',_0x0167('0x62')],'where':{'id':_0x4aec07[_0x0167('0x57')][_0x0167('0x63')]}});})['then'](function(_0x52bed0){if(_0x52bed0){_0x4aec07['applications'][_0x0167('0x64')]({'id':0x0,'priority':0x0,'app':_0x0167('0x65'),'appdata':_0x52bed0[_0x0167('0x62')]+','+(_0x4aec07[_0x0167('0x3b')][_0x0167('0x66')]||0xa),'interval':'*,*,*,*'});}if(!_0x4aec07[_0x0167('0x57')][_0x0167('0x67')]){return;}return db[_0x0167('0x68')][_0x0167('0x21')]({'attributes':['id',_0x0167('0x62')],'where':{'id':_0x4aec07[_0x0167('0x57')]['queueId']}});})['then'](function(_0x1690ff){if(_0x1690ff){_0x4aec07[_0x0167('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0167('0x69'),'appdata':_0x1690ff[_0x0167('0x62')]+','+(_0x4aec07[_0x0167('0x3b')][_0x0167('0x6a')]||0x12c),'interval':_0x0167('0x46')});}return respondWithRpcPromise(_0x0167('0x6b'),_0x0167('0x6c'),_0x4aec07);})[_0x0167('0xe')](function(_0x4ba0c4){_0x3c393a(_0x4ba0c4);})[_0x0167('0x20')](function(_0x1c3cb2){_0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x1c3cb2[_0x0167('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 34c5083..8383866 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 _0xa849=['register','mailAccount:','./mailAccount.events','save','remove','emit','removeListener'];(function(_0x107eae,_0x1fe7bf){var _0x4851f5=function(_0x3840b3){while(--_0x3840b3){_0x107eae['push'](_0x107eae['shift']());}};_0x4851f5(++_0x1fe7bf);}(_0xa849,0x175));var _0x9a84=function(_0x22a95e,_0x535e9d){_0x22a95e=_0x22a95e-0x0;var _0x271f14=_0xa849[_0x22a95e];return _0x271f14;};'use strict';var MailAccountEvents=require(_0x9a84('0x0'));var events=[_0x9a84('0x1'),_0x9a84('0x2'),'update'];function createListener(_0x10b62e,_0x413198){return function(_0x538ea3){_0x413198[_0x9a84('0x3')](_0x10b62e,_0x538ea3);};}function removeListener(_0x43ebb8,_0x229601){return function(){MailAccountEvents[_0x9a84('0x4')](_0x43ebb8,_0x229601);};}exports[_0x9a84('0x5')]=function(_0x2ba3b2){for(var _0x15bea3=0x0,_0x2f5685=events['length'];_0x15bea3<_0x2f5685;_0x15bea3++){var _0x305fdb=events[_0x15bea3];var _0x9e4193=createListener(_0x9a84('0x6')+_0x305fdb,_0x2ba3b2);MailAccountEvents['on'](_0x305fdb,_0x9e4193);}}; \ No newline at end of file +var _0xb65a=['./mailAccount.events','update','removeListener','mailAccount:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb65a,0x114));var _0xab65=function(_0x3edcf7,_0x12f8f0){_0x3edcf7=_0x3edcf7-0x0;var _0x4d1519=_0xb65a[_0x3edcf7];return _0x4d1519;};'use strict';var MailAccountEvents=require(_0xab65('0x0'));var events=['save','remove',_0xab65('0x1')];function createListener(_0xfd7fe6,_0x1c1c2f){return function(_0x50534e){_0x1c1c2f['emit'](_0xfd7fe6,_0x50534e);};}function removeListener(_0x6ba738,_0x39447c){return function(){MailAccountEvents[_0xab65('0x2')](_0x6ba738,_0x39447c);};}exports['register']=function(_0x1bda21){for(var _0x4dabba=0x0,_0x59e069=events['length'];_0x4dabba<_0x59e069;_0x4dabba++){var _0x2d1cf1=events[_0x4dabba];var _0x2c3f48=createListener(_0xab65('0x3')+_0x2d1cf1,_0x1bda21);MailAccountEvents['on'](_0x2d1cf1,_0x2c3f48);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f164ef7..6263142 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 _0x332b=['put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x373a71,_0x2fafb4){var _0x2990fc=function(_0xee820a){while(--_0xee820a){_0x373a71['push'](_0x373a71['shift']());}};_0x2990fc(++_0x2fafb4);}(_0x332b,0x111));var _0xb332=function(_0xbc1061,_0x4df02e){_0xbc1061=_0xbc1061-0x0;var _0x2e5a0b=_0x332b[_0xbc1061];return _0x2e5a0b;};'use strict';var multer=require(_0xb332('0x0'));var util=require('util');var path=require(_0xb332('0x1'));var timeout=require('connect-timeout');var express=require(_0xb332('0x2'));var router=express[_0xb332('0x3')]();var fs_extra=require(_0xb332('0x4'));var auth=require(_0xb332('0x5'));var interaction=require(_0xb332('0x6'));var config=require(_0xb332('0x7'));var controller=require('./mailApplication.controller');router[_0xb332('0x8')](_0xb332('0x9'),auth[_0xb332('0xa')](),controller[_0xb332('0xb')]);router[_0xb332('0xc')](_0xb332('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb332('0xa')](),controller[_0xb332('0xd')]);module[_0xb332('0xe')]=router; \ No newline at end of file +var _0x9a83=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','show','put','isAuthenticated','update','delete'];(function(_0x3be12f,_0x437488){var _0x1a16d9=function(_0x572600){while(--_0x572600){_0x3be12f['push'](_0x3be12f['shift']());}};_0x1a16d9(++_0x437488);}(_0x9a83,0x152));var _0x39a8=function(_0x1440ce,_0x136aee){_0x1440ce=_0x1440ce-0x0;var _0x389c35=_0x9a83[_0x1440ce];return _0x389c35;};'use strict';var multer=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var path=require('path');var timeout=require(_0x39a8('0x2'));var express=require(_0x39a8('0x3'));var router=express[_0x39a8('0x4')]();var fs_extra=require(_0x39a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x39a8('0x6'));var config=require(_0x39a8('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x39a8('0x8'),auth['isAuthenticated'](),controller[_0x39a8('0x9')]);router[_0x39a8('0xa')](_0x39a8('0x8'),auth[_0x39a8('0xb')](),controller[_0x39a8('0xc')]);router[_0x39a8('0xd')](_0x39a8('0x8'),auth[_0x39a8('0xb')](),controller[_0x39a8('0xe')]);module[_0x39a8('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6808bcb..649f2dd 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 _0x9ccb=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9ccb,0xf5));var _0xb9cc=function(_0x49e734,_0xc04f4f){_0x49e734=_0x49e734-0x0;var _0x2a2d42=_0x9ccb[_0x49e734];return _0x2a2d42;};'use strict';var Sequelize=require('sequelize');module[_0xb9cc('0x0')]={'priority':{'type':Sequelize[_0xb9cc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb9cc('0x2')],'allowNull':![],'defaultValue':_0xb9cc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb9cc('0x2')]},'interval':{'type':Sequelize[_0xb9cc('0x2')],'defaultValue':_0xb9cc('0x4')}}; \ No newline at end of file +var _0xe00e=['*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x4333c0,_0x1b8b7d){var _0x1ea60b=function(_0x36a1ea){while(--_0x36a1ea){_0x4333c0['push'](_0x4333c0['shift']());}};_0x1ea60b(++_0x1b8b7d);}(_0xe00e,0x65));var _0xee00=function(_0x3e4712,_0x2a8be3){_0x3e4712=_0x3e4712-0x0;var _0x240683=_0xe00e[_0x3e4712];return _0x240683;};'use strict';var Sequelize=require(_0xee00('0x0'));module[_0xee00('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xee00('0x2')},'appdata':{'type':Sequelize[_0xee00('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee00('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ad3aa88..6146aed 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x564cc6,_0x4cec54){var _0x2679f2=function(_0x1ce7e5){while(--_0x1ce7e5){_0x564cc6['push'](_0x564cc6['shift']());}};_0x2679f2(++_0x4cec54);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xcb91[_0x3b0912];return _0xa8f339;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x535e1e,_0x2b3930){var _0x5161d2=function(_0x4296ba){while(--_0x4296ba){_0x535e1e['push'](_0x535e1e['shift']());}};_0x5161d2(++_0x2b3930);}(_0x70e0,0x17b));var _0x070e=function(_0x73d5a3,_0x18012d){_0x73d5a3=_0x73d5a3-0x0;var _0x560ac1=_0x70e0[_0x73d5a3];return _0x560ac1;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 171ef1c..a00acad 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 _0x7d42=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x303984,_0x2bacfc){var _0x4a07fe=function(_0x1fc900){while(--_0x1fc900){_0x303984['push'](_0x303984['shift']());}};_0x4a07fe(++_0x2bacfc);}(_0x7d42,0x129));var _0x27d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d42[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x27d4('0x0'));var util=require(_0x27d4('0x1'));var logger=require(_0x27d4('0x2'))(_0x27d4('0x3'));var moment=require(_0x27d4('0x4'));var BPromise=require(_0x27d4('0x5'));var rp=require(_0x27d4('0x6'));var fs=require('fs');var path=require(_0x27d4('0x7'));var rimraf=require(_0x27d4('0x8'));var config=require(_0x27d4('0x9'));var attributes=require(_0x27d4('0xa'));module[_0x27d4('0xb')]=function(_0x566ec7,_0x3407fb){return _0x566ec7[_0x27d4('0xc')](_0x27d4('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x27d4('0xe'),'collate':_0x27d4('0xf')});}; \ No newline at end of file +var _0x53a4=['MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x53a4,0x1bd));var _0x453a=function(_0x161ddd,_0x4f9795){_0x161ddd=_0x161ddd-0x0;var _0x1fce41=_0x53a4[_0x161ddd];return _0x1fce41;};'use strict';var _=require(_0x453a('0x0'));var util=require(_0x453a('0x1'));var logger=require(_0x453a('0x2'))(_0x453a('0x3'));var moment=require('moment');var BPromise=require(_0x453a('0x4'));var rp=require(_0x453a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x453a('0x6'));var config=require(_0x453a('0x7'));var attributes=require(_0x453a('0x8'));module[_0x453a('0x9')]=function(_0x40dd8,_0x347f34){return _0x40dd8['define'](_0x453a('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x453a('0xb'),'collate':_0x453a('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 81b6a8a..b6dab68 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 _0xc0b1=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateMailApplication','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s'];(function(_0x253113,_0x278426){var _0x578c99=function(_0x2d73dd){while(--_0x2d73dd){_0x253113['push'](_0x253113['shift']());}};_0x578c99(++_0x278426);}(_0xc0b1,0x1b3));var _0x1c0b=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0xc0b1[_0x3e3f27];return _0x15c868;};'use strict';var _=require('lodash');var util=require(_0x1c0b('0x0'));var moment=require(_0x1c0b('0x1'));var BPromise=require(_0x1c0b('0x2'));var rs=require(_0x1c0b('0x3'));var fs=require('fs');var Redis=require(_0x1c0b('0x4'));var db=require(_0x1c0b('0x5'))['db'];var utils=require(_0x1c0b('0x6'));var logger=require('../../config/logger')(_0x1c0b('0x7'));var config=require(_0x1c0b('0x8'));var jayson=require(_0x1c0b('0x9'));var client=jayson[_0x1c0b('0xa')][_0x1c0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48debe,_0x48e0ff,_0x1208a5){return new BPromise(function(_0x547e49,_0x4072be){return client[_0x1c0b('0xc')](_0x48debe,_0x1208a5)[_0x1c0b('0xd')](function(_0x725e6){logger['info'](_0x1c0b('0xe'),_0x48e0ff,_0x1c0b('0xf'));logger[_0x1c0b('0x10')](_0x1c0b('0x11'),_0x48e0ff,_0x1c0b('0xf'),JSON[_0x1c0b('0x12')](_0x725e6));if(_0x725e6['error']){if(_0x725e6['error']['code']===0x1f4){logger[_0x1c0b('0x13')](_0x1c0b('0xe'),_0x48e0ff,_0x725e6['error'][_0x1c0b('0x14')]);return _0x4072be(_0x725e6['error'][_0x1c0b('0x14')]);}logger[_0x1c0b('0x13')](_0x1c0b('0xe'),_0x48e0ff,_0x725e6[_0x1c0b('0x13')][_0x1c0b('0x14')]);return _0x547e49(_0x725e6[_0x1c0b('0x13')][_0x1c0b('0x14')]);}else{logger[_0x1c0b('0x15')](_0x1c0b('0xe'),_0x48e0ff,'request\x20sent');_0x547e49(_0x725e6[_0x1c0b('0x16')][_0x1c0b('0x14')]);}})[_0x1c0b('0x17')](function(_0x22353e){logger[_0x1c0b('0x13')]('MailApplication,\x20%s,\x20%s',_0x48e0ff,_0x22353e);_0x4072be(_0x22353e);});});}exports[_0x1c0b('0x18')]=function(_0x4245d3){var _0x3374d9=this;return new Promise(function(_0x3849dc,_0x3f831a){return db['MailApplication']['update'](_0x4245d3['body'],{'raw':_0x4245d3['options']?_0x4245d3[_0x1c0b('0x19')][_0x1c0b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3['options'][_0x1c0b('0x1b')]||null:null,'attributes':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3['options'][_0x1c0b('0x1c')]||null:null,'limit':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3[_0x1c0b('0x19')][_0x1c0b('0x1d')]||null:null})['then'](function(_0x43be13){logger[_0x1c0b('0x15')](_0x1c0b('0x18'),_0x4245d3);logger['debug'](_0x1c0b('0x18'),_0x4245d3,JSON['stringify'](_0x43be13));_0x3849dc(_0x43be13);})['catch'](function(_0x384df5){logger['error'](_0x1c0b('0x18'),_0x384df5[_0x1c0b('0x14')],_0x4245d3);_0x3f831a(_0x3374d9[_0x1c0b('0x13')](0x1f4,_0x384df5[_0x1c0b('0x14')]));});});}; \ No newline at end of file +var _0x515b=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','then','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x515b,0x1f2));var _0xb515=function(_0x3734c1,_0x14831d){_0x3734c1=_0x3734c1-0x0;var _0x482051=_0x515b[_0x3734c1];return _0x482051;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb515('0x0'));var rs=require(_0xb515('0x1'));var fs=require('fs');var Redis=require(_0xb515('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb515('0x3'))(_0xb515('0x4'));var config=require(_0xb515('0x5'));var jayson=require(_0xb515('0x6'));var client=jayson[_0xb515('0x7')][_0xb515('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1db5de,_0x2e7ca0,_0x6e3492){return new BPromise(function(_0x508a99,_0x4c6eb7){return client[_0xb515('0x9')](_0x1db5de,_0x6e3492)['then'](function(_0xdd8c21){logger[_0xb515('0xa')](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));logger[_0xb515('0xd')](_0xb515('0xe'),_0x2e7ca0,'request\x20sent',JSON[_0xb515('0xf')](_0xdd8c21));if(_0xdd8c21[_0xb515('0x10')]){if(_0xdd8c21[_0xb515('0x10')][_0xb515('0x11')]===0x1f4){logger[_0xb515('0x10')](_0xb515('0xb'),_0x2e7ca0,_0xdd8c21['error'][_0xb515('0x12')]);return _0x4c6eb7(_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);}logger[_0xb515('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e7ca0,_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);return _0x508a99(_0xdd8c21[_0xb515('0x10')]['message']);}else{logger['info'](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));_0x508a99(_0xdd8c21[_0xb515('0x13')][_0xb515('0x12')]);}})[_0xb515('0x14')](function(_0x2247c9){logger['error'](_0xb515('0xb'),_0x2e7ca0,_0x2247c9);_0x4c6eb7(_0x2247c9);});});}exports[_0xb515('0x15')]=function(_0xfd0a44){var _0x55cb65=this;return new Promise(function(_0x2103ce,_0x252b11){return db[_0xb515('0x16')][_0xb515('0x17')](_0xfd0a44[_0xb515('0x18')],{'raw':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44['options'][_0xb515('0x1a')]||null:null,'attributes':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44[_0xb515('0x19')][_0xb515('0x1b')]||null:null,'limit':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44[_0xb515('0x19')][_0xb515('0x1c')]||null:null})[_0xb515('0x1d')](function(_0x7d56d1){logger[_0xb515('0xa')](_0xb515('0x15'),_0xfd0a44);logger[_0xb515('0xd')](_0xb515('0x15'),_0xfd0a44,JSON['stringify'](_0x7d56d1));_0x2103ce(_0x7d56d1);})['catch'](function(_0xc9c01e){logger[_0xb515('0x10')](_0xb515('0x15'),_0xc9c01e[_0xb515('0x12')],_0xfd0a44);_0x252b11(_0x55cb65[_0xb515('0x10')](0x1f4,_0xc9c01e[_0xb515('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 69e4460..9122fc6 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 _0xd187=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','tracked','mail','addTags'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd187,0x8d));var _0x7d18=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0xd187[_0x90e575];return _0x1aae60;};'use strict';var express=require(_0x7d18('0x0'));var router=express['Router']();var auth=require(_0x7d18('0x1'));var interaction=require(_0x7d18('0x2'));var controller=require(_0x7d18('0x3'));router[_0x7d18('0x4')]('/',auth[_0x7d18('0x5')](),controller[_0x7d18('0x6')]);router['get'](_0x7d18('0x7'),auth[_0x7d18('0x5')](),controller[_0x7d18('0x8')]);router[_0x7d18('0x4')](_0x7d18('0x9'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xa')]);router[_0x7d18('0x4')](_0x7d18('0xb'),auth['isAuthenticated'](),controller[_0x7d18('0xc')]);router[_0x7d18('0x4')](_0x7d18('0xd'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xe')]);router['post']('/',auth[_0x7d18('0x5')](),controller['create']);router['post'](_0x7d18('0xb'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xf')]);router[_0x7d18('0x10')](_0x7d18('0x11'),auth[_0x7d18('0x5')](),interaction[_0x7d18('0x12')](_0x7d18('0x13'),'mailinteraction:addtags'),controller[_0x7d18('0x14')]);router['put'](_0x7d18('0x9'),auth[_0x7d18('0x5')](),interaction[_0x7d18('0x12')](_0x7d18('0x13'),'mailinteraction:update'),controller[_0x7d18('0x15')]);router[_0x7d18('0x16')](_0x7d18('0x9'),auth[_0x7d18('0x5')](),interaction['tracked'](_0x7d18('0x13'),_0x7d18('0x17')),controller[_0x7d18('0x18')]);router[_0x7d18('0x16')](_0x7d18('0x11'),auth['isAuthenticated'](),controller[_0x7d18('0x19')]);module[_0x7d18('0x1a')]=router; \ No newline at end of file +var _0xce29=['addMessage','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','removeTags','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','download','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce29,0xa3));var _0x9ce2=function(_0x278d8d,_0x39253d){_0x278d8d=_0x278d8d-0x0;var _0x32c11a=_0xce29[_0x278d8d];return _0x32c11a;};'use strict';var express=require('express');var router=express[_0x9ce2('0x0')]();var auth=require(_0x9ce2('0x1'));var interaction=require(_0x9ce2('0x2'));var controller=require(_0x9ce2('0x3'));router[_0x9ce2('0x4')]('/',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0x6')]);router[_0x9ce2('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x9ce2('0x7')]);router[_0x9ce2('0x4')](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),controller['show']);router[_0x9ce2('0x4')]('/:id/messages',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x9ce2('0xa')]);router[_0x9ce2('0xb')]('/',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0xc')]);router[_0x9ce2('0xb')]('/:id/messages',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0xd')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x9ce2('0xe')](_0x9ce2('0xf'),'mailinteraction:addtags'),controller[_0x9ce2('0x10')]);router[_0x9ce2('0x11')](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),interaction[_0x9ce2('0xe')](_0x9ce2('0xf'),_0x9ce2('0x12')),controller[_0x9ce2('0x13')]);router['delete'](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),interaction['tracked'](_0x9ce2('0xf'),_0x9ce2('0x14')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x9ce2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 72ba6e0..9950d32 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 _0x35cf=['INTEGER','sequelize','exports','STRING','TEXT','BOOLEAN','DATE','ENUM'];(function(_0x1654da,_0x29b4f7){var _0x3220ca=function(_0x550fb7){while(--_0x550fb7){_0x1654da['push'](_0x1654da['shift']());}};_0x3220ca(++_0x29b4f7);}(_0x35cf,0xe9));var _0xf35c=function(_0x2ecb8b,_0x4d2942){_0x2ecb8b=_0x2ecb8b-0x0;var _0x4769c5=_0x35cf[_0x2ecb8b];return _0x4769c5;};'use strict';var Sequelize=require(_0xf35c('0x0'));var iconv=require('iconv');module[_0xf35c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf35c('0x2')]},'secondDisposition':{'type':Sequelize[_0xf35c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf35c('0x2')]},'note':{'type':Sequelize[_0xf35c('0x2')]},'inReplyTo':{'type':Sequelize[_0xf35c('0x2')](0x1fe)},'to':{'type':Sequelize[_0xf35c('0x2')]},'cc':{'type':Sequelize[_0xf35c('0x3')]('long')},'subject':{'type':Sequelize[_0xf35c('0x3')]()},'attach':{'type':Sequelize[_0xf35c('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf35c('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xf35c('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xf35c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf35c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xf35c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf35c('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf35c('0x7')]}}; \ No newline at end of file +var _0x4724=['TEXT','ENUM','INTEGER','iconv','BOOLEAN','DATE','STRING','long'];(function(_0x3f601f,_0x4d4e69){var _0x452b2e=function(_0x3617f4){while(--_0x3617f4){_0x3f601f['push'](_0x3f601f['shift']());}};_0x452b2e(++_0x4d4e69);}(_0x4724,0x83));var _0x4472=function(_0x4090cd,_0x55a2f0){_0x4090cd=_0x4090cd-0x0;var _0x522fbe=_0x4724[_0x4090cd];return _0x522fbe;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4472('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4472('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4472('0x2')]},'disposition':{'type':Sequelize[_0x4472('0x3')]},'secondDisposition':{'type':Sequelize[_0x4472('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4472('0x3')]},'note':{'type':Sequelize[_0x4472('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x4472('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x4472('0x4'))},'subject':{'type':Sequelize[_0x4472('0x5')]()},'attach':{'type':Sequelize[_0x4472('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4472('0x2')]},'substatus':{'type':Sequelize[_0x4472('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4472('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x4472('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4472('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4472('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4472('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 86d5813..d5c8c1b 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 _0x1270=['inlineCss','rows','addTags','setTags','spread','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','sendStatus','eml-format','rimraf','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','end','json','offset','undefined','count','set','update','destroy','then','error','name','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','keys','rawAttributes','filters','model','attributes','fields','length','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','limit','sort','where','pick','MailInteractionId','filter','$gte','split','includeAll','include'];(function(_0x5a8e24,_0x2dc21f){var _0x235660=function(_0x56e529){while(--_0x56e529){_0x5a8e24['push'](_0x5a8e24['shift']());}};_0x235660(++_0x2dc21f);}(_0x1270,0x178));var _0x0127=function(_0x47e424,_0x49c0ed){_0x47e424=_0x47e424-0x0;var _0x4122a9=_0x1270[_0x47e424];return _0x4122a9;};'use strict';var emlformat=require(_0x0127('0x0'));var rimraf=require(_0x0127('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0127('0x2'));var path=require(_0x0127('0x3'));var fs=require('fs');var _=require(_0x0127('0x4'));var juice=require(_0x0127('0x5'));var Redis=require(_0x0127('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x0127('0x7'));var logger=require(_0x0127('0x8'))('api');var config=require(_0x0127('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x0127('0xa'));config[_0x0127('0xb')]=_['defaults'](config['redis'],{'host':_0x0127('0xc'),'port':0x18eb});var socket=require(_0x0127('0xd'))(new Redis(config[_0x0127('0xb')]));require(_0x0127('0xe'))['register'](socket);function respondWithStatusCode(_0x2ad8e5,_0x3ab444){_0x3ab444=_0x3ab444||0xcc;return function(_0x130432){if(_0x130432){return _0x2ad8e5['sendStatus'](_0x3ab444);}return _0x2ad8e5[_0x0127('0xf')](_0x3ab444)[_0x0127('0x10')]();};}function respondWithResult(_0xef14e3,_0x4f8130){_0x4f8130=_0x4f8130||0xc8;return function(_0xc006e){if(_0xc006e){return _0xef14e3['status'](_0x4f8130)[_0x0127('0x11')](_0xc006e);}};}function respondWithFilteredResult(_0x1b4b0e,_0x2f7cea){return function(_0x3d7fae){if(_0x3d7fae){var _0x31066f=typeof _0x2f7cea[_0x0127('0x12')]===_0x0127('0x13')&&typeof _0x2f7cea['limit']==='undefined';var _0x5b8757=_0x3d7fae[_0x0127('0x14')];var _0x5e721a=_0x31066f?0x0:_0x2f7cea[_0x0127('0x12')];var _0x169cdc=_0x31066f?_0x3d7fae[_0x0127('0x14')]:_0x2f7cea['offset']+_0x2f7cea['limit'];var _0xad66dd;if(_0x169cdc>=_0x5b8757){_0x169cdc=_0x5b8757;_0xad66dd=0xc8;}else{_0xad66dd=0xce;}_0x1b4b0e[_0x0127('0xf')](_0xad66dd);return _0x1b4b0e[_0x0127('0x15')]('Content-Range',_0x5e721a+'-'+_0x169cdc+'/'+_0x5b8757)['json'](_0x3d7fae);}return null;};}function saveUpdates(_0x4992db){return function(_0x37b672){if(_0x37b672){return _0x37b672[_0x0127('0x16')](_0x4992db)['then'](function(_0x457cde){return _0x457cde;});}return null;};}function removeEntity(_0x1c3a81){return function(_0xb7a797){if(_0xb7a797){return _0xb7a797[_0x0127('0x17')]()[_0x0127('0x18')](function(){_0x1c3a81[_0x0127('0xf')](0xcc)[_0x0127('0x10')]();});}};}function handleEntityNotFound(_0x21e717){return function(_0x44f6c5){if(!_0x44f6c5){_0x21e717['sendStatus'](0x194);}return _0x44f6c5;};}function handleError(_0x161bfb,_0x106c08){_0x106c08=_0x106c08||0x1f4;return function(_0x4fa670){logger[_0x0127('0x19')](_0x4fa670['stack']);if(_0x4fa670[_0x0127('0x1a')]){delete _0x4fa670[_0x0127('0x1a')];}_0x161bfb[_0x0127('0xf')](_0x106c08)['send'](_0x4fa670);};}exports[_0x0127('0x1b')]=function(_0x81c591,_0x325c99){var _0x3766d3={};var _0x281cbc=_[_0x0127('0x1c')](db[_0x0127('0x1d')]['rawAttributes'],function(_0xd3fbab){return{'name':_0xd3fbab[_0x0127('0x1e')],'type':_0xd3fbab[_0x0127('0x1f')][_0x0127('0x20')]};});_0x3766d3=qs[_0x0127('0x21')](_0x281cbc,_0x81c591);return interaction[_0x0127('0x22')]('mail',_0x81c591[_0x0127('0x23')],_0x81c591[_0x0127('0x24')],_0x3766d3,_0x281cbc)[_0x0127('0x18')](respondWithFilteredResult(_0x325c99,_0x3766d3))[_0x0127('0x25')](handleError(_0x325c99,null));};exports[_0x0127('0x26')]=function(_0x192cbf,_0x5363ba){var _0x547cd4={'raw':![],'where':{'id':_0x192cbf[_0x0127('0x27')]['id']}},_0x3c6bc8={};_0x3c6bc8['model']=_[_0x0127('0x28')](db['MailInteraction'][_0x0127('0x29')]);_0x3c6bc8['query']=_[_0x0127('0x28')](_0x192cbf[_0x0127('0x23')]);_0x3c6bc8[_0x0127('0x2a')]=_['intersection'](_0x3c6bc8[_0x0127('0x2b')],_0x3c6bc8[_0x0127('0x23')]);_0x547cd4[_0x0127('0x2c')]=_['intersection'](_0x3c6bc8[_0x0127('0x2b')],qs[_0x0127('0x2d')](_0x192cbf['query'][_0x0127('0x2d')]));_0x547cd4['attributes']=_0x547cd4[_0x0127('0x2c')][_0x0127('0x2e')]?_0x547cd4[_0x0127('0x2c')]:_0x3c6bc8[_0x0127('0x2b')];if(_0x192cbf[_0x0127('0x23')]['includeAll']){_0x547cd4['include']=[{'all':!![]}];}_0x547cd4=_[_0x0127('0x2f')]({},_0x547cd4,_0x192cbf[_0x0127('0x30')]);return db[_0x0127('0x1d')][_0x0127('0x31')](_0x547cd4)[_0x0127('0x18')](handleEntityNotFound(_0x5363ba,null))[_0x0127('0x18')](respondWithResult(_0x5363ba,null))[_0x0127('0x25')](handleError(_0x5363ba,null));};exports[_0x0127('0x32')]=function(_0x1bff6a,_0x33f6f7){return db[_0x0127('0x1d')][_0x0127('0x32')](_0x1bff6a['body'],{})[_0x0127('0x18')](respondWithResult(_0x33f6f7,0xc9))[_0x0127('0x25')](handleError(_0x33f6f7,null));};exports[_0x0127('0x16')]=function(_0x447f3c,_0x2addb7){if(_0x447f3c[_0x0127('0x33')]['id']){delete _0x447f3c[_0x0127('0x33')]['id'];}return db['MailInteraction'][_0x0127('0x31')]({'where':{'id':_0x447f3c[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x2addb7,null))[_0x0127('0x18')](saveUpdates(_0x447f3c[_0x0127('0x33')],null))[_0x0127('0x18')](respondWithResult(_0x2addb7,null))[_0x0127('0x25')](handleError(_0x2addb7,null));};exports['destroy']=function(_0x58b069,_0x4bccce){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x58b069['params']['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x4bccce,null))['then'](removeEntity(_0x4bccce,null))[_0x0127('0x25')](handleError(_0x4bccce,null));};exports[_0x0127('0x34')]=function(_0x355f89,_0x1e3970){return db[_0x0127('0x1d')][_0x0127('0x34')]()[_0x0127('0x18')](respondWithResult(_0x1e3970,null))[_0x0127('0x25')](handleError(_0x1e3970,null));};exports[_0x0127('0x35')]=function(_0x544773,_0x4d365a){return db[_0x0127('0x36')][_0x0127('0x31')]({'where':{'id':_0x544773['params']['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x4d365a,null))[_0x0127('0x18')](function(_0xb12400){if(_0xb12400){return _0xb12400['addMessage'](_0x544773[_0x0127('0x33')][_0x0127('0x37')],_[_0x0127('0x38')](_0x544773[_0x0127('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x4d365a,null))[_0x0127('0x25')](handleError(_0x4d365a,null));};exports[_0x0127('0x39')]=function(_0x5c88ed,_0x903565){var _0x3064d9={'raw':![],'where':{}};var _0x9cd874={};var _0x437b37={'count':0x0,'rows':[]};return db[_0x0127('0x1d')][_0x0127('0x3a')]({'where':{'id':_0x5c88ed[_0x0127('0x27')]['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x903565,null))[_0x0127('0x18')](function(_0x594db7){if(_0x594db7){_0x9cd874[_0x0127('0x2b')]=_['keys'](db[_0x0127('0x36')][_0x0127('0x29')]);_0x9cd874['query']=_[_0x0127('0x28')](_0x5c88ed[_0x0127('0x23')]);_0x9cd874[_0x0127('0x2a')]=_['intersection'](_0x9cd874[_0x0127('0x2b')],_0x9cd874[_0x0127('0x23')]);_0x3064d9[_0x0127('0x2c')]=_[_0x0127('0x3b')](_0x9cd874[_0x0127('0x2b')],qs['fields'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x2d')]));_0x3064d9[_0x0127('0x2c')]=_0x3064d9[_0x0127('0x2c')][_0x0127('0x2e')]?_0x3064d9[_0x0127('0x2c')]:_0x9cd874[_0x0127('0x2b')];if(!_0x5c88ed[_0x0127('0x23')][_0x0127('0x3c')](_0x0127('0x3d'))){_0x3064d9[_0x0127('0x3e')]=qs['limit'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x3e')]);_0x3064d9[_0x0127('0x12')]=qs['offset'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x12')]);}_0x3064d9['order']=qs[_0x0127('0x3f')](_0x5c88ed[_0x0127('0x23')][_0x0127('0x3f')]);_0x3064d9[_0x0127('0x40')]=qs[_0x0127('0x2a')](_[_0x0127('0x41')](_0x5c88ed[_0x0127('0x23')],_0x9cd874['filters']));_0x3064d9[_0x0127('0x40')][_0x0127('0x42')]=_0x594db7['id'];if(_0x5c88ed[_0x0127('0x23')][_0x0127('0x43')]){_0x3064d9[_0x0127('0x40')]=_[_0x0127('0x2f')](_0x3064d9[_0x0127('0x40')],{'$or':_['map'](_0x3064d9[_0x0127('0x2c')],function(_0xc39cb6){var _0x4d38b3={};_0x4d38b3[_0xc39cb6]={'$like':'%'+_0x5c88ed[_0x0127('0x23')][_0x0127('0x43')]+'%'};return _0x4d38b3;})});}if(_0x5c88ed[_0x0127('0x23')]['$gte']){var _0xdb1798=_0x5c88ed['query'][_0x0127('0x44')][_0x0127('0x45')](',');var _0x25b5cb={};_0x25b5cb[_0xdb1798[0x0]]={'$gte':moment(_0xdb1798[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3064d9[_0x0127('0x40')]=_[_0x0127('0x2f')](_0x3064d9[_0x0127('0x40')],_0x25b5cb);}_0x3064d9=_['merge']({},_0x3064d9,_0x5c88ed[_0x0127('0x30')]);return db['MailMessage']['count']({'where':_0x3064d9[_0x0127('0x40')]})['then'](function(_0x38ff03){_0x437b37[_0x0127('0x14')]=_0x38ff03;if(_0x5c88ed['query'][_0x0127('0x46')]){_0x3064d9[_0x0127('0x47')]=[{'all':!![]}];}return db['MailMessage'][_0x0127('0x22')](_0x3064d9);})[_0x0127('0x18')](function(_0x5e3050){if(_0x5c88ed[_0x0127('0x23')][_0x0127('0x48')]==='true'){for(var _0x22f146=0x0;_0x22f146<_0x5e3050[_0x0127('0x2e')];_0x22f146++){_0x5e3050[_0x22f146][_0x0127('0x33')]=juice(_0x5e3050[_0x22f146]['body']);}}_0x437b37[_0x0127('0x49')]=_0x5e3050;return _0x437b37;});}})[_0x0127('0x18')](respondWithFilteredResult(_0x903565,_0x3064d9))[_0x0127('0x25')](handleError(_0x903565,null));};exports[_0x0127('0x4a')]=function(_0x531a53,_0x3ce89c){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x531a53[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x3ce89c,null))[_0x0127('0x18')](function(_0x1b5841){if(_0x1b5841){return _0x1b5841[_0x0127('0x4b')](_0x531a53[_0x0127('0x33')][_0x0127('0x37')],_[_0x0127('0x38')](_0x531a53['body'],['ids','id'])||{})[_0x0127('0x4c')](function(){return db['Tag'][_0x0127('0x22')]({'attributes':['id',_0x0127('0x1a'),_0x0127('0x4d')],'where':{'id':_0x531a53[_0x0127('0x33')][_0x0127('0x37')]}});})[_0x0127('0x18')](function(_0x6bd62e){socket['emit'](_0x0127('0x4e'),{'id':Number(_0x531a53[_0x0127('0x27')]['id']),'tags':_0x6bd62e||[]});return{'id':Number(_0x531a53[_0x0127('0x27')]['id']),'tags':_0x6bd62e||[]};});}})['then'](respondWithResult(_0x3ce89c,null))[_0x0127('0x25')](handleError(_0x3ce89c,null));};exports[_0x0127('0x4f')]=function(_0x75b868,_0x5dd04d){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x75b868[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x5dd04d,null))[_0x0127('0x18')](function(_0x1010ed){if(_0x1010ed){return _0x1010ed[_0x0127('0x4f')](_0x75b868[_0x0127('0x23')][_0x0127('0x37')]);}})['then'](respondWithStatusCode(_0x5dd04d,null))[_0x0127('0x25')](handleError(_0x5dd04d,null));};exports[_0x0127('0x50')]=function(_0x2e19df,_0x176592){var _0x3a46a0=moment()[_0x0127('0x51')]()[_0x0127('0x52')]();var _0x3c90ac=path[_0x0127('0x53')](config[_0x0127('0x54')],_0x0127('0x55'),_0x0127('0x56'),_0x0127('0x57'));var _0x44d865=path[_0x0127('0x53')](config[_0x0127('0x54')],_0x0127('0x55'),_0x0127('0x56'),_0x0127('0x58'));var _0x20525d=path[_0x0127('0x53')](_0x3c90ac,_0x3a46a0);var _0x9b4b38=util[_0x0127('0x59')](_0x0127('0x5a'),_0x2e19df['params']['id'],_0x3a46a0);var _0x1e7e8b=path[_0x0127('0x53')](_0x3c90ac,_0x9b4b38);var _0x11a99d=[];if(_0x2e19df[_0x0127('0x23')][_0x0127('0x58')]){_0x11a99d[_0x0127('0x5b')]({'model':db[_0x0127('0x5c')],'as':_0x0127('0x5d'),'raw':!![]});}var _0x26999d=[{'model':db['MailMessage'],'as':_0x0127('0x5e'),'attributes':['id',_0x0127('0x33'),_0x0127('0x5f'),'to','cc',_0x0127('0x60'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x0127('0x3f')]('id'),'include':_0x11a99d}];return db['MailInteraction'][_0x0127('0x31')]({'where':{'id':_0x2e19df['params']['id']},'include':_0x26999d})[_0x0127('0x18')](handleEntityNotFound(_0x176592,null))[_0x0127('0x18')](function(_0x401b6c){if(_0x401b6c&&_0x401b6c['Messages']){var _0xb7cd46=_0x401b6c[_0x0127('0x61')]({'plain':!![]});fs[_0x0127('0x62')](_0x20525d);return BPromise[_0x0127('0x63')](_0xb7cd46[_0x0127('0x5e')],function(_0xbbc960,_0x45f7ca){var _0xa0169d={'from':_0xbbc960[_0x0127('0x5f')],'to':_0xbbc960['to']||_0x0127('0x64'),'subject':_0xbbc960['subject'],'html':htmlEntities[_0x0127('0x65')](_0xbbc960[_0x0127('0x33')]),'headers':{'Date':moment(_0xbbc960['createdAt'])['format'](_0x0127('0x66'))},'attachments':[]};if(_0xbbc960['cc']){_0xa0169d[_0x0127('0x67')]['Cc']=_0xbbc960['cc'];}if(_0xbbc960['bcc']){_0xa0169d[_0x0127('0x67')][_0x0127('0x68')]=_0xbbc960[_0x0127('0x60')];}return new BPromise(function(_0x449b92,_0x45c607){if(_0xbbc960[_0x0127('0x5d')]){for(var _0x5d45e1=0x0;_0x5d45e1<_0xbbc960['Attachments']['length'];_0x5d45e1++){var _0x44ee49=_0xbbc960[_0x0127('0x5d')][_0x5d45e1];var _0x56a9f9=path[_0x0127('0x53')](_0x44d865,_0x44ee49[_0x0127('0x69')]);if(fs[_0x0127('0x6a')](_0x56a9f9)){_0xa0169d[_0x0127('0x58')][_0x0127('0x5b')]({'name':_0x44ee49['name'],'contentType':_0x44ee49[_0x0127('0x1f')],'data':fs[_0x0127('0x6b')](_0x56a9f9)});}}}emlformat[_0x0127('0x6c')](_0xa0169d,function(_0x5cbf6d,_0x45be9e){if(_0x5cbf6d)return _0x45c607(_0x5cbf6d);fs[_0x0127('0x6d')](path[_0x0127('0x53')](_0x20525d,util['format'](_0x0127('0x6e'),_0x45f7ca)),_0x45be9e);return _0x449b92(_0x45be9e);});});})[_0x0127('0x18')](function(){return new BPromise(function(_0x45fcca,_0x586773){zipdir(_0x20525d,{'saveTo':_0x1e7e8b},function(_0x1d1d09,_0x223dcd){if(_0x1d1d09)return _0x586773(_0x1d1d09);return _0x45fcca(_0x223dcd);});})[_0x0127('0x18')](function(){return new BPromise(function(_0x399ce4,_0xf0d2af){rimraf(_0x20525d,function(_0x29e2ee){if(_0x29e2ee)_0xf0d2af(_0x29e2ee);return _0x399ce4();});});})[_0x0127('0x18')](function(){return _0x176592[_0x0127('0x50')](_0x1e7e8b,_0x9b4b38,function(_0x23fe4b){if(!_0x23fe4b)fs['unlinkSync'](_0x1e7e8b);});});});}else{return _0x176592[_0x0127('0x6f')](0xc8);}})[_0x0127('0x25')](handleError(_0x176592,null));}; \ No newline at end of file +var _0x12bb=['query','user','catch','keys','rawAttributes','model','attributes','fields','length','includeAll','include','merge','create','body','update','find','params','describe','addMessage','ids','omit','findOne','MailMessage','filters','intersection','hasOwnProperty','nolimit','order','sort','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','Tag','findAll','color','emit','removeTags','download','unix','join','root','server','files','attachments','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','readFileSync','build','eml-format','zip-dir','bluebird','util','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','MailInteraction','fieldName','type','getOptions','mail'];(function(_0x275e0e,_0x2fdb88){var _0x60196a=function(_0x5e4f13){while(--_0x5e4f13){_0x275e0e['push'](_0x275e0e['shift']());}};_0x60196a(++_0x2fdb88);}(_0x12bb,0x122));var _0xb12b=function(_0x2ed7d5,_0x509cad){_0x2ed7d5=_0x2ed7d5-0x0;var _0x515dd0=_0x12bb[_0x2ed7d5];return _0x515dd0;};'use strict';var emlformat=require(_0xb12b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb12b('0x1'));var moment=require('moment');var BPromise=require(_0xb12b('0x2'));var util=require(_0xb12b('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xb12b('0x4'));var juice=require(_0xb12b('0x5'));var Redis=require('ioredis');var interaction=require(_0xb12b('0x6'));var qs=require(_0xb12b('0x7'));var logger=require(_0xb12b('0x8'))(_0xb12b('0x9'));var config=require(_0xb12b('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0xb12b('0xb')],{'host':_0xb12b('0xc'),'port':0x18eb});var socket=require(_0xb12b('0xd'))(new Redis(config[_0xb12b('0xb')]));require(_0xb12b('0xe'))[_0xb12b('0xf')](socket);function respondWithStatusCode(_0x3094a3,_0x51ad1d){_0x51ad1d=_0x51ad1d||0xcc;return function(_0x4c0843){if(_0x4c0843){return _0x3094a3['sendStatus'](_0x51ad1d);}return _0x3094a3[_0xb12b('0x10')](_0x51ad1d)[_0xb12b('0x11')]();};}function respondWithResult(_0x500ad3,_0x3f5654){_0x3f5654=_0x3f5654||0xc8;return function(_0x5b9ef4){if(_0x5b9ef4){return _0x500ad3[_0xb12b('0x10')](_0x3f5654)['json'](_0x5b9ef4);}};}function respondWithFilteredResult(_0x2f9200,_0x56a459){return function(_0x17c099){if(_0x17c099){var _0x1bda8c=typeof _0x56a459[_0xb12b('0x12')]==='undefined'&&typeof _0x56a459[_0xb12b('0x13')]===_0xb12b('0x14');var _0x188ab1=_0x17c099[_0xb12b('0x15')];var _0x47720c=_0x1bda8c?0x0:_0x56a459[_0xb12b('0x12')];var _0x263642=_0x1bda8c?_0x17c099['count']:_0x56a459[_0xb12b('0x12')]+_0x56a459[_0xb12b('0x13')];var _0x231024;if(_0x263642>=_0x188ab1){_0x263642=_0x188ab1;_0x231024=0xc8;}else{_0x231024=0xce;}_0x2f9200[_0xb12b('0x10')](_0x231024);return _0x2f9200[_0xb12b('0x16')](_0xb12b('0x17'),_0x47720c+'-'+_0x263642+'/'+_0x188ab1)[_0xb12b('0x18')](_0x17c099);}return null;};}function saveUpdates(_0x3384cc){return function(_0x10cdb5){if(_0x10cdb5){return _0x10cdb5['update'](_0x3384cc)[_0xb12b('0x19')](function(_0x38791d){return _0x38791d;});}return null;};}function removeEntity(_0x4c7bb6){return function(_0x93a40b){if(_0x93a40b){return _0x93a40b[_0xb12b('0x1a')]()[_0xb12b('0x19')](function(){_0x4c7bb6[_0xb12b('0x10')](0xcc)[_0xb12b('0x11')]();});}};}function handleEntityNotFound(_0x6fbfb){return function(_0xaa4ff1){if(!_0xaa4ff1){_0x6fbfb[_0xb12b('0x1b')](0x194);}return _0xaa4ff1;};}function handleError(_0x3a7fe5,_0x35592f){_0x35592f=_0x35592f||0x1f4;return function(_0x9b22a3){logger[_0xb12b('0x1c')](_0x9b22a3[_0xb12b('0x1d')]);if(_0x9b22a3[_0xb12b('0x1e')]){delete _0x9b22a3['name'];}_0x3a7fe5[_0xb12b('0x10')](_0x35592f)[_0xb12b('0x1f')](_0x9b22a3);};}exports['index']=function(_0x269309,_0x33f445){var _0x4d5184={};var _0x312fc2=_['map'](db[_0xb12b('0x20')]['rawAttributes'],function(_0x19dfaa){return{'name':_0x19dfaa[_0xb12b('0x21')],'type':_0x19dfaa[_0xb12b('0x22')]['key']};});_0x4d5184=qs[_0xb12b('0x23')](_0x312fc2,_0x269309);return interaction['findAll'](_0xb12b('0x24'),_0x269309[_0xb12b('0x25')],_0x269309[_0xb12b('0x26')],_0x4d5184,_0x312fc2)[_0xb12b('0x19')](respondWithFilteredResult(_0x33f445,_0x4d5184))[_0xb12b('0x27')](handleError(_0x33f445,null));};exports['show']=function(_0x45c7e9,_0x5ee3bf){var _0x224e93={'raw':![],'where':{'id':_0x45c7e9['params']['id']}},_0x2a8382={};_0x2a8382['model']=_[_0xb12b('0x28')](db[_0xb12b('0x20')][_0xb12b('0x29')]);_0x2a8382[_0xb12b('0x25')]=_['keys'](_0x45c7e9[_0xb12b('0x25')]);_0x2a8382['filters']=_['intersection'](_0x2a8382[_0xb12b('0x2a')],_0x2a8382[_0xb12b('0x25')]);_0x224e93[_0xb12b('0x2b')]=_['intersection'](_0x2a8382[_0xb12b('0x2a')],qs[_0xb12b('0x2c')](_0x45c7e9['query']['fields']));_0x224e93[_0xb12b('0x2b')]=_0x224e93[_0xb12b('0x2b')][_0xb12b('0x2d')]?_0x224e93['attributes']:_0x2a8382[_0xb12b('0x2a')];if(_0x45c7e9[_0xb12b('0x25')][_0xb12b('0x2e')]){_0x224e93[_0xb12b('0x2f')]=[{'all':!![]}];}_0x224e93=_[_0xb12b('0x30')]({},_0x224e93,_0x45c7e9['options']);return db[_0xb12b('0x20')]['find'](_0x224e93)[_0xb12b('0x19')](handleEntityNotFound(_0x5ee3bf,null))[_0xb12b('0x19')](respondWithResult(_0x5ee3bf,null))[_0xb12b('0x27')](handleError(_0x5ee3bf,null));};exports[_0xb12b('0x31')]=function(_0x45934d,_0x5acff1){return db[_0xb12b('0x20')][_0xb12b('0x31')](_0x45934d[_0xb12b('0x32')],{})['then'](respondWithResult(_0x5acff1,0xc9))[_0xb12b('0x27')](handleError(_0x5acff1,null));};exports[_0xb12b('0x33')]=function(_0x4d2495,_0x187a2b){if(_0x4d2495[_0xb12b('0x32')]['id']){delete _0x4d2495[_0xb12b('0x32')]['id'];}return db['MailInteraction'][_0xb12b('0x34')]({'where':{'id':_0x4d2495[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x187a2b,null))[_0xb12b('0x19')](saveUpdates(_0x4d2495['body'],null))['then'](respondWithResult(_0x187a2b,null))[_0xb12b('0x27')](handleError(_0x187a2b,null));};exports[_0xb12b('0x1a')]=function(_0x4bf508,_0x5c9df1){return db[_0xb12b('0x20')]['find']({'where':{'id':_0x4bf508[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x5c9df1,null))[_0xb12b('0x19')](removeEntity(_0x5c9df1,null))[_0xb12b('0x27')](handleError(_0x5c9df1,null));};exports[_0xb12b('0x36')]=function(_0x6b5c26,_0x167b54){return db[_0xb12b('0x20')][_0xb12b('0x36')]()[_0xb12b('0x19')](respondWithResult(_0x167b54,null))[_0xb12b('0x27')](handleError(_0x167b54,null));};exports[_0xb12b('0x37')]=function(_0x3ba30c,_0x1f380a){return db['MailMessage'][_0xb12b('0x34')]({'where':{'id':_0x3ba30c['params']['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0x1f380a,null))[_0xb12b('0x19')](function(_0x38ed52){if(_0x38ed52){return _0x38ed52[_0xb12b('0x37')](_0x3ba30c[_0xb12b('0x32')][_0xb12b('0x38')],_[_0xb12b('0x39')](_0x3ba30c[_0xb12b('0x32')],[_0xb12b('0x38'),'id'])||{});}})[_0xb12b('0x19')](respondWithResult(_0x1f380a,null))[_0xb12b('0x27')](handleError(_0x1f380a,null));};exports['getMessages']=function(_0xaa04cf,_0x3d1311){var _0x1545f4={'raw':![],'where':{}};var _0x148457={};var _0x1a8e48={'count':0x0,'rows':[]};return db['MailInteraction'][_0xb12b('0x3a')]({'where':{'id':_0xaa04cf['params']['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0x3d1311,null))[_0xb12b('0x19')](function(_0x2e7254){if(_0x2e7254){_0x148457[_0xb12b('0x2a')]=_[_0xb12b('0x28')](db[_0xb12b('0x3b')][_0xb12b('0x29')]);_0x148457[_0xb12b('0x25')]=_['keys'](_0xaa04cf[_0xb12b('0x25')]);_0x148457[_0xb12b('0x3c')]=_[_0xb12b('0x3d')](_0x148457[_0xb12b('0x2a')],_0x148457['query']);_0x1545f4['attributes']=_[_0xb12b('0x3d')](_0x148457['model'],qs['fields'](_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x2c')]));_0x1545f4[_0xb12b('0x2b')]=_0x1545f4[_0xb12b('0x2b')][_0xb12b('0x2d')]?_0x1545f4[_0xb12b('0x2b')]:_0x148457['model'];if(!_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x3e')](_0xb12b('0x3f'))){_0x1545f4[_0xb12b('0x13')]=qs[_0xb12b('0x13')](_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x13')]);_0x1545f4[_0xb12b('0x12')]=qs[_0xb12b('0x12')](_0xaa04cf['query'][_0xb12b('0x12')]);}_0x1545f4[_0xb12b('0x40')]=qs[_0xb12b('0x41')](_0xaa04cf['query'][_0xb12b('0x41')]);_0x1545f4['where']=qs[_0xb12b('0x3c')](_[_0xb12b('0x42')](_0xaa04cf[_0xb12b('0x25')],_0x148457[_0xb12b('0x3c')]));_0x1545f4[_0xb12b('0x43')]['MailInteractionId']=_0x2e7254['id'];if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x44')]){_0x1545f4[_0xb12b('0x43')]=_['merge'](_0x1545f4['where'],{'$or':_[_0xb12b('0x45')](_0x1545f4[_0xb12b('0x2b')],function(_0x2f96e3){var _0xb7109b={};_0xb7109b[_0x2f96e3]={'$like':'%'+_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x44')]+'%'};return _0xb7109b;})});}if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x46')]){var _0x16f785=_0xaa04cf[_0xb12b('0x25')]['$gte'][_0xb12b('0x47')](',');var _0x4e4435={};_0x4e4435[_0x16f785[0x0]]={'$gte':moment(_0x16f785[0x1])[_0xb12b('0x48')](_0xb12b('0x49'))};_0x1545f4[_0xb12b('0x43')]=_[_0xb12b('0x30')](_0x1545f4['where'],_0x4e4435);}_0x1545f4=_['merge']({},_0x1545f4,_0xaa04cf['options']);return db[_0xb12b('0x3b')][_0xb12b('0x15')]({'where':_0x1545f4['where']})['then'](function(_0x353b75){_0x1a8e48[_0xb12b('0x15')]=_0x353b75;if(_0xaa04cf['query'][_0xb12b('0x2e')]){_0x1545f4['include']=[{'all':!![]}];}return db[_0xb12b('0x3b')]['findAll'](_0x1545f4);})[_0xb12b('0x19')](function(_0x5483aa){if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x4a')]===_0xb12b('0x4b')){for(var _0x4302c7=0x0;_0x4302c7<_0x5483aa[_0xb12b('0x2d')];_0x4302c7++){_0x5483aa[_0x4302c7][_0xb12b('0x32')]=juice(_0x5483aa[_0x4302c7][_0xb12b('0x32')]);}}_0x1a8e48['rows']=_0x5483aa;return _0x1a8e48;});}})['then'](respondWithFilteredResult(_0x3d1311,_0x1545f4))[_0xb12b('0x27')](handleError(_0x3d1311,null));};exports[_0xb12b('0x4c')]=function(_0x4ad5f2,_0xb5b12a){return db['MailInteraction'][_0xb12b('0x34')]({'where':{'id':_0x4ad5f2[_0xb12b('0x35')]['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0xb5b12a,null))[_0xb12b('0x19')](function(_0x510517){if(_0x510517){return _0x510517[_0xb12b('0x4d')](_0x4ad5f2[_0xb12b('0x32')][_0xb12b('0x38')],_[_0xb12b('0x39')](_0x4ad5f2[_0xb12b('0x32')],[_0xb12b('0x38'),'id'])||{})[_0xb12b('0x4e')](function(){return db[_0xb12b('0x4f')][_0xb12b('0x50')]({'attributes':['id',_0xb12b('0x1e'),_0xb12b('0x51')],'where':{'id':_0x4ad5f2['body']['ids']}});})[_0xb12b('0x19')](function(_0x32bb09){socket[_0xb12b('0x52')]('mailInteractionTags:save',{'id':Number(_0x4ad5f2['params']['id']),'tags':_0x32bb09||[]});return{'id':Number(_0x4ad5f2['params']['id']),'tags':_0x32bb09||[]};});}})['then'](respondWithResult(_0xb5b12a,null))[_0xb12b('0x27')](handleError(_0xb5b12a,null));};exports[_0xb12b('0x53')]=function(_0x5a25b1,_0x218029){return db[_0xb12b('0x20')][_0xb12b('0x34')]({'where':{'id':_0x5a25b1[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x218029,null))[_0xb12b('0x19')](function(_0x253a84){if(_0x253a84){return _0x253a84[_0xb12b('0x53')](_0x5a25b1['query'][_0xb12b('0x38')]);}})['then'](respondWithStatusCode(_0x218029,null))[_0xb12b('0x27')](handleError(_0x218029,null));};exports[_0xb12b('0x54')]=function(_0xa05321,_0x313cf7){var _0x3f6b1e=moment()[_0xb12b('0x55')]()['toString']();var _0xd46381=path[_0xb12b('0x56')](config[_0xb12b('0x57')],_0xb12b('0x58'),'files','tmp');var _0x127e7c=path[_0xb12b('0x56')](config[_0xb12b('0x57')],_0xb12b('0x58'),_0xb12b('0x59'),'attachments');var _0x45a84e=path[_0xb12b('0x56')](_0xd46381,_0x3f6b1e);var _0x2c6366=util[_0xb12b('0x48')]('transcript-%d-%s.zip',_0xa05321[_0xb12b('0x35')]['id'],_0x3f6b1e);var _0x3ae4f5=path[_0xb12b('0x56')](_0xd46381,_0x2c6366);var _0x1d6f8a=[];if(_0xa05321[_0xb12b('0x25')][_0xb12b('0x5a')]){_0x1d6f8a[_0xb12b('0x5b')]({'model':db[_0xb12b('0x5c')],'as':'Attachments','raw':!![]});}var _0x2b505b=[{'model':db[_0xb12b('0x3b')],'as':_0xb12b('0x5d'),'attributes':['id',_0xb12b('0x32'),_0xb12b('0x5e'),'to','cc','bcc',_0xb12b('0x5f'),_0xb12b('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1d6f8a}];return db[_0xb12b('0x20')]['find']({'where':{'id':_0xa05321[_0xb12b('0x35')]['id']},'include':_0x2b505b})['then'](handleEntityNotFound(_0x313cf7,null))[_0xb12b('0x19')](function(_0x569f6f){if(_0x569f6f&&_0x569f6f['Messages']){var _0x4c27fd=_0x569f6f[_0xb12b('0x61')]({'plain':!![]});fs[_0xb12b('0x62')](_0x45a84e);return BPromise[_0xb12b('0x63')](_0x4c27fd[_0xb12b('0x5d')],function(_0x232ffc,_0x10cd23){var _0x1f6fa4={'from':_0x232ffc[_0xb12b('0x5e')],'to':_0x232ffc['to']||_0xb12b('0x64'),'subject':_0x232ffc[_0xb12b('0x5f')],'html':htmlEntities[_0xb12b('0x65')](_0x232ffc[_0xb12b('0x32')]),'headers':{'Date':moment(_0x232ffc[_0xb12b('0x60')])[_0xb12b('0x48')](_0xb12b('0x66'))},'attachments':[]};if(_0x232ffc['cc']){_0x1f6fa4[_0xb12b('0x67')]['Cc']=_0x232ffc['cc'];}if(_0x232ffc[_0xb12b('0x68')]){_0x1f6fa4[_0xb12b('0x67')][_0xb12b('0x69')]=_0x232ffc[_0xb12b('0x68')];}return new BPromise(function(_0x63738e,_0x1b7da2){if(_0x232ffc['Attachments']){for(var _0x4a3ce1=0x0;_0x4a3ce1<_0x232ffc['Attachments'][_0xb12b('0x2d')];_0x4a3ce1++){var _0x29f631=_0x232ffc['Attachments'][_0x4a3ce1];var _0x4e9a86=path[_0xb12b('0x56')](_0x127e7c,_0x29f631['basename']);if(fs[_0xb12b('0x6a')](_0x4e9a86)){_0x1f6fa4[_0xb12b('0x5a')][_0xb12b('0x5b')]({'name':_0x29f631[_0xb12b('0x1e')],'contentType':_0x29f631[_0xb12b('0x22')],'data':fs[_0xb12b('0x6b')](_0x4e9a86)});}}}emlformat[_0xb12b('0x6c')](_0x1f6fa4,function(_0x2dec4b,_0x53187b){if(_0x2dec4b)return _0x1b7da2(_0x2dec4b);fs['writeFileSync'](path[_0xb12b('0x56')](_0x45a84e,util[_0xb12b('0x48')]('message%d.eml',_0x10cd23)),_0x53187b);return _0x63738e(_0x53187b);});});})[_0xb12b('0x19')](function(){return new BPromise(function(_0x4c17cc,_0x115bd6){zipdir(_0x45a84e,{'saveTo':_0x3ae4f5},function(_0x59c93d,_0x34b90e){if(_0x59c93d)return _0x115bd6(_0x59c93d);return _0x4c17cc(_0x34b90e);});})['then'](function(){return new BPromise(function(_0xb0a0ad,_0x208b79){rimraf(_0x45a84e,function(_0x50d551){if(_0x50d551)_0x208b79(_0x50d551);return _0xb0a0ad();});});})['then'](function(){return _0x313cf7['download'](_0x3ae4f5,_0x2c6366,function(_0x4977d1){if(!_0x4977d1)fs['unlinkSync'](_0x3ae4f5);});});});}else{return _0x313cf7[_0xb12b('0x1b')](0xc8);}})[_0xb12b('0x27')](handleError(_0x313cf7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 101f83a..11b239f 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 _0x1907=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1907,0x155));var _0x7190=function(_0x3da684,_0x12a556){_0x3da684=_0x3da684-0x0;var _0x273bb4=_0x1907[_0x3da684];return _0x273bb4;};'use strict';var EventEmitter=require(_0x7190('0x0'));var MailInteraction=require(_0x7190('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x7190('0x1'))['db'][_0x7190('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7190('0x3')](0x0);var events={'afterCreate':_0x7190('0x4'),'afterUpdate':_0x7190('0x5'),'afterDestroy':_0x7190('0x6')};function emitEvent(_0x3a9074){return function(_0x569bc8,_0x5ed958,_0x1751d0){_0x569bc8[_0x7190('0x7')]({'attributes':['id'],'raw':!![]})[_0x7190('0x8')](function(_0x2bf621){_0x569bc8[_0x7190('0x9')](_0x7190('0xa'),_0x2bf621['map'](function(_0x46d382){return{'id':_0x46d382['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x569bc8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x50641a){_0x569bc8[_0x7190('0x9')](_0x7190('0xb'),_0x50641a[_0x7190('0xc')]);MailInteractionEvents[_0x7190('0xd')](_0x3a9074+':'+_0x569bc8['id'],_0x569bc8);MailInteractionEvents[_0x7190('0xd')](_0x3a9074,_0x569bc8);_0x1751d0(null);})[_0x7190('0xe')](_0x1751d0(null));};}for(var e in events){if(events[_0x7190('0xf')](e)){var event=events[e];MailInteraction[_0x7190('0x10')](e,emitEvent(event));}}module[_0x7190('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xf0b7=['hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x52ad4a,_0x123add){var _0x3f3a81=function(_0x2d2186){while(--_0x2d2186){_0x52ad4a['push'](_0x52ad4a['shift']());}};_0x3f3a81(++_0x123add);}(_0xf0b7,0xec));var _0x7f0b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf0b7[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7f0b('0x0'))['db'][_0x7f0b('0x1')];var MailMessage=require(_0x7f0b('0x0'))['db'][_0x7f0b('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7f0b('0x3')](0x0);var events={'afterCreate':_0x7f0b('0x4'),'afterUpdate':'update','afterDestroy':_0x7f0b('0x5')};function emitEvent(_0xafc2d5){return function(_0x2e79a6,_0xb7a70d,_0x3ee0e1){_0x2e79a6[_0x7f0b('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f0b('0x7')](function(_0x45c77e){_0x2e79a6[_0x7f0b('0x8')](_0x7f0b('0x9'),_0x45c77e[_0x7f0b('0xa')](function(_0x12881c){return{'id':_0x12881c['id']};}));return MailMessage[_0x7f0b('0xb')]({'where':{'MailInteractionId':_0x2e79a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f0b('0x7')](function(_0x46d741){_0x2e79a6[_0x7f0b('0x8')](_0x7f0b('0xc'),_0x46d741[_0x7f0b('0xd')]);MailInteractionEvents['emit'](_0xafc2d5+':'+_0x2e79a6['id'],_0x2e79a6);MailInteractionEvents[_0x7f0b('0xe')](_0xafc2d5,_0x2e79a6);_0x3ee0e1(null);})[_0x7f0b('0xf')](_0x3ee0e1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7f0b('0x10')](e,emitEvent(event));}}module[_0x7f0b('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d08019e..60ef736 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 _0x1924=['MailInteraction','fti_mail_interactions','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','substatusAt','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x49c854,_0x387d1a){var _0x111a10=function(_0x432c67){while(--_0x432c67){_0x49c854['push'](_0x49c854['shift']());}};_0x111a10(++_0x387d1a);}(_0x1924,0x13b));var _0x4192=function(_0x461fd6,_0x1db38c){_0x461fd6=_0x461fd6-0x0;var _0x4e7a9c=_0x1924[_0x461fd6];return _0x4e7a9c;};'use strict';var _=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var logger=require(_0x4192('0x2'))(_0x4192('0x3'));var moment=require(_0x4192('0x4'));var BPromise=require(_0x4192('0x5'));var rp=require(_0x4192('0x6'));var fs=require('fs');var path=require(_0x4192('0x7'));var rimraf=require('rimraf');var config=require(_0x4192('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x1c0030,_0x2f0be5){return _0x1c0030[_0x4192('0x9')](_0x4192('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x4192('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31ace1,_0x1d0daf,_0x618a51){if(_0x31ace1['substatus']){_0x31ace1['substatusAt']=moment()[_0x4192('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x31ace1[_0x4192('0xd')]){_0x31ace1[_0x4192('0xe')]=moment()[_0x4192('0xc')](_0x4192('0xf'));}_0x618a51(null,_0x1d0daf);},'beforeUpdate':function(_0x4298bb,_0x3c2f0f,_0x2a6110){if(_0x4298bb[_0x4192('0x10')](_0x4192('0x11'))){_0x4298bb['substatusAt']=_0x4298bb[_0x4192('0x11')]?moment()[_0x4192('0xc')](_0x4192('0xf')):null;}if(_0x4298bb[_0x4192('0x10')]('closed')){_0x4298bb[_0x4192('0xe')]=moment()[_0x4192('0xc')](_0x4192('0xf'));_0x4298bb[_0x4192('0x11')]=null;_0x4298bb[_0x4192('0x12')]=null;}_0x2a6110(null,_0x4298bb);},'afterUpdate':function(_0x4ffe07,_0x35997d,_0x100125){var _0x2e00e6=_0x1c0030[_0x4192('0x13')];var _0x38f2fd=_0x4ffe07[_0x4192('0x14')]({'plain':!![]});if(_0x38f2fd[_0x4192('0xd')]){return _0x2e00e6[_0x4192('0x15')][_0x4192('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x38f2fd['id']}})['then'](function(){_0x100125();})['catch'](function(_0x4323b8){_0x100125(_0x4323b8);});}else{_0x100125();}}},'charset':_0x4192('0x17'),'collate':_0x4192('0x18')});}; \ No newline at end of file +var _0xa055=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','get','MailMessage','then','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed'];(function(_0xa06587,_0x3f753f){var _0x10344d=function(_0x2a25a8){while(--_0x2a25a8){_0xa06587['push'](_0xa06587['shift']());}};_0x10344d(++_0x3f753f);}(_0xa055,0x68));var _0x5a05=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0xa055[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0x5a05('0x0'));var util=require(_0x5a05('0x1'));var logger=require('../../config/logger')(_0x5a05('0x2'));var moment=require(_0x5a05('0x3'));var BPromise=require(_0x5a05('0x4'));var rp=require(_0x5a05('0x5'));var fs=require('fs');var path=require(_0x5a05('0x6'));var rimraf=require('rimraf');var config=require(_0x5a05('0x7'));var attributes=require(_0x5a05('0x8'));module['exports']=function(_0x2c7170,_0x4fcb68){return _0x2c7170[_0x5a05('0x9')](_0x5a05('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5a05('0xb'),'fields':['subject','to'],'type':_0x5a05('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe15c3e,_0x2cfabf,_0x46e88a){if(_0xe15c3e[_0x5a05('0xd')]){_0xe15c3e[_0x5a05('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xe15c3e[_0x5a05('0xf')]){_0xe15c3e[_0x5a05('0x10')]=moment()[_0x5a05('0x11')](_0x5a05('0x12'));}_0x46e88a(null,_0x2cfabf);},'beforeUpdate':function(_0x471d57,_0x20bb71,_0x406036){if(_0x471d57[_0x5a05('0x13')]('substatus')){_0x471d57[_0x5a05('0xe')]=_0x471d57[_0x5a05('0xd')]?moment()[_0x5a05('0x11')](_0x5a05('0x12')):null;}if(_0x471d57[_0x5a05('0x13')](_0x5a05('0xf'))){_0x471d57[_0x5a05('0x10')]=moment()[_0x5a05('0x11')](_0x5a05('0x12'));_0x471d57[_0x5a05('0xd')]=null;_0x471d57['substatusAt']=null;}_0x406036(null,_0x471d57);},'afterUpdate':function(_0x1ea11c,_0x38de3f,_0x30c7ad){var _0x5c50ab=_0x2c7170['models'];var _0x55a18b=_0x1ea11c[_0x5a05('0x14')]({'plain':!![]});if(_0x55a18b[_0x5a05('0xf')]){return _0x5c50ab[_0x5a05('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x55a18b['id']}})[_0x5a05('0x16')](function(){_0x30c7ad();})['catch'](function(_0x3c4813){_0x30c7ad(_0x3c4813);});}else{_0x30c7ad();}}},'charset':_0x5a05('0x17'),'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 799e9b4..8b10071 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 _0xb0d7=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailInteraction','body','options','where','UpdateMailInteraction','stringify','catch','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s'];(function(_0x21cd36,_0x2aa6b2){var _0x3ff267=function(_0x2eb8c9){while(--_0x2eb8c9){_0x21cd36['push'](_0x21cd36['shift']());}};_0x3ff267(++_0x2aa6b2);}(_0xb0d7,0xb0));var _0x7b0d=function(_0x2e0475,_0x1eca9a){_0x2e0475=_0x2e0475-0x0;var _0x40cd05=_0xb0d7[_0x2e0475];return _0x40cd05;};'use strict';var _=require(_0x7b0d('0x0'));var util=require('util');var moment=require(_0x7b0d('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b0d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b0d('0x3'))['db'];var utils=require(_0x7b0d('0x4'));var logger=require(_0x7b0d('0x5'))(_0x7b0d('0x6'));var config=require(_0x7b0d('0x7'));var jayson=require(_0x7b0d('0x8'));var client=jayson[_0x7b0d('0x9')]['http']({'port':0x232a});config[_0x7b0d('0xa')]=_[_0x7b0d('0xb')](config[_0x7b0d('0xa')],{'host':_0x7b0d('0xc'),'port':0x18eb});var socket=require(_0x7b0d('0xd'))(new Redis(config[_0x7b0d('0xa')]));require('./mailInteraction.socket')[_0x7b0d('0xe')](socket);function respondWithRpcPromise(_0x2bde34,_0x428aff,_0x169d4f){return new BPromise(function(_0x36c26e,_0x4d344f){return client[_0x7b0d('0xf')](_0x2bde34,_0x169d4f)[_0x7b0d('0x10')](function(_0x5daf6a){logger[_0x7b0d('0x11')](_0x7b0d('0x12'),_0x428aff,'request\x20sent');logger[_0x7b0d('0x13')](_0x7b0d('0x14'),_0x428aff,_0x7b0d('0x15'),JSON['stringify'](_0x5daf6a));if(_0x5daf6a[_0x7b0d('0x16')]){if(_0x5daf6a['error'][_0x7b0d('0x17')]===0x1f4){logger[_0x7b0d('0x16')](_0x7b0d('0x12'),_0x428aff,_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);return _0x4d344f(_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);}logger[_0x7b0d('0x16')]('MailInteraction,\x20%s,\x20%s',_0x428aff,_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);return _0x36c26e(_0x5daf6a[_0x7b0d('0x16')]['message']);}else{logger[_0x7b0d('0x11')](_0x7b0d('0x12'),_0x428aff,_0x7b0d('0x15'));_0x36c26e(_0x5daf6a[_0x7b0d('0x19')][_0x7b0d('0x18')]);}})['catch'](function(_0xff406){logger['error'](_0x7b0d('0x12'),_0x428aff,_0xff406);_0x4d344f(_0xff406);});});}exports['UpdateMailInteraction']=function(_0x58d2a7){var _0x59b9d3=this;return new Promise(function(_0xf4b040,_0x4cf1ff){return db[_0x7b0d('0x1a')]['update'](_0x58d2a7[_0x7b0d('0x1b')],{'raw':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')][_0x7b0d('0x1d')]||null:null,'attributes':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['attributes']||null:null,'limit':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['limit']||null:null})[_0x7b0d('0x10')](function(_0x4d2d6d){logger['info'](_0x7b0d('0x1e'),_0x58d2a7);logger['debug']('UpdateMailInteraction',_0x58d2a7,JSON[_0x7b0d('0x1f')](_0x4d2d6d));_0xf4b040(_0x4d2d6d);})[_0x7b0d('0x20')](function(_0x2d3a98){logger['error'](_0x7b0d('0x1e'),_0x2d3a98[_0x7b0d('0x18')],_0x58d2a7);_0x4cf1ff(_0x59b9d3[_0x7b0d('0x16')](0x1f4,_0x2d3a98[_0x7b0d('0x18')]));});});};exports[_0x7b0d('0x21')]=function(_0xb4bd06){return new Promise(function(_0x3b4e,_0x4a0870){return db[_0x7b0d('0x1a')]['find']({'where':_0xb4bd06[_0x7b0d('0x1c')]?_0xb4bd06[_0x7b0d('0x1c')]['where']||null:null})[_0x7b0d('0x10')](function(_0x577845){if(_0x577845){return _0x577845[_0x7b0d('0x22')](_0xb4bd06['body'][_0x7b0d('0x23')],_[_0x7b0d('0x24')](_0xb4bd06[_0x7b0d('0x1b')],[_0x7b0d('0x23'),'id'])||{});}})[_0x7b0d('0x25')](function(_0x22d751){logger[_0x7b0d('0x11')](_0x7b0d('0x26'),_0xb4bd06);logger[_0x7b0d('0x13')](_0x7b0d('0x26'),_0xb4bd06,JSON['stringify'](_0x22d751));_0x3b4e(_0x22d751);})[_0x7b0d('0x20')](function(_0x1bebd9){logger['error']('AddTags',_0x1bebd9[_0x7b0d('0x18')],_0xb4bd06);_0x4a0870(_this[_0x7b0d('0x16')](0x1f4,_0x1bebd9[_0x7b0d('0x18')]));});});}; \ No newline at end of file +var _0x58b4=['info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','options','raw','where','attributes','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','then'];(function(_0x1b37ca,_0x38ac2d){var _0x3bbcca=function(_0x2852cd){while(--_0x2852cd){_0x1b37ca['push'](_0x1b37ca['shift']());}};_0x3bbcca(++_0x38ac2d);}(_0x58b4,0xb7));var _0x458b=function(_0xbfabe2,_0x59823f){_0xbfabe2=_0xbfabe2-0x0;var _0x100aec=_0x58b4[_0xbfabe2];return _0x100aec;};'use strict';var _=require('lodash');var util=require(_0x458b('0x0'));var moment=require(_0x458b('0x1'));var BPromise=require(_0x458b('0x2'));var rs=require(_0x458b('0x3'));var fs=require('fs');var Redis=require(_0x458b('0x4'));var db=require(_0x458b('0x5'))['db'];var utils=require(_0x458b('0x6'));var logger=require(_0x458b('0x7'))(_0x458b('0x8'));var config=require('../../config/environment');var jayson=require(_0x458b('0x9'));var client=jayson[_0x458b('0xa')][_0x458b('0xb')]({'port':0x232a});config[_0x458b('0xc')]=_[_0x458b('0xd')](config[_0x458b('0xc')],{'host':_0x458b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458b('0xc')]));require('./mailInteraction.socket')[_0x458b('0xf')](socket);function respondWithRpcPromise(_0x3808d1,_0x34e0d1,_0x40031a){return new BPromise(function(_0x1e2c50,_0x3aeb9f){return client['request'](_0x3808d1,_0x40031a)[_0x458b('0x10')](function(_0x2b2bee){logger[_0x458b('0x11')](_0x458b('0x12'),_0x34e0d1,'request\x20sent');logger[_0x458b('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x34e0d1,_0x458b('0x14'),JSON[_0x458b('0x15')](_0x2b2bee));if(_0x2b2bee['error']){if(_0x2b2bee[_0x458b('0x16')][_0x458b('0x17')]===0x1f4){logger[_0x458b('0x16')]('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);return _0x3aeb9f(_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);}logger[_0x458b('0x16')](_0x458b('0x12'),_0x34e0d1,_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);return _0x1e2c50(_0x2b2bee[_0x458b('0x16')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x458b('0x14'));_0x1e2c50(_0x2b2bee[_0x458b('0x19')]['message']);}})[_0x458b('0x1a')](function(_0x5c8c6e){logger[_0x458b('0x16')]('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x5c8c6e);_0x3aeb9f(_0x5c8c6e);});});}exports[_0x458b('0x1b')]=function(_0x5006a5){var _0x20ba43=this;return new Promise(function(_0x4bd98c,_0x25ef98){return db['MailInteraction']['update'](_0x5006a5['body'],{'raw':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1e')]||null:null,'attributes':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1f')]||null:null,'limit':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')]['limit']||null:null})['then'](function(_0x5e5c8f){logger[_0x458b('0x11')](_0x458b('0x1b'),_0x5006a5);logger[_0x458b('0x13')](_0x458b('0x1b'),_0x5006a5,JSON['stringify'](_0x5e5c8f));_0x4bd98c(_0x5e5c8f);})[_0x458b('0x1a')](function(_0x1c9503){logger[_0x458b('0x16')](_0x458b('0x1b'),_0x1c9503[_0x458b('0x18')],_0x5006a5);_0x25ef98(_0x20ba43[_0x458b('0x16')](0x1f4,_0x1c9503[_0x458b('0x18')]));});});};exports[_0x458b('0x20')]=function(_0x572398){return new Promise(function(_0x4b751d,_0x3062e7){return db[_0x458b('0x21')]['find']({'where':_0x572398[_0x458b('0x1c')]?_0x572398[_0x458b('0x1c')][_0x458b('0x1e')]||null:null})['then'](function(_0x129266){if(_0x129266){return _0x129266[_0x458b('0x22')](_0x572398['body'][_0x458b('0x23')],_[_0x458b('0x24')](_0x572398[_0x458b('0x25')],[_0x458b('0x23'),'id'])||{});}})[_0x458b('0x26')](function(_0x40ad8d){logger[_0x458b('0x11')](_0x458b('0x27'),_0x572398);logger[_0x458b('0x13')](_0x458b('0x27'),_0x572398,JSON[_0x458b('0x15')](_0x40ad8d));_0x4b751d(_0x40ad8d);})[_0x458b('0x1a')](function(_0xcf1d5e){logger[_0x458b('0x16')]('AddTags',_0xcf1d5e['message'],_0x572398);_0x3062e7(_this['error'](0x1f4,_0xcf1d5e[_0x458b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 05f9763..9b83303 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 _0x350b=['update','emit','register','length','mailInteraction:','./mailInteraction.events'];(function(_0xcc1266,_0x27ba6d){var _0x34e46a=function(_0x623c34){while(--_0x623c34){_0xcc1266['push'](_0xcc1266['shift']());}};_0x34e46a(++_0x27ba6d);}(_0x350b,0x14f));var _0xb350=function(_0x1783f4,_0x122040){_0x1783f4=_0x1783f4-0x0;var _0x5c97af=_0x350b[_0x1783f4];return _0x5c97af;};'use strict';var MailInteractionEvents=require(_0xb350('0x0'));var events=['save','remove',_0xb350('0x1')];function createListener(_0x3901a1,_0x48c025){return function(_0x3c2ecf){_0x48c025[_0xb350('0x2')](_0x3901a1,_0x3c2ecf);};}function removeListener(_0x9952c,_0x57b4c1){return function(){MailInteractionEvents['removeListener'](_0x9952c,_0x57b4c1);};}exports[_0xb350('0x3')]=function(_0x30375b){for(var _0x48a7c8=0x0,_0x4adb06=events[_0xb350('0x4')];_0x48a7c8<_0x4adb06;_0x48a7c8++){var _0x454514=events[_0x48a7c8];var _0x1606a5=createListener(_0xb350('0x5')+_0x454514,_0x30375b);MailInteractionEvents['on'](_0x454514,_0x1606a5);}}; \ No newline at end of file +var _0xef3a=['remove','update','emit','register','length','./mailInteraction.events','save'];(function(_0x2e72c9,_0x3e3787){var _0x4a7e3b=function(_0x506fe3){while(--_0x506fe3){_0x2e72c9['push'](_0x2e72c9['shift']());}};_0x4a7e3b(++_0x3e3787);}(_0xef3a,0xc2));var _0xaef3=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xef3a[_0x118653];return _0xc11fa6;};'use strict';var MailInteractionEvents=require(_0xaef3('0x0'));var events=[_0xaef3('0x1'),_0xaef3('0x2'),_0xaef3('0x3')];function createListener(_0x1b82c5,_0x2507bc){return function(_0x24cf10){_0x2507bc[_0xaef3('0x4')](_0x1b82c5,_0x24cf10);};}function removeListener(_0x13b0f7,_0x3522e6){return function(){MailInteractionEvents['removeListener'](_0x13b0f7,_0x3522e6);};}exports[_0xaef3('0x5')]=function(_0x32fc90){for(var _0x25e363=0x0,_0xdc9157=events[_0xaef3('0x6')];_0x25e363<_0xdc9157;_0x25e363++){var _0x4753c3=events[_0x25e363];var _0x111eb7=createListener('mailInteraction:'+_0x4753c3,_0x32fc90);MailInteractionEvents['on'](_0x4753c3,_0x111eb7);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 9bc88db..b28c352 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4473=['/describe','isAuthenticated','describe'];(function(_0x2f469b,_0x3dffd9){var _0xe6e9b9=function(_0x45e1a7){while(--_0x45e1a7){_0x2f469b['push'](_0x2f469b['shift']());}};_0xe6e9b9(++_0x3dffd9);}(_0x4473,0x15c));var _0x3447=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x4473[_0x5608a3];return _0x1ed50a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get'](_0x3447('0x0'),auth[_0x3447('0x1')](),controller[_0x3447('0x2')]);module['exports']=router; \ No newline at end of file +var _0xc130=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated','describe','exports','express','Router'];(function(_0xfaa5e5,_0x13edad){var _0x4c0e1d=function(_0x4fb8d1){while(--_0x4fb8d1){_0xfaa5e5['push'](_0xfaa5e5['shift']());}};_0x4c0e1d(++_0x13edad);}(_0xc130,0x7c));var _0x0c13=function(_0x5e5168,_0x479061){_0x5e5168=_0x5e5168-0x0;var _0x380924=_0xc130[_0x5e5168];return _0x380924;};'use strict';var express=require(_0x0c13('0x0'));var router=express[_0x0c13('0x1')]();var auth=require(_0x0c13('0x2'));var controller=require(_0x0c13('0x3'));router[_0x0c13('0x4')](_0x0c13('0x5'),auth[_0x0c13('0x6')](),controller[_0x0c13('0x7')]);module[_0x0c13('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index c4c0a3a..ad035dc 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x393dee,_0x5ed5cc){var _0x5cdba3=function(_0x440d64){while(--_0x440d64){_0x393dee['push'](_0x393dee['shift']());}};_0x5cdba3(++_0x5ed5cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x37ce97,_0xcbc261){var _0x590daa=function(_0x53a879){while(--_0x53a879){_0x37ce97['push'](_0x37ce97['shift']());}};_0x590daa(++_0xcbc261);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index f2ee348..44602fc 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70ce=['sequelize','exports','INTEGER'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x70ce,0x1d7));var _0xe70c=function(_0x5d9999,_0x3f0321){_0x5d9999=_0x5d9999-0x0;var _0x1d15ed=_0x70ce[_0x5d9999];return _0x1d15ed;};'use strict';var Sequelize=require(_0xe70c('0x0'));module[_0xe70c('0x1')]={'MailInteractionId':{'type':Sequelize[_0xe70c('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xe70c('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xed70=['INTEGER','exports'];(function(_0x44c296,_0x449415){var _0x1b9b44=function(_0x2f3194){while(--_0x2f3194){_0x44c296['push'](_0x44c296['shift']());}};_0x1b9b44(++_0x449415);}(_0xed70,0xa1));var _0x0ed7=function(_0x13544b,_0x25fcd3){_0x13544b=_0x13544b-0x0;var _0x1f4ee4=_0xed70[_0x13544b];return _0x1f4ee4;};'use strict';var Sequelize=require('sequelize');module[_0x0ed7('0x0')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x0ed7('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index e6b7a14..ecf8d65 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3090=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0xe01b5,_0x1787bd){var _0x3113dc=function(_0x56029d){while(--_0x56029d){_0xe01b5['push'](_0xe01b5['shift']());}};_0x3113dc(++_0x1787bd);}(_0x3090,0xf1));var _0x0309=function(_0x2e9c1f,_0x19c688){_0x2e9c1f=_0x2e9c1f-0x0;var _0xcecc3e=_0x3090[_0x2e9c1f];return _0xcecc3e;};'use strict';var attributes=require(_0x0309('0x0'));module[_0x0309('0x1')]=function(_0x3d761d){return _0x3d761d[_0x0309('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x0309('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd724=['exports','define','MailInteractionHasTag'];(function(_0x2b1f02,_0x253c90){var _0x196149=function(_0x4f5dc5){while(--_0x4f5dc5){_0x2b1f02['push'](_0x2b1f02['shift']());}};_0x196149(++_0x253c90);}(_0xd724,0x1f2));var _0x4d72=function(_0x263c5d,_0x57edc1){_0x263c5d=_0x263c5d-0x0;var _0x5c0fc2=_0xd724[_0x263c5d];return _0x5c0fc2;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x4d72('0x0')]=function(_0x4b59c3){return _0x4b59c3[_0x4d72('0x1')](_0x4d72('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b199a29..6632e73 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 _0x6de9=['express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6de9,0xe6));var _0x96de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6de9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var path=require(_0x96de('0x2'));var timeout=require(_0x96de('0x3'));var express=require(_0x96de('0x4'));var router=express['Router']();var fs_extra=require(_0x96de('0x5'));var auth=require(_0x96de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96de('0x7'));var controller=require(_0x96de('0x8'));router['get']('/',auth[_0x96de('0x9')](),controller[_0x96de('0xa')]);router[_0x96de('0xb')](_0x96de('0xc'),auth['isAuthenticated'](),controller[_0x96de('0xd')]);router[_0x96de('0xb')](_0x96de('0xe'),auth['isAuthenticated'](),controller[_0x96de('0xf')]);router[_0x96de('0xb')](_0x96de('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x96de('0x11')]('/',auth[_0x96de('0x9')](),interaction['tracked'](_0x96de('0x12'),_0x96de('0x13')),controller['create']);router['put'](_0x96de('0xe'),auth[_0x96de('0x9')](),controller['update']);router[_0x96de('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x96de('0x15')]);router[_0x96de('0x14')](_0x96de('0x16'),auth[_0x96de('0x9')](),controller[_0x96de('0x17')]);router['delete'](_0x96de('0xe'),auth[_0x96de('0x9')](),controller[_0x96de('0x18')]);module[_0x96de('0x19')]=router; \ No newline at end of file +var _0x6c50=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','mailmessage:create','put','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout'];(function(_0x595e03,_0x3d8714){var _0x484879=function(_0x1e8a1f){while(--_0x1e8a1f){_0x595e03['push'](_0x595e03['shift']());}};_0x484879(++_0x3d8714);}(_0x6c50,0xa4));var _0x06c5=function(_0x535538,_0x4b4f88){_0x535538=_0x535538-0x0;var _0x3ffee6=_0x6c50[_0x535538];return _0x3ffee6;};'use strict';var multer=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var path=require(_0x06c5('0x2'));var timeout=require(_0x06c5('0x3'));var express=require('express');var router=express[_0x06c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06c5('0x5'));var interaction=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var controller=require(_0x06c5('0x8'));router[_0x06c5('0x9')]('/',auth[_0x06c5('0xa')](),controller[_0x06c5('0xb')]);router[_0x06c5('0x9')](_0x06c5('0xc'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xd')]);router['get'](_0x06c5('0xe'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xf')]);router[_0x06c5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x06c5('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x06c5('0x11')),controller['create']);router[_0x06c5('0x12')](_0x06c5('0xe'),auth[_0x06c5('0xa')](),controller['update']);router[_0x06c5('0x12')](_0x06c5('0x13'),auth[_0x06c5('0xa')](),controller[_0x06c5('0x14')]);router['put']('/:id/reject',auth[_0x06c5('0xa')](),controller[_0x06c5('0x15')]);router[_0x06c5('0x16')]('/:id',auth[_0x06c5('0xa')](),controller[_0x06c5('0x17')]);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 91278c8..0c23165 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 _0x35f9=['DATE','Email','Chat','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0x563e94,_0x469aa0){var _0x433ec5=function(_0x5b2124){while(--_0x5b2124){_0x563e94['push'](_0x563e94['shift']());}};_0x433ec5(++_0x469aa0);}(_0x35f9,0x1d7));var _0x935f=function(_0x2be3b5,_0x2833f4){_0x2be3b5=_0x2be3b5-0x0;var _0x18a076=_0x35f9[_0x2be3b5];return _0x18a076;};'use strict';var Sequelize=require(_0x935f('0x0'));var _=require('lodash');module[_0x935f('0x1')]={'body':{'type':Sequelize[_0x935f('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x3'))},'read':{'type':Sequelize[_0x935f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x935f('0x5')]('in',_0x935f('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x935f('0x7')](0x1fe)},'from':{'type':Sequelize[_0x935f('0x7')]},'to':{'type':Sequelize[_0x935f('0x2')]('long')},'cc':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0x935f('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x935f('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x935f('0x9')]},'originTo':{'type':Sequelize[_0x935f('0x2')]('long')},'originCc':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x8'))},'originChannel':{'type':Sequelize[_0x935f('0x5')](_0x935f('0xa'),_0x935f('0xb')),'defaultValue':_0x935f('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xf315=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x184d73,_0x5869de){var _0x275f11=function(_0x2ca3bd){while(--_0x2ca3bd){_0x184d73['push'](_0x184d73['shift']());}};_0x275f11(++_0x5869de);}(_0xf315,0x130));var _0x5f31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf315[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5f31('0x0'));var _=require(_0x5f31('0x1'));module[_0x5f31('0x2')]={'body':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5f31('0x5'))},'read':{'type':Sequelize[_0x5f31('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5f31('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5f31('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5f31('0x8')]},'to':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'cc':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'bcc':{'type':Sequelize[_0x5f31('0x3')]('long')},'subject':{'type':Sequelize[_0x5f31('0x3')]},'sentAt':{'type':Sequelize[_0x5f31('0x9')]},'attach':{'type':Sequelize[_0x5f31('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5f31('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5f31('0x9')]},'originTo':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'originCc':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'originChannel':{'type':Sequelize[_0x5f31('0xb')](_0x5f31('0xc'),_0x5f31('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 09cef06..3a04057 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 _0xa256=['find','params','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','basename','CmContact','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','UserId','user','agent','get','MailInteraction','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','reject','fromString','EventManager','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','join','unlinkSync','moment','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','status','offset','undefined','limit','count','set','Content-Range','json','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','intersection','includeAll','include','update','body'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xa256,0xe1));var _0x6a25=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xa256[_0x3826ad];return _0x17b900;};'use strict';var emlformat=require('eml-format');var moment=require(_0x6a25('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6a25('0x1'));var Redis=require(_0x6a25('0x2'));var htmlToText=require(_0x6a25('0x3'));var interactionService=require(_0x6a25('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6a25('0x5'))(_0x6a25('0x6'));var interaction_log=require(_0x6a25('0x5'))('mail-interactions');var config=require(_0x6a25('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6a25('0x8'),'port':0x18eb});var socket=require(_0x6a25('0x9'))(new Redis(config['redis']));var htmlEntities=require(_0x6a25('0xa'));require(_0x6a25('0xb'))[_0x6a25('0xc')](socket);var jayson=require(_0x6a25('0xd'));var client=jayson['client'][_0x6a25('0xe')]({'port':0x232c});var client9003=jayson[_0x6a25('0xf')][_0x6a25('0xe')]({'port':0x232b});var client9002=jayson[_0x6a25('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1bb9,_0x3fd6b4,_0x389d5a,_0x51e915){return new Promise(function(_0x36f8df,_0x57f5d7){var _0xede72c=_0x51e915||client;return _0xede72c['request'](_0x4f1bb9,_0x389d5a)[_0x6a25('0x10')](function(_0x2f3601){logger[_0x6a25('0x11')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x6a25('0x12'));logger[_0x6a25('0x13')](_0x6a25('0x14'),_0x3fd6b4,_0x6a25('0x12'),JSON[_0x6a25('0x15')](_0x2f3601));if(_0x2f3601[_0x6a25('0x16')]){if(_0x2f3601[_0x6a25('0x16')][_0x6a25('0x17')]===0x1f4){logger[_0x6a25('0x16')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x2f3601[_0x6a25('0x16')][_0x6a25('0x18')]);return _0x57f5d7(_0x2f3601['error'][_0x6a25('0x18')]);}logger[_0x6a25('0x16')](_0x6a25('0x19'),_0x3fd6b4,_0x2f3601[_0x6a25('0x16')][_0x6a25('0x18')]);return _0x36f8df(_0x2f3601[_0x6a25('0x16')]['message']);}else{logger['info'](_0x6a25('0x19'),_0x3fd6b4,'request\x20sent');_0x36f8df(_0x2f3601[_0x6a25('0x1a')][_0x6a25('0x18')]);}})['catch'](function(_0x2e48a7){logger[_0x6a25('0x16')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x2e48a7);_0x57f5d7(_0x2e48a7);});});}function respondWithResult(_0x238cea,_0x22b004){_0x22b004=_0x22b004||0xc8;return function(_0x2ce37f){if(_0x2ce37f){return _0x238cea[_0x6a25('0x1b')](_0x22b004)['json'](_0x2ce37f);}};}function respondWithFilteredResult(_0xcca4b5,_0x552faf){return function(_0x2dbaaf){if(_0x2dbaaf){var _0x4b1490=typeof _0x552faf[_0x6a25('0x1c')]===_0x6a25('0x1d')&&typeof _0x552faf[_0x6a25('0x1e')]===_0x6a25('0x1d');var _0x28ecc6=_0x2dbaaf[_0x6a25('0x1f')];var _0x21bab8=_0x4b1490?0x0:_0x552faf[_0x6a25('0x1c')];var _0xe32cff=_0x4b1490?_0x2dbaaf[_0x6a25('0x1f')]:_0x552faf['offset']+_0x552faf[_0x6a25('0x1e')];var _0x215efa;if(_0xe32cff>=_0x28ecc6){_0xe32cff=_0x28ecc6;_0x215efa=0xc8;}else{_0x215efa=0xce;}_0xcca4b5['status'](_0x215efa);return _0xcca4b5[_0x6a25('0x20')](_0x6a25('0x21'),_0x21bab8+'-'+_0xe32cff+'/'+_0x28ecc6)[_0x6a25('0x22')](_0x2dbaaf);}return null;};}function saveUpdates(_0x29db29){return function(_0x38ea62){if(_0x38ea62){return _0x38ea62['update'](_0x29db29)[_0x6a25('0x10')](function(_0x1ee137){return _0x1ee137;});}return null;};}function removeEntity(_0x34e9f1){return function(_0x4058bf){if(_0x4058bf){return _0x4058bf[_0x6a25('0x23')]()[_0x6a25('0x10')](function(){_0x34e9f1[_0x6a25('0x1b')](0xcc)[_0x6a25('0x24')]();});}};}function handleEntityNotFound(_0x150f11){return function(_0x577388){if(!_0x577388){_0x150f11['sendStatus'](0x194);}return _0x577388;};}function handleError(_0x510648,_0xdf86c5){_0xdf86c5=_0xdf86c5||0x1f4;return function(_0x33467a){logger[_0x6a25('0x16')](_0x33467a['stack']);if(_0x33467a['name']){delete _0x33467a[_0x6a25('0x25')];}_0x510648[_0x6a25('0x1b')](_0xdf86c5)[_0x6a25('0x26')](_0x33467a);};}exports[_0x6a25('0x27')]=function(_0xf2fa36,_0x2a3939){var _0x2bdb04={},_0xf8c721={},_0x591328={'count':0x0,'rows':[]};var _0x2abdd2=_[_0x6a25('0x28')](db[_0x6a25('0x29')][_0x6a25('0x2a')],function(_0x3c9daa){return{'name':_0x3c9daa[_0x6a25('0x2b')],'type':_0x3c9daa[_0x6a25('0x2c')]['key']};});_0xf8c721[_0x6a25('0x2d')]=_['map'](_0x2abdd2,_0x6a25('0x25'));_0xf8c721[_0x6a25('0x2e')]=_['keys'](_0xf2fa36['query']);_0xf8c721[_0x6a25('0x2f')]=_['intersection'](_0xf8c721[_0x6a25('0x2d')],_0xf8c721[_0x6a25('0x2e')]);_0x2bdb04['attributes']=_['intersection'](_0xf8c721['model'],qs[_0x6a25('0x30')](_0xf2fa36[_0x6a25('0x2e')]['fields']));_0x2bdb04[_0x6a25('0x31')]=_0x2bdb04[_0x6a25('0x31')][_0x6a25('0x32')]?_0x2bdb04['attributes']:_0xf8c721[_0x6a25('0x2d')];if(!_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x33')]('nolimit')){_0x2bdb04[_0x6a25('0x1e')]=qs['limit'](_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x1e')]);_0x2bdb04[_0x6a25('0x1c')]=qs['offset'](_0xf2fa36[_0x6a25('0x2e')]['offset']);}_0x2bdb04[_0x6a25('0x34')]=qs[_0x6a25('0x35')](_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x35')]);_0x2bdb04[_0x6a25('0x36')]=qs[_0x6a25('0x2f')](_[_0x6a25('0x37')](_0xf2fa36[_0x6a25('0x2e')],_0xf8c721[_0x6a25('0x2f')]),_0x2abdd2);if(_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x38')]){_0x2bdb04[_0x6a25('0x36')]=_[_0x6a25('0x39')](_0x2bdb04['where'],{'$or':_[_0x6a25('0x28')](_0x2abdd2,function(_0x3d6062){if(_0x3d6062[_0x6a25('0x2c')]!==_0x6a25('0x3a')){var _0x50487f={};_0x50487f[_0x3d6062['name']]={'$like':'%'+_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x38')]+'%'};return _0x50487f;}})});}_0x2bdb04=_['merge']({},_0x2bdb04,_0xf2fa36[_0x6a25('0x3b')]);var _0x26da39={'where':_0x2bdb04[_0x6a25('0x36')]};return db[_0x6a25('0x29')][_0x6a25('0x1f')](_0x26da39)[_0x6a25('0x10')](function(_0x4d584d){_0x591328[_0x6a25('0x1f')]=_0x4d584d;if(_0xf2fa36[_0x6a25('0x2e')]['includeAll']){_0x2bdb04['include']=[{'all':!![]}];}return db[_0x6a25('0x29')][_0x6a25('0x3c')](_0x2bdb04);})[_0x6a25('0x10')](function(_0x1feaf4){_0x591328[_0x6a25('0x3d')]=_0x1feaf4;return _0x591328;})[_0x6a25('0x10')](respondWithFilteredResult(_0x2a3939,_0x2bdb04))[_0x6a25('0x3e')](handleError(_0x2a3939,null));};exports[_0x6a25('0x3f')]=function(_0xe61e03,_0x220254){var _0x5c05a3={'raw':!![],'where':{'id':_0xe61e03['params']['id']}},_0x2c88ac={};_0x2c88ac['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x2c88ac[_0x6a25('0x2e')]=_['keys'](_0xe61e03[_0x6a25('0x2e')]);_0x2c88ac[_0x6a25('0x2f')]=_[_0x6a25('0x40')](_0x2c88ac[_0x6a25('0x2d')],_0x2c88ac[_0x6a25('0x2e')]);_0x5c05a3['attributes']=_[_0x6a25('0x40')](_0x2c88ac[_0x6a25('0x2d')],qs['fields'](_0xe61e03[_0x6a25('0x2e')]['fields']));_0x5c05a3['attributes']=_0x5c05a3[_0x6a25('0x31')][_0x6a25('0x32')]?_0x5c05a3[_0x6a25('0x31')]:_0x2c88ac[_0x6a25('0x2d')];if(_0xe61e03[_0x6a25('0x2e')][_0x6a25('0x41')]){_0x5c05a3[_0x6a25('0x42')]=[{'all':!![]}];}_0x5c05a3=_[_0x6a25('0x39')]({},_0x5c05a3,_0xe61e03[_0x6a25('0x3b')]);return db[_0x6a25('0x29')]['find'](_0x5c05a3)[_0x6a25('0x10')](handleEntityNotFound(_0x220254,null))[_0x6a25('0x10')](respondWithResult(_0x220254,null))[_0x6a25('0x3e')](handleError(_0x220254,null));};exports[_0x6a25('0x43')]=function(_0x17e431,_0x2762e0){if(_0x17e431['body']['id']){delete _0x17e431[_0x6a25('0x44')]['id'];}return db[_0x6a25('0x29')][_0x6a25('0x45')]({'where':{'id':_0x17e431[_0x6a25('0x46')]['id']}})[_0x6a25('0x10')](handleEntityNotFound(_0x2762e0,null))[_0x6a25('0x10')](saveUpdates(_0x17e431['body'],null))['then'](respondWithResult(_0x2762e0,null))[_0x6a25('0x3e')](handleError(_0x2762e0,null));};exports[_0x6a25('0x23')]=function(_0x26e053,_0x8fd620){return db['MailMessage']['find']({'where':{'id':_0x26e053[_0x6a25('0x46')]['id']}})['then'](handleEntityNotFound(_0x8fd620,null))['then'](removeEntity(_0x8fd620,null))[_0x6a25('0x3e')](handleError(_0x8fd620,null));};exports[_0x6a25('0x47')]=function(_0x521789,_0x1af5f6){return db[_0x6a25('0x29')][_0x6a25('0x47')]()[_0x6a25('0x10')](respondWithResult(_0x1af5f6,null))[_0x6a25('0x3e')](handleError(_0x1af5f6,null));};exports[_0x6a25('0x48')]=function(_0xd4618e,_0x9c3556){return db[_0x6a25('0x29')]['create'](_0xd4618e[_0x6a25('0x44')])[_0x6a25('0x10')](function(_0x142fd9){if(_0x142fd9){if(_0x142fd9[_0x6a25('0x49')]===_0x6a25('0x4a')&&!_0x142fd9[_0x6a25('0x4b')]){var _0xc6da7a,_0x5bd60a,_0x4950ed;if(_0xd4618e[_0x6a25('0x44')]['to']){_0x5bd60a=_0xd4618e[_0x6a25('0x44')]['to'][_0x6a25('0x4c')](',')[0x0];}return db[_0x6a25('0x4d')]['findOne']({'where':{'id':_0x142fd9[_0x6a25('0x4e')]},'include':[{'model':db[_0x6a25('0x4f')],'as':_0x6a25('0x50'),'include':[{'model':db['CmContact'],'as':_0x6a25('0x51'),'where':{'email':_0x5bd60a},'limit':0x1,'order':[[_0x6a25('0x52'),'DESC']]}]},{'model':db[_0x6a25('0x53')],'as':_0x6a25('0x54'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a25('0x55'),'raw':!![]}]}]})[_0x6a25('0x10')](function(_0x9e91e7){_0xc6da7a=_0x9e91e7;if(!_0xc6da7a||!_0xc6da7a['Smtp'])return;var _0x4ef13d=_0xc6da7a[_0x6a25('0x56')]();if(_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')]&&_0xd4618e['body'][_0x6a25('0x57')][_0x6a25('0x32')]){for(var _0x344913=0x0;_0x344913<_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x6a25('0x32')];_0x344913+=0x1){_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913]={'filename':_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913][_0x6a25('0x25')],'path':path['join'](config[_0x6a25('0x58')],'server/files/attachments',_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913][_0x6a25('0x59')])};}}_0x4950ed={'account':_0x4ef13d,'message':_0xd4618e[_0x6a25('0x44')]};return;})[_0x6a25('0x10')](function(){if(_0xc6da7a[_0x6a25('0x50')]){if(_0xc6da7a[_0x6a25('0x50')][_0x6a25('0x51')][_0x6a25('0x32')]){return _0xc6da7a[_0x6a25('0x50')][_0x6a25('0x51')][0x0];}else{return db[_0x6a25('0x5a')][_0x6a25('0x48')](_['defaults'](_0xd4618e['body'],{'firstName':_0xd4618e[_0x6a25('0x44')]['to'],'email':_0xd4618e[_0x6a25('0x44')]['to'],'phone':_0xd4618e[_0x6a25('0x44')]['to'],'ListId':_0xc6da7a['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x6a25('0x10')](function(){if(_0x4950ed){return respondWithRpcPromise(_0x6a25('0x5b'),_0x6a25('0x5c'),_0x4950ed,client9003)[_0x6a25('0x10')](function(_0x339635){return _0x142fd9[_0x6a25('0x43')]({'read':!![],'messageId':_0x339635[_0x6a25('0x5d')],'sentAt':moment()[_0x6a25('0x5e')](_0x6a25('0x5f'))});})[_0x6a25('0x3e')](function(_0x366147){logger[_0x6a25('0x16')]('%s',JSON[_0x6a25('0x15')](_0x366147));return _0x142fd9;});}return _0x142fd9;});}return _0x142fd9;}})[_0x6a25('0x10')](respondWithResult(_0x9c3556,0xc9))[_0x6a25('0x3e')](handleError(_0x9c3556,null));};exports[_0x6a25('0x60')]=function(_0x200e11,_0xee414b){var _0x4b5c78=_0x6a25('0x61');return interactionService[_0x6a25('0x62')](_0x200e11,_0x4b5c78)[_0x6a25('0x10')](respondWithResult(_0xee414b,null))[_0x6a25('0x3e')](handleError(_0xee414b,null));};exports['reject']=function(_0x37fa81,_0x5231cb){var _0xc679d9={'agent':{},'channel':'mail'};if(_0x37fa81[_0x6a25('0x44')]['id']){delete _0x37fa81[_0x6a25('0x44')]['id'];}_0x37fa81[_0x6a25('0x44')][_0x6a25('0x63')]=_0x37fa81[_0x6a25('0x44')][_0x6a25('0x63')]||_0x37fa81[_0x6a25('0x64')]['id'];_0xc679d9[_0x6a25('0x65')]['id']=_0x37fa81['body'][_0x6a25('0x63')];return db['MailMessage']['find']({'where':{'id':_0x37fa81[_0x6a25('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5231cb,null))[_0x6a25('0x10')](function(_0x2c39ad){if(_0x2c39ad){_0xc679d9[_0x6a25('0x18')]=_0x2c39ad[_0x6a25('0x66')]({'plain':!![]});return db[_0x6a25('0x67')]['find']({'where':{'id':_0x2c39ad['MailInteractionId']}});}return null;})[_0x6a25('0x10')](handleEntityNotFound(_0x5231cb,null))['then'](function(_0x43accf){if(_0x43accf){_0xc679d9['interaction']=_0x43accf[_0x6a25('0x66')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37fa81[_0x6a25('0x64')]['id'],_0x37fa81[_0x6a25('0x64')][_0x6a25('0x25')],_0x37fa81[_0x6a25('0x64')]['role'],_0xc679d9[_0x6a25('0x68')]['id'],_0x37fa81[_0x6a25('0x44')]?JSON[_0x6a25('0x15')](_0x37fa81['body']):_0x6a25('0x69'));return respondWithRpcPromise(_0x6a25('0x6a'),'rejectMessage',_0xc679d9);}return null;})[_0x6a25('0x10')](function(_0x31920a){var _0x262737=_0x6a25('0x6b')+_0x31920a['message'][_0x6a25('0x6c')];return db['sequelize'][_0x6a25('0x2e')](_0x262737,{'type':db[_0x6a25('0x6d')][_0x6a25('0x6e')][_0x6a25('0x6f')],'raw':!![]})[_0x6a25('0x10')](function(_0x285be7){return _0x285be7;});})[_0x6a25('0x10')](function(_0x47df32){if(_0x47df32){_0xc679d9[_0x6a25('0x18')][_0x6a25('0x70')]=_0x47df32[0x0];if(!_0x37fa81['body'][_0x6a25('0x63')])return;return db[_0x6a25('0x71')][_0x6a25('0x45')]({'where':{'id':_0x37fa81['body'][_0x6a25('0x63')],'role':_0x6a25('0x65')},'attributes':['id',_0x6a25('0x25'),_0x6a25('0x72'),_0x6a25('0x73'),_0x6a25('0x74')],'raw':!![]});}return null;})[_0x6a25('0x10')](function(_0x170bd1){if(!_0x170bd1)return null;_0xc679d9[_0x6a25('0x18')]['agent']=_0x170bd1;return _0xc679d9;})[_0x6a25('0x10')](function(_0x49dfac){if(_0x49dfac){_0x49dfac[_0x6a25('0x18')][_0x6a25('0x75')]=util[_0x6a25('0x5e')](_0x6a25('0x76'),_0x37fa81[_0x6a25('0x64')][_0x6a25('0x25')]);_0x49dfac[_0x6a25('0x18')]['channel']=_0xc679d9[_0x6a25('0x77')];_0x49dfac['message'][_0x6a25('0x78')]=_0xc679d9[_0x6a25('0x77')];_0x49dfac['message'][_0x6a25('0x79')]=_0x6a25('0x7a');_0x49dfac['message'][_0x6a25('0x44')]=htmlToText[_0x6a25('0x7b')](_0xc679d9[_0x6a25('0x18')][_0x6a25('0x44')]);respondWithRpcPromise(_0x6a25('0x7c'),_0x6a25('0x7c'),{'event':'rejectmessage','message':_0x49dfac[_0x6a25('0x18')]},client9002);return _0xc679d9;}return null;})[_0x6a25('0x10')](respondWithResult(_0x5231cb,null))[_0x6a25('0x3e')](handleError(_0x5231cb,null));};exports[_0x6a25('0x7d')]=function(_0x21f7ae,_0xcf4725){var _0x50d3f9=moment()[_0x6a25('0x7e')]()[_0x6a25('0x7f')]();var _0x201c6f=path['join'](config['root'],_0x6a25('0x80'),_0x6a25('0x81'),_0x6a25('0x82'));var _0x189317=path['join'](config[_0x6a25('0x58')],_0x6a25('0x80'),'files',_0x6a25('0x57'));var _0x4d0c98=util[_0x6a25('0x5e')](_0x6a25('0x83'),_0x50d3f9);return db[_0x6a25('0x29')][_0x6a25('0x45')]({'where':{'id':_0x21f7ae[_0x6a25('0x46')]['id']},'attributes':['id',_0x6a25('0x44'),_0x6a25('0x84'),'to','cc',_0x6a25('0x85'),_0x6a25('0x86'),'createdAt'],'include':_0x21f7ae[_0x6a25('0x2e')]['attachments']?[{'model':db[_0x6a25('0x87')],'as':_0x6a25('0x88')}]:undefined})[_0x6a25('0x10')](handleEntityNotFound(_0xcf4725,null))[_0x6a25('0x10')](function(_0x173ef1){if(_0x173ef1){var _0x17cd8c=_0x173ef1;var _0x47d585={'from':_0x17cd8c[_0x6a25('0x84')],'to':_0x17cd8c['to'],'subject':_0x17cd8c[_0x6a25('0x86')],'html':htmlEntities[_0x6a25('0x89')](_0x17cd8c[_0x6a25('0x44')]),'headers':{'Date':moment(_0x17cd8c[_0x6a25('0x8a')])[_0x6a25('0x5e')](_0x6a25('0x8b'))},'attachments':[]};if(_0x173ef1['cc']){_0x47d585[_0x6a25('0x8c')]['Cc']=_0x173ef1['cc'];}if(_0x173ef1['bcc']){_0x47d585[_0x6a25('0x8c')][_0x6a25('0x8d')]=_0x173ef1[_0x6a25('0x85')];}return new Promise(function(_0x4ec0bb,_0x298a0e){if(_0x173ef1[_0x6a25('0x88')]){for(var _0x321e0e=0x0;_0x321e0e<_0x173ef1['Attachments'][_0x6a25('0x32')];_0x321e0e++){var _0xf72c75=_0x173ef1['Attachments'][_0x321e0e];var _0x6aabe6=path['join'](_0x189317,_0xf72c75['basename']);if(fs[_0x6a25('0x8e')](_0x6aabe6)){_0x47d585[_0x6a25('0x57')][_0x6a25('0x8f')]({'name':_0xf72c75[_0x6a25('0x25')],'contentType':_0xf72c75[_0x6a25('0x2c')],'data':fs['readFileSync'](_0x6aabe6)});}}}emlformat[_0x6a25('0x90')](_0x47d585,function(_0x12d9bf,_0x29c4f9){if(_0x12d9bf)return _0x298a0e(_0x12d9bf);fs['writeFileSync'](path[_0x6a25('0x91')](_0x201c6f,_0x4d0c98),_0x29c4f9);return _0x4ec0bb(_0x29c4f9);});});}})['then'](function(_0x47b604){if(_0x47b604){return _0xcf4725['download'](path['join'](_0x201c6f,_0x4d0c98),_0x4d0c98,function(_0x7b0d2a){if(!_0x7b0d2a)fs[_0x6a25('0x92')](path['join'](_0x201c6f,_0x4d0c98));});}})['catch'](handleError(_0xcf4725,null));}; \ No newline at end of file +var _0xcfaf=['existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','api','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','MailMessage','includeAll','rows','length','include','find','catch','body','params','describe','create','out','secret','split','findOne','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','getSmtpOptions','attachments','join','server/files/attachments','ListId','SendMail','sendMail','messageId','format','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','SIP/%s','channel','event','fromString','EventManager','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','basename'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0xcfaf,0x125));var _0xfcfa=function(_0x17197d,_0x5dc148){_0x17197d=_0x17197d-0x0;var _0x355f4f=_0xcfaf[_0x17197d];return _0x355f4f;};'use strict';var emlformat=require(_0xfcfa('0x0'));var moment=require(_0xfcfa('0x1'));var util=require(_0xfcfa('0x2'));var path=require(_0xfcfa('0x3'));var fs=require('fs');var _=require(_0xfcfa('0x4'));var Redis=require(_0xfcfa('0x5'));var htmlToText=require(_0xfcfa('0x6'));var interactionService=require(_0xfcfa('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xfcfa('0x8'));var interaction_log=require(_0xfcfa('0x9'))(_0xfcfa('0xa'));var config=require(_0xfcfa('0xb'));var db=require('../../mysqldb')['db'];config[_0xfcfa('0xc')]=_[_0xfcfa('0xd')](config[_0xfcfa('0xc')],{'host':_0xfcfa('0xe'),'port':0x18eb});var socket=require(_0xfcfa('0xf'))(new Redis(config[_0xfcfa('0xc')]));var htmlEntities=require('html-entities');require(_0xfcfa('0x10'))[_0xfcfa('0x11')](socket);var jayson=require(_0xfcfa('0x12'));var client=jayson['client'][_0xfcfa('0x13')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0xfcfa('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x498094,_0x2f48f8,_0x3eb956,_0x214a1f){return new Promise(function(_0x3e8186,_0x2b581e){var _0xa3feea=_0x214a1f||client;return _0xa3feea['request'](_0x498094,_0x3eb956)[_0xfcfa('0x14')](function(_0x24e4f1){logger[_0xfcfa('0x15')]('MailMessage,\x20%s,\x20%s',_0x2f48f8,_0xfcfa('0x16'));logger[_0xfcfa('0x17')](_0xfcfa('0x18'),_0x2f48f8,'request\x20sent',JSON[_0xfcfa('0x19')](_0x24e4f1));if(_0x24e4f1['error']){if(_0x24e4f1[_0xfcfa('0x1a')][_0xfcfa('0x1b')]===0x1f4){logger['error'](_0xfcfa('0x1c'),_0x2f48f8,_0x24e4f1[_0xfcfa('0x1a')]['message']);return _0x2b581e(_0x24e4f1[_0xfcfa('0x1a')][_0xfcfa('0x1d')]);}logger[_0xfcfa('0x1a')](_0xfcfa('0x1c'),_0x2f48f8,_0x24e4f1[_0xfcfa('0x1a')]['message']);return _0x3e8186(_0x24e4f1[_0xfcfa('0x1a')]['message']);}else{logger[_0xfcfa('0x15')](_0xfcfa('0x1c'),_0x2f48f8,'request\x20sent');_0x3e8186(_0x24e4f1[_0xfcfa('0x1e')]['message']);}})['catch'](function(_0x59d541){logger[_0xfcfa('0x1a')](_0xfcfa('0x1c'),_0x2f48f8,_0x59d541);_0x2b581e(_0x59d541);});});}function respondWithResult(_0x346114,_0x2f0103){_0x2f0103=_0x2f0103||0xc8;return function(_0x91c358){if(_0x91c358){return _0x346114[_0xfcfa('0x1f')](_0x2f0103)[_0xfcfa('0x20')](_0x91c358);}};}function respondWithFilteredResult(_0x23d68e,_0x169a04){return function(_0x323989){if(_0x323989){var _0x22569d=typeof _0x169a04[_0xfcfa('0x21')]===_0xfcfa('0x22')&&typeof _0x169a04[_0xfcfa('0x23')]===_0xfcfa('0x22');var _0x489842=_0x323989[_0xfcfa('0x24')];var _0x4ee554=_0x22569d?0x0:_0x169a04[_0xfcfa('0x21')];var _0x4c5d87=_0x22569d?_0x323989['count']:_0x169a04['offset']+_0x169a04['limit'];var _0x5b61f2;if(_0x4c5d87>=_0x489842){_0x4c5d87=_0x489842;_0x5b61f2=0xc8;}else{_0x5b61f2=0xce;}_0x23d68e[_0xfcfa('0x1f')](_0x5b61f2);return _0x23d68e[_0xfcfa('0x25')](_0xfcfa('0x26'),_0x4ee554+'-'+_0x4c5d87+'/'+_0x489842)[_0xfcfa('0x20')](_0x323989);}return null;};}function saveUpdates(_0x767b50){return function(_0x16dc29){if(_0x16dc29){return _0x16dc29[_0xfcfa('0x27')](_0x767b50)[_0xfcfa('0x14')](function(_0x3c15e2){return _0x3c15e2;});}return null;};}function removeEntity(_0x237447){return function(_0x46ea03){if(_0x46ea03){return _0x46ea03[_0xfcfa('0x28')]()[_0xfcfa('0x14')](function(){_0x237447[_0xfcfa('0x1f')](0xcc)[_0xfcfa('0x29')]();});}};}function handleEntityNotFound(_0x5c4eff){return function(_0x5aaa36){if(!_0x5aaa36){_0x5c4eff[_0xfcfa('0x2a')](0x194);}return _0x5aaa36;};}function handleError(_0x5f23b,_0xf4fa71){_0xf4fa71=_0xf4fa71||0x1f4;return function(_0x323614){logger[_0xfcfa('0x1a')](_0x323614[_0xfcfa('0x2b')]);if(_0x323614[_0xfcfa('0x2c')]){delete _0x323614[_0xfcfa('0x2c')];}_0x5f23b[_0xfcfa('0x1f')](_0xf4fa71)[_0xfcfa('0x2d')](_0x323614);};}exports['index']=function(_0x233099,_0x2cceb5){var _0x19cbf4={},_0x1f00a7={},_0x24682b={'count':0x0,'rows':[]};var _0x2a6e71=_[_0xfcfa('0x2e')](db['MailMessage'][_0xfcfa('0x2f')],function(_0x288622){return{'name':_0x288622[_0xfcfa('0x30')],'type':_0x288622['type'][_0xfcfa('0x31')]};});_0x1f00a7[_0xfcfa('0x32')]=_[_0xfcfa('0x2e')](_0x2a6e71,_0xfcfa('0x2c'));_0x1f00a7['query']=_[_0xfcfa('0x33')](_0x233099['query']);_0x1f00a7['filters']=_[_0xfcfa('0x34')](_0x1f00a7['model'],_0x1f00a7[_0xfcfa('0x35')]);_0x19cbf4[_0xfcfa('0x36')]=_[_0xfcfa('0x34')](_0x1f00a7[_0xfcfa('0x32')],qs[_0xfcfa('0x37')](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x37')]));_0x19cbf4[_0xfcfa('0x36')]=_0x19cbf4[_0xfcfa('0x36')]['length']?_0x19cbf4[_0xfcfa('0x36')]:_0x1f00a7[_0xfcfa('0x32')];if(!_0x233099[_0xfcfa('0x35')][_0xfcfa('0x38')](_0xfcfa('0x39'))){_0x19cbf4[_0xfcfa('0x23')]=qs[_0xfcfa('0x23')](_0x233099['query'][_0xfcfa('0x23')]);_0x19cbf4[_0xfcfa('0x21')]=qs[_0xfcfa('0x21')](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x21')]);}_0x19cbf4[_0xfcfa('0x3a')]=qs['sort'](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x3b')]);_0x19cbf4[_0xfcfa('0x3c')]=qs[_0xfcfa('0x3d')](_[_0xfcfa('0x3e')](_0x233099[_0xfcfa('0x35')],_0x1f00a7[_0xfcfa('0x3d')]),_0x2a6e71);if(_0x233099[_0xfcfa('0x35')]['filter']){_0x19cbf4[_0xfcfa('0x3c')]=_['merge'](_0x19cbf4[_0xfcfa('0x3c')],{'$or':_[_0xfcfa('0x2e')](_0x2a6e71,function(_0x1de8a5){if(_0x1de8a5['type']!=='VIRTUAL'){var _0x3b44df={};_0x3b44df[_0x1de8a5[_0xfcfa('0x2c')]]={'$like':'%'+_0x233099['query']['filter']+'%'};return _0x3b44df;}})});}_0x19cbf4=_[_0xfcfa('0x3f')]({},_0x19cbf4,_0x233099[_0xfcfa('0x40')]);var _0xb03417={'where':_0x19cbf4[_0xfcfa('0x3c')]};return db[_0xfcfa('0x41')]['count'](_0xb03417)[_0xfcfa('0x14')](function(_0x8874ee){_0x24682b[_0xfcfa('0x24')]=_0x8874ee;if(_0x233099['query'][_0xfcfa('0x42')]){_0x19cbf4['include']=[{'all':!![]}];}return db[_0xfcfa('0x41')]['findAll'](_0x19cbf4);})[_0xfcfa('0x14')](function(_0x1ae322){_0x24682b[_0xfcfa('0x43')]=_0x1ae322;return _0x24682b;})[_0xfcfa('0x14')](respondWithFilteredResult(_0x2cceb5,_0x19cbf4))['catch'](handleError(_0x2cceb5,null));};exports['show']=function(_0x2cccbe,_0x3f7d7b){var _0x369474={'raw':!![],'where':{'id':_0x2cccbe['params']['id']}},_0x21d020={};_0x21d020[_0xfcfa('0x32')]=_['keys'](db[_0xfcfa('0x41')][_0xfcfa('0x2f')]);_0x21d020[_0xfcfa('0x35')]=_['keys'](_0x2cccbe[_0xfcfa('0x35')]);_0x21d020[_0xfcfa('0x3d')]=_['intersection'](_0x21d020[_0xfcfa('0x32')],_0x21d020[_0xfcfa('0x35')]);_0x369474[_0xfcfa('0x36')]=_[_0xfcfa('0x34')](_0x21d020[_0xfcfa('0x32')],qs['fields'](_0x2cccbe[_0xfcfa('0x35')][_0xfcfa('0x37')]));_0x369474[_0xfcfa('0x36')]=_0x369474['attributes'][_0xfcfa('0x44')]?_0x369474[_0xfcfa('0x36')]:_0x21d020[_0xfcfa('0x32')];if(_0x2cccbe['query']['includeAll']){_0x369474[_0xfcfa('0x45')]=[{'all':!![]}];}_0x369474=_[_0xfcfa('0x3f')]({},_0x369474,_0x2cccbe[_0xfcfa('0x40')]);return db[_0xfcfa('0x41')][_0xfcfa('0x46')](_0x369474)[_0xfcfa('0x14')](handleEntityNotFound(_0x3f7d7b,null))[_0xfcfa('0x14')](respondWithResult(_0x3f7d7b,null))[_0xfcfa('0x47')](handleError(_0x3f7d7b,null));};exports[_0xfcfa('0x27')]=function(_0x288367,_0x159c79){if(_0x288367[_0xfcfa('0x48')]['id']){delete _0x288367[_0xfcfa('0x48')]['id'];}return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x288367[_0xfcfa('0x49')]['id']}})[_0xfcfa('0x14')](handleEntityNotFound(_0x159c79,null))['then'](saveUpdates(_0x288367['body'],null))[_0xfcfa('0x14')](respondWithResult(_0x159c79,null))[_0xfcfa('0x47')](handleError(_0x159c79,null));};exports[_0xfcfa('0x28')]=function(_0x2095dc,_0x538218){return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x2095dc[_0xfcfa('0x49')]['id']}})['then'](handleEntityNotFound(_0x538218,null))['then'](removeEntity(_0x538218,null))[_0xfcfa('0x47')](handleError(_0x538218,null));};exports[_0xfcfa('0x4a')]=function(_0x59e416,_0x1ac4a5){return db['MailMessage']['describe']()[_0xfcfa('0x14')](respondWithResult(_0x1ac4a5,null))[_0xfcfa('0x47')](handleError(_0x1ac4a5,null));};exports[_0xfcfa('0x4b')]=function(_0x391045,_0x4286e0){return db[_0xfcfa('0x41')][_0xfcfa('0x4b')](_0x391045[_0xfcfa('0x48')])[_0xfcfa('0x14')](function(_0x47ebc3){if(_0x47ebc3){if(_0x47ebc3['direction']===_0xfcfa('0x4c')&&!_0x47ebc3[_0xfcfa('0x4d')]){var _0x414ee8,_0x7377b8,_0x2876ae;if(_0x391045['body']['to']){_0x7377b8=_0x391045[_0xfcfa('0x48')]['to'][_0xfcfa('0x4e')](',')[0x0];}return db['MailAccount'][_0xfcfa('0x4f')]({'where':{'id':_0x47ebc3['MailAccountId']},'include':[{'model':db[_0xfcfa('0x50')],'as':_0xfcfa('0x51'),'include':[{'model':db[_0xfcfa('0x52')],'as':_0xfcfa('0x53'),'where':{'email':_0x7377b8},'limit':0x1,'order':[[_0xfcfa('0x54'),'DESC']]}]},{'model':db[_0xfcfa('0x55')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x478f86){_0x414ee8=_0x478f86;if(!_0x414ee8||!_0x414ee8[_0xfcfa('0x56')])return;var _0x448ad2=_0x414ee8[_0xfcfa('0x57')]();if(_0x391045[_0xfcfa('0x48')]['attachments']&&_0x391045['body'][_0xfcfa('0x58')][_0xfcfa('0x44')]){for(var _0x831db8=0x0;_0x831db8<_0x391045['body'][_0xfcfa('0x58')]['length'];_0x831db8+=0x1){_0x391045[_0xfcfa('0x48')]['attachments'][_0x831db8]={'filename':_0x391045[_0xfcfa('0x48')][_0xfcfa('0x58')][_0x831db8][_0xfcfa('0x2c')],'path':path[_0xfcfa('0x59')](config['root'],_0xfcfa('0x5a'),_0x391045['body'][_0xfcfa('0x58')][_0x831db8]['basename'])};}}_0x2876ae={'account':_0x448ad2,'message':_0x391045['body']};return;})[_0xfcfa('0x14')](function(){if(_0x414ee8[_0xfcfa('0x51')]){if(_0x414ee8['List']['Contacts'][_0xfcfa('0x44')]){return _0x414ee8['List'][_0xfcfa('0x53')][0x0];}else{return db[_0xfcfa('0x52')][_0xfcfa('0x4b')](_[_0xfcfa('0xd')](_0x391045['body'],{'firstName':_0x391045[_0xfcfa('0x48')]['to'],'email':_0x391045[_0xfcfa('0x48')]['to'],'phone':_0x391045[_0xfcfa('0x48')]['to'],'ListId':_0x414ee8[_0xfcfa('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xfcfa('0x14')](function(){if(_0x2876ae){return respondWithRpcPromise(_0xfcfa('0x5c'),_0xfcfa('0x5d'),_0x2876ae,client9003)[_0xfcfa('0x14')](function(_0x488092){return _0x47ebc3[_0xfcfa('0x27')]({'read':!![],'messageId':_0x488092[_0xfcfa('0x5e')],'sentAt':moment()[_0xfcfa('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x963b4c){logger[_0xfcfa('0x1a')]('%s',JSON[_0xfcfa('0x19')](_0x963b4c));return _0x47ebc3;});}return _0x47ebc3;});}return _0x47ebc3;}})[_0xfcfa('0x14')](respondWithResult(_0x4286e0,0xc9))['catch'](handleError(_0x4286e0,null));};exports[_0xfcfa('0x60')]=function(_0x223dde,_0x4ca5b3){var _0xfc8174=_0xfcfa('0x61');return interactionService[_0xfcfa('0x62')](_0x223dde,_0xfc8174)[_0xfcfa('0x14')](respondWithResult(_0x4ca5b3,null))[_0xfcfa('0x47')](handleError(_0x4ca5b3,null));};exports[_0xfcfa('0x63')]=function(_0x173214,_0x23c4e4){var _0x109fb9={'agent':{},'channel':_0xfcfa('0x61')};if(_0x173214[_0xfcfa('0x48')]['id']){delete _0x173214[_0xfcfa('0x48')]['id'];}_0x173214['body']['UserId']=_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')]||_0x173214['user']['id'];_0x109fb9[_0xfcfa('0x65')]['id']=_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')];return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x173214[_0xfcfa('0x49')]['id'],'UserId':null}})[_0xfcfa('0x14')](handleEntityNotFound(_0x23c4e4,null))[_0xfcfa('0x14')](function(_0x39e6d9){if(_0x39e6d9){_0x109fb9[_0xfcfa('0x1d')]=_0x39e6d9[_0xfcfa('0x66')]({'plain':!![]});return db[_0xfcfa('0x67')][_0xfcfa('0x46')]({'where':{'id':_0x39e6d9[_0xfcfa('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x23c4e4,null))['then'](function(_0x338c32){if(_0x338c32){_0x109fb9['interaction']=_0x338c32['get']({'plain':!![]});interaction_log['info'](_0xfcfa('0x69'),_0x173214[_0xfcfa('0x6a')]['id'],_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x2c')],_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x6b')],_0x109fb9['interaction']['id'],_0x173214['body']?JSON['stringify'](_0x173214[_0xfcfa('0x48')]):_0xfcfa('0x6c'));return respondWithRpcPromise(_0xfcfa('0x6d'),'rejectMessage',_0x109fb9);}return null;})[_0xfcfa('0x14')](function(_0x3746e8){var _0x5acf67='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3746e8[_0xfcfa('0x1d')]['ContactId'];return db[_0xfcfa('0x6e')][_0xfcfa('0x35')](_0x5acf67,{'type':db[_0xfcfa('0x6f')][_0xfcfa('0x70')][_0xfcfa('0x71')],'raw':!![]})[_0xfcfa('0x14')](function(_0x31fdc5){return _0x31fdc5;});})[_0xfcfa('0x14')](function(_0x5e3bc3){if(_0x5e3bc3){_0x109fb9[_0xfcfa('0x1d')][_0xfcfa('0x72')]=_0x5e3bc3[0x0];if(!_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')])return;return db['User'][_0xfcfa('0x46')]({'where':{'id':_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')],'role':_0xfcfa('0x65')},'attributes':['id','name','fullname',_0xfcfa('0x73'),_0xfcfa('0x74')],'raw':!![]});}return null;})[_0xfcfa('0x14')](function(_0x1505b3){if(!_0x1505b3)return null;_0x109fb9['message'][_0xfcfa('0x65')]=_0x1505b3;return _0x109fb9;})[_0xfcfa('0x14')](function(_0x3f11db){if(_0x3f11db){_0x3f11db[_0xfcfa('0x1d')]['interface']=util[_0xfcfa('0x5f')](_0xfcfa('0x75'),_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x2c')]);_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x76')]=_0x109fb9[_0xfcfa('0x76')];_0x3f11db['message']['motionChannel']=_0x109fb9[_0xfcfa('0x76')];_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x77')]=_0xfcfa('0x63');_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x48')]=htmlToText[_0xfcfa('0x78')](_0x109fb9[_0xfcfa('0x1d')][_0xfcfa('0x48')]);respondWithRpcPromise(_0xfcfa('0x79'),_0xfcfa('0x79'),{'event':'rejectmessage','message':_0x3f11db[_0xfcfa('0x1d')]},client9002);return _0x109fb9;}return null;})[_0xfcfa('0x14')](respondWithResult(_0x23c4e4,null))[_0xfcfa('0x47')](handleError(_0x23c4e4,null));};exports[_0xfcfa('0x7a')]=function(_0xae8d9e,_0x36d0b4){var _0x575063=moment()[_0xfcfa('0x7b')]()[_0xfcfa('0x7c')]();var _0x4d2ee8=path['join'](config[_0xfcfa('0x7d')],_0xfcfa('0x7e'),_0xfcfa('0x7f'),_0xfcfa('0x80'));var _0x23c909=path[_0xfcfa('0x59')](config['root'],_0xfcfa('0x7e'),'files','attachments');var _0xda6878=util[_0xfcfa('0x5f')](_0xfcfa('0x81'),_0x575063);return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0xae8d9e[_0xfcfa('0x49')]['id']},'attributes':['id',_0xfcfa('0x48'),_0xfcfa('0x82'),'to','cc',_0xfcfa('0x83'),_0xfcfa('0x84'),_0xfcfa('0x85')],'include':_0xae8d9e[_0xfcfa('0x35')][_0xfcfa('0x58')]?[{'model':db[_0xfcfa('0x86')],'as':_0xfcfa('0x87')}]:undefined})[_0xfcfa('0x14')](handleEntityNotFound(_0x36d0b4,null))[_0xfcfa('0x14')](function(_0x3ac958){if(_0x3ac958){var _0x4da023=_0x3ac958;var _0x2358f7={'from':_0x4da023[_0xfcfa('0x82')],'to':_0x4da023['to'],'subject':_0x4da023[_0xfcfa('0x84')],'html':htmlEntities[_0xfcfa('0x88')](_0x4da023[_0xfcfa('0x48')]),'headers':{'Date':moment(_0x4da023['createdAt'])[_0xfcfa('0x5f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3ac958['cc']){_0x2358f7[_0xfcfa('0x89')]['Cc']=_0x3ac958['cc'];}if(_0x3ac958['bcc']){_0x2358f7[_0xfcfa('0x89')]['Bcc']=_0x3ac958[_0xfcfa('0x83')];}return new Promise(function(_0x456dc7,_0x17282f){if(_0x3ac958['Attachments']){for(var _0x4631b1=0x0;_0x4631b1<_0x3ac958[_0xfcfa('0x87')][_0xfcfa('0x44')];_0x4631b1++){var _0x4127c5=_0x3ac958[_0xfcfa('0x87')][_0x4631b1];var _0x386a46=path[_0xfcfa('0x59')](_0x23c909,_0x4127c5[_0xfcfa('0x8a')]);if(fs[_0xfcfa('0x8b')](_0x386a46)){_0x2358f7['attachments'][_0xfcfa('0x8c')]({'name':_0x4127c5[_0xfcfa('0x2c')],'contentType':_0x4127c5['type'],'data':fs[_0xfcfa('0x8d')](_0x386a46)});}}}emlformat[_0xfcfa('0x8e')](_0x2358f7,function(_0x4a5742,_0x2086ea){if(_0x4a5742)return _0x17282f(_0x4a5742);fs['writeFileSync'](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878),_0x2086ea);return _0x456dc7(_0x2086ea);});});}})[_0xfcfa('0x14')](function(_0x4e6894){if(_0x4e6894){return _0x36d0b4[_0xfcfa('0x7a')](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878),_0xda6878,function(_0x239398){if(!_0x239398)fs[_0xfcfa('0x8f')](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878));});}})[_0xfcfa('0x47')](handleError(_0x36d0b4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 95eb4f9..02a50d8 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 _0xb454=['events','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x403225,_0x2bc476){var _0x40b322=function(_0x3742af){while(--_0x3742af){_0x403225['push'](_0x403225['shift']());}};_0x40b322(++_0x2bc476);}(_0xb454,0x1b0));var _0x4b45=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xb454[_0x15ca1a];return _0x507626;};'use strict';var EventEmitter=require(_0x4b45('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x4b45('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4b45('0x2')](0x0);var events={'afterCreate':_0x4b45('0x3'),'afterUpdate':_0x4b45('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e6729){return function(_0x5474c3,_0x42a02e,_0xb8b254){MailMessageEvents['emit'](_0x3e6729+':'+_0x5474c3['id'],_0x5474c3);MailMessageEvents[_0x4b45('0x5')](_0x3e6729,_0x5474c3);_0xb8b254(null);};}for(var e in events){if(events[_0x4b45('0x6')](e)){var event=events[e];MailMessage[_0x4b45('0x7')](e,emitEvent(event));}}module[_0x4b45('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x3740=['remove','emit','hook','MailMessage','save','update'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x3740,0x11d));var _0x0374=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x3740[_0x9cfe28];return _0x54a1d0;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x0374('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0374('0x1'),'afterUpdate':_0x0374('0x2'),'afterDestroy':_0x0374('0x3')};function emitEvent(_0x2ee04f){return function(_0x23898c,_0xa94a7e,_0x2d1b84){MailMessageEvents['emit'](_0x2ee04f+':'+_0x23898c['id'],_0x23898c);MailMessageEvents[_0x0374('0x4')](_0x2ee04f,_0x23898c);_0x2d1b84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0374('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9984a95..3c3b668 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 _0x9ef9=['models','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','direction','catch','error','lodash','util','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString'];(function(_0x322719,_0x16b381){var _0x30cb6f=function(_0x1e5698){while(--_0x1e5698){_0x322719['push'](_0x322719['shift']());}};_0x30cb6f(++_0x16b381);}(_0x9ef9,0x115));var _0x99ef=function(_0x5a2d1a,_0x24af9f){_0x5a2d1a=_0x5a2d1a-0x0;var _0xab3bab=_0x9ef9[_0x5a2d1a];return _0xab3bab;};'use strict';var _=require(_0x99ef('0x0'));var util=require(_0x99ef('0x1'));var logger=require(_0x99ef('0x2'))(_0x99ef('0x3'));var moment=require(_0x99ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x99ef('0x5'));var fs=require('fs');var path=require(_0x99ef('0x6'));var rimraf=require(_0x99ef('0x7'));var config=require(_0x99ef('0x8'));var attributes=require(_0x99ef('0x9'));module[_0x99ef('0xa')]=function(_0x54e897,_0x1736f4){return _0x54e897[_0x99ef('0xb')](_0x99ef('0xc'),attributes,{'tableName':_0x99ef('0xd'),'paranoid':![],'indexes':[{'name':_0x99ef('0xe'),'fields':['messageId']},{'name':_0x99ef('0xf'),'fields':['plainBody',_0x99ef('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x481994,_0x3ad8d7,_0x23d794){if(_0x481994[_0x99ef('0x11')]){_0x481994[_0x99ef('0x12')]=htmlToText[_0x99ef('0x13')](_0x481994['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x23d794(null,_0x3ad8d7);},'afterCreate':function(_0x4874bb,_0xe1fc9b,_0x66f2f8){var _0x568502=_0x54e897[_0x99ef('0x14')];var _0x2280e6=_0x4874bb['get']({'plain':!![]});if(_0x2280e6['direction'][_0x99ef('0x15')]()==='in'||_0x2280e6['direction'][_0x99ef('0x15')]()===_0x99ef('0x16')&&!_0x2280e6[_0x99ef('0x17')]&&!_['isNil'](_0x2280e6[_0x99ef('0x18')])){_0x568502[_0x99ef('0x19')][_0x99ef('0x1a')]({'where':{'id':_0x2280e6[_0x99ef('0x1b')]}})[_0x99ef('0x1c')](function(_0xefc85a){if(_0xefc85a){_0xefc85a[_0x99ef('0x1d')]({'lastMsgAt':_0x2280e6['createdAt'],'lastMsgDirection':_0x2280e6[_0x99ef('0x1e')][_0x99ef('0x15')]()});}})[_0x99ef('0x1f')](function(_0xaa3d55){console[_0x99ef('0x20')](_0xaa3d55);});}_0x66f2f8();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x01d8=['bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x43f6ca,_0x5295ff){var _0x36dcad=function(_0x4c88ec){while(--_0x4c88ec){_0x43f6ca['push'](_0x43f6ca['shift']());}};_0x36dcad(++_0x5295ff);}(_0x01d8,0x88));var _0x801d=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x01d8[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0x801d('0x0'));var util=require(_0x801d('0x1'));var logger=require(_0x801d('0x2'))('api');var moment=require(_0x801d('0x3'));var BPromise=require(_0x801d('0x4'));var rp=require(_0x801d('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x801d('0x6'));var rimraf=require(_0x801d('0x7'));var config=require(_0x801d('0x8'));var attributes=require(_0x801d('0x9'));module[_0x801d('0xa')]=function(_0x4d35c6,_0x5aab08){return _0x4d35c6[_0x801d('0xb')](_0x801d('0xc'),attributes,{'tableName':_0x801d('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x801d('0xe')]},{'name':_0x801d('0xf'),'fields':['plainBody',_0x801d('0x10')],'type':_0x801d('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11d7fa,_0x4d4f4c,_0x17f7e3){if(_0x11d7fa[_0x801d('0x12')]){_0x11d7fa[_0x801d('0x13')]=htmlToText[_0x801d('0x14')](_0x11d7fa[_0x801d('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x17f7e3(null,_0x4d4f4c);},'afterCreate':function(_0x5adef6,_0x580e2b,_0x8a917a){var _0x37ec12=_0x4d35c6[_0x801d('0x15')];var _0x29cb56=_0x5adef6[_0x801d('0x16')]({'plain':!![]});if(_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()==='in'||_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()===_0x801d('0x19')&&!_0x29cb56[_0x801d('0x1a')]&&!_[_0x801d('0x1b')](_0x29cb56['UserId'])){_0x37ec12[_0x801d('0x1c')][_0x801d('0x1d')]({'where':{'id':_0x29cb56[_0x801d('0x1e')]}})['then'](function(_0x53c758){if(_0x53c758){_0x53c758['update']({'lastMsgAt':_0x29cb56[_0x801d('0x1f')],'lastMsgDirection':_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()});}})[_0x801d('0x20')](function(_0x1796e9){console[_0x801d('0x21')](_0x1796e9);});}_0x8a917a();}},'charset':'utf8mb4','collate':_0x801d('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 763d9a4..4683a09 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 _0x28f2=['CreateMailMessage','MailMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3049d9,_0x26afc1){var _0x52aabc=function(_0x2ea189){while(--_0x2ea189){_0x3049d9['push'](_0x3049d9['shift']());}};_0x52aabc(++_0x26afc1);}(_0x28f2,0x193));var _0x228f=function(_0x3aa817,_0x178311){_0x3aa817=_0x3aa817-0x0;var _0x4f88a6=_0x28f2[_0x3aa817];return _0x4f88a6;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});config[_0x228f('0xc')]=_['defaults'](config[_0x228f('0xc')],{'host':_0x228f('0xd'),'port':0x18eb});var socket=require(_0x228f('0xe'))(new Redis(config['redis']));require(_0x228f('0xf'))['register'](socket);function respondWithRpcPromise(_0x212c90,_0x2dfd07,_0x4e26fe){return new BPromise(function(_0x3884c6,_0x40aca5){return client[_0x228f('0x10')](_0x212c90,_0x4e26fe)[_0x228f('0x11')](function(_0x3aa9bf){logger['info'](_0x228f('0x12'),_0x2dfd07,_0x228f('0x13'));logger[_0x228f('0x14')](_0x228f('0x15'),_0x2dfd07,_0x228f('0x13'),JSON[_0x228f('0x16')](_0x3aa9bf));if(_0x3aa9bf[_0x228f('0x17')]){if(_0x3aa9bf[_0x228f('0x17')]['code']===0x1f4){logger[_0x228f('0x17')](_0x228f('0x12'),_0x2dfd07,_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);return _0x40aca5(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}logger[_0x228f('0x17')]('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x3aa9bf[_0x228f('0x17')]['message']);return _0x3884c6(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}else{logger[_0x228f('0x19')]('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x228f('0x13'));_0x3884c6(_0x3aa9bf['result'][_0x228f('0x18')]);}})['catch'](function(_0x30cbc2){logger['error']('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x30cbc2);_0x40aca5(_0x30cbc2);});});}exports[_0x228f('0x1a')]=function(_0x52da36){var _0x302d54=this;return new Promise(function(_0x139373,_0x1294a8){return db[_0x228f('0x1b')][_0x228f('0x1c')](_0x52da36[_0x228f('0x1d')],{'raw':_0x52da36[_0x228f('0x1e')]?_0x52da36[_0x228f('0x1e')][_0x228f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1e96d4){logger[_0x228f('0x19')](_0x228f('0x1a'),_0x52da36);logger[_0x228f('0x14')](_0x228f('0x1a'),_0x52da36,JSON[_0x228f('0x16')](_0x1e96d4));_0x139373(_0x1e96d4);})[_0x228f('0x20')](function(_0x20c111){logger[_0x228f('0x17')]('CreateMailMessage',_0x20c111[_0x228f('0x18')],_0x52da36);_0x1294a8(_0x302d54[_0x228f('0x17')](0x1f4,_0x20c111[_0x228f('0x18')]));});});}; \ No newline at end of file +var _0x4024=['debug','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x23971e,_0x24c061){var _0x54c10a=function(_0x554e54){while(--_0x554e54){_0x23971e['push'](_0x23971e['shift']());}};_0x54c10a(++_0x24c061);}(_0x4024,0x89));var _0x4402=function(_0x10ea18,_0x918c9a){_0x10ea18=_0x10ea18-0x0;var _0x3c3cd3=_0x4024[_0x10ea18];return _0x3c3cd3;};'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});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});}exports[_0x4402('0x14')]=function(_0x5cb0c5){var _0x38b459=this;return new Promise(function(_0x4e0340,_0x55cc8c){return db[_0x4402('0x15')][_0x4402('0x16')](_0x5cb0c5[_0x4402('0x17')],{'raw':_0x5cb0c5['options']?_0x5cb0c5[_0x4402('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6f1f72){logger[_0x4402('0x12')](_0x4402('0x14'),_0x5cb0c5);logger[_0x4402('0xd')](_0x4402('0x14'),_0x5cb0c5,JSON[_0x4402('0xe')](_0x6f1f72));_0x4e0340(_0x6f1f72);})[_0x4402('0x13')](function(_0x6b1fc5){logger[_0x4402('0xf')]('CreateMailMessage',_0x6b1fc5[_0x4402('0x11')],_0x5cb0c5);_0x55cc8c(_0x38b459['error'](0x1f4,_0x6b1fc5[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9fd18c6..24bb479 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 _0x951a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x2f89c4,_0x5eaa33){var _0x21c5cc=function(_0x5dad44){while(--_0x5dad44){_0x2f89c4['push'](_0x2f89c4['shift']());}};_0x21c5cc(++_0x5eaa33);}(_0x951a,0x101));var _0xa951=function(_0x1dd9b0,_0x5cafc6){_0x1dd9b0=_0x1dd9b0-0x0;var _0x1d2c46=_0x951a[_0x1dd9b0];return _0x1d2c46;};'use strict';var MailMessageEvents=require(_0xa951('0x0'));var events=[_0xa951('0x1'),_0xa951('0x2'),_0xa951('0x3')];function createListener(_0x2064c4,_0x4c37bc){return function(_0x30eeeb){_0x4c37bc[_0xa951('0x4')](_0x2064c4,_0x30eeeb);};}function removeListener(_0x30212e,_0x3ee75f){return function(){MailMessageEvents[_0xa951('0x5')](_0x30212e,_0x3ee75f);};}exports[_0xa951('0x6')]=function(_0x534b24){for(var _0x3b9deb=0x0,_0x50444b=events[_0xa951('0x7')];_0x3b9deb<_0x50444b;_0x3b9deb++){var _0x2b67d6=events[_0x3b9deb];var _0x5daaba=createListener(_0xa951('0x8')+_0x2b67d6,_0x534b24);MailMessageEvents['on'](_0x2b67d6,_0x5daaba);}}; \ No newline at end of file +var _0x755b=['update','emit','removeListener','mailMessage:','save','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x755b,0xfa));var _0xb755=function(_0xc298ad,_0xea4dc2){_0xc298ad=_0xc298ad-0x0;var _0x11b2e6=_0x755b[_0xc298ad];return _0x11b2e6;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb755('0x0'),_0xb755('0x1'),_0xb755('0x2')];function createListener(_0x455bef,_0x1658f5){return function(_0x626c8f){_0x1658f5[_0xb755('0x3')](_0x455bef,_0x626c8f);};}function removeListener(_0x35ec81,_0xed2068){return function(){MailMessageEvents[_0xb755('0x4')](_0x35ec81,_0xed2068);};}exports['register']=function(_0x1ec43a){for(var _0x399f2a=0x0,_0x15a732=events['length'];_0x399f2a<_0x15a732;_0x399f2a++){var _0x52a7b5=events[_0x399f2a];var _0x5b9691=createListener(_0xb755('0x5')+_0x52a7b5,_0x1ec43a);MailMessageEvents['on'](_0x52a7b5,_0x5b9691);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index dfe15d9..14f31a6 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 _0xb9de=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x253b13,_0x247a2f){var _0x396bcc=function(_0x152c32){while(--_0x152c32){_0x253b13['push'](_0x253b13['shift']());}};_0x396bcc(++_0x247a2f);}(_0xb9de,0x18d));var _0xeb9d=function(_0x125bf0,_0x279b96){_0x125bf0=_0x125bf0-0x0;var _0x25f0bf=_0xb9de[_0x125bf0];return _0x25f0bf;};'use strict';var multer=require(_0xeb9d('0x0'));var util=require(_0xeb9d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb9d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb9d('0x3'));var interaction=require(_0xeb9d('0x4'));var config=require(_0xeb9d('0x5'));var controller=require(_0xeb9d('0x6'));router[_0xeb9d('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb9d('0x8')]);router[_0xeb9d('0x7')](_0xeb9d('0x9'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0xb')]);router['get'](_0xeb9d('0xc'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0xd')]);router[_0xeb9d('0x7')](_0xeb9d('0xe'),auth[_0xeb9d('0xa')](),controller['getMembers']);router[_0xeb9d('0x7')](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x10')]);router[_0xeb9d('0x7')](_0xeb9d('0x11'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x12')]);router[_0xeb9d('0x13')]('/',auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x14')]);router[_0xeb9d('0x13')](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller['addTeams']);router[_0xeb9d('0x13')]('/:id/users',auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x15')]);router['put'](_0xeb9d('0xc'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x16')]);router[_0xeb9d('0x17')](_0xeb9d('0xc'),auth['isAuthenticated'](),controller[_0xeb9d('0x18')]);router['delete'](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x19')]);router[_0xeb9d('0x17')](_0xeb9d('0x11'),auth[_0xeb9d('0xa')](),controller['removeAgents']);module[_0xeb9d('0x1a')]=router; \ No newline at end of file +var _0x1924=['addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams'];(function(_0x1395e1,_0x2543e2){var _0x28047f=function(_0x5d3273){while(--_0x5d3273){_0x1395e1['push'](_0x1395e1['shift']());}};_0x28047f(++_0x2543e2);}(_0x1924,0x1e7));var _0x4192=function(_0x516ee3,_0xb042c8){_0x516ee3=_0x516ee3-0x0;var _0x5a8ffe=_0x1924[_0x516ee3];return _0x5a8ffe;};'use strict';var multer=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var path=require(_0x4192('0x2'));var timeout=require(_0x4192('0x3'));var express=require(_0x4192('0x4'));var router=express[_0x4192('0x5')]();var fs_extra=require(_0x4192('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4192('0x7'));var config=require('../../config/environment');var controller=require(_0x4192('0x8'));router[_0x4192('0x9')]('/',auth[_0x4192('0xa')](),controller[_0x4192('0xb')]);router[_0x4192('0x9')](_0x4192('0xc'),auth[_0x4192('0xa')](),controller[_0x4192('0xd')]);router['get']('/:id',auth[_0x4192('0xa')](),controller[_0x4192('0xe')]);router[_0x4192('0x9')](_0x4192('0xf'),auth['isAuthenticated'](),controller[_0x4192('0x10')]);router[_0x4192('0x9')]('/:id/teams',auth[_0x4192('0xa')](),controller[_0x4192('0x11')]);router[_0x4192('0x9')](_0x4192('0x12'),auth[_0x4192('0xa')](),controller[_0x4192('0x13')]);router[_0x4192('0x14')]('/',auth[_0x4192('0xa')](),controller['create']);router[_0x4192('0x14')](_0x4192('0x15'),auth['isAuthenticated'](),controller[_0x4192('0x16')]);router[_0x4192('0x14')]('/:id/users',auth[_0x4192('0xa')](),controller[_0x4192('0x17')]);router[_0x4192('0x18')](_0x4192('0x19'),auth['isAuthenticated'](),controller[_0x4192('0x1a')]);router[_0x4192('0x1b')](_0x4192('0x19'),auth['isAuthenticated'](),controller[_0x4192('0x1c')]);router[_0x4192('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4192('0x1d')]);router[_0x4192('0x1b')](_0x4192('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8716e87..bed5c46 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 _0x8a40=['exports','name','STRING','ENUM','beepall','roundrobin','sequelize'];(function(_0x3c2024,_0x4c2148){var _0x2a838c=function(_0x2da3ce){while(--_0x2da3ce){_0x3c2024['push'](_0x3c2024['shift']());}};_0x2a838c(++_0x4c2148);}(_0x8a40,0xfb));var _0x08a4=function(_0x4254d1,_0x5121c6){_0x4254d1=_0x4254d1-0x0;var _0x1292ff=_0x8a40[_0x4254d1];return _0x1292ff;};'use strict';var Sequelize=require(_0x08a4('0x0'));module[_0x08a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x08a4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x08a4('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x08a4('0x4')]('rrmemory',_0x08a4('0x5'),_0x08a4('0x6'))}}; \ No newline at end of file +var _0xdba0=['sequelize','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x237f07,_0x2142a9){var _0x22c133=function(_0x3e1280){while(--_0x3e1280){_0x237f07['push'](_0x237f07['shift']());}};_0x22c133(++_0x2142a9);}(_0xdba0,0xb4));var _0x0dba=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xdba0[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x0dba('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dba('0x1')],'unique':_0x0dba('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0dba('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0dba('0x3'),_0x0dba('0x4'),_0x0dba('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5abe73b..47e6322 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 _0x4407=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','union','compact','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','key','getOptions','count','include','query','findAll','show','params','model','filters','intersection','attributes','fields','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','length','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','User','findAndCountAll','agent','mailPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','findOne','keys','Team','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x4407,0x107));var _0x7440=function(_0x78b582,_0x112a8f){_0x78b582=_0x78b582-0x0;var _0x59ee7e=_0x4407[_0x78b582];return _0x59ee7e;};'use strict';var BPromise=require(_0x7440('0x0'));var util=require(_0x7440('0x1'));var _=require(_0x7440('0x2'));var squel=require(_0x7440('0x3'));var Redis=require(_0x7440('0x4'));var qs=require(_0x7440('0x5'));var logger=require(_0x7440('0x6'))('api');var config=require(_0x7440('0x7'));var db=require(_0x7440('0x8'))['db'];config[_0x7440('0x9')]=_['defaults'](config[_0x7440('0x9')],{'host':_0x7440('0xa'),'port':0x18eb});var socket=require(_0x7440('0xb'))(new Redis(config[_0x7440('0x9')]));require('./mailQueue.socket')[_0x7440('0xc')](socket);function respondWithStatusCode(_0xac62b4,_0x463c17){_0x463c17=_0x463c17||0xcc;return function(_0x1ea6ff){if(_0x1ea6ff){return _0xac62b4[_0x7440('0xd')](_0x463c17);}return _0xac62b4[_0x7440('0xe')](_0x463c17)[_0x7440('0xf')]();};}function respondWithResult(_0x298144,_0x4ccb75){_0x4ccb75=_0x4ccb75||0xc8;return function(_0x102852){if(_0x102852){return _0x298144[_0x7440('0xe')](_0x4ccb75)[_0x7440('0x10')](_0x102852);}};}function respondWithFilteredResult(_0x17ea7c,_0x34716c){return function(_0x26f993){if(_0x26f993){var _0xfa554f=typeof _0x34716c[_0x7440('0x11')]==='undefined'&&typeof _0x34716c[_0x7440('0x12')]===_0x7440('0x13');var _0x50988a=_0x26f993['count'];var _0x5f3ff0=_0xfa554f?0x0:_0x34716c[_0x7440('0x11')];var _0x2721c8=_0xfa554f?_0x26f993['count']:_0x34716c[_0x7440('0x11')]+_0x34716c[_0x7440('0x12')];var _0xc7b7f6;if(_0x2721c8>=_0x50988a){_0x2721c8=_0x50988a;_0xc7b7f6=0xc8;}else{_0xc7b7f6=0xce;}_0x17ea7c['status'](_0xc7b7f6);return _0x17ea7c['set'](_0x7440('0x14'),_0x5f3ff0+'-'+_0x2721c8+'/'+_0x50988a)[_0x7440('0x10')](_0x26f993);}return null;};}function saveUpdates(_0x10c089){return function(_0x1b8e08){if(_0x1b8e08){return _0x1b8e08[_0x7440('0x15')](_0x10c089)[_0x7440('0x16')](function(_0x4a7858){return _0x4a7858;});}return null;};}function removeEntity(_0x34d517){return function(_0x32a6a6){if(_0x32a6a6){return _0x32a6a6[_0x7440('0x17')]()['then'](function(){var _0x49e986=_0x32a6a6[_0x7440('0x18')]({'plain':!![]});var _0x3e1cdf='MailQueues';return db[_0x7440('0x19')]['destroy']({'where':{'type':_0x3e1cdf,'resourceId':_0x49e986['id']}})['then'](function(){return _0x32a6a6;});})[_0x7440('0x16')](function(){_0x34d517[_0x7440('0xe')](0xcc)[_0x7440('0xf')]();});}};}function handleEntityNotFound(_0x180873){return function(_0x3f0295){if(!_0x3f0295){_0x180873['sendStatus'](0x194);}return _0x3f0295;};}function handleError(_0x11a6a1,_0x4adebd){_0x4adebd=_0x4adebd||0x1f4;return function(_0x14bc3e){logger[_0x7440('0x1a')](_0x14bc3e[_0x7440('0x1b')]);if(_0x14bc3e[_0x7440('0x1c')]){delete _0x14bc3e['name'];}_0x11a6a1[_0x7440('0xe')](_0x4adebd)['send'](_0x14bc3e);};}exports[_0x7440('0x1d')]=function(_0x41db42,_0x1a04b4){var _0x3eaa7c={};var _0x1db4b5={'count':0x0,'rows':[]};var _0x212b83=_[_0x7440('0x1e')](db[_0x7440('0x1f')][_0x7440('0x20')],function(_0x774a17){return{'name':_0x774a17['fieldName'],'type':_0x774a17['type'][_0x7440('0x21')]};});_0x3eaa7c=qs[_0x7440('0x22')](_0x212b83,_0x41db42);var _0x2713b1={'where':_0x3eaa7c['where']};return db['MailQueue'][_0x7440('0x23')](_0x2713b1)[_0x7440('0x16')](function(_0x3ab8d1){_0x1db4b5[_0x7440('0x23')]=_0x3ab8d1;_0x3eaa7c[_0x7440('0x24')]=qs[_0x7440('0x24')](_0x41db42[_0x7440('0x25')]);return db[_0x7440('0x1f')][_0x7440('0x26')](_0x3eaa7c);})[_0x7440('0x16')](function(_0x3b265c){_0x1db4b5['rows']=_0x3b265c;return _0x1db4b5;})[_0x7440('0x16')](respondWithFilteredResult(_0x1a04b4,_0x3eaa7c))['catch'](handleError(_0x1a04b4,null));};exports[_0x7440('0x27')]=function(_0x1066fa,_0xc3b859){var _0x35d376={'raw':!![],'where':{'id':_0x1066fa[_0x7440('0x28')]['id']}},_0x3af16a={};_0x3af16a[_0x7440('0x29')]=_['keys'](db[_0x7440('0x1f')][_0x7440('0x20')]);_0x3af16a[_0x7440('0x25')]=_['keys'](_0x1066fa[_0x7440('0x25')]);_0x3af16a[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x3af16a[_0x7440('0x29')],_0x3af16a[_0x7440('0x25')]);_0x35d376[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x3af16a[_0x7440('0x29')],qs[_0x7440('0x2d')](_0x1066fa[_0x7440('0x25')][_0x7440('0x2d')]));_0x35d376['attributes']=_0x35d376[_0x7440('0x2c')]['length']?_0x35d376[_0x7440('0x2c')]:_0x3af16a[_0x7440('0x29')];if(_0x1066fa['query']['includeAll']){_0x35d376[_0x7440('0x24')]=[{'all':!![]}];}_0x35d376=_[_0x7440('0x2e')]({},_0x35d376,_0x1066fa[_0x7440('0x2f')]);return db[_0x7440('0x1f')][_0x7440('0x30')](_0x35d376)['then'](handleEntityNotFound(_0xc3b859,null))[_0x7440('0x16')](respondWithResult(_0xc3b859,null))[_0x7440('0x31')](handleError(_0xc3b859,null));};exports[_0x7440('0x32')]=function(_0x7dc5ec,_0x28a4ae){return db['MailQueue'][_0x7440('0x32')](_0x7dc5ec['body'],{})[_0x7440('0x16')](function(_0x4dbdea){var _0x463e7f=_0x7dc5ec[_0x7440('0x33')][_0x7440('0x18')]({'plain':!![]});if(!_0x463e7f)throw new Error(_0x7440('0x34'));if(_0x463e7f[_0x7440('0x35')]==='user'){var _0xbbf1e9=_0x4dbdea['get']({'plain':!![]});var _0x825a49='MailQueues';return db[_0x7440('0x36')][_0x7440('0x30')]({'where':{'name':_0x825a49,'userProfileId':_0x463e7f[_0x7440('0x37')]},'raw':!![]})['then'](function(_0x25110c){if(_0x25110c&&_0x25110c['autoAssociation']===0x0){return db[_0x7440('0x19')][_0x7440('0x32')]({'name':_0xbbf1e9[_0x7440('0x1c')],'resourceId':_0xbbf1e9['id'],'type':_0x25110c[_0x7440('0x1c')],'sectionId':_0x25110c['id']},{})[_0x7440('0x16')](function(){return _0x4dbdea;});}else{return _0x4dbdea;}})['catch'](function(_0xff56ac){logger['error'](_0x7440('0x38'),_0xff56ac);throw _0xff56ac;});}return _0x4dbdea;})[_0x7440('0x16')](respondWithResult(_0x28a4ae,0xc9))[_0x7440('0x31')](handleError(_0x28a4ae,null));};exports['update']=function(_0x354ab7,_0x4b4134){if(_0x354ab7['body']['id']){delete _0x354ab7['body']['id'];}return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x354ab7['params']['id']}})['then'](handleEntityNotFound(_0x4b4134,null))['then'](saveUpdates(_0x354ab7[_0x7440('0x39')],null))[_0x7440('0x16')](respondWithResult(_0x4b4134,null))[_0x7440('0x31')](handleError(_0x4b4134,null));};exports[_0x7440('0x17')]=function(_0x3d21fc,_0x1a29d0){return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x3d21fc['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x1a29d0,null))['then'](removeEntity(_0x1a29d0,null))[_0x7440('0x31')](handleError(_0x1a29d0,null));};exports[_0x7440('0x3a')]=function(_0x13079d,_0x2371f4){return db['MailQueue']['describe']()['then'](respondWithResult(_0x2371f4,null))['catch'](handleError(_0x2371f4,null));};exports[_0x7440('0x3b')]=function(_0x12026c,_0x4d0979){var _0x31708e={'raw':!![],'where':{}},_0x363ce2={},_0x5b6a4d;return db[_0x7440('0x1f')]['findOne']({'where':{'id':_0x12026c[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x4d0979,null))[_0x7440('0x16')](function(_0x210d8e){if(_0x210d8e){_0x5b6a4d=_0x210d8e[_0x7440('0x18')]({'plain':!![]});_0x363ce2[_0x7440('0x29')]=_['keys'](db[_0x7440('0x3c')][_0x7440('0x20')]);_0x363ce2[_0x7440('0x25')]=_['keys'](_0x12026c[_0x7440('0x25')]);_0x363ce2[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x363ce2[_0x7440('0x29')],_0x363ce2[_0x7440('0x25')]);_0x31708e['attributes']=_[_0x7440('0x2b')](_0x363ce2[_0x7440('0x29')],qs[_0x7440('0x2d')](_0x12026c[_0x7440('0x25')]['fields']));_0x31708e['attributes']=_0x31708e['attributes'][_0x7440('0x3d')]?_0x31708e[_0x7440('0x2c')]:_0x363ce2[_0x7440('0x29')];if(!_0x12026c['query'][_0x7440('0x3e')]('nolimit')){_0x31708e[_0x7440('0x12')]=qs['limit'](_0x12026c[_0x7440('0x25')][_0x7440('0x12')]);_0x31708e[_0x7440('0x11')]=qs['offset'](_0x12026c[_0x7440('0x25')]['offset']);}_0x31708e[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x12026c[_0x7440('0x25')]['sort']);_0x31708e[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x12026c['query'],_0x363ce2['filters']));_0x31708e[_0x7440('0x41')][_0x7440('0x43')]=_0x210d8e['id'];if(_0x12026c['query'][_0x7440('0x44')]){_0x31708e[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x31708e['where'],{'$or':_['map'](_0x31708e[_0x7440('0x2c')],function(_0x2d3894){var _0x27c78e={};_0x27c78e[_0x2d3894]={'$like':'%'+_0x12026c[_0x7440('0x25')][_0x7440('0x44')]+'%'};return _0x27c78e;})});}_0x31708e=_['merge']({},_0x31708e,_0x12026c[_0x7440('0x2f')]);return db[_0x7440('0x3c')][_0x7440('0x26')](_0x31708e);}})[_0x7440('0x16')](function(_0x4a00cb){if(_0x4a00cb){return db[_0x7440('0x45')][_0x7440('0x46')]({'where':{'id':_['map'](_0x4a00cb,'UserId'),'role':_0x7440('0x47')},'attributes':['id',_0x7440('0x1c'),_0x7440('0x48'),'updatedAt',_0x7440('0x49')]});}})[_0x7440('0x16')](function(_0xa7c828){if(_0xa7c828){return{'count':_0xa7c828[_0x7440('0x23')],'rows':_['map'](_0xa7c828[_0x7440('0x4a')],function(_0x2b34fd){return{'membername':_0x2b34fd[_0x7440('0x1c')],'UserId':_0x2b34fd['id'],'queue_name':_0x5b6a4d[_0x7440('0x1c')],'MailQueueId':_0x5b6a4d['id'],'interface':util[_0x7440('0x4b')](_0x7440('0x4c'),'SIP',_0x2b34fd[_0x7440('0x1c')]),'penalty':0x0,'paused':_0x2b34fd[_0x7440('0x48')],'createdAt':_0x2b34fd['createdAt'],'updatedAt':_0x2b34fd[_0x7440('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d0979,_0x31708e))[_0x7440('0x31')](handleError(_0x4d0979,null));};exports[_0x7440('0x4e')]=function(_0x3cb25f,_0x25f103){var _0x57a609={};var _0x2c18fc={};var _0x22d890;var _0x10bab0;return db[_0x7440('0x1f')][_0x7440('0x4f')]({'where':{'id':_0x3cb25f[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x25f103,null))[_0x7440('0x16')](function(_0x55459c){if(_0x55459c){_0x22d890=_0x55459c;_0x2c18fc[_0x7440('0x29')]=_[_0x7440('0x50')](db[_0x7440('0x51')][_0x7440('0x20')]);_0x2c18fc[_0x7440('0x25')]=_[_0x7440('0x50')](_0x3cb25f['query']);_0x2c18fc[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x2c18fc['model'],_0x2c18fc[_0x7440('0x25')]);_0x57a609[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x2c18fc[_0x7440('0x29')],qs['fields'](_0x3cb25f[_0x7440('0x25')][_0x7440('0x2d')]));_0x57a609[_0x7440('0x2c')]=_0x57a609[_0x7440('0x2c')][_0x7440('0x3d')]?_0x57a609[_0x7440('0x2c')]:_0x2c18fc[_0x7440('0x29')];_0x57a609[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x3cb25f['query'][_0x7440('0x40')]);_0x57a609[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x3cb25f[_0x7440('0x25')],_0x2c18fc['filters']));if(_0x3cb25f[_0x7440('0x25')][_0x7440('0x44')]){_0x57a609[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x57a609[_0x7440('0x41')],{'$or':_['map'](_0x57a609['attributes'],function(_0x1f3143){var _0x350e91={};_0x350e91[_0x1f3143]={'$like':'%'+_0x3cb25f[_0x7440('0x25')][_0x7440('0x44')]+'%'};return _0x350e91;})});}_0x57a609=_[_0x7440('0x2e')]({},_0x57a609,_0x3cb25f[_0x7440('0x2f')]);return _0x22d890[_0x7440('0x4e')](_0x57a609);}})[_0x7440('0x16')](function(_0x268865){if(_0x268865){_0x10bab0=_0x268865[_0x7440('0x3d')];if(!_0x3cb25f['query'][_0x7440('0x3e')](_0x7440('0x52'))){_0x57a609[_0x7440('0x12')]=qs[_0x7440('0x12')](_0x3cb25f[_0x7440('0x25')][_0x7440('0x12')]);_0x57a609[_0x7440('0x11')]=qs[_0x7440('0x11')](_0x3cb25f['query'][_0x7440('0x11')]);}return _0x22d890['getTeams'](_0x57a609);}})[_0x7440('0x16')](function(_0x24c73e){if(_0x24c73e){return _0x24c73e?{'count':_0x10bab0,'rows':_0x24c73e}:null;}})[_0x7440('0x16')](respondWithResult(_0x25f103,null))['catch'](handleError(_0x25f103,null));};exports[_0x7440('0x53')]=function(_0x54e587,_0x2ce8c6){var _0x6e198c=_0x54e587[_0x7440('0x39')][_0x7440('0x54')];return db[_0x7440('0x51')][_0x7440('0x26')]({'where':{'id':_0x6e198c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x7440('0x55'),_0x7440('0x56')],'raw':!![]}]})['then'](function(_0x1ef833){if(_0x1ef833){var _0x83aa2e=_[_0x7440('0x57')](_0x1ef833,function(_0x254c61){var _0x1984c7=_0x254c61['get']({'plain':!![]});return _0x1984c7[_0x7440('0x58')];});return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x54e587[_0x7440('0x28')]['id']}})[_0x7440('0x16')](function(_0x5103b9){return db['sequelize'][_0x7440('0x59')](function(_0x1f0999){return _0x5103b9[_0x7440('0x53')](_0x6e198c,{'transaction':_0x1f0999})[_0x7440('0x16')](function(){return BPromise[_0x7440('0x5a')](_0x83aa2e,function(_0x122e6b){return db[_0x7440('0x3c')][_0x7440('0x5b')]({'where':{'UserId':_0x122e6b['id'],'MailQueueId':_0x54e587[_0x7440('0x28')]['id']},'transaction':_0x1f0999});});})['then'](function(){_0x83aa2e[_0x7440('0x5c')](function(_0x505e41){socket[_0x7440('0x5d')](_0x7440('0x5e'),{'UserId':_0x505e41['id'],'MailQueueId':_0x5103b9['id']});});});});});}})['then'](respondWithStatusCode(_0x2ce8c6,null))[_0x7440('0x31')](handleError(_0x2ce8c6,null));};exports['removeTeams']=function(_0x1ba9d8,_0x1f0fea){return db['Team'][_0x7440('0x26')]({'where':{'id':_0x1ba9d8[_0x7440('0x25')][_0x7440('0x54')]},'attributes':['id'],'include':[{'model':db[_0x7440('0x45')],'as':_0x7440('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f0fea,null))[_0x7440('0x16')](function(_0x17ce71){var _0x4b3d1d=_[_0x7440('0x1e')](_0x17ce71,'id');var _0x36442c=[];var _0x229e05=[];var _0x519590=squel[_0x7440('0x5f')]();_0x519590[_0x7440('0x60')](_0x7440('0x61'))[_0x7440('0x62')](_0x7440('0x63'),'tq')[_0x7440('0x64')](_0x7440('0x65'),'ut',_0x7440('0x66'))[_0x7440('0x41')](_0x7440('0x67'),_0x1ba9d8['params']['id']);for(var _0x282a3b=0x0;_0x282a3b<_0x17ce71[_0x7440('0x3d')];_0x282a3b+=0x1){let _0x61c34b=_0x17ce71[_0x282a3b];for(var _0x21870e=0x0;_0x21870e<_0x61c34b[_0x7440('0x58')][_0x7440('0x3d')];_0x21870e+=0x1){let _0x5ad5d8=_0x61c34b[_0x7440('0x58')][_0x21870e];var _0x136a53=_0x519590[_0x7440('0x68')]();_0x136a53[_0x7440('0x41')](_0x7440('0x69'),_0x5ad5d8['id']);_0x229e05[_0x7440('0x6a')](db['sequelize'][_0x7440('0x25')](_0x136a53['toString'](),{'type':db[_0x7440('0x6b')][_0x7440('0x6c')][_0x7440('0x6d')]})['then'](function(_0x21cf34){if(_0x21cf34[_0x7440('0x3d')]===0x1){return _0x5ad5d8['id'];}else{var _0x5b7ac1=_[_0x7440('0x6e')](_[_0x7440('0x1e')](_0x21cf34,'TeamId'),function(_0x5848d7){return _['includes'](_0x4b3d1d,_0x5848d7);});if(_0x5b7ac1){return _0x5ad5d8['id'];}}}));}}return BPromise[_0x7440('0x6f')](_0x229e05)['then'](function(_0xdcf356){_0x36442c=_(_0x36442c)[_0x7440('0x70')](_0xdcf356)[_0x7440('0x71')]()['value']();return db[_0x7440('0x1f')]['find']({'where':{'id':_0x1ba9d8[_0x7440('0x28')]['id']}})[_0x7440('0x16')](function(_0x1a359f){return db[_0x7440('0x6b')]['transaction'](function(_0x1f9b20){return _0x1a359f[_0x7440('0x72')](_0x1ba9d8[_0x7440('0x25')][_0x7440('0x54')],{'transaction':_0x1f9b20})['then'](function(){if(!_[_0x7440('0x73')](_0x36442c)){return _0x1a359f[_0x7440('0x74')](_0x36442c,{'transaction':_0x1f9b20});}})['then'](function(){_0x36442c['forEach'](function(_0x3e33d9){socket[_0x7440('0x5d')](_0x7440('0x75'),{'UserId':_0x3e33d9,'MailQueueId':_0x1a359f['id']});});});});});});})[_0x7440('0x16')](respondWithStatusCode(_0x1f0fea,null))[_0x7440('0x31')](handleError(_0x1f0fea,null));};exports[_0x7440('0x76')]=function(_0x149743,_0x125d6e){return db[_0x7440('0x1f')]['find']({'where':{'id':_0x149743['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x125d6e,null))[_0x7440('0x16')](function(_0x2f2efd){if(_0x2f2efd){return _0x2f2efd[_0x7440('0x76')](_0x149743[_0x7440('0x39')][_0x7440('0x54')],_['omit'](_0x149743[_0x7440('0x39')],[_0x7440('0x54'),'id'])||{})[_0x7440('0x77')](function(_0x1625e2){for(var _0x468d72=0x0;_0x468d72<_0x149743[_0x7440('0x39')]['ids'][_0x7440('0x3d')];_0x468d72+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x149743[_0x7440('0x39')][_0x7440('0x54')][_0x468d72]),'MailQueueId':Number(_0x149743[_0x7440('0x28')]['id'])});}return _0x1625e2;});}})[_0x7440('0x16')](respondWithResult(_0x125d6e,null))[_0x7440('0x31')](handleError(_0x125d6e,null));};exports[_0x7440('0x74')]=function(_0x5498fc,_0x394f69){return db['MailQueue']['find']({'where':{'id':_0x5498fc[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x394f69,null))[_0x7440('0x16')](function(_0x2390f5){if(_0x2390f5){return _0x2390f5[_0x7440('0x74')](_0x5498fc['query'][_0x7440('0x54')])['then'](function(){if(_[_0x7440('0x78')](_0x5498fc[_0x7440('0x25')]['ids'])){for(var _0x4fbeff=0x0;_0x4fbeff<_0x5498fc[_0x7440('0x25')][_0x7440('0x54')][_0x7440('0x3d')];_0x4fbeff+=0x1){socket['emit'](_0x7440('0x75'),{'UserId':Number(_0x5498fc[_0x7440('0x25')][_0x7440('0x54')][_0x4fbeff]),'MailQueueId':Number(_0x5498fc['params']['id'])});}}else{socket[_0x7440('0x5d')](_0x7440('0x75'),{'UserId':Number(_0x5498fc['query'][_0x7440('0x54')]),'MailQueueId':Number(_0x5498fc[_0x7440('0x28')]['id'])});}});}})[_0x7440('0x16')](respondWithStatusCode(_0x394f69,null))[_0x7440('0x31')](handleError(_0x394f69,null));};exports['getAgents']=function(_0x512e17,_0x482c65){var _0x5e185d={};var _0x816d9e={};var _0x550f0c;var _0x1fe074;return db[_0x7440('0x1f')][_0x7440('0x4f')]({'where':{'id':_0x512e17['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x482c65,null))['then'](function(_0x17c4c9){if(_0x17c4c9){_0x550f0c=_0x17c4c9;_0x816d9e[_0x7440('0x29')]=_[_0x7440('0x50')](db[_0x7440('0x45')][_0x7440('0x20')]);_0x816d9e[_0x7440('0x25')]=_[_0x7440('0x50')](_0x512e17['query']);_0x816d9e[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x816d9e[_0x7440('0x29')],_0x816d9e['query']);_0x5e185d[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x816d9e[_0x7440('0x29')],qs['fields'](_0x512e17[_0x7440('0x25')][_0x7440('0x2d')]));_0x5e185d[_0x7440('0x2c')]=_0x5e185d['attributes'][_0x7440('0x3d')]?_0x5e185d[_0x7440('0x2c')]:_0x816d9e[_0x7440('0x29')];_0x5e185d[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x512e17[_0x7440('0x25')][_0x7440('0x40')]);_0x5e185d[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x512e17[_0x7440('0x25')],_0x816d9e[_0x7440('0x2a')]));if(_0x512e17[_0x7440('0x25')][_0x7440('0x44')]){_0x5e185d[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x5e185d[_0x7440('0x41')],{'$or':_[_0x7440('0x1e')](_0x5e185d[_0x7440('0x2c')],function(_0x18a157){var _0x560a82={};_0x560a82[_0x18a157]={'$like':'%'+_0x512e17[_0x7440('0x25')]['filter']+'%'};return _0x560a82;})});}_0x5e185d=_[_0x7440('0x2e')]({},_0x5e185d,_0x512e17[_0x7440('0x2f')]);return _0x550f0c['getAgents'](_0x5e185d);}})['then'](function(_0x139705){if(_0x139705){_0x1fe074=_0x139705[_0x7440('0x3d')];if(!_0x512e17[_0x7440('0x25')][_0x7440('0x3e')]('nolimit')){_0x5e185d['limit']=qs['limit'](_0x512e17[_0x7440('0x25')][_0x7440('0x12')]);_0x5e185d[_0x7440('0x11')]=qs[_0x7440('0x11')](_0x512e17[_0x7440('0x25')][_0x7440('0x11')]);}return _0x550f0c['getAgents'](_0x5e185d);}})[_0x7440('0x16')](function(_0x48284c){if(_0x48284c){return _0x48284c?{'count':_0x1fe074,'rows':_0x48284c}:null;}})['then'](respondWithResult(_0x482c65,null))[_0x7440('0x31')](handleError(_0x482c65,null));}; \ No newline at end of file +var _0x7f8b=['undefined','count','offset','set','update','destroy','get','MailQueues','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','type','getOptions','where','MailQueue','include','query','rows','catch','show','params','keys','intersection','model','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','filters','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','findOne','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','value','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit'];(function(_0x9c7f4a,_0x29cbcf){var _0xf27c07=function(_0x3bd3b9){while(--_0x3bd3b9){_0x9c7f4a['push'](_0x9c7f4a['shift']());}};_0xf27c07(++_0x29cbcf);}(_0x7f8b,0xd6));var _0xb7f8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7f8b[_0x173441];return _0x2423a8;};'use strict';var BPromise=require(_0xb7f8('0x0'));var util=require('util');var _=require(_0xb7f8('0x1'));var squel=require(_0xb7f8('0x2'));var Redis=require(_0xb7f8('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb7f8('0x4'));var config=require(_0xb7f8('0x5'));var db=require(_0xb7f8('0x6'))['db'];config[_0xb7f8('0x7')]=_[_0xb7f8('0x8')](config[_0xb7f8('0x7')],{'host':_0xb7f8('0x9'),'port':0x18eb});var socket=require(_0xb7f8('0xa'))(new Redis(config[_0xb7f8('0x7')]));require(_0xb7f8('0xb'))[_0xb7f8('0xc')](socket);function respondWithStatusCode(_0x292b23,_0x7b02fe){_0x7b02fe=_0x7b02fe||0xcc;return function(_0x1fde46){if(_0x1fde46){return _0x292b23[_0xb7f8('0xd')](_0x7b02fe);}return _0x292b23[_0xb7f8('0xe')](_0x7b02fe)[_0xb7f8('0xf')]();};}function respondWithResult(_0x13cdf6,_0x2f7d5f){_0x2f7d5f=_0x2f7d5f||0xc8;return function(_0x4c6e14){if(_0x4c6e14){return _0x13cdf6[_0xb7f8('0xe')](_0x2f7d5f)[_0xb7f8('0x10')](_0x4c6e14);}};}function respondWithFilteredResult(_0x5d4b6d,_0x563783){return function(_0x25996a){if(_0x25996a){var _0x5a8d92=typeof _0x563783['offset']==='undefined'&&typeof _0x563783[_0xb7f8('0x11')]===_0xb7f8('0x12');var _0x24a3db=_0x25996a[_0xb7f8('0x13')];var _0x34bd31=_0x5a8d92?0x0:_0x563783[_0xb7f8('0x14')];var _0x4d1bcf=_0x5a8d92?_0x25996a['count']:_0x563783[_0xb7f8('0x14')]+_0x563783[_0xb7f8('0x11')];var _0x35645c;if(_0x4d1bcf>=_0x24a3db){_0x4d1bcf=_0x24a3db;_0x35645c=0xc8;}else{_0x35645c=0xce;}_0x5d4b6d['status'](_0x35645c);return _0x5d4b6d[_0xb7f8('0x15')]('Content-Range',_0x34bd31+'-'+_0x4d1bcf+'/'+_0x24a3db)['json'](_0x25996a);}return null;};}function saveUpdates(_0x4c1d8e){return function(_0x3a4607){if(_0x3a4607){return _0x3a4607[_0xb7f8('0x16')](_0x4c1d8e)['then'](function(_0x73956a){return _0x73956a;});}return null;};}function removeEntity(_0x45d51b){return function(_0x23eba5){if(_0x23eba5){return _0x23eba5[_0xb7f8('0x17')]()['then'](function(){var _0x4bb3e2=_0x23eba5[_0xb7f8('0x18')]({'plain':!![]});var _0x1bd45b=_0xb7f8('0x19');return db[_0xb7f8('0x1a')]['destroy']({'where':{'type':_0x1bd45b,'resourceId':_0x4bb3e2['id']}})[_0xb7f8('0x1b')](function(){return _0x23eba5;});})['then'](function(){_0x45d51b['status'](0xcc)[_0xb7f8('0xf')]();});}};}function handleEntityNotFound(_0x1884cc){return function(_0x12cfa0){if(!_0x12cfa0){_0x1884cc[_0xb7f8('0xd')](0x194);}return _0x12cfa0;};}function handleError(_0xab7b83,_0x28d2b9){_0x28d2b9=_0x28d2b9||0x1f4;return function(_0x302574){logger[_0xb7f8('0x1c')](_0x302574[_0xb7f8('0x1d')]);if(_0x302574[_0xb7f8('0x1e')]){delete _0x302574[_0xb7f8('0x1e')];}_0xab7b83[_0xb7f8('0xe')](_0x28d2b9)[_0xb7f8('0x1f')](_0x302574);};}exports[_0xb7f8('0x20')]=function(_0x1ed230,_0x27caed){var _0xb6e509={};var _0x5f2009={'count':0x0,'rows':[]};var _0x57a9f7=_[_0xb7f8('0x21')](db['MailQueue'][_0xb7f8('0x22')],function(_0x1941af){return{'name':_0x1941af['fieldName'],'type':_0x1941af[_0xb7f8('0x23')]['key']};});_0xb6e509=qs[_0xb7f8('0x24')](_0x57a9f7,_0x1ed230);var _0x3477ed={'where':_0xb6e509[_0xb7f8('0x25')]};return db[_0xb7f8('0x26')][_0xb7f8('0x13')](_0x3477ed)[_0xb7f8('0x1b')](function(_0x1c4e14){_0x5f2009[_0xb7f8('0x13')]=_0x1c4e14;_0xb6e509['include']=qs[_0xb7f8('0x27')](_0x1ed230[_0xb7f8('0x28')]);return db['MailQueue']['findAll'](_0xb6e509);})['then'](function(_0x4d50b2){_0x5f2009[_0xb7f8('0x29')]=_0x4d50b2;return _0x5f2009;})[_0xb7f8('0x1b')](respondWithFilteredResult(_0x27caed,_0xb6e509))[_0xb7f8('0x2a')](handleError(_0x27caed,null));};exports[_0xb7f8('0x2b')]=function(_0x4bde2e,_0x5dfefe){var _0x2a84aa={'raw':!![],'where':{'id':_0x4bde2e[_0xb7f8('0x2c')]['id']}},_0x1f4c3d={};_0x1f4c3d['model']=_[_0xb7f8('0x2d')](db[_0xb7f8('0x26')][_0xb7f8('0x22')]);_0x1f4c3d['query']=_[_0xb7f8('0x2d')](_0x4bde2e['query']);_0x1f4c3d['filters']=_[_0xb7f8('0x2e')](_0x1f4c3d[_0xb7f8('0x2f')],_0x1f4c3d['query']);_0x2a84aa[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x1f4c3d['model'],qs['fields'](_0x4bde2e[_0xb7f8('0x28')][_0xb7f8('0x31')]));_0x2a84aa['attributes']=_0x2a84aa[_0xb7f8('0x30')][_0xb7f8('0x32')]?_0x2a84aa[_0xb7f8('0x30')]:_0x1f4c3d['model'];if(_0x4bde2e['query']['includeAll']){_0x2a84aa[_0xb7f8('0x27')]=[{'all':!![]}];}_0x2a84aa=_[_0xb7f8('0x33')]({},_0x2a84aa,_0x4bde2e[_0xb7f8('0x34')]);return db[_0xb7f8('0x26')][_0xb7f8('0x35')](_0x2a84aa)[_0xb7f8('0x1b')](handleEntityNotFound(_0x5dfefe,null))[_0xb7f8('0x1b')](respondWithResult(_0x5dfefe,null))[_0xb7f8('0x2a')](handleError(_0x5dfefe,null));};exports['create']=function(_0x43d660,_0x30bc10){return db['MailQueue'][_0xb7f8('0x36')](_0x43d660[_0xb7f8('0x37')],{})[_0xb7f8('0x1b')](function(_0xee6c19){var _0x55338b=_0x43d660[_0xb7f8('0x38')][_0xb7f8('0x18')]({'plain':!![]});if(!_0x55338b)throw new Error(_0xb7f8('0x39'));if(_0x55338b[_0xb7f8('0x3a')]===_0xb7f8('0x38')){var _0x2264d3=_0xee6c19['get']({'plain':!![]});var _0x420f31='MailQueues';return db[_0xb7f8('0x3b')][_0xb7f8('0x35')]({'where':{'name':_0x420f31,'userProfileId':_0x55338b['userProfileId']},'raw':!![]})['then'](function(_0x3a1893){if(_0x3a1893&&_0x3a1893[_0xb7f8('0x3c')]===0x0){return db[_0xb7f8('0x1a')][_0xb7f8('0x36')]({'name':_0x2264d3[_0xb7f8('0x1e')],'resourceId':_0x2264d3['id'],'type':_0x3a1893['name'],'sectionId':_0x3a1893['id']},{})['then'](function(){return _0xee6c19;});}else{return _0xee6c19;}})[_0xb7f8('0x2a')](function(_0x23ec41){logger['error'](_0xb7f8('0x3d'),_0x23ec41);throw _0x23ec41;});}return _0xee6c19;})[_0xb7f8('0x1b')](respondWithResult(_0x30bc10,0xc9))[_0xb7f8('0x2a')](handleError(_0x30bc10,null));};exports[_0xb7f8('0x16')]=function(_0x200949,_0x4c0381){if(_0x200949[_0xb7f8('0x37')]['id']){delete _0x200949['body']['id'];}return db['MailQueue'][_0xb7f8('0x35')]({'where':{'id':_0x200949['params']['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x4c0381,null))[_0xb7f8('0x1b')](saveUpdates(_0x200949[_0xb7f8('0x37')],null))['then'](respondWithResult(_0x4c0381,null))['catch'](handleError(_0x4c0381,null));};exports['destroy']=function(_0x222bd1,_0x15971e){return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x222bd1['params']['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x15971e,null))[_0xb7f8('0x1b')](removeEntity(_0x15971e,null))[_0xb7f8('0x2a')](handleError(_0x15971e,null));};exports['describe']=function(_0x3f9ec7,_0xf7fc5d){return db[_0xb7f8('0x26')][_0xb7f8('0x3e')]()[_0xb7f8('0x1b')](respondWithResult(_0xf7fc5d,null))[_0xb7f8('0x2a')](handleError(_0xf7fc5d,null));};exports['getMembers']=function(_0xdc35f5,_0x42877f){var _0x4532b1={'raw':!![],'where':{}},_0x3a70c7={},_0x45dd67;return db[_0xb7f8('0x26')]['findOne']({'where':{'id':_0xdc35f5[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x42877f,null))['then'](function(_0x19e902){if(_0x19e902){_0x45dd67=_0x19e902['get']({'plain':!![]});_0x3a70c7['model']=_[_0xb7f8('0x2d')](db[_0xb7f8('0x3f')][_0xb7f8('0x22')]);_0x3a70c7[_0xb7f8('0x28')]=_[_0xb7f8('0x2d')](_0xdc35f5['query']);_0x3a70c7[_0xb7f8('0x40')]=_[_0xb7f8('0x2e')](_0x3a70c7[_0xb7f8('0x2f')],_0x3a70c7['query']);_0x4532b1[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x3a70c7['model'],qs[_0xb7f8('0x31')](_0xdc35f5['query']['fields']));_0x4532b1[_0xb7f8('0x30')]=_0x4532b1[_0xb7f8('0x30')]['length']?_0x4532b1[_0xb7f8('0x30')]:_0x3a70c7['model'];if(!_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x41')](_0xb7f8('0x42'))){_0x4532b1[_0xb7f8('0x11')]=qs[_0xb7f8('0x11')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x11')]);_0x4532b1[_0xb7f8('0x14')]=qs[_0xb7f8('0x14')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x14')]);}_0x4532b1[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x44')]);_0x4532b1['where']=qs['filters'](_[_0xb7f8('0x45')](_0xdc35f5['query'],_0x3a70c7[_0xb7f8('0x40')]));_0x4532b1['where'][_0xb7f8('0x46')]=_0x19e902['id'];if(_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x47')]){_0x4532b1['where']=_[_0xb7f8('0x33')](_0x4532b1[_0xb7f8('0x25')],{'$or':_['map'](_0x4532b1[_0xb7f8('0x30')],function(_0x3e836a){var _0x25f343={};_0x25f343[_0x3e836a]={'$like':'%'+_0xdc35f5['query'][_0xb7f8('0x47')]+'%'};return _0x25f343;})});}_0x4532b1=_['merge']({},_0x4532b1,_0xdc35f5['options']);return db[_0xb7f8('0x3f')][_0xb7f8('0x48')](_0x4532b1);}})[_0xb7f8('0x1b')](function(_0x148351){if(_0x148351){return db[_0xb7f8('0x49')][_0xb7f8('0x4a')]({'where':{'id':_[_0xb7f8('0x21')](_0x148351,_0xb7f8('0x4b')),'role':_0xb7f8('0x4c')},'attributes':['id',_0xb7f8('0x1e'),_0xb7f8('0x4d'),_0xb7f8('0x4e'),_0xb7f8('0x4f')]});}})[_0xb7f8('0x1b')](function(_0x405ce4){if(_0x405ce4){return{'count':_0x405ce4[_0xb7f8('0x13')],'rows':_[_0xb7f8('0x21')](_0x405ce4[_0xb7f8('0x29')],function(_0x4d1008){return{'membername':_0x4d1008['name'],'UserId':_0x4d1008['id'],'queue_name':_0x45dd67['name'],'MailQueueId':_0x45dd67['id'],'interface':util['format']('%s/%s',_0xb7f8('0x50'),_0x4d1008[_0xb7f8('0x1e')]),'penalty':0x0,'paused':_0x4d1008['mailPause'],'createdAt':_0x4d1008['createdAt'],'updatedAt':_0x4d1008[_0xb7f8('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42877f,_0x4532b1))['catch'](handleError(_0x42877f,null));};exports['getTeams']=function(_0x41dbf2,_0xe69ada){var _0x34bb9d={};var _0x18a8a4={};var _0x48a69a;var _0x1d8bae;return db[_0xb7f8('0x26')][_0xb7f8('0x51')]({'where':{'id':_0x41dbf2[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0xe69ada,null))['then'](function(_0x4c5b0e){if(_0x4c5b0e){_0x48a69a=_0x4c5b0e;_0x18a8a4['model']=_[_0xb7f8('0x2d')](db['Team'][_0xb7f8('0x22')]);_0x18a8a4[_0xb7f8('0x28')]=_['keys'](_0x41dbf2[_0xb7f8('0x28')]);_0x18a8a4['filters']=_[_0xb7f8('0x2e')](_0x18a8a4['model'],_0x18a8a4[_0xb7f8('0x28')]);_0x34bb9d[_0xb7f8('0x30')]=_['intersection'](_0x18a8a4['model'],qs['fields'](_0x41dbf2['query'][_0xb7f8('0x31')]));_0x34bb9d['attributes']=_0x34bb9d[_0xb7f8('0x30')]['length']?_0x34bb9d[_0xb7f8('0x30')]:_0x18a8a4[_0xb7f8('0x2f')];_0x34bb9d[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0x41dbf2['query'][_0xb7f8('0x44')]);_0x34bb9d[_0xb7f8('0x25')]=qs['filters'](_['pick'](_0x41dbf2[_0xb7f8('0x28')],_0x18a8a4[_0xb7f8('0x40')]));if(_0x41dbf2['query']['filter']){_0x34bb9d[_0xb7f8('0x25')]=_[_0xb7f8('0x33')](_0x34bb9d[_0xb7f8('0x25')],{'$or':_['map'](_0x34bb9d['attributes'],function(_0x3d51ea){var _0x25b253={};_0x25b253[_0x3d51ea]={'$like':'%'+_0x41dbf2['query'][_0xb7f8('0x47')]+'%'};return _0x25b253;})});}_0x34bb9d=_[_0xb7f8('0x33')]({},_0x34bb9d,_0x41dbf2[_0xb7f8('0x34')]);return _0x48a69a[_0xb7f8('0x52')](_0x34bb9d);}})['then'](function(_0x4d17a5){if(_0x4d17a5){_0x1d8bae=_0x4d17a5[_0xb7f8('0x32')];if(!_0x41dbf2[_0xb7f8('0x28')]['hasOwnProperty'](_0xb7f8('0x42'))){_0x34bb9d[_0xb7f8('0x11')]=qs['limit'](_0x41dbf2[_0xb7f8('0x28')]['limit']);_0x34bb9d['offset']=qs[_0xb7f8('0x14')](_0x41dbf2[_0xb7f8('0x28')][_0xb7f8('0x14')]);}return _0x48a69a['getTeams'](_0x34bb9d);}})[_0xb7f8('0x1b')](function(_0x93d2a6){if(_0x93d2a6){return _0x93d2a6?{'count':_0x1d8bae,'rows':_0x93d2a6}:null;}})['then'](respondWithResult(_0xe69ada,null))['catch'](handleError(_0xe69ada,null));};exports[_0xb7f8('0x53')]=function(_0xb236a9,_0x543086){var _0x362dc4=_0xb236a9[_0xb7f8('0x37')][_0xb7f8('0x54')];return db[_0xb7f8('0x55')][_0xb7f8('0x48')]({'where':{'id':_0x362dc4},'attributes':['id'],'include':[{'model':db[_0xb7f8('0x49')],'as':_0xb7f8('0x56'),'attributes':['id',_0xb7f8('0x1e'),'online','voicePause',_0xb7f8('0x57')],'raw':!![]}]})['then'](function(_0x230ba5){if(_0x230ba5){var _0x7f5ffd=_[_0xb7f8('0x58')](_0x230ba5,function(_0x1ebebb){var _0x5b57c3=_0x1ebebb[_0xb7f8('0x18')]({'plain':!![]});return _0x5b57c3[_0xb7f8('0x56')];});return db['MailQueue'][_0xb7f8('0x35')]({'where':{'id':_0xb236a9[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](function(_0x58a2d2){return db[_0xb7f8('0x59')][_0xb7f8('0x5a')](function(_0x17676f){return _0x58a2d2[_0xb7f8('0x53')](_0x362dc4,{'transaction':_0x17676f})['then'](function(){return BPromise['each'](_0x7f5ffd,function(_0x3d7104){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x3d7104['id'],'MailQueueId':_0xb236a9[_0xb7f8('0x2c')]['id']},'transaction':_0x17676f});});})[_0xb7f8('0x1b')](function(){_0x7f5ffd[_0xb7f8('0x5b')](function(_0x4127fc){socket[_0xb7f8('0x5c')](_0xb7f8('0x5d'),{'UserId':_0x4127fc['id'],'MailQueueId':_0x58a2d2['id']});});});});});}})[_0xb7f8('0x1b')](respondWithStatusCode(_0x543086,null))['catch'](handleError(_0x543086,null));};exports[_0xb7f8('0x5e')]=function(_0x1d95c5,_0x449263){return db[_0xb7f8('0x55')][_0xb7f8('0x48')]({'where':{'id':_0x1d95c5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb7f8('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb7f8('0x1b')](handleEntityNotFound(_0x449263,null))['then'](function(_0xb9fb5c){var _0x5cfae3=_[_0xb7f8('0x21')](_0xb9fb5c,'id');var _0x55a659=[];var _0x9e1a2e=[];var _0x216d50=squel[_0xb7f8('0x5f')]();_0x216d50['field']('tq.TeamId')[_0xb7f8('0x60')](_0xb7f8('0x61'),'tq')['join'](_0xb7f8('0x62'),'ut',_0xb7f8('0x63'))[_0xb7f8('0x25')](_0xb7f8('0x64'),_0x1d95c5[_0xb7f8('0x2c')]['id']);for(var _0x32a336=0x0;_0x32a336<_0xb9fb5c[_0xb7f8('0x32')];_0x32a336+=0x1){let _0x5f37ac=_0xb9fb5c[_0x32a336];for(var _0x30ddc0=0x0;_0x30ddc0<_0x5f37ac[_0xb7f8('0x56')][_0xb7f8('0x32')];_0x30ddc0+=0x1){let _0x4ea94f=_0x5f37ac['Agents'][_0x30ddc0];var _0x173be3=_0x216d50[_0xb7f8('0x65')]();_0x173be3[_0xb7f8('0x25')](_0xb7f8('0x66'),_0x4ea94f['id']);_0x9e1a2e[_0xb7f8('0x67')](db[_0xb7f8('0x59')]['query'](_0x173be3['toString'](),{'type':db[_0xb7f8('0x59')][_0xb7f8('0x68')][_0xb7f8('0x69')]})[_0xb7f8('0x1b')](function(_0x4ced1c){if(_0x4ced1c[_0xb7f8('0x32')]===0x1){return _0x4ea94f['id'];}else{var _0x48d34e=_[_0xb7f8('0x6a')](_[_0xb7f8('0x21')](_0x4ced1c,'TeamId'),function(_0xba1d70){return _['includes'](_0x5cfae3,_0xba1d70);});if(_0x48d34e){return _0x4ea94f['id'];}}}));}}return BPromise[_0xb7f8('0x6b')](_0x9e1a2e)[_0xb7f8('0x1b')](function(_0x407b8e){_0x55a659=_(_0x55a659)['union'](_0x407b8e)['compact']()[_0xb7f8('0x6c')]();return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x1d95c5['params']['id']}})[_0xb7f8('0x1b')](function(_0x382e36){return db['sequelize'][_0xb7f8('0x5a')](function(_0x33fc2d){return _0x382e36['removeTeams'](_0x1d95c5[_0xb7f8('0x28')][_0xb7f8('0x54')],{'transaction':_0x33fc2d})[_0xb7f8('0x1b')](function(){if(!_['isEmpty'](_0x55a659)){return _0x382e36['removeAgents'](_0x55a659,{'transaction':_0x33fc2d});}})['then'](function(){_0x55a659[_0xb7f8('0x5b')](function(_0x4ee89f){socket['emit'](_0xb7f8('0x6d'),{'UserId':_0x4ee89f,'MailQueueId':_0x382e36['id']});});});});});});})['then'](respondWithStatusCode(_0x449263,null))[_0xb7f8('0x2a')](handleError(_0x449263,null));};exports['addAgents']=function(_0x31003c,_0x1bd703){return db[_0xb7f8('0x26')]['find']({'where':{'id':_0x31003c[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x1bd703,null))['then'](function(_0x1d9709){if(_0x1d9709){return _0x1d9709[_0xb7f8('0x6e')](_0x31003c[_0xb7f8('0x37')]['ids'],_[_0xb7f8('0x6f')](_0x31003c['body'],['ids','id'])||{})[_0xb7f8('0x70')](function(_0x1e06ea){for(var _0x4defb9=0x0;_0x4defb9<_0x31003c[_0xb7f8('0x37')][_0xb7f8('0x54')][_0xb7f8('0x32')];_0x4defb9+=0x1){socket[_0xb7f8('0x5c')]('userMailQueue:save',{'UserId':Number(_0x31003c['body'][_0xb7f8('0x54')][_0x4defb9]),'MailQueueId':Number(_0x31003c[_0xb7f8('0x2c')]['id'])});}return _0x1e06ea;});}})[_0xb7f8('0x1b')](respondWithResult(_0x1bd703,null))[_0xb7f8('0x2a')](handleError(_0x1bd703,null));};exports[_0xb7f8('0x71')]=function(_0x5577da,_0x426d9f){return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x5577da[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x426d9f,null))['then'](function(_0x27b9ab){if(_0x27b9ab){return _0x27b9ab[_0xb7f8('0x71')](_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')])[_0xb7f8('0x1b')](function(){if(_[_0xb7f8('0x72')](_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')])){for(var _0x3ca462=0x0;_0x3ca462<_0x5577da[_0xb7f8('0x28')]['ids'][_0xb7f8('0x32')];_0x3ca462+=0x1){socket['emit'](_0xb7f8('0x6d'),{'UserId':Number(_0x5577da['query'][_0xb7f8('0x54')][_0x3ca462]),'MailQueueId':Number(_0x5577da[_0xb7f8('0x2c')]['id'])});}}else{socket[_0xb7f8('0x5c')](_0xb7f8('0x6d'),{'UserId':Number(_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')]),'MailQueueId':Number(_0x5577da['params']['id'])});}});}})[_0xb7f8('0x1b')](respondWithStatusCode(_0x426d9f,null))[_0xb7f8('0x2a')](handleError(_0x426d9f,null));};exports[_0xb7f8('0x73')]=function(_0x5cca03,_0x40fb9c){var _0x4a1c7f={};var _0x4c246d={};var _0x3858d0;var _0x566e67;return db[_0xb7f8('0x26')]['findOne']({'where':{'id':_0x5cca03[_0xb7f8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x40fb9c,null))[_0xb7f8('0x1b')](function(_0x487c01){if(_0x487c01){_0x3858d0=_0x487c01;_0x4c246d[_0xb7f8('0x2f')]=_[_0xb7f8('0x2d')](db[_0xb7f8('0x49')][_0xb7f8('0x22')]);_0x4c246d[_0xb7f8('0x28')]=_[_0xb7f8('0x2d')](_0x5cca03[_0xb7f8('0x28')]);_0x4c246d[_0xb7f8('0x40')]=_[_0xb7f8('0x2e')](_0x4c246d[_0xb7f8('0x2f')],_0x4c246d[_0xb7f8('0x28')]);_0x4a1c7f[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x4c246d['model'],qs['fields'](_0x5cca03[_0xb7f8('0x28')]['fields']));_0x4a1c7f[_0xb7f8('0x30')]=_0x4a1c7f[_0xb7f8('0x30')][_0xb7f8('0x32')]?_0x4a1c7f[_0xb7f8('0x30')]:_0x4c246d[_0xb7f8('0x2f')];_0x4a1c7f[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0x5cca03['query'][_0xb7f8('0x44')]);_0x4a1c7f[_0xb7f8('0x25')]=qs[_0xb7f8('0x40')](_['pick'](_0x5cca03[_0xb7f8('0x28')],_0x4c246d[_0xb7f8('0x40')]));if(_0x5cca03[_0xb7f8('0x28')][_0xb7f8('0x47')]){_0x4a1c7f[_0xb7f8('0x25')]=_[_0xb7f8('0x33')](_0x4a1c7f['where'],{'$or':_[_0xb7f8('0x21')](_0x4a1c7f[_0xb7f8('0x30')],function(_0x578d5c){var _0x549a12={};_0x549a12[_0x578d5c]={'$like':'%'+_0x5cca03[_0xb7f8('0x28')][_0xb7f8('0x47')]+'%'};return _0x549a12;})});}_0x4a1c7f=_['merge']({},_0x4a1c7f,_0x5cca03[_0xb7f8('0x34')]);return _0x3858d0[_0xb7f8('0x73')](_0x4a1c7f);}})[_0xb7f8('0x1b')](function(_0xb5034b){if(_0xb5034b){_0x566e67=_0xb5034b[_0xb7f8('0x32')];if(!_0x5cca03[_0xb7f8('0x28')]['hasOwnProperty'](_0xb7f8('0x42'))){_0x4a1c7f['limit']=qs[_0xb7f8('0x11')](_0x5cca03['query'][_0xb7f8('0x11')]);_0x4a1c7f[_0xb7f8('0x14')]=qs[_0xb7f8('0x14')](_0x5cca03['query'][_0xb7f8('0x14')]);}return _0x3858d0[_0xb7f8('0x73')](_0x4a1c7f);}})[_0xb7f8('0x1b')](function(_0x70fc85){if(_0x70fc85){return _0x70fc85?{'count':_0x566e67,'rows':_0x70fc85}:null;}})['then'](respondWithResult(_0x40fb9c,null))[_0xb7f8('0x2a')](handleError(_0x40fb9c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index fa8d594..666c90f 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 _0x7f6d=['remove','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7f6d,0xa6));var _0xd7f6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x7f6d[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0xd7f6('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd7f6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd7f6('0x2')};function emitEvent(_0x1d5cf6){return function(_0x160a0b,_0x5ca51b,_0x19057e){MailQueueEvents['emit'](_0x1d5cf6+':'+_0x160a0b['id'],_0x160a0b);MailQueueEvents[_0xd7f6('0x3')](_0x1d5cf6,_0x160a0b);_0x19057e(null);};}for(var e in events){if(events[_0xd7f6('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd7f6('0x5')]=MailQueueEvents; \ No newline at end of file +var _0xb406=['update','emit','hook','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x24799f,_0x15a803){var _0x128dc9=function(_0x2462bc){while(--_0x2462bc){_0x24799f['push'](_0x24799f['shift']());}};_0x128dc9(++_0x15a803);}(_0xb406,0xc0));var _0x6b40=function(_0x1102ff,_0x1d2f6f){_0x1102ff=_0x1102ff-0x0;var _0x23e7c9=_0xb406[_0x1102ff];return _0x23e7c9;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x6b40('0x0'))['db'][_0x6b40('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6b40('0x2')](0x0);var events={'afterCreate':_0x6b40('0x3'),'afterUpdate':_0x6b40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a577f){return function(_0x24857d,_0x1ecc99,_0xc91c92){MailQueueEvents[_0x6b40('0x5')](_0x5a577f+':'+_0x24857d['id'],_0x24857d);MailQueueEvents[_0x6b40('0x5')](_0x5a577f,_0x24857d);_0xc91c92(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x6b40('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 62a64b6..81369ba 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 _0x3527=['exports','define','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x3527,0x9f));var _0x7352=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x3527[_0xfedc72];return _0x2c7c78;};'use strict';var _=require(_0x7352('0x0'));var util=require(_0x7352('0x1'));var logger=require(_0x7352('0x2'))(_0x7352('0x3'));var moment=require(_0x7352('0x4'));var BPromise=require('bluebird');var rp=require(_0x7352('0x5'));var fs=require('fs');var path=require(_0x7352('0x6'));var rimraf=require(_0x7352('0x7'));var config=require(_0x7352('0x8'));var attributes=require('./mailQueue.attributes');module[_0x7352('0x9')]=function(_0x2408d3,_0x461b7e){return _0x2408d3[_0x7352('0xa')]('MailQueue',attributes,{'tableName':_0x7352('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2527=['rimraf','../../config/environment','./mailQueue.attributes','exports','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2527,0x1d9));var _0x7252=function(_0x26149a,_0x177cda){_0x26149a=_0x26149a-0x0;var _0x17c825=_0x2527[_0x26149a];return _0x17c825;};'use strict';var _=require(_0x7252('0x0'));var util=require(_0x7252('0x1'));var logger=require(_0x7252('0x2'))('api');var moment=require(_0x7252('0x3'));var BPromise=require(_0x7252('0x4'));var rp=require(_0x7252('0x5'));var fs=require('fs');var path=require(_0x7252('0x6'));var rimraf=require(_0x7252('0x7'));var config=require(_0x7252('0x8'));var attributes=require(_0x7252('0x9'));module[_0x7252('0xa')]=function(_0xf726b5,_0x5e903d){return _0xf726b5['define']('MailQueue',attributes,{'tableName':_0x7252('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 23118c5..38f2c3c 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 _0xf9b6=['../../config/utils','../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','map','include','model','ShowMailQueue','find','util','moment','randomstring','../../mysqldb'];(function(_0x2c6db2,_0x58d932){var _0x2a3516=function(_0x431eee){while(--_0x431eee){_0x2c6db2['push'](_0x2c6db2['shift']());}};_0x2a3516(++_0x58d932);}(_0xf9b6,0x114));var _0x6f9b=function(_0x54bc96,_0x20cb68){_0x54bc96=_0x54bc96-0x0;var _0x4685b9=_0xf9b6[_0x54bc96];return _0x4685b9;};'use strict';var _=require('lodash');var util=require(_0x6f9b('0x0'));var moment=require(_0x6f9b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f9b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f9b('0x3'))['db'];var utils=require(_0x6f9b('0x4'));var logger=require(_0x6f9b('0x5'))(_0x6f9b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6f9b('0x7')](config['redis'],{'host':_0x6f9b('0x8'),'port':0x18eb});var socket=require(_0x6f9b('0x9'))(new Redis(config[_0x6f9b('0xa')]));require(_0x6f9b('0xb'))['register'](socket);function respondWithRpcPromise(_0x511174,_0x237dd9,_0x337bba){return new BPromise(function(_0x1450ff,_0x38903e){return client['request'](_0x511174,_0x337bba)[_0x6f9b('0xc')](function(_0xd85e13){logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));logger[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x237dd9,_0x6f9b('0xe'),JSON[_0x6f9b('0x11')](_0xd85e13));if(_0xd85e13['error']){if(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x13')]===0x1f4){logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13['error'][_0x6f9b('0x15')]);return _0x38903e(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);}logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);return _0x1450ff(_0xd85e13[_0x6f9b('0x12')]['message']);}else{logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));_0x1450ff(_0xd85e13[_0x6f9b('0x16')][_0x6f9b('0x15')]);}})[_0x6f9b('0x17')](function(_0x2d1bf3){logger['error']('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x2d1bf3);_0x38903e(_0x2d1bf3);});});}exports[_0x6f9b('0x18')]=function(_0x3ae9ea){var _0x3df88c=this;return new Promise(function(_0x3037d8,_0x323807){return db[_0x6f9b('0x19')][_0x6f9b('0x1a')]({'raw':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1d')]||null:null,'limit':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['limit']||null:null,'include':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['include']?_[_0x6f9b('0x1e')](_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x308a35){return{'model':db[_0x308a35[_0x6f9b('0x20')]],'as':_0x308a35['as'],'attributes':_0x308a35[_0x6f9b('0x1d')],'include':_0x308a35[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x308a35[_0x6f9b('0x1f')],function(_0x6e163a){return{'model':db[_0x6e163a[_0x6f9b('0x20')]],'as':_0x6e163a['as'],'attributes':_0x6e163a['attributes'],'include':_0x6e163a[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x6e163a[_0x6f9b('0x1f')],function(_0x51b667){return{'model':db[_0x51b667['model']],'as':_0x51b667['as'],'attributes':_0x51b667[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x22ddfc){logger['info'](_0x6f9b('0x18'),_0x3ae9ea);logger[_0x6f9b('0xf')]('GetMailQueue',_0x3ae9ea,JSON['stringify'](_0x22ddfc));_0x3037d8(_0x22ddfc);})[_0x6f9b('0x17')](function(_0x23df54){logger[_0x6f9b('0x12')]('GetMailQueue',_0x23df54[_0x6f9b('0x15')],_0x3ae9ea);_0x323807(_0x3df88c[_0x6f9b('0x12')](0x1f4,_0x23df54[_0x6f9b('0x15')]));});});};exports[_0x6f9b('0x21')]=function(_0x460227){var _0x2470e1=this;return new Promise(function(_0x3a8f17,_0x2c98fa){return db[_0x6f9b('0x19')][_0x6f9b('0x22')]({'raw':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['attributes']||null:null,'include':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')]?_['map'](_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x1cb962){return{'model':db[_0x1cb962['model']],'as':_0x1cb962['as'],'attributes':_0x1cb962[_0x6f9b('0x1d')],'include':_0x1cb962['include']?_[_0x6f9b('0x1e')](_0x1cb962[_0x6f9b('0x1f')],function(_0x3d46e8){return{'model':db[_0x3d46e8[_0x6f9b('0x20')]],'as':_0x3d46e8['as'],'attributes':_0x3d46e8['attributes'],'include':_0x3d46e8[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x3d46e8['include'],function(_0x3b370f){return{'model':db[_0x3b370f[_0x6f9b('0x20')]],'as':_0x3b370f['as'],'attributes':_0x3b370f[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x23be72){logger['info']('ShowMailQueue',_0x460227);logger['debug']('ShowMailQueue',_0x460227,JSON[_0x6f9b('0x11')](_0x23be72));_0x3a8f17(_0x23be72);})[_0x6f9b('0x17')](function(_0x102961){logger[_0x6f9b('0x12')](_0x6f9b('0x21'),_0x102961[_0x6f9b('0x15')],_0x460227);_0x2c98fa(_0x2470e1[_0x6f9b('0x12')](0x1f4,_0x102961[_0x6f9b('0x15')]));});});}; \ No newline at end of file +var _0xc66c=['find','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x2ebbe5,_0x4bd798){var _0x5a1960=function(_0xf7f849){while(--_0xf7f849){_0x2ebbe5['push'](_0x2ebbe5['shift']());}};_0x5a1960(++_0x4bd798);}(_0xc66c,0x77));var _0xcc66=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc66c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcc66('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcc66('0x1'));var rs=require(_0xcc66('0x2'));var fs=require('fs');var Redis=require(_0xcc66('0x3'));var db=require(_0xcc66('0x4'))['db'];var utils=require(_0xcc66('0x5'));var logger=require(_0xcc66('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc66('0x7')][_0xcc66('0x8')]({'port':0x232a});config[_0xcc66('0x9')]=_[_0xcc66('0xa')](config[_0xcc66('0x9')],{'host':_0xcc66('0xb'),'port':0x18eb});var socket=require(_0xcc66('0xc'))(new Redis(config[_0xcc66('0x9')]));require(_0xcc66('0xd'))[_0xcc66('0xe')](socket);function respondWithRpcPromise(_0x216c52,_0x4202cd,_0x5c33ae){return new BPromise(function(_0x5ea205,_0x4cd1a8){return client[_0xcc66('0xf')](_0x216c52,_0x5c33ae)[_0xcc66('0x10')](function(_0xe54325){logger[_0xcc66('0x11')]('MailQueue,\x20%s,\x20%s',_0x4202cd,'request\x20sent');logger[_0xcc66('0x12')](_0xcc66('0x13'),_0x4202cd,_0xcc66('0x14'),JSON[_0xcc66('0x15')](_0xe54325));if(_0xe54325[_0xcc66('0x16')]){if(_0xe54325[_0xcc66('0x16')]['code']===0x1f4){logger[_0xcc66('0x16')](_0xcc66('0x17'),_0x4202cd,_0xe54325[_0xcc66('0x16')]['message']);return _0x4cd1a8(_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);}logger[_0xcc66('0x16')](_0xcc66('0x17'),_0x4202cd,_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);return _0x5ea205(_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);}else{logger[_0xcc66('0x11')]('MailQueue,\x20%s,\x20%s',_0x4202cd,_0xcc66('0x14'));_0x5ea205(_0xe54325['result'][_0xcc66('0x18')]);}})[_0xcc66('0x19')](function(_0x2ed553){logger['error'](_0xcc66('0x17'),_0x4202cd,_0x2ed553);_0x4cd1a8(_0x2ed553);});});}exports[_0xcc66('0x1a')]=function(_0x29a5a4){var _0x3208c1=this;return new Promise(function(_0x164c0a,_0x33d71b){return db[_0xcc66('0x1b')][_0xcc66('0x1c')]({'raw':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x1e')]===undefined?!![]:![]:!![],'where':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4['options'][_0xcc66('0x1f')]||null:null,'attributes':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x20')]||null:null,'limit':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x21')]||null:null,'include':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')]['include']?_['map'](_0x29a5a4['options'][_0xcc66('0x22')],function(_0x56d65a){return{'model':db[_0x56d65a[_0xcc66('0x23')]],'as':_0x56d65a['as'],'attributes':_0x56d65a[_0xcc66('0x20')],'include':_0x56d65a[_0xcc66('0x22')]?_[_0xcc66('0x24')](_0x56d65a['include'],function(_0x54e968){return{'model':db[_0x54e968[_0xcc66('0x23')]],'as':_0x54e968['as'],'attributes':_0x54e968[_0xcc66('0x20')],'include':_0x54e968[_0xcc66('0x22')]?_[_0xcc66('0x24')](_0x54e968[_0xcc66('0x22')],function(_0x246d7e){return{'model':db[_0x246d7e[_0xcc66('0x23')]],'as':_0x246d7e['as'],'attributes':_0x246d7e[_0xcc66('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcc66('0x10')](function(_0x41b68b){logger[_0xcc66('0x11')](_0xcc66('0x1a'),_0x29a5a4);logger[_0xcc66('0x12')](_0xcc66('0x1a'),_0x29a5a4,JSON[_0xcc66('0x15')](_0x41b68b));_0x164c0a(_0x41b68b);})['catch'](function(_0x52b0bc){logger[_0xcc66('0x16')]('GetMailQueue',_0x52b0bc[_0xcc66('0x18')],_0x29a5a4);_0x33d71b(_0x3208c1[_0xcc66('0x16')](0x1f4,_0x52b0bc['message']));});});};exports['ShowMailQueue']=function(_0x5de9c8){var _0x5ed161=this;return new Promise(function(_0x1be4cb,_0x273cb5){return db[_0xcc66('0x1b')][_0xcc66('0x25')]({'raw':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x1e')]===undefined?!![]:![]:!![],'where':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x1f')]||null:null,'attributes':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')]['attributes']||null:null,'include':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x22')]?_['map'](_0x5de9c8[_0xcc66('0x1d')]['include'],function(_0xe0bf5){return{'model':db[_0xe0bf5['model']],'as':_0xe0bf5['as'],'attributes':_0xe0bf5[_0xcc66('0x20')],'include':_0xe0bf5['include']?_[_0xcc66('0x24')](_0xe0bf5[_0xcc66('0x22')],function(_0x2bb15e){return{'model':db[_0x2bb15e[_0xcc66('0x23')]],'as':_0x2bb15e['as'],'attributes':_0x2bb15e[_0xcc66('0x20')],'include':_0x2bb15e['include']?_['map'](_0x2bb15e[_0xcc66('0x22')],function(_0x318fbc){return{'model':db[_0x318fbc[_0xcc66('0x23')]],'as':_0x318fbc['as'],'attributes':_0x318fbc['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc66('0x10')](function(_0x34bcad){logger[_0xcc66('0x11')](_0xcc66('0x26'),_0x5de9c8);logger[_0xcc66('0x12')]('ShowMailQueue',_0x5de9c8,JSON[_0xcc66('0x15')](_0x34bcad));_0x1be4cb(_0x34bcad);})[_0xcc66('0x19')](function(_0x3ac9d8){logger[_0xcc66('0x16')](_0xcc66('0x26'),_0x3ac9d8[_0xcc66('0x18')],_0x5de9c8);_0x273cb5(_0x5ed161[_0xcc66('0x16')](0x1f4,_0x3ac9d8[_0xcc66('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f79c1b5..e78bc7b 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 _0xf93d=['emit','removeListener','save','remove','update'];(function(_0x5460aa,_0x48b3c3){var _0x66394d=function(_0x133e60){while(--_0x133e60){_0x5460aa['push'](_0x5460aa['shift']());}};_0x66394d(++_0x48b3c3);}(_0xf93d,0x11f));var _0xdf93=function(_0x2b3c95,_0x373430){_0x2b3c95=_0x2b3c95-0x0;var _0xa293e4=_0xf93d[_0x2b3c95];return _0xa293e4;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xdf93('0x0'),_0xdf93('0x1'),_0xdf93('0x2')];function createListener(_0x1367e4,_0x832bda){return function(_0x316298){_0x832bda[_0xdf93('0x3')](_0x1367e4,_0x316298);};}function removeListener(_0x537180,_0x4777cc){return function(){MailQueueEvents[_0xdf93('0x4')](_0x537180,_0x4777cc);};}exports['register']=function(_0x5194ad){for(var _0x378b83=0x0,_0x4d356e=events['length'];_0x378b83<_0x4d356e;_0x378b83++){var _0x3cb77b=events[_0x378b83];var _0x3cbd61=createListener('mailQueue:'+_0x3cb77b,_0x5194ad);MailQueueEvents['on'](_0x3cb77b,_0x3cbd61);}}; \ No newline at end of file +var _0x2ca3=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x38d672,_0xc41411){var _0x33b0ca=function(_0x1022ee){while(--_0x1022ee){_0x38d672['push'](_0x38d672['shift']());}};_0x33b0ca(++_0xc41411);}(_0x2ca3,0xb5));var _0x32ca=function(_0xdffd72,_0xc39199){_0xdffd72=_0xdffd72-0x0;var _0x1ea274=_0x2ca3[_0xdffd72];return _0x1ea274;};'use strict';var MailQueueEvents=require(_0x32ca('0x0'));var events=[_0x32ca('0x1'),'remove',_0x32ca('0x2')];function createListener(_0x4ddccb,_0x1ae6f4){return function(_0xd07e77){_0x1ae6f4[_0x32ca('0x3')](_0x4ddccb,_0xd07e77);};}function removeListener(_0x141ccb,_0x5e9d56){return function(){MailQueueEvents[_0x32ca('0x4')](_0x141ccb,_0x5e9d56);};}exports[_0x32ca('0x5')]=function(_0x2f207d){for(var _0x3eac95=0x0,_0x2b57f4=events[_0x32ca('0x6')];_0x3eac95<_0x2b57f4;_0x3eac95++){var _0x2c5ea3=events[_0x3eac95];var _0x41b4db=createListener(_0x32ca('0x7')+_0x2c5ea3,_0x2f207d);MailQueueEvents['on'](_0x2c5ea3,_0x41b4db);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8ef6578..7735b69 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 _0xa741=['Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x35a016,_0x4ea8e5){var _0x42bb4e=function(_0x650e0){while(--_0x650e0){_0x35a016['push'](_0x35a016['shift']());}};_0x42bb4e(++_0x4ea8e5);}(_0xa741,0x100));var _0x1a74=function(_0x1bbcdb,_0x12ce8f){_0x1bbcdb=_0x1bbcdb-0x0;var _0x3c9c4a=_0xa741[_0x1bbcdb];return _0x3c9c4a;};'use strict';var multer=require(_0x1a74('0x0'));var util=require(_0x1a74('0x1'));var path=require('path');var timeout=require(_0x1a74('0x2'));var express=require(_0x1a74('0x3'));var router=express[_0x1a74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a74('0x6'));var controller=require(_0x1a74('0x7'));router['get']('/',auth[_0x1a74('0x8')](),controller[_0x1a74('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1a74('0xa')]);router[_0x1a74('0xb')](_0x1a74('0xc'),auth[_0x1a74('0x8')](),controller[_0x1a74('0xd')]);router['post']('/',auth[_0x1a74('0x8')](),controller[_0x1a74('0xe')]);router[_0x1a74('0xf')](_0x1a74('0xc'),auth['isAuthenticated'](),controller[_0x1a74('0x10')]);router[_0x1a74('0x11')]('/:id',auth[_0x1a74('0x8')](),controller[_0x1a74('0x12')]);module[_0x1a74('0x13')]=router; \ No newline at end of file +var _0xc479=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xc479,0x91));var _0x9c47=function(_0x1a16d7,_0x2a62a2){_0x1a16d7=_0x1a16d7-0x0;var _0x4e2f6a=_0xc479[_0x1a16d7];return _0x4e2f6a;};'use strict';var multer=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));var path=require('path');var timeout=require(_0x9c47('0x2'));var express=require('express');var router=express[_0x9c47('0x3')]();var fs_extra=require(_0x9c47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9c47('0x5'));var config=require(_0x9c47('0x6'));var controller=require('./mailQueueReport.controller');router[_0x9c47('0x7')]('/',auth[_0x9c47('0x8')](),controller[_0x9c47('0x9')]);router[_0x9c47('0x7')](_0x9c47('0xa'),auth[_0x9c47('0x8')](),controller[_0x9c47('0xb')]);router[_0x9c47('0x7')](_0x9c47('0xc'),auth[_0x9c47('0x8')](),controller['show']);router[_0x9c47('0xd')]('/',auth[_0x9c47('0x8')](),controller[_0x9c47('0xe')]);router[_0x9c47('0xf')](_0x9c47('0xc'),auth[_0x9c47('0x8')](),controller[_0x9c47('0x10')]);router[_0x9c47('0x11')](_0x9c47('0xc'),auth['isAuthenticated'](),controller[_0x9c47('0x12')]);module[_0x9c47('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 84af9d6..bc884c0 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 _0x1c6e=['DATE','moment','sequelize','exports','STRING'];(function(_0x326bbb,_0x2a807b){var _0x1ba652=function(_0x1fd76d){while(--_0x1fd76d){_0x326bbb['push'](_0x326bbb['shift']());}};_0x1ba652(++_0x2a807b);}(_0x1c6e,0x79));var _0xe1c6=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x1c6e[_0x1ca4c3];return _0x4426a6;};'use strict';var moment=require(_0xe1c6('0x0'));var Sequelize=require(_0xe1c6('0x1'));module[_0xe1c6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe1c6('0x3')]},'joinAt':{'type':Sequelize[_0xe1c6('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1c6('0x4')]},'exitAt':{'type':Sequelize[_0xe1c6('0x4')]},'reason':{'type':Sequelize[_0xe1c6('0x3')]}}; \ No newline at end of file +var _0x6ef9=['exports','STRING','DATE','moment','sequelize'];(function(_0x1dd688,_0x3b2f52){var _0x194452=function(_0x5ca10e){while(--_0x5ca10e){_0x1dd688['push'](_0x1dd688['shift']());}};_0x194452(++_0x3b2f52);}(_0x6ef9,0x148));var _0x96ef=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x6ef9[_0x5311e8];return _0x582ad8;};'use strict';var moment=require(_0x96ef('0x0'));var Sequelize=require(_0x96ef('0x1'));module[_0x96ef('0x2')]={'uniqueid':{'type':Sequelize[_0x96ef('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x96ef('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x96ef('0x4')]},'acceptAt':{'type':Sequelize[_0x96ef('0x4')]},'exitAt':{'type':Sequelize[_0x96ef('0x4')]},'reason':{'type':Sequelize[_0x96ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9fdccfa..6e979b2 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 _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','MailQueueReport','includeAll','include'];(function(_0x14af49,_0x4eaf2d){var _0x33b9e6=function(_0x12eb0b){while(--_0x12eb0b){_0x14af49['push'](_0x14af49['shift']());}};_0x33b9e6(++_0x4eaf2d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x5c3c[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['MailQueueReport'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':!![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['MailQueueReport'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['MailQueueReport'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file +var _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x4290b5,_0x51cc70){var _0x56c794=function(_0xf0129e){while(--_0xf0129e){_0x4290b5['push'](_0x4290b5['shift']());}};_0x56c794(++_0x51cc70);}(_0x93e9,0xcc));var _0x993e=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x93e9[_0x4c9380];return _0x49a523;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['MailQueueReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['MailQueueReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['MailQueueReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['MailQueueReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b14ac05..94d2b5f 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 _0xdded=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x1125cd,_0x523546){var _0x15b496=function(_0xc1a381){while(--_0xc1a381){_0x1125cd['push'](_0x1125cd['shift']());}};_0x15b496(++_0x523546);}(_0xdded,0x17a));var _0xddde=function(_0x24d771,_0x49e7bb){_0x24d771=_0x24d771-0x0;var _0x2c6bd7=_0xdded[_0x24d771];return _0x2c6bd7;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var logger=require(_0xddde('0x2'))(_0xddde('0x3'));var moment=require(_0xddde('0x4'));var BPromise=require(_0xddde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddde('0x6'));var rimraf=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var attributes=require(_0xddde('0x9'));module[_0xddde('0xa')]=function(_0x39fd85,_0x3c3021){return _0x39fd85[_0xddde('0xb')](_0xddde('0xc'),attributes,{'tableName':_0xddde('0xd'),'paranoid':![],'indexes':[{'name':_0xddde('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xea4f=['report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','./mailQueueReport.attributes','define'];(function(_0x525ac5,_0x178d00){var _0x3c0fc2=function(_0x2f4873){while(--_0x2f4873){_0x525ac5['push'](_0x525ac5['shift']());}};_0x3c0fc2(++_0x178d00);}(_0xea4f,0x7a));var _0xfea4=function(_0x37a76e,_0x30f473){_0x37a76e=_0x37a76e-0x0;var _0x5328db=_0xea4f[_0x37a76e];return _0x5328db;};'use strict';var _=require(_0xfea4('0x0'));var util=require(_0xfea4('0x1'));var logger=require('../../config/logger')(_0xfea4('0x2'));var moment=require(_0xfea4('0x3'));var BPromise=require(_0xfea4('0x4'));var rp=require(_0xfea4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfea4('0x6'));module['exports']=function(_0x5518a2,_0x545d11){return _0x5518a2[_0xfea4('0x7')]('MailQueueReport',attributes,{'tableName':_0xfea4('0x8'),'paranoid':![],'indexes':[{'name':_0xfea4('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f3dbb2e..eb35a7d 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x51f7a9,_0x1f24e3){var _0xf735ee=function(_0x34b9fe){while(--_0x34b9fe){_0x51f7a9['push'](_0x51f7a9['shift']());}};_0xf735ee(++_0x1f24e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x220b13,_0x53f16e){_0x220b13=_0x220b13-0x0;var _0x57ff0a=_0x5f2f[_0x220b13];return _0x57ff0a;};'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')]('MailQueueReport,\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?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ed261,_0x34ed3b){var _0x46e465=function(_0x3c646e){while(--_0x3c646e){_0x4ed261['push'](_0x4ed261['shift']());}};_0x46e465(++_0x34ed3b);}(_0x1261,0x144));var _0x1126=function(_0x51708f,_0x511834){_0x51708f=_0x51708f-0x0;var _0x5c60a3=_0x1261[_0x51708f];return _0x5c60a3;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7b1d510..5f3df38 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x163cdc,_0x2a275b){var _0x3c554f=function(_0xa73124){while(--_0xa73124){_0x163cdc['push'](_0x163cdc['shift']());}};_0x3c554f(++_0x2a275b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xcb91[_0x622035];return _0x326cf2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56f151,_0x281759){var _0x52c1e3=function(_0x12ba6d){while(--_0x12ba6d){_0x56f151['push'](_0x56f151['shift']());}};_0x52c1e3(++_0x281759);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index dc92b4b..5214b0c 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 _0x68a1=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x12849e,_0x3f9cce){var _0xaec77b=function(_0x35ccb4){while(--_0x35ccb4){_0x12849e['push'](_0x12849e['shift']());}};_0xaec77b(++_0x3f9cce);}(_0x68a1,0x17f));var _0x168a=function(_0x1c6785,_0x363d90){_0x1c6785=_0x1c6785-0x0;var _0x534e7b=_0x68a1[_0x1c6785];return _0x534e7b;};'use strict';var Sequelize=require(_0x168a('0x0'));module['exports']={'description':{'type':Sequelize[_0x168a('0x1')]},'host':{'type':Sequelize[_0x168a('0x1')]},'authentication':{'type':Sequelize[_0x168a('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x168a('0x3')]},'tls':{'type':Sequelize[_0x168a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x168a('0x1')],'defaultValue':_0x168a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x168a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd039=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x53564f,_0x52d58d){var _0xd566eb=function(_0x42ff0c){while(--_0x42ff0c){_0x53564f['push'](_0x53564f['shift']());}};_0xd566eb(++_0x52d58d);}(_0xd039,0x1e9));var _0x9d03=function(_0x2f8d91,_0x208e5f){_0x2f8d91=_0x2f8d91-0x0;var _0x271286=_0xd039[_0x2f8d91];return _0x271286;};'use strict';var Sequelize=require(_0x9d03('0x0'));module[_0x9d03('0x1')]={'description':{'type':Sequelize[_0x9d03('0x2')]},'host':{'type':Sequelize[_0x9d03('0x2')]},'authentication':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9d03('0x2')]},'password':{'type':Sequelize[_0x9d03('0x2')]},'port':{'type':Sequelize[_0x9d03('0x4')]},'tls':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9d03('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9d03('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9c47fea..ec1d9b2 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 _0x3689=['rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','api','moment','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3689,0x14f));var _0x9368=function(_0x3fcbd3,_0x535070){_0x3fcbd3=_0x3fcbd3-0x0;var _0x1ebf0b=_0x3689[_0x3fcbd3];return _0x1ebf0b;};'use strict';var _=require(_0x9368('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9368('0x1'));var moment=require(_0x9368('0x2'));var BPromise=require(_0x9368('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9368('0x4'));var rimraf=require(_0x9368('0x5'));var config=require(_0x9368('0x6'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x5d067f,_0x5a910c){return _0x5d067f[_0x9368('0x7')](_0x9368('0x8'),attributes,{'tableName':_0x9368('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bbd=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x1a3cb2,_0x11c068){var _0x56cf8a=function(_0x52d3c7){while(--_0x52d3c7){_0x1a3cb2['push'](_0x1a3cb2['shift']());}};_0x56cf8a(++_0x11c068);}(_0x0bbd,0x68));var _0xd0bb=function(_0x84cab1,_0x384b3e){_0x84cab1=_0x84cab1-0x0;var _0x364476=_0x0bbd[_0x84cab1];return _0x364476;};'use strict';var _=require(_0xd0bb('0x0'));var util=require(_0xd0bb('0x1'));var logger=require(_0xd0bb('0x2'))('api');var moment=require(_0xd0bb('0x3'));var BPromise=require(_0xd0bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bb('0x5'));var rimraf=require(_0xd0bb('0x6'));var config=require(_0xd0bb('0x7'));var attributes=require(_0xd0bb('0x8'));module[_0xd0bb('0x9')]=function(_0x2bfa66,_0x50bbef){return _0x2bfa66[_0xd0bb('0xa')](_0xd0bb('0xb'),attributes,{'tableName':_0xd0bb('0xc'),'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 2abf41f..a7ef9a7 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 _0xc112=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailServerIn','options','raw','where','limit','include','model','attributes','map','GetMailServerIn','stringify','lodash','util'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xc112,0xec));var _0x2c11=function(_0x1c32f6,_0x1bc453){_0x1c32f6=_0x1c32f6-0x0;var _0x2903bb=_0xc112[_0x1c32f6];return _0x2903bb;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('MailServerIn,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});}exports['GetMailServerIn']=function(_0x89a56){var _0x12ce46=this;return new Promise(function(_0x3988d7,_0x49304f){return db[_0x2c11('0x17')]['findAll']({'raw':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x19')]===undefined?!![]:![]:!![],'where':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1a')]||null:null,'attributes':_0x89a56['options']?_0x89a56['options']['attributes']||null:null,'limit':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1b')]||null:null,'include':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')]?_['map'](_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')],function(_0x45b96f){return{'model':db[_0x45b96f[_0x2c11('0x1d')]],'as':_0x45b96f['as'],'attributes':_0x45b96f[_0x2c11('0x1e')],'include':_0x45b96f[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x45b96f[_0x2c11('0x1c')],function(_0x107983){return{'model':db[_0x107983[_0x2c11('0x1d')]],'as':_0x107983['as'],'attributes':_0x107983['attributes'],'include':_0x107983[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x107983[_0x2c11('0x1c')],function(_0x308da8){return{'model':db[_0x308da8[_0x2c11('0x1d')]],'as':_0x308da8['as'],'attributes':_0x308da8[_0x2c11('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51af52){logger[_0x2c11('0x14')](_0x2c11('0x20'),_0x89a56);logger[_0x2c11('0xf')](_0x2c11('0x20'),_0x89a56,JSON[_0x2c11('0x21')](_0x51af52));_0x3988d7(_0x51af52);})[_0x2c11('0x16')](function(_0x2a494f){logger['error'](_0x2c11('0x20'),_0x2a494f[_0x2c11('0x13')],_0x89a56);_0x49304f(_0x12ce46[_0x2c11('0x11')](0x1f4,_0x2a494f[_0x2c11('0x13')]));});});}; \ No newline at end of file +var _0xc805=['stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x172872,_0x4f4299){var _0x378d84=function(_0x14f36f){while(--_0x14f36f){_0x172872['push'](_0x172872['shift']());}};_0x378d84(++_0x4f4299);}(_0xc805,0x171));var _0x5c80=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0xc805[_0x3ff0f0];return _0x5dc82a;};'use strict';var _=require(_0x5c80('0x0'));var util=require('util');var moment=require(_0x5c80('0x1'));var BPromise=require(_0x5c80('0x2'));var rs=require(_0x5c80('0x3'));var fs=require('fs');var Redis=require(_0x5c80('0x4'));var db=require(_0x5c80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c80('0x6'))(_0x5c80('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c80('0x8'));var client=jayson['client'][_0x5c80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc7f27e,_0xb5d868,_0x5d4c1b){return new BPromise(function(_0x17358d,_0x1960b7){return client[_0x5c80('0xa')](_0xc7f27e,_0x5d4c1b)[_0x5c80('0xb')](function(_0x5a4b2b){logger['info'](_0x5c80('0xc'),_0xb5d868,_0x5c80('0xd'));logger['debug'](_0x5c80('0xe'),_0xb5d868,_0x5c80('0xd'),JSON[_0x5c80('0xf')](_0x5a4b2b));if(_0x5a4b2b[_0x5c80('0x10')]){if(_0x5a4b2b['error'][_0x5c80('0x11')]===0x1f4){logger[_0x5c80('0x10')]('MailServerIn,\x20%s,\x20%s',_0xb5d868,_0x5a4b2b[_0x5c80('0x10')][_0x5c80('0x12')]);return _0x1960b7(_0x5a4b2b[_0x5c80('0x10')][_0x5c80('0x12')]);}logger[_0x5c80('0x10')](_0x5c80('0xc'),_0xb5d868,_0x5a4b2b[_0x5c80('0x10')]['message']);return _0x17358d(_0x5a4b2b['error'][_0x5c80('0x12')]);}else{logger[_0x5c80('0x13')](_0x5c80('0xc'),_0xb5d868,_0x5c80('0xd'));_0x17358d(_0x5a4b2b[_0x5c80('0x14')]['message']);}})[_0x5c80('0x15')](function(_0x164726){logger[_0x5c80('0x10')](_0x5c80('0xc'),_0xb5d868,_0x164726);_0x1960b7(_0x164726);});});}exports[_0x5c80('0x16')]=function(_0x849856){var _0xfd4291=this;return new Promise(function(_0x406d5e,_0x37e2b0){return db[_0x5c80('0x17')][_0x5c80('0x18')]({'raw':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1a')]||null:null,'attributes':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1b')]||null:null,'limit':_0x849856['options']?_0x849856[_0x5c80('0x19')]['limit']||null:null,'include':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1c')]?_['map'](_0x849856['options'][_0x5c80('0x1c')],function(_0x2b5530){return{'model':db[_0x2b5530[_0x5c80('0x1d')]],'as':_0x2b5530['as'],'attributes':_0x2b5530[_0x5c80('0x1b')],'include':_0x2b5530[_0x5c80('0x1c')]?_[_0x5c80('0x1e')](_0x2b5530['include'],function(_0x5ae145){return{'model':db[_0x5ae145[_0x5c80('0x1d')]],'as':_0x5ae145['as'],'attributes':_0x5ae145[_0x5c80('0x1b')],'include':_0x5ae145[_0x5c80('0x1c')]?_[_0x5c80('0x1e')](_0x5ae145[_0x5c80('0x1c')],function(_0x5aa162){return{'model':db[_0x5aa162['model']],'as':_0x5aa162['as'],'attributes':_0x5aa162[_0x5c80('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c80('0xb')](function(_0x596edc){logger[_0x5c80('0x13')](_0x5c80('0x16'),_0x849856);logger[_0x5c80('0x1f')](_0x5c80('0x16'),_0x849856,JSON[_0x5c80('0xf')](_0x596edc));_0x406d5e(_0x596edc);})[_0x5c80('0x15')](function(_0x2196e5){logger[_0x5c80('0x10')](_0x5c80('0x16'),_0x2196e5[_0x5c80('0x12')],_0x849856);_0x37e2b0(_0xfd4291[_0x5c80('0x10')](0x1f4,_0x2196e5[_0x5c80('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 38ac2ff..3ad2c60 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0xbd57e9,_0x25395a){_0xbd57e9=_0xbd57e9-0x0;var _0x3af7ad=_0x7a54[_0xbd57e9];return _0x3af7ad;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f560776..48a6cb3 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 _0xe2cf=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x1fe57c,_0x27f637){var _0x5eb6f4=function(_0x2deedf){while(--_0x2deedf){_0x1fe57c['push'](_0x1fe57c['shift']());}};_0x5eb6f4(++_0x27f637);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0xe2cf[_0x4b14bb];return _0x285200;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfe2c('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe2c('0x1')]},'port':{'type':Sequelize[_0xfe2c('0x2')]},'secure':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe2c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2547=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2547,0x1cd));var _0x7254=function(_0x5acad7,_0x3e6fda){_0x5acad7=_0x5acad7-0x0;var _0x264e42=_0x2547[_0x5acad7];return _0x264e42;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'description':{'type':Sequelize[_0x7254('0x1')]},'host':{'type':Sequelize[_0x7254('0x1')]},'user':{'type':Sequelize[_0x7254('0x1')]},'pass':{'type':Sequelize[_0x7254('0x1')]},'port':{'type':Sequelize[_0x7254('0x2')]},'secure':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x7254('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a4d1b84..c33f5cb 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 _0x5a11=['attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','merge','type','filter','options','where','includeAll','include','MailServerOut','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x2ee3a2,_0xfd0935){var _0x191057=function(_0x350463){while(--_0x350463){_0x2ee3a2['push'](_0x2ee3a2['shift']());}};_0x191057(++_0xfd0935);}(_0x5a11,0xb0));var _0x15a1=function(_0x1ec989,_0x33838c){_0x1ec989=_0x1ec989-0x0;var _0x1af2c8=_0x5a11[_0x1ec989];return _0x1af2c8;};'use strict';var emlformat=require(_0x15a1('0x0'));var rimraf=require(_0x15a1('0x1'));var zipdir=require(_0x15a1('0x2'));var jsonpatch=require(_0x15a1('0x3'));var rp=require('request-promise');var moment=require(_0x15a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15a1('0x5'));var util=require(_0x15a1('0x6'));var path=require(_0x15a1('0x7'));var sox=require(_0x15a1('0x8'));var csv=require(_0x15a1('0x9'));var ejs=require(_0x15a1('0xa'));var fs=require('fs');var fs_extra=require(_0x15a1('0xb'));var _=require(_0x15a1('0xc'));var squel=require(_0x15a1('0xd'));var crypto=require('crypto');var jsforce=require(_0x15a1('0xe'));var deskjs=require(_0x15a1('0xf'));var toCsv=require(_0x15a1('0x9'));var querystring=require(_0x15a1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15a1('0x11'));var qs=require(_0x15a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15a1('0x13'));var logger=require(_0x15a1('0x14'))(_0x15a1('0x15'));var utils=require(_0x15a1('0x16'));var config=require(_0x15a1('0x17'));var licenseUtil=require(_0x15a1('0x18'));var db=require(_0x15a1('0x19'))['db'];function respondWithStatusCode(_0x5b8452,_0x2298cc){_0x2298cc=_0x2298cc||0xcc;return function(_0x2af9c0){if(_0x2af9c0){return _0x5b8452[_0x15a1('0x1a')](_0x2298cc);}return _0x5b8452[_0x15a1('0x1b')](_0x2298cc)['end']();};}function respondWithResult(_0x20fdd3,_0x47e853){_0x47e853=_0x47e853||0xc8;return function(_0x578fec){if(_0x578fec){return _0x20fdd3['status'](_0x47e853)[_0x15a1('0x1c')](_0x578fec);}};}function respondWithFilteredResult(_0x58b7f2,_0x163bb2){return function(_0x6ddbe7){if(_0x6ddbe7){var _0x85f2ed=typeof _0x163bb2[_0x15a1('0x1d')]===_0x15a1('0x1e')&&typeof _0x163bb2[_0x15a1('0x1f')]==='undefined';var _0x5d32d5=_0x6ddbe7['count'];var _0x117e48=_0x85f2ed?0x0:_0x163bb2[_0x15a1('0x1d')];var _0x26c5a5=_0x85f2ed?_0x6ddbe7[_0x15a1('0x20')]:_0x163bb2[_0x15a1('0x1d')]+_0x163bb2['limit'];var _0x27c4f7;if(_0x26c5a5>=_0x5d32d5){_0x26c5a5=_0x5d32d5;_0x27c4f7=0xc8;}else{_0x27c4f7=0xce;}_0x58b7f2[_0x15a1('0x1b')](_0x27c4f7);return _0x58b7f2['set'](_0x15a1('0x21'),_0x117e48+'-'+_0x26c5a5+'/'+_0x5d32d5)[_0x15a1('0x1c')](_0x6ddbe7);}return null;};}function patchUpdates(_0x4f61a1){return function(_0x427678){try{jsonpatch[_0x15a1('0x22')](_0x427678,_0x4f61a1,!![]);}catch(_0x4898b5){return BPromise['reject'](_0x4898b5);}return _0x427678[_0x15a1('0x23')]();};}function saveUpdates(_0x460451,_0x5dd00a){return function(_0x52b8ed){if(_0x52b8ed){return _0x52b8ed['update'](_0x460451)[_0x15a1('0x24')](function(_0x265bbb){return _0x265bbb;});}return null;};}function removeEntity(_0x1e75c2,_0xf3bbd1){return function(_0x2ea3cf){if(_0x2ea3cf){return _0x2ea3cf[_0x15a1('0x25')]()[_0x15a1('0x24')](function(){_0x1e75c2[_0x15a1('0x1b')](0xcc)[_0x15a1('0x26')]();});}};}function handleEntityNotFound(_0xcb03db,_0x5d0640){return function(_0xf3a3db){if(!_0xf3a3db){_0xcb03db[_0x15a1('0x1a')](0x194);}return _0xf3a3db;};}function handleError(_0x5d6050,_0x1388c5){_0x1388c5=_0x1388c5||0x1f4;return function(_0x50ae38){logger[_0x15a1('0x27')](_0x50ae38[_0x15a1('0x28')]);if(_0x50ae38['name']){delete _0x50ae38[_0x15a1('0x29')];}_0x5d6050[_0x15a1('0x1b')](_0x1388c5)[_0x15a1('0x2a')](_0x50ae38);};}exports[_0x15a1('0x2b')]=function(_0x12c706,_0x3dab75){var _0x55de02={},_0x41c578={},_0x5b9232={'count':0x0,'rows':[]};var _0x55c559=_[_0x15a1('0x2c')](db['MailServerOut'][_0x15a1('0x2d')],function(_0x547d33){return{'name':_0x547d33[_0x15a1('0x2e')],'type':_0x547d33['type'][_0x15a1('0x2f')]};});_0x41c578[_0x15a1('0x30')]=_[_0x15a1('0x2c')](_0x55c559,_0x15a1('0x29'));_0x41c578[_0x15a1('0x31')]=_[_0x15a1('0x32')](_0x12c706['query']);_0x41c578[_0x15a1('0x33')]=_['intersection'](_0x41c578['model'],_0x41c578[_0x15a1('0x31')]);_0x55de02[_0x15a1('0x34')]=_[_0x15a1('0x35')](_0x41c578[_0x15a1('0x30')],qs['fields'](_0x12c706[_0x15a1('0x31')]['fields']));_0x55de02[_0x15a1('0x34')]=_0x55de02[_0x15a1('0x34')][_0x15a1('0x36')]?_0x55de02[_0x15a1('0x34')]:_0x41c578[_0x15a1('0x30')];if(!_0x12c706[_0x15a1('0x31')][_0x15a1('0x37')](_0x15a1('0x38'))){_0x55de02['limit']=qs[_0x15a1('0x1f')](_0x12c706[_0x15a1('0x31')][_0x15a1('0x1f')]);_0x55de02[_0x15a1('0x1d')]=qs['offset'](_0x12c706[_0x15a1('0x31')][_0x15a1('0x1d')]);}_0x55de02['order']=qs['sort'](_0x12c706['query'][_0x15a1('0x39')]);_0x55de02['where']=qs[_0x15a1('0x33')](_[_0x15a1('0x3a')](_0x12c706[_0x15a1('0x31')],_0x41c578['filters']),_0x55c559);if(_0x12c706[_0x15a1('0x31')]['filter']){_0x55de02['where']=_[_0x15a1('0x3b')](_0x55de02['where'],{'$or':_[_0x15a1('0x2c')](_0x55c559,function(_0x1740dd){if(_0x1740dd[_0x15a1('0x3c')]!=='VIRTUAL'){var _0x428b5a={};_0x428b5a[_0x1740dd[_0x15a1('0x29')]]={'$like':'%'+_0x12c706[_0x15a1('0x31')][_0x15a1('0x3d')]+'%'};return _0x428b5a;}})});}_0x55de02=_['merge']({},_0x55de02,_0x12c706[_0x15a1('0x3e')]);var _0xc45e63={'where':_0x55de02[_0x15a1('0x3f')]};return db['MailServerOut']['count'](_0xc45e63)[_0x15a1('0x24')](function(_0xd2c0b8){_0x5b9232[_0x15a1('0x20')]=_0xd2c0b8;if(_0x12c706[_0x15a1('0x31')][_0x15a1('0x40')]){_0x55de02[_0x15a1('0x41')]=[{'all':!![]}];}return db[_0x15a1('0x42')][_0x15a1('0x43')](_0x55de02);})[_0x15a1('0x24')](function(_0x174319){_0x5b9232[_0x15a1('0x44')]=_0x174319;return _0x5b9232;})['then'](respondWithFilteredResult(_0x3dab75,_0x55de02))[_0x15a1('0x45')](handleError(_0x3dab75,null));};exports[_0x15a1('0x46')]=function(_0x2dd1fd,_0x4f21e6){var _0xb644aa={'raw':!![],'where':{'id':_0x2dd1fd[_0x15a1('0x47')]['id']}},_0x584622={};_0x584622['model']=_[_0x15a1('0x32')](db['MailServerOut'][_0x15a1('0x2d')]);_0x584622['query']=_[_0x15a1('0x32')](_0x2dd1fd[_0x15a1('0x31')]);_0x584622[_0x15a1('0x33')]=_['intersection'](_0x584622['model'],_0x584622[_0x15a1('0x31')]);_0xb644aa[_0x15a1('0x34')]=_[_0x15a1('0x35')](_0x584622['model'],qs[_0x15a1('0x48')](_0x2dd1fd[_0x15a1('0x31')]['fields']));_0xb644aa[_0x15a1('0x34')]=_0xb644aa[_0x15a1('0x34')][_0x15a1('0x36')]?_0xb644aa['attributes']:_0x584622[_0x15a1('0x30')];if(_0x2dd1fd[_0x15a1('0x31')][_0x15a1('0x40')]){_0xb644aa[_0x15a1('0x41')]=[{'all':!![]}];}_0xb644aa=_[_0x15a1('0x3b')]({},_0xb644aa,_0x2dd1fd[_0x15a1('0x3e')]);return db[_0x15a1('0x42')][_0x15a1('0x49')](_0xb644aa)['then'](handleEntityNotFound(_0x4f21e6,null))[_0x15a1('0x24')](respondWithResult(_0x4f21e6,null))[_0x15a1('0x45')](handleError(_0x4f21e6,null));};exports['create']=function(_0x208e01,_0x56f204){return db[_0x15a1('0x42')][_0x15a1('0x4a')](_0x208e01['body'],{})['then'](respondWithResult(_0x56f204,0xc9))[_0x15a1('0x45')](handleError(_0x56f204,null));};exports['update']=function(_0x2aba41,_0x4c3c8b){if(_0x2aba41['body']['id']){delete _0x2aba41[_0x15a1('0x4b')]['id'];}return db[_0x15a1('0x42')]['find']({'where':{'id':_0x2aba41[_0x15a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c3c8b,null))['then'](saveUpdates(_0x2aba41[_0x15a1('0x4b')],null))[_0x15a1('0x24')](respondWithResult(_0x4c3c8b,null))[_0x15a1('0x45')](handleError(_0x4c3c8b,null));};exports[_0x15a1('0x25')]=function(_0x19f4df,_0x1bf0d0){return db['MailServerOut'][_0x15a1('0x49')]({'where':{'id':_0x19f4df[_0x15a1('0x47')]['id']}})[_0x15a1('0x24')](handleEntityNotFound(_0x1bf0d0,null))[_0x15a1('0x24')](removeEntity(_0x1bf0d0,null))['catch'](handleError(_0x1bf0d0,null));}; \ No newline at end of file +var _0x7f28=['end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0x7f28,0x166));var _0x87f2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f28[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x87f2('0x0'));var rimraf=require(_0x87f2('0x1'));var zipdir=require(_0x87f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87f2('0x3'));var moment=require('moment');var BPromise=require(_0x87f2('0x4'));var Mustache=require('mustache');var util=require(_0x87f2('0x5'));var path=require(_0x87f2('0x6'));var sox=require(_0x87f2('0x7'));var csv=require('to-csv');var ejs=require(_0x87f2('0x8'));var fs=require('fs');var fs_extra=require(_0x87f2('0x9'));var _=require(_0x87f2('0xa'));var squel=require('squel');var crypto=require(_0x87f2('0xb'));var jsforce=require(_0x87f2('0xc'));var deskjs=require(_0x87f2('0xd'));var toCsv=require(_0x87f2('0xe'));var querystring=require(_0x87f2('0xf'));var Papa=require(_0x87f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x87f2('0x11'));var as=require(_0x87f2('0x12'));var hardwareService=require(_0x87f2('0x13'));var logger=require(_0x87f2('0x14'))(_0x87f2('0x15'));var utils=require(_0x87f2('0x16'));var config=require(_0x87f2('0x17'));var licenseUtil=require(_0x87f2('0x18'));var db=require(_0x87f2('0x19'))['db'];function respondWithStatusCode(_0x1cf79c,_0x5d20ec){_0x5d20ec=_0x5d20ec||0xcc;return function(_0x2914b3){if(_0x2914b3){return _0x1cf79c['sendStatus'](_0x5d20ec);}return _0x1cf79c[_0x87f2('0x1a')](_0x5d20ec)[_0x87f2('0x1b')]();};}function respondWithResult(_0x59cfbe,_0x5bbc73){_0x5bbc73=_0x5bbc73||0xc8;return function(_0x30cf30){if(_0x30cf30){return _0x59cfbe[_0x87f2('0x1a')](_0x5bbc73)['json'](_0x30cf30);}};}function respondWithFilteredResult(_0x3e8835,_0x3b5f06){return function(_0x41acaa){if(_0x41acaa){var _0x3150ca=typeof _0x3b5f06[_0x87f2('0x1c')]===_0x87f2('0x1d')&&typeof _0x3b5f06[_0x87f2('0x1e')]===_0x87f2('0x1d');var _0x5cedbd=_0x41acaa[_0x87f2('0x1f')];var _0x13ac7f=_0x3150ca?0x0:_0x3b5f06[_0x87f2('0x1c')];var _0x4646a3=_0x3150ca?_0x41acaa[_0x87f2('0x1f')]:_0x3b5f06['offset']+_0x3b5f06[_0x87f2('0x1e')];var _0x857504;if(_0x4646a3>=_0x5cedbd){_0x4646a3=_0x5cedbd;_0x857504=0xc8;}else{_0x857504=0xce;}_0x3e8835['status'](_0x857504);return _0x3e8835[_0x87f2('0x20')](_0x87f2('0x21'),_0x13ac7f+'-'+_0x4646a3+'/'+_0x5cedbd)['json'](_0x41acaa);}return null;};}function patchUpdates(_0x2fba51){return function(_0xf006a8){try{jsonpatch[_0x87f2('0x22')](_0xf006a8,_0x2fba51,!![]);}catch(_0x1ce85e){return BPromise[_0x87f2('0x23')](_0x1ce85e);}return _0xf006a8[_0x87f2('0x24')]();};}function saveUpdates(_0x1d8df8,_0x47ac37){return function(_0x1f06a9){if(_0x1f06a9){return _0x1f06a9['update'](_0x1d8df8)[_0x87f2('0x25')](function(_0x115451){return _0x115451;});}return null;};}function removeEntity(_0x3965d0,_0x30037e){return function(_0xbc9b9c){if(_0xbc9b9c){return _0xbc9b9c[_0x87f2('0x26')]()[_0x87f2('0x25')](function(){_0x3965d0[_0x87f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdff1,_0x555f4b){return function(_0x2c92df){if(!_0x2c92df){_0x4cdff1['sendStatus'](0x194);}return _0x2c92df;};}function handleError(_0x2880d8,_0xc2e3e2){_0xc2e3e2=_0xc2e3e2||0x1f4;return function(_0x2f4b43){logger[_0x87f2('0x27')](_0x2f4b43[_0x87f2('0x28')]);if(_0x2f4b43['name']){delete _0x2f4b43[_0x87f2('0x29')];}_0x2880d8['status'](_0xc2e3e2)[_0x87f2('0x2a')](_0x2f4b43);};}exports[_0x87f2('0x2b')]=function(_0x1762da,_0x748ea8){var _0x1e8a0d={},_0xf32d2b={},_0xef93e1={'count':0x0,'rows':[]};var _0x5c30a5=_[_0x87f2('0x2c')](db[_0x87f2('0x2d')][_0x87f2('0x2e')],function(_0x1fcf72){return{'name':_0x1fcf72[_0x87f2('0x2f')],'type':_0x1fcf72[_0x87f2('0x30')][_0x87f2('0x31')]};});_0xf32d2b['model']=_['map'](_0x5c30a5,_0x87f2('0x29'));_0xf32d2b[_0x87f2('0x32')]=_[_0x87f2('0x33')](_0x1762da[_0x87f2('0x32')]);_0xf32d2b['filters']=_[_0x87f2('0x34')](_0xf32d2b[_0x87f2('0x35')],_0xf32d2b[_0x87f2('0x32')]);_0x1e8a0d[_0x87f2('0x36')]=_[_0x87f2('0x34')](_0xf32d2b[_0x87f2('0x35')],qs['fields'](_0x1762da[_0x87f2('0x32')][_0x87f2('0x37')]));_0x1e8a0d['attributes']=_0x1e8a0d[_0x87f2('0x36')][_0x87f2('0x38')]?_0x1e8a0d[_0x87f2('0x36')]:_0xf32d2b[_0x87f2('0x35')];if(!_0x1762da[_0x87f2('0x32')][_0x87f2('0x39')](_0x87f2('0x3a'))){_0x1e8a0d[_0x87f2('0x1e')]=qs[_0x87f2('0x1e')](_0x1762da[_0x87f2('0x32')]['limit']);_0x1e8a0d[_0x87f2('0x1c')]=qs[_0x87f2('0x1c')](_0x1762da[_0x87f2('0x32')]['offset']);}_0x1e8a0d[_0x87f2('0x3b')]=qs['sort'](_0x1762da[_0x87f2('0x32')][_0x87f2('0x3c')]);_0x1e8a0d['where']=qs[_0x87f2('0x3d')](_['pick'](_0x1762da[_0x87f2('0x32')],_0xf32d2b['filters']),_0x5c30a5);if(_0x1762da[_0x87f2('0x32')]['filter']){_0x1e8a0d[_0x87f2('0x3e')]=_[_0x87f2('0x3f')](_0x1e8a0d[_0x87f2('0x3e')],{'$or':_[_0x87f2('0x2c')](_0x5c30a5,function(_0x331ee9){if(_0x331ee9[_0x87f2('0x30')]!=='VIRTUAL'){var _0x5756c7={};_0x5756c7[_0x331ee9['name']]={'$like':'%'+_0x1762da[_0x87f2('0x32')][_0x87f2('0x40')]+'%'};return _0x5756c7;}})});}_0x1e8a0d=_['merge']({},_0x1e8a0d,_0x1762da[_0x87f2('0x41')]);var _0x3cc954={'where':_0x1e8a0d[_0x87f2('0x3e')]};return db['MailServerOut'][_0x87f2('0x1f')](_0x3cc954)['then'](function(_0x4c5a86){_0xef93e1[_0x87f2('0x1f')]=_0x4c5a86;if(_0x1762da[_0x87f2('0x32')][_0x87f2('0x42')]){_0x1e8a0d[_0x87f2('0x43')]=[{'all':!![]}];}return db[_0x87f2('0x2d')][_0x87f2('0x44')](_0x1e8a0d);})[_0x87f2('0x25')](function(_0x53e722){_0xef93e1[_0x87f2('0x45')]=_0x53e722;return _0xef93e1;})[_0x87f2('0x25')](respondWithFilteredResult(_0x748ea8,_0x1e8a0d))[_0x87f2('0x46')](handleError(_0x748ea8,null));};exports[_0x87f2('0x47')]=function(_0x167521,_0x22231f){var _0xa0c728={'raw':!![],'where':{'id':_0x167521[_0x87f2('0x48')]['id']}},_0x2d85e4={};_0x2d85e4[_0x87f2('0x35')]=_['keys'](db[_0x87f2('0x2d')]['rawAttributes']);_0x2d85e4[_0x87f2('0x32')]=_[_0x87f2('0x33')](_0x167521[_0x87f2('0x32')]);_0x2d85e4['filters']=_[_0x87f2('0x34')](_0x2d85e4[_0x87f2('0x35')],_0x2d85e4[_0x87f2('0x32')]);_0xa0c728[_0x87f2('0x36')]=_['intersection'](_0x2d85e4[_0x87f2('0x35')],qs[_0x87f2('0x37')](_0x167521['query'][_0x87f2('0x37')]));_0xa0c728[_0x87f2('0x36')]=_0xa0c728['attributes'][_0x87f2('0x38')]?_0xa0c728['attributes']:_0x2d85e4[_0x87f2('0x35')];if(_0x167521['query'][_0x87f2('0x42')]){_0xa0c728['include']=[{'all':!![]}];}_0xa0c728=_[_0x87f2('0x3f')]({},_0xa0c728,_0x167521[_0x87f2('0x41')]);return db[_0x87f2('0x2d')][_0x87f2('0x49')](_0xa0c728)[_0x87f2('0x25')](handleEntityNotFound(_0x22231f,null))[_0x87f2('0x25')](respondWithResult(_0x22231f,null))[_0x87f2('0x46')](handleError(_0x22231f,null));};exports[_0x87f2('0x4a')]=function(_0x45996b,_0x35e92c){return db[_0x87f2('0x2d')][_0x87f2('0x4a')](_0x45996b['body'],{})[_0x87f2('0x25')](respondWithResult(_0x35e92c,0xc9))[_0x87f2('0x46')](handleError(_0x35e92c,null));};exports[_0x87f2('0x4b')]=function(_0x42694f,_0x427196){if(_0x42694f['body']['id']){delete _0x42694f[_0x87f2('0x4c')]['id'];}return db[_0x87f2('0x2d')][_0x87f2('0x49')]({'where':{'id':_0x42694f[_0x87f2('0x48')]['id']}})[_0x87f2('0x25')](handleEntityNotFound(_0x427196,null))[_0x87f2('0x25')](saveUpdates(_0x42694f[_0x87f2('0x4c')],null))[_0x87f2('0x25')](respondWithResult(_0x427196,null))['catch'](handleError(_0x427196,null));};exports[_0x87f2('0x26')]=function(_0x84e669,_0x44f582){return db[_0x87f2('0x2d')][_0x87f2('0x49')]({'where':{'id':_0x84e669[_0x87f2('0x48')]['id']}})[_0x87f2('0x25')](handleEntityNotFound(_0x44f582,null))[_0x87f2('0x25')](removeEntity(_0x44f582,null))[_0x87f2('0x46')](handleError(_0x44f582,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9184629..a21bb38 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 _0xea50=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xea50,0x1b4));var _0x0ea5=function(_0x49fc26,_0x56e2a9){_0x49fc26=_0x49fc26-0x0;var _0x9423a7=_0xea50[_0x49fc26];return _0x9423a7;};'use strict';var _=require(_0x0ea5('0x0'));var util=require(_0x0ea5('0x1'));var logger=require(_0x0ea5('0x2'))(_0x0ea5('0x3'));var moment=require(_0x0ea5('0x4'));var BPromise=require(_0x0ea5('0x5'));var rp=require(_0x0ea5('0x6'));var fs=require('fs');var path=require(_0x0ea5('0x7'));var rimraf=require(_0x0ea5('0x8'));var config=require(_0x0ea5('0x9'));var attributes=require(_0x0ea5('0xa'));module[_0x0ea5('0xb')]=function(_0x5b51ee,_0x255d3e){return _0x5b51ee[_0x0ea5('0xc')](_0x0ea5('0xd'),attributes,{'tableName':_0x0ea5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5a=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x300f9c,_0x59ccd4){var _0x72ca5=function(_0x3a9bc5){while(--_0x3a9bc5){_0x300f9c['push'](_0x300f9c['shift']());}};_0x72ca5(++_0x59ccd4);}(_0xaa5a,0xe7));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var logger=require(_0xaaa5('0x2'))(_0xaaa5('0x3'));var moment=require(_0xaaa5('0x4'));var BPromise=require('bluebird');var rp=require(_0xaaa5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaaa5('0x6'));var config=require(_0xaaa5('0x7'));var attributes=require(_0xaaa5('0x8'));module[_0xaaa5('0x9')]=function(_0x474f88,_0x1454fd){return _0x474f88[_0xaaa5('0xa')]('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 c7c92c1..d489188 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x4b30dd,_0x4d5f63){_0x4b30dd=_0x4b30dd-0x0;var _0x57bbcf=_0x7a54[_0x4b30dd];return _0x57bbcf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x520a99,_0x3780ca){var _0x103611=function(_0x1462fd){while(--_0x1462fd){_0x520a99['push'](_0x520a99['shift']());}};_0x103611(++_0x3780ca);}(_0xdb28,0x106));var _0x8db2=function(_0x382772,_0xac978c){_0x382772=_0x382772-0x0;var _0x1689b1=_0xdb28[_0x382772];return _0x1689b1;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 488c13a..fb94fd9 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 _0x5f2f=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','post','create'];(function(_0x3890f8,_0x1b39df){var _0x40713e=function(_0x4f7f3b){while(--_0x4f7f3b){_0x3890f8['push'](_0x3890f8['shift']());}};_0x40713e(++_0x1b39df);}(_0x5f2f,0x10d));var _0xf5f2=function(_0x5374cb,_0x5d7b89){_0x5374cb=_0x5374cb-0x0;var _0x2d1581=_0x5f2f[_0x5374cb];return _0x2d1581;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf5f2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f2('0x7'));var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0x9')](_0xf5f2('0xd'),auth[_0xf5f2('0xa')](),controller['show']);router[_0xf5f2('0xe')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/:id',auth[_0xf5f2('0xa')](),controller['update']);router['delete'](_0xf5f2('0xd'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x63f1=['show','post','put','/:id','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','get','describe'];(function(_0xd193c2,_0x48669b){var _0x1e2a64=function(_0x547c72){while(--_0x547c72){_0xd193c2['push'](_0xd193c2['shift']());}};_0x1e2a64(++_0x48669b);}(_0x63f1,0x106));var _0x163f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x63f1[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x163f('0x0'));var path=require(_0x163f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x163f('0x2')]();var fs_extra=require(_0x163f('0x3'));var auth=require(_0x163f('0x4'));var interaction=require(_0x163f('0x5'));var config=require('../../config/environment');var controller=require(_0x163f('0x6'));router['get']('/',auth[_0x163f('0x7')](),controller['index']);router[_0x163f('0x8')]('/describe',auth[_0x163f('0x7')](),controller[_0x163f('0x9')]);router['get']('/:id',auth[_0x163f('0x7')](),controller[_0x163f('0xa')]);router[_0x163f('0xb')]('/',auth[_0x163f('0x7')](),controller['create']);router[_0x163f('0xc')](_0x163f('0xd'),auth[_0x163f('0x7')](),controller['update']);router[_0x163f('0xe')](_0x163f('0xd'),auth['isAuthenticated'](),controller[_0x163f('0xf')]);module[_0x163f('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fcb5fa6..8571709 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 _0x9206=['STRING','name','sequelize','exports'];(function(_0x5397f4,_0x3f2c05){var _0x4cba07=function(_0x20b72d){while(--_0x20b72d){_0x5397f4['push'](_0x5397f4['shift']());}};_0x4cba07(++_0x3f2c05);}(_0x9206,0x176));var _0x6920=function(_0x926bc4,_0x3ecd5b){_0x926bc4=_0x926bc4-0x0;var _0x520988=_0x9206[_0x926bc4];return _0x520988;};'use strict';var Sequelize=require(_0x6920('0x0'));module[_0x6920('0x1')]={'name':{'type':Sequelize[_0x6920('0x2')],'unique':_0x6920('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6920('0x2')]}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x02a7,0x7a));var _0x702a=function(_0x166f66,_0x1e9f39){_0x166f66=_0x166f66-0x0;var _0x5294cd=_0x02a7[_0x166f66];return _0x5294cd;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b50a839..0543117 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 _0x3d08=['catch','create','body','describe','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','pick','where','merge','options','includeAll','show','params','include','find'];(function(_0x243bba,_0x1ea69f){var _0x12e696=function(_0x5d3ab5){while(--_0x5d3ab5){_0x243bba['push'](_0x243bba['shift']());}};_0x12e696(++_0x1ea69f);}(_0x3d08,0x1ee));var _0x83d0=function(_0x3c9a7f,_0x2b6593){_0x3c9a7f=_0x3c9a7f-0x0;var _0x115aaf=_0x3d08[_0x3c9a7f];return _0x115aaf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x83d0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83d0('0x1'));var moment=require(_0x83d0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83d0('0x3'));var path=require(_0x83d0('0x4'));var sox=require(_0x83d0('0x5'));var csv=require(_0x83d0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83d0('0x7'));var _=require(_0x83d0('0x8'));var squel=require(_0x83d0('0x9'));var crypto=require(_0x83d0('0xa'));var jsforce=require(_0x83d0('0xb'));var deskjs=require(_0x83d0('0xc'));var toCsv=require(_0x83d0('0x6'));var querystring=require('querystring');var Papa=require(_0x83d0('0xd'));var Redis=require(_0x83d0('0xe'));var authService=require(_0x83d0('0xf'));var qs=require(_0x83d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83d0('0x11'));var logger=require(_0x83d0('0x12'))(_0x83d0('0x13'));var utils=require(_0x83d0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83d0('0x15'))['db'];function respondWithStatusCode(_0x5baed6,_0x106d26){_0x106d26=_0x106d26||0xcc;return function(_0x16d47c){if(_0x16d47c){return _0x5baed6[_0x83d0('0x16')](_0x106d26);}return _0x5baed6[_0x83d0('0x17')](_0x106d26)[_0x83d0('0x18')]();};}function respondWithResult(_0x47d900,_0x34b7c7){_0x34b7c7=_0x34b7c7||0xc8;return function(_0x30ffb3){if(_0x30ffb3){return _0x47d900[_0x83d0('0x17')](_0x34b7c7)[_0x83d0('0x19')](_0x30ffb3);}};}function respondWithFilteredResult(_0x997090,_0x4703a6){return function(_0x1ea7a3){if(_0x1ea7a3){var _0x36933d=typeof _0x4703a6[_0x83d0('0x1a')]===_0x83d0('0x1b')&&typeof _0x4703a6[_0x83d0('0x1c')]===_0x83d0('0x1b');var _0x561b5d=_0x1ea7a3[_0x83d0('0x1d')];var _0x20ea75=_0x36933d?0x0:_0x4703a6[_0x83d0('0x1a')];var _0x1784f3=_0x36933d?_0x1ea7a3['count']:_0x4703a6[_0x83d0('0x1a')]+_0x4703a6[_0x83d0('0x1c')];var _0x5997bc;if(_0x1784f3>=_0x561b5d){_0x1784f3=_0x561b5d;_0x5997bc=0xc8;}else{_0x5997bc=0xce;}_0x997090[_0x83d0('0x17')](_0x5997bc);return _0x997090[_0x83d0('0x1e')](_0x83d0('0x1f'),_0x20ea75+'-'+_0x1784f3+'/'+_0x561b5d)[_0x83d0('0x19')](_0x1ea7a3);}return null;};}function patchUpdates(_0x73ea0f){return function(_0x41c54c){try{jsonpatch[_0x83d0('0x20')](_0x41c54c,_0x73ea0f,!![]);}catch(_0x35fddf){return BPromise[_0x83d0('0x21')](_0x35fddf);}return _0x41c54c['save']();};}function saveUpdates(_0x4cee9d,_0x2bad13){return function(_0x3de1db){if(_0x3de1db){return _0x3de1db[_0x83d0('0x22')](_0x4cee9d)[_0x83d0('0x23')](function(_0x25053c){return _0x25053c;});}return null;};}function removeEntity(_0x43e30d,_0xcce35){return function(_0x1edddc){if(_0x1edddc){return _0x1edddc[_0x83d0('0x24')]()['then'](function(){_0x43e30d[_0x83d0('0x17')](0xcc)[_0x83d0('0x18')]();});}};}function handleEntityNotFound(_0x32cc31,_0x4e31ed){return function(_0x1d967c){if(!_0x1d967c){_0x32cc31['sendStatus'](0x194);}return _0x1d967c;};}function handleError(_0x2665b8,_0xd2dfd6){_0xd2dfd6=_0xd2dfd6||0x1f4;return function(_0x7eda1d){logger[_0x83d0('0x25')](_0x7eda1d[_0x83d0('0x26')]);if(_0x7eda1d[_0x83d0('0x27')]){delete _0x7eda1d[_0x83d0('0x27')];}_0x2665b8[_0x83d0('0x17')](_0xd2dfd6)[_0x83d0('0x28')](_0x7eda1d);};}exports[_0x83d0('0x29')]=function(_0x1d8d9e,_0x2379c1){var _0x1ad6d2={},_0x15ceff={},_0x5c33b9={'count':0x0,'rows':[]};var _0x550428=_['map'](db[_0x83d0('0x2a')][_0x83d0('0x2b')],function(_0x3fa18c){return{'name':_0x3fa18c[_0x83d0('0x2c')],'type':_0x3fa18c[_0x83d0('0x2d')][_0x83d0('0x2e')]};});_0x15ceff[_0x83d0('0x2f')]=_[_0x83d0('0x30')](_0x550428,_0x83d0('0x27'));_0x15ceff[_0x83d0('0x31')]=_[_0x83d0('0x32')](_0x1d8d9e[_0x83d0('0x31')]);_0x15ceff[_0x83d0('0x33')]=_[_0x83d0('0x34')](_0x15ceff[_0x83d0('0x2f')],_0x15ceff['query']);_0x1ad6d2[_0x83d0('0x35')]=_[_0x83d0('0x34')](_0x15ceff[_0x83d0('0x2f')],qs[_0x83d0('0x36')](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x36')]));_0x1ad6d2[_0x83d0('0x35')]=_0x1ad6d2[_0x83d0('0x35')][_0x83d0('0x37')]?_0x1ad6d2[_0x83d0('0x35')]:_0x15ceff[_0x83d0('0x2f')];if(!_0x1d8d9e[_0x83d0('0x31')]['hasOwnProperty']('nolimit')){_0x1ad6d2[_0x83d0('0x1c')]=qs[_0x83d0('0x1c')](_0x1d8d9e['query']['limit']);_0x1ad6d2[_0x83d0('0x1a')]=qs['offset'](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x1a')]);}_0x1ad6d2['order']=qs[_0x83d0('0x38')](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x38')]);_0x1ad6d2['where']=qs[_0x83d0('0x33')](_[_0x83d0('0x39')](_0x1d8d9e[_0x83d0('0x31')],_0x15ceff['filters']),_0x550428);if(_0x1d8d9e[_0x83d0('0x31')]['filter']){_0x1ad6d2[_0x83d0('0x3a')]=_[_0x83d0('0x3b')](_0x1ad6d2['where'],{'$or':_[_0x83d0('0x30')](_0x550428,function(_0x4c18cf){if(_0x4c18cf['type']!=='VIRTUAL'){var _0x21b086={};_0x21b086[_0x4c18cf[_0x83d0('0x27')]]={'$like':'%'+_0x1d8d9e[_0x83d0('0x31')]['filter']+'%'};return _0x21b086;}})});}_0x1ad6d2=_[_0x83d0('0x3b')]({},_0x1ad6d2,_0x1d8d9e[_0x83d0('0x3c')]);var _0x3ecde3={'where':_0x1ad6d2['where']};return db['MailSubstatus'][_0x83d0('0x1d')](_0x3ecde3)['then'](function(_0xfb45d4){_0x5c33b9[_0x83d0('0x1d')]=_0xfb45d4;if(_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x3d')]){_0x1ad6d2['include']=[{'all':!![]}];}return db[_0x83d0('0x2a')]['findAll'](_0x1ad6d2);})['then'](function(_0x2612a8){_0x5c33b9['rows']=_0x2612a8;return _0x5c33b9;})[_0x83d0('0x23')](respondWithFilteredResult(_0x2379c1,_0x1ad6d2))['catch'](handleError(_0x2379c1,null));};exports[_0x83d0('0x3e')]=function(_0x5e24c8,_0xf558a2){var _0x2148fd={'raw':!![],'where':{'id':_0x5e24c8[_0x83d0('0x3f')]['id']}},_0x336388={};_0x336388[_0x83d0('0x2f')]=_['keys'](db[_0x83d0('0x2a')][_0x83d0('0x2b')]);_0x336388['query']=_[_0x83d0('0x32')](_0x5e24c8[_0x83d0('0x31')]);_0x336388[_0x83d0('0x33')]=_[_0x83d0('0x34')](_0x336388['model'],_0x336388[_0x83d0('0x31')]);_0x2148fd['attributes']=_[_0x83d0('0x34')](_0x336388[_0x83d0('0x2f')],qs[_0x83d0('0x36')](_0x5e24c8[_0x83d0('0x31')]['fields']));_0x2148fd['attributes']=_0x2148fd[_0x83d0('0x35')][_0x83d0('0x37')]?_0x2148fd[_0x83d0('0x35')]:_0x336388['model'];if(_0x5e24c8[_0x83d0('0x31')][_0x83d0('0x3d')]){_0x2148fd[_0x83d0('0x40')]=[{'all':!![]}];}_0x2148fd=_['merge']({},_0x2148fd,_0x5e24c8[_0x83d0('0x3c')]);return db[_0x83d0('0x2a')][_0x83d0('0x41')](_0x2148fd)[_0x83d0('0x23')](handleEntityNotFound(_0xf558a2,null))[_0x83d0('0x23')](respondWithResult(_0xf558a2,null))[_0x83d0('0x42')](handleError(_0xf558a2,null));};exports[_0x83d0('0x43')]=function(_0x559018,_0x3ec098){return db[_0x83d0('0x2a')][_0x83d0('0x43')](_0x559018['body'],{})[_0x83d0('0x23')](respondWithResult(_0x3ec098,0xc9))[_0x83d0('0x42')](handleError(_0x3ec098,null));};exports[_0x83d0('0x22')]=function(_0x48cdb5,_0x1d5c4d){if(_0x48cdb5[_0x83d0('0x44')]['id']){delete _0x48cdb5[_0x83d0('0x44')]['id'];}return db['MailSubstatus'][_0x83d0('0x41')]({'where':{'id':_0x48cdb5['params']['id']}})[_0x83d0('0x23')](handleEntityNotFound(_0x1d5c4d,null))[_0x83d0('0x23')](saveUpdates(_0x48cdb5[_0x83d0('0x44')],null))['then'](respondWithResult(_0x1d5c4d,null))[_0x83d0('0x42')](handleError(_0x1d5c4d,null));};exports[_0x83d0('0x24')]=function(_0x5836ea,_0x5ec144){return db['MailSubstatus'][_0x83d0('0x41')]({'where':{'id':_0x5836ea[_0x83d0('0x3f')]['id']}})[_0x83d0('0x23')](handleEntityNotFound(_0x5ec144,null))['then'](removeEntity(_0x5ec144,null))[_0x83d0('0x42')](handleError(_0x5ec144,null));};exports[_0x83d0('0x45')]=function(_0x17f8ce,_0x2e8f1e){return db[_0x83d0('0x2a')]['describe']()[_0x83d0('0x23')](respondWithResult(_0x2e8f1e,null))[_0x83d0('0x42')](handleError(_0x2e8f1e,null));}; \ No newline at end of file +var _0x8690=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MailSubstatus','create','body','find'];(function(_0x353471,_0x19f123){var _0x584806=function(_0x3c8352){while(--_0x3c8352){_0x353471['push'](_0x353471['shift']());}};_0x584806(++_0x19f123);}(_0x8690,0x191));var _0x0869=function(_0xba96b0,_0x36e8f8){_0xba96b0=_0xba96b0-0x0;var _0xdad969=_0x8690[_0xba96b0];return _0xdad969;};'use strict';var emlformat=require(_0x0869('0x0'));var rimraf=require(_0x0869('0x1'));var zipdir=require(_0x0869('0x2'));var jsonpatch=require(_0x0869('0x3'));var rp=require(_0x0869('0x4'));var moment=require(_0x0869('0x5'));var BPromise=require(_0x0869('0x6'));var Mustache=require(_0x0869('0x7'));var util=require(_0x0869('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0869('0x9'));var ejs=require(_0x0869('0xa'));var fs=require('fs');var fs_extra=require(_0x0869('0xb'));var _=require(_0x0869('0xc'));var squel=require('squel');var crypto=require(_0x0869('0xd'));var jsforce=require(_0x0869('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0869('0x9'));var querystring=require(_0x0869('0xf'));var Papa=require(_0x0869('0x10'));var Redis=require(_0x0869('0x11'));var authService=require(_0x0869('0x12'));var qs=require(_0x0869('0x13'));var as=require(_0x0869('0x14'));var hardwareService=require(_0x0869('0x15'));var logger=require(_0x0869('0x16'))(_0x0869('0x17'));var utils=require(_0x0869('0x18'));var config=require(_0x0869('0x19'));var licenseUtil=require(_0x0869('0x1a'));var db=require(_0x0869('0x1b'))['db'];function respondWithStatusCode(_0x22d1a4,_0x8b0e0a){_0x8b0e0a=_0x8b0e0a||0xcc;return function(_0x2f8876){if(_0x2f8876){return _0x22d1a4['sendStatus'](_0x8b0e0a);}return _0x22d1a4['status'](_0x8b0e0a)[_0x0869('0x1c')]();};}function respondWithResult(_0x34852c,_0x36d36c){_0x36d36c=_0x36d36c||0xc8;return function(_0x25e588){if(_0x25e588){return _0x34852c['status'](_0x36d36c)[_0x0869('0x1d')](_0x25e588);}};}function respondWithFilteredResult(_0x17a10b,_0x5767eb){return function(_0x50917d){if(_0x50917d){var _0x181962=typeof _0x5767eb['offset']==='undefined'&&typeof _0x5767eb[_0x0869('0x1e')]===_0x0869('0x1f');var _0x4346bd=_0x50917d[_0x0869('0x20')];var _0x5c09ed=_0x181962?0x0:_0x5767eb[_0x0869('0x21')];var _0x4a03e7=_0x181962?_0x50917d['count']:_0x5767eb['offset']+_0x5767eb[_0x0869('0x1e')];var _0x4f455f;if(_0x4a03e7>=_0x4346bd){_0x4a03e7=_0x4346bd;_0x4f455f=0xc8;}else{_0x4f455f=0xce;}_0x17a10b[_0x0869('0x22')](_0x4f455f);return _0x17a10b[_0x0869('0x23')](_0x0869('0x24'),_0x5c09ed+'-'+_0x4a03e7+'/'+_0x4346bd)[_0x0869('0x1d')](_0x50917d);}return null;};}function patchUpdates(_0x5c5c1c){return function(_0x563164){try{jsonpatch[_0x0869('0x25')](_0x563164,_0x5c5c1c,!![]);}catch(_0x24e8fd){return BPromise[_0x0869('0x26')](_0x24e8fd);}return _0x563164['save']();};}function saveUpdates(_0x574611,_0xb10f52){return function(_0x116855){if(_0x116855){return _0x116855[_0x0869('0x27')](_0x574611)['then'](function(_0x5aabb3){return _0x5aabb3;});}return null;};}function removeEntity(_0x28b973,_0x3921c6){return function(_0x473575){if(_0x473575){return _0x473575[_0x0869('0x28')]()[_0x0869('0x29')](function(){_0x28b973[_0x0869('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c25c,_0x4e303d){return function(_0x5117c8){if(!_0x5117c8){_0x44c25c[_0x0869('0x2a')](0x194);}return _0x5117c8;};}function handleError(_0x2b10e2,_0xdd4781){_0xdd4781=_0xdd4781||0x1f4;return function(_0x9c9aaf){logger['error'](_0x9c9aaf[_0x0869('0x2b')]);if(_0x9c9aaf['name']){delete _0x9c9aaf['name'];}_0x2b10e2['status'](_0xdd4781)['send'](_0x9c9aaf);};}exports[_0x0869('0x2c')]=function(_0x3bfee1,_0xee08b7){var _0x3be3c9={},_0xe070b6={},_0x4307dc={'count':0x0,'rows':[]};var _0x1c8842=_[_0x0869('0x2d')](db['MailSubstatus'][_0x0869('0x2e')],function(_0x296532){return{'name':_0x296532[_0x0869('0x2f')],'type':_0x296532[_0x0869('0x30')][_0x0869('0x31')]};});_0xe070b6[_0x0869('0x32')]=_[_0x0869('0x2d')](_0x1c8842,_0x0869('0x33'));_0xe070b6[_0x0869('0x34')]=_[_0x0869('0x35')](_0x3bfee1['query']);_0xe070b6[_0x0869('0x36')]=_['intersection'](_0xe070b6['model'],_0xe070b6[_0x0869('0x34')]);_0x3be3c9[_0x0869('0x37')]=_[_0x0869('0x38')](_0xe070b6[_0x0869('0x32')],qs[_0x0869('0x39')](_0x3bfee1[_0x0869('0x34')][_0x0869('0x39')]));_0x3be3c9[_0x0869('0x37')]=_0x3be3c9['attributes'][_0x0869('0x3a')]?_0x3be3c9[_0x0869('0x37')]:_0xe070b6[_0x0869('0x32')];if(!_0x3bfee1[_0x0869('0x34')][_0x0869('0x3b')](_0x0869('0x3c'))){_0x3be3c9[_0x0869('0x1e')]=qs[_0x0869('0x1e')](_0x3bfee1[_0x0869('0x34')][_0x0869('0x1e')]);_0x3be3c9[_0x0869('0x21')]=qs['offset'](_0x3bfee1[_0x0869('0x34')][_0x0869('0x21')]);}_0x3be3c9['order']=qs[_0x0869('0x3d')](_0x3bfee1[_0x0869('0x34')]['sort']);_0x3be3c9['where']=qs['filters'](_[_0x0869('0x3e')](_0x3bfee1[_0x0869('0x34')],_0xe070b6[_0x0869('0x36')]),_0x1c8842);if(_0x3bfee1[_0x0869('0x34')][_0x0869('0x3f')]){_0x3be3c9[_0x0869('0x40')]=_[_0x0869('0x41')](_0x3be3c9['where'],{'$or':_['map'](_0x1c8842,function(_0x1836b9){if(_0x1836b9['type']!==_0x0869('0x42')){var _0x5aa8d6={};_0x5aa8d6[_0x1836b9[_0x0869('0x33')]]={'$like':'%'+_0x3bfee1[_0x0869('0x34')][_0x0869('0x3f')]+'%'};return _0x5aa8d6;}})});}_0x3be3c9=_[_0x0869('0x41')]({},_0x3be3c9,_0x3bfee1[_0x0869('0x43')]);var _0x16df64={'where':_0x3be3c9[_0x0869('0x40')]};return db['MailSubstatus'][_0x0869('0x20')](_0x16df64)['then'](function(_0x1c0017){_0x4307dc[_0x0869('0x20')]=_0x1c0017;if(_0x3bfee1[_0x0869('0x34')][_0x0869('0x44')]){_0x3be3c9[_0x0869('0x45')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0869('0x46')](_0x3be3c9);})[_0x0869('0x29')](function(_0x426d85){_0x4307dc[_0x0869('0x47')]=_0x426d85;return _0x4307dc;})['then'](respondWithFilteredResult(_0xee08b7,_0x3be3c9))[_0x0869('0x48')](handleError(_0xee08b7,null));};exports[_0x0869('0x49')]=function(_0x27bf52,_0x11e5e6){var _0x33f4aa={'raw':!![],'where':{'id':_0x27bf52[_0x0869('0x4a')]['id']}},_0x17a8d4={};_0x17a8d4['model']=_['keys'](db[_0x0869('0x4b')][_0x0869('0x2e')]);_0x17a8d4[_0x0869('0x34')]=_[_0x0869('0x35')](_0x27bf52[_0x0869('0x34')]);_0x17a8d4[_0x0869('0x36')]=_[_0x0869('0x38')](_0x17a8d4['model'],_0x17a8d4['query']);_0x33f4aa[_0x0869('0x37')]=_['intersection'](_0x17a8d4['model'],qs[_0x0869('0x39')](_0x27bf52[_0x0869('0x34')][_0x0869('0x39')]));_0x33f4aa[_0x0869('0x37')]=_0x33f4aa['attributes'][_0x0869('0x3a')]?_0x33f4aa[_0x0869('0x37')]:_0x17a8d4['model'];if(_0x27bf52['query']['includeAll']){_0x33f4aa[_0x0869('0x45')]=[{'all':!![]}];}_0x33f4aa=_[_0x0869('0x41')]({},_0x33f4aa,_0x27bf52[_0x0869('0x43')]);return db[_0x0869('0x4b')]['find'](_0x33f4aa)[_0x0869('0x29')](handleEntityNotFound(_0x11e5e6,null))[_0x0869('0x29')](respondWithResult(_0x11e5e6,null))[_0x0869('0x48')](handleError(_0x11e5e6,null));};exports['create']=function(_0x50c3d7,_0x4f3fb6){return db[_0x0869('0x4b')][_0x0869('0x4c')](_0x50c3d7[_0x0869('0x4d')],{})['then'](respondWithResult(_0x4f3fb6,0xc9))[_0x0869('0x48')](handleError(_0x4f3fb6,null));};exports[_0x0869('0x27')]=function(_0xf50093,_0x30b82f){if(_0xf50093[_0x0869('0x4d')]['id']){delete _0xf50093[_0x0869('0x4d')]['id'];}return db['MailSubstatus'][_0x0869('0x4e')]({'where':{'id':_0xf50093[_0x0869('0x4a')]['id']}})[_0x0869('0x29')](handleEntityNotFound(_0x30b82f,null))[_0x0869('0x29')](saveUpdates(_0xf50093[_0x0869('0x4d')],null))[_0x0869('0x29')](respondWithResult(_0x30b82f,null))[_0x0869('0x48')](handleError(_0x30b82f,null));};exports[_0x0869('0x28')]=function(_0x21f3d5,_0x5d7e29){return db['MailSubstatus'][_0x0869('0x4e')]({'where':{'id':_0x21f3d5[_0x0869('0x4a')]['id']}})[_0x0869('0x29')](handleEntityNotFound(_0x5d7e29,null))[_0x0869('0x29')](removeEntity(_0x5d7e29,null))[_0x0869('0x48')](handleError(_0x5d7e29,null));};exports[_0x0869('0x4f')]=function(_0x310528,_0x3d5961){return db['MailSubstatus'][_0x0869('0x4f')]()[_0x0869('0x29')](respondWithResult(_0x3d5961,null))[_0x0869('0x48')](handleError(_0x3d5961,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 92eb500..f513849 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc1e=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x47ae80,_0x716165){var _0x528263=function(_0x284553){while(--_0x284553){_0x47ae80['push'](_0x47ae80['shift']());}};_0x528263(++_0x716165);}(_0xcc1e,0x19b));var _0xecc1=function(_0x59a3ce,_0x23ef83){_0x59a3ce=_0x59a3ce-0x0;var _0x924618=_0xcc1e[_0x59a3ce];return _0x924618;};'use strict';var EventEmitter=require(_0xecc1('0x0'));var MailSubstatus=require(_0xecc1('0x1'))['db'][_0xecc1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xecc1('0x3')](0x0);var events={'afterUpdate':_0xecc1('0x4')};function emitEvent(_0x5b29ae){return function(_0x4dfb14,_0x2ee313,_0x1c10ca){MailSubstatusEvents[_0xecc1('0x5')](_0x5b29ae+':'+_0x4dfb14['id'],_0x4dfb14);MailSubstatusEvents[_0xecc1('0x5')](_0x5b29ae,_0x4dfb14);_0x1c10ca(null);};}for(var e in events){if(events[_0xecc1('0x6')](e)){var event=events[e];MailSubstatus[_0xecc1('0x7')](e,emitEvent(event));}}module[_0xecc1('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x4be1=['events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x4be1,0x130));var _0x14be=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x4be1[_0x582274];return _0x8f14d3;};'use strict';var EventEmitter=require(_0x14be('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x14be('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x14be('0x2')](0x0);var events={'afterUpdate':_0x14be('0x3')};function emitEvent(_0x3da3ef){return function(_0x58a46f,_0x518196,_0xd9661c){MailSubstatusEvents[_0x14be('0x4')](_0x3da3ef+':'+_0x58a46f['id'],_0x58a46f);MailSubstatusEvents[_0x14be('0x4')](_0x3da3ef,_0x58a46f);_0xd9661c(null);};}for(var e in events){if(events[_0x14be('0x5')](e)){var event=events[e];MailSubstatus[_0x14be('0x6')](e,emitEvent(event));}}module[_0x14be('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 084bd64..5629dce 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 _0x2263=['MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x35f570,_0xd00776){var _0x4ade60=function(_0x5bb126){while(--_0x5bb126){_0x35f570['push'](_0x35f570['shift']());}};_0x4ade60(++_0xd00776);}(_0x2263,0x194));var _0x3226=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x2263[_0x2f1762];return _0x8ab21;};'use strict';var attributes=require(_0x3226('0x0'));module[_0x3226('0x1')]=function(_0x21dd1f){var _0x7c845a=_0x21dd1f['models'];return _0x21dd1f[_0x3226('0x2')](_0x3226('0x3'),attributes,{'tableName':_0x3226('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5ed34f,_0x5d3d0b,_0x335f36){return _0x7c845a[_0x3226('0x5')]['update']({'value':_0x5ed34f[_0x3226('0x6')]},{'where':{'field':_0x3226('0x7'),'value':_0x5ed34f[_0x3226('0x8')][_0x3226('0x6')]}})[_0x3226('0x9')](function(){_0x335f36();})[_0x3226('0xa')](function(_0x4ab934){_0x335f36(_0x4ab934);});}}});}; \ No newline at end of file +var _0x5cf1=['update','name','_previousDataValues','then','exports','models','Condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cf1,0xba));var _0x15cf=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x5cf1[_0x149db1];return _0x2059a8;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x15cf('0x0')]=function(_0x556f4e){var _0x309b3a=_0x556f4e[_0x15cf('0x1')];return _0x556f4e['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x293890,_0x3de178,_0x5d0e49){return _0x309b3a[_0x15cf('0x2')][_0x15cf('0x3')]({'value':_0x293890[_0x15cf('0x4')]},{'where':{'field':'mailSubstatus','value':_0x293890[_0x15cf('0x5')]['name']}})[_0x15cf('0x6')](function(){_0x5d0e49();})['catch'](function(_0x34144c){_0x5d0e49(_0x34144c);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c52c6d5..46e2d7b 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 _0x047e=['../../mysqldb','../../config/logger','client','http','request','then','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x207db1,_0x19c38c){var _0x3744e1=function(_0x1cd678){while(--_0x1cd678){_0x207db1['push'](_0x207db1['shift']());}};_0x3744e1(++_0x19c38c);}(_0x047e,0x121));var _0xe047=function(_0x2fa99a,_0x5c2c61){_0x2fa99a=_0x2fa99a-0x0;var _0x3635ff=_0x047e[_0x2fa99a];return _0x3635ff;};'use strict';var _=require(_0xe047('0x0'));var util=require('util');var moment=require(_0xe047('0x1'));var BPromise=require(_0xe047('0x2'));var rs=require(_0xe047('0x3'));var fs=require('fs');var Redis=require(_0xe047('0x4'));var db=require(_0xe047('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe047('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe047('0x7')][_0xe047('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0e18,_0x402fa8,_0x16e2e1){return new BPromise(function(_0x243e93,_0x182c95){return client[_0xe047('0x9')](_0x4a0e18,_0x16e2e1)[_0xe047('0xa')](function(_0x99e42a){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x402fa8,'request\x20sent');logger[_0xe047('0xb')](_0xe047('0xc'),_0x402fa8,_0xe047('0xd'),JSON[_0xe047('0xe')](_0x99e42a));if(_0x99e42a[_0xe047('0xf')]){if(_0x99e42a['error'][_0xe047('0x10')]===0x1f4){logger[_0xe047('0xf')](_0xe047('0x11'),_0x402fa8,_0x99e42a[_0xe047('0xf')]['message']);return _0x182c95(_0x99e42a[_0xe047('0xf')]['message']);}logger[_0xe047('0xf')](_0xe047('0x11'),_0x402fa8,_0x99e42a[_0xe047('0xf')][_0xe047('0x12')]);return _0x243e93(_0x99e42a['error'][_0xe047('0x12')]);}else{logger[_0xe047('0x13')](_0xe047('0x11'),_0x402fa8,_0xe047('0xd'));_0x243e93(_0x99e42a['result'][_0xe047('0x12')]);}})[_0xe047('0x14')](function(_0x310440){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x402fa8,_0x310440);_0x182c95(_0x310440);});});} \ No newline at end of file +var _0xf377=['lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x112c50,_0xc36512){var _0x23c96c=function(_0x2cd808){while(--_0x2cd808){_0x112c50['push'](_0x112c50['shift']());}};_0x23c96c(++_0xc36512);}(_0xf377,0x126));var _0x7f37=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xf377[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x7f37('0x0'));var util=require(_0x7f37('0x1'));var moment=require(_0x7f37('0x2'));var BPromise=require(_0x7f37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f37('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f37('0x5'))('rpc');var config=require(_0x7f37('0x6'));var jayson=require(_0x7f37('0x7'));var client=jayson[_0x7f37('0x8')][_0x7f37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302c4b,_0x5cd66a,_0x3c10ad){return new BPromise(function(_0xf60b2,_0x823c23){return client[_0x7f37('0xa')](_0x302c4b,_0x3c10ad)['then'](function(_0x7d20b3){logger[_0x7f37('0xb')](_0x7f37('0xc'),_0x5cd66a,_0x7f37('0xd'));logger[_0x7f37('0xe')](_0x7f37('0xf'),_0x5cd66a,_0x7f37('0xd'),JSON[_0x7f37('0x10')](_0x7d20b3));if(_0x7d20b3[_0x7f37('0x11')]){if(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x12')]===0x1f4){logger[_0x7f37('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5cd66a,_0x7d20b3[_0x7f37('0x11')]['message']);return _0x823c23(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);}logger['error'](_0x7f37('0xc'),_0x5cd66a,_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);return _0xf60b2(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);}else{logger[_0x7f37('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x5cd66a,'request\x20sent');_0xf60b2(_0x7d20b3['result'][_0x7f37('0x13')]);}})[_0x7f37('0x14')](function(_0x32cdf0){logger[_0x7f37('0x11')](_0x7f37('0xc'),_0x5cd66a,_0x32cdf0);_0x823c23(_0x32cdf0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 62f773a..01c34db 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 _0xf182=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','describe','/:id','post','create','put'];(function(_0x1d76ff,_0x4432a5){var _0x225544=function(_0x2830fd){while(--_0x2830fd){_0x1d76ff['push'](_0x1d76ff['shift']());}};_0x225544(++_0x4432a5);}(_0xf182,0x1a3));var _0x2f18=function(_0x355089,_0x3dc542){_0x355089=_0x355089-0x0;var _0x5df525=_0xf182[_0x355089];return _0x5df525;};'use strict';var multer=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var path=require('path');var timeout=require(_0x2f18('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f18('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2f18('0x4'));var config=require(_0x2f18('0x5'));var controller=require(_0x2f18('0x6'));router[_0x2f18('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f18('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2f18('0x8')]);router[_0x2f18('0x7')](_0x2f18('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2f18('0xa')]('/',auth['isAuthenticated'](),controller[_0x2f18('0xb')]);router[_0x2f18('0xc')]('/:id',auth[_0x2f18('0xd')](),controller[_0x2f18('0xe')]);router[_0x2f18('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2f18('0x10')]);module[_0x2f18('0x11')]=router; \ No newline at end of file +var _0x903d=['get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c0acf,_0x436456){var _0xb5e130=function(_0x4b2424){while(--_0x4b2424){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0xb5e130(++_0x436456);}(_0x903d,0x19c));var _0xd903=function(_0x4da1fe,_0x2243b0){_0x4da1fe=_0x4da1fe-0x0;var _0x32ac56=_0x903d[_0x4da1fe];return _0x32ac56;};'use strict';var multer=require('multer');var util=require(_0xd903('0x0'));var path=require('path');var timeout=require(_0xd903('0x1'));var express=require(_0xd903('0x2'));var router=express[_0xd903('0x3')]();var fs_extra=require(_0xd903('0x4'));var auth=require(_0xd903('0x5'));var interaction=require(_0xd903('0x6'));var config=require(_0xd903('0x7'));var controller=require('./mailTransferReport.controller');router[_0xd903('0x8')]('/',auth['isAuthenticated'](),controller[_0xd903('0x9')]);router['get'](_0xd903('0xa'),auth['isAuthenticated'](),controller[_0xd903('0xb')]);router[_0xd903('0x8')](_0xd903('0xc'),auth[_0xd903('0xd')](),controller[_0xd903('0xe')]);router[_0xd903('0xf')]('/',auth[_0xd903('0xd')](),controller[_0xd903('0x10')]);router[_0xd903('0x11')](_0xd903('0xc'),auth[_0xd903('0xd')](),controller[_0xd903('0x12')]);router['delete'](_0xd903('0xc'),auth['isAuthenticated'](),controller[_0xd903('0x13')]);module[_0xd903('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e3f8d5b..36b4198 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xb43b,0x1b2));var _0xbb43=function(_0xdda602,_0x41e4f3){_0xdda602=_0xdda602-0x0;var _0x5c0da9=_0xb43b[_0xdda602];return _0x5c0da9;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e895f,_0x1d126e){_0x5e895f=_0x5e895f-0x0;var _0x44f0ac=_0xb43b[_0x5e895f];return _0x44f0ac;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cf35325..e3e474b 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 _0xea11=['findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x2b4c10,_0x2241d3){var _0x46968=function(_0x2361f4){while(--_0x2361f4){_0x2b4c10['push'](_0x2b4c10['shift']());}};_0x46968(++_0x2241d3);}(_0xea11,0x101));var _0x1ea1=function(_0x55dcc6,_0x5f3de0){_0x55dcc6=_0x55dcc6-0x0;var _0x2b2e02=_0xea11[_0x55dcc6];return _0x2b2e02;};'use strict';var emlformat=require(_0x1ea1('0x0'));var rimraf=require(_0x1ea1('0x1'));var zipdir=require(_0x1ea1('0x2'));var jsonpatch=require(_0x1ea1('0x3'));var rp=require('request-promise');var moment=require(_0x1ea1('0x4'));var BPromise=require(_0x1ea1('0x5'));var Mustache=require(_0x1ea1('0x6'));var util=require(_0x1ea1('0x7'));var path=require(_0x1ea1('0x8'));var sox=require(_0x1ea1('0x9'));var csv=require(_0x1ea1('0xa'));var ejs=require(_0x1ea1('0xb'));var fs=require('fs');var fs_extra=require(_0x1ea1('0xc'));var _=require(_0x1ea1('0xd'));var squel=require('squel');var crypto=require(_0x1ea1('0xe'));var jsforce=require(_0x1ea1('0xf'));var deskjs=require(_0x1ea1('0x10'));var toCsv=require(_0x1ea1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1ea1('0x11'));var authService=require(_0x1ea1('0x12'));var qs=require(_0x1ea1('0x13'));var as=require(_0x1ea1('0x14'));var hardwareService=require(_0x1ea1('0x15'));var logger=require(_0x1ea1('0x16'))(_0x1ea1('0x17'));var utils=require(_0x1ea1('0x18'));var config=require(_0x1ea1('0x19'));var licenseUtil=require(_0x1ea1('0x1a'));var db=require(_0x1ea1('0x1b'))['db'];function respondWithStatusCode(_0x28534c,_0x2a06a5){_0x2a06a5=_0x2a06a5||0xcc;return function(_0x2b799c){if(_0x2b799c){return _0x28534c[_0x1ea1('0x1c')](_0x2a06a5);}return _0x28534c[_0x1ea1('0x1d')](_0x2a06a5)[_0x1ea1('0x1e')]();};}function respondWithResult(_0x521da7,_0x492a2a){_0x492a2a=_0x492a2a||0xc8;return function(_0x245ad3){if(_0x245ad3){return _0x521da7['status'](_0x492a2a)[_0x1ea1('0x1f')](_0x245ad3);}};}function respondWithFilteredResult(_0x3e19e0,_0x342fd7){return function(_0x365544){if(_0x365544){var _0x27a890=typeof _0x342fd7['offset']===_0x1ea1('0x20')&&typeof _0x342fd7[_0x1ea1('0x21')]==='undefined';var _0x214f63=_0x365544[_0x1ea1('0x22')];var _0x4e3812=_0x27a890?0x0:_0x342fd7[_0x1ea1('0x23')];var _0x300c1e=_0x27a890?_0x365544[_0x1ea1('0x22')]:_0x342fd7[_0x1ea1('0x23')]+_0x342fd7[_0x1ea1('0x21')];var _0x1cb81b;if(_0x300c1e>=_0x214f63){_0x300c1e=_0x214f63;_0x1cb81b=0xc8;}else{_0x1cb81b=0xce;}_0x3e19e0['status'](_0x1cb81b);return _0x3e19e0[_0x1ea1('0x24')](_0x1ea1('0x25'),_0x4e3812+'-'+_0x300c1e+'/'+_0x214f63)['json'](_0x365544);}return null;};}function patchUpdates(_0x2b3707){return function(_0x2531c9){try{jsonpatch[_0x1ea1('0x26')](_0x2531c9,_0x2b3707,!![]);}catch(_0x13b348){return BPromise[_0x1ea1('0x27')](_0x13b348);}return _0x2531c9[_0x1ea1('0x28')]();};}function saveUpdates(_0x3013f9,_0x29b86b){return function(_0x1d3edd){if(_0x1d3edd){return _0x1d3edd[_0x1ea1('0x29')](_0x3013f9)['then'](function(_0x173d73){return _0x173d73;});}return null;};}function removeEntity(_0x3f8baf,_0x3d8abd){return function(_0x4342ee){if(_0x4342ee){return _0x4342ee[_0x1ea1('0x2a')]()[_0x1ea1('0x2b')](function(){_0x3f8baf[_0x1ea1('0x1d')](0xcc)[_0x1ea1('0x1e')]();});}};}function handleEntityNotFound(_0x164442,_0x2390da){return function(_0x3b9ae3){if(!_0x3b9ae3){_0x164442['sendStatus'](0x194);}return _0x3b9ae3;};}function handleError(_0x5b4106,_0x497b97){_0x497b97=_0x497b97||0x1f4;return function(_0x56f14e){logger[_0x1ea1('0x2c')](_0x56f14e[_0x1ea1('0x2d')]);if(_0x56f14e[_0x1ea1('0x2e')]){delete _0x56f14e[_0x1ea1('0x2e')];}_0x5b4106['status'](_0x497b97)[_0x1ea1('0x2f')](_0x56f14e);};}exports[_0x1ea1('0x30')]=function(_0xec7945,_0x578b7d){var _0x1b9b2a={},_0x2ab43a={},_0x5d904a={'count':0x0,'rows':[]};var _0xc976c0=_[_0x1ea1('0x31')](db[_0x1ea1('0x32')]['rawAttributes'],function(_0x4aff0e){return{'name':_0x4aff0e[_0x1ea1('0x33')],'type':_0x4aff0e[_0x1ea1('0x34')][_0x1ea1('0x35')]};});_0x2ab43a[_0x1ea1('0x36')]=_['map'](_0xc976c0,_0x1ea1('0x2e'));_0x2ab43a['query']=_['keys'](_0xec7945[_0x1ea1('0x37')]);_0x2ab43a[_0x1ea1('0x38')]=_[_0x1ea1('0x39')](_0x2ab43a[_0x1ea1('0x36')],_0x2ab43a[_0x1ea1('0x37')]);_0x1b9b2a[_0x1ea1('0x3a')]=_[_0x1ea1('0x39')](_0x2ab43a[_0x1ea1('0x36')],qs[_0x1ea1('0x3b')](_0xec7945[_0x1ea1('0x37')]['fields']));_0x1b9b2a[_0x1ea1('0x3a')]=_0x1b9b2a[_0x1ea1('0x3a')][_0x1ea1('0x3c')]?_0x1b9b2a['attributes']:_0x2ab43a[_0x1ea1('0x36')];if(!_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x3d')](_0x1ea1('0x3e'))){_0x1b9b2a[_0x1ea1('0x21')]=qs['limit'](_0xec7945[_0x1ea1('0x37')]['limit']);_0x1b9b2a[_0x1ea1('0x23')]=qs[_0x1ea1('0x23')](_0xec7945[_0x1ea1('0x37')]['offset']);}_0x1b9b2a[_0x1ea1('0x3f')]=qs['sort'](_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x40')]);_0x1b9b2a[_0x1ea1('0x41')]=qs[_0x1ea1('0x38')](_[_0x1ea1('0x42')](_0xec7945[_0x1ea1('0x37')],_0x2ab43a[_0x1ea1('0x38')]),_0xc976c0);if(_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x43')]){_0x1b9b2a[_0x1ea1('0x41')]=_[_0x1ea1('0x44')](_0x1b9b2a[_0x1ea1('0x41')],{'$or':_['map'](_0xc976c0,function(_0x125508){if(_0x125508[_0x1ea1('0x34')]!==_0x1ea1('0x45')){var _0x2b99d6={};_0x2b99d6[_0x125508[_0x1ea1('0x2e')]]={'$like':'%'+_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x43')]+'%'};return _0x2b99d6;}})});}_0x1b9b2a=_[_0x1ea1('0x44')]({},_0x1b9b2a,_0xec7945['options']);var _0x5825ea={'where':_0x1b9b2a[_0x1ea1('0x41')]};return db['MailTransferReport'][_0x1ea1('0x22')](_0x5825ea)[_0x1ea1('0x2b')](function(_0x23d8a5){_0x5d904a[_0x1ea1('0x22')]=_0x23d8a5;if(_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x46')]){_0x1b9b2a['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x1ea1('0x47')](_0x1b9b2a);})['then'](function(_0x10b396){_0x5d904a[_0x1ea1('0x48')]=_0x10b396;return _0x5d904a;})[_0x1ea1('0x2b')](respondWithFilteredResult(_0x578b7d,_0x1b9b2a))['catch'](handleError(_0x578b7d,null));};exports['show']=function(_0x372aa3,_0x4b7752){var _0x2fb28a={'raw':!![],'where':{'id':_0x372aa3[_0x1ea1('0x49')]['id']}},_0x4487ee={};_0x4487ee[_0x1ea1('0x36')]=_[_0x1ea1('0x4a')](db[_0x1ea1('0x32')][_0x1ea1('0x4b')]);_0x4487ee[_0x1ea1('0x37')]=_[_0x1ea1('0x4a')](_0x372aa3[_0x1ea1('0x37')]);_0x4487ee['filters']=_[_0x1ea1('0x39')](_0x4487ee[_0x1ea1('0x36')],_0x4487ee[_0x1ea1('0x37')]);_0x2fb28a[_0x1ea1('0x3a')]=_[_0x1ea1('0x39')](_0x4487ee[_0x1ea1('0x36')],qs[_0x1ea1('0x3b')](_0x372aa3[_0x1ea1('0x37')][_0x1ea1('0x3b')]));_0x2fb28a[_0x1ea1('0x3a')]=_0x2fb28a['attributes'][_0x1ea1('0x3c')]?_0x2fb28a[_0x1ea1('0x3a')]:_0x4487ee[_0x1ea1('0x36')];if(_0x372aa3[_0x1ea1('0x37')][_0x1ea1('0x46')]){_0x2fb28a['include']=[{'all':!![]}];}_0x2fb28a=_[_0x1ea1('0x44')]({},_0x2fb28a,_0x372aa3[_0x1ea1('0x4c')]);return db[_0x1ea1('0x32')][_0x1ea1('0x4d')](_0x2fb28a)[_0x1ea1('0x2b')](handleEntityNotFound(_0x4b7752,null))[_0x1ea1('0x2b')](respondWithResult(_0x4b7752,null))[_0x1ea1('0x4e')](handleError(_0x4b7752,null));};exports[_0x1ea1('0x4f')]=function(_0x4f46fd,_0x353e4f){return db['MailTransferReport'][_0x1ea1('0x4f')](_0x4f46fd[_0x1ea1('0x50')],{})[_0x1ea1('0x2b')](respondWithResult(_0x353e4f,0xc9))[_0x1ea1('0x4e')](handleError(_0x353e4f,null));};exports['update']=function(_0x20a195,_0x280229){if(_0x20a195[_0x1ea1('0x50')]['id']){delete _0x20a195[_0x1ea1('0x50')]['id'];}return db[_0x1ea1('0x32')]['find']({'where':{'id':_0x20a195[_0x1ea1('0x49')]['id']}})['then'](handleEntityNotFound(_0x280229,null))[_0x1ea1('0x2b')](saveUpdates(_0x20a195[_0x1ea1('0x50')],null))[_0x1ea1('0x2b')](respondWithResult(_0x280229,null))[_0x1ea1('0x4e')](handleError(_0x280229,null));};exports[_0x1ea1('0x2a')]=function(_0x3671af,_0x3646ad){return db[_0x1ea1('0x32')][_0x1ea1('0x4d')]({'where':{'id':_0x3671af['params']['id']}})['then'](handleEntityNotFound(_0x3646ad,null))[_0x1ea1('0x2b')](removeEntity(_0x3646ad,null))[_0x1ea1('0x4e')](handleError(_0x3646ad,null));};exports[_0x1ea1('0x51')]=function(_0x570262,_0x56a7fb){return db['MailTransferReport']['describe']()[_0x1ea1('0x2b')](respondWithResult(_0x56a7fb,null))['catch'](handleError(_0x56a7fb,null));}; \ No newline at end of file +var _0xea24=['limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','describe','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xea24,0x1ef));var _0x4ea2=function(_0xa57e38,_0x53e62d){_0xa57e38=_0xa57e38-0x0;var _0x5a5e0e=_0xea24[_0xa57e38];return _0x5a5e0e;};'use strict';var emlformat=require(_0x4ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ea2('0x2'));var BPromise=require(_0x4ea2('0x3'));var Mustache=require(_0x4ea2('0x4'));var util=require('util');var path=require(_0x4ea2('0x5'));var sox=require(_0x4ea2('0x6'));var csv=require(_0x4ea2('0x7'));var ejs=require(_0x4ea2('0x8'));var fs=require('fs');var fs_extra=require(_0x4ea2('0x9'));var _=require(_0x4ea2('0xa'));var squel=require(_0x4ea2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ea2('0xc'));var toCsv=require(_0x4ea2('0x7'));var querystring=require(_0x4ea2('0xd'));var Papa=require(_0x4ea2('0xe'));var Redis=require(_0x4ea2('0xf'));var authService=require(_0x4ea2('0x10'));var qs=require(_0x4ea2('0x11'));var as=require(_0x4ea2('0x12'));var hardwareService=require(_0x4ea2('0x13'));var logger=require(_0x4ea2('0x14'))('api');var utils=require(_0x4ea2('0x15'));var config=require(_0x4ea2('0x16'));var licenseUtil=require(_0x4ea2('0x17'));var db=require(_0x4ea2('0x18'))['db'];function respondWithStatusCode(_0x379a5b,_0x212546){_0x212546=_0x212546||0xcc;return function(_0x4d0255){if(_0x4d0255){return _0x379a5b[_0x4ea2('0x19')](_0x212546);}return _0x379a5b[_0x4ea2('0x1a')](_0x212546)[_0x4ea2('0x1b')]();};}function respondWithResult(_0x576d24,_0x1b296b){_0x1b296b=_0x1b296b||0xc8;return function(_0x4fd406){if(_0x4fd406){return _0x576d24['status'](_0x1b296b)[_0x4ea2('0x1c')](_0x4fd406);}};}function respondWithFilteredResult(_0x264e06,_0x2eaa91){return function(_0x3ea8b8){if(_0x3ea8b8){var _0x2ca4ad=typeof _0x2eaa91['offset']===_0x4ea2('0x1d')&&typeof _0x2eaa91[_0x4ea2('0x1e')]===_0x4ea2('0x1d');var _0x580ce2=_0x3ea8b8[_0x4ea2('0x1f')];var _0x5d9220=_0x2ca4ad?0x0:_0x2eaa91[_0x4ea2('0x20')];var _0x535315=_0x2ca4ad?_0x3ea8b8[_0x4ea2('0x1f')]:_0x2eaa91['offset']+_0x2eaa91[_0x4ea2('0x1e')];var _0x2c2a81;if(_0x535315>=_0x580ce2){_0x535315=_0x580ce2;_0x2c2a81=0xc8;}else{_0x2c2a81=0xce;}_0x264e06[_0x4ea2('0x1a')](_0x2c2a81);return _0x264e06[_0x4ea2('0x21')]('Content-Range',_0x5d9220+'-'+_0x535315+'/'+_0x580ce2)[_0x4ea2('0x1c')](_0x3ea8b8);}return null;};}function patchUpdates(_0x3338df){return function(_0x328d1e){try{jsonpatch[_0x4ea2('0x22')](_0x328d1e,_0x3338df,!![]);}catch(_0x1d4ca8){return BPromise[_0x4ea2('0x23')](_0x1d4ca8);}return _0x328d1e[_0x4ea2('0x24')]();};}function saveUpdates(_0xfd353b,_0xf7541d){return function(_0x426cbc){if(_0x426cbc){return _0x426cbc[_0x4ea2('0x25')](_0xfd353b)[_0x4ea2('0x26')](function(_0x329421){return _0x329421;});}return null;};}function removeEntity(_0xb75f68,_0x31ac59){return function(_0x53043e){if(_0x53043e){return _0x53043e[_0x4ea2('0x27')]()[_0x4ea2('0x26')](function(){_0xb75f68[_0x4ea2('0x1a')](0xcc)[_0x4ea2('0x1b')]();});}};}function handleEntityNotFound(_0x1abd94,_0x563cd3){return function(_0x23b48b){if(!_0x23b48b){_0x1abd94[_0x4ea2('0x19')](0x194);}return _0x23b48b;};}function handleError(_0x559a52,_0x4090d8){_0x4090d8=_0x4090d8||0x1f4;return function(_0x359e86){logger[_0x4ea2('0x28')](_0x359e86[_0x4ea2('0x29')]);if(_0x359e86[_0x4ea2('0x2a')]){delete _0x359e86[_0x4ea2('0x2a')];}_0x559a52['status'](_0x4090d8)[_0x4ea2('0x2b')](_0x359e86);};}exports[_0x4ea2('0x2c')]=function(_0x4c75d1,_0x52f23c){var _0x4bdea3={},_0x33d85d={},_0x2ee5a0={'count':0x0,'rows':[]};var _0x2eb5fc=_[_0x4ea2('0x2d')](db['MailTransferReport']['rawAttributes'],function(_0x2b404b){return{'name':_0x2b404b[_0x4ea2('0x2e')],'type':_0x2b404b['type']['key']};});_0x33d85d[_0x4ea2('0x2f')]=_['map'](_0x2eb5fc,'name');_0x33d85d[_0x4ea2('0x30')]=_[_0x4ea2('0x31')](_0x4c75d1[_0x4ea2('0x30')]);_0x33d85d[_0x4ea2('0x32')]=_[_0x4ea2('0x33')](_0x33d85d['model'],_0x33d85d[_0x4ea2('0x30')]);_0x4bdea3[_0x4ea2('0x34')]=_['intersection'](_0x33d85d[_0x4ea2('0x2f')],qs[_0x4ea2('0x35')](_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x35')]));_0x4bdea3[_0x4ea2('0x34')]=_0x4bdea3['attributes']['length']?_0x4bdea3[_0x4ea2('0x34')]:_0x33d85d['model'];if(!_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x36')]('nolimit')){_0x4bdea3[_0x4ea2('0x1e')]=qs[_0x4ea2('0x1e')](_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x1e')]);_0x4bdea3[_0x4ea2('0x20')]=qs[_0x4ea2('0x20')](_0x4c75d1['query'][_0x4ea2('0x20')]);}_0x4bdea3['order']=qs[_0x4ea2('0x37')](_0x4c75d1['query'][_0x4ea2('0x37')]);_0x4bdea3[_0x4ea2('0x38')]=qs[_0x4ea2('0x32')](_['pick'](_0x4c75d1['query'],_0x33d85d[_0x4ea2('0x32')]),_0x2eb5fc);if(_0x4c75d1['query'][_0x4ea2('0x39')]){_0x4bdea3[_0x4ea2('0x38')]=_[_0x4ea2('0x3a')](_0x4bdea3[_0x4ea2('0x38')],{'$or':_['map'](_0x2eb5fc,function(_0x15626a){if(_0x15626a[_0x4ea2('0x3b')]!==_0x4ea2('0x3c')){var _0x20b1d2={};_0x20b1d2[_0x15626a[_0x4ea2('0x2a')]]={'$like':'%'+_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x39')]+'%'};return _0x20b1d2;}})});}_0x4bdea3=_[_0x4ea2('0x3a')]({},_0x4bdea3,_0x4c75d1[_0x4ea2('0x3d')]);var _0x23ae14={'where':_0x4bdea3[_0x4ea2('0x38')]};return db[_0x4ea2('0x3e')][_0x4ea2('0x1f')](_0x23ae14)[_0x4ea2('0x26')](function(_0x4ae209){_0x2ee5a0[_0x4ea2('0x1f')]=_0x4ae209;if(_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x3f')]){_0x4bdea3[_0x4ea2('0x40')]=[{'all':!![]}];}return db[_0x4ea2('0x3e')][_0x4ea2('0x41')](_0x4bdea3);})[_0x4ea2('0x26')](function(_0x438437){_0x2ee5a0[_0x4ea2('0x42')]=_0x438437;return _0x2ee5a0;})['then'](respondWithFilteredResult(_0x52f23c,_0x4bdea3))[_0x4ea2('0x43')](handleError(_0x52f23c,null));};exports[_0x4ea2('0x44')]=function(_0x51f29c,_0x19efe9){var _0x37427d={'raw':!![],'where':{'id':_0x51f29c[_0x4ea2('0x45')]['id']}},_0x21acf3={};_0x21acf3[_0x4ea2('0x2f')]=_[_0x4ea2('0x31')](db[_0x4ea2('0x3e')][_0x4ea2('0x46')]);_0x21acf3['query']=_[_0x4ea2('0x31')](_0x51f29c[_0x4ea2('0x30')]);_0x21acf3[_0x4ea2('0x32')]=_[_0x4ea2('0x33')](_0x21acf3[_0x4ea2('0x2f')],_0x21acf3[_0x4ea2('0x30')]);_0x37427d[_0x4ea2('0x34')]=_[_0x4ea2('0x33')](_0x21acf3['model'],qs[_0x4ea2('0x35')](_0x51f29c[_0x4ea2('0x30')][_0x4ea2('0x35')]));_0x37427d['attributes']=_0x37427d['attributes'][_0x4ea2('0x47')]?_0x37427d[_0x4ea2('0x34')]:_0x21acf3[_0x4ea2('0x2f')];if(_0x51f29c['query']['includeAll']){_0x37427d[_0x4ea2('0x40')]=[{'all':!![]}];}_0x37427d=_[_0x4ea2('0x3a')]({},_0x37427d,_0x51f29c[_0x4ea2('0x3d')]);return db['MailTransferReport'][_0x4ea2('0x48')](_0x37427d)[_0x4ea2('0x26')](handleEntityNotFound(_0x19efe9,null))[_0x4ea2('0x26')](respondWithResult(_0x19efe9,null))[_0x4ea2('0x43')](handleError(_0x19efe9,null));};exports['create']=function(_0x5341e9,_0xbbe3bf){return db['MailTransferReport']['create'](_0x5341e9[_0x4ea2('0x49')],{})[_0x4ea2('0x26')](respondWithResult(_0xbbe3bf,0xc9))['catch'](handleError(_0xbbe3bf,null));};exports['update']=function(_0x173a50,_0x2d776d){if(_0x173a50[_0x4ea2('0x49')]['id']){delete _0x173a50[_0x4ea2('0x49')]['id'];}return db[_0x4ea2('0x3e')][_0x4ea2('0x48')]({'where':{'id':_0x173a50['params']['id']}})[_0x4ea2('0x26')](handleEntityNotFound(_0x2d776d,null))[_0x4ea2('0x26')](saveUpdates(_0x173a50[_0x4ea2('0x49')],null))[_0x4ea2('0x26')](respondWithResult(_0x2d776d,null))[_0x4ea2('0x43')](handleError(_0x2d776d,null));};exports[_0x4ea2('0x27')]=function(_0x2c9e0a,_0x33f3f3){return db[_0x4ea2('0x3e')][_0x4ea2('0x48')]({'where':{'id':_0x2c9e0a[_0x4ea2('0x45')]['id']}})[_0x4ea2('0x26')](handleEntityNotFound(_0x33f3f3,null))[_0x4ea2('0x26')](removeEntity(_0x33f3f3,null))[_0x4ea2('0x43')](handleError(_0x33f3f3,null));};exports['describe']=function(_0x1667f3,_0x577d68){return db[_0x4ea2('0x3e')][_0x4ea2('0x4a')]()['then'](respondWithResult(_0x577d68,null))['catch'](handleError(_0x577d68,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e1f75a1..84731f9 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 _0x5977=['path','../../config/environment','exports','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x5977,0xeb));var _0x7597=function(_0x570c8b,_0x1a69f1){_0x570c8b=_0x570c8b-0x0;var _0x4c9d7=_0x5977[_0x570c8b];return _0x4c9d7;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var logger=require(_0x7597('0x2'))('api');var moment=require(_0x7597('0x3'));var BPromise=require(_0x7597('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7597('0x5'));var rimraf=require('rimraf');var config=require(_0x7597('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x7597('0x7')]=function(_0x3875e1,_0x5302c6){return _0x3875e1['define']('MailTransferReport',attributes,{'tableName':_0x7597('0x8'),'paranoid':![],'indexes':[{'name':_0x7597('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x37cc=['api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x37cc,0x185));var _0xc37c=function(_0x22f3bc,_0x54340e){_0x22f3bc=_0x22f3bc-0x0;var _0x325c4e=_0x37cc[_0x22f3bc];return _0x325c4e;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var moment=require(_0xc37c('0x4'));var BPromise=require(_0xc37c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var attributes=require(_0xc37c('0x8'));module[_0xc37c('0x9')]=function(_0x4c9dcd,_0x582100){return _0x4c9dcd[_0xc37c('0xa')](_0xc37c('0xb'),attributes,{'tableName':_0xc37c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc37c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4282493..fe612a2 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 _0x4906=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4906,0xda));var _0x6490=function(_0x3493aa,_0x24d21c){_0x3493aa=_0x3493aa-0x0;var _0x18aff5=_0x4906[_0x3493aa];return _0x18aff5;};'use strict';var _=require(_0x6490('0x0'));var util=require(_0x6490('0x1'));var moment=require(_0x6490('0x2'));var BPromise=require('bluebird');var rs=require(_0x6490('0x3'));var fs=require('fs');var Redis=require(_0x6490('0x4'));var db=require(_0x6490('0x5'))['db'];var utils=require(_0x6490('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6490('0x7'));var jayson=require(_0x6490('0x8'));var client=jayson[_0x6490('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2fae,_0x2f1230,_0x5c76ed){return new BPromise(function(_0x241b6f,_0x539ad9){return client[_0x6490('0xa')](_0x4e2fae,_0x5c76ed)[_0x6490('0xb')](function(_0x505533){logger['info'](_0x6490('0xc'),_0x2f1230,_0x6490('0xd'));logger[_0x6490('0xe')](_0x6490('0xf'),_0x2f1230,_0x6490('0xd'),JSON['stringify'](_0x505533));if(_0x505533[_0x6490('0x10')]){if(_0x505533[_0x6490('0x10')]['code']===0x1f4){logger['error'](_0x6490('0xc'),_0x2f1230,_0x505533[_0x6490('0x10')][_0x6490('0x11')]);return _0x539ad9(_0x505533[_0x6490('0x10')][_0x6490('0x11')]);}logger[_0x6490('0x10')](_0x6490('0xc'),_0x2f1230,_0x505533[_0x6490('0x10')]['message']);return _0x241b6f(_0x505533[_0x6490('0x10')][_0x6490('0x11')]);}else{logger[_0x6490('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2f1230,_0x6490('0xd'));_0x241b6f(_0x505533[_0x6490('0x13')]['message']);}})[_0x6490('0x14')](function(_0x445fe2){logger[_0x6490('0x10')](_0x6490('0xc'),_0x2f1230,_0x445fe2);_0x539ad9(_0x445fe2);});});} \ No newline at end of file +var _0x7edc=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x30fed1,_0x9f755b){var _0x2d9ee0=function(_0x52a2cf){while(--_0x52a2cf){_0x30fed1['push'](_0x30fed1['shift']());}};_0x2d9ee0(++_0x9f755b);}(_0x7edc,0x152));var _0xc7ed=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x7edc[_0x533132];return _0x1a7447;};'use strict';var _=require(_0xc7ed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7ed('0x1'));var rs=require(_0xc7ed('0x2'));var fs=require('fs');var Redis=require(_0xc7ed('0x3'));var db=require(_0xc7ed('0x4'))['db'];var utils=require(_0xc7ed('0x5'));var logger=require('../../config/logger')(_0xc7ed('0x6'));var config=require(_0xc7ed('0x7'));var jayson=require(_0xc7ed('0x8'));var client=jayson['client'][_0xc7ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d073,_0x21c822,_0x585814){return new BPromise(function(_0x136a71,_0x3d593d){return client[_0xc7ed('0xa')](_0x8d073,_0x585814)['then'](function(_0x36f769){logger[_0xc7ed('0xb')](_0xc7ed('0xc'),_0x21c822,_0xc7ed('0xd'));logger['debug'](_0xc7ed('0xe'),_0x21c822,_0xc7ed('0xd'),JSON[_0xc7ed('0xf')](_0x36f769));if(_0x36f769[_0xc7ed('0x10')]){if(_0x36f769[_0xc7ed('0x10')]['code']===0x1f4){logger[_0xc7ed('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x21c822,_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);return _0x3d593d(_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);}logger[_0xc7ed('0x10')](_0xc7ed('0xc'),_0x21c822,_0x36f769['error'][_0xc7ed('0x11')]);return _0x136a71(_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);}else{logger['info'](_0xc7ed('0xc'),_0x21c822,_0xc7ed('0xd'));_0x136a71(_0x36f769['result'][_0xc7ed('0x11')]);}})[_0xc7ed('0x12')](function(_0x1fef02){logger[_0xc7ed('0x10')](_0xc7ed('0xc'),_0x21c822,_0x1fef02);_0x3d593d(_0x1fef02);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a793dcb..aa4c512 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 _0x53ae=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1c4fd7,_0x4cc31e){var _0x4b4e54=function(_0x593d06){while(--_0x593d06){_0x1c4fd7['push'](_0x1c4fd7['shift']());}};_0x4b4e54(++_0x4cc31e);}(_0x53ae,0x18d));var _0xe53a=function(_0x183fb8,_0x1a3918){_0x183fb8=_0x183fb8-0x0;var _0xa5d821=_0x53ae[_0x183fb8];return _0xa5d821;};'use strict';var multer=require(_0xe53a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe53a('0x1'));var express=require(_0xe53a('0x2'));var router=express['Router']();var fs_extra=require(_0xe53a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe53a('0x4'));var config=require(_0xe53a('0x5'));var controller=require('./memberReport.controller');router[_0xe53a('0x6')]('/',auth[_0xe53a('0x7')](),controller[_0xe53a('0x8')]);router[_0xe53a('0x6')](_0xe53a('0x9'),auth['isAuthenticated'](),controller[_0xe53a('0xa')]);router[_0xe53a('0x6')](_0xe53a('0xb'),auth[_0xe53a('0x7')](),controller['show']);router[_0xe53a('0xc')]('/',auth[_0xe53a('0x7')](),controller[_0xe53a('0xd')]);router[_0xe53a('0xe')](_0xe53a('0xb'),auth[_0xe53a('0x7')](),controller[_0xe53a('0xf')]);router[_0xe53a('0x10')]('/:id',auth[_0xe53a('0x7')](),controller[_0xe53a('0x11')]);module[_0xe53a('0x12')]=router; \ No newline at end of file +var _0x972e=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x140734,_0x33df05){var _0x4de877=function(_0x214249){while(--_0x214249){_0x140734['push'](_0x140734['shift']());}};_0x4de877(++_0x33df05);}(_0x972e,0x6e));var _0xe972=function(_0x1273a7,_0x767a60){_0x1273a7=_0x1273a7-0x0;var _0x29783c=_0x972e[_0x1273a7];return _0x29783c;};'use strict';var multer=require('multer');var util=require(_0xe972('0x0'));var path=require('path');var timeout=require(_0xe972('0x1'));var express=require(_0xe972('0x2'));var router=express[_0xe972('0x3')]();var fs_extra=require(_0xe972('0x4'));var auth=require(_0xe972('0x5'));var interaction=require(_0xe972('0x6'));var config=require(_0xe972('0x7'));var controller=require(_0xe972('0x8'));router[_0xe972('0x9')]('/',auth['isAuthenticated'](),controller[_0xe972('0xa')]);router[_0xe972('0x9')](_0xe972('0xb'),auth[_0xe972('0xc')](),controller[_0xe972('0xd')]);router[_0xe972('0x9')](_0xe972('0xe'),auth[_0xe972('0xc')](),controller[_0xe972('0xf')]);router[_0xe972('0x10')]('/',auth[_0xe972('0xc')](),controller[_0xe972('0x11')]);router[_0xe972('0x12')](_0xe972('0xe'),auth['isAuthenticated'](),controller[_0xe972('0x13')]);router['delete'](_0xe972('0xe'),auth['isAuthenticated'](),controller[_0xe972('0x14')]);module[_0xe972('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 914485e..25e22fd 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 _0x7345=['enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x124c75,_0x332013){var _0x5c5471=function(_0x2fd3eb){while(--_0x2fd3eb){_0x124c75['push'](_0x124c75['shift']());}};_0x5c5471(++_0x332013);}(_0x7345,0x1ba));var _0x5734=function(_0x44b04e,_0x3bbf02){_0x44b04e=_0x44b04e-0x0;var _0x1cb884=_0x7345[_0x44b04e];return _0x1cb884;};'use strict';var Sequelize=require(_0x5734('0x0'));var moment=require(_0x5734('0x1'));module[_0x5734('0x2')]={'channel':{'type':Sequelize[_0x5734('0x3')]},'membername':{'type':Sequelize[_0x5734('0x3')]},'interface':{'type':Sequelize[_0x5734('0x3')]},'type':{'type':Sequelize[_0x5734('0x3')],'defaultValue':_0x5734('0x4'),'comment':_0x5734('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5734('0x6')]},'exitAt':{'type':Sequelize[_0x5734('0x6')],'set':function(_0x1c7072){var _0x5c220a=moment(_0x1c7072);var _0xec897d=moment(this[_0x5734('0x7')](_0x5734('0x8')));var _0x30a17b=_0x5c220a['diff'](_0xec897d,_0x5734('0x9'));this[_0x5734('0xa')](_0x5734('0xb'),_0x1c7072);this[_0x5734('0xa')](_0x5734('0xc'),_0x30a17b>=0x0?_0x30a17b:null);}},'data1':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xd')},'data2':{'type':Sequelize[_0x5734('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xe')},'data4':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xf')},'data5':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0x10')},'role':{'type':Sequelize[_0x5734('0x3')]},'internal':{'type':Sequelize[_0x5734('0x11')]},'uniqueid':{'type':Sequelize[_0x5734('0x3')]}}; \ No newline at end of file +var _0x8c9b=['enterAt','seconds','setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue'];(function(_0x346f31,_0x3616bc){var _0x31920f=function(_0x21b578){while(--_0x21b578){_0x346f31['push'](_0x346f31['shift']());}};_0x31920f(++_0x3616bc);}(_0x8c9b,0x120));var _0xb8c9=function(_0x17afca,_0x5d6455){_0x17afca=_0x17afca-0x0;var _0x4691c9=_0x8c9b[_0x17afca];return _0x4691c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb8c9('0x0'));module[_0xb8c9('0x1')]={'channel':{'type':Sequelize[_0xb8c9('0x2')]},'membername':{'type':Sequelize[_0xb8c9('0x2')]},'interface':{'type':Sequelize[_0xb8c9('0x2')]},'type':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb8c9('0x3')]},'enterAt':{'type':Sequelize[_0xb8c9('0x4')]},'exitAt':{'type':Sequelize[_0xb8c9('0x4')],'set':function(_0x3f4a33){var _0x1a652b=moment(_0x3f4a33);var _0x33560d=moment(this[_0xb8c9('0x5')](_0xb8c9('0x6')));var _0x47447d=_0x1a652b['diff'](_0x33560d,_0xb8c9('0x7'));this[_0xb8c9('0x8')](_0xb8c9('0x9'),_0x3f4a33);this['setDataValue']('duration',_0x47447d>=0x0?_0x47447d:null);}},'data1':{'type':Sequelize[_0xb8c9('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0xb8c9('0xb')},'data4':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xc')},'data5':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xd')},'role':{'type':Sequelize[_0xb8c9('0x2')]},'internal':{'type':Sequelize[_0xb8c9('0x3')]},'uniqueid':{'type':Sequelize[_0xb8c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 838654d..17ed38a 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x595154,_0x89e3ed){var _0x4ad97a=function(_0x1643d3){while(--_0x1643d3){_0x595154['push'](_0x595154['shift']());}};_0x4ad97a(++_0x89e3ed);}(_0x3e74,0x175));var _0x43e7=function(_0x3d270e,_0xf196f1){_0x3d270e=_0x3d270e-0x0;var _0x131496=_0x3e74[_0x3d270e];return _0x131496;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x15142c,_0x362e2e){var _0x5cd69e=function(_0x16ed43){while(--_0x16ed43){_0x15142c['push'](_0x15142c['shift']());}};_0x5cd69e(++_0x362e2e);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 2628bc3..168fbc8 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 _0xebf4=['exports','membername','interface','lodash','moment','bluebird','path','rimraf'];(function(_0x1751f1,_0xcbc4e9){var _0x198340=function(_0xa4c816){while(--_0xa4c816){_0x1751f1['push'](_0x1751f1['shift']());}};_0x198340(++_0xcbc4e9);}(_0xebf4,0xe3));var _0x4ebf=function(_0x7e64ae,_0xe3f464){_0x7e64ae=_0x7e64ae-0x0;var _0x1390ac=_0xebf4[_0x7e64ae];return _0x1390ac;};'use strict';var _=require(_0x4ebf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4ebf('0x1'));var BPromise=require(_0x4ebf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ebf('0x3'));var rimraf=require(_0x4ebf('0x4'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x4ebf('0x5')]=function(_0x557e84,_0x32f022){return _0x557e84['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4ebf('0x6'),_0x4ebf('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x019b=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ac49a,_0x2b78a7){var _0x232558=function(_0x242dd4){while(--_0x242dd4){_0x1ac49a['push'](_0x1ac49a['shift']());}};_0x232558(++_0x2b78a7);}(_0x019b,0x1da));var _0xb019=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x019b[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0xb019('0x0'));var util=require(_0xb019('0x1'));var logger=require(_0xb019('0x2'))(_0xb019('0x3'));var moment=require(_0xb019('0x4'));var BPromise=require(_0xb019('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb019('0x6'));var attributes=require(_0xb019('0x7'));module[_0xb019('0x8')]=function(_0x173ee4,_0x39bafe){return _0x173ee4[_0xb019('0x9')](_0xb019('0xa'),attributes,{'tableName':_0xb019('0xb'),'paranoid':![],'indexes':[{'name':_0xb019('0xc'),'fields':[_0xb019('0xd'),_0xb019('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d3fe142..d529cb3 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 _0x687b=['limit','include','map','model','CreateMemberReport','create','body','raw','update','UpdateMemberReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes'];(function(_0x9e9c31,_0xbcd6a2){var _0x1f21a8=function(_0x3c8cd8){while(--_0x3c8cd8){_0x9e9c31['push'](_0x9e9c31['shift']());}};_0x1f21a8(++_0xbcd6a2);}(_0x687b,0x14a));var _0xb687=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0x687b[_0x92b4dc];return _0xe68d92;};'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});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});}exports[_0xb687('0x18')]=function(_0x30d370){var _0x5eb9b9=this;return new Promise(function(_0x48958d,_0x12eff1){return db[_0xb687('0x19')][_0xb687('0x1a')]({'raw':_0x30d370['options']?_0x30d370[_0xb687('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x30d370[_0xb687('0x1b')]?_0x30d370[_0xb687('0x1b')][_0xb687('0x1c')]||null:null,'attributes':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1d')]||null:null,'limit':_0x30d370['options']?_0x30d370[_0xb687('0x1b')][_0xb687('0x1e')]||null:null,'include':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1f')]?_[_0xb687('0x20')](_0x30d370[_0xb687('0x1b')][_0xb687('0x1f')],function(_0xbf6c58){return{'model':db[_0xbf6c58[_0xb687('0x21')]],'as':_0xbf6c58['as'],'attributes':_0xbf6c58[_0xb687('0x1d')],'include':_0xbf6c58[_0xb687('0x1f')]?_['map'](_0xbf6c58[_0xb687('0x1f')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x21')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1d')],'include':_0x129347[_0xb687('0x1f')]?_[_0xb687('0x20')](_0x129347[_0xb687('0x1f')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x21')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3712cf){logger[_0xb687('0xd')](_0xb687('0x18'),_0x30d370);logger[_0xb687('0x10')](_0xb687('0x18'),_0x30d370,JSON[_0xb687('0x12')](_0x3712cf));_0x48958d(_0x3712cf);})['catch'](function(_0x28b69a){logger['error'](_0xb687('0x18'),_0x28b69a[_0xb687('0x15')],_0x30d370);_0x12eff1(_0x5eb9b9[_0xb687('0x13')](0x1f4,_0x28b69a[_0xb687('0x15')]));});});};exports[_0xb687('0x22')]=function(_0x43d20d){var _0xf1f0dd=this;return new Promise(function(_0x556815,_0x3da2be){return db[_0xb687('0x19')][_0xb687('0x23')](_0x43d20d[_0xb687('0x24')],{'raw':_0x43d20d[_0xb687('0x1b')]?_0x43d20d[_0xb687('0x1b')][_0xb687('0x25')]===undefined?!![]:![]:!![]})[_0xb687('0xc')](function(_0x3551df){logger[_0xb687('0xd')](_0xb687('0x22'),_0x43d20d);logger['debug']('CreateMemberReport',_0x43d20d,JSON[_0xb687('0x12')](_0x3551df));_0x556815(_0x3551df);})[_0xb687('0x17')](function(_0x24c418){logger[_0xb687('0x13')]('CreateMemberReport',_0x24c418['message'],_0x43d20d);_0x3da2be(_0xf1f0dd[_0xb687('0x13')](0x1f4,_0x24c418[_0xb687('0x15')]));});});};exports['UpdateMemberReport']=function(_0x23dc96){var _0x449074=this;return new Promise(function(_0x548b83,_0x387448){return db['MemberReport'][_0xb687('0x26')](_0x23dc96[_0xb687('0x24')],{'raw':_0x23dc96[_0xb687('0x1b')]?_0x23dc96[_0xb687('0x1b')][_0xb687('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23dc96[_0xb687('0x1b')]?_0x23dc96['options'][_0xb687('0x1c')]||null:null,'attributes':_0x23dc96[_0xb687('0x1b')]?_0x23dc96[_0xb687('0x1b')][_0xb687('0x1d')]||null:null,'limit':_0x23dc96['options']?_0x23dc96[_0xb687('0x1b')][_0xb687('0x1e')]||null:null})[_0xb687('0xc')](function(_0xce9624){logger[_0xb687('0xd')]('UpdateMemberReport',_0x23dc96);logger[_0xb687('0x10')](_0xb687('0x27'),_0x23dc96,JSON[_0xb687('0x12')](_0xce9624));_0x548b83(_0xce9624);})[_0xb687('0x17')](function(_0x24b785){logger[_0xb687('0x13')]('UpdateMemberReport',_0x24b785['message'],_0x23dc96);_0x387448(_0x449074[_0xb687('0x13')](0x1f4,_0x24b785['message']));});});}; \ No newline at end of file +var _0xd9ce=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','create','body','CreateMemberReport','catch','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x87b845,_0x277414){var _0x34f59f=function(_0x47c3ea){while(--_0x47c3ea){_0x87b845['push'](_0x87b845['shift']());}};_0x34f59f(++_0x277414);}(_0xd9ce,0xeb));var _0xed9c=function(_0x4ab9a7,_0x291df1){_0x4ab9a7=_0x4ab9a7-0x0;var _0xd08799=_0xd9ce[_0x4ab9a7];return _0xd08799;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var moment=require(_0xed9c('0x2'));var BPromise=require(_0xed9c('0x3'));var rs=require(_0xed9c('0x4'));var fs=require('fs');var Redis=require(_0xed9c('0x5'));var db=require(_0xed9c('0x6'))['db'];var utils=require(_0xed9c('0x7'));var logger=require('../../config/logger')(_0xed9c('0x8'));var config=require(_0xed9c('0x9'));var jayson=require(_0xed9c('0xa'));var client=jayson[_0xed9c('0xb')][_0xed9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x434898,_0x58c757,_0x2ad757){return new BPromise(function(_0xde32e4,_0x5a312d){return client['request'](_0x434898,_0x2ad757)[_0xed9c('0xd')](function(_0x5ed0ab){logger[_0xed9c('0xe')](_0xed9c('0xf'),_0x58c757,_0xed9c('0x10'));logger[_0xed9c('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x58c757,_0xed9c('0x10'),JSON[_0xed9c('0x12')](_0x5ed0ab));if(_0x5ed0ab[_0xed9c('0x13')]){if(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x14')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x58c757,_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);return _0x5a312d(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x58c757,_0x5ed0ab[_0xed9c('0x13')]['message']);return _0xde32e4(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);}else{logger[_0xed9c('0xe')](_0xed9c('0xf'),_0x58c757,_0xed9c('0x10'));_0xde32e4(_0x5ed0ab[_0xed9c('0x16')][_0xed9c('0x15')]);}})['catch'](function(_0x244d5e){logger[_0xed9c('0x13')](_0xed9c('0xf'),_0x58c757,_0x244d5e);_0x5a312d(_0x244d5e);});});}exports['GetMemberReport']=function(_0x485029){var _0x7eea82=this;return new Promise(function(_0x48b7b4,_0x421834){return db[_0xed9c('0x17')][_0xed9c('0x18')]({'raw':_0x485029[_0xed9c('0x19')]?_0x485029[_0xed9c('0x19')][_0xed9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x485029['options']?_0x485029[_0xed9c('0x19')][_0xed9c('0x1b')]||null:null,'attributes':_0x485029[_0xed9c('0x19')]?_0x485029['options'][_0xed9c('0x1c')]||null:null,'limit':_0x485029[_0xed9c('0x19')]?_0x485029[_0xed9c('0x19')][_0xed9c('0x1d')]||null:null,'include':_0x485029['options']?_0x485029['options'][_0xed9c('0x1e')]?_[_0xed9c('0x1f')](_0x485029[_0xed9c('0x19')][_0xed9c('0x1e')],function(_0x1fd75d){return{'model':db[_0x1fd75d[_0xed9c('0x20')]],'as':_0x1fd75d['as'],'attributes':_0x1fd75d['attributes'],'include':_0x1fd75d[_0xed9c('0x1e')]?_['map'](_0x1fd75d['include'],function(_0x495055){return{'model':db[_0x495055[_0xed9c('0x20')]],'as':_0x495055['as'],'attributes':_0x495055[_0xed9c('0x1c')],'include':_0x495055[_0xed9c('0x1e')]?_[_0xed9c('0x1f')](_0x495055['include'],function(_0x2a1fac){return{'model':db[_0x2a1fac[_0xed9c('0x20')]],'as':_0x2a1fac['as'],'attributes':_0x2a1fac[_0xed9c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe3be1){logger[_0xed9c('0xe')](_0xed9c('0x21'),_0x485029);logger[_0xed9c('0x11')]('GetMemberReport',_0x485029,JSON[_0xed9c('0x12')](_0xe3be1));_0x48b7b4(_0xe3be1);})['catch'](function(_0x42c134){logger[_0xed9c('0x13')](_0xed9c('0x21'),_0x42c134[_0xed9c('0x15')],_0x485029);_0x421834(_0x7eea82[_0xed9c('0x13')](0x1f4,_0x42c134['message']));});});};exports['CreateMemberReport']=function(_0x241372){var _0x9a2584=this;return new Promise(function(_0x13d128,_0xf6ddf4){return db['MemberReport'][_0xed9c('0x22')](_0x241372[_0xed9c('0x23')],{'raw':_0x241372[_0xed9c('0x19')]?_0x241372[_0xed9c('0x19')][_0xed9c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2226a2){logger['info'](_0xed9c('0x24'),_0x241372);logger[_0xed9c('0x11')](_0xed9c('0x24'),_0x241372,JSON[_0xed9c('0x12')](_0x2226a2));_0x13d128(_0x2226a2);})[_0xed9c('0x25')](function(_0x3ee465){logger[_0xed9c('0x13')](_0xed9c('0x24'),_0x3ee465[_0xed9c('0x15')],_0x241372);_0xf6ddf4(_0x9a2584[_0xed9c('0x13')](0x1f4,_0x3ee465[_0xed9c('0x15')]));});});};exports[_0xed9c('0x26')]=function(_0x281ca0){var _0x4655ba=this;return new Promise(function(_0x436b86,_0x3e986e){return db['MemberReport'][_0xed9c('0x27')](_0x281ca0[_0xed9c('0x23')],{'raw':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1b')]||null:null,'attributes':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1c')]||null:null,'limit':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1d')]||null:null})[_0xed9c('0xd')](function(_0x50e6f0){logger['info'](_0xed9c('0x26'),_0x281ca0);logger[_0xed9c('0x11')](_0xed9c('0x26'),_0x281ca0,JSON['stringify'](_0x50e6f0));_0x436b86(_0x50e6f0);})[_0xed9c('0x25')](function(_0x4dc992){logger['error'](_0xed9c('0x26'),_0x4dc992['message'],_0x281ca0);_0x3e986e(_0x4655ba['error'](0x1f4,_0x4dc992[_0xed9c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d81c037..e058a81 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 _0x8c79=['multer','express','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x8c79,0xa8));var _0x98c7=function(_0x37870d,_0x356e02){_0x37870d=_0x37870d-0x0;var _0x1ae695=_0x8c79[_0x37870d];return _0x1ae695;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c7('0x1'));var router=express['Router']();var fs_extra=require(_0x98c7('0x2'));var auth=require(_0x98c7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x98c7('0x4'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x98c7('0x5')]=router; \ No newline at end of file +var _0x8149=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','index','multer'];(function(_0x3d1289,_0x362df5){var _0xfa5838=function(_0x43f49e){while(--_0x43f49e){_0x3d1289['push'](_0x3d1289['shift']());}};_0xfa5838(++_0x362df5);}(_0x8149,0x1a3));var _0x9814=function(_0x457189,_0x454408){_0x457189=_0x457189-0x0;var _0x56461c=_0x8149[_0x457189];return _0x56461c;};'use strict';var multer=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var path=require('path');var timeout=require(_0x9814('0x2'));var express=require(_0x9814('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9814('0x4'));var config=require(_0x9814('0x5'));var controller=require('./migration.controller');router['get']('/',controller[_0x9814('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9ed7720..dbf0089 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 _0x5cc9=['exports','STRING','version'];(function(_0x49c57b,_0x5bface){var _0x34a689=function(_0x657741){while(--_0x657741){_0x49c57b['push'](_0x49c57b['shift']());}};_0x34a689(++_0x5bface);}(_0x5cc9,0xf9));var _0x95cc=function(_0x3be144,_0x4705cc){_0x3be144=_0x3be144-0x0;var _0x58e325=_0x5cc9[_0x3be144];return _0x58e325;};'use strict';var Sequelize=require('sequelize');module[_0x95cc('0x0')]={'version':{'type':Sequelize[_0x95cc('0x1')],'unique':_0x95cc('0x2')}}; \ No newline at end of file +var _0xebc3=['exports','STRING','version','sequelize'];(function(_0x295148,_0x585dfa){var _0xaf3076=function(_0x43ecd6){while(--_0x43ecd6){_0x295148['push'](_0x295148['shift']());}};_0xaf3076(++_0x585dfa);}(_0xebc3,0x7f));var _0x3ebc=function(_0x5b39f3,_0x1bc28a){_0x5b39f3=_0x5b39f3-0x0;var _0xfec1fa=_0xebc3[_0x5b39f3];return _0xfec1fa;};'use strict';var Sequelize=require(_0x3ebc('0x0'));module[_0x3ebc('0x1')]={'version':{'type':Sequelize[_0x3ebc('0x2')],'unique':_0x3ebc('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2f39454..6283175 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 _0x0c9d=['request-promise','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','eml-format','zip-dir','fast-json-patch'];(function(_0x36bd17,_0x2f7a84){var _0xeff03c=function(_0x1b391d){while(--_0x1b391d){_0x36bd17['push'](_0x36bd17['shift']());}};_0xeff03c(++_0x2f7a84);}(_0x0c9d,0x1ad));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd0c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0c9('0x1'));var jsonpatch=require(_0xd0c9('0x2'));var rp=require(_0xd0c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0c9('0x4'));var util=require(_0xd0c9('0x5'));var path=require(_0xd0c9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0c9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c9('0x8'));var squel=require(_0xd0c9('0x9'));var crypto=require('crypto');var jsforce=require(_0xd0c9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c9('0xb'));var Papa=require(_0xd0c9('0xc'));var Redis=require(_0xd0c9('0xd'));var authService=require(_0xd0c9('0xe'));var qs=require(_0xd0c9('0xf'));var as=require(_0xd0c9('0x10'));var hardwareService=require(_0xd0c9('0x11'));var logger=require(_0xd0c9('0x12'))(_0xd0c9('0x13'));var utils=require(_0xd0c9('0x14'));var config=require(_0xd0c9('0x15'));var licenseUtil=require(_0xd0c9('0x16'));var db=require(_0xd0c9('0x17'))['db'];function respondWithStatusCode(_0x3a1946,_0x59912f){_0x59912f=_0x59912f||0xcc;return function(_0x320ef4){if(_0x320ef4){return _0x3a1946[_0xd0c9('0x18')](_0x59912f);}return _0x3a1946[_0xd0c9('0x19')](_0x59912f)['end']();};}function respondWithResult(_0x4e15bf,_0x380d07){_0x380d07=_0x380d07||0xc8;return function(_0x334e0e){if(_0x334e0e){return _0x4e15bf[_0xd0c9('0x19')](_0x380d07)['json'](_0x334e0e);}};}function respondWithFilteredResult(_0x3cb7de,_0x428254){return function(_0x1e71b8){if(_0x1e71b8){var _0x2b475e=typeof _0x428254['offset']===_0xd0c9('0x1a')&&typeof _0x428254[_0xd0c9('0x1b')]===_0xd0c9('0x1a');var _0x4d64fa=_0x1e71b8[_0xd0c9('0x1c')];var _0xe06cbe=_0x2b475e?0x0:_0x428254['offset'];var _0x12b21e=_0x2b475e?_0x1e71b8['count']:_0x428254[_0xd0c9('0x1d')]+_0x428254[_0xd0c9('0x1b')];var _0x3c4ade;if(_0x12b21e>=_0x4d64fa){_0x12b21e=_0x4d64fa;_0x3c4ade=0xc8;}else{_0x3c4ade=0xce;}_0x3cb7de[_0xd0c9('0x19')](_0x3c4ade);return _0x3cb7de[_0xd0c9('0x1e')](_0xd0c9('0x1f'),_0xe06cbe+'-'+_0x12b21e+'/'+_0x4d64fa)[_0xd0c9('0x20')](_0x1e71b8);}return null;};}function patchUpdates(_0x8d857d){return function(_0x52cfa8){try{jsonpatch[_0xd0c9('0x21')](_0x52cfa8,_0x8d857d,!![]);}catch(_0xa446a7){return BPromise[_0xd0c9('0x22')](_0xa446a7);}return _0x52cfa8[_0xd0c9('0x23')]();};}function saveUpdates(_0x53eea0,_0x5e0097){return function(_0x59aec0){if(_0x59aec0){return _0x59aec0[_0xd0c9('0x24')](_0x53eea0)[_0xd0c9('0x25')](function(_0xcd5083){return _0xcd5083;});}return null;};}function removeEntity(_0x49167a,_0x2dbf34){return function(_0x4324c8){if(_0x4324c8){return _0x4324c8[_0xd0c9('0x26')]()[_0xd0c9('0x25')](function(){_0x49167a[_0xd0c9('0x19')](0xcc)[_0xd0c9('0x27')]();});}};}function handleEntityNotFound(_0xba9c3d,_0x463b83){return function(_0x4c3f55){if(!_0x4c3f55){_0xba9c3d[_0xd0c9('0x18')](0x194);}return _0x4c3f55;};}function handleError(_0x1ab16f,_0x19f767){_0x19f767=_0x19f767||0x1f4;return function(_0x1e6de4){logger[_0xd0c9('0x28')](_0x1e6de4[_0xd0c9('0x29')]);if(_0x1e6de4[_0xd0c9('0x2a')]){delete _0x1e6de4[_0xd0c9('0x2a')];}_0x1ab16f[_0xd0c9('0x19')](_0x19f767)[_0xd0c9('0x2b')](_0x1e6de4);};}exports[_0xd0c9('0x2c')]=function(_0x17c2cb,_0x7990a8){var _0x83eace={},_0x27b03d={},_0x2459ac={'count':0x0,'rows':[]};var _0x2da111=_[_0xd0c9('0x2d')](db[_0xd0c9('0x2e')][_0xd0c9('0x2f')],function(_0x1a5d80){return{'name':_0x1a5d80[_0xd0c9('0x30')],'type':_0x1a5d80[_0xd0c9('0x31')][_0xd0c9('0x32')]};});_0x27b03d[_0xd0c9('0x33')]=_['map'](_0x2da111,_0xd0c9('0x2a'));_0x27b03d[_0xd0c9('0x34')]=_[_0xd0c9('0x35')](_0x17c2cb[_0xd0c9('0x34')]);_0x27b03d['filters']=_['intersection'](_0x27b03d[_0xd0c9('0x33')],_0x27b03d[_0xd0c9('0x34')]);_0x83eace[_0xd0c9('0x36')]=_[_0xd0c9('0x37')](_0x27b03d[_0xd0c9('0x33')],qs[_0xd0c9('0x38')](_0x17c2cb['query'][_0xd0c9('0x38')]));_0x83eace[_0xd0c9('0x36')]=_0x83eace[_0xd0c9('0x36')][_0xd0c9('0x39')]?_0x83eace[_0xd0c9('0x36')]:_0x27b03d[_0xd0c9('0x33')];if(!_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x3a')](_0xd0c9('0x3b'))){_0x83eace['limit']=qs[_0xd0c9('0x1b')](_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x1b')]);_0x83eace[_0xd0c9('0x1d')]=qs[_0xd0c9('0x1d')](_0x17c2cb['query'][_0xd0c9('0x1d')]);}_0x83eace[_0xd0c9('0x3c')]=qs[_0xd0c9('0x3d')](_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x3d')]);_0x83eace[_0xd0c9('0x3e')]=qs[_0xd0c9('0x3f')](_[_0xd0c9('0x40')](_0x17c2cb[_0xd0c9('0x34')],_0x27b03d[_0xd0c9('0x3f')]),_0x2da111);if(_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x41')]){_0x83eace[_0xd0c9('0x3e')]=_[_0xd0c9('0x42')](_0x83eace[_0xd0c9('0x3e')],{'$or':_[_0xd0c9('0x2d')](_0x2da111,function(_0x3247dd){if(_0x3247dd['type']!==_0xd0c9('0x43')){var _0x5f53a0={};_0x5f53a0[_0x3247dd['name']]={'$like':'%'+_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x41')]+'%'};return _0x5f53a0;}})});}_0x83eace=_[_0xd0c9('0x42')]({},_0x83eace,_0x17c2cb['options']);var _0x467bec={'where':_0x83eace[_0xd0c9('0x3e')]};return db[_0xd0c9('0x2e')][_0xd0c9('0x1c')](_0x467bec)[_0xd0c9('0x25')](function(_0x32cf95){_0x2459ac[_0xd0c9('0x1c')]=_0x32cf95;if(_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x44')]){_0x83eace[_0xd0c9('0x45')]=[{'all':!![]}];}return db['Migration'][_0xd0c9('0x46')](_0x83eace);})['then'](function(_0x5652c8){_0x2459ac[_0xd0c9('0x47')]=_0x5652c8;return _0x2459ac;})['then'](respondWithFilteredResult(_0x7990a8,_0x83eace))['catch'](handleError(_0x7990a8,null));}; \ No newline at end of file +var _0x96e6=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','offset','sort','pick','where','merge','VIRTUAL','filter','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x96e6,0xab));var _0x696e=function(_0x405e28,_0x2ab3a9){_0x405e28=_0x405e28-0x0;var _0x5c2877=_0x96e6[_0x405e28];return _0x5c2877;};'use strict';var emlformat=require(_0x696e('0x0'));var rimraf=require(_0x696e('0x1'));var zipdir=require(_0x696e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x696e('0x3'));var moment=require(_0x696e('0x4'));var BPromise=require(_0x696e('0x5'));var Mustache=require(_0x696e('0x6'));var util=require(_0x696e('0x7'));var path=require('path');var sox=require(_0x696e('0x8'));var csv=require('to-csv');var ejs=require(_0x696e('0x9'));var fs=require('fs');var fs_extra=require(_0x696e('0xa'));var _=require('lodash');var squel=require(_0x696e('0xb'));var crypto=require('crypto');var jsforce=require(_0x696e('0xc'));var deskjs=require(_0x696e('0xd'));var toCsv=require(_0x696e('0xe'));var querystring=require(_0x696e('0xf'));var Papa=require(_0x696e('0x10'));var Redis=require(_0x696e('0x11'));var authService=require(_0x696e('0x12'));var qs=require(_0x696e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x696e('0x14'));var logger=require(_0x696e('0x15'))(_0x696e('0x16'));var utils=require(_0x696e('0x17'));var config=require(_0x696e('0x18'));var licenseUtil=require(_0x696e('0x19'));var db=require(_0x696e('0x1a'))['db'];function respondWithStatusCode(_0x5099da,_0x45e036){_0x45e036=_0x45e036||0xcc;return function(_0x37cbbc){if(_0x37cbbc){return _0x5099da[_0x696e('0x1b')](_0x45e036);}return _0x5099da['status'](_0x45e036)[_0x696e('0x1c')]();};}function respondWithResult(_0x281b9e,_0xe9464f){_0xe9464f=_0xe9464f||0xc8;return function(_0x272cb3){if(_0x272cb3){return _0x281b9e[_0x696e('0x1d')](_0xe9464f)[_0x696e('0x1e')](_0x272cb3);}};}function respondWithFilteredResult(_0x4ebaaa,_0x2dda8a){return function(_0x301d61){if(_0x301d61){var _0xe7f7ab=typeof _0x2dda8a['offset']===_0x696e('0x1f')&&typeof _0x2dda8a[_0x696e('0x20')]==='undefined';var _0x5d9872=_0x301d61[_0x696e('0x21')];var _0x4b642c=_0xe7f7ab?0x0:_0x2dda8a['offset'];var _0x1f1e86=_0xe7f7ab?_0x301d61[_0x696e('0x21')]:_0x2dda8a['offset']+_0x2dda8a[_0x696e('0x20')];var _0x147cb5;if(_0x1f1e86>=_0x5d9872){_0x1f1e86=_0x5d9872;_0x147cb5=0xc8;}else{_0x147cb5=0xce;}_0x4ebaaa[_0x696e('0x1d')](_0x147cb5);return _0x4ebaaa[_0x696e('0x22')](_0x696e('0x23'),_0x4b642c+'-'+_0x1f1e86+'/'+_0x5d9872)[_0x696e('0x1e')](_0x301d61);}return null;};}function patchUpdates(_0xfa1fad){return function(_0x5b68ff){try{jsonpatch[_0x696e('0x24')](_0x5b68ff,_0xfa1fad,!![]);}catch(_0x57e266){return BPromise[_0x696e('0x25')](_0x57e266);}return _0x5b68ff[_0x696e('0x26')]();};}function saveUpdates(_0x502853,_0xc2263b){return function(_0x192f7d){if(_0x192f7d){return _0x192f7d['update'](_0x502853)[_0x696e('0x27')](function(_0x80fe6f){return _0x80fe6f;});}return null;};}function removeEntity(_0x20b5a0,_0x2ba634){return function(_0x3d763b){if(_0x3d763b){return _0x3d763b[_0x696e('0x28')]()[_0x696e('0x27')](function(){_0x20b5a0[_0x696e('0x1d')](0xcc)[_0x696e('0x1c')]();});}};}function handleEntityNotFound(_0x14ba2d,_0x2027ab){return function(_0x518608){if(!_0x518608){_0x14ba2d[_0x696e('0x1b')](0x194);}return _0x518608;};}function handleError(_0x2e1db7,_0x174078){_0x174078=_0x174078||0x1f4;return function(_0x2b36c6){logger[_0x696e('0x29')](_0x2b36c6[_0x696e('0x2a')]);if(_0x2b36c6[_0x696e('0x2b')]){delete _0x2b36c6[_0x696e('0x2b')];}_0x2e1db7['status'](_0x174078)[_0x696e('0x2c')](_0x2b36c6);};}exports[_0x696e('0x2d')]=function(_0x511aec,_0xf57565){var _0x39627e={},_0x4355b3={},_0x2008f4={'count':0x0,'rows':[]};var _0x5f18c2=_[_0x696e('0x2e')](db['Migration'][_0x696e('0x2f')],function(_0x22dea9){return{'name':_0x22dea9[_0x696e('0x30')],'type':_0x22dea9['type'][_0x696e('0x31')]};});_0x4355b3[_0x696e('0x32')]=_[_0x696e('0x2e')](_0x5f18c2,_0x696e('0x2b'));_0x4355b3[_0x696e('0x33')]=_[_0x696e('0x34')](_0x511aec[_0x696e('0x33')]);_0x4355b3[_0x696e('0x35')]=_[_0x696e('0x36')](_0x4355b3[_0x696e('0x32')],_0x4355b3[_0x696e('0x33')]);_0x39627e[_0x696e('0x37')]=_[_0x696e('0x36')](_0x4355b3[_0x696e('0x32')],qs['fields'](_0x511aec[_0x696e('0x33')]['fields']));_0x39627e[_0x696e('0x37')]=_0x39627e['attributes'][_0x696e('0x38')]?_0x39627e['attributes']:_0x4355b3['model'];if(!_0x511aec[_0x696e('0x33')]['hasOwnProperty'](_0x696e('0x39'))){_0x39627e[_0x696e('0x20')]=qs[_0x696e('0x20')](_0x511aec['query'][_0x696e('0x20')]);_0x39627e[_0x696e('0x3a')]=qs[_0x696e('0x3a')](_0x511aec[_0x696e('0x33')][_0x696e('0x3a')]);}_0x39627e['order']=qs[_0x696e('0x3b')](_0x511aec[_0x696e('0x33')][_0x696e('0x3b')]);_0x39627e['where']=qs[_0x696e('0x35')](_[_0x696e('0x3c')](_0x511aec[_0x696e('0x33')],_0x4355b3[_0x696e('0x35')]),_0x5f18c2);if(_0x511aec[_0x696e('0x33')]['filter']){_0x39627e[_0x696e('0x3d')]=_[_0x696e('0x3e')](_0x39627e['where'],{'$or':_['map'](_0x5f18c2,function(_0x14d4fa){if(_0x14d4fa['type']!==_0x696e('0x3f')){var _0x16dca4={};_0x16dca4[_0x14d4fa[_0x696e('0x2b')]]={'$like':'%'+_0x511aec[_0x696e('0x33')][_0x696e('0x40')]+'%'};return _0x16dca4;}})});}_0x39627e=_[_0x696e('0x3e')]({},_0x39627e,_0x511aec[_0x696e('0x41')]);var _0x5e828b={'where':_0x39627e['where']};return db[_0x696e('0x42')][_0x696e('0x21')](_0x5e828b)['then'](function(_0x32a427){_0x2008f4[_0x696e('0x21')]=_0x32a427;if(_0x511aec[_0x696e('0x33')][_0x696e('0x43')]){_0x39627e[_0x696e('0x44')]=[{'all':!![]}];}return db[_0x696e('0x42')][_0x696e('0x45')](_0x39627e);})[_0x696e('0x27')](function(_0x29e04b){_0x2008f4[_0x696e('0x46')]=_0x29e04b;return _0x2008f4;})['then'](respondWithFilteredResult(_0xf57565,_0x39627e))[_0x696e('0x47')](handleError(_0xf57565,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index da76fc2..4c36aa7 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 _0x9bdb=['rimraf','../../config/environment','define','migrations'];(function(_0x2e8508,_0xbb9b7c){var _0x2daa31=function(_0x133acc){while(--_0x133acc){_0x2e8508['push'](_0x2e8508['shift']());}};_0x2daa31(++_0xbb9b7c);}(_0x9bdb,0xec));var _0xb9bd=function(_0x33e6fa,_0x1643f2){_0x33e6fa=_0x33e6fa-0x0;var _0x1ae7a6=_0x9bdb[_0x33e6fa];return _0x1ae7a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb9bd('0x0'));var config=require(_0xb9bd('0x1'));var attributes=require('./migration.attributes');module['exports']=function(_0x18e01e,_0x3494eb){return _0x18e01e[_0xb9bd('0x2')]('Migration',attributes,{'tableName':_0xb9bd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1999=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger'];(function(_0x57fbc8,_0x5f1746){var _0xfcf1de=function(_0x368e6e){while(--_0x368e6e){_0x57fbc8['push'](_0x57fbc8['shift']());}};_0xfcf1de(++_0x5f1746);}(_0x1999,0xe7));var _0x9199=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1999[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9199('0x0'));var util=require(_0x9199('0x1'));var logger=require(_0x9199('0x2'))('api');var moment=require(_0x9199('0x3'));var BPromise=require(_0x9199('0x4'));var rp=require(_0x9199('0x5'));var fs=require('fs');var path=require(_0x9199('0x6'));var rimraf=require(_0x9199('0x7'));var config=require(_0x9199('0x8'));var attributes=require(_0x9199('0x9'));module[_0x9199('0xa')]=function(_0x204f37,_0x594660){return _0x204f37[_0x9199('0xb')]('Migration',attributes,{'tableName':_0x9199('0xc'),'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 ee41401..48c33ec 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 _0x74f0=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x74f0,0xf3));var _0x074f=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x74f0[_0x17b0d4];return _0x2d02c7;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('Migration,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});} \ No newline at end of file +var _0xa571=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0xa571,0x107));var _0x1a57=function(_0x32b2bf,_0x64a61e){_0x32b2bf=_0x32b2bf-0x0;var _0x42756a=_0xa571[_0x32b2bf];return _0x42756a;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a43827a..dad1179 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 _0xac35=['../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xac35,0x141));var _0x5ac3=function(_0x11b28e,_0x3cf207){_0x11b28e=_0x11b28e-0x0;var _0x5502a5=_0xac35[_0x11b28e];return _0x5502a5;};'use strict';var multer=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var path=require(_0x5ac3('0x2'));var timeout=require(_0x5ac3('0x3'));var express=require(_0x5ac3('0x4'));var router=express[_0x5ac3('0x5')]();var fs_extra=require(_0x5ac3('0x6'));var auth=require(_0x5ac3('0x7'));var interaction=require(_0x5ac3('0x8'));var config=require(_0x5ac3('0x9'));var controller=require(_0x5ac3('0xa'));router[_0x5ac3('0xb')]('/',auth[_0x5ac3('0xc')](),controller[_0x5ac3('0xd')]);router['get'](_0x5ac3('0xe'),auth['isAuthenticated'](),controller[_0x5ac3('0xf')]);router[_0x5ac3('0x10')]('/',auth[_0x5ac3('0xc')](),controller[_0x5ac3('0x11')]);router[_0x5ac3('0x12')](_0x5ac3('0xe'),auth['isAuthenticated'](),controller[_0x5ac3('0x13')]);router['delete'](_0x5ac3('0xe'),auth[_0x5ac3('0xc')](),controller[_0x5ac3('0x14')]);module[_0x5ac3('0x15')]=router; \ No newline at end of file +var _0x7d37=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','update','destroy','exports','multer','util','path','express','Router'];(function(_0x162df5,_0x431ca5){var _0x2eef64=function(_0x1d8878){while(--_0x1d8878){_0x162df5['push'](_0x162df5['shift']());}};_0x2eef64(++_0x431ca5);}(_0x7d37,0x1db));var _0x77d3=function(_0x3727e9,_0x24db0a){_0x3727e9=_0x3727e9-0x0;var _0x2598c4=_0x7d37[_0x3727e9];return _0x2598c4;};'use strict';var multer=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var path=require(_0x77d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x77d3('0x3'));var router=express[_0x77d3('0x4')]();var fs_extra=require(_0x77d3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77d3('0x6'));var config=require(_0x77d3('0x7'));var controller=require('./network.controller');router[_0x77d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x77d3('0x9')]);router['get'](_0x77d3('0xa'),auth[_0x77d3('0xb')](),controller['show']);router['post']('/',auth[_0x77d3('0xb')](),controller[_0x77d3('0xc')]);router['put'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xd')]);router['delete'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xe')]);module[_0x77d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2b6550e..760bd31 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 _0x4631=['externip','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x4631,0xe3));var _0x1463=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x4631[_0xe8129c];return _0x709fc5;};'use strict';var Sequelize=require(_0x1463('0x0'));module[_0x1463('0x1')]={'type':{'type':Sequelize[_0x1463('0x2')](_0x1463('0x3'),_0x1463('0x4'),'stun',_0x1463('0x5'))},'value':{'type':Sequelize[_0x1463('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1463('0x6')]}}; \ No newline at end of file +var _0x417c=['STRING','exports','ENUM','localnet','externip','stun','turn'];(function(_0x153fb3,_0x547cb0){var _0x12a556=function(_0x15e924){while(--_0x15e924){_0x153fb3['push'](_0x153fb3['shift']());}};_0x12a556(++_0x547cb0);}(_0x417c,0x1c1));var _0xc417=function(_0x1c0c68,_0x783954){_0x1c0c68=_0x1c0c68-0x0;var _0x2c98fa=_0x417c[_0x1c0c68];return _0x2c98fa;};'use strict';var Sequelize=require('sequelize');module[_0xc417('0x0')]={'type':{'type':Sequelize[_0xc417('0x1')](_0xc417('0x2'),_0xc417('0x3'),_0xc417('0x4'),_0xc417('0x5'))},'value':{'type':Sequelize[_0xc417('0x6')]},'username':{'type':Sequelize[_0xc417('0x6')]},'password':{'type':Sequelize[_0xc417('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 28f15ae..fb549c4 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 _0xed64=['undefined','limit','count','set','Content-Range','update','end','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','length','options','find','create','body','toUpperCase','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','format','toLowerCase','STUN','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','destroy','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xed64,0xee));var _0x4ed6=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xed64[_0x16dbfd];return _0x382254;};'use strict';var util=require(_0x4ed6('0x0'));var path=require(_0x4ed6('0x1'));var ejs=require(_0x4ed6('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x4ed6('0x3'));var logger=require(_0x4ed6('0x4'))(_0x4ed6('0x5'));var config=require(_0x4ed6('0x6'));var db=require(_0x4ed6('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4ed6('0x8')][_0x4ed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e0,_0xdde4a3,_0x533ba3,_0x5a4f3f){return new Promise(function(_0x13a8b8,_0x387a38){var _0x33887e=_0x5a4f3f||client;return _0x33887e[_0x4ed6('0xa')](_0x4e10e0,_0x533ba3)[_0x4ed6('0xb')](function(_0x52eee9){logger[_0x4ed6('0xc')](_0x4ed6('0xd'),_0xdde4a3,'request\x20sent');logger[_0x4ed6('0xe')](_0x4ed6('0xf'),_0xdde4a3,_0x4ed6('0x10'),JSON[_0x4ed6('0x11')](_0x52eee9));if(_0x52eee9[_0x4ed6('0x12')]){if(_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x13')]===0x1f4){logger[_0x4ed6('0x12')](_0x4ed6('0xd'),_0xdde4a3,_0x52eee9['error']['message']);return _0x387a38(_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x14')]);}logger['error'](_0x4ed6('0xd'),_0xdde4a3,_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x14')]);return _0x13a8b8(_0x52eee9[_0x4ed6('0x12')]['message']);}else{logger['info'](_0x4ed6('0xd'),_0xdde4a3,_0x4ed6('0x10'));_0x13a8b8(_0x52eee9[_0x4ed6('0x15')][_0x4ed6('0x14')]);}})[_0x4ed6('0x16')](function(_0x17af6d){logger[_0x4ed6('0x12')](_0x4ed6('0xd'),_0xdde4a3,_0x17af6d);_0x387a38(_0x17af6d);});});}function respondWithResult(_0x42e9a5,_0x411ede){_0x411ede=_0x411ede||0xc8;return function(_0x3de309){if(_0x3de309){return _0x42e9a5[_0x4ed6('0x17')](_0x411ede)[_0x4ed6('0x18')](_0x3de309);}};}function respondWithFilteredResult(_0x5d4097,_0x5dc9c0){return function(_0x1170e0){if(_0x1170e0){var _0x41dbec=typeof _0x5dc9c0[_0x4ed6('0x19')]===_0x4ed6('0x1a')&&typeof _0x5dc9c0[_0x4ed6('0x1b')]===_0x4ed6('0x1a');var _0x488eac=_0x1170e0[_0x4ed6('0x1c')];var _0xabbf1a=_0x41dbec?0x0:_0x5dc9c0['offset'];var _0x24e869=_0x41dbec?_0x1170e0[_0x4ed6('0x1c')]:_0x5dc9c0['offset']+_0x5dc9c0[_0x4ed6('0x1b')];var _0x5b5dbf;if(_0x24e869>=_0x488eac){_0x24e869=_0x488eac;_0x5b5dbf=0xc8;}else{_0x5b5dbf=0xce;}_0x5d4097['status'](_0x5b5dbf);return _0x5d4097[_0x4ed6('0x1d')](_0x4ed6('0x1e'),_0xabbf1a+'-'+_0x24e869+'/'+_0x488eac)[_0x4ed6('0x18')](_0x1170e0);}return null;};}function saveUpdates(_0x182eb9){return function(_0x1b871b){if(_0x1b871b){return _0x1b871b[_0x4ed6('0x1f')](_0x182eb9)[_0x4ed6('0xb')](function(_0x1855ca){return _0x1855ca;});}return null;};}function removeEntity(_0x3789c4){return function(_0x3f9dd8){if(_0x3f9dd8){return _0x3f9dd8['destroy']()[_0x4ed6('0xb')](function(){_0x3789c4[_0x4ed6('0x17')](0xcc)[_0x4ed6('0x20')]();});}};}function handleEntityNotFound(_0xc6860c){return function(_0x38e1b8){if(!_0x38e1b8){_0xc6860c[_0x4ed6('0x21')](0x194);}return _0x38e1b8;};}function handleError(_0x4eac80,_0x47a911){_0x47a911=_0x47a911||0x1f4;return function(_0x21e285){logger['error'](_0x21e285['stack']);if(_0x21e285[_0x4ed6('0x22')]){delete _0x21e285[_0x4ed6('0x22')];}_0x4eac80[_0x4ed6('0x17')](_0x47a911)[_0x4ed6('0x23')](_0x21e285);};}exports[_0x4ed6('0x24')]=function(_0x2b89a2,_0x404cb4){var _0x1fa7b3={},_0x52da9c={},_0x41bf5e={'count':0x0,'rows':[]};var _0x26d427=_[_0x4ed6('0x25')](db[_0x4ed6('0x26')][_0x4ed6('0x27')],function(_0x3640f7){return{'name':_0x3640f7[_0x4ed6('0x28')],'type':_0x3640f7[_0x4ed6('0x29')]['key']};});_0x52da9c[_0x4ed6('0x2a')]=_[_0x4ed6('0x25')](_0x26d427,'name');_0x52da9c[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x2b89a2[_0x4ed6('0x2b')]);_0x52da9c[_0x4ed6('0x2d')]=_[_0x4ed6('0x2e')](_0x52da9c[_0x4ed6('0x2a')],_0x52da9c[_0x4ed6('0x2b')]);_0x1fa7b3[_0x4ed6('0x2f')]=_[_0x4ed6('0x2e')](_0x52da9c[_0x4ed6('0x2a')],qs[_0x4ed6('0x30')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x30')]));_0x1fa7b3[_0x4ed6('0x2f')]=_0x1fa7b3['attributes']['length']?_0x1fa7b3[_0x4ed6('0x2f')]:_0x52da9c[_0x4ed6('0x2a')];if(!_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x31')](_0x4ed6('0x32'))){_0x1fa7b3[_0x4ed6('0x1b')]=qs[_0x4ed6('0x1b')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x1b')]);_0x1fa7b3['offset']=qs[_0x4ed6('0x19')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x19')]);}_0x1fa7b3[_0x4ed6('0x33')]=qs['sort'](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x34')]);_0x1fa7b3[_0x4ed6('0x35')]=qs[_0x4ed6('0x2d')](_['pick'](_0x2b89a2[_0x4ed6('0x2b')],_0x52da9c[_0x4ed6('0x2d')]),_0x26d427);if(_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x36')]){_0x1fa7b3['where']=_[_0x4ed6('0x37')](_0x1fa7b3[_0x4ed6('0x35')],{'$or':_[_0x4ed6('0x25')](_0x26d427,function(_0x3c2b70){if(_0x3c2b70[_0x4ed6('0x29')]!=='VIRTUAL'){var _0xa54887={};_0xa54887[_0x3c2b70[_0x4ed6('0x22')]]={'$like':'%'+_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x36')]+'%'};return _0xa54887;}})});}_0x1fa7b3=_[_0x4ed6('0x37')]({},_0x1fa7b3,_0x2b89a2['options']);var _0x43b1c8={'where':_0x1fa7b3[_0x4ed6('0x35')]};return db[_0x4ed6('0x26')][_0x4ed6('0x1c')](_0x43b1c8)['then'](function(_0x1da9b6){_0x41bf5e[_0x4ed6('0x1c')]=_0x1da9b6;if(_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x38')]){_0x1fa7b3[_0x4ed6('0x39')]=[{'all':!![]}];}return db[_0x4ed6('0x26')][_0x4ed6('0x3a')](_0x1fa7b3);})[_0x4ed6('0xb')](function(_0x43351b){_0x41bf5e[_0x4ed6('0x3b')]=_0x43351b;return _0x41bf5e;})[_0x4ed6('0xb')](respondWithFilteredResult(_0x404cb4,_0x1fa7b3))[_0x4ed6('0x16')](handleError(_0x404cb4,null));};exports[_0x4ed6('0x3c')]=function(_0x4bcf6a,_0x12ff5f){var _0x3d1b3b={'raw':!![],'where':{'id':_0x4bcf6a[_0x4ed6('0x3d')]['id']}},_0x1b4bd1={};_0x1b4bd1[_0x4ed6('0x2a')]=_['keys'](db[_0x4ed6('0x26')][_0x4ed6('0x27')]);_0x1b4bd1['query']=_[_0x4ed6('0x2c')](_0x4bcf6a[_0x4ed6('0x2b')]);_0x1b4bd1[_0x4ed6('0x2d')]=_[_0x4ed6('0x2e')](_0x1b4bd1[_0x4ed6('0x2a')],_0x1b4bd1['query']);_0x3d1b3b[_0x4ed6('0x2f')]=_[_0x4ed6('0x2e')](_0x1b4bd1['model'],qs[_0x4ed6('0x30')](_0x4bcf6a['query'][_0x4ed6('0x30')]));_0x3d1b3b['attributes']=_0x3d1b3b[_0x4ed6('0x2f')][_0x4ed6('0x3e')]?_0x3d1b3b[_0x4ed6('0x2f')]:_0x1b4bd1['model'];if(_0x4bcf6a['query']['includeAll']){_0x3d1b3b[_0x4ed6('0x39')]=[{'all':!![]}];}_0x3d1b3b=_[_0x4ed6('0x37')]({},_0x3d1b3b,_0x4bcf6a[_0x4ed6('0x3f')]);return db[_0x4ed6('0x26')][_0x4ed6('0x40')](_0x3d1b3b)[_0x4ed6('0xb')](handleEntityNotFound(_0x12ff5f,null))['then'](respondWithResult(_0x12ff5f,null))[_0x4ed6('0x16')](handleError(_0x12ff5f,null));};exports[_0x4ed6('0x41')]=function(_0x1cb00d,_0x19044c){var _0x3201bc;return db['Network'][_0x4ed6('0x41')](_0x1cb00d[_0x4ed6('0x42')],{'raw':!![]})['then'](function(_0x59c0a8){_0x3201bc=_0x59c0a8;return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x1cb00d[_0x4ed6('0x42')][_0x4ed6('0x29')]},'raw':!![]});})['then'](function(_0x5028e8){if(_0x3201bc[_0x4ed6('0x29')][_0x4ed6('0x43')]()=='STUN'){var _0x24ade7=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config[_0x4ed6('0x46')],'server/files/templates/stun_multiple.ejs'),_0x4ed6('0x47'));var _0x16d6dc=ejs[_0x4ed6('0x48')](_0x24ade7,{'networks':_0x5028e8||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x4a'),_0x16d6dc);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x41'),{'module':'res_stun_monitor.so'});}else if(_0x3201bc[_0x4ed6('0x29')][_0x4ed6('0x43')]()==_0x4ed6('0x4c')){var _0x523040=fs[_0x4ed6('0x44')](path['join'](config[_0x4ed6('0x46')],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x19533b=ejs['render'](_0x523040,{'networks':_0x5028e8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x19533b);return respondWithRpcPromise('Reload',_0x4ed6('0x41'),{'module':_0x4ed6('0x4e')});}else{var _0x562c9d=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config[_0x4ed6('0x46')],'server/files/templates/network.ejs'),'utf8');var _0x56fe86=ejs[_0x4ed6('0x48')](_0x562c9d,{'networks':_0x5028e8||[]});fs[_0x4ed6('0x49')](util[_0x4ed6('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x1cb00d[_0x4ed6('0x42')]['type'][_0x4ed6('0x50')]()),_0x56fe86);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x41'),{'module':'chan_sip.so'});}})[_0x4ed6('0xb')](function(){return _0x3201bc;})['then'](respondWithResult(_0x19044c,0xc9))['catch'](handleError(_0x19044c,null));};exports[_0x4ed6('0x1f')]=function(_0x3debc7,_0xa715ec){var _0x226ab3;return db[_0x4ed6('0x26')][_0x4ed6('0x40')]({'where':{'id':_0x3debc7[_0x4ed6('0x3d')]['id']}})[_0x4ed6('0xb')](handleEntityNotFound(_0xa715ec,null))[_0x4ed6('0xb')](saveUpdates(_0x3debc7[_0x4ed6('0x42')],null))[_0x4ed6('0xb')](function(_0xa33047){if(_0xa33047){_0x226ab3=_0xa33047;return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x226ab3['type']},'raw':!![]});}return null;})[_0x4ed6('0xb')](function(_0x4dcfab){if(_0x226ab3['type'][_0x4ed6('0x43')]()==_0x4ed6('0x51')){var _0x4248fa=fs['readFileSync'](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x52')),'utf8');var _0x554ef1=ejs[_0x4ed6('0x48')](_0x4248fa,{'networks':_0x4dcfab||[]});fs['writeFileSync'](_0x4ed6('0x4a'),_0x554ef1);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x226ab3[_0x4ed6('0x29')][_0x4ed6('0x43')]()==_0x4ed6('0x4c')){var _0x2d5b46=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x5545c2=ejs[_0x4ed6('0x48')](_0x2d5b46,{'networks':_0x4dcfab||[]});fs[_0x4ed6('0x49')]('/etc/asterisk/turn_xcally.conf',_0x5545c2);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x1f'),{'module':_0x4ed6('0x4e')});}else{var _0x59f59f=fs['readFileSync'](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x53')),_0x4ed6('0x47'));var _0x578814=ejs[_0x4ed6('0x48')](_0x59f59f,{'networks':_0x4dcfab||[]});fs['writeFileSync'](util[_0x4ed6('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x3debc7[_0x4ed6('0x42')][_0x4ed6('0x29')][_0x4ed6('0x50')]()),_0x578814);return respondWithRpcPromise('Reload',_0x4ed6('0x1f'),{'module':_0x4ed6('0x54')});}})[_0x4ed6('0xb')](function(_0x5627be){if(_0x5627be){return _0x226ab3;}return null;})['then'](respondWithResult(_0xa715ec,null))[_0x4ed6('0x16')](handleError(_0xa715ec,null));};exports[_0x4ed6('0x55')]=function(_0x452abc,_0x49b94c){var _0x54fb64;return db['Network'][_0x4ed6('0x40')]({'where':{'id':_0x452abc[_0x4ed6('0x3d')]['id']}})[_0x4ed6('0xb')](function(_0x3d8614){_0x54fb64=_0x3d8614;return _0x3d8614;})[_0x4ed6('0xb')](handleEntityNotFound(_0x49b94c,null))[_0x4ed6('0xb')](removeEntity(_0x49b94c,null))[_0x4ed6('0xb')](function(){if(_0x54fb64){return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x54fb64[_0x4ed6('0x29')]},'raw':!![]});}})[_0x4ed6('0xb')](function(_0x2fa4a5){if(_0x54fb64['type']['toUpperCase']()==_0x4ed6('0x51')){var _0x1143d1=fs[_0x4ed6('0x44')](path['join'](config[_0x4ed6('0x46')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x25b8bf=ejs[_0x4ed6('0x48')](_0x1143d1,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x4a'),_0x25b8bf);return respondWithRpcPromise(_0x4ed6('0x4b'),'destroy',{'module':_0x4ed6('0x4e')});}else if(_0x54fb64[_0x4ed6('0x29')]['toUpperCase']()==_0x4ed6('0x4c')){var _0x199203=fs['readFileSync'](path['join'](config['root'],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x570d39=ejs['render'](_0x199203,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x56'),_0x570d39);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x55'),{'module':_0x4ed6('0x4e')});}else{var _0x501a46=fs['readFileSync'](path['join'](config[_0x4ed6('0x46')],'server/files/templates/network.ejs'),_0x4ed6('0x47'));var _0x34bf13=ejs[_0x4ed6('0x48')](_0x501a46,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](util['format'](_0x4ed6('0x57'),_0x54fb64[_0x4ed6('0x29')][_0x4ed6('0x50')]()),_0x34bf13);return respondWithRpcPromise('Reload','destroy',{'module':_0x4ed6('0x54')});}})[_0x4ed6('0x16')](handleError(_0x49b94c,null));}; \ No newline at end of file +var _0xa0b6=['server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','undefined','limit','count','offset','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Network','find','create','body','toUpperCase','STUN','join','root'];(function(_0x22fbdf,_0xb8a923){var _0x16b602=function(_0xfc1f3d){while(--_0xfc1f3d){_0x22fbdf['push'](_0x22fbdf['shift']());}};_0x16b602(++_0xb8a923);}(_0xa0b6,0x169));var _0x6a0b=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa0b6[_0x1d24eb];return _0x1dc576;};'use strict';var util=require(_0x6a0b('0x0'));var path=require(_0x6a0b('0x1'));var ejs=require(_0x6a0b('0x2'));var fs=require('fs');var _=require(_0x6a0b('0x3'));var qs=require(_0x6a0b('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x6a0b('0x5'));var db=require(_0x6a0b('0x6'))['db'];var jayson=require(_0x6a0b('0x7'));var client=jayson['client'][_0x6a0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x92ae31,_0xafd29d,_0x5aa2e1,_0x44ffb6){return new Promise(function(_0x588eef,_0x1e73e7){var _0x27069f=_0x44ffb6||client;return _0x27069f[_0x6a0b('0x9')](_0x92ae31,_0x5aa2e1)['then'](function(_0x5e0298){logger['info'](_0x6a0b('0xa'),_0xafd29d,_0x6a0b('0xb'));logger[_0x6a0b('0xc')](_0x6a0b('0xd'),_0xafd29d,_0x6a0b('0xb'),JSON[_0x6a0b('0xe')](_0x5e0298));if(_0x5e0298[_0x6a0b('0xf')]){if(_0x5e0298[_0x6a0b('0xf')]['code']===0x1f4){logger[_0x6a0b('0xf')](_0x6a0b('0xa'),_0xafd29d,_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);return _0x1e73e7(_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);}logger[_0x6a0b('0xf')](_0x6a0b('0xa'),_0xafd29d,_0x5e0298['error'][_0x6a0b('0x10')]);return _0x588eef(_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);}else{logger['info'](_0x6a0b('0xa'),_0xafd29d,_0x6a0b('0xb'));_0x588eef(_0x5e0298[_0x6a0b('0x11')][_0x6a0b('0x10')]);}})[_0x6a0b('0x12')](function(_0x18fc75){logger['error'](_0x6a0b('0xa'),_0xafd29d,_0x18fc75);_0x1e73e7(_0x18fc75);});});}function respondWithResult(_0x46ed37,_0x20bbe0){_0x20bbe0=_0x20bbe0||0xc8;return function(_0x4d92d5){if(_0x4d92d5){return _0x46ed37[_0x6a0b('0x13')](_0x20bbe0)['json'](_0x4d92d5);}};}function respondWithFilteredResult(_0x1e8718,_0x123242){return function(_0x3d8f69){if(_0x3d8f69){var _0x182acb=typeof _0x123242['offset']===_0x6a0b('0x14')&&typeof _0x123242[_0x6a0b('0x15')]==='undefined';var _0x4d3a57=_0x3d8f69[_0x6a0b('0x16')];var _0x46c681=_0x182acb?0x0:_0x123242['offset'];var _0x10cef1=_0x182acb?_0x3d8f69['count']:_0x123242[_0x6a0b('0x17')]+_0x123242[_0x6a0b('0x15')];var _0x243af3;if(_0x10cef1>=_0x4d3a57){_0x10cef1=_0x4d3a57;_0x243af3=0xc8;}else{_0x243af3=0xce;}_0x1e8718[_0x6a0b('0x13')](_0x243af3);return _0x1e8718['set'](_0x6a0b('0x18'),_0x46c681+'-'+_0x10cef1+'/'+_0x4d3a57)['json'](_0x3d8f69);}return null;};}function saveUpdates(_0xe56aaf){return function(_0x482c6c){if(_0x482c6c){return _0x482c6c[_0x6a0b('0x19')](_0xe56aaf)[_0x6a0b('0x1a')](function(_0x110914){return _0x110914;});}return null;};}function removeEntity(_0xd14208){return function(_0x26a43a){if(_0x26a43a){return _0x26a43a['destroy']()[_0x6a0b('0x1a')](function(){_0xd14208['status'](0xcc)[_0x6a0b('0x1b')]();});}};}function handleEntityNotFound(_0x1fafe0){return function(_0x596cdc){if(!_0x596cdc){_0x1fafe0[_0x6a0b('0x1c')](0x194);}return _0x596cdc;};}function handleError(_0x5ada2f,_0x457190){_0x457190=_0x457190||0x1f4;return function(_0x6431b7){logger['error'](_0x6431b7[_0x6a0b('0x1d')]);if(_0x6431b7[_0x6a0b('0x1e')]){delete _0x6431b7['name'];}_0x5ada2f[_0x6a0b('0x13')](_0x457190)[_0x6a0b('0x1f')](_0x6431b7);};}exports[_0x6a0b('0x20')]=function(_0xb775c1,_0x251212){var _0x21557a={},_0x7c3904={},_0x9e3d55={'count':0x0,'rows':[]};var _0x1ab39e=_[_0x6a0b('0x21')](db['Network'][_0x6a0b('0x22')],function(_0x53c772){return{'name':_0x53c772[_0x6a0b('0x23')],'type':_0x53c772[_0x6a0b('0x24')][_0x6a0b('0x25')]};});_0x7c3904['model']=_[_0x6a0b('0x21')](_0x1ab39e,_0x6a0b('0x1e'));_0x7c3904[_0x6a0b('0x26')]=_[_0x6a0b('0x27')](_0xb775c1['query']);_0x7c3904['filters']=_['intersection'](_0x7c3904[_0x6a0b('0x28')],_0x7c3904[_0x6a0b('0x26')]);_0x21557a[_0x6a0b('0x29')]=_[_0x6a0b('0x2a')](_0x7c3904[_0x6a0b('0x28')],qs[_0x6a0b('0x2b')](_0xb775c1[_0x6a0b('0x26')]['fields']));_0x21557a[_0x6a0b('0x29')]=_0x21557a[_0x6a0b('0x29')][_0x6a0b('0x2c')]?_0x21557a[_0x6a0b('0x29')]:_0x7c3904[_0x6a0b('0x28')];if(!_0xb775c1['query'][_0x6a0b('0x2d')](_0x6a0b('0x2e'))){_0x21557a[_0x6a0b('0x15')]=qs[_0x6a0b('0x15')](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x15')]);_0x21557a[_0x6a0b('0x17')]=qs['offset'](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x17')]);}_0x21557a[_0x6a0b('0x2f')]=qs[_0x6a0b('0x30')](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x30')]);_0x21557a[_0x6a0b('0x31')]=qs[_0x6a0b('0x32')](_[_0x6a0b('0x33')](_0xb775c1[_0x6a0b('0x26')],_0x7c3904['filters']),_0x1ab39e);if(_0xb775c1['query'][_0x6a0b('0x34')]){_0x21557a[_0x6a0b('0x31')]=_[_0x6a0b('0x35')](_0x21557a[_0x6a0b('0x31')],{'$or':_[_0x6a0b('0x21')](_0x1ab39e,function(_0xa9df0){if(_0xa9df0['type']!==_0x6a0b('0x36')){var _0x2a88cc={};_0x2a88cc[_0xa9df0[_0x6a0b('0x1e')]]={'$like':'%'+_0xb775c1[_0x6a0b('0x26')]['filter']+'%'};return _0x2a88cc;}})});}_0x21557a=_[_0x6a0b('0x35')]({},_0x21557a,_0xb775c1[_0x6a0b('0x37')]);var _0x44ca3c={'where':_0x21557a[_0x6a0b('0x31')]};return db['Network'][_0x6a0b('0x16')](_0x44ca3c)[_0x6a0b('0x1a')](function(_0x4e9ca2){_0x9e3d55[_0x6a0b('0x16')]=_0x4e9ca2;if(_0xb775c1['query'][_0x6a0b('0x38')]){_0x21557a[_0x6a0b('0x39')]=[{'all':!![]}];}return db['Network'][_0x6a0b('0x3a')](_0x21557a);})[_0x6a0b('0x1a')](function(_0x10f2a0){_0x9e3d55['rows']=_0x10f2a0;return _0x9e3d55;})[_0x6a0b('0x1a')](respondWithFilteredResult(_0x251212,_0x21557a))[_0x6a0b('0x12')](handleError(_0x251212,null));};exports[_0x6a0b('0x3b')]=function(_0x5d8a1a,_0x46c008){var _0x57288d={'raw':!![],'where':{'id':_0x5d8a1a[_0x6a0b('0x3c')]['id']}},_0x55a7cd={};_0x55a7cd['model']=_[_0x6a0b('0x27')](db[_0x6a0b('0x3d')][_0x6a0b('0x22')]);_0x55a7cd[_0x6a0b('0x26')]=_[_0x6a0b('0x27')](_0x5d8a1a[_0x6a0b('0x26')]);_0x55a7cd[_0x6a0b('0x32')]=_[_0x6a0b('0x2a')](_0x55a7cd['model'],_0x55a7cd['query']);_0x57288d['attributes']=_[_0x6a0b('0x2a')](_0x55a7cd['model'],qs['fields'](_0x5d8a1a['query'][_0x6a0b('0x2b')]));_0x57288d[_0x6a0b('0x29')]=_0x57288d[_0x6a0b('0x29')][_0x6a0b('0x2c')]?_0x57288d['attributes']:_0x55a7cd[_0x6a0b('0x28')];if(_0x5d8a1a[_0x6a0b('0x26')][_0x6a0b('0x38')]){_0x57288d[_0x6a0b('0x39')]=[{'all':!![]}];}_0x57288d=_[_0x6a0b('0x35')]({},_0x57288d,_0x5d8a1a[_0x6a0b('0x37')]);return db[_0x6a0b('0x3d')][_0x6a0b('0x3e')](_0x57288d)['then'](handleEntityNotFound(_0x46c008,null))[_0x6a0b('0x1a')](respondWithResult(_0x46c008,null))[_0x6a0b('0x12')](handleError(_0x46c008,null));};exports[_0x6a0b('0x3f')]=function(_0x5eaa5c,_0x14a375){var _0x2f1137;return db[_0x6a0b('0x3d')]['create'](_0x5eaa5c[_0x6a0b('0x40')],{'raw':!![]})[_0x6a0b('0x1a')](function(_0x20a14e){_0x2f1137=_0x20a14e;return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x5eaa5c[_0x6a0b('0x40')]['type']},'raw':!![]});})[_0x6a0b('0x1a')](function(_0x320e4d){if(_0x2f1137[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x42')){var _0x44583d=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x45')),_0x6a0b('0x46'));var _0x5960e2=ejs[_0x6a0b('0x47')](_0x44583d,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x5960e2);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x3f'),{'module':_0x6a0b('0x4b')});}else if(_0x2f1137[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x8398fd=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/turn_multiple.ejs'),_0x6a0b('0x46'));var _0x4e17a7=ejs['render'](_0x8398fd,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x4d'),_0x4e17a7);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x3f'),{'module':_0x6a0b('0x4b')});}else{var _0x301d66=fs['readFileSync'](path[_0x6a0b('0x43')](config['root'],_0x6a0b('0x4e')),_0x6a0b('0x46'));var _0x1d45ca=ejs[_0x6a0b('0x47')](_0x301d66,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](util[_0x6a0b('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x5eaa5c[_0x6a0b('0x40')]['type'][_0x6a0b('0x50')]()),_0x1d45ca);return respondWithRpcPromise(_0x6a0b('0x4a'),'create',{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x1a')](function(){return _0x2f1137;})[_0x6a0b('0x1a')](respondWithResult(_0x14a375,0xc9))[_0x6a0b('0x12')](handleError(_0x14a375,null));};exports[_0x6a0b('0x19')]=function(_0x3980d9,_0x5badfe){var _0x526d9d;return db['Network'][_0x6a0b('0x3e')]({'where':{'id':_0x3980d9['params']['id']}})[_0x6a0b('0x1a')](handleEntityNotFound(_0x5badfe,null))[_0x6a0b('0x1a')](saveUpdates(_0x3980d9['body'],null))[_0x6a0b('0x1a')](function(_0x141383){if(_0x141383){_0x526d9d=_0x141383;return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x526d9d[_0x6a0b('0x24')]},'raw':!![]});}return null;})[_0x6a0b('0x1a')](function(_0x1d6108){if(_0x526d9d[_0x6a0b('0x24')]['toUpperCase']()==_0x6a0b('0x42')){var _0x5db53a=fs[_0x6a0b('0x52')](path['join'](config[_0x6a0b('0x44')],'server/files/templates/stun_multiple.ejs'),_0x6a0b('0x46'));var _0x403977=ejs[_0x6a0b('0x47')](_0x5db53a,{'networks':_0x1d6108||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x403977);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x526d9d[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x4c44b5=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x53')),'utf8');var _0x5c4fb0=ejs[_0x6a0b('0x47')](_0x4c44b5,{'networks':_0x1d6108||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5c4fb0);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':_0x6a0b('0x4b')});}else{var _0x2697c6=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x4e')),_0x6a0b('0x46'));var _0x2e2976=ejs[_0x6a0b('0x47')](_0x2697c6,{'networks':_0x1d6108||[]});fs[_0x6a0b('0x48')](util[_0x6a0b('0x4f')](_0x6a0b('0x54'),_0x3980d9[_0x6a0b('0x40')][_0x6a0b('0x24')][_0x6a0b('0x50')]()),_0x2e2976);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x1a')](function(_0x2a5a3b){if(_0x2a5a3b){return _0x526d9d;}return null;})['then'](respondWithResult(_0x5badfe,null))['catch'](handleError(_0x5badfe,null));};exports['destroy']=function(_0x1d7b51,_0x1b3195){var _0x2e6c48;return db[_0x6a0b('0x3d')][_0x6a0b('0x3e')]({'where':{'id':_0x1d7b51[_0x6a0b('0x3c')]['id']}})[_0x6a0b('0x1a')](function(_0x5719d2){_0x2e6c48=_0x5719d2;return _0x5719d2;})['then'](handleEntityNotFound(_0x1b3195,null))[_0x6a0b('0x1a')](removeEntity(_0x1b3195,null))['then'](function(){if(_0x2e6c48){return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x2e6c48[_0x6a0b('0x24')]},'raw':!![]});}})[_0x6a0b('0x1a')](function(_0x382644){if(_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x42')){var _0x49a10b=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x45')),_0x6a0b('0x46'));var _0x1127eb=ejs[_0x6a0b('0x47')](_0x49a10b,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x1127eb);return respondWithRpcPromise('Reload',_0x6a0b('0x55'),{'module':_0x6a0b('0x4b')});}else if(_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x54fa2a=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4d3314=ejs['render'](_0x54fa2a,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x4d'),_0x4d3314);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x55'),{'module':_0x6a0b('0x4b')});}else{var _0x63e1dd=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/network.ejs'),'utf8');var _0x399b21=ejs[_0x6a0b('0x47')](_0x63e1dd,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x50')]()),_0x399b21);return respondWithRpcPromise(_0x6a0b('0x4a'),'destroy',{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x12')](handleError(_0x1b3195,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2946355..53ff12e 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a12,0xb8));var _0x20a1=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x0a12[_0x39d544];return _0x5a5ff2;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x278aec,_0x362035){var _0x1dc040=function(_0x4a9623){while(--_0x4a9623){_0x278aec['push'](_0x278aec['shift']());}};_0x1dc040(++_0x362035);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xcb91[_0x547456];return _0xc1fd7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'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 c98d38d..64d2188 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x442c23,_0x410d14){var _0x5f2153=function(_0x42c295){while(--_0x42c295){_0x442c23['push'](_0x442c23['shift']());}};_0x5f2153(++_0x410d14);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c2306,_0x1f6be9){var _0x459232=function(_0x473d7d){while(--_0x473d7d){_0x2c2306['push'](_0x2c2306['shift']());}};_0x459232(++_0x1f6be9);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 3334b10..fec35f6 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 _0x3423=['/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f4989,_0x5e7a88){var _0x3294bd=function(_0x29f15){while(--_0x29f15){_0x3f4989['push'](_0x3f4989['shift']());}};_0x3294bd(++_0x5e7a88);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x9')]('/:id/interactions',auth[_0x3342('0xa')](),controller[_0x3342('0x13')]);router[_0x3342('0x9')](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x15')]);router[_0x3342('0x16')]('/',auth['isAuthenticated'](),controller[_0x3342('0x17')]);router[_0x3342('0x16')]('/:id/dispositions',auth[_0x3342('0xa')](),controller[_0x3342('0x18')]);router['post']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x19')]);router[_0x3342('0x16')](_0x3342('0x1a'),controller[_0x3342('0x1b')]);router[_0x3342('0x16')](_0x3342('0x11'),auth[_0x3342('0xa')](),controller[_0x3342('0x1c')]);router['post'](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x1d')]);router['post'](_0x3342('0x1e'),auth[_0x3342('0xa')](),controller['send']);router[_0x3342('0x1f')](_0x3342('0xe'),auth['isAuthenticated'](),controller[_0x3342('0x20')]);router['delete'](_0x3342('0xe'),auth[_0x3342('0xa')](),controller[_0x3342('0x21')]);router[_0x3342('0x22')](_0x3342('0xf'),auth[_0x3342('0xa')](),controller[_0x3342('0x23')]);router[_0x3342('0x22')]('/:id/canned_answers',auth[_0x3342('0xa')](),controller['removeAnswers']);router['delete'](_0x3342('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3342('0x24')]=router; \ No newline at end of file +var _0xfcbb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router'];(function(_0x433b91,_0x29447a){var _0x481ca8=function(_0xdc271f){while(--_0xdc271f){_0x433b91['push'](_0x433b91['shift']());}};_0x481ca8(++_0x29447a);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x9a6d3,_0x2ab9b9){_0x9a6d3=_0x9a6d3-0x0;var _0x577127=_0xfcbb[_0x9a6d3];return _0x577127;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var fs_extra=require(_0xbfcb('0x4'));var auth=require(_0xbfcb('0x5'));var interaction=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x9')]);router[_0xbfcb('0xa')](_0xbfcb('0xb'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xc')]);router[_0xbfcb('0xa')]('/:id',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xd')]);router[_0xbfcb('0xa')]('/:id/dispositions',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xe')]);router[_0xbfcb('0xa')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x10')]);router['get'](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x12')]);router[_0xbfcb('0xa')]('/:id/interactions',auth[_0xbfcb('0x8')](),controller['getInteractions']);router[_0xbfcb('0xa')](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x14')]);router[_0xbfcb('0x15')]('/',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x16')]);router[_0xbfcb('0x15')](_0xbfcb('0x17'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x18')]);router[_0xbfcb('0x15')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x19')]);router[_0xbfcb('0x15')](_0xbfcb('0x1a'),controller[_0xbfcb('0x1b')]);router[_0xbfcb('0x15')](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x1c')]);router['post'](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller['addAgents']);router[_0xbfcb('0x15')](_0xbfcb('0x1d'),auth['isAuthenticated'](),controller['send']);router[_0xbfcb('0x1e')](_0xbfcb('0x1f'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x20')]);router[_0xbfcb('0x21')]('/:id',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x22')]);router[_0xbfcb('0x21')](_0xbfcb('0x17'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x23')]);router[_0xbfcb('0x21')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x24')]);router[_0xbfcb('0x21')](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x25')]);module[_0xbfcb('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c298512..7042a1e 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 _0xcda9=['name','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','exports','STRING'];(function(_0x34b7b6,_0x5a84bf){var _0x30915e=function(_0x48e460){while(--_0x48e460){_0x34b7b6['push'](_0x34b7b6['shift']());}};_0x30915e(++_0x5a84bf);}(_0xcda9,0x189));var _0x9cda=function(_0x37a4ca,_0x4532e4){_0x37a4ca=_0x37a4ca-0x0;var _0x63aa6=_0xcda9[_0x37a4ca];return _0x63aa6;};'use strict';var Sequelize=require(_0x9cda('0x0'));var rs=require('randomstring');module[_0x9cda('0x1')]={'name':{'type':Sequelize[_0x9cda('0x2')],'unique':_0x9cda('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9cda('0x2')]},'token':{'type':Sequelize[_0x9cda('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9cda('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9cda('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9cda('0x4')],'defaultValue':function(){return _0x9cda('0x5');}},'notificationSound':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cda('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9cda('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9cda('0x9'),'set':function(_0x473bdb){if(!_0x473bdb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9cda('0xa')](_0x9cda('0xb'),_0x473bdb);}}}; \ No newline at end of file +var _0xfca8=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x35f6b4,_0x505966){var _0x10f072=function(_0x20e563){while(--_0x20e563){_0x35f6b4['push'](_0x35f6b4['shift']());}};_0x10f072(++_0x505966);}(_0xfca8,0x1d7));var _0x8fca=function(_0x3d5c21,_0x12ec72){_0x3d5c21=_0x3d5c21-0x0;var _0x395e68=_0xfca8[_0x3d5c21];return _0x395e68;};'use strict';var Sequelize=require(_0x8fca('0x0'));var rs=require('randomstring');module[_0x8fca('0x1')]={'name':{'type':Sequelize[_0x8fca('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8fca('0x2')],'defaultValue':function(){return rs[_0x8fca('0x3')]();}},'replyUri':{'type':Sequelize[_0x8fca('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8fca('0x4')],'defaultValue':function(){return _0x8fca('0x5');}},'notificationSound':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8fca('0x2')]},'queueTransfer':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8fca('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![],'comment':_0x8fca('0x8'),'set':function(_0x4350eb){if(!_0x4350eb)this[_0x8fca('0x9')](_0x8fca('0xa'),null);this[_0x8fca('0x9')](_0x8fca('0xb'),_0x4350eb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d92aec7..ca0e962 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 _0xa423=['socket.io-emitter','./openchannelAccount.socket','register','client','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','findOne','nolimit','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','OpenchannelApplication','List','applications','Applications','asc','account','Contacts','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queue','waitForTheAssignedQueue','EventManager','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost'];(function(_0xf945c7,_0x298d9a){var _0x3ef75c=function(_0x252670){while(--_0x252670){_0xf945c7['push'](_0xf945c7['shift']());}};_0x3ef75c(++_0x298d9a);}(_0xa423,0x16c));var _0x3a42=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xa423[_0x35e083];return _0x4c1d88;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a42('0x1a')]=_['defaults'](config[_0x3a42('0x1a')],{'host':_0x3a42('0x1b'),'port':0x18eb});var socket=require(_0x3a42('0x1c'))(new Redis(config[_0x3a42('0x1a')]));require(_0x3a42('0x1d'))[_0x3a42('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3a42('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3a42('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e5d77,_0x5895a8,_0x46ef1e,_0x4edcf5){return new BPromise(function(_0x486c74,_0x4eae89){var _0x26c844=_0x4edcf5||client;return _0x26c844[_0x3a42('0x20')](_0x3e5d77,_0x46ef1e)[_0x3a42('0x21')](function(_0x39e620){logger[_0x3a42('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5895a8,_0x3a42('0x23'));logger[_0x3a42('0x24')](_0x3a42('0x25'),_0x5895a8,_0x3a42('0x23'),JSON[_0x3a42('0x26')](_0x39e620));if(_0x39e620[_0x3a42('0x27')]){if(_0x39e620['error'][_0x3a42('0x28')]===0x1f4){logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x39e620[_0x3a42('0x27')][_0x3a42('0x2a')]);return _0x4eae89(_0x39e620['error'][_0x3a42('0x2a')]);}logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x39e620[_0x3a42('0x27')][_0x3a42('0x2a')]);return _0x486c74(_0x39e620['error'][_0x3a42('0x2a')]);}else{logger[_0x3a42('0x22')](_0x3a42('0x29'),_0x5895a8,_0x3a42('0x23'));_0x486c74(_0x39e620[_0x3a42('0x2b')][_0x3a42('0x2a')]);}})[_0x3a42('0x2c')](function(_0x434044){logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x434044);_0x4eae89(_0x434044);});});}function respondWithStatusCode(_0x29a4d0,_0x510c93){_0x510c93=_0x510c93||0xcc;return function(_0x222f88){if(_0x222f88){return _0x29a4d0[_0x3a42('0x2d')](_0x510c93);}return _0x29a4d0['status'](_0x510c93)[_0x3a42('0x2e')]();};}function respondWithResult(_0x5b5897,_0x462a56){_0x462a56=_0x462a56||0xc8;return function(_0x2a4878){if(_0x2a4878){return _0x5b5897[_0x3a42('0x2f')](_0x462a56)[_0x3a42('0x30')](_0x2a4878);}};}function respondWithFilteredResult(_0x1559cd,_0xaf28ad){return function(_0x4b8fe7){if(_0x4b8fe7){var _0x175fc4=typeof _0xaf28ad[_0x3a42('0x31')]===_0x3a42('0x32')&&typeof _0xaf28ad[_0x3a42('0x33')]===_0x3a42('0x32');var _0x44ef39=_0x4b8fe7[_0x3a42('0x34')];var _0x56ee5d=_0x175fc4?0x0:_0xaf28ad[_0x3a42('0x31')];var _0x3e7442=_0x175fc4?_0x4b8fe7[_0x3a42('0x34')]:_0xaf28ad[_0x3a42('0x31')]+_0xaf28ad[_0x3a42('0x33')];var _0x50ece0;if(_0x3e7442>=_0x44ef39){_0x3e7442=_0x44ef39;_0x50ece0=0xc8;}else{_0x50ece0=0xce;}_0x1559cd['status'](_0x50ece0);return _0x1559cd[_0x3a42('0x35')]('Content-Range',_0x56ee5d+'-'+_0x3e7442+'/'+_0x44ef39)[_0x3a42('0x30')](_0x4b8fe7);}return null;};}function patchUpdates(_0x2e6fb3){return function(_0x2bbfe4){try{jsonpatch[_0x3a42('0x36')](_0x2bbfe4,_0x2e6fb3,!![]);}catch(_0x37defa){return BPromise[_0x3a42('0x37')](_0x37defa);}return _0x2bbfe4['save']();};}function saveUpdates(_0x1935cf,_0x1c92e2){return function(_0x412d65){if(_0x412d65){return _0x412d65['update'](_0x1935cf)['then'](function(_0x41df56){return _0x41df56;});}return null;};}function removeEntity(_0x3f21ed,_0xb2f1d3){return function(_0xe51e6){if(_0xe51e6){return _0xe51e6[_0x3a42('0x38')]()['then'](function(){var _0x528cce=_0xe51e6[_0x3a42('0x39')]({'plain':!![]});var _0x153801=_0x3a42('0x3a');return db[_0x3a42('0x3b')]['destroy']({'where':{'type':_0x153801,'resourceId':_0x528cce['id']}})[_0x3a42('0x21')](function(){return _0xe51e6;});})[_0x3a42('0x21')](function(){_0x3f21ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5079a4,_0x199a39){return function(_0x4ca6a9){if(!_0x4ca6a9){_0x5079a4[_0x3a42('0x2d')](0x194);}return _0x4ca6a9;};}function handleError(_0x14ebbe,_0x29312e){_0x29312e=_0x29312e||0x1f4;return function(_0x1fcbcb){logger[_0x3a42('0x27')](_0x1fcbcb[_0x3a42('0x3c')]);if(_0x1fcbcb[_0x3a42('0x3d')]){delete _0x1fcbcb[_0x3a42('0x3d')];}_0x14ebbe[_0x3a42('0x2f')](_0x29312e)['send'](_0x1fcbcb);};}exports[_0x3a42('0x3e')]=function(_0x3a33f3,_0x2541db){var _0xd3ee22={'include':[{'model':db[_0x3a42('0x3f')],'as':'mandatoryDispositionPause'}]},_0x38e3fe={},_0x567043={'count':0x0,'rows':[]};var _0x4e9224=_['map'](db['OpenchannelAccount'][_0x3a42('0x40')],function(_0x47dbb7){return{'name':_0x47dbb7['fieldName'],'type':_0x47dbb7['type'][_0x3a42('0x41')]};});_0x38e3fe['model']=_['map'](_0x4e9224,_0x3a42('0x3d'));_0x38e3fe[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x3a33f3[_0x3a42('0x42')]);_0x38e3fe[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x38e3fe['model'],_0x38e3fe[_0x3a42('0x42')]);_0xd3ee22[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x38e3fe['model'],qs[_0x3a42('0x47')](_0x3a33f3[_0x3a42('0x42')]['fields']));_0xd3ee22[_0x3a42('0x46')]=_0xd3ee22[_0x3a42('0x46')][_0x3a42('0x48')]?_0xd3ee22[_0x3a42('0x46')]:_0x38e3fe[_0x3a42('0x49')];if(!_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4a')]('nolimit')){_0xd3ee22[_0x3a42('0x33')]=qs[_0x3a42('0x33')](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x33')]);_0xd3ee22[_0x3a42('0x31')]=qs['offset'](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x31')]);}_0xd3ee22[_0x3a42('0x4b')]=qs['sort'](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4c')]);_0xd3ee22[_0x3a42('0x4d')]=qs[_0x3a42('0x44')](_[_0x3a42('0x4e')](_0x3a33f3['query'],_0x38e3fe[_0x3a42('0x44')]),_0x4e9224);if(_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4f')]){_0xd3ee22[_0x3a42('0x4d')]=_['merge'](_0xd3ee22[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x4e9224,function(_0x3d4897){if(_0x3d4897[_0x3a42('0x51')]!==_0x3a42('0x52')){var _0x9799a={};_0x9799a[_0x3d4897[_0x3a42('0x3d')]]={'$like':'%'+_0x3a33f3['query'][_0x3a42('0x4f')]+'%'};return _0x9799a;}})});}_0xd3ee22=_[_0x3a42('0x53')]({},_0xd3ee22,_0x3a33f3[_0x3a42('0x54')]);var _0x1f9912={'where':_0xd3ee22[_0x3a42('0x4d')]};return db[_0x3a42('0x55')]['count'](_0x1f9912)[_0x3a42('0x21')](function(_0x5e5af8){_0x567043[_0x3a42('0x34')]=_0x5e5af8;if(_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x56')]){_0xd3ee22[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x55')][_0x3a42('0x58')](_0xd3ee22);})[_0x3a42('0x21')](function(_0x36dbb3){_0x567043[_0x3a42('0x59')]=_0x36dbb3;return _0x567043;})['then'](respondWithFilteredResult(_0x2541db,_0xd3ee22))[_0x3a42('0x2c')](handleError(_0x2541db,null));};exports[_0x3a42('0x5a')]=function(_0x55eceb,_0x583029){var _0x1019db={'raw':![],'where':{'id':_0x55eceb['params']['id']},'include':[{'model':db[_0x3a42('0x3f')],'as':_0x3a42('0x5b')}]},_0xb752a5={};_0xb752a5[_0x3a42('0x49')]=_['keys'](db[_0x3a42('0x55')][_0x3a42('0x40')]);_0xb752a5['query']=_[_0x3a42('0x43')](_0x55eceb['query']);_0xb752a5[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0xb752a5['model'],_0xb752a5[_0x3a42('0x42')]);_0x1019db[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0xb752a5[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x55eceb[_0x3a42('0x42')][_0x3a42('0x47')]));_0x1019db[_0x3a42('0x46')]=_0x1019db[_0x3a42('0x46')][_0x3a42('0x48')]?_0x1019db['attributes']:_0xb752a5[_0x3a42('0x49')];if(_0x55eceb[_0x3a42('0x42')][_0x3a42('0x56')]){_0x1019db[_0x3a42('0x57')]=[{'all':!![]}];}_0x1019db=_[_0x3a42('0x53')]({},_0x1019db,_0x55eceb['options']);return db[_0x3a42('0x55')][_0x3a42('0x5c')](_0x1019db)[_0x3a42('0x21')](handleEntityNotFound(_0x583029,null))['then'](respondWithResult(_0x583029,null))[_0x3a42('0x2c')](handleError(_0x583029,null));};exports[_0x3a42('0x5d')]=function(_0x596e9e,_0x190563){return db[_0x3a42('0x55')][_0x3a42('0x5d')](_0x596e9e[_0x3a42('0x5e')],{})[_0x3a42('0x21')](function(_0x1b74c7){var _0x52c6af=_0x596e9e['user']['get']({'plain':!![]});if(!_0x52c6af)throw new Error(_0x3a42('0x5f'));if(_0x52c6af[_0x3a42('0x60')]===_0x3a42('0x61')){var _0x46cd72=_0x1b74c7['get']({'plain':!![]});var _0x376aa0=_0x3a42('0x3a');return db[_0x3a42('0x62')]['find']({'where':{'name':_0x376aa0,'userProfileId':_0x52c6af[_0x3a42('0x63')]},'raw':!![]})[_0x3a42('0x21')](function(_0x5abb21){if(_0x5abb21&&_0x5abb21[_0x3a42('0x64')]===0x0){return db[_0x3a42('0x3b')][_0x3a42('0x5d')]({'name':_0x46cd72[_0x3a42('0x3d')],'resourceId':_0x46cd72['id'],'type':_0x5abb21[_0x3a42('0x3d')],'sectionId':_0x5abb21['id']},{})[_0x3a42('0x21')](function(){return _0x1b74c7;});}else{return _0x1b74c7;}})[_0x3a42('0x2c')](function(_0x3fbf45){logger[_0x3a42('0x27')](_0x3a42('0x65'),_0x3fbf45);throw _0x3fbf45;});}return _0x1b74c7;})[_0x3a42('0x21')](respondWithResult(_0x190563,0xc9))[_0x3a42('0x2c')](handleError(_0x190563,null));};exports[_0x3a42('0x66')]=function(_0xaf2a8,_0xb6b0a){if(_0xaf2a8[_0x3a42('0x5e')]['id']){delete _0xaf2a8[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0xaf2a8[_0x3a42('0x67')]['id']},'include':[{'model':db[_0x3a42('0x3f')],'as':_0x3a42('0x5b')}]})['then'](handleEntityNotFound(_0xb6b0a,null))['then'](saveUpdates(_0xaf2a8['body'],null))[_0x3a42('0x21')](respondWithResult(_0xb6b0a,null))[_0x3a42('0x2c')](handleError(_0xb6b0a,null));};exports[_0x3a42('0x38')]=function(_0x1e665a,_0x20008b){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x1e665a['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x20008b,null))[_0x3a42('0x21')](removeEntity(_0x20008b,null))['catch'](handleError(_0x20008b,null));};exports[_0x3a42('0x68')]=function(_0x209493,_0x531dbc){return db[_0x3a42('0x55')]['describe']()[_0x3a42('0x21')](respondWithResult(_0x531dbc,null))['catch'](handleError(_0x531dbc,null));};exports[_0x3a42('0x69')]=function(_0xfb5739,_0xfbd35a,_0x9621ee){if(_0xfb5739[_0x3a42('0x5e')]['id']){delete _0xfb5739[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0xfb5739[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0xfbd35a,null))['then'](function(_0x9c3224){if(_0x9c3224){_0xfb5739[_0x3a42('0x5e')]['OpenchannelAccountId']=_0x9c3224['id'];return db[_0x3a42('0x6a')][_0x3a42('0x5d')](_0xfb5739[_0x3a42('0x5e')]);}})[_0x3a42('0x21')](respondWithResult(_0xfbd35a,null))[_0x3a42('0x2c')](handleError(_0xfbd35a,null));};exports['getDispositions']=function(_0x5cfdaa,_0x78d77f,_0x248bb9){var _0x12e3f1={'raw':![],'where':{}};var _0x55f4df={};var _0x4c2025={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3a42('0x6b')]({'where':{'id':_0x5cfdaa['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x78d77f,null))['then'](function(_0x698e0){if(_0x698e0){_0x55f4df['model']=_['keys'](db[_0x3a42('0x6a')]['rawAttributes']);_0x55f4df[_0x3a42('0x42')]=_['keys'](_0x5cfdaa['query']);_0x55f4df[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x55f4df[_0x3a42('0x49')],_0x55f4df[_0x3a42('0x42')]);_0x12e3f1['attributes']=_[_0x3a42('0x45')](_0x55f4df[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x5cfdaa['query'][_0x3a42('0x47')]));_0x12e3f1[_0x3a42('0x46')]=_0x12e3f1['attributes'][_0x3a42('0x48')]?_0x12e3f1[_0x3a42('0x46')]:_0x55f4df[_0x3a42('0x49')];if(!_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4a')](_0x3a42('0x6c'))){_0x12e3f1['limit']=qs[_0x3a42('0x33')](_0x5cfdaa['query'][_0x3a42('0x33')]);_0x12e3f1[_0x3a42('0x31')]=qs['offset'](_0x5cfdaa[_0x3a42('0x42')]['offset']);}_0x12e3f1[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x12e3f1['where']=qs[_0x3a42('0x44')](_[_0x3a42('0x4e')](_0x5cfdaa[_0x3a42('0x42')],_0x55f4df['filters']));_0x12e3f1[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x698e0['id'];if(_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x12e3f1[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x12e3f1['where'],{'$or':_[_0x3a42('0x50')](_0x12e3f1[_0x3a42('0x46')],function(_0x541a15){var _0x75de0e={};_0x75de0e[_0x541a15]={'$like':'%'+_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x75de0e;})});}_0x12e3f1=_[_0x3a42('0x53')]({},_0x12e3f1,_0x5cfdaa['options']);return db[_0x3a42('0x6a')][_0x3a42('0x34')]({'where':_0x12e3f1[_0x3a42('0x4d')]})[_0x3a42('0x21')](function(_0x997202){_0x4c2025[_0x3a42('0x34')]=_0x997202;if(_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x56')]){_0x12e3f1[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x6a')]['findAll'](_0x12e3f1);})[_0x3a42('0x21')](function(_0x5725aa){_0x4c2025[_0x3a42('0x59')]=_0x5725aa;return _0x4c2025;});}})['then'](respondWithFilteredResult(_0x78d77f,_0x12e3f1))[_0x3a42('0x2c')](handleError(_0x78d77f,null));};exports[_0x3a42('0x6e')]=function(_0x39a9e7,_0x596911,_0x176cb4){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x39a9e7[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x596911,null))[_0x3a42('0x21')](function(_0x8bcc02){if(_0x8bcc02){return _0x8bcc02['removeDispositions'](_0x39a9e7[_0x3a42('0x42')][_0x3a42('0x6f')]);}})['then'](respondWithStatusCode(_0x596911,null))[_0x3a42('0x2c')](handleError(_0x596911,null));};exports[_0x3a42('0x70')]=function(_0x36c223,_0x5a8ecd,_0x1ea0b3){if(_0x36c223[_0x3a42('0x5e')]['id']){delete _0x36c223[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0x36c223[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x5a8ecd,null))[_0x3a42('0x21')](function(_0x118d23){if(_0x118d23){_0x36c223['body'][_0x3a42('0x6d')]=_0x118d23['id'];return db[_0x3a42('0x71')][_0x3a42('0x5d')](_0x36c223[_0x3a42('0x5e')]);}})[_0x3a42('0x21')](respondWithResult(_0x5a8ecd,null))[_0x3a42('0x2c')](handleError(_0x5a8ecd,null));};exports[_0x3a42('0x72')]=function(_0x1337e1,_0x31bd65,_0x1c3e87){var _0x400d0f={'raw':![],'where':{}};var _0x103188={};var _0x1cff88={'count':0x0,'rows':[]};return db[_0x3a42('0x55')]['findOne']({'where':{'id':_0x1337e1[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x31bd65,null))[_0x3a42('0x21')](function(_0x432d68){if(_0x432d68){_0x103188[_0x3a42('0x49')]=_['keys'](db['CannedAnswer'][_0x3a42('0x40')]);_0x103188['query']=_[_0x3a42('0x43')](_0x1337e1[_0x3a42('0x42')]);_0x103188[_0x3a42('0x44')]=_['intersection'](_0x103188[_0x3a42('0x49')],_0x103188[_0x3a42('0x42')]);_0x400d0f['attributes']=_[_0x3a42('0x45')](_0x103188['model'],qs[_0x3a42('0x47')](_0x1337e1[_0x3a42('0x42')][_0x3a42('0x47')]));_0x400d0f[_0x3a42('0x46')]=_0x400d0f[_0x3a42('0x46')][_0x3a42('0x48')]?_0x400d0f['attributes']:_0x103188['model'];if(!_0x1337e1[_0x3a42('0x42')]['hasOwnProperty'](_0x3a42('0x6c'))){_0x400d0f['limit']=qs['limit'](_0x1337e1[_0x3a42('0x42')]['limit']);_0x400d0f['offset']=qs[_0x3a42('0x31')](_0x1337e1[_0x3a42('0x42')][_0x3a42('0x31')]);}_0x400d0f[_0x3a42('0x4b')]=qs['sort'](_0x1337e1['query'][_0x3a42('0x4c')]);_0x400d0f[_0x3a42('0x4d')]=qs['filters'](_['pick'](_0x1337e1[_0x3a42('0x42')],_0x103188[_0x3a42('0x44')]));_0x400d0f[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x432d68['id'];if(_0x1337e1[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x400d0f['where']=_['merge'](_0x400d0f[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x400d0f[_0x3a42('0x46')],function(_0xd6b5ae){var _0x4c76ec={};_0x4c76ec[_0xd6b5ae]={'$like':'%'+_0x1337e1[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x4c76ec;})});}_0x400d0f=_['merge']({},_0x400d0f,_0x1337e1[_0x3a42('0x54')]);return db[_0x3a42('0x71')][_0x3a42('0x34')]({'where':_0x400d0f[_0x3a42('0x4d')]})['then'](function(_0x1294a1){_0x1cff88[_0x3a42('0x34')]=_0x1294a1;if(_0x1337e1[_0x3a42('0x42')]['includeAll']){_0x400d0f[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x71')]['findAll'](_0x400d0f);})[_0x3a42('0x21')](function(_0x182ad5){_0x1cff88[_0x3a42('0x59')]=_0x182ad5;return _0x1cff88;});}})['then'](respondWithFilteredResult(_0x31bd65,_0x400d0f))[_0x3a42('0x2c')](handleError(_0x31bd65,null));};exports['removeAnswers']=function(_0x35b712,_0xcce2d1,_0x6dfb47){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x35b712[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0xcce2d1,null))[_0x3a42('0x21')](function(_0x1ad654){if(_0x1ad654){return _0x1ad654[_0x3a42('0x73')](_0x35b712[_0x3a42('0x42')][_0x3a42('0x6f')]);}})[_0x3a42('0x21')](respondWithStatusCode(_0xcce2d1,null))[_0x3a42('0x2c')](handleError(_0xcce2d1,null));};exports[_0x3a42('0x74')]=function(_0x42fd75,_0x5654c1,_0x5737ba){var _0x48fd7f={'body':_0x42fd75[_0x3a42('0x5e')],'channel':_0x3a42('0x75')};var _0x2efcea=[];var _0x298b0c=[];var _0x17a01e={};var _0x69f054=![];return db[_0x3a42('0x76')][_0x3a42('0x68')]()[_0x3a42('0x21')](function(_0x45bbae){if(!_0x45bbae){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x79'));}_0x2efcea=_[_0x3a42('0x7a')](_[_0x3a42('0x43')](_0x45bbae),[_0x3a42('0x7b'),'updatedAt']);_0x298b0c=_[_0x3a42('0x7a')](_[_0x3a42('0x43')](_0x45bbae),[_0x3a42('0x7b'),_0x3a42('0x7c'),_0x3a42('0x7d'),_0x3a42('0x7e')]);if(_0x42fd75['body']['id']){delete _0x42fd75[_0x3a42('0x5e')]['id'];}if(_[_0x3a42('0x7f')](_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x80')])){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x81'));}if(_[_0x3a42('0x7f')](_0x42fd75[_0x3a42('0x5e')]['body'])||_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x5e')]===''){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x82'));}if(_['isNil'](_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x83')])){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x84')+_0x298b0c);}if(!_[_0x3a42('0x85')](_0x298b0c,_0x42fd75[_0x3a42('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x298b0c);}_0x17a01e[_0x42fd75[_0x3a42('0x5e')]['mapKey']]=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x80')];})[_0x3a42('0x21')](function(){return db['OpenchannelAccount'][_0x3a42('0x5c')]({'where':{'id':_0x42fd75[_0x3a42('0x67')]['id']},'include':[{'model':db[_0x3a42('0x86')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x17a01e,'limit':0x1,'order':[[_0x3a42('0x7c'),'DESC']]}]},{'model':db[_0x3a42('0x87')],'as':'Applications'}]});})[_0x3a42('0x21')](handleEntityNotFound(_0x5654c1,null))[_0x3a42('0x21')](function(_0x115ec5){if(_0x115ec5&&_0x115ec5[_0x3a42('0x88')]){_0x48fd7f['account']=_0x115ec5;_0x48fd7f[_0x3a42('0x89')]=_0x115ec5[_0x3a42('0x8a')];_0x48fd7f['list']=_0x115ec5[_0x3a42('0x88')];_0x48fd7f[_0x3a42('0x89')]=_['orderBy'](_0x48fd7f[_0x3a42('0x89')],['priority'],[_0x3a42('0x8b')]);if(_0x48fd7f['account']['Applications']){delete _0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x8a')];}if(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x88')]&&_0x48fd7f['account'][_0x3a42('0x88')][_0x3a42('0x8d')]['length']){return _0x48fd7f[_0x3a42('0x8c')]['List'][_0x3a42('0x8d')][0x0];}var _0x7c1459=_[_0x3a42('0x8e')](_0x42fd75[_0x3a42('0x5e')],{'firstName':_0x42fd75['body'][_0x3a42('0x80')],'ListId':_0x115ec5[_0x3a42('0x7e')]});_0x7c1459[_0x42fd75['body'][_0x3a42('0x83')]]=_0x42fd75['body'][_0x3a42('0x80')];return db[_0x3a42('0x76')][_0x3a42('0x5d')](_0x7c1459,{'fields':_0x2efcea,'raw':!![]});}})['then'](handleEntityNotFound(_0x5654c1,null))['then'](function(_0x3dfa0f){_0x48fd7f[_0x3a42('0x8f')]=_0x3dfa0f;if(_0x3dfa0f){var _0x5b5062={'ContactId':_0x3dfa0f['id'],'OpenchannelAccountId':_0x42fd75[_0x3a42('0x67')]['id'],'from':(_0x3dfa0f[_0x3a42('0x90')]||'')+'\x20'+(_0x3dfa0f[_0x3a42('0x91')]||'')};var _0x4f4dc6={'OpenchannelAccountId':_0x42fd75[_0x3a42('0x67')]['id'],'closed':![]};if(_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]){_0x4f4dc6['threadId']=_0x42fd75[_0x3a42('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0x3a42('0x5c')]({'where':_0x4f4dc6})['then'](function(_0x1e6038){if(_0x1e6038){return[_0x1e6038,![]];}_0x5b5062['threadId']=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')];_0x5b5062[_0x3a42('0x93')]=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x93')];return db[_0x3a42('0x94')][_0x3a42('0x5d')](_0x5b5062)[_0x3a42('0x21')](function(_0x44afb2){return[_0x44afb2,!![]];});});}else{_0x4f4dc6['threadId']=null;}_0x4f4dc6['ContactId']=_0x3dfa0f['id'];return db[_0x3a42('0x94')][_0x3a42('0x5c')]({'where':_0x4f4dc6})[_0x3a42('0x21')](function(_0x553047){if(_0x553047){return[_0x553047,![]];}return db[_0x3a42('0x94')][_0x3a42('0x5d')](_0x5b5062)[_0x3a42('0x21')](function(_0x949b84){return[_0x949b84,!![]];});});}})[_0x3a42('0x95')](function(_0x2a4d1c,_0x47cb21){if(_0x2a4d1c){_0x69f054=_0x47cb21;if(!_0x47cb21){var _0x16f9a4={'from':(_0x48fd7f['contact'][_0x3a42('0x90')]||'')+'\x20'+(_0x48fd7f['contact'][_0x3a42('0x91')]||'')};if(_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]&&_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x96')]&&_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]!=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x96')]){_0x16f9a4[_0x3a42('0x92')]=_0x42fd75['body']['messageId'];}return _0x2a4d1c[_0x3a42('0x66')](_0x16f9a4);}else{return _0x2a4d1c;}}})[_0x3a42('0x21')](function(_0x82c7f3){_0x48fd7f[_0x3a42('0x97')]=_0x82c7f3[_0x3a42('0x39')]({'plain':!![]});_0x48fd7f['interaction'][_0x3a42('0x98')]=_0x69f054;if(_0x48fd7f[_0x3a42('0x97')]['created']){if(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x99')]){_0x48fd7f['applications'][_0x3a42('0x9a')]({'id':0x0,'priority':_0x48fd7f[_0x3a42('0x89')][_0x3a42('0x48')]+0x1,'app':_0x3a42('0x9b'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x3a42('0x9c')][_0x3a42('0x5d')]({'body':_0x42fd75['body']['body'],'OpenchannelAccountId':_0x42fd75['params']['id'],'OpenchannelInteractionId':_0x82c7f3['id'],'direction':'in','ContactId':_0x48fd7f['contact']['id'],'AttachmentId':_0x42fd75['body'][_0x3a42('0x9d')]});})[_0x3a42('0x21')](function(_0x385b16){_0x48fd7f[_0x3a42('0x2a')]=_0x385b16;if(!_0x48fd7f[_0x3a42('0x97')][_0x3a42('0x9e')])return;return db[_0x3a42('0x9f')][_0x3a42('0x5c')]({'attributes':['id',_0x3a42('0x3d')],'where':{'id':_0x48fd7f[_0x3a42('0x97')][_0x3a42('0x9e')]}});})[_0x3a42('0x21')](function(_0x30a696){if(_0x30a696){_0x48fd7f[_0x3a42('0x89')][_0x3a42('0xa0')]({'id':0x0,'priority':0x0,'app':_0x3a42('0xa1'),'appdata':_0x30a696[_0x3a42('0x3d')]+','+(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0xa2')]||0xa),'interval':_0x3a42('0xa3')});}if(!_0x48fd7f[_0x3a42('0x97')]['queueId'])return;return db['OpenchannelQueue'][_0x3a42('0x5c')]({'attributes':['id',_0x3a42('0x3d')],'where':{'id':_0x48fd7f[_0x3a42('0x97')]['queueId']}});})[_0x3a42('0x21')](function(_0x22cd74){if(_0x22cd74){_0x48fd7f['applications'][_0x3a42('0xa0')]({'id':0x0,'priority':0x1,'app':_0x3a42('0xa4'),'appdata':_0x22cd74[_0x3a42('0x3d')]+','+(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0xa5')]||0x12c),'interval':_0x3a42('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x48fd7f);})[_0x3a42('0x21')](function(_0x1a0144){respondWithRpcPromise(_0x3a42('0xa6'),_0x3a42('0xa6'),{'event':_0x3a42('0x74'),'message':_0x1a0144},client9002);return _0x1a0144;})[_0x3a42('0x21')](respondWithResult(_0x5654c1,null))['catch'](handleError(_0x5654c1,null));};exports['addApplications']=function(_0x2968a2,_0x2adb8c){var _0x48d90c=_0x2968a2['params']['id'];var _0x53c806=_0x2968a2[_0x3a42('0x5e')];var _0x2f0372=0xc8;var _0x2a0340=null;return db[_0x3a42('0xa7')][_0x3a42('0xa8')]({'isolationLevel':db[_0x3a42('0xa7')]['Transaction'][_0x3a42('0xa9')][_0x3a42('0xaa')]},function(_0x620c72){return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x48d90c},'transaction':_0x620c72})[_0x3a42('0x21')](function(_0x3588ea){if(_0x3588ea){return db[_0x3a42('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x48d90c},'transaction':_0x620c72})[_0x3a42('0x21')](function(){var _0x1810a8=_[_0x3a42('0x50')](_0x53c806,function(_0x5c7a1d){_0x5c7a1d[_0x3a42('0x6d')]=_0x48d90c;return _0x5c7a1d;});return db[_0x3a42('0x87')][_0x3a42('0xab')](_0x1810a8,{'transaction':_0x620c72});});}else{_0x2f0372=0x194;_0x2a0340=[];}});})[_0x3a42('0x21')](function(){if(_0x2f0372!==0x194){return db[_0x3a42('0x87')][_0x3a42('0xac')]({'where':{'OpenchannelAccountId':_0x48d90c},'order':_0x3a42('0xad')})[_0x3a42('0x21')](function(_0x553b3c){_0x2a0340=_0x553b3c;});}})[_0x3a42('0x2c')](function(_0x1e08eb){_0x2f0372=0x1f4;logger[_0x3a42('0x27')](_0x1e08eb[_0x3a42('0x3c')]);if(_0x1e08eb['name']){delete _0x1e08eb[_0x3a42('0x3d')];}_0x2a0340=_0x1e08eb;})[_0x3a42('0xae')](function(){if(_0x2a0340===null){_0x2adb8c[_0x3a42('0x2d')](_0x2f0372);}else{if(_0x2f0372===0x1f4){_0x2adb8c[_0x3a42('0x2f')](_0x2f0372)[_0x3a42('0xaf')](_0x2a0340);}else{_0x2adb8c[_0x3a42('0x2f')](_0x2f0372)[_0x3a42('0x30')](_0x2a0340);}}});};exports[_0x3a42('0xb0')]=function(_0x3d7480,_0x47d5ed,_0x29d35a){var _0x33b68c={};var _0x57984d={};var _0x1cb329;var _0x3333f8;return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x3d7480[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x47d5ed,null))[_0x3a42('0x21')](function(_0x180da0){if(_0x180da0){_0x1cb329=_0x180da0;_0x57984d[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x87')][_0x3a42('0x40')]);_0x57984d[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x3d7480['query']);_0x57984d['filters']=_[_0x3a42('0x45')](_0x57984d[_0x3a42('0x49')],_0x57984d[_0x3a42('0x42')]);_0x33b68c['attributes']=_[_0x3a42('0x45')](_0x57984d[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x3d7480[_0x3a42('0x42')]['fields']));_0x33b68c[_0x3a42('0x46')]=_0x33b68c['attributes'][_0x3a42('0x48')]?_0x33b68c[_0x3a42('0x46')]:_0x57984d[_0x3a42('0x49')];_0x33b68c['order']=qs[_0x3a42('0x4c')](_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x33b68c[_0x3a42('0x4d')]=qs['filters'](_['pick'](_0x3d7480[_0x3a42('0x42')],_0x57984d[_0x3a42('0x44')]));if(_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x33b68c[_0x3a42('0x4d')]=_['merge'](_0x33b68c[_0x3a42('0x4d')],{'$or':_['map'](_0x33b68c[_0x3a42('0x46')],function(_0x25744e){var _0x5457d1={};_0x5457d1[_0x25744e]={'$like':'%'+_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x5457d1;})});}_0x33b68c=_[_0x3a42('0x53')]({},_0x33b68c,_0x3d7480[_0x3a42('0x54')]);return _0x1cb329[_0x3a42('0xb0')](_0x33b68c);}})['then'](function(_0x479c7d){if(_0x479c7d){_0x3333f8=_0x479c7d[_0x3a42('0x48')];if(!_0x3d7480['query']['hasOwnProperty']('nolimit')){_0x33b68c[_0x3a42('0x33')]=qs['limit'](_0x3d7480[_0x3a42('0x42')][_0x3a42('0x33')]);_0x33b68c[_0x3a42('0x31')]=qs[_0x3a42('0x31')](_0x3d7480[_0x3a42('0x42')]['offset']);}return _0x1cb329[_0x3a42('0xb0')](_0x33b68c);}})[_0x3a42('0x21')](function(_0x18388c){if(_0x18388c){return _0x18388c?{'count':_0x3333f8,'rows':_0x18388c}:null;}})[_0x3a42('0x21')](respondWithResult(_0x47d5ed,null))[_0x3a42('0x2c')](handleError(_0x47d5ed,null));};exports[_0x3a42('0xb1')]=function(_0x334fd3,_0x1cd28f,_0x168e97){var _0x5d9503={'raw':![],'where':{}};var _0x9d843d={};var _0x2f5183={'count':0x0,'rows':[]};return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x334fd3['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x1cd28f,null))['then'](function(_0x13d076){if(_0x13d076){_0x9d843d[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x94')][_0x3a42('0x40')]);_0x9d843d[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x334fd3[_0x3a42('0x42')]);_0x9d843d[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x9d843d[_0x3a42('0x49')],_0x9d843d[_0x3a42('0x42')]);_0x5d9503[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x9d843d[_0x3a42('0x49')],qs['fields'](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x47')]));_0x5d9503[_0x3a42('0x46')]=_0x5d9503[_0x3a42('0x46')][_0x3a42('0x48')]?_0x5d9503['attributes']:_0x9d843d[_0x3a42('0x49')];if(!_0x334fd3[_0x3a42('0x42')][_0x3a42('0x4a')](_0x3a42('0x6c'))){_0x5d9503['limit']=qs[_0x3a42('0x33')](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x33')]);_0x5d9503['offset']=qs['offset'](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x31')]);}_0x5d9503[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x334fd3[_0x3a42('0x42')]['sort']);_0x5d9503[_0x3a42('0x4d')]=qs[_0x3a42('0x44')](_['pick'](_0x334fd3[_0x3a42('0x42')],_0x9d843d['filters']));_0x5d9503[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x13d076['id'];if(_0x334fd3['query'][_0x3a42('0x4f')]){_0x5d9503[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x5d9503[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x5d9503[_0x3a42('0x46')],function(_0x9211){var _0x3c4f6b={};_0x3c4f6b[_0x9211]={'$like':'%'+_0x334fd3[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x3c4f6b;})});}_0x5d9503=_['merge']({},_0x5d9503,_0x334fd3[_0x3a42('0x54')]);return db[_0x3a42('0x94')][_0x3a42('0x34')]({'where':_0x5d9503[_0x3a42('0x4d')]})[_0x3a42('0x21')](function(_0x113bfc){_0x2f5183[_0x3a42('0x34')]=_0x113bfc;if(_0x334fd3[_0x3a42('0x42')][_0x3a42('0x56')]){_0x5d9503[_0x3a42('0x57')]=[{'model':db[_0x3a42('0x76')],'as':_0x3a42('0xb2'),'required':![]},{'model':db[_0x3a42('0x9f')],'as':_0x3a42('0xb3'),'attributes':[_0x3a42('0x3d'),_0x3a42('0xb4'),'internal'],'required':![]},{'model':db[_0x3a42('0xb5')],'as':_0x3a42('0xb6'),'attributes':['id',_0x3a42('0x3d'),'color'],'where':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]?{'id':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]}:undefined,'required':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]?!![]:![]}];}return db[_0x3a42('0x94')][_0x3a42('0x58')](_0x5d9503);})[_0x3a42('0x21')](function(_0xe62af3){_0x2f5183['rows']=_0xe62af3;return _0x2f5183;});}})['then'](respondWithFilteredResult(_0x1cd28f,_0x5d9503))[_0x3a42('0x2c')](handleError(_0x1cd28f,null));};exports[_0x3a42('0xb8')]=function(_0x152354,_0x1cb326,_0x3f460a){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x152354['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x1cb326,null))[_0x3a42('0x21')](function(_0x3b75f5){if(_0x3b75f5){return _0x3b75f5[_0x3a42('0xb8')](_0x152354['body'][_0x3a42('0x6f')],_[_0x3a42('0xb9')](_0x152354['body'],[_0x3a42('0x6f'),'id'])||{})[_0x3a42('0x95')](function(_0x4264b9){for(var _0x22082b=0x0;_0x22082b<_0x152354['body']['ids']['length'];_0x22082b+=0x1){socket[_0x3a42('0xba')](_0x3a42('0xbb'),{'UserId':Number(_0x152354[_0x3a42('0x5e')][_0x3a42('0x6f')][_0x22082b]),'OpenchannelAccountId':Number(_0x152354[_0x3a42('0x67')]['id'])});}return _0x4264b9;});}})[_0x3a42('0x21')](respondWithResult(_0x1cb326,null))[_0x3a42('0x2c')](handleError(_0x1cb326,null));};exports[_0x3a42('0xbc')]=function(_0x372f61,_0x355de9,_0x1fbffe){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x372f61[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x355de9,null))['then'](function(_0x5a076d){if(_0x5a076d){return _0x5a076d[_0x3a42('0xbc')](_0x372f61['query'][_0x3a42('0x6f')])['then'](function(){if(_[_0x3a42('0xbd')](_0x372f61[_0x3a42('0x42')][_0x3a42('0x6f')])){for(var _0x2f2902=0x0;_0x2f2902<_0x372f61[_0x3a42('0x42')][_0x3a42('0x6f')][_0x3a42('0x48')];_0x2f2902+=0x1){socket['emit'](_0x3a42('0xbe'),{'UserId':Number(_0x372f61[_0x3a42('0x42')]['ids'][_0x2f2902]),'OpenchannelAccountId':Number(_0x372f61[_0x3a42('0x67')]['id'])});}}else{socket[_0x3a42('0xba')](_0x3a42('0xbe'),{'UserId':Number(_0x372f61['query'][_0x3a42('0x6f')]),'OpenchannelAccountId':Number(_0x372f61['params']['id'])});}});}})[_0x3a42('0x21')](respondWithStatusCode(_0x355de9,null))[_0x3a42('0x2c')](handleError(_0x355de9,null));};exports['getAgents']=function(_0x58b777,_0x5815e5,_0x348df3){var _0x172ae2={};var _0x478936={};var _0x5b09cf;var _0xfd5dd9;return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x58b777[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x5815e5,null))['then'](function(_0x372c70){if(_0x372c70){_0x5b09cf=_0x372c70;_0x478936[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x9f')][_0x3a42('0x40')]);_0x478936['query']=_['keys'](_0x58b777[_0x3a42('0x42')]);_0x478936[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x478936[_0x3a42('0x49')],_0x478936['query']);_0x172ae2[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x478936['model'],qs[_0x3a42('0x47')](_0x58b777[_0x3a42('0x42')]['fields']));_0x172ae2['attributes']=_0x172ae2['attributes'][_0x3a42('0x48')]?_0x172ae2[_0x3a42('0x46')]:_0x478936['model'];_0x172ae2[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x58b777[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x172ae2['where']=qs[_0x3a42('0x44')](_['pick'](_0x58b777['query'],_0x478936[_0x3a42('0x44')]));if(_0x58b777['query'][_0x3a42('0x4f')]){_0x172ae2[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x172ae2[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x172ae2[_0x3a42('0x46')],function(_0x1c2f79){var _0x5029d1={};_0x5029d1[_0x1c2f79]={'$like':'%'+_0x58b777[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x5029d1;})});}_0x172ae2=_['merge']({},_0x172ae2,_0x58b777[_0x3a42('0x54')]);return _0x5b09cf[_0x3a42('0xbf')](_0x172ae2);}})[_0x3a42('0x21')](function(_0x5ec9d2){if(_0x5ec9d2){_0xfd5dd9=_0x5ec9d2[_0x3a42('0x48')];if(!_0x58b777[_0x3a42('0x42')][_0x3a42('0x4a')]('nolimit')){_0x172ae2[_0x3a42('0x33')]=qs[_0x3a42('0x33')](_0x58b777[_0x3a42('0x42')][_0x3a42('0x33')]);_0x172ae2[_0x3a42('0x31')]=qs['offset'](_0x58b777['query'][_0x3a42('0x31')]);}return _0x5b09cf[_0x3a42('0xbf')](_0x172ae2);}})[_0x3a42('0x21')](function(_0x177728){if(_0x177728){return _0x177728?{'count':_0xfd5dd9,'rows':_0x177728}:null;}})[_0x3a42('0x21')](respondWithResult(_0x5815e5,null))[_0x3a42('0x2c')](handleError(_0x5815e5,null));};exports[_0x3a42('0xaf')]=function(_0x4edfd2,_0x5300ad,_0x14b1c2){var _0x164807,_0x61ee94,_0x3b83af;if(_[_0x3a42('0x7f')](_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')])||_0x4edfd2[_0x3a42('0x5e')]['body']===''){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x82'));}if(_[_0x3a42('0x7f')](_0x4edfd2[_0x3a42('0x5e')]['to'])){}_0x164807=_0x4edfd2[_0x3a42('0x5e')]['to'];return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x4edfd2[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x22175f){if(_0x22175f){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x22175f['id']},'include':[{'model':db[_0x3a42('0x86')],'as':_0x3a42('0x88'),'include':[{'model':db[_0x3a42('0x76')],'as':_0x3a42('0x8d'),'where':{[_0x22175f[_0x3a42('0x83')]]:_0x164807},'limit':0x1,'order':[[_0x3a42('0x7c'),_0x3a42('0xc0')]]}]}]})[_0x3a42('0x21')](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x3c0e05){if(_0x3c0e05&&_0x3c0e05[_0x3a42('0x88')]){_0x61ee94=_0x3c0e05['get']({'plain':!![]});if(_0x61ee94[_0x3a42('0x88')]&&_0x61ee94[_0x3a42('0x88')][_0x3a42('0x8d')][_0x3a42('0x48')]){return _0x61ee94[_0x3a42('0x88')]['Contacts'][0x0];}return db[_0x3a42('0x76')][_0x3a42('0x5d')](_[_0x3a42('0x8e')](_0x4edfd2['body'],{'firstName':_0x164807,[_0x3c0e05[_0x3a42('0x83')]]:_0x164807,'phone':_0x164807,'ListId':_0x61ee94[_0x3a42('0x7e')]}));}})[_0x3a42('0x21')](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x55a346){if(_0x55a346){_0x3b83af=_0x55a346;return db[_0x3a42('0x94')][_0x3a42('0x5c')]({'where':{'ContactId':_0x3b83af['id'],'closed':![],'OpenchannelAccountId':_0x61ee94['id']}})['then'](function(_0x206acd){if(_0x206acd){return[_0x206acd,![]];}return db[_0x3a42('0x94')][_0x3a42('0x5d')]({'UserId':_0x4edfd2['user']['id'],'ContactId':_0x3b83af['id'],'OpenchannelAccountId':_0x61ee94['id'],'lastMsgDirection':_0x3a42('0xc1'),'firstMsgDirection':'out','Messages':[_['merge'](_0x4edfd2['body'],{'read':![],'body':_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')],'OpenchannelAccountId':_0x61ee94['id'],'UserId':_0x4edfd2[_0x3a42('0x61')]['id'],'ContactId':_0x3b83af['id']})]},{'include':[{'model':db[_0x3a42('0x9c')],'as':'Messages'}]})[_0x3a42('0x21')](function(_0x331c29){return[_0x331c29,!![]];});});}})[_0x3a42('0x95')](function(_0x3acec4,_0x200d8e){if(_0x200d8e){return _0x3acec4;}return db[_0x3a42('0x9c')][_0x3a42('0x5d')](_['merge'](_0x4edfd2[_0x3a42('0x5e')],{'read':![],'body':_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')],'OpenchannelAccountId':_0x61ee94['id'],'OpenchannelInteractionId':_0x3acec4['id'],'UserId':_0x4edfd2['user']['id'],'ContactId':_0x3b83af['id']}))[_0x3a42('0x21')](function(_0x2322be){_0x3acec4[_0x3a42('0xc2')][_0x3a42('0xc3')]=[];_0x3acec4[_0x3a42('0xc2')][_0x3a42('0xc3')][_0x3a42('0x9a')](_0x2322be['dataValues']);return _0x3acec4;});});}})[_0x3a42('0x21')](respondWithResult(_0x5300ad,null))[_0x3a42('0x2c')](handleError(_0x5300ad,null));}; \ No newline at end of file +var _0x483f=['addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','ValidationError','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','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','push','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','rows','params','include','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x483f,0x11c));var _0xf483=function(_0x27b309,_0x217d6a){_0x27b309=_0x27b309-0x0;var _0x6a712=_0x483f[_0x27b309];return _0x6a712;};'use strict';var emlformat=require(_0xf483('0x0'));var rimraf=require(_0xf483('0x1'));var zipdir=require(_0xf483('0x2'));var jsonpatch=require(_0xf483('0x3'));var rp=require(_0xf483('0x4'));var moment=require(_0xf483('0x5'));var BPromise=require(_0xf483('0x6'));var Mustache=require(_0xf483('0x7'));var util=require(_0xf483('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf483('0x9'));var fs=require('fs');var fs_extra=require(_0xf483('0xa'));var _=require(_0xf483('0xb'));var squel=require(_0xf483('0xc'));var crypto=require(_0xf483('0xd'));var jsforce=require(_0xf483('0xe'));var deskjs=require(_0xf483('0xf'));var toCsv=require(_0xf483('0x10'));var querystring=require('querystring');var Papa=require(_0xf483('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf483('0x12'));var as=require(_0xf483('0x13'));var hardwareService=require(_0xf483('0x14'));var logger=require(_0xf483('0x15'))('api');var utils=require(_0xf483('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf483('0x17'));var db=require(_0xf483('0x18'))['db'];config['redis']=_[_0xf483('0x19')](config[_0xf483('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf483('0x1a')]));require(_0xf483('0x1b'))[_0xf483('0x1c')](socket);var jayson=require(_0xf483('0x1d'));var client=jayson[_0xf483('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf483('0x1e')][_0xf483('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x48ee49,_0x14811d,_0x325472,_0x209bf0){return new BPromise(function(_0xaaab8f,_0xc1c541){var _0x355f6a=_0x209bf0||client;return _0x355f6a[_0xf483('0x20')](_0x48ee49,_0x325472)[_0xf483('0x21')](function(_0x4a2b19){logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14811d,_0xf483('0x24'),JSON[_0xf483('0x25')](_0x4a2b19));if(_0x4a2b19[_0xf483('0x26')]){if(_0x4a2b19['error'][_0xf483('0x27')]===0x1f4){logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')]['message']);return _0xc1c541(_0x4a2b19[_0xf483('0x26')]['message']);}logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);return _0xaaab8f(_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);}else{logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));_0xaaab8f(_0x4a2b19['result'][_0xf483('0x28')]);}})[_0xf483('0x29')](function(_0x50932d){logger[_0xf483('0x26')](_0xf483('0x23'),_0x14811d,_0x50932d);_0xc1c541(_0x50932d);});});}function respondWithStatusCode(_0x514811,_0x2188ff){_0x2188ff=_0x2188ff||0xcc;return function(_0xfb138e){if(_0xfb138e){return _0x514811['sendStatus'](_0x2188ff);}return _0x514811[_0xf483('0x2a')](_0x2188ff)[_0xf483('0x2b')]();};}function respondWithResult(_0x2ac32d,_0x49147f){_0x49147f=_0x49147f||0xc8;return function(_0x1c6000){if(_0x1c6000){return _0x2ac32d['status'](_0x49147f)[_0xf483('0x2c')](_0x1c6000);}};}function respondWithFilteredResult(_0x202eab,_0x38d1eb){return function(_0x2c00d6){if(_0x2c00d6){var _0x2afaf6=typeof _0x38d1eb['offset']===_0xf483('0x2d')&&typeof _0x38d1eb[_0xf483('0x2e')]===_0xf483('0x2d');var _0x40c76f=_0x2c00d6[_0xf483('0x2f')];var _0x12498b=_0x2afaf6?0x0:_0x38d1eb[_0xf483('0x30')];var _0x2ed65b=_0x2afaf6?_0x2c00d6[_0xf483('0x2f')]:_0x38d1eb[_0xf483('0x30')]+_0x38d1eb[_0xf483('0x2e')];var _0x2f369f;if(_0x2ed65b>=_0x40c76f){_0x2ed65b=_0x40c76f;_0x2f369f=0xc8;}else{_0x2f369f=0xce;}_0x202eab[_0xf483('0x2a')](_0x2f369f);return _0x202eab['set'](_0xf483('0x31'),_0x12498b+'-'+_0x2ed65b+'/'+_0x40c76f)[_0xf483('0x2c')](_0x2c00d6);}return null;};}function patchUpdates(_0x397b60){return function(_0x18711a){try{jsonpatch[_0xf483('0x32')](_0x18711a,_0x397b60,!![]);}catch(_0x32bc2a){return BPromise['reject'](_0x32bc2a);}return _0x18711a[_0xf483('0x33')]();};}function saveUpdates(_0x493866,_0x280aca){return function(_0x3f6471){if(_0x3f6471){return _0x3f6471[_0xf483('0x34')](_0x493866)[_0xf483('0x21')](function(_0x5b6edb){return _0x5b6edb;});}return null;};}function removeEntity(_0x573bd3,_0x5e594e){return function(_0x277c3f){if(_0x277c3f){return _0x277c3f['destroy']()[_0xf483('0x21')](function(){var _0x2e3444=_0x277c3f['get']({'plain':!![]});var _0x57879a='OpenchannelAccounts';return db[_0xf483('0x35')][_0xf483('0x36')]({'where':{'type':_0x57879a,'resourceId':_0x2e3444['id']}})[_0xf483('0x21')](function(){return _0x277c3f;});})[_0xf483('0x21')](function(){_0x573bd3[_0xf483('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1118c6,_0x56ad00){return function(_0x53c3d9){if(!_0x53c3d9){_0x1118c6[_0xf483('0x37')](0x194);}return _0x53c3d9;};}function handleError(_0x1a71dc,_0x4a8f45){_0x4a8f45=_0x4a8f45||0x1f4;return function(_0x58c5dd){logger[_0xf483('0x26')](_0x58c5dd[_0xf483('0x38')]);if(_0x58c5dd[_0xf483('0x39')]){delete _0x58c5dd['name'];}_0x1a71dc['status'](_0x4a8f45)[_0xf483('0x3a')](_0x58c5dd);};}exports[_0xf483('0x3b')]=function(_0x364502,_0x28649b){var _0xd834da={'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x5d1432={},_0x1044e9={'count':0x0,'rows':[]};var _0x42fd62=_['map'](db[_0xf483('0x3e')][_0xf483('0x3f')],function(_0xa5e99d){return{'name':_0xa5e99d[_0xf483('0x40')],'type':_0xa5e99d[_0xf483('0x41')][_0xf483('0x42')]};});_0x5d1432[_0xf483('0x43')]=_[_0xf483('0x44')](_0x42fd62,_0xf483('0x39'));_0x5d1432['query']=_[_0xf483('0x45')](_0x364502[_0xf483('0x46')]);_0x5d1432[_0xf483('0x47')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],_0x5d1432[_0xf483('0x46')]);_0xd834da[_0xf483('0x49')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],qs['fields'](_0x364502[_0xf483('0x46')][_0xf483('0x4a')]));_0xd834da['attributes']=_0xd834da[_0xf483('0x49')][_0xf483('0x4b')]?_0xd834da[_0xf483('0x49')]:_0x5d1432[_0xf483('0x43')];if(!_0x364502[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0xd834da[_0xf483('0x2e')]=qs['limit'](_0x364502[_0xf483('0x46')]['limit']);_0xd834da[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x364502[_0xf483('0x46')]['offset']);}_0xd834da[_0xf483('0x4d')]=qs['sort'](_0x364502['query'][_0xf483('0x4e')]);_0xd834da['where']=qs[_0xf483('0x47')](_[_0xf483('0x4f')](_0x364502[_0xf483('0x46')],_0x5d1432[_0xf483('0x47')]),_0x42fd62);if(_0x364502[_0xf483('0x46')][_0xf483('0x50')]){_0xd834da['where']=_['merge'](_0xd834da['where'],{'$or':_[_0xf483('0x44')](_0x42fd62,function(_0x447953){if(_0x447953[_0xf483('0x41')]!==_0xf483('0x51')){var _0x53a42b={};_0x53a42b[_0x447953[_0xf483('0x39')]]={'$like':'%'+_0x364502[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x53a42b;}})});}_0xd834da=_['merge']({},_0xd834da,_0x364502[_0xf483('0x52')]);var _0x588f53={'where':_0xd834da[_0xf483('0x53')]};return db[_0xf483('0x3e')][_0xf483('0x2f')](_0x588f53)[_0xf483('0x21')](function(_0x2da7d0){_0x1044e9[_0xf483('0x2f')]=_0x2da7d0;if(_0x364502[_0xf483('0x46')][_0xf483('0x54')]){_0xd834da['include']=[{'all':!![]}];}return db[_0xf483('0x3e')][_0xf483('0x55')](_0xd834da);})[_0xf483('0x21')](function(_0x11b1b6){_0x1044e9[_0xf483('0x56')]=_0x11b1b6;return _0x1044e9;})[_0xf483('0x21')](respondWithFilteredResult(_0x28649b,_0xd834da))[_0xf483('0x29')](handleError(_0x28649b,null));};exports['show']=function(_0x18712c,_0x5ae641){var _0x326e0a={'raw':![],'where':{'id':_0x18712c[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x599c1d={};_0x599c1d[_0xf483('0x43')]=_[_0xf483('0x45')](db['OpenchannelAccount'][_0xf483('0x3f')]);_0x599c1d['query']=_[_0xf483('0x45')](_0x18712c['query']);_0x599c1d['filters']=_['intersection'](_0x599c1d[_0xf483('0x43')],_0x599c1d[_0xf483('0x46')]);_0x326e0a['attributes']=_['intersection'](_0x599c1d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x18712c['query'][_0xf483('0x4a')]));_0x326e0a[_0xf483('0x49')]=_0x326e0a[_0xf483('0x49')]['length']?_0x326e0a[_0xf483('0x49')]:_0x599c1d[_0xf483('0x43')];if(_0x18712c[_0xf483('0x46')][_0xf483('0x54')]){_0x326e0a[_0xf483('0x58')]=[{'all':!![]}];}_0x326e0a=_[_0xf483('0x59')]({},_0x326e0a,_0x18712c['options']);return db['OpenchannelAccount'][_0xf483('0x5a')](_0x326e0a)['then'](handleEntityNotFound(_0x5ae641,null))[_0xf483('0x21')](respondWithResult(_0x5ae641,null))[_0xf483('0x29')](handleError(_0x5ae641,null));};exports[_0xf483('0x5b')]=function(_0x57bf0b,_0x1265eb){return db[_0xf483('0x3e')][_0xf483('0x5b')](_0x57bf0b[_0xf483('0x5c')],{})['then'](function(_0x56af15){var _0x1bdea3=_0x57bf0b[_0xf483('0x5d')][_0xf483('0x5e')]({'plain':!![]});if(!_0x1bdea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bdea3[_0xf483('0x5f')]===_0xf483('0x5d')){var _0x4df340=_0x56af15[_0xf483('0x5e')]({'plain':!![]});var _0x5784e0='OpenchannelAccounts';return db[_0xf483('0x60')][_0xf483('0x5a')]({'where':{'name':_0x5784e0,'userProfileId':_0x1bdea3[_0xf483('0x61')]},'raw':!![]})[_0xf483('0x21')](function(_0x597c3c){if(_0x597c3c&&_0x597c3c[_0xf483('0x62')]===0x0){return db[_0xf483('0x35')][_0xf483('0x5b')]({'name':_0x4df340[_0xf483('0x39')],'resourceId':_0x4df340['id'],'type':_0x597c3c[_0xf483('0x39')],'sectionId':_0x597c3c['id']},{})['then'](function(){return _0x56af15;});}else{return _0x56af15;}})[_0xf483('0x29')](function(_0x3d3647){logger[_0xf483('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3647);throw _0x3d3647;});}return _0x56af15;})['then'](respondWithResult(_0x1265eb,0xc9))[_0xf483('0x29')](handleError(_0x1265eb,null));};exports['update']=function(_0x22af15,_0x4d0754){if(_0x22af15['body']['id']){delete _0x22af15[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x22af15[_0xf483('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xf483('0x21')](handleEntityNotFound(_0x4d0754,null))[_0xf483('0x21')](saveUpdates(_0x22af15['body'],null))[_0xf483('0x21')](respondWithResult(_0x4d0754,null))['catch'](handleError(_0x4d0754,null));};exports[_0xf483('0x36')]=function(_0x5256f6,_0x34efd1){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5256f6[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x34efd1,null))[_0xf483('0x21')](removeEntity(_0x34efd1,null))[_0xf483('0x29')](handleError(_0x34efd1,null));};exports[_0xf483('0x63')]=function(_0x5140f8,_0x2e0b5c){return db['OpenchannelAccount']['describe']()[_0xf483('0x21')](respondWithResult(_0x2e0b5c,null))[_0xf483('0x29')](handleError(_0x2e0b5c,null));};exports[_0xf483('0x64')]=function(_0x4fcf38,_0x4d7b3a,_0xbb1a0d){if(_0x4fcf38[_0xf483('0x5c')]['id']){delete _0x4fcf38[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x4fcf38['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x4d7b3a,null))[_0xf483('0x21')](function(_0x46fe47){if(_0x46fe47){_0x4fcf38['body'][_0xf483('0x65')]=_0x46fe47['id'];return db[_0xf483('0x66')][_0xf483('0x5b')](_0x4fcf38[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x4d7b3a,null))[_0xf483('0x29')](handleError(_0x4d7b3a,null));};exports['getDispositions']=function(_0x4abf56,_0xaaffdd,_0x294ffa){var _0x55a5de={'raw':![],'where':{}};var _0x8f2281={};var _0x1bebd9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x4abf56['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xaaffdd,null))['then'](function(_0x47b886){if(_0x47b886){_0x8f2281[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x66')][_0xf483('0x3f')]);_0x8f2281[_0xf483('0x46')]=_[_0xf483('0x45')](_0x4abf56[_0xf483('0x46')]);_0x8f2281[_0xf483('0x47')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],_0x8f2281[_0xf483('0x46')]);_0x55a5de[_0xf483('0x49')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4a')]));_0x55a5de['attributes']=_0x55a5de[_0xf483('0x49')][_0xf483('0x4b')]?_0x55a5de[_0xf483('0x49')]:_0x8f2281[_0xf483('0x43')];if(!_0x4abf56[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x55a5de['limit']=qs[_0xf483('0x2e')](_0x4abf56['query'][_0xf483('0x2e')]);_0x55a5de[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x4abf56[_0xf483('0x46')]['offset']);}_0x55a5de[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4e')]);_0x55a5de[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4abf56['query'],_0x8f2281[_0xf483('0x47')]));_0x55a5de['where'][_0xf483('0x65')]=_0x47b886['id'];if(_0x4abf56[_0xf483('0x46')]['filter']){_0x55a5de[_0xf483('0x53')]=_[_0xf483('0x59')](_0x55a5de[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x55a5de[_0xf483('0x49')],function(_0x4e96ce){var _0x4d691c={};_0x4d691c[_0x4e96ce]={'$like':'%'+_0x4abf56['query'][_0xf483('0x50')]+'%'};return _0x4d691c;})});}_0x55a5de=_[_0xf483('0x59')]({},_0x55a5de,_0x4abf56[_0xf483('0x52')]);return db[_0xf483('0x66')][_0xf483('0x2f')]({'where':_0x55a5de[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x357ed1){_0x1bebd9[_0xf483('0x2f')]=_0x357ed1;if(_0x4abf56[_0xf483('0x46')][_0xf483('0x54')]){_0x55a5de['include']=[{'all':!![]}];}return db[_0xf483('0x66')]['findAll'](_0x55a5de);})[_0xf483('0x21')](function(_0x3545b8){_0x1bebd9[_0xf483('0x56')]=_0x3545b8;return _0x1bebd9;});}})[_0xf483('0x21')](respondWithFilteredResult(_0xaaffdd,_0x55a5de))['catch'](handleError(_0xaaffdd,null));};exports['removeDispositions']=function(_0x8b7a73,_0x358b51,_0x2830bb){return db[_0xf483('0x3e')]['find']({'where':{'id':_0x8b7a73[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x358b51,null))[_0xf483('0x21')](function(_0x1357fc){if(_0x1357fc){return _0x1357fc[_0xf483('0x69')](_0x8b7a73[_0xf483('0x46')][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x358b51,null))[_0xf483('0x29')](handleError(_0x358b51,null));};exports[_0xf483('0x6b')]=function(_0x3a2da2,_0x45142f,_0x5260b6){if(_0x3a2da2['body']['id']){delete _0x3a2da2['body']['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x3a2da2[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x45142f,null))['then'](function(_0x497e1d){if(_0x497e1d){_0x3a2da2[_0xf483('0x5c')][_0xf483('0x65')]=_0x497e1d['id'];return db[_0xf483('0x6c')][_0xf483('0x5b')](_0x3a2da2[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x45142f,null))[_0xf483('0x29')](handleError(_0x45142f,null));};exports['getAnswers']=function(_0x46bf77,_0x3590a9,_0x3a350d){var _0x25d9ee={'raw':![],'where':{}};var _0x13d70b={};var _0x4bbf7a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x46bf77['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x3590a9,null))[_0xf483('0x21')](function(_0x20ab3e){if(_0x20ab3e){_0x13d70b[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x6c')][_0xf483('0x3f')]);_0x13d70b['query']=_[_0xf483('0x45')](_0x46bf77[_0xf483('0x46')]);_0x13d70b[_0xf483('0x47')]=_['intersection'](_0x13d70b[_0xf483('0x43')],_0x13d70b['query']);_0x25d9ee['attributes']=_[_0xf483('0x48')](_0x13d70b['model'],qs[_0xf483('0x4a')](_0x46bf77[_0xf483('0x46')]['fields']));_0x25d9ee[_0xf483('0x49')]=_0x25d9ee[_0xf483('0x49')][_0xf483('0x4b')]?_0x25d9ee[_0xf483('0x49')]:_0x13d70b['model'];if(!_0x46bf77[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0x25d9ee['limit']=qs['limit'](_0x46bf77[_0xf483('0x46')]['limit']);_0x25d9ee[_0xf483('0x30')]=qs['offset'](_0x46bf77[_0xf483('0x46')][_0xf483('0x30')]);}_0x25d9ee[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x46bf77[_0xf483('0x46')][_0xf483('0x4e')]);_0x25d9ee[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x46bf77['query'],_0x13d70b[_0xf483('0x47')]));_0x25d9ee['where'][_0xf483('0x65')]=_0x20ab3e['id'];if(_0x46bf77['query'][_0xf483('0x50')]){_0x25d9ee[_0xf483('0x53')]=_[_0xf483('0x59')](_0x25d9ee[_0xf483('0x53')],{'$or':_['map'](_0x25d9ee[_0xf483('0x49')],function(_0x8e6ee4){var _0x102293={};_0x102293[_0x8e6ee4]={'$like':'%'+_0x46bf77[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x102293;})});}_0x25d9ee=_[_0xf483('0x59')]({},_0x25d9ee,_0x46bf77[_0xf483('0x52')]);return db['CannedAnswer'][_0xf483('0x2f')]({'where':_0x25d9ee[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x13ee77){_0x4bbf7a[_0xf483('0x2f')]=_0x13ee77;if(_0x46bf77[_0xf483('0x46')][_0xf483('0x54')]){_0x25d9ee[_0xf483('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf483('0x55')](_0x25d9ee);})['then'](function(_0x50ec3b){_0x4bbf7a['rows']=_0x50ec3b;return _0x4bbf7a;});}})['then'](respondWithFilteredResult(_0x3590a9,_0x25d9ee))['catch'](handleError(_0x3590a9,null));};exports[_0xf483('0x6d')]=function(_0x56a60b,_0x26d567,_0x5f568e){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x56a60b[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x26d567,null))['then'](function(_0x227278){if(_0x227278){return _0x227278[_0xf483('0x6d')](_0x56a60b['query'][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x26d567,null))[_0xf483('0x29')](handleError(_0x26d567,null));};exports[_0xf483('0x6e')]=function(_0x5c1e07,_0x509a47,_0x57a2c4){var _0x5e6b42={'body':_0x5c1e07['body'],'channel':_0xf483('0x6f')};var _0x5ba4af=[];var _0x4b964b=[];var _0x2e8034={};var _0x3800a7=![];return db[_0xf483('0x70')][_0xf483('0x63')]()[_0xf483('0x21')](function(_0x435881){if(!_0x435881){throw new db[(_0xf483('0x71'))]['ValidationError'](_0xf483('0x72'));}_0x5ba4af=_[_0xf483('0x73')](_[_0xf483('0x45')](_0x435881),[_0xf483('0x74'),_0xf483('0x75')]);_0x4b964b=_['difference'](_[_0xf483('0x45')](_0x435881),['createdAt','updatedAt',_0xf483('0x76'),_0xf483('0x77')]);if(_0x5c1e07[_0xf483('0x5c')]['id']){delete _0x5c1e07[_0xf483('0x5c')]['id'];}if(_['isNil'](_0x5c1e07[_0xf483('0x5c')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf483('0x78'));}if(_[_0xf483('0x79')](_0x5c1e07['body']['body'])||_0x5c1e07[_0xf483('0x5c')]['body']===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7b'));}if(_[_0xf483('0x79')](_0x5c1e07[_0xf483('0x5c')]['mapKey'])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7c')+_0x4b964b);}if(!_[_0xf483('0x7d')](_0x4b964b,_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7f')+_0x4b964b);}_0x2e8034[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];})[_0xf483('0x21')](function(){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5c1e07[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x81')],'as':_0xf483('0x82'),'include':[{'model':db['CmContact'],'as':_0xf483('0x83'),'where':_0x2e8034,'limit':0x1,'order':[[_0xf483('0x75'),_0xf483('0x84')]]}]},{'model':db[_0xf483('0x85')],'as':_0xf483('0x86')}]});})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))['then'](function(_0x25afda){if(_0x25afda&&_0x25afda[_0xf483('0x82')]){_0x5e6b42[_0xf483('0x87')]=_0x25afda;_0x5e6b42[_0xf483('0x88')]=_0x25afda[_0xf483('0x86')];_0x5e6b42[_0xf483('0x89')]=_0x25afda[_0xf483('0x82')];_0x5e6b42[_0xf483('0x88')]=_['orderBy'](_0x5e6b42[_0xf483('0x88')],[_0xf483('0x8a')],[_0xf483('0x8b')]);if(_0x5e6b42['account'][_0xf483('0x86')]){delete _0x5e6b42['account']['Applications'];}if(_0x5e6b42['account'][_0xf483('0x82')]&&_0x5e6b42[_0xf483('0x87')][_0xf483('0x82')][_0xf483('0x83')][_0xf483('0x4b')]){return _0x5e6b42['account'][_0xf483('0x82')][_0xf483('0x83')][0x0];}var _0x310ec6=_['defaults'](_0x5c1e07[_0xf483('0x5c')],{'firstName':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')],'ListId':_0x25afda[_0xf483('0x77')]});_0x310ec6[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];return db[_0xf483('0x70')][_0xf483('0x5b')](_0x310ec6,{'fields':_0x5ba4af,'raw':!![]});}})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))[_0xf483('0x21')](function(_0x3ef26d){_0x5e6b42[_0xf483('0x8c')]=_0x3ef26d;if(_0x3ef26d){var _0x3e1b97={'ContactId':_0x3ef26d['id'],'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'from':(_0x3ef26d[_0xf483('0x8d')]||'')+'\x20'+(_0x3ef26d[_0xf483('0x8e')]||'')};var _0x127594={'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'closed':![]};if(_0x5c1e07[_0xf483('0x5c')]['threadId']){_0x127594[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')]['threadId'];return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0xf564f1){if(_0xf564f1){return[_0xf564f1,![]];}_0x3e1b97['threadId']=_0x5c1e07['body'][_0xf483('0x8f')];_0x3e1b97['externalUrl']=_0x5c1e07[_0xf483('0x5c')]['externalUrl'];return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x4339b0){return[_0x4339b0,!![]];});});}else{_0x127594[_0xf483('0x8f')]=null;}_0x127594[_0xf483('0x91')]=_0x3ef26d['id'];return db['OpenchannelInteraction'][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0x3dec20){if(_0x3dec20){return[_0x3dec20,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x52c775){return[_0x52c775,!![]];});});}})['spread'](function(_0x4df7b2,_0x1caf13){if(_0x4df7b2){_0x3800a7=_0x1caf13;if(!_0x1caf13){var _0x95f359={'from':(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8d')]||'')+'\x20'+(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8e')]||'')};if(_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]!=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]){_0x95f359[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')];}return _0x4df7b2[_0xf483('0x34')](_0x95f359);}else{return _0x4df7b2;}}})['then'](function(_0x21f9e3){_0x5e6b42[_0xf483('0x93')]=_0x21f9e3['get']({'plain':!![]});_0x5e6b42['interaction'][_0xf483('0x94')]=_0x3800a7;if(_0x5e6b42['interaction'][_0xf483('0x94')]){if(_0x5e6b42[_0xf483('0x87')][_0xf483('0x95')]){_0x5e6b42[_0xf483('0x88')]['push']({'id':0x0,'priority':_0x5e6b42['applications'][_0xf483('0x4b')]+0x1,'app':_0xf483('0x96'),'appdata':'unmanaged','interval':_0xf483('0x97')});}}return db[_0xf483('0x98')]['create']({'body':_0x5c1e07[_0xf483('0x5c')]['body'],'OpenchannelAccountId':_0x5c1e07['params']['id'],'OpenchannelInteractionId':_0x21f9e3['id'],'direction':'in','ContactId':_0x5e6b42[_0xf483('0x8c')]['id'],'AttachmentId':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x99')]});})[_0xf483('0x21')](function(_0x57bb82){_0x5e6b42[_0xf483('0x28')]=_0x57bb82;if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9a')])return;return db[_0xf483('0x9b')][_0xf483('0x5a')]({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42['interaction'][_0xf483('0x9a')]}});})[_0xf483('0x21')](function(_0x54b3f5){if(_0x54b3f5){_0x5e6b42['applications'][_0xf483('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54b3f5[_0xf483('0x39')]+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0x9d')]||0xa),'interval':_0xf483('0x97')});}if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9e')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42[_0xf483('0x93')]['queueId']}});})[_0xf483('0x21')](function(_0x568a9a){if(_0x568a9a){_0x5e6b42[_0xf483('0x88')][_0xf483('0x9c')]({'id':0x0,'priority':0x1,'app':_0xf483('0x9f'),'appdata':_0x568a9a['name']+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0xa0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf483('0xa1'),_0xf483('0xa2'),_0x5e6b42);})[_0xf483('0x21')](function(_0x25d0c8){respondWithRpcPromise('EventManager',_0xf483('0xa3'),{'event':_0xf483('0x6e'),'message':_0x25d0c8},client9002);return _0x25d0c8;})[_0xf483('0x21')](respondWithResult(_0x509a47,null))[_0xf483('0x29')](handleError(_0x509a47,null));};exports['addApplications']=function(_0x4a554d,_0x33764f){var _0x4a2fc1=_0x4a554d['params']['id'];var _0x492993=_0x4a554d['body'];var _0x243f38=0xc8;var _0x541732=null;return db[_0xf483('0xa4')][_0xf483('0xa5')]({'isolationLevel':db[_0xf483('0xa4')][_0xf483('0xa6')][_0xf483('0xa7')][_0xf483('0xa8')]},function(_0x4383f0){return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(_0x564809){if(_0x564809){return db[_0xf483('0x85')][_0xf483('0x36')]({'where':{'OpenchannelAccountId':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(){var _0x5b646f=_[_0xf483('0x44')](_0x492993,function(_0x3c50c7){_0x3c50c7[_0xf483('0x65')]=_0x4a2fc1;return _0x3c50c7;});return db[_0xf483('0x85')][_0xf483('0xa9')](_0x5b646f,{'transaction':_0x4383f0});});}else{_0x243f38=0x194;_0x541732=[];}});})[_0xf483('0x21')](function(){if(_0x243f38!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4a2fc1},'order':_0xf483('0x8a')})[_0xf483('0x21')](function(_0x53386d){_0x541732=_0x53386d;});}})['catch'](function(_0x5d429e){_0x243f38=0x1f4;logger[_0xf483('0x26')](_0x5d429e[_0xf483('0x38')]);if(_0x5d429e['name']){delete _0x5d429e['name'];}_0x541732=_0x5d429e;})[_0xf483('0xaa')](function(){if(_0x541732===null){_0x33764f[_0xf483('0x37')](_0x243f38);}else{if(_0x243f38===0x1f4){_0x33764f[_0xf483('0x2a')](_0x243f38)['send'](_0x541732);}else{_0x33764f['status'](_0x243f38)[_0xf483('0x2c')](_0x541732);}}});};exports['getApplications']=function(_0x4942aa,_0x522691,_0x5db014){var _0x86ec2f={};var _0x167c7d={};var _0x1c9768;var _0x40421b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4942aa['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x522691,null))[_0xf483('0x21')](function(_0x5371fe){if(_0x5371fe){_0x1c9768=_0x5371fe;_0x167c7d['model']=_['keys'](db[_0xf483('0x85')][_0xf483('0x3f')]);_0x167c7d[_0xf483('0x46')]=_['keys'](_0x4942aa[_0xf483('0x46')]);_0x167c7d[_0xf483('0x47')]=_[_0xf483('0x48')](_0x167c7d[_0xf483('0x43')],_0x167c7d['query']);_0x86ec2f[_0xf483('0x49')]=_['intersection'](_0x167c7d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4942aa[_0xf483('0x46')][_0xf483('0x4a')]));_0x86ec2f[_0xf483('0x49')]=_0x86ec2f['attributes'][_0xf483('0x4b')]?_0x86ec2f['attributes']:_0x167c7d[_0xf483('0x43')];_0x86ec2f[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4942aa['query']['sort']);_0x86ec2f[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4942aa['query'],_0x167c7d['filters']));if(_0x4942aa['query']['filter']){_0x86ec2f[_0xf483('0x53')]=_['merge'](_0x86ec2f[_0xf483('0x53')],{'$or':_['map'](_0x86ec2f[_0xf483('0x49')],function(_0x4b1605){var _0x17d3c6={};_0x17d3c6[_0x4b1605]={'$like':'%'+_0x4942aa[_0xf483('0x46')]['filter']+'%'};return _0x17d3c6;})});}_0x86ec2f=_['merge']({},_0x86ec2f,_0x4942aa['options']);return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})['then'](function(_0x49a0f2){if(_0x49a0f2){_0x40421b=_0x49a0f2[_0xf483('0x4b')];if(!_0x4942aa[_0xf483('0x46')][_0xf483('0x68')]('nolimit')){_0x86ec2f[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x4942aa[_0xf483('0x46')]['limit']);_0x86ec2f['offset']=qs[_0xf483('0x30')](_0x4942aa[_0xf483('0x46')]['offset']);}return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})[_0xf483('0x21')](function(_0x4fe717){if(_0x4fe717){return _0x4fe717?{'count':_0x40421b,'rows':_0x4fe717}:null;}})['then'](respondWithResult(_0x522691,null))[_0xf483('0x29')](handleError(_0x522691,null));};exports[_0xf483('0xac')]=function(_0x365c76,_0x46052d,_0x7433e3){var _0x263b8a={'raw':![],'where':{}};var _0x25f6d0={};var _0xf5c069={'count':0x0,'rows':[]};return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x365c76[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x46052d,null))[_0xf483('0x21')](function(_0x420eac){if(_0x420eac){_0x25f6d0[_0xf483('0x43')]=_['keys'](db[_0xf483('0x90')]['rawAttributes']);_0x25f6d0[_0xf483('0x46')]=_[_0xf483('0x45')](_0x365c76[_0xf483('0x46')]);_0x25f6d0[_0xf483('0x47')]=_[_0xf483('0x48')](_0x25f6d0['model'],_0x25f6d0[_0xf483('0x46')]);_0x263b8a[_0xf483('0x49')]=_['intersection'](_0x25f6d0[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x365c76['query']['fields']));_0x263b8a[_0xf483('0x49')]=_0x263b8a['attributes'][_0xf483('0x4b')]?_0x263b8a[_0xf483('0x49')]:_0x25f6d0[_0xf483('0x43')];if(!_0x365c76['query'][_0xf483('0x68')](_0xf483('0x4c'))){_0x263b8a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x365c76['query'][_0xf483('0x2e')]);_0x263b8a[_0xf483('0x30')]=qs['offset'](_0x365c76[_0xf483('0x46')][_0xf483('0x30')]);}_0x263b8a[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x365c76[_0xf483('0x46')]['sort']);_0x263b8a['where']=qs['filters'](_[_0xf483('0x4f')](_0x365c76['query'],_0x25f6d0[_0xf483('0x47')]));_0x263b8a['where']['OpenchannelAccountId']=_0x420eac['id'];if(_0x365c76[_0xf483('0x46')]['filter']){_0x263b8a[_0xf483('0x53')]=_[_0xf483('0x59')](_0x263b8a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x263b8a[_0xf483('0x49')],function(_0x374d32){var _0x17186e={};_0x17186e[_0x374d32]={'$like':'%'+_0x365c76[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x17186e;})});}_0x263b8a=_[_0xf483('0x59')]({},_0x263b8a,_0x365c76[_0xf483('0x52')]);return db[_0xf483('0x90')][_0xf483('0x2f')]({'where':_0x263b8a['where']})[_0xf483('0x21')](function(_0x3410d7){_0xf5c069[_0xf483('0x2f')]=_0x3410d7;if(_0x365c76['query'][_0xf483('0x54')]){_0x263b8a[_0xf483('0x58')]=[{'model':db[_0xf483('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf483('0xad'),'attributes':[_0xf483('0x39'),_0xf483('0xae'),_0xf483('0xaf')],'required':![]},{'model':db[_0xf483('0xb0')],'as':_0xf483('0xb1'),'attributes':['id',_0xf483('0x39'),'color'],'where':_0x365c76['query'][_0xf483('0xb2')]?{'id':_0x365c76[_0xf483('0x46')]['tag']}:undefined,'required':_0x365c76[_0xf483('0x46')][_0xf483('0xb2')]?!![]:![]}];}return db[_0xf483('0x90')]['findAll'](_0x263b8a);})[_0xf483('0x21')](function(_0x138050){_0xf5c069[_0xf483('0x56')]=_0x138050;return _0xf5c069;});}})[_0xf483('0x21')](respondWithFilteredResult(_0x46052d,_0x263b8a))[_0xf483('0x29')](handleError(_0x46052d,null));};exports[_0xf483('0xb3')]=function(_0x197578,_0x40a5e4,_0x88c5d7){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x197578[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x40a5e4,null))['then'](function(_0x5bb8bb){if(_0x5bb8bb){return _0x5bb8bb[_0xf483('0xb3')](_0x197578[_0xf483('0x5c')]['ids'],_[_0xf483('0xb4')](_0x197578[_0xf483('0x5c')],['ids','id'])||{})[_0xf483('0xb5')](function(_0x632141){for(var _0x281c3d=0x0;_0x281c3d<_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0xf483('0x4b')];_0x281c3d+=0x1){socket[_0xf483('0xb6')](_0xf483('0xb7'),{'UserId':Number(_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0x281c3d]),'OpenchannelAccountId':Number(_0x197578[_0xf483('0x57')]['id'])});}return _0x632141;});}})['then'](respondWithResult(_0x40a5e4,null))[_0xf483('0x29')](handleError(_0x40a5e4,null));};exports[_0xf483('0xb8')]=function(_0x352bed,_0x34e661,_0x2ff6f0){return db['OpenchannelAccount']['find']({'where':{'id':_0x352bed[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x34e661,null))['then'](function(_0x2ea619){if(_0x2ea619){return _0x2ea619[_0xf483('0xb8')](_0x352bed['query']['ids'])[_0xf483('0x21')](function(){if(_[_0xf483('0xb9')](_0x352bed['query'][_0xf483('0x6a')])){for(var _0x4287fd=0x0;_0x4287fd<_0x352bed['query'][_0xf483('0x6a')][_0xf483('0x4b')];_0x4287fd+=0x1){socket[_0xf483('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x352bed['query'][_0xf483('0x6a')][_0x4287fd]),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}}else{socket['emit'](_0xf483('0xba'),{'UserId':Number(_0x352bed['query']['ids']),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}});}})[_0xf483('0x21')](respondWithStatusCode(_0x34e661,null))[_0xf483('0x29')](handleError(_0x34e661,null));};exports['getAgents']=function(_0x22207a,_0xe1bf97,_0x40629e){var _0x5aa00a={};var _0x409b34={};var _0x6d31d2;var _0xfb1d14;return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x22207a[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xe1bf97,null))[_0xf483('0x21')](function(_0x1d7851){if(_0x1d7851){_0x6d31d2=_0x1d7851;_0x409b34[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x9b')][_0xf483('0x3f')]);_0x409b34[_0xf483('0x46')]=_[_0xf483('0x45')](_0x22207a['query']);_0x409b34[_0xf483('0x47')]=_['intersection'](_0x409b34[_0xf483('0x43')],_0x409b34[_0xf483('0x46')]);_0x5aa00a[_0xf483('0x49')]=_[_0xf483('0x48')](_0x409b34[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x22207a['query']['fields']));_0x5aa00a[_0xf483('0x49')]=_0x5aa00a[_0xf483('0x49')][_0xf483('0x4b')]?_0x5aa00a[_0xf483('0x49')]:_0x409b34['model'];_0x5aa00a['order']=qs[_0xf483('0x4e')](_0x22207a[_0xf483('0x46')][_0xf483('0x4e')]);_0x5aa00a[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x22207a[_0xf483('0x46')],_0x409b34['filters']));if(_0x22207a[_0xf483('0x46')][_0xf483('0x50')]){_0x5aa00a['where']=_['merge'](_0x5aa00a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x5aa00a[_0xf483('0x49')],function(_0x3fb89b){var _0x3d86da={};_0x3d86da[_0x3fb89b]={'$like':'%'+_0x22207a[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x3d86da;})});}_0x5aa00a=_[_0xf483('0x59')]({},_0x5aa00a,_0x22207a['options']);return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})[_0xf483('0x21')](function(_0x3f65bc){if(_0x3f65bc){_0xfb1d14=_0x3f65bc['length'];if(!_0x22207a[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x5aa00a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x22207a[_0xf483('0x46')][_0xf483('0x2e')]);_0x5aa00a['offset']=qs['offset'](_0x22207a[_0xf483('0x46')]['offset']);}return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})['then'](function(_0x2f0ab6){if(_0x2f0ab6){return _0x2f0ab6?{'count':_0xfb1d14,'rows':_0x2f0ab6}:null;}})['then'](respondWithResult(_0xe1bf97,null))[_0xf483('0x29')](handleError(_0xe1bf97,null));};exports['send']=function(_0x2739b0,_0x3929a2,_0x3b836d){var _0x20a11b,_0x3c9ed6,_0x58e269;if(_['isNil'](_0x2739b0['body'][_0xf483('0x5c')])||_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')]===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf483('0x79')](_0x2739b0['body']['to'])){}_0x20a11b=_0x2739b0[_0xf483('0x5c')]['to'];return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x2739b0['params']['id']}})['then'](handleEntityNotFound(_0x3929a2,null))['then'](function(_0xf9f144){if(_0xf9f144){return db['OpenchannelAccount'][_0xf483('0x5a')]({'where':{'id':_0xf9f144['id']},'include':[{'model':db[_0xf483('0x81')],'as':'List','include':[{'model':db[_0xf483('0x70')],'as':_0xf483('0x83'),'where':{[_0xf9f144[_0xf483('0x7e')]]:_0x20a11b},'limit':0x1,'order':[[_0xf483('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x4aeb82){if(_0x4aeb82&&_0x4aeb82[_0xf483('0x82')]){_0x3c9ed6=_0x4aeb82[_0xf483('0x5e')]({'plain':!![]});if(_0x3c9ed6[_0xf483('0x82')]&&_0x3c9ed6['List'][_0xf483('0x83')][_0xf483('0x4b')]){return _0x3c9ed6['List'][_0xf483('0x83')][0x0];}return db[_0xf483('0x70')]['create'](_['defaults'](_0x2739b0['body'],{'firstName':_0x20a11b,[_0x4aeb82[_0xf483('0x7e')]]:_0x20a11b,'phone':_0x20a11b,'ListId':_0x3c9ed6[_0xf483('0x77')]}));}})[_0xf483('0x21')](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x37d356){if(_0x37d356){_0x58e269=_0x37d356;return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':{'ContactId':_0x58e269['id'],'closed':![],'OpenchannelAccountId':_0x3c9ed6['id']}})[_0xf483('0x21')](function(_0xdb86c4){if(_0xdb86c4){return[_0xdb86c4,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')]({'UserId':_0x2739b0['user']['id'],'ContactId':_0x58e269['id'],'OpenchannelAccountId':_0x3c9ed6['id'],'lastMsgDirection':_0xf483('0xbc'),'firstMsgDirection':_0xf483('0xbc'),'Messages':[_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']})]},{'include':[{'model':db[_0xf483('0x98')],'as':'Messages'}]})[_0xf483('0x21')](function(_0xec881d){return[_0xec881d,!![]];});});}})[_0xf483('0xb5')](function(_0x2a061c,_0x18480e){if(_0x18480e){return _0x2a061c;}return db['OpenchannelMessage']['create'](_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'OpenchannelInteractionId':_0x2a061c['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']}))[_0xf483('0x21')](function(_0x284d81){_0x2a061c['dataValues'][_0xf483('0xbd')]=[];_0x2a061c['dataValues'][_0xf483('0xbd')][_0xf483('0xbe')](_0x284d81[_0xf483('0xbf')]);return _0x2a061c;});});}})['then'](respondWithResult(_0x3929a2,null))[_0xf483('0x29')](handleError(_0x3929a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7a814c2..181f136 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 _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x994d25,_0x1b1fb2){var _0x50d5b3=function(_0x82b231){while(--_0x82b231){_0x994d25['push'](_0x994d25['shift']());}};_0x50d5b3(++_0x1b1fb2);}(_0x1339,0x1ed));var _0x9133=function(_0x44f728,_0x102cb1){_0x44f728=_0x44f728-0x0;var _0x4f91d6=_0x1339[_0x44f728];return _0x4f91d6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0xce32e9,_0x40820d){var _0x5a6d7c=function(_0x4bfc42){while(--_0x4bfc42){_0xce32e9['push'](_0xce32e9['shift']());}};_0x5a6d7c(++_0x40820d);}(_0xe706,0xa3));var _0x6e70=function(_0x5ee287,_0x49b6a1){_0x5ee287=_0x5ee287-0x0;var _0x2a1adf=_0xe706[_0x5ee287];return _0x2a1adf;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9907b96..e5944b9 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x435bf1,_0x3276ab){var _0x271fa6=function(_0x3dc2f3){while(--_0x3dc2f3){_0x435bf1['push'](_0x435bf1['shift']());}};_0x271fa6(++_0x3276ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2b05d8,_0x54ec4d){var _0xe254ea=function(_0x2ade05){while(--_0x2ade05){_0x2b05d8['push'](_0x2b05d8['shift']());}};_0xe254ea(++_0x54ec4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index bcf6fd1..a4f5291 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 _0x5eb1=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2c93a2,_0x1c1e3b){_0x2c93a2=_0x2c93a2-0x0;var _0x5bde6c=_0x5eb1[_0x2c93a2];return _0x5bde6c;};'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')]('OpenchannelAccount,\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')]('OpenchannelAccount,\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);});});} \ 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','redis','localhost','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1acb7e,_0x5c1b6f){var _0x18b5c7=function(_0x5af735){while(--_0x5af735){_0x1acb7e['push'](_0x1acb7e['shift']());}};_0x18b5c7(++_0x5c1b6f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcb91[_0x30cd7e];return _0x462a02;};'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});config[_0x1cb9('0x9')]=_['defaults'](config[_0x1cb9('0x9')],{'host':_0x1cb9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x45a12f,_0x2fa15c,_0x74ce19){return new BPromise(function(_0x1f0eca,_0x2fc627){return client['request'](_0x45a12f,_0x74ce19)[_0x1cb9('0xb')](function(_0x44a6b4){logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2fa15c,'request\x20sent',JSON[_0x1cb9('0xf')](_0x44a6b4));if(_0x44a6b4[_0x1cb9('0x10')]){if(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger['error'](_0x1cb9('0xd'),_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x2fc627(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x1f0eca(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));_0x1f0eca(_0x44a6b4['result']['message']);}})[_0x1cb9('0x13')](function(_0x41ac41){logger[_0x1cb9('0x10')](_0x1cb9('0xd'),_0x2fa15c,_0x41ac41);_0x2fc627(_0x41ac41);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index cba30da..4ff7b9c 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 _0xa101=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x7b53a5,_0x3a4bf1){var _0x21af7a=function(_0x1aa8dc){while(--_0x1aa8dc){_0x7b53a5['push'](_0x7b53a5['shift']());}};_0x21af7a(++_0x3a4bf1);}(_0xa101,0x15f));var _0x1a10=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0xa101[_0x19f9e6];return _0x45c862;};'use strict';var OpenchannelAccountEvents=require(_0x1a10('0x0'));var events=[_0x1a10('0x1'),'remove',_0x1a10('0x2')];function createListener(_0x1c42d9,_0x522253){return function(_0x9e0102){_0x522253[_0x1a10('0x3')](_0x1c42d9,_0x9e0102);};}function removeListener(_0x51baf6,_0x205faf){return function(){OpenchannelAccountEvents[_0x1a10('0x4')](_0x51baf6,_0x205faf);};}exports[_0x1a10('0x5')]=function(_0x1a9d22){for(var _0x2eb3c8=0x0,_0x2b95f3=events['length'];_0x2eb3c8<_0x2b95f3;_0x2eb3c8++){var _0x4f0cd4=events[_0x2eb3c8];var _0x3c90fa=createListener(_0x1a10('0x6')+_0x4f0cd4,_0x1a9d22);OpenchannelAccountEvents['on'](_0x4f0cd4,_0x3c90fa);}}; \ No newline at end of file +var _0xff96=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xff96,0x179));var _0x6ff9=function(_0x5bb488,_0x405570){_0x5bb488=_0x5bb488-0x0;var _0x3a541a=_0xff96[_0x5bb488];return _0x3a541a;};'use strict';var OpenchannelAccountEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){OpenchannelAccountEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);OpenchannelAccountEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 32b1b6f..8317958 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 _0xa642=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x443caa,_0x247042){var _0x3dff1c=function(_0x98f43c){while(--_0x98f43c){_0x443caa['push'](_0x443caa['shift']());}};_0x3dff1c(++_0x247042);}(_0xa642,0x1d9));var _0x2a64=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xa642[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x2a64('0x0'));var util=require(_0x2a64('0x1'));var path=require(_0x2a64('0x2'));var timeout=require(_0x2a64('0x3'));var express=require(_0x2a64('0x4'));var router=express['Router']();var fs_extra=require(_0x2a64('0x5'));var auth=require(_0x2a64('0x6'));var interaction=require(_0x2a64('0x7'));var config=require(_0x2a64('0x8'));var controller=require(_0x2a64('0x9'));router['get']('/',auth[_0x2a64('0xa')](),controller[_0x2a64('0xb')]);router['get'](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0xd')]);router[_0x2a64('0xe')]('/',auth[_0x2a64('0xa')](),controller['create']);router[_0x2a64('0xf')](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0x10')]);router[_0x2a64('0x11')](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0x12')]);module[_0x2a64('0x13')]=router; \ No newline at end of file +var _0x3fb7=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x157d74,_0x2f03f5){var _0x29a3ac=function(_0x588b6e){while(--_0x588b6e){_0x157d74['push'](_0x157d74['shift']());}};_0x29a3ac(++_0x2f03f5);}(_0x3fb7,0x19b));var _0x73fb=function(_0x16f20e,_0x4863cf){_0x16f20e=_0x16f20e-0x0;var _0x48d7a1=_0x3fb7[_0x16f20e];return _0x48d7a1;};'use strict';var multer=require('multer');var util=require(_0x73fb('0x0'));var path=require(_0x73fb('0x1'));var timeout=require(_0x73fb('0x2'));var express=require(_0x73fb('0x3'));var router=express['Router']();var fs_extra=require(_0x73fb('0x4'));var auth=require(_0x73fb('0x5'));var interaction=require(_0x73fb('0x6'));var config=require(_0x73fb('0x7'));var controller=require(_0x73fb('0x8'));router[_0x73fb('0x9')]('/',auth['isAuthenticated'](),controller[_0x73fb('0xa')]);router['get'](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller[_0x73fb('0xd')]);router[_0x73fb('0xe')]('/',auth[_0x73fb('0xc')](),controller[_0x73fb('0xf')]);router[_0x73fb('0x10')](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller[_0x73fb('0x11')]);router[_0x73fb('0x12')](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller['destroy']);module[_0x73fb('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5685929..a79c340 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 _0xf650=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x499bd2,_0x3667fd){var _0x5decdd=function(_0x4a3505){while(--_0x4a3505){_0x499bd2['push'](_0x499bd2['shift']());}};_0x5decdd(++_0x3667fd);}(_0xf650,0x155));var _0x0f65=function(_0x355f39,_0x325eb6){_0x355f39=_0x355f39-0x0;var _0x42538b=_0xf650[_0x355f39];return _0x42538b;};'use strict';var Sequelize=require(_0x0f65('0x0'));module[_0x0f65('0x1')]={'priority':{'type':Sequelize[_0x0f65('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f65('0x3')],'allowNull':![],'defaultValue':_0x0f65('0x4')},'appdata':{'type':Sequelize[_0x0f65('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0f65('0x3')],'defaultValue':_0x0f65('0x6')}}; \ No newline at end of file +var _0x20bb=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x57fec5,_0x48cd67){var _0x5d7684=function(_0xcd4a5a){while(--_0xcd4a5a){_0x57fec5['push'](_0x57fec5['shift']());}};_0x5d7684(++_0x48cd67);}(_0x20bb,0xa1));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb20b('0x0'));module[_0xb20b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb20b('0x2')],'allowNull':![],'defaultValue':_0xb20b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb20b('0x2')]},'interval':{'type':Sequelize[_0xb20b('0x2')],'defaultValue':_0xb20b('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 95c4629..98323f1 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 _0x39e9=['model','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','name','send','OpenchannelApplication','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39e9,0x183));var _0x939e=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x39e9[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x939e('0x0'));var zipdir=require(_0x939e('0x1'));var jsonpatch=require(_0x939e('0x2'));var rp=require(_0x939e('0x3'));var moment=require('moment');var BPromise=require(_0x939e('0x4'));var Mustache=require('mustache');var util=require(_0x939e('0x5'));var path=require(_0x939e('0x6'));var sox=require(_0x939e('0x7'));var csv=require(_0x939e('0x8'));var ejs=require(_0x939e('0x9'));var fs=require('fs');var fs_extra=require(_0x939e('0xa'));var _=require('lodash');var squel=require(_0x939e('0xb'));var crypto=require(_0x939e('0xc'));var jsforce=require(_0x939e('0xd'));var deskjs=require(_0x939e('0xe'));var toCsv=require(_0x939e('0x8'));var querystring=require(_0x939e('0xf'));var Papa=require(_0x939e('0x10'));var Redis=require(_0x939e('0x11'));var authService=require(_0x939e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x939e('0x13'));var hardwareService=require(_0x939e('0x14'));var logger=require(_0x939e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x939e('0x16'));var licenseUtil=require(_0x939e('0x17'));var db=require(_0x939e('0x18'))['db'];function respondWithStatusCode(_0x2e6ad7,_0x5ce4fd){_0x5ce4fd=_0x5ce4fd||0xcc;return function(_0x3fdf1c){if(_0x3fdf1c){return _0x2e6ad7[_0x939e('0x19')](_0x5ce4fd);}return _0x2e6ad7[_0x939e('0x1a')](_0x5ce4fd)['end']();};}function respondWithResult(_0x331282,_0x3f695b){_0x3f695b=_0x3f695b||0xc8;return function(_0x537699){if(_0x537699){return _0x331282[_0x939e('0x1a')](_0x3f695b)[_0x939e('0x1b')](_0x537699);}};}function respondWithFilteredResult(_0xa6e435,_0x1090a3){return function(_0x50aa34){if(_0x50aa34){var _0x3c6d52=typeof _0x1090a3['offset']===_0x939e('0x1c')&&typeof _0x1090a3[_0x939e('0x1d')]==='undefined';var _0x1022f5=_0x50aa34[_0x939e('0x1e')];var _0x1dad74=_0x3c6d52?0x0:_0x1090a3[_0x939e('0x1f')];var _0x5d079a=_0x3c6d52?_0x50aa34['count']:_0x1090a3[_0x939e('0x1f')]+_0x1090a3['limit'];var _0x5b4f3a;if(_0x5d079a>=_0x1022f5){_0x5d079a=_0x1022f5;_0x5b4f3a=0xc8;}else{_0x5b4f3a=0xce;}_0xa6e435[_0x939e('0x1a')](_0x5b4f3a);return _0xa6e435[_0x939e('0x20')](_0x939e('0x21'),_0x1dad74+'-'+_0x5d079a+'/'+_0x1022f5)[_0x939e('0x1b')](_0x50aa34);}return null;};}function patchUpdates(_0x1f7341){return function(_0x19c113){try{jsonpatch['apply'](_0x19c113,_0x1f7341,!![]);}catch(_0x197b6f){return BPromise[_0x939e('0x22')](_0x197b6f);}return _0x19c113[_0x939e('0x23')]();};}function saveUpdates(_0x23a4d8,_0x5950d7){return function(_0x17d9d6){if(_0x17d9d6){return _0x17d9d6['update'](_0x23a4d8)[_0x939e('0x24')](function(_0x28afca){return _0x28afca;});}return null;};}function removeEntity(_0xa6ea7e,_0x4bf230){return function(_0x27f347){if(_0x27f347){return _0x27f347[_0x939e('0x25')]()[_0x939e('0x24')](function(){_0xa6ea7e[_0x939e('0x1a')](0xcc)[_0x939e('0x26')]();});}};}function handleEntityNotFound(_0x34b699,_0x5c5832){return function(_0x5bcd66){if(!_0x5bcd66){_0x34b699[_0x939e('0x19')](0x194);}return _0x5bcd66;};}function handleError(_0x1b9421,_0x2a0095){_0x2a0095=_0x2a0095||0x1f4;return function(_0x4cdde0){logger[_0x939e('0x27')](_0x4cdde0['stack']);if(_0x4cdde0[_0x939e('0x28')]){delete _0x4cdde0[_0x939e('0x28')];}_0x1b9421['status'](_0x2a0095)[_0x939e('0x29')](_0x4cdde0);};}exports['index']=function(_0x19e946,_0x2332f5){var _0x7918d0={},_0x450d32={},_0x4138d4={'count':0x0,'rows':[]};var _0x2d4b11=_['map'](db[_0x939e('0x2a')]['rawAttributes'],function(_0xcda9f7){return{'name':_0xcda9f7[_0x939e('0x2b')],'type':_0xcda9f7[_0x939e('0x2c')][_0x939e('0x2d')]};});_0x450d32['model']=_[_0x939e('0x2e')](_0x2d4b11,'name');_0x450d32[_0x939e('0x2f')]=_[_0x939e('0x30')](_0x19e946[_0x939e('0x2f')]);_0x450d32[_0x939e('0x31')]=_[_0x939e('0x32')](_0x450d32[_0x939e('0x33')],_0x450d32[_0x939e('0x2f')]);_0x7918d0[_0x939e('0x34')]=_[_0x939e('0x32')](_0x450d32[_0x939e('0x33')],qs[_0x939e('0x35')](_0x19e946[_0x939e('0x2f')][_0x939e('0x35')]));_0x7918d0['attributes']=_0x7918d0[_0x939e('0x34')]['length']?_0x7918d0['attributes']:_0x450d32['model'];if(!_0x19e946['query']['hasOwnProperty'](_0x939e('0x36'))){_0x7918d0[_0x939e('0x1d')]=qs['limit'](_0x19e946[_0x939e('0x2f')][_0x939e('0x1d')]);_0x7918d0[_0x939e('0x1f')]=qs['offset'](_0x19e946[_0x939e('0x2f')][_0x939e('0x1f')]);}_0x7918d0[_0x939e('0x37')]=qs[_0x939e('0x38')](_0x19e946[_0x939e('0x2f')]['sort']);_0x7918d0['where']=qs[_0x939e('0x31')](_[_0x939e('0x39')](_0x19e946[_0x939e('0x2f')],_0x450d32[_0x939e('0x31')]),_0x2d4b11);if(_0x19e946['query'][_0x939e('0x3a')]){_0x7918d0[_0x939e('0x3b')]=_['merge'](_0x7918d0[_0x939e('0x3b')],{'$or':_['map'](_0x2d4b11,function(_0x21424c){if(_0x21424c[_0x939e('0x2c')]!==_0x939e('0x3c')){var _0x2c8187={};_0x2c8187[_0x21424c[_0x939e('0x28')]]={'$like':'%'+_0x19e946[_0x939e('0x2f')][_0x939e('0x3a')]+'%'};return _0x2c8187;}})});}_0x7918d0=_[_0x939e('0x3d')]({},_0x7918d0,_0x19e946[_0x939e('0x3e')]);var _0x5db37f={'where':_0x7918d0[_0x939e('0x3b')]};return db[_0x939e('0x2a')][_0x939e('0x1e')](_0x5db37f)['then'](function(_0xa3968f){_0x4138d4[_0x939e('0x1e')]=_0xa3968f;if(_0x19e946['query'][_0x939e('0x3f')]){_0x7918d0[_0x939e('0x40')]=[{'all':!![]}];}return db[_0x939e('0x2a')][_0x939e('0x41')](_0x7918d0);})[_0x939e('0x24')](function(_0x213176){_0x4138d4['rows']=_0x213176;return _0x4138d4;})[_0x939e('0x24')](respondWithFilteredResult(_0x2332f5,_0x7918d0))[_0x939e('0x42')](handleError(_0x2332f5,null));};exports[_0x939e('0x43')]=function(_0x38bdce,_0x388413){var _0x258a93={'raw':!![],'where':{'id':_0x38bdce[_0x939e('0x44')]['id']}},_0x5328eb={};_0x5328eb[_0x939e('0x33')]=_[_0x939e('0x30')](db[_0x939e('0x2a')][_0x939e('0x45')]);_0x5328eb[_0x939e('0x2f')]=_[_0x939e('0x30')](_0x38bdce['query']);_0x5328eb[_0x939e('0x31')]=_[_0x939e('0x32')](_0x5328eb[_0x939e('0x33')],_0x5328eb[_0x939e('0x2f')]);_0x258a93['attributes']=_['intersection'](_0x5328eb[_0x939e('0x33')],qs[_0x939e('0x35')](_0x38bdce[_0x939e('0x2f')][_0x939e('0x35')]));_0x258a93['attributes']=_0x258a93[_0x939e('0x34')]['length']?_0x258a93['attributes']:_0x5328eb[_0x939e('0x33')];if(_0x38bdce[_0x939e('0x2f')][_0x939e('0x3f')]){_0x258a93[_0x939e('0x40')]=[{'all':!![]}];}_0x258a93=_[_0x939e('0x3d')]({},_0x258a93,_0x38bdce[_0x939e('0x3e')]);return db['OpenchannelApplication'][_0x939e('0x46')](_0x258a93)[_0x939e('0x24')](handleEntityNotFound(_0x388413,null))[_0x939e('0x24')](respondWithResult(_0x388413,null))['catch'](handleError(_0x388413,null));};exports[_0x939e('0x47')]=function(_0x1896ec,_0x3f6bc4){return db['OpenchannelApplication']['create'](_0x1896ec['body'],{})[_0x939e('0x24')](respondWithResult(_0x3f6bc4,0xc9))['catch'](handleError(_0x3f6bc4,null));};exports['update']=function(_0xb97569,_0x5509e4){if(_0xb97569[_0x939e('0x48')]['id']){delete _0xb97569[_0x939e('0x48')]['id'];}return db[_0x939e('0x2a')][_0x939e('0x46')]({'where':{'id':_0xb97569[_0x939e('0x44')]['id']}})[_0x939e('0x24')](handleEntityNotFound(_0x5509e4,null))[_0x939e('0x24')](saveUpdates(_0xb97569['body'],null))[_0x939e('0x24')](respondWithResult(_0x5509e4,null))[_0x939e('0x42')](handleError(_0x5509e4,null));};exports[_0x939e('0x25')]=function(_0x57c320,_0x15185e){return db[_0x939e('0x2a')][_0x939e('0x46')]({'where':{'id':_0x57c320[_0x939e('0x44')]['id']}})[_0x939e('0x24')](handleEntityNotFound(_0x15185e,null))[_0x939e('0x24')](removeEntity(_0x15185e,null))[_0x939e('0x42')](handleError(_0x15185e,null));}; \ No newline at end of file +var _0xe45d=['map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','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','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model'];(function(_0x42418a,_0x5d6f7e){var _0x2bd0cd=function(_0x3e0086){while(--_0x3e0086){_0x42418a['push'](_0x42418a['shift']());}};_0x2bd0cd(++_0x5d6f7e);}(_0xe45d,0xb0));var _0xde45=function(_0x4e9646,_0x224f43){_0x4e9646=_0x4e9646-0x0;var _0x149afe=_0xe45d[_0x4e9646];return _0x149afe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde45('0x0'));var zipdir=require(_0xde45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde45('0x2'));var moment=require(_0xde45('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde45('0x4'));var util=require(_0xde45('0x5'));var path=require(_0xde45('0x6'));var sox=require(_0xde45('0x7'));var csv=require('to-csv');var ejs=require(_0xde45('0x8'));var fs=require('fs');var fs_extra=require(_0xde45('0x9'));var _=require(_0xde45('0xa'));var squel=require(_0xde45('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde45('0xc'));var querystring=require(_0xde45('0xd'));var Papa=require(_0xde45('0xe'));var Redis=require(_0xde45('0xf'));var authService=require(_0xde45('0x10'));var qs=require(_0xde45('0x11'));var as=require(_0xde45('0x12'));var hardwareService=require(_0xde45('0x13'));var logger=require('../../config/logger')(_0xde45('0x14'));var utils=require(_0xde45('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde45('0x16'));var db=require(_0xde45('0x17'))['db'];function respondWithStatusCode(_0x1ac5e8,_0x1a2855){_0x1a2855=_0x1a2855||0xcc;return function(_0x25bcb2){if(_0x25bcb2){return _0x1ac5e8[_0xde45('0x18')](_0x1a2855);}return _0x1ac5e8[_0xde45('0x19')](_0x1a2855)['end']();};}function respondWithResult(_0x18e488,_0x428c50){_0x428c50=_0x428c50||0xc8;return function(_0x11c231){if(_0x11c231){return _0x18e488[_0xde45('0x19')](_0x428c50)[_0xde45('0x1a')](_0x11c231);}};}function respondWithFilteredResult(_0x1a55bf,_0x15747a){return function(_0x36cd09){if(_0x36cd09){var _0x47bdee=typeof _0x15747a[_0xde45('0x1b')]===_0xde45('0x1c')&&typeof _0x15747a[_0xde45('0x1d')]===_0xde45('0x1c');var _0x45f299=_0x36cd09[_0xde45('0x1e')];var _0x271406=_0x47bdee?0x0:_0x15747a[_0xde45('0x1b')];var _0x51f47a=_0x47bdee?_0x36cd09[_0xde45('0x1e')]:_0x15747a[_0xde45('0x1b')]+_0x15747a[_0xde45('0x1d')];var _0x22d77c;if(_0x51f47a>=_0x45f299){_0x51f47a=_0x45f299;_0x22d77c=0xc8;}else{_0x22d77c=0xce;}_0x1a55bf[_0xde45('0x19')](_0x22d77c);return _0x1a55bf['set'](_0xde45('0x1f'),_0x271406+'-'+_0x51f47a+'/'+_0x45f299)[_0xde45('0x1a')](_0x36cd09);}return null;};}function patchUpdates(_0x83af2d){return function(_0x458bde){try{jsonpatch[_0xde45('0x20')](_0x458bde,_0x83af2d,!![]);}catch(_0x3e79ce){return BPromise[_0xde45('0x21')](_0x3e79ce);}return _0x458bde['save']();};}function saveUpdates(_0x710811,_0x1c9d52){return function(_0x1cc01b){if(_0x1cc01b){return _0x1cc01b[_0xde45('0x22')](_0x710811)[_0xde45('0x23')](function(_0x2b42d4){return _0x2b42d4;});}return null;};}function removeEntity(_0x24b9e8,_0x5a4980){return function(_0x2349ca){if(_0x2349ca){return _0x2349ca[_0xde45('0x24')]()['then'](function(){_0x24b9e8['status'](0xcc)[_0xde45('0x25')]();});}};}function handleEntityNotFound(_0x1a3a4d,_0x2a9a61){return function(_0x580839){if(!_0x580839){_0x1a3a4d[_0xde45('0x18')](0x194);}return _0x580839;};}function handleError(_0x4cc1d6,_0x46af6a){_0x46af6a=_0x46af6a||0x1f4;return function(_0x2ba974){logger[_0xde45('0x26')](_0x2ba974[_0xde45('0x27')]);if(_0x2ba974[_0xde45('0x28')]){delete _0x2ba974[_0xde45('0x28')];}_0x4cc1d6[_0xde45('0x19')](_0x46af6a)[_0xde45('0x29')](_0x2ba974);};}exports[_0xde45('0x2a')]=function(_0x53897d,_0x6da233){var _0x50803f={},_0x5081d1={},_0x5d5d99={'count':0x0,'rows':[]};var _0x277893=_['map'](db[_0xde45('0x2b')][_0xde45('0x2c')],function(_0x8e92a8){return{'name':_0x8e92a8[_0xde45('0x2d')],'type':_0x8e92a8[_0xde45('0x2e')][_0xde45('0x2f')]};});_0x5081d1[_0xde45('0x30')]=_[_0xde45('0x31')](_0x277893,_0xde45('0x28'));_0x5081d1[_0xde45('0x32')]=_[_0xde45('0x33')](_0x53897d[_0xde45('0x32')]);_0x5081d1['filters']=_[_0xde45('0x34')](_0x5081d1[_0xde45('0x30')],_0x5081d1[_0xde45('0x32')]);_0x50803f[_0xde45('0x35')]=_[_0xde45('0x34')](_0x5081d1[_0xde45('0x30')],qs['fields'](_0x53897d['query'][_0xde45('0x36')]));_0x50803f['attributes']=_0x50803f[_0xde45('0x35')][_0xde45('0x37')]?_0x50803f['attributes']:_0x5081d1[_0xde45('0x30')];if(!_0x53897d[_0xde45('0x32')][_0xde45('0x38')](_0xde45('0x39'))){_0x50803f[_0xde45('0x1d')]=qs['limit'](_0x53897d[_0xde45('0x32')][_0xde45('0x1d')]);_0x50803f[_0xde45('0x1b')]=qs['offset'](_0x53897d[_0xde45('0x32')][_0xde45('0x1b')]);}_0x50803f[_0xde45('0x3a')]=qs['sort'](_0x53897d[_0xde45('0x32')]['sort']);_0x50803f[_0xde45('0x3b')]=qs[_0xde45('0x3c')](_[_0xde45('0x3d')](_0x53897d[_0xde45('0x32')],_0x5081d1[_0xde45('0x3c')]),_0x277893);if(_0x53897d['query'][_0xde45('0x3e')]){_0x50803f['where']=_[_0xde45('0x3f')](_0x50803f[_0xde45('0x3b')],{'$or':_[_0xde45('0x31')](_0x277893,function(_0x505dcb){if(_0x505dcb[_0xde45('0x2e')]!==_0xde45('0x40')){var _0x226fdc={};_0x226fdc[_0x505dcb[_0xde45('0x28')]]={'$like':'%'+_0x53897d[_0xde45('0x32')][_0xde45('0x3e')]+'%'};return _0x226fdc;}})});}_0x50803f=_[_0xde45('0x3f')]({},_0x50803f,_0x53897d[_0xde45('0x41')]);var _0xd05231={'where':_0x50803f[_0xde45('0x3b')]};return db[_0xde45('0x2b')][_0xde45('0x1e')](_0xd05231)['then'](function(_0x441240){_0x5d5d99[_0xde45('0x1e')]=_0x441240;if(_0x53897d[_0xde45('0x32')][_0xde45('0x42')]){_0x50803f['include']=[{'all':!![]}];}return db[_0xde45('0x2b')][_0xde45('0x43')](_0x50803f);})['then'](function(_0x5e0f01){_0x5d5d99[_0xde45('0x44')]=_0x5e0f01;return _0x5d5d99;})[_0xde45('0x23')](respondWithFilteredResult(_0x6da233,_0x50803f))[_0xde45('0x45')](handleError(_0x6da233,null));};exports['show']=function(_0x3a1603,_0x42edd2){var _0x3caaf9={'raw':!![],'where':{'id':_0x3a1603[_0xde45('0x46')]['id']}},_0x469883={};_0x469883[_0xde45('0x30')]=_[_0xde45('0x33')](db['OpenchannelApplication'][_0xde45('0x2c')]);_0x469883['query']=_[_0xde45('0x33')](_0x3a1603[_0xde45('0x32')]);_0x469883[_0xde45('0x3c')]=_[_0xde45('0x34')](_0x469883[_0xde45('0x30')],_0x469883[_0xde45('0x32')]);_0x3caaf9['attributes']=_[_0xde45('0x34')](_0x469883[_0xde45('0x30')],qs[_0xde45('0x36')](_0x3a1603[_0xde45('0x32')][_0xde45('0x36')]));_0x3caaf9[_0xde45('0x35')]=_0x3caaf9[_0xde45('0x35')]['length']?_0x3caaf9['attributes']:_0x469883[_0xde45('0x30')];if(_0x3a1603[_0xde45('0x32')][_0xde45('0x42')]){_0x3caaf9[_0xde45('0x47')]=[{'all':!![]}];}_0x3caaf9=_[_0xde45('0x3f')]({},_0x3caaf9,_0x3a1603[_0xde45('0x41')]);return db['OpenchannelApplication'][_0xde45('0x48')](_0x3caaf9)['then'](handleEntityNotFound(_0x42edd2,null))['then'](respondWithResult(_0x42edd2,null))['catch'](handleError(_0x42edd2,null));};exports[_0xde45('0x49')]=function(_0x183f10,_0x43da39){return db['OpenchannelApplication'][_0xde45('0x49')](_0x183f10[_0xde45('0x4a')],{})[_0xde45('0x23')](respondWithResult(_0x43da39,0xc9))[_0xde45('0x45')](handleError(_0x43da39,null));};exports[_0xde45('0x22')]=function(_0x4e78cf,_0x442179){if(_0x4e78cf[_0xde45('0x4a')]['id']){delete _0x4e78cf[_0xde45('0x4a')]['id'];}return db[_0xde45('0x2b')][_0xde45('0x48')]({'where':{'id':_0x4e78cf[_0xde45('0x46')]['id']}})[_0xde45('0x23')](handleEntityNotFound(_0x442179,null))['then'](saveUpdates(_0x4e78cf[_0xde45('0x4a')],null))[_0xde45('0x23')](respondWithResult(_0x442179,null))['catch'](handleError(_0x442179,null));};exports['destroy']=function(_0x28c700,_0x44a08b){return db[_0xde45('0x2b')][_0xde45('0x48')]({'where':{'id':_0x28c700['params']['id']}})['then'](handleEntityNotFound(_0x44a08b,null))[_0xde45('0x23')](removeEntity(_0x44a08b,null))[_0xde45('0x45')](handleError(_0x44a08b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c7d1638..c6397c7 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 _0xf58f=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','util','../../config/logger','moment','request-promise','path'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0xf58f,0x69));var _0xff58=function(_0x45951d,_0x5afec6){_0x45951d=_0x45951d-0x0;var _0x1ad3c6=_0xf58f[_0x45951d];return _0x1ad3c6;};'use strict';var _=require('lodash');var util=require(_0xff58('0x0'));var logger=require(_0xff58('0x1'))('api');var moment=require(_0xff58('0x2'));var BPromise=require('bluebird');var rp=require(_0xff58('0x3'));var fs=require('fs');var path=require(_0xff58('0x4'));var rimraf=require(_0xff58('0x5'));var config=require(_0xff58('0x6'));var attributes=require(_0xff58('0x7'));module[_0xff58('0x8')]=function(_0x4ad273,_0x282c8f){return _0x4ad273['define'](_0xff58('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff58('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xce95=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c6370,_0x2ff70a){var _0x35156e=function(_0x1f1359){while(--_0x1f1359){_0x4c6370['push'](_0x4c6370['shift']());}};_0x35156e(++_0x2ff70a);}(_0xce95,0x69));var _0x5ce9=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xce95[_0x2f9467];return _0x39894c;};'use strict';var _=require('lodash');var util=require(_0x5ce9('0x0'));var logger=require(_0x5ce9('0x1'))(_0x5ce9('0x2'));var moment=require(_0x5ce9('0x3'));var BPromise=require(_0x5ce9('0x4'));var rp=require(_0x5ce9('0x5'));var fs=require('fs');var path=require(_0x5ce9('0x6'));var rimraf=require('rimraf');var config=require(_0x5ce9('0x7'));var attributes=require(_0x5ce9('0x8'));module[_0x5ce9('0x9')]=function(_0x3c6643,_0x433aa5){return _0x3c6643[_0x5ce9('0xa')](_0x5ce9('0xb'),attributes,{'tableName':_0x5ce9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ce9('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d903e58..83a7f5f 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 _0x2d11=['update','body','options','raw','where','attributes','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x3f74b2,_0x16df31){var _0x51136f=function(_0x3659ea){while(--_0x3659ea){_0x3f74b2['push'](_0x3f74b2['shift']());}};_0x51136f(++_0x16df31);}(_0x2d11,0xb5));var _0x12d1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2d11[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x12d1('0x0'));var util=require(_0x12d1('0x1'));var moment=require('moment');var BPromise=require(_0x12d1('0x2'));var rs=require(_0x12d1('0x3'));var fs=require('fs');var Redis=require(_0x12d1('0x4'));var db=require(_0x12d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12d1('0x6'))(_0x12d1('0x7'));var config=require(_0x12d1('0x8'));var jayson=require(_0x12d1('0x9'));var client=jayson[_0x12d1('0xa')][_0x12d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3454e7,_0x454f61,_0x39cdd9){return new BPromise(function(_0x2e8c54,_0x195b0b){return client['request'](_0x3454e7,_0x39cdd9)[_0x12d1('0xc')](function(_0x20bc6f){logger['info'](_0x12d1('0xd'),_0x454f61,_0x12d1('0xe'));logger[_0x12d1('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x454f61,_0x12d1('0xe'),JSON[_0x12d1('0x10')](_0x20bc6f));if(_0x20bc6f[_0x12d1('0x11')]){if(_0x20bc6f[_0x12d1('0x11')]['code']===0x1f4){logger[_0x12d1('0x11')](_0x12d1('0xd'),_0x454f61,_0x20bc6f[_0x12d1('0x11')][_0x12d1('0x12')]);return _0x195b0b(_0x20bc6f['error'][_0x12d1('0x12')]);}logger[_0x12d1('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x454f61,_0x20bc6f['error'][_0x12d1('0x12')]);return _0x2e8c54(_0x20bc6f[_0x12d1('0x11')]['message']);}else{logger['info'](_0x12d1('0xd'),_0x454f61,'request\x20sent');_0x2e8c54(_0x20bc6f['result'][_0x12d1('0x12')]);}})[_0x12d1('0x13')](function(_0xc12a32){logger[_0x12d1('0x11')](_0x12d1('0xd'),_0x454f61,_0xc12a32);_0x195b0b(_0xc12a32);});});}exports[_0x12d1('0x14')]=function(_0x4a40c4){var _0x58e54b=this;return new Promise(function(_0x46dc4f,_0x318c4d){return db[_0x12d1('0x15')][_0x12d1('0x16')](_0x4a40c4[_0x12d1('0x17')],{'raw':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a40c4['options']?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x1a')]||null:null,'attributes':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x1b')]||null:null,'limit':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')]['limit']||null:null})['then'](function(_0x1ca4bc){logger[_0x12d1('0x1c')](_0x12d1('0x14'),_0x4a40c4);logger[_0x12d1('0xf')](_0x12d1('0x14'),_0x4a40c4,JSON[_0x12d1('0x10')](_0x1ca4bc));_0x46dc4f(_0x1ca4bc);})[_0x12d1('0x13')](function(_0x3bc32f){logger[_0x12d1('0x11')](_0x12d1('0x14'),_0x3bc32f['message'],_0x4a40c4);_0x318c4d(_0x58e54b['error'](0x1f4,_0x3bc32f[_0x12d1('0x12')]));});});}; \ No newline at end of file +var _0x84e0=['message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x35a329,_0x488fee){var _0x4cbdb1=function(_0x5042c0){while(--_0x5042c0){_0x35a329['push'](_0x35a329['shift']());}};_0x4cbdb1(++_0x488fee);}(_0x84e0,0xcf));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x084e('0x0'));var moment=require(_0x084e('0x1'));var BPromise=require(_0x084e('0x2'));var rs=require(_0x084e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x084e('0x4'))['db'];var utils=require(_0x084e('0x5'));var logger=require(_0x084e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x084e('0x7'));var client=jayson['client'][_0x084e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2612f9,_0x3f9ede,_0x46efb9){return new BPromise(function(_0x63e045,_0x53f0e9){return client[_0x084e('0x9')](_0x2612f9,_0x46efb9)[_0x084e('0xa')](function(_0xf11b0c){logger[_0x084e('0xb')](_0x084e('0xc'),_0x3f9ede,_0x084e('0xd'));logger[_0x084e('0xe')](_0x084e('0xf'),_0x3f9ede,_0x084e('0xd'),JSON['stringify'](_0xf11b0c));if(_0xf11b0c[_0x084e('0x10')]){if(_0xf11b0c['error']['code']===0x1f4){logger['error'](_0x084e('0xc'),_0x3f9ede,_0xf11b0c[_0x084e('0x10')][_0x084e('0x11')]);return _0x53f0e9(_0xf11b0c['error'][_0x084e('0x11')]);}logger['error'](_0x084e('0xc'),_0x3f9ede,_0xf11b0c['error'][_0x084e('0x11')]);return _0x63e045(_0xf11b0c['error'][_0x084e('0x11')]);}else{logger['info'](_0x084e('0xc'),_0x3f9ede,'request\x20sent');_0x63e045(_0xf11b0c[_0x084e('0x12')][_0x084e('0x11')]);}})[_0x084e('0x13')](function(_0x5dcf3f){logger[_0x084e('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f9ede,_0x5dcf3f);_0x53f0e9(_0x5dcf3f);});});}exports[_0x084e('0x14')]=function(_0x1affe7){var _0x5e45fe=this;return new Promise(function(_0x446fe7,_0x1dea99){return db['OpenchannelApplication'][_0x084e('0x15')](_0x1affe7[_0x084e('0x16')],{'raw':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')]['where']||null:null,'attributes':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x19')]||null:null,'limit':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x1a')]||null:null})[_0x084e('0xa')](function(_0x4a3964){logger[_0x084e('0xb')]('UpdateOpenchannelApplication',_0x1affe7);logger['debug'](_0x084e('0x14'),_0x1affe7,JSON[_0x084e('0x1b')](_0x4a3964));_0x446fe7(_0x4a3964);})[_0x084e('0x13')](function(_0x4d0d1f){logger[_0x084e('0x10')](_0x084e('0x14'),_0x4d0d1f[_0x084e('0x11')],_0x1affe7);_0x1dea99(_0x5e45fe[_0x084e('0x10')](0x1f4,_0x4d0d1f[_0x084e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ca88fa1..e3ddf23 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 _0x2d27=['tracked','openchannelinteraction:addtags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x47ccec,_0x613352){var _0x4224fd=function(_0x52ff22){while(--_0x52ff22){_0x47ccec['push'](_0x47ccec['shift']());}};_0x4224fd(++_0x613352);}(_0x2d27,0x8e));var _0x72d2=function(_0xf432a2,_0x2d1f98){_0xf432a2=_0xf432a2-0x0;var _0x4f5fad=_0x2d27[_0xf432a2];return _0x4f5fad;};'use strict';var multer=require('multer');var util=require(_0x72d2('0x0'));var path=require(_0x72d2('0x1'));var timeout=require(_0x72d2('0x2'));var express=require(_0x72d2('0x3'));var router=express[_0x72d2('0x4')]();var fs_extra=require(_0x72d2('0x5'));var auth=require(_0x72d2('0x6'));var interaction=require(_0x72d2('0x7'));var config=require(_0x72d2('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x72d2('0x9')]('/',auth[_0x72d2('0xa')](),controller[_0x72d2('0xb')]);router[_0x72d2('0x9')](_0x72d2('0xc'),auth[_0x72d2('0xa')](),controller[_0x72d2('0xd')]);router[_0x72d2('0x9')](_0x72d2('0xe'),auth['isAuthenticated'](),controller[_0x72d2('0xf')]);router[_0x72d2('0x9')](_0x72d2('0x10'),auth[_0x72d2('0xa')](),controller[_0x72d2('0x11')]);router[_0x72d2('0x9')](_0x72d2('0x12'),auth[_0x72d2('0xa')](),controller['download']);router[_0x72d2('0x13')]('/',auth[_0x72d2('0xa')](),controller[_0x72d2('0x14')]);router[_0x72d2('0x13')](_0x72d2('0x10'),auth[_0x72d2('0xa')](),controller[_0x72d2('0x15')]);router[_0x72d2('0x13')](_0x72d2('0x16'),auth[_0x72d2('0xa')](),interaction[_0x72d2('0x17')]('openchannel',_0x72d2('0x18')),controller['addTags']);router[_0x72d2('0x19')](_0x72d2('0xe'),auth[_0x72d2('0xa')](),interaction[_0x72d2('0x17')](_0x72d2('0x1a'),'openchannelinteraction:update'),controller[_0x72d2('0x1b')]);router[_0x72d2('0x1c')](_0x72d2('0xe'),auth['isAuthenticated'](),interaction[_0x72d2('0x17')](_0x72d2('0x1a'),_0x72d2('0x1d')),controller[_0x72d2('0x1e')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x72d2('0x1f')]);module[_0x72d2('0x20')]=router; \ No newline at end of file +var _0x3573=['addTags','put','/:id','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','download','create','post','openchannel','openchannelinteraction:addtags'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3573,0x175));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3357('0x0'));var util=require(_0x3357('0x1'));var path=require(_0x3357('0x2'));var timeout=require(_0x3357('0x3'));var express=require(_0x3357('0x4'));var router=express[_0x3357('0x5')]();var fs_extra=require(_0x3357('0x6'));var auth=require(_0x3357('0x7'));var interaction=require(_0x3357('0x8'));var config=require(_0x3357('0x9'));var controller=require(_0x3357('0xa'));router[_0x3357('0xb')]('/',auth[_0x3357('0xc')](),controller[_0x3357('0xd')]);router['get']('/describe',auth[_0x3357('0xc')](),controller[_0x3357('0xe')]);router[_0x3357('0xb')]('/:id',auth[_0x3357('0xc')](),controller[_0x3357('0xf')]);router['get'](_0x3357('0x10'),auth[_0x3357('0xc')](),controller[_0x3357('0x11')]);router['get']('/:id/download',auth[_0x3357('0xc')](),controller[_0x3357('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3357('0x13')]);router['post'](_0x3357('0x10'),auth[_0x3357('0xc')](),controller['addMessage']);router[_0x3357('0x14')]('/:id/tags',auth[_0x3357('0xc')](),interaction['tracked'](_0x3357('0x15'),_0x3357('0x16')),controller[_0x3357('0x17')]);router[_0x3357('0x18')](_0x3357('0x19'),auth[_0x3357('0xc')](),interaction[_0x3357('0x1a')](_0x3357('0x15'),_0x3357('0x1b')),controller[_0x3357('0x1c')]);router[_0x3357('0x1d')](_0x3357('0x19'),auth[_0x3357('0xc')](),interaction['tracked'](_0x3357('0x15'),_0x3357('0x1e')),controller[_0x3357('0x1f')]);router[_0x3357('0x1d')](_0x3357('0x20'),auth[_0x3357('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 953694e..9b2288a 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 _0x0de3=['DATE','STRING','ENUM','INTEGER','sequelize','exports'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x0de3,0x184));var _0x30de=function(_0x122701,_0x15dfea){_0x122701=_0x122701-0x0;var _0x18f1a2=_0x0de3[_0x122701];return _0x18f1a2;};'use strict';var Sequelize=require(_0x30de('0x0'));module[_0x30de('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x30de('0x2')]},'disposition':{'type':Sequelize[_0x30de('0x3')]},'secondDisposition':{'type':Sequelize[_0x30de('0x3')]},'thirdDisposition':{'type':Sequelize[_0x30de('0x3')]},'note':{'type':Sequelize[_0x30de('0x3')]},'read1stAt':{'type':Sequelize[_0x30de('0x2')]},'threadId':{'type':Sequelize[_0x30de('0x3')]},'externalUrl':{'type':Sequelize[_0x30de('0x3')]},'lastMsgAt':{'type':Sequelize[_0x30de('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x30de('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x30de('0x5')]}}; \ No newline at end of file +var _0x7b05=['out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x7b05,0x91));var _0x57b0=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0x7b05[_0x1fa841];return _0x384b67;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'closed':{'type':Sequelize[_0x57b0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x57b0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x57b0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x57b0('0x4')]},'read1stAt':{'type':Sequelize[_0x57b0('0x3')]},'threadId':{'type':Sequelize[_0x57b0('0x4')]},'externalUrl':{'type':Sequelize[_0x57b0('0x4')]},'lastMsgAt':{'type':Sequelize[_0x57b0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x57b0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x57b0('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x57b0('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 55343a9..eaa7516 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 _0x7b41=['length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','hasOwnProperty','order','where','pick','OpenchannelInteractionId','filter','map','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','fullname','CmContact','firstName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','User','Owner','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','Contact','lastName','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','stack','name','index','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','openchannel','query','user','catch','type','from','params','model','keys','filters','intersection','attributes','fields'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7b41,0x1d4));var _0x17b4=function(_0x2d2582,_0x37836b){_0x2d2582=_0x2d2582-0x0;var _0x2cad94=_0x7b41[_0x2d2582];return _0x2cad94;};'use strict';var rimraf=require(_0x17b4('0x0'));var zipdir=require(_0x17b4('0x1'));var moment=require(_0x17b4('0x2'));var util=require(_0x17b4('0x3'));var path=require('path');var ejs=require(_0x17b4('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x17b4('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x17b4('0x6'));var pdf=require(_0x17b4('0x7'));var logger=require(_0x17b4('0x8'))(_0x17b4('0x9'));var config=require(_0x17b4('0xa'));var db=require(_0x17b4('0xb'))['db'];config[_0x17b4('0xc')]=_[_0x17b4('0xd')](config[_0x17b4('0xc')],{'host':_0x17b4('0xe'),'port':0x18eb});var socket=require(_0x17b4('0xf'))(new Redis(config[_0x17b4('0xc')]));require(_0x17b4('0x10'))[_0x17b4('0x11')](socket);function respondWithStatusCode(_0x318a4e,_0x4483cb){_0x4483cb=_0x4483cb||0xcc;return function(_0x504bc5){if(_0x504bc5){return _0x318a4e[_0x17b4('0x12')](_0x4483cb);}return _0x318a4e[_0x17b4('0x13')](_0x4483cb)['end']();};}function respondWithResult(_0x53c93e,_0x59172f){_0x59172f=_0x59172f||0xc8;return function(_0x1bcb0f){if(_0x1bcb0f){return _0x53c93e[_0x17b4('0x13')](_0x59172f)[_0x17b4('0x14')](_0x1bcb0f);}};}function respondWithFilteredResult(_0x2f59a3,_0x5f417d){return function(_0x1af89e){if(_0x1af89e){var _0x3047ba=typeof _0x5f417d[_0x17b4('0x15')]===_0x17b4('0x16')&&typeof _0x5f417d[_0x17b4('0x17')]==='undefined';var _0x6cfbcc=_0x1af89e[_0x17b4('0x18')];var _0x2ccecc=_0x3047ba?0x0:_0x5f417d[_0x17b4('0x15')];var _0x55508e=_0x3047ba?_0x1af89e[_0x17b4('0x18')]:_0x5f417d[_0x17b4('0x15')]+_0x5f417d[_0x17b4('0x17')];var _0x31cd2e;if(_0x55508e>=_0x6cfbcc){_0x55508e=_0x6cfbcc;_0x31cd2e=0xc8;}else{_0x31cd2e=0xce;}_0x2f59a3[_0x17b4('0x13')](_0x31cd2e);return _0x2f59a3['set'](_0x17b4('0x19'),_0x2ccecc+'-'+_0x55508e+'/'+_0x6cfbcc)[_0x17b4('0x14')](_0x1af89e);}return null;};}function saveUpdates(_0x233095){return function(_0x1cfd85){if(_0x1cfd85){return _0x1cfd85[_0x17b4('0x1a')](_0x233095)[_0x17b4('0x1b')](function(_0x368a56){return _0x368a56;});}return null;};}function removeEntity(_0x88a9c6){return function(_0xd77dc5){if(_0xd77dc5){return _0xd77dc5[_0x17b4('0x1c')]()[_0x17b4('0x1b')](function(){_0x88a9c6[_0x17b4('0x13')](0xcc)[_0x17b4('0x1d')]();});}};}function handleEntityNotFound(_0x4f1e81){return function(_0x208a89){if(!_0x208a89){_0x4f1e81[_0x17b4('0x12')](0x194);}return _0x208a89;};}function handleError(_0x527fd5,_0x2fa1a7){_0x2fa1a7=_0x2fa1a7||0x1f4;return function(_0x493076){logger[_0x17b4('0x1e')](_0x493076[_0x17b4('0x1f')]);if(_0x493076[_0x17b4('0x20')]){delete _0x493076['name'];}_0x527fd5[_0x17b4('0x13')](_0x2fa1a7)['send'](_0x493076);};}exports[_0x17b4('0x21')]=function(_0x122ed8,_0x2f6e79){var _0x2ff384={};var _0x48e168=_['map'](db[_0x17b4('0x22')][_0x17b4('0x23')],function(_0x35c216){return{'name':_0x35c216[_0x17b4('0x24')],'type':_0x35c216['type'][_0x17b4('0x25')]};});_0x2ff384=qs[_0x17b4('0x26')](_0x48e168,_0x122ed8);return interaction['findAll'](_0x17b4('0x27'),_0x122ed8[_0x17b4('0x28')],_0x122ed8[_0x17b4('0x29')],_0x2ff384,_0x48e168)[_0x17b4('0x1b')](respondWithFilteredResult(_0x2f6e79,_0x2ff384))[_0x17b4('0x2a')](handleError(_0x2f6e79,null));};exports['show']=function(_0x120c5e,_0xbe2699){var _0x46ce85={};if(_0x120c5e[_0x17b4('0x28')][_0x17b4('0x2b')]&&_0x120c5e[_0x17b4('0x28')][_0x17b4('0x2b')]===_0x17b4('0x2c')){_0x46ce85[_0x17b4('0x2c')]=_0x120c5e[_0x17b4('0x2d')]['id'];}else{_0x46ce85['id']=_0x120c5e[_0x17b4('0x2d')]['id'];}var _0x1c26c6={'raw':![],'where':_0x46ce85},_0x5f1326={};_0x5f1326[_0x17b4('0x2e')]=_['keys'](db['OpenchannelInteraction'][_0x17b4('0x23')]);_0x5f1326[_0x17b4('0x28')]=_[_0x17b4('0x2f')](_0x120c5e[_0x17b4('0x28')]);_0x5f1326[_0x17b4('0x30')]=_[_0x17b4('0x31')](_0x5f1326['model'],_0x5f1326[_0x17b4('0x28')]);_0x1c26c6[_0x17b4('0x32')]=_['intersection'](_0x5f1326['model'],qs[_0x17b4('0x33')](_0x120c5e['query']['fields']));_0x1c26c6[_0x17b4('0x32')]=_0x1c26c6['attributes'][_0x17b4('0x34')]?_0x1c26c6[_0x17b4('0x32')]:_0x5f1326[_0x17b4('0x2e')];if(_0x120c5e[_0x17b4('0x28')][_0x17b4('0x35')]){_0x1c26c6[_0x17b4('0x36')]=[{'all':!![]}];}_0x1c26c6=_[_0x17b4('0x37')]({},_0x1c26c6,_0x120c5e[_0x17b4('0x38')]);return db[_0x17b4('0x22')][_0x17b4('0x39')](_0x1c26c6)[_0x17b4('0x1b')](handleEntityNotFound(_0xbe2699,null))[_0x17b4('0x1b')](respondWithResult(_0xbe2699,null))[_0x17b4('0x2a')](handleError(_0xbe2699,null));};exports[_0x17b4('0x3a')]=function(_0x549cc9,_0x24fb41){return db[_0x17b4('0x22')][_0x17b4('0x3a')](_0x549cc9[_0x17b4('0x3b')],{})[_0x17b4('0x1b')](respondWithResult(_0x24fb41,0xc9))[_0x17b4('0x2a')](handleError(_0x24fb41,null));};exports['update']=function(_0x2f97c4,_0x8b2cd2){if(_0x2f97c4['body']['id']){delete _0x2f97c4[_0x17b4('0x3b')]['id'];}return db['OpenchannelInteraction'][_0x17b4('0x39')]({'where':{'id':_0x2f97c4[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x8b2cd2,null))[_0x17b4('0x1b')](saveUpdates(_0x2f97c4[_0x17b4('0x3b')],null))[_0x17b4('0x1b')](respondWithResult(_0x8b2cd2,null))['catch'](handleError(_0x8b2cd2,null));};exports['destroy']=function(_0x4bd989,_0x170c23){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x4bd989[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x170c23,null))[_0x17b4('0x1b')](removeEntity(_0x170c23,null))['catch'](handleError(_0x170c23,null));};exports[_0x17b4('0x3c')]=function(_0x4dcf01,_0x56c155){return db[_0x17b4('0x22')][_0x17b4('0x3c')]()[_0x17b4('0x1b')](respondWithResult(_0x56c155,null))['catch'](handleError(_0x56c155,null));};exports[_0x17b4('0x3d')]=function(_0x2ecade,_0x472b5f){return db[_0x17b4('0x3e')][_0x17b4('0x39')]({'where':{'id':_0x2ecade['params']['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x472b5f,null))['then'](function(_0x2dfc4a){if(_0x2dfc4a){return _0x2dfc4a[_0x17b4('0x3d')](_0x2ecade[_0x17b4('0x3b')]['ids'],_[_0x17b4('0x3f')](_0x2ecade['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x472b5f,null))[_0x17b4('0x2a')](handleError(_0x472b5f,null));};exports[_0x17b4('0x40')]=function(_0x5af9cd,_0x3ee17e){var _0x5f0ce1={'raw':![],'where':{}};var _0x14be52={};var _0x39e819={'count':0x0,'rows':[]};return db[_0x17b4('0x22')][_0x17b4('0x41')]({'where':{'id':_0x5af9cd[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x3ee17e,null))[_0x17b4('0x1b')](function(_0x2fcd0c){if(_0x2fcd0c){_0x14be52['model']=_[_0x17b4('0x2f')](db[_0x17b4('0x3e')][_0x17b4('0x23')]);_0x14be52[_0x17b4('0x28')]=_[_0x17b4('0x2f')](_0x5af9cd[_0x17b4('0x28')]);_0x14be52[_0x17b4('0x30')]=_[_0x17b4('0x31')](_0x14be52['model'],_0x14be52[_0x17b4('0x28')]);_0x5f0ce1[_0x17b4('0x32')]=_['intersection'](_0x14be52[_0x17b4('0x2e')],qs[_0x17b4('0x33')](_0x5af9cd[_0x17b4('0x28')]['fields']));_0x5f0ce1[_0x17b4('0x32')]=_0x5f0ce1[_0x17b4('0x32')][_0x17b4('0x34')]?_0x5f0ce1[_0x17b4('0x32')]:_0x14be52[_0x17b4('0x2e')];if(!_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x42')]('nolimit')){_0x5f0ce1[_0x17b4('0x17')]=qs[_0x17b4('0x17')](_0x5af9cd['query'][_0x17b4('0x17')]);_0x5f0ce1[_0x17b4('0x15')]=qs['offset'](_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x15')]);}_0x5f0ce1[_0x17b4('0x43')]=qs['sort'](_0x5af9cd[_0x17b4('0x28')]['sort']);_0x5f0ce1[_0x17b4('0x44')]=qs['filters'](_[_0x17b4('0x45')](_0x5af9cd[_0x17b4('0x28')],_0x14be52[_0x17b4('0x30')]));_0x5f0ce1[_0x17b4('0x44')][_0x17b4('0x46')]=_0x2fcd0c['id'];if(_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x47')]){_0x5f0ce1[_0x17b4('0x44')]=_[_0x17b4('0x37')](_0x5f0ce1[_0x17b4('0x44')],{'$or':_[_0x17b4('0x48')](_0x5f0ce1['attributes'],function(_0x1493b5){var _0x14ce65={};_0x14ce65[_0x1493b5]={'$like':'%'+_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x47')]+'%'};return _0x14ce65;})});}if(_0x5af9cd[_0x17b4('0x28')]['$gte']){var _0x16ab22=_0x5af9cd[_0x17b4('0x28')]['$gte'][_0x17b4('0x49')](',');var _0x5ef3cf={};_0x5ef3cf[_0x16ab22[0x0]]={'$gte':moment(_0x16ab22[0x1])[_0x17b4('0x4a')](_0x17b4('0x4b'))};_0x5f0ce1[_0x17b4('0x44')]=_[_0x17b4('0x37')](_0x5f0ce1[_0x17b4('0x44')],_0x5ef3cf);}_0x5f0ce1=_[_0x17b4('0x37')]({},_0x5f0ce1,_0x5af9cd[_0x17b4('0x38')]);return db[_0x17b4('0x3e')][_0x17b4('0x18')]({'where':_0x5f0ce1[_0x17b4('0x44')]})[_0x17b4('0x1b')](function(_0x4e08ab){_0x39e819[_0x17b4('0x18')]=_0x4e08ab;if(_0x5af9cd['query'][_0x17b4('0x35')]){_0x5f0ce1[_0x17b4('0x36')]=[{'all':!![]}];}return db[_0x17b4('0x3e')]['findAll'](_0x5f0ce1);})['then'](function(_0x168d6c){_0x39e819[_0x17b4('0x4c')]=_0x168d6c;return _0x39e819;});}})['then'](respondWithFilteredResult(_0x3ee17e,_0x5f0ce1))[_0x17b4('0x2a')](handleError(_0x3ee17e,null));};exports['addTags']=function(_0x20c8d0,_0x113c4e){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x20c8d0['params']['id']}})['then'](handleEntityNotFound(_0x113c4e,null))[_0x17b4('0x1b')](function(_0x4359b6){if(_0x4359b6){return _0x4359b6[_0x17b4('0x4d')](_0x20c8d0[_0x17b4('0x3b')][_0x17b4('0x4e')],_[_0x17b4('0x3f')](_0x20c8d0[_0x17b4('0x3b')],['ids','id'])||{})['spread'](function(){return db[_0x17b4('0x4f')][_0x17b4('0x50')]({'attributes':['id',_0x17b4('0x20'),'color'],'where':{'id':_0x20c8d0[_0x17b4('0x3b')][_0x17b4('0x4e')]}});})[_0x17b4('0x1b')](function(_0x42229c){socket[_0x17b4('0x51')](_0x17b4('0x52'),{'id':Number(_0x20c8d0[_0x17b4('0x2d')]['id']),'tags':_0x42229c||[]});return{'id':Number(_0x20c8d0[_0x17b4('0x2d')]['id']),'tags':_0x42229c||[]};});}})['then'](respondWithResult(_0x113c4e,null))['catch'](handleError(_0x113c4e,null));};exports[_0x17b4('0x53')]=function(_0x50f7b8,_0x162fc0){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x50f7b8[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x162fc0,null))[_0x17b4('0x1b')](function(_0x2b8339){if(_0x2b8339){return _0x2b8339[_0x17b4('0x53')](_0x50f7b8[_0x17b4('0x28')][_0x17b4('0x4e')]);}})[_0x17b4('0x1b')](respondWithStatusCode(_0x162fc0,null))[_0x17b4('0x2a')](handleError(_0x162fc0,null));};exports[_0x17b4('0x54')]=function(_0x5f0316,_0x44a7e4){var _0x4c6a5e=moment()['unix']()[_0x17b4('0x55')]();var _0x42b732=path[_0x17b4('0x56')](config['root'],_0x17b4('0x57'),_0x17b4('0x58'),_0x17b4('0x59'));var _0x53dd45=path[_0x17b4('0x56')](config[_0x17b4('0x5a')],_0x17b4('0x57'),_0x17b4('0x58'),_0x17b4('0x5b'));var _0x471344=path[_0x17b4('0x56')](_0x42b732,_0x4c6a5e);var _0x223a8e=util[_0x17b4('0x4a')](_0x17b4('0x5c'),_0x5f0316[_0x17b4('0x2d')]['id'],_0x4c6a5e);var _0x44dbdc=path[_0x17b4('0x56')](_0x42b732,_0x223a8e);var _0x5bbf06=[];_0x5bbf06[_0x17b4('0x5d')]({'model':db['User'],'as':'User','attributes':['id',_0x17b4('0x5e')],'raw':!![]});_0x5bbf06[_0x17b4('0x5d')]({'model':db[_0x17b4('0x5f')],'as':'Contact','attributes':['id',_0x17b4('0x60'),'lastName'],'raw':!![]});if(_0x5f0316['query'][_0x17b4('0x5b')]){_0x5bbf06['push']({'model':db[_0x17b4('0x61')],'as':_0x17b4('0x61'),'raw':!![]});}var _0x47b6b6=[{'model':db[_0x17b4('0x3e')],'as':_0x17b4('0x62'),'attributes':['id','body',_0x17b4('0x63'),_0x17b4('0x64'),'secret',_0x17b4('0x65')],'include':_0x5bbf06}];_0x47b6b6[_0x17b4('0x5d')]({'model':db[_0x17b4('0x66')],'as':_0x17b4('0x67'),'attributes':['id',_0x17b4('0x20')]});_0x47b6b6['push']({'model':db[_0x17b4('0x68')],'as':_0x17b4('0x69'),'attributes':['id',_0x17b4('0x5e')]});return db['OpenchannelInteraction'][_0x17b4('0x39')]({'where':{'id':_0x5f0316[_0x17b4('0x2d')]['id']},'include':_0x47b6b6})['then'](handleEntityNotFound(_0x44a7e4,null))[_0x17b4('0x1b')](function(_0x643383){if(_0x643383){var _0x1b0909=_0x643383['get']({'plain':!![]});fs['mkdirSync'](_0x471344);var _0x4b16f4={'channel':_0x17b4('0x6a'),'account':_0x1b0909[_0x17b4('0x67')][_0x17b4('0x20')],'agent':_0x1b0909[_0x17b4('0x69')]?_0x1b0909[_0x17b4('0x69')][_0x17b4('0x5e')]:_0x17b4('0x6b'),'createdAt':moment(_0x1b0909[_0x17b4('0x63')])[_0x17b4('0x4a')](_0x17b4('0x4b'))['toString'](),'closedAt':_0x1b0909['closed']?moment(_0x1b0909[_0x17b4('0x6c')])[_0x17b4('0x4a')](_0x17b4('0x4b'))['toString']():'','disposition':_0x1b0909[_0x17b4('0x6d')],'visibility':_0x1b0909[_0x17b4('0x6e')]?_0x17b4('0x6f'):_0x17b4('0x70'),'messages':_(_0x1b0909['Messages'])[_0x17b4('0x47')]({'secret':![]})[_0x17b4('0x48')](function(_0x4179c7){if(_0x4179c7[_0x17b4('0x61')]){var _0x2f37c8=path[_0x17b4('0x56')](_0x53dd45,_0x4179c7[_0x17b4('0x61')][_0x17b4('0x71')]);if(fs['existsSync'](_0x2f37c8)){fs[_0x17b4('0x72')](_0x2f37c8)[_0x17b4('0x73')](fs[_0x17b4('0x74')](path['join'](_0x471344,_0x4179c7[_0x17b4('0x61')]['basename'])));}}return{'date':moment(_0x4179c7[_0x17b4('0x63')])[_0x17b4('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x17b4('0x55')](),'sender':_0x4179c7[_0x17b4('0x64')]===_0x17b4('0x75')?_0x4179c7[_0x17b4('0x68')]?_0x4179c7[_0x17b4('0x68')]['fullname']:'System':_0x4179c7['Contact'][_0x17b4('0x60')]+(_0x4179c7[_0x17b4('0x76')][_0x17b4('0x77')]?'\x20'+_0x4179c7[_0x17b4('0x76')][_0x17b4('0x77')]:''),'body':_0x4179c7[_0x17b4('0x61')]?_0x4179c7[_0x17b4('0x61')][_0x17b4('0x71')]:_0x4179c7[_0x17b4('0x3b')],'direction':_0x4179c7[_0x17b4('0x64')]==='out'?'A':'C','secret':_0x4179c7[_0x17b4('0x78')],'read':_0x4179c7['read'],'attachment':_0x4179c7[_0x17b4('0x61')]};})[_0x17b4('0x79')]()};return ejs[_0x17b4('0x7a')](path[_0x17b4('0x56')](config[_0x17b4('0x5a')],_0x17b4('0x57'),_0x17b4('0x7b'),_0x17b4('0x7c')),{'interaction':_0x4b16f4})['then'](function(_0x2b68ba){var _0x3d1e35=path['join'](_0x471344,_0x17b4('0x7d')+_0x1b0909['id']+'-'+_0x4c6a5e+_0x17b4('0x7e'));var _0x12bbe6={'path':_0x3d1e35,'channel':_0x17b4('0x6a'),'interactionId':_0x1b0909['id']};return pdf[_0x17b4('0x7f')](_0x2b68ba,_0x12bbe6);})[_0x17b4('0x1b')](function(){return new Promise(function(_0x25da4c,_0x4674d3){zipdir(_0x471344,{'saveTo':_0x44dbdc},function(_0x46f85e,_0x4ed0b3){if(_0x46f85e)return _0x4674d3(_0x46f85e);return _0x25da4c(_0x4ed0b3);});})['then'](function(){return new Promise(function(_0x137934,_0x59d108){rimraf(_0x471344,function(_0x47b8dc){if(_0x47b8dc)_0x59d108(_0x47b8dc);return _0x137934();});});})['then'](function(){return _0x44a7e4['download'](_0x44dbdc,_0x223a8e,function(_0x3393e1){if(_0x3393e1){logger['error'](_0x17b4('0x80'),_0x3393e1);}else{fs[_0x17b4('0x81')](_0x44dbdc);}});});});}else{return _0x44a7e4[_0x17b4('0x12')](0xc8);}})[_0x17b4('0x2a')](handleError(_0x44a7e4,null));}; \ No newline at end of file +var _0x6db1=['addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','Tag','emit','removeTags','download','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','push','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','existsSync','System','basename','direction','out','read','renderFile','views','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','map','OpenchannelInteraction','rawAttributes','fieldName','getOptions','openchannel','query','user','type','from','params','keys','filters','intersection','model','attributes','fields','length','include','options','find','catch','create','body','describe'];(function(_0x2c9d43,_0x12efae){var _0x1b46e3=function(_0x17c639){while(--_0x17c639){_0x2c9d43['push'](_0x2c9d43['shift']());}};_0x1b46e3(++_0x12efae);}(_0x6db1,0x12c));var _0x16db=function(_0x5a5c34,_0x52338d){_0x5a5c34=_0x5a5c34-0x0;var _0xbd439=_0x6db1[_0x5a5c34];return _0xbd439;};'use strict';var rimraf=require(_0x16db('0x0'));var zipdir=require('zip-dir');var moment=require(_0x16db('0x1'));var util=require('util');var path=require(_0x16db('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x16db('0x3'));var interaction=require(_0x16db('0x4'));var qs=require(_0x16db('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x16db('0x6'))('api');var config=require(_0x16db('0x7'));var db=require('../../mysqldb')['db'];config[_0x16db('0x8')]=_[_0x16db('0x9')](config['redis'],{'host':_0x16db('0xa'),'port':0x18eb});var socket=require(_0x16db('0xb'))(new Redis(config[_0x16db('0x8')]));require('./openchannelInteraction.socket')[_0x16db('0xc')](socket);function respondWithStatusCode(_0x16e95b,_0x4f8b8a){_0x4f8b8a=_0x4f8b8a||0xcc;return function(_0x339b21){if(_0x339b21){return _0x16e95b[_0x16db('0xd')](_0x4f8b8a);}return _0x16e95b[_0x16db('0xe')](_0x4f8b8a)['end']();};}function respondWithResult(_0x1b94b2,_0x5cd313){_0x5cd313=_0x5cd313||0xc8;return function(_0x430c8e){if(_0x430c8e){return _0x1b94b2[_0x16db('0xe')](_0x5cd313)[_0x16db('0xf')](_0x430c8e);}};}function respondWithFilteredResult(_0x10cdb0,_0x4fff4d){return function(_0x104f1d){if(_0x104f1d){var _0x58fadb=typeof _0x4fff4d[_0x16db('0x10')]===_0x16db('0x11')&&typeof _0x4fff4d[_0x16db('0x12')]==='undefined';var _0x3a109b=_0x104f1d[_0x16db('0x13')];var _0x5a2c76=_0x58fadb?0x0:_0x4fff4d['offset'];var _0x44116b=_0x58fadb?_0x104f1d[_0x16db('0x13')]:_0x4fff4d['offset']+_0x4fff4d[_0x16db('0x12')];var _0x402dce;if(_0x44116b>=_0x3a109b){_0x44116b=_0x3a109b;_0x402dce=0xc8;}else{_0x402dce=0xce;}_0x10cdb0[_0x16db('0xe')](_0x402dce);return _0x10cdb0[_0x16db('0x14')](_0x16db('0x15'),_0x5a2c76+'-'+_0x44116b+'/'+_0x3a109b)[_0x16db('0xf')](_0x104f1d);}return null;};}function saveUpdates(_0x5d43e2){return function(_0x56b061){if(_0x56b061){return _0x56b061[_0x16db('0x16')](_0x5d43e2)[_0x16db('0x17')](function(_0x333f8e){return _0x333f8e;});}return null;};}function removeEntity(_0x44d5f6){return function(_0x23889e){if(_0x23889e){return _0x23889e[_0x16db('0x18')]()[_0x16db('0x17')](function(){_0x44d5f6[_0x16db('0xe')](0xcc)[_0x16db('0x19')]();});}};}function handleEntityNotFound(_0x72dee2){return function(_0x53d7d4){if(!_0x53d7d4){_0x72dee2['sendStatus'](0x194);}return _0x53d7d4;};}function handleError(_0xed3a70,_0x5c2893){_0x5c2893=_0x5c2893||0x1f4;return function(_0x5b8a15){logger[_0x16db('0x1a')](_0x5b8a15[_0x16db('0x1b')]);if(_0x5b8a15[_0x16db('0x1c')]){delete _0x5b8a15[_0x16db('0x1c')];}_0xed3a70[_0x16db('0xe')](_0x5c2893)['send'](_0x5b8a15);};}exports['index']=function(_0x5cc781,_0x2a1fb7){var _0x5bcfa1={};var _0x735419=_[_0x16db('0x1d')](db[_0x16db('0x1e')][_0x16db('0x1f')],function(_0x233ad7){return{'name':_0x233ad7[_0x16db('0x20')],'type':_0x233ad7['type']['key']};});_0x5bcfa1=qs[_0x16db('0x21')](_0x735419,_0x5cc781);return interaction['findAll'](_0x16db('0x22'),_0x5cc781[_0x16db('0x23')],_0x5cc781[_0x16db('0x24')],_0x5bcfa1,_0x735419)[_0x16db('0x17')](respondWithFilteredResult(_0x2a1fb7,_0x5bcfa1))['catch'](handleError(_0x2a1fb7,null));};exports['show']=function(_0x4717b8,_0x598327){var _0x1fa9c0={};if(_0x4717b8[_0x16db('0x23')][_0x16db('0x25')]&&_0x4717b8['query'][_0x16db('0x25')]===_0x16db('0x26')){_0x1fa9c0[_0x16db('0x26')]=_0x4717b8[_0x16db('0x27')]['id'];}else{_0x1fa9c0['id']=_0x4717b8[_0x16db('0x27')]['id'];}var _0x2ff564={'raw':![],'where':_0x1fa9c0},_0x2e69cb={};_0x2e69cb['model']=_[_0x16db('0x28')](db[_0x16db('0x1e')][_0x16db('0x1f')]);_0x2e69cb[_0x16db('0x23')]=_['keys'](_0x4717b8['query']);_0x2e69cb[_0x16db('0x29')]=_[_0x16db('0x2a')](_0x2e69cb[_0x16db('0x2b')],_0x2e69cb['query']);_0x2ff564[_0x16db('0x2c')]=_[_0x16db('0x2a')](_0x2e69cb['model'],qs[_0x16db('0x2d')](_0x4717b8[_0x16db('0x23')]['fields']));_0x2ff564[_0x16db('0x2c')]=_0x2ff564[_0x16db('0x2c')][_0x16db('0x2e')]?_0x2ff564['attributes']:_0x2e69cb[_0x16db('0x2b')];if(_0x4717b8['query']['includeAll']){_0x2ff564[_0x16db('0x2f')]=[{'all':!![]}];}_0x2ff564=_['merge']({},_0x2ff564,_0x4717b8[_0x16db('0x30')]);return db['OpenchannelInteraction'][_0x16db('0x31')](_0x2ff564)[_0x16db('0x17')](handleEntityNotFound(_0x598327,null))[_0x16db('0x17')](respondWithResult(_0x598327,null))[_0x16db('0x32')](handleError(_0x598327,null));};exports[_0x16db('0x33')]=function(_0x5d040b,_0x4b556f){return db[_0x16db('0x1e')][_0x16db('0x33')](_0x5d040b[_0x16db('0x34')],{})[_0x16db('0x17')](respondWithResult(_0x4b556f,0xc9))[_0x16db('0x32')](handleError(_0x4b556f,null));};exports[_0x16db('0x16')]=function(_0x5a95cf,_0x4f406a){if(_0x5a95cf['body']['id']){delete _0x5a95cf['body']['id'];}return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x5a95cf[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x4f406a,null))[_0x16db('0x17')](saveUpdates(_0x5a95cf[_0x16db('0x34')],null))[_0x16db('0x17')](respondWithResult(_0x4f406a,null))[_0x16db('0x32')](handleError(_0x4f406a,null));};exports[_0x16db('0x18')]=function(_0x2e3cca,_0x1f3c1a){return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x2e3cca['params']['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x1f3c1a,null))[_0x16db('0x17')](removeEntity(_0x1f3c1a,null))['catch'](handleError(_0x1f3c1a,null));};exports[_0x16db('0x35')]=function(_0x221204,_0x2a68c0){return db['OpenchannelInteraction'][_0x16db('0x35')]()[_0x16db('0x17')](respondWithResult(_0x2a68c0,null))[_0x16db('0x32')](handleError(_0x2a68c0,null));};exports[_0x16db('0x36')]=function(_0x151638,_0x3e101c){return db[_0x16db('0x37')][_0x16db('0x31')]({'where':{'id':_0x151638[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x3e101c,null))[_0x16db('0x17')](function(_0x1ee01e){if(_0x1ee01e){return _0x1ee01e[_0x16db('0x36')](_0x151638[_0x16db('0x34')][_0x16db('0x38')],_[_0x16db('0x39')](_0x151638[_0x16db('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x3e101c,null))['catch'](handleError(_0x3e101c,null));};exports[_0x16db('0x3a')]=function(_0x3f02ba,_0x1ce3f5){var _0x136d95={'raw':![],'where':{}};var _0x3ac14b={};var _0x25e78d={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x16db('0x3b')]({'where':{'id':_0x3f02ba[_0x16db('0x27')]['id']}})['then'](handleEntityNotFound(_0x1ce3f5,null))[_0x16db('0x17')](function(_0x4509b1){if(_0x4509b1){_0x3ac14b[_0x16db('0x2b')]=_['keys'](db[_0x16db('0x37')][_0x16db('0x1f')]);_0x3ac14b[_0x16db('0x23')]=_['keys'](_0x3f02ba['query']);_0x3ac14b[_0x16db('0x29')]=_[_0x16db('0x2a')](_0x3ac14b['model'],_0x3ac14b[_0x16db('0x23')]);_0x136d95[_0x16db('0x2c')]=_[_0x16db('0x2a')](_0x3ac14b[_0x16db('0x2b')],qs[_0x16db('0x2d')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x2d')]));_0x136d95['attributes']=_0x136d95[_0x16db('0x2c')][_0x16db('0x2e')]?_0x136d95['attributes']:_0x3ac14b[_0x16db('0x2b')];if(!_0x3f02ba['query'][_0x16db('0x3c')]('nolimit')){_0x136d95[_0x16db('0x12')]=qs[_0x16db('0x12')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x12')]);_0x136d95['offset']=qs[_0x16db('0x10')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x10')]);}_0x136d95['order']=qs[_0x16db('0x3d')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x3d')]);_0x136d95[_0x16db('0x3e')]=qs['filters'](_['pick'](_0x3f02ba[_0x16db('0x23')],_0x3ac14b[_0x16db('0x29')]));_0x136d95[_0x16db('0x3e')][_0x16db('0x3f')]=_0x4509b1['id'];if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x40')]){_0x136d95['where']=_[_0x16db('0x41')](_0x136d95[_0x16db('0x3e')],{'$or':_[_0x16db('0x1d')](_0x136d95[_0x16db('0x2c')],function(_0x3b4760){var _0xeb88ec={};_0xeb88ec[_0x3b4760]={'$like':'%'+_0x3f02ba[_0x16db('0x23')][_0x16db('0x40')]+'%'};return _0xeb88ec;})});}if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x42')]){var _0x401349=_0x3f02ba['query'][_0x16db('0x42')][_0x16db('0x43')](',');var _0x51bbee={};_0x51bbee[_0x401349[0x0]]={'$gte':moment(_0x401349[0x1])[_0x16db('0x44')](_0x16db('0x45'))};_0x136d95[_0x16db('0x3e')]=_[_0x16db('0x41')](_0x136d95['where'],_0x51bbee);}_0x136d95=_[_0x16db('0x41')]({},_0x136d95,_0x3f02ba[_0x16db('0x30')]);return db[_0x16db('0x37')][_0x16db('0x13')]({'where':_0x136d95[_0x16db('0x3e')]})[_0x16db('0x17')](function(_0x259502){_0x25e78d[_0x16db('0x13')]=_0x259502;if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x46')]){_0x136d95[_0x16db('0x2f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x16db('0x47')](_0x136d95);})[_0x16db('0x17')](function(_0x3cdfe9){_0x25e78d['rows']=_0x3cdfe9;return _0x25e78d;});}})[_0x16db('0x17')](respondWithFilteredResult(_0x1ce3f5,_0x136d95))['catch'](handleError(_0x1ce3f5,null));};exports[_0x16db('0x48')]=function(_0x1fd357,_0x6ebce4){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1fd357[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x6ebce4,null))[_0x16db('0x17')](function(_0x488b38){if(_0x488b38){return _0x488b38[_0x16db('0x49')](_0x1fd357[_0x16db('0x34')]['ids'],_[_0x16db('0x39')](_0x1fd357[_0x16db('0x34')],[_0x16db('0x38'),'id'])||{})['spread'](function(){return db[_0x16db('0x4a')][_0x16db('0x47')]({'attributes':['id',_0x16db('0x1c'),'color'],'where':{'id':_0x1fd357[_0x16db('0x34')]['ids']}});})[_0x16db('0x17')](function(_0x44bd3a){socket[_0x16db('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0x1fd357['params']['id']),'tags':_0x44bd3a||[]});return{'id':Number(_0x1fd357[_0x16db('0x27')]['id']),'tags':_0x44bd3a||[]};});}})['then'](respondWithResult(_0x6ebce4,null))[_0x16db('0x32')](handleError(_0x6ebce4,null));};exports[_0x16db('0x4c')]=function(_0x2bd86d,_0x401f5a){return db['OpenchannelInteraction'][_0x16db('0x31')]({'where':{'id':_0x2bd86d[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x401f5a,null))['then'](function(_0x426268){if(_0x426268){return _0x426268[_0x16db('0x4c')](_0x2bd86d[_0x16db('0x23')][_0x16db('0x38')]);}})[_0x16db('0x17')](respondWithStatusCode(_0x401f5a,null))[_0x16db('0x32')](handleError(_0x401f5a,null));};exports[_0x16db('0x4d')]=function(_0x572bff,_0x18b886){var _0xfba94e=moment()['unix']()[_0x16db('0x4e')]();var _0x5546e4=path[_0x16db('0x4f')](config[_0x16db('0x50')],_0x16db('0x51'),'files','tmp');var _0x180ef8=path[_0x16db('0x4f')](config[_0x16db('0x50')],_0x16db('0x51'),_0x16db('0x52'),'attachments');var _0x11266d=path[_0x16db('0x4f')](_0x5546e4,_0xfba94e);var _0x335a79=util[_0x16db('0x44')](_0x16db('0x53'),_0x572bff['params']['id'],_0xfba94e);var _0x2b4f46=path[_0x16db('0x4f')](_0x5546e4,_0x335a79);var _0xb40093=[];_0xb40093['push']({'model':db['User'],'as':_0x16db('0x54'),'attributes':['id',_0x16db('0x55')],'raw':!![]});_0xb40093['push']({'model':db[_0x16db('0x56')],'as':_0x16db('0x57'),'attributes':['id',_0x16db('0x58'),_0x16db('0x59')],'raw':!![]});if(_0x572bff['query']['attachments']){_0xb40093[_0x16db('0x5a')]({'model':db[_0x16db('0x5b')],'as':_0x16db('0x5b'),'raw':!![]});}var _0x12d337=[{'model':db[_0x16db('0x37')],'as':_0x16db('0x5c'),'attributes':['id',_0x16db('0x34'),_0x16db('0x5d'),'direction',_0x16db('0x5e'),'read'],'include':_0xb40093}];_0x12d337['push']({'model':db[_0x16db('0x5f')],'as':_0x16db('0x60'),'attributes':['id','name']});_0x12d337['push']({'model':db[_0x16db('0x54')],'as':_0x16db('0x61'),'attributes':['id',_0x16db('0x55')]});return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x572bff['params']['id']},'include':_0x12d337})[_0x16db('0x17')](handleEntityNotFound(_0x18b886,null))['then'](function(_0x449922){if(_0x449922){var _0x24b6c8=_0x449922[_0x16db('0x62')]({'plain':!![]});fs[_0x16db('0x63')](_0x11266d);var _0x5d9b10={'channel':_0x16db('0x64'),'account':_0x24b6c8[_0x16db('0x60')][_0x16db('0x1c')],'agent':_0x24b6c8[_0x16db('0x61')]?_0x24b6c8[_0x16db('0x61')]['fullname']:_0x16db('0x65'),'createdAt':moment(_0x24b6c8['createdAt'])[_0x16db('0x44')](_0x16db('0x45'))['toString'](),'closedAt':_0x24b6c8[_0x16db('0x66')]?moment(_0x24b6c8[_0x16db('0x67')])[_0x16db('0x44')](_0x16db('0x45'))[_0x16db('0x4e')]():'','disposition':_0x24b6c8[_0x16db('0x68')],'visibility':_0x24b6c8['threadId']?_0x16db('0x69'):_0x16db('0x6a'),'messages':_(_0x24b6c8[_0x16db('0x5c')])['filter']({'secret':![]})[_0x16db('0x1d')](function(_0x1e9c53){if(_0x1e9c53[_0x16db('0x5b')]){var _0x3f0a4a=path[_0x16db('0x4f')](_0x180ef8,_0x1e9c53[_0x16db('0x5b')]['basename']);if(fs[_0x16db('0x6b')](_0x3f0a4a)){fs['createReadStream'](_0x3f0a4a)['pipe'](fs['createWriteStream'](path['join'](_0x11266d,_0x1e9c53['Attachment']['basename'])));}}return{'date':moment(_0x1e9c53['createdAt'])[_0x16db('0x44')](_0x16db('0x45'))[_0x16db('0x4e')](),'sender':_0x1e9c53['direction']==='out'?_0x1e9c53[_0x16db('0x54')]?_0x1e9c53[_0x16db('0x54')]['fullname']:_0x16db('0x6c'):_0x1e9c53[_0x16db('0x57')][_0x16db('0x58')]+(_0x1e9c53[_0x16db('0x57')]['lastName']?'\x20'+_0x1e9c53[_0x16db('0x57')][_0x16db('0x59')]:''),'body':_0x1e9c53[_0x16db('0x5b')]?_0x1e9c53['Attachment'][_0x16db('0x6d')]:_0x1e9c53[_0x16db('0x34')],'direction':_0x1e9c53[_0x16db('0x6e')]===_0x16db('0x6f')?'A':'C','secret':_0x1e9c53['secret'],'read':_0x1e9c53[_0x16db('0x70')],'attachment':_0x1e9c53['Attachment']};})['value']()};return ejs[_0x16db('0x71')](path[_0x16db('0x4f')](config['root'],'server',_0x16db('0x72'),'downloadInteraction.ejs'),{'interaction':_0x5d9b10})[_0x16db('0x17')](function(_0x502cae){var _0x18a1c7=path[_0x16db('0x4f')](_0x11266d,_0x16db('0x73')+_0x24b6c8['id']+'-'+_0xfba94e+'.pdf');var _0x4aeba8={'path':_0x18a1c7,'channel':_0x16db('0x64'),'interactionId':_0x24b6c8['id']};return pdf['createPdfFromHTML'](_0x502cae,_0x4aeba8);})[_0x16db('0x17')](function(){return new Promise(function(_0x510ec2,_0x189efa){zipdir(_0x11266d,{'saveTo':_0x2b4f46},function(_0x1865ff,_0xdaec6f){if(_0x1865ff)return _0x189efa(_0x1865ff);return _0x510ec2(_0xdaec6f);});})['then'](function(){return new Promise(function(_0x538002,_0x16eefd){rimraf(_0x11266d,function(_0x3be5d6){if(_0x3be5d6)_0x16eefd(_0x3be5d6);return _0x538002();});});})[_0x16db('0x17')](function(){return _0x18b886[_0x16db('0x4d')](_0x2b4f46,_0x335a79,function(_0x3a68bd){if(_0x3a68bd){logger[_0x16db('0x1a')](_0x16db('0x74'),_0x3a68bd);}else{fs[_0x16db('0x75')](_0x2b4f46);}});});});}else{return _0x18b886['sendStatus'](0xc8);}})['catch'](handleError(_0x18b886,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 96f5bff..66dbe7f 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 _0x8dcc=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','length','emit','catch','hasOwnProperty','hook'];(function(_0x304ac5,_0x365c84){var _0xee8d41=function(_0x17a814){while(--_0x17a814){_0x304ac5['push'](_0x304ac5['shift']());}};_0xee8d41(++_0x365c84);}(_0x8dcc,0x151));var _0xc8dc=function(_0x4cf8e4,_0x2a2f2f){_0x4cf8e4=_0x4cf8e4-0x0;var _0x49d46c=_0x8dcc[_0x4cf8e4];return _0x49d46c;};'use strict';var EventEmitter=require(_0xc8dc('0x0'));var OpenchannelInteraction=require(_0xc8dc('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xc8dc('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc8dc('0x2')](0x0);var events={'afterCreate':_0xc8dc('0x3'),'afterUpdate':_0xc8dc('0x4'),'afterDestroy':_0xc8dc('0x5')};function emitEvent(_0x5c439b){return function(_0x97dbc9,_0x55c43f,_0x2b56bf){_0x97dbc9[_0xc8dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc8dc('0x7')](function(_0x515a9b){_0x97dbc9[_0xc8dc('0x8')](_0xc8dc('0x9'),_0x515a9b['map'](function(_0x390381){return{'id':_0x390381['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x97dbc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc8dc('0x7')](function(_0x391253){_0x97dbc9[_0xc8dc('0x8')]('unreadMessages',_0x391253[_0xc8dc('0xa')]);OpenchannelInteractionEvents[_0xc8dc('0xb')](_0x5c439b+':'+_0x97dbc9['id'],_0x97dbc9);OpenchannelInteractionEvents[_0xc8dc('0xb')](_0x5c439b,_0x97dbc9);_0x2b56bf(null);})[_0xc8dc('0xc')](_0x2b56bf(null));};}for(var e in events){if(events[_0xc8dc('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xc8dc('0xe')](e,emitEvent(event));}}module[_0xc8dc('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6492=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','unreadMessages','emit','catch','hook','events'];(function(_0x39c5c0,_0x357dae){var _0x2e4dd4=function(_0x4a473f){while(--_0x4a473f){_0x39c5c0['push'](_0x39c5c0['shift']());}};_0x2e4dd4(++_0x357dae);}(_0x6492,0x11f));var _0x2649=function(_0x5935c6,_0x1f7127){_0x5935c6=_0x5935c6-0x0;var _0x24d6bd=_0x6492[_0x5935c6];return _0x24d6bd;};'use strict';var EventEmitter=require(_0x2649('0x0'));var OpenchannelInteraction=require(_0x2649('0x1'))['db'][_0x2649('0x2')];var OpenchannelMessage=require(_0x2649('0x1'))['db'][_0x2649('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2649('0x4')](0x0);var events={'afterCreate':_0x2649('0x5'),'afterUpdate':_0x2649('0x6'),'afterDestroy':_0x2649('0x7')};function emitEvent(_0x1951aa){return function(_0x5b8dc9,_0x424aea,_0x3659bf){_0x5b8dc9['getUsers']({'attributes':['id'],'raw':!![]})[_0x2649('0x8')](function(_0x3112ba){_0x5b8dc9['setDataValue'](_0x2649('0x9'),_0x3112ba[_0x2649('0xa')](function(_0x5b49f8){return{'id':_0x5b49f8['id']};}));return OpenchannelMessage[_0x2649('0xb')]({'where':{'OpenchannelInteractionId':_0x5b8dc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2649('0x8')](function(_0x43e9f3){_0x5b8dc9['setDataValue'](_0x2649('0xc'),_0x43e9f3['length']);OpenchannelInteractionEvents[_0x2649('0xd')](_0x1951aa+':'+_0x5b8dc9['id'],_0x5b8dc9);OpenchannelInteractionEvents['emit'](_0x1951aa,_0x5b8dc9);_0x3659bf(null);})[_0x2649('0xe')](_0x3659bf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x2649('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7e99ada..1e1dca1 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 _0x9e71=['OpenchannelInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x39f8ea,_0x35a0e4){var _0x3d9f95=function(_0x1b1aa9){while(--_0x1b1aa9){_0x39f8ea['push'](_0x39f8ea['shift']());}};_0x3d9f95(++_0x35a0e4);}(_0x9e71,0x1a8));var _0x19e7=function(_0x13508e,_0x273e9b){_0x13508e=_0x13508e-0x0;var _0x5ddb20=_0x9e71[_0x13508e];return _0x5ddb20;};'use strict';var _=require(_0x19e7('0x0'));var util=require(_0x19e7('0x1'));var logger=require('../../config/logger')(_0x19e7('0x2'));var moment=require(_0x19e7('0x3'));var BPromise=require(_0x19e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19e7('0x5'));var rimraf=require('rimraf');var config=require(_0x19e7('0x6'));var attributes=require(_0x19e7('0x7'));module[_0x19e7('0x8')]=function(_0x4aab99,_0xe99d98){return _0x4aab99[_0x19e7('0x9')](_0x19e7('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x54bcae,_0x5333af,_0x267df3){if(_0x54bcae['changed'](_0x19e7('0xb'))){_0x54bcae['closedAt']=moment()[_0x19e7('0xc')](_0x19e7('0xd'));}_0x267df3(null,_0x54bcae);}}});}; \ No newline at end of file +var _0x5f27=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x5bbb96,_0x10071d){var _0x18d362=function(_0x41af9a){while(--_0x41af9a){_0x5bbb96['push'](_0x5bbb96['shift']());}};_0x18d362(++_0x10071d);}(_0x5f27,0xd8));var _0x75f2=function(_0x260f5b,_0x43929d){_0x260f5b=_0x260f5b-0x0;var _0x301ab1=_0x5f27[_0x260f5b];return _0x301ab1;};'use strict';var _=require(_0x75f2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x75f2('0x1'));var BPromise=require(_0x75f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75f2('0x3'));var rimraf=require(_0x75f2('0x4'));var config=require(_0x75f2('0x5'));var attributes=require(_0x75f2('0x6'));module[_0x75f2('0x7')]=function(_0x1490d7,_0x1295e8){return _0x1490d7[_0x75f2('0x8')](_0x75f2('0x9'),attributes,{'tableName':_0x75f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75f2('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2bdee9,_0x4d8b2c,_0x21a663){if(_0x2bdee9['changed']('closed')){_0x2bdee9[_0x75f2('0xc')]=moment()['format'](_0x75f2('0xd'));}_0x21a663(null,_0x2bdee9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5a8116b..e4679cd 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 _0x67ad=['then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x67ad,0x6e));var _0xd67a=function(_0x356669,_0x418104){_0x356669=_0x356669-0x0;var _0x382d80=_0x67ad[_0x356669];return _0x382d80;};'use strict';var _=require(_0xd67a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd67a('0x1'));var rs=require(_0xd67a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd67a('0x3'));var logger=require(_0xd67a('0x4'))(_0xd67a('0x5'));var config=require('../../config/environment');var jayson=require(_0xd67a('0x6'));var client=jayson[_0xd67a('0x7')][_0xd67a('0x8')]({'port':0x232a});config[_0xd67a('0x9')]=_[_0xd67a('0xa')](config[_0xd67a('0x9')],{'host':_0xd67a('0xb'),'port':0x18eb});var socket=require(_0xd67a('0xc'))(new Redis(config['redis']));require(_0xd67a('0xd'))[_0xd67a('0xe')](socket);function respondWithRpcPromise(_0xeaa26b,_0x35536f,_0x1e7ac7){return new BPromise(function(_0x72b605,_0x3735b5){return client[_0xd67a('0xf')](_0xeaa26b,_0x1e7ac7)[_0xd67a('0x10')](function(_0x3ab968){logger['info'](_0xd67a('0x11'),_0x35536f,_0xd67a('0x12'));logger[_0xd67a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x35536f,_0xd67a('0x12'),JSON['stringify'](_0x3ab968));if(_0x3ab968[_0xd67a('0x14')]){if(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x15')]===0x1f4){logger[_0xd67a('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35536f,_0x3ab968['error'][_0xd67a('0x16')]);return _0x3735b5(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);}logger['error'](_0xd67a('0x11'),_0x35536f,_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);return _0x72b605(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);}else{logger[_0xd67a('0x17')](_0xd67a('0x11'),_0x35536f,_0xd67a('0x12'));_0x72b605(_0x3ab968[_0xd67a('0x18')][_0xd67a('0x16')]);}})[_0xd67a('0x19')](function(_0x12f52f){logger[_0xd67a('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35536f,_0x12f52f);_0x3735b5(_0x12f52f);});});}exports[_0xd67a('0x1a')]=function(_0x2c68dc){var _0x3a03b6=this;return new Promise(function(_0x3facbb,_0x109b81){return db[_0xd67a('0x1b')][_0xd67a('0x1c')](_0x2c68dc[_0xd67a('0x1d')],{'raw':_0x2c68dc['options']?_0x2c68dc[_0xd67a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x1f')]||null:null,'attributes':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x20')]||null:null,'limit':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x21')]||null:null})['then'](function(_0x31a78a){logger[_0xd67a('0x17')](_0xd67a('0x1a'),_0x2c68dc);logger[_0xd67a('0x13')]('UpdateOpenchannelInteraction',_0x2c68dc,JSON[_0xd67a('0x22')](_0x31a78a));_0x3facbb(_0x31a78a);})['catch'](function(_0x5d2ca4){logger[_0xd67a('0x14')](_0xd67a('0x1a'),_0x5d2ca4[_0xd67a('0x16')],_0x2c68dc);_0x109b81(_0x3a03b6[_0xd67a('0x14')](0x1f4,_0x5d2ca4['message']));});});};exports[_0xd67a('0x23')]=function(_0x8c837b){return new Promise(function(_0x113076,_0x50cf88){return db[_0xd67a('0x1b')][_0xd67a('0x24')]({'where':_0x8c837b[_0xd67a('0x1e')]?_0x8c837b[_0xd67a('0x1e')][_0xd67a('0x1f')]||null:null})[_0xd67a('0x10')](function(_0x23aacd){if(_0x23aacd){return _0x23aacd[_0xd67a('0x25')](_0x8c837b[_0xd67a('0x1d')][_0xd67a('0x26')],_[_0xd67a('0x27')](_0x8c837b[_0xd67a('0x1d')],[_0xd67a('0x26'),'id'])||{});}})[_0xd67a('0x28')](function(_0x304552){logger[_0xd67a('0x17')](_0xd67a('0x29'),_0x8c837b);logger[_0xd67a('0x13')](_0xd67a('0x29'),_0x8c837b,JSON[_0xd67a('0x22')](_0x304552));_0x113076(_0x304552);})['catch'](function(_0x488c0e){logger[_0xd67a('0x14')](_0xd67a('0x29'),_0x488c0e[_0xd67a('0x16')],_0x8c837b);_0x50cf88(_this['error'](0x1f4,_0x488c0e[_0xd67a('0x16')]));});});}; \ No newline at end of file +var _0x026a=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','redis','socket.io-emitter','register'];(function(_0x228111,_0x5eae48){var _0x31034e=function(_0x556668){while(--_0x556668){_0x228111['push'](_0x228111['shift']());}};_0x31034e(++_0x5eae48);}(_0x026a,0x1d6));var _0xa026=function(_0x481f5b,_0x1067e4){_0x481f5b=_0x481f5b-0x0;var _0x3f0179=_0x026a[_0x481f5b];return _0x3f0179;};'use strict';var _=require(_0xa026('0x0'));var util=require('util');var moment=require(_0xa026('0x1'));var BPromise=require(_0xa026('0x2'));var rs=require(_0xa026('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa026('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa026('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa026('0x6'));var client=jayson[_0xa026('0x7')]['http']({'port':0x232a});config[_0xa026('0x8')]=_['defaults'](config[_0xa026('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa026('0x9'))(new Redis(config[_0xa026('0x8')]));require('./openchannelInteraction.socket')[_0xa026('0xa')](socket);function respondWithRpcPromise(_0x547841,_0x5c23b7,_0x148997){return new BPromise(function(_0x514dd9,_0x2e116f){return client[_0xa026('0xb')](_0x547841,_0x148997)[_0xa026('0xc')](function(_0x86b7e){logger[_0xa026('0xd')](_0xa026('0xe'),_0x5c23b7,_0xa026('0xf'));logger[_0xa026('0x10')](_0xa026('0x11'),_0x5c23b7,_0xa026('0xf'),JSON[_0xa026('0x12')](_0x86b7e));if(_0x86b7e[_0xa026('0x13')]){if(_0x86b7e[_0xa026('0x13')][_0xa026('0x14')]===0x1f4){logger[_0xa026('0x13')](_0xa026('0xe'),_0x5c23b7,_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);return _0x2e116f(_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);}logger[_0xa026('0x13')](_0xa026('0xe'),_0x5c23b7,_0x86b7e[_0xa026('0x13')]['message']);return _0x514dd9(_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);}else{logger[_0xa026('0xd')](_0xa026('0xe'),_0x5c23b7,_0xa026('0xf'));_0x514dd9(_0x86b7e[_0xa026('0x16')][_0xa026('0x15')]);}})[_0xa026('0x17')](function(_0x4da156){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5c23b7,_0x4da156);_0x2e116f(_0x4da156);});});}exports[_0xa026('0x18')]=function(_0x2e59b8){var _0x50f02c=this;return new Promise(function(_0xdc68a1,_0x3c58e5){return db['OpenchannelInteraction']['update'](_0x2e59b8['body'],{'raw':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1b')]||null:null,'attributes':_0x2e59b8['options']?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1c')]||null:null,'limit':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8['options'][_0xa026('0x1d')]||null:null})[_0xa026('0xc')](function(_0xa86d4a){logger[_0xa026('0xd')]('UpdateOpenchannelInteraction',_0x2e59b8);logger[_0xa026('0x10')]('UpdateOpenchannelInteraction',_0x2e59b8,JSON[_0xa026('0x12')](_0xa86d4a));_0xdc68a1(_0xa86d4a);})[_0xa026('0x17')](function(_0x415695){logger['error'](_0xa026('0x18'),_0x415695['message'],_0x2e59b8);_0x3c58e5(_0x50f02c['error'](0x1f4,_0x415695[_0xa026('0x15')]));});});};exports[_0xa026('0x1e')]=function(_0x53e26f){return new Promise(function(_0x28de99,_0x277eb0){return db[_0xa026('0x1f')][_0xa026('0x20')]({'where':_0x53e26f[_0xa026('0x19')]?_0x53e26f[_0xa026('0x19')]['where']||null:null})[_0xa026('0xc')](function(_0x36e155){if(_0x36e155){return _0x36e155['addTags'](_0x53e26f['body'][_0xa026('0x21')],_['omit'](_0x53e26f[_0xa026('0x22')],[_0xa026('0x21'),'id'])||{});}})[_0xa026('0x23')](function(_0x2a685d){logger[_0xa026('0xd')](_0xa026('0x24'),_0x53e26f);logger[_0xa026('0x10')](_0xa026('0x24'),_0x53e26f,JSON[_0xa026('0x12')](_0x2a685d));_0x28de99(_0x2a685d);})['catch'](function(_0x53c9b8){logger[_0xa026('0x13')](_0xa026('0x24'),_0x53c9b8[_0xa026('0x15')],_0x53e26f);_0x277eb0(_this[_0xa026('0x13')](0x1f4,_0x53c9b8[_0xa026('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index becdc69..1289ca3 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 _0xf2e3=['length','openchannelInteraction:','save','update','emit','removeListener','register'];(function(_0x30b2be,_0x2e9fae){var _0x2fd24e=function(_0x18ddbf){while(--_0x18ddbf){_0x30b2be['push'](_0x30b2be['shift']());}};_0x2fd24e(++_0x2e9fae);}(_0xf2e3,0x80));var _0x3f2e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf2e3[_0x3070dc];return _0x431489;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3f2e('0x0'),'remove',_0x3f2e('0x1')];function createListener(_0x5d7754,_0x579ad7){return function(_0x3bd415){_0x579ad7[_0x3f2e('0x2')](_0x5d7754,_0x3bd415);};}function removeListener(_0x445e74,_0x2a213d){return function(){OpenchannelInteractionEvents[_0x3f2e('0x3')](_0x445e74,_0x2a213d);};}exports[_0x3f2e('0x4')]=function(_0x4fbc34){for(var _0x1dda7c=0x0,_0x473f1c=events[_0x3f2e('0x5')];_0x1dda7c<_0x473f1c;_0x1dda7c++){var _0x41eebf=events[_0x1dda7c];var _0x268fc6=createListener(_0x3f2e('0x6')+_0x41eebf,_0x4fbc34);OpenchannelInteractionEvents['on'](_0x41eebf,_0x268fc6);}}; \ No newline at end of file +var _0x32e5=['emit','removeListener','register','length','openchannelInteraction:','save','remove','update'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x32e5,0xbd));var _0x532e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x32e5[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x532e('0x0'),_0x532e('0x1'),_0x532e('0x2')];function createListener(_0x6d9d48,_0x410ee0){return function(_0x20ceea){_0x410ee0[_0x532e('0x3')](_0x6d9d48,_0x20ceea);};}function removeListener(_0x42f77d,_0x243072){return function(){OpenchannelInteractionEvents[_0x532e('0x4')](_0x42f77d,_0x243072);};}exports[_0x532e('0x5')]=function(_0x315d2d){for(var _0x40d603=0x0,_0x5b7312=events[_0x532e('0x6')];_0x40d603<_0x5b7312;_0x40d603++){var _0x53096f=events[_0x40d603];var _0x86c243=createListener(_0x532e('0x7')+_0x53096f,_0x315d2d);OpenchannelInteractionEvents['on'](_0x53096f,_0x86c243);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index cf15ace..ae34c50 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x2da811,_0x4a0a42){_0x2da811=_0x2da811-0x0;var _0xeb2f0c=_0x70e0[_0x2da811];return _0xeb2f0c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xeeca45,_0x5ce4af){var _0x366bcb=function(_0x411cd5){while(--_0x411cd5){_0xeeca45['push'](_0xeeca45['shift']());}};_0x366bcb(++_0x5ce4af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 7edfba0..5f3fcfc 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 _0x5eef=['TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eef,0x9c));var _0xf5ee=function(_0x3cf004,_0x4c7c4f){_0x3cf004=_0x3cf004-0x0;var _0x1eab5a=_0x5eef[_0x3cf004];return _0x1eab5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xf5ee('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf5ee('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf5ee('0x2')]('in',_0xf5ee('0x3')),'defaultValue':_0xf5ee('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf5ee('0x4')]},'providerName':{'type':Sequelize[_0xf5ee('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3cae=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x3cae,0x117));var _0xe3ca=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x3cae[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'body':{'type':Sequelize[_0xe3ca('0x2')](_0xe3ca('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3ca('0x5')]('in','out'),'defaultValue':_0xe3ca('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe3ca('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe3ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 38fff05..7f0e20a 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 _0xf683=['util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','offset','undefined','count','limit','status','set','Content-Range','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','includeAll','include','OpenchannelMessage','findAll','show','params','keys','options','find','body','describe','accept','openchannel','acceptMessage','UserId','agent','get','OpenchannelInteractionId','user','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','event','reject','EventManager','rejectmessage'];(function(_0x275240,_0x54de1e){var _0x370f4d=function(_0x3bac00){while(--_0x3bac00){_0x275240['push'](_0x275240['shift']());}};_0x370f4d(++_0x54de1e);}(_0xf683,0x120));var _0x3f68=function(_0x251077,_0x360a45){_0x251077=_0x251077-0x0;var _0x4943f4=_0xf683[_0x251077];return _0x4943f4;};'use strict';var util=require(_0x3f68('0x0'));var _=require(_0x3f68('0x1'));var Redis=require(_0x3f68('0x2'));var interactionService=require(_0x3f68('0x3'));var qs=require(_0x3f68('0x4'));var logger=require(_0x3f68('0x5'))(_0x3f68('0x6'));var config=require(_0x3f68('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3f68('0x8')],{'host':_0x3f68('0x9'),'port':0x18eb});var socket=require(_0x3f68('0xa'))(new Redis(config[_0x3f68('0x8')]));require(_0x3f68('0xb'))[_0x3f68('0xc')](socket);var jayson=require(_0x3f68('0xd'));var client=jayson[_0x3f68('0xe')][_0x3f68('0xf')]({'port':0x232c});var client9002=jayson[_0x3f68('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x3f68('0x5'))('openchannel-interactions');function respondWithRpcPromise(_0x1bf751,_0x1f746e,_0xe332e8,_0x28eced){return new Promise(function(_0xc41df6,_0x5e92d0){var _0x3260d8=_0x28eced||client;return _0x3260d8['request'](_0x1bf751,_0xe332e8)[_0x3f68('0x10')](function(_0xf4b885){logger[_0x3f68('0x11')](_0x3f68('0x12'),_0x1f746e,_0x3f68('0x13'));logger[_0x3f68('0x14')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1f746e,_0x3f68('0x13'),JSON[_0x3f68('0x15')](_0xf4b885));if(_0xf4b885[_0x3f68('0x16')]){if(_0xf4b885[_0x3f68('0x16')][_0x3f68('0x17')]===0x1f4){logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0xf4b885[_0x3f68('0x16')][_0x3f68('0x18')]);return _0x5e92d0(_0xf4b885[_0x3f68('0x16')][_0x3f68('0x18')]);}logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0xf4b885['error'][_0x3f68('0x18')]);return _0xc41df6(_0xf4b885[_0x3f68('0x16')]['message']);}else{logger['info'](_0x3f68('0x12'),_0x1f746e,_0x3f68('0x13'));_0xc41df6(_0xf4b885[_0x3f68('0x19')][_0x3f68('0x18')]);}})[_0x3f68('0x1a')](function(_0x3bff31){logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0x3bff31);_0x5e92d0(_0x3bff31);});});}function respondWithResult(_0xa0e29b,_0x4bf719){_0x4bf719=_0x4bf719||0xc8;return function(_0x327794){if(_0x327794){return _0xa0e29b['status'](_0x4bf719)['json'](_0x327794);}};}function respondWithFilteredResult(_0x5c164e,_0x14d825){return function(_0x100e02){if(_0x100e02){var _0x15a833=typeof _0x14d825[_0x3f68('0x1b')]==='undefined'&&typeof _0x14d825['limit']===_0x3f68('0x1c');var _0x137414=_0x100e02[_0x3f68('0x1d')];var _0x338ae1=_0x15a833?0x0:_0x14d825[_0x3f68('0x1b')];var _0x4c6e87=_0x15a833?_0x100e02['count']:_0x14d825['offset']+_0x14d825[_0x3f68('0x1e')];var _0x57a912;if(_0x4c6e87>=_0x137414){_0x4c6e87=_0x137414;_0x57a912=0xc8;}else{_0x57a912=0xce;}_0x5c164e[_0x3f68('0x1f')](_0x57a912);return _0x5c164e[_0x3f68('0x20')](_0x3f68('0x21'),_0x338ae1+'-'+_0x4c6e87+'/'+_0x137414)['json'](_0x100e02);}return null;};}function saveUpdates(_0x2849ef){return function(_0x196ed3){if(_0x196ed3){return _0x196ed3[_0x3f68('0x22')](_0x2849ef)[_0x3f68('0x10')](function(_0x4a879f){return _0x4a879f;});}return null;};}function removeEntity(_0x42335c){return function(_0x59e7fe){if(_0x59e7fe){return _0x59e7fe[_0x3f68('0x23')]()[_0x3f68('0x10')](function(){_0x42335c[_0x3f68('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1712d6){return function(_0x5ccf35){if(!_0x5ccf35){_0x1712d6['sendStatus'](0x194);}return _0x5ccf35;};}function handleError(_0x2d3c1b,_0x31d89b){_0x31d89b=_0x31d89b||0x1f4;return function(_0x57884d){logger[_0x3f68('0x16')](_0x57884d['stack']);if(_0x57884d['name']){delete _0x57884d[_0x3f68('0x24')];}_0x2d3c1b[_0x3f68('0x1f')](_0x31d89b)[_0x3f68('0x25')](_0x57884d);};}exports[_0x3f68('0x26')]=function(_0x20665b,_0xa707d5){var _0x9132ec={},_0x467c8f={},_0x237846={'count':0x0,'rows':[]};var _0x9bdf89=_[_0x3f68('0x27')](db['OpenchannelMessage'][_0x3f68('0x28')],function(_0x2f6592){return{'name':_0x2f6592[_0x3f68('0x29')],'type':_0x2f6592[_0x3f68('0x2a')][_0x3f68('0x2b')]};});_0x467c8f[_0x3f68('0x2c')]=_[_0x3f68('0x27')](_0x9bdf89,_0x3f68('0x24'));_0x467c8f['query']=_['keys'](_0x20665b[_0x3f68('0x2d')]);_0x467c8f['filters']=_[_0x3f68('0x2e')](_0x467c8f[_0x3f68('0x2c')],_0x467c8f[_0x3f68('0x2d')]);_0x9132ec['attributes']=_[_0x3f68('0x2e')](_0x467c8f[_0x3f68('0x2c')],qs[_0x3f68('0x2f')](_0x20665b['query'][_0x3f68('0x2f')]));_0x9132ec[_0x3f68('0x30')]=_0x9132ec[_0x3f68('0x30')][_0x3f68('0x31')]?_0x9132ec['attributes']:_0x467c8f[_0x3f68('0x2c')];if(!_0x20665b[_0x3f68('0x2d')]['hasOwnProperty'](_0x3f68('0x32'))){_0x9132ec['limit']=qs[_0x3f68('0x1e')](_0x20665b[_0x3f68('0x2d')][_0x3f68('0x1e')]);_0x9132ec['offset']=qs[_0x3f68('0x1b')](_0x20665b[_0x3f68('0x2d')][_0x3f68('0x1b')]);}_0x9132ec[_0x3f68('0x33')]=qs[_0x3f68('0x34')](_0x20665b['query'][_0x3f68('0x34')]);_0x9132ec[_0x3f68('0x35')]=qs[_0x3f68('0x36')](_['pick'](_0x20665b[_0x3f68('0x2d')],_0x467c8f[_0x3f68('0x36')]),_0x9bdf89);if(_0x20665b[_0x3f68('0x2d')][_0x3f68('0x37')]){_0x9132ec['where']=_['merge'](_0x9132ec['where'],{'$or':_[_0x3f68('0x27')](_0x9bdf89,function(_0x37e595){if(_0x37e595[_0x3f68('0x2a')]!=='VIRTUAL'){var _0x3c4799={};_0x3c4799[_0x37e595[_0x3f68('0x24')]]={'$like':'%'+_0x20665b[_0x3f68('0x2d')][_0x3f68('0x37')]+'%'};return _0x3c4799;}})});}_0x9132ec=_[_0x3f68('0x38')]({},_0x9132ec,_0x20665b['options']);var _0x27a203={'where':_0x9132ec['where']};return db['OpenchannelMessage']['count'](_0x27a203)[_0x3f68('0x10')](function(_0x1f2bd5){_0x237846[_0x3f68('0x1d')]=_0x1f2bd5;if(_0x20665b['query'][_0x3f68('0x39')]){_0x9132ec[_0x3f68('0x3a')]=[{'all':!![]}];}return db[_0x3f68('0x3b')][_0x3f68('0x3c')](_0x9132ec);})[_0x3f68('0x10')](function(_0x3606bf){_0x237846['rows']=_0x3606bf;return _0x237846;})[_0x3f68('0x10')](respondWithFilteredResult(_0xa707d5,_0x9132ec))[_0x3f68('0x1a')](handleError(_0xa707d5,null));};exports[_0x3f68('0x3d')]=function(_0x2f8263,_0x53ab46){var _0x348e54={'raw':!![],'where':{'id':_0x2f8263[_0x3f68('0x3e')]['id']}},_0x18b0c9={};_0x18b0c9['model']=_[_0x3f68('0x3f')](db[_0x3f68('0x3b')][_0x3f68('0x28')]);_0x18b0c9[_0x3f68('0x2d')]=_[_0x3f68('0x3f')](_0x2f8263['query']);_0x18b0c9['filters']=_[_0x3f68('0x2e')](_0x18b0c9['model'],_0x18b0c9[_0x3f68('0x2d')]);_0x348e54[_0x3f68('0x30')]=_[_0x3f68('0x2e')](_0x18b0c9['model'],qs[_0x3f68('0x2f')](_0x2f8263[_0x3f68('0x2d')][_0x3f68('0x2f')]));_0x348e54[_0x3f68('0x30')]=_0x348e54[_0x3f68('0x30')][_0x3f68('0x31')]?_0x348e54['attributes']:_0x18b0c9[_0x3f68('0x2c')];if(_0x2f8263[_0x3f68('0x2d')]['includeAll']){_0x348e54[_0x3f68('0x3a')]=[{'all':!![]}];}_0x348e54=_['merge']({},_0x348e54,_0x2f8263[_0x3f68('0x40')]);return db['OpenchannelMessage'][_0x3f68('0x41')](_0x348e54)[_0x3f68('0x10')](handleEntityNotFound(_0x53ab46,null))[_0x3f68('0x10')](respondWithResult(_0x53ab46,null))[_0x3f68('0x1a')](handleError(_0x53ab46,null));};exports['create']=function(_0x44de51,_0x3af5a7){return db[_0x3f68('0x3b')]['create'](_0x44de51[_0x3f68('0x42')],{})[_0x3f68('0x10')](respondWithResult(_0x3af5a7,0xc9))['catch'](handleError(_0x3af5a7,null));};exports[_0x3f68('0x22')]=function(_0x472a33,_0x54761d){if(_0x472a33[_0x3f68('0x42')]['id']){delete _0x472a33['body']['id'];}return db['OpenchannelMessage'][_0x3f68('0x41')]({'where':{'id':_0x472a33[_0x3f68('0x3e')]['id']}})[_0x3f68('0x10')](handleEntityNotFound(_0x54761d,null))[_0x3f68('0x10')](saveUpdates(_0x472a33[_0x3f68('0x42')],null))[_0x3f68('0x10')](respondWithResult(_0x54761d,null))['catch'](handleError(_0x54761d,null));};exports[_0x3f68('0x23')]=function(_0x1c9d28,_0xf0b22c){return db[_0x3f68('0x3b')][_0x3f68('0x41')]({'where':{'id':_0x1c9d28[_0x3f68('0x3e')]['id']}})[_0x3f68('0x10')](handleEntityNotFound(_0xf0b22c,null))[_0x3f68('0x10')](removeEntity(_0xf0b22c,null))[_0x3f68('0x1a')](handleError(_0xf0b22c,null));};exports[_0x3f68('0x43')]=function(_0x402ad9,_0x5b947b){return db[_0x3f68('0x3b')][_0x3f68('0x43')]()['then'](respondWithResult(_0x5b947b,null))['catch'](handleError(_0x5b947b,null));};exports[_0x3f68('0x44')]=function(_0x66bb88,_0x3c7f32){var _0x38cd4f=_0x3f68('0x45');return interactionService[_0x3f68('0x46')](_0x66bb88,_0x38cd4f)['then'](respondWithResult(_0x3c7f32,null))['catch'](handleError(_0x3c7f32,null));};exports['reject']=function(_0xa15d74,_0x19b5f0){var _0x592d3d={'agent':{},'channel':'openchannel'};if(_0xa15d74[_0x3f68('0x42')]['id']){delete _0xa15d74[_0x3f68('0x42')]['id'];}_0xa15d74['body']['UserId']=_0xa15d74[_0x3f68('0x42')][_0x3f68('0x47')]||_0xa15d74['user']['id'];_0x592d3d[_0x3f68('0x48')]['id']=_0xa15d74['body'][_0x3f68('0x47')];return db['OpenchannelMessage'][_0x3f68('0x41')]({'where':{'id':_0xa15d74[_0x3f68('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19b5f0,null))[_0x3f68('0x10')](function(_0x1a3e3e){if(_0x1a3e3e){_0x592d3d[_0x3f68('0x18')]=_0x1a3e3e[_0x3f68('0x49')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3f68('0x41')]({'where':{'id':_0x1a3e3e[_0x3f68('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0x19b5f0,null))[_0x3f68('0x10')](function(_0x58fe63){if(_0x58fe63){_0x592d3d['interaction']=_0x58fe63[_0x3f68('0x49')]({'plain':!![]});interaction_log[_0x3f68('0x11')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa15d74[_0x3f68('0x4b')]['id'],_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x24')],_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x4c')],_0x592d3d['interaction']['id'],_0xa15d74[_0x3f68('0x42')]?JSON[_0x3f68('0x15')](_0xa15d74[_0x3f68('0x42')]):_0x3f68('0x4d'));return respondWithRpcPromise(_0x3f68('0x4e'),'rejectMessage',_0x592d3d);}return null;})[_0x3f68('0x10')](function(_0x1d8c6f){var _0x72e6a7=_0x3f68('0x4f')+_0x1d8c6f[_0x3f68('0x18')][_0x3f68('0x50')];return db[_0x3f68('0x51')][_0x3f68('0x2d')](_0x72e6a7,{'type':db[_0x3f68('0x52')][_0x3f68('0x53')][_0x3f68('0x54')],'raw':!![]})['then'](function(_0x224e08){return _0x224e08;});})[_0x3f68('0x10')](function(_0x34c203){if(_0x34c203){_0x592d3d[_0x3f68('0x18')][_0x3f68('0x55')]=_0x34c203[0x0];if(!_0xa15d74['body']['UserId'])return;return db[_0x3f68('0x56')]['find']({'where':{'id':_0xa15d74['body'][_0x3f68('0x47')],'role':'agent'},'attributes':['id',_0x3f68('0x24'),_0x3f68('0x57'),'email',_0x3f68('0x58')],'raw':!![]});}return null;})[_0x3f68('0x10')](function(_0x6e82){if(!_0x6e82)return null;_0x592d3d[_0x3f68('0x18')][_0x3f68('0x48')]=_0x6e82;return _0x592d3d;})[_0x3f68('0x10')](function(_0x2b8144){if(_0x2b8144){_0x2b8144[_0x3f68('0x18')][_0x3f68('0x59')]=util['format'](_0x3f68('0x5a'),_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x24')]);_0x2b8144['message'][_0x3f68('0x5b')]=_0x592d3d[_0x3f68('0x5b')];_0x2b8144[_0x3f68('0x18')]['motionChannel']=_0x592d3d[_0x3f68('0x5b')];_0x2b8144['message'][_0x3f68('0x5c')]=_0x3f68('0x5d');respondWithRpcPromise(_0x3f68('0x5e'),_0x3f68('0x5e'),{'event':_0x3f68('0x5f'),'message':_0x2b8144[_0x3f68('0x18')]},client9002);return _0x592d3d;}return null;})[_0x3f68('0x10')](respondWithResult(_0x19b5f0,null))[_0x3f68('0x1a')](handleError(_0x19b5f0,null));}; \ No newline at end of file +var _0xf43f=['client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','OpenchannelMessage','findAll','rows','params','keys','includeAll','include','options','find','create','body','describe','acceptMessage','reject','openchannel','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','util','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','http'];(function(_0x515dcc,_0x1e7059){var _0x2993bf=function(_0x530a73){while(--_0x530a73){_0x515dcc['push'](_0x515dcc['shift']());}};_0x2993bf(++_0x1e7059);}(_0xf43f,0x1d0));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xff43('0x0'));var _=require('lodash');var Redis=require(_0xff43('0x1'));var interactionService=require(_0xff43('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff43('0x3'))('api');var config=require(_0xff43('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xff43('0x5')](config[_0xff43('0x6')],{'host':_0xff43('0x7'),'port':0x18eb});var socket=require(_0xff43('0x8'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xff43('0x9')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xff43('0xa')]({'port':0x232c});var client9002=jayson[_0xff43('0xb')][_0xff43('0xa')]({'port':0x232a});var interaction_log=require(_0xff43('0x3'))('openchannel-interactions');function respondWithRpcPromise(_0x52bd4b,_0x53f4bd,_0x21be63,_0x5d8960){return new Promise(function(_0x13f290,_0xc87b50){var _0x110a4a=_0x5d8960||client;return _0x110a4a[_0xff43('0xc')](_0x52bd4b,_0x21be63)[_0xff43('0xd')](function(_0x836717){logger[_0xff43('0xe')](_0xff43('0xf'),_0x53f4bd,_0xff43('0x10'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x53f4bd,_0xff43('0x10'),JSON[_0xff43('0x11')](_0x836717));if(_0x836717[_0xff43('0x12')]){if(_0x836717[_0xff43('0x12')]['code']===0x1f4){logger[_0xff43('0x12')](_0xff43('0xf'),_0x53f4bd,_0x836717[_0xff43('0x12')][_0xff43('0x13')]);return _0xc87b50(_0x836717[_0xff43('0x12')][_0xff43('0x13')]);}logger['error'](_0xff43('0xf'),_0x53f4bd,_0x836717[_0xff43('0x12')][_0xff43('0x13')]);return _0x13f290(_0x836717[_0xff43('0x12')]['message']);}else{logger[_0xff43('0xe')]('OpenchannelMessage,\x20%s,\x20%s',_0x53f4bd,_0xff43('0x10'));_0x13f290(_0x836717[_0xff43('0x14')][_0xff43('0x13')]);}})[_0xff43('0x15')](function(_0x171fc9){logger['error'](_0xff43('0xf'),_0x53f4bd,_0x171fc9);_0xc87b50(_0x171fc9);});});}function respondWithResult(_0x5eb4f7,_0x29c1b5){_0x29c1b5=_0x29c1b5||0xc8;return function(_0x291013){if(_0x291013){return _0x5eb4f7['status'](_0x29c1b5)[_0xff43('0x16')](_0x291013);}};}function respondWithFilteredResult(_0x5c6c1a,_0x4ae9f2){return function(_0x20c8bb){if(_0x20c8bb){var _0x12512a=typeof _0x4ae9f2[_0xff43('0x17')]===_0xff43('0x18')&&typeof _0x4ae9f2[_0xff43('0x19')]===_0xff43('0x18');var _0xcaa824=_0x20c8bb[_0xff43('0x1a')];var _0x51727b=_0x12512a?0x0:_0x4ae9f2[_0xff43('0x17')];var _0x2afb7b=_0x12512a?_0x20c8bb[_0xff43('0x1a')]:_0x4ae9f2[_0xff43('0x17')]+_0x4ae9f2[_0xff43('0x19')];var _0x26ad75;if(_0x2afb7b>=_0xcaa824){_0x2afb7b=_0xcaa824;_0x26ad75=0xc8;}else{_0x26ad75=0xce;}_0x5c6c1a[_0xff43('0x1b')](_0x26ad75);return _0x5c6c1a[_0xff43('0x1c')](_0xff43('0x1d'),_0x51727b+'-'+_0x2afb7b+'/'+_0xcaa824)[_0xff43('0x16')](_0x20c8bb);}return null;};}function saveUpdates(_0x4b8254){return function(_0x532654){if(_0x532654){return _0x532654[_0xff43('0x1e')](_0x4b8254)[_0xff43('0xd')](function(_0x2ca5cb){return _0x2ca5cb;});}return null;};}function removeEntity(_0x437cc7){return function(_0x19ab9c){if(_0x19ab9c){return _0x19ab9c[_0xff43('0x1f')]()['then'](function(){_0x437cc7[_0xff43('0x1b')](0xcc)[_0xff43('0x20')]();});}};}function handleEntityNotFound(_0x553f2c){return function(_0x2e8386){if(!_0x2e8386){_0x553f2c[_0xff43('0x21')](0x194);}return _0x2e8386;};}function handleError(_0xafeadf,_0x3be2e4){_0x3be2e4=_0x3be2e4||0x1f4;return function(_0x215027){logger[_0xff43('0x12')](_0x215027[_0xff43('0x22')]);if(_0x215027[_0xff43('0x23')]){delete _0x215027[_0xff43('0x23')];}_0xafeadf[_0xff43('0x1b')](_0x3be2e4)['send'](_0x215027);};}exports['index']=function(_0x18d9b4,_0x54369f){var _0x5633fa={},_0x286fff={},_0x31ee35={'count':0x0,'rows':[]};var _0x25f9d4=_[_0xff43('0x24')](db['OpenchannelMessage'][_0xff43('0x25')],function(_0x248b07){return{'name':_0x248b07[_0xff43('0x26')],'type':_0x248b07['type'][_0xff43('0x27')]};});_0x286fff[_0xff43('0x28')]=_[_0xff43('0x24')](_0x25f9d4,_0xff43('0x23'));_0x286fff[_0xff43('0x29')]=_['keys'](_0x18d9b4[_0xff43('0x29')]);_0x286fff['filters']=_[_0xff43('0x2a')](_0x286fff['model'],_0x286fff[_0xff43('0x29')]);_0x5633fa[_0xff43('0x2b')]=_[_0xff43('0x2a')](_0x286fff[_0xff43('0x28')],qs[_0xff43('0x2c')](_0x18d9b4[_0xff43('0x29')][_0xff43('0x2c')]));_0x5633fa[_0xff43('0x2b')]=_0x5633fa[_0xff43('0x2b')][_0xff43('0x2d')]?_0x5633fa[_0xff43('0x2b')]:_0x286fff['model'];if(!_0x18d9b4['query'][_0xff43('0x2e')](_0xff43('0x2f'))){_0x5633fa[_0xff43('0x19')]=qs[_0xff43('0x19')](_0x18d9b4['query'][_0xff43('0x19')]);_0x5633fa[_0xff43('0x17')]=qs['offset'](_0x18d9b4[_0xff43('0x29')][_0xff43('0x17')]);}_0x5633fa[_0xff43('0x30')]=qs[_0xff43('0x31')](_0x18d9b4['query']['sort']);_0x5633fa['where']=qs[_0xff43('0x32')](_[_0xff43('0x33')](_0x18d9b4[_0xff43('0x29')],_0x286fff[_0xff43('0x32')]),_0x25f9d4);if(_0x18d9b4[_0xff43('0x29')][_0xff43('0x34')]){_0x5633fa['where']=_[_0xff43('0x35')](_0x5633fa[_0xff43('0x36')],{'$or':_[_0xff43('0x24')](_0x25f9d4,function(_0x36ffb8){if(_0x36ffb8['type']!=='VIRTUAL'){var _0x420e25={};_0x420e25[_0x36ffb8[_0xff43('0x23')]]={'$like':'%'+_0x18d9b4[_0xff43('0x29')]['filter']+'%'};return _0x420e25;}})});}_0x5633fa=_[_0xff43('0x35')]({},_0x5633fa,_0x18d9b4['options']);var _0x1c45a5={'where':_0x5633fa[_0xff43('0x36')]};return db[_0xff43('0x37')][_0xff43('0x1a')](_0x1c45a5)[_0xff43('0xd')](function(_0x3924be){_0x31ee35[_0xff43('0x1a')]=_0x3924be;if(_0x18d9b4['query']['includeAll']){_0x5633fa['include']=[{'all':!![]}];}return db[_0xff43('0x37')][_0xff43('0x38')](_0x5633fa);})[_0xff43('0xd')](function(_0x4d752b){_0x31ee35[_0xff43('0x39')]=_0x4d752b;return _0x31ee35;})['then'](respondWithFilteredResult(_0x54369f,_0x5633fa))['catch'](handleError(_0x54369f,null));};exports['show']=function(_0x336825,_0x3d1a76){var _0x5dfcfb={'raw':!![],'where':{'id':_0x336825[_0xff43('0x3a')]['id']}},_0x25b4d4={};_0x25b4d4[_0xff43('0x28')]=_[_0xff43('0x3b')](db[_0xff43('0x37')][_0xff43('0x25')]);_0x25b4d4[_0xff43('0x29')]=_[_0xff43('0x3b')](_0x336825[_0xff43('0x29')]);_0x25b4d4[_0xff43('0x32')]=_[_0xff43('0x2a')](_0x25b4d4['model'],_0x25b4d4[_0xff43('0x29')]);_0x5dfcfb[_0xff43('0x2b')]=_['intersection'](_0x25b4d4[_0xff43('0x28')],qs['fields'](_0x336825[_0xff43('0x29')][_0xff43('0x2c')]));_0x5dfcfb[_0xff43('0x2b')]=_0x5dfcfb[_0xff43('0x2b')]['length']?_0x5dfcfb[_0xff43('0x2b')]:_0x25b4d4['model'];if(_0x336825[_0xff43('0x29')][_0xff43('0x3c')]){_0x5dfcfb[_0xff43('0x3d')]=[{'all':!![]}];}_0x5dfcfb=_[_0xff43('0x35')]({},_0x5dfcfb,_0x336825[_0xff43('0x3e')]);return db[_0xff43('0x37')][_0xff43('0x3f')](_0x5dfcfb)[_0xff43('0xd')](handleEntityNotFound(_0x3d1a76,null))[_0xff43('0xd')](respondWithResult(_0x3d1a76,null))[_0xff43('0x15')](handleError(_0x3d1a76,null));};exports[_0xff43('0x40')]=function(_0x1b354e,_0x223646){return db[_0xff43('0x37')]['create'](_0x1b354e['body'],{})[_0xff43('0xd')](respondWithResult(_0x223646,0xc9))[_0xff43('0x15')](handleError(_0x223646,null));};exports[_0xff43('0x1e')]=function(_0x13a3eb,_0x139d9a){if(_0x13a3eb[_0xff43('0x41')]['id']){delete _0x13a3eb[_0xff43('0x41')]['id'];}return db[_0xff43('0x37')][_0xff43('0x3f')]({'where':{'id':_0x13a3eb[_0xff43('0x3a')]['id']}})['then'](handleEntityNotFound(_0x139d9a,null))[_0xff43('0xd')](saveUpdates(_0x13a3eb[_0xff43('0x41')],null))['then'](respondWithResult(_0x139d9a,null))[_0xff43('0x15')](handleError(_0x139d9a,null));};exports[_0xff43('0x1f')]=function(_0x75ae5f,_0x5bf5b1){return db[_0xff43('0x37')]['find']({'where':{'id':_0x75ae5f[_0xff43('0x3a')]['id']}})[_0xff43('0xd')](handleEntityNotFound(_0x5bf5b1,null))[_0xff43('0xd')](removeEntity(_0x5bf5b1,null))[_0xff43('0x15')](handleError(_0x5bf5b1,null));};exports['describe']=function(_0x163823,_0x32793a){return db[_0xff43('0x37')][_0xff43('0x42')]()[_0xff43('0xd')](respondWithResult(_0x32793a,null))[_0xff43('0x15')](handleError(_0x32793a,null));};exports['accept']=function(_0x244ba7,_0x2a7a38){var _0x2c2402='openchannel';return interactionService[_0xff43('0x43')](_0x244ba7,_0x2c2402)[_0xff43('0xd')](respondWithResult(_0x2a7a38,null))[_0xff43('0x15')](handleError(_0x2a7a38,null));};exports[_0xff43('0x44')]=function(_0x2fd47d,_0xb7eb87){var _0x35db45={'agent':{},'channel':_0xff43('0x45')};if(_0x2fd47d[_0xff43('0x41')]['id']){delete _0x2fd47d[_0xff43('0x41')]['id'];}_0x2fd47d['body'][_0xff43('0x46')]=_0x2fd47d[_0xff43('0x41')][_0xff43('0x46')]||_0x2fd47d[_0xff43('0x47')]['id'];_0x35db45[_0xff43('0x48')]['id']=_0x2fd47d['body'][_0xff43('0x46')];return db['OpenchannelMessage'][_0xff43('0x3f')]({'where':{'id':_0x2fd47d[_0xff43('0x3a')]['id'],'UserId':null}})[_0xff43('0xd')](handleEntityNotFound(_0xb7eb87,null))[_0xff43('0xd')](function(_0x13befb){if(_0x13befb){_0x35db45[_0xff43('0x13')]=_0x13befb['get']({'plain':!![]});return db[_0xff43('0x49')][_0xff43('0x3f')]({'where':{'id':_0x13befb[_0xff43('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0xb7eb87,null))['then'](function(_0x53bda1){if(_0x53bda1){_0x35db45[_0xff43('0x4b')]=_0x53bda1['get']({'plain':!![]});interaction_log[_0xff43('0xe')](_0xff43('0x4c'),_0x2fd47d[_0xff43('0x47')]['id'],_0x2fd47d[_0xff43('0x47')][_0xff43('0x23')],_0x2fd47d[_0xff43('0x47')][_0xff43('0x4d')],_0x35db45['interaction']['id'],_0x2fd47d['body']?JSON['stringify'](_0x2fd47d[_0xff43('0x41')]):_0xff43('0x4e'));return respondWithRpcPromise(_0xff43('0x4f'),'rejectMessage',_0x35db45);}return null;})[_0xff43('0xd')](function(_0x3d5f61){var _0x4ae617=_0xff43('0x50')+_0x3d5f61[_0xff43('0x13')]['ContactId'];return db[_0xff43('0x51')][_0xff43('0x29')](_0x4ae617,{'type':db['Sequelize']['QueryTypes'][_0xff43('0x52')],'raw':!![]})['then'](function(_0x4a70e6){return _0x4a70e6;});})[_0xff43('0xd')](function(_0x11e9a5){if(_0x11e9a5){_0x35db45[_0xff43('0x13')][_0xff43('0x53')]=_0x11e9a5[0x0];if(!_0x2fd47d[_0xff43('0x41')][_0xff43('0x46')])return;return db[_0xff43('0x54')][_0xff43('0x3f')]({'where':{'id':_0x2fd47d['body'][_0xff43('0x46')],'role':_0xff43('0x48')},'attributes':['id',_0xff43('0x23'),_0xff43('0x55'),_0xff43('0x56'),_0xff43('0x57')],'raw':!![]});}return null;})[_0xff43('0xd')](function(_0x5b39cd){if(!_0x5b39cd)return null;_0x35db45[_0xff43('0x13')][_0xff43('0x48')]=_0x5b39cd;return _0x35db45;})['then'](function(_0x1fe60f){if(_0x1fe60f){_0x1fe60f['message'][_0xff43('0x58')]=util[_0xff43('0x59')](_0xff43('0x5a'),_0x2fd47d[_0xff43('0x47')]['name']);_0x1fe60f['message'][_0xff43('0x5b')]=_0x35db45['channel'];_0x1fe60f['message'][_0xff43('0x5c')]=_0x35db45[_0xff43('0x5b')];_0x1fe60f[_0xff43('0x13')][_0xff43('0x5d')]=_0xff43('0x44');respondWithRpcPromise(_0xff43('0x5e'),_0xff43('0x5e'),{'event':'rejectmessage','message':_0x1fe60f[_0xff43('0x13')]},client9002);return _0x35db45;}return null;})[_0xff43('0xd')](respondWithResult(_0xb7eb87,null))[_0xff43('0x15')](handleError(_0xb7eb87,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cc5b13b..976308e 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 _0x42a3=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3fd026,_0x244702){var _0x4b7eb4=function(_0xb94089){while(--_0xb94089){_0x3fd026['push'](_0x3fd026['shift']());}};_0x4b7eb4(++_0x244702);}(_0x42a3,0x1d6));var _0x342a=function(_0x29db8b,_0x2913e2){_0x29db8b=_0x29db8b-0x0;var _0x2eb005=_0x42a3[_0x29db8b];return _0x2eb005;};'use strict';var EventEmitter=require(_0x342a('0x0'));var OpenchannelMessage=require(_0x342a('0x1'))['db'][_0x342a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x342a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x342a('0x4'),'afterDestroy':_0x342a('0x5')};function emitEvent(_0x20f4de){return function(_0x2e5725,_0x4cb811,_0x20c8fb){OpenchannelMessageEvents[_0x342a('0x6')](_0x20f4de+':'+_0x2e5725['id'],_0x2e5725);OpenchannelMessageEvents[_0x342a('0x6')](_0x20f4de,_0x2e5725);_0x20c8fb(null);};}for(var e in events){if(events[_0x342a('0x7')](e)){var event=events[e];OpenchannelMessage[_0x342a('0x8')](e,emitEvent(event));}}module[_0x342a('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x745a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x31ec70,_0x1e44d4){var _0x2c8719=function(_0x4aa35e){while(--_0x4aa35e){_0x31ec70['push'](_0x31ec70['shift']());}};_0x2c8719(++_0x1e44d4);}(_0x745a,0x15d));var _0xa745=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x745a[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0xa745('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xa745('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa745('0x2'),'afterUpdate':_0xa745('0x3'),'afterDestroy':_0xa745('0x4')};function emitEvent(_0x4580d0){return function(_0xef0c5f,_0x1a6957,_0x5dac8c){OpenchannelMessageEvents[_0xa745('0x5')](_0x4580d0+':'+_0xef0c5f['id'],_0xef0c5f);OpenchannelMessageEvents[_0xa745('0x5')](_0x4580d0,_0xef0c5f);_0x5dac8c(null);};}for(var e in events){if(events[_0xa745('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa745('0x7')](e,emitEvent(event));}}module[_0xa745('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index bdbd571..aeed9b8 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 _0x5edd=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','then','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','body','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x17727e,_0xc002d0){var _0x303082=function(_0x198c3b){while(--_0x198c3b){_0x17727e['push'](_0x17727e['shift']());}};_0x303082(++_0xc002d0);}(_0x5edd,0xa3));var _0xd5ed=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5edd[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xd5ed('0x0'));var util=require(_0xd5ed('0x1'));var logger=require(_0xd5ed('0x2'))(_0xd5ed('0x3'));var moment=require(_0xd5ed('0x4'));var BPromise=require(_0xd5ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd5ed('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5ed('0x7'));module[_0xd5ed('0x8')]=function(_0x5c037b,_0x3c2a4e){return _0x5c037b[_0xd5ed('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xd5ed('0xa'),'fields':['body'],'type':_0xd5ed('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb4739f,_0x459346,_0x5106de){var _0x982e83=_0x5c037b['models'];var _0x1d47cb=_0xb4739f[_0xd5ed('0xc')]({'plain':!![]});if(_0x1d47cb[_0xd5ed('0xd')]['toLowerCase']()==='in'||_0x1d47cb[_0xd5ed('0xd')][_0xd5ed('0xe')]()===_0xd5ed('0xf')&&!_0x1d47cb[_0xd5ed('0x10')]&&!_[_0xd5ed('0x11')](_0x1d47cb[_0xd5ed('0x12')])){_0x982e83[_0xd5ed('0x13')][_0xd5ed('0x14')]({'where':{'id':_0x1d47cb[_0xd5ed('0x15')]}})['then'](function(_0x2f5745){if(_0x2f5745){_0x2f5745['update']({'lastMsgAt':_0x1d47cb[_0xd5ed('0x16')],'lastMsgDirection':_0x1d47cb[_0xd5ed('0xd')]['toLowerCase']()});}})[_0xd5ed('0x17')](function(_0x4d3875){console[_0xd5ed('0x18')](_0x4d3875);});}if(_0x1d47cb[_0xd5ed('0xd')]==='out'&&!_0x1d47cb['secret']){var _0x2babb7;_0x982e83[_0xd5ed('0x19')][_0xd5ed('0x1a')]()['then'](function(_0x5598da){return _0x982e83[_0xd5ed('0x1b')][_0xd5ed('0x1c')]({'where':{'id':_0x1d47cb['OpenchannelAccountId']},'include':[{'model':_0x982e83[_0xd5ed('0x13')],'as':_0xd5ed('0x1d'),'where':{'id':_0x1d47cb['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x982e83[_0xd5ed('0x19')],'as':_0xd5ed('0x1e'),'attributes':_[_0xd5ed('0x1f')](_0x5598da)}]}]});})[_0xd5ed('0x20')](function(_0x586571){_0x2babb7=_0x586571['get']({'plain':!![]});if(_0x2babb7&&_0x2babb7[_0xd5ed('0x21')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xd5ed('0x22'),util[_0xd5ed('0x23')](_0xd5ed('0x24'),_0x1d47cb['id'],_0x2babb7[_0xd5ed('0x21')]));if(_0x2babb7[_0xd5ed('0x1d')]&&_0x2babb7['Interactions'][_0xd5ed('0x25')]){_0x1d47cb[_0xd5ed('0x26')]=_['omit'](_0x2babb7[_0xd5ed('0x1d')][0x0],'Contact');_0x1d47cb[_0xd5ed('0x1e')]=_0x2babb7[_0xd5ed('0x1d')][0x0][_0xd5ed('0x1e')];}var _0x459346={'method':_0xd5ed('0x27'),'uri':encodeURI(_0x2babb7[_0xd5ed('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x459346[_0xd5ed('0x28')]){case _0xd5ed('0x29'):_0x459346['qs']=_0x1d47cb;break;case _0xd5ed('0x27'):_0x459346[_0xd5ed('0x2a')]=_0x1d47cb;break;}return rp(_0x459346)['then'](function(_0x1a23c5){logger[_0xd5ed('0x2b')](_0xd5ed('0x2c'),_0xd5ed('0x22'),util[_0xd5ed('0x23')](_0xd5ed('0x2d'),_0x1d47cb['id'],_0x2babb7[_0xd5ed('0x21')]));if(_0x1a23c5[_0xd5ed('0x2a')][_0xd5ed('0x2e')]&&_0x1a23c5[_0xd5ed('0x2a')][_0xd5ed('0x2e')]!=_0x1d47cb[_0xd5ed('0x26')]['threadId']){return _0x982e83[_0xd5ed('0x13')][_0xd5ed('0x2f')]({'threadId':_0x1a23c5[_0xd5ed('0x2a')]['threadId']},{'where':{'id':_0x1d47cb[_0xd5ed('0x26')]['id']}});}else{return;}})['then'](function(){return _0xb4739f[_0xd5ed('0x2f')]({'read':!![]});})[_0xd5ed('0x17')](function(_0x138d66){logger[_0xd5ed('0x18')](_0xd5ed('0x2c'),'afterCreate',util[_0xd5ed('0x30')](_0x138d66,{'showHidden':![],'depth':null}));_0x5106de();});}else{_0x5106de();}})[_0xd5ed('0x31')](function(){_0x5106de();});}else{_0x5106de();}}},'charset':_0xd5ed('0x32'),'collate':_0xd5ed('0x33')});}; \ No newline at end of file +var _0x9c46=['catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','error','CmContact','then','find','OpenchannelAccountId','Interactions','keys','get','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','Interaction'];(function(_0x50b53a,_0x359f54){var _0x723807=function(_0x284024){while(--_0x284024){_0x50b53a['push'](_0x50b53a['shift']());}};_0x723807(++_0x359f54);}(_0x9c46,0xa9));var _0x69c4=function(_0x5e6f73,_0x652f65){_0x5e6f73=_0x5e6f73-0x0;var _0x3744a0=_0x9c46[_0x5e6f73];return _0x3744a0;};'use strict';var _=require(_0x69c4('0x0'));var util=require(_0x69c4('0x1'));var logger=require(_0x69c4('0x2'))(_0x69c4('0x3'));var moment=require(_0x69c4('0x4'));var BPromise=require(_0x69c4('0x5'));var rp=require(_0x69c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69c4('0x7'));var config=require(_0x69c4('0x8'));var attributes=require(_0x69c4('0x9'));module[_0x69c4('0xa')]=function(_0x179175,_0x5d7367){return _0x179175[_0x69c4('0xb')](_0x69c4('0xc'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x69c4('0xd'),'fields':[_0x69c4('0xe')],'type':_0x69c4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12ba91,_0x33c899,_0x5d8cfe){var _0x170b68=_0x179175[_0x69c4('0x10')];var _0x64b439=_0x12ba91['get']({'plain':!![]});if(_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()==='in'||_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()===_0x69c4('0x13')&&!_0x64b439[_0x69c4('0x14')]&&!_[_0x69c4('0x15')](_0x64b439[_0x69c4('0x16')])){_0x170b68[_0x69c4('0x17')][_0x69c4('0x18')]({'where':{'id':_0x64b439[_0x69c4('0x19')]}})['then'](function(_0x4eae45){if(_0x4eae45){_0x4eae45['update']({'lastMsgAt':_0x64b439[_0x69c4('0x1a')],'lastMsgDirection':_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()});}})['catch'](function(_0x502ce0){console[_0x69c4('0x1b')](_0x502ce0);});}if(_0x64b439[_0x69c4('0x11')]===_0x69c4('0x13')&&!_0x64b439[_0x69c4('0x14')]){var _0xdd122f;_0x170b68[_0x69c4('0x1c')]['describe']()[_0x69c4('0x1d')](function(_0x18d872){return _0x170b68['OpenchannelAccount'][_0x69c4('0x1e')]({'where':{'id':_0x64b439[_0x69c4('0x1f')]},'include':[{'model':_0x170b68[_0x69c4('0x17')],'as':_0x69c4('0x20'),'where':{'id':_0x64b439[_0x69c4('0x19')]},'limit':0x1,'include':[{'model':_0x170b68['CmContact'],'as':'Contact','attributes':_[_0x69c4('0x21')](_0x18d872)}]}]});})[_0x69c4('0x1d')](function(_0x4bf367){_0xdd122f=_0x4bf367[_0x69c4('0x22')]({'plain':!![]});if(_0xdd122f&&_0xdd122f['replyUri']){logger[_0x69c4('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x69c4('0x24'),util[_0x69c4('0x25')](_0x69c4('0x26'),_0x64b439['id'],_0xdd122f[_0x69c4('0x27')]));if(_0xdd122f[_0x69c4('0x20')]&&_0xdd122f['Interactions'][_0x69c4('0x28')]){_0x64b439['Interaction']=_[_0x69c4('0x29')](_0xdd122f[_0x69c4('0x20')][0x0],_0x69c4('0x2a'));_0x64b439['Contact']=_0xdd122f['Interactions'][0x0][_0x69c4('0x2a')];}var _0x33c899={'method':_0x69c4('0x2b'),'uri':encodeURI(_0xdd122f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x33c899[_0x69c4('0x2c')]){case _0x69c4('0x2d'):_0x33c899['qs']=_0x64b439;break;case'POST':_0x33c899[_0x69c4('0xe')]=_0x64b439;break;}return rp(_0x33c899)['then'](function(_0x1142f8){logger[_0x69c4('0x23')](_0x69c4('0x2e'),_0x69c4('0x24'),util[_0x69c4('0x25')](_0x69c4('0x2f'),_0x64b439['id'],_0xdd122f[_0x69c4('0x27')]));if(_0x1142f8['body'][_0x69c4('0x30')]&&_0x1142f8[_0x69c4('0xe')][_0x69c4('0x30')]!=_0x64b439['Interaction'][_0x69c4('0x30')]){return _0x170b68[_0x69c4('0x17')][_0x69c4('0x31')]({'threadId':_0x1142f8[_0x69c4('0xe')][_0x69c4('0x30')]},{'where':{'id':_0x64b439[_0x69c4('0x32')]['id']}});}else{return;}})['then'](function(){return _0x12ba91[_0x69c4('0x31')]({'read':!![]});})[_0x69c4('0x33')](function(_0x262aa0){logger[_0x69c4('0x1b')](_0x69c4('0x2e'),'afterCreate',util['inspect'](_0x262aa0,{'showHidden':![],'depth':null}));_0x5d8cfe();});}else{_0x5d8cfe();}})[_0x69c4('0x34')](function(){_0x5d8cfe();});}else{_0x5d8cfe();}}},'charset':_0x69c4('0x35'),'collate':_0x69c4('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3c4c441..039e268 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e0e99,_0xa39d23){var _0x487015=function(_0x49884d){while(--_0x49884d){_0x3e0e99['push'](_0x3e0e99['shift']());}};_0x487015(++_0xa39d23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2cf32d,_0xa45bab){_0x2cf32d=_0x2cf32d-0x0;var _0x3e1ecd=_0x5f2f[_0x2cf32d];return _0x3e1ecd;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59481b,_0x4c7624){var _0x55e559=function(_0x15c3a4){while(--_0x15c3a4){_0x59481b['push'](_0x59481b['shift']());}};_0x55e559(++_0x4c7624);}(_0x1261,0x144));var _0x1126=function(_0xc4ea75,_0x273753){_0xc4ea75=_0xc4ea75-0x0;var _0x52ea5e=_0x1261[_0xc4ea75];return _0x52ea5e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2a4233f..90219c9 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 _0x103f=['remove','update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x5c6cff,_0x42a8c2){var _0x2bac89=function(_0x40f62c){while(--_0x40f62c){_0x5c6cff['push'](_0x5c6cff['shift']());}};_0x2bac89(++_0x42a8c2);}(_0x103f,0x13e));var _0xf103=function(_0x3ec44a,_0x26fc31){_0x3ec44a=_0x3ec44a-0x0;var _0x9ae88e=_0x103f[_0x3ec44a];return _0x9ae88e;};'use strict';var OpenchannelMessageEvents=require(_0xf103('0x0'));var events=[_0xf103('0x1'),_0xf103('0x2'),_0xf103('0x3')];function createListener(_0xbaee4b,_0x15ff90){return function(_0x3eca86){_0x15ff90[_0xf103('0x4')](_0xbaee4b,_0x3eca86);};}function removeListener(_0x2db927,_0x2e15c9){return function(){OpenchannelMessageEvents['removeListener'](_0x2db927,_0x2e15c9);};}exports[_0xf103('0x5')]=function(_0x30ae90){for(var _0x1cb07e=0x0,_0x211dbc=events[_0xf103('0x6')];_0x1cb07e<_0x211dbc;_0x1cb07e++){var _0x3cfbd1=events[_0x1cb07e];var _0x37e92b=createListener(_0xf103('0x7')+_0x3cfbd1,_0x30ae90);OpenchannelMessageEvents['on'](_0x3cfbd1,_0x37e92b);}}; \ No newline at end of file +var _0xf066=['save','remove','update','emit','removeListener','register'];(function(_0x2c4f80,_0x1d7421){var _0x1d5c9d=function(_0x1a1366){while(--_0x1a1366){_0x2c4f80['push'](_0x2c4f80['shift']());}};_0x1d5c9d(++_0x1d7421);}(_0xf066,0x1a4));var _0x6f06=function(_0x44799d,_0x26c23a){_0x44799d=_0x44799d-0x0;var _0x4f4a20=_0xf066[_0x44799d];return _0x4f4a20;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x6f06('0x0'),_0x6f06('0x1'),_0x6f06('0x2')];function createListener(_0x2608de,_0x3a1ff8){return function(_0x1a9901){_0x3a1ff8[_0x6f06('0x3')](_0x2608de,_0x1a9901);};}function removeListener(_0x350970,_0x5c3443){return function(){OpenchannelMessageEvents[_0x6f06('0x4')](_0x350970,_0x5c3443);};}exports[_0x6f06('0x5')]=function(_0x1e76c5){for(var _0x2e77a9=0x0,_0x1452d4=events['length'];_0x2e77a9<_0x1452d4;_0x2e77a9++){var _0x280442=events[_0x2e77a9];var _0x2e49e6=createListener('openchannelMessage:'+_0x280442,_0x1e76c5);OpenchannelMessageEvents['on'](_0x280442,_0x2e49e6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4847bf3..58bf8e8 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 _0xa123=['/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xa123,0x1b3));var _0x3a12=function(_0x13d7c1,_0x2d6708){_0x13d7c1=_0x13d7c1-0x0;var _0x289a11=_0xa123[_0x13d7c1];return _0x289a11;};'use strict';var multer=require(_0x3a12('0x0'));var util=require(_0x3a12('0x1'));var path=require(_0x3a12('0x2'));var timeout=require(_0x3a12('0x3'));var express=require('express');var router=express[_0x3a12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3a12('0x5'));var interaction=require(_0x3a12('0x6'));var config=require(_0x3a12('0x7'));var controller=require('./openchannelQueue.controller');router[_0x3a12('0x8')]('/',auth['isAuthenticated'](),controller[_0x3a12('0x9')]);router[_0x3a12('0x8')](_0x3a12('0xa'),auth[_0x3a12('0xb')](),controller[_0x3a12('0xc')]);router[_0x3a12('0x8')]('/:id',auth[_0x3a12('0xb')](),controller['show']);router[_0x3a12('0x8')](_0x3a12('0xd'),auth[_0x3a12('0xb')](),controller[_0x3a12('0xe')]);router[_0x3a12('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3a12('0xf')]);router['get'](_0x3a12('0x10'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x11')]);router[_0x3a12('0x12')]('/',auth['isAuthenticated'](),controller[_0x3a12('0x13')]);router['post']('/:id/teams',auth[_0x3a12('0xb')](),controller['addTeams']);router[_0x3a12('0x12')](_0x3a12('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3a12('0x14')](_0x3a12('0x15'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x16')]);router[_0x3a12('0x17')](_0x3a12('0x15'),auth[_0x3a12('0xb')](),controller['destroy']);router[_0x3a12('0x17')](_0x3a12('0x18'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x19')]);router['delete']('/:id/users',auth[_0x3a12('0xb')](),controller['removeAgents']);module[_0x3a12('0x1a')]=router; \ No newline at end of file +var _0x2c41=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x2c41,0x101));var _0x12c4=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x2c41[_0x47568e];return _0x33815b;};'use strict';var multer=require(_0x12c4('0x0'));var util=require(_0x12c4('0x1'));var path=require(_0x12c4('0x2'));var timeout=require(_0x12c4('0x3'));var express=require(_0x12c4('0x4'));var router=express['Router']();var fs_extra=require(_0x12c4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x12c4('0x6'));var controller=require(_0x12c4('0x7'));router[_0x12c4('0x8')]('/',auth['isAuthenticated'](),controller[_0x12c4('0x9')]);router[_0x12c4('0x8')](_0x12c4('0xa'),auth[_0x12c4('0xb')](),controller[_0x12c4('0xc')]);router[_0x12c4('0x8')](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0xe')]);router['get'](_0x12c4('0xf'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x10')]);router[_0x12c4('0x8')](_0x12c4('0x11'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x12')]);router[_0x12c4('0x8')](_0x12c4('0x13'),auth['isAuthenticated'](),controller[_0x12c4('0x14')]);router[_0x12c4('0x15')]('/',auth[_0x12c4('0xb')](),controller[_0x12c4('0x16')]);router[_0x12c4('0x15')](_0x12c4('0x11'),auth['isAuthenticated'](),controller[_0x12c4('0x17')]);router[_0x12c4('0x15')](_0x12c4('0x13'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x18')]);router['put'](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x19')]);router[_0x12c4('0x1a')](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x1b')]);router[_0x12c4('0x1a')](_0x12c4('0x11'),auth['isAuthenticated'](),controller[_0x12c4('0x1c')]);router[_0x12c4('0x1a')](_0x12c4('0x13'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 92c796e..d1afcc9 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 _0x5f64=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4945e8,_0x597c5e){var _0x4300ca=function(_0x50c331){while(--_0x50c331){_0x4945e8['push'](_0x4945e8['shift']());}};_0x4300ca(++_0x597c5e);}(_0x5f64,0x86));var _0x45f6=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0x5f64[_0x2e6dee];return _0x47706;};'use strict';var Sequelize=require(_0x45f6('0x0'));module[_0x45f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x45f6('0x2')]},'timeout':{'type':Sequelize[_0x45f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45f6('0x4')](_0x45f6('0x5'),_0x45f6('0x6'),_0x45f6('0x7'))}}; \ No newline at end of file +var _0xfa67=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x2b350c,_0x3427b5){var _0xbb04c2=function(_0x2cb3c7){while(--_0x2cb3c7){_0x2b350c['push'](_0x2b350c['shift']());}};_0xbb04c2(++_0x3427b5);}(_0xfa67,0x1a6));var _0x7fa6=function(_0x43bde0,_0x4621cf){_0x43bde0=_0x43bde0-0x0;var _0x489e57=_0xfa67[_0x43bde0];return _0x489e57;};'use strict';var Sequelize=require(_0x7fa6('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fa6('0x1')],'unique':_0x7fa6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fa6('0x1')]},'timeout':{'type':Sequelize[_0x7fa6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7fa6('0x4'),_0x7fa6('0x5'),_0x7fa6('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 299408c..e49e342 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 _0x23ba=['sort','getTeams','hasOwnProperty','addTeams','ids','online','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','OpenchannelQueue','query','findAll','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','filter','User','findAndCountAll','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','order'];(function(_0x268eb1,_0x530778){var _0x18e233=function(_0x17670b){while(--_0x17670b){_0x268eb1['push'](_0x268eb1['shift']());}};_0x18e233(++_0x530778);}(_0x23ba,0x123));var _0xa23b=function(_0x45612c,_0x54fb28){_0x45612c=_0x45612c-0x0;var _0x1c31c3=_0x23ba[_0x45612c];return _0x1c31c3;};'use strict';var BPromise=require(_0xa23b('0x0'));var util=require(_0xa23b('0x1'));var _=require('lodash');var squel=require(_0xa23b('0x2'));var Redis=require(_0xa23b('0x3'));var qs=require(_0xa23b('0x4'));var logger=require(_0xa23b('0x5'))(_0xa23b('0x6'));var config=require(_0xa23b('0x7'));var db=require(_0xa23b('0x8'))['db'];config[_0xa23b('0x9')]=_[_0xa23b('0xa')](config[_0xa23b('0x9')],{'host':_0xa23b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa23b('0x9')]));require(_0xa23b('0xc'))[_0xa23b('0xd')](socket);function respondWithStatusCode(_0x36f930,_0xbc228d){_0xbc228d=_0xbc228d||0xcc;return function(_0x11cf70){if(_0x11cf70){return _0x36f930[_0xa23b('0xe')](_0xbc228d);}return _0x36f930['status'](_0xbc228d)[_0xa23b('0xf')]();};}function respondWithResult(_0x30c054,_0x1a60fa){_0x1a60fa=_0x1a60fa||0xc8;return function(_0x231cae){if(_0x231cae){return _0x30c054[_0xa23b('0x10')](_0x1a60fa)['json'](_0x231cae);}};}function respondWithFilteredResult(_0x20cb8c,_0x2223eb){return function(_0x123dc1){if(_0x123dc1){var _0x455afa=typeof _0x2223eb[_0xa23b('0x11')]===_0xa23b('0x12')&&typeof _0x2223eb[_0xa23b('0x13')]===_0xa23b('0x12');var _0xf89910=_0x123dc1['count'];var _0x5cd9a6=_0x455afa?0x0:_0x2223eb[_0xa23b('0x11')];var _0x44ab3a=_0x455afa?_0x123dc1[_0xa23b('0x14')]:_0x2223eb['offset']+_0x2223eb[_0xa23b('0x13')];var _0x424c1e;if(_0x44ab3a>=_0xf89910){_0x44ab3a=_0xf89910;_0x424c1e=0xc8;}else{_0x424c1e=0xce;}_0x20cb8c[_0xa23b('0x10')](_0x424c1e);return _0x20cb8c[_0xa23b('0x15')](_0xa23b('0x16'),_0x5cd9a6+'-'+_0x44ab3a+'/'+_0xf89910)['json'](_0x123dc1);}return null;};}function saveUpdates(_0x188351){return function(_0x5241d4){if(_0x5241d4){return _0x5241d4[_0xa23b('0x17')](_0x188351)['then'](function(_0x46db96){return _0x46db96;});}return null;};}function removeEntity(_0x555295){return function(_0x178bab){if(_0x178bab){return _0x178bab[_0xa23b('0x18')]()[_0xa23b('0x19')](function(){var _0x3c545d=_0x178bab[_0xa23b('0x1a')]({'plain':!![]});var _0x31f446='OpenchannelQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x31f446,'resourceId':_0x3c545d['id']}})[_0xa23b('0x19')](function(){return _0x178bab;});})[_0xa23b('0x19')](function(){_0x555295[_0xa23b('0x10')](0xcc)[_0xa23b('0xf')]();});}};}function handleEntityNotFound(_0x48933e){return function(_0x4a5727){if(!_0x4a5727){_0x48933e[_0xa23b('0xe')](0x194);}return _0x4a5727;};}function handleError(_0x59c6b1,_0x4afa0a){_0x4afa0a=_0x4afa0a||0x1f4;return function(_0x10b5f8){logger[_0xa23b('0x1b')](_0x10b5f8[_0xa23b('0x1c')]);if(_0x10b5f8['name']){delete _0x10b5f8[_0xa23b('0x1d')];}_0x59c6b1['status'](_0x4afa0a)[_0xa23b('0x1e')](_0x10b5f8);};}exports[_0xa23b('0x1f')]=function(_0x5ae442,_0x15c327){var _0x5ee798={};var _0x343875={'count':0x0,'rows':[]};var _0x5c35eb=_[_0xa23b('0x20')](db['OpenchannelQueue'][_0xa23b('0x21')],function(_0x4a96ac){return{'name':_0x4a96ac[_0xa23b('0x22')],'type':_0x4a96ac['type'][_0xa23b('0x23')]};});_0x5ee798=qs[_0xa23b('0x24')](_0x5c35eb,_0x5ae442);var _0x185378={'where':_0x5ee798[_0xa23b('0x25')]};return db[_0xa23b('0x26')][_0xa23b('0x14')](_0x185378)[_0xa23b('0x19')](function(_0xdd6f06){_0x343875[_0xa23b('0x14')]=_0xdd6f06;_0x5ee798['include']=qs['include'](_0x5ae442[_0xa23b('0x27')]);return db[_0xa23b('0x26')][_0xa23b('0x28')](_0x5ee798);})[_0xa23b('0x19')](function(_0x412271){_0x343875[_0xa23b('0x29')]=_0x412271;return _0x343875;})['then'](respondWithFilteredResult(_0x15c327,_0x5ee798))['catch'](handleError(_0x15c327,null));};exports['show']=function(_0x2a7082,_0x3a6a15){var _0x4143e4={'raw':!![],'where':{'id':_0x2a7082[_0xa23b('0x2a')]['id']}},_0x29421f={};_0x29421f[_0xa23b('0x2b')]=_[_0xa23b('0x2c')](db[_0xa23b('0x26')][_0xa23b('0x21')]);_0x29421f[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x2a7082[_0xa23b('0x27')]);_0x29421f[_0xa23b('0x2d')]=_[_0xa23b('0x2e')](_0x29421f[_0xa23b('0x2b')],_0x29421f['query']);_0x4143e4[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x29421f[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x2a7082[_0xa23b('0x27')][_0xa23b('0x30')]));_0x4143e4['attributes']=_0x4143e4[_0xa23b('0x2f')][_0xa23b('0x31')]?_0x4143e4[_0xa23b('0x2f')]:_0x29421f[_0xa23b('0x2b')];if(_0x2a7082['query'][_0xa23b('0x32')]){_0x4143e4[_0xa23b('0x33')]=[{'all':!![]}];}_0x4143e4=_[_0xa23b('0x34')]({},_0x4143e4,_0x2a7082[_0xa23b('0x35')]);return db[_0xa23b('0x26')]['find'](_0x4143e4)[_0xa23b('0x19')](handleEntityNotFound(_0x3a6a15,null))[_0xa23b('0x19')](respondWithResult(_0x3a6a15,null))[_0xa23b('0x36')](handleError(_0x3a6a15,null));};exports['create']=function(_0x23ac71,_0x24f343){return db['OpenchannelQueue']['create'](_0x23ac71[_0xa23b('0x37')],{})['then'](function(_0x357ca1){var _0x23b37f=_0x23ac71[_0xa23b('0x38')]['get']({'plain':!![]});if(!_0x23b37f)throw new Error(_0xa23b('0x39'));if(_0x23b37f[_0xa23b('0x3a')]===_0xa23b('0x38')){var _0x55b1fa=_0x357ca1[_0xa23b('0x1a')]({'plain':!![]});var _0x21700a=_0xa23b('0x3b');return db[_0xa23b('0x3c')][_0xa23b('0x3d')]({'where':{'name':_0x21700a,'userProfileId':_0x23b37f[_0xa23b('0x3e')]},'raw':!![]})[_0xa23b('0x19')](function(_0x45e2fe){if(_0x45e2fe&&_0x45e2fe[_0xa23b('0x3f')]===0x0){return db[_0xa23b('0x40')][_0xa23b('0x41')]({'name':_0x55b1fa[_0xa23b('0x1d')],'resourceId':_0x55b1fa['id'],'type':_0x45e2fe[_0xa23b('0x1d')],'sectionId':_0x45e2fe['id']},{})[_0xa23b('0x19')](function(){return _0x357ca1;});}else{return _0x357ca1;}})['catch'](function(_0x136440){logger[_0xa23b('0x1b')](_0xa23b('0x42'),_0x136440);throw _0x136440;});}return _0x357ca1;})[_0xa23b('0x19')](respondWithResult(_0x24f343,0xc9))[_0xa23b('0x36')](handleError(_0x24f343,null));};exports[_0xa23b('0x17')]=function(_0x31fb48,_0x51d71e){if(_0x31fb48['body']['id']){delete _0x31fb48[_0xa23b('0x37')]['id'];}return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x31fb48[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x51d71e,null))['then'](saveUpdates(_0x31fb48[_0xa23b('0x37')],null))[_0xa23b('0x19')](respondWithResult(_0x51d71e,null))['catch'](handleError(_0x51d71e,null));};exports[_0xa23b('0x18')]=function(_0x406b6e,_0x458d06){return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x406b6e[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x458d06,null))[_0xa23b('0x19')](removeEntity(_0x458d06,null))[_0xa23b('0x36')](handleError(_0x458d06,null));};exports[_0xa23b('0x43')]=function(_0x18e41d,_0x25d061){return db[_0xa23b('0x26')]['describe']()[_0xa23b('0x19')](respondWithResult(_0x25d061,null))[_0xa23b('0x36')](handleError(_0x25d061,null));};exports[_0xa23b('0x44')]=function(_0x1e4333,_0x4258e1){var _0x4ba061={'raw':!![],'where':{}},_0x32dc08={},_0xfe00d0;return db[_0xa23b('0x26')]['findOne']({'where':{'id':_0x1e4333[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x4258e1,null))[_0xa23b('0x19')](function(_0x85c559){if(_0x85c559){_0xfe00d0=_0x85c559[_0xa23b('0x1a')]({'plain':!![]});_0x32dc08[_0xa23b('0x2b')]=_[_0xa23b('0x2c')](db[_0xa23b('0x45')][_0xa23b('0x21')]);_0x32dc08[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x1e4333['query']);_0x32dc08[_0xa23b('0x2d')]=_['intersection'](_0x32dc08[_0xa23b('0x2b')],_0x32dc08[_0xa23b('0x27')]);_0x4ba061[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x32dc08[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x1e4333[_0xa23b('0x27')][_0xa23b('0x30')]));_0x4ba061[_0xa23b('0x2f')]=_0x4ba061['attributes'][_0xa23b('0x31')]?_0x4ba061[_0xa23b('0x2f')]:_0x32dc08[_0xa23b('0x2b')];if(!_0x1e4333[_0xa23b('0x27')]['hasOwnProperty'](_0xa23b('0x46'))){_0x4ba061['limit']=qs[_0xa23b('0x13')](_0x1e4333[_0xa23b('0x27')][_0xa23b('0x13')]);_0x4ba061['offset']=qs[_0xa23b('0x11')](_0x1e4333['query'][_0xa23b('0x11')]);}_0x4ba061['order']=qs['sort'](_0x1e4333[_0xa23b('0x27')]['sort']);_0x4ba061[_0xa23b('0x25')]=qs['filters'](_['pick'](_0x1e4333[_0xa23b('0x27')],_0x32dc08[_0xa23b('0x2d')]));_0x4ba061[_0xa23b('0x25')]['OpenchannelQueueId']=_0x85c559['id'];if(_0x1e4333[_0xa23b('0x27')][_0xa23b('0x47')]){_0x4ba061['where']=_[_0xa23b('0x34')](_0x4ba061[_0xa23b('0x25')],{'$or':_['map'](_0x4ba061['attributes'],function(_0x171325){var _0x1e6577={};_0x1e6577[_0x171325]={'$like':'%'+_0x1e4333[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x1e6577;})});}_0x4ba061=_[_0xa23b('0x34')]({},_0x4ba061,_0x1e4333[_0xa23b('0x35')]);return db[_0xa23b('0x45')][_0xa23b('0x28')](_0x4ba061);}})['then'](function(_0x456290){if(_0x456290){return db[_0xa23b('0x48')][_0xa23b('0x49')]({'where':{'id':_[_0xa23b('0x20')](_0x456290,'UserId'),'role':_0xa23b('0x4a')},'attributes':['id',_0xa23b('0x1d'),_0xa23b('0x4b'),'updatedAt',_0xa23b('0x4c')]});}})[_0xa23b('0x19')](function(_0x19dfd1){if(_0x19dfd1){return{'count':_0x19dfd1[_0xa23b('0x14')],'rows':_['map'](_0x19dfd1[_0xa23b('0x29')],function(_0x198b22){return{'membername':_0x198b22[_0xa23b('0x1d')],'UserId':_0x198b22['id'],'queue_name':_0xfe00d0[_0xa23b('0x1d')],'OpenchannelQueueId':_0xfe00d0['id'],'interface':util[_0xa23b('0x4d')](_0xa23b('0x4e'),_0xa23b('0x4f'),_0x198b22[_0xa23b('0x1d')]),'penalty':0x0,'paused':_0x198b22[_0xa23b('0x4b')],'createdAt':_0x198b22[_0xa23b('0x4c')],'updatedAt':_0x198b22[_0xa23b('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa23b('0x19')](respondWithFilteredResult(_0x4258e1,_0x4ba061))[_0xa23b('0x36')](handleError(_0x4258e1,null));};exports['getTeams']=function(_0x12f46f,_0x593bd0){var _0x56b5ec={};var _0x20fb66={};var _0x973762;var _0x2f37b5;return db[_0xa23b('0x26')][_0xa23b('0x51')]({'where':{'id':_0x12f46f['params']['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x593bd0,null))['then'](function(_0x36be7d){if(_0x36be7d){_0x973762=_0x36be7d;_0x20fb66[_0xa23b('0x2b')]=_['keys'](db[_0xa23b('0x52')][_0xa23b('0x21')]);_0x20fb66[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x12f46f[_0xa23b('0x27')]);_0x20fb66[_0xa23b('0x2d')]=_[_0xa23b('0x2e')](_0x20fb66[_0xa23b('0x2b')],_0x20fb66['query']);_0x56b5ec[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x20fb66[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x30')]));_0x56b5ec[_0xa23b('0x2f')]=_0x56b5ec[_0xa23b('0x2f')][_0xa23b('0x31')]?_0x56b5ec[_0xa23b('0x2f')]:_0x20fb66[_0xa23b('0x2b')];_0x56b5ec[_0xa23b('0x53')]=qs[_0xa23b('0x54')](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x54')]);_0x56b5ec[_0xa23b('0x25')]=qs[_0xa23b('0x2d')](_['pick'](_0x12f46f[_0xa23b('0x27')],_0x20fb66[_0xa23b('0x2d')]));if(_0x12f46f[_0xa23b('0x27')][_0xa23b('0x47')]){_0x56b5ec['where']=_['merge'](_0x56b5ec[_0xa23b('0x25')],{'$or':_['map'](_0x56b5ec[_0xa23b('0x2f')],function(_0x108239){var _0x2f7cd5={};_0x2f7cd5[_0x108239]={'$like':'%'+_0x12f46f[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x2f7cd5;})});}_0x56b5ec=_[_0xa23b('0x34')]({},_0x56b5ec,_0x12f46f[_0xa23b('0x35')]);return _0x973762[_0xa23b('0x55')](_0x56b5ec);}})[_0xa23b('0x19')](function(_0x36f31a){if(_0x36f31a){_0x2f37b5=_0x36f31a[_0xa23b('0x31')];if(!_0x12f46f[_0xa23b('0x27')][_0xa23b('0x56')]('nolimit')){_0x56b5ec[_0xa23b('0x13')]=qs['limit'](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x13')]);_0x56b5ec['offset']=qs[_0xa23b('0x11')](_0x12f46f['query'][_0xa23b('0x11')]);}return _0x973762[_0xa23b('0x55')](_0x56b5ec);}})[_0xa23b('0x19')](function(_0x326487){if(_0x326487){return _0x326487?{'count':_0x2f37b5,'rows':_0x326487}:null;}})[_0xa23b('0x19')](respondWithResult(_0x593bd0,null))['catch'](handleError(_0x593bd0,null));};exports[_0xa23b('0x57')]=function(_0x43f802,_0x5dd08){var _0x3daab5=_0x43f802[_0xa23b('0x37')][_0xa23b('0x58')];return db[_0xa23b('0x52')]['findAll']({'where':{'id':_0x3daab5},'attributes':['id'],'include':[{'model':db[_0xa23b('0x48')],'as':'Agents','attributes':['id',_0xa23b('0x1d'),_0xa23b('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xa23b('0x19')](function(_0x19764d){if(_0x19764d){var _0x4f55c6=_[_0xa23b('0x5a')](_0x19764d,function(_0x28f20c){var _0x19f364=_0x28f20c[_0xa23b('0x1a')]({'plain':!![]});return _0x19f364[_0xa23b('0x5b')];});return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x43f802['params']['id']}})[_0xa23b('0x19')](function(_0x53a679){return db['sequelize'][_0xa23b('0x5c')](function(_0x283b64){return _0x53a679[_0xa23b('0x57')](_0x3daab5,{'transaction':_0x283b64})[_0xa23b('0x19')](function(){return BPromise[_0xa23b('0x5d')](_0x4f55c6,function(_0x201e49){return db[_0xa23b('0x45')][_0xa23b('0x5e')]({'where':{'UserId':_0x201e49['id'],'OpenchannelQueueId':_0x43f802[_0xa23b('0x2a')]['id']},'transaction':_0x283b64});});})[_0xa23b('0x19')](function(){_0x4f55c6[_0xa23b('0x5f')](function(_0x22511a){socket[_0xa23b('0x60')](_0xa23b('0x61'),{'UserId':_0x22511a['id'],'OpenchannelQueueId':_0x53a679['id']});});});});});}})[_0xa23b('0x19')](respondWithStatusCode(_0x5dd08,null))[_0xa23b('0x36')](handleError(_0x5dd08,null));};exports[_0xa23b('0x62')]=function(_0x373dba,_0x21a208){return db[_0xa23b('0x52')][_0xa23b('0x28')]({'where':{'id':_0x373dba[_0xa23b('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa23b('0x48')],'as':_0xa23b('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21a208,null))['then'](function(_0x16f4dc){var _0x25e89c=_[_0xa23b('0x20')](_0x16f4dc,'id');var _0x231ebc=[];var _0x1821b4=[];var _0x2e2be2=squel[_0xa23b('0x63')]();_0x2e2be2[_0xa23b('0x64')](_0xa23b('0x65'))[_0xa23b('0x66')](_0xa23b('0x67'),'tq')[_0xa23b('0x68')]('user_has_teams','ut',_0xa23b('0x69'))[_0xa23b('0x25')](_0xa23b('0x6a'),_0x373dba[_0xa23b('0x2a')]['id']);for(var _0x61da7f=0x0;_0x61da7f<_0x16f4dc[_0xa23b('0x31')];_0x61da7f+=0x1){let _0x1cf77e=_0x16f4dc[_0x61da7f];for(var _0x1d0071=0x0;_0x1d0071<_0x1cf77e[_0xa23b('0x5b')][_0xa23b('0x31')];_0x1d0071+=0x1){let _0x1c8d3c=_0x1cf77e[_0xa23b('0x5b')][_0x1d0071];var _0x17fa80=_0x2e2be2[_0xa23b('0x6b')]();_0x17fa80[_0xa23b('0x25')]('ut.UserId\x20=\x20?',_0x1c8d3c['id']);_0x1821b4['push'](db[_0xa23b('0x6c')][_0xa23b('0x27')](_0x17fa80[_0xa23b('0x6d')](),{'type':db[_0xa23b('0x6c')][_0xa23b('0x6e')][_0xa23b('0x6f')]})[_0xa23b('0x19')](function(_0x72e1d7){if(_0x72e1d7['length']===0x1){return _0x1c8d3c['id'];}else{var _0x2f286e=_[_0xa23b('0x70')](_[_0xa23b('0x20')](_0x72e1d7,_0xa23b('0x71')),function(_0x3c7fc7){return _[_0xa23b('0x72')](_0x25e89c,_0x3c7fc7);});if(_0x2f286e){return _0x1c8d3c['id'];}}}));}}return BPromise[_0xa23b('0x73')](_0x1821b4)[_0xa23b('0x19')](function(_0xe61644){_0x231ebc=_(_0x231ebc)[_0xa23b('0x74')](_0xe61644)[_0xa23b('0x75')]()[_0xa23b('0x76')]();return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x373dba[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](function(_0x32db01){return db[_0xa23b('0x6c')][_0xa23b('0x5c')](function(_0x570e6a){return _0x32db01[_0xa23b('0x62')](_0x373dba[_0xa23b('0x27')][_0xa23b('0x58')],{'transaction':_0x570e6a})[_0xa23b('0x19')](function(){if(!_[_0xa23b('0x77')](_0x231ebc)){return _0x32db01['removeAgents'](_0x231ebc,{'transaction':_0x570e6a});}})[_0xa23b('0x19')](function(){_0x231ebc['forEach'](function(_0x48a671){socket[_0xa23b('0x60')]('userOpenchannelQueue:remove',{'UserId':_0x48a671,'OpenchannelQueueId':_0x32db01['id']});});});});});});})[_0xa23b('0x19')](respondWithStatusCode(_0x21a208,null))[_0xa23b('0x36')](handleError(_0x21a208,null));};exports[_0xa23b('0x78')]=function(_0x8947d7,_0x5affb3){return db['OpenchannelQueue'][_0xa23b('0x3d')]({'where':{'id':_0x8947d7[_0xa23b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5affb3,null))[_0xa23b('0x19')](function(_0x17f7e7){if(_0x17f7e7){return _0x17f7e7[_0xa23b('0x78')](_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')],_[_0xa23b('0x79')](_0x8947d7[_0xa23b('0x37')],['ids','id'])||{})['spread'](function(_0x4faf21){for(var _0x4b4ec2=0x0;_0x4b4ec2<_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')][_0xa23b('0x31')];_0x4b4ec2+=0x1){socket[_0xa23b('0x60')](_0xa23b('0x61'),{'UserId':Number(_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')][_0x4b4ec2]),'OpenchannelQueueId':Number(_0x8947d7[_0xa23b('0x2a')]['id'])});}return _0x4faf21;});}})[_0xa23b('0x19')](respondWithResult(_0x5affb3,null))[_0xa23b('0x36')](handleError(_0x5affb3,null));};exports[_0xa23b('0x7a')]=function(_0xd3512b,_0x65676c){return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0xd3512b['params']['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x65676c,null))[_0xa23b('0x19')](function(_0x3f8231){if(_0x3f8231){return _0x3f8231[_0xa23b('0x7a')](_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')])[_0xa23b('0x19')](function(){if(_[_0xa23b('0x7b')](_0xd3512b[_0xa23b('0x27')]['ids'])){for(var _0x575c6c=0x0;_0x575c6c<_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')][_0xa23b('0x31')];_0x575c6c+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xd3512b['query'][_0xa23b('0x58')][_0x575c6c]),'OpenchannelQueueId':Number(_0xd3512b[_0xa23b('0x2a')]['id'])});}}else{socket[_0xa23b('0x60')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')]),'OpenchannelQueueId':Number(_0xd3512b[_0xa23b('0x2a')]['id'])});}});}})[_0xa23b('0x19')](respondWithStatusCode(_0x65676c,null))[_0xa23b('0x36')](handleError(_0x65676c,null));};exports['getAgents']=function(_0x36be0c,_0x5b966d){var _0xc2edfd={};var _0x3071f7={};var _0x1c3da2;var _0x12ada9;return db[_0xa23b('0x26')][_0xa23b('0x51')]({'where':{'id':_0x36be0c[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x5b966d,null))[_0xa23b('0x19')](function(_0x306e0f){if(_0x306e0f){_0x1c3da2=_0x306e0f;_0x3071f7[_0xa23b('0x2b')]=_['keys'](db[_0xa23b('0x48')][_0xa23b('0x21')]);_0x3071f7[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x36be0c['query']);_0x3071f7['filters']=_[_0xa23b('0x2e')](_0x3071f7[_0xa23b('0x2b')],_0x3071f7[_0xa23b('0x27')]);_0xc2edfd['attributes']=_['intersection'](_0x3071f7[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x36be0c[_0xa23b('0x27')]['fields']));_0xc2edfd[_0xa23b('0x2f')]=_0xc2edfd[_0xa23b('0x2f')][_0xa23b('0x31')]?_0xc2edfd[_0xa23b('0x2f')]:_0x3071f7[_0xa23b('0x2b')];_0xc2edfd[_0xa23b('0x53')]=qs[_0xa23b('0x54')](_0x36be0c[_0xa23b('0x27')][_0xa23b('0x54')]);_0xc2edfd[_0xa23b('0x25')]=qs['filters'](_['pick'](_0x36be0c[_0xa23b('0x27')],_0x3071f7[_0xa23b('0x2d')]));if(_0x36be0c[_0xa23b('0x27')][_0xa23b('0x47')]){_0xc2edfd[_0xa23b('0x25')]=_['merge'](_0xc2edfd[_0xa23b('0x25')],{'$or':_[_0xa23b('0x20')](_0xc2edfd[_0xa23b('0x2f')],function(_0x1b83f3){var _0x429bcd={};_0x429bcd[_0x1b83f3]={'$like':'%'+_0x36be0c[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x429bcd;})});}_0xc2edfd=_[_0xa23b('0x34')]({},_0xc2edfd,_0x36be0c[_0xa23b('0x35')]);return _0x1c3da2[_0xa23b('0x7c')](_0xc2edfd);}})[_0xa23b('0x19')](function(_0x381f16){if(_0x381f16){_0x12ada9=_0x381f16[_0xa23b('0x31')];if(!_0x36be0c['query']['hasOwnProperty'](_0xa23b('0x46'))){_0xc2edfd[_0xa23b('0x13')]=qs['limit'](_0x36be0c['query'][_0xa23b('0x13')]);_0xc2edfd[_0xa23b('0x11')]=qs[_0xa23b('0x11')](_0x36be0c[_0xa23b('0x27')]['offset']);}return _0x1c3da2[_0xa23b('0x7c')](_0xc2edfd);}})[_0xa23b('0x19')](function(_0x2c756c){if(_0x2c756c){return _0x2c756c?{'count':_0x12ada9,'rows':_0x2c756c}:null;}})[_0xa23b('0x19')](respondWithResult(_0x5b966d,null))['catch'](handleError(_0x5b966d,null));}; \ No newline at end of file +var _0x1410=['findOrCreate','forEach','emit','userOpenchannelQueue:save','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','all','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','merge','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','then','get','OpenchannelQueues','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','params','model','keys','attributes','intersection','fields','options','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','getMembers','findOne','filters','hasOwnProperty','order','sort','pick','filter','UserOpenchannelQueue','findAll','User','UserId','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','length','nolimit','addTeams','Team','Agents','online','voicePause','flatMap','transaction','each'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1410,0x1e6));var _0x0141=function(_0x223a9d,_0x53cd64){_0x223a9d=_0x223a9d-0x0;var _0x5cca43=_0x1410[_0x223a9d];return _0x5cca43;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x0141('0x0'));var squel=require(_0x0141('0x1'));var Redis=require(_0x0141('0x2'));var qs=require(_0x0141('0x3'));var logger=require(_0x0141('0x4'))(_0x0141('0x5'));var config=require(_0x0141('0x6'));var db=require('../../mysqldb')['db'];config[_0x0141('0x7')]=_['defaults'](config['redis'],{'host':_0x0141('0x8'),'port':0x18eb});var socket=require(_0x0141('0x9'))(new Redis(config[_0x0141('0x7')]));require(_0x0141('0xa'))[_0x0141('0xb')](socket);function respondWithStatusCode(_0x3deac2,_0x46a622){_0x46a622=_0x46a622||0xcc;return function(_0x37ee15){if(_0x37ee15){return _0x3deac2['sendStatus'](_0x46a622);}return _0x3deac2['status'](_0x46a622)[_0x0141('0xc')]();};}function respondWithResult(_0x473f9a,_0x1ef4bf){_0x1ef4bf=_0x1ef4bf||0xc8;return function(_0x17fc00){if(_0x17fc00){return _0x473f9a[_0x0141('0xd')](_0x1ef4bf)[_0x0141('0xe')](_0x17fc00);}};}function respondWithFilteredResult(_0xf7eb9c,_0x2ffd50){return function(_0x50ad75){if(_0x50ad75){var _0x53a003=typeof _0x2ffd50[_0x0141('0xf')]===_0x0141('0x10')&&typeof _0x2ffd50['limit']===_0x0141('0x10');var _0x4bd35e=_0x50ad75[_0x0141('0x11')];var _0x2fcf53=_0x53a003?0x0:_0x2ffd50[_0x0141('0xf')];var _0xff932b=_0x53a003?_0x50ad75[_0x0141('0x11')]:_0x2ffd50['offset']+_0x2ffd50[_0x0141('0x12')];var _0x1eb781;if(_0xff932b>=_0x4bd35e){_0xff932b=_0x4bd35e;_0x1eb781=0xc8;}else{_0x1eb781=0xce;}_0xf7eb9c[_0x0141('0xd')](_0x1eb781);return _0xf7eb9c[_0x0141('0x13')](_0x0141('0x14'),_0x2fcf53+'-'+_0xff932b+'/'+_0x4bd35e)[_0x0141('0xe')](_0x50ad75);}return null;};}function saveUpdates(_0x267fa1){return function(_0x4bca88){if(_0x4bca88){return _0x4bca88['update'](_0x267fa1)[_0x0141('0x15')](function(_0xdd2bb9){return _0xdd2bb9;});}return null;};}function removeEntity(_0x278fbc){return function(_0x84cfa9){if(_0x84cfa9){return _0x84cfa9['destroy']()[_0x0141('0x15')](function(){var _0x34f0e2=_0x84cfa9[_0x0141('0x16')]({'plain':!![]});var _0x398265=_0x0141('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x398265,'resourceId':_0x34f0e2['id']}})['then'](function(){return _0x84cfa9;});})['then'](function(){_0x278fbc['status'](0xcc)[_0x0141('0xc')]();});}};}function handleEntityNotFound(_0x14fa6c){return function(_0x19551c){if(!_0x19551c){_0x14fa6c['sendStatus'](0x194);}return _0x19551c;};}function handleError(_0x5e2a24,_0x54308f){_0x54308f=_0x54308f||0x1f4;return function(_0x31ca82){logger['error'](_0x31ca82[_0x0141('0x18')]);if(_0x31ca82['name']){delete _0x31ca82[_0x0141('0x19')];}_0x5e2a24['status'](_0x54308f)[_0x0141('0x1a')](_0x31ca82);};}exports[_0x0141('0x1b')]=function(_0x315f86,_0x2b9222){var _0x16d7eb={};var _0x26ca36={'count':0x0,'rows':[]};var _0x5b357b=_[_0x0141('0x1c')](db[_0x0141('0x1d')][_0x0141('0x1e')],function(_0x23ade0){return{'name':_0x23ade0[_0x0141('0x1f')],'type':_0x23ade0[_0x0141('0x20')][_0x0141('0x21')]};});_0x16d7eb=qs[_0x0141('0x22')](_0x5b357b,_0x315f86);var _0x4ab208={'where':_0x16d7eb[_0x0141('0x23')]};return db['OpenchannelQueue'][_0x0141('0x11')](_0x4ab208)[_0x0141('0x15')](function(_0x21a1e6){_0x26ca36[_0x0141('0x11')]=_0x21a1e6;_0x16d7eb[_0x0141('0x24')]=qs[_0x0141('0x24')](_0x315f86[_0x0141('0x25')]);return db[_0x0141('0x1d')]['findAll'](_0x16d7eb);})[_0x0141('0x15')](function(_0x5a17a5){_0x26ca36['rows']=_0x5a17a5;return _0x26ca36;})[_0x0141('0x15')](respondWithFilteredResult(_0x2b9222,_0x16d7eb))['catch'](handleError(_0x2b9222,null));};exports['show']=function(_0xdd2635,_0x404197){var _0xbc6375={'raw':!![],'where':{'id':_0xdd2635[_0x0141('0x26')]['id']}},_0x379f7d={};_0x379f7d[_0x0141('0x27')]=_[_0x0141('0x28')](db[_0x0141('0x1d')]['rawAttributes']);_0x379f7d[_0x0141('0x25')]=_[_0x0141('0x28')](_0xdd2635[_0x0141('0x25')]);_0x379f7d['filters']=_['intersection'](_0x379f7d[_0x0141('0x27')],_0x379f7d['query']);_0xbc6375[_0x0141('0x29')]=_[_0x0141('0x2a')](_0x379f7d[_0x0141('0x27')],qs[_0x0141('0x2b')](_0xdd2635[_0x0141('0x25')][_0x0141('0x2b')]));_0xbc6375[_0x0141('0x29')]=_0xbc6375[_0x0141('0x29')]['length']?_0xbc6375[_0x0141('0x29')]:_0x379f7d[_0x0141('0x27')];if(_0xdd2635[_0x0141('0x25')]['includeAll']){_0xbc6375['include']=[{'all':!![]}];}_0xbc6375=_['merge']({},_0xbc6375,_0xdd2635[_0x0141('0x2c')]);return db[_0x0141('0x1d')][_0x0141('0x2d')](_0xbc6375)['then'](handleEntityNotFound(_0x404197,null))[_0x0141('0x15')](respondWithResult(_0x404197,null))[_0x0141('0x2e')](handleError(_0x404197,null));};exports['create']=function(_0x2ce7f7,_0x4b6fcf){return db[_0x0141('0x1d')][_0x0141('0x2f')](_0x2ce7f7['body'],{})[_0x0141('0x15')](function(_0x18be76){var _0x3fac37=_0x2ce7f7[_0x0141('0x30')]['get']({'plain':!![]});if(!_0x3fac37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fac37[_0x0141('0x31')]==='user'){var _0x17e66c=_0x18be76['get']({'plain':!![]});var _0xda398f=_0x0141('0x17');return db[_0x0141('0x32')][_0x0141('0x2d')]({'where':{'name':_0xda398f,'userProfileId':_0x3fac37[_0x0141('0x33')]},'raw':!![]})[_0x0141('0x15')](function(_0x5bc04f){if(_0x5bc04f&&_0x5bc04f[_0x0141('0x34')]===0x0){return db[_0x0141('0x35')][_0x0141('0x2f')]({'name':_0x17e66c[_0x0141('0x19')],'resourceId':_0x17e66c['id'],'type':_0x5bc04f['name'],'sectionId':_0x5bc04f['id']},{})[_0x0141('0x15')](function(){return _0x18be76;});}else{return _0x18be76;}})[_0x0141('0x2e')](function(_0xe055e4){logger[_0x0141('0x36')](_0x0141('0x37'),_0xe055e4);throw _0xe055e4;});}return _0x18be76;})[_0x0141('0x15')](respondWithResult(_0x4b6fcf,0xc9))[_0x0141('0x2e')](handleError(_0x4b6fcf,null));};exports[_0x0141('0x38')]=function(_0x531d2c,_0x2c75ca){if(_0x531d2c[_0x0141('0x39')]['id']){delete _0x531d2c[_0x0141('0x39')]['id'];}return db[_0x0141('0x1d')]['find']({'where':{'id':_0x531d2c[_0x0141('0x26')]['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x2c75ca,null))[_0x0141('0x15')](saveUpdates(_0x531d2c[_0x0141('0x39')],null))['then'](respondWithResult(_0x2c75ca,null))['catch'](handleError(_0x2c75ca,null));};exports[_0x0141('0x3a')]=function(_0x4ed577,_0x1a779f){return db['OpenchannelQueue'][_0x0141('0x2d')]({'where':{'id':_0x4ed577[_0x0141('0x26')]['id']}})['then'](handleEntityNotFound(_0x1a779f,null))[_0x0141('0x15')](removeEntity(_0x1a779f,null))[_0x0141('0x2e')](handleError(_0x1a779f,null));};exports[_0x0141('0x3b')]=function(_0x48313a,_0x28b3be){return db[_0x0141('0x1d')][_0x0141('0x3b')]()[_0x0141('0x15')](respondWithResult(_0x28b3be,null))['catch'](handleError(_0x28b3be,null));};exports[_0x0141('0x3c')]=function(_0x33ff92,_0x2c8ed9){var _0x236e23={'raw':!![],'where':{}},_0x557d13={},_0x3afa12;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x33ff92['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x2c8ed9,null))[_0x0141('0x15')](function(_0x4aed4a){if(_0x4aed4a){_0x3afa12=_0x4aed4a[_0x0141('0x16')]({'plain':!![]});_0x557d13[_0x0141('0x27')]=_['keys'](db['UserOpenchannelQueue'][_0x0141('0x1e')]);_0x557d13[_0x0141('0x25')]=_[_0x0141('0x28')](_0x33ff92['query']);_0x557d13[_0x0141('0x3e')]=_['intersection'](_0x557d13[_0x0141('0x27')],_0x557d13[_0x0141('0x25')]);_0x236e23[_0x0141('0x29')]=_['intersection'](_0x557d13[_0x0141('0x27')],qs[_0x0141('0x2b')](_0x33ff92[_0x0141('0x25')]['fields']));_0x236e23[_0x0141('0x29')]=_0x236e23[_0x0141('0x29')]['length']?_0x236e23['attributes']:_0x557d13['model'];if(!_0x33ff92[_0x0141('0x25')][_0x0141('0x3f')]('nolimit')){_0x236e23['limit']=qs[_0x0141('0x12')](_0x33ff92['query'][_0x0141('0x12')]);_0x236e23['offset']=qs[_0x0141('0xf')](_0x33ff92[_0x0141('0x25')]['offset']);}_0x236e23[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x33ff92['query']['sort']);_0x236e23[_0x0141('0x23')]=qs[_0x0141('0x3e')](_[_0x0141('0x42')](_0x33ff92[_0x0141('0x25')],_0x557d13[_0x0141('0x3e')]));_0x236e23['where']['OpenchannelQueueId']=_0x4aed4a['id'];if(_0x33ff92[_0x0141('0x25')][_0x0141('0x43')]){_0x236e23[_0x0141('0x23')]=_['merge'](_0x236e23[_0x0141('0x23')],{'$or':_['map'](_0x236e23['attributes'],function(_0x58fae2){var _0x4813a9={};_0x4813a9[_0x58fae2]={'$like':'%'+_0x33ff92[_0x0141('0x25')][_0x0141('0x43')]+'%'};return _0x4813a9;})});}_0x236e23=_['merge']({},_0x236e23,_0x33ff92[_0x0141('0x2c')]);return db[_0x0141('0x44')][_0x0141('0x45')](_0x236e23);}})[_0x0141('0x15')](function(_0x21bd2f){if(_0x21bd2f){return db[_0x0141('0x46')]['findAndCountAll']({'where':{'id':_['map'](_0x21bd2f,_0x0141('0x47')),'role':'agent'},'attributes':['id',_0x0141('0x19'),_0x0141('0x48'),_0x0141('0x49'),_0x0141('0x4a')]});}})[_0x0141('0x15')](function(_0x3dfce0){if(_0x3dfce0){return{'count':_0x3dfce0[_0x0141('0x11')],'rows':_[_0x0141('0x1c')](_0x3dfce0[_0x0141('0x4b')],function(_0x195fd8){return{'membername':_0x195fd8[_0x0141('0x19')],'UserId':_0x195fd8['id'],'queue_name':_0x3afa12[_0x0141('0x19')],'OpenchannelQueueId':_0x3afa12['id'],'interface':util[_0x0141('0x4c')](_0x0141('0x4d'),'SIP',_0x195fd8[_0x0141('0x19')]),'penalty':0x0,'paused':_0x195fd8[_0x0141('0x48')],'createdAt':_0x195fd8[_0x0141('0x4a')],'updatedAt':_0x195fd8[_0x0141('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2c8ed9,_0x236e23))['catch'](handleError(_0x2c8ed9,null));};exports[_0x0141('0x4e')]=function(_0x48233d,_0x75280){var _0xcbf7f6={};var _0x408cd5={};var _0xffdc9f;var _0x2b1158;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x48233d[_0x0141('0x26')]['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x75280,null))[_0x0141('0x15')](function(_0x6ebd56){if(_0x6ebd56){_0xffdc9f=_0x6ebd56;_0x408cd5[_0x0141('0x27')]=_[_0x0141('0x28')](db['Team'][_0x0141('0x1e')]);_0x408cd5['query']=_['keys'](_0x48233d[_0x0141('0x25')]);_0x408cd5[_0x0141('0x3e')]=_['intersection'](_0x408cd5[_0x0141('0x27')],_0x408cd5['query']);_0xcbf7f6['attributes']=_[_0x0141('0x2a')](_0x408cd5[_0x0141('0x27')],qs[_0x0141('0x2b')](_0x48233d[_0x0141('0x25')][_0x0141('0x2b')]));_0xcbf7f6['attributes']=_0xcbf7f6[_0x0141('0x29')][_0x0141('0x4f')]?_0xcbf7f6['attributes']:_0x408cd5[_0x0141('0x27')];_0xcbf7f6[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x48233d[_0x0141('0x25')][_0x0141('0x41')]);_0xcbf7f6[_0x0141('0x23')]=qs[_0x0141('0x3e')](_['pick'](_0x48233d[_0x0141('0x25')],_0x408cd5[_0x0141('0x3e')]));if(_0x48233d[_0x0141('0x25')][_0x0141('0x43')]){_0xcbf7f6[_0x0141('0x23')]=_['merge'](_0xcbf7f6[_0x0141('0x23')],{'$or':_[_0x0141('0x1c')](_0xcbf7f6['attributes'],function(_0x44d576){var _0x5e471b={};_0x5e471b[_0x44d576]={'$like':'%'+_0x48233d[_0x0141('0x25')]['filter']+'%'};return _0x5e471b;})});}_0xcbf7f6=_['merge']({},_0xcbf7f6,_0x48233d[_0x0141('0x2c')]);return _0xffdc9f['getTeams'](_0xcbf7f6);}})[_0x0141('0x15')](function(_0x84ce6d){if(_0x84ce6d){_0x2b1158=_0x84ce6d[_0x0141('0x4f')];if(!_0x48233d[_0x0141('0x25')][_0x0141('0x3f')](_0x0141('0x50'))){_0xcbf7f6['limit']=qs[_0x0141('0x12')](_0x48233d[_0x0141('0x25')][_0x0141('0x12')]);_0xcbf7f6[_0x0141('0xf')]=qs['offset'](_0x48233d[_0x0141('0x25')][_0x0141('0xf')]);}return _0xffdc9f[_0x0141('0x4e')](_0xcbf7f6);}})[_0x0141('0x15')](function(_0x515c1b){if(_0x515c1b){return _0x515c1b?{'count':_0x2b1158,'rows':_0x515c1b}:null;}})[_0x0141('0x15')](respondWithResult(_0x75280,null))[_0x0141('0x2e')](handleError(_0x75280,null));};exports[_0x0141('0x51')]=function(_0x7b2fda,_0x40a52d){var _0x4e77e7=_0x7b2fda['body']['ids'];return db[_0x0141('0x52')][_0x0141('0x45')]({'where':{'id':_0x4e77e7},'attributes':['id'],'include':[{'model':db[_0x0141('0x46')],'as':_0x0141('0x53'),'attributes':['id',_0x0141('0x19'),_0x0141('0x54'),_0x0141('0x55'),'interface'],'raw':!![]}]})[_0x0141('0x15')](function(_0x7d3578){if(_0x7d3578){var _0x8f40ab=_[_0x0141('0x56')](_0x7d3578,function(_0x5151ef){var _0x263216=_0x5151ef[_0x0141('0x16')]({'plain':!![]});return _0x263216[_0x0141('0x53')];});return db[_0x0141('0x1d')][_0x0141('0x2d')]({'where':{'id':_0x7b2fda[_0x0141('0x26')]['id']}})[_0x0141('0x15')](function(_0x1a303c){return db['sequelize'][_0x0141('0x57')](function(_0x1cfc22){return _0x1a303c[_0x0141('0x51')](_0x4e77e7,{'transaction':_0x1cfc22})[_0x0141('0x15')](function(){return BPromise[_0x0141('0x58')](_0x8f40ab,function(_0x2eb494){return db['UserOpenchannelQueue'][_0x0141('0x59')]({'where':{'UserId':_0x2eb494['id'],'OpenchannelQueueId':_0x7b2fda['params']['id']},'transaction':_0x1cfc22});});})['then'](function(){_0x8f40ab[_0x0141('0x5a')](function(_0x335840){socket[_0x0141('0x5b')](_0x0141('0x5c'),{'UserId':_0x335840['id'],'OpenchannelQueueId':_0x1a303c['id']});});});});});}})[_0x0141('0x15')](respondWithStatusCode(_0x40a52d,null))[_0x0141('0x2e')](handleError(_0x40a52d,null));};exports['removeTeams']=function(_0x1732d1,_0x2f1e7f){return db[_0x0141('0x52')][_0x0141('0x45')]({'where':{'id':_0x1732d1[_0x0141('0x25')][_0x0141('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x0141('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0141('0x15')](handleEntityNotFound(_0x2f1e7f,null))[_0x0141('0x15')](function(_0x5a3394){var _0x5c6598=_[_0x0141('0x1c')](_0x5a3394,'id');var _0x5e20a2=[];var _0x55768b=[];var _0x49456c=squel[_0x0141('0x5e')]();_0x49456c[_0x0141('0x5f')]('tq.TeamId')[_0x0141('0x60')](_0x0141('0x61'),'tq')[_0x0141('0x62')](_0x0141('0x63'),'ut',_0x0141('0x64'))[_0x0141('0x23')](_0x0141('0x65'),_0x1732d1[_0x0141('0x26')]['id']);for(var _0x483b73=0x0;_0x483b73<_0x5a3394['length'];_0x483b73+=0x1){let _0x1236d0=_0x5a3394[_0x483b73];for(var _0x1953c8=0x0;_0x1953c8<_0x1236d0[_0x0141('0x53')]['length'];_0x1953c8+=0x1){let _0x2dd977=_0x1236d0[_0x0141('0x53')][_0x1953c8];var _0x2abb7c=_0x49456c['clone']();_0x2abb7c[_0x0141('0x23')](_0x0141('0x66'),_0x2dd977['id']);_0x55768b[_0x0141('0x67')](db[_0x0141('0x68')][_0x0141('0x25')](_0x2abb7c['toString'](),{'type':db[_0x0141('0x68')]['QueryTypes'][_0x0141('0x69')]})[_0x0141('0x15')](function(_0x55428e){if(_0x55428e[_0x0141('0x4f')]===0x1){return _0x2dd977['id'];}else{var _0x1cf9f8=_[_0x0141('0x6a')](_[_0x0141('0x1c')](_0x55428e,'TeamId'),function(_0x2bfbe8){return _['includes'](_0x5c6598,_0x2bfbe8);});if(_0x1cf9f8){return _0x2dd977['id'];}}}));}}return BPromise[_0x0141('0x6b')](_0x55768b)['then'](function(_0x300a2c){_0x5e20a2=_(_0x5e20a2)['union'](_0x300a2c)['compact']()['value']();return db[_0x0141('0x1d')][_0x0141('0x2d')]({'where':{'id':_0x1732d1['params']['id']}})[_0x0141('0x15')](function(_0x4ee6ce){return db['sequelize'][_0x0141('0x57')](function(_0x20250c){return _0x4ee6ce['removeTeams'](_0x1732d1[_0x0141('0x25')][_0x0141('0x5d')],{'transaction':_0x20250c})[_0x0141('0x15')](function(){if(!_[_0x0141('0x6c')](_0x5e20a2)){return _0x4ee6ce[_0x0141('0x6d')](_0x5e20a2,{'transaction':_0x20250c});}})[_0x0141('0x15')](function(){_0x5e20a2[_0x0141('0x5a')](function(_0x2b088a){socket['emit'](_0x0141('0x6e'),{'UserId':_0x2b088a,'OpenchannelQueueId':_0x4ee6ce['id']});});});});});});})[_0x0141('0x15')](respondWithStatusCode(_0x2f1e7f,null))[_0x0141('0x2e')](handleError(_0x2f1e7f,null));};exports[_0x0141('0x6f')]=function(_0x28aa0c,_0x4bd7a7){return db['OpenchannelQueue'][_0x0141('0x2d')]({'where':{'id':_0x28aa0c[_0x0141('0x26')]['id']}})['then'](handleEntityNotFound(_0x4bd7a7,null))[_0x0141('0x15')](function(_0x4e31e3){if(_0x4e31e3){return _0x4e31e3[_0x0141('0x6f')](_0x28aa0c['body'][_0x0141('0x5d')],_[_0x0141('0x70')](_0x28aa0c[_0x0141('0x39')],['ids','id'])||{})['spread'](function(_0x278f41){for(var _0x3758fe=0x0;_0x3758fe<_0x28aa0c[_0x0141('0x39')][_0x0141('0x5d')]['length'];_0x3758fe+=0x1){socket[_0x0141('0x5b')](_0x0141('0x5c'),{'UserId':Number(_0x28aa0c[_0x0141('0x39')][_0x0141('0x5d')][_0x3758fe]),'OpenchannelQueueId':Number(_0x28aa0c[_0x0141('0x26')]['id'])});}return _0x278f41;});}})[_0x0141('0x15')](respondWithResult(_0x4bd7a7,null))[_0x0141('0x2e')](handleError(_0x4bd7a7,null));};exports[_0x0141('0x6d')]=function(_0x48f71f,_0x249f29){return db[_0x0141('0x1d')]['find']({'where':{'id':_0x48f71f['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x249f29,null))['then'](function(_0x41e232){if(_0x41e232){return _0x41e232[_0x0141('0x6d')](_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')])[_0x0141('0x15')](function(){if(_[_0x0141('0x71')](_0x48f71f[_0x0141('0x25')]['ids'])){for(var _0x3318cd=0x0;_0x3318cd<_0x48f71f[_0x0141('0x25')]['ids'][_0x0141('0x4f')];_0x3318cd+=0x1){socket[_0x0141('0x5b')](_0x0141('0x6e'),{'UserId':Number(_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')][_0x3318cd]),'OpenchannelQueueId':Number(_0x48f71f[_0x0141('0x26')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')]),'OpenchannelQueueId':Number(_0x48f71f['params']['id'])});}});}})[_0x0141('0x15')](respondWithStatusCode(_0x249f29,null))[_0x0141('0x2e')](handleError(_0x249f29,null));};exports['getAgents']=function(_0x279938,_0x4d8ea9){var _0x55a2d5={};var _0x2ec000={};var _0x45a0f1;var _0x1949e0;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x279938['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x4d8ea9,null))['then'](function(_0x38ef82){if(_0x38ef82){_0x45a0f1=_0x38ef82;_0x2ec000['model']=_[_0x0141('0x28')](db[_0x0141('0x46')][_0x0141('0x1e')]);_0x2ec000[_0x0141('0x25')]=_[_0x0141('0x28')](_0x279938[_0x0141('0x25')]);_0x2ec000['filters']=_[_0x0141('0x2a')](_0x2ec000[_0x0141('0x27')],_0x2ec000[_0x0141('0x25')]);_0x55a2d5[_0x0141('0x29')]=_[_0x0141('0x2a')](_0x2ec000[_0x0141('0x27')],qs['fields'](_0x279938[_0x0141('0x25')][_0x0141('0x2b')]));_0x55a2d5[_0x0141('0x29')]=_0x55a2d5['attributes'][_0x0141('0x4f')]?_0x55a2d5[_0x0141('0x29')]:_0x2ec000[_0x0141('0x27')];_0x55a2d5[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x279938[_0x0141('0x25')][_0x0141('0x41')]);_0x55a2d5[_0x0141('0x23')]=qs[_0x0141('0x3e')](_['pick'](_0x279938['query'],_0x2ec000[_0x0141('0x3e')]));if(_0x279938[_0x0141('0x25')][_0x0141('0x43')]){_0x55a2d5[_0x0141('0x23')]=_['merge'](_0x55a2d5[_0x0141('0x23')],{'$or':_[_0x0141('0x1c')](_0x55a2d5[_0x0141('0x29')],function(_0x21054f){var _0x16587e={};_0x16587e[_0x21054f]={'$like':'%'+_0x279938[_0x0141('0x25')][_0x0141('0x43')]+'%'};return _0x16587e;})});}_0x55a2d5=_[_0x0141('0x72')]({},_0x55a2d5,_0x279938[_0x0141('0x2c')]);return _0x45a0f1['getAgents'](_0x55a2d5);}})[_0x0141('0x15')](function(_0x9cce58){if(_0x9cce58){_0x1949e0=_0x9cce58[_0x0141('0x4f')];if(!_0x279938[_0x0141('0x25')][_0x0141('0x3f')](_0x0141('0x50'))){_0x55a2d5[_0x0141('0x12')]=qs[_0x0141('0x12')](_0x279938['query']['limit']);_0x55a2d5[_0x0141('0xf')]=qs[_0x0141('0xf')](_0x279938[_0x0141('0x25')][_0x0141('0xf')]);}return _0x45a0f1['getAgents'](_0x55a2d5);}})['then'](function(_0x55346f){if(_0x55346f){return _0x55346f?{'count':_0x1949e0,'rows':_0x55346f}:null;}})[_0x0141('0x15')](respondWithResult(_0x4d8ea9,null))[_0x0141('0x2e')](handleError(_0x4d8ea9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d0193ac..6323b06 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 _0xa74d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x11ba32,_0x5a7ba6){var _0x296558=function(_0x53d575){while(--_0x53d575){_0x11ba32['push'](_0x11ba32['shift']());}};_0x296558(++_0x5a7ba6);}(_0xa74d,0x154));var _0xda74=function(_0x46d355,_0x1db95f){_0x46d355=_0x46d355-0x0;var _0x37b75f=_0xa74d[_0x46d355];return _0x37b75f;};'use strict';var EventEmitter=require(_0xda74('0x0'));var OpenchannelQueue=require(_0xda74('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xda74('0x2')](0x0);var events={'afterCreate':_0xda74('0x3'),'afterUpdate':_0xda74('0x4'),'afterDestroy':_0xda74('0x5')};function emitEvent(_0x395c6d){return function(_0x6b5778,_0x5c8a67,_0xcf795c){OpenchannelQueueEvents[_0xda74('0x6')](_0x395c6d+':'+_0x6b5778['id'],_0x6b5778);OpenchannelQueueEvents['emit'](_0x395c6d,_0x6b5778);_0xcf795c(null);};}for(var e in events){if(events[_0xda74('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xda74('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb4cd=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0xb4cd,0x9a));var _0xdb4c=function(_0x950c87,_0x381c1a){_0x950c87=_0x950c87-0x0;var _0x19d1ee=_0xb4cd[_0x950c87];return _0x19d1ee;};'use strict';var EventEmitter=require(_0xdb4c('0x0'));var OpenchannelQueue=require(_0xdb4c('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdb4c('0x2')](0x0);var events={'afterCreate':_0xdb4c('0x3'),'afterUpdate':_0xdb4c('0x4'),'afterDestroy':_0xdb4c('0x5')};function emitEvent(_0x37f13d){return function(_0x24ac3a,_0x2eb6bd,_0x1e3141){OpenchannelQueueEvents['emit'](_0x37f13d+':'+_0x24ac3a['id'],_0x24ac3a);OpenchannelQueueEvents['emit'](_0x37f13d,_0x24ac3a);_0x1e3141(null);};}for(var e in events){if(events[_0xdb4c('0x6')](e)){var event=events[e];OpenchannelQueue[_0xdb4c('0x7')](e,emitEvent(event));}}module[_0xdb4c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index beaa6a6..0918542 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 _0xad7d=['util','../../config/logger','api','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0xcb483f,_0x4afa66){var _0x138ca3=function(_0x55c9bb){while(--_0x55c9bb){_0xcb483f['push'](_0xcb483f['shift']());}};_0x138ca3(++_0x4afa66);}(_0xad7d,0x154));var _0xdad7=function(_0x17633a,_0x5ebbbd){_0x17633a=_0x17633a-0x0;var _0xa3c776=_0xad7d[_0x17633a];return _0xa3c776;};'use strict';var _=require(_0xdad7('0x0'));var util=require(_0xdad7('0x1'));var logger=require(_0xdad7('0x2'))(_0xdad7('0x3'));var moment=require('moment');var BPromise=require(_0xdad7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdad7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdad7('0x6'));module[_0xdad7('0x7')]=function(_0x14a445,_0xc1a7b6){return _0x14a445[_0xdad7('0x8')](_0xdad7('0x9'),attributes,{'tableName':_0xdad7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b5=['OpenchannelQueue','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x2afcc2,_0x509165){var _0x238b69=function(_0x578f28){while(--_0x578f28){_0x2afcc2['push'](_0x2afcc2['shift']());}};_0x238b69(++_0x509165);}(_0xe5b5,0x8d));var _0x5e5b=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xe5b5[_0x43a37c];return _0x5d1d40;};'use strict';var _=require('lodash');var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var moment=require(_0x5e5b('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e5b('0x4'));var fs=require('fs');var path=require(_0x5e5b('0x5'));var rimraf=require(_0x5e5b('0x6'));var config=require(_0x5e5b('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x51ea1c,_0x36e88e){return _0x51ea1c[_0x5e5b('0x8')](_0x5e5b('0x9'),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 88c0a32..37fd3b0 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 _0xfad9=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','model','attributes','include','ShowOpenchannelQueue','find','where','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x4c1222,_0x3362f3){var _0x5e9a17=function(_0x23ba79){while(--_0x23ba79){_0x4c1222['push'](_0x4c1222['shift']());}};_0x5e9a17(++_0x3362f3);}(_0xfad9,0xd6));var _0x9fad=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xfad9[_0x1780f8];return _0x33a410;};'use strict';var _=require('lodash');var util=require(_0x9fad('0x0'));var moment=require(_0x9fad('0x1'));var BPromise=require(_0x9fad('0x2'));var rs=require(_0x9fad('0x3'));var fs=require('fs');var Redis=require(_0x9fad('0x4'));var db=require(_0x9fad('0x5'))['db'];var utils=require(_0x9fad('0x6'));var logger=require(_0x9fad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9fad('0x8'));var client=jayson[_0x9fad('0x9')][_0x9fad('0xa')]({'port':0x232a});config['redis']=_[_0x9fad('0xb')](config[_0x9fad('0xc')],{'host':_0x9fad('0xd'),'port':0x18eb});var socket=require(_0x9fad('0xe'))(new Redis(config[_0x9fad('0xc')]));require(_0x9fad('0xf'))['register'](socket);function respondWithRpcPromise(_0xf13c0c,_0x3308a7,_0x352a4b){return new BPromise(function(_0x5cd50f,_0x1b777a){return client[_0x9fad('0x10')](_0xf13c0c,_0x352a4b)[_0x9fad('0x11')](function(_0x51489e){logger[_0x9fad('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3308a7,_0x9fad('0x13'));logger[_0x9fad('0x14')](_0x9fad('0x15'),_0x3308a7,'request\x20sent',JSON[_0x9fad('0x16')](_0x51489e));if(_0x51489e[_0x9fad('0x17')]){if(_0x51489e['error']['code']===0x1f4){logger['error'](_0x9fad('0x18'),_0x3308a7,_0x51489e[_0x9fad('0x17')]['message']);return _0x1b777a(_0x51489e[_0x9fad('0x17')][_0x9fad('0x19')]);}logger['error'](_0x9fad('0x18'),_0x3308a7,_0x51489e[_0x9fad('0x17')][_0x9fad('0x19')]);return _0x5cd50f(_0x51489e['error'][_0x9fad('0x19')]);}else{logger[_0x9fad('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3308a7,'request\x20sent');_0x5cd50f(_0x51489e[_0x9fad('0x1a')][_0x9fad('0x19')]);}})[_0x9fad('0x1b')](function(_0x50d8a8){logger[_0x9fad('0x17')](_0x9fad('0x18'),_0x3308a7,_0x50d8a8);_0x1b777a(_0x50d8a8);});});}exports[_0x9fad('0x1c')]=function(_0x3b7075){var _0x489dc1=this;return new Promise(function(_0xf707b3,_0x3c7f1d){return db[_0x9fad('0x1d')][_0x9fad('0x1e')]({'raw':_0x3b7075[_0x9fad('0x1f')]?_0x3b7075['options'][_0x9fad('0x20')]===undefined?!![]:![]:!![],'where':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['where']||null:null,'attributes':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['attributes']||null:null,'limit':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['limit']||null:null,'include':_0x3b7075[_0x9fad('0x1f')]?_0x3b7075[_0x9fad('0x1f')]['include']?_['map'](_0x3b7075['options']['include'],function(_0x555a58){return{'model':db[_0x555a58[_0x9fad('0x21')]],'as':_0x555a58['as'],'attributes':_0x555a58[_0x9fad('0x22')],'include':_0x555a58[_0x9fad('0x23')]?_['map'](_0x555a58['include'],function(_0x14620a){return{'model':db[_0x14620a[_0x9fad('0x21')]],'as':_0x14620a['as'],'attributes':_0x14620a[_0x9fad('0x22')],'include':_0x14620a[_0x9fad('0x23')]?_['map'](_0x14620a[_0x9fad('0x23')],function(_0x42ebf1){return{'model':db[_0x42ebf1['model']],'as':_0x42ebf1['as'],'attributes':_0x42ebf1[_0x9fad('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9fad('0x11')](function(_0x54b231){logger[_0x9fad('0x12')]('GetOpenchannelQueue',_0x3b7075);logger[_0x9fad('0x14')](_0x9fad('0x1c'),_0x3b7075,JSON[_0x9fad('0x16')](_0x54b231));_0xf707b3(_0x54b231);})[_0x9fad('0x1b')](function(_0x3bf378){logger['error'](_0x9fad('0x1c'),_0x3bf378['message'],_0x3b7075);_0x3c7f1d(_0x489dc1['error'](0x1f4,_0x3bf378[_0x9fad('0x19')]));});});};exports[_0x9fad('0x24')]=function(_0x1db9fd){var _0x3132a6=this;return new Promise(function(_0x98cf3d,_0x354f37){return db[_0x9fad('0x1d')][_0x9fad('0x25')]({'raw':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x26')]||null:null,'attributes':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x22')]||null:null,'include':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')]['include']?_[_0x9fad('0x27')](_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x23')],function(_0x2ee974){return{'model':db[_0x2ee974['model']],'as':_0x2ee974['as'],'attributes':_0x2ee974[_0x9fad('0x22')],'include':_0x2ee974['include']?_[_0x9fad('0x27')](_0x2ee974['include'],function(_0x41d68c){return{'model':db[_0x41d68c[_0x9fad('0x21')]],'as':_0x41d68c['as'],'attributes':_0x41d68c[_0x9fad('0x22')],'include':_0x41d68c[_0x9fad('0x23')]?_[_0x9fad('0x27')](_0x41d68c[_0x9fad('0x23')],function(_0x410f97){return{'model':db[_0x410f97['model']],'as':_0x410f97['as'],'attributes':_0x410f97[_0x9fad('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9fad('0x11')](function(_0x3058d9){logger[_0x9fad('0x12')](_0x9fad('0x24'),_0x1db9fd);logger[_0x9fad('0x14')](_0x9fad('0x24'),_0x1db9fd,JSON['stringify'](_0x3058d9));_0x98cf3d(_0x3058d9);})[_0x9fad('0x1b')](function(_0x1526c2){logger['error'](_0x9fad('0x24'),_0x1526c2['message'],_0x1db9fd);_0x354f37(_0x3132a6[_0x9fad('0x17')](0x1f4,_0x1526c2[_0x9fad('0x19')]));});});}; \ No newline at end of file +var _0x080a=['attributes','limit','include','map','model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueue','options','raw','where'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x080a,0x111));var _0xa080=function(_0xc136d6,_0x291dd5){_0xc136d6=_0xc136d6-0x0;var _0xe1c77f=_0x080a[_0xc136d6];return _0xe1c77f;};'use strict';var _=require(_0xa080('0x0'));var util=require(_0xa080('0x1'));var moment=require(_0xa080('0x2'));var BPromise=require(_0xa080('0x3'));var rs=require(_0xa080('0x4'));var fs=require('fs');var Redis=require(_0xa080('0x5'));var db=require(_0xa080('0x6'))['db'];var utils=require(_0xa080('0x7'));var logger=require(_0xa080('0x8'))(_0xa080('0x9'));var config=require(_0xa080('0xa'));var jayson=require(_0xa080('0xb'));var client=jayson['client'][_0xa080('0xc')]({'port':0x232a});config[_0xa080('0xd')]=_[_0xa080('0xe')](config[_0xa080('0xd')],{'host':_0xa080('0xf'),'port':0x18eb});var socket=require(_0xa080('0x10'))(new Redis(config[_0xa080('0xd')]));require(_0xa080('0x11'))[_0xa080('0x12')](socket);function respondWithRpcPromise(_0x9feabe,_0x4777b9,_0x32d17d){return new BPromise(function(_0x5a88c3,_0x523d2f){return client[_0xa080('0x13')](_0x9feabe,_0x32d17d)[_0xa080('0x14')](function(_0x5573cf){logger[_0xa080('0x15')](_0xa080('0x16'),_0x4777b9,_0xa080('0x17'));logger[_0xa080('0x18')](_0xa080('0x19'),_0x4777b9,'request\x20sent',JSON[_0xa080('0x1a')](_0x5573cf));if(_0x5573cf[_0xa080('0x1b')]){if(_0x5573cf[_0xa080('0x1b')][_0xa080('0x1c')]===0x1f4){logger['error'](_0xa080('0x16'),_0x4777b9,_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);return _0x523d2f(_0x5573cf[_0xa080('0x1b')]['message']);}logger[_0xa080('0x1b')]('OpenchannelQueue,\x20%s,\x20%s',_0x4777b9,_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);return _0x5a88c3(_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);}else{logger[_0xa080('0x15')](_0xa080('0x16'),_0x4777b9,_0xa080('0x17'));_0x5a88c3(_0x5573cf[_0xa080('0x1e')][_0xa080('0x1d')]);}})['catch'](function(_0x5aca39){logger['error'](_0xa080('0x16'),_0x4777b9,_0x5aca39);_0x523d2f(_0x5aca39);});});}exports['GetOpenchannelQueue']=function(_0x52fd8a){var _0xcffc85=this;return new Promise(function(_0x3eabf2,_0x4c77fc){return db[_0xa080('0x1f')]['findAll']({'raw':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x21')]===undefined?!![]:![]:!![],'where':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x22')]||null:null,'attributes':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a['options'][_0xa080('0x23')]||null:null,'limit':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x24')]||null:null,'include':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x25')]?_[_0xa080('0x26')](_0x52fd8a[_0xa080('0x20')]['include'],function(_0x3c2006){return{'model':db[_0x3c2006[_0xa080('0x27')]],'as':_0x3c2006['as'],'attributes':_0x3c2006[_0xa080('0x23')],'include':_0x3c2006[_0xa080('0x25')]?_[_0xa080('0x26')](_0x3c2006[_0xa080('0x25')],function(_0xd07ff9){return{'model':db[_0xd07ff9[_0xa080('0x27')]],'as':_0xd07ff9['as'],'attributes':_0xd07ff9[_0xa080('0x23')],'include':_0xd07ff9[_0xa080('0x25')]?_['map'](_0xd07ff9[_0xa080('0x25')],function(_0x45d09e){return{'model':db[_0x45d09e[_0xa080('0x27')]],'as':_0x45d09e['as'],'attributes':_0x45d09e[_0xa080('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa080('0x14')](function(_0x9cc4f5){logger[_0xa080('0x15')](_0xa080('0x28'),_0x52fd8a);logger['debug'](_0xa080('0x28'),_0x52fd8a,JSON[_0xa080('0x1a')](_0x9cc4f5));_0x3eabf2(_0x9cc4f5);})[_0xa080('0x29')](function(_0x4c9554){logger[_0xa080('0x1b')](_0xa080('0x28'),_0x4c9554[_0xa080('0x1d')],_0x52fd8a);_0x4c77fc(_0xcffc85[_0xa080('0x1b')](0x1f4,_0x4c9554[_0xa080('0x1d')]));});});};exports[_0xa080('0x2a')]=function(_0x524b3f){var _0x2f347c=this;return new Promise(function(_0x414e5b,_0x32ea49){return db[_0xa080('0x1f')][_0xa080('0x2b')]({'raw':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')][_0xa080('0x21')]===undefined?!![]:![]:!![],'where':_0x524b3f[_0xa080('0x20')]?_0x524b3f['options'][_0xa080('0x22')]||null:null,'attributes':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')]['attributes']||null:null,'include':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')][_0xa080('0x25')]?_[_0xa080('0x26')](_0x524b3f['options'][_0xa080('0x25')],function(_0xfdaf12){return{'model':db[_0xfdaf12[_0xa080('0x27')]],'as':_0xfdaf12['as'],'attributes':_0xfdaf12[_0xa080('0x23')],'include':_0xfdaf12[_0xa080('0x25')]?_[_0xa080('0x26')](_0xfdaf12['include'],function(_0x47f20e){return{'model':db[_0x47f20e[_0xa080('0x27')]],'as':_0x47f20e['as'],'attributes':_0x47f20e['attributes'],'include':_0x47f20e[_0xa080('0x25')]?_['map'](_0x47f20e[_0xa080('0x25')],function(_0x75062d){return{'model':db[_0x75062d[_0xa080('0x27')]],'as':_0x75062d['as'],'attributes':_0x75062d[_0xa080('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa080('0x14')](function(_0x512070){logger[_0xa080('0x15')](_0xa080('0x2a'),_0x524b3f);logger[_0xa080('0x18')]('ShowOpenchannelQueue',_0x524b3f,JSON[_0xa080('0x1a')](_0x512070));_0x414e5b(_0x512070);})[_0xa080('0x29')](function(_0x572019){logger[_0xa080('0x1b')](_0xa080('0x2a'),_0x572019[_0xa080('0x1d')],_0x524b3f);_0x32ea49(_0x2f347c['error'](0x1f4,_0x572019[_0xa080('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 248bbde..4d94bdc 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 _0x3865=['save','remove','update','emit','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3fa3b6,_0x57804d){var _0x2e1825=function(_0x308f9c){while(--_0x308f9c){_0x3fa3b6['push'](_0x3fa3b6['shift']());}};_0x2e1825(++_0x57804d);}(_0x3865,0x13a));var _0x5386=function(_0x4f4c77,_0x11f842){_0x4f4c77=_0x4f4c77-0x0;var _0x555cb3=_0x3865[_0x4f4c77];return _0x555cb3;};'use strict';var OpenchannelQueueEvents=require(_0x5386('0x0'));var events=[_0x5386('0x1'),_0x5386('0x2'),_0x5386('0x3')];function createListener(_0xc23910,_0x285b0a){return function(_0x13108d){_0x285b0a[_0x5386('0x4')](_0xc23910,_0x13108d);};}function removeListener(_0xd4c1eb,_0x59e83c){return function(){OpenchannelQueueEvents['removeListener'](_0xd4c1eb,_0x59e83c);};}exports[_0x5386('0x5')]=function(_0xf1a138){for(var _0x51babe=0x0,_0x939c81=events['length'];_0x51babe<_0x939c81;_0x51babe++){var _0x2b4d2b=events[_0x51babe];var _0x2f9ae8=createListener(_0x5386('0x6')+_0x2b4d2b,_0xf1a138);OpenchannelQueueEvents['on'](_0x2b4d2b,_0x2f9ae8);}}; \ No newline at end of file +var _0xebd0=['save','remove','emit','register','length','./openchannelQueue.events'];(function(_0x40b932,_0x305c43){var _0x188a20=function(_0x1b2bd2){while(--_0x1b2bd2){_0x40b932['push'](_0x40b932['shift']());}};_0x188a20(++_0x305c43);}(_0xebd0,0x149));var _0x0ebd=function(_0x1993a9,_0x42cc64){_0x1993a9=_0x1993a9-0x0;var _0x125e71=_0xebd0[_0x1993a9];return _0x125e71;};'use strict';var OpenchannelQueueEvents=require(_0x0ebd('0x0'));var events=[_0x0ebd('0x1'),_0x0ebd('0x2'),'update'];function createListener(_0x168d49,_0x1c0a1c){return function(_0x1d23f9){_0x1c0a1c[_0x0ebd('0x3')](_0x168d49,_0x1d23f9);};}function removeListener(_0x46d2d2,_0x775024){return function(){OpenchannelQueueEvents['removeListener'](_0x46d2d2,_0x775024);};}exports[_0x0ebd('0x4')]=function(_0x1ddc1b){for(var _0x5ede3d=0x0,_0x20f3eb=events[_0x0ebd('0x5')];_0x5ede3d<_0x20f3eb;_0x5ede3d++){var _0xd91292=events[_0x5ede3d];var _0x4a48d1=createListener('openchannelQueue:'+_0xd91292,_0x1ddc1b);OpenchannelQueueEvents['on'](_0xd91292,_0x4a48d1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 16f5f4d..116c743 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 _0xfb33=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x111327,_0x1e340b){var _0x5eca7a=function(_0x546550){while(--_0x546550){_0x111327['push'](_0x111327['shift']());}};_0x5eca7a(++_0x1e340b);}(_0xfb33,0x90));var _0x3fb3=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xfb33[_0x48e1ec];return _0x3b33eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fb3('0x0'));var timeout=require(_0x3fb3('0x1'));var express=require(_0x3fb3('0x2'));var router=express[_0x3fb3('0x3')]();var fs_extra=require(_0x3fb3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3fb3('0x5'));var config=require(_0x3fb3('0x6'));var controller=require(_0x3fb3('0x7'));router['get']('/',auth[_0x3fb3('0x8')](),controller['index']);router[_0x3fb3('0x9')]('/describe',auth[_0x3fb3('0x8')](),controller[_0x3fb3('0xa')]);router['get'](_0x3fb3('0xb'),auth['isAuthenticated'](),controller[_0x3fb3('0xc')]);router[_0x3fb3('0xd')]('/',auth['isAuthenticated'](),controller[_0x3fb3('0xe')]);router['put'](_0x3fb3('0xb'),auth['isAuthenticated'](),controller[_0x3fb3('0xf')]);router[_0x3fb3('0x10')](_0x3fb3('0xb'),auth[_0x3fb3('0x8')](),controller[_0x3fb3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8ec8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x8ec8,0x159));var _0x88ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ec8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x88ec('0x0'));var util=require(_0x88ec('0x1'));var path=require(_0x88ec('0x2'));var timeout=require(_0x88ec('0x3'));var express=require(_0x88ec('0x4'));var router=express[_0x88ec('0x5')]();var fs_extra=require(_0x88ec('0x6'));var auth=require(_0x88ec('0x7'));var interaction=require(_0x88ec('0x8'));var config=require(_0x88ec('0x9'));var controller=require(_0x88ec('0xa'));router[_0x88ec('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ec('0xb')](_0x88ec('0xc'),auth['isAuthenticated'](),controller[_0x88ec('0xd')]);router['get'](_0x88ec('0xe'),auth[_0x88ec('0xf')](),controller['show']);router[_0x88ec('0x10')]('/',auth['isAuthenticated'](),controller[_0x88ec('0x11')]);router[_0x88ec('0x12')](_0x88ec('0xe'),auth[_0x88ec('0xf')](),controller[_0x88ec('0x13')]);router['delete'](_0x88ec('0xe'),auth['isAuthenticated'](),controller[_0x88ec('0x14')]);module[_0x88ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5cc70e1..9885b87 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 _0x6fc3=['sequelize','exports','STRING','DATE','moment'];(function(_0x329cd9,_0x351296){var _0x4ebe34=function(_0x586c9d){while(--_0x586c9d){_0x329cd9['push'](_0x329cd9['shift']());}};_0x4ebe34(++_0x351296);}(_0x6fc3,0x117));var _0x36fc=function(_0x11b42e,_0x21fe54){_0x11b42e=_0x11b42e-0x0;var _0x3c8641=_0x6fc3[_0x11b42e];return _0x3c8641;};'use strict';var moment=require(_0x36fc('0x0'));var Sequelize=require(_0x36fc('0x1'));module[_0x36fc('0x2')]={'uniqueid':{'type':Sequelize[_0x36fc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x36fc('0x3')]},'joinAt':{'type':Sequelize[_0x36fc('0x4')]},'leaveAt':{'type':Sequelize[_0x36fc('0x4')]},'acceptAt':{'type':Sequelize[_0x36fc('0x4')]},'exitAt':{'type':Sequelize[_0x36fc('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x363b=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f272f,_0x4ec10f){var _0x3cd290=function(_0x4aa5ea){while(--_0x4aa5ea){_0x1f272f['push'](_0x1f272f['shift']());}};_0x3cd290(++_0x4ec10f);}(_0x363b,0x17c));var _0xb363=function(_0x79f71b,_0x4946d2){_0x79f71b=_0x79f71b-0x0;var _0x2495af=_0x363b[_0x79f71b];return _0x2495af;};'use strict';var moment=require(_0xb363('0x0'));var Sequelize=require(_0xb363('0x1'));module[_0xb363('0x2')]={'uniqueid':{'type':Sequelize[_0xb363('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb363('0x3')]},'joinAt':{'type':Sequelize[_0xb363('0x4')]},'leaveAt':{'type':Sequelize[_0xb363('0x4')]},'acceptAt':{'type':Sequelize[_0xb363('0x4')]},'exitAt':{'type':Sequelize[_0xb363('0x4')]},'reason':{'type':Sequelize[_0xb363('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8178520..b229671 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 _0x039e=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x283d4f,_0x27fd9b){var _0x3085cf=function(_0x1efdf6){while(--_0x1efdf6){_0x283d4f['push'](_0x283d4f['shift']());}};_0x3085cf(++_0x27fd9b);}(_0x039e,0xe2));var _0xe039=function(_0x2ac16c,_0xf6b95e){_0x2ac16c=_0x2ac16c-0x0;var _0x29507a=_0x039e[_0x2ac16c];return _0x29507a;};'use strict';var emlformat=require(_0xe039('0x0'));var rimraf=require(_0xe039('0x1'));var zipdir=require(_0xe039('0x2'));var jsonpatch=require(_0xe039('0x3'));var rp=require(_0xe039('0x4'));var moment=require('moment');var BPromise=require(_0xe039('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe039('0x6'));var sox=require(_0xe039('0x7'));var csv=require(_0xe039('0x8'));var ejs=require(_0xe039('0x9'));var fs=require('fs');var fs_extra=require(_0xe039('0xa'));var _=require('lodash');var squel=require(_0xe039('0xb'));var crypto=require(_0xe039('0xc'));var jsforce=require(_0xe039('0xd'));var deskjs=require(_0xe039('0xe'));var toCsv=require(_0xe039('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe039('0xf'));var authService=require(_0xe039('0x10'));var qs=require(_0xe039('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe039('0x12'));var logger=require(_0xe039('0x13'))(_0xe039('0x14'));var utils=require(_0xe039('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe039('0x16'));var db=require(_0xe039('0x17'))['db'];function respondWithStatusCode(_0x2d0804,_0x2ce8dd){_0x2ce8dd=_0x2ce8dd||0xcc;return function(_0x1f47ee){if(_0x1f47ee){return _0x2d0804['sendStatus'](_0x2ce8dd);}return _0x2d0804['status'](_0x2ce8dd)[_0xe039('0x18')]();};}function respondWithResult(_0x3c8da9,_0x2c7edb){_0x2c7edb=_0x2c7edb||0xc8;return function(_0x6c835){if(_0x6c835){return _0x3c8da9[_0xe039('0x19')](_0x2c7edb)[_0xe039('0x1a')](_0x6c835);}};}function respondWithFilteredResult(_0x489650,_0x3b786c){return function(_0x23b3cc){if(_0x23b3cc){var _0x43fdf2=typeof _0x3b786c[_0xe039('0x1b')]===_0xe039('0x1c')&&typeof _0x3b786c[_0xe039('0x1d')]==='undefined';var _0x41771e=_0x23b3cc[_0xe039('0x1e')];var _0x204160=_0x43fdf2?0x0:_0x3b786c[_0xe039('0x1b')];var _0x20536a=_0x43fdf2?_0x23b3cc[_0xe039('0x1e')]:_0x3b786c[_0xe039('0x1b')]+_0x3b786c[_0xe039('0x1d')];var _0x2f0b7a;if(_0x20536a>=_0x41771e){_0x20536a=_0x41771e;_0x2f0b7a=0xc8;}else{_0x2f0b7a=0xce;}_0x489650['status'](_0x2f0b7a);return _0x489650[_0xe039('0x1f')]('Content-Range',_0x204160+'-'+_0x20536a+'/'+_0x41771e)[_0xe039('0x1a')](_0x23b3cc);}return null;};}function patchUpdates(_0x26a496){return function(_0x4918cd){try{jsonpatch[_0xe039('0x20')](_0x4918cd,_0x26a496,!![]);}catch(_0x2e931c){return BPromise['reject'](_0x2e931c);}return _0x4918cd['save']();};}function saveUpdates(_0x4d0f11,_0x4a33ed){return function(_0x425d8a){if(_0x425d8a){return _0x425d8a[_0xe039('0x21')](_0x4d0f11)[_0xe039('0x22')](function(_0x1384da){return _0x1384da;});}return null;};}function removeEntity(_0x1f8041,_0x5803b1){return function(_0x3f27c4){if(_0x3f27c4){return _0x3f27c4[_0xe039('0x23')]()[_0xe039('0x22')](function(){_0x1f8041[_0xe039('0x19')](0xcc)[_0xe039('0x18')]();});}};}function handleEntityNotFound(_0x57c0b2,_0x55b5f2){return function(_0x53953e){if(!_0x53953e){_0x57c0b2[_0xe039('0x24')](0x194);}return _0x53953e;};}function handleError(_0x40634a,_0x151d4f){_0x151d4f=_0x151d4f||0x1f4;return function(_0x4d455f){logger['error'](_0x4d455f[_0xe039('0x25')]);if(_0x4d455f['name']){delete _0x4d455f[_0xe039('0x26')];}_0x40634a[_0xe039('0x19')](_0x151d4f)[_0xe039('0x27')](_0x4d455f);};}exports[_0xe039('0x28')]=function(_0x11d689,_0x36b604){var _0x126135={},_0x489490={},_0x40df64={'count':0x0,'rows':[]};var _0x9787b2=_[_0xe039('0x29')](db['OpenchannelQueueReport'][_0xe039('0x2a')],function(_0x22f094){return{'name':_0x22f094[_0xe039('0x2b')],'type':_0x22f094[_0xe039('0x2c')][_0xe039('0x2d')]};});_0x489490[_0xe039('0x2e')]=_[_0xe039('0x29')](_0x9787b2,_0xe039('0x26'));_0x489490[_0xe039('0x2f')]=_[_0xe039('0x30')](_0x11d689[_0xe039('0x2f')]);_0x489490['filters']=_[_0xe039('0x31')](_0x489490[_0xe039('0x2e')],_0x489490[_0xe039('0x2f')]);_0x126135['attributes']=_[_0xe039('0x31')](_0x489490[_0xe039('0x2e')],qs[_0xe039('0x32')](_0x11d689[_0xe039('0x2f')][_0xe039('0x32')]));_0x126135[_0xe039('0x33')]=_0x126135[_0xe039('0x33')][_0xe039('0x34')]?_0x126135[_0xe039('0x33')]:_0x489490[_0xe039('0x2e')];if(!_0x11d689[_0xe039('0x2f')][_0xe039('0x35')](_0xe039('0x36'))){_0x126135[_0xe039('0x1d')]=qs['limit'](_0x11d689[_0xe039('0x2f')]['limit']);_0x126135[_0xe039('0x1b')]=qs[_0xe039('0x1b')](_0x11d689['query'][_0xe039('0x1b')]);}_0x126135['order']=qs[_0xe039('0x37')](_0x11d689[_0xe039('0x2f')][_0xe039('0x37')]);_0x126135[_0xe039('0x38')]=qs[_0xe039('0x39')](_[_0xe039('0x3a')](_0x11d689[_0xe039('0x2f')],_0x489490[_0xe039('0x39')]),_0x9787b2);if(_0x11d689[_0xe039('0x2f')]['filter']){_0x126135[_0xe039('0x38')]=_[_0xe039('0x3b')](_0x126135['where'],{'$or':_[_0xe039('0x29')](_0x9787b2,function(_0x571515){if(_0x571515[_0xe039('0x2c')]!==_0xe039('0x3c')){var _0x24479d={};_0x24479d[_0x571515[_0xe039('0x26')]]={'$like':'%'+_0x11d689[_0xe039('0x2f')][_0xe039('0x3d')]+'%'};return _0x24479d;}})});}_0x126135=_[_0xe039('0x3b')]({},_0x126135,_0x11d689[_0xe039('0x3e')]);var _0x28f6a0={'where':_0x126135[_0xe039('0x38')]};return db[_0xe039('0x3f')][_0xe039('0x1e')](_0x28f6a0)[_0xe039('0x22')](function(_0x5e3839){_0x40df64[_0xe039('0x1e')]=_0x5e3839;if(_0x11d689['query'][_0xe039('0x40')]){_0x126135[_0xe039('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xe039('0x42')](_0x126135);})['then'](function(_0x22d9a4){_0x40df64[_0xe039('0x43')]=_0x22d9a4;return _0x40df64;})[_0xe039('0x22')](respondWithFilteredResult(_0x36b604,_0x126135))[_0xe039('0x44')](handleError(_0x36b604,null));};exports[_0xe039('0x45')]=function(_0xc18719,_0x5d7ec4){var _0x95a32c={'raw':!![],'where':{'id':_0xc18719[_0xe039('0x46')]['id']}},_0x1e44a2={};_0x1e44a2[_0xe039('0x2e')]=_[_0xe039('0x30')](db['OpenchannelQueueReport'][_0xe039('0x2a')]);_0x1e44a2['query']=_['keys'](_0xc18719[_0xe039('0x2f')]);_0x1e44a2[_0xe039('0x39')]=_[_0xe039('0x31')](_0x1e44a2[_0xe039('0x2e')],_0x1e44a2[_0xe039('0x2f')]);_0x95a32c[_0xe039('0x33')]=_[_0xe039('0x31')](_0x1e44a2[_0xe039('0x2e')],qs['fields'](_0xc18719[_0xe039('0x2f')][_0xe039('0x32')]));_0x95a32c['attributes']=_0x95a32c[_0xe039('0x33')][_0xe039('0x34')]?_0x95a32c[_0xe039('0x33')]:_0x1e44a2[_0xe039('0x2e')];if(_0xc18719[_0xe039('0x2f')][_0xe039('0x40')]){_0x95a32c[_0xe039('0x41')]=[{'all':!![]}];}_0x95a32c=_[_0xe039('0x3b')]({},_0x95a32c,_0xc18719[_0xe039('0x3e')]);return db[_0xe039('0x3f')][_0xe039('0x47')](_0x95a32c)[_0xe039('0x22')](handleEntityNotFound(_0x5d7ec4,null))[_0xe039('0x22')](respondWithResult(_0x5d7ec4,null))[_0xe039('0x44')](handleError(_0x5d7ec4,null));};exports['create']=function(_0x70da08,_0x1127b7){return db[_0xe039('0x3f')][_0xe039('0x48')](_0x70da08['body'],{})[_0xe039('0x22')](respondWithResult(_0x1127b7,0xc9))[_0xe039('0x44')](handleError(_0x1127b7,null));};exports[_0xe039('0x21')]=function(_0x177f27,_0x34533d){if(_0x177f27[_0xe039('0x49')]['id']){delete _0x177f27[_0xe039('0x49')]['id'];}return db['OpenchannelQueueReport'][_0xe039('0x47')]({'where':{'id':_0x177f27[_0xe039('0x46')]['id']}})[_0xe039('0x22')](handleEntityNotFound(_0x34533d,null))[_0xe039('0x22')](saveUpdates(_0x177f27[_0xe039('0x49')],null))[_0xe039('0x22')](respondWithResult(_0x34533d,null))[_0xe039('0x44')](handleError(_0x34533d,null));};exports['destroy']=function(_0x450f8d,_0xc7dd4){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x450f8d[_0xe039('0x46')]['id']}})[_0xe039('0x22')](handleEntityNotFound(_0xc7dd4,null))[_0xe039('0x22')](removeEntity(_0xc7dd4,null))[_0xe039('0x44')](handleError(_0xc7dd4,null));};exports['describe']=function(_0x866aa,_0x4e1534){return db[_0xe039('0x3f')][_0xe039('0x4a')]()[_0xe039('0x22')](respondWithResult(_0x4e1534,null))[_0xe039('0x44')](handleError(_0x4e1534,null));}; \ No newline at end of file +var _0xb84b=['request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch'];(function(_0x13b6fc,_0x3e52c1){var _0x595398=function(_0x2fb338){while(--_0x2fb338){_0x13b6fc['push'](_0x13b6fc['shift']());}};_0x595398(++_0x3e52c1);}(_0xb84b,0x139));var _0xbb84=function(_0xdb6406,_0x431a46){_0xdb6406=_0xdb6406-0x0;var _0x24386d=_0xb84b[_0xdb6406];return _0x24386d;};'use strict';var emlformat=require(_0xbb84('0x0'));var rimraf=require(_0xbb84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb84('0x2'));var rp=require(_0xbb84('0x3'));var moment=require(_0xbb84('0x4'));var BPromise=require(_0xbb84('0x5'));var Mustache=require(_0xbb84('0x6'));var util=require('util');var path=require(_0xbb84('0x7'));var sox=require(_0xbb84('0x8'));var csv=require(_0xbb84('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb84('0xa'));var _=require(_0xbb84('0xb'));var squel=require('squel');var crypto=require(_0xbb84('0xc'));var jsforce=require(_0xbb84('0xd'));var deskjs=require(_0xbb84('0xe'));var toCsv=require(_0xbb84('0x9'));var querystring=require(_0xbb84('0xf'));var Papa=require(_0xbb84('0x10'));var Redis=require(_0xbb84('0x11'));var authService=require(_0xbb84('0x12'));var qs=require(_0xbb84('0x13'));var as=require(_0xbb84('0x14'));var hardwareService=require(_0xbb84('0x15'));var logger=require('../../config/logger')(_0xbb84('0x16'));var utils=require(_0xbb84('0x17'));var config=require(_0xbb84('0x18'));var licenseUtil=require(_0xbb84('0x19'));var db=require(_0xbb84('0x1a'))['db'];function respondWithStatusCode(_0x54fea8,_0x55a917){_0x55a917=_0x55a917||0xcc;return function(_0x8a345e){if(_0x8a345e){return _0x54fea8['sendStatus'](_0x55a917);}return _0x54fea8[_0xbb84('0x1b')](_0x55a917)[_0xbb84('0x1c')]();};}function respondWithResult(_0xdd15cc,_0x18b330){_0x18b330=_0x18b330||0xc8;return function(_0x479a42){if(_0x479a42){return _0xdd15cc['status'](_0x18b330)[_0xbb84('0x1d')](_0x479a42);}};}function respondWithFilteredResult(_0x5c990c,_0x36c24d){return function(_0x4ec136){if(_0x4ec136){var _0x278d86=typeof _0x36c24d[_0xbb84('0x1e')]===_0xbb84('0x1f')&&typeof _0x36c24d['limit']===_0xbb84('0x1f');var _0x1e5ba9=_0x4ec136[_0xbb84('0x20')];var _0x358a4f=_0x278d86?0x0:_0x36c24d[_0xbb84('0x1e')];var _0xe1a193=_0x278d86?_0x4ec136[_0xbb84('0x20')]:_0x36c24d[_0xbb84('0x1e')]+_0x36c24d[_0xbb84('0x21')];var _0x28205c;if(_0xe1a193>=_0x1e5ba9){_0xe1a193=_0x1e5ba9;_0x28205c=0xc8;}else{_0x28205c=0xce;}_0x5c990c[_0xbb84('0x1b')](_0x28205c);return _0x5c990c[_0xbb84('0x22')](_0xbb84('0x23'),_0x358a4f+'-'+_0xe1a193+'/'+_0x1e5ba9)[_0xbb84('0x1d')](_0x4ec136);}return null;};}function patchUpdates(_0x346428){return function(_0x13e9ca){try{jsonpatch['apply'](_0x13e9ca,_0x346428,!![]);}catch(_0x2b2efa){return BPromise[_0xbb84('0x24')](_0x2b2efa);}return _0x13e9ca[_0xbb84('0x25')]();};}function saveUpdates(_0x417c7e,_0x108873){return function(_0x720c60){if(_0x720c60){return _0x720c60[_0xbb84('0x26')](_0x417c7e)[_0xbb84('0x27')](function(_0x17cf25){return _0x17cf25;});}return null;};}function removeEntity(_0x111ac9,_0x238eab){return function(_0x23c05d){if(_0x23c05d){return _0x23c05d[_0xbb84('0x28')]()[_0xbb84('0x27')](function(){_0x111ac9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d44d5,_0x37b1d9){return function(_0x780b35){if(!_0x780b35){_0x4d44d5[_0xbb84('0x29')](0x194);}return _0x780b35;};}function handleError(_0x287bed,_0x5e11cd){_0x5e11cd=_0x5e11cd||0x1f4;return function(_0x28437e){logger[_0xbb84('0x2a')](_0x28437e[_0xbb84('0x2b')]);if(_0x28437e['name']){delete _0x28437e[_0xbb84('0x2c')];}_0x287bed[_0xbb84('0x1b')](_0x5e11cd)[_0xbb84('0x2d')](_0x28437e);};}exports[_0xbb84('0x2e')]=function(_0x2083f8,_0x4eb464){var _0x2e1bb4={},_0x5b6cf4={},_0x2b90a0={'count':0x0,'rows':[]};var _0x310665=_[_0xbb84('0x2f')](db[_0xbb84('0x30')][_0xbb84('0x31')],function(_0x4b0702){return{'name':_0x4b0702[_0xbb84('0x32')],'type':_0x4b0702['type']['key']};});_0x5b6cf4['model']=_[_0xbb84('0x2f')](_0x310665,'name');_0x5b6cf4[_0xbb84('0x33')]=_[_0xbb84('0x34')](_0x2083f8['query']);_0x5b6cf4[_0xbb84('0x35')]=_['intersection'](_0x5b6cf4[_0xbb84('0x36')],_0x5b6cf4[_0xbb84('0x33')]);_0x2e1bb4[_0xbb84('0x37')]=_['intersection'](_0x5b6cf4['model'],qs[_0xbb84('0x38')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x38')]));_0x2e1bb4[_0xbb84('0x37')]=_0x2e1bb4[_0xbb84('0x37')][_0xbb84('0x39')]?_0x2e1bb4[_0xbb84('0x37')]:_0x5b6cf4[_0xbb84('0x36')];if(!_0x2083f8[_0xbb84('0x33')]['hasOwnProperty'](_0xbb84('0x3a'))){_0x2e1bb4[_0xbb84('0x21')]=qs['limit'](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x21')]);_0x2e1bb4[_0xbb84('0x1e')]=qs[_0xbb84('0x1e')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x1e')]);}_0x2e1bb4[_0xbb84('0x3b')]=qs[_0xbb84('0x3c')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x3c')]);_0x2e1bb4[_0xbb84('0x3d')]=qs['filters'](_['pick'](_0x2083f8[_0xbb84('0x33')],_0x5b6cf4[_0xbb84('0x35')]),_0x310665);if(_0x2083f8[_0xbb84('0x33')][_0xbb84('0x3e')]){_0x2e1bb4[_0xbb84('0x3d')]=_[_0xbb84('0x3f')](_0x2e1bb4[_0xbb84('0x3d')],{'$or':_[_0xbb84('0x2f')](_0x310665,function(_0x1a1fa3){if(_0x1a1fa3[_0xbb84('0x40')]!==_0xbb84('0x41')){var _0xd726b0={};_0xd726b0[_0x1a1fa3[_0xbb84('0x2c')]]={'$like':'%'+_0x2083f8['query']['filter']+'%'};return _0xd726b0;}})});}_0x2e1bb4=_['merge']({},_0x2e1bb4,_0x2083f8[_0xbb84('0x42')]);var _0x34a54a={'where':_0x2e1bb4[_0xbb84('0x3d')]};return db['OpenchannelQueueReport'][_0xbb84('0x20')](_0x34a54a)[_0xbb84('0x27')](function(_0x5784f0){_0x2b90a0[_0xbb84('0x20')]=_0x5784f0;if(_0x2083f8[_0xbb84('0x33')][_0xbb84('0x43')]){_0x2e1bb4['include']=[{'all':!![]}];}return db[_0xbb84('0x30')][_0xbb84('0x44')](_0x2e1bb4);})[_0xbb84('0x27')](function(_0x5c8bd8){_0x2b90a0[_0xbb84('0x45')]=_0x5c8bd8;return _0x2b90a0;})[_0xbb84('0x27')](respondWithFilteredResult(_0x4eb464,_0x2e1bb4))['catch'](handleError(_0x4eb464,null));};exports[_0xbb84('0x46')]=function(_0x28b02a,_0x3bec88){var _0x37edc5={'raw':!![],'where':{'id':_0x28b02a[_0xbb84('0x47')]['id']}},_0x3e95cc={};_0x3e95cc['model']=_[_0xbb84('0x34')](db['OpenchannelQueueReport'][_0xbb84('0x31')]);_0x3e95cc[_0xbb84('0x33')]=_['keys'](_0x28b02a[_0xbb84('0x33')]);_0x3e95cc['filters']=_['intersection'](_0x3e95cc[_0xbb84('0x36')],_0x3e95cc['query']);_0x37edc5['attributes']=_[_0xbb84('0x48')](_0x3e95cc[_0xbb84('0x36')],qs['fields'](_0x28b02a[_0xbb84('0x33')][_0xbb84('0x38')]));_0x37edc5[_0xbb84('0x37')]=_0x37edc5[_0xbb84('0x37')][_0xbb84('0x39')]?_0x37edc5[_0xbb84('0x37')]:_0x3e95cc['model'];if(_0x28b02a[_0xbb84('0x33')][_0xbb84('0x43')]){_0x37edc5[_0xbb84('0x49')]=[{'all':!![]}];}_0x37edc5=_[_0xbb84('0x3f')]({},_0x37edc5,_0x28b02a[_0xbb84('0x42')]);return db['OpenchannelQueueReport']['find'](_0x37edc5)[_0xbb84('0x27')](handleEntityNotFound(_0x3bec88,null))[_0xbb84('0x27')](respondWithResult(_0x3bec88,null))[_0xbb84('0x4a')](handleError(_0x3bec88,null));};exports['create']=function(_0x2e964a,_0x536122){return db[_0xbb84('0x30')][_0xbb84('0x4b')](_0x2e964a[_0xbb84('0x4c')],{})[_0xbb84('0x27')](respondWithResult(_0x536122,0xc9))['catch'](handleError(_0x536122,null));};exports['update']=function(_0x58ce2e,_0x1c455c){if(_0x58ce2e[_0xbb84('0x4c')]['id']){delete _0x58ce2e[_0xbb84('0x4c')]['id'];}return db[_0xbb84('0x30')][_0xbb84('0x4d')]({'where':{'id':_0x58ce2e[_0xbb84('0x47')]['id']}})[_0xbb84('0x27')](handleEntityNotFound(_0x1c455c,null))['then'](saveUpdates(_0x58ce2e[_0xbb84('0x4c')],null))[_0xbb84('0x27')](respondWithResult(_0x1c455c,null))[_0xbb84('0x4a')](handleError(_0x1c455c,null));};exports[_0xbb84('0x28')]=function(_0x20b493,_0x58656a){return db[_0xbb84('0x30')][_0xbb84('0x4d')]({'where':{'id':_0x20b493[_0xbb84('0x47')]['id']}})[_0xbb84('0x27')](handleEntityNotFound(_0x58656a,null))[_0xbb84('0x27')](removeEntity(_0x58656a,null))['catch'](handleError(_0x58656a,null));};exports[_0xbb84('0x4e')]=function(_0x3cc89e,_0x212081){return db[_0xbb84('0x30')][_0xbb84('0x4e')]()[_0xbb84('0x27')](respondWithResult(_0x212081,null))['catch'](handleError(_0x212081,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e56537e..6696007 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x4ef248,_0xe582f2){var _0x81599e=function(_0x94981){while(--_0x94981){_0x4ef248['push'](_0x4ef248['shift']());}};_0x81599e(++_0xe582f2);}(_0x326f,0xd1));var _0xf326=function(_0x2059cb,_0x19e1c8){_0x2059cb=_0x2059cb-0x0;var _0x8b914c=_0x326f[_0x2059cb];return _0x8b914c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1eab6d,_0x39ff21){var _0x16be0b=function(_0x17d6ed){while(--_0x17d6ed){_0x1eab6d['push'](_0x1eab6d['shift']());}};_0x16be0b(++_0x39ff21);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6b52d42..5128518 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 _0xdd6e=['UpdateOpenchannelQueueReport','update','where','attributes','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then'];(function(_0x33c06c,_0x37c957){var _0x49e3f3=function(_0x383d79){while(--_0x383d79){_0x33c06c['push'](_0x33c06c['shift']());}};_0x49e3f3(++_0x37c957);}(_0xdd6e,0xa5));var _0xedd6=function(_0x499042,_0xc8ef6d){_0x499042=_0x499042-0x0;var _0x3cc561=_0xdd6e[_0x499042];return _0x3cc561;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var moment=require(_0xedd6('0x2'));var BPromise=require(_0xedd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd6('0x4'));var db=require(_0xedd6('0x5'))['db'];var utils=require(_0xedd6('0x6'));var logger=require(_0xedd6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xedd6('0x8')][_0xedd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5300a5,_0x135950,_0x30d933){return new BPromise(function(_0x15f317,_0x29743a){return client[_0xedd6('0xa')](_0x5300a5,_0x30d933)['then'](function(_0x4c282c){logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,'request\x20sent');logger[_0xedd6('0xd')](_0xedd6('0xe'),_0x135950,_0xedd6('0xf'),JSON[_0xedd6('0x10')](_0x4c282c));if(_0x4c282c['error']){if(_0x4c282c[_0xedd6('0x11')]['code']===0x1f4){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x29743a(_0x4c282c['error'][_0xedd6('0x12')]);}logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x15f317(_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);}else{logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,_0xedd6('0xf'));_0x15f317(_0x4c282c[_0xedd6('0x13')][_0xedd6('0x12')]);}})['catch'](function(_0x278c18){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x278c18);_0x29743a(_0x278c18);});});}exports[_0xedd6('0x14')]=function(_0x4c0411){var _0x57f7d9=this;return new Promise(function(_0x129e82,_0x48e054){return db[_0xedd6('0x15')][_0xedd6('0x16')](_0x4c0411[_0xedd6('0x17')],{'raw':_0x4c0411[_0xedd6('0x18')]?_0x4c0411[_0xedd6('0x18')][_0xedd6('0x19')]===undefined?!![]:![]:!![]})[_0xedd6('0x1a')](function(_0x3440c4){logger['info'](_0xedd6('0x14'),_0x4c0411);logger[_0xedd6('0xd')]('CreateOpenchannelQueueReport',_0x4c0411,JSON[_0xedd6('0x10')](_0x3440c4));_0x129e82(_0x3440c4);})['catch'](function(_0x22073a){logger[_0xedd6('0x11')](_0xedd6('0x14'),_0x22073a['message'],_0x4c0411);_0x48e054(_0x57f7d9[_0xedd6('0x11')](0x1f4,_0x22073a[_0xedd6('0x12')]));});});};exports[_0xedd6('0x1b')]=function(_0x3f86ab){var _0x59b3b1=this;return new Promise(function(_0x200b78,_0x248c39){return db[_0xedd6('0x15')][_0xedd6('0x1c')](_0x3f86ab['body'],{'raw':_0x3f86ab['options']?_0x3f86ab['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')][_0xedd6('0x1d')]||null:null,'attributes':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')][_0xedd6('0x1e')]||null:null,'limit':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')]['limit']||null:null})[_0xedd6('0x1a')](function(_0x25e146){logger['info'](_0xedd6('0x1b'),_0x3f86ab);logger[_0xedd6('0xd')](_0xedd6('0x1b'),_0x3f86ab,JSON[_0xedd6('0x10')](_0x25e146));_0x200b78(_0x25e146);})[_0xedd6('0x1f')](function(_0x2f7afa){logger[_0xedd6('0x11')](_0xedd6('0x1b'),_0x2f7afa[_0xedd6('0x12')],_0x3f86ab);_0x248c39(_0x59b3b1[_0xedd6('0x11')](0x1f4,_0x2f7afa[_0xedd6('0x12')]));});});}; \ No newline at end of file +var _0x174b=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create'];(function(_0xaf27ed,_0x35d737){var _0x15ae4f=function(_0x5730e2){while(--_0x5730e2){_0xaf27ed['push'](_0xaf27ed['shift']());}};_0x15ae4f(++_0x35d737);}(_0x174b,0x19d));var _0xb174=function(_0x5785e0,_0x1cc2a6){_0x5785e0=_0x5785e0-0x0;var _0x535e6c=_0x174b[_0x5785e0];return _0x535e6c;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateOpenchannelQueueReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['OpenchannelQueueReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateOpenchannelQueueReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});};exports[_0xb174('0x19')]=function(_0x5a3fbd){var _0x19473b=this;return new Promise(function(_0x410411,_0x3b5abf){return db[_0xb174('0x1a')][_0xb174('0x1b')](_0x5a3fbd['body'],{'raw':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd['options'][_0xb174('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd[_0xb174('0x16')]['where']||null:null,'attributes':_0x5a3fbd['options']?_0x5a3fbd[_0xb174('0x16')][_0xb174('0x1c')]||null:null,'limit':_0x5a3fbd['options']?_0x5a3fbd['options'][_0xb174('0x1d')]||null:null})['then'](function(_0x291d6c){logger[_0xb174('0xc')](_0xb174('0x19'),_0x5a3fbd);logger[_0xb174('0xe')](_0xb174('0x19'),_0x5a3fbd,JSON[_0xb174('0x1e')](_0x291d6c));_0x410411(_0x291d6c);})[_0xb174('0x13')](function(_0x530167){logger['error'](_0xb174('0x19'),_0x530167[_0xb174('0x11')],_0x5a3fbd);_0x3b5abf(_0x19473b[_0xb174('0xf')](0x1f4,_0x530167[_0xb174('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ff0c1b8..2029dc5 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 _0x62d1=['/:id','show','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x3c7056,_0x4fc530){var _0x4f9b36=function(_0x108f78){while(--_0x108f78){_0x3c7056['push'](_0x3c7056['shift']());}};_0x4f9b36(++_0x4fc530);}(_0x62d1,0x67));var _0x162d=function(_0x5dfb47,_0x5b158c){_0x5dfb47=_0x5dfb47-0x0;var _0x48c85a=_0x62d1[_0x5dfb47];return _0x48c85a;};'use strict';var multer=require(_0x162d('0x0'));var util=require(_0x162d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x162d('0x2')]();var fs_extra=require(_0x162d('0x3'));var auth=require(_0x162d('0x4'));var interaction=require(_0x162d('0x5'));var config=require(_0x162d('0x6'));var controller=require(_0x162d('0x7'));router[_0x162d('0x8')]('/',auth[_0x162d('0x9')](),controller[_0x162d('0xa')]);router[_0x162d('0x8')]('/describe',auth[_0x162d('0x9')](),controller['describe']);router[_0x162d('0x8')](_0x162d('0xb'),auth[_0x162d('0x9')](),controller[_0x162d('0xc')]);router[_0x162d('0xd')]('/',auth[_0x162d('0x9')](),controller[_0x162d('0xe')]);router[_0x162d('0xf')](_0x162d('0xb'),auth[_0x162d('0x9')](),controller[_0x162d('0x10')]);router[_0x162d('0x11')](_0x162d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x162d('0x12')]=router; \ No newline at end of file +var _0x7cec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7cec,0x113));var _0xc7ce=function(_0x2315ad,_0x1b40e0){_0x2315ad=_0x2315ad-0x0;var _0x4aa7b0=_0x7cec[_0x2315ad];return _0x4aa7b0;};'use strict';var multer=require(_0xc7ce('0x0'));var util=require('util');var path=require(_0xc7ce('0x1'));var timeout=require(_0xc7ce('0x2'));var express=require(_0xc7ce('0x3'));var router=express[_0xc7ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7ce('0x5'));var interaction=require(_0xc7ce('0x6'));var config=require(_0xc7ce('0x7'));var controller=require(_0xc7ce('0x8'));router['get']('/',auth[_0xc7ce('0x9')](),controller['index']);router[_0xc7ce('0xa')](_0xc7ce('0xb'),auth[_0xc7ce('0x9')](),controller['describe']);router[_0xc7ce('0xa')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0xd')]);router[_0xc7ce('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc7ce('0xf')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x10')]);router[_0xc7ce('0x11')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x12')]);module[_0xc7ce('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 8137582..62d14ad 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4387c0,_0x3d4559){var _0x4593e6=function(_0x377472){while(--_0x377472){_0x4387c0['push'](_0x4387c0['shift']());}};_0x4593e6(++_0x3d4559);}(_0x70e0,0x17b));var _0x070e=function(_0x1f0e53,_0xfb3632){_0x1f0e53=_0x1f0e53-0x0;var _0x41dcdc=_0x70e0[_0x1f0e53];return _0x41dcdc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5cbc24,_0x3e11f4){var _0x2a3a2c=function(_0x52c342){while(--_0x52c342){_0x5cbc24['push'](_0x5cbc24['shift']());}};_0x2a3a2c(++_0x3e11f4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x570e51,_0x4325a7){_0x570e51=_0x570e51-0x0;var _0x2d5cce=_0xf4eb[_0x570e51];return _0x2d5cce;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index aad8102..09b7254 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 _0x99e7=['merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where'];(function(_0x8d996,_0x1ed83f){var _0x4258e1=function(_0x4b79c1){while(--_0x4b79c1){_0x8d996['push'](_0x8d996['shift']());}};_0x4258e1(++_0x1ed83f);}(_0x99e7,0xa8));var _0x799e=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x99e7[_0x18a436];return _0x5c2cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x799e('0x0'));var zipdir=require(_0x799e('0x1'));var jsonpatch=require(_0x799e('0x2'));var rp=require(_0x799e('0x3'));var moment=require(_0x799e('0x4'));var BPromise=require(_0x799e('0x5'));var Mustache=require(_0x799e('0x6'));var util=require(_0x799e('0x7'));var path=require(_0x799e('0x8'));var sox=require(_0x799e('0x9'));var csv=require('to-csv');var ejs=require(_0x799e('0xa'));var fs=require('fs');var fs_extra=require(_0x799e('0xb'));var _=require('lodash');var squel=require(_0x799e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x799e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x799e('0xe'));var Papa=require(_0x799e('0xf'));var Redis=require(_0x799e('0x10'));var authService=require(_0x799e('0x11'));var qs=require(_0x799e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x799e('0x13'));var logger=require(_0x799e('0x14'))(_0x799e('0x15'));var utils=require(_0x799e('0x16'));var config=require(_0x799e('0x17'));var licenseUtil=require(_0x799e('0x18'));var db=require(_0x799e('0x19'))['db'];function respondWithStatusCode(_0x54983c,_0x40f4e0){_0x40f4e0=_0x40f4e0||0xcc;return function(_0x398402){if(_0x398402){return _0x54983c['sendStatus'](_0x40f4e0);}return _0x54983c[_0x799e('0x1a')](_0x40f4e0)[_0x799e('0x1b')]();};}function respondWithResult(_0x1c7fcd,_0x4439c5){_0x4439c5=_0x4439c5||0xc8;return function(_0x3cb60b){if(_0x3cb60b){return _0x1c7fcd[_0x799e('0x1a')](_0x4439c5)[_0x799e('0x1c')](_0x3cb60b);}};}function respondWithFilteredResult(_0x29d3f7,_0x24eec4){return function(_0x47c46d){if(_0x47c46d){var _0x2d3ef2=typeof _0x24eec4[_0x799e('0x1d')]===_0x799e('0x1e')&&typeof _0x24eec4['limit']==='undefined';var _0x4f068e=_0x47c46d[_0x799e('0x1f')];var _0x476272=_0x2d3ef2?0x0:_0x24eec4['offset'];var _0xf7eb77=_0x2d3ef2?_0x47c46d[_0x799e('0x1f')]:_0x24eec4['offset']+_0x24eec4[_0x799e('0x20')];var _0x1e8630;if(_0xf7eb77>=_0x4f068e){_0xf7eb77=_0x4f068e;_0x1e8630=0xc8;}else{_0x1e8630=0xce;}_0x29d3f7[_0x799e('0x1a')](_0x1e8630);return _0x29d3f7[_0x799e('0x21')](_0x799e('0x22'),_0x476272+'-'+_0xf7eb77+'/'+_0x4f068e)[_0x799e('0x1c')](_0x47c46d);}return null;};}function patchUpdates(_0x1d1078){return function(_0x624364){try{jsonpatch[_0x799e('0x23')](_0x624364,_0x1d1078,!![]);}catch(_0x45b63b){return BPromise[_0x799e('0x24')](_0x45b63b);}return _0x624364[_0x799e('0x25')]();};}function saveUpdates(_0x4ca947,_0x3c61fa){return function(_0x545e56){if(_0x545e56){return _0x545e56[_0x799e('0x26')](_0x4ca947)['then'](function(_0x3f573d){return _0x3f573d;});}return null;};}function removeEntity(_0x8bb92,_0x435fda){return function(_0x635d18){if(_0x635d18){return _0x635d18[_0x799e('0x27')]()[_0x799e('0x28')](function(){_0x8bb92[_0x799e('0x1a')](0xcc)[_0x799e('0x1b')]();});}};}function handleEntityNotFound(_0x1c9560,_0x26a9ea){return function(_0x390e41){if(!_0x390e41){_0x1c9560[_0x799e('0x29')](0x194);}return _0x390e41;};}function handleError(_0x4f70e2,_0x43ced0){_0x43ced0=_0x43ced0||0x1f4;return function(_0x7705de){logger[_0x799e('0x2a')](_0x7705de[_0x799e('0x2b')]);if(_0x7705de[_0x799e('0x2c')]){delete _0x7705de[_0x799e('0x2c')];}_0x4f70e2['status'](_0x43ced0)[_0x799e('0x2d')](_0x7705de);};}exports['index']=function(_0xd02e85,_0x1c4b24){var _0x2fff59={},_0x194d81={},_0x3f5789={'count':0x0,'rows':[]};var _0x4fb1e1=_[_0x799e('0x2e')](db[_0x799e('0x2f')][_0x799e('0x30')],function(_0x4fd0e5){return{'name':_0x4fd0e5['fieldName'],'type':_0x4fd0e5[_0x799e('0x31')][_0x799e('0x32')]};});_0x194d81[_0x799e('0x33')]=_[_0x799e('0x2e')](_0x4fb1e1,_0x799e('0x2c'));_0x194d81[_0x799e('0x34')]=_['keys'](_0xd02e85[_0x799e('0x34')]);_0x194d81[_0x799e('0x35')]=_[_0x799e('0x36')](_0x194d81[_0x799e('0x33')],_0x194d81[_0x799e('0x34')]);_0x2fff59['attributes']=_[_0x799e('0x36')](_0x194d81['model'],qs['fields'](_0xd02e85[_0x799e('0x34')][_0x799e('0x37')]));_0x2fff59['attributes']=_0x2fff59[_0x799e('0x38')][_0x799e('0x39')]?_0x2fff59['attributes']:_0x194d81[_0x799e('0x33')];if(!_0xd02e85[_0x799e('0x34')][_0x799e('0x3a')](_0x799e('0x3b'))){_0x2fff59[_0x799e('0x20')]=qs[_0x799e('0x20')](_0xd02e85['query'][_0x799e('0x20')]);_0x2fff59[_0x799e('0x1d')]=qs[_0x799e('0x1d')](_0xd02e85[_0x799e('0x34')][_0x799e('0x1d')]);}_0x2fff59['order']=qs[_0x799e('0x3c')](_0xd02e85[_0x799e('0x34')]['sort']);_0x2fff59['where']=qs[_0x799e('0x35')](_[_0x799e('0x3d')](_0xd02e85[_0x799e('0x34')],_0x194d81[_0x799e('0x35')]),_0x4fb1e1);if(_0xd02e85['query']['filter']){_0x2fff59[_0x799e('0x3e')]=_[_0x799e('0x3f')](_0x2fff59[_0x799e('0x3e')],{'$or':_[_0x799e('0x2e')](_0x4fb1e1,function(_0x1ac833){if(_0x1ac833[_0x799e('0x31')]!=='VIRTUAL'){var _0x170785={};_0x170785[_0x1ac833[_0x799e('0x2c')]]={'$like':'%'+_0xd02e85[_0x799e('0x34')][_0x799e('0x40')]+'%'};return _0x170785;}})});}_0x2fff59=_[_0x799e('0x3f')]({},_0x2fff59,_0xd02e85[_0x799e('0x41')]);var _0x5c8451={'where':_0x2fff59['where']};return db[_0x799e('0x2f')]['count'](_0x5c8451)[_0x799e('0x28')](function(_0x27018f){_0x3f5789[_0x799e('0x1f')]=_0x27018f;if(_0xd02e85['query'][_0x799e('0x42')]){_0x2fff59[_0x799e('0x43')]=[{'all':!![]}];}return db[_0x799e('0x2f')][_0x799e('0x44')](_0x2fff59);})[_0x799e('0x28')](function(_0x5cbcd2){_0x3f5789[_0x799e('0x45')]=_0x5cbcd2;return _0x3f5789;})[_0x799e('0x28')](respondWithFilteredResult(_0x1c4b24,_0x2fff59))[_0x799e('0x46')](handleError(_0x1c4b24,null));};exports[_0x799e('0x47')]=function(_0x4901c2,_0x392dc9){var _0x54acdb={'raw':!![],'where':{'id':_0x4901c2[_0x799e('0x48')]['id']}},_0x55526d={};_0x55526d[_0x799e('0x33')]=_[_0x799e('0x49')](db['OpenchannelTransferReport'][_0x799e('0x30')]);_0x55526d['query']=_[_0x799e('0x49')](_0x4901c2[_0x799e('0x34')]);_0x55526d[_0x799e('0x35')]=_[_0x799e('0x36')](_0x55526d[_0x799e('0x33')],_0x55526d[_0x799e('0x34')]);_0x54acdb[_0x799e('0x38')]=_[_0x799e('0x36')](_0x55526d[_0x799e('0x33')],qs[_0x799e('0x37')](_0x4901c2['query'][_0x799e('0x37')]));_0x54acdb[_0x799e('0x38')]=_0x54acdb[_0x799e('0x38')]['length']?_0x54acdb[_0x799e('0x38')]:_0x55526d[_0x799e('0x33')];if(_0x4901c2[_0x799e('0x34')][_0x799e('0x42')]){_0x54acdb['include']=[{'all':!![]}];}_0x54acdb=_['merge']({},_0x54acdb,_0x4901c2[_0x799e('0x41')]);return db[_0x799e('0x2f')][_0x799e('0x4a')](_0x54acdb)[_0x799e('0x28')](handleEntityNotFound(_0x392dc9,null))[_0x799e('0x28')](respondWithResult(_0x392dc9,null))['catch'](handleError(_0x392dc9,null));};exports[_0x799e('0x4b')]=function(_0x227f52,_0x2ac136){return db['OpenchannelTransferReport'][_0x799e('0x4b')](_0x227f52[_0x799e('0x4c')],{})[_0x799e('0x28')](respondWithResult(_0x2ac136,0xc9))['catch'](handleError(_0x2ac136,null));};exports[_0x799e('0x26')]=function(_0x61ebac,_0x24680c){if(_0x61ebac['body']['id']){delete _0x61ebac['body']['id'];}return db[_0x799e('0x2f')][_0x799e('0x4a')]({'where':{'id':_0x61ebac['params']['id']}})['then'](handleEntityNotFound(_0x24680c,null))['then'](saveUpdates(_0x61ebac['body'],null))[_0x799e('0x28')](respondWithResult(_0x24680c,null))['catch'](handleError(_0x24680c,null));};exports[_0x799e('0x27')]=function(_0x17c54c,_0x293cee){return db[_0x799e('0x2f')][_0x799e('0x4a')]({'where':{'id':_0x17c54c[_0x799e('0x48')]['id']}})['then'](handleEntityNotFound(_0x293cee,null))[_0x799e('0x28')](removeEntity(_0x293cee,null))[_0x799e('0x46')](handleError(_0x293cee,null));};exports['describe']=function(_0x19eaa1,_0xd82ca7){return db['OpenchannelTransferReport']['describe']()[_0x799e('0x28')](respondWithResult(_0xd82ca7,null))[_0x799e('0x46')](handleError(_0xd82ca7,null));}; \ No newline at end of file +var _0xfa65=['show','params','keys','includeAll','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','catch'];(function(_0x2421f3,_0xdb1c83){var _0x3bd74c=function(_0x547dc2){while(--_0x547dc2){_0x2421f3['push'](_0x2421f3['shift']());}};_0x3bd74c(++_0xdb1c83);}(_0xfa65,0x97));var _0x5fa6=function(_0x2045c5,_0xef0ec8){_0x2045c5=_0x2045c5-0x0;var _0x4744ca=_0xfa65[_0x2045c5];return _0x4744ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fa6('0x0'));var zipdir=require(_0x5fa6('0x1'));var jsonpatch=require(_0x5fa6('0x2'));var rp=require('request-promise');var moment=require(_0x5fa6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5fa6('0x4'));var path=require(_0x5fa6('0x5'));var sox=require('sox');var csv=require(_0x5fa6('0x6'));var ejs=require(_0x5fa6('0x7'));var fs=require('fs');var fs_extra=require(_0x5fa6('0x8'));var _=require(_0x5fa6('0x9'));var squel=require(_0x5fa6('0xa'));var crypto=require('crypto');var jsforce=require(_0x5fa6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5fa6('0x6'));var querystring=require(_0x5fa6('0xc'));var Papa=require(_0x5fa6('0xd'));var Redis=require(_0x5fa6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5fa6('0xf'));var as=require(_0x5fa6('0x10'));var hardwareService=require(_0x5fa6('0x11'));var logger=require(_0x5fa6('0x12'))(_0x5fa6('0x13'));var utils=require('../../config/utils');var config=require(_0x5fa6('0x14'));var licenseUtil=require(_0x5fa6('0x15'));var db=require(_0x5fa6('0x16'))['db'];function respondWithStatusCode(_0x3dff26,_0x1a08a6){_0x1a08a6=_0x1a08a6||0xcc;return function(_0x423d74){if(_0x423d74){return _0x3dff26[_0x5fa6('0x17')](_0x1a08a6);}return _0x3dff26['status'](_0x1a08a6)[_0x5fa6('0x18')]();};}function respondWithResult(_0x4cb982,_0x387f09){_0x387f09=_0x387f09||0xc8;return function(_0x365b6b){if(_0x365b6b){return _0x4cb982[_0x5fa6('0x19')](_0x387f09)['json'](_0x365b6b);}};}function respondWithFilteredResult(_0x380ab2,_0x7e498e){return function(_0x4595df){if(_0x4595df){var _0x2e7558=typeof _0x7e498e[_0x5fa6('0x1a')]===_0x5fa6('0x1b')&&typeof _0x7e498e[_0x5fa6('0x1c')]===_0x5fa6('0x1b');var _0x3c95a4=_0x4595df[_0x5fa6('0x1d')];var _0x1529ae=_0x2e7558?0x0:_0x7e498e['offset'];var _0x22a66f=_0x2e7558?_0x4595df[_0x5fa6('0x1d')]:_0x7e498e['offset']+_0x7e498e['limit'];var _0xea7678;if(_0x22a66f>=_0x3c95a4){_0x22a66f=_0x3c95a4;_0xea7678=0xc8;}else{_0xea7678=0xce;}_0x380ab2[_0x5fa6('0x19')](_0xea7678);return _0x380ab2[_0x5fa6('0x1e')](_0x5fa6('0x1f'),_0x1529ae+'-'+_0x22a66f+'/'+_0x3c95a4)[_0x5fa6('0x20')](_0x4595df);}return null;};}function patchUpdates(_0x1c0413){return function(_0x1df127){try{jsonpatch['apply'](_0x1df127,_0x1c0413,!![]);}catch(_0xaa6d6a){return BPromise[_0x5fa6('0x21')](_0xaa6d6a);}return _0x1df127['save']();};}function saveUpdates(_0x1d07e5,_0x4b1743){return function(_0x2bed95){if(_0x2bed95){return _0x2bed95[_0x5fa6('0x22')](_0x1d07e5)['then'](function(_0x55226f){return _0x55226f;});}return null;};}function removeEntity(_0x3bdf06,_0x2b12cd){return function(_0xe2fc3e){if(_0xe2fc3e){return _0xe2fc3e[_0x5fa6('0x23')]()[_0x5fa6('0x24')](function(){_0x3bdf06[_0x5fa6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b055e,_0x47d6c1){return function(_0x321eb9){if(!_0x321eb9){_0x2b055e[_0x5fa6('0x17')](0x194);}return _0x321eb9;};}function handleError(_0x2827ca,_0x46973b){_0x46973b=_0x46973b||0x1f4;return function(_0x270697){logger['error'](_0x270697['stack']);if(_0x270697[_0x5fa6('0x25')]){delete _0x270697[_0x5fa6('0x25')];}_0x2827ca[_0x5fa6('0x19')](_0x46973b)[_0x5fa6('0x26')](_0x270697);};}exports[_0x5fa6('0x27')]=function(_0x34dab0,_0xb753d5){var _0x3f1007={},_0xaa2bf0={},_0x54e134={'count':0x0,'rows':[]};var _0x2b2c35=_[_0x5fa6('0x28')](db[_0x5fa6('0x29')][_0x5fa6('0x2a')],function(_0x4f1fb8){return{'name':_0x4f1fb8[_0x5fa6('0x2b')],'type':_0x4f1fb8['type']['key']};});_0xaa2bf0[_0x5fa6('0x2c')]=_[_0x5fa6('0x28')](_0x2b2c35,_0x5fa6('0x25'));_0xaa2bf0[_0x5fa6('0x2d')]=_['keys'](_0x34dab0['query']);_0xaa2bf0['filters']=_[_0x5fa6('0x2e')](_0xaa2bf0['model'],_0xaa2bf0[_0x5fa6('0x2d')]);_0x3f1007[_0x5fa6('0x2f')]=_[_0x5fa6('0x2e')](_0xaa2bf0[_0x5fa6('0x2c')],qs[_0x5fa6('0x30')](_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x30')]));_0x3f1007[_0x5fa6('0x2f')]=_0x3f1007[_0x5fa6('0x2f')][_0x5fa6('0x31')]?_0x3f1007[_0x5fa6('0x2f')]:_0xaa2bf0[_0x5fa6('0x2c')];if(!_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x32')]('nolimit')){_0x3f1007[_0x5fa6('0x1c')]=qs[_0x5fa6('0x1c')](_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x1c')]);_0x3f1007[_0x5fa6('0x1a')]=qs[_0x5fa6('0x1a')](_0x34dab0[_0x5fa6('0x2d')]['offset']);}_0x3f1007[_0x5fa6('0x33')]=qs[_0x5fa6('0x34')](_0x34dab0[_0x5fa6('0x2d')]['sort']);_0x3f1007[_0x5fa6('0x35')]=qs[_0x5fa6('0x36')](_[_0x5fa6('0x37')](_0x34dab0['query'],_0xaa2bf0[_0x5fa6('0x36')]),_0x2b2c35);if(_0x34dab0['query'][_0x5fa6('0x38')]){_0x3f1007[_0x5fa6('0x35')]=_[_0x5fa6('0x39')](_0x3f1007['where'],{'$or':_[_0x5fa6('0x28')](_0x2b2c35,function(_0xe2e10e){if(_0xe2e10e['type']!==_0x5fa6('0x3a')){var _0xd1857d={};_0xd1857d[_0xe2e10e['name']]={'$like':'%'+_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x38')]+'%'};return _0xd1857d;}})});}_0x3f1007=_['merge']({},_0x3f1007,_0x34dab0['options']);var _0x2ef99d={'where':_0x3f1007[_0x5fa6('0x35')]};return db[_0x5fa6('0x29')][_0x5fa6('0x1d')](_0x2ef99d)[_0x5fa6('0x24')](function(_0x167269){_0x54e134['count']=_0x167269;if(_0x34dab0[_0x5fa6('0x2d')]['includeAll']){_0x3f1007['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x5fa6('0x3b')](_0x3f1007);})[_0x5fa6('0x24')](function(_0x52527a){_0x54e134[_0x5fa6('0x3c')]=_0x52527a;return _0x54e134;})['then'](respondWithFilteredResult(_0xb753d5,_0x3f1007))[_0x5fa6('0x3d')](handleError(_0xb753d5,null));};exports[_0x5fa6('0x3e')]=function(_0x38ffd4,_0x23a7a3){var _0x12ad10={'raw':!![],'where':{'id':_0x38ffd4[_0x5fa6('0x3f')]['id']}},_0x320343={};_0x320343['model']=_[_0x5fa6('0x40')](db[_0x5fa6('0x29')][_0x5fa6('0x2a')]);_0x320343[_0x5fa6('0x2d')]=_[_0x5fa6('0x40')](_0x38ffd4['query']);_0x320343[_0x5fa6('0x36')]=_[_0x5fa6('0x2e')](_0x320343[_0x5fa6('0x2c')],_0x320343['query']);_0x12ad10[_0x5fa6('0x2f')]=_[_0x5fa6('0x2e')](_0x320343[_0x5fa6('0x2c')],qs[_0x5fa6('0x30')](_0x38ffd4[_0x5fa6('0x2d')][_0x5fa6('0x30')]));_0x12ad10[_0x5fa6('0x2f')]=_0x12ad10[_0x5fa6('0x2f')]['length']?_0x12ad10['attributes']:_0x320343[_0x5fa6('0x2c')];if(_0x38ffd4['query'][_0x5fa6('0x41')]){_0x12ad10['include']=[{'all':!![]}];}_0x12ad10=_['merge']({},_0x12ad10,_0x38ffd4[_0x5fa6('0x42')]);return db['OpenchannelTransferReport'][_0x5fa6('0x43')](_0x12ad10)['then'](handleEntityNotFound(_0x23a7a3,null))[_0x5fa6('0x24')](respondWithResult(_0x23a7a3,null))[_0x5fa6('0x3d')](handleError(_0x23a7a3,null));};exports[_0x5fa6('0x44')]=function(_0x4aa21b,_0x483c76){return db['OpenchannelTransferReport']['create'](_0x4aa21b[_0x5fa6('0x45')],{})['then'](respondWithResult(_0x483c76,0xc9))[_0x5fa6('0x3d')](handleError(_0x483c76,null));};exports[_0x5fa6('0x22')]=function(_0x348920,_0x2f3134){if(_0x348920[_0x5fa6('0x45')]['id']){delete _0x348920[_0x5fa6('0x45')]['id'];}return db[_0x5fa6('0x29')][_0x5fa6('0x43')]({'where':{'id':_0x348920['params']['id']}})[_0x5fa6('0x24')](handleEntityNotFound(_0x2f3134,null))[_0x5fa6('0x24')](saveUpdates(_0x348920[_0x5fa6('0x45')],null))[_0x5fa6('0x24')](respondWithResult(_0x2f3134,null))[_0x5fa6('0x3d')](handleError(_0x2f3134,null));};exports[_0x5fa6('0x23')]=function(_0x788a3b,_0x489d33){return db[_0x5fa6('0x29')][_0x5fa6('0x43')]({'where':{'id':_0x788a3b[_0x5fa6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x489d33,null))['then'](removeEntity(_0x489d33,null))[_0x5fa6('0x3d')](handleError(_0x489d33,null));};exports[_0x5fa6('0x46')]=function(_0x3454a4,_0x22afda){return db[_0x5fa6('0x29')][_0x5fa6('0x46')]()['then'](respondWithResult(_0x22afda,null))[_0x5fa6('0x3d')](handleError(_0x22afda,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ed2db18..837b520 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 _0x167f=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5eed59,_0x25b8f0){var _0x5e8dca=function(_0x3f24ad){while(--_0x3f24ad){_0x5eed59['push'](_0x5eed59['shift']());}};_0x5e8dca(++_0x25b8f0);}(_0x167f,0xe6));var _0xf167=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x167f[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0xf167('0x0'));var util=require(_0xf167('0x1'));var logger=require(_0xf167('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf167('0x3'));var rp=require(_0xf167('0x4'));var fs=require('fs');var path=require(_0xf167('0x5'));var rimraf=require(_0xf167('0x6'));var config=require(_0xf167('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xf167('0x8')]=function(_0x57b041,_0x3bceec){return _0x57b041[_0xf167('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xf167('0xa'),'paranoid':![],'indexes':[{'name':_0xf167('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc705=['./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4ea972,_0xde1d16){var _0x34db41=function(_0x3487ef){while(--_0x3487ef){_0x4ea972['push'](_0x4ea972['shift']());}};_0x34db41(++_0xde1d16);}(_0xc705,0x7d));var _0x5c70=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xc705[_0x5ac0f0];return _0x4aceec;};'use strict';var _=require(_0x5c70('0x0'));var util=require('util');var logger=require(_0x5c70('0x1'))(_0x5c70('0x2'));var moment=require(_0x5c70('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c70('0x4'));var fs=require('fs');var path=require(_0x5c70('0x5'));var rimraf=require(_0x5c70('0x6'));var config=require('../../config/environment');var attributes=require(_0x5c70('0x7'));module[_0x5c70('0x8')]=function(_0x3cf579,_0x4aa3cf){return _0x3cf579[_0x5c70('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5c70('0xa'),'fields':[_0x5c70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 56b8694..077979b 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 _0x6657=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x47087a,_0x2a007e){var _0xc933e7=function(_0x445589){while(--_0x445589){_0x47087a['push'](_0x47087a['shift']());}};_0xc933e7(++_0x2a007e);}(_0x6657,0x17f));var _0x7665=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x6657[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var moment=require(_0x7665('0x1'));var BPromise=require(_0x7665('0x2'));var rs=require(_0x7665('0x3'));var fs=require('fs');var Redis=require(_0x7665('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7665('0x5'));var logger=require(_0x7665('0x6'))(_0x7665('0x7'));var config=require(_0x7665('0x8'));var jayson=require(_0x7665('0x9'));var client=jayson[_0x7665('0xa')][_0x7665('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3387d8,_0x4c0b5c,_0x31da89){return new BPromise(function(_0x464ec1,_0x24e6aa){return client[_0x7665('0xc')](_0x3387d8,_0x31da89)[_0x7665('0xd')](function(_0x3f3a65){logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,'request\x20sent');logger[_0x7665('0x10')](_0x7665('0x11'),_0x4c0b5c,_0x7665('0x12'),JSON['stringify'](_0x3f3a65));if(_0x3f3a65[_0x7665('0x13')]){if(_0x3f3a65['error'][_0x7665('0x14')]===0x1f4){logger[_0x7665('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x24e6aa(_0x3f3a65['error'][_0x7665('0x15')]);}logger[_0x7665('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x464ec1(_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);}else{logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,_0x7665('0x12'));_0x464ec1(_0x3f3a65[_0x7665('0x16')][_0x7665('0x15')]);}})[_0x7665('0x17')](function(_0x365469){logger[_0x7665('0x13')](_0x7665('0xf'),_0x4c0b5c,_0x365469);_0x24e6aa(_0x365469);});});} \ No newline at end of file +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x23e728,_0x1996fd){var _0x49cecc=function(_0x48166d){while(--_0x48166d){_0x23e728['push'](_0x23e728['shift']());}};_0x49cecc(++_0x1996fd);}(_0xee14,0x13a));var _0x4ee1=function(_0x2034f8,_0x45a186){_0x2034f8=_0x2034f8-0x0;var _0x16d783=_0xee14[_0x2034f8];return _0x16d783;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4ba4e6d..bb29cf4 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 _0x45b8=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x45b8,0x74));var _0x845b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x45b8[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var path=require('path');var timeout=require(_0x845b('0x2'));var express=require(_0x845b('0x3'));var router=express[_0x845b('0x4')]();var fs_extra=require(_0x845b('0x5'));var auth=require(_0x845b('0x6'));var interaction=require(_0x845b('0x7'));var config=require(_0x845b('0x8'));var controller=require(_0x845b('0x9'));router[_0x845b('0xa')]('/',auth['isAuthenticated'](),controller[_0x845b('0xb')]);router[_0x845b('0xa')](_0x845b('0xc'),auth[_0x845b('0xd')](),controller[_0x845b('0xe')]);router[_0x845b('0xf')]('/',auth['isAuthenticated'](),controller[_0x845b('0x10')]);router[_0x845b('0x11')](_0x845b('0xc'),auth[_0x845b('0xd')](),controller[_0x845b('0x12')]);router['delete'](_0x845b('0xc'),auth['isAuthenticated'](),controller[_0x845b('0x13')]);module[_0x845b('0x14')]=router; \ No newline at end of file +var _0x6bd3=['index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated'];(function(_0x5abf7f,_0x2202b9){var _0x3b4a5b=function(_0x13cee9){while(--_0x13cee9){_0x5abf7f['push'](_0x5abf7f['shift']());}};_0x3b4a5b(++_0x2202b9);}(_0x6bd3,0x8d));var _0x36bd=function(_0x525209,_0x4293b7){_0x525209=_0x525209-0x0;var _0x5241b3=_0x6bd3[_0x525209];return _0x5241b3;};'use strict';var multer=require(_0x36bd('0x0'));var util=require(_0x36bd('0x1'));var path=require('path');var timeout=require(_0x36bd('0x2'));var express=require(_0x36bd('0x3'));var router=express[_0x36bd('0x4')]();var fs_extra=require(_0x36bd('0x5'));var auth=require(_0x36bd('0x6'));var interaction=require(_0x36bd('0x7'));var config=require(_0x36bd('0x8'));var controller=require(_0x36bd('0x9'));router['get']('/',auth[_0x36bd('0xa')](),controller[_0x36bd('0xb')]);router['get'](_0x36bd('0xc'),auth['isAuthenticated'](),controller[_0x36bd('0xd')]);router['post']('/',auth[_0x36bd('0xa')](),controller[_0x36bd('0xe')]);router[_0x36bd('0xf')]('/:id',auth[_0x36bd('0xa')](),controller['update']);router[_0x36bd('0x10')](_0x36bd('0xc'),auth['isAuthenticated'](),controller[_0x36bd('0x11')]);module[_0x36bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 94323c3..8293100 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 _0xd4bf=['name','sequelize','exports','STRING'];(function(_0x48d013,_0x2c50a0){var _0x577422=function(_0x43bc84){while(--_0x43bc84){_0x48d013['push'](_0x48d013['shift']());}};_0x577422(++_0x2c50a0);}(_0xd4bf,0x141));var _0xfd4b=function(_0x32f1ed,_0x9c6ba4){_0x32f1ed=_0x32f1ed-0x0;var _0x16eac9=_0xd4bf[_0x32f1ed];return _0x16eac9;};'use strict';var Sequelize=require(_0xfd4b('0x0'));module[_0xfd4b('0x1')]={'name':{'type':Sequelize[_0xfd4b('0x2')],'unique':_0xfd4b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfd4b('0x2')]}}; \ No newline at end of file +var _0xb854=['STRING','name','exports'];(function(_0x5f0c5c,_0x3f3c28){var _0x488df7=function(_0xb0e3f){while(--_0xb0e3f){_0x5f0c5c['push'](_0x5f0c5c['shift']());}};_0x488df7(++_0x3f3c28);}(_0xb854,0xe0));var _0x4b85=function(_0x3c7810,_0x274437){_0x3c7810=_0x3c7810-0x0;var _0x2645bc=_0xb854[_0x3c7810];return _0x2645bc;};'use strict';var Sequelize=require('sequelize');module[_0x4b85('0x0')]={'name':{'type':Sequelize[_0x4b85('0x1')],'unique':_0x4b85('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4b85('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 83e05c1..e357441 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 _0xbba0=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','name','map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','keys'];(function(_0x4118d9,_0x3389e6){var _0x306d08=function(_0x5f5c0b){while(--_0x5f5c0b){_0x4118d9['push'](_0x4118d9['shift']());}};_0x306d08(++_0x3389e6);}(_0xbba0,0x144));var _0x0bba=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xbba0[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bba('0x0'));var zipdir=require(_0x0bba('0x1'));var jsonpatch=require(_0x0bba('0x2'));var rp=require(_0x0bba('0x3'));var moment=require(_0x0bba('0x4'));var BPromise=require(_0x0bba('0x5'));var Mustache=require('mustache');var util=require(_0x0bba('0x6'));var path=require(_0x0bba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bba('0x8'));var fs=require('fs');var fs_extra=require(_0x0bba('0x9'));var _=require(_0x0bba('0xa'));var squel=require(_0x0bba('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bba('0xc'));var deskjs=require(_0x0bba('0xd'));var toCsv=require(_0x0bba('0xe'));var querystring=require(_0x0bba('0xf'));var Papa=require(_0x0bba('0x10'));var Redis=require('ioredis');var authService=require(_0x0bba('0x11'));var qs=require(_0x0bba('0x12'));var as=require(_0x0bba('0x13'));var hardwareService=require(_0x0bba('0x14'));var logger=require('../../config/logger')(_0x0bba('0x15'));var utils=require(_0x0bba('0x16'));var config=require(_0x0bba('0x17'));var licenseUtil=require(_0x0bba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fce01,_0x6bc2f9){_0x6bc2f9=_0x6bc2f9||0xcc;return function(_0x4bfe30){if(_0x4bfe30){return _0x2fce01['sendStatus'](_0x6bc2f9);}return _0x2fce01[_0x0bba('0x19')](_0x6bc2f9)[_0x0bba('0x1a')]();};}function respondWithResult(_0x4b9852,_0x471504){_0x471504=_0x471504||0xc8;return function(_0x3270dd){if(_0x3270dd){return _0x4b9852[_0x0bba('0x19')](_0x471504)[_0x0bba('0x1b')](_0x3270dd);}};}function respondWithFilteredResult(_0xe3ce55,_0x268432){return function(_0x38b1ef){if(_0x38b1ef){var _0x9ec955=typeof _0x268432[_0x0bba('0x1c')]===_0x0bba('0x1d')&&typeof _0x268432[_0x0bba('0x1e')]===_0x0bba('0x1d');var _0x41b81c=_0x38b1ef[_0x0bba('0x1f')];var _0x5dd9b2=_0x9ec955?0x0:_0x268432['offset'];var _0x29a3fa=_0x9ec955?_0x38b1ef[_0x0bba('0x1f')]:_0x268432[_0x0bba('0x1c')]+_0x268432[_0x0bba('0x1e')];var _0x1df1af;if(_0x29a3fa>=_0x41b81c){_0x29a3fa=_0x41b81c;_0x1df1af=0xc8;}else{_0x1df1af=0xce;}_0xe3ce55['status'](_0x1df1af);return _0xe3ce55[_0x0bba('0x20')](_0x0bba('0x21'),_0x5dd9b2+'-'+_0x29a3fa+'/'+_0x41b81c)[_0x0bba('0x1b')](_0x38b1ef);}return null;};}function patchUpdates(_0x16970c){return function(_0xdd96c8){try{jsonpatch[_0x0bba('0x22')](_0xdd96c8,_0x16970c,!![]);}catch(_0x19191e){return BPromise[_0x0bba('0x23')](_0x19191e);}return _0xdd96c8['save']();};}function saveUpdates(_0x1a7142,_0x2dfe00){return function(_0xb93dd){if(_0xb93dd){return _0xb93dd[_0x0bba('0x24')](_0x1a7142)[_0x0bba('0x25')](function(_0x156ed2){return _0x156ed2;});}return null;};}function removeEntity(_0x5aa10b,_0x5ea4f0){return function(_0x5e202f){if(_0x5e202f){return _0x5e202f[_0x0bba('0x26')]()[_0x0bba('0x25')](function(){var _0x5e5eda=_0x5e202f[_0x0bba('0x27')]({'plain':!![]});var _0x988162=_0x0bba('0x28');return db[_0x0bba('0x29')][_0x0bba('0x26')]({'where':{'type':_0x988162,'resourceId':_0x5e5eda['id']}})[_0x0bba('0x25')](function(){return _0x5e202f;});})[_0x0bba('0x25')](function(){_0x5aa10b[_0x0bba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434217,_0x41542e){return function(_0x3f4d8d){if(!_0x3f4d8d){_0x434217['sendStatus'](0x194);}return _0x3f4d8d;};}function handleError(_0x527a6a,_0x14a314){_0x14a314=_0x14a314||0x1f4;return function(_0x51837d){logger[_0x0bba('0x2a')](_0x51837d['stack']);if(_0x51837d[_0x0bba('0x2b')]){delete _0x51837d[_0x0bba('0x2b')];}_0x527a6a[_0x0bba('0x19')](_0x14a314)['send'](_0x51837d);};}exports['index']=function(_0x5225ef,_0x5195b2){var _0x2842a9={},_0x5ef530={},_0x161f3f={'count':0x0,'rows':[]};var _0x2e87d2=_[_0x0bba('0x2c')](db[_0x0bba('0x2d')][_0x0bba('0x2e')],function(_0x145b2d){return{'name':_0x145b2d[_0x0bba('0x2f')],'type':_0x145b2d[_0x0bba('0x30')][_0x0bba('0x31')]};});_0x5ef530[_0x0bba('0x32')]=_[_0x0bba('0x2c')](_0x2e87d2,'name');_0x5ef530['query']=_['keys'](_0x5225ef[_0x0bba('0x33')]);_0x5ef530['filters']=_['intersection'](_0x5ef530[_0x0bba('0x32')],_0x5ef530['query']);_0x2842a9['attributes']=_[_0x0bba('0x34')](_0x5ef530[_0x0bba('0x32')],qs[_0x0bba('0x35')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x35')]));_0x2842a9[_0x0bba('0x36')]=_0x2842a9['attributes'][_0x0bba('0x37')]?_0x2842a9[_0x0bba('0x36')]:_0x5ef530[_0x0bba('0x32')];if(!_0x5225ef[_0x0bba('0x33')][_0x0bba('0x38')](_0x0bba('0x39'))){_0x2842a9[_0x0bba('0x1e')]=qs[_0x0bba('0x1e')](_0x5225ef[_0x0bba('0x33')]['limit']);_0x2842a9['offset']=qs[_0x0bba('0x1c')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x1c')]);}_0x2842a9[_0x0bba('0x3a')]=qs[_0x0bba('0x3b')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x3b')]);_0x2842a9[_0x0bba('0x3c')]=qs[_0x0bba('0x3d')](_['pick'](_0x5225ef['query'],_0x5ef530[_0x0bba('0x3d')]),_0x2e87d2);if(_0x5225ef[_0x0bba('0x33')]['filter']){_0x2842a9[_0x0bba('0x3c')]=_['merge'](_0x2842a9['where'],{'$or':_[_0x0bba('0x2c')](_0x2e87d2,function(_0xb9c6ef){if(_0xb9c6ef[_0x0bba('0x30')]!=='VIRTUAL'){var _0x9d4a0b={};_0x9d4a0b[_0xb9c6ef['name']]={'$like':'%'+_0x5225ef[_0x0bba('0x33')][_0x0bba('0x3e')]+'%'};return _0x9d4a0b;}})});}_0x2842a9=_[_0x0bba('0x3f')]({},_0x2842a9,_0x5225ef[_0x0bba('0x40')]);var _0x2d846b={'where':_0x2842a9['where']};return db[_0x0bba('0x2d')][_0x0bba('0x1f')](_0x2d846b)[_0x0bba('0x25')](function(_0x5c4eec){_0x161f3f['count']=_0x5c4eec;if(_0x5225ef[_0x0bba('0x33')][_0x0bba('0x41')]){_0x2842a9[_0x0bba('0x42')]=[{'all':!![]}];}return db[_0x0bba('0x2d')]['findAll'](_0x2842a9);})[_0x0bba('0x25')](function(_0x129b72){_0x161f3f[_0x0bba('0x43')]=_0x129b72;return _0x161f3f;})['then'](respondWithFilteredResult(_0x5195b2,_0x2842a9))[_0x0bba('0x44')](handleError(_0x5195b2,null));};exports[_0x0bba('0x45')]=function(_0x252138,_0x4fc77d){var _0x217f0d={'raw':!![],'where':{'id':_0x252138['params']['id']}},_0x3f4a74={};_0x3f4a74[_0x0bba('0x32')]=_[_0x0bba('0x46')](db[_0x0bba('0x2d')][_0x0bba('0x2e')]);_0x3f4a74[_0x0bba('0x33')]=_['keys'](_0x252138[_0x0bba('0x33')]);_0x3f4a74[_0x0bba('0x3d')]=_[_0x0bba('0x34')](_0x3f4a74[_0x0bba('0x32')],_0x3f4a74[_0x0bba('0x33')]);_0x217f0d[_0x0bba('0x36')]=_[_0x0bba('0x34')](_0x3f4a74['model'],qs[_0x0bba('0x35')](_0x252138['query']['fields']));_0x217f0d[_0x0bba('0x36')]=_0x217f0d[_0x0bba('0x36')][_0x0bba('0x37')]?_0x217f0d[_0x0bba('0x36')]:_0x3f4a74[_0x0bba('0x32')];if(_0x252138[_0x0bba('0x33')][_0x0bba('0x41')]){_0x217f0d[_0x0bba('0x42')]=[{'all':!![]}];}_0x217f0d=_[_0x0bba('0x3f')]({},_0x217f0d,_0x252138[_0x0bba('0x40')]);return db['Pause']['find'](_0x217f0d)[_0x0bba('0x25')](handleEntityNotFound(_0x4fc77d,null))['then'](respondWithResult(_0x4fc77d,null))[_0x0bba('0x44')](handleError(_0x4fc77d,null));};exports[_0x0bba('0x47')]=function(_0x37a68c,_0xaf2dda){return db[_0x0bba('0x2d')]['create'](_0x37a68c[_0x0bba('0x48')],{})[_0x0bba('0x25')](function(_0x32c7ef){var _0x301b35=_0x37a68c['user'][_0x0bba('0x27')]({'plain':!![]});if(!_0x301b35)throw new Error(_0x0bba('0x49'));if(_0x301b35['role']===_0x0bba('0x4a')){var _0x4139c9=_0x32c7ef[_0x0bba('0x27')]({'plain':!![]});var _0x18fffc='Pauses';return db['UserProfileSection'][_0x0bba('0x4b')]({'where':{'name':_0x18fffc,'userProfileId':_0x301b35[_0x0bba('0x4c')]},'raw':!![]})[_0x0bba('0x25')](function(_0x32590c){if(_0x32590c&&_0x32590c[_0x0bba('0x4d')]===0x0){return db[_0x0bba('0x29')][_0x0bba('0x47')]({'name':_0x4139c9['name'],'resourceId':_0x4139c9['id'],'type':_0x32590c[_0x0bba('0x2b')],'sectionId':_0x32590c['id']},{})[_0x0bba('0x25')](function(){return _0x32c7ef;});}else{return _0x32c7ef;}})[_0x0bba('0x44')](function(_0x234d8f){logger[_0x0bba('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x234d8f);throw _0x234d8f;});}return _0x32c7ef;})['then'](respondWithResult(_0xaf2dda,0xc9))[_0x0bba('0x44')](handleError(_0xaf2dda,null));};exports[_0x0bba('0x24')]=function(_0x5c0171,_0x328197){if(_0x5c0171[_0x0bba('0x48')]['id']){delete _0x5c0171[_0x0bba('0x48')]['id'];}return db['Pause'][_0x0bba('0x4b')]({'where':{'id':_0x5c0171[_0x0bba('0x4e')]['id']}})[_0x0bba('0x25')](handleEntityNotFound(_0x328197,null))[_0x0bba('0x25')](saveUpdates(_0x5c0171['body'],null))[_0x0bba('0x25')](respondWithResult(_0x328197,null))[_0x0bba('0x44')](handleError(_0x328197,null));};exports['destroy']=function(_0x338e42,_0x25fb27){return db[_0x0bba('0x2d')]['find']({'where':{'id':_0x338e42['params']['id']}})['then'](handleEntityNotFound(_0x25fb27,null))[_0x0bba('0x25')](removeEntity(_0x25fb27,null))['catch'](handleError(_0x25fb27,null));}; \ No newline at end of file +var _0xa98c=['filter','merge','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2ca90c,_0x3ae6ff){var _0x59fda3=function(_0x2c634d){while(--_0x2c634d){_0x2ca90c['push'](_0x2ca90c['shift']());}};_0x59fda3(++_0x3ae6ff);}(_0xa98c,0xb7));var _0xca98=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0xa98c[_0xe1a3a5];return _0x362646;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca98('0x0'));var jsonpatch=require(_0xca98('0x1'));var rp=require(_0xca98('0x2'));var moment=require('moment');var BPromise=require(_0xca98('0x3'));var Mustache=require(_0xca98('0x4'));var util=require(_0xca98('0x5'));var path=require('path');var sox=require(_0xca98('0x6'));var csv=require(_0xca98('0x7'));var ejs=require(_0xca98('0x8'));var fs=require('fs');var fs_extra=require(_0xca98('0x9'));var _=require('lodash');var squel=require(_0xca98('0xa'));var crypto=require('crypto');var jsforce=require(_0xca98('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xca98('0x7'));var querystring=require(_0xca98('0xc'));var Papa=require(_0xca98('0xd'));var Redis=require(_0xca98('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca98('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca98('0x10'))(_0xca98('0x11'));var utils=require(_0xca98('0x12'));var config=require(_0xca98('0x13'));var licenseUtil=require(_0xca98('0x14'));var db=require(_0xca98('0x15'))['db'];function respondWithStatusCode(_0x329aa7,_0x5775f1){_0x5775f1=_0x5775f1||0xcc;return function(_0x183b4f){if(_0x183b4f){return _0x329aa7[_0xca98('0x16')](_0x5775f1);}return _0x329aa7[_0xca98('0x17')](_0x5775f1)[_0xca98('0x18')]();};}function respondWithResult(_0x56b749,_0x54c77d){_0x54c77d=_0x54c77d||0xc8;return function(_0x287d68){if(_0x287d68){return _0x56b749['status'](_0x54c77d)[_0xca98('0x19')](_0x287d68);}};}function respondWithFilteredResult(_0x4f5901,_0x5e6b0a){return function(_0x14aa97){if(_0x14aa97){var _0x5c15ed=typeof _0x5e6b0a['offset']===_0xca98('0x1a')&&typeof _0x5e6b0a[_0xca98('0x1b')]===_0xca98('0x1a');var _0x3a7704=_0x14aa97[_0xca98('0x1c')];var _0x4ff609=_0x5c15ed?0x0:_0x5e6b0a[_0xca98('0x1d')];var _0x4a0b65=_0x5c15ed?_0x14aa97[_0xca98('0x1c')]:_0x5e6b0a[_0xca98('0x1d')]+_0x5e6b0a['limit'];var _0x51f94e;if(_0x4a0b65>=_0x3a7704){_0x4a0b65=_0x3a7704;_0x51f94e=0xc8;}else{_0x51f94e=0xce;}_0x4f5901[_0xca98('0x17')](_0x51f94e);return _0x4f5901['set'](_0xca98('0x1e'),_0x4ff609+'-'+_0x4a0b65+'/'+_0x3a7704)[_0xca98('0x19')](_0x14aa97);}return null;};}function patchUpdates(_0x1ab8cc){return function(_0x4ca9f9){try{jsonpatch[_0xca98('0x1f')](_0x4ca9f9,_0x1ab8cc,!![]);}catch(_0x5876c5){return BPromise[_0xca98('0x20')](_0x5876c5);}return _0x4ca9f9[_0xca98('0x21')]();};}function saveUpdates(_0x141bbb,_0x2cc65a){return function(_0x5c4879){if(_0x5c4879){return _0x5c4879[_0xca98('0x22')](_0x141bbb)['then'](function(_0xe8032b){return _0xe8032b;});}return null;};}function removeEntity(_0x55b91f,_0x143213){return function(_0x5eb3e2){if(_0x5eb3e2){return _0x5eb3e2[_0xca98('0x23')]()[_0xca98('0x24')](function(){var _0x19ba53=_0x5eb3e2[_0xca98('0x25')]({'plain':!![]});var _0x9a5cca=_0xca98('0x26');return db[_0xca98('0x27')][_0xca98('0x23')]({'where':{'type':_0x9a5cca,'resourceId':_0x19ba53['id']}})[_0xca98('0x24')](function(){return _0x5eb3e2;});})['then'](function(){_0x55b91f[_0xca98('0x17')](0xcc)[_0xca98('0x18')]();});}};}function handleEntityNotFound(_0x1e5468,_0x35f7c6){return function(_0x27a442){if(!_0x27a442){_0x1e5468['sendStatus'](0x194);}return _0x27a442;};}function handleError(_0x18066b,_0x2a5dcb){_0x2a5dcb=_0x2a5dcb||0x1f4;return function(_0x43ae38){logger['error'](_0x43ae38[_0xca98('0x28')]);if(_0x43ae38[_0xca98('0x29')]){delete _0x43ae38[_0xca98('0x29')];}_0x18066b[_0xca98('0x17')](_0x2a5dcb)[_0xca98('0x2a')](_0x43ae38);};}exports[_0xca98('0x2b')]=function(_0x23a1a0,_0x44eea1){var _0x5643c3={},_0xb010c6={},_0x17039a={'count':0x0,'rows':[]};var _0x575817=_['map'](db[_0xca98('0x2c')][_0xca98('0x2d')],function(_0x40e15e){return{'name':_0x40e15e[_0xca98('0x2e')],'type':_0x40e15e[_0xca98('0x2f')][_0xca98('0x30')]};});_0xb010c6[_0xca98('0x31')]=_[_0xca98('0x32')](_0x575817,_0xca98('0x29'));_0xb010c6['query']=_[_0xca98('0x33')](_0x23a1a0[_0xca98('0x34')]);_0xb010c6[_0xca98('0x35')]=_[_0xca98('0x36')](_0xb010c6[_0xca98('0x31')],_0xb010c6['query']);_0x5643c3[_0xca98('0x37')]=_[_0xca98('0x36')](_0xb010c6[_0xca98('0x31')],qs[_0xca98('0x38')](_0x23a1a0[_0xca98('0x34')][_0xca98('0x38')]));_0x5643c3[_0xca98('0x37')]=_0x5643c3[_0xca98('0x37')][_0xca98('0x39')]?_0x5643c3[_0xca98('0x37')]:_0xb010c6[_0xca98('0x31')];if(!_0x23a1a0['query'][_0xca98('0x3a')](_0xca98('0x3b'))){_0x5643c3[_0xca98('0x1b')]=qs['limit'](_0x23a1a0['query']['limit']);_0x5643c3[_0xca98('0x1d')]=qs[_0xca98('0x1d')](_0x23a1a0[_0xca98('0x34')][_0xca98('0x1d')]);}_0x5643c3[_0xca98('0x3c')]=qs[_0xca98('0x3d')](_0x23a1a0[_0xca98('0x34')]['sort']);_0x5643c3[_0xca98('0x3e')]=qs[_0xca98('0x35')](_['pick'](_0x23a1a0[_0xca98('0x34')],_0xb010c6['filters']),_0x575817);if(_0x23a1a0[_0xca98('0x34')][_0xca98('0x3f')]){_0x5643c3[_0xca98('0x3e')]=_[_0xca98('0x40')](_0x5643c3['where'],{'$or':_[_0xca98('0x32')](_0x575817,function(_0x14d0b9){if(_0x14d0b9[_0xca98('0x2f')]!=='VIRTUAL'){var _0x4f3f53={};_0x4f3f53[_0x14d0b9['name']]={'$like':'%'+_0x23a1a0[_0xca98('0x34')]['filter']+'%'};return _0x4f3f53;}})});}_0x5643c3=_['merge']({},_0x5643c3,_0x23a1a0['options']);var _0x14700d={'where':_0x5643c3[_0xca98('0x3e')]};return db[_0xca98('0x2c')][_0xca98('0x1c')](_0x14700d)[_0xca98('0x24')](function(_0x1f0473){_0x17039a[_0xca98('0x1c')]=_0x1f0473;if(_0x23a1a0['query'][_0xca98('0x41')]){_0x5643c3[_0xca98('0x42')]=[{'all':!![]}];}return db['Pause'][_0xca98('0x43')](_0x5643c3);})[_0xca98('0x24')](function(_0x540197){_0x17039a[_0xca98('0x44')]=_0x540197;return _0x17039a;})[_0xca98('0x24')](respondWithFilteredResult(_0x44eea1,_0x5643c3))['catch'](handleError(_0x44eea1,null));};exports[_0xca98('0x45')]=function(_0x5c79bd,_0x1c371f){var _0x2da7e7={'raw':!![],'where':{'id':_0x5c79bd['params']['id']}},_0x137bdd={};_0x137bdd[_0xca98('0x31')]=_[_0xca98('0x33')](db['Pause'][_0xca98('0x2d')]);_0x137bdd[_0xca98('0x34')]=_['keys'](_0x5c79bd[_0xca98('0x34')]);_0x137bdd[_0xca98('0x35')]=_['intersection'](_0x137bdd['model'],_0x137bdd['query']);_0x2da7e7['attributes']=_['intersection'](_0x137bdd[_0xca98('0x31')],qs['fields'](_0x5c79bd[_0xca98('0x34')]['fields']));_0x2da7e7['attributes']=_0x2da7e7[_0xca98('0x37')][_0xca98('0x39')]?_0x2da7e7[_0xca98('0x37')]:_0x137bdd[_0xca98('0x31')];if(_0x5c79bd[_0xca98('0x34')]['includeAll']){_0x2da7e7['include']=[{'all':!![]}];}_0x2da7e7=_[_0xca98('0x40')]({},_0x2da7e7,_0x5c79bd['options']);return db[_0xca98('0x2c')][_0xca98('0x46')](_0x2da7e7)[_0xca98('0x24')](handleEntityNotFound(_0x1c371f,null))[_0xca98('0x24')](respondWithResult(_0x1c371f,null))[_0xca98('0x47')](handleError(_0x1c371f,null));};exports[_0xca98('0x48')]=function(_0x35c3d6,_0x4c9f43){return db['Pause'][_0xca98('0x48')](_0x35c3d6['body'],{})[_0xca98('0x24')](function(_0x16f230){var _0x84e1d8=_0x35c3d6[_0xca98('0x49')][_0xca98('0x25')]({'plain':!![]});if(!_0x84e1d8)throw new Error(_0xca98('0x4a'));if(_0x84e1d8[_0xca98('0x4b')]===_0xca98('0x49')){var _0x149dc7=_0x16f230[_0xca98('0x25')]({'plain':!![]});var _0x24ccba='Pauses';return db[_0xca98('0x4c')][_0xca98('0x46')]({'where':{'name':_0x24ccba,'userProfileId':_0x84e1d8[_0xca98('0x4d')]},'raw':!![]})[_0xca98('0x24')](function(_0x422c9d){if(_0x422c9d&&_0x422c9d[_0xca98('0x4e')]===0x0){return db[_0xca98('0x27')]['create']({'name':_0x149dc7[_0xca98('0x29')],'resourceId':_0x149dc7['id'],'type':_0x422c9d[_0xca98('0x29')],'sectionId':_0x422c9d['id']},{})[_0xca98('0x24')](function(){return _0x16f230;});}else{return _0x16f230;}})[_0xca98('0x47')](function(_0x1d0b8c){logger[_0xca98('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d0b8c);throw _0x1d0b8c;});}return _0x16f230;})[_0xca98('0x24')](respondWithResult(_0x4c9f43,0xc9))[_0xca98('0x47')](handleError(_0x4c9f43,null));};exports[_0xca98('0x22')]=function(_0x3592dc,_0x17abbd){if(_0x3592dc['body']['id']){delete _0x3592dc[_0xca98('0x50')]['id'];}return db[_0xca98('0x2c')][_0xca98('0x46')]({'where':{'id':_0x3592dc[_0xca98('0x51')]['id']}})[_0xca98('0x24')](handleEntityNotFound(_0x17abbd,null))[_0xca98('0x24')](saveUpdates(_0x3592dc['body'],null))[_0xca98('0x24')](respondWithResult(_0x17abbd,null))[_0xca98('0x47')](handleError(_0x17abbd,null));};exports['destroy']=function(_0x58161a,_0x13481b){return db[_0xca98('0x2c')]['find']({'where':{'id':_0x58161a[_0xca98('0x51')]['id']}})[_0xca98('0x24')](handleEntityNotFound(_0x13481b,null))[_0xca98('0x24')](removeEntity(_0x13481b,null))[_0xca98('0x47')](handleError(_0x13481b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index d79d15e..3730dc3 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5e91be,_0x24e723){var _0x2a357d=function(_0x4c695e){while(--_0x4c695e){_0x5e91be['push'](_0x5e91be['shift']());}};_0x2a357d(++_0x24e723);}(_0x326f,0xd1));var _0xf326=function(_0x41fcb6,_0x3aa5ae){_0x41fcb6=_0x41fcb6-0x0;var _0x186956=_0x326f[_0x41fcb6];return _0x186956;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 7ed882d..de1a5a8 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x571433,_0x28da0c){var _0x12bc56=function(_0x5ec56a){while(--_0x5ec56a){_0x571433['push'](_0x571433['shift']());}};_0x12bc56(++_0x28da0c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c5eac,_0x319ede){_0x2c5eac=_0x2c5eac-0x0;var _0x13773d=_0xb10b[_0x2c5eac];return _0x13773d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4ddfbd,_0x37fdcf){var _0x3db951=function(_0x462781){while(--_0x462781){_0x4ddfbd['push'](_0x4ddfbd['shift']());}};_0x3db951(++_0x37fdcf);}(_0xb10b,0x12a));var _0xbb10=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb10b[_0xd050c6];return _0x7278a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 34c3645..3dd9595 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 _0x72b1=['./plugin.controller','get','isAuthenticated','index','/webhook','show','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ec5ab,_0x17b398){var _0x39e35e=function(_0x30d8a5){while(--_0x30d8a5){_0x3ec5ab['push'](_0x3ec5ab['shift']());}};_0x39e35e(++_0x17b398);}(_0x72b1,0x16e));var _0x172b=function(_0x27b97a,_0x3d93cd){_0x27b97a=_0x27b97a-0x0;var _0x10bee1=_0x72b1[_0x27b97a];return _0x10bee1;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),controller['webhookGet']);router[_0x172b('0x9')]('/:id',auth[_0x172b('0xa')](),controller[_0x172b('0xd')]);router[_0x172b('0x9')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0xf')]);var upload=multer({'storage':multer[_0x172b('0x10')]({'destination':function(_0x28aaad,_0x161c7c,_0xa4ada9){_0xa4ada9(null,path[_0x172b('0x11')](config[_0x172b('0x12')],'server/files/plugins'));},'filename':function(_0x13d285,_0x82727f,_0xdf832e){_0x82727f['originalname']=_0x82727f[_0x172b('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xdf832e(null,util[_0x172b('0x14')](_0x172b('0x15'),path['basename'](_0x82727f[_0x172b('0x13')],path[_0x172b('0x16')](_0x82727f[_0x172b('0x13')])),Date[_0x172b('0x17')](),path['extname'](_0x82727f['originalname'])));}})});router[_0x172b('0x18')]('/',upload[_0x172b('0x19')](_0x172b('0x1a')),controller[_0x172b('0x1b')]);router['post']('/webhook',controller[_0x172b('0x1c')]);router[_0x172b('0x1d')](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x1f')]);router['delete'](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x20')]);module[_0x172b('0x21')]=router; \ No newline at end of file +var _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x373f38,_0x5b41bb){var _0x19eb4f=function(_0x2f7f2e){while(--_0x2f7f2e){_0x373f38['push'](_0x373f38['shift']());}};_0x19eb4f(++_0x5b41bb);}(_0x68fc,0xa5));var _0xc68f=function(_0xa4c4fa,_0x3bf8fe){_0xa4c4fa=_0xa4c4fa-0x0;var _0x551559=_0x68fc[_0xa4c4fa];return _0x551559;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bc27b40..3011e91 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 _0x592b=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','exports','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','never'];(function(_0x13188a,_0x2f635f){var _0x2f5716=function(_0x40d1b4){while(--_0x40d1b4){_0x13188a['push'](_0x13188a['shift']());}};_0x2f5716(++_0x2f635f);}(_0x592b,0x87));var _0xb592=function(_0x73ad2,_0x3c36a0){_0x73ad2=_0x73ad2-0x0;var _0x56c214=_0x592b[_0x73ad2];return _0x56c214;};'use strict';var Sequelize=require('sequelize');module[_0xb592('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb592('0x1')]('html',_0xb592('0x2'))},'description':{'type':Sequelize[_0xb592('0x3')]},'version':{'type':Sequelize[_0xb592('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0xb592('0x4')},'active':{'type':Sequelize[_0xb592('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb592('0x1')](_0xb592('0x6'),_0xb592('0x7'),'always',_0xb592('0x8')),'defaultValue':_0xb592('0x9'),'comment':_0xb592('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb592('0xb')]},'scriptPath':{'type':Sequelize[_0xb592('0xb')]}}; \ No newline at end of file +var _0x05a9=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','sequelize','exports','ENUM'];(function(_0x41bda5,_0x113e7a){var _0xda4625=function(_0x1a6e0f){while(--_0x1a6e0f){_0x41bda5['push'](_0x41bda5['shift']());}};_0xda4625(++_0x113e7a);}(_0x05a9,0x8d));var _0x905a=function(_0x5968e7,_0x5cadb1){_0x5968e7=_0x5968e7-0x0;var _0x5cb5c6=_0x05a9[_0x5968e7];return _0x5cb5c6;};'use strict';var Sequelize=require(_0x905a('0x0'));module[_0x905a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x905a('0x2')](_0x905a('0x3'),_0x905a('0x4'))},'description':{'type':Sequelize[_0x905a('0x5')]},'version':{'type':Sequelize[_0x905a('0x5')]},'path':{'type':Sequelize[_0x905a('0x6')],'comment':_0x905a('0x7')},'active':{'type':Sequelize[_0x905a('0x8')],'defaultValue':0x0,'comment':_0x905a('0x9')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x905a('0xa'),_0x905a('0xb'),'never'),'defaultValue':_0x905a('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x905a('0x6')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x905a('0x6')]},'scriptName':{'type':Sequelize[_0x905a('0x6')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1ed09b3..2633f72 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 _0x7b6d=['end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','params','length','includeAll','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','rimraf','archiver','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','./plugin.socket','register','sendStatus','status'];(function(_0x49f24a,_0x3f8da0){var _0x41ae25=function(_0xb08e2a){while(--_0xb08e2a){_0x49f24a['push'](_0x49f24a['shift']());}};_0x41ae25(++_0x3f8da0);}(_0x7b6d,0x138));var _0xd7b6=function(_0x26fc89,_0x5f06cd){_0x26fc89=_0x26fc89-0x0;var _0x3d27a9=_0x7b6d[_0x26fc89];return _0x3d27a9;};'use strict';var emlformat=require(_0xd7b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7b6('0x1'));var jsonpatch=require(_0xd7b6('0x2'));var rp=require(_0xd7b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7b6('0x4'));var util=require('util');var path=require(_0xd7b6('0x5'));var sox=require(_0xd7b6('0x6'));var csv=require('to-csv');var ejs=require(_0xd7b6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b6('0x8'));var squel=require(_0xd7b6('0x9'));var crypto=require(_0xd7b6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd7b6('0xb'));var querystring=require(_0xd7b6('0xc'));var Papa=require(_0xd7b6('0xd'));var extract=require('extract-zip');var rimraf=require(_0xd7b6('0xe'));var archiver=require(_0xd7b6('0xf'));var Redis=require(_0xd7b6('0x10'));var authService=require(_0xd7b6('0x11'));var qs=require(_0xd7b6('0x12'));var as=require(_0xd7b6('0x13'));var hardwareService=require(_0xd7b6('0x14'));var logger=require('../../config/logger')(_0xd7b6('0x15'));var utils=require(_0xd7b6('0x16'));var config=require(_0xd7b6('0x17'));var licenseUtil=require(_0xd7b6('0x18'));var db=require(_0xd7b6('0x19'))['db'];config[_0xd7b6('0x1a')]=_[_0xd7b6('0x1b')](config[_0xd7b6('0x1a')],{'host':_0xd7b6('0x1c'),'port':0x18eb});var socket=require(_0xd7b6('0x1d'))(new Redis(config[_0xd7b6('0x1a')]));require(_0xd7b6('0x1e'))[_0xd7b6('0x1f')](socket);function respondWithStatusCode(_0x424f98,_0x2182d3){_0x2182d3=_0x2182d3||0xcc;return function(_0x29b4b4){if(_0x29b4b4){return _0x424f98[_0xd7b6('0x20')](_0x2182d3);}return _0x424f98[_0xd7b6('0x21')](_0x2182d3)[_0xd7b6('0x22')]();};}function respondWithResult(_0x431c9d,_0x3f39c2){_0x3f39c2=_0x3f39c2||0xc8;return function(_0x377957){if(_0x377957){return _0x431c9d['status'](_0x3f39c2)[_0xd7b6('0x23')](_0x377957);}};}function respondWithFilteredResult(_0x44cac3,_0x2f76ab){return function(_0x25b7e0){if(_0x25b7e0){var _0x35b1ee=typeof _0x2f76ab[_0xd7b6('0x24')]===_0xd7b6('0x25')&&typeof _0x2f76ab[_0xd7b6('0x26')]===_0xd7b6('0x25');var _0x5e7b16=_0x25b7e0[_0xd7b6('0x27')];var _0x55a94b=_0x35b1ee?0x0:_0x2f76ab[_0xd7b6('0x24')];var _0x1002cd=_0x35b1ee?_0x25b7e0[_0xd7b6('0x27')]:_0x2f76ab[_0xd7b6('0x24')]+_0x2f76ab[_0xd7b6('0x26')];var _0x2d3a22;if(_0x1002cd>=_0x5e7b16){_0x1002cd=_0x5e7b16;_0x2d3a22=0xc8;}else{_0x2d3a22=0xce;}_0x44cac3[_0xd7b6('0x21')](_0x2d3a22);return _0x44cac3[_0xd7b6('0x28')]('Content-Range',_0x55a94b+'-'+_0x1002cd+'/'+_0x5e7b16)[_0xd7b6('0x23')](_0x25b7e0);}return null;};}function patchUpdates(_0x388dce){return function(_0x5cb82a){try{jsonpatch['apply'](_0x5cb82a,_0x388dce,!![]);}catch(_0x3d9453){return BPromise[_0xd7b6('0x29')](_0x3d9453);}return _0x5cb82a[_0xd7b6('0x2a')]();};}function saveUpdates(_0x52bb62,_0x4e2886){return function(_0x5224c2){if(_0x5224c2){return _0x5224c2[_0xd7b6('0x2b')](_0x52bb62)[_0xd7b6('0x2c')](function(_0x10d802){return _0x10d802;});}return null;};}function removeEntity(_0x34f4ca,_0x142377){return function(_0x33bd70){if(_0x33bd70){return _0x33bd70[_0xd7b6('0x2d')]()['then'](function(){var _0x274b77=_0x33bd70[_0xd7b6('0x2e')]({'plain':!![]});var _0x51973d=_0xd7b6('0x2f');return db[_0xd7b6('0x30')][_0xd7b6('0x2d')]({'where':{'type':_0x51973d,'resourceId':_0x274b77['id']}})[_0xd7b6('0x2c')](function(){return _0x33bd70;});})['then'](function(){_0x34f4ca['status'](0xcc)[_0xd7b6('0x22')]();});}};}function handleEntityNotFound(_0x13775f,_0x58a4b5){return function(_0x2883c1){if(!_0x2883c1){_0x13775f[_0xd7b6('0x20')](0x194);}return _0x2883c1;};}function handleError(_0x3f66e3,_0x5d382c){_0x5d382c=_0x5d382c||0x1f4;return function(_0x331051){logger[_0xd7b6('0x31')](_0x331051[_0xd7b6('0x32')]);if(_0x331051[_0xd7b6('0x33')]){delete _0x331051['name'];}_0x3f66e3[_0xd7b6('0x21')](_0x5d382c)[_0xd7b6('0x34')](_0x331051);};}exports[_0xd7b6('0x35')]=function(_0x230cb0,_0x1060ec){var _0x265dd5={},_0x277858={},_0x531631={'count':0x0,'rows':[]};var _0x1e8bd4=_['map'](db[_0xd7b6('0x36')][_0xd7b6('0x37')],function(_0x5696a0){return{'name':_0x5696a0['fieldName'],'type':_0x5696a0['type'][_0xd7b6('0x38')]};});_0x277858[_0xd7b6('0x39')]=_[_0xd7b6('0x3a')](_0x1e8bd4,_0xd7b6('0x33'));_0x277858[_0xd7b6('0x3b')]=_[_0xd7b6('0x3c')](_0x230cb0[_0xd7b6('0x3b')]);_0x277858[_0xd7b6('0x3d')]=_[_0xd7b6('0x3e')](_0x277858[_0xd7b6('0x39')],_0x277858[_0xd7b6('0x3b')]);_0x265dd5['attributes']=_[_0xd7b6('0x3e')](_0x277858[_0xd7b6('0x39')],qs['fields'](_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x3f')]));_0x265dd5[_0xd7b6('0x40')]=_0x265dd5[_0xd7b6('0x40')]['length']?_0x265dd5[_0xd7b6('0x40')]:_0x277858['model'];if(!_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x41')]('nolimit')){_0x265dd5['limit']=qs[_0xd7b6('0x26')](_0x230cb0[_0xd7b6('0x3b')]['limit']);_0x265dd5[_0xd7b6('0x24')]=qs[_0xd7b6('0x24')](_0x230cb0[_0xd7b6('0x3b')]['offset']);}_0x265dd5[_0xd7b6('0x42')]=qs[_0xd7b6('0x43')](_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x43')]);_0x265dd5[_0xd7b6('0x44')]=qs[_0xd7b6('0x3d')](_[_0xd7b6('0x45')](_0x230cb0[_0xd7b6('0x3b')],_0x277858[_0xd7b6('0x3d')]),_0x1e8bd4);if(_0x230cb0['query'][_0xd7b6('0x46')]){_0x265dd5[_0xd7b6('0x44')]=_[_0xd7b6('0x47')](_0x265dd5[_0xd7b6('0x44')],{'$or':_[_0xd7b6('0x3a')](_0x1e8bd4,function(_0x5c0acc){if(_0x5c0acc[_0xd7b6('0x48')]!==_0xd7b6('0x49')){var _0x1804a1={};_0x1804a1[_0x5c0acc[_0xd7b6('0x33')]]={'$like':'%'+_0x230cb0['query'][_0xd7b6('0x46')]+'%'};return _0x1804a1;}})});}_0x265dd5=_[_0xd7b6('0x47')]({},_0x265dd5,_0x230cb0[_0xd7b6('0x4a')]);var _0xbd2c98={'where':_0x265dd5[_0xd7b6('0x44')]};return db[_0xd7b6('0x36')][_0xd7b6('0x27')](_0xbd2c98)[_0xd7b6('0x2c')](function(_0xe8d696){_0x531631[_0xd7b6('0x27')]=_0xe8d696;if(_0x230cb0[_0xd7b6('0x3b')]['includeAll']){_0x265dd5[_0xd7b6('0x4b')]=[{'all':!![]}];}return db[_0xd7b6('0x36')]['findAll'](_0x265dd5);})['then'](function(_0x51f529){_0x531631[_0xd7b6('0x4c')]=_0x51f529;return _0x531631;})['then'](respondWithFilteredResult(_0x1060ec,_0x265dd5))[_0xd7b6('0x4d')](handleError(_0x1060ec,null));};exports['show']=function(_0x57fd37,_0x3ebcb2){var _0x1a79e2={'raw':!![],'where':{'id':_0x57fd37[_0xd7b6('0x4e')]['id']}},_0x111163={};_0x111163[_0xd7b6('0x39')]=_['keys'](db[_0xd7b6('0x36')][_0xd7b6('0x37')]);_0x111163[_0xd7b6('0x3b')]=_[_0xd7b6('0x3c')](_0x57fd37[_0xd7b6('0x3b')]);_0x111163[_0xd7b6('0x3d')]=_[_0xd7b6('0x3e')](_0x111163['model'],_0x111163[_0xd7b6('0x3b')]);_0x1a79e2['attributes']=_[_0xd7b6('0x3e')](_0x111163['model'],qs[_0xd7b6('0x3f')](_0x57fd37[_0xd7b6('0x3b')]['fields']));_0x1a79e2[_0xd7b6('0x40')]=_0x1a79e2[_0xd7b6('0x40')][_0xd7b6('0x4f')]?_0x1a79e2[_0xd7b6('0x40')]:_0x111163['model'];if(_0x57fd37[_0xd7b6('0x3b')][_0xd7b6('0x50')]){_0x1a79e2[_0xd7b6('0x4b')]=[{'all':!![]}];}_0x1a79e2=_[_0xd7b6('0x47')]({},_0x1a79e2,_0x57fd37['options']);return db['Plugin'][_0xd7b6('0x51')](_0x1a79e2)[_0xd7b6('0x2c')](handleEntityNotFound(_0x3ebcb2,null))[_0xd7b6('0x2c')](respondWithResult(_0x3ebcb2,null))[_0xd7b6('0x4d')](handleError(_0x3ebcb2,null));};exports[_0xd7b6('0x52')]=function(_0x181fef,_0x321180,_0xbd3bb2){return db['Plugin'][_0xd7b6('0x51')]({'where':{'id':_0x181fef[_0xd7b6('0x4e')]['id']},'attributes':['name',_0xd7b6('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x321180,null))[_0xd7b6('0x2c')](function(_0x17273e){if(_0x17273e){var _0x278740=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),util['format'](_0xd7b6('0x56'),path[_0xd7b6('0x57')](_0x17273e[_0xd7b6('0x5')])));var _0x622a39=fs[_0xd7b6('0x58')](_0x278740);var _0x582962=archiver(_0xd7b6('0x59'),{'zlib':{'level':0x9}});_0x582962['on']('warning',function(_0x5d20c7){if(_0x5d20c7[_0xd7b6('0x5a')]===_0xd7b6('0x5b')){logger[_0xd7b6('0x31')](_0x5d20c7);}else{throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))](_0xd7b6('0x5e'));}});_0x582962['on']('error',function(_0x2e6994){throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x582962['pipe'](_0x622a39);_0x582962[_0xd7b6('0x5f')](_0xd7b6('0x60'),{'cwd':path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),path[_0xd7b6('0x61')](_0x17273e[_0xd7b6('0x5')])),'ignore':[path[_0xd7b6('0x53')](path[_0xd7b6('0x57')](_0x17273e[_0xd7b6('0x5')]),_0xd7b6('0x62')),path[_0xd7b6('0x53')](path['basename'](_0x17273e[_0xd7b6('0x5')]),'attachments/**/*')],'nodir':!![]})[_0xd7b6('0x63')]();_0x622a39['on']('close',function(){if(!fs[_0xd7b6('0x64')](_0x278740)){throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))](_0xd7b6('0x65'));}return _0x321180[_0xd7b6('0x52')](_0x278740,util['format'](_0xd7b6('0x56'),path[_0xd7b6('0x57')](_0x17273e['path'])),function(_0x2ce578){if(_0x2ce578){throw new db[(_0xd7b6('0x5c'))]['Error'](_0xd7b6('0x66'));}fs[_0xd7b6('0x67')](_0x278740);logger['info'](_0xd7b6('0x68'));logger[_0xd7b6('0x69')](_0xd7b6('0x6a'));});});}return null;})[_0xd7b6('0x4d')](handleError(_0x321180,null));};exports[_0xd7b6('0x6b')]=function(_0x55f7a3,_0xebc1a,_0x69b23e){var _0x53e9ce=path[_0xd7b6('0x57')](_0x55f7a3[_0xd7b6('0x6c')][_0xd7b6('0x6d')],path[_0xd7b6('0x6e')](_0x55f7a3[_0xd7b6('0x6c')]['filename']));var _0x2d83d=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),_0x55f7a3[_0xd7b6('0x6c')][_0xd7b6('0x6d')]);var _0x3c73a1=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),_0x53e9ce);logger[_0xd7b6('0x69')](_0xd7b6('0x6f'),_0x2d83d);logger[_0xd7b6('0x69')](_0xd7b6('0x70'),_0x3c73a1);try{fs['chmodSync'](_0x2d83d,parseInt(_0xd7b6('0x71'),0x8));extract(_0x2d83d,{'dir':_0x3c73a1},function(_0xb13427){if(_0xb13427){logger[_0xd7b6('0x31')](_0xb13427);handleError(_0xb13427,!![]);};var _0x28cf8a=fs[_0xd7b6('0x72')](_0x3c73a1);if(_0x28cf8a[_0xd7b6('0x4f')]>0x1){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')](_0xd7b6('0x73'));return _0x69b23e(new Error(_0xd7b6('0x73')));}var _0x5cb0d4=fs[_0xd7b6('0x74')](path['join'](_0x3c73a1,_0x28cf8a[0x0]));if(_0x5cb0d4[_0xd7b6('0x75')]()){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')](_0xd7b6('0x73'));return _0x69b23e(new Error(_0xd7b6('0x73')));}if(_0x5cb0d4['isDirectory']()){var _0x1371a7=fs['readdirSync'](path[_0xd7b6('0x53')](_0x3c73a1,_0x28cf8a[0x0]));if(_0x1371a7[_0xd7b6('0x4f')]===0x0){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')]('Invalid\x20plugin\x20structure');return _0x69b23e(new Error(_0xd7b6('0x73')));}var _0x189bfe=_0x1371a7['some'](function(_0x5d3c3b){return _0x5d3c3b===_0xd7b6('0x76');});if(!_0x189bfe){return _0x69b23e(new Error(_0xd7b6('0x77')));}var _0x4d38cf=fs[_0xd7b6('0x78')](path[_0xd7b6('0x53')](_0x3c73a1,_0x28cf8a[0x0],_0xd7b6('0x76')));var _0x845832=JSON[_0xd7b6('0x79')](_0x4d38cf);if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x33')]){return _0x69b23e(new Error(_0xd7b6('0x7a')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x48')]){return _0x69b23e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7b')]){return _0x69b23e(new Error(_0xd7b6('0x7c')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')]){return _0x69b23e(new Error(_0xd7b6('0x7e')));}if(_0x845832[_0xd7b6('0x48')]===_0xd7b6('0x7f')){if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]){return _0x69b23e(new Error(_0xd7b6('0x81')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')]&&_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]['agent']){return _0x69b23e(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x845832[_0xd7b6('0x48')]===_0xd7b6('0x83')){if(_0xd7b6('0x25')==typeof _0x845832['parameters'][_0xd7b6('0x84')]){return _0x69b23e(new Error(_0xd7b6('0x85')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')]['scriptPath']){return _0x69b23e(new Error(_0xd7b6('0x86')));}}else{return _0x69b23e(new Error(_0xd7b6('0x87')));}var _0x2bd8b1=_0x845832[_0xd7b6('0x33')];var _0x190a74=_0x845832[_0xd7b6('0x88')];var _0x478641=_0x845832[_0xd7b6('0x48')];var _0x399ff6=_0x845832['sidebar']?_0x845832['sidebar']:_0xd7b6('0x89');var _0x4da6b4=_0x845832[_0xd7b6('0x8a')]?_0x845832[_0xd7b6('0x8a')]:_0xd7b6('0x8b');var _0x79792d='';var _0x214028='';var _0x1e6a22='';var _0x49d973='';var _0xad9765=_0x845832[_0xd7b6('0x7b')];if(_0x478641===_0xd7b6('0x7f')){if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')]){var _0x261244=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x261244)){_0x79792d=path['join'](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x261244);}else{_0x79792d=_0x261244;}}else{logger[_0xd7b6('0x69')](_0xd7b6('0x8e'));}if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]['agent']){var _0x2ea6cc=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x2ea6cc)){_0x214028=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x2ea6cc);}else{_0x214028=_0x2ea6cc;}}else{logger[_0xd7b6('0x69')](_0xd7b6('0x90'));}}else if(_0x478641===_0xd7b6('0x83')){_0x1e6a22=_0x845832[_0xd7b6('0x7d')]['scriptName'];_0x49d973=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x91')];if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]){if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')]['views']['admin']){var _0x261244=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x261244)){_0x79792d=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x261244);}else{_0x79792d=_0x261244;}}if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')]){var _0x2ea6cc=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2ea6cc)){_0x214028=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x2ea6cc);}else{_0x214028=_0x2ea6cc;}}}}var _0x4ffd37={'name':_0x2bd8b1,'description':_0x190a74,'path':path[_0xd7b6('0x53')](_0x53e9ce,_0x28cf8a[0x0]),'type':_0x478641,'sidebar':_0x399ff6,'icon':_0x4da6b4,'adminUrl':_0x79792d,'agentUrl':_0x214028,'scriptName':_0x1e6a22,'scriptPath':_0x49d973,'version':_0xad9765};removeReferences(_0x2d83d,null);return db[_0xd7b6('0x36')][_0xd7b6('0x92')](_0x4ffd37)[_0xd7b6('0x2c')](function(_0x16e007){var _0x3dccb7={'role':_0x55f7a3[_0xd7b6('0x93')][_0xd7b6('0x94')],'userProfileId':_0x55f7a3[_0xd7b6('0x93')]['userProfileId']};if(!_0x3dccb7)throw new Error(_0xd7b6('0x95'));if(_0x3dccb7[_0xd7b6('0x94')]===_0xd7b6('0x96')){var _0x539f87=_0x16e007[_0xd7b6('0x2e')]({'plain':!![]});return db[_0xd7b6('0x97')][_0xd7b6('0x51')]({'where':{'name':'Plugins','userProfileId':_0x3dccb7[_0xd7b6('0x98')]},'raw':!![]})[_0xd7b6('0x2c')](function(_0x35a10f){if(_0x35a10f&&_0x35a10f[_0xd7b6('0x99')]===0x0){return db[_0xd7b6('0x30')][_0xd7b6('0x92')]({'name':_0x539f87[_0xd7b6('0x33')],'resourceId':_0x539f87['id'],'type':_0x35a10f[_0xd7b6('0x33')],'sectionId':_0x35a10f['id']},{})[_0xd7b6('0x2c')](function(){return _0x16e007;});}else{return _0x16e007;}})[_0xd7b6('0x4d')](function(_0xa3b7af){logger['error'](_0xd7b6('0x9a'),_0xa3b7af);throw _0xa3b7af;});}return _0x16e007;})['then'](respondWithResult(_0xebc1a,null))[_0xd7b6('0x4d')](handleError(_0xebc1a,null));}});}catch(_0x59c377){_0xebc1a[_0xd7b6('0x21')](0x1f4)[_0xd7b6('0x34')](_0x59c377);}};function removeReferences(_0x312f1e,_0x46c1e3){try{if(_0x312f1e){fs['unlinkSync'](_0x312f1e);logger[_0xd7b6('0x69')]('Zip\x20archive\x20removed');}if(_0x46c1e3){rimraf(_0x46c1e3,function(){});logger[_0xd7b6('0x69')](_0xd7b6('0x9b'));}}catch(_0xe70859){logger[_0xd7b6('0x31')](_0xe70859);}}exports[_0xd7b6('0x2b')]=function(_0x32f327,_0x1cac59,_0x58105a){return db['Plugin'][_0xd7b6('0x51')]({'where':{'id':_0x32f327['params']['id']}})[_0xd7b6('0x2c')](handleEntityNotFound(_0x1cac59,null))[_0xd7b6('0x2c')](saveUpdates(_0x32f327[_0xd7b6('0x93')],null))[_0xd7b6('0x2c')](respondWithResult(_0x1cac59,null))[_0xd7b6('0x4d')](handleError(_0x1cac59,null));};exports['delete']=function(_0x560f40,_0x56cc3d,_0x30aab4){return db[_0xd7b6('0x36')][_0xd7b6('0x51')]({'where':{'id':_0x560f40[_0xd7b6('0x4e')]['id']}})[_0xd7b6('0x2c')](function(_0x30deb3){if(_0x30deb3){return _0x30deb3[_0xd7b6('0x2d')]();}})[_0xd7b6('0x2c')](function(_0x3dc78f){rimraf(path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),path[_0xd7b6('0x61')](_0x3dc78f[_0xd7b6('0x5')])),function(){});return _0x3dc78f;})['then'](handleEntityNotFound(_0x56cc3d,null))[_0xd7b6('0x2c')](respondWithStatusCode(_0x56cc3d,null))[_0xd7b6('0x4d')](handleError(_0x56cc3d,null));};exports[_0xd7b6('0x9c')]=function(_0x299042,_0x307ac7,_0x4195d3){return BPromise['resolve']()['then'](function(){if(!_0x299042[_0xd7b6('0x3b')]['path']){throw new Error(_0xd7b6('0x9d'));}if(!_0x299042['query'][_0xd7b6('0x9e')]){throw new Error(_0xd7b6('0x9f'));}var _0x113e4b=_0x299042[_0xd7b6('0x3b')][_0xd7b6('0xa0')]?_0x299042['query']['hostname']+':'+_0x299042['query']['port']:_0xd7b6('0xa1')+_0x299042['query']['port'];var _0x1c7aeb=_0x299042['query'][_0xd7b6('0x23')]?_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x23')]:!![];var _0x472667=_0x299042['query'][_0xd7b6('0xa2')]?_0x299042[_0xd7b6('0x3b')][_0xd7b6('0xa2')]:null;var _0x1d0d7d={'method':_0x299042[_0xd7b6('0xa3')],'uri':util[_0xd7b6('0xa4')](_0xd7b6('0xa5'),_0x113e4b,_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x5')]),'json':_0x1c7aeb,'resolveWithFullResponse':!![],'encoding':_0x472667,'qs':_0x299042['query']};if(_0x299042[_0xd7b6('0xa6')]){_0x1d0d7d['headers']=_0x299042[_0xd7b6('0xa6')];if(_0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa7')]){delete _0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa7')];}}if(_0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa8')]){delete _0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa8')];}return rp(_0x1d0d7d);})['then'](function(_0x4e569f){if(_0x4e569f){_0x307ac7[_0xd7b6('0x28')](_0x4e569f[_0xd7b6('0xa6')]);logger[_0xd7b6('0x69')](_0x4e569f[_0xd7b6('0x93')]);if(_[_0xd7b6('0xa9')](_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x5')],_0xd7b6('0x52'))&&_0x4e569f[_0xd7b6('0xaa')]==0x1f4){return _0x307ac7[_0xd7b6('0x20')](_0x4e569f['statusCode']);}else{return _0x307ac7['status'](_0x4e569f[_0xd7b6('0xaa')])[_0xd7b6('0x34')](_0x4e569f[_0xd7b6('0x93')]);}}else{return _0x307ac7[_0xd7b6('0x20')](0xc8);}})['catch'](handleError(_0x307ac7,null));};exports[_0xd7b6('0xab')]=function(_0x221852,_0x4704b9,_0x251396){return BPromise[_0xd7b6('0xac')]()[_0xd7b6('0x2c')](function(){if(!_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x5')]){throw new Error(_0xd7b6('0x9d'));}if(!_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x9e')]){throw new Error(_0xd7b6('0x9f'));}var _0x37757d=_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa0')]?_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa0')]+':'+_0x221852['query'][_0xd7b6('0x9e')]:_0xd7b6('0xa1')+_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x9e')];var _0x5e933d=_0x221852[_0xd7b6('0x3b')]['json']?_0x221852[_0xd7b6('0x3b')]['json']:!![];var _0x3a9e4e=_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa2')]?_0x221852[_0xd7b6('0x3b')]['encoding']:null;var _0xadf780={'method':_0x221852['method'],'uri':util[_0xd7b6('0xa4')](_0xd7b6('0xa5'),_0x37757d,_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x5')]),'json':_0x5e933d,'resolveWithFullResponse':!![],'encoding':_0x3a9e4e,'body':_0x221852[_0xd7b6('0x93')]};if(_0x221852[_0xd7b6('0xa6')]){_0xadf780[_0xd7b6('0xa6')]=_0x221852['headers'];if(_0xadf780[_0xd7b6('0xa6')][_0xd7b6('0xa7')]){delete _0xadf780[_0xd7b6('0xa6')][_0xd7b6('0xa7')];}}if(_0xadf780['headers']['content-type']){delete _0xadf780[_0xd7b6('0xa6')]['content-type'];}return rp(_0xadf780);})[_0xd7b6('0x2c')](function(_0xcc15){if(_0xcc15){_0x4704b9[_0xd7b6('0x28')](_0xcc15[_0xd7b6('0xa6')]);logger[_0xd7b6('0x69')](_0xcc15[_0xd7b6('0x93')]);return _0x4704b9['status'](_0xcc15[_0xd7b6('0xaa')])['send'](_0xcc15[_0xd7b6('0x93')]);}else{return _0x4704b9['sendStatus'](0xc8);}})[_0xd7b6('0x4d')](handleError(_0x4704b9,null));}; \ No newline at end of file +var _0x662b=['undefined','limit','count','Content-Range','json','reject','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','download','find','root','%s.zip','basename','path','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','join','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20name\x20missing','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','set','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','offset'];(function(_0x4fecef,_0x24ffc3){var _0x34d59b=function(_0x57fbfe){while(--_0x57fbfe){_0x4fecef['push'](_0x4fecef['shift']());}};_0x34d59b(++_0x24ffc3);}(_0x662b,0x8a));var _0xb662=function(_0x134bf1,_0x7a0e71){_0x134bf1=_0x134bf1-0x0;var _0x42a913=_0x662b[_0x134bf1];return _0x42a913;};'use strict';var emlformat=require(_0xb662('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb662('0x1'));var rp=require('request-promise');var moment=require(_0xb662('0x2'));var BPromise=require(_0xb662('0x3'));var Mustache=require(_0xb662('0x4'));var util=require(_0xb662('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb662('0x6'));var ejs=require(_0xb662('0x7'));var fs=require('fs');var fs_extra=require(_0xb662('0x8'));var _=require(_0xb662('0x9'));var squel=require(_0xb662('0xa'));var crypto=require(_0xb662('0xb'));var jsforce=require(_0xb662('0xc'));var deskjs=require(_0xb662('0xd'));var toCsv=require(_0xb662('0x6'));var querystring=require('querystring');var Papa=require(_0xb662('0xe'));var extract=require('extract-zip');var rimraf=require(_0xb662('0xf'));var archiver=require(_0xb662('0x10'));var Redis=require(_0xb662('0x11'));var authService=require(_0xb662('0x12'));var qs=require(_0xb662('0x13'));var as=require(_0xb662('0x14'));var hardwareService=require(_0xb662('0x15'));var logger=require('../../config/logger')(_0xb662('0x16'));var utils=require(_0xb662('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb662('0x18'));var db=require(_0xb662('0x19'))['db'];config[_0xb662('0x1a')]=_['defaults'](config[_0xb662('0x1a')],{'host':_0xb662('0x1b'),'port':0x18eb});var socket=require(_0xb662('0x1c'))(new Redis(config['redis']));require('./plugin.socket')[_0xb662('0x1d')](socket);function respondWithStatusCode(_0x252ca2,_0x163365){_0x163365=_0x163365||0xcc;return function(_0x135b79){if(_0x135b79){return _0x252ca2[_0xb662('0x1e')](_0x163365);}return _0x252ca2[_0xb662('0x1f')](_0x163365)['end']();};}function respondWithResult(_0x296ae4,_0x5543bf){_0x5543bf=_0x5543bf||0xc8;return function(_0x14efa9){if(_0x14efa9){return _0x296ae4[_0xb662('0x1f')](_0x5543bf)['json'](_0x14efa9);}};}function respondWithFilteredResult(_0x548a33,_0x2aa93a){return function(_0x3f2893){if(_0x3f2893){var _0xb6ec82=typeof _0x2aa93a[_0xb662('0x20')]===_0xb662('0x21')&&typeof _0x2aa93a[_0xb662('0x22')]==='undefined';var _0x3809a9=_0x3f2893[_0xb662('0x23')];var _0x5e23a8=_0xb6ec82?0x0:_0x2aa93a[_0xb662('0x20')];var _0x51f0f0=_0xb6ec82?_0x3f2893[_0xb662('0x23')]:_0x2aa93a[_0xb662('0x20')]+_0x2aa93a[_0xb662('0x22')];var _0x4c4eb0;if(_0x51f0f0>=_0x3809a9){_0x51f0f0=_0x3809a9;_0x4c4eb0=0xc8;}else{_0x4c4eb0=0xce;}_0x548a33[_0xb662('0x1f')](_0x4c4eb0);return _0x548a33['set'](_0xb662('0x24'),_0x5e23a8+'-'+_0x51f0f0+'/'+_0x3809a9)[_0xb662('0x25')](_0x3f2893);}return null;};}function patchUpdates(_0x3fb382){return function(_0x5a9cd){try{jsonpatch['apply'](_0x5a9cd,_0x3fb382,!![]);}catch(_0x5f31e5){return BPromise[_0xb662('0x26')](_0x5f31e5);}return _0x5a9cd[_0xb662('0x27')]();};}function saveUpdates(_0xd9a538,_0x21095a){return function(_0x475afa){if(_0x475afa){return _0x475afa[_0xb662('0x28')](_0xd9a538)[_0xb662('0x29')](function(_0x3aa418){return _0x3aa418;});}return null;};}function removeEntity(_0x1b7689,_0x582ee0){return function(_0x14946e){if(_0x14946e){return _0x14946e['destroy']()[_0xb662('0x29')](function(){var _0x36dc87=_0x14946e[_0xb662('0x2a')]({'plain':!![]});var _0x533c37=_0xb662('0x2b');return db[_0xb662('0x2c')][_0xb662('0x2d')]({'where':{'type':_0x533c37,'resourceId':_0x36dc87['id']}})[_0xb662('0x29')](function(){return _0x14946e;});})['then'](function(){_0x1b7689['status'](0xcc)[_0xb662('0x2e')]();});}};}function handleEntityNotFound(_0x4c5678,_0xa23dc2){return function(_0x950860){if(!_0x950860){_0x4c5678[_0xb662('0x1e')](0x194);}return _0x950860;};}function handleError(_0x4e9890,_0x2cb1a9){_0x2cb1a9=_0x2cb1a9||0x1f4;return function(_0x560203){logger[_0xb662('0x2f')](_0x560203[_0xb662('0x30')]);if(_0x560203[_0xb662('0x31')]){delete _0x560203['name'];}_0x4e9890[_0xb662('0x1f')](_0x2cb1a9)[_0xb662('0x32')](_0x560203);};}exports[_0xb662('0x33')]=function(_0x462a14,_0x2ab022){var _0x2c7a8d={},_0x28b5a1={},_0xca6ea0={'count':0x0,'rows':[]};var _0x1fbacf=_[_0xb662('0x34')](db[_0xb662('0x35')][_0xb662('0x36')],function(_0x299ee8){return{'name':_0x299ee8[_0xb662('0x37')],'type':_0x299ee8[_0xb662('0x38')][_0xb662('0x39')]};});_0x28b5a1[_0xb662('0x3a')]=_[_0xb662('0x34')](_0x1fbacf,_0xb662('0x31'));_0x28b5a1[_0xb662('0x3b')]=_[_0xb662('0x3c')](_0x462a14[_0xb662('0x3b')]);_0x28b5a1[_0xb662('0x3d')]=_[_0xb662('0x3e')](_0x28b5a1[_0xb662('0x3a')],_0x28b5a1[_0xb662('0x3b')]);_0x2c7a8d[_0xb662('0x3f')]=_[_0xb662('0x3e')](_0x28b5a1['model'],qs[_0xb662('0x40')](_0x462a14[_0xb662('0x3b')][_0xb662('0x40')]));_0x2c7a8d[_0xb662('0x3f')]=_0x2c7a8d[_0xb662('0x3f')][_0xb662('0x41')]?_0x2c7a8d[_0xb662('0x3f')]:_0x28b5a1[_0xb662('0x3a')];if(!_0x462a14[_0xb662('0x3b')][_0xb662('0x42')](_0xb662('0x43'))){_0x2c7a8d[_0xb662('0x22')]=qs[_0xb662('0x22')](_0x462a14['query']['limit']);_0x2c7a8d[_0xb662('0x20')]=qs[_0xb662('0x20')](_0x462a14[_0xb662('0x3b')]['offset']);}_0x2c7a8d['order']=qs[_0xb662('0x44')](_0x462a14[_0xb662('0x3b')][_0xb662('0x44')]);_0x2c7a8d[_0xb662('0x45')]=qs[_0xb662('0x3d')](_[_0xb662('0x46')](_0x462a14[_0xb662('0x3b')],_0x28b5a1[_0xb662('0x3d')]),_0x1fbacf);if(_0x462a14[_0xb662('0x3b')][_0xb662('0x47')]){_0x2c7a8d['where']=_[_0xb662('0x48')](_0x2c7a8d[_0xb662('0x45')],{'$or':_['map'](_0x1fbacf,function(_0x39c9a2){if(_0x39c9a2['type']!=='VIRTUAL'){var _0x454e78={};_0x454e78[_0x39c9a2['name']]={'$like':'%'+_0x462a14['query']['filter']+'%'};return _0x454e78;}})});}_0x2c7a8d=_[_0xb662('0x48')]({},_0x2c7a8d,_0x462a14[_0xb662('0x49')]);var _0x12ed79={'where':_0x2c7a8d['where']};return db['Plugin'][_0xb662('0x23')](_0x12ed79)['then'](function(_0x2643a3){_0xca6ea0[_0xb662('0x23')]=_0x2643a3;if(_0x462a14[_0xb662('0x3b')][_0xb662('0x4a')]){_0x2c7a8d[_0xb662('0x4b')]=[{'all':!![]}];}return db[_0xb662('0x35')][_0xb662('0x4c')](_0x2c7a8d);})[_0xb662('0x29')](function(_0x35c212){_0xca6ea0[_0xb662('0x4d')]=_0x35c212;return _0xca6ea0;})[_0xb662('0x29')](respondWithFilteredResult(_0x2ab022,_0x2c7a8d))[_0xb662('0x4e')](handleError(_0x2ab022,null));};exports[_0xb662('0x4f')]=function(_0x2a8ba2,_0x28349f){var _0x43e93d={'raw':!![],'where':{'id':_0x2a8ba2[_0xb662('0x50')]['id']}},_0x72a78d={};_0x72a78d['model']=_[_0xb662('0x3c')](db[_0xb662('0x35')][_0xb662('0x36')]);_0x72a78d[_0xb662('0x3b')]=_['keys'](_0x2a8ba2[_0xb662('0x3b')]);_0x72a78d['filters']=_[_0xb662('0x3e')](_0x72a78d['model'],_0x72a78d['query']);_0x43e93d[_0xb662('0x3f')]=_[_0xb662('0x3e')](_0x72a78d[_0xb662('0x3a')],qs[_0xb662('0x40')](_0x2a8ba2[_0xb662('0x3b')][_0xb662('0x40')]));_0x43e93d[_0xb662('0x3f')]=_0x43e93d[_0xb662('0x3f')][_0xb662('0x41')]?_0x43e93d[_0xb662('0x3f')]:_0x72a78d['model'];if(_0x2a8ba2[_0xb662('0x3b')][_0xb662('0x4a')]){_0x43e93d[_0xb662('0x4b')]=[{'all':!![]}];}_0x43e93d=_['merge']({},_0x43e93d,_0x2a8ba2[_0xb662('0x49')]);return db[_0xb662('0x35')]['find'](_0x43e93d)['then'](handleEntityNotFound(_0x28349f,null))[_0xb662('0x29')](respondWithResult(_0x28349f,null))[_0xb662('0x4e')](handleError(_0x28349f,null));};exports[_0xb662('0x51')]=function(_0x463c90,_0x49a99c,_0x2befab){return db['Plugin'][_0xb662('0x52')]({'where':{'id':_0x463c90[_0xb662('0x50')]['id']},'attributes':['name','path'],'raw':!![]})[_0xb662('0x29')](handleEntityNotFound(_0x49a99c,null))['then'](function(_0x335824){if(_0x335824){var _0x444e75=path['join'](config[_0xb662('0x53')],'server/files/plugins',util['format'](_0xb662('0x54'),path[_0xb662('0x55')](_0x335824[_0xb662('0x56')])));var _0x1940e5=fs[_0xb662('0x57')](_0x444e75);var _0x1b74b6=archiver(_0xb662('0x58'),{'zlib':{'level':0x9}});_0x1b74b6['on'](_0xb662('0x59'),function(_0x14fff5){if(_0x14fff5['code']===_0xb662('0x5a')){logger[_0xb662('0x2f')](_0x14fff5);}else{throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x5d'));}});_0x1b74b6['on']('error',function(_0x231852){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x5d'));});_0x1b74b6[_0xb662('0x5e')](_0x1940e5);_0x1b74b6[_0xb662('0x5f')](_0xb662('0x60'),{'cwd':path['join'](config[_0xb662('0x53')],_0xb662('0x61'),path[_0xb662('0x62')](_0x335824[_0xb662('0x56')])),'ignore':[path[_0xb662('0x63')](path[_0xb662('0x55')](_0x335824[_0xb662('0x56')]),_0xb662('0x64')),path[_0xb662('0x63')](path[_0xb662('0x55')](_0x335824['path']),_0xb662('0x65'))],'nodir':!![]})[_0xb662('0x66')]();_0x1940e5['on']('close',function(){if(!fs[_0xb662('0x67')](_0x444e75)){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x68'));}return _0x49a99c[_0xb662('0x51')](_0x444e75,util['format'](_0xb662('0x54'),path[_0xb662('0x55')](_0x335824[_0xb662('0x56')])),function(_0x58290f){if(_0x58290f){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x69'));}fs[_0xb662('0x6a')](_0x444e75);logger['info']('Download\x20completed');logger[_0xb662('0x6b')](_0xb662('0x6c'));});});}return null;})[_0xb662('0x4e')](handleError(_0x49a99c,null));};exports['upload']=function(_0x6910e7,_0x4893d0,_0x555033){var _0x7d7a14=path[_0xb662('0x55')](_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')],path['extname'](_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')]));var _0x1ab1eb=path['join'](config['root'],_0xb662('0x61'),_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')]);var _0x6a3c1e=path[_0xb662('0x63')](config[_0xb662('0x53')],'server/files/plugins',_0x7d7a14);logger[_0xb662('0x6b')](_0xb662('0x6f'),_0x1ab1eb);logger[_0xb662('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x6a3c1e);try{fs[_0xb662('0x70')](_0x1ab1eb,parseInt(_0xb662('0x71'),0x8));extract(_0x1ab1eb,{'dir':_0x6a3c1e},function(_0x28390c){if(_0x28390c){logger[_0xb662('0x2f')](_0x28390c);handleError(_0x28390c,!![]);};var _0x38b100=fs[_0xb662('0x72')](_0x6a3c1e);if(_0x38b100['length']>0x1){removeReferences(_0x1ab1eb,_0x6a3c1e);logger[_0xb662('0x2f')](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}var _0x40c6f4=fs['lstatSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0]));if(_0x40c6f4[_0xb662('0x74')]()){removeReferences(_0x1ab1eb,_0x6a3c1e);logger['error'](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}if(_0x40c6f4[_0xb662('0x75')]()){var _0x2a5b58=fs['readdirSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0]));if(_0x2a5b58['length']===0x0){removeReferences(_0x1ab1eb,_0x6a3c1e);logger[_0xb662('0x2f')](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}var _0x3f06bb=_0x2a5b58[_0xb662('0x76')](function(_0x12696a){return _0x12696a==='manifest.json';});if(!_0x3f06bb){return _0x555033(new Error(_0xb662('0x77')));}var _0x2af4e2=fs['readFileSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0],_0xb662('0x78')));var _0x1bb1ee=JSON['parse'](_0x2af4e2);if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x31')]){return _0x555033(new Error(_0xb662('0x79')));}if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x38')]){return _0x555033(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb662('0x21')==typeof _0x1bb1ee['version']){return _0x555033(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')]){return _0x555033(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1bb1ee[_0xb662('0x38')]===_0xb662('0x7b')){if(_0xb662('0x21')==typeof _0x1bb1ee['parameters'][_0xb662('0x7c')]){return _0x555033(new Error(_0xb662('0x7d')));}if('undefined'==typeof _0x1bb1ee['parameters'][_0xb662('0x7c')][_0xb662('0x7e')]&&_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')]['agent']){return _0x555033(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1bb1ee[_0xb662('0x38')]===_0xb662('0x7f')){if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x80')]){return _0x555033(new Error(_0xb662('0x81')));}if(_0xb662('0x21')==typeof _0x1bb1ee['parameters'][_0xb662('0x82')]){return _0x555033(new Error(_0xb662('0x83')));}}else{return _0x555033(new Error(_0xb662('0x84')));}var _0x1265e3=_0x1bb1ee[_0xb662('0x31')];var _0x37547e=_0x1bb1ee[_0xb662('0x85')];var _0x73476b=_0x1bb1ee[_0xb662('0x38')];var _0x2afa81=_0x1bb1ee[_0xb662('0x86')]?_0x1bb1ee[_0xb662('0x86')]:_0xb662('0x87');var _0x29ddf5=_0x1bb1ee[_0xb662('0x88')]?_0x1bb1ee[_0xb662('0x88')]:_0xb662('0x89');var _0x4cbefb='';var _0x4188aa='';var _0x5c50ff='';var _0x5cc6e0='';var _0x2f1521=_0x1bb1ee[_0xb662('0x8a')];if(_0x73476b==='html'){if(_0xb662('0x21')!=typeof _0x1bb1ee[_0xb662('0x7a')]['views'][_0xb662('0x7e')]){var _0x3066cd=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3066cd)){_0x4cbefb=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3066cd);}else{_0x4cbefb=_0x3066cd;}}else{logger['info'](_0xb662('0x8c'));}if('undefined'!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x8d')]){var _0x3719e1=_0x1bb1ee['parameters']['views'][_0xb662('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xb662('0x8e')](_0x3719e1)){_0x4188aa=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3719e1);}else{_0x4188aa=_0x3719e1;}}else{logger['info'](_0xb662('0x8f'));}}else if(_0x73476b==='script'){_0x5c50ff=_0x1bb1ee['parameters'][_0xb662('0x80')];_0x5cc6e0=_0x1bb1ee['parameters'][_0xb662('0x82')];if('undefined'!=typeof _0x1bb1ee['parameters']['views']){if('undefined'!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')]){var _0x3066cd=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xb662('0x8e')](_0x3066cd)){_0x4cbefb=path[_0xb662('0x63')]('plugins',_0x7d7a14,_0x38b100[0x0],_0x3066cd);}else{_0x4cbefb=_0x3066cd;}}if(_0xb662('0x21')!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')]['agent']){var _0x3719e1=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3719e1)){_0x4188aa=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3719e1);}else{_0x4188aa=_0x3719e1;}}}}var _0x27ff5a={'name':_0x1265e3,'description':_0x37547e,'path':path[_0xb662('0x63')](_0x7d7a14,_0x38b100[0x0]),'type':_0x73476b,'sidebar':_0x2afa81,'icon':_0x29ddf5,'adminUrl':_0x4cbefb,'agentUrl':_0x4188aa,'scriptName':_0x5c50ff,'scriptPath':_0x5cc6e0,'version':_0x2f1521};removeReferences(_0x1ab1eb,null);return db[_0xb662('0x35')][_0xb662('0x90')](_0x27ff5a)[_0xb662('0x29')](function(_0x394ae4){var _0x233008={'role':_0x6910e7['body'][_0xb662('0x91')],'userProfileId':_0x6910e7[_0xb662('0x92')][_0xb662('0x93')]};if(!_0x233008)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x233008['role']===_0xb662('0x94')){var _0x22ac34=_0x394ae4[_0xb662('0x2a')]({'plain':!![]});return db[_0xb662('0x95')]['find']({'where':{'name':_0xb662('0x2b'),'userProfileId':_0x233008[_0xb662('0x93')]},'raw':!![]})['then'](function(_0x53b075){if(_0x53b075&&_0x53b075[_0xb662('0x96')]===0x0){return db['UserProfileResource'][_0xb662('0x90')]({'name':_0x22ac34[_0xb662('0x31')],'resourceId':_0x22ac34['id'],'type':_0x53b075[_0xb662('0x31')],'sectionId':_0x53b075['id']},{})[_0xb662('0x29')](function(){return _0x394ae4;});}else{return _0x394ae4;}})['catch'](function(_0x568cc8){logger[_0xb662('0x2f')](_0xb662('0x97'),_0x568cc8);throw _0x568cc8;});}return _0x394ae4;})['then'](respondWithResult(_0x4893d0,null))[_0xb662('0x4e')](handleError(_0x4893d0,null));}});}catch(_0x37c121){_0x4893d0[_0xb662('0x1f')](0x1f4)[_0xb662('0x32')](_0x37c121);}};function removeReferences(_0x116b3b,_0x3e5ef0){try{if(_0x116b3b){fs['unlinkSync'](_0x116b3b);logger[_0xb662('0x6b')](_0xb662('0x98'));}if(_0x3e5ef0){rimraf(_0x3e5ef0,function(){});logger[_0xb662('0x6b')](_0xb662('0x99'));}}catch(_0x442f5e){logger[_0xb662('0x2f')](_0x442f5e);}}exports['update']=function(_0x38cbac,_0x45a6a5,_0x310fe2){return db[_0xb662('0x35')]['find']({'where':{'id':_0x38cbac[_0xb662('0x50')]['id']}})['then'](handleEntityNotFound(_0x45a6a5,null))[_0xb662('0x29')](saveUpdates(_0x38cbac[_0xb662('0x92')],null))[_0xb662('0x29')](respondWithResult(_0x45a6a5,null))[_0xb662('0x4e')](handleError(_0x45a6a5,null));};exports[_0xb662('0x9a')]=function(_0x310fd0,_0xeafe05,_0x4d9bcd){return db[_0xb662('0x35')][_0xb662('0x52')]({'where':{'id':_0x310fd0['params']['id']}})['then'](function(_0x350add){if(_0x350add){return _0x350add[_0xb662('0x2d')]();}})[_0xb662('0x29')](function(_0x4bb817){rimraf(path[_0xb662('0x63')](config[_0xb662('0x53')],_0xb662('0x61'),path[_0xb662('0x62')](_0x4bb817[_0xb662('0x56')])),function(){});return _0x4bb817;})[_0xb662('0x29')](handleEntityNotFound(_0xeafe05,null))[_0xb662('0x29')](respondWithStatusCode(_0xeafe05,null))[_0xb662('0x4e')](handleError(_0xeafe05,null));};exports[_0xb662('0x9b')]=function(_0x1cf790,_0x1d8e01,_0x215281){return BPromise[_0xb662('0x9c')]()[_0xb662('0x29')](function(){if(!_0x1cf790['query'][_0xb662('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1cf790[_0xb662('0x3b')][_0xb662('0x9d')]){throw new Error(_0xb662('0x9e'));}var _0x45ba3b=_0x1cf790[_0xb662('0x3b')][_0xb662('0x9f')]?_0x1cf790[_0xb662('0x3b')]['hostname']+':'+_0x1cf790[_0xb662('0x3b')]['port']:_0xb662('0xa0')+_0x1cf790[_0xb662('0x3b')][_0xb662('0x9d')];var _0x3efe17=_0x1cf790[_0xb662('0x3b')][_0xb662('0x25')]?_0x1cf790[_0xb662('0x3b')]['json']:!![];var _0x332653=_0x1cf790[_0xb662('0x3b')][_0xb662('0xa1')]?_0x1cf790[_0xb662('0x3b')][_0xb662('0xa1')]:null;var _0xef3832={'method':_0x1cf790['method'],'uri':util['format'](_0xb662('0xa2'),_0x45ba3b,_0x1cf790[_0xb662('0x3b')][_0xb662('0x56')]),'json':_0x3efe17,'resolveWithFullResponse':!![],'encoding':_0x332653,'qs':_0x1cf790[_0xb662('0x3b')]};if(_0x1cf790[_0xb662('0xa3')]){_0xef3832[_0xb662('0xa3')]=_0x1cf790[_0xb662('0xa3')];if(_0xef3832['headers'][_0xb662('0xa4')]){delete _0xef3832[_0xb662('0xa3')]['content-length'];}}if(_0xef3832[_0xb662('0xa3')][_0xb662('0xa5')]){delete _0xef3832[_0xb662('0xa3')][_0xb662('0xa5')];}return rp(_0xef3832);})[_0xb662('0x29')](function(_0x263ba3){if(_0x263ba3){_0x1d8e01['set'](_0x263ba3['headers']);logger[_0xb662('0x6b')](_0x263ba3[_0xb662('0x92')]);if(_[_0xb662('0xa6')](_0x1cf790['query'][_0xb662('0x56')],'download')&&_0x263ba3[_0xb662('0xa7')]==0x1f4){return _0x1d8e01['sendStatus'](_0x263ba3[_0xb662('0xa7')]);}else{return _0x1d8e01[_0xb662('0x1f')](_0x263ba3['statusCode'])[_0xb662('0x32')](_0x263ba3[_0xb662('0x92')]);}}else{return _0x1d8e01[_0xb662('0x1e')](0xc8);}})[_0xb662('0x4e')](handleError(_0x1d8e01,null));};exports[_0xb662('0xa8')]=function(_0x2ccc3b,_0x46d749,_0x3c9c4b){return BPromise[_0xb662('0x9c')]()[_0xb662('0x29')](function(){if(!_0x2ccc3b[_0xb662('0x3b')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2ccc3b[_0xb662('0x3b')]['port']){throw new Error(_0xb662('0x9e'));}var _0x1e6374=_0x2ccc3b['query'][_0xb662('0x9f')]?_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x9f')]+':'+_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x9d')]:_0xb662('0xa0')+_0x2ccc3b[_0xb662('0x3b')]['port'];var _0x3307f4=_0x2ccc3b[_0xb662('0x3b')]['json']?_0x2ccc3b[_0xb662('0x3b')]['json']:!![];var _0x10b99a=_0x2ccc3b[_0xb662('0x3b')][_0xb662('0xa1')]?_0x2ccc3b[_0xb662('0x3b')][_0xb662('0xa1')]:null;var _0x3ef667={'method':_0x2ccc3b[_0xb662('0xa9')],'uri':util['format']('%s%s',_0x1e6374,_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x56')]),'json':_0x3307f4,'resolveWithFullResponse':!![],'encoding':_0x10b99a,'body':_0x2ccc3b[_0xb662('0x92')]};if(_0x2ccc3b[_0xb662('0xa3')]){_0x3ef667[_0xb662('0xa3')]=_0x2ccc3b[_0xb662('0xa3')];if(_0x3ef667[_0xb662('0xa3')][_0xb662('0xa4')]){delete _0x3ef667[_0xb662('0xa3')][_0xb662('0xa4')];}}if(_0x3ef667[_0xb662('0xa3')][_0xb662('0xa5')]){delete _0x3ef667[_0xb662('0xa3')][_0xb662('0xa5')];}return rp(_0x3ef667);})[_0xb662('0x29')](function(_0x1fb24d){if(_0x1fb24d){_0x46d749[_0xb662('0xaa')](_0x1fb24d[_0xb662('0xa3')]);logger[_0xb662('0x6b')](_0x1fb24d[_0xb662('0x92')]);return _0x46d749[_0xb662('0x1f')](_0x1fb24d[_0xb662('0xa7')])[_0xb662('0x32')](_0x1fb24d['body']);}else{return _0x46d749[_0xb662('0x1e')](0xc8);}})[_0xb662('0x4e')](handleError(_0x46d749,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ff2ddd3..289a88a 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 _0xb5dd=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x495019,_0x3f7cff){var _0x40b37f=function(_0x45f07e){while(--_0x45f07e){_0x495019['push'](_0x495019['shift']());}};_0x40b37f(++_0x3f7cff);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5dd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdb5d('0x0'));var Plugin=require(_0xdb5d('0x1'))['db'][_0xdb5d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdb5d('0x3')](0x0);var events={'afterCreate':_0xdb5d('0x4'),'afterUpdate':'update','afterDestroy':_0xdb5d('0x5')};function emitEvent(_0x15a072){return function(_0x292af1,_0x5ba1dd,_0x477651){PluginEvents[_0xdb5d('0x6')](_0x15a072+':'+_0x292af1['id'],_0x292af1);PluginEvents[_0xdb5d('0x6')](_0x15a072,_0x292af1);_0x477651(null);};}for(var e in events){if(events[_0xdb5d('0x7')](e)){var event=events[e];Plugin[_0xdb5d('0x8')](e,emitEvent(event));}}module[_0xdb5d('0x9')]=PluginEvents; \ No newline at end of file +var _0x37cc=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c29f4,_0x3ba791){var _0x35596a=function(_0x53c6bf){while(--_0x53c6bf){_0x2c29f4['push'](_0x2c29f4['shift']());}};_0x35596a(++_0x3ba791);}(_0x37cc,0x185));var _0xc37c=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x37cc[_0x22b68a];return _0x1ac67a;};'use strict';var EventEmitter=require(_0xc37c('0x0'));var Plugin=require(_0xc37c('0x1'))['db'][_0xc37c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc37c('0x3')](0x0);var events={'afterCreate':_0xc37c('0x4'),'afterUpdate':_0xc37c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b158){return function(_0x334d3c,_0x946e3b,_0x310b02){PluginEvents[_0xc37c('0x6')](_0x55b158+':'+_0x334d3c['id'],_0x334d3c);PluginEvents[_0xc37c('0x6')](_0x55b158,_0x334d3c);_0x310b02(null);};}for(var e in events){if(events[_0xc37c('0x7')](e)){var event=events[e];Plugin[_0xc37c('0x8')](e,emitEvent(event));}}module[_0xc37c('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0c23711..948a718 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 _0xb205=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','moment','path'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0xb205,0x1bf));var _0x5b20=function(_0x253e76,_0x31c78f){_0x253e76=_0x253e76-0x0;var _0x26bacf=_0xb205[_0x253e76];return _0x26bacf;};'use strict';var _=require(_0x5b20('0x0'));var util=require('util');var logger=require(_0x5b20('0x1'))('api');var moment=require(_0x5b20('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x3'));var rimraf=require(_0x5b20('0x4'));var config=require(_0x5b20('0x5'));var attributes=require(_0x5b20('0x6'));module[_0x5b20('0x7')]=function(_0x240a92,_0x438b51){return _0x240a92[_0x5b20('0x8')](_0x5b20('0x9'),attributes,{'tableName':_0x5b20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc393=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin'];(function(_0x2b9e21,_0x14724c){var _0xe19250=function(_0x26c4b0){while(--_0x26c4b0){_0x2b9e21['push'](_0x2b9e21['shift']());}};_0xe19250(++_0x14724c);}(_0xc393,0xd3));var _0x3c39=function(_0x1e6d9a,_0x548cf2){_0x1e6d9a=_0x1e6d9a-0x0;var _0x59b4da=_0xc393[_0x1e6d9a];return _0x59b4da;};'use strict';var _=require(_0x3c39('0x0'));var util=require(_0x3c39('0x1'));var logger=require(_0x3c39('0x2'))(_0x3c39('0x3'));var moment=require(_0x3c39('0x4'));var BPromise=require(_0x3c39('0x5'));var rp=require(_0x3c39('0x6'));var fs=require('fs');var path=require(_0x3c39('0x7'));var rimraf=require(_0x3c39('0x8'));var config=require(_0x3c39('0x9'));var attributes=require(_0x3c39('0xa'));module['exports']=function(_0x26842f,_0xfd74f3){return _0x26842f[_0x3c39('0xb')](_0x3c39('0xc'),attributes,{'tableName':_0x3c39('0xd'),'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 a3e6e70..a74e2dc 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 _0x39ce=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin'];(function(_0x3af583,_0x42d9c8){var _0x4049a3=function(_0x49e4e3){while(--_0x49e4e3){_0x3af583['push'](_0x3af583['shift']());}};_0x4049a3(++_0x42d9c8);}(_0x39ce,0x162));var _0xe39c=function(_0x2ec43a,_0x41d3f7){_0x2ec43a=_0x2ec43a-0x0;var _0x2a0b8b=_0x39ce[_0x2ec43a];return _0x2a0b8b;};'use strict';var _=require('lodash');var util=require(_0xe39c('0x0'));var moment=require(_0xe39c('0x1'));var BPromise=require(_0xe39c('0x2'));var rs=require(_0xe39c('0x3'));var fs=require('fs');var Redis=require(_0xe39c('0x4'));var db=require(_0xe39c('0x5'))['db'];var utils=require(_0xe39c('0x6'));var logger=require(_0xe39c('0x7'))(_0xe39c('0x8'));var config=require(_0xe39c('0x9'));var jayson=require(_0xe39c('0xa'));var client=jayson[_0xe39c('0xb')][_0xe39c('0xc')]({'port':0x232a});config[_0xe39c('0xd')]=_[_0xe39c('0xe')](config[_0xe39c('0xd')],{'host':_0xe39c('0xf'),'port':0x18eb});var socket=require(_0xe39c('0x10'))(new Redis(config['redis']));require(_0xe39c('0x11'))[_0xe39c('0x12')](socket);function respondWithRpcPromise(_0x35834c,_0x312003,_0x5333ab){return new BPromise(function(_0x1baba5,_0x215630){return client[_0xe39c('0x13')](_0x35834c,_0x5333ab)[_0xe39c('0x14')](function(_0x4dccc7){logger[_0xe39c('0x15')](_0xe39c('0x16'),_0x312003,_0xe39c('0x17'));logger[_0xe39c('0x18')]('Plugin,\x20%s,\x20%s,\x20%s',_0x312003,'request\x20sent',JSON[_0xe39c('0x19')](_0x4dccc7));if(_0x4dccc7[_0xe39c('0x1a')]){if(_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1b')]===0x1f4){logger[_0xe39c('0x1a')]('Plugin,\x20%s,\x20%s',_0x312003,_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1c')]);return _0x215630(_0x4dccc7['error'][_0xe39c('0x1c')]);}logger[_0xe39c('0x1a')](_0xe39c('0x16'),_0x312003,_0x4dccc7[_0xe39c('0x1a')]['message']);return _0x1baba5(_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1c')]);}else{logger[_0xe39c('0x15')](_0xe39c('0x16'),_0x312003,_0xe39c('0x17'));_0x1baba5(_0x4dccc7['result']['message']);}})[_0xe39c('0x1d')](function(_0x1b9793){logger[_0xe39c('0x1a')](_0xe39c('0x16'),_0x312003,_0x1b9793);_0x215630(_0x1b9793);});});}exports[_0xe39c('0x1e')]=function(_0x284688){var _0xae96d6=this;return new Promise(function(_0x1695fd,_0x1cd959){return db['Plugin'][_0xe39c('0x1f')](_0x284688[_0xe39c('0x20')],{'raw':_0x284688[_0xe39c('0x21')]?_0x284688['options'][_0xe39c('0x22')]===undefined?!![]:![]:!![]})[_0xe39c('0x14')](function(_0x4ab0d5){logger['info'](_0xe39c('0x1e'),_0x284688);logger[_0xe39c('0x18')](_0xe39c('0x1e'),_0x284688,JSON[_0xe39c('0x19')](_0x4ab0d5));_0x1695fd(_0x4ab0d5);})[_0xe39c('0x1d')](function(_0x49a004){logger[_0xe39c('0x1a')](_0xe39c('0x1e'),_0x49a004[_0xe39c('0x1c')],_0x284688);_0x1cd959(_0xae96d6[_0xe39c('0x1a')](0x1f4,_0x49a004[_0xe39c('0x1c')]));});});}; \ No newline at end of file +var _0x8c5c=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreatePlugin','body','options','then','debug','catch','util'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x8c5c,0x7f));var _0xc8c5=function(_0x16e7ad,_0x66e047){_0x16e7ad=_0x16e7ad-0x0;var _0x184e69=_0x8c5c[_0x16e7ad];return _0x184e69;};'use strict';var _=require('lodash');var util=require(_0xc8c5('0x0'));var moment=require('moment');var BPromise=require(_0xc8c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8c5('0x2'));var db=require(_0xc8c5('0x3'))['db'];var utils=require(_0xc8c5('0x4'));var logger=require('../../config/logger')(_0xc8c5('0x5'));var config=require(_0xc8c5('0x6'));var jayson=require(_0xc8c5('0x7'));var client=jayson[_0xc8c5('0x8')][_0xc8c5('0x9')]({'port':0x232a});config[_0xc8c5('0xa')]=_[_0xc8c5('0xb')](config['redis'],{'host':_0xc8c5('0xc'),'port':0x18eb});var socket=require(_0xc8c5('0xd'))(new Redis(config[_0xc8c5('0xa')]));require(_0xc8c5('0xe'))[_0xc8c5('0xf')](socket);function respondWithRpcPromise(_0x2446b4,_0x3b4534,_0x3aea27){return new BPromise(function(_0xbc58be,_0x59f2c5){return client[_0xc8c5('0x10')](_0x2446b4,_0x3aea27)['then'](function(_0x2b691a){logger[_0xc8c5('0x11')](_0xc8c5('0x12'),_0x3b4534,'request\x20sent');logger['debug'](_0xc8c5('0x13'),_0x3b4534,_0xc8c5('0x14'),JSON[_0xc8c5('0x15')](_0x2b691a));if(_0x2b691a[_0xc8c5('0x16')]){if(_0x2b691a[_0xc8c5('0x16')][_0xc8c5('0x17')]===0x1f4){logger[_0xc8c5('0x16')](_0xc8c5('0x12'),_0x3b4534,_0x2b691a['error'][_0xc8c5('0x18')]);return _0x59f2c5(_0x2b691a['error'][_0xc8c5('0x18')]);}logger[_0xc8c5('0x16')](_0xc8c5('0x12'),_0x3b4534,_0x2b691a[_0xc8c5('0x16')]['message']);return _0xbc58be(_0x2b691a[_0xc8c5('0x16')][_0xc8c5('0x18')]);}else{logger[_0xc8c5('0x11')](_0xc8c5('0x12'),_0x3b4534,_0xc8c5('0x14'));_0xbc58be(_0x2b691a[_0xc8c5('0x19')][_0xc8c5('0x18')]);}})['catch'](function(_0x3d1fb7){logger['error'](_0xc8c5('0x12'),_0x3b4534,_0x3d1fb7);_0x59f2c5(_0x3d1fb7);});});}exports[_0xc8c5('0x1a')]=function(_0x52148d){var _0x2a2d91=this;return new Promise(function(_0x5b9d43,_0x447bee){return db['Plugin']['create'](_0x52148d[_0xc8c5('0x1b')],{'raw':_0x52148d[_0xc8c5('0x1c')]?_0x52148d[_0xc8c5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc8c5('0x1d')](function(_0x597063){logger[_0xc8c5('0x11')](_0xc8c5('0x1a'),_0x52148d);logger[_0xc8c5('0x1e')](_0xc8c5('0x1a'),_0x52148d,JSON[_0xc8c5('0x15')](_0x597063));_0x5b9d43(_0x597063);})[_0xc8c5('0x1f')](function(_0x5b18e0){logger[_0xc8c5('0x16')](_0xc8c5('0x1a'),_0x5b18e0['message'],_0x52148d);_0x447bee(_0x2a2d91[_0xc8c5('0x16')](0x1f4,_0x5b18e0[_0xc8c5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4476f65..3ce1723 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 _0xea07=['save','remove','update','emit','register','length','plugin:'];(function(_0x309b15,_0x47068a){var _0xdab7b0=function(_0x3f75e3){while(--_0x3f75e3){_0x309b15['push'](_0x309b15['shift']());}};_0xdab7b0(++_0x47068a);}(_0xea07,0x70));var _0x7ea0=function(_0x516307,_0x14fcd4){_0x516307=_0x516307-0x0;var _0x444430=_0xea07[_0x516307];return _0x444430;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x7ea0('0x0'),_0x7ea0('0x1'),_0x7ea0('0x2')];function createListener(_0x404586,_0x42d52f){return function(_0xfcf2de){_0x42d52f[_0x7ea0('0x3')](_0x404586,_0xfcf2de);};}function removeListener(_0x437514,_0x18cf8a){return function(){PluginEvents['removeListener'](_0x437514,_0x18cf8a);};}exports[_0x7ea0('0x4')]=function(_0x657783){for(var _0x278441=0x0,_0xc06ed5=events[_0x7ea0('0x5')];_0x278441<_0xc06ed5;_0x278441++){var _0x13b11c=events[_0x278441];var _0x55501f=createListener(_0x7ea0('0x6')+_0x13b11c,_0x657783);PluginEvents['on'](_0x13b11c,_0x55501f);}}; \ No newline at end of file +var _0x94e0=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x40368e,_0x458699){var _0x4e004e=function(_0x1db306){while(--_0x1db306){_0x40368e['push'](_0x40368e['shift']());}};_0x4e004e(++_0x458699);}(_0x94e0,0xa5));var _0x094e=function(_0x2da8e3,_0x397415){_0x2da8e3=_0x2da8e3-0x0;var _0x281fd5=_0x94e0[_0x2da8e3];return _0x281fd5;};'use strict';var PluginEvents=require(_0x094e('0x0'));var events=[_0x094e('0x1'),_0x094e('0x2'),'update'];function createListener(_0x3e00c8,_0x2edb4a){return function(_0x2acf00){_0x2edb4a[_0x094e('0x3')](_0x3e00c8,_0x2acf00);};}function removeListener(_0x3aa15f,_0x1c09ed){return function(){PluginEvents[_0x094e('0x4')](_0x3aa15f,_0x1c09ed);};}exports[_0x094e('0x5')]=function(_0x336027){for(var _0x46b93a=0x0,_0x17a813=events[_0x094e('0x6')];_0x46b93a<_0x17a813;_0x46b93a++){var _0x4c4a32=events[_0x46b93a];var _0x5ce6d9=createListener(_0x094e('0x7')+_0x4c4a32,_0x336027);PluginEvents['on'](_0x4c4a32,_0x5ce6d9);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 082ba58..b103e71 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x139f6a,_0x2e6f1e){var _0x8f32c0=function(_0x18e274){while(--_0x18e274){_0x139f6a['push'](_0x139f6a['shift']());}};_0x8f32c0(++_0x2e6f1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x16fa08,_0x5b2061){var _0x27a8ca=function(_0x2fcea7){while(--_0x2fcea7){_0x16fa08['push'](_0x16fa08['shift']());}};_0x27a8ca(++_0x5b2061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 071d1ab..07ddf4c 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 _0xc874=['Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','list','then','reject','express','motion2','length','show','params','catch','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x15dfcd,_0xb5cdb7){var _0x906363=function(_0x34d43b){while(--_0x34d43b){_0x15dfcd['push'](_0x15dfcd['shift']());}};_0x906363(++_0xb5cdb7);}(_0xc874,0x154));var _0x4c87=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xc874[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x4c87('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var path=require('path');var exec=require('child_process')[_0x4c87('0x3')];var BPromise=require(_0x4c87('0x4'));function handleEntityNotFound(_0x1c3dbc,_0x575a7c){return function(_0x3fbf14){if(!_0x3fbf14){_0x1c3dbc[_0x4c87('0x5')](0x194);;}return _0x3fbf14;};}function respondWithResult(_0x5d63ae,_0x46e0f5){_0x46e0f5=_0x46e0f5||0xc8;return function(_0x3dafe0){if(_0x3dafe0){return _0x5d63ae[_0x4c87('0x6')](_0x46e0f5)[_0x4c87('0x7')](_0x3dafe0);}return null;};}function handleError(_0x116649,_0x5b7720){_0x5b7720=_0x5b7720||0x1f4;return function(_0x1e0897){logger['error'](_0x1e0897[_0x4c87('0x8')]);if(_0x1e0897[_0x4c87('0x9')]){delete _0x1e0897[_0x4c87('0x9')];}_0x116649[_0x4c87('0x6')](_0x5b7720)[_0x4c87('0xa')](_0x1e0897);};}function execChildProcess(){return new BPromise(function(_0x548e1a,_0x1fcc99){exec(_0x4c87('0xb'),function(_0x527917,_0x20240a,_0x19bcbf){logger[_0x4c87('0xc')](_0x20240a);logger[_0x4c87('0xc')](_0x19bcbf);if(_0x527917){logger[_0x4c87('0xd')](_0x527917);return _0x1fcc99(_0x527917);}return _0x548e1a(_0x20240a);});});}exports['index']=function(_0x50c90c,_0x4826cb){return pm2[_0x4c87('0xe')]()[_0x4c87('0xf')](function(_0x2c66bc){if(_0x2c66bc){var _0x3f1cc5=_[_0x4c87('0x10')](_0x2c66bc,function(_0x453274){return _0x453274[_0x4c87('0x9')]===_0x4c87('0x11')||_0x453274['name']===_0x4c87('0x12');});return{'rows':_0x3f1cc5,'count':_0x3f1cc5[_0x4c87('0x13')]};}return null;})['then'](respondWithResult(_0x4826cb,null))['catch'](handleError(_0x4826cb,null));};exports[_0x4c87('0x14')]=function(_0x8cebb9,_0x2b55fa){return pm2['describe'](_0x8cebb9[_0x4c87('0x15')]['id'])['then'](respondWithResult(_0x2b55fa,null))[_0x4c87('0xf')](handleEntityNotFound(_0x2b55fa,null))[_0x4c87('0x16')](handleError(_0x2b55fa,null));};exports[_0x4c87('0x17')]=function(_0x22f775,_0x4f6514){if(_0x22f775[_0x4c87('0x18')][_0x4c87('0x9')]&&_0x22f775[_0x4c87('0x18')][_0x4c87('0x19')]){var _0xa4baa7=path[_0x4c87('0x1a')](__dirname,_0x4c87('0x1b'),_0x22f775[_0x4c87('0x18')]['script']);var _0x353ac9=process[_0x4c87('0x1c')]();process['chdir'](path[_0x4c87('0x1d')](_0xa4baa7));return execChildProcess()[_0x4c87('0xf')](function(_0x5a9496){process[_0x4c87('0x1e')](_0x353ac9);return pm2[_0x4c87('0x1f')]({'name':_0x22f775[_0x4c87('0x18')][_0x4c87('0x9')],'script':_0xa4baa7});})['then'](function(_0x4735f2){pm2[_0x4c87('0x20')]();return _0x4735f2[0x0];})[_0x4c87('0xf')](respondWithResult(_0x4f6514,0xc9))[_0x4c87('0x16')](handleError(_0x4f6514,null));}else{return _0x4f6514[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x21')});}};exports[_0x4c87('0x22')]=function(_0x4ca5fb,_0x4ecad3){if(_0x4ca5fb['body']['id']){delete _0x4ca5fb[_0x4c87('0x18')]['id'];}var _0x381af7={'online':_0x4c87('0x23'),'stopped':_0x4c87('0x24')};if(_0x381af7[_0x4c87('0x25')](_0x4ca5fb[_0x4c87('0x18')]['status'])){return pm2[_0x381af7[_0x4ca5fb[_0x4c87('0x18')][_0x4c87('0x6')]]](_0x4ca5fb[_0x4c87('0x15')]['id'])[_0x4c87('0xf')](respondWithResult(_0x4ecad3,0xc8))[_0x4c87('0x16')](handleError(_0x4ecad3,null));}else{return _0x4ecad3[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x26')});}};exports[_0x4c87('0x27')]=function(_0x2de21a,_0x41468f){if(_0x2de21a[_0x4c87('0x18')]['id']){delete _0x2de21a[_0x4c87('0x18')]['id'];}if(_0x2de21a[_0x4c87('0x15')]['id']){return pm2[_0x4c87('0x28')](_0x2de21a[_0x4c87('0x15')]['id'])['then'](function(_0xd4a2af){pm2['dump']();return _0xd4a2af[0x0];})[_0x4c87('0xf')](respondWithResult(_0x41468f,null))['catch'](handleError(_0x41468f,null));}else{return _0x41468f[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x29')});}}; \ No newline at end of file +var _0x70e0=['dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','json','error','stack','name','send','npm\x20install','info','index','list','reject','motion2','length','then','describe','params','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start'];(function(_0x1b1c4f,_0x32eb9c){var _0x3f02c1=function(_0x180c82){while(--_0x180c82){_0x1b1c4f['push'](_0x1b1c4f['shift']());}};_0x3f02c1(++_0x32eb9c);}(_0x70e0,0x17b));var _0x070e=function(_0x484227,_0x4780ae){_0x484227=_0x484227-0x0;var _0xa19abe=_0x70e0[_0x484227];return _0xa19abe;};'use strict';var _=require(_0x070e('0x0'));var pm2=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var path=require('path');var exec=require(_0x070e('0x3'))[_0x070e('0x4')];var BPromise=require(_0x070e('0x5'));function handleEntityNotFound(_0x2593e5,_0x5c90fc){return function(_0x7bce9b){if(!_0x7bce9b){_0x2593e5['sendStatus'](0x194);;}return _0x7bce9b;};}function respondWithResult(_0x46fe68,_0x4b041d){_0x4b041d=_0x4b041d||0xc8;return function(_0x56e420){if(_0x56e420){return _0x46fe68['status'](_0x4b041d)[_0x070e('0x6')](_0x56e420);}return null;};}function handleError(_0x1e11f0,_0x604664){_0x604664=_0x604664||0x1f4;return function(_0x2611e6){logger[_0x070e('0x7')](_0x2611e6[_0x070e('0x8')]);if(_0x2611e6[_0x070e('0x9')]){delete _0x2611e6['name'];}_0x1e11f0['status'](_0x604664)[_0x070e('0xa')](_0x2611e6);};}function execChildProcess(){return new BPromise(function(_0x2e3e5e,_0x12bb37){exec(_0x070e('0xb'),function(_0xa927a2,_0xffcdd6,_0x25cfe1){logger[_0x070e('0xc')](_0xffcdd6);logger[_0x070e('0xc')](_0x25cfe1);if(_0xa927a2){logger[_0x070e('0x7')](_0xa927a2);return _0x12bb37(_0xa927a2);}return _0x2e3e5e(_0xffcdd6);});});}exports[_0x070e('0xd')]=function(_0x52da3b,_0x5dca0f){return pm2[_0x070e('0xe')]()['then'](function(_0x4a33d2){if(_0x4a33d2){var _0x5bae0f=_[_0x070e('0xf')](_0x4a33d2,function(_0x14c3fd){return _0x14c3fd['name']==='express'||_0x14c3fd[_0x070e('0x9')]===_0x070e('0x10');});return{'rows':_0x5bae0f,'count':_0x5bae0f[_0x070e('0x11')]};}return null;})[_0x070e('0x12')](respondWithResult(_0x5dca0f,null))['catch'](handleError(_0x5dca0f,null));};exports['show']=function(_0x17e2e4,_0x2bd937){return pm2[_0x070e('0x13')](_0x17e2e4[_0x070e('0x14')]['id'])[_0x070e('0x12')](respondWithResult(_0x2bd937,null))['then'](handleEntityNotFound(_0x2bd937,null))[_0x070e('0x15')](handleError(_0x2bd937,null));};exports[_0x070e('0x16')]=function(_0x1ad3de,_0x3ea105){if(_0x1ad3de[_0x070e('0x17')]['name']&&_0x1ad3de['body']['script']){var _0x9907cf=path[_0x070e('0x18')](__dirname,_0x070e('0x19'),_0x1ad3de['body'][_0x070e('0x1a')]);var _0x5dc5d2=process[_0x070e('0x1b')]();process[_0x070e('0x1c')](path[_0x070e('0x1d')](_0x9907cf));return execChildProcess()[_0x070e('0x12')](function(_0x28a1c3){process[_0x070e('0x1c')](_0x5dc5d2);return pm2[_0x070e('0x1e')]({'name':_0x1ad3de[_0x070e('0x17')]['name'],'script':_0x9907cf});})[_0x070e('0x12')](function(_0x270061){pm2[_0x070e('0x1f')]();return _0x270061[0x0];})['then'](respondWithResult(_0x3ea105,0xc9))[_0x070e('0x15')](handleError(_0x3ea105,null));}else{return _0x3ea105['status'](0x1f4)['send']({'message':_0x070e('0x20')});}};exports[_0x070e('0x21')]=function(_0x41deb1,_0x1743cc){if(_0x41deb1[_0x070e('0x17')]['id']){delete _0x41deb1['body']['id'];}var _0x374c54={'online':_0x070e('0x22'),'stopped':_0x070e('0x23')};if(_0x374c54[_0x070e('0x24')](_0x41deb1[_0x070e('0x17')][_0x070e('0x25')])){return pm2[_0x374c54[_0x41deb1[_0x070e('0x17')][_0x070e('0x25')]]](_0x41deb1['params']['id'])[_0x070e('0x12')](respondWithResult(_0x1743cc,0xc8))[_0x070e('0x15')](handleError(_0x1743cc,null));}else{return _0x1743cc[_0x070e('0x25')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x070e('0x26')]=function(_0x46065c,_0xa6c0ab){if(_0x46065c['body']['id']){delete _0x46065c[_0x070e('0x17')]['id'];}if(_0x46065c[_0x070e('0x14')]['id']){return pm2[_0x070e('0x27')](_0x46065c[_0x070e('0x14')]['id'])['then'](function(_0x5bf522){pm2['dump']();return _0x5bf522[0x0];})['then'](respondWithResult(_0xa6c0ab,null))[_0x070e('0x15')](handleError(_0xa6c0ab,null));}else{return _0xa6c0ab['status'](0x1f4)[_0x070e('0xa')]({'message':_0x070e('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d75bcee..a9cafa4 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2e5=['getAgents','isAuthenticated','getQueues','exports','Router','../../components/auth/service','get','/agents'];(function(_0x41c203,_0x158a40){var _0x2f3eb5=function(_0x47f4bd){while(--_0x47f4bd){_0x41c203['push'](_0x41c203['shift']());}};_0x2f3eb5(++_0x158a40);}(_0xe2e5,0x1ac));var _0x5e2e=function(_0x46b85e,_0x4be12a){_0x46b85e=_0x46b85e-0x0;var _0x467dc1=_0xe2e5[_0x46b85e];return _0x467dc1;};'use strict';var express=require('express');var router=express[_0x5e2e('0x0')]();var auth=require(_0x5e2e('0x1'));var controller=require('./realtime.controller');router[_0x5e2e('0x2')](_0x5e2e('0x3'),auth['isAuthenticated'](),controller[_0x5e2e('0x4')]);router[_0x5e2e('0x2')]('/queues',auth[_0x5e2e('0x5')](),controller[_0x5e2e('0x6')]);module[_0x5e2e('0x7')]=router; \ No newline at end of file +var _0x24b6=['get','/agents','isAuthenticated','getAgents','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x22e231,_0x453380){var _0x3e89f5=function(_0x5141fb){while(--_0x5141fb){_0x22e231['push'](_0x22e231['shift']());}};_0x3e89f5(++_0x453380);}(_0x24b6,0xde));var _0x624b=function(_0x274bcb,_0x2bd5a6){_0x274bcb=_0x274bcb-0x0;var _0x3497c6=_0x24b6[_0x274bcb];return _0x3497c6;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x624b('0x0'));var controller=require(_0x624b('0x1'));router[_0x624b('0x2')](_0x624b('0x3'),auth[_0x624b('0x4')](),controller[_0x624b('0x5')]);router['get']('/queues',auth[_0x624b('0x4')](),controller[_0x624b('0x6')]);module[_0x624b('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index c67a209..6a50f95 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2528=['set','Content-Range','json','getChannels','query','globalStatusFilter','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','getAgentIdsByQueues','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','push','sequelize','FIELD(id,','order','Pause','forEach','where','merge','user','Agents','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','pause','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','getQueues','startCase','Queue','name','voice','type','outbound','dialActive','dialMethod','fields','join','userProfileId','QueueCampaigns','Queues','filter','getRealtimeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2528,0xfb));var _0x8252=function(_0x4aa5a6,_0xade936){_0x4aa5a6=_0x4aa5a6-0x0;var _0x16f091=_0x2528[_0x4aa5a6];return _0x16f091;};'use strict';var _=require('lodash');var util=require(_0x8252('0x0'));var rta=require(_0x8252('0x1'));var rtq=require(_0x8252('0x2'));var qs=require(_0x8252('0x3'));var utils=require(_0x8252('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x8252('0x5'))[_0x8252('0x6')];var APIHandleError=require('../../errors/api')[_0x8252('0x7')];function respondWithFilteredResult(_0xe76807,_0x5ddd69){return function(_0x3cb827){if(_0x3cb827){var _0x2bf57e=typeof _0x5ddd69[_0x8252('0x8')]==='undefined'&&typeof _0x5ddd69[_0x8252('0x9')]===_0x8252('0xa');var _0x293232=_0x3cb827[_0x8252('0xb')];var _0x157069=_0x2bf57e?0x0:_0x5ddd69[_0x8252('0x8')];var _0x3b89d3=_0x2bf57e?_0x3cb827[_0x8252('0xb')]:_0x5ddd69[_0x8252('0x8')]+_0x5ddd69[_0x8252('0x9')];var _0x1def7a;if(_0x3b89d3>=_0x293232){_0x3b89d3=_0x293232;_0x1def7a=0xc8;}else{_0x1def7a=0xce;}_0xe76807[_0x8252('0xc')](_0x1def7a);return _0xe76807[_0x8252('0xd')](_0x8252('0xe'),_0x157069+'-'+_0x3b89d3+'/'+_0x293232)[_0x8252('0xf')](_0x3cb827);}return null;};}exports['getAgents']=function(_0x205e33,_0x13810a){var _0x5b9179={'count':0x0,'rows':[]};var _0x3d27f2={};var _0x59143b;var _0x1dfa18=utils[_0x8252('0x10')]();var _0x421740;var _0x5ce04f;var _0x2d0164=_0x205e33[_0x8252('0x11')]['globalQueueFilter'];var _0x37a2b1=_0x205e33[_0x8252('0x11')][_0x8252('0x12')];var _0x433412=_0x205e33[_0x8252('0x11')]['pauseTypeFilter'];var _0x4e8772=_0x37a2b1==='pause'||_0x37a2b1===_0x8252('0x13')?!![]:![];var _0x5557c9=[];var _0x308ad0;var _0x24ee8f;Promise[_0x8252('0x14')]()[_0x8252('0x15')](function(){if(_0x205e33['query'][_0x8252('0x16')]){if(!utils[_0x8252('0x17')](_0x205e33['query'][_0x8252('0x16')])){throw new APIBadRequestError(util[_0x8252('0x18')](_0x8252('0x19'),_0x205e33[_0x8252('0x11')][_0x8252('0x16')]));}_0x59143b=_0x205e33[_0x8252('0x11')][_0x8252('0x16')][_0x8252('0x1a')]();}if(!_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]||!_0x205e33[_0x8252('0x11')][_0x8252('0x1b')][_0x8252('0x1c')](_0x8252('0x1d'))){_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]=rta[_0x8252('0x1e')](_0x205e33[_0x8252('0x11')]['sort']);return;}var _0x3a98ad=rta[_0x8252('0x1f')](_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]);_0x205e33['query'][_0x8252('0x1b')]=_0x3a98ad['fields']['join'](',');_0x308ad0=_0x3a98ad['order'];})[_0x8252('0x15')](function(){if(!_0x2d0164){return[];}return rta[_0x8252('0x20')](_0x2d0164,_0x59143b);})[_0x8252('0x15')](function(_0x374409){_0x5557c9=_0x374409;return rta[_0x8252('0x21')]();})[_0x8252('0x15')](function(_0x231bc9){_0x5ce04f=_0x231bc9['rows'];if((!_0x37a2b1||_0x4e8772)&&!_0x308ad0){return _0x5557c9;}if(_0x308ad0&&!_0x37a2b1){return rta['getSortedAgentsIdsByStatus'](_0x5ce04f,_0x5557c9,_0x308ad0);}else{return rta[_0x8252('0x22')](_0x5ce04f,_0x5557c9,_0x37a2b1);}})[_0x8252('0x15')](function(_0xd3d389){_0x5557c9=_0xd3d389;var _0x53541a=![];if(_0x5557c9[_0x8252('0x23')]===0x0){if(_0x2d0164||_0x37a2b1){_0x53541a=!![];}if(_0x4e8772){_0x53541a=![];}}if(_0x53541a){return _0x5b9179;}var _0x2615b9=_[_0x8252('0x24')](db[_0x8252('0x25')][_0x8252('0x26')],function(_0x552e4c){return{'name':_0x552e4c[_0x8252('0x27')],'type':_0x552e4c['type'][_0x8252('0x28')]};});_0x205e33[_0x8252('0x11')][_0x8252('0x29')]=_0x8252('0x2a');_0x3d27f2=qs[_0x8252('0x2b')](_0x2615b9,_0x205e33);_0x3d27f2[_0x8252('0x2c')]=!![];var _0x2ca8ea=[];if(_0x5557c9[_0x8252('0x23')]>0x0){_0x2ca8ea[_0x8252('0x2d')]({'id':{'$in':_0x5557c9}});if(_0x308ad0&&!_0x37a2b1){_0x24ee8f=[db[_0x8252('0x2e')]['literal'](_0x8252('0x2f')+_0x5557c9+')')];_0x3d27f2[_0x8252('0x30')]=_0x24ee8f;}}if(_0x4e8772){_0x1dfa18['forEach'](function(_0x24e373){var _0x419353=!![];if(_0x37a2b1===_0x8252('0x13')&&_0x59143b!==_0x24e373){_0x419353=![];}_0x2ca8ea[_0x8252('0x2d')]({[_0x24e373+_0x8252('0x31')]:_0x419353});});if(_0x433412){_0x2ca8ea[_0x8252('0x2d')]({'pauseType':_0x433412});}}else if(_0x37a2b1){_0x1dfa18[_0x8252('0x32')](function(_0xcde7e7){_0x2ca8ea[_0x8252('0x2d')]({[_0xcde7e7+_0x8252('0x31')]:![]});});}_0x3d27f2[_0x8252('0x33')]=_[_0x8252('0x34')](_0x3d27f2[_0x8252('0x33')],{'$and':_0x2ca8ea});if(_0x205e33[_0x8252('0x35')][_0x8252('0x29')]===_0x8252('0x35')){var _0x34243a={'params':{'id':_0x205e33[_0x8252('0x35')]['userProfileId']},'query':{'section':_0x8252('0x36'),'role':_0x8252('0x2a'),'raw':!![],'ids':_0x5557c9,'customSorting':_0x24ee8f}};if(_0x205e33['query'][_0x8252('0x37')]){_0x34243a[_0x8252('0x11')][_0x8252('0x37')]=!![];}if(_0x4e8772){_0x34243a[_0x8252('0x11')][_0x8252('0x38')]=_0x2ca8ea;}_0x34243a[_0x8252('0x11')]=Object[_0x8252('0x39')](_0x34243a[_0x8252('0x11')],_[_0x8252('0x3a')](_0x205e33[_0x8252('0x11')],'id'));return db[_0x8252('0x3b')][_0x8252('0x3c')](_0x34243a);}return db['User'][_0x8252('0x3d')](_0x3d27f2);})['then'](function(_0x24a2ee){_0x5b9179[_0x8252('0xb')]=_0x24a2ee[_0x8252('0xb')];_0x421740=_0x24a2ee[_0x8252('0x3e')];return _0x421740[_0x8252('0x24')](function(_0x1a876d){var _0xad0822=_[_0x8252('0x3f')](_0x5ce04f,['id',_0x1a876d['id']]);if(_0xad0822){var _0x9fe76d=rta[_0x8252('0x40')](_0xad0822);_[_0x8252('0x34')](_0x1a876d,_0x9fe76d);}_0x1a876d[_0x8252('0x1d')]=rta[_0x8252('0x41')](_0x1a876d);if(_0x1a876d[_0x8252('0x1d')][_0x8252('0x1c')](_0x8252('0x42'))){_0x1dfa18[_0x8252('0x32')](function(_0x1ca513){if(_0x1a876d[_0x1ca513+_0x8252('0x31')]){if(_0x1ca513==='voice'){if(_0x1a876d[_0x8252('0x43')]!==_0x8252('0x44')){_0x1a876d['voiceStatus']='pause';}}else{_0x1a876d[_0x1ca513+_0x8252('0x45')]=_0x8252('0x42');}}});}return _0x1a876d;});})['then'](function(_0x3fd6db){if(!_0x308ad0||_0x24ee8f){return _0x3fd6db;}return rta[_0x8252('0x46')](_0x3fd6db,_0x308ad0);})[_0x8252('0x15')](function(_0x36d34f){var _0x21a3c8=rta[_0x8252('0x47')]();_0x5b9179['rows']=_0x36d34f['map'](function(_0xa73d00){return _['pick'](_0xa73d00,_0x21a3c8);});return _0x5b9179;})[_0x8252('0x15')](respondWithFilteredResult(_0x13810a,_0x3d27f2))['catch'](APIHandleError(_0x13810a));};exports[_0x8252('0x48')]=function(_0x33b9cc,_0xb1e127){var _0x3e89c9={'count':0x0,'rows':[]};var _0x21d27d={};var _0x560259;var _0xfd849e;var _0x14a67d;Promise['resolve']()[_0x8252('0x15')](function(){if(_0x33b9cc[_0x8252('0x11')][_0x8252('0x16')]){if(!utils['isValidChannel'](_0x33b9cc[_0x8252('0x11')][_0x8252('0x16')])){throw new APIBadRequestError(util[_0x8252('0x18')](_0x8252('0x19'),_0x33b9cc['query'][_0x8252('0x16')]));}_0x560259=_0x33b9cc['query'][_0x8252('0x16')]['toLowerCase']();}var _0x22cd22=_[_0x8252('0x49')](_0x560259)+_0x8252('0x4a');var _0x2a070a=_[_0x8252('0x24')](db[_0x22cd22]['rawAttributes'],function(_0x20cb91){return{'name':_0x20cb91[_0x8252('0x27')],'type':_0x20cb91['type'][_0x8252('0x28')]};});if(!_0x33b9cc[_0x8252('0x11')]['fields']){var _0x4a8fd5=['id',_0x8252('0x4b')];if(_0x560259===_0x8252('0x4c')){_0x4a8fd5[_0x8252('0x2d')](_0x8252('0x4d'));if(_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')]===_0x8252('0x4e')){_0x4a8fd5['push']([_0x8252('0x4f'),_0x8252('0x50')]);}}_0x33b9cc['query'][_0x8252('0x51')]=_0x4a8fd5[_0x8252('0x52')](',');}_0x21d27d=qs[_0x8252('0x2b')](_0x2a070a,_0x33b9cc);if(_0x33b9cc[_0x8252('0x35')]['role']===_0x8252('0x35')){var _0x2b4824={'params':{'id':_0x33b9cc[_0x8252('0x35')][_0x8252('0x53')]},'query':{'section':_0x560259==='voice'&&_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')]===_0x8252('0x4e')?_0x8252('0x54'):_[_0x8252('0x49')](_0x560259)+_0x8252('0x55'),'type':_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')],'nolimit':!![],'sort':_0x8252('0x4b'),'filter':_0x33b9cc['query'][_0x8252('0x56')]}};_0x2b4824[_0x8252('0x11')]=Object[_0x8252('0x39')](_0x2b4824['query'],_0x33b9cc[_0x8252('0x11')]);delete _0x2b4824[_0x8252('0x11')]['id'];return db[_0x8252('0x3b')]['getResources'](_0x2b4824);}return db[_0x22cd22]['findAndCountAll'](_0x21d27d);})[_0x8252('0x15')](function(_0xf3d73){_0x3e89c9[_0x8252('0xb')]=_0xf3d73[_0x8252('0xb')];_0xfd849e=_0xf3d73[_0x8252('0x3e')];return rtq[_0x8252('0x57')](_0x33b9cc,_0x560259);})[_0x8252('0x15')](function(_0x408921){_0x14a67d=_0x408921['rows'];return rtq['initializeQueues'](_0xfd849e,_0x14a67d,_0x560259,_0x33b9cc[_0x8252('0x11')]['type']);})['then'](function(_0x53689f){_0x3e89c9[_0x8252('0x3e')]=_0x53689f;return _0x3e89c9;})[_0x8252('0x15')](respondWithFilteredResult(_0xb1e127,_0x21d27d))['catch'](APIHandleError(_0xb1e127));}; \ No newline at end of file +var _0xc03f=['assign','getResources','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','count','offset','limit','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','*pause','resolve','isValidChannel','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','Pause','push','where','merge','user','Agents','online','extraQueryConditions','UserProfile','rows','map','filterAgentAttributes','getAgentStatus','pause','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','rawAttributes','name','voice','outbound','dialActive','dialMethod','Queues'];(function(_0xbb38e8,_0x46812b){var _0x5a4c51=function(_0xea1967){while(--_0xea1967){_0xbb38e8['push'](_0xbb38e8['shift']());}};_0x5a4c51(++_0x46812b);}(_0xc03f,0x161));var _0xfc03=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0xc03f[_0x27af8e];return _0x3d00f8;};'use strict';var _=require(_0xfc03('0x0'));var util=require(_0xfc03('0x1'));var rta=require(_0xfc03('0x2'));var rtq=require(_0xfc03('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xfc03('0x4'))['db'];var APIBadRequestError=require(_0xfc03('0x5'))[_0xfc03('0x6')];var APIHandleError=require(_0xfc03('0x5'))[_0xfc03('0x7')];function respondWithFilteredResult(_0x9faa76,_0x26f221){return function(_0x37727b){if(_0x37727b){var _0x678fd0=typeof _0x26f221['offset']===_0xfc03('0x8')&&typeof _0x26f221['limit']===_0xfc03('0x8');var _0x35d8dc=_0x37727b[_0xfc03('0x9')];var _0x17880d=_0x678fd0?0x0:_0x26f221[_0xfc03('0xa')];var _0x16ba67=_0x678fd0?_0x37727b[_0xfc03('0x9')]:_0x26f221['offset']+_0x26f221[_0xfc03('0xb')];var _0x4e0113;if(_0x16ba67>=_0x35d8dc){_0x16ba67=_0x35d8dc;_0x4e0113=0xc8;}else{_0x4e0113=0xce;}_0x9faa76[_0xfc03('0xc')](_0x4e0113);return _0x9faa76['set'](_0xfc03('0xd'),_0x17880d+'-'+_0x16ba67+'/'+_0x35d8dc)['json'](_0x37727b);}return null;};}exports[_0xfc03('0xe')]=function(_0x35901f,_0x505a4f){var _0x1e616e={'count':0x0,'rows':[]};var _0x5de734={};var _0x205494;var _0x2bc537=utils[_0xfc03('0xf')]();var _0x4a86a0;var _0x1723f7;var _0x51470e=_0x35901f[_0xfc03('0x10')][_0xfc03('0x11')];var _0x298169=_0x35901f[_0xfc03('0x10')]['globalStatusFilter'];var _0xc24dff=_0x35901f['query'][_0xfc03('0x12')];var _0x3fbb27=_0x298169==='pause'||_0x298169===_0xfc03('0x13')?!![]:![];var _0x336c7f=[];var _0x439391;var _0x12ad7d;Promise[_0xfc03('0x14')]()['then'](function(){if(_0x35901f['query']['channel']){if(!utils[_0xfc03('0x15')](_0x35901f[_0xfc03('0x10')][_0xfc03('0x16')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x35901f['query'][_0xfc03('0x16')]));}_0x205494=_0x35901f[_0xfc03('0x10')][_0xfc03('0x16')][_0xfc03('0x17')]();}if(!_0x35901f['query'][_0xfc03('0x18')]||!_0x35901f[_0xfc03('0x10')][_0xfc03('0x18')][_0xfc03('0x19')](_0xfc03('0x1a'))){_0x35901f['query'][_0xfc03('0x18')]=rta[_0xfc03('0x1b')](_0x35901f[_0xfc03('0x10')][_0xfc03('0x18')]);return;}var _0x15e34d=rta[_0xfc03('0x1c')](_0x35901f[_0xfc03('0x10')]['sort']);_0x35901f['query'][_0xfc03('0x18')]=_0x15e34d[_0xfc03('0x1d')][_0xfc03('0x1e')](',');_0x439391=_0x15e34d[_0xfc03('0x1f')];})[_0xfc03('0x20')](function(){if(!_0x51470e){return[];}return rta[_0xfc03('0x21')](_0x51470e,_0x205494);})[_0xfc03('0x20')](function(_0x33bba9){_0x336c7f=_0x33bba9;return rta[_0xfc03('0x22')]();})[_0xfc03('0x20')](function(_0x710453){_0x1723f7=_0x710453['rows'];if((!_0x298169||_0x3fbb27)&&!_0x439391){return _0x336c7f;}if(_0x439391&&!_0x298169){return rta[_0xfc03('0x23')](_0x1723f7,_0x336c7f,_0x439391);}else{return rta[_0xfc03('0x24')](_0x1723f7,_0x336c7f,_0x298169);}})[_0xfc03('0x20')](function(_0x4f9ad6){_0x336c7f=_0x4f9ad6;var _0x53dd42=![];if(_0x336c7f[_0xfc03('0x25')]===0x0){if(_0x51470e||_0x298169){_0x53dd42=!![];}if(_0x3fbb27){_0x53dd42=![];}}if(_0x53dd42){return _0x1e616e;}var _0x1fca25=_['map'](db[_0xfc03('0x26')]['rawAttributes'],function(_0x159da0){return{'name':_0x159da0[_0xfc03('0x27')],'type':_0x159da0[_0xfc03('0x28')][_0xfc03('0x29')]};});_0x35901f['query'][_0xfc03('0x2a')]=_0xfc03('0x2b');_0x5de734=qs[_0xfc03('0x2c')](_0x1fca25,_0x35901f);_0x5de734[_0xfc03('0x2d')]=!![];var _0xfa0cd=[];if(_0x336c7f[_0xfc03('0x25')]>0x0){_0xfa0cd['push']({'id':{'$in':_0x336c7f}});if(_0x439391&&!_0x298169){_0x12ad7d=[db[_0xfc03('0x2e')][_0xfc03('0x2f')](_0xfc03('0x30')+_0x336c7f+')')];_0x5de734[_0xfc03('0x1f')]=_0x12ad7d;}}if(_0x3fbb27){_0x2bc537[_0xfc03('0x31')](function(_0x21833c){var _0x6050b2=!![];if(_0x298169===_0xfc03('0x13')&&_0x205494!==_0x21833c){_0x6050b2=![];}_0xfa0cd['push']({[_0x21833c+_0xfc03('0x32')]:_0x6050b2});});if(_0xc24dff){_0xfa0cd[_0xfc03('0x33')]({'pauseType':_0xc24dff});}}else if(_0x298169){_0x2bc537[_0xfc03('0x31')](function(_0x3f2a0d){_0xfa0cd[_0xfc03('0x33')]({[_0x3f2a0d+_0xfc03('0x32')]:![]});});}_0x5de734[_0xfc03('0x34')]=_[_0xfc03('0x35')](_0x5de734['where'],{'$and':_0xfa0cd});if(_0x35901f[_0xfc03('0x36')][_0xfc03('0x2a')]==='user'){var _0x4a79f5={'params':{'id':_0x35901f['user']['userProfileId']},'query':{'section':_0xfc03('0x37'),'role':_0xfc03('0x2b'),'raw':!![],'ids':_0x336c7f,'customSorting':_0x12ad7d}};if(_0x35901f[_0xfc03('0x10')][_0xfc03('0x38')]){_0x4a79f5[_0xfc03('0x10')][_0xfc03('0x38')]=!![];}if(_0x3fbb27){_0x4a79f5[_0xfc03('0x10')][_0xfc03('0x39')]=_0xfa0cd;}_0x4a79f5[_0xfc03('0x10')]=Object['assign'](_0x4a79f5[_0xfc03('0x10')],_['omit'](_0x35901f[_0xfc03('0x10')],'id'));return db[_0xfc03('0x3a')]['getResources'](_0x4a79f5);}return db[_0xfc03('0x26')]['findAndCountAll'](_0x5de734);})[_0xfc03('0x20')](function(_0x9d3ffb){_0x1e616e[_0xfc03('0x9')]=_0x9d3ffb[_0xfc03('0x9')];_0x4a86a0=_0x9d3ffb[_0xfc03('0x3b')];return _0x4a86a0[_0xfc03('0x3c')](function(_0x2ab7ec){var _0xbe716e=_['find'](_0x1723f7,['id',_0x2ab7ec['id']]);if(_0xbe716e){var _0x139cf7=rta[_0xfc03('0x3d')](_0xbe716e);_[_0xfc03('0x35')](_0x2ab7ec,_0x139cf7);}_0x2ab7ec[_0xfc03('0x1a')]=rta[_0xfc03('0x3e')](_0x2ab7ec);if(_0x2ab7ec[_0xfc03('0x1a')][_0xfc03('0x19')](_0xfc03('0x3f'))){_0x2bc537[_0xfc03('0x31')](function(_0x5e14df){if(_0x2ab7ec[_0x5e14df+_0xfc03('0x32')]){if(_0x5e14df==='voice'){if(_0x2ab7ec[_0xfc03('0x40')]!==_0xfc03('0x41')){_0x2ab7ec[_0xfc03('0x40')]=_0xfc03('0x3f');}}else{_0x2ab7ec[_0x5e14df+_0xfc03('0x42')]=_0xfc03('0x3f');}}});}return _0x2ab7ec;});})['then'](function(_0x46e0d4){if(!_0x439391||_0x12ad7d){return _0x46e0d4;}return rta[_0xfc03('0x43')](_0x46e0d4,_0x439391);})[_0xfc03('0x20')](function(_0x2d7700){var _0x49cfa8=rta[_0xfc03('0x44')]();_0x1e616e[_0xfc03('0x3b')]=_0x2d7700[_0xfc03('0x3c')](function(_0x35ed29){return _[_0xfc03('0x45')](_0x35ed29,_0x49cfa8);});return _0x1e616e;})[_0xfc03('0x20')](respondWithFilteredResult(_0x505a4f,_0x5de734))[_0xfc03('0x46')](APIHandleError(_0x505a4f));};exports['getQueues']=function(_0x4726f8,_0xa8a39b){var _0x259c70={'count':0x0,'rows':[]};var _0x1e641d={};var _0x4999e1;var _0x485265;var _0x294784;Promise[_0xfc03('0x14')]()[_0xfc03('0x20')](function(){if(_0x4726f8[_0xfc03('0x10')][_0xfc03('0x16')]){if(!utils[_0xfc03('0x15')](_0x4726f8[_0xfc03('0x10')][_0xfc03('0x16')])){throw new APIBadRequestError(util[_0xfc03('0x47')](_0xfc03('0x48'),_0x4726f8['query'][_0xfc03('0x16')]));}_0x4999e1=_0x4726f8['query'][_0xfc03('0x16')]['toLowerCase']();}var _0x5aba5c=_[_0xfc03('0x49')](_0x4999e1)+_0xfc03('0x4a');var _0x4616cb=_[_0xfc03('0x3c')](db[_0x5aba5c][_0xfc03('0x4b')],function(_0x51a748){return{'name':_0x51a748[_0xfc03('0x27')],'type':_0x51a748[_0xfc03('0x28')][_0xfc03('0x29')]};});if(!_0x4726f8['query']['fields']){var _0x3ef793=['id',_0xfc03('0x4c')];if(_0x4999e1===_0xfc03('0x4d')){_0x3ef793[_0xfc03('0x33')]('type');if(_0x4726f8[_0xfc03('0x10')]['type']===_0xfc03('0x4e')){_0x3ef793[_0xfc03('0x33')]([_0xfc03('0x4f'),_0xfc03('0x50')]);}}_0x4726f8[_0xfc03('0x10')]['fields']=_0x3ef793[_0xfc03('0x1e')](',');}_0x1e641d=qs[_0xfc03('0x2c')](_0x4616cb,_0x4726f8);if(_0x4726f8[_0xfc03('0x36')][_0xfc03('0x2a')]===_0xfc03('0x36')){var _0x51a464={'params':{'id':_0x4726f8[_0xfc03('0x36')]['userProfileId']},'query':{'section':_0x4999e1===_0xfc03('0x4d')&&_0x4726f8[_0xfc03('0x10')][_0xfc03('0x28')]===_0xfc03('0x4e')?'QueueCampaigns':_[_0xfc03('0x49')](_0x4999e1)+_0xfc03('0x51'),'type':_0x4726f8['query'][_0xfc03('0x28')],'nolimit':!![],'sort':_0xfc03('0x4c'),'filter':_0x4726f8[_0xfc03('0x10')]['filter']}};_0x51a464['query']=Object[_0xfc03('0x52')](_0x51a464[_0xfc03('0x10')],_0x4726f8['query']);delete _0x51a464[_0xfc03('0x10')]['id'];return db[_0xfc03('0x3a')][_0xfc03('0x53')](_0x51a464);}return db[_0x5aba5c][_0xfc03('0x54')](_0x1e641d);})['then'](function(_0x159c4e){_0x259c70[_0xfc03('0x9')]=_0x159c4e[_0xfc03('0x9')];_0x485265=_0x159c4e[_0xfc03('0x3b')];return rtq[_0xfc03('0x55')](_0x4726f8,_0x4999e1);})[_0xfc03('0x20')](function(_0x392b62){_0x294784=_0x392b62[_0xfc03('0x3b')];return rtq[_0xfc03('0x56')](_0x485265,_0x294784,_0x4999e1,_0x4726f8[_0xfc03('0x10')]['type']);})[_0xfc03('0x20')](function(_0x124a23){_0x259c70[_0xfc03('0x3b')]=_0x124a23;return _0x259c70;})[_0xfc03('0x20')](respondWithFilteredResult(_0xa8a39b,_0x1e641d))[_0xfc03('0x46')](APIHandleError(_0xa8a39b));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a88f25c..cb908af 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1135e8,_0x23f07b){var _0x24fad6=function(_0x5363fe){while(--_0x5363fe){_0x1135e8['push'](_0x1135e8['shift']());}};_0x24fad6(++_0x23f07b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x237587,_0x5ca4cb){var _0x1ae730=function(_0x1d471e){while(--_0x1d471e){_0x237587['push'](_0x237587['shift']());}};_0x1ae730(++_0x5ca4cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 25d6221..2a9f087 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 _0x7ebb=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x1bcd61,_0x3a7907){var _0x1d0881=function(_0x4fe510){while(--_0x4fe510){_0x1bcd61['push'](_0x1bcd61['shift']());}};_0x1d0881(++_0x3a7907);}(_0x7ebb,0x161));var _0xb7eb=function(_0x4ae2a1,_0x453065){_0x4ae2a1=_0x4ae2a1-0x0;var _0x49b5b7=_0x7ebb[_0x4ae2a1];return _0x49b5b7;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'state':{'type':Sequelize[_0xb7eb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb7eb('0x3')]},'scheduledat':{'type':Sequelize[_0xb7eb('0x4')]},'uniqueid':{'type':Sequelize[_0xb7eb('0x3')]},'starttime':{'type':Sequelize[_0xb7eb('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb7eb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb7eb('0x3')]},'campaigntype':{'type':Sequelize[_0xb7eb('0x3')]},'membername':{'type':Sequelize[_0xb7eb('0x3')]}}; \ No newline at end of file +var _0x44ff=['STRING','exports','INTEGER'];(function(_0x765cc9,_0x90fa0d){var _0x5450a1=function(_0x2b2daa){while(--_0x2b2daa){_0x765cc9['push'](_0x765cc9['shift']());}};_0x5450a1(++_0x90fa0d);}(_0x44ff,0x1c3));var _0xf44f=function(_0x3922d8,_0x24f376){_0x3922d8=_0x3922d8-0x0;var _0x21038e=_0x44ff[_0x3922d8];return _0x21038e;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'state':{'type':Sequelize[_0xf44f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf44f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf44f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf44f('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 741b82e..def9359 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 _0x3e8b=['bluebird','path','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x3e8b,0xce));var _0xb3e8=function(_0x43505e,_0xa95348){_0x43505e=_0x43505e-0x0;var _0x1786c1=_0x3e8b[_0x43505e];return _0x1786c1;};'use strict';var _=require(_0xb3e8('0x0'));var util=require(_0xb3e8('0x1'));var logger=require(_0xb3e8('0x2'))(_0xb3e8('0x3'));var moment=require('moment');var BPromise=require(_0xb3e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3e8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3e8('0x6'));module[_0xb3e8('0x7')]=function(_0x229774,_0x145f73){return _0x229774['define'](_0xb3e8('0x8'),attributes,{'tableName':_0xb3e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1412=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview'];(function(_0x1eefe6,_0x415de6){var _0x49295b=function(_0x383fb3){while(--_0x383fb3){_0x1eefe6['push'](_0x1eefe6['shift']());}};_0x49295b(++_0x415de6);}(_0x1412,0x8f));var _0x2141=function(_0x5a4f25,_0x2bc735){_0x5a4f25=_0x5a4f25-0x0;var _0x207dd7=_0x1412[_0x5a4f25];return _0x207dd7;};'use strict';var _=require(_0x2141('0x0'));var util=require('util');var logger=require(_0x2141('0x1'))(_0x2141('0x2'));var moment=require(_0x2141('0x3'));var BPromise=require(_0x2141('0x4'));var rp=require(_0x2141('0x5'));var fs=require('fs');var path=require(_0x2141('0x6'));var rimraf=require(_0x2141('0x7'));var config=require(_0x2141('0x8'));var attributes=require(_0x2141('0x9'));module['exports']=function(_0x33fb65,_0x53815a){return _0x33fb65[_0x2141('0xa')](_0x2141('0xb'),attributes,{'tableName':_0x2141('0xc'),'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 6bd2955..afb9231 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 _0xaf11=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','bluebird'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xaf11,0x190));var _0x1af1=function(_0x43df4e,_0x23718d){_0x43df4e=_0x43df4e-0x0;var _0x868c68=_0xaf11[_0x43df4e];return _0x868c68;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var moment=require('moment');var BPromise=require(_0x1af1('0x2'));var rs=require(_0x1af1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1af1('0x4'))['db'];var utils=require(_0x1af1('0x5'));var logger=require(_0x1af1('0x6'))(_0x1af1('0x7'));var config=require(_0x1af1('0x8'));var jayson=require(_0x1af1('0x9'));var client=jayson[_0x1af1('0xa')][_0x1af1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562949,_0x63410c,_0x20a736){return new BPromise(function(_0x19398e,_0x1f7336){return client[_0x1af1('0xc')](_0x562949,_0x20a736)[_0x1af1('0xd')](function(_0x329b9b){logger[_0x1af1('0xe')](_0x1af1('0xf'),_0x63410c,'request\x20sent');logger[_0x1af1('0x10')](_0x1af1('0x11'),_0x63410c,_0x1af1('0x12'),JSON[_0x1af1('0x13')](_0x329b9b));if(_0x329b9b[_0x1af1('0x14')]){if(_0x329b9b['error'][_0x1af1('0x15')]===0x1f4){logger[_0x1af1('0x14')](_0x1af1('0xf'),_0x63410c,_0x329b9b['error'][_0x1af1('0x16')]);return _0x1f7336(_0x329b9b[_0x1af1('0x14')]['message']);}logger['error'](_0x1af1('0xf'),_0x63410c,_0x329b9b[_0x1af1('0x14')][_0x1af1('0x16')]);return _0x19398e(_0x329b9b['error'][_0x1af1('0x16')]);}else{logger[_0x1af1('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x63410c,_0x1af1('0x12'));_0x19398e(_0x329b9b[_0x1af1('0x17')][_0x1af1('0x16')]);}})['catch'](function(_0xb43a2d){logger[_0x1af1('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x63410c,_0xb43a2d);_0x1f7336(_0xb43a2d);});});}exports[_0x1af1('0x18')]=function(_0x155df8){var _0x452c5e=this;return new Promise(function(_0x555a6a,_0x510ba1){return db[_0x1af1('0x19')][_0x1af1('0x1a')](_0x155df8[_0x1af1('0x1b')],{'raw':_0x155df8[_0x1af1('0x1c')]?_0x155df8[_0x1af1('0x1c')][_0x1af1('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3d4402){logger['info'](_0x1af1('0x18'),_0x155df8);logger[_0x1af1('0x10')](_0x1af1('0x18'),_0x155df8,JSON[_0x1af1('0x13')](_0x3d4402));_0x555a6a(_0x3d4402);})[_0x1af1('0x1e')](function(_0x4e1c6d){logger[_0x1af1('0x14')]('CreateReportAgentPreview',_0x4e1c6d[_0x1af1('0x16')],_0x155df8);_0x510ba1(_0x452c5e[_0x1af1('0x14')](0x1f4,_0x4e1c6d[_0x1af1('0x16')]));});});}; \ No newline at end of file +var _0xd324=['util','moment','randomstring','ioredis','../../config/logger','../../config/environment','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','ReportAgentPreview','create','body','options','then','CreateReportAgentPreview','lodash'];(function(_0x4ac761,_0x228735){var _0x4de38d=function(_0x430d65){while(--_0x430d65){_0x4ac761['push'](_0x4ac761['shift']());}};_0x4de38d(++_0x228735);}(_0xd324,0x137));var _0x4d32=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xd324[_0x4ef734];return _0x33a7cb;};'use strict';var _=require(_0x4d32('0x0'));var util=require(_0x4d32('0x1'));var moment=require(_0x4d32('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d32('0x3'));var fs=require('fs');var Redis=require(_0x4d32('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d32('0x5'))('rpc');var config=require(_0x4d32('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x280bce,_0x313b41,_0x4fe7cb){return new BPromise(function(_0x4b0cd3,_0x215ca5){return client[_0x4d32('0x8')](_0x280bce,_0x4fe7cb)['then'](function(_0x2cd8b6){logger[_0x4d32('0x9')](_0x4d32('0xa'),_0x313b41,_0x4d32('0xb'));logger[_0x4d32('0xc')](_0x4d32('0xd'),_0x313b41,'request\x20sent',JSON['stringify'](_0x2cd8b6));if(_0x2cd8b6[_0x4d32('0xe')]){if(_0x2cd8b6['error'][_0x4d32('0xf')]===0x1f4){logger[_0x4d32('0xe')](_0x4d32('0xa'),_0x313b41,_0x2cd8b6[_0x4d32('0xe')][_0x4d32('0x10')]);return _0x215ca5(_0x2cd8b6[_0x4d32('0xe')]['message']);}logger[_0x4d32('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x313b41,_0x2cd8b6[_0x4d32('0xe')][_0x4d32('0x10')]);return _0x4b0cd3(_0x2cd8b6['error'][_0x4d32('0x10')]);}else{logger[_0x4d32('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x313b41,_0x4d32('0xb'));_0x4b0cd3(_0x2cd8b6['result'][_0x4d32('0x10')]);}})[_0x4d32('0x11')](function(_0x294768){logger[_0x4d32('0xe')](_0x4d32('0xa'),_0x313b41,_0x294768);_0x215ca5(_0x294768);});});}exports['CreateReportAgentPreview']=function(_0x55a535){var _0x3c763f=this;return new Promise(function(_0x163f3b,_0x2832c7){return db[_0x4d32('0x12')][_0x4d32('0x13')](_0x55a535[_0x4d32('0x14')],{'raw':_0x55a535['options']?_0x55a535[_0x4d32('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x4d32('0x16')](function(_0x309802){logger[_0x4d32('0x9')](_0x4d32('0x17'),_0x55a535);logger[_0x4d32('0xc')]('CreateReportAgentPreview',_0x55a535,JSON['stringify'](_0x309802));_0x163f3b(_0x309802);})[_0x4d32('0x11')](function(_0x10d1cd){logger['error']('CreateReportAgentPreview',_0x10d1cd['message'],_0x55a535);_0x2832c7(_0x3c763f[_0x4d32('0xe')](0x1f4,_0x10d1cd[_0x4d32('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b972f09..59f68e8 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 _0x6615=['agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity'];(function(_0x42ab43,_0xb38833){var _0xf1ca33=function(_0x10b5e9){while(--_0x10b5e9){_0x42ab43['push'](_0x42ab43['shift']());}};_0xf1ca33(++_0xb38833);}(_0x6615,0x171));var _0x5661=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x6615[_0xa4f636];return _0x37e02a;};'use strict';var multer=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var path=require(_0x5661('0x2'));var express=require(_0x5661('0x3'));var router=express[_0x5661('0x4')]();var auth=require(_0x5661('0x5'));var controller=require(_0x5661('0x6'));router[_0x5661('0x7')](_0x5661('0x8'),auth[_0x5661('0x9')](),controller[_0x5661('0xa')]);router[_0x5661('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x5661('0x9')](),controller['voiceChannelMixMonitor']);router[_0x5661('0x7')](_0x5661('0xb'),auth[_0x5661('0x9')](),controller[_0x5661('0xc')]);router[_0x5661('0x7')]('/voice/queues',auth[_0x5661('0x9')](),controller[_0x5661('0xd')]);router[_0x5661('0x7')]('/chat/queues',auth[_0x5661('0x9')](),controller['chatQueues']);router[_0x5661('0x7')]('/mail/queues',auth[_0x5661('0x9')](),controller[_0x5661('0xe')]);router[_0x5661('0x7')](_0x5661('0xf'),auth[_0x5661('0x9')](),controller[_0x5661('0x10')]);router['get']('/openchannel/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x11')]);router[_0x5661('0x7')]('/sms/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x12')]);router['get'](_0x5661('0x13'),auth[_0x5661('0x9')](),controller[_0x5661('0x14')]);router[_0x5661('0x7')]('/fax/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x15')]);router['get'](_0x5661('0x16'),auth[_0x5661('0x9')](),controller[_0x5661('0x17')]);router[_0x5661('0x7')](_0x5661('0x18'),auth[_0x5661('0x9')](),controller[_0x5661('0x19')]);router[_0x5661('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x5661('0x9')](),controller[_0x5661('0x1a')]);router[_0x5661('0x7')](_0x5661('0x1b'),auth[_0x5661('0x9')](),controller[_0x5661('0x1c')]);router[_0x5661('0x7')](_0x5661('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x5661('0x7')]('/voice/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x1e')]);router[_0x5661('0x1f')](_0x5661('0x20'),auth[_0x5661('0x9')](),controller[_0x5661('0x21')]);router[_0x5661('0x7')](_0x5661('0x22'),auth[_0x5661('0x9')](),controller[_0x5661('0x23')]);router[_0x5661('0x7')](_0x5661('0x24'),auth['isAuthenticated'](),controller[_0x5661('0x25')]);router[_0x5661('0x7')](_0x5661('0x26'),auth[_0x5661('0x9')](),controller[_0x5661('0x27')]);router['put'](_0x5661('0x28'),auth[_0x5661('0x9')](),controller[_0x5661('0x29')]);router[_0x5661('0x7')](_0x5661('0x2a'),auth[_0x5661('0x9')](),controller['telephones']);router[_0x5661('0x7')](_0x5661('0x2b'),auth[_0x5661('0x9')](),controller[_0x5661('0x2c')]);router[_0x5661('0x7')](_0x5661('0x2d'),auth[_0x5661('0x9')](),controller[_0x5661('0x2e')]);router[_0x5661('0x7')](_0x5661('0x2f'),auth['isAuthenticated'](),controller[_0x5661('0x30')]);router[_0x5661('0x7')](_0x5661('0x31'),auth['isAuthenticated'](),controller[_0x5661('0x32')]);router[_0x5661('0x7')](_0x5661('0x33'),auth[_0x5661('0x9')](),controller[_0x5661('0x34')]);router[_0x5661('0x7')](_0x5661('0x35'),auth['isAuthenticated'](),controller[_0x5661('0x36')]);router[_0x5661('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x5661('0x9')](),controller[_0x5661('0x37')]);router[_0x5661('0x7')](_0x5661('0x38'),auth[_0x5661('0x9')](),controller[_0x5661('0x39')]);router[_0x5661('0x7')](_0x5661('0x3a'),auth[_0x5661('0x9')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x5661('0x3b'),auth[_0x5661('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x5661('0x3c')](_0x5661('0x3d'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x3f')));router[_0x5661('0x7')]('/mail/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x40')]);router['post'](_0x5661('0x41'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x42')));router['get']('/chat/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x43')]);router[_0x5661('0x3c')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('fax'));router['get'](_0x5661('0x44'),auth[_0x5661('0x9')](),controller['showFaxQueues']);router[_0x5661('0x3c')]('/openchannel/queues/:id/notify',auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x45')));router[_0x5661('0x7')](_0x5661('0x46'),auth[_0x5661('0x9')](),controller[_0x5661('0x47')]);router[_0x5661('0x3c')](_0x5661('0x48'),auth['isAuthenticated'](),controller[_0x5661('0x3e')]('sms'));router[_0x5661('0x3c')](_0x5661('0x49'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x4a')));router[_0x5661('0x7')](_0x5661('0x4b'),auth[_0x5661('0x9')](),controller[_0x5661('0x4c')]);router[_0x5661('0x7')](_0x5661('0x4d'),auth['isAuthenticated'](),controller[_0x5661('0x4e')]);router[_0x5661('0x3c')](_0x5661('0x4f'),auth[_0x5661('0x9')](),controller[_0x5661('0x50')]);module[_0x5661('0x51')]=router; \ No newline at end of file +var _0x234c=['showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/sms/queues/:id'];(function(_0x4a9801,_0x548afb){var _0x2b089a=function(_0x4b4074){while(--_0x4b4074){_0x4a9801['push'](_0x4a9801['shift']());}};_0x2b089a(++_0x548afb);}(_0x234c,0x9b));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var path=require('path');var express=require(_0xc234('0x2'));var router=express[_0xc234('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xc234('0x4'));router[_0xc234('0x5')](_0xc234('0x6'),auth[_0xc234('0x7')](),controller[_0xc234('0x8')]);router[_0xc234('0x5')](_0xc234('0x9'),auth['isAuthenticated'](),controller[_0xc234('0xa')]);router['get'](_0xc234('0xb'),auth[_0xc234('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xc234('0x5')](_0xc234('0xc'),auth['isAuthenticated'](),controller[_0xc234('0xd')]);router[_0xc234('0x5')]('/chat/queues',auth[_0xc234('0x7')](),controller[_0xc234('0xe')]);router[_0xc234('0x5')](_0xc234('0xf'),auth[_0xc234('0x7')](),controller[_0xc234('0x10')]);router[_0xc234('0x5')](_0xc234('0x11'),auth[_0xc234('0x7')](),controller[_0xc234('0x12')]);router[_0xc234('0x5')](_0xc234('0x13'),auth[_0xc234('0x7')](),controller[_0xc234('0x14')]);router[_0xc234('0x5')]('/sms/queues',auth[_0xc234('0x7')](),controller[_0xc234('0x15')]);router['get'](_0xc234('0x16'),auth[_0xc234('0x7')](),controller['whatsappQueues']);router[_0xc234('0x5')](_0xc234('0x17'),auth['isAuthenticated'](),controller[_0xc234('0x18')]);router[_0xc234('0x5')]('/voice/queues/preview/:id',auth[_0xc234('0x7')](),controller[_0xc234('0x19')]);router[_0xc234('0x5')]('/voice/queues/channels',auth[_0xc234('0x7')](),controller[_0xc234('0x1a')]);router[_0xc234('0x5')](_0xc234('0x1b'),auth[_0xc234('0x7')](),controller['voiceQueuesChannel']);router[_0xc234('0x5')](_0xc234('0x1c'),auth['isAuthenticated'](),controller[_0xc234('0x1d')]);router[_0xc234('0x5')](_0xc234('0x1e'),auth[_0xc234('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xc234('0x1f'),auth[_0xc234('0x7')](),controller[_0xc234('0x20')]);router[_0xc234('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xc234('0x5')]('/outbound',auth[_0xc234('0x7')](),controller[_0xc234('0x22')]);router[_0xc234('0x5')](_0xc234('0x23'),auth[_0xc234('0x7')](),controller[_0xc234('0x24')]);router[_0xc234('0x5')]('/agents',auth[_0xc234('0x7')](),controller[_0xc234('0x25')]);router[_0xc234('0x21')](_0xc234('0x26'),auth[_0xc234('0x7')](),controller[_0xc234('0x27')]);router['get'](_0xc234('0x28'),auth[_0xc234('0x7')](),controller[_0xc234('0x29')]);router[_0xc234('0x5')](_0xc234('0x2a'),auth[_0xc234('0x7')](),controller[_0xc234('0x2b')]);router[_0xc234('0x5')](_0xc234('0x2c'),auth['isAuthenticated'](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xc234('0x7')](),controller['faxAccounts']);router['get'](_0xc234('0x2d'),auth[_0xc234('0x7')](),controller[_0xc234('0x2e')]);router['get'](_0xc234('0x2f'),auth[_0xc234('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xc234('0x5')](_0xc234('0x30'),auth[_0xc234('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xc234('0x5')](_0xc234('0x31'),auth[_0xc234('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc234('0x32')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xc234('0x7')](),controller[_0xc234('0x33')]);router[_0xc234('0x5')]('/fax/queues/waitinginteractions',auth[_0xc234('0x7')](),controller[_0xc234('0x34')]);router['post']('/mail/queues/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x36')));router['get'](_0xc234('0x37'),auth[_0xc234('0x7')](),controller[_0xc234('0x38')]);router['post'](_0xc234('0x39'),auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x3a')));router['get'](_0xc234('0x3b'),auth[_0xc234('0x7')](),controller[_0xc234('0x3c')]);router[_0xc234('0x3d')](_0xc234('0x3e'),auth[_0xc234('0x7')](),controller['queueNotify'](_0xc234('0x3f')));router['get'](_0xc234('0x40'),auth[_0xc234('0x7')](),controller['showFaxQueues']);router['post'](_0xc234('0x41'),auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x42')));router[_0xc234('0x5')](_0xc234('0x43'),auth[_0xc234('0x7')](),controller['showOpenchannelQueues']);router[_0xc234('0x3d')](_0xc234('0x44'),auth[_0xc234('0x7')](),controller['queueNotify']('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x35')]('whatsapp'));router[_0xc234('0x5')](_0xc234('0x45'),auth[_0xc234('0x7')](),controller[_0xc234('0x46')]);router[_0xc234('0x5')](_0xc234('0x47'),auth[_0xc234('0x7')](),controller[_0xc234('0x48')]);router[_0xc234('0x3d')]('/agents/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x49')]);module[_0xc234('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5b88493..c8e489f 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x6dfea,_0x19621e){var _0x892046=function(_0x38eb3a){while(--_0x38eb3a){_0x6dfea['push'](_0x6dfea['shift']());}};_0x892046(++_0x19621e);}(_0xe706,0xa3));var _0x6e70=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xe706[_0x3bb63a];return _0x3b822a;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8382d79..1e819cd 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 _0xb1a2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','run','post','put'];(function(_0x5b3e5d,_0x474610){var _0x302097=function(_0x4ec20b){while(--_0x4ec20b){_0x5b3e5d['push'](_0x5b3e5d['shift']());}};_0x302097(++_0x474610);}(_0xb1a2,0x193));var _0x2b1a=function(_0xa34dac,_0x3a89db){_0xa34dac=_0xa34dac-0x0;var _0x47a16c=_0xb1a2[_0xa34dac];return _0x47a16c;};'use strict';var multer=require(_0x2b1a('0x0'));var util=require(_0x2b1a('0x1'));var path=require(_0x2b1a('0x2'));var timeout=require(_0x2b1a('0x3'));var express=require(_0x2b1a('0x4'));var router=express[_0x2b1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b1a('0x6'));var interaction=require(_0x2b1a('0x7'));var config=require(_0x2b1a('0x8'));var controller=require('./schedule.controller');router['get']('/',auth[_0x2b1a('0x9')](),controller[_0x2b1a('0xa')]);router[_0x2b1a('0xb')](_0x2b1a('0xc'),auth[_0x2b1a('0x9')](),controller[_0x2b1a('0xd')]);router[_0x2b1a('0xb')]('/:id/run',auth['isAuthenticated'](),controller[_0x2b1a('0xe')]);router[_0x2b1a('0xf')]('/',auth[_0x2b1a('0x9')](),controller['create']);router[_0x2b1a('0x10')](_0x2b1a('0xc'),auth[_0x2b1a('0x9')](),controller[_0x2b1a('0x11')]);router[_0x2b1a('0x12')]('/:id',auth[_0x2b1a('0x9')](),controller[_0x2b1a('0x13')]);module[_0x2b1a('0x14')]=router; \ No newline at end of file +var _0x5150=['show','/:id/run','run','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5150,0x173));var _0x0515=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x5150[_0x1a595a];return _0x33f008;};'use strict';var multer=require(_0x0515('0x0'));var util=require(_0x0515('0x1'));var path=require('path');var timeout=require(_0x0515('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0515('0x3'));var auth=require(_0x0515('0x4'));var interaction=require(_0x0515('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x0515('0x6')]('/',auth[_0x0515('0x7')](),controller[_0x0515('0x8')]);router[_0x0515('0x6')]('/:id',auth[_0x0515('0x7')](),controller[_0x0515('0x9')]);router[_0x0515('0x6')](_0x0515('0xa'),auth[_0x0515('0x7')](),controller[_0x0515('0xb')]);router['post']('/',auth[_0x0515('0x7')](),controller[_0x0515('0xc')]);router[_0x0515('0xd')](_0x0515('0xe'),auth['isAuthenticated'](),controller[_0x0515('0xf')]);router[_0x0515('0x10')](_0x0515('0xe'),auth[_0x0515('0x7')](),controller[_0x0515('0x11')]);module[_0x0515('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index bc56428..84410ef 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 _0xb11d=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','weeks','days','minutes','ENUM','csv','xlsx','custom','TEXT','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb11d,0x10c));var _0xdb11=function(_0x2258a6,_0x3e1e9c){_0x2258a6=_0x2258a6-0x0;var _0x31c75f=_0xb11d[_0x2258a6];return _0x31c75f;};'use strict';var Sequelize=require('sequelize');module[_0xdb11('0x0')]={'name':{'type':Sequelize[_0xdb11('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdb11('0x1')]},'active':{'type':Sequelize[_0xdb11('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb11('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xdb11('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdb11('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xdb11('0x6'),'quarters','months',_0xdb11('0x7'),_0xdb11('0x8'),'hours',_0xdb11('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdb11('0xa')](_0xdb11('0xb'),'pdf',_0xdb11('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xdb11('0xa')](_0xdb11('0xd'),'default'),'allowNull':![],'defaultValue':_0xdb11('0xd')},'sendMail':{'type':Sequelize[_0xdb11('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb11('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xdb11('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe827=['years','months','weeks','days','hours','minutes','csv','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2e56cf,_0x32a94a){var _0x2e4d87=function(_0xcab258){while(--_0xcab258){_0x2e56cf['push'](_0x2e56cf['shift']());}};_0x2e4d87(++_0x32a94a);}(_0xe827,0x191));var _0x7e82=function(_0xcb7b05,_0x1aff01){_0xcb7b05=_0xcb7b05-0x0;var _0x23ef2a=_0xe827[_0xcb7b05];return _0x23ef2a;};'use strict';var Sequelize=require('sequelize');module[_0x7e82('0x0')]={'name':{'type':Sequelize[_0x7e82('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7e82('0x1')]},'active':{'type':Sequelize[_0x7e82('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7e82('0x1')],'allowNull':![],'defaultValue':_0x7e82('0x3')},'startAt':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7e82('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7e82('0x6')](_0x7e82('0x7'),'quarters',_0x7e82('0x8'),_0x7e82('0x9'),_0x7e82('0xa'),_0x7e82('0xb'),_0x7e82('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x7e82('0x6')](_0x7e82('0xd'),'pdf',_0x7e82('0xe')),'allowNull':![],'defaultValue':_0x7e82('0xd')},'type':{'type':Sequelize['ENUM'](_0x7e82('0xf'),'default'),'allowNull':![],'defaultValue':_0x7e82('0xf')},'sendMail':{'type':Sequelize[_0x7e82('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7e82('0x1')]},'cc':{'type':Sequelize[_0x7e82('0x10')]},'bcc':{'type':Sequelize[_0x7e82('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x7e82('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 97efc60..5e71ed7 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 _0xff7f=['type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Schedule','rawAttributes','fieldName'];(function(_0x15165e,_0x47648c){var _0x3383e3=function(_0x250cb0){while(--_0x250cb0){_0x15165e['push'](_0x15165e['shift']());}};_0x3383e3(++_0x47648c);}(_0xff7f,0x111));var _0xfff7=function(_0x4d9cab,_0x488b32){_0x4d9cab=_0x4d9cab-0x0;var _0x4a1609=_0xff7f[_0x4d9cab];return _0x4a1609;};'use strict';var emlformat=require(_0xfff7('0x0'));var rimraf=require(_0xfff7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff7('0x2'));var rp=require(_0xfff7('0x3'));var moment=require(_0xfff7('0x4'));var BPromise=require(_0xfff7('0x5'));var Mustache=require(_0xfff7('0x6'));var util=require(_0xfff7('0x7'));var path=require('path');var sox=require(_0xfff7('0x8'));var csv=require(_0xfff7('0x9'));var ejs=require(_0xfff7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfff7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfff7('0xc'));var deskjs=require(_0xfff7('0xd'));var toCsv=require(_0xfff7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfff7('0xe'));var qs=require(_0xfff7('0xf'));var as=require(_0xfff7('0x10'));var hardwareService=require(_0xfff7('0x11'));var logger=require(_0xfff7('0x12'))(_0xfff7('0x13'));var utils=require(_0xfff7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfff7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x203996,_0xb0c657){_0xb0c657=_0xb0c657||0xcc;return function(_0x3098f1){if(_0x3098f1){return _0x203996['sendStatus'](_0xb0c657);}return _0x203996[_0xfff7('0x16')](_0xb0c657)['end']();};}function respondWithResult(_0x109149,_0x4dc74f){_0x4dc74f=_0x4dc74f||0xc8;return function(_0x41abd4){if(_0x41abd4){return _0x109149[_0xfff7('0x16')](_0x4dc74f)[_0xfff7('0x17')](_0x41abd4);}};}function respondWithFilteredResult(_0x54a3bc,_0x2d0fb1){return function(_0x5377da){if(_0x5377da){var _0x28ec0e=typeof _0x2d0fb1[_0xfff7('0x18')]===_0xfff7('0x19')&&typeof _0x2d0fb1[_0xfff7('0x1a')]===_0xfff7('0x19');var _0x22d5bd=_0x5377da[_0xfff7('0x1b')];var _0x5740a7=_0x28ec0e?0x0:_0x2d0fb1[_0xfff7('0x18')];var _0x303c22=_0x28ec0e?_0x5377da[_0xfff7('0x1b')]:_0x2d0fb1['offset']+_0x2d0fb1[_0xfff7('0x1a')];var _0x3afc23;if(_0x303c22>=_0x22d5bd){_0x303c22=_0x22d5bd;_0x3afc23=0xc8;}else{_0x3afc23=0xce;}_0x54a3bc['status'](_0x3afc23);return _0x54a3bc[_0xfff7('0x1c')](_0xfff7('0x1d'),_0x5740a7+'-'+_0x303c22+'/'+_0x22d5bd)[_0xfff7('0x17')](_0x5377da);}return null;};}function patchUpdates(_0x455fc4){return function(_0x2452d2){try{jsonpatch[_0xfff7('0x1e')](_0x2452d2,_0x455fc4,!![]);}catch(_0x50dbac){return BPromise[_0xfff7('0x1f')](_0x50dbac);}return _0x2452d2[_0xfff7('0x20')]();};}function saveUpdates(_0x2ffcd3,_0x399c94){return function(_0x4a17f2){if(_0x4a17f2){return _0x4a17f2[_0xfff7('0x21')](_0x2ffcd3)[_0xfff7('0x22')](function(_0x302be3){return _0x302be3;});}return null;};}function removeEntity(_0x5d9642,_0x6cb62d){return function(_0x5d4274){if(_0x5d4274){return _0x5d4274[_0xfff7('0x23')]()[_0xfff7('0x22')](function(){var _0x26095f=_0x5d4274[_0xfff7('0x24')]({'plain':!![]});var _0xa424b7='Scheduler';return db[_0xfff7('0x25')][_0xfff7('0x23')]({'where':{'type':_0xa424b7,'resourceId':_0x26095f['id']}})[_0xfff7('0x22')](function(){return _0x5d4274;});})[_0xfff7('0x22')](function(){_0x5d9642[_0xfff7('0x16')](0xcc)[_0xfff7('0x26')]();});}};}function handleEntityNotFound(_0x40b138,_0x580fb1){return function(_0xec3513){if(!_0xec3513){_0x40b138['sendStatus'](0x194);}return _0xec3513;};}function handleError(_0x133650,_0x39cb80){_0x39cb80=_0x39cb80||0x1f4;return function(_0x1b3869){logger[_0xfff7('0x27')](_0x1b3869[_0xfff7('0x28')]);if(_0x1b3869['name']){delete _0x1b3869[_0xfff7('0x29')];}_0x133650[_0xfff7('0x16')](_0x39cb80)[_0xfff7('0x2a')](_0x1b3869);};}exports['index']=function(_0xf5a9ad,_0x26d66a){var _0x4edfaa={},_0x459957={},_0x5d4c9d={'count':0x0,'rows':[]};var _0x52cf37=_[_0xfff7('0x2b')](db[_0xfff7('0x2c')][_0xfff7('0x2d')],function(_0x54dc54){return{'name':_0x54dc54[_0xfff7('0x2e')],'type':_0x54dc54[_0xfff7('0x2f')][_0xfff7('0x30')]};});_0x459957['model']=_[_0xfff7('0x2b')](_0x52cf37,'name');_0x459957[_0xfff7('0x31')]=_[_0xfff7('0x32')](_0xf5a9ad[_0xfff7('0x31')]);_0x459957[_0xfff7('0x33')]=_[_0xfff7('0x34')](_0x459957[_0xfff7('0x35')],_0x459957[_0xfff7('0x31')]);_0x4edfaa['attributes']=_[_0xfff7('0x34')](_0x459957['model'],qs[_0xfff7('0x36')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x36')]));_0x4edfaa[_0xfff7('0x37')]=_0x4edfaa[_0xfff7('0x37')][_0xfff7('0x38')]?_0x4edfaa[_0xfff7('0x37')]:_0x459957[_0xfff7('0x35')];if(!_0xf5a9ad['query']['hasOwnProperty'](_0xfff7('0x39'))){_0x4edfaa[_0xfff7('0x1a')]=qs[_0xfff7('0x1a')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x1a')]);_0x4edfaa[_0xfff7('0x18')]=qs[_0xfff7('0x18')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x18')]);}_0x4edfaa[_0xfff7('0x3a')]=qs[_0xfff7('0x3b')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x3b')]);_0x4edfaa[_0xfff7('0x3c')]=qs['filters'](_[_0xfff7('0x3d')](_0xf5a9ad['query'],_0x459957[_0xfff7('0x33')]),_0x52cf37);if(_0xf5a9ad[_0xfff7('0x31')]['filter']){_0x4edfaa['where']=_['merge'](_0x4edfaa[_0xfff7('0x3c')],{'$or':_[_0xfff7('0x2b')](_0x52cf37,function(_0x31f765){if(_0x31f765[_0xfff7('0x2f')]!==_0xfff7('0x3e')){var _0x59f471={};_0x59f471[_0x31f765[_0xfff7('0x29')]]={'$like':'%'+_0xf5a9ad[_0xfff7('0x31')]['filter']+'%'};return _0x59f471;}})});}_0x4edfaa=_[_0xfff7('0x3f')]({},_0x4edfaa,_0xf5a9ad[_0xfff7('0x40')]);var _0x5cd21a={'where':_0x4edfaa[_0xfff7('0x3c')]};return db['Schedule']['count'](_0x5cd21a)[_0xfff7('0x22')](function(_0x2b07f1){_0x5d4c9d[_0xfff7('0x1b')]=_0x2b07f1;if(_0xf5a9ad['query'][_0xfff7('0x41')]){_0x4edfaa[_0xfff7('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4edfaa);})['then'](function(_0x1579c3){_0x5d4c9d['rows']=_0x1579c3;return _0x5d4c9d;})['then'](respondWithFilteredResult(_0x26d66a,_0x4edfaa))[_0xfff7('0x43')](handleError(_0x26d66a,null));};exports[_0xfff7('0x44')]=function(_0xa10e,_0x432f49){var _0x524585={'raw':![],'where':{'id':_0xa10e[_0xfff7('0x45')]['id']}},_0x2e4eba={};_0x2e4eba[_0xfff7('0x35')]=_[_0xfff7('0x32')](db[_0xfff7('0x2c')][_0xfff7('0x2d')]);_0x2e4eba['query']=_[_0xfff7('0x32')](_0xa10e[_0xfff7('0x31')]);_0x2e4eba[_0xfff7('0x33')]=_[_0xfff7('0x34')](_0x2e4eba[_0xfff7('0x35')],_0x2e4eba[_0xfff7('0x31')]);_0x524585[_0xfff7('0x37')]=_[_0xfff7('0x34')](_0x2e4eba['model'],qs['fields'](_0xa10e[_0xfff7('0x31')][_0xfff7('0x36')]));_0x524585[_0xfff7('0x37')]=_0x524585[_0xfff7('0x37')][_0xfff7('0x38')]?_0x524585[_0xfff7('0x37')]:_0x2e4eba[_0xfff7('0x35')];if(_0xa10e[_0xfff7('0x31')]['includeAll']){_0x524585['include']=[{'all':!![]}];}_0x524585=_[_0xfff7('0x3f')]({},_0x524585,_0xa10e[_0xfff7('0x40')]);return db[_0xfff7('0x2c')][_0xfff7('0x46')](_0x524585)['then'](handleEntityNotFound(_0x432f49,null))[_0xfff7('0x22')](respondWithResult(_0x432f49,null))[_0xfff7('0x43')](handleError(_0x432f49,null));};exports[_0xfff7('0x47')]=function(_0x2c0306,_0x393013){return db[_0xfff7('0x2c')]['create'](_0x2c0306[_0xfff7('0x48')],{})['then'](function(_0x48afdf){var _0x20cbb2=_0x2c0306[_0xfff7('0x49')][_0xfff7('0x24')]({'plain':!![]});if(!_0x20cbb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20cbb2[_0xfff7('0x4a')]==='user'){var _0x204b53=_0x48afdf[_0xfff7('0x24')]({'plain':!![]});var _0x30b442=_0xfff7('0x4b');return db[_0xfff7('0x4c')]['find']({'where':{'name':_0x30b442,'userProfileId':_0x20cbb2[_0xfff7('0x4d')]},'raw':!![]})['then'](function(_0x508161){if(_0x508161&&_0x508161['autoAssociation']===0x0){return db[_0xfff7('0x25')][_0xfff7('0x47')]({'name':_0x204b53[_0xfff7('0x29')],'resourceId':_0x204b53['id'],'type':_0x508161[_0xfff7('0x29')],'sectionId':_0x508161['id']},{})['then'](function(){return _0x48afdf;});}else{return _0x48afdf;}})[_0xfff7('0x43')](function(_0xee5b67){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee5b67);throw _0xee5b67;});}return _0x48afdf;})[_0xfff7('0x22')](respondWithResult(_0x393013,0xc9))[_0xfff7('0x43')](handleError(_0x393013,null));};exports[_0xfff7('0x21')]=function(_0x45d243,_0x3b423b){if(_0x45d243[_0xfff7('0x48')]['id']){delete _0x45d243[_0xfff7('0x48')]['id'];}return db[_0xfff7('0x2c')][_0xfff7('0x46')]({'where':{'id':_0x45d243[_0xfff7('0x45')]['id']}})[_0xfff7('0x22')](handleEntityNotFound(_0x3b423b,null))[_0xfff7('0x22')](saveUpdates(_0x45d243[_0xfff7('0x48')],null))[_0xfff7('0x22')](respondWithResult(_0x3b423b,null))[_0xfff7('0x43')](handleError(_0x3b423b,null));};exports[_0xfff7('0x23')]=function(_0x2546ad,_0x353b61){return db[_0xfff7('0x2c')]['find']({'where':{'id':_0x2546ad['params']['id']}})[_0xfff7('0x22')](handleEntityNotFound(_0x353b61,null))['then'](removeEntity(_0x353b61,null))[_0xfff7('0x43')](handleError(_0x353b61,null));};exports[_0xfff7('0x4e')]=function(_0x12f649,_0xd370b3,_0x5ac54b){var _0x329bb0=require(_0xfff7('0x4f'));return db['Schedule']['find']({'where':{'id':_0x12f649[_0xfff7('0x45')]['id']},'raw':!![]})[_0xfff7('0x22')](handleEntityNotFound(_0xd370b3,null))[_0xfff7('0x22')](function(){_0x329bb0[_0xfff7('0x4e')](_0x12f649[_0xfff7('0x45')]['id']);})[_0xfff7('0x22')](respondWithStatusCode(_0xd370b3,null))[_0xfff7('0x43')](handleError(_0xd370b3,null));}; \ No newline at end of file +var _0xda56=['update','then','destroy','get','UserProfileResource','sendStatus','name','send','Schedule','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','options','find','create','user','role','Scheduler','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x2a84d1,_0x2e6209){var _0x2eaadb=function(_0x21f65f){while(--_0x21f65f){_0x2a84d1['push'](_0x2a84d1['shift']());}};_0x2eaadb(++_0x2e6209);}(_0xda56,0x80));var _0x6da5=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0xda56[_0x337dd9];return _0x20f4fc;};'use strict';var emlformat=require(_0x6da5('0x0'));var rimraf=require(_0x6da5('0x1'));var zipdir=require(_0x6da5('0x2'));var jsonpatch=require(_0x6da5('0x3'));var rp=require(_0x6da5('0x4'));var moment=require(_0x6da5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6da5('0x6'));var util=require(_0x6da5('0x7'));var path=require(_0x6da5('0x8'));var sox=require(_0x6da5('0x9'));var csv=require(_0x6da5('0xa'));var ejs=require(_0x6da5('0xb'));var fs=require('fs');var fs_extra=require(_0x6da5('0xc'));var _=require(_0x6da5('0xd'));var squel=require('squel');var crypto=require(_0x6da5('0xe'));var jsforce=require(_0x6da5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6da5('0xa'));var querystring=require(_0x6da5('0x10'));var Papa=require(_0x6da5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6da5('0x12'));var as=require(_0x6da5('0x13'));var hardwareService=require(_0x6da5('0x14'));var logger=require(_0x6da5('0x15'))(_0x6da5('0x16'));var utils=require(_0x6da5('0x17'));var config=require(_0x6da5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6da5('0x19'))['db'];function respondWithStatusCode(_0x3c833f,_0x59500a){_0x59500a=_0x59500a||0xcc;return function(_0x308f97){if(_0x308f97){return _0x3c833f['sendStatus'](_0x59500a);}return _0x3c833f[_0x6da5('0x1a')](_0x59500a)[_0x6da5('0x1b')]();};}function respondWithResult(_0x16953e,_0x330a42){_0x330a42=_0x330a42||0xc8;return function(_0x2f7d40){if(_0x2f7d40){return _0x16953e[_0x6da5('0x1a')](_0x330a42)['json'](_0x2f7d40);}};}function respondWithFilteredResult(_0x451f44,_0x3c13fc){return function(_0x2dae0f){if(_0x2dae0f){var _0x1d41f5=typeof _0x3c13fc[_0x6da5('0x1c')]===_0x6da5('0x1d')&&typeof _0x3c13fc[_0x6da5('0x1e')]===_0x6da5('0x1d');var _0x164988=_0x2dae0f[_0x6da5('0x1f')];var _0x3b51bd=_0x1d41f5?0x0:_0x3c13fc[_0x6da5('0x1c')];var _0xa40d00=_0x1d41f5?_0x2dae0f['count']:_0x3c13fc['offset']+_0x3c13fc[_0x6da5('0x1e')];var _0x973777;if(_0xa40d00>=_0x164988){_0xa40d00=_0x164988;_0x973777=0xc8;}else{_0x973777=0xce;}_0x451f44[_0x6da5('0x1a')](_0x973777);return _0x451f44[_0x6da5('0x20')]('Content-Range',_0x3b51bd+'-'+_0xa40d00+'/'+_0x164988)[_0x6da5('0x21')](_0x2dae0f);}return null;};}function patchUpdates(_0x4d1dd9){return function(_0x5e8136){try{jsonpatch[_0x6da5('0x22')](_0x5e8136,_0x4d1dd9,!![]);}catch(_0x5d5d5e){return BPromise[_0x6da5('0x23')](_0x5d5d5e);}return _0x5e8136['save']();};}function saveUpdates(_0x580d45,_0x56dd6e){return function(_0x480c7d){if(_0x480c7d){return _0x480c7d[_0x6da5('0x24')](_0x580d45)[_0x6da5('0x25')](function(_0x9ae910){return _0x9ae910;});}return null;};}function removeEntity(_0x433ded,_0x39eeed){return function(_0x5935f4){if(_0x5935f4){return _0x5935f4[_0x6da5('0x26')]()['then'](function(){var _0x4df7a3=_0x5935f4[_0x6da5('0x27')]({'plain':!![]});var _0x57fcb5='Scheduler';return db[_0x6da5('0x28')]['destroy']({'where':{'type':_0x57fcb5,'resourceId':_0x4df7a3['id']}})[_0x6da5('0x25')](function(){return _0x5935f4;});})['then'](function(){_0x433ded[_0x6da5('0x1a')](0xcc)[_0x6da5('0x1b')]();});}};}function handleEntityNotFound(_0x13c660,_0x30509f){return function(_0xd991eb){if(!_0xd991eb){_0x13c660[_0x6da5('0x29')](0x194);}return _0xd991eb;};}function handleError(_0x59c80b,_0x5e0a8e){_0x5e0a8e=_0x5e0a8e||0x1f4;return function(_0x5ab024){logger['error'](_0x5ab024['stack']);if(_0x5ab024['name']){delete _0x5ab024[_0x6da5('0x2a')];}_0x59c80b[_0x6da5('0x1a')](_0x5e0a8e)[_0x6da5('0x2b')](_0x5ab024);};}exports['index']=function(_0x3da242,_0x52a561){var _0x3eb441={},_0xe8887c={},_0x2b8d2d={'count':0x0,'rows':[]};var _0x556e18=_['map'](db[_0x6da5('0x2c')]['rawAttributes'],function(_0xa56b5d){return{'name':_0xa56b5d['fieldName'],'type':_0xa56b5d[_0x6da5('0x2d')]['key']};});_0xe8887c[_0x6da5('0x2e')]=_['map'](_0x556e18,_0x6da5('0x2a'));_0xe8887c[_0x6da5('0x2f')]=_[_0x6da5('0x30')](_0x3da242['query']);_0xe8887c[_0x6da5('0x31')]=_['intersection'](_0xe8887c[_0x6da5('0x2e')],_0xe8887c['query']);_0x3eb441[_0x6da5('0x32')]=_[_0x6da5('0x33')](_0xe8887c['model'],qs[_0x6da5('0x34')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x34')]));_0x3eb441[_0x6da5('0x32')]=_0x3eb441[_0x6da5('0x32')][_0x6da5('0x35')]?_0x3eb441['attributes']:_0xe8887c[_0x6da5('0x2e')];if(!_0x3da242[_0x6da5('0x2f')][_0x6da5('0x36')]('nolimit')){_0x3eb441[_0x6da5('0x1e')]=qs[_0x6da5('0x1e')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x1e')]);_0x3eb441[_0x6da5('0x1c')]=qs[_0x6da5('0x1c')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x1c')]);}_0x3eb441['order']=qs[_0x6da5('0x37')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x37')]);_0x3eb441[_0x6da5('0x38')]=qs['filters'](_[_0x6da5('0x39')](_0x3da242[_0x6da5('0x2f')],_0xe8887c[_0x6da5('0x31')]),_0x556e18);if(_0x3da242[_0x6da5('0x2f')][_0x6da5('0x3a')]){_0x3eb441[_0x6da5('0x38')]=_[_0x6da5('0x3b')](_0x3eb441[_0x6da5('0x38')],{'$or':_[_0x6da5('0x3c')](_0x556e18,function(_0x405c63){if(_0x405c63[_0x6da5('0x2d')]!==_0x6da5('0x3d')){var _0x11f2b6={};_0x11f2b6[_0x405c63['name']]={'$like':'%'+_0x3da242[_0x6da5('0x2f')][_0x6da5('0x3a')]+'%'};return _0x11f2b6;}})});}_0x3eb441=_[_0x6da5('0x3b')]({},_0x3eb441,_0x3da242['options']);var _0x2a665a={'where':_0x3eb441[_0x6da5('0x38')]};return db[_0x6da5('0x2c')][_0x6da5('0x1f')](_0x2a665a)['then'](function(_0xf5ae98){_0x2b8d2d[_0x6da5('0x1f')]=_0xf5ae98;if(_0x3da242['query'][_0x6da5('0x3e')]){_0x3eb441[_0x6da5('0x3f')]=[{'all':!![]}];}return db[_0x6da5('0x2c')][_0x6da5('0x40')](_0x3eb441);})[_0x6da5('0x25')](function(_0x4f216c){_0x2b8d2d[_0x6da5('0x41')]=_0x4f216c;return _0x2b8d2d;})[_0x6da5('0x25')](respondWithFilteredResult(_0x52a561,_0x3eb441))[_0x6da5('0x42')](handleError(_0x52a561,null));};exports['show']=function(_0x43c73e,_0x55a873){var _0x54176b={'raw':![],'where':{'id':_0x43c73e['params']['id']}},_0x282791={};_0x282791['model']=_['keys'](db[_0x6da5('0x2c')][_0x6da5('0x43')]);_0x282791['query']=_[_0x6da5('0x30')](_0x43c73e[_0x6da5('0x2f')]);_0x282791[_0x6da5('0x31')]=_[_0x6da5('0x33')](_0x282791[_0x6da5('0x2e')],_0x282791[_0x6da5('0x2f')]);_0x54176b[_0x6da5('0x32')]=_[_0x6da5('0x33')](_0x282791[_0x6da5('0x2e')],qs[_0x6da5('0x34')](_0x43c73e[_0x6da5('0x2f')][_0x6da5('0x34')]));_0x54176b[_0x6da5('0x32')]=_0x54176b[_0x6da5('0x32')][_0x6da5('0x35')]?_0x54176b[_0x6da5('0x32')]:_0x282791[_0x6da5('0x2e')];if(_0x43c73e['query'][_0x6da5('0x3e')]){_0x54176b['include']=[{'all':!![]}];}_0x54176b=_[_0x6da5('0x3b')]({},_0x54176b,_0x43c73e[_0x6da5('0x44')]);return db[_0x6da5('0x2c')][_0x6da5('0x45')](_0x54176b)[_0x6da5('0x25')](handleEntityNotFound(_0x55a873,null))[_0x6da5('0x25')](respondWithResult(_0x55a873,null))[_0x6da5('0x42')](handleError(_0x55a873,null));};exports['create']=function(_0x37d66d,_0x31cdb6){return db[_0x6da5('0x2c')][_0x6da5('0x46')](_0x37d66d['body'],{})['then'](function(_0x165d87){var _0x1ef3d8=_0x37d66d[_0x6da5('0x47')][_0x6da5('0x27')]({'plain':!![]});if(!_0x1ef3d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ef3d8[_0x6da5('0x48')]==='user'){var _0x4a2581=_0x165d87[_0x6da5('0x27')]({'plain':!![]});var _0x5a6a9a=_0x6da5('0x49');return db[_0x6da5('0x4a')][_0x6da5('0x45')]({'where':{'name':_0x5a6a9a,'userProfileId':_0x1ef3d8['userProfileId']},'raw':!![]})[_0x6da5('0x25')](function(_0x1a02d7){if(_0x1a02d7&&_0x1a02d7[_0x6da5('0x4b')]===0x0){return db['UserProfileResource'][_0x6da5('0x46')]({'name':_0x4a2581[_0x6da5('0x2a')],'resourceId':_0x4a2581['id'],'type':_0x1a02d7[_0x6da5('0x2a')],'sectionId':_0x1a02d7['id']},{})[_0x6da5('0x25')](function(){return _0x165d87;});}else{return _0x165d87;}})[_0x6da5('0x42')](function(_0x48038f){logger[_0x6da5('0x4c')](_0x6da5('0x4d'),_0x48038f);throw _0x48038f;});}return _0x165d87;})[_0x6da5('0x25')](respondWithResult(_0x31cdb6,0xc9))[_0x6da5('0x42')](handleError(_0x31cdb6,null));};exports['update']=function(_0x3f738d,_0x2a4a17){if(_0x3f738d[_0x6da5('0x4e')]['id']){delete _0x3f738d['body']['id'];}return db[_0x6da5('0x2c')][_0x6da5('0x45')]({'where':{'id':_0x3f738d['params']['id']}})[_0x6da5('0x25')](handleEntityNotFound(_0x2a4a17,null))[_0x6da5('0x25')](saveUpdates(_0x3f738d[_0x6da5('0x4e')],null))[_0x6da5('0x25')](respondWithResult(_0x2a4a17,null))[_0x6da5('0x42')](handleError(_0x2a4a17,null));};exports[_0x6da5('0x26')]=function(_0x132f8c,_0x6cfa9a){return db[_0x6da5('0x2c')][_0x6da5('0x45')]({'where':{'id':_0x132f8c[_0x6da5('0x4f')]['id']}})[_0x6da5('0x25')](handleEntityNotFound(_0x6cfa9a,null))[_0x6da5('0x25')](removeEntity(_0x6cfa9a,null))[_0x6da5('0x42')](handleError(_0x6cfa9a,null));};exports[_0x6da5('0x50')]=function(_0x22ffa9,_0xe30fce,_0x56096b){var _0x5368d4=require(_0x6da5('0x51'));return db['Schedule'][_0x6da5('0x45')]({'where':{'id':_0x22ffa9[_0x6da5('0x4f')]['id']},'raw':!![]})[_0x6da5('0x25')](handleEntityNotFound(_0xe30fce,null))['then'](function(){_0x5368d4[_0x6da5('0x50')](_0x22ffa9[_0x6da5('0x4f')]['id']);})[_0x6da5('0x25')](respondWithStatusCode(_0xe30fce,null))[_0x6da5('0x42')](handleError(_0xe30fce,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ebc9101..3abfd63 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 _0xf5b1=['api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger'];(function(_0x3c240d,_0x398533){var _0x2081fa=function(_0x296e27){while(--_0x296e27){_0x3c240d['push'](_0x3c240d['shift']());}};_0x2081fa(++_0x398533);}(_0xf5b1,0x19f));var _0x1f5b=function(_0x4f58a0,_0xb4fb09){_0x4f58a0=_0x4f58a0-0x0;var _0x5ebf29=_0xf5b1[_0x4f58a0];return _0x5ebf29;};'use strict';var _=require(_0x1f5b('0x0'));var util=require(_0x1f5b('0x1'));var logger=require(_0x1f5b('0x2'))(_0x1f5b('0x3'));var moment=require(_0x1f5b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f5b('0x6'));var config=require(_0x1f5b('0x7'));var attributes=require(_0x1f5b('0x8'));module[_0x1f5b('0x9')]=function(_0x477a01,_0x4845ba){return _0x477a01['define'](_0x1f5b('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c87=['define','Schedule','tools_schedules','../../config/logger','api','bluebird','path','../../config/environment','./schedule.attributes'];(function(_0x3c8909,_0x145aa7){var _0x51dfa8=function(_0x23f07a){while(--_0x23f07a){_0x3c8909['push'](_0x3c8909['shift']());}};_0x51dfa8(++_0x145aa7);}(_0x3c87,0x198));var _0x73c8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x3c87[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73c8('0x0'))(_0x73c8('0x1'));var moment=require('moment');var BPromise=require(_0x73c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73c8('0x3'));var rimraf=require('rimraf');var config=require(_0x73c8('0x4'));var attributes=require(_0x73c8('0x5'));module['exports']=function(_0x55d573,_0x1874dc){return _0x55d573[_0x73c8('0x6')](_0x73c8('0x7'),attributes,{'tableName':_0x73c8('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 caf6d9e..776aa0a 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 _0x537b=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x537b,0x1a2));var _0xb537=function(_0x241ebe,_0x4fc0d4){_0x241ebe=_0x241ebe-0x0;var _0x4ec09a=_0x537b[_0x241ebe];return _0x4ec09a;};'use strict';var _=require(_0xb537('0x0'));var util=require(_0xb537('0x1'));var moment=require(_0xb537('0x2'));var BPromise=require(_0xb537('0x3'));var rs=require(_0xb537('0x4'));var fs=require('fs');var Redis=require(_0xb537('0x5'));var db=require(_0xb537('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb537('0x7'))(_0xb537('0x8'));var config=require('../../config/environment');var jayson=require(_0xb537('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46094d,_0x4286b1,_0x321100){return new BPromise(function(_0x240804,_0x39f063){return client['request'](_0x46094d,_0x321100)['then'](function(_0x3b2ed2){logger['info'](_0xb537('0xa'),_0x4286b1,_0xb537('0xb'));logger['debug'](_0xb537('0xc'),_0x4286b1,_0xb537('0xb'),JSON['stringify'](_0x3b2ed2));if(_0x3b2ed2[_0xb537('0xd')]){if(_0x3b2ed2['error']['code']===0x1f4){logger[_0xb537('0xd')](_0xb537('0xa'),_0x4286b1,_0x3b2ed2[_0xb537('0xd')]['message']);return _0x39f063(_0x3b2ed2[_0xb537('0xd')]['message']);}logger[_0xb537('0xd')]('Schedule,\x20%s,\x20%s',_0x4286b1,_0x3b2ed2[_0xb537('0xd')][_0xb537('0xe')]);return _0x240804(_0x3b2ed2[_0xb537('0xd')][_0xb537('0xe')]);}else{logger[_0xb537('0xf')](_0xb537('0xa'),_0x4286b1,_0xb537('0xb'));_0x240804(_0x3b2ed2[_0xb537('0x10')][_0xb537('0xe')]);}})[_0xb537('0x11')](function(_0x4c02d8){logger['error'](_0xb537('0xa'),_0x4286b1,_0x4c02d8);_0x39f063(_0x4c02d8);});});} \ No newline at end of file +var _0xec7c=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x2c7b5c,_0x331adf){var _0x1df5f3=function(_0x4fc30b){while(--_0x4fc30b){_0x2c7b5c['push'](_0x2c7b5c['shift']());}};_0x1df5f3(++_0x331adf);}(_0xec7c,0x163));var _0xcec7=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0xec7c[_0x239b5e];return _0x577f3d;};'use strict';var _=require(_0xcec7('0x0'));var util=require(_0xcec7('0x1'));var moment=require('moment');var BPromise=require(_0xcec7('0x2'));var rs=require(_0xcec7('0x3'));var fs=require('fs');var Redis=require(_0xcec7('0x4'));var db=require(_0xcec7('0x5'))['db'];var utils=require(_0xcec7('0x6'));var logger=require(_0xcec7('0x7'))(_0xcec7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcec7('0x9'));var client=jayson[_0xcec7('0xa')][_0xcec7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32dcd8,_0x2f7966,_0x2dda08){return new BPromise(function(_0x285b4a,_0x1875e5){return client[_0xcec7('0xc')](_0x32dcd8,_0x2dda08)['then'](function(_0x43f6c2){logger[_0xcec7('0xd')](_0xcec7('0xe'),_0x2f7966,_0xcec7('0xf'));logger[_0xcec7('0x10')](_0xcec7('0x11'),_0x2f7966,_0xcec7('0xf'),JSON['stringify'](_0x43f6c2));if(_0x43f6c2[_0xcec7('0x12')]){if(_0x43f6c2['error'][_0xcec7('0x13')]===0x1f4){logger['error'](_0xcec7('0xe'),_0x2f7966,_0x43f6c2[_0xcec7('0x12')]['message']);return _0x1875e5(_0x43f6c2[_0xcec7('0x12')]['message']);}logger[_0xcec7('0x12')]('Schedule,\x20%s,\x20%s',_0x2f7966,_0x43f6c2[_0xcec7('0x12')][_0xcec7('0x14')]);return _0x285b4a(_0x43f6c2[_0xcec7('0x12')][_0xcec7('0x14')]);}else{logger[_0xcec7('0xd')]('Schedule,\x20%s,\x20%s',_0x2f7966,'request\x20sent');_0x285b4a(_0x43f6c2[_0xcec7('0x15')][_0xcec7('0x14')]);}})['catch'](function(_0x18ac96){logger[_0xcec7('0x12')]('Schedule,\x20%s,\x20%s',_0x2f7966,_0x18ac96);_0x1875e5(_0x18ac96);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 10834ca..bf5c88a 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 _0xf3e6=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','download'];(function(_0x8121fa,_0x395cdf){var _0x37ebd5=function(_0x2fb41e){while(--_0x2fb41e){_0x8121fa['push'](_0x8121fa['shift']());}};_0x37ebd5(++_0x395cdf);}(_0xf3e6,0x10f));var _0x6f3e=function(_0x4224e2,_0x340a2b){_0x4224e2=_0x4224e2-0x0;var _0x309e5d=_0xf3e6[_0x4224e2];return _0x309e5d;};'use strict';var multer=require(_0x6f3e('0x0'));var util=require(_0x6f3e('0x1'));var path=require(_0x6f3e('0x2'));var timeout=require(_0x6f3e('0x3'));var express=require(_0x6f3e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6f3e('0x5'));var interaction=require(_0x6f3e('0x6'));var config=require(_0x6f3e('0x7'));var controller=require('./screenRecording.controller');router[_0x6f3e('0x8')]('/',auth[_0x6f3e('0x9')](),controller['index']);router[_0x6f3e('0x8')](_0x6f3e('0xa'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xb')]);router['get'](_0x6f3e('0xc'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xd')]);router[_0x6f3e('0x8')]('/:id/download',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xe')]);router[_0x6f3e('0xf')]('/',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x10')]);router[_0x6f3e('0x11')]('/:id',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x12')]);router[_0x6f3e('0x13')](_0x6f3e('0xc'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x14')]);module[_0x6f3e('0x15')]=router; \ No newline at end of file +var _0xb377=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','download','post','create','put','/:id','update','exports'];(function(_0x1d1d0a,_0x43d9b6){var _0x42e8a4=function(_0x23358e){while(--_0x23358e){_0x1d1d0a['push'](_0x1d1d0a['shift']());}};_0x42e8a4(++_0x43d9b6);}(_0xb377,0xf7));var _0x7b37=function(_0x51ce7a,_0x56c33b){_0x51ce7a=_0x51ce7a-0x0;var _0x5d2992=_0xb377[_0x51ce7a];return _0x5d2992;};'use strict';var multer=require('multer');var util=require(_0x7b37('0x0'));var path=require('path');var timeout=require(_0x7b37('0x1'));var express=require('express');var router=express[_0x7b37('0x2')]();var fs_extra=require(_0x7b37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b37('0x4'));var config=require('../../config/environment');var controller=require(_0x7b37('0x5'));router[_0x7b37('0x6')]('/',auth[_0x7b37('0x7')](),controller[_0x7b37('0x8')]);router['get'](_0x7b37('0x9'),auth[_0x7b37('0x7')](),controller[_0x7b37('0xa')]);router[_0x7b37('0x6')]('/:id',auth[_0x7b37('0x7')](),controller[_0x7b37('0xb')]);router[_0x7b37('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')]('/',auth[_0x7b37('0x7')](),controller[_0x7b37('0xe')]);router[_0x7b37('0xf')](_0x7b37('0x10'),auth[_0x7b37('0x7')](),controller[_0x7b37('0x11')]);router['delete'](_0x7b37('0x10'),auth[_0x7b37('0x7')](),controller['destroy']);module[_0x7b37('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7fadcfd..6b20c1f 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 _0x119c=['getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','value','extname'];(function(_0x8faedc,_0x2198a7){var _0xbeba54=function(_0x27232a){while(--_0x27232a){_0x8faedc['push'](_0x8faedc['shift']());}};_0xbeba54(++_0x2198a7);}(_0x119c,0xea));var _0xc119=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x119c[_0x258257];return _0xafb58a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc119('0x0'));var path=require('path');var config=require(_0xc119('0x1'));module[_0xc119('0x2')]={'format':{'type':Sequelize[_0xc119('0x3')],'get':function(){return this['getDataValue'](_0xc119('0x4'))?path[_0xc119('0x5')](this[_0xc119('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc119('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc119('0x7')],'set':function(_0x57bc8a){var _0x16b3d2=_0x57bc8a[_0xc119('0x8')](/\\/g,'/');this[_0xc119('0x9')](_0xc119('0x4'),_0x16b3d2);}},'rating':{'type':Sequelize[_0xc119('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc119('0xa')],'set':function(_0x367745){this[_0xc119('0x9')](_0xc119('0xb'),moment()[_0xc119('0xc')](_0x367745,'ms'));this[_0xc119('0x9')]('closedAt',moment());this[_0xc119('0x9')]('duration',_0x367745);}},'startedAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this[_0xc119('0x6')](_0xc119('0xb')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xc119('0x11')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}},'createdAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this['getDataValue'](_0xc119('0x12')))['format'](_0xc119('0xf'))[_0xc119('0x10')]();}},'updatedAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this[_0xc119('0x6')](_0xc119('0x13')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}}}; \ No newline at end of file +var _0x253d=['toString','sequelize','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','duration','DATE','startedAt','format','closedAt'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x253d,0x1b3));var _0xd253=function(_0x1f60c5,_0x402257){_0x1f60c5=_0x1f60c5-0x0;var _0x47ee42=_0x253d[_0x1f60c5];return _0x47ee42;};'use strict';var Sequelize=require(_0xd253('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xd253('0x1')],'get':function(){return this[_0xd253('0x2')](_0xd253('0x3'))?path[_0xd253('0x4')](this[_0xd253('0x2')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xd253('0x5')]},'channel':{'type':Sequelize[_0xd253('0x5')]},'value':{'type':Sequelize[_0xd253('0x5')],'set':function(_0x17589a){var _0xf4b457=_0x17589a['replace'](/\\/g,'/');this[_0xd253('0x6')](_0xd253('0x3'),_0xf4b457);}},'rating':{'type':Sequelize[_0xd253('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd253('0x7')],'set':function(_0x351047){this[_0xd253('0x6')]('startedAt',moment()['subtract'](_0x351047,'ms'));this[_0xd253('0x6')]('closedAt',moment());this[_0xd253('0x6')](_0xd253('0x8'),_0x351047);}},'startedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')](_0xd253('0xa')))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')](_0xd253('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}},'createdAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')]('createdAt'))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}},'updatedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')]('updatedAt'))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index de3d73c..17dd5ed 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 _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file +var _0x9a19=['limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','duration','value','find','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x9a19,0x114));var _0x99a1=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x9a19[_0x16bb4b];return _0x8aeb84;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['index']=function(_0xf41b0d,_0x499eef){var _0x255197={},_0x1137f2={},_0x26fbae={'count':0x0,'rows':[]};var _0x523668=_[_0x99a1('0x29')](db[_0x99a1('0x2a')]['rawAttributes'],function(_0x37514e){return{'name':_0x37514e[_0x99a1('0x2b')],'type':_0x37514e[_0x99a1('0x2c')][_0x99a1('0x2d')]};});_0x1137f2[_0x99a1('0x2e')]=_[_0x99a1('0x2f')](_[_0x99a1('0x29')](_0x523668,_0x99a1('0x27')),['format']);_0x1137f2['query']=_[_0x99a1('0x30')](_0xf41b0d['query']);_0x1137f2[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x1137f2['model'],_0x1137f2[_0x99a1('0x33')]);_0x255197[_0x99a1('0x34')]=_[_0x99a1('0x32')](_0x1137f2[_0x99a1('0x2e')],qs[_0x99a1('0x35')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x35')]));_0x255197[_0x99a1('0x34')]=_0x255197[_0x99a1('0x34')][_0x99a1('0x36')]?_0x255197[_0x99a1('0x34')]:_0x1137f2[_0x99a1('0x2e')];if(!_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x37')]('nolimit')){_0x255197['limit']=qs[_0x99a1('0x1e')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1e')]);_0x255197[_0x99a1('0x1c')]=qs[_0x99a1('0x1c')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1c')]);}_0x255197['order']=qs[_0x99a1('0x38')](_0xf41b0d[_0x99a1('0x33')]['sort']);_0x255197[_0x99a1('0x39')]=qs[_0x99a1('0x31')](_[_0x99a1('0x3a')](_0xf41b0d[_0x99a1('0x33')],_0x1137f2[_0x99a1('0x31')]),_0x523668);if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]){_0x255197[_0x99a1('0x39')]=_[_0x99a1('0x3c')](_0x255197[_0x99a1('0x39')],{'$or':_[_0x99a1('0x29')](_0x523668,function(_0x152969){if(_0x152969[_0x99a1('0x2c')]!=='VIRTUAL'){var _0x5553e4={};_0x5553e4[_0x152969['name']]={'$like':'%'+_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]+'%'};return _0x5553e4;}})});}_0x255197=_[_0x99a1('0x3c')]({},_0x255197,_0xf41b0d[_0x99a1('0x3d')]);var _0x40613a={'where':_0x255197['where']};return db[_0x99a1('0x2a')][_0x99a1('0x1f')](_0x40613a)[_0x99a1('0x23')](function(_0x51efe5){_0x26fbae['count']=_0x51efe5;if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x255197[_0x99a1('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x99a1('0x40')](_0x255197);})[_0x99a1('0x23')](function(_0x1b5d2d){_0x26fbae[_0x99a1('0x41')]=_0x1b5d2d;return _0x26fbae;})[_0x99a1('0x23')](respondWithFilteredResult(_0x499eef,_0x255197))[_0x99a1('0x42')](handleError(_0x499eef,null));};exports[_0x99a1('0x43')]=function(_0x29d0a0,_0x1c4ce4){var _0x2be9e3={'raw':![],'where':{'id':_0x29d0a0[_0x99a1('0x44')]['id']}},_0x4b40e1={};_0x4b40e1[_0x99a1('0x2e')]=_[_0x99a1('0x30')](db['ScreenRecording'][_0x99a1('0x45')]);_0x4b40e1['query']=_[_0x99a1('0x30')](_0x29d0a0[_0x99a1('0x33')]);_0x4b40e1[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x4b40e1[_0x99a1('0x2e')],_0x4b40e1[_0x99a1('0x33')]);_0x2be9e3['attributes']=_[_0x99a1('0x32')](_0x4b40e1['model'],qs[_0x99a1('0x35')](_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x35')]));_0x2be9e3[_0x99a1('0x34')]=_0x2be9e3[_0x99a1('0x34')][_0x99a1('0x36')]?_0x2be9e3[_0x99a1('0x34')]:_0x4b40e1[_0x99a1('0x2e')];if(_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x2be9e3[_0x99a1('0x3f')]=[{'all':!![]}];}_0x2be9e3=_['merge']({},_0x2be9e3,_0x29d0a0[_0x99a1('0x3d')]);return db[_0x99a1('0x2a')]['find'](_0x2be9e3)[_0x99a1('0x23')](handleEntityNotFound(_0x1c4ce4,null))[_0x99a1('0x23')](respondWithResult(_0x1c4ce4,null))[_0x99a1('0x42')](handleError(_0x1c4ce4,null));};exports[_0x99a1('0x46')]=function(_0x113dd9,_0x254c41){return db[_0x99a1('0x2a')]['create'](_0x113dd9[_0x99a1('0x47')],{})['then'](respondWithResult(_0x254c41,0xc9))[_0x99a1('0x42')](handleError(_0x254c41,null));};exports[_0x99a1('0x48')]=function(_0x566442,_0x5433f2){if(_0x566442[_0x99a1('0x47')]['id']){delete _0x566442[_0x99a1('0x47')]['id'];}delete _0x566442[_0x99a1('0x47')][_0x99a1('0x49')];delete _0x566442[_0x99a1('0x47')]['createdAt'];delete _0x566442['body']['closedAt'];delete _0x566442[_0x99a1('0x47')][_0x99a1('0x4a')];return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':{'id':_0x566442[_0x99a1('0x44')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x5433f2,null))[_0x99a1('0x23')](saveUpdates(_0x566442['body'],null))[_0x99a1('0x23')](respondWithResult(_0x5433f2,null))[_0x99a1('0x42')](handleError(_0x5433f2,null));};exports[_0x99a1('0x4c')]=function(_0x5e877f,_0x81e218){return db['ScreenRecording']['describe']()[_0x99a1('0x23')](respondWithResult(_0x81e218,null))[_0x99a1('0x42')](handleError(_0x81e218,null));};exports[_0x99a1('0x4d')]=function(_0x175f6d,_0x11632d,_0xf8208a){var _0x240d2e=require(_0x99a1('0x4e'));var _0x16641e=![];var _0x53e9eb={};if(_0x175f6d[_0x99a1('0x33')]['type']&&_0x175f6d[_0x99a1('0x33')][_0x99a1('0x2c')]==='uniqueid'){_0x53e9eb[_0x99a1('0x4f')]=_0x175f6d[_0x99a1('0x44')]['id'];}else{_0x53e9eb['id']=_0x175f6d[_0x99a1('0x44')]['id'];}return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':_0x53e9eb,'attributes':['id',_0x99a1('0x4a')],'raw':!![]})[_0x99a1('0x23')](handleEntityNotFound(_0x11632d,null))[_0x99a1('0x23')](function(_0x28ba8f){if(_0x28ba8f){var _0x1c2926=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x28ba8f['value']);var _0x2e3e08=util[_0x99a1('0x52')](_0x99a1('0x53'),_0x1c2926);if(fs[_0x99a1('0x54')](_0x2e3e08)){_0x16641e=!![];return _0x240d2e[_0x99a1('0x55')](_0x2e3e08,_0x1c2926,config['secrets'][_0x99a1('0x56')])[_0x99a1('0x23')](function(){return _0x28ba8f;});}return _0x28ba8f;}})['then'](function(_0x6107cd){if(_0x6107cd){var _0x95f20a=path[_0x99a1('0x50')](config[_0x99a1('0x51')],_0x99a1('0x57'),_0x6107cd['value']);if(!fs[_0x99a1('0x54')](_0x95f20a)){throw new db[(_0x99a1('0x58'))][(_0x99a1('0x59'))](_0x99a1('0x5a'));}if(_0x6107cd[_0x99a1('0x5b')]){return _0x11632d[_0x99a1('0x4d')](_0x95f20a,_0x6107cd['filename']+path[_0x99a1('0x5c')](_0x95f20a),function(){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}else{return _0x11632d['download'](_0x95f20a,function(_0x33feb9){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}}})[_0x99a1('0x42')](function(_0xb126dd){if(_0xb126dd[_0x99a1('0x5e')]==='ScreenRecording\x20not\x20found'){_0x11632d[_0x99a1('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x11632d,null);}});};exports['destroy']=function(_0x38ce3c,_0x3f7c16){return db['ScreenRecording']['find']({'where':{'id':_0x38ce3c[_0x99a1('0x44')]['id']}})['then'](function(_0x21a5f6){if(_[_0x99a1('0x5f')](_0x21a5f6)){throw new ReferenceError(_0x99a1('0x60'));}return _0x21a5f6;})[_0x99a1('0x23')](function(_0x56d6cf){var _0x18f74b=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x56d6cf[_0x99a1('0x4a')]);logger['info'](_0x99a1('0x61'),_0x18f74b);if(!_[_0x99a1('0x5f')](_0x56d6cf[_0x99a1('0x4a')])&&fs[_0x99a1('0x54')](_0x18f74b)){logger[_0x99a1('0x62')]('File:\x20\x22'+_0x18f74b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x18f74b);}_0x18f74b=_0x18f74b+_0x99a1('0x63');if(!_[_0x99a1('0x5f')](_0x56d6cf['value'])&&fs['existsSync'](_0x18f74b)){logger[_0x99a1('0x62')](_0x99a1('0x64')+_0x18f74b+_0x99a1('0x65'));fs['unlinkSync'](_0x18f74b);}return _0x56d6cf;})['then'](function(_0x2b8df8){if(!_0x2b8df8)throw new InternalError();return _0x2b8df8['destroy']();})[_0x99a1('0x23')](function(){_0x3f7c16[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();})['catch'](handleError(_0x3f7c16,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3a35a87..fd21065 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 _0x6fc3=['screen_recordings','interactionid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x6fc3,0xaa));var _0x36fc=function(_0x3fa3a6,_0x172624){_0x3fa3a6=_0x3fa3a6-0x0;var _0x1b3500=_0x6fc3[_0x3fa3a6];return _0x1b3500;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36fc('0x0'))(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var BPromise=require(_0x36fc('0x3'));var rp=require(_0x36fc('0x4'));var fs=require('fs');var path=require(_0x36fc('0x5'));var rimraf=require(_0x36fc('0x6'));var config=require(_0x36fc('0x7'));var attributes=require(_0x36fc('0x8'));module[_0x36fc('0x9')]=function(_0x1e5f4f,_0x4547f7){return _0x1e5f4f[_0x36fc('0xa')](_0x36fc('0xb'),attributes,{'tableName':_0x36fc('0xc'),'paranoid':![],'indexes':[{'name':_0x36fc('0xd'),'fields':[_0x36fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfbc=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19f813,_0x547998){var _0xf9c00e=function(_0x3e142d){while(--_0x3e142d){_0x19f813['push'](_0x19f813['shift']());}};_0xf9c00e(++_0x547998);}(_0xdfbc,0x13a));var _0xcdfb=function(_0x3f7778,_0x1d9d48){_0x3f7778=_0x3f7778-0x0;var _0x4e4f37=_0xdfbc[_0x3f7778];return _0x4e4f37;};'use strict';var _=require(_0xcdfb('0x0'));var util=require(_0xcdfb('0x1'));var logger=require(_0xcdfb('0x2'))(_0xcdfb('0x3'));var moment=require(_0xcdfb('0x4'));var BPromise=require(_0xcdfb('0x5'));var rp=require(_0xcdfb('0x6'));var fs=require('fs');var path=require(_0xcdfb('0x7'));var rimraf=require(_0xcdfb('0x8'));var config=require(_0xcdfb('0x9'));var attributes=require(_0xcdfb('0xa'));module[_0xcdfb('0xb')]=function(_0x45b111,_0x143c2f){return _0x45b111[_0xcdfb('0xc')](_0xcdfb('0xd'),attributes,{'tableName':_0xcdfb('0xe'),'paranoid':![],'indexes':[{'name':_0xcdfb('0xf'),'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 dd82a89..08f6966 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 _0xbf92=['ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4a86d0,_0x3fa6ab){var _0x26dd24=function(_0x375512){while(--_0x375512){_0x4a86d0['push'](_0x4a86d0['shift']());}};_0x26dd24(++_0x3fa6ab);}(_0xbf92,0x9e));var _0x2bf9=function(_0x50e747,_0x3e9e9d){_0x50e747=_0x50e747-0x0;var _0x1957d5=_0xbf92[_0x50e747];return _0x1957d5;};'use strict';var _=require(_0x2bf9('0x0'));var util=require(_0x2bf9('0x1'));var moment=require(_0x2bf9('0x2'));var BPromise=require(_0x2bf9('0x3'));var rs=require(_0x2bf9('0x4'));var fs=require('fs');var Redis=require(_0x2bf9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bf9('0x6'));var logger=require(_0x2bf9('0x7'))(_0x2bf9('0x8'));var config=require(_0x2bf9('0x9'));var jayson=require(_0x2bf9('0xa'));var client=jayson[_0x2bf9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed521,_0x4a118f,_0x2b8bef){return new BPromise(function(_0x33508a,_0x459fc7){return client[_0x2bf9('0xc')](_0x2ed521,_0x2b8bef)['then'](function(_0xbe3eea){logger[_0x2bf9('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x4a118f,'request\x20sent');logger['debug'](_0x2bf9('0xe'),_0x4a118f,_0x2bf9('0xf'),JSON['stringify'](_0xbe3eea));if(_0xbe3eea[_0x2bf9('0x10')]){if(_0xbe3eea['error'][_0x2bf9('0x11')]===0x1f4){logger[_0x2bf9('0x10')](_0x2bf9('0x12'),_0x4a118f,_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);return _0x459fc7(_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);}logger['error'](_0x2bf9('0x12'),_0x4a118f,_0xbe3eea['error'][_0x2bf9('0x13')]);return _0x33508a(_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);}else{logger[_0x2bf9('0xd')](_0x2bf9('0x12'),_0x4a118f,_0x2bf9('0xf'));_0x33508a(_0xbe3eea[_0x2bf9('0x14')][_0x2bf9('0x13')]);}})[_0x2bf9('0x15')](function(_0x37db8f){logger['error'](_0x2bf9('0x12'),_0x4a118f,_0x37db8f);_0x459fc7(_0x37db8f);});});} \ No newline at end of file +var _0x4ba6=['ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x218ec3,_0x5aae78){var _0x23db5d=function(_0x426135){while(--_0x426135){_0x218ec3['push'](_0x218ec3['shift']());}};_0x23db5d(++_0x5aae78);}(_0x4ba6,0x155));var _0x64ba=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x4ba6[_0x295a92];return _0x3f5dac;};'use strict';var _=require('lodash');var util=require(_0x64ba('0x0'));var moment=require(_0x64ba('0x1'));var BPromise=require(_0x64ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ba('0x3'))['db'];var utils=require(_0x64ba('0x4'));var logger=require(_0x64ba('0x5'))(_0x64ba('0x6'));var config=require(_0x64ba('0x7'));var jayson=require(_0x64ba('0x8'));var client=jayson[_0x64ba('0x9')][_0x64ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dad8e,_0x3bb882,_0x1a27a2){return new BPromise(function(_0x5be7a0,_0x2113ff){return client[_0x64ba('0xb')](_0x4dad8e,_0x1a27a2)[_0x64ba('0xc')](function(_0x152bde){logger[_0x64ba('0xd')](_0x64ba('0xe'),_0x3bb882,_0x64ba('0xf'));logger['debug'](_0x64ba('0x10'),_0x3bb882,'request\x20sent',JSON['stringify'](_0x152bde));if(_0x152bde[_0x64ba('0x11')]){if(_0x152bde[_0x64ba('0x11')][_0x64ba('0x12')]===0x1f4){logger[_0x64ba('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3bb882,_0x152bde[_0x64ba('0x11')][_0x64ba('0x13')]);return _0x2113ff(_0x152bde[_0x64ba('0x11')][_0x64ba('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x3bb882,_0x152bde['error']['message']);return _0x5be7a0(_0x152bde['error'][_0x64ba('0x13')]);}else{logger[_0x64ba('0xd')](_0x64ba('0xe'),_0x3bb882,_0x64ba('0xf'));_0x5be7a0(_0x152bde[_0x64ba('0x14')][_0x64ba('0x13')]);}})['catch'](function(_0x39a9ff){logger[_0x64ba('0x11')](_0x64ba('0xe'),_0x3bb882,_0x39a9ff);_0x2113ff(_0x39a9ff);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2b6dc6c..09d5f81 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 _0x26e8=['single','addLogoLogin','preferred','/:id/preferred','addPreferred','diskStorage','favicon','addFavicon','put','/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','join','root'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26e8,0x114));var _0x826e=function(_0x2ac3cf,_0x465bb6){_0x2ac3cf=_0x2ac3cf-0x0;var _0x27dcca=_0x26e8[_0x2ac3cf];return _0x27dcca;};'use strict';var multer=require('multer');var util=require(_0x826e('0x0'));var path=require('path');var timeout=require(_0x826e('0x1'));var express=require(_0x826e('0x2'));var router=express[_0x826e('0x3')]();var fs_extra=require(_0x826e('0x4'));var auth=require(_0x826e('0x5'));var interaction=require(_0x826e('0x6'));var config=require(_0x826e('0x7'));var controller=require(_0x826e('0x8'));router[_0x826e('0x9')]('/',auth[_0x826e('0xa')](),controller[_0x826e('0xb')]);router['get'](_0x826e('0xc'),controller[_0x826e('0xd')]);router[_0x826e('0x9')]('/:id',controller[_0x826e('0xe')]);router[_0x826e('0x9')](_0x826e('0xf'),controller['getLogo']);router[_0x826e('0x9')](_0x826e('0x10'),controller[_0x826e('0x11')]);router[_0x826e('0x9')](_0x826e('0x12'),controller['gdpr']);router[_0x826e('0x9')]('/:id/preferred',controller[_0x826e('0x13')]);router[_0x826e('0x9')](_0x826e('0x14'),controller[_0x826e('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46264b,_0x4e2374,_0x10c42a){_0x10c42a(null,path['join'](config['root'],_0x826e('0x16')));},'filename':function(_0x536cdb,_0x162fef,_0x55c6ae){_0x55c6ae(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x19'),path[_0x826e('0x1a')](_0x162fef[_0x826e('0x1b')])));}})});router[_0x826e('0x1c')](_0x826e('0xf'),upload['single'](_0x826e('0x1d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22d81c,_0x11c678,_0x26cc9a){_0x26cc9a(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x17b479,_0x248689,_0x10e92e){_0x10e92e(null,util[_0x826e('0x17')](_0x826e('0x18'),'logologin',path['extname'](_0x248689[_0x826e('0x1b')])));}})});router[_0x826e('0x1c')](_0x826e('0x10'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27d246,_0x34c8f4,_0x421e48){_0x421e48(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x52e237,_0x12280f,_0x2ae529){_0x2ae529(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x22'),path['extname'](_0x12280f[_0x826e('0x1b')])));}})});router['post'](_0x826e('0x23'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x24')]);var upload=multer({'storage':multer[_0x826e('0x25')]({'destination':function(_0x12a2e8,_0xfb8398,_0x1f20ad){_0x1f20ad(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x3b4494,_0x1e20ce,_0x4d3ed2){_0x4d3ed2(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x26'),path['extname'](_0x1e20ce['originalname'])));}})});router[_0x826e('0x1c')](_0x826e('0x14'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x27')]);router[_0x826e('0x28')](_0x826e('0x29'),auth[_0x826e('0xa')](),controller[_0x826e('0x2a')]);module[_0x826e('0x2b')]=router; \ No newline at end of file +var _0x539d=['root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','/:id/logo_login','preferred','addPreferred','favicon','/:id/favicon','file','addFavicon','put','/:id','isAuthenticated','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./setting.controller','/now','getDate','get','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join'];(function(_0x28d1d9,_0x226b8c){var _0x5f0c03=function(_0x5c89c0){while(--_0x5c89c0){_0x28d1d9['push'](_0x28d1d9['shift']());}};_0x5f0c03(++_0x226b8c);}(_0x539d,0x1c2));var _0xd539=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x539d[_0x200827];return _0x120047;};'use strict';var multer=require(_0xd539('0x0'));var util=require(_0xd539('0x1'));var path=require(_0xd539('0x2'));var timeout=require('connect-timeout');var express=require(_0xd539('0x3'));var router=express[_0xd539('0x4')]();var fs_extra=require(_0xd539('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd539('0x6'));var config=require('../../config/environment');var controller=require(_0xd539('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd539('0x8'),controller[_0xd539('0x9')]);router[_0xd539('0xa')]('/:id',controller['show']);router[_0xd539('0xa')]('/:id/logo',controller[_0xd539('0xb')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router[_0xd539('0xa')](_0xd539('0xc'),controller[_0xd539('0xd')]);router[_0xd539('0xa')](_0xd539('0xe'),controller[_0xd539('0xf')]);router[_0xd539('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x172565,_0x5bbde3,_0x3b8f61){_0x3b8f61(null,path[_0xd539('0x11')](config[_0xd539('0x12')],_0xd539('0x13')));},'filename':function(_0x2eb050,_0x5b806d,_0x389fdd){_0x389fdd(null,util[_0xd539('0x14')](_0xd539('0x15'),_0xd539('0x16'),path[_0xd539('0x17')](_0x5b806d[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x1a'),upload[_0xd539('0x1b')]('file'),controller[_0xd539('0x1c')]);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x16c7ba,_0x44755b,_0x248de6){_0x248de6(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xfe50b9,_0x547af5,_0x2039d1){_0x2039d1(null,util['format'](_0xd539('0x15'),'logologin',path[_0xd539('0x17')](_0x547af5[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x1d'),upload[_0xd539('0x1b')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x19da37,_0x94f0a6,_0x360dbe){_0x360dbe(null,path[_0xd539('0x11')](config['root'],_0xd539('0x13')));},'filename':function(_0x532d6a,_0x424312,_0x5217d0){_0x5217d0(null,util['format'](_0xd539('0x15'),_0xd539('0x1e'),path[_0xd539('0x17')](_0x424312[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0xe'),upload[_0xd539('0x1b')]('file'),controller[_0xd539('0x1f')]);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x2e5708,_0x35608b,_0x5383fc){_0x5383fc(null,path[_0xd539('0x11')](config['root'],'server/files/images/logos/'));},'filename':function(_0x406d67,_0x2e95b3,_0x4818e2){_0x4818e2(null,util[_0xd539('0x14')](_0xd539('0x15'),_0xd539('0x20'),path['extname'](_0x2e95b3[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x21'),upload['single'](_0xd539('0x22')),controller[_0xd539('0x23')]);router[_0xd539('0x24')](_0xd539('0x25'),auth[_0xd539('0x26')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 507e4c4..04a43c1 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 _0x6f63=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','exports','INTEGER','min_mailbox','STRING'];(function(_0x5c7a52,_0x3179d4){var _0x6b524d=function(_0x784ff5){while(--_0x784ff5){_0x5c7a52['push'](_0x5c7a52['shift']());}};_0x6b524d(++_0x3179d4);}(_0x6f63,0x16c));var _0x36f6=function(_0xb85b8a,_0x26cdc6){_0xb85b8a=_0xb85b8a-0x0;var _0x815317=_0x6f63[_0xb85b8a];return _0x815317;};'use strict';var Sequelize=require('sequelize');module[_0x36f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x36f6('0x1')](0xb),'unique':_0x36f6('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x36f6('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x36f6('0x3')],'defaultValue':_0x36f6('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x36f6('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x36f6('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x36f6('0x3')]},'turnaddr':{'type':Sequelize[_0x36f6('0x3')]},'turnusername':{'type':Sequelize[_0x36f6('0x3')]},'turnpassword':{'type':Sequelize[_0x36f6('0x3')]},'pageTitle':{'type':Sequelize[_0x36f6('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x36f6('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x36f6('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x36f6('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x36f6('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x36f6('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x36f6('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x36f6('0x3')]},'bucket':{'type':Sequelize[_0x36f6('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x36f6('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x434e=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x434e,0x10c));var _0xe434=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x434e[_0x25bca6];return _0x3f8d02;};'use strict';var Sequelize=require('sequelize');module[_0xe434('0x0')]={'min_internal':{'type':Sequelize[_0xe434('0x1')](0xb),'unique':_0xe434('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe434('0x1')](0xb),'unique':_0xe434('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe434('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe434('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe434('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xe434('0x4')]},'turnpassword':{'type':Sequelize[_0xe434('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe434('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x7')},'enableEmailPreview':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe434('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe434('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe434('0x4')]},'defaultFavicon':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe434('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe434('0x1')]},'sentimentRegion':{'type':Sequelize[_0xe434('0x4')]},'language':{'type':Sequelize[_0xe434('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xe434('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe434('0x1')](0x2)[_0xe434('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xe434('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b929148..3642e5d 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 _0xa234=['Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','addLogo','file','filename','body','logo','addLogoLogin','loginLogo','server/files/images/logos','favicon','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','preferred','defaultLogo','default_loginLogo.svg','Sequelize','securePassword','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa234,0x142));var _0x4a23=function(_0x5f31f7,_0x2cc8d8){_0x5f31f7=_0x5f31f7-0x0;var _0x40377d=_0xa234[_0x5f31f7];return _0x40377d;};'use strict';var emlformat=require(_0x4a23('0x0'));var rimraf=require(_0x4a23('0x1'));var zipdir=require(_0x4a23('0x2'));var jsonpatch=require(_0x4a23('0x3'));var rp=require(_0x4a23('0x4'));var moment=require('moment');var BPromise=require(_0x4a23('0x5'));var Mustache=require('mustache');var util=require(_0x4a23('0x6'));var path=require('path');var sox=require(_0x4a23('0x7'));var csv=require(_0x4a23('0x8'));var ejs=require(_0x4a23('0x9'));var fs=require('fs');var fs_extra=require(_0x4a23('0xa'));var _=require(_0x4a23('0xb'));var squel=require(_0x4a23('0xc'));var crypto=require('crypto');var jsforce=require(_0x4a23('0xd'));var deskjs=require(_0x4a23('0xe'));var toCsv=require(_0x4a23('0x8'));var querystring=require(_0x4a23('0xf'));var Papa=require(_0x4a23('0x10'));var Redis=require(_0x4a23('0x11'));var authService=require(_0x4a23('0x12'));var qs=require(_0x4a23('0x13'));var as=require(_0x4a23('0x14'));var hardwareService=require(_0x4a23('0x15'));var logger=require(_0x4a23('0x16'))('api');var utils=require(_0x4a23('0x17'));var config=require(_0x4a23('0x18'));var licenseUtil=require(_0x4a23('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4a23('0x1a'));var client=jayson[_0x4a23('0x1b')][_0x4a23('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xeab648,_0x5a4922,_0x1e36b2,_0x207026){return new BPromise(function(_0x838369,_0x2b16ad){var _0x562e1a=_0x207026||client;return _0x562e1a['request'](_0xeab648,_0x1e36b2)['then'](function(_0x4abba6){logger['info'](_0x4a23('0x1d'),_0x5a4922,_0x4a23('0x1e'));logger[_0x4a23('0x1f')](_0x4a23('0x20'),_0x5a4922,'request\x20sent',JSON[_0x4a23('0x21')](_0x4abba6));if(_0x4abba6['error']){if(_0x4abba6[_0x4a23('0x22')][_0x4a23('0x23')]===0x1f4){logger[_0x4a23('0x22')](_0x4a23('0x1d'),_0x5a4922,_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);return _0x2b16ad(_0x4abba6['error'][_0x4a23('0x24')]);}logger['error'](_0x4a23('0x1d'),_0x5a4922,_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);return _0x838369(_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x5a4922,_0x4a23('0x1e'));_0x838369(_0x4abba6[_0x4a23('0x25')][_0x4a23('0x24')]);}})[_0x4a23('0x26')](function(_0x4d7885){logger[_0x4a23('0x22')](_0x4a23('0x1d'),_0x5a4922,_0x4d7885);_0x2b16ad(_0x4d7885);});});}function respondWithStatusCode(_0x16ce94,_0x194e88){_0x194e88=_0x194e88||0xcc;return function(_0x11b8b8){if(_0x11b8b8){return _0x16ce94[_0x4a23('0x27')](_0x194e88);}return _0x16ce94[_0x4a23('0x28')](_0x194e88)['end']();};}function respondWithResult(_0x1be912,_0x5c6c76){_0x5c6c76=_0x5c6c76||0xc8;return function(_0x3bea8c){if(_0x3bea8c){return _0x1be912['status'](_0x5c6c76)[_0x4a23('0x29')](_0x3bea8c);}};}function respondWithFilteredResult(_0x3690fc,_0x3c3184){return function(_0x305546){if(_0x305546){var _0x11d418=typeof _0x3c3184[_0x4a23('0x2a')]===_0x4a23('0x2b')&&typeof _0x3c3184[_0x4a23('0x2c')]==='undefined';var _0x3a94b6=_0x305546[_0x4a23('0x2d')];var _0x430c34=_0x11d418?0x0:_0x3c3184['offset'];var _0x39976d=_0x11d418?_0x305546['count']:_0x3c3184[_0x4a23('0x2a')]+_0x3c3184[_0x4a23('0x2c')];var _0x10058f;if(_0x39976d>=_0x3a94b6){_0x39976d=_0x3a94b6;_0x10058f=0xc8;}else{_0x10058f=0xce;}_0x3690fc[_0x4a23('0x28')](_0x10058f);return _0x3690fc[_0x4a23('0x2e')](_0x4a23('0x2f'),_0x430c34+'-'+_0x39976d+'/'+_0x3a94b6)[_0x4a23('0x29')](_0x305546);}return null;};}function patchUpdates(_0x261cea){return function(_0x1e2494){try{jsonpatch[_0x4a23('0x30')](_0x1e2494,_0x261cea,!![]);}catch(_0x1c500f){return BPromise['reject'](_0x1c500f);}return _0x1e2494[_0x4a23('0x31')]();};}function saveUpdates(_0x4153e3,_0x3133f3){return function(_0xaa6861){if(_0xaa6861){return _0xaa6861[_0x4a23('0x32')](_0x4153e3)[_0x4a23('0x33')](function(_0x1e2fe1){return _0x1e2fe1;});}return null;};}function removeEntity(_0x59e43d,_0xbba98a){return function(_0x2c1c5f){if(_0x2c1c5f){return _0x2c1c5f[_0x4a23('0x34')]()[_0x4a23('0x33')](function(){_0x59e43d[_0x4a23('0x28')](0xcc)[_0x4a23('0x35')]();});}};}function handleEntityNotFound(_0x378a3e,_0x443ee6){return function(_0x4ca06f){if(!_0x4ca06f){_0x378a3e[_0x4a23('0x27')](0x194);}return _0x4ca06f;};}function handleError(_0x368417,_0x1aaca4){_0x1aaca4=_0x1aaca4||0x1f4;return function(_0xb4fa84){logger[_0x4a23('0x22')](_0xb4fa84[_0x4a23('0x36')]);if(_0xb4fa84[_0x4a23('0x37')]){delete _0xb4fa84[_0x4a23('0x37')];}_0x368417[_0x4a23('0x28')](_0x1aaca4)[_0x4a23('0x38')](_0xb4fa84);};}exports[_0x4a23('0x39')]=function(_0x4edd5c,_0x355f8a){var _0x5369a5={},_0x45e13a={},_0x3d2cf9={'count':0x0,'rows':[]};var _0x53d419=_[_0x4a23('0x3a')](db[_0x4a23('0x3b')][_0x4a23('0x3c')],function(_0x1ae2f8){return{'name':_0x1ae2f8['fieldName'],'type':_0x1ae2f8[_0x4a23('0x3d')][_0x4a23('0x3e')]};});_0x45e13a[_0x4a23('0x3f')]=_['map'](_0x53d419,'name');_0x45e13a[_0x4a23('0x40')]=_[_0x4a23('0x41')](_0x4edd5c[_0x4a23('0x40')]);_0x45e13a[_0x4a23('0x42')]=_[_0x4a23('0x43')](_0x45e13a[_0x4a23('0x3f')],_0x45e13a[_0x4a23('0x40')]);_0x5369a5[_0x4a23('0x44')]=_[_0x4a23('0x43')](_0x45e13a['model'],qs[_0x4a23('0x45')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x45')]));_0x5369a5['attributes']=_0x5369a5[_0x4a23('0x44')][_0x4a23('0x46')]?_0x5369a5[_0x4a23('0x44')]:_0x45e13a[_0x4a23('0x3f')];if(!_0x4edd5c[_0x4a23('0x40')]['hasOwnProperty']('nolimit')){_0x5369a5[_0x4a23('0x2c')]=qs['limit'](_0x4edd5c['query']['limit']);_0x5369a5['offset']=qs[_0x4a23('0x2a')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x2a')]);}_0x5369a5['order']=qs[_0x4a23('0x47')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x47')]);_0x5369a5[_0x4a23('0x48')]=qs[_0x4a23('0x42')](_['pick'](_0x4edd5c[_0x4a23('0x40')],_0x45e13a['filters']),_0x53d419);if(_0x4edd5c['query'][_0x4a23('0x49')]){_0x5369a5[_0x4a23('0x48')]=_['merge'](_0x5369a5[_0x4a23('0x48')],{'$or':_['map'](_0x53d419,function(_0x4edbc7){if(_0x4edbc7[_0x4a23('0x3d')]!==_0x4a23('0x4a')){var _0x6585b3={};_0x6585b3[_0x4edbc7[_0x4a23('0x37')]]={'$like':'%'+_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x49')]+'%'};return _0x6585b3;}})});}_0x5369a5=_[_0x4a23('0x4b')]({},_0x5369a5,_0x4edd5c[_0x4a23('0x4c')]);var _0x41f3ac={'where':_0x5369a5[_0x4a23('0x48')]};return db[_0x4a23('0x3b')][_0x4a23('0x2d')](_0x41f3ac)[_0x4a23('0x33')](function(_0x348305){_0x3d2cf9[_0x4a23('0x2d')]=_0x348305;if(_0x4edd5c['query'][_0x4a23('0x4d')]){_0x5369a5[_0x4a23('0x4e')]=[{'all':!![]}];}return db['Setting'][_0x4a23('0x4f')](_0x5369a5);})['then'](function(_0x47e5c4){_0x3d2cf9[_0x4a23('0x50')]=_0x47e5c4;return _0x3d2cf9;})['then'](respondWithFilteredResult(_0x355f8a,_0x5369a5))[_0x4a23('0x26')](handleError(_0x355f8a,null));};exports['show']=function(_0x241fab,_0x9a1181){var _0x147fbd={'raw':![],'where':{'id':_0x241fab[_0x4a23('0x51')]['id']}},_0x5b8b6e={};_0x5b8b6e[_0x4a23('0x3f')]=_[_0x4a23('0x41')](db['Setting']['rawAttributes']);_0x5b8b6e['query']=_[_0x4a23('0x41')](_0x241fab[_0x4a23('0x40')]);_0x5b8b6e[_0x4a23('0x42')]=_[_0x4a23('0x43')](_0x5b8b6e[_0x4a23('0x3f')],_0x5b8b6e['query']);_0x147fbd[_0x4a23('0x44')]=_['intersection'](_0x5b8b6e[_0x4a23('0x3f')],qs[_0x4a23('0x45')](_0x241fab['query'][_0x4a23('0x45')]));_0x147fbd[_0x4a23('0x44')]=_0x147fbd[_0x4a23('0x44')][_0x4a23('0x46')]?_0x147fbd[_0x4a23('0x44')]:_0x5b8b6e['model'];if(_0x241fab[_0x4a23('0x40')]['includeAll']){_0x147fbd['include']=[{'all':!![]}];}_0x147fbd=_[_0x4a23('0x4b')]({},_0x147fbd,_0x241fab[_0x4a23('0x4c')]);return db[_0x4a23('0x3b')][_0x4a23('0x52')](_0x147fbd)[_0x4a23('0x33')](handleEntityNotFound(_0x9a1181,null))[_0x4a23('0x33')](respondWithResult(_0x9a1181,null))['catch'](handleError(_0x9a1181,null));};exports[_0x4a23('0x32')]=function(_0x299328,_0x286f26){if(_0x299328['body']['id']){delete _0x299328['body']['id'];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x299328['params']['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x286f26,null))[_0x4a23('0x33')](saveUpdates(_0x299328['body'],null))['then'](respondWithResult(_0x286f26,null))[_0x4a23('0x26')](handleError(_0x286f26,null));};exports[_0x4a23('0x53')]=function(_0x45f517,_0x26a450,_0x1efcd8){if(_0x45f517[_0x4a23('0x54')]&&_0x45f517[_0x4a23('0x54')][_0x4a23('0x55')]){_0x45f517[_0x4a23('0x56')][_0x4a23('0x57')]=_0x45f517[_0x4a23('0x54')][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x45f517[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x26a450,null))[_0x4a23('0x33')](saveUpdates(_0x45f517[_0x4a23('0x56')],null))['then'](respondWithResult(_0x26a450,null))['catch'](handleError(_0x26a450,null));};exports[_0x4a23('0x58')]=function(_0x2b598d,_0x1ce621,_0x1edb80){if(_0x2b598d[_0x4a23('0x54')]&&_0x2b598d['file'][_0x4a23('0x55')]){_0x2b598d[_0x4a23('0x56')][_0x4a23('0x59')]=_0x2b598d['file'][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x2b598d['params']['id']}})['then'](handleEntityNotFound(_0x1ce621,null))['then'](saveUpdates(_0x2b598d[_0x4a23('0x56')],null))['then'](respondWithResult(_0x1ce621,null))[_0x4a23('0x26')](handleError(_0x1ce621,null));};var utilLicense=require(_0x4a23('0x19'));exports['getLogo']=function(_0x3c7c13,_0x3e4a01,_0x2da36f){var _0x4190f4=_0x4a23('0x5a');var _0x45c081={'custom':![]};return utilLicense['getLicense']()[_0x4a23('0x33')](function(_0x2f2d2f){if(_0x2f2d2f){_0x45c081=_0x2f2d2f;}return db['Setting']['find']({'where':{'id':_0x3c7c13['params']['id']},'attributes':[_0x4a23('0x57'),_0x4a23('0x59'),'preferred',_0x4a23('0x5b'),'defaultLogo',_0x4a23('0x5c'),_0x4a23('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x3e4a01,null))[_0x4a23('0x33')](function(_0x1b08b8){if(_0x1b08b8){var _0x16b89f=_0x1b08b8['logo']&&fs['existsSync'](path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x1b08b8[_0x4a23('0x57')])))?path[_0x4a23('0x5e')](config['root'],_0x4190f4,_['toLower'](_0x1b08b8[_0x4a23('0x57')])):path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x4a23('0x61')));var _0x546f03=_0x4a23('0x62')+_[_0x4a23('0x63')]('logo');if(_0x1b08b8[_0x546f03]||!_0x45c081[_0x4a23('0x64')]){_0x16b89f=path['join'](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x4a23('0x61')));}if(!fs[_0x4a23('0x65')](_0x16b89f)){throw new db['Sequelize'][(_0x4a23('0x66'))](_[_0x4a23('0x63')](_0x4a23('0x57'))+_0x4a23('0x67'));}return _0x3e4a01[_0x4a23('0x68')](_0x16b89f);}})[_0x4a23('0x26')](handleError(_0x3e4a01,null));};var utilLicense=require(_0x4a23('0x19'));exports[_0x4a23('0x69')]=function(_0x239097,_0x5d03e1,_0x21f500){var _0x5c9bfc='server/files/images/logos';var _0x3a45d5={'custom':![]};return utilLicense[_0x4a23('0x6a')]()['then'](function(_0x3c3af9){if(_0x3c3af9){_0x3a45d5=_0x3c3af9;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x239097[_0x4a23('0x51')]['id']},'attributes':['logo',_0x4a23('0x59'),_0x4a23('0x6b'),'favicon',_0x4a23('0x6c'),_0x4a23('0x5c'),_0x4a23('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x5d03e1,null))[_0x4a23('0x33')](function(_0x514119){if(_0x514119){var _0x58ae03=_0x514119[_0x4a23('0x59')]&&fs['existsSync'](path[_0x4a23('0x5e')](config['root'],_0x5c9bfc,_[_0x4a23('0x60')](_0x514119[_0x4a23('0x59')])))?path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x5c9bfc,_['toLower'](_0x514119[_0x4a23('0x59')])):path['join'](config[_0x4a23('0x5f')],_0x5c9bfc,_[_0x4a23('0x60')](_0x4a23('0x6d')));var _0x194b8='default'+_[_0x4a23('0x63')](_0x4a23('0x59'));if(_0x514119[_0x194b8]||!_0x3a45d5['custom']){_0x58ae03=path[_0x4a23('0x5e')](config['root'],_0x5c9bfc,_[_0x4a23('0x60')](_0x4a23('0x6d')));}if(!fs['existsSync'](_0x58ae03)){throw new db[(_0x4a23('0x6e'))][(_0x4a23('0x66'))](_[_0x4a23('0x63')](_0x4a23('0x59'))+'\x20not\x20found');}return _0x5d03e1['download'](_0x58ae03);}})[_0x4a23('0x26')](handleError(_0x5d03e1,null));};exports['gdpr']=function(_0x422b66,_0x37ae30){return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x422b66[_0x4a23('0x51')]['id']},'attributes':[_0x4a23('0x6f')]})[_0x4a23('0x33')](respondWithResult(_0x37ae30,null))[_0x4a23('0x26')](handleError(_0x37ae30,null));};exports['addPreferred']=function(_0x4476a8,_0x27b720,_0x2c9de1){if(_0x4476a8['file']&&_0x4476a8[_0x4a23('0x54')][_0x4a23('0x55')]){_0x4476a8[_0x4a23('0x56')]['preferred']=_0x4476a8['file']['filename'];}return db['Setting'][_0x4a23('0x52')]({'where':{'id':_0x4476a8[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x27b720,null))[_0x4a23('0x33')](saveUpdates(_0x4476a8[_0x4a23('0x56')],null))[_0x4a23('0x33')](respondWithResult(_0x27b720,null))['catch'](handleError(_0x27b720,null));};var utilLicense=require('../../config/license/util');exports[_0x4a23('0x70')]=function(_0x22bfef,_0x40e1ab,_0xb3a02f){var _0x27ee4='server/files/images/logos';var _0x5c403b={'custom':![]};return utilLicense[_0x4a23('0x6a')]()[_0x4a23('0x33')](function(_0x53892d){if(_0x53892d){_0x5c403b=_0x53892d;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x22bfef[_0x4a23('0x51')]['id']},'attributes':['logo',_0x4a23('0x59'),_0x4a23('0x6b'),'favicon',_0x4a23('0x6c'),'defaultLoginLogo',_0x4a23('0x5d'),_0x4a23('0x71')],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x40e1ab,null))[_0x4a23('0x33')](function(_0x54b058){if(_0x54b058){var _0x34ca8e=_0x54b058[_0x4a23('0x6b')]&&fs[_0x4a23('0x65')](path[_0x4a23('0x5e')](config['root'],_0x27ee4,_['toLower'](_0x54b058[_0x4a23('0x6b')])))?path[_0x4a23('0x5e')](config['root'],_0x27ee4,_[_0x4a23('0x60')](_0x54b058[_0x4a23('0x6b')])):path['join'](config[_0x4a23('0x5f')],_0x27ee4,_[_0x4a23('0x60')](_0x4a23('0x72')));var _0x1f73e4=_0x4a23('0x62')+_['upperFirst'](_0x4a23('0x6b'));if(_0x54b058[_0x1f73e4]||!_0x5c403b[_0x4a23('0x64')]||!_0x5c403b['preferred']){_0x34ca8e=path[_0x4a23('0x5e')](config['root'],_0x27ee4,_[_0x4a23('0x60')]('default_preferred.png'));}if(!fs[_0x4a23('0x65')](_0x34ca8e)){throw new db[(_0x4a23('0x6e'))][(_0x4a23('0x66'))](_[_0x4a23('0x63')]('preferred')+_0x4a23('0x67'));}return _0x40e1ab[_0x4a23('0x68')](_0x34ca8e);}})[_0x4a23('0x26')](handleError(_0x40e1ab,null));};exports[_0x4a23('0x73')]=function(_0x431d55,_0x3c15ef,_0x5291a8){if(_0x431d55['file']&&_0x431d55[_0x4a23('0x54')][_0x4a23('0x55')]){_0x431d55[_0x4a23('0x56')][_0x4a23('0x5b')]=_0x431d55[_0x4a23('0x54')][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x431d55[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x3c15ef,null))[_0x4a23('0x33')](saveUpdates(_0x431d55[_0x4a23('0x56')],null))[_0x4a23('0x33')](respondWithResult(_0x3c15ef,null))[_0x4a23('0x26')](handleError(_0x3c15ef,null));};var utilLicense=require('../../config/license/util');exports[_0x4a23('0x74')]=function(_0x390c5d,_0x51515f,_0x151afa){var _0x3b47e7=_0x4a23('0x5a');var _0x51e4f5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x36f998){if(_0x36f998){_0x51e4f5=_0x36f998;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x390c5d[_0x4a23('0x51')]['id']},'attributes':[_0x4a23('0x57'),_0x4a23('0x59'),_0x4a23('0x6b'),_0x4a23('0x5b'),'defaultLogo',_0x4a23('0x5c'),_0x4a23('0x5d'),_0x4a23('0x71')],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x51515f,null))['then'](function(_0x3ce20d){if(_0x3ce20d){var _0x325984=_0x3ce20d['favicon']&&fs[_0x4a23('0x65')](path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x3b47e7,_['toLower'](_0x3ce20d[_0x4a23('0x5b')])))?path[_0x4a23('0x5e')](config['root'],_0x3b47e7,_[_0x4a23('0x60')](_0x3ce20d[_0x4a23('0x5b')])):path['join'](config['root'],_0x3b47e7,_[_0x4a23('0x60')](_0x4a23('0x75')));var _0xc34568=_0x4a23('0x62')+_['upperFirst'](_0x4a23('0x5b'));if(_0x3ce20d[_0xc34568]||!_0x51e4f5['custom']){_0x325984=path['join'](config[_0x4a23('0x5f')],_0x3b47e7,_['toLower'](_0x4a23('0x75')));}if(!fs['existsSync'](_0x325984)){throw new db[(_0x4a23('0x6e'))]['ValidationError'](_[_0x4a23('0x63')](_0x4a23('0x5b'))+_0x4a23('0x67'));}return _0x51515f['download'](_0x325984);}})['catch'](handleError(_0x51515f,null));};exports[_0x4a23('0x76')]=function(_0x318343,_0x3d5ae4){var _0x4a8f72={'offset':moment()[_0x4a23('0x77')]()};_0x4a8f72[_0x4a23('0x78')]=moment()[_0x4a23('0x77')](_0x4a8f72[_0x4a23('0x2a')])[_0x4a23('0x79')](_0x4a23('0x7a'));return _0x3d5ae4[_0x4a23('0x28')](0xc8)[_0x4a23('0x38')](_0x4a8f72);}; \ No newline at end of file +var _0xf021=['getLogo','server/files/images/logos','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','defaultLogo','defaultLoginLogo','default_loginLogo.svg','ValidationError','securePassword','addPreferred','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','filter','options','Setting','count','includeAll','include','findAll','rows','show','merge','find','body','params','addLogo','logo','file','filename','addLogoLogin','loginLogo'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xf021,0x18f));var _0x1f02=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0xf021[_0xeb4c8b];return _0x90b0d0;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x17')][_0x1f02('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x154a1e,_0x567f8a,_0x5b12e8,_0x4974bd){return new BPromise(function(_0x11ba7e,_0x2c08ad){var _0x354ad1=_0x4974bd||client;return _0x354ad1[_0x1f02('0x19')](_0x154a1e,_0x5b12e8)[_0x1f02('0x1a')](function(_0x45bae1){logger[_0x1f02('0x1b')](_0x1f02('0x1c'),_0x567f8a,'request\x20sent');logger[_0x1f02('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x567f8a,'request\x20sent',JSON['stringify'](_0x45bae1));if(_0x45bae1['error']){if(_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x1f')]===0x1f4){logger[_0x1f02('0x1e')]('Setting,\x20%s,\x20%s',_0x567f8a,_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);return _0x2c08ad(_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);}logger['error']('Setting,\x20%s,\x20%s',_0x567f8a,_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);return _0x11ba7e(_0x45bae1['error']['message']);}else{logger[_0x1f02('0x1b')](_0x1f02('0x1c'),_0x567f8a,_0x1f02('0x21'));_0x11ba7e(_0x45bae1[_0x1f02('0x22')]['message']);}})[_0x1f02('0x23')](function(_0x127b1d){logger[_0x1f02('0x1e')](_0x1f02('0x1c'),_0x567f8a,_0x127b1d);_0x2c08ad(_0x127b1d);});});}function respondWithStatusCode(_0x43b3e7,_0x134398){_0x134398=_0x134398||0xcc;return function(_0x1328ea){if(_0x1328ea){return _0x43b3e7['sendStatus'](_0x134398);}return _0x43b3e7[_0x1f02('0x24')](_0x134398)[_0x1f02('0x25')]();};}function respondWithResult(_0x47bc22,_0x25a8d1){_0x25a8d1=_0x25a8d1||0xc8;return function(_0x43db49){if(_0x43db49){return _0x47bc22['status'](_0x25a8d1)['json'](_0x43db49);}};}function respondWithFilteredResult(_0x3f7426,_0x36c8c1){return function(_0x3c3fda){if(_0x3c3fda){var _0xf2b9a8=typeof _0x36c8c1[_0x1f02('0x26')]===_0x1f02('0x27')&&typeof _0x36c8c1[_0x1f02('0x28')]==='undefined';var _0x4d5f7e=_0x3c3fda['count'];var _0x3ef4bf=_0xf2b9a8?0x0:_0x36c8c1[_0x1f02('0x26')];var _0x23059a=_0xf2b9a8?_0x3c3fda['count']:_0x36c8c1['offset']+_0x36c8c1[_0x1f02('0x28')];var _0x6e88d5;if(_0x23059a>=_0x4d5f7e){_0x23059a=_0x4d5f7e;_0x6e88d5=0xc8;}else{_0x6e88d5=0xce;}_0x3f7426[_0x1f02('0x24')](_0x6e88d5);return _0x3f7426[_0x1f02('0x29')](_0x1f02('0x2a'),_0x3ef4bf+'-'+_0x23059a+'/'+_0x4d5f7e)[_0x1f02('0x2b')](_0x3c3fda);}return null;};}function patchUpdates(_0x442333){return function(_0x23fa22){try{jsonpatch[_0x1f02('0x2c')](_0x23fa22,_0x442333,!![]);}catch(_0x2869b0){return BPromise['reject'](_0x2869b0);}return _0x23fa22[_0x1f02('0x2d')]();};}function saveUpdates(_0x5ab7a2,_0xa61d8f){return function(_0x3b3b57){if(_0x3b3b57){return _0x3b3b57[_0x1f02('0x2e')](_0x5ab7a2)[_0x1f02('0x1a')](function(_0x28a572){return _0x28a572;});}return null;};}function removeEntity(_0x194c85,_0x58f332){return function(_0x48ae22){if(_0x48ae22){return _0x48ae22[_0x1f02('0x2f')]()[_0x1f02('0x1a')](function(){_0x194c85['status'](0xcc)[_0x1f02('0x25')]();});}};}function handleEntityNotFound(_0x4d1aec,_0x34b0d2){return function(_0x4e7add){if(!_0x4e7add){_0x4d1aec[_0x1f02('0x30')](0x194);}return _0x4e7add;};}function handleError(_0x5482d9,_0x596fcc){_0x596fcc=_0x596fcc||0x1f4;return function(_0x26f33e){logger[_0x1f02('0x1e')](_0x26f33e[_0x1f02('0x31')]);if(_0x26f33e[_0x1f02('0x32')]){delete _0x26f33e['name'];}_0x5482d9[_0x1f02('0x24')](_0x596fcc)[_0x1f02('0x33')](_0x26f33e);};}exports[_0x1f02('0x34')]=function(_0x507866,_0x68a2cb){var _0x3454aa={},_0x2a82fa={},_0x390686={'count':0x0,'rows':[]};var _0x4292b7=_[_0x1f02('0x35')](db['Setting'][_0x1f02('0x36')],function(_0x143e18){return{'name':_0x143e18[_0x1f02('0x37')],'type':_0x143e18['type'][_0x1f02('0x38')]};});_0x2a82fa['model']=_[_0x1f02('0x35')](_0x4292b7,'name');_0x2a82fa['query']=_[_0x1f02('0x39')](_0x507866['query']);_0x2a82fa['filters']=_[_0x1f02('0x3a')](_0x2a82fa[_0x1f02('0x3b')],_0x2a82fa[_0x1f02('0x3c')]);_0x3454aa[_0x1f02('0x3d')]=_['intersection'](_0x2a82fa[_0x1f02('0x3b')],qs['fields'](_0x507866[_0x1f02('0x3c')][_0x1f02('0x3e')]));_0x3454aa[_0x1f02('0x3d')]=_0x3454aa[_0x1f02('0x3d')][_0x1f02('0x3f')]?_0x3454aa[_0x1f02('0x3d')]:_0x2a82fa[_0x1f02('0x3b')];if(!_0x507866[_0x1f02('0x3c')][_0x1f02('0x40')]('nolimit')){_0x3454aa[_0x1f02('0x28')]=qs['limit'](_0x507866[_0x1f02('0x3c')]['limit']);_0x3454aa[_0x1f02('0x26')]=qs[_0x1f02('0x26')](_0x507866[_0x1f02('0x3c')]['offset']);}_0x3454aa['order']=qs[_0x1f02('0x41')](_0x507866[_0x1f02('0x3c')][_0x1f02('0x41')]);_0x3454aa[_0x1f02('0x42')]=qs[_0x1f02('0x43')](_[_0x1f02('0x44')](_0x507866[_0x1f02('0x3c')],_0x2a82fa[_0x1f02('0x43')]),_0x4292b7);if(_0x507866[_0x1f02('0x3c')]['filter']){_0x3454aa[_0x1f02('0x42')]=_['merge'](_0x3454aa['where'],{'$or':_[_0x1f02('0x35')](_0x4292b7,function(_0x4e185a){if(_0x4e185a['type']!==_0x1f02('0x45')){var _0x55ad2b={};_0x55ad2b[_0x4e185a['name']]={'$like':'%'+_0x507866[_0x1f02('0x3c')][_0x1f02('0x46')]+'%'};return _0x55ad2b;}})});}_0x3454aa=_['merge']({},_0x3454aa,_0x507866[_0x1f02('0x47')]);var _0x1ec899={'where':_0x3454aa[_0x1f02('0x42')]};return db[_0x1f02('0x48')]['count'](_0x1ec899)[_0x1f02('0x1a')](function(_0x30d438){_0x390686[_0x1f02('0x49')]=_0x30d438;if(_0x507866[_0x1f02('0x3c')][_0x1f02('0x4a')]){_0x3454aa[_0x1f02('0x4b')]=[{'all':!![]}];}return db[_0x1f02('0x48')][_0x1f02('0x4c')](_0x3454aa);})[_0x1f02('0x1a')](function(_0x282e5b){_0x390686[_0x1f02('0x4d')]=_0x282e5b;return _0x390686;})[_0x1f02('0x1a')](respondWithFilteredResult(_0x68a2cb,_0x3454aa))[_0x1f02('0x23')](handleError(_0x68a2cb,null));};exports[_0x1f02('0x4e')]=function(_0x5b6d49,_0x240f49){var _0x50d5ed={'raw':![],'where':{'id':_0x5b6d49['params']['id']}},_0x37759d={};_0x37759d[_0x1f02('0x3b')]=_[_0x1f02('0x39')](db[_0x1f02('0x48')][_0x1f02('0x36')]);_0x37759d[_0x1f02('0x3c')]=_[_0x1f02('0x39')](_0x5b6d49[_0x1f02('0x3c')]);_0x37759d[_0x1f02('0x43')]=_[_0x1f02('0x3a')](_0x37759d[_0x1f02('0x3b')],_0x37759d[_0x1f02('0x3c')]);_0x50d5ed['attributes']=_[_0x1f02('0x3a')](_0x37759d[_0x1f02('0x3b')],qs[_0x1f02('0x3e')](_0x5b6d49[_0x1f02('0x3c')][_0x1f02('0x3e')]));_0x50d5ed[_0x1f02('0x3d')]=_0x50d5ed[_0x1f02('0x3d')][_0x1f02('0x3f')]?_0x50d5ed[_0x1f02('0x3d')]:_0x37759d['model'];if(_0x5b6d49[_0x1f02('0x3c')][_0x1f02('0x4a')]){_0x50d5ed[_0x1f02('0x4b')]=[{'all':!![]}];}_0x50d5ed=_[_0x1f02('0x4f')]({},_0x50d5ed,_0x5b6d49[_0x1f02('0x47')]);return db['Setting'][_0x1f02('0x50')](_0x50d5ed)['then'](handleEntityNotFound(_0x240f49,null))[_0x1f02('0x1a')](respondWithResult(_0x240f49,null))[_0x1f02('0x23')](handleError(_0x240f49,null));};exports[_0x1f02('0x2e')]=function(_0x18d80d,_0x2eb2f4){if(_0x18d80d[_0x1f02('0x51')]['id']){delete _0x18d80d[_0x1f02('0x51')]['id'];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x18d80d[_0x1f02('0x52')]['id']}})['then'](handleEntityNotFound(_0x2eb2f4,null))['then'](saveUpdates(_0x18d80d['body'],null))[_0x1f02('0x1a')](respondWithResult(_0x2eb2f4,null))['catch'](handleError(_0x2eb2f4,null));};exports[_0x1f02('0x53')]=function(_0x449d58,_0x587873,_0x5a8768){if(_0x449d58['file']&&_0x449d58['file']['filename']){_0x449d58[_0x1f02('0x51')][_0x1f02('0x54')]=_0x449d58[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x449d58['params']['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x587873,null))[_0x1f02('0x1a')](saveUpdates(_0x449d58['body'],null))['then'](respondWithResult(_0x587873,null))[_0x1f02('0x23')](handleError(_0x587873,null));};exports[_0x1f02('0x57')]=function(_0x270bab,_0x47efdf,_0x1c515c){if(_0x270bab['file']&&_0x270bab[_0x1f02('0x55')]['filename']){_0x270bab[_0x1f02('0x51')][_0x1f02('0x58')]=_0x270bab[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x270bab[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x47efdf,null))[_0x1f02('0x1a')](saveUpdates(_0x270bab[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x47efdf,null))[_0x1f02('0x23')](handleError(_0x47efdf,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x59')]=function(_0x34e2af,_0x14038a,_0x2218dd){var _0x3a465f=_0x1f02('0x5a');var _0x283060={'custom':![]};return utilLicense['getLicense']()[_0x1f02('0x1a')](function(_0x225e17){if(_0x225e17){_0x283060=_0x225e17;}return db['Setting'][_0x1f02('0x50')]({'where':{'id':_0x34e2af[_0x1f02('0x52')]['id']},'attributes':['logo',_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),'defaultLogo','defaultLoginLogo',_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x14038a,null))[_0x1f02('0x1a')](function(_0x6a2cd8){if(_0x6a2cd8){var _0x2f971c=_0x6a2cd8[_0x1f02('0x54')]&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_['toLower'](_0x6a2cd8[_0x1f02('0x54')])))?path['join'](config['root'],_0x3a465f,_[_0x1f02('0x62')](_0x6a2cd8[_0x1f02('0x54')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_[_0x1f02('0x62')](_0x1f02('0x63')));var _0x2fb8bb=_0x1f02('0x64')+_[_0x1f02('0x65')](_0x1f02('0x54'));if(_0x6a2cd8[_0x2fb8bb]||!_0x283060[_0x1f02('0x66')]){_0x2f971c=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_['toLower']('default_logo.svg'));}if(!fs[_0x1f02('0x5f')](_0x2f971c)){throw new db[(_0x1f02('0x67'))]['ValidationError'](_['upperFirst'](_0x1f02('0x54'))+_0x1f02('0x68'));}return _0x14038a[_0x1f02('0x69')](_0x2f971c);}})[_0x1f02('0x23')](handleError(_0x14038a,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x6a')]=function(_0x5b10cd,_0x2e7c1b,_0x5ee858){var _0x386df5=_0x1f02('0x5a');var _0x2886b4={'custom':![]};return utilLicense[_0x1f02('0x6b')]()[_0x1f02('0x1a')](function(_0x452ca2){if(_0x452ca2){_0x2886b4=_0x452ca2;}return db[_0x1f02('0x48')]['find']({'where':{'id':_0x5b10cd[_0x1f02('0x52')]['id']},'attributes':[_0x1f02('0x54'),_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),_0x1f02('0x6c'),_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x2e7c1b,null))[_0x1f02('0x1a')](function(_0x48655c){if(_0x48655c){var _0x572965=_0x48655c[_0x1f02('0x58')]&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x48655c[_0x1f02('0x58')])))?path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x48655c[_0x1f02('0x58')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x1f02('0x6e')));var _0x4187b9=_0x1f02('0x64')+_[_0x1f02('0x65')](_0x1f02('0x58'));if(_0x48655c[_0x4187b9]||!_0x2886b4['custom']){_0x572965=path['join'](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')]('default_loginLogo.svg'));}if(!fs[_0x1f02('0x5f')](_0x572965)){throw new db[(_0x1f02('0x67'))][(_0x1f02('0x6f'))](_[_0x1f02('0x65')](_0x1f02('0x58'))+_0x1f02('0x68'));}return _0x2e7c1b[_0x1f02('0x69')](_0x572965);}})[_0x1f02('0x23')](handleError(_0x2e7c1b,null));};exports['gdpr']=function(_0x1343af,_0x14d455){return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x1343af[_0x1f02('0x52')]['id']},'attributes':[_0x1f02('0x70')]})[_0x1f02('0x1a')](respondWithResult(_0x14d455,null))[_0x1f02('0x23')](handleError(_0x14d455,null));};exports[_0x1f02('0x71')]=function(_0x5b64d4,_0x27bd93,_0x1bf800){if(_0x5b64d4['file']&&_0x5b64d4[_0x1f02('0x55')]['filename']){_0x5b64d4[_0x1f02('0x51')][_0x1f02('0x5b')]=_0x5b64d4[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x5b64d4[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x27bd93,null))[_0x1f02('0x1a')](saveUpdates(_0x5b64d4[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x27bd93,null))[_0x1f02('0x23')](handleError(_0x27bd93,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x72')]=function(_0x3af2fa,_0x3e0332,_0x119420){var _0x18ed82=_0x1f02('0x5a');var _0x337fcf={'custom':![]};return utilLicense[_0x1f02('0x6b')]()[_0x1f02('0x1a')](function(_0x1a1eed){if(_0x1a1eed){_0x337fcf=_0x1a1eed;}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x3af2fa[_0x1f02('0x52')]['id']},'attributes':['logo',_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),'defaultLogo',_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x3e0332,null))[_0x1f02('0x1a')](function(_0x440557){if(_0x440557){var _0x582685=_0x440557['preferred']&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config['root'],_0x18ed82,_[_0x1f02('0x62')](_0x440557[_0x1f02('0x5b')])))?path[_0x1f02('0x60')](config['root'],_0x18ed82,_[_0x1f02('0x62')](_0x440557[_0x1f02('0x5b')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x18ed82,_['toLower']('default_preferred.png'));var _0x293c10=_0x1f02('0x64')+_['upperFirst']('preferred');if(_0x440557[_0x293c10]||!_0x337fcf[_0x1f02('0x66')]||!_0x337fcf[_0x1f02('0x5b')]){_0x582685=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x18ed82,_[_0x1f02('0x62')]('default_preferred.png'));}if(!fs[_0x1f02('0x5f')](_0x582685)){throw new db['Sequelize'][(_0x1f02('0x6f'))](_[_0x1f02('0x65')](_0x1f02('0x5b'))+'\x20not\x20found');}return _0x3e0332[_0x1f02('0x69')](_0x582685);}})[_0x1f02('0x23')](handleError(_0x3e0332,null));};exports[_0x1f02('0x73')]=function(_0x55764d,_0x1eca0f,_0xbce1c5){if(_0x55764d[_0x1f02('0x55')]&&_0x55764d[_0x1f02('0x55')]['filename']){_0x55764d[_0x1f02('0x51')]['favicon']=_0x55764d[_0x1f02('0x55')]['filename'];}return db[_0x1f02('0x48')]['find']({'where':{'id':_0x55764d[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x1eca0f,null))['then'](saveUpdates(_0x55764d[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x1eca0f,null))[_0x1f02('0x23')](handleError(_0x1eca0f,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x74')]=function(_0x541d97,_0x1734cb,_0x34fe7f){var _0x299fa9=_0x1f02('0x5a');var _0x2198eb={'custom':![]};return utilLicense['getLicense']()[_0x1f02('0x1a')](function(_0x31052c){if(_0x31052c){_0x2198eb=_0x31052c;}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x541d97['params']['id']},'attributes':['logo',_0x1f02('0x58'),'preferred',_0x1f02('0x5c'),_0x1f02('0x6c'),_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x1734cb,null))[_0x1f02('0x1a')](function(_0x262bd6){if(_0x262bd6){var _0x5b3fb5=_0x262bd6[_0x1f02('0x5c')]&&fs[_0x1f02('0x5f')](path['join'](config['root'],_0x299fa9,_[_0x1f02('0x62')](_0x262bd6['favicon'])))?path[_0x1f02('0x60')](config['root'],_0x299fa9,_[_0x1f02('0x62')](_0x262bd6['favicon'])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x299fa9,_[_0x1f02('0x62')]('default_favicon.ico'));var _0x3cc8da=_0x1f02('0x64')+_['upperFirst'](_0x1f02('0x5c'));if(_0x262bd6[_0x3cc8da]||!_0x2198eb[_0x1f02('0x66')]){_0x5b3fb5=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x299fa9,_[_0x1f02('0x62')](_0x1f02('0x75')));}if(!fs[_0x1f02('0x5f')](_0x5b3fb5)){throw new db[(_0x1f02('0x67'))][(_0x1f02('0x6f'))](_['upperFirst'](_0x1f02('0x5c'))+_0x1f02('0x68'));}return _0x1734cb[_0x1f02('0x69')](_0x5b3fb5);}})['catch'](handleError(_0x1734cb,null));};exports[_0x1f02('0x76')]=function(_0x40a945,_0x23ad42){var _0x1f9e2f={'offset':moment()[_0x1f02('0x77')]()};_0x1f9e2f[_0x1f02('0x78')]=moment()[_0x1f02('0x77')](_0x1f9e2f[_0x1f02('0x26')])[_0x1f02('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23ad42[_0x1f02('0x24')](0xc8)[_0x1f02('0x33')](_0x1f9e2f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 34ec869..a76253b 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x55ca,0x126));var _0xa55c=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x55ca[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x7217,0x19e));var _0x7721=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7217[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 93fd860..c499444 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 _0x6a3e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','options','raw','include','model','map','attributes','ShowSetting','debug','catch','lodash','moment','randomstring','ioredis'];(function(_0x2c4a6e,_0x21b837){var _0x28e4fd=function(_0x1047c3){while(--_0x1047c3){_0x2c4a6e['push'](_0x2c4a6e['shift']());}};_0x28e4fd(++_0x21b837);}(_0x6a3e,0x7c));var _0xe6a3=function(_0x348b66,_0x5bc38c){_0x348b66=_0x348b66-0x0;var _0xf63c2=_0x6a3e[_0x348b66];return _0xf63c2;};'use strict';var _=require(_0xe6a3('0x0'));var util=require('util');var moment=require(_0xe6a3('0x1'));var BPromise=require('bluebird');var rs=require(_0xe6a3('0x2'));var fs=require('fs');var Redis=require(_0xe6a3('0x3'));var db=require(_0xe6a3('0x4'))['db'];var utils=require(_0xe6a3('0x5'));var logger=require(_0xe6a3('0x6'))('rpc');var config=require(_0xe6a3('0x7'));var jayson=require(_0xe6a3('0x8'));var client=jayson[_0xe6a3('0x9')][_0xe6a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34206d,_0x599c86,_0x34dfb3){return new BPromise(function(_0x28e9cf,_0x590f83){return client[_0xe6a3('0xb')](_0x34206d,_0x34dfb3)[_0xe6a3('0xc')](function(_0xc9e8e0){logger[_0xe6a3('0xd')](_0xe6a3('0xe'),_0x599c86,_0xe6a3('0xf'));logger['debug'](_0xe6a3('0x10'),_0x599c86,_0xe6a3('0xf'),JSON[_0xe6a3('0x11')](_0xc9e8e0));if(_0xc9e8e0['error']){if(_0xc9e8e0[_0xe6a3('0x12')][_0xe6a3('0x13')]===0x1f4){logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0xc9e8e0[_0xe6a3('0x12')][_0xe6a3('0x14')]);return _0x590f83(_0xc9e8e0[_0xe6a3('0x12')]['message']);}logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0xc9e8e0['error'][_0xe6a3('0x14')]);return _0x28e9cf(_0xc9e8e0[_0xe6a3('0x12')]['message']);}else{logger[_0xe6a3('0xd')](_0xe6a3('0xe'),_0x599c86,'request\x20sent');_0x28e9cf(_0xc9e8e0[_0xe6a3('0x15')][_0xe6a3('0x14')]);}})['catch'](function(_0x479ce0){logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0x479ce0);_0x590f83(_0x479ce0);});});}exports['ShowSetting']=function(_0x9f2b68){var _0x574936=this;return new Promise(function(_0x154392,_0x1de1c7){return db[_0xe6a3('0x16')]['find']({'raw':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x18')]===undefined?!![]:![]:!![],'where':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')]['where']||null:null,'attributes':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')]['attributes']||null:null,'include':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x19')]?_['map'](_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x19')],function(_0xa58b5b){return{'model':db[_0xa58b5b[_0xe6a3('0x1a')]],'as':_0xa58b5b['as'],'attributes':_0xa58b5b['attributes'],'include':_0xa58b5b[_0xe6a3('0x19')]?_[_0xe6a3('0x1b')](_0xa58b5b[_0xe6a3('0x19')],function(_0x3ab7d1){return{'model':db[_0x3ab7d1['model']],'as':_0x3ab7d1['as'],'attributes':_0x3ab7d1[_0xe6a3('0x1c')],'include':_0x3ab7d1['include']?_[_0xe6a3('0x1b')](_0x3ab7d1['include'],function(_0x157577){return{'model':db[_0x157577[_0xe6a3('0x1a')]],'as':_0x157577['as'],'attributes':_0x157577['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x92a19d){logger[_0xe6a3('0xd')](_0xe6a3('0x1d'),_0x9f2b68);logger[_0xe6a3('0x1e')]('ShowSetting',_0x9f2b68,JSON['stringify'](_0x92a19d));_0x154392(_0x92a19d);})[_0xe6a3('0x1f')](function(_0x52df1a){logger[_0xe6a3('0x12')](_0xe6a3('0x1d'),_0x52df1a['message'],_0x9f2b68);_0x1de1c7(_0x574936[_0xe6a3('0x12')](0x1f4,_0x52df1a[_0xe6a3('0x14')]));});});}; \ No newline at end of file +var _0x5fc1=['then','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x5fc1,0x1c3));var _0x15fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15fc('0x0'));var util=require(_0x15fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15fc('0x2'));var fs=require('fs');var Redis=require(_0x15fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15fc('0x4'))(_0x15fc('0x5'));var config=require('../../config/environment');var jayson=require(_0x15fc('0x6'));var client=jayson[_0x15fc('0x7')][_0x15fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x535400,_0xd9660a,_0x55b775){return new BPromise(function(_0x93615a,_0x40ed48){return client[_0x15fc('0x9')](_0x535400,_0x55b775)['then'](function(_0x4d63a1){logger[_0x15fc('0xa')]('Setting,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'));logger[_0x15fc('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'),JSON['stringify'](_0x4d63a1));if(_0x4d63a1[_0x15fc('0xd')]){if(_0x4d63a1[_0x15fc('0xd')][_0x15fc('0xe')]===0x1f4){logger['error'](_0x15fc('0xf'),_0xd9660a,_0x4d63a1[_0x15fc('0xd')][_0x15fc('0x10')]);return _0x40ed48(_0x4d63a1[_0x15fc('0xd')][_0x15fc('0x10')]);}logger[_0x15fc('0xd')](_0x15fc('0xf'),_0xd9660a,_0x4d63a1[_0x15fc('0xd')]['message']);return _0x93615a(_0x4d63a1[_0x15fc('0xd')]['message']);}else{logger[_0x15fc('0xa')]('Setting,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'));_0x93615a(_0x4d63a1[_0x15fc('0x11')][_0x15fc('0x10')]);}})[_0x15fc('0x12')](function(_0x28b460){logger[_0x15fc('0xd')](_0x15fc('0xf'),_0xd9660a,_0x28b460);_0x40ed48(_0x28b460);});});}exports[_0x15fc('0x13')]=function(_0x28ca29){var _0xcdc238=this;return new Promise(function(_0x53dd02,_0x22695f){return db[_0x15fc('0x14')][_0x15fc('0x15')]({'raw':_0x28ca29[_0x15fc('0x16')]?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x17')]===undefined?!![]:![]:!![],'where':_0x28ca29['options']?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x18')]||null:null,'attributes':_0x28ca29['options']?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x19')]||null:null,'include':_0x28ca29[_0x15fc('0x16')]?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x1a')]?_[_0x15fc('0x1b')](_0x28ca29[_0x15fc('0x16')][_0x15fc('0x1a')],function(_0x473b4f){return{'model':db[_0x473b4f['model']],'as':_0x473b4f['as'],'attributes':_0x473b4f[_0x15fc('0x19')],'include':_0x473b4f['include']?_[_0x15fc('0x1b')](_0x473b4f[_0x15fc('0x1a')],function(_0x13553f){return{'model':db[_0x13553f['model']],'as':_0x13553f['as'],'attributes':_0x13553f[_0x15fc('0x19')],'include':_0x13553f[_0x15fc('0x1a')]?_[_0x15fc('0x1b')](_0x13553f[_0x15fc('0x1a')],function(_0x5c34b7){return{'model':db[_0x5c34b7[_0x15fc('0x1c')]],'as':_0x5c34b7['as'],'attributes':_0x5c34b7[_0x15fc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x15fc('0x1d')](function(_0x46d5ea){logger[_0x15fc('0xa')](_0x15fc('0x13'),_0x28ca29);logger[_0x15fc('0xc')](_0x15fc('0x13'),_0x28ca29,JSON['stringify'](_0x46d5ea));_0x53dd02(_0x46d5ea);})[_0x15fc('0x12')](function(_0x8e203e){logger[_0x15fc('0xd')](_0x15fc('0x13'),_0x8e203e[_0x15fc('0x10')],_0x28ca29);_0x22695f(_0xcdc238[_0x15fc('0xd')](0x1f4,_0x8e203e[_0x15fc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c94e38b..7f2ce98 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x2d42b2,_0x15586b){var _0x474ad5=function(_0xa1094b){while(--_0xa1094b){_0x2d42b2['push'](_0x2d42b2['shift']());}};_0x474ad5(++_0x15586b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1fbd6b,_0x209219){var _0x6e8190=function(_0x2d55de){while(--_0x2d55de){_0x1fbd6b['push'](_0x1fbd6b['shift']());}};_0x6e8190(++_0x209219);}(_0x7a54,0x106));var _0x47a5=function(_0x3cc46f,_0x30523c){_0x3cc46f=_0x3cc46f-0x0;var _0x1c907a=_0x7a54[_0x3cc46f];return _0x1c907a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 9312892..68539c0 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 _0xbaa1=['exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x43d25c,_0xcafbc7){var _0x1a378c=function(_0x59c1ce){while(--_0x59c1ce){_0x43d25c['push'](_0x43d25c['shift']());}};_0x1a378c(++_0xcafbc7);}(_0xbaa1,0x1a3));var _0x1baa=function(_0x21a8ed,_0x54d122){_0x21a8ed=_0x21a8ed-0x0;var _0x641ed9=_0xbaa1[_0x21a8ed];return _0x641ed9;};'use strict';var Sequelize=require(_0x1baa('0x0'));var rs=require('randomstring');module[_0x1baa('0x1')]={'name':{'type':Sequelize[_0x1baa('0x2')],'unique':_0x1baa('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1baa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1baa('0x2')],'defaultValue':function(){return rs[_0x1baa('0x4')]();}},'phone':{'type':Sequelize[_0x1baa('0x2')]},'type':{'type':Sequelize[_0x1baa('0x5')](_0x1baa('0x6'),_0x1baa('0x7'),_0x1baa('0x8'),_0x1baa('0x9'),_0x1baa('0xa'),_0x1baa('0xb'),'bandwidth',_0x1baa('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x1baa('0x2')]},'authId':{'type':Sequelize[_0x1baa('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1baa('0x2')]},'apiKey':{'type':Sequelize[_0x1baa('0x2')]},'applicationId':{'type':Sequelize[_0x1baa('0x2')]},'accountId':{'type':Sequelize[_0x1baa('0x2')]},'senderString':{'type':Sequelize[_0x1baa('0x2')]},'deliveryReport':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x1baa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1baa('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1baa('0xf')],'comment':_0x1baa('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1264e1){if(!_0x1264e1)this[_0x1baa('0x11')](_0x1baa('0x12'),null);this[_0x1baa('0x11')](_0x1baa('0x13'),_0x1264e1);}}}; \ No newline at end of file +var _0x1d95=['randomstring','exports','name','STRING','generate','skebby','connectel','clicksend','csc','intelepeer','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d95,0x117));var _0x51d9=function(_0x86e660,_0x4db72e){_0x86e660=_0x86e660-0x0;var _0x3c7a0a=_0x1d95[_0x86e660];return _0x3c7a0a;};'use strict';var Sequelize=require(_0x51d9('0x0'));var rs=require(_0x51d9('0x1'));module[_0x51d9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x51d9('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x51d9('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x51d9('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x51d9('0x4')],'defaultValue':function(){return rs[_0x51d9('0x5')]();}},'phone':{'type':Sequelize[_0x51d9('0x4')]},'type':{'type':Sequelize['ENUM']('twilio',_0x51d9('0x6'),_0x51d9('0x7'),_0x51d9('0x8'),'plivo','clickatell','bandwidth',_0x51d9('0x9'),'infobip',_0x51d9('0xa'))},'accountSid':{'type':Sequelize[_0x51d9('0x4')]},'authId':{'type':Sequelize[_0x51d9('0x4')]},'authToken':{'type':Sequelize[_0x51d9('0x4')]},'smsMethod':{'type':Sequelize[_0x51d9('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x51d9('0x4')]},'password':{'type':Sequelize[_0x51d9('0x4')]},'apiKey':{'type':Sequelize[_0x51d9('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x51d9('0x4')]},'notificationTemplate':{'type':Sequelize[_0x51d9('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x51d9('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x51d9('0xe')],'comment':_0x51d9('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![],'comment':_0x51d9('0x10'),'set':function(_0x18cde4){if(!_0x18cde4)this[_0x51d9('0x11')](_0x51d9('0x12'),null);this[_0x51d9('0x11')](_0x51d9('0x13'),_0x18cde4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 8df6ecb..f42b34a 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 _0xca28=['mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','SmsAccounts','end','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','order','findAll','removeAnswers','sms','SmsApplication','Applications','account','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','SmsMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','text/xml','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','ListId','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x3ca5a5,_0x1e0f40){var _0x27021d=function(_0x496778){while(--_0x496778){_0x3ca5a5['push'](_0x3ca5a5['shift']());}};_0x27021d(++_0x1e0f40);}(_0xca28,0xe8));var _0x8ca2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xca28[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x8ca2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ca2('0x1'));var jsonpatch=require(_0x8ca2('0x2'));var rp=require('request-promise');var moment=require(_0x8ca2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ca2('0x4'));var util=require(_0x8ca2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8ca2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8ca2('0x7'));var crypto=require(_0x8ca2('0x8'));var jsforce=require(_0x8ca2('0x9'));var deskjs=require(_0x8ca2('0xa'));var toCsv=require(_0x8ca2('0x6'));var querystring=require(_0x8ca2('0xb'));var Papa=require(_0x8ca2('0xc'));var Redis=require(_0x8ca2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8ca2('0xe'));var as=require(_0x8ca2('0xf'));var hardwareService=require(_0x8ca2('0x10'));var logger=require(_0x8ca2('0x11'))('api');var utils=require(_0x8ca2('0x12'));var config=require(_0x8ca2('0x13'));var licenseUtil=require(_0x8ca2('0x14'));var db=require(_0x8ca2('0x15'))['db'];config[_0x8ca2('0x16')]=_[_0x8ca2('0x17')](config[_0x8ca2('0x16')],{'host':_0x8ca2('0x18'),'port':0x18eb});var socket=require(_0x8ca2('0x19'))(new Redis(config[_0x8ca2('0x16')]));require(_0x8ca2('0x1a'))[_0x8ca2('0x1b')](socket);var jayson=require(_0x8ca2('0x1c'));var client=jayson[_0x8ca2('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x425aa8,_0x4af740,_0x1e462d,_0x1fda32){return new BPromise(function(_0x564d12,_0x46b98d){var _0x12846b=_0x1fda32||client;return _0x12846b[_0x8ca2('0x1e')](_0x425aa8,_0x1e462d)['then'](function(_0x1d4d0e){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x8ca2('0x1f'));logger[_0x8ca2('0x20')](_0x8ca2('0x21'),_0x4af740,_0x8ca2('0x1f'),JSON[_0x8ca2('0x22')](_0x1d4d0e));if(_0x1d4d0e[_0x8ca2('0x23')]){if(_0x1d4d0e['error'][_0x8ca2('0x24')]===0x1f4){logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x1d4d0e['error'][_0x8ca2('0x25')]);return _0x46b98d(_0x1d4d0e[_0x8ca2('0x23')][_0x8ca2('0x25')]);}logger['error'](_0x8ca2('0x26'),_0x4af740,_0x1d4d0e['error']['message']);return _0x564d12(_0x1d4d0e[_0x8ca2('0x23')][_0x8ca2('0x25')]);}else{logger[_0x8ca2('0x27')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x8ca2('0x1f'));_0x564d12(_0x1d4d0e[_0x8ca2('0x28')]['message']);}})[_0x8ca2('0x29')](function(_0x303ea7){logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x303ea7);_0x46b98d(_0x303ea7);});});}function respondWithStatusCode(_0x14d3dd,_0x423901){_0x423901=_0x423901||0xcc;return function(_0xa66079){if(_0xa66079){return _0x14d3dd[_0x8ca2('0x2a')](_0x423901);}return _0x14d3dd[_0x8ca2('0x2b')](_0x423901)['end']();};}function respondWithResult(_0x38ff17,_0x48f13c){_0x48f13c=_0x48f13c||0xc8;return function(_0x25368b){if(_0x25368b){return _0x38ff17[_0x8ca2('0x2b')](_0x48f13c)[_0x8ca2('0x2c')](_0x25368b);}};}function respondWithFilteredResult(_0x1d38ef,_0x188d38){return function(_0x2e29f2){if(_0x2e29f2){var _0x238692=typeof _0x188d38['offset']==='undefined'&&typeof _0x188d38['limit']===_0x8ca2('0x2d');var _0x1712de=_0x2e29f2[_0x8ca2('0x2e')];var _0x738c35=_0x238692?0x0:_0x188d38[_0x8ca2('0x2f')];var _0x494ec9=_0x238692?_0x2e29f2[_0x8ca2('0x2e')]:_0x188d38['offset']+_0x188d38[_0x8ca2('0x30')];var _0x1ba627;if(_0x494ec9>=_0x1712de){_0x494ec9=_0x1712de;_0x1ba627=0xc8;}else{_0x1ba627=0xce;}_0x1d38ef[_0x8ca2('0x2b')](_0x1ba627);return _0x1d38ef[_0x8ca2('0x31')](_0x8ca2('0x32'),_0x738c35+'-'+_0x494ec9+'/'+_0x1712de)['json'](_0x2e29f2);}return null;};}function patchUpdates(_0x475a00){return function(_0x1b6221){try{jsonpatch[_0x8ca2('0x33')](_0x1b6221,_0x475a00,!![]);}catch(_0x158d5d){return BPromise[_0x8ca2('0x34')](_0x158d5d);}return _0x1b6221[_0x8ca2('0x35')]();};}function saveUpdates(_0x1fc1b4,_0x118f59){return function(_0x7a2068){if(_0x7a2068){return _0x7a2068[_0x8ca2('0x36')](_0x1fc1b4)[_0x8ca2('0x37')](function(_0x2ce7d6){return _0x2ce7d6;});}return null;};}function removeEntity(_0x2ad4c8,_0x6b9e7b){return function(_0x2d574d){if(_0x2d574d){return _0x2d574d[_0x8ca2('0x38')]()[_0x8ca2('0x37')](function(){var _0x18a2f3=_0x2d574d['get']({'plain':!![]});var _0x3e98dc=_0x8ca2('0x39');return db['UserProfileResource'][_0x8ca2('0x38')]({'where':{'type':_0x3e98dc,'resourceId':_0x18a2f3['id']}})[_0x8ca2('0x37')](function(){return _0x2d574d;});})[_0x8ca2('0x37')](function(){_0x2ad4c8['status'](0xcc)[_0x8ca2('0x3a')]();});}};}function handleEntityNotFound(_0x3f8887,_0x4d7a12){return function(_0x524ee4){if(!_0x524ee4){_0x3f8887[_0x8ca2('0x2a')](0x194);}return _0x524ee4;};}function handleError(_0x5de5fc,_0x229f15){_0x229f15=_0x229f15||0x1f4;return function(_0x5098dd){logger[_0x8ca2('0x23')](_0x5098dd[_0x8ca2('0x3b')]);if(_0x5098dd[_0x8ca2('0x3c')]){delete _0x5098dd[_0x8ca2('0x3c')];}_0x5de5fc[_0x8ca2('0x2b')](_0x229f15)[_0x8ca2('0x3d')](_0x5098dd);};}exports['index']=function(_0x438720,_0x539439){var _0x1d849d={'include':[{'model':db[_0x8ca2('0x3e')],'as':_0x8ca2('0x3f')}]},_0x1d7d8e={},_0x265b99={'count':0x0,'rows':[]};var _0x29e987=_['map'](db[_0x8ca2('0x40')][_0x8ca2('0x41')],function(_0x92d983){return{'name':_0x92d983[_0x8ca2('0x42')],'type':_0x92d983[_0x8ca2('0x43')][_0x8ca2('0x44')]};});_0x1d7d8e[_0x8ca2('0x45')]=_['map'](_0x29e987,'name');_0x1d7d8e['query']=_[_0x8ca2('0x46')](_0x438720[_0x8ca2('0x47')]);_0x1d7d8e['filters']=_[_0x8ca2('0x48')](_0x1d7d8e[_0x8ca2('0x45')],_0x1d7d8e[_0x8ca2('0x47')]);_0x1d849d[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x1d7d8e[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x438720[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x1d849d[_0x8ca2('0x49')]=_0x1d849d[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x1d849d['attributes']:_0x1d7d8e['model'];if(!_0x438720['query'][_0x8ca2('0x4c')]('nolimit')){_0x1d849d[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x438720[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x1d849d[_0x8ca2('0x2f')]=qs['offset'](_0x438720['query'][_0x8ca2('0x2f')]);}_0x1d849d['order']=qs[_0x8ca2('0x4d')](_0x438720[_0x8ca2('0x47')]['sort']);_0x1d849d[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x438720[_0x8ca2('0x47')],_0x1d7d8e[_0x8ca2('0x4f')]),_0x29e987);if(_0x438720[_0x8ca2('0x47')][_0x8ca2('0x51')]){_0x1d849d[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x1d849d[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x29e987,function(_0x439d4f){if(_0x439d4f[_0x8ca2('0x43')]!==_0x8ca2('0x54')){var _0x572550={};_0x572550[_0x439d4f[_0x8ca2('0x3c')]]={'$like':'%'+_0x438720[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x572550;}})});}_0x1d849d=_[_0x8ca2('0x52')]({},_0x1d849d,_0x438720['options']);var _0x444fba={'where':_0x1d849d['where']};return db[_0x8ca2('0x40')][_0x8ca2('0x2e')](_0x444fba)[_0x8ca2('0x37')](function(_0x316bc8){_0x265b99[_0x8ca2('0x2e')]=_0x316bc8;if(_0x438720['query'][_0x8ca2('0x55')]){_0x1d849d[_0x8ca2('0x56')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1d849d);})['then'](function(_0x52a8d2){_0x265b99[_0x8ca2('0x57')]=_0x52a8d2;return _0x265b99;})[_0x8ca2('0x37')](respondWithFilteredResult(_0x539439,_0x1d849d))[_0x8ca2('0x29')](handleError(_0x539439,null));};exports[_0x8ca2('0x58')]=function(_0x1db00b,_0x11a9aa){var _0x129191={'raw':![],'where':{'id':_0x1db00b[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5202fd={};_0x5202fd[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db[_0x8ca2('0x40')][_0x8ca2('0x41')]);_0x5202fd['query']=_[_0x8ca2('0x46')](_0x1db00b[_0x8ca2('0x47')]);_0x5202fd['filters']=_['intersection'](_0x5202fd[_0x8ca2('0x45')],_0x5202fd[_0x8ca2('0x47')]);_0x129191[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x5202fd[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x1db00b[_0x8ca2('0x47')]['fields']));_0x129191[_0x8ca2('0x49')]=_0x129191[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x129191[_0x8ca2('0x49')]:_0x5202fd[_0x8ca2('0x45')];if(_0x1db00b[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x129191[_0x8ca2('0x56')]=[{'all':!![]}];}_0x129191=_[_0x8ca2('0x52')]({},_0x129191,_0x1db00b['options']);return db[_0x8ca2('0x40')]['find'](_0x129191)[_0x8ca2('0x37')](handleEntityNotFound(_0x11a9aa,null))[_0x8ca2('0x37')](respondWithResult(_0x11a9aa,null))[_0x8ca2('0x29')](handleError(_0x11a9aa,null));};exports[_0x8ca2('0x5a')]=function(_0x5395c8,_0x30448a){return db[_0x8ca2('0x40')][_0x8ca2('0x5a')](_0x5395c8[_0x8ca2('0x5b')],{})[_0x8ca2('0x37')](function(_0x3f64d4){var _0x1f778e=_0x5395c8[_0x8ca2('0x5c')]['get']({'plain':!![]});if(!_0x1f778e)throw new Error(_0x8ca2('0x5d'));if(_0x1f778e[_0x8ca2('0x5e')]==='user'){var _0x3a64c4=_0x3f64d4[_0x8ca2('0x5f')]({'plain':!![]});var _0x23a89a=_0x8ca2('0x39');return db['UserProfileSection'][_0x8ca2('0x60')]({'where':{'name':_0x23a89a,'userProfileId':_0x1f778e[_0x8ca2('0x61')]},'raw':!![]})[_0x8ca2('0x37')](function(_0x58fda9){if(_0x58fda9&&_0x58fda9[_0x8ca2('0x62')]===0x0){return db[_0x8ca2('0x63')][_0x8ca2('0x5a')]({'name':_0x3a64c4[_0x8ca2('0x3c')],'resourceId':_0x3a64c4['id'],'type':_0x58fda9['name'],'sectionId':_0x58fda9['id']},{})[_0x8ca2('0x37')](function(){return _0x3f64d4;});}else{return _0x3f64d4;}})['catch'](function(_0x3cb99e){logger['error'](_0x8ca2('0x64'),_0x3cb99e);throw _0x3cb99e;});}return _0x3f64d4;})[_0x8ca2('0x37')](respondWithResult(_0x30448a,0xc9))[_0x8ca2('0x29')](handleError(_0x30448a,null));};exports[_0x8ca2('0x36')]=function(_0x2497d8,_0x311f9c){if(_0x2497d8[_0x8ca2('0x5b')]['id']){delete _0x2497d8[_0x8ca2('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2497d8['params']['id']},'include':[{'model':db[_0x8ca2('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x8ca2('0x37')](handleEntityNotFound(_0x311f9c,null))[_0x8ca2('0x37')](saveUpdates(_0x2497d8[_0x8ca2('0x5b')],null))[_0x8ca2('0x37')](respondWithResult(_0x311f9c,null))[_0x8ca2('0x29')](handleError(_0x311f9c,null));};exports['destroy']=function(_0xad63e5,_0x4790e2){return db[_0x8ca2('0x40')]['find']({'where':{'id':_0xad63e5[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x4790e2,null))[_0x8ca2('0x37')](removeEntity(_0x4790e2,null))[_0x8ca2('0x29')](handleError(_0x4790e2,null));};exports['describe']=function(_0x2d7f9d,_0x265de9){return db[_0x8ca2('0x40')][_0x8ca2('0x65')]()[_0x8ca2('0x37')](respondWithResult(_0x265de9,null))[_0x8ca2('0x29')](handleError(_0x265de9,null));};exports[_0x8ca2('0x66')]=function(_0x29102a,_0x40dbe1,_0x4f6f57){if(_0x29102a[_0x8ca2('0x5b')]['id']){delete _0x29102a[_0x8ca2('0x5b')]['id'];}return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x29102a[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x40dbe1,null))[_0x8ca2('0x37')](function(_0x35b8fd){if(_0x35b8fd){_0x29102a[_0x8ca2('0x5b')][_0x8ca2('0x67')]=_0x35b8fd['id'];return db[_0x8ca2('0x68')][_0x8ca2('0x5a')](_0x29102a[_0x8ca2('0x5b')]);}})[_0x8ca2('0x37')](respondWithResult(_0x40dbe1,null))[_0x8ca2('0x29')](handleError(_0x40dbe1,null));};exports[_0x8ca2('0x69')]=function(_0x115982,_0x2bd766,_0x209e37){var _0x5964f4={'raw':![],'where':{}};var _0xe6034b={};var _0x2fc7c4={'count':0x0,'rows':[]};return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0x115982[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x2bd766,null))['then'](function(_0x3f2bd7){if(_0x3f2bd7){_0xe6034b[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db[_0x8ca2('0x68')][_0x8ca2('0x41')]);_0xe6034b[_0x8ca2('0x47')]=_['keys'](_0x115982[_0x8ca2('0x47')]);_0xe6034b[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0xe6034b[_0x8ca2('0x45')],_0xe6034b[_0x8ca2('0x47')]);_0x5964f4[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0xe6034b['model'],qs[_0x8ca2('0x4a')](_0x115982['query'][_0x8ca2('0x4a')]));_0x5964f4['attributes']=_0x5964f4['attributes']['length']?_0x5964f4['attributes']:_0xe6034b[_0x8ca2('0x45')];if(!_0x115982[_0x8ca2('0x47')]['hasOwnProperty']('nolimit')){_0x5964f4['limit']=qs[_0x8ca2('0x30')](_0x115982['query'][_0x8ca2('0x30')]);_0x5964f4[_0x8ca2('0x2f')]=qs[_0x8ca2('0x2f')](_0x115982[_0x8ca2('0x47')][_0x8ca2('0x2f')]);}_0x5964f4['order']=qs[_0x8ca2('0x4d')](_0x115982[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x5964f4[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x115982[_0x8ca2('0x47')],_0xe6034b[_0x8ca2('0x4f')]));_0x5964f4[_0x8ca2('0x4e')][_0x8ca2('0x67')]=_0x3f2bd7['id'];if(_0x115982['query'][_0x8ca2('0x51')]){_0x5964f4[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x5964f4[_0x8ca2('0x4e')],{'$or':_['map'](_0x5964f4['attributes'],function(_0x345880){var _0x2444ac={};_0x2444ac[_0x345880]={'$like':'%'+_0x115982['query'][_0x8ca2('0x51')]+'%'};return _0x2444ac;})});}_0x5964f4=_[_0x8ca2('0x52')]({},_0x5964f4,_0x115982[_0x8ca2('0x6b')]);return db[_0x8ca2('0x68')]['count']({'where':_0x5964f4['where']})[_0x8ca2('0x37')](function(_0x4f297d){_0x2fc7c4[_0x8ca2('0x2e')]=_0x4f297d;if(_0x115982[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x5964f4[_0x8ca2('0x56')]=[{'all':!![]}];}return db[_0x8ca2('0x68')]['findAll'](_0x5964f4);})[_0x8ca2('0x37')](function(_0x5f14ed){_0x2fc7c4[_0x8ca2('0x57')]=_0x5f14ed;return _0x2fc7c4;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x2bd766,_0x5964f4))[_0x8ca2('0x29')](handleError(_0x2bd766,null));};exports[_0x8ca2('0x6c')]=function(_0x57cc97,_0x128893,_0x31e70c){return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0x57cc97['params']['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x128893,null))['then'](function(_0x2ab8ed){if(_0x2ab8ed){return _0x2ab8ed['removeDispositions'](_0x57cc97['query'][_0x8ca2('0x6d')]);}})['then'](respondWithStatusCode(_0x128893,null))[_0x8ca2('0x29')](handleError(_0x128893,null));};exports[_0x8ca2('0x6e')]=function(_0x3e6766,_0x3bbaa8,_0x46e1fc){if(_0x3e6766[_0x8ca2('0x5b')]['id']){delete _0x3e6766['body']['id'];}return db[_0x8ca2('0x40')]['find']({'where':{'id':_0x3e6766[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x3bbaa8,null))[_0x8ca2('0x37')](function(_0x25ae23){if(_0x25ae23){_0x3e6766[_0x8ca2('0x5b')][_0x8ca2('0x67')]=_0x25ae23['id'];return db[_0x8ca2('0x6f')][_0x8ca2('0x5a')](_0x3e6766[_0x8ca2('0x5b')]);}})[_0x8ca2('0x37')](respondWithResult(_0x3bbaa8,null))[_0x8ca2('0x29')](handleError(_0x3bbaa8,null));};exports[_0x8ca2('0x70')]=function(_0x266cef,_0x489ebd,_0x4b8fa7){var _0x5cd0d8={'raw':![],'where':{}};var _0x32f2aa={};var _0x159725={'count':0x0,'rows':[]};return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0x266cef[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x489ebd,null))['then'](function(_0x1fc4d6){if(_0x1fc4d6){_0x32f2aa[_0x8ca2('0x45')]=_['keys'](db[_0x8ca2('0x6f')][_0x8ca2('0x41')]);_0x32f2aa['query']=_['keys'](_0x266cef[_0x8ca2('0x47')]);_0x32f2aa[_0x8ca2('0x4f')]=_['intersection'](_0x32f2aa[_0x8ca2('0x45')],_0x32f2aa[_0x8ca2('0x47')]);_0x5cd0d8[_0x8ca2('0x49')]=_['intersection'](_0x32f2aa[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x5cd0d8['attributes']=_0x5cd0d8[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x5cd0d8[_0x8ca2('0x49')]:_0x32f2aa[_0x8ca2('0x45')];if(!_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x5cd0d8['limit']=qs['limit'](_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x5cd0d8['offset']=qs['offset'](_0x266cef[_0x8ca2('0x47')]['offset']);}_0x5cd0d8[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0x266cef[_0x8ca2('0x47')]['sort']);_0x5cd0d8[_0x8ca2('0x4e')]=qs['filters'](_[_0x8ca2('0x50')](_0x266cef['query'],_0x32f2aa[_0x8ca2('0x4f')]));_0x5cd0d8['where'][_0x8ca2('0x67')]=_0x1fc4d6['id'];if(_0x266cef['query']['filter']){_0x5cd0d8[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x5cd0d8[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x5cd0d8[_0x8ca2('0x49')],function(_0x3de323){var _0x2b4618={};_0x2b4618[_0x3de323]={'$like':'%'+_0x266cef[_0x8ca2('0x47')]['filter']+'%'};return _0x2b4618;})});}_0x5cd0d8=_[_0x8ca2('0x52')]({},_0x5cd0d8,_0x266cef[_0x8ca2('0x6b')]);return db['CannedAnswer'][_0x8ca2('0x2e')]({'where':_0x5cd0d8[_0x8ca2('0x4e')]})[_0x8ca2('0x37')](function(_0x72f57d){_0x159725[_0x8ca2('0x2e')]=_0x72f57d;if(_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x5cd0d8[_0x8ca2('0x56')]=[{'all':!![]}];}return db[_0x8ca2('0x6f')][_0x8ca2('0x73')](_0x5cd0d8);})[_0x8ca2('0x37')](function(_0xc93d9c){_0x159725[_0x8ca2('0x57')]=_0xc93d9c;return _0x159725;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x489ebd,_0x5cd0d8))[_0x8ca2('0x29')](handleError(_0x489ebd,null));};exports['removeAnswers']=function(_0x5ac62c,_0x589680,_0x354998){return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x5ac62c[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x589680,null))[_0x8ca2('0x37')](function(_0x5205e7){if(_0x5205e7){return _0x5205e7[_0x8ca2('0x74')](_0x5ac62c[_0x8ca2('0x47')][_0x8ca2('0x6d')]);}})['then'](respondWithStatusCode(_0x589680,null))[_0x8ca2('0x29')](handleError(_0x589680,null));};exports['notify']=function(_0x110c8b,_0x553a5f,_0x467b7f){var _0x1e7a15={'channel':_0x8ca2('0x75')};var _0x17b46f=[];var _0x49b86b=[];var _0x366bf7={};return db['SmsAccount']['find']({'where':{'id':_0x110c8b[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0x76')],'as':_0x8ca2('0x77')}]})['then'](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x2a9494){_0x1e7a15[_0x8ca2('0x78')]=_0x2a9494;_0x1e7a15['applications']=_['orderBy'](_0x2a9494[_0x8ca2('0x77')],[_0x8ca2('0x79')],[_0x8ca2('0x7a')]);if(_0x1e7a15['account'][_0x8ca2('0x77')]){delete _0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0x77')];}return db[_0x8ca2('0x7b')][_0x8ca2('0x65')]();})[_0x8ca2('0x37')](function(_0x52d9fc){if(!_0x52d9fc){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x7e'));}_0x17b46f=_['difference'](_[_0x8ca2('0x46')](_0x52d9fc),[_0x8ca2('0x7f'),_0x8ca2('0x80')]);_0x49b86b=_[_0x8ca2('0x81')](_[_0x8ca2('0x46')](_0x52d9fc),['createdAt',_0x8ca2('0x80'),_0x8ca2('0x82'),'ListId']);_0x1e7a15[_0x8ca2('0x5b')]={'mapKey':'mobile'};if(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0x43')]){switch(_0x1e7a15[_0x8ca2('0x78')]['type']){case _0x8ca2('0x83'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b['body'][_0x8ca2('0x85')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x86')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x88')];break;case _0x8ca2('0x89'):_0x1e7a15[_0x8ca2('0x5b')]['from']='+'+_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x8a')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b['body'][_0x8ca2('0x8b')];break;case _0x8ca2('0x8c'):_0x1e7a15[_0x8ca2('0x5b')]['from']=_0x110c8b[_0x8ca2('0x5b')]['from'];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')]['message'];break;case _0x8ca2('0x8d'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')]['body'];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')]['message_id'];break;case _0x8ca2('0x8e'):_0x1e7a15[_0x8ca2('0x5b')]['from']=_0x110c8b['body'][_0x8ca2('0x85')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b['body'][_0x8ca2('0x8f')];_0x1e7a15['body'][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x90')];break;case _0x8ca2('0x91'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]='+'+_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0]['text'];_0x1e7a15[_0x8ca2('0x5b')]['messageId']=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0][_0x8ca2('0x87')];break;case _0x8ca2('0x93'):_0x1e7a15['body'][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x94')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x95')][_0x8ca2('0x25')];break;case _0x8ca2('0x96'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x97')];_0x1e7a15['body'][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')]['text'];_0x1e7a15[_0x8ca2('0x5b')]['messageId']=_0x110c8b[_0x8ca2('0x5b')]['replyMessageId'];break;case _0x8ca2('0x98'):_0x1e7a15['body']['messageId']=_0x110c8b[_0x8ca2('0x5b')][0x0][_0x8ca2('0x25')]['id'];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b['body'][0x0][_0x8ca2('0x25')][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')][0x0]['message']['text'];break;case _0x8ca2('0x99'):_0x1e7a15['body'][_0x8ca2('0x84')]=_0x110c8b['body'][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x25')];_0x1e7a15['body'][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x9a')];break;}}if(_0x1e7a15[_0x8ca2('0x5b')]['id']){delete _0x1e7a15[_0x8ca2('0x5b')]['id'];}if(_[_0x8ca2('0x9b')](_0x1e7a15[_0x8ca2('0x5b')]['from'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x9c'));}if(_[_0x8ca2('0x9b')](_0x1e7a15[_0x8ca2('0x5b')]['body'])||_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]===''){throw new db[(_0x8ca2('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x9d')])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x9e')+_0x49b86b);}if(!_[_0x8ca2('0x9f')](_0x49b86b,_0x1e7a15['body']['mapKey'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0xa0')+_0x49b86b);}_0x366bf7[_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x9d')]]=_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')];return db[_0x8ca2('0xa1')]['find']({'where':{'id':_0x1e7a15[_0x8ca2('0x78')]['ListId']},'include':[{'model':db[_0x8ca2('0x7b')],'as':_0x8ca2('0xa2'),'where':_0x366bf7,'limit':0x1,'order':[[_0x8ca2('0x80'),_0x8ca2('0xa3')]]}]});})[_0x8ca2('0x37')](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x249937){if(_0x249937){_0x1e7a15['list']=_[_0x8ca2('0xa4')](_0x249937,['Contacts']);if(_0x249937[_0x8ca2('0xa2')]['length']){return _0x249937['Contacts'][0x0];}var _0x4c7d3a=_[_0x8ca2('0x17')](_0x1e7a15[_0x8ca2('0x5b')],{'firstName':_0x1e7a15['body'][_0x8ca2('0x84')],'ListId':_0x249937['id']});_0x4c7d3a[_0x1e7a15[_0x8ca2('0x5b')]['mapKey']]=_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')];return db[_0x8ca2('0x7b')]['create'](_0x4c7d3a,{'fields':_0x17b46f,'raw':!![]});}})[_0x8ca2('0x37')](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x282bf9){if(_0x282bf9){_0x1e7a15[_0x8ca2('0xa5')]=_0x282bf9;var _0x5ad495={'ContactId':_0x282bf9['id'],'phone':_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id']};var _0x1f69ad={'ContactId':_0x282bf9['id'],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id'],'closed':![]};return db[_0x8ca2('0xa6')][_0x8ca2('0x60')]({'where':_0x1f69ad})[_0x8ca2('0x37')](function(_0x2aae8b){if(_0x2aae8b){return[_0x2aae8b,![]];}return db[_0x8ca2('0xa6')][_0x8ca2('0x5a')](_0x5ad495)[_0x8ca2('0x37')](function(_0x1cfaa3){return[_0x1cfaa3,!![]];});});}})[_0x8ca2('0xa7')](function(_0x186eff,_0x474933){_0x1e7a15[_0x8ca2('0xa8')]=_0x186eff['get']({'plain':!![]});_0x1e7a15[_0x8ca2('0xa8')][_0x8ca2('0xa9')]=![];if(_0x474933){if(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xaa')]){_0x1e7a15[_0x8ca2('0xab')]['push']({'id':0x0,'priority':_0x1e7a15[_0x8ca2('0xab')][_0x8ca2('0x4b')]+0x1,'app':_0x8ca2('0xac'),'appdata':'unmanaged','interval':_0x8ca2('0xad')});}_0x1e7a15[_0x8ca2('0xa8')][_0x8ca2('0xa9')]=!![];}return db[_0x8ca2('0xae')]['create']({'phone':_0x1e7a15['body']['from'],'messageId':_0x1e7a15[_0x8ca2('0x5b')]['messageId'],'body':_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id'],'SmsInteractionId':_0x186eff['id'],'direction':'in','ContactId':_0x186eff[_0x8ca2('0xaf')],'AttachmentId':_0x1e7a15[_0x8ca2('0x5b')]['AttachmentId']});})['then'](function(_0x4f2776){_0x1e7a15['message']=_0x4f2776;if(!_0x1e7a15[_0x8ca2('0xa8')]['UserId'])return;return db[_0x8ca2('0xb0')][_0x8ca2('0x60')]({'attributes':['id',_0x8ca2('0x3c')],'where':{'id':_0x1e7a15['interaction']['UserId']}});})[_0x8ca2('0x37')](function(_0x6d5707){if(_0x6d5707){_0x1e7a15['applications'][_0x8ca2('0xb1')]({'id':0x0,'priority':0x0,'app':_0x8ca2('0xb2'),'appdata':_0x6d5707['name']+','+(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x1e7a15['interaction'][_0x8ca2('0xb4')])return;return db[_0x8ca2('0xb5')][_0x8ca2('0x60')]({'attributes':['id','name'],'where':{'id':_0x1e7a15[_0x8ca2('0xa8')]['queueId']}});})[_0x8ca2('0x37')](function(_0x543cfd){if(_0x543cfd){_0x1e7a15[_0x8ca2('0xab')][_0x8ca2('0xb1')]({'id':0x0,'priority':0x1,'app':_0x8ca2('0xb6'),'appdata':_0x543cfd['name']+','+(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xb7')]||0x12c),'interval':_0x8ca2('0xad')});}return respondWithRpcPromise(_0x8ca2('0xb8'),_0x8ca2('0xb9'),_0x1e7a15);})[_0x8ca2('0x37')](function(_0x4c5c3e){if(_0x4c5c3e){var _0x43eb1c=0xc8;var _0x43ab35=_0x8ca2('0xba');logger[_0x8ca2('0x27')](_0x8ca2('0x21'),_0x43ab35,_0x43eb1c,_0x8ca2('0xbb'));logger[_0x8ca2('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x43ab35,_0x43eb1c,'entity\x20found',JSON[_0x8ca2('0x22')](_0x4c5c3e));if(_0x1e7a15['account'][_0x8ca2('0x43')]===_0x8ca2('0x83')){return _0x553a5f[_0x8ca2('0x2b')](_0x43eb1c)[_0x8ca2('0x31')]('Content-Type',_0x8ca2('0xbc'))[_0x8ca2('0x3d')]('\x0a');}else{return _0x553a5f[_0x8ca2('0x2b')](_0x43eb1c)[_0x8ca2('0x2c')](_0x4c5c3e);}}})[_0x8ca2('0x29')](handleError(_0x553a5f,null));};exports[_0x8ca2('0xbd')]=function(_0x2ebbf2,_0x1c5816){var _0x3ccafe=_0x2ebbf2[_0x8ca2('0x59')]['id'];var _0x5000bf=_0x2ebbf2['body'];var _0x153d2b=0xc8;var _0x53cea6=null;return db[_0x8ca2('0xbe')][_0x8ca2('0xbf')]({'isolationLevel':db['sequelize']['Transaction'][_0x8ca2('0xc0')][_0x8ca2('0xc1')]},function(_0xbc7590){return db['SmsAccount'][_0x8ca2('0x6a')]({'where':{'id':_0x3ccafe},'transaction':_0xbc7590})['then'](function(_0x454a78){if(_0x454a78){return db[_0x8ca2('0x76')][_0x8ca2('0x38')]({'where':{'SmsAccountId':_0x3ccafe},'transaction':_0xbc7590})[_0x8ca2('0x37')](function(){var _0x114065=_[_0x8ca2('0x53')](_0x5000bf,function(_0x27b4f9){_0x27b4f9[_0x8ca2('0x67')]=_0x3ccafe;return _0x27b4f9;});return db[_0x8ca2('0x76')][_0x8ca2('0xc2')](_0x114065,{'transaction':_0xbc7590});});}else{_0x153d2b=0x194;_0x53cea6=[];}});})['then'](function(){if(_0x153d2b!==0x194){return db[_0x8ca2('0x76')]['findAndCountAll']({'where':{'SmsAccountId':_0x3ccafe},'order':'priority'})[_0x8ca2('0x37')](function(_0x496ad5){_0x53cea6=_0x496ad5;});}})['catch'](function(_0x9c808f){_0x153d2b=0x1f4;logger[_0x8ca2('0x23')](_0x9c808f[_0x8ca2('0x3b')]);if(_0x9c808f['name']){delete _0x9c808f[_0x8ca2('0x3c')];}_0x53cea6=_0x9c808f;})['finally'](function(){if(_0x53cea6===null){_0x1c5816[_0x8ca2('0x2a')](_0x153d2b);}else{if(_0x153d2b===0x1f4){_0x1c5816[_0x8ca2('0x2b')](_0x153d2b)[_0x8ca2('0x3d')](_0x53cea6);}else{_0x1c5816[_0x8ca2('0x2b')](_0x153d2b)[_0x8ca2('0x2c')](_0x53cea6);}}});};exports['getApplications']=function(_0x57892e,_0x54901c,_0x145a5c){var _0x5f37a2={};var _0x2f38e9={};var _0x3724c0;var _0x29c594;return db[_0x8ca2('0x40')]['findOne']({'where':{'id':_0x57892e[_0x8ca2('0x59')]['id']}})['then'](handleEntityNotFound(_0x54901c,null))[_0x8ca2('0x37')](function(_0x8eb9f2){if(_0x8eb9f2){_0x3724c0=_0x8eb9f2;_0x2f38e9['model']=_[_0x8ca2('0x46')](db[_0x8ca2('0x76')][_0x8ca2('0x41')]);_0x2f38e9[_0x8ca2('0x47')]=_['keys'](_0x57892e['query']);_0x2f38e9[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x2f38e9[_0x8ca2('0x45')],_0x2f38e9['query']);_0x5f37a2[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x2f38e9[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x57892e[_0x8ca2('0x47')]['fields']));_0x5f37a2[_0x8ca2('0x49')]=_0x5f37a2[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x5f37a2[_0x8ca2('0x49')]:_0x2f38e9[_0x8ca2('0x45')];_0x5f37a2['order']=qs[_0x8ca2('0x4d')](_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x5f37a2[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_['pick'](_0x57892e['query'],_0x2f38e9[_0x8ca2('0x4f')]));if(_0x57892e['query'][_0x8ca2('0x51')]){_0x5f37a2['where']=_[_0x8ca2('0x52')](_0x5f37a2[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x5f37a2['attributes'],function(_0x2fee00){var _0x51fdeb={};_0x51fdeb[_0x2fee00]={'$like':'%'+_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x51fdeb;})});}_0x5f37a2=_[_0x8ca2('0x52')]({},_0x5f37a2,_0x57892e[_0x8ca2('0x6b')]);return _0x3724c0[_0x8ca2('0xc3')](_0x5f37a2);}})[_0x8ca2('0x37')](function(_0x1b4390){if(_0x1b4390){_0x29c594=_0x1b4390[_0x8ca2('0x4b')];if(!_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x5f37a2[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x5f37a2['offset']=qs[_0x8ca2('0x2f')](_0x57892e['query'][_0x8ca2('0x2f')]);}return _0x3724c0[_0x8ca2('0xc3')](_0x5f37a2);}})[_0x8ca2('0x37')](function(_0x356418){if(_0x356418){return _0x356418?{'count':_0x29c594,'rows':_0x356418}:null;}})[_0x8ca2('0x37')](respondWithResult(_0x54901c,null))['catch'](handleError(_0x54901c,null));};exports[_0x8ca2('0xc4')]=function(_0x2140f9,_0x16ec03,_0x181024){var _0x8752ad={'raw':![],'where':{}};var _0x1d693a={};var _0x5bdd44={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2140f9[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x16ec03,null))[_0x8ca2('0x37')](function(_0x48eca8){if(_0x48eca8){_0x1d693a[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db['SmsInteraction'][_0x8ca2('0x41')]);_0x1d693a[_0x8ca2('0x47')]=_[_0x8ca2('0x46')](_0x2140f9['query']);_0x1d693a[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x1d693a['model'],_0x1d693a['query']);_0x8752ad[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x1d693a[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x2140f9['query']['fields']));_0x8752ad[_0x8ca2('0x49')]=_0x8752ad[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x8752ad[_0x8ca2('0x49')]:_0x1d693a[_0x8ca2('0x45')];if(!_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x8752ad[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x8752ad['offset']=qs[_0x8ca2('0x2f')](_0x2140f9[_0x8ca2('0x47')]['offset']);}_0x8752ad[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0x2140f9['query'][_0x8ca2('0x4d')]);_0x8752ad[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x2140f9[_0x8ca2('0x47')],_0x1d693a[_0x8ca2('0x4f')]));_0x8752ad[_0x8ca2('0x4e')][_0x8ca2('0x67')]=_0x48eca8['id'];if(_0x2140f9['query']['filter']){_0x8752ad[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x8752ad[_0x8ca2('0x4e')],{'$or':_['map'](_0x8752ad[_0x8ca2('0x49')],function(_0xa02b8){var _0x1b6bd4={};_0x1b6bd4[_0xa02b8]={'$like':'%'+_0x2140f9[_0x8ca2('0x47')]['filter']+'%'};return _0x1b6bd4;})});}_0x8752ad=_['merge']({},_0x8752ad,_0x2140f9[_0x8ca2('0x6b')]);return db[_0x8ca2('0xa6')][_0x8ca2('0x2e')]({'where':_0x8752ad[_0x8ca2('0x4e')]})['then'](function(_0x2926d8){_0x5bdd44[_0x8ca2('0x2e')]=_0x2926d8;if(_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x8752ad[_0x8ca2('0x56')]=[{'model':db[_0x8ca2('0x7b')],'as':'Contact','required':![]},{'model':db[_0x8ca2('0xb0')],'as':_0x8ca2('0xc5'),'attributes':[_0x8ca2('0x3c'),_0x8ca2('0xc6'),_0x8ca2('0xc7')],'required':![]},{'model':db[_0x8ca2('0xc8')],'as':_0x8ca2('0xc9'),'attributes':['id',_0x8ca2('0x3c'),_0x8ca2('0xca')],'where':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]?{'id':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]}:undefined,'required':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]?!![]:![]}];}return db[_0x8ca2('0xa6')][_0x8ca2('0x73')](_0x8752ad);})[_0x8ca2('0x37')](function(_0x43ff87){_0x5bdd44[_0x8ca2('0x57')]=_0x43ff87;return _0x5bdd44;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x16ec03,_0x8752ad))[_0x8ca2('0x29')](handleError(_0x16ec03,null));};exports['send']=function(_0x516eba,_0x52a49a,_0x4ecfc6){var _0x3c4eb8,_0x482cc2,_0x261a11;if(_[_0x8ca2('0x9b')](_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')])||_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')]===''){throw new db['Sequelize'][(_0x8ca2('0x7d'))](_0x8ca2('0xcc'));}if(_[_0x8ca2('0x9b')](_0x516eba['body']['to'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0xcd'));}_0x3c4eb8=_0x516eba[_0x8ca2('0x5b')]['to'];return db[_0x8ca2('0x40')]['find']({'where':{'id':_0x516eba[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0xa1')],'as':_0x8ca2('0xce'),'include':[{'model':db[_0x8ca2('0x7b')],'as':_0x8ca2('0xa2'),'where':{'mobile':_0x3c4eb8},'limit':0x1,'order':[[_0x8ca2('0x80'),_0x8ca2('0xa3')]]}]}]})[_0x8ca2('0x37')](handleEntityNotFound(_0x52a49a,null))[_0x8ca2('0x37')](function(_0x21c6f5){if(_0x21c6f5&&_0x21c6f5[_0x8ca2('0xce')]){_0x482cc2=_0x21c6f5[_0x8ca2('0x5f')]({'plain':!![]});if(_0x482cc2[_0x8ca2('0xce')]&&_0x482cc2[_0x8ca2('0xce')][_0x8ca2('0xa2')]['length']){return _0x482cc2[_0x8ca2('0xce')][_0x8ca2('0xa2')][0x0];}return db[_0x8ca2('0x7b')][_0x8ca2('0x5a')](_[_0x8ca2('0x17')](_0x516eba[_0x8ca2('0x5b')],{'firstName':_0x3c4eb8,'mobile':_0x3c4eb8,'phone':_0x3c4eb8,'ListId':_0x482cc2[_0x8ca2('0xcf')]}));}})['then'](handleEntityNotFound(_0x52a49a,null))[_0x8ca2('0x37')](function(_0x305304){if(_0x305304){_0x261a11=_0x305304;return db[_0x8ca2('0xa6')][_0x8ca2('0x60')]({'where':{'ContactId':_0x261a11['id'],'closed':![],'SmsAccountId':_0x482cc2['id']}})['then'](function(_0x3ab1b6){if(_0x3ab1b6){return[_0x3ab1b6,![]];}return db['SmsInteraction']['create']({'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id'],'SmsAccountId':_0x482cc2['id'],'phone':_0x3c4eb8,'firstMsgDirection':'out','Messages':[_[_0x8ca2('0x52')](_0x516eba[_0x8ca2('0x5b')],{'read':![],'body':_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'phone':_0x3c4eb8,'SmsAccountId':_0x482cc2['id'],'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id']})]},{'include':[{'model':db[_0x8ca2('0xae')],'as':_0x8ca2('0xd0')}]})[_0x8ca2('0x37')](function(_0x419c0e){return[_0x419c0e,!![]];});});}})[_0x8ca2('0xa7')](function(_0x2832c6,_0x1bd8bd){if(_0x1bd8bd){return _0x2832c6;}return db[_0x8ca2('0xae')][_0x8ca2('0x5a')](_['merge'](_0x516eba[_0x8ca2('0x5b')],{'read':![],'body':_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'phone':_0x3c4eb8,'SmsAccountId':_0x482cc2['id'],'SmsInteractionId':_0x2832c6['id'],'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id']}))[_0x8ca2('0x37')](function(_0x1f6020){_0x2832c6['dataValues']['Messages']=[];_0x2832c6[_0x8ca2('0xd1')]['Messages'][_0x8ca2('0xd2')](_0x1f6020[_0x8ca2('0xd1')]);return _0x2832c6;});})[_0x8ca2('0x37')](respondWithResult(_0x52a49a,null))[_0x8ca2('0x29')](handleError(_0x52a49a,null));};exports['status']=function(_0x1d7435,_0x226cd1,_0x5b0477){if(_0x1d7435[_0x8ca2('0x5b')]['id']){delete _0x1d7435[_0x8ca2('0x5b')]['id'];}var _0x13e31f,_0x215fd1,_0x1ad8fa;return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0x1d7435[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x226cd1,null))[_0x8ca2('0x37')](function(_0x5d5b47){if(_0x5d5b47){_0x1ad8fa=_0x5d5b47;logger['debug'](_0x8ca2('0x21'),_0x8ca2('0x2b'),_0x8ca2('0xd3'),_0x5d5b47[_0x8ca2('0x43')],util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5d5b47[_0x8ca2('0x43')]){case'skebby':if(_0x1d7435['body']['skebby_dispatch_id']&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x2b')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x1d7435['body'][_0x8ca2('0xd5')]}});}break;case _0x8ca2('0x8c'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd6')]&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd7')]){_0x215fd1=_0x1d7435['body'][_0x8ca2('0xd7')];return db[_0x8ca2('0xae')]['find']({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd6')]}});}break;case _0x8ca2('0x8d'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd8')]&&_0x1d7435['body'][_0x8ca2('0xd9')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd9')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')]['message_id']}});}break;case _0x8ca2('0x91'):var _0x11b486=_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0];if(_0x11b486[_0x8ca2('0x87')]&&_0x11b486['status'][_0x8ca2('0xda')]==='DELIVERED'){_0x215fd1=_0x11b486[_0x8ca2('0x2b')]['groupName'];return db['SmsMessage'][_0x8ca2('0x60')]({'where':{'messageId':_0x11b486[_0x8ca2('0x87')]}});}break;case _0x8ca2('0x96'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x87')]&&_0x1d7435[_0x8ca2('0x5b')]['status']){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')]['messageId']}});}break;case _0x8ca2('0x98'):if(_0x1d7435[_0x8ca2('0x5b')][0x0][_0x8ca2('0x25')]['id']){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')][0x0][_0x8ca2('0x43')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435['body'][0x0][_0x8ca2('0x25')]['id']}});}break;case _0x8ca2('0x99'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xdb')]&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x2b')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435['body'][_0x8ca2('0xdb')]}});}break;}}})[_0x8ca2('0x37')](handleEntityNotFound(_0x226cd1,null))[_0x8ca2('0x37')](function(_0x2bdf21){if(_0x2bdf21){_0x13e31f=_0x2bdf21;switch(_0x1ad8fa['type']){case _0x8ca2('0x89'):if(_0x215fd1==='DELIVERED'){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8ca2('0x89'),util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x8c'):if(_0x215fd1==='1'){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),'status',_0x8ca2('0x89'),util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x8d'):if(!_0x1d7435['body'][_0x8ca2('0xdc')]&&_0x215fd1>=0xc8&&_0x215fd1<=0xce){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),_0x8ca2('0x8d'),util['inspect'](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x91'):var _0x3163db=_0x1d7435['body']['results'][0x0];if(_0x3163db[_0x8ca2('0x2b')][_0x8ca2('0xda')]===_0x8ca2('0xdd')){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),'infobip',util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x96'):if(_0x215fd1==_0x8ca2('0xde')||_0x215fd1=='RECEIVED_BY_RECIPIENT'){return _0x13e31f['update']({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),'clickatell',util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x98'):if(_0x215fd1==_0x8ca2('0xdf')){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),'bandwidth',util['inspect'](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x215fd1===_0x8ca2('0xe0')||_0x215fd1===_0x8ca2('0xe1')){return _0x13e31f['update']({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0x99'),util[_0x8ca2('0xd4')](_0x1d7435['body'],{'showHidden':![],'depth':null}));}break;}return _0x13e31f;}})[_0x8ca2('0x37')](respondWithResult(_0x226cd1,null))[_0x8ca2('0x29')](handleError(_0x226cd1,null));};exports[_0x8ca2('0xe2')]=function(_0x25e5fc,_0x4f2d64,_0x26575c){var _0x31263f,_0x2375f0,_0x4f7396;return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x25e5fc[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x4f2d64,null))[_0x8ca2('0x37')](function(_0x2f36f6){if(_0x2f36f6){_0x4f7396=_0x2f36f6;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0xd3'),_0x2f36f6[_0x8ca2('0x43')],util['inspect'](_0x25e5fc[_0x8ca2('0x47')],{'showHidden':![],'depth':null}));switch(_0x2f36f6[_0x8ca2('0x43')]){case'csc':if(_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe3')]&&_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe4')]){_0x2375f0=_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe4')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x4f2d64,null))[_0x8ca2('0x37')](function(_0xf5a252){if(_0xf5a252){_0x31263f=_0xf5a252;switch(_0x4f7396[_0x8ca2('0x43')]){case _0x8ca2('0x93'):if(_0x2375f0==='2'||_0x2375f0==='6'){return _0x31263f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0x93'),util[_0x8ca2('0xd4')](_0x25e5fc[_0x8ca2('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x31263f;}})[_0x8ca2('0x37')](respondWithResult(_0x4f2d64,null))[_0x8ca2('0x29')](handleError(_0x4f2d64,null));};exports[_0x8ca2('0xe5')]=function(_0x236d4d,_0x1de3e2,_0x30fd4c){return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x236d4d['params']['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x1de3e2,null))['then'](function(_0x104906){if(_0x104906){return _0x104906[_0x8ca2('0xe5')](_0x236d4d[_0x8ca2('0x5b')]['ids'],_[_0x8ca2('0xa4')](_0x236d4d[_0x8ca2('0x5b')],['ids','id'])||{})['spread'](function(_0x1c3743){for(var _0x46bf34=0x0;_0x46bf34<_0x236d4d[_0x8ca2('0x5b')][_0x8ca2('0x6d')][_0x8ca2('0x4b')];_0x46bf34+=0x1){socket[_0x8ca2('0xe6')](_0x8ca2('0xe7'),{'UserId':Number(_0x236d4d[_0x8ca2('0x5b')][_0x8ca2('0x6d')][_0x46bf34]),'SmsAccountId':Number(_0x236d4d[_0x8ca2('0x59')]['id'])});}return _0x1c3743;});}})['then'](respondWithResult(_0x1de3e2,null))[_0x8ca2('0x29')](handleError(_0x1de3e2,null));};exports['removeAgents']=function(_0xd91f10,_0x140187,_0x19b0f1){return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0xd91f10[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x140187,null))[_0x8ca2('0x37')](function(_0xb177f6){if(_0xb177f6){return _0xb177f6[_0x8ca2('0xe8')](_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')])[_0x8ca2('0x37')](function(){if(_[_0x8ca2('0xe9')](_0xd91f10[_0x8ca2('0x47')]['ids'])){for(var _0xca10dc=0x0;_0xca10dc<_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')][_0x8ca2('0x4b')];_0xca10dc+=0x1){socket[_0x8ca2('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0xd91f10[_0x8ca2('0x47')]['ids'][_0xca10dc]),'SmsAccountId':Number(_0xd91f10[_0x8ca2('0x59')]['id'])});}}else{socket[_0x8ca2('0xe6')](_0x8ca2('0xea'),{'UserId':Number(_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')]),'SmsAccountId':Number(_0xd91f10[_0x8ca2('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x140187,null))['catch'](handleError(_0x140187,null));};exports[_0x8ca2('0xeb')]=function(_0xb8e9d5,_0x40482b,_0x3fbd2c){var _0x4fb684={};var _0x187638={};var _0x2979fd;var _0x160691;return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0xb8e9d5[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x40482b,null))[_0x8ca2('0x37')](function(_0x2feeae){if(_0x2feeae){_0x2979fd=_0x2feeae;_0x187638[_0x8ca2('0x45')]=_['keys'](db['User']['rawAttributes']);_0x187638[_0x8ca2('0x47')]=_[_0x8ca2('0x46')](_0xb8e9d5[_0x8ca2('0x47')]);_0x187638[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x187638['model'],_0x187638[_0x8ca2('0x47')]);_0x4fb684[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x187638[_0x8ca2('0x45')],qs['fields'](_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x4fb684[_0x8ca2('0x49')]=_0x4fb684[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x4fb684[_0x8ca2('0x49')]:_0x187638[_0x8ca2('0x45')];_0x4fb684[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x4fb684[_0x8ca2('0x4e')]=qs['filters'](_[_0x8ca2('0x50')](_0xb8e9d5[_0x8ca2('0x47')],_0x187638[_0x8ca2('0x4f')]));if(_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x51')]){_0x4fb684[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x4fb684['where'],{'$or':_[_0x8ca2('0x53')](_0x4fb684[_0x8ca2('0x49')],function(_0x2efcfc){var _0x34b504={};_0x34b504[_0x2efcfc]={'$like':'%'+_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x34b504;})});}_0x4fb684=_['merge']({},_0x4fb684,_0xb8e9d5[_0x8ca2('0x6b')]);return _0x2979fd[_0x8ca2('0xeb')](_0x4fb684);}})[_0x8ca2('0x37')](function(_0x2f9adb){if(_0x2f9adb){_0x160691=_0x2f9adb[_0x8ca2('0x4b')];if(!_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x4fb684[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0xb8e9d5[_0x8ca2('0x47')]['limit']);_0x4fb684[_0x8ca2('0x2f')]=qs[_0x8ca2('0x2f')](_0xb8e9d5[_0x8ca2('0x47')]['offset']);}return _0x2979fd[_0x8ca2('0xeb')](_0x4fb684);}})[_0x8ca2('0x37')](function(_0x321e9b){if(_0x321e9b){return _0x321e9b?{'count':_0x160691,'rows':_0x321e9b}:null;}})[_0x8ca2('0x37')](respondWithResult(_0x40482b,null))[_0x8ca2('0x29')](handleError(_0x40482b,null));}; \ No newline at end of file +var _0x4ed1=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','SmsAccount','findAll','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','Body','MessageSid','skebby','sender','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','Sequelize','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','SmsInteraction','spread','interaction','get','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','\x0a','addApplications','sequelize','Transaction','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','ListId','out','SmsMessage','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','keys','query'];(function(_0x54666f,_0x56cc45){var _0x4c2ede=function(_0x4a5401){while(--_0x4a5401){_0x54666f['push'](_0x54666f['shift']());}};_0x4c2ede(++_0x56cc45);}(_0x4ed1,0x18d));var _0x14ed=function(_0x3c5afd,_0x2dc439){_0x3c5afd=_0x3c5afd-0x0;var _0x574f20=_0x4ed1[_0x3c5afd];return _0x574f20;};'use strict';var emlformat=require(_0x14ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x14ed('0x1'));var moment=require(_0x14ed('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x14ed('0x3'));var path=require(_0x14ed('0x4'));var sox=require('sox');var csv=require(_0x14ed('0x5'));var ejs=require(_0x14ed('0x6'));var fs=require('fs');var fs_extra=require(_0x14ed('0x7'));var _=require(_0x14ed('0x8'));var squel=require(_0x14ed('0x9'));var crypto=require(_0x14ed('0xa'));var jsforce=require(_0x14ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x14ed('0x5'));var querystring=require('querystring');var Papa=require(_0x14ed('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14ed('0xd'));var hardwareService=require(_0x14ed('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x14ed('0xf'));var licenseUtil=require(_0x14ed('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x14ed('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x14ed('0x12'))(new Redis(config[_0x14ed('0x13')]));require(_0x14ed('0x14'))[_0x14ed('0x15')](socket);var jayson=require(_0x14ed('0x16'));var client=jayson[_0x14ed('0x17')][_0x14ed('0x18')]({'port':0x232c});function respondWithRpcPromise(_0xd899cf,_0x3acc2e,_0x105b2e,_0x3b5804){return new BPromise(function(_0x48c2ee,_0x54b20a){var _0x1d2c33=_0x3b5804||client;return _0x1d2c33['request'](_0xd899cf,_0x105b2e)['then'](function(_0x292479){logger['info'](_0x14ed('0x19'),_0x3acc2e,_0x14ed('0x1a'));logger[_0x14ed('0x1b')](_0x14ed('0x1c'),_0x3acc2e,_0x14ed('0x1a'),JSON[_0x14ed('0x1d')](_0x292479));if(_0x292479[_0x14ed('0x1e')]){if(_0x292479[_0x14ed('0x1e')][_0x14ed('0x1f')]===0x1f4){logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);return _0x54b20a(_0x292479['error'][_0x14ed('0x20')]);}logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);return _0x48c2ee(_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);}else{logger[_0x14ed('0x21')](_0x14ed('0x19'),_0x3acc2e,'request\x20sent');_0x48c2ee(_0x292479[_0x14ed('0x22')]['message']);}})[_0x14ed('0x23')](function(_0x46061d){logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x46061d);_0x54b20a(_0x46061d);});});}function respondWithStatusCode(_0x4c5fdb,_0x334293){_0x334293=_0x334293||0xcc;return function(_0x386b5d){if(_0x386b5d){return _0x4c5fdb[_0x14ed('0x24')](_0x334293);}return _0x4c5fdb[_0x14ed('0x25')](_0x334293)['end']();};}function respondWithResult(_0x1af906,_0x1942ac){_0x1942ac=_0x1942ac||0xc8;return function(_0x39bdd6){if(_0x39bdd6){return _0x1af906['status'](_0x1942ac)[_0x14ed('0x26')](_0x39bdd6);}};}function respondWithFilteredResult(_0x3c7ce5,_0x1f04d8){return function(_0x3dea08){if(_0x3dea08){var _0x59c451=typeof _0x1f04d8[_0x14ed('0x27')]===_0x14ed('0x28')&&typeof _0x1f04d8[_0x14ed('0x29')]==='undefined';var _0x9d8b2f=_0x3dea08['count'];var _0x236827=_0x59c451?0x0:_0x1f04d8[_0x14ed('0x27')];var _0x53a2d3=_0x59c451?_0x3dea08[_0x14ed('0x2a')]:_0x1f04d8[_0x14ed('0x27')]+_0x1f04d8[_0x14ed('0x29')];var _0x268006;if(_0x53a2d3>=_0x9d8b2f){_0x53a2d3=_0x9d8b2f;_0x268006=0xc8;}else{_0x268006=0xce;}_0x3c7ce5['status'](_0x268006);return _0x3c7ce5[_0x14ed('0x2b')](_0x14ed('0x2c'),_0x236827+'-'+_0x53a2d3+'/'+_0x9d8b2f)['json'](_0x3dea08);}return null;};}function patchUpdates(_0x10f20f){return function(_0x171db0){try{jsonpatch[_0x14ed('0x2d')](_0x171db0,_0x10f20f,!![]);}catch(_0x31948f){return BPromise[_0x14ed('0x2e')](_0x31948f);}return _0x171db0['save']();};}function saveUpdates(_0x44c0fb,_0x1f1982){return function(_0x41ccdd){if(_0x41ccdd){return _0x41ccdd[_0x14ed('0x2f')](_0x44c0fb)[_0x14ed('0x30')](function(_0x2ce8ac){return _0x2ce8ac;});}return null;};}function removeEntity(_0x4f5292,_0x365e38){return function(_0xdedcfe){if(_0xdedcfe){return _0xdedcfe[_0x14ed('0x31')]()['then'](function(){var _0x37cc96=_0xdedcfe['get']({'plain':!![]});var _0x502501='SmsAccounts';return db[_0x14ed('0x32')]['destroy']({'where':{'type':_0x502501,'resourceId':_0x37cc96['id']}})[_0x14ed('0x30')](function(){return _0xdedcfe;});})[_0x14ed('0x30')](function(){_0x4f5292[_0x14ed('0x25')](0xcc)[_0x14ed('0x33')]();});}};}function handleEntityNotFound(_0x580594,_0x565ae6){return function(_0x562ad8){if(!_0x562ad8){_0x580594[_0x14ed('0x24')](0x194);}return _0x562ad8;};}function handleError(_0x34ff4c,_0x19889d){_0x19889d=_0x19889d||0x1f4;return function(_0x18ab00){logger[_0x14ed('0x1e')](_0x18ab00[_0x14ed('0x34')]);if(_0x18ab00[_0x14ed('0x35')]){delete _0x18ab00[_0x14ed('0x35')];}_0x34ff4c[_0x14ed('0x25')](_0x19889d)['send'](_0x18ab00);};}exports['index']=function(_0x55e5da,_0x2021c4){var _0x5f9aec={'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]},_0xfeb1cf={},_0xdcfc4f={'count':0x0,'rows':[]};var _0x28b262=_[_0x14ed('0x38')](db['SmsAccount'][_0x14ed('0x39')],function(_0x33e828){return{'name':_0x33e828['fieldName'],'type':_0x33e828[_0x14ed('0x3a')][_0x14ed('0x3b')]};});_0xfeb1cf[_0x14ed('0x3c')]=_['map'](_0x28b262,_0x14ed('0x35'));_0xfeb1cf['query']=_[_0x14ed('0x3d')](_0x55e5da[_0x14ed('0x3e')]);_0xfeb1cf['filters']=_[_0x14ed('0x3f')](_0xfeb1cf[_0x14ed('0x3c')],_0xfeb1cf['query']);_0x5f9aec[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0xfeb1cf[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x55e5da['query'][_0x14ed('0x41')]));_0x5f9aec[_0x14ed('0x40')]=_0x5f9aec[_0x14ed('0x40')][_0x14ed('0x42')]?_0x5f9aec[_0x14ed('0x40')]:_0xfeb1cf[_0x14ed('0x3c')];if(!_0x55e5da[_0x14ed('0x3e')][_0x14ed('0x43')]('nolimit')){_0x5f9aec[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x55e5da['query'][_0x14ed('0x29')]);_0x5f9aec[_0x14ed('0x27')]=qs['offset'](_0x55e5da[_0x14ed('0x3e')][_0x14ed('0x27')]);}_0x5f9aec[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x55e5da[_0x14ed('0x3e')]['sort']);_0x5f9aec[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x55e5da[_0x14ed('0x3e')],_0xfeb1cf[_0x14ed('0x47')]),_0x28b262);if(_0x55e5da['query'][_0x14ed('0x49')]){_0x5f9aec['where']=_['merge'](_0x5f9aec['where'],{'$or':_['map'](_0x28b262,function(_0x46bc19){if(_0x46bc19['type']!==_0x14ed('0x4a')){var _0x10411b={};_0x10411b[_0x46bc19[_0x14ed('0x35')]]={'$like':'%'+_0x55e5da[_0x14ed('0x3e')]['filter']+'%'};return _0x10411b;}})});}_0x5f9aec=_[_0x14ed('0x4b')]({},_0x5f9aec,_0x55e5da['options']);var _0x333ac7={'where':_0x5f9aec[_0x14ed('0x46')]};return db['SmsAccount'][_0x14ed('0x2a')](_0x333ac7)[_0x14ed('0x30')](function(_0x7a05e8){_0xdcfc4f[_0x14ed('0x2a')]=_0x7a05e8;if(_0x55e5da['query'][_0x14ed('0x4c')]){_0x5f9aec['include']=[{'all':!![]}];}return db[_0x14ed('0x4d')][_0x14ed('0x4e')](_0x5f9aec);})['then'](function(_0x3d6ccf){_0xdcfc4f['rows']=_0x3d6ccf;return _0xdcfc4f;})[_0x14ed('0x30')](respondWithFilteredResult(_0x2021c4,_0x5f9aec))[_0x14ed('0x23')](handleError(_0x2021c4,null));};exports['show']=function(_0x362269,_0x39bb0a){var _0x53c666={'raw':![],'where':{'id':_0x362269[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]},_0x8f5b46={};_0x8f5b46[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x4d')][_0x14ed('0x39')]);_0x8f5b46[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x362269[_0x14ed('0x3e')]);_0x8f5b46[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x8f5b46[_0x14ed('0x3c')],_0x8f5b46[_0x14ed('0x3e')]);_0x53c666[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x8f5b46[_0x14ed('0x3c')],qs['fields'](_0x362269['query'][_0x14ed('0x41')]));_0x53c666[_0x14ed('0x40')]=_0x53c666[_0x14ed('0x40')][_0x14ed('0x42')]?_0x53c666[_0x14ed('0x40')]:_0x8f5b46[_0x14ed('0x3c')];if(_0x362269[_0x14ed('0x3e')]['includeAll']){_0x53c666[_0x14ed('0x50')]=[{'all':!![]}];}_0x53c666=_[_0x14ed('0x4b')]({},_0x53c666,_0x362269[_0x14ed('0x51')]);return db[_0x14ed('0x4d')][_0x14ed('0x52')](_0x53c666)[_0x14ed('0x30')](handleEntityNotFound(_0x39bb0a,null))[_0x14ed('0x30')](respondWithResult(_0x39bb0a,null))['catch'](handleError(_0x39bb0a,null));};exports[_0x14ed('0x53')]=function(_0x235bd6,_0x5a82dc){return db['SmsAccount'][_0x14ed('0x53')](_0x235bd6[_0x14ed('0x54')],{})[_0x14ed('0x30')](function(_0x2e1edc){var _0x569942=_0x235bd6[_0x14ed('0x55')]['get']({'plain':!![]});if(!_0x569942)throw new Error(_0x14ed('0x56'));if(_0x569942[_0x14ed('0x57')]===_0x14ed('0x55')){var _0x5dff9a=_0x2e1edc['get']({'plain':!![]});var _0x22e5b6='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x22e5b6,'userProfileId':_0x569942[_0x14ed('0x58')]},'raw':!![]})[_0x14ed('0x30')](function(_0x549fe2){if(_0x549fe2&&_0x549fe2[_0x14ed('0x59')]===0x0){return db[_0x14ed('0x32')]['create']({'name':_0x5dff9a[_0x14ed('0x35')],'resourceId':_0x5dff9a['id'],'type':_0x549fe2[_0x14ed('0x35')],'sectionId':_0x549fe2['id']},{})['then'](function(){return _0x2e1edc;});}else{return _0x2e1edc;}})[_0x14ed('0x23')](function(_0x691a06){logger[_0x14ed('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x691a06);throw _0x691a06;});}return _0x2e1edc;})[_0x14ed('0x30')](respondWithResult(_0x5a82dc,0xc9))[_0x14ed('0x23')](handleError(_0x5a82dc,null));};exports[_0x14ed('0x2f')]=function(_0x43ef03,_0x1daecd){if(_0x43ef03['body']['id']){delete _0x43ef03[_0x14ed('0x54')]['id'];}return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x43ef03[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]})[_0x14ed('0x30')](handleEntityNotFound(_0x1daecd,null))[_0x14ed('0x30')](saveUpdates(_0x43ef03[_0x14ed('0x54')],null))['then'](respondWithResult(_0x1daecd,null))['catch'](handleError(_0x1daecd,null));};exports[_0x14ed('0x31')]=function(_0xf2cf34,_0x49b0a1){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0xf2cf34['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x49b0a1,null))[_0x14ed('0x30')](removeEntity(_0x49b0a1,null))[_0x14ed('0x23')](handleError(_0x49b0a1,null));};exports[_0x14ed('0x5a')]=function(_0x2935d4,_0xbb851){return db[_0x14ed('0x4d')][_0x14ed('0x5a')]()[_0x14ed('0x30')](respondWithResult(_0xbb851,null))[_0x14ed('0x23')](handleError(_0xbb851,null));};exports[_0x14ed('0x5b')]=function(_0x99ddff,_0x48c84f,_0x44be89){if(_0x99ddff[_0x14ed('0x54')]['id']){delete _0x99ddff[_0x14ed('0x54')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x99ddff[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48c84f,null))[_0x14ed('0x30')](function(_0x1c192e){if(_0x1c192e){_0x99ddff[_0x14ed('0x54')][_0x14ed('0x5c')]=_0x1c192e['id'];return db[_0x14ed('0x5d')]['create'](_0x99ddff[_0x14ed('0x54')]);}})['then'](respondWithResult(_0x48c84f,null))[_0x14ed('0x23')](handleError(_0x48c84f,null));};exports[_0x14ed('0x5e')]=function(_0x38497a,_0x56ef8e,_0x4184d4){var _0x1c8743={'raw':![],'where':{}};var _0x2974c8={};var _0x37cab1={'count':0x0,'rows':[]};return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x38497a[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56ef8e,null))['then'](function(_0xd65e68){if(_0xd65e68){_0x2974c8[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x5d')][_0x14ed('0x39')]);_0x2974c8['query']=_[_0x14ed('0x3d')](_0x38497a[_0x14ed('0x3e')]);_0x2974c8[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x2974c8['model'],_0x2974c8['query']);_0x1c8743[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x2974c8['model'],qs[_0x14ed('0x41')](_0x38497a['query'][_0x14ed('0x41')]));_0x1c8743['attributes']=_0x1c8743[_0x14ed('0x40')][_0x14ed('0x42')]?_0x1c8743['attributes']:_0x2974c8['model'];if(!_0x38497a[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x1c8743[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x38497a[_0x14ed('0x3e')]['limit']);_0x1c8743[_0x14ed('0x27')]=qs['offset'](_0x38497a[_0x14ed('0x3e')]['offset']);}_0x1c8743['order']=qs['sort'](_0x38497a[_0x14ed('0x3e')]['sort']);_0x1c8743[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x38497a[_0x14ed('0x3e')],_0x2974c8[_0x14ed('0x47')]));_0x1c8743['where'][_0x14ed('0x5c')]=_0xd65e68['id'];if(_0x38497a['query'][_0x14ed('0x49')]){_0x1c8743[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x1c8743[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x1c8743['attributes'],function(_0x449b43){var _0x4dd1a8={};_0x4dd1a8[_0x449b43]={'$like':'%'+_0x38497a[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x4dd1a8;})});}_0x1c8743=_[_0x14ed('0x4b')]({},_0x1c8743,_0x38497a[_0x14ed('0x51')]);return db[_0x14ed('0x5d')]['count']({'where':_0x1c8743['where']})[_0x14ed('0x30')](function(_0x571d28){_0x37cab1[_0x14ed('0x2a')]=_0x571d28;if(_0x38497a['query'][_0x14ed('0x4c')]){_0x1c8743[_0x14ed('0x50')]=[{'all':!![]}];}return db[_0x14ed('0x5d')]['findAll'](_0x1c8743);})[_0x14ed('0x30')](function(_0x46438c){_0x37cab1[_0x14ed('0x61')]=_0x46438c;return _0x37cab1;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0x56ef8e,_0x1c8743))['catch'](handleError(_0x56ef8e,null));};exports['removeDispositions']=function(_0x59813e,_0x5c6d0a,_0x40f5bc){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x59813e[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x5c6d0a,null))['then'](function(_0x10ceeb){if(_0x10ceeb){return _0x10ceeb[_0x14ed('0x62')](_0x59813e[_0x14ed('0x3e')]['ids']);}})[_0x14ed('0x30')](respondWithStatusCode(_0x5c6d0a,null))[_0x14ed('0x23')](handleError(_0x5c6d0a,null));};exports[_0x14ed('0x63')]=function(_0x1962a9,_0x18a442,_0x5ce6ca){if(_0x1962a9[_0x14ed('0x54')]['id']){delete _0x1962a9['body']['id'];}return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x1962a9[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x18a442,null))[_0x14ed('0x30')](function(_0x2a5c3f){if(_0x2a5c3f){_0x1962a9[_0x14ed('0x54')]['SmsAccountId']=_0x2a5c3f['id'];return db[_0x14ed('0x64')][_0x14ed('0x53')](_0x1962a9[_0x14ed('0x54')]);}})[_0x14ed('0x30')](respondWithResult(_0x18a442,null))[_0x14ed('0x23')](handleError(_0x18a442,null));};exports[_0x14ed('0x65')]=function(_0x43d04c,_0x458847,_0x4c70fc){var _0x14d830={'raw':![],'where':{}};var _0x449b55={};var _0x4b341e={'count':0x0,'rows':[]};return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x43d04c[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x458847,null))[_0x14ed('0x30')](function(_0x1af99e){if(_0x1af99e){_0x449b55['model']=_[_0x14ed('0x3d')](db[_0x14ed('0x64')][_0x14ed('0x39')]);_0x449b55[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x43d04c[_0x14ed('0x3e')]);_0x449b55[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x449b55[_0x14ed('0x3c')],_0x449b55[_0x14ed('0x3e')]);_0x14d830['attributes']=_[_0x14ed('0x3f')](_0x449b55[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x14d830['attributes']=_0x14d830[_0x14ed('0x40')][_0x14ed('0x42')]?_0x14d830['attributes']:_0x449b55['model'];if(!_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x14d830[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x43d04c[_0x14ed('0x3e')]['limit']);_0x14d830[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x43d04c['query'][_0x14ed('0x27')]);}_0x14d830[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x43d04c[_0x14ed('0x3e')]['sort']);_0x14d830[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x43d04c[_0x14ed('0x3e')],_0x449b55[_0x14ed('0x47')]));_0x14d830[_0x14ed('0x46')]['SmsAccountId']=_0x1af99e['id'];if(_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x14d830['where']=_['merge'](_0x14d830[_0x14ed('0x46')],{'$or':_['map'](_0x14d830[_0x14ed('0x40')],function(_0x4d5c3f){var _0x8ac059={};_0x8ac059[_0x4d5c3f]={'$like':'%'+_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x8ac059;})});}_0x14d830=_[_0x14ed('0x4b')]({},_0x14d830,_0x43d04c[_0x14ed('0x51')]);return db[_0x14ed('0x64')][_0x14ed('0x2a')]({'where':_0x14d830[_0x14ed('0x46')]})['then'](function(_0x1372b9){_0x4b341e[_0x14ed('0x2a')]=_0x1372b9;if(_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x4c')]){_0x14d830[_0x14ed('0x50')]=[{'all':!![]}];}return db[_0x14ed('0x64')][_0x14ed('0x4e')](_0x14d830);})[_0x14ed('0x30')](function(_0x2d5341){_0x4b341e[_0x14ed('0x61')]=_0x2d5341;return _0x4b341e;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0x458847,_0x14d830))[_0x14ed('0x23')](handleError(_0x458847,null));};exports[_0x14ed('0x66')]=function(_0x5dc446,_0x15da66,_0x2057e9){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x5dc446[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x15da66,null))['then'](function(_0x9d1c06){if(_0x9d1c06){return _0x9d1c06['removeAnswers'](_0x5dc446[_0x14ed('0x3e')][_0x14ed('0x67')]);}})[_0x14ed('0x30')](respondWithStatusCode(_0x15da66,null))[_0x14ed('0x23')](handleError(_0x15da66,null));};exports[_0x14ed('0x68')]=function(_0x12e564,_0x23b082,_0x432d30){var _0x43cc7b={'channel':_0x14ed('0x69')};var _0x131242=[];var _0x4719c5=[];var _0x3c5202={};return db['SmsAccount']['find']({'where':{'id':_0x12e564[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x6a')],'as':_0x14ed('0x6b')}]})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x410969){_0x43cc7b['account']=_0x410969;_0x43cc7b[_0x14ed('0x6c')]=_[_0x14ed('0x6d')](_0x410969[_0x14ed('0x6b')],[_0x14ed('0x6e')],[_0x14ed('0x6f')]);if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x6b')]){delete _0x43cc7b[_0x14ed('0x70')][_0x14ed('0x6b')];}return db[_0x14ed('0x71')]['describe']();})[_0x14ed('0x30')](function(_0x387b24){if(!_0x387b24){throw new db['Sequelize'][(_0x14ed('0x72'))](_0x14ed('0x73'));}_0x131242=_[_0x14ed('0x74')](_[_0x14ed('0x3d')](_0x387b24),[_0x14ed('0x75'),_0x14ed('0x76')]);_0x4719c5=_['difference'](_[_0x14ed('0x3d')](_0x387b24),[_0x14ed('0x75'),_0x14ed('0x76'),_0x14ed('0x77'),'ListId']);_0x43cc7b[_0x14ed('0x54')]={'mapKey':_0x14ed('0x78')};if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]){switch(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]){case'twilio':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')]['From'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564['body'][_0x14ed('0x7a')];_0x43cc7b[_0x14ed('0x54')]['messageId']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x7b')];break;case _0x14ed('0x7c'):_0x43cc7b[_0x14ed('0x54')]['from']='+'+_0x12e564[_0x14ed('0x54')][_0x14ed('0x7d')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564['body']['text'];break;case _0x14ed('0x7e'):_0x43cc7b['body']['from']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b['body'][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['message'];break;case _0x14ed('0x7f'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b['body'][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['body'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564['body'][_0x14ed('0x81')];break;case _0x14ed('0x82'):_0x43cc7b[_0x14ed('0x54')]['from']=_0x12e564[_0x14ed('0x54')]['From'];_0x43cc7b['body']['body']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x83')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564['body'][_0x14ed('0x84')];break;case _0x14ed('0x85'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]='+'+_0x12e564[_0x14ed('0x54')][_0x14ed('0x86')][0x0][_0x14ed('0x79')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['results'][0x0][_0x14ed('0x87')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564[_0x14ed('0x54')]['results'][0x0]['messageId'];break;case _0x14ed('0x88'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x89')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8a')]['message'];break;case _0x14ed('0x8b'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8c')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x87')];_0x43cc7b[_0x14ed('0x54')]['messageId']=_0x12e564[_0x14ed('0x54')]['replyMessageId'];break;case _0x14ed('0x8d'):_0x43cc7b['body']['messageId']=_0x12e564[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564['body'][0x0][_0x14ed('0x20')]['from'];_0x43cc7b['body']['body']=_0x12e564[_0x14ed('0x54')][0x0][_0x14ed('0x20')][_0x14ed('0x87')];break;case _0x14ed('0x8e'):_0x43cc7b['body'][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b[_0x14ed('0x54')]['body']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x20')];_0x43cc7b['body'][_0x14ed('0x80')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8f')];break;}}if(_0x43cc7b[_0x14ed('0x54')]['id']){delete _0x43cc7b[_0x14ed('0x54')]['id'];}if(_['isNil'](_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')])){throw new db[(_0x14ed('0x90'))][(_0x14ed('0x72'))](_0x14ed('0x91'));}if(_[_0x14ed('0x92')](_0x43cc7b['body'][_0x14ed('0x54')])||_0x43cc7b[_0x14ed('0x54')]['body']===''){throw new db[(_0x14ed('0x90'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x14ed('0x92')](_0x43cc7b[_0x14ed('0x54')]['mapKey'])){throw new db['Sequelize'][(_0x14ed('0x72'))](_0x14ed('0x93')+_0x4719c5);}if(!_[_0x14ed('0x94')](_0x4719c5,_0x43cc7b['body'][_0x14ed('0x95')])){throw new db[(_0x14ed('0x90'))]['ValidationError'](_0x14ed('0x96')+_0x4719c5);}_0x3c5202[_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x95')]]=_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')];return db[_0x14ed('0x97')][_0x14ed('0x52')]({'where':{'id':_0x43cc7b[_0x14ed('0x70')]['ListId']},'include':[{'model':db[_0x14ed('0x71')],'as':'Contacts','where':_0x3c5202,'limit':0x1,'order':[[_0x14ed('0x76'),_0x14ed('0x98')]]}]});})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x5e5f78){if(_0x5e5f78){_0x43cc7b[_0x14ed('0x99')]=_['omit'](_0x5e5f78,[_0x14ed('0x9a')]);if(_0x5e5f78['Contacts'][_0x14ed('0x42')]){return _0x5e5f78[_0x14ed('0x9a')][0x0];}var _0x27aab5=_[_0x14ed('0x11')](_0x43cc7b[_0x14ed('0x54')],{'firstName':_0x43cc7b['body'][_0x14ed('0x79')],'ListId':_0x5e5f78['id']});_0x27aab5[_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x95')]]=_0x43cc7b['body']['from'];return db[_0x14ed('0x71')][_0x14ed('0x53')](_0x27aab5,{'fields':_0x131242,'raw':!![]});}})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x31475a){if(_0x31475a){_0x43cc7b['contact']=_0x31475a;var _0x250cb2={'ContactId':_0x31475a['id'],'phone':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id']};var _0x4e2070={'ContactId':_0x31475a['id'],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x4e2070})[_0x14ed('0x30')](function(_0x33b046){if(_0x33b046){return[_0x33b046,![]];}return db[_0x14ed('0x9b')][_0x14ed('0x53')](_0x250cb2)['then'](function(_0x1e9ff3){return[_0x1e9ff3,!![]];});});}})[_0x14ed('0x9c')](function(_0x44f510,_0x1fd926){_0x43cc7b[_0x14ed('0x9d')]=_0x44f510[_0x14ed('0x9e')]({'plain':!![]});_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0x9f')]=![];if(_0x1fd926){if(_0x43cc7b['account']['autoclose']){_0x43cc7b[_0x14ed('0x6c')]['push']({'id':0x0,'priority':_0x43cc7b[_0x14ed('0x6c')]['length']+0x1,'app':_0x14ed('0xa0'),'appdata':_0x14ed('0xa1'),'interval':_0x14ed('0xa2')});}_0x43cc7b[_0x14ed('0x9d')]['created']=!![];}return db['SmsMessage'][_0x14ed('0x53')]({'phone':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')],'messageId':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')],'body':_0x43cc7b['body'][_0x14ed('0x54')],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id'],'SmsInteractionId':_0x44f510['id'],'direction':'in','ContactId':_0x44f510[_0x14ed('0xa3')],'AttachmentId':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0xa4')]});})[_0x14ed('0x30')](function(_0x5ed729){_0x43cc7b['message']=_0x5ed729;if(!_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xa5')])return;return db[_0x14ed('0xa6')][_0x14ed('0x52')]({'attributes':['id',_0x14ed('0x35')],'where':{'id':_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xa5')]}});})['then'](function(_0x3f8470){if(_0x3f8470){_0x43cc7b[_0x14ed('0x6c')][_0x14ed('0xa7')]({'id':0x0,'priority':0x0,'app':_0x14ed('0xa8'),'appdata':_0x3f8470['name']+','+(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0xa9')]||0xa),'interval':'*,*,*,*'});}if(!_0x43cc7b['interaction'][_0x14ed('0xaa')])return;return db[_0x14ed('0xab')][_0x14ed('0x52')]({'attributes':['id',_0x14ed('0x35')],'where':{'id':_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xaa')]}});})['then'](function(_0x15e239){if(_0x15e239){_0x43cc7b[_0x14ed('0x6c')][_0x14ed('0xa7')]({'id':0x0,'priority':0x1,'app':_0x14ed('0xac'),'appdata':_0x15e239[_0x14ed('0x35')]+','+(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0xad')]||0x12c),'interval':_0x14ed('0xa2')});}return respondWithRpcPromise(_0x14ed('0xae'),_0x14ed('0xaf'),_0x43cc7b);})[_0x14ed('0x30')](function(_0x42fbfa){if(_0x42fbfa){var _0x8b1b53=0xc8;var _0x414797=_0x14ed('0xb0');logger[_0x14ed('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x414797,_0x8b1b53,'entity\x20found');logger['debug'](_0x14ed('0xb1'),_0x414797,_0x8b1b53,'entity\x20found',JSON[_0x14ed('0x1d')](_0x42fbfa));if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]===_0x14ed('0xb2')){return _0x23b082['status'](_0x8b1b53)[_0x14ed('0x2b')]('Content-Type',_0x14ed('0xb3'))[_0x14ed('0xb4')](_0x14ed('0xb5'));}else{return _0x23b082[_0x14ed('0x25')](_0x8b1b53)[_0x14ed('0x26')](_0x42fbfa);}}})[_0x14ed('0x23')](handleError(_0x23b082,null));};exports[_0x14ed('0xb6')]=function(_0x28167f,_0x154a25){var _0x5083e6=_0x28167f[_0x14ed('0x4f')]['id'];var _0x344757=_0x28167f[_0x14ed('0x54')];var _0x5ede63=0xc8;var _0x569780=null;return db[_0x14ed('0xb7')]['transaction']({'isolationLevel':db[_0x14ed('0xb7')][_0x14ed('0xb8')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x391f7f){return db[_0x14ed('0x4d')]['findOne']({'where':{'id':_0x5083e6},'transaction':_0x391f7f})[_0x14ed('0x30')](function(_0x2fb464){if(_0x2fb464){return db[_0x14ed('0x6a')]['destroy']({'where':{'SmsAccountId':_0x5083e6},'transaction':_0x391f7f})[_0x14ed('0x30')](function(){var _0x3a9366=_[_0x14ed('0x38')](_0x344757,function(_0x24053e){_0x24053e[_0x14ed('0x5c')]=_0x5083e6;return _0x24053e;});return db['SmsApplication'][_0x14ed('0xb9')](_0x3a9366,{'transaction':_0x391f7f});});}else{_0x5ede63=0x194;_0x569780=[];}});})[_0x14ed('0x30')](function(){if(_0x5ede63!==0x194){return db['SmsApplication'][_0x14ed('0xba')]({'where':{'SmsAccountId':_0x5083e6},'order':_0x14ed('0x6e')})[_0x14ed('0x30')](function(_0x3b9953){_0x569780=_0x3b9953;});}})[_0x14ed('0x23')](function(_0x502db9){_0x5ede63=0x1f4;logger[_0x14ed('0x1e')](_0x502db9[_0x14ed('0x34')]);if(_0x502db9[_0x14ed('0x35')]){delete _0x502db9[_0x14ed('0x35')];}_0x569780=_0x502db9;})[_0x14ed('0xbb')](function(){if(_0x569780===null){_0x154a25[_0x14ed('0x24')](_0x5ede63);}else{if(_0x5ede63===0x1f4){_0x154a25[_0x14ed('0x25')](_0x5ede63)[_0x14ed('0xb4')](_0x569780);}else{_0x154a25['status'](_0x5ede63)[_0x14ed('0x26')](_0x569780);}}});};exports[_0x14ed('0xbc')]=function(_0x1a00f3,_0x4d8db5,_0x204efd){var _0x54a931={};var _0x4771f5={};var _0x22d0a9;var _0x32d412;return db['SmsAccount'][_0x14ed('0x5f')]({'where':{'id':_0x1a00f3['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x4d8db5,null))[_0x14ed('0x30')](function(_0x4a4389){if(_0x4a4389){_0x22d0a9=_0x4a4389;_0x4771f5[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x6a')][_0x14ed('0x39')]);_0x4771f5[_0x14ed('0x3e')]=_['keys'](_0x1a00f3[_0x14ed('0x3e')]);_0x4771f5[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x4771f5['model'],_0x4771f5[_0x14ed('0x3e')]);_0x54a931[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x4771f5[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x1a00f3['query'][_0x14ed('0x41')]));_0x54a931[_0x14ed('0x40')]=_0x54a931[_0x14ed('0x40')][_0x14ed('0x42')]?_0x54a931[_0x14ed('0x40')]:_0x4771f5[_0x14ed('0x3c')];_0x54a931[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x1a00f3[_0x14ed('0x3e')]['sort']);_0x54a931[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x1a00f3[_0x14ed('0x3e')],_0x4771f5['filters']));if(_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x54a931[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x54a931[_0x14ed('0x46')],{'$or':_['map'](_0x54a931['attributes'],function(_0x38ca6c){var _0x218625={};_0x218625[_0x38ca6c]={'$like':'%'+_0x1a00f3['query']['filter']+'%'};return _0x218625;})});}_0x54a931=_[_0x14ed('0x4b')]({},_0x54a931,_0x1a00f3['options']);return _0x22d0a9[_0x14ed('0xbc')](_0x54a931);}})[_0x14ed('0x30')](function(_0x3ac262){if(_0x3ac262){_0x32d412=_0x3ac262[_0x14ed('0x42')];if(!_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x54a931[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x1a00f3[_0x14ed('0x3e')]['limit']);_0x54a931[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x27')]);}return _0x22d0a9[_0x14ed('0xbc')](_0x54a931);}})['then'](function(_0x950d5f){if(_0x950d5f){return _0x950d5f?{'count':_0x32d412,'rows':_0x950d5f}:null;}})[_0x14ed('0x30')](respondWithResult(_0x4d8db5,null))[_0x14ed('0x23')](handleError(_0x4d8db5,null));};exports[_0x14ed('0xbd')]=function(_0x2294f7,_0xab3916,_0x3d0c79){var _0x3e3d3d={'raw':![],'where':{}};var _0x1c840c={};var _0x262892={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2294f7[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0xab3916,null))[_0x14ed('0x30')](function(_0x429d5e){if(_0x429d5e){_0x1c840c[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db['SmsInteraction'][_0x14ed('0x39')]);_0x1c840c['query']=_[_0x14ed('0x3d')](_0x2294f7[_0x14ed('0x3e')]);_0x1c840c[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x1c840c[_0x14ed('0x3c')],_0x1c840c[_0x14ed('0x3e')]);_0x3e3d3d[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x1c840c[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x3e3d3d[_0x14ed('0x40')]=_0x3e3d3d[_0x14ed('0x40')][_0x14ed('0x42')]?_0x3e3d3d[_0x14ed('0x40')]:_0x1c840c['model'];if(!_0x2294f7[_0x14ed('0x3e')]['hasOwnProperty'](_0x14ed('0x60'))){_0x3e3d3d['limit']=qs[_0x14ed('0x29')](_0x2294f7['query']['limit']);_0x3e3d3d[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x27')]);}_0x3e3d3d[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x45')]);_0x3e3d3d[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x2294f7['query'],_0x1c840c[_0x14ed('0x47')]));_0x3e3d3d['where'][_0x14ed('0x5c')]=_0x429d5e['id'];if(_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x3e3d3d[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x3e3d3d[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x3e3d3d[_0x14ed('0x40')],function(_0x44a784){var _0x3c25d8={};_0x3c25d8[_0x44a784]={'$like':'%'+_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x3c25d8;})});}_0x3e3d3d=_['merge']({},_0x3e3d3d,_0x2294f7[_0x14ed('0x51')]);return db[_0x14ed('0x9b')][_0x14ed('0x2a')]({'where':_0x3e3d3d['where']})[_0x14ed('0x30')](function(_0x1a9eb5){_0x262892[_0x14ed('0x2a')]=_0x1a9eb5;if(_0x2294f7[_0x14ed('0x3e')]['includeAll']){_0x3e3d3d['include']=[{'model':db['CmContact'],'as':_0x14ed('0xbe'),'required':![]},{'model':db[_0x14ed('0xa6')],'as':'Owner','attributes':[_0x14ed('0x35'),_0x14ed('0xbf'),_0x14ed('0xc0')],'required':![]},{'model':db[_0x14ed('0xc1')],'as':_0x14ed('0xc2'),'attributes':['id',_0x14ed('0x35'),_0x14ed('0xc3')],'where':_0x2294f7[_0x14ed('0x3e')][_0x14ed('0xc4')]?{'id':_0x2294f7[_0x14ed('0x3e')][_0x14ed('0xc4')]}:undefined,'required':_0x2294f7['query'][_0x14ed('0xc4')]?!![]:![]}];}return db[_0x14ed('0x9b')][_0x14ed('0x4e')](_0x3e3d3d);})['then'](function(_0x511f26){_0x262892[_0x14ed('0x61')]=_0x511f26;return _0x262892;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0xab3916,_0x3e3d3d))['catch'](handleError(_0xab3916,null));};exports[_0x14ed('0xb4')]=function(_0x49c7f4,_0xdcfcc4,_0x4d3a93){var _0x233d7e,_0x3a117a,_0x4f6504;if(_[_0x14ed('0x92')](_0x49c7f4[_0x14ed('0x54')]['body'])||_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')]===''){throw new db['Sequelize']['ValidationError'](_0x14ed('0xc5'));}if(_['isNil'](_0x49c7f4[_0x14ed('0x54')]['to'])){throw new db[(_0x14ed('0x90'))][(_0x14ed('0x72'))](_0x14ed('0xc6'));}_0x233d7e=_0x49c7f4['body']['to'];return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x49c7f4[_0x14ed('0x4f')]['id']},'include':[{'model':db['CmList'],'as':_0x14ed('0xc7'),'include':[{'model':db[_0x14ed('0x71')],'as':_0x14ed('0x9a'),'where':{'mobile':_0x233d7e},'limit':0x1,'order':[[_0x14ed('0x76'),_0x14ed('0x98')]]}]}]})[_0x14ed('0x30')](handleEntityNotFound(_0xdcfcc4,null))[_0x14ed('0x30')](function(_0x46d9d2){if(_0x46d9d2&&_0x46d9d2[_0x14ed('0xc7')]){_0x3a117a=_0x46d9d2[_0x14ed('0x9e')]({'plain':!![]});if(_0x3a117a['List']&&_0x3a117a[_0x14ed('0xc7')][_0x14ed('0x9a')]['length']){return _0x3a117a[_0x14ed('0xc7')][_0x14ed('0x9a')][0x0];}return db['CmContact']['create'](_['defaults'](_0x49c7f4[_0x14ed('0x54')],{'firstName':_0x233d7e,'mobile':_0x233d7e,'phone':_0x233d7e,'ListId':_0x3a117a[_0x14ed('0xc8')]}));}})[_0x14ed('0x30')](handleEntityNotFound(_0xdcfcc4,null))[_0x14ed('0x30')](function(_0x5c35a2){if(_0x5c35a2){_0x4f6504=_0x5c35a2;return db[_0x14ed('0x9b')][_0x14ed('0x52')]({'where':{'ContactId':_0x4f6504['id'],'closed':![],'SmsAccountId':_0x3a117a['id']}})[_0x14ed('0x30')](function(_0x2d44ec){if(_0x2d44ec){return[_0x2d44ec,![]];}return db[_0x14ed('0x9b')][_0x14ed('0x53')]({'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id'],'SmsAccountId':_0x3a117a['id'],'phone':_0x233d7e,'firstMsgDirection':_0x14ed('0xc9'),'Messages':[_[_0x14ed('0x4b')](_0x49c7f4[_0x14ed('0x54')],{'read':![],'body':_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')],'phone':_0x233d7e,'SmsAccountId':_0x3a117a['id'],'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id']})]},{'include':[{'model':db[_0x14ed('0xca')],'as':'Messages'}]})[_0x14ed('0x30')](function(_0xf1b2e8){return[_0xf1b2e8,!![]];});});}})[_0x14ed('0x9c')](function(_0x587121,_0x572121){if(_0x572121){return _0x587121;}return db[_0x14ed('0xca')][_0x14ed('0x53')](_[_0x14ed('0x4b')](_0x49c7f4[_0x14ed('0x54')],{'read':![],'body':_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')],'phone':_0x233d7e,'SmsAccountId':_0x3a117a['id'],'SmsInteractionId':_0x587121['id'],'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id']}))[_0x14ed('0x30')](function(_0x12442d){_0x587121[_0x14ed('0xcb')][_0x14ed('0xcc')]=[];_0x587121[_0x14ed('0xcb')][_0x14ed('0xcc')][_0x14ed('0xcd')](_0x12442d[_0x14ed('0xcb')]);return _0x587121;});})[_0x14ed('0x30')](respondWithResult(_0xdcfcc4,null))[_0x14ed('0x23')](handleError(_0xdcfcc4,null));};exports[_0x14ed('0x25')]=function(_0x2a8e93,_0x439f12,_0x1fe607){if(_0x2a8e93['body']['id']){delete _0x2a8e93[_0x14ed('0x54')]['id'];}var _0x2661d2,_0x5a13d2,_0x44853e;return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x2a8e93[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x439f12,null))['then'](function(_0x494f84){if(_0x494f84){_0x44853e=_0x494f84;logger[_0x14ed('0x1b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14ed('0x25'),_0x14ed('0xce'),_0x494f84['type'],util[_0x14ed('0xcf')](_0x2a8e93['body'],{'showHidden':![],'depth':null}));switch(_0x494f84[_0x14ed('0x3a')]){case _0x14ed('0x7c'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd0')]&&_0x2a8e93['body'][_0x14ed('0x25')]){_0x5a13d2=_0x2a8e93['body'][_0x14ed('0x25')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd0')]}});}break;case _0x14ed('0x7e'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd1')]&&_0x2a8e93['body'][_0x14ed('0xd2')]){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd2')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd1')]}});}break;case _0x14ed('0x7f'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0x81')]&&_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd3')]){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd3')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0x81')]}});}break;case _0x14ed('0x85'):var _0x4e7029=_0x2a8e93['body'][_0x14ed('0x86')][0x0];if(_0x4e7029[_0x14ed('0x80')]&&_0x4e7029[_0x14ed('0x25')][_0x14ed('0xd4')]===_0x14ed('0xd5')){_0x5a13d2=_0x4e7029['status'][_0x14ed('0xd4')];return db[_0x14ed('0xca')]['find']({'where':{'messageId':_0x4e7029[_0x14ed('0x80')]}});}break;case _0x14ed('0x8b'):if(_0x2a8e93['body'][_0x14ed('0x80')]&&_0x2a8e93['body']['status']){_0x5a13d2=_0x2a8e93['body']['status'];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')]['messageId']}});}break;case _0x14ed('0x8d'):if(_0x2a8e93[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id']){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][0x0]['type'];return db['SmsMessage'][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id']}});}break;case'intelepeer':if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd6')]&&_0x2a8e93['body'][_0x14ed('0x25')]){_0x5a13d2=_0x2a8e93['body']['status'];return db['SmsMessage'][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93['body']['redif']}});}break;}}})[_0x14ed('0x30')](handleEntityNotFound(_0x439f12,null))['then'](function(_0x496520){if(_0x496520){_0x2661d2=_0x496520;switch(_0x44853e['type']){case _0x14ed('0x7c'):if(_0x5a13d2===_0x14ed('0xd5')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7c'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5a13d2==='1'){return _0x2661d2['update']({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7c'),util[_0x14ed('0xcf')](_0x2a8e93['body'],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x7f'):if(!_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd7')]&&_0x5a13d2>=0xc8&&_0x5a13d2<=0xce){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7f'),util['inspect'](_0x2a8e93['body'],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x85'):var _0x128c18=_0x2a8e93['body'][_0x14ed('0x86')][0x0];if(_0x128c18['status'][_0x14ed('0xd4')]==='DELIVERED'){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),'status',_0x14ed('0x85'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x8b'):if(_0x5a13d2==_0x14ed('0xd8')||_0x5a13d2==_0x14ed('0xd9')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),'clickatell',util['inspect'](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5a13d2==_0x14ed('0xda')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x8d'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x8e'):if(_0x5a13d2===_0x14ed('0xdb')||_0x5a13d2===_0x14ed('0xdc')){return _0x2661d2['update']({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x8e'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2661d2;}})[_0x14ed('0x30')](respondWithResult(_0x439f12,null))[_0x14ed('0x23')](handleError(_0x439f12,null));};exports['statusGet']=function(_0x50cd3d,_0x10615f,_0x4dd80a){var _0x4bf5b1,_0x406f34,_0x564f09;return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x50cd3d['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x10615f,null))[_0x14ed('0x30')](function(_0x1cf8f1){if(_0x1cf8f1){_0x564f09=_0x1cf8f1;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14ed('0x25'),'received\x20delivery\x20report\x20from',_0x1cf8f1[_0x14ed('0x3a')],util[_0x14ed('0xcf')](_0x50cd3d[_0x14ed('0x3e')],{'showHidden':![],'depth':null}));switch(_0x1cf8f1[_0x14ed('0x3a')]){case _0x14ed('0x88'):if(_0x50cd3d['query'][_0x14ed('0xdd')]&&_0x50cd3d[_0x14ed('0x3e')][_0x14ed('0xde')]){_0x406f34=_0x50cd3d['query'][_0x14ed('0xde')];return db[_0x14ed('0xca')]['find']({'where':{'messageId':_0x50cd3d[_0x14ed('0x3e')][_0x14ed('0xdd')]}});}break;}}})[_0x14ed('0x30')](handleEntityNotFound(_0x10615f,null))['then'](function(_0x10024e){if(_0x10024e){_0x4bf5b1=_0x10024e;switch(_0x564f09[_0x14ed('0x3a')]){case'csc':if(_0x406f34==='2'||_0x406f34==='6'){return _0x4bf5b1['update']({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),'csc',util[_0x14ed('0xcf')](_0x50cd3d[_0x14ed('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x4bf5b1;}})[_0x14ed('0x30')](respondWithResult(_0x10615f,null))[_0x14ed('0x23')](handleError(_0x10615f,null));};exports[_0x14ed('0xdf')]=function(_0xd6699c,_0x537dc3,_0x484aa2){return db[_0x14ed('0x4d')]['find']({'where':{'id':_0xd6699c['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x537dc3,null))[_0x14ed('0x30')](function(_0x1ab4ce){if(_0x1ab4ce){return _0x1ab4ce[_0x14ed('0xdf')](_0xd6699c['body'][_0x14ed('0x67')],_['omit'](_0xd6699c[_0x14ed('0x54')],[_0x14ed('0x67'),'id'])||{})['spread'](function(_0x2054c9){for(var _0x221b9c=0x0;_0x221b9c<_0xd6699c[_0x14ed('0x54')][_0x14ed('0x67')][_0x14ed('0x42')];_0x221b9c+=0x1){socket[_0x14ed('0xe0')](_0x14ed('0xe1'),{'UserId':Number(_0xd6699c[_0x14ed('0x54')][_0x14ed('0x67')][_0x221b9c]),'SmsAccountId':Number(_0xd6699c['params']['id'])});}return _0x2054c9;});}})[_0x14ed('0x30')](respondWithResult(_0x537dc3,null))['catch'](handleError(_0x537dc3,null));};exports[_0x14ed('0xe2')]=function(_0x41fc94,_0x1dc261,_0x5204fc){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x41fc94[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1dc261,null))[_0x14ed('0x30')](function(_0x2698a3){if(_0x2698a3){return _0x2698a3[_0x14ed('0xe2')](_0x41fc94[_0x14ed('0x3e')][_0x14ed('0x67')])[_0x14ed('0x30')](function(){if(_[_0x14ed('0xe3')](_0x41fc94[_0x14ed('0x3e')]['ids'])){for(var _0x50e071=0x0;_0x50e071<_0x41fc94[_0x14ed('0x3e')][_0x14ed('0x67')][_0x14ed('0x42')];_0x50e071+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x41fc94[_0x14ed('0x3e')]['ids'][_0x50e071]),'SmsAccountId':Number(_0x41fc94['params']['id'])});}}else{socket[_0x14ed('0xe0')](_0x14ed('0xe4'),{'UserId':Number(_0x41fc94[_0x14ed('0x3e')]['ids']),'SmsAccountId':Number(_0x41fc94[_0x14ed('0x4f')]['id'])});}});}})[_0x14ed('0x30')](respondWithStatusCode(_0x1dc261,null))['catch'](handleError(_0x1dc261,null));};exports[_0x14ed('0xe5')]=function(_0x2b05c0,_0x407655,_0x594f86){var _0x34894c={};var _0x3b7003={};var _0x36e4ed;var _0x491d66;return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x2b05c0['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x407655,null))[_0x14ed('0x30')](function(_0x51c9f9){if(_0x51c9f9){_0x36e4ed=_0x51c9f9;_0x3b7003[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0xa6')][_0x14ed('0x39')]);_0x3b7003[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x2b05c0['query']);_0x3b7003[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x3b7003[_0x14ed('0x3c')],_0x3b7003[_0x14ed('0x3e')]);_0x34894c[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x3b7003['model'],qs['fields'](_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x34894c['attributes']=_0x34894c[_0x14ed('0x40')][_0x14ed('0x42')]?_0x34894c[_0x14ed('0x40')]:_0x3b7003[_0x14ed('0x3c')];_0x34894c[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x2b05c0['query'][_0x14ed('0x45')]);_0x34894c['where']=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x2b05c0[_0x14ed('0x3e')],_0x3b7003[_0x14ed('0x47')]));if(_0x2b05c0[_0x14ed('0x3e')]['filter']){_0x34894c['where']=_[_0x14ed('0x4b')](_0x34894c[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x34894c[_0x14ed('0x40')],function(_0x5609c7){var _0x257817={};_0x257817[_0x5609c7]={'$like':'%'+_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x257817;})});}_0x34894c=_[_0x14ed('0x4b')]({},_0x34894c,_0x2b05c0[_0x14ed('0x51')]);return _0x36e4ed[_0x14ed('0xe5')](_0x34894c);}})[_0x14ed('0x30')](function(_0x41365a){if(_0x41365a){_0x491d66=_0x41365a['length'];if(!_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x34894c[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x2b05c0['query'][_0x14ed('0x29')]);_0x34894c[_0x14ed('0x27')]=qs['offset'](_0x2b05c0['query'][_0x14ed('0x27')]);}return _0x36e4ed[_0x14ed('0xe5')](_0x34894c);}})[_0x14ed('0x30')](function(_0x38b7f4){if(_0x38b7f4){return _0x38b7f4?{'count':_0x491d66,'rows':_0x38b7f4}:null;}})[_0x14ed('0x30')](respondWithResult(_0x407655,null))[_0x14ed('0x23')](handleError(_0x407655,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c693031..740923a 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 _0xdff8=['SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xdff8,0xa8));var _0x8dff=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xdff8[_0x4ebf6a];return _0x1e7a72;};'use strict';var EventEmitter=require(_0x8dff('0x0'));var SmsAccount=require(_0x8dff('0x1'))['db'][_0x8dff('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8dff('0x3')](0x0);var events={'afterCreate':_0x8dff('0x4'),'afterUpdate':'update','afterDestroy':_0x8dff('0x5')};function emitEvent(_0x2ec831){return function(_0x1a2387,_0x4fb36d,_0x47803f){SmsAccountEvents[_0x8dff('0x6')](_0x2ec831+':'+_0x1a2387['id'],_0x1a2387);SmsAccountEvents[_0x8dff('0x6')](_0x2ec831,_0x1a2387);_0x47803f(null);};}for(var e in events){if(events[_0x8dff('0x7')](e)){var event=events[e];SmsAccount[_0x8dff('0x8')](e,emitEvent(event));}}module[_0x8dff('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x1fec=['update','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1fec,0x1e2));var _0xc1fe=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x1fec[_0x341e0f];return _0x59555a;};'use strict';var EventEmitter=require(_0xc1fe('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xc1fe('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc1fe('0x2')](0x0);var events={'afterCreate':_0xc1fe('0x3'),'afterUpdate':_0xc1fe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2487ca){return function(_0x3b024b,_0x480dbb,_0x59555a){SmsAccountEvents[_0xc1fe('0x5')](_0x2487ca+':'+_0x3b024b['id'],_0x3b024b);SmsAccountEvents[_0xc1fe('0x5')](_0x2487ca,_0x3b024b);_0x59555a(null);};}for(var e in events){if(events[_0xc1fe('0x6')](e)){var event=events[e];SmsAccount[_0xc1fe('0x7')](e,emitEvent(event));}}module[_0xc1fe('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3f644e7..e7358ab 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 _0xf9a3=['SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./smsAccount.attributes','exports','define'];(function(_0x2163b0,_0x4a8ca6){var _0x17e53f=function(_0x490310){while(--_0x490310){_0x2163b0['push'](_0x2163b0['shift']());}};_0x17e53f(++_0x4a8ca6);}(_0xf9a3,0xd3));var _0x3f9a=function(_0x4caf99,_0x4e7f46){_0x4caf99=_0x4caf99-0x0;var _0x878f4b=_0xf9a3[_0x4caf99];return _0x878f4b;};'use strict';var _=require(_0x3f9a('0x0'));var util=require('util');var logger=require(_0x3f9a('0x1'))('api');var moment=require(_0x3f9a('0x2'));var BPromise=require(_0x3f9a('0x3'));var rp=require(_0x3f9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x3f9a('0x6'));module[_0x3f9a('0x7')]=function(_0x13b16c,_0x5e9c59){return _0x13b16c[_0x3f9a('0x8')](_0x3f9a('0x9'),attributes,{'tableName':_0x3f9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf70=['request-promise','./smsAccount.attributes','exports','define','lodash','util','api','moment','bluebird'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0xdf70,0x109));var _0x0df7=function(_0x4b962a,_0x3c7758){_0x4b962a=_0x4b962a-0x0;var _0x3fe9ef=_0xdf70[_0x4b962a];return _0x3fe9ef;};'use strict';var _=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var logger=require('../../config/logger')(_0x0df7('0x2'));var moment=require(_0x0df7('0x3'));var BPromise=require(_0x0df7('0x4'));var rp=require(_0x0df7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0df7('0x6'));module[_0x0df7('0x7')]=function(_0x11a66e,_0x41a27a){return _0x11a66e[_0x0df7('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index f4d4784..33aa22a 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 _0x71e2=['model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','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','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map'];(function(_0x562cc9,_0x1cb01e){var _0x5ddbf8=function(_0x48cb40){while(--_0x48cb40){_0x562cc9['push'](_0x562cc9['shift']());}};_0x5ddbf8(++_0x1cb01e);}(_0x71e2,0x104));var _0x271e=function(_0x5c621c,_0x4d1fa6){_0x5c621c=_0x5c621c-0x0;var _0x6bf538=_0x71e2[_0x5c621c];return _0x6bf538;};'use strict';var _=require(_0x271e('0x0'));var util=require(_0x271e('0x1'));var moment=require('moment');var BPromise=require(_0x271e('0x2'));var rs=require(_0x271e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x271e('0x4'))['db'];var utils=require(_0x271e('0x5'));var logger=require(_0x271e('0x6'))(_0x271e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x271e('0x8')][_0x271e('0x9')]({'port':0x232a});config[_0x271e('0xa')]=_['defaults'](config[_0x271e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x271e('0xb'))(new Redis(config[_0x271e('0xa')]));require(_0x271e('0xc'))[_0x271e('0xd')](socket);function respondWithRpcPromise(_0x312bd3,_0x19e7e9,_0x441fa9){return new BPromise(function(_0x3629c7,_0x464475){return client[_0x271e('0xe')](_0x312bd3,_0x441fa9)[_0x271e('0xf')](function(_0x27bff7){logger[_0x271e('0x10')](_0x271e('0x11'),_0x19e7e9,_0x271e('0x12'));logger[_0x271e('0x13')](_0x271e('0x14'),_0x19e7e9,_0x271e('0x12'),JSON[_0x271e('0x15')](_0x27bff7));if(_0x27bff7['error']){if(_0x27bff7[_0x271e('0x16')][_0x271e('0x17')]===0x1f4){logger[_0x271e('0x16')](_0x271e('0x11'),_0x19e7e9,_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);return _0x464475(_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);}logger[_0x271e('0x16')](_0x271e('0x11'),_0x19e7e9,_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);return _0x3629c7(_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);}else{logger[_0x271e('0x10')](_0x271e('0x11'),_0x19e7e9,_0x271e('0x12'));_0x3629c7(_0x27bff7[_0x271e('0x19')][_0x271e('0x18')]);}})[_0x271e('0x1a')](function(_0x173bc4){logger['error'](_0x271e('0x11'),_0x19e7e9,_0x173bc4);_0x464475(_0x173bc4);});});}exports[_0x271e('0x1b')]=function(_0x41965d){var _0x144052=this;return new Promise(function(_0xd510ba,_0x5e6c35){return db[_0x271e('0x1c')][_0x271e('0x1d')]({'raw':_0x41965d[_0x271e('0x1e')]?_0x41965d[_0x271e('0x1e')][_0x271e('0x1f')]===undefined?!![]:![]:!![],'where':_0x41965d[_0x271e('0x1e')]?_0x41965d['options'][_0x271e('0x20')]||null:null,'attributes':_0x41965d['options']?_0x41965d[_0x271e('0x1e')][_0x271e('0x21')]||null:null,'include':_0x41965d['options']?_0x41965d[_0x271e('0x1e')][_0x271e('0x22')]?_[_0x271e('0x23')](_0x41965d[_0x271e('0x1e')][_0x271e('0x22')],function(_0x4d96fc){return{'model':db[_0x4d96fc['model']],'as':_0x4d96fc['as'],'attributes':_0x4d96fc['attributes'],'include':_0x4d96fc[_0x271e('0x22')]?_[_0x271e('0x23')](_0x4d96fc['include'],function(_0x450c15){return{'model':db[_0x450c15[_0x271e('0x24')]],'as':_0x450c15['as'],'attributes':_0x450c15[_0x271e('0x21')],'include':_0x450c15['include']?_[_0x271e('0x23')](_0x450c15[_0x271e('0x22')],function(_0x510719){return{'model':db[_0x510719[_0x271e('0x24')]],'as':_0x510719['as'],'attributes':_0x510719[_0x271e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x271e('0xf')](function(_0x25743f){logger['info'](_0x271e('0x1b'),_0x41965d);logger[_0x271e('0x13')](_0x271e('0x1b'),_0x41965d,JSON[_0x271e('0x15')](_0x25743f));_0xd510ba(_0x25743f);})['catch'](function(_0x3d81e8){logger[_0x271e('0x16')]('ShowSmsAccount',_0x3d81e8[_0x271e('0x18')],_0x41965d);_0x5e6c35(_0x144052['error'](0x1f4,_0x3d81e8['message']));});});}; \ No newline at end of file +var _0x9d24=['SmsAccount','find','options','raw','attributes','map','include','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9d24,0x139));var _0x49d2=function(_0x15d503,_0x125150){_0x15d503=_0x15d503-0x0;var _0x5ac089=_0x9d24[_0x15d503];return _0x5ac089;};'use strict';var _=require(_0x49d2('0x0'));var util=require('util');var moment=require(_0x49d2('0x1'));var BPromise=require(_0x49d2('0x2'));var rs=require(_0x49d2('0x3'));var fs=require('fs');var Redis=require(_0x49d2('0x4'));var db=require(_0x49d2('0x5'))['db'];var utils=require(_0x49d2('0x6'));var logger=require('../../config/logger')(_0x49d2('0x7'));var config=require('../../config/environment');var jayson=require(_0x49d2('0x8'));var client=jayson['client'][_0x49d2('0x9')]({'port':0x232a});config[_0x49d2('0xa')]=_['defaults'](config['redis'],{'host':_0x49d2('0xb'),'port':0x18eb});var socket=require(_0x49d2('0xc'))(new Redis(config[_0x49d2('0xa')]));require(_0x49d2('0xd'))[_0x49d2('0xe')](socket);function respondWithRpcPromise(_0x1cd3c5,_0xd902cc,_0x8fd3e5){return new BPromise(function(_0x30b17c,_0x40b59f){return client['request'](_0x1cd3c5,_0x8fd3e5)[_0x49d2('0xf')](function(_0x5919a3){logger[_0x49d2('0x10')](_0x49d2('0x11'),_0xd902cc,_0x49d2('0x12'));logger[_0x49d2('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd902cc,_0x49d2('0x12'),JSON[_0x49d2('0x14')](_0x5919a3));if(_0x5919a3[_0x49d2('0x15')]){if(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x16')]===0x1f4){logger['error'](_0x49d2('0x11'),_0xd902cc,_0x5919a3['error'][_0x49d2('0x17')]);return _0x40b59f(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);}logger['error'](_0x49d2('0x11'),_0xd902cc,_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);return _0x30b17c(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);}else{logger[_0x49d2('0x10')](_0x49d2('0x11'),_0xd902cc,'request\x20sent');_0x30b17c(_0x5919a3[_0x49d2('0x18')][_0x49d2('0x17')]);}})[_0x49d2('0x19')](function(_0x1213e4){logger['error'](_0x49d2('0x11'),_0xd902cc,_0x1213e4);_0x40b59f(_0x1213e4);});});}exports[_0x49d2('0x1a')]=function(_0x469fb3){var _0x2caf58=this;return new Promise(function(_0x59da44,_0x29b0e8){return db[_0x49d2('0x1b')][_0x49d2('0x1c')]({'raw':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3[_0x49d2('0x1d')][_0x49d2('0x1e')]===undefined?!![]:![]:!![],'where':_0x469fb3['options']?_0x469fb3[_0x49d2('0x1d')]['where']||null:null,'attributes':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3['options'][_0x49d2('0x1f')]||null:null,'include':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3['options']['include']?_[_0x49d2('0x20')](_0x469fb3[_0x49d2('0x1d')][_0x49d2('0x21')],function(_0x36022d){return{'model':db[_0x36022d['model']],'as':_0x36022d['as'],'attributes':_0x36022d['attributes'],'include':_0x36022d[_0x49d2('0x21')]?_[_0x49d2('0x20')](_0x36022d[_0x49d2('0x21')],function(_0x49b4aa){return{'model':db[_0x49b4aa['model']],'as':_0x49b4aa['as'],'attributes':_0x49b4aa['attributes'],'include':_0x49b4aa[_0x49d2('0x21')]?_[_0x49d2('0x20')](_0x49b4aa[_0x49d2('0x21')],function(_0x5a64fc){return{'model':db[_0x5a64fc['model']],'as':_0x5a64fc['as'],'attributes':_0x5a64fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x49d2('0xf')](function(_0x3389fc){logger[_0x49d2('0x10')](_0x49d2('0x1a'),_0x469fb3);logger[_0x49d2('0x13')](_0x49d2('0x1a'),_0x469fb3,JSON[_0x49d2('0x14')](_0x3389fc));_0x59da44(_0x3389fc);})[_0x49d2('0x19')](function(_0x21f988){logger['error'](_0x49d2('0x1a'),_0x21f988['message'],_0x469fb3);_0x29b0e8(_0x2caf58['error'](0x1f4,_0x21f988[_0x49d2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2fd3231..a73eb84 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 1100d7b..cdda3dc 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3c9fa6,_0x457c18){var _0x15d44b=function(_0x276afb){while(--_0x276afb){_0x3c9fa6['push'](_0x3c9fa6['shift']());}};_0x15d44b(++_0x457c18);}(_0xedd9,0xfc));var _0x9edd=function(_0x5311d1,_0x36e532){_0x5311d1=_0x5311d1-0x0;var _0x161197=_0xedd9[_0x5311d1];return _0x161197;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0750750..78962bc 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 _0x4801=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5c4183,_0x19172a){var _0x59ad2f=function(_0x1f1418){while(--_0x1f1418){_0x5c4183['push'](_0x5c4183['shift']());}};_0x59ad2f(++_0x19172a);}(_0x4801,0x95));var _0x1480=function(_0x537281,_0x3e2849){_0x537281=_0x537281-0x0;var _0x58a6b3=_0x4801[_0x537281];return _0x58a6b3;};'use strict';var Sequelize=require(_0x1480('0x0'));module[_0x1480('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1480('0x2')],'allowNull':![],'defaultValue':_0x1480('0x3')},'appdata':{'type':Sequelize[_0x1480('0x4')]()},'description':{'type':Sequelize[_0x1480('0x2')]},'interval':{'type':Sequelize[_0x1480('0x2')],'defaultValue':_0x1480('0x5')}}; \ No newline at end of file +var _0x6a0a=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x979612,_0x5b7618){var _0x27f117=function(_0x5de4fd){while(--_0x5de4fd){_0x979612['push'](_0x979612['shift']());}};_0x27f117(++_0x5b7618);}(_0x6a0a,0x174));var _0xa6a0=function(_0x293e39,_0x34315f){_0x293e39=_0x293e39-0x0;var _0x118450=_0x6a0a[_0x293e39];return _0x118450;};'use strict';var Sequelize=require(_0xa6a0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa6a0('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa6a0('0x2')},'appdata':{'type':Sequelize[_0xa6a0('0x3')]()},'description':{'type':Sequelize[_0xa6a0('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9307916..68278bb 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 _0x800b=['fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','then','destroy','error','stack','send','index','SmsApplication','rawAttributes','type','model','map','name','query','keys','intersection','attributes'];(function(_0x236afd,_0x1f519b){var _0x2b0b11=function(_0x3ae148){while(--_0x3ae148){_0x236afd['push'](_0x236afd['shift']());}};_0x2b0b11(++_0x1f519b);}(_0x800b,0x186));var _0xb800=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x800b[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb800('0x0'));var zipdir=require(_0xb800('0x1'));var jsonpatch=require(_0xb800('0x2'));var rp=require(_0xb800('0x3'));var moment=require('moment');var BPromise=require(_0xb800('0x4'));var Mustache=require(_0xb800('0x5'));var util=require(_0xb800('0x6'));var path=require(_0xb800('0x7'));var sox=require(_0xb800('0x8'));var csv=require(_0xb800('0x9'));var ejs=require(_0xb800('0xa'));var fs=require('fs');var fs_extra=require(_0xb800('0xb'));var _=require(_0xb800('0xc'));var squel=require(_0xb800('0xd'));var crypto=require(_0xb800('0xe'));var jsforce=require(_0xb800('0xf'));var deskjs=require(_0xb800('0x10'));var toCsv=require(_0xb800('0x9'));var querystring=require(_0xb800('0x11'));var Papa=require(_0xb800('0x12'));var Redis=require('ioredis');var authService=require(_0xb800('0x13'));var qs=require(_0xb800('0x14'));var as=require(_0xb800('0x15'));var hardwareService=require(_0xb800('0x16'));var logger=require(_0xb800('0x17'))(_0xb800('0x18'));var utils=require('../../config/utils');var config=require(_0xb800('0x19'));var licenseUtil=require(_0xb800('0x1a'));var db=require(_0xb800('0x1b'))['db'];function respondWithStatusCode(_0x46a9e9,_0x229c48){_0x229c48=_0x229c48||0xcc;return function(_0x1769e7){if(_0x1769e7){return _0x46a9e9[_0xb800('0x1c')](_0x229c48);}return _0x46a9e9[_0xb800('0x1d')](_0x229c48)[_0xb800('0x1e')]();};}function respondWithResult(_0x1a09b3,_0x3656b6){_0x3656b6=_0x3656b6||0xc8;return function(_0x114a74){if(_0x114a74){return _0x1a09b3[_0xb800('0x1d')](_0x3656b6)[_0xb800('0x1f')](_0x114a74);}};}function respondWithFilteredResult(_0x3b2faa,_0x35edea){return function(_0x117bb8){if(_0x117bb8){var _0x54e84e=typeof _0x35edea[_0xb800('0x20')]==='undefined'&&typeof _0x35edea[_0xb800('0x21')]===_0xb800('0x22');var _0x5b6bc3=_0x117bb8[_0xb800('0x23')];var _0x321c3f=_0x54e84e?0x0:_0x35edea[_0xb800('0x20')];var _0x23db43=_0x54e84e?_0x117bb8['count']:_0x35edea['offset']+_0x35edea[_0xb800('0x21')];var _0x3a3446;if(_0x23db43>=_0x5b6bc3){_0x23db43=_0x5b6bc3;_0x3a3446=0xc8;}else{_0x3a3446=0xce;}_0x3b2faa[_0xb800('0x1d')](_0x3a3446);return _0x3b2faa['set']('Content-Range',_0x321c3f+'-'+_0x23db43+'/'+_0x5b6bc3)[_0xb800('0x1f')](_0x117bb8);}return null;};}function patchUpdates(_0x5864c1){return function(_0x1280b7){try{jsonpatch[_0xb800('0x24')](_0x1280b7,_0x5864c1,!![]);}catch(_0x3b4727){return BPromise['reject'](_0x3b4727);}return _0x1280b7['save']();};}function saveUpdates(_0xcaa322,_0x442d35){return function(_0x50d467){if(_0x50d467){return _0x50d467[_0xb800('0x25')](_0xcaa322)[_0xb800('0x26')](function(_0x3fe623){return _0x3fe623;});}return null;};}function removeEntity(_0x318a8e,_0x37995c){return function(_0x568556){if(_0x568556){return _0x568556[_0xb800('0x27')]()[_0xb800('0x26')](function(){_0x318a8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af299,_0x470780){return function(_0x267b7b){if(!_0x267b7b){_0x3af299[_0xb800('0x1c')](0x194);}return _0x267b7b;};}function handleError(_0x2ee2cd,_0x1658a0){_0x1658a0=_0x1658a0||0x1f4;return function(_0x334dc7){logger[_0xb800('0x28')](_0x334dc7[_0xb800('0x29')]);if(_0x334dc7['name']){delete _0x334dc7['name'];}_0x2ee2cd[_0xb800('0x1d')](_0x1658a0)[_0xb800('0x2a')](_0x334dc7);};}exports[_0xb800('0x2b')]=function(_0x331cd1,_0x2bed33){var _0x80c37a={},_0x4b2414={},_0x59c407={'count':0x0,'rows':[]};var _0x1edb4b=_['map'](db[_0xb800('0x2c')][_0xb800('0x2d')],function(_0x37ffed){return{'name':_0x37ffed['fieldName'],'type':_0x37ffed[_0xb800('0x2e')]['key']};});_0x4b2414[_0xb800('0x2f')]=_[_0xb800('0x30')](_0x1edb4b,_0xb800('0x31'));_0x4b2414[_0xb800('0x32')]=_[_0xb800('0x33')](_0x331cd1[_0xb800('0x32')]);_0x4b2414['filters']=_[_0xb800('0x34')](_0x4b2414[_0xb800('0x2f')],_0x4b2414[_0xb800('0x32')]);_0x80c37a[_0xb800('0x35')]=_[_0xb800('0x34')](_0x4b2414['model'],qs[_0xb800('0x36')](_0x331cd1[_0xb800('0x32')]['fields']));_0x80c37a[_0xb800('0x35')]=_0x80c37a[_0xb800('0x35')][_0xb800('0x37')]?_0x80c37a[_0xb800('0x35')]:_0x4b2414[_0xb800('0x2f')];if(!_0x331cd1[_0xb800('0x32')]['hasOwnProperty'](_0xb800('0x38'))){_0x80c37a[_0xb800('0x21')]=qs['limit'](_0x331cd1[_0xb800('0x32')]['limit']);_0x80c37a[_0xb800('0x20')]=qs[_0xb800('0x20')](_0x331cd1['query'][_0xb800('0x20')]);}_0x80c37a['order']=qs[_0xb800('0x39')](_0x331cd1[_0xb800('0x32')][_0xb800('0x39')]);_0x80c37a['where']=qs['filters'](_[_0xb800('0x3a')](_0x331cd1['query'],_0x4b2414[_0xb800('0x3b')]),_0x1edb4b);if(_0x331cd1['query'][_0xb800('0x3c')]){_0x80c37a[_0xb800('0x3d')]=_[_0xb800('0x3e')](_0x80c37a['where'],{'$or':_[_0xb800('0x30')](_0x1edb4b,function(_0x3b67ab){if(_0x3b67ab['type']!==_0xb800('0x3f')){var _0x204717={};_0x204717[_0x3b67ab[_0xb800('0x31')]]={'$like':'%'+_0x331cd1[_0xb800('0x32')][_0xb800('0x3c')]+'%'};return _0x204717;}})});}_0x80c37a=_[_0xb800('0x3e')]({},_0x80c37a,_0x331cd1[_0xb800('0x40')]);var _0x5361c4={'where':_0x80c37a[_0xb800('0x3d')]};return db['SmsApplication'][_0xb800('0x23')](_0x5361c4)[_0xb800('0x26')](function(_0x896643){_0x59c407[_0xb800('0x23')]=_0x896643;if(_0x331cd1['query'][_0xb800('0x41')]){_0x80c37a[_0xb800('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0xb800('0x43')](_0x80c37a);})[_0xb800('0x26')](function(_0x29fad1){_0x59c407['rows']=_0x29fad1;return _0x59c407;})[_0xb800('0x26')](respondWithFilteredResult(_0x2bed33,_0x80c37a))[_0xb800('0x44')](handleError(_0x2bed33,null));};exports[_0xb800('0x45')]=function(_0x1afdf7,_0x49fcd9){var _0x2099d1={'raw':!![],'where':{'id':_0x1afdf7['params']['id']}},_0x16fea7={};_0x16fea7[_0xb800('0x2f')]=_[_0xb800('0x33')](db[_0xb800('0x2c')][_0xb800('0x2d')]);_0x16fea7[_0xb800('0x32')]=_[_0xb800('0x33')](_0x1afdf7['query']);_0x16fea7['filters']=_[_0xb800('0x34')](_0x16fea7['model'],_0x16fea7[_0xb800('0x32')]);_0x2099d1[_0xb800('0x35')]=_['intersection'](_0x16fea7['model'],qs[_0xb800('0x36')](_0x1afdf7[_0xb800('0x32')][_0xb800('0x36')]));_0x2099d1[_0xb800('0x35')]=_0x2099d1[_0xb800('0x35')][_0xb800('0x37')]?_0x2099d1[_0xb800('0x35')]:_0x16fea7[_0xb800('0x2f')];if(_0x1afdf7[_0xb800('0x32')][_0xb800('0x41')]){_0x2099d1[_0xb800('0x42')]=[{'all':!![]}];}_0x2099d1=_[_0xb800('0x3e')]({},_0x2099d1,_0x1afdf7[_0xb800('0x40')]);return db[_0xb800('0x2c')][_0xb800('0x46')](_0x2099d1)[_0xb800('0x26')](handleEntityNotFound(_0x49fcd9,null))[_0xb800('0x26')](respondWithResult(_0x49fcd9,null))[_0xb800('0x44')](handleError(_0x49fcd9,null));};exports[_0xb800('0x47')]=function(_0xebf195,_0x4b1b4a){return db[_0xb800('0x2c')][_0xb800('0x47')](_0xebf195[_0xb800('0x48')],{})[_0xb800('0x26')](respondWithResult(_0x4b1b4a,0xc9))[_0xb800('0x44')](handleError(_0x4b1b4a,null));};exports[_0xb800('0x25')]=function(_0x398d55,_0x29a3c0){if(_0x398d55[_0xb800('0x48')]['id']){delete _0x398d55[_0xb800('0x48')]['id'];}return db[_0xb800('0x2c')][_0xb800('0x46')]({'where':{'id':_0x398d55[_0xb800('0x49')]['id']}})[_0xb800('0x26')](handleEntityNotFound(_0x29a3c0,null))[_0xb800('0x26')](saveUpdates(_0x398d55['body'],null))[_0xb800('0x26')](respondWithResult(_0x29a3c0,null))[_0xb800('0x44')](handleError(_0x29a3c0,null));};exports[_0xb800('0x27')]=function(_0x1123f5,_0x54068a){return db[_0xb800('0x2c')][_0xb800('0x46')]({'where':{'id':_0x1123f5['params']['id']}})[_0xb800('0x26')](handleEntityNotFound(_0x54068a,null))[_0xb800('0x26')](removeEntity(_0x54068a,null))[_0xb800('0x44')](handleError(_0x54068a,null));}; \ No newline at end of file +var _0xfc60=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','limit','undefined','offset','Content-Range','apply','reject','save','update','destroy','then','status','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','rows','catch','show','params','find','body'];(function(_0x338974,_0x225b29){var _0x2bc83a=function(_0x16b991){while(--_0x16b991){_0x338974['push'](_0x338974['shift']());}};_0x2bc83a(++_0x225b29);}(_0xfc60,0x8c));var _0x0fc6=function(_0x2a24f9,_0x33f21b){_0x2a24f9=_0x2a24f9-0x0;var _0x32edf3=_0xfc60[_0x2a24f9];return _0x32edf3;};'use strict';var emlformat=require(_0x0fc6('0x0'));var rimraf=require(_0x0fc6('0x1'));var zipdir=require(_0x0fc6('0x2'));var jsonpatch=require(_0x0fc6('0x3'));var rp=require(_0x0fc6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0fc6('0x5'));var util=require('util');var path=require(_0x0fc6('0x6'));var sox=require(_0x0fc6('0x7'));var csv=require('to-csv');var ejs=require(_0x0fc6('0x8'));var fs=require('fs');var fs_extra=require(_0x0fc6('0x9'));var _=require(_0x0fc6('0xa'));var squel=require(_0x0fc6('0xb'));var crypto=require(_0x0fc6('0xc'));var jsforce=require(_0x0fc6('0xd'));var deskjs=require(_0x0fc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0fc6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0fc6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0fc6('0x11'));var hardwareService=require(_0x0fc6('0x12'));var logger=require(_0x0fc6('0x13'))(_0x0fc6('0x14'));var utils=require(_0x0fc6('0x15'));var config=require(_0x0fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fc6('0x17'))['db'];function respondWithStatusCode(_0x3acc6e,_0x29d971){_0x29d971=_0x29d971||0xcc;return function(_0x3b3b40){if(_0x3b3b40){return _0x3acc6e[_0x0fc6('0x18')](_0x29d971);}return _0x3acc6e['status'](_0x29d971)['end']();};}function respondWithResult(_0x3d5557,_0x32632a){_0x32632a=_0x32632a||0xc8;return function(_0x128ecd){if(_0x128ecd){return _0x3d5557['status'](_0x32632a)['json'](_0x128ecd);}};}function respondWithFilteredResult(_0x5ac80e,_0x282178){return function(_0x212440){if(_0x212440){var _0x33f115=typeof _0x282178['offset']==='undefined'&&typeof _0x282178[_0x0fc6('0x19')]===_0x0fc6('0x1a');var _0x3318c7=_0x212440['count'];var _0x241b2d=_0x33f115?0x0:_0x282178[_0x0fc6('0x1b')];var _0x4e0105=_0x33f115?_0x212440['count']:_0x282178[_0x0fc6('0x1b')]+_0x282178[_0x0fc6('0x19')];var _0x226123;if(_0x4e0105>=_0x3318c7){_0x4e0105=_0x3318c7;_0x226123=0xc8;}else{_0x226123=0xce;}_0x5ac80e['status'](_0x226123);return _0x5ac80e['set'](_0x0fc6('0x1c'),_0x241b2d+'-'+_0x4e0105+'/'+_0x3318c7)['json'](_0x212440);}return null;};}function patchUpdates(_0x560c50){return function(_0x34196f){try{jsonpatch[_0x0fc6('0x1d')](_0x34196f,_0x560c50,!![]);}catch(_0x1a1f4a){return BPromise[_0x0fc6('0x1e')](_0x1a1f4a);}return _0x34196f[_0x0fc6('0x1f')]();};}function saveUpdates(_0x34adf3,_0x27939c){return function(_0x927ef1){if(_0x927ef1){return _0x927ef1[_0x0fc6('0x20')](_0x34adf3)['then'](function(_0x1eb321){return _0x1eb321;});}return null;};}function removeEntity(_0x3738a8,_0x38e3b5){return function(_0x254c83){if(_0x254c83){return _0x254c83[_0x0fc6('0x21')]()[_0x0fc6('0x22')](function(){_0x3738a8[_0x0fc6('0x23')](0xcc)[_0x0fc6('0x24')]();});}};}function handleEntityNotFound(_0x1d3c62,_0xa6ca83){return function(_0x17cfcb){if(!_0x17cfcb){_0x1d3c62['sendStatus'](0x194);}return _0x17cfcb;};}function handleError(_0x115c6f,_0x3c0aa0){_0x3c0aa0=_0x3c0aa0||0x1f4;return function(_0x1171ec){logger[_0x0fc6('0x25')](_0x1171ec[_0x0fc6('0x26')]);if(_0x1171ec[_0x0fc6('0x27')]){delete _0x1171ec[_0x0fc6('0x27')];}_0x115c6f[_0x0fc6('0x23')](_0x3c0aa0)[_0x0fc6('0x28')](_0x1171ec);};}exports[_0x0fc6('0x29')]=function(_0x10bd37,_0x15b32d){var _0x197b0f={},_0x1ac075={},_0x3354e8={'count':0x0,'rows':[]};var _0x23c223=_[_0x0fc6('0x2a')](db[_0x0fc6('0x2b')][_0x0fc6('0x2c')],function(_0x18884e){return{'name':_0x18884e[_0x0fc6('0x2d')],'type':_0x18884e['type']['key']};});_0x1ac075[_0x0fc6('0x2e')]=_[_0x0fc6('0x2a')](_0x23c223,_0x0fc6('0x27'));_0x1ac075[_0x0fc6('0x2f')]=_['keys'](_0x10bd37[_0x0fc6('0x2f')]);_0x1ac075[_0x0fc6('0x30')]=_['intersection'](_0x1ac075[_0x0fc6('0x2e')],_0x1ac075['query']);_0x197b0f[_0x0fc6('0x31')]=_['intersection'](_0x1ac075[_0x0fc6('0x2e')],qs[_0x0fc6('0x32')](_0x10bd37['query'][_0x0fc6('0x32')]));_0x197b0f[_0x0fc6('0x31')]=_0x197b0f['attributes'][_0x0fc6('0x33')]?_0x197b0f[_0x0fc6('0x31')]:_0x1ac075[_0x0fc6('0x2e')];if(!_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x34')](_0x0fc6('0x35'))){_0x197b0f[_0x0fc6('0x19')]=qs[_0x0fc6('0x19')](_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x19')]);_0x197b0f[_0x0fc6('0x1b')]=qs['offset'](_0x10bd37['query'][_0x0fc6('0x1b')]);}_0x197b0f[_0x0fc6('0x36')]=qs['sort'](_0x10bd37['query'][_0x0fc6('0x37')]);_0x197b0f['where']=qs['filters'](_[_0x0fc6('0x38')](_0x10bd37['query'],_0x1ac075[_0x0fc6('0x30')]),_0x23c223);if(_0x10bd37['query'][_0x0fc6('0x39')]){_0x197b0f[_0x0fc6('0x3a')]=_['merge'](_0x197b0f[_0x0fc6('0x3a')],{'$or':_[_0x0fc6('0x2a')](_0x23c223,function(_0x49b205){if(_0x49b205['type']!=='VIRTUAL'){var _0x21e6fe={};_0x21e6fe[_0x49b205[_0x0fc6('0x27')]]={'$like':'%'+_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x39')]+'%'};return _0x21e6fe;}})});}_0x197b0f=_[_0x0fc6('0x3b')]({},_0x197b0f,_0x10bd37[_0x0fc6('0x3c')]);var _0x224bab={'where':_0x197b0f[_0x0fc6('0x3a')]};return db[_0x0fc6('0x2b')][_0x0fc6('0x3d')](_0x224bab)['then'](function(_0xf08267){_0x3354e8[_0x0fc6('0x3d')]=_0xf08267;if(_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x3e')]){_0x197b0f[_0x0fc6('0x3f')]=[{'all':!![]}];}return db[_0x0fc6('0x2b')]['findAll'](_0x197b0f);})[_0x0fc6('0x22')](function(_0x2d7f7a){_0x3354e8[_0x0fc6('0x40')]=_0x2d7f7a;return _0x3354e8;})[_0x0fc6('0x22')](respondWithFilteredResult(_0x15b32d,_0x197b0f))[_0x0fc6('0x41')](handleError(_0x15b32d,null));};exports[_0x0fc6('0x42')]=function(_0x1ef871,_0x11da93){var _0x371030={'raw':!![],'where':{'id':_0x1ef871[_0x0fc6('0x43')]['id']}},_0x3a0ae8={};_0x3a0ae8[_0x0fc6('0x2e')]=_['keys'](db['SmsApplication'][_0x0fc6('0x2c')]);_0x3a0ae8[_0x0fc6('0x2f')]=_['keys'](_0x1ef871[_0x0fc6('0x2f')]);_0x3a0ae8[_0x0fc6('0x30')]=_['intersection'](_0x3a0ae8['model'],_0x3a0ae8[_0x0fc6('0x2f')]);_0x371030['attributes']=_['intersection'](_0x3a0ae8[_0x0fc6('0x2e')],qs[_0x0fc6('0x32')](_0x1ef871[_0x0fc6('0x2f')][_0x0fc6('0x32')]));_0x371030[_0x0fc6('0x31')]=_0x371030[_0x0fc6('0x31')]['length']?_0x371030[_0x0fc6('0x31')]:_0x3a0ae8[_0x0fc6('0x2e')];if(_0x1ef871[_0x0fc6('0x2f')][_0x0fc6('0x3e')]){_0x371030[_0x0fc6('0x3f')]=[{'all':!![]}];}_0x371030=_['merge']({},_0x371030,_0x1ef871['options']);return db[_0x0fc6('0x2b')][_0x0fc6('0x44')](_0x371030)[_0x0fc6('0x22')](handleEntityNotFound(_0x11da93,null))[_0x0fc6('0x22')](respondWithResult(_0x11da93,null))['catch'](handleError(_0x11da93,null));};exports['create']=function(_0x58833b,_0x5b0291){return db[_0x0fc6('0x2b')]['create'](_0x58833b[_0x0fc6('0x45')],{})[_0x0fc6('0x22')](respondWithResult(_0x5b0291,0xc9))[_0x0fc6('0x41')](handleError(_0x5b0291,null));};exports[_0x0fc6('0x20')]=function(_0x3149fd,_0x460927){if(_0x3149fd[_0x0fc6('0x45')]['id']){delete _0x3149fd['body']['id'];}return db[_0x0fc6('0x2b')][_0x0fc6('0x44')]({'where':{'id':_0x3149fd['params']['id']}})[_0x0fc6('0x22')](handleEntityNotFound(_0x460927,null))[_0x0fc6('0x22')](saveUpdates(_0x3149fd[_0x0fc6('0x45')],null))[_0x0fc6('0x22')](respondWithResult(_0x460927,null))[_0x0fc6('0x41')](handleError(_0x460927,null));};exports['destroy']=function(_0x2a1a40,_0x5a8b8d){return db[_0x0fc6('0x2b')][_0x0fc6('0x44')]({'where':{'id':_0x2a1a40['params']['id']}})[_0x0fc6('0x22')](handleEntityNotFound(_0x5a8b8d,null))[_0x0fc6('0x22')](removeEntity(_0x5a8b8d,null))[_0x0fc6('0x41')](handleError(_0x5a8b8d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a37f732..4da8b08 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 _0x802c=['request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x1c8dce,_0x2fe0cc){var _0x31a1c1=function(_0x4a60f2){while(--_0x4a60f2){_0x1c8dce['push'](_0x1c8dce['shift']());}};_0x31a1c1(++_0x2fe0cc);}(_0x802c,0x1dd));var _0xc802=function(_0x15318c,_0x2e50e4){_0x15318c=_0x15318c-0x0;var _0x10d3ce=_0x802c[_0x15318c];return _0x10d3ce;};'use strict';var _=require(_0xc802('0x0'));var util=require(_0xc802('0x1'));var logger=require(_0xc802('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc802('0x3'));var rp=require(_0xc802('0x4'));var fs=require('fs');var path=require(_0xc802('0x5'));var rimraf=require('rimraf');var config=require(_0xc802('0x6'));var attributes=require(_0xc802('0x7'));module[_0xc802('0x8')]=function(_0x4157c5,_0x399225){return _0x4157c5[_0xc802('0x9')]('SmsApplication',attributes,{'tableName':_0xc802('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc802('0xb'),'collate':_0xc802('0xc')});}; \ No newline at end of file +var _0x7aee=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x7aee,0x1c3));var _0xe7ae=function(_0x44e8d8,_0x38f2eb){_0x44e8d8=_0x44e8d8-0x0;var _0x220193=_0x7aee[_0x44e8d8];return _0x220193;};'use strict';var _=require(_0xe7ae('0x0'));var util=require('util');var logger=require(_0xe7ae('0x1'))(_0xe7ae('0x2'));var moment=require(_0xe7ae('0x3'));var BPromise=require(_0xe7ae('0x4'));var rp=require(_0xe7ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7ae('0x6'));var config=require(_0xe7ae('0x7'));var attributes=require(_0xe7ae('0x8'));module[_0xe7ae('0x9')]=function(_0x1d658a,_0x5c4173){return _0x1d658a[_0xe7ae('0xa')](_0xe7ae('0xb'),attributes,{'tableName':_0xe7ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7ae('0xd'),'collate':_0xe7ae('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c7131bf..390edbb 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 _0xb2af=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb2af,0xd2));var _0xfb2a=function(_0x32334d,_0x28a839){_0x32334d=_0x32334d-0x0;var _0x33b0f6=_0xb2af[_0x32334d];return _0x33b0f6;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file +var _0x3ef7=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a34c2,_0x3fb737){var _0x58cdef=function(_0x3336d1){while(--_0x3336d1){_0x3a34c2['push'](_0x3a34c2['shift']());}};_0x58cdef(++_0x3fb737);}(_0x3ef7,0xa2));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137f35,_0x1bc285,_0x1b2802){return new BPromise(function(_0xe938e1,_0x4cd5ce){return client[_0x73ef('0xb')](_0x137f35,_0x1b2802)[_0x73ef('0xc')](function(_0x50098a){logger[_0x73ef('0xd')](_0x73ef('0xe'),_0x1bc285,_0x73ef('0xf'));logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x1bc285,'request\x20sent',JSON[_0x73ef('0x12')](_0x50098a));if(_0x50098a[_0x73ef('0x13')]){if(_0x50098a[_0x73ef('0x13')][_0x73ef('0x14')]===0x1f4){logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x50098a[_0x73ef('0x13')][_0x73ef('0x15')]);return _0x4cd5ce(_0x50098a[_0x73ef('0x13')][_0x73ef('0x15')]);}logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x50098a[_0x73ef('0x13')]['message']);return _0xe938e1(_0x50098a[_0x73ef('0x13')]['message']);}else{logger[_0x73ef('0xd')](_0x73ef('0xe'),_0x1bc285,_0x73ef('0xf'));_0xe938e1(_0x50098a['result'][_0x73ef('0x15')]);}})[_0x73ef('0x16')](function(_0x4bccf6){logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x4bccf6);_0x4cd5ce(_0x4bccf6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 41c5dae..94579b3 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 _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5553a7,_0x3a8ee5){var _0x20c966=function(_0x356a6b){while(--_0x356a6b){_0x5553a7['push'](_0x5553a7['shift']());}};_0x20c966(++_0x3a8ee5);}(_0xe605,0x92));var _0x5e60=function(_0x2d2542,_0x36bfbe){_0x2d2542=_0x2d2542-0x0;var _0x332e1c=_0xe605[_0x2d2542];return _0x332e1c;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file +var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bb9fedf..597e65f 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 _0x2da6=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x17b883,_0xe20c9){var _0x9dabb0=function(_0x3f2d02){while(--_0x3f2d02){_0x17b883['push'](_0x17b883['shift']());}};_0x9dabb0(++_0xe20c9);}(_0x2da6,0x1dd));var _0x62da=function(_0xa122d7,_0x18afa3){_0xa122d7=_0xa122d7-0x0;var _0x51452a=_0x2da6[_0xa122d7];return _0x51452a;};'use strict';var Sequelize=require(_0x62da('0x0'));var moment=require(_0x62da('0x1'));module[_0x62da('0x2')]={'closed':{'type':Sequelize[_0x62da('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62da('0x4')]},'disposition':{'type':Sequelize[_0x62da('0x5')]},'secondDisposition':{'type':Sequelize[_0x62da('0x5')]},'thirdDisposition':{'type':Sequelize[_0x62da('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x62da('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x62da('0x6')]('in',_0x62da('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62da('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x62da('0x6')]('in',_0x62da('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x62da('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x62da('0x8')]}}; \ No newline at end of file +var _0x110f=['STRING','ENUM','out','DATE','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x4c506e,_0x81d98d){var _0x42a808=function(_0x55313c){while(--_0x55313c){_0x4c506e['push'](_0x4c506e['shift']());}};_0x42a808(++_0x81d98d);}(_0x110f,0x1e6));var _0xf110=function(_0x5aa14d,_0x13f3ed){_0x5aa14d=_0x5aa14d-0x0;var _0x4a3297=_0x110f[_0x5aa14d];return _0x4a3297;};'use strict';var Sequelize=require(_0xf110('0x0'));var moment=require(_0xf110('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf110('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf110('0x2')]},'note':{'type':Sequelize[_0xf110('0x2')]},'phone':{'type':Sequelize[_0xf110('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf110('0x3')]('in',_0xf110('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf110('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf110('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf110('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf110('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c285124..a20c73f 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 _0xaf07=['Contact','value','renderFile','server','views','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','defaults','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','count','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','sms','query','catch','show','model','SmsInteraction','keys','filters','intersection','fields','attributes','length','include','merge','options','find','create','body','params','describe','addMessage','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','limit','order','sort','pick','SmsInteractionId','filter','where','map','split','format','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out'];(function(_0x3aa329,_0x4e4e46){var _0x32ec90=function(_0x2062d8){while(--_0x2062d8){_0x3aa329['push'](_0x3aa329['shift']());}};_0x32ec90(++_0x4e4e46);}(_0xaf07,0x1df));var _0x7af0=function(_0x355a91,_0x103e84){_0x355a91=_0x355a91-0x0;var _0x40b0e2=_0xaf07[_0x355a91];return _0x40b0e2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7af0('0x0'));var moment=require(_0x7af0('0x1'));var BPromise=require(_0x7af0('0x2'));var util=require(_0x7af0('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7af0('0x4'));var Redis=require(_0x7af0('0x5'));var interaction=require(_0x7af0('0x6'));var qs=require(_0x7af0('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x7af0('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7af0('0x9')](config[_0x7af0('0xa')],{'host':_0x7af0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af0('0xa')]));require(_0x7af0('0xc'))[_0x7af0('0xd')](socket);function respondWithStatusCode(_0x231edf,_0x36044e){_0x36044e=_0x36044e||0xcc;return function(_0xc48dca){if(_0xc48dca){return _0x231edf['sendStatus'](_0x36044e);}return _0x231edf[_0x7af0('0xe')](_0x36044e)[_0x7af0('0xf')]();};}function respondWithResult(_0x1c5fff,_0x3a18f9){_0x3a18f9=_0x3a18f9||0xc8;return function(_0x200676){if(_0x200676){return _0x1c5fff[_0x7af0('0xe')](_0x3a18f9)[_0x7af0('0x10')](_0x200676);}};}function respondWithFilteredResult(_0x5aa8d3,_0x1e0812){return function(_0x55e16d){if(_0x55e16d){var _0x2c6a35=typeof _0x1e0812[_0x7af0('0x11')]===_0x7af0('0x12')&&typeof _0x1e0812['limit']===_0x7af0('0x12');var _0x458492=_0x55e16d[_0x7af0('0x13')];var _0x2c9c0b=_0x2c6a35?0x0:_0x1e0812[_0x7af0('0x11')];var _0x10bf59=_0x2c6a35?_0x55e16d['count']:_0x1e0812[_0x7af0('0x11')]+_0x1e0812['limit'];var _0x489058;if(_0x10bf59>=_0x458492){_0x10bf59=_0x458492;_0x489058=0xc8;}else{_0x489058=0xce;}_0x5aa8d3['status'](_0x489058);return _0x5aa8d3['set']('Content-Range',_0x2c9c0b+'-'+_0x10bf59+'/'+_0x458492)[_0x7af0('0x10')](_0x55e16d);}return null;};}function saveUpdates(_0x1dd923){return function(_0xedd929){if(_0xedd929){return _0xedd929['update'](_0x1dd923)[_0x7af0('0x14')](function(_0x34abf7){return _0x34abf7;});}return null;};}function removeEntity(_0x235647){return function(_0x5def40){if(_0x5def40){return _0x5def40[_0x7af0('0x15')]()['then'](function(){_0x235647[_0x7af0('0xe')](0xcc)[_0x7af0('0xf')]();});}};}function handleEntityNotFound(_0x39b2a9){return function(_0x478242){if(!_0x478242){_0x39b2a9['sendStatus'](0x194);}return _0x478242;};}function handleError(_0x46a0b5,_0x5206a8){_0x5206a8=_0x5206a8||0x1f4;return function(_0x5555bf){logger['error'](_0x5555bf[_0x7af0('0x16')]);if(_0x5555bf[_0x7af0('0x17')]){delete _0x5555bf[_0x7af0('0x17')];}_0x46a0b5[_0x7af0('0xe')](_0x5206a8)[_0x7af0('0x18')](_0x5555bf);};}exports[_0x7af0('0x19')]=function(_0x1c72ce,_0x415b78){var _0x2b70a7={};var _0x2371f8=_['map'](db['SmsInteraction'][_0x7af0('0x1a')],function(_0x1b15cf){return{'name':_0x1b15cf[_0x7af0('0x1b')],'type':_0x1b15cf[_0x7af0('0x1c')]['key']};});_0x2b70a7=qs[_0x7af0('0x1d')](_0x2371f8,_0x1c72ce);return interaction[_0x7af0('0x1e')](_0x7af0('0x1f'),_0x1c72ce[_0x7af0('0x20')],_0x1c72ce['user'],_0x2b70a7,_0x2371f8)[_0x7af0('0x14')](respondWithFilteredResult(_0x415b78,_0x2b70a7))[_0x7af0('0x21')](handleError(_0x415b78,null));};exports[_0x7af0('0x22')]=function(_0x1c0bfd,_0x3b6670){var _0x22a42d={'raw':![],'where':{'id':_0x1c0bfd['params']['id']}},_0x462176={};_0x462176[_0x7af0('0x23')]=_['keys'](db[_0x7af0('0x24')][_0x7af0('0x1a')]);_0x462176[_0x7af0('0x20')]=_[_0x7af0('0x25')](_0x1c0bfd['query']);_0x462176[_0x7af0('0x26')]=_[_0x7af0('0x27')](_0x462176['model'],_0x462176[_0x7af0('0x20')]);_0x22a42d['attributes']=_[_0x7af0('0x27')](_0x462176[_0x7af0('0x23')],qs['fields'](_0x1c0bfd[_0x7af0('0x20')][_0x7af0('0x28')]));_0x22a42d[_0x7af0('0x29')]=_0x22a42d[_0x7af0('0x29')][_0x7af0('0x2a')]?_0x22a42d[_0x7af0('0x29')]:_0x462176[_0x7af0('0x23')];if(_0x1c0bfd['query']['includeAll']){_0x22a42d[_0x7af0('0x2b')]=[{'all':!![]}];}_0x22a42d=_[_0x7af0('0x2c')]({},_0x22a42d,_0x1c0bfd[_0x7af0('0x2d')]);return db[_0x7af0('0x24')][_0x7af0('0x2e')](_0x22a42d)[_0x7af0('0x14')](handleEntityNotFound(_0x3b6670,null))[_0x7af0('0x14')](respondWithResult(_0x3b6670,null))[_0x7af0('0x21')](handleError(_0x3b6670,null));};exports[_0x7af0('0x2f')]=function(_0x1694ce,_0x44e30e){return db[_0x7af0('0x24')]['create'](_0x1694ce[_0x7af0('0x30')],{})[_0x7af0('0x14')](respondWithResult(_0x44e30e,0xc9))[_0x7af0('0x21')](handleError(_0x44e30e,null));};exports['update']=function(_0xaa40aa,_0x518830){if(_0xaa40aa[_0x7af0('0x30')]['id']){delete _0xaa40aa[_0x7af0('0x30')]['id'];}return db[_0x7af0('0x24')]['find']({'where':{'id':_0xaa40aa[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x518830,null))['then'](saveUpdates(_0xaa40aa[_0x7af0('0x30')],null))[_0x7af0('0x14')](respondWithResult(_0x518830,null))['catch'](handleError(_0x518830,null));};exports[_0x7af0('0x15')]=function(_0x24053f,_0x26f85a){return db[_0x7af0('0x24')][_0x7af0('0x2e')]({'where':{'id':_0x24053f['params']['id']}})['then'](handleEntityNotFound(_0x26f85a,null))[_0x7af0('0x14')](removeEntity(_0x26f85a,null))[_0x7af0('0x21')](handleError(_0x26f85a,null));};exports[_0x7af0('0x32')]=function(_0x14fc74,_0x24fe93){return db[_0x7af0('0x24')][_0x7af0('0x32')]()['then'](respondWithResult(_0x24fe93,null))[_0x7af0('0x21')](handleError(_0x24fe93,null));};exports[_0x7af0('0x33')]=function(_0x239617,_0x2181b7){return db['SmsMessage'][_0x7af0('0x2e')]({'where':{'id':_0x239617[_0x7af0('0x31')]['id']}})['then'](handleEntityNotFound(_0x2181b7,null))[_0x7af0('0x14')](function(_0x2e1a94){if(_0x2e1a94){return _0x2e1a94['addMessage'](_0x239617[_0x7af0('0x30')]['ids'],_[_0x7af0('0x34')](_0x239617['body'],['ids','id'])||{});}})[_0x7af0('0x14')](respondWithResult(_0x2181b7,null))[_0x7af0('0x21')](handleError(_0x2181b7,null));};exports[_0x7af0('0x35')]=function(_0x57859a,_0x1c8d4b){var _0x23fb57={'raw':![],'where':{}};var _0x1412a3={};var _0x506f1d={'count':0x0,'rows':[]};return db[_0x7af0('0x24')][_0x7af0('0x36')]({'where':{'id':_0x57859a[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x1c8d4b,null))[_0x7af0('0x14')](function(_0x58abab){if(_0x58abab){_0x1412a3[_0x7af0('0x23')]=_['keys'](db[_0x7af0('0x37')][_0x7af0('0x1a')]);_0x1412a3['query']=_[_0x7af0('0x25')](_0x57859a[_0x7af0('0x20')]);_0x1412a3[_0x7af0('0x26')]=_['intersection'](_0x1412a3['model'],_0x1412a3[_0x7af0('0x20')]);_0x23fb57[_0x7af0('0x29')]=_[_0x7af0('0x27')](_0x1412a3['model'],qs['fields'](_0x57859a[_0x7af0('0x20')]['fields']));_0x23fb57['attributes']=_0x23fb57[_0x7af0('0x29')][_0x7af0('0x2a')]?_0x23fb57[_0x7af0('0x29')]:_0x1412a3[_0x7af0('0x23')];if(!_0x57859a['query'][_0x7af0('0x38')](_0x7af0('0x39'))){_0x23fb57['limit']=qs[_0x7af0('0x3a')](_0x57859a[_0x7af0('0x20')][_0x7af0('0x3a')]);_0x23fb57[_0x7af0('0x11')]=qs['offset'](_0x57859a['query']['offset']);}_0x23fb57[_0x7af0('0x3b')]=qs['sort'](_0x57859a[_0x7af0('0x20')][_0x7af0('0x3c')]);_0x23fb57['where']=qs[_0x7af0('0x26')](_[_0x7af0('0x3d')](_0x57859a[_0x7af0('0x20')],_0x1412a3[_0x7af0('0x26')]));_0x23fb57['where'][_0x7af0('0x3e')]=_0x58abab['id'];if(_0x57859a['query'][_0x7af0('0x3f')]){_0x23fb57[_0x7af0('0x40')]=_[_0x7af0('0x2c')](_0x23fb57[_0x7af0('0x40')],{'$or':_[_0x7af0('0x41')](_0x23fb57[_0x7af0('0x29')],function(_0x1a8f54){var _0x281570={};_0x281570[_0x1a8f54]={'$like':'%'+_0x57859a['query'][_0x7af0('0x3f')]+'%'};return _0x281570;})});}if(_0x57859a['query']['$gte']){var _0x1614d2=_0x57859a[_0x7af0('0x20')]['$gte'][_0x7af0('0x42')](',');var _0x358275={};_0x358275[_0x1614d2[0x0]]={'$gte':moment(_0x1614d2[0x1])[_0x7af0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23fb57[_0x7af0('0x40')]=_['merge'](_0x23fb57[_0x7af0('0x40')],_0x358275);}_0x23fb57=_[_0x7af0('0x2c')]({},_0x23fb57,_0x57859a[_0x7af0('0x2d')]);return db['SmsMessage'][_0x7af0('0x13')]({'where':_0x23fb57[_0x7af0('0x40')]})[_0x7af0('0x14')](function(_0x4bb90e){_0x506f1d[_0x7af0('0x13')]=_0x4bb90e;if(_0x57859a[_0x7af0('0x20')][_0x7af0('0x44')]){_0x23fb57['include']=[{'all':!![]}];}return db[_0x7af0('0x37')][_0x7af0('0x1e')](_0x23fb57);})[_0x7af0('0x14')](function(_0x4348b0){_0x506f1d[_0x7af0('0x45')]=_0x4348b0;return _0x506f1d;});}})[_0x7af0('0x14')](respondWithFilteredResult(_0x1c8d4b,_0x23fb57))[_0x7af0('0x21')](handleError(_0x1c8d4b,null));};exports[_0x7af0('0x46')]=function(_0x408e71,_0x5ec2eb){return db[_0x7af0('0x24')]['find']({'where':{'id':_0x408e71[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x5ec2eb,null))['then'](function(_0x94ded5){if(_0x94ded5){return _0x94ded5[_0x7af0('0x47')](_0x408e71['body'][_0x7af0('0x48')],_[_0x7af0('0x34')](_0x408e71['body'],[_0x7af0('0x48'),'id'])||{})[_0x7af0('0x49')](function(){return db[_0x7af0('0x4a')]['findAll']({'attributes':['id',_0x7af0('0x17'),_0x7af0('0x4b')],'where':{'id':_0x408e71[_0x7af0('0x30')][_0x7af0('0x48')]}});})['then'](function(_0x477783){socket[_0x7af0('0x4c')](_0x7af0('0x4d'),{'id':Number(_0x408e71[_0x7af0('0x31')]['id']),'tags':_0x477783||[]});return{'id':Number(_0x408e71[_0x7af0('0x31')]['id']),'tags':_0x477783||[]};});}})[_0x7af0('0x14')](respondWithResult(_0x5ec2eb,null))[_0x7af0('0x21')](handleError(_0x5ec2eb,null));};exports[_0x7af0('0x4e')]=function(_0xab4c2c,_0x2e66d7){return db[_0x7af0('0x24')][_0x7af0('0x2e')]({'where':{'id':_0xab4c2c[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x2e66d7,null))['then'](function(_0x1032f4){if(_0x1032f4){return _0x1032f4[_0x7af0('0x4e')](_0xab4c2c[_0x7af0('0x20')]['ids']);}})[_0x7af0('0x14')](respondWithStatusCode(_0x2e66d7,null))['catch'](handleError(_0x2e66d7,null));};exports[_0x7af0('0x4f')]=function(_0x5affe8,_0x19c231){var _0x17514e=moment()['unix']()[_0x7af0('0x50')]();var _0x35f4b1=path[_0x7af0('0x51')](config[_0x7af0('0x52')],'server','files',_0x7af0('0x53'));var _0x10c809=path[_0x7af0('0x51')](_0x35f4b1,_0x17514e);var _0x191319=util[_0x7af0('0x43')](_0x7af0('0x54'),_0x5affe8['params']['id'],_0x17514e);var _0x11d1c2=path[_0x7af0('0x51')](_0x35f4b1,_0x191319);var _0x6d22d7=[];_0x6d22d7['push']({'model':db['User'],'as':_0x7af0('0x55'),'attributes':['id',_0x7af0('0x56')],'raw':!![]});_0x6d22d7[_0x7af0('0x57')]({'model':db[_0x7af0('0x58')],'as':'Contact','attributes':['id',_0x7af0('0x59'),_0x7af0('0x5a')],'raw':!![]});var _0x54ddcc=[{'model':db[_0x7af0('0x37')],'as':_0x7af0('0x5b'),'attributes':['id',_0x7af0('0x30'),_0x7af0('0x5c'),_0x7af0('0x5d'),_0x7af0('0x5e'),_0x7af0('0x5f')],'include':_0x6d22d7}];_0x54ddcc['push']({'model':db[_0x7af0('0x60')],'as':_0x7af0('0x61'),'attributes':['id',_0x7af0('0x17')]});_0x54ddcc[_0x7af0('0x57')]({'model':db[_0x7af0('0x55')],'as':_0x7af0('0x62'),'attributes':['id',_0x7af0('0x56')]});return db[_0x7af0('0x24')]['find']({'where':{'id':_0x5affe8[_0x7af0('0x31')]['id']},'include':_0x54ddcc})[_0x7af0('0x14')](handleEntityNotFound(_0x19c231,null))[_0x7af0('0x14')](function(_0x5ba6ea){if(_0x5ba6ea){var _0x11b028=_0x5ba6ea['get']({'plain':!![]});fs[_0x7af0('0x63')](_0x10c809);var _0x37fddd={'channel':_0x7af0('0x64'),'account':_0x11b028['Account'][_0x7af0('0x17')],'agent':_0x11b028['Owner']?_0x11b028['Owner'][_0x7af0('0x56')]:_0x7af0('0x65'),'createdAt':moment(_0x11b028[_0x7af0('0x5c')])[_0x7af0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7af0('0x50')](),'closedAt':_0x11b028['closed']?moment(_0x11b028[_0x7af0('0x66')])[_0x7af0('0x43')](_0x7af0('0x67'))[_0x7af0('0x50')]():'','disposition':_0x11b028[_0x7af0('0x68')],'messages':_(_0x11b028[_0x7af0('0x5b')])[_0x7af0('0x3f')]({'secret':![]})[_0x7af0('0x41')](function(_0x30eb83){return{'date':moment(_0x30eb83[_0x7af0('0x5c')])['format'](_0x7af0('0x67'))[_0x7af0('0x50')](),'sender':_0x30eb83[_0x7af0('0x5d')]===_0x7af0('0x69')?_0x30eb83[_0x7af0('0x55')]?_0x30eb83[_0x7af0('0x55')][_0x7af0('0x56')]:'System':_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x59')]+(_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x5a')]?'\x20'+_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x5a')]:''),'body':_0x30eb83[_0x7af0('0x30')],'direction':_0x30eb83[_0x7af0('0x5d')]==='out'?'A':'C','secret':_0x30eb83[_0x7af0('0x5e')],'read':_0x30eb83[_0x7af0('0x5f')]};})[_0x7af0('0x6b')]()};return ejs[_0x7af0('0x6c')](path[_0x7af0('0x51')](config[_0x7af0('0x52')],_0x7af0('0x6d'),_0x7af0('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x37fddd})[_0x7af0('0x14')](function(_0x5422b9){var _0x163e76=path[_0x7af0('0x51')](_0x10c809,'transcript-'+_0x11b028['id']+'-'+_0x17514e+_0x7af0('0x6f'));var _0x1eb412={'path':_0x163e76,'channel':'Sms','interactionId':_0x11b028['id']};return pdf[_0x7af0('0x70')](_0x5422b9,_0x1eb412);})[_0x7af0('0x14')](function(){return new BPromise(function(_0x1cef39,_0x4856c5){zipdir(_0x10c809,{'saveTo':_0x11d1c2},function(_0x4e0223,_0x41907f){if(_0x4e0223)return _0x4856c5(_0x4e0223);return _0x1cef39(_0x41907f);});})[_0x7af0('0x14')](function(){return new BPromise(function(_0x2ed121,_0x37e433){rimraf(_0x10c809,function(_0x174b49){if(_0x174b49)_0x37e433(_0x174b49);return _0x2ed121();});});})[_0x7af0('0x14')](function(){return _0x19c231[_0x7af0('0x4f')](_0x11d1c2,_0x191319,function(_0x38d383){if(_0x38d383){console[_0x7af0('0x71')](_0x7af0('0x72'),_0x38d383);}else{fs[_0x7af0('0x73')](_0x11d1c2);}});});});}else{return _0x19c231[_0x7af0('0x74')](0xc8);}})[_0x7af0('0x21')](handleError(_0x19c231,null));}; \ No newline at end of file +var _0xfd62=['ids','omit','getMessages','findOne','length','nolimit','order','sort','where','pick','filter','$gte','addTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','User','push','Contact','lastName','direction','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','createdAt','out','firstName','value','renderFile','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','update','destroy','then','name','send','index','map','rawAttributes','key','findAll','sms','query','user','catch','show','model','keys','SmsInteraction','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','params','describe','addMessage','SmsMessage'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xfd62,0xaa));var _0x2fd6=function(_0xd8906c,_0x256420){_0xd8906c=_0xd8906c-0x0;var _0x4c49cb=_0xfd62[_0xd8906c];return _0x4c49cb;};'use strict';var rimraf=require(_0x2fd6('0x0'));var zipdir=require(_0x2fd6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2fd6('0x2'));var path=require(_0x2fd6('0x3'));var ejs=require(_0x2fd6('0x4'));var fs=require('fs');var _=require(_0x2fd6('0x5'));var Redis=require(_0x2fd6('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x2fd6('0x7'));var pdf=require(_0x2fd6('0x8'));var logger=require(_0x2fd6('0x9'))(_0x2fd6('0xa'));var config=require(_0x2fd6('0xb'));var db=require('../../mysqldb')['db'];config[_0x2fd6('0xc')]=_['defaults'](config[_0x2fd6('0xc')],{'host':_0x2fd6('0xd'),'port':0x18eb});var socket=require(_0x2fd6('0xe'))(new Redis(config[_0x2fd6('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x692df2,_0x297560){_0x297560=_0x297560||0xcc;return function(_0x5901a7){if(_0x5901a7){return _0x692df2[_0x2fd6('0xf')](_0x297560);}return _0x692df2[_0x2fd6('0x10')](_0x297560)['end']();};}function respondWithResult(_0x2aa16d,_0x3766b8){_0x3766b8=_0x3766b8||0xc8;return function(_0xa505e6){if(_0xa505e6){return _0x2aa16d['status'](_0x3766b8)['json'](_0xa505e6);}};}function respondWithFilteredResult(_0x12f253,_0x55ab9f){return function(_0xd10d1){if(_0xd10d1){var _0x483ed5=typeof _0x55ab9f['offset']===_0x2fd6('0x11')&&typeof _0x55ab9f[_0x2fd6('0x12')]===_0x2fd6('0x11');var _0x3f1020=_0xd10d1[_0x2fd6('0x13')];var _0x20ff71=_0x483ed5?0x0:_0x55ab9f['offset'];var _0x28c9dc=_0x483ed5?_0xd10d1['count']:_0x55ab9f[_0x2fd6('0x14')]+_0x55ab9f[_0x2fd6('0x12')];var _0x2d7098;if(_0x28c9dc>=_0x3f1020){_0x28c9dc=_0x3f1020;_0x2d7098=0xc8;}else{_0x2d7098=0xce;}_0x12f253[_0x2fd6('0x10')](_0x2d7098);return _0x12f253[_0x2fd6('0x15')](_0x2fd6('0x16'),_0x20ff71+'-'+_0x28c9dc+'/'+_0x3f1020)['json'](_0xd10d1);}return null;};}function saveUpdates(_0x426a80){return function(_0x4480e5){if(_0x4480e5){return _0x4480e5[_0x2fd6('0x17')](_0x426a80)['then'](function(_0x5f43c8){return _0x5f43c8;});}return null;};}function removeEntity(_0x1f1635){return function(_0x2b71db){if(_0x2b71db){return _0x2b71db[_0x2fd6('0x18')]()[_0x2fd6('0x19')](function(){_0x1f1635[_0x2fd6('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16abe8){return function(_0x4009ef){if(!_0x4009ef){_0x16abe8['sendStatus'](0x194);}return _0x4009ef;};}function handleError(_0x51b6d0,_0x1cc532){_0x1cc532=_0x1cc532||0x1f4;return function(_0x4471c4){logger['error'](_0x4471c4['stack']);if(_0x4471c4[_0x2fd6('0x1a')]){delete _0x4471c4[_0x2fd6('0x1a')];}_0x51b6d0[_0x2fd6('0x10')](_0x1cc532)[_0x2fd6('0x1b')](_0x4471c4);};}exports[_0x2fd6('0x1c')]=function(_0x1f5de5,_0x3cde78){var _0x3ed117={};var _0x24d7bf=_[_0x2fd6('0x1d')](db['SmsInteraction'][_0x2fd6('0x1e')],function(_0x5f00f3){return{'name':_0x5f00f3['fieldName'],'type':_0x5f00f3['type'][_0x2fd6('0x1f')]};});_0x3ed117=qs['getOptions'](_0x24d7bf,_0x1f5de5);return interaction[_0x2fd6('0x20')](_0x2fd6('0x21'),_0x1f5de5[_0x2fd6('0x22')],_0x1f5de5[_0x2fd6('0x23')],_0x3ed117,_0x24d7bf)['then'](respondWithFilteredResult(_0x3cde78,_0x3ed117))[_0x2fd6('0x24')](handleError(_0x3cde78,null));};exports[_0x2fd6('0x25')]=function(_0x2023dc,_0x190d08){var _0x5025d0={'raw':![],'where':{'id':_0x2023dc['params']['id']}},_0x275fac={};_0x275fac[_0x2fd6('0x26')]=_[_0x2fd6('0x27')](db[_0x2fd6('0x28')][_0x2fd6('0x1e')]);_0x275fac['query']=_[_0x2fd6('0x27')](_0x2023dc[_0x2fd6('0x22')]);_0x275fac[_0x2fd6('0x29')]=_[_0x2fd6('0x2a')](_0x275fac[_0x2fd6('0x26')],_0x275fac['query']);_0x5025d0['attributes']=_[_0x2fd6('0x2a')](_0x275fac[_0x2fd6('0x26')],qs[_0x2fd6('0x2b')](_0x2023dc[_0x2fd6('0x22')]['fields']));_0x5025d0[_0x2fd6('0x2c')]=_0x5025d0[_0x2fd6('0x2c')]['length']?_0x5025d0[_0x2fd6('0x2c')]:_0x275fac[_0x2fd6('0x26')];if(_0x2023dc['query'][_0x2fd6('0x2d')]){_0x5025d0[_0x2fd6('0x2e')]=[{'all':!![]}];}_0x5025d0=_[_0x2fd6('0x2f')]({},_0x5025d0,_0x2023dc[_0x2fd6('0x30')]);return db['SmsInteraction'][_0x2fd6('0x31')](_0x5025d0)['then'](handleEntityNotFound(_0x190d08,null))['then'](respondWithResult(_0x190d08,null))[_0x2fd6('0x24')](handleError(_0x190d08,null));};exports[_0x2fd6('0x32')]=function(_0xdffcc4,_0x256e2f){return db[_0x2fd6('0x28')][_0x2fd6('0x32')](_0xdffcc4[_0x2fd6('0x33')],{})[_0x2fd6('0x19')](respondWithResult(_0x256e2f,0xc9))[_0x2fd6('0x24')](handleError(_0x256e2f,null));};exports['update']=function(_0x43acda,_0x3a04e7){if(_0x43acda[_0x2fd6('0x33')]['id']){delete _0x43acda['body']['id'];}return db[_0x2fd6('0x28')]['find']({'where':{'id':_0x43acda[_0x2fd6('0x34')]['id']}})['then'](handleEntityNotFound(_0x3a04e7,null))[_0x2fd6('0x19')](saveUpdates(_0x43acda[_0x2fd6('0x33')],null))[_0x2fd6('0x19')](respondWithResult(_0x3a04e7,null))[_0x2fd6('0x24')](handleError(_0x3a04e7,null));};exports[_0x2fd6('0x18')]=function(_0x1231e9,_0x432f63){return db[_0x2fd6('0x28')][_0x2fd6('0x31')]({'where':{'id':_0x1231e9['params']['id']}})['then'](handleEntityNotFound(_0x432f63,null))[_0x2fd6('0x19')](removeEntity(_0x432f63,null))[_0x2fd6('0x24')](handleError(_0x432f63,null));};exports[_0x2fd6('0x35')]=function(_0x446a25,_0x3f5dbe){return db[_0x2fd6('0x28')]['describe']()['then'](respondWithResult(_0x3f5dbe,null))[_0x2fd6('0x24')](handleError(_0x3f5dbe,null));};exports[_0x2fd6('0x36')]=function(_0x16b7e6,_0x1eca4a){return db[_0x2fd6('0x37')][_0x2fd6('0x31')]({'where':{'id':_0x16b7e6[_0x2fd6('0x34')]['id']}})['then'](handleEntityNotFound(_0x1eca4a,null))['then'](function(_0x57a7fe){if(_0x57a7fe){return _0x57a7fe[_0x2fd6('0x36')](_0x16b7e6['body'][_0x2fd6('0x38')],_[_0x2fd6('0x39')](_0x16b7e6[_0x2fd6('0x33')],[_0x2fd6('0x38'),'id'])||{});}})[_0x2fd6('0x19')](respondWithResult(_0x1eca4a,null))[_0x2fd6('0x24')](handleError(_0x1eca4a,null));};exports[_0x2fd6('0x3a')]=function(_0x43f311,_0x3e1ea5){var _0x4482c3={'raw':![],'where':{}};var _0x2ca614={};var _0x37df73={'count':0x0,'rows':[]};return db[_0x2fd6('0x28')][_0x2fd6('0x3b')]({'where':{'id':_0x43f311['params']['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x3e1ea5,null))[_0x2fd6('0x19')](function(_0xf847fa){if(_0xf847fa){_0x2ca614[_0x2fd6('0x26')]=_[_0x2fd6('0x27')](db[_0x2fd6('0x37')][_0x2fd6('0x1e')]);_0x2ca614[_0x2fd6('0x22')]=_[_0x2fd6('0x27')](_0x43f311['query']);_0x2ca614[_0x2fd6('0x29')]=_[_0x2fd6('0x2a')](_0x2ca614[_0x2fd6('0x26')],_0x2ca614[_0x2fd6('0x22')]);_0x4482c3[_0x2fd6('0x2c')]=_[_0x2fd6('0x2a')](_0x2ca614[_0x2fd6('0x26')],qs[_0x2fd6('0x2b')](_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x2b')]));_0x4482c3[_0x2fd6('0x2c')]=_0x4482c3[_0x2fd6('0x2c')][_0x2fd6('0x3c')]?_0x4482c3[_0x2fd6('0x2c')]:_0x2ca614[_0x2fd6('0x26')];if(!_0x43f311[_0x2fd6('0x22')]['hasOwnProperty'](_0x2fd6('0x3d'))){_0x4482c3[_0x2fd6('0x12')]=qs['limit'](_0x43f311['query'][_0x2fd6('0x12')]);_0x4482c3[_0x2fd6('0x14')]=qs[_0x2fd6('0x14')](_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x14')]);}_0x4482c3[_0x2fd6('0x3e')]=qs[_0x2fd6('0x3f')](_0x43f311[_0x2fd6('0x22')]['sort']);_0x4482c3[_0x2fd6('0x40')]=qs[_0x2fd6('0x29')](_[_0x2fd6('0x41')](_0x43f311['query'],_0x2ca614[_0x2fd6('0x29')]));_0x4482c3[_0x2fd6('0x40')]['SmsInteractionId']=_0xf847fa['id'];if(_0x43f311[_0x2fd6('0x22')]['filter']){_0x4482c3[_0x2fd6('0x40')]=_[_0x2fd6('0x2f')](_0x4482c3['where'],{'$or':_['map'](_0x4482c3[_0x2fd6('0x2c')],function(_0x245eb6){var _0x2ee0d9={};_0x2ee0d9[_0x245eb6]={'$like':'%'+_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x42')]+'%'};return _0x2ee0d9;})});}if(_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x43')]){var _0x2dcfe3=_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x43')]['split'](',');var _0x2bec78={};_0x2bec78[_0x2dcfe3[0x0]]={'$gte':moment(_0x2dcfe3[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4482c3['where']=_[_0x2fd6('0x2f')](_0x4482c3['where'],_0x2bec78);}_0x4482c3=_['merge']({},_0x4482c3,_0x43f311['options']);return db[_0x2fd6('0x37')]['count']({'where':_0x4482c3['where']})['then'](function(_0x11dfba){_0x37df73[_0x2fd6('0x13')]=_0x11dfba;if(_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x2d')]){_0x4482c3[_0x2fd6('0x2e')]=[{'all':!![]}];}return db['SmsMessage'][_0x2fd6('0x20')](_0x4482c3);})[_0x2fd6('0x19')](function(_0xbd3152){_0x37df73['rows']=_0xbd3152;return _0x37df73;});}})['then'](respondWithFilteredResult(_0x3e1ea5,_0x4482c3))[_0x2fd6('0x24')](handleError(_0x3e1ea5,null));};exports[_0x2fd6('0x44')]=function(_0xcb0c39,_0x436d66){return db[_0x2fd6('0x28')][_0x2fd6('0x31')]({'where':{'id':_0xcb0c39[_0x2fd6('0x34')]['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x436d66,null))[_0x2fd6('0x19')](function(_0x1ed953){if(_0x1ed953){return _0x1ed953['setTags'](_0xcb0c39[_0x2fd6('0x33')][_0x2fd6('0x38')],_[_0x2fd6('0x39')](_0xcb0c39[_0x2fd6('0x33')],[_0x2fd6('0x38'),'id'])||{})['spread'](function(){return db[_0x2fd6('0x45')][_0x2fd6('0x20')]({'attributes':['id',_0x2fd6('0x1a'),_0x2fd6('0x46')],'where':{'id':_0xcb0c39['body'][_0x2fd6('0x38')]}});})[_0x2fd6('0x19')](function(_0x49e4f2){socket[_0x2fd6('0x47')](_0x2fd6('0x48'),{'id':Number(_0xcb0c39['params']['id']),'tags':_0x49e4f2||[]});return{'id':Number(_0xcb0c39[_0x2fd6('0x34')]['id']),'tags':_0x49e4f2||[]};});}})[_0x2fd6('0x19')](respondWithResult(_0x436d66,null))[_0x2fd6('0x24')](handleError(_0x436d66,null));};exports[_0x2fd6('0x49')]=function(_0x4fd81c,_0x574d6b){return db[_0x2fd6('0x28')]['find']({'where':{'id':_0x4fd81c[_0x2fd6('0x34')]['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x574d6b,null))[_0x2fd6('0x19')](function(_0xb6b731){if(_0xb6b731){return _0xb6b731[_0x2fd6('0x49')](_0x4fd81c[_0x2fd6('0x22')]['ids']);}})[_0x2fd6('0x19')](respondWithStatusCode(_0x574d6b,null))[_0x2fd6('0x24')](handleError(_0x574d6b,null));};exports[_0x2fd6('0x4a')]=function(_0x43a324,_0xfa1ac4){var _0x57cdde=moment()[_0x2fd6('0x4b')]()[_0x2fd6('0x4c')]();var _0x19154e=path[_0x2fd6('0x4d')](config[_0x2fd6('0x4e')],_0x2fd6('0x4f'),_0x2fd6('0x50'),_0x2fd6('0x51'));var _0x481d6a=path[_0x2fd6('0x4d')](_0x19154e,_0x57cdde);var _0x459460=util[_0x2fd6('0x52')](_0x2fd6('0x53'),_0x43a324['params']['id'],_0x57cdde);var _0xee0b42=path['join'](_0x19154e,_0x459460);var _0x325210=[];_0x325210['push']({'model':db[_0x2fd6('0x54')],'as':_0x2fd6('0x54'),'attributes':['id','fullname'],'raw':!![]});_0x325210[_0x2fd6('0x55')]({'model':db['CmContact'],'as':_0x2fd6('0x56'),'attributes':['id','firstName',_0x2fd6('0x57')],'raw':!![]});var _0x5b2a42=[{'model':db[_0x2fd6('0x37')],'as':'Messages','attributes':['id',_0x2fd6('0x33'),'createdAt',_0x2fd6('0x58'),_0x2fd6('0x59'),_0x2fd6('0x5a')],'include':_0x325210}];_0x5b2a42['push']({'model':db[_0x2fd6('0x5b')],'as':'Account','attributes':['id',_0x2fd6('0x1a')]});_0x5b2a42[_0x2fd6('0x55')]({'model':db[_0x2fd6('0x54')],'as':_0x2fd6('0x5c'),'attributes':['id',_0x2fd6('0x5d')]});return db['SmsInteraction'][_0x2fd6('0x31')]({'where':{'id':_0x43a324[_0x2fd6('0x34')]['id']},'include':_0x5b2a42})['then'](handleEntityNotFound(_0xfa1ac4,null))['then'](function(_0x53bebf){if(_0x53bebf){var _0x1bd283=_0x53bebf[_0x2fd6('0x5e')]({'plain':!![]});fs[_0x2fd6('0x5f')](_0x481d6a);var _0x2ff9bd={'channel':_0x2fd6('0x60'),'account':_0x1bd283['Account'][_0x2fd6('0x1a')],'agent':_0x1bd283[_0x2fd6('0x5c')]?_0x1bd283['Owner'][_0x2fd6('0x5d')]:_0x2fd6('0x61'),'createdAt':moment(_0x1bd283['createdAt'])[_0x2fd6('0x52')](_0x2fd6('0x62'))['toString'](),'closedAt':_0x1bd283[_0x2fd6('0x63')]?moment(_0x1bd283[_0x2fd6('0x64')])[_0x2fd6('0x52')](_0x2fd6('0x62'))[_0x2fd6('0x4c')]():'','disposition':_0x1bd283[_0x2fd6('0x65')],'messages':_(_0x1bd283[_0x2fd6('0x66')])[_0x2fd6('0x42')]({'secret':![]})['map'](function(_0x505a97){return{'date':moment(_0x505a97[_0x2fd6('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2fd6('0x4c')](),'sender':_0x505a97[_0x2fd6('0x58')]===_0x2fd6('0x68')?_0x505a97[_0x2fd6('0x54')]?_0x505a97['User'][_0x2fd6('0x5d')]:'System':_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x69')]+(_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x57')]?'\x20'+_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x57')]:''),'body':_0x505a97[_0x2fd6('0x33')],'direction':_0x505a97[_0x2fd6('0x58')]===_0x2fd6('0x68')?'A':'C','secret':_0x505a97[_0x2fd6('0x59')],'read':_0x505a97[_0x2fd6('0x5a')]};})[_0x2fd6('0x6a')]()};return ejs[_0x2fd6('0x6b')](path[_0x2fd6('0x4d')](config[_0x2fd6('0x4e')],_0x2fd6('0x4f'),'views','downloadInteraction.ejs'),{'interaction':_0x2ff9bd})[_0x2fd6('0x19')](function(_0x3fe9c2){var _0x5bf1b2=path['join'](_0x481d6a,'transcript-'+_0x1bd283['id']+'-'+_0x57cdde+_0x2fd6('0x6c'));var _0x24c10c={'path':_0x5bf1b2,'channel':_0x2fd6('0x60'),'interactionId':_0x1bd283['id']};return pdf[_0x2fd6('0x6d')](_0x3fe9c2,_0x24c10c);})[_0x2fd6('0x19')](function(){return new BPromise(function(_0x17698b,_0xdeb5a0){zipdir(_0x481d6a,{'saveTo':_0xee0b42},function(_0x1ec33a,_0x1d9337){if(_0x1ec33a)return _0xdeb5a0(_0x1ec33a);return _0x17698b(_0x1d9337);});})[_0x2fd6('0x19')](function(){return new BPromise(function(_0x42c9bd,_0x473863){rimraf(_0x481d6a,function(_0x3b94b2){if(_0x3b94b2)_0x473863(_0x3b94b2);return _0x42c9bd();});});})[_0x2fd6('0x19')](function(){return _0xfa1ac4[_0x2fd6('0x4a')](_0xee0b42,_0x459460,function(_0x51e194){if(_0x51e194){console[_0x2fd6('0x6e')](_0x2fd6('0x6f'),_0x51e194);}else{fs[_0x2fd6('0x70')](_0xee0b42);}});});});}else{return _0xfa1ac4[_0x2fd6('0xf')](0xc8);}})[_0x2fd6('0x24')](handleError(_0xfa1ac4,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1e41208..e08bccb 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 _0x5eb8=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x182292,_0x14f0ef){var _0xdd798d=function(_0x4f08e2){while(--_0x4f08e2){_0x182292['push'](_0x182292['shift']());}};_0xdd798d(++_0x14f0ef);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x5eb8[_0x3f70cd];return _0x3feb93;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x85eb('0x0')];var SmsMessage=require(_0x85eb('0x1'))['db'][_0x85eb('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x85eb('0x3')](0x0);var events={'afterCreate':_0x85eb('0x4'),'afterUpdate':_0x85eb('0x5'),'afterDestroy':_0x85eb('0x6')};function emitEvent(_0x44e313){return function(_0x3c5798,_0x1fde1a,_0x2bf83c){_0x3c5798[_0x85eb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16d7b9){_0x3c5798[_0x85eb('0x8')](_0x85eb('0x9'),_0x16d7b9['map'](function(_0x2da3b0){return{'id':_0x2da3b0['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3c5798['id'],'direction':'in','read':![]},'raw':!![]});})[_0x85eb('0xa')](function(_0x40d6b6){_0x3c5798[_0x85eb('0x8')](_0x85eb('0xb'),_0x40d6b6[_0x85eb('0xc')]);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313+':'+_0x3c5798['id'],_0x3c5798);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313,_0x3c5798);_0x2bf83c(null);})['catch'](_0x2bf83c(null));};}for(var e in events){if(events[_0x85eb('0xe')](e)){var event=events[e];SmsInteraction[_0x85eb('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x28f2=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28f2,0x193));var _0x228f=function(_0xb2c144,_0x193d3c){_0xb2c144=_0xb2c144-0x0;var _0x49b81d=_0x28f2[_0xb2c144];return _0x49b81d;};'use strict';var EventEmitter=require(_0x228f('0x0'));var SmsInteraction=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var SmsMessage=require(_0x228f('0x1'))['db'][_0x228f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':_0x228f('0x5'),'afterDestroy':_0x228f('0x6')};function emitEvent(_0x4303c3){return function(_0x2bb7d7,_0x3439f5,_0x32c5c3){_0x2bb7d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x228f('0x7')](function(_0x4a4a44){_0x2bb7d7[_0x228f('0x8')](_0x228f('0x9'),_0x4a4a44[_0x228f('0xa')](function(_0x5f406c){return{'id':_0x5f406c['id']};}));return SmsMessage[_0x228f('0xb')]({'where':{'SmsInteractionId':_0x2bb7d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x212c90){_0x2bb7d7[_0x228f('0x8')]('unreadMessages',_0x212c90[_0x228f('0xc')]);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3+':'+_0x2bb7d7['id'],_0x2bb7d7);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3,_0x2bb7d7);_0x32c5c3(null);})[_0x228f('0xe')](_0x32c5c3(null));};}for(var e in events){if(events[_0x228f('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x228f('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 1178437..69f56e4 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 _0x08a5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3f3eda,_0x3885f0){var _0xd4278e=function(_0xdebb9e){while(--_0xdebb9e){_0x3f3eda['push'](_0x3f3eda['shift']());}};_0xd4278e(++_0x3885f0);}(_0x08a5,0x18c));var _0x508a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x508a('0x0'));var util=require(_0x508a('0x1'));var logger=require(_0x508a('0x2'))(_0x508a('0x3'));var moment=require(_0x508a('0x4'));var BPromise=require(_0x508a('0x5'));var rp=require(_0x508a('0x6'));var fs=require('fs');var path=require(_0x508a('0x7'));var rimraf=require(_0x508a('0x8'));var config=require(_0x508a('0x9'));var attributes=require(_0x508a('0xa'));module['exports']=function(_0x54a145,_0x164dda){return _0x54a145[_0x508a('0xb')](_0x508a('0xc'),attributes,{'tableName':_0x508a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5840e9,_0x19fe22,_0x5e374e){if(_0x5840e9[_0x508a('0xe')](_0x508a('0xf'))){_0x5840e9[_0x508a('0x10')]=moment()[_0x508a('0x11')](_0x508a('0x12'));}_0x5e374e(null,_0x5840e9);}}});}; \ No newline at end of file +var _0xb438=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb438,0x1b8));var _0x8b43=function(_0x130745,_0x194bd8){_0x130745=_0x130745-0x0;var _0x189c0d=_0xb438[_0x130745];return _0x189c0d;};'use strict';var _=require(_0x8b43('0x0'));var util=require(_0x8b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b43('0x2'));var BPromise=require(_0x8b43('0x3'));var rp=require(_0x8b43('0x4'));var fs=require('fs');var path=require(_0x8b43('0x5'));var rimraf=require(_0x8b43('0x6'));var config=require(_0x8b43('0x7'));var attributes=require(_0x8b43('0x8'));module['exports']=function(_0x2b5fc5,_0x968f5b){return _0x2b5fc5[_0x8b43('0x9')](_0x8b43('0xa'),attributes,{'tableName':_0x8b43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a1e20,_0x51226c,_0x2831f2){if(_0x2a1e20[_0x8b43('0xc')](_0x8b43('0xd'))){_0x2a1e20[_0x8b43('0xe')]=moment()[_0x8b43('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2831f2(null,_0x2a1e20);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 178351b..0306d0b 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 _0x4709=['stringify','error','code','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','socket.io-emitter','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4709,0x13c));var _0x9470=function(_0x2a24bc,_0x3a167d){_0x2a24bc=_0x2a24bc-0x0;var _0x429e50=_0x4709[_0x2a24bc];return _0x429e50;};'use strict';var _=require(_0x9470('0x0'));var util=require('util');var moment=require(_0x9470('0x1'));var BPromise=require(_0x9470('0x2'));var rs=require(_0x9470('0x3'));var fs=require('fs');var Redis=require(_0x9470('0x4'));var db=require(_0x9470('0x5'))['db'];var utils=require(_0x9470('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9470('0x7'));var client=jayson['client'][_0x9470('0x8')]({'port':0x232a});config[_0x9470('0x9')]=_['defaults'](config[_0x9470('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9470('0xa'))(new Redis(config[_0x9470('0x9')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1e8080,_0x8f14a3,_0x1495d9){return new BPromise(function(_0x31a67a,_0x354636){return client[_0x9470('0xb')](_0x1e8080,_0x1495d9)['then'](function(_0x203305){logger[_0x9470('0xc')](_0x9470('0xd'),_0x8f14a3,_0x9470('0xe'));logger[_0x9470('0xf')](_0x9470('0x10'),_0x8f14a3,_0x9470('0xe'),JSON[_0x9470('0x11')](_0x203305));if(_0x203305['error']){if(_0x203305[_0x9470('0x12')][_0x9470('0x13')]===0x1f4){logger[_0x9470('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x8f14a3,_0x203305[_0x9470('0x12')][_0x9470('0x14')]);return _0x354636(_0x203305[_0x9470('0x12')]['message']);}logger['error'](_0x9470('0xd'),_0x8f14a3,_0x203305[_0x9470('0x12')][_0x9470('0x14')]);return _0x31a67a(_0x203305[_0x9470('0x12')][_0x9470('0x14')]);}else{logger['info'](_0x9470('0xd'),_0x8f14a3,'request\x20sent');_0x31a67a(_0x203305['result']['message']);}})[_0x9470('0x15')](function(_0x158637){logger[_0x9470('0x12')](_0x9470('0xd'),_0x8f14a3,_0x158637);_0x354636(_0x158637);});});}exports['UpdateSmsInteraction']=function(_0x2d371d){var _0x2c3ce2=this;return new Promise(function(_0x1bb35a,_0x584fd8){return db[_0x9470('0x16')][_0x9470('0x17')](_0x2d371d[_0x9470('0x18')],{'raw':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d371d['options']?_0x2d371d[_0x9470('0x19')][_0x9470('0x1b')]||null:null,'attributes':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1c')]||null:null,'limit':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1d')]||null:null})[_0x9470('0x1e')](function(_0x34d52e){logger[_0x9470('0xc')]('UpdateSmsInteraction',_0x2d371d);logger[_0x9470('0xf')]('UpdateSmsInteraction',_0x2d371d,JSON[_0x9470('0x11')](_0x34d52e));_0x1bb35a(_0x34d52e);})[_0x9470('0x15')](function(_0x300585){logger[_0x9470('0x12')](_0x9470('0x1f'),_0x300585[_0x9470('0x14')],_0x2d371d);_0x584fd8(_0x2c3ce2[_0x9470('0x12')](0x1f4,_0x300585[_0x9470('0x14')]));});});};exports[_0x9470('0x20')]=function(_0x5a821c){return new Promise(function(_0xe89481,_0x3501d3){return db[_0x9470('0x16')][_0x9470('0x21')]({'where':_0x5a821c[_0x9470('0x19')]?_0x5a821c['options']['where']||null:null})[_0x9470('0x1e')](function(_0x29d390){if(_0x29d390){return _0x29d390['addTags'](_0x5a821c['body']['ids'],_['omit'](_0x5a821c[_0x9470('0x18')],[_0x9470('0x22'),'id'])||{});}})[_0x9470('0x23')](function(_0x3acc28){logger[_0x9470('0xc')](_0x9470('0x24'),_0x5a821c);logger[_0x9470('0xf')](_0x9470('0x24'),_0x5a821c,JSON['stringify'](_0x3acc28));_0xe89481(_0x3acc28);})[_0x9470('0x15')](function(_0xc36ad){logger[_0x9470('0x12')](_0x9470('0x24'),_0xc36ad['message'],_0x5a821c);_0x3501d3(_this[_0x9470('0x12')](0x1f4,_0xc36ad[_0x9470('0x14')]));});});}; \ No newline at end of file +var _0x1cab=['info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsInteraction','update','body','options','attributes','limit','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','where','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','then'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x1cab,0xb5));var _0xb1ca=function(_0x351bc2,_0x4704c4){_0x351bc2=_0x351bc2-0x0;var _0x25dfcc=_0x1cab[_0x351bc2];return _0x25dfcc;};'use strict';var _=require('lodash');var util=require(_0xb1ca('0x0'));var moment=require(_0xb1ca('0x1'));var BPromise=require(_0xb1ca('0x2'));var rs=require(_0xb1ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1ca('0x4'));var logger=require(_0xb1ca('0x5'))(_0xb1ca('0x6'));var config=require(_0xb1ca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1ca('0x8')]({'port':0x232a});config[_0xb1ca('0x9')]=_[_0xb1ca('0xa')](config['redis'],{'host':_0xb1ca('0xb'),'port':0x18eb});var socket=require(_0xb1ca('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x170b98,_0x32694e,_0x5bfa7c){return new BPromise(function(_0x2f3fb7,_0xe150d4){return client['request'](_0x170b98,_0x5bfa7c)[_0xb1ca('0xd')](function(_0x388f01){logger[_0xb1ca('0xe')](_0xb1ca('0xf'),_0x32694e,'request\x20sent');logger['debug'](_0xb1ca('0x10'),_0x32694e,_0xb1ca('0x11'),JSON[_0xb1ca('0x12')](_0x388f01));if(_0x388f01[_0xb1ca('0x13')]){if(_0x388f01['error'][_0xb1ca('0x14')]===0x1f4){logger[_0xb1ca('0x13')](_0xb1ca('0xf'),_0x32694e,_0x388f01[_0xb1ca('0x13')][_0xb1ca('0x15')]);return _0xe150d4(_0x388f01['error'][_0xb1ca('0x15')]);}logger['error'](_0xb1ca('0xf'),_0x32694e,_0x388f01[_0xb1ca('0x13')]['message']);return _0x2f3fb7(_0x388f01['error'][_0xb1ca('0x15')]);}else{logger[_0xb1ca('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x32694e,'request\x20sent');_0x2f3fb7(_0x388f01[_0xb1ca('0x16')][_0xb1ca('0x15')]);}})[_0xb1ca('0x17')](function(_0x6dc3dd){logger[_0xb1ca('0x13')](_0xb1ca('0xf'),_0x32694e,_0x6dc3dd);_0xe150d4(_0x6dc3dd);});});}exports['UpdateSmsInteraction']=function(_0x4c5f9a){var _0x550cb3=this;return new Promise(function(_0x176bd5,_0xc4d01e){return db[_0xb1ca('0x18')][_0xb1ca('0x19')](_0x4c5f9a[_0xb1ca('0x1a')],{'raw':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')]['where']||null:null,'attributes':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')][_0xb1ca('0x1c')]||null:null,'limit':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')][_0xb1ca('0x1d')]||null:null})['then'](function(_0x379500){logger[_0xb1ca('0xe')](_0xb1ca('0x1e'),_0x4c5f9a);logger[_0xb1ca('0x1f')]('UpdateSmsInteraction',_0x4c5f9a,JSON['stringify'](_0x379500));_0x176bd5(_0x379500);})[_0xb1ca('0x17')](function(_0x130854){logger[_0xb1ca('0x13')]('UpdateSmsInteraction',_0x130854[_0xb1ca('0x15')],_0x4c5f9a);_0xc4d01e(_0x550cb3[_0xb1ca('0x13')](0x1f4,_0x130854[_0xb1ca('0x15')]));});});};exports[_0xb1ca('0x20')]=function(_0x327580){return new Promise(function(_0x2aa364,_0x151f05){return db['SmsInteraction'][_0xb1ca('0x21')]({'where':_0x327580[_0xb1ca('0x1b')]?_0x327580[_0xb1ca('0x1b')][_0xb1ca('0x22')]||null:null})[_0xb1ca('0xd')](function(_0x47d6f7){if(_0x47d6f7){return _0x47d6f7[_0xb1ca('0x23')](_0x327580[_0xb1ca('0x1a')]['ids'],_['omit'](_0x327580[_0xb1ca('0x1a')],[_0xb1ca('0x24'),'id'])||{});}})[_0xb1ca('0x25')](function(_0x8fe94){logger[_0xb1ca('0xe')](_0xb1ca('0x26'),_0x327580);logger['debug'](_0xb1ca('0x26'),_0x327580,JSON[_0xb1ca('0x12')](_0x8fe94));_0x2aa364(_0x8fe94);})['catch'](function(_0x4c262b){logger[_0xb1ca('0x13')]('AddTags',_0x4c262b[_0xb1ca('0x15')],_0x327580);_0x151f05(_this['error'](0x1f4,_0x4c262b[_0xb1ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 62d9096..6012833 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 _0xc5b6=['emit','removeListener','./smsInteraction.events','save','remove'];(function(_0x54fe4e,_0x153ebc){var _0x21ceae=function(_0x2d907b){while(--_0x2d907b){_0x54fe4e['push'](_0x54fe4e['shift']());}};_0x21ceae(++_0x153ebc);}(_0xc5b6,0x192));var _0x6c5b=function(_0x204d83,_0x4cd7ac){_0x204d83=_0x204d83-0x0;var _0x20a662=_0xc5b6[_0x204d83];return _0x20a662;};'use strict';var SmsInteractionEvents=require(_0x6c5b('0x0'));var events=[_0x6c5b('0x1'),_0x6c5b('0x2'),'update'];function createListener(_0x48ebe9,_0x83a4dd){return function(_0x417bc3){_0x83a4dd[_0x6c5b('0x3')](_0x48ebe9,_0x417bc3);};}function removeListener(_0x689296,_0x3f033d){return function(){SmsInteractionEvents[_0x6c5b('0x4')](_0x689296,_0x3f033d);};}exports['register']=function(_0x5c841f){for(var _0x49e926=0x0,_0x586800=events['length'];_0x49e926<_0x586800;_0x49e926++){var _0x304157=events[_0x49e926];var _0x547bc8=createListener('smsInteraction:'+_0x304157,_0x5c841f);SmsInteractionEvents['on'](_0x304157,_0x547bc8);}}; \ No newline at end of file +var _0xe408=['remove','update','emit','register','length','smsInteraction:'];(function(_0x20b50f,_0xc24bfb){var _0x3173ff=function(_0x3f17c1){while(--_0x3f17c1){_0x20b50f['push'](_0x20b50f['shift']());}};_0x3173ff(++_0xc24bfb);}(_0xe408,0xa8));var _0x8e40=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xe408[_0x24f31b];return _0x488401;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x8e40('0x0'),_0x8e40('0x1')];function createListener(_0x1c06dc,_0x1afec4){return function(_0x54d83e){_0x1afec4[_0x8e40('0x2')](_0x1c06dc,_0x54d83e);};}function removeListener(_0x6bbac3,_0x7dd03c){return function(){SmsInteractionEvents['removeListener'](_0x6bbac3,_0x7dd03c);};}exports[_0x8e40('0x3')]=function(_0x416101){for(var _0x44d88d=0x0,_0x29922e=events[_0x8e40('0x4')];_0x44d88d<_0x29922e;_0x44d88d++){var _0xcac02a=events[_0x44d88d];var _0x1fe4a7=createListener(_0x8e40('0x5')+_0xcac02a,_0x416101);SmsInteractionEvents['on'](_0xcac02a,_0x1fe4a7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 12a00f9..5e04980 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 _0x5ed0=['status','put','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','create','/:id/status'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x5ed0,0xcb));var _0x05ed=function(_0x277ad0,_0x35306c){_0x277ad0=_0x277ad0-0x0;var _0x3d1b66=_0x5ed0[_0x277ad0];return _0x3d1b66;};'use strict';var multer=require('multer');var util=require(_0x05ed('0x0'));var path=require(_0x05ed('0x1'));var timeout=require(_0x05ed('0x2'));var express=require(_0x05ed('0x3'));var router=express[_0x05ed('0x4')]();var fs_extra=require(_0x05ed('0x5'));var auth=require(_0x05ed('0x6'));var interaction=require(_0x05ed('0x7'));var config=require('../../config/environment');var controller=require(_0x05ed('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x05ed('0x9')]);router[_0x05ed('0xa')](_0x05ed('0xb'),auth[_0x05ed('0xc')](),controller[_0x05ed('0xd')]);router['get'](_0x05ed('0xe'),auth['isAuthenticated'](),controller[_0x05ed('0xf')]);router[_0x05ed('0x10')]('/',auth['isAuthenticated'](),interaction[_0x05ed('0x11')](_0x05ed('0x12'),'smsmessage:create'),controller[_0x05ed('0x13')]);router[_0x05ed('0x10')](_0x05ed('0x14'),controller[_0x05ed('0x15')]);router[_0x05ed('0x16')](_0x05ed('0xe'),auth[_0x05ed('0xc')](),controller['update']);router['put']('/:id/accept',auth[_0x05ed('0xc')](),controller[_0x05ed('0x17')]);router[_0x05ed('0x16')]('/:id/reject',auth[_0x05ed('0xc')](),controller[_0x05ed('0x18')]);router[_0x05ed('0x19')](_0x05ed('0xe'),auth['isAuthenticated'](),controller[_0x05ed('0x1a')]);module[_0x05ed('0x1b')]=router; \ No newline at end of file +var _0x1b55=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','reject','delete','destroy','multer'];(function(_0x153e24,_0x321156){var _0x37f353=function(_0x40c5cc){while(--_0x40c5cc){_0x153e24['push'](_0x153e24['shift']());}};_0x37f353(++_0x321156);}(_0x1b55,0x1ca));var _0x51b5=function(_0x570b67,_0x5d27d3){_0x570b67=_0x570b67-0x0;var _0x2bb6ce=_0x1b55[_0x570b67];return _0x2bb6ce;};'use strict';var multer=require(_0x51b5('0x0'));var util=require(_0x51b5('0x1'));var path=require(_0x51b5('0x2'));var timeout=require(_0x51b5('0x3'));var express=require('express');var router=express[_0x51b5('0x4')]();var fs_extra=require(_0x51b5('0x5'));var auth=require(_0x51b5('0x6'));var interaction=require(_0x51b5('0x7'));var config=require('../../config/environment');var controller=require(_0x51b5('0x8'));router[_0x51b5('0x9')]('/',auth[_0x51b5('0xa')](),controller[_0x51b5('0xb')]);router['get'](_0x51b5('0xc'),auth[_0x51b5('0xa')](),controller['describe']);router[_0x51b5('0x9')](_0x51b5('0xd'),auth[_0x51b5('0xa')](),controller[_0x51b5('0xe')]);router[_0x51b5('0xf')]('/',auth[_0x51b5('0xa')](),interaction[_0x51b5('0x10')](_0x51b5('0x11'),_0x51b5('0x12')),controller[_0x51b5('0x13')]);router[_0x51b5('0xf')](_0x51b5('0x14'),controller['status']);router[_0x51b5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x51b5('0x16')]);router[_0x51b5('0x15')](_0x51b5('0x17'),auth[_0x51b5('0xa')](),controller['accept']);router[_0x51b5('0x15')]('/:id/reject',auth[_0x51b5('0xa')](),controller[_0x51b5('0x18')]);router[_0x51b5('0x19')](_0x51b5('0xd'),auth[_0x51b5('0xa')](),controller[_0x51b5('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 53feb02..030df3a 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 _0xde0f=['DATE','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xde0f,0xa2));var _0xfde0=function(_0x41a20f,_0x42086b){_0x41a20f=_0x41a20f-0x0;var _0x334c0c=_0xde0f[_0x41a20f];return _0x334c0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xfde0('0x0')](_0xfde0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfde0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfde0('0x3')]('in',_0xfde0('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfde0('0x5')](0xbe)},'phone':{'type':Sequelize[_0xfde0('0x5')]},'readAt':{'type':Sequelize[_0xfde0('0x6')]},'secret':{'type':Sequelize[_0xfde0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfde0('0x5')]},'providerResponse':{'type':Sequelize[_0xfde0('0x0')]}}; \ No newline at end of file +var _0xe7a5=['medium','ENUM','STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5b0074,_0xd87207){var _0x5776f6=function(_0x1d69f5){while(--_0x1d69f5){_0x5b0074['push'](_0x5b0074['shift']());}};_0x5776f6(++_0xd87207);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xe7a5[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x5e7a('0x0'));module[_0x5e7a('0x1')]={'body':{'type':Sequelize[_0x5e7a('0x2')](_0x5e7a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5e7a('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5e7a('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5e7a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5e7a('0x5')]},'providerResponse':{'type':Sequelize[_0x5e7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 8b138c5..2304499 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 _0xc7b8=['create','body','find','describe','accept','acceptMessage','reject','sms','UserId','user','SmsInteraction','SmsInteractionId','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','format','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','infobip','results','groupName','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','undefined','count','offset','Content-Range','update','destroy','end','name','send','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','params','includeAll','merge'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc7b8,0x119));var _0x8c7b=function(_0x215994,_0x55825c){_0x215994=_0x215994-0x0;var _0x249ed7=_0xc7b8[_0x215994];return _0x249ed7;};'use strict';var util=require(_0x8c7b('0x0'));var _=require(_0x8c7b('0x1'));var Redis=require('ioredis');var interactionService=require(_0x8c7b('0x2'));var qs=require(_0x8c7b('0x3'));var logger=require(_0x8c7b('0x4'))(_0x8c7b('0x5'));var config=require(_0x8c7b('0x6'));var db=require(_0x8c7b('0x7'))['db'];config['redis']=_[_0x8c7b('0x8')](config[_0x8c7b('0x9')],{'host':_0x8c7b('0xa'),'port':0x18eb});var socket=require(_0x8c7b('0xb'))(new Redis(config[_0x8c7b('0x9')]));require(_0x8c7b('0xc'))[_0x8c7b('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8c7b('0xe')][_0x8c7b('0xf')]({'port':0x232c});var client9002=jayson['client'][_0x8c7b('0xf')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x551b3f,_0x3f3fb6,_0x59424a,_0x33e618){return new Promise(function(_0x41a96c,_0x38fd55){var _0x4e3716=_0x33e618||client;return _0x4e3716['request'](_0x551b3f,_0x59424a)[_0x8c7b('0x10')](function(_0x32a153){logger[_0x8c7b('0x11')](_0x8c7b('0x12'),_0x3f3fb6,_0x8c7b('0x13'));logger['debug'](_0x8c7b('0x14'),_0x3f3fb6,_0x8c7b('0x13'),JSON[_0x8c7b('0x15')](_0x32a153));if(_0x32a153[_0x8c7b('0x16')]){if(_0x32a153[_0x8c7b('0x16')]['code']===0x1f4){logger[_0x8c7b('0x16')](_0x8c7b('0x12'),_0x3f3fb6,_0x32a153[_0x8c7b('0x16')][_0x8c7b('0x17')]);return _0x38fd55(_0x32a153[_0x8c7b('0x16')]['message']);}logger[_0x8c7b('0x16')](_0x8c7b('0x12'),_0x3f3fb6,_0x32a153['error']['message']);return _0x41a96c(_0x32a153[_0x8c7b('0x16')][_0x8c7b('0x17')]);}else{logger[_0x8c7b('0x11')](_0x8c7b('0x12'),_0x3f3fb6,_0x8c7b('0x13'));_0x41a96c(_0x32a153['result'][_0x8c7b('0x17')]);}})[_0x8c7b('0x18')](function(_0x3eb1e1){logger['error'](_0x8c7b('0x12'),_0x3f3fb6,_0x3eb1e1);_0x38fd55(_0x3eb1e1);});});}function respondWithResult(_0x2bf9e2,_0x404db9){_0x404db9=_0x404db9||0xc8;return function(_0x11d8a5){if(_0x11d8a5){return _0x2bf9e2[_0x8c7b('0x19')](_0x404db9)[_0x8c7b('0x1a')](_0x11d8a5);}};}function respondWithFilteredResult(_0x5859c3,_0x1ff17a){return function(_0x5e95c2){if(_0x5e95c2){var _0x29b571=typeof _0x1ff17a['offset']===_0x8c7b('0x1b')&&typeof _0x1ff17a['limit']===_0x8c7b('0x1b');var _0x21dad6=_0x5e95c2[_0x8c7b('0x1c')];var _0x3bafb2=_0x29b571?0x0:_0x1ff17a[_0x8c7b('0x1d')];var _0x25e28a=_0x29b571?_0x5e95c2['count']:_0x1ff17a[_0x8c7b('0x1d')]+_0x1ff17a['limit'];var _0x5ebcaf;if(_0x25e28a>=_0x21dad6){_0x25e28a=_0x21dad6;_0x5ebcaf=0xc8;}else{_0x5ebcaf=0xce;}_0x5859c3[_0x8c7b('0x19')](_0x5ebcaf);return _0x5859c3['set'](_0x8c7b('0x1e'),_0x3bafb2+'-'+_0x25e28a+'/'+_0x21dad6)[_0x8c7b('0x1a')](_0x5e95c2);}return null;};}function saveUpdates(_0x5cdfab){return function(_0x34b019){if(_0x34b019){return _0x34b019[_0x8c7b('0x1f')](_0x5cdfab)[_0x8c7b('0x10')](function(_0x4b76b2){return _0x4b76b2;});}return null;};}function removeEntity(_0x54a8a8){return function(_0x5935ed){if(_0x5935ed){return _0x5935ed[_0x8c7b('0x20')]()[_0x8c7b('0x10')](function(){_0x54a8a8['status'](0xcc)[_0x8c7b('0x21')]();});}};}function handleEntityNotFound(_0x11c286){return function(_0x510beb){if(!_0x510beb){_0x11c286['sendStatus'](0x194);}return _0x510beb;};}function handleError(_0x3ea981,_0xed7447){_0xed7447=_0xed7447||0x1f4;return function(_0x26da68){logger[_0x8c7b('0x16')](_0x26da68['stack']);if(_0x26da68[_0x8c7b('0x22')]){delete _0x26da68[_0x8c7b('0x22')];}_0x3ea981[_0x8c7b('0x19')](_0xed7447)[_0x8c7b('0x23')](_0x26da68);};}exports['index']=function(_0x1be946,_0x8eb29d){var _0x435412={},_0x9f40d3={},_0x793f94={'count':0x0,'rows':[]};var _0x5ac23e=_[_0x8c7b('0x24')](db[_0x8c7b('0x25')][_0x8c7b('0x26')],function(_0x2d0c75){return{'name':_0x2d0c75['fieldName'],'type':_0x2d0c75[_0x8c7b('0x27')][_0x8c7b('0x28')]};});_0x9f40d3[_0x8c7b('0x29')]=_['map'](_0x5ac23e,'name');_0x9f40d3[_0x8c7b('0x2a')]=_[_0x8c7b('0x2b')](_0x1be946[_0x8c7b('0x2a')]);_0x9f40d3[_0x8c7b('0x2c')]=_[_0x8c7b('0x2d')](_0x9f40d3['model'],_0x9f40d3['query']);_0x435412[_0x8c7b('0x2e')]=_[_0x8c7b('0x2d')](_0x9f40d3[_0x8c7b('0x29')],qs['fields'](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x2f')]));_0x435412[_0x8c7b('0x2e')]=_0x435412[_0x8c7b('0x2e')][_0x8c7b('0x30')]?_0x435412[_0x8c7b('0x2e')]:_0x9f40d3[_0x8c7b('0x29')];if(!_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x31')](_0x8c7b('0x32'))){_0x435412['limit']=qs[_0x8c7b('0x33')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x33')]);_0x435412[_0x8c7b('0x1d')]=qs[_0x8c7b('0x1d')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x1d')]);}_0x435412[_0x8c7b('0x34')]=qs[_0x8c7b('0x35')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x35')]);_0x435412[_0x8c7b('0x36')]=qs[_0x8c7b('0x2c')](_[_0x8c7b('0x37')](_0x1be946[_0x8c7b('0x2a')],_0x9f40d3[_0x8c7b('0x2c')]),_0x5ac23e);if(_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x38')]){_0x435412[_0x8c7b('0x36')]=_['merge'](_0x435412[_0x8c7b('0x36')],{'$or':_[_0x8c7b('0x24')](_0x5ac23e,function(_0x1e7ffa){if(_0x1e7ffa[_0x8c7b('0x27')]!==_0x8c7b('0x39')){var _0x489bd0={};_0x489bd0[_0x1e7ffa[_0x8c7b('0x22')]]={'$like':'%'+_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x38')]+'%'};return _0x489bd0;}})});}_0x435412=_['merge']({},_0x435412,_0x1be946[_0x8c7b('0x3a')]);var _0x383740={'where':_0x435412[_0x8c7b('0x36')]};return db[_0x8c7b('0x25')][_0x8c7b('0x1c')](_0x383740)[_0x8c7b('0x10')](function(_0x29f1b7){_0x793f94['count']=_0x29f1b7;if(_0x1be946[_0x8c7b('0x2a')]['includeAll']){_0x435412[_0x8c7b('0x3b')]=[{'all':!![]}];}return db[_0x8c7b('0x25')]['findAll'](_0x435412);})[_0x8c7b('0x10')](function(_0x14fa55){_0x793f94[_0x8c7b('0x3c')]=_0x14fa55;return _0x793f94;})['then'](respondWithFilteredResult(_0x8eb29d,_0x435412))[_0x8c7b('0x18')](handleError(_0x8eb29d,null));};exports['show']=function(_0x216e22,_0x10a526){var _0xdee425={'raw':!![],'where':{'id':_0x216e22[_0x8c7b('0x3d')]['id']}},_0xe7cd37={};_0xe7cd37[_0x8c7b('0x29')]=_[_0x8c7b('0x2b')](db[_0x8c7b('0x25')][_0x8c7b('0x26')]);_0xe7cd37['query']=_['keys'](_0x216e22[_0x8c7b('0x2a')]);_0xe7cd37[_0x8c7b('0x2c')]=_['intersection'](_0xe7cd37[_0x8c7b('0x29')],_0xe7cd37[_0x8c7b('0x2a')]);_0xdee425[_0x8c7b('0x2e')]=_['intersection'](_0xe7cd37[_0x8c7b('0x29')],qs[_0x8c7b('0x2f')](_0x216e22[_0x8c7b('0x2a')]['fields']));_0xdee425[_0x8c7b('0x2e')]=_0xdee425[_0x8c7b('0x2e')]['length']?_0xdee425[_0x8c7b('0x2e')]:_0xe7cd37[_0x8c7b('0x29')];if(_0x216e22[_0x8c7b('0x2a')][_0x8c7b('0x3e')]){_0xdee425[_0x8c7b('0x3b')]=[{'all':!![]}];}_0xdee425=_[_0x8c7b('0x3f')]({},_0xdee425,_0x216e22[_0x8c7b('0x3a')]);return db[_0x8c7b('0x25')]['find'](_0xdee425)[_0x8c7b('0x10')](handleEntityNotFound(_0x10a526,null))['then'](respondWithResult(_0x10a526,null))[_0x8c7b('0x18')](handleError(_0x10a526,null));};exports[_0x8c7b('0x40')]=function(_0x395843,_0x163450){return db['SmsMessage'][_0x8c7b('0x40')](_0x395843[_0x8c7b('0x41')],{})[_0x8c7b('0x10')](respondWithResult(_0x163450,0xc9))[_0x8c7b('0x18')](handleError(_0x163450,null));};exports['update']=function(_0x4147a1,_0x3ed8b6){if(_0x4147a1[_0x8c7b('0x41')]['id']){delete _0x4147a1[_0x8c7b('0x41')]['id'];}return db['SmsMessage'][_0x8c7b('0x42')]({'where':{'id':_0x4147a1[_0x8c7b('0x3d')]['id']}})[_0x8c7b('0x10')](handleEntityNotFound(_0x3ed8b6,null))[_0x8c7b('0x10')](saveUpdates(_0x4147a1[_0x8c7b('0x41')],null))[_0x8c7b('0x10')](respondWithResult(_0x3ed8b6,null))[_0x8c7b('0x18')](handleError(_0x3ed8b6,null));};exports['destroy']=function(_0x5e52cf,_0x544122){return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x5e52cf['params']['id']}})['then'](handleEntityNotFound(_0x544122,null))['then'](removeEntity(_0x544122,null))['catch'](handleError(_0x544122,null));};exports[_0x8c7b('0x43')]=function(_0x3e3ee6,_0x4c29b6){return db[_0x8c7b('0x25')][_0x8c7b('0x43')]()['then'](respondWithResult(_0x4c29b6,null))[_0x8c7b('0x18')](handleError(_0x4c29b6,null));};exports[_0x8c7b('0x44')]=function(_0x3083b7,_0x451915){var _0x5156a1='sms';return interactionService[_0x8c7b('0x45')](_0x3083b7,_0x5156a1)[_0x8c7b('0x10')](respondWithResult(_0x451915,null))[_0x8c7b('0x18')](handleError(_0x451915,null));};exports[_0x8c7b('0x46')]=function(_0x1c520c,_0x1a5eb8){var _0x46ed8f={'agent':{},'channel':_0x8c7b('0x47')};if(_0x1c520c[_0x8c7b('0x41')]['id']){delete _0x1c520c[_0x8c7b('0x41')]['id'];}_0x1c520c['body'][_0x8c7b('0x48')]=_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')]||_0x1c520c[_0x8c7b('0x49')]['id'];_0x46ed8f['agent']['id']=_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')];return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x1c520c['params']['id'],'UserId':null}})[_0x8c7b('0x10')](handleEntityNotFound(_0x1a5eb8,null))['then'](function(_0x374793){if(_0x374793){_0x46ed8f[_0x8c7b('0x17')]=_0x374793['get']({'plain':!![]});return db[_0x8c7b('0x4a')][_0x8c7b('0x42')]({'where':{'id':_0x374793[_0x8c7b('0x4b')]}});}return null;})[_0x8c7b('0x10')](handleEntityNotFound(_0x1a5eb8,null))[_0x8c7b('0x10')](function(_0x35ba66){if(_0x35ba66){_0x46ed8f[_0x8c7b('0x4c')]=_0x35ba66[_0x8c7b('0x4d')]({'plain':!![]});interaction_log[_0x8c7b('0x11')](_0x8c7b('0x4e'),_0x1c520c[_0x8c7b('0x49')]['id'],_0x1c520c['user']['name'],_0x1c520c[_0x8c7b('0x49')][_0x8c7b('0x4f')],_0x46ed8f[_0x8c7b('0x4c')]['id'],_0x1c520c['body']?JSON['stringify'](_0x1c520c[_0x8c7b('0x41')]):_0x8c7b('0x50'));return respondWithRpcPromise('RejectMessage',_0x8c7b('0x51'),_0x46ed8f);}return null;})[_0x8c7b('0x10')](function(_0x45af38){var _0x274aae=_0x8c7b('0x52')+_0x45af38['message'][_0x8c7b('0x53')];return db[_0x8c7b('0x54')]['query'](_0x274aae,{'type':db[_0x8c7b('0x55')][_0x8c7b('0x56')][_0x8c7b('0x57')],'raw':!![]})[_0x8c7b('0x10')](function(_0x49aaad){return _0x49aaad;});})['then'](function(_0x42184c){if(_0x42184c){_0x46ed8f[_0x8c7b('0x17')][_0x8c7b('0x58')]=_0x42184c[0x0];if(!_0x1c520c['body'][_0x8c7b('0x48')])return;return db[_0x8c7b('0x59')][_0x8c7b('0x42')]({'where':{'id':_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')],'role':_0x8c7b('0x5a')},'attributes':['id','name',_0x8c7b('0x5b'),'email',_0x8c7b('0x5c')],'raw':!![]});}return null;})[_0x8c7b('0x10')](function(_0x167be2){if(!_0x167be2)return null;_0x46ed8f[_0x8c7b('0x17')][_0x8c7b('0x5a')]=_0x167be2;return _0x46ed8f;})[_0x8c7b('0x10')](function(_0x21047f){if(_0x21047f){_0x21047f[_0x8c7b('0x17')]['interface']=util[_0x8c7b('0x5d')]('SIP/%s',_0x1c520c[_0x8c7b('0x49')]['name']);_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x5e')]=_0x46ed8f[_0x8c7b('0x5e')];_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x5f')]=_0x46ed8f[_0x8c7b('0x5e')];_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x60')]=_0x8c7b('0x46');respondWithRpcPromise(_0x8c7b('0x61'),'EventManager',{'event':_0x8c7b('0x62'),'message':_0x21047f[_0x8c7b('0x17')]},client9002);return _0x46ed8f;}return null;})[_0x8c7b('0x10')](respondWithResult(_0x1a5eb8,null))[_0x8c7b('0x18')](handleError(_0x1a5eb8,null));};exports['status']=function(_0x5711ab,_0x490175){if(_0x5711ab['body']['id']){delete _0x5711ab['body']['id'];}var _0x2653c2;return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x5711ab[_0x8c7b('0x3d')]['id']}})[_0x8c7b('0x10')](handleEntityNotFound(_0x490175,null))['then'](function(_0x3fc40a){if(_0x3fc40a){_0x2653c2=_0x3fc40a;return db[_0x8c7b('0x63')][_0x8c7b('0x42')]({'where':{'id':_0x3fc40a[_0x8c7b('0x64')]}});}})[_0x8c7b('0x10')](handleEntityNotFound(_0x490175,null))[_0x8c7b('0x10')](function(_0x3ca429){if(_0x3ca429){logger[_0x8c7b('0x65')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8c7b('0x19'),_0x8c7b('0x66'),_0x3ca429[_0x8c7b('0x27')],util[_0x8c7b('0x67')](_0x5711ab[_0x8c7b('0x41')],{'showHidden':![],'depth':null}));switch(_0x3ca429[_0x8c7b('0x27')]){case _0x8c7b('0x68'):if(_0x5711ab['body'][_0x8c7b('0x69')]&&_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x69')]===_0x2653c2[_0x8c7b('0x6a')]){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger['error'](_0x8c7b('0x6b'),_0x8c7b('0x19'),_0x8c7b('0x68'),util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;case _0x8c7b('0x6c'):if(_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6d')]&&_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6d')]===_0x2653c2[_0x8c7b('0x6a')]&&_[_0x8c7b('0x6e')](['sent','delivered'],_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6f')])>=0x0){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger[_0x8c7b('0x16')](_0x8c7b('0x6b'),_0x8c7b('0x19'),'plivio',util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;case _0x8c7b('0x70'):var _0x1a8dec=_0x5711ab['body'][_0x8c7b('0x71')][0x0];if(_0x1a8dec[_0x8c7b('0x19')][_0x8c7b('0x72')]==='DELIVERED'){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger[_0x8c7b('0x16')](_0x8c7b('0x6b'),_0x8c7b('0x19'),'infobip',util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;}return _0x2653c2;}})[_0x8c7b('0x10')](respondWithResult(_0x490175,null))[_0x8c7b('0x18')](handleError(_0x490175,null));}; \ No newline at end of file +var _0x4594=['filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','sms','acceptMessage','reject','UserId','agent','SmsInteraction','SmsInteractionId','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','RejectMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./smsMessage.socket','register','client','http','sms-interactions','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','SmsMessage','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x4594,0xb3));var _0x4459=function(_0x5ec7d1,_0x17e89d){_0x5ec7d1=_0x5ec7d1-0x0;var _0x543c8d=_0x4594[_0x5ec7d1];return _0x543c8d;};'use strict';var util=require(_0x4459('0x0'));var _=require(_0x4459('0x1'));var Redis=require(_0x4459('0x2'));var interactionService=require(_0x4459('0x3'));var qs=require(_0x4459('0x4'));var logger=require(_0x4459('0x5'))(_0x4459('0x6'));var config=require(_0x4459('0x7'));var db=require(_0x4459('0x8'))['db'];config['redis']=_[_0x4459('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4459('0xa'))(new Redis(config['redis']));require(_0x4459('0xb'))[_0x4459('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4459('0xd')][_0x4459('0xe')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x4459('0xf'));function respondWithRpcPromise(_0x525a64,_0x339caa,_0x5f2f98,_0x27d30f){return new Promise(function(_0x1d0c6c,_0x111ddd){var _0x24b2aa=_0x27d30f||client;return _0x24b2aa[_0x4459('0x10')](_0x525a64,_0x5f2f98)[_0x4459('0x11')](function(_0x57c31e){logger['info'](_0x4459('0x12'),_0x339caa,_0x4459('0x13'));logger[_0x4459('0x14')](_0x4459('0x15'),_0x339caa,_0x4459('0x13'),JSON[_0x4459('0x16')](_0x57c31e));if(_0x57c31e[_0x4459('0x17')]){if(_0x57c31e[_0x4459('0x17')][_0x4459('0x18')]===0x1f4){logger[_0x4459('0x17')](_0x4459('0x12'),_0x339caa,_0x57c31e['error'][_0x4459('0x19')]);return _0x111ddd(_0x57c31e['error'][_0x4459('0x19')]);}logger[_0x4459('0x17')]('SmsMessage,\x20%s,\x20%s',_0x339caa,_0x57c31e[_0x4459('0x17')][_0x4459('0x19')]);return _0x1d0c6c(_0x57c31e[_0x4459('0x17')][_0x4459('0x19')]);}else{logger[_0x4459('0x1a')](_0x4459('0x12'),_0x339caa,_0x4459('0x13'));_0x1d0c6c(_0x57c31e['result'][_0x4459('0x19')]);}})[_0x4459('0x1b')](function(_0x5efd85){logger['error'](_0x4459('0x12'),_0x339caa,_0x5efd85);_0x111ddd(_0x5efd85);});});}function respondWithResult(_0x10bf63,_0x279873){_0x279873=_0x279873||0xc8;return function(_0x50b592){if(_0x50b592){return _0x10bf63[_0x4459('0x1c')](_0x279873)[_0x4459('0x1d')](_0x50b592);}};}function respondWithFilteredResult(_0x5c3f91,_0x3542d3){return function(_0x3ba017){if(_0x3ba017){var _0x5ba3f0=typeof _0x3542d3[_0x4459('0x1e')]===_0x4459('0x1f')&&typeof _0x3542d3[_0x4459('0x20')]==='undefined';var _0x2236e1=_0x3ba017['count'];var _0x435a8e=_0x5ba3f0?0x0:_0x3542d3[_0x4459('0x1e')];var _0x1e4da3=_0x5ba3f0?_0x3ba017[_0x4459('0x21')]:_0x3542d3['offset']+_0x3542d3[_0x4459('0x20')];var _0x132684;if(_0x1e4da3>=_0x2236e1){_0x1e4da3=_0x2236e1;_0x132684=0xc8;}else{_0x132684=0xce;}_0x5c3f91['status'](_0x132684);return _0x5c3f91['set'](_0x4459('0x22'),_0x435a8e+'-'+_0x1e4da3+'/'+_0x2236e1)[_0x4459('0x1d')](_0x3ba017);}return null;};}function saveUpdates(_0x2addb3){return function(_0x59ae2d){if(_0x59ae2d){return _0x59ae2d[_0x4459('0x23')](_0x2addb3)[_0x4459('0x11')](function(_0xa2a99e){return _0xa2a99e;});}return null;};}function removeEntity(_0x464339){return function(_0x4fdf0f){if(_0x4fdf0f){return _0x4fdf0f[_0x4459('0x24')]()[_0x4459('0x11')](function(){_0x464339[_0x4459('0x1c')](0xcc)[_0x4459('0x25')]();});}};}function handleEntityNotFound(_0x993fa1){return function(_0x38614e){if(!_0x38614e){_0x993fa1[_0x4459('0x26')](0x194);}return _0x38614e;};}function handleError(_0x4313c4,_0x931634){_0x931634=_0x931634||0x1f4;return function(_0x1bae4b){logger[_0x4459('0x17')](_0x1bae4b[_0x4459('0x27')]);if(_0x1bae4b[_0x4459('0x28')]){delete _0x1bae4b[_0x4459('0x28')];}_0x4313c4[_0x4459('0x1c')](_0x931634)[_0x4459('0x29')](_0x1bae4b);};}exports[_0x4459('0x2a')]=function(_0x580959,_0x3ca9df){var _0x673e9d={},_0x100b90={},_0x7c47d4={'count':0x0,'rows':[]};var _0x18119f=_['map'](db[_0x4459('0x2b')][_0x4459('0x2c')],function(_0x2c10f6){return{'name':_0x2c10f6['fieldName'],'type':_0x2c10f6[_0x4459('0x2d')][_0x4459('0x2e')]};});_0x100b90[_0x4459('0x2f')]=_['map'](_0x18119f,'name');_0x100b90['query']=_[_0x4459('0x30')](_0x580959['query']);_0x100b90[_0x4459('0x31')]=_[_0x4459('0x32')](_0x100b90['model'],_0x100b90[_0x4459('0x33')]);_0x673e9d[_0x4459('0x34')]=_['intersection'](_0x100b90[_0x4459('0x2f')],qs[_0x4459('0x35')](_0x580959[_0x4459('0x33')][_0x4459('0x35')]));_0x673e9d[_0x4459('0x34')]=_0x673e9d[_0x4459('0x34')][_0x4459('0x36')]?_0x673e9d['attributes']:_0x100b90[_0x4459('0x2f')];if(!_0x580959[_0x4459('0x33')][_0x4459('0x37')](_0x4459('0x38'))){_0x673e9d[_0x4459('0x20')]=qs[_0x4459('0x20')](_0x580959[_0x4459('0x33')][_0x4459('0x20')]);_0x673e9d[_0x4459('0x1e')]=qs[_0x4459('0x1e')](_0x580959[_0x4459('0x33')]['offset']);}_0x673e9d[_0x4459('0x39')]=qs[_0x4459('0x3a')](_0x580959[_0x4459('0x33')][_0x4459('0x3a')]);_0x673e9d[_0x4459('0x3b')]=qs[_0x4459('0x31')](_[_0x4459('0x3c')](_0x580959[_0x4459('0x33')],_0x100b90[_0x4459('0x31')]),_0x18119f);if(_0x580959[_0x4459('0x33')][_0x4459('0x3d')]){_0x673e9d[_0x4459('0x3b')]=_[_0x4459('0x3e')](_0x673e9d['where'],{'$or':_[_0x4459('0x3f')](_0x18119f,function(_0x3bb3a7){if(_0x3bb3a7[_0x4459('0x2d')]!==_0x4459('0x40')){var _0x296494={};_0x296494[_0x3bb3a7[_0x4459('0x28')]]={'$like':'%'+_0x580959[_0x4459('0x33')][_0x4459('0x3d')]+'%'};return _0x296494;}})});}_0x673e9d=_[_0x4459('0x3e')]({},_0x673e9d,_0x580959[_0x4459('0x41')]);var _0x48cef4={'where':_0x673e9d[_0x4459('0x3b')]};return db['SmsMessage'][_0x4459('0x21')](_0x48cef4)[_0x4459('0x11')](function(_0x23e59c){_0x7c47d4[_0x4459('0x21')]=_0x23e59c;if(_0x580959[_0x4459('0x33')][_0x4459('0x42')]){_0x673e9d[_0x4459('0x43')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x673e9d);})[_0x4459('0x11')](function(_0x28d6a5){_0x7c47d4[_0x4459('0x44')]=_0x28d6a5;return _0x7c47d4;})[_0x4459('0x11')](respondWithFilteredResult(_0x3ca9df,_0x673e9d))[_0x4459('0x1b')](handleError(_0x3ca9df,null));};exports[_0x4459('0x45')]=function(_0x1252a3,_0x21c36c){var _0x5ed3e6={'raw':!![],'where':{'id':_0x1252a3[_0x4459('0x46')]['id']}},_0x4aacb7={};_0x4aacb7[_0x4459('0x2f')]=_[_0x4459('0x30')](db[_0x4459('0x2b')][_0x4459('0x2c')]);_0x4aacb7['query']=_['keys'](_0x1252a3[_0x4459('0x33')]);_0x4aacb7[_0x4459('0x31')]=_[_0x4459('0x32')](_0x4aacb7['model'],_0x4aacb7['query']);_0x5ed3e6['attributes']=_[_0x4459('0x32')](_0x4aacb7[_0x4459('0x2f')],qs[_0x4459('0x35')](_0x1252a3['query'][_0x4459('0x35')]));_0x5ed3e6[_0x4459('0x34')]=_0x5ed3e6[_0x4459('0x34')][_0x4459('0x36')]?_0x5ed3e6[_0x4459('0x34')]:_0x4aacb7[_0x4459('0x2f')];if(_0x1252a3[_0x4459('0x33')][_0x4459('0x42')]){_0x5ed3e6['include']=[{'all':!![]}];}_0x5ed3e6=_[_0x4459('0x3e')]({},_0x5ed3e6,_0x1252a3[_0x4459('0x41')]);return db[_0x4459('0x2b')][_0x4459('0x47')](_0x5ed3e6)['then'](handleEntityNotFound(_0x21c36c,null))[_0x4459('0x11')](respondWithResult(_0x21c36c,null))[_0x4459('0x1b')](handleError(_0x21c36c,null));};exports['create']=function(_0x826acc,_0x582f60){return db['SmsMessage'][_0x4459('0x48')](_0x826acc[_0x4459('0x49')],{})[_0x4459('0x11')](respondWithResult(_0x582f60,0xc9))[_0x4459('0x1b')](handleError(_0x582f60,null));};exports[_0x4459('0x23')]=function(_0x835fc9,_0x2ba428){if(_0x835fc9['body']['id']){delete _0x835fc9[_0x4459('0x49')]['id'];}return db[_0x4459('0x2b')][_0x4459('0x47')]({'where':{'id':_0x835fc9['params']['id']}})[_0x4459('0x11')](handleEntityNotFound(_0x2ba428,null))[_0x4459('0x11')](saveUpdates(_0x835fc9['body'],null))[_0x4459('0x11')](respondWithResult(_0x2ba428,null))[_0x4459('0x1b')](handleError(_0x2ba428,null));};exports['destroy']=function(_0x37aac6,_0x4057cc){return db[_0x4459('0x2b')][_0x4459('0x47')]({'where':{'id':_0x37aac6[_0x4459('0x46')]['id']}})[_0x4459('0x11')](handleEntityNotFound(_0x4057cc,null))[_0x4459('0x11')](removeEntity(_0x4057cc,null))['catch'](handleError(_0x4057cc,null));};exports[_0x4459('0x4a')]=function(_0xa5deb0,_0x454a12){return db['SmsMessage'][_0x4459('0x4a')]()[_0x4459('0x11')](respondWithResult(_0x454a12,null))[_0x4459('0x1b')](handleError(_0x454a12,null));};exports[_0x4459('0x4b')]=function(_0x3b6430,_0x155601){var _0x48f38a=_0x4459('0x4c');return interactionService[_0x4459('0x4d')](_0x3b6430,_0x48f38a)[_0x4459('0x11')](respondWithResult(_0x155601,null))[_0x4459('0x1b')](handleError(_0x155601,null));};exports[_0x4459('0x4e')]=function(_0x46925e,_0x5785d0){var _0x2d11d2={'agent':{},'channel':_0x4459('0x4c')};if(_0x46925e[_0x4459('0x49')]['id']){delete _0x46925e[_0x4459('0x49')]['id'];}_0x46925e[_0x4459('0x49')][_0x4459('0x4f')]=_0x46925e[_0x4459('0x49')][_0x4459('0x4f')]||_0x46925e['user']['id'];_0x2d11d2[_0x4459('0x50')]['id']=_0x46925e['body'][_0x4459('0x4f')];return db[_0x4459('0x2b')]['find']({'where':{'id':_0x46925e[_0x4459('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5785d0,null))['then'](function(_0x2ffc0c){if(_0x2ffc0c){_0x2d11d2[_0x4459('0x19')]=_0x2ffc0c['get']({'plain':!![]});return db[_0x4459('0x51')][_0x4459('0x47')]({'where':{'id':_0x2ffc0c[_0x4459('0x52')]}});}return null;})['then'](handleEntityNotFound(_0x5785d0,null))[_0x4459('0x11')](function(_0xa0b670){if(_0xa0b670){_0x2d11d2['interaction']=_0xa0b670[_0x4459('0x53')]({'plain':!![]});interaction_log['info'](_0x4459('0x54'),_0x46925e[_0x4459('0x55')]['id'],_0x46925e[_0x4459('0x55')][_0x4459('0x28')],_0x46925e['user'][_0x4459('0x56')],_0x2d11d2[_0x4459('0x57')]['id'],_0x46925e[_0x4459('0x49')]?JSON[_0x4459('0x16')](_0x46925e[_0x4459('0x49')]):_0x4459('0x58'));return respondWithRpcPromise(_0x4459('0x59'),'rejectMessage',_0x2d11d2);}return null;})[_0x4459('0x11')](function(_0xf4d8b){var _0x4a2f30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xf4d8b[_0x4459('0x19')][_0x4459('0x5a')];return db['sequelize'][_0x4459('0x33')](_0x4a2f30,{'type':db[_0x4459('0x5b')][_0x4459('0x5c')]['SELECT'],'raw':!![]})['then'](function(_0x3cec03){return _0x3cec03;});})['then'](function(_0x219988){if(_0x219988){_0x2d11d2[_0x4459('0x19')][_0x4459('0x5d')]=_0x219988[0x0];if(!_0x46925e[_0x4459('0x49')][_0x4459('0x4f')])return;return db[_0x4459('0x5e')][_0x4459('0x47')]({'where':{'id':_0x46925e[_0x4459('0x49')]['UserId'],'role':'agent'},'attributes':['id',_0x4459('0x28'),_0x4459('0x5f'),_0x4459('0x60'),'internal'],'raw':!![]});}return null;})[_0x4459('0x11')](function(_0x5afe55){if(!_0x5afe55)return null;_0x2d11d2[_0x4459('0x19')][_0x4459('0x50')]=_0x5afe55;return _0x2d11d2;})[_0x4459('0x11')](function(_0x25b157){if(_0x25b157){_0x25b157[_0x4459('0x19')][_0x4459('0x61')]=util[_0x4459('0x62')](_0x4459('0x63'),_0x46925e[_0x4459('0x55')][_0x4459('0x28')]);_0x25b157['message'][_0x4459('0x64')]=_0x2d11d2['channel'];_0x25b157[_0x4459('0x19')][_0x4459('0x65')]=_0x2d11d2[_0x4459('0x64')];_0x25b157[_0x4459('0x19')][_0x4459('0x66')]=_0x4459('0x4e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4459('0x67'),'message':_0x25b157[_0x4459('0x19')]},client9002);return _0x2d11d2;}return null;})[_0x4459('0x11')](respondWithResult(_0x5785d0,null))['catch'](handleError(_0x5785d0,null));};exports[_0x4459('0x1c')]=function(_0x123a8a,_0x1e54de){if(_0x123a8a[_0x4459('0x49')]['id']){delete _0x123a8a[_0x4459('0x49')]['id'];}var _0x524d11;return db[_0x4459('0x2b')]['find']({'where':{'id':_0x123a8a['params']['id']}})['then'](handleEntityNotFound(_0x1e54de,null))[_0x4459('0x11')](function(_0x3b7fa5){if(_0x3b7fa5){_0x524d11=_0x3b7fa5;return db[_0x4459('0x68')][_0x4459('0x47')]({'where':{'id':_0x3b7fa5[_0x4459('0x69')]}});}})[_0x4459('0x11')](handleEntityNotFound(_0x1e54de,null))[_0x4459('0x11')](function(_0x2b4745){if(_0x2b4745){logger['debug'](_0x4459('0x15'),_0x4459('0x1c'),_0x4459('0x6a'),_0x2b4745[_0x4459('0x2d')],util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));switch(_0x2b4745[_0x4459('0x2d')]){case _0x4459('0x6c'):if(_0x123a8a['body'][_0x4459('0x6d')]&&_0x123a8a[_0x4459('0x49')]['MessageSid']===_0x524d11[_0x4459('0x6e')]){return _0x524d11['update']({'read':!![]});}else{logger[_0x4459('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4459('0x6c'),util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x123a8a[_0x4459('0x49')][_0x4459('0x6f')]&&_0x123a8a['body']['MessageUUID']===_0x524d11[_0x4459('0x6e')]&&_['indexOf']([_0x4459('0x70'),_0x4459('0x71')],_0x123a8a[_0x4459('0x49')][_0x4459('0x72')])>=0x0){return _0x524d11[_0x4459('0x23')]({'read':!![]});}else{logger[_0x4459('0x17')](_0x4459('0x73'),'status',_0x4459('0x74'),util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x163cc=_0x123a8a[_0x4459('0x49')][_0x4459('0x75')][0x0];if(_0x163cc[_0x4459('0x1c')][_0x4459('0x76')]==='DELIVERED'){return _0x524d11['update']({'read':!![]});}else{logger[_0x4459('0x17')](_0x4459('0x73'),'status',_0x4459('0x77'),util['inspect'](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x524d11;}})[_0x4459('0x11')](respondWithResult(_0x1e54de,null))[_0x4459('0x1b')](handleError(_0x1e54de,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 011ffd8..cefd7a7 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 _0x0dc1=['remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0dc1,0x67));var _0x10dc=function(_0xa3177e,_0x98f16f){_0xa3177e=_0xa3177e-0x0;var _0x6c195e=_0x0dc1[_0xa3177e];return _0x6c195e;};'use strict';var EventEmitter=require(_0x10dc('0x0'));var SmsMessage=require(_0x10dc('0x1'))['db'][_0x10dc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x10dc('0x3')](0x0);var events={'afterCreate':_0x10dc('0x4'),'afterUpdate':'update','afterDestroy':_0x10dc('0x5')};function emitEvent(_0x12f952){return function(_0x37b618,_0x2e6217,_0x582b48){SmsMessageEvents[_0x10dc('0x6')](_0x12f952+':'+_0x37b618['id'],_0x37b618);SmsMessageEvents['emit'](_0x12f952,_0x37b618);_0x582b48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x10dc('0x7')](e,emitEvent(event));}}module[_0x10dc('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x83cf=['../../mysqldb','SmsMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x83cf,0xa1));var _0xf83c=function(_0x29106c,_0x4371d6){_0x29106c=_0x29106c-0x0;var _0x4133ac=_0x83cf[_0x29106c];return _0x4133ac;};'use strict';var EventEmitter=require(_0xf83c('0x0'));var SmsMessage=require(_0xf83c('0x1'))['db'][_0xf83c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf83c('0x3'),'afterUpdate':_0xf83c('0x4'),'afterDestroy':_0xf83c('0x5')};function emitEvent(_0x2c0a5d){return function(_0xf2250f,_0x801ee3,_0x53109d){SmsMessageEvents[_0xf83c('0x6')](_0x2c0a5d+':'+_0xf2250f['id'],_0xf2250f);SmsMessageEvents[_0xf83c('0x6')](_0x2c0a5d,_0xf2250f);_0x53109d(null);};}for(var e in events){if(events[_0xf83c('0x7')](e)){var event=events[e];SmsMessage[_0xf83c('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0e7cc22..475bc9e 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 _0xa776=['remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','split','sms','user_key','total_sent','internal_order_id','read','skebby','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','POST','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','type','twilio','accountSid','authToken','phone','messages'];(function(_0x3400cd,_0x3b62d9){var _0x248697=function(_0x32b47c){while(--_0x32b47c){_0x3400cd['push'](_0x3400cd['shift']());}};_0x248697(++_0x3b62d9);}(_0xa776,0x1c0));var _0x6a77=function(_0x2bfadc,_0x31136d){_0x2bfadc=_0x2bfadc-0x0;var _0x58c47a=_0xa776[_0x2bfadc];return _0x58c47a;};'use strict';var _=require(_0x6a77('0x0'));var util=require(_0x6a77('0x1'));var logger=require(_0x6a77('0x2'))(_0x6a77('0x3'));var moment=require('moment');var BPromise=require(_0x6a77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a77('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6a77('0x6'));module['exports']=function(_0x379e70,_0x3eae5e){return _0x379e70['define'](_0x6a77('0x7'),attributes,{'tableName':_0x6a77('0x8'),'paranoid':![],'indexes':[{'name':_0x6a77('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x6a77('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xce5858,_0x308808,_0x23ef5b){var _0x3dc8d0=_0x379e70[_0x6a77('0xb')];var _0x3ab470=_0xce5858[_0x6a77('0xc')]({'plain':!![]});if(_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()==='in'||_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()===_0x6a77('0xf')&&!_0x3ab470['secret']&&!_[_0x6a77('0x10')](_0x3ab470[_0x6a77('0x11')])&&!_[_0x6a77('0x10')](_0x3ab470['SmsInteractionId'])){_0x3dc8d0[_0x6a77('0x12')][_0x6a77('0x13')]({'where':{'id':_0x3ab470[_0x6a77('0x14')]}})[_0x6a77('0x15')](function(_0x42afc1){if(_0x42afc1){_0x42afc1[_0x6a77('0x16')]({'lastMsgAt':_0x3ab470[_0x6a77('0x17')],'lastMsgDirection':_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()});}})[_0x6a77('0x18')](function(_0x34c14a){console['error'](_0x34c14a);});}if(_0x3ab470[_0x6a77('0xd')]===_0x6a77('0xf')&&!_0x3ab470['secret']){var _0x54d94d;_0x3dc8d0[_0x6a77('0x19')]['find']({'where':{'id':_0x3ab470['SmsAccountId']},'raw':!![]})['then'](function(_0xc128de){_0x54d94d=_0xc128de;if(_0x54d94d&&_0x54d94d['type']){switch(_0x54d94d[_0x6a77('0x1a')]){case _0x6a77('0x1b'):var _0x1398ba=require(_0x6a77('0x1b'));if(_0x54d94d[_0x6a77('0x1c')]&&_0x54d94d[_0x6a77('0x1d')]&&_0x54d94d[_0x6a77('0x1e')]){var _0x451f4d=new _0x1398ba(_0x54d94d['accountSid'],_0x54d94d[_0x6a77('0x1d')]);_0x451f4d[_0x6a77('0x1f')]['create']({'body':_0x3ab470[_0x6a77('0xa')],'to':_0x3ab470[_0x6a77('0x1e')],'from':_0x54d94d[_0x6a77('0x1e')],'statusCallback':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d[_0x6a77('0x23')]})[_0x6a77('0x15')](function(_0x25d950){if(_0x25d950[_0x6a77('0x24')]){return _0xce5858[_0x6a77('0x16')]({'messageId':_0x25d950[_0x6a77('0x24')]});}})['catch'](function(_0x4332aa){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'twilio',util[_0x6a77('0x28')](_0x4332aa,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x1b'),_0x6a77('0x29'));}break;case'skebby':var _0x3066bd=_0x6a77('0x2a');if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d['password']){var _0x4803c8={'recipient':[_0x3ab470[_0x6a77('0x1e')]],'message':_0x3ab470[_0x6a77('0xa')],'message_type':_0x54d94d[_0x6a77('0x2c')]};if(_0x54d94d[_0x6a77('0x2c')]&&_0x54d94d[_0x6a77('0x2c')]!=='SI'){_0x4803c8[_0x6a77('0x2d')]=_0x54d94d[_0x6a77('0x1e')];}var _0x1321fa={'url':_0x3066bd+'login?username='+_0x54d94d['username']+_0x6a77('0x2e')+_0x54d94d[_0x6a77('0x2f')],'method':'GET'};rp(_0x1321fa)[_0x6a77('0x15')](function(_0x6640d){var _0x2abafa=_0x6640d[_0x6a77('0x30')](';');var _0x166823={'user_key':_0x2abafa[0x0],'session_key':_0x2abafa[0x1]};_0x1321fa={'url':_0x3066bd+_0x6a77('0x31'),'method':'POST','headers':{'user_key':_0x166823[_0x6a77('0x32')],'Session_key':_0x166823['session_key']},'json':!![],'body':_0x4803c8};return rp(_0x1321fa);})['then'](function(_0x54845b){if(_0x54845b[_0x6a77('0x33')]>=0x1){var _0x50091b={'messageId':_0x54845b[_0x6a77('0x34')]};if(_0x54d94d[_0x6a77('0x2c')]!=='GP'||!_0x54d94d['deliveryReport']){_0x50091b[_0x6a77('0x35')]=!![];}return _0xce5858['update'](_0x50091b);}else{return logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'skebby',util['inspect'](_0x54845b,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x3ae398){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x36'),util[_0x6a77('0x28')](_0x3ae398,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6a77('0x37'):if(_0x54d94d[_0x6a77('0x1d')]){var _0x588d41={'recipient':_0x3ab470[_0x6a77('0x1e')],'message':_0x3ab470[_0x6a77('0xa')],'sender':_0x54d94d['senderString']||_0x54d94d[_0x6a77('0x1e')],'authorization':_0x54d94d[_0x6a77('0x1d')]};var _0x308808={'method':'POST','uri':_0x6a77('0x38'),'body':_0x588d41,'json':!![]};rp(_0x308808)['then'](function(_0x4edc8a){var _0x129188={'messageId':_0x4edc8a[_0x6a77('0x39')]};if(!_0x54d94d[_0x6a77('0x3a')]){_0x129188[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x129188);})['catch'](function(_0x3c9fb0){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x37'),util[_0x6a77('0x28')](_0x3c9fb0,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'connectel',_0x6a77('0x3b'));}break;case _0x6a77('0x3c'):if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d[_0x6a77('0x2f')]){var _0x588d41={'messages':[{'source':_0x6a77('0x3d'),'to':_0x3ab470[_0x6a77('0x1e')],'body':_0x3ab470[_0x6a77('0xa')],'from':_0x54d94d[_0x6a77('0x3e')]||_0x54d94d[_0x6a77('0x1e')]}]};var _0x526a6c=util['format'](_0x6a77('0x3f'),_0x54d94d[_0x6a77('0x2b')],_0x54d94d[_0x6a77('0x2f')]);var _0x308808={'method':_0x6a77('0x40'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x588d41,'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')](_0x6a77('0x44')))},'json':!![]};rp(_0x308808)[_0x6a77('0x15')](function(_0x408419){if(_0x408419[_0x6a77('0x45')]>=0xc8&&_0x408419[_0x6a77('0x45')]<=0xce){if(_0x408419[_0x6a77('0x46')]&&_0x408419[_0x6a77('0x46')][_0x6a77('0x47')]>0x0){var _0x2ce950=_[_0x6a77('0x48')](_0x408419[_0x6a77('0x46')][_0x6a77('0x1f')]);var _0x4894f9={'messageId':_0x2ce950[_0x6a77('0x49')]};if(!_0x54d94d['deliveryReport']){_0x4894f9[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x4894f9);}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x4a'),util[_0x6a77('0x28')](_0x408419,{'showHidden':![],'depth':null}));}}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x4a'),util['inspect'](_0x408419,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x56a34f){logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'clickSend',util[_0x6a77('0x28')](_0x56a34f,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a77('0x4b'):if(_0x54d94d[_0x6a77('0x4c')]&&_0x54d94d[_0x6a77('0x1d')]){var _0x588d41={'dst':_0x3ab470[_0x6a77('0x1e')],'text':_0x3ab470[_0x6a77('0xa')],'src':_0x54d94d[_0x6a77('0x3e')]||_0x54d94d['phone'],'url':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d['token']};var _0x526a6c=util['format'](_0x6a77('0x3f'),_0x54d94d['authId'],_0x54d94d['authToken']);var _0x308808={'method':_0x6a77('0x40'),'uri':util[_0x6a77('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x54d94d[_0x6a77('0x4c')]),'body':_0x588d41,'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')](_0x6a77('0x44')))},'json':!![]};rp(_0x308808)[_0x6a77('0x15')](function(_0xe88da0){var _0x50f293={'messageId':_0xe88da0[_0x6a77('0x4d')][0x0]};return _0xce5858[_0x6a77('0x16')](_0x50f293);})[_0x6a77('0x18')](function(_0x46c3d2){logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x4b'),util[_0x6a77('0x28')](_0x46c3d2,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'plivo',_0x6a77('0x4e'));}break;case'infobip':if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d[_0x6a77('0x2f')]){if(_0x54d94d['baseUrl']){var _0x4d4f5b={'method':_0x6a77('0x40'),'uri':_0x54d94d[_0x6a77('0x4f')]+_0x6a77('0x50'),'body':{'username':_0x54d94d['username'],'password':_0x54d94d[_0x6a77('0x2f')]},'json':!![]};return rp(_0x4d4f5b)[_0x6a77('0x15')](function(_0x44890e){var _0x2ddf94={'method':_0x6a77('0x40'),'uri':_0x54d94d['baseUrl']+_0x6a77('0x51'),'body':{'messages':[{'from':_0x54d94d[_0x6a77('0x1e')],'destinations':[{'to':_0x3ab470[_0x6a77('0x1e')]}],'text':_0x3ab470['body'],'notifyUrl':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d[_0x6a77('0x23')],'notifyContentType':_0x6a77('0x52'),'callbackData':_0x54d94d[_0x6a77('0x1e')]+';'+_0x3ab470['body']}]},'headers':{'Authorization':_0x6a77('0x53')+_0x44890e[_0x6a77('0x23')]},'json':!![]};return rp(_0x2ddf94)[_0x6a77('0x15')](function(_0x1bdac0){if(_0x1bdac0['messages']){var _0x9771b9={'messageId':_0x1bdac0[_0x6a77('0x1f')][0x0][_0x6a77('0x9')]};if(!_0x54d94d['deliveryReport']){_0x9771b9[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x9771b9);}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x54'),util[_0x6a77('0x28')](_0x1bdac0,{'showHidden':![],'depth':null}));}});})[_0x6a77('0x18')](function(_0x49bb77){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x54'),util[_0x6a77('0x28')](_0x49bb77,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'infobip',_0x6a77('0x55'));}}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'infobip',_0x6a77('0x56'));}break;case _0x6a77('0x57'):var _0x5d0c18=require(_0x6a77('0x58'));if(_0x54d94d[_0x6a77('0x59')]){var _0x2fdeab={};_0x2fdeab[_0x6a77('0x5a')]=_0x54d94d['username'];_0x2fdeab['phone']=_0x3ab470[_0x6a77('0x1e')];_0x2fdeab[_0x6a77('0x2d')]=_0x54d94d['phone'];_0x2fdeab[_0x6a77('0x5b')]=_0x3ab470[_0x6a77('0xa')];_0x2fdeab['timestamp']=+new Date();var _0x3485b4='';var _0x915fd7='';var _0x29fc50=Object[_0x6a77('0x5c')](_0x2fdeab);_0x29fc50[_0x6a77('0x5d')]();for(var _0x191f47=0x0;_0x191f47<_0x29fc50[_0x6a77('0x5e')];_0x191f47++){if(_0x3485b4!=''){_0x3485b4+='&';}_0x3485b4+=_0x29fc50[_0x191f47]+'='+encodeURIComponent(_0x2fdeab[_0x29fc50[_0x191f47]]);_0x915fd7+=_0x2fdeab[_0x29fc50[_0x191f47]];}_0x915fd7+=_0x54d94d[_0x6a77('0x59')];_0x915fd7=_0x5d0c18[_0x6a77('0x5f')](_0x6a77('0x60'))[_0x6a77('0x16')](_0x915fd7)[_0x6a77('0x61')](_0x6a77('0x62'));if(_0x3485b4!==''){_0x3485b4+='&';}_0x3485b4+='signature='+_0x915fd7;var _0x1321fa={'method':_0x6a77('0x63'),'uri':_0x54d94d['baseUrl']+'/external/get/send.php?'+_0x3485b4,'json':!![]};return rp(_0x1321fa)[_0x6a77('0x15')](function(_0x2b9e15){var _0x49b865=Object[_0x6a77('0x5c')](_0x2b9e15);if(_0x2b9e15[_0x49b865[0x0]][_0x6a77('0x25')]&&parseInt(_0x2b9e15[_0x49b865[0x0]]['error'])===0x0){var _0x3b4197={'messageId':_0x2b9e15[_0x49b865[0x0]][_0x6a77('0x64')]};if(!_0x54d94d['deliveryReport']){_0x3b4197[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x3b4197);}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'csc',util[_0x6a77('0x28')](_0x2b9e15[_0x6a77('0x25')],{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x55f7dd){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x57'),util['inspect'](_0x55f7dd,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'csc',_0x6a77('0x65'));}break;case _0x6a77('0x66'):if(_0x54d94d[_0x6a77('0x59')]){var _0x46263e={'method':'POST','uri':_0x6a77('0x67'),'headers':{'Authorization':_0x54d94d[_0x6a77('0x59')]},'body':{'content':_0x3ab470['body'],'to':[_0x3ab470['phone']],'from':_0x54d94d[_0x6a77('0x1e')],'binary':![],'clientMessageId':_0x6a77('0x68'),'charset':_0x6a77('0x69')},'json':!![]};rp(_0x46263e)['then'](function(_0x4e11ff){if(!_0x4e11ff[_0x6a77('0x25')]){var _0x10c3c7={'messageId':_0x4e11ff[_0x6a77('0x1f')][0x0][_0x6a77('0x6a')]};if(!_0x54d94d[_0x6a77('0x3a')]){_0x10c3c7[_0x6a77('0x35')]=!![];}return _0xce5858['update'](_0x10c3c7);}else{return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x66'),util[_0x6a77('0x28')](_0x4e11ff[_0x6a77('0x25')],{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0xf221cc){return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x66'),util[_0x6a77('0x28')](_0xf221cc,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x66'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d['password']){var _0x526a6c=util[_0x6a77('0x41')](_0x6a77('0x3f'),_0x54d94d[_0x6a77('0x2b')],_0x54d94d['password']);var _0x308808={'method':_0x6a77('0x40'),'uri':_0x6a77('0x6b')+_0x54d94d[_0x6a77('0x6c')]+_0x6a77('0x6d'),'body':{'to':[_0x3ab470[_0x6a77('0x1e')]],'text':_0x3ab470[_0x6a77('0xa')],'from':_0x54d94d[_0x6a77('0x1e')],'applicationId':_0x54d94d[_0x6a77('0x6e')]},'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')]('base64'))},'json':!![]};rp(_0x308808)['then'](function(_0xfc9b73){if(_0xfc9b73['id']){var _0x652fdf={'messageId':_0xfc9b73['id']};return _0xce5858['update'](_0x652fdf);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x6f'),util['inspect'](_0xfc9b73,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x53932f){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'bandwidth',util['inspect'](_0x53932f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'bandwidth',_0x6a77('0x56'));}break;case _0x6a77('0x70'):if(_0x54d94d['apiKey']){var _0x15a6fe={};var _0x1321fa={'method':_0x6a77('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x6a77('0x71')+_0x54d94d['apiKey'],'Content-Type':_0x6a77('0x52')},'body':{'from':_0x54d94d[_0x6a77('0x1e')],'to':_0x3ab470['phone'],'text':_0x3ab470['body']},'json':!![]};return rp(_0x1321fa)[_0x6a77('0x15')](function(_0x1c4624){if(_0x1c4624[_0x6a77('0x72')]==0xca){_0x15a6fe['message']=_0x1c4624;var _0x3fea56={'method':_0x6a77('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x6a77('0x71')+_0x54d94d['apiKey'],'Content-Type':_0x6a77('0x52')},'body':{'refid':_0x15a6fe['message'][_0x6a77('0x73')]},'json':!![]};return rp(_0x3fea56)['then'](function(_0x3239de){_0x15a6fe[_0x6a77('0x74')]=_0x3239de;var _0x3239d0={'messageId':_0x15a6fe['message'][_0x6a77('0x73')],'read':!![]};return _0xce5858[_0x6a77('0x16')](_0x3239d0);});}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x70'),util['inspect'](_0x1c4624,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x3413a2){return logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x70'),util[_0x6a77('0x28')](_0x3413a2,{'showHidden':![],'depth':null}));});}else{return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x70'),'Token\x20not\x20received');}break;}}})[_0x6a77('0x75')](function(){_0x23ef5b();});}else{_0x23ef5b();}}},'charset':_0x6a77('0x76'),'collate':_0x6a77('0x77')});}; \ No newline at end of file +var _0x1be5=['&password=','split','sms','user_key','session_key','internal_order_id','read','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','toString','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/status?token=','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','SmsAccount','find','SmsAccountId','type','accountSid','phone','authToken','messages','remote','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x1be5,0x1c6));var _0x51be=function(_0xc239fc,_0x1c9c65){_0xc239fc=_0xc239fc-0x0;var _0x12ec85=_0x1be5[_0xc239fc];return _0x12ec85;};'use strict';var _=require('lodash');var util=require(_0x51be('0x0'));var logger=require(_0x51be('0x1'))(_0x51be('0x2'));var moment=require(_0x51be('0x3'));var BPromise=require(_0x51be('0x4'));var rp=require(_0x51be('0x5'));var fs=require('fs');var path=require(_0x51be('0x6'));var rimraf=require(_0x51be('0x7'));var config=require('../../config/environment');var attributes=require(_0x51be('0x8'));module[_0x51be('0x9')]=function(_0x582da0,_0x133b4a){return _0x582da0[_0x51be('0xa')](_0x51be('0xb'),attributes,{'tableName':_0x51be('0xc'),'paranoid':![],'indexes':[{'name':_0x51be('0xd'),'fields':[_0x51be('0xd')]},{'name':_0x51be('0xe'),'fields':[_0x51be('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x226121,_0x4b47d9,_0x309c33){var _0x5ed947=_0x582da0[_0x51be('0x10')];var _0x19e461=_0x226121['get']({'plain':!![]});if(_0x19e461['direction'][_0x51be('0x11')]()==='in'||_0x19e461[_0x51be('0x12')]['toLowerCase']()===_0x51be('0x13')&&!_0x19e461[_0x51be('0x14')]&&!_[_0x51be('0x15')](_0x19e461[_0x51be('0x16')])&&!_[_0x51be('0x15')](_0x19e461[_0x51be('0x17')])){_0x5ed947['SmsInteraction'][_0x51be('0x18')]({'where':{'id':_0x19e461[_0x51be('0x17')]}})[_0x51be('0x19')](function(_0x1c0948){if(_0x1c0948){_0x1c0948[_0x51be('0x1a')]({'lastMsgAt':_0x19e461['createdAt'],'lastMsgDirection':_0x19e461['direction'][_0x51be('0x11')]()});}})['catch'](function(_0x1de4c1){console['error'](_0x1de4c1);});}if(_0x19e461['direction']===_0x51be('0x13')&&!_0x19e461['secret']){var _0x4ec33d;_0x5ed947[_0x51be('0x1b')][_0x51be('0x1c')]({'where':{'id':_0x19e461[_0x51be('0x1d')]},'raw':!![]})[_0x51be('0x19')](function(_0xfba4df){_0x4ec33d=_0xfba4df;if(_0x4ec33d&&_0x4ec33d[_0x51be('0x1e')]){switch(_0x4ec33d['type']){case'twilio':var _0x18f918=require('twilio');if(_0x4ec33d[_0x51be('0x1f')]&&_0x4ec33d['authToken']&&_0x4ec33d[_0x51be('0x20')]){var _0x4584cf=new _0x18f918(_0x4ec33d[_0x51be('0x1f')],_0x4ec33d[_0x51be('0x21')]);_0x4584cf[_0x51be('0x22')]['create']({'body':_0x19e461[_0x51be('0xf')],'to':_0x19e461[_0x51be('0x20')],'from':_0x4ec33d[_0x51be('0x20')],'statusCallback':_0x4ec33d[_0x51be('0x23')]+'/api/sms/messages/'+_0x19e461['id']+'/status?token='+_0x4ec33d[_0x51be('0x24')]})[_0x51be('0x19')](function(_0x3068d9){if(_0x3068d9[_0x51be('0x25')]){return _0x226121[_0x51be('0x1a')]({'messageId':_0x3068d9[_0x51be('0x25')]});}})[_0x51be('0x26')](function(_0x354631){logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x2a'),util[_0x51be('0x2b')](_0x354631,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x2a'),_0x51be('0x2c'));}break;case _0x51be('0x2d'):var _0x233e6c=_0x51be('0x2e');if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x31ad92={'recipient':[_0x19e461[_0x51be('0x20')]],'message':_0x19e461['body'],'message_type':_0x4ec33d['smsMethod']};if(_0x4ec33d[_0x51be('0x31')]&&_0x4ec33d['smsMethod']!=='SI'){_0x31ad92['sender']=_0x4ec33d[_0x51be('0x20')];}var _0x1829e8={'url':_0x233e6c+'login?username='+_0x4ec33d[_0x51be('0x2f')]+_0x51be('0x32')+_0x4ec33d[_0x51be('0x30')],'method':'GET'};rp(_0x1829e8)[_0x51be('0x19')](function(_0x29e6f6){var _0x1be94f=_0x29e6f6[_0x51be('0x33')](';');var _0x569be0={'user_key':_0x1be94f[0x0],'session_key':_0x1be94f[0x1]};_0x1829e8={'url':_0x233e6c+_0x51be('0x34'),'method':'POST','headers':{'user_key':_0x569be0[_0x51be('0x35')],'Session_key':_0x569be0[_0x51be('0x36')]},'json':!![],'body':_0x31ad92};return rp(_0x1829e8);})[_0x51be('0x19')](function(_0x4d8881){if(_0x4d8881['total_sent']>=0x1){var _0x3f1c61={'messageId':_0x4d8881[_0x51be('0x37')]};if(_0x4ec33d[_0x51be('0x31')]!=='GP'||!_0x4ec33d['deliveryReport']){_0x3f1c61[_0x51be('0x38')]=!![];}return _0x226121[_0x51be('0x1a')](_0x3f1c61);}else{return logger['error'](_0x51be('0x28'),_0x51be('0x29'),'skebby',util['inspect'](_0x4d8881,{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x2e32a7){return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x2d'),util[_0x51be('0x2b')](_0x2e32a7,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x4ec33d[_0x51be('0x21')]){var _0x3b46f0={'recipient':_0x19e461['phone'],'message':_0x19e461[_0x51be('0xf')],'sender':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d['phone'],'authorization':_0x4ec33d[_0x51be('0x21')]};var _0x4b47d9={'method':_0x51be('0x3a'),'uri':_0x51be('0x3b'),'body':_0x3b46f0,'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x87e18d){var _0x523dfd={'messageId':_0x87e18d[_0x51be('0x3c')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x523dfd['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x523dfd);})[_0x51be('0x26')](function(_0x489784){logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x3e'),util[_0x51be('0x2b')](_0x489784,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'connectel',_0x51be('0x3f'));}break;case _0x51be('0x40'):if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x3b46f0={'messages':[{'source':_0x51be('0x41'),'to':_0x19e461[_0x51be('0x20')],'body':_0x19e461[_0x51be('0xf')],'from':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d[_0x51be('0x20')]}]};var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x2f')],_0x4ec33d[_0x51be('0x30')]);var _0x4b47d9={'method':_0x51be('0x3a'),'uri':_0x51be('0x44'),'body':_0x3b46f0,'headers':{'Authorization':util[_0x51be('0x42')](_0x51be('0x45'),new Buffer(_0x385e93)['toString'](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x54609b){if(_0x54609b[_0x51be('0x47')]>=0xc8&&_0x54609b[_0x51be('0x47')]<=0xce){if(_0x54609b['data']&&_0x54609b[_0x51be('0x48')][_0x51be('0x49')]>0x0){var _0x1130d9=_[_0x51be('0x4a')](_0x54609b['data'][_0x51be('0x22')]);var _0x57b9b8={'messageId':_0x1130d9[_0x51be('0x4b')]};if(!_0x4ec33d['deliveryReport']){_0x57b9b8['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x57b9b8);}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x51be('0x4c'),util['inspect'](_0x54609b,{'showHidden':![],'depth':null}));}}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x4c'),util[_0x51be('0x2b')](_0x54609b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x37dc67){logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4c'),util[_0x51be('0x2b')](_0x37dc67,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x4c'),_0x51be('0x4d'));}break;case _0x51be('0x4e'):if(_0x4ec33d[_0x51be('0x4f')]&&_0x4ec33d[_0x51be('0x21')]){var _0x3b46f0={'dst':_0x19e461[_0x51be('0x20')],'text':_0x19e461[_0x51be('0xf')],'src':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d[_0x51be('0x20')],'url':_0x4ec33d[_0x51be('0x23')]+_0x51be('0x50')+_0x19e461['id']+'/status?token='+_0x4ec33d[_0x51be('0x24')]};var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x4f')],_0x4ec33d[_0x51be('0x21')]);var _0x4b47d9={'method':_0x51be('0x3a'),'uri':util[_0x51be('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4ec33d[_0x51be('0x4f')]),'body':_0x3b46f0,'headers':{'Authorization':util['format'](_0x51be('0x45'),new Buffer(_0x385e93)[_0x51be('0x51')](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x330d61){var _0x511fd0={'messageId':_0x330d61['message_uuid'][0x0]};return _0x226121[_0x51be('0x1a')](_0x511fd0);})[_0x51be('0x26')](function(_0x2b3946){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4e'),util[_0x51be('0x2b')](_0x2b3946,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4e'),_0x51be('0x52'));}break;case'infobip':if(_0x4ec33d['username']&&_0x4ec33d[_0x51be('0x30')]){if(_0x4ec33d[_0x51be('0x53')]){var _0x5231e2={'method':_0x51be('0x3a'),'uri':_0x4ec33d[_0x51be('0x53')]+_0x51be('0x54'),'body':{'username':_0x4ec33d[_0x51be('0x2f')],'password':_0x4ec33d[_0x51be('0x30')]},'json':!![]};return rp(_0x5231e2)[_0x51be('0x19')](function(_0x1ca23c){var _0x341c9e={'method':_0x51be('0x3a'),'uri':_0x4ec33d[_0x51be('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4ec33d['phone'],'destinations':[{'to':_0x19e461[_0x51be('0x20')]}],'text':_0x19e461[_0x51be('0xf')],'notifyUrl':_0x4ec33d['remote']+_0x51be('0x50')+_0x19e461['id']+_0x51be('0x55')+_0x4ec33d[_0x51be('0x24')],'notifyContentType':_0x51be('0x56'),'callbackData':_0x4ec33d[_0x51be('0x20')]+';'+_0x19e461[_0x51be('0xf')]}]},'headers':{'Authorization':_0x51be('0x57')+_0x1ca23c[_0x51be('0x24')]},'json':!![]};return rp(_0x341c9e)[_0x51be('0x19')](function(_0x592ba5){if(_0x592ba5['messages']){var _0x38dc37={'messageId':_0x592ba5[_0x51be('0x22')][0x0][_0x51be('0xd')]};if(!_0x4ec33d['deliveryReport']){_0x38dc37['read']=!![];}return _0x226121['update'](_0x38dc37);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x58'),util[_0x51be('0x2b')](_0x592ba5,{'showHidden':![],'depth':null}));}});})[_0x51be('0x26')](function(_0x6ec4ff){return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),util[_0x51be('0x2b')](_0x6ec4ff,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),_0x51be('0x59'));}}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x51be('0x5a'):var _0x5aa64d=require(_0x51be('0x5b'));if(_0x4ec33d[_0x51be('0x5c')]){var _0x1e19d3={};_0x1e19d3[_0x51be('0x5d')]=_0x4ec33d['username'];_0x1e19d3['phone']=_0x19e461[_0x51be('0x20')];_0x1e19d3['sender']=_0x4ec33d['phone'];_0x1e19d3[_0x51be('0x5e')]=_0x19e461[_0x51be('0xf')];_0x1e19d3[_0x51be('0x5f')]=+new Date();var _0x43cdc8='';var _0x217215='';var _0x6f46f3=Object['keys'](_0x1e19d3);_0x6f46f3[_0x51be('0x60')]();for(var _0x1a0658=0x0;_0x1a0658<_0x6f46f3['length'];_0x1a0658++){if(_0x43cdc8!=''){_0x43cdc8+='&';}_0x43cdc8+=_0x6f46f3[_0x1a0658]+'='+encodeURIComponent(_0x1e19d3[_0x6f46f3[_0x1a0658]]);_0x217215+=_0x1e19d3[_0x6f46f3[_0x1a0658]];}_0x217215+=_0x4ec33d[_0x51be('0x5c')];_0x217215=_0x5aa64d[_0x51be('0x61')](_0x51be('0x62'))[_0x51be('0x1a')](_0x217215)[_0x51be('0x63')](_0x51be('0x64'));if(_0x43cdc8!==''){_0x43cdc8+='&';}_0x43cdc8+=_0x51be('0x65')+_0x217215;var _0x1829e8={'method':_0x51be('0x66'),'uri':_0x4ec33d[_0x51be('0x53')]+_0x51be('0x67')+_0x43cdc8,'json':!![]};return rp(_0x1829e8)[_0x51be('0x19')](function(_0x15de0f){var _0x34e37b=Object[_0x51be('0x68')](_0x15de0f);if(_0x15de0f[_0x34e37b[0x0]][_0x51be('0x27')]&&parseInt(_0x15de0f[_0x34e37b[0x0]][_0x51be('0x27')])===0x0){var _0x424803={'messageId':_0x15de0f[_0x34e37b[0x0]][_0x51be('0x69')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x424803['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x424803);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'csc',util['inspect'](_0x15de0f['error'],{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x21f657){return logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x5a'),util['inspect'](_0x21f657,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0x51be('0x6a'):if(_0x4ec33d[_0x51be('0x5c')]){var _0x392d06={'method':_0x51be('0x3a'),'uri':_0x51be('0x6b'),'headers':{'Authorization':_0x4ec33d[_0x51be('0x5c')]},'body':{'content':_0x19e461[_0x51be('0xf')],'to':[_0x19e461[_0x51be('0x20')]],'from':_0x4ec33d[_0x51be('0x20')],'binary':![],'clientMessageId':_0x51be('0x6c'),'charset':_0x51be('0x6d')},'json':!![]};rp(_0x392d06)[_0x51be('0x19')](function(_0x4cb67d){if(!_0x4cb67d['error']){var _0x4eeb6a={'messageId':_0x4cb67d['messages'][0x0][_0x51be('0x6e')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x4eeb6a[_0x51be('0x38')]=!![];}return _0x226121[_0x51be('0x1a')](_0x4eeb6a);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x6a'),util[_0x51be('0x2b')](_0x4cb67d['error'],{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x167a20){return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x6a'),util['inspect'](_0x167a20,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x6a'),_0x51be('0x6f'));}break;case _0x51be('0x70'):if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x2f')],_0x4ec33d[_0x51be('0x30')]);var _0x4b47d9={'method':'POST','uri':_0x51be('0x71')+_0x4ec33d[_0x51be('0x72')]+_0x51be('0x73'),'body':{'to':[_0x19e461[_0x51be('0x20')]],'text':_0x19e461[_0x51be('0xf')],'from':_0x4ec33d[_0x51be('0x20')],'applicationId':_0x4ec33d[_0x51be('0x74')]},'headers':{'Authorization':util['format'](_0x51be('0x45'),new Buffer(_0x385e93)[_0x51be('0x51')](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x313487){if(_0x313487['id']){var _0x3ce370={'messageId':_0x313487['id']};return _0x226121[_0x51be('0x1a')](_0x3ce370);}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x70'),util['inspect'](_0x313487,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e6d77){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x70'),util[_0x51be('0x2b')](_0x2e6d77,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x70'),_0x51be('0x4d'));}break;case'intelepeer':if(_0x4ec33d[_0x51be('0x5c')]){var _0x41fc10={};var _0x1829e8={'method':_0x51be('0x3a'),'uri':_0x51be('0x75'),'headers':{'Authorization':_0x51be('0x76')+_0x4ec33d['apiKey'],'Content-Type':_0x51be('0x56')},'body':{'from':_0x4ec33d[_0x51be('0x20')],'to':_0x19e461[_0x51be('0x20')],'text':_0x19e461[_0x51be('0xf')]},'json':!![]};return rp(_0x1829e8)[_0x51be('0x19')](function(_0x97e9b7){if(_0x97e9b7[_0x51be('0x77')]==0xca){_0x41fc10[_0x51be('0x78')]=_0x97e9b7;var _0x2eec06={'method':_0x51be('0x3a'),'uri':_0x51be('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x4ec33d[_0x51be('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x41fc10['message']['refid']},'json':!![]};return rp(_0x2eec06)['then'](function(_0xe3ed36){_0x41fc10[_0x51be('0x7a')]=_0xe3ed36;var _0x50837f={'messageId':_0x41fc10[_0x51be('0x78')][_0x51be('0x7b')],'read':!![]};return _0x226121[_0x51be('0x1a')](_0x50837f);});}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'intelepeer',util['inspect'](_0x97e9b7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5aec56){return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x7c'),util[_0x51be('0x2b')](_0x5aec56,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x51be('0x28'),_0x51be('0x29'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x51be('0x7d')](function(){_0x309c33();});}else{_0x309c33();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 007cd8e..7823257 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 _0x141c=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','options','debug','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsMessage.socket','register','request'];(function(_0x56ce1f,_0x2afb82){var _0x3d1aba=function(_0x168a19){while(--_0x168a19){_0x56ce1f['push'](_0x56ce1f['shift']());}};_0x3d1aba(++_0x2afb82);}(_0x141c,0x1cf));var _0xc141=function(_0x55bc03,_0x469709){_0x55bc03=_0x55bc03-0x0;var _0xc8941a=_0x141c[_0x55bc03];return _0xc8941a;};'use strict';var _=require('lodash');var util=require(_0xc141('0x0'));var moment=require(_0xc141('0x1'));var BPromise=require('bluebird');var rs=require(_0xc141('0x2'));var fs=require('fs');var Redis=require(_0xc141('0x3'));var db=require(_0xc141('0x4'))['db'];var utils=require(_0xc141('0x5'));var logger=require(_0xc141('0x6'))(_0xc141('0x7'));var config=require(_0xc141('0x8'));var jayson=require(_0xc141('0x9'));var client=jayson['client'][_0xc141('0xa')]({'port':0x232a});config[_0xc141('0xb')]=_[_0xc141('0xc')](config[_0xc141('0xb')],{'host':_0xc141('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc141('0xe'))[_0xc141('0xf')](socket);function respondWithRpcPromise(_0x148d78,_0x1e9156,_0x321371){return new BPromise(function(_0x27d498,_0x17b98e){return client[_0xc141('0x10')](_0x148d78,_0x321371)[_0xc141('0x11')](function(_0x5b47f8){logger[_0xc141('0x12')](_0xc141('0x13'),_0x1e9156,_0xc141('0x14'));logger['debug'](_0xc141('0x15'),_0x1e9156,'request\x20sent',JSON['stringify'](_0x5b47f8));if(_0x5b47f8[_0xc141('0x16')]){if(_0x5b47f8[_0xc141('0x16')][_0xc141('0x17')]===0x1f4){logger[_0xc141('0x16')](_0xc141('0x13'),_0x1e9156,_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);return _0x17b98e(_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);}logger[_0xc141('0x16')](_0xc141('0x13'),_0x1e9156,_0x5b47f8[_0xc141('0x16')]['message']);return _0x27d498(_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);}else{logger[_0xc141('0x12')](_0xc141('0x13'),_0x1e9156,_0xc141('0x14'));_0x27d498(_0x5b47f8[_0xc141('0x19')][_0xc141('0x18')]);}})[_0xc141('0x1a')](function(_0x133093){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e9156,_0x133093);_0x17b98e(_0x133093);});});}exports['CreateSmsMessage']=function(_0x274e0f){var _0x152e0b=this;return new Promise(function(_0x3dca30,_0x457554){return db[_0xc141('0x1b')]['create'](_0x274e0f['body'],{'raw':_0x274e0f[_0xc141('0x1c')]?_0x274e0f[_0xc141('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc141('0x11')](function(_0x6f3a7a){logger[_0xc141('0x12')]('CreateSmsMessage',_0x274e0f);logger[_0xc141('0x1d')](_0xc141('0x1e'),_0x274e0f,JSON[_0xc141('0x1f')](_0x6f3a7a));_0x3dca30(_0x6f3a7a);})[_0xc141('0x1a')](function(_0x141910){logger[_0xc141('0x16')]('CreateSmsMessage',_0x141910['message'],_0x274e0f);_0x457554(_0x152e0b[_0xc141('0x16')](0x1f4,_0x141910[_0xc141('0x18')]));});});}; \ No newline at end of file +var _0x7254=['message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x549ba5,_0x2538cb){var _0x195d32=function(_0x531f86){while(--_0x531f86){_0x549ba5['push'](_0x549ba5['shift']());}};_0x195d32(++_0x2538cb);}(_0x7254,0x168));var _0x4725=function(_0x5f1212,_0x116bf1){_0x5f1212=_0x5f1212-0x0;var _0x336e3b=_0x7254[_0x5f1212];return _0x336e3b;};'use strict';var _=require(_0x4725('0x0'));var util=require(_0x4725('0x1'));var moment=require(_0x4725('0x2'));var BPromise=require(_0x4725('0x3'));var rs=require(_0x4725('0x4'));var fs=require('fs');var Redis=require(_0x4725('0x5'));var db=require(_0x4725('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4725('0x7'))(_0x4725('0x8'));var config=require(_0x4725('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4725('0xa')][_0x4725('0xb')]({'port':0x232a});config[_0x4725('0xc')]=_[_0x4725('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4725('0xc')]));require(_0x4725('0xe'))[_0x4725('0xf')](socket);function respondWithRpcPromise(_0x4aaf74,_0x2707c0,_0x2ea264){return new BPromise(function(_0xd5cc1,_0x33247c){return client['request'](_0x4aaf74,_0x2ea264)[_0x4725('0x10')](function(_0x5201a7){logger[_0x4725('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2707c0,_0x4725('0x12'));logger[_0x4725('0x13')](_0x4725('0x14'),_0x2707c0,_0x4725('0x12'),JSON['stringify'](_0x5201a7));if(_0x5201a7[_0x4725('0x15')]){if(_0x5201a7[_0x4725('0x15')][_0x4725('0x16')]===0x1f4){logger[_0x4725('0x15')](_0x4725('0x17'),_0x2707c0,_0x5201a7[_0x4725('0x15')]['message']);return _0x33247c(_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);}logger['error'](_0x4725('0x17'),_0x2707c0,_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);return _0xd5cc1(_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);}else{logger[_0x4725('0x11')](_0x4725('0x17'),_0x2707c0,_0x4725('0x12'));_0xd5cc1(_0x5201a7['result'][_0x4725('0x18')]);}})[_0x4725('0x19')](function(_0x4b13e7){logger[_0x4725('0x15')](_0x4725('0x17'),_0x2707c0,_0x4b13e7);_0x33247c(_0x4b13e7);});});}exports[_0x4725('0x1a')]=function(_0x1b1804){var _0x4026a9=this;return new Promise(function(_0x5d0193,_0x2555b0){return db[_0x4725('0x1b')][_0x4725('0x1c')](_0x1b1804[_0x4725('0x1d')],{'raw':_0x1b1804[_0x4725('0x1e')]?_0x1b1804[_0x4725('0x1e')][_0x4725('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x209c99){logger[_0x4725('0x11')](_0x4725('0x1a'),_0x1b1804);logger[_0x4725('0x13')](_0x4725('0x1a'),_0x1b1804,JSON['stringify'](_0x209c99));_0x5d0193(_0x209c99);})[_0x4725('0x19')](function(_0x421a9b){logger['error'](_0x4725('0x1a'),_0x421a9b['message'],_0x1b1804);_0x2555b0(_0x4026a9[_0x4725('0x15')](0x1f4,_0x421a9b[_0x4725('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 77b1aec..8485349 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 _0xde05=['length','./smsMessage.events','remove','update','emit','removeListener'];(function(_0x552c92,_0x193099){var _0x439bc6=function(_0x201235){while(--_0x201235){_0x552c92['push'](_0x552c92['shift']());}};_0x439bc6(++_0x193099);}(_0xde05,0x1f3));var _0x5de0=function(_0x330786,_0x579ea1){_0x330786=_0x330786-0x0;var _0x31e5c1=_0xde05[_0x330786];return _0x31e5c1;};'use strict';var SmsMessageEvents=require(_0x5de0('0x0'));var events=['save',_0x5de0('0x1'),_0x5de0('0x2')];function createListener(_0x5c99a3,_0x35fe3d){return function(_0x510c46){_0x35fe3d[_0x5de0('0x3')](_0x5c99a3,_0x510c46);};}function removeListener(_0x260fbf,_0x4050b9){return function(){SmsMessageEvents[_0x5de0('0x4')](_0x260fbf,_0x4050b9);};}exports['register']=function(_0x5109c3){for(var _0x1568ff=0x0,_0x2d42d5=events[_0x5de0('0x5')];_0x1568ff<_0x2d42d5;_0x1568ff++){var _0xda0463=events[_0x1568ff];var _0x644fe1=createListener('smsMessage:'+_0xda0463,_0x5109c3);SmsMessageEvents['on'](_0xda0463,_0x644fe1);}}; \ No newline at end of file +var _0xefd8=['removeListener','length','smsMessage:','./smsMessage.events','save','update','emit'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xefd8,0x1ae));var _0x8efd=function(_0x359471,_0x4c7eaf){_0x359471=_0x359471-0x0;var _0x131710=_0xefd8[_0x359471];return _0x131710;};'use strict';var SmsMessageEvents=require(_0x8efd('0x0'));var events=[_0x8efd('0x1'),'remove',_0x8efd('0x2')];function createListener(_0x21cb64,_0x11dc04){return function(_0xad068a){_0x11dc04[_0x8efd('0x3')](_0x21cb64,_0xad068a);};}function removeListener(_0x2e015e,_0x4e7d34){return function(){SmsMessageEvents[_0x8efd('0x4')](_0x2e015e,_0x4e7d34);};}exports['register']=function(_0x425d74){for(var _0x4805ce=0x0,_0x27f757=events[_0x8efd('0x5')];_0x4805ce<_0x27f757;_0x4805ce++){var _0x32261a=events[_0x4805ce];var _0x4ff94e=createListener(_0x8efd('0x6')+_0x32261a,_0x425d74);SmsMessageEvents['on'](_0x32261a,_0x4ff94e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a030ef2..14eee20 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 _0x5892=['create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','getMembers','/:id/teams','post'];(function(_0x46e940,_0x59e2f0){var _0x460a6e=function(_0x24afef){while(--_0x24afef){_0x46e940['push'](_0x46e940['shift']());}};_0x460a6e(++_0x59e2f0);}(_0x5892,0xfa));var _0x2589=function(_0x5b2c8d,_0x118bf4){_0x5b2c8d=_0x5b2c8d-0x0;var _0x5a1b30=_0x5892[_0x5b2c8d];return _0x5a1b30;};'use strict';var multer=require('multer');var util=require(_0x2589('0x0'));var path=require(_0x2589('0x1'));var timeout=require('connect-timeout');var express=require(_0x2589('0x2'));var router=express[_0x2589('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2589('0x4'));var config=require(_0x2589('0x5'));var controller=require(_0x2589('0x6'));router[_0x2589('0x7')]('/',auth[_0x2589('0x8')](),controller['index']);router[_0x2589('0x7')]('/describe',auth[_0x2589('0x8')](),controller[_0x2589('0x9')]);router[_0x2589('0x7')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller['show']);router[_0x2589('0x7')]('/:id/members',auth[_0x2589('0x8')](),controller[_0x2589('0xb')]);router['get'](_0x2589('0xc'),auth[_0x2589('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0x2589('0x8')](),controller['getAgents']);router[_0x2589('0xd')]('/',auth[_0x2589('0x8')](),controller[_0x2589('0xe')]);router['post'](_0x2589('0xc'),auth[_0x2589('0x8')](),controller[_0x2589('0xf')]);router[_0x2589('0xd')](_0x2589('0x10'),auth[_0x2589('0x8')](),controller['addAgents']);router[_0x2589('0x11')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller[_0x2589('0x12')]);router[_0x2589('0x13')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller[_0x2589('0x14')]);router[_0x2589('0x13')]('/:id/teams',auth[_0x2589('0x8')](),controller[_0x2589('0x15')]);router[_0x2589('0x13')](_0x2589('0x10'),auth[_0x2589('0x8')](),controller[_0x2589('0x16')]);module[_0x2589('0x17')]=router; \ No newline at end of file +var _0xddb8=['/:id/users','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get','isAuthenticated','/:id/members','post','create','/:id/teams','addTeams'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xddb8,0xee));var _0x8ddb=function(_0x368d90,_0x3b9b75){_0x368d90=_0x368d90-0x0;var _0x3ca5f5=_0xddb8[_0x368d90];return _0x3ca5f5;};'use strict';var multer=require(_0x8ddb('0x0'));var util=require(_0x8ddb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ddb('0x2')]();var fs_extra=require(_0x8ddb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8ddb('0x4'));var config=require(_0x8ddb('0x5'));var controller=require(_0x8ddb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ddb('0x7')]);router[_0x8ddb('0x8')]('/describe',auth[_0x8ddb('0x9')](),controller['describe']);router[_0x8ddb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8ddb('0x8')](_0x8ddb('0xa'),auth[_0x8ddb('0x9')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x8ddb('0x9')](),controller['getTeams']);router[_0x8ddb('0x8')]('/:id/users',auth[_0x8ddb('0x9')](),controller['getAgents']);router[_0x8ddb('0xb')]('/',auth['isAuthenticated'](),controller[_0x8ddb('0xc')]);router[_0x8ddb('0xb')](_0x8ddb('0xd'),auth[_0x8ddb('0x9')](),controller[_0x8ddb('0xe')]);router[_0x8ddb('0xb')](_0x8ddb('0xf'),auth[_0x8ddb('0x9')](),controller['addAgents']);router[_0x8ddb('0x10')](_0x8ddb('0x11'),auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x12')]);router[_0x8ddb('0x13')](_0x8ddb('0x11'),auth[_0x8ddb('0x9')](),controller['destroy']);router[_0x8ddb('0x13')]('/:id/teams',auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x14')]);router[_0x8ddb('0x13')]('/:id/users',auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x15')]);module[_0x8ddb('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5b216f6..5b38133 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 _0xe473=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xe473,0x94));var _0x3e47=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe473[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x3e47('0x0'));module[_0x3e47('0x1')]={'name':{'type':Sequelize[_0x3e47('0x2')],'unique':_0x3e47('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e47('0x2')]},'timeout':{'type':Sequelize[_0x3e47('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3e47('0x5'),_0x3e47('0x6'),_0x3e47('0x7'))}}; \ No newline at end of file +var _0x62b2=['roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory','beepall'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x62b2,0x181));var _0x262b=function(_0x58dae7,_0x2a7986){_0x58dae7=_0x58dae7-0x0;var _0x57abc3=_0x62b2[_0x58dae7];return _0x57abc3;};'use strict';var Sequelize=require(_0x262b('0x0'));module[_0x262b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x262b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x262b('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x262b('0x4')](_0x262b('0x5'),_0x262b('0x6'),_0x262b('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2055f50..83ad210 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 _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x2032,0xd9));var _0x2203=function(_0xb429b0,_0x5e2c91){_0xb429b0=_0xb429b0-0x0;var _0x47b017=_0x2032[_0xb429b0];return _0x47b017;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x43020d,_0x214151){var _0x379d07=function(_0x5b843a){while(--_0x5b843a){_0x43020d['push'](_0x43020d['shift']());}};_0x379d07(++_0x214151);}(_0xdb28,0x106));var _0x8db2=function(_0x3fa433,_0x16d93f){_0x3fa433=_0x3fa433-0x0;var _0x2d985b=_0xdb28[_0x3fa433];return _0x2d985b;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 37db387..3dc9c2d 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 _0x9044=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x179fe7,_0x3aa54d){var _0x4d1903=function(_0x57add0){while(--_0x57add0){_0x179fe7['push'](_0x179fe7['shift']());}};_0x4d1903(++_0x3aa54d);}(_0x9044,0xa0));var _0x4904=function(_0x199c44,_0x26e52d){_0x199c44=_0x199c44-0x0;var _0x5325de=_0x9044[_0x199c44];return _0x5325de;};'use strict';var EventEmitter=require(_0x4904('0x0'));var SmsQueue=require(_0x4904('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4904('0x2')](0x0);var events={'afterCreate':_0x4904('0x3'),'afterUpdate':_0x4904('0x4'),'afterDestroy':_0x4904('0x5')};function emitEvent(_0x4e10ac){return function(_0x28df25,_0x506db9,_0x180fd8){SmsQueueEvents['emit'](_0x4e10ac+':'+_0x28df25['id'],_0x28df25);SmsQueueEvents[_0x4904('0x6')](_0x4e10ac,_0x28df25);_0x180fd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x4904('0x7')](e,emitEvent(event));}}module[_0x4904('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x8f59=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x30bd3b,_0x4c2538){var _0x17aacd=function(_0x3d4716){while(--_0x3d4716){_0x30bd3b['push'](_0x30bd3b['shift']());}};_0x17aacd(++_0x4c2538);}(_0x8f59,0x9f));var _0x98f5=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x8f59[_0x419e17];return _0x1f2044;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var SmsQueue=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':_0x98f5('0x6')};function emitEvent(_0x3c097c){return function(_0x3e5a99,_0x525356,_0x210123){SmsQueueEvents[_0x98f5('0x7')](_0x3c097c+':'+_0x3e5a99['id'],_0x3e5a99);SmsQueueEvents[_0x98f5('0x7')](_0x3c097c,_0x3e5a99);_0x210123(null);};}for(var e in events){if(events[_0x98f5('0x8')](e)){var event=events[e];SmsQueue[_0x98f5('0x9')](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 bc1157e..70c0b89 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 _0x5c52=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5c52,0x144));var _0x25c5=function(_0x5a1c83,_0xe777ca){_0x5a1c83=_0x5a1c83-0x0;var _0x393c43=_0x5c52[_0x5a1c83];return _0x393c43;};'use strict';var _=require(_0x25c5('0x0'));var util=require(_0x25c5('0x1'));var logger=require('../../config/logger')(_0x25c5('0x2'));var moment=require(_0x25c5('0x3'));var BPromise=require(_0x25c5('0x4'));var rp=require(_0x25c5('0x5'));var fs=require('fs');var path=require(_0x25c5('0x6'));var rimraf=require(_0x25c5('0x7'));var config=require(_0x25c5('0x8'));var attributes=require(_0x25c5('0x9'));module['exports']=function(_0x57912b,_0x5d2421){return _0x57912b[_0x25c5('0xa')](_0x25c5('0xb'),attributes,{'tableName':_0x25c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c0=['moment','request-promise','../../config/environment','define','SmsQueue','sms_queues','util','../../config/logger'];(function(_0x5b5c52,_0x249992){var _0x161eb0=function(_0x3a9a86){while(--_0x3a9a86){_0x5b5c52['push'](_0x5b5c52['shift']());}};_0x161eb0(++_0x249992);}(_0x58c0,0x1ae));var _0x058c=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x58c0[_0x5c5c52];return _0x4229ff;};'use strict';var _=require('lodash');var util=require(_0x058c('0x0'));var logger=require(_0x058c('0x1'))('api');var moment=require(_0x058c('0x2'));var BPromise=require('bluebird');var rp=require(_0x058c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x058c('0x4'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x38fc76,_0x9c4ddd){return _0x38fc76[_0x058c('0x5')](_0x058c('0x6'),attributes,{'tableName':_0x058c('0x7'),'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 8c3d680..0afe914 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 _0x3df6=['defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','options','raw','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0xbe259,_0x3099c1){var _0x35cdf2=function(_0x147ad5){while(--_0x147ad5){_0xbe259['push'](_0xbe259['shift']());}};_0x35cdf2(++_0x3099c1);}(_0x3df6,0x1f1));var _0x63df=function(_0x1c1d78,_0x7c8495){_0x1c1d78=_0x1c1d78-0x0;var _0x4e369e=_0x3df6[_0x1c1d78];return _0x4e369e;};'use strict';var _=require(_0x63df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x63df('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63df('0x2'));var db=require(_0x63df('0x3'))['db'];var utils=require(_0x63df('0x4'));var logger=require(_0x63df('0x5'))(_0x63df('0x6'));var config=require(_0x63df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63df('0x8')]['http']({'port':0x232a});config[_0x63df('0x9')]=_[_0x63df('0xa')](config[_0x63df('0x9')],{'host':_0x63df('0xb'),'port':0x18eb});var socket=require(_0x63df('0xc'))(new Redis(config[_0x63df('0x9')]));require('./smsQueue.socket')[_0x63df('0xd')](socket);function respondWithRpcPromise(_0x201c81,_0x29058f,_0x1c24bb){return new BPromise(function(_0x5059b2,_0x29acaf){return client[_0x63df('0xe')](_0x201c81,_0x1c24bb)[_0x63df('0xf')](function(_0x2d50f9){logger[_0x63df('0x10')](_0x63df('0x11'),_0x29058f,_0x63df('0x12'));logger['debug'](_0x63df('0x13'),_0x29058f,_0x63df('0x12'),JSON[_0x63df('0x14')](_0x2d50f9));if(_0x2d50f9['error']){if(_0x2d50f9[_0x63df('0x15')][_0x63df('0x16')]===0x1f4){logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x2d50f9[_0x63df('0x15')][_0x63df('0x17')]);return _0x29acaf(_0x2d50f9['error']['message']);}logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x2d50f9['error']['message']);return _0x5059b2(_0x2d50f9['error'][_0x63df('0x17')]);}else{logger[_0x63df('0x10')](_0x63df('0x11'),_0x29058f,_0x63df('0x12'));_0x5059b2(_0x2d50f9[_0x63df('0x18')][_0x63df('0x17')]);}})[_0x63df('0x19')](function(_0x28aba1){logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x28aba1);_0x29acaf(_0x28aba1);});});}exports['GetSmsQueue']=function(_0x3c6e0b){var _0x17af00=this;return new Promise(function(_0x315d28,_0x5d54dd){return db[_0x63df('0x1a')]['findAll']({'raw':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')]['where']||null:null,'attributes':_0x3c6e0b['options']?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1d')]||null:null,'limit':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1e')]||null:null,'include':_0x3c6e0b['options']?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1f')]?_[_0x63df('0x20')](_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1f')],function(_0x59dd20){return{'model':db[_0x59dd20[_0x63df('0x21')]],'as':_0x59dd20['as'],'attributes':_0x59dd20[_0x63df('0x1d')],'include':_0x59dd20[_0x63df('0x1f')]?_['map'](_0x59dd20[_0x63df('0x1f')],function(_0x3e5973){return{'model':db[_0x3e5973['model']],'as':_0x3e5973['as'],'attributes':_0x3e5973[_0x63df('0x1d')],'include':_0x3e5973[_0x63df('0x1f')]?_['map'](_0x3e5973[_0x63df('0x1f')],function(_0x509bff){return{'model':db[_0x509bff['model']],'as':_0x509bff['as'],'attributes':_0x509bff[_0x63df('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x63df('0xf')](function(_0x361f35){logger[_0x63df('0x10')](_0x63df('0x22'),_0x3c6e0b);logger[_0x63df('0x23')](_0x63df('0x22'),_0x3c6e0b,JSON[_0x63df('0x14')](_0x361f35));_0x315d28(_0x361f35);})[_0x63df('0x19')](function(_0x4f5e20){logger[_0x63df('0x15')](_0x63df('0x22'),_0x4f5e20[_0x63df('0x17')],_0x3c6e0b);_0x5d54dd(_0x17af00['error'](0x1f4,_0x4f5e20[_0x63df('0x17')]));});});};exports[_0x63df('0x24')]=function(_0x188845){var _0x3d6b02=this;return new Promise(function(_0x476c81,_0x128cbf){return db[_0x63df('0x1a')][_0x63df('0x25')]({'raw':_0x188845[_0x63df('0x1b')]?_0x188845['options'][_0x63df('0x1c')]===undefined?!![]:![]:!![],'where':_0x188845[_0x63df('0x1b')]?_0x188845[_0x63df('0x1b')][_0x63df('0x26')]||null:null,'attributes':_0x188845[_0x63df('0x1b')]?_0x188845[_0x63df('0x1b')]['attributes']||null:null,'include':_0x188845['options']?_0x188845[_0x63df('0x1b')]['include']?_[_0x63df('0x20')](_0x188845[_0x63df('0x1b')][_0x63df('0x1f')],function(_0x4dfc6a){return{'model':db[_0x4dfc6a[_0x63df('0x21')]],'as':_0x4dfc6a['as'],'attributes':_0x4dfc6a[_0x63df('0x1d')],'include':_0x4dfc6a[_0x63df('0x1f')]?_[_0x63df('0x20')](_0x4dfc6a[_0x63df('0x1f')],function(_0x1dc77a){return{'model':db[_0x1dc77a[_0x63df('0x21')]],'as':_0x1dc77a['as'],'attributes':_0x1dc77a['attributes'],'include':_0x1dc77a['include']?_[_0x63df('0x20')](_0x1dc77a[_0x63df('0x1f')],function(_0x43672b){return{'model':db[_0x43672b[_0x63df('0x21')]],'as':_0x43672b['as'],'attributes':_0x43672b['attributes']};}):[]};}):[]};}):[]:[]})[_0x63df('0xf')](function(_0x951705){logger[_0x63df('0x10')]('ShowSmsQueue',_0x188845);logger[_0x63df('0x23')](_0x63df('0x24'),_0x188845,JSON[_0x63df('0x14')](_0x951705));_0x476c81(_0x951705);})['catch'](function(_0x226fb6){logger[_0x63df('0x15')](_0x63df('0x24'),_0x226fb6['message'],_0x188845);_0x128cbf(_0x3d6b02[_0x63df('0x15')](0x1f4,_0x226fb6['message']));});});}; \ No newline at end of file +var _0x57df=['code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','map','include','model','attributes','find','ShowSmsQueue','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x104740,_0x56a583){var _0x303b51=function(_0x3f4e3c){while(--_0x3f4e3c){_0x104740['push'](_0x104740['shift']());}};_0x303b51(++_0x56a583);}(_0x57df,0xc0));var _0xf57d=function(_0x169e1d,_0x16f8c2){_0x169e1d=_0x169e1d-0x0;var _0x1b4689=_0x57df[_0x169e1d];return _0x1b4689;};'use strict';var _=require(_0xf57d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf57d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf57d('0x2'))['db'];var utils=require(_0xf57d('0x3'));var logger=require('../../config/logger')(_0xf57d('0x4'));var config=require(_0xf57d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf57d('0x6')]({'port':0x232a});config[_0xf57d('0x7')]=_['defaults'](config[_0xf57d('0x7')],{'host':_0xf57d('0x8'),'port':0x18eb});var socket=require(_0xf57d('0x9'))(new Redis(config[_0xf57d('0x7')]));require('./smsQueue.socket')[_0xf57d('0xa')](socket);function respondWithRpcPromise(_0x5a69a9,_0x55ab4a,_0x371ad9){return new BPromise(function(_0x1cf01b,_0x537828){return client['request'](_0x5a69a9,_0x371ad9)[_0xf57d('0xb')](function(_0x185c08){logger['info'](_0xf57d('0xc'),_0x55ab4a,_0xf57d('0xd'));logger[_0xf57d('0xe')](_0xf57d('0xf'),_0x55ab4a,_0xf57d('0xd'),JSON[_0xf57d('0x10')](_0x185c08));if(_0x185c08[_0xf57d('0x11')]){if(_0x185c08[_0xf57d('0x11')][_0xf57d('0x12')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x55ab4a,_0x185c08[_0xf57d('0x11')][_0xf57d('0x13')]);return _0x537828(_0x185c08['error'][_0xf57d('0x13')]);}logger[_0xf57d('0x11')](_0xf57d('0xc'),_0x55ab4a,_0x185c08['error'][_0xf57d('0x13')]);return _0x1cf01b(_0x185c08[_0xf57d('0x11')]['message']);}else{logger[_0xf57d('0x14')](_0xf57d('0xc'),_0x55ab4a,_0xf57d('0xd'));_0x1cf01b(_0x185c08[_0xf57d('0x15')][_0xf57d('0x13')]);}})[_0xf57d('0x16')](function(_0x52e959){logger[_0xf57d('0x11')](_0xf57d('0xc'),_0x55ab4a,_0x52e959);_0x537828(_0x52e959);});});}exports[_0xf57d('0x17')]=function(_0x36d041){var _0x1a41c4=this;return new Promise(function(_0x42cbc4,_0x6729c3){return db[_0xf57d('0x18')][_0xf57d('0x19')]({'raw':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')][_0xf57d('0x1b')]===undefined?!![]:![]:!![],'where':_0x36d041[_0xf57d('0x1a')]?_0x36d041['options'][_0xf57d('0x1c')]||null:null,'attributes':_0x36d041['options']?_0x36d041[_0xf57d('0x1a')]['attributes']||null:null,'limit':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')]['limit']||null:null,'include':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')]['include']?_[_0xf57d('0x1d')](_0x36d041['options'][_0xf57d('0x1e')],function(_0x34768f){return{'model':db[_0x34768f[_0xf57d('0x1f')]],'as':_0x34768f['as'],'attributes':_0x34768f['attributes'],'include':_0x34768f['include']?_[_0xf57d('0x1d')](_0x34768f[_0xf57d('0x1e')],function(_0x1bbd16){return{'model':db[_0x1bbd16[_0xf57d('0x1f')]],'as':_0x1bbd16['as'],'attributes':_0x1bbd16[_0xf57d('0x20')],'include':_0x1bbd16[_0xf57d('0x1e')]?_[_0xf57d('0x1d')](_0x1bbd16[_0xf57d('0x1e')],function(_0x32fdac){return{'model':db[_0x32fdac['model']],'as':_0x32fdac['as'],'attributes':_0x32fdac[_0xf57d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1649e8){logger['info'](_0xf57d('0x17'),_0x36d041);logger[_0xf57d('0xe')](_0xf57d('0x17'),_0x36d041,JSON[_0xf57d('0x10')](_0x1649e8));_0x42cbc4(_0x1649e8);})['catch'](function(_0x240b3e){logger[_0xf57d('0x11')](_0xf57d('0x17'),_0x240b3e['message'],_0x36d041);_0x6729c3(_0x1a41c4['error'](0x1f4,_0x240b3e[_0xf57d('0x13')]));});});};exports['ShowSmsQueue']=function(_0x4b8c65){var _0x827bae=this;return new Promise(function(_0x1645c5,_0x96e5d8){return db[_0xf57d('0x18')][_0xf57d('0x21')]({'raw':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65['options'][_0xf57d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65[_0xf57d('0x1a')][_0xf57d('0x1c')]||null:null,'attributes':_0x4b8c65['options']?_0x4b8c65[_0xf57d('0x1a')]['attributes']||null:null,'include':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65[_0xf57d('0x1a')]['include']?_[_0xf57d('0x1d')](_0x4b8c65['options'][_0xf57d('0x1e')],function(_0x235c2a){return{'model':db[_0x235c2a[_0xf57d('0x1f')]],'as':_0x235c2a['as'],'attributes':_0x235c2a[_0xf57d('0x20')],'include':_0x235c2a[_0xf57d('0x1e')]?_['map'](_0x235c2a['include'],function(_0x1993c4){return{'model':db[_0x1993c4[_0xf57d('0x1f')]],'as':_0x1993c4['as'],'attributes':_0x1993c4[_0xf57d('0x20')],'include':_0x1993c4[_0xf57d('0x1e')]?_[_0xf57d('0x1d')](_0x1993c4['include'],function(_0x53c005){return{'model':db[_0x53c005['model']],'as':_0x53c005['as'],'attributes':_0x53c005[_0xf57d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf57d('0xb')](function(_0x18e64c){logger[_0xf57d('0x14')](_0xf57d('0x22'),_0x4b8c65);logger[_0xf57d('0xe')](_0xf57d('0x22'),_0x4b8c65,JSON[_0xf57d('0x10')](_0x18e64c));_0x1645c5(_0x18e64c);})[_0xf57d('0x16')](function(_0x4e8626){logger[_0xf57d('0x11')](_0xf57d('0x22'),_0x4e8626[_0xf57d('0x13')],_0x4b8c65);_0x96e5d8(_0x827bae[_0xf57d('0x11')](0x1f4,_0x4e8626[_0xf57d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 382bcd6..ea5a760 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 _0x4b9f=['./smsQueue.events','save','remove','register','smsQueue:'];(function(_0x5c10f7,_0x1f47fc){var _0x2427fd=function(_0x166203){while(--_0x166203){_0x5c10f7['push'](_0x5c10f7['shift']());}};_0x2427fd(++_0x1f47fc);}(_0x4b9f,0xaf));var _0xf4b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b9f[_0x17d9e3];return _0x14192d;};'use strict';var SmsQueueEvents=require(_0xf4b9('0x0'));var events=[_0xf4b9('0x1'),_0xf4b9('0x2'),'update'];function createListener(_0x2ac036,_0x5a4067){return function(_0x35e75e){_0x5a4067['emit'](_0x2ac036,_0x35e75e);};}function removeListener(_0x55c66d,_0x2bcf9c){return function(){SmsQueueEvents['removeListener'](_0x55c66d,_0x2bcf9c);};}exports[_0xf4b9('0x3')]=function(_0x5e3d53){for(var _0x529f67=0x0,_0x433598=events['length'];_0x529f67<_0x433598;_0x529f67++){var _0xb63866=events[_0x529f67];var _0x3eedf3=createListener(_0xf4b9('0x4')+_0xb63866,_0x5e3d53);SmsQueueEvents['on'](_0xb63866,_0x3eedf3);}}; \ No newline at end of file +var _0x09dd=['smsQueue:','./smsQueue.events','remove','emit','register'];(function(_0x4cb6e1,_0x6d5c3){var _0x1b8e77=function(_0x294d86){while(--_0x294d86){_0x4cb6e1['push'](_0x4cb6e1['shift']());}};_0x1b8e77(++_0x6d5c3);}(_0x09dd,0xd8));var _0xd09d=function(_0x5a3785,_0x2de636){_0x5a3785=_0x5a3785-0x0;var _0x4d058a=_0x09dd[_0x5a3785];return _0x4d058a;};'use strict';var SmsQueueEvents=require(_0xd09d('0x0'));var events=['save',_0xd09d('0x1'),'update'];function createListener(_0x369ae4,_0x5deaf0){return function(_0x2cf0bf){_0x5deaf0[_0xd09d('0x2')](_0x369ae4,_0x2cf0bf);};}function removeListener(_0x538661,_0x2f76cc){return function(){SmsQueueEvents['removeListener'](_0x538661,_0x2f76cc);};}exports[_0xd09d('0x3')]=function(_0x54e61a){for(var _0x2c9dfb=0x0,_0x3ac9ae=events['length'];_0x2c9dfb<_0x3ac9ae;_0x2c9dfb++){var _0x31fdcf=events[_0x2c9dfb];var _0x2f029c=createListener(_0xd09d('0x4')+_0x31fdcf,_0x54e61a);SmsQueueEvents['on'](_0x31fdcf,_0x2f029c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 63ed9cc..540e965 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 _0x048f=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x048f,0xcd));var _0xf048=function(_0x532356,_0x418194){_0x532356=_0x532356-0x0;var _0x24e437=_0x048f[_0x532356];return _0x24e437;};'use strict';var multer=require(_0xf048('0x0'));var util=require(_0xf048('0x1'));var path=require(_0xf048('0x2'));var timeout=require(_0xf048('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf048('0x4'));var auth=require(_0xf048('0x5'));var interaction=require(_0xf048('0x6'));var config=require(_0xf048('0x7'));var controller=require(_0xf048('0x8'));router[_0xf048('0x9')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0xb')]);router[_0xf048('0x9')](_0xf048('0xc'),auth[_0xf048('0xa')](),controller[_0xf048('0xd')]);router['get'](_0xf048('0xe'),auth['isAuthenticated'](),controller[_0xf048('0xf')]);router[_0xf048('0x10')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0x11')]);router[_0xf048('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf048('0x13')]);router[_0xf048('0x14')](_0xf048('0xe'),auth[_0xf048('0xa')](),controller['destroy']);module[_0xf048('0x15')]=router; \ No newline at end of file +var _0x6b24=['/:id','show','post','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1dfd1d,_0x305800){var _0x26d4d1=function(_0x3d1218){while(--_0x3d1218){_0x1dfd1d['push'](_0x1dfd1d['shift']());}};_0x26d4d1(++_0x305800);}(_0x6b24,0xf7));var _0x46b2=function(_0x19cf7a,_0x1dd21e){_0x19cf7a=_0x19cf7a-0x0;var _0x1a75bb=_0x6b24[_0x19cf7a];return _0x1a75bb;};'use strict';var multer=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var path=require(_0x46b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46b2('0x3')]();var fs_extra=require(_0x46b2('0x4'));var auth=require(_0x46b2('0x5'));var interaction=require(_0x46b2('0x6'));var config=require(_0x46b2('0x7'));var controller=require('./smsQueueReport.controller');router[_0x46b2('0x8')]('/',auth[_0x46b2('0x9')](),controller[_0x46b2('0xa')]);router[_0x46b2('0x8')](_0x46b2('0xb'),auth['isAuthenticated'](),controller[_0x46b2('0xc')]);router[_0x46b2('0x8')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0xe')]);router[_0x46b2('0xf')]('/',auth[_0x46b2('0x9')](),controller['create']);router['put']('/:id',auth[_0x46b2('0x9')](),controller[_0x46b2('0x10')]);router[_0x46b2('0x11')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0x12')]);module[_0x46b2('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 f0f09a1..aa30e75 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 _0x6ac8=['STRING','DATE','sequelize'];(function(_0x42bffc,_0x29eaee){var _0x1e4d17=function(_0x2aaa4b){while(--_0x2aaa4b){_0x42bffc['push'](_0x42bffc['shift']());}};_0x1e4d17(++_0x29eaee);}(_0x6ac8,0x83));var _0x86ac=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6ac8[_0x387777];return _0x3f84c0;};'use strict';var moment=require('moment');var Sequelize=require(_0x86ac('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x86ac('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x86ac('0x2')]},'leaveAt':{'type':Sequelize[_0x86ac('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x86ac('0x1')]}}; \ No newline at end of file +var _0x6a47=['moment','sequelize','exports','STRING','DATE'];(function(_0xaecb42,_0xd0e70d){var _0x491972=function(_0x365f84){while(--_0x365f84){_0xaecb42['push'](_0xaecb42['shift']());}};_0x491972(++_0xd0e70d);}(_0x6a47,0x16d));var _0x76a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a47[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x76a4('0x0'));var Sequelize=require(_0x76a4('0x1'));module[_0x76a4('0x2')]={'uniqueid':{'type':Sequelize[_0x76a4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x76a4('0x3')]},'joinAt':{'type':Sequelize[_0x76a4('0x4')]},'leaveAt':{'type':Sequelize[_0x76a4('0x4')]},'acceptAt':{'type':Sequelize[_0x76a4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x76a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a9b8b5a..7fd598e 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 _0x1f00=['update','then','destroy','end','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','create','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','offset','count','Content-Range','reject','save'];(function(_0x11b6d6,_0xe371ec){var _0x2710df=function(_0x3c6fdc){while(--_0x3c6fdc){_0x11b6d6['push'](_0x11b6d6['shift']());}};_0x2710df(++_0xe371ec);}(_0x1f00,0x15a));var _0x01f0=function(_0x1aa797,_0xf1b372){_0x1aa797=_0x1aa797-0x0;var _0x4c89d9=_0x1f00[_0x1aa797];return _0x4c89d9;};'use strict';var emlformat=require(_0x01f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01f0('0x1'));var jsonpatch=require(_0x01f0('0x2'));var rp=require('request-promise');var moment=require(_0x01f0('0x3'));var BPromise=require(_0x01f0('0x4'));var Mustache=require('mustache');var util=require(_0x01f0('0x5'));var path=require('path');var sox=require(_0x01f0('0x6'));var csv=require(_0x01f0('0x7'));var ejs=require(_0x01f0('0x8'));var fs=require('fs');var fs_extra=require(_0x01f0('0x9'));var _=require('lodash');var squel=require(_0x01f0('0xa'));var crypto=require('crypto');var jsforce=require(_0x01f0('0xb'));var deskjs=require(_0x01f0('0xc'));var toCsv=require(_0x01f0('0x7'));var querystring=require(_0x01f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x01f0('0xe'));var authService=require(_0x01f0('0xf'));var qs=require(_0x01f0('0x10'));var as=require(_0x01f0('0x11'));var hardwareService=require(_0x01f0('0x12'));var logger=require(_0x01f0('0x13'))(_0x01f0('0x14'));var utils=require(_0x01f0('0x15'));var config=require(_0x01f0('0x16'));var licenseUtil=require(_0x01f0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbda5c2,_0x12179d){_0x12179d=_0x12179d||0xcc;return function(_0x2e7096){if(_0x2e7096){return _0xbda5c2[_0x01f0('0x18')](_0x12179d);}return _0xbda5c2[_0x01f0('0x19')](_0x12179d)['end']();};}function respondWithResult(_0x39b415,_0x4b3c68){_0x4b3c68=_0x4b3c68||0xc8;return function(_0x5307d4){if(_0x5307d4){return _0x39b415[_0x01f0('0x19')](_0x4b3c68)[_0x01f0('0x1a')](_0x5307d4);}};}function respondWithFilteredResult(_0x2194b2,_0x2ee895){return function(_0x588c26){if(_0x588c26){var _0x14a056=typeof _0x2ee895['offset']==='undefined'&&typeof _0x2ee895[_0x01f0('0x1b')]===_0x01f0('0x1c');var _0x227e25=_0x588c26['count'];var _0x622f89=_0x14a056?0x0:_0x2ee895[_0x01f0('0x1d')];var _0x1e7b87=_0x14a056?_0x588c26[_0x01f0('0x1e')]:_0x2ee895[_0x01f0('0x1d')]+_0x2ee895[_0x01f0('0x1b')];var _0x25e7f5;if(_0x1e7b87>=_0x227e25){_0x1e7b87=_0x227e25;_0x25e7f5=0xc8;}else{_0x25e7f5=0xce;}_0x2194b2[_0x01f0('0x19')](_0x25e7f5);return _0x2194b2['set'](_0x01f0('0x1f'),_0x622f89+'-'+_0x1e7b87+'/'+_0x227e25)[_0x01f0('0x1a')](_0x588c26);}return null;};}function patchUpdates(_0x1f01b3){return function(_0x5ccb7b){try{jsonpatch['apply'](_0x5ccb7b,_0x1f01b3,!![]);}catch(_0x30e61a){return BPromise[_0x01f0('0x20')](_0x30e61a);}return _0x5ccb7b[_0x01f0('0x21')]();};}function saveUpdates(_0x4b5082,_0x49ef30){return function(_0x3f6c0d){if(_0x3f6c0d){return _0x3f6c0d[_0x01f0('0x22')](_0x4b5082)[_0x01f0('0x23')](function(_0x3f67a8){return _0x3f67a8;});}return null;};}function removeEntity(_0x2d05ba,_0x15f74b){return function(_0x1e9757){if(_0x1e9757){return _0x1e9757[_0x01f0('0x24')]()['then'](function(){_0x2d05ba[_0x01f0('0x19')](0xcc)[_0x01f0('0x25')]();});}};}function handleEntityNotFound(_0xd18a77,_0x4d5692){return function(_0x3375ba){if(!_0x3375ba){_0xd18a77[_0x01f0('0x18')](0x194);}return _0x3375ba;};}function handleError(_0x1e75c6,_0xe615b5){_0xe615b5=_0xe615b5||0x1f4;return function(_0x46d4df){logger[_0x01f0('0x26')](_0x46d4df[_0x01f0('0x27')]);if(_0x46d4df['name']){delete _0x46d4df[_0x01f0('0x28')];}_0x1e75c6[_0x01f0('0x19')](_0xe615b5)[_0x01f0('0x29')](_0x46d4df);};}exports[_0x01f0('0x2a')]=function(_0xac796d,_0x1ae9f7){var _0x95f7c6={},_0x14a298={},_0x1b99f8={'count':0x0,'rows':[]};var _0x1f68b4=_[_0x01f0('0x2b')](db[_0x01f0('0x2c')][_0x01f0('0x2d')],function(_0x5ae2d6){return{'name':_0x5ae2d6[_0x01f0('0x2e')],'type':_0x5ae2d6[_0x01f0('0x2f')]['key']};});_0x14a298[_0x01f0('0x30')]=_[_0x01f0('0x2b')](_0x1f68b4,_0x01f0('0x28'));_0x14a298['query']=_['keys'](_0xac796d['query']);_0x14a298['filters']=_[_0x01f0('0x31')](_0x14a298[_0x01f0('0x30')],_0x14a298['query']);_0x95f7c6['attributes']=_[_0x01f0('0x31')](_0x14a298[_0x01f0('0x30')],qs[_0x01f0('0x32')](_0xac796d['query'][_0x01f0('0x32')]));_0x95f7c6['attributes']=_0x95f7c6[_0x01f0('0x33')][_0x01f0('0x34')]?_0x95f7c6[_0x01f0('0x33')]:_0x14a298[_0x01f0('0x30')];if(!_0xac796d['query'][_0x01f0('0x35')](_0x01f0('0x36'))){_0x95f7c6[_0x01f0('0x1b')]=qs[_0x01f0('0x1b')](_0xac796d[_0x01f0('0x37')]['limit']);_0x95f7c6['offset']=qs[_0x01f0('0x1d')](_0xac796d[_0x01f0('0x37')][_0x01f0('0x1d')]);}_0x95f7c6['order']=qs[_0x01f0('0x38')](_0xac796d['query'][_0x01f0('0x38')]);_0x95f7c6[_0x01f0('0x39')]=qs[_0x01f0('0x3a')](_[_0x01f0('0x3b')](_0xac796d[_0x01f0('0x37')],_0x14a298[_0x01f0('0x3a')]),_0x1f68b4);if(_0xac796d[_0x01f0('0x37')][_0x01f0('0x3c')]){_0x95f7c6[_0x01f0('0x39')]=_[_0x01f0('0x3d')](_0x95f7c6['where'],{'$or':_[_0x01f0('0x2b')](_0x1f68b4,function(_0x41930b){if(_0x41930b[_0x01f0('0x2f')]!==_0x01f0('0x3e')){var _0x127739={};_0x127739[_0x41930b['name']]={'$like':'%'+_0xac796d[_0x01f0('0x37')][_0x01f0('0x3c')]+'%'};return _0x127739;}})});}_0x95f7c6=_[_0x01f0('0x3d')]({},_0x95f7c6,_0xac796d['options']);var _0x2ae3a5={'where':_0x95f7c6[_0x01f0('0x39')]};return db[_0x01f0('0x2c')]['count'](_0x2ae3a5)[_0x01f0('0x23')](function(_0x39b7d1){_0x1b99f8[_0x01f0('0x1e')]=_0x39b7d1;if(_0xac796d['query'][_0x01f0('0x3f')]){_0x95f7c6[_0x01f0('0x40')]=[{'all':!![]}];}return db[_0x01f0('0x2c')][_0x01f0('0x41')](_0x95f7c6);})['then'](function(_0x5bc1eb){_0x1b99f8[_0x01f0('0x42')]=_0x5bc1eb;return _0x1b99f8;})[_0x01f0('0x23')](respondWithFilteredResult(_0x1ae9f7,_0x95f7c6))['catch'](handleError(_0x1ae9f7,null));};exports[_0x01f0('0x43')]=function(_0x196c49,_0x564f26){var _0x52d422={'raw':!![],'where':{'id':_0x196c49[_0x01f0('0x44')]['id']}},_0x19c94b={};_0x19c94b[_0x01f0('0x30')]=_[_0x01f0('0x45')](db['SmsQueueReport'][_0x01f0('0x2d')]);_0x19c94b[_0x01f0('0x37')]=_[_0x01f0('0x45')](_0x196c49['query']);_0x19c94b[_0x01f0('0x3a')]=_[_0x01f0('0x31')](_0x19c94b[_0x01f0('0x30')],_0x19c94b[_0x01f0('0x37')]);_0x52d422[_0x01f0('0x33')]=_[_0x01f0('0x31')](_0x19c94b[_0x01f0('0x30')],qs[_0x01f0('0x32')](_0x196c49[_0x01f0('0x37')][_0x01f0('0x32')]));_0x52d422[_0x01f0('0x33')]=_0x52d422[_0x01f0('0x33')][_0x01f0('0x34')]?_0x52d422['attributes']:_0x19c94b['model'];if(_0x196c49[_0x01f0('0x37')][_0x01f0('0x3f')]){_0x52d422['include']=[{'all':!![]}];}_0x52d422=_[_0x01f0('0x3d')]({},_0x52d422,_0x196c49[_0x01f0('0x46')]);return db[_0x01f0('0x2c')]['find'](_0x52d422)[_0x01f0('0x23')](handleEntityNotFound(_0x564f26,null))[_0x01f0('0x23')](respondWithResult(_0x564f26,null))['catch'](handleError(_0x564f26,null));};exports[_0x01f0('0x47')]=function(_0x207d0b,_0x3038b9){return db[_0x01f0('0x2c')][_0x01f0('0x47')](_0x207d0b['body'],{})[_0x01f0('0x23')](respondWithResult(_0x3038b9,0xc9))[_0x01f0('0x48')](handleError(_0x3038b9,null));};exports[_0x01f0('0x22')]=function(_0x31c548,_0x15a9f1){if(_0x31c548[_0x01f0('0x49')]['id']){delete _0x31c548['body']['id'];}return db[_0x01f0('0x2c')][_0x01f0('0x4a')]({'where':{'id':_0x31c548[_0x01f0('0x44')]['id']}})['then'](handleEntityNotFound(_0x15a9f1,null))['then'](saveUpdates(_0x31c548[_0x01f0('0x49')],null))[_0x01f0('0x23')](respondWithResult(_0x15a9f1,null))['catch'](handleError(_0x15a9f1,null));};exports['destroy']=function(_0x3e93ee,_0x3bbac3){return db[_0x01f0('0x2c')][_0x01f0('0x4a')]({'where':{'id':_0x3e93ee['params']['id']}})['then'](handleEntityNotFound(_0x3bbac3,null))[_0x01f0('0x23')](removeEntity(_0x3bbac3,null))['catch'](handleError(_0x3bbac3,null));};exports[_0x01f0('0x4b')]=function(_0x6b1d73,_0x457d1c){return db[_0x01f0('0x2c')][_0x01f0('0x4b')]()[_0x01f0('0x23')](respondWithResult(_0x457d1c,null))[_0x01f0('0x48')](handleError(_0x457d1c,null));}; \ No newline at end of file +var _0x8e7c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','where','filter','SmsQueueReport','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8e7c,0xc2));var _0xc8e7=function(_0x1b3df5,_0x2e2fb0){_0x1b3df5=_0x1b3df5-0x0;var _0x12f463=_0x8e7c[_0x1b3df5];return _0x12f463;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8e7('0x1'));var rp=require(_0xc8e7('0x2'));var moment=require(_0xc8e7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc8e7('0x4'));var util=require(_0xc8e7('0x5'));var path=require(_0xc8e7('0x6'));var sox=require(_0xc8e7('0x7'));var csv=require(_0xc8e7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8e7('0x9'));var crypto=require(_0xc8e7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc8e7('0xb'));var toCsv=require(_0xc8e7('0x8'));var querystring=require(_0xc8e7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc8e7('0xd'));var qs=require(_0xc8e7('0xe'));var as=require(_0xc8e7('0xf'));var hardwareService=require(_0xc8e7('0x10'));var logger=require(_0xc8e7('0x11'))(_0xc8e7('0x12'));var utils=require(_0xc8e7('0x13'));var config=require(_0xc8e7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8e7('0x15'))['db'];function respondWithStatusCode(_0x7b5d4e,_0x19dd73){_0x19dd73=_0x19dd73||0xcc;return function(_0x20634f){if(_0x20634f){return _0x7b5d4e[_0xc8e7('0x16')](_0x19dd73);}return _0x7b5d4e['status'](_0x19dd73)['end']();};}function respondWithResult(_0x59ed80,_0x1ae1f7){_0x1ae1f7=_0x1ae1f7||0xc8;return function(_0x3d0e27){if(_0x3d0e27){return _0x59ed80[_0xc8e7('0x17')](_0x1ae1f7)['json'](_0x3d0e27);}};}function respondWithFilteredResult(_0x405725,_0x1ae18b){return function(_0x40200f){if(_0x40200f){var _0x4a5df8=typeof _0x1ae18b[_0xc8e7('0x18')]===_0xc8e7('0x19')&&typeof _0x1ae18b[_0xc8e7('0x1a')]===_0xc8e7('0x19');var _0x14ba18=_0x40200f[_0xc8e7('0x1b')];var _0x57c598=_0x4a5df8?0x0:_0x1ae18b[_0xc8e7('0x18')];var _0x58d6b5=_0x4a5df8?_0x40200f['count']:_0x1ae18b['offset']+_0x1ae18b['limit'];var _0x2f85aa;if(_0x58d6b5>=_0x14ba18){_0x58d6b5=_0x14ba18;_0x2f85aa=0xc8;}else{_0x2f85aa=0xce;}_0x405725[_0xc8e7('0x17')](_0x2f85aa);return _0x405725[_0xc8e7('0x1c')](_0xc8e7('0x1d'),_0x57c598+'-'+_0x58d6b5+'/'+_0x14ba18)[_0xc8e7('0x1e')](_0x40200f);}return null;};}function patchUpdates(_0x1257c0){return function(_0x51aa8e){try{jsonpatch[_0xc8e7('0x1f')](_0x51aa8e,_0x1257c0,!![]);}catch(_0x2e1aed){return BPromise[_0xc8e7('0x20')](_0x2e1aed);}return _0x51aa8e[_0xc8e7('0x21')]();};}function saveUpdates(_0x5ce44d,_0x343272){return function(_0x1926ff){if(_0x1926ff){return _0x1926ff[_0xc8e7('0x22')](_0x5ce44d)[_0xc8e7('0x23')](function(_0x3cac96){return _0x3cac96;});}return null;};}function removeEntity(_0xc7c40c,_0xdb87a4){return function(_0x33e38d){if(_0x33e38d){return _0x33e38d['destroy']()[_0xc8e7('0x23')](function(){_0xc7c40c['status'](0xcc)[_0xc8e7('0x24')]();});}};}function handleEntityNotFound(_0xfe145f,_0x341f24){return function(_0x35924b){if(!_0x35924b){_0xfe145f[_0xc8e7('0x16')](0x194);}return _0x35924b;};}function handleError(_0x203d8c,_0x3a3d71){_0x3a3d71=_0x3a3d71||0x1f4;return function(_0x3d1694){logger['error'](_0x3d1694[_0xc8e7('0x25')]);if(_0x3d1694[_0xc8e7('0x26')]){delete _0x3d1694[_0xc8e7('0x26')];}_0x203d8c[_0xc8e7('0x17')](_0x3a3d71)['send'](_0x3d1694);};}exports[_0xc8e7('0x27')]=function(_0x559ac2,_0x411414){var _0x3a88eb={},_0x8ef0dd={},_0x2b2210={'count':0x0,'rows':[]};var _0x2b293f=_[_0xc8e7('0x28')](db['SmsQueueReport']['rawAttributes'],function(_0x2a81fa){return{'name':_0x2a81fa[_0xc8e7('0x29')],'type':_0x2a81fa[_0xc8e7('0x2a')][_0xc8e7('0x2b')]};});_0x8ef0dd[_0xc8e7('0x2c')]=_[_0xc8e7('0x28')](_0x2b293f,_0xc8e7('0x26'));_0x8ef0dd[_0xc8e7('0x2d')]=_[_0xc8e7('0x2e')](_0x559ac2[_0xc8e7('0x2d')]);_0x8ef0dd[_0xc8e7('0x2f')]=_['intersection'](_0x8ef0dd[_0xc8e7('0x2c')],_0x8ef0dd['query']);_0x3a88eb[_0xc8e7('0x30')]=_[_0xc8e7('0x31')](_0x8ef0dd[_0xc8e7('0x2c')],qs[_0xc8e7('0x32')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x32')]));_0x3a88eb[_0xc8e7('0x30')]=_0x3a88eb[_0xc8e7('0x30')][_0xc8e7('0x33')]?_0x3a88eb['attributes']:_0x8ef0dd[_0xc8e7('0x2c')];if(!_0x559ac2[_0xc8e7('0x2d')]['hasOwnProperty'](_0xc8e7('0x34'))){_0x3a88eb['limit']=qs['limit'](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x1a')]);_0x3a88eb[_0xc8e7('0x18')]=qs[_0xc8e7('0x18')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x18')]);}_0x3a88eb[_0xc8e7('0x35')]=qs[_0xc8e7('0x36')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x36')]);_0x3a88eb['where']=qs[_0xc8e7('0x2f')](_[_0xc8e7('0x37')](_0x559ac2[_0xc8e7('0x2d')],_0x8ef0dd[_0xc8e7('0x2f')]),_0x2b293f);if(_0x559ac2['query']['filter']){_0x3a88eb['where']=_[_0xc8e7('0x38')](_0x3a88eb[_0xc8e7('0x39')],{'$or':_[_0xc8e7('0x28')](_0x2b293f,function(_0x2169c2){if(_0x2169c2[_0xc8e7('0x2a')]!=='VIRTUAL'){var _0x53943d={};_0x53943d[_0x2169c2[_0xc8e7('0x26')]]={'$like':'%'+_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x3a')]+'%'};return _0x53943d;}})});}_0x3a88eb=_[_0xc8e7('0x38')]({},_0x3a88eb,_0x559ac2['options']);var _0x282e93={'where':_0x3a88eb[_0xc8e7('0x39')]};return db[_0xc8e7('0x3b')][_0xc8e7('0x1b')](_0x282e93)['then'](function(_0x17d991){_0x2b2210[_0xc8e7('0x1b')]=_0x17d991;if(_0x559ac2[_0xc8e7('0x2d')]['includeAll']){_0x3a88eb[_0xc8e7('0x3c')]=[{'all':!![]}];}return db[_0xc8e7('0x3b')][_0xc8e7('0x3d')](_0x3a88eb);})[_0xc8e7('0x23')](function(_0x2b859a){_0x2b2210[_0xc8e7('0x3e')]=_0x2b859a;return _0x2b2210;})[_0xc8e7('0x23')](respondWithFilteredResult(_0x411414,_0x3a88eb))[_0xc8e7('0x3f')](handleError(_0x411414,null));};exports['show']=function(_0x386c87,_0x73d63d){var _0xcd0c6a={'raw':!![],'where':{'id':_0x386c87[_0xc8e7('0x40')]['id']}},_0x402fd8={};_0x402fd8[_0xc8e7('0x2c')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x402fd8['query']=_[_0xc8e7('0x2e')](_0x386c87['query']);_0x402fd8[_0xc8e7('0x2f')]=_[_0xc8e7('0x31')](_0x402fd8[_0xc8e7('0x2c')],_0x402fd8[_0xc8e7('0x2d')]);_0xcd0c6a[_0xc8e7('0x30')]=_[_0xc8e7('0x31')](_0x402fd8[_0xc8e7('0x2c')],qs[_0xc8e7('0x32')](_0x386c87[_0xc8e7('0x2d')][_0xc8e7('0x32')]));_0xcd0c6a['attributes']=_0xcd0c6a[_0xc8e7('0x30')]['length']?_0xcd0c6a[_0xc8e7('0x30')]:_0x402fd8[_0xc8e7('0x2c')];if(_0x386c87[_0xc8e7('0x2d')][_0xc8e7('0x41')]){_0xcd0c6a[_0xc8e7('0x3c')]=[{'all':!![]}];}_0xcd0c6a=_['merge']({},_0xcd0c6a,_0x386c87[_0xc8e7('0x42')]);return db[_0xc8e7('0x3b')][_0xc8e7('0x43')](_0xcd0c6a)['then'](handleEntityNotFound(_0x73d63d,null))[_0xc8e7('0x23')](respondWithResult(_0x73d63d,null))[_0xc8e7('0x3f')](handleError(_0x73d63d,null));};exports[_0xc8e7('0x44')]=function(_0x122371,_0x54b3f7){return db[_0xc8e7('0x3b')]['create'](_0x122371[_0xc8e7('0x45')],{})[_0xc8e7('0x23')](respondWithResult(_0x54b3f7,0xc9))[_0xc8e7('0x3f')](handleError(_0x54b3f7,null));};exports['update']=function(_0xda44cd,_0x24579f){if(_0xda44cd['body']['id']){delete _0xda44cd['body']['id'];}return db[_0xc8e7('0x3b')][_0xc8e7('0x43')]({'where':{'id':_0xda44cd['params']['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x24579f,null))['then'](saveUpdates(_0xda44cd[_0xc8e7('0x45')],null))[_0xc8e7('0x23')](respondWithResult(_0x24579f,null))[_0xc8e7('0x3f')](handleError(_0x24579f,null));};exports['destroy']=function(_0x14855f,_0x275659){return db[_0xc8e7('0x3b')][_0xc8e7('0x43')]({'where':{'id':_0x14855f[_0xc8e7('0x40')]['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x275659,null))[_0xc8e7('0x23')](removeEntity(_0x275659,null))[_0xc8e7('0x3f')](handleError(_0x275659,null));};exports[_0xc8e7('0x46')]=function(_0x129123,_0x5e0672){return db[_0xc8e7('0x3b')][_0xc8e7('0x46')]()['then'](respondWithResult(_0x5e0672,null))[_0xc8e7('0x3f')](handleError(_0x5e0672,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ea8279c..6687c75 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e19dd,_0x4973e2){var _0x2e334e=function(_0x5c5f0e){while(--_0x5c5f0e){_0x2e19dd['push'](_0x2e19dd['shift']());}};_0x2e334e(++_0x4973e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_0xe706,0xa3));var _0x6e70=function(_0x423eba,_0xb6826c){_0x423eba=_0x423eba-0x0;var _0x138f29=_0xe706[_0x423eba];return _0x138f29;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4e8a7fd..66aa512 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 _0xc99f=['../../mysqldb','rpc','jayson/promise','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsQueueReport,\x20%s,\x20%s','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then','UpdateSmsQueueReport','body','attributes','limit','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xc99f,0x15a));var _0xfc99=function(_0x3e3064,_0x3dd6f5){_0x3e3064=_0x3e3064-0x0;var _0x4547e1=_0xc99f[_0x3e3064];return _0x4547e1;};'use strict';var _=require('lodash');var util=require(_0xfc99('0x0'));var moment=require(_0xfc99('0x1'));var BPromise=require(_0xfc99('0x2'));var rs=require(_0xfc99('0x3'));var fs=require('fs');var Redis=require(_0xfc99('0x4'));var db=require(_0xfc99('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc99('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc99('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37cc79,_0xdc674a,_0x1028ac){return new BPromise(function(_0x353132,_0x117a5d){return client['request'](_0x37cc79,_0x1028ac)['then'](function(_0x824ef7){logger[_0xfc99('0x8')]('SmsQueueReport,\x20%s,\x20%s',_0xdc674a,_0xfc99('0x9'));logger[_0xfc99('0xa')](_0xfc99('0xb'),_0xdc674a,_0xfc99('0x9'),JSON[_0xfc99('0xc')](_0x824ef7));if(_0x824ef7[_0xfc99('0xd')]){if(_0x824ef7[_0xfc99('0xd')]['code']===0x1f4){logger[_0xfc99('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xdc674a,_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);return _0x117a5d(_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);}logger[_0xfc99('0xd')](_0xfc99('0xf'),_0xdc674a,_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);return _0x353132(_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);}else{logger[_0xfc99('0x8')](_0xfc99('0xf'),_0xdc674a,_0xfc99('0x9'));_0x353132(_0x824ef7['result']['message']);}})[_0xfc99('0x10')](function(_0x4020f6){logger[_0xfc99('0xd')](_0xfc99('0xf'),_0xdc674a,_0x4020f6);_0x117a5d(_0x4020f6);});});}exports[_0xfc99('0x11')]=function(_0x1797ad){var _0xaa8ab8=this;return new Promise(function(_0x1a0d73,_0x47199c){return db[_0xfc99('0x12')][_0xfc99('0x13')](_0x1797ad['body'],{'raw':_0x1797ad[_0xfc99('0x14')]?_0x1797ad[_0xfc99('0x14')][_0xfc99('0x15')]===undefined?!![]:![]:!![]})[_0xfc99('0x16')](function(_0x414b88){logger[_0xfc99('0x8')]('CreateSmsQueueReport',_0x1797ad);logger[_0xfc99('0xa')](_0xfc99('0x11'),_0x1797ad,JSON[_0xfc99('0xc')](_0x414b88));_0x1a0d73(_0x414b88);})['catch'](function(_0x1905e9){logger[_0xfc99('0xd')]('CreateSmsQueueReport',_0x1905e9[_0xfc99('0xe')],_0x1797ad);_0x47199c(_0xaa8ab8[_0xfc99('0xd')](0x1f4,_0x1905e9['message']));});});};exports[_0xfc99('0x17')]=function(_0x2485ff){var _0x4e30ee=this;return new Promise(function(_0x567b79,_0x40b264){return db[_0xfc99('0x12')]['update'](_0x2485ff[_0xfc99('0x18')],{'raw':_0x2485ff[_0xfc99('0x14')]?_0x2485ff['options'][_0xfc99('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2485ff['options']?_0x2485ff['options']['where']||null:null,'attributes':_0x2485ff[_0xfc99('0x14')]?_0x2485ff[_0xfc99('0x14')][_0xfc99('0x19')]||null:null,'limit':_0x2485ff[_0xfc99('0x14')]?_0x2485ff[_0xfc99('0x14')][_0xfc99('0x1a')]||null:null})['then'](function(_0x5b2e3c){logger['info'](_0xfc99('0x17'),_0x2485ff);logger[_0xfc99('0xa')](_0xfc99('0x17'),_0x2485ff,JSON[_0xfc99('0xc')](_0x5b2e3c));_0x567b79(_0x5b2e3c);})[_0xfc99('0x10')](function(_0x487ba7){logger[_0xfc99('0xd')]('UpdateSmsQueueReport',_0x487ba7['message'],_0x2485ff);_0x40b264(_0x4e30ee['error'](0x1f4,_0x487ba7[_0xfc99('0xe')]));});});}; \ No newline at end of file +var _0x5e72=['client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsQueueReport','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x5e72,0x1d3));var _0x25e7=function(_0x668df5,_0x40b17a){_0x668df5=_0x668df5-0x0;var _0x5d30f8=_0x5e72[_0x668df5];return _0x5d30f8;};'use strict';var _=require(_0x25e7('0x0'));var util=require(_0x25e7('0x1'));var moment=require(_0x25e7('0x2'));var BPromise=require(_0x25e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25e7('0x5'));var logger=require(_0x25e7('0x6'))('rpc');var config=require(_0x25e7('0x7'));var jayson=require(_0x25e7('0x8'));var client=jayson[_0x25e7('0x9')][_0x25e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc834,_0x290800,_0x49b41f){return new BPromise(function(_0x129959,_0x13ed49){return client[_0x25e7('0xb')](_0x1dc834,_0x49b41f)['then'](function(_0x20b0e4){logger['info'](_0x25e7('0xc'),_0x290800,_0x25e7('0xd'));logger[_0x25e7('0xe')](_0x25e7('0xf'),_0x290800,'request\x20sent',JSON[_0x25e7('0x10')](_0x20b0e4));if(_0x20b0e4[_0x25e7('0x11')]){if(_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x12')]===0x1f4){logger[_0x25e7('0x11')](_0x25e7('0xc'),_0x290800,_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);return _0x13ed49(_0x20b0e4[_0x25e7('0x11')]['message']);}logger['error'](_0x25e7('0xc'),_0x290800,_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);return _0x129959(_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);}else{logger[_0x25e7('0x14')](_0x25e7('0xc'),_0x290800,_0x25e7('0xd'));_0x129959(_0x20b0e4[_0x25e7('0x15')][_0x25e7('0x13')]);}})[_0x25e7('0x16')](function(_0x2e58a5){logger[_0x25e7('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x290800,_0x2e58a5);_0x13ed49(_0x2e58a5);});});}exports['CreateSmsQueueReport']=function(_0x5eed37){var _0xb1885c=this;return new Promise(function(_0x4b996b,_0x3d71bc){return db[_0x25e7('0x17')]['create'](_0x5eed37[_0x25e7('0x18')],{'raw':_0x5eed37[_0x25e7('0x19')]?_0x5eed37['options'][_0x25e7('0x1a')]===undefined?!![]:![]:!![]})[_0x25e7('0x1b')](function(_0x2c17b6){logger[_0x25e7('0x14')](_0x25e7('0x1c'),_0x5eed37);logger[_0x25e7('0xe')](_0x25e7('0x1c'),_0x5eed37,JSON[_0x25e7('0x10')](_0x2c17b6));_0x4b996b(_0x2c17b6);})[_0x25e7('0x16')](function(_0x544680){logger[_0x25e7('0x11')](_0x25e7('0x1c'),_0x544680['message'],_0x5eed37);_0x3d71bc(_0xb1885c[_0x25e7('0x11')](0x1f4,_0x544680['message']));});});};exports[_0x25e7('0x1d')]=function(_0x10b2a8){var _0x47c398=this;return new Promise(function(_0x36ecce,_0x29fd16){return db[_0x25e7('0x17')][_0x25e7('0x1e')](_0x10b2a8[_0x25e7('0x18')],{'raw':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8[_0x25e7('0x19')][_0x25e7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8[_0x25e7('0x19')][_0x25e7('0x1f')]||null:null,'attributes':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8['options'][_0x25e7('0x20')]||null:null,'limit':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8['options'][_0x25e7('0x21')]||null:null})['then'](function(_0x117570){logger[_0x25e7('0x14')]('UpdateSmsQueueReport',_0x10b2a8);logger[_0x25e7('0xe')](_0x25e7('0x1d'),_0x10b2a8,JSON[_0x25e7('0x10')](_0x117570));_0x36ecce(_0x117570);})[_0x25e7('0x16')](function(_0x11448f){logger[_0x25e7('0x11')](_0x25e7('0x1d'),_0x11448f[_0x25e7('0x13')],_0x10b2a8);_0x29fd16(_0x47c398[_0x25e7('0x11')](0x1f4,_0x11448f[_0x25e7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2c3af60..7683a46 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 _0x2494=['express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x544b54,_0x449462){var _0x3f68dc=function(_0x49a7fb){while(--_0x49a7fb){_0x544b54['push'](_0x544b54['shift']());}};_0x3f68dc(++_0x449462);}(_0x2494,0x82));var _0x4249=function(_0x3da28f,_0x1c62fc){_0x3da28f=_0x3da28f-0x0;var _0x3240c7=_0x2494[_0x3da28f];return _0x3240c7;};'use strict';var multer=require(_0x4249('0x0'));var util=require('util');var path=require(_0x4249('0x1'));var timeout=require(_0x4249('0x2'));var express=require(_0x4249('0x3'));var router=express[_0x4249('0x4')]();var fs_extra=require(_0x4249('0x5'));var auth=require(_0x4249('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4249('0x7'));router['get']('/',auth[_0x4249('0x8')](),controller[_0x4249('0x9')]);router[_0x4249('0xa')]('/describe',auth[_0x4249('0x8')](),controller[_0x4249('0xb')]);router[_0x4249('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4249('0xc')]);router[_0x4249('0xd')]('/',auth[_0x4249('0x8')](),controller[_0x4249('0xe')]);router[_0x4249('0xf')](_0x4249('0x10'),auth[_0x4249('0x8')](),controller['update']);router['delete'](_0x4249('0x10'),auth['isAuthenticated'](),controller[_0x4249('0x11')]);module[_0x4249('0x12')]=router; \ No newline at end of file +var _0x3561=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','delete','destroy'];(function(_0x4b0a3e,_0x236bc4){var _0x418bde=function(_0x2df866){while(--_0x2df866){_0x4b0a3e['push'](_0x4b0a3e['shift']());}};_0x418bde(++_0x236bc4);}(_0x3561,0x94));var _0x1356=function(_0x3786a0,_0x58a16f){_0x3786a0=_0x3786a0-0x0;var _0xaef246=_0x3561[_0x3786a0];return _0xaef246;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/describe',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1356('0xe')]);router[_0x1356('0xf')]('/',auth['isAuthenticated'](),controller[_0x1356('0x10')]);router['put'](_0x1356('0x11'),auth[_0x1356('0xb')](),controller['update']);router[_0x1356('0x12')](_0x1356('0x11'),auth['isAuthenticated'](),controller[_0x1356('0x13')]);module[_0x1356('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8500071..e82ef4a 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x348ba6,_0x1aa82f){var _0xc80ec5=function(_0xfe3852){while(--_0xfe3852){_0x348ba6['push'](_0x348ba6['shift']());}};_0xc80ec5(++_0x1aa82f);}(_0x70e0,0x17b));var _0x070e=function(_0x50ca9b,_0x2de110){_0x50ca9b=_0x50ca9b-0x0;var _0x44e413=_0x70e0[_0x50ca9b];return _0x44e413;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x127473,_0x4a6406){var _0x3d4712=function(_0x5d2894){while(--_0x5d2894){_0x127473['push'](_0x127473['shift']());}};_0x3d4712(++_0x4a6406);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37e3bd,_0x50e852){_0x37e3bd=_0x37e3bd-0x0;var _0x870291=_0xf4eb[_0x37e3bd];return _0x870291;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 431fa85..b8de53b 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 _0xe234=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x233e92,_0x5557db){var _0x2752e5=function(_0x7ce74e){while(--_0x7ce74e){_0x233e92['push'](_0x233e92['shift']());}};_0x2752e5(++_0x5557db);}(_0xe234,0x191));var _0x4e23=function(_0x1fb74b,_0x882c58){_0x1fb74b=_0x1fb74b-0x0;var _0x4482b1=_0xe234[_0x1fb74b];return _0x4482b1;};'use strict';var emlformat=require(_0x4e23('0x0'));var rimraf=require(_0x4e23('0x1'));var zipdir=require(_0x4e23('0x2'));var jsonpatch=require(_0x4e23('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e23('0x4'));var Mustache=require(_0x4e23('0x5'));var util=require('util');var path=require(_0x4e23('0x6'));var sox=require(_0x4e23('0x7'));var csv=require(_0x4e23('0x8'));var ejs=require(_0x4e23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e23('0xa'));var squel=require('squel');var crypto=require(_0x4e23('0xb'));var jsforce=require(_0x4e23('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e23('0x8'));var querystring=require(_0x4e23('0xd'));var Papa=require(_0x4e23('0xe'));var Redis=require(_0x4e23('0xf'));var authService=require(_0x4e23('0x10'));var qs=require(_0x4e23('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e23('0x12'));var logger=require(_0x4e23('0x13'))(_0x4e23('0x14'));var utils=require(_0x4e23('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4e23('0x16'));var db=require(_0x4e23('0x17'))['db'];function respondWithStatusCode(_0x1c3783,_0x434b4d){_0x434b4d=_0x434b4d||0xcc;return function(_0x591aee){if(_0x591aee){return _0x1c3783[_0x4e23('0x18')](_0x434b4d);}return _0x1c3783[_0x4e23('0x19')](_0x434b4d)[_0x4e23('0x1a')]();};}function respondWithResult(_0x5c6a8f,_0x5358cb){_0x5358cb=_0x5358cb||0xc8;return function(_0x25191d){if(_0x25191d){return _0x5c6a8f['status'](_0x5358cb)[_0x4e23('0x1b')](_0x25191d);}};}function respondWithFilteredResult(_0x11e57d,_0x20a823){return function(_0x41038a){if(_0x41038a){var _0x1a4de6=typeof _0x20a823[_0x4e23('0x1c')]==='undefined'&&typeof _0x20a823[_0x4e23('0x1d')]===_0x4e23('0x1e');var _0x564bcf=_0x41038a[_0x4e23('0x1f')];var _0x203ac8=_0x1a4de6?0x0:_0x20a823[_0x4e23('0x1c')];var _0x5b3859=_0x1a4de6?_0x41038a['count']:_0x20a823[_0x4e23('0x1c')]+_0x20a823['limit'];var _0x528a28;if(_0x5b3859>=_0x564bcf){_0x5b3859=_0x564bcf;_0x528a28=0xc8;}else{_0x528a28=0xce;}_0x11e57d[_0x4e23('0x19')](_0x528a28);return _0x11e57d[_0x4e23('0x20')]('Content-Range',_0x203ac8+'-'+_0x5b3859+'/'+_0x564bcf)[_0x4e23('0x1b')](_0x41038a);}return null;};}function patchUpdates(_0x1aa3b3){return function(_0x53517c){try{jsonpatch['apply'](_0x53517c,_0x1aa3b3,!![]);}catch(_0x37e90){return BPromise[_0x4e23('0x21')](_0x37e90);}return _0x53517c[_0x4e23('0x22')]();};}function saveUpdates(_0x14b944,_0xa4fb0f){return function(_0x55566d){if(_0x55566d){return _0x55566d[_0x4e23('0x23')](_0x14b944)['then'](function(_0x419ab2){return _0x419ab2;});}return null;};}function removeEntity(_0x25b118,_0x2951aa){return function(_0x2cdc13){if(_0x2cdc13){return _0x2cdc13[_0x4e23('0x24')]()[_0x4e23('0x25')](function(){_0x25b118[_0x4e23('0x19')](0xcc)[_0x4e23('0x1a')]();});}};}function handleEntityNotFound(_0xde2c04,_0x429d63){return function(_0x1b42ca){if(!_0x1b42ca){_0xde2c04['sendStatus'](0x194);}return _0x1b42ca;};}function handleError(_0x518214,_0x44134d){_0x44134d=_0x44134d||0x1f4;return function(_0x811dc2){logger[_0x4e23('0x26')](_0x811dc2[_0x4e23('0x27')]);if(_0x811dc2[_0x4e23('0x28')]){delete _0x811dc2['name'];}_0x518214[_0x4e23('0x19')](_0x44134d)['send'](_0x811dc2);};}exports[_0x4e23('0x29')]=function(_0xcc533d,_0x350a86){var _0x383a00={},_0x5457f3={},_0x2e50ec={'count':0x0,'rows':[]};var _0x315af=_[_0x4e23('0x2a')](db[_0x4e23('0x2b')][_0x4e23('0x2c')],function(_0x351d2f){return{'name':_0x351d2f[_0x4e23('0x2d')],'type':_0x351d2f[_0x4e23('0x2e')][_0x4e23('0x2f')]};});_0x5457f3[_0x4e23('0x30')]=_[_0x4e23('0x2a')](_0x315af,_0x4e23('0x28'));_0x5457f3[_0x4e23('0x31')]=_[_0x4e23('0x32')](_0xcc533d['query']);_0x5457f3[_0x4e23('0x33')]=_[_0x4e23('0x34')](_0x5457f3[_0x4e23('0x30')],_0x5457f3[_0x4e23('0x31')]);_0x383a00[_0x4e23('0x35')]=_['intersection'](_0x5457f3[_0x4e23('0x30')],qs[_0x4e23('0x36')](_0xcc533d[_0x4e23('0x31')][_0x4e23('0x36')]));_0x383a00[_0x4e23('0x35')]=_0x383a00[_0x4e23('0x35')][_0x4e23('0x37')]?_0x383a00[_0x4e23('0x35')]:_0x5457f3[_0x4e23('0x30')];if(!_0xcc533d[_0x4e23('0x31')]['hasOwnProperty']('nolimit')){_0x383a00['limit']=qs['limit'](_0xcc533d['query'][_0x4e23('0x1d')]);_0x383a00[_0x4e23('0x1c')]=qs[_0x4e23('0x1c')](_0xcc533d['query'][_0x4e23('0x1c')]);}_0x383a00['order']=qs['sort'](_0xcc533d[_0x4e23('0x31')][_0x4e23('0x38')]);_0x383a00['where']=qs['filters'](_['pick'](_0xcc533d[_0x4e23('0x31')],_0x5457f3[_0x4e23('0x33')]),_0x315af);if(_0xcc533d[_0x4e23('0x31')][_0x4e23('0x39')]){_0x383a00[_0x4e23('0x3a')]=_[_0x4e23('0x3b')](_0x383a00[_0x4e23('0x3a')],{'$or':_[_0x4e23('0x2a')](_0x315af,function(_0x2bd7e1){if(_0x2bd7e1['type']!=='VIRTUAL'){var _0x187f2d={};_0x187f2d[_0x2bd7e1['name']]={'$like':'%'+_0xcc533d[_0x4e23('0x31')][_0x4e23('0x39')]+'%'};return _0x187f2d;}})});}_0x383a00=_['merge']({},_0x383a00,_0xcc533d[_0x4e23('0x3c')]);var _0xb7a230={'where':_0x383a00[_0x4e23('0x3a')]};return db[_0x4e23('0x2b')][_0x4e23('0x1f')](_0xb7a230)['then'](function(_0x2e0e6b){_0x2e50ec[_0x4e23('0x1f')]=_0x2e0e6b;if(_0xcc533d[_0x4e23('0x31')][_0x4e23('0x3d')]){_0x383a00[_0x4e23('0x3e')]=[{'all':!![]}];}return db[_0x4e23('0x2b')][_0x4e23('0x3f')](_0x383a00);})[_0x4e23('0x25')](function(_0xb9ea2c){_0x2e50ec['rows']=_0xb9ea2c;return _0x2e50ec;})[_0x4e23('0x25')](respondWithFilteredResult(_0x350a86,_0x383a00))[_0x4e23('0x40')](handleError(_0x350a86,null));};exports[_0x4e23('0x41')]=function(_0x212936,_0x116ff8){var _0x19f4a3={'raw':!![],'where':{'id':_0x212936[_0x4e23('0x42')]['id']}},_0x4ab3b0={};_0x4ab3b0[_0x4e23('0x30')]=_[_0x4e23('0x32')](db[_0x4e23('0x2b')][_0x4e23('0x2c')]);_0x4ab3b0['query']=_[_0x4e23('0x32')](_0x212936['query']);_0x4ab3b0['filters']=_[_0x4e23('0x34')](_0x4ab3b0['model'],_0x4ab3b0['query']);_0x19f4a3[_0x4e23('0x35')]=_[_0x4e23('0x34')](_0x4ab3b0[_0x4e23('0x30')],qs[_0x4e23('0x36')](_0x212936['query'][_0x4e23('0x36')]));_0x19f4a3['attributes']=_0x19f4a3['attributes']['length']?_0x19f4a3['attributes']:_0x4ab3b0[_0x4e23('0x30')];if(_0x212936[_0x4e23('0x31')]['includeAll']){_0x19f4a3['include']=[{'all':!![]}];}_0x19f4a3=_['merge']({},_0x19f4a3,_0x212936[_0x4e23('0x3c')]);return db[_0x4e23('0x2b')]['find'](_0x19f4a3)[_0x4e23('0x25')](handleEntityNotFound(_0x116ff8,null))[_0x4e23('0x25')](respondWithResult(_0x116ff8,null))[_0x4e23('0x40')](handleError(_0x116ff8,null));};exports['create']=function(_0x5b63e4,_0x99d25d){return db['SmsTransferReport']['create'](_0x5b63e4[_0x4e23('0x43')],{})[_0x4e23('0x25')](respondWithResult(_0x99d25d,0xc9))[_0x4e23('0x40')](handleError(_0x99d25d,null));};exports[_0x4e23('0x23')]=function(_0x12037a,_0x169209){if(_0x12037a[_0x4e23('0x43')]['id']){delete _0x12037a[_0x4e23('0x43')]['id'];}return db['SmsTransferReport'][_0x4e23('0x44')]({'where':{'id':_0x12037a[_0x4e23('0x42')]['id']}})['then'](handleEntityNotFound(_0x169209,null))[_0x4e23('0x25')](saveUpdates(_0x12037a[_0x4e23('0x43')],null))[_0x4e23('0x25')](respondWithResult(_0x169209,null))[_0x4e23('0x40')](handleError(_0x169209,null));};exports[_0x4e23('0x24')]=function(_0x49a395,_0x8d0531){return db[_0x4e23('0x2b')][_0x4e23('0x44')]({'where':{'id':_0x49a395[_0x4e23('0x42')]['id']}})[_0x4e23('0x25')](handleEntityNotFound(_0x8d0531,null))[_0x4e23('0x25')](removeEntity(_0x8d0531,null))[_0x4e23('0x40')](handleError(_0x8d0531,null));};exports[_0x4e23('0x45')]=function(_0x3a942b,_0x36ca60){return db[_0x4e23('0x2b')]['describe']()[_0x4e23('0x25')](respondWithResult(_0x36ca60,null))[_0x4e23('0x40')](handleError(_0x36ca60,null));}; \ No newline at end of file +var _0xa24a=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xa24a,0x184));var _0xaa24=function(_0x181aa1,_0x456875){_0x181aa1=_0x181aa1-0x0;var _0x47216f=_0xa24a[_0x181aa1];return _0x47216f;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require('request-promise');var moment=require(_0xaa24('0x4'));var BPromise=require(_0xaa24('0x5'));var Mustache=require(_0xaa24('0x6'));var util=require(_0xaa24('0x7'));var path=require(_0xaa24('0x8'));var sox=require('sox');var csv=require(_0xaa24('0x9'));var ejs=require(_0xaa24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa24('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa24('0xc'));var deskjs=require(_0xaa24('0xd'));var toCsv=require(_0xaa24('0x9'));var querystring=require(_0xaa24('0xe'));var Papa=require(_0xaa24('0xf'));var Redis=require(_0xaa24('0x10'));var authService=require(_0xaa24('0x11'));var qs=require(_0xaa24('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa24('0x13'));var logger=require(_0xaa24('0x14'))(_0xaa24('0x15'));var utils=require(_0xaa24('0x16'));var config=require(_0xaa24('0x17'));var licenseUtil=require(_0xaa24('0x18'));var db=require(_0xaa24('0x19'))['db'];function respondWithStatusCode(_0x5b34d5,_0x2ae629){_0x2ae629=_0x2ae629||0xcc;return function(_0x2901f9){if(_0x2901f9){return _0x5b34d5['sendStatus'](_0x2ae629);}return _0x5b34d5[_0xaa24('0x1a')](_0x2ae629)[_0xaa24('0x1b')]();};}function respondWithResult(_0x27cca6,_0x11d3d8){_0x11d3d8=_0x11d3d8||0xc8;return function(_0x2a68d6){if(_0x2a68d6){return _0x27cca6[_0xaa24('0x1a')](_0x11d3d8)[_0xaa24('0x1c')](_0x2a68d6);}};}function respondWithFilteredResult(_0x2c3594,_0x3e7efb){return function(_0x16d48a){if(_0x16d48a){var _0xc93f0f=typeof _0x3e7efb['offset']===_0xaa24('0x1d')&&typeof _0x3e7efb[_0xaa24('0x1e')]===_0xaa24('0x1d');var _0x16afde=_0x16d48a[_0xaa24('0x1f')];var _0x5e058c=_0xc93f0f?0x0:_0x3e7efb[_0xaa24('0x20')];var _0x5ec4df=_0xc93f0f?_0x16d48a[_0xaa24('0x1f')]:_0x3e7efb['offset']+_0x3e7efb[_0xaa24('0x1e')];var _0xab0ada;if(_0x5ec4df>=_0x16afde){_0x5ec4df=_0x16afde;_0xab0ada=0xc8;}else{_0xab0ada=0xce;}_0x2c3594[_0xaa24('0x1a')](_0xab0ada);return _0x2c3594[_0xaa24('0x21')](_0xaa24('0x22'),_0x5e058c+'-'+_0x5ec4df+'/'+_0x16afde)[_0xaa24('0x1c')](_0x16d48a);}return null;};}function patchUpdates(_0x884e35){return function(_0x59fcba){try{jsonpatch[_0xaa24('0x23')](_0x59fcba,_0x884e35,!![]);}catch(_0x1aee09){return BPromise[_0xaa24('0x24')](_0x1aee09);}return _0x59fcba[_0xaa24('0x25')]();};}function saveUpdates(_0x5e2f4e,_0x56f6af){return function(_0x2cc1e1){if(_0x2cc1e1){return _0x2cc1e1[_0xaa24('0x26')](_0x5e2f4e)[_0xaa24('0x27')](function(_0x3519fd){return _0x3519fd;});}return null;};}function removeEntity(_0x479cee,_0x366ec8){return function(_0x233a64){if(_0x233a64){return _0x233a64[_0xaa24('0x28')]()['then'](function(){_0x479cee[_0xaa24('0x1a')](0xcc)[_0xaa24('0x1b')]();});}};}function handleEntityNotFound(_0x4c2f79,_0x50ffb9){return function(_0x1d96f2){if(!_0x1d96f2){_0x4c2f79[_0xaa24('0x29')](0x194);}return _0x1d96f2;};}function handleError(_0x5cfa9f,_0x53d5ea){_0x53d5ea=_0x53d5ea||0x1f4;return function(_0x142713){logger[_0xaa24('0x2a')](_0x142713['stack']);if(_0x142713['name']){delete _0x142713[_0xaa24('0x2b')];}_0x5cfa9f['status'](_0x53d5ea)[_0xaa24('0x2c')](_0x142713);};}exports[_0xaa24('0x2d')]=function(_0x2d9a2f,_0x129eeb){var _0x260390={},_0xacc77e={},_0x32e360={'count':0x0,'rows':[]};var _0x3cee29=_[_0xaa24('0x2e')](db[_0xaa24('0x2f')][_0xaa24('0x30')],function(_0x581978){return{'name':_0x581978['fieldName'],'type':_0x581978[_0xaa24('0x31')][_0xaa24('0x32')]};});_0xacc77e['model']=_[_0xaa24('0x2e')](_0x3cee29,_0xaa24('0x2b'));_0xacc77e[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x2d9a2f[_0xaa24('0x33')]);_0xacc77e['filters']=_[_0xaa24('0x35')](_0xacc77e[_0xaa24('0x36')],_0xacc77e[_0xaa24('0x33')]);_0x260390[_0xaa24('0x37')]=_[_0xaa24('0x35')](_0xacc77e['model'],qs[_0xaa24('0x38')](_0x2d9a2f[_0xaa24('0x33')]['fields']));_0x260390[_0xaa24('0x37')]=_0x260390['attributes'][_0xaa24('0x39')]?_0x260390[_0xaa24('0x37')]:_0xacc77e['model'];if(!_0x2d9a2f['query']['hasOwnProperty'](_0xaa24('0x3a'))){_0x260390[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x1e')]);_0x260390[_0xaa24('0x20')]=qs[_0xaa24('0x20')](_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x20')]);}_0x260390[_0xaa24('0x3b')]=qs['sort'](_0x2d9a2f[_0xaa24('0x33')]['sort']);_0x260390[_0xaa24('0x3c')]=qs[_0xaa24('0x3d')](_[_0xaa24('0x3e')](_0x2d9a2f[_0xaa24('0x33')],_0xacc77e[_0xaa24('0x3d')]),_0x3cee29);if(_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x3f')]){_0x260390[_0xaa24('0x3c')]=_['merge'](_0x260390['where'],{'$or':_[_0xaa24('0x2e')](_0x3cee29,function(_0x4d3ebe){if(_0x4d3ebe[_0xaa24('0x31')]!==_0xaa24('0x40')){var _0x516ce4={};_0x516ce4[_0x4d3ebe['name']]={'$like':'%'+_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x3f')]+'%'};return _0x516ce4;}})});}_0x260390=_['merge']({},_0x260390,_0x2d9a2f[_0xaa24('0x41')]);var _0x41bd48={'where':_0x260390[_0xaa24('0x3c')]};return db['SmsTransferReport'][_0xaa24('0x1f')](_0x41bd48)['then'](function(_0x5dbab9){_0x32e360[_0xaa24('0x1f')]=_0x5dbab9;if(_0x2d9a2f[_0xaa24('0x33')]['includeAll']){_0x260390[_0xaa24('0x42')]=[{'all':!![]}];}return db[_0xaa24('0x2f')][_0xaa24('0x43')](_0x260390);})[_0xaa24('0x27')](function(_0x197f8f){_0x32e360[_0xaa24('0x44')]=_0x197f8f;return _0x32e360;})[_0xaa24('0x27')](respondWithFilteredResult(_0x129eeb,_0x260390))['catch'](handleError(_0x129eeb,null));};exports[_0xaa24('0x45')]=function(_0x584b99,_0x3ed009){var _0x2ea459={'raw':!![],'where':{'id':_0x584b99[_0xaa24('0x46')]['id']}},_0x460cd1={};_0x460cd1[_0xaa24('0x36')]=_[_0xaa24('0x34')](db[_0xaa24('0x2f')][_0xaa24('0x30')]);_0x460cd1[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x584b99[_0xaa24('0x33')]);_0x460cd1[_0xaa24('0x3d')]=_[_0xaa24('0x35')](_0x460cd1[_0xaa24('0x36')],_0x460cd1[_0xaa24('0x33')]);_0x2ea459[_0xaa24('0x37')]=_[_0xaa24('0x35')](_0x460cd1[_0xaa24('0x36')],qs[_0xaa24('0x38')](_0x584b99[_0xaa24('0x33')][_0xaa24('0x38')]));_0x2ea459[_0xaa24('0x37')]=_0x2ea459[_0xaa24('0x37')][_0xaa24('0x39')]?_0x2ea459[_0xaa24('0x37')]:_0x460cd1['model'];if(_0x584b99[_0xaa24('0x33')][_0xaa24('0x47')]){_0x2ea459['include']=[{'all':!![]}];}_0x2ea459=_[_0xaa24('0x48')]({},_0x2ea459,_0x584b99[_0xaa24('0x41')]);return db['SmsTransferReport'][_0xaa24('0x49')](_0x2ea459)['then'](handleEntityNotFound(_0x3ed009,null))[_0xaa24('0x27')](respondWithResult(_0x3ed009,null))[_0xaa24('0x4a')](handleError(_0x3ed009,null));};exports[_0xaa24('0x4b')]=function(_0x31a0e3,_0x57a5aa){return db['SmsTransferReport']['create'](_0x31a0e3[_0xaa24('0x4c')],{})[_0xaa24('0x27')](respondWithResult(_0x57a5aa,0xc9))[_0xaa24('0x4a')](handleError(_0x57a5aa,null));};exports[_0xaa24('0x26')]=function(_0x5b2836,_0xab68b){if(_0x5b2836[_0xaa24('0x4c')]['id']){delete _0x5b2836['body']['id'];}return db[_0xaa24('0x2f')][_0xaa24('0x49')]({'where':{'id':_0x5b2836[_0xaa24('0x46')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0xab68b,null))[_0xaa24('0x27')](saveUpdates(_0x5b2836['body'],null))[_0xaa24('0x27')](respondWithResult(_0xab68b,null))['catch'](handleError(_0xab68b,null));};exports[_0xaa24('0x28')]=function(_0xc329a8,_0x8ac093){return db[_0xaa24('0x2f')][_0xaa24('0x49')]({'where':{'id':_0xc329a8[_0xaa24('0x46')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x8ac093,null))[_0xaa24('0x27')](removeEntity(_0x8ac093,null))[_0xaa24('0x4a')](handleError(_0x8ac093,null));};exports[_0xaa24('0x4d')]=function(_0x40e03e,_0x90c298){return db['SmsTransferReport'][_0xaa24('0x4d')]()[_0xaa24('0x27')](respondWithResult(_0x90c298,null))[_0xaa24('0x4a')](handleError(_0x90c298,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 36eb0fd..d735a5d 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 _0x106f=['../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0x106f,0x162));var _0xf106=function(_0x6d87a2,_0x401de3){_0x6d87a2=_0x6d87a2-0x0;var _0x27ea10=_0x106f[_0x6d87a2];return _0x27ea10;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var logger=require('../../config/logger')(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require('bluebird');var rp=require(_0xf106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var attributes=require(_0xf106('0x7'));module[_0xf106('0x8')]=function(_0x253f6d,_0x282fd4){return _0x253f6d[_0xf106('0x9')]('SmsTransferReport',attributes,{'tableName':_0xf106('0xa'),'paranoid':![],'indexes':[{'name':_0xf106('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe02c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x296e73,_0x56d662){var _0xd7f53=function(_0x3f5151){while(--_0x3f5151){_0x296e73['push'](_0x296e73['shift']());}};_0xd7f53(++_0x56d662);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xce02('0x1'));var BPromise=require(_0xce02('0x2'));var rp=require(_0xce02('0x3'));var fs=require('fs');var path=require(_0xce02('0x4'));var rimraf=require(_0xce02('0x5'));var config=require(_0xce02('0x6'));var attributes=require(_0xce02('0x7'));module[_0xce02('0x8')]=function(_0x4dfae3,_0x1cd6cd){return _0x4dfae3[_0xce02('0x9')](_0xce02('0xa'),attributes,{'tableName':_0xce02('0xb'),'paranoid':![],'indexes':[{'name':_0xce02('0xc'),'fields':[_0xce02('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 289b54d..96d8b2d 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 _0xac4f=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x55c787,_0x30ea48){var _0x78c063=function(_0x23375a){while(--_0x23375a){_0x55c787['push'](_0x55c787['shift']());}};_0x78c063(++_0x30ea48);}(_0xac4f,0x122));var _0xfac4=function(_0x254c9e,_0xab8a1b){_0x254c9e=_0x254c9e-0x0;var _0x2d4cb6=_0xac4f[_0x254c9e];return _0x2d4cb6;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var moment=require(_0xfac4('0x1'));var BPromise=require('bluebird');var rs=require(_0xfac4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfac4('0x3'));var logger=require(_0xfac4('0x4'))('rpc');var config=require(_0xfac4('0x5'));var jayson=require(_0xfac4('0x6'));var client=jayson[_0xfac4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x342b8c,_0x8599e2,_0xdd64ea){return new BPromise(function(_0x2ad59f,_0x2e7774){return client[_0xfac4('0x8')](_0x342b8c,_0xdd64ea)['then'](function(_0x6c46e8){logger[_0xfac4('0x9')](_0xfac4('0xa'),_0x8599e2,_0xfac4('0xb'));logger[_0xfac4('0xc')](_0xfac4('0xd'),_0x8599e2,_0xfac4('0xb'),JSON[_0xfac4('0xe')](_0x6c46e8));if(_0x6c46e8[_0xfac4('0xf')]){if(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x10')]===0x1f4){logger[_0xfac4('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x8599e2,_0x6c46e8[_0xfac4('0xf')]['message']);return _0x2e7774(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);}logger[_0xfac4('0xf')](_0xfac4('0xa'),_0x8599e2,_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);return _0x2ad59f(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);}else{logger['info'](_0xfac4('0xa'),_0x8599e2,_0xfac4('0xb'));_0x2ad59f(_0x6c46e8[_0xfac4('0x12')][_0xfac4('0x11')]);}})[_0xfac4('0x13')](function(_0x3ce345){logger[_0xfac4('0xf')](_0xfac4('0xa'),_0x8599e2,_0x3ce345);_0x2e7774(_0x3ce345);});});} \ No newline at end of file +var _0x56a4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2aab76,_0x520bdf){var _0xa1dff0=function(_0x5e80a6){while(--_0x5e80a6){_0x2aab76['push'](_0x2aab76['shift']());}};_0xa1dff0(++_0x520bdf);}(_0x56a4,0x11b));var _0x456a=function(_0x206fc3,_0x251f21){_0x206fc3=_0x206fc3-0x0;var _0xea0c75=_0x56a4[_0x206fc3];return _0xea0c75;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b38d,_0x497df4,_0x2b6329){return new BPromise(function(_0x20c8e0,_0x37f1b4){return client['request'](_0x52b38d,_0x2b6329)[_0x456a('0xa')](function(_0x595c4b){logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));logger[_0x456a('0xe')](_0x456a('0xf'),_0x497df4,_0x456a('0xd'),JSON[_0x456a('0x10')](_0x595c4b));if(_0x595c4b[_0x456a('0x11')]){if(_0x595c4b[_0x456a('0x11')][_0x456a('0x12')]===0x1f4){logger[_0x456a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x37f1b4(_0x595c4b['error'][_0x456a('0x13')]);}logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x20c8e0(_0x595c4b[_0x456a('0x11')][_0x456a('0x13')]);}else{logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));_0x20c8e0(_0x595c4b[_0x456a('0x14')]['message']);}})[_0x456a('0x15')](function(_0x42f7d8){logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x42f7d8);_0x37f1b4(_0x42f7d8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b656120..77418ad 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 _0xfabc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','single','file','create','put','update','delete','/:id','exports','multer'];(function(_0x4ed1ad,_0x2a8b17){var _0x35a5e1=function(_0x4bab88){while(--_0x4bab88){_0x4ed1ad['push'](_0x4ed1ad['shift']());}};_0x35a5e1(++_0x2a8b17);}(_0xfabc,0xa7));var _0xcfab=function(_0x454c9b,_0x5711a9){_0x454c9b=_0x454c9b-0x0;var _0x2254af=_0xfabc[_0x454c9b];return _0x2254af;};'use strict';var multer=require(_0xcfab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfab('0x1'));var router=express[_0xcfab('0x2')]();var fs_extra=require(_0xcfab('0x3'));var auth=require(_0xcfab('0x4'));var interaction=require(_0xcfab('0x5'));var config=require(_0xcfab('0x6'));var controller=require(_0xcfab('0x7'));router['get']('/',auth[_0xcfab('0x8')](),controller['index']);router[_0xcfab('0x9')]('/:id',auth[_0xcfab('0x8')](),controller['show']);router['get'](_0xcfab('0xa'),auth['isAuthenticated'](),controller[_0xcfab('0xb')]);var upload=multer({'storage':multer[_0xcfab('0xc')]({'destination':function(_0x673c44,_0x2edb1d,_0x5ce4ed){_0x5ce4ed(null,path[_0xcfab('0xd')](config[_0xcfab('0xe')],_0xcfab('0xf')));},'filename':function(_0x8bb198,_0x3fb81f,_0x715ac6){_0x3fb81f[_0xcfab('0x10')]=_0x3fb81f[_0xcfab('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x715ac6(null,util[_0xcfab('0x11')](_0xcfab('0x12'),path['basename'](_0x3fb81f[_0xcfab('0x10')],path['extname'](_0x3fb81f['originalname'])),Date['now'](),path[_0xcfab('0x13')](_0x3fb81f[_0xcfab('0x10')])));}})});router['post']('/',upload[_0xcfab('0x14')](_0xcfab('0x15')),controller[_0xcfab('0x16')]);router[_0xcfab('0x17')]('/:id',auth[_0xcfab('0x8')](),controller[_0xcfab('0x18')]);router[_0xcfab('0x19')](_0xcfab('0x1a'),auth[_0xcfab('0x8')](),controller[_0xcfab('0x19')]);module[_0xcfab('0x1b')]=router; \ No newline at end of file +var _0xe6ca=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','exports','multer','path','connect-timeout'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xe6ca,0x13c));var _0xae6c=function(_0x5e6eaa,_0x154146){_0x5e6eaa=_0x5e6eaa-0x0;var _0x48174e=_0xe6ca[_0x5e6eaa];return _0x48174e;};'use strict';var multer=require(_0xae6c('0x0'));var util=require('util');var path=require(_0xae6c('0x1'));var timeout=require(_0xae6c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xae6c('0x3'));var auth=require(_0xae6c('0x4'));var interaction=require(_0xae6c('0x5'));var config=require(_0xae6c('0x6'));var controller=require(_0xae6c('0x7'));router[_0xae6c('0x8')]('/',auth[_0xae6c('0x9')](),controller['index']);router[_0xae6c('0x8')](_0xae6c('0xa'),auth['isAuthenticated'](),controller[_0xae6c('0xb')]);router[_0xae6c('0x8')]('/:id/download',auth[_0xae6c('0x9')](),controller[_0xae6c('0xc')]);var upload=multer({'storage':multer[_0xae6c('0xd')]({'destination':function(_0x370966,_0x2cee69,_0x26a9ec){_0x26a9ec(null,path[_0xae6c('0xe')](config['root'],_0xae6c('0xf')));},'filename':function(_0x2af0c0,_0xe9c2ff,_0x119b4f){_0xe9c2ff[_0xae6c('0x10')]=_0xe9c2ff['originalname'][_0xae6c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x119b4f(null,util[_0xae6c('0x12')](_0xae6c('0x13'),path[_0xae6c('0x14')](_0xe9c2ff[_0xae6c('0x10')],path[_0xae6c('0x15')](_0xe9c2ff[_0xae6c('0x10')])),Date['now'](),path['extname'](_0xe9c2ff[_0xae6c('0x10')])));}})});router[_0xae6c('0x16')]('/',upload[_0xae6c('0x17')](_0xae6c('0x18')),controller[_0xae6c('0x19')]);router[_0xae6c('0x1a')](_0xae6c('0xa'),auth[_0xae6c('0x9')](),controller[_0xae6c('0x1b')]);router['delete'](_0xae6c('0xa'),auth[_0xae6c('0x9')](),controller['delete']);module[_0xae6c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f0de855..20e5b9c 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 _0x1983=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x20c726,_0x711a9c){var _0x4ff397=function(_0x226b07){while(--_0x226b07){_0x20c726['push'](_0x20c726['shift']());}};_0x4ff397(++_0x711a9c);}(_0x1983,0x14f));var _0x3198=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1983[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0x3198('0x0'));module['exports']={'name':{'type':Sequelize[_0x3198('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3198('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x3198('0x1')]},'original_duration':{'type':Sequelize[_0x3198('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3198('0x3')]},'original_channelCount':{'type':Sequelize[_0x3198('0x4')]},'original_bitRate':{'type':Sequelize[_0x3198('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3198('0x1')]},'converted_duration':{'type':Sequelize[_0x3198('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x3198('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3198('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3198('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9da3=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x2d9da8,_0x545785){var _0x30670e=function(_0x3d19f0){while(--_0x3d19f0){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x30670e(++_0x545785);}(_0x9da3,0x1b6));var _0x39da=function(_0x26f7ff,_0x18ae86){_0x26f7ff=_0x26f7ff-0x0;var _0x495cab=_0x9da3[_0x26f7ff];return _0x495cab;};'use strict';var Sequelize=require(_0x39da('0x0'));module[_0x39da('0x1')]={'name':{'type':Sequelize[_0x39da('0x2')],'unique':_0x39da('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x39da('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x39da('0x2')]},'original_format':{'type':Sequelize[_0x39da('0x2')]},'original_duration':{'type':Sequelize[_0x39da('0x4')]},'original_sampleCount':{'type':Sequelize[_0x39da('0x5')]},'original_channelCount':{'type':Sequelize[_0x39da('0x6')]},'original_bitRate':{'type':Sequelize[_0x39da('0x5')]},'original_sampleRate':{'type':Sequelize[_0x39da('0x6')]},'converted_format':{'type':Sequelize[_0x39da('0x2')]},'converted_duration':{'type':Sequelize[_0x39da('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x39da('0x5')]},'converted_channelCount':{'type':Sequelize[_0x39da('0x6')]},'converted_bitRate':{'type':Sequelize[_0x39da('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x39da('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 687eaf4..ceca049 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 _0x0faf=['rawAttributes','includeAll','find','catch','save_name','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','download','format','basename','file','originalname','filename','substring','wav','info','chmodSync','transcode','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','server/files/sounds/original','%s.%s','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','name','send','Sound','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','include','findAll','rows','show','params','keys'];(function(_0xcf5d4f,_0x2b4ed1){var _0x3a9d1a=function(_0x46c4ae){while(--_0x46c4ae){_0xcf5d4f['push'](_0xcf5d4f['shift']());}};_0x3a9d1a(++_0x2b4ed1);}(_0x0faf,0xb0));var _0xf0fa=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0x0faf[_0x474035];return _0x1b58e0;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require(_0xf0fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0fa('0x4'));var util=require(_0xf0fa('0x5'));var path=require(_0xf0fa('0x6'));var sox=require(_0xf0fa('0x7'));var csv=require(_0xf0fa('0x8'));var ejs=require(_0xf0fa('0x9'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xa'));var _=require(_0xf0fa('0xb'));var squel=require('squel');var crypto=require(_0xf0fa('0xc'));var jsforce=require(_0xf0fa('0xd'));var deskjs=require(_0xf0fa('0xe'));var toCsv=require(_0xf0fa('0x8'));var querystring=require('querystring');var Papa=require(_0xf0fa('0xf'));var Redis=require(_0xf0fa('0x10'));var authService=require(_0xf0fa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf0fa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0fa('0x13'));var utils=require(_0xf0fa('0x14'));var config=require(_0xf0fa('0x15'));var licenseUtil=require(_0xf0fa('0x16'));var db=require(_0xf0fa('0x17'))['db'];function respondWithStatusCode(_0x5dfba0,_0x23d09d){_0x23d09d=_0x23d09d||0xcc;return function(_0x552893){if(_0x552893){return _0x5dfba0[_0xf0fa('0x18')](_0x23d09d);}return _0x5dfba0[_0xf0fa('0x19')](_0x23d09d)[_0xf0fa('0x1a')]();};}function respondWithResult(_0x531eca,_0x562bc3){_0x562bc3=_0x562bc3||0xc8;return function(_0x316ee6){if(_0x316ee6){return _0x531eca[_0xf0fa('0x19')](_0x562bc3)[_0xf0fa('0x1b')](_0x316ee6);}};}function respondWithFilteredResult(_0x51c308,_0x544786){return function(_0x5b883c){if(_0x5b883c){var _0x23c563=typeof _0x544786[_0xf0fa('0x1c')]===_0xf0fa('0x1d')&&typeof _0x544786[_0xf0fa('0x1e')]===_0xf0fa('0x1d');var _0x21f520=_0x5b883c[_0xf0fa('0x1f')];var _0x1064e4=_0x23c563?0x0:_0x544786[_0xf0fa('0x1c')];var _0x73bf7f=_0x23c563?_0x5b883c[_0xf0fa('0x1f')]:_0x544786['offset']+_0x544786[_0xf0fa('0x1e')];var _0x430425;if(_0x73bf7f>=_0x21f520){_0x73bf7f=_0x21f520;_0x430425=0xc8;}else{_0x430425=0xce;}_0x51c308['status'](_0x430425);return _0x51c308[_0xf0fa('0x20')](_0xf0fa('0x21'),_0x1064e4+'-'+_0x73bf7f+'/'+_0x21f520)['json'](_0x5b883c);}return null;};}function patchUpdates(_0x45e613){return function(_0x5ad9fc){try{jsonpatch[_0xf0fa('0x22')](_0x5ad9fc,_0x45e613,!![]);}catch(_0x1fe4d9){return BPromise['reject'](_0x1fe4d9);}return _0x5ad9fc[_0xf0fa('0x23')]();};}function saveUpdates(_0x5aa3d9,_0x1686a2){return function(_0x3e2520){if(_0x3e2520){return _0x3e2520['update'](_0x5aa3d9)[_0xf0fa('0x24')](function(_0x3fc369){return _0x3fc369;});}return null;};}function removeEntity(_0x130c9f,_0x1e1087){return function(_0x198762){if(_0x198762){return _0x198762[_0xf0fa('0x25')]()['then'](function(){var _0x5a6f82=_0x198762[_0xf0fa('0x26')]({'plain':!![]});var _0xa732e4='Sounds';return db[_0xf0fa('0x27')]['destroy']({'where':{'type':_0xa732e4,'resourceId':_0x5a6f82['id']}})['then'](function(){return _0x198762;});})[_0xf0fa('0x24')](function(){_0x130c9f['status'](0xcc)[_0xf0fa('0x1a')]();});}};}function handleEntityNotFound(_0x36fd04,_0x21decd){return function(_0x299695){if(!_0x299695){_0x36fd04[_0xf0fa('0x18')](0x194);}return _0x299695;};}function handleError(_0x5c72f3,_0x5e2387){_0x5e2387=_0x5e2387||0x1f4;return function(_0x2bbc3b){logger[_0xf0fa('0x28')](_0x2bbc3b['stack']);if(_0x2bbc3b['name']){delete _0x2bbc3b[_0xf0fa('0x29')];}_0x5c72f3[_0xf0fa('0x19')](_0x5e2387)[_0xf0fa('0x2a')](_0x2bbc3b);};}exports['index']=function(_0x4d70a9,_0x349eed){var _0xfb8387={},_0xfc455c={},_0x378f50={'count':0x0,'rows':[]};var _0x384787=_['map'](db[_0xf0fa('0x2b')]['rawAttributes'],function(_0x362d80){return{'name':_0x362d80[_0xf0fa('0x2c')],'type':_0x362d80['type'][_0xf0fa('0x2d')]};});_0xfc455c[_0xf0fa('0x2e')]=_[_0xf0fa('0x2f')](_0x384787,_0xf0fa('0x29'));_0xfc455c[_0xf0fa('0x30')]=_['keys'](_0x4d70a9[_0xf0fa('0x30')]);_0xfc455c['filters']=_['intersection'](_0xfc455c[_0xf0fa('0x2e')],_0xfc455c[_0xf0fa('0x30')]);_0xfb8387[_0xf0fa('0x31')]=_[_0xf0fa('0x32')](_0xfc455c[_0xf0fa('0x2e')],qs['fields'](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x33')]));_0xfb8387[_0xf0fa('0x31')]=_0xfb8387[_0xf0fa('0x31')][_0xf0fa('0x34')]?_0xfb8387[_0xf0fa('0x31')]:_0xfc455c[_0xf0fa('0x2e')];if(!_0x4d70a9['query'][_0xf0fa('0x35')](_0xf0fa('0x36'))){_0xfb8387[_0xf0fa('0x1e')]=qs[_0xf0fa('0x1e')](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x1e')]);_0xfb8387[_0xf0fa('0x1c')]=qs[_0xf0fa('0x1c')](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x1c')]);}_0xfb8387[_0xf0fa('0x37')]=qs[_0xf0fa('0x38')](_0x4d70a9[_0xf0fa('0x30')]['sort']);_0xfb8387['where']=qs[_0xf0fa('0x39')](_[_0xf0fa('0x3a')](_0x4d70a9['query'],_0xfc455c['filters']),_0x384787);if(_0x4d70a9[_0xf0fa('0x30')]['filter']){_0xfb8387[_0xf0fa('0x3b')]=_[_0xf0fa('0x3c')](_0xfb8387[_0xf0fa('0x3b')],{'$or':_[_0xf0fa('0x2f')](_0x384787,function(_0x2077fe){if(_0x2077fe[_0xf0fa('0x3d')]!=='VIRTUAL'){var _0x1e5f64={};_0x1e5f64[_0x2077fe[_0xf0fa('0x29')]]={'$like':'%'+_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x3e')]+'%'};return _0x1e5f64;}})});}_0xfb8387=_['merge']({},_0xfb8387,_0x4d70a9[_0xf0fa('0x3f')]);var _0x34b1d2={'where':_0xfb8387['where']};return db[_0xf0fa('0x2b')][_0xf0fa('0x1f')](_0x34b1d2)[_0xf0fa('0x24')](function(_0xbbf6c4){_0x378f50[_0xf0fa('0x1f')]=_0xbbf6c4;if(_0x4d70a9[_0xf0fa('0x30')]['includeAll']){_0xfb8387[_0xf0fa('0x40')]=[{'all':!![]}];}return db['Sound'][_0xf0fa('0x41')](_0xfb8387);})[_0xf0fa('0x24')](function(_0x14be99){_0x378f50[_0xf0fa('0x42')]=_0x14be99;return _0x378f50;})[_0xf0fa('0x24')](respondWithFilteredResult(_0x349eed,_0xfb8387))['catch'](handleError(_0x349eed,null));};exports[_0xf0fa('0x43')]=function(_0x2c0a3c,_0x5bf16c){var _0x1dd946={'raw':!![],'where':{'id':_0x2c0a3c[_0xf0fa('0x44')]['id']}},_0x1b3c16={};_0x1b3c16[_0xf0fa('0x2e')]=_[_0xf0fa('0x45')](db[_0xf0fa('0x2b')][_0xf0fa('0x46')]);_0x1b3c16[_0xf0fa('0x30')]=_['keys'](_0x2c0a3c[_0xf0fa('0x30')]);_0x1b3c16['filters']=_[_0xf0fa('0x32')](_0x1b3c16[_0xf0fa('0x2e')],_0x1b3c16['query']);_0x1dd946[_0xf0fa('0x31')]=_['intersection'](_0x1b3c16[_0xf0fa('0x2e')],qs[_0xf0fa('0x33')](_0x2c0a3c[_0xf0fa('0x30')]['fields']));_0x1dd946[_0xf0fa('0x31')]=_0x1dd946[_0xf0fa('0x31')][_0xf0fa('0x34')]?_0x1dd946[_0xf0fa('0x31')]:_0x1b3c16['model'];if(_0x2c0a3c[_0xf0fa('0x30')][_0xf0fa('0x47')]){_0x1dd946[_0xf0fa('0x40')]=[{'all':!![]}];}_0x1dd946=_[_0xf0fa('0x3c')]({},_0x1dd946,_0x2c0a3c[_0xf0fa('0x3f')]);return db[_0xf0fa('0x2b')][_0xf0fa('0x48')](_0x1dd946)[_0xf0fa('0x24')](handleEntityNotFound(_0x5bf16c,null))[_0xf0fa('0x24')](respondWithResult(_0x5bf16c,null))[_0xf0fa('0x49')](handleError(_0x5bf16c,null));};exports['download']=function(_0x4d0ae2,_0x4e72bb,_0x1eae77){return db[_0xf0fa('0x2b')]['find']({'where':{'id':_0x4d0ae2[_0xf0fa('0x44')]['id']},'attributes':[_0xf0fa('0x29'),_0xf0fa('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x4e72bb,null))[_0xf0fa('0x24')](function(_0x2766bd){if(_0x2766bd){if(!fs['existsSync'](path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),_0x2766bd[_0xf0fa('0x4a')]+'.'+_0x2766bd[_0xf0fa('0x4e')]))){throw new db['Sequelize'][(_0xf0fa('0x4f'))](_0xf0fa('0x50'));}return _0x4e72bb[_0xf0fa('0x51')](path['join'](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')]('%s.%s',_0x2766bd[_0xf0fa('0x4a')],_0x2766bd[_0xf0fa('0x4e')])),util[_0xf0fa('0x52')]('%s.%s',_0x2766bd[_0xf0fa('0x29')],_0x2766bd['converted_format']));}return null;})['catch'](handleError(_0x4e72bb,null));};exports['create']=function(_0x1155ab,_0xe190c3,_0x191bb1){var _0x3f6831={'name':path[_0xf0fa('0x53')](_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x55')],path['extname'](_0x1155ab[_0xf0fa('0x54')]['originalname'])),'save_name':path[_0xf0fa('0x53')](_0x1155ab['file'][_0xf0fa('0x56')],path['extname'](_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x56')])),'original_format':path['extname'](_0x1155ab['file'][_0xf0fa('0x55')])[_0xf0fa('0x57')](0x1),'converted_format':_0xf0fa('0x58')};var _0x56282c=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],'server/files/sounds/original',_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x56')]);var _0x19254a=path['join'](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')]('%s.%s',path[_0xf0fa('0x53')](_0x1155ab['file'][_0xf0fa('0x56')],path['extname'](_0x1155ab[_0xf0fa('0x54')]['filename'])),_0x3f6831[_0xf0fa('0x4e')]));logger[_0xf0fa('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x56282c);logger[_0xf0fa('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x19254a);try{fs[_0xf0fa('0x5a')](_0x56282c,parseInt('0777',0x8));var _0xe263d3=sox[_0xf0fa('0x5b')](_0x56282c,_0x19254a,{'sampleRate':0x1f40,'format':_0xf0fa('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xe263d3['on'](_0xf0fa('0x28'),function(_0x36deaa){fs[_0xf0fa('0x5c')](_0x56282c);_0xe190c3['status'](0x1f4)['send'](_0x36deaa);});_0xe263d3['on'](_0xf0fa('0x5d'),function(_0x33f99b){_0x3f6831[_0xf0fa('0x5e')]=isNaN(_0x33f99b[_0xf0fa('0x5f')])?null:_0x33f99b[_0xf0fa('0x5f')]*0x3e8;_0x3f6831['original_sampleCount']=isNaN(_0x33f99b[_0xf0fa('0x60')])?null:_0x33f99b[_0xf0fa('0x60')];_0x3f6831['original_channelCount']=isNaN(_0x33f99b[_0xf0fa('0x61')])?null:_0x33f99b[_0xf0fa('0x61')];_0x3f6831[_0xf0fa('0x62')]=isNaN(_0x33f99b['bitRate'])?null:_0x33f99b[_0xf0fa('0x63')];_0x3f6831[_0xf0fa('0x64')]=isNaN(_0x33f99b[_0xf0fa('0x65')])?null:_0x33f99b[_0xf0fa('0x65')];});_0xe263d3['on'](_0xf0fa('0x66'),function(_0x847b5c){_0x3f6831[_0xf0fa('0x67')]=isNaN(_0x847b5c[_0xf0fa('0x5f')])?null:_0x847b5c[_0xf0fa('0x5f')]*0x3e8;_0x3f6831[_0xf0fa('0x68')]=isNaN(_0x847b5c[_0xf0fa('0x60')])?null:_0x847b5c[_0xf0fa('0x60')];_0x3f6831['converted_channelCount']=isNaN(_0x847b5c[_0xf0fa('0x61')])?null:_0x847b5c[_0xf0fa('0x61')];_0x3f6831[_0xf0fa('0x69')]=isNaN(_0x847b5c[_0xf0fa('0x63')])?null:_0x847b5c['bitRate'];_0x3f6831[_0xf0fa('0x6a')]=isNaN(_0x847b5c['sampleRate'])?null:_0x847b5c[_0xf0fa('0x65')];});_0xe263d3['on']('end',function(){fs['chmodSync'](_0x19254a,parseInt(_0xf0fa('0x6b'),0x8));return db[_0xf0fa('0x2b')][_0xf0fa('0x6c')](_0x3f6831)[_0xf0fa('0x24')](function(_0x2f8930){var _0x29d896={'role':_0x1155ab[_0xf0fa('0x6d')]['role'],'userProfileId':_0x1155ab['body'][_0xf0fa('0x6e')]};if(!_0x29d896)throw new Error(_0xf0fa('0x6f'));if(_0x29d896[_0xf0fa('0x70')]===_0xf0fa('0x71')){var _0x24bc67=_0x2f8930[_0xf0fa('0x26')]({'plain':!![]});return db[_0xf0fa('0x72')]['find']({'where':{'name':_0xf0fa('0x73'),'userProfileId':_0x29d896[_0xf0fa('0x6e')]},'raw':!![]})[_0xf0fa('0x24')](function(_0x51a17d){if(_0x51a17d&&_0x51a17d[_0xf0fa('0x74')]===0x0){return db['UserProfileResource'][_0xf0fa('0x6c')]({'name':_0x24bc67['name'],'resourceId':_0x24bc67['id'],'type':_0x51a17d['name'],'sectionId':_0x51a17d['id']},{})['then'](function(){return _0x2f8930;});}else{return _0x2f8930;}})['catch'](function(_0x16b528){logger['error'](_0xf0fa('0x75'),_0x16b528);throw _0x16b528;});}return _0x2f8930;})[_0xf0fa('0x24')](respondWithResult(_0xe190c3,null))[_0xf0fa('0x49')](handleError(_0xe190c3,null));});_0xe263d3[_0xf0fa('0x76')]();}catch(_0x242f8f){_0xe190c3['status'](0x1f4)[_0xf0fa('0x2a')](_0x242f8f);}};exports[_0xf0fa('0x77')]=function(_0x3fbaf2,_0x26e925,_0x120fdd){return db[_0xf0fa('0x2b')]['find']({'where':{'id':_0x3fbaf2[_0xf0fa('0x44')]['id']}})[_0xf0fa('0x24')](handleEntityNotFound(_0x26e925,null))['then'](saveUpdates(_[_0xf0fa('0x3a')](_0x3fbaf2[_0xf0fa('0x6d')],['name','description']),null))[_0xf0fa('0x24')](respondWithResult(_0x26e925,null))[_0xf0fa('0x49')](handleError(_0x26e925,null));};exports[_0xf0fa('0x78')]=function(_0x4bcf78,_0x31c0aa,_0x22ead5){return db['Sound'][_0xf0fa('0x48')]({'where':{'id':_0x4bcf78['params']['id']}})[_0xf0fa('0x24')](function(_0x1fde29){if(_0x1fde29){return _0x1fde29[_0xf0fa('0x25')]();}})[_0xf0fa('0x24')](function(_0x2d2799){var _0x1bcade=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x79'),util[_0xf0fa('0x52')]('%s.%s',_0x2d2799[_0xf0fa('0x4a')],_0x2d2799['original_format']));var _0x1f219e=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')](_0xf0fa('0x7a'),_0x2d2799[_0xf0fa('0x4a')],_0x2d2799[_0xf0fa('0x4e')]));fs['unlinkSync'](_0x1bcade);fs[_0xf0fa('0x5c')](_0x1f219e);return _0x2d2799;})[_0xf0fa('0x24')](function(_0xbf0430){if(_0xbf0430){return _0x31c0aa[_0xf0fa('0x19')](0xcc)[_0xf0fa('0x1a')]();}})[_0xf0fa('0x24')](handleEntityNotFound(_0x31c0aa,null))[_0xf0fa('0x49')](handleError(_0x31c0aa,null));}; \ No newline at end of file +var _0x9417=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','get','Sounds','destroy','end','name','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','download','find','save_name','converted_format','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','send','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5b0540,_0xc6d8b3){var _0x131754=function(_0x3f6992){while(--_0x3f6992){_0x5b0540['push'](_0x5b0540['shift']());}};_0x131754(++_0xc6d8b3);}(_0x9417,0xe6));var _0x7941=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9417[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7941('0x0'));var zipdir=require(_0x7941('0x1'));var jsonpatch=require(_0x7941('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7941('0x3'));var util=require(_0x7941('0x4'));var path=require(_0x7941('0x5'));var sox=require(_0x7941('0x6'));var csv=require(_0x7941('0x7'));var ejs=require(_0x7941('0x8'));var fs=require('fs');var fs_extra=require(_0x7941('0x9'));var _=require(_0x7941('0xa'));var squel=require(_0x7941('0xb'));var crypto=require(_0x7941('0xc'));var jsforce=require(_0x7941('0xd'));var deskjs=require(_0x7941('0xe'));var toCsv=require(_0x7941('0x7'));var querystring=require(_0x7941('0xf'));var Papa=require(_0x7941('0x10'));var Redis=require(_0x7941('0x11'));var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7941('0x14'))(_0x7941('0x15'));var utils=require(_0x7941('0x16'));var config=require(_0x7941('0x17'));var licenseUtil=require(_0x7941('0x18'));var db=require(_0x7941('0x19'))['db'];function respondWithStatusCode(_0x5060b0,_0x5b1ca2){_0x5b1ca2=_0x5b1ca2||0xcc;return function(_0x1bfe9d){if(_0x1bfe9d){return _0x5060b0['sendStatus'](_0x5b1ca2);}return _0x5060b0['status'](_0x5b1ca2)['end']();};}function respondWithResult(_0x1e17d2,_0x4c4b4d){_0x4c4b4d=_0x4c4b4d||0xc8;return function(_0x337b12){if(_0x337b12){return _0x1e17d2[_0x7941('0x1a')](_0x4c4b4d)[_0x7941('0x1b')](_0x337b12);}};}function respondWithFilteredResult(_0xdc9e44,_0x474538){return function(_0x18119f){if(_0x18119f){var _0x4d524d=typeof _0x474538['offset']===_0x7941('0x1c')&&typeof _0x474538[_0x7941('0x1d')]===_0x7941('0x1c');var _0xc35338=_0x18119f['count'];var _0x444460=_0x4d524d?0x0:_0x474538[_0x7941('0x1e')];var _0x85928e=_0x4d524d?_0x18119f[_0x7941('0x1f')]:_0x474538[_0x7941('0x1e')]+_0x474538[_0x7941('0x1d')];var _0x1bd9d8;if(_0x85928e>=_0xc35338){_0x85928e=_0xc35338;_0x1bd9d8=0xc8;}else{_0x1bd9d8=0xce;}_0xdc9e44[_0x7941('0x1a')](_0x1bd9d8);return _0xdc9e44[_0x7941('0x20')]('Content-Range',_0x444460+'-'+_0x85928e+'/'+_0xc35338)['json'](_0x18119f);}return null;};}function patchUpdates(_0x50bb89){return function(_0x56847){try{jsonpatch[_0x7941('0x21')](_0x56847,_0x50bb89,!![]);}catch(_0x13a19d){return BPromise[_0x7941('0x22')](_0x13a19d);}return _0x56847[_0x7941('0x23')]();};}function saveUpdates(_0x410ee3,_0x1d0efd){return function(_0xde75d4){if(_0xde75d4){return _0xde75d4[_0x7941('0x24')](_0x410ee3)[_0x7941('0x25')](function(_0x724c92){return _0x724c92;});}return null;};}function removeEntity(_0x365e8b,_0x4cb9ef){return function(_0xdaf685){if(_0xdaf685){return _0xdaf685['destroy']()[_0x7941('0x25')](function(){var _0x389c8e=_0xdaf685[_0x7941('0x26')]({'plain':!![]});var _0x55e279=_0x7941('0x27');return db['UserProfileResource'][_0x7941('0x28')]({'where':{'type':_0x55e279,'resourceId':_0x389c8e['id']}})[_0x7941('0x25')](function(){return _0xdaf685;});})[_0x7941('0x25')](function(){_0x365e8b[_0x7941('0x1a')](0xcc)[_0x7941('0x29')]();});}};}function handleEntityNotFound(_0x475adb,_0x375ade){return function(_0x4e0ae8){if(!_0x4e0ae8){_0x475adb['sendStatus'](0x194);}return _0x4e0ae8;};}function handleError(_0x3c2ae8,_0x20cbb6){_0x20cbb6=_0x20cbb6||0x1f4;return function(_0x31c69f){logger['error'](_0x31c69f['stack']);if(_0x31c69f[_0x7941('0x2a')]){delete _0x31c69f['name'];}_0x3c2ae8[_0x7941('0x1a')](_0x20cbb6)['send'](_0x31c69f);};}exports['index']=function(_0x32cea9,_0x490beb){var _0x184a57={},_0x50e2e1={},_0x58d91d={'count':0x0,'rows':[]};var _0x30a76c=_[_0x7941('0x2b')](db[_0x7941('0x2c')]['rawAttributes'],function(_0x47c64c){return{'name':_0x47c64c[_0x7941('0x2d')],'type':_0x47c64c[_0x7941('0x2e')][_0x7941('0x2f')]};});_0x50e2e1[_0x7941('0x30')]=_['map'](_0x30a76c,_0x7941('0x2a'));_0x50e2e1[_0x7941('0x31')]=_[_0x7941('0x32')](_0x32cea9[_0x7941('0x31')]);_0x50e2e1[_0x7941('0x33')]=_[_0x7941('0x34')](_0x50e2e1[_0x7941('0x30')],_0x50e2e1[_0x7941('0x31')]);_0x184a57[_0x7941('0x35')]=_['intersection'](_0x50e2e1[_0x7941('0x30')],qs[_0x7941('0x36')](_0x32cea9[_0x7941('0x31')][_0x7941('0x36')]));_0x184a57[_0x7941('0x35')]=_0x184a57[_0x7941('0x35')][_0x7941('0x37')]?_0x184a57[_0x7941('0x35')]:_0x50e2e1[_0x7941('0x30')];if(!_0x32cea9[_0x7941('0x31')][_0x7941('0x38')]('nolimit')){_0x184a57['limit']=qs[_0x7941('0x1d')](_0x32cea9[_0x7941('0x31')][_0x7941('0x1d')]);_0x184a57['offset']=qs[_0x7941('0x1e')](_0x32cea9[_0x7941('0x31')][_0x7941('0x1e')]);}_0x184a57[_0x7941('0x39')]=qs['sort'](_0x32cea9[_0x7941('0x31')][_0x7941('0x3a')]);_0x184a57['where']=qs['filters'](_[_0x7941('0x3b')](_0x32cea9['query'],_0x50e2e1['filters']),_0x30a76c);if(_0x32cea9[_0x7941('0x31')][_0x7941('0x3c')]){_0x184a57[_0x7941('0x3d')]=_[_0x7941('0x3e')](_0x184a57[_0x7941('0x3d')],{'$or':_['map'](_0x30a76c,function(_0x2eca15){if(_0x2eca15[_0x7941('0x2e')]!==_0x7941('0x3f')){var _0x26aacf={};_0x26aacf[_0x2eca15[_0x7941('0x2a')]]={'$like':'%'+_0x32cea9[_0x7941('0x31')][_0x7941('0x3c')]+'%'};return _0x26aacf;}})});}_0x184a57=_['merge']({},_0x184a57,_0x32cea9['options']);var _0x4852f1={'where':_0x184a57[_0x7941('0x3d')]};return db[_0x7941('0x2c')][_0x7941('0x1f')](_0x4852f1)[_0x7941('0x25')](function(_0x1cc51c){_0x58d91d['count']=_0x1cc51c;if(_0x32cea9['query'][_0x7941('0x40')]){_0x184a57[_0x7941('0x41')]=[{'all':!![]}];}return db[_0x7941('0x2c')][_0x7941('0x42')](_0x184a57);})[_0x7941('0x25')](function(_0x4ce718){_0x58d91d[_0x7941('0x43')]=_0x4ce718;return _0x58d91d;})['then'](respondWithFilteredResult(_0x490beb,_0x184a57))[_0x7941('0x44')](handleError(_0x490beb,null));};exports[_0x7941('0x45')]=function(_0x12aba8,_0x1925e6){var _0x57264a={'raw':!![],'where':{'id':_0x12aba8[_0x7941('0x46')]['id']}},_0x4283d5={};_0x4283d5[_0x7941('0x30')]=_[_0x7941('0x32')](db[_0x7941('0x2c')][_0x7941('0x47')]);_0x4283d5['query']=_['keys'](_0x12aba8[_0x7941('0x31')]);_0x4283d5[_0x7941('0x33')]=_[_0x7941('0x34')](_0x4283d5['model'],_0x4283d5['query']);_0x57264a['attributes']=_[_0x7941('0x34')](_0x4283d5[_0x7941('0x30')],qs[_0x7941('0x36')](_0x12aba8['query'][_0x7941('0x36')]));_0x57264a['attributes']=_0x57264a[_0x7941('0x35')][_0x7941('0x37')]?_0x57264a['attributes']:_0x4283d5[_0x7941('0x30')];if(_0x12aba8[_0x7941('0x31')][_0x7941('0x40')]){_0x57264a[_0x7941('0x41')]=[{'all':!![]}];}_0x57264a=_['merge']({},_0x57264a,_0x12aba8['options']);return db[_0x7941('0x2c')]['find'](_0x57264a)[_0x7941('0x25')](handleEntityNotFound(_0x1925e6,null))['then'](respondWithResult(_0x1925e6,null))['catch'](handleError(_0x1925e6,null));};exports[_0x7941('0x48')]=function(_0x2eb252,_0x41cce9,_0x2a0fe8){return db[_0x7941('0x2c')][_0x7941('0x49')]({'where':{'id':_0x2eb252[_0x7941('0x46')]['id']},'attributes':[_0x7941('0x2a'),_0x7941('0x4a'),_0x7941('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x41cce9,null))['then'](function(_0x57f6f8){if(_0x57f6f8){if(!fs['existsSync'](path['join'](config['root'],_0x7941('0x4c'),_0x57f6f8['save_name']+'.'+_0x57f6f8[_0x7941('0x4b')]))){throw new db['Sequelize'][(_0x7941('0x4d'))](_0x7941('0x4e'));}return _0x41cce9['download'](path['join'](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),_0x57f6f8[_0x7941('0x4a')],_0x57f6f8[_0x7941('0x4b')])),util['format'](_0x7941('0x51'),_0x57f6f8['name'],_0x57f6f8[_0x7941('0x4b')]));}return null;})[_0x7941('0x44')](handleError(_0x41cce9,null));};exports[_0x7941('0x52')]=function(_0xc39eb3,_0x26b26e,_0x34b7d2){var _0x1facbc={'name':path[_0x7941('0x53')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')])),'save_name':path[_0x7941('0x53')](_0xc39eb3['file'][_0x7941('0x57')],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x57')])),'original_format':path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')])[_0x7941('0x58')](0x1),'converted_format':'wav'};var _0x2da1b1=path['join'](config[_0x7941('0x4f')],_0x7941('0x59'),_0xc39eb3[_0x7941('0x54')][_0x7941('0x57')]);var _0x4308a4=path[_0x7941('0x5a')](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),path[_0x7941('0x53')](_0xc39eb3[_0x7941('0x54')]['filename'],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')]['filename'])),_0x1facbc[_0x7941('0x4b')]));logger[_0x7941('0x5b')](_0x7941('0x5c'),_0x2da1b1);logger['info'](_0x7941('0x5d'),_0x4308a4);try{fs[_0x7941('0x5e')](_0x2da1b1,parseInt(_0x7941('0x5f'),0x8));var _0x5c1f2f=sox[_0x7941('0x60')](_0x2da1b1,_0x4308a4,{'sampleRate':0x1f40,'format':_0x7941('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c1f2f['on'](_0x7941('0x62'),function(_0x3b047b){fs[_0x7941('0x63')](_0x2da1b1);_0x26b26e['status'](0x1f4)[_0x7941('0x64')](_0x3b047b);});_0x5c1f2f['on']('src',function(_0x3fa897){_0x1facbc[_0x7941('0x65')]=isNaN(_0x3fa897['duration'])?null:_0x3fa897['duration']*0x3e8;_0x1facbc['original_sampleCount']=isNaN(_0x3fa897[_0x7941('0x66')])?null:_0x3fa897[_0x7941('0x66')];_0x1facbc[_0x7941('0x67')]=isNaN(_0x3fa897[_0x7941('0x68')])?null:_0x3fa897['channelCount'];_0x1facbc[_0x7941('0x69')]=isNaN(_0x3fa897[_0x7941('0x6a')])?null:_0x3fa897['bitRate'];_0x1facbc[_0x7941('0x6b')]=isNaN(_0x3fa897[_0x7941('0x6c')])?null:_0x3fa897[_0x7941('0x6c')];});_0x5c1f2f['on'](_0x7941('0x6d'),function(_0x28456e){_0x1facbc[_0x7941('0x6e')]=isNaN(_0x28456e[_0x7941('0x6f')])?null:_0x28456e[_0x7941('0x6f')]*0x3e8;_0x1facbc['converted_sampleCount']=isNaN(_0x28456e[_0x7941('0x66')])?null:_0x28456e['sampleCount'];_0x1facbc[_0x7941('0x70')]=isNaN(_0x28456e[_0x7941('0x68')])?null:_0x28456e[_0x7941('0x68')];_0x1facbc[_0x7941('0x71')]=isNaN(_0x28456e[_0x7941('0x6a')])?null:_0x28456e[_0x7941('0x6a')];_0x1facbc[_0x7941('0x72')]=isNaN(_0x28456e['sampleRate'])?null:_0x28456e[_0x7941('0x6c')];});_0x5c1f2f['on'](_0x7941('0x29'),function(){fs[_0x7941('0x5e')](_0x4308a4,parseInt(_0x7941('0x5f'),0x8));return db[_0x7941('0x2c')][_0x7941('0x52')](_0x1facbc)[_0x7941('0x25')](function(_0xbc26f4){var _0x274d01={'role':_0xc39eb3[_0x7941('0x73')]['role'],'userProfileId':_0xc39eb3['body']['userProfileId']};if(!_0x274d01)throw new Error(_0x7941('0x74'));if(_0x274d01[_0x7941('0x75')]===_0x7941('0x76')){var _0x19ca3c=_0xbc26f4[_0x7941('0x26')]({'plain':!![]});return db[_0x7941('0x77')][_0x7941('0x49')]({'where':{'name':_0x7941('0x27'),'userProfileId':_0x274d01['userProfileId']},'raw':!![]})[_0x7941('0x25')](function(_0x132e40){if(_0x132e40&&_0x132e40['autoAssociation']===0x0){return db[_0x7941('0x78')][_0x7941('0x52')]({'name':_0x19ca3c[_0x7941('0x2a')],'resourceId':_0x19ca3c['id'],'type':_0x132e40['name'],'sectionId':_0x132e40['id']},{})[_0x7941('0x25')](function(){return _0xbc26f4;});}else{return _0xbc26f4;}})[_0x7941('0x44')](function(_0x225ba9){logger[_0x7941('0x62')](_0x7941('0x79'),_0x225ba9);throw _0x225ba9;});}return _0xbc26f4;})['then'](respondWithResult(_0x26b26e,null))[_0x7941('0x44')](handleError(_0x26b26e,null));});_0x5c1f2f[_0x7941('0x7a')]();}catch(_0x14b55b){_0x26b26e[_0x7941('0x1a')](0x1f4)[_0x7941('0x64')](_0x14b55b);}};exports[_0x7941('0x24')]=function(_0x5dffb8,_0x15138e,_0x1f8267){return db[_0x7941('0x2c')][_0x7941('0x49')]({'where':{'id':_0x5dffb8[_0x7941('0x46')]['id']}})[_0x7941('0x25')](handleEntityNotFound(_0x15138e,null))[_0x7941('0x25')](saveUpdates(_[_0x7941('0x3b')](_0x5dffb8[_0x7941('0x73')],['name','description']),null))['then'](respondWithResult(_0x15138e,null))[_0x7941('0x44')](handleError(_0x15138e,null));};exports[_0x7941('0x7b')]=function(_0x19238a,_0x3a20bf,_0xe05003){return db['Sound'][_0x7941('0x49')]({'where':{'id':_0x19238a['params']['id']}})[_0x7941('0x25')](function(_0x4f2e33){if(_0x4f2e33){return _0x4f2e33[_0x7941('0x28')]();}})['then'](function(_0x8d5279){var _0x26631e=path[_0x7941('0x5a')](config[_0x7941('0x4f')],_0x7941('0x59'),util['format'](_0x7941('0x51'),_0x8d5279[_0x7941('0x4a')],_0x8d5279['original_format']));var _0x38fd07=path['join'](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),_0x8d5279[_0x7941('0x4a')],_0x8d5279[_0x7941('0x4b')]));fs['unlinkSync'](_0x26631e);fs['unlinkSync'](_0x38fd07);return _0x8d5279;})[_0x7941('0x25')](function(_0x5af809){if(_0x5af809){return _0x3a20bf['status'](0xcc)[_0x7941('0x29')]();}})[_0x7941('0x25')](handleEntityNotFound(_0x3a20bf,null))[_0x7941('0x44')](handleError(_0x3a20bf,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f9771c7..65bfdd2 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 _0x7a5e=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','./sound.attributes'];(function(_0x406d10,_0x2064f8){var _0x40e684=function(_0x1b9bd6){while(--_0x1b9bd6){_0x406d10['push'](_0x406d10['shift']());}};_0x40e684(++_0x2064f8);}(_0x7a5e,0xac));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var logger=require(_0xe7a5('0x2'))(_0xe7a5('0x3'));var moment=require('moment');var BPromise=require(_0xe7a5('0x4'));var rp=require(_0xe7a5('0x5'));var fs=require('fs');var path=require(_0xe7a5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7a5('0x7'));module[_0xe7a5('0x8')]=function(_0x2a87d1,_0x1cb360){return _0x2a87d1[_0xe7a5('0x9')](_0xe7a5('0xa'),attributes,{'tableName':_0xe7a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9be9=['Sound','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports','define'];(function(_0x5afdc4,_0x3be94e){var _0x41cf71=function(_0x25eb22){while(--_0x25eb22){_0x5afdc4['push'](_0x5afdc4['shift']());}};_0x41cf71(++_0x3be94e);}(_0x9be9,0xf1));var _0x99be=function(_0x525117,_0x25d139){_0x525117=_0x525117-0x0;var _0x2997f0=_0x9be9[_0x525117];return _0x2997f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x99be('0x0'));var moment=require(_0x99be('0x1'));var BPromise=require(_0x99be('0x2'));var rp=require(_0x99be('0x3'));var fs=require('fs');var path=require(_0x99be('0x4'));var rimraf=require(_0x99be('0x5'));var config=require('../../config/environment');var attributes=require(_0x99be('0x6'));module[_0x99be('0x7')]=function(_0x7f7418,_0x150b3f){return _0x7f7418[_0x99be('0x8')](_0x99be('0x9'),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 fdb2de4..0c098a0 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 _0xfb15=['../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','options','raw','where','include','attributes','map','model','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x176539,_0x24dd37){var _0x439468=function(_0x2a5d15){while(--_0x2a5d15){_0x176539['push'](_0x176539['shift']());}};_0x439468(++_0x24dd37);}(_0xfb15,0x75));var _0x5fb1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xfb15[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x5fb1('0x0'));var moment=require('moment');var BPromise=require(_0x5fb1('0x1'));var rs=require(_0x5fb1('0x2'));var fs=require('fs');var Redis=require(_0x5fb1('0x3'));var db=require(_0x5fb1('0x4'))['db'];var utils=require(_0x5fb1('0x5'));var logger=require(_0x5fb1('0x6'))('rpc');var config=require(_0x5fb1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fb1('0x8')][_0x5fb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13932e,_0x19e21b,_0x371a2d){return new BPromise(function(_0x673e0f,_0x925208){return client[_0x5fb1('0xa')](_0x13932e,_0x371a2d)[_0x5fb1('0xb')](function(_0x10dd25){logger[_0x5fb1('0xc')](_0x5fb1('0xd'),_0x19e21b,'request\x20sent');logger[_0x5fb1('0xe')](_0x5fb1('0xf'),_0x19e21b,_0x5fb1('0x10'),JSON[_0x5fb1('0x11')](_0x10dd25));if(_0x10dd25[_0x5fb1('0x12')]){if(_0x10dd25[_0x5fb1('0x12')]['code']===0x1f4){logger[_0x5fb1('0x12')]('Sound,\x20%s,\x20%s',_0x19e21b,_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);return _0x925208(_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);}logger[_0x5fb1('0x12')](_0x5fb1('0xd'),_0x19e21b,_0x10dd25['error']['message']);return _0x673e0f(_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);}else{logger[_0x5fb1('0xc')]('Sound,\x20%s,\x20%s',_0x19e21b,'request\x20sent');_0x673e0f(_0x10dd25[_0x5fb1('0x14')]['message']);}})['catch'](function(_0x34e150){logger[_0x5fb1('0x12')]('Sound,\x20%s,\x20%s',_0x19e21b,_0x34e150);_0x925208(_0x34e150);});});}exports[_0x5fb1('0x15')]=function(_0x5c0aa4){var _0xebb0f6=this;return new Promise(function(_0x5eca76,_0x4b39bf){return db[_0x5fb1('0x16')]['find']({'raw':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x19')]||null:null,'attributes':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')]['attributes']||null:null,'include':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4['options'][_0x5fb1('0x1a')]?_['map'](_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x1a')],function(_0x169bc4){return{'model':db[_0x169bc4['model']],'as':_0x169bc4['as'],'attributes':_0x169bc4[_0x5fb1('0x1b')],'include':_0x169bc4[_0x5fb1('0x1a')]?_[_0x5fb1('0x1c')](_0x169bc4[_0x5fb1('0x1a')],function(_0x772998){return{'model':db[_0x772998[_0x5fb1('0x1d')]],'as':_0x772998['as'],'attributes':_0x772998[_0x5fb1('0x1b')],'include':_0x772998[_0x5fb1('0x1a')]?_[_0x5fb1('0x1c')](_0x772998['include'],function(_0x372d08){return{'model':db[_0x372d08[_0x5fb1('0x1d')]],'as':_0x372d08['as'],'attributes':_0x372d08[_0x5fb1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5fb1('0xb')](function(_0x44bd23){logger[_0x5fb1('0xc')](_0x5fb1('0x15'),_0x5c0aa4);logger[_0x5fb1('0xe')](_0x5fb1('0x15'),_0x5c0aa4,JSON['stringify'](_0x44bd23));_0x5eca76(_0x44bd23);})[_0x5fb1('0x1e')](function(_0x3b23c4){logger['error']('ShowSound',_0x3b23c4['message'],_0x5c0aa4);_0x4b39bf(_0xebb0f6[_0x5fb1('0x12')](0x1f4,_0x3b23c4[_0x5fb1('0x13')]));});});}; \ No newline at end of file +var _0x5a33=['stringify','error','code','message','result','Sound','find','options','raw','attributes','include','map','model','ShowSound','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x5a33,0x1b3));var _0x35a3=function(_0x1e48e7,_0xf3114b){_0x1e48e7=_0x1e48e7-0x0;var _0x3712d4=_0x5a33[_0x1e48e7];return _0x3712d4;};'use strict';var _=require(_0x35a3('0x0'));var util=require(_0x35a3('0x1'));var moment=require(_0x35a3('0x2'));var BPromise=require(_0x35a3('0x3'));var rs=require(_0x35a3('0x4'));var fs=require('fs');var Redis=require(_0x35a3('0x5'));var db=require(_0x35a3('0x6'))['db'];var utils=require(_0x35a3('0x7'));var logger=require(_0x35a3('0x8'))(_0x35a3('0x9'));var config=require(_0x35a3('0xa'));var jayson=require(_0x35a3('0xb'));var client=jayson[_0x35a3('0xc')][_0x35a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb4d32,_0x59d953,_0x17bc05){return new BPromise(function(_0x499482,_0x8d2385){return client[_0x35a3('0xe')](_0xb4d32,_0x17bc05)[_0x35a3('0xf')](function(_0x4c13a0){logger[_0x35a3('0x10')](_0x35a3('0x11'),_0x59d953,_0x35a3('0x12'));logger[_0x35a3('0x13')]('Sound,\x20%s,\x20%s,\x20%s',_0x59d953,'request\x20sent',JSON[_0x35a3('0x14')](_0x4c13a0));if(_0x4c13a0[_0x35a3('0x15')]){if(_0x4c13a0['error'][_0x35a3('0x16')]===0x1f4){logger[_0x35a3('0x15')]('Sound,\x20%s,\x20%s',_0x59d953,_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);return _0x8d2385(_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);}logger[_0x35a3('0x15')](_0x35a3('0x11'),_0x59d953,_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);return _0x499482(_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);}else{logger[_0x35a3('0x10')](_0x35a3('0x11'),_0x59d953,_0x35a3('0x12'));_0x499482(_0x4c13a0[_0x35a3('0x18')][_0x35a3('0x17')]);}})['catch'](function(_0xe7baa6){logger['error'](_0x35a3('0x11'),_0x59d953,_0xe7baa6);_0x8d2385(_0xe7baa6);});});}exports['ShowSound']=function(_0x2b7975){var _0x826089=this;return new Promise(function(_0x5352fb,_0xf30e97){return db[_0x35a3('0x19')][_0x35a3('0x1a')]({'raw':_0x2b7975['options']?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')]['where']||null:null,'attributes':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1d')]||null:null,'include':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1e')],function(_0x5c0ce5){return{'model':db[_0x5c0ce5[_0x35a3('0x20')]],'as':_0x5c0ce5['as'],'attributes':_0x5c0ce5['attributes'],'include':_0x5c0ce5[_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x5c0ce5[_0x35a3('0x1e')],function(_0x312530){return{'model':db[_0x312530[_0x35a3('0x20')]],'as':_0x312530['as'],'attributes':_0x312530[_0x35a3('0x1d')],'include':_0x312530[_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x312530[_0x35a3('0x1e')],function(_0x769a49){return{'model':db[_0x769a49[_0x35a3('0x20')]],'as':_0x769a49['as'],'attributes':_0x769a49[_0x35a3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35a3('0xf')](function(_0xac9b1e){logger['info'](_0x35a3('0x21'),_0x2b7975);logger[_0x35a3('0x13')](_0x35a3('0x21'),_0x2b7975,JSON[_0x35a3('0x14')](_0xac9b1e));_0x5352fb(_0xac9b1e);})[_0x35a3('0x22')](function(_0x4bccd8){logger[_0x35a3('0x15')](_0x35a3('0x21'),_0x4bccd8['message'],_0x2b7975);_0xf30e97(_0x826089[_0x35a3('0x15')](0x1f4,_0x4bccd8[_0x35a3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cad7e7a..5c290cc 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x441ea2,_0x19bbaa){var _0x316bea=function(_0x3e48e3){while(--_0x3e48e3){_0x441ea2['push'](_0x441ea2['shift']());}};_0x316bea(++_0x19bbaa);}(_0x5eb8,0xb0));var _0x85eb=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x5eb8[_0xf7f60a];return _0x2567ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc8ea89,_0x41819d){var _0x36fbe5=function(_0xe335ca){while(--_0xe335ca){_0xc8ea89['push'](_0xc8ea89['shift']());}};_0x36fbe5(++_0x41819d);}(_0xb10b,0x12a));var _0xbb10=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0xb10b[_0x25bb4c];return _0x4c78b2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b2ad3d2..a5bf04f 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 _0x6638=['medium','ENUM','STRING','TEXT','sequelize','exports'];(function(_0x36198b,_0x3584d9){var _0x3c51c1=function(_0x3292dd){while(--_0x3292dd){_0x36198b['push'](_0x36198b['shift']());}};_0x3c51c1(++_0x3584d9);}(_0x6638,0x1ae));var _0x8663=function(_0x2b7355,_0x4ad54b){_0x2b7355=_0x2b7355-0x0;var _0x2ca8d3=_0x6638[_0x2b7355];return _0x2ca8d3;};'use strict';var Sequelize=require(_0x8663('0x0'));module[_0x8663('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x8663('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x8663('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8663('0x4')]},'providerResponse':{'type':Sequelize[_0x8663('0x5')]}}; \ No newline at end of file +var _0xe70b=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x27621f,_0x371da3){var _0x3938eb=function(_0x28a75f){while(--_0x28a75f){_0x27621f['push'](_0x27621f['shift']());}};_0x3938eb(++_0x371da3);}(_0xe70b,0x67));var _0xbe70=function(_0x47fcd3,_0x56bab3){_0x47fcd3=_0x47fcd3-0x0;var _0x863076=_0xe70b[_0x47fcd3];return _0x863076;};'use strict';var Sequelize=require(_0xbe70('0x0'));module[_0xbe70('0x1')]={'uniqueid':{'type':Sequelize[_0xbe70('0x2')]},'body':{'type':Sequelize[_0xbe70('0x3')](_0xbe70('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe70('0x5')),'defaultValue':_0xbe70('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbe70('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f2ea447..bb75cb2 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 _0xfaeb=['save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','includeAll','include','findAll','show','params','SquareMessage','length','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x45dbe2,_0x3e0483){var _0x50fbdd=function(_0x5008a0){while(--_0x5008a0){_0x45dbe2['push'](_0x45dbe2['shift']());}};_0x50fbdd(++_0x3e0483);}(_0xfaeb,0x1a4));var _0xbfae=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xfaeb[_0x30cd7e];return _0x462a02;};'use strict';var emlformat=require(_0xbfae('0x0'));var rimraf=require(_0xbfae('0x1'));var zipdir=require(_0xbfae('0x2'));var jsonpatch=require(_0xbfae('0x3'));var rp=require(_0xbfae('0x4'));var moment=require(_0xbfae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfae('0x6'));var util=require(_0xbfae('0x7'));var path=require(_0xbfae('0x8'));var sox=require(_0xbfae('0x9'));var csv=require(_0xbfae('0xa'));var ejs=require(_0xbfae('0xb'));var fs=require('fs');var fs_extra=require(_0xbfae('0xc'));var _=require(_0xbfae('0xd'));var squel=require(_0xbfae('0xe'));var crypto=require(_0xbfae('0xf'));var jsforce=require(_0xbfae('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbfae('0x11'));var Redis=require(_0xbfae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbfae('0x13'));var as=require(_0xbfae('0x14'));var hardwareService=require(_0xbfae('0x15'));var logger=require(_0xbfae('0x16'))(_0xbfae('0x17'));var utils=require(_0xbfae('0x18'));var config=require(_0xbfae('0x19'));var licenseUtil=require(_0xbfae('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c73bb,_0x485c46){_0x485c46=_0x485c46||0xcc;return function(_0x66bb25){if(_0x66bb25){return _0x3c73bb['sendStatus'](_0x485c46);}return _0x3c73bb[_0xbfae('0x1b')](_0x485c46)['end']();};}function respondWithResult(_0x17aefb,_0x2d5b1d){_0x2d5b1d=_0x2d5b1d||0xc8;return function(_0x50d10a){if(_0x50d10a){return _0x17aefb['status'](_0x2d5b1d)[_0xbfae('0x1c')](_0x50d10a);}};}function respondWithFilteredResult(_0x40cb25,_0x210b56){return function(_0x4613ac){if(_0x4613ac){var _0x4bc9dd=typeof _0x210b56[_0xbfae('0x1d')]===_0xbfae('0x1e')&&typeof _0x210b56['limit']===_0xbfae('0x1e');var _0x377251=_0x4613ac['count'];var _0x4945c7=_0x4bc9dd?0x0:_0x210b56[_0xbfae('0x1d')];var _0xd908ea=_0x4bc9dd?_0x4613ac[_0xbfae('0x1f')]:_0x210b56[_0xbfae('0x1d')]+_0x210b56[_0xbfae('0x20')];var _0xbed1f9;if(_0xd908ea>=_0x377251){_0xd908ea=_0x377251;_0xbed1f9=0xc8;}else{_0xbed1f9=0xce;}_0x40cb25[_0xbfae('0x1b')](_0xbed1f9);return _0x40cb25[_0xbfae('0x21')](_0xbfae('0x22'),_0x4945c7+'-'+_0xd908ea+'/'+_0x377251)['json'](_0x4613ac);}return null;};}function patchUpdates(_0x5ccbf4){return function(_0x54c808){try{jsonpatch[_0xbfae('0x23')](_0x54c808,_0x5ccbf4,!![]);}catch(_0x47ec45){return BPromise['reject'](_0x47ec45);}return _0x54c808[_0xbfae('0x24')]();};}function saveUpdates(_0x56c607,_0x258bcb){return function(_0x38112a){if(_0x38112a){return _0x38112a[_0xbfae('0x25')](_0x56c607)[_0xbfae('0x26')](function(_0xc7eb69){return _0xc7eb69;});}return null;};}function removeEntity(_0x1007ff,_0x2edb2f){return function(_0x119f5c){if(_0x119f5c){return _0x119f5c[_0xbfae('0x27')]()[_0xbfae('0x26')](function(){_0x1007ff[_0xbfae('0x1b')](0xcc)[_0xbfae('0x28')]();});}};}function handleEntityNotFound(_0x47c482,_0x198029){return function(_0x16af47){if(!_0x16af47){_0x47c482[_0xbfae('0x29')](0x194);}return _0x16af47;};}function handleError(_0x5a1be9,_0x444db4){_0x444db4=_0x444db4||0x1f4;return function(_0x230f21){logger[_0xbfae('0x2a')](_0x230f21['stack']);if(_0x230f21[_0xbfae('0x2b')]){delete _0x230f21['name'];}_0x5a1be9[_0xbfae('0x1b')](_0x444db4)[_0xbfae('0x2c')](_0x230f21);};}exports[_0xbfae('0x2d')]=function(_0x1d6f59,_0x22c800){var _0x4158ed={},_0x46eb68={},_0x46e525={'count':0x0,'rows':[]};var _0x5b1956=_[_0xbfae('0x2e')](db['SquareMessage'][_0xbfae('0x2f')],function(_0x29661a){return{'name':_0x29661a[_0xbfae('0x30')],'type':_0x29661a[_0xbfae('0x31')][_0xbfae('0x32')]};});_0x46eb68[_0xbfae('0x33')]=_[_0xbfae('0x2e')](_0x5b1956,_0xbfae('0x2b'));_0x46eb68[_0xbfae('0x34')]=_[_0xbfae('0x35')](_0x1d6f59[_0xbfae('0x34')]);_0x46eb68['filters']=_[_0xbfae('0x36')](_0x46eb68[_0xbfae('0x33')],_0x46eb68[_0xbfae('0x34')]);_0x4158ed['attributes']=_['intersection'](_0x46eb68[_0xbfae('0x33')],qs[_0xbfae('0x37')](_0x1d6f59[_0xbfae('0x34')]['fields']));_0x4158ed[_0xbfae('0x38')]=_0x4158ed['attributes']['length']?_0x4158ed[_0xbfae('0x38')]:_0x46eb68['model'];if(!_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x39')](_0xbfae('0x3a'))){_0x4158ed[_0xbfae('0x20')]=qs[_0xbfae('0x20')](_0x1d6f59['query'][_0xbfae('0x20')]);_0x4158ed['offset']=qs[_0xbfae('0x1d')](_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x1d')]);}_0x4158ed[_0xbfae('0x3b')]=qs[_0xbfae('0x3c')](_0x1d6f59[_0xbfae('0x34')]['sort']);_0x4158ed['where']=qs[_0xbfae('0x3d')](_['pick'](_0x1d6f59['query'],_0x46eb68[_0xbfae('0x3d')]),_0x5b1956);if(_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x3e')]){_0x4158ed['where']=_[_0xbfae('0x3f')](_0x4158ed[_0xbfae('0x40')],{'$or':_[_0xbfae('0x2e')](_0x5b1956,function(_0x2a8e48){if(_0x2a8e48['type']!=='VIRTUAL'){var _0x4d9da3={};_0x4d9da3[_0x2a8e48[_0xbfae('0x2b')]]={'$like':'%'+_0x1d6f59['query'][_0xbfae('0x3e')]+'%'};return _0x4d9da3;}})});}_0x4158ed=_[_0xbfae('0x3f')]({},_0x4158ed,_0x1d6f59[_0xbfae('0x41')]);var _0x56728b={'where':_0x4158ed[_0xbfae('0x40')]};return db['SquareMessage'][_0xbfae('0x1f')](_0x56728b)[_0xbfae('0x26')](function(_0x300786){_0x46e525['count']=_0x300786;if(_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x42')]){_0x4158ed[_0xbfae('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0xbfae('0x44')](_0x4158ed);})[_0xbfae('0x26')](function(_0x20c928){_0x46e525['rows']=_0x20c928;return _0x46e525;})[_0xbfae('0x26')](respondWithFilteredResult(_0x22c800,_0x4158ed))['catch'](handleError(_0x22c800,null));};exports[_0xbfae('0x45')]=function(_0x2c50d9,_0x49a2e7){var _0x54ae0f={'raw':!![],'where':{'id':_0x2c50d9[_0xbfae('0x46')]['id']}},_0x467b12={};_0x467b12[_0xbfae('0x33')]=_[_0xbfae('0x35')](db[_0xbfae('0x47')][_0xbfae('0x2f')]);_0x467b12[_0xbfae('0x34')]=_[_0xbfae('0x35')](_0x2c50d9[_0xbfae('0x34')]);_0x467b12['filters']=_[_0xbfae('0x36')](_0x467b12['model'],_0x467b12[_0xbfae('0x34')]);_0x54ae0f[_0xbfae('0x38')]=_[_0xbfae('0x36')](_0x467b12[_0xbfae('0x33')],qs[_0xbfae('0x37')](_0x2c50d9['query']['fields']));_0x54ae0f['attributes']=_0x54ae0f['attributes'][_0xbfae('0x48')]?_0x54ae0f[_0xbfae('0x38')]:_0x467b12[_0xbfae('0x33')];if(_0x2c50d9['query'][_0xbfae('0x42')]){_0x54ae0f[_0xbfae('0x43')]=[{'all':!![]}];}_0x54ae0f=_[_0xbfae('0x3f')]({},_0x54ae0f,_0x2c50d9[_0xbfae('0x41')]);return db[_0xbfae('0x47')]['find'](_0x54ae0f)[_0xbfae('0x26')](handleEntityNotFound(_0x49a2e7,null))[_0xbfae('0x26')](respondWithResult(_0x49a2e7,null))[_0xbfae('0x49')](handleError(_0x49a2e7,null));};exports['create']=function(_0x4bae4e,_0x456c41){return db['SquareMessage'][_0xbfae('0x4a')](_0x4bae4e[_0xbfae('0x4b')],{})[_0xbfae('0x26')](respondWithResult(_0x456c41,0xc9))[_0xbfae('0x49')](handleError(_0x456c41,null));};exports[_0xbfae('0x25')]=function(_0x1845d0,_0x1c928c){if(_0x1845d0[_0xbfae('0x4b')]['id']){delete _0x1845d0['body']['id'];}return db[_0xbfae('0x47')]['find']({'where':{'id':_0x1845d0['params']['id']}})[_0xbfae('0x26')](handleEntityNotFound(_0x1c928c,null))[_0xbfae('0x26')](saveUpdates(_0x1845d0[_0xbfae('0x4b')],null))[_0xbfae('0x26')](respondWithResult(_0x1c928c,null))[_0xbfae('0x49')](handleError(_0x1c928c,null));};exports['destroy']=function(_0x464394,_0x551def){return db[_0xbfae('0x47')]['find']({'where':{'id':_0x464394[_0xbfae('0x46')]['id']}})[_0xbfae('0x26')](handleEntityNotFound(_0x551def,null))[_0xbfae('0x26')](removeEntity(_0x551def,null))[_0xbfae('0x49')](handleError(_0x551def,null));}; \ No newline at end of file +var _0x16a8=['destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then'];(function(_0x462df2,_0x31503d){var _0x19a513=function(_0x2bf8d3){while(--_0x2bf8d3){_0x462df2['push'](_0x462df2['shift']());}};_0x19a513(++_0x31503d);}(_0x16a8,0xb4));var _0x816a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x16a8[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x816a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x816a('0x1'));var jsonpatch=require(_0x816a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x816a('0x3'));var Mustache=require(_0x816a('0x4'));var util=require(_0x816a('0x5'));var path=require(_0x816a('0x6'));var sox=require(_0x816a('0x7'));var csv=require(_0x816a('0x8'));var ejs=require(_0x816a('0x9'));var fs=require('fs');var fs_extra=require(_0x816a('0xa'));var _=require(_0x816a('0xb'));var squel=require('squel');var crypto=require(_0x816a('0xc'));var jsforce=require(_0x816a('0xd'));var deskjs=require(_0x816a('0xe'));var toCsv=require(_0x816a('0x8'));var querystring=require(_0x816a('0xf'));var Papa=require(_0x816a('0x10'));var Redis=require(_0x816a('0x11'));var authService=require(_0x816a('0x12'));var qs=require(_0x816a('0x13'));var as=require(_0x816a('0x14'));var hardwareService=require(_0x816a('0x15'));var logger=require('../../config/logger')(_0x816a('0x16'));var utils=require(_0x816a('0x17'));var config=require(_0x816a('0x18'));var licenseUtil=require(_0x816a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4427,_0x454929){_0x454929=_0x454929||0xcc;return function(_0x3057f8){if(_0x3057f8){return _0x4d4427[_0x816a('0x1a')](_0x454929);}return _0x4d4427[_0x816a('0x1b')](_0x454929)[_0x816a('0x1c')]();};}function respondWithResult(_0x3e3829,_0x2ac2ea){_0x2ac2ea=_0x2ac2ea||0xc8;return function(_0x4a7a11){if(_0x4a7a11){return _0x3e3829['status'](_0x2ac2ea)[_0x816a('0x1d')](_0x4a7a11);}};}function respondWithFilteredResult(_0x4e9d5e,_0x3ce19d){return function(_0x3d668a){if(_0x3d668a){var _0x106d28=typeof _0x3ce19d['offset']===_0x816a('0x1e')&&typeof _0x3ce19d[_0x816a('0x1f')]===_0x816a('0x1e');var _0x5ef835=_0x3d668a[_0x816a('0x20')];var _0x543ee8=_0x106d28?0x0:_0x3ce19d[_0x816a('0x21')];var _0x511ed8=_0x106d28?_0x3d668a[_0x816a('0x20')]:_0x3ce19d[_0x816a('0x21')]+_0x3ce19d['limit'];var _0x3c8b09;if(_0x511ed8>=_0x5ef835){_0x511ed8=_0x5ef835;_0x3c8b09=0xc8;}else{_0x3c8b09=0xce;}_0x4e9d5e['status'](_0x3c8b09);return _0x4e9d5e[_0x816a('0x22')](_0x816a('0x23'),_0x543ee8+'-'+_0x511ed8+'/'+_0x5ef835)[_0x816a('0x1d')](_0x3d668a);}return null;};}function patchUpdates(_0x339be6){return function(_0x123abd){try{jsonpatch[_0x816a('0x24')](_0x123abd,_0x339be6,!![]);}catch(_0x2f5ec0){return BPromise[_0x816a('0x25')](_0x2f5ec0);}return _0x123abd['save']();};}function saveUpdates(_0xd5051f,_0xf5fddc){return function(_0x440c76){if(_0x440c76){return _0x440c76['update'](_0xd5051f)[_0x816a('0x26')](function(_0xb053ab){return _0xb053ab;});}return null;};}function removeEntity(_0x5ac945,_0x4108bf){return function(_0x1dd0b8){if(_0x1dd0b8){return _0x1dd0b8[_0x816a('0x27')]()['then'](function(){_0x5ac945['status'](0xcc)[_0x816a('0x1c')]();});}};}function handleEntityNotFound(_0x58898f,_0x377229){return function(_0x31bea4){if(!_0x31bea4){_0x58898f[_0x816a('0x1a')](0x194);}return _0x31bea4;};}function handleError(_0x4cf4f4,_0x46eaa6){_0x46eaa6=_0x46eaa6||0x1f4;return function(_0x1bf75d){logger['error'](_0x1bf75d[_0x816a('0x28')]);if(_0x1bf75d[_0x816a('0x29')]){delete _0x1bf75d['name'];}_0x4cf4f4[_0x816a('0x1b')](_0x46eaa6)[_0x816a('0x2a')](_0x1bf75d);};}exports[_0x816a('0x2b')]=function(_0x42832e,_0x2323fd){var _0x392541={},_0x4e89a9={},_0x339295={'count':0x0,'rows':[]};var _0x2c489c=_['map'](db[_0x816a('0x2c')][_0x816a('0x2d')],function(_0x561ade){return{'name':_0x561ade[_0x816a('0x2e')],'type':_0x561ade[_0x816a('0x2f')][_0x816a('0x30')]};});_0x4e89a9[_0x816a('0x31')]=_[_0x816a('0x32')](_0x2c489c,_0x816a('0x29'));_0x4e89a9[_0x816a('0x33')]=_[_0x816a('0x34')](_0x42832e[_0x816a('0x33')]);_0x4e89a9[_0x816a('0x35')]=_[_0x816a('0x36')](_0x4e89a9[_0x816a('0x31')],_0x4e89a9[_0x816a('0x33')]);_0x392541[_0x816a('0x37')]=_[_0x816a('0x36')](_0x4e89a9[_0x816a('0x31')],qs[_0x816a('0x38')](_0x42832e['query'][_0x816a('0x38')]));_0x392541[_0x816a('0x37')]=_0x392541[_0x816a('0x37')]['length']?_0x392541[_0x816a('0x37')]:_0x4e89a9[_0x816a('0x31')];if(!_0x42832e[_0x816a('0x33')]['hasOwnProperty'](_0x816a('0x39'))){_0x392541['limit']=qs[_0x816a('0x1f')](_0x42832e[_0x816a('0x33')][_0x816a('0x1f')]);_0x392541['offset']=qs['offset'](_0x42832e['query'][_0x816a('0x21')]);}_0x392541['order']=qs['sort'](_0x42832e['query']['sort']);_0x392541[_0x816a('0x3a')]=qs['filters'](_['pick'](_0x42832e[_0x816a('0x33')],_0x4e89a9[_0x816a('0x35')]),_0x2c489c);if(_0x42832e[_0x816a('0x33')][_0x816a('0x3b')]){_0x392541[_0x816a('0x3a')]=_[_0x816a('0x3c')](_0x392541['where'],{'$or':_[_0x816a('0x32')](_0x2c489c,function(_0x527b5f){if(_0x527b5f[_0x816a('0x2f')]!=='VIRTUAL'){var _0x4f4dcd={};_0x4f4dcd[_0x527b5f[_0x816a('0x29')]]={'$like':'%'+_0x42832e['query']['filter']+'%'};return _0x4f4dcd;}})});}_0x392541=_[_0x816a('0x3c')]({},_0x392541,_0x42832e[_0x816a('0x3d')]);var _0x5c60a9={'where':_0x392541[_0x816a('0x3a')]};return db[_0x816a('0x2c')][_0x816a('0x20')](_0x5c60a9)[_0x816a('0x26')](function(_0x20227f){_0x339295['count']=_0x20227f;if(_0x42832e['query'][_0x816a('0x3e')]){_0x392541[_0x816a('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x816a('0x40')](_0x392541);})[_0x816a('0x26')](function(_0x48b15f){_0x339295[_0x816a('0x41')]=_0x48b15f;return _0x339295;})[_0x816a('0x26')](respondWithFilteredResult(_0x2323fd,_0x392541))[_0x816a('0x42')](handleError(_0x2323fd,null));};exports[_0x816a('0x43')]=function(_0x16e74c,_0x27877a){var _0xa1838={'raw':!![],'where':{'id':_0x16e74c[_0x816a('0x44')]['id']}},_0x2e2eb7={};_0x2e2eb7[_0x816a('0x31')]=_['keys'](db['SquareMessage'][_0x816a('0x2d')]);_0x2e2eb7[_0x816a('0x33')]=_['keys'](_0x16e74c[_0x816a('0x33')]);_0x2e2eb7[_0x816a('0x35')]=_[_0x816a('0x36')](_0x2e2eb7['model'],_0x2e2eb7[_0x816a('0x33')]);_0xa1838[_0x816a('0x37')]=_['intersection'](_0x2e2eb7[_0x816a('0x31')],qs[_0x816a('0x38')](_0x16e74c[_0x816a('0x33')][_0x816a('0x38')]));_0xa1838[_0x816a('0x37')]=_0xa1838[_0x816a('0x37')]['length']?_0xa1838['attributes']:_0x2e2eb7[_0x816a('0x31')];if(_0x16e74c[_0x816a('0x33')]['includeAll']){_0xa1838[_0x816a('0x3f')]=[{'all':!![]}];}_0xa1838=_[_0x816a('0x3c')]({},_0xa1838,_0x16e74c['options']);return db[_0x816a('0x2c')][_0x816a('0x45')](_0xa1838)['then'](handleEntityNotFound(_0x27877a,null))['then'](respondWithResult(_0x27877a,null))[_0x816a('0x42')](handleError(_0x27877a,null));};exports[_0x816a('0x46')]=function(_0x5b8768,_0x3cfb98){return db[_0x816a('0x2c')]['create'](_0x5b8768[_0x816a('0x47')],{})[_0x816a('0x26')](respondWithResult(_0x3cfb98,0xc9))[_0x816a('0x42')](handleError(_0x3cfb98,null));};exports[_0x816a('0x48')]=function(_0xc35abb,_0x59bbd0){if(_0xc35abb['body']['id']){delete _0xc35abb[_0x816a('0x47')]['id'];}return db[_0x816a('0x2c')][_0x816a('0x45')]({'where':{'id':_0xc35abb['params']['id']}})[_0x816a('0x26')](handleEntityNotFound(_0x59bbd0,null))['then'](saveUpdates(_0xc35abb['body'],null))[_0x816a('0x26')](respondWithResult(_0x59bbd0,null))[_0x816a('0x42')](handleError(_0x59bbd0,null));};exports[_0x816a('0x27')]=function(_0xc5f7c2,_0x325549){return db[_0x816a('0x2c')][_0x816a('0x45')]({'where':{'id':_0xc5f7c2['params']['id']}})[_0x816a('0x26')](handleEntityNotFound(_0x325549,null))[_0x816a('0x26')](removeEntity(_0x325549,null))[_0x816a('0x42')](handleError(_0x325549,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 44801ae..3c676af 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 _0x936e=['./squareMessage.attributes','define','SquareMessage','square_messages','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x59b1ed,_0x48c04c){var _0x492b47=function(_0x3985dc){while(--_0x3985dc){_0x59b1ed['push'](_0x59b1ed['shift']());}};_0x492b47(++_0x48c04c);}(_0x936e,0xf4));var _0xe936=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0x936e[_0xb31b62];return _0x3928ed;};'use strict';var _=require(_0xe936('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe936('0x1'));var moment=require('moment');var BPromise=require(_0xe936('0x2'));var rp=require(_0xe936('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe936('0x4'));var config=require(_0xe936('0x5'));var attributes=require(_0xe936('0x6'));module['exports']=function(_0x2bea84,_0x39d6b5){return _0x2bea84[_0xe936('0x7')](_0xe936('0x8'),attributes,{'tableName':_0xe936('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['./squareMessage.attributes','exports','define','square_messages','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0xe1e3,0xe8));var _0x3e1e=function(_0x1ba331,_0x3e0150){_0x1ba331=_0x1ba331-0x0;var _0x4687ea=_0xe1e3[_0x1ba331];return _0x4687ea;};'use strict';var _=require(_0x3e1e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e1e('0x1'));var moment=require(_0x3e1e('0x2'));var BPromise=require(_0x3e1e('0x3'));var rp=require(_0x3e1e('0x4'));var fs=require('fs');var path=require(_0x3e1e('0x5'));var rimraf=require(_0x3e1e('0x6'));var config=require(_0x3e1e('0x7'));var attributes=require(_0x3e1e('0x8'));module[_0x3e1e('0x9')]=function(_0x2f67bc,_0x4a698f){return _0x2f67bc[_0x3e1e('0xa')]('SquareMessage',attributes,{'tableName':_0x3e1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index a96601a..baaf101 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 _0xff03=['SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateSquareMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0xff03,0xbe));var _0x3ff0=function(_0x207281,_0x25ea3d){_0x207281=_0x207281-0x0;var _0xfc0baa=_0xff03[_0x207281];return _0xfc0baa;};'use strict';var _=require(_0x3ff0('0x0'));var util=require(_0x3ff0('0x1'));var moment=require(_0x3ff0('0x2'));var BPromise=require(_0x3ff0('0x3'));var rs=require(_0x3ff0('0x4'));var fs=require('fs');var Redis=require(_0x3ff0('0x5'));var db=require(_0x3ff0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ff0('0x7'))('rpc');var config=require(_0x3ff0('0x8'));var jayson=require(_0x3ff0('0x9'));var client=jayson[_0x3ff0('0xa')][_0x3ff0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28de30,_0x3decf8,_0x405d14){return new BPromise(function(_0x10d9ab,_0x4f8604){return client['request'](_0x28de30,_0x405d14)['then'](function(_0x51dd30){logger[_0x3ff0('0xc')](_0x3ff0('0xd'),_0x3decf8,_0x3ff0('0xe'));logger['debug'](_0x3ff0('0xf'),_0x3decf8,_0x3ff0('0xe'),JSON[_0x3ff0('0x10')](_0x51dd30));if(_0x51dd30[_0x3ff0('0x11')]){if(_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x12')]===0x1f4){logger['error'](_0x3ff0('0xd'),_0x3decf8,_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);return _0x4f8604(_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);}logger['error'](_0x3ff0('0xd'),_0x3decf8,_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);return _0x10d9ab(_0x51dd30[_0x3ff0('0x11')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x3decf8,_0x3ff0('0xe'));_0x10d9ab(_0x51dd30[_0x3ff0('0x14')][_0x3ff0('0x13')]);}})[_0x3ff0('0x15')](function(_0x1c3b2c){logger[_0x3ff0('0x11')](_0x3ff0('0xd'),_0x3decf8,_0x1c3b2c);_0x4f8604(_0x1c3b2c);});});}exports['CreateSquareMessage']=function(_0x44dadb){var _0x5639b7=this;return new Promise(function(_0x540836,_0xdac3e4){return db['SquareMessage'][_0x3ff0('0x16')](_0x44dadb[_0x3ff0('0x17')],{'raw':_0x44dadb['options']?_0x44dadb[_0x3ff0('0x18')][_0x3ff0('0x19')]===undefined?!![]:![]:!![]})[_0x3ff0('0x1a')](function(_0x516602){logger[_0x3ff0('0xc')](_0x3ff0('0x1b'),_0x44dadb);logger[_0x3ff0('0x1c')]('CreateSquareMessage',_0x44dadb,JSON[_0x3ff0('0x10')](_0x516602));_0x540836(_0x516602);})['catch'](function(_0x2e020c){logger[_0x3ff0('0x11')](_0x3ff0('0x1b'),_0x2e020c[_0x3ff0('0x13')],_0x44dadb);_0xdac3e4(_0x5639b7[_0x3ff0('0x11')](0x1f4,_0x2e020c[_0x3ff0('0x13')]));});});}; \ No newline at end of file +var _0x7b23=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','options','raw','catch','lodash'];(function(_0x51ece4,_0x39165c){var _0x2b7e27=function(_0x88b36e){while(--_0x88b36e){_0x51ece4['push'](_0x51ece4['shift']());}};_0x2b7e27(++_0x39165c);}(_0x7b23,0x1bf));var _0x37b2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7b23[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x37b2('0x0'));var util=require(_0x37b2('0x1'));var moment=require(_0x37b2('0x2'));var BPromise=require(_0x37b2('0x3'));var rs=require(_0x37b2('0x4'));var fs=require('fs');var Redis=require(_0x37b2('0x5'));var db=require(_0x37b2('0x6'))['db'];var utils=require(_0x37b2('0x7'));var logger=require(_0x37b2('0x8'))(_0x37b2('0x9'));var config=require('../../config/environment');var jayson=require(_0x37b2('0xa'));var client=jayson[_0x37b2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22718a,_0x2cdff0,_0x179dd6){return new BPromise(function(_0x4143ce,_0x199b63){return client['request'](_0x22718a,_0x179dd6)[_0x37b2('0xc')](function(_0x2687e9){logger[_0x37b2('0xd')](_0x37b2('0xe'),_0x2cdff0,'request\x20sent');logger[_0x37b2('0xf')](_0x37b2('0x10'),_0x2cdff0,'request\x20sent',JSON[_0x37b2('0x11')](_0x2687e9));if(_0x2687e9[_0x37b2('0x12')]){if(_0x2687e9[_0x37b2('0x12')][_0x37b2('0x13')]===0x1f4){logger[_0x37b2('0x12')]('SquareMessage,\x20%s,\x20%s',_0x2cdff0,_0x2687e9[_0x37b2('0x12')][_0x37b2('0x14')]);return _0x199b63(_0x2687e9['error']['message']);}logger[_0x37b2('0x12')](_0x37b2('0xe'),_0x2cdff0,_0x2687e9['error'][_0x37b2('0x14')]);return _0x4143ce(_0x2687e9[_0x37b2('0x12')][_0x37b2('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x2cdff0,'request\x20sent');_0x4143ce(_0x2687e9[_0x37b2('0x15')]['message']);}})['catch'](function(_0x467073){logger['error'](_0x37b2('0xe'),_0x2cdff0,_0x467073);_0x199b63(_0x467073);});});}exports[_0x37b2('0x16')]=function(_0x2b7f55){var _0x4718c6=this;return new Promise(function(_0x47c444,_0x2bb121){return db[_0x37b2('0x17')][_0x37b2('0x18')](_0x2b7f55['body'],{'raw':_0x2b7f55[_0x37b2('0x19')]?_0x2b7f55[_0x37b2('0x19')][_0x37b2('0x1a')]===undefined?!![]:![]:!![]})[_0x37b2('0xc')](function(_0x3643a2){logger['info']('CreateSquareMessage',_0x2b7f55);logger[_0x37b2('0xf')](_0x37b2('0x16'),_0x2b7f55,JSON[_0x37b2('0x11')](_0x3643a2));_0x47c444(_0x3643a2);})[_0x37b2('0x1b')](function(_0x5afb56){logger['error'](_0x37b2('0x16'),_0x5afb56['message'],_0x2b7f55);_0x2bb121(_0x4718c6[_0x37b2('0x12')](0x1f4,_0x5afb56['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b577b2c..45e2e77 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 _0xdbb3=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','delete','destroy','exports','multer'];(function(_0x5323f6,_0x5c3994){var _0x4e027b=function(_0x1f80bd){while(--_0x1f80bd){_0x5323f6['push'](_0x5323f6['shift']());}};_0x4e027b(++_0x5c3994);}(_0xdbb3,0x18b));var _0x3dbb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xdbb3[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var path=require(_0x3dbb('0x2'));var timeout=require(_0x3dbb('0x3'));var express=require('express');var router=express[_0x3dbb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3dbb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3dbb('0x6'));var controller=require(_0x3dbb('0x7'));router[_0x3dbb('0x8')]('/',auth[_0x3dbb('0x9')](),controller[_0x3dbb('0xa')]);router['get'](_0x3dbb('0xb'),auth['isAuthenticated'](),controller[_0x3dbb('0xc')]);router[_0x3dbb('0x8')](_0x3dbb('0xd'),auth[_0x3dbb('0x9')](),timeout(_0x3dbb('0xe')),controller[_0x3dbb('0xf')]);router['post']('/',auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x10')]);router[_0x3dbb('0x11')](_0x3dbb('0xb'),auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x12')]);router[_0x3dbb('0x13')](_0x3dbb('0xb'),auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x14')]);module[_0x3dbb('0x15')]=router; \ No newline at end of file +var _0x31f2=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','show','isAuthenticated','15s','test','put','update','delete','exports','multer','util'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x31f2,0x12e));var _0x231f=function(_0x423e29,_0x589378){_0x423e29=_0x423e29-0x0;var _0x30c8cb=_0x31f2[_0x423e29];return _0x30c8cb;};'use strict';var multer=require(_0x231f('0x0'));var util=require(_0x231f('0x1'));var path=require(_0x231f('0x2'));var timeout=require(_0x231f('0x3'));var express=require(_0x231f('0x4'));var router=express[_0x231f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x231f('0x6'));var config=require(_0x231f('0x7'));var controller=require(_0x231f('0x8'));router[_0x231f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x231f('0x9')](_0x231f('0xa'),auth['isAuthenticated'](),controller[_0x231f('0xb')]);router[_0x231f('0x9')]('/:id/test',auth[_0x231f('0xc')](),timeout(_0x231f('0xd')),controller[_0x231f('0xe')]);router['post']('/',auth[_0x231f('0xc')](),controller['create']);router[_0x231f('0xf')]('/:id',auth[_0x231f('0xc')](),controller[_0x231f('0x10')]);router[_0x231f('0x11')](_0x231f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x231f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a98b6ed..35db089 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 _0x342f=['sequelize','exports','STRING'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x342f,0xf3));var _0xf342=function(_0x6e5ca9,_0x581255){_0x6e5ca9=_0x6e5ca9-0x0;var _0x39ecf8=_0x342f[_0x6e5ca9];return _0x39ecf8;};'use strict';var Sequelize=require(_0xf342('0x0'));module[_0xf342('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xf342('0x2')]},'description':{'type':Sequelize[_0xf342('0x2')]}}; \ No newline at end of file +var _0x157a=['sequelize','STRING','name'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x157a,0x15f));var _0xa157=function(_0x2d8eac,_0x4d2f89){_0x2d8eac=_0x2d8eac-0x0;var _0x4af6a7=_0x157a[_0x2d8eac];return _0x4af6a7;};'use strict';var Sequelize=require(_0xa157('0x0'));module['exports']={'name':{'type':Sequelize[_0xa157('0x1')],'unique':_0xa157('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa157('0x1')]},'description':{'type':Sequelize[_0xa157('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e2834fe..25dbfad 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 _0xffa8=['keys','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','update','then','destroy','get','ODBC','error','name','send','index','map','SquareOdbc','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','type','VIRTUAL','includeAll','include','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xffa8,0xae));var _0x8ffa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xffa8[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x8ffa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ffa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ffa('0x2'));var moment=require(_0x8ffa('0x3'));var BPromise=require(_0x8ffa('0x4'));var Mustache=require(_0x8ffa('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8ffa('0x6'));var ejs=require(_0x8ffa('0x7'));var fs=require('fs');var fs_extra=require(_0x8ffa('0x8'));var _=require(_0x8ffa('0x9'));var squel=require(_0x8ffa('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ffa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8ffa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ffa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8ffa('0xd'));var as=require(_0x8ffa('0xe'));var hardwareService=require(_0x8ffa('0xf'));var logger=require(_0x8ffa('0x10'))(_0x8ffa('0x11'));var utils=require(_0x8ffa('0x12'));var config=require(_0x8ffa('0x13'));var licenseUtil=require(_0x8ffa('0x14'));var db=require(_0x8ffa('0x15'))['db'];function respondWithStatusCode(_0x118a70,_0x21d40e){_0x21d40e=_0x21d40e||0xcc;return function(_0x37f3ca){if(_0x37f3ca){return _0x118a70[_0x8ffa('0x16')](_0x21d40e);}return _0x118a70['status'](_0x21d40e)[_0x8ffa('0x17')]();};}function respondWithResult(_0x787497,_0x2a0a0d){_0x2a0a0d=_0x2a0a0d||0xc8;return function(_0x271db3){if(_0x271db3){return _0x787497[_0x8ffa('0x18')](_0x2a0a0d)['json'](_0x271db3);}};}function respondWithFilteredResult(_0xc99792,_0xce32b5){return function(_0x412db2){if(_0x412db2){var _0x4debf6=typeof _0xce32b5[_0x8ffa('0x19')]===_0x8ffa('0x1a')&&typeof _0xce32b5[_0x8ffa('0x1b')]===_0x8ffa('0x1a');var _0x1f107b=_0x412db2['count'];var _0x41d338=_0x4debf6?0x0:_0xce32b5['offset'];var _0xc5a0da=_0x4debf6?_0x412db2[_0x8ffa('0x1c')]:_0xce32b5[_0x8ffa('0x19')]+_0xce32b5[_0x8ffa('0x1b')];var _0x55a09e;if(_0xc5a0da>=_0x1f107b){_0xc5a0da=_0x1f107b;_0x55a09e=0xc8;}else{_0x55a09e=0xce;}_0xc99792[_0x8ffa('0x18')](_0x55a09e);return _0xc99792['set']('Content-Range',_0x41d338+'-'+_0xc5a0da+'/'+_0x1f107b)[_0x8ffa('0x1d')](_0x412db2);}return null;};}function patchUpdates(_0x443b20){return function(_0x25b2dc){try{jsonpatch['apply'](_0x25b2dc,_0x443b20,!![]);}catch(_0xfda1a8){return BPromise['reject'](_0xfda1a8);}return _0x25b2dc['save']();};}function saveUpdates(_0x4cadf4,_0x3593ea){return function(_0x5d5766){if(_0x5d5766){return _0x5d5766[_0x8ffa('0x1e')](_0x4cadf4)[_0x8ffa('0x1f')](function(_0x25ce0e){return _0x25ce0e;});}return null;};}function removeEntity(_0x386d8b,_0x2b903f){return function(_0x499940){if(_0x499940){return _0x499940[_0x8ffa('0x20')]()['then'](function(){var _0x4eb9e9=_0x499940[_0x8ffa('0x21')]({'plain':!![]});var _0x307375=_0x8ffa('0x22');return db['UserProfileResource'][_0x8ffa('0x20')]({'where':{'type':_0x307375,'resourceId':_0x4eb9e9['id']}})['then'](function(){return _0x499940;});})['then'](function(){_0x386d8b[_0x8ffa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b902,_0x2304b9){return function(_0x1ed6f8){if(!_0x1ed6f8){_0x46b902['sendStatus'](0x194);}return _0x1ed6f8;};}function handleError(_0x4b03f7,_0x1a054d){_0x1a054d=_0x1a054d||0x1f4;return function(_0x1d1b6e){logger[_0x8ffa('0x23')](_0x1d1b6e['stack']);if(_0x1d1b6e['name']){delete _0x1d1b6e[_0x8ffa('0x24')];}_0x4b03f7[_0x8ffa('0x18')](_0x1a054d)[_0x8ffa('0x25')](_0x1d1b6e);};}exports[_0x8ffa('0x26')]=function(_0x52c6fb,_0x5e0c21){var _0x3a1702={},_0x592e30={},_0xfc4e2e={'count':0x0,'rows':[]};var _0xc24d86=_[_0x8ffa('0x27')](db[_0x8ffa('0x28')]['rawAttributes'],function(_0x26559e){return{'name':_0x26559e['fieldName'],'type':_0x26559e['type']['key']};});_0x592e30[_0x8ffa('0x29')]=_['map'](_0xc24d86,'name');_0x592e30['query']=_['keys'](_0x52c6fb[_0x8ffa('0x2a')]);_0x592e30['filters']=_['intersection'](_0x592e30[_0x8ffa('0x29')],_0x592e30[_0x8ffa('0x2a')]);_0x3a1702['attributes']=_[_0x8ffa('0x2b')](_0x592e30[_0x8ffa('0x29')],qs['fields'](_0x52c6fb['query'][_0x8ffa('0x2c')]));_0x3a1702[_0x8ffa('0x2d')]=_0x3a1702['attributes'][_0x8ffa('0x2e')]?_0x3a1702['attributes']:_0x592e30[_0x8ffa('0x29')];if(!_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x2f')](_0x8ffa('0x30'))){_0x3a1702[_0x8ffa('0x1b')]=qs[_0x8ffa('0x1b')](_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x1b')]);_0x3a1702[_0x8ffa('0x19')]=qs[_0x8ffa('0x19')](_0x52c6fb['query'][_0x8ffa('0x19')]);}_0x3a1702[_0x8ffa('0x31')]=qs[_0x8ffa('0x32')](_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x32')]);_0x3a1702['where']=qs[_0x8ffa('0x33')](_[_0x8ffa('0x34')](_0x52c6fb[_0x8ffa('0x2a')],_0x592e30[_0x8ffa('0x33')]),_0xc24d86);if(_0x52c6fb[_0x8ffa('0x2a')]['filter']){_0x3a1702['where']=_[_0x8ffa('0x35')](_0x3a1702[_0x8ffa('0x36')],{'$or':_['map'](_0xc24d86,function(_0x1438b8){if(_0x1438b8[_0x8ffa('0x37')]!==_0x8ffa('0x38')){var _0x530101={};_0x530101[_0x1438b8[_0x8ffa('0x24')]]={'$like':'%'+_0x52c6fb[_0x8ffa('0x2a')]['filter']+'%'};return _0x530101;}})});}_0x3a1702=_[_0x8ffa('0x35')]({},_0x3a1702,_0x52c6fb['options']);var _0x135296={'where':_0x3a1702[_0x8ffa('0x36')]};return db['SquareOdbc'][_0x8ffa('0x1c')](_0x135296)[_0x8ffa('0x1f')](function(_0x49f0c9){_0xfc4e2e[_0x8ffa('0x1c')]=_0x49f0c9;if(_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x39')]){_0x3a1702[_0x8ffa('0x3a')]=[{'all':!![]}];}return db[_0x8ffa('0x28')]['findAll'](_0x3a1702);})[_0x8ffa('0x1f')](function(_0x2b2f8f){_0xfc4e2e['rows']=_0x2b2f8f;return _0xfc4e2e;})[_0x8ffa('0x1f')](respondWithFilteredResult(_0x5e0c21,_0x3a1702))['catch'](handleError(_0x5e0c21,null));};exports['show']=function(_0x3d5c85,_0x5f1784){var _0x5b6ec2={'raw':!![],'where':{'id':_0x3d5c85[_0x8ffa('0x3b')]['id']}},_0x44d766={};_0x44d766[_0x8ffa('0x29')]=_[_0x8ffa('0x3c')](db[_0x8ffa('0x28')]['rawAttributes']);_0x44d766[_0x8ffa('0x2a')]=_[_0x8ffa('0x3c')](_0x3d5c85[_0x8ffa('0x2a')]);_0x44d766[_0x8ffa('0x33')]=_[_0x8ffa('0x2b')](_0x44d766[_0x8ffa('0x29')],_0x44d766[_0x8ffa('0x2a')]);_0x5b6ec2[_0x8ffa('0x2d')]=_[_0x8ffa('0x2b')](_0x44d766[_0x8ffa('0x29')],qs[_0x8ffa('0x2c')](_0x3d5c85[_0x8ffa('0x2a')]['fields']));_0x5b6ec2['attributes']=_0x5b6ec2['attributes'][_0x8ffa('0x2e')]?_0x5b6ec2['attributes']:_0x44d766[_0x8ffa('0x29')];if(_0x3d5c85[_0x8ffa('0x2a')]['includeAll']){_0x5b6ec2[_0x8ffa('0x3a')]=[{'all':!![]}];}_0x5b6ec2=_[_0x8ffa('0x35')]({},_0x5b6ec2,_0x3d5c85[_0x8ffa('0x3d')]);return db[_0x8ffa('0x28')]['find'](_0x5b6ec2)[_0x8ffa('0x1f')](handleEntityNotFound(_0x5f1784,null))[_0x8ffa('0x1f')](respondWithResult(_0x5f1784,null))[_0x8ffa('0x3e')](handleError(_0x5f1784,null));};exports[_0x8ffa('0x3f')]=function(_0x495cde,_0x3e79b8){return db[_0x8ffa('0x28')][_0x8ffa('0x3f')](_0x495cde[_0x8ffa('0x40')],{})[_0x8ffa('0x1f')](function(_0x1bf03d){var _0x328bc3=_0x495cde['user'][_0x8ffa('0x21')]({'plain':!![]});if(!_0x328bc3)throw new Error(_0x8ffa('0x41'));if(_0x328bc3[_0x8ffa('0x42')]===_0x8ffa('0x43')){var _0x19b49c=_0x1bf03d[_0x8ffa('0x21')]({'plain':!![]});var _0x5d2133=_0x8ffa('0x22');return db[_0x8ffa('0x44')][_0x8ffa('0x45')]({'where':{'name':_0x5d2133,'userProfileId':_0x328bc3[_0x8ffa('0x46')]},'raw':!![]})[_0x8ffa('0x1f')](function(_0x1bbc86){if(_0x1bbc86&&_0x1bbc86[_0x8ffa('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x19b49c['name'],'resourceId':_0x19b49c['id'],'type':_0x1bbc86[_0x8ffa('0x24')],'sectionId':_0x1bbc86['id']},{})['then'](function(){return _0x1bf03d;});}else{return _0x1bf03d;}})['catch'](function(_0xd58067){logger[_0x8ffa('0x23')](_0x8ffa('0x48'),_0xd58067);throw _0xd58067;});}return _0x1bf03d;})[_0x8ffa('0x1f')](respondWithResult(_0x3e79b8,0xc9))['catch'](handleError(_0x3e79b8,null));};exports[_0x8ffa('0x1e')]=function(_0x1ef301,_0x47045c){if(_0x1ef301[_0x8ffa('0x40')]['id']){delete _0x1ef301[_0x8ffa('0x40')]['id'];}return db[_0x8ffa('0x28')]['find']({'where':{'id':_0x1ef301[_0x8ffa('0x3b')]['id']}})['then'](handleEntityNotFound(_0x47045c,null))[_0x8ffa('0x1f')](saveUpdates(_0x1ef301[_0x8ffa('0x40')],null))[_0x8ffa('0x1f')](respondWithResult(_0x47045c,null))[_0x8ffa('0x3e')](handleError(_0x47045c,null));};exports[_0x8ffa('0x20')]=function(_0x2e9bc0,_0x43baa9){return db[_0x8ffa('0x28')][_0x8ffa('0x45')]({'where':{'id':_0x2e9bc0[_0x8ffa('0x3b')]['id']}})[_0x8ffa('0x1f')](handleEntityNotFound(_0x43baa9,null))['then'](removeEntity(_0x43baa9,null))['catch'](handleError(_0x43baa9,null));};exports[_0x8ffa('0x49')]=function(_0x13c009,_0x191580,_0xa107eb){var _0x1daf22;return db['SquareOdbc']['find']({'where':{'id':_0x13c009[_0x8ffa('0x3b')]['id']},'attributes':['id',_0x8ffa('0x4a')]})[_0x8ffa('0x1f')](handleEntityNotFound(_0x191580,null))[_0x8ffa('0x1f')](function(_0x2871fe){if(_0x2871fe){var _0x2c0590=require(_0x8ffa('0x4b'))();_0x2c0590[_0x8ffa('0x4c')](_0x2871fe[_0x8ffa('0x4a')]);_0x2c0590[_0x8ffa('0x4d')]();return _0x2871fe;}})[_0x8ffa('0x1f')](respondWithResult(_0x191580,null))[_0x8ffa('0x3e')](handleError(_0x191580,null));}; \ No newline at end of file +var _0x542b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','ODBC','UserProfileResource','end','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','show','create','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xf34418,_0x3b5a25){var _0x5e1cdf=function(_0x43d732){while(--_0x43d732){_0xf34418['push'](_0xf34418['shift']());}};_0x5e1cdf(++_0x3b5a25);}(_0x542b,0x149));var _0xb542=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x542b[_0x4eafed];return _0x159c85;};'use strict';var emlformat=require(_0xb542('0x0'));var rimraf=require(_0xb542('0x1'));var zipdir=require(_0xb542('0x2'));var jsonpatch=require(_0xb542('0x3'));var rp=require(_0xb542('0x4'));var moment=require(_0xb542('0x5'));var BPromise=require(_0xb542('0x6'));var Mustache=require(_0xb542('0x7'));var util=require(_0xb542('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb542('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb542('0xa'));var _=require('lodash');var squel=require(_0xb542('0xb'));var crypto=require(_0xb542('0xc'));var jsforce=require(_0xb542('0xd'));var deskjs=require(_0xb542('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb542('0xf'));var Papa=require(_0xb542('0x10'));var Redis=require(_0xb542('0x11'));var authService=require(_0xb542('0x12'));var qs=require(_0xb542('0x13'));var as=require(_0xb542('0x14'));var hardwareService=require(_0xb542('0x15'));var logger=require('../../config/logger')(_0xb542('0x16'));var utils=require(_0xb542('0x17'));var config=require(_0xb542('0x18'));var licenseUtil=require(_0xb542('0x19'));var db=require(_0xb542('0x1a'))['db'];function respondWithStatusCode(_0x319232,_0x432174){_0x432174=_0x432174||0xcc;return function(_0x2be4fc){if(_0x2be4fc){return _0x319232[_0xb542('0x1b')](_0x432174);}return _0x319232[_0xb542('0x1c')](_0x432174)['end']();};}function respondWithResult(_0x2c6800,_0x537ba6){_0x537ba6=_0x537ba6||0xc8;return function(_0x3b6c0f){if(_0x3b6c0f){return _0x2c6800[_0xb542('0x1c')](_0x537ba6)[_0xb542('0x1d')](_0x3b6c0f);}};}function respondWithFilteredResult(_0x6e6d49,_0x1fb03a){return function(_0x2f9495){if(_0x2f9495){var _0x256f18=typeof _0x1fb03a[_0xb542('0x1e')]===_0xb542('0x1f')&&typeof _0x1fb03a[_0xb542('0x20')]===_0xb542('0x1f');var _0x395dfb=_0x2f9495[_0xb542('0x21')];var _0x362c91=_0x256f18?0x0:_0x1fb03a['offset'];var _0x37e5eb=_0x256f18?_0x2f9495[_0xb542('0x21')]:_0x1fb03a['offset']+_0x1fb03a[_0xb542('0x20')];var _0x135f81;if(_0x37e5eb>=_0x395dfb){_0x37e5eb=_0x395dfb;_0x135f81=0xc8;}else{_0x135f81=0xce;}_0x6e6d49[_0xb542('0x1c')](_0x135f81);return _0x6e6d49['set'](_0xb542('0x22'),_0x362c91+'-'+_0x37e5eb+'/'+_0x395dfb)[_0xb542('0x1d')](_0x2f9495);}return null;};}function patchUpdates(_0x3ef031){return function(_0x2d9bef){try{jsonpatch['apply'](_0x2d9bef,_0x3ef031,!![]);}catch(_0x49b64d){return BPromise[_0xb542('0x23')](_0x49b64d);}return _0x2d9bef['save']();};}function saveUpdates(_0x5c08c5,_0x299be8){return function(_0xc32d40){if(_0xc32d40){return _0xc32d40[_0xb542('0x24')](_0x5c08c5)[_0xb542('0x25')](function(_0x252171){return _0x252171;});}return null;};}function removeEntity(_0x5c5602,_0x3ba222){return function(_0x401375){if(_0x401375){return _0x401375[_0xb542('0x26')]()[_0xb542('0x25')](function(){var _0x37dfd4=_0x401375[_0xb542('0x27')]({'plain':!![]});var _0x3fcced=_0xb542('0x28');return db[_0xb542('0x29')][_0xb542('0x26')]({'where':{'type':_0x3fcced,'resourceId':_0x37dfd4['id']}})['then'](function(){return _0x401375;});})[_0xb542('0x25')](function(){_0x5c5602['status'](0xcc)[_0xb542('0x2a')]();});}};}function handleEntityNotFound(_0x5a0d76,_0x2c4224){return function(_0x34dd7c){if(!_0x34dd7c){_0x5a0d76[_0xb542('0x1b')](0x194);}return _0x34dd7c;};}function handleError(_0x4f32b9,_0x43b152){_0x43b152=_0x43b152||0x1f4;return function(_0x5a8fa1){logger['error'](_0x5a8fa1[_0xb542('0x2b')]);if(_0x5a8fa1[_0xb542('0x2c')]){delete _0x5a8fa1[_0xb542('0x2c')];}_0x4f32b9[_0xb542('0x1c')](_0x43b152)['send'](_0x5a8fa1);};}exports[_0xb542('0x2d')]=function(_0xebee22,_0x16a8f6){var _0x349de8={},_0x3794af={},_0x3cbb68={'count':0x0,'rows':[]};var _0x44bbb0=_[_0xb542('0x2e')](db[_0xb542('0x2f')][_0xb542('0x30')],function(_0x214f4d){return{'name':_0x214f4d[_0xb542('0x31')],'type':_0x214f4d[_0xb542('0x32')][_0xb542('0x33')]};});_0x3794af[_0xb542('0x34')]=_['map'](_0x44bbb0,_0xb542('0x2c'));_0x3794af[_0xb542('0x35')]=_[_0xb542('0x36')](_0xebee22[_0xb542('0x35')]);_0x3794af['filters']=_[_0xb542('0x37')](_0x3794af[_0xb542('0x34')],_0x3794af['query']);_0x349de8[_0xb542('0x38')]=_['intersection'](_0x3794af[_0xb542('0x34')],qs[_0xb542('0x39')](_0xebee22[_0xb542('0x35')][_0xb542('0x39')]));_0x349de8[_0xb542('0x38')]=_0x349de8[_0xb542('0x38')][_0xb542('0x3a')]?_0x349de8['attributes']:_0x3794af[_0xb542('0x34')];if(!_0xebee22[_0xb542('0x35')][_0xb542('0x3b')](_0xb542('0x3c'))){_0x349de8['limit']=qs[_0xb542('0x20')](_0xebee22[_0xb542('0x35')][_0xb542('0x20')]);_0x349de8[_0xb542('0x1e')]=qs[_0xb542('0x1e')](_0xebee22[_0xb542('0x35')]['offset']);}_0x349de8['order']=qs[_0xb542('0x3d')](_0xebee22[_0xb542('0x35')]['sort']);_0x349de8[_0xb542('0x3e')]=qs[_0xb542('0x3f')](_[_0xb542('0x40')](_0xebee22[_0xb542('0x35')],_0x3794af[_0xb542('0x3f')]),_0x44bbb0);if(_0xebee22[_0xb542('0x35')]['filter']){_0x349de8[_0xb542('0x3e')]=_['merge'](_0x349de8['where'],{'$or':_[_0xb542('0x2e')](_0x44bbb0,function(_0x5758a9){if(_0x5758a9[_0xb542('0x32')]!==_0xb542('0x41')){var _0x4bcbe0={};_0x4bcbe0[_0x5758a9['name']]={'$like':'%'+_0xebee22[_0xb542('0x35')][_0xb542('0x42')]+'%'};return _0x4bcbe0;}})});}_0x349de8=_[_0xb542('0x43')]({},_0x349de8,_0xebee22['options']);var _0x1b4bbf={'where':_0x349de8['where']};return db[_0xb542('0x2f')][_0xb542('0x21')](_0x1b4bbf)['then'](function(_0x1ec9bc){_0x3cbb68['count']=_0x1ec9bc;if(_0xebee22[_0xb542('0x35')][_0xb542('0x44')]){_0x349de8[_0xb542('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb542('0x46')](_0x349de8);})['then'](function(_0x96ab3b){_0x3cbb68['rows']=_0x96ab3b;return _0x3cbb68;})[_0xb542('0x25')](respondWithFilteredResult(_0x16a8f6,_0x349de8))['catch'](handleError(_0x16a8f6,null));};exports[_0xb542('0x47')]=function(_0x381cfe,_0x6e73a0){var _0x2d720a={'raw':!![],'where':{'id':_0x381cfe['params']['id']}},_0xc3f6d7={};_0xc3f6d7[_0xb542('0x34')]=_['keys'](db['SquareOdbc'][_0xb542('0x30')]);_0xc3f6d7[_0xb542('0x35')]=_[_0xb542('0x36')](_0x381cfe[_0xb542('0x35')]);_0xc3f6d7[_0xb542('0x3f')]=_['intersection'](_0xc3f6d7[_0xb542('0x34')],_0xc3f6d7['query']);_0x2d720a[_0xb542('0x38')]=_['intersection'](_0xc3f6d7[_0xb542('0x34')],qs[_0xb542('0x39')](_0x381cfe[_0xb542('0x35')][_0xb542('0x39')]));_0x2d720a[_0xb542('0x38')]=_0x2d720a[_0xb542('0x38')]['length']?_0x2d720a['attributes']:_0xc3f6d7['model'];if(_0x381cfe[_0xb542('0x35')][_0xb542('0x44')]){_0x2d720a[_0xb542('0x45')]=[{'all':!![]}];}_0x2d720a=_[_0xb542('0x43')]({},_0x2d720a,_0x381cfe['options']);return db[_0xb542('0x2f')]['find'](_0x2d720a)[_0xb542('0x25')](handleEntityNotFound(_0x6e73a0,null))['then'](respondWithResult(_0x6e73a0,null))['catch'](handleError(_0x6e73a0,null));};exports[_0xb542('0x48')]=function(_0x398ce4,_0x4acf12){return db[_0xb542('0x2f')][_0xb542('0x48')](_0x398ce4['body'],{})[_0xb542('0x25')](function(_0x25d30c){var _0x2e529f=_0x398ce4[_0xb542('0x49')][_0xb542('0x27')]({'plain':!![]});if(!_0x2e529f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e529f[_0xb542('0x4a')]===_0xb542('0x49')){var _0x2c0f4e=_0x25d30c[_0xb542('0x27')]({'plain':!![]});var _0x5b7a68=_0xb542('0x28');return db[_0xb542('0x4b')]['find']({'where':{'name':_0x5b7a68,'userProfileId':_0x2e529f[_0xb542('0x4c')]},'raw':!![]})[_0xb542('0x25')](function(_0x41ed66){if(_0x41ed66&&_0x41ed66[_0xb542('0x4d')]===0x0){return db[_0xb542('0x29')][_0xb542('0x48')]({'name':_0x2c0f4e[_0xb542('0x2c')],'resourceId':_0x2c0f4e['id'],'type':_0x41ed66['name'],'sectionId':_0x41ed66['id']},{})[_0xb542('0x25')](function(){return _0x25d30c;});}else{return _0x25d30c;}})[_0xb542('0x4e')](function(_0x4663cf){logger[_0xb542('0x4f')](_0xb542('0x50'),_0x4663cf);throw _0x4663cf;});}return _0x25d30c;})[_0xb542('0x25')](respondWithResult(_0x4acf12,0xc9))[_0xb542('0x4e')](handleError(_0x4acf12,null));};exports['update']=function(_0x596672,_0xe5606c){if(_0x596672[_0xb542('0x51')]['id']){delete _0x596672[_0xb542('0x51')]['id'];}return db['SquareOdbc'][_0xb542('0x52')]({'where':{'id':_0x596672[_0xb542('0x53')]['id']}})[_0xb542('0x25')](handleEntityNotFound(_0xe5606c,null))[_0xb542('0x25')](saveUpdates(_0x596672[_0xb542('0x51')],null))['then'](respondWithResult(_0xe5606c,null))[_0xb542('0x4e')](handleError(_0xe5606c,null));};exports[_0xb542('0x26')]=function(_0x205f47,_0x113483){return db[_0xb542('0x2f')][_0xb542('0x52')]({'where':{'id':_0x205f47[_0xb542('0x53')]['id']}})[_0xb542('0x25')](handleEntityNotFound(_0x113483,null))[_0xb542('0x25')](removeEntity(_0x113483,null))[_0xb542('0x4e')](handleError(_0x113483,null));};exports[_0xb542('0x54')]=function(_0x3757fc,_0x4be860,_0x145ebd){var _0x1c3739;return db[_0xb542('0x2f')][_0xb542('0x52')]({'where':{'id':_0x3757fc['params']['id']},'attributes':['id','dsn']})[_0xb542('0x25')](handleEntityNotFound(_0x4be860,null))['then'](function(_0x1f5bf1){if(_0x1f5bf1){var _0xfa8dcb=require(_0xb542('0x55'))();_0xfa8dcb[_0xb542('0x56')](_0x1f5bf1[_0xb542('0x57')]);_0xfa8dcb['closeSync']();return _0x1f5bf1;}})['then'](respondWithResult(_0x4be860,null))[_0xb542('0x4e')](handleError(_0x4be860,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 75ce09e..25adce3 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 _0x4156=['path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0x4156,0x11a));var _0x6415=function(_0x2d43a7,_0x457b94){_0x2d43a7=_0x2d43a7-0x0;var _0x296918=_0x4156[_0x2d43a7];return _0x296918;};'use strict';var _=require('lodash');var util=require(_0x6415('0x0'));var logger=require(_0x6415('0x1'))(_0x6415('0x2'));var moment=require(_0x6415('0x3'));var BPromise=require(_0x6415('0x4'));var rp=require(_0x6415('0x5'));var fs=require('fs');var path=require(_0x6415('0x6'));var rimraf=require('rimraf');var config=require(_0x6415('0x7'));var attributes=require(_0x6415('0x8'));module[_0x6415('0x9')]=function(_0x5b58ce,_0x3dcc45){return _0x5b58ce[_0x6415('0xa')]('SquareOdbc',attributes,{'tableName':_0x6415('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34374d,_0x5d925c){var _0x592a7b=function(_0x488573){while(--_0x488573){_0x34374d['push'](_0x34374d['shift']());}};_0x592a7b(++_0x5d925c);}(_0x4975,0x86));var _0x5497=function(_0x4ee49c,_0x5231ac){_0x4ee49c=_0x4ee49c-0x0;var _0x3351fe=_0x4975[_0x4ee49c];return _0x3351fe;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index bd6c498..9b269b2 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 _0x789d=['http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','attributes','map','include','model','then','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x7f1331,_0x5bc140){var _0x4baff4=function(_0xc91a8c){while(--_0xc91a8c){_0x7f1331['push'](_0x7f1331['shift']());}};_0x4baff4(++_0x5bc140);}(_0x789d,0x118));var _0xd789=function(_0x2462a8,_0xd03f92){_0x2462a8=_0x2462a8-0x0;var _0x1b2a98=_0x789d[_0x2462a8];return _0x1b2a98;};'use strict';var _=require(_0xd789('0x0'));var util=require(_0xd789('0x1'));var moment=require(_0xd789('0x2'));var BPromise=require(_0xd789('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd789('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd789('0x5'))(_0xd789('0x6'));var config=require(_0xd789('0x7'));var jayson=require(_0xd789('0x8'));var client=jayson[_0xd789('0x9')][_0xd789('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4316f0,_0x228664,_0x620b2e){return new BPromise(function(_0x37f243,_0x384807){return client[_0xd789('0xb')](_0x4316f0,_0x620b2e)['then'](function(_0x517434){logger['info'](_0xd789('0xc'),_0x228664,_0xd789('0xd'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x228664,_0xd789('0xd'),JSON[_0xd789('0xe')](_0x517434));if(_0x517434[_0xd789('0xf')]){if(_0x517434[_0xd789('0xf')][_0xd789('0x10')]===0x1f4){logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x517434['error']['message']);return _0x384807(_0x517434['error'][_0xd789('0x11')]);}logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x517434[_0xd789('0xf')][_0xd789('0x11')]);return _0x37f243(_0x517434['error'][_0xd789('0x11')]);}else{logger[_0xd789('0x12')](_0xd789('0xc'),_0x228664,_0xd789('0xd'));_0x37f243(_0x517434['result']['message']);}})[_0xd789('0x13')](function(_0x797edd){logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x797edd);_0x384807(_0x797edd);});});}exports[_0xd789('0x14')]=function(_0x11fa1a){var _0x1355cf=this;return new Promise(function(_0x4772ae,_0x11c39c){return db[_0xd789('0x15')][_0xd789('0x16')]({'raw':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a['options']['raw']===undefined?!![]:![]:!![],'where':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')]['where']||null:null,'attributes':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')][_0xd789('0x18')]||null:null,'include':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')]['include']?_[_0xd789('0x19')](_0x11fa1a['options'][_0xd789('0x1a')],function(_0xc7db1d){return{'model':db[_0xc7db1d['model']],'as':_0xc7db1d['as'],'attributes':_0xc7db1d[_0xd789('0x18')],'include':_0xc7db1d[_0xd789('0x1a')]?_[_0xd789('0x19')](_0xc7db1d['include'],function(_0x333e4e){return{'model':db[_0x333e4e[_0xd789('0x1b')]],'as':_0x333e4e['as'],'attributes':_0x333e4e[_0xd789('0x18')],'include':_0x333e4e['include']?_[_0xd789('0x19')](_0x333e4e[_0xd789('0x1a')],function(_0x3fdcef){return{'model':db[_0x3fdcef[_0xd789('0x1b')]],'as':_0x3fdcef['as'],'attributes':_0x3fdcef[_0xd789('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd789('0x1c')](function(_0x5a8018){logger[_0xd789('0x12')](_0xd789('0x14'),_0x11fa1a);logger['debug']('ShowSquareOdbc',_0x11fa1a,JSON[_0xd789('0xe')](_0x5a8018));_0x4772ae(_0x5a8018);})[_0xd789('0x13')](function(_0x52f098){logger[_0xd789('0xf')](_0xd789('0x14'),_0x52f098['message'],_0x11fa1a);_0x11c39c(_0x1355cf[_0xd789('0xf')](0x1f4,_0x52f098[_0xd789('0x11')]));});});}; \ No newline at end of file +var _0xf582=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','find','raw','options','where','attributes','include','map','model','then','ShowSquareOdbc','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fcfb1,_0x114e24){var _0x2b5019=function(_0x267216){while(--_0x267216){_0x3fcfb1['push'](_0x3fcfb1['shift']());}};_0x2b5019(++_0x114e24);}(_0xf582,0x179));var _0x2f58=function(_0x2ccab9,_0x42969d){_0x2ccab9=_0x2ccab9-0x0;var _0x20e296=_0xf582[_0x2ccab9];return _0x20e296;};'use strict';var _=require(_0x2f58('0x0'));var util=require(_0x2f58('0x1'));var moment=require(_0x2f58('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f58('0x3'));var fs=require('fs');var Redis=require(_0x2f58('0x4'));var db=require(_0x2f58('0x5'))['db'];var utils=require(_0x2f58('0x6'));var logger=require(_0x2f58('0x7'))(_0x2f58('0x8'));var config=require(_0x2f58('0x9'));var jayson=require(_0x2f58('0xa'));var client=jayson[_0x2f58('0xb')][_0x2f58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c262e,_0x7be1d6,_0x150ce6){return new BPromise(function(_0x3c58cc,_0x8edaab){return client[_0x2f58('0xd')](_0x3c262e,_0x150ce6)['then'](function(_0x3ec7a9){logger['info'](_0x2f58('0xe'),_0x7be1d6,'request\x20sent');logger[_0x2f58('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x7be1d6,_0x2f58('0x10'),JSON[_0x2f58('0x11')](_0x3ec7a9));if(_0x3ec7a9['error']){if(_0x3ec7a9['error']['code']===0x1f4){logger[_0x2f58('0x12')](_0x2f58('0xe'),_0x7be1d6,_0x3ec7a9['error'][_0x2f58('0x13')]);return _0x8edaab(_0x3ec7a9['error'][_0x2f58('0x13')]);}logger[_0x2f58('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x7be1d6,_0x3ec7a9['error'][_0x2f58('0x13')]);return _0x3c58cc(_0x3ec7a9[_0x2f58('0x12')]['message']);}else{logger[_0x2f58('0x14')](_0x2f58('0xe'),_0x7be1d6,_0x2f58('0x10'));_0x3c58cc(_0x3ec7a9['result'][_0x2f58('0x13')]);}})[_0x2f58('0x15')](function(_0x3e5201){logger[_0x2f58('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x7be1d6,_0x3e5201);_0x8edaab(_0x3e5201);});});}exports['ShowSquareOdbc']=function(_0x1e03c9){var _0xc6f5f0=this;return new Promise(function(_0x3db9ea,_0x3e9352){return db['SquareOdbc'][_0x2f58('0x16')]({'raw':_0x1e03c9['options']?_0x1e03c9['options'][_0x2f58('0x17')]===undefined?!![]:![]:!![],'where':_0x1e03c9['options']?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x19')]||null:null,'attributes':_0x1e03c9['options']?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1a')]||null:null,'include':_0x1e03c9[_0x2f58('0x18')]?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1b')],function(_0x3b817f){return{'model':db[_0x3b817f[_0x2f58('0x1d')]],'as':_0x3b817f['as'],'attributes':_0x3b817f['attributes'],'include':_0x3b817f[_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x3b817f[_0x2f58('0x1b')],function(_0x2d1079){return{'model':db[_0x2d1079[_0x2f58('0x1d')]],'as':_0x2d1079['as'],'attributes':_0x2d1079[_0x2f58('0x1a')],'include':_0x2d1079[_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x2d1079[_0x2f58('0x1b')],function(_0x47f4ec){return{'model':db[_0x47f4ec['model']],'as':_0x47f4ec['as'],'attributes':_0x47f4ec[_0x2f58('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2f58('0x1e')](function(_0x43bf13){logger[_0x2f58('0x14')]('ShowSquareOdbc',_0x1e03c9);logger[_0x2f58('0xf')]('ShowSquareOdbc',_0x1e03c9,JSON[_0x2f58('0x11')](_0x43bf13));_0x3db9ea(_0x43bf13);})[_0x2f58('0x15')](function(_0x1f9b82){logger[_0x2f58('0x12')](_0x2f58('0x1f'),_0x1f9b82[_0x2f58('0x13')],_0x1e03c9);_0x3e9352(_0xc6f5f0[_0x2f58('0x12')](0x1f4,_0x1f9b82['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5fcf616..8bb68e5 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 _0x8b3e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0x4aed02,_0x3f757d){var _0x15c0b4=function(_0x3c8271){while(--_0x3c8271){_0x4aed02['push'](_0x4aed02['shift']());}};_0x15c0b4(++_0x3f757d);}(_0x8b3e,0x1b5));var _0xe8b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b3e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe8b3('0x0'));var util=require('util');var path=require(_0xe8b3('0x1'));var timeout=require(_0xe8b3('0x2'));var express=require(_0xe8b3('0x3'));var router=express[_0xe8b3('0x4')]();var fs_extra=require(_0xe8b3('0x5'));var auth=require(_0xe8b3('0x6'));var interaction=require(_0xe8b3('0x7'));var config=require(_0xe8b3('0x8'));var controller=require(_0xe8b3('0x9'));router[_0xe8b3('0xa')]('/',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0xc')]);router['get'](_0xe8b3('0xd'),auth[_0xe8b3('0xb')](),controller[_0xe8b3('0xe')]);router[_0xe8b3('0xf')]('/',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x10')]);router[_0xe8b3('0x11')]('/:id',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x12')]);router['delete'](_0xe8b3('0xd'),auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x24a0=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./squareProject.controller','isAuthenticated','get','/:id','create'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x24a0,0x148));var _0x024a=function(_0x1745f8,_0x117055){_0x1745f8=_0x1745f8-0x0;var _0x3a6f17=_0x24a0[_0x1745f8];return _0x3a6f17;};'use strict';var multer=require(_0x024a('0x0'));var util=require(_0x024a('0x1'));var path=require(_0x024a('0x2'));var timeout=require(_0x024a('0x3'));var express=require(_0x024a('0x4'));var router=express['Router']();var fs_extra=require(_0x024a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x024a('0x6'));var config=require('../../config/environment');var controller=require(_0x024a('0x7'));router['get']('/',auth[_0x024a('0x8')](),controller['index']);router[_0x024a('0x9')](_0x024a('0xa'),auth[_0x024a('0x8')](),controller['show']);router['post']('/',auth[_0x024a('0x8')](),controller[_0x024a('0xb')]);router[_0x024a('0xc')]('/:id',auth[_0x024a('0x8')](),controller[_0x024a('0xd')]);router[_0x024a('0xe')](_0x024a('0xa'),auth[_0x024a('0x8')](),controller[_0x024a('0xf')]);module[_0x024a('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3a79643..59aaf8d 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 _0x40df=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x348cce,_0x3676ba){var _0x2f31d5=function(_0x53b366){while(--_0x53b366){_0x348cce['push'](_0x348cce['shift']());}};_0x2f31d5(++_0x3676ba);}(_0x40df,0x1c9));var _0xf40d=function(_0x2d9c2c,_0x2881fd){_0x2d9c2c=_0x2d9c2c-0x0;var _0x2e7d25=_0x40df[_0x2d9c2c];return _0x2e7d25;};'use strict';var Sequelize=require(_0xf40d('0x0'));module[_0xf40d('0x1')]={'name':{'type':Sequelize[_0xf40d('0x2')],'unique':_0xf40d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf40d('0x2')]},'notes':{'type':Sequelize[_0xf40d('0x4')]},'preproduction':{'type':Sequelize[_0xf40d('0x5')](_0xf40d('0x6')),'get':function(){if(this[_0xf40d('0x7')](_0xf40d('0x8'))){return this[_0xf40d('0x7')](_0xf40d('0x8'))[_0xf40d('0x9')]('utf8');}}},'production':{'type':Sequelize[_0xf40d('0x5')](_0xf40d('0x6')),'get':function(){if(this[_0xf40d('0x7')]('production')){return this[_0xf40d('0x7')](_0xf40d('0xa'))[_0xf40d('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf40d('0xb')]},'publishedAt':{'type':Sequelize[_0xf40d('0xb')]}}; \ No newline at end of file +var _0x4a03=['preproduction','getDataValue','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0xccd4d3,_0xec2028){var _0xca752=function(_0x42de71){while(--_0x42de71){_0xccd4d3['push'](_0xccd4d3['shift']());}};_0xca752(++_0xec2028);}(_0x4a03,0x16e));var _0x34a0=function(_0x11ceb6,_0x4ed25c){_0x11ceb6=_0x11ceb6-0x0;var _0x50595c=_0x4a03[_0x11ceb6];return _0x50595c;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x34a0('0x3')]},'preproduction':{'type':Sequelize[_0x34a0('0x4')](_0x34a0('0x5')),'get':function(){if(this['getDataValue'](_0x34a0('0x6'))){return this[_0x34a0('0x7')]('preproduction')[_0x34a0('0x8')](_0x34a0('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x34a0('0x5')),'get':function(){if(this[_0x34a0('0x7')]('production')){return this[_0x34a0('0x7')](_0x34a0('0xa'))[_0x34a0('0x8')](_0x34a0('0x9'));}}},'savedAt':{'type':Sequelize[_0x34a0('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 37abd30..6309fa1 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 _0x8107=['status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','name','send','index','map','SquareProject','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','show','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','params','pick','lodash','ioredis','../../config/logger','api','redis','defaults','socket.io-emitter','./squareProject.socket','register'];(function(_0x57c9a9,_0x48c040){var _0x19a608=function(_0x671481){while(--_0x671481){_0x57c9a9['push'](_0x57c9a9['shift']());}};_0x19a608(++_0x48c040);}(_0x8107,0xbd));var _0x7810=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x8107[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0x7810('0x0'));var Redis=require(_0x7810('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x7810('0x2'))(_0x7810('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7810('0x4')]=_[_0x7810('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7810('0x6'))(new Redis(config[_0x7810('0x4')]));require(_0x7810('0x7'))[_0x7810('0x8')](socket);function respondWithResult(_0x5acdb3,_0x527222){_0x527222=_0x527222||0xc8;return function(_0x4528ca){if(_0x4528ca){return _0x5acdb3[_0x7810('0x9')](_0x527222)['json'](_0x4528ca);}};}function respondWithFilteredResult(_0x2fae83,_0x10114f){return function(_0x58ca4e){if(_0x58ca4e){var _0x19b234=typeof _0x10114f[_0x7810('0xa')]===_0x7810('0xb')&&typeof _0x10114f[_0x7810('0xc')]===_0x7810('0xb');var _0x33a7bd=_0x58ca4e[_0x7810('0xd')];var _0x2535a3=_0x19b234?0x0:_0x10114f['offset'];var _0xf09584=_0x19b234?_0x58ca4e[_0x7810('0xd')]:_0x10114f[_0x7810('0xa')]+_0x10114f[_0x7810('0xc')];var _0x1277c0;if(_0xf09584>=_0x33a7bd){_0xf09584=_0x33a7bd;_0x1277c0=0xc8;}else{_0x1277c0=0xce;}_0x2fae83[_0x7810('0x9')](_0x1277c0);return _0x2fae83[_0x7810('0xe')](_0x7810('0xf'),_0x2535a3+'-'+_0xf09584+'/'+_0x33a7bd)[_0x7810('0x10')](_0x58ca4e);}return null;};}function saveUpdates(_0x5eac77){return function(_0xa3140b){if(_0xa3140b){return _0xa3140b[_0x7810('0x11')](_0x5eac77)[_0x7810('0x12')](function(_0x6cfd2f){return _0x6cfd2f;});}return null;};}function removeEntity(_0x4f7509){return function(_0x259fd5){if(_0x259fd5){return _0x259fd5[_0x7810('0x13')]()['then'](function(){var _0x2095b9=_0x259fd5[_0x7810('0x14')]({'plain':!![]});var _0xd9baf=_0x7810('0x15');return db[_0x7810('0x16')]['destroy']({'where':{'type':_0xd9baf,'resourceId':_0x2095b9['id']}})[_0x7810('0x12')](function(){return _0x259fd5;});})[_0x7810('0x12')](function(){var _0x4a777d=new Redis(config[_0x7810('0x4')]);_0x4a777d[_0x7810('0x17')]('agi',JSON[_0x7810('0x18')]({'id':_0x259fd5['id'],'deleted':!![]}));})[_0x7810('0x12')](function(){_0x4f7509['status'](0xcc)[_0x7810('0x19')]();});}};}function handleEntityNotFound(_0x1a6a58){return function(_0x3df913){if(!_0x3df913){_0x1a6a58['sendStatus'](0x194);}return _0x3df913;};}function handleError(_0x3306a5,_0x21a453){_0x21a453=_0x21a453||0x1f4;return function(_0xfa640b){logger['error'](_0xfa640b['stack']);if(_0xfa640b[_0x7810('0x1a')]){delete _0xfa640b[_0x7810('0x1a')];}_0x3306a5[_0x7810('0x9')](_0x21a453)[_0x7810('0x1b')](_0xfa640b);};}exports[_0x7810('0x1c')]=function(_0x21b73b,_0x303750){var _0x509802={},_0x23a5c3={},_0x501246={'count':0x0,'rows':[]};var _0x5ec614=_[_0x7810('0x1d')](db[_0x7810('0x1e')]['rawAttributes'],function(_0x5423b7){return{'name':_0x5423b7['fieldName'],'type':_0x5423b7['type'][_0x7810('0x1f')]};});_0x23a5c3[_0x7810('0x20')]=_['map'](_0x5ec614,_0x7810('0x1a'));_0x23a5c3[_0x7810('0x21')]=_[_0x7810('0x22')](_0x21b73b[_0x7810('0x21')]);_0x23a5c3[_0x7810('0x23')]=_[_0x7810('0x24')](_0x23a5c3[_0x7810('0x20')],_0x23a5c3['query']);_0x509802[_0x7810('0x25')]=_['intersection'](_0x23a5c3[_0x7810('0x20')],qs[_0x7810('0x26')](_0x21b73b[_0x7810('0x21')][_0x7810('0x26')]));_0x509802['attributes']=_0x509802[_0x7810('0x25')]['length']?_0x509802[_0x7810('0x25')]:_0x23a5c3['model'];if(!_0x21b73b[_0x7810('0x21')][_0x7810('0x27')](_0x7810('0x28'))){_0x509802[_0x7810('0xc')]=qs[_0x7810('0xc')](_0x21b73b[_0x7810('0x21')][_0x7810('0xc')]);_0x509802[_0x7810('0xa')]=qs[_0x7810('0xa')](_0x21b73b[_0x7810('0x21')]['offset']);}_0x509802[_0x7810('0x29')]=qs[_0x7810('0x2a')](_0x21b73b[_0x7810('0x21')][_0x7810('0x2a')]);_0x509802[_0x7810('0x2b')]=qs[_0x7810('0x23')](_['pick'](_0x21b73b['query'],_0x23a5c3[_0x7810('0x23')]),_0x5ec614);if(_0x21b73b[_0x7810('0x21')][_0x7810('0x2c')]){_0x509802['where']=_[_0x7810('0x2d')](_0x509802['where'],{'$or':_[_0x7810('0x1d')](_0x5ec614,function(_0x5efee6){if(_0x5efee6[_0x7810('0x2e')]!==_0x7810('0x2f')){var _0x17ca39={};_0x17ca39[_0x5efee6['name']]={'$like':'%'+_0x21b73b['query'][_0x7810('0x2c')]+'%'};return _0x17ca39;}})});}_0x509802=_[_0x7810('0x2d')]({},_0x509802,_0x21b73b[_0x7810('0x30')]);var _0x176ebe={'where':_0x509802[_0x7810('0x2b')]};return db[_0x7810('0x1e')]['count'](_0x176ebe)[_0x7810('0x12')](function(_0x2cc0e9){_0x501246[_0x7810('0xd')]=_0x2cc0e9;if(_0x21b73b[_0x7810('0x21')][_0x7810('0x31')]){_0x509802['include']=[{'all':!![]}];}return db[_0x7810('0x1e')]['findAll'](_0x509802);})[_0x7810('0x12')](function(_0x2d82ff){_0x501246['rows']=_0x2d82ff;return _0x501246;})[_0x7810('0x12')](respondWithFilteredResult(_0x303750,_0x509802))[_0x7810('0x32')](handleError(_0x303750,null));};exports[_0x7810('0x33')]=function(_0x67fd9a,_0x49884c){var _0xa47b72={'raw':![],'where':{'id':_0x67fd9a['params']['id']}},_0x2d62e0={};_0x2d62e0[_0x7810('0x20')]=_[_0x7810('0x22')](db[_0x7810('0x1e')][_0x7810('0x34')]);_0x2d62e0[_0x7810('0x21')]=_[_0x7810('0x22')](_0x67fd9a['query']);_0x2d62e0[_0x7810('0x23')]=_['intersection'](_0x2d62e0[_0x7810('0x20')],_0x2d62e0['query']);_0xa47b72[_0x7810('0x25')]=_[_0x7810('0x24')](_0x2d62e0['model'],qs['fields'](_0x67fd9a[_0x7810('0x21')]['fields']));_0xa47b72['attributes']=_0xa47b72['attributes']['length']?_0xa47b72[_0x7810('0x25')]:_0x2d62e0['model'];if(_0x67fd9a[_0x7810('0x21')][_0x7810('0x31')]){_0xa47b72[_0x7810('0x35')]=[{'all':!![]}];}_0xa47b72=_[_0x7810('0x2d')]({},_0xa47b72,_0x67fd9a[_0x7810('0x30')]);return db[_0x7810('0x1e')]['find'](_0xa47b72)['then'](handleEntityNotFound(_0x49884c,null))[_0x7810('0x12')](respondWithResult(_0x49884c,null))[_0x7810('0x32')](handleError(_0x49884c,null));};exports[_0x7810('0x36')]=function(_0x2e0362,_0x269fd5){return db['SquareProject']['create'](_0x2e0362[_0x7810('0x37')],{})[_0x7810('0x12')](function(_0xafdff5){var _0x16f2ee=_0x2e0362[_0x7810('0x38')]['get']({'plain':!![]});if(!_0x16f2ee)throw new Error(_0x7810('0x39'));if(_0x16f2ee[_0x7810('0x3a')]===_0x7810('0x38')){var _0x3090d0=_0xafdff5[_0x7810('0x14')]({'plain':!![]});var _0x6daa93=_0x7810('0x15');return db[_0x7810('0x3b')][_0x7810('0x3c')]({'where':{'name':_0x6daa93,'userProfileId':_0x16f2ee[_0x7810('0x3d')]},'raw':!![]})[_0x7810('0x12')](function(_0x595904){if(_0x595904&&_0x595904[_0x7810('0x3e')]===0x0){return db[_0x7810('0x16')][_0x7810('0x36')]({'name':_0x3090d0[_0x7810('0x1a')],'resourceId':_0x3090d0['id'],'type':_0x595904[_0x7810('0x1a')],'sectionId':_0x595904['id']},{})[_0x7810('0x12')](function(){return _0xafdff5;});}else{return _0xafdff5;}})[_0x7810('0x32')](function(_0x147b95){logger[_0x7810('0x3f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147b95);throw _0x147b95;});}return _0xafdff5;})[_0x7810('0x12')](respondWithResult(_0x269fd5,0xc9))['catch'](handleError(_0x269fd5,null));};exports[_0x7810('0x11')]=function(_0x4e9b80,_0xd76ba2){if(_0x4e9b80['body']['id']){delete _0x4e9b80[_0x7810('0x37')]['id'];}return db['SquareProject'][_0x7810('0x3c')]({'where':{'id':_0x4e9b80[_0x7810('0x40')]['id']}})[_0x7810('0x12')](handleEntityNotFound(_0xd76ba2,null))[_0x7810('0x12')](saveUpdates(_0x4e9b80[_0x7810('0x37')],null))[_0x7810('0x12')](function(_0x484958){if(!_0x484958)return;var _0x4a4586=_0x484958[_0x7810('0x14')]({'plain':!![]});return _0x4a4586;})[_0x7810('0x12')](function(_0x407c8c){var _0x2e638f=new Redis(config[_0x7810('0x4')]);_0x2e638f[_0x7810('0x17')]('agi',JSON['stringify'](_[_0x7810('0x41')](_0x407c8c,['id','name','production'])));return _0x407c8c;})[_0x7810('0x12')](respondWithResult(_0xd76ba2,null))[_0x7810('0x32')](handleError(_0xd76ba2,null));};exports['destroy']=function(_0x5dc5f9,_0x58c97c){return db['SquareProject'][_0x7810('0x3c')]({'where':{'id':_0x5dc5f9[_0x7810('0x40')]['id']}})[_0x7810('0x12')](handleEntityNotFound(_0x58c97c,null))[_0x7810('0x12')](removeEntity(_0x58c97c,null))[_0x7810('0x32')](handleError(_0x58c97c,null));}; \ No newline at end of file +var _0xe8d5=['map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','agi','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','status','offset','undefined','limit','count','Content-Range','json','destroy','then','get','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send'];(function(_0xb8a736,_0x1bbded){var _0x54dc30=function(_0x3b36fe){while(--_0x3b36fe){_0xb8a736['push'](_0xb8a736['shift']());}};_0x54dc30(++_0x1bbded);}(_0xe8d5,0x138));var _0x5e8d=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe8d5[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x5e8d('0x0'));var Redis=require(_0x5e8d('0x1'));var qs=require(_0x5e8d('0x2'));var logger=require(_0x5e8d('0x3'))('api');var config=require(_0x5e8d('0x4'));var db=require(_0x5e8d('0x5'))['db'];config[_0x5e8d('0x6')]=_['defaults'](config[_0x5e8d('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e8d('0x7'))(new Redis(config[_0x5e8d('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x3404fd,_0x5a2945){_0x5a2945=_0x5a2945||0xc8;return function(_0xd47817){if(_0xd47817){return _0x3404fd[_0x5e8d('0x8')](_0x5a2945)['json'](_0xd47817);}};}function respondWithFilteredResult(_0x4db909,_0x107ca5){return function(_0x195047){if(_0x195047){var _0x105385=typeof _0x107ca5[_0x5e8d('0x9')]===_0x5e8d('0xa')&&typeof _0x107ca5[_0x5e8d('0xb')]===_0x5e8d('0xa');var _0x1a8119=_0x195047[_0x5e8d('0xc')];var _0x44365c=_0x105385?0x0:_0x107ca5[_0x5e8d('0x9')];var _0x423ae0=_0x105385?_0x195047[_0x5e8d('0xc')]:_0x107ca5[_0x5e8d('0x9')]+_0x107ca5['limit'];var _0x57e44f;if(_0x423ae0>=_0x1a8119){_0x423ae0=_0x1a8119;_0x57e44f=0xc8;}else{_0x57e44f=0xce;}_0x4db909[_0x5e8d('0x8')](_0x57e44f);return _0x4db909['set'](_0x5e8d('0xd'),_0x44365c+'-'+_0x423ae0+'/'+_0x1a8119)[_0x5e8d('0xe')](_0x195047);}return null;};}function saveUpdates(_0x348c1a){return function(_0x114ba0){if(_0x114ba0){return _0x114ba0['update'](_0x348c1a)['then'](function(_0xbbaa8c){return _0xbbaa8c;});}return null;};}function removeEntity(_0x5291b6){return function(_0x3ac4db){if(_0x3ac4db){return _0x3ac4db[_0x5e8d('0xf')]()[_0x5e8d('0x10')](function(){var _0x5eb633=_0x3ac4db[_0x5e8d('0x11')]({'plain':!![]});var _0x5d39be=_0x5e8d('0x12');return db[_0x5e8d('0x13')][_0x5e8d('0xf')]({'where':{'type':_0x5d39be,'resourceId':_0x5eb633['id']}})[_0x5e8d('0x10')](function(){return _0x3ac4db;});})[_0x5e8d('0x10')](function(){var _0x2ebc3f=new Redis(config[_0x5e8d('0x6')]);_0x2ebc3f[_0x5e8d('0x14')]('agi',JSON[_0x5e8d('0x15')]({'id':_0x3ac4db['id'],'deleted':!![]}));})[_0x5e8d('0x10')](function(){_0x5291b6[_0x5e8d('0x8')](0xcc)[_0x5e8d('0x16')]();});}};}function handleEntityNotFound(_0xf77635){return function(_0x5e3d3e){if(!_0x5e3d3e){_0xf77635[_0x5e8d('0x17')](0x194);}return _0x5e3d3e;};}function handleError(_0x2f90c6,_0x3bfc2f){_0x3bfc2f=_0x3bfc2f||0x1f4;return function(_0x537beb){logger[_0x5e8d('0x18')](_0x537beb[_0x5e8d('0x19')]);if(_0x537beb[_0x5e8d('0x1a')]){delete _0x537beb[_0x5e8d('0x1a')];}_0x2f90c6[_0x5e8d('0x8')](_0x3bfc2f)[_0x5e8d('0x1b')](_0x537beb);};}exports['index']=function(_0x174316,_0xb4538c){var _0x393f45={},_0xa7db73={},_0x1fb3ab={'count':0x0,'rows':[]};var _0xac052c=_[_0x5e8d('0x1c')](db[_0x5e8d('0x1d')][_0x5e8d('0x1e')],function(_0x148c0f){return{'name':_0x148c0f[_0x5e8d('0x1f')],'type':_0x148c0f[_0x5e8d('0x20')][_0x5e8d('0x21')]};});_0xa7db73[_0x5e8d('0x22')]=_[_0x5e8d('0x1c')](_0xac052c,_0x5e8d('0x1a'));_0xa7db73[_0x5e8d('0x23')]=_['keys'](_0x174316[_0x5e8d('0x23')]);_0xa7db73[_0x5e8d('0x24')]=_['intersection'](_0xa7db73[_0x5e8d('0x22')],_0xa7db73[_0x5e8d('0x23')]);_0x393f45[_0x5e8d('0x25')]=_[_0x5e8d('0x26')](_0xa7db73[_0x5e8d('0x22')],qs[_0x5e8d('0x27')](_0x174316[_0x5e8d('0x23')]['fields']));_0x393f45['attributes']=_0x393f45[_0x5e8d('0x25')][_0x5e8d('0x28')]?_0x393f45[_0x5e8d('0x25')]:_0xa7db73[_0x5e8d('0x22')];if(!_0x174316[_0x5e8d('0x23')][_0x5e8d('0x29')](_0x5e8d('0x2a'))){_0x393f45[_0x5e8d('0xb')]=qs['limit'](_0x174316[_0x5e8d('0x23')]['limit']);_0x393f45[_0x5e8d('0x9')]=qs[_0x5e8d('0x9')](_0x174316[_0x5e8d('0x23')][_0x5e8d('0x9')]);}_0x393f45['order']=qs['sort'](_0x174316[_0x5e8d('0x23')][_0x5e8d('0x2b')]);_0x393f45[_0x5e8d('0x2c')]=qs[_0x5e8d('0x24')](_[_0x5e8d('0x2d')](_0x174316['query'],_0xa7db73[_0x5e8d('0x24')]),_0xac052c);if(_0x174316[_0x5e8d('0x23')]['filter']){_0x393f45['where']=_[_0x5e8d('0x2e')](_0x393f45['where'],{'$or':_[_0x5e8d('0x1c')](_0xac052c,function(_0x27f3c9){if(_0x27f3c9['type']!==_0x5e8d('0x2f')){var _0x23d141={};_0x23d141[_0x27f3c9[_0x5e8d('0x1a')]]={'$like':'%'+_0x174316[_0x5e8d('0x23')][_0x5e8d('0x30')]+'%'};return _0x23d141;}})});}_0x393f45=_[_0x5e8d('0x2e')]({},_0x393f45,_0x174316[_0x5e8d('0x31')]);var _0x2f7571={'where':_0x393f45[_0x5e8d('0x2c')]};return db[_0x5e8d('0x1d')][_0x5e8d('0xc')](_0x2f7571)[_0x5e8d('0x10')](function(_0x5f095c){_0x1fb3ab['count']=_0x5f095c;if(_0x174316['query'][_0x5e8d('0x32')]){_0x393f45[_0x5e8d('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x5e8d('0x34')](_0x393f45);})['then'](function(_0x38b715){_0x1fb3ab[_0x5e8d('0x35')]=_0x38b715;return _0x1fb3ab;})[_0x5e8d('0x10')](respondWithFilteredResult(_0xb4538c,_0x393f45))[_0x5e8d('0x36')](handleError(_0xb4538c,null));};exports[_0x5e8d('0x37')]=function(_0x414709,_0x215e80){var _0x1c7e95={'raw':![],'where':{'id':_0x414709[_0x5e8d('0x38')]['id']}},_0x3beeab={};_0x3beeab[_0x5e8d('0x22')]=_[_0x5e8d('0x39')](db['SquareProject'][_0x5e8d('0x1e')]);_0x3beeab[_0x5e8d('0x23')]=_[_0x5e8d('0x39')](_0x414709[_0x5e8d('0x23')]);_0x3beeab[_0x5e8d('0x24')]=_[_0x5e8d('0x26')](_0x3beeab[_0x5e8d('0x22')],_0x3beeab['query']);_0x1c7e95[_0x5e8d('0x25')]=_[_0x5e8d('0x26')](_0x3beeab['model'],qs['fields'](_0x414709['query'][_0x5e8d('0x27')]));_0x1c7e95[_0x5e8d('0x25')]=_0x1c7e95['attributes']['length']?_0x1c7e95[_0x5e8d('0x25')]:_0x3beeab[_0x5e8d('0x22')];if(_0x414709[_0x5e8d('0x23')][_0x5e8d('0x32')]){_0x1c7e95[_0x5e8d('0x33')]=[{'all':!![]}];}_0x1c7e95=_[_0x5e8d('0x2e')]({},_0x1c7e95,_0x414709['options']);return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')](_0x1c7e95)[_0x5e8d('0x10')](handleEntityNotFound(_0x215e80,null))[_0x5e8d('0x10')](respondWithResult(_0x215e80,null))[_0x5e8d('0x36')](handleError(_0x215e80,null));};exports['create']=function(_0x42fd7d,_0x4a553c){return db[_0x5e8d('0x1d')][_0x5e8d('0x3b')](_0x42fd7d['body'],{})[_0x5e8d('0x10')](function(_0x597ec8){var _0xea1618=_0x42fd7d[_0x5e8d('0x3c')]['get']({'plain':!![]});if(!_0xea1618)throw new Error(_0x5e8d('0x3d'));if(_0xea1618[_0x5e8d('0x3e')]===_0x5e8d('0x3c')){var _0x403eb0=_0x597ec8[_0x5e8d('0x11')]({'plain':!![]});var _0x5b98d0='SquareProjects';return db[_0x5e8d('0x3f')]['find']({'where':{'name':_0x5b98d0,'userProfileId':_0xea1618[_0x5e8d('0x40')]},'raw':!![]})[_0x5e8d('0x10')](function(_0x440578){if(_0x440578&&_0x440578['autoAssociation']===0x0){return db[_0x5e8d('0x13')]['create']({'name':_0x403eb0[_0x5e8d('0x1a')],'resourceId':_0x403eb0['id'],'type':_0x440578['name'],'sectionId':_0x440578['id']},{})['then'](function(){return _0x597ec8;});}else{return _0x597ec8;}})[_0x5e8d('0x36')](function(_0x139004){logger[_0x5e8d('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139004);throw _0x139004;});}return _0x597ec8;})[_0x5e8d('0x10')](respondWithResult(_0x4a553c,0xc9))['catch'](handleError(_0x4a553c,null));};exports['update']=function(_0x417b63,_0x141393){if(_0x417b63[_0x5e8d('0x41')]['id']){delete _0x417b63['body']['id'];}return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')]({'where':{'id':_0x417b63['params']['id']}})[_0x5e8d('0x10')](handleEntityNotFound(_0x141393,null))[_0x5e8d('0x10')](saveUpdates(_0x417b63['body'],null))[_0x5e8d('0x10')](function(_0x3ea58a){if(!_0x3ea58a)return;var _0xce43d5=_0x3ea58a[_0x5e8d('0x11')]({'plain':!![]});return _0xce43d5;})[_0x5e8d('0x10')](function(_0x1bdc5f){var _0x1c2df2=new Redis(config[_0x5e8d('0x6')]);_0x1c2df2[_0x5e8d('0x14')](_0x5e8d('0x42'),JSON[_0x5e8d('0x15')](_[_0x5e8d('0x2d')](_0x1bdc5f,['id','name',_0x5e8d('0x43')])));return _0x1bdc5f;})['then'](respondWithResult(_0x141393,null))[_0x5e8d('0x36')](handleError(_0x141393,null));};exports['destroy']=function(_0x42ddc5,_0x5af765){return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')]({'where':{'id':_0x42ddc5['params']['id']}})[_0x5e8d('0x10')](handleEntityNotFound(_0x5af765,null))[_0x5e8d('0x10')](removeEntity(_0x5af765,null))[_0x5e8d('0x36')](handleError(_0x5af765,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e99cc24..d0949a1 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 _0x4a45=['emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x94f5f7,_0x7fc74d){var _0x5cc1d8=function(_0x2a2043){while(--_0x2a2043){_0x94f5f7['push'](_0x94f5f7['shift']());}};_0x5cc1d8(++_0x7fc74d);}(_0x4a45,0x189));var _0x54a4=function(_0x3e3be4,_0x4fa051){_0x3e3be4=_0x3e3be4-0x0;var _0x5807f8=_0x4a45[_0x3e3be4];return _0x5807f8;};'use strict';var EventEmitter=require(_0x54a4('0x0'));var SquareProject=require(_0x54a4('0x1'))['db'][_0x54a4('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x54a4('0x3')](0x0);var events={'afterCreate':_0x54a4('0x4'),'afterUpdate':_0x54a4('0x5'),'afterDestroy':_0x54a4('0x6')};function emitEvent(_0x4b4850){return function(_0x31241e,_0x73bd6a,_0x32e834){SquareProjectEvents[_0x54a4('0x7')](_0x4b4850+':'+_0x31241e['id'],_0x31241e);SquareProjectEvents[_0x54a4('0x7')](_0x4b4850,_0x31241e);_0x32e834(null);};}for(var e in events){if(events[_0x54a4('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x54a4('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xff1b=['update','remove','emit','hasOwnProperty','events','SquareProject'];(function(_0x598475,_0x4405d2){var _0x304ec2=function(_0xc8cb7b){while(--_0xc8cb7b){_0x598475['push'](_0x598475['shift']());}};_0x304ec2(++_0x4405d2);}(_0xff1b,0x16c));var _0xbff1=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0xff1b[_0x5e7b6c];return _0x3afdbd;};'use strict';var EventEmitter=require(_0xbff1('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xbff1('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbff1('0x2'),'afterDestroy':_0xbff1('0x3')};function emitEvent(_0x5cfb01){return function(_0x1c1838,_0x19078f,_0xd6b3df){SquareProjectEvents[_0xbff1('0x4')](_0x5cfb01+':'+_0x1c1838['id'],_0x1c1838);SquareProjectEvents['emit'](_0x5cfb01,_0x1c1838);_0xd6b3df(null);};}for(var e in events){if(events[_0xbff1('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 558b0d0..5bb083b 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 _0x01f4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','production','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x1c6856,_0x8786ba){var _0x310ca5=function(_0x5d32b6){while(--_0x5d32b6){_0x1c6856['push'](_0x1c6856['shift']());}};_0x310ca5(++_0x8786ba);}(_0x01f4,0x1be));var _0x401f=function(_0x2ddffe,_0x34ee64){_0x2ddffe=_0x2ddffe-0x0;var _0x7a7604=_0x01f4[_0x2ddffe];return _0x7a7604;};'use strict';var _=require(_0x401f('0x0'));var util=require(_0x401f('0x1'));var logger=require(_0x401f('0x2'))(_0x401f('0x3'));var moment=require(_0x401f('0x4'));var BPromise=require(_0x401f('0x5'));var rp=require(_0x401f('0x6'));var fs=require('fs');var path=require(_0x401f('0x7'));var rimraf=require(_0x401f('0x8'));var config=require(_0x401f('0x9'));var attributes=require(_0x401f('0xa'));module[_0x401f('0xb')]=function(_0xf89202,_0x1c1816){return _0xf89202[_0x401f('0xc')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc3e7,_0xb49140,_0x2ec333){if(_0x1dc3e7[_0x401f('0xd')](_0x401f('0xe'))){_0x1dc3e7['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1dc3e7[_0x401f('0xd')](_0x401f('0xf'))){_0x1dc3e7['publishedAt']=moment()[_0x401f('0x10')](_0x401f('0x11'));}_0x2ec333(null,_0x1dc3e7);}}});}; \ No newline at end of file +var _0x926c=['format','changed','publishedAt','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x926c,0x193));var _0xc926=function(_0x55aa03,_0x2baa86){_0x55aa03=_0x55aa03-0x0;var _0x26282e=_0x926c[_0x55aa03];return _0x26282e;};'use strict';var _=require('lodash');var util=require(_0xc926('0x0'));var logger=require(_0xc926('0x1'))(_0xc926('0x2'));var moment=require('moment');var BPromise=require(_0xc926('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc926('0x4'));var config=require(_0xc926('0x5'));var attributes=require(_0xc926('0x6'));module[_0xc926('0x7')]=function(_0x578d43,_0x4e6bb6){return _0x578d43[_0xc926('0x8')](_0xc926('0x9'),attributes,{'tableName':_0xc926('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x88ff34,_0x407639,_0x225ea5){if(_0x88ff34['changed'](_0xc926('0xb'))){_0x88ff34[_0xc926('0xc')]=moment()[_0xc926('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x88ff34[_0xc926('0xe')]('production')){_0x88ff34[_0xc926('0xf')]=moment()[_0xc926('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x225ea5(null,_0x88ff34);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4c814aa..b93131a 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 _0x7df7=['raw','where','limit','include','map','attributes','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options'];(function(_0x3616a4,_0x2b89fa){var _0x539472=function(_0x250f5e){while(--_0x250f5e){_0x3616a4['push'](_0x3616a4['shift']());}};_0x539472(++_0x2b89fa);}(_0x7df7,0x66));var _0x77df=function(_0x485c80,_0x12da03){_0x485c80=_0x485c80-0x0;var _0x371437=_0x7df7[_0x485c80];return _0x371437;};'use strict';var _=require(_0x77df('0x0'));var Redis=require('ioredis');var db=require(_0x77df('0x1'))['db'];var logger=require(_0x77df('0x2'))(_0x77df('0x3'));var config=require(_0x77df('0x4'));config[_0x77df('0x5')]=_[_0x77df('0x6')](config[_0x77df('0x5')],{'host':_0x77df('0x7'),'port':0x18eb});var socket=require(_0x77df('0x8'))(new Redis(config[_0x77df('0x5')]));require(_0x77df('0x9'))[_0x77df('0xa')](socket);exports[_0x77df('0xb')]=function(_0x1b2f10){var _0x867786=this;return new Promise(function(_0xb0e429,_0x41d9a4){return db[_0x77df('0xc')]['findAll']({'raw':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0xe')]===undefined?!![]:![]:!![],'where':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0xf')]||null:null,'attributes':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')]['attributes']||null:null,'limit':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0x10')]||null:null,'include':_0x1b2f10['options']?_0x1b2f10['options'][_0x77df('0x11')]?_[_0x77df('0x12')](_0x1b2f10[_0x77df('0xd')][_0x77df('0x11')],function(_0x21ed7c){return{'model':db[_0x21ed7c['model']],'as':_0x21ed7c['as'],'attributes':_0x21ed7c[_0x77df('0x13')],'include':_0x21ed7c[_0x77df('0x11')]?_[_0x77df('0x12')](_0x21ed7c[_0x77df('0x11')],function(_0x49cb85){return{'model':db[_0x49cb85['model']],'as':_0x49cb85['as'],'attributes':_0x49cb85[_0x77df('0x13')],'include':_0x49cb85[_0x77df('0x11')]?_['map'](_0x49cb85[_0x77df('0x11')],function(_0x4cb8cf){return{'model':db[_0x4cb8cf[_0x77df('0x14')]],'as':_0x4cb8cf['as'],'attributes':_0x4cb8cf[_0x77df('0x13')]};}):[]};}):[]};}):[]:[]})[_0x77df('0x15')](function(_0x3e629b){logger[_0x77df('0x16')](_0x77df('0xb'),_0x1b2f10);logger[_0x77df('0x17')](_0x77df('0xb'),_0x1b2f10,JSON[_0x77df('0x18')](_0x3e629b));_0xb0e429(_0x3e629b);})[_0x77df('0x19')](function(_0x3864d6){logger[_0x77df('0x1a')](_0x77df('0xb'),_0x3864d6[_0x77df('0x1b')],_0x1b2f10);_0x41d9a4(_0x867786[_0x77df('0x1a')](0x1f4,_0x3864d6[_0x77df('0x1b')]));});});};exports[_0x77df('0x1c')]=function(_0x2bb0bb){var _0x466103=this;return new Promise(function(_0x2798f4,_0x383800){return db['SquareProject']['find']({'raw':_0x2bb0bb['options']?_0x2bb0bb[_0x77df('0xd')][_0x77df('0xe')]===undefined?!![]:![]:!![],'where':_0x2bb0bb['options']?_0x2bb0bb[_0x77df('0xd')][_0x77df('0xf')]||null:null,'attributes':_0x2bb0bb[_0x77df('0xd')]?_0x2bb0bb[_0x77df('0xd')][_0x77df('0x13')]||null:null,'include':_0x2bb0bb[_0x77df('0xd')]?_0x2bb0bb['options'][_0x77df('0x11')]?_['map'](_0x2bb0bb['options'][_0x77df('0x11')],function(_0x2b6600){return{'model':db[_0x2b6600[_0x77df('0x14')]],'as':_0x2b6600['as'],'attributes':_0x2b6600[_0x77df('0x13')],'include':_0x2b6600[_0x77df('0x11')]?_['map'](_0x2b6600[_0x77df('0x11')],function(_0x293f4a){return{'model':db[_0x293f4a[_0x77df('0x14')]],'as':_0x293f4a['as'],'attributes':_0x293f4a[_0x77df('0x13')],'include':_0x293f4a[_0x77df('0x11')]?_['map'](_0x293f4a[_0x77df('0x11')],function(_0x5710c4){return{'model':db[_0x5710c4['model']],'as':_0x5710c4['as'],'attributes':_0x5710c4[_0x77df('0x13')]};}):[]};}):[]};}):[]:[]})[_0x77df('0x15')](function(_0xdcd643){logger[_0x77df('0x16')](_0x77df('0x1c'),_0x2bb0bb);logger[_0x77df('0x17')](_0x77df('0x1c'),_0x2bb0bb,JSON['stringify'](_0xdcd643));_0x2798f4(_0xdcd643);})['catch'](function(_0x416969){logger['error'](_0x77df('0x1c'),_0x416969['message'],_0x2bb0bb);_0x383800(_0x466103['error'](0x1f4,_0x416969['message']));});});}; \ No newline at end of file +var _0xb9fd=['error','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','limit','map','include','model','then','info','GetSquareProjects','stringify','message','ShowSquareProject','raw','debug','catch'];(function(_0x23974d,_0x43643f){var _0x50aed1=function(_0xaf5404){while(--_0xaf5404){_0x23974d['push'](_0x23974d['shift']());}};_0x50aed1(++_0x43643f);}(_0xb9fd,0x187));var _0xdb9f=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0xb9fd[_0x1f9503];return _0xaab94f;};'use strict';var _=require('lodash');var Redis=require(_0xdb9f('0x0'));var db=require(_0xdb9f('0x1'))['db'];var logger=require(_0xdb9f('0x2'))(_0xdb9f('0x3'));var config=require(_0xdb9f('0x4'));config['redis']=_[_0xdb9f('0x5')](config['redis'],{'host':_0xdb9f('0x6'),'port':0x18eb});var socket=require(_0xdb9f('0x7'))(new Redis(config[_0xdb9f('0x8')]));require(_0xdb9f('0x9'))[_0xdb9f('0xa')](socket);exports['GetSquareProjects']=function(_0x23bd5a){var _0x90ead8=this;return new Promise(function(_0x491528,_0x210608){return db[_0xdb9f('0xb')][_0xdb9f('0xc')]({'raw':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0xe')]||null:null,'attributes':_0x23bd5a['options']?_0x23bd5a['options'][_0xdb9f('0xf')]||null:null,'limit':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0x10')]||null:null,'include':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')]['include']?_[_0xdb9f('0x11')](_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0x12')],function(_0x1e255e){return{'model':db[_0x1e255e[_0xdb9f('0x13')]],'as':_0x1e255e['as'],'attributes':_0x1e255e[_0xdb9f('0xf')],'include':_0x1e255e[_0xdb9f('0x12')]?_['map'](_0x1e255e['include'],function(_0x436338){return{'model':db[_0x436338['model']],'as':_0x436338['as'],'attributes':_0x436338[_0xdb9f('0xf')],'include':_0x436338[_0xdb9f('0x12')]?_['map'](_0x436338[_0xdb9f('0x12')],function(_0x1167a5){return{'model':db[_0x1167a5[_0xdb9f('0x13')]],'as':_0x1167a5['as'],'attributes':_0x1167a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb9f('0x14')](function(_0x78e4ac){logger[_0xdb9f('0x15')](_0xdb9f('0x16'),_0x23bd5a);logger['debug'](_0xdb9f('0x16'),_0x23bd5a,JSON[_0xdb9f('0x17')](_0x78e4ac));_0x491528(_0x78e4ac);})['catch'](function(_0x25dac9){logger['error'](_0xdb9f('0x16'),_0x25dac9[_0xdb9f('0x18')],_0x23bd5a);_0x210608(_0x90ead8['error'](0x1f4,_0x25dac9[_0xdb9f('0x18')]));});});};exports[_0xdb9f('0x19')]=function(_0x2c37eb){var _0x23dcf6=this;return new Promise(function(_0xfabb56,_0x424659){return db['SquareProject']['find']({'raw':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb['options'][_0xdb9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')]['where']||null:null,'attributes':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')][_0xdb9f('0xf')]||null:null,'include':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')][_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x2c37eb['options']['include'],function(_0x2c0018){return{'model':db[_0x2c0018['model']],'as':_0x2c0018['as'],'attributes':_0x2c0018[_0xdb9f('0xf')],'include':_0x2c0018[_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x2c0018['include'],function(_0x20001c){return{'model':db[_0x20001c[_0xdb9f('0x13')]],'as':_0x20001c['as'],'attributes':_0x20001c[_0xdb9f('0xf')],'include':_0x20001c[_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x20001c[_0xdb9f('0x12')],function(_0x5c3a19){return{'model':db[_0x5c3a19[_0xdb9f('0x13')]],'as':_0x5c3a19['as'],'attributes':_0x5c3a19[_0xdb9f('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x580528){logger[_0xdb9f('0x15')](_0xdb9f('0x19'),_0x2c37eb);logger[_0xdb9f('0x1b')]('ShowSquareProject',_0x2c37eb,JSON[_0xdb9f('0x17')](_0x580528));_0xfabb56(_0x580528);})[_0xdb9f('0x1c')](function(_0x3e4dd2){logger[_0xdb9f('0x1d')](_0xdb9f('0x19'),_0x3e4dd2[_0xdb9f('0x18')],_0x2c37eb);_0x424659(_0x23dcf6[_0xdb9f('0x1d')](0x1f4,_0x3e4dd2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 097b64b..5c372a4 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 _0x4cc6=['removeListener','register','./squareProject.events','save','remove','update','emit'];(function(_0x9935f1,_0xfe5642){var _0x2e88c6=function(_0x497651){while(--_0x497651){_0x9935f1['push'](_0x9935f1['shift']());}};_0x2e88c6(++_0xfe5642);}(_0x4cc6,0xd4));var _0x64cc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4cc6[_0x1969a7];return _0x3d665f;};'use strict';var SquareProjectEvents=require(_0x64cc('0x0'));var events=[_0x64cc('0x1'),_0x64cc('0x2'),_0x64cc('0x3')];function createListener(_0x55f3db,_0x4764df){return function(_0x3e2684){_0x4764df[_0x64cc('0x4')](_0x55f3db,_0x3e2684);};}function removeListener(_0x317e44,_0x4682db){return function(){SquareProjectEvents[_0x64cc('0x5')](_0x317e44,_0x4682db);};}exports[_0x64cc('0x6')]=function(_0x4b12c3){for(var _0x40778d=0x0,_0x309c7f=events['length'];_0x40778d<_0x309c7f;_0x40778d++){var _0x2ffcb2=events[_0x40778d];var _0x57b196=createListener('squareProject:'+_0x2ffcb2,_0x4b12c3);SquareProjectEvents['on'](_0x2ffcb2,_0x57b196);}}; \ No newline at end of file +var _0x3d6b=['remove','update','emit','removeListener','length','squareProject:','./squareProject.events','save'];(function(_0x364cdc,_0x4bdb15){var _0x5ac378=function(_0xa7a23a){while(--_0xa7a23a){_0x364cdc['push'](_0x364cdc['shift']());}};_0x5ac378(++_0x4bdb15);}(_0x3d6b,0x9e));var _0xb3d6=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0x3d6b[_0x2803ab];return _0x3d6e8e;};'use strict';var SquareProjectEvents=require(_0xb3d6('0x0'));var events=[_0xb3d6('0x1'),_0xb3d6('0x2'),_0xb3d6('0x3')];function createListener(_0x5032a4,_0x17a53a){return function(_0x4f6551){_0x17a53a[_0xb3d6('0x4')](_0x5032a4,_0x4f6551);};}function removeListener(_0x1139cd,_0x2afb2f){return function(){SquareProjectEvents[_0xb3d6('0x5')](_0x1139cd,_0x2afb2f);};}exports['register']=function(_0x419178){for(var _0x2f4f42=0x0,_0x5178e4=events[_0xb3d6('0x6')];_0x2f4f42<_0x5178e4;_0x2f4f42++){var _0x25e106=events[_0x2f4f42];var _0x10b4d5=createListener(_0xb3d6('0x7')+_0x25e106,_0x419178);SquareProjectEvents['on'](_0x25e106,_0x10b4d5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d261bc4..5dc044d 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x2823aa,_0x99aa49){var _0x5abe99=function(_0xffae65){while(--_0xffae65){_0x2823aa['push'](_0x2823aa['shift']());}};_0x5abe99(++_0x99aa49);}(_0xe14b,0x93));var _0xbe14=function(_0x5ad742,_0x54cf91){_0x5ad742=_0x5ad742-0x0;var _0x483ee1=_0xe14b[_0x5ad742];return _0x483ee1;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x386ac0,_0x53958c){var _0x43de54=function(_0x3ace49){while(--_0x3ace49){_0x386ac0['push'](_0x386ac0['shift']());}};_0x43de54(++_0x53958c);}(_0x53ec,0x192));var _0xc53e=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x53ec[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ec90824..8419dc4 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 _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xf494,0x1c6));var _0x4f49=function(_0x506d35,_0x4b5aaa){_0x506d35=_0x506d35-0x0;var _0x842728=_0xf494[_0x506d35];return _0x842728;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file +var _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x19e087,_0x18c45a){var _0x5b0033=function(_0x521831){while(--_0x521831){_0x19e087['push'](_0x19e087['shift']());}};_0x5b0033(++_0x18c45a);}(_0x326f,0xd1));var _0xf326=function(_0x524dfb,_0x19c24c){_0x524dfb=_0x524dfb-0x0;var _0x1ebb2e=_0x326f[_0x524dfb];return _0x1ebb2e;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d59e836..8c4915c 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 _0xe55e=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','SquareRecording','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe55e,0x1ad));var _0xee55=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe55e[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee55('0x0'));var zipdir=require(_0xee55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee55('0x2'));var moment=require(_0xee55('0x3'));var BPromise=require(_0xee55('0x4'));var Mustache=require(_0xee55('0x5'));var util=require(_0xee55('0x6'));var path=require(_0xee55('0x7'));var sox=require(_0xee55('0x8'));var csv=require(_0xee55('0x9'));var ejs=require(_0xee55('0xa'));var fs=require('fs');var fs_extra=require(_0xee55('0xb'));var _=require(_0xee55('0xc'));var squel=require(_0xee55('0xd'));var crypto=require(_0xee55('0xe'));var jsforce=require(_0xee55('0xf'));var deskjs=require(_0xee55('0x10'));var toCsv=require(_0xee55('0x9'));var querystring=require(_0xee55('0x11'));var Papa=require(_0xee55('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee55('0x13'));var hardwareService=require(_0xee55('0x14'));var logger=require('../../config/logger')(_0xee55('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee55('0x16'))['db'];function respondWithStatusCode(_0x5788b,_0x1c17cb){_0x1c17cb=_0x1c17cb||0xcc;return function(_0x1fa28b){if(_0x1fa28b){return _0x5788b[_0xee55('0x17')](_0x1c17cb);}return _0x5788b[_0xee55('0x18')](_0x1c17cb)[_0xee55('0x19')]();};}function respondWithResult(_0x22b8fc,_0x1afd01){_0x1afd01=_0x1afd01||0xc8;return function(_0x1084a7){if(_0x1084a7){return _0x22b8fc[_0xee55('0x18')](_0x1afd01)['json'](_0x1084a7);}};}function respondWithFilteredResult(_0x353ed5,_0x3f312d){return function(_0x5402b0){if(_0x5402b0){var _0x2b08a3=typeof _0x3f312d[_0xee55('0x1a')]==='undefined'&&typeof _0x3f312d['limit']===_0xee55('0x1b');var _0xb5f0ab=_0x5402b0['count'];var _0x562aee=_0x2b08a3?0x0:_0x3f312d[_0xee55('0x1a')];var _0xf94b37=_0x2b08a3?_0x5402b0[_0xee55('0x1c')]:_0x3f312d[_0xee55('0x1a')]+_0x3f312d[_0xee55('0x1d')];var _0x56f9b7;if(_0xf94b37>=_0xb5f0ab){_0xf94b37=_0xb5f0ab;_0x56f9b7=0xc8;}else{_0x56f9b7=0xce;}_0x353ed5[_0xee55('0x18')](_0x56f9b7);return _0x353ed5[_0xee55('0x1e')](_0xee55('0x1f'),_0x562aee+'-'+_0xf94b37+'/'+_0xb5f0ab)[_0xee55('0x20')](_0x5402b0);}return null;};}function patchUpdates(_0x526de3){return function(_0x4a8473){try{jsonpatch[_0xee55('0x21')](_0x4a8473,_0x526de3,!![]);}catch(_0x2f9f9d){return BPromise[_0xee55('0x22')](_0x2f9f9d);}return _0x4a8473[_0xee55('0x23')]();};}function saveUpdates(_0x3cf7c0,_0x188c90){return function(_0xd8d6c5){if(_0xd8d6c5){return _0xd8d6c5[_0xee55('0x24')](_0x3cf7c0)[_0xee55('0x25')](function(_0x5b1022){return _0x5b1022;});}return null;};}function removeEntity(_0x48b3a8,_0x23ee95){return function(_0x5ab92d){if(_0x5ab92d){return _0x5ab92d['destroy']()[_0xee55('0x25')](function(){_0x48b3a8['status'](0xcc)[_0xee55('0x19')]();});}};}function handleEntityNotFound(_0x4bcb3b,_0x1e3e0e){return function(_0x35cb69){if(!_0x35cb69){_0x4bcb3b[_0xee55('0x17')](0x194);}return _0x35cb69;};}function handleError(_0x52eeda,_0x110861){_0x110861=_0x110861||0x1f4;return function(_0x4a9f9b){logger['error'](_0x4a9f9b[_0xee55('0x26')]);if(_0x4a9f9b[_0xee55('0x27')]){delete _0x4a9f9b[_0xee55('0x27')];}_0x52eeda[_0xee55('0x18')](_0x110861)[_0xee55('0x28')](_0x4a9f9b);};}exports[_0xee55('0x29')]=function(_0x204d64,_0x3609a5){var _0x34371e={},_0x2108aa={},_0x341adb={'count':0x0,'rows':[]};var _0x21585c=_[_0xee55('0x2a')](db[_0xee55('0x2b')][_0xee55('0x2c')],function(_0xfbf6f8){return{'name':_0xfbf6f8['fieldName'],'type':_0xfbf6f8[_0xee55('0x2d')]['key']};});_0x2108aa[_0xee55('0x2e')]=_['map'](_0x21585c,_0xee55('0x27'));_0x2108aa[_0xee55('0x2f')]=_[_0xee55('0x30')](_0x204d64[_0xee55('0x2f')]);_0x2108aa[_0xee55('0x31')]=_[_0xee55('0x32')](_0x2108aa[_0xee55('0x2e')],_0x2108aa[_0xee55('0x2f')]);_0x34371e[_0xee55('0x33')]=_[_0xee55('0x32')](_0x2108aa[_0xee55('0x2e')],qs['fields'](_0x204d64[_0xee55('0x2f')][_0xee55('0x34')]));_0x34371e[_0xee55('0x33')]=_0x34371e['attributes'][_0xee55('0x35')]?_0x34371e[_0xee55('0x33')]:_0x2108aa[_0xee55('0x2e')];if(!_0x204d64[_0xee55('0x2f')][_0xee55('0x36')]('nolimit')){_0x34371e['limit']=qs[_0xee55('0x1d')](_0x204d64[_0xee55('0x2f')][_0xee55('0x1d')]);_0x34371e[_0xee55('0x1a')]=qs['offset'](_0x204d64[_0xee55('0x2f')][_0xee55('0x1a')]);}_0x34371e[_0xee55('0x37')]=qs[_0xee55('0x38')](_0x204d64[_0xee55('0x2f')]['sort']);_0x34371e[_0xee55('0x39')]=qs['filters'](_[_0xee55('0x3a')](_0x204d64['query'],_0x2108aa[_0xee55('0x31')]),_0x21585c);if(_0x204d64[_0xee55('0x2f')][_0xee55('0x3b')]){_0x34371e['where']=_[_0xee55('0x3c')](_0x34371e[_0xee55('0x39')],{'$or':_['map'](_0x21585c,function(_0x2e97a0){if(_0x2e97a0['type']!==_0xee55('0x3d')){var _0x51af6d={};_0x51af6d[_0x2e97a0[_0xee55('0x27')]]={'$like':'%'+_0x204d64[_0xee55('0x2f')][_0xee55('0x3b')]+'%'};return _0x51af6d;}})});}_0x34371e=_[_0xee55('0x3c')]({},_0x34371e,_0x204d64['options']);var _0xacdbeb={'where':_0x34371e[_0xee55('0x39')]};return db['SquareRecording'][_0xee55('0x1c')](_0xacdbeb)[_0xee55('0x25')](function(_0xa7b021){_0x341adb[_0xee55('0x1c')]=_0xa7b021;if(_0x204d64[_0xee55('0x2f')][_0xee55('0x3e')]){_0x34371e[_0xee55('0x3f')]=[{'all':!![]}];}return db[_0xee55('0x2b')]['findAll'](_0x34371e);})[_0xee55('0x25')](function(_0x21cd45){_0x341adb[_0xee55('0x40')]=_0x21cd45;return _0x341adb;})['then'](respondWithFilteredResult(_0x3609a5,_0x34371e))[_0xee55('0x41')](handleError(_0x3609a5,null));};exports[_0xee55('0x42')]=function(_0x4e59b6,_0x48bd0e){var _0x123b98={'raw':!![],'where':{'id':_0x4e59b6['params']['id']}},_0x250294={};_0x250294[_0xee55('0x2e')]=_['keys'](db[_0xee55('0x2b')][_0xee55('0x2c')]);_0x250294[_0xee55('0x2f')]=_[_0xee55('0x30')](_0x4e59b6[_0xee55('0x2f')]);_0x250294[_0xee55('0x31')]=_[_0xee55('0x32')](_0x250294[_0xee55('0x2e')],_0x250294[_0xee55('0x2f')]);_0x123b98[_0xee55('0x33')]=_[_0xee55('0x32')](_0x250294['model'],qs['fields'](_0x4e59b6[_0xee55('0x2f')][_0xee55('0x34')]));_0x123b98['attributes']=_0x123b98['attributes'][_0xee55('0x35')]?_0x123b98[_0xee55('0x33')]:_0x250294['model'];if(_0x4e59b6[_0xee55('0x2f')][_0xee55('0x3e')]){_0x123b98['include']=[{'all':!![]}];}_0x123b98=_[_0xee55('0x3c')]({},_0x123b98,_0x4e59b6[_0xee55('0x43')]);return db[_0xee55('0x2b')][_0xee55('0x44')](_0x123b98)[_0xee55('0x25')](handleEntityNotFound(_0x48bd0e,null))['then'](respondWithResult(_0x48bd0e,null))[_0xee55('0x41')](handleError(_0x48bd0e,null));};exports[_0xee55('0x45')]=function(_0x4c2492,_0x530f4e){return db[_0xee55('0x2b')]['create'](_0x4c2492[_0xee55('0x46')],{})[_0xee55('0x25')](respondWithResult(_0x530f4e,0xc9))[_0xee55('0x41')](handleError(_0x530f4e,null));};exports[_0xee55('0x24')]=function(_0x4f7e80,_0x89e064){if(_0x4f7e80[_0xee55('0x46')]['id']){delete _0x4f7e80['body']['id'];}return db[_0xee55('0x2b')]['find']({'where':{'id':_0x4f7e80[_0xee55('0x47')]['id']}})[_0xee55('0x25')](handleEntityNotFound(_0x89e064,null))['then'](saveUpdates(_0x4f7e80[_0xee55('0x46')],null))[_0xee55('0x25')](respondWithResult(_0x89e064,null))[_0xee55('0x41')](handleError(_0x89e064,null));};exports[_0xee55('0x48')]=function(_0x554c96,_0x384b33,_0x4f4bd5){var _0x1370d3=require('../../components/encryptor');var _0x3f0601=![];var _0x4667c2={};if(_0x554c96['query'][_0xee55('0x2d')]&&_0x554c96[_0xee55('0x2f')]['type']==='uniqueid'){_0x4667c2[_0xee55('0x49')]=_0x554c96[_0xee55('0x47')]['id'];}else{_0x4667c2['id']=_0x554c96[_0xee55('0x47')]['id'];}return db[_0xee55('0x2b')][_0xee55('0x44')]({'where':_0x4667c2,'attributes':['id',_0xee55('0x4a'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x384b33,null))[_0xee55('0x25')](function(_0x5b6338){if(_0x5b6338){var _0x4949da=_0x5b6338['savePath'];var _0x51bafe=util[_0xee55('0x4b')](_0xee55('0x4c'),_0x4949da);if(fs['existsSync'](_0x51bafe)){_0x3f0601=!![];return _0x1370d3[_0xee55('0x4d')](_0x51bafe,_0x4949da,config[_0xee55('0x4e')][_0xee55('0x4f')])[_0xee55('0x25')](function(){return _0x5b6338;});}return _0x5b6338;}})['then'](function(_0x828f4c){if(_0x828f4c){var _0x2fb973=_0x828f4c['savePath'];if(!fs[_0xee55('0x50')](_0x2fb973)){throw new db[(_0xee55('0x51'))]['ValidationError'](_0xee55('0x52'));}if(_0x828f4c['filename']){return _0x384b33[_0xee55('0x48')](_0x2fb973,_0x828f4c['filename']+path[_0xee55('0x53')](_0x2fb973),function(){if(_0x3f0601){fs['unlink'](_0x2fb973);}});}else{return _0x384b33[_0xee55('0x48')](_0x2fb973,function(_0x9b49c6){if(_0x3f0601){fs[_0xee55('0x54')](_0x2fb973);}});}}})[_0xee55('0x41')](function(_0x2350da){if(_0x2350da[_0xee55('0x55')]===_0xee55('0x52')){_0x384b33['status'](0x194)[_0xee55('0x28')](_0xee55('0x56'));}else{return handleError(_0x384b33,null);}});};exports[_0xee55('0x57')]=function(_0x29e188,_0x38a4f2){return db[_0xee55('0x2b')]['find']({'where':{'id':_0x29e188[_0xee55('0x47')]['id']}})[_0xee55('0x25')](function(_0x13d287){if(_[_0xee55('0x58')](_0x13d287)){throw new ReferenceError(_0xee55('0x59'));}return _0x13d287;})['then'](function(_0x2d39b9){var _0x29abae=_0x2d39b9[_0xee55('0x4a')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x29abae);if(!_[_0xee55('0x58')](_0x2d39b9['savePath'])&&fs[_0xee55('0x50')](_0x29abae)){logger[_0xee55('0x5a')](_0xee55('0x5b')+_0x29abae+_0xee55('0x5c'));fs[_0xee55('0x5d')](_0x29abae);}_0x29abae=_0x29abae+_0xee55('0x5e');if(!_[_0xee55('0x58')](_0x2d39b9[_0xee55('0x4a')])&&fs['existsSync'](_0x29abae)){logger[_0xee55('0x5a')]('File:\x20\x22'+_0x29abae+_0xee55('0x5c'));fs[_0xee55('0x5d')](_0x29abae);}return _0x2d39b9;})[_0xee55('0x25')](function(_0x27be4d){if(!_0x27be4d)throw new InternalError();return _0x27be4d[_0xee55('0x57')]();})['then'](function(){_0x38a4f2[_0xee55('0x18')](0xcc)['end']();})['catch'](handleError(_0x38a4f2,null));}; \ No newline at end of file +var _0xabdb=['sort','where','filter','map','type','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','uniqueid','savePath','filename','%s.cypher','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','isNil','Entity\x20not\x20found','info','existsSync','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','name','index','SquareRecording','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xabdb,0x188));var _0xbabd=function(_0x125813,_0x15dfc7){_0x125813=_0x125813-0x0;var _0x26eda0=_0xabdb[_0x125813];return _0x26eda0;};'use strict';var emlformat=require(_0xbabd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbabd('0x1'));var jsonpatch=require(_0xbabd('0x2'));var rp=require(_0xbabd('0x3'));var moment=require('moment');var BPromise=require(_0xbabd('0x4'));var Mustache=require('mustache');var util=require(_0xbabd('0x5'));var path=require(_0xbabd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbabd('0x7'));var fs=require('fs');var fs_extra=require(_0xbabd('0x8'));var _=require(_0xbabd('0x9'));var squel=require('squel');var crypto=require(_0xbabd('0xa'));var jsforce=require(_0xbabd('0xb'));var deskjs=require(_0xbabd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbabd('0xd'));var Redis=require('ioredis');var authService=require(_0xbabd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbabd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbabd('0x10'))(_0xbabd('0x11'));var utils=require('../../config/utils');var config=require(_0xbabd('0x12'));var licenseUtil=require(_0xbabd('0x13'));var db=require(_0xbabd('0x14'))['db'];function respondWithStatusCode(_0x59645a,_0x2ea1e9){_0x2ea1e9=_0x2ea1e9||0xcc;return function(_0x2b19dd){if(_0x2b19dd){return _0x59645a[_0xbabd('0x15')](_0x2ea1e9);}return _0x59645a[_0xbabd('0x16')](_0x2ea1e9)[_0xbabd('0x17')]();};}function respondWithResult(_0x4ea92a,_0x34e333){_0x34e333=_0x34e333||0xc8;return function(_0x6542cd){if(_0x6542cd){return _0x4ea92a[_0xbabd('0x16')](_0x34e333)[_0xbabd('0x18')](_0x6542cd);}};}function respondWithFilteredResult(_0x432592,_0x92457b){return function(_0x1f1cbf){if(_0x1f1cbf){var _0x2783a6=typeof _0x92457b[_0xbabd('0x19')]===_0xbabd('0x1a')&&typeof _0x92457b[_0xbabd('0x1b')]===_0xbabd('0x1a');var _0x4dad48=_0x1f1cbf['count'];var _0x487df4=_0x2783a6?0x0:_0x92457b[_0xbabd('0x19')];var _0x4f369a=_0x2783a6?_0x1f1cbf['count']:_0x92457b[_0xbabd('0x19')]+_0x92457b['limit'];var _0x4768fe;if(_0x4f369a>=_0x4dad48){_0x4f369a=_0x4dad48;_0x4768fe=0xc8;}else{_0x4768fe=0xce;}_0x432592['status'](_0x4768fe);return _0x432592['set'](_0xbabd('0x1c'),_0x487df4+'-'+_0x4f369a+'/'+_0x4dad48)[_0xbabd('0x18')](_0x1f1cbf);}return null;};}function patchUpdates(_0x5f5ecc){return function(_0x3a62b5){try{jsonpatch['apply'](_0x3a62b5,_0x5f5ecc,!![]);}catch(_0x3d4b19){return BPromise[_0xbabd('0x1d')](_0x3d4b19);}return _0x3a62b5[_0xbabd('0x1e')]();};}function saveUpdates(_0x53bb4d,_0x1f3679){return function(_0x12963a){if(_0x12963a){return _0x12963a[_0xbabd('0x1f')](_0x53bb4d)[_0xbabd('0x20')](function(_0x4cc067){return _0x4cc067;});}return null;};}function removeEntity(_0x357318,_0x32f4c2){return function(_0x5d8790){if(_0x5d8790){return _0x5d8790[_0xbabd('0x21')]()[_0xbabd('0x20')](function(){_0x357318[_0xbabd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252f52,_0x2a767c){return function(_0x3f8208){if(!_0x3f8208){_0x252f52[_0xbabd('0x15')](0x194);}return _0x3f8208;};}function handleError(_0x34cb38,_0x84fba5){_0x84fba5=_0x84fba5||0x1f4;return function(_0x3a1484){logger['error'](_0x3a1484['stack']);if(_0x3a1484[_0xbabd('0x22')]){delete _0x3a1484[_0xbabd('0x22')];}_0x34cb38[_0xbabd('0x16')](_0x84fba5)['send'](_0x3a1484);};}exports[_0xbabd('0x23')]=function(_0x3a4649,_0x155b9d){var _0x29abad={},_0x22169f={},_0x1ef2b6={'count':0x0,'rows':[]};var _0x427568=_['map'](db[_0xbabd('0x24')]['rawAttributes'],function(_0x3c4573){return{'name':_0x3c4573[_0xbabd('0x25')],'type':_0x3c4573['type']['key']};});_0x22169f['model']=_['map'](_0x427568,'name');_0x22169f[_0xbabd('0x26')]=_[_0xbabd('0x27')](_0x3a4649[_0xbabd('0x26')]);_0x22169f[_0xbabd('0x28')]=_[_0xbabd('0x29')](_0x22169f[_0xbabd('0x2a')],_0x22169f[_0xbabd('0x26')]);_0x29abad['attributes']=_[_0xbabd('0x29')](_0x22169f[_0xbabd('0x2a')],qs[_0xbabd('0x2b')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x2b')]));_0x29abad[_0xbabd('0x2c')]=_0x29abad[_0xbabd('0x2c')][_0xbabd('0x2d')]?_0x29abad[_0xbabd('0x2c')]:_0x22169f[_0xbabd('0x2a')];if(!_0x3a4649[_0xbabd('0x26')][_0xbabd('0x2e')]('nolimit')){_0x29abad[_0xbabd('0x1b')]=qs[_0xbabd('0x1b')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x1b')]);_0x29abad[_0xbabd('0x19')]=qs['offset'](_0x3a4649[_0xbabd('0x26')]['offset']);}_0x29abad[_0xbabd('0x2f')]=qs[_0xbabd('0x30')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x30')]);_0x29abad[_0xbabd('0x31')]=qs['filters'](_['pick'](_0x3a4649['query'],_0x22169f[_0xbabd('0x28')]),_0x427568);if(_0x3a4649[_0xbabd('0x26')][_0xbabd('0x32')]){_0x29abad[_0xbabd('0x31')]=_['merge'](_0x29abad['where'],{'$or':_[_0xbabd('0x33')](_0x427568,function(_0x1ff3e1){if(_0x1ff3e1[_0xbabd('0x34')]!=='VIRTUAL'){var _0x5ca893={};_0x5ca893[_0x1ff3e1[_0xbabd('0x22')]]={'$like':'%'+_0x3a4649[_0xbabd('0x26')][_0xbabd('0x32')]+'%'};return _0x5ca893;}})});}_0x29abad=_[_0xbabd('0x35')]({},_0x29abad,_0x3a4649[_0xbabd('0x36')]);var _0x275497={'where':_0x29abad[_0xbabd('0x31')]};return db[_0xbabd('0x24')][_0xbabd('0x37')](_0x275497)[_0xbabd('0x20')](function(_0x13b83d){_0x1ef2b6['count']=_0x13b83d;if(_0x3a4649[_0xbabd('0x26')][_0xbabd('0x38')]){_0x29abad[_0xbabd('0x39')]=[{'all':!![]}];}return db[_0xbabd('0x24')][_0xbabd('0x3a')](_0x29abad);})['then'](function(_0x2d3195){_0x1ef2b6[_0xbabd('0x3b')]=_0x2d3195;return _0x1ef2b6;})[_0xbabd('0x20')](respondWithFilteredResult(_0x155b9d,_0x29abad))[_0xbabd('0x3c')](handleError(_0x155b9d,null));};exports[_0xbabd('0x3d')]=function(_0x1b8a8c,_0x298df8){var _0x5a5641={'raw':!![],'where':{'id':_0x1b8a8c[_0xbabd('0x3e')]['id']}},_0x379153={};_0x379153[_0xbabd('0x2a')]=_[_0xbabd('0x27')](db[_0xbabd('0x24')][_0xbabd('0x3f')]);_0x379153[_0xbabd('0x26')]=_[_0xbabd('0x27')](_0x1b8a8c[_0xbabd('0x26')]);_0x379153[_0xbabd('0x28')]=_[_0xbabd('0x29')](_0x379153[_0xbabd('0x2a')],_0x379153[_0xbabd('0x26')]);_0x5a5641[_0xbabd('0x2c')]=_[_0xbabd('0x29')](_0x379153[_0xbabd('0x2a')],qs[_0xbabd('0x2b')](_0x1b8a8c[_0xbabd('0x26')]['fields']));_0x5a5641['attributes']=_0x5a5641['attributes'][_0xbabd('0x2d')]?_0x5a5641[_0xbabd('0x2c')]:_0x379153[_0xbabd('0x2a')];if(_0x1b8a8c[_0xbabd('0x26')][_0xbabd('0x38')]){_0x5a5641['include']=[{'all':!![]}];}_0x5a5641=_['merge']({},_0x5a5641,_0x1b8a8c[_0xbabd('0x36')]);return db['SquareRecording'][_0xbabd('0x40')](_0x5a5641)[_0xbabd('0x20')](handleEntityNotFound(_0x298df8,null))[_0xbabd('0x20')](respondWithResult(_0x298df8,null))['catch'](handleError(_0x298df8,null));};exports[_0xbabd('0x41')]=function(_0x3af725,_0x432cab){return db[_0xbabd('0x24')][_0xbabd('0x41')](_0x3af725[_0xbabd('0x42')],{})[_0xbabd('0x20')](respondWithResult(_0x432cab,0xc9))[_0xbabd('0x3c')](handleError(_0x432cab,null));};exports[_0xbabd('0x1f')]=function(_0xdf2f34,_0xaae685){if(_0xdf2f34['body']['id']){delete _0xdf2f34['body']['id'];}return db[_0xbabd('0x24')]['find']({'where':{'id':_0xdf2f34[_0xbabd('0x3e')]['id']}})[_0xbabd('0x20')](handleEntityNotFound(_0xaae685,null))[_0xbabd('0x20')](saveUpdates(_0xdf2f34[_0xbabd('0x42')],null))['then'](respondWithResult(_0xaae685,null))['catch'](handleError(_0xaae685,null));};exports[_0xbabd('0x43')]=function(_0x5b0f0a,_0x30779f,_0x2c5204){var _0x2d7093=require('../../components/encryptor');var _0x2c9874=![];var _0x3b5cc9={};if(_0x5b0f0a['query'][_0xbabd('0x34')]&&_0x5b0f0a[_0xbabd('0x26')][_0xbabd('0x34')]===_0xbabd('0x44')){_0x3b5cc9[_0xbabd('0x44')]=_0x5b0f0a[_0xbabd('0x3e')]['id'];}else{_0x3b5cc9['id']=_0x5b0f0a[_0xbabd('0x3e')]['id'];}return db[_0xbabd('0x24')][_0xbabd('0x40')]({'where':_0x3b5cc9,'attributes':['id',_0xbabd('0x45'),_0xbabd('0x46')],'raw':!![]})[_0xbabd('0x20')](handleEntityNotFound(_0x30779f,null))['then'](function(_0x59f400){if(_0x59f400){var _0x2932a1=_0x59f400[_0xbabd('0x45')];var _0x5dfe4d=util['format'](_0xbabd('0x47'),_0x2932a1);if(fs['existsSync'](_0x5dfe4d)){_0x2c9874=!![];return _0x2d7093['decryptFile'](_0x5dfe4d,_0x2932a1,config[_0xbabd('0x48')][_0xbabd('0x49')])[_0xbabd('0x20')](function(){return _0x59f400;});}return _0x59f400;}})[_0xbabd('0x20')](function(_0x569879){if(_0x569879){var _0x409a87=_0x569879[_0xbabd('0x45')];if(!fs['existsSync'](_0x409a87)){throw new db[(_0xbabd('0x4a'))][(_0xbabd('0x4b'))](_0xbabd('0x4c'));}if(_0x569879['filename']){return _0x30779f[_0xbabd('0x43')](_0x409a87,_0x569879[_0xbabd('0x46')]+path[_0xbabd('0x4d')](_0x409a87),function(){if(_0x2c9874){fs[_0xbabd('0x4e')](_0x409a87);}});}else{return _0x30779f['download'](_0x409a87,function(_0x4735f4){if(_0x2c9874){fs[_0xbabd('0x4e')](_0x409a87);}});}}})['catch'](function(_0x54759d){if(_0x54759d[_0xbabd('0x4f')]==='SquareRecording\x20not\x20found'){_0x30779f[_0xbabd('0x16')](0x194)[_0xbabd('0x50')]('Not\x20found');}else{return handleError(_0x30779f,null);}});};exports[_0xbabd('0x21')]=function(_0x5521ec,_0x4a0e5f){return db[_0xbabd('0x24')]['find']({'where':{'id':_0x5521ec[_0xbabd('0x3e')]['id']}})['then'](function(_0xfd2de3){if(_[_0xbabd('0x51')](_0xfd2de3)){throw new ReferenceError(_0xbabd('0x52'));}return _0xfd2de3;})[_0xbabd('0x20')](function(_0x1b59d9){var _0x2bb31d=_0x1b59d9[_0xbabd('0x45')];logger[_0xbabd('0x53')]('cancellazione\x20fisica\x20documento\x20%s',_0x2bb31d);if(!_['isNil'](_0x1b59d9[_0xbabd('0x45')])&&fs[_0xbabd('0x54')](_0x2bb31d)){logger[_0xbabd('0x53')](_0xbabd('0x55')+_0x2bb31d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbabd('0x56')](_0x2bb31d);}_0x2bb31d=_0x2bb31d+_0xbabd('0x57');if(!_['isNil'](_0x1b59d9['savePath'])&&fs[_0xbabd('0x54')](_0x2bb31d)){logger[_0xbabd('0x53')](_0xbabd('0x55')+_0x2bb31d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbabd('0x56')](_0x2bb31d);}return _0x1b59d9;})['then'](function(_0x4c4172){if(!_0x4c4172)throw new InternalError();return _0x4c4172[_0xbabd('0x21')]();})[_0xbabd('0x20')](function(){_0x4a0e5f[_0xbabd('0x16')](0xcc)[_0xbabd('0x17')]();})[_0xbabd('0x3c')](handleError(_0x4a0e5f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3bd0994..50c2c7a 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 _0x975b=['define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x261dfb,_0xaff1a1){var _0x317e5a=function(_0x20c9e4){while(--_0x20c9e4){_0x261dfb['push'](_0x261dfb['shift']());}};_0x317e5a(++_0xaff1a1);}(_0x975b,0x1c9));var _0xb975=function(_0x3dec0f,_0x6075ea){_0x3dec0f=_0x3dec0f-0x0;var _0x4e5a17=_0x975b[_0x3dec0f];return _0x4e5a17;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var logger=require(_0xb975('0x2'))(_0xb975('0x3'));var moment=require(_0xb975('0x4'));var BPromise=require(_0xb975('0x5'));var rp=require(_0xb975('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb975('0x7'));var config=require(_0xb975('0x8'));var attributes=require(_0xb975('0x9'));module[_0xb975('0xa')]=function(_0x599d95,_0x1729fe){return _0x599d95[_0xb975('0xb')]('SquareRecording',attributes,{'tableName':_0xb975('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd9e=['./squareRecording.attributes','define','SquareRecording','square_recordings','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbd9e,0x108));var _0xebd9=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xbd9e[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xebd9('0x0'))('api');var moment=require(_0xebd9('0x1'));var BPromise=require(_0xebd9('0x2'));var rp=require(_0xebd9('0x3'));var fs=require('fs');var path=require(_0xebd9('0x4'));var rimraf=require(_0xebd9('0x5'));var config=require('../../config/environment');var attributes=require(_0xebd9('0x6'));module['exports']=function(_0x3b2ade,_0x17f877){return _0x3b2ade[_0xebd9('0x7')](_0xebd9('0x8'),attributes,{'tableName':_0xebd9('0x9'),'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 48da84e..5b5d0cd 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 _0xfc3e=['SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0xfc3e,0x1cc));var _0xefc3=function(_0x316677,_0xd3c665){_0x316677=_0x316677-0x0;var _0x1121bd=_0xfc3e[_0x316677];return _0x1121bd;};'use strict';var _=require(_0xefc3('0x0'));var util=require(_0xefc3('0x1'));var moment=require(_0xefc3('0x2'));var BPromise=require(_0xefc3('0x3'));var rs=require(_0xefc3('0x4'));var fs=require('fs');var Redis=require(_0xefc3('0x5'));var db=require(_0xefc3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xefc3('0x7'))(_0xefc3('0x8'));var config=require(_0xefc3('0x9'));var jayson=require(_0xefc3('0xa'));var client=jayson[_0xefc3('0xb')][_0xefc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a132,_0x51bb3b,_0x3724d7){return new BPromise(function(_0x3fcc51,_0x1bdc61){return client[_0xefc3('0xd')](_0x1a132,_0x3724d7)[_0xefc3('0xe')](function(_0xdcacc3){logger[_0xefc3('0xf')](_0xefc3('0x10'),_0x51bb3b,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x51bb3b,_0xefc3('0x11'),JSON[_0xefc3('0x12')](_0xdcacc3));if(_0xdcacc3['error']){if(_0xdcacc3[_0xefc3('0x13')][_0xefc3('0x14')]===0x1f4){logger[_0xefc3('0x13')](_0xefc3('0x10'),_0x51bb3b,_0xdcacc3['error']['message']);return _0x1bdc61(_0xdcacc3[_0xefc3('0x13')][_0xefc3('0x15')]);}logger[_0xefc3('0x13')]('SquareRecording,\x20%s,\x20%s',_0x51bb3b,_0xdcacc3['error']['message']);return _0x3fcc51(_0xdcacc3[_0xefc3('0x13')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x51bb3b,_0xefc3('0x11'));_0x3fcc51(_0xdcacc3[_0xefc3('0x16')][_0xefc3('0x15')]);}})['catch'](function(_0x58ddd8){logger[_0xefc3('0x13')](_0xefc3('0x10'),_0x51bb3b,_0x58ddd8);_0x1bdc61(_0x58ddd8);});});}exports[_0xefc3('0x17')]=function(_0x55d7ea){var _0x1c2037=this;return new Promise(function(_0x55a42b,_0x38ab42){return db['SquareRecording'][_0xefc3('0x18')](_0x55d7ea[_0xefc3('0x19')],{'raw':_0x55d7ea['options']?_0x55d7ea[_0xefc3('0x1a')][_0xefc3('0x1b')]===undefined?!![]:![]:!![]})[_0xefc3('0xe')](function(_0x287b9b){logger[_0xefc3('0xf')](_0xefc3('0x17'),_0x55d7ea);logger['debug'](_0xefc3('0x17'),_0x55d7ea,JSON[_0xefc3('0x12')](_0x287b9b));_0x55a42b(_0x287b9b);})['catch'](function(_0x3ba74c){logger[_0xefc3('0x13')](_0xefc3('0x17'),_0x3ba74c['message'],_0x55d7ea);_0x38ab42(_0x1c2037[_0xefc3('0x13')](0x1f4,_0x3ba74c[_0xefc3('0x15')]));});});}; \ No newline at end of file +var _0xdb63=['info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareRecording','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x271bf3,_0x25daa2){var _0x1fcb26=function(_0x24f78e){while(--_0x24f78e){_0x271bf3['push'](_0x271bf3['shift']());}};_0x1fcb26(++_0x25daa2);}(_0xdb63,0x132));var _0x3db6=function(_0x5ac2e1,_0x2fc6e4){_0x5ac2e1=_0x5ac2e1-0x0;var _0xbfde8=_0xdb63[_0x5ac2e1];return _0xbfde8;};'use strict';var _=require(_0x3db6('0x0'));var util=require('util');var moment=require(_0x3db6('0x1'));var BPromise=require('bluebird');var rs=require(_0x3db6('0x2'));var fs=require('fs');var Redis=require(_0x3db6('0x3'));var db=require(_0x3db6('0x4'))['db'];var utils=require(_0x3db6('0x5'));var logger=require(_0x3db6('0x6'))('rpc');var config=require(_0x3db6('0x7'));var jayson=require(_0x3db6('0x8'));var client=jayson[_0x3db6('0x9')][_0x3db6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cf83b,_0x553602,_0x4dd7d5){return new BPromise(function(_0x1e3017,_0x55fdf3){return client[_0x3db6('0xb')](_0x3cf83b,_0x4dd7d5)[_0x3db6('0xc')](function(_0x407e21){logger[_0x3db6('0xd')]('SquareRecording,\x20%s,\x20%s',_0x553602,'request\x20sent');logger[_0x3db6('0xe')](_0x3db6('0xf'),_0x553602,'request\x20sent',JSON[_0x3db6('0x10')](_0x407e21));if(_0x407e21['error']){if(_0x407e21[_0x3db6('0x11')][_0x3db6('0x12')]===0x1f4){logger['error'](_0x3db6('0x13'),_0x553602,_0x407e21['error'][_0x3db6('0x14')]);return _0x55fdf3(_0x407e21[_0x3db6('0x11')][_0x3db6('0x14')]);}logger[_0x3db6('0x11')](_0x3db6('0x13'),_0x553602,_0x407e21['error'][_0x3db6('0x14')]);return _0x1e3017(_0x407e21[_0x3db6('0x11')][_0x3db6('0x14')]);}else{logger[_0x3db6('0xd')](_0x3db6('0x13'),_0x553602,_0x3db6('0x15'));_0x1e3017(_0x407e21[_0x3db6('0x16')][_0x3db6('0x14')]);}})[_0x3db6('0x17')](function(_0x269b4a){logger['error'](_0x3db6('0x13'),_0x553602,_0x269b4a);_0x55fdf3(_0x269b4a);});});}exports[_0x3db6('0x18')]=function(_0x2e37f4){var _0x279464=this;return new Promise(function(_0x298f78,_0x45281c){return db['SquareRecording'][_0x3db6('0x19')](_0x2e37f4[_0x3db6('0x1a')],{'raw':_0x2e37f4['options']?_0x2e37f4[_0x3db6('0x1b')][_0x3db6('0x1c')]===undefined?!![]:![]:!![]})[_0x3db6('0xc')](function(_0x49e963){logger['info'](_0x3db6('0x18'),_0x2e37f4);logger[_0x3db6('0xe')]('CreateSquareRecording',_0x2e37f4,JSON['stringify'](_0x49e963));_0x298f78(_0x49e963);})[_0x3db6('0x17')](function(_0x5e207e){logger[_0x3db6('0x11')](_0x3db6('0x18'),_0x5e207e[_0x3db6('0x14')],_0x2e37f4);_0x45281c(_0x279464['error'](0x1f4,_0x5e207e[_0x3db6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ed10ee2..8c72292 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x24dbad,_0x38302c){var _0x8624ac=function(_0x532198){while(--_0x532198){_0x24dbad['push'](_0x24dbad['shift']());}};_0x8624ac(++_0x38302c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x473de8,_0x5c24f1){var _0x5c24de=function(_0x2aa8b3){while(--_0x2aa8b3){_0x473de8['push'](_0x473de8['shift']());}};_0x5c24de(++_0x5c24f1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b76f6b3..6a2e123 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 _0xc24c=['DATE','exports','STRING'];(function(_0x47a83c,_0xd7b5fc){var _0x121d6b=function(_0xb56d6e){while(--_0xb56d6e){_0x47a83c['push'](_0x47a83c['shift']());}};_0x121d6b(++_0xd7b5fc);}(_0xc24c,0x1ed));var _0xcc24=function(_0x1a4160,_0x442aa4){_0x1a4160=_0x1a4160-0x0;var _0x3300e=_0xc24c[_0x1a4160];return _0x3300e;};'use strict';var Sequelize=require('sequelize');module[_0xcc24('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xcc24('0x1')]},'request':{'type':Sequelize[_0xcc24('0x1')]},'channel':{'type':Sequelize[_0xcc24('0x1')]},'language':{'type':Sequelize[_0xcc24('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xcc24('0x1')]},'version':{'type':Sequelize[_0xcc24('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcc24('0x1')]},'callingpres':{'type':Sequelize[_0xcc24('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xcc24('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcc24('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcc24('0x1')]},'enhanced':{'type':Sequelize[_0xcc24('0x1')]},'accountcode':{'type':Sequelize[_0xcc24('0x1')]},'threadid':{'type':Sequelize[_0xcc24('0x1')]},'project_name':{'type':Sequelize[_0xcc24('0x1')]},'joinAt':{'type':Sequelize[_0xcc24('0x2')]},'leaveAt':{'type':Sequelize[_0xcc24('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x12b7=['BOOLEAN','sequelize','STRING','DATE'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x12b7,0x81));var _0x712b=function(_0x128232,_0x4bdea7){_0x128232=_0x128232-0x0;var _0x1b76b1=_0x12b7[_0x128232];return _0x1b76b1;};'use strict';var Sequelize=require(_0x712b('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x712b('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x712b('0x1')]},'language':{'type':Sequelize[_0x712b('0x1')]},'type':{'type':Sequelize[_0x712b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x712b('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x712b('0x1')]},'callingani2':{'type':Sequelize[_0x712b('0x1')]},'callington':{'type':Sequelize[_0x712b('0x1')]},'callingtns':{'type':Sequelize[_0x712b('0x1')]},'dnid':{'type':Sequelize[_0x712b('0x1')]},'rdnis':{'type':Sequelize[_0x712b('0x1')]},'context':{'type':Sequelize[_0x712b('0x1')]},'extension':{'type':Sequelize[_0x712b('0x1')]},'priority':{'type':Sequelize[_0x712b('0x1')]},'enhanced':{'type':Sequelize[_0x712b('0x1')]},'accountcode':{'type':Sequelize[_0x712b('0x1')]},'threadid':{'type':Sequelize[_0x712b('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x712b('0x2')]},'leaveAt':{'type':Sequelize[_0x712b('0x2')]},'bot':{'type':Sequelize[_0x712b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2c5742a..2840a0d 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 _0xa9fd=['type','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareReport'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa9fd,0x67));var _0xda9f=function(_0x352e87,_0x2d10ab){_0x352e87=_0x352e87-0x0;var _0x32ed18=_0xa9fd[_0x352e87];return _0x32ed18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda9f('0x0'));var zipdir=require(_0xda9f('0x1'));var jsonpatch=require(_0xda9f('0x2'));var rp=require(_0xda9f('0x3'));var moment=require(_0xda9f('0x4'));var BPromise=require(_0xda9f('0x5'));var Mustache=require(_0xda9f('0x6'));var util=require(_0xda9f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xda9f('0x8'));var ejs=require(_0xda9f('0x9'));var fs=require('fs');var fs_extra=require(_0xda9f('0xa'));var _=require(_0xda9f('0xb'));var squel=require(_0xda9f('0xc'));var crypto=require('crypto');var jsforce=require(_0xda9f('0xd'));var deskjs=require(_0xda9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda9f('0xf'));var Papa=require(_0xda9f('0x10'));var Redis=require('ioredis');var authService=require(_0xda9f('0x11'));var qs=require(_0xda9f('0x12'));var as=require(_0xda9f('0x13'));var hardwareService=require(_0xda9f('0x14'));var logger=require('../../config/logger')(_0xda9f('0x15'));var utils=require(_0xda9f('0x16'));var config=require(_0xda9f('0x17'));var licenseUtil=require(_0xda9f('0x18'));var db=require(_0xda9f('0x19'))['db'];function respondWithStatusCode(_0x4e6651,_0xffc005){_0xffc005=_0xffc005||0xcc;return function(_0x1613b8){if(_0x1613b8){return _0x4e6651[_0xda9f('0x1a')](_0xffc005);}return _0x4e6651[_0xda9f('0x1b')](_0xffc005)['end']();};}function respondWithResult(_0x2a2778,_0x59664b){_0x59664b=_0x59664b||0xc8;return function(_0x44fb35){if(_0x44fb35){return _0x2a2778[_0xda9f('0x1b')](_0x59664b)['json'](_0x44fb35);}};}function respondWithFilteredResult(_0x34a44c,_0x56633f){return function(_0x220534){if(_0x220534){var _0x11d342=typeof _0x56633f['offset']==='undefined'&&typeof _0x56633f['limit']===_0xda9f('0x1c');var _0x34e55f=_0x220534[_0xda9f('0x1d')];var _0x3ac442=_0x11d342?0x0:_0x56633f[_0xda9f('0x1e')];var _0x59d3e2=_0x11d342?_0x220534[_0xda9f('0x1d')]:_0x56633f[_0xda9f('0x1e')]+_0x56633f[_0xda9f('0x1f')];var _0x4bc9e7;if(_0x59d3e2>=_0x34e55f){_0x59d3e2=_0x34e55f;_0x4bc9e7=0xc8;}else{_0x4bc9e7=0xce;}_0x34a44c[_0xda9f('0x1b')](_0x4bc9e7);return _0x34a44c[_0xda9f('0x20')]('Content-Range',_0x3ac442+'-'+_0x59d3e2+'/'+_0x34e55f)[_0xda9f('0x21')](_0x220534);}return null;};}function patchUpdates(_0x1ec26b){return function(_0x361279){try{jsonpatch[_0xda9f('0x22')](_0x361279,_0x1ec26b,!![]);}catch(_0x4ea724){return BPromise[_0xda9f('0x23')](_0x4ea724);}return _0x361279[_0xda9f('0x24')]();};}function saveUpdates(_0x37380d,_0x58414f){return function(_0x238645){if(_0x238645){return _0x238645[_0xda9f('0x25')](_0x37380d)['then'](function(_0x3ceacb){return _0x3ceacb;});}return null;};}function removeEntity(_0x4e608d,_0x332481){return function(_0x2a65d0){if(_0x2a65d0){return _0x2a65d0[_0xda9f('0x26')]()[_0xda9f('0x27')](function(){_0x4e608d[_0xda9f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1223c3,_0x4a9a75){return function(_0x4c9d68){if(!_0x4c9d68){_0x1223c3[_0xda9f('0x1a')](0x194);}return _0x4c9d68;};}function handleError(_0x2e2e28,_0x37e2ea){_0x37e2ea=_0x37e2ea||0x1f4;return function(_0x49962c){logger[_0xda9f('0x28')](_0x49962c[_0xda9f('0x29')]);if(_0x49962c[_0xda9f('0x2a')]){delete _0x49962c[_0xda9f('0x2a')];}_0x2e2e28[_0xda9f('0x1b')](_0x37e2ea)[_0xda9f('0x2b')](_0x49962c);};}exports[_0xda9f('0x2c')]=function(_0x24469d,_0x5e9fb0){var _0x2bc564={},_0x46a6bd={},_0x7f6227={'count':0x0,'rows':[]};var _0x3c0f5a=_[_0xda9f('0x2d')](db[_0xda9f('0x2e')]['rawAttributes'],function(_0x5c57b7){return{'name':_0x5c57b7['fieldName'],'type':_0x5c57b7[_0xda9f('0x2f')]['key']};});_0x46a6bd[_0xda9f('0x30')]=_[_0xda9f('0x2d')](_0x3c0f5a,'name');_0x46a6bd['query']=_[_0xda9f('0x31')](_0x24469d['query']);_0x46a6bd['filters']=_[_0xda9f('0x32')](_0x46a6bd[_0xda9f('0x30')],_0x46a6bd['query']);_0x2bc564[_0xda9f('0x33')]=_['intersection'](_0x46a6bd[_0xda9f('0x30')],qs[_0xda9f('0x34')](_0x24469d[_0xda9f('0x35')][_0xda9f('0x34')]));_0x2bc564[_0xda9f('0x33')]=_0x2bc564['attributes'][_0xda9f('0x36')]?_0x2bc564[_0xda9f('0x33')]:_0x46a6bd[_0xda9f('0x30')];if(!_0x24469d[_0xda9f('0x35')][_0xda9f('0x37')]('nolimit')){_0x2bc564[_0xda9f('0x1f')]=qs[_0xda9f('0x1f')](_0x24469d[_0xda9f('0x35')]['limit']);_0x2bc564[_0xda9f('0x1e')]=qs[_0xda9f('0x1e')](_0x24469d['query'][_0xda9f('0x1e')]);}_0x2bc564[_0xda9f('0x38')]=qs[_0xda9f('0x39')](_0x24469d['query']['sort']);_0x2bc564[_0xda9f('0x3a')]=qs['filters'](_[_0xda9f('0x3b')](_0x24469d['query'],_0x46a6bd[_0xda9f('0x3c')]),_0x3c0f5a);if(_0x24469d['query'][_0xda9f('0x3d')]){_0x2bc564['where']=_[_0xda9f('0x3e')](_0x2bc564['where'],{'$or':_[_0xda9f('0x2d')](_0x3c0f5a,function(_0x12a675){if(_0x12a675['type']!==_0xda9f('0x3f')){var _0x39c23d={};_0x39c23d[_0x12a675[_0xda9f('0x2a')]]={'$like':'%'+_0x24469d[_0xda9f('0x35')][_0xda9f('0x3d')]+'%'};return _0x39c23d;}})});}_0x2bc564=_[_0xda9f('0x3e')]({},_0x2bc564,_0x24469d[_0xda9f('0x40')]);var _0x43ea97={'where':_0x2bc564[_0xda9f('0x3a')]};return db[_0xda9f('0x2e')][_0xda9f('0x1d')](_0x43ea97)[_0xda9f('0x27')](function(_0x4f584b){_0x7f6227[_0xda9f('0x1d')]=_0x4f584b;if(_0x24469d[_0xda9f('0x35')][_0xda9f('0x41')]){_0x2bc564[_0xda9f('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0xda9f('0x43')](_0x2bc564);})[_0xda9f('0x27')](function(_0x182c0f){_0x7f6227[_0xda9f('0x44')]=_0x182c0f;return _0x7f6227;})[_0xda9f('0x27')](respondWithFilteredResult(_0x5e9fb0,_0x2bc564))[_0xda9f('0x45')](handleError(_0x5e9fb0,null));};exports['show']=function(_0x363dfa,_0x46f93d){var _0x5f2b5a={'raw':!![],'where':{'id':_0x363dfa['params']['id']}},_0x2f5ae7={};_0x2f5ae7['model']=_[_0xda9f('0x31')](db['SquareReport']['rawAttributes']);_0x2f5ae7[_0xda9f('0x35')]=_[_0xda9f('0x31')](_0x363dfa[_0xda9f('0x35')]);_0x2f5ae7[_0xda9f('0x3c')]=_[_0xda9f('0x32')](_0x2f5ae7[_0xda9f('0x30')],_0x2f5ae7[_0xda9f('0x35')]);_0x5f2b5a[_0xda9f('0x33')]=_[_0xda9f('0x32')](_0x2f5ae7[_0xda9f('0x30')],qs[_0xda9f('0x34')](_0x363dfa[_0xda9f('0x35')][_0xda9f('0x34')]));_0x5f2b5a[_0xda9f('0x33')]=_0x5f2b5a[_0xda9f('0x33')]['length']?_0x5f2b5a['attributes']:_0x2f5ae7[_0xda9f('0x30')];if(_0x363dfa['query'][_0xda9f('0x41')]){_0x5f2b5a[_0xda9f('0x42')]=[{'all':!![]}];}_0x5f2b5a=_['merge']({},_0x5f2b5a,_0x363dfa[_0xda9f('0x40')]);return db['SquareReport']['find'](_0x5f2b5a)['then'](handleEntityNotFound(_0x46f93d,null))[_0xda9f('0x27')](respondWithResult(_0x46f93d,null))[_0xda9f('0x45')](handleError(_0x46f93d,null));};exports['create']=function(_0x2dffe5,_0x282811){return db[_0xda9f('0x2e')][_0xda9f('0x46')](_0x2dffe5[_0xda9f('0x47')],{})['then'](respondWithResult(_0x282811,0xc9))[_0xda9f('0x45')](handleError(_0x282811,null));};exports[_0xda9f('0x25')]=function(_0x2939df,_0x1a433f){if(_0x2939df['body']['id']){delete _0x2939df[_0xda9f('0x47')]['id'];}return db[_0xda9f('0x2e')][_0xda9f('0x48')]({'where':{'id':_0x2939df['params']['id']}})[_0xda9f('0x27')](handleEntityNotFound(_0x1a433f,null))['then'](saveUpdates(_0x2939df[_0xda9f('0x47')],null))['then'](respondWithResult(_0x1a433f,null))[_0xda9f('0x45')](handleError(_0x1a433f,null));};exports['destroy']=function(_0x2842f7,_0x5932ab){return db[_0xda9f('0x2e')]['find']({'where':{'id':_0x2842f7[_0xda9f('0x49')]['id']}})[_0xda9f('0x27')](handleEntityNotFound(_0x5932ab,null))[_0xda9f('0x27')](removeEntity(_0x5932ab,null))[_0xda9f('0x45')](handleError(_0x5932ab,null));};exports[_0xda9f('0x4a')]=function(_0x155c57,_0x3a0154){return db[_0xda9f('0x2e')][_0xda9f('0x4a')]()[_0xda9f('0x27')](respondWithResult(_0x3a0154,null))[_0xda9f('0x45')](handleError(_0x3a0154,null));}; \ No newline at end of file +var _0xea13=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SquareReport','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','type','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xea13,0x195));var _0x3ea1=function(_0x3f875d,_0x214000){_0x3f875d=_0x3f875d-0x0;var _0x37e83d=_0xea13[_0x3f875d];return _0x37e83d;};'use strict';var emlformat=require(_0x3ea1('0x0'));var rimraf=require(_0x3ea1('0x1'));var zipdir=require(_0x3ea1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ea1('0x3'));var BPromise=require(_0x3ea1('0x4'));var Mustache=require(_0x3ea1('0x5'));var util=require('util');var path=require(_0x3ea1('0x6'));var sox=require('sox');var csv=require(_0x3ea1('0x7'));var ejs=require(_0x3ea1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ea1('0x9'));var squel=require('squel');var crypto=require(_0x3ea1('0xa'));var jsforce=require(_0x3ea1('0xb'));var deskjs=require(_0x3ea1('0xc'));var toCsv=require(_0x3ea1('0x7'));var querystring=require(_0x3ea1('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ea1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ea1('0xf'));var hardwareService=require(_0x3ea1('0x10'));var logger=require(_0x3ea1('0x11'))(_0x3ea1('0x12'));var utils=require(_0x3ea1('0x13'));var config=require(_0x3ea1('0x14'));var licenseUtil=require(_0x3ea1('0x15'));var db=require(_0x3ea1('0x16'))['db'];function respondWithStatusCode(_0xfdea85,_0x4532bf){_0x4532bf=_0x4532bf||0xcc;return function(_0xed674e){if(_0xed674e){return _0xfdea85[_0x3ea1('0x17')](_0x4532bf);}return _0xfdea85[_0x3ea1('0x18')](_0x4532bf)[_0x3ea1('0x19')]();};}function respondWithResult(_0x1eaa95,_0x2528c6){_0x2528c6=_0x2528c6||0xc8;return function(_0x2a9748){if(_0x2a9748){return _0x1eaa95[_0x3ea1('0x18')](_0x2528c6)[_0x3ea1('0x1a')](_0x2a9748);}};}function respondWithFilteredResult(_0x59616b,_0x490100){return function(_0x3b4791){if(_0x3b4791){var _0x192618=typeof _0x490100[_0x3ea1('0x1b')]===_0x3ea1('0x1c')&&typeof _0x490100[_0x3ea1('0x1d')]===_0x3ea1('0x1c');var _0x3bec0c=_0x3b4791['count'];var _0x19b59f=_0x192618?0x0:_0x490100['offset'];var _0x7db3d1=_0x192618?_0x3b4791[_0x3ea1('0x1e')]:_0x490100[_0x3ea1('0x1b')]+_0x490100[_0x3ea1('0x1d')];var _0x582300;if(_0x7db3d1>=_0x3bec0c){_0x7db3d1=_0x3bec0c;_0x582300=0xc8;}else{_0x582300=0xce;}_0x59616b['status'](_0x582300);return _0x59616b[_0x3ea1('0x1f')](_0x3ea1('0x20'),_0x19b59f+'-'+_0x7db3d1+'/'+_0x3bec0c)[_0x3ea1('0x1a')](_0x3b4791);}return null;};}function patchUpdates(_0x3420c3){return function(_0x19aff8){try{jsonpatch[_0x3ea1('0x21')](_0x19aff8,_0x3420c3,!![]);}catch(_0x1fa659){return BPromise[_0x3ea1('0x22')](_0x1fa659);}return _0x19aff8['save']();};}function saveUpdates(_0x386b79,_0x3b5753){return function(_0x1718bb){if(_0x1718bb){return _0x1718bb[_0x3ea1('0x23')](_0x386b79)[_0x3ea1('0x24')](function(_0x1a3a3a){return _0x1a3a3a;});}return null;};}function removeEntity(_0x5c30c7,_0x585e97){return function(_0x2e5e07){if(_0x2e5e07){return _0x2e5e07[_0x3ea1('0x25')]()[_0x3ea1('0x24')](function(){_0x5c30c7['status'](0xcc)[_0x3ea1('0x19')]();});}};}function handleEntityNotFound(_0x8e0170,_0x1e8fa7){return function(_0x2fe56f){if(!_0x2fe56f){_0x8e0170[_0x3ea1('0x17')](0x194);}return _0x2fe56f;};}function handleError(_0x4fad1c,_0x14efd9){_0x14efd9=_0x14efd9||0x1f4;return function(_0xa17e05){logger[_0x3ea1('0x26')](_0xa17e05['stack']);if(_0xa17e05[_0x3ea1('0x27')]){delete _0xa17e05['name'];}_0x4fad1c[_0x3ea1('0x18')](_0x14efd9)[_0x3ea1('0x28')](_0xa17e05);};}exports[_0x3ea1('0x29')]=function(_0x377f48,_0x156b0d){var _0x41ca52={},_0x33efe7={},_0x141341={'count':0x0,'rows':[]};var _0x1e6997=_['map'](db[_0x3ea1('0x2a')]['rawAttributes'],function(_0x183fa2){return{'name':_0x183fa2[_0x3ea1('0x2b')],'type':_0x183fa2['type'][_0x3ea1('0x2c')]};});_0x33efe7[_0x3ea1('0x2d')]=_[_0x3ea1('0x2e')](_0x1e6997,'name');_0x33efe7[_0x3ea1('0x2f')]=_[_0x3ea1('0x30')](_0x377f48[_0x3ea1('0x2f')]);_0x33efe7[_0x3ea1('0x31')]=_[_0x3ea1('0x32')](_0x33efe7[_0x3ea1('0x2d')],_0x33efe7['query']);_0x41ca52['attributes']=_[_0x3ea1('0x32')](_0x33efe7['model'],qs[_0x3ea1('0x33')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x33')]));_0x41ca52[_0x3ea1('0x34')]=_0x41ca52['attributes'][_0x3ea1('0x35')]?_0x41ca52[_0x3ea1('0x34')]:_0x33efe7[_0x3ea1('0x2d')];if(!_0x377f48['query'][_0x3ea1('0x36')]('nolimit')){_0x41ca52['limit']=qs[_0x3ea1('0x1d')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x1d')]);_0x41ca52[_0x3ea1('0x1b')]=qs[_0x3ea1('0x1b')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x1b')]);}_0x41ca52['order']=qs[_0x3ea1('0x37')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x37')]);_0x41ca52['where']=qs[_0x3ea1('0x31')](_[_0x3ea1('0x38')](_0x377f48[_0x3ea1('0x2f')],_0x33efe7['filters']),_0x1e6997);if(_0x377f48['query'][_0x3ea1('0x39')]){_0x41ca52[_0x3ea1('0x3a')]=_['merge'](_0x41ca52[_0x3ea1('0x3a')],{'$or':_[_0x3ea1('0x2e')](_0x1e6997,function(_0x53252e){if(_0x53252e[_0x3ea1('0x3b')]!=='VIRTUAL'){var _0x213d44={};_0x213d44[_0x53252e['name']]={'$like':'%'+_0x377f48['query'][_0x3ea1('0x39')]+'%'};return _0x213d44;}})});}_0x41ca52=_[_0x3ea1('0x3c')]({},_0x41ca52,_0x377f48['options']);var _0x478869={'where':_0x41ca52[_0x3ea1('0x3a')]};return db[_0x3ea1('0x2a')]['count'](_0x478869)[_0x3ea1('0x24')](function(_0x371287){_0x141341[_0x3ea1('0x1e')]=_0x371287;if(_0x377f48['query'][_0x3ea1('0x3d')]){_0x41ca52[_0x3ea1('0x3e')]=[{'all':!![]}];}return db[_0x3ea1('0x2a')]['findAll'](_0x41ca52);})[_0x3ea1('0x24')](function(_0x21fa86){_0x141341['rows']=_0x21fa86;return _0x141341;})[_0x3ea1('0x24')](respondWithFilteredResult(_0x156b0d,_0x41ca52))[_0x3ea1('0x3f')](handleError(_0x156b0d,null));};exports[_0x3ea1('0x40')]=function(_0x27cccc,_0x508be7){var _0x7e5b86={'raw':!![],'where':{'id':_0x27cccc[_0x3ea1('0x41')]['id']}},_0x1ec712={};_0x1ec712[_0x3ea1('0x2d')]=_[_0x3ea1('0x30')](db[_0x3ea1('0x2a')][_0x3ea1('0x42')]);_0x1ec712['query']=_[_0x3ea1('0x30')](_0x27cccc[_0x3ea1('0x2f')]);_0x1ec712[_0x3ea1('0x31')]=_['intersection'](_0x1ec712['model'],_0x1ec712[_0x3ea1('0x2f')]);_0x7e5b86[_0x3ea1('0x34')]=_['intersection'](_0x1ec712[_0x3ea1('0x2d')],qs[_0x3ea1('0x33')](_0x27cccc['query']['fields']));_0x7e5b86['attributes']=_0x7e5b86['attributes']['length']?_0x7e5b86[_0x3ea1('0x34')]:_0x1ec712[_0x3ea1('0x2d')];if(_0x27cccc['query'][_0x3ea1('0x3d')]){_0x7e5b86[_0x3ea1('0x3e')]=[{'all':!![]}];}_0x7e5b86=_[_0x3ea1('0x3c')]({},_0x7e5b86,_0x27cccc[_0x3ea1('0x43')]);return db[_0x3ea1('0x2a')][_0x3ea1('0x44')](_0x7e5b86)['then'](handleEntityNotFound(_0x508be7,null))[_0x3ea1('0x24')](respondWithResult(_0x508be7,null))[_0x3ea1('0x3f')](handleError(_0x508be7,null));};exports[_0x3ea1('0x45')]=function(_0x24cecb,_0x195b87){return db[_0x3ea1('0x2a')][_0x3ea1('0x45')](_0x24cecb[_0x3ea1('0x46')],{})[_0x3ea1('0x24')](respondWithResult(_0x195b87,0xc9))['catch'](handleError(_0x195b87,null));};exports[_0x3ea1('0x23')]=function(_0x24c790,_0xbfb57d){if(_0x24c790[_0x3ea1('0x46')]['id']){delete _0x24c790[_0x3ea1('0x46')]['id'];}return db[_0x3ea1('0x2a')][_0x3ea1('0x44')]({'where':{'id':_0x24c790[_0x3ea1('0x41')]['id']}})[_0x3ea1('0x24')](handleEntityNotFound(_0xbfb57d,null))[_0x3ea1('0x24')](saveUpdates(_0x24c790[_0x3ea1('0x46')],null))['then'](respondWithResult(_0xbfb57d,null))[_0x3ea1('0x3f')](handleError(_0xbfb57d,null));};exports[_0x3ea1('0x25')]=function(_0x58b1c2,_0x1b0350){return db[_0x3ea1('0x2a')][_0x3ea1('0x44')]({'where':{'id':_0x58b1c2['params']['id']}})[_0x3ea1('0x24')](handleEntityNotFound(_0x1b0350,null))['then'](removeEntity(_0x1b0350,null))['catch'](handleError(_0x1b0350,null));};exports[_0x3ea1('0x47')]=function(_0x211e1e,_0x457036){return db[_0x3ea1('0x2a')]['describe']()[_0x3ea1('0x24')](respondWithResult(_0x457036,null))[_0x3ea1('0x3f')](handleError(_0x457036,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4f5c8fc..4955d6e 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 _0xfda9=['uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','bluebird','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x20d9f0,_0x453415){var _0x195dda=function(_0x58d8e8){while(--_0x58d8e8){_0x20d9f0['push'](_0x20d9f0['shift']());}};_0x195dda(++_0x453415);}(_0xfda9,0x17d));var _0x9fda=function(_0x58594c,_0x5f05d1){_0x58594c=_0x58594c-0x0;var _0x440377=_0xfda9[_0x58594c];return _0x440377;};'use strict';var _=require(_0x9fda('0x0'));var util=require('util');var logger=require(_0x9fda('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9fda('0x3'));var config=require('../../config/environment');var attributes=require(_0x9fda('0x4'));module[_0x9fda('0x5')]=function(_0x1f6979,_0x15b218){return _0x1f6979[_0x9fda('0x6')](_0x9fda('0x7'),attributes,{'tableName':_0x9fda('0x8'),'paranoid':![],'indexes':[{'name':_0x9fda('0x9'),'fields':[_0x9fda('0xa'),_0x9fda('0xb')]},{'name':_0x9fda('0xc'),'fields':[_0x9fda('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d1c=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','moment','bluebird'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0x6d1c,0xa1));var _0xc6d1=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x6d1c[_0x2d0d9f];return _0x30243d;};'use strict';var _=require(_0xc6d1('0x0'));var util=require('util');var logger=require(_0xc6d1('0x1'))('api');var moment=require(_0xc6d1('0x2'));var BPromise=require(_0xc6d1('0x3'));var rp=require(_0xc6d1('0x4'));var fs=require('fs');var path=require(_0xc6d1('0x5'));var rimraf=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var attributes=require(_0xc6d1('0x8'));module['exports']=function(_0x773409,_0x397213){return _0x773409[_0xc6d1('0x9')](_0xc6d1('0xa'),attributes,{'tableName':_0xc6d1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6d1('0xc'),'fields':['uniqueid',_0xc6d1('0xd')]},{'name':_0xc6d1('0xe'),'fields':[_0xc6d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d87b8db..49f25f2 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 _0x0855=['attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw'];(function(_0x413b4f,_0x2d104a){var _0x5a372f=function(_0x5b697c){while(--_0x5b697c){_0x413b4f['push'](_0x413b4f['shift']());}};_0x5a372f(++_0x2d104a);}(_0x0855,0xf1));var _0x5085=function(_0x35069a,_0x4bcd1b){_0x35069a=_0x35069a-0x0;var _0x5bdba6=_0x0855[_0x35069a];return _0x5bdba6;};'use strict';var _=require(_0x5085('0x0'));var util=require(_0x5085('0x1'));var moment=require('moment');var BPromise=require(_0x5085('0x2'));var rs=require(_0x5085('0x3'));var fs=require('fs');var Redis=require(_0x5085('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5085('0x5'));var logger=require('../../config/logger')(_0x5085('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5085('0x7')][_0x5085('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e2ce0,_0x54dd37,_0x124f4c){return new BPromise(function(_0x77142d,_0x8e12e){return client['request'](_0x2e2ce0,_0x124f4c)[_0x5085('0x9')](function(_0x1177a2){logger['info'](_0x5085('0xa'),_0x54dd37,_0x5085('0xb'));logger[_0x5085('0xc')](_0x5085('0xd'),_0x54dd37,'request\x20sent',JSON[_0x5085('0xe')](_0x1177a2));if(_0x1177a2['error']){if(_0x1177a2[_0x5085('0xf')][_0x5085('0x10')]===0x1f4){logger['error'](_0x5085('0xa'),_0x54dd37,_0x1177a2[_0x5085('0xf')][_0x5085('0x11')]);return _0x8e12e(_0x1177a2[_0x5085('0xf')][_0x5085('0x11')]);}logger[_0x5085('0xf')](_0x5085('0xa'),_0x54dd37,_0x1177a2['error'][_0x5085('0x11')]);return _0x77142d(_0x1177a2['error'][_0x5085('0x11')]);}else{logger[_0x5085('0x12')](_0x5085('0xa'),_0x54dd37,_0x5085('0xb'));_0x77142d(_0x1177a2[_0x5085('0x13')][_0x5085('0x11')]);}})[_0x5085('0x14')](function(_0x4248c2){logger[_0x5085('0xf')](_0x5085('0xa'),_0x54dd37,_0x4248c2);_0x8e12e(_0x4248c2);});});}exports[_0x5085('0x15')]=function(_0x1402c0){var _0x5bd786=this;return new Promise(function(_0x3ba48d,_0x516867){return db[_0x5085('0x16')][_0x5085('0x17')](_0x1402c0[_0x5085('0x18')],{'raw':_0x1402c0[_0x5085('0x19')]?_0x1402c0[_0x5085('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5085('0x9')](function(_0x129efa){logger[_0x5085('0x12')](_0x5085('0x15'),_0x1402c0);logger['debug']('CreateSquareReport',_0x1402c0,JSON[_0x5085('0xe')](_0x129efa));_0x3ba48d(_0x129efa);})['catch'](function(_0x33ad54){logger[_0x5085('0xf')]('CreateSquareReport',_0x33ad54[_0x5085('0x11')],_0x1402c0);_0x516867(_0x5bd786['error'](0x1f4,_0x33ad54[_0x5085('0x11')]));});});};exports[_0x5085('0x1a')]=function(_0x286b1f){var _0x3da0a9=this;return new Promise(function(_0xf0df71,_0x3a294c){return db[_0x5085('0x16')][_0x5085('0x1b')](_0x286b1f['body'],{'raw':_0x286b1f[_0x5085('0x19')]?_0x286b1f[_0x5085('0x19')][_0x5085('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286b1f['options']?_0x286b1f[_0x5085('0x19')]['where']||null:null,'attributes':_0x286b1f[_0x5085('0x19')]?_0x286b1f[_0x5085('0x19')][_0x5085('0x1d')]||null:null,'limit':_0x286b1f[_0x5085('0x19')]?_0x286b1f['options']['limit']||null:null})[_0x5085('0x9')](function(_0x182861){logger[_0x5085('0x12')](_0x5085('0x1a'),_0x286b1f);logger[_0x5085('0xc')]('UpdateSquareReport',_0x286b1f,JSON[_0x5085('0xe')](_0x182861));_0xf0df71(_0x182861);})[_0x5085('0x14')](function(_0x54851b){logger['error'](_0x5085('0x1a'),_0x54851b[_0x5085('0x11')],_0x286b1f);_0x3a294c(_0x3da0a9['error'](0x1f4,_0x54851b[_0x5085('0x11')]));});});}; \ No newline at end of file +var _0xcf0d=['UpdateSquareReport','body','raw','where','attributes','limit','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareReport','options','CreateSquareReport'];(function(_0x4129c9,_0x229ea7){var _0xb1f9cd=function(_0xd69e17){while(--_0xd69e17){_0x4129c9['push'](_0x4129c9['shift']());}};_0xb1f9cd(++_0x229ea7);}(_0xcf0d,0x1d6));var _0xdcf0=function(_0x4e5e92,_0x4e657e){_0x4e5e92=_0x4e5e92-0x0;var _0x486c68=_0xcf0d[_0x4e5e92];return _0x486c68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcf0('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcf0('0x1'))['db'];var utils=require(_0xdcf0('0x2'));var logger=require(_0xdcf0('0x3'))(_0xdcf0('0x4'));var config=require(_0xdcf0('0x5'));var jayson=require(_0xdcf0('0x6'));var client=jayson['client'][_0xdcf0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2915,_0x7b7e98,_0x20c587){return new BPromise(function(_0x3eee9c,_0x13f066){return client[_0xdcf0('0x8')](_0x3f2915,_0x20c587)[_0xdcf0('0x9')](function(_0x2b39c7){logger[_0xdcf0('0xa')](_0xdcf0('0xb'),_0x7b7e98,'request\x20sent');logger[_0xdcf0('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x7b7e98,_0xdcf0('0xd'),JSON[_0xdcf0('0xe')](_0x2b39c7));if(_0x2b39c7[_0xdcf0('0xf')]){if(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x10')]===0x1f4){logger['error'](_0xdcf0('0xb'),_0x7b7e98,_0x2b39c7[_0xdcf0('0xf')]['message']);return _0x13f066(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x11')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x7b7e98,_0x2b39c7[_0xdcf0('0xf')]['message']);return _0x3eee9c(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x11')]);}else{logger[_0xdcf0('0xa')](_0xdcf0('0xb'),_0x7b7e98,_0xdcf0('0xd'));_0x3eee9c(_0x2b39c7[_0xdcf0('0x12')][_0xdcf0('0x11')]);}})[_0xdcf0('0x13')](function(_0x1c5d08){logger['error']('SquareReport,\x20%s,\x20%s',_0x7b7e98,_0x1c5d08);_0x13f066(_0x1c5d08);});});}exports['CreateSquareReport']=function(_0x2c931e){var _0x436ea8=this;return new Promise(function(_0x3a18d0,_0x44cbe6){return db[_0xdcf0('0x14')]['create'](_0x2c931e['body'],{'raw':_0x2c931e[_0xdcf0('0x15')]?_0x2c931e[_0xdcf0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xdcf0('0x9')](function(_0x2953cf){logger[_0xdcf0('0xa')]('CreateSquareReport',_0x2c931e);logger[_0xdcf0('0xc')]('CreateSquareReport',_0x2c931e,JSON[_0xdcf0('0xe')](_0x2953cf));_0x3a18d0(_0x2953cf);})[_0xdcf0('0x13')](function(_0x2e9bb7){logger[_0xdcf0('0xf')](_0xdcf0('0x16'),_0x2e9bb7['message'],_0x2c931e);_0x44cbe6(_0x436ea8['error'](0x1f4,_0x2e9bb7[_0xdcf0('0x11')]));});});};exports[_0xdcf0('0x17')]=function(_0x2a96ca){var _0x4e76a2=this;return new Promise(function(_0x3cec5c,_0x5117ad){return db['SquareReport']['update'](_0x2a96ca[_0xdcf0('0x18')],{'raw':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca[_0xdcf0('0x15')][_0xdcf0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca[_0xdcf0('0x15')][_0xdcf0('0x1a')]||null:null,'attributes':_0x2a96ca['options']?_0x2a96ca['options'][_0xdcf0('0x1b')]||null:null,'limit':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca['options'][_0xdcf0('0x1c')]||null:null})[_0xdcf0('0x9')](function(_0x4f22d8){logger[_0xdcf0('0xa')]('UpdateSquareReport',_0x2a96ca);logger['debug'](_0xdcf0('0x17'),_0x2a96ca,JSON[_0xdcf0('0xe')](_0x4f22d8));_0x3cec5c(_0x4f22d8);})[_0xdcf0('0x13')](function(_0x1f6f07){logger['error']('UpdateSquareReport',_0x1f6f07[_0xdcf0('0x11')],_0x2a96ca);_0x5117ad(_0x4e76a2[_0xdcf0('0xf')](0x1f4,_0x1f6f07[_0xdcf0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0263bc3..4cc5943 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 _0x7805=['put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','/:id','post','isAuthenticated'];(function(_0x1a6a25,_0x2394f6){var _0x592ccb=function(_0x4f6994){while(--_0x4f6994){_0x1a6a25['push'](_0x1a6a25['shift']());}};_0x592ccb(++_0x2394f6);}(_0x7805,0x124));var _0x5780=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7805[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x5780('0x0'));var util=require(_0x5780('0x1'));var path=require('path');var timeout=require(_0x5780('0x2'));var express=require(_0x5780('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5780('0x4'));var interaction=require(_0x5780('0x5'));var config=require(_0x5780('0x6'));var controller=require(_0x5780('0x7'));router[_0x5780('0x8')]('/',auth['isAuthenticated'](),controller[_0x5780('0x9')]);router['get'](_0x5780('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5780('0x8')](_0x5780('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5780('0xc')]('/',auth[_0x5780('0xd')](),controller['create']);router[_0x5780('0xe')](_0x5780('0xb'),auth[_0x5780('0xd')](),controller['update']);router[_0x5780('0xf')]('/:id',auth[_0x5780('0xd')](),controller[_0x5780('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb285=['express','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3aec4a,_0x48fe63){var _0x879bfa=function(_0x1e30bc){while(--_0x1e30bc){_0x3aec4a['push'](_0x3aec4a['shift']());}};_0x879bfa(++_0x48fe63);}(_0xb285,0x19e));var _0x5b28=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xb285[_0x967959];return _0x5c4489;};'use strict';var multer=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var path=require(_0x5b28('0x2'));var timeout=require(_0x5b28('0x3'));var express=require(_0x5b28('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b28('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b28('0x6'));var controller=require(_0x5b28('0x7'));router[_0x5b28('0x8')]('/',auth['isAuthenticated'](),controller[_0x5b28('0x9')]);router['get'](_0x5b28('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5b28('0x8')](_0x5b28('0xb'),auth['isAuthenticated'](),controller[_0x5b28('0xc')]);router[_0x5b28('0xd')]('/',auth[_0x5b28('0xe')](),controller[_0x5b28('0xf')]);router['put']('/:id',auth[_0x5b28('0xe')](),controller[_0x5b28('0x10')]);router[_0x5b28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5b28('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f037a29..65dd63b 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 _0xce63=['STRING','TEXT'];(function(_0x332fc5,_0x28b7dd){var _0x3e6352=function(_0x484dac){while(--_0x484dac){_0x332fc5['push'](_0x332fc5['shift']());}};_0x3e6352(++_0x28b7dd);}(_0xce63,0xf0));var _0x3ce6=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xce63[_0x3cc05d];return _0x28b736;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3ce6('0x0')]},'node':{'type':Sequelize[_0x3ce6('0x0')]},'application':{'type':Sequelize[_0x3ce6('0x0')]},'data':{'type':Sequelize[_0x3ce6('0x1')]},'project_name':{'type':Sequelize[_0x3ce6('0x0')]},'callerid':{'type':Sequelize[_0x3ce6('0x0')]}}; \ No newline at end of file +var _0x8152=['TEXT','sequelize','exports','STRING'];(function(_0x3fe5b1,_0x1b9732){var _0x2cc1cf=function(_0x32b299){while(--_0x32b299){_0x3fe5b1['push'](_0x3fe5b1['shift']());}};_0x2cc1cf(++_0x1b9732);}(_0x8152,0x81));var _0x2815=function(_0x358d7c,_0x433fc6){_0x358d7c=_0x358d7c-0x0;var _0x3e54e4=_0x8152[_0x358d7c];return _0x3e54e4;};'use strict';var Sequelize=require(_0x2815('0x0'));module[_0x2815('0x1')]={'uniqueid':{'type':Sequelize[_0x2815('0x2')]},'node':{'type':Sequelize[_0x2815('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2815('0x3')]},'project_name':{'type':Sequelize[_0x2815('0x2')]},'callerid':{'type':Sequelize[_0x2815('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 11503bb..7799b4f 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 _0x85ac=['rows','show','params','find','catch','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x2f1f93,_0x55b2b7){var _0x3b2e8e=function(_0x4c5766){while(--_0x4c5766){_0x2f1f93['push'](_0x2f1f93['shift']());}};_0x3b2e8e(++_0x55b2b7);}(_0x85ac,0x9c));var _0xc85a=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x85ac[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc85a('0x0'));var zipdir=require(_0xc85a('0x1'));var jsonpatch=require(_0xc85a('0x2'));var rp=require(_0xc85a('0x3'));var moment=require(_0xc85a('0x4'));var BPromise=require(_0xc85a('0x5'));var Mustache=require('mustache');var util=require(_0xc85a('0x6'));var path=require(_0xc85a('0x7'));var sox=require('sox');var csv=require(_0xc85a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85a('0x9'));var _=require('lodash');var squel=require(_0xc85a('0xa'));var crypto=require(_0xc85a('0xb'));var jsforce=require(_0xc85a('0xc'));var deskjs=require(_0xc85a('0xd'));var toCsv=require(_0xc85a('0x8'));var querystring=require('querystring');var Papa=require(_0xc85a('0xe'));var Redis=require('ioredis');var authService=require(_0xc85a('0xf'));var qs=require(_0xc85a('0x10'));var as=require(_0xc85a('0x11'));var hardwareService=require(_0xc85a('0x12'));var logger=require(_0xc85a('0x13'))(_0xc85a('0x14'));var utils=require(_0xc85a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc85a('0x16'));var db=require(_0xc85a('0x17'))['db'];function respondWithStatusCode(_0xa77062,_0x1f7025){_0x1f7025=_0x1f7025||0xcc;return function(_0x4d748d){if(_0x4d748d){return _0xa77062[_0xc85a('0x18')](_0x1f7025);}return _0xa77062['status'](_0x1f7025)[_0xc85a('0x19')]();};}function respondWithResult(_0x53f310,_0x32c601){_0x32c601=_0x32c601||0xc8;return function(_0x516963){if(_0x516963){return _0x53f310[_0xc85a('0x1a')](_0x32c601)[_0xc85a('0x1b')](_0x516963);}};}function respondWithFilteredResult(_0x59cc87,_0x70d33c){return function(_0x2be340){if(_0x2be340){var _0x51401e=typeof _0x70d33c['offset']===_0xc85a('0x1c')&&typeof _0x70d33c[_0xc85a('0x1d')]===_0xc85a('0x1c');var _0x316988=_0x2be340[_0xc85a('0x1e')];var _0x467fd4=_0x51401e?0x0:_0x70d33c[_0xc85a('0x1f')];var _0x122c4c=_0x51401e?_0x2be340[_0xc85a('0x1e')]:_0x70d33c[_0xc85a('0x1f')]+_0x70d33c['limit'];var _0x4f4248;if(_0x122c4c>=_0x316988){_0x122c4c=_0x316988;_0x4f4248=0xc8;}else{_0x4f4248=0xce;}_0x59cc87[_0xc85a('0x1a')](_0x4f4248);return _0x59cc87[_0xc85a('0x20')](_0xc85a('0x21'),_0x467fd4+'-'+_0x122c4c+'/'+_0x316988)['json'](_0x2be340);}return null;};}function patchUpdates(_0x97fbd9){return function(_0x354b3d){try{jsonpatch[_0xc85a('0x22')](_0x354b3d,_0x97fbd9,!![]);}catch(_0x2d1f6b){return BPromise[_0xc85a('0x23')](_0x2d1f6b);}return _0x354b3d[_0xc85a('0x24')]();};}function saveUpdates(_0x24a9c3,_0x294590){return function(_0x3eb443){if(_0x3eb443){return _0x3eb443[_0xc85a('0x25')](_0x24a9c3)[_0xc85a('0x26')](function(_0x4251b0){return _0x4251b0;});}return null;};}function removeEntity(_0x1e9ec8,_0x4e71da){return function(_0x33c091){if(_0x33c091){return _0x33c091['destroy']()['then'](function(){_0x1e9ec8[_0xc85a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c0cd6,_0xcdda84){return function(_0x331030){if(!_0x331030){_0x3c0cd6[_0xc85a('0x18')](0x194);}return _0x331030;};}function handleError(_0xe3ea41,_0x5dbeaf){_0x5dbeaf=_0x5dbeaf||0x1f4;return function(_0x235319){logger['error'](_0x235319[_0xc85a('0x27')]);if(_0x235319[_0xc85a('0x28')]){delete _0x235319[_0xc85a('0x28')];}_0xe3ea41[_0xc85a('0x1a')](_0x5dbeaf)[_0xc85a('0x29')](_0x235319);};}exports[_0xc85a('0x2a')]=function(_0x2588f0,_0x56f248){var _0x3fc8e3={},_0x3feefb={},_0x489eea={'count':0x0,'rows':[]};var _0xf9f488=_[_0xc85a('0x2b')](db[_0xc85a('0x2c')][_0xc85a('0x2d')],function(_0x2fd96e){return{'name':_0x2fd96e[_0xc85a('0x2e')],'type':_0x2fd96e[_0xc85a('0x2f')][_0xc85a('0x30')]};});_0x3feefb['model']=_[_0xc85a('0x2b')](_0xf9f488,_0xc85a('0x28'));_0x3feefb[_0xc85a('0x31')]=_[_0xc85a('0x32')](_0x2588f0['query']);_0x3feefb[_0xc85a('0x33')]=_[_0xc85a('0x34')](_0x3feefb[_0xc85a('0x35')],_0x3feefb[_0xc85a('0x31')]);_0x3fc8e3[_0xc85a('0x36')]=_[_0xc85a('0x34')](_0x3feefb['model'],qs[_0xc85a('0x37')](_0x2588f0['query'][_0xc85a('0x37')]));_0x3fc8e3[_0xc85a('0x36')]=_0x3fc8e3[_0xc85a('0x36')][_0xc85a('0x38')]?_0x3fc8e3[_0xc85a('0x36')]:_0x3feefb[_0xc85a('0x35')];if(!_0x2588f0[_0xc85a('0x31')][_0xc85a('0x39')]('nolimit')){_0x3fc8e3[_0xc85a('0x1d')]=qs[_0xc85a('0x1d')](_0x2588f0[_0xc85a('0x31')]['limit']);_0x3fc8e3[_0xc85a('0x1f')]=qs['offset'](_0x2588f0['query'][_0xc85a('0x1f')]);}_0x3fc8e3[_0xc85a('0x3a')]=qs['sort'](_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3b')]);_0x3fc8e3[_0xc85a('0x3c')]=qs['filters'](_['pick'](_0x2588f0['query'],_0x3feefb[_0xc85a('0x33')]),_0xf9f488);if(_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3d')]){_0x3fc8e3[_0xc85a('0x3c')]=_[_0xc85a('0x3e')](_0x3fc8e3[_0xc85a('0x3c')],{'$or':_['map'](_0xf9f488,function(_0x110b84){if(_0x110b84[_0xc85a('0x2f')]!=='VIRTUAL'){var _0x43e1cf={};_0x43e1cf[_0x110b84[_0xc85a('0x28')]]={'$like':'%'+_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3d')]+'%'};return _0x43e1cf;}})});}_0x3fc8e3=_[_0xc85a('0x3e')]({},_0x3fc8e3,_0x2588f0[_0xc85a('0x3f')]);var _0x4896ba={'where':_0x3fc8e3[_0xc85a('0x3c')]};return db['SquareDetailsReport'][_0xc85a('0x1e')](_0x4896ba)[_0xc85a('0x26')](function(_0xd59ed){_0x489eea[_0xc85a('0x1e')]=_0xd59ed;if(_0x2588f0[_0xc85a('0x31')][_0xc85a('0x40')]){_0x3fc8e3[_0xc85a('0x41')]=[{'all':!![]}];}return db[_0xc85a('0x2c')]['findAll'](_0x3fc8e3);})[_0xc85a('0x26')](function(_0xf5cc32){_0x489eea[_0xc85a('0x42')]=_0xf5cc32;return _0x489eea;})['then'](respondWithFilteredResult(_0x56f248,_0x3fc8e3))['catch'](handleError(_0x56f248,null));};exports[_0xc85a('0x43')]=function(_0x311054,_0x4c9323){var _0x6861de={'raw':!![],'where':{'id':_0x311054[_0xc85a('0x44')]['id']}},_0x538aa0={};_0x538aa0['model']=_[_0xc85a('0x32')](db['SquareDetailsReport'][_0xc85a('0x2d')]);_0x538aa0[_0xc85a('0x31')]=_[_0xc85a('0x32')](_0x311054[_0xc85a('0x31')]);_0x538aa0['filters']=_['intersection'](_0x538aa0[_0xc85a('0x35')],_0x538aa0['query']);_0x6861de['attributes']=_['intersection'](_0x538aa0[_0xc85a('0x35')],qs[_0xc85a('0x37')](_0x311054[_0xc85a('0x31')]['fields']));_0x6861de[_0xc85a('0x36')]=_0x6861de[_0xc85a('0x36')][_0xc85a('0x38')]?_0x6861de[_0xc85a('0x36')]:_0x538aa0[_0xc85a('0x35')];if(_0x311054['query'][_0xc85a('0x40')]){_0x6861de[_0xc85a('0x41')]=[{'all':!![]}];}_0x6861de=_['merge']({},_0x6861de,_0x311054[_0xc85a('0x3f')]);return db[_0xc85a('0x2c')][_0xc85a('0x45')](_0x6861de)['then'](handleEntityNotFound(_0x4c9323,null))[_0xc85a('0x26')](respondWithResult(_0x4c9323,null))[_0xc85a('0x46')](handleError(_0x4c9323,null));};exports['create']=function(_0x2bad2e,_0x369172){return db['SquareDetailsReport']['create'](_0x2bad2e[_0xc85a('0x47')],{})[_0xc85a('0x26')](respondWithResult(_0x369172,0xc9))['catch'](handleError(_0x369172,null));};exports[_0xc85a('0x25')]=function(_0x29e8ee,_0x2ac023){if(_0x29e8ee[_0xc85a('0x47')]['id']){delete _0x29e8ee[_0xc85a('0x47')]['id'];}return db[_0xc85a('0x2c')][_0xc85a('0x45')]({'where':{'id':_0x29e8ee[_0xc85a('0x44')]['id']}})[_0xc85a('0x26')](handleEntityNotFound(_0x2ac023,null))[_0xc85a('0x26')](saveUpdates(_0x29e8ee[_0xc85a('0x47')],null))['then'](respondWithResult(_0x2ac023,null))[_0xc85a('0x46')](handleError(_0x2ac023,null));};exports[_0xc85a('0x48')]=function(_0x46be18,_0x2372f3){return db['SquareDetailsReport'][_0xc85a('0x45')]({'where':{'id':_0x46be18[_0xc85a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2372f3,null))[_0xc85a('0x26')](removeEntity(_0x2372f3,null))[_0xc85a('0x46')](handleError(_0x2372f3,null));};exports[_0xc85a('0x49')]=function(_0x1ec7f5,_0x5c027f){return db[_0xc85a('0x2c')][_0xc85a('0x49')]()[_0xc85a('0x26')](respondWithResult(_0x5c027f,null))[_0xc85a('0x46')](handleError(_0x5c027f,null));}; \ No newline at end of file +var _0xe404=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','params','includeAll','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','send','index','SquareDetailsReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x586f2b,_0x331fc0){var _0x29927f=function(_0x4cc557){while(--_0x4cc557){_0x586f2b['push'](_0x586f2b['shift']());}};_0x29927f(++_0x331fc0);}(_0xe404,0x144));var _0x4e40=function(_0x2fa079,_0x4e406a){_0x2fa079=_0x2fa079-0x0;var _0x8bf6ca=_0xe404[_0x2fa079];return _0x8bf6ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e40('0x0'));var zipdir=require(_0x4e40('0x1'));var jsonpatch=require(_0x4e40('0x2'));var rp=require(_0x4e40('0x3'));var moment=require(_0x4e40('0x4'));var BPromise=require(_0x4e40('0x5'));var Mustache=require(_0x4e40('0x6'));var util=require('util');var path=require(_0x4e40('0x7'));var sox=require(_0x4e40('0x8'));var csv=require(_0x4e40('0x9'));var ejs=require(_0x4e40('0xa'));var fs=require('fs');var fs_extra=require(_0x4e40('0xb'));var _=require(_0x4e40('0xc'));var squel=require(_0x4e40('0xd'));var crypto=require(_0x4e40('0xe'));var jsforce=require(_0x4e40('0xf'));var deskjs=require(_0x4e40('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e40('0x11'));var Redis=require(_0x4e40('0x12'));var authService=require(_0x4e40('0x13'));var qs=require(_0x4e40('0x14'));var as=require(_0x4e40('0x15'));var hardwareService=require(_0x4e40('0x16'));var logger=require(_0x4e40('0x17'))('api');var utils=require(_0x4e40('0x18'));var config=require(_0x4e40('0x19'));var licenseUtil=require(_0x4e40('0x1a'));var db=require(_0x4e40('0x1b'))['db'];function respondWithStatusCode(_0x433ccc,_0x51da10){_0x51da10=_0x51da10||0xcc;return function(_0x34e3c6){if(_0x34e3c6){return _0x433ccc[_0x4e40('0x1c')](_0x51da10);}return _0x433ccc['status'](_0x51da10)[_0x4e40('0x1d')]();};}function respondWithResult(_0x588552,_0x8b95e2){_0x8b95e2=_0x8b95e2||0xc8;return function(_0xe7de05){if(_0xe7de05){return _0x588552[_0x4e40('0x1e')](_0x8b95e2)[_0x4e40('0x1f')](_0xe7de05);}};}function respondWithFilteredResult(_0x54b8b2,_0x5d2318){return function(_0x4fec5d){if(_0x4fec5d){var _0x260619=typeof _0x5d2318[_0x4e40('0x20')]===_0x4e40('0x21')&&typeof _0x5d2318[_0x4e40('0x22')]==='undefined';var _0x50e936=_0x4fec5d['count'];var _0x231937=_0x260619?0x0:_0x5d2318[_0x4e40('0x20')];var _0x503270=_0x260619?_0x4fec5d['count']:_0x5d2318[_0x4e40('0x20')]+_0x5d2318[_0x4e40('0x22')];var _0x58d72d;if(_0x503270>=_0x50e936){_0x503270=_0x50e936;_0x58d72d=0xc8;}else{_0x58d72d=0xce;}_0x54b8b2[_0x4e40('0x1e')](_0x58d72d);return _0x54b8b2[_0x4e40('0x23')]('Content-Range',_0x231937+'-'+_0x503270+'/'+_0x50e936)[_0x4e40('0x1f')](_0x4fec5d);}return null;};}function patchUpdates(_0x5f56b6){return function(_0x4c0908){try{jsonpatch[_0x4e40('0x24')](_0x4c0908,_0x5f56b6,!![]);}catch(_0xa667fd){return BPromise[_0x4e40('0x25')](_0xa667fd);}return _0x4c0908[_0x4e40('0x26')]();};}function saveUpdates(_0x1893c1,_0x556f7e){return function(_0x3392d9){if(_0x3392d9){return _0x3392d9[_0x4e40('0x27')](_0x1893c1)[_0x4e40('0x28')](function(_0x350254){return _0x350254;});}return null;};}function removeEntity(_0xe84bde,_0x439ce7){return function(_0x3c1200){if(_0x3c1200){return _0x3c1200['destroy']()[_0x4e40('0x28')](function(){_0xe84bde[_0x4e40('0x1e')](0xcc)[_0x4e40('0x1d')]();});}};}function handleEntityNotFound(_0x53a6b6,_0x254516){return function(_0x4e4419){if(!_0x4e4419){_0x53a6b6[_0x4e40('0x1c')](0x194);}return _0x4e4419;};}function handleError(_0x5634ac,_0x25815e){_0x25815e=_0x25815e||0x1f4;return function(_0xf25e66){logger[_0x4e40('0x29')](_0xf25e66['stack']);if(_0xf25e66[_0x4e40('0x2a')]){delete _0xf25e66['name'];}_0x5634ac['status'](_0x25815e)[_0x4e40('0x2b')](_0xf25e66);};}exports[_0x4e40('0x2c')]=function(_0x353fd5,_0x5551db){var _0x4e8c49={},_0x107daa={},_0x4569fc={'count':0x0,'rows':[]};var _0x1c4af7=_['map'](db[_0x4e40('0x2d')][_0x4e40('0x2e')],function(_0x341321){return{'name':_0x341321['fieldName'],'type':_0x341321['type'][_0x4e40('0x2f')]};});_0x107daa[_0x4e40('0x30')]=_[_0x4e40('0x31')](_0x1c4af7,_0x4e40('0x2a'));_0x107daa[_0x4e40('0x32')]=_[_0x4e40('0x33')](_0x353fd5[_0x4e40('0x32')]);_0x107daa[_0x4e40('0x34')]=_[_0x4e40('0x35')](_0x107daa['model'],_0x107daa[_0x4e40('0x32')]);_0x4e8c49[_0x4e40('0x36')]=_[_0x4e40('0x35')](_0x107daa['model'],qs[_0x4e40('0x37')](_0x353fd5['query'][_0x4e40('0x37')]));_0x4e8c49[_0x4e40('0x36')]=_0x4e8c49[_0x4e40('0x36')][_0x4e40('0x38')]?_0x4e8c49[_0x4e40('0x36')]:_0x107daa[_0x4e40('0x30')];if(!_0x353fd5[_0x4e40('0x32')][_0x4e40('0x39')](_0x4e40('0x3a'))){_0x4e8c49[_0x4e40('0x22')]=qs[_0x4e40('0x22')](_0x353fd5['query'][_0x4e40('0x22')]);_0x4e8c49['offset']=qs[_0x4e40('0x20')](_0x353fd5[_0x4e40('0x32')][_0x4e40('0x20')]);}_0x4e8c49['order']=qs[_0x4e40('0x3b')](_0x353fd5[_0x4e40('0x32')][_0x4e40('0x3b')]);_0x4e8c49[_0x4e40('0x3c')]=qs['filters'](_[_0x4e40('0x3d')](_0x353fd5[_0x4e40('0x32')],_0x107daa[_0x4e40('0x34')]),_0x1c4af7);if(_0x353fd5[_0x4e40('0x32')]['filter']){_0x4e8c49['where']=_[_0x4e40('0x3e')](_0x4e8c49[_0x4e40('0x3c')],{'$or':_[_0x4e40('0x31')](_0x1c4af7,function(_0x5cb0db){if(_0x5cb0db['type']!==_0x4e40('0x3f')){var _0x542445={};_0x542445[_0x5cb0db[_0x4e40('0x2a')]]={'$like':'%'+_0x353fd5[_0x4e40('0x32')][_0x4e40('0x40')]+'%'};return _0x542445;}})});}_0x4e8c49=_[_0x4e40('0x3e')]({},_0x4e8c49,_0x353fd5[_0x4e40('0x41')]);var _0x3db387={'where':_0x4e8c49[_0x4e40('0x3c')]};return db[_0x4e40('0x2d')]['count'](_0x3db387)[_0x4e40('0x28')](function(_0x5eea6e){_0x4569fc[_0x4e40('0x42')]=_0x5eea6e;if(_0x353fd5[_0x4e40('0x32')]['includeAll']){_0x4e8c49['include']=[{'all':!![]}];}return db[_0x4e40('0x2d')][_0x4e40('0x43')](_0x4e8c49);})[_0x4e40('0x28')](function(_0x31c188){_0x4569fc['rows']=_0x31c188;return _0x4569fc;})[_0x4e40('0x28')](respondWithFilteredResult(_0x5551db,_0x4e8c49))['catch'](handleError(_0x5551db,null));};exports['show']=function(_0x116521,_0x128de8){var _0x734034={'raw':!![],'where':{'id':_0x116521[_0x4e40('0x44')]['id']}},_0x54ffed={};_0x54ffed[_0x4e40('0x30')]=_[_0x4e40('0x33')](db[_0x4e40('0x2d')]['rawAttributes']);_0x54ffed[_0x4e40('0x32')]=_[_0x4e40('0x33')](_0x116521['query']);_0x54ffed[_0x4e40('0x34')]=_[_0x4e40('0x35')](_0x54ffed[_0x4e40('0x30')],_0x54ffed['query']);_0x734034[_0x4e40('0x36')]=_[_0x4e40('0x35')](_0x54ffed['model'],qs['fields'](_0x116521[_0x4e40('0x32')]['fields']));_0x734034[_0x4e40('0x36')]=_0x734034[_0x4e40('0x36')][_0x4e40('0x38')]?_0x734034[_0x4e40('0x36')]:_0x54ffed['model'];if(_0x116521[_0x4e40('0x32')][_0x4e40('0x45')]){_0x734034[_0x4e40('0x46')]=[{'all':!![]}];}_0x734034=_[_0x4e40('0x3e')]({},_0x734034,_0x116521[_0x4e40('0x41')]);return db['SquareDetailsReport'][_0x4e40('0x47')](_0x734034)[_0x4e40('0x28')](handleEntityNotFound(_0x128de8,null))[_0x4e40('0x28')](respondWithResult(_0x128de8,null))[_0x4e40('0x48')](handleError(_0x128de8,null));};exports[_0x4e40('0x49')]=function(_0x5a0164,_0x44c7a){return db[_0x4e40('0x2d')][_0x4e40('0x49')](_0x5a0164[_0x4e40('0x4a')],{})[_0x4e40('0x28')](respondWithResult(_0x44c7a,0xc9))[_0x4e40('0x48')](handleError(_0x44c7a,null));};exports[_0x4e40('0x27')]=function(_0xb44eb6,_0x43dce9){if(_0xb44eb6[_0x4e40('0x4a')]['id']){delete _0xb44eb6[_0x4e40('0x4a')]['id'];}return db[_0x4e40('0x2d')][_0x4e40('0x47')]({'where':{'id':_0xb44eb6[_0x4e40('0x44')]['id']}})[_0x4e40('0x28')](handleEntityNotFound(_0x43dce9,null))[_0x4e40('0x28')](saveUpdates(_0xb44eb6[_0x4e40('0x4a')],null))[_0x4e40('0x28')](respondWithResult(_0x43dce9,null))['catch'](handleError(_0x43dce9,null));};exports['destroy']=function(_0x54a633,_0x433355){return db[_0x4e40('0x2d')]['find']({'where':{'id':_0x54a633[_0x4e40('0x44')]['id']}})['then'](handleEntityNotFound(_0x433355,null))[_0x4e40('0x28')](removeEntity(_0x433355,null))[_0x4e40('0x48')](handleError(_0x433355,null));};exports[_0x4e40('0x4b')]=function(_0x234ef1,_0x1ea4ce){return db[_0x4e40('0x2d')][_0x4e40('0x4b')]()[_0x4e40('0x28')](respondWithResult(_0x1ea4ce,null))[_0x4e40('0x48')](handleError(_0x1ea4ce,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0c3066b..4e71c9b 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 _0xbebb=['bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbebb,0x110));var _0xbbeb=function(_0xb11217,_0x4645a8){_0xb11217=_0xb11217-0x0;var _0x30dcd2=_0xbebb[_0xb11217];return _0x30dcd2;};'use strict';var _=require(_0xbbeb('0x0'));var util=require(_0xbbeb('0x1'));var logger=require(_0xbbeb('0x2'))('api');var moment=require(_0xbbeb('0x3'));var BPromise=require(_0xbbeb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbeb('0x5'));var rimraf=require(_0xbbeb('0x6'));var config=require(_0xbbeb('0x7'));var attributes=require(_0xbbeb('0x8'));module[_0xbbeb('0x9')]=function(_0x99702c,_0x5b9146){return _0x99702c[_0xbbeb('0xa')](_0xbbeb('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa36e=['request-promise','path','rimraf','./squareReportDetail.attributes','lodash','util','api','moment','bluebird'];(function(_0x1da09c,_0x29d5ea){var _0x1b09fa=function(_0x29189c){while(--_0x29189c){_0x1da09c['push'](_0x1da09c['shift']());}};_0x1b09fa(++_0x29d5ea);}(_0xa36e,0x109));var _0xea36=function(_0x3af7d4,_0x2f817b){_0x3af7d4=_0x3af7d4-0x0;var _0x4c8da4=_0xa36e[_0x3af7d4];return _0x4c8da4;};'use strict';var _=require(_0xea36('0x0'));var util=require(_0xea36('0x1'));var logger=require('../../config/logger')(_0xea36('0x2'));var moment=require(_0xea36('0x3'));var BPromise=require(_0xea36('0x4'));var rp=require(_0xea36('0x5'));var fs=require('fs');var path=require(_0xea36('0x6'));var rimraf=require(_0xea36('0x7'));var config=require('../../config/environment');var attributes=require(_0xea36('0x8'));module['exports']=function(_0x1ede3e,_0x27b076){return _0x1ede3e['define']('SquareDetailsReport',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 78f37a6..61f9c4e 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 _0xfcbb=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x1f5cea,_0x418ae0){_0x1f5cea=_0x1f5cea-0x0;var _0x4875bc=_0xfcbb[_0x1f5cea];return _0x4875bc;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateSquareDetailsReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x3de3=['../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x35421e,_0x3e37f1){var _0x241e0f=function(_0xb16213){while(--_0xb16213){_0x35421e['push'](_0x35421e['shift']());}};_0x241e0f(++_0x3e37f1);}(_0x3de3,0x1ce));var _0x33de=function(_0x197a54,_0xc35b61){_0x197a54=_0x197a54-0x0;var _0x1284da=_0x3de3[_0x197a54];return _0x1284da;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['SquareDetailsReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateSquareDetailsReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 2acda70..fb0c6af 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 _0xb443=['index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x354100,_0x561c4a){var _0x1b35e2=function(_0x3ac028){while(--_0x3ac028){_0x354100['push'](_0x354100['shift']());}};_0x1b35e2(++_0x561c4a);}(_0xb443,0x1a9));var _0x3b44=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb443[_0x35da42];return _0x370035;};'use strict';var express=require(_0x3b44('0x0'));var router=express[_0x3b44('0x1')]();var auth=require(_0x3b44('0x2'));var controller=require(_0x3b44('0x3'));router[_0x3b44('0x4')]('/',auth['isAuthenticated'](),controller[_0x3b44('0x5')]);router[_0x3b44('0x4')](_0x3b44('0x6'),auth[_0x3b44('0x7')](),controller[_0x3b44('0x8')]);module[_0x3b44('0x9')]=router; \ No newline at end of file +var _0x7938=['exports','express','Router','../../components/auth/service','get','isAuthenticated','index','killProcess'];(function(_0x3f086a,_0xdfc88e){var _0xf5c68b=function(_0x503785){while(--_0x503785){_0x3f086a['push'](_0x3f086a['shift']());}};_0xf5c68b(++_0xdfc88e);}(_0x7938,0x1e1));var _0x8793=function(_0x137b54,_0x3ac723){_0x137b54=_0x137b54-0x0;var _0x305fbb=_0x7938[_0x137b54];return _0x305fbb;};'use strict';var express=require(_0x8793('0x0'));var router=express[_0x8793('0x1')]();var auth=require(_0x8793('0x2'));var controller=require('./system.controller');router[_0x8793('0x3')]('/',auth[_0x8793('0x4')](),controller[_0x8793('0x5')]);router['get']('/process/:pid/kill',auth[_0x8793('0x4')](),controller[_0x8793('0x6')]);module[_0x8793('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f8f1fe7..7122114 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 _0x6741=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json','catch','killProcess'];(function(_0x38f8e9,_0x36eede){var _0x269e6a=function(_0x120dda){while(--_0x120dda){_0x38f8e9['push'](_0x38f8e9['shift']());}};_0x269e6a(++_0x36eede);}(_0x6741,0x136));var _0x1674=function(_0x4d0456,_0x382073){_0x4d0456=_0x4d0456-0x0;var _0x2c7b54=_0x6741[_0x4d0456];return _0x2c7b54;};'use strict';var info=require('systeminformation');var exec=require(_0x1674('0x0'))[_0x1674('0x1')];var logger=require(_0x1674('0x2'))(_0x1674('0x3'));var util=require(_0x1674('0x4'));var BPromise=require('bluebird');var _=require(_0x1674('0x5'));function handleError(_0x3f5470,_0x3bce75,_0x6a9f57){_0x3bce75=_0x3bce75||0x1f4;return function(_0xd3f837){logger['error'](_0x1674('0x6'),_0x6a9f57,_0x3bce75,util['inspect'](_0xd3f837,{'showHidden':![],'depth':null}));delete _0xd3f837[_0x1674('0x7')];_0x3f5470[_0x1674('0x8')](_0x3bce75)[_0x1674('0x9')](_0xd3f837);};}exports[_0x1674('0xa')]=function(_0x1d8aed,_0x3884d2){return info[_0x1674('0xb')]()['then'](function(_0x414976){return _0x3884d2[_0x1674('0x8')](0xc8)[_0x1674('0xc')](_0x414976);})[_0x1674('0xd')](function(_0x1b2edc){return _0x3884d2[_0x1674('0x8')](0x1f4)[_0x1674('0xc')](_0x1b2edc);});};exports[_0x1674('0xe')]=function(_0x46926b,_0x4d3b40){var _0x3f5e61=[_0x1674('0xf')];return new BPromise(function(_0x3896fc,_0x57de88){return exec(util[_0x1674('0x10')](_0x1674('0x11'),_0x46926b[_0x1674('0x12')][_0x1674('0x13')]),function(_0x1d7169,_0x2f2fe4,_0x23892f){if(_0x1d7169){return _0x57de88(_0x1d7169);}return _0x3896fc(_0x2f2fe4);});})['then'](function(_0x11e22e){var _0x1c7b51=![];var _0x5d3fb1=_0x11e22e[_0x1674('0x14')](/\n/);for(var _0x353247=0x0,_0x2557b3=_0x3f5e61[_0x1674('0x15')];_0x353247<_0x2557b3,_0x1c7b51===![];_0x353247+=0x1){if(_0x11e22e[_0x1674('0x16')](_0x3f5e61[_0x353247])>=0x0){_0x1c7b51=!![];}}if(!_0x1c7b51){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x46926b[_0x1674('0x12')][_0x1674('0x13')]));}process[_0x1674('0x17')](_0x46926b[_0x1674('0x12')][_0x1674('0x13')],'SIGINT');return _0x4d3b40[_0x1674('0x8')](0xc8)[_0x1674('0xc')]({'message':util[_0x1674('0x10')](_0x1674('0x18'),_0x46926b['params'][_0x1674('0x13')])});})[_0x1674('0xd')](handleError(_0x4d3b40,null,'killProcess'));}; \ No newline at end of file +var _0xeabe=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xeabe,0x12d));var _0xeeab=function(_0x435049,_0x1c5f97){_0x435049=_0x435049-0x0;var _0x519ffe=_0xeabe[_0x435049];return _0x519ffe;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xeeab('0x0'))(_0xeeab('0x1'));var util=require('util');var BPromise=require(_0xeeab('0x2'));var _=require(_0xeeab('0x3'));function handleError(_0x44da89,_0x18e71b,_0x9bae77){_0x18e71b=_0x18e71b||0x1f4;return function(_0x125b35){logger[_0xeeab('0x4')](_0xeeab('0x5'),_0x9bae77,_0x18e71b,util['inspect'](_0x125b35,{'showHidden':![],'depth':null}));delete _0x125b35[_0xeeab('0x6')];_0x44da89[_0xeeab('0x7')](_0x18e71b)[_0xeeab('0x8')](_0x125b35);};}exports[_0xeeab('0x9')]=function(_0x59ee4c,_0x3625b6){return info['getAllData']()[_0xeeab('0xa')](function(_0x1d7303){return _0x3625b6[_0xeeab('0x7')](0xc8)['json'](_0x1d7303);})[_0xeeab('0xb')](function(_0x29c10f){return _0x3625b6['status'](0x1f4)['json'](_0x29c10f);});};exports[_0xeeab('0xc')]=function(_0x38418c,_0x433dae){var _0x2cf99a=['components/import/cm'];return new BPromise(function(_0x5f0785,_0x3410af){return exec(util[_0xeeab('0xd')](_0xeeab('0xe'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')]),function(_0x353b63,_0x8c51ed,_0x723897){if(_0x353b63){return _0x3410af(_0x353b63);}return _0x5f0785(_0x8c51ed);});})[_0xeeab('0xa')](function(_0x29412d){var _0x4191f0=![];var _0x1c0952=_0x29412d[_0xeeab('0x11')](/\n/);for(var _0x13d0b5=0x0,_0x2a6436=_0x2cf99a[_0xeeab('0x12')];_0x13d0b5<_0x2a6436,_0x4191f0===![];_0x13d0b5+=0x1){if(_0x29412d[_0xeeab('0x13')](_0x2cf99a[_0x13d0b5])>=0x0){_0x4191f0=!![];}}if(!_0x4191f0){throw new Error(util[_0xeeab('0xd')](_0xeeab('0x14'),_0x38418c['params'][_0xeeab('0x10')]));}process['kill'](_0x38418c['params'][_0xeeab('0x10')],_0xeeab('0x15'));return _0x433dae[_0xeeab('0x7')](0xc8)['json']({'message':util['format'](_0xeeab('0x16'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')])});})[_0xeeab('0xb')](handleError(_0x433dae,null,_0xeeab('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1bd60ae..e1099c9 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 _0xdace=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0xf4724a,_0x5dbfd9){var _0x3fe34f=function(_0x53508e){while(--_0x53508e){_0xf4724a['push'](_0xf4724a['shift']());}};_0x3fe34f(++_0x5dbfd9);}(_0xdace,0xc5));var _0xedac=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xdace[_0x37756b];return _0x46efec;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./tag.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')]('/:id',auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x13')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x3d2f87,_0xa9f93a){var _0x45e78c=function(_0xb0d2f6){while(--_0xb0d2f6){_0x3d2f87['push'](_0x3d2f87['shift']());}};_0x45e78c(++_0xa9f93a);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1458c7,_0x5f5a0b){_0x1458c7=_0x1458c7-0x0;var _0x5c2f1a=_0x0a9a[_0x1458c7];return _0x5c2f1a;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./tag.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3c19eb5..99e04f7 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 _0xf089=['exports','STRING','#0091EA'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xf089,0xba));var _0x9f08=function(_0x15d41a,_0x21d81b){_0x15d41a=_0x15d41a-0x0;var _0x245954=_0xf089[_0x15d41a];return _0x245954;};'use strict';var Sequelize=require('sequelize');module[_0x9f08('0x0')]={'name':{'type':Sequelize[_0x9f08('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f08('0x1')],'defaultValue':_0x9f08('0x2')},'description':{'type':Sequelize[_0x9f08('0x1')]}}; \ No newline at end of file +var _0x9a86=['name','STRING','#0091EA','sequelize','exports'];(function(_0x244aab,_0x3e607f){var _0x3182ca=function(_0x380946){while(--_0x380946){_0x244aab['push'](_0x244aab['shift']());}};_0x3182ca(++_0x3e607f);}(_0x9a86,0x1ed));var _0x69a8=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x9a86[_0x34933a];return _0x36abb4;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x69a8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x69a8('0x3')],'defaultValue':_0x69a8('0x4')},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 419b6c0..aad362c 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 _0x1327=['Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x22631c,_0x221fe8){var _0x679176=function(_0x1b7c47){while(--_0x1b7c47){_0x22631c['push'](_0x22631c['shift']());}};_0x679176(++_0x221fe8);}(_0x1327,0x85));var _0x7132=function(_0x5a62ee,_0x324ff8){_0x5a62ee=_0x5a62ee-0x0;var _0x47b49e=_0x1327[_0x5a62ee];return _0x47b49e;};'use strict';var emlformat=require(_0x7132('0x0'));var rimraf=require(_0x7132('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7132('0x2'));var rp=require(_0x7132('0x3'));var moment=require('moment');var BPromise=require(_0x7132('0x4'));var Mustache=require('mustache');var util=require(_0x7132('0x5'));var path=require(_0x7132('0x6'));var sox=require(_0x7132('0x7'));var csv=require(_0x7132('0x8'));var ejs=require(_0x7132('0x9'));var fs=require('fs');var fs_extra=require(_0x7132('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7132('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7132('0xc'));var toCsv=require(_0x7132('0x8'));var querystring=require('querystring');var Papa=require(_0x7132('0xd'));var Redis=require(_0x7132('0xe'));var authService=require(_0x7132('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7132('0x10'));var hardwareService=require(_0x7132('0x11'));var logger=require(_0x7132('0x12'))(_0x7132('0x13'));var utils=require(_0x7132('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7132('0x15'));var db=require(_0x7132('0x16'))['db'];function respondWithStatusCode(_0x5a81b1,_0x28c07f){_0x28c07f=_0x28c07f||0xcc;return function(_0x42af16){if(_0x42af16){return _0x5a81b1['sendStatus'](_0x28c07f);}return _0x5a81b1[_0x7132('0x17')](_0x28c07f)[_0x7132('0x18')]();};}function respondWithResult(_0x50a414,_0x5d247c){_0x5d247c=_0x5d247c||0xc8;return function(_0x47eaf6){if(_0x47eaf6){return _0x50a414['status'](_0x5d247c)[_0x7132('0x19')](_0x47eaf6);}};}function respondWithFilteredResult(_0xf05e3d,_0x53aa4a){return function(_0x75bba6){if(_0x75bba6){var _0x1c423a=typeof _0x53aa4a[_0x7132('0x1a')]===_0x7132('0x1b')&&typeof _0x53aa4a[_0x7132('0x1c')]===_0x7132('0x1b');var _0x2d11bf=_0x75bba6[_0x7132('0x1d')];var _0x148b9b=_0x1c423a?0x0:_0x53aa4a['offset'];var _0x4f7496=_0x1c423a?_0x75bba6[_0x7132('0x1d')]:_0x53aa4a[_0x7132('0x1a')]+_0x53aa4a[_0x7132('0x1c')];var _0x629e57;if(_0x4f7496>=_0x2d11bf){_0x4f7496=_0x2d11bf;_0x629e57=0xc8;}else{_0x629e57=0xce;}_0xf05e3d[_0x7132('0x17')](_0x629e57);return _0xf05e3d[_0x7132('0x1e')](_0x7132('0x1f'),_0x148b9b+'-'+_0x4f7496+'/'+_0x2d11bf)[_0x7132('0x19')](_0x75bba6);}return null;};}function patchUpdates(_0x57329e){return function(_0x408dcb){try{jsonpatch[_0x7132('0x20')](_0x408dcb,_0x57329e,!![]);}catch(_0x2ecb14){return BPromise[_0x7132('0x21')](_0x2ecb14);}return _0x408dcb[_0x7132('0x22')]();};}function saveUpdates(_0x4381d2,_0xf6375c){return function(_0x4ad880){if(_0x4ad880){return _0x4ad880[_0x7132('0x23')](_0x4381d2)[_0x7132('0x24')](function(_0x3d3530){return _0x3d3530;});}return null;};}function removeEntity(_0x1d44aa,_0x29f010){return function(_0x19855d){if(_0x19855d){return _0x19855d['destroy']()[_0x7132('0x24')](function(){var _0x561ec7=_0x19855d[_0x7132('0x25')]({'plain':!![]});var _0x561825=_0x7132('0x26');return db[_0x7132('0x27')][_0x7132('0x28')]({'where':{'type':_0x561825,'resourceId':_0x561ec7['id']}})[_0x7132('0x24')](function(){return _0x19855d;});})[_0x7132('0x24')](function(){_0x1d44aa['status'](0xcc)[_0x7132('0x18')]();});}};}function handleEntityNotFound(_0x394671,_0x5db0cc){return function(_0x477409){if(!_0x477409){_0x394671['sendStatus'](0x194);}return _0x477409;};}function handleError(_0xd3285,_0x117435){_0x117435=_0x117435||0x1f4;return function(_0x4be753){logger[_0x7132('0x29')](_0x4be753[_0x7132('0x2a')]);if(_0x4be753[_0x7132('0x2b')]){delete _0x4be753[_0x7132('0x2b')];}_0xd3285[_0x7132('0x17')](_0x117435)['send'](_0x4be753);};}exports['index']=function(_0x109dbf,_0x492200){var _0x76f596={},_0x21a8e1={},_0x1add96={'count':0x0,'rows':[]};var _0x5afad1=_[_0x7132('0x2c')](db[_0x7132('0x2d')][_0x7132('0x2e')],function(_0x26fc6){return{'name':_0x26fc6[_0x7132('0x2f')],'type':_0x26fc6[_0x7132('0x30')][_0x7132('0x31')]};});_0x21a8e1[_0x7132('0x32')]=_[_0x7132('0x2c')](_0x5afad1,_0x7132('0x2b'));_0x21a8e1['query']=_[_0x7132('0x33')](_0x109dbf[_0x7132('0x34')]);_0x21a8e1[_0x7132('0x35')]=_['intersection'](_0x21a8e1['model'],_0x21a8e1[_0x7132('0x34')]);_0x76f596[_0x7132('0x36')]=_[_0x7132('0x37')](_0x21a8e1[_0x7132('0x32')],qs[_0x7132('0x38')](_0x109dbf[_0x7132('0x34')][_0x7132('0x38')]));_0x76f596[_0x7132('0x36')]=_0x76f596[_0x7132('0x36')][_0x7132('0x39')]?_0x76f596['attributes']:_0x21a8e1[_0x7132('0x32')];if(!_0x109dbf['query'][_0x7132('0x3a')](_0x7132('0x3b'))){_0x76f596[_0x7132('0x1c')]=qs[_0x7132('0x1c')](_0x109dbf[_0x7132('0x34')][_0x7132('0x1c')]);_0x76f596['offset']=qs['offset'](_0x109dbf[_0x7132('0x34')][_0x7132('0x1a')]);}_0x76f596['order']=qs[_0x7132('0x3c')](_0x109dbf['query'][_0x7132('0x3c')]);_0x76f596[_0x7132('0x3d')]=qs[_0x7132('0x35')](_[_0x7132('0x3e')](_0x109dbf[_0x7132('0x34')],_0x21a8e1[_0x7132('0x35')]),_0x5afad1);if(_0x109dbf[_0x7132('0x34')][_0x7132('0x3f')]){_0x76f596[_0x7132('0x3d')]=_[_0x7132('0x40')](_0x76f596[_0x7132('0x3d')],{'$or':_['map'](_0x5afad1,function(_0x5e1642){if(_0x5e1642[_0x7132('0x30')]!==_0x7132('0x41')){var _0x4790bf={};_0x4790bf[_0x5e1642['name']]={'$like':'%'+_0x109dbf['query'][_0x7132('0x3f')]+'%'};return _0x4790bf;}})});}_0x76f596=_[_0x7132('0x40')]({},_0x76f596,_0x109dbf['options']);var _0x2c2934={'where':_0x76f596['where']};return db[_0x7132('0x2d')][_0x7132('0x1d')](_0x2c2934)[_0x7132('0x24')](function(_0x1bb738){_0x1add96[_0x7132('0x1d')]=_0x1bb738;if(_0x109dbf[_0x7132('0x34')]['includeAll']){_0x76f596[_0x7132('0x42')]=[{'all':!![]}];}return db[_0x7132('0x2d')][_0x7132('0x43')](_0x76f596);})['then'](function(_0x13d0b3){_0x1add96['rows']=_0x13d0b3;return _0x1add96;})[_0x7132('0x24')](respondWithFilteredResult(_0x492200,_0x76f596))['catch'](handleError(_0x492200,null));};exports[_0x7132('0x44')]=function(_0x1c7320,_0x7c9c84){var _0x5a5f4d={'raw':!![],'where':{'id':_0x1c7320[_0x7132('0x45')]['id']}},_0x2740ac={};_0x2740ac[_0x7132('0x32')]=_['keys'](db[_0x7132('0x2d')]['rawAttributes']);_0x2740ac[_0x7132('0x34')]=_[_0x7132('0x33')](_0x1c7320['query']);_0x2740ac[_0x7132('0x35')]=_[_0x7132('0x37')](_0x2740ac[_0x7132('0x32')],_0x2740ac[_0x7132('0x34')]);_0x5a5f4d[_0x7132('0x36')]=_['intersection'](_0x2740ac[_0x7132('0x32')],qs['fields'](_0x1c7320[_0x7132('0x34')][_0x7132('0x38')]));_0x5a5f4d['attributes']=_0x5a5f4d[_0x7132('0x36')]['length']?_0x5a5f4d[_0x7132('0x36')]:_0x2740ac[_0x7132('0x32')];if(_0x1c7320['query'][_0x7132('0x46')]){_0x5a5f4d['include']=[{'all':!![]}];}_0x5a5f4d=_[_0x7132('0x40')]({},_0x5a5f4d,_0x1c7320[_0x7132('0x47')]);return db[_0x7132('0x2d')]['find'](_0x5a5f4d)[_0x7132('0x24')](handleEntityNotFound(_0x7c9c84,null))['then'](respondWithResult(_0x7c9c84,null))['catch'](handleError(_0x7c9c84,null));};exports['create']=function(_0x5bd5b0,_0x484a4e){return db[_0x7132('0x2d')][_0x7132('0x48')](_0x5bd5b0['body'],{})[_0x7132('0x24')](function(_0xcceca6){var _0x5098d4=_0x5bd5b0[_0x7132('0x49')][_0x7132('0x25')]({'plain':!![]});if(!_0x5098d4)throw new Error(_0x7132('0x4a'));if(_0x5098d4[_0x7132('0x4b')]===_0x7132('0x49')){var _0x21bdcd=_0xcceca6[_0x7132('0x25')]({'plain':!![]});var _0x3e8a83=_0x7132('0x26');return db['UserProfileSection'][_0x7132('0x4c')]({'where':{'name':_0x3e8a83,'userProfileId':_0x5098d4[_0x7132('0x4d')]},'raw':!![]})['then'](function(_0x1ac333){if(_0x1ac333&&_0x1ac333['autoAssociation']===0x0){return db[_0x7132('0x27')]['create']({'name':_0x21bdcd[_0x7132('0x2b')],'resourceId':_0x21bdcd['id'],'type':_0x1ac333[_0x7132('0x2b')],'sectionId':_0x1ac333['id']},{})[_0x7132('0x24')](function(){return _0xcceca6;});}else{return _0xcceca6;}})[_0x7132('0x4e')](function(_0x5ae7e9){logger['error'](_0x7132('0x4f'),_0x5ae7e9);throw _0x5ae7e9;});}return _0xcceca6;})[_0x7132('0x24')](respondWithResult(_0x484a4e,0xc9))[_0x7132('0x4e')](handleError(_0x484a4e,null));};exports[_0x7132('0x23')]=function(_0x476adc,_0x9f47f3){if(_0x476adc['body']['id']){delete _0x476adc[_0x7132('0x50')]['id'];}return db[_0x7132('0x2d')][_0x7132('0x4c')]({'where':{'id':_0x476adc[_0x7132('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f47f3,null))[_0x7132('0x24')](saveUpdates(_0x476adc[_0x7132('0x50')],null))[_0x7132('0x24')](respondWithResult(_0x9f47f3,null))[_0x7132('0x4e')](handleError(_0x9f47f3,null));};exports[_0x7132('0x28')]=function(_0x4a7cec,_0x185c30){return db['Tag'][_0x7132('0x4c')]({'where':{'id':_0x4a7cec['params']['id']}})[_0x7132('0x24')](handleEntityNotFound(_0x185c30,null))['then'](removeEntity(_0x185c30,null))['catch'](handleError(_0x185c30,null));};exports[_0x7132('0x51')]=function(_0x427e2a,_0x2708a3){return db[_0x7132('0x2d')]['describe']()['then'](respondWithResult(_0x2708a3,null))['catch'](handleError(_0x2708a3,null));}; \ No newline at end of file +var _0x40df=['send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','apply','save','then','destroy','get','Tags','UserProfileResource','error','name'];(function(_0x44c6dc,_0x5e2c56){var _0x403a26=function(_0x4f1cf5){while(--_0x4f1cf5){_0x44c6dc['push'](_0x44c6dc['shift']());}};_0x403a26(++_0x5e2c56);}(_0x40df,0x16c));var _0xf40d=function(_0x22c90f,_0xd7a36b){_0x22c90f=_0x22c90f-0x0;var _0xd26886=_0x40df[_0x22c90f];return _0xd26886;};'use strict';var emlformat=require(_0xf40d('0x0'));var rimraf=require(_0xf40d('0x1'));var zipdir=require(_0xf40d('0x2'));var jsonpatch=require(_0xf40d('0x3'));var rp=require('request-promise');var moment=require(_0xf40d('0x4'));var BPromise=require(_0xf40d('0x5'));var Mustache=require(_0xf40d('0x6'));var util=require('util');var path=require(_0xf40d('0x7'));var sox=require(_0xf40d('0x8'));var csv=require(_0xf40d('0x9'));var ejs=require(_0xf40d('0xa'));var fs=require('fs');var fs_extra=require(_0xf40d('0xb'));var _=require(_0xf40d('0xc'));var squel=require(_0xf40d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf40d('0x9'));var querystring=require('querystring');var Papa=require(_0xf40d('0xe'));var Redis=require('ioredis');var authService=require(_0xf40d('0xf'));var qs=require(_0xf40d('0x10'));var as=require(_0xf40d('0x11'));var hardwareService=require(_0xf40d('0x12'));var logger=require(_0xf40d('0x13'))(_0xf40d('0x14'));var utils=require(_0xf40d('0x15'));var config=require(_0xf40d('0x16'));var licenseUtil=require(_0xf40d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4530f,_0x5f5c1b){_0x5f5c1b=_0x5f5c1b||0xcc;return function(_0x4f400e){if(_0x4f400e){return _0xf4530f[_0xf40d('0x18')](_0x5f5c1b);}return _0xf4530f['status'](_0x5f5c1b)[_0xf40d('0x19')]();};}function respondWithResult(_0x234d2d,_0x2ab870){_0x2ab870=_0x2ab870||0xc8;return function(_0x386831){if(_0x386831){return _0x234d2d[_0xf40d('0x1a')](_0x2ab870)[_0xf40d('0x1b')](_0x386831);}};}function respondWithFilteredResult(_0x369e67,_0x3aa1bb){return function(_0x42a60b){if(_0x42a60b){var _0x13c587=typeof _0x3aa1bb['offset']==='undefined'&&typeof _0x3aa1bb[_0xf40d('0x1c')]===_0xf40d('0x1d');var _0xae8aee=_0x42a60b['count'];var _0x2471f9=_0x13c587?0x0:_0x3aa1bb['offset'];var _0x1ff89c=_0x13c587?_0x42a60b[_0xf40d('0x1e')]:_0x3aa1bb[_0xf40d('0x1f')]+_0x3aa1bb['limit'];var _0x266f24;if(_0x1ff89c>=_0xae8aee){_0x1ff89c=_0xae8aee;_0x266f24=0xc8;}else{_0x266f24=0xce;}_0x369e67[_0xf40d('0x1a')](_0x266f24);return _0x369e67['set']('Content-Range',_0x2471f9+'-'+_0x1ff89c+'/'+_0xae8aee)['json'](_0x42a60b);}return null;};}function patchUpdates(_0x5d38b2){return function(_0x2dc396){try{jsonpatch[_0xf40d('0x20')](_0x2dc396,_0x5d38b2,!![]);}catch(_0x4dea06){return BPromise['reject'](_0x4dea06);}return _0x2dc396[_0xf40d('0x21')]();};}function saveUpdates(_0x3e0960,_0xa65b45){return function(_0xad8f35){if(_0xad8f35){return _0xad8f35['update'](_0x3e0960)[_0xf40d('0x22')](function(_0x58e758){return _0x58e758;});}return null;};}function removeEntity(_0x1880db,_0x3f44f1){return function(_0x115c0e){if(_0x115c0e){return _0x115c0e[_0xf40d('0x23')]()[_0xf40d('0x22')](function(){var _0x3a6198=_0x115c0e[_0xf40d('0x24')]({'plain':!![]});var _0x3d7612=_0xf40d('0x25');return db[_0xf40d('0x26')][_0xf40d('0x23')]({'where':{'type':_0x3d7612,'resourceId':_0x3a6198['id']}})['then'](function(){return _0x115c0e;});})[_0xf40d('0x22')](function(){_0x1880db[_0xf40d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3c5e,_0x200f5f){return function(_0x1399fa){if(!_0x1399fa){_0x2b3c5e['sendStatus'](0x194);}return _0x1399fa;};}function handleError(_0x9aa6a,_0x5682dc){_0x5682dc=_0x5682dc||0x1f4;return function(_0x37d128){logger[_0xf40d('0x27')](_0x37d128['stack']);if(_0x37d128[_0xf40d('0x28')]){delete _0x37d128[_0xf40d('0x28')];}_0x9aa6a[_0xf40d('0x1a')](_0x5682dc)[_0xf40d('0x29')](_0x37d128);};}exports[_0xf40d('0x2a')]=function(_0x473d30,_0x4bf8ea){var _0x18e9b2={},_0x5e61e1={},_0x804d61={'count':0x0,'rows':[]};var _0x462509=_[_0xf40d('0x2b')](db[_0xf40d('0x2c')][_0xf40d('0x2d')],function(_0x44b52e){return{'name':_0x44b52e[_0xf40d('0x2e')],'type':_0x44b52e[_0xf40d('0x2f')]['key']};});_0x5e61e1[_0xf40d('0x30')]=_[_0xf40d('0x2b')](_0x462509,_0xf40d('0x28'));_0x5e61e1[_0xf40d('0x31')]=_[_0xf40d('0x32')](_0x473d30[_0xf40d('0x31')]);_0x5e61e1[_0xf40d('0x33')]=_[_0xf40d('0x34')](_0x5e61e1[_0xf40d('0x30')],_0x5e61e1[_0xf40d('0x31')]);_0x18e9b2['attributes']=_[_0xf40d('0x34')](_0x5e61e1[_0xf40d('0x30')],qs[_0xf40d('0x35')](_0x473d30[_0xf40d('0x31')]['fields']));_0x18e9b2[_0xf40d('0x36')]=_0x18e9b2['attributes'][_0xf40d('0x37')]?_0x18e9b2[_0xf40d('0x36')]:_0x5e61e1['model'];if(!_0x473d30['query']['hasOwnProperty'](_0xf40d('0x38'))){_0x18e9b2['limit']=qs['limit'](_0x473d30[_0xf40d('0x31')][_0xf40d('0x1c')]);_0x18e9b2[_0xf40d('0x1f')]=qs[_0xf40d('0x1f')](_0x473d30[_0xf40d('0x31')][_0xf40d('0x1f')]);}_0x18e9b2[_0xf40d('0x39')]=qs[_0xf40d('0x3a')](_0x473d30[_0xf40d('0x31')][_0xf40d('0x3a')]);_0x18e9b2[_0xf40d('0x3b')]=qs[_0xf40d('0x33')](_['pick'](_0x473d30['query'],_0x5e61e1['filters']),_0x462509);if(_0x473d30[_0xf40d('0x31')][_0xf40d('0x3c')]){_0x18e9b2[_0xf40d('0x3b')]=_[_0xf40d('0x3d')](_0x18e9b2['where'],{'$or':_['map'](_0x462509,function(_0x245c68){if(_0x245c68[_0xf40d('0x2f')]!==_0xf40d('0x3e')){var _0x23138f={};_0x23138f[_0x245c68[_0xf40d('0x28')]]={'$like':'%'+_0x473d30[_0xf40d('0x31')][_0xf40d('0x3c')]+'%'};return _0x23138f;}})});}_0x18e9b2=_[_0xf40d('0x3d')]({},_0x18e9b2,_0x473d30[_0xf40d('0x3f')]);var _0x5bee2f={'where':_0x18e9b2[_0xf40d('0x3b')]};return db[_0xf40d('0x2c')][_0xf40d('0x1e')](_0x5bee2f)[_0xf40d('0x22')](function(_0x162b92){_0x804d61['count']=_0x162b92;if(_0x473d30['query'][_0xf40d('0x40')]){_0x18e9b2[_0xf40d('0x41')]=[{'all':!![]}];}return db[_0xf40d('0x2c')][_0xf40d('0x42')](_0x18e9b2);})[_0xf40d('0x22')](function(_0x151afb){_0x804d61['rows']=_0x151afb;return _0x804d61;})['then'](respondWithFilteredResult(_0x4bf8ea,_0x18e9b2))[_0xf40d('0x43')](handleError(_0x4bf8ea,null));};exports[_0xf40d('0x44')]=function(_0x3471d9,_0x5e3116){var _0x34bd24={'raw':!![],'where':{'id':_0x3471d9['params']['id']}},_0xe1c442={};_0xe1c442['model']=_[_0xf40d('0x32')](db[_0xf40d('0x2c')][_0xf40d('0x2d')]);_0xe1c442[_0xf40d('0x31')]=_[_0xf40d('0x32')](_0x3471d9['query']);_0xe1c442['filters']=_[_0xf40d('0x34')](_0xe1c442[_0xf40d('0x30')],_0xe1c442[_0xf40d('0x31')]);_0x34bd24['attributes']=_['intersection'](_0xe1c442['model'],qs[_0xf40d('0x35')](_0x3471d9[_0xf40d('0x31')][_0xf40d('0x35')]));_0x34bd24[_0xf40d('0x36')]=_0x34bd24[_0xf40d('0x36')][_0xf40d('0x37')]?_0x34bd24[_0xf40d('0x36')]:_0xe1c442[_0xf40d('0x30')];if(_0x3471d9['query'][_0xf40d('0x40')]){_0x34bd24[_0xf40d('0x41')]=[{'all':!![]}];}_0x34bd24=_[_0xf40d('0x3d')]({},_0x34bd24,_0x3471d9[_0xf40d('0x3f')]);return db['Tag'][_0xf40d('0x45')](_0x34bd24)[_0xf40d('0x22')](handleEntityNotFound(_0x5e3116,null))[_0xf40d('0x22')](respondWithResult(_0x5e3116,null))['catch'](handleError(_0x5e3116,null));};exports['create']=function(_0x251e6a,_0x3f13fd){return db[_0xf40d('0x2c')][_0xf40d('0x46')](_0x251e6a[_0xf40d('0x47')],{})[_0xf40d('0x22')](function(_0x1873e9){var _0x14f083=_0x251e6a[_0xf40d('0x48')]['get']({'plain':!![]});if(!_0x14f083)throw new Error(_0xf40d('0x49'));if(_0x14f083[_0xf40d('0x4a')]===_0xf40d('0x48')){var _0x251d47=_0x1873e9['get']({'plain':!![]});var _0x1b674b=_0xf40d('0x25');return db[_0xf40d('0x4b')][_0xf40d('0x45')]({'where':{'name':_0x1b674b,'userProfileId':_0x14f083[_0xf40d('0x4c')]},'raw':!![]})[_0xf40d('0x22')](function(_0x5aacf6){if(_0x5aacf6&&_0x5aacf6['autoAssociation']===0x0){return db[_0xf40d('0x26')][_0xf40d('0x46')]({'name':_0x251d47[_0xf40d('0x28')],'resourceId':_0x251d47['id'],'type':_0x5aacf6[_0xf40d('0x28')],'sectionId':_0x5aacf6['id']},{})[_0xf40d('0x22')](function(){return _0x1873e9;});}else{return _0x1873e9;}})[_0xf40d('0x43')](function(_0x16025b){logger[_0xf40d('0x27')](_0xf40d('0x4d'),_0x16025b);throw _0x16025b;});}return _0x1873e9;})[_0xf40d('0x22')](respondWithResult(_0x3f13fd,0xc9))[_0xf40d('0x43')](handleError(_0x3f13fd,null));};exports[_0xf40d('0x4e')]=function(_0x50b051,_0x48b21c){if(_0x50b051['body']['id']){delete _0x50b051[_0xf40d('0x47')]['id'];}return db[_0xf40d('0x2c')][_0xf40d('0x45')]({'where':{'id':_0x50b051[_0xf40d('0x4f')]['id']}})[_0xf40d('0x22')](handleEntityNotFound(_0x48b21c,null))[_0xf40d('0x22')](saveUpdates(_0x50b051[_0xf40d('0x47')],null))[_0xf40d('0x22')](respondWithResult(_0x48b21c,null))[_0xf40d('0x43')](handleError(_0x48b21c,null));};exports[_0xf40d('0x23')]=function(_0x562917,_0xf3cef){return db[_0xf40d('0x2c')][_0xf40d('0x45')]({'where':{'id':_0x562917[_0xf40d('0x4f')]['id']}})[_0xf40d('0x22')](handleEntityNotFound(_0xf3cef,null))[_0xf40d('0x22')](removeEntity(_0xf3cef,null))[_0xf40d('0x43')](handleError(_0xf3cef,null));};exports[_0xf40d('0x50')]=function(_0x19412f,_0xea5624){return db[_0xf40d('0x2c')][_0xf40d('0x50')]()[_0xf40d('0x22')](respondWithResult(_0xea5624,null))[_0xf40d('0x43')](handleError(_0xea5624,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 043c251..d8ff082 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 _0x80bd=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','tools_tags'];(function(_0xa0038e,_0x5cc604){var _0x3c3866=function(_0x293f20){while(--_0x293f20){_0xa0038e['push'](_0xa0038e['shift']());}};_0x3c3866(++_0x5cc604);}(_0x80bd,0x78));var _0xd80b=function(_0x3607c0,_0x4c5878){_0x3607c0=_0x3607c0-0x0;var _0x2865a0=_0x80bd[_0x3607c0];return _0x2865a0;};'use strict';var _=require(_0xd80b('0x0'));var util=require(_0xd80b('0x1'));var logger=require(_0xd80b('0x2'))('api');var moment=require(_0xd80b('0x3'));var BPromise=require(_0xd80b('0x4'));var rp=require(_0xd80b('0x5'));var fs=require('fs');var path=require(_0xd80b('0x6'));var rimraf=require('rimraf');var config=require(_0xd80b('0x7'));var attributes=require('./tag.attributes');module[_0xd80b('0x8')]=function(_0x5c8404,_0x1c0569){return _0x5c8404[_0xd80b('0x9')](_0xd80b('0xa'),attributes,{'tableName':_0xd80b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1445=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','lodash','util'];(function(_0x14766d,_0x100937){var _0x4d7937=function(_0x541bbe){while(--_0x541bbe){_0x14766d['push'](_0x14766d['shift']());}};_0x4d7937(++_0x100937);}(_0x1445,0xa3));var _0x5144=function(_0x507b8c,_0x362593){_0x507b8c=_0x507b8c-0x0;var _0x1ab72a=_0x1445[_0x507b8c];return _0x1ab72a;};'use strict';var _=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var logger=require('../../config/logger')(_0x5144('0x2'));var moment=require(_0x5144('0x3'));var BPromise=require(_0x5144('0x4'));var rp=require(_0x5144('0x5'));var fs=require('fs');var path=require(_0x5144('0x6'));var rimraf=require('rimraf');var config=require(_0x5144('0x7'));var attributes=require('./tag.attributes');module[_0x5144('0x8')]=function(_0x3b268e,_0x214f9e){return _0x3b268e[_0x5144('0x9')](_0x5144('0xa'),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 8aefa1d..b8ac40f 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 _0xb66c=['../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x6c8eae,_0x5a0c5f){var _0x2d8b91=function(_0x1853d4){while(--_0x1853d4){_0x6c8eae['push'](_0x6c8eae['shift']());}};_0x2d8b91(++_0x5a0c5f);}(_0xb66c,0x175));var _0xcb66=function(_0x514185,_0x410206){_0x514185=_0x514185-0x0;var _0xcbbd23=_0xb66c[_0x514185];return _0xcbbd23;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var moment=require(_0xcb66('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb66('0x2'));var fs=require('fs');var Redis=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var jayson=require(_0xcb66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19adf5,_0x1b6852,_0xa3993){return new BPromise(function(_0x439f3d,_0xf7bc39){return client['request'](_0x19adf5,_0xa3993)[_0xcb66('0x9')](function(_0x3047f7){logger[_0xcb66('0xa')](_0xcb66('0xb'),_0x1b6852,_0xcb66('0xc'));logger['debug'](_0xcb66('0xd'),_0x1b6852,_0xcb66('0xc'),JSON[_0xcb66('0xe')](_0x3047f7));if(_0x3047f7[_0xcb66('0xf')]){if(_0x3047f7['error'][_0xcb66('0x10')]===0x1f4){logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7[_0xcb66('0xf')]['message']);return _0xf7bc39(_0x3047f7[_0xcb66('0xf')][_0xcb66('0x11')]);}logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7['error'][_0xcb66('0x11')]);return _0x439f3d(_0x3047f7['error'][_0xcb66('0x11')]);}else{logger['info'](_0xcb66('0xb'),_0x1b6852,'request\x20sent');_0x439f3d(_0x3047f7['result'][_0xcb66('0x11')]);}})[_0xcb66('0x12')](function(_0x681ce3){logger[_0xcb66('0xf')]('Tag,\x20%s,\x20%s',_0x1b6852,_0x681ce3);_0xf7bc39(_0x681ce3);});});} \ No newline at end of file +var _0xe644=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3d83ac,_0x1d0135){var _0x299760=function(_0x40c1a3){while(--_0x40c1a3){_0x3d83ac['push'](_0x3d83ac['shift']());}};_0x299760(++_0x1d0135);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var moment=require(_0x4e64('0x2'));var BPromise=require(_0x4e64('0x3'));var rs=require(_0x4e64('0x4'));var fs=require('fs');var Redis=require(_0x4e64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e64('0x6'));var logger=require(_0x4e64('0x7'))(_0x4e64('0x8'));var config=require(_0x4e64('0x9'));var jayson=require(_0x4e64('0xa'));var client=jayson[_0x4e64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x66faf,_0x12c40d,_0x5cce6e){return new BPromise(function(_0x4d5aa6,_0x8573c1){return client['request'](_0x66faf,_0x5cce6e)['then'](function(_0x2ebcfe){logger[_0x4e64('0xc')](_0x4e64('0xd'),_0x12c40d,_0x4e64('0xe'));logger[_0x4e64('0xf')](_0x4e64('0x10'),_0x12c40d,'request\x20sent',JSON[_0x4e64('0x11')](_0x2ebcfe));if(_0x2ebcfe[_0x4e64('0x12')]){if(_0x2ebcfe['error'][_0x4e64('0x13')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x12c40d,_0x2ebcfe[_0x4e64('0x12')]['message']);return _0x8573c1(_0x2ebcfe[_0x4e64('0x12')][_0x4e64('0x14')]);}logger[_0x4e64('0x12')](_0x4e64('0xd'),_0x12c40d,_0x2ebcfe[_0x4e64('0x12')][_0x4e64('0x14')]);return _0x4d5aa6(_0x2ebcfe[_0x4e64('0x12')]['message']);}else{logger[_0x4e64('0xc')](_0x4e64('0xd'),_0x12c40d,_0x4e64('0xe'));_0x4d5aa6(_0x2ebcfe['result'][_0x4e64('0x14')]);}})[_0x4e64('0x15')](function(_0x452f34){logger[_0x4e64('0x12')](_0x4e64('0xd'),_0x12c40d,_0x452f34);_0x8573c1(_0x452f34);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fd11711..7a9d23e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 7fa684c..7a6b139 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x2c0e96,_0x46bb2a){var _0x461aed=function(_0x5de840){while(--_0x5de840){_0x2c0e96['push'](_0x2c0e96['shift']());}};_0x461aed(++_0x46bb2a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe706,0xa3));var _0x6e70=function(_0x165d3c,_0x3ba20d){_0x165d3c=_0x165d3c-0x0;var _0xc27339=_0xe706[_0x165d3c];return _0xc27339;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4cea56b..a88e386 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 _0xd897=['ValidationError','Unknown\x20channel','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','TeamVoiceQueue','emit','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','spread','removeAgents','Queue:remove','getAgents','User','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','error','stack','send','index','map','Team','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','findOne','channel','capitalize','toLowerCase','Queue','rawAttributes','pick','Queues','addQueues','isValidChannel','body'];(function(_0x739d41,_0x253297){var _0x1c340c=function(_0x476918){while(--_0x476918){_0x739d41['push'](_0x739d41['shift']());}};_0x1c340c(++_0x253297);}(_0xd897,0x1f2));var _0x7d89=function(_0x10c2d9,_0x1b31bd){_0x10c2d9=_0x10c2d9-0x0;var _0x5f500e=_0xd897[_0x10c2d9];return _0x5f500e;};'use strict';var emlformat=require(_0x7d89('0x0'));var rimraf=require(_0x7d89('0x1'));var zipdir=require(_0x7d89('0x2'));var jsonpatch=require(_0x7d89('0x3'));var rp=require(_0x7d89('0x4'));var moment=require(_0x7d89('0x5'));var BPromise=require(_0x7d89('0x6'));var Mustache=require(_0x7d89('0x7'));var util=require(_0x7d89('0x8'));var path=require(_0x7d89('0x9'));var sox=require(_0x7d89('0xa'));var csv=require('to-csv');var ejs=require(_0x7d89('0xb'));var fs=require('fs');var fs_extra=require(_0x7d89('0xc'));var _=require(_0x7d89('0xd'));var squel=require('squel');var crypto=require(_0x7d89('0xe'));var jsforce=require(_0x7d89('0xf'));var deskjs=require(_0x7d89('0x10'));var toCsv=require(_0x7d89('0x11'));var querystring=require(_0x7d89('0x12'));var Papa=require(_0x7d89('0x13'));var Redis=require('ioredis');var authService=require(_0x7d89('0x14'));var qs=require(_0x7d89('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d89('0x16'));var logger=require(_0x7d89('0x17'))(_0x7d89('0x18'));var utils=require(_0x7d89('0x19'));var config=require(_0x7d89('0x1a'));var licenseUtil=require(_0x7d89('0x1b'));var db=require(_0x7d89('0x1c'))['db'];config[_0x7d89('0x1d')]=_[_0x7d89('0x1e')](config[_0x7d89('0x1d')],{'host':_0x7d89('0x1f'),'port':0x18eb});var socket=require(_0x7d89('0x20'))(new Redis(config['redis']));require('./team.socket')[_0x7d89('0x21')](socket);function respondWithStatusCode(_0x3ee8e1,_0x1944e4){_0x1944e4=_0x1944e4||0xcc;return function(_0x39105c){if(_0x39105c){return _0x3ee8e1[_0x7d89('0x22')](_0x1944e4);}return _0x3ee8e1[_0x7d89('0x23')](_0x1944e4)['end']();};}function respondWithResult(_0x493848,_0x18bf7a){_0x18bf7a=_0x18bf7a||0xc8;return function(_0x180600){if(_0x180600){return _0x493848[_0x7d89('0x23')](_0x18bf7a)[_0x7d89('0x24')](_0x180600);}};}function respondWithFilteredResult(_0x1832d0,_0x31a12d){return function(_0x2c00c9){if(_0x2c00c9){var _0x51762f=typeof _0x31a12d[_0x7d89('0x25')]===_0x7d89('0x26')&&typeof _0x31a12d[_0x7d89('0x27')]===_0x7d89('0x26');var _0x167a54=_0x2c00c9[_0x7d89('0x28')];var _0x46aca3=_0x51762f?0x0:_0x31a12d[_0x7d89('0x25')];var _0xd7e706=_0x51762f?_0x2c00c9[_0x7d89('0x28')]:_0x31a12d[_0x7d89('0x25')]+_0x31a12d[_0x7d89('0x27')];var _0x14af68;if(_0xd7e706>=_0x167a54){_0xd7e706=_0x167a54;_0x14af68=0xc8;}else{_0x14af68=0xce;}_0x1832d0[_0x7d89('0x23')](_0x14af68);return _0x1832d0['set']('Content-Range',_0x46aca3+'-'+_0xd7e706+'/'+_0x167a54)[_0x7d89('0x24')](_0x2c00c9);}return null;};}function patchUpdates(_0x16d9bd){return function(_0x52c9e7){try{jsonpatch[_0x7d89('0x29')](_0x52c9e7,_0x16d9bd,!![]);}catch(_0x27d509){return BPromise[_0x7d89('0x2a')](_0x27d509);}return _0x52c9e7['save']();};}function saveUpdates(_0x15a6c7,_0x304715){return function(_0xcb2c3f){if(_0xcb2c3f){return _0xcb2c3f[_0x7d89('0x2b')](_0x15a6c7)[_0x7d89('0x2c')](function(_0xc4df06){return _0xc4df06;});}return null;};}function handleEntityNotFound(_0x277bef,_0x5c246d){return function(_0x1c1cd8){if(!_0x1c1cd8){_0x277bef[_0x7d89('0x22')](0x194);}return _0x1c1cd8;};}function handleError(_0x4bed21,_0x1e1ea6){_0x1e1ea6=_0x1e1ea6||0x1f4;return function(_0x58bc77){logger[_0x7d89('0x2d')](_0x58bc77[_0x7d89('0x2e')]);if(_0x58bc77['name']){delete _0x58bc77['name'];}_0x4bed21[_0x7d89('0x23')](_0x1e1ea6)[_0x7d89('0x2f')](_0x58bc77);};}exports[_0x7d89('0x30')]=function(_0x36be2a,_0x20791d){var _0x3fe280={},_0x160d9e={},_0x590fc4={'count':0x0,'rows':[]};var _0x468463=_[_0x7d89('0x31')](db[_0x7d89('0x32')]['rawAttributes'],function(_0x150581){return{'name':_0x150581[_0x7d89('0x33')],'type':_0x150581[_0x7d89('0x34')][_0x7d89('0x35')]};});_0x160d9e[_0x7d89('0x36')]=_[_0x7d89('0x31')](_0x468463,_0x7d89('0x37'));_0x160d9e[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x36be2a[_0x7d89('0x38')]);_0x160d9e[_0x7d89('0x3a')]=_['intersection'](_0x160d9e[_0x7d89('0x36')],_0x160d9e[_0x7d89('0x38')]);_0x3fe280[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x160d9e[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x36be2a[_0x7d89('0x38')][_0x7d89('0x3d')]));_0x3fe280[_0x7d89('0x3b')]=_0x3fe280[_0x7d89('0x3b')]['length']?_0x3fe280[_0x7d89('0x3b')]:_0x160d9e[_0x7d89('0x36')];if(!_0x36be2a[_0x7d89('0x38')]['hasOwnProperty'](_0x7d89('0x3e'))){_0x3fe280[_0x7d89('0x27')]=qs[_0x7d89('0x27')](_0x36be2a[_0x7d89('0x38')][_0x7d89('0x27')]);_0x3fe280[_0x7d89('0x25')]=qs[_0x7d89('0x25')](_0x36be2a[_0x7d89('0x38')]['offset']);}_0x3fe280[_0x7d89('0x3f')]=qs['sort'](_0x36be2a['query'][_0x7d89('0x40')]);_0x3fe280[_0x7d89('0x41')]=qs['filters'](_['pick'](_0x36be2a[_0x7d89('0x38')],_0x160d9e['filters']),_0x468463);if(_0x36be2a[_0x7d89('0x38')][_0x7d89('0x42')]){_0x3fe280[_0x7d89('0x41')]=_[_0x7d89('0x43')](_0x3fe280['where'],{'$or':_[_0x7d89('0x31')](_0x468463,function(_0x4d5a04){if(_0x4d5a04[_0x7d89('0x34')]!==_0x7d89('0x44')){var _0x236528={};_0x236528[_0x4d5a04[_0x7d89('0x37')]]={'$like':'%'+_0x36be2a[_0x7d89('0x38')][_0x7d89('0x42')]+'%'};return _0x236528;}})});}_0x3fe280=_[_0x7d89('0x43')]({},_0x3fe280,_0x36be2a[_0x7d89('0x45')]);var _0x1439ee={'where':_0x3fe280[_0x7d89('0x41')]};return db[_0x7d89('0x32')][_0x7d89('0x28')](_0x1439ee)[_0x7d89('0x2c')](function(_0x152bd6){_0x590fc4['count']=_0x152bd6;if(_0x36be2a[_0x7d89('0x38')]['includeAll']){_0x3fe280[_0x7d89('0x46')]=[{'all':!![]}];}return db[_0x7d89('0x32')][_0x7d89('0x47')](_0x3fe280);})[_0x7d89('0x2c')](function(_0x58a810){_0x590fc4[_0x7d89('0x48')]=_0x58a810;return _0x590fc4;})[_0x7d89('0x2c')](respondWithFilteredResult(_0x20791d,_0x3fe280))[_0x7d89('0x49')](handleError(_0x20791d,null));};exports['show']=function(_0x4f8539,_0x5e18a8){var _0x2bedfa={'raw':![],'where':{'id':_0x4f8539[_0x7d89('0x4a')]['id']}},_0x264034={};_0x264034[_0x7d89('0x36')]=_[_0x7d89('0x39')](db[_0x7d89('0x32')]['rawAttributes']);_0x264034[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x4f8539['query']);_0x264034[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x264034['model'],_0x264034[_0x7d89('0x38')]);_0x2bedfa[_0x7d89('0x3b')]=_['intersection'](_0x264034[_0x7d89('0x36')],qs['fields'](_0x4f8539['query']['fields']));_0x2bedfa[_0x7d89('0x3b')]=_0x2bedfa[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x2bedfa['attributes']:_0x264034[_0x7d89('0x36')];if(_0x4f8539[_0x7d89('0x38')]['includeAll']){_0x2bedfa[_0x7d89('0x46')]=[{'all':!![]}];}_0x2bedfa=_[_0x7d89('0x43')]({},_0x2bedfa,_0x4f8539['options']);return db[_0x7d89('0x32')][_0x7d89('0x4c')](_0x2bedfa)[_0x7d89('0x2c')](handleEntityNotFound(_0x5e18a8,null))[_0x7d89('0x2c')](respondWithResult(_0x5e18a8,null))[_0x7d89('0x49')](handleError(_0x5e18a8,null));};exports[_0x7d89('0x4d')]=function(_0x12e4ea,_0x49394e){return db[_0x7d89('0x32')][_0x7d89('0x4d')](_0x12e4ea['body'],{})[_0x7d89('0x2c')](function(_0x9fa1ec){var _0x5c31ab=_0x12e4ea[_0x7d89('0x4e')][_0x7d89('0x4f')]({'plain':!![]});if(!_0x5c31ab)throw new Error(_0x7d89('0x50'));if(_0x5c31ab[_0x7d89('0x51')]===_0x7d89('0x4e')){var _0x11dc70=_0x9fa1ec['get']({'plain':!![]});var _0x4cb6a1=_0x7d89('0x52');return db[_0x7d89('0x53')][_0x7d89('0x4c')]({'where':{'name':_0x4cb6a1,'userProfileId':_0x5c31ab[_0x7d89('0x54')]},'raw':!![]})[_0x7d89('0x2c')](function(_0x10002b){if(_0x10002b&&_0x10002b[_0x7d89('0x55')]===0x0){return db[_0x7d89('0x56')]['create']({'name':_0x11dc70['name'],'resourceId':_0x11dc70['id'],'type':_0x10002b[_0x7d89('0x37')],'sectionId':_0x10002b['id']},{})[_0x7d89('0x2c')](function(){return _0x9fa1ec;});}else{return _0x9fa1ec;}})['catch'](function(_0x596379){logger['error'](_0x7d89('0x57'),_0x596379);throw _0x596379;});}return _0x9fa1ec;})[_0x7d89('0x2c')](respondWithResult(_0x49394e,0xc9))['catch'](handleError(_0x49394e,null));};exports[_0x7d89('0x2b')]=function(_0x26f54a,_0x27cd06){if(_0x26f54a['body']['id']){delete _0x26f54a['body']['id'];}return db[_0x7d89('0x32')]['find']({'where':{'id':_0x26f54a[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x27cd06,null))['then'](saveUpdates(_0x26f54a['body'],null))[_0x7d89('0x2c')](respondWithResult(_0x27cd06,null))[_0x7d89('0x49')](handleError(_0x27cd06,null));};exports[_0x7d89('0x58')]=function(_0x42cdab,_0x347dca){var _0x1bcafa=_0x42cdab['params']['id'];var _0x1c20d8=[];return db['sequelize'][_0x7d89('0x59')](function(_0x734d97){var _0x2f7409='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1bcafa;return db['sequelize'][_0x7d89('0x38')](_0x2f7409,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97})[_0x7d89('0x2c')](function(_0x568390){_0x1c20d8=_[_0x7d89('0x31')](_0x568390,function(_0x329d04){return Number(_0x329d04['UserId']);});})[_0x7d89('0x2c')](function(){var _0x4ad1b8=_0x7d89('0x5d')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x4ad1b8,{'type':db['Sequelize']['QueryTypes'][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x294814){var _0x27b1ed=_['map'](_0x294814,function(_0x47a68d){return Number(_0x47a68d[_0x7d89('0x5f')]);});return db[_0x7d89('0x60')]['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'VoiceQueueId':{'$in':_0x27b1ed}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x5bd361=_0x7d89('0x61')+_0x1bcafa;return db['sequelize']['query'](_0x5bd361,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x517435){var _0x325330=_['map'](_0x517435,function(_0x47f370){return Number(_0x47f370[_0x7d89('0x62')]);});return db['UserMailQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'MailQueueId':{'$in':_0x325330}},'transaction':_0x734d97});})['then'](function(){var _0x8eb86a=_0x7d89('0x63')+_0x1bcafa;return db[_0x7d89('0x5e')]['query'](_0x8eb86a,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')]['SELECT'],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x17a0c4){var _0xe53bfe=_[_0x7d89('0x31')](_0x17a0c4,function(_0x57def9){return Number(_0x57def9['SmsQueueId']);});return db[_0x7d89('0x64')][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'SmsQueueId':{'$in':_0xe53bfe}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0xe59c7a=_0x7d89('0x65')+_0x1bcafa;return db[_0x7d89('0x5e')]['query'](_0xe59c7a,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0xe8f953){var _0x47d17f=_[_0x7d89('0x31')](_0xe8f953,function(_0x5aa161){return Number(_0x5aa161['ChatQueueId']);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'ChatQueueId':{'$in':_0x47d17f}},'transaction':_0x734d97});})['then'](function(){var _0x442f44=_0x7d89('0x66')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x442f44,{'type':db[_0x7d89('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x1030e6){var _0x107956=_[_0x7d89('0x31')](_0x1030e6,function(_0xbc3751){return Number(_0xbc3751[_0x7d89('0x67')]);});return db['UserFaxQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'FaxQueueId':{'$in':_0x107956}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x174ae5=_0x7d89('0x68')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x174ae5,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x2ff7ec){var _0x28ad2a=_[_0x7d89('0x31')](_0x2ff7ec,function(_0x191718){return Number(_0x191718[_0x7d89('0x69')]);});return db['UserOpenchannelQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'OpenchannelQueueId':{'$in':_0x28ad2a}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x1ecad4='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x1ecad4,{'type':db['Sequelize'][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x4dc5f5){var _0xe1dfd8=_[_0x7d89('0x31')](_0x4dc5f5,function(_0x16fd87){return Number(_0x16fd87['WhatsappQueueId']);});return db[_0x7d89('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'WhatsappQueueId':{'$in':_0xe1dfd8}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x6b')][_0x7d89('0x4c')]({'where':{'TeamId':_0x1bcafa}});})[_0x7d89('0x2c')](function(_0x1df764){if(_0x1df764===null){return;}return db[_0x7d89('0x6c')][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'VoicePrefixId':_0x1df764[_0x7d89('0x6d')]},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x32')][_0x7d89('0x58')]({'where':{'id':_0x1bcafa},'cascade':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x54ce2a){if(_0x54ce2a===0x0){_0x347dca[_0x7d89('0x22')](0x194);}else{return db['UserProfileResource'][_0x7d89('0x58')]({'where':{'type':'Teams','resourceId':_0x1bcafa},'cascade':!![],'transaction':_0x734d97})[_0x7d89('0x2c')](function(){_0x347dca[_0x7d89('0x23')](0xcc)[_0x7d89('0x6e')]();});}})['catch'](function(_0x31f8c1){_0x347dca[_0x7d89('0x23')](0x1f4)['send'](_0x31f8c1);});});};exports['getQueues']=function(_0x1259a2,_0x310962,_0x36da91){return db[_0x7d89('0x32')][_0x7d89('0x6f')]({'where':{'id':_0x1259a2[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x310962,null))[_0x7d89('0x2c')](function(_0x3df876){if(!_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')]||!utils['isValidChannel'](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')])){throw new db[(_0x7d89('0x5a'))]['ValidationError']('Unknown\x20channel');}var _0x217800={};var _0x135928={};_0x135928[_0x7d89('0x36')]=_['keys'](db[_[_0x7d89('0x71')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x73')][_0x7d89('0x74')]);_0x135928[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x1259a2[_0x7d89('0x38')]);_0x135928[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x135928['model'],_0x135928[_0x7d89('0x38')]);_0x217800[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x135928[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x1259a2['query'][_0x7d89('0x3d')]));_0x217800[_0x7d89('0x3b')]=_0x217800[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x217800[_0x7d89('0x3b')]:_0x135928['model'];_0x217800[_0x7d89('0x27')]=qs[_0x7d89('0x27')](_0x1259a2[_0x7d89('0x38')]['limit']);_0x217800['offset']=qs[_0x7d89('0x25')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x25')]);_0x217800[_0x7d89('0x3f')]=qs[_0x7d89('0x40')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x40')]);_0x217800['where']=qs['filters'](_[_0x7d89('0x75')](_0x1259a2[_0x7d89('0x38')],_0x135928[_0x7d89('0x3a')]));_0x217800=_['merge']({},_0x217800,_0x1259a2['options']);return _0x3df876['get'+_[_0x7d89('0x71')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')]['toLowerCase']())+_0x7d89('0x76')](_0x217800);})[_0x7d89('0x2c')](respondWithResult(_0x310962,null))['catch'](handleError(_0x310962,null));};exports[_0x7d89('0x77')]=function(_0x6e3e7a,_0x3071ac,_0x46de9e){return db['Team'][_0x7d89('0x6f')]({'where':{'id':_0x6e3e7a[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](function(_0x401ced){if(_0x401ced){if(!_0x6e3e7a['body'][_0x7d89('0x70')]||!utils[_0x7d89('0x78')](_0x6e3e7a[_0x7d89('0x79')][_0x7d89('0x70')])){throw new db[(_0x7d89('0x5a'))][(_0x7d89('0x7a'))](_0x7d89('0x7b'));}return _0x401ced['add'+_['capitalize'](_0x6e3e7a[_0x7d89('0x79')][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x76')](_0x6e3e7a[_0x7d89('0x79')]['ids']);}return null;})[_0x7d89('0x2c')](handleEntityNotFound(_0x3071ac,null))[_0x7d89('0x2c')](respondWithStatusCode(_0x3071ac,null))[_0x7d89('0x49')](handleError(_0x3071ac,null));};exports[_0x7d89('0x7c')]=function(_0x3785b1,_0x446b8e,_0x393809){return db['Team'][_0x7d89('0x6f')]({'where':{'id':_0x3785b1[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](function(_0x307e00){if(_0x307e00){if(!_0x3785b1['query'][_0x7d89('0x70')]||!utils[_0x7d89('0x78')](_0x3785b1['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0x7d89('0x7b'));}return _0x307e00[_0x7d89('0x7d')+_[_0x7d89('0x71')](_0x3785b1['query'][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x76')](_0x3785b1['query'][_0x7d89('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x446b8e,null))[_0x7d89('0x2c')](respondWithStatusCode(_0x446b8e,null))[_0x7d89('0x49')](handleError(_0x446b8e,null));};exports[_0x7d89('0x7f')]=function(_0x4b2f20,_0x57abd2){var _0x169b49=_[_0x7d89('0x80')](_0x4b2f20[_0x7d89('0x79')][_0x7d89('0x7e')])?_0x4b2f20[_0x7d89('0x79')]['ids']:[_0x4b2f20[_0x7d89('0x79')][_0x7d89('0x7e')]];var _0x4017fd=_0x4b2f20[_0x7d89('0x4a')]['id'];return db['Team'][_0x7d89('0x4c')]({'where':{'id':_0x4017fd}})[_0x7d89('0x2c')](handleEntityNotFound(_0x57abd2,null))[_0x7d89('0x2c')](function(_0x54ac26){if(_0x54ac26){var _0x43d44a=[_0x7d89('0x81'),_0x7d89('0x82'),_0x7d89('0x83'),_0x7d89('0x84'),_0x7d89('0x85'),'Openchannel',_0x7d89('0x86')];return db[_0x7d89('0x5e')][_0x7d89('0x59')](function(_0x1eff6b){var _0x5ddeb2=_[_0x7d89('0x31')](_0x43d44a,function(_0x5dde90){var _0x506ee9={'attributes':['id',_0x7d89('0x37')]};if(_0x5dde90===_0x7d89('0x81')){_0x506ee9[_0x7d89('0x87')]={'attributes':[_0x7d89('0x88')]};}return _0x54ac26[_0x7d89('0x4f')+_0x5dde90+_0x7d89('0x76')](_0x506ee9)[_0x7d89('0x2c')](function(_0x4484bf){var _0x145cb4=_[_0x7d89('0x31')](_0x4484bf,function(_0x4cf00f){var _0x15287d=_[_0x7d89('0x31')](_0x169b49,function(_0xef8e0d){var _0x5562d5={'where':{'UserId':_0xef8e0d,[_0x5dde90+'QueueId']:_0x4cf00f['id']},'transaction':_0x1eff6b};if(_0x5dde90===_0x7d89('0x81')){_0x5562d5['defaults']={'penalty':_0x4cf00f[_0x7d89('0x89')]['penalty']};}return db['User'+_0x5dde90+_0x7d89('0x73')]['findOrCreate'](_0x5562d5)['then'](function(){socket[_0x7d89('0x8a')](_0x7d89('0x4e')+_0x5dde90+_0x7d89('0x8b'),{'UserId':_0xef8e0d,[_0x5dde90+_0x7d89('0x8c')]:_0x4cf00f['id']});if(_0x5dde90!==_0x7d89('0x81')){return;}return db['User'][_0x7d89('0x47')]({'where':{'id':_0x169b49,'online':0x1},'attributes':['id',_0x7d89('0x37'),'online',_0x7d89('0x8d'),_0x7d89('0x8e')],'raw':!![]})[_0x7d89('0x2c')](function(_0x26a227){var _0x58b5b5=_[_0x7d89('0x31')](_0x26a227,function(_0x296c57){return db[_0x7d89('0x8f')]['upsert']({'membername':_0x296c57[_0x7d89('0x37')],'UserId':_0x296c57['id'],'queue_name':_0x4cf00f['name'],'VoiceQueueId':_0x4cf00f['id'],'interface':_[_0x7d89('0x90')](_0x296c57[_0x7d89('0x8e')])?util[_0x7d89('0x91')](_0x7d89('0x92'),_0x296c57[_0x7d89('0x37')]):_0x296c57[_0x7d89('0x8e')],'paused':_0x296c57[_0x7d89('0x8d')]||![],'penalty':_0x4cf00f['TeamVoiceQueue'][_0x7d89('0x88')]},{'transaction':_0x1eff6b});});return Promise[_0x7d89('0x93')](_0x58b5b5);});});});return Promise['all'](_0x15287d);});return Promise[_0x7d89('0x93')](_0x145cb4);})[_0x7d89('0x2c')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x4017fd}})[_0x7d89('0x2c')](function(_0x34b622){if(_0x34b622){var _0x15ccdc=_[_0x7d89('0x31')](_0x169b49,function(_0x8a2dd1){db[_0x7d89('0x6c')][_0x7d89('0x94')]({'UserId':_0x8a2dd1,'VoicePrefixId':_0x34b622[_0x7d89('0x6d')]});});return Promise[_0x7d89('0x93')](_0x15ccdc);}});});});return Promise[_0x7d89('0x93')](_0x5ddeb2)[_0x7d89('0x2c')](function(){return _0x54ac26['addAgents'](_0x169b49,{'transaction':_0x1eff6b})[_0x7d89('0x95')](function(_0x10962b){return _0x10962b;});});});}})[_0x7d89('0x2c')](respondWithResult(_0x57abd2,null))[_0x7d89('0x49')](handleError(_0x57abd2,null));};exports[_0x7d89('0x96')]=function(_0x3a09ef,_0x2ca5d2){var _0xe79cd9=_[_0x7d89('0x80')](_0x3a09ef[_0x7d89('0x38')][_0x7d89('0x7e')])?_0x3a09ef['query'][_0x7d89('0x7e')]:[_0x3a09ef['query']['ids']];var _0x21174f=_0x3a09ef['params']['id'];return db['Team'][_0x7d89('0x4c')]({'where':{'id':_0x21174f}})[_0x7d89('0x2c')](handleEntityNotFound(_0x2ca5d2,null))[_0x7d89('0x2c')](function(_0x494ac6){if(_0x494ac6){var _0x409c14=[_0x7d89('0x81'),'Chat',_0x7d89('0x83'),_0x7d89('0x84'),_0x7d89('0x85'),'Openchannel',_0x7d89('0x86')];return db[_0x7d89('0x5e')][_0x7d89('0x59')](function(_0x5188f0){var _0x17a2fe=_[_0x7d89('0x31')](_0x409c14,function(_0x50e3ad){var _0x59646f={'attributes':['id','name']};return _0x494ac6[_0x7d89('0x4f')+_0x50e3ad+_0x7d89('0x76')](_0x59646f)[_0x7d89('0x2c')](function(_0x46183a){var _0x3ebbc6=_[_0x7d89('0x31')](_0x46183a,function(_0x3a8714){return _0x3a8714[_0x7d89('0x96')](_0xe79cd9,{'transaction':_0x5188f0})[_0x7d89('0x2c')](function(){var _0x2c662f=_[_0x7d89('0x31')](_0xe79cd9,function(_0x57112d){socket[_0x7d89('0x8a')]('user'+_0x50e3ad+_0x7d89('0x97'),{'UserId':Number(_0x57112d),[_0x50e3ad+'QueueId']:_0x3a8714['id']});if(_0x50e3ad!==_0x7d89('0x81')){return;}return db[_0x7d89('0x8f')][_0x7d89('0x58')]({'where':{'VoiceQueueId':_0x3a8714['id'],'UserId':_0x57112d},'transaction':_0x5188f0});});return Promise[_0x7d89('0x93')](_0x2c662f);});});return Promise[_0x7d89('0x93')](_0x3ebbc6);});});return Promise[_0x7d89('0x93')](_0x17a2fe)['then'](function(){return _0x494ac6[_0x7d89('0x96')](_0xe79cd9,{'transaction':_0x5188f0});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x6b')][_0x7d89('0x6f')]({'where':{'teamId':_0x21174f}})[_0x7d89('0x2c')](function(_0x5aba62){if(_0x5aba62){var _0x253bdd=_[_0x7d89('0x31')](_0xe79cd9,function(_0x80b15e){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x80b15e,'VoicePrefixId':_0x5aba62['VoicePrefixId']}});});return Promise['all'](_0x253bdd);}});});});}})['then'](respondWithStatusCode(_0x2ca5d2,null))[_0x7d89('0x49')](handleError(_0x2ca5d2,null));};exports[_0x7d89('0x98')]=function(_0x40ad14,_0x154f19,_0x584b4f){var _0x547ac2={};var _0x1bdc43={};var _0x5dcec3;var _0x33c1b7;return db[_0x7d89('0x32')][_0x7d89('0x6f')]({'where':{'id':_0x40ad14[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x154f19,null))[_0x7d89('0x2c')](function(_0xbd7448){if(_0xbd7448){_0x5dcec3=_0xbd7448;_0x1bdc43[_0x7d89('0x36')]=_[_0x7d89('0x39')](db[_0x7d89('0x99')][_0x7d89('0x74')]);_0x1bdc43['query']=_['keys'](_0x40ad14['query']);_0x1bdc43[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x1bdc43[_0x7d89('0x36')],_0x1bdc43['query']);_0x547ac2[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x1bdc43[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x3d')]));_0x547ac2[_0x7d89('0x3b')]=_0x547ac2[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x547ac2['attributes']:_0x1bdc43['model'];_0x547ac2[_0x7d89('0x3f')]=qs[_0x7d89('0x40')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x40')]);_0x547ac2[_0x7d89('0x41')]=qs['filters'](_['pick'](_0x40ad14[_0x7d89('0x38')],_0x1bdc43['filters']));if(_0x40ad14[_0x7d89('0x38')][_0x7d89('0x42')]){_0x547ac2[_0x7d89('0x41')]=_['merge'](_0x547ac2[_0x7d89('0x41')],{'$or':_[_0x7d89('0x31')](_0x547ac2[_0x7d89('0x3b')],function(_0x295465){var _0x83c6cc={};_0x83c6cc[_0x295465]={'$like':'%'+_0x40ad14['query'][_0x7d89('0x42')]+'%'};return _0x83c6cc;})});}_0x547ac2=_[_0x7d89('0x43')]({},_0x547ac2,_0x40ad14['options']);return _0x5dcec3[_0x7d89('0x98')](_0x547ac2);}})[_0x7d89('0x2c')](function(_0x4d5b1e){if(_0x4d5b1e){_0x33c1b7=_0x4d5b1e[_0x7d89('0x4b')];if(!_0x40ad14[_0x7d89('0x38')][_0x7d89('0x9a')]('nolimit')){_0x547ac2['limit']=qs[_0x7d89('0x27')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x27')]);_0x547ac2['offset']=qs['offset'](_0x40ad14[_0x7d89('0x38')]['offset']);}return _0x5dcec3[_0x7d89('0x98')](_0x547ac2);}})[_0x7d89('0x2c')](function(_0x4950f5){if(_0x4950f5){return _0x4950f5?{'count':_0x33c1b7,'rows':_0x4950f5}:null;}})['then'](respondWithResult(_0x154f19,null))[_0x7d89('0x49')](handleError(_0x154f19,null));}; \ No newline at end of file +var _0xe0f8=['create','user','role','get','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','Sequelize','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','order','capitalize','Queues','add','removeQueues','remove','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','all','addAgents','spread','removeAgents','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./team.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','map','Team','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','show','length','find','catch'];(function(_0x554c3b,_0x3196d0){var _0x54402a=function(_0x5beb60){while(--_0x5beb60){_0x554c3b['push'](_0x554c3b['shift']());}};_0x54402a(++_0x3196d0);}(_0xe0f8,0xe4));var _0x8e0f=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xe0f8[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0x8e0f('0x0'));var rimraf=require(_0x8e0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e0f('0x2'));var rp=require(_0x8e0f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8e0f('0x4'));var csv=require(_0x8e0f('0x5'));var ejs=require(_0x8e0f('0x6'));var fs=require('fs');var fs_extra=require(_0x8e0f('0x7'));var _=require(_0x8e0f('0x8'));var squel=require(_0x8e0f('0x9'));var crypto=require(_0x8e0f('0xa'));var jsforce=require(_0x8e0f('0xb'));var deskjs=require(_0x8e0f('0xc'));var toCsv=require(_0x8e0f('0x5'));var querystring=require(_0x8e0f('0xd'));var Papa=require(_0x8e0f('0xe'));var Redis=require(_0x8e0f('0xf'));var authService=require(_0x8e0f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e0f('0x11'));var hardwareService=require(_0x8e0f('0x12'));var logger=require(_0x8e0f('0x13'))('api');var utils=require(_0x8e0f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e0f('0x15'))['db'];config[_0x8e0f('0x16')]=_['defaults'](config[_0x8e0f('0x16')],{'host':_0x8e0f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e0f('0x16')]));require(_0x8e0f('0x18'))[_0x8e0f('0x19')](socket);function respondWithStatusCode(_0x4dc7a5,_0x161008){_0x161008=_0x161008||0xcc;return function(_0x48195b){if(_0x48195b){return _0x4dc7a5['sendStatus'](_0x161008);}return _0x4dc7a5[_0x8e0f('0x1a')](_0x161008)[_0x8e0f('0x1b')]();};}function respondWithResult(_0x186cc5,_0x6a7dd7){_0x6a7dd7=_0x6a7dd7||0xc8;return function(_0x3654b8){if(_0x3654b8){return _0x186cc5[_0x8e0f('0x1a')](_0x6a7dd7)[_0x8e0f('0x1c')](_0x3654b8);}};}function respondWithFilteredResult(_0x592e85,_0x48aa6b){return function(_0x4023c6){if(_0x4023c6){var _0x546ccc=typeof _0x48aa6b[_0x8e0f('0x1d')]==='undefined'&&typeof _0x48aa6b[_0x8e0f('0x1e')]===_0x8e0f('0x1f');var _0x25f6e4=_0x4023c6[_0x8e0f('0x20')];var _0xc9817b=_0x546ccc?0x0:_0x48aa6b[_0x8e0f('0x1d')];var _0x5d13fb=_0x546ccc?_0x4023c6[_0x8e0f('0x20')]:_0x48aa6b['offset']+_0x48aa6b['limit'];var _0x156962;if(_0x5d13fb>=_0x25f6e4){_0x5d13fb=_0x25f6e4;_0x156962=0xc8;}else{_0x156962=0xce;}_0x592e85['status'](_0x156962);return _0x592e85[_0x8e0f('0x21')]('Content-Range',_0xc9817b+'-'+_0x5d13fb+'/'+_0x25f6e4)[_0x8e0f('0x1c')](_0x4023c6);}return null;};}function patchUpdates(_0x5d4e2a){return function(_0x3b7cd9){try{jsonpatch[_0x8e0f('0x22')](_0x3b7cd9,_0x5d4e2a,!![]);}catch(_0x5e42fb){return BPromise[_0x8e0f('0x23')](_0x5e42fb);}return _0x3b7cd9[_0x8e0f('0x24')]();};}function saveUpdates(_0x3ff6c2,_0x5ad610){return function(_0x1a8604){if(_0x1a8604){return _0x1a8604[_0x8e0f('0x25')](_0x3ff6c2)[_0x8e0f('0x26')](function(_0x5f2181){return _0x5f2181;});}return null;};}function handleEntityNotFound(_0x5b593c,_0x4e6d05){return function(_0x370831){if(!_0x370831){_0x5b593c[_0x8e0f('0x27')](0x194);}return _0x370831;};}function handleError(_0x2ddb75,_0xfa1d8a){_0xfa1d8a=_0xfa1d8a||0x1f4;return function(_0x465038){logger[_0x8e0f('0x28')](_0x465038[_0x8e0f('0x29')]);if(_0x465038[_0x8e0f('0x2a')]){delete _0x465038['name'];}_0x2ddb75[_0x8e0f('0x1a')](_0xfa1d8a)['send'](_0x465038);};}exports['index']=function(_0x385961,_0x26aadc){var _0x541867={},_0x3ea37b={},_0x22c491={'count':0x0,'rows':[]};var _0x516ee4=_[_0x8e0f('0x2b')](db[_0x8e0f('0x2c')][_0x8e0f('0x2d')],function(_0x5ae0e1){return{'name':_0x5ae0e1['fieldName'],'type':_0x5ae0e1['type']['key']};});_0x3ea37b[_0x8e0f('0x2e')]=_[_0x8e0f('0x2b')](_0x516ee4,_0x8e0f('0x2a'));_0x3ea37b[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x385961[_0x8e0f('0x2f')]);_0x3ea37b[_0x8e0f('0x31')]=_['intersection'](_0x3ea37b[_0x8e0f('0x2e')],_0x3ea37b[_0x8e0f('0x2f')]);_0x541867[_0x8e0f('0x32')]=_[_0x8e0f('0x33')](_0x3ea37b[_0x8e0f('0x2e')],qs[_0x8e0f('0x34')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x34')]));_0x541867[_0x8e0f('0x32')]=_0x541867['attributes']['length']?_0x541867[_0x8e0f('0x32')]:_0x3ea37b['model'];if(!_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x35')](_0x8e0f('0x36'))){_0x541867[_0x8e0f('0x1e')]=qs[_0x8e0f('0x1e')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x1e')]);_0x541867[_0x8e0f('0x1d')]=qs['offset'](_0x385961[_0x8e0f('0x2f')]['offset']);}_0x541867['order']=qs[_0x8e0f('0x37')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x37')]);_0x541867['where']=qs[_0x8e0f('0x31')](_[_0x8e0f('0x38')](_0x385961['query'],_0x3ea37b[_0x8e0f('0x31')]),_0x516ee4);if(_0x385961[_0x8e0f('0x2f')]['filter']){_0x541867[_0x8e0f('0x39')]=_[_0x8e0f('0x3a')](_0x541867[_0x8e0f('0x39')],{'$or':_[_0x8e0f('0x2b')](_0x516ee4,function(_0xb79af1){if(_0xb79af1['type']!==_0x8e0f('0x3b')){var _0x143046={};_0x143046[_0xb79af1[_0x8e0f('0x2a')]]={'$like':'%'+_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x3c')]+'%'};return _0x143046;}})});}_0x541867=_[_0x8e0f('0x3a')]({},_0x541867,_0x385961[_0x8e0f('0x3d')]);var _0x488fd4={'where':_0x541867[_0x8e0f('0x39')]};return db[_0x8e0f('0x2c')][_0x8e0f('0x20')](_0x488fd4)[_0x8e0f('0x26')](function(_0x25b95f){_0x22c491['count']=_0x25b95f;if(_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x3e')]){_0x541867[_0x8e0f('0x3f')]=[{'all':!![]}];}return db['Team']['findAll'](_0x541867);})[_0x8e0f('0x26')](function(_0x324732){_0x22c491['rows']=_0x324732;return _0x22c491;})['then'](respondWithFilteredResult(_0x26aadc,_0x541867))['catch'](handleError(_0x26aadc,null));};exports[_0x8e0f('0x40')]=function(_0x383c44,_0x240560){var _0x19e62c={'raw':![],'where':{'id':_0x383c44['params']['id']}},_0x9528b={};_0x9528b['model']=_[_0x8e0f('0x30')](db[_0x8e0f('0x2c')]['rawAttributes']);_0x9528b[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x383c44['query']);_0x9528b[_0x8e0f('0x31')]=_[_0x8e0f('0x33')](_0x9528b[_0x8e0f('0x2e')],_0x9528b['query']);_0x19e62c[_0x8e0f('0x32')]=_[_0x8e0f('0x33')](_0x9528b[_0x8e0f('0x2e')],qs['fields'](_0x383c44[_0x8e0f('0x2f')]['fields']));_0x19e62c[_0x8e0f('0x32')]=_0x19e62c[_0x8e0f('0x32')][_0x8e0f('0x41')]?_0x19e62c[_0x8e0f('0x32')]:_0x9528b[_0x8e0f('0x2e')];if(_0x383c44[_0x8e0f('0x2f')][_0x8e0f('0x3e')]){_0x19e62c[_0x8e0f('0x3f')]=[{'all':!![]}];}_0x19e62c=_[_0x8e0f('0x3a')]({},_0x19e62c,_0x383c44[_0x8e0f('0x3d')]);return db[_0x8e0f('0x2c')][_0x8e0f('0x42')](_0x19e62c)['then'](handleEntityNotFound(_0x240560,null))[_0x8e0f('0x26')](respondWithResult(_0x240560,null))[_0x8e0f('0x43')](handleError(_0x240560,null));};exports[_0x8e0f('0x44')]=function(_0x51ebd0,_0x328155){return db['Team'][_0x8e0f('0x44')](_0x51ebd0['body'],{})[_0x8e0f('0x26')](function(_0x2c579e){var _0x3e8126=_0x51ebd0[_0x8e0f('0x45')]['get']({'plain':!![]});if(!_0x3e8126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8126[_0x8e0f('0x46')]==='user'){var _0x27c19f=_0x2c579e[_0x8e0f('0x47')]({'plain':!![]});var _0x37dc54=_0x8e0f('0x48');return db['UserProfileSection'][_0x8e0f('0x42')]({'where':{'name':_0x37dc54,'userProfileId':_0x3e8126[_0x8e0f('0x49')]},'raw':!![]})[_0x8e0f('0x26')](function(_0x51b58a){if(_0x51b58a&&_0x51b58a[_0x8e0f('0x4a')]===0x0){return db['UserProfileResource'][_0x8e0f('0x44')]({'name':_0x27c19f[_0x8e0f('0x2a')],'resourceId':_0x27c19f['id'],'type':_0x51b58a[_0x8e0f('0x2a')],'sectionId':_0x51b58a['id']},{})['then'](function(){return _0x2c579e;});}else{return _0x2c579e;}})[_0x8e0f('0x43')](function(_0x51a6fe){logger[_0x8e0f('0x28')](_0x8e0f('0x4b'),_0x51a6fe);throw _0x51a6fe;});}return _0x2c579e;})[_0x8e0f('0x26')](respondWithResult(_0x328155,0xc9))[_0x8e0f('0x43')](handleError(_0x328155,null));};exports[_0x8e0f('0x25')]=function(_0x1dc435,_0x57e7ee){if(_0x1dc435[_0x8e0f('0x4c')]['id']){delete _0x1dc435['body']['id'];}return db[_0x8e0f('0x2c')][_0x8e0f('0x42')]({'where':{'id':_0x1dc435[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](handleEntityNotFound(_0x57e7ee,null))[_0x8e0f('0x26')](saveUpdates(_0x1dc435[_0x8e0f('0x4c')],null))[_0x8e0f('0x26')](respondWithResult(_0x57e7ee,null))[_0x8e0f('0x43')](handleError(_0x57e7ee,null));};exports['destroy']=function(_0x1d3d18,_0x7d729){var _0xc10776=_0x1d3d18[_0x8e0f('0x4d')]['id'];var _0x239645=[];return db[_0x8e0f('0x4e')][_0x8e0f('0x4f')](function(_0x12a844){var _0x1d5938=_0x8e0f('0x50')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x1d5938,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844})[_0x8e0f('0x26')](function(_0xe34742){_0x239645=_[_0x8e0f('0x2b')](_0xe34742,function(_0x188ae2){return Number(_0x188ae2['UserId']);});})['then'](function(){var _0xe9e746=_0x8e0f('0x53')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0xe9e746,{'type':db['Sequelize']['QueryTypes'][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x48bff8){var _0xce3ebf=_[_0x8e0f('0x2b')](_0x48bff8,function(_0x865641){return Number(_0x865641[_0x8e0f('0x54')]);});return db[_0x8e0f('0x55')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'VoiceQueueId':{'$in':_0xce3ebf}},'transaction':_0x12a844});})['then'](function(){var _0x571e74='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x571e74,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x5c4f12){var _0x3645b5=_[_0x8e0f('0x2b')](_0x5c4f12,function(_0x505c5f){return Number(_0x505c5f[_0x8e0f('0x57')]);});return db[_0x8e0f('0x58')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'MailQueueId':{'$in':_0x3645b5}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x2a62c8='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x2a62c8,{'type':db[_0x8e0f('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x4d830e){var _0x5bfd92=_[_0x8e0f('0x2b')](_0x4d830e,function(_0x56434c){return Number(_0x56434c[_0x8e0f('0x5a')]);});return db[_0x8e0f('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x239645},'SmsQueueId':{'$in':_0x5bfd92}},'transaction':_0x12a844});})['then'](function(){var _0x41598a='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x41598a,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x1527e8){var _0x437bd0=_[_0x8e0f('0x2b')](_0x1527e8,function(_0x2baddd){return Number(_0x2baddd['ChatQueueId']);});return db[_0x8e0f('0x5c')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'ChatQueueId':{'$in':_0x437bd0}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x23e296=_0x8e0f('0x5d')+_0xc10776;return db[_0x8e0f('0x4e')]['query'](_0x23e296,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x33746b){var _0xe7c3e0=_['map'](_0x33746b,function(_0x379534){return Number(_0x379534['FaxQueueId']);});return db['UserFaxQueue'][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'FaxQueueId':{'$in':_0xe7c3e0}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x128087=_0x8e0f('0x5e')+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x128087,{'type':db[_0x8e0f('0x59')][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x586d66){var _0x45fc8e=_[_0x8e0f('0x2b')](_0x586d66,function(_0x1cf86c){return Number(_0x1cf86c[_0x8e0f('0x5f')]);});return db['UserOpenchannelQueue'][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'OpenchannelQueueId':{'$in':_0x45fc8e}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x477b8f=_0x8e0f('0x60')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x477b8f,{'type':db[_0x8e0f('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x84581a){var _0x29d85d=_[_0x8e0f('0x2b')](_0x84581a,function(_0x817636){return Number(_0x817636['WhatsappQueueId']);});return db[_0x8e0f('0x61')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'WhatsappQueueId':{'$in':_0x29d85d}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){return db[_0x8e0f('0x62')][_0x8e0f('0x42')]({'where':{'TeamId':_0xc10776}});})[_0x8e0f('0x26')](function(_0x4c548a){if(_0x4c548a===null){return;}return db[_0x8e0f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x239645},'VoicePrefixId':_0x4c548a[_0x8e0f('0x64')]},'transaction':_0x12a844});})['then'](function(){return db[_0x8e0f('0x2c')][_0x8e0f('0x56')]({'where':{'id':_0xc10776},'cascade':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x546f22){if(_0x546f22===0x0){_0x7d729[_0x8e0f('0x27')](0x194);}else{return db[_0x8e0f('0x65')][_0x8e0f('0x56')]({'where':{'type':_0x8e0f('0x48'),'resourceId':_0xc10776},'cascade':!![],'transaction':_0x12a844})['then'](function(){_0x7d729[_0x8e0f('0x1a')](0xcc)['end']();});}})[_0x8e0f('0x43')](function(_0x47565a){_0x7d729[_0x8e0f('0x1a')](0x1f4)[_0x8e0f('0x66')](_0x47565a);});});};exports[_0x8e0f('0x67')]=function(_0x2bd8f6,_0x2c4516,_0x38dbe5){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2bd8f6[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](handleEntityNotFound(_0x2c4516,null))[_0x8e0f('0x26')](function(_0xae1ab2){if(!_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x69')]||!utils[_0x8e0f('0x6a')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x69')])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))](_0x8e0f('0x6c'));}var _0x333256={};var _0x37ba34={};_0x37ba34[_0x8e0f('0x2e')]=_['keys'](db[_['capitalize'](_0x2bd8f6['query'][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+'Queue'][_0x8e0f('0x2d')]);_0x37ba34[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x2bd8f6['query']);_0x37ba34[_0x8e0f('0x31')]=_['intersection'](_0x37ba34['model'],_0x37ba34['query']);_0x333256['attributes']=_['intersection'](_0x37ba34[_0x8e0f('0x2e')],qs[_0x8e0f('0x34')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x34')]));_0x333256[_0x8e0f('0x32')]=_0x333256['attributes'][_0x8e0f('0x41')]?_0x333256[_0x8e0f('0x32')]:_0x37ba34[_0x8e0f('0x2e')];_0x333256['limit']=qs[_0x8e0f('0x1e')](_0x2bd8f6['query'][_0x8e0f('0x1e')]);_0x333256[_0x8e0f('0x1d')]=qs[_0x8e0f('0x1d')](_0x2bd8f6['query'][_0x8e0f('0x1d')]);_0x333256[_0x8e0f('0x6e')]=qs[_0x8e0f('0x37')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x37')]);_0x333256[_0x8e0f('0x39')]=qs[_0x8e0f('0x31')](_[_0x8e0f('0x38')](_0x2bd8f6[_0x8e0f('0x2f')],_0x37ba34['filters']));_0x333256=_[_0x8e0f('0x3a')]({},_0x333256,_0x2bd8f6[_0x8e0f('0x3d')]);return _0xae1ab2[_0x8e0f('0x47')+_[_0x8e0f('0x6f')](_0x2bd8f6['query'][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+_0x8e0f('0x70')](_0x333256);})['then'](respondWithResult(_0x2c4516,null))[_0x8e0f('0x43')](handleError(_0x2c4516,null));};exports['addQueues']=function(_0x2882f6,_0x4cdf80,_0x5751ae){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2882f6[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](function(_0x5ea5f9){if(_0x5ea5f9){if(!_0x2882f6[_0x8e0f('0x4c')]['channel']||!utils[_0x8e0f('0x6a')](_0x2882f6[_0x8e0f('0x4c')][_0x8e0f('0x69')])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))]('Unknown\x20channel');}return _0x5ea5f9[_0x8e0f('0x71')+_[_0x8e0f('0x6f')](_0x2882f6[_0x8e0f('0x4c')][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+_0x8e0f('0x70')](_0x2882f6['body']['ids']);}return null;})[_0x8e0f('0x26')](handleEntityNotFound(_0x4cdf80,null))[_0x8e0f('0x26')](respondWithStatusCode(_0x4cdf80,null))[_0x8e0f('0x43')](handleError(_0x4cdf80,null));};exports[_0x8e0f('0x72')]=function(_0x2e43e3,_0x72443,_0x22d051){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2e43e3[_0x8e0f('0x4d')]['id']}})['then'](function(_0x321fbf){if(_0x321fbf){if(!_0x2e43e3[_0x8e0f('0x2f')][_0x8e0f('0x69')]||!utils[_0x8e0f('0x6a')](_0x2e43e3[_0x8e0f('0x2f')]['channel'])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))]('Unknown\x20channel');}return _0x321fbf[_0x8e0f('0x73')+_['capitalize'](_0x2e43e3[_0x8e0f('0x2f')][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+'Queues'](_0x2e43e3['query'][_0x8e0f('0x74')]);}return null;})[_0x8e0f('0x26')](handleEntityNotFound(_0x72443,null))[_0x8e0f('0x26')](respondWithStatusCode(_0x72443,null))[_0x8e0f('0x43')](handleError(_0x72443,null));};exports['addAgents']=function(_0x55a701,_0x3e9830){var _0x2fee83=_[_0x8e0f('0x75')](_0x55a701[_0x8e0f('0x4c')][_0x8e0f('0x74')])?_0x55a701[_0x8e0f('0x4c')][_0x8e0f('0x74')]:[_0x55a701['body'][_0x8e0f('0x74')]];var _0x53a3ca=_0x55a701[_0x8e0f('0x4d')]['id'];return db[_0x8e0f('0x2c')]['find']({'where':{'id':_0x53a3ca}})[_0x8e0f('0x26')](handleEntityNotFound(_0x3e9830,null))[_0x8e0f('0x26')](function(_0x111d52){if(_0x111d52){var _0x2636f7=[_0x8e0f('0x76'),_0x8e0f('0x77'),_0x8e0f('0x78'),_0x8e0f('0x79'),_0x8e0f('0x7a'),_0x8e0f('0x7b'),_0x8e0f('0x7c')];return db[_0x8e0f('0x4e')][_0x8e0f('0x4f')](function(_0x2077db){var _0x1c8292=_[_0x8e0f('0x2b')](_0x2636f7,function(_0x29e3bc){var _0x3842ea={'attributes':['id',_0x8e0f('0x2a')]};if(_0x29e3bc===_0x8e0f('0x76')){_0x3842ea[_0x8e0f('0x7d')]={'attributes':[_0x8e0f('0x7e')]};}return _0x111d52[_0x8e0f('0x47')+_0x29e3bc+_0x8e0f('0x70')](_0x3842ea)[_0x8e0f('0x26')](function(_0x2e1864){var _0x23b618=_[_0x8e0f('0x2b')](_0x2e1864,function(_0x51e843){var _0x53572a=_[_0x8e0f('0x2b')](_0x2fee83,function(_0x5d80b3){var _0x5a98d5={'where':{'UserId':_0x5d80b3,[_0x29e3bc+_0x8e0f('0x7f')]:_0x51e843['id']},'transaction':_0x2077db};if(_0x29e3bc===_0x8e0f('0x76')){_0x5a98d5[_0x8e0f('0x80')]={'penalty':_0x51e843[_0x8e0f('0x81')]['penalty']};}return db[_0x8e0f('0x82')+_0x29e3bc+_0x8e0f('0x83')][_0x8e0f('0x84')](_0x5a98d5)['then'](function(){socket[_0x8e0f('0x85')](_0x8e0f('0x45')+_0x29e3bc+_0x8e0f('0x86'),{'UserId':_0x5d80b3,[_0x29e3bc+'QueueId']:_0x51e843['id']});if(_0x29e3bc!==_0x8e0f('0x76')){return;}return db[_0x8e0f('0x82')]['findAll']({'where':{'id':_0x2fee83,'online':0x1},'attributes':['id',_0x8e0f('0x2a'),_0x8e0f('0x87'),_0x8e0f('0x88'),'interface'],'raw':!![]})['then'](function(_0x22f667){var _0x37f6bc=_[_0x8e0f('0x2b')](_0x22f667,function(_0x509ffd){return db[_0x8e0f('0x89')][_0x8e0f('0x8a')]({'membername':_0x509ffd[_0x8e0f('0x2a')],'UserId':_0x509ffd['id'],'queue_name':_0x51e843[_0x8e0f('0x2a')],'VoiceQueueId':_0x51e843['id'],'interface':_[_0x8e0f('0x8b')](_0x509ffd['interface'])?util['format'](_0x8e0f('0x8c'),_0x509ffd[_0x8e0f('0x2a')]):_0x509ffd[_0x8e0f('0x8d')],'paused':_0x509ffd['voicePause']||![],'penalty':_0x51e843[_0x8e0f('0x81')][_0x8e0f('0x7e')]},{'transaction':_0x2077db});});return Promise[_0x8e0f('0x8e')](_0x37f6bc);});});});return Promise[_0x8e0f('0x8e')](_0x53572a);});return Promise[_0x8e0f('0x8e')](_0x23b618);})[_0x8e0f('0x26')](function(){return db[_0x8e0f('0x62')]['findOne']({'where':{'teamId':_0x53a3ca}})['then'](function(_0x2a6032){if(_0x2a6032){var _0x1d3d2b=_['map'](_0x2fee83,function(_0x290389){db[_0x8e0f('0x63')]['upsert']({'UserId':_0x290389,'VoicePrefixId':_0x2a6032['VoicePrefixId']});});return Promise[_0x8e0f('0x8e')](_0x1d3d2b);}});});});return Promise[_0x8e0f('0x8e')](_0x1c8292)[_0x8e0f('0x26')](function(){return _0x111d52[_0x8e0f('0x8f')](_0x2fee83,{'transaction':_0x2077db})[_0x8e0f('0x90')](function(_0xf7f553){return _0xf7f553;});});});}})[_0x8e0f('0x26')](respondWithResult(_0x3e9830,null))[_0x8e0f('0x43')](handleError(_0x3e9830,null));};exports[_0x8e0f('0x91')]=function(_0x3853ff,_0x59ca11){var _0x3ebf1e=_[_0x8e0f('0x75')](_0x3853ff[_0x8e0f('0x2f')][_0x8e0f('0x74')])?_0x3853ff['query'][_0x8e0f('0x74')]:[_0x3853ff['query'][_0x8e0f('0x74')]];var _0x4da83c=_0x3853ff['params']['id'];return db[_0x8e0f('0x2c')][_0x8e0f('0x42')]({'where':{'id':_0x4da83c}})[_0x8e0f('0x26')](handleEntityNotFound(_0x59ca11,null))['then'](function(_0x4482b2){if(_0x4482b2){var _0xcbc46c=[_0x8e0f('0x76'),_0x8e0f('0x77'),_0x8e0f('0x78'),_0x8e0f('0x79'),_0x8e0f('0x7a'),_0x8e0f('0x7b'),'Whatsapp'];return db['sequelize'][_0x8e0f('0x4f')](function(_0x30b2df){var _0x56b1e0=_[_0x8e0f('0x2b')](_0xcbc46c,function(_0x1a39a4){var _0x614dd8={'attributes':['id',_0x8e0f('0x2a')]};return _0x4482b2[_0x8e0f('0x47')+_0x1a39a4+'Queues'](_0x614dd8)[_0x8e0f('0x26')](function(_0x96b504){var _0x26cdb4=_['map'](_0x96b504,function(_0x32727f){return _0x32727f['removeAgents'](_0x3ebf1e,{'transaction':_0x30b2df})[_0x8e0f('0x26')](function(){var _0xbc5466=_[_0x8e0f('0x2b')](_0x3ebf1e,function(_0x1af583){socket[_0x8e0f('0x85')](_0x8e0f('0x45')+_0x1a39a4+_0x8e0f('0x92'),{'UserId':Number(_0x1af583),[_0x1a39a4+'QueueId']:_0x32727f['id']});if(_0x1a39a4!==_0x8e0f('0x76')){return;}return db['UserVoiceQueueRt'][_0x8e0f('0x56')]({'where':{'VoiceQueueId':_0x32727f['id'],'UserId':_0x1af583},'transaction':_0x30b2df});});return Promise[_0x8e0f('0x8e')](_0xbc5466);});});return Promise['all'](_0x26cdb4);});});return Promise[_0x8e0f('0x8e')](_0x56b1e0)[_0x8e0f('0x26')](function(){return _0x4482b2[_0x8e0f('0x91')](_0x3ebf1e,{'transaction':_0x30b2df});})[_0x8e0f('0x26')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x4da83c}})[_0x8e0f('0x26')](function(_0x543c57){if(_0x543c57){var _0x1b67e5=_[_0x8e0f('0x2b')](_0x3ebf1e,function(_0x1e2ad6){db[_0x8e0f('0x63')][_0x8e0f('0x56')]({'where':{'UserId':_0x1e2ad6,'VoicePrefixId':_0x543c57[_0x8e0f('0x64')]}});});return Promise[_0x8e0f('0x8e')](_0x1b67e5);}});});});}})['then'](respondWithStatusCode(_0x59ca11,null))['catch'](handleError(_0x59ca11,null));};exports['getAgents']=function(_0x45bff0,_0x5111af,_0x444f6d){var _0x4493dd={};var _0x542a5e={};var _0x1f00fa;var _0x4cd53e;return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x45bff0[_0x8e0f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5111af,null))[_0x8e0f('0x26')](function(_0xfaeccc){if(_0xfaeccc){_0x1f00fa=_0xfaeccc;_0x542a5e[_0x8e0f('0x2e')]=_[_0x8e0f('0x30')](db[_0x8e0f('0x82')][_0x8e0f('0x2d')]);_0x542a5e[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x45bff0['query']);_0x542a5e['filters']=_[_0x8e0f('0x33')](_0x542a5e['model'],_0x542a5e[_0x8e0f('0x2f')]);_0x4493dd[_0x8e0f('0x32')]=_['intersection'](_0x542a5e[_0x8e0f('0x2e')],qs['fields'](_0x45bff0[_0x8e0f('0x2f')]['fields']));_0x4493dd[_0x8e0f('0x32')]=_0x4493dd[_0x8e0f('0x32')][_0x8e0f('0x41')]?_0x4493dd[_0x8e0f('0x32')]:_0x542a5e[_0x8e0f('0x2e')];_0x4493dd[_0x8e0f('0x6e')]=qs[_0x8e0f('0x37')](_0x45bff0[_0x8e0f('0x2f')]['sort']);_0x4493dd[_0x8e0f('0x39')]=qs['filters'](_[_0x8e0f('0x38')](_0x45bff0[_0x8e0f('0x2f')],_0x542a5e[_0x8e0f('0x31')]));if(_0x45bff0[_0x8e0f('0x2f')]['filter']){_0x4493dd[_0x8e0f('0x39')]=_['merge'](_0x4493dd['where'],{'$or':_[_0x8e0f('0x2b')](_0x4493dd[_0x8e0f('0x32')],function(_0x1a7eb0){var _0x47ea8f={};_0x47ea8f[_0x1a7eb0]={'$like':'%'+_0x45bff0[_0x8e0f('0x2f')][_0x8e0f('0x3c')]+'%'};return _0x47ea8f;})});}_0x4493dd=_['merge']({},_0x4493dd,_0x45bff0[_0x8e0f('0x3d')]);return _0x1f00fa[_0x8e0f('0x93')](_0x4493dd);}})[_0x8e0f('0x26')](function(_0x5b33aa){if(_0x5b33aa){_0x4cd53e=_0x5b33aa[_0x8e0f('0x41')];if(!_0x45bff0['query'][_0x8e0f('0x35')](_0x8e0f('0x36'))){_0x4493dd[_0x8e0f('0x1e')]=qs['limit'](_0x45bff0[_0x8e0f('0x2f')]['limit']);_0x4493dd[_0x8e0f('0x1d')]=qs[_0x8e0f('0x1d')](_0x45bff0[_0x8e0f('0x2f')][_0x8e0f('0x1d')]);}return _0x1f00fa[_0x8e0f('0x93')](_0x4493dd);}})[_0x8e0f('0x26')](function(_0x476ba5){if(_0x476ba5){return _0x476ba5?{'count':_0x4cd53e,'rows':_0x476ba5}:null;}})['then'](respondWithResult(_0x5111af,null))[_0x8e0f('0x43')](handleError(_0x5111af,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8f968b1..e4ffc13 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 _0x590a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x590a,0x9d));var _0xa590=function(_0x470e21,_0x3932d8){_0x470e21=_0x470e21-0x0;var _0xfc4788=_0x590a[_0x470e21];return _0xfc4788;};'use strict';var EventEmitter=require(_0xa590('0x0'));var Team=require(_0xa590('0x1'))['db'][_0xa590('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa590('0x3')](0x0);var events={'afterCreate':_0xa590('0x4'),'afterUpdate':'update','afterDestroy':_0xa590('0x5')};function emitEvent(_0x4da4e4){return function(_0x35b6c5,_0x3741eb,_0x47db44){TeamEvents[_0xa590('0x6')](_0x4da4e4+':'+_0x35b6c5['id'],_0x35b6c5);TeamEvents[_0xa590('0x6')](_0x4da4e4,_0x35b6c5);_0x47db44(null);};}for(var e in events){if(events[_0xa590('0x7')](e)){var event=events[e];Team[_0xa590('0x8')](e,emitEvent(event));}}module[_0xa590('0x9')]=TeamEvents; \ No newline at end of file +var _0xe3b2=['Team','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xa56e40,_0x3b594a){var _0x361f56=function(_0x32edce){while(--_0x32edce){_0xa56e40['push'](_0xa56e40['shift']());}};_0x361f56(++_0x3b594a);}(_0xe3b2,0x1ae));var _0x2e3b=function(_0x5f4ce2,_0x42c469){_0x5f4ce2=_0x5f4ce2-0x0;var _0x219b5b=_0xe3b2[_0x5f4ce2];return _0x219b5b;};'use strict';var EventEmitter=require(_0x2e3b('0x0'));var Team=require(_0x2e3b('0x1'))['db'][_0x2e3b('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e3b('0x3'),'afterDestroy':_0x2e3b('0x4')};function emitEvent(_0x53e444){return function(_0x32759c,_0x4f7e7e,_0x2ff40d){TeamEvents['emit'](_0x53e444+':'+_0x32759c['id'],_0x32759c);TeamEvents[_0x2e3b('0x5')](_0x53e444,_0x32759c);_0x2ff40d(null);};}for(var e in events){if(events[_0x2e3b('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2e3b('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c1413cc..6993d98 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 _0x2677=['then','map','catch','define','Team','Chat','Mail','Sms','all','lodash','./team.attributes','get','Queues'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x2677,0x1b6));var _0x7267=function(_0x4a917d,_0x18c5fb){_0x4a917d=_0x4a917d-0x0;var _0x465333=_0x2677[_0x4a917d];return _0x465333;};'use strict';var _=require(_0x7267('0x0'));var attributes=require(_0x7267('0x1'));function getQueuesByChannel(_0x2b81fa,_0x47556a){var _0x2960a9=_0x7267('0x2')+_0x47556a+_0x7267('0x3');return _0x2b81fa[_0x2960a9]()[_0x7267('0x4')](function(_0x51b884){return _[_0x7267('0x5')](_0x51b884,function(_0xafec16){_0xafec16['setDataValue']('channel',_0x47556a);return _0xafec16;});})[_0x7267('0x6')](function(_0x46fc9e){throw _0x46fc9e;});}module['exports']=function(_0xb00817){return _0xb00817[_0x7267('0x7')](_0x7267('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x16e554=this;var _0x178234=[_0x7267('0x9'),'Fax',_0x7267('0xa'),'Openchannel',_0x7267('0xb'),'Voice','Whatsapp'];return Promise['resolve']()[_0x7267('0x4')](function(){var _0x207cbc=_[_0x7267('0x5')](_0x178234,function(_0x1f5b47){return getQueuesByChannel(_0x16e554,_0x1f5b47);});return Promise[_0x7267('0xc')](_0x207cbc);})[_0x7267('0x6')](function(_0x5c0332){throw _0x5c0332;});}}});}; \ No newline at end of file +var _0x3533=['Whatsapp','resolve','all','lodash','get','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x3533,0xdb));var _0x3353=function(_0xd0c7bf,_0xb7f4ef){_0xd0c7bf=_0xd0c7bf-0x0;var _0x2bc558=_0x3533[_0xd0c7bf];return _0x2bc558;};'use strict';var _=require(_0x3353('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x1656da,_0x12a256){var _0x5d0866=_0x3353('0x1')+_0x12a256+'Queues';return _0x1656da[_0x5d0866]()['then'](function(_0x2ff01e){return _[_0x3353('0x2')](_0x2ff01e,function(_0x58b02b){_0x58b02b[_0x3353('0x3')](_0x3353('0x4'),_0x12a256);return _0x58b02b;});})['catch'](function(_0x5de4d1){throw _0x5de4d1;});}module[_0x3353('0x5')]=function(_0x3c7c10){return _0x3c7c10[_0x3353('0x6')](_0x3353('0x7'),attributes,{'tableName':_0x3353('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5127a9=this;var _0x528afe=[_0x3353('0x9'),_0x3353('0xa'),_0x3353('0xb'),_0x3353('0xc'),_0x3353('0xd'),_0x3353('0xe'),_0x3353('0xf')];return Promise[_0x3353('0x10')]()['then'](function(){var _0x1c9c91=_[_0x3353('0x2')](_0x528afe,function(_0x55afb9){return getQueuesByChannel(_0x5127a9,_0x55afb9);});return Promise[_0x3353('0x11')](_0x1c9c91);})['catch'](function(_0x21f679){throw _0x21f679;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 7d88a65..3bc3bfc 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 _0x39ef=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3ad93b,_0x284c95){var _0x4ef96b=function(_0x576f6b){while(--_0x576f6b){_0x3ad93b['push'](_0x3ad93b['shift']());}};_0x4ef96b(++_0x284c95);}(_0x39ef,0x1dc));var _0xf39e=function(_0x40db09,_0x377c60){_0x40db09=_0x40db09-0x0;var _0x13c04c=_0x39ef[_0x40db09];return _0x13c04c;};'use strict';var _=require(_0xf39e('0x0'));var util=require('util');var moment=require(_0xf39e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf39e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf39e('0x3'))['db'];var utils=require(_0xf39e('0x4'));var logger=require(_0xf39e('0x5'))(_0xf39e('0x6'));var config=require('../../config/environment');var jayson=require(_0xf39e('0x7'));var client=jayson[_0xf39e('0x8')][_0xf39e('0x9')]({'port':0x232a});config[_0xf39e('0xa')]=_[_0xf39e('0xb')](config[_0xf39e('0xa')],{'host':_0xf39e('0xc'),'port':0x18eb});var socket=require(_0xf39e('0xd'))(new Redis(config[_0xf39e('0xa')]));require('./team.socket')[_0xf39e('0xe')](socket);function respondWithRpcPromise(_0x3b8b51,_0x3a73f6,_0xa04807){return new BPromise(function(_0x356492,_0x22eadf){return client[_0xf39e('0xf')](_0x3b8b51,_0xa04807)[_0xf39e('0x10')](function(_0x213e58){logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,_0xf39e('0x13'));logger[_0xf39e('0x14')](_0xf39e('0x15'),_0x3a73f6,'request\x20sent',JSON[_0xf39e('0x16')](_0x213e58));if(_0x213e58[_0xf39e('0x17')]){if(_0x213e58['error'][_0xf39e('0x18')]===0x1f4){logger[_0xf39e('0x17')](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);return _0x22eadf(_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);}logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')]['message']);return _0x356492(_0x213e58['error']['message']);}else{logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,'request\x20sent');_0x356492(_0x213e58[_0xf39e('0x1a')][_0xf39e('0x19')]);}})['catch'](function(_0x3e0e3f){logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x3e0e3f);_0x22eadf(_0x3e0e3f);});});} \ No newline at end of file +var _0x7a36=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7a36,0xce));var _0x67a3=function(_0x3666c2,_0x8467fe){_0x3666c2=_0x3666c2-0x0;var _0x14700f=_0x7a36[_0x3666c2];return _0x14700f;};'use strict';var _=require('lodash');var util=require(_0x67a3('0x0'));var moment=require(_0x67a3('0x1'));var BPromise=require(_0x67a3('0x2'));var rs=require(_0x67a3('0x3'));var fs=require('fs');var Redis=require(_0x67a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67a3('0x5'));var logger=require(_0x67a3('0x6'))(_0x67a3('0x7'));var config=require(_0x67a3('0x8'));var jayson=require(_0x67a3('0x9'));var client=jayson[_0x67a3('0xa')]['http']({'port':0x232a});config[_0x67a3('0xb')]=_[_0x67a3('0xc')](config[_0x67a3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x67a3('0xd'))(new Redis(config['redis']));require(_0x67a3('0xe'))['register'](socket);function respondWithRpcPromise(_0x4d75a7,_0x110f92,_0xd1827d){return new BPromise(function(_0x11801f,_0xfacdcb){return client[_0x67a3('0xf')](_0x4d75a7,_0xd1827d)['then'](function(_0x5e81e4){logger['info'](_0x67a3('0x10'),_0x110f92,_0x67a3('0x11'));logger[_0x67a3('0x12')](_0x67a3('0x13'),_0x110f92,_0x67a3('0x11'),JSON['stringify'](_0x5e81e4));if(_0x5e81e4[_0x67a3('0x14')]){if(_0x5e81e4[_0x67a3('0x14')][_0x67a3('0x15')]===0x1f4){logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x5e81e4[_0x67a3('0x14')]['message']);return _0xfacdcb(_0x5e81e4['error'][_0x67a3('0x16')]);}logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x5e81e4[_0x67a3('0x14')][_0x67a3('0x16')]);return _0x11801f(_0x5e81e4[_0x67a3('0x14')]['message']);}else{logger[_0x67a3('0x17')]('Team,\x20%s,\x20%s',_0x110f92,_0x67a3('0x11'));_0x11801f(_0x5e81e4[_0x67a3('0x18')][_0x67a3('0x16')]);}})[_0x67a3('0x19')](function(_0x4696aa){logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x4696aa);_0xfacdcb(_0x4696aa);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 10e0ba8..f73156f 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 _0xc00a=['length','team:','./team.events','save','update','emit','removeListener'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc00a,0x1f3));var _0xac00=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0xc00a[_0xcc26d2];return _0x3841e2;};'use strict';var TeamEvents=require(_0xac00('0x0'));var events=[_0xac00('0x1'),'remove',_0xac00('0x2')];function createListener(_0x40cb98,_0x2875f6){return function(_0x4b1e68){_0x2875f6[_0xac00('0x3')](_0x40cb98,_0x4b1e68);};}function removeListener(_0x4ede0a,_0x17f0cf){return function(){TeamEvents[_0xac00('0x4')](_0x4ede0a,_0x17f0cf);};}exports['register']=function(_0x1487dd){for(var _0x1344d0=0x0,_0x22d1c8=events[_0xac00('0x5')];_0x1344d0<_0x22d1c8;_0x1344d0++){var _0x552147=events[_0x1344d0];var _0x45950e=createListener(_0xac00('0x6')+_0x552147,_0x1487dd);TeamEvents['on'](_0x552147,_0x45950e);}}; \ No newline at end of file +var _0xd2e3=['register','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x4417c5,_0x597821){var _0x5376a4=function(_0x40ff33){while(--_0x40ff33){_0x4417c5['push'](_0x4417c5['shift']());}};_0x5376a4(++_0x597821);}(_0xd2e3,0x10a));var _0x3d2e=function(_0x3070af,_0x268826){_0x3070af=_0x3070af-0x0;var _0x5be773=_0xd2e3[_0x3070af];return _0x5be773;};'use strict';var TeamEvents=require(_0x3d2e('0x0'));var events=[_0x3d2e('0x1'),_0x3d2e('0x2'),_0x3d2e('0x3')];function createListener(_0x5bf326,_0x33d073){return function(_0x4eabf8){_0x33d073[_0x3d2e('0x4')](_0x5bf326,_0x4eabf8);};}function removeListener(_0x4468e2,_0x3c34a6){return function(){TeamEvents[_0x3d2e('0x5')](_0x4468e2,_0x3c34a6);};}exports[_0x3d2e('0x6')]=function(_0x1d74f9){for(var _0x10ec04=0x0,_0x5588e5=events['length'];_0x10ec04<_0x5588e5;_0x10ec04++){var _0x3c6af4=events[_0x10ec04];var _0x5e3cd3=createListener(_0x3d2e('0x7')+_0x3c6af4,_0x1d74f9);TeamEvents['on'](_0x3c6af4,_0x5e3cd3);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6be305c..139384f 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542b=['exports','INTEGER','sequelize'];(function(_0x27e8d8,_0x2c0baa){var _0x6f7eda=function(_0x14d347){while(--_0x14d347){_0x27e8d8['push'](_0x27e8d8['shift']());}};_0x6f7eda(++_0x2c0baa);}(_0x542b,0xec));var _0xb542=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x542b[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require(_0xb542('0x0'));module[_0xb542('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb542('0x2')]}}; \ No newline at end of file +var _0xa446=['sequelize','exports','INTEGER'];(function(_0x196a6f,_0x348ee1){var _0x41e47c=function(_0x4d4c3b){while(--_0x4d4c3b){_0x196a6f['push'](_0x196a6f['shift']());}};_0x41e47c(++_0x348ee1);}(_0xa446,0xc6));var _0x6a44=function(_0x2414c3,_0x58983f){_0x2414c3=_0x2414c3-0x0;var _0x5951fc=_0xa446[_0x2414c3];return _0x5951fc;};'use strict';var Sequelize=require(_0x6a44('0x0'));module[_0x6a44('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6a44('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 9d7a004..86dd532 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9805=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x9805,0x18f));var _0x5980=function(_0x27405c,_0xfb3b33){_0x27405c=_0x27405c-0x0;var _0x5d3a09=_0x9805[_0x27405c];return _0x5d3a09;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require(_0x5980('0x2'))(_0x5980('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5980('0x4'));var fs=require('fs');var path=require(_0x5980('0x5'));var rimraf=require(_0x5980('0x6'));var config=require(_0x5980('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x1b1c8d,_0x255321){return _0x1b1c8d[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78e2=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x131bf1,_0x1f0959){var _0x1df658=function(_0x1ba0a0){while(--_0x1ba0a0){_0x131bf1['push'](_0x131bf1['shift']());}};_0x1df658(++_0x1f0959);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x278e('0x0'));var util=require(_0x278e('0x1'));var logger=require(_0x278e('0x2'))(_0x278e('0x3'));var moment=require(_0x278e('0x4'));var BPromise=require('bluebird');var rp=require(_0x278e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x278e('0x6'));var config=require(_0x278e('0x7'));var attributes=require(_0x278e('0x8'));module[_0x278e('0x9')]=function(_0x221b65,_0xc1a9b8){return _0x221b65[_0x278e('0xa')](_0x278e('0xb'),attributes,{'tableName':_0x278e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 91a2615..675dcf7 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x84ce4d,_0x24c6d7){var _0x327d33=function(_0x5748f9){while(--_0x5748f9){_0x84ce4d['push'](_0x84ce4d['shift']());}};_0x327d33(++_0x24c6d7);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0f6de0e..4e44cad 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb79=['INTEGER','sequelize','exports'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xdb79,0x9a));var _0x9db7=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xdb79[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x9db7('0x0'));module[_0x9db7('0x1')]={'penalty':{'type':Sequelize[_0x9db7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1bc2=['exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1bc2,0x1e8));var _0x21bc=function(_0x21a9ae,_0x354716){_0x21a9ae=_0x21a9ae-0x0;var _0x41da4a=_0x1bc2[_0x21a9ae];return _0x41da4a;};'use strict';var Sequelize=require('sequelize');module[_0x21bc('0x0')]={'penalty':{'type':Sequelize[_0x21bc('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 616a4dc..aa5851a 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90ae=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x2406b4,_0x2f9771){var _0x7f3752=function(_0x583971){while(--_0x583971){_0x2406b4['push'](_0x2406b4['shift']());}};_0x7f3752(++_0x2f9771);}(_0x90ae,0x195));var _0xe90a=function(_0x5af955,_0x1b7e3c){_0x5af955=_0x5af955-0x0;var _0x7e04be=_0x90ae[_0x5af955];return _0x7e04be;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var logger=require(_0xe90a('0x2'))('api');var moment=require(_0xe90a('0x3'));var BPromise=require(_0xe90a('0x4'));var rp=require(_0xe90a('0x5'));var fs=require('fs');var path=require(_0xe90a('0x6'));var rimraf=require(_0xe90a('0x7'));var config=require(_0xe90a('0x8'));var attributes=require(_0xe90a('0x9'));module[_0xe90a('0xa')]=function(_0x30cb7b,_0x5c3573){return _0x30cb7b[_0xe90a('0xb')](_0xe90a('0xc'),attributes,{'tableName':_0xe90a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b73=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x34df29,_0x2eb175){var _0x4cff66=function(_0x379d68){while(--_0x379d68){_0x34df29['push'](_0x34df29['shift']());}};_0x4cff66(++_0x2eb175);}(_0x1b73,0x1d5));var _0x31b7=function(_0x388863,_0x2b9b00){_0x388863=_0x388863-0x0;var _0x4f5c70=_0x1b73[_0x388863];return _0x4f5c70;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require(_0x31b7('0x1'))(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x31b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x31b7('0x7')]=function(_0x3d058f,_0x15c31e){return _0x3d058f['define'](_0x31b7('0x8'),attributes,{'tableName':_0x31b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 6086852..43d4898 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea63=['code','message','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5369e1,_0x2ceb72){var _0x3738ec=function(_0x33955c){while(--_0x33955c){_0x5369e1['push'](_0x5369e1['shift']());}};_0x3738ec(++_0x2ceb72);}(_0xea63,0x1d6));var _0x3ea6=function(_0x38849a,_0x2ab000){_0x38849a=_0x38849a-0x0;var _0x632b99=_0xea63[_0x38849a];return _0x632b99;};'use strict';var _=require('lodash');var util=require(_0x3ea6('0x0'));var moment=require(_0x3ea6('0x1'));var BPromise=require(_0x3ea6('0x2'));var rs=require(_0x3ea6('0x3'));var fs=require('fs');var Redis=require(_0x3ea6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ea6('0x5'))(_0x3ea6('0x6'));var config=require(_0x3ea6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3ea6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf5312a,_0xf47979,_0x398b02){return new BPromise(function(_0x383a4c,_0x13be48){return client['request'](_0xf5312a,_0x398b02)[_0x3ea6('0x9')](function(_0x10cd0b){logger['info'](_0x3ea6('0xa'),_0xf47979,_0x3ea6('0xb'));logger[_0x3ea6('0xc')](_0x3ea6('0xd'),_0xf47979,'request\x20sent',JSON[_0x3ea6('0xe')](_0x10cd0b));if(_0x10cd0b['error']){if(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x10')]===0x1f4){logger['error'](_0x3ea6('0xa'),_0xf47979,_0x10cd0b[_0x3ea6('0xf')]['message']);return _0x13be48(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0xf47979,_0x10cd0b['error'][_0x3ea6('0x11')]);return _0x383a4c(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x11')]);}else{logger['info'](_0x3ea6('0xa'),_0xf47979,_0x3ea6('0xb'));_0x383a4c(_0x10cd0b['result'][_0x3ea6('0x11')]);}})['catch'](function(_0x2f5d9){logger['error'](_0x3ea6('0xa'),_0xf47979,_0x2f5d9);_0x13be48(_0x2f5d9);});});} \ 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','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x56549f,_0x1325f9){var _0x540ad3=function(_0x4bbcf2){while(--_0x4bbcf2){_0x56549f['push'](_0x56549f['shift']());}};_0x540ad3(++_0x1325f9);}(_0x4522,0x1a0));var _0x2452=function(_0x237c98,_0x1c9921){_0x237c98=_0x237c98-0x0;var _0x4c6130=_0x4522[_0x237c98];return _0x4c6130;};'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']('TeamVoiceQueue,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('TeamVoiceQueue,\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')]('TeamVoiceQueue,\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/template/index.js b/server/api/template/index.js index f38edd1..d15bc36 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 _0x6fad=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports'];(function(_0x11fbb1,_0x2fc380){var _0x29988f=function(_0x415b82){while(--_0x415b82){_0x11fbb1['push'](_0x11fbb1['shift']());}};_0x29988f(++_0x2fc380);}(_0x6fad,0x17a));var _0xd6fa=function(_0x5cbfed,_0x2b8ba5){_0x5cbfed=_0x5cbfed-0x0;var _0x462d98=_0x6fad[_0x5cbfed];return _0x462d98;};'use strict';var multer=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var timeout=require(_0xd6fa('0x3'));var express=require(_0xd6fa('0x4'));var router=express['Router']();var fs_extra=require(_0xd6fa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd6fa('0x7'));router['get']('/',auth[_0xd6fa('0x8')](),controller[_0xd6fa('0x9')]);router[_0xd6fa('0xa')](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xc')]);router[_0xd6fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xd6fa('0xe')]);router['put'](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xf')]);router[_0xd6fa('0x10')](_0xd6fa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd6fa('0x11')]=router; \ No newline at end of file +var _0x9e6d=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','destroy'];(function(_0x2c9a53,_0x3051f1){var _0x3c80b5=function(_0x148e2e){while(--_0x148e2e){_0x2c9a53['push'](_0x2c9a53['shift']());}};_0x3c80b5(++_0x3051f1);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x1e712e,_0x215ba3){_0x1e712e=_0x1e712e-0x0;var _0x161d24=_0x9e6d[_0x1e712e];return _0x161d24;};'use strict';var multer=require(_0xd9e6('0x0'));var util=require('util');var path=require(_0xd9e6('0x1'));var timeout=require(_0xd9e6('0x2'));var express=require(_0xd9e6('0x3'));var router=express['Router']();var fs_extra=require(_0xd9e6('0x4'));var auth=require(_0xd9e6('0x5'));var interaction=require(_0xd9e6('0x6'));var config=require(_0xd9e6('0x7'));var controller=require('./template.controller');router[_0xd9e6('0x8')]('/',auth[_0xd9e6('0x9')](),controller['index']);router['get'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xb')]);router['post']('/',auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xc')]);router['put'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller['update']);router['delete'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xd')]);module[_0xd9e6('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 90e4cab..4c4644a 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 _0xe38c=['sequelize','STRING','TEXT'];(function(_0x5ab1c3,_0x4e98cd){var _0x9b30ec=function(_0x56049a){while(--_0x56049a){_0x5ab1c3['push'](_0x5ab1c3['shift']());}};_0x9b30ec(++_0x4e98cd);}(_0xe38c,0x117));var _0xce38=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe38c[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xce38('0x0'));module['exports']={'name':{'type':Sequelize[_0xce38('0x1')]},'description':{'type':Sequelize[_0xce38('0x1')]},'html':{'type':Sequelize[_0xce38('0x2')]}}; \ No newline at end of file +var _0x31b7=['sequelize','exports','STRING','TEXT'];(function(_0x52a059,_0x46e42e){var _0x250df2=function(_0x9a35a1){while(--_0x9a35a1){_0x52a059['push'](_0x52a059['shift']());}};_0x250df2(++_0x46e42e);}(_0x31b7,0xec));var _0x731b=function(_0x2d3ebb,_0x1a3d93){_0x2d3ebb=_0x2d3ebb-0x0;var _0x14adfe=_0x31b7[_0x2d3ebb];return _0x14adfe;};'use strict';var Sequelize=require(_0x731b('0x0'));module[_0x731b('0x1')]={'name':{'type':Sequelize[_0x731b('0x2')]},'description':{'type':Sequelize[_0x731b('0x2')]},'html':{'type':Sequelize[_0x731b('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e7531da..2f99556 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 _0x6af7=['fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','catch','show','params','intersection','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','sendStatus','stack','name','send','index','Template','rawAttributes'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6af7,0x16b));var _0x76af=function(_0x24e1df,_0x6dcb19){_0x24e1df=_0x24e1df-0x0;var _0x514f79=_0x6af7[_0x24e1df];return _0x514f79;};'use strict';var emlformat=require(_0x76af('0x0'));var rimraf=require(_0x76af('0x1'));var zipdir=require(_0x76af('0x2'));var jsonpatch=require(_0x76af('0x3'));var rp=require(_0x76af('0x4'));var moment=require(_0x76af('0x5'));var BPromise=require(_0x76af('0x6'));var Mustache=require(_0x76af('0x7'));var util=require(_0x76af('0x8'));var path=require(_0x76af('0x9'));var sox=require(_0x76af('0xa'));var csv=require('to-csv');var ejs=require(_0x76af('0xb'));var fs=require('fs');var fs_extra=require(_0x76af('0xc'));var _=require(_0x76af('0xd'));var squel=require(_0x76af('0xe'));var crypto=require(_0x76af('0xf'));var jsforce=require(_0x76af('0x10'));var deskjs=require(_0x76af('0x11'));var toCsv=require(_0x76af('0x12'));var querystring=require(_0x76af('0x13'));var Papa=require(_0x76af('0x14'));var Redis=require(_0x76af('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76af('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76af('0x17'));var utils=require(_0x76af('0x18'));var config=require(_0x76af('0x19'));var licenseUtil=require(_0x76af('0x1a'));var db=require(_0x76af('0x1b'))['db'];function respondWithStatusCode(_0x40b186,_0x208d59){_0x208d59=_0x208d59||0xcc;return function(_0x3fe878){if(_0x3fe878){return _0x40b186['sendStatus'](_0x208d59);}return _0x40b186[_0x76af('0x1c')](_0x208d59)['end']();};}function respondWithResult(_0x45d7df,_0x4ce90c){_0x4ce90c=_0x4ce90c||0xc8;return function(_0x782174){if(_0x782174){return _0x45d7df['status'](_0x4ce90c)[_0x76af('0x1d')](_0x782174);}};}function respondWithFilteredResult(_0x50fb87,_0x42cf17){return function(_0x4c4de0){if(_0x4c4de0){var _0x415ce9=typeof _0x42cf17[_0x76af('0x1e')]===_0x76af('0x1f')&&typeof _0x42cf17[_0x76af('0x20')]===_0x76af('0x1f');var _0x2d5155=_0x4c4de0[_0x76af('0x21')];var _0x185903=_0x415ce9?0x0:_0x42cf17[_0x76af('0x1e')];var _0x101e53=_0x415ce9?_0x4c4de0[_0x76af('0x21')]:_0x42cf17['offset']+_0x42cf17[_0x76af('0x20')];var _0x12078e;if(_0x101e53>=_0x2d5155){_0x101e53=_0x2d5155;_0x12078e=0xc8;}else{_0x12078e=0xce;}_0x50fb87['status'](_0x12078e);return _0x50fb87[_0x76af('0x22')](_0x76af('0x23'),_0x185903+'-'+_0x101e53+'/'+_0x2d5155)['json'](_0x4c4de0);}return null;};}function patchUpdates(_0xc25cee){return function(_0x4c8fba){try{jsonpatch[_0x76af('0x24')](_0x4c8fba,_0xc25cee,!![]);}catch(_0x4a2831){return BPromise[_0x76af('0x25')](_0x4a2831);}return _0x4c8fba[_0x76af('0x26')]();};}function saveUpdates(_0x3efe7b,_0x44a81b){return function(_0x2aded7){if(_0x2aded7){return _0x2aded7[_0x76af('0x27')](_0x3efe7b)[_0x76af('0x28')](function(_0x1b5997){return _0x1b5997;});}return null;};}function removeEntity(_0x4e830e,_0x1ae41f){return function(_0x154388){if(_0x154388){return _0x154388[_0x76af('0x29')]()[_0x76af('0x28')](function(){var _0x443172=_0x154388[_0x76af('0x2a')]({'plain':!![]});var _0x47128d=_0x76af('0x2b');return db['UserProfileResource'][_0x76af('0x29')]({'where':{'type':_0x47128d,'resourceId':_0x443172['id']}})[_0x76af('0x28')](function(){return _0x154388;});})[_0x76af('0x28')](function(){_0x4e830e[_0x76af('0x1c')](0xcc)[_0x76af('0x2c')]();});}};}function handleEntityNotFound(_0x2a8aaa,_0x3e3b6b){return function(_0x364518){if(!_0x364518){_0x2a8aaa[_0x76af('0x2d')](0x194);}return _0x364518;};}function handleError(_0x32d1ee,_0x36ecc7){_0x36ecc7=_0x36ecc7||0x1f4;return function(_0x269255){logger['error'](_0x269255[_0x76af('0x2e')]);if(_0x269255[_0x76af('0x2f')]){delete _0x269255[_0x76af('0x2f')];}_0x32d1ee[_0x76af('0x1c')](_0x36ecc7)[_0x76af('0x30')](_0x269255);};}exports[_0x76af('0x31')]=function(_0x40fd6c,_0x4e83ce){var _0x48a695={},_0x3f49c6={},_0x6335ec={'count':0x0,'rows':[]};var _0x16002a=_['map'](db[_0x76af('0x32')][_0x76af('0x33')],function(_0x4c581e){return{'name':_0x4c581e[_0x76af('0x34')],'type':_0x4c581e[_0x76af('0x35')][_0x76af('0x36')]};});_0x3f49c6[_0x76af('0x37')]=_['map'](_0x16002a,'name');_0x3f49c6[_0x76af('0x38')]=_[_0x76af('0x39')](_0x40fd6c['query']);_0x3f49c6[_0x76af('0x3a')]=_['intersection'](_0x3f49c6[_0x76af('0x37')],_0x3f49c6[_0x76af('0x38')]);_0x48a695[_0x76af('0x3b')]=_['intersection'](_0x3f49c6[_0x76af('0x37')],qs[_0x76af('0x3c')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x3c')]));_0x48a695[_0x76af('0x3b')]=_0x48a695[_0x76af('0x3b')]['length']?_0x48a695['attributes']:_0x3f49c6[_0x76af('0x37')];if(!_0x40fd6c['query'][_0x76af('0x3d')](_0x76af('0x3e'))){_0x48a695[_0x76af('0x20')]=qs[_0x76af('0x20')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x20')]);_0x48a695[_0x76af('0x1e')]=qs[_0x76af('0x1e')](_0x40fd6c[_0x76af('0x38')]['offset']);}_0x48a695[_0x76af('0x3f')]=qs[_0x76af('0x40')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x40')]);_0x48a695[_0x76af('0x41')]=qs[_0x76af('0x3a')](_['pick'](_0x40fd6c[_0x76af('0x38')],_0x3f49c6[_0x76af('0x3a')]),_0x16002a);if(_0x40fd6c[_0x76af('0x38')][_0x76af('0x42')]){_0x48a695['where']=_[_0x76af('0x43')](_0x48a695['where'],{'$or':_[_0x76af('0x44')](_0x16002a,function(_0x309159){if(_0x309159[_0x76af('0x35')]!==_0x76af('0x45')){var _0x11a1ec={};_0x11a1ec[_0x309159[_0x76af('0x2f')]]={'$like':'%'+_0x40fd6c[_0x76af('0x38')][_0x76af('0x42')]+'%'};return _0x11a1ec;}})});}_0x48a695=_['merge']({},_0x48a695,_0x40fd6c[_0x76af('0x46')]);var _0x462a8a={'where':_0x48a695[_0x76af('0x41')]};return db[_0x76af('0x32')][_0x76af('0x21')](_0x462a8a)['then'](function(_0x4d53e0){_0x6335ec[_0x76af('0x21')]=_0x4d53e0;if(_0x40fd6c[_0x76af('0x38')][_0x76af('0x47')]){_0x48a695['include']=[{'all':!![]}];}return db[_0x76af('0x32')]['findAll'](_0x48a695);})[_0x76af('0x28')](function(_0x518fc3){_0x6335ec['rows']=_0x518fc3;return _0x6335ec;})['then'](respondWithFilteredResult(_0x4e83ce,_0x48a695))[_0x76af('0x48')](handleError(_0x4e83ce,null));};exports[_0x76af('0x49')]=function(_0x26d855,_0x117aa2){var _0x276360={'raw':!![],'where':{'id':_0x26d855[_0x76af('0x4a')]['id']}},_0x3ffb51={};_0x3ffb51['model']=_[_0x76af('0x39')](db['Template'][_0x76af('0x33')]);_0x3ffb51[_0x76af('0x38')]=_[_0x76af('0x39')](_0x26d855[_0x76af('0x38')]);_0x3ffb51[_0x76af('0x3a')]=_['intersection'](_0x3ffb51[_0x76af('0x37')],_0x3ffb51[_0x76af('0x38')]);_0x276360['attributes']=_[_0x76af('0x4b')](_0x3ffb51[_0x76af('0x37')],qs['fields'](_0x26d855[_0x76af('0x38')][_0x76af('0x3c')]));_0x276360[_0x76af('0x3b')]=_0x276360[_0x76af('0x3b')][_0x76af('0x4c')]?_0x276360[_0x76af('0x3b')]:_0x3ffb51[_0x76af('0x37')];if(_0x26d855[_0x76af('0x38')]['includeAll']){_0x276360['include']=[{'all':!![]}];}_0x276360=_['merge']({},_0x276360,_0x26d855[_0x76af('0x46')]);return db['Template']['find'](_0x276360)[_0x76af('0x28')](handleEntityNotFound(_0x117aa2,null))[_0x76af('0x28')](respondWithResult(_0x117aa2,null))[_0x76af('0x48')](handleError(_0x117aa2,null));};exports['create']=function(_0x87cdc,_0x55da6a){return db[_0x76af('0x32')]['create'](_0x87cdc[_0x76af('0x4d')],{})['then'](function(_0x2b7e01){var _0x2f8493=_0x87cdc[_0x76af('0x4e')][_0x76af('0x2a')]({'plain':!![]});if(!_0x2f8493)throw new Error(_0x76af('0x4f'));if(_0x2f8493['role']===_0x76af('0x4e')){var _0x120340=_0x2b7e01['get']({'plain':!![]});var _0x2ed9a1=_0x76af('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2ed9a1,'userProfileId':_0x2f8493['userProfileId']},'raw':!![]})[_0x76af('0x28')](function(_0x22911a){if(_0x22911a&&_0x22911a[_0x76af('0x50')]===0x0){return db['UserProfileResource'][_0x76af('0x51')]({'name':_0x120340[_0x76af('0x2f')],'resourceId':_0x120340['id'],'type':_0x22911a[_0x76af('0x2f')],'sectionId':_0x22911a['id']},{})[_0x76af('0x28')](function(){return _0x2b7e01;});}else{return _0x2b7e01;}})[_0x76af('0x48')](function(_0x427c98){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x427c98);throw _0x427c98;});}return _0x2b7e01;})[_0x76af('0x28')](respondWithResult(_0x55da6a,0xc9))[_0x76af('0x48')](handleError(_0x55da6a,null));};exports[_0x76af('0x27')]=function(_0x58b641,_0x1378cf){if(_0x58b641[_0x76af('0x4d')]['id']){delete _0x58b641[_0x76af('0x4d')]['id'];}return db['Template'][_0x76af('0x52')]({'where':{'id':_0x58b641[_0x76af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1378cf,null))[_0x76af('0x28')](saveUpdates(_0x58b641[_0x76af('0x4d')],null))[_0x76af('0x28')](respondWithResult(_0x1378cf,null))['catch'](handleError(_0x1378cf,null));};exports[_0x76af('0x29')]=function(_0x55791a,_0x5d6813){return db['Template'][_0x76af('0x52')]({'where':{'id':_0x55791a[_0x76af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d6813,null))['then'](removeEntity(_0x5d6813,null))[_0x76af('0x48')](handleError(_0x5d6813,null));}; \ No newline at end of file +var _0x453a=['sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x231389,_0x287116){var _0x2f815b=function(_0x19e9b7){while(--_0x19e9b7){_0x231389['push'](_0x231389['shift']());}};_0x2f815b(++_0x287116);}(_0x453a,0xf2));var _0xa453=function(_0x412ae1,_0x20a4c4){_0x412ae1=_0x412ae1-0x0;var _0x50bea0=_0x453a[_0x412ae1];return _0x50bea0;};'use strict';var emlformat=require(_0xa453('0x0'));var rimraf=require(_0xa453('0x1'));var zipdir=require(_0xa453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa453('0x3'));var BPromise=require(_0xa453('0x4'));var Mustache=require('mustache');var util=require(_0xa453('0x5'));var path=require(_0xa453('0x6'));var sox=require(_0xa453('0x7'));var csv=require(_0xa453('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa453('0x9'));var squel=require(_0xa453('0xa'));var crypto=require('crypto');var jsforce=require(_0xa453('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa453('0x8'));var querystring=require(_0xa453('0xc'));var Papa=require(_0xa453('0xd'));var Redis=require(_0xa453('0xe'));var authService=require(_0xa453('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa453('0x10'));var hardwareService=require(_0xa453('0x11'));var logger=require(_0xa453('0x12'))(_0xa453('0x13'));var utils=require(_0xa453('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa453('0x15'));var db=require(_0xa453('0x16'))['db'];function respondWithStatusCode(_0x579842,_0x1e31ba){_0x1e31ba=_0x1e31ba||0xcc;return function(_0x2163c2){if(_0x2163c2){return _0x579842[_0xa453('0x17')](_0x1e31ba);}return _0x579842[_0xa453('0x18')](_0x1e31ba)[_0xa453('0x19')]();};}function respondWithResult(_0x58e3d1,_0x543b97){_0x543b97=_0x543b97||0xc8;return function(_0x2cdbce){if(_0x2cdbce){return _0x58e3d1[_0xa453('0x18')](_0x543b97)['json'](_0x2cdbce);}};}function respondWithFilteredResult(_0x2aaa1b,_0x3b8328){return function(_0x180160){if(_0x180160){var _0xb1b799=typeof _0x3b8328[_0xa453('0x1a')]===_0xa453('0x1b')&&typeof _0x3b8328[_0xa453('0x1c')]===_0xa453('0x1b');var _0x3b487e=_0x180160[_0xa453('0x1d')];var _0x296eda=_0xb1b799?0x0:_0x3b8328[_0xa453('0x1a')];var _0x198641=_0xb1b799?_0x180160[_0xa453('0x1d')]:_0x3b8328['offset']+_0x3b8328[_0xa453('0x1c')];var _0x5796cd;if(_0x198641>=_0x3b487e){_0x198641=_0x3b487e;_0x5796cd=0xc8;}else{_0x5796cd=0xce;}_0x2aaa1b[_0xa453('0x18')](_0x5796cd);return _0x2aaa1b[_0xa453('0x1e')]('Content-Range',_0x296eda+'-'+_0x198641+'/'+_0x3b487e)[_0xa453('0x1f')](_0x180160);}return null;};}function patchUpdates(_0x324cf2){return function(_0x5f148b){try{jsonpatch[_0xa453('0x20')](_0x5f148b,_0x324cf2,!![]);}catch(_0x8a376){return BPromise[_0xa453('0x21')](_0x8a376);}return _0x5f148b[_0xa453('0x22')]();};}function saveUpdates(_0x5fe284,_0x58b3a7){return function(_0x7b8fde){if(_0x7b8fde){return _0x7b8fde[_0xa453('0x23')](_0x5fe284)[_0xa453('0x24')](function(_0x36092c){return _0x36092c;});}return null;};}function removeEntity(_0x111067,_0xd66ee2){return function(_0x420082){if(_0x420082){return _0x420082[_0xa453('0x25')]()[_0xa453('0x24')](function(){var _0x32af25=_0x420082[_0xa453('0x26')]({'plain':!![]});var _0x30307d=_0xa453('0x27');return db[_0xa453('0x28')][_0xa453('0x25')]({'where':{'type':_0x30307d,'resourceId':_0x32af25['id']}})['then'](function(){return _0x420082;});})[_0xa453('0x24')](function(){_0x111067[_0xa453('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d9e7,_0x11c259){return function(_0x9f87fe){if(!_0x9f87fe){_0x17d9e7[_0xa453('0x17')](0x194);}return _0x9f87fe;};}function handleError(_0x2e6fa5,_0x2bd367){_0x2bd367=_0x2bd367||0x1f4;return function(_0x7781bc){logger[_0xa453('0x29')](_0x7781bc[_0xa453('0x2a')]);if(_0x7781bc[_0xa453('0x2b')]){delete _0x7781bc[_0xa453('0x2b')];}_0x2e6fa5[_0xa453('0x18')](_0x2bd367)[_0xa453('0x2c')](_0x7781bc);};}exports['index']=function(_0x225a0b,_0x292ced){var _0x53d12a={},_0x2b98fa={},_0x4a0e63={'count':0x0,'rows':[]};var _0x4c3e0d=_[_0xa453('0x2d')](db[_0xa453('0x2e')][_0xa453('0x2f')],function(_0x4f5090){return{'name':_0x4f5090[_0xa453('0x30')],'type':_0x4f5090[_0xa453('0x31')][_0xa453('0x32')]};});_0x2b98fa['model']=_['map'](_0x4c3e0d,_0xa453('0x2b'));_0x2b98fa[_0xa453('0x33')]=_[_0xa453('0x34')](_0x225a0b[_0xa453('0x33')]);_0x2b98fa['filters']=_['intersection'](_0x2b98fa[_0xa453('0x35')],_0x2b98fa[_0xa453('0x33')]);_0x53d12a['attributes']=_['intersection'](_0x2b98fa[_0xa453('0x35')],qs[_0xa453('0x36')](_0x225a0b[_0xa453('0x33')]['fields']));_0x53d12a[_0xa453('0x37')]=_0x53d12a[_0xa453('0x37')][_0xa453('0x38')]?_0x53d12a[_0xa453('0x37')]:_0x2b98fa[_0xa453('0x35')];if(!_0x225a0b[_0xa453('0x33')]['hasOwnProperty'](_0xa453('0x39'))){_0x53d12a['limit']=qs[_0xa453('0x1c')](_0x225a0b['query'][_0xa453('0x1c')]);_0x53d12a[_0xa453('0x1a')]=qs[_0xa453('0x1a')](_0x225a0b[_0xa453('0x33')][_0xa453('0x1a')]);}_0x53d12a['order']=qs[_0xa453('0x3a')](_0x225a0b[_0xa453('0x33')][_0xa453('0x3a')]);_0x53d12a['where']=qs[_0xa453('0x3b')](_[_0xa453('0x3c')](_0x225a0b[_0xa453('0x33')],_0x2b98fa[_0xa453('0x3b')]),_0x4c3e0d);if(_0x225a0b[_0xa453('0x33')][_0xa453('0x3d')]){_0x53d12a[_0xa453('0x3e')]=_[_0xa453('0x3f')](_0x53d12a[_0xa453('0x3e')],{'$or':_['map'](_0x4c3e0d,function(_0x308d56){if(_0x308d56[_0xa453('0x31')]!==_0xa453('0x40')){var _0x145b74={};_0x145b74[_0x308d56[_0xa453('0x2b')]]={'$like':'%'+_0x225a0b[_0xa453('0x33')]['filter']+'%'};return _0x145b74;}})});}_0x53d12a=_['merge']({},_0x53d12a,_0x225a0b['options']);var _0x2dac3f={'where':_0x53d12a[_0xa453('0x3e')]};return db[_0xa453('0x2e')][_0xa453('0x1d')](_0x2dac3f)[_0xa453('0x24')](function(_0x1d503d){_0x4a0e63[_0xa453('0x1d')]=_0x1d503d;if(_0x225a0b[_0xa453('0x33')][_0xa453('0x41')]){_0x53d12a[_0xa453('0x42')]=[{'all':!![]}];}return db[_0xa453('0x2e')][_0xa453('0x43')](_0x53d12a);})[_0xa453('0x24')](function(_0x212aad){_0x4a0e63[_0xa453('0x44')]=_0x212aad;return _0x4a0e63;})[_0xa453('0x24')](respondWithFilteredResult(_0x292ced,_0x53d12a))['catch'](handleError(_0x292ced,null));};exports[_0xa453('0x45')]=function(_0x369109,_0x297c4c){var _0x364617={'raw':!![],'where':{'id':_0x369109[_0xa453('0x46')]['id']}},_0x5a58b3={};_0x5a58b3[_0xa453('0x35')]=_['keys'](db[_0xa453('0x2e')][_0xa453('0x2f')]);_0x5a58b3['query']=_[_0xa453('0x34')](_0x369109[_0xa453('0x33')]);_0x5a58b3[_0xa453('0x3b')]=_[_0xa453('0x47')](_0x5a58b3[_0xa453('0x35')],_0x5a58b3[_0xa453('0x33')]);_0x364617[_0xa453('0x37')]=_[_0xa453('0x47')](_0x5a58b3[_0xa453('0x35')],qs[_0xa453('0x36')](_0x369109[_0xa453('0x33')][_0xa453('0x36')]));_0x364617[_0xa453('0x37')]=_0x364617[_0xa453('0x37')][_0xa453('0x38')]?_0x364617[_0xa453('0x37')]:_0x5a58b3[_0xa453('0x35')];if(_0x369109[_0xa453('0x33')][_0xa453('0x41')]){_0x364617[_0xa453('0x42')]=[{'all':!![]}];}_0x364617=_['merge']({},_0x364617,_0x369109[_0xa453('0x48')]);return db[_0xa453('0x2e')][_0xa453('0x49')](_0x364617)['then'](handleEntityNotFound(_0x297c4c,null))['then'](respondWithResult(_0x297c4c,null))[_0xa453('0x4a')](handleError(_0x297c4c,null));};exports[_0xa453('0x4b')]=function(_0x305e4f,_0x4bb593){return db[_0xa453('0x2e')][_0xa453('0x4b')](_0x305e4f[_0xa453('0x4c')],{})[_0xa453('0x24')](function(_0x4dd589){var _0x578cd8=_0x305e4f[_0xa453('0x4d')][_0xa453('0x26')]({'plain':!![]});if(!_0x578cd8)throw new Error(_0xa453('0x4e'));if(_0x578cd8['role']===_0xa453('0x4d')){var _0x49a180=_0x4dd589[_0xa453('0x26')]({'plain':!![]});var _0x4d4921=_0xa453('0x27');return db[_0xa453('0x4f')][_0xa453('0x49')]({'where':{'name':_0x4d4921,'userProfileId':_0x578cd8[_0xa453('0x50')]},'raw':!![]})[_0xa453('0x24')](function(_0x4ed2fb){if(_0x4ed2fb&&_0x4ed2fb[_0xa453('0x51')]===0x0){return db['UserProfileResource'][_0xa453('0x4b')]({'name':_0x49a180[_0xa453('0x2b')],'resourceId':_0x49a180['id'],'type':_0x4ed2fb['name'],'sectionId':_0x4ed2fb['id']},{})[_0xa453('0x24')](function(){return _0x4dd589;});}else{return _0x4dd589;}})[_0xa453('0x4a')](function(_0x387b50){logger[_0xa453('0x29')](_0xa453('0x52'),_0x387b50);throw _0x387b50;});}return _0x4dd589;})[_0xa453('0x24')](respondWithResult(_0x4bb593,0xc9))['catch'](handleError(_0x4bb593,null));};exports[_0xa453('0x23')]=function(_0x492014,_0x948887){if(_0x492014[_0xa453('0x4c')]['id']){delete _0x492014[_0xa453('0x4c')]['id'];}return db[_0xa453('0x2e')][_0xa453('0x49')]({'where':{'id':_0x492014[_0xa453('0x46')]['id']}})[_0xa453('0x24')](handleEntityNotFound(_0x948887,null))['then'](saveUpdates(_0x492014['body'],null))[_0xa453('0x24')](respondWithResult(_0x948887,null))[_0xa453('0x4a')](handleError(_0x948887,null));};exports[_0xa453('0x25')]=function(_0xe9df30,_0x5d02ae){return db['Template'][_0xa453('0x49')]({'where':{'id':_0xe9df30[_0xa453('0x46')]['id']}})[_0xa453('0x24')](handleEntityNotFound(_0x5d02ae,null))['then'](removeEntity(_0x5d02ae,null))['catch'](handleError(_0x5d02ae,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 102630a..d326623 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 _0x87a8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','Template','tools_templates'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x87a8,0x190));var _0x887a=function(_0x997222,_0x5c0bd8){_0x997222=_0x997222-0x0;var _0x4b8869=_0x87a8[_0x997222];return _0x4b8869;};'use strict';var _=require('lodash');var util=require(_0x887a('0x0'));var logger=require(_0x887a('0x1'))(_0x887a('0x2'));var moment=require(_0x887a('0x3'));var BPromise=require(_0x887a('0x4'));var rp=require(_0x887a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x887a('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x887a('0x7')]=function(_0x27049d,_0x4412b7){return _0x27049d['define'](_0x887a('0x8'),attributes,{'tableName':_0x887a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef9c=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','request-promise'];(function(_0x21df37,_0x426666){var _0x1b4b9f=function(_0x4a7962){while(--_0x4a7962){_0x21df37['push'](_0x21df37['shift']());}};_0x1b4b9f(++_0x426666);}(_0xef9c,0x125));var _0xcef9=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xef9c[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xcef9('0x0'));var util=require(_0xcef9('0x1'));var logger=require('../../config/logger')(_0xcef9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcef9('0x3'));var fs=require('fs');var path=require(_0xcef9('0x4'));var rimraf=require(_0xcef9('0x5'));var config=require('../../config/environment');var attributes=require(_0xcef9('0x6'));module[_0xcef9('0x7')]=function(_0x4295f0,_0x2ce5df){return _0x4295f0[_0xcef9('0x8')](_0xcef9('0x9'),attributes,{'tableName':_0xcef9('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 0033dfc..8898f8f 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 _0xc0a6=['attributes','include','map','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','limit','model'];(function(_0x14911e,_0x578e33){var _0x46ed87=function(_0x315ad6){while(--_0x315ad6){_0x14911e['push'](_0x14911e['shift']());}};_0x46ed87(++_0x578e33);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x3f9a09,_0x59befb){_0x3f9a09=_0x3f9a09-0x0;var _0xe1b0c1=_0xc0a6[_0x3f9a09];return _0xe1b0c1;};'use strict';var _=require(_0x6c0a('0x0'));var util=require(_0x6c0a('0x1'));var moment=require('moment');var BPromise=require(_0x6c0a('0x2'));var rs=require(_0x6c0a('0x3'));var fs=require('fs');var Redis=require(_0x6c0a('0x4'));var db=require(_0x6c0a('0x5'))['db'];var utils=require(_0x6c0a('0x6'));var logger=require(_0x6c0a('0x7'))(_0x6c0a('0x8'));var config=require(_0x6c0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6c0a('0xa')][_0x6c0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x416ceb,_0x415ded,_0x48695b){return new BPromise(function(_0x344873,_0x40098b){return client['request'](_0x416ceb,_0x48695b)[_0x6c0a('0xc')](function(_0x4f133c){logger[_0x6c0a('0xd')]('Template,\x20%s,\x20%s',_0x415ded,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x415ded,_0x6c0a('0xe'),JSON['stringify'](_0x4f133c));if(_0x4f133c[_0x6c0a('0xf')]){if(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x10')]===0x1f4){logger['error'](_0x6c0a('0x11'),_0x415ded,_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);return _0x40098b(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);}logger[_0x6c0a('0xf')]('Template,\x20%s,\x20%s',_0x415ded,_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);return _0x344873(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);}else{logger[_0x6c0a('0xd')](_0x6c0a('0x11'),_0x415ded,_0x6c0a('0xe'));_0x344873(_0x4f133c[_0x6c0a('0x13')][_0x6c0a('0x12')]);}})[_0x6c0a('0x14')](function(_0x140803){logger[_0x6c0a('0xf')]('Template,\x20%s,\x20%s',_0x415ded,_0x140803);_0x40098b(_0x140803);});});}exports[_0x6c0a('0x15')]=function(_0x373988){var _0x394b67=this;return new Promise(function(_0x3038d8,_0x20c261){return db[_0x6c0a('0x16')][_0x6c0a('0x17')]({'raw':_0x373988[_0x6c0a('0x18')]?_0x373988['options'][_0x6c0a('0x19')]===undefined?!![]:![]:!![],'where':_0x373988[_0x6c0a('0x18')]?_0x373988['options']['where']||null:null,'attributes':_0x373988[_0x6c0a('0x18')]?_0x373988[_0x6c0a('0x18')]['attributes']||null:null,'limit':_0x373988['options']?_0x373988[_0x6c0a('0x18')][_0x6c0a('0x1a')]||null:null,'include':_0x373988[_0x6c0a('0x18')]?_0x373988[_0x6c0a('0x18')]['include']?_['map'](_0x373988[_0x6c0a('0x18')]['include'],function(_0x307fbb){return{'model':db[_0x307fbb[_0x6c0a('0x1b')]],'as':_0x307fbb['as'],'attributes':_0x307fbb[_0x6c0a('0x1c')],'include':_0x307fbb[_0x6c0a('0x1d')]?_[_0x6c0a('0x1e')](_0x307fbb[_0x6c0a('0x1d')],function(_0x39745b){return{'model':db[_0x39745b[_0x6c0a('0x1b')]],'as':_0x39745b['as'],'attributes':_0x39745b[_0x6c0a('0x1c')],'include':_0x39745b['include']?_[_0x6c0a('0x1e')](_0x39745b[_0x6c0a('0x1d')],function(_0xb8170b){return{'model':db[_0xb8170b[_0x6c0a('0x1b')]],'as':_0xb8170b['as'],'attributes':_0xb8170b[_0x6c0a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c0a('0xc')](function(_0x3b27be){logger[_0x6c0a('0xd')](_0x6c0a('0x15'),_0x373988);logger[_0x6c0a('0x1f')](_0x6c0a('0x15'),_0x373988,JSON[_0x6c0a('0x20')](_0x3b27be));_0x3038d8(_0x3b27be);})[_0x6c0a('0x14')](function(_0x25e860){logger[_0x6c0a('0xf')]('GetTemplate',_0x25e860['message'],_0x373988);_0x20c261(_0x394b67['error'](0x1f4,_0x25e860[_0x6c0a('0x12')]));});});}; \ No newline at end of file +var _0x98f1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','limit','include','map','model','attributes','moment','bluebird'];(function(_0x5dba8e,_0x4bae0b){var _0x2abe77=function(_0x6ee09a){while(--_0x6ee09a){_0x5dba8e['push'](_0x5dba8e['shift']());}};_0x2abe77(++_0x4bae0b);}(_0x98f1,0x1cf));var _0x198f=function(_0x1b701a,_0x126512){_0x1b701a=_0x1b701a-0x0;var _0xb92894=_0x98f1[_0x1b701a];return _0xb92894;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x198f('0x0'));var BPromise=require(_0x198f('0x1'));var rs=require(_0x198f('0x2'));var fs=require('fs');var Redis=require(_0x198f('0x3'));var db=require(_0x198f('0x4'))['db'];var utils=require(_0x198f('0x5'));var logger=require('../../config/logger')(_0x198f('0x6'));var config=require(_0x198f('0x7'));var jayson=require(_0x198f('0x8'));var client=jayson['client'][_0x198f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193097,_0x387f25,_0x5f55ad){return new BPromise(function(_0x36474d,_0x48d681){return client[_0x198f('0xa')](_0x193097,_0x5f55ad)[_0x198f('0xb')](function(_0x399405){logger[_0x198f('0xc')](_0x198f('0xd'),_0x387f25,_0x198f('0xe'));logger[_0x198f('0xf')](_0x198f('0x10'),_0x387f25,_0x198f('0xe'),JSON[_0x198f('0x11')](_0x399405));if(_0x399405[_0x198f('0x12')]){if(_0x399405[_0x198f('0x12')]['code']===0x1f4){logger[_0x198f('0x12')](_0x198f('0xd'),_0x387f25,_0x399405[_0x198f('0x12')][_0x198f('0x13')]);return _0x48d681(_0x399405[_0x198f('0x12')][_0x198f('0x13')]);}logger[_0x198f('0x12')]('Template,\x20%s,\x20%s',_0x387f25,_0x399405[_0x198f('0x12')][_0x198f('0x13')]);return _0x36474d(_0x399405['error'][_0x198f('0x13')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x387f25,_0x198f('0xe'));_0x36474d(_0x399405['result'][_0x198f('0x13')]);}})[_0x198f('0x14')](function(_0x50cdd0){logger[_0x198f('0x12')]('Template,\x20%s,\x20%s',_0x387f25,_0x50cdd0);_0x48d681(_0x50cdd0);});});}exports[_0x198f('0x15')]=function(_0x4f2557){var _0x4a9d5d=this;return new Promise(function(_0x14cfb1,_0x2fa4cd){return db[_0x198f('0x16')][_0x198f('0x17')]({'raw':_0x4f2557['options']?_0x4f2557[_0x198f('0x18')][_0x198f('0x19')]===undefined?!![]:![]:!![],'where':_0x4f2557[_0x198f('0x18')]?_0x4f2557['options']['where']||null:null,'attributes':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')]['attributes']||null:null,'limit':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')][_0x198f('0x1a')]||null:null,'include':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')][_0x198f('0x1b')]?_[_0x198f('0x1c')](_0x4f2557[_0x198f('0x18')][_0x198f('0x1b')],function(_0x48b632){return{'model':db[_0x48b632[_0x198f('0x1d')]],'as':_0x48b632['as'],'attributes':_0x48b632[_0x198f('0x1e')],'include':_0x48b632[_0x198f('0x1b')]?_[_0x198f('0x1c')](_0x48b632[_0x198f('0x1b')],function(_0x5b0fdd){return{'model':db[_0x5b0fdd[_0x198f('0x1d')]],'as':_0x5b0fdd['as'],'attributes':_0x5b0fdd[_0x198f('0x1e')],'include':_0x5b0fdd[_0x198f('0x1b')]?_['map'](_0x5b0fdd[_0x198f('0x1b')],function(_0x511c32){return{'model':db[_0x511c32['model']],'as':_0x511c32['as'],'attributes':_0x511c32[_0x198f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x198f('0xb')](function(_0x1f9707){logger['info']('GetTemplate',_0x4f2557);logger['debug']('GetTemplate',_0x4f2557,JSON[_0x198f('0x11')](_0x1f9707));_0x14cfb1(_0x1f9707);})['catch'](function(_0x15e9d8){logger[_0x198f('0x12')](_0x198f('0x15'),_0x15e9d8[_0x198f('0x13')],_0x4f2557);_0x2fa4cd(_0x4a9d5d['error'](0x1f4,_0x15e9d8[_0x198f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c5d5b6d..da40600 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 _0x7d26=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put'];(function(_0x256f90,_0x2187a6){var _0x415016=function(_0x43fcd6){while(--_0x43fcd6){_0x256f90['push'](_0x256f90['shift']());}};_0x415016(++_0x2187a6);}(_0x7d26,0x16f));var _0x67d2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7d26[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x67d2('0x0'));var path=require('path');var timeout=require(_0x67d2('0x1'));var express=require(_0x67d2('0x2'));var router=express[_0x67d2('0x3')]();var fs_extra=require(_0x67d2('0x4'));var auth=require(_0x67d2('0x5'));var interaction=require(_0x67d2('0x6'));var config=require(_0x67d2('0x7'));var controller=require(_0x67d2('0x8'));router[_0x67d2('0x9')]('/',auth[_0x67d2('0xa')](),controller['index']);router[_0x67d2('0x9')](_0x67d2('0xb'),auth[_0x67d2('0xa')](),controller[_0x67d2('0xc')]);router[_0x67d2('0x9')](_0x67d2('0xd'),auth[_0x67d2('0xa')](),controller[_0x67d2('0xe')]);router[_0x67d2('0x9')]('/:id/any_conditions',auth[_0x67d2('0xa')](),controller[_0x67d2('0xf')]);router['get']('/:id/actions',auth[_0x67d2('0xa')](),controller[_0x67d2('0x10')]);router[_0x67d2('0x11')]('/',auth['isAuthenticated'](),controller[_0x67d2('0x12')]);router[_0x67d2('0x11')](_0x67d2('0xd'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x13')]);router[_0x67d2('0x11')](_0x67d2('0x14'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x15')]);router['post'](_0x67d2('0x16'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x17')]);router[_0x67d2('0x18')](_0x67d2('0xb'),auth[_0x67d2('0xa')](),controller['update']);router[_0x67d2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x67d2('0x1a')]);module[_0x67d2('0x1b')]=router; \ No newline at end of file +var _0x5692=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer'];(function(_0x3474c8,_0x433a13){var _0x41b56d=function(_0x44bf3a){while(--_0x44bf3a){_0x3474c8['push'](_0x3474c8['shift']());}};_0x41b56d(++_0x433a13);}(_0x5692,0x144));var _0x2569=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5692[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x2569('0x0'));var util=require('util');var path=require(_0x2569('0x1'));var timeout=require('connect-timeout');var express=require(_0x2569('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2569('0x3'));var interaction=require(_0x2569('0x4'));var config=require(_0x2569('0x5'));var controller=require(_0x2569('0x6'));router[_0x2569('0x7')]('/',auth[_0x2569('0x8')](),controller[_0x2569('0x9')]);router[_0x2569('0x7')]('/:id',auth[_0x2569('0x8')](),controller[_0x2569('0xa')]);router['get'](_0x2569('0xb'),auth[_0x2569('0x8')](),controller['getAllConditions']);router[_0x2569('0x7')](_0x2569('0xc'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x2569('0x7')](_0x2569('0xd'),auth[_0x2569('0x8')](),controller['getActions']);router[_0x2569('0xe')]('/',auth[_0x2569('0x8')](),controller[_0x2569('0xf')]);router['post'](_0x2569('0xb'),auth[_0x2569('0x8')](),controller[_0x2569('0x10')]);router[_0x2569('0xe')](_0x2569('0xc'),auth['isAuthenticated'](),controller[_0x2569('0x11')]);router[_0x2569('0xe')](_0x2569('0xd'),auth['isAuthenticated'](),controller[_0x2569('0x12')]);router[_0x2569('0x13')](_0x2569('0x14'),auth[_0x2569('0x8')](),controller[_0x2569('0x15')]);router[_0x2569('0x16')](_0x2569('0x14'),auth[_0x2569('0x8')](),controller[_0x2569('0x17')]);module[_0x2569('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1f74c1b..dfae6b7 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 _0xd4dd=['sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd4dd,0x1b9));var _0xdd4d=function(_0x308100,_0xb8369c){_0x308100=_0x308100-0x0;var _0x3f0f1c=_0xd4dd[_0x308100];return _0x3f0f1c;};'use strict';var Sequelize=require(_0xdd4d('0x0'));module[_0xdd4d('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd4d('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x245d=['sequelize','exports','STRING'];(function(_0x3faa78,_0x120a2b){var _0x1012bf=function(_0x56a9cf){while(--_0x56a9cf){_0x3faa78['push'](_0x3faa78['shift']());}};_0x1012bf(++_0x120a2b);}(_0x245d,0x126));var _0xd245=function(_0x2f6ea1,_0x1a5aa3){_0x2f6ea1=_0x2f6ea1-0x0;var _0x2e6309=_0x245d[_0x2f6ea1];return _0x2e6309;};'use strict';var Sequelize=require(_0xd245('0x0'));module[_0xd245('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd245('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 04124df..2d6de88 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 _0xc723=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','reject','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','Trigger','rawAttributes','type','query','intersection','fields','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','attributes','length','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','order','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x2204f9,_0x186399){var _0x3bf444=function(_0x2f086a){while(--_0x2f086a){_0x2204f9['push'](_0x2204f9['shift']());}};_0x3bf444(++_0x186399);}(_0xc723,0x103));var _0x3c72=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0xc723[_0x4e82ff];return _0x495205;};'use strict';var emlformat=require(_0x3c72('0x0'));var rimraf=require(_0x3c72('0x1'));var zipdir=require(_0x3c72('0x2'));var jsonpatch=require(_0x3c72('0x3'));var rp=require(_0x3c72('0x4'));var moment=require(_0x3c72('0x5'));var BPromise=require(_0x3c72('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3c72('0x7'));var ejs=require(_0x3c72('0x8'));var fs=require('fs');var fs_extra=require(_0x3c72('0x9'));var _=require(_0x3c72('0xa'));var squel=require('squel');var crypto=require(_0x3c72('0xb'));var jsforce=require(_0x3c72('0xc'));var deskjs=require(_0x3c72('0xd'));var toCsv=require(_0x3c72('0x7'));var querystring=require(_0x3c72('0xe'));var Papa=require(_0x3c72('0xf'));var Redis=require(_0x3c72('0x10'));var authService=require(_0x3c72('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c72('0x12'));var logger=require(_0x3c72('0x13'))(_0x3c72('0x14'));var utils=require(_0x3c72('0x15'));var config=require(_0x3c72('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c72('0x17'))['db'];function respondWithStatusCode(_0x3ed882,_0x481699){_0x481699=_0x481699||0xcc;return function(_0x10f95e){if(_0x10f95e){return _0x3ed882['sendStatus'](_0x481699);}return _0x3ed882[_0x3c72('0x18')](_0x481699)[_0x3c72('0x19')]();};}function respondWithResult(_0x4aef4f,_0x404f3b){_0x404f3b=_0x404f3b||0xc8;return function(_0x7cc976){if(_0x7cc976){return _0x4aef4f[_0x3c72('0x18')](_0x404f3b)['json'](_0x7cc976);}};}function respondWithFilteredResult(_0xcd8980,_0x1c5dc6){return function(_0x587b3a){if(_0x587b3a){var _0x5ab0ea=typeof _0x1c5dc6[_0x3c72('0x1a')]===_0x3c72('0x1b')&&typeof _0x1c5dc6[_0x3c72('0x1c')]===_0x3c72('0x1b');var _0x47fd56=_0x587b3a['count'];var _0x522af6=_0x5ab0ea?0x0:_0x1c5dc6[_0x3c72('0x1a')];var _0x5f4b7b=_0x5ab0ea?_0x587b3a['count']:_0x1c5dc6[_0x3c72('0x1a')]+_0x1c5dc6['limit'];var _0x5b7a37;if(_0x5f4b7b>=_0x47fd56){_0x5f4b7b=_0x47fd56;_0x5b7a37=0xc8;}else{_0x5b7a37=0xce;}_0xcd8980['status'](_0x5b7a37);return _0xcd8980[_0x3c72('0x1d')]('Content-Range',_0x522af6+'-'+_0x5f4b7b+'/'+_0x47fd56)[_0x3c72('0x1e')](_0x587b3a);}return null;};}function patchUpdates(_0x37e11d){return function(_0xf18338){try{jsonpatch['apply'](_0xf18338,_0x37e11d,!![]);}catch(_0xb8c15c){return BPromise[_0x3c72('0x1f')](_0xb8c15c);}return _0xf18338[_0x3c72('0x20')]();};}function saveUpdates(_0x125ce4,_0x5cde37){return function(_0x924d8){if(_0x924d8){return _0x924d8['update'](_0x125ce4)[_0x3c72('0x21')](function(_0x866c5a){return _0x866c5a;});}return null;};}function removeEntity(_0x48adaa,_0x18af15){return function(_0x11372f){if(_0x11372f){return _0x11372f[_0x3c72('0x22')]()[_0x3c72('0x21')](function(){var _0x1d1117=_0x11372f['get']({'plain':!![]});var _0x2c1f3f='Triggers';return db[_0x3c72('0x23')]['destroy']({'where':{'type':_0x2c1f3f,'resourceId':_0x1d1117['id']}})['then'](function(){return _0x11372f;});})[_0x3c72('0x21')](function(){_0x48adaa['status'](0xcc)[_0x3c72('0x19')]();});}};}function handleEntityNotFound(_0x4b2801,_0xfc2966){return function(_0x572b32){if(!_0x572b32){_0x4b2801[_0x3c72('0x24')](0x194);}return _0x572b32;};}function handleError(_0xeec244,_0x49707a){_0x49707a=_0x49707a||0x1f4;return function(_0x371c58){logger[_0x3c72('0x25')](_0x371c58[_0x3c72('0x26')]);if(_0x371c58[_0x3c72('0x27')]){delete _0x371c58[_0x3c72('0x27')];}_0xeec244['status'](_0x49707a)[_0x3c72('0x28')](_0x371c58);};}exports['index']=function(_0x1645ac,_0x31bf96){var _0x576e43={},_0x243866={},_0x53fe7a={'count':0x0,'rows':[]};var _0x1537c8=_[_0x3c72('0x29')](db[_0x3c72('0x2a')][_0x3c72('0x2b')],function(_0x9297e7){return{'name':_0x9297e7['fieldName'],'type':_0x9297e7[_0x3c72('0x2c')]['key']};});_0x243866['model']=_['map'](_0x1537c8,_0x3c72('0x27'));_0x243866['query']=_['keys'](_0x1645ac[_0x3c72('0x2d')]);_0x243866['filters']=_[_0x3c72('0x2e')](_0x243866['model'],_0x243866[_0x3c72('0x2d')]);_0x576e43['attributes']=_[_0x3c72('0x2e')](_0x243866['model'],qs[_0x3c72('0x2f')](_0x1645ac[_0x3c72('0x2d')]['fields']));_0x576e43['attributes']=_0x576e43['attributes']['length']?_0x576e43['attributes']:_0x243866[_0x3c72('0x30')];if(!_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x31')](_0x3c72('0x32'))){_0x576e43[_0x3c72('0x1c')]=qs[_0x3c72('0x1c')](_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x576e43[_0x3c72('0x1a')]=qs['offset'](_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x1a')]);}_0x576e43['order']=qs[_0x3c72('0x33')](_0x1645ac[_0x3c72('0x2d')]['sort']);_0x576e43[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x1645ac[_0x3c72('0x2d')],_0x243866[_0x3c72('0x35')]),_0x1537c8);if(_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x576e43[_0x3c72('0x34')]=_[_0x3c72('0x38')](_0x576e43[_0x3c72('0x34')],{'$or':_[_0x3c72('0x29')](_0x1537c8,function(_0x3b3b1f){if(_0x3b3b1f[_0x3c72('0x2c')]!==_0x3c72('0x39')){var _0xdb5b50={};_0xdb5b50[_0x3b3b1f[_0x3c72('0x27')]]={'$like':'%'+_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x37')]+'%'};return _0xdb5b50;}})});}_0x576e43=_[_0x3c72('0x38')]({},_0x576e43,_0x1645ac[_0x3c72('0x3a')]);var _0x5f3aa9={'where':_0x576e43[_0x3c72('0x34')]};return db[_0x3c72('0x2a')][_0x3c72('0x3b')](_0x5f3aa9)[_0x3c72('0x21')](function(_0xc1db1b){_0x53fe7a['count']=_0xc1db1b;if(_0x1645ac['query'][_0x3c72('0x3c')]){_0x576e43[_0x3c72('0x3d')]=[{'all':!![]}];}return db[_0x3c72('0x2a')][_0x3c72('0x3e')](_0x576e43);})[_0x3c72('0x21')](function(_0x5c03db){_0x53fe7a['rows']=_0x5c03db;return _0x53fe7a;})[_0x3c72('0x21')](respondWithFilteredResult(_0x31bf96,_0x576e43))[_0x3c72('0x3f')](handleError(_0x31bf96,null));};exports['show']=function(_0xc7f682,_0x1949d4){var _0x5e8b35={'raw':![],'where':{'id':_0xc7f682[_0x3c72('0x40')]['id']}},_0x5b21cb={};_0x5b21cb[_0x3c72('0x30')]=_[_0x3c72('0x41')](db[_0x3c72('0x2a')]['rawAttributes']);_0x5b21cb[_0x3c72('0x2d')]=_[_0x3c72('0x41')](_0xc7f682[_0x3c72('0x2d')]);_0x5b21cb[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x5b21cb['model'],_0x5b21cb['query']);_0x5e8b35[_0x3c72('0x42')]=_['intersection'](_0x5b21cb['model'],qs[_0x3c72('0x2f')](_0xc7f682[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x5e8b35[_0x3c72('0x42')]=_0x5e8b35[_0x3c72('0x42')][_0x3c72('0x43')]?_0x5e8b35[_0x3c72('0x42')]:_0x5b21cb[_0x3c72('0x30')];if(_0xc7f682[_0x3c72('0x2d')][_0x3c72('0x3c')]){_0x5e8b35[_0x3c72('0x3d')]=[{'all':!![]}];}_0x5e8b35=_['merge']({},_0x5e8b35,_0xc7f682[_0x3c72('0x3a')]);return db[_0x3c72('0x2a')]['find'](_0x5e8b35)[_0x3c72('0x21')](handleEntityNotFound(_0x1949d4,null))[_0x3c72('0x21')](respondWithResult(_0x1949d4,null))[_0x3c72('0x3f')](handleError(_0x1949d4,null));};exports[_0x3c72('0x44')]=function(_0x48d1c0,_0x502c72){return db['Trigger'][_0x3c72('0x44')](_0x48d1c0[_0x3c72('0x45')],{})[_0x3c72('0x21')](function(_0x47fe96){var _0x594f7b=_0x48d1c0['user'][_0x3c72('0x46')]({'plain':!![]});if(!_0x594f7b)throw new Error(_0x3c72('0x47'));if(_0x594f7b[_0x3c72('0x48')]===_0x3c72('0x49')){var _0x244d8a=_0x47fe96[_0x3c72('0x46')]({'plain':!![]});var _0x1f055b=_0x3c72('0x4a');return db[_0x3c72('0x4b')][_0x3c72('0x4c')]({'where':{'name':_0x1f055b,'userProfileId':_0x594f7b[_0x3c72('0x4d')]},'raw':!![]})[_0x3c72('0x21')](function(_0x497920){if(_0x497920&&_0x497920[_0x3c72('0x4e')]===0x0){return db[_0x3c72('0x23')][_0x3c72('0x44')]({'name':_0x244d8a[_0x3c72('0x27')],'resourceId':_0x244d8a['id'],'type':_0x497920[_0x3c72('0x27')],'sectionId':_0x497920['id']},{})[_0x3c72('0x21')](function(){return _0x47fe96;});}else{return _0x47fe96;}})['catch'](function(_0x40b233){logger['error'](_0x3c72('0x4f'),_0x40b233);throw _0x40b233;});}return _0x47fe96;})['then'](respondWithResult(_0x502c72,0xc9))['catch'](handleError(_0x502c72,null));};exports[_0x3c72('0x50')]=function(_0x380a2f,_0x3c9302){if(_0x380a2f[_0x3c72('0x45')]['id']){delete _0x380a2f[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x380a2f[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x3c9302,null))[_0x3c72('0x21')](saveUpdates(_0x380a2f[_0x3c72('0x45')],null))['then'](respondWithResult(_0x3c9302,null))['catch'](handleError(_0x3c9302,null));};exports[_0x3c72('0x22')]=function(_0x447549,_0x46abcf){return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x447549['params']['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x46abcf,null))[_0x3c72('0x21')](removeEntity(_0x46abcf,null))[_0x3c72('0x3f')](handleError(_0x46abcf,null));};exports[_0x3c72('0x51')]=function(_0x1679b3,_0x935c66,_0x51e076){if(_0x1679b3[_0x3c72('0x45')]['id']){delete _0x1679b3[_0x3c72('0x45')]['id'];}return db['Trigger'][_0x3c72('0x4c')]({'where':{'id':_0x1679b3[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x935c66,null))[_0x3c72('0x21')](function(_0x54d482){if(_0x54d482){_0x1679b3['body']['TriggerAllId']=_0x54d482['id'];return db[_0x3c72('0x52')]['create'](_0x1679b3['body']);}})[_0x3c72('0x21')](respondWithResult(_0x935c66,null))['catch'](handleError(_0x935c66,null));};exports[_0x3c72('0x53')]=function(_0x978982,_0x4a39c1,_0x4cf55f){if(_0x978982[_0x3c72('0x45')]['id']){delete _0x978982[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x978982[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x4a39c1,null))[_0x3c72('0x21')](function(_0x5a99e3){if(_0x5a99e3){_0x978982[_0x3c72('0x45')][_0x3c72('0x54')]=_0x5a99e3['id'];return db[_0x3c72('0x52')][_0x3c72('0x44')](_0x978982[_0x3c72('0x45')]);}})[_0x3c72('0x21')](respondWithResult(_0x4a39c1,null))[_0x3c72('0x3f')](handleError(_0x4a39c1,null));};exports[_0x3c72('0x55')]=function(_0x135059,_0x390f03,_0x12a6cd){var _0x118703={};var _0x310e79={};var _0x3be472;var _0x26eb18;return db[_0x3c72('0x2a')]['findOne']({'where':{'id':_0x135059[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x390f03,null))[_0x3c72('0x21')](function(_0x111e0d){if(_0x111e0d){_0x3be472=_0x111e0d;_0x310e79[_0x3c72('0x30')]=_[_0x3c72('0x41')](db[_0x3c72('0x52')][_0x3c72('0x2b')]);_0x310e79['query']=_[_0x3c72('0x41')](_0x135059[_0x3c72('0x2d')]);_0x310e79[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x310e79[_0x3c72('0x30')],_0x310e79[_0x3c72('0x2d')]);_0x118703[_0x3c72('0x42')]=_[_0x3c72('0x2e')](_0x310e79[_0x3c72('0x30')],qs[_0x3c72('0x2f')](_0x135059['query']['fields']));_0x118703[_0x3c72('0x42')]=_0x118703[_0x3c72('0x42')][_0x3c72('0x43')]?_0x118703['attributes']:_0x310e79['model'];_0x118703['order']=qs[_0x3c72('0x33')](_0x135059[_0x3c72('0x2d')]['sort']);_0x118703[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x135059[_0x3c72('0x2d')],_0x310e79['filters']));if(_0x135059['query']['filter']){_0x118703[_0x3c72('0x34')]=_[_0x3c72('0x38')](_0x118703[_0x3c72('0x34')],{'$or':_['map'](_0x118703[_0x3c72('0x42')],function(_0x11432b){var _0x2c4e83={};_0x2c4e83[_0x11432b]={'$like':'%'+_0x135059[_0x3c72('0x2d')][_0x3c72('0x37')]+'%'};return _0x2c4e83;})});}_0x118703=_[_0x3c72('0x38')]({},_0x118703,_0x135059[_0x3c72('0x3a')]);return _0x3be472[_0x3c72('0x55')](_0x118703);}})[_0x3c72('0x21')](function(_0xd2d579){if(_0xd2d579){_0x26eb18=_0xd2d579[_0x3c72('0x43')];if(!_0x135059[_0x3c72('0x2d')]['hasOwnProperty'](_0x3c72('0x32'))){_0x118703['limit']=qs[_0x3c72('0x1c')](_0x135059[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x118703[_0x3c72('0x1a')]=qs[_0x3c72('0x1a')](_0x135059[_0x3c72('0x2d')][_0x3c72('0x1a')]);}return _0x3be472[_0x3c72('0x55')](_0x118703);}})[_0x3c72('0x21')](function(_0x576ded){if(_0x576ded){return _0x576ded?{'count':_0x26eb18,'rows':_0x576ded}:null;}})[_0x3c72('0x21')](respondWithResult(_0x390f03,null))[_0x3c72('0x3f')](handleError(_0x390f03,null));};exports[_0x3c72('0x56')]=function(_0x48dffc,_0x2c203b,_0x267e22){var _0x1c1cb3={};var _0x79c775={};var _0x6ca34a;var _0x58eb88;return db['Trigger'][_0x3c72('0x57')]({'where':{'id':_0x48dffc[_0x3c72('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c203b,null))[_0x3c72('0x21')](function(_0xebb636){if(_0xebb636){_0x6ca34a=_0xebb636;_0x79c775['model']=_[_0x3c72('0x41')](db['Condition'][_0x3c72('0x2b')]);_0x79c775[_0x3c72('0x2d')]=_[_0x3c72('0x41')](_0x48dffc[_0x3c72('0x2d')]);_0x79c775[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x79c775[_0x3c72('0x30')],_0x79c775[_0x3c72('0x2d')]);_0x1c1cb3['attributes']=_[_0x3c72('0x2e')](_0x79c775['model'],qs['fields'](_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x1c1cb3[_0x3c72('0x42')]=_0x1c1cb3[_0x3c72('0x42')][_0x3c72('0x43')]?_0x1c1cb3[_0x3c72('0x42')]:_0x79c775[_0x3c72('0x30')];_0x1c1cb3['order']=qs[_0x3c72('0x33')](_0x48dffc[_0x3c72('0x2d')]['sort']);_0x1c1cb3['where']=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x48dffc['query'],_0x79c775[_0x3c72('0x35')]));if(_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x1c1cb3['where']=_['merge'](_0x1c1cb3['where'],{'$or':_[_0x3c72('0x29')](_0x1c1cb3['attributes'],function(_0x2cc4be){var _0x673080={};_0x673080[_0x2cc4be]={'$like':'%'+_0x48dffc['query']['filter']+'%'};return _0x673080;})});}_0x1c1cb3=_[_0x3c72('0x38')]({},_0x1c1cb3,_0x48dffc[_0x3c72('0x3a')]);return _0x6ca34a[_0x3c72('0x56')](_0x1c1cb3);}})[_0x3c72('0x21')](function(_0x3ff378){if(_0x3ff378){_0x58eb88=_0x3ff378[_0x3c72('0x43')];if(!_0x48dffc['query'][_0x3c72('0x31')](_0x3c72('0x32'))){_0x1c1cb3[_0x3c72('0x1c')]=qs['limit'](_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x1c1cb3['offset']=qs[_0x3c72('0x1a')](_0x48dffc[_0x3c72('0x2d')]['offset']);}return _0x6ca34a[_0x3c72('0x56')](_0x1c1cb3);}})[_0x3c72('0x21')](function(_0x37d405){if(_0x37d405){return _0x37d405?{'count':_0x58eb88,'rows':_0x37d405}:null;}})['then'](respondWithResult(_0x2c203b,null))[_0x3c72('0x3f')](handleError(_0x2c203b,null));};exports[_0x3c72('0x58')]=function(_0xe41d52,_0x2a11c3,_0x357924){if(_0xe41d52['body']['id']){delete _0xe41d52[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')]['find']({'where':{'id':_0xe41d52[_0x3c72('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a11c3,null))[_0x3c72('0x21')](function(_0x316883){if(_0x316883){_0xe41d52['body'][_0x3c72('0x59')]=_0x316883['id'];return db['Action'][_0x3c72('0x44')](_0xe41d52[_0x3c72('0x45')]);}})['then'](respondWithResult(_0x2a11c3,null))[_0x3c72('0x3f')](handleError(_0x2a11c3,null));};exports['getActions']=function(_0xe3c238,_0x40629d,_0x1f30a3){var _0x13a270={};var _0x4294a2={};var _0x4a7f30;var _0x3203;return db[_0x3c72('0x2a')][_0x3c72('0x57')]({'where':{'id':_0xe3c238[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x40629d,null))['then'](function(_0x31fa8c){if(_0x31fa8c){_0x4a7f30=_0x31fa8c;_0x4294a2[_0x3c72('0x30')]=_['keys'](db[_0x3c72('0x5a')][_0x3c72('0x2b')]);_0x4294a2['query']=_['keys'](_0xe3c238['query']);_0x4294a2[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x4294a2['model'],_0x4294a2['query']);_0x13a270[_0x3c72('0x42')]=_[_0x3c72('0x2e')](_0x4294a2[_0x3c72('0x30')],qs['fields'](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x13a270[_0x3c72('0x42')]=_0x13a270['attributes'][_0x3c72('0x43')]?_0x13a270[_0x3c72('0x42')]:_0x4294a2[_0x3c72('0x30')];_0x13a270[_0x3c72('0x5b')]=qs[_0x3c72('0x33')](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x33')]);_0x13a270[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_['pick'](_0xe3c238['query'],_0x4294a2[_0x3c72('0x35')]));if(_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x13a270[_0x3c72('0x34')]=_['merge'](_0x13a270[_0x3c72('0x34')],{'$or':_['map'](_0x13a270[_0x3c72('0x42')],function(_0x58704a){var _0x2ee403={};_0x2ee403[_0x58704a]={'$like':'%'+_0xe3c238['query'][_0x3c72('0x37')]+'%'};return _0x2ee403;})});}_0x13a270=_[_0x3c72('0x38')]({},_0x13a270,_0xe3c238[_0x3c72('0x3a')]);return _0x4a7f30[_0x3c72('0x5c')](_0x13a270);}})[_0x3c72('0x21')](function(_0x1ae8a4){if(_0x1ae8a4){_0x3203=_0x1ae8a4[_0x3c72('0x43')];if(!_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x31')](_0x3c72('0x32'))){_0x13a270[_0x3c72('0x1c')]=qs['limit'](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x13a270[_0x3c72('0x1a')]=qs[_0x3c72('0x1a')](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x1a')]);}return _0x4a7f30[_0x3c72('0x5c')](_0x13a270);}})['then'](function(_0x1aff3b){if(_0x1aff3b){return _0x1aff3b?{'count':_0x3203,'rows':_0x1aff3b}:null;}})['then'](respondWithResult(_0x40629d,null))[_0x3c72('0x3f')](handleError(_0x40629d,null));}; \ No newline at end of file +var _0xdf81=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','catch','show','params','model','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','getAllConditions','findOne','Condition','getAnyConditions','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse'];(function(_0x2203b3,_0x12aa65){var _0x3e095a=function(_0x1f9bfb){while(--_0x1f9bfb){_0x2203b3['push'](_0x2203b3['shift']());}};_0x3e095a(++_0x12aa65);}(_0xdf81,0x1ad));var _0x1df8=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xdf81[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0x1df8('0x0'));var rimraf=require(_0x1df8('0x1'));var zipdir=require(_0x1df8('0x2'));var jsonpatch=require(_0x1df8('0x3'));var rp=require('request-promise');var moment=require(_0x1df8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1df8('0x5'));var util=require(_0x1df8('0x6'));var path=require(_0x1df8('0x7'));var sox=require(_0x1df8('0x8'));var csv=require('to-csv');var ejs=require(_0x1df8('0x9'));var fs=require('fs');var fs_extra=require(_0x1df8('0xa'));var _=require(_0x1df8('0xb'));var squel=require('squel');var crypto=require(_0x1df8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1df8('0xd'));var toCsv=require(_0x1df8('0xe'));var querystring=require('querystring');var Papa=require(_0x1df8('0xf'));var Redis=require(_0x1df8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1df8('0x11'));var as=require(_0x1df8('0x12'));var hardwareService=require(_0x1df8('0x13'));var logger=require('../../config/logger')(_0x1df8('0x14'));var utils=require(_0x1df8('0x15'));var config=require(_0x1df8('0x16'));var licenseUtil=require(_0x1df8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d79ec,_0x798ef9){_0x798ef9=_0x798ef9||0xcc;return function(_0x59ff2a){if(_0x59ff2a){return _0x2d79ec[_0x1df8('0x18')](_0x798ef9);}return _0x2d79ec[_0x1df8('0x19')](_0x798ef9)['end']();};}function respondWithResult(_0x1a56cc,_0x173265){_0x173265=_0x173265||0xc8;return function(_0x14c598){if(_0x14c598){return _0x1a56cc['status'](_0x173265)[_0x1df8('0x1a')](_0x14c598);}};}function respondWithFilteredResult(_0x2b2bbf,_0x6c9b80){return function(_0x4e5a9c){if(_0x4e5a9c){var _0x411159=typeof _0x6c9b80[_0x1df8('0x1b')]===_0x1df8('0x1c')&&typeof _0x6c9b80['limit']===_0x1df8('0x1c');var _0xd5b277=_0x4e5a9c[_0x1df8('0x1d')];var _0x946fd1=_0x411159?0x0:_0x6c9b80[_0x1df8('0x1b')];var _0x4b5206=_0x411159?_0x4e5a9c['count']:_0x6c9b80['offset']+_0x6c9b80[_0x1df8('0x1e')];var _0x3e06c2;if(_0x4b5206>=_0xd5b277){_0x4b5206=_0xd5b277;_0x3e06c2=0xc8;}else{_0x3e06c2=0xce;}_0x2b2bbf[_0x1df8('0x19')](_0x3e06c2);return _0x2b2bbf[_0x1df8('0x1f')]('Content-Range',_0x946fd1+'-'+_0x4b5206+'/'+_0xd5b277)['json'](_0x4e5a9c);}return null;};}function patchUpdates(_0x25a113){return function(_0x268598){try{jsonpatch[_0x1df8('0x20')](_0x268598,_0x25a113,!![]);}catch(_0x5080ef){return BPromise[_0x1df8('0x21')](_0x5080ef);}return _0x268598['save']();};}function saveUpdates(_0x4e37af,_0x4dcae0){return function(_0x19e7e0){if(_0x19e7e0){return _0x19e7e0[_0x1df8('0x22')](_0x4e37af)[_0x1df8('0x23')](function(_0x5651a7){return _0x5651a7;});}return null;};}function removeEntity(_0x258089,_0x284966){return function(_0x2aaf22){if(_0x2aaf22){return _0x2aaf22[_0x1df8('0x24')]()[_0x1df8('0x23')](function(){var _0x3f18c8=_0x2aaf22[_0x1df8('0x25')]({'plain':!![]});var _0x20ea5e=_0x1df8('0x26');return db[_0x1df8('0x27')][_0x1df8('0x24')]({'where':{'type':_0x20ea5e,'resourceId':_0x3f18c8['id']}})['then'](function(){return _0x2aaf22;});})[_0x1df8('0x23')](function(){_0x258089[_0x1df8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30680b,_0x2c5210){return function(_0x5c6296){if(!_0x5c6296){_0x30680b[_0x1df8('0x18')](0x194);}return _0x5c6296;};}function handleError(_0x709d6f,_0x4f6116){_0x4f6116=_0x4f6116||0x1f4;return function(_0x35dc5f){logger['error'](_0x35dc5f['stack']);if(_0x35dc5f['name']){delete _0x35dc5f[_0x1df8('0x28')];}_0x709d6f['status'](_0x4f6116)['send'](_0x35dc5f);};}exports[_0x1df8('0x29')]=function(_0x486aa2,_0x446442){var _0x473c6b={},_0x3abf08={},_0x1c51a2={'count':0x0,'rows':[]};var _0x2fa8ae=_[_0x1df8('0x2a')](db[_0x1df8('0x2b')][_0x1df8('0x2c')],function(_0x2b4ee5){return{'name':_0x2b4ee5[_0x1df8('0x2d')],'type':_0x2b4ee5[_0x1df8('0x2e')][_0x1df8('0x2f')]};});_0x3abf08['model']=_['map'](_0x2fa8ae,'name');_0x3abf08[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x486aa2[_0x1df8('0x30')]);_0x3abf08[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x3abf08['model'],_0x3abf08['query']);_0x473c6b[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x3abf08['model'],qs[_0x1df8('0x35')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x35')]));_0x473c6b[_0x1df8('0x34')]=_0x473c6b[_0x1df8('0x34')][_0x1df8('0x36')]?_0x473c6b[_0x1df8('0x34')]:_0x3abf08['model'];if(!_0x486aa2[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x473c6b[_0x1df8('0x1e')]=qs[_0x1df8('0x1e')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x473c6b['offset']=qs[_0x1df8('0x1b')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x1b')]);}_0x473c6b[_0x1df8('0x39')]=qs[_0x1df8('0x3a')](_0x486aa2[_0x1df8('0x30')]['sort']);_0x473c6b[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x486aa2['query'],_0x3abf08[_0x1df8('0x32')]),_0x2fa8ae);if(_0x486aa2[_0x1df8('0x30')][_0x1df8('0x3d')]){_0x473c6b[_0x1df8('0x3b')]=_['merge'](_0x473c6b[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x2fa8ae,function(_0x39f3fd){if(_0x39f3fd[_0x1df8('0x2e')]!==_0x1df8('0x3e')){var _0x4a8e9b={};_0x4a8e9b[_0x39f3fd[_0x1df8('0x28')]]={'$like':'%'+_0x486aa2[_0x1df8('0x30')]['filter']+'%'};return _0x4a8e9b;}})});}_0x473c6b=_[_0x1df8('0x3f')]({},_0x473c6b,_0x486aa2['options']);var _0x9de71={'where':_0x473c6b['where']};return db[_0x1df8('0x2b')]['count'](_0x9de71)[_0x1df8('0x23')](function(_0x2ea30b){_0x1c51a2[_0x1df8('0x1d')]=_0x2ea30b;if(_0x486aa2[_0x1df8('0x30')]['includeAll']){_0x473c6b['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x473c6b);})[_0x1df8('0x23')](function(_0x262d19){_0x1c51a2['rows']=_0x262d19;return _0x1c51a2;})[_0x1df8('0x23')](respondWithFilteredResult(_0x446442,_0x473c6b))[_0x1df8('0x40')](handleError(_0x446442,null));};exports[_0x1df8('0x41')]=function(_0x19a4a0,_0x131394){var _0x5aa1a9={'raw':![],'where':{'id':_0x19a4a0[_0x1df8('0x42')]['id']}},_0x562914={};_0x562914[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x2b')]['rawAttributes']);_0x562914[_0x1df8('0x30')]=_['keys'](_0x19a4a0[_0x1df8('0x30')]);_0x562914[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x562914['model'],_0x562914[_0x1df8('0x30')]);_0x5aa1a9[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x562914[_0x1df8('0x43')],qs[_0x1df8('0x35')](_0x19a4a0[_0x1df8('0x30')][_0x1df8('0x35')]));_0x5aa1a9[_0x1df8('0x34')]=_0x5aa1a9[_0x1df8('0x34')][_0x1df8('0x36')]?_0x5aa1a9[_0x1df8('0x34')]:_0x562914[_0x1df8('0x43')];if(_0x19a4a0['query'][_0x1df8('0x44')]){_0x5aa1a9[_0x1df8('0x45')]=[{'all':!![]}];}_0x5aa1a9=_[_0x1df8('0x3f')]({},_0x5aa1a9,_0x19a4a0[_0x1df8('0x46')]);return db[_0x1df8('0x2b')][_0x1df8('0x47')](_0x5aa1a9)[_0x1df8('0x23')](handleEntityNotFound(_0x131394,null))[_0x1df8('0x23')](respondWithResult(_0x131394,null))[_0x1df8('0x40')](handleError(_0x131394,null));};exports[_0x1df8('0x48')]=function(_0x49c648,_0x4af87d){return db[_0x1df8('0x2b')]['create'](_0x49c648[_0x1df8('0x49')],{})['then'](function(_0x49f02e){var _0x1fdeb3=_0x49c648[_0x1df8('0x4a')][_0x1df8('0x25')]({'plain':!![]});if(!_0x1fdeb3)throw new Error(_0x1df8('0x4b'));if(_0x1fdeb3['role']===_0x1df8('0x4a')){var _0x586e55=_0x49f02e['get']({'plain':!![]});var _0x2f0ae1=_0x1df8('0x26');return db[_0x1df8('0x4c')][_0x1df8('0x47')]({'where':{'name':_0x2f0ae1,'userProfileId':_0x1fdeb3['userProfileId']},'raw':!![]})[_0x1df8('0x23')](function(_0x1b1498){if(_0x1b1498&&_0x1b1498['autoAssociation']===0x0){return db['UserProfileResource'][_0x1df8('0x48')]({'name':_0x586e55['name'],'resourceId':_0x586e55['id'],'type':_0x1b1498[_0x1df8('0x28')],'sectionId':_0x1b1498['id']},{})[_0x1df8('0x23')](function(){return _0x49f02e;});}else{return _0x49f02e;}})[_0x1df8('0x40')](function(_0x4648da){logger[_0x1df8('0x4d')](_0x1df8('0x4e'),_0x4648da);throw _0x4648da;});}return _0x49f02e;})[_0x1df8('0x23')](respondWithResult(_0x4af87d,0xc9))[_0x1df8('0x40')](handleError(_0x4af87d,null));};exports[_0x1df8('0x22')]=function(_0x4e110c,_0x20b3f8){if(_0x4e110c[_0x1df8('0x49')]['id']){delete _0x4e110c[_0x1df8('0x49')]['id'];}return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x4e110c['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x20b3f8,null))[_0x1df8('0x23')](saveUpdates(_0x4e110c[_0x1df8('0x49')],null))['then'](respondWithResult(_0x20b3f8,null))[_0x1df8('0x40')](handleError(_0x20b3f8,null));};exports[_0x1df8('0x24')]=function(_0x4a2b73,_0x4b19e5){return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x4a2b73['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x4b19e5,null))[_0x1df8('0x23')](removeEntity(_0x4b19e5,null))[_0x1df8('0x40')](handleError(_0x4b19e5,null));};exports[_0x1df8('0x4f')]=function(_0x6dd714,_0x58ab44,_0x54c6cf){if(_0x6dd714['body']['id']){delete _0x6dd714[_0x1df8('0x49')]['id'];}return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x6dd714[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x58ab44,null))[_0x1df8('0x23')](function(_0x3760ca){if(_0x3760ca){_0x6dd714[_0x1df8('0x49')][_0x1df8('0x50')]=_0x3760ca['id'];return db['Condition'][_0x1df8('0x48')](_0x6dd714['body']);}})['then'](respondWithResult(_0x58ab44,null))[_0x1df8('0x40')](handleError(_0x58ab44,null));};exports[_0x1df8('0x51')]=function(_0x3fd93c,_0x1a8334,_0x41c9c3){if(_0x3fd93c[_0x1df8('0x49')]['id']){delete _0x3fd93c[_0x1df8('0x49')]['id'];}return db['Trigger'][_0x1df8('0x47')]({'where':{'id':_0x3fd93c[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x1a8334,null))[_0x1df8('0x23')](function(_0x42bd7f){if(_0x42bd7f){_0x3fd93c[_0x1df8('0x49')]['TriggerAnyId']=_0x42bd7f['id'];return db['Condition'][_0x1df8('0x48')](_0x3fd93c[_0x1df8('0x49')]);}})[_0x1df8('0x23')](respondWithResult(_0x1a8334,null))[_0x1df8('0x40')](handleError(_0x1a8334,null));};exports[_0x1df8('0x52')]=function(_0x259d7a,_0x1c2d4e,_0xab67ee){var _0x55fc1b={};var _0x36ebba={};var _0x5600dc;var _0x4c2646;return db[_0x1df8('0x2b')][_0x1df8('0x53')]({'where':{'id':_0x259d7a[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x1c2d4e,null))[_0x1df8('0x23')](function(_0x27118b){if(_0x27118b){_0x5600dc=_0x27118b;_0x36ebba[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x54')][_0x1df8('0x2c')]);_0x36ebba[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x259d7a[_0x1df8('0x30')]);_0x36ebba[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x36ebba[_0x1df8('0x43')],_0x36ebba[_0x1df8('0x30')]);_0x55fc1b[_0x1df8('0x34')]=_['intersection'](_0x36ebba[_0x1df8('0x43')],qs[_0x1df8('0x35')](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x35')]));_0x55fc1b['attributes']=_0x55fc1b[_0x1df8('0x34')][_0x1df8('0x36')]?_0x55fc1b[_0x1df8('0x34')]:_0x36ebba[_0x1df8('0x43')];_0x55fc1b['order']=qs[_0x1df8('0x3a')](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x55fc1b[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x259d7a['query'],_0x36ebba[_0x1df8('0x32')]));if(_0x259d7a['query']['filter']){_0x55fc1b[_0x1df8('0x3b')]=_[_0x1df8('0x3f')](_0x55fc1b[_0x1df8('0x3b')],{'$or':_['map'](_0x55fc1b['attributes'],function(_0x322e65){var _0x4b9a91={};_0x4b9a91[_0x322e65]={'$like':'%'+_0x259d7a[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0x4b9a91;})});}_0x55fc1b=_[_0x1df8('0x3f')]({},_0x55fc1b,_0x259d7a[_0x1df8('0x46')]);return _0x5600dc[_0x1df8('0x52')](_0x55fc1b);}})[_0x1df8('0x23')](function(_0x2b60e9){if(_0x2b60e9){_0x4c2646=_0x2b60e9['length'];if(!_0x259d7a['query'][_0x1df8('0x37')](_0x1df8('0x38'))){_0x55fc1b[_0x1df8('0x1e')]=qs['limit'](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x55fc1b['offset']=qs['offset'](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x1b')]);}return _0x5600dc[_0x1df8('0x52')](_0x55fc1b);}})[_0x1df8('0x23')](function(_0x2bd1f9){if(_0x2bd1f9){return _0x2bd1f9?{'count':_0x4c2646,'rows':_0x2bd1f9}:null;}})[_0x1df8('0x23')](respondWithResult(_0x1c2d4e,null))[_0x1df8('0x40')](handleError(_0x1c2d4e,null));};exports[_0x1df8('0x55')]=function(_0x4b4239,_0x41750f,_0x455b1b){var _0x4d6b07={};var _0x132294={};var _0x3ad57b;var _0x42dc62;return db[_0x1df8('0x2b')]['findOne']({'where':{'id':_0x4b4239[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x41750f,null))[_0x1df8('0x23')](function(_0xd813fa){if(_0xd813fa){_0x3ad57b=_0xd813fa;_0x132294[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x54')][_0x1df8('0x2c')]);_0x132294['query']=_[_0x1df8('0x31')](_0x4b4239[_0x1df8('0x30')]);_0x132294[_0x1df8('0x32')]=_['intersection'](_0x132294[_0x1df8('0x43')],_0x132294[_0x1df8('0x30')]);_0x4d6b07[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x132294[_0x1df8('0x43')],qs['fields'](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x35')]));_0x4d6b07[_0x1df8('0x34')]=_0x4d6b07['attributes'][_0x1df8('0x36')]?_0x4d6b07['attributes']:_0x132294[_0x1df8('0x43')];_0x4d6b07[_0x1df8('0x39')]=qs[_0x1df8('0x3a')](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x4d6b07[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x4b4239['query'],_0x132294[_0x1df8('0x32')]));if(_0x4b4239[_0x1df8('0x30')]['filter']){_0x4d6b07['where']=_[_0x1df8('0x3f')](_0x4d6b07[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x4d6b07[_0x1df8('0x34')],function(_0x22fe55){var _0xd0f0d4={};_0xd0f0d4[_0x22fe55]={'$like':'%'+_0x4b4239[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0xd0f0d4;})});}_0x4d6b07=_['merge']({},_0x4d6b07,_0x4b4239['options']);return _0x3ad57b[_0x1df8('0x55')](_0x4d6b07);}})['then'](function(_0x5cb991){if(_0x5cb991){_0x42dc62=_0x5cb991[_0x1df8('0x36')];if(!_0x4b4239[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x4d6b07[_0x1df8('0x1e')]=qs['limit'](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x4d6b07[_0x1df8('0x1b')]=qs['offset'](_0x4b4239['query'][_0x1df8('0x1b')]);}return _0x3ad57b[_0x1df8('0x55')](_0x4d6b07);}})[_0x1df8('0x23')](function(_0x598819){if(_0x598819){return _0x598819?{'count':_0x42dc62,'rows':_0x598819}:null;}})['then'](respondWithResult(_0x41750f,null))[_0x1df8('0x40')](handleError(_0x41750f,null));};exports[_0x1df8('0x56')]=function(_0x3bca7b,_0x2225fb,_0x3a2474){if(_0x3bca7b['body']['id']){delete _0x3bca7b[_0x1df8('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3bca7b[_0x1df8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2225fb,null))[_0x1df8('0x23')](function(_0x133538){if(_0x133538){_0x3bca7b[_0x1df8('0x49')]['TriggerId']=_0x133538['id'];return db['Action'][_0x1df8('0x48')](_0x3bca7b[_0x1df8('0x49')]);}})['then'](respondWithResult(_0x2225fb,null))[_0x1df8('0x40')](handleError(_0x2225fb,null));};exports[_0x1df8('0x57')]=function(_0x5da385,_0x105fd9,_0x1ccdab){var _0x16c590={};var _0x579ae5={};var _0x2f8026;var _0x4a183e;return db['Trigger']['findOne']({'where':{'id':_0x5da385['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x105fd9,null))['then'](function(_0x1a66f8){if(_0x1a66f8){_0x2f8026=_0x1a66f8;_0x579ae5[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x58')][_0x1df8('0x2c')]);_0x579ae5[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x5da385[_0x1df8('0x30')]);_0x579ae5[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x579ae5[_0x1df8('0x43')],_0x579ae5[_0x1df8('0x30')]);_0x16c590[_0x1df8('0x34')]=_['intersection'](_0x579ae5['model'],qs['fields'](_0x5da385[_0x1df8('0x30')][_0x1df8('0x35')]));_0x16c590[_0x1df8('0x34')]=_0x16c590[_0x1df8('0x34')]['length']?_0x16c590[_0x1df8('0x34')]:_0x579ae5[_0x1df8('0x43')];_0x16c590[_0x1df8('0x39')]=qs['sort'](_0x5da385[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x16c590[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x5da385[_0x1df8('0x30')],_0x579ae5[_0x1df8('0x32')]));if(_0x5da385['query']['filter']){_0x16c590[_0x1df8('0x3b')]=_[_0x1df8('0x3f')](_0x16c590[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x16c590['attributes'],function(_0x5d9538){var _0x10942c={};_0x10942c[_0x5d9538]={'$like':'%'+_0x5da385[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0x10942c;})});}_0x16c590=_[_0x1df8('0x3f')]({},_0x16c590,_0x5da385[_0x1df8('0x46')]);return _0x2f8026['getActions'](_0x16c590);}})[_0x1df8('0x23')](function(_0x59a0ae){if(_0x59a0ae){_0x4a183e=_0x59a0ae['length'];if(!_0x5da385[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x16c590[_0x1df8('0x1e')]=qs[_0x1df8('0x1e')](_0x5da385['query']['limit']);_0x16c590[_0x1df8('0x1b')]=qs[_0x1df8('0x1b')](_0x5da385[_0x1df8('0x30')][_0x1df8('0x1b')]);}return _0x2f8026[_0x1df8('0x57')](_0x16c590);}})[_0x1df8('0x23')](function(_0x29ea56){if(_0x29ea56){return _0x29ea56?{'count':_0x4a183e,'rows':_0x29ea56}:null;}})[_0x1df8('0x23')](respondWithResult(_0x105fd9,null))[_0x1df8('0x40')](handleError(_0x105fd9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ab06f25..c0e6b74 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 _0xcb81=['lodash','util','api','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers'];(function(_0x2951f1,_0x42d2d2){var _0x2faf77=function(_0x520db1){while(--_0x520db1){_0x2951f1['push'](_0x2951f1['shift']());}};_0x2faf77(++_0x42d2d2);}(_0xcb81,0x154));var _0x1cb8=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xcb81[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('Trigger',attributes,{'tableName':_0x1cb8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','../../config/logger','moment'];(function(_0xafee51,_0x200069){var _0x1e553b=function(_0x4a9c0e){while(--_0x4a9c0e){_0xafee51['push'](_0xafee51['shift']());}};_0x1e553b(++_0x200069);}(_0xa8eb,0x179));var _0xba8e=function(_0xec10a6,_0x5e1108){_0xec10a6=_0xec10a6-0x0;var _0x2e6f1e=_0xa8eb[_0xec10a6];return _0x2e6f1e;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./trigger.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'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 fc4ab68..fe0c9eb 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 _0x6b5e=['Trigger,\x20%s,\x20%s','message','info','request\x20sent','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b5e,0x16a));var _0xe6b5=function(_0x21afa0,_0x1f7b19){_0x21afa0=_0x21afa0-0x0;var _0x55f0e4=_0x6b5e[_0x21afa0];return _0x55f0e4;};'use strict';var _=require(_0xe6b5('0x0'));var util=require(_0xe6b5('0x1'));var moment=require(_0xe6b5('0x2'));var BPromise=require(_0xe6b5('0x3'));var rs=require(_0xe6b5('0x4'));var fs=require('fs');var Redis=require(_0xe6b5('0x5'));var db=require(_0xe6b5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6b5('0x7'))(_0xe6b5('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6b5('0x9'));var client=jayson[_0xe6b5('0xa')][_0xe6b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fe51b,_0x31825e,_0x252651){return new BPromise(function(_0x15cb92,_0x1451c2){return client[_0xe6b5('0xc')](_0x4fe51b,_0x252651)[_0xe6b5('0xd')](function(_0x2d67c3){logger['info']('Trigger,\x20%s,\x20%s',_0x31825e,'request\x20sent');logger['debug'](_0xe6b5('0xe'),_0x31825e,'request\x20sent',JSON[_0xe6b5('0xf')](_0x2d67c3));if(_0x2d67c3[_0xe6b5('0x10')]){if(_0x2d67c3['error'][_0xe6b5('0x11')]===0x1f4){logger[_0xe6b5('0x10')](_0xe6b5('0x12'),_0x31825e,_0x2d67c3[_0xe6b5('0x10')]['message']);return _0x1451c2(_0x2d67c3[_0xe6b5('0x10')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x31825e,_0x2d67c3['error'][_0xe6b5('0x13')]);return _0x15cb92(_0x2d67c3[_0xe6b5('0x10')]['message']);}else{logger[_0xe6b5('0x14')](_0xe6b5('0x12'),_0x31825e,_0xe6b5('0x15'));_0x15cb92(_0x2d67c3[_0xe6b5('0x16')][_0xe6b5('0x13')]);}})[_0xe6b5('0x17')](function(_0x2f5029){logger[_0xe6b5('0x10')](_0xe6b5('0x12'),_0x31825e,_0x2f5029);_0x1451c2(_0x2f5029);});});}exports['GetTrigger']=function(_0x391fd2){var _0x419b47=this;return new Promise(function(_0x3534a2,_0x4da487){return db[_0xe6b5('0x18')][_0xe6b5('0x19')]({'raw':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1c')]||null:null,'attributes':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1d')]||null:null,'limit':_0x391fd2['options']?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1e')]||null:null,'include':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1f')]?_['map'](_0x391fd2['options'][_0xe6b5('0x1f')],function(_0x4c4bc1){return{'model':db[_0x4c4bc1['model']],'as':_0x4c4bc1['as'],'attributes':_0x4c4bc1[_0xe6b5('0x1d')],'include':_0x4c4bc1[_0xe6b5('0x1f')]?_[_0xe6b5('0x20')](_0x4c4bc1['include'],function(_0x31406c){return{'model':db[_0x31406c[_0xe6b5('0x21')]],'as':_0x31406c['as'],'attributes':_0x31406c[_0xe6b5('0x1d')],'include':_0x31406c['include']?_[_0xe6b5('0x20')](_0x31406c[_0xe6b5('0x1f')],function(_0x55833e){return{'model':db[_0x55833e[_0xe6b5('0x21')]],'as':_0x55833e['as'],'attributes':_0x55833e[_0xe6b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe6b5('0xd')](function(_0x2dcda7){logger['info']('GetTrigger',_0x391fd2);logger[_0xe6b5('0x22')]('GetTrigger',_0x391fd2,JSON[_0xe6b5('0xf')](_0x2dcda7));_0x3534a2(_0x2dcda7);})[_0xe6b5('0x17')](function(_0x458a60){logger['error'](_0xe6b5('0x23'),_0x458a60['message'],_0x391fd2);_0x4da487(_0x419b47[_0xe6b5('0x10')](0x1f4,_0x458a60['message']));});});};exports[_0xe6b5('0x24')]=function(_0x19cdf1){var _0x26a6ea=this;return new Promise(function(_0x4bed92,_0xb8321a){return db[_0xe6b5('0x18')][_0xe6b5('0x25')]({'raw':_0x19cdf1['options']?_0x19cdf1[_0xe6b5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1c')]||null:null,'attributes':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1d')]||null:null,'include':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1['options'][_0xe6b5('0x1f')]?_['map'](_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1f')],function(_0x2613c5){return{'model':db[_0x2613c5[_0xe6b5('0x21')]],'as':_0x2613c5['as'],'attributes':_0x2613c5[_0xe6b5('0x1d')],'include':_0x2613c5[_0xe6b5('0x1f')]?_[_0xe6b5('0x20')](_0x2613c5[_0xe6b5('0x1f')],function(_0x3cab54){return{'model':db[_0x3cab54[_0xe6b5('0x21')]],'as':_0x3cab54['as'],'attributes':_0x3cab54[_0xe6b5('0x1d')],'include':_0x3cab54[_0xe6b5('0x1f')]?_['map'](_0x3cab54[_0xe6b5('0x1f')],function(_0x2a2332){return{'model':db[_0x2a2332[_0xe6b5('0x21')]],'as':_0x2a2332['as'],'attributes':_0x2a2332['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e1b7a){logger[_0xe6b5('0x14')](_0xe6b5('0x24'),_0x19cdf1);logger[_0xe6b5('0x22')](_0xe6b5('0x24'),_0x19cdf1,JSON[_0xe6b5('0xf')](_0x4e1b7a));_0x4bed92(_0x4e1b7a);})[_0xe6b5('0x17')](function(_0x3a7933){logger[_0xe6b5('0x10')](_0xe6b5('0x24'),_0x3a7933[_0xe6b5('0x13')],_0x19cdf1);_0xb8321a(_0x26a6ea[_0xe6b5('0x10')](0x1f4,_0x3a7933[_0xe6b5('0x13')]));});});}; \ No newline at end of file +var _0x81aa=['include','model','map','then','ShowTrigger','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','raw','options','where','attributes','limit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x81aa,0xde));var _0xa81a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x81aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa81a('0x0'));var util=require(_0xa81a('0x1'));var moment=require(_0xa81a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa81a('0x3'));var fs=require('fs');var Redis=require(_0xa81a('0x4'));var db=require(_0xa81a('0x5'))['db'];var utils=require(_0xa81a('0x6'));var logger=require('../../config/logger')(_0xa81a('0x7'));var config=require(_0xa81a('0x8'));var jayson=require(_0xa81a('0x9'));var client=jayson['client'][_0xa81a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22e4a8,_0x42c97d,_0x260c2a){return new BPromise(function(_0x31338c,_0x32b97b){return client[_0xa81a('0xb')](_0x22e4a8,_0x260c2a)['then'](function(_0x408e9c){logger[_0xa81a('0xc')](_0xa81a('0xd'),_0x42c97d,'request\x20sent');logger[_0xa81a('0xe')](_0xa81a('0xf'),_0x42c97d,_0xa81a('0x10'),JSON[_0xa81a('0x11')](_0x408e9c));if(_0x408e9c[_0xa81a('0x12')]){if(_0x408e9c[_0xa81a('0x12')]['code']===0x1f4){logger['error'](_0xa81a('0xd'),_0x42c97d,_0x408e9c[_0xa81a('0x12')]['message']);return _0x32b97b(_0x408e9c['error'][_0xa81a('0x13')]);}logger[_0xa81a('0x12')]('Trigger,\x20%s,\x20%s',_0x42c97d,_0x408e9c[_0xa81a('0x12')][_0xa81a('0x13')]);return _0x31338c(_0x408e9c[_0xa81a('0x12')]['message']);}else{logger[_0xa81a('0xc')](_0xa81a('0xd'),_0x42c97d,_0xa81a('0x10'));_0x31338c(_0x408e9c[_0xa81a('0x14')]['message']);}})[_0xa81a('0x15')](function(_0x45773a){logger[_0xa81a('0x12')](_0xa81a('0xd'),_0x42c97d,_0x45773a);_0x32b97b(_0x45773a);});});}exports[_0xa81a('0x16')]=function(_0x57da21){var _0x1c7b8b=this;return new Promise(function(_0x9b3db9,_0x129149){return db[_0xa81a('0x17')][_0xa81a('0x18')]({'raw':_0x57da21['options']?_0x57da21['options'][_0xa81a('0x19')]===undefined?!![]:![]:!![],'where':_0x57da21[_0xa81a('0x1a')]?_0x57da21['options'][_0xa81a('0x1b')]||null:null,'attributes':_0x57da21[_0xa81a('0x1a')]?_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1c')]||null:null,'limit':_0x57da21[_0xa81a('0x1a')]?_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1d')]||null:null,'include':_0x57da21[_0xa81a('0x1a')]?_0x57da21['options'][_0xa81a('0x1e')]?_['map'](_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1e')],function(_0x561e6b){return{'model':db[_0x561e6b[_0xa81a('0x1f')]],'as':_0x561e6b['as'],'attributes':_0x561e6b['attributes'],'include':_0x561e6b['include']?_[_0xa81a('0x20')](_0x561e6b[_0xa81a('0x1e')],function(_0x50219b){return{'model':db[_0x50219b[_0xa81a('0x1f')]],'as':_0x50219b['as'],'attributes':_0x50219b[_0xa81a('0x1c')],'include':_0x50219b['include']?_[_0xa81a('0x20')](_0x50219b[_0xa81a('0x1e')],function(_0x34c434){return{'model':db[_0x34c434['model']],'as':_0x34c434['as'],'attributes':_0x34c434[_0xa81a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa81a('0x21')](function(_0x236a4b){logger[_0xa81a('0xc')](_0xa81a('0x16'),_0x57da21);logger[_0xa81a('0xe')](_0xa81a('0x16'),_0x57da21,JSON[_0xa81a('0x11')](_0x236a4b));_0x9b3db9(_0x236a4b);})['catch'](function(_0x3e30a9){logger[_0xa81a('0x12')]('GetTrigger',_0x3e30a9[_0xa81a('0x13')],_0x57da21);_0x129149(_0x1c7b8b[_0xa81a('0x12')](0x1f4,_0x3e30a9['message']));});});};exports[_0xa81a('0x22')]=function(_0x25ce34){var _0xbf6baa=this;return new Promise(function(_0x2271ad,_0xa5c7af){return db[_0xa81a('0x17')][_0xa81a('0x23')]({'raw':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')][_0xa81a('0x19')]===undefined?!![]:![]:!![],'where':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')]['where']||null:null,'attributes':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34['options']['attributes']||null:null,'include':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')]['include']?_[_0xa81a('0x20')](_0x25ce34[_0xa81a('0x1a')][_0xa81a('0x1e')],function(_0x54661c){return{'model':db[_0x54661c[_0xa81a('0x1f')]],'as':_0x54661c['as'],'attributes':_0x54661c[_0xa81a('0x1c')],'include':_0x54661c[_0xa81a('0x1e')]?_[_0xa81a('0x20')](_0x54661c[_0xa81a('0x1e')],function(_0x2fb567){return{'model':db[_0x2fb567[_0xa81a('0x1f')]],'as':_0x2fb567['as'],'attributes':_0x2fb567[_0xa81a('0x1c')],'include':_0x2fb567[_0xa81a('0x1e')]?_[_0xa81a('0x20')](_0x2fb567[_0xa81a('0x1e')],function(_0x11c122){return{'model':db[_0x11c122[_0xa81a('0x1f')]],'as':_0x11c122['as'],'attributes':_0x11c122[_0xa81a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa81a('0x21')](function(_0xa45de0){logger[_0xa81a('0xc')]('ShowTrigger',_0x25ce34);logger[_0xa81a('0xe')](_0xa81a('0x22'),_0x25ce34,JSON[_0xa81a('0x11')](_0xa45de0));_0x2271ad(_0xa45de0);})[_0xa81a('0x15')](function(_0x391e1f){logger[_0xa81a('0x12')](_0xa81a('0x22'),_0x391e1f[_0xa81a('0x13')],_0x25ce34);_0xa5c7af(_0xbf6baa[_0xa81a('0x12')](0x1f4,_0x391e1f[_0xa81a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index df28bb6..0bad704 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 _0x110a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x25eb68,_0x2b9197){var _0x359151=function(_0x32ea66){while(--_0x32ea66){_0x25eb68['push'](_0x25eb68['shift']());}};_0x359151(++_0x2b9197);}(_0x110a,0xa6));var _0xa110=function(_0x50ce0c,_0x541b68){_0x50ce0c=_0x50ce0c-0x0;var _0x3c988c=_0x110a[_0x50ce0c];return _0x3c988c;};'use strict';var multer=require(_0xa110('0x0'));var util=require(_0xa110('0x1'));var path=require('path');var timeout=require(_0xa110('0x2'));var express=require(_0xa110('0x3'));var router=express[_0xa110('0x4')]();var fs_extra=require(_0xa110('0x5'));var auth=require(_0xa110('0x6'));var interaction=require(_0xa110('0x7'));var config=require('../../config/environment');var controller=require(_0xa110('0x8'));router[_0xa110('0x9')]('/',auth[_0xa110('0xa')](),controller[_0xa110('0xb')]);router[_0xa110('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa110('0xc')]);router[_0xa110('0xd')](_0xa110('0xe'),auth[_0xa110('0xa')](),controller['clone']);router[_0xa110('0xd')]('/',auth['isAuthenticated'](),controller[_0xa110('0xf')]);router[_0xa110('0x10')](_0xa110('0x11'),auth[_0xa110('0xa')](),controller[_0xa110('0x12')]);router[_0xa110('0x13')](_0xa110('0x11'),auth[_0xa110('0xa')](),controller[_0xa110('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa17c=['isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa17c,0xea));var _0xca17=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xa17c[_0x512550];return _0x19f661;};'use strict';var multer=require('multer');var util=require(_0xca17('0x0'));var path=require('path');var timeout=require(_0xca17('0x1'));var express=require('express');var router=express[_0xca17('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xca17('0x3'));var interaction=require(_0xca17('0x4'));var config=require('../../config/environment');var controller=require(_0xca17('0x5'));router['get']('/',auth[_0xca17('0x6')](),controller[_0xca17('0x7')]);router['get']('/:id',auth[_0xca17('0x6')](),controller[_0xca17('0x8')]);router[_0xca17('0x9')](_0xca17('0xa'),auth[_0xca17('0x6')](),controller[_0xca17('0xb')]);router[_0xca17('0x9')]('/',auth['isAuthenticated'](),controller[_0xca17('0xc')]);router['put'](_0xca17('0xd'),auth[_0xca17('0x6')](),controller['update']);router[_0xca17('0xe')](_0xca17('0xd'),auth[_0xca17('0x6')](),controller[_0xca17('0xf')]);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 e3d981b..b90197f 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 _0x349a=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','active','passive','actpass','dynamic','nonat','update','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x349a,0x160));var _0xa349=function(_0x48d3fa,_0x3808a6){_0x48d3fa=_0x48d3fa-0x0;var _0x4c4995=_0x349a[_0x48d3fa];return _0x4c4995;};'use strict';var Sequelize=require(_0xa349('0x0'));module['exports']={'name':{'type':Sequelize[_0xa349('0x1')],'allowNull':![],'unique':_0xa349('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa349('0x3')]('friend',_0xa349('0x4'),_0xa349('0x5')),'allowNull':![],'defaultValue':_0xa349('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa349('0x7')},'callingpres':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x8'),'ALLOWED_PASSED_SCREEN',_0xa349('0x9'),_0xa349('0xa'),_0xa349('0xb'),_0xa349('0xc'),_0xa349('0xd'),_0xa349('0xe'))},'deny':{'type':Sequelize[_0xa349('0x1')]},'permit':{'type':Sequelize[_0xa349('0x1')]},'secret':{'type':Sequelize[_0xa349('0x1')]},'md5secret':{'type':Sequelize[_0xa349('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'udp','set':function(_0x22c865){this[_0xa349('0xf')](_0xa349('0x10'),_0x22c865?_0x22c865[_0xa349('0x11')](','):null);},'get':function(){return this[_0xa349('0x12')](_0xa349('0x10'))?this[_0xa349('0x12')](_0xa349('0x10'))['split'](','):null;},'comment':_0xa349('0x13')},'dtmfmode':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x14'),_0xa349('0x15'),_0xa349('0x16'),_0xa349('0x17'),'auto'),'defaultValue':_0xa349('0x14')},'directmedia':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no','nonat','update',_0xa349('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa349('0x1')]},'directmediadeny':{'type':Sequelize[_0xa349('0x1')]},'nat':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x1a'),'set':function(_0x54d66a){this[_0xa349('0xf')]('nat',_0x54d66a?_0x54d66a[_0xa349('0x11')](','):null);},'get':function(){return this[_0xa349('0x12')](_0xa349('0x1b'))?this['getDataValue'](_0xa349('0x1b'))[_0xa349('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa349('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa349('0x1')]},'language':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa349('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x1d')},'allow':{'type':Sequelize[_0xa349('0x1')],'allowNull':![],'defaultValue':_0xa349('0x1e'),'set':function(_0x24a8ba){this[_0xa349('0xf')](_0xa349('0x1f'),_0x24a8ba?_0x24a8ba['join'](';'):_0xa349('0x1e'));},'get':function(){return this[_0xa349('0x12')](_0xa349('0x1f'))?this[_0xa349('0x12')](_0xa349('0x1f'))[_0xa349('0x1c')](';'):null;},'comment':_0xa349('0x20')},'autoframing':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'insecure':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x21'),'set':function(_0x47f51b){this[_0xa349('0xf')](_0xa349('0x22'),_0x47f51b?_0x47f51b[_0xa349('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xa349('0x22'))?this[_0xa349('0x12')](_0xa349('0x22'))[_0xa349('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa349('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa349('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa349('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'accountcode':{'type':Sequelize[_0xa349('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x24')},'amaflags':{'type':Sequelize[_0xa349('0x1')]},'callcounter':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':_0xa349('0x18')},'busylevel':{'type':Sequelize[_0xa349('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xa349('0x1')]},'template':{'type':Sequelize[_0xa349('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no',_0xa349('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa349('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'mailbox':{'type':Sequelize[_0xa349('0x1')]},'session_timers':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x26'),_0xa349('0x27'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa349('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x28'),_0xa349('0x29')),'defaultValue':_0xa349('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa349('0x1')]},'fromuser':{'type':Sequelize[_0xa349('0x1')]},'port':{'type':Sequelize[_0xa349('0x23')](0x5)},'qualify':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':_0xa349('0x18')},'keepalive':{'type':Sequelize[_0xa349('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xa349('0x1')]},'defaultuser':{'type':Sequelize[_0xa349('0x1')]},'rtptimeout':{'type':Sequelize[_0xa349('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa349('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no',_0xa349('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xa349('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa349('0x1')]},'contactdeny':{'type':Sequelize[_0xa349('0x1')]},'contactacl':{'type':Sequelize[_0xa349('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa349('0x1')]},'use_q850_reason':{'type':Sequelize[_0xa349('0x1')]},'maxforwards':{'type':Sequelize[_0xa349('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'force_avp':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xa349('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xa349('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xa349('0x1')]},'dtlscafile':{'type':Sequelize[_0xa349('0x1')]},'dtlscapath':{'type':Sequelize[_0xa349('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa349('0x2c'),_0xa349('0x2d'),_0xa349('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa349('0x1')]},'usereqphone':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa349('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xa349('0x1')]},'mohinterpret':{'type':Sequelize[_0xa349('0x1')]},'mohsuggest':{'type':Sequelize[_0xa349('0x1')]},'parkinglot':{'type':Sequelize[_0xa349('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa349('0x2f')},'canreinvite':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no',_0xa349('0x30'),_0xa349('0x31'),_0xa349('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa349('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa349('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7782=['\x22\x22\x20<>','always','refuse','uas','pai','fingerprint','certificate','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','info','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','port,invite','insecure','INTEGER'];(function(_0x4c7b8a,_0x12540d){var _0x3fbc85=function(_0x854b1e){while(--_0x854b1e){_0x4c7b8a['push'](_0x4c7b8a['shift']());}};_0x3fbc85(++_0x12540d);}(_0x7782,0xfa));var _0x2778=function(_0x10fcf3,_0x24a4fd){_0x10fcf3=_0x10fcf3-0x0;var _0x244d86=_0x7782[_0x10fcf3];return _0x244d86;};'use strict';var Sequelize=require(_0x2778('0x0'));module[_0x2778('0x1')]={'name':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'unique':_0x2778('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2778('0x4')]('friend',_0x2778('0x5'),_0x2778('0x6')),'allowNull':![],'defaultValue':_0x2778('0x7')},'context':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'defaultValue':_0x2778('0x8')},'callingpres':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x9'),_0x2778('0xa'),_0x2778('0xb'),'ALLOWED',_0x2778('0xc'),_0x2778('0xd'),_0x2778('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x2778('0x2')]},'permit':{'type':Sequelize[_0x2778('0x2')]},'secret':{'type':Sequelize[_0x2778('0x2')]},'md5secret':{'type':Sequelize[_0x2778('0x2')]},'remotesecret':{'type':Sequelize[_0x2778('0x2')]},'transport':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0xf'),'set':function(_0x82280b){this[_0x2778('0x10')](_0x2778('0x11'),_0x82280b?_0x82280b['join'](','):null);},'get':function(){return this[_0x2778('0x12')](_0x2778('0x11'))?this[_0x2778('0x12')](_0x2778('0x11'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2778('0x4')]('rfc2833',_0x2778('0x14'),_0x2778('0x15'),_0x2778('0x16'),_0x2778('0x17')),'defaultValue':_0x2778('0x18')},'directmedia':{'type':Sequelize[_0x2778('0x4')]('yes','no',_0x2778('0x19'),_0x2778('0x1a'),_0x2778('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2778('0x2')]},'directmediadeny':{'type':Sequelize[_0x2778('0x2')]},'nat':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x1d'),'set':function(_0x4a1527){this['setDataValue'](_0x2778('0x1e'),_0x4a1527?_0x4a1527[_0x2778('0x1f')](','):null);},'get':function(){return this[_0x2778('0x12')](_0x2778('0x1e'))?this[_0x2778('0x12')](_0x2778('0x1e'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2778('0x2')]},'pickupgroup':{'type':Sequelize[_0x2778('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2778('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x20')},'allow':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x337e12){this[_0x2778('0x10')]('allow',_0x337e12?_0x337e12[_0x2778('0x1f')](';'):_0x2778('0x21'));},'get':function(){return this[_0x2778('0x12')](_0x2778('0x22'))?this[_0x2778('0x12')](_0x2778('0x22'))[_0x2778('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'insecure':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x23'),'set':function(_0x2be0c3){this[_0x2778('0x10')](_0x2778('0x24'),_0x2be0c3?_0x2be0c3[_0x2778('0x1f')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x2778('0x12')](_0x2778('0x24'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2778('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x2778('0x25')](0xb)},'setvar':{'type':Sequelize[_0x2778('0x2')]},'callerid':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x26')},'amaflags':{'type':Sequelize[_0x2778('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no'),'defaultValue':_0x2778('0x1c')},'busylevel':{'type':Sequelize[_0x2778('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x2778('0x2')]},'template':{'type':Sequelize[_0x2778('0x2')]},'videosupport':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2778('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'mailbox':{'type':Sequelize[_0x2778('0x2')]},'session_timers':{'type':Sequelize[_0x2778('0x4')]('accept',_0x2778('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x2778('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2778('0x4')]('uac',_0x2778('0x29')),'defaultValue':_0x2778('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x2778('0x2')]},'regexten':{'type':Sequelize[_0x2778('0x2')]},'fromdomain':{'type':Sequelize[_0x2778('0x2')]},'fromuser':{'type':Sequelize[_0x2778('0x2')]},'port':{'type':Sequelize[_0x2778('0x25')](0x5)},'qualify':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':_0x2778('0x1c')},'keepalive':{'type':Sequelize[_0x2778('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x2778('0x2')]},'defaultuser':{'type':Sequelize[_0x2778('0x2')]},'rtptimeout':{'type':Sequelize[_0x2778('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2778('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2778('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x2778('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2778('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2778('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x2778('0x2')]},'contactdeny':{'type':Sequelize[_0x2778('0x2')]},'contactacl':{'type':Sequelize[_0x2778('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2778('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2778('0x2')]},'maxforwards':{'type':Sequelize[_0x2778('0x25')](0xb)},'encryption':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'force_avp':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x2b'),_0x2778('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x2778('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2778('0x2')]},'dtlscipher':{'type':Sequelize[_0x2778('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2778('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x2778('0x2d'),_0x2778('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2778('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'vmexten':{'type':Sequelize[_0x2778('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2778('0x2')]},'description':{'type':Sequelize[_0x2778('0x2')]},'host':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x2f')},'canreinvite':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no','nonat',_0x2778('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2778('0x2')]},'otherFields':{'type':Sequelize[_0x2778('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2778('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 b70035c..a9c8d6a 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x59c352,_0x1a3d99){var _0x24e1ac=function(_0x3e4931){while(--_0x3e4931){_0x59c352['push'](_0x59c352['shift']());}};_0x24e1ac(++_0x1a3d99);}(_0xb821,0xa7));var _0x1b82=function(_0x55f086,_0x138b7b){_0x55f086=_0x55f086-0x0;var _0x3c66f2=_0xb821[_0x55f086];return _0x3c66f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x439ed9,_0x581c3f){var _0x337d30=function(_0x57f8d0){while(--_0x57f8d0){_0x439ed9['push'](_0x439ed9['shift']());}};_0x337d30(++_0x581c3f);}(_0x98a8,0x12c));var _0x898a=function(_0x3070ac,_0x2ddbff){_0x3070ac=_0x3070ac-0x0;var _0x1172c0=_0x98a8[_0x3070ac];return _0x1172c0;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index deb9190..997cb14 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 _0xa1e7=['Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1a37b2,_0x584b3b){var _0x130c75=function(_0x268407){while(--_0x268407){_0x1a37b2['push'](_0x1a37b2['shift']());}};_0x130c75(++_0x584b3b);}(_0xa1e7,0x1af));var _0x7a1e=function(_0x343dbb,_0x42e74c){_0x343dbb=_0x343dbb-0x0;var _0x35c94f=_0xa1e7[_0x343dbb];return _0x35c94f;};'use strict';var _=require(_0x7a1e('0x0'));var util=require(_0x7a1e('0x1'));var logger=require('../../config/logger')(_0x7a1e('0x2'));var moment=require(_0x7a1e('0x3'));var BPromise=require(_0x7a1e('0x4'));var rp=require(_0x7a1e('0x5'));var fs=require('fs');var path=require(_0x7a1e('0x6'));var rimraf=require(_0x7a1e('0x7'));var config=require(_0x7a1e('0x8'));var attributes=require('./trunk.attributes');module[_0x7a1e('0x9')]=function(_0x50f502,_0x55f557){return _0x50f502[_0x7a1e('0xa')](_0x7a1e('0xb'),attributes,{'tableName':_0x7a1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd82c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger'];(function(_0x17c38b,_0x201c48){var _0x52e7a4=function(_0x2fa956){while(--_0x2fa956){_0x17c38b['push'](_0x17c38b['shift']());}};_0x52e7a4(++_0x201c48);}(_0xd82c,0xb4));var _0xcd82=function(_0x82ef14,_0x298691){_0x82ef14=_0x82ef14-0x0;var _0x53f793=_0xd82c[_0x82ef14];return _0x53f793;};'use strict';var _=require(_0xcd82('0x0'));var util=require('util');var logger=require(_0xcd82('0x1'))(_0xcd82('0x2'));var moment=require(_0xcd82('0x3'));var BPromise=require(_0xcd82('0x4'));var rp=require(_0xcd82('0x5'));var fs=require('fs');var path=require(_0xcd82('0x6'));var rimraf=require(_0xcd82('0x7'));var config=require(_0xcd82('0x8'));var attributes=require(_0xcd82('0x9'));module[_0xcd82('0xa')]=function(_0x119551,_0x3be425){return _0x119551[_0xcd82('0xb')](_0xcd82('0xc'),attributes,{'tableName':_0xcd82('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 16359c5..54d52fa 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 _0x0a9f=['catch','GetTrunk','Trunk','findAll','options','raw','where','limit','model','attributes','include','map','then','debug','stringify','ShowTrunk','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a9f,0x19d));var _0xf0a9=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x0a9f[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var moment=require('moment');var BPromise=require(_0xf0a9('0x2'));var rs=require(_0xf0a9('0x3'));var fs=require('fs');var Redis=require(_0xf0a9('0x4'));var db=require(_0xf0a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0a9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0a9('0x7'));var client=jayson[_0xf0a9('0x8')][_0xf0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e71c4,_0x36396c,_0xd1e58d){return new BPromise(function(_0x9852f8,_0x2d1794){return client[_0xf0a9('0xa')](_0x2e71c4,_0xd1e58d)['then'](function(_0x20648d){logger[_0xf0a9('0xb')](_0xf0a9('0xc'),_0x36396c,_0xf0a9('0xd'));logger['debug'](_0xf0a9('0xe'),_0x36396c,_0xf0a9('0xd'),JSON['stringify'](_0x20648d));if(_0x20648d[_0xf0a9('0xf')]){if(_0x20648d[_0xf0a9('0xf')][_0xf0a9('0x10')]===0x1f4){logger[_0xf0a9('0xf')]('Trunk,\x20%s,\x20%s',_0x36396c,_0x20648d['error'][_0xf0a9('0x11')]);return _0x2d1794(_0x20648d['error'][_0xf0a9('0x11')]);}logger['error'](_0xf0a9('0xc'),_0x36396c,_0x20648d[_0xf0a9('0xf')]['message']);return _0x9852f8(_0x20648d[_0xf0a9('0xf')][_0xf0a9('0x11')]);}else{logger[_0xf0a9('0xb')](_0xf0a9('0xc'),_0x36396c,_0xf0a9('0xd'));_0x9852f8(_0x20648d[_0xf0a9('0x12')]['message']);}})[_0xf0a9('0x13')](function(_0x5c5fb6){logger[_0xf0a9('0xf')](_0xf0a9('0xc'),_0x36396c,_0x5c5fb6);_0x2d1794(_0x5c5fb6);});});}exports[_0xf0a9('0x14')]=function(_0x2b2d4a){var _0x4609e4=this;return new Promise(function(_0x516f23,_0x556fb9){return db[_0xf0a9('0x15')][_0xf0a9('0x16')]({'raw':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a['options'][_0xf0a9('0x18')]===undefined?!![]:![]:!![],'where':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')][_0xf0a9('0x19')]||null:null,'attributes':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')]['attributes']||null:null,'limit':_0x2b2d4a['options']?_0x2b2d4a['options'][_0xf0a9('0x1a')]||null:null,'include':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')]['include']?_['map'](_0x2b2d4a[_0xf0a9('0x17')]['include'],function(_0x2d7d36){return{'model':db[_0x2d7d36[_0xf0a9('0x1b')]],'as':_0x2d7d36['as'],'attributes':_0x2d7d36[_0xf0a9('0x1c')],'include':_0x2d7d36[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x2d7d36[_0xf0a9('0x1d')],function(_0x4b6163){return{'model':db[_0x4b6163[_0xf0a9('0x1b')]],'as':_0x4b6163['as'],'attributes':_0x4b6163[_0xf0a9('0x1c')],'include':_0x4b6163['include']?_[_0xf0a9('0x1e')](_0x4b6163[_0xf0a9('0x1d')],function(_0x4cbef1){return{'model':db[_0x4cbef1[_0xf0a9('0x1b')]],'as':_0x4cbef1['as'],'attributes':_0x4cbef1[_0xf0a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0a9('0x1f')](function(_0x2e5acd){logger['info']('GetTrunk',_0x2b2d4a);logger[_0xf0a9('0x20')](_0xf0a9('0x14'),_0x2b2d4a,JSON[_0xf0a9('0x21')](_0x2e5acd));_0x516f23(_0x2e5acd);})[_0xf0a9('0x13')](function(_0x5e1ffd){logger[_0xf0a9('0xf')](_0xf0a9('0x14'),_0x5e1ffd[_0xf0a9('0x11')],_0x2b2d4a);_0x556fb9(_0x4609e4[_0xf0a9('0xf')](0x1f4,_0x5e1ffd[_0xf0a9('0x11')]));});});};exports[_0xf0a9('0x22')]=function(_0x126be3){var _0x4296f7=this;return new Promise(function(_0xd10bd4,_0x27fa4d){return db[_0xf0a9('0x15')][_0xf0a9('0x23')]({'raw':_0x126be3['options']?_0x126be3['options'][_0xf0a9('0x18')]===undefined?!![]:![]:!![],'where':_0x126be3[_0xf0a9('0x17')]?_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x19')]||null:null,'attributes':_0x126be3[_0xf0a9('0x17')]?_0x126be3['options']['attributes']||null:null,'include':_0x126be3['options']?_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x1d')],function(_0x59b24a){return{'model':db[_0x59b24a[_0xf0a9('0x1b')]],'as':_0x59b24a['as'],'attributes':_0x59b24a['attributes'],'include':_0x59b24a[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x59b24a[_0xf0a9('0x1d')],function(_0x48996a){return{'model':db[_0x48996a['model']],'as':_0x48996a['as'],'attributes':_0x48996a[_0xf0a9('0x1c')],'include':_0x48996a[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x48996a[_0xf0a9('0x1d')],function(_0x5c16ca){return{'model':db[_0x5c16ca['model']],'as':_0x5c16ca['as'],'attributes':_0x5c16ca[_0xf0a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0a9('0x1f')](function(_0x21cc38){logger[_0xf0a9('0xb')](_0xf0a9('0x22'),_0x126be3);logger[_0xf0a9('0x20')]('ShowTrunk',_0x126be3,JSON[_0xf0a9('0x21')](_0x21cc38));_0xd10bd4(_0x21cc38);})[_0xf0a9('0x13')](function(_0x27eab3){logger[_0xf0a9('0xf')](_0xf0a9('0x22'),_0x27eab3[_0xf0a9('0x11')],_0x126be3);_0x27fa4d(_0x4296f7[_0xf0a9('0xf')](0x1f4,_0x27eab3[_0xf0a9('0x11')]));});});}; \ No newline at end of file +var _0x5c94=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','findAll','options','raw','where','attributes','include','map','model','then','ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5c94,0xc2));var _0x45c9=function(_0xdac6b0,_0x52f950){_0xdac6b0=_0xdac6b0-0x0;var _0x4a73ef=_0x5c94[_0xdac6b0];return _0x4a73ef;};'use strict';var _=require(_0x45c9('0x0'));var util=require(_0x45c9('0x1'));var moment=require(_0x45c9('0x2'));var BPromise=require(_0x45c9('0x3'));var rs=require(_0x45c9('0x4'));var fs=require('fs');var Redis=require(_0x45c9('0x5'));var db=require(_0x45c9('0x6'))['db'];var utils=require(_0x45c9('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x45c9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45c9('0x9')][_0x45c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c3c51,_0x8b1ec1,_0x56aa7e){return new BPromise(function(_0x51e363,_0x2d9f6d){return client[_0x45c9('0xb')](_0x3c3c51,_0x56aa7e)['then'](function(_0x53e6c6){logger[_0x45c9('0xc')](_0x45c9('0xd'),_0x8b1ec1,_0x45c9('0xe'));logger[_0x45c9('0xf')](_0x45c9('0x10'),_0x8b1ec1,'request\x20sent',JSON[_0x45c9('0x11')](_0x53e6c6));if(_0x53e6c6[_0x45c9('0x12')]){if(_0x53e6c6['error'][_0x45c9('0x13')]===0x1f4){logger['error'](_0x45c9('0xd'),_0x8b1ec1,_0x53e6c6['error'][_0x45c9('0x14')]);return _0x2d9f6d(_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);}logger[_0x45c9('0x12')]('Trunk,\x20%s,\x20%s',_0x8b1ec1,_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);return _0x51e363(_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);}else{logger[_0x45c9('0xc')](_0x45c9('0xd'),_0x8b1ec1,_0x45c9('0xe'));_0x51e363(_0x53e6c6['result'][_0x45c9('0x14')]);}})[_0x45c9('0x15')](function(_0x1e5965){logger['error'](_0x45c9('0xd'),_0x8b1ec1,_0x1e5965);_0x2d9f6d(_0x1e5965);});});}exports[_0x45c9('0x16')]=function(_0x39cda6){var _0x4a5518=this;return new Promise(function(_0x477b88,_0x20b79e){return db['Trunk'][_0x45c9('0x17')]({'raw':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x19')]===undefined?!![]:![]:!![],'where':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x1a')]||null:null,'attributes':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x1b')]||null:null,'limit':_0x39cda6['options']?_0x39cda6[_0x45c9('0x18')]['limit']||null:null,'include':_0x39cda6[_0x45c9('0x18')]?_0x39cda6['options'][_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x39cda6['options'][_0x45c9('0x1c')],function(_0x257913){return{'model':db[_0x257913['model']],'as':_0x257913['as'],'attributes':_0x257913['attributes'],'include':_0x257913[_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x257913[_0x45c9('0x1c')],function(_0x255293){return{'model':db[_0x255293[_0x45c9('0x1e')]],'as':_0x255293['as'],'attributes':_0x255293['attributes'],'include':_0x255293[_0x45c9('0x1c')]?_['map'](_0x255293[_0x45c9('0x1c')],function(_0x1b9290){return{'model':db[_0x1b9290[_0x45c9('0x1e')]],'as':_0x1b9290['as'],'attributes':_0x1b9290['attributes']};}):[]};}):[]};}):[]:[]})[_0x45c9('0x1f')](function(_0x3b51c1){logger[_0x45c9('0xc')](_0x45c9('0x16'),_0x39cda6);logger['debug']('GetTrunk',_0x39cda6,JSON['stringify'](_0x3b51c1));_0x477b88(_0x3b51c1);})[_0x45c9('0x15')](function(_0x288561){logger['error'](_0x45c9('0x16'),_0x288561[_0x45c9('0x14')],_0x39cda6);_0x20b79e(_0x4a5518[_0x45c9('0x12')](0x1f4,_0x288561[_0x45c9('0x14')]));});});};exports[_0x45c9('0x20')]=function(_0x5b2361){var _0x12cf3c=this;return new Promise(function(_0x31c9d1,_0x372b7a){return db[_0x45c9('0x21')][_0x45c9('0x22')]({'raw':_0x5b2361[_0x45c9('0x18')]?_0x5b2361[_0x45c9('0x18')][_0x45c9('0x19')]===undefined?!![]:![]:!![],'where':_0x5b2361[_0x45c9('0x18')]?_0x5b2361['options'][_0x45c9('0x1a')]||null:null,'attributes':_0x5b2361[_0x45c9('0x18')]?_0x5b2361[_0x45c9('0x18')]['attributes']||null:null,'include':_0x5b2361['options']?_0x5b2361['options'][_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x5b2361[_0x45c9('0x18')][_0x45c9('0x1c')],function(_0xfd4f0){return{'model':db[_0xfd4f0[_0x45c9('0x1e')]],'as':_0xfd4f0['as'],'attributes':_0xfd4f0[_0x45c9('0x1b')],'include':_0xfd4f0[_0x45c9('0x1c')]?_['map'](_0xfd4f0[_0x45c9('0x1c')],function(_0x5e3c35){return{'model':db[_0x5e3c35[_0x45c9('0x1e')]],'as':_0x5e3c35['as'],'attributes':_0x5e3c35['attributes'],'include':_0x5e3c35[_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x5e3c35[_0x45c9('0x1c')],function(_0x78e27){return{'model':db[_0x78e27[_0x45c9('0x1e')]],'as':_0x78e27['as'],'attributes':_0x78e27[_0x45c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x68fa57){logger[_0x45c9('0xc')](_0x45c9('0x20'),_0x5b2361);logger['debug'](_0x45c9('0x20'),_0x5b2361,JSON[_0x45c9('0x11')](_0x68fa57));_0x31c9d1(_0x68fa57);})[_0x45c9('0x15')](function(_0x4c31e6){logger[_0x45c9('0x12')](_0x45c9('0x20'),_0x4c31e6[_0x45c9('0x14')],_0x5b2361);_0x372b7a(_0x12cf3c[_0x45c9('0x12')](0x1f4,_0x4c31e6[_0x45c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index eeb60a3..139917a 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d8=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x140c2b,_0x1f4856){var _0x367de6=function(_0x3a3a9b){while(--_0x3a3a9b){_0x140c2b['push'](_0x140c2b['shift']());}};_0x367de6(++_0x1f4856);}(_0x29d8,0xe2));var _0x829d=function(_0xf7b27d,_0x5c051b){_0xf7b27d=_0xf7b27d-0x0;var _0x57e290=_0x29d8[_0xf7b27d];return _0x57e290;};'use strict';var express=require(_0x829d('0x0'));var router=express[_0x829d('0x1')]();var auth=require(_0x829d('0x2'));var controller=require(_0x829d('0x3'));router[_0x829d('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x829d('0x5')]);module[_0x829d('0x6')]=router; \ No newline at end of file +var _0x823d=['Router','../../components/auth/service','put','update','exports','express'];(function(_0x3fd0cd,_0x25f157){var _0x521411=function(_0x236de0){while(--_0x236de0){_0x3fd0cd['push'](_0x3fd0cd['shift']());}};_0x521411(++_0x25f157);}(_0x823d,0x161));var _0xd823=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x823d[_0xea343d];return _0x2c6e9c;};'use strict';var express=require(_0xd823('0x0'));var router=express[_0xd823('0x1')]();var auth=require(_0xd823('0x2'));var controller=require('./user-setting.controller');router[_0xd823('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xd823('0x4')]);module[_0xd823('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 3add18a..dae06d0 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4902=['warning','info','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x250044,_0xe3d708){var _0x14a2d3=function(_0x2a4d0d){while(--_0x2a4d0d){_0x250044['push'](_0x250044['shift']());}};_0x14a2d3(++_0xe3d708);}(_0x4902,0x82));var _0x2490=function(_0x56686a,_0x58dc61){_0x56686a=_0x56686a-0x0;var _0x5afbf0=_0x4902[_0x56686a];return _0x5afbf0;};'use strict';var Sequelize=require(_0x2490('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2490('0x1'),_0x2490('0x2'),_0x2490('0x3'),_0x2490('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x2490('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2490('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2490('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2490('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2490('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2490('0x9')],'unique':_0x2490('0xa')}}; \ No newline at end of file +var _0xe0ff=['DATE','INTEGER','sequelize','error','warning','exports','ENUM','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe0ff,0xc2));var _0xfe0f=function(_0x3b62e3,_0x403db8){_0x3b62e3=_0x3b62e3-0x0;var _0x3211fc=_0xe0ff[_0x3b62e3];return _0x3211fc;};'use strict';var Sequelize=require(_0xfe0f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfe0f('0x1'),_0xfe0f('0x2'),'info','debug'];module[_0xfe0f('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfe0f('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfe0f('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfe0f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfe0f('0x7')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 14e510d..ee16043 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aee=['send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','sendStatus','error','stack','name'];(function(_0x262711,_0x378c42){var _0x2ff581=function(_0x244540){while(--_0x244540){_0x262711['push'](_0x262711['shift']());}};_0x2ff581(++_0x378c42);}(_0x9aee,0x71));var _0xe9ae=function(_0x200490,_0x38bbf3){_0x200490=_0x200490-0x0;var _0x40aa6d=_0x9aee[_0x200490];return _0x40aa6d;};'use strict';var _=require(_0xe9ae('0x0'));var Redis=require(_0xe9ae('0x1'));var logger=require(_0xe9ae('0x2'))(_0xe9ae('0x3'));var config=require(_0xe9ae('0x4'));var db=require(_0xe9ae('0x5'))['db'];var socket=require(_0xe9ae('0x6'))(new Redis(config[_0xe9ae('0x7')]));require(_0xe9ae('0x8'))['register'](socket);config['redis']=_['defaults'](config[_0xe9ae('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x54e9e7,_0x34cef2){_0x34cef2=_0x34cef2||0xc8;return function(_0x478bf5){if(_0x478bf5){return _0x54e9e7[_0xe9ae('0x9')](_0x34cef2)[_0xe9ae('0xa')](_0x478bf5);}};}function saveUpdates(_0x4a317a){return function(_0x2e3199){if(_0x2e3199){return _0x2e3199[_0xe9ae('0xb')](_0x4a317a)[_0xe9ae('0xc')](function(_0x4dffbd){return _0x4dffbd;});}return null;};}function handleEntityNotFound(_0x359047){return function(_0x17371c){if(!_0x17371c){_0x359047[_0xe9ae('0xd')](0x194);}return _0x17371c;};}function handleError(_0x5689ef,_0xbf049e){_0xbf049e=_0xbf049e||0x1f4;return function(_0x502fac){logger[_0xe9ae('0xe')](_0x502fac[_0xe9ae('0xf')]);if(_0x502fac[_0xe9ae('0x10')]){delete _0x502fac[_0xe9ae('0x10')];}_0x5689ef[_0xe9ae('0x9')](_0xbf049e)[_0xe9ae('0x11')](_0x502fac);};}exports[_0xe9ae('0xb')]=function(_0x3326b9,_0x4e5d3b){if(_0x3326b9[_0xe9ae('0x12')][_0xe9ae('0x13')]!=='admin')throw new Error(_0xe9ae('0x14'));if(isNaN(Number(_0x3326b9[_0xe9ae('0x15')]['id'])))throw new Error(_0xe9ae('0x16'));return db[_0xe9ae('0x17')][_0xe9ae('0x18')]({'where':{'id':_0x3326b9[_0xe9ae('0x15')]['id']}})[_0xe9ae('0xc')](handleEntityNotFound(_0x4e5d3b,null))[_0xe9ae('0xc')](saveUpdates(_0x3326b9[_0xe9ae('0x19')],null))['then'](respondWithResult(_0x4e5d3b,null))['catch'](handleError(_0x4e5d3b,null));}; \ No newline at end of file +var _0xd691=['../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','sendStatus','error','stack','name','status','send','user','role','admin','Unauthorized','UserSetting','find','params','then','body','catch','lodash','ioredis'];(function(_0x45d50b,_0x25cfa9){var _0xba96f3=function(_0x54e414){while(--_0x54e414){_0x45d50b['push'](_0x45d50b['shift']());}};_0xba96f3(++_0x25cfa9);}(_0xd691,0xe6));var _0x1d69=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xd691[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x1d69('0x0'));var Redis=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))('api');var config=require(_0x1d69('0x3'));var db=require(_0x1d69('0x4'))['db'];var socket=require(_0x1d69('0x5'))(new Redis(config[_0x1d69('0x6')]));require(_0x1d69('0x7'))[_0x1d69('0x8')](socket);config[_0x1d69('0x6')]=_[_0x1d69('0x9')](config[_0x1d69('0x6')],{'host':_0x1d69('0xa'),'port':0x18eb});function respondWithResult(_0x5a5b0c,_0x520acb){_0x520acb=_0x520acb||0xc8;return function(_0x267da3){if(_0x267da3){return _0x5a5b0c['status'](_0x520acb)[_0x1d69('0xb')](_0x267da3);}};}function saveUpdates(_0x122b27){return function(_0x1a09f0){if(_0x1a09f0){return _0x1a09f0[_0x1d69('0xc')](_0x122b27)['then'](function(_0x298c17){return _0x298c17;});}return null;};}function handleEntityNotFound(_0xe9eae1){return function(_0x296541){if(!_0x296541){_0xe9eae1[_0x1d69('0xd')](0x194);}return _0x296541;};}function handleError(_0x294e75,_0x5d2092){_0x5d2092=_0x5d2092||0x1f4;return function(_0x5d1c82){logger[_0x1d69('0xe')](_0x5d1c82[_0x1d69('0xf')]);if(_0x5d1c82[_0x1d69('0x10')]){delete _0x5d1c82[_0x1d69('0x10')];}_0x294e75[_0x1d69('0x11')](_0x5d2092)[_0x1d69('0x12')](_0x5d1c82);};}exports[_0x1d69('0xc')]=function(_0x1d98be,_0x276389){if(_0x1d98be[_0x1d69('0x13')][_0x1d69('0x14')]!==_0x1d69('0x15'))throw new Error(_0x1d69('0x16'));if(isNaN(Number(_0x1d98be['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1d69('0x17')][_0x1d69('0x18')]({'where':{'id':_0x1d98be[_0x1d69('0x19')]['id']}})[_0x1d69('0x1a')](handleEntityNotFound(_0x276389,null))[_0x1d69('0x1a')](saveUpdates(_0x1d98be[_0x1d69('0x1b')],null))['then'](respondWithResult(_0x276389,null))[_0x1d69('0x1c')](handleError(_0x276389,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index a781b3e..056beca 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d09=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x4d09,0x137));var _0x94d0=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x4d09[_0x307d86];return _0x361745;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x94d0('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x94d0('0x1')](0x0);var events={'afterCreate':_0x94d0('0x2'),'afterUpdate':_0x94d0('0x3'),'afterDestroy':_0x94d0('0x4')};function emitEvent(_0x36ce09){return function(_0x362231,_0x2681a2,_0x221920){UserSettingEvents[_0x94d0('0x5')](_0x36ce09+':'+_0x362231['id'],_0x362231);UserSettingEvents[_0x94d0('0x5')](_0x36ce09,_0x362231);_0x221920(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x94d0('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xafe0=['emit','hook','events','UserSetting','setMaxListeners','update','remove'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0xafe0,0x136));var _0x0afe=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0xafe0[_0x1d3e3f];return _0x3879fa;};'use strict';var EventEmitter=require(_0x0afe('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x0afe('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0afe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0afe('0x3'),'afterDestroy':_0x0afe('0x4')};function emitEvent(_0x38a310){return function(_0x50507d,_0x1314f7,_0x27cb87){UserSettingEvents[_0x0afe('0x5')](_0x38a310+':'+_0x50507d['id'],_0x50507d);UserSettingEvents[_0x0afe('0x5')](_0x38a310,_0x50507d);_0x27cb87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0afe('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index dab82dd..208aec1 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc788=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','user_settings','clientSideLoggingEnabled'];(function(_0x1fc7d0,_0x235642){var _0x467002=function(_0x177cc3){while(--_0x177cc3){_0x1fc7d0['push'](_0x1fc7d0['shift']());}};_0x467002(++_0x235642);}(_0xc788,0xc4));var _0x8c78=function(_0x29d849,_0x209ceb){_0x29d849=_0x29d849-0x0;var _0x30b104=_0xc788[_0x29d849];return _0x30b104;};'use strict';var attributes=require(_0x8c78('0x0'));module[_0x8c78('0x1')]=function(_0x2344ba){return _0x2344ba['define']('UserSetting',attributes,{'tableName':_0x8c78('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1af8e2){if(!_0x1af8e2[_0x8c78('0x3')])_0x1af8e2[_0x8c78('0x4')]=null;else if(_0x1af8e2[_0x8c78('0x4')]===null)_0x1af8e2['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x9861=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0xe9bbaa,_0x2c4410){var _0x556272=function(_0x55afc3){while(--_0x55afc3){_0xe9bbaa['push'](_0xe9bbaa['shift']());}};_0x556272(++_0x2c4410);}(_0x9861,0x176));var _0x1986=function(_0x471a78,_0x1289af){_0x471a78=_0x471a78-0x0;var _0xc7480d=_0x9861[_0x471a78];return _0xc7480d;};'use strict';var attributes=require(_0x1986('0x0'));module['exports']=function(_0x5071b2){return _0x5071b2[_0x1986('0x1')](_0x1986('0x2'),attributes,{'tableName':_0x1986('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ddc92){if(!_0x3ddc92[_0x1986('0x4')])_0x3ddc92[_0x1986('0x5')]=null;else if(_0x3ddc92['clientSideLoggingEnabledSince']===null)_0x3ddc92[_0x1986('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 1a4fdb6..703a2d0 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb675=['save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x362b55,_0x27b2c2){var _0x286ee1=function(_0x4d8079){while(--_0x4d8079){_0x362b55['push'](_0x362b55['shift']());}};_0x286ee1(++_0x27b2c2);}(_0xb675,0x19e));var _0x5b67=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xb675[_0x51e79c];return _0x2467be;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5b67('0x0'),_0x5b67('0x1'),_0x5b67('0x2')];function createListener(_0x374500,_0x28f921){return function(_0x3cb67a){_0x28f921[_0x5b67('0x3')](_0x374500,_0x3cb67a);if(_0x374500===_0x5b67('0x4')){_0x28f921[_0x5b67('0x3')](_0x5b67('0x5')+_0x3cb67a[_0x5b67('0x6')],_0x3cb67a);}};}exports[_0x5b67('0x7')]=function(_0xecb2c){for(var _0x351421=0x0,_0x486872=events[_0x5b67('0x8')];_0x351421<_0x486872;_0x351421++){var _0x1ecf17=events[_0x351421];var _0x269ee4=createListener('user-setting:'+_0x1ecf17,_0xecb2c);UserSettingEvents['on'](_0x1ecf17,_0x269ee4);}}; \ No newline at end of file +var _0x813e=['emit','user-setting:update','UserId','register','user-setting:','./user-setting.events','save','remove','update'];(function(_0xed09be,_0x4ee415){var _0x2de3c3=function(_0xe6f4dc){while(--_0xe6f4dc){_0xed09be['push'](_0xed09be['shift']());}};_0x2de3c3(++_0x4ee415);}(_0x813e,0x16d));var _0xe813=function(_0x26b4e8,_0x1c1a98){_0x26b4e8=_0x26b4e8-0x0;var _0x448057=_0x813e[_0x26b4e8];return _0x448057;};'use strict';var UserSettingEvents=require(_0xe813('0x0'));var events=[_0xe813('0x1'),_0xe813('0x2'),_0xe813('0x3')];function createListener(_0x3019ae,_0x1379ba){return function(_0x5153a4){_0x1379ba[_0xe813('0x4')](_0x3019ae,_0x5153a4);if(_0x3019ae===_0xe813('0x5')){_0x1379ba[_0xe813('0x4')]('user-setting:update:user-'+_0x5153a4[_0xe813('0x6')],_0x5153a4);}};}exports[_0xe813('0x7')]=function(_0x2a7b51){for(var _0x5d8edc=0x0,_0x23265d=events['length'];_0x5d8edc<_0x23265d;_0x5d8edc++){var _0x5f176e=events[_0x5d8edc];var _0x304aaf=createListener(_0xe813('0x8')+_0x5f176e,_0x2a7b51);UserSettingEvents['on'](_0x5f176e,_0x304aaf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 04467bc..e9973f7 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 _0x5453=['bulkCreate','/:id/queues','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0x5453,0x18b));var _0x3545=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5453[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var path=require(_0x3545('0x2'));var timeout=require(_0x3545('0x3'));var express=require(_0x3545('0x4'));var router=express[_0x3545('0x5')]();var fs_extra=require(_0x3545('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3545('0x7'));var controller=require(_0x3545('0x8'));router['get']('/',auth[_0x3545('0x9')](),controller['index']);router[_0x3545('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3545('0xb')]);router[_0x3545('0xa')](_0x3545('0xc'),auth['isAuthenticated'](),controller[_0x3545('0xd')]);router[_0x3545('0xa')](_0x3545('0xe'),auth[_0x3545('0x9')](),controller[_0x3545('0xf')]);router[_0x3545('0xa')](_0x3545('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x3545('0xa')](_0x3545('0x11'),controller[_0x3545('0x12')]);router[_0x3545('0xa')]('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x3545('0xa')](_0x3545('0x13'),auth['isAuthenticated'](),controller[_0x3545('0x14')]);router['get']('/:id/queues',auth[_0x3545('0x9')](),controller[_0x3545('0x15')]);router['get'](_0x3545('0x16'),auth[_0x3545('0x9')](),controller['getVoiceQueuesRt']);router[_0x3545('0xa')]('/:id/groups',auth[_0x3545('0x9')](),controller[_0x3545('0x17')]);router[_0x3545('0xa')](_0x3545('0x18'),auth['isAuthenticated'](),controller[_0x3545('0x19')]);router[_0x3545('0xa')]('/:id/screen_recordings',auth[_0x3545('0x9')](),controller[_0x3545('0x1a')]);router[_0x3545('0xa')](_0x3545('0x1b'),auth[_0x3545('0x9')](),controller[_0x3545('0x1c')]);router[_0x3545('0xa')](_0x3545('0x1d'),auth[_0x3545('0x9')](),controller[_0x3545('0x1e')]);router[_0x3545('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x3545('0x1f')]);router['get'](_0x3545('0x20'),auth[_0x3545('0x9')](),controller['getSmsInteractions']);router[_0x3545('0xa')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x3545('0x21')]);router[_0x3545('0xa')]('/:id/whatsapp/interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x22')]);router[_0x3545('0xa')](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x24')]);router['get'](_0x3545('0x25'),auth[_0x3545('0x9')](),controller[_0x3545('0x26')]);router[_0x3545('0xa')](_0x3545('0x27'),auth[_0x3545('0x9')](),controller[_0x3545('0x28')]);router['get'](_0x3545('0x29'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0x3545('0x9')](),controller['getFaxAccounts']);router[_0x3545('0xa')](_0x3545('0x2a'),auth[_0x3545('0x9')](),controller[_0x3545('0x2b')]);router[_0x3545('0xa')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller[_0x3545('0x2d')]);router[_0x3545('0xa')](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller['getSmsAccounts']);router['get'](_0x3545('0x2f'),auth[_0x3545('0x9')](),controller['getChatWebsites']);router[_0x3545('0xa')](_0x3545('0x30'),auth[_0x3545('0x9')](),controller[_0x3545('0x31')]);router[_0x3545('0xa')](_0x3545('0x32'),auth[_0x3545('0x9')](),controller[_0x3545('0x33')]);router[_0x3545('0xa')](_0x3545('0x34'),auth['isAuthenticated'](),controller[_0x3545('0x35')]);router[_0x3545('0x36')](_0x3545('0x13'),auth[_0x3545('0x9')](),controller[_0x3545('0x37')]);router[_0x3545('0x36')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3545('0x36')](_0x3545('0x38'),auth[_0x3545('0x9')](),controller[_0x3545('0x39')]);router[_0x3545('0x36')](_0x3545('0x3a'),auth['isAuthenticated'](),controller[_0x3545('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b206c,_0x54051c,_0x261c5f){_0x261c5f(null,path[_0x3545('0x3c')](config['root'],_0x3545('0x3d')));},'filename':function(_0x3ce42c,_0x2c1386,_0x19d30a){_0x19d30a(null,util[_0x3545('0x3e')](_0x3545('0x3f'),Date[_0x3545('0x40')](),_0x2c1386[_0x3545('0x41')]));}})});router['post'](_0x3545('0x11'),upload[_0x3545('0x42')](_0x3545('0x43')),controller[_0x3545('0x44')]);router[_0x3545('0x36')](_0x3545('0x45'),auth['isAuthenticated'](),controller['login']);router[_0x3545('0x36')](_0x3545('0x46'),auth[_0x3545('0x9')](),controller[_0x3545('0x47')]);router[_0x3545('0x36')]('/:id/pause',auth[_0x3545('0x9')](),controller[_0x3545('0x48')]);router[_0x3545('0x36')]('/:id/unpause',auth[_0x3545('0x9')](),controller[_0x3545('0x49')]);router['post'](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x4a')]);router['post'](_0x3545('0x4b'),auth[_0x3545('0x9')](),controller[_0x3545('0x4c')]);router[_0x3545('0x36')](_0x3545('0x4d'),auth[_0x3545('0x9')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x4e')]);router[_0x3545('0x36')](_0x3545('0x4f'),auth['isAuthenticated'](),controller[_0x3545('0x50')]);router[_0x3545('0x36')](_0x3545('0x51'),auth[_0x3545('0x9')](),controller[_0x3545('0x52')]);router[_0x3545('0x36')](_0x3545('0x53'),auth[_0x3545('0x9')](),controller[_0x3545('0x54')]);router['post']('/:id/fax_accounts',auth[_0x3545('0x9')](),controller['addFaxAccounts']);router[_0x3545('0x36')](_0x3545('0x2a'),auth['isAuthenticated'](),controller[_0x3545('0x55')]);router[_0x3545('0x36')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller['addOpenchannelAccounts']);router['post'](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller['addSmsAccounts']);router[_0x3545('0x36')]('/:id/chat_websites',auth[_0x3545('0x9')](),controller[_0x3545('0x56')]);router['post'](_0x3545('0x30'),auth['isAuthenticated'](),controller[_0x3545('0x57')]);router[_0x3545('0x36')](_0x3545('0x34'),auth[_0x3545('0x9')](),controller[_0x3545('0x58')]);router[_0x3545('0x59')](_0x3545('0x10'),auth[_0x3545('0x9')](),controller[_0x3545('0x5a')]);router['put'](_0x3545('0x5b'),auth['isAuthenticated'](),controller[_0x3545('0x5c')]);router['delete']('/:id/queues',auth[_0x3545('0x9')](),controller[_0x3545('0x5d')]);router[_0x3545('0x5e')](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x5f')]);router[_0x3545('0x5e')](_0x3545('0x10'),auth[_0x3545('0x9')](),controller[_0x3545('0x60')]);router['delete'](_0x3545('0x4b'),auth['isAuthenticated'](),controller[_0x3545('0x61')]);router[_0x3545('0x5e')](_0x3545('0x4d'),auth[_0x3545('0x9')](),controller[_0x3545('0x62')]);router['delete']('/:id/fax_interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x63')]);router[_0x3545('0x5e')](_0x3545('0x4f'),auth['isAuthenticated'](),controller[_0x3545('0x64')]);router[_0x3545('0x5e')]('/:id/openchannel_interactions',auth[_0x3545('0x9')](),controller['removeOpenchannelInteractions']);router[_0x3545('0x5e')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x3545('0x65')]);router[_0x3545('0x5e')](_0x3545('0x66'),auth[_0x3545('0x9')](),controller[_0x3545('0x67')]);router[_0x3545('0x5e')](_0x3545('0x2a'),auth[_0x3545('0x9')](),controller[_0x3545('0x68')]);router[_0x3545('0x5e')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller[_0x3545('0x69')]);router[_0x3545('0x5e')](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller[_0x3545('0x6a')]);router['delete'](_0x3545('0x2f'),auth[_0x3545('0x9')](),controller[_0x3545('0x6b')]);router[_0x3545('0x5e')](_0x3545('0x30'),auth[_0x3545('0x9')](),controller[_0x3545('0x6c')]);router[_0x3545('0x5e')](_0x3545('0x34'),auth[_0x3545('0x9')](),controller[_0x3545('0x6d')]);router[_0x3545('0x36')](_0x3545('0x6e'),auth[_0x3545('0x9')](),controller[_0x3545('0x6f')]);module[_0x3545('0x70')]=router; \ No newline at end of file +var _0x09ef=['removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','diskStorage','join','root','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x171f52,_0x29b514){var _0x149c78=function(_0xc62a08){while(--_0xc62a08){_0x171f52['push'](_0x171f52['shift']());}};_0x149c78(++_0x29b514);}(_0x09ef,0x15e));var _0xf09e=function(_0x1cee93,_0x5de9e8){_0x1cee93=_0x1cee93-0x0;var _0x20068a=_0x09ef[_0x1cee93];return _0x20068a;};'use strict';var multer=require(_0xf09e('0x0'));var util=require(_0xf09e('0x1'));var path=require(_0xf09e('0x2'));var timeout=require(_0xf09e('0x3'));var express=require(_0xf09e('0x4'));var router=express[_0xf09e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf09e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf09e('0x7'));var controller=require(_0xf09e('0x8'));router[_0xf09e('0x9')]('/',auth[_0xf09e('0xa')](),controller[_0xf09e('0xb')]);router[_0xf09e('0x9')](_0xf09e('0xc'),auth[_0xf09e('0xa')](),controller[_0xf09e('0xd')]);router[_0xf09e('0x9')]('/whoami',auth[_0xf09e('0xa')](),controller[_0xf09e('0xe')]);router[_0xf09e('0x9')](_0xf09e('0xf'),auth[_0xf09e('0xa')](),controller['getPresence']);router['get'](_0xf09e('0x10'),auth[_0xf09e('0xa')](),controller['show']);router[_0xf09e('0x9')]('/:id/avatar',controller[_0xf09e('0x11')]);router[_0xf09e('0x9')](_0xf09e('0x12'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x13')]);router[_0xf09e('0x9')]('/:id/contacts',auth[_0xf09e('0xa')](),controller['getContacts']);router[_0xf09e('0x9')](_0xf09e('0x14'),auth[_0xf09e('0xa')](),controller['getQueues']);router[_0xf09e('0x9')](_0xf09e('0x15'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x16')]);router[_0xf09e('0x9')](_0xf09e('0x17'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x18')]);router['get'](_0xf09e('0x19'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1a')]);router[_0xf09e('0x9')](_0xf09e('0x1b'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1c')]);router[_0xf09e('0x9')](_0xf09e('0x1d'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1e')]);router['get'](_0xf09e('0x1f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x20')]);router[_0xf09e('0x9')]('/:id/mail/interactions',auth[_0xf09e('0xa')](),controller['getMailInteractions']);router[_0xf09e('0x9')](_0xf09e('0x21'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x22')]);router[_0xf09e('0x9')](_0xf09e('0x23'),auth['isAuthenticated'](),controller[_0xf09e('0x24')]);router[_0xf09e('0x9')](_0xf09e('0x25'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x26')]);router['get'](_0xf09e('0x27'),auth[_0xf09e('0xa')](),controller['getTeams']);router[_0xf09e('0x9')](_0xf09e('0x28'),auth['isAuthenticated'](),controller[_0xf09e('0x29')]);router[_0xf09e('0x9')](_0xf09e('0x2a'),auth['isAuthenticated'](),controller[_0xf09e('0x2b')]);router[_0xf09e('0x9')](_0xf09e('0x2c'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x2d')]);router['get'](_0xf09e('0x2e'),auth[_0xf09e('0xa')](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xf09e('0xa')](),controller[_0xf09e('0x2f')]);router[_0xf09e('0x9')](_0xf09e('0x30'),auth[_0xf09e('0xa')](),controller['getOpenchannelAccounts']);router[_0xf09e('0x9')](_0xf09e('0x31'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x32')]);router[_0xf09e('0x9')](_0xf09e('0x33'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x34')]);router[_0xf09e('0x9')](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x36')]);router['get'](_0xf09e('0x37'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x38')]);router[_0xf09e('0x9')](_0xf09e('0x39'),auth[_0xf09e('0xa')](),controller['getApiKey']);router[_0xf09e('0x3a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf09e('0x3b')]);router['post']('/',auth[_0xf09e('0xa')](),controller[_0xf09e('0x3c')]);router[_0xf09e('0x3a')](_0xf09e('0x3d'),auth[_0xf09e('0xa')](),controller['bulkCreate']);router[_0xf09e('0x3a')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xf09e('0x3e')]({'destination':function(_0x41bcc5,_0x505a8c,_0x2134d0){_0x2134d0(null,path[_0xf09e('0x3f')](config[_0xf09e('0x40')],'server/files/images/'));},'filename':function(_0x4c1fa0,_0xe3dc65,_0x1b4705){_0x1b4705(null,util['format'](_0xf09e('0x41'),Date[_0xf09e('0x42')](),_0xe3dc65[_0xf09e('0x43')]));}})});router[_0xf09e('0x3a')](_0xf09e('0x44'),upload[_0xf09e('0x45')](_0xf09e('0x46')),controller['addAvatar']);router[_0xf09e('0x3a')](_0xf09e('0x47'),auth['isAuthenticated'](),controller[_0xf09e('0x48')]);router[_0xf09e('0x3a')](_0xf09e('0x49'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x4a')]);router[_0xf09e('0x3a')](_0xf09e('0x4b'),auth['isAuthenticated'](),controller[_0xf09e('0x4c')]);router['post'](_0xf09e('0x4d'),auth['isAuthenticated'](),controller[_0xf09e('0x4e')]);router[_0xf09e('0x3a')](_0xf09e('0x27'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf09e('0x3a')](_0xf09e('0x4f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x50')]);router[_0xf09e('0x3a')](_0xf09e('0x51'),auth[_0xf09e('0xa')](),controller['addMailInteractions']);router[_0xf09e('0x3a')](_0xf09e('0x52'),auth[_0xf09e('0xa')](),controller['addFaxInteractions']);router[_0xf09e('0x3a')](_0xf09e('0x53'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x54')]);router[_0xf09e('0x3a')](_0xf09e('0x55'),auth[_0xf09e('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0xf09e('0x56'),auth[_0xf09e('0xa')](),controller['addWhatsappInteractions']);router['post'](_0xf09e('0x2e'),auth['isAuthenticated'](),controller[_0xf09e('0x57')]);router[_0xf09e('0x3a')](_0xf09e('0x58'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x59')]);router[_0xf09e('0x3a')](_0xf09e('0x30'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5a')]);router[_0xf09e('0x3a')](_0xf09e('0x31'),auth['isAuthenticated'](),controller[_0xf09e('0x5b')]);router['post'](_0xf09e('0x33'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5c')]);router['post'](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5d')]);router[_0xf09e('0x3a')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf09e('0x5e')]);router['put'](_0xf09e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xf09e('0x5f')]('/:id/password',auth['isAuthenticated'](),controller[_0xf09e('0x60')]);router[_0xf09e('0x61')](_0xf09e('0x14'),auth[_0xf09e('0xa')](),controller['removeQueues']);router[_0xf09e('0x61')](_0xf09e('0x27'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x62')]);router[_0xf09e('0x61')](_0xf09e('0x10'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x63')]);router[_0xf09e('0x61')](_0xf09e('0x4f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x64')]);router['delete'](_0xf09e('0x51'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x65')]);router[_0xf09e('0x61')]('/:id/fax_interactions',auth[_0xf09e('0xa')](),controller[_0xf09e('0x66')]);router['delete'](_0xf09e('0x53'),auth['isAuthenticated'](),controller[_0xf09e('0x67')]);router['delete'](_0xf09e('0x55'),auth[_0xf09e('0xa')](),controller['removeOpenchannelInteractions']);router[_0xf09e('0x61')](_0xf09e('0x56'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x68')]);router[_0xf09e('0x61')](_0xf09e('0x2e'),auth['isAuthenticated'](),controller[_0xf09e('0x69')]);router[_0xf09e('0x61')](_0xf09e('0x58'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6a')]);router[_0xf09e('0x61')](_0xf09e('0x30'),auth['isAuthenticated'](),controller[_0xf09e('0x6b')]);router[_0xf09e('0x61')](_0xf09e('0x31'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6c')]);router['delete'](_0xf09e('0x33'),auth['isAuthenticated'](),controller[_0xf09e('0x6d')]);router[_0xf09e('0x61')](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6e')]);router[_0xf09e('0x61')](_0xf09e('0x39'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6f')]);router['post'](_0xf09e('0x70'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x71')]);module[_0xf09e('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index ba68639..0a2abb8 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 _0x4bd5=['PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','join','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','wss','icesupport','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','STRING','name','setDataValue','defaultuser','format','getDataValue','internal','email','toLowerCase','user','agent','local','accountcode','callerid','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x169bc3,_0xae09fa){var _0x7ada13=function(_0x1e73d2){while(--_0x1e73d2){_0x169bc3['push'](_0x169bc3['shift']());}};_0x7ada13(++_0xae09fa);}(_0x4bd5,0x94));var _0x54bd=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x4bd5[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require(_0x54bd('0x0'));var moment=require(_0x54bd('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'unique':_0x54bd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c825c){this[_0x54bd('0x4')](_0x54bd('0x3'),_0x4c825c);this[_0x54bd('0x4')](_0x54bd('0x5'),_0x4c825c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x34cc9f){this[_0x54bd('0x4')]('fullname',_0x34cc9f);this['setDataValue']('callerid',util[_0x54bd('0x6')]('\x22%s\x22\x20<%s>',_0x34cc9f,this[_0x54bd('0x7')](_0x54bd('0x8'))));}},'alias':{'type':Sequelize[_0x54bd('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xa36a4d){if(_0xa36a4d){this[_0x54bd('0x4')](_0x54bd('0x9'),_0xa36a4d[_0x54bd('0xa')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x54bd('0xb'),_0x54bd('0xc'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x54bd('0xd')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x54bd('0x8'),'set':function(_0x177184){this['setDataValue'](_0x54bd('0x8'),_0x177184);this[_0x54bd('0x4')](_0x54bd('0xe'),_0x177184);this['setDataValue'](_0x54bd('0xf'),util[_0x54bd('0x6')](_0x54bd('0x10'),this[_0x54bd('0x7')](_0x54bd('0x11')),_0x177184));}},'salt':{'type':Sequelize[_0x54bd('0x2')]},'phone':{'type':Sequelize[_0x54bd('0x2')]},'mobile':{'type':Sequelize[_0x54bd('0x2')]},'address':{'type':Sequelize[_0x54bd('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x54bd('0x2')]},'city':{'type':Sequelize[_0x54bd('0x2')]},'country':{'type':Sequelize[_0x54bd('0x2')]},'online':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x54bd('0x13')},'lastPauseAt':{'type':Sequelize[_0x54bd('0x14')]},'chatCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x54bd('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x54bd('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x54bd('0x16')},'ipaddr':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x54bd('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x18'),'user','peer'),'allowNull':!![],'defaultValue':_0x54bd('0x18')},'context':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x19')},'callingpres':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x1a'),_0x54bd('0x1b'),_0x54bd('0x1c'),_0x54bd('0x1d'),_0x54bd('0x1e'),_0x54bd('0x1f'),_0x54bd('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x21'),'set':function(_0x16f8bc){this[_0x54bd('0x4')]('transport',_0x16f8bc?_0x16f8bc['join'](','):null);},'get':function(){return this[_0x54bd('0x7')]('transport')?this[_0x54bd('0x7')](_0x54bd('0x22'))[_0x54bd('0x23')](','):null;},'comment':_0x54bd('0x24')},'dtmfmode':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x25'),'info',_0x54bd('0x26'),_0x54bd('0x27'),_0x54bd('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x54bd('0x17')]('yes','no',_0x54bd('0x29'),_0x54bd('0x2a'),_0x54bd('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x55d0bc){this[_0x54bd('0x4')]('nat',_0x55d0bc?_0x55d0bc[_0x54bd('0x2d')](','):null);},'get':function(){return this[_0x54bd('0x7')]('nat')?this[_0x54bd('0x7')](_0x54bd('0x2e'))[_0x54bd('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x54bd('0x2')]},'namedcallgroup':{'type':Sequelize[_0x54bd('0x2')]},'pickupgroup':{'type':Sequelize[_0x54bd('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x54bd('0x2')]},'language':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54bd('0x2f'),'set':function(_0x27442d){this[_0x54bd('0x4')](_0x54bd('0x30'),_0x27442d?_0x27442d[_0x54bd('0x2d')](';'):_0x54bd('0x2f'));},'get':function(){return this[_0x54bd('0x7')](_0x54bd('0x30'))?this['getDataValue'](_0x54bd('0x30'))[_0x54bd('0x23')](';'):null;},'comment':_0x54bd('0x31')},'autoframing':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x8210cf){this[_0x54bd('0x4')](_0x54bd('0x32'),_0x8210cf?_0x8210cf[_0x54bd('0x2d')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x54bd('0x7')]('insecure')[_0x54bd('0x23')](','):null;},'comment':_0x54bd('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x35')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x54bd('0x2c')},'busylevel':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x54bd('0x37'),_0x54bd('0x38'),_0x54bd('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x3a'),_0x54bd('0x3b')),'allowNull':!![],'defaultValue':_0x54bd('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no',_0x54bd('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x3d'),_0x54bd('0x3e'),_0x54bd('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x29'),_0x54bd('0x2a'),_0x54bd('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x54bd('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x54bd('0x14')]},'passwordResetAt':{'type':Sequelize[_0x54bd('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x54bd('0x41')]},'showWebBar':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0,'set':function(_0x53f506){this[_0x54bd('0x4')](_0x54bd('0x42'),_0x53f506);var _0x49610e=this['get']({'plain':!![]});switch(_0x53f506){case 0x0:case 0x1:var _0x36cf9d=_0x49610e[_0x54bd('0x22')]?_[_0x54bd('0x43')](_0x49610e[_0x54bd('0x22')])?_0x49610e[_0x54bd('0x22')][_0x54bd('0x2d')]():_0x49610e[_0x54bd('0x22')]:_0x54bd('0x21');if(_0x36cf9d==='wss'){_0x36cf9d=_0x54bd('0x21');}this[_0x54bd('0x4')]('transport',_0x36cf9d);this['setDataValue'](_0x54bd('0x44'),'no');this[_0x54bd('0x4')](_0x54bd('0x45'),null);this['setDataValue'](_0x54bd('0x46'),null);this['setDataValue']('icesupport',null);this[_0x54bd('0x4')](_0x54bd('0x47'),null);this[_0x54bd('0x4')](_0x54bd('0x48'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x54bd('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x54bd('0x4a'),'no');break;case 0x2:this[_0x54bd('0x4')](_0x54bd('0x22'),_0x54bd('0x4b'));this[_0x54bd('0x4')]('encryption',_0x54bd('0x2c'));this[_0x54bd('0x4')]('avpf',_0x54bd('0x2c'));this[_0x54bd('0x4')](_0x54bd('0x46'),'yes');this[_0x54bd('0x4')](_0x54bd('0x4c'),_0x54bd('0x2c'));this[_0x54bd('0x4')](_0x54bd('0x47'),'yes');this['setDataValue'](_0x54bd('0x48'),'no');this['setDataValue']('dtlssetup','actpass');this[_0x54bd('0x4')](_0x54bd('0x49'),_0x49610e[_0x54bd('0x49')]||_0x54bd('0x4d'));this['setDataValue'](_0x54bd('0x4e'),_0x49610e[_0x54bd('0x4e')]||_0x54bd('0x4f'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x54bd('0x41')],'set':function(_0x51da01){this[_0x54bd('0x4')](_0x54bd('0x50'),_0x51da01?_0x51da01[_0x54bd('0x2d')](','):[]);},'get':function(){return this[_0x54bd('0x7')]('permissions')?_['map'](this[_0x54bd('0x7')]('permissions')[_0x54bd('0x23')](','),function(_0x157295){return parseInt(_0x157295,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x54bd('0x51')],'get':function(){return this[_0x54bd('0x7')](_0x54bd('0x52'))?this[_0x54bd('0x7')](_0x54bd('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![],'set':function(_0x14cfa2){if(typeof _0x14cfa2===_0x54bd('0x53')){var _0x38d21e=_0x14cfa2==='1'?!![]:_0x14cfa2==='0'?![]:_0x14cfa2===_0x54bd('0x54')?!![]:_0x14cfa2===_0x54bd('0x55')?![]:![];this[_0x54bd('0x4')](_0x54bd('0x56'),_0x38d21e);}else{this[_0x54bd('0x4')](_0x54bd('0x56'),_0x14cfa2);}}},'blocked':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![],'set':function(_0x1c279c){this[_0x54bd('0x4')](_0x54bd('0x57'),_0x1c279c);if(_0x1c279c===!![]){this[_0x54bd('0x4')](_0x54bd('0x58'),moment());this['setDataValue'](_0x54bd('0x59'),0x0);}else{this[_0x54bd('0x4')](_0x54bd('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0xe7a5=['internal','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','join','all','allow','ulaw;alaw;gsm','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','blocked','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue'];(function(_0x39d0e3,_0x9c9ad0){var _0x786ac=function(_0x240204){while(--_0x240204){_0x39d0e3['push'](_0x39d0e3['shift']());}};_0x786ac(++_0x9c9ad0);}(_0xe7a5,0xa6));var _0x5e7a=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe7a5[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require(_0x5e7a('0x0'));var moment=require('moment');var util=require(_0x5e7a('0x1'));var _=require(_0x5e7a('0x2'));module[_0x5e7a('0x3')]={'name':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'unique':_0x5e7a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x150bdf){this[_0x5e7a('0x6')](_0x5e7a('0x5'),_0x150bdf);this[_0x5e7a('0x6')]('defaultuser',_0x150bdf);},'comment':_0x5e7a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x17f137){this[_0x5e7a('0x6')](_0x5e7a('0x8'),_0x17f137);this[_0x5e7a('0x6')](_0x5e7a('0x9'),util['format'](_0x5e7a('0xa'),_0x17f137,this[_0x5e7a('0xb')](_0x5e7a('0xc'))));}},'alias':{'type':Sequelize[_0x5e7a('0x4')]},'email':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x586397){if(_0x586397){this[_0x5e7a('0x6')]('email',_0x586397[_0x5e7a('0xd')]());}}},'role':{'type':Sequelize[_0x5e7a('0xe')]('admin',_0x5e7a('0xf'),_0x5e7a('0x10'),_0x5e7a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x5e7a('0x12')},'internal':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':![],'unique':_0x5e7a('0xc'),'set':function(_0x128171){this[_0x5e7a('0x6')](_0x5e7a('0xc'),_0x128171);this[_0x5e7a('0x6')](_0x5e7a('0x14'),_0x128171);this['setDataValue']('callerid',util['format']('\x22%s\x22\x20<%s>',this[_0x5e7a('0xb')](_0x5e7a('0x8')),_0x128171));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5e7a('0x4')]},'mobile':{'type':Sequelize[_0x5e7a('0x4')]},'address':{'type':Sequelize[_0x5e7a('0x4')]},'zipcode':{'type':Sequelize[_0x5e7a('0x4')]},'userpic':{'type':Sequelize[_0x5e7a('0x4')]},'city':{'type':Sequelize[_0x5e7a('0x4')]},'country':{'type':Sequelize[_0x5e7a('0x4')]},'online':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x5e7a('0x16')},'lastPauseAt':{'type':Sequelize[_0x5e7a('0x17')]},'chatCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5e7a('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5e7a('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x18'),_0x5e7a('0xf'),_0x5e7a('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x1a')},'callingpres':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x1b'),_0x5e7a('0x1c'),_0x5e7a('0x1d'),_0x5e7a('0x1e'),_0x5e7a('0x1f'),'PROHIB_PASSED_SCREEN',_0x5e7a('0x20'),_0x5e7a('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x22'),'set':function(_0x5c3e1c){this[_0x5e7a('0x6')](_0x5e7a('0x23'),_0x5c3e1c?_0x5c3e1c['join'](','):null);},'get':function(){return this['getDataValue'](_0x5e7a('0x23'))?this[_0x5e7a('0xb')](_0x5e7a('0x23'))[_0x5e7a('0x24')](','):null;},'comment':_0x5e7a('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5e7a('0x26'),_0x5e7a('0x27'),'shortinfo',_0x5e7a('0x28'),_0x5e7a('0x29')),'allowNull':!![],'defaultValue':_0x5e7a('0x26')},'directmedia':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no','nonat',_0x5e7a('0x2b'),_0x5e7a('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5e7a('0x2d'),'set':function(_0x19a38f){this[_0x5e7a('0x6')](_0x5e7a('0x2e'),_0x19a38f?_0x19a38f[_0x5e7a('0x2f')](','):null);},'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x2e'))?this[_0x5e7a('0xb')](_0x5e7a('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5e7a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x5e7a('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x5e7a('0x4')]},'language':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5e7a('0x4')]},'disallow':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'defaultValue':_0x5e7a('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1f250b){this['setDataValue'](_0x5e7a('0x31'),_0x1f250b?_0x1f250b[_0x5e7a('0x2f')](';'):_0x5e7a('0x32'));},'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x31'))?this[_0x5e7a('0xb')]('allow')[_0x5e7a('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'set':function(_0x38db51){this[_0x5e7a('0x6')](_0x5e7a('0x33'),_0x38db51?_0x38db51[_0x5e7a('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x5e7a('0x33'))?this[_0x5e7a('0xb')](_0x5e7a('0x33'))[_0x5e7a('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x35')},'amaflags':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x36'),_0x5e7a('0x37'),_0x5e7a('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x39'),_0x5e7a('0x3a')),'allowNull':!![],'defaultValue':_0x5e7a('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x3b'),_0x5e7a('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x3d'),_0x5e7a('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x3f'),_0x5e7a('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5e7a('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5e7a('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5e7a('0x40')]},'showWebBar':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0,'set':function(_0x1e6ca0){this[_0x5e7a('0x6')](_0x5e7a('0x41'),_0x1e6ca0);var _0x482245=this[_0x5e7a('0x42')]({'plain':!![]});switch(_0x1e6ca0){case 0x0:case 0x1:var _0x2a05c1=_0x482245[_0x5e7a('0x23')]?_[_0x5e7a('0x43')](_0x482245[_0x5e7a('0x23')])?_0x482245[_0x5e7a('0x23')][_0x5e7a('0x2f')]():_0x482245[_0x5e7a('0x23')]:_0x5e7a('0x22');if(_0x2a05c1===_0x5e7a('0x44')){_0x2a05c1=_0x5e7a('0x22');}this['setDataValue']('transport',_0x2a05c1);this[_0x5e7a('0x6')](_0x5e7a('0x45'),'no');this[_0x5e7a('0x6')](_0x5e7a('0x46'),null);this[_0x5e7a('0x6')](_0x5e7a('0x47'),null);this[_0x5e7a('0x6')](_0x5e7a('0x48'),null);this['setDataValue'](_0x5e7a('0x49'),null);this[_0x5e7a('0x6')]('dtlsverify',null);this[_0x5e7a('0x6')]('dtlssetup',null);this[_0x5e7a('0x6')](_0x5e7a('0x4a'),null);this['setDataValue'](_0x5e7a('0x4b'),null);this['setDataValue'](_0x5e7a('0x4c'),'no');break;case 0x2:this[_0x5e7a('0x6')](_0x5e7a('0x23'),_0x5e7a('0x44'));this[_0x5e7a('0x6')]('encryption',_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x46'),'yes');this['setDataValue'](_0x5e7a('0x47'),_0x5e7a('0x2a'));this[_0x5e7a('0x6')]('icesupport',_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x49'),_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x4d'),'no');this[_0x5e7a('0x6')](_0x5e7a('0x4e'),_0x5e7a('0x4f'));this[_0x5e7a('0x6')](_0x5e7a('0x4a'),_0x482245[_0x5e7a('0x4a')]||_0x5e7a('0x50'));this[_0x5e7a('0x6')](_0x5e7a('0x4b'),_0x482245[_0x5e7a('0x4b')]||_0x5e7a('0x51'));this['setDataValue'](_0x5e7a('0x4c'),_0x5e7a('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5bb734){this['setDataValue']('permissions',_0x5bb734?_0x5bb734[_0x5e7a('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0x5e7a('0x52'))?_[_0x5e7a('0x53')](this[_0x5e7a('0xb')](_0x5e7a('0x52'))[_0x5e7a('0x24')](','),function(_0xfc230e){return parseInt(_0xfc230e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x54'))?this[_0x5e7a('0xb')](_0x5e7a('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![],'set':function(_0x26b863){if(typeof _0x26b863===_0x5e7a('0x55')){var _0x18c5d1=_0x26b863==='1'?!![]:_0x26b863==='0'?![]:_0x26b863==='true'?!![]:_0x26b863===_0x5e7a('0x56')?![]:![];this[_0x5e7a('0x6')]('screenrecording',_0x18c5d1);}else{this['setDataValue']('screenrecording',_0x26b863);}}},'blocked':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![],'set':function(_0x55e91a){this['setDataValue'](_0x5e7a('0x57'),_0x55e91a);if(_0x55e91a===!![]){this[_0x5e7a('0x6')](_0x5e7a('0x58'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x5e7a('0x6')](_0x5e7a('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x5e7a('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5e7a('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9693b0b..a671a2e 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 _0x6766=['UserSetting','attributes','push','findAll','openTabs','true','rows','length','chat','sms','dataValues','fax','mail','whatsapp','catch','show','params','userSetting','merge','options','all','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','113','110','105','106','107','108','109','100','111','114','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','checkUserLimits','settingsEnabled','userProfileId','create','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','Queue:save','voice','VoiceQueue','format','UserVoiceQueueRt','upsert','removeQueues','channel','remove','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','download','root','server/files/images/','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','rawAttributes','keys','intersection','fields','sort','pick','filters','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','order','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','mobile','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyIat','getUserSetting','getPresence','idle','unknown','ringing','queues','inbound','flatten','lower','col','asc','desc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','busy','charAt','toUpperCase','slice','field','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','moment','lodash','squel','ioredis','jayson/promise','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../errors/api','APIForbiddenrror','handleError','socket.io-emitter','redis','./user.socket','register','localhost','http','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','update','role','agent','emit','destroy','get','Users','user','Agents','Telephones','ignore','value','includes','find','name','UserProfileResource','stack','send','User','map','type','key','filter','password','previousPasswords','resetPasswordToken','where','query','includeAll','include'];(function(_0x1f72fa,_0x474365){var _0x5c29e=function(_0x61756c){while(--_0x61756c){_0x1f72fa['push'](_0x1f72fa['shift']());}};_0x5c29e(++_0x474365);}(_0x6766,0x146));var _0x6676=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x6766[_0x46c1d5];return _0x40fe7b;};'use strict';var moment=require(_0x6676('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6676('0x1'));var squel=require(_0x6676('0x2'));var Redis=require(_0x6676('0x3'));var jayson=require(_0x6676('0x4'));var authService=require('../../components/auth/service');var contacts=require(_0x6676('0x5'));var qs=require(_0x6676('0x6'));var rta=require(_0x6676('0x7'));var logger=require(_0x6676('0x8'))(_0x6676('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x6676('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x6676('0xa'))['APINotFoundError'];var APIForbiddenError=require(_0x6676('0xa'))[_0x6676('0xb')];var APIHandleError=require(_0x6676('0xa'))[_0x6676('0xc')];var db=require('../../mysqldb')['db'];var socket=require(_0x6676('0xd'))(new Redis(config[_0x6676('0xe')]));require(_0x6676('0xf'))[_0x6676('0x10')](socket);config[_0x6676('0xe')]=_['defaults'](config[_0x6676('0xe')],{'host':_0x6676('0x11'),'port':0x18eb});var amiClient=jayson['client'][_0x6676('0x12')]({'port':0x232a});var values;function respondWithStatusCode(_0x1ec884,_0x550fe2){_0x550fe2=_0x550fe2||0xcc;return function(_0x2a9f86){if(_0x2a9f86){return _0x1ec884[_0x6676('0x13')](_0x550fe2);}return _0x1ec884['status'](_0x550fe2)[_0x6676('0x14')]();};}function respondWithResult(_0x2e79de,_0x5c589f){_0x5c589f=_0x5c589f||0xc8;return function(_0x3e303d){if(_0x3e303d){return _0x2e79de['status'](_0x5c589f)['json'](_0x3e303d);}};}function respondWithFilteredResult(_0x230386,_0x15d7e1){return function(_0x1800a1){if(_0x1800a1){var _0x1cbf43=typeof _0x15d7e1[_0x6676('0x15')]===_0x6676('0x16')&&typeof _0x15d7e1[_0x6676('0x17')]===_0x6676('0x16');var _0x2d9cc8=_0x1800a1['count'];var _0x2c4ea9=_0x1cbf43?0x0:_0x15d7e1[_0x6676('0x15')];var _0x390cfd=_0x1cbf43?_0x1800a1[_0x6676('0x18')]:_0x15d7e1['offset']+_0x15d7e1[_0x6676('0x17')];var _0x4c2079;if(_0x390cfd>=_0x2d9cc8){_0x390cfd=_0x2d9cc8;_0x4c2079=0xc8;}else{_0x4c2079=0xce;}_0x230386[_0x6676('0x19')](_0x4c2079);return _0x230386[_0x6676('0x1a')](_0x6676('0x1b'),_0x2c4ea9+'-'+_0x390cfd+'/'+_0x2d9cc8)[_0x6676('0x1c')](_0x1800a1);}return null;};}function respondWithRpcPromise(_0x31d5d1,_0x300f91,_0x4bbad4,_0xa4bedf){return new Promise(function(_0x2f8da4,_0x9c6895){var _0xfb2ac7=_0xa4bedf||amiClient;return _0xfb2ac7[_0x6676('0x1d')](_0x31d5d1,_0x4bbad4)[_0x6676('0x1e')](function(_0x3be942){logger[_0x6676('0x1f')](_0x6676('0x20'),_0x300f91,_0x6676('0x21'));logger[_0x6676('0x22')](_0x6676('0x23'),_0x300f91,'request\x20sent',JSON[_0x6676('0x24')](_0x3be942));if(_0x3be942['error']){if(_0x3be942[_0x6676('0x25')]['code']===0x1f4){logger['error'](_0x6676('0x20'),_0x300f91,_0x3be942[_0x6676('0x25')][_0x6676('0x26')]);return _0x9c6895(_0x3be942[_0x6676('0x25')][_0x6676('0x26')]);}logger[_0x6676('0x25')](_0x6676('0x20'),_0x300f91,_0x3be942[_0x6676('0x25')]['message']);return _0x2f8da4(_0x3be942[_0x6676('0x25')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x300f91,_0x6676('0x21'));_0x2f8da4(_0x3be942['result']['message']);}})['catch'](function(_0x3fe5e8){logger[_0x6676('0x25')]('User,\x20%s,\x20%s',_0x300f91,_0x3fe5e8);_0x9c6895(_0x3fe5e8);});});}function saveUpdates(_0x16bbae){return function(_0x103e4e){if(_0x103e4e){return _0x103e4e[_0x6676('0x27')](_0x16bbae)[_0x6676('0x1e')](function(_0x2eefe3){if(_0x2eefe3[_0x6676('0x28')]===_0x6676('0x29')){socket[_0x6676('0x2a')]('userNotification:recalc:'+_0x2eefe3['id'],_0x2eefe3);}return _0x2eefe3;});}return null;};}function removeEntity(_0x4bdb80,_0x2beff6){return function(_0x34631d){if(_0x34631d){return _0x34631d[_0x6676('0x2b')]({'transaction':_0x2beff6})['then'](function(){var _0x24819c=_0x34631d[_0x6676('0x2c')]({'plain':!![]});if(_0x24819c[_0x6676('0x28')]==='admin')return;var _0x13064d=[{'name':_0x6676('0x2d'),'value':_0x6676('0x2e'),'ignore':!![]},{'name':_0x6676('0x2f'),'value':_0x6676('0x29'),'ignore':![]},{'name':_0x6676('0x30'),'value':'telephone','ignore':![]}];var _0x19aca9=_(_0x13064d)['filter'](_0x6676('0x31'))['map'](_0x6676('0x32'))[_0x6676('0x32')]();if(_[_0x6676('0x33')](_0x19aca9,_0x24819c[_0x6676('0x28')])){return;}var _0x5270c2=_[_0x6676('0x34')](_0x13064d,[_0x6676('0x32'),_0x24819c['role']])[_0x6676('0x35')];return db[_0x6676('0x36')][_0x6676('0x2b')]({'where':{'type':_0x5270c2,'resourceId':_0x24819c['id']},'transaction':_0x2beff6})[_0x6676('0x1e')](function(){return _0x34631d;});})['then'](function(){_0x4bdb80[_0x6676('0x19')](0xcc)[_0x6676('0x14')]();});}};}function handleEntityNotFound(_0x53ac27){return function(_0x26b5c9){if(!_0x26b5c9){_0x53ac27['sendStatus'](0x194);}return _0x26b5c9;};}function handleError(_0x440833,_0x13f475){_0x13f475=_0x13f475||0x1f4;return function(_0x1cd5f0){logger[_0x6676('0x25')](_0x1cd5f0[_0x6676('0x37')]);if(_0x1cd5f0[_0x6676('0x35')]){delete _0x1cd5f0[_0x6676('0x35')];}_0x440833[_0x6676('0x19')](_0x13f475)[_0x6676('0x38')](_0x1cd5f0);};}function getUserAttributes(){return _(db[_0x6676('0x39')]['rawAttributes'])[_0x6676('0x3a')](function(_0x25b218){return{'name':_0x25b218['fieldName'],'type':_0x25b218[_0x6676('0x3b')][_0x6676('0x3c')]};})[_0x6676('0x3d')](function(_0x195134){return![_0x6676('0x3e'),'salt',_0x6676('0x3f'),_0x6676('0x40'),'resetPasswordExpires','md5secret']['includes'](_0x195134['name']);})['value']();}exports['index']=function(_0x4b2967,_0x5a2b0d){var _0x3d354b={},_0x47456d={'count':0x0,'rows':[]};var _0x21b839=getUserAttributes();_0x3d354b=qs['getOptions'](_0x21b839,_0x4b2967);var _0x580d21={'where':_0x3d354b[_0x6676('0x41')]};return db['User']['count'](_0x580d21)['then'](function(_0x4ebcb4){_0x47456d[_0x6676('0x18')]=_0x4ebcb4;if(_0x4b2967[_0x6676('0x42')][_0x6676('0x43')]){_0x3d354b[_0x6676('0x44')]=[{'all':!![]}];}if(_0x4b2967[_0x6676('0x42')]['userSetting']==='true'){_0x3d354b['include']=[{'model':db[_0x6676('0x45')],'as':'userSetting'}];}if(!_[_0x6676('0x33')](_0x3d354b[_0x6676('0x46')],'id')){_0x3d354b[_0x6676('0x46')][_0x6676('0x47')]('id');}return db['User'][_0x6676('0x48')](_0x3d354b);})[_0x6676('0x1e')](function(_0x9ae400){_0x47456d['rows']=_0x9ae400;if(_0x4b2967['query'][_0x6676('0x49')]===_0x6676('0x4a')){var _0x5e97d8=[];for(var _0x466655=0x0;_0x466655<_0x47456d[_0x6676('0x4b')][_0x6676('0x4c')];_0x466655++){_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x47456d[_0x6676('0x4b')][_0x466655]['dataValues']));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x4e'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x50'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs('openchannel',_0x47456d['rows'][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x52'),_0x47456d['rows'][_0x466655][_0x6676('0x4f')]));}return Promise['all'](_0x5e97d8)[_0x6676('0x1e')](function(){return _0x47456d;});}else{return _0x47456d;}})['then'](respondWithFilteredResult(_0x5a2b0d,_0x3d354b))[_0x6676('0x53')](handleError(_0x5a2b0d,null));};exports[_0x6676('0x54')]=function(_0x13d091,_0x6bb32e){var _0x156cf9=getUserAttributes();_0x13d091[_0x6676('0x42')]['id']=_0x13d091[_0x6676('0x55')]['id'];var _0x4c5b87=qs['getOptions'](_0x156cf9,_0x13d091);if(_0x13d091['query'][_0x6676('0x43')]){_0x4c5b87[_0x6676('0x44')]=[{'all':!![]}];}if(_0x13d091[_0x6676('0x42')][_0x6676('0x56')]===_0x6676('0x4a')){_0x4c5b87['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x4c5b87=_[_0x6676('0x57')]({},_0x4c5b87,_0x13d091[_0x6676('0x58')]);if(!_['includes'](_0x4c5b87[_0x6676('0x46')],'id')){_0x4c5b87[_0x6676('0x46')][_0x6676('0x47')]('id');}return db[_0x6676('0x39')][_0x6676('0x34')](_0x4c5b87)['then'](handleEntityNotFound(_0x6bb32e,null))['then'](function(_0x2be8fc){var _0x2152ad=[];values=_0x2be8fc;if(_0x13d091[_0x6676('0x42')][_0x6676('0x49')]===_0x6676('0x4a')){_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs('sms',_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs('openchannel',_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x52'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad['push'](get_open_tabs(_0x6676('0x50'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x2be8fc['dataValues']));return Promise[_0x6676('0x59')](_0x2152ad);}else{return values;}})[_0x6676('0x1e')](function(){return values;})['then'](respondWithResult(_0x6bb32e,null))[_0x6676('0x53')](handleError(_0x6bb32e,null));};exports['update']=function(_0x4d044f,_0x3dd5b9){if(_0x4d044f[_0x6676('0x5a')]['id']){delete _0x4d044f['body']['id'];}delete _0x4d044f[_0x6676('0x5a')][_0x6676('0x28')];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x4d044f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x3dd5b9,null))[_0x6676('0x1e')](saveUpdates(_0x4d044f[_0x6676('0x5a')],null))['then'](respondWithResult(_0x3dd5b9,null))['catch'](handleError(_0x3dd5b9,null));};exports[_0x6676('0x5b')]=function(_0x1cb17a,_0x58faea){return db[_0x6676('0x39')][_0x6676('0x5b')]()[_0x6676('0x1e')](respondWithResult(_0x58faea,null))[_0x6676('0x53')](handleError(_0x58faea,null));};exports[_0x6676('0x5c')]=function(_0x5c0a55,_0x11af95){return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x5c0a55[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x11af95,null))[_0x6676('0x1e')](function(_0xe7cb45){if(_0xe7cb45){return _0xe7cb45[_0x6676('0x5c')](_0x5c0a55[_0x6676('0x5a')][_0x6676('0x5d')],_[_0x6676('0x5e')](_0x5c0a55[_0x6676('0x5a')],[_0x6676('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x11af95,null))[_0x6676('0x53')](handleError(_0x11af95,null));};function validateUser(_0x150098){return new Promise(function(_0x1d9b8e,_0x209fbd){if(_0x150098[_0x6676('0x5f')])return _0x1d9b8e(_0x150098);return db[_0x6676('0x60')][_0x6676('0x61')](0x1)[_0x6676('0x1e')](function(_0x5f13e5){if(_0x5f13e5[_0x6676('0x62')])authService[_0x6676('0x63')](_0x150098['password']);db[_0x6676('0x39')][_0x6676('0x64')](_0x6676('0x5f'))[_0x6676('0x1e')](function(_0x4fe138){if(_[_0x6676('0x65')](_0x4fe138)){_0x150098['internal']=_0x5f13e5[_0x6676('0x66')]||0x1;return;}if(_[_0x6676('0x65')](_0x5f13e5[_0x6676('0x66')])||_0x5f13e5[_0x6676('0x66')]===_0x4fe138){_0x150098[_0x6676('0x5f')]=_0x4fe138+0x1;return;}if(_0x5f13e5['min_internal']>_0x4fe138){_0x150098[_0x6676('0x5f')]=_0x5f13e5[_0x6676('0x66')];return;}return db[_0x6676('0x67')]['query'](_0x6676('0x68'),{'type':db[_0x6676('0x67')][_0x6676('0x69')][_0x6676('0x6a')]})[_0x6676('0x1e')](function(_0xfffb67){if(_0xfffb67&&_0xfffb67[_0x6676('0x4c')]){for(var _0x4d48ce=0x0,_0xe770d1=_0xfffb67[_0x6676('0x4c')];_0x4d48ce<_0xe770d1&&_[_0x6676('0x65')](_0x150098[_0x6676('0x5f')]);_0x4d48ce++){if(_0x5f13e5[_0x6676('0x66')]<=_0xfffb67[_0x4d48ce][_0x6676('0x6b')]){_0x150098['internal']=_0xfffb67[_0x4d48ce][_0x6676('0x6b')];}else if(_0x5f13e5[_0x6676('0x66')]>_0xfffb67[_0x4d48ce][_0x6676('0x6b')]&&_0x5f13e5[_0x6676('0x66')]<=_0xfffb67[_0x4d48ce]['to']){_0x150098[_0x6676('0x5f')]=_0x5f13e5[_0x6676('0x66')];}}}if(_[_0x6676('0x65')](_0x150098[_0x6676('0x5f')])){_0x150098['internal']=_0x4fe138+0x1;}return _0x1d9b8e(_0x150098);});});})[_0x6676('0x53')](function(_0x34d698){_0x209fbd(_0x34d698);});});}function updateUser(_0x3d3307){return new Promise(function(_0x2cb2ad,_0xa7d5e2){try{if(_0x3d3307[_0x6676('0x6c')]){_0x3d3307[_0x6676('0x6d')]=_0x3d3307[_0x6676('0x5f')];_0x3d3307['VoiceMail']={'mailbox':_0x3d3307[_0x6676('0x5f')],'password':_0x3d3307[_0x6676('0x3e')],'fullname':_0x3d3307[_0x6676('0x6e')],'email':_0x3d3307[_0x6676('0x6f')]};}if(_0x3d3307['role']===_0x6676('0x29')){if(!_0x3d3307[_0x6676('0x70')])_0x3d3307[_0x6676('0x70')]=[_0x6676('0x71'),_0x6676('0x72'),'103',_0x6676('0x73'),_0x6676('0x74'),'104',_0x6676('0x75'),_0x6676('0x76'),_0x6676('0x77'),_0x6676('0x78'),_0x6676('0x79'),_0x6676('0x7a'),_0x6676('0x7b'),_0x6676('0x7c'),_0x6676('0x7d')];}_0x2cb2ad(_0x3d3307);}catch(_0xd1291d){_0xa7d5e2(_0xd1291d);}});}exports['create']=function(_0x1096a8,_0x470ada){if(_0x1096a8[_0x6676('0x2e')]['role']==='agent')throw new Error(_0x6676('0x7e'));if(_0x1096a8[_0x6676('0x5a')][_0x6676('0x28')]===_0x6676('0x2e')&&_0x1096a8['user'][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x7f'));}if(_0x1096a8[_0x6676('0x5a')]['role']===_0x6676('0x80')&&_0x1096a8[_0x6676('0x2e')][_0x6676('0x28')]!==_0x6676('0x80')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x6676('0x81')]([_0x1096a8[_0x6676('0x5a')]])['then'](function(){return validateUser(_0x1096a8[_0x6676('0x5a')]);})[_0x6676('0x1e')](function(_0x3c369e){return updateUser(_0x3c369e)[_0x6676('0x1e')](function(_0x5d72bc){if(_0x5d72bc[_0x6676('0x28')]==='admin'){_0x5d72bc[_0x6676('0x82')]=_0x1096a8[_0x6676('0x2e')][_0x6676('0x82')];delete _0x5d72bc[_0x6676('0x83')];}return _0x5d72bc;});})[_0x6676('0x1e')](function(_0x309079){return db[_0x6676('0x39')][_0x6676('0x84')](_0x309079,{'include':[{'model':db[_0x6676('0x85')],'as':'VoiceMail'}]});})[_0x6676('0x1e')](function(_0x2abd3a){if(_0x1096a8['body']['role']===_0x6676('0x2e'))return _0x2abd3a;if(_0x1096a8[_0x6676('0x2e')][_0x6676('0x28')]!==_0x6676('0x2e'))return _0x2abd3a;return db[_0x6676('0x86')][_0x6676('0x34')]({'where':{'name':_0x2abd3a[_0x6676('0x28')]===_0x6676('0x29')?_0x6676('0x2f'):_0x6676('0x30'),'userProfileId':_0x1096a8[_0x6676('0x2e')]['userProfileId']},'raw':!![]})[_0x6676('0x1e')](function(_0x730ae6){if(!_0x730ae6||_0x730ae6[_0x6676('0x87')]!=0x0)return _0x2abd3a;return db[_0x6676('0x36')][_0x6676('0x84')]({'name':_0x2abd3a[_0x6676('0x35')],'resourceId':_0x2abd3a['id'],'type':_0x730ae6['name'],'sectionId':_0x730ae6['id']},{})['then'](function(){return _0x2abd3a;});})[_0x6676('0x53')](function(_0x4ef988){logger[_0x6676('0x25')](_0x6676('0x88'),_0x4ef988);throw _0x4ef988;});})[_0x6676('0x1e')](respondWithResult(_0x470ada,0xc9))[_0x6676('0x53')](handleError(_0x470ada,null));};exports[_0x6676('0x89')]=function(_0x3a11af,_0x14f619){var _0x54c81c=_0x3a11af[_0x6676('0x5a')];var _0x8bef59=[];if(_0x3a11af['user']['role']===_0x6676('0x29'))throw new Error('Unauthorized');if(_['some'](_0x54c81c,[_0x6676('0x28'),_0x6676('0x2e')])&&_0x3a11af[_0x6676('0x2e')][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x7f'));}if(_[_0x6676('0x8a')](_0x54c81c,[_0x6676('0x28'),'admin'])&&_0x3a11af[_0x6676('0x2e')][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x8b'));}return licenseUtil[_0x6676('0x81')](_0x54c81c)[_0x6676('0x1e')](function(){return validateUser(_0x54c81c[0x0]);})['then'](function(){for(var _0x4920ac=0x1;_0x4920ac<_0x54c81c[_0x6676('0x4c')];_0x4920ac++){var _0x342324=_0x54c81c[_0x4920ac-0x1][_0x6676('0x5f')];if(!_0x54c81c[_0x4920ac][_0x6676('0x5f')])_0x54c81c[_0x4920ac][_0x6676('0x5f')]=_0x342324+0x1;_0x8bef59[_0x6676('0x47')](validateUser(_0x54c81c[_0x4920ac]));}return Promise[_0x6676('0x59')](_0x8bef59);})[_0x6676('0x1e')](function(){_0x8bef59=[];for(var _0x43750b=0x0;_0x43750b<_0x54c81c[_0x6676('0x4c')];_0x43750b++){_0x8bef59[_0x6676('0x47')](updateUser(_0x54c81c[_0x43750b]));}return Promise['all'](_0x8bef59);})[_0x6676('0x1e')](function(){_0x8bef59=_0x54c81c[_0x6676('0x3a')](function(_0x2f97a2){return db['User'][_0x6676('0x84')](_0x2f97a2,{'include':[{'model':db[_0x6676('0x85')],'as':_0x6676('0x85')}]})[_0x6676('0x1e')](function(_0x98bc96){_0x2f97a2['id']=_0x98bc96['id'];return _0x2f97a2;});});return Promise[_0x6676('0x59')](_0x8bef59);})[_0x6676('0x1e')](function(_0x333804){if(_0x3a11af[_0x6676('0x5a')][_0x6676('0x28')]===_0x6676('0x2e'))return _0x333804;if(_0x3a11af[_0x6676('0x2e')]['role']!==_0x6676('0x2e'))return _0x333804;var _0x3d20dc=_[_0x6676('0x8a')](_0x333804,function(_0x198092){return _0x198092['role']===_0x6676('0x29')||_0x198092[_0x6676('0x28')]===_0x6676('0x8c');});if(!_0x3d20dc)return _0x333804;return db[_0x6676('0x86')][_0x6676('0x48')]({'where':{'name':{'$or':[_0x6676('0x2f'),_0x6676('0x30')]},'userProfileId':_0x3a11af[_0x6676('0x2e')][_0x6676('0x83')]},'raw':!![]})[_0x6676('0x1e')](function(_0x44c80f){if(_[_0x6676('0x8d')](_0x44c80f)||!_[_0x6676('0x8a')](_0x44c80f,['autoAssociation',0x0]))return _0x333804;_0x8bef59=[];var _0x5d766e=_(_0x44c80f)[_0x6676('0x3a')](function(_0x26178e){if(_0x26178e['autoAssociation']===0x1)return;return _0x26178e[_0x6676('0x35')]===_0x6676('0x2f')?_0x6676('0x29'):_0x6676('0x8c');})['compact']()['value']();for(var _0x1ec95a=0x0;_0x1ec95a<_0x333804[_0x6676('0x4c')];_0x1ec95a++){if(!_[_0x6676('0x33')](_0x5d766e,_0x333804[_0x1ec95a][_0x6676('0x28')]))return;var _0x1b460d=_0x333804[_0x1ec95a][_0x6676('0x28')]===_0x6676('0x29')?_0x6676('0x2f'):_0x6676('0x30');_0x8bef59[_0x6676('0x47')](db[_0x6676('0x36')][_0x6676('0x84')]({'name':_0x333804[_0x1ec95a][_0x6676('0x35')],'resourceId':_0x333804[_0x1ec95a]['id'],'type':_0x1b460d,'sectionId':_[_0x6676('0x34')](_0x44c80f,[_0x6676('0x35'),_0x1b460d])['id']},{}));}return Promise[_0x6676('0x59')](_0x8bef59);});})['then'](respondWithResult(_0x14f619,0xc9))[_0x6676('0x53')](handleError(_0x14f619,null));};exports[_0x6676('0x8e')]=function(_0x1df3b7,_0x1820de){if(_0x1df3b7['body']['id']){delete _0x1df3b7[_0x6676('0x5a')]['id'];}return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1df3b7[_0x6676('0x55')]['id']}})['then'](function(_0x3d1548){if(!_0x3d1548)return null;if(_0x3d1548['id']===_0x1df3b7[_0x6676('0x2e')]['id']){if(!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x8f')]||!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')]){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3d1548['authenticate'](_0x1df3b7[_0x6676('0x5a')]['oldPassword'])){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x93'));}if(_0x1df3b7[_0x6676('0x5a')]['oldPassword']===_0x1df3b7[_0x6676('0x5a')]['newPassword']){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x94'));}}else if(_0x1df3b7[_0x6676('0x2e')][_0x6676('0x28')]===_0x6676('0x80')){if(!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')]){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))](_0x6676('0x95'));}}else if(_0x1df3b7[_0x6676('0x2e')][_0x6676('0x28')]==='user'){if(!_0x1df3b7[_0x6676('0x5a')]['newPassword']){throw new db[(_0x6676('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3d1548['role']!=='agent'){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x7e'));}}else{throw new db['Sequelize'][(_0x6676('0x92'))](_0x6676('0x7e'));}return _0x3d1548;})[_0x6676('0x1e')](handleEntityNotFound(_0x1820de,null))[_0x6676('0x1e')](function(_0x55c03e){return db[_0x6676('0x60')][_0x6676('0x96')]({'attributes':['id',_0x6676('0x62'),_0x6676('0x97'),_0x6676('0x98')]})[_0x6676('0x1e')](function(_0x3f2dcf){if(_0x3f2dcf[_0x6676('0x62')])authService['validatePasswordPattern'](_0x1df3b7[_0x6676('0x5a')]['newPassword']);if(!_0x3f2dcf[_0x6676('0x97')]||!_0x55c03e[_0x6676('0x3f')])return _0x55c03e;authService[_0x6676('0x99')](_0x1df3b7[_0x6676('0x5a')]['newPassword'],_0x55c03e['previousPasswords'],_0x3f2dcf['passwordHistoryLimit']);return _0x55c03e;})['then'](saveUpdates({'password':_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')],'passwordResetAt':_0x1df3b7[_0x6676('0x2e')]['id']==_0x1df3b7[_0x6676('0x55')]['id']?moment():null,'previousPasswords':authService[_0x6676('0x9a')](_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')],_0x55c03e[_0x6676('0x3f')])},null));})[_0x6676('0x1e')](respondWithResult(_0x1820de,null))[_0x6676('0x53')](handleError(_0x1820de,null));};exports[_0x6676('0x9b')]=function(_0x55da68,_0x32fe0c){var _0x17f157=_0x55da68[_0x6676('0x5a')]['channel'];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x55da68[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),_0x6676('0x28'),_0x6676('0x9c'),_0x6676('0x9d'),_0x6676('0x9e'),_0x6676('0x9f')]})[_0x6676('0x1e')](handleEntityNotFound(_0x32fe0c,null))[_0x6676('0x1e')](function(_0xaaece1){if(_0xaaece1){if(!utils[_0x6676('0xa0')](_0x17f157)){throw new db['Sequelize'][(_0x6676('0x92'))](_0x6676('0xa1'));}return _0xaaece1['add'+_[_0x6676('0xa2')](_0x17f157[_0x6676('0xa3')]())+_0x6676('0xa4')](_0x55da68[_0x6676('0x5a')]['ids'],{'penalty':_0x55da68[_0x6676('0x5a')][_0x6676('0xa5')]||0x0})['spread'](function(_0x2618b1){for(var _0x10979b=0x0;_0x10979b<_0x55da68[_0x6676('0x5a')][_0x6676('0x5d')][_0x6676('0x4c')];_0x10979b+=0x1){var _0x1d9aff={'UserId':Number(_0x55da68['params']['id'])};_0x1d9aff[_[_0x6676('0xa2')](_0x17f157[_0x6676('0xa3')]())+'QueueId']=Number(_0x55da68[_0x6676('0x5a')][_0x6676('0x5d')][_0x10979b]);socket[_0x6676('0x2a')](_0x6676('0x2e')+_['capitalize'](_0x17f157[_0x6676('0xa3')]())+_0x6676('0xa6'),_0x1d9aff);}return _0x2618b1;})[_0x6676('0x1e')](function(){if(_0x17f157===_0x6676('0xa7')){return db[_0x6676('0xa8')][_0x6676('0x48')]({'where':{'id':_0x55da68['body'][_0x6676('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6676('0x1e')](function(_0x51d3a6){var _0x599ecd=_0xaaece1[_0x6676('0x2c')]({'plain':!![]});var _0x5aaaec=[];if(_0x17f157==='voice'&&_0x599ecd[_0x6676('0x28')]===_0x6676('0x29')&&_0x599ecd[_0x6676('0x9c')]){for(let _0x10fc89=0x0;_0x10fc89<_0x51d3a6[_0x6676('0x4c')];_0x10fc89+=0x1){_0x5aaaec['push']({'membername':_0x599ecd[_0x6676('0x35')],'UserId':_0x599ecd['id'],'queue_name':_0x51d3a6[_0x10fc89][_0x6676('0x35')],'VoiceQueueId':_0x51d3a6[_0x10fc89]['id'],'interface':_['isNil'](_0x599ecd[_0x6676('0x9f')])?util[_0x6676('0xa9')]('SIP/%s',_0x599ecd[_0x6676('0x35')]):_0x599ecd[_0x6676('0x9f')],'paused':_0x599ecd[_0x6676('0x9e')]||![],'penalty':_0x55da68[_0x6676('0x5a')]['penalty']||0x0});}return Promise['all'](_0x5aaaec['map'](function(_0x67615d){return db[_0x6676('0xaa')][_0x6676('0xab')](_0x67615d);}));}return _0xaaece1;});}})[_0x6676('0x1e')](respondWithStatusCode(_0x32fe0c,null))['catch'](handleError(_0x32fe0c,null));};exports[_0x6676('0xac')]=function(_0x437fc4,_0x2429da){var _0x286643,_0x2a2663;return db['User']['find']({'where':{'id':_0x437fc4[_0x6676('0x55')]['id']},'attributes':['id','name',_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x2429da,null))['then'](function(_0x584f79){if(_0x584f79){_0x286643=_0x584f79;if(!_0x437fc4[_0x6676('0x42')][_0x6676('0xad')]||!utils[_0x6676('0xa0')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')])){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Unknown\x20channel');}return _0x584f79[_0x6676('0xae')+_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xa4')](_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')]);}})[_0x6676('0x1e')](function(_0x928260){if(_['isArray'](_0x437fc4['query'][_0x6676('0x5d')])){for(var _0xc80eea=0x0;_0xc80eea<_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')][_0x6676('0x4c')];_0xc80eea+=0x1){_0x2a2663={'UserId':Number(_0x437fc4[_0x6676('0x55')]['id'])};_0x2a2663[_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')]['channel'][_0x6676('0xa3')]())+'QueueId']=Number(_0x437fc4['query'][_0x6676('0x5d')][_0xc80eea]);socket[_0x6676('0x2a')](_0x6676('0x2e')+_['capitalize'](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+'Queue:remove',_0x2a2663);}}else{_0x2a2663={'UserId':Number(_0x437fc4['params']['id'])};_0x2a2663[_[_0x6676('0xa2')](_0x437fc4['query'][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xaf')]=Number(_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')]);socket['emit'](_0x6676('0x2e')+_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xb0'),_0x2a2663);}return _0x928260;})[_0x6676('0x1e')](function(){if(_0x437fc4[_0x6676('0x42')][_0x6676('0xad')]===_0x6676('0xa7')){return db['UserVoiceQueueRt'][_0x6676('0x2b')]({'where':{'UserId':_0x437fc4['params']['id'],'VoiceQueueId':_0x437fc4['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x286643;});}return _0x286643;})['then'](respondWithStatusCode(_0x2429da,null))['catch'](handleError(_0x2429da,null));};exports[_0x6676('0xb1')]=function(_0x1e4ab3,_0x308af2){_0x1e4ab3[_0x6676('0x5a')][_0x6676('0xb2')]=_0x1e4ab3[_0x6676('0xb3')][_0x6676('0xb4')];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1e4ab3[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x308af2,null))[_0x6676('0x1e')](saveUpdates(_0x1e4ab3['body'],null))[_0x6676('0x1e')](respondWithResult(_0x308af2,null))[_0x6676('0x53')](handleError(_0x308af2,null));};exports[_0x6676('0xb5')]=function(_0x515db5,_0x491e37){var _0x387839=path[_0x6676('0xb6')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x515db5[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0xb2')],'raw':!![]})[_0x6676('0x1e')](handleEntityNotFound(_0x491e37,null))[_0x6676('0x1e')](function(_0x4785b5){if(_0x4785b5){if(_[_0x6676('0x65')](_0x4785b5[_0x6676('0xb2')])){return _0x491e37[_0x6676('0xb7')](_0x387839);}else{if(!fs['existsSync'](path[_0x6676('0xb6')](config[_0x6676('0xb8')],_0x6676('0xb9'),_0x4785b5[_0x6676('0xb2')]))){return _0x491e37['download'](_0x387839);}return _0x491e37[_0x6676('0xb7')](path[_0x6676('0xb6')](config[_0x6676('0xb8')],_0x6676('0xb9'),_0x4785b5[_0x6676('0xb2')]));}}})[_0x6676('0x53')](handleError(_0x491e37,null));};exports['getOpenTabs']=function(_0x1e6989,_0x3c296f){return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1e6989[_0x6676('0x55')]['id']},'attributes':['id']})[_0x6676('0x1e')](handleEntityNotFound(_0x3c296f,null))['then'](function(_0x10c246){var _0x43fae4=[];values=_0x10c246['dataValues'];_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x10c246[_0x6676('0x4f')]));_0x43fae4['push'](get_open_tabs(_0x6676('0x4e'),_0x10c246[_0x6676('0x4f')]));_0x43fae4[_0x6676('0x47')](get_open_tabs('openchannel',_0x10c246[_0x6676('0x4f')]));_0x43fae4['push'](get_open_tabs('whatsapp',_0x10c246[_0x6676('0x4f')]));_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x50'),_0x10c246['dataValues']));_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x10c246[_0x6676('0x4f')]));return Promise[_0x6676('0x59')](_0x43fae4);})[_0x6676('0x1e')](function(_0x3e0a87){if(_0x3e0a87){var _0x51336b=_[_0x6676('0x3a')](values[_0x6676('0xba')],function(_0x5e60bb){return{'channel':'CHAT','id':_0x5e60bb['id'],'createdAt':_0x5e60bb['createdAt']};});var _0x55b464=_[_0x6676('0x3a')](values[_0x6676('0xbb')],function(_0x29eca3){return{'channel':_0x6676('0xbc'),'id':_0x29eca3['id'],'createdAt':_0x29eca3[_0x6676('0xbd')]};});var _0x33acd2=_[_0x6676('0x3a')](values['OpenchannelOpenTabs'],function(_0x8a279){return{'channel':_0x6676('0xbe'),'id':_0x8a279['id'],'createdAt':_0x8a279['createdAt']};});var _0x3e960d=_[_0x6676('0x3a')](values['MailOpenTabs'],function(_0x25ac4a){return{'channel':_0x6676('0xbf'),'id':_0x25ac4a['id'],'createdAt':_0x25ac4a[_0x6676('0xbd')]};});var _0x4ce9c8=_[_0x6676('0x3a')](values[_0x6676('0xc0')],function(_0x9e0af3){return{'channel':_0x6676('0xc1'),'id':_0x9e0af3['id'],'createdAt':_0x9e0af3[_0x6676('0xbd')]};});var _0x569089=_[_0x6676('0x3a')](values['WhatsappOpenTabs'],function(_0x5c8cd7){return{'channel':'WHATSAPP','id':_0x5c8cd7['id'],'createdAt':_0x5c8cd7[_0x6676('0xbd')]};});var _0x9e5fc7=_[_0x6676('0xc2')](_0x51336b,_0x55b464,_0x33acd2,_0x3e960d,_0x4ce9c8,_0x569089);var _0x2bae4c={'count':_0x9e5fc7[_0x6676('0x4c')],'rows':_0x9e5fc7};return _0x2bae4c;}else return null;})[_0x6676('0x1e')](respondWithResult(_0x3c296f,null))[_0x6676('0x53')](handleError(_0x3c296f,null));};exports[_0x6676('0xc3')]=function(_0xf9ab97,_0x1b2143){var _0x46070b={};return db[_0x6676('0x39')]['findOne']({'where':{'id':_0xf9ab97[_0x6676('0x55')]['id']}})['then'](function(_0x2a299c){if(!_0x2a299c){throw new APINotFoundError(util['format'](_0x6676('0xc4'),_0xf9ab97[_0x6676('0x55')]['id']));}return contacts[_0x6676('0x5b')]();})[_0x6676('0x1e')](function(_0x3394c4){_0xf9ab97[_0x6676('0x42')][_0x6676('0x39')]=_0xf9ab97[_0x6676('0x55')]['id'];_0x46070b=qs['getOptions'](_0x3394c4,_0xf9ab97);if(_0xf9ab97[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0x43'))){_0x46070b[_0x6676('0x44')]=[{'model':db[_0x6676('0xc6')],'as':_0x6676('0xc7'),'required':![]},{'model':db[_0x6676('0xc8')],'as':_0x6676('0xc9'),'attributes':['id',_0x6676('0x35'),_0x6676('0xca')],'where':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]?{'id':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]}:undefined,'required':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]?!![]:![]}];}return contacts[_0x6676('0x48')](_0xf9ab97[_0x6676('0x42')],_0xf9ab97[_0x6676('0x2e')],_0x46070b,_0x3394c4);})[_0x6676('0x1e')](respondWithFilteredResult(_0x1b2143,_0x46070b))['catch'](APIHandleError(_0x1b2143));};exports[_0x6676('0xcc')]=function(_0x3e0677,_0x27132c){var _0x4a3430;var _0x55e262={};var _0x42bea8;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x3e0677[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x27132c,null))['then'](function(_0x1da7f3){if(!utils['isValidChannel'](_0x3e0677[_0x6676('0x42')][_0x6676('0xad')])){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Unknown\x20channel');}_0x4a3430=_0x1da7f3;var _0x42c0c7={};_0x42c0c7[_0x6676('0xcd')]=_['keys'](db[_[_0x6676('0xa2')](_0x3e0677['query']['channel'])+'Queue'][_0x6676('0xce')]);_0x42c0c7[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x3e0677[_0x6676('0x42')]);_0x42c0c7['filters']=_[_0x6676('0xd0')](_0x42c0c7[_0x6676('0xcd')],_0x42c0c7[_0x6676('0x42')]);_0x55e262['attributes']=_[_0x6676('0xd0')](_0x42c0c7[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x3e0677[_0x6676('0x42')][_0x6676('0xd1')]));_0x55e262['attributes']=_0x55e262[_0x6676('0x46')]['length']?_0x55e262['attributes']:_0x42c0c7[_0x6676('0xcd')];_0x55e262['order']=qs[_0x6676('0xd2')](_0x3e0677[_0x6676('0x42')]['sort']);_0x55e262[_0x6676('0x41')]=qs['filters'](_[_0x6676('0xd3')](_0x3e0677['query'],_0x42c0c7[_0x6676('0xd4')]));if(_0x3e0677[_0x6676('0x42')][_0x6676('0x3d')]){_0x55e262[_0x6676('0x41')]=_[_0x6676('0x57')](_0x55e262['where'],{'$or':_['map'](_0x55e262[_0x6676('0x46')],function(_0x2e0b2a){var _0x3d5cca={};_0x3d5cca[_0x2e0b2a]={'$like':'%'+_0x3e0677[_0x6676('0x42')]['filter']+'%'};return _0x3d5cca;})});}_0x55e262=_['merge']({},_0x55e262,_0x3e0677[_0x6676('0x58')]);switch(_0x4a3430['role']){case'admin':return db[_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')]['channel'])+_0x6676('0xd5')][_0x6676('0x48')](_0x55e262);case _0x6676('0x2e'):case _0x6676('0x29'):return _0x4a3430[_0x6676('0x2c')+_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')]['channel'])+'Queues'](_0x55e262);default:throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0xd6'));}})['then'](function(_0x55cdb7){_0x42bea8=_0x55cdb7[_0x6676('0x4c')];if(!_0x3e0677[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x55e262[_0x6676('0x17')]=qs['limit'](_0x3e0677['query'][_0x6676('0x17')]);_0x55e262['offset']=qs['offset'](_0x3e0677['query']['offset']);}switch(_0x4a3430[_0x6676('0x28')]){case _0x6676('0x80'):return db[_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')][_0x6676('0xad')])+'Queue'][_0x6676('0x48')](_0x55e262);case _0x6676('0x2e'):case'agent':return _0x4a3430[_0x6676('0x2c')+_[_0x6676('0xa2')](_0x3e0677['query'][_0x6676('0xad')])+_0x6676('0xa4')](_0x55e262);}})['then'](function(_0x26b20f){return{'count':_0x42bea8,'rows':_0x26b20f};})['then'](respondWithResult(_0x27132c,null))[_0x6676('0x53')](handleError(_0x27132c,null));};exports[_0x6676('0xd8')]=function(_0xffefdc,_0x1e74da){var _0x2b7c28={};var _0x1c2019={};var _0x4b6a78;var _0x371f63;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0xffefdc[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e74da,null))[_0x6676('0x1e')](function(_0x4ef33e){if(_0x4ef33e){_0x4b6a78=_0x4ef33e;_0x1c2019[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xaa')][_0x6676('0xce')]);_0x1c2019[_0x6676('0x42')]=_['keys'](_0xffefdc[_0x6676('0x42')]);_0x1c2019[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x1c2019[_0x6676('0xcd')],_0x1c2019[_0x6676('0x42')]);_0x2b7c28['attributes']=_[_0x6676('0xd0')](_0x1c2019[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0xffefdc[_0x6676('0x42')][_0x6676('0xd1')]));_0x2b7c28[_0x6676('0x46')]=_0x2b7c28[_0x6676('0x46')][_0x6676('0x4c')]?_0x2b7c28[_0x6676('0x46')]:_0x1c2019[_0x6676('0xcd')];_0x2b7c28['order']=qs['sort'](_0xffefdc['query'][_0x6676('0xd2')]);_0x2b7c28['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0xffefdc[_0x6676('0x42')],_0x1c2019[_0x6676('0xd4')]));if(_0xffefdc[_0x6676('0x42')]['filter']){_0x2b7c28[_0x6676('0x41')]=_[_0x6676('0x57')](_0x2b7c28[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x2b7c28[_0x6676('0x46')],function(_0x3c5c32){var _0x1b5d6b={};_0x1b5d6b[_0x3c5c32]={'$like':'%'+_0xffefdc[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x1b5d6b;})});}_0x2b7c28=_[_0x6676('0x57')]({},_0x2b7c28,_0xffefdc[_0x6676('0x58')]);return _0x4b6a78[_0x6676('0xd8')](_0x2b7c28);}})[_0x6676('0x1e')](function(_0x3e2109){if(_0x3e2109){_0x371f63=_0x3e2109[_0x6676('0x4c')];if(!_0xffefdc[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x2b7c28[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xffefdc[_0x6676('0x42')]['limit']);_0x2b7c28[_0x6676('0x15')]=qs['offset'](_0xffefdc[_0x6676('0x42')][_0x6676('0x15')]);}return _0x4b6a78['getVoiceQueuesRt'](_0x2b7c28);}})['then'](function(_0x47c364){if(_0x47c364){return _0x47c364?{'count':_0x371f63,'rows':_0x47c364}:null;}})['then'](respondWithResult(_0x1e74da,null))[_0x6676('0x53')](handleError(_0x1e74da,null));};exports[_0x6676('0xd9')]=function(_0x2d0e4f,_0x3cd0e2){var _0x358e2c={};var _0x2679ef={};var _0x5c401b;var _0x177fc3;return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x2d0e4f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x3cd0e2,null))['then'](function(_0x1cd6bf){if(_0x1cd6bf){_0x5c401b=_0x1cd6bf;_0x2679ef[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xda')][_0x6676('0xce')]);_0x2679ef[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x2d0e4f[_0x6676('0x42')]);_0x2679ef['filters']=_[_0x6676('0xd0')](_0x2679ef[_0x6676('0xcd')],_0x2679ef[_0x6676('0x42')]);_0x358e2c[_0x6676('0x46')]=_['intersection'](_0x2679ef[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x2d0e4f[_0x6676('0x42')]['fields']));_0x358e2c[_0x6676('0x46')]=_0x358e2c[_0x6676('0x46')][_0x6676('0x4c')]?_0x358e2c[_0x6676('0x46')]:_0x2679ef[_0x6676('0xcd')];_0x358e2c[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x2d0e4f[_0x6676('0x42')]['sort']);_0x358e2c[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x2d0e4f['query'],_0x2679ef['filters']));if(_0x2d0e4f[_0x6676('0x42')][_0x6676('0x3d')]){_0x358e2c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x358e2c[_0x6676('0x41')],{'$or':_['map'](_0x358e2c['attributes'],function(_0x39d3fe){var _0x1f3fc7={};_0x1f3fc7[_0x39d3fe]={'$like':'%'+_0x2d0e4f[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x1f3fc7;})});}_0x358e2c=_[_0x6676('0x57')]({},_0x358e2c,_0x2d0e4f['options']);return _0x5c401b[_0x6676('0xd9')](_0x358e2c);}})[_0x6676('0x1e')](function(_0x15ec77){if(_0x15ec77){_0x177fc3=_0x15ec77['length'];if(!_0x2d0e4f[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x358e2c[_0x6676('0x17')]=qs['limit'](_0x2d0e4f[_0x6676('0x42')][_0x6676('0x17')]);_0x358e2c[_0x6676('0x15')]=qs['offset'](_0x2d0e4f[_0x6676('0x42')]['offset']);}return _0x5c401b[_0x6676('0xd9')](_0x358e2c);}})[_0x6676('0x1e')](function(_0xeca8a2){if(_0xeca8a2){return _0xeca8a2?{'count':_0x177fc3,'rows':_0xeca8a2}:null;}})[_0x6676('0x1e')](respondWithResult(_0x3cd0e2,null))[_0x6676('0x53')](handleError(_0x3cd0e2,null));};exports[_0x6676('0xdc')]=function(_0x12c0c9,_0xcfc5b2){var _0xb6cf85={'raw':!![],'where':{}};var _0x5cca27={};var _0x33c0e0={'count':0x0,'rows':[]};return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x12c0c9[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0xcfc5b2,null))[_0x6676('0x1e')](function(_0x14f57f){if(_0x14f57f){_0x5cca27[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xdd')]['rawAttributes']);_0x5cca27[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x12c0c9[_0x6676('0x42')]);_0x5cca27[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x5cca27[_0x6676('0xcd')],_0x5cca27[_0x6676('0x42')]);_0xb6cf85[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x5cca27['model'],qs[_0x6676('0xd1')](_0x12c0c9[_0x6676('0x42')][_0x6676('0xd1')]));_0xb6cf85[_0x6676('0x46')]=_0xb6cf85[_0x6676('0x46')][_0x6676('0x4c')]?_0xb6cf85[_0x6676('0x46')]:_0x5cca27['model'];if(!_0x12c0c9[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0xb6cf85[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x12c0c9[_0x6676('0x42')]['limit']);_0xb6cf85[_0x6676('0x15')]=qs['offset'](_0x12c0c9[_0x6676('0x42')][_0x6676('0x15')]);}_0xb6cf85['order']=qs[_0x6676('0xd2')](_0x12c0c9[_0x6676('0x42')][_0x6676('0xd2')]);_0xb6cf85[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x12c0c9['query'],_0x5cca27[_0x6676('0xd4')]));_0xb6cf85[_0x6676('0x41')][_0x6676('0xde')]=_0x14f57f['id'];if(_0x12c0c9['query'][_0x6676('0x3d')]){_0xb6cf85[_0x6676('0x41')]=_[_0x6676('0x57')](_0xb6cf85['where'],{'$or':_[_0x6676('0x3a')](_0xb6cf85[_0x6676('0x46')],function(_0x26cd40){var _0x40db3b={};_0x40db3b[_0x26cd40]={'$like':'%'+_0x12c0c9[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x40db3b;})});}_0xb6cf85=_[_0x6676('0x57')]({},_0xb6cf85,_0x12c0c9[_0x6676('0x58')]);return db[_0x6676('0xdd')][_0x6676('0x18')]({'where':_0xb6cf85[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x54b0ad){_0x33c0e0[_0x6676('0x18')]=_0x54b0ad;if(_0x12c0c9[_0x6676('0x42')][_0x6676('0x43')]){_0xb6cf85[_0x6676('0x44')]=[{'all':!![]}];}return db[_0x6676('0xdd')]['findAll'](_0xb6cf85);})[_0x6676('0x1e')](function(_0x4f3d27){_0x33c0e0[_0x6676('0x4b')]=_0x4f3d27;return _0x33c0e0;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0xcfc5b2,_0xb6cf85))[_0x6676('0x53')](handleError(_0xcfc5b2,null));};exports[_0x6676('0xdf')]=function(_0xff17d2,_0x25f8bf){var _0x22d190={'raw':!![],'where':{}};var _0x48ffa8={};var _0x181943={'count':0x0,'rows':[]};return db[_0x6676('0x39')]['findOne']({'where':{'id':_0xff17d2[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x25f8bf,null))[_0x6676('0x1e')](function(_0x49039c){if(_0x49039c){_0x48ffa8[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe0')]['rawAttributes']);_0x48ffa8[_0x6676('0x42')]=_['keys'](_0xff17d2[_0x6676('0x42')]);_0x48ffa8[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x48ffa8[_0x6676('0xcd')],_0x48ffa8['query']);_0x22d190[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x48ffa8['model'],qs[_0x6676('0xd1')](_0xff17d2[_0x6676('0x42')][_0x6676('0xd1')]));_0x22d190['attributes']=_0x22d190[_0x6676('0x46')][_0x6676('0x4c')]?_0x22d190[_0x6676('0x46')]:_0x48ffa8[_0x6676('0xcd')];if(!_0xff17d2[_0x6676('0x42')][_0x6676('0xc5')]('nolimit')){_0x22d190[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xff17d2['query'][_0x6676('0x17')]);_0x22d190[_0x6676('0x15')]=qs[_0x6676('0x15')](_0xff17d2[_0x6676('0x42')][_0x6676('0x15')]);}_0x22d190['order']=qs[_0x6676('0xd2')](_0xff17d2['query']['sort']);_0x22d190[_0x6676('0x41')]=qs[_0x6676('0xd4')](_['pick'](_0xff17d2['query'],_0x48ffa8[_0x6676('0xd4')]));_0x22d190[_0x6676('0x41')][_0x6676('0xde')]=_0x49039c['id'];if(_0xff17d2[_0x6676('0x42')][_0x6676('0x3d')]){_0x22d190['where']=_[_0x6676('0x57')](_0x22d190[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x22d190[_0x6676('0x46')],function(_0x1db138){var _0x47dd47={};_0x47dd47[_0x1db138]={'$like':'%'+_0xff17d2[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x47dd47;})});}_0x22d190=_[_0x6676('0x57')]({},_0x22d190,_0xff17d2[_0x6676('0x58')]);return db[_0x6676('0xe0')][_0x6676('0x18')]({'where':_0x22d190[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x4fadd8){_0x181943['count']=_0x4fadd8;if(_0xff17d2[_0x6676('0x42')]['includeAll']){_0x22d190[_0x6676('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6676('0x48')](_0x22d190);})[_0x6676('0x1e')](function(_0x483393){_0x181943[_0x6676('0x4b')]=_0x483393;return _0x181943;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0x25f8bf,_0x22d190))['catch'](handleError(_0x25f8bf,null));};exports['getChatInteractions']=function(_0x5bea3f,_0x5a0bee){var _0x5bad2c={};var _0x289b13={};var _0x488fa4;var _0x313ef0;return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x5bea3f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x5a0bee,null))['then'](function(_0x795903){if(_0x795903){_0x488fa4=_0x795903;_0x289b13[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xe1')][_0x6676('0xce')]);_0x289b13[_0x6676('0x42')]=_['keys'](_0x5bea3f['query']);_0x289b13['filters']=_['intersection'](_0x289b13['model'],_0x289b13[_0x6676('0x42')]);_0x5bad2c[_0x6676('0x46')]=_['intersection'](_0x289b13[_0x6676('0xcd')],qs['fields'](_0x5bea3f[_0x6676('0x42')][_0x6676('0xd1')]));_0x5bad2c['attributes']=_0x5bad2c[_0x6676('0x46')]['length']?_0x5bad2c[_0x6676('0x46')]:_0x289b13[_0x6676('0xcd')];_0x5bad2c[_0x6676('0xdb')]=qs['sort'](_0x5bea3f[_0x6676('0x42')][_0x6676('0xd2')]);_0x5bad2c[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x5bea3f[_0x6676('0x42')],_0x289b13[_0x6676('0xd4')]));if(_0x5bea3f['query']['filter']){_0x5bad2c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x5bad2c[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x5bad2c[_0x6676('0x46')],function(_0xb8af3a){var _0x2b48de={};_0x2b48de[_0xb8af3a]={'$like':'%'+_0x5bea3f['query'][_0x6676('0x3d')]+'%'};return _0x2b48de;})});}_0x5bad2c=_['merge']({},_0x5bad2c,_0x5bea3f[_0x6676('0x58')]);return _0x488fa4[_0x6676('0xe2')](_0x5bad2c);}})[_0x6676('0x1e')](function(_0x2fa88e){if(_0x2fa88e){_0x313ef0=_0x2fa88e[_0x6676('0x4c')];if(!_0x5bea3f['query']['hasOwnProperty'](_0x6676('0xd7'))){_0x5bad2c[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x5bea3f[_0x6676('0x42')][_0x6676('0x17')]);_0x5bad2c[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x5bea3f[_0x6676('0x42')][_0x6676('0x15')]);}return _0x488fa4['getChatInteractions'](_0x5bad2c);}})['then'](function(_0x4d1d5){if(_0x4d1d5){return _0x4d1d5?{'count':_0x313ef0,'rows':_0x4d1d5}:null;}})[_0x6676('0x1e')](respondWithResult(_0x5a0bee,null))['catch'](handleError(_0x5a0bee,null));};exports['getOpenchannelInteractions']=function(_0x2a6d16,_0x264e80){var _0x4661af={};var _0x2105f4={};var _0x4c091e;var _0x43ee5a;return db['User'][_0x6676('0x96')]({'where':{'id':_0x2a6d16[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x264e80,null))[_0x6676('0x1e')](function(_0x5b443c){if(_0x5b443c){_0x4c091e=_0x5b443c;_0x2105f4[_0x6676('0xcd')]=_[_0x6676('0xcf')](db['OpenchannelInteraction'][_0x6676('0xce')]);_0x2105f4[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x2a6d16[_0x6676('0x42')]);_0x2105f4['filters']=_[_0x6676('0xd0')](_0x2105f4[_0x6676('0xcd')],_0x2105f4[_0x6676('0x42')]);_0x4661af[_0x6676('0x46')]=_['intersection'](_0x2105f4[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x2a6d16[_0x6676('0x42')][_0x6676('0xd1')]));_0x4661af[_0x6676('0x46')]=_0x4661af[_0x6676('0x46')][_0x6676('0x4c')]?_0x4661af[_0x6676('0x46')]:_0x2105f4[_0x6676('0xcd')];_0x4661af[_0x6676('0xdb')]=qs['sort'](_0x2a6d16[_0x6676('0x42')][_0x6676('0xd2')]);_0x4661af['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x2a6d16[_0x6676('0x42')],_0x2105f4[_0x6676('0xd4')]));if(_0x2a6d16[_0x6676('0x42')][_0x6676('0x3d')]){_0x4661af[_0x6676('0x41')]=_[_0x6676('0x57')](_0x4661af['where'],{'$or':_[_0x6676('0x3a')](_0x4661af['attributes'],function(_0x19243c){var _0x26c11f={};_0x26c11f[_0x19243c]={'$like':'%'+_0x2a6d16[_0x6676('0x42')]['filter']+'%'};return _0x26c11f;})});}_0x4661af=_['merge']({},_0x4661af,_0x2a6d16[_0x6676('0x58')]);return _0x4c091e[_0x6676('0xe3')](_0x4661af);}})[_0x6676('0x1e')](function(_0x5abc6c){if(_0x5abc6c){_0x43ee5a=_0x5abc6c[_0x6676('0x4c')];if(!_0x2a6d16[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x4661af[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x2a6d16[_0x6676('0x42')][_0x6676('0x17')]);_0x4661af[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x2a6d16[_0x6676('0x42')][_0x6676('0x15')]);}return _0x4c091e[_0x6676('0xe3')](_0x4661af);}})[_0x6676('0x1e')](function(_0x5828b4){if(_0x5828b4){return _0x5828b4?{'count':_0x43ee5a,'rows':_0x5828b4}:null;}})[_0x6676('0x1e')](respondWithResult(_0x264e80,null))[_0x6676('0x53')](handleError(_0x264e80,null));};exports[_0x6676('0xe4')]=function(_0x15a1db,_0x335b2d){var _0xce6d98={'raw':!![],'where':{}};var _0x4c3afa={};var _0x507f1e={'count':0x0,'rows':[]};return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x15a1db[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x335b2d,null))['then'](function(_0x31552f){if(_0x31552f){_0x4c3afa[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe5')][_0x6676('0xce')]);_0x4c3afa['query']=_[_0x6676('0xcf')](_0x15a1db[_0x6676('0x42')]);_0x4c3afa[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x4c3afa['model'],_0x4c3afa[_0x6676('0x42')]);_0xce6d98[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x4c3afa[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x15a1db[_0x6676('0x42')][_0x6676('0xd1')]));_0xce6d98[_0x6676('0x46')]=_0xce6d98[_0x6676('0x46')]['length']?_0xce6d98[_0x6676('0x46')]:_0x4c3afa['model'];if(!_0x15a1db[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0xce6d98[_0x6676('0x17')]=qs['limit'](_0x15a1db[_0x6676('0x42')][_0x6676('0x17')]);_0xce6d98[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x15a1db['query'][_0x6676('0x15')]);}_0xce6d98['order']=qs[_0x6676('0xd2')](_0x15a1db['query'][_0x6676('0xd2')]);_0xce6d98[_0x6676('0x41')]=qs['filters'](_['pick'](_0x15a1db['query'],_0x4c3afa[_0x6676('0xd4')]));_0xce6d98[_0x6676('0x41')][_0x6676('0xde')]=_0x31552f['id'];if(_0x15a1db[_0x6676('0x42')]['filter']){_0xce6d98[_0x6676('0x41')]=_[_0x6676('0x57')](_0xce6d98[_0x6676('0x41')],{'$or':_['map'](_0xce6d98[_0x6676('0x46')],function(_0x3b3eca){var _0x2ec653={};_0x2ec653[_0x3b3eca]={'$like':'%'+_0x15a1db[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x2ec653;})});}_0xce6d98=_[_0x6676('0x57')]({},_0xce6d98,_0x15a1db[_0x6676('0x58')]);return db[_0x6676('0xe5')][_0x6676('0x18')]({'where':_0xce6d98[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x3cc57c){_0x507f1e[_0x6676('0x18')]=_0x3cc57c;if(_0x15a1db['query'][_0x6676('0x43')]){_0xce6d98[_0x6676('0x44')]=[{'all':!![]}];}return db[_0x6676('0xe5')][_0x6676('0x48')](_0xce6d98);})[_0x6676('0x1e')](function(_0x25884d){_0x507f1e[_0x6676('0x4b')]=_0x25884d;return _0x507f1e;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0x335b2d,_0xce6d98))['catch'](handleError(_0x335b2d,null));};exports['getSmsInteractions']=function(_0xb3d9ca,_0x293905){var _0x24afec={};var _0x5d160d={};var _0x4e3f85;var _0x5a8ea8;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0xb3d9ca[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x293905,null))[_0x6676('0x1e')](function(_0x2bc627){if(_0x2bc627){_0x4e3f85=_0x2bc627;_0x5d160d['model']=_['keys'](db[_0x6676('0xe6')][_0x6676('0xce')]);_0x5d160d[_0x6676('0x42')]=_[_0x6676('0xcf')](_0xb3d9ca[_0x6676('0x42')]);_0x5d160d[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x5d160d[_0x6676('0xcd')],_0x5d160d[_0x6676('0x42')]);_0x24afec[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x5d160d[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0xb3d9ca[_0x6676('0x42')][_0x6676('0xd1')]));_0x24afec[_0x6676('0x46')]=_0x24afec[_0x6676('0x46')][_0x6676('0x4c')]?_0x24afec['attributes']:_0x5d160d[_0x6676('0xcd')];_0x24afec['order']=qs[_0x6676('0xd2')](_0xb3d9ca[_0x6676('0x42')]['sort']);_0x24afec[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0xb3d9ca[_0x6676('0x42')],_0x5d160d[_0x6676('0xd4')]));if(_0xb3d9ca['query'][_0x6676('0x3d')]){_0x24afec[_0x6676('0x41')]=_['merge'](_0x24afec['where'],{'$or':_[_0x6676('0x3a')](_0x24afec[_0x6676('0x46')],function(_0x29a833){var _0x964d30={};_0x964d30[_0x29a833]={'$like':'%'+_0xb3d9ca[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x964d30;})});}_0x24afec=_[_0x6676('0x57')]({},_0x24afec,_0xb3d9ca[_0x6676('0x58')]);return _0x4e3f85[_0x6676('0xe7')](_0x24afec);}})[_0x6676('0x1e')](function(_0x13e376){if(_0x13e376){_0x5a8ea8=_0x13e376['length'];if(!_0xb3d9ca[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x24afec[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xb3d9ca[_0x6676('0x42')][_0x6676('0x17')]);_0x24afec[_0x6676('0x15')]=qs[_0x6676('0x15')](_0xb3d9ca[_0x6676('0x42')]['offset']);}return _0x4e3f85[_0x6676('0xe7')](_0x24afec);}})[_0x6676('0x1e')](function(_0x49fc4d){if(_0x49fc4d){return _0x49fc4d?{'count':_0x5a8ea8,'rows':_0x49fc4d}:null;}})['then'](respondWithResult(_0x293905,null))[_0x6676('0x53')](handleError(_0x293905,null));};exports[_0x6676('0xe8')]=function(_0x498641,_0x554db4){var _0x82f78d={};var _0x1ec6e2={};var _0x133096;var _0x50b309;return db['User'][_0x6676('0x96')]({'where':{'id':_0x498641[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x554db4,null))[_0x6676('0x1e')](function(_0x54d6c1){if(_0x54d6c1){_0x133096=_0x54d6c1;_0x1ec6e2[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe9')][_0x6676('0xce')]);_0x1ec6e2['query']=_['keys'](_0x498641[_0x6676('0x42')]);_0x1ec6e2[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x1ec6e2[_0x6676('0xcd')],_0x1ec6e2[_0x6676('0x42')]);_0x82f78d[_0x6676('0x46')]=_['intersection'](_0x1ec6e2['model'],qs[_0x6676('0xd1')](_0x498641[_0x6676('0x42')]['fields']));_0x82f78d['attributes']=_0x82f78d[_0x6676('0x46')][_0x6676('0x4c')]?_0x82f78d[_0x6676('0x46')]:_0x1ec6e2[_0x6676('0xcd')];_0x82f78d['order']=qs['sort'](_0x498641[_0x6676('0x42')][_0x6676('0xd2')]);_0x82f78d[_0x6676('0x41')]=qs['filters'](_['pick'](_0x498641[_0x6676('0x42')],_0x1ec6e2[_0x6676('0xd4')]));if(_0x498641[_0x6676('0x42')][_0x6676('0x3d')]){_0x82f78d[_0x6676('0x41')]=_[_0x6676('0x57')](_0x82f78d[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x82f78d[_0x6676('0x46')],function(_0x1cbb13){var _0x5b4f7d={};_0x5b4f7d[_0x1cbb13]={'$like':'%'+_0x498641['query'][_0x6676('0x3d')]+'%'};return _0x5b4f7d;})});}_0x82f78d=_[_0x6676('0x57')]({},_0x82f78d,_0x498641[_0x6676('0x58')]);return _0x133096[_0x6676('0xe8')](_0x82f78d);}})['then'](function(_0x497a5d){if(_0x497a5d){_0x50b309=_0x497a5d[_0x6676('0x4c')];if(!_0x498641[_0x6676('0x42')][_0x6676('0xc5')]('nolimit')){_0x82f78d[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x498641['query']['limit']);_0x82f78d[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x498641['query'][_0x6676('0x15')]);}return _0x133096[_0x6676('0xe8')](_0x82f78d);}})[_0x6676('0x1e')](function(_0x59fe41){if(_0x59fe41){return _0x59fe41?{'count':_0x50b309,'rows':_0x59fe41}:null;}})[_0x6676('0x1e')](respondWithResult(_0x554db4,null))[_0x6676('0x53')](handleError(_0x554db4,null));};exports['getWhatsappInteractions']=function(_0x19004c,_0x5acdf6){var _0x44930e={};var _0x3f8b5f={};var _0x1dd964;var _0x4d2a01;return db['User'][_0x6676('0x96')]({'where':{'id':_0x19004c['params']['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x5acdf6,null))[_0x6676('0x1e')](function(_0x37573c){if(_0x37573c){_0x1dd964=_0x37573c;_0x3f8b5f[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xea')][_0x6676('0xce')]);_0x3f8b5f[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x19004c[_0x6676('0x42')]);_0x3f8b5f['filters']=_['intersection'](_0x3f8b5f[_0x6676('0xcd')],_0x3f8b5f[_0x6676('0x42')]);_0x44930e[_0x6676('0x46')]=_['intersection'](_0x3f8b5f[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x19004c[_0x6676('0x42')]['fields']));_0x44930e[_0x6676('0x46')]=_0x44930e[_0x6676('0x46')][_0x6676('0x4c')]?_0x44930e['attributes']:_0x3f8b5f[_0x6676('0xcd')];_0x44930e[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x19004c[_0x6676('0x42')][_0x6676('0xd2')]);_0x44930e[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x19004c[_0x6676('0x42')],_0x3f8b5f[_0x6676('0xd4')]));if(_0x19004c[_0x6676('0x42')][_0x6676('0x3d')]){_0x44930e['where']=_[_0x6676('0x57')](_0x44930e['where'],{'$or':_[_0x6676('0x3a')](_0x44930e[_0x6676('0x46')],function(_0x1c8213){var _0x40df63={};_0x40df63[_0x1c8213]={'$like':'%'+_0x19004c[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x40df63;})});}_0x44930e=_['merge']({},_0x44930e,_0x19004c[_0x6676('0x58')]);return _0x1dd964[_0x6676('0xeb')](_0x44930e);}})['then'](function(_0x5e771d){if(_0x5e771d){_0x4d2a01=_0x5e771d[_0x6676('0x4c')];if(!_0x19004c[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x44930e['limit']=qs[_0x6676('0x17')](_0x19004c['query'][_0x6676('0x17')]);_0x44930e[_0x6676('0x15')]=qs['offset'](_0x19004c['query']['offset']);}return _0x1dd964[_0x6676('0xeb')](_0x44930e);}})['then'](function(_0x158229){if(_0x158229){return _0x158229?{'count':_0x4d2a01,'rows':_0x158229}:null;}})[_0x6676('0x1e')](respondWithResult(_0x5acdf6,null))[_0x6676('0x53')](handleError(_0x5acdf6,null));};exports['login']=function(_0x4aa483,_0x275d63,_0x1faa49){var _0xbd7543;var _0x3c9c9f;var _0x33c300;var _0x133345=!_[_0x6676('0x65')](_0x4aa483[_0x6676('0x55')]['id'])?_0x4aa483['params']['id']:!_[_0x6676('0x65')](_0x4aa483[_0x6676('0x2e')]['id'])?_0x4aa483[_0x6676('0x2e')]['id']:null;return db['User'][_0x6676('0x34')]({'where':{'id':_0x133345,'role':{'$or':[_0x6676('0x80'),_0x6676('0x2e'),'agent']}},'attributes':['id',_0x6676('0x35'),_0x6676('0xec'),_0x6676('0xed'),'role',_0x6676('0x5f'),_0x6676('0x9d')]})[_0x6676('0x1e')](function(_0x5ed805){if(_0x5ed805){if(_0x5ed805[_0x6676('0x28')]===_0x6676('0x29')){_0xbd7543=_0x5ed805;if(_0x4aa483['body']['interface']){_0x33c300=util[_0x6676('0xa9')]('LOCAL/%s@from-sip/n',_0xbd7543[_0x4aa483[_0x6676('0x5a')][_0x6676('0x9f')]]);}else if(_0x4aa483[_0x6676('0x5a')][_0x6676('0xee')]){_0x33c300=util[_0x6676('0xa9')](_0x6676('0xef'),_0x4aa483[_0x6676('0x5a')][_0x6676('0xee')]);}else{_0x33c300=util[_0x6676('0xa9')](_0x6676('0xef'),_0xbd7543[_0x6676('0x35')]);}socket['to'](util[_0x6676('0xa9')](_0x6676('0xf0'),_0xbd7543[_0x6676('0x35')]))['emit']('user:forcelogout',{'user':{'id':_0xbd7543['id'],'name':_0xbd7543[_0x6676('0x35')]},'ip':_0x4aa483[_0x6676('0xf1')][_0x6676('0xf2')]||_0x4aa483[_0x6676('0xf3')][_0x6676('0xf4')]||_0x4aa483['socket'][_0x6676('0xf4')]||_0x4aa483['connection'][_0x6676('0xf5')][_0x6676('0xf4')]});return new Promise(function(_0x4654af,_0x55eb18){db[_0x6676('0x67')]['transaction']()[_0x6676('0x1e')](_0x964a60=>{db[_0x6676('0xaa')][_0x6676('0x2b')]({'where':{'membername':_0xbd7543[_0x6676('0x35')]},'individualHooks':!![]},{'transaction':_0x964a60})[_0x6676('0x1e')](function(){return _0x964a60[_0x6676('0xf6')]();})[_0x6676('0x1e')](_0x4654af)['catch'](_0x55eb18);});});}}else{throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))](_0x6676('0xf7'));}})[_0x6676('0x1e')](function(){if(_0xbd7543){return _0xbd7543['getVoiceQueues']({'raw':!![]});}})[_0x6676('0x1e')](function(_0x1d456b){if(_0xbd7543){if(_0x1d456b){_0x3c9c9f=_0x1d456b;if(_0x3c9c9f[_0x6676('0x4c')]){var _0x263f86=_0x3c9c9f['map'](function(_0x1eceb0){return{'membername':_0xbd7543[_0x6676('0x35')],'UserId':_0xbd7543['id'],'queue_name':_0x1eceb0[_0x6676('0x35')],'VoiceQueueId':_0x1eceb0['id'],'interface':_0x33c300,'paused':_0xbd7543[_0x6676('0x9d')]||![],'penalty':_0x1eceb0['UserVoiceQueue.penalty']||0x0};});return db[_0x6676('0xaa')][_0x6676('0x89')](_0x263f86);}}}})[_0x6676('0x1e')](function(){if(_0xbd7543){return db[_0x6676('0xf8')][_0x6676('0x48')]({'where':{'membername':_0xbd7543['name'],'exitAt':null}});}})[_0x6676('0x1e')](function(_0xca2a36){if(_0xbd7543){var _0x565d47=[];_0xca2a36[_0x6676('0xf9')](function(_0x180c24){_0x565d47[_0x6676('0x47')](_0x180c24[_0x6676('0x27')]({'exitAt':moment()[_0x6676('0xa9')](_0x6676('0xfa'))}));});return Promise[_0x6676('0x59')](_0x565d47);}})[_0x6676('0x1e')](function(){if(_0xbd7543){var _0x138971=[];var _0x5af6b9=[];var _0x71a374=utils[_0x6676('0xfb')]();var _0x4d9def={'membername':_0xbd7543[_0x6676('0x35')],'interface':_0x33c300,'enterAt':moment()[_0x6676('0xa9')](_0x6676('0xfa')),'role':_0xbd7543['role'],'internal':_0xbd7543['internal']};_0x71a374[_0x6676('0xf9')](function(_0x151915){_0x138971[_0x6676('0x47')](_[_0x6676('0x57')]({'channel':_0x151915,'type':_0x6676('0xfc'),'data1':_0x4aa483[_0x6676('0x5a')][_0x6676('0xfd')],'data2':_0x33c300},_0x4d9def));if(_0xbd7543['loginInPause']){_0x5af6b9[_0x6676('0x47')](_[_0x6676('0x57')]({'channel':_0x151915,'type':_0x6676('0xfe'),'data1':_0x6676('0xff')},_0x4d9def));}});return db[_0x6676('0xf8')]['bulkCreate'](_0x138971[_0x6676('0xc2')](_0x5af6b9),{'individualHooks':!![]});}})[_0x6676('0x1e')](function(){if(_0xbd7543){return _0xbd7543['update']({'online':!![],'lastLoginAt':moment()['format'](_0x6676('0xfa')),'voicePause':_0xbd7543['loginInPause']||![],'mailPause':_0xbd7543[_0x6676('0x9d')]||![],'chatPause':_0xbd7543[_0x6676('0x9d')]||![],'faxPause':_0xbd7543[_0x6676('0x9d')]||![],'smsPause':_0xbd7543[_0x6676('0x9d')]||![],'openchannelPause':_0xbd7543[_0x6676('0x9d')]||![],'whatsappPause':_0xbd7543[_0x6676('0x9d')]||![],'pauseType':_0xbd7543[_0x6676('0x9d')]?'LOGININPAUSE':null,'interface':_0x33c300,'lastPauseAt':moment()[_0x6676('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6676('0x1e')](function(_0x1e9696){if(_0x4aa483[_0x6676('0x100')]){return _0x1faa49();}else{return Promise['resolve'](_0x1e9696)[_0x6676('0x1e')](respondWithResult(_0x275d63,null));}})[_0x6676('0x53')](handleError(_0x275d63,null));};exports[_0x6676('0x101')]=function(_0x3a3279,_0x52d1a0){var _0x4e135e;return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x3a3279['params']['id'],'role':_0x6676('0x29')},'attributes':['id',_0x6676('0x35'),_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x52d1a0,null))[_0x6676('0x1e')](function(_0x54eb37){if(_0x54eb37){_0x4e135e=_0x54eb37;return db[_0x6676('0xaa')][_0x6676('0x2b')]({'where':{'membername':_0x4e135e[_0x6676('0x35')]},'individualHooks':!![]});}})[_0x6676('0x1e')](function(){return db[_0x6676('0xf8')][_0x6676('0x48')]({'where':{'membername':_0x4e135e[_0x6676('0x35')],'exitAt':null}});})[_0x6676('0x1e')](function(_0x16a7b7){var _0x799168=[];_0x16a7b7[_0x6676('0xf9')](function(_0x1a203c){_0x799168[_0x6676('0x47')](_0x1a203c[_0x6676('0x27')]({'exitAt':moment()['format'](_0x6676('0xfa'))}));});return Promise[_0x6676('0x59')](_0x799168);})[_0x6676('0x1e')](function(){return _0x4e135e[_0x6676('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6676('0x1e')](respondWithResult(_0x52d1a0,null))[_0x6676('0x53')](handleError(_0x52d1a0,null));};exports[_0x6676('0x102')]=function(_0x5c47c4,_0x50e5f0){var _0x3fa6f3;return db[_0x6676('0xaa')]['update']({'paused':0x1},{'where':{'UserId':_0x5c47c4['params']['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x6676('0x34')]({'where':{'id':_0x5c47c4[_0x6676('0x55')]['id'],'role':_0x6676('0x29')},'attributes':['id','name','role',_0x6676('0x5f'),_0x6676('0x9f'),'online']});})[_0x6676('0x1e')](handleEntityNotFound(_0x50e5f0,null))[_0x6676('0x1e')](function(_0xf151d2){if(_0xf151d2){_0x3fa6f3=_0xf151d2;return respondWithRpcPromise(_0x6676('0x103'),'pause',{'id':_0x3fa6f3['id'],'name':_0x3fa6f3[_0x6676('0x35')],'pause':!![]});}})[_0x6676('0x1e')](function(){if(_0x3fa6f3){return db['MemberReport'][_0x6676('0x48')]({'where':{'membername':_0x3fa6f3[_0x6676('0x35')],'type':_0x6676('0xfe'),'exitAt':null}});}})[_0x6676('0x1e')](function(_0x29649d){if(_0x29649d[_0x6676('0x4c')]){var _0x2cc2ef=moment()[_0x6676('0xa9')](_0x6676('0xfa'));for(var _0x443792=0x0,_0x341b3a=_0x29649d['length'];_0x443792<_0x341b3a;_0x443792++){_0x29649d[_0x443792]['updateAttributes']({'exitAt':_0x2cc2ef});}}})[_0x6676('0x1e')](function(){var _0x1ba811=[];var _0xf271d3=utils['getChannels']();_0xf271d3[_0x6676('0xf9')](function(_0x258ca7){_0x1ba811[_0x6676('0x47')]({'channel':_0x258ca7,'membername':_0x3fa6f3[_0x6676('0x35')],'interface':_['isNil'](_0x3fa6f3['interface'])?util['format'](_0x6676('0xef'),_0x3fa6f3['name']):_0x3fa6f3[_0x6676('0x9f')],'type':'PAUSE','enterAt':moment()[_0x6676('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5c47c4[_0x6676('0x5a')][_0x6676('0x3b')]||'DEFAULT\x20PAUSE','role':_0x3fa6f3[_0x6676('0x28')],'internal':_0x3fa6f3['internal']});});return db['MemberReport'][_0x6676('0x89')](_0x1ba811,{'individualHooks':!![]});})[_0x6676('0x1e')](function(){return _0x3fa6f3[_0x6676('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5c47c4[_0x6676('0x5a')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6676('0xa9')](_0x6676('0xfa'))});})[_0x6676('0x1e')](respondWithResult(_0x50e5f0,null))[_0x6676('0x53')](handleError(_0x50e5f0,null));};exports[_0x6676('0x104')]=function(_0x203c0a,_0x113aaa){if(_0x203c0a[_0x6676('0x5a')]['channel']&&!utils[_0x6676('0xa0')](_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')])){throw new APIBadRequestError(util[_0x6676('0xa9')](_0x6676('0x105'),_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')]));}return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x203c0a[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),'role',_0x6676('0x5f'),_0x6676('0x9f'),'online',_0x6676('0x9e'),'mailPause',_0x6676('0x106'),_0x6676('0x107'),_0x6676('0x108'),_0x6676('0x109'),_0x6676('0x10a'),_0x6676('0x10b'),_0x6676('0x10c')]})['then'](function(_0x188418){if(!_0x188418){throw new APINotFoundError(util[_0x6676('0xa9')](_0x6676('0xc4'),_0x203c0a[_0x6676('0x55')]['id']));}return _0x188418['unpause'](_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')]);})[_0x6676('0x1e')](respondWithResult(_0x113aaa,null))[_0x6676('0x53')](APIHandleError(_0x113aaa));};exports['getTeams']=function(_0x20358e,_0x2e8c7f){var _0x1c909c={};var _0x2f1991={};var _0x27188a;var _0x657417;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x20358e[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x2e8c7f,null))[_0x6676('0x1e')](function(_0x5ddff2){if(_0x5ddff2){_0x27188a=_0x5ddff2;_0x2f1991[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0x10d')][_0x6676('0xce')]);_0x2f1991[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x20358e['query']);_0x2f1991['filters']=_[_0x6676('0xd0')](_0x2f1991[_0x6676('0xcd')],_0x2f1991[_0x6676('0x42')]);_0x1c909c[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x2f1991[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x20358e['query'][_0x6676('0xd1')]));_0x1c909c[_0x6676('0x46')]=_0x1c909c[_0x6676('0x46')][_0x6676('0x4c')]?_0x1c909c['attributes']:_0x2f1991['model'];_0x1c909c[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x20358e['query'][_0x6676('0xd2')]);_0x1c909c[_0x6676('0x41')]=qs['filters'](_['pick'](_0x20358e[_0x6676('0x42')],_0x2f1991[_0x6676('0xd4')]));if(_0x20358e['query'][_0x6676('0x3d')]){_0x1c909c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x1c909c[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x1c909c[_0x6676('0x46')],function(_0x29c0d5){var _0x534837={};_0x534837[_0x29c0d5]={'$like':'%'+_0x20358e[_0x6676('0x42')]['filter']+'%'};return _0x534837;})});}_0x1c909c=_[_0x6676('0x57')]({},_0x1c909c,_0x20358e[_0x6676('0x58')]);return _0x27188a[_0x6676('0x10e')](_0x1c909c);}})[_0x6676('0x1e')](function(_0x27d678){if(_0x27d678){_0x657417=_0x27d678[_0x6676('0x4c')];if(!_0x20358e[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x1c909c[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x20358e[_0x6676('0x42')][_0x6676('0x17')]);_0x1c909c[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x20358e[_0x6676('0x42')]['offset']);}return _0x27188a[_0x6676('0x10e')](_0x1c909c);}})['then'](function(_0x232544){if(_0x232544){return _0x232544?{'count':_0x657417,'rows':_0x232544}:null;}})['then'](respondWithResult(_0x2e8c7f,null))[_0x6676('0x53')](handleError(_0x2e8c7f,null));};exports['addTeams']=function(_0x1e2dfb,_0x50c6b0){var _0x5bf18c=_0x1e2dfb[_0x6676('0x55')]['id'];var _0x3b16cf=_0x1e2dfb['body']?_0x1e2dfb[_0x6676('0x5a')][_0x6676('0x5d')]:null;var _0x475ade=[];return Promise[_0x6676('0x10f')]()['then'](function(){if(!_0x3b16cf)throw new APIBadRequestError(_0x6676('0x110'));})[_0x6676('0x1e')](function(){return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x5bf18c}});})[_0x6676('0x1e')](function(_0x4ecf9d){if(!_0x4ecf9d)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1e2dfb[_0x6676('0x55')]['id']));return db[_0x6676('0x67')][_0x6676('0x111')](function(_0x296bda){return _0x4ecf9d['addTeams'](_0x3b16cf,{'transaction':_0x296bda})[_0x6676('0x1e')](function(){return db[_0x6676('0x10d')][_0x6676('0x48')]({'where':{'id':{'$in':_0x3b16cf}}});})[_0x6676('0x1e')](function(_0x536986){var _0x4076b2=_[_0x6676('0x3a')](_0x536986,function(_0x475ac1){return _0x475ac1[_0x6676('0x112')]();});return Promise[_0x6676('0x59')](_0x4076b2);})[_0x6676('0x1e')](function(_0x39f44b){_0x475ade=_[_0x6676('0x113')](_0x39f44b);var _0x3b39ec=_[_0x6676('0x3a')](_0x475ade,function(_0x5398a0){return _0x5398a0[_0x6676('0x114')](_0x4ecf9d['id'],{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x3b39ec);})[_0x6676('0x1e')](function(){if(!_0x4ecf9d[_0x6676('0x9c')])return;var _0x3bef14=_[_0x6676('0x3d')](_0x475ade,function(_0x33936b){return _0x33936b[_0x6676('0x115')](_0x6676('0xad'))===_0x6676('0x116');});var _0x24abdb=_[_0x6676('0x3a')](_0x3bef14,function(_0x2219c1){return db[_0x6676('0xaa')]['upsert']({'membername':_0x4ecf9d['name'],'UserId':_0x4ecf9d['id'],'queue_name':_0x2219c1['name'],'VoiceQueueId':_0x2219c1['id'],'interface':_['isNil'](_0x4ecf9d[_0x6676('0x9f')])?util[_0x6676('0xa9')](_0x6676('0xef'),_0x4ecf9d[_0x6676('0x35')]):_0x4ecf9d[_0x6676('0x9f')],'paused':_0x4ecf9d[_0x6676('0x9e')]||![],'penalty':_0x4ecf9d['penalty']},{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x24abdb);})[_0x6676('0x1e')](function(){return db[_0x6676('0x117')][_0x6676('0x48')]({'where':{'teamId':{'$in':_0x3b16cf}}});})['then'](function(_0x2be096){var _0x282622=_['map'](_0x2be096,function(_0x375ae3){return db[_0x6676('0x118')][_0x6676('0x84')]({'UserId':_0x4ecf9d['id'],'VoicePrefixId':_0x375ae3[_0x6676('0x119')]},{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x282622);});});})[_0x6676('0x1e')](function(){for(var _0x3279c5=0x0;_0x3279c5<_0x475ade[_0x6676('0x4c')];_0x3279c5++){var _0x1717c6=_0x475ade[_0x3279c5]['getDataValue']('channel');var _0x3bf587=_0x1717c6+_0x6676('0xaf');socket[_0x6676('0x2a')](_0x6676('0x2e')+_0x1717c6+_0x6676('0xa6'),{'UserId':_0x5bf18c,['queueField']:_0x475ade[_0x3279c5]['id']});}})[_0x6676('0x1e')](respondWithStatusCode(_0x50c6b0,null))[_0x6676('0x53')](APIHandleError(_0x50c6b0));};exports[_0x6676('0x11a')]=function(_0x807b3f,_0x38e20b){var _0x2de36f=_0x807b3f[_0x6676('0x55')]['id'];var _0x229f59=null;if(_0x807b3f['query'][_0x6676('0x5d')]){_0x229f59=_[_0x6676('0x11b')](_0x807b3f['query'][_0x6676('0x5d')])?_0x807b3f['query'][_0x6676('0x5d')]:[_0x807b3f['query'][_0x6676('0x5d')]];}var _0x2c28e5=[];return Promise[_0x6676('0x10f')]()['then'](function(){if(!_0x229f59)throw new APIBadRequestError(_0x6676('0x11c'));})[_0x6676('0x1e')](function(){return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x2de36f}});})[_0x6676('0x1e')](function(_0x65b138){if(!_0x65b138)throw new APINotFoundError(util[_0x6676('0xa9')](_0x6676('0xc4'),_0x807b3f['params']['id']));return db[_0x6676('0x67')][_0x6676('0x111')](function(_0x281a12){return _0x65b138['removeTeams'](_0x229f59,{'transaction':_0x281a12})[_0x6676('0x1e')](function(){return db[_0x6676('0x10d')][_0x6676('0x48')]({'where':{'id':{'$in':_0x229f59}}});})[_0x6676('0x1e')](function(_0x3342b6){var _0x118b74=_['map'](_0x3342b6,function(_0x352662){return _0x352662['getAssociatedQueues']();});return Promise[_0x6676('0x59')](_0x118b74);})[_0x6676('0x1e')](function(_0x1297a3){_0x2c28e5=_[_0x6676('0x113')](_0x1297a3);var _0x4fc30b=_[_0x6676('0x3a')](_0x2c28e5,function(_0x237040){return _0x237040[_0x6676('0x11d')](_0x65b138['id'],{'transaction':_0x281a12});});return Promise['all'](_0x4fc30b);})['then'](function(){if(!_0x65b138['online'])return;var _0x79eebb=_[_0x6676('0x3d')](_0x2c28e5,function(_0x34c22f){return _0x34c22f[_0x6676('0x115')](_0x6676('0xad'))===_0x6676('0x116');});var _0x342a8c=_['map'](_0x79eebb,function(_0x13cdcf){return db[_0x6676('0xaa')]['destroy']({'where':{'VoiceQueueId':_0x13cdcf['id'],'UserId':_0x65b138['id']},'transaction':_0x281a12});});return Promise[_0x6676('0x59')](_0x342a8c);})[_0x6676('0x1e')](function(){return db['TeamVoicePrefix'][_0x6676('0x48')]({'where':{'teamId':{'$in':_0x229f59}}});})['then'](function(_0x4640ff){var _0x48b862=_[_0x6676('0x3a')](_0x4640ff,function(_0x3a8857){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x65b138['id'],'VoicePrefixId':_0x3a8857[_0x6676('0x119')]}},{'transaction':_0x281a12});});return Promise['all'](_0x48b862);});});})[_0x6676('0x1e')](function(){for(var _0x50abf3=0x0;_0x50abf3<_0x2c28e5[_0x6676('0x4c')];_0x50abf3++){var _0x197555=_0x2c28e5[_0x50abf3][_0x6676('0x115')](_0x6676('0xad'));var _0x31a6a9=_0x197555+_0x6676('0xaf');socket[_0x6676('0x2a')](_0x6676('0x2e')+_0x197555+_0x6676('0xb0'),{'UserId':_0x2de36f,['queueField']:_0x2c28e5[_0x50abf3]['id']});}})['then'](respondWithStatusCode(_0x38e20b,null))[_0x6676('0x53')](APIHandleError(_0x38e20b));};exports['getLists']=function(_0x58dceb,_0x1b1877){var _0x421af9={};var _0x7d454b={};var _0x11e876;var _0x482c4d;return db['User'][_0x6676('0x96')]({'where':{'id':_0x58dceb[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x1b1877,null))['then'](function(_0x5a5d06){if(_0x5a5d06){_0x11e876=_0x5a5d06;_0x7d454b[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xc6')]['rawAttributes']);_0x7d454b[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x58dceb[_0x6676('0x42')]);_0x7d454b['filters']=_[_0x6676('0xd0')](_0x7d454b[_0x6676('0xcd')],_0x7d454b[_0x6676('0x42')]);_0x421af9[_0x6676('0x46')]=_['intersection'](_0x7d454b[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x58dceb[_0x6676('0x42')]['fields']));_0x421af9['attributes']=_0x421af9['attributes']['length']?_0x421af9['attributes']:_0x7d454b[_0x6676('0xcd')];_0x421af9[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x58dceb[_0x6676('0x42')][_0x6676('0xd2')]);_0x421af9['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x58dceb[_0x6676('0x42')],_0x7d454b[_0x6676('0xd4')]));if(_0x58dceb[_0x6676('0x42')][_0x6676('0x3d')]){_0x421af9[_0x6676('0x41')]=_[_0x6676('0x57')](_0x421af9[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x421af9[_0x6676('0x46')],function(_0x1efbcf){var _0x46db32={};_0x46db32[_0x1efbcf]={'$like':'%'+_0x58dceb[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x46db32;})});}_0x421af9=_['merge']({},_0x421af9,_0x58dceb[_0x6676('0x58')]);return _0x11e876[_0x6676('0x11e')](_0x421af9);}})['then'](function(_0x2e78b9){if(_0x2e78b9){_0x482c4d=_0x2e78b9[_0x6676('0x4c')];if(!_0x58dceb[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x421af9['limit']=qs[_0x6676('0x17')](_0x58dceb[_0x6676('0x42')]['limit']);_0x421af9[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x58dceb[_0x6676('0x42')]['offset']);}return _0x11e876['getLists'](_0x421af9);}})[_0x6676('0x1e')](function(_0x4c8d3b){if(_0x4c8d3b){return _0x4c8d3b?{'count':_0x482c4d,'rows':_0x4c8d3b}:null;}})[_0x6676('0x1e')](respondWithResult(_0x1b1877,null))[_0x6676('0x53')](handleError(_0x1b1877,null));};exports[_0x6676('0x11f')]=function(_0x28d5cc,_0x278122){var _0x42b014={};var _0x3048a3={};var _0x3c3a46;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x28d5cc[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x278122,null))[_0x6676('0x1e')](function(_0x35b9a5){if(_0x35b9a5){_0x3c3a46=_0x35b9a5;_0x3048a3['model']=_[_0x6676('0xcf')](db['User'][_0x6676('0xce')]);_0x3048a3[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x28d5cc['query']);_0x3048a3[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x3048a3[_0x6676('0xcd')],_0x3048a3[_0x6676('0x42')]);_0x42b014['attributes']=_['intersection'](_0x3048a3[_0x6676('0xcd')],qs['fields'](_0x28d5cc[_0x6676('0x42')]['fields']));_0x42b014['attributes']=_0x42b014[_0x6676('0x46')]['length']?_0x42b014[_0x6676('0x46')]:_0x3048a3['model'];_0x42b014[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x28d5cc[_0x6676('0x42')][_0x6676('0xd2')]);_0x42b014['where']=qs['filters'](_['pick'](_0x28d5cc[_0x6676('0x42')],_0x3048a3[_0x6676('0xd4')]));if(_0x28d5cc[_0x6676('0x42')][_0x6676('0x3d')]){_0x42b014[_0x6676('0x41')]=_[_0x6676('0x57')](_0x42b014[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x42b014['attributes'],function(_0x461750){var _0x512581={};_0x512581[_0x461750]={'$like':'%'+_0x28d5cc[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x512581;})});}_0x42b014[_0x6676('0xcd')]=db[_0x6676('0x39')];_0x42b014['as']=_0x6676('0x2f');_0x42b014=_[_0x6676('0x57')]({},_0x42b014,_0x28d5cc[_0x6676('0x58')]);return _0x3c3a46['getVoiceQueues']({'include':[_0x42b014]});}})[_0x6676('0x1e')](function(_0xe5e477){if(_0xe5e477){var _0x19b5d7={},_0x471eb0=[];for(var _0x2c8c74=0x0;_0x2c8c74<_0xe5e477['length'];_0x2c8c74+=0x1){for(var _0x3641e9=0x0,_0x40fd45;_0x3641e9<_0xe5e477[_0x2c8c74][_0x6676('0x2f')][_0x6676('0x4c')];_0x3641e9+=0x1){_0x40fd45=_0xe5e477[_0x2c8c74][_0x6676('0x2f')][_0x3641e9][_0x6676('0x2c')]({'plain':!![]});_0x19b5d7[_0x40fd45['id']]=_0x40fd45;}}_0x19b5d7=_[_0x6676('0x120')](_0x19b5d7);for(var _0x3dca9f=qs[_0x6676('0x15')](_0x28d5cc['query'][_0x6676('0x15')]);_0x3dca9f<_0x19b5d7[_0x6676('0x4c')]&&_0x471eb0[_0x6676('0x4c')]=_0x50f81a){_0x29b90f=_0x50f81a;_0x1aa97f=0xc8;}else{_0x1aa97f=0xce;}_0x5260a0[_0xde5c('0x1c')](_0x1aa97f);return _0x5260a0['set'](_0xde5c('0x22'),_0x1f9e87+'-'+_0x29b90f+'/'+_0x50f81a)[_0xde5c('0x23')](_0x26ff24);}return null;};}function respondWithRpcPromise(_0x2e1c64,_0x4ae687,_0x569de4,_0x6e9b7f){return new Promise(function(_0x348d6a,_0x4c245b){var _0x287c87=_0x6e9b7f||amiClient;return _0x287c87[_0xde5c('0x24')](_0x2e1c64,_0x569de4)[_0xde5c('0x25')](function(_0x43b10b){logger[_0xde5c('0x26')](_0xde5c('0x27'),_0x4ae687,'request\x20sent');logger[_0xde5c('0x28')](_0xde5c('0x29'),_0x4ae687,_0xde5c('0x2a'),JSON[_0xde5c('0x2b')](_0x43b10b));if(_0x43b10b['error']){if(_0x43b10b[_0xde5c('0x2c')][_0xde5c('0x2d')]===0x1f4){logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x43b10b[_0xde5c('0x2c')][_0xde5c('0x2e')]);return _0x4c245b(_0x43b10b['error'][_0xde5c('0x2e')]);}logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x43b10b['error']['message']);return _0x348d6a(_0x43b10b['error']['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x4ae687,_0xde5c('0x2a'));_0x348d6a(_0x43b10b[_0xde5c('0x2f')][_0xde5c('0x2e')]);}})[_0xde5c('0x30')](function(_0x1b4cf6){logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x1b4cf6);_0x4c245b(_0x1b4cf6);});});}function saveUpdates(_0x166d17){return function(_0xe5d317){if(_0xe5d317){return _0xe5d317[_0xde5c('0x31')](_0x166d17)[_0xde5c('0x25')](function(_0x4acde1){if(_0x4acde1[_0xde5c('0x32')]===_0xde5c('0x33')){socket[_0xde5c('0x34')](_0xde5c('0x35')+_0x4acde1['id'],_0x4acde1);}return _0x4acde1;});}return null;};}function removeEntity(_0x4b7224,_0x916fe9){return function(_0x40f0c6){if(_0x40f0c6){return _0x40f0c6[_0xde5c('0x36')]({'transaction':_0x916fe9})[_0xde5c('0x25')](function(){var _0x17377a=_0x40f0c6[_0xde5c('0x37')]({'plain':!![]});if(_0x17377a['role']===_0xde5c('0x38'))return;var _0x120ed1=[{'name':'Users','value':_0xde5c('0x39'),'ignore':!![]},{'name':_0xde5c('0x3a'),'value':_0xde5c('0x33'),'ignore':![]},{'name':_0xde5c('0x3b'),'value':_0xde5c('0x3c'),'ignore':![]}];var _0x3d5cc4=_(_0x120ed1)['filter'](_0xde5c('0x3d'))['map'](_0xde5c('0x3e'))[_0xde5c('0x3e')]();if(_[_0xde5c('0x3f')](_0x3d5cc4,_0x17377a[_0xde5c('0x32')])){return;}var _0x226e58=_[_0xde5c('0x40')](_0x120ed1,[_0xde5c('0x3e'),_0x17377a[_0xde5c('0x32')]])[_0xde5c('0x41')];return db['UserProfileResource'][_0xde5c('0x36')]({'where':{'type':_0x226e58,'resourceId':_0x17377a['id']},'transaction':_0x916fe9})['then'](function(){return _0x40f0c6;});})['then'](function(){_0x4b7224['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac156){return function(_0x3fc7eb){if(!_0x3fc7eb){_0x2ac156['sendStatus'](0x194);}return _0x3fc7eb;};}function handleError(_0x247fa9,_0x3a84db){_0x3a84db=_0x3a84db||0x1f4;return function(_0x4d46fc){logger[_0xde5c('0x2c')](_0x4d46fc['stack']);if(_0x4d46fc['name']){delete _0x4d46fc[_0xde5c('0x41')];}_0x247fa9[_0xde5c('0x1c')](_0x3a84db)[_0xde5c('0x42')](_0x4d46fc);};}function getUserAttributes(){return _(db[_0xde5c('0x43')][_0xde5c('0x44')])['map'](function(_0x6eaf12){return{'name':_0x6eaf12[_0xde5c('0x45')],'type':_0x6eaf12['type']['key']};})[_0xde5c('0x46')](function(_0x15fcfe){return![_0xde5c('0x47'),'salt',_0xde5c('0x48'),'resetPasswordToken',_0xde5c('0x49'),_0xde5c('0x4a')]['includes'](_0x15fcfe['name']);})['value']();}exports[_0xde5c('0x4b')]=function(_0x19c513,_0x15a297){var _0x5680fe={},_0x469c43={'count':0x0,'rows':[]};var _0x426804=getUserAttributes();_0x5680fe=qs[_0xde5c('0x4c')](_0x426804,_0x19c513);var _0x20c65d={'where':_0x5680fe['where']};return db['User'][_0xde5c('0x21')](_0x20c65d)[_0xde5c('0x25')](function(_0x46c11b){_0x469c43[_0xde5c('0x21')]=_0x46c11b;if(_0x19c513['query']['includeAll']){_0x5680fe[_0xde5c('0x4d')]=[{'all':!![]}];}if(_0x19c513[_0xde5c('0x4e')][_0xde5c('0x4f')]===_0xde5c('0x50')){_0x5680fe[_0xde5c('0x4d')]=[{'model':db[_0xde5c('0x51')],'as':'userSetting'}];}if(!_['includes'](_0x5680fe[_0xde5c('0x52')],'id')){_0x5680fe[_0xde5c('0x52')][_0xde5c('0x53')]('id');}return db[_0xde5c('0x43')][_0xde5c('0x54')](_0x5680fe);})[_0xde5c('0x25')](function(_0x3191ae){_0x469c43[_0xde5c('0x55')]=_0x3191ae;if(_0x19c513[_0xde5c('0x4e')][_0xde5c('0x56')]===_0xde5c('0x50')){var _0x387722=[];for(var _0x5ae98b=0x0;_0x5ae98b<_0x469c43[_0xde5c('0x55')][_0xde5c('0x57')];_0x5ae98b++){_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5a'),_0x469c43['rows'][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5b'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5d'),_0x469c43['rows'][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x469c43[_0xde5c('0x55')][_0x5ae98b]['dataValues']));}return Promise[_0xde5c('0x5f')](_0x387722)[_0xde5c('0x25')](function(){return _0x469c43;});}else{return _0x469c43;}})['then'](respondWithFilteredResult(_0x15a297,_0x5680fe))[_0xde5c('0x30')](handleError(_0x15a297,null));};exports[_0xde5c('0x60')]=function(_0x4677ee,_0x3c7c05){var _0x545252=getUserAttributes();_0x4677ee[_0xde5c('0x4e')]['id']=_0x4677ee[_0xde5c('0x61')]['id'];var _0x7fbcd=qs[_0xde5c('0x4c')](_0x545252,_0x4677ee);if(_0x4677ee['query'][_0xde5c('0x62')]){_0x7fbcd[_0xde5c('0x4d')]=[{'all':!![]}];}if(_0x4677ee[_0xde5c('0x4e')][_0xde5c('0x4f')]===_0xde5c('0x50')){_0x7fbcd['include']=[{'model':db['UserSetting'],'as':_0xde5c('0x4f')}];}_0x7fbcd=_[_0xde5c('0x63')]({},_0x7fbcd,_0x4677ee[_0xde5c('0x64')]);if(!_[_0xde5c('0x3f')](_0x7fbcd[_0xde5c('0x52')],'id')){_0x7fbcd['attributes'][_0xde5c('0x53')]('id');}return db[_0xde5c('0x43')]['find'](_0x7fbcd)[_0xde5c('0x25')](handleEntityNotFound(_0x3c7c05,null))[_0xde5c('0x25')](function(_0x5019c8){var _0x2018b4=[];values=_0x5019c8;if(_0x4677ee[_0xde5c('0x4e')]['openTabs']===_0xde5c('0x50')){_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4['push'](get_open_tabs('sms',_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5d'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5b'),_0x5019c8['dataValues']));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x5019c8['dataValues']));return Promise['all'](_0x2018b4);}else{return values;}})['then'](function(){return values;})[_0xde5c('0x25')](respondWithResult(_0x3c7c05,null))[_0xde5c('0x30')](handleError(_0x3c7c05,null));};exports['update']=function(_0x21e0db,_0x949aa0){if(_0x21e0db['body']['id']){delete _0x21e0db[_0xde5c('0x65')]['id'];}delete _0x21e0db[_0xde5c('0x65')]['role'];return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x21e0db[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x949aa0,null))[_0xde5c('0x25')](saveUpdates(_0x21e0db[_0xde5c('0x65')],null))[_0xde5c('0x25')](respondWithResult(_0x949aa0,null))[_0xde5c('0x30')](handleError(_0x949aa0,null));};exports[_0xde5c('0x66')]=function(_0x348313,_0x3960d8){return db['User'][_0xde5c('0x66')]()[_0xde5c('0x25')](respondWithResult(_0x3960d8,null))[_0xde5c('0x30')](handleError(_0x3960d8,null));};exports[_0xde5c('0x67')]=function(_0x42bb50,_0x1afccd){return db[_0xde5c('0x43')]['find']({'where':{'id':_0x42bb50[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x1afccd,null))[_0xde5c('0x25')](function(_0xf3ad11){if(_0xf3ad11){return _0xf3ad11[_0xde5c('0x67')](_0x42bb50[_0xde5c('0x65')][_0xde5c('0x68')],_[_0xde5c('0x69')](_0x42bb50['body'],[_0xde5c('0x68'),'id'])||{});}})[_0xde5c('0x25')](respondWithResult(_0x1afccd,null))[_0xde5c('0x30')](handleError(_0x1afccd,null));};function validateUser(_0x3cdc24){return new Promise(function(_0x4e8bcf,_0x2c0eba){if(_0x3cdc24[_0xde5c('0x6a')])return _0x4e8bcf(_0x3cdc24);return db[_0xde5c('0x6b')]['findById'](0x1)[_0xde5c('0x25')](function(_0x46d3c3){if(_0x46d3c3[_0xde5c('0x6c')])authService[_0xde5c('0x6d')](_0x3cdc24[_0xde5c('0x47')]);db[_0xde5c('0x43')][_0xde5c('0x6e')]('internal')[_0xde5c('0x25')](function(_0x515439){if(_[_0xde5c('0x6f')](_0x515439)){_0x3cdc24[_0xde5c('0x6a')]=_0x46d3c3[_0xde5c('0x70')]||0x1;return;}if(_[_0xde5c('0x6f')](_0x46d3c3['min_internal'])||_0x46d3c3[_0xde5c('0x70')]===_0x515439){_0x3cdc24[_0xde5c('0x6a')]=_0x515439+0x1;return;}if(_0x46d3c3[_0xde5c('0x70')]>_0x515439){_0x3cdc24['internal']=_0x46d3c3[_0xde5c('0x70')];return;}return db[_0xde5c('0x71')][_0xde5c('0x4e')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xde5c('0x71')]['QueryTypes'][_0xde5c('0x72')]})[_0xde5c('0x25')](function(_0x57b6af){if(_0x57b6af&&_0x57b6af[_0xde5c('0x57')]){for(var _0x2d0cc2=0x0,_0x906d69=_0x57b6af[_0xde5c('0x57')];_0x2d0cc2<_0x906d69&&_[_0xde5c('0x6f')](_0x3cdc24[_0xde5c('0x6a')]);_0x2d0cc2++){if(_0x46d3c3[_0xde5c('0x70')]<=_0x57b6af[_0x2d0cc2][_0xde5c('0x73')]){_0x3cdc24[_0xde5c('0x6a')]=_0x57b6af[_0x2d0cc2][_0xde5c('0x73')];}else if(_0x46d3c3[_0xde5c('0x70')]>_0x57b6af[_0x2d0cc2][_0xde5c('0x73')]&&_0x46d3c3[_0xde5c('0x70')]<=_0x57b6af[_0x2d0cc2]['to']){_0x3cdc24['internal']=_0x46d3c3[_0xde5c('0x70')];}}}if(_[_0xde5c('0x6f')](_0x3cdc24[_0xde5c('0x6a')])){_0x3cdc24['internal']=_0x515439+0x1;}return _0x4e8bcf(_0x3cdc24);});});})[_0xde5c('0x30')](function(_0x12620b){_0x2c0eba(_0x12620b);});});}function updateUser(_0x3633ee){return new Promise(function(_0x55b708,_0x418e90){try{if(_0x3633ee[_0xde5c('0x74')]){_0x3633ee[_0xde5c('0x75')]=_0x3633ee['internal'];_0x3633ee['VoiceMail']={'mailbox':_0x3633ee[_0xde5c('0x6a')],'password':_0x3633ee[_0xde5c('0x47')],'fullname':_0x3633ee[_0xde5c('0x76')],'email':_0x3633ee['email']};}if(_0x3633ee[_0xde5c('0x32')]==='agent'){if(!_0x3633ee[_0xde5c('0x77')])_0x3633ee[_0xde5c('0x77')]=[_0xde5c('0x78'),_0xde5c('0x79'),_0xde5c('0x7a'),_0xde5c('0x7b'),_0xde5c('0x7c'),'104',_0xde5c('0x7d'),_0xde5c('0x7e'),_0xde5c('0x7f'),_0xde5c('0x80'),_0xde5c('0x81'),_0xde5c('0x82'),_0xde5c('0x83'),_0xde5c('0x84'),_0xde5c('0x85')];}_0x55b708(_0x3633ee);}catch(_0x467622){_0x418e90(_0x467622);}});}exports[_0xde5c('0x86')]=function(_0x1e8e40,_0x3a80ae){if(_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]==='agent')throw new Error('Unauthorized');if(_0x1e8e40[_0xde5c('0x65')][_0xde5c('0x32')]===_0xde5c('0x39')&&_0x1e8e40['user'][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x87'));}if(_0x1e8e40[_0xde5c('0x65')]['role']==='admin'&&_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x88'));}return licenseUtil['checkUserLimits']([_0x1e8e40[_0xde5c('0x65')]])[_0xde5c('0x25')](function(){return validateUser(_0x1e8e40['body']);})[_0xde5c('0x25')](function(_0x3904a5){return updateUser(_0x3904a5)[_0xde5c('0x25')](function(_0x56da01){if(_0x56da01['role']===_0xde5c('0x38')){_0x56da01[_0xde5c('0x89')]=_0x1e8e40['user'][_0xde5c('0x89')];delete _0x56da01['userProfileId'];}return _0x56da01;});})[_0xde5c('0x25')](function(_0x22fee1){return db['User']['create'](_0x22fee1,{'include':[{'model':db[_0xde5c('0x8a')],'as':_0xde5c('0x8a')}]});})['then'](function(_0x4985e5){if(_0x1e8e40[_0xde5c('0x65')][_0xde5c('0x32')]===_0xde5c('0x39'))return _0x4985e5;if(_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x39'))return _0x4985e5;return db[_0xde5c('0x8b')][_0xde5c('0x40')]({'where':{'name':_0x4985e5['role']===_0xde5c('0x33')?_0xde5c('0x3a'):_0xde5c('0x3b'),'userProfileId':_0x1e8e40['user'][_0xde5c('0x8c')]},'raw':!![]})['then'](function(_0xd156e5){if(!_0xd156e5||_0xd156e5[_0xde5c('0x8d')]!=0x0)return _0x4985e5;return db[_0xde5c('0x8e')][_0xde5c('0x86')]({'name':_0x4985e5[_0xde5c('0x41')],'resourceId':_0x4985e5['id'],'type':_0xd156e5[_0xde5c('0x41')],'sectionId':_0xd156e5['id']},{})['then'](function(){return _0x4985e5;});})['catch'](function(_0x534b47){logger[_0xde5c('0x2c')](_0xde5c('0x8f'),_0x534b47);throw _0x534b47;});})[_0xde5c('0x25')](respondWithResult(_0x3a80ae,0xc9))[_0xde5c('0x30')](handleError(_0x3a80ae,null));};exports[_0xde5c('0x90')]=function(_0xd77a8,_0x4fca74){var _0x461cab=_0xd77a8[_0xde5c('0x65')];var _0x1c0c1d=[];if(_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]==='agent')throw new Error(_0xde5c('0x91'));if(_['some'](_0x461cab,[_0xde5c('0x32'),'user'])&&_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x87'));}if(_['some'](_0x461cab,[_0xde5c('0x32'),_0xde5c('0x38')])&&_0xd77a8[_0xde5c('0x39')]['role']!==_0xde5c('0x38')){throw new Error(_0xde5c('0x92'));}return licenseUtil[_0xde5c('0x93')](_0x461cab)[_0xde5c('0x25')](function(){return validateUser(_0x461cab[0x0]);})[_0xde5c('0x25')](function(){for(var _0x50f624=0x1;_0x50f624<_0x461cab[_0xde5c('0x57')];_0x50f624++){var _0x1ab1dc=_0x461cab[_0x50f624-0x1][_0xde5c('0x6a')];if(!_0x461cab[_0x50f624][_0xde5c('0x6a')])_0x461cab[_0x50f624][_0xde5c('0x6a')]=_0x1ab1dc+0x1;_0x1c0c1d[_0xde5c('0x53')](validateUser(_0x461cab[_0x50f624]));}return Promise[_0xde5c('0x5f')](_0x1c0c1d);})[_0xde5c('0x25')](function(){_0x1c0c1d=[];for(var _0x27af5c=0x0;_0x27af5c<_0x461cab[_0xde5c('0x57')];_0x27af5c++){_0x1c0c1d[_0xde5c('0x53')](updateUser(_0x461cab[_0x27af5c]));}return Promise['all'](_0x1c0c1d);})[_0xde5c('0x25')](function(){_0x1c0c1d=_0x461cab['map'](function(_0x29c08b){return db[_0xde5c('0x43')]['create'](_0x29c08b,{'include':[{'model':db[_0xde5c('0x8a')],'as':_0xde5c('0x8a')}]})[_0xde5c('0x25')](function(_0x11f95b){_0x29c08b['id']=_0x11f95b['id'];return _0x29c08b;});});return Promise[_0xde5c('0x5f')](_0x1c0c1d);})['then'](function(_0x124c7b){if(_0xd77a8['body'][_0xde5c('0x32')]==='user')return _0x124c7b;if(_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x39'))return _0x124c7b;var _0xacf11e=_[_0xde5c('0x94')](_0x124c7b,function(_0x39b6e9){return _0x39b6e9['role']===_0xde5c('0x33')||_0x39b6e9[_0xde5c('0x32')]===_0xde5c('0x3c');});if(!_0xacf11e)return _0x124c7b;return db[_0xde5c('0x8b')][_0xde5c('0x54')]({'where':{'name':{'$or':[_0xde5c('0x3a'),_0xde5c('0x3b')]},'userProfileId':_0xd77a8['user']['userProfileId']},'raw':!![]})[_0xde5c('0x25')](function(_0x305d9f){if(_[_0xde5c('0x95')](_0x305d9f)||!_[_0xde5c('0x94')](_0x305d9f,[_0xde5c('0x8d'),0x0]))return _0x124c7b;_0x1c0c1d=[];var _0x547119=_(_0x305d9f)['map'](function(_0x5097c4){if(_0x5097c4[_0xde5c('0x8d')]===0x1)return;return _0x5097c4[_0xde5c('0x41')]==='Agents'?'agent':_0xde5c('0x3c');})[_0xde5c('0x96')]()[_0xde5c('0x3e')]();for(var _0x59b8d9=0x0;_0x59b8d9<_0x124c7b[_0xde5c('0x57')];_0x59b8d9++){if(!_[_0xde5c('0x3f')](_0x547119,_0x124c7b[_0x59b8d9]['role']))return;var _0xfea8f1=_0x124c7b[_0x59b8d9][_0xde5c('0x32')]==='agent'?'Agents':_0xde5c('0x3b');_0x1c0c1d['push'](db[_0xde5c('0x8e')][_0xde5c('0x86')]({'name':_0x124c7b[_0x59b8d9][_0xde5c('0x41')],'resourceId':_0x124c7b[_0x59b8d9]['id'],'type':_0xfea8f1,'sectionId':_[_0xde5c('0x40')](_0x305d9f,[_0xde5c('0x41'),_0xfea8f1])['id']},{}));}return Promise[_0xde5c('0x5f')](_0x1c0c1d);});})['then'](respondWithResult(_0x4fca74,0xc9))['catch'](handleError(_0x4fca74,null));};exports[_0xde5c('0x97')]=function(_0x9dacaa,_0x2296b4){if(_0x9dacaa[_0xde5c('0x65')]['id']){delete _0x9dacaa[_0xde5c('0x65')]['id'];}return db['User'][_0xde5c('0x40')]({'where':{'id':_0x9dacaa['params']['id']}})[_0xde5c('0x25')](function(_0x117622){if(!_0x117622)return null;if(_0x117622['id']===_0x9dacaa['user']['id']){if(!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x98')]||!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x117622[_0xde5c('0x9a')](_0x9dacaa[_0xde5c('0x65')]['oldPassword'])){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))]('Wrong\x20credentials');}if(_0x9dacaa['body'][_0xde5c('0x98')]===_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x9dacaa[_0xde5c('0x39')]['role']==='admin'){if(!_0x9dacaa[_0xde5c('0x65')]['newPassword']){throw new db[(_0xde5c('0x9b'))]['ValidationError'](_0xde5c('0x9d'));}}else if(_0x9dacaa['user']['role']===_0xde5c('0x39')){if(!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db['Sequelize']['ValidationError'](_0xde5c('0x9d'));}if(_0x117622[_0xde5c('0x32')]!==_0xde5c('0x33')){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0x91'));}}else{throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0x91'));}return _0x117622;})[_0xde5c('0x25')](handleEntityNotFound(_0x2296b4,null))[_0xde5c('0x25')](function(_0x123e93){return db[_0xde5c('0x6b')][_0xde5c('0x9e')]({'attributes':['id',_0xde5c('0x6c'),_0xde5c('0x9f'),_0xde5c('0xa0')]})[_0xde5c('0x25')](function(_0x4bd7f7){if(_0x4bd7f7[_0xde5c('0x6c')])authService['validatePasswordPattern'](_0x9dacaa['body']['newPassword']);if(!_0x4bd7f7[_0xde5c('0x9f')]||!_0x123e93[_0xde5c('0x48')])return _0x123e93;authService[_0xde5c('0xa1')](_0x9dacaa[_0xde5c('0x65')]['newPassword'],_0x123e93[_0xde5c('0x48')],_0x4bd7f7['passwordHistoryLimit']);return _0x123e93;})[_0xde5c('0x25')](saveUpdates({'password':_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')],'passwordResetAt':_0x9dacaa[_0xde5c('0x39')]['id']==_0x9dacaa[_0xde5c('0x61')]['id']?moment():null,'previousPasswords':authService[_0xde5c('0xa2')](_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')],_0x123e93[_0xde5c('0x48')])},null));})[_0xde5c('0x25')](respondWithResult(_0x2296b4,null))['catch'](handleError(_0x2296b4,null));};exports['addQueues']=function(_0x32ea11,_0x448a69){var _0x5168fa=_0x32ea11['body'][_0xde5c('0xa3')];return db[_0xde5c('0x43')]['find']({'where':{'id':_0x32ea11['params']['id']},'attributes':['id',_0xde5c('0x41'),'role',_0xde5c('0xa4'),_0xde5c('0xa5'),_0xde5c('0xa6'),'interface']})[_0xde5c('0x25')](handleEntityNotFound(_0x448a69,null))['then'](function(_0x88bca6){if(_0x88bca6){if(!utils['isValidChannel'](_0x5168fa)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x88bca6[_0xde5c('0xa7')+_[_0xde5c('0xa8')](_0x5168fa[_0xde5c('0xa9')]())+_0xde5c('0xaa')](_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')],{'penalty':_0x32ea11[_0xde5c('0x65')][_0xde5c('0xab')]||0x0})['spread'](function(_0x557d34){for(var _0x48d099=0x0;_0x48d099<_0x32ea11['body'][_0xde5c('0x68')][_0xde5c('0x57')];_0x48d099+=0x1){var _0x54b6c9={'UserId':Number(_0x32ea11[_0xde5c('0x61')]['id'])};_0x54b6c9[_[_0xde5c('0xa8')](_0x5168fa[_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')][_0x48d099]);socket[_0xde5c('0x34')](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5168fa['toLowerCase']())+'Queue:save',_0x54b6c9);}return _0x557d34;})[_0xde5c('0x25')](function(){if(_0x5168fa===_0xde5c('0xad')){return db[_0xde5c('0xae')][_0xde5c('0x54')]({'where':{'id':_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')]||[]},'raw':!![],'attributes':['id',_0xde5c('0x41')]});}})[_0xde5c('0x25')](function(_0x41f59){var _0x38a638=_0x88bca6[_0xde5c('0x37')]({'plain':!![]});var _0x28eff3=[];if(_0x5168fa===_0xde5c('0xad')&&_0x38a638[_0xde5c('0x32')]==='agent'&&_0x38a638[_0xde5c('0xa4')]){for(let _0x594241=0x0;_0x594241<_0x41f59[_0xde5c('0x57')];_0x594241+=0x1){_0x28eff3[_0xde5c('0x53')]({'membername':_0x38a638[_0xde5c('0x41')],'UserId':_0x38a638['id'],'queue_name':_0x41f59[_0x594241][_0xde5c('0x41')],'VoiceQueueId':_0x41f59[_0x594241]['id'],'interface':_[_0xde5c('0x6f')](_0x38a638[_0xde5c('0xaf')])?util[_0xde5c('0xb0')]('SIP/%s',_0x38a638['name']):_0x38a638[_0xde5c('0xaf')],'paused':_0x38a638[_0xde5c('0xa6')]||![],'penalty':_0x32ea11[_0xde5c('0x65')][_0xde5c('0xab')]||0x0});}return Promise[_0xde5c('0x5f')](_0x28eff3[_0xde5c('0xb1')](function(_0x16d4b4){return db[_0xde5c('0xb2')][_0xde5c('0xb3')](_0x16d4b4);}));}return _0x88bca6;});}})[_0xde5c('0x25')](respondWithStatusCode(_0x448a69,null))[_0xde5c('0x30')](handleError(_0x448a69,null));};exports[_0xde5c('0xb4')]=function(_0x5cca50,_0x39ac24){var _0x5f283a,_0x143e8;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5cca50[_0xde5c('0x61')]['id']},'attributes':['id','name',_0xde5c('0x32')]})['then'](handleEntityNotFound(_0x39ac24,null))['then'](function(_0x451e0b){if(_0x451e0b){_0x5f283a=_0x451e0b;if(!_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')]||!utils['isValidChannel'](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')])){throw new db[(_0xde5c('0x9b'))]['ValidationError'](_0xde5c('0xb5'));}return _0x451e0b[_0xde5c('0xb6')+_['capitalize'](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')]['toLowerCase']())+_0xde5c('0xaa')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]);}})[_0xde5c('0x25')](function(_0x2bb715){if(_[_0xde5c('0xb7')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')])){for(var _0x3bbede=0x0;_0x3bbede<_0x5cca50['query'][_0xde5c('0x68')]['length'];_0x3bbede+=0x1){_0x143e8={'UserId':Number(_0x5cca50['params']['id'])};_0x143e8[_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x5cca50['query'][_0xde5c('0x68')][_0x3bbede]);socket[_0xde5c('0x34')](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')]['channel'][_0xde5c('0xa9')]())+'Queue:remove',_0x143e8);}}else{_0x143e8={'UserId':Number(_0x5cca50['params']['id'])};_0x143e8[_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]);socket['emit'](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xb8'),_0x143e8);}return _0x2bb715;})['then'](function(){if(_0x5cca50['query'][_0xde5c('0xa3')]===_0xde5c('0xad')){return db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'UserId':_0x5cca50['params']['id'],'VoiceQueueId':_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]},'individualHooks':!![]})['then'](function(){return _0x5f283a;});}return _0x5f283a;})[_0xde5c('0x25')](respondWithStatusCode(_0x39ac24,null))[_0xde5c('0x30')](handleError(_0x39ac24,null));};exports[_0xde5c('0xb9')]=function(_0x1c7cc5,_0xef5ec8){_0x1c7cc5[_0xde5c('0x65')][_0xde5c('0xba')]=_0x1c7cc5['file'][_0xde5c('0xbb')];return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x1c7cc5[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xef5ec8,null))[_0xde5c('0x25')](saveUpdates(_0x1c7cc5[_0xde5c('0x65')],null))[_0xde5c('0x25')](respondWithResult(_0xef5ec8,null))[_0xde5c('0x30')](handleError(_0xef5ec8,null));};exports[_0xde5c('0xbc')]=function(_0x4b7bbc,_0x599794){var _0x4e3bc9=path[_0xde5c('0xbd')](config[_0xde5c('0xbe')],_0xde5c('0xbf'));return db['User'][_0xde5c('0x40')]({'where':{'id':_0x4b7bbc['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xde5c('0x25')](handleEntityNotFound(_0x599794,null))[_0xde5c('0x25')](function(_0x560c90){if(_0x560c90){if(_[_0xde5c('0x6f')](_0x560c90[_0xde5c('0xba')])){return _0x599794[_0xde5c('0xc0')](_0x4e3bc9);}else{if(!fs[_0xde5c('0xc1')](path[_0xde5c('0xbd')](config[_0xde5c('0xbe')],'server/files/images/',_0x560c90['userpic']))){return _0x599794[_0xde5c('0xc0')](_0x4e3bc9);}return _0x599794['download'](path['join'](config[_0xde5c('0xbe')],_0xde5c('0xc2'),_0x560c90['userpic']));}}})['catch'](handleError(_0x599794,null));};exports[_0xde5c('0xc3')]=function(_0x57cdbe,_0x501470){return db['User']['find']({'where':{'id':_0x57cdbe['params']['id']},'attributes':['id']})[_0xde5c('0x25')](handleEntityNotFound(_0x501470,null))[_0xde5c('0x25')](function(_0x5bab14){var _0x3a40cd=[];values=_0x5bab14[_0xde5c('0x59')];_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('sms',_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('openchannel',_0x5bab14['dataValues']));_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('fax',_0x5bab14['dataValues']));_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x5bab14[_0xde5c('0x59')]));return Promise['all'](_0x3a40cd);})['then'](function(_0xcb8793){if(_0xcb8793){var _0x4f25cf=_[_0xde5c('0xb1')](values['ChatOpenTabs'],function(_0x43408f){return{'channel':'CHAT','id':_0x43408f['id'],'createdAt':_0x43408f[_0xde5c('0xc4')]};});var _0x412d57=_[_0xde5c('0xb1')](values[_0xde5c('0xc5')],function(_0x361f60){return{'channel':_0xde5c('0xc6'),'id':_0x361f60['id'],'createdAt':_0x361f60[_0xde5c('0xc4')]};});var _0x100446=_['map'](values[_0xde5c('0xc7')],function(_0x237e10){return{'channel':_0xde5c('0xc8'),'id':_0x237e10['id'],'createdAt':_0x237e10[_0xde5c('0xc4')]};});var _0x3596b2=_['map'](values[_0xde5c('0xc9')],function(_0x85efd1){return{'channel':_0xde5c('0xca'),'id':_0x85efd1['id'],'createdAt':_0x85efd1[_0xde5c('0xc4')]};});var _0x5747b3=_[_0xde5c('0xb1')](values[_0xde5c('0xcb')],function(_0x1d3645){return{'channel':_0xde5c('0xcc'),'id':_0x1d3645['id'],'createdAt':_0x1d3645[_0xde5c('0xc4')]};});var _0x5e19e3=_[_0xde5c('0xb1')](values[_0xde5c('0xcd')],function(_0x49512d){return{'channel':_0xde5c('0xce'),'id':_0x49512d['id'],'createdAt':_0x49512d[_0xde5c('0xc4')]};});var _0x1f7a10=_[_0xde5c('0xcf')](_0x4f25cf,_0x412d57,_0x100446,_0x3596b2,_0x5747b3,_0x5e19e3);var _0xa2b7d9={'count':_0x1f7a10[_0xde5c('0x57')],'rows':_0x1f7a10};return _0xa2b7d9;}else return null;})[_0xde5c('0x25')](respondWithResult(_0x501470,null))[_0xde5c('0x30')](handleError(_0x501470,null));};exports[_0xde5c('0xd0')]=function(_0x429bda,_0x25dfa0){var _0x581a8d={};return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x429bda[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](function(_0x5cd84c){if(!_0x5cd84c){throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x429bda[_0xde5c('0x61')]['id']));}return contacts[_0xde5c('0x66')]();})[_0xde5c('0x25')](function(_0x5f781f){_0x429bda['query']['User']=_0x429bda[_0xde5c('0x61')]['id'];_0x581a8d=qs[_0xde5c('0x4c')](_0x5f781f,_0x429bda);if(_0x429bda[_0xde5c('0x4e')]['hasOwnProperty']('includeAll')){_0x581a8d[_0xde5c('0x4d')]=[{'model':db['CmList'],'as':_0xde5c('0xd2'),'required':![]},{'model':db[_0xde5c('0xd3')],'as':_0xde5c('0xd4'),'attributes':['id',_0xde5c('0x41'),'color'],'where':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]?{'id':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]}:undefined,'required':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]?!![]:![]}];}return contacts['findAll'](_0x429bda['query'],_0x429bda[_0xde5c('0x39')],_0x581a8d,_0x5f781f);})[_0xde5c('0x25')](respondWithFilteredResult(_0x25dfa0,_0x581a8d))[_0xde5c('0x30')](APIHandleError(_0x25dfa0));};exports[_0xde5c('0xd6')]=function(_0x4831b5,_0x24e198){var _0x277526;var _0xeeb6c5={};var _0xc3435d;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x4831b5['params']['id']},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32')]})['then'](handleEntityNotFound(_0x24e198,null))[_0xde5c('0x25')](function(_0x13f885){if(!utils[_0xde5c('0xd7')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xb5'));}_0x277526=_0x13f885;var _0x2a039a={};_0x2a039a[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+_0xde5c('0xda')]['rawAttributes']);_0x2a039a[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x4831b5[_0xde5c('0x4e')]);_0x2a039a[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x2a039a[_0xde5c('0xd8')],_0x2a039a[_0xde5c('0x4e')]);_0xeeb6c5['attributes']=_[_0xde5c('0xdc')](_0x2a039a['model'],qs['fields'](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0xeeb6c5['attributes']=_0xeeb6c5[_0xde5c('0x52')][_0xde5c('0x57')]?_0xeeb6c5[_0xde5c('0x52')]:_0x2a039a[_0xde5c('0xd8')];_0xeeb6c5[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x4831b5[_0xde5c('0x4e')]['sort']);_0xeeb6c5[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x4831b5[_0xde5c('0x4e')],_0x2a039a['filters']));if(_0x4831b5[_0xde5c('0x4e')][_0xde5c('0x46')]){_0xeeb6c5[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0xeeb6c5[_0xde5c('0xe0')],{'$or':_['map'](_0xeeb6c5['attributes'],function(_0x24f111){var _0x30cb38={};_0x30cb38[_0x24f111]={'$like':'%'+_0x4831b5[_0xde5c('0x4e')]['filter']+'%'};return _0x30cb38;})});}_0xeeb6c5=_['merge']({},_0xeeb6c5,_0x4831b5['options']);switch(_0x277526[_0xde5c('0x32')]){case _0xde5c('0x38'):return db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+_0xde5c('0xda')][_0xde5c('0x54')](_0xeeb6c5);case _0xde5c('0x39'):case _0xde5c('0x33'):return _0x277526[_0xde5c('0x37')+_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')]['channel'])+_0xde5c('0xaa')](_0xeeb6c5);default:throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xe2'));}})[_0xde5c('0x25')](function(_0x4b396a){_0xc3435d=_0x4b396a[_0xde5c('0x57')];if(!_0x4831b5['query'][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0xeeb6c5[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x4831b5['query'][_0xde5c('0x20')]);_0xeeb6c5['offset']=qs[_0xde5c('0x1e')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0x1e')]);}switch(_0x277526[_0xde5c('0x32')]){case'admin':return db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+'Queue'][_0xde5c('0x54')](_0xeeb6c5);case _0xde5c('0x39'):case _0xde5c('0x33'):return _0x277526[_0xde5c('0x37')+_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')]['channel'])+_0xde5c('0xaa')](_0xeeb6c5);}})[_0xde5c('0x25')](function(_0x6310be){return{'count':_0xc3435d,'rows':_0x6310be};})[_0xde5c('0x25')](respondWithResult(_0x24e198,null))[_0xde5c('0x30')](handleError(_0x24e198,null));};exports['getVoiceQueuesRt']=function(_0x428462,_0x293f98){var _0x18c38d={};var _0x5772cf={};var _0x173b80;var _0x1b529b;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x428462[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x293f98,null))['then'](function(_0x576eb1){if(_0x576eb1){_0x173b80=_0x576eb1;_0x5772cf['model']=_['keys'](db[_0xde5c('0xb2')]['rawAttributes']);_0x5772cf[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x428462[_0xde5c('0x4e')]);_0x5772cf[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x5772cf['model'],_0x5772cf[_0xde5c('0x4e')]);_0x18c38d[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x5772cf[_0xde5c('0xd8')],qs['fields'](_0x428462[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x18c38d[_0xde5c('0x52')]=_0x18c38d[_0xde5c('0x52')][_0xde5c('0x57')]?_0x18c38d[_0xde5c('0x52')]:_0x5772cf[_0xde5c('0xd8')];_0x18c38d[_0xde5c('0xde')]=qs['sort'](_0x428462[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x18c38d[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x428462[_0xde5c('0x4e')],_0x5772cf[_0xde5c('0xdb')]));if(_0x428462[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x18c38d[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x18c38d[_0xde5c('0xe0')],{'$or':_['map'](_0x18c38d[_0xde5c('0x52')],function(_0x37dad9){var _0x7fe73b={};_0x7fe73b[_0x37dad9]={'$like':'%'+_0x428462[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x7fe73b;})});}_0x18c38d=_[_0xde5c('0x63')]({},_0x18c38d,_0x428462['options']);return _0x173b80[_0xde5c('0xe5')](_0x18c38d);}})[_0xde5c('0x25')](function(_0x50520a){if(_0x50520a){_0x1b529b=_0x50520a[_0xde5c('0x57')];if(!_0x428462[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x18c38d[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x428462[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x18c38d[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x428462[_0xde5c('0x4e')]['offset']);}return _0x173b80[_0xde5c('0xe5')](_0x18c38d);}})[_0xde5c('0x25')](function(_0x534411){if(_0x534411){return _0x534411?{'count':_0x1b529b,'rows':_0x534411}:null;}})['then'](respondWithResult(_0x293f98,null))[_0xde5c('0x30')](handleError(_0x293f98,null));};exports[_0xde5c('0xe6')]=function(_0x4686ec,_0x2e6fa5){var _0x562796={};var _0x496554={};var _0x161fef;var _0x45c317;return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x4686ec[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e6fa5,null))[_0xde5c('0x25')](function(_0x2f646c){if(_0x2f646c){_0x161fef=_0x2f646c;_0x496554['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x496554[_0xde5c('0x4e')]=_['keys'](_0x4686ec[_0xde5c('0x4e')]);_0x496554[_0xde5c('0xdb')]=_['intersection'](_0x496554[_0xde5c('0xd8')],_0x496554[_0xde5c('0x4e')]);_0x562796[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x496554[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x562796['attributes']=_0x562796[_0xde5c('0x52')][_0xde5c('0x57')]?_0x562796[_0xde5c('0x52')]:_0x496554[_0xde5c('0xd8')];_0x562796[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x562796[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_['pick'](_0x4686ec[_0xde5c('0x4e')],_0x496554[_0xde5c('0xdb')]));if(_0x4686ec[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x562796[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x562796['where'],{'$or':_[_0xde5c('0xb1')](_0x562796[_0xde5c('0x52')],function(_0x18d241){var _0x3c4a11={};_0x3c4a11[_0x18d241]={'$like':'%'+_0x4686ec[_0xde5c('0x4e')]['filter']+'%'};return _0x3c4a11;})});}_0x562796=_[_0xde5c('0x63')]({},_0x562796,_0x4686ec[_0xde5c('0x64')]);return _0x161fef[_0xde5c('0xe6')](_0x562796);}})[_0xde5c('0x25')](function(_0x5062c4){if(_0x5062c4){_0x45c317=_0x5062c4[_0xde5c('0x57')];if(!_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x562796[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x562796[_0xde5c('0x1e')]=qs['offset'](_0x4686ec[_0xde5c('0x4e')]['offset']);}return _0x161fef[_0xde5c('0xe6')](_0x562796);}})[_0xde5c('0x25')](function(_0x4b9261){if(_0x4b9261){return _0x4b9261?{'count':_0x45c317,'rows':_0x4b9261}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2e6fa5,null))[_0xde5c('0x30')](handleError(_0x2e6fa5,null));};exports['getRecordings']=function(_0x174b6c,_0x30a4b5){var _0x5160a3={'raw':!![],'where':{}};var _0x1b470f={};var _0x3f0dd0={'count':0x0,'rows':[]};return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x174b6c[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0x30a4b5,null))['then'](function(_0x1cd3e5){if(_0x1cd3e5){_0x1b470f[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0xe7')][_0xde5c('0x44')]);_0x1b470f['query']=_[_0xde5c('0xd9')](_0x174b6c[_0xde5c('0x4e')]);_0x1b470f['filters']=_['intersection'](_0x1b470f[_0xde5c('0xd8')],_0x1b470f['query']);_0x5160a3[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1b470f[_0xde5c('0xd8')],qs['fields'](_0x174b6c[_0xde5c('0x4e')]['fields']));_0x5160a3[_0xde5c('0x52')]=_0x5160a3['attributes']['length']?_0x5160a3[_0xde5c('0x52')]:_0x1b470f[_0xde5c('0xd8')];if(!_0x174b6c[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x5160a3[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x174b6c['query'][_0xde5c('0x20')]);_0x5160a3[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x174b6c[_0xde5c('0x4e')]['offset']);}_0x5160a3[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x174b6c[_0xde5c('0x4e')]['sort']);_0x5160a3['where']=qs['filters'](_[_0xde5c('0xe1')](_0x174b6c[_0xde5c('0x4e')],_0x1b470f[_0xde5c('0xdb')]));_0x5160a3['where'][_0xde5c('0xe8')]=_0x1cd3e5['id'];if(_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x5160a3[_0xde5c('0xe0')]=_['merge'](_0x5160a3[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x5160a3[_0xde5c('0x52')],function(_0x22fe73){var _0x5a5e21={};_0x5a5e21[_0x22fe73]={'$like':'%'+_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x5a5e21;})});}_0x5160a3=_[_0xde5c('0x63')]({},_0x5160a3,_0x174b6c[_0xde5c('0x64')]);return db[_0xde5c('0xe7')][_0xde5c('0x21')]({'where':_0x5160a3[_0xde5c('0xe0')]})['then'](function(_0x352882){_0x3f0dd0['count']=_0x352882;if(_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x62')]){_0x5160a3['include']=[{'all':!![]}];}return db[_0xde5c('0xe7')][_0xde5c('0x54')](_0x5160a3);})[_0xde5c('0x25')](function(_0x1557ef){_0x3f0dd0[_0xde5c('0x55')]=_0x1557ef;return _0x3f0dd0;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x30a4b5,_0x5160a3))[_0xde5c('0x30')](handleError(_0x30a4b5,null));};exports[_0xde5c('0xe9')]=function(_0x26014f,_0x341c17){var _0x501d58={'raw':!![],'where':{}};var _0x1c2b70={};var _0x516094={'count':0x0,'rows':[]};return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x26014f[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x341c17,null))['then'](function(_0x2d5bd8){if(_0x2d5bd8){_0x1c2b70[_0xde5c('0xd8')]=_['keys'](db['ScreenRecording'][_0xde5c('0x44')]);_0x1c2b70[_0xde5c('0x4e')]=_['keys'](_0x26014f[_0xde5c('0x4e')]);_0x1c2b70['filters']=_[_0xde5c('0xdc')](_0x1c2b70[_0xde5c('0xd8')],_0x1c2b70['query']);_0x501d58[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1c2b70[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x26014f[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x501d58[_0xde5c('0x52')]=_0x501d58[_0xde5c('0x52')][_0xde5c('0x57')]?_0x501d58[_0xde5c('0x52')]:_0x1c2b70[_0xde5c('0xd8')];if(!_0x26014f[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x501d58['limit']=qs[_0xde5c('0x20')](_0x26014f[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x501d58[_0xde5c('0x1e')]=qs['offset'](_0x26014f[_0xde5c('0x4e')][_0xde5c('0x1e')]);}_0x501d58[_0xde5c('0xde')]=qs['sort'](_0x26014f[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x501d58['where']=qs['filters'](_[_0xde5c('0xe1')](_0x26014f['query'],_0x1c2b70[_0xde5c('0xdb')]));_0x501d58['where']['UserId']=_0x2d5bd8['id'];if(_0x26014f['query'][_0xde5c('0x46')]){_0x501d58['where']=_['merge'](_0x501d58[_0xde5c('0xe0')],{'$or':_['map'](_0x501d58[_0xde5c('0x52')],function(_0x207ab1){var _0x42f0d4={};_0x42f0d4[_0x207ab1]={'$like':'%'+_0x26014f[_0xde5c('0x4e')]['filter']+'%'};return _0x42f0d4;})});}_0x501d58=_[_0xde5c('0x63')]({},_0x501d58,_0x26014f[_0xde5c('0x64')]);return db[_0xde5c('0xea')][_0xde5c('0x21')]({'where':_0x501d58['where']})[_0xde5c('0x25')](function(_0x5f5923){_0x516094[_0xde5c('0x21')]=_0x5f5923;if(_0x26014f[_0xde5c('0x4e')][_0xde5c('0x62')]){_0x501d58[_0xde5c('0x4d')]=[{'all':!![]}];}return db[_0xde5c('0xea')][_0xde5c('0x54')](_0x501d58);})[_0xde5c('0x25')](function(_0x1c82db){_0x516094[_0xde5c('0x55')]=_0x1c82db;return _0x516094;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x341c17,_0x501d58))[_0xde5c('0x30')](handleError(_0x341c17,null));};exports[_0xde5c('0xeb')]=function(_0x82783e,_0xaefcf2){var _0x506dd1={};var _0x301271={};var _0x34d3b2;var _0x51e262;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x82783e[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xaefcf2,null))[_0xde5c('0x25')](function(_0x61740d){if(_0x61740d){_0x34d3b2=_0x61740d;_0x301271[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['ChatInteraction']['rawAttributes']);_0x301271['query']=_[_0xde5c('0xd9')](_0x82783e['query']);_0x301271['filters']=_[_0xde5c('0xdc')](_0x301271[_0xde5c('0xd8')],_0x301271[_0xde5c('0x4e')]);_0x506dd1[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x301271['model'],qs[_0xde5c('0xdd')](_0x82783e[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x506dd1[_0xde5c('0x52')]=_0x506dd1[_0xde5c('0x52')][_0xde5c('0x57')]?_0x506dd1['attributes']:_0x301271[_0xde5c('0xd8')];_0x506dd1['order']=qs['sort'](_0x82783e[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x506dd1[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x82783e[_0xde5c('0x4e')],_0x301271['filters']));if(_0x82783e['query'][_0xde5c('0x46')]){_0x506dd1[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x506dd1[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x506dd1[_0xde5c('0x52')],function(_0x18f477){var _0x46fc09={};_0x46fc09[_0x18f477]={'$like':'%'+_0x82783e['query'][_0xde5c('0x46')]+'%'};return _0x46fc09;})});}_0x506dd1=_[_0xde5c('0x63')]({},_0x506dd1,_0x82783e[_0xde5c('0x64')]);return _0x34d3b2[_0xde5c('0xeb')](_0x506dd1);}})[_0xde5c('0x25')](function(_0x4f9bb9){if(_0x4f9bb9){_0x51e262=_0x4f9bb9['length'];if(!_0x82783e[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x506dd1[_0xde5c('0x20')]=qs['limit'](_0x82783e[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x506dd1[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x82783e[_0xde5c('0x4e')][_0xde5c('0x1e')]);}return _0x34d3b2[_0xde5c('0xeb')](_0x506dd1);}})[_0xde5c('0x25')](function(_0x3995b7){if(_0x3995b7){return _0x3995b7?{'count':_0x51e262,'rows':_0x3995b7}:null;}})[_0xde5c('0x25')](respondWithResult(_0xaefcf2,null))[_0xde5c('0x30')](handleError(_0xaefcf2,null));};exports['getOpenchannelInteractions']=function(_0x42e890,_0x38c723){var _0x9cf7c1={};var _0x41dbf3={};var _0x34bb8d;var _0x52581e;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x42e890[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x38c723,null))[_0xde5c('0x25')](function(_0x83b147){if(_0x83b147){_0x34bb8d=_0x83b147;_0x41dbf3[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['OpenchannelInteraction']['rawAttributes']);_0x41dbf3[_0xde5c('0x4e')]=_['keys'](_0x42e890[_0xde5c('0x4e')]);_0x41dbf3[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x41dbf3[_0xde5c('0xd8')],_0x41dbf3[_0xde5c('0x4e')]);_0x9cf7c1[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x41dbf3[_0xde5c('0xd8')],qs['fields'](_0x42e890[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x9cf7c1['attributes']=_0x9cf7c1[_0xde5c('0x52')][_0xde5c('0x57')]?_0x9cf7c1[_0xde5c('0x52')]:_0x41dbf3[_0xde5c('0xd8')];_0x9cf7c1['order']=qs[_0xde5c('0xdf')](_0x42e890[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x9cf7c1['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x42e890[_0xde5c('0x4e')],_0x41dbf3[_0xde5c('0xdb')]));if(_0x42e890[_0xde5c('0x4e')]['filter']){_0x9cf7c1['where']=_[_0xde5c('0x63')](_0x9cf7c1['where'],{'$or':_[_0xde5c('0xb1')](_0x9cf7c1[_0xde5c('0x52')],function(_0x193908){var _0x37c06f={};_0x37c06f[_0x193908]={'$like':'%'+_0x42e890[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x37c06f;})});}_0x9cf7c1=_['merge']({},_0x9cf7c1,_0x42e890[_0xde5c('0x64')]);return _0x34bb8d[_0xde5c('0xec')](_0x9cf7c1);}})[_0xde5c('0x25')](function(_0x5df30b){if(_0x5df30b){_0x52581e=_0x5df30b['length'];if(!_0x42e890[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x9cf7c1['limit']=qs[_0xde5c('0x20')](_0x42e890[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x9cf7c1['offset']=qs['offset'](_0x42e890[_0xde5c('0x4e')][_0xde5c('0x1e')]);}return _0x34bb8d[_0xde5c('0xec')](_0x9cf7c1);}})[_0xde5c('0x25')](function(_0x73265e){if(_0x73265e){return _0x73265e?{'count':_0x52581e,'rows':_0x73265e}:null;}})['then'](respondWithResult(_0x38c723,null))[_0xde5c('0x30')](handleError(_0x38c723,null));};exports[_0xde5c('0xed')]=function(_0xa92ca1,_0x403ece){var _0x296190={'raw':!![],'where':{}};var _0x1bf1dd={};var _0x3036ce={'count':0x0,'rows':[]};return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0xa92ca1[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x403ece,null))['then'](function(_0xceee53){if(_0xceee53){_0x1bf1dd[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['MailInteraction'][_0xde5c('0x44')]);_0x1bf1dd[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0xa92ca1[_0xde5c('0x4e')]);_0x1bf1dd[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x1bf1dd[_0xde5c('0xd8')],_0x1bf1dd[_0xde5c('0x4e')]);_0x296190[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1bf1dd[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x296190['attributes']=_0x296190[_0xde5c('0x52')][_0xde5c('0x57')]?_0x296190['attributes']:_0x1bf1dd[_0xde5c('0xd8')];if(!_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x296190['limit']=qs[_0xde5c('0x20')](_0xa92ca1['query']['limit']);_0x296190[_0xde5c('0x1e')]=qs['offset'](_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0x1e')]);}_0x296190['order']=qs['sort'](_0xa92ca1[_0xde5c('0x4e')]['sort']);_0x296190[_0xde5c('0xe0')]=qs['filters'](_[_0xde5c('0xe1')](_0xa92ca1[_0xde5c('0x4e')],_0x1bf1dd[_0xde5c('0xdb')]));_0x296190[_0xde5c('0xe0')][_0xde5c('0xe8')]=_0xceee53['id'];if(_0xa92ca1['query']['filter']){_0x296190['where']=_['merge'](_0x296190['where'],{'$or':_[_0xde5c('0xb1')](_0x296190[_0xde5c('0x52')],function(_0xb78da2){var _0x3ebce4={};_0x3ebce4[_0xb78da2]={'$like':'%'+_0xa92ca1['query']['filter']+'%'};return _0x3ebce4;})});}_0x296190=_[_0xde5c('0x63')]({},_0x296190,_0xa92ca1['options']);return db[_0xde5c('0xee')]['count']({'where':_0x296190[_0xde5c('0xe0')]})['then'](function(_0x296ab1){_0x3036ce[_0xde5c('0x21')]=_0x296ab1;if(_0xa92ca1[_0xde5c('0x4e')]['includeAll']){_0x296190[_0xde5c('0x4d')]=[{'all':!![]}];}return db[_0xde5c('0xee')]['findAll'](_0x296190);})['then'](function(_0x30f0c9){_0x3036ce[_0xde5c('0x55')]=_0x30f0c9;return _0x3036ce;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x403ece,_0x296190))[_0xde5c('0x30')](handleError(_0x403ece,null));};exports[_0xde5c('0xef')]=function(_0x1e4e15,_0x39c0df){var _0x3d9c32={};var _0x2cf89f={};var _0x50c1e4;var _0x17f52f;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x1e4e15['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x39c0df,null))['then'](function(_0x424a2c){if(_0x424a2c){_0x50c1e4=_0x424a2c;_0x2cf89f[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['SmsInteraction']['rawAttributes']);_0x2cf89f[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x1e4e15[_0xde5c('0x4e')]);_0x2cf89f[_0xde5c('0xdb')]=_['intersection'](_0x2cf89f['model'],_0x2cf89f['query']);_0x3d9c32[_0xde5c('0x52')]=_['intersection'](_0x2cf89f[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x1e4e15[_0xde5c('0x4e')]['fields']));_0x3d9c32[_0xde5c('0x52')]=_0x3d9c32[_0xde5c('0x52')][_0xde5c('0x57')]?_0x3d9c32[_0xde5c('0x52')]:_0x2cf89f[_0xde5c('0xd8')];_0x3d9c32['order']=qs[_0xde5c('0xdf')](_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x3d9c32[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x1e4e15['query'],_0x2cf89f[_0xde5c('0xdb')]));if(_0x1e4e15[_0xde5c('0x4e')]['filter']){_0x3d9c32['where']=_['merge'](_0x3d9c32[_0xde5c('0xe0')],{'$or':_['map'](_0x3d9c32['attributes'],function(_0x391c7e){var _0x41960e={};_0x41960e[_0x391c7e]={'$like':'%'+_0x1e4e15[_0xde5c('0x4e')]['filter']+'%'};return _0x41960e;})});}_0x3d9c32=_['merge']({},_0x3d9c32,_0x1e4e15[_0xde5c('0x64')]);return _0x50c1e4[_0xde5c('0xef')](_0x3d9c32);}})['then'](function(_0x398051){if(_0x398051){_0x17f52f=_0x398051['length'];if(!_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x3d9c32[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x3d9c32[_0xde5c('0x1e')]=qs['offset'](_0x1e4e15['query'][_0xde5c('0x1e')]);}return _0x50c1e4[_0xde5c('0xef')](_0x3d9c32);}})[_0xde5c('0x25')](function(_0x308d86){if(_0x308d86){return _0x308d86?{'count':_0x17f52f,'rows':_0x308d86}:null;}})[_0xde5c('0x25')](respondWithResult(_0x39c0df,null))[_0xde5c('0x30')](handleError(_0x39c0df,null));};exports[_0xde5c('0xf0')]=function(_0x59ae6e,_0xb103d7){var _0x39f9e0={};var _0x44f810={};var _0x3e55b8;var _0xb39739;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x59ae6e['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xb103d7,null))[_0xde5c('0x25')](function(_0x403c35){if(_0x403c35){_0x3e55b8=_0x403c35;_0x44f810[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0xf1')]['rawAttributes']);_0x44f810['query']=_[_0xde5c('0xd9')](_0x59ae6e[_0xde5c('0x4e')]);_0x44f810[_0xde5c('0xdb')]=_['intersection'](_0x44f810[_0xde5c('0xd8')],_0x44f810['query']);_0x39f9e0['attributes']=_[_0xde5c('0xdc')](_0x44f810[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x39f9e0[_0xde5c('0x52')]=_0x39f9e0[_0xde5c('0x52')][_0xde5c('0x57')]?_0x39f9e0[_0xde5c('0x52')]:_0x44f810[_0xde5c('0xd8')];_0x39f9e0[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x39f9e0[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x59ae6e[_0xde5c('0x4e')],_0x44f810[_0xde5c('0xdb')]));if(_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x39f9e0[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x39f9e0['where'],{'$or':_[_0xde5c('0xb1')](_0x39f9e0[_0xde5c('0x52')],function(_0x8fc9c7){var _0x1a3e2a={};_0x1a3e2a[_0x8fc9c7]={'$like':'%'+_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x1a3e2a;})});}_0x39f9e0=_[_0xde5c('0x63')]({},_0x39f9e0,_0x59ae6e['options']);return _0x3e55b8[_0xde5c('0xf0')](_0x39f9e0);}})[_0xde5c('0x25')](function(_0x3466ea){if(_0x3466ea){_0xb39739=_0x3466ea['length'];if(!_0x59ae6e['query'][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x39f9e0[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x59ae6e[_0xde5c('0x4e')]['limit']);_0x39f9e0[_0xde5c('0x1e')]=qs['offset'](_0x59ae6e['query'][_0xde5c('0x1e')]);}return _0x3e55b8[_0xde5c('0xf0')](_0x39f9e0);}})[_0xde5c('0x25')](function(_0x457e91){if(_0x457e91){return _0x457e91?{'count':_0xb39739,'rows':_0x457e91}:null;}})[_0xde5c('0x25')](respondWithResult(_0xb103d7,null))['catch'](handleError(_0xb103d7,null));};exports[_0xde5c('0xf2')]=function(_0x4d15dd,_0x2e8111){var _0x4b25e7={};var _0x29de0e={};var _0x4169d5;var _0x99e79c;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x4d15dd[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x2e8111,null))[_0xde5c('0x25')](function(_0x264cd4){if(_0x264cd4){_0x4169d5=_0x264cd4;_0x29de0e['model']=_[_0xde5c('0xd9')](db[_0xde5c('0xf3')]['rawAttributes']);_0x29de0e[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x4d15dd[_0xde5c('0x4e')]);_0x29de0e['filters']=_[_0xde5c('0xdc')](_0x29de0e[_0xde5c('0xd8')],_0x29de0e['query']);_0x4b25e7[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x29de0e[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x4d15dd[_0xde5c('0x4e')]['fields']));_0x4b25e7['attributes']=_0x4b25e7[_0xde5c('0x52')][_0xde5c('0x57')]?_0x4b25e7[_0xde5c('0x52')]:_0x29de0e['model'];_0x4b25e7[_0xde5c('0xde')]=qs['sort'](_0x4d15dd['query']['sort']);_0x4b25e7[_0xde5c('0xe0')]=qs['filters'](_[_0xde5c('0xe1')](_0x4d15dd[_0xde5c('0x4e')],_0x29de0e['filters']));if(_0x4d15dd[_0xde5c('0x4e')]['filter']){_0x4b25e7[_0xde5c('0xe0')]=_['merge'](_0x4b25e7[_0xde5c('0xe0')],{'$or':_['map'](_0x4b25e7[_0xde5c('0x52')],function(_0x1aa39e){var _0x59d1d7={};_0x59d1d7[_0x1aa39e]={'$like':'%'+_0x4d15dd[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x59d1d7;})});}_0x4b25e7=_['merge']({},_0x4b25e7,_0x4d15dd['options']);return _0x4169d5[_0xde5c('0xf2')](_0x4b25e7);}})[_0xde5c('0x25')](function(_0x21e425){if(_0x21e425){_0x99e79c=_0x21e425[_0xde5c('0x57')];if(!_0x4d15dd[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x4b25e7['limit']=qs[_0xde5c('0x20')](_0x4d15dd['query']['limit']);_0x4b25e7[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x4d15dd[_0xde5c('0x4e')]['offset']);}return _0x4169d5[_0xde5c('0xf2')](_0x4b25e7);}})[_0xde5c('0x25')](function(_0x6b52b4){if(_0x6b52b4){return _0x6b52b4?{'count':_0x99e79c,'rows':_0x6b52b4}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2e8111,null))[_0xde5c('0x30')](handleError(_0x2e8111,null));};exports[_0xde5c('0xf4')]=function(_0x3b21ba,_0x4d3447,_0x14f721){var _0x50c63e;var _0x880a62;var _0x8e8e6c;var _0x5cd3f1=!_['isNil'](_0x3b21ba[_0xde5c('0x61')]['id'])?_0x3b21ba[_0xde5c('0x61')]['id']:!_['isNil'](_0x3b21ba[_0xde5c('0x39')]['id'])?_0x3b21ba[_0xde5c('0x39')]['id']:null;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5cd3f1,'role':{'$or':[_0xde5c('0x38'),_0xde5c('0x39'),'agent']}},'attributes':['id','name',_0xde5c('0xf5'),'mobile',_0xde5c('0x32'),_0xde5c('0x6a'),_0xde5c('0xa5')]})[_0xde5c('0x25')](function(_0x4f6c8a){if(_0x4f6c8a){if(_0x4f6c8a[_0xde5c('0x32')]===_0xde5c('0x33')){_0x50c63e=_0x4f6c8a;if(_0x3b21ba[_0xde5c('0x65')]['interface']){_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf6'),_0x50c63e[_0x3b21ba[_0xde5c('0x65')][_0xde5c('0xaf')]]);}else if(_0x3b21ba[_0xde5c('0x65')]['intrf']){_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf7'),_0x3b21ba['body'][_0xde5c('0xf8')]);}else{_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf7'),_0x50c63e[_0xde5c('0x41')]);}socket['to'](util['format']('user:%s',_0x50c63e['name']))[_0xde5c('0x34')]('user:forcelogout',{'user':{'id':_0x50c63e['id'],'name':_0x50c63e[_0xde5c('0x41')]},'ip':_0x3b21ba[_0xde5c('0xf9')]['x-forwarded-for']||_0x3b21ba[_0xde5c('0xfa')][_0xde5c('0xfb')]||_0x3b21ba['socket'][_0xde5c('0xfb')]||_0x3b21ba['connection'][_0xde5c('0xfc')][_0xde5c('0xfb')]});return new Promise(function(_0x1a53a8,_0x277979){db['sequelize']['transaction']()[_0xde5c('0x25')](_0x32172d=>{db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'membername':_0x50c63e[_0xde5c('0x41')]},'individualHooks':!![]},{'transaction':_0x32172d})[_0xde5c('0x25')](function(){return _0x32172d[_0xde5c('0xfd')]();})[_0xde5c('0x25')](_0x1a53a8)[_0xde5c('0x30')](_0x277979);});});}}else{throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xfe'));}})['then'](function(){if(_0x50c63e){return _0x50c63e['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1c5684){if(_0x50c63e){if(_0x1c5684){_0x880a62=_0x1c5684;if(_0x880a62[_0xde5c('0x57')]){var _0x1921f4=_0x880a62['map'](function(_0x1f16fd){return{'membername':_0x50c63e[_0xde5c('0x41')],'UserId':_0x50c63e['id'],'queue_name':_0x1f16fd[_0xde5c('0x41')],'VoiceQueueId':_0x1f16fd['id'],'interface':_0x8e8e6c,'paused':_0x50c63e[_0xde5c('0xa5')]||![],'penalty':_0x1f16fd[_0xde5c('0xff')]||0x0};});return db[_0xde5c('0xb2')][_0xde5c('0x90')](_0x1921f4);}}}})[_0xde5c('0x25')](function(){if(_0x50c63e){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x50c63e['name'],'exitAt':null}});}})[_0xde5c('0x25')](function(_0x3c1d7e){if(_0x50c63e){var _0x2f71d6=[];_0x3c1d7e[_0xde5c('0x101')](function(_0x51692d){_0x2f71d6[_0xde5c('0x53')](_0x51692d['update']({'exitAt':moment()['format'](_0xde5c('0x102'))}));});return Promise[_0xde5c('0x5f')](_0x2f71d6);}})[_0xde5c('0x25')](function(){if(_0x50c63e){var _0x1d7d8d=[];var _0xb76238=[];var _0x27a243=utils[_0xde5c('0x103')]();var _0x2fb69f={'membername':_0x50c63e[_0xde5c('0x41')],'interface':_0x8e8e6c,'enterAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'role':_0x50c63e['role'],'internal':_0x50c63e[_0xde5c('0x6a')]};_0x27a243[_0xde5c('0x101')](function(_0x10a360){_0x1d7d8d[_0xde5c('0x53')](_[_0xde5c('0x63')]({'channel':_0x10a360,'type':_0xde5c('0x104'),'data1':_0x3b21ba[_0xde5c('0x65')][_0xde5c('0x105')],'data2':_0x8e8e6c},_0x2fb69f));if(_0x50c63e['loginInPause']){_0xb76238[_0xde5c('0x53')](_[_0xde5c('0x63')]({'channel':_0x10a360,'type':'PAUSE','data1':_0xde5c('0x106')},_0x2fb69f));}});return db[_0xde5c('0x100')][_0xde5c('0x90')](_0x1d7d8d[_0xde5c('0xcf')](_0xb76238),{'individualHooks':!![]});}})[_0xde5c('0x25')](function(){if(_0x50c63e){return _0x50c63e[_0xde5c('0x31')]({'online':!![],'lastLoginAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'voicePause':_0x50c63e[_0xde5c('0xa5')]||![],'mailPause':_0x50c63e[_0xde5c('0xa5')]||![],'chatPause':_0x50c63e[_0xde5c('0xa5')]||![],'faxPause':_0x50c63e[_0xde5c('0xa5')]||![],'smsPause':_0x50c63e['loginInPause']||![],'openchannelPause':_0x50c63e[_0xde5c('0xa5')]||![],'whatsappPause':_0x50c63e[_0xde5c('0xa5')]||![],'pauseType':_0x50c63e[_0xde5c('0xa5')]?'LOGININPAUSE':null,'interface':_0x8e8e6c,'lastPauseAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102'))});}})[_0xde5c('0x25')](function(_0x49b3d5){if(_0x3b21ba[_0xde5c('0x107')]){return _0x14f721();}else{return Promise[_0xde5c('0x108')](_0x49b3d5)[_0xde5c('0x25')](respondWithResult(_0x4d3447,null));}})['catch'](handleError(_0x4d3447,null));};exports[_0xde5c('0x109')]=function(_0x5a301c,_0xb211e1){var _0x27a351;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5a301c[_0xde5c('0x61')]['id'],'role':_0xde5c('0x33')},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32')]})[_0xde5c('0x25')](handleEntityNotFound(_0xb211e1,null))[_0xde5c('0x25')](function(_0x3c77e1){if(_0x3c77e1){_0x27a351=_0x3c77e1;return db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'membername':_0x27a351['name']},'individualHooks':!![]});}})[_0xde5c('0x25')](function(){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x27a351[_0xde5c('0x41')],'exitAt':null}});})[_0xde5c('0x25')](function(_0x4d5e80){var _0x3306d1=[];_0x4d5e80[_0xde5c('0x101')](function(_0x3d0ab9){_0x3306d1[_0xde5c('0x53')](_0x3d0ab9['update']({'exitAt':moment()['format'](_0xde5c('0x102'))}));});return Promise[_0xde5c('0x5f')](_0x3306d1);})[_0xde5c('0x25')](function(){return _0x27a351[_0xde5c('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xb211e1,null))[_0xde5c('0x30')](handleError(_0xb211e1,null));};exports[_0xde5c('0x10a')]=function(_0x1b2170,_0x2ec809){var _0x56f91c;return db[_0xde5c('0xb2')][_0xde5c('0x31')]({'paused':0x1},{'where':{'UserId':_0x1b2170[_0xde5c('0x61')]['id']},'individualHooks':!![]})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x1b2170[_0xde5c('0x61')]['id'],'role':'agent'},'attributes':['id','name',_0xde5c('0x32'),_0xde5c('0x6a'),'interface',_0xde5c('0xa4')]});})['then'](handleEntityNotFound(_0x2ec809,null))[_0xde5c('0x25')](function(_0x360598){if(_0x360598){_0x56f91c=_0x360598;return respondWithRpcPromise(_0xde5c('0x10b'),_0xde5c('0x10a'),{'id':_0x56f91c['id'],'name':_0x56f91c[_0xde5c('0x41')],'pause':!![]});}})[_0xde5c('0x25')](function(){if(_0x56f91c){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x56f91c[_0xde5c('0x41')],'type':'PAUSE','exitAt':null}});}})[_0xde5c('0x25')](function(_0x2cb0c3){if(_0x2cb0c3[_0xde5c('0x57')]){var _0x5a9bef=moment()[_0xde5c('0xb0')](_0xde5c('0x102'));for(var _0x2f5984=0x0,_0x5da6fa=_0x2cb0c3['length'];_0x2f5984<_0x5da6fa;_0x2f5984++){_0x2cb0c3[_0x2f5984][_0xde5c('0x10c')]({'exitAt':_0x5a9bef});}}})['then'](function(){var _0x490d3a=[];var _0x480932=utils[_0xde5c('0x103')]();_0x480932[_0xde5c('0x101')](function(_0x543724){_0x490d3a[_0xde5c('0x53')]({'channel':_0x543724,'membername':_0x56f91c[_0xde5c('0x41')],'interface':_[_0xde5c('0x6f')](_0x56f91c['interface'])?util['format'](_0xde5c('0xf7'),_0x56f91c[_0xde5c('0x41')]):_0x56f91c['interface'],'type':_0xde5c('0x10d'),'enterAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'data1':_0x1b2170['body']['type']||_0xde5c('0x10e'),'role':_0x56f91c['role'],'internal':_0x56f91c[_0xde5c('0x6a')]});});return db[_0xde5c('0x100')][_0xde5c('0x90')](_0x490d3a,{'individualHooks':!![]});})[_0xde5c('0x25')](function(){return _0x56f91c[_0xde5c('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b2170['body']['type']||_0xde5c('0x10e'),'lastPauseAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102'))});})[_0xde5c('0x25')](respondWithResult(_0x2ec809,null))[_0xde5c('0x30')](handleError(_0x2ec809,null));};exports['unpause']=function(_0x6079c0,_0x1ebf10){if(_0x6079c0[_0xde5c('0x65')]['channel']&&!utils[_0xde5c('0xd7')](_0x6079c0['body'][_0xde5c('0xa3')])){throw new APIBadRequestError(util[_0xde5c('0xb0')](_0xde5c('0x10f'),_0x6079c0[_0xde5c('0x65')][_0xde5c('0xa3')]));}return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x6079c0[_0xde5c('0x61')]['id']},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32'),'internal',_0xde5c('0xaf'),'online',_0xde5c('0xa6'),'mailPause',_0xde5c('0x110'),_0xde5c('0x111'),_0xde5c('0x112'),_0xde5c('0x113'),_0xde5c('0x114'),_0xde5c('0x115'),_0xde5c('0x116')]})['then'](function(_0x2f18ce){if(!_0x2f18ce){throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x6079c0[_0xde5c('0x61')]['id']));}return _0x2f18ce[_0xde5c('0x117')](_0x6079c0[_0xde5c('0x65')][_0xde5c('0xa3')]);})[_0xde5c('0x25')](respondWithResult(_0x1ebf10,null))[_0xde5c('0x30')](APIHandleError(_0x1ebf10));};exports[_0xde5c('0x118')]=function(_0xee71e8,_0x54cdae){var _0x1c6e1a={};var _0x2e360e={};var _0x584c03;var _0x5ad19a;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0xee71e8[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x54cdae,null))[_0xde5c('0x25')](function(_0x22a5c2){if(_0x22a5c2){_0x584c03=_0x22a5c2;_0x2e360e[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0x119')][_0xde5c('0x44')]);_0x2e360e[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0xee71e8[_0xde5c('0x4e')]);_0x2e360e['filters']=_['intersection'](_0x2e360e['model'],_0x2e360e[_0xde5c('0x4e')]);_0x1c6e1a[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x2e360e[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0xee71e8[_0xde5c('0x4e')]['fields']));_0x1c6e1a[_0xde5c('0x52')]=_0x1c6e1a[_0xde5c('0x52')][_0xde5c('0x57')]?_0x1c6e1a[_0xde5c('0x52')]:_0x2e360e[_0xde5c('0xd8')];_0x1c6e1a[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0xee71e8['query'][_0xde5c('0xdf')]);_0x1c6e1a['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0xee71e8[_0xde5c('0x4e')],_0x2e360e[_0xde5c('0xdb')]));if(_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x1c6e1a[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x1c6e1a[_0xde5c('0xe0')],{'$or':_['map'](_0x1c6e1a[_0xde5c('0x52')],function(_0x4c5618){var _0x43ce27={};_0x43ce27[_0x4c5618]={'$like':'%'+_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x43ce27;})});}_0x1c6e1a=_[_0xde5c('0x63')]({},_0x1c6e1a,_0xee71e8[_0xde5c('0x64')]);return _0x584c03[_0xde5c('0x118')](_0x1c6e1a);}})['then'](function(_0x479317){if(_0x479317){_0x5ad19a=_0x479317[_0xde5c('0x57')];if(!_0xee71e8[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x1c6e1a[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x1c6e1a[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0xee71e8['query'][_0xde5c('0x1e')]);}return _0x584c03[_0xde5c('0x118')](_0x1c6e1a);}})['then'](function(_0x141338){if(_0x141338){return _0x141338?{'count':_0x5ad19a,'rows':_0x141338}:null;}})['then'](respondWithResult(_0x54cdae,null))['catch'](handleError(_0x54cdae,null));};exports[_0xde5c('0x11a')]=function(_0x4b4fa6,_0x115359){var _0x143f40=_0x4b4fa6[_0xde5c('0x61')]['id'];var _0x41d5f2=_0x4b4fa6[_0xde5c('0x65')]?_0x4b4fa6[_0xde5c('0x65')][_0xde5c('0x68')]:null;var _0x1e8050=[];return Promise[_0xde5c('0x108')]()[_0xde5c('0x25')](function(){if(!_0x41d5f2)throw new APIBadRequestError(_0xde5c('0x11b'));})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x143f40}});})[_0xde5c('0x25')](function(_0x66695){if(!_0x66695)throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x4b4fa6[_0xde5c('0x61')]['id']));return db[_0xde5c('0x71')][_0xde5c('0x11c')](function(_0x206432){return _0x66695[_0xde5c('0x11a')](_0x41d5f2,{'transaction':_0x206432})[_0xde5c('0x25')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x41d5f2}}});})[_0xde5c('0x25')](function(_0x312746){var _0x2ca95d=_['map'](_0x312746,function(_0x55929e){return _0x55929e['getAssociatedQueues']();});return Promise[_0xde5c('0x5f')](_0x2ca95d);})[_0xde5c('0x25')](function(_0x2d0627){_0x1e8050=_[_0xde5c('0x11d')](_0x2d0627);var _0x2ffa1b=_['map'](_0x1e8050,function(_0x5166ea){return _0x5166ea[_0xde5c('0x11e')](_0x66695['id'],{'transaction':_0x206432});});return Promise['all'](_0x2ffa1b);})[_0xde5c('0x25')](function(){if(!_0x66695[_0xde5c('0xa4')])return;var _0x257b0a=_[_0xde5c('0x46')](_0x1e8050,function(_0x3fe5e8){return _0x3fe5e8[_0xde5c('0x11f')](_0xde5c('0xa3'))===_0xde5c('0x120');});var _0x4410ba=_[_0xde5c('0xb1')](_0x257b0a,function(_0x232651){return db['UserVoiceQueueRt'][_0xde5c('0xb3')]({'membername':_0x66695[_0xde5c('0x41')],'UserId':_0x66695['id'],'queue_name':_0x232651[_0xde5c('0x41')],'VoiceQueueId':_0x232651['id'],'interface':_[_0xde5c('0x6f')](_0x66695['interface'])?util['format'](_0xde5c('0xf7'),_0x66695[_0xde5c('0x41')]):_0x66695[_0xde5c('0xaf')],'paused':_0x66695[_0xde5c('0xa6')]||![],'penalty':_0x66695['penalty']},{'transaction':_0x206432});});return Promise[_0xde5c('0x5f')](_0x4410ba);})[_0xde5c('0x25')](function(){return db[_0xde5c('0x121')][_0xde5c('0x54')]({'where':{'teamId':{'$in':_0x41d5f2}}});})['then'](function(_0x24bf8d){var _0x51e22c=_[_0xde5c('0xb1')](_0x24bf8d,function(_0x384df5){return db[_0xde5c('0x122')]['create']({'UserId':_0x66695['id'],'VoicePrefixId':_0x384df5[_0xde5c('0x123')]},{'transaction':_0x206432});});return Promise[_0xde5c('0x5f')](_0x51e22c);});});})[_0xde5c('0x25')](function(){for(var _0x4f5998=0x0;_0x4f5998<_0x1e8050['length'];_0x4f5998++){var _0x52a10e=_0x1e8050[_0x4f5998][_0xde5c('0x11f')]('channel');var _0x34b7d2=_0x52a10e+'QueueId';socket[_0xde5c('0x34')](_0xde5c('0x39')+_0x52a10e+'Queue:save',{'UserId':_0x143f40,['queueField']:_0x1e8050[_0x4f5998]['id']});}})[_0xde5c('0x25')](respondWithStatusCode(_0x115359,null))[_0xde5c('0x30')](APIHandleError(_0x115359));};exports[_0xde5c('0x124')]=function(_0x1a616e,_0x25fa2e){var _0x3cf9eb=_0x1a616e[_0xde5c('0x61')]['id'];var _0x5dd9cf=null;if(_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')]){_0x5dd9cf=_['isArray'](_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')])?_0x1a616e['query'][_0xde5c('0x68')]:[_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')]];}var _0x55805b=[];return Promise[_0xde5c('0x108')]()[_0xde5c('0x25')](function(){if(!_0x5dd9cf)throw new APIBadRequestError(_0xde5c('0x125'));})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x3cf9eb}});})['then'](function(_0x435d6f){if(!_0x435d6f)throw new APINotFoundError(util[_0xde5c('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1a616e[_0xde5c('0x61')]['id']));return db['sequelize'][_0xde5c('0x11c')](function(_0x49a8ce){return _0x435d6f['removeTeams'](_0x5dd9cf,{'transaction':_0x49a8ce})['then'](function(){return db[_0xde5c('0x119')]['findAll']({'where':{'id':{'$in':_0x5dd9cf}}});})['then'](function(_0x2d3d6a){var _0x8cc700=_['map'](_0x2d3d6a,function(_0xa265b8){return _0xa265b8[_0xde5c('0x126')]();});return Promise[_0xde5c('0x5f')](_0x8cc700);})[_0xde5c('0x25')](function(_0x700ac3){_0x55805b=_[_0xde5c('0x11d')](_0x700ac3);var _0x134094=_['map'](_0x55805b,function(_0x276cfd){return _0x276cfd['removeAgent'](_0x435d6f['id'],{'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x134094);})[_0xde5c('0x25')](function(){if(!_0x435d6f[_0xde5c('0xa4')])return;var _0x244a17=_[_0xde5c('0x46')](_0x55805b,function(_0x390c6b){return _0x390c6b[_0xde5c('0x11f')]('channel')===_0xde5c('0x120');});var _0x54da83=_['map'](_0x244a17,function(_0x575a24){return db['UserVoiceQueueRt'][_0xde5c('0x36')]({'where':{'VoiceQueueId':_0x575a24['id'],'UserId':_0x435d6f['id']},'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x54da83);})['then'](function(){return db[_0xde5c('0x121')][_0xde5c('0x54')]({'where':{'teamId':{'$in':_0x5dd9cf}}});})[_0xde5c('0x25')](function(_0x449326){var _0x5851b1=_['map'](_0x449326,function(_0x243382){return db[_0xde5c('0x122')]['destroy']({'where':{'UserId':_0x435d6f['id'],'VoicePrefixId':_0x243382['VoicePrefixId']}},{'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x5851b1);});});})[_0xde5c('0x25')](function(){for(var _0x5e085b=0x0;_0x5e085b<_0x55805b[_0xde5c('0x57')];_0x5e085b++){var _0xf47cff=_0x55805b[_0x5e085b][_0xde5c('0x11f')](_0xde5c('0xa3'));var _0x473078=_0xf47cff+_0xde5c('0xac');socket[_0xde5c('0x34')]('user'+_0xf47cff+_0xde5c('0xb8'),{'UserId':_0x3cf9eb,['queueField']:_0x55805b[_0x5e085b]['id']});}})[_0xde5c('0x25')](respondWithStatusCode(_0x25fa2e,null))[_0xde5c('0x30')](APIHandleError(_0x25fa2e));};exports['getLists']=function(_0x18bac6,_0x2ab799){var _0x88626c={};var _0x13bb6a={};var _0x31c8f0;var _0x3bb193;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x18bac6['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x2ab799,null))[_0xde5c('0x25')](function(_0x3f94df){if(_0x3f94df){_0x31c8f0=_0x3f94df;_0x13bb6a[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['CmList'][_0xde5c('0x44')]);_0x13bb6a[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x18bac6[_0xde5c('0x4e')]);_0x13bb6a['filters']=_['intersection'](_0x13bb6a[_0xde5c('0xd8')],_0x13bb6a[_0xde5c('0x4e')]);_0x88626c['attributes']=_['intersection'](_0x13bb6a[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x18bac6[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x88626c['attributes']=_0x88626c[_0xde5c('0x52')][_0xde5c('0x57')]?_0x88626c[_0xde5c('0x52')]:_0x13bb6a[_0xde5c('0xd8')];_0x88626c['order']=qs['sort'](_0x18bac6['query']['sort']);_0x88626c['where']=qs['filters'](_[_0xde5c('0xe1')](_0x18bac6[_0xde5c('0x4e')],_0x13bb6a[_0xde5c('0xdb')]));if(_0x18bac6['query']['filter']){_0x88626c[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x88626c[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x88626c[_0xde5c('0x52')],function(_0x2f438b){var _0x108673={};_0x108673[_0x2f438b]={'$like':'%'+_0x18bac6[_0xde5c('0x4e')]['filter']+'%'};return _0x108673;})});}_0x88626c=_[_0xde5c('0x63')]({},_0x88626c,_0x18bac6['options']);return _0x31c8f0[_0xde5c('0x127')](_0x88626c);}})[_0xde5c('0x25')](function(_0x128abf){if(_0x128abf){_0x3bb193=_0x128abf[_0xde5c('0x57')];if(!_0x18bac6[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x88626c[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x18bac6['query'][_0xde5c('0x20')]);_0x88626c[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x18bac6['query']['offset']);}return _0x31c8f0[_0xde5c('0x127')](_0x88626c);}})[_0xde5c('0x25')](function(_0x456a65){if(_0x456a65){return _0x456a65?{'count':_0x3bb193,'rows':_0x456a65}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2ab799,null))[_0xde5c('0x30')](handleError(_0x2ab799,null));};exports[_0xde5c('0x128')]=function(_0x3c833d,_0xf29aac){var _0x53c949={};var _0x3db338={};var _0x4d8734;return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x3c833d[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0xf29aac,null))[_0xde5c('0x25')](function(_0x34bd62){if(_0x34bd62){_0x4d8734=_0x34bd62;_0x3db338[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['User'][_0xde5c('0x44')]);_0x3db338[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x3c833d[_0xde5c('0x4e')]);_0x3db338['filters']=_[_0xde5c('0xdc')](_0x3db338[_0xde5c('0xd8')],_0x3db338[_0xde5c('0x4e')]);_0x53c949[_0xde5c('0x52')]=_['intersection'](_0x3db338[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x3c833d[_0xde5c('0x4e')]['fields']));_0x53c949['attributes']=_0x53c949['attributes']['length']?_0x53c949[_0xde5c('0x52')]:_0x3db338['model'];_0x53c949[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x3c833d[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x53c949['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x3c833d[_0xde5c('0x4e')],_0x3db338[_0xde5c('0xdb')]));if(_0x3c833d[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x53c949[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x53c949['where'],{'$or':_[_0xde5c('0xb1')](_0x53c949[_0xde5c('0x52')],function(_0x4f5acf){var _0x2e70f0={};_0x2e70f0[_0x4f5acf]={'$like':'%'+_0x3c833d[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x2e70f0;})});}_0x53c949[_0xde5c('0xd8')]=db['User'];_0x53c949['as']=_0xde5c('0x3a');_0x53c949=_[_0xde5c('0x63')]({},_0x53c949,_0x3c833d[_0xde5c('0x64')]);return _0x4d8734[_0xde5c('0x129')]({'include':[_0x53c949]});}})[_0xde5c('0x25')](function(_0x28cd86){if(_0x28cd86){var _0x128e42={},_0x3e8bb2=[];for(var _0x6c152e=0x0;_0x6c152e<_0x28cd86[_0xde5c('0x57')];_0x6c152e+=0x1){for(var _0xd2e6e4=0x0,_0x68f4f0;_0xd2e6e4<_0x28cd86[_0x6c152e][_0xde5c('0x3a')][_0xde5c('0x57')];_0xd2e6e4+=0x1){_0x68f4f0=_0x28cd86[_0x6c152e][_0xde5c('0x3a')][_0xd2e6e4][_0xde5c('0x37')]({'plain':!![]});_0x128e42[_0x68f4f0['id']]=_0x68f4f0;}}_0x128e42=_['values'](_0x128e42);for(var _0x2aab34=qs[_0xde5c('0x1e')](_0x3c833d['query'][_0xde5c('0x1e')]);_0x2aab34<_0x128e42[_0xde5c('0x57')]&&_0x3e8bb2['length']=_0x42309f[_0xe7e5('0x4c')]){throw new Error(_0xe7e5('0x4d'));}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return db[_0xe7e5('0x42')][_0xe7e5('0x43')]({'where':{'membername':_0x295be0[_0xe7e5('0x1c')]},'individualHooks':!![]});}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return _0x295be0['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2d61cd){if(_0x295be0){if(_0x2d61cd){var _0x45449=[];_0x43557a=_0x2d61cd;if(_0x43557a['length']){for(var _0x5f18c3=0x0;_0x5f18c3<_0x43557a[_0xe7e5('0x26')];_0x5f18c3++){_0x45449[_0xe7e5('0x2b')](db[_0xe7e5('0x42')][_0xe7e5('0x4e')]({'membername':_0x295be0['name'],'UserId':_0x295be0['id'],'queue_name':_0x43557a[_0x5f18c3][_0xe7e5('0x1c')],'VoiceQueueId':_0x43557a[_0x5f18c3]['id'],'interface':_0x1873ed,'paused':_0x295be0['loginInPause']||![],'penalty':_0x43557a[_0x5f18c3][_0xe7e5('0x4f')]||0x0}));}return BPromise[_0xe7e5('0x44')](_0x45449);}}}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return db[_0xe7e5('0x23')]['findAll']({'where':{'membername':_0x295be0['name'],'exitAt':null}});}})[_0xe7e5('0x1f')](function(_0x17918c){if(_0x295be0){if(_0x17918c&&_0x17918c[_0xe7e5('0x26')]){var _0x25737a=[];_0x17918c[_0xe7e5('0x2a')](function(_0x420649){_0x25737a['push'](_0x420649[_0xe7e5('0x22')]({'exitAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28'))}));});return BPromise[_0xe7e5('0x44')](_0x25737a);}}})['then'](function(){if(_0x295be0){var _0x3f7aad=[];var _0x5174aa=[];var _0x1e0916=utils['getChannels']();var _0x36848b={'membername':_0x295be0[_0xe7e5('0x1c')],'interface':_0x1873ed,'enterAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'role':_0x295be0[_0xe7e5('0x1d')],'internal':_0x295be0[_0xe7e5('0x30')]};_0x1e0916['forEach'](function(_0x17d946){_0x3f7aad['push'](_[_0xe7e5('0x50')]({'channel':_0x17d946,'type':_0xe7e5('0x51'),'data1':_0xe7e5('0x52'),'data2':_0x1873ed},_0x36848b));if(_0x295be0[_0xe7e5('0x47')]){_0x5174aa['push'](_[_0xe7e5('0x50')]({'channel':_0x17d946,'type':_0xe7e5('0x25'),'data1':_0xe7e5('0x53')},_0x36848b));}});return db[_0xe7e5('0x23')]['bulkCreate'](_0x3f7aad[_0xe7e5('0x54')](_0x5174aa),{'individualHooks':!![]});}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return _0x295be0[_0xe7e5('0x22')]({'online':!![],'lastLoginAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'voicePause':_0x295be0['loginInPause']||![],'mailPause':_0x295be0['loginInPause']||![],'chatPause':_0x295be0[_0xe7e5('0x47')]||![],'faxPause':_0x295be0['loginInPause']||![],'smsPause':_0x295be0[_0xe7e5('0x47')]||![],'openchannelPause':_0x295be0[_0xe7e5('0x47')]||![],'pauseType':_0x295be0[_0xe7e5('0x47')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'interface':_0x1873ed});}})[_0xe7e5('0x1f')](function(_0x2eab02){_0x5b9852(_0x2eab02);})[_0xe7e5('0x14')](function(_0x43afbf){_0x1cbd88(_0x5c1ae1[_0xe7e5('0x15')](0x1f4,_0x43afbf[_0xe7e5('0x16')]));});});}; \ No newline at end of file +var _0xe8f5=['faxPause','openchannelPause','pauseType','lastPauseAt','params','system','LogoutUser','findOne','mobile','phone','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt','destroy','upsert','UserVoiceQueue.penalty','push','merge','callysquare','LOGININPAUSE','concat','loginInPause','lodash','util','bluebird','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','GetUser','User','options','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowUser','find','raw','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','update','MemberReport','findAll','name','PAUSE','length','updateAttributes','getChannels','forEach','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','role','bulkCreate','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','chatPause'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe8f5,0xbc));var _0x5e8f=function(_0x5b3c11,_0x9d539){_0x5b3c11=_0x5b3c11-0x0;var _0x5f4a82=_0xe8f5[_0x5b3c11];return _0x5f4a82;};'use strict';var _=require(_0x5e8f('0x0'));var util=require(_0x5e8f('0x1'));var moment=require('moment');var BPromise=require(_0x5e8f('0x2'));var Redis=require(_0x5e8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e8f('0x4'));var config=require(_0x5e8f('0x5'));config[_0x5e8f('0x6')]=_[_0x5e8f('0x7')](config['redis'],{'host':_0x5e8f('0x8'),'port':0x18eb});var socket=require(_0x5e8f('0x9'))(new Redis(config[_0x5e8f('0x6')]));require(_0x5e8f('0xa'))['register'](socket);exports[_0x5e8f('0xb')]=function(_0x1d7e56){var _0x2f26b3=this;return new Promise(function(_0x53a8af,_0x5dc614){return db[_0x5e8f('0xc')]['findAll']({'raw':_0x1d7e56[_0x5e8f('0xd')]?_0x1d7e56[_0x5e8f('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x1d7e56[_0x5e8f('0xd')]?_0x1d7e56['options'][_0x5e8f('0xe')]||null:null,'attributes':_0x1d7e56[_0x5e8f('0xd')]?_0x1d7e56['options'][_0x5e8f('0xf')]||null:null,'limit':_0x1d7e56[_0x5e8f('0xd')]?_0x1d7e56['options'][_0x5e8f('0x10')]||null:null,'include':_0x1d7e56[_0x5e8f('0xd')]?_0x1d7e56['options'][_0x5e8f('0x11')]?_['map'](_0x1d7e56[_0x5e8f('0xd')][_0x5e8f('0x11')],function(_0x2cbf1d){return{'model':db[_0x2cbf1d['model']],'as':_0x2cbf1d['as'],'attributes':_0x2cbf1d[_0x5e8f('0xf')],'include':_0x2cbf1d[_0x5e8f('0x11')]?_['map'](_0x2cbf1d[_0x5e8f('0x11')],function(_0x2afe94){return{'model':db[_0x2afe94[_0x5e8f('0x12')]],'as':_0x2afe94['as'],'attributes':_0x2afe94[_0x5e8f('0xf')],'include':_0x2afe94[_0x5e8f('0x11')]?_[_0x5e8f('0x13')](_0x2afe94['include'],function(_0x1afc33){return{'model':db[_0x1afc33['model']],'as':_0x1afc33['as'],'attributes':_0x1afc33['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e8f('0x14')](function(_0x342d68){logger[_0x5e8f('0x15')](_0x5e8f('0xb'),_0x1d7e56);logger[_0x5e8f('0x16')](_0x5e8f('0xb'),_0x1d7e56,JSON[_0x5e8f('0x17')](_0x342d68));_0x53a8af(_0x342d68);})[_0x5e8f('0x18')](function(_0x5ae39f){logger['error'](_0x5e8f('0xb'),_0x5ae39f[_0x5e8f('0x19')],_0x1d7e56);_0x5dc614(_0x2f26b3[_0x5e8f('0x1a')](0x1f4,_0x5ae39f[_0x5e8f('0x19')]));});});};exports[_0x5e8f('0x1b')]=function(_0x5d63a8){var _0x124c87=this;return new Promise(function(_0x400b75,_0x311a99){return db[_0x5e8f('0xc')][_0x5e8f('0x1c')]({'raw':_0x5d63a8['options']?_0x5d63a8['options'][_0x5e8f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d63a8[_0x5e8f('0xd')]?_0x5d63a8['options'][_0x5e8f('0xe')]||null:null,'attributes':_0x5d63a8['options']?_0x5d63a8[_0x5e8f('0xd')][_0x5e8f('0xf')]||null:null,'include':_0x5d63a8['options']?_0x5d63a8[_0x5e8f('0xd')][_0x5e8f('0x11')]?_[_0x5e8f('0x13')](_0x5d63a8['options'][_0x5e8f('0x11')],function(_0x289777){return{'model':db[_0x289777['model']],'as':_0x289777['as'],'attributes':_0x289777['attributes'],'include':_0x289777[_0x5e8f('0x11')]?_[_0x5e8f('0x13')](_0x289777[_0x5e8f('0x11')],function(_0x298e23){return{'model':db[_0x298e23[_0x5e8f('0x12')]],'as':_0x298e23['as'],'attributes':_0x298e23[_0x5e8f('0xf')],'include':_0x298e23['include']?_[_0x5e8f('0x13')](_0x298e23[_0x5e8f('0x11')],function(_0x1cec38){return{'model':db[_0x1cec38['model']],'as':_0x1cec38['as'],'attributes':_0x1cec38[_0x5e8f('0xf')]};}):[]};}):[]};}):[]:[]})[_0x5e8f('0x14')](function(_0x37fa0e){logger[_0x5e8f('0x15')](_0x5e8f('0x1b'),_0x5d63a8);logger['debug'](_0x5e8f('0x1b'),_0x5d63a8,JSON['stringify'](_0x37fa0e));_0x400b75(_0x37fa0e);})[_0x5e8f('0x18')](function(_0x4ed567){logger[_0x5e8f('0x1a')](_0x5e8f('0x1b'),_0x4ed567[_0x5e8f('0x19')],_0x5d63a8);_0x311a99(_0x124c87[_0x5e8f('0x1a')](0x1f4,_0x4ed567[_0x5e8f('0x19')]));});});};exports['PauseUser']=function(_0x20aec5){var _0x2147f3;return db['User'][_0x5e8f('0x1c')]({'where':_0x20aec5[_0x5e8f('0xd')][_0x5e8f('0xe')]||{},'attributes':['id','name','role',_0x5e8f('0x1e'),_0x5e8f('0x1f')]})[_0x5e8f('0x14')](function(_0x25c99d){if(!_0x25c99d){throw new Error(util[_0x5e8f('0x20')](_0x5e8f('0x21'),_0x20aec5['params']['id']));}_0x2147f3=_0x25c99d;return db['UserVoiceQueueRt'][_0x5e8f('0x22')]({'paused':0x1},{'where':{'UserId':_0x2147f3['id']},'individualHooks':!![]});})['then'](function(){return db[_0x5e8f('0x23')][_0x5e8f('0x24')]({'where':{'membername':_0x2147f3[_0x5e8f('0x25')],'type':_0x5e8f('0x26'),'exitAt':null}});})[_0x5e8f('0x14')](function(_0x5d9419){if(_0x5d9419&&_0x5d9419[_0x5e8f('0x27')]){var _0x22fdcb=moment()[_0x5e8f('0x20')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x26edc7=0x0,_0x1b74b6=_0x5d9419['length'];_0x26edc7<_0x1b74b6;_0x26edc7++){_0x5d9419[_0x26edc7][_0x5e8f('0x28')]({'exitAt':_0x22fdcb});}}})['then'](function(){var _0x1b19b=[];var _0xb8ce4e=utils[_0x5e8f('0x29')]();_0xb8ce4e[_0x5e8f('0x2a')](function(_0x15a5e8){_0x1b19b['push']({'channel':_0x15a5e8,'membername':_0x2147f3[_0x5e8f('0x25')],'interface':_[_0x5e8f('0x2b')](_0x2147f3[_0x5e8f('0x1f')])?util[_0x5e8f('0x20')](_0x5e8f('0x2c'),_0x2147f3[_0x5e8f('0x25')]):_0x2147f3[_0x5e8f('0x1f')],'type':_0x5e8f('0x26'),'enterAt':moment()['format'](_0x5e8f('0x2d')),'data1':_0x20aec5[_0x5e8f('0x2e')][_0x5e8f('0x2f')]||_0x5e8f('0x30'),'role':_0x2147f3[_0x5e8f('0x31')],'internal':_0x2147f3[_0x5e8f('0x1e')],'uniqueid':_0x20aec5[_0x5e8f('0x2e')]['uniqueid']||null});});return db[_0x5e8f('0x23')][_0x5e8f('0x32')](_0x1b19b,{'individualHooks':!![]});})[_0x5e8f('0x14')](function(){return _0x2147f3[_0x5e8f('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x20aec5[_0x5e8f('0x2e')][_0x5e8f('0x2f')]||_0x5e8f('0x30'),'lastPauseAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d'))});})[_0x5e8f('0x18')](function(_0x479959){throw _0x479959;});};exports[_0x5e8f('0x33')]=function(_0x1ae3d7){return Promise['resolve']()[_0x5e8f('0x14')](function(){if(_0x1ae3d7[_0x5e8f('0x2e')]['channel']&&!utils['isValidChannel'](_0x1ae3d7[_0x5e8f('0x2e')][_0x5e8f('0x34')])){throw new Error(util['format'](_0x5e8f('0x35'),_0x1ae3d7['body']['channel']));}return db[_0x5e8f('0xc')]['findOne']({'where':_0x1ae3d7[_0x5e8f('0xd')][_0x5e8f('0xe')]||{},'attributes':['id',_0x5e8f('0x25'),'role','internal','interface',_0x5e8f('0x36'),_0x5e8f('0x37'),_0x5e8f('0x38'),_0x5e8f('0x39'),_0x5e8f('0x3a'),_0x5e8f('0x3b'),'smsPause','whatsappPause',_0x5e8f('0x3c'),_0x5e8f('0x3d')]});})['then'](function(_0x31c492){if(!_0x31c492){throw new Error(util[_0x5e8f('0x20')](_0x5e8f('0x21'),_0x1ae3d7[_0x5e8f('0x3e')]['id']));}return _0x31c492['unpause'](_0x1ae3d7[_0x5e8f('0x2e')][_0x5e8f('0x34')],_0x5e8f('0x3f'));})[_0x5e8f('0x18')](function(_0x100f6c){throw _0x100f6c;});};exports[_0x5e8f('0x40')]=function(_0x8428b4){var _0x189c87=this;return new Promise(function(_0x2f1449,_0x1c6181){var _0x26c44d;return db[_0x5e8f('0xc')][_0x5e8f('0x41')]({'where':_0x8428b4[_0x5e8f('0xd')][_0x5e8f('0xe')]||{},'attributes':['id',_0x5e8f('0x25')]})[_0x5e8f('0x14')](function(_0x407926){if(_0x407926){_0x26c44d=_0x407926;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x26c44d[_0x5e8f('0x25')]},'individualHooks':!![]});}})['then'](function(){if(_0x26c44d){return db['MemberReport'][_0x5e8f('0x24')]({'where':{'membername':_0x26c44d[_0x5e8f('0x25')],'exitAt':null}});}})[_0x5e8f('0x14')](function(_0x5536f7){if(_0x26c44d){if(_0x5536f7&&_0x5536f7['length']){var _0x18cbfe=[];_0x5536f7[_0x5e8f('0x2a')](function(_0x3da576){_0x18cbfe['push'](_0x3da576['update']({'exitAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d'))}));});return BPromise['all'](_0x18cbfe);}}})['then'](function(){if(_0x26c44d){return _0x26c44d[_0x5e8f('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5e8f('0x14')](function(_0x376859){_0x2f1449(_0x376859);})[_0x5e8f('0x18')](function(_0x3e1fd6){_0x1c6181(_0x189c87['error'](0x1f4,_0x3e1fd6['message']));});});};exports['LoginUser']=function(_0xcf7443){var _0x3ccd1a=this;return new Promise(function(_0x6bdc67,_0x24fefb){var _0x302ad8;var _0x3b6735;var _0xe4124;var _0x14aec5;return db[_0x5e8f('0xc')][_0x5e8f('0x41')]({'where':_0xcf7443[_0x5e8f('0xd')][_0x5e8f('0xe')]||{},'attributes':['id',_0x5e8f('0x25'),'role',_0x5e8f('0x42'),_0x5e8f('0x43'),_0x5e8f('0x1e'),'loginInPause',_0x5e8f('0x1f')]})[_0x5e8f('0x14')](function(_0x292639){if(_0x292639){_0x302ad8=_0x292639;_0x14aec5=_0xcf7443[_0x5e8f('0x2e')][_0x5e8f('0x1f')]?_0xcf7443[_0x5e8f('0x2e')]['interface']:util['format'](_0x5e8f('0x2c'),_0x302ad8[_0x5e8f('0x25')]);return db[_0x5e8f('0xc')][_0x5e8f('0x44')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x302ad8['id']}}});}})[_0x5e8f('0x14')](function(_0x536692){if(_0x536692){_0xe4124=_0x536692;return require('../../config/license/util')[_0x5e8f('0x45')]();}})[_0x5e8f('0x14')](function(_0x4c6a0f){if(_0x4c6a0f&&_0x4c6a0f[_0x5e8f('0x46')]&&_0xe4124>=_0x4c6a0f[_0x5e8f('0x46')]){throw new Error(_0x5e8f('0x47'));}})['then'](function(){if(_0x302ad8){return db[_0x5e8f('0x48')][_0x5e8f('0x49')]({'where':{'membername':_0x302ad8[_0x5e8f('0x25')]},'individualHooks':!![]});}})['then'](function(){if(_0x302ad8){return _0x302ad8['getVoiceQueues']({'raw':!![]});}})[_0x5e8f('0x14')](function(_0x1ab17a){if(_0x302ad8){if(_0x1ab17a){var _0x410323=[];_0x3b6735=_0x1ab17a;if(_0x3b6735[_0x5e8f('0x27')]){for(var _0x553d51=0x0;_0x553d51<_0x3b6735[_0x5e8f('0x27')];_0x553d51++){_0x410323['push'](db[_0x5e8f('0x48')][_0x5e8f('0x4a')]({'membername':_0x302ad8[_0x5e8f('0x25')],'UserId':_0x302ad8['id'],'queue_name':_0x3b6735[_0x553d51][_0x5e8f('0x25')],'VoiceQueueId':_0x3b6735[_0x553d51]['id'],'interface':_0x14aec5,'paused':_0x302ad8['loginInPause']||![],'penalty':_0x3b6735[_0x553d51][_0x5e8f('0x4b')]||0x0}));}return BPromise['all'](_0x410323);}}}})['then'](function(){if(_0x302ad8){return db['MemberReport'][_0x5e8f('0x24')]({'where':{'membername':_0x302ad8[_0x5e8f('0x25')],'exitAt':null}});}})[_0x5e8f('0x14')](function(_0x33de2b){if(_0x302ad8){if(_0x33de2b&&_0x33de2b[_0x5e8f('0x27')]){var _0xbbabf2=[];_0x33de2b[_0x5e8f('0x2a')](function(_0x13f242){_0xbbabf2[_0x5e8f('0x4c')](_0x13f242[_0x5e8f('0x22')]({'exitAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d'))}));});return BPromise['all'](_0xbbabf2);}}})[_0x5e8f('0x14')](function(){if(_0x302ad8){var _0xd85b05=[];var _0x13f9cb=[];var _0x386c11=utils[_0x5e8f('0x29')]();var _0x341969={'membername':_0x302ad8[_0x5e8f('0x25')],'interface':_0x14aec5,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x302ad8[_0x5e8f('0x31')],'internal':_0x302ad8[_0x5e8f('0x1e')]};_0x386c11[_0x5e8f('0x2a')](function(_0xf02de3){_0xd85b05['push'](_[_0x5e8f('0x4d')]({'channel':_0xf02de3,'type':'LOGIN','data1':_0x5e8f('0x4e'),'data2':_0x14aec5},_0x341969));if(_0x302ad8['loginInPause']){_0x13f9cb[_0x5e8f('0x4c')](_[_0x5e8f('0x4d')]({'channel':_0xf02de3,'type':_0x5e8f('0x26'),'data1':_0x5e8f('0x4f')},_0x341969));}});return db['MemberReport']['bulkCreate'](_0xd85b05[_0x5e8f('0x50')](_0x13f9cb),{'individualHooks':!![]});}})[_0x5e8f('0x14')](function(){if(_0x302ad8){return _0x302ad8[_0x5e8f('0x22')]({'online':!![],'lastLoginAt':moment()[_0x5e8f('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x302ad8[_0x5e8f('0x51')]||![],'mailPause':_0x302ad8[_0x5e8f('0x51')]||![],'chatPause':_0x302ad8[_0x5e8f('0x51')]||![],'faxPause':_0x302ad8['loginInPause']||![],'smsPause':_0x302ad8[_0x5e8f('0x51')]||![],'openchannelPause':_0x302ad8[_0x5e8f('0x51')]||![],'pauseType':_0x302ad8['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d')),'interface':_0x14aec5});}})[_0x5e8f('0x14')](function(_0x2222bb){_0x6bdc67(_0x2222bb);})[_0x5e8f('0x18')](function(_0x275f1a){_0x24fefb(_0x3ccd1a[_0x5e8f('0x1a')](0x1f4,_0x275f1a[_0x5e8f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 40c71ac..82abf46 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 _0x9fab=['update','./user.events','save','remove'];(function(_0x370752,_0x114958){var _0x1daba3=function(_0x288503){while(--_0x288503){_0x370752['push'](_0x370752['shift']());}};_0x1daba3(++_0x114958);}(_0x9fab,0x135));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0xb9fa('0x0'));var events=[_0xb9fa('0x1'),_0xb9fa('0x2'),_0xb9fa('0x3')];function createListener(_0x918be7,_0xfb36a0){return function(_0x23be09){_0xfb36a0['emit'](_0x918be7,_0x23be09);};}function removeListener(_0x20937b,_0xd0b37c){return function(){UserEvents['removeListener'](_0x20937b,_0xd0b37c);};}exports['register']=function(_0x470271){for(var _0xe2a7a=0x0,_0x271ee5=events['length'];_0xe2a7a<_0x271ee5;_0xe2a7a++){var _0x153378=events[_0xe2a7a];var _0x46d93a=createListener('user:'+_0x153378,_0x470271);UserEvents['on'](_0x153378,_0x46d93a);}}; \ No newline at end of file +var _0x8c1b=['remove','emit','register','length','save'];(function(_0x50cf87,_0x4b5587){var _0x14f02e=function(_0x8f350b){while(--_0x8f350b){_0x50cf87['push'](_0x50cf87['shift']());}};_0x14f02e(++_0x4b5587);}(_0x8c1b,0xae));var _0xb8c1=function(_0x699b7e,_0x6132d9){_0x699b7e=_0x699b7e-0x0;var _0x7ac59f=_0x8c1b[_0x699b7e];return _0x7ac59f;};'use strict';var UserEvents=require('./user.events');var events=[_0xb8c1('0x0'),_0xb8c1('0x1'),'update'];function createListener(_0x154164,_0x17e97d){return function(_0x1c830a){_0x17e97d[_0xb8c1('0x2')](_0x154164,_0x1c830a);};}function removeListener(_0x5e111c,_0x13340a){return function(){UserEvents['removeListener'](_0x5e111c,_0x13340a);};}exports[_0xb8c1('0x3')]=function(_0x2972b5){for(var _0x329104=0x0,_0x4845ed=events[_0xb8c1('0x4')];_0x329104<_0x4845ed;_0x329104++){var _0x6d16d4=events[_0x329104];var _0x45bc17=createListener('user:'+_0x6d16d4,_0x2972b5);UserEvents['on'](_0x6d16d4,_0x45bc17);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a9dcf2a..6e66c58 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1da66d,_0x53e0da){var _0xfa4180=function(_0x4fa2b9){while(--_0x4fa2b9){_0x1da66d['push'](_0x1da66d['shift']());}};_0xfa4180(++_0x53e0da);}(_0x70e0,0x17b));var _0x070e=function(_0x4111fd,_0xc0597c){_0x4111fd=_0x4111fd-0x0;var _0x332f21=_0x70e0[_0x4111fd];return _0x332f21;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a1877,_0x1cd405){var _0x353b31=function(_0x376b9d){while(--_0x376b9d){_0x2a1877['push'](_0x2a1877['shift']());}};_0x353b31(++_0x1cd405);}(_0xe706,0xa3));var _0x6e70=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xe706[_0x3132e8];return _0x43eb8c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3ff4a02..b7fd398 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 _0x20c9=['sequelize','exports','INTEGER'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x20c9,0x108));var _0x920c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x20c9[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x920c('0x0'));module[_0x920c('0x1')]={'penalty':{'type':Sequelize[_0x920c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc99a=['INTEGER','sequelize'];(function(_0x43b969,_0x4e0845){var _0xfb392c=function(_0x5259ee){while(--_0x5259ee){_0x43b969['push'](_0x43b969['shift']());}};_0xfb392c(++_0x4e0845);}(_0xc99a,0xef));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xac99('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 0c1e577..561ca3c 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 _0x9276=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x8cb31b,_0x509016){var _0x2ce32e=function(_0x1e6f4a){while(--_0x1e6f4a){_0x8cb31b['push'](_0x8cb31b['shift']());}};_0x2ce32e(++_0x509016);}(_0x9276,0x199));var _0x6927=function(_0x454979,_0x1efab1){_0x454979=_0x454979-0x0;var _0x22e7cf=_0x9276[_0x454979];return _0x22e7cf;};'use strict';var _=require('lodash');var util=require(_0x6927('0x0'));var logger=require(_0x6927('0x1'))(_0x6927('0x2'));var moment=require(_0x6927('0x3'));var BPromise=require(_0x6927('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6927('0x5'));var rimraf=require(_0x6927('0x6'));var config=require(_0x6927('0x7'));var attributes=require(_0x6927('0x8'));module[_0x6927('0x9')]=function(_0x5c7050,_0x2cc6c2){return _0x5c7050[_0x6927('0xa')](_0x6927('0xb'),attributes,{'tableName':_0x6927('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb73a=['exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x295204,_0x2104c0){var _0x45c97f=function(_0x22f0f8){while(--_0x22f0f8){_0x295204['push'](_0x295204['shift']());}};_0x45c97f(++_0x2104c0);}(_0xb73a,0x1ee));var _0xab73=function(_0x411cfc,_0x1a1488){_0x411cfc=_0x411cfc-0x0;var _0x5c83af=_0xb73a[_0x411cfc];return _0x5c83af;};'use strict';var _=require(_0xab73('0x0'));var util=require('util');var logger=require(_0xab73('0x1'))(_0xab73('0x2'));var moment=require(_0xab73('0x3'));var BPromise=require(_0xab73('0x4'));var rp=require(_0xab73('0x5'));var fs=require('fs');var path=require(_0xab73('0x6'));var rimraf=require(_0xab73('0x7'));var config=require(_0xab73('0x8'));var attributes=require(_0xab73('0x9'));module[_0xab73('0xa')]=function(_0x76c0aa,_0x8b5ec9){return _0x76c0aa[_0xab73('0xb')](_0xab73('0xc'),attributes,{'tableName':_0xab73('0xd'),'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 ab505ac..0dc5019 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 _0xe4bc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment'];(function(_0x33f926,_0xaac7e5){var _0x207955=function(_0x6d0b8a){while(--_0x6d0b8a){_0x33f926['push'](_0x33f926['shift']());}};_0x207955(++_0xaac7e5);}(_0xe4bc,0x167));var _0xce4b=function(_0xc1fcb4,_0x14f85f){_0xc1fcb4=_0xc1fcb4-0x0;var _0x165912=_0xe4bc[_0xc1fcb4];return _0x165912;};'use strict';var _=require('lodash');var util=require(_0xce4b('0x0'));var moment=require(_0xce4b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce4b('0x2'));var fs=require('fs');var Redis=require(_0xce4b('0x3'));var db=require(_0xce4b('0x4'))['db'];var utils=require(_0xce4b('0x5'));var logger=require(_0xce4b('0x6'))(_0xce4b('0x7'));var config=require('../../config/environment');var jayson=require(_0xce4b('0x8'));var client=jayson[_0xce4b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a2be,_0x52a509,_0x5f39e0){return new BPromise(function(_0xaf4b9d,_0x3edc04){return client[_0xce4b('0xa')](_0x41a2be,_0x5f39e0)[_0xce4b('0xb')](function(_0x1bcea1){logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,_0xce4b('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x52a509,_0xce4b('0xe'),JSON[_0xce4b('0xf')](_0x1bcea1));if(_0x1bcea1[_0xce4b('0x10')]){if(_0x1bcea1[_0xce4b('0x10')]['code']===0x1f4){logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0x3edc04(_0x1bcea1['error']['message']);}logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0xaf4b9d(_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);}else{logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,'request\x20sent');_0xaf4b9d(_0x1bcea1[_0xce4b('0x12')][_0xce4b('0x11')]);}})['catch'](function(_0x4af71a){logger[_0xce4b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x52a509,_0x4af71a);_0x3edc04(_0x4af71a);});});} \ No newline at end of file +var _0xedc3=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','lodash','util','moment'];(function(_0xe3803e,_0x37e9ce){var _0x312c82=function(_0xc129ff){while(--_0xc129ff){_0xe3803e['push'](_0xe3803e['shift']());}};_0x312c82(++_0x37e9ce);}(_0xedc3,0x14d));var _0x3edc=function(_0x5029f6,_0x118108){_0x5029f6=_0x5029f6-0x0;var _0xb1b7e1=_0xedc3[_0x5029f6];return _0xb1b7e1;};'use strict';var _=require(_0x3edc('0x0'));var util=require(_0x3edc('0x1'));var moment=require(_0x3edc('0x2'));var BPromise=require(_0x3edc('0x3'));var rs=require(_0x3edc('0x4'));var fs=require('fs');var Redis=require(_0x3edc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3edc('0x6'));var config=require(_0x3edc('0x7'));var jayson=require(_0x3edc('0x8'));var client=jayson[_0x3edc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1acf85,_0x27ca11,_0x4f4c13){return new BPromise(function(_0x20ef53,_0x47e0cb){return client[_0x3edc('0xa')](_0x1acf85,_0x4f4c13)[_0x3edc('0xb')](function(_0x147c94){logger[_0x3edc('0xc')](_0x3edc('0xd'),_0x27ca11,'request\x20sent');logger[_0x3edc('0xe')](_0x3edc('0xf'),_0x27ca11,_0x3edc('0x10'),JSON['stringify'](_0x147c94));if(_0x147c94['error']){if(_0x147c94['error'][_0x3edc('0x11')]===0x1f4){logger[_0x3edc('0x12')](_0x3edc('0xd'),_0x27ca11,_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);return _0x47e0cb(_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);}logger['error'](_0x3edc('0xd'),_0x27ca11,_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);return _0x20ef53(_0x147c94['error'][_0x3edc('0x13')]);}else{logger[_0x3edc('0xc')](_0x3edc('0xd'),_0x27ca11,_0x3edc('0x10'));_0x20ef53(_0x147c94[_0x3edc('0x14')][_0x3edc('0x13')]);}})['catch'](function(_0x39225b){logger[_0x3edc('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x27ca11,_0x39225b);_0x47e0cb(_0x39225b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7d94439..bce26a2 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x416a0a,_0x24f91f){var _0x574c9f=function(_0x44b83e){while(--_0x44b83e){_0x416a0a['push'](_0x416a0a['shift']());}};_0x574c9f(++_0x24f91f);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x9b9c46,_0x3997a8){var _0x47ee52=function(_0x1b382f){while(--_0x1b382f){_0x9b9c46['push'](_0x9b9c46['shift']());}};_0x47ee52(++_0x3997a8);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6c99b8d..bca4027 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 _0x207f=['STRING','sequelize','exports','INTEGER'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x207f,0x1cd));var _0xf207=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x207f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf207('0x0'));module[_0xf207('0x1')]={'penalty':{'type':Sequelize[_0xf207('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf207('0x3')]}}; \ No newline at end of file +var _0xb4fc=['STRING','sequelize','INTEGER'];(function(_0x80d5e8,_0x3be93c){var _0x3e8164=function(_0x138cf2){while(--_0x138cf2){_0x80d5e8['push'](_0x80d5e8['shift']());}};_0x3e8164(++_0x3be93c);}(_0xb4fc,0xeb));var _0xcb4f=function(_0x22656e,_0x1163dc){_0x22656e=_0x22656e-0x0;var _0x3e4255=_0xb4fc[_0x22656e];return _0x3e4255;};'use strict';var Sequelize=require(_0xcb4f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcb4f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcb4f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9abd285..67fffb5 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 _0xb3a6=['path','rimraf','../../config/environment','define','UserFaxQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x49b6e2,_0x4770b4){var _0x5ca1ec=function(_0x4d2a28){while(--_0x4d2a28){_0x49b6e2['push'](_0x49b6e2['shift']());}};_0x5ca1ec(++_0x4770b4);}(_0xb3a6,0x15a));var _0x6b3a=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xb3a6[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0x6b3a('0x0'));var util=require(_0x6b3a('0x1'));var logger=require('../../config/logger')(_0x6b3a('0x2'));var moment=require(_0x6b3a('0x3'));var BPromise=require(_0x6b3a('0x4'));var rp=require(_0x6b3a('0x5'));var fs=require('fs');var path=require(_0x6b3a('0x6'));var rimraf=require(_0x6b3a('0x7'));var config=require(_0x6b3a('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x40ad58,_0x1be1d9){return _0x40ad58[_0x6b3a('0x9')](_0x6b3a('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b24=['../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b24,0x65));var _0x41b2=function(_0x4bc7b0,_0x461027){_0x4bc7b0=_0x4bc7b0-0x0;var _0xb35921=_0x1b24[_0x4bc7b0];return _0xb35921;};'use strict';var _=require(_0x41b2('0x0'));var util=require(_0x41b2('0x1'));var logger=require(_0x41b2('0x2'))('api');var moment=require(_0x41b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x41b2('0x4'));var fs=require('fs');var path=require(_0x41b2('0x5'));var rimraf=require(_0x41b2('0x6'));var config=require(_0x41b2('0x7'));var attributes=require(_0x41b2('0x8'));module[_0x41b2('0x9')]=function(_0x4fb821,_0x373f8b){return _0x4fb821['define'](_0x41b2('0xa'),attributes,{'tableName':_0x41b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0da23aa..c148722 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 _0x58fc=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x58fc,0xd3));var _0xc58f=function(_0x552bae,_0x16eda1){_0x552bae=_0x552bae-0x0;var _0x147c59=_0x58fc[_0x552bae];return _0x147c59;};'use strict';var _=require('lodash');var util=require(_0xc58f('0x0'));var moment=require(_0xc58f('0x1'));var BPromise=require(_0xc58f('0x2'));var rs=require(_0xc58f('0x3'));var fs=require('fs');var Redis=require(_0xc58f('0x4'));var db=require(_0xc58f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc58f('0x6'));var config=require(_0xc58f('0x7'));var jayson=require(_0xc58f('0x8'));var client=jayson[_0xc58f('0x9')][_0xc58f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5579f5,_0x518ed6,_0x54913f){return new BPromise(function(_0x4f37bf,_0x510885){return client[_0xc58f('0xb')](_0x5579f5,_0x54913f)[_0xc58f('0xc')](function(_0x245005){logger[_0xc58f('0xd')](_0xc58f('0xe'),_0x518ed6,_0xc58f('0xf'));logger['debug'](_0xc58f('0x10'),_0x518ed6,'request\x20sent',JSON[_0xc58f('0x11')](_0x245005));if(_0x245005['error']){if(_0x245005[_0xc58f('0x12')][_0xc58f('0x13')]===0x1f4){logger[_0xc58f('0x12')](_0xc58f('0xe'),_0x518ed6,_0x245005[_0xc58f('0x12')]['message']);return _0x510885(_0x245005[_0xc58f('0x12')]['message']);}logger[_0xc58f('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x518ed6,_0x245005[_0xc58f('0x12')][_0xc58f('0x14')]);return _0x4f37bf(_0x245005[_0xc58f('0x12')][_0xc58f('0x14')]);}else{logger['info'](_0xc58f('0xe'),_0x518ed6,_0xc58f('0xf'));_0x4f37bf(_0x245005[_0xc58f('0x15')][_0xc58f('0x14')]);}})['catch'](function(_0x52b7cd){logger[_0xc58f('0x12')](_0xc58f('0xe'),_0x518ed6,_0x52b7cd);_0x510885(_0x52b7cd);});});} \ No newline at end of file +var _0xe607=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','util','moment','randomstring','../../mysqldb'];(function(_0x1a2dce,_0x39f042){var _0x5d3e1f=function(_0x1c3e12){while(--_0x1c3e12){_0x1a2dce['push'](_0x1a2dce['shift']());}};_0x5d3e1f(++_0x39f042);}(_0xe607,0x6e));var _0x7e60=function(_0xbcbe17,_0x37fb59){_0xbcbe17=_0xbcbe17-0x0;var _0x15ddec=_0xe607[_0xbcbe17];return _0x15ddec;};'use strict';var _=require('lodash');var util=require(_0x7e60('0x0'));var moment=require(_0x7e60('0x1'));var BPromise=require('bluebird');var rs=require(_0x7e60('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e60('0x3'))['db'];var utils=require(_0x7e60('0x4'));var logger=require(_0x7e60('0x5'))(_0x7e60('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e60('0x7'));var client=jayson[_0x7e60('0x8')][_0x7e60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482fc8,_0x238eda,_0x5c45cd){return new BPromise(function(_0x3b8a07,_0x8c89a3){return client['request'](_0x482fc8,_0x5c45cd)['then'](function(_0x4164e1){logger['info'](_0x7e60('0xa'),_0x238eda,'request\x20sent');logger[_0x7e60('0xb')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x238eda,'request\x20sent',JSON[_0x7e60('0xc')](_0x4164e1));if(_0x4164e1['error']){if(_0x4164e1[_0x7e60('0xd')][_0x7e60('0xe')]===0x1f4){logger[_0x7e60('0xd')](_0x7e60('0xa'),_0x238eda,_0x4164e1[_0x7e60('0xd')]['message']);return _0x8c89a3(_0x4164e1[_0x7e60('0xd')]['message']);}logger[_0x7e60('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x238eda,_0x4164e1[_0x7e60('0xd')]['message']);return _0x3b8a07(_0x4164e1[_0x7e60('0xd')]['message']);}else{logger['info'](_0x7e60('0xa'),_0x238eda,_0x7e60('0xf'));_0x3b8a07(_0x4164e1[_0x7e60('0x10')][_0x7e60('0x11')]);}})[_0x7e60('0x12')](function(_0x32de8f){logger['error'](_0x7e60('0xa'),_0x238eda,_0x32de8f);_0x8c89a3(_0x32de8f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d5aea52..8b2c52a 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f3cca,_0x3e232f){var _0x3105c7=function(_0x584e67){while(--_0x584e67){_0x2f3cca['push'](_0x2f3cca['shift']());}};_0x3105c7(++_0x3e232f);}(_0x70e0,0x17b));var _0x070e=function(_0x536838,_0x49a7d7){_0x536838=_0x536838-0x0;var _0x4e0ca7=_0x70e0[_0x536838];return _0x4e0ca7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15120c,_0x2a51b7){var _0x434b36=function(_0x39e6fe){while(--_0x39e6fe){_0x15120c['push'](_0x15120c['shift']());}};_0x434b36(++_0x2a51b7);}(_0xe706,0xa3));var _0x6e70=function(_0x2a97f7,_0x465e0c){_0x2a97f7=_0x2a97f7-0x0;var _0x13c258=_0xe706[_0x2a97f7];return _0x13c258;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 41a15eb..8e910ad 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 _0xd709=['exports','INTEGER','sequelize'];(function(_0x330997,_0x33302c){var _0x43eb92=function(_0x823e6f){while(--_0x823e6f){_0x330997['push'](_0x330997['shift']());}};_0x43eb92(++_0x33302c);}(_0xd709,0x7d));var _0x9d70=function(_0x5b0e13,_0x51ff8c){_0x5b0e13=_0x5b0e13-0x0;var _0x9258c8=_0xd709[_0x5b0e13];return _0x9258c8;};'use strict';var Sequelize=require(_0x9d70('0x0'));module[_0x9d70('0x1')]={'penalty':{'type':Sequelize[_0x9d70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdcde=['INTEGER'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xdcde,0x8b));var _0xedcd=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xdcde[_0x27c068];return _0xe5a67f;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xedcd('0x0')],'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 9ea84b1..415e6ee 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 _0x8909=['./userMailQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12e8d5,_0x4be36a){var _0xf7964e=function(_0x33bf66){while(--_0x33bf66){_0x12e8d5['push'](_0x12e8d5['shift']());}};_0xf7964e(++_0x4be36a);}(_0x8909,0x12f));var _0x9890=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x8909[_0xe84805];return _0x398efd;};'use strict';var _=require(_0x9890('0x0'));var util=require(_0x9890('0x1'));var logger=require(_0x9890('0x2'))(_0x9890('0x3'));var moment=require(_0x9890('0x4'));var BPromise=require(_0x9890('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9890('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9890('0x7'));module[_0x9890('0x8')]=function(_0x157c15,_0x4c2f63){return _0x157c15[_0x9890('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae19=['lodash','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xae19,0x197));var _0x9ae1=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0xae19[_0x3fc5d8];return _0x25307a;};'use strict';var _=require(_0x9ae1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ae1('0x1'));var moment=require(_0x9ae1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9ae1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ae1('0x4'));var config=require(_0x9ae1('0x5'));var attributes=require(_0x9ae1('0x6'));module[_0x9ae1('0x7')]=function(_0x3c1f75,_0x2e26c9){return _0x3c1f75[_0x9ae1('0x8')](_0x9ae1('0x9'),attributes,{'tableName':_0x9ae1('0xa'),'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 f8e986c..2314d87 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x57f7bd,_0x438e81){var _0x7f7a5a=function(_0x1abe55){while(--_0x1abe55){_0x57f7bd['push'](_0x57f7bd['shift']());}};_0x7f7a5a(++_0x438e81);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1672ea,_0x41a05b){var _0x291d86=function(_0x4ec4e3){while(--_0x4ec4e3){_0x1672ea['push'](_0x1672ea['shift']());}};_0x291d86(++_0x41a05b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x214c5b,_0x15a8e8){_0x214c5b=_0x214c5b-0x0;var _0x78494c=_0x8ef6[_0x214c5b];return _0x78494c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c4b3ac7..6b8d002 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3877=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3877,0x16e));var _0x7387=function(_0x391935,_0x3fb9aa){_0x391935=_0x391935-0x0;var _0x6cf66e=_0x3877[_0x391935];return _0x6cf66e;};'use strict';var multer=require(_0x7387('0x0'));var util=require('util');var path=require(_0x7387('0x1'));var timeout=require(_0x7387('0x2'));var express=require('express');var router=express[_0x7387('0x3')]();var fs_extra=require(_0x7387('0x4'));var auth=require(_0x7387('0x5'));var interaction=require(_0x7387('0x6'));var config=require(_0x7387('0x7'));var controller=require(_0x7387('0x8'));router[_0x7387('0x9')]('/',auth[_0x7387('0xa')](),controller[_0x7387('0xb')]);module['exports']=router; \ No newline at end of file +var _0x1a65=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','path','express','Router','fs-extra'];(function(_0x328b99,_0x530d72){var _0x48510c=function(_0x15d7f8){while(--_0x15d7f8){_0x328b99['push'](_0x328b99['shift']());}};_0x48510c(++_0x530d72);}(_0x1a65,0x1c3));var _0x51a6=function(_0x3290ea,_0x22dfba){_0x3290ea=_0x3290ea-0x0;var _0x3234d9=_0x1a65[_0x3290ea];return _0x3234d9;};'use strict';var multer=require(_0x51a6('0x0'));var util=require('util');var path=require(_0x51a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x51a6('0x2'));var router=express[_0x51a6('0x3')]();var fs_extra=require(_0x51a6('0x4'));var auth=require(_0x51a6('0x5'));var interaction=require(_0x51a6('0x6'));var config=require(_0x51a6('0x7'));var controller=require(_0x51a6('0x8'));router[_0x51a6('0x9')]('/',auth['isAuthenticated'](),controller[_0x51a6('0xa')]);module[_0x51a6('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 4185e3f..884d9a4 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c79=['BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c79,0x105));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x97c7('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x97c7('0x1')]}}; \ No newline at end of file +var _0xcec9=['exports','STRING','BOOLEAN','sequelize'];(function(_0x159abc,_0x1cdcc5){var _0x16e742=function(_0x3e53c6){while(--_0x3e53c6){_0x159abc['push'](_0x159abc['shift']());}};_0x16e742(++_0x1cdcc5);}(_0xcec9,0x153));var _0x9cec=function(_0x4cccb7,_0x528880){_0x4cccb7=_0x4cccb7-0x0;var _0x8fa7f6=_0xcec9[_0x4cccb7];return _0x8fa7f6;};'use strict';var Sequelize=require(_0x9cec('0x0'));module[_0x9cec('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x9cec('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x9cec('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index aa7d5b5..fdd40c2 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe21b=['squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','render','html','view','startCase','model','ids','includes','queue','replace','Queue','push','union','flatten','getAgents','map','zip-dir','request-promise','mustache','util','to-csv','ejs','lodash'];(function(_0x36ff4e,_0x4de0c1){var _0x1eef88=function(_0x448924){while(--_0x448924){_0x36ff4e['push'](_0x36ff4e['shift']());}};_0x1eef88(++_0x4de0c1);}(_0xe21b,0x1d4));var _0xbe21=function(_0x682838,_0x1fcfd9){_0x682838=_0x682838-0x0;var _0x5a3c45=_0xe21b[_0x682838];return _0x5a3c45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbe21('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe21('0x2'));var util=require(_0xbe21('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xbe21('0x4'));var ejs=require(_0xbe21('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe21('0x6'));var squel=require(_0xbe21('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe21('0x8'));var toCsv=require(_0xbe21('0x4'));var querystring=require(_0xbe21('0x9'));var Papa=require('papaparse');var Redis=require(_0xbe21('0xa'));var authService=require(_0xbe21('0xb'));var qs=require(_0xbe21('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe21('0xd'));var utils=require(_0xbe21('0xe'));var config=require(_0xbe21('0xf'));var licenseUtil=require(_0xbe21('0x10'));var db=require(_0xbe21('0x11'))['db'];config[_0xbe21('0x12')]=_[_0xbe21('0x13')](config[_0xbe21('0x12')],{'host':_0xbe21('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe21('0x12')]));require(_0xbe21('0x15'))[_0xbe21('0x16')](socket);function respondWithStatusCode(_0x4dc425,_0x4f9670){_0x4f9670=_0x4f9670||0xcc;return function(_0x1da72a){if(_0x1da72a){return _0x4dc425['sendStatus'](_0x4f9670);}return _0x4dc425[_0xbe21('0x17')](_0x4f9670)[_0xbe21('0x18')]();};}function respondWithResult(_0x223863,_0x5059bf){_0x5059bf=_0x5059bf||0xc8;return function(_0x2ce420){if(_0x2ce420){return _0x223863[_0xbe21('0x17')](_0x5059bf)[_0xbe21('0x19')](_0x2ce420);}};}function respondWithFilteredResult(_0x516424,_0x3d2661){return function(_0xf53683){if(_0xf53683){var _0x58867e=typeof _0x3d2661[_0xbe21('0x1a')]===_0xbe21('0x1b')&&typeof _0x3d2661[_0xbe21('0x1c')]==='undefined';var _0x29d376=_0xf53683[_0xbe21('0x1d')];var _0x56c30c=_0x58867e?0x0:_0x3d2661[_0xbe21('0x1a')];var _0x42c041=_0x58867e?_0xf53683[_0xbe21('0x1d')]:_0x3d2661[_0xbe21('0x1a')]+_0x3d2661[_0xbe21('0x1c')];var _0x293156;if(_0x42c041>=_0x29d376){_0x42c041=_0x29d376;_0x293156=0xc8;}else{_0x293156=0xce;}_0x516424[_0xbe21('0x17')](_0x293156);return _0x516424[_0xbe21('0x1e')](_0xbe21('0x1f'),_0x56c30c+'-'+_0x42c041+'/'+_0x29d376)[_0xbe21('0x19')](_0xf53683);}return null;};}function patchUpdates(_0xe4e787){return function(_0x566eea){try{jsonpatch['apply'](_0x566eea,_0xe4e787,!![]);}catch(_0x3ccaa9){return BPromise[_0xbe21('0x20')](_0x3ccaa9);}return _0x566eea[_0xbe21('0x21')]();};}function saveUpdates(_0x2655a8,_0x1f2b56){return function(_0x3ebd4f){if(_0x3ebd4f){return _0x3ebd4f[_0xbe21('0x22')](_0x2655a8)[_0xbe21('0x23')](function(_0x4d1f20){return _0x4d1f20;});}return null;};}function removeEntity(_0x40ca66,_0x54e15c){return function(_0x287a3c){if(_0x287a3c){return _0x287a3c['destroy']()[_0xbe21('0x23')](function(){_0x40ca66[_0xbe21('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2675,_0x449495){return function(_0x582ce6){if(!_0x582ce6){_0x1e2675['sendStatus'](0x194);}return _0x582ce6;};}function handleError(_0x46cd34,_0x3d0127){_0x3d0127=_0x3d0127||0x1f4;return function(_0x6dd57b){logger[_0xbe21('0x24')](_0x6dd57b[_0xbe21('0x25')]);if(_0x6dd57b[_0xbe21('0x26')]){delete _0x6dd57b[_0xbe21('0x26')];}_0x46cd34[_0xbe21('0x17')](_0x3d0127)['send'](_0x6dd57b);};}exports[_0xbe21('0x27')]=function(_0x18f39a,_0x50f762,_0x440b0d){if(!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x2a'))&&!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x2b'))){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x2e'));}else{if(_0x18f39a[_0xbe21('0x28')]['hasOwnProperty']('TemplateId')&&!_0x18f39a['body'][_0xbe21('0x29')]('view')){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x2f'));}if(!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x30'))){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x31'));}else{try{var _0x32f350=JSON['parse'](_0x18f39a[_0xbe21('0x28')][_0xbe21('0x30')]);}catch(_0x27f931){logger['error'](_0x27f931);throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x32'));}var _0x454550=[_0xbe21('0x33'),_0xbe21('0x34'),_0xbe21('0x35'),'openchannelqueue',_0xbe21('0x36'),_0xbe21('0x37'),_0xbe21('0x38'),_0xbe21('0x39'),'user'];if(_[_0xbe21('0x3a')](_0x32f350,function(_0x1c13fe){return!_['includes'](_0x454550,_0x1c13fe['model'][_0xbe21('0x3b')]());})){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x3c'));}}}var _0x5f168a={};_0x5f168a[_0xbe21('0x3d')]=_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')]('senderName')?_0x18f39a[_0xbe21('0x28')][_0xbe21('0x3d')]:_0x18f39a[_0xbe21('0x3e')][_0xbe21('0x3f')];_0x5f168a[_0xbe21('0x40')]=_['isEmpty'](_0x18f39a['body'][_0xbe21('0x40')])?null:_0x18f39a[_0xbe21('0x28')]['recipientsDescription'];_0x5f168a[_0xbe21('0x41')]=_0x18f39a[_0xbe21('0x28')][_0xbe21('0x41')]||![];_0x5f168a[_0xbe21('0x42')]=_0x18f39a['user']['id'];return getContent(_0x18f39a[_0xbe21('0x28')])[_0xbe21('0x23')](function(_0x295cd6){_0x5f168a[_0xbe21('0x28')]=_0x295cd6;return getRecipients(_0x32f350);})[_0xbe21('0x23')](function(_0x16676a){_0x5f168a[_0xbe21('0x43')]=_[_0xbe21('0x44')](_0x16676a)[_0xbe21('0x45')](',');return db[_0xbe21('0x46')][_0xbe21('0x47')](function(_0x1f9471){return db[_0xbe21('0x48')]['create'](_0x5f168a,{'raw':!![],'transaction':_0x1f9471})[_0xbe21('0x23')](function(_0x59f724){var _0x1be4f9={'sender':_0x5f168a[_0xbe21('0x3d')],'description':_0x5f168a[_0xbe21('0x40')],'content':_0x5f168a['body'],'beep':_0x5f168a[_0xbe21('0x41')]};_0x16676a[_0xbe21('0x49')](function(_0x398eb9){_0x1be4f9[_0xbe21('0x4a')]=_0x398eb9;socket[_0xbe21('0x4b')](_0xbe21('0x4c'),_0x1be4f9);});return _0x59f724;});});})[_0xbe21('0x23')](respondWithResult(_0x50f762,0xc9))[_0xbe21('0x4d')](handleError(_0x50f762,null));};function getContent(_0x215889){return new BPromise(function(_0xd1e1c8,_0x21e199){if(_0x215889['text']){_0xd1e1c8(_0x215889['text']);return;}return db[_0xbe21('0x4e')][_0xbe21('0x4f')]({'attributes':['html'],'where':{'id':_0x215889[_0xbe21('0x2b')]},'raw':!![]})['then'](function(_0x23b0c2){if(!_0x23b0c2)throw new db['Sequelize'][(_0xbe21('0x2d'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2d80c4=Mustache[_0xbe21('0x50')](_0x23b0c2[_0xbe21('0x51')],_0x215889[_0xbe21('0x52')]);_0xd1e1c8(_0x2d80c4);})['catch'](function(_0x148423){_0x21e199(_0x148423);});});}function getRecipients(_0x797422){return new BPromise(function(_0x2043d8,_0x425ad9){var _0x3a8af3=[];var _0x4c6875=[];_0x797422[_0xbe21('0x49')](function(_0x57f8cb){var _0x46769f=_[_0xbe21('0x53')](_0x57f8cb[_0xbe21('0x54')]['toLowerCase']());if(_0x46769f==='User'){_0x3a8af3=_['union'](_0x3a8af3,_0x57f8cb[_0xbe21('0x55')]);}else{if(_[_0xbe21('0x56')](_0x46769f,_0xbe21('0x57')))_0x46769f=_0x46769f[_0xbe21('0x58')]('queue',_0xbe21('0x59'));_0x57f8cb[_0xbe21('0x55')][_0xbe21('0x49')](function(_0x305a0f){_0x4c6875[_0xbe21('0x5a')](getAgents(_0x46769f,_0x305a0f));});}});return BPromise['all'](_0x4c6875)[_0xbe21('0x23')](function(_0x4bafc0){_0x3a8af3=_[_0xbe21('0x5b')](_0x3a8af3,_[_0xbe21('0x5c')](_0x4bafc0));_0x2043d8(_0x3a8af3);})[_0xbe21('0x4d')](function(_0x4804c4){_0x425ad9(_0x4804c4);});});}function getAgents(_0x6149ef,_0x3223e3){return new BPromise(function(_0x5a9df9,_0x1b5ef1){return db[_0x6149ef][_0xbe21('0x4f')]({'where':{'id':_0x3223e3}})[_0xbe21('0x23')](function(_0xbfef4c){return _0xbfef4c[_0xbe21('0x5d')]({'attributes':['id'],'raw':!![]})[_0xbe21('0x23')](function(_0x122df3){var _0x3050ee=_[_0xbe21('0x5e')](_0x122df3,'id');_0x5a9df9(_0x3050ee);});})[_0xbe21('0x4d')](function(_0x1c19b2){_0x1b5ef1(_0x1c19b2);});});} \ No newline at end of file +var _0x0d7d=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','emit','userNotification:send','Template'];(function(_0x9035b9,_0x4eec8d){var _0x508b2b=function(_0x66dec9){while(--_0x66dec9){_0x9035b9['push'](_0x9035b9['shift']());}};_0x508b2b(++_0x4eec8d);}(_0x0d7d,0x142));var _0xd0d7=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x0d7d[_0x469fc4];return _0x11f6d4;};'use strict';var emlformat=require(_0xd0d7('0x0'));var rimraf=require(_0xd0d7('0x1'));var zipdir=require(_0xd0d7('0x2'));var jsonpatch=require(_0xd0d7('0x3'));var rp=require(_0xd0d7('0x4'));var moment=require(_0xd0d7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0d7('0x6'));var path=require('path');var sox=require(_0xd0d7('0x7'));var csv=require(_0xd0d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0d7('0x9'));var _=require(_0xd0d7('0xa'));var squel=require('squel');var crypto=require(_0xd0d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd0d7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0d7('0xd'));var Papa=require(_0xd0d7('0xe'));var Redis=require(_0xd0d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd0d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0d7('0x11'))(_0xd0d7('0x12'));var utils=require(_0xd0d7('0x13'));var config=require(_0xd0d7('0x14'));var licenseUtil=require(_0xd0d7('0x15'));var db=require(_0xd0d7('0x16'))['db'];config[_0xd0d7('0x17')]=_[_0xd0d7('0x18')](config[_0xd0d7('0x17')],{'host':_0xd0d7('0x19'),'port':0x18eb});var socket=require(_0xd0d7('0x1a'))(new Redis(config[_0xd0d7('0x17')]));require(_0xd0d7('0x1b'))[_0xd0d7('0x1c')](socket);function respondWithStatusCode(_0x26ae3f,_0x1fb0db){_0x1fb0db=_0x1fb0db||0xcc;return function(_0x1ed5c8){if(_0x1ed5c8){return _0x26ae3f[_0xd0d7('0x1d')](_0x1fb0db);}return _0x26ae3f[_0xd0d7('0x1e')](_0x1fb0db)[_0xd0d7('0x1f')]();};}function respondWithResult(_0x348342,_0x4fc518){_0x4fc518=_0x4fc518||0xc8;return function(_0x2919f5){if(_0x2919f5){return _0x348342['status'](_0x4fc518)[_0xd0d7('0x20')](_0x2919f5);}};}function respondWithFilteredResult(_0x586922,_0x30c905){return function(_0x2c72bb){if(_0x2c72bb){var _0x368b63=typeof _0x30c905[_0xd0d7('0x21')]==='undefined'&&typeof _0x30c905[_0xd0d7('0x22')]===_0xd0d7('0x23');var _0x2b4a60=_0x2c72bb['count'];var _0x101ac4=_0x368b63?0x0:_0x30c905[_0xd0d7('0x21')];var _0x5a1c12=_0x368b63?_0x2c72bb[_0xd0d7('0x24')]:_0x30c905[_0xd0d7('0x21')]+_0x30c905['limit'];var _0x4b4829;if(_0x5a1c12>=_0x2b4a60){_0x5a1c12=_0x2b4a60;_0x4b4829=0xc8;}else{_0x4b4829=0xce;}_0x586922['status'](_0x4b4829);return _0x586922[_0xd0d7('0x25')](_0xd0d7('0x26'),_0x101ac4+'-'+_0x5a1c12+'/'+_0x2b4a60)[_0xd0d7('0x20')](_0x2c72bb);}return null;};}function patchUpdates(_0x15e4ea){return function(_0x12b24a){try{jsonpatch[_0xd0d7('0x27')](_0x12b24a,_0x15e4ea,!![]);}catch(_0x51bf22){return BPromise[_0xd0d7('0x28')](_0x51bf22);}return _0x12b24a['save']();};}function saveUpdates(_0x49a62b,_0x207d15){return function(_0x5b57a6){if(_0x5b57a6){return _0x5b57a6['update'](_0x49a62b)[_0xd0d7('0x29')](function(_0x17e2bf){return _0x17e2bf;});}return null;};}function removeEntity(_0x16b46b,_0x24e21e){return function(_0x5423ab){if(_0x5423ab){return _0x5423ab[_0xd0d7('0x2a')]()[_0xd0d7('0x29')](function(){_0x16b46b[_0xd0d7('0x1e')](0xcc)[_0xd0d7('0x1f')]();});}};}function handleEntityNotFound(_0x31f02d,_0x1cbf04){return function(_0x28a345){if(!_0x28a345){_0x31f02d[_0xd0d7('0x1d')](0x194);}return _0x28a345;};}function handleError(_0x2c8e36,_0x59bbfa){_0x59bbfa=_0x59bbfa||0x1f4;return function(_0x1875c3){logger[_0xd0d7('0x2b')](_0x1875c3['stack']);if(_0x1875c3[_0xd0d7('0x2c')]){delete _0x1875c3[_0xd0d7('0x2c')];}_0x2c8e36[_0xd0d7('0x1e')](_0x59bbfa)[_0xd0d7('0x2d')](_0x1875c3);};}exports[_0xd0d7('0x2e')]=function(_0x2aa2e6,_0x5cdbfd,_0x25d6f6){if(!_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x31'))&&!_0x2aa2e6['body']['hasOwnProperty'](_0xd0d7('0x32'))){throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x32'))&&!_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')]('view')){throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x35'));}if(!_0x2aa2e6['body'][_0xd0d7('0x30')](_0xd0d7('0x36'))){throw new db['Sequelize'][(_0xd0d7('0x34'))](_0xd0d7('0x37'));}else{try{var _0x1ad177=JSON['parse'](_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x36')]);}catch(_0x2f486f){logger['error'](_0x2f486f);throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x38'));}var _0x451cc9=[_0xd0d7('0x39'),_0xd0d7('0x3a'),_0xd0d7('0x3b'),'openchannelqueue',_0xd0d7('0x3c'),_0xd0d7('0x3d'),_0xd0d7('0x3e'),_0xd0d7('0x3f'),_0xd0d7('0x40')];if(_[_0xd0d7('0x41')](_0x1ad177,function(_0x522a28){return!_[_0xd0d7('0x42')](_0x451cc9,_0x522a28[_0xd0d7('0x43')][_0xd0d7('0x44')]());})){throw new db['Sequelize'][(_0xd0d7('0x34'))](_0xd0d7('0x45'));}}}var _0x5ee0b7={};_0x5ee0b7[_0xd0d7('0x46')]=_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x46'))?_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x46')]:_0x2aa2e6[_0xd0d7('0x40')]['fullname'];_0x5ee0b7[_0xd0d7('0x47')]=_['isEmpty'](_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x47')])?null:_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x47')];_0x5ee0b7[_0xd0d7('0x48')]=_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x48')]||![];_0x5ee0b7[_0xd0d7('0x49')]=_0x2aa2e6[_0xd0d7('0x40')]['id'];return getContent(_0x2aa2e6[_0xd0d7('0x2f')])[_0xd0d7('0x29')](function(_0x2aa7e0){_0x5ee0b7[_0xd0d7('0x2f')]=_0x2aa7e0;return getRecipients(_0x1ad177);})[_0xd0d7('0x29')](function(_0x55cf8b){_0x5ee0b7[_0xd0d7('0x4a')]=_[_0xd0d7('0x4b')](_0x55cf8b)[_0xd0d7('0x4c')](',');return db['sequelize']['transaction'](function(_0x395bfa){return db[_0xd0d7('0x4d')][_0xd0d7('0x4e')](_0x5ee0b7,{'raw':!![],'transaction':_0x395bfa})[_0xd0d7('0x29')](function(_0x4a05b1){var _0x579ef3={'sender':_0x5ee0b7[_0xd0d7('0x46')],'description':_0x5ee0b7[_0xd0d7('0x47')],'content':_0x5ee0b7[_0xd0d7('0x2f')],'beep':_0x5ee0b7[_0xd0d7('0x48')]};_0x55cf8b['forEach'](function(_0x4a84f4){_0x579ef3['recipient']=_0x4a84f4;socket[_0xd0d7('0x4f')](_0xd0d7('0x50'),_0x579ef3);});return _0x4a05b1;});});})['then'](respondWithResult(_0x5cdbfd,0xc9))['catch'](handleError(_0x5cdbfd,null));};function getContent(_0x3ca539){return new BPromise(function(_0x5b3632,_0x35b8ed){if(_0x3ca539['text']){_0x5b3632(_0x3ca539[_0xd0d7('0x31')]);return;}return db[_0xd0d7('0x51')][_0xd0d7('0x52')]({'attributes':[_0xd0d7('0x53')],'where':{'id':_0x3ca539[_0xd0d7('0x32')]},'raw':!![]})[_0xd0d7('0x29')](function(_0x4716eb){if(!_0x4716eb)throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x54'));var _0x52db36=Mustache[_0xd0d7('0x55')](_0x4716eb[_0xd0d7('0x53')],_0x3ca539[_0xd0d7('0x56')]);_0x5b3632(_0x52db36);})['catch'](function(_0x141cfc){_0x35b8ed(_0x141cfc);});});}function getRecipients(_0x167e9a){return new BPromise(function(_0x7a53c4,_0x2854f0){var _0xe71389=[];var _0x33d110=[];_0x167e9a[_0xd0d7('0x57')](function(_0xbd23eb){var _0xde5eda=_[_0xd0d7('0x58')](_0xbd23eb['model'][_0xd0d7('0x44')]());if(_0xde5eda===_0xd0d7('0x59')){_0xe71389=_[_0xd0d7('0x5a')](_0xe71389,_0xbd23eb[_0xd0d7('0x5b')]);}else{if(_[_0xd0d7('0x42')](_0xde5eda,_0xd0d7('0x5c')))_0xde5eda=_0xde5eda[_0xd0d7('0x5d')](_0xd0d7('0x5c'),_0xd0d7('0x5e'));_0xbd23eb[_0xd0d7('0x5b')][_0xd0d7('0x57')](function(_0x5a3909){_0x33d110[_0xd0d7('0x5f')](getAgents(_0xde5eda,_0x5a3909));});}});return BPromise[_0xd0d7('0x60')](_0x33d110)[_0xd0d7('0x29')](function(_0x4a2f9f){_0xe71389=_[_0xd0d7('0x5a')](_0xe71389,_[_0xd0d7('0x61')](_0x4a2f9f));_0x7a53c4(_0xe71389);})[_0xd0d7('0x62')](function(_0x40bd58){_0x2854f0(_0x40bd58);});});}function getAgents(_0x43818a,_0x5879c9){return new BPromise(function(_0x188a20,_0x5671bd){return db[_0x43818a][_0xd0d7('0x52')]({'where':{'id':_0x5879c9}})[_0xd0d7('0x29')](function(_0x438d1b){return _0x438d1b[_0xd0d7('0x63')]({'attributes':['id'],'raw':!![]})[_0xd0d7('0x29')](function(_0x1b3311){var _0x42c140=_[_0xd0d7('0x64')](_0x1b3311,'id');_0x188a20(_0x42c140);});})[_0xd0d7('0x62')](function(_0x502b25){_0x5671bd(_0x502b25);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e0f8a9f..72dd85f 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6792=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification'];(function(_0x32b769,_0x12d997){var _0x28a9b5=function(_0x1bc161){while(--_0x1bc161){_0x32b769['push'](_0x32b769['shift']());}};_0x28a9b5(++_0x12d997);}(_0x6792,0x18d));var _0x2679=function(_0xe51925,_0x513834){_0xe51925=_0xe51925-0x0;var _0x36d4da=_0x6792[_0xe51925];return _0x36d4da;};'use strict';var EventEmitter=require(_0x2679('0x0'));var UserNotification=require(_0x2679('0x1'))['db'][_0x2679('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2679('0x3'),'afterUpdate':_0x2679('0x4'),'afterDestroy':'remove'};function emitEvent(_0x517865){return function(_0x2df9c5,_0x1ece6a,_0x45e22a){UserNotificationEvents['emit'](_0x517865+':'+_0x2df9c5['id'],_0x2df9c5);UserNotificationEvents[_0x2679('0x5')](_0x517865,_0x2df9c5);_0x45e22a(null);};}for(var e in events){if(events[_0x2679('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2679('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xc749=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc749,0x1dc));var _0x9c74=function(_0x422619,_0x21e505){_0x422619=_0x422619-0x0;var _0x16d6f3=_0xc749[_0x422619];return _0x16d6f3;};'use strict';var EventEmitter=require(_0x9c74('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9c74('0x1')](0x0);var events={'afterCreate':_0x9c74('0x2'),'afterUpdate':'update','afterDestroy':_0x9c74('0x3')};function emitEvent(_0x13c7b0){return function(_0x4c6317,_0x34f6e5,_0x5396ab){UserNotificationEvents[_0x9c74('0x4')](_0x13c7b0+':'+_0x4c6317['id'],_0x4c6317);UserNotificationEvents[_0x9c74('0x4')](_0x13c7b0,_0x4c6317);_0x5396ab(null);};}for(var e in events){if(events[_0x9c74('0x5')](e)){var event=events[e];UserNotification[_0x9c74('0x6')](e,emitEvent(event));}}module[_0x9c74('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 50a01df..fa80176 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7b3=['path','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43b77b,_0x42f79a){var _0x47cd20=function(_0x384006){while(--_0x384006){_0x43b77b['push'](_0x43b77b['shift']());}};_0x47cd20(++_0x42f79a);}(_0xb7b3,0x124));var _0x3b7b=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0xb7b3[_0x33bb07];return _0x481c81;};'use strict';var _=require(_0x3b7b('0x0'));var util=require(_0x3b7b('0x1'));var logger=require(_0x3b7b('0x2'))(_0x3b7b('0x3'));var moment=require(_0x3b7b('0x4'));var BPromise=require(_0x3b7b('0x5'));var rp=require(_0x3b7b('0x6'));var fs=require('fs');var path=require(_0x3b7b('0x7'));var rimraf=require('rimraf');var config=require(_0x3b7b('0x8'));var attributes=require(_0x3b7b('0x9'));module[_0x3b7b('0xa')]=function(_0x8c6f99,_0x13064d){return _0x8c6f99['define'](_0x3b7b('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b7b('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ab5=['UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3b09c4,_0x3c44ba){var _0x486ebc=function(_0x50763a){while(--_0x50763a){_0x3b09c4['push'](_0x3b09c4['shift']());}};_0x486ebc(++_0x3c44ba);}(_0x8ab5,0x1b5));var _0x58ab=function(_0x43670c,_0x105812){_0x43670c=_0x43670c-0x0;var _0x3b099e=_0x8ab5[_0x43670c];return _0x3b099e;};'use strict';var _=require(_0x58ab('0x0'));var util=require(_0x58ab('0x1'));var logger=require(_0x58ab('0x2'))(_0x58ab('0x3'));var moment=require(_0x58ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x58ab('0x5'));var fs=require('fs');var path=require(_0x58ab('0x6'));var rimraf=require(_0x58ab('0x7'));var config=require(_0x58ab('0x8'));var attributes=require('./userNotification.attributes');module[_0x58ab('0x9')]=function(_0x187c70,_0x361177){return _0x187c70[_0x58ab('0xa')](_0x58ab('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ab('0xc'),'collate':_0x58ab('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 00c0919..dd60cd4 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c5b=['http','defaults','redis','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1e96c0,_0xf1df02){var _0x257b7=function(_0x1d4b4c){while(--_0x1d4b4c){_0x1e96c0['push'](_0x1e96c0['shift']());}};_0x257b7(++_0xf1df02);}(_0x4c5b,0x94));var _0xb4c5=function(_0x4796ff,_0xbfa800){_0x4796ff=_0x4796ff-0x0;var _0x1d53e9=_0x4c5b[_0x4796ff];return _0x1d53e9;};'use strict';var _=require(_0xb4c5('0x0'));var util=require('util');var moment=require(_0xb4c5('0x1'));var BPromise=require('bluebird');var rs=require(_0xb4c5('0x2'));var fs=require('fs');var Redis=require(_0xb4c5('0x3'));var db=require(_0xb4c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4c5('0x5'));var config=require(_0xb4c5('0x6'));var jayson=require(_0xb4c5('0x7'));var client=jayson['client'][_0xb4c5('0x8')]({'port':0x232a});config['redis']=_[_0xb4c5('0x9')](config[_0xb4c5('0xa')],{'host':_0xb4c5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb4c5('0xc'))[_0xb4c5('0xd')](socket);function respondWithRpcPromise(_0xbe3199,_0x47d68d,_0x490973){return new BPromise(function(_0x36ade6,_0x15735b){return client[_0xb4c5('0xe')](_0xbe3199,_0x490973)[_0xb4c5('0xf')](function(_0x1ec40a){logger[_0xb4c5('0x10')](_0xb4c5('0x11'),_0x47d68d,_0xb4c5('0x12'));logger[_0xb4c5('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x47d68d,'request\x20sent',JSON[_0xb4c5('0x14')](_0x1ec40a));if(_0x1ec40a['error']){if(_0x1ec40a[_0xb4c5('0x15')][_0xb4c5('0x16')]===0x1f4){logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x1ec40a[_0xb4c5('0x15')]['message']);return _0x15735b(_0x1ec40a['error'][_0xb4c5('0x17')]);}logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x1ec40a[_0xb4c5('0x15')][_0xb4c5('0x17')]);return _0x36ade6(_0x1ec40a[_0xb4c5('0x15')]['message']);}else{logger[_0xb4c5('0x10')](_0xb4c5('0x11'),_0x47d68d,_0xb4c5('0x12'));_0x36ade6(_0x1ec40a[_0xb4c5('0x18')][_0xb4c5('0x17')]);}})[_0xb4c5('0x19')](function(_0x26b63d){logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x26b63d);_0x15735b(_0x26b63d);});});} \ No newline at end of file +var _0x705a=['request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x705a,0x1df));var _0xa705=function(_0x46bcee,_0x3c8eb8){_0x46bcee=_0x46bcee-0x0;var _0x1c74e2=_0x705a[_0x46bcee];return _0x1c74e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa705('0x0'));var BPromise=require('bluebird');var rs=require(_0xa705('0x1'));var fs=require('fs');var Redis=require(_0xa705('0x2'));var db=require(_0xa705('0x3'))['db'];var utils=require(_0xa705('0x4'));var logger=require(_0xa705('0x5'))(_0xa705('0x6'));var config=require(_0xa705('0x7'));var jayson=require(_0xa705('0x8'));var client=jayson[_0xa705('0x9')][_0xa705('0xa')]({'port':0x232a});config[_0xa705('0xb')]=_[_0xa705('0xc')](config[_0xa705('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa705('0xd'))[_0xa705('0xe')](socket);function respondWithRpcPromise(_0xd0607e,_0x34d256,_0x540c52){return new BPromise(function(_0x57806a,_0x1c86e6){return client[_0xa705('0xf')](_0xd0607e,_0x540c52)['then'](function(_0xc4eecd){logger[_0xa705('0x10')]('UserNotification,\x20%s,\x20%s',_0x34d256,_0xa705('0x11'));logger[_0xa705('0x12')](_0xa705('0x13'),_0x34d256,'request\x20sent',JSON[_0xa705('0x14')](_0xc4eecd));if(_0xc4eecd['error']){if(_0xc4eecd[_0xa705('0x15')][_0xa705('0x16')]===0x1f4){logger[_0xa705('0x15')](_0xa705('0x17'),_0x34d256,_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);return _0x1c86e6(_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);}logger['error'](_0xa705('0x17'),_0x34d256,_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);return _0x57806a(_0xc4eecd['error']['message']);}else{logger[_0xa705('0x10')](_0xa705('0x17'),_0x34d256,_0xa705('0x11'));_0x57806a(_0xc4eecd['result']['message']);}})[_0xa705('0x19')](function(_0x1d3007){logger[_0xa705('0x15')]('UserNotification,\x20%s,\x20%s',_0x34d256,_0x1d3007);_0x1c86e6(_0x1d3007);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index fd073ba..8fdd7fd 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb977=['emit','register','length','userNotification:','save','update'];(function(_0x1362d6,_0x4621e9){var _0x339025=function(_0x2eb481){while(--_0x2eb481){_0x1362d6['push'](_0x1362d6['shift']());}};_0x339025(++_0x4621e9);}(_0xb977,0xe2));var _0x7b97=function(_0x3fc75e,_0x39efb9){_0x3fc75e=_0x3fc75e-0x0;var _0x13e53e=_0xb977[_0x3fc75e];return _0x13e53e;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x7b97('0x0'),'remove',_0x7b97('0x1')];function createListener(_0x342d3a,_0x21514){return function(_0x4f4342){_0x21514[_0x7b97('0x2')](_0x342d3a,_0x4f4342);};}function removeListener(_0x5dcb5d,_0x4927ff){return function(){UserNotificationEvents['removeListener'](_0x5dcb5d,_0x4927ff);};}exports[_0x7b97('0x3')]=function(_0x4d8ede){for(var _0x30ba4f=0x0,_0x120a40=events[_0x7b97('0x4')];_0x30ba4f<_0x120a40;_0x30ba4f++){var _0x124c54=events[_0x30ba4f];var _0x555fb2=createListener(_0x7b97('0x5')+_0x124c54,_0x4d8ede);UserNotificationEvents['on'](_0x124c54,_0x555fb2);}}; \ No newline at end of file +var _0x4dce=['./userNotification.events','save','update','emit','removeListener','length','userNotification:'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x4dce,0xc4));var _0xe4dc=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0x4dce[_0x3253f3];return _0x598c26;};'use strict';var UserNotificationEvents=require(_0xe4dc('0x0'));var events=[_0xe4dc('0x1'),'remove',_0xe4dc('0x2')];function createListener(_0x808cdd,_0x13fc96){return function(_0x420c18){_0x13fc96[_0xe4dc('0x3')](_0x808cdd,_0x420c18);};}function removeListener(_0x243293,_0x249772){return function(){UserNotificationEvents[_0xe4dc('0x4')](_0x243293,_0x249772);};}exports['register']=function(_0x3fc81b){for(var _0x259506=0x0,_0x19f93b=events[_0xe4dc('0x5')];_0x259506<_0x19f93b;_0x259506++){var _0x18c18c=events[_0x259506];var _0x5bea82=createListener(_0xe4dc('0x6')+_0x18c18c,_0x3fc81b);UserNotificationEvents['on'](_0x18c18c,_0x5bea82);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 206553e..6de6837 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3eee77,_0x2a76a7){var _0x1b75e9=function(_0x5b9af1){while(--_0x5b9af1){_0x3eee77['push'](_0x3eee77['shift']());}};_0x1b75e9(++_0x2a76a7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xcb91[_0x11ce46];return _0x368a1e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x536c66,_0x570b6b){var _0x221d57=function(_0x34af51){while(--_0x34af51){_0x536c66['push'](_0x536c66['shift']());}};_0x221d57(++_0x570b6b);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c2ec72c..d31a2b5 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 _0x6037=['sequelize','exports'];(function(_0x37e0e4,_0x21837f){var _0x37e1f7=function(_0x1dadc7){while(--_0x1dadc7){_0x37e0e4['push'](_0x37e0e4['shift']());}};_0x37e1f7(++_0x21837f);}(_0x6037,0xc0));var _0x7603=function(_0x47e1a5,_0x3dc785){_0x47e1a5=_0x47e1a5-0x0;var _0x3c838c=_0x6037[_0x47e1a5];return _0x3c838c;};'use strict';var Sequelize=require(_0x7603('0x0'));module[_0x7603('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ca2=['exports','INTEGER'];(function(_0x165789,_0x51d9e1){var _0x29fac7=function(_0x45cd7f){while(--_0x45cd7f){_0x165789['push'](_0x165789['shift']());}};_0x29fac7(++_0x51d9e1);}(_0x6ca2,0xc8));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x26ca('0x0')]={'penalty':{'type':Sequelize[_0x26ca('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 b43bcae..cbf9dc0 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 _0x7ebc=['../../config/environment','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x125bc6,_0x5d2604){var _0x5de25a=function(_0x42c253){while(--_0x42c253){_0x125bc6['push'](_0x125bc6['shift']());}};_0x5de25a(++_0x5d2604);}(_0x7ebc,0x72));var _0xc7eb=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7ebc[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xc7eb('0x0'));var util=require(_0xc7eb('0x1'));var logger=require(_0xc7eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc7eb('0x3'));var rp=require(_0xc7eb('0x4'));var fs=require('fs');var path=require(_0xc7eb('0x5'));var rimraf=require(_0xc7eb('0x6'));var config=require(_0xc7eb('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc7eb('0x8')]=function(_0x40aa57,_0x28f2e9){return _0x40aa57[_0xc7eb('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xc7eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb328=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','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);}(_0xb328,0x91));var _0x8b32=function(_0x4a4178,_0x546619){_0x4a4178=_0x4a4178-0x0;var _0x51eccd=_0xb328[_0x4a4178];return _0x51eccd;};'use strict';var _=require(_0x8b32('0x0'));var util=require(_0x8b32('0x1'));var logger=require(_0x8b32('0x2'))(_0x8b32('0x3'));var moment=require(_0x8b32('0x4'));var BPromise=require(_0x8b32('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b32('0x6'));var rimraf=require(_0x8b32('0x7'));var config=require(_0x8b32('0x8'));var attributes=require(_0x8b32('0x9'));module[_0x8b32('0xa')]=function(_0x21e31a,_0x594ba1){return _0x21e31a[_0x8b32('0xb')](_0x8b32('0xc'),attributes,{'tableName':_0x8b32('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index f11ee4d..78290b2 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 _0xa806=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa806,0x69));var _0x6a80=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xa806[_0x531e48];return _0x202971;};'use strict';var _=require('lodash');var util=require(_0x6a80('0x0'));var moment=require(_0x6a80('0x1'));var BPromise=require(_0x6a80('0x2'));var rs=require(_0x6a80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a80('0x4'))['db'];var utils=require(_0x6a80('0x5'));var logger=require(_0x6a80('0x6'))(_0x6a80('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a80('0x8'));var client=jayson[_0x6a80('0x9')][_0x6a80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21edf8,_0x9ebf49,_0xdcddc8){return new BPromise(function(_0x41232f,_0x16eac8){return client[_0x6a80('0xb')](_0x21edf8,_0xdcddc8)[_0x6a80('0xc')](function(_0x272c9a){logger[_0x6a80('0xd')](_0x6a80('0xe'),_0x9ebf49,_0x6a80('0xf'));logger[_0x6a80('0x10')](_0x6a80('0x11'),_0x9ebf49,'request\x20sent',JSON[_0x6a80('0x12')](_0x272c9a));if(_0x272c9a[_0x6a80('0x13')]){if(_0x272c9a['error'][_0x6a80('0x14')]===0x1f4){logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x16eac8(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x41232f(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}else{logger[_0x6a80('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x9ebf49,_0x6a80('0xf'));_0x41232f(_0x272c9a['result'][_0x6a80('0x15')]);}})[_0x6a80('0x16')](function(_0x439d98){logger['error'](_0x6a80('0xe'),_0x9ebf49,_0x439d98);_0x16eac8(_0x439d98);});});} \ No newline at end of file +var _0x5561=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5561,0x9d));var _0x1556=function(_0x3e34a3,_0x1072ea){_0x3e34a3=_0x3e34a3-0x0;var _0x301f7e=_0x5561[_0x3e34a3];return _0x301f7e;};'use strict';var _=require(_0x1556('0x0'));var util=require(_0x1556('0x1'));var moment=require('moment');var BPromise=require(_0x1556('0x2'));var rs=require(_0x1556('0x3'));var fs=require('fs');var Redis=require(_0x1556('0x4'));var db=require(_0x1556('0x5'))['db'];var utils=require(_0x1556('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1556('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1556('0x8')][_0x1556('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf375a8,_0x34cc19,_0x1ebd53){return new BPromise(function(_0xfa385c,_0x6b6fff){return client[_0x1556('0xa')](_0xf375a8,_0x1ebd53)[_0x1556('0xb')](function(_0x34c89c){logger[_0x1556('0xc')](_0x1556('0xd'),_0x34cc19,_0x1556('0xe'));logger[_0x1556('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x34cc19,_0x1556('0xe'),JSON[_0x1556('0x10')](_0x34c89c));if(_0x34c89c[_0x1556('0x11')]){if(_0x34c89c[_0x1556('0x11')][_0x1556('0x12')]===0x1f4){logger[_0x1556('0x11')](_0x1556('0xd'),_0x34cc19,_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);return _0x6b6fff(_0x34c89c['error'][_0x1556('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x34cc19,_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);return _0xfa385c(_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);}else{logger[_0x1556('0xc')](_0x1556('0xd'),_0x34cc19,_0x1556('0xe'));_0xfa385c(_0x34c89c[_0x1556('0x14')]['message']);}})[_0x1556('0x15')](function(_0x5764d4){logger[_0x1556('0x11')](_0x1556('0xd'),_0x34cc19,_0x5764d4);_0x6b6fff(_0x5764d4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 26061a4..40fc27e 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 _0xfce5=['create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post'];(function(_0xc74312,_0x3d8ef0){var _0x3a9838=function(_0x49cfac){while(--_0x49cfac){_0xc74312['push'](_0xc74312['shift']());}};_0x3a9838(++_0x3d8ef0);}(_0xfce5,0x1ad));var _0x5fce=function(_0x36aad0,_0x3d2e17){_0x36aad0=_0x36aad0-0x0;var _0x31e987=_0xfce5[_0x36aad0];return _0x31e987;};'use strict';var multer=require(_0x5fce('0x0'));var util=require('util');var path=require(_0x5fce('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fce('0x2'));var router=express['Router']();var fs_extra=require(_0x5fce('0x3'));var auth=require(_0x5fce('0x4'));var interaction=require(_0x5fce('0x5'));var config=require(_0x5fce('0x6'));var controller=require(_0x5fce('0x7'));router[_0x5fce('0x8')]('/',auth[_0x5fce('0x9')](),controller[_0x5fce('0xa')]);router[_0x5fce('0x8')](_0x5fce('0xb'),auth['isAuthenticated'](),controller[_0x5fce('0xc')]);router[_0x5fce('0x8')](_0x5fce('0xd'),auth[_0x5fce('0x9')](),controller[_0x5fce('0xe')]);router[_0x5fce('0x8')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x10')]);router[_0x5fce('0x8')]('/:id/resources',auth[_0x5fce('0x9')](),controller[_0x5fce('0x11')]);router[_0x5fce('0x12')]('/',auth[_0x5fce('0x9')](),controller[_0x5fce('0x13')]);router[_0x5fce('0x12')](_0x5fce('0x14'),auth['isAuthenticated'](),controller[_0x5fce('0x15')]);router[_0x5fce('0x12')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x16')]);router['post']('/:id/resources',auth[_0x5fce('0x9')](),controller[_0x5fce('0x17')]);router[_0x5fce('0x18')](_0x5fce('0xd'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x19')]);router[_0x5fce('0x1a')](_0x5fce('0xd'),auth['isAuthenticated'](),controller[_0x5fce('0x1b')]);router[_0x5fce('0x1a')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x1c')]);router[_0x5fce('0x1a')](_0x5fce('0x1d'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x1e')]);module[_0x5fce('0x1f')]=router; \ No newline at end of file +var _0xa9b7=['show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','destroy','removeSections','removeResources','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9b7,0x147));var _0x7a9b=function(_0x2e8bd8,_0x181160){_0x2e8bd8=_0x2e8bd8-0x0;var _0x43fb04=_0xa9b7[_0x2e8bd8];return _0x43fb04;};'use strict';var multer=require(_0x7a9b('0x0'));var util=require(_0x7a9b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7a9b('0x2'));var interaction=require(_0x7a9b('0x3'));var config=require(_0x7a9b('0x4'));var controller=require(_0x7a9b('0x5'));router[_0x7a9b('0x6')]('/',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x8')]);router['get']('/describe',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x9')]);router[_0x7a9b('0x6')](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0xb')]);router['get'](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller['getSections']);router['get'](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0xe')]);router[_0x7a9b('0xf')]('/',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x10')]);router['post'](_0x7a9b('0x11'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x12')]);router[_0x7a9b('0xf')](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x13')]);router[_0x7a9b('0xf')](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller['addResources']);router['put'](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x14')]);router[_0x7a9b('0x15')](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x16')]);router[_0x7a9b('0x15')](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x17')]);router['delete'](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x18')]);module[_0x7a9b('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6f3ca93..321c64a 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 _0xdb7e=['split','BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0xdb7e,0x1ba));var _0xedb7=function(_0x4c1ce3,_0xe97ff6){_0x4c1ce3=_0x4c1ce3-0x0;var _0x106692=_0xdb7e[_0x4c1ce3];return _0x106692;};'use strict';var Sequelize=require('sequelize');module[_0xedb7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xedb7('0x1')},'crudPermissions':{'type':Sequelize[_0xedb7('0x2')],'set':function(_0x1c7e4b){this[_0xedb7('0x3')](_0xedb7('0x4'),_0x1c7e4b?_0x1c7e4b['join'](''):[]);},'get':function(){return this[_0xedb7('0x5')](_0xedb7('0x4'))?this['getDataValue']('crudPermissions')[_0xedb7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xedb7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x61ae=['join','getDataValue','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x17f268,_0xfc2d5a){var _0x160510=function(_0x3c6f31){while(--_0x3c6f31){_0x17f268['push'](_0x17f268['shift']());}};_0x160510(++_0xfc2d5a);}(_0x61ae,0x14b));var _0xe61a=function(_0x38b1fe,_0x53aedb){_0x38b1fe=_0x38b1fe-0x0;var _0x1b3f86=_0x61ae[_0x38b1fe];return _0x1b3f86;};'use strict';var Sequelize=require(_0xe61a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe61a('0x1')],'allowNull':![],'unique':_0xe61a('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4560cb){this[_0xe61a('0x3')](_0xe61a('0x4'),_0x4560cb?_0x4560cb[_0xe61a('0x5')](''):[]);},'get':function(){return this[_0xe61a('0x6')](_0xe61a('0x4'))?this[_0xe61a('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d8689e1..6073649 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 _0x311a=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','order','sort','where','pick','filter','VIRTUAL','merge','UserProfile','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','clone','get','omit','createdAt','crudPermissions','updatedAt','sequelize','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','transaction','push','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x252295,_0x4bc665){var _0x27f24e=function(_0x513615){while(--_0x513615){_0x252295['push'](_0x252295['shift']());}};_0x27f24e(++_0x4bc665);}(_0x311a,0x6e));var _0xa311=function(_0x58a3c0,_0x4bdb75){_0x58a3c0=_0x58a3c0-0x0;var _0x49bf1f=_0x311a[_0x58a3c0];return _0x49bf1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa311('0x0'));var zipdir=require(_0xa311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa311('0x2'));var BPromise=require(_0xa311('0x3'));var Mustache=require(_0xa311('0x4'));var util=require(_0xa311('0x5'));var path=require(_0xa311('0x6'));var sox=require(_0xa311('0x7'));var csv=require(_0xa311('0x8'));var ejs=require(_0xa311('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa311('0xa'));var squel=require(_0xa311('0xb'));var crypto=require(_0xa311('0xc'));var jsforce=require(_0xa311('0xd'));var deskjs=require(_0xa311('0xe'));var toCsv=require(_0xa311('0x8'));var querystring=require('querystring');var Papa=require(_0xa311('0xf'));var Redis=require(_0xa311('0x10'));var authService=require(_0xa311('0x11'));var qs=require(_0xa311('0x12'));var as=require(_0xa311('0x13'));var hardwareService=require(_0xa311('0x14'));var logger=require(_0xa311('0x15'))('api');var utils=require(_0xa311('0x16'));var config=require(_0xa311('0x17'));var licenseUtil=require(_0xa311('0x18'));var db=require(_0xa311('0x19'))['db'];config[_0xa311('0x1a')]=_[_0xa311('0x1b')](config['redis'],{'host':_0xa311('0x1c'),'port':0x18eb});var socket=require(_0xa311('0x1d'))(new Redis(config['redis']));require('./userProfile.socket')[_0xa311('0x1e')](socket);function respondWithStatusCode(_0x3d0f8f,_0x4b0975){_0x4b0975=_0x4b0975||0xcc;return function(_0x46a758){if(_0x46a758){return _0x3d0f8f['sendStatus'](_0x4b0975);}return _0x3d0f8f[_0xa311('0x1f')](_0x4b0975)[_0xa311('0x20')]();};}function respondWithResult(_0x103985,_0x1d67c9){_0x1d67c9=_0x1d67c9||0xc8;return function(_0x4c9339){if(_0x4c9339){return _0x103985[_0xa311('0x1f')](_0x1d67c9)['json'](_0x4c9339);}};}function respondWithFilteredResult(_0x4efbbe,_0x42a219){return function(_0x427167){if(_0x427167){var _0xa1292=typeof _0x42a219[_0xa311('0x21')]==='undefined'&&typeof _0x42a219[_0xa311('0x22')]==='undefined';var _0x1239f6=_0x427167[_0xa311('0x23')];var _0xd1f116=_0xa1292?0x0:_0x42a219['offset'];var _0xdb9486=_0xa1292?_0x427167[_0xa311('0x23')]:_0x42a219[_0xa311('0x21')]+_0x42a219[_0xa311('0x22')];var _0x2900cd;if(_0xdb9486>=_0x1239f6){_0xdb9486=_0x1239f6;_0x2900cd=0xc8;}else{_0x2900cd=0xce;}_0x4efbbe[_0xa311('0x1f')](_0x2900cd);return _0x4efbbe[_0xa311('0x24')](_0xa311('0x25'),_0xd1f116+'-'+_0xdb9486+'/'+_0x1239f6)[_0xa311('0x26')](_0x427167);}return null;};}function patchUpdates(_0x51ccb3){return function(_0x539c9c){try{jsonpatch[_0xa311('0x27')](_0x539c9c,_0x51ccb3,!![]);}catch(_0x2a3096){return BPromise[_0xa311('0x28')](_0x2a3096);}return _0x539c9c[_0xa311('0x29')]();};}function saveUpdates(_0x51b786,_0x51a13c){return function(_0x6d177){if(_0x6d177){return _0x6d177[_0xa311('0x2a')](_0x51b786)[_0xa311('0x2b')](function(_0x43d6f4){return _0x43d6f4;});}return null;};}function removeEntity(_0x564773,_0x10c704){return function(_0x13b0c5){if(_0x13b0c5){return _0x13b0c5['destroy']()[_0xa311('0x2b')](function(){_0x564773[_0xa311('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b033,_0x5cdf2a){return function(_0x1962a4){if(!_0x1962a4){_0x12b033[_0xa311('0x2c')](0x194);}return _0x1962a4;};}function handleError(_0x583748,_0x45c1e6){_0x45c1e6=_0x45c1e6||0x1f4;return function(_0x21556e){logger['error'](_0x21556e['stack']);if(_0x21556e['name']){delete _0x21556e[_0xa311('0x2d')];}_0x583748['status'](_0x45c1e6)[_0xa311('0x2e')](_0x21556e);};}exports[_0xa311('0x2f')]=function(_0x5a7422,_0x12daa4){var _0x1294d6={},_0x4dbda2={},_0x12fa42={'count':0x0,'rows':[]};var _0x22f6d9=_[_0xa311('0x30')](db['UserProfile'][_0xa311('0x31')],function(_0x3e0326){return{'name':_0x3e0326[_0xa311('0x32')],'type':_0x3e0326[_0xa311('0x33')]['key']};});_0x4dbda2['model']=_['map'](_0x22f6d9,_0xa311('0x2d'));_0x4dbda2['query']=_[_0xa311('0x34')](_0x5a7422['query']);_0x4dbda2[_0xa311('0x35')]=_[_0xa311('0x36')](_0x4dbda2[_0xa311('0x37')],_0x4dbda2['query']);_0x1294d6[_0xa311('0x38')]=_[_0xa311('0x36')](_0x4dbda2['model'],qs[_0xa311('0x39')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x39')]));_0x1294d6[_0xa311('0x38')]=_0x1294d6['attributes'][_0xa311('0x3b')]?_0x1294d6[_0xa311('0x38')]:_0x4dbda2[_0xa311('0x37')];if(!_0x5a7422[_0xa311('0x3a')]['hasOwnProperty']('nolimit')){_0x1294d6['limit']=qs['limit'](_0x5a7422[_0xa311('0x3a')][_0xa311('0x22')]);_0x1294d6['offset']=qs[_0xa311('0x21')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x21')]);}_0x1294d6[_0xa311('0x3c')]=qs[_0xa311('0x3d')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x3d')]);_0x1294d6[_0xa311('0x3e')]=qs[_0xa311('0x35')](_[_0xa311('0x3f')](_0x5a7422[_0xa311('0x3a')],_0x4dbda2[_0xa311('0x35')]),_0x22f6d9);if(_0x5a7422[_0xa311('0x3a')][_0xa311('0x40')]){_0x1294d6[_0xa311('0x3e')]=_['merge'](_0x1294d6[_0xa311('0x3e')],{'$or':_[_0xa311('0x30')](_0x22f6d9,function(_0x560823){if(_0x560823[_0xa311('0x33')]!==_0xa311('0x41')){var _0x2de197={};_0x2de197[_0x560823[_0xa311('0x2d')]]={'$like':'%'+_0x5a7422['query'][_0xa311('0x40')]+'%'};return _0x2de197;}})});}_0x1294d6=_[_0xa311('0x42')]({},_0x1294d6,_0x5a7422['options']);var _0x13c39a={'where':_0x1294d6[_0xa311('0x3e')]};return db[_0xa311('0x43')]['count'](_0x13c39a)[_0xa311('0x2b')](function(_0x557a04){_0x12fa42[_0xa311('0x23')]=_0x557a04;if(_0x5a7422[_0xa311('0x3a')][_0xa311('0x44')]){_0x1294d6['include']=[{'all':!![]}];}return db[_0xa311('0x43')][_0xa311('0x45')](_0x1294d6);})[_0xa311('0x2b')](function(_0x262d44){_0x12fa42[_0xa311('0x46')]=_0x262d44;return _0x12fa42;})['then'](respondWithFilteredResult(_0x12daa4,_0x1294d6))['catch'](handleError(_0x12daa4,null));};exports[_0xa311('0x47')]=function(_0x58564c,_0x1dbe97){var _0x39dddc={'raw':![],'where':{'id':_0x58564c[_0xa311('0x48')]['id']}},_0x3d81ae={};_0x3d81ae['model']=_[_0xa311('0x34')](db[_0xa311('0x43')][_0xa311('0x31')]);_0x3d81ae['query']=_[_0xa311('0x34')](_0x58564c[_0xa311('0x3a')]);_0x3d81ae[_0xa311('0x35')]=_[_0xa311('0x36')](_0x3d81ae[_0xa311('0x37')],_0x3d81ae[_0xa311('0x3a')]);_0x39dddc[_0xa311('0x38')]=_[_0xa311('0x36')](_0x3d81ae[_0xa311('0x37')],qs[_0xa311('0x39')](_0x58564c[_0xa311('0x3a')][_0xa311('0x39')]));_0x39dddc[_0xa311('0x38')]=_0x39dddc[_0xa311('0x38')][_0xa311('0x3b')]?_0x39dddc[_0xa311('0x38')]:_0x3d81ae[_0xa311('0x37')];if(_0x58564c['query'][_0xa311('0x44')]){_0x39dddc[_0xa311('0x49')]=[{'all':!![]}];}_0x39dddc=_[_0xa311('0x42')]({},_0x39dddc,_0x58564c[_0xa311('0x4a')]);return db[_0xa311('0x43')][_0xa311('0x4b')](_0x39dddc)[_0xa311('0x2b')](handleEntityNotFound(_0x1dbe97,null))['then'](respondWithResult(_0x1dbe97,null))[_0xa311('0x4c')](handleError(_0x1dbe97,null));};exports[_0xa311('0x4d')]=function(_0x2785c7,_0x55bc94){return db[_0xa311('0x43')]['create'](_0x2785c7[_0xa311('0x4e')],{})['then'](respondWithResult(_0x55bc94,0xc9))[_0xa311('0x4c')](handleError(_0x55bc94,null));};exports[_0xa311('0x4f')]=function(_0x53b15d,_0x5e89a2){var _0x525935={'where':{'id':_0x53b15d['params']['id']}},_0xd53a20={};_0xd53a20[_0xa311('0x37')]=_[_0xa311('0x34')](db[_0xa311('0x43')][_0xa311('0x31')]);_0x525935['attributes']=_[_0xa311('0x36')](_0xd53a20[_0xa311('0x37')],qs['fields'](_0x53b15d[_0xa311('0x3a')]['fields']));_0x525935[_0xa311('0x38')]=_0x525935['attributes']['length']?_0x525935['attributes']:_0xd53a20[_0xa311('0x37')];if(_0x53b15d[_0xa311('0x3a')]['includeAll']){_0x525935[_0xa311('0x49')]=[{'all':!![]}];}_0x525935=_[_0xa311('0x42')]({},_0x525935,_0x53b15d[_0xa311('0x4a')]);return db[_0xa311('0x43')][_0xa311('0x4b')](_0x525935)[_0xa311('0x2b')](handleEntityNotFound(_0x5e89a2,null))['then'](function(_0xb1a0fa){if(_0xb1a0fa){var _0x251090=_0xb1a0fa[_0xa311('0x50')]({'plain':!![]});_0x251090=qs[_0xa311('0x51')](_0x251090,['id',_0xa311('0x52'),'updatedAt',_0xa311('0x53')]);_0x53b15d[_0xa311('0x4e')]=_['omit'](_0x53b15d['body'],['id','createdAt',_0xa311('0x54')]);return db[_0xa311('0x55')]['transaction'](function(_0x439fcf){return db['UserProfile'][_0xa311('0x4d')](_[_0xa311('0x42')](_0x251090,_0x53b15d[_0xa311('0x4e')]),{'include':_0x53b15d[_0xa311('0x3a')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x439fcf})[_0xa311('0x2b')](function(_0x4dd80f){var _0x45e30a=_0x4dd80f[_0xa311('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xa311('0x45')]({'where':{'userProfileId':_0x53b15d['params']['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x385c2){if(_0x385c2){return BPromise[_0xa311('0x56')](_0x385c2,function(_0x3d8f91){return new BPromise(function(_0x5ad1ee,_0x84170d){if(_0x3d8f91['autoAssociation']===null||_0x3d8f91[_0xa311('0x57')]===0x1)_0x5ad1ee(null);return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0x3d8f91['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x44d3b7){var _0x568be6=_['map'](_0x44d3b7,function(_0x104956){return qs['omit'](_0x104956,['id','createdAt',_0xa311('0x54'),_0xa311('0x59')]);});_0x5ad1ee(_0x568be6);})['catch'](function(_0x5dbfcc){_0x84170d(_0x5dbfcc);});})[_0xa311('0x2b')](function(_0x4ca057){var _0x2dd27c=qs['omit'](_0x3d8f91,['id',_0xa311('0x52'),'updatedAt']);_0x2dd27c[_0xa311('0x5a')]=_0x45e30a['id'];if(_0x4ca057)_0x2dd27c[_0xa311('0x5b')]=_0x4ca057;return _0x2dd27c;})[_0xa311('0x2b')](function(_0x2568fd){return db[_0xa311('0x5c')][_0xa311('0x4d')](_0x2568fd,{'include':[{'model':db[_0xa311('0x58')],'as':_0xa311('0x5b')}],'raw':!![],'transaction':_0x439fcf});});})[_0xa311('0x2b')](function(){return _0x45e30a;});}});});});}})['then'](respondWithResult(_0x5e89a2,0xc9))[_0xa311('0x4c')](handleError(_0x5e89a2,null));};exports[_0xa311('0x2a')]=function(_0x5a6668,_0x3fec4e){if(_0x5a6668[_0xa311('0x4e')]['id']){delete _0x5a6668[_0xa311('0x4e')]['id'];}return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x5a6668[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x3fec4e,null))['then'](saveUpdates(_0x5a6668[_0xa311('0x4e')],null))[_0xa311('0x2b')](respondWithResult(_0x3fec4e,null))['catch'](handleError(_0x3fec4e,null));};exports[_0xa311('0x5d')]=function(_0x488a1f,_0x596f3b){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x488a1f[_0xa311('0x48')]['id']}})['then'](handleEntityNotFound(_0x596f3b,null))['then'](removeEntity(_0x596f3b,null))[_0xa311('0x4c')](handleError(_0x596f3b,null));};exports[_0xa311('0x5e')]=function(_0x24a7a0,_0x21c52b){return db[_0xa311('0x43')][_0xa311('0x5e')]()[_0xa311('0x2b')](respondWithResult(_0x21c52b,null))['catch'](handleError(_0x21c52b,null));};exports['addSections']=function(_0x54fe14,_0x2b9382){var _0x48a2c7=_0x54fe14[_0xa311('0x4e')];return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x54fe14[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x2b9382,null))[_0xa311('0x2b')](function(_0x5dc827){if(_0x5dc827){return db['sequelize'][_0xa311('0x5f')](function(_0x2ad5c9){return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x54fe14['params']['id'],'sectionId':_[_0xa311('0x30')](_0x48a2c7,function(_0xfc29e3){return _0xfc29e3[_0xa311('0x59')];})},'transaction':_0x2ad5c9})[_0xa311('0x2b')](function(){var _0x5354d6=_['map'](_0x48a2c7,function(_0x6953b){_0x6953b[_0xa311('0x5a')]=_0x54fe14[_0xa311('0x48')]['id'];return _0x6953b;});var _0x1b5406=[];return BPromise[_0xa311('0x56')](_0x5354d6,function(_0x476b5c){return db['UserProfileSection']['create'](_0x476b5c,{'include':[{'model':db[_0xa311('0x58')],'as':_0xa311('0x5b')}],'raw':!![],'transaction':_0x2ad5c9})[_0xa311('0x2b')](function(_0x2234fc){_0x1b5406[_0xa311('0x60')](_0x2234fc[_0xa311('0x50')]({'plain':!![]}));});})[_0xa311('0x2b')](function(){return _0x1b5406;});});});}})['then'](function(_0x510287){return _0x510287;})[_0xa311('0x2b')](respondWithResult(_0x2b9382,null))['catch'](handleError(_0x2b9382,null));};exports['removeSections']=function(_0x904dd5,_0x393235){var _0x1b279c;return db['UserProfile']['find']({'where':{'id':_0x904dd5[_0xa311('0x48')]['id']},'attributes':['id',_0xa311('0x2d')]})[_0xa311('0x2b')](handleEntityNotFound(_0x393235,null))['then'](function(_0x37ccd2){if(_0x37ccd2){_0x1b279c=_0x37ccd2;return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x904dd5[_0xa311('0x48')]['id'],'sectionId':_0x904dd5[_0xa311('0x3a')][_0xa311('0x61')]}});}})[_0xa311('0x2b')](function(){return _0x1b279c;})[_0xa311('0x2b')](respondWithStatusCode(_0x393235,null))[_0xa311('0x4c')](handleError(_0x393235,null));};exports[_0xa311('0x62')]=function(_0x5a885a,_0xc9f540){var _0x497b3c=[];var _0x585cc2=[];return db[_0xa311('0x5c')][_0xa311('0x45')]({'where':{'userProfileId':_0x5a885a[_0xa311('0x48')]['id']},'raw':!![]})['then'](function(_0x4c4c5e){_0x497b3c=_[_0xa311('0x40')](_0x4c4c5e,function(_0x8f37c7){return _0x8f37c7[_0xa311('0x63')]===0x1||_[_0xa311('0x64')]([0x3eb,0x709],_0x8f37c7[_0xa311('0x59')]);});if(!_['isEmpty'](_0x497b3c)){return _[_0xa311('0x30')](_0x497b3c,function(_0x528c85){return _0x528c85['sectionId'];});}else{return;}})[_0xa311('0x2b')](function(_0x537ca3){if(_0x537ca3)_0x585cc2=_0x537ca3;if(_[_0xa311('0x64')](_0x585cc2,0x64)){var _0x17c703=_[_0xa311('0x4b')](_0x497b3c,{'sectionId':0x64});return hasDefaultDashboard(_0x17c703)[_0xa311('0x2b')](function(_0x3a6e27){return _['map'](_0x497b3c,function(_0x17823d){if(_0x17823d[_0xa311('0x59')]===0x64){_0x17823d[_0xa311('0x65')]=_0x3a6e27;}return _0x17823d;});});}else{return;}})['then'](function(_0xc336be){if(_0xc336be)_0x497b3c=_0xc336be;if(_[_0xa311('0x64')](_0x585cc2,0x3eb)){var _0x5bd7f1=_['find'](_0x497b3c,{'sectionId':0x3eb});return getCustomDashboards(_0x5bd7f1)[_0xa311('0x2b')](function(_0x3ed316){return _[_0xa311('0x30')](_0x497b3c,function(_0x24bfab){if(_0x5bd7f1[_0xa311('0x63')]){if(_0x24bfab[_0xa311('0x59')]===0x3eb){_0x24bfab['subsections']=_0x3ed316;}}else{if(_0x24bfab['sectionId']===0x64){if(!_0x24bfab[_0xa311('0x65')]){_0x24bfab['subsections']=[];}_0x24bfab['subsections']=_0x24bfab[_0xa311('0x65')][_0xa311('0x66')](_0x3ed316);}}return _0x24bfab;});});}else{return;}})[_0xa311('0x2b')](function(_0x317666){if(_0x317666)_0x497b3c=_0x317666;if(_[_0xa311('0x64')](_0x585cc2,0x709)){var _0x25ff3a=_[_0xa311('0x4b')](_0x497b3c,{'sectionId':0x709});return getPlugins(_0x25ff3a)[_0xa311('0x2b')](function(_0x30a102){if(_0x25ff3a[_0xa311('0x63')]){return _['map'](_0x497b3c,function(_0xf04ae3){if(_0xf04ae3['sectionId']===0x709){_0xf04ae3[_0xa311('0x65')]=_0x30a102;}return _0xf04ae3;});}else{var _0x23b1f6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x30a102};var _0x2b1750=_[_0xa311('0x30')](_0x497b3c);_0x2b1750['push'](_0x23b1f6);return _0x2b1750;}});}else{return;}})[_0xa311('0x2b')](function(_0x491559){if(_0x491559)_0x497b3c=_0x491559;return _[_0xa311('0x40')](_0x497b3c,[_0xa311('0x63'),0x1]);})[_0xa311('0x2b')](respondWithResult(_0xc9f540,null))[_0xa311('0x4c')](handleError(_0xc9f540,null));};function hasDefaultDashboard(_0x1f0e74){var _0x35cc94=[0x65];return new BPromise(function(_0x5b89d1,_0x109001){try{if(_0x1f0e74['autoAssociation']){_0x5b89d1(_0x35cc94);}else{return db['UserProfileResource'][_0xa311('0x67')]({'where':{'sectionId':_0x1f0e74['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x471564){_0x471564?_0x5b89d1(_0x35cc94):_0x5b89d1();});}}catch(_0x2fd742){_0x109001(_0x2fd742);}});}function getCustomDashboards(_0xc2b38d){var _0x4ccfc8=[];return new BPromise(function(_0x3c3c21,_0x294500){try{if(_0xc2b38d[_0xa311('0x57')]){return db[_0xa311('0x68')][_0xa311('0x45')]({'raw':!![]})['then'](function(_0x4f54b7){_0x4f54b7[_0xa311('0x69')](function(_0x346ab2){_0x4ccfc8[_0xa311('0x60')](_0x346ab2['id']+0x1869f);});_0x3c3c21(_0x4ccfc8);});}else{return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0xc2b38d['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x211388){_0x211388['forEach'](function(_0x1e5147){_0x4ccfc8[_0xa311('0x60')](_0x1e5147[_0xa311('0x6a')]+0x1869f);});_0x3c3c21(_0x4ccfc8);});}}catch(_0x373a2c){_0x294500(_0x373a2c);}});}function getPlugins(_0xe0a57c){var _0x1dfebc=[];return new BPromise(function(_0x1de443,_0x21220c){try{if(_0xe0a57c[_0xa311('0x57')]){return db[_0xa311('0x6b')][_0xa311('0x45')]({'raw':!![]})[_0xa311('0x2b')](function(_0x524172){_0x524172[_0xa311('0x69')](function(_0x75686b){_0x1dfebc['push'](_0x75686b['id']+0x15b38);});_0x1de443(_0x1dfebc);});}else{return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0xe0a57c['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x44f988){_0x44f988['forEach'](function(_0x5e3933){_0x1dfebc[_0xa311('0x60')](_0x5e3933['resourceId']+0x15b38);});_0x1de443(_0x1dfebc);});}}catch(_0x540f6c){_0x21220c(_0x540f6c);}});}exports[_0xa311('0x6c')]=function(_0x49de11,_0x6bedb7){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x49de11[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x6bedb7,null))[_0xa311('0x2b')](function(_0xf7ce1){if(_0xf7ce1){return db['sequelize']['transaction'](function(_0x3a3e8a){return db[_0xa311('0x5c')]['findAll']({'where':{'userProfileId':_0x49de11[_0xa311('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xa311('0x2b')](function(_0x19d74b){if(_0x19d74b){return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x49de11['params']['id'],'id':_[_0xa311('0x30')](_0x19d74b,function(_0xdc5e75){return _0xdc5e75['id'];})},'transaction':_0x3a3e8a});}})[_0xa311('0x2b')](function(_0x501a36){var _0x3e6c15=_[_0xa311('0x30')](_0x49de11[_0xa311('0x4e')],function(_0x514a5c){_0x514a5c[_0xa311('0x5a')]=_0x49de11[_0xa311('0x48')]['id'];return _0x514a5c;});return db[_0xa311('0x5c')][_0xa311('0x6d')](_0x3e6c15,{'raw':!![],'transaction':_0x3a3e8a});})['then'](function(_0x414b44){var _0x1507e7=_['filter'](_[_0xa311('0x30')](_0x414b44,function(_0x23c77c){return _0x23c77c[_0xa311('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1507e7){return db[_0xa311('0x5c')][_0xa311('0x45')]({'where':{'userProfileId':_0x49de11[_0xa311('0x48')]['id'],'sectionId':_[_0xa311('0x30')](_0x1507e7,function(_0x496347){return _0x496347[_0xa311('0x59')];})},'attributes':['id',_0xa311('0x59')],'raw':!![]})[_0xa311('0x2b')](function(_0x4b5efa){var _0x43e5aa=_['map'](_0x49de11['body'],function(_0x9fa865){_0x9fa865[_0xa311('0x5a')]=_0x49de11[_0xa311('0x48')]['id'];return _0x9fa865;});return db[_0xa311('0x58')][_0xa311('0x6d')](_0x43e5aa,{'raw':!![],'transaction':_0x3a3e8a});});}})[_0xa311('0x4c')](handleError(_0x6bedb7,null));});}})[_0xa311('0x2b')](function(_0x444630){var _0x4cad6c=_[_0xa311('0x30')](_0x444630,function(_0x39b6dd){return _0x39b6dd[_0xa311('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x6bedb7,null))[_0xa311('0x4c')](handleError(_0x6bedb7,null));};exports[_0xa311('0x6e')]=function(_0x3ada33,_0x61a723,_0x16597c){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x3ada33[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x61a723,null))[_0xa311('0x2b')](function(_0x4675c7){if(_0x4675c7){return _0x4675c7[_0xa311('0x6e')](_0x3ada33[_0xa311('0x3a')][_0xa311('0x61')]);}})[_0xa311('0x2b')](respondWithStatusCode(_0x61a723,null))[_0xa311('0x4c')](handleError(_0x61a723,null));};exports['getResources']=function(_0x32150e,_0x2a1432){var _0x20977d={};if(!_0x32150e['query'][_0xa311('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x32150e[_0xa311('0x3a')][_0xa311('0x70')]('nolimit')){_0x20977d[_0xa311('0x22')]=qs[_0xa311('0x22')](_0x32150e[_0xa311('0x3a')][_0xa311('0x22')]);_0x20977d[_0xa311('0x21')]=qs[_0xa311('0x21')](_0x32150e['query'][_0xa311('0x21')]);}return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x32150e[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](function(_0x41401d){if(!_0x41401d)throw new Error(_0xa311('0x71')+_0x32150e[_0xa311('0x48')]['id']);return db[_0xa311('0x43')][_0xa311('0x72')](_0x32150e);})[_0xa311('0x2b')](respondWithFilteredResult(_0x2a1432,_0x20977d))[_0xa311('0x4c')](handleError(_0x2a1432,null));}; \ No newline at end of file +var _0xbbf2=['catch','show','rawAttributes','find','create','clone','params','length','get','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','sectionId','userProfileId','Resources','update','destroy','describe','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','UserProfile','type','key','model','map','query','keys','intersection','fields','attributes','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x145e8e,_0x13fe3a){var _0x44658e=function(_0x35a43d){while(--_0x35a43d){_0x145e8e['push'](_0x145e8e['shift']());}};_0x44658e(++_0x13fe3a);}(_0xbbf2,0x1e9));var _0x2bbf=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0xbbf2[_0x176d14];return _0x89522c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bbf('0x1'));var moment=require(_0x2bbf('0x2'));var BPromise=require(_0x2bbf('0x3'));var Mustache=require(_0x2bbf('0x4'));var util=require(_0x2bbf('0x5'));var path=require(_0x2bbf('0x6'));var sox=require(_0x2bbf('0x7'));var csv=require(_0x2bbf('0x8'));var ejs=require(_0x2bbf('0x9'));var fs=require('fs');var fs_extra=require(_0x2bbf('0xa'));var _=require(_0x2bbf('0xb'));var squel=require(_0x2bbf('0xc'));var crypto=require('crypto');var jsforce=require(_0x2bbf('0xd'));var deskjs=require(_0x2bbf('0xe'));var toCsv=require(_0x2bbf('0x8'));var querystring=require(_0x2bbf('0xf'));var Papa=require(_0x2bbf('0x10'));var Redis=require(_0x2bbf('0x11'));var authService=require(_0x2bbf('0x12'));var qs=require(_0x2bbf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bbf('0x14'));var utils=require('../../config/utils');var config=require(_0x2bbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2bbf('0x16'))['db'];config[_0x2bbf('0x17')]=_[_0x2bbf('0x18')](config[_0x2bbf('0x17')],{'host':_0x2bbf('0x19'),'port':0x18eb});var socket=require(_0x2bbf('0x1a'))(new Redis(config[_0x2bbf('0x17')]));require('./userProfile.socket')[_0x2bbf('0x1b')](socket);function respondWithStatusCode(_0x37397b,_0xf544f2){_0xf544f2=_0xf544f2||0xcc;return function(_0x42a3f5){if(_0x42a3f5){return _0x37397b['sendStatus'](_0xf544f2);}return _0x37397b[_0x2bbf('0x1c')](_0xf544f2)[_0x2bbf('0x1d')]();};}function respondWithResult(_0x23219b,_0x2bb890){_0x2bb890=_0x2bb890||0xc8;return function(_0x409c6e){if(_0x409c6e){return _0x23219b[_0x2bbf('0x1c')](_0x2bb890)[_0x2bbf('0x1e')](_0x409c6e);}};}function respondWithFilteredResult(_0x3931ed,_0x4178c5){return function(_0x43670c){if(_0x43670c){var _0x419a7e=typeof _0x4178c5[_0x2bbf('0x1f')]===_0x2bbf('0x20')&&typeof _0x4178c5[_0x2bbf('0x21')]===_0x2bbf('0x20');var _0x439806=_0x43670c[_0x2bbf('0x22')];var _0xa3cad9=_0x419a7e?0x0:_0x4178c5['offset'];var _0x47bb7b=_0x419a7e?_0x43670c[_0x2bbf('0x22')]:_0x4178c5[_0x2bbf('0x1f')]+_0x4178c5[_0x2bbf('0x21')];var _0x5adb25;if(_0x47bb7b>=_0x439806){_0x47bb7b=_0x439806;_0x5adb25=0xc8;}else{_0x5adb25=0xce;}_0x3931ed[_0x2bbf('0x1c')](_0x5adb25);return _0x3931ed['set'](_0x2bbf('0x23'),_0xa3cad9+'-'+_0x47bb7b+'/'+_0x439806)['json'](_0x43670c);}return null;};}function patchUpdates(_0x1e5799){return function(_0x3c0f30){try{jsonpatch[_0x2bbf('0x24')](_0x3c0f30,_0x1e5799,!![]);}catch(_0x54f352){return BPromise[_0x2bbf('0x25')](_0x54f352);}return _0x3c0f30['save']();};}function saveUpdates(_0x454fed,_0x4a6bba){return function(_0x9f9ed2){if(_0x9f9ed2){return _0x9f9ed2['update'](_0x454fed)[_0x2bbf('0x26')](function(_0x501d7){return _0x501d7;});}return null;};}function removeEntity(_0x54db46,_0x3a0dae){return function(_0x33eddb){if(_0x33eddb){return _0x33eddb['destroy']()['then'](function(){_0x54db46[_0x2bbf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453885,_0x4e95fa){return function(_0x415a79){if(!_0x415a79){_0x453885[_0x2bbf('0x27')](0x194);}return _0x415a79;};}function handleError(_0x1a4bc0,_0x49119c){_0x49119c=_0x49119c||0x1f4;return function(_0x3f7f8b){logger[_0x2bbf('0x28')](_0x3f7f8b[_0x2bbf('0x29')]);if(_0x3f7f8b[_0x2bbf('0x2a')]){delete _0x3f7f8b[_0x2bbf('0x2a')];}_0x1a4bc0['status'](_0x49119c)['send'](_0x3f7f8b);};}exports[_0x2bbf('0x2b')]=function(_0x3c2322,_0x556bc4){var _0x1e263d={},_0x21052f={},_0x548402={'count':0x0,'rows':[]};var _0x2e7ad0=_['map'](db[_0x2bbf('0x2c')]['rawAttributes'],function(_0x3043c7){return{'name':_0x3043c7['fieldName'],'type':_0x3043c7[_0x2bbf('0x2d')][_0x2bbf('0x2e')]};});_0x21052f[_0x2bbf('0x2f')]=_[_0x2bbf('0x30')](_0x2e7ad0,'name');_0x21052f[_0x2bbf('0x31')]=_[_0x2bbf('0x32')](_0x3c2322[_0x2bbf('0x31')]);_0x21052f['filters']=_[_0x2bbf('0x33')](_0x21052f[_0x2bbf('0x2f')],_0x21052f[_0x2bbf('0x31')]);_0x1e263d['attributes']=_[_0x2bbf('0x33')](_0x21052f[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x34')]));_0x1e263d[_0x2bbf('0x35')]=_0x1e263d['attributes']['length']?_0x1e263d[_0x2bbf('0x35')]:_0x21052f[_0x2bbf('0x2f')];if(!_0x3c2322[_0x2bbf('0x31')]['hasOwnProperty']('nolimit')){_0x1e263d[_0x2bbf('0x21')]=qs[_0x2bbf('0x21')](_0x3c2322['query']['limit']);_0x1e263d['offset']=qs[_0x2bbf('0x1f')](_0x3c2322['query'][_0x2bbf('0x1f')]);}_0x1e263d['order']=qs[_0x2bbf('0x36')](_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x36')]);_0x1e263d[_0x2bbf('0x37')]=qs[_0x2bbf('0x38')](_[_0x2bbf('0x39')](_0x3c2322[_0x2bbf('0x31')],_0x21052f[_0x2bbf('0x38')]),_0x2e7ad0);if(_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x3a')]){_0x1e263d['where']=_[_0x2bbf('0x3b')](_0x1e263d[_0x2bbf('0x37')],{'$or':_[_0x2bbf('0x30')](_0x2e7ad0,function(_0x18a0a3){if(_0x18a0a3['type']!==_0x2bbf('0x3c')){var _0x13ad25={};_0x13ad25[_0x18a0a3[_0x2bbf('0x2a')]]={'$like':'%'+_0x3c2322[_0x2bbf('0x31')]['filter']+'%'};return _0x13ad25;}})});}_0x1e263d=_[_0x2bbf('0x3b')]({},_0x1e263d,_0x3c2322[_0x2bbf('0x3d')]);var _0x226a93={'where':_0x1e263d[_0x2bbf('0x37')]};return db['UserProfile']['count'](_0x226a93)[_0x2bbf('0x26')](function(_0x2284dc){_0x548402[_0x2bbf('0x22')]=_0x2284dc;if(_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x3e')]){_0x1e263d[_0x2bbf('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x2bbf('0x40')](_0x1e263d);})['then'](function(_0x54b286){_0x548402[_0x2bbf('0x41')]=_0x54b286;return _0x548402;})[_0x2bbf('0x26')](respondWithFilteredResult(_0x556bc4,_0x1e263d))[_0x2bbf('0x42')](handleError(_0x556bc4,null));};exports[_0x2bbf('0x43')]=function(_0x42cbec,_0x1ccfc8){var _0x3fe787={'raw':![],'where':{'id':_0x42cbec['params']['id']}},_0x563608={};_0x563608[_0x2bbf('0x2f')]=_[_0x2bbf('0x32')](db[_0x2bbf('0x2c')][_0x2bbf('0x44')]);_0x563608[_0x2bbf('0x31')]=_['keys'](_0x42cbec['query']);_0x563608[_0x2bbf('0x38')]=_[_0x2bbf('0x33')](_0x563608['model'],_0x563608[_0x2bbf('0x31')]);_0x3fe787[_0x2bbf('0x35')]=_[_0x2bbf('0x33')](_0x563608[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x42cbec['query'][_0x2bbf('0x34')]));_0x3fe787[_0x2bbf('0x35')]=_0x3fe787[_0x2bbf('0x35')]['length']?_0x3fe787[_0x2bbf('0x35')]:_0x563608[_0x2bbf('0x2f')];if(_0x42cbec['query'][_0x2bbf('0x3e')]){_0x3fe787[_0x2bbf('0x3f')]=[{'all':!![]}];}_0x3fe787=_[_0x2bbf('0x3b')]({},_0x3fe787,_0x42cbec[_0x2bbf('0x3d')]);return db[_0x2bbf('0x2c')][_0x2bbf('0x45')](_0x3fe787)[_0x2bbf('0x26')](handleEntityNotFound(_0x1ccfc8,null))[_0x2bbf('0x26')](respondWithResult(_0x1ccfc8,null))['catch'](handleError(_0x1ccfc8,null));};exports[_0x2bbf('0x46')]=function(_0x5cf275,_0x43a701){return db[_0x2bbf('0x2c')][_0x2bbf('0x46')](_0x5cf275['body'],{})[_0x2bbf('0x26')](respondWithResult(_0x43a701,0xc9))[_0x2bbf('0x42')](handleError(_0x43a701,null));};exports[_0x2bbf('0x47')]=function(_0x571597,_0x1fcecb){var _0x1a8f61={'where':{'id':_0x571597[_0x2bbf('0x48')]['id']}},_0x3991bc={};_0x3991bc['model']=_[_0x2bbf('0x32')](db[_0x2bbf('0x2c')][_0x2bbf('0x44')]);_0x1a8f61[_0x2bbf('0x35')]=_['intersection'](_0x3991bc[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x571597[_0x2bbf('0x31')]['fields']));_0x1a8f61[_0x2bbf('0x35')]=_0x1a8f61[_0x2bbf('0x35')][_0x2bbf('0x49')]?_0x1a8f61[_0x2bbf('0x35')]:_0x3991bc[_0x2bbf('0x2f')];if(_0x571597[_0x2bbf('0x31')][_0x2bbf('0x3e')]){_0x1a8f61[_0x2bbf('0x3f')]=[{'all':!![]}];}_0x1a8f61=_['merge']({},_0x1a8f61,_0x571597[_0x2bbf('0x3d')]);return db['UserProfile']['find'](_0x1a8f61)[_0x2bbf('0x26')](handleEntityNotFound(_0x1fcecb,null))[_0x2bbf('0x26')](function(_0x3eb1e1){if(_0x3eb1e1){var _0x389372=_0x3eb1e1[_0x2bbf('0x4a')]({'plain':!![]});_0x389372=qs['omit'](_0x389372,['id','createdAt','updatedAt',_0x2bbf('0x4b')]);_0x571597[_0x2bbf('0x4c')]=_['omit'](_0x571597[_0x2bbf('0x4c')],['id','createdAt','updatedAt']);return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x1e93bd){return db['UserProfile'][_0x2bbf('0x46')](_[_0x2bbf('0x3b')](_0x389372,_0x571597[_0x2bbf('0x4c')]),{'include':_0x571597[_0x2bbf('0x31')][_0x2bbf('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x1e93bd})[_0x2bbf('0x26')](function(_0x1f1414){var _0x285966=_0x1f1414[_0x2bbf('0x4a')]({'plain':!![]});return db[_0x2bbf('0x4f')][_0x2bbf('0x40')]({'where':{'userProfileId':_0x571597['params']['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x259fb7){if(_0x259fb7){return BPromise[_0x2bbf('0x50')](_0x259fb7,function(_0x2b012b){return new BPromise(function(_0x256d61,_0x2cefcd){if(_0x2b012b[_0x2bbf('0x51')]===null||_0x2b012b[_0x2bbf('0x51')]===0x1)_0x256d61(null);return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x2b012b['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x31c20f){var _0x4a7ea5=_[_0x2bbf('0x30')](_0x31c20f,function(_0x533ca3){return qs[_0x2bbf('0x53')](_0x533ca3,['id',_0x2bbf('0x54'),_0x2bbf('0x55'),_0x2bbf('0x56')]);});_0x256d61(_0x4a7ea5);})[_0x2bbf('0x42')](function(_0x3cf486){_0x2cefcd(_0x3cf486);});})['then'](function(_0x5de931){var _0x18dfe6=qs[_0x2bbf('0x53')](_0x2b012b,['id',_0x2bbf('0x54'),_0x2bbf('0x55')]);_0x18dfe6[_0x2bbf('0x57')]=_0x285966['id'];if(_0x5de931)_0x18dfe6[_0x2bbf('0x58')]=_0x5de931;return _0x18dfe6;})[_0x2bbf('0x26')](function(_0x15898b){return db['UserProfileSection'][_0x2bbf('0x46')](_0x15898b,{'include':[{'model':db['UserProfileResource'],'as':_0x2bbf('0x58')}],'raw':!![],'transaction':_0x1e93bd});});})['then'](function(){return _0x285966;});}});});});}})[_0x2bbf('0x26')](respondWithResult(_0x1fcecb,0xc9))[_0x2bbf('0x42')](handleError(_0x1fcecb,null));};exports[_0x2bbf('0x59')]=function(_0x78dd18,_0xf4cc10){if(_0x78dd18[_0x2bbf('0x4c')]['id']){delete _0x78dd18[_0x2bbf('0x4c')]['id'];}return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x78dd18[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0xf4cc10,null))[_0x2bbf('0x26')](saveUpdates(_0x78dd18[_0x2bbf('0x4c')],null))[_0x2bbf('0x26')](respondWithResult(_0xf4cc10,null))[_0x2bbf('0x42')](handleError(_0xf4cc10,null));};exports[_0x2bbf('0x5a')]=function(_0x111c31,_0x2c2502){return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x111c31[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x2c2502,null))[_0x2bbf('0x26')](removeEntity(_0x2c2502,null))[_0x2bbf('0x42')](handleError(_0x2c2502,null));};exports['describe']=function(_0x306fe0,_0x86f675){return db[_0x2bbf('0x2c')][_0x2bbf('0x5b')]()[_0x2bbf('0x26')](respondWithResult(_0x86f675,null))[_0x2bbf('0x42')](handleError(_0x86f675,null));};exports['addSections']=function(_0x487c41,_0x57dc32){var _0x2fc7bc=_0x487c41['body'];return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x487c41[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x57dc32,null))[_0x2bbf('0x26')](function(_0x1ea07e){if(_0x1ea07e){return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x1d46fe){return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x487c41['params']['id'],'sectionId':_[_0x2bbf('0x30')](_0x2fc7bc,function(_0x84656){return _0x84656[_0x2bbf('0x56')];})},'transaction':_0x1d46fe})[_0x2bbf('0x26')](function(){var _0xb6c26=_[_0x2bbf('0x30')](_0x2fc7bc,function(_0x3af60c){_0x3af60c['userProfileId']=_0x487c41[_0x2bbf('0x48')]['id'];return _0x3af60c;});var _0x2c2da9=[];return BPromise['each'](_0xb6c26,function(_0x192f45){return db[_0x2bbf('0x4f')][_0x2bbf('0x46')](_0x192f45,{'include':[{'model':db[_0x2bbf('0x52')],'as':_0x2bbf('0x58')}],'raw':!![],'transaction':_0x1d46fe})['then'](function(_0x2b61f8){_0x2c2da9[_0x2bbf('0x5c')](_0x2b61f8[_0x2bbf('0x4a')]({'plain':!![]}));});})[_0x2bbf('0x26')](function(){return _0x2c2da9;});});});}})[_0x2bbf('0x26')](function(_0x7befdc){return _0x7befdc;})[_0x2bbf('0x26')](respondWithResult(_0x57dc32,null))[_0x2bbf('0x42')](handleError(_0x57dc32,null));};exports[_0x2bbf('0x5d')]=function(_0x3afc5a,_0x195ad7){var _0x1ca966;return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x3afc5a['params']['id']},'attributes':['id',_0x2bbf('0x2a')]})[_0x2bbf('0x26')](handleEntityNotFound(_0x195ad7,null))[_0x2bbf('0x26')](function(_0x14ba1d){if(_0x14ba1d){_0x1ca966=_0x14ba1d;return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x3afc5a['params']['id'],'sectionId':_0x3afc5a[_0x2bbf('0x31')]['ids']}});}})['then'](function(){return _0x1ca966;})[_0x2bbf('0x26')](respondWithStatusCode(_0x195ad7,null))['catch'](handleError(_0x195ad7,null));};exports[_0x2bbf('0x5e')]=function(_0x27ad66,_0x540347){var _0x28fd66=[];var _0x76ca24=[];return db[_0x2bbf('0x4f')]['findAll']({'where':{'userProfileId':_0x27ad66[_0x2bbf('0x48')]['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x5f4136){_0x28fd66=_[_0x2bbf('0x3a')](_0x5f4136,function(_0x1238c5){return _0x1238c5[_0x2bbf('0x5f')]===0x1||_[_0x2bbf('0x60')]([0x3eb,0x709],_0x1238c5['sectionId']);});if(!_[_0x2bbf('0x61')](_0x28fd66)){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x1fa85b){return _0x1fa85b[_0x2bbf('0x56')];});}else{return;}})[_0x2bbf('0x26')](function(_0x27bf3b){if(_0x27bf3b)_0x76ca24=_0x27bf3b;if(_[_0x2bbf('0x60')](_0x76ca24,0x64)){var _0x110922=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x64});return hasDefaultDashboard(_0x110922)[_0x2bbf('0x26')](function(_0x8f5612){return _['map'](_0x28fd66,function(_0x5bfa9a){if(_0x5bfa9a[_0x2bbf('0x56')]===0x64){_0x5bfa9a[_0x2bbf('0x62')]=_0x8f5612;}return _0x5bfa9a;});});}else{return;}})[_0x2bbf('0x26')](function(_0x4ab692){if(_0x4ab692)_0x28fd66=_0x4ab692;if(_[_0x2bbf('0x60')](_0x76ca24,0x3eb)){var _0x1ab949=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x3eb});return getCustomDashboards(_0x1ab949)[_0x2bbf('0x26')](function(_0x2d6e2f){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x4429cd){if(_0x1ab949[_0x2bbf('0x5f')]){if(_0x4429cd[_0x2bbf('0x56')]===0x3eb){_0x4429cd[_0x2bbf('0x62')]=_0x2d6e2f;}}else{if(_0x4429cd[_0x2bbf('0x56')]===0x64){if(!_0x4429cd[_0x2bbf('0x62')]){_0x4429cd[_0x2bbf('0x62')]=[];}_0x4429cd[_0x2bbf('0x62')]=_0x4429cd[_0x2bbf('0x62')][_0x2bbf('0x63')](_0x2d6e2f);}}return _0x4429cd;});});}else{return;}})[_0x2bbf('0x26')](function(_0xbbe5b4){if(_0xbbe5b4)_0x28fd66=_0xbbe5b4;if(_[_0x2bbf('0x60')](_0x76ca24,0x709)){var _0x26fec3=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x709});return getPlugins(_0x26fec3)[_0x2bbf('0x26')](function(_0x54cfb0){if(_0x26fec3[_0x2bbf('0x5f')]){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x24f853){if(_0x24f853[_0x2bbf('0x56')]===0x709){_0x24f853[_0x2bbf('0x62')]=_0x54cfb0;}return _0x24f853;});}else{var _0x366184={'sectionId':0x76c,'enabled':0x1,'subsections':_0x54cfb0};var _0x5ca57d=_[_0x2bbf('0x30')](_0x28fd66);_0x5ca57d[_0x2bbf('0x5c')](_0x366184);return _0x5ca57d;}});}else{return;}})[_0x2bbf('0x26')](function(_0x57b808){if(_0x57b808)_0x28fd66=_0x57b808;return _[_0x2bbf('0x3a')](_0x28fd66,[_0x2bbf('0x5f'),0x1]);})['then'](respondWithResult(_0x540347,null))['catch'](handleError(_0x540347,null));};function hasDefaultDashboard(_0x2dbca8){var _0x1891a0=[0x65];return new BPromise(function(_0x515ff7,_0x43e146){try{if(_0x2dbca8[_0x2bbf('0x51')]){_0x515ff7(_0x1891a0);}else{return db[_0x2bbf('0x52')][_0x2bbf('0x64')]({'where':{'sectionId':_0x2dbca8['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x3e095b){_0x3e095b?_0x515ff7(_0x1891a0):_0x515ff7();});}}catch(_0x4f31e5){_0x43e146(_0x4f31e5);}});}function getCustomDashboards(_0x56bca3){var _0x41a007=[];return new BPromise(function(_0xf01c59,_0x3ec5bd){try{if(_0x56bca3[_0x2bbf('0x51')]){return db[_0x2bbf('0x65')][_0x2bbf('0x40')]({'raw':!![]})['then'](function(_0x3ed8c9){_0x3ed8c9[_0x2bbf('0x66')](function(_0x41aca1){_0x41a007[_0x2bbf('0x5c')](_0x41aca1['id']+0x1869f);});_0xf01c59(_0x41a007);});}else{return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x56bca3['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x4b420d){_0x4b420d['forEach'](function(_0x36637f){_0x41a007[_0x2bbf('0x5c')](_0x36637f[_0x2bbf('0x67')]+0x1869f);});_0xf01c59(_0x41a007);});}}catch(_0x20a674){_0x3ec5bd(_0x20a674);}});}function getPlugins(_0x49a8fd){var _0x837394=[];return new BPromise(function(_0x5dc162,_0x40a90e){try{if(_0x49a8fd[_0x2bbf('0x51')]){return db['Plugin'][_0x2bbf('0x40')]({'raw':!![]})[_0x2bbf('0x26')](function(_0x5c3b1f){_0x5c3b1f['forEach'](function(_0x559923){_0x837394['push'](_0x559923['id']+0x15b38);});_0x5dc162(_0x837394);});}else{return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x49a8fd['id']},'raw':!![]})['then'](function(_0xcd80c9){_0xcd80c9['forEach'](function(_0x37483a){_0x837394[_0x2bbf('0x5c')](_0x37483a[_0x2bbf('0x67')]+0x15b38);});_0x5dc162(_0x837394);});}}catch(_0x4db31b){_0x40a90e(_0x4db31b);}});}exports[_0x2bbf('0x68')]=function(_0x586b5a,_0x342a25){return db['UserProfile'][_0x2bbf('0x45')]({'where':{'id':_0x586b5a[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x342a25,null))['then'](function(_0x2d2cd1){if(_0x2d2cd1){return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x54f52a){return db['UserProfileSection'][_0x2bbf('0x40')]({'where':{'userProfileId':_0x586b5a[_0x2bbf('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x2bbf('0x26')](function(_0x5a95f9){if(_0x5a95f9){return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x586b5a['params']['id'],'id':_[_0x2bbf('0x30')](_0x5a95f9,function(_0x4b3cf7){return _0x4b3cf7['id'];})},'transaction':_0x54f52a});}})['then'](function(_0x312cb4){var _0x40b3ce=_['map'](_0x586b5a[_0x2bbf('0x4c')],function(_0x1c9854){_0x1c9854[_0x2bbf('0x57')]=_0x586b5a[_0x2bbf('0x48')]['id'];return _0x1c9854;});return db[_0x2bbf('0x4f')]['bulkCreate'](_0x40b3ce,{'raw':!![],'transaction':_0x54f52a});})[_0x2bbf('0x26')](function(_0x56e507){var _0x1fc6df=_[_0x2bbf('0x3a')](_['map'](_0x56e507,function(_0x40c95b){return _0x40c95b[_0x2bbf('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x1fc6df){return db[_0x2bbf('0x4f')][_0x2bbf('0x40')]({'where':{'userProfileId':_0x586b5a[_0x2bbf('0x48')]['id'],'sectionId':_[_0x2bbf('0x30')](_0x1fc6df,function(_0x1cea9d){return _0x1cea9d[_0x2bbf('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2bbf('0x26')](function(_0x1b985d){var _0x578725=_['map'](_0x586b5a['body'],function(_0x2007a1){_0x2007a1[_0x2bbf('0x57')]=_0x586b5a[_0x2bbf('0x48')]['id'];return _0x2007a1;});return db[_0x2bbf('0x52')]['bulkCreate'](_0x578725,{'raw':!![],'transaction':_0x54f52a});});}})['catch'](handleError(_0x342a25,null));});}})['then'](function(_0x5568fa){var _0x14d2ed=_[_0x2bbf('0x30')](_0x5568fa,function(_0xcf648b){return _0xcf648b[_0x2bbf('0x4a')]({'plain':!![]});});})[_0x2bbf('0x26')](respondWithResult(_0x342a25,null))['catch'](handleError(_0x342a25,null));};exports[_0x2bbf('0x69')]=function(_0x1569dc,_0x446256,_0x4b2819){return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x1569dc[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x446256,null))['then'](function(_0x58c73e){if(_0x58c73e){return _0x58c73e[_0x2bbf('0x69')](_0x1569dc['query']['ids']);}})[_0x2bbf('0x26')](respondWithStatusCode(_0x446256,null))[_0x2bbf('0x42')](handleError(_0x446256,null));};exports[_0x2bbf('0x6a')]=function(_0x68e88b,_0x19fe7c){var _0x5159b2={};if(!_0x68e88b['query'][_0x2bbf('0x6b')])throw new Error(_0x2bbf('0x6c'));if(!_0x68e88b['query']['hasOwnProperty'](_0x2bbf('0x6d'))){_0x5159b2['limit']=qs['limit'](_0x68e88b['query'][_0x2bbf('0x21')]);_0x5159b2['offset']=qs[_0x2bbf('0x1f')](_0x68e88b[_0x2bbf('0x31')][_0x2bbf('0x1f')]);}return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x68e88b[_0x2bbf('0x48')]['id']}})['then'](function(_0x468e9f){if(!_0x468e9f)throw new Error(_0x2bbf('0x6e')+_0x68e88b[_0x2bbf('0x48')]['id']);return db['UserProfile']['getResources'](_0x68e88b);})[_0x2bbf('0x26')](respondWithFilteredResult(_0x19fe7c,_0x5159b2))['catch'](handleError(_0x19fe7c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 49dda03..a6dc792 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 _0x187d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners'];(function(_0x529966,_0x25c320){var _0xe643a7=function(_0x39433b){while(--_0x39433b){_0x529966['push'](_0x529966['shift']());}};_0xe643a7(++_0x25c320);}(_0x187d,0x93));var _0xd187=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x187d[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0xd187('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd187('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd187('0x2')](0x0);var events={'afterCreate':_0xd187('0x3'),'afterUpdate':_0xd187('0x4'),'afterDestroy':_0xd187('0x5')};function emitEvent(_0x201b79){return function(_0x58622a,_0x28fa0b,_0x163807){UserProfileEvents['emit'](_0x201b79+':'+_0x58622a['id'],_0x58622a);UserProfileEvents[_0xd187('0x6')](_0x201b79,_0x58622a);_0x163807(null);};}for(var e in events){if(events[_0xd187('0x7')](e)){var event=events[e];UserProfile[_0xd187('0x8')](e,emitEvent(event));}}module[_0xd187('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x58c7fa,_0x8cf29e){var _0x4f0f5b=function(_0x38ff58){while(--_0x38ff58){_0x58c7fa['push'](_0x58c7fa['shift']());}};_0x4f0f5b(++_0x8cf29e);}(_0x4888,0x198));var _0x8488=function(_0x231b09,_0x4342ab){_0x231b09=_0x231b09-0x0;var _0x407bb6=_0x4888[_0x231b09];return _0x407bb6;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){UserProfileEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);UserProfileEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];UserProfile[_0x8488('0x8')](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 d394d3c..1df4eef 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 _0x07ea=['chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','map','catch','model','then','name','resolve','field','associatedResources','type','resourceId','childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','AnalyticExtractedReport','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','sequelize','query','OpenTabs','define','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','options','include','reportType','default','reportId','DefaultReports','CustomReports','count','rows','customSorting','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','openTabs'];(function(_0xf433fa,_0x32e751){var _0x46c91a=function(_0x293a3b){while(--_0x293a3b){_0xf433fa['push'](_0xf433fa['shift']());}};_0x46c91a(++_0x32e751);}(_0x07ea,0xc0));var _0xa07e=function(_0x4026c8,_0x477780){_0x4026c8=_0x4026c8-0x0;var _0xf7aeba=_0x07ea[_0x4026c8];return _0xf7aeba;};'use strict';var _=require(_0xa07e('0x0'));var attributes=require(_0xa07e('0x1'));var squel=require(_0xa07e('0x2'));module[_0xa07e('0x3')]=function(_0x2719b5){var _0x1c3337=_0x2719b5['models'];function _0xdf877f(_0x2cd874,_0x31f621){return new Promise(function(_0x3ba7d1,_0x3c9212){if(!_0x31f621)return _0x3ba7d1(null);var _0x3daf23=_0x31f621['filter']?{[_0x31f621[_0xa07e('0x4')]['field']]:_0x31f621[_0xa07e('0x4')][_0xa07e('0x5')]}:undefined;return _0x1c3337[_0x2cd874][_0xa07e('0x6')]({'where':_0x3daf23,'raw':!![]})['then'](function(_0xcffa8d){_0x31f621['associatedResources']=_[_0xa07e('0x7')](_0xcffa8d,'id');_0x3ba7d1(_0x31f621);})[_0xa07e('0x8')](function(_0x134140){_0x3c9212(_0x134140);});});}function _0x193ed7(_0x5874bd,_0x2f37f9){return new Promise(function(_0x3330db,_0x4d6b6e){var _0x230312=_0x5874bd['filter']?{[_0x5874bd[_0xa07e('0x4')]['field']]:_0x5874bd[_0xa07e('0x4')][_0xa07e('0x5')]}:undefined;return _0x1c3337[_0x5874bd[_0xa07e('0x9')]][_0xa07e('0x6')]({'where':_0x230312,'raw':!![]})[_0xa07e('0xa')](function(_0x3e6d67){_0x2f37f9['associatedResources']=_[_0xa07e('0x7')](_0x3e6d67,function(_0x163006){return _0x163006[_0xa07e('0xb')];});_0x3330db(_0x2f37f9);})[_0xa07e('0x8')](function(_0x30a0f9){_0x4d6b6e(_0x30a0f9);});});}function _0x37e0ba(_0x50ebf8,_0x287cfa,_0x36e6d2){if(!_0x287cfa)return Promise[_0xa07e('0xc')](null);return new Promise(function(_0x20f69f,_0x5867da){return _0x1c3337['UserProfileResource']['findAll']({'where':{'sectionId':_0x287cfa['id']},'raw':!![]})[_0xa07e('0xa')](function(_0x151433){if(_0x50ebf8[_0xa07e('0xd')]&&_0x50ebf8[_0xa07e('0xd')]!=='id'){_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x4a62c2){return _0x4a62c2[_0x50ebf8['field']];});}else{if(_0x36e6d2==='AnalyticExtractedReport'){_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x1fb4b1){return{'id':_0x1fb4b1['resourceId'],'type':_0x1fb4b1[_0xa07e('0xf')]};});}else{_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x45857c){return _0x45857c[_0xa07e('0x10')];});}}_0x20f69f(_0x287cfa);})[_0xa07e('0x8')](function(_0x42e6b5){_0x5867da(_0x42e6b5);});});}function _0x4d0136(_0x3c8bcd,_0x278f9c){var _0x1f106={'parentSections':[]};switch(_0x3c8bcd['toLowerCase']()){case'squareprojects':_0x1f106[_0xa07e('0x11')]='SquareProject';break;case _0xa07e('0x12'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x13');break;case'squarerecordings':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x14');_0x1f106[_0xa07e('0x15')]=[{'name':_0xa07e('0x16'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x17')}];break;case _0xa07e('0x18'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x19');break;case _0xa07e('0x1a'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x1b');_0x1f106[_0xa07e('0x15')]=[{'name':'Lists','field':'id','foreignKey':_0xa07e('0x1c')}];break;case _0xa07e('0x1d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x1e');break;case _0xa07e('0x1f'):_0x1f106[_0xa07e('0x11')]='CmCompany';break;case'globalcustomfields':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x20');break;case'chatqueues':_0x1f106['childModel']=_0xa07e('0x21');break;case _0xa07e('0x22'):_0x1f106['childModel']=_0xa07e('0x23');break;case _0xa07e('0x24'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x25');break;case'faxaccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x26');break;case _0xa07e('0x27'):case _0xa07e('0x28'):case _0xa07e('0x29'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2a');break;case'contexts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2b');break;case'voicemails':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2c');break;case _0xa07e('0x2d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2e');_0x1f106['parentSections']=[{'name':'Agents','field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x2f'),'model':_0xa07e('0x30'),'filter':{'field':_0xa07e('0x31'),'value':['agent']}},{'name':_0xa07e('0x32'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x2f'),'model':_0xa07e('0x30'),'filter':{'field':_0xa07e('0x31'),'value':[_0xa07e('0x33')]}},{'name':_0xa07e('0x34'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x35'),'model':_0xa07e('0x36'),'filter':{'field':_0xa07e('0xf'),'value':[_0xa07e('0x37')]}},{'name':'QueueCampaigns','field':_0xa07e('0xb'),'foreignKey':'queue','model':_0xa07e('0x36'),'filter':{'field':_0xa07e('0xf'),'value':[_0xa07e('0x38')]}}];break;case _0xa07e('0x39'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3a');break;case'chanspies':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3b');break;case'voiceprefixes':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3c');break;case _0xa07e('0x3d'):_0x1f106['childModel']=_0xa07e('0x3e');break;case _0xa07e('0x3f'):_0x1f106['childModel']='MailQueue';break;case _0xa07e('0x40'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x41');break;case'mailsubstatuses':_0x1f106['childModel']=_0xa07e('0x42');break;case _0xa07e('0x43'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x44');break;case'openchannelaccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x45');break;case'smsqueues':_0x1f106['childModel']=_0xa07e('0x46');break;case _0xa07e('0x47'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x48');break;case _0xa07e('0x49'):_0x1f106['childModel']=_0xa07e('0x4a');break;case _0xa07e('0x4b'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x4c');break;case _0xa07e('0x4d'):_0x1f106[_0xa07e('0x11')]='Team';break;case _0xa07e('0x4e'):case _0xa07e('0x4f'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x36');if(_0x278f9c){_0x1f106['parentSections']=[{'name':_0xa07e('0x34')},{'name':'QueueCampaigns'}];}break;case _0xa07e('0x50'):case'agents':case'telephones':_0x1f106['childModel']='User';if(_0x278f9c){_0x1f106['parentSections']=[{'name':_0xa07e('0x51'),'filter':{'field':_0xa07e('0x31'),'value':[_0xa07e('0x52'),_0xa07e('0x53')]},'ignore':!![]},{'name':_0xa07e('0x54')},{'name':_0xa07e('0x32')}];}break;case _0xa07e('0x55'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x56');break;case'salesforceaccounts':_0x1f106['childModel']='SalesforceAccount';break;case _0xa07e('0x57'):_0x1f106['childModel']=_0xa07e('0x58');break;case _0xa07e('0x59'):_0x1f106['childModel']=_0xa07e('0x5a');break;case _0xa07e('0x5b'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x5c');break;case _0xa07e('0x5d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x5e');break;case'vtigeraccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x30');break;case _0xa07e('0x5f'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x60');break;case _0xa07e('0x61'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x62');break;case _0xa07e('0x63'):_0x1f106['childModel']=_0xa07e('0x64');break;case _0xa07e('0x65'):_0x1f106['childModel']=_0xa07e('0x66');break;case _0xa07e('0x67'):_0x1f106['childModel']=_0xa07e('0x68');break;case _0xa07e('0x69'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6a');break;case _0xa07e('0x6b'):_0x1f106[_0xa07e('0x11')]='Sound';break;case _0xa07e('0x6c'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6d');break;case _0xa07e('0x6e'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6f');break;case _0xa07e('0x70'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x71');break;case _0xa07e('0x72'):_0x1f106[_0xa07e('0x11')]='Trunk';break;case _0xa07e('0x73'):_0x1f106[_0xa07e('0x11')]='Variable';break;case'plugins':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x74');break;case _0xa07e('0x75'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x76');_0x1f106[_0xa07e('0x15')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x77');break;}return _0x1f106;}function _0x391195(_0x7f893b,_0x34b03d){var _0x98ca58=_0x7f893b['charAt'](0x0)[_0xa07e('0x78')]()+_0x7f893b[_0xa07e('0x79')](0x1);var _0x4940dd={'type':_0x1c3337['Sequelize'][_0xa07e('0x7a')][_0xa07e('0x7b')],'raw':!![]};return new Promise(function(_0x357035,_0x28aa6a){var _0x37edb0=squel[_0xa07e('0x7c')]()[_0xa07e('0xd')](_0xa07e('0x7d')+_0x98ca58+_0xa07e('0x7e'),'id')[_0xa07e('0xd')]('ui.createdAt')['from']('user_has_'+_0x7f893b+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x34b03d['id']);return _0x1c3337[_0xa07e('0x7f')][_0xa07e('0x80')](_0x37edb0['toString'](),_0x4940dd)['then'](function(_0x30cf23){_0x34b03d[_0x98ca58+_0xa07e('0x81')]=_0x30cf23;_0x357035(_0x30cf23);})[_0xa07e('0x8')](function(_0x7db89f){_0x28aa6a(_0x7db89f);});});}return _0x2719b5[_0xa07e('0x82')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3cbacc){var _0x44ba03=require(_0xa07e('0x83'));var _0x2dcb54={'raw':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x84')],'where':{}};var _0x5e9de1={};var _0x39da84={'count':0x0,'rows':[]};var _0x32e154=_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x85')];var _0x4d8552=_0x3cbacc[_0xa07e('0x80')]['mergeResources']||![];var _0x21a012=_0x4d0136(_0x32e154,_0x4d8552);if(!_0x21a012['childModel'])throw new Error(_0xa07e('0x86')+_0x32e154+'\x27');var _0x353145=[{'name':_0x32e154}];if(!_[_0xa07e('0x87')](_0x21a012['parentSections']))_0x353145=_0x21a012['parentSections'];var _0x3390ea=[];for(var _0x1cefaf=0x0;_0x1cefaf<_0x353145[_0xa07e('0x88')];_0x1cefaf++){_0x3390ea[_0xa07e('0x89')](_0x1c3337[_0xa07e('0x8a')]['find']({'where':{'userProfileId':_0x3cbacc[_0xa07e('0x8b')]['id'],'name':_0x353145[_0x1cefaf][_0xa07e('0xb')]},'raw':!![]}));}return Promise[_0xa07e('0x8c')](_0x3390ea)[_0xa07e('0xa')](function(_0x16038b){var _0x49322a=_[_0xa07e('0x4')](_0x16038b,function(_0x1ca80a){return _0x1ca80a?_0x1ca80a:undefined;});var _0xca8e61=_[_0xa07e('0x4')](_0x353145,['ignore',!![]]);var _0x24f325=_['isEmpty'](_0x49322a)&&_[_0xa07e('0x87')](_0xca8e61)?null:_[_0xa07e('0x8d')](_0xca8e61,_0x49322a);if(!_0x24f325)return null;var _0x3dcf39=[];for(var _0x58bdd8=0x0;_0x58bdd8<_0x24f325['length'];_0x58bdd8++){var _0x48ebd9=_[_0xa07e('0x8e')](_0x353145,function(_0x4dd7c8){return _0x24f325[_0x58bdd8]?_0x4dd7c8[_0xa07e('0xb')]===_0x24f325[_0x58bdd8][_0xa07e('0xb')]:null;});if(_0x48ebd9){if(_0x24f325[_0x58bdd8][_0xa07e('0x8f')]){_0x3dcf39[_0xa07e('0x89')](_0xdf877f(_0x21a012['childModel'],_0x24f325[_0x58bdd8]));}else{if(!_0x24f325[_0x58bdd8][_0xa07e('0x90')]){_0x3dcf39['push'](_0x37e0ba(_0x48ebd9,_0x24f325[_0x58bdd8],_0x21a012['childModel']));}else{if(_0x48ebd9[_0xa07e('0x9')]){_0x3dcf39[_0xa07e('0x89')](_0x193ed7(_0x48ebd9,_0x24f325[_0x58bdd8]));}}}}}return Promise[_0xa07e('0x8c')](_0x3dcf39);})[_0xa07e('0xa')](function(_0x7ea141){var _0x88f0c1=_0x7ea141;var _0x237692=null;if(_0x88f0c1){_0x237692=_0x88f0c1[_0xa07e('0x88')]===0x1?_0x88f0c1[0x0]:null;}if(!_0x237692&&!_0x88f0c1)return _0x39da84;var _0x335d2b=_0x1c3337[_0x21a012[_0xa07e('0x11')]][_0xa07e('0x91')];_0x5e9de1['model']=_[_0xa07e('0x92')](_0x335d2b);_0x5e9de1[_0xa07e('0x80')]=_['keys'](_0x3cbacc[_0xa07e('0x80')]);_0x5e9de1[_0xa07e('0x93')]=_[_0xa07e('0x94')](_0x5e9de1[_0xa07e('0x9')],_0x5e9de1[_0xa07e('0x80')]);_0x2dcb54['attributes']=_[_0xa07e('0x94')](_0x5e9de1['model'],_0x44ba03['fields'](_0x3cbacc['query'][_0xa07e('0x95')]));_0x2dcb54[_0xa07e('0x96')]=_0x2dcb54['attributes']['length']?_0x2dcb54[_0xa07e('0x96')]:_0x5e9de1[_0xa07e('0x9')];if(!_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x97')](_0xa07e('0x98'))){_0x2dcb54['limit']=_0x44ba03[_0xa07e('0x99')](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x99')]);_0x2dcb54[_0xa07e('0x9a')]=_0x44ba03[_0xa07e('0x9a')](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x9a')]);}_0x2dcb54['order']=_0x44ba03['sort'](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x9b')]);_0x2dcb54[_0xa07e('0x9c')]=_0x44ba03['filters'](_[_0xa07e('0x9d')](_0x3cbacc[_0xa07e('0x80')],_0x5e9de1['filters']));if(_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x4')]){_0x2dcb54['where']=_['merge'](_0x2dcb54[_0xa07e('0x9c')],{'$or':_['map'](_0x335d2b,function(_0x450c9c){if(_0x450c9c[_0xa07e('0xf')][_0xa07e('0x9e')]!==_0xa07e('0x9f')){var _0x46e851={};_0x46e851[_0x450c9c[_0xa07e('0xd')]]={'$like':'%'+_0x3cbacc['query'][_0xa07e('0x4')]+'%'};return _0x46e851;}})});}var _0x127d0b=[];var _0x299bed=null;var _0x4478f3={};if(_0x237692){_0x299bed=_[_0xa07e('0x8e')](_0x353145,[_0xa07e('0xb'),_0x237692[_0xa07e('0xb')]]);if(_0x299bed[_0xa07e('0xd')]){_0x4478f3={};if(_0x21a012[_0xa07e('0x11')]===_0xa07e('0x76')){_0x4478f3[_0x299bed[_0xa07e('0xa0')]]=_[_0xa07e('0x7')](_0x237692[_0xa07e('0xe')],'id');}else{_0x4478f3[_0x299bed[_0xa07e('0xa0')]]=_0x237692[_0xa07e('0xe')];}_0x127d0b['push'](_0x4478f3);}else{_0x2dcb54[_0xa07e('0x9c')]['id']=_0x237692[_0xa07e('0xe')];}}else{for(var _0x41f383=0x0;_0x41f383<_0x88f0c1[_0xa07e('0x88')];_0x41f383++){_0x299bed=_['find'](_0x353145,['name',_0x88f0c1[_0x41f383][_0xa07e('0xb')]]);if(_0x299bed[_0xa07e('0xd')]){_0x4478f3={};_0x4478f3[_0x299bed['foreignKey']]=_0x88f0c1[_0x41f383][_0xa07e('0xe')];_0x127d0b[_0xa07e('0x89')](_0x4478f3);}else{if(!_0x2dcb54[_0xa07e('0x9c')]['id'])_0x2dcb54[_0xa07e('0x9c')]['id']=[];_0x88f0c1[_0x41f383][_0xa07e('0xe')][_0xa07e('0xa1')](function(_0x458fbf){_0x2dcb54[_0xa07e('0x9c')]['id']['push'](_0x458fbf);});}}}if(!_['isEmpty'](_0x127d0b)){_0x2dcb54[_0xa07e('0x9c')]=_[_0xa07e('0xa2')](_0x2dcb54[_0xa07e('0x9c')],{'$and':{'$or':_0x127d0b}});}_0x2dcb54=_[_0xa07e('0xa2')]({},_0x2dcb54,_0x3cbacc[_0xa07e('0xa3')]);if(_0x237692&&!_0x237692['autoAssociation']&&_0x21a012[_0xa07e('0x11')]==='AnalyticExtractedReport'){if(_0x3cbacc['query']['includeAll']){_0x2dcb54[_0xa07e('0xa4')]=[{'all':!![]}];}return _0x1c3337[_0x21a012[_0xa07e('0x11')]]['findAll'](_0x2dcb54)[_0xa07e('0xa')](function(_0x370415){var _0x3fd277=[];_0x370415[_0xa07e('0xa1')](function(_0x3d445a){var _0x4e76d6;switch(_0x3d445a[_0xa07e('0xa5')]){case _0xa07e('0xa6'):_0x4e76d6=_[_0xa07e('0x8e')](_0x237692[_0xa07e('0xe')],function(_0x514083){return _0x514083['id']===_0x3d445a[_0xa07e('0xa7')]&&_0x514083[_0xa07e('0xf')]===_0xa07e('0xa8');});break;case'custom':_0x4e76d6=_[_0xa07e('0x8e')](_0x237692[_0xa07e('0xe')],function(_0x45a9ea){return _0x45a9ea['id']===_0x3d445a[_0xa07e('0xa7')]&&_0x45a9ea[_0xa07e('0xf')]===_0xa07e('0xa9');});break;}if(_0x4e76d6)_0x3fd277[_0xa07e('0x89')](_0x3d445a);});_0x39da84[_0xa07e('0xaa')]=_0x3fd277[_0xa07e('0x88')];_0x39da84[_0xa07e('0xab')]=_0x3fd277;return _0x39da84;});}else{if(!_[_0xa07e('0x87')](_0x3cbacc[_0xa07e('0x80')]['ids'])){_0x2dcb54['where']['id']=_0x2dcb54[_0xa07e('0x9c')]['id']?_[_0xa07e('0x94')](_0x2dcb54[_0xa07e('0x9c')]['id'],_0x3cbacc[_0xa07e('0x80')]['ids']):_0x3cbacc['query']['ids'];if(_0x3cbacc[_0xa07e('0x80')]['customSorting']){_0x2dcb54['order']=_0x3cbacc['query'][_0xa07e('0xac')];}}if(_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xad')]){_0x2dcb54[_0xa07e('0x9c')]=_[_0xa07e('0xa2')](_0x2dcb54[_0xa07e('0x9c')],{'$and':_0x3cbacc['query']['extraQueryConditions']});}return _0x1c3337[_0x21a012['childModel']][_0xa07e('0xaa')]({'where':_0x2dcb54[_0xa07e('0x9c')]})[_0xa07e('0xa')](function(_0x7b4b2a){_0x39da84[_0xa07e('0xaa')]=_0x7b4b2a;if(_0x3cbacc['query'][_0xa07e('0xae')]){if(_0x21a012['childModel']===_0xa07e('0x1b')){_0x2dcb54[_0xa07e('0xa4')]=[{'model':_0x1c3337[_0xa07e('0x6d')],'as':_0xa07e('0xaf'),'attributes':['id',_0xa07e('0xb'),_0xa07e('0xb0')],'required':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?!![]:![]},{'model':_0x1c3337[_0xa07e('0x6d')],'as':_0xa07e('0xb2'),'attributes':['id',_0xa07e('0xb'),_0xa07e('0xb0')],'through':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?{'attributes':[],'where':{'TagId':_0x3cbacc[_0xa07e('0x80')]['tag']||undefined}}:{},'required':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?!![]:![]}];}else{_0x2dcb54[_0xa07e('0xa4')]=[{'all':!![]}];}}return _0x1c3337[_0x21a012[_0xa07e('0x11')]][_0xa07e('0x6')](_0x2dcb54);})[_0xa07e('0xa')](function(_0x2cb468){_0x39da84[_0xa07e('0xab')]=_0x2cb468;if(_0x32e154===_0xa07e('0x54')&&_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb3')]==='true'){var _0x464eed=[];for(var _0xd241df=0x0;_0xd241df<_0x39da84[_0xa07e('0xab')][_0xa07e('0x88')];_0xd241df++){_0x464eed['push'](_0x391195(_0xa07e('0xb4'),_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed['push'](_0x391195(_0xa07e('0xb6'),_0x39da84['rows'][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195('fax',_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb7'),_0x39da84['rows'][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb8'),_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb9'),_0x39da84[_0xa07e('0xab')][_0xd241df]['dataValues']));}return Promise[_0xa07e('0x8c')](_0x464eed)[_0xa07e('0xa')](function(){return _0x39da84;});}return _0x39da84;});}});}}});}; \ No newline at end of file +var _0xc7f8=['model','map','catch','UserProfileResource','AnalyticExtractedReport','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','name','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','intervals','Interval','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','define','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','DefaultReports','count','rows','ids','customSorting','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources'];(function(_0x2a45d0,_0x4a89f1){var _0x5c4e2f=function(_0x3af60d){while(--_0x3af60d){_0x2a45d0['push'](_0x2a45d0['shift']());}};_0x5c4e2f(++_0x4a89f1);}(_0xc7f8,0xb2));var _0x8c7f=function(_0x378963,_0x362640){_0x378963=_0x378963-0x0;var _0x247e5e=_0xc7f8[_0x378963];return _0x247e5e;};'use strict';var _=require(_0x8c7f('0x0'));var attributes=require(_0x8c7f('0x1'));var squel=require(_0x8c7f('0x2'));module[_0x8c7f('0x3')]=function(_0x3ccde4){var _0x1065c2=_0x3ccde4[_0x8c7f('0x4')];function _0x3e3ec2(_0x42e8bb,_0x58cf62){return new Promise(function(_0x27cf2c,_0x202449){if(!_0x58cf62)return _0x27cf2c(null);var _0xc6d6f2=_0x58cf62['filter']?{[_0x58cf62[_0x8c7f('0x5')][_0x8c7f('0x6')]]:_0x58cf62[_0x8c7f('0x5')][_0x8c7f('0x7')]}:undefined;return _0x1065c2[_0x42e8bb][_0x8c7f('0x8')]({'where':_0xc6d6f2,'raw':!![]})[_0x8c7f('0x9')](function(_0xee7b8){_0x58cf62[_0x8c7f('0xa')]=_['map'](_0xee7b8,'id');_0x27cf2c(_0x58cf62);})['catch'](function(_0x4433b9){_0x202449(_0x4433b9);});});}function _0x40facc(_0x501d4e,_0x23f86){return new Promise(function(_0x412610,_0x5a8b1a){var _0x3a27ed=_0x501d4e[_0x8c7f('0x5')]?{[_0x501d4e['filter'][_0x8c7f('0x6')]]:_0x501d4e[_0x8c7f('0x5')][_0x8c7f('0x7')]}:undefined;return _0x1065c2[_0x501d4e[_0x8c7f('0xb')]][_0x8c7f('0x8')]({'where':_0x3a27ed,'raw':!![]})[_0x8c7f('0x9')](function(_0x386fbf){_0x23f86[_0x8c7f('0xa')]=_[_0x8c7f('0xc')](_0x386fbf,function(_0x57d2de){return _0x57d2de['name'];});_0x412610(_0x23f86);})[_0x8c7f('0xd')](function(_0x3431a6){_0x5a8b1a(_0x3431a6);});});}function _0x14494a(_0x4454c6,_0x262955,_0x4a3092){if(!_0x262955)return Promise['resolve'](null);return new Promise(function(_0x35f096,_0x22c0ba){return _0x1065c2[_0x8c7f('0xe')][_0x8c7f('0x8')]({'where':{'sectionId':_0x262955['id']},'raw':!![]})[_0x8c7f('0x9')](function(_0x47b590){if(_0x4454c6[_0x8c7f('0x6')]&&_0x4454c6[_0x8c7f('0x6')]!=='id'){_0x262955['associatedResources']=_['map'](_0x47b590,function(_0x4b55a9){return _0x4b55a9[_0x4454c6[_0x8c7f('0x6')]];});}else{if(_0x4a3092===_0x8c7f('0xf')){_0x262955[_0x8c7f('0xa')]=_[_0x8c7f('0xc')](_0x47b590,function(_0x43143e){return{'id':_0x43143e['resourceId'],'type':_0x43143e['type']};});}else{_0x262955['associatedResources']=_[_0x8c7f('0xc')](_0x47b590,function(_0x3f8b94){return _0x3f8b94['resourceId'];});}}_0x35f096(_0x262955);})[_0x8c7f('0xd')](function(_0x4d1f95){_0x22c0ba(_0x4d1f95);});});}function _0x52f95f(_0x1b81ca,_0x358b2c){var _0xb2598={'parentSections':[]};switch(_0x1b81ca['toLowerCase']()){case _0x8c7f('0x10'):_0xb2598[_0x8c7f('0x11')]='SquareProject';break;case _0x8c7f('0x12'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x13');break;case _0x8c7f('0x14'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x15');_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x17'),'field':'name','foreignKey':_0x8c7f('0x18')}];break;case'projects':_0xb2598[_0x8c7f('0x11')]='JscriptyProject';break;case _0x8c7f('0x19'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x1a');_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x1b'),'field':'id','foreignKey':_0x8c7f('0x1c')}];break;case _0x8c7f('0x1d'):_0xb2598[_0x8c7f('0x11')]='CmList';break;case _0x8c7f('0x1e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x1f');break;case _0x8c7f('0x20'):_0xb2598[_0x8c7f('0x11')]='CmCustomField';break;case _0x8c7f('0x21'):_0xb2598[_0x8c7f('0x11')]='ChatQueue';break;case _0x8c7f('0x22'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x23');break;case _0x8c7f('0x24'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x25');break;case _0x8c7f('0x26'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x27');break;case _0x8c7f('0x28'):case _0x8c7f('0x29'):case _0x8c7f('0x2a'):_0xb2598['childModel']=_0x8c7f('0x2b');break;case _0x8c7f('0x2c'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x2d');break;case _0x8c7f('0x2e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x2f');break;case _0x8c7f('0x30'):_0xb2598[_0x8c7f('0x11')]='VoiceRecording';_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x31'),'field':_0x8c7f('0x32'),'foreignKey':_0x8c7f('0x33'),'model':_0x8c7f('0x34'),'filter':{'field':'role','value':[_0x8c7f('0x35')]}},{'name':_0x8c7f('0x36'),'field':'name','foreignKey':_0x8c7f('0x33'),'model':_0x8c7f('0x34'),'filter':{'field':_0x8c7f('0x37'),'value':[_0x8c7f('0x38')]}},{'name':_0x8c7f('0x39'),'field':'name','foreignKey':_0x8c7f('0x3a'),'model':_0x8c7f('0x3b'),'filter':{'field':_0x8c7f('0x3c'),'value':[_0x8c7f('0x3d')]}},{'name':_0x8c7f('0x3e'),'field':_0x8c7f('0x32'),'foreignKey':_0x8c7f('0x3a'),'model':_0x8c7f('0x3b'),'filter':{'field':_0x8c7f('0x3c'),'value':['outbound']}}];break;case _0x8c7f('0x3f'):_0xb2598['childModel']='VoiceMusicOnHold';break;case _0x8c7f('0x40'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x41');break;case _0x8c7f('0x42'):_0xb2598[_0x8c7f('0x11')]='VoicePrefix';break;case _0x8c7f('0x43'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x44');break;case'mailqueues':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x45');break;case _0x8c7f('0x46'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x47');break;case'mailsubstatuses':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x48');break;case _0x8c7f('0x49'):_0xb2598['childModel']='OpenchannelQueue';break;case _0x8c7f('0x4a'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4b');break;case'smsqueues':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4c');break;case _0x8c7f('0x4d'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4e');break;case _0x8c7f('0x4f'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x50');break;case _0x8c7f('0x51'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x52');break;case _0x8c7f('0x53'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x54');break;case _0x8c7f('0x55'):case _0x8c7f('0x56'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x3b');if(_0x358b2c){_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x39')},{'name':_0x8c7f('0x3e')}];}break;case _0x8c7f('0x57'):case _0x8c7f('0x58'):case _0x8c7f('0x59'):_0xb2598[_0x8c7f('0x11')]='User';if(_0x358b2c){_0xb2598[_0x8c7f('0x16')]=[{'name':'Users','filter':{'field':'role','value':['admin',_0x8c7f('0x5a')]},'ignore':!![]},{'name':_0x8c7f('0x31')},{'name':_0x8c7f('0x36')}];}break;case _0x8c7f('0x5b'):_0xb2598['childModel']=_0x8c7f('0x5c');break;case'salesforceaccounts':_0xb2598['childModel']=_0x8c7f('0x5d');break;case _0x8c7f('0x5e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x5f');break;case _0x8c7f('0x60'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x61');break;case _0x8c7f('0x62'):_0xb2598['childModel']=_0x8c7f('0x63');break;case _0x8c7f('0x64'):_0xb2598['childModel']='ZohoAccount';break;case'vtigeraccounts':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x34');break;case _0x8c7f('0x65'):_0xb2598[_0x8c7f('0x11')]='CannedAnswer';break;case'dispositions':_0xb2598[_0x8c7f('0x11')]='Disposition';break;case'customdashboards':_0xb2598['childModel']='Dashboard';break;case _0x8c7f('0x66'):_0xb2598['childModel']=_0x8c7f('0x67');break;case'pauses':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x68');break;case _0x8c7f('0x69'):_0xb2598['childModel']='Schedule';break;case _0x8c7f('0x6a'):_0xb2598['childModel']=_0x8c7f('0x6b');break;case _0x8c7f('0x6c'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x6d');break;case _0x8c7f('0x6e'):_0xb2598['childModel']=_0x8c7f('0x6f');break;case _0x8c7f('0x70'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x71');break;case _0x8c7f('0x72'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x73');break;case _0x8c7f('0x74'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x75');break;case _0x8c7f('0x76'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x77');break;case _0x8c7f('0x78'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0xf');_0xb2598[_0x8c7f('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x8c7f('0x79')}];break;case _0x8c7f('0x7a'):_0xb2598['childModel']=_0x8c7f('0x7b');break;}return _0xb2598;}function _0x332178(_0x2bd1f1,_0x4d2063){var _0x57b8e1=_0x2bd1f1[_0x8c7f('0x7c')](0x0)[_0x8c7f('0x7d')]()+_0x2bd1f1[_0x8c7f('0x7e')](0x1);var _0x9ceb2c={'type':_0x1065c2['Sequelize'][_0x8c7f('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x4ceb01,_0x57d44e){var _0x2c0880=squel['select']()[_0x8c7f('0x6')](_0x8c7f('0x80')+_0x57b8e1+_0x8c7f('0x81'),'id')[_0x8c7f('0x6')](_0x8c7f('0x82'))[_0x8c7f('0x83')](_0x8c7f('0x84')+_0x2bd1f1+_0x8c7f('0x85'),'ui')[_0x8c7f('0x86')](_0x8c7f('0x87'),_0x4d2063['id']);return _0x1065c2['sequelize'][_0x8c7f('0x88')](_0x2c0880[_0x8c7f('0x89')](),_0x9ceb2c)['then'](function(_0x33addc){_0x4d2063[_0x57b8e1+'OpenTabs']=_0x33addc;_0x4ceb01(_0x33addc);})[_0x8c7f('0xd')](function(_0x558f32){_0x57d44e(_0x558f32);});});}return _0x3ccde4[_0x8c7f('0x8a')]('UserProfile',attributes,{'tableName':_0x8c7f('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xee1731){var _0x1b7e48=require('../../components/parsers/qs');var _0x15e362={'raw':_0xee1731[_0x8c7f('0x88')]['raw'],'where':{}};var _0x4d5421={};var _0x7ab73b={'count':0x0,'rows':[]};var _0x5dcffb=_0xee1731['query'][_0x8c7f('0x8c')];var _0x5a7977=_0xee1731['query']['mergeResources']||![];var _0xe5dcda=_0x52f95f(_0x5dcffb,_0x5a7977);if(!_0xe5dcda[_0x8c7f('0x11')])throw new Error(_0x8c7f('0x8d')+_0x5dcffb+'\x27');var _0x54feb8=[{'name':_0x5dcffb}];if(!_[_0x8c7f('0x8e')](_0xe5dcda[_0x8c7f('0x16')]))_0x54feb8=_0xe5dcda[_0x8c7f('0x16')];var _0xe79e34=[];for(var _0x2c7a37=0x0;_0x2c7a37<_0x54feb8[_0x8c7f('0x8f')];_0x2c7a37++){_0xe79e34[_0x8c7f('0x90')](_0x1065c2[_0x8c7f('0x91')][_0x8c7f('0x92')]({'where':{'userProfileId':_0xee1731[_0x8c7f('0x93')]['id'],'name':_0x54feb8[_0x2c7a37][_0x8c7f('0x32')]},'raw':!![]}));}return Promise[_0x8c7f('0x94')](_0xe79e34)[_0x8c7f('0x9')](function(_0x5edd88){var _0x57d0aa=_[_0x8c7f('0x5')](_0x5edd88,function(_0x48352d){return _0x48352d?_0x48352d:undefined;});var _0x1d528f=_[_0x8c7f('0x5')](_0x54feb8,['ignore',!![]]);var _0x391858=_[_0x8c7f('0x8e')](_0x57d0aa)&&_[_0x8c7f('0x8e')](_0x1d528f)?null:_[_0x8c7f('0x95')](_0x1d528f,_0x57d0aa);if(!_0x391858)return null;var _0x128d43=[];for(var _0x3641d1=0x0;_0x3641d1<_0x391858[_0x8c7f('0x8f')];_0x3641d1++){var _0x3931fb=_['find'](_0x54feb8,function(_0x361a6c){return _0x391858[_0x3641d1]?_0x361a6c[_0x8c7f('0x32')]===_0x391858[_0x3641d1][_0x8c7f('0x32')]:null;});if(_0x3931fb){if(_0x391858[_0x3641d1][_0x8c7f('0x96')]){_0x128d43[_0x8c7f('0x90')](_0x3e3ec2(_0xe5dcda[_0x8c7f('0x11')],_0x391858[_0x3641d1]));}else{if(!_0x391858[_0x3641d1][_0x8c7f('0x97')]){_0x128d43[_0x8c7f('0x90')](_0x14494a(_0x3931fb,_0x391858[_0x3641d1],_0xe5dcda['childModel']));}else{if(_0x3931fb['model']){_0x128d43['push'](_0x40facc(_0x3931fb,_0x391858[_0x3641d1]));}}}}}return Promise[_0x8c7f('0x94')](_0x128d43);})[_0x8c7f('0x9')](function(_0x5edf48){var _0x53d6f9=_0x5edf48;var _0x13da8b=null;if(_0x53d6f9){_0x13da8b=_0x53d6f9[_0x8c7f('0x8f')]===0x1?_0x53d6f9[0x0]:null;}if(!_0x13da8b&&!_0x53d6f9)return _0x7ab73b;var _0x3a31a2=_0x1065c2[_0xe5dcda['childModel']][_0x8c7f('0x98')];_0x4d5421[_0x8c7f('0xb')]=_[_0x8c7f('0x99')](_0x3a31a2);_0x4d5421[_0x8c7f('0x88')]=_[_0x8c7f('0x99')](_0xee1731[_0x8c7f('0x88')]);_0x4d5421['filters']=_[_0x8c7f('0x9a')](_0x4d5421['model'],_0x4d5421['query']);_0x15e362[_0x8c7f('0x9b')]=_[_0x8c7f('0x9a')](_0x4d5421[_0x8c7f('0xb')],_0x1b7e48['fields'](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9c')]));_0x15e362[_0x8c7f('0x9b')]=_0x15e362[_0x8c7f('0x9b')][_0x8c7f('0x8f')]?_0x15e362[_0x8c7f('0x9b')]:_0x4d5421[_0x8c7f('0xb')];if(!_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9d')]('nolimit')){_0x15e362[_0x8c7f('0x9e')]=_0x1b7e48[_0x8c7f('0x9e')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9e')]);_0x15e362[_0x8c7f('0x9f')]=_0x1b7e48[_0x8c7f('0x9f')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9f')]);}_0x15e362[_0x8c7f('0xa0')]=_0x1b7e48['sort'](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xa1')]);_0x15e362[_0x8c7f('0x86')]=_0x1b7e48['filters'](_[_0x8c7f('0xa2')](_0xee1731[_0x8c7f('0x88')],_0x4d5421['filters']));if(_0xee1731['query'][_0x8c7f('0x5')]){_0x15e362[_0x8c7f('0x86')]=_['merge'](_0x15e362[_0x8c7f('0x86')],{'$or':_[_0x8c7f('0xc')](_0x3a31a2,function(_0x58480){if(_0x58480[_0x8c7f('0x3c')][_0x8c7f('0xa3')]!==_0x8c7f('0xa4')){var _0x18f3f7={};_0x18f3f7[_0x58480['field']]={'$like':'%'+_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x5')]+'%'};return _0x18f3f7;}})});}var _0x1c53fc=[];var _0x407d69=null;var _0x13cea0={};if(_0x13da8b){_0x407d69=_[_0x8c7f('0x92')](_0x54feb8,['name',_0x13da8b[_0x8c7f('0x32')]]);if(_0x407d69[_0x8c7f('0x6')]){_0x13cea0={};if(_0xe5dcda['childModel']==='AnalyticExtractedReport'){_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_[_0x8c7f('0xc')](_0x13da8b[_0x8c7f('0xa')],'id');}else{_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_0x13da8b[_0x8c7f('0xa')];}_0x1c53fc['push'](_0x13cea0);}else{_0x15e362[_0x8c7f('0x86')]['id']=_0x13da8b[_0x8c7f('0xa')];}}else{for(var _0x7e32cb=0x0;_0x7e32cb<_0x53d6f9[_0x8c7f('0x8f')];_0x7e32cb++){_0x407d69=_[_0x8c7f('0x92')](_0x54feb8,['name',_0x53d6f9[_0x7e32cb][_0x8c7f('0x32')]]);if(_0x407d69[_0x8c7f('0x6')]){_0x13cea0={};_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_0x53d6f9[_0x7e32cb][_0x8c7f('0xa')];_0x1c53fc[_0x8c7f('0x90')](_0x13cea0);}else{if(!_0x15e362[_0x8c7f('0x86')]['id'])_0x15e362[_0x8c7f('0x86')]['id']=[];_0x53d6f9[_0x7e32cb][_0x8c7f('0xa')][_0x8c7f('0xa6')](function(_0x580409){_0x15e362['where']['id'][_0x8c7f('0x90')](_0x580409);});}}}if(!_['isEmpty'](_0x1c53fc)){_0x15e362[_0x8c7f('0x86')]=_[_0x8c7f('0xa7')](_0x15e362['where'],{'$and':{'$or':_0x1c53fc}});}_0x15e362=_[_0x8c7f('0xa7')]({},_0x15e362,_0xee1731[_0x8c7f('0xa8')]);if(_0x13da8b&&!_0x13da8b[_0x8c7f('0x97')]&&_0xe5dcda['childModel']===_0x8c7f('0xf')){if(_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xa9')]){_0x15e362[_0x8c7f('0xaa')]=[{'all':!![]}];}return _0x1065c2[_0xe5dcda[_0x8c7f('0x11')]][_0x8c7f('0x8')](_0x15e362)['then'](function(_0x4d3019){var _0x34e721=[];_0x4d3019['forEach'](function(_0x486e5a){var _0x1d54a4;switch(_0x486e5a[_0x8c7f('0xab')]){case'default':_0x1d54a4=_[_0x8c7f('0x92')](_0x13da8b[_0x8c7f('0xa')],function(_0x34f6db){return _0x34f6db['id']===_0x486e5a[_0x8c7f('0x79')]&&_0x34f6db[_0x8c7f('0x3c')]===_0x8c7f('0xac');});break;case'custom':_0x1d54a4=_[_0x8c7f('0x92')](_0x13da8b[_0x8c7f('0xa')],function(_0x4027d1){return _0x4027d1['id']===_0x486e5a[_0x8c7f('0x79')]&&_0x4027d1['type']==='CustomReports';});break;}if(_0x1d54a4)_0x34e721[_0x8c7f('0x90')](_0x486e5a);});_0x7ab73b[_0x8c7f('0xad')]=_0x34e721[_0x8c7f('0x8f')];_0x7ab73b[_0x8c7f('0xae')]=_0x34e721;return _0x7ab73b;});}else{if(!_[_0x8c7f('0x8e')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xaf')])){_0x15e362['where']['id']=_0x15e362[_0x8c7f('0x86')]['id']?_[_0x8c7f('0x9a')](_0x15e362[_0x8c7f('0x86')]['id'],_0xee1731[_0x8c7f('0x88')]['ids']):_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xaf')];if(_0xee1731[_0x8c7f('0x88')]['customSorting']){_0x15e362[_0x8c7f('0xa0')]=_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb0')];}}if(_0xee1731[_0x8c7f('0x88')]['extraQueryConditions']){_0x15e362[_0x8c7f('0x86')]=_[_0x8c7f('0xa7')](_0x15e362[_0x8c7f('0x86')],{'$and':_0xee1731[_0x8c7f('0x88')]['extraQueryConditions']});}return _0x1065c2[_0xe5dcda['childModel']][_0x8c7f('0xad')]({'where':_0x15e362[_0x8c7f('0x86')]})[_0x8c7f('0x9')](function(_0x27c7af){_0x7ab73b[_0x8c7f('0xad')]=_0x27c7af;if(_0xee1731[_0x8c7f('0x88')]['includeAll']){if(_0xe5dcda[_0x8c7f('0x11')]===_0x8c7f('0x1a')){_0x15e362[_0x8c7f('0xaa')]=[{'model':_0x1065c2['Tag'],'as':_0x8c7f('0xb1'),'attributes':['id',_0x8c7f('0x32'),_0x8c7f('0xb2')],'required':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]?!![]:![]},{'model':_0x1065c2['Tag'],'as':_0x8c7f('0xb4'),'attributes':['id',_0x8c7f('0x32'),_0x8c7f('0xb2')],'through':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]?{'attributes':[],'where':{'TagId':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]||undefined}}:{},'required':_0xee1731['query'][_0x8c7f('0xb3')]?!![]:![]}];}else{_0x15e362['include']=[{'all':!![]}];}}return _0x1065c2[_0xe5dcda[_0x8c7f('0x11')]][_0x8c7f('0x8')](_0x15e362);})[_0x8c7f('0x9')](function(_0xb33be9){_0x7ab73b['rows']=_0xb33be9;if(_0x5dcffb===_0x8c7f('0x31')&&_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb5')]===_0x8c7f('0xb6')){var _0x1c7adf=[];for(var _0x28d89a=0x0;_0x28d89a<_0x7ab73b['rows'][_0x8c7f('0x8f')];_0x28d89a++){_0x1c7adf['push'](_0x332178(_0x8c7f('0xb7'),_0x7ab73b['rows'][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf[_0x8c7f('0x90')](_0x332178('sms',_0x7ab73b[_0x8c7f('0xae')][_0x28d89a]['dataValues']));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xb9'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf['push'](_0x332178(_0x8c7f('0xba'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xbb'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a]['dataValues']));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xbc'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));}return Promise[_0x8c7f('0x94')](_0x1c7adf)['then'](function(){return _0x7ab73b;});}return _0x7ab73b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5692963..664fbb8 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 _0x110e=['info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfile,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x209a38,_0x4bbe11){var _0x10ed34=function(_0x453762){while(--_0x453762){_0x209a38['push'](_0x209a38['shift']());}};_0x10ed34(++_0x4bbe11);}(_0x110e,0x68));var _0xe110=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x110e[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});config[_0xe110('0x8')]=_[_0xe110('0x9')](config[_0xe110('0x8')],{'host':_0xe110('0xa'),'port':0x18eb});var socket=require(_0xe110('0xb'))(new Redis(config[_0xe110('0x8')]));require(_0xe110('0xc'))[_0xe110('0xd')](socket);function respondWithRpcPromise(_0x3985c9,_0x47a535,_0x2df21e){return new BPromise(function(_0x435722,_0x5ebe72){return client[_0xe110('0xe')](_0x3985c9,_0x2df21e)[_0xe110('0xf')](function(_0x326a5a){logger[_0xe110('0x10')]('UserProfile,\x20%s,\x20%s',_0x47a535,'request\x20sent');logger['debug'](_0xe110('0x11'),_0x47a535,_0xe110('0x12'),JSON['stringify'](_0x326a5a));if(_0x326a5a['error']){if(_0x326a5a['error'][_0xe110('0x13')]===0x1f4){logger[_0xe110('0x14')]('UserProfile,\x20%s,\x20%s',_0x47a535,_0x326a5a['error'][_0xe110('0x15')]);return _0x5ebe72(_0x326a5a['error'][_0xe110('0x15')]);}logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x326a5a[_0xe110('0x14')]['message']);return _0x435722(_0x326a5a[_0xe110('0x14')][_0xe110('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x47a535,_0xe110('0x12'));_0x435722(_0x326a5a['result'][_0xe110('0x15')]);}})[_0xe110('0x17')](function(_0x47fff8){logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x47fff8);_0x5ebe72(_0x47fff8);});});} \ No newline at end of file +var _0x110e=['info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfile,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x55f315,_0x2c11db){var _0x55624b=function(_0x241aea){while(--_0x241aea){_0x55f315['push'](_0x55f315['shift']());}};_0x55624b(++_0x2c11db);}(_0x110e,0x68));var _0xe110=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x110e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});config[_0xe110('0x8')]=_[_0xe110('0x9')](config[_0xe110('0x8')],{'host':_0xe110('0xa'),'port':0x18eb});var socket=require(_0xe110('0xb'))(new Redis(config[_0xe110('0x8')]));require(_0xe110('0xc'))[_0xe110('0xd')](socket);function respondWithRpcPromise(_0x3985c9,_0x47a535,_0x2df21e){return new BPromise(function(_0x435722,_0x5ebe72){return client[_0xe110('0xe')](_0x3985c9,_0x2df21e)[_0xe110('0xf')](function(_0x326a5a){logger[_0xe110('0x10')]('UserProfile,\x20%s,\x20%s',_0x47a535,'request\x20sent');logger['debug'](_0xe110('0x11'),_0x47a535,_0xe110('0x12'),JSON['stringify'](_0x326a5a));if(_0x326a5a['error']){if(_0x326a5a['error'][_0xe110('0x13')]===0x1f4){logger[_0xe110('0x14')]('UserProfile,\x20%s,\x20%s',_0x47a535,_0x326a5a['error'][_0xe110('0x15')]);return _0x5ebe72(_0x326a5a['error'][_0xe110('0x15')]);}logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x326a5a[_0xe110('0x14')]['message']);return _0x435722(_0x326a5a[_0xe110('0x14')][_0xe110('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x47a535,_0xe110('0x12'));_0x435722(_0x326a5a['result'][_0xe110('0x15')]);}})[_0xe110('0x17')](function(_0x47fff8){logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x47fff8);_0x5ebe72(_0x47fff8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 332daa8..0b69b4f 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 _0x1c1b=['save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x18c62c,_0x155f10){var _0x57fe3d=function(_0x4b7473){while(--_0x4b7473){_0x18c62c['push'](_0x18c62c['shift']());}};_0x57fe3d(++_0x155f10);}(_0x1c1b,0x80));var _0xb1c1=function(_0x376136,_0x2c5511){_0x376136=_0x376136-0x0;var _0x3483f3=_0x1c1b[_0x376136];return _0x3483f3;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xb1c1('0x0'),_0xb1c1('0x1'),_0xb1c1('0x2')];function createListener(_0x238914,_0x3aa7fb){return function(_0x20fe40){_0x3aa7fb[_0xb1c1('0x3')](_0x238914,_0x20fe40);};}function removeListener(_0x318209,_0x4a59fe){return function(){UserProfileEvents[_0xb1c1('0x4')](_0x318209,_0x4a59fe);};}exports[_0xb1c1('0x5')]=function(_0x25033b){for(var _0x3f43e1=0x0,_0x1cb5a1=events[_0xb1c1('0x6')];_0x3f43e1<_0x1cb5a1;_0x3f43e1++){var _0x5abda9=events[_0x3f43e1];var _0x29d64e=createListener(_0xb1c1('0x7')+_0x5abda9,_0x25033b);UserProfileEvents['on'](_0x5abda9,_0x29d64e);}}; \ No newline at end of file +var _0x4a31=['userProfile:','save','remove','update','emit','removeListener','register','length'];(function(_0x27e8f2,_0x19c3ed){var _0x3aff23=function(_0x3366ac){while(--_0x3366ac){_0x27e8f2['push'](_0x27e8f2['shift']());}};_0x3aff23(++_0x19c3ed);}(_0x4a31,0xf1));var _0x14a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a31[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x14a3('0x0'),_0x14a3('0x1'),_0x14a3('0x2')];function createListener(_0x594d02,_0x2efaa5){return function(_0x2404f2){_0x2efaa5[_0x14a3('0x3')](_0x594d02,_0x2404f2);};}function removeListener(_0x4c3c1d,_0x223a94){return function(){UserProfileEvents[_0x14a3('0x4')](_0x4c3c1d,_0x223a94);};}exports[_0x14a3('0x5')]=function(_0x51cc86){for(var _0x2f6b58=0x0,_0x5530d7=events[_0x14a3('0x6')];_0x2f6b58<_0x5530d7;_0x2f6b58++){var _0x10d5b1=events[_0x2f6b58];var _0x18bb02=createListener(_0x14a3('0x7')+_0x10d5b1,_0x51cc86);UserProfileEvents['on'](_0x10d5b1,_0x18bb02);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bbfdd8c..1c6e883 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 _0x3840=['/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x222951,_0x302864){var _0x2f9752=function(_0x53bd50){while(--_0x53bd50){_0x222951['push'](_0x222951['shift']());}};_0x2f9752(++_0x302864);}(_0x3840,0x15e));var _0x0384=function(_0x41eb27,_0x4f29bb){_0x41eb27=_0x41eb27-0x0;var _0x26a9e6=_0x3840[_0x41eb27];return _0x26a9e6;};'use strict';var multer=require(_0x0384('0x0'));var util=require('util');var path=require(_0x0384('0x1'));var timeout=require(_0x0384('0x2'));var express=require(_0x0384('0x3'));var router=express['Router']();var fs_extra=require(_0x0384('0x4'));var auth=require(_0x0384('0x5'));var interaction=require(_0x0384('0x6'));var config=require(_0x0384('0x7'));var controller=require(_0x0384('0x8'));router[_0x0384('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0384('0x9')](_0x0384('0xa'),auth[_0x0384('0xb')](),controller['describe']);router[_0x0384('0x9')](_0x0384('0xc'),auth['isAuthenticated'](),controller[_0x0384('0xd')]);router[_0x0384('0xe')]('/',auth[_0x0384('0xb')](),controller[_0x0384('0xf')]);router['put'](_0x0384('0xc'),auth[_0x0384('0xb')](),controller[_0x0384('0x10')]);router[_0x0384('0x11')](_0x0384('0xc'),auth[_0x0384('0xb')](),controller[_0x0384('0x12')]);module[_0x0384('0x13')]=router; \ No newline at end of file +var _0xc260=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0xc260,0x10f));var _0x0c26=function(_0x5e6d61,_0x44e9c7){_0x5e6d61=_0x5e6d61-0x0;var _0x4aec58=_0xc260[_0x5e6d61];return _0x4aec58;};'use strict';var multer=require(_0x0c26('0x0'));var util=require(_0x0c26('0x1'));var path=require(_0x0c26('0x2'));var timeout=require(_0x0c26('0x3'));var express=require(_0x0c26('0x4'));var router=express['Router']();var fs_extra=require(_0x0c26('0x5'));var auth=require(_0x0c26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c26('0x7'));var controller=require('./userProfileResource.controller');router[_0x0c26('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c26('0x9')]);router[_0x0c26('0x8')](_0x0c26('0xa'),auth[_0x0c26('0xb')](),controller[_0x0c26('0xc')]);router['get'](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0xe')]);router[_0x0c26('0xf')]('/',auth[_0x0c26('0xb')](),controller[_0x0c26('0x10')]);router[_0x0c26('0x11')](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0x12')]);router['delete'](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0x13')]);module[_0x0c26('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8e58df4..f2ba331 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 _0xa821=['sequelize','STRING','INTEGER'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xa821,0x17a));var _0x1a82=function(_0x30a5f6,_0x2e582a){_0x30a5f6=_0x30a5f6-0x0;var _0x2bc67c=_0xa821[_0x30a5f6];return _0x2bc67c;};'use strict';var Sequelize=require(_0x1a82('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a82('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1a82('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1a82('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0d8f=['INTEGER','STRING','sequelize','exports'];(function(_0x3869fa,_0x16ef3f){var _0x209652=function(_0x527167){while(--_0x527167){_0x3869fa['push'](_0x3869fa['shift']());}};_0x209652(++_0x16ef3f);}(_0x0d8f,0x11e));var _0xf0d8=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x0d8f[_0x4c98b9];return _0x3a257a;};'use strict';var Sequelize=require(_0xf0d8('0x0'));module[_0xf0d8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf0d8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf0d8('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 7c9b906..a828068 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x52c691,_0x565162){var _0xdefb85=function(_0xa973dd){while(--_0xa973dd){_0x52c691['push'](_0x52c691['shift']());}};_0xdefb85(++_0x565162);}(_0x4975,0x86));var _0x5497=function(_0x2deace,_0x3b5163){_0x2deace=_0x2deace-0x0;var _0x23bc20=_0x4975[_0x2deace];return _0x23bc20;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1f184a,_0x19ff0c){var _0x5780b1=function(_0x290490){while(--_0x290490){_0x1f184a['push'](_0x1f184a['shift']());}};_0x5780b1(++_0x19ff0c);}(_0x4c60,0xc1));var _0x04c6=function(_0x327351,_0x6c9e7d){_0x327351=_0x327351-0x0;var _0x54d1e8=_0x4c60[_0x327351];return _0x54d1e8;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0aec338..dca1f30 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 _0x4eec=['bluebird','request-promise','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','../../config/logger','moment'];(function(_0x105b3a,_0x3f146c){var _0x561a8f=function(_0x566e07){while(--_0x566e07){_0x105b3a['push'](_0x105b3a['shift']());}};_0x561a8f(++_0x3f146c);}(_0x4eec,0x159));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4ee('0x0'));var util=require('util');var logger=require(_0xc4ee('0x1'))('api');var moment=require(_0xc4ee('0x2'));var BPromise=require(_0xc4ee('0x3'));var rp=require(_0xc4ee('0x4'));var fs=require('fs');var path=require(_0xc4ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4ee('0x6'));module[_0xc4ee('0x7')]=function(_0x127538,_0x475a5f){return _0x127538[_0xc4ee('0x8')](_0xc4ee('0x9'),attributes,{'tableName':_0xc4ee('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xc4ee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2d2=['exports','UserProfileResource','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a41fb,_0x149269){var _0x44b1b8=function(_0x5e9024){while(--_0x5e9024){_0x2a41fb['push'](_0x2a41fb['shift']());}};_0x44b1b8(++_0x149269);}(_0xe2d2,0x1a9));var _0x2e2d=function(_0x28b836,_0x2ce2d){_0x28b836=_0x28b836-0x0;var _0x347ea8=_0xe2d2[_0x28b836];return _0x347ea8;};'use strict';var _=require('lodash');var util=require(_0x2e2d('0x0'));var logger=require(_0x2e2d('0x1'))(_0x2e2d('0x2'));var moment=require(_0x2e2d('0x3'));var BPromise=require(_0x2e2d('0x4'));var rp=require(_0x2e2d('0x5'));var fs=require('fs');var path=require(_0x2e2d('0x6'));var rimraf=require(_0x2e2d('0x7'));var config=require(_0x2e2d('0x8'));var attributes=require('./userProfileResource.attributes');module[_0x2e2d('0x9')]=function(_0xe8c1ca,_0x1fc125){return _0xe8c1ca['define'](_0x2e2d('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2e2d('0xb'),'fields':[_0x2e2d('0xc'),_0x2e2d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a8ea9be..88f4656 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 _0x8b85=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring'];(function(_0x408fe0,_0x2b49c0){var _0x21b8b1=function(_0x57158a){while(--_0x57158a){_0x408fe0['push'](_0x408fe0['shift']());}};_0x21b8b1(++_0x2b49c0);}(_0x8b85,0x1a0));var _0x58b8=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0x8b85[_0x17fd65];return _0x27d033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58b8('0x0'));var BPromise=require('bluebird');var rs=require(_0x58b8('0x1'));var fs=require('fs');var Redis=require(_0x58b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x58b8('0x3'));var logger=require('../../config/logger')(_0x58b8('0x4'));var config=require(_0x58b8('0x5'));var jayson=require(_0x58b8('0x6'));var client=jayson[_0x58b8('0x7')][_0x58b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2027f6,_0x2437f2,_0x1eeac2){return new BPromise(function(_0x5b32ac,_0x31279d){return client['request'](_0x2027f6,_0x1eeac2)['then'](function(_0x2f3e43){logger[_0x58b8('0x9')](_0x58b8('0xa'),_0x2437f2,_0x58b8('0xb'));logger[_0x58b8('0xc')](_0x58b8('0xd'),_0x2437f2,_0x58b8('0xb'),JSON['stringify'](_0x2f3e43));if(_0x2f3e43[_0x58b8('0xe')]){if(_0x2f3e43['error'][_0x58b8('0xf')]===0x1f4){logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x2f3e43['error'][_0x58b8('0x10')]);return _0x31279d(_0x2f3e43['error'][_0x58b8('0x10')]);}logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x2f3e43[_0x58b8('0xe')][_0x58b8('0x10')]);return _0x5b32ac(_0x2f3e43[_0x58b8('0xe')][_0x58b8('0x10')]);}else{logger[_0x58b8('0x9')](_0x58b8('0xa'),_0x2437f2,_0x58b8('0xb'));_0x5b32ac(_0x2f3e43[_0x58b8('0x11')][_0x58b8('0x10')]);}})[_0x58b8('0x12')](function(_0x51916b){logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x51916b);_0x31279d(_0x51916b);});});} \ No newline at end of file +var _0xf474=['http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4fcc4a,_0x4aaa88){var _0x50f8fa=function(_0x24abf6){while(--_0x24abf6){_0x4fcc4a['push'](_0x4fcc4a['shift']());}};_0x50f8fa(++_0x4aaa88);}(_0xf474,0x1ba));var _0x4f47=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf474[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f47('0x0'));var fs=require('fs');var Redis=require(_0x4f47('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f47('0x2'));var logger=require(_0x4f47('0x3'))(_0x4f47('0x4'));var config=require(_0x4f47('0x5'));var jayson=require(_0x4f47('0x6'));var client=jayson[_0x4f47('0x7')][_0x4f47('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58f525,_0x23ebd5,_0x4f6d32){return new BPromise(function(_0x4f7862,_0x3f0832){return client['request'](_0x58f525,_0x4f6d32)['then'](function(_0x3ef184){logger[_0x4f47('0x9')](_0x4f47('0xa'),_0x23ebd5,_0x4f47('0xb'));logger[_0x4f47('0xc')](_0x4f47('0xd'),_0x23ebd5,_0x4f47('0xb'),JSON[_0x4f47('0xe')](_0x3ef184));if(_0x3ef184[_0x4f47('0xf')]){if(_0x3ef184[_0x4f47('0xf')][_0x4f47('0x10')]===0x1f4){logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x3ef184[_0x4f47('0xf')][_0x4f47('0x11')]);return _0x3f0832(_0x3ef184[_0x4f47('0xf')][_0x4f47('0x11')]);}logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x3ef184[_0x4f47('0xf')]['message']);return _0x4f7862(_0x3ef184[_0x4f47('0xf')]['message']);}else{logger['info'](_0x4f47('0xa'),_0x23ebd5,'request\x20sent');_0x4f7862(_0x3ef184['result']['message']);}})['catch'](function(_0x222f80){logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x222f80);_0x3f0832(_0x222f80);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 16ab7e8..4407d44 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 _0x2a86=['create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x2a86,0x1b9));var _0x62a8=function(_0x4105d9,_0x4b4d2d){_0x4105d9=_0x4105d9-0x0;var _0x47b984=_0x2a86[_0x4105d9];return _0x47b984;};'use strict';var multer=require(_0x62a8('0x0'));var util=require(_0x62a8('0x1'));var path=require('path');var timeout=require(_0x62a8('0x2'));var express=require(_0x62a8('0x3'));var router=express[_0x62a8('0x4')]();var fs_extra=require(_0x62a8('0x5'));var auth=require(_0x62a8('0x6'));var interaction=require(_0x62a8('0x7'));var config=require(_0x62a8('0x8'));var controller=require('./userProfileSection.controller');router[_0x62a8('0x9')]('/',auth['isAuthenticated'](),controller[_0x62a8('0xa')]);router[_0x62a8('0x9')]('/describe',auth[_0x62a8('0xb')](),controller[_0x62a8('0xc')]);router['get'](_0x62a8('0xd'),auth[_0x62a8('0xb')](),controller[_0x62a8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62a8('0xf')]);router[_0x62a8('0x10')](_0x62a8('0xd'),auth[_0x62a8('0xb')](),controller['update']);router[_0x62a8('0x11')]('/:id',auth[_0x62a8('0xb')](),controller['destroy']);module[_0x62a8('0x12')]=router; \ No newline at end of file +var _0x2261=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update'];(function(_0x18a15d,_0x151ed8){var _0x106897=function(_0x28687e){while(--_0x28687e){_0x18a15d['push'](_0x18a15d['shift']());}};_0x106897(++_0x151ed8);}(_0x2261,0x92));var _0x1226=function(_0x37829b,_0x383b5c){_0x37829b=_0x37829b-0x0;var _0x101a25=_0x2261[_0x37829b];return _0x101a25;};'use strict';var multer=require(_0x1226('0x0'));var util=require(_0x1226('0x1'));var path=require(_0x1226('0x2'));var timeout=require(_0x1226('0x3'));var express=require('express');var router=express[_0x1226('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1226('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1226('0x6'));var controller=require(_0x1226('0x7'));router[_0x1226('0x8')]('/',auth[_0x1226('0x9')](),controller[_0x1226('0xa')]);router[_0x1226('0x8')](_0x1226('0xb'),auth[_0x1226('0x9')](),controller[_0x1226('0xc')]);router['get'](_0x1226('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1226('0xe')]('/',auth[_0x1226('0x9')](),controller['create']);router['put'](_0x1226('0xd'),auth[_0x1226('0x9')](),controller[_0x1226('0xf')]);router[_0x1226('0x10')](_0x1226('0xd'),auth[_0x1226('0x9')](),controller[_0x1226('0x11')]);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 0d3fc11..2be8549 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 _0x3de3=['sequelize','STRING','BOOLEAN','crudPermissions','join','split'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x3de3,0x1ce));var _0x33de=function(_0x57f75,_0x2dd64a){_0x57f75=_0x57f75-0x0;var _0x3fcae9=_0x3de3[_0x57f75];return _0x3fcae9;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'name':{'type':Sequelize[_0x33de('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x33de('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x33de('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x33de('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x33de('0x1')],'set':function(_0xbdd404){this['setDataValue'](_0x33de('0x3'),_0xbdd404?_0xbdd404[_0x33de('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x33de('0x3'))?this['getDataValue'](_0x33de('0x3'))[_0x33de('0x5')](''):[];}}}; \ No newline at end of file +var _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x4dd2bc,_0x1068b0){var _0x271bc4=function(_0x2e249e){while(--_0x2e249e){_0x4dd2bc['push'](_0x4dd2bc['shift']());}};_0x271bc4(++_0x1068b0);}(_0xb688,0xcf));var _0x8b68=function(_0xc48deb,_0x3be5f4){_0xc48deb=_0xc48deb-0x0;var _0x5a4831=_0xb688[_0xc48deb];return _0x5a4831;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 73bddbe..6fe86ee 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 _0xe8f7=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','UserProfileSection','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x297220,_0x49bec5){var _0x532a3e=function(_0x117fd2){while(--_0x117fd2){_0x297220['push'](_0x297220['shift']());}};_0x532a3e(++_0x49bec5);}(_0xe8f7,0x12a));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7e8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8f('0x1'));var jsonpatch=require(_0x7e8f('0x2'));var rp=require(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var Mustache=require(_0x7e8f('0x6'));var util=require(_0x7e8f('0x7'));var path=require(_0x7e8f('0x8'));var sox=require(_0x7e8f('0x9'));var csv=require('to-csv');var ejs=require(_0x7e8f('0xa'));var fs=require('fs');var fs_extra=require(_0x7e8f('0xb'));var _=require(_0x7e8f('0xc'));var squel=require('squel');var crypto=require(_0x7e8f('0xd'));var jsforce=require(_0x7e8f('0xe'));var deskjs=require(_0x7e8f('0xf'));var toCsv=require(_0x7e8f('0x10'));var querystring=require(_0x7e8f('0x11'));var Papa=require(_0x7e8f('0x12'));var Redis=require(_0x7e8f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7e8f('0x14'));var as=require(_0x7e8f('0x15'));var hardwareService=require(_0x7e8f('0x16'));var logger=require(_0x7e8f('0x17'))(_0x7e8f('0x18'));var utils=require(_0x7e8f('0x19'));var config=require(_0x7e8f('0x1a'));var licenseUtil=require(_0x7e8f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49898e,_0x3b2ce6){_0x3b2ce6=_0x3b2ce6||0xcc;return function(_0x46c597){if(_0x46c597){return _0x49898e[_0x7e8f('0x1c')](_0x3b2ce6);}return _0x49898e['status'](_0x3b2ce6)[_0x7e8f('0x1d')]();};}function respondWithResult(_0x28f8d0,_0x1148b2){_0x1148b2=_0x1148b2||0xc8;return function(_0x204ed4){if(_0x204ed4){return _0x28f8d0['status'](_0x1148b2)['json'](_0x204ed4);}};}function respondWithFilteredResult(_0x4a2f72,_0x3518dc){return function(_0x2f03c1){if(_0x2f03c1){var _0x401597=typeof _0x3518dc[_0x7e8f('0x1e')]===_0x7e8f('0x1f')&&typeof _0x3518dc['limit']===_0x7e8f('0x1f');var _0x246dc6=_0x2f03c1[_0x7e8f('0x20')];var _0x3ff56e=_0x401597?0x0:_0x3518dc[_0x7e8f('0x1e')];var _0x54e8e3=_0x401597?_0x2f03c1[_0x7e8f('0x20')]:_0x3518dc[_0x7e8f('0x1e')]+_0x3518dc['limit'];var _0x4bb4dc;if(_0x54e8e3>=_0x246dc6){_0x54e8e3=_0x246dc6;_0x4bb4dc=0xc8;}else{_0x4bb4dc=0xce;}_0x4a2f72[_0x7e8f('0x21')](_0x4bb4dc);return _0x4a2f72[_0x7e8f('0x22')]('Content-Range',_0x3ff56e+'-'+_0x54e8e3+'/'+_0x246dc6)[_0x7e8f('0x23')](_0x2f03c1);}return null;};}function patchUpdates(_0x87e43b){return function(_0x2aad09){try{jsonpatch[_0x7e8f('0x24')](_0x2aad09,_0x87e43b,!![]);}catch(_0x1b87a7){return BPromise[_0x7e8f('0x25')](_0x1b87a7);}return _0x2aad09[_0x7e8f('0x26')]();};}function saveUpdates(_0x4749f9,_0x579e8a){return function(_0x254a25){if(_0x254a25){return _0x254a25[_0x7e8f('0x27')](_0x4749f9)[_0x7e8f('0x28')](function(_0x381b6f){return _0x381b6f;});}return null;};}function removeEntity(_0x447125,_0x27924f){return function(_0x560307){if(_0x560307){return _0x560307[_0x7e8f('0x29')]()['then'](function(){_0x447125[_0x7e8f('0x21')](0xcc)[_0x7e8f('0x1d')]();});}};}function handleEntityNotFound(_0x30c2aa,_0x3d00a9){return function(_0x528234){if(!_0x528234){_0x30c2aa['sendStatus'](0x194);}return _0x528234;};}function handleError(_0x34af99,_0x377c4f){_0x377c4f=_0x377c4f||0x1f4;return function(_0x37d7ed){logger[_0x7e8f('0x2a')](_0x37d7ed[_0x7e8f('0x2b')]);if(_0x37d7ed[_0x7e8f('0x2c')]){delete _0x37d7ed[_0x7e8f('0x2c')];}_0x34af99[_0x7e8f('0x21')](_0x377c4f)['send'](_0x37d7ed);};}exports[_0x7e8f('0x2d')]=function(_0x5031dc,_0x405d05){var _0x1fb015={},_0xfd65c5={},_0x5789a3={'count':0x0,'rows':[]};var _0x444d5c=_['map'](db[_0x7e8f('0x2e')]['rawAttributes'],function(_0x1c91cf){return{'name':_0x1c91cf['fieldName'],'type':_0x1c91cf[_0x7e8f('0x2f')]['key']};});_0xfd65c5[_0x7e8f('0x30')]=_[_0x7e8f('0x31')](_0x444d5c,_0x7e8f('0x2c'));_0xfd65c5[_0x7e8f('0x32')]=_[_0x7e8f('0x33')](_0x5031dc[_0x7e8f('0x32')]);_0xfd65c5[_0x7e8f('0x34')]=_['intersection'](_0xfd65c5[_0x7e8f('0x30')],_0xfd65c5[_0x7e8f('0x32')]);_0x1fb015[_0x7e8f('0x35')]=_['intersection'](_0xfd65c5[_0x7e8f('0x30')],qs[_0x7e8f('0x36')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x36')]));_0x1fb015['attributes']=_0x1fb015[_0x7e8f('0x35')][_0x7e8f('0x37')]?_0x1fb015[_0x7e8f('0x35')]:_0xfd65c5[_0x7e8f('0x30')];if(!_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x38')](_0x7e8f('0x39'))){_0x1fb015['limit']=qs[_0x7e8f('0x3a')](_0x5031dc['query'][_0x7e8f('0x3a')]);_0x1fb015[_0x7e8f('0x1e')]=qs[_0x7e8f('0x1e')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x1e')]);}_0x1fb015['order']=qs[_0x7e8f('0x3b')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3b')]);_0x1fb015[_0x7e8f('0x3c')]=qs[_0x7e8f('0x34')](_[_0x7e8f('0x3d')](_0x5031dc[_0x7e8f('0x32')],_0xfd65c5[_0x7e8f('0x34')]),_0x444d5c);if(_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3e')]){_0x1fb015[_0x7e8f('0x3c')]=_[_0x7e8f('0x3f')](_0x1fb015['where'],{'$or':_['map'](_0x444d5c,function(_0x5a0259){if(_0x5a0259[_0x7e8f('0x2f')]!==_0x7e8f('0x40')){var _0x3b7b15={};_0x3b7b15[_0x5a0259['name']]={'$like':'%'+_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3e')]+'%'};return _0x3b7b15;}})});}_0x1fb015=_[_0x7e8f('0x3f')]({},_0x1fb015,_0x5031dc[_0x7e8f('0x41')]);var _0x14f395={'where':_0x1fb015['where']};return db['UserProfileSection']['count'](_0x14f395)[_0x7e8f('0x28')](function(_0x339c29){_0x5789a3[_0x7e8f('0x20')]=_0x339c29;if(_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x42')]){_0x1fb015[_0x7e8f('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0x7e8f('0x44')](_0x1fb015);})[_0x7e8f('0x28')](function(_0x37c99b){_0x5789a3[_0x7e8f('0x45')]=_0x37c99b;return _0x5789a3;})['then'](respondWithFilteredResult(_0x405d05,_0x1fb015))[_0x7e8f('0x46')](handleError(_0x405d05,null));};exports[_0x7e8f('0x47')]=function(_0x484f15,_0x5bbf9b){var _0x584ba7={'raw':![],'where':{'id':_0x484f15['params']['id']}},_0x1981d0={};_0x1981d0['model']=_[_0x7e8f('0x33')](db[_0x7e8f('0x2e')][_0x7e8f('0x48')]);_0x1981d0[_0x7e8f('0x32')]=_[_0x7e8f('0x33')](_0x484f15[_0x7e8f('0x32')]);_0x1981d0[_0x7e8f('0x34')]=_[_0x7e8f('0x49')](_0x1981d0['model'],_0x1981d0[_0x7e8f('0x32')]);_0x584ba7['attributes']=_[_0x7e8f('0x49')](_0x1981d0['model'],qs[_0x7e8f('0x36')](_0x484f15[_0x7e8f('0x32')]['fields']));_0x584ba7[_0x7e8f('0x35')]=_0x584ba7[_0x7e8f('0x35')][_0x7e8f('0x37')]?_0x584ba7[_0x7e8f('0x35')]:_0x1981d0[_0x7e8f('0x30')];if(_0x484f15[_0x7e8f('0x32')][_0x7e8f('0x42')]){_0x584ba7[_0x7e8f('0x43')]=[{'all':!![]}];}_0x584ba7=_[_0x7e8f('0x3f')]({},_0x584ba7,_0x484f15[_0x7e8f('0x41')]);return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')](_0x584ba7)['then'](handleEntityNotFound(_0x5bbf9b,null))[_0x7e8f('0x28')](respondWithResult(_0x5bbf9b,null))[_0x7e8f('0x46')](handleError(_0x5bbf9b,null));};exports[_0x7e8f('0x4b')]=function(_0x172373,_0x4059b0){return db[_0x7e8f('0x2e')][_0x7e8f('0x4b')](_0x172373[_0x7e8f('0x4c')],{})['then'](respondWithResult(_0x4059b0,0xc9))[_0x7e8f('0x46')](handleError(_0x4059b0,null));};exports[_0x7e8f('0x27')]=function(_0x59b4ae,_0x4b741d){if(_0x59b4ae[_0x7e8f('0x4c')]['id']){delete _0x59b4ae[_0x7e8f('0x4c')]['id'];}return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')]({'where':{'id':_0x59b4ae[_0x7e8f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b741d,null))[_0x7e8f('0x28')](saveUpdates(_0x59b4ae[_0x7e8f('0x4c')],null))[_0x7e8f('0x28')](respondWithResult(_0x4b741d,null))[_0x7e8f('0x46')](handleError(_0x4b741d,null));};exports['destroy']=function(_0x439a66,_0x2835af){return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')]({'where':{'id':_0x439a66['params']['id']}})[_0x7e8f('0x28')](handleEntityNotFound(_0x2835af,null))[_0x7e8f('0x28')](removeEntity(_0x2835af,null))[_0x7e8f('0x46')](handleError(_0x2835af,null));};exports[_0x7e8f('0x4e')]=function(_0x187a6e,_0x51d63d){return db[_0x7e8f('0x2e')]['describe']()[_0x7e8f('0x28')](respondWithResult(_0x51d63d,null))[_0x7e8f('0x46')](handleError(_0x51d63d,null));}; \ No newline at end of file +var _0x3054=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x3054,0x87));var _0x4305=function(_0x2b46db,_0x27b86a){_0x2b46db=_0x2b46db-0x0;var _0x12a5fc=_0x3054[_0x2b46db];return _0x12a5fc;};'use strict';var emlformat=require(_0x4305('0x0'));var rimraf=require(_0x4305('0x1'));var zipdir=require(_0x4305('0x2'));var jsonpatch=require(_0x4305('0x3'));var rp=require(_0x4305('0x4'));var moment=require(_0x4305('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4305('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4305('0x7'));var csv=require(_0x4305('0x8'));var ejs=require(_0x4305('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4305('0xa'));var squel=require('squel');var crypto=require(_0x4305('0xb'));var jsforce=require(_0x4305('0xc'));var deskjs=require(_0x4305('0xd'));var toCsv=require(_0x4305('0x8'));var querystring=require(_0x4305('0xe'));var Papa=require('papaparse');var Redis=require(_0x4305('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4305('0x10'));var hardwareService=require(_0x4305('0x11'));var logger=require(_0x4305('0x12'))(_0x4305('0x13'));var utils=require(_0x4305('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4305('0x15'));var db=require(_0x4305('0x16'))['db'];function respondWithStatusCode(_0x4e5e5d,_0x2be2d2){_0x2be2d2=_0x2be2d2||0xcc;return function(_0x2ef926){if(_0x2ef926){return _0x4e5e5d[_0x4305('0x17')](_0x2be2d2);}return _0x4e5e5d[_0x4305('0x18')](_0x2be2d2)[_0x4305('0x19')]();};}function respondWithResult(_0x3b8229,_0x3f863b){_0x3f863b=_0x3f863b||0xc8;return function(_0x3a02ae){if(_0x3a02ae){return _0x3b8229[_0x4305('0x18')](_0x3f863b)[_0x4305('0x1a')](_0x3a02ae);}};}function respondWithFilteredResult(_0x2687c8,_0x73070c){return function(_0x125a7a){if(_0x125a7a){var _0x2f6a6e=typeof _0x73070c[_0x4305('0x1b')]===_0x4305('0x1c')&&typeof _0x73070c['limit']===_0x4305('0x1c');var _0x3903aa=_0x125a7a['count'];var _0x50429b=_0x2f6a6e?0x0:_0x73070c['offset'];var _0x3f9624=_0x2f6a6e?_0x125a7a[_0x4305('0x1d')]:_0x73070c[_0x4305('0x1b')]+_0x73070c['limit'];var _0x1be8cb;if(_0x3f9624>=_0x3903aa){_0x3f9624=_0x3903aa;_0x1be8cb=0xc8;}else{_0x1be8cb=0xce;}_0x2687c8[_0x4305('0x18')](_0x1be8cb);return _0x2687c8[_0x4305('0x1e')](_0x4305('0x1f'),_0x50429b+'-'+_0x3f9624+'/'+_0x3903aa)['json'](_0x125a7a);}return null;};}function patchUpdates(_0x130038){return function(_0x1fb798){try{jsonpatch[_0x4305('0x20')](_0x1fb798,_0x130038,!![]);}catch(_0x5850a2){return BPromise[_0x4305('0x21')](_0x5850a2);}return _0x1fb798[_0x4305('0x22')]();};}function saveUpdates(_0x2af7c3,_0x3521fa){return function(_0x3bbb27){if(_0x3bbb27){return _0x3bbb27[_0x4305('0x23')](_0x2af7c3)['then'](function(_0x37f9b8){return _0x37f9b8;});}return null;};}function removeEntity(_0x187b2f,_0x130aca){return function(_0x4194a4){if(_0x4194a4){return _0x4194a4[_0x4305('0x24')]()[_0x4305('0x25')](function(){_0x187b2f[_0x4305('0x18')](0xcc)[_0x4305('0x19')]();});}};}function handleEntityNotFound(_0x110dda,_0x40d160){return function(_0x3b6d6b){if(!_0x3b6d6b){_0x110dda[_0x4305('0x17')](0x194);}return _0x3b6d6b;};}function handleError(_0x23fbb2,_0x5cf7f2){_0x5cf7f2=_0x5cf7f2||0x1f4;return function(_0x333cf9){logger[_0x4305('0x26')](_0x333cf9[_0x4305('0x27')]);if(_0x333cf9['name']){delete _0x333cf9['name'];}_0x23fbb2[_0x4305('0x18')](_0x5cf7f2)[_0x4305('0x28')](_0x333cf9);};}exports[_0x4305('0x29')]=function(_0x18cce2,_0x9bc9c){var _0x1731f5={},_0x186d86={},_0x515b6b={'count':0x0,'rows':[]};var _0x1de460=_[_0x4305('0x2a')](db['UserProfileSection'][_0x4305('0x2b')],function(_0x536aab){return{'name':_0x536aab[_0x4305('0x2c')],'type':_0x536aab['type'][_0x4305('0x2d')]};});_0x186d86[_0x4305('0x2e')]=_[_0x4305('0x2a')](_0x1de460,_0x4305('0x2f'));_0x186d86[_0x4305('0x30')]=_[_0x4305('0x31')](_0x18cce2[_0x4305('0x30')]);_0x186d86['filters']=_['intersection'](_0x186d86[_0x4305('0x2e')],_0x186d86[_0x4305('0x30')]);_0x1731f5['attributes']=_[_0x4305('0x32')](_0x186d86[_0x4305('0x2e')],qs[_0x4305('0x33')](_0x18cce2[_0x4305('0x30')][_0x4305('0x33')]));_0x1731f5[_0x4305('0x34')]=_0x1731f5[_0x4305('0x34')][_0x4305('0x35')]?_0x1731f5['attributes']:_0x186d86[_0x4305('0x2e')];if(!_0x18cce2[_0x4305('0x30')][_0x4305('0x36')](_0x4305('0x37'))){_0x1731f5['limit']=qs['limit'](_0x18cce2[_0x4305('0x30')][_0x4305('0x38')]);_0x1731f5[_0x4305('0x1b')]=qs[_0x4305('0x1b')](_0x18cce2['query'][_0x4305('0x1b')]);}_0x1731f5[_0x4305('0x39')]=qs[_0x4305('0x3a')](_0x18cce2[_0x4305('0x30')][_0x4305('0x3a')]);_0x1731f5[_0x4305('0x3b')]=qs[_0x4305('0x3c')](_[_0x4305('0x3d')](_0x18cce2[_0x4305('0x30')],_0x186d86['filters']),_0x1de460);if(_0x18cce2['query'][_0x4305('0x3e')]){_0x1731f5[_0x4305('0x3b')]=_[_0x4305('0x3f')](_0x1731f5['where'],{'$or':_[_0x4305('0x2a')](_0x1de460,function(_0x531f58){if(_0x531f58['type']!==_0x4305('0x40')){var _0x4a424b={};_0x4a424b[_0x531f58[_0x4305('0x2f')]]={'$like':'%'+_0x18cce2[_0x4305('0x30')][_0x4305('0x3e')]+'%'};return _0x4a424b;}})});}_0x1731f5=_[_0x4305('0x3f')]({},_0x1731f5,_0x18cce2[_0x4305('0x41')]);var _0x2e9ae4={'where':_0x1731f5['where']};return db[_0x4305('0x42')]['count'](_0x2e9ae4)[_0x4305('0x25')](function(_0x47ce98){_0x515b6b[_0x4305('0x1d')]=_0x47ce98;if(_0x18cce2[_0x4305('0x30')][_0x4305('0x43')]){_0x1731f5[_0x4305('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x4305('0x45')](_0x1731f5);})[_0x4305('0x25')](function(_0x467732){_0x515b6b['rows']=_0x467732;return _0x515b6b;})[_0x4305('0x25')](respondWithFilteredResult(_0x9bc9c,_0x1731f5))['catch'](handleError(_0x9bc9c,null));};exports[_0x4305('0x46')]=function(_0x146fef,_0x36179a){var _0x4b12d1={'raw':![],'where':{'id':_0x146fef[_0x4305('0x47')]['id']}},_0x1f572c={};_0x1f572c[_0x4305('0x2e')]=_['keys'](db[_0x4305('0x42')][_0x4305('0x2b')]);_0x1f572c[_0x4305('0x30')]=_[_0x4305('0x31')](_0x146fef[_0x4305('0x30')]);_0x1f572c['filters']=_['intersection'](_0x1f572c['model'],_0x1f572c[_0x4305('0x30')]);_0x4b12d1['attributes']=_['intersection'](_0x1f572c[_0x4305('0x2e')],qs[_0x4305('0x33')](_0x146fef[_0x4305('0x30')][_0x4305('0x33')]));_0x4b12d1[_0x4305('0x34')]=_0x4b12d1['attributes']['length']?_0x4b12d1[_0x4305('0x34')]:_0x1f572c['model'];if(_0x146fef['query'][_0x4305('0x43')]){_0x4b12d1['include']=[{'all':!![]}];}_0x4b12d1=_[_0x4305('0x3f')]({},_0x4b12d1,_0x146fef['options']);return db[_0x4305('0x42')]['find'](_0x4b12d1)[_0x4305('0x25')](handleEntityNotFound(_0x36179a,null))[_0x4305('0x25')](respondWithResult(_0x36179a,null))[_0x4305('0x48')](handleError(_0x36179a,null));};exports[_0x4305('0x49')]=function(_0x2ea04c,_0x2990bf){return db[_0x4305('0x42')][_0x4305('0x49')](_0x2ea04c[_0x4305('0x4a')],{})[_0x4305('0x25')](respondWithResult(_0x2990bf,0xc9))[_0x4305('0x48')](handleError(_0x2990bf,null));};exports[_0x4305('0x23')]=function(_0x1750e4,_0x515bd7){if(_0x1750e4[_0x4305('0x4a')]['id']){delete _0x1750e4[_0x4305('0x4a')]['id'];}return db[_0x4305('0x42')][_0x4305('0x4b')]({'where':{'id':_0x1750e4[_0x4305('0x47')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x515bd7,null))[_0x4305('0x25')](saveUpdates(_0x1750e4[_0x4305('0x4a')],null))[_0x4305('0x25')](respondWithResult(_0x515bd7,null))[_0x4305('0x48')](handleError(_0x515bd7,null));};exports[_0x4305('0x24')]=function(_0xd0eda4,_0x24fc55){return db[_0x4305('0x42')][_0x4305('0x4b')]({'where':{'id':_0xd0eda4[_0x4305('0x47')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x24fc55,null))['then'](removeEntity(_0x24fc55,null))[_0x4305('0x48')](handleError(_0x24fc55,null));};exports[_0x4305('0x4c')]=function(_0x20354e,_0x28808a){return db[_0x4305('0x42')][_0x4305('0x4c')]()[_0x4305('0x25')](respondWithResult(_0x28808a,null))[_0x4305('0x48')](handleError(_0x28808a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b3c7f1f..a3c4f63 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 _0x4ed2=['define','compositeIndex','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ed2,0x1d7));var _0x24ed=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ed2[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x24ed('0x0'));var util=require(_0x24ed('0x1'));var logger=require('../../config/logger')(_0x24ed('0x2'));var moment=require(_0x24ed('0x3'));var BPromise=require(_0x24ed('0x4'));var rp=require(_0x24ed('0x5'));var fs=require('fs');var path=require(_0x24ed('0x6'));var rimraf=require(_0x24ed('0x7'));var config=require(_0x24ed('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x24ed('0x9')]=function(_0x5254f4,_0x1aa86d){return _0x5254f4[_0x24ed('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x24ed('0xb'),'fields':['sectionId',_0x24ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab17=['../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x325fa4,_0x1dcf06){var _0x5e20a2=function(_0x55036e){while(--_0x55036e){_0x325fa4['push'](_0x325fa4['shift']());}};_0x5e20a2(++_0x1dcf06);}(_0xab17,0x17f));var _0x7ab1=function(_0x2ea46f,_0x33cfea){_0x2ea46f=_0x2ea46f-0x0;var _0x5d40fd=_0xab17[_0x2ea46f];return _0x5d40fd;};'use strict';var _=require(_0x7ab1('0x0'));var util=require(_0x7ab1('0x1'));var logger=require(_0x7ab1('0x2'))(_0x7ab1('0x3'));var moment=require(_0x7ab1('0x4'));var BPromise=require(_0x7ab1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7ab1('0x6'));var config=require(_0x7ab1('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x7ab1('0x8')]=function(_0x52516c,_0x2fe6c8){return _0x52516c['define'](_0x7ab1('0x9'),attributes,{'tableName':_0x7ab1('0xa'),'paranoid':![],'indexes':[{'name':_0x7ab1('0xb'),'fields':[_0x7ab1('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0643d5e..d6debd7 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 _0xf70f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x5f14c7,_0x3d98b6){var _0x5c2284=function(_0x3b64ad){while(--_0x3b64ad){_0x5f14c7['push'](_0x5f14c7['shift']());}};_0x5c2284(++_0x3d98b6);}(_0xf70f,0x9c));var _0xff70=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0xf70f[_0x7efe31];return _0x59ea5a;};'use strict';var _=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var moment=require(_0xff70('0x2'));var BPromise=require('bluebird');var rs=require(_0xff70('0x3'));var fs=require('fs');var Redis=require(_0xff70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff70('0x5'));var logger=require(_0xff70('0x6'))(_0xff70('0x7'));var config=require(_0xff70('0x8'));var jayson=require(_0xff70('0x9'));var client=jayson[_0xff70('0xa')][_0xff70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a65bf,_0x384f67,_0x381604){return new BPromise(function(_0x1d2083,_0x9fba00){return client[_0xff70('0xc')](_0x4a65bf,_0x381604)['then'](function(_0x274bcb){logger[_0xff70('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x384f67,_0xff70('0xe'));logger[_0xff70('0xf')](_0xff70('0x10'),_0x384f67,_0xff70('0xe'),JSON[_0xff70('0x11')](_0x274bcb));if(_0x274bcb[_0xff70('0x12')]){if(_0x274bcb[_0xff70('0x12')][_0xff70('0x13')]===0x1f4){logger['error'](_0xff70('0x14'),_0x384f67,_0x274bcb['error'][_0xff70('0x15')]);return _0x9fba00(_0x274bcb['error']['message']);}logger[_0xff70('0x12')](_0xff70('0x14'),_0x384f67,_0x274bcb['error']['message']);return _0x1d2083(_0x274bcb[_0xff70('0x12')][_0xff70('0x15')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x384f67,_0xff70('0xe'));_0x1d2083(_0x274bcb[_0xff70('0x16')][_0xff70('0x15')]);}})['catch'](function(_0x5840d0){logger[_0xff70('0x12')](_0xff70('0x14'),_0x384f67,_0x5840d0);_0x9fba00(_0x5840d0);});});} \ No newline at end of file +var _0xb980=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5923be,_0x3023ae){var _0x303700=function(_0x13d05c){while(--_0x13d05c){_0x5923be['push'](_0x5923be['shift']());}};_0x303700(++_0x3023ae);}(_0xb980,0xf9));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b98('0x0'));var util=require(_0x0b98('0x1'));var moment=require('moment');var BPromise=require(_0x0b98('0x2'));var rs=require(_0x0b98('0x3'));var fs=require('fs');var Redis=require(_0x0b98('0x4'));var db=require(_0x0b98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b98('0x6'))(_0x0b98('0x7'));var config=require('../../config/environment');var jayson=require(_0x0b98('0x8'));var client=jayson['client'][_0x0b98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326028,_0x10aa2a,_0x514c62){return new BPromise(function(_0x1274ee,_0x4f9455){return client[_0x0b98('0xa')](_0x326028,_0x514c62)[_0x0b98('0xb')](function(_0x2deebd){logger[_0x0b98('0xc')](_0x0b98('0xd'),_0x10aa2a,_0x0b98('0xe'));logger[_0x0b98('0xf')](_0x0b98('0x10'),_0x10aa2a,'request\x20sent',JSON[_0x0b98('0x11')](_0x2deebd));if(_0x2deebd[_0x0b98('0x12')]){if(_0x2deebd['error'][_0x0b98('0x13')]===0x1f4){logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);return _0x4f9455(_0x2deebd['error'][_0x0b98('0x14')]);}logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);return _0x1274ee(_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);}else{logger['info'](_0x0b98('0xd'),_0x10aa2a,_0x0b98('0xe'));_0x1274ee(_0x2deebd[_0x0b98('0x15')][_0x0b98('0x14')]);}})[_0x0b98('0x16')](function(_0x466a20){logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x466a20);_0x4f9455(_0x466a20);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7ad7b00..febd055 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x20e174,_0x321464){var _0x5c9b21=function(_0x1bec55){while(--_0x1bec55){_0x20e174['push'](_0x20e174['shift']());}};_0x5c9b21(++_0x321464);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x267c3d,_0x23a5bd){var _0x3d7e69=function(_0x6f0cf){while(--_0x6f0cf){_0x267c3d['push'](_0x267c3d['shift']());}};_0x3d7e69(++_0x23a5bd);}(_0xe706,0xa3));var _0x6e70=function(_0x13b3f2,_0x1f230e){_0x13b3f2=_0x13b3f2-0x0;var _0x476495=_0xe706[_0x13b3f2];return _0x476495;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b3e9e5e..6cf7eb3 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 _0xa6aa=['sequelize'];(function(_0x2133d9,_0x1bc974){var _0x5719bf=function(_0x1baad4){while(--_0x1baad4){_0x2133d9['push'](_0x2133d9['shift']());}};_0x5719bf(++_0x1bc974);}(_0xa6aa,0x19b));var _0xaa6a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6aa[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xaa6a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf03=['INTEGER','sequelize'];(function(_0x15499e,_0x439ea4){var _0x576da6=function(_0x510cdc){while(--_0x510cdc){_0x15499e['push'](_0x15499e['shift']());}};_0x576da6(++_0x439ea4);}(_0xbf03,0x1e1));var _0x3bf0=function(_0xe041a7,_0xb8812f){_0xe041a7=_0xe041a7-0x0;var _0x4608cc=_0xbf03[_0xe041a7];return _0x4608cc;};'use strict';var Sequelize=require(_0x3bf0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3bf0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e952692..1d8a8bf 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 _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x278c9b,_0x216e89){var _0x30ce15=function(_0x5b5184){while(--_0x5b5184){_0x278c9b['push'](_0x278c9b['shift']());}};_0x30ce15(++_0x216e89);}(_0x4bd3,0x174));var _0x34bd=function(_0x5b01ce,_0x20b8f4){_0x5b01ce=_0x5b01ce-0x0;var _0x45695a=_0x4bd3[_0x5b01ce];return _0x45695a;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d0a=['user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x3e55ff,_0x579048){var _0x30ca1a=function(_0xa2642c){while(--_0xa2642c){_0x3e55ff['push'](_0x3e55ff['shift']());}};_0x30ca1a(++_0x579048);}(_0x5d0a,0x175));var _0xa5d0=function(_0x350ccf,_0x41e4cc){_0x350ccf=_0x350ccf-0x0;var _0x3cf8a3=_0x5d0a[_0x350ccf];return _0x3cf8a3;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var logger=require(_0xa5d0('0x1'))('api');var moment=require(_0xa5d0('0x2'));var BPromise=require(_0xa5d0('0x3'));var rp=require(_0xa5d0('0x4'));var fs=require('fs');var path=require(_0xa5d0('0x5'));var rimraf=require('rimraf');var config=require(_0xa5d0('0x6'));var attributes=require(_0xa5d0('0x7'));module[_0xa5d0('0x8')]=function(_0x1e90c4,_0x406289){return _0x1e90c4[_0xa5d0('0x9')](_0xa5d0('0xa'),attributes,{'tableName':_0xa5d0('0xb'),'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 27c720c..1c2bb2a 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 _0xcbe5=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2f57d0,_0x5cecc4){var _0x3097e2=function(_0x4b87d7){while(--_0x4b87d7){_0x2f57d0['push'](_0x2f57d0['shift']());}};_0x3097e2(++_0x5cecc4);}(_0xcbe5,0x12e));var _0x5cbe=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcbe5[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x5cbe('0x0'));var moment=require(_0x5cbe('0x1'));var BPromise=require('bluebird');var rs=require(_0x5cbe('0x2'));var fs=require('fs');var Redis=require(_0x5cbe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cbe('0x4'));var logger=require(_0x5cbe('0x5'))(_0x5cbe('0x6'));var config=require(_0x5cbe('0x7'));var jayson=require(_0x5cbe('0x8'));var client=jayson[_0x5cbe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290ef2,_0x173931,_0x2eddc7){return new BPromise(function(_0x260665,_0x2e7043){return client[_0x5cbe('0xa')](_0x290ef2,_0x2eddc7)[_0x5cbe('0xb')](function(_0x6b862e){logger[_0x5cbe('0xc')](_0x5cbe('0xd'),_0x173931,_0x5cbe('0xe'));logger[_0x5cbe('0xf')](_0x5cbe('0x10'),_0x173931,_0x5cbe('0xe'),JSON[_0x5cbe('0x11')](_0x6b862e));if(_0x6b862e[_0x5cbe('0x12')]){if(_0x6b862e[_0x5cbe('0x12')][_0x5cbe('0x13')]===0x1f4){logger['error'](_0x5cbe('0xd'),_0x173931,_0x6b862e[_0x5cbe('0x12')]['message']);return _0x2e7043(_0x6b862e['error'][_0x5cbe('0x14')]);}logger[_0x5cbe('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x173931,_0x6b862e['error']['message']);return _0x260665(_0x6b862e[_0x5cbe('0x12')][_0x5cbe('0x14')]);}else{logger['info'](_0x5cbe('0xd'),_0x173931,_0x5cbe('0xe'));_0x260665(_0x6b862e[_0x5cbe('0x15')][_0x5cbe('0x14')]);}})['catch'](function(_0x252921){logger['error'](_0x5cbe('0xd'),_0x173931,_0x252921);_0x2e7043(_0x252921);});});} \ No newline at end of file +var _0xcee1=['then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2bcc58,_0x2ff8d4){var _0x31d9a5=function(_0x14ebfa){while(--_0x14ebfa){_0x2bcc58['push'](_0x2bcc58['shift']());}};_0x31d9a5(++_0x2ff8d4);}(_0xcee1,0x9e));var _0x1cee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcee1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1cee('0x0'));var fs=require('fs');var Redis=require(_0x1cee('0x1'));var db=require(_0x1cee('0x2'))['db'];var utils=require(_0x1cee('0x3'));var logger=require(_0x1cee('0x4'))(_0x1cee('0x5'));var config=require(_0x1cee('0x6'));var jayson=require(_0x1cee('0x7'));var client=jayson[_0x1cee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc602,_0x31142a,_0xa9e0a4){return new BPromise(function(_0x3e6b26,_0x52845a){return client[_0x1cee('0x9')](_0x1fc602,_0xa9e0a4)[_0x1cee('0xa')](function(_0x90fdf5){logger[_0x1cee('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x31142a,_0x1cee('0xc'));logger[_0x1cee('0xd')](_0x1cee('0xe'),_0x31142a,_0x1cee('0xc'),JSON['stringify'](_0x90fdf5));if(_0x90fdf5['error']){if(_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x10')]===0x1f4){logger[_0x1cee('0xf')](_0x1cee('0x11'),_0x31142a,_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);return _0x52845a(_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x31142a,_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);return _0x3e6b26(_0x90fdf5[_0x1cee('0xf')]['message']);}else{logger[_0x1cee('0xb')](_0x1cee('0x11'),_0x31142a,_0x1cee('0xc'));_0x3e6b26(_0x90fdf5[_0x1cee('0x13')][_0x1cee('0x12')]);}})[_0x1cee('0x14')](function(_0x377f0e){logger[_0x1cee('0xf')](_0x1cee('0x11'),_0x31142a,_0x377f0e);_0x52845a(_0x377f0e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 492f3ae..3f8d318 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8241=['exports','INTEGER','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x8241,0x1c4));var _0x1824=function(_0x2bfbae,_0x4e277d){_0x2bfbae=_0x2bfbae-0x0;var _0x268b16=_0x8241[_0x2bfbae];return _0x268b16;};'use strict';var Sequelize=require(_0x1824('0x0'));module[_0x1824('0x1')]={'UserId':{'type':Sequelize[_0x1824('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfcbd=['sequelize','INTEGER'];(function(_0x35f85d,_0x1810c4){var _0x48a0d4=function(_0x52af94){while(--_0x52af94){_0x35f85d['push'](_0x35f85d['shift']());}};_0x48a0d4(++_0x1810c4);}(_0xfcbd,0x172));var _0xdfcb=function(_0x59ac3b,_0x1f7e06){_0x59ac3b=_0x59ac3b-0x0;var _0x366174=_0xfcbd[_0x59ac3b];return _0x366174;};'use strict';var Sequelize=require(_0xdfcb('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xdfcb('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdfcb('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 946a47a..23c51d5 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x643602,_0x42c3f7){var _0x48ce97=function(_0x5d765b){while(--_0x5d765b){_0x643602['push'](_0x643602['shift']());}};_0x48ce97(++_0x42c3f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5b6437,_0xb2f9dd){var _0x3a3afc=function(_0x3f8a8e){while(--_0x3f8a8e){_0x5b6437['push'](_0x5b6437['shift']());}};_0x3a3afc(++_0xb2f9dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index dfc727d..493e1ff 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x379f05,_0x47bd2c){var _0x359277=function(_0x4ba3fe){while(--_0x4ba3fe){_0x379f05['push'](_0x379f05['shift']());}};_0x359277(++_0x47bd2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c6160,_0x3b11d1){_0x4c6160=_0x4c6160-0x0;var _0x8bacfd=_0xedd9[_0x4c6160];return _0x8bacfd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5961d9,_0x440dab){var _0x35dbd1=function(_0x1d08f2){while(--_0x1d08f2){_0x5961d9['push'](_0x5961d9['shift']());}};_0x35dbd1(++_0x440dab);}(_0x70e0,0x17b));var _0x070e=function(_0xe1ef1d,_0x51c03b){_0xe1ef1d=_0xe1ef1d-0x0;var _0x650f6b=_0x70e0[_0xe1ef1d];return _0x650f6b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 5467d3e..e41f66f 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 _0x1f50=['exports','INTEGER','sequelize'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0x1f50,0xb9));var _0x01f5=function(_0x50e1cf,_0x5b8361){_0x50e1cf=_0x50e1cf-0x0;var _0x39104f=_0x1f50[_0x50e1cf];return _0x39104f;};'use strict';var Sequelize=require(_0x01f5('0x0'));module[_0x01f5('0x1')]={'penalty':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed39=['exports','INTEGER','sequelize'];(function(_0x9b6a5,_0x32fb13){var _0x11da45=function(_0x284eea){while(--_0x284eea){_0x9b6a5['push'](_0x9b6a5['shift']());}};_0x11da45(++_0x32fb13);}(_0xed39,0xa7));var _0x9ed3=function(_0x3098cc,_0xd0179c){_0x3098cc=_0x3098cc-0x0;var _0x5246e4=_0xed39[_0x3098cc];return _0x5246e4;};'use strict';var Sequelize=require(_0x9ed3('0x0'));module[_0x9ed3('0x1')]={'penalty':{'type':Sequelize[_0x9ed3('0x2')],'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 588952a..745c71d 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 _0x482f=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x5ee995,_0x591f41){var _0x509977=function(_0x4f1b90){while(--_0x4f1b90){_0x5ee995['push'](_0x5ee995['shift']());}};_0x509977(++_0x591f41);}(_0x482f,0x93));var _0xf482=function(_0x14885e,_0x2622ef){_0x14885e=_0x14885e-0x0;var _0x264358=_0x482f[_0x14885e];return _0x264358;};'use strict';var _=require(_0xf482('0x0'));var util=require('util');var logger=require(_0xf482('0x1'))(_0xf482('0x2'));var moment=require(_0xf482('0x3'));var BPromise=require(_0xf482('0x4'));var rp=require(_0xf482('0x5'));var fs=require('fs');var path=require(_0xf482('0x6'));var rimraf=require('rimraf');var config=require(_0xf482('0x7'));var attributes=require(_0xf482('0x8'));module[_0xf482('0x9')]=function(_0x133cdf,_0x52c25b){return _0x133cdf[_0xf482('0xa')](_0xf482('0xb'),attributes,{'tableName':_0xf482('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fc=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','user_has_voice_queues'];(function(_0x3355c4,_0x5b8ac1){var _0xcdccfc=function(_0x1fbb8c){while(--_0x1fbb8c){_0x3355c4['push'](_0x3355c4['shift']());}};_0xcdccfc(++_0x5b8ac1);}(_0x00fc,0x1ea));var _0xc00f=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x00fc[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require('lodash');var util=require(_0xc00f('0x0'));var logger=require(_0xc00f('0x1'))(_0xc00f('0x2'));var moment=require('moment');var BPromise=require(_0xc00f('0x3'));var rp=require(_0xc00f('0x4'));var fs=require('fs');var path=require(_0xc00f('0x5'));var rimraf=require(_0xc00f('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xc00f('0x7')]=function(_0x11955e,_0x207de2){return _0x11955e[_0xc00f('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xc00f('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 25d1dbb..486474f 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 _0x575f=['UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4efcf4,_0x20f39b){var _0x4d9d20=function(_0x563c4b){while(--_0x563c4b){_0x4efcf4['push'](_0x4efcf4['shift']());}};_0x4d9d20(++_0x20f39b);}(_0x575f,0x86));var _0xf575=function(_0x58b2e3,_0xccacc4){_0x58b2e3=_0x58b2e3-0x0;var _0x1c8282=_0x575f[_0x58b2e3];return _0x1c8282;};'use strict';var _=require(_0xf575('0x0'));var util=require(_0xf575('0x1'));var moment=require(_0xf575('0x2'));var BPromise=require(_0xf575('0x3'));var rs=require(_0xf575('0x4'));var fs=require('fs');var Redis=require(_0xf575('0x5'));var db=require(_0xf575('0x6'))['db'];var utils=require(_0xf575('0x7'));var logger=require(_0xf575('0x8'))('rpc');var config=require(_0xf575('0x9'));var jayson=require(_0xf575('0xa'));var client=jayson[_0xf575('0xb')][_0xf575('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18270e,_0x177a19,_0x428e0c){return new BPromise(function(_0x799798,_0x1ff636){return client[_0xf575('0xd')](_0x18270e,_0x428e0c)[_0xf575('0xe')](function(_0xf59a7){logger[_0xf575('0xf')](_0xf575('0x10'),_0x177a19,'request\x20sent');logger[_0xf575('0x11')](_0xf575('0x12'),_0x177a19,_0xf575('0x13'),JSON['stringify'](_0xf59a7));if(_0xf59a7[_0xf575('0x14')]){if(_0xf59a7[_0xf575('0x14')][_0xf575('0x15')]===0x1f4){logger[_0xf575('0x14')](_0xf575('0x10'),_0x177a19,_0xf59a7[_0xf575('0x14')][_0xf575('0x16')]);return _0x1ff636(_0xf59a7[_0xf575('0x14')][_0xf575('0x16')]);}logger[_0xf575('0x14')](_0xf575('0x10'),_0x177a19,_0xf59a7[_0xf575('0x14')]['message']);return _0x799798(_0xf59a7['error']['message']);}else{logger[_0xf575('0xf')](_0xf575('0x10'),_0x177a19,_0xf575('0x13'));_0x799798(_0xf59a7[_0xf575('0x17')][_0xf575('0x16')]);}})[_0xf575('0x18')](function(_0x1c8cd8){logger['error'](_0xf575('0x10'),_0x177a19,_0x1c8cd8);_0x1ff636(_0x1c8cd8);});});} \ No newline at end of file +var _0xd3fa=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xd3fa,0x1b8));var _0xad3f=function(_0x347363,_0x4ce556){_0x347363=_0x347363-0x0;var _0x598819=_0xd3fa[_0x347363];return _0x598819;};'use strict';var _=require(_0xad3f('0x0'));var util=require(_0xad3f('0x1'));var moment=require('moment');var BPromise=require(_0xad3f('0x2'));var rs=require(_0xad3f('0x3'));var fs=require('fs');var Redis=require(_0xad3f('0x4'));var db=require(_0xad3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad3f('0x6'));var config=require(_0xad3f('0x7'));var jayson=require(_0xad3f('0x8'));var client=jayson[_0xad3f('0x9')][_0xad3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528f03,_0x4e2723,_0x200147){return new BPromise(function(_0x21de91,_0x53c5a7){return client['request'](_0x528f03,_0x200147)[_0xad3f('0xb')](function(_0x1a8486){logger[_0xad3f('0xc')](_0xad3f('0xd'),_0x4e2723,_0xad3f('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4e2723,_0xad3f('0xe'),JSON[_0xad3f('0xf')](_0x1a8486));if(_0x1a8486[_0xad3f('0x10')]){if(_0x1a8486['error']['code']===0x1f4){logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x1a8486[_0xad3f('0x10')]['message']);return _0x53c5a7(_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);}logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);return _0x21de91(_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);}else{logger[_0xad3f('0xc')](_0xad3f('0xd'),_0x4e2723,'request\x20sent');_0x21de91(_0x1a8486['result'][_0xad3f('0x11')]);}})[_0xad3f('0x12')](function(_0x30bd20){logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x30bd20);_0x53c5a7(_0x30bd20);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e08a3b5..1f17eb4 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f29cf,_0x43e022){var _0x2dcdf9=function(_0x413976){while(--_0x413976){_0x2f29cf['push'](_0x2f29cf['shift']());}};_0x2dcdf9(++_0x43e022);}(_0x70e0,0x17b));var _0x070e=function(_0x13b742,_0x3098c7){_0x13b742=_0x13b742-0x0;var _0x3d3b65=_0x70e0[_0x13b742];return _0x3d3b65;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x179c7e,_0x3c62ed){var _0xb2dcbb=function(_0x3829ff){while(--_0x3829ff){_0x179c7e['push'](_0x179c7e['shift']());}};_0xb2dcbb(++_0x3c62ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index e33bcbc..868e6b7 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 _0xe2fa=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4923eb,_0x4fcf4b){var _0x236c2d=function(_0x53a691){while(--_0x53a691){_0x4923eb['push'](_0x4923eb['shift']());}};_0x236c2d(++_0x4fcf4b);}(_0xe2fa,0x6f));var _0xae2f=function(_0x492424,_0x4e0c4e){_0x492424=_0x492424-0x0;var _0x311f51=_0xe2fa[_0x492424];return _0x311f51;};'use strict';var Sequelize=require(_0xae2f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xae2f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xae2f('0x2')},'membername':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'comment':_0xae2f('0x2')},'UserId':{'type':Sequelize[_0xae2f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'unique':_0xae2f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xae2f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xae2f('0x2')},'penalty':{'type':Sequelize[_0xae2f('0x1')](0xb),'defaultValue':0x0,'comment':_0xae2f('0x2')},'paused':{'type':Sequelize[_0xae2f('0x1')](0xb),'defaultValue':0x0,'comment':_0xae2f('0x2')}}; \ No newline at end of file +var _0x982f=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x82d959,_0x2287e6){var _0x23db20=function(_0x330be1){while(--_0x330be1){_0x82d959['push'](_0x82d959['shift']());}};_0x23db20(++_0x2287e6);}(_0x982f,0x1b5));var _0xf982=function(_0x320f2b,_0x469bfd){_0x320f2b=_0x320f2b-0x0;var _0x2de381=_0x982f[_0x320f2b];return _0x2de381;};'use strict';var Sequelize=require('sequelize');module[_0xf982('0x0')]={'uniqueid':{'type':Sequelize[_0xf982('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf982('0x2')},'membername':{'type':Sequelize[_0xf982('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xf982('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf982('0x3')],'allowNull':![],'unique':_0xf982('0x4'),'comment':_0xf982('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xf982('0x2')},'penalty':{'type':Sequelize[_0xf982('0x1')](0xb),'defaultValue':0x0,'comment':_0xf982('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf982('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b605bf5..691f192 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 _0x12d2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x565443,_0x17429){var _0x71025d=function(_0x21bc12){while(--_0x21bc12){_0x565443['push'](_0x565443['shift']());}};_0x71025d(++_0x17429);}(_0x12d2,0xb0));var _0x212d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x12d2[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x212d('0x0'));var UserVoiceQueueRt=require(_0x212d('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x212d('0x2')](0x0);var events={'afterCreate':_0x212d('0x3'),'afterUpdate':_0x212d('0x4'),'afterDestroy':_0x212d('0x5')};function emitEvent(_0xb144f){return function(_0x445d1d,_0x121e0e,_0x450d02){UserVoiceQueueRtEvents[_0x212d('0x6')](_0xb144f+':'+_0x445d1d['id'],_0x445d1d);UserVoiceQueueRtEvents[_0x212d('0x6')](_0xb144f,_0x445d1d);_0x450d02(null);};}for(var e in events){if(events[_0x212d('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x212d('0x8')](e,emitEvent(event));}}module[_0x212d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd4f0=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd4f0,0x15e));var _0x0d4f=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xd4f0[_0xbf5e16];return _0x5975a5;};'use strict';var EventEmitter=require(_0x0d4f('0x0'));var UserVoiceQueueRt=require(_0x0d4f('0x1'))['db'][_0x0d4f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d4f('0x3'),'afterUpdate':_0x0d4f('0x4'),'afterDestroy':_0x0d4f('0x5')};function emitEvent(_0x2f05bc){return function(_0x47a6a9,_0x22d7f1,_0x2b9009){UserVoiceQueueRtEvents[_0x0d4f('0x6')](_0x2f05bc+':'+_0x47a6a9['id'],_0x47a6a9);UserVoiceQueueRtEvents[_0x0d4f('0x6')](_0x2f05bc,_0x47a6a9);_0x2b9009(null);};}for(var e in events){if(events[_0x0d4f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x0d4f('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7e98cce..76ef14d 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 _0xe7c3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x1ee8d6,_0x23faa4){var _0x33f27a=function(_0x285924){while(--_0x285924){_0x1ee8d6['push'](_0x1ee8d6['shift']());}};_0x33f27a(++_0x23faa4);}(_0xe7c3,0x10a));var _0x3e7c=function(_0x523caa,_0x4bea30){_0x523caa=_0x523caa-0x0;var _0x347ef0=_0xe7c3[_0x523caa];return _0x347ef0;};'use strict';var _=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var logger=require(_0x3e7c('0x2'))(_0x3e7c('0x3'));var moment=require(_0x3e7c('0x4'));var BPromise=require(_0x3e7c('0x5'));var rp=require(_0x3e7c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7c('0x7'));var config=require(_0x3e7c('0x8'));var attributes=require(_0x3e7c('0x9'));module[_0x3e7c('0xa')]=function(_0xd0b9bc,_0x388279){return _0xd0b9bc[_0x3e7c('0xb')](_0x3e7c('0xc'),attributes,{'tableName':_0x3e7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5675=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util','../../config/logger','request-promise','path','rimraf'];(function(_0x4186ae,_0x5548e5){var _0x31d4b0=function(_0xf394a9){while(--_0xf394a9){_0x4186ae['push'](_0x4186ae['shift']());}};_0x31d4b0(++_0x5548e5);}(_0x5675,0xe3));var _0x5567=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5675[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x5567('0x0'));var logger=require(_0x5567('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5567('0x2'));var fs=require('fs');var path=require(_0x5567('0x3'));var rimraf=require(_0x5567('0x4'));var config=require('../../config/environment');var attributes=require(_0x5567('0x5'));module['exports']=function(_0x45a022,_0x558187){return _0x45a022[_0x5567('0x6')](_0x5567('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6e08a5d..a732740 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 _0x72d0=['info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x72d0,0x134));var _0x072d=function(_0x256ea9,_0x390904){_0x256ea9=_0x256ea9-0x0;var _0x32127e=_0x72d0[_0x256ea9];return _0x32127e;};'use strict';var _=require(_0x072d('0x0'));var util=require(_0x072d('0x1'));var moment=require(_0x072d('0x2'));var BPromise=require('bluebird');var rs=require(_0x072d('0x3'));var fs=require('fs');var Redis=require(_0x072d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x072d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x072d('0x6'));var jayson=require(_0x072d('0x7'));var client=jayson[_0x072d('0x8')][_0x072d('0x9')]({'port':0x232a});config[_0x072d('0xa')]=_[_0x072d('0xb')](config[_0x072d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x072d('0xc'))(new Redis(config['redis']));require(_0x072d('0xd'))['register'](socket);function respondWithRpcPromise(_0x566ee0,_0x5d4da4,_0x149ca8){return new BPromise(function(_0x2b96c1,_0x3d25cd){return client[_0x072d('0xe')](_0x566ee0,_0x149ca8)[_0x072d('0xf')](function(_0x25f1c0){logger[_0x072d('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x072d('0x11'));logger[_0x072d('0x12')](_0x072d('0x13'),_0x5d4da4,_0x072d('0x11'),JSON['stringify'](_0x25f1c0));if(_0x25f1c0['error']){if(_0x25f1c0[_0x072d('0x14')][_0x072d('0x15')]===0x1f4){logger[_0x072d('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x25f1c0[_0x072d('0x14')]['message']);return _0x3d25cd(_0x25f1c0[_0x072d('0x14')]['message']);}logger[_0x072d('0x14')](_0x072d('0x16'),_0x5d4da4,_0x25f1c0[_0x072d('0x14')][_0x072d('0x17')]);return _0x2b96c1(_0x25f1c0['error']['message']);}else{logger['info'](_0x072d('0x16'),_0x5d4da4,_0x072d('0x11'));_0x2b96c1(_0x25f1c0[_0x072d('0x18')][_0x072d('0x17')]);}})[_0x072d('0x19')](function(_0x4959fd){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x4959fd);_0x3d25cd(_0x4959fd);});});}exports[_0x072d('0x1a')]=function(_0x618df0){var _0x287f9a=this;return new Promise(function(_0x481c42,_0x37154d){return db['UserVoiceQueueRt'][_0x072d('0x1b')]({'raw':_0x618df0[_0x072d('0x1c')]?_0x618df0['options'][_0x072d('0x1d')]===undefined?!![]:![]:!![],'where':_0x618df0[_0x072d('0x1c')]?_0x618df0[_0x072d('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x072d('0x1e'),db[_0x072d('0x1f')]['fn']('IF',db['sequelize'][_0x072d('0x20')](_0x072d('0x21')))),_0x072d('0x22')]]})['then'](function(_0xf256c5){logger[_0x072d('0x10')](_0x072d('0x1a'),_0x618df0);logger['debug'](_0x072d('0x1a'),_0x618df0,JSON[_0x072d('0x23')](_0xf256c5));_0x481c42(_0xf256c5);})[_0x072d('0x19')](function(_0x217208){logger[_0x072d('0x14')](_0x072d('0x1a'),_0x217208[_0x072d('0x17')],_0x618df0);_0x37154d(_0x287f9a[_0x072d('0x14')](0x1f4,_0x217208['message']));});});}; \ No newline at end of file +var _0x40e7=['stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x490cb2,_0x54a8a4){var _0x305401=function(_0x34ad0f){while(--_0x34ad0f){_0x490cb2['push'](_0x490cb2['shift']());}};_0x305401(++_0x54a8a4);}(_0x40e7,0x83));var _0x740e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x40e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x740e('0x0'));var util=require(_0x740e('0x1'));var moment=require(_0x740e('0x2'));var BPromise=require(_0x740e('0x3'));var rs=require(_0x740e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x740e('0x5'))['db'];var utils=require(_0x740e('0x6'));var logger=require(_0x740e('0x7'))(_0x740e('0x8'));var config=require(_0x740e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x740e('0xa')]({'port':0x232a});config[_0x740e('0xb')]=_[_0x740e('0xc')](config[_0x740e('0xb')],{'host':_0x740e('0xd'),'port':0x18eb});var socket=require(_0x740e('0xe'))(new Redis(config['redis']));require(_0x740e('0xf'))[_0x740e('0x10')](socket);function respondWithRpcPromise(_0x3c8ac6,_0x5081db,_0xe5a64b){return new BPromise(function(_0x3c5f87,_0x427ca5){return client['request'](_0x3c8ac6,_0xe5a64b)['then'](function(_0x1f8935){logger[_0x740e('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5081db,_0x740e('0x12'));logger[_0x740e('0x13')](_0x740e('0x14'),_0x5081db,_0x740e('0x12'),JSON[_0x740e('0x15')](_0x1f8935));if(_0x1f8935[_0x740e('0x16')]){if(_0x1f8935['error'][_0x740e('0x17')]===0x1f4){logger[_0x740e('0x16')](_0x740e('0x18'),_0x5081db,_0x1f8935['error'][_0x740e('0x19')]);return _0x427ca5(_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);}logger[_0x740e('0x16')](_0x740e('0x18'),_0x5081db,_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);return _0x3c5f87(_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);}else{logger['info'](_0x740e('0x18'),_0x5081db,_0x740e('0x12'));_0x3c5f87(_0x1f8935[_0x740e('0x1a')][_0x740e('0x19')]);}})[_0x740e('0x1b')](function(_0x483cd0){logger[_0x740e('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5081db,_0x483cd0);_0x427ca5(_0x483cd0);});});}exports[_0x740e('0x1c')]=function(_0x2cfa6c){var _0x647d29=this;return new Promise(function(_0x137e39,_0x42c22f){return db['UserVoiceQueueRt'][_0x740e('0x1d')]({'raw':_0x2cfa6c[_0x740e('0x1e')]?_0x2cfa6c['options'][_0x740e('0x1f')]===undefined?!![]:![]:!![],'where':_0x2cfa6c[_0x740e('0x1e')]?_0x2cfa6c[_0x740e('0x1e')][_0x740e('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x740e('0x21'),db[_0x740e('0x22')]['fn']('IF',db[_0x740e('0x22')][_0x740e('0x23')](_0x740e('0x24')))),_0x740e('0x25')]]})['then'](function(_0x5a69b5){logger['info'](_0x740e('0x1c'),_0x2cfa6c);logger[_0x740e('0x13')](_0x740e('0x1c'),_0x2cfa6c,JSON[_0x740e('0x15')](_0x5a69b5));_0x137e39(_0x5a69b5);})[_0x740e('0x1b')](function(_0x598950){logger[_0x740e('0x16')](_0x740e('0x1c'),_0x598950[_0x740e('0x19')],_0x2cfa6c);_0x42c22f(_0x647d29[_0x740e('0x16')](0x1f4,_0x598950[_0x740e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 948ef33..0312474 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 _0xf981=['remove','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4a13cd,_0x1d5ef8){var _0x57eb9b=function(_0x524bdf){while(--_0x524bdf){_0x4a13cd['push'](_0x4a13cd['shift']());}};_0x57eb9b(++_0x1d5ef8);}(_0xf981,0xe6));var _0x1f98=function(_0x4aa926,_0x236dc1){_0x4aa926=_0x4aa926-0x0;var _0x5a88a7=_0xf981[_0x4aa926];return _0x5a88a7;};'use strict';var UserVoiceQueueRtEvents=require(_0x1f98('0x0'));var events=[_0x1f98('0x1'),_0x1f98('0x2'),_0x1f98('0x3')];function createListener(_0x1125ac,_0x2f8aec){return function(_0x476693){_0x2f8aec[_0x1f98('0x4')](_0x1125ac,_0x476693);};}function removeListener(_0x562a81,_0x14da55){return function(){UserVoiceQueueRtEvents[_0x1f98('0x5')](_0x562a81,_0x14da55);};}exports[_0x1f98('0x6')]=function(_0x14bb19){for(var _0x285cdc=0x0,_0x4a4526=events['length'];_0x285cdc<_0x4a4526;_0x285cdc++){var _0x24a520=events[_0x285cdc];var _0x501423=createListener(_0x1f98('0x7')+_0x24a520,_0x14bb19);UserVoiceQueueRtEvents['on'](_0x24a520,_0x501423);}}; \ No newline at end of file +var _0x737d=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','removeListener','register'];(function(_0x532aef,_0x4e1065){var _0x11998c=function(_0x42f48a){while(--_0x42f48a){_0x532aef['push'](_0x532aef['shift']());}};_0x11998c(++_0x4e1065);}(_0x737d,0xbc));var _0xd737=function(_0x2024b8,_0x9bafab){_0x2024b8=_0x2024b8-0x0;var _0x3c5ace=_0x737d[_0x2024b8];return _0x3c5ace;};'use strict';var UserVoiceQueueRtEvents=require(_0xd737('0x0'));var events=[_0xd737('0x1'),'remove','update'];function createListener(_0x58b187,_0x47ae10){return function(_0x2e966e){_0x47ae10['emit'](_0x58b187,_0x2e966e);};}function removeListener(_0x2f8396,_0x4a19e0){return function(){UserVoiceQueueRtEvents[_0xd737('0x2')](_0x2f8396,_0x4a19e0);};}exports[_0xd737('0x3')]=function(_0x1cf86e){for(var _0x2e7d75=0x0,_0x46f559=events[_0xd737('0x4')];_0x2e7d75<_0x46f559;_0x2e7d75++){var _0x3a78be=events[_0x2e7d75];var _0xb077fb=createListener(_0xd737('0x5')+_0x3a78be,_0x1cf86e);UserVoiceQueueRtEvents['on'](_0x3a78be,_0xb077fb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ef12148..856e039 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x16f7c3,_0x7cc6bd){var _0x259a52=function(_0x5d494a){while(--_0x5d494a){_0x16f7c3['push'](_0x16f7c3['shift']());}};_0x259a52(++_0x7cc6bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4458b3,_0x5e191b){var _0x4994e2=function(_0x405032){while(--_0x405032){_0x4458b3['push'](_0x4458b3['shift']());}};_0x4994e2(++_0x5e191b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xcb91[_0x4c3ffe];return _0x28d3eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3bbb879..70354fe 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 _0x568a=['INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x568a,0x1dc));var _0xa568=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x568a[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xa568('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c79=['sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c79,0x102));var _0x92c7=function(_0x33f0f9,_0x3c6430){_0x33f0f9=_0x33f0f9-0x0;var _0x2cd35f=_0x2c79[_0x33f0f9];return _0x2cd35f;};'use strict';var Sequelize=require(_0x92c7('0x0'));module[_0x92c7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 19bfb39..5580868 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 _0x8c79=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger'];(function(_0x1208cc,_0x3de835){var _0x48114b=function(_0x546db3){while(--_0x546db3){_0x1208cc['push'](_0x1208cc['shift']());}};_0x48114b(++_0x3de835);}(_0x8c79,0x1c6));var _0x98c7=function(_0xb77dfe,_0x39c4c7){_0xb77dfe=_0xb77dfe-0x0;var _0x5e4f5d=_0x8c79[_0xb77dfe];return _0x5e4f5d;};'use strict';var _=require(_0x98c7('0x0'));var util=require('util');var logger=require(_0x98c7('0x1'))(_0x98c7('0x2'));var moment=require('moment');var BPromise=require(_0x98c7('0x3'));var rp=require(_0x98c7('0x4'));var fs=require('fs');var path=require(_0x98c7('0x5'));var rimraf=require(_0x98c7('0x6'));var config=require(_0x98c7('0x7'));var attributes=require(_0x98c7('0x8'));module[_0x98c7('0x9')]=function(_0xdf909e,_0x7420be){return _0xdf909e['define'](_0x98c7('0xa'),attributes,{'tableName':_0x98c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb81e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1d5987,_0x43b206){var _0x47bf64=function(_0x2542c5){while(--_0x2542c5){_0x1d5987['push'](_0x1d5987['shift']());}};_0x47bf64(++_0x43b206);}(_0xb81e,0x1ad));var _0xeb81=function(_0x187661,_0x18b11b){_0x187661=_0x187661-0x0;var _0x372a57=_0xb81e[_0x187661];return _0x372a57;};'use strict';var _=require(_0xeb81('0x0'));var util=require(_0xeb81('0x1'));var logger=require(_0xeb81('0x2'))(_0xeb81('0x3'));var moment=require(_0xeb81('0x4'));var BPromise=require(_0xeb81('0x5'));var rp=require(_0xeb81('0x6'));var fs=require('fs');var path=require(_0xeb81('0x7'));var rimraf=require(_0xeb81('0x8'));var config=require(_0xeb81('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0xeb81('0xa')]=function(_0x42c550,_0x12adf5){return _0x42c550[_0xeb81('0xb')](_0xeb81('0xc'),attributes,{'tableName':_0xeb81('0xd'),'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 b7d490b..d019692 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 _0x79b3=['client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x496ebe,_0x5a224a){var _0x392b56=function(_0x18d137){while(--_0x18d137){_0x496ebe['push'](_0x496ebe['shift']());}};_0x392b56(++_0x5a224a);}(_0x79b3,0xfb));var _0x379b=function(_0x54d3a9,_0x13480c){_0x54d3a9=_0x54d3a9-0x0;var _0x113581=_0x79b3[_0x54d3a9];return _0x113581;};'use strict';var _=require(_0x379b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x379b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x379b('0x2'))['db'];var utils=require(_0x379b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x379b('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x379b('0x5')][_0x379b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4bd76b,_0x403207,_0x4f3866){return new BPromise(function(_0x5f24ec,_0x3ce03c){return client['request'](_0x4bd76b,_0x4f3866)[_0x379b('0x7')](function(_0x24da31){logger[_0x379b('0x8')](_0x379b('0x9'),_0x403207,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x403207,'request\x20sent',JSON[_0x379b('0xa')](_0x24da31));if(_0x24da31[_0x379b('0xb')]){if(_0x24da31[_0x379b('0xb')]['code']===0x1f4){logger[_0x379b('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x403207,_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);return _0x3ce03c(_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);}logger[_0x379b('0xb')](_0x379b('0x9'),_0x403207,_0x24da31[_0x379b('0xb')]['message']);return _0x5f24ec(_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);}else{logger['info'](_0x379b('0x9'),_0x403207,_0x379b('0xd'));_0x5f24ec(_0x24da31[_0x379b('0xe')]['message']);}})[_0x379b('0xf')](function(_0x36dc36){logger[_0x379b('0xb')](_0x379b('0x9'),_0x403207,_0x36dc36);_0x3ce03c(_0x36dc36);});});} \ No newline at end of file +var _0x5cf1=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring'];(function(_0x55528f,_0x4d225f){var _0x46500e=function(_0x233104){while(--_0x233104){_0x55528f['push'](_0x55528f['shift']());}};_0x46500e(++_0x4d225f);}(_0x5cf1,0x165));var _0x15cf=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x5cf1[_0x2b35ca];return _0x68389e;};'use strict';var _=require(_0x15cf('0x0'));var util=require('util');var moment=require(_0x15cf('0x1'));var BPromise=require(_0x15cf('0x2'));var rs=require(_0x15cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15cf('0x4'))['db'];var utils=require(_0x15cf('0x5'));var logger=require(_0x15cf('0x6'))(_0x15cf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15cf('0x8')][_0x15cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x494558,_0x56e16c,_0x86a12e){return new BPromise(function(_0x4f29e4,_0xf035fa){return client[_0x15cf('0xa')](_0x494558,_0x86a12e)[_0x15cf('0xb')](function(_0x20f01d){logger[_0x15cf('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56e16c,_0x15cf('0xd'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x56e16c,_0x15cf('0xd'),JSON[_0x15cf('0xe')](_0x20f01d));if(_0x20f01d[_0x15cf('0xf')]){if(_0x20f01d[_0x15cf('0xf')]['code']===0x1f4){logger['error'](_0x15cf('0x10'),_0x56e16c,_0x20f01d[_0x15cf('0xf')][_0x15cf('0x11')]);return _0xf035fa(_0x20f01d[_0x15cf('0xf')]['message']);}logger[_0x15cf('0xf')](_0x15cf('0x10'),_0x56e16c,_0x20f01d['error'][_0x15cf('0x11')]);return _0x4f29e4(_0x20f01d[_0x15cf('0xf')][_0x15cf('0x11')]);}else{logger['info'](_0x15cf('0x10'),_0x56e16c,_0x15cf('0xd'));_0x4f29e4(_0x20f01d[_0x15cf('0x12')][_0x15cf('0x11')]);}})['catch'](function(_0x5ebd4c){logger[_0x15cf('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56e16c,_0x5ebd4c);_0xf035fa(_0x5ebd4c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 758ee17..a555db7 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 _0x94dc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','path','express'];(function(_0xd365a8,_0x36b21b){var _0x57234a=function(_0x34fe3b){while(--_0x34fe3b){_0xd365a8['push'](_0xd365a8['shift']());}};_0x57234a(++_0x36b21b);}(_0x94dc,0xb1));var _0xc94d=function(_0x12b8f6,_0x42a9da){_0x12b8f6=_0x12b8f6-0x0;var _0x3ae1cc=_0x94dc[_0x12b8f6];return _0x3ae1cc;};'use strict';var multer=require(_0xc94d('0x0'));var util=require('util');var path=require(_0xc94d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc94d('0x2'));var router=express[_0xc94d('0x3')]();var fs_extra=require(_0xc94d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc94d('0x5'));var config=require(_0xc94d('0x6'));var controller=require(_0xc94d('0x7'));router[_0xc94d('0x8')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xa')]);router[_0xc94d('0x8')]('/:id',auth[_0xc94d('0x9')](),controller[_0xc94d('0xb')]);router[_0xc94d('0xc')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xd')]);router['put'](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller[_0xc94d('0xf')]);router[_0xc94d('0x10')](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller['destroy']);module[_0xc94d('0x11')]=router; \ No newline at end of file +var _0x26bc=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x26bc,0x162));var _0xc26b=function(_0x2de182,_0x402b38){_0x2de182=_0x2de182-0x0;var _0x2e5854=_0x26bc[_0x2de182];return _0x2e5854;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xd')]('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xf')](_0xc26b('0x10'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);module[_0xc26b('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 02e413a..06fbfae 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 _0x6816=['STRING','sequelize','exports'];(function(_0x10797d,_0x2e0dcd){var _0x3a6dab=function(_0x4b0bac){while(--_0x4b0bac){_0x10797d['push'](_0x10797d['shift']());}};_0x3a6dab(++_0x2e0dcd);}(_0x6816,0x16f));var _0x6681=function(_0x41930b,_0x329693){_0x41930b=_0x41930b-0x0;var _0x21b9a5=_0x6816[_0x41930b];return _0x21b9a5;};'use strict';var Sequelize=require(_0x6681('0x0'));module[_0x6681('0x1')]={'name':{'type':Sequelize[_0x6681('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6681('0x2')]}}; \ No newline at end of file +var _0x20fd=['exports','STRING','sequelize'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x20fd,0x125));var _0xd20f=function(_0x1173d2,_0x4a1c6a){_0x1173d2=_0x1173d2-0x0;var _0x2c55ae=_0x20fd[_0x1173d2];return _0x2c55ae;};'use strict';var Sequelize=require(_0xd20f('0x0'));module[_0xd20f('0x1')]={'name':{'type':Sequelize[_0xd20f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd20f('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 35dba10..89a1e46 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 _0x8d0f=['query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','UserProfileResource','error','name','send','index','Variable','rawAttributes','type','key','model','map'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x8d0f,0x19a));var _0xf8d0=function(_0x14a3c9,_0x3c787f){_0x14a3c9=_0x14a3c9-0x0;var _0x22191f=_0x8d0f[_0x14a3c9];return _0x22191f;};'use strict';var emlformat=require(_0xf8d0('0x0'));var rimraf=require(_0xf8d0('0x1'));var zipdir=require(_0xf8d0('0x2'));var jsonpatch=require(_0xf8d0('0x3'));var rp=require(_0xf8d0('0x4'));var moment=require(_0xf8d0('0x5'));var BPromise=require(_0xf8d0('0x6'));var Mustache=require('mustache');var util=require(_0xf8d0('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf8d0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8d0('0x9'));var squel=require(_0xf8d0('0xa'));var crypto=require(_0xf8d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf8d0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf8d0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf8d0('0xe'));var qs=require(_0xf8d0('0xf'));var as=require(_0xf8d0('0x10'));var hardwareService=require(_0xf8d0('0x11'));var logger=require('../../config/logger')(_0xf8d0('0x12'));var utils=require('../../config/utils');var config=require(_0xf8d0('0x13'));var licenseUtil=require(_0xf8d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x546129,_0x58aa3c){_0x58aa3c=_0x58aa3c||0xcc;return function(_0x23644e){if(_0x23644e){return _0x546129[_0xf8d0('0x15')](_0x58aa3c);}return _0x546129['status'](_0x58aa3c)[_0xf8d0('0x16')]();};}function respondWithResult(_0x35b219,_0x58eaa1){_0x58eaa1=_0x58eaa1||0xc8;return function(_0x5214b8){if(_0x5214b8){return _0x35b219[_0xf8d0('0x17')](_0x58eaa1)['json'](_0x5214b8);}};}function respondWithFilteredResult(_0x2775dd,_0x2d615b){return function(_0xf22069){if(_0xf22069){var _0x385ba9=typeof _0x2d615b[_0xf8d0('0x18')]===_0xf8d0('0x19')&&typeof _0x2d615b[_0xf8d0('0x1a')]===_0xf8d0('0x19');var _0x579eb9=_0xf22069['count'];var _0x3507b0=_0x385ba9?0x0:_0x2d615b[_0xf8d0('0x18')];var _0x1848d4=_0x385ba9?_0xf22069[_0xf8d0('0x1b')]:_0x2d615b[_0xf8d0('0x18')]+_0x2d615b[_0xf8d0('0x1a')];var _0x5df1bc;if(_0x1848d4>=_0x579eb9){_0x1848d4=_0x579eb9;_0x5df1bc=0xc8;}else{_0x5df1bc=0xce;}_0x2775dd[_0xf8d0('0x17')](_0x5df1bc);return _0x2775dd[_0xf8d0('0x1c')](_0xf8d0('0x1d'),_0x3507b0+'-'+_0x1848d4+'/'+_0x579eb9)[_0xf8d0('0x1e')](_0xf22069);}return null;};}function patchUpdates(_0x4e0be2){return function(_0x407936){try{jsonpatch['apply'](_0x407936,_0x4e0be2,!![]);}catch(_0x1485b5){return BPromise[_0xf8d0('0x1f')](_0x1485b5);}return _0x407936[_0xf8d0('0x20')]();};}function saveUpdates(_0x2fc8a2,_0x5db972){return function(_0x39f894){if(_0x39f894){return _0x39f894['update'](_0x2fc8a2)[_0xf8d0('0x21')](function(_0x1cecda){return _0x1cecda;});}return null;};}function removeEntity(_0x46626d,_0x114204){return function(_0x5e2f0a){if(_0x5e2f0a){return _0x5e2f0a[_0xf8d0('0x22')]()['then'](function(){var _0xd69179=_0x5e2f0a['get']({'plain':!![]});var _0x231a8d='Variables';return db[_0xf8d0('0x23')][_0xf8d0('0x22')]({'where':{'type':_0x231a8d,'resourceId':_0xd69179['id']}})[_0xf8d0('0x21')](function(){return _0x5e2f0a;});})[_0xf8d0('0x21')](function(){_0x46626d['status'](0xcc)[_0xf8d0('0x16')]();});}};}function handleEntityNotFound(_0x990bc9,_0x3796c0){return function(_0x4a8875){if(!_0x4a8875){_0x990bc9['sendStatus'](0x194);}return _0x4a8875;};}function handleError(_0x386311,_0x449f7a){_0x449f7a=_0x449f7a||0x1f4;return function(_0x458769){logger[_0xf8d0('0x24')](_0x458769['stack']);if(_0x458769[_0xf8d0('0x25')]){delete _0x458769[_0xf8d0('0x25')];}_0x386311[_0xf8d0('0x17')](_0x449f7a)[_0xf8d0('0x26')](_0x458769);};}exports[_0xf8d0('0x27')]=function(_0x3a0ad9,_0x4208aa){var _0x283dda={},_0x46535a={},_0x16e6af={'count':0x0,'rows':[]};var _0x31100f=_['map'](db[_0xf8d0('0x28')][_0xf8d0('0x29')],function(_0x3b86cb){return{'name':_0x3b86cb['fieldName'],'type':_0x3b86cb[_0xf8d0('0x2a')][_0xf8d0('0x2b')]};});_0x46535a[_0xf8d0('0x2c')]=_[_0xf8d0('0x2d')](_0x31100f,_0xf8d0('0x25'));_0x46535a['query']=_['keys'](_0x3a0ad9[_0xf8d0('0x2e')]);_0x46535a[_0xf8d0('0x2f')]=_[_0xf8d0('0x30')](_0x46535a[_0xf8d0('0x2c')],_0x46535a['query']);_0x283dda[_0xf8d0('0x31')]=_['intersection'](_0x46535a[_0xf8d0('0x2c')],qs[_0xf8d0('0x32')](_0x3a0ad9['query'][_0xf8d0('0x32')]));_0x283dda[_0xf8d0('0x31')]=_0x283dda[_0xf8d0('0x31')]['length']?_0x283dda['attributes']:_0x46535a[_0xf8d0('0x2c')];if(!_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x33')]('nolimit')){_0x283dda[_0xf8d0('0x1a')]=qs[_0xf8d0('0x1a')](_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x1a')]);_0x283dda[_0xf8d0('0x18')]=qs[_0xf8d0('0x18')](_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x18')]);}_0x283dda[_0xf8d0('0x34')]=qs[_0xf8d0('0x35')](_0x3a0ad9[_0xf8d0('0x2e')]['sort']);_0x283dda[_0xf8d0('0x36')]=qs[_0xf8d0('0x2f')](_[_0xf8d0('0x37')](_0x3a0ad9[_0xf8d0('0x2e')],_0x46535a[_0xf8d0('0x2f')]),_0x31100f);if(_0x3a0ad9[_0xf8d0('0x2e')]['filter']){_0x283dda['where']=_[_0xf8d0('0x38')](_0x283dda[_0xf8d0('0x36')],{'$or':_['map'](_0x31100f,function(_0x23cc28){if(_0x23cc28['type']!==_0xf8d0('0x39')){var _0x318859={};_0x318859[_0x23cc28[_0xf8d0('0x25')]]={'$like':'%'+_0x3a0ad9[_0xf8d0('0x2e')]['filter']+'%'};return _0x318859;}})});}_0x283dda=_[_0xf8d0('0x38')]({},_0x283dda,_0x3a0ad9[_0xf8d0('0x3a')]);var _0x53c122={'where':_0x283dda[_0xf8d0('0x36')]};return db[_0xf8d0('0x28')]['count'](_0x53c122)[_0xf8d0('0x21')](function(_0x58e67a){_0x16e6af[_0xf8d0('0x1b')]=_0x58e67a;if(_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x3b')]){_0x283dda[_0xf8d0('0x3c')]=[{'all':!![]}];}return db[_0xf8d0('0x28')]['findAll'](_0x283dda);})['then'](function(_0x4446a5){_0x16e6af[_0xf8d0('0x3d')]=_0x4446a5;return _0x16e6af;})[_0xf8d0('0x21')](respondWithFilteredResult(_0x4208aa,_0x283dda))[_0xf8d0('0x3e')](handleError(_0x4208aa,null));};exports[_0xf8d0('0x3f')]=function(_0x25da2b,_0x218049){var _0x35c79a={'raw':!![],'where':{'id':_0x25da2b['params']['id']}},_0x11b91e={};_0x11b91e[_0xf8d0('0x2c')]=_[_0xf8d0('0x40')](db[_0xf8d0('0x28')]['rawAttributes']);_0x11b91e[_0xf8d0('0x2e')]=_['keys'](_0x25da2b['query']);_0x11b91e[_0xf8d0('0x2f')]=_[_0xf8d0('0x30')](_0x11b91e['model'],_0x11b91e[_0xf8d0('0x2e')]);_0x35c79a[_0xf8d0('0x31')]=_['intersection'](_0x11b91e[_0xf8d0('0x2c')],qs[_0xf8d0('0x32')](_0x25da2b[_0xf8d0('0x2e')][_0xf8d0('0x32')]));_0x35c79a[_0xf8d0('0x31')]=_0x35c79a[_0xf8d0('0x31')][_0xf8d0('0x41')]?_0x35c79a[_0xf8d0('0x31')]:_0x11b91e[_0xf8d0('0x2c')];if(_0x25da2b[_0xf8d0('0x2e')][_0xf8d0('0x3b')]){_0x35c79a[_0xf8d0('0x3c')]=[{'all':!![]}];}_0x35c79a=_[_0xf8d0('0x38')]({},_0x35c79a,_0x25da2b[_0xf8d0('0x3a')]);return db[_0xf8d0('0x28')]['find'](_0x35c79a)['then'](handleEntityNotFound(_0x218049,null))[_0xf8d0('0x21')](respondWithResult(_0x218049,null))['catch'](handleError(_0x218049,null));};exports[_0xf8d0('0x42')]=function(_0x1d7419,_0x7a0f79){return db['Variable']['create'](_0x1d7419['body'],{})[_0xf8d0('0x21')](function(_0x2fb6b7){var _0xf57bea=_0x1d7419['user'][_0xf8d0('0x43')]({'plain':!![]});if(!_0xf57bea)throw new Error(_0xf8d0('0x44'));if(_0xf57bea['role']===_0xf8d0('0x45')){var _0x19172f=_0x2fb6b7[_0xf8d0('0x43')]({'plain':!![]});var _0x332bfb='Variables';return db[_0xf8d0('0x46')][_0xf8d0('0x47')]({'where':{'name':_0x332bfb,'userProfileId':_0xf57bea['userProfileId']},'raw':!![]})[_0xf8d0('0x21')](function(_0x5e0eba){if(_0x5e0eba&&_0x5e0eba['autoAssociation']===0x0){return db[_0xf8d0('0x23')][_0xf8d0('0x42')]({'name':_0x19172f[_0xf8d0('0x25')],'resourceId':_0x19172f['id'],'type':_0x5e0eba[_0xf8d0('0x25')],'sectionId':_0x5e0eba['id']},{})[_0xf8d0('0x21')](function(){return _0x2fb6b7;});}else{return _0x2fb6b7;}})[_0xf8d0('0x3e')](function(_0x141bfb){logger[_0xf8d0('0x24')](_0xf8d0('0x48'),_0x141bfb);throw _0x141bfb;});}return _0x2fb6b7;})[_0xf8d0('0x21')](respondWithResult(_0x7a0f79,0xc9))[_0xf8d0('0x3e')](handleError(_0x7a0f79,null));};exports[_0xf8d0('0x49')]=function(_0x555022,_0x56e239){if(_0x555022['body']['id']){delete _0x555022[_0xf8d0('0x4a')]['id'];}return db[_0xf8d0('0x28')][_0xf8d0('0x47')]({'where':{'id':_0x555022[_0xf8d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56e239,null))[_0xf8d0('0x21')](saveUpdates(_0x555022[_0xf8d0('0x4a')],null))[_0xf8d0('0x21')](respondWithResult(_0x56e239,null))['catch'](handleError(_0x56e239,null));};exports[_0xf8d0('0x22')]=function(_0x169590,_0x4318cd){return db['Variable'][_0xf8d0('0x47')]({'where':{'id':_0x169590[_0xf8d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4318cd,null))[_0xf8d0('0x21')](removeEntity(_0x4318cd,null))[_0xf8d0('0x3e')](handleError(_0x4318cd,null));}; \ No newline at end of file +var _0x5881=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Variables','status','error','stack','name','index','map','rawAttributes','fieldName','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','Variable','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x4abf13,_0x28742a){var _0x27b0e5=function(_0x3a0aa5){while(--_0x3a0aa5){_0x4abf13['push'](_0x4abf13['shift']());}};_0x27b0e5(++_0x28742a);}(_0x5881,0x1ca));var _0x1588=function(_0x32cde2,_0x238559){_0x32cde2=_0x32cde2-0x0;var _0x10b4b0=_0x5881[_0x32cde2];return _0x10b4b0;};'use strict';var emlformat=require(_0x1588('0x0'));var rimraf=require(_0x1588('0x1'));var zipdir=require(_0x1588('0x2'));var jsonpatch=require(_0x1588('0x3'));var rp=require(_0x1588('0x4'));var moment=require(_0x1588('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1588('0x6'));var path=require(_0x1588('0x7'));var sox=require(_0x1588('0x8'));var csv=require(_0x1588('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1588('0xa'));var _=require(_0x1588('0xb'));var squel=require(_0x1588('0xc'));var crypto=require('crypto');var jsforce=require(_0x1588('0xd'));var deskjs=require(_0x1588('0xe'));var toCsv=require(_0x1588('0x9'));var querystring=require(_0x1588('0xf'));var Papa=require('papaparse');var Redis=require(_0x1588('0x10'));var authService=require(_0x1588('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1588('0x12'));var logger=require('../../config/logger')(_0x1588('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1588('0x14'));var db=require(_0x1588('0x15'))['db'];function respondWithStatusCode(_0x25a331,_0x15c37e){_0x15c37e=_0x15c37e||0xcc;return function(_0x57a2b1){if(_0x57a2b1){return _0x25a331[_0x1588('0x16')](_0x15c37e);}return _0x25a331['status'](_0x15c37e)[_0x1588('0x17')]();};}function respondWithResult(_0xf467a0,_0x34092b){_0x34092b=_0x34092b||0xc8;return function(_0x67ed52){if(_0x67ed52){return _0xf467a0['status'](_0x34092b)[_0x1588('0x18')](_0x67ed52);}};}function respondWithFilteredResult(_0x2567da,_0x3f9be6){return function(_0x5637f6){if(_0x5637f6){var _0x17bc21=typeof _0x3f9be6[_0x1588('0x19')]===_0x1588('0x1a')&&typeof _0x3f9be6[_0x1588('0x1b')]==='undefined';var _0x142bb1=_0x5637f6[_0x1588('0x1c')];var _0x382b4d=_0x17bc21?0x0:_0x3f9be6['offset'];var _0x3ed628=_0x17bc21?_0x5637f6[_0x1588('0x1c')]:_0x3f9be6[_0x1588('0x19')]+_0x3f9be6[_0x1588('0x1b')];var _0x31f780;if(_0x3ed628>=_0x142bb1){_0x3ed628=_0x142bb1;_0x31f780=0xc8;}else{_0x31f780=0xce;}_0x2567da['status'](_0x31f780);return _0x2567da[_0x1588('0x1d')]('Content-Range',_0x382b4d+'-'+_0x3ed628+'/'+_0x142bb1)[_0x1588('0x18')](_0x5637f6);}return null;};}function patchUpdates(_0x493820){return function(_0x392223){try{jsonpatch[_0x1588('0x1e')](_0x392223,_0x493820,!![]);}catch(_0x587611){return BPromise[_0x1588('0x1f')](_0x587611);}return _0x392223[_0x1588('0x20')]();};}function saveUpdates(_0x552465,_0x1aec0a){return function(_0x2d2eea){if(_0x2d2eea){return _0x2d2eea[_0x1588('0x21')](_0x552465)['then'](function(_0x5e8647){return _0x5e8647;});}return null;};}function removeEntity(_0x51ce76,_0xe97392){return function(_0x16dca7){if(_0x16dca7){return _0x16dca7[_0x1588('0x22')]()[_0x1588('0x23')](function(){var _0x273f32=_0x16dca7[_0x1588('0x24')]({'plain':!![]});var _0x462806=_0x1588('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x462806,'resourceId':_0x273f32['id']}})[_0x1588('0x23')](function(){return _0x16dca7;});})[_0x1588('0x23')](function(){_0x51ce76[_0x1588('0x26')](0xcc)[_0x1588('0x17')]();});}};}function handleEntityNotFound(_0x2d892e,_0x39d65a){return function(_0xf3721){if(!_0xf3721){_0x2d892e[_0x1588('0x16')](0x194);}return _0xf3721;};}function handleError(_0x120455,_0x135aca){_0x135aca=_0x135aca||0x1f4;return function(_0x155ede){logger[_0x1588('0x27')](_0x155ede[_0x1588('0x28')]);if(_0x155ede[_0x1588('0x29')]){delete _0x155ede[_0x1588('0x29')];}_0x120455['status'](_0x135aca)['send'](_0x155ede);};}exports[_0x1588('0x2a')]=function(_0x5bc6e0,_0x5acae4){var _0x37bca9={},_0x3edc9c={},_0x1d7a1e={'count':0x0,'rows':[]};var _0x3b27b1=_[_0x1588('0x2b')](db['Variable'][_0x1588('0x2c')],function(_0x415c08){return{'name':_0x415c08[_0x1588('0x2d')],'type':_0x415c08[_0x1588('0x2e')][_0x1588('0x2f')]};});_0x3edc9c['model']=_[_0x1588('0x2b')](_0x3b27b1,'name');_0x3edc9c['query']=_['keys'](_0x5bc6e0['query']);_0x3edc9c[_0x1588('0x30')]=_[_0x1588('0x31')](_0x3edc9c[_0x1588('0x32')],_0x3edc9c[_0x1588('0x33')]);_0x37bca9['attributes']=_['intersection'](_0x3edc9c[_0x1588('0x32')],qs[_0x1588('0x34')](_0x5bc6e0['query'][_0x1588('0x34')]));_0x37bca9[_0x1588('0x35')]=_0x37bca9[_0x1588('0x35')][_0x1588('0x36')]?_0x37bca9[_0x1588('0x35')]:_0x3edc9c['model'];if(!_0x5bc6e0[_0x1588('0x33')][_0x1588('0x37')]('nolimit')){_0x37bca9[_0x1588('0x1b')]=qs[_0x1588('0x1b')](_0x5bc6e0[_0x1588('0x33')][_0x1588('0x1b')]);_0x37bca9[_0x1588('0x19')]=qs[_0x1588('0x19')](_0x5bc6e0['query'][_0x1588('0x19')]);}_0x37bca9['order']=qs[_0x1588('0x38')](_0x5bc6e0['query'][_0x1588('0x38')]);_0x37bca9[_0x1588('0x39')]=qs[_0x1588('0x30')](_[_0x1588('0x3a')](_0x5bc6e0['query'],_0x3edc9c[_0x1588('0x30')]),_0x3b27b1);if(_0x5bc6e0['query']['filter']){_0x37bca9[_0x1588('0x39')]=_['merge'](_0x37bca9[_0x1588('0x39')],{'$or':_[_0x1588('0x2b')](_0x3b27b1,function(_0x5d8808){if(_0x5d8808[_0x1588('0x2e')]!==_0x1588('0x3b')){var _0x1da4d7={};_0x1da4d7[_0x5d8808[_0x1588('0x29')]]={'$like':'%'+_0x5bc6e0[_0x1588('0x33')][_0x1588('0x3c')]+'%'};return _0x1da4d7;}})});}_0x37bca9=_[_0x1588('0x3d')]({},_0x37bca9,_0x5bc6e0['options']);var _0x46721b={'where':_0x37bca9[_0x1588('0x39')]};return db[_0x1588('0x3e')][_0x1588('0x1c')](_0x46721b)[_0x1588('0x23')](function(_0x2eeef4){_0x1d7a1e[_0x1588('0x1c')]=_0x2eeef4;if(_0x5bc6e0[_0x1588('0x33')]['includeAll']){_0x37bca9[_0x1588('0x3f')]=[{'all':!![]}];}return db[_0x1588('0x3e')][_0x1588('0x40')](_0x37bca9);})['then'](function(_0x28d8b2){_0x1d7a1e[_0x1588('0x41')]=_0x28d8b2;return _0x1d7a1e;})['then'](respondWithFilteredResult(_0x5acae4,_0x37bca9))[_0x1588('0x42')](handleError(_0x5acae4,null));};exports[_0x1588('0x43')]=function(_0x83d96e,_0x54b0d8){var _0x59d12d={'raw':!![],'where':{'id':_0x83d96e['params']['id']}},_0xab49d2={};_0xab49d2[_0x1588('0x32')]=_['keys'](db['Variable'][_0x1588('0x2c')]);_0xab49d2[_0x1588('0x33')]=_[_0x1588('0x44')](_0x83d96e[_0x1588('0x33')]);_0xab49d2[_0x1588('0x30')]=_[_0x1588('0x31')](_0xab49d2['model'],_0xab49d2[_0x1588('0x33')]);_0x59d12d['attributes']=_[_0x1588('0x31')](_0xab49d2[_0x1588('0x32')],qs[_0x1588('0x34')](_0x83d96e[_0x1588('0x33')][_0x1588('0x34')]));_0x59d12d[_0x1588('0x35')]=_0x59d12d[_0x1588('0x35')][_0x1588('0x36')]?_0x59d12d[_0x1588('0x35')]:_0xab49d2[_0x1588('0x32')];if(_0x83d96e[_0x1588('0x33')][_0x1588('0x45')]){_0x59d12d[_0x1588('0x3f')]=[{'all':!![]}];}_0x59d12d=_['merge']({},_0x59d12d,_0x83d96e[_0x1588('0x46')]);return db[_0x1588('0x3e')][_0x1588('0x47')](_0x59d12d)[_0x1588('0x23')](handleEntityNotFound(_0x54b0d8,null))[_0x1588('0x23')](respondWithResult(_0x54b0d8,null))[_0x1588('0x42')](handleError(_0x54b0d8,null));};exports[_0x1588('0x48')]=function(_0x499678,_0x1a765e){return db[_0x1588('0x3e')][_0x1588('0x48')](_0x499678[_0x1588('0x49')],{})[_0x1588('0x23')](function(_0x334d6a){var _0x1f2be8=_0x499678[_0x1588('0x4a')][_0x1588('0x24')]({'plain':!![]});if(!_0x1f2be8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f2be8[_0x1588('0x4b')]===_0x1588('0x4a')){var _0x5cefff=_0x334d6a[_0x1588('0x24')]({'plain':!![]});var _0x250eea=_0x1588('0x25');return db['UserProfileSection'][_0x1588('0x47')]({'where':{'name':_0x250eea,'userProfileId':_0x1f2be8[_0x1588('0x4c')]},'raw':!![]})[_0x1588('0x23')](function(_0x52e24a){if(_0x52e24a&&_0x52e24a['autoAssociation']===0x0){return db[_0x1588('0x4d')][_0x1588('0x48')]({'name':_0x5cefff[_0x1588('0x29')],'resourceId':_0x5cefff['id'],'type':_0x52e24a[_0x1588('0x29')],'sectionId':_0x52e24a['id']},{})[_0x1588('0x23')](function(){return _0x334d6a;});}else{return _0x334d6a;}})[_0x1588('0x42')](function(_0x402355){logger[_0x1588('0x27')](_0x1588('0x4e'),_0x402355);throw _0x402355;});}return _0x334d6a;})[_0x1588('0x23')](respondWithResult(_0x1a765e,0xc9))['catch'](handleError(_0x1a765e,null));};exports[_0x1588('0x21')]=function(_0x2c596c,_0xa9778d){if(_0x2c596c['body']['id']){delete _0x2c596c[_0x1588('0x49')]['id'];}return db[_0x1588('0x3e')]['find']({'where':{'id':_0x2c596c['params']['id']}})['then'](handleEntityNotFound(_0xa9778d,null))[_0x1588('0x23')](saveUpdates(_0x2c596c[_0x1588('0x49')],null))['then'](respondWithResult(_0xa9778d,null))['catch'](handleError(_0xa9778d,null));};exports[_0x1588('0x22')]=function(_0x82803d,_0x26ba8d){return db[_0x1588('0x3e')][_0x1588('0x47')]({'where':{'id':_0x82803d['params']['id']}})['then'](handleEntityNotFound(_0x26ba8d,null))[_0x1588('0x23')](removeEntity(_0x26ba8d,null))[_0x1588('0x42')](handleError(_0x26ba8d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9da1273..06cdb6a 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 _0x19dd=['api','bluebird','request-promise','rimraf','../../config/environment','define','tools_variables','lodash','util'];(function(_0x162e46,_0x540e39){var _0x28ad45=function(_0xe4c99){while(--_0xe4c99){_0x162e46['push'](_0x162e46['shift']());}};_0x28ad45(++_0x540e39);}(_0x19dd,0xfa));var _0xd19d=function(_0x49d5ae,_0x25cccc){_0x49d5ae=_0x49d5ae-0x0;var _0x5bed55=_0x19dd[_0x49d5ae];return _0x5bed55;};'use strict';var _=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var logger=require('../../config/logger')(_0xd19d('0x2'));var moment=require('moment');var BPromise=require(_0xd19d('0x3'));var rp=require(_0xd19d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd19d('0x5'));var config=require(_0xd19d('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x1ffc4a,_0x40c77e){return _0x1ffc4a[_0xd19d('0x7')]('Variable',attributes,{'tableName':_0xd19d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeabc=['path','rimraf','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22964c,_0x281f37){var _0x4eccca=function(_0x5b57e2){while(--_0x5b57e2){_0x22964c['push'](_0x22964c['shift']());}};_0x4eccca(++_0x281f37);}(_0xeabc,0x94));var _0xceab=function(_0x327f55,_0x2e1966){_0x327f55=_0x327f55-0x0;var _0x439a9b=_0xeabc[_0x327f55];return _0x439a9b;};'use strict';var _=require(_0xceab('0x0'));var util=require('util');var logger=require(_0xceab('0x1'))(_0xceab('0x2'));var moment=require(_0xceab('0x3'));var BPromise=require(_0xceab('0x4'));var rp=require(_0xceab('0x5'));var fs=require('fs');var path=require(_0xceab('0x6'));var rimraf=require(_0xceab('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xceab('0x8')]=function(_0x572145,_0x7d1408){return _0x572145[_0xceab('0x9')]('Variable',attributes,{'tableName':_0xceab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 5ff8e8f..d1d256a 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x478b59,_0xc9b29e){var _0x5b874b=function(_0x5b3143){while(--_0x5b3143){_0x478b59['push'](_0x478b59['shift']());}};_0x5b874b(++_0xc9b29e);}(_0xf494,0x1c6));var _0x4f49=function(_0x42fe8d,_0xdac443){_0x42fe8d=_0x42fe8d-0x0;var _0x299aea=_0xf494[_0x42fe8d];return _0x299aea;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0x3e74,0x175));var _0x43e7=function(_0x48a184,_0x77d0b1){_0x48a184=_0x48a184-0x0;var _0x4c5ff6=_0x3e74[_0x48a184];return _0x4c5ff6;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8bcb7ee..4a2b642 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 _0xeadd=['/migrations','express','Router','../../components/auth/service','get','isAuthenticated','canUpdate','/pull','pull','restart'];(function(_0x53ced7,_0x40cae1){var _0x1f3122=function(_0x19c83a){while(--_0x19c83a){_0x53ced7['push'](_0x53ced7['shift']());}};_0x1f3122(++_0x40cae1);}(_0xeadd,0x10f));var _0xdead=function(_0x7c3cb0,_0x3a0c14){_0x7c3cb0=_0x7c3cb0-0x0;var _0x2eb5ce=_0xeadd[_0x7c3cb0];return _0x2eb5ce;};'use strict';var express=require(_0xdead('0x0'));var router=express[_0xdead('0x1')]();var auth=require(_0xdead('0x2'));var controller=require('./version.controller');router[_0xdead('0x3')]('/',controller['index']);router[_0xdead('0x3')]('/fetch',auth[_0xdead('0x4')](),auth[_0xdead('0x5')](),controller['fetch']);router[_0xdead('0x3')]('/reset',auth['isAuthenticated'](),auth[_0xdead('0x5')](),controller['reset']);router['get'](_0xdead('0x6'),auth[_0xdead('0x4')](),auth['canUpdate'](),controller[_0xdead('0x7')]);router[_0xdead('0x3')]('/restart',auth[_0xdead('0x4')](),controller[_0xdead('0x8')]);router[_0xdead('0x3')](_0xdead('0x9'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0xfbf7=['./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','restart','migrations','exports','express','Router','../../components/auth/service'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xfbf7,0x16d));var _0x7fbf=function(_0x5265a8,_0x4c9b3c){_0x5265a8=_0x5265a8-0x0;var _0x9ef318=_0xfbf7[_0x5265a8];return _0x9ef318;};'use strict';var express=require(_0x7fbf('0x0'));var router=express[_0x7fbf('0x1')]();var auth=require(_0x7fbf('0x2'));var controller=require(_0x7fbf('0x3'));router[_0x7fbf('0x4')]('/',controller[_0x7fbf('0x5')]);router[_0x7fbf('0x4')](_0x7fbf('0x6'),auth[_0x7fbf('0x7')](),auth['canUpdate'](),controller[_0x7fbf('0x8')]);router['get'](_0x7fbf('0x9'),auth[_0x7fbf('0x7')](),auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xb')]);router[_0x7fbf('0x4')]('/pull',auth[_0x7fbf('0x7')](),auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xc')]);router['get']('/restart',auth[_0x7fbf('0x7')](),controller[_0x7fbf('0xd')]);router['get']('/migrations',controller[_0x7fbf('0xe')]);module[_0x7fbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8c5b3ee..712fab7 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 _0xe622=['.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/logger','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0xe622,0x16c));var _0x2e62=function(_0x37d2f5,_0x34a99b){_0x37d2f5=_0x37d2f5-0x0;var _0x5071f8=_0xe622[_0x37d2f5];return _0x5071f8;};'use strict';var Umzug=require(_0x2e62('0x0'));var path=require(_0x2e62('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2e62('0x2'))(module,_0x2e62('0x3'));var compareVersions=require(_0x2e62('0x4'));var exec=require(_0x2e62('0x5'))[_0x2e62('0x6')];var db=require(_0x2e62('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x2e62('0x8'))('update');var git=require(_0x2e62('0x9'))(config[_0x2e62('0xa')]);exports[_0x2e62('0xb')]=function(_0x536594,_0x33fe4f){var _0x28de08={'current':module[_0x2e62('0xc')][_0x2e62('0x3')],'phonebar':0x2};if(_0x536594[_0x2e62('0xd')]&&_0x536594[_0x2e62('0xd')][_0x2e62('0xe')]){return git[_0x2e62('0xf')]()['tags'](function(_0x2ef94a,_0x4dbe7b){_0x28de08['latest']=(_0x2ef94a?module[_0x2e62('0xc')][_0x2e62('0x3')]:_0x4dbe7b[_0x2e62('0xe')])||_0x2e62('0x10');return _0x33fe4f['status'](0xc8)['json'](_0x28de08);});}else{return _0x33fe4f[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')](_0x28de08);}};exports[_0x2e62('0xf')]=function(_0x23b6a3,_0x311718){return git[_0x2e62('0xf')](['origin','master'],function(_0x229a38){if(_0x229a38){logger[_0x2e62('0x13')](_0x229a38);return _0x311718[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x229a38);}logger[_0x2e62('0x14')](_0x2e62('0x15'));return _0x311718['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x16')});});};exports['reset']=function(_0x1b74e7,_0x538720){return git['reset']([_0x2e62('0x17'),_0x2e62('0x18')],function(_0x509883){if(_0x509883){logger[_0x2e62('0x13')](_0x509883);return _0x538720[_0x2e62('0x11')](0x1f4)['json'](_0x509883);}logger[_0x2e62('0x14')](_0x2e62('0x19'));return _0x538720[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x1a')});});};exports['pull']=function(_0xe34af4,_0x28a9bd){exec(_0x2e62('0x1b'),function(_0x50a44f,_0x3cb992,_0x1b6800){logger[_0x2e62('0x14')](_0x3cb992);logger[_0x2e62('0x14')](_0x1b6800);if(_0x50a44f){logger[_0x2e62('0x13')](_0x50a44f);return _0x28a9bd['status'](0x1f4)[_0x2e62('0x12')](_0x50a44f);}return _0x28a9bd[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x3cb992});});};exports['restart']=function(_0x58d440,_0x28178a){return pm2[_0x2e62('0x1c')](_0x2e62('0x1d'))['then'](function(_0x543b3a){logger[_0x2e62('0x14')](_0x2e62('0x1e'),_0x543b3a);return _0x28178a['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x1f')});})[_0x2e62('0x20')](function(_0x5375d9){logger[_0x2e62('0x13')](_0x5375d9);return _0x28178a[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x5375d9);});};exports[_0x2e62('0x21')]=function(_0x433656,_0x1faf33){var _0x5e90e8=fs[_0x2e62('0x22')](path[_0x2e62('0x23')](config[_0x2e62('0xa')],'server',_0x2e62('0x21')));var _0x4fb698=[];for(var _0x93c2df=0x0;_0x93c2df<_0x5e90e8[_0x2e62('0x24')];_0x93c2df++){var _0x68889=_0x5e90e8[_0x93c2df]['replace']('.js','');if(compareVersions(module[_0x2e62('0xc')][_0x2e62('0x3')],_0x68889)===-0x1){_0x4fb698['push'](_0x68889);}}if(_0x4fb698[_0x2e62('0x24')]){var _0x132517=_0x4fb698[_0x2e62('0x25')](compareVersions);var _0x3ace36=new Umzug({'storage':_0x2e62('0x26'),'storageOptions':{'model':db[_0x2e62('0x27')],'modelName':'Migration','columnName':_0x2e62('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x2e62('0x26')][_0x2e62('0x28')],function(){throw new Error(_0x2e62('0x29'));}],'path':path[_0x2e62('0x23')](config['root'],_0x2e62('0x2a'),_0x2e62('0x21')),'pattern':/\.js$/}});_0x3ace36['up']({'migrations':_[_0x2e62('0x2b')](_0x132517,function(_0x1a612f){return _0x1a612f+_0x2e62('0x2c');})})[_0x2e62('0x2d')](function(){return _0x1faf33[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x2e')+module[_0x2e62('0xc')]['version']+_0x2e62('0x2f')+_[_0x2e62('0x30')](_0x132517),'migrations':_[_0x2e62('0x23')](_0x132517)});})[_0x2e62('0x20')](function(_0x419fb0){if(_0x419fb0 instanceof db['sequelize'][_0x2e62('0x31')]){return _0x1faf33[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x1faf33[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x419fb0);}});}else{return _0x1faf33['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x32')});}}; \ No newline at end of file +var _0xd61d=['error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','tags','status','json','fetch'];(function(_0x4a0d07,_0x4b198a){var _0xfbce68=function(_0x2ef218){while(--_0x2ef218){_0x4a0d07['push'](_0x4a0d07['shift']());}};_0xfbce68(++_0x4b198a);}(_0xd61d,0x18c));var _0xdd61=function(_0x60072e,_0x3ce032){_0x60072e=_0x60072e-0x0;var _0x4920c3=_0xd61d[_0x60072e];return _0x4920c3;};'use strict';var Umzug=require(_0xdd61('0x0'));var path=require(_0xdd61('0x1'));var fs=require('fs');var _=require(_0xdd61('0x2'));var pkginfo=require('pkginfo')(module,_0xdd61('0x3'));var compareVersions=require(_0xdd61('0x4'));var exec=require(_0xdd61('0x5'))[_0xdd61('0x6')];var db=require(_0xdd61('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xdd61('0x8'));var logger=require(_0xdd61('0x9'))(_0xdd61('0xa'));var git=require('simple-git')(config[_0xdd61('0xb')]);exports[_0xdd61('0xc')]=function(_0x4cff98,_0x5813e6){var _0x25e409={'current':module[_0xdd61('0xd')]['version'],'phonebar':0x2};if(_0x4cff98[_0xdd61('0xe')]&&_0x4cff98['query'][_0xdd61('0xf')]){return git['fetch']()[_0xdd61('0x10')](function(_0x2b0ca5,_0x321855){_0x25e409[_0xdd61('0xf')]=(_0x2b0ca5?module['exports'][_0xdd61('0x3')]:_0x321855[_0xdd61('0xf')])||'2.0.0';return _0x5813e6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')](_0x25e409);});}else{return _0x5813e6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')](_0x25e409);}};exports['fetch']=function(_0x4444bc,_0xe8f7c5){return git[_0xdd61('0x13')](['origin','master'],function(_0x26737d){if(_0x26737d){logger[_0xdd61('0x14')](_0x26737d);return _0xe8f7c5['status'](0x1f4)[_0xdd61('0x12')](_0x26737d);}logger[_0xdd61('0x15')]('git\x20fetch');return _0xe8f7c5['status'](0xc8)['json']({'output':_0xdd61('0x16')});});};exports[_0xdd61('0x17')]=function(_0x41534d,_0x3ed825){return git[_0xdd61('0x17')]([_0xdd61('0x18'),_0xdd61('0x19')],function(_0x1f1a56){if(_0x1f1a56){logger['error'](_0x1f1a56);return _0x3ed825[_0xdd61('0x11')](0x1f4)[_0xdd61('0x12')](_0x1f1a56);}logger[_0xdd61('0x15')](_0xdd61('0x1a'));return _0x3ed825[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x1b')});});};exports[_0xdd61('0x1c')]=function(_0x21def3,_0x19eb77){exec('npm\x20install\x20--production',function(_0x4a8048,_0x152964,_0x4c7d82){logger['info'](_0x152964);logger[_0xdd61('0x15')](_0x4c7d82);if(_0x4a8048){logger[_0xdd61('0x14')](_0x4a8048);return _0x19eb77[_0xdd61('0x11')](0x1f4)[_0xdd61('0x12')](_0x4a8048);}return _0x19eb77['status'](0xc8)[_0xdd61('0x12')]({'output':_0x152964});});};exports[_0xdd61('0x1d')]=function(_0xd091ad,_0x71743f){return pm2[_0xdd61('0x1d')](_0xdd61('0x1e'))[_0xdd61('0x1f')](function(_0x2d980b){logger[_0xdd61('0x15')](_0xdd61('0x20'),_0x2d980b);return _0x71743f[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x21')});})[_0xdd61('0x22')](function(_0x5c5a85){logger[_0xdd61('0x14')](_0x5c5a85);return _0x71743f['status'](0x1f4)[_0xdd61('0x12')](_0x5c5a85);});};exports[_0xdd61('0x23')]=function(_0x5b1cb1,_0x1247b6){var _0x342b3b=fs[_0xdd61('0x24')](path['join'](config[_0xdd61('0xb')],_0xdd61('0x25'),_0xdd61('0x23')));var _0xb69698=[];for(var _0x597f34=0x0;_0x597f34<_0x342b3b[_0xdd61('0x26')];_0x597f34++){var _0x242384=_0x342b3b[_0x597f34][_0xdd61('0x27')](_0xdd61('0x28'),'');if(compareVersions(module[_0xdd61('0xd')]['version'],_0x242384)===-0x1){_0xb69698[_0xdd61('0x29')](_0x242384);}}if(_0xb69698['length']){var _0x2d9621=_0xb69698['sort'](compareVersions);var _0x4ff00a=new Umzug({'storage':_0xdd61('0x2a'),'storageOptions':{'model':db[_0xdd61('0x2b')],'modelName':_0xdd61('0x2b'),'columnName':_0xdd61('0x3')},'migrations':{'params':[db[_0xdd61('0x2a')][_0xdd61('0x2c')](),db[_0xdd61('0x2a')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xdd61('0xb')],_0xdd61('0x25'),_0xdd61('0x23')),'pattern':/\.js$/}});_0x4ff00a['up']({'migrations':_[_0xdd61('0x2d')](_0x2d9621,function(_0x30fafa){return _0x30fafa+_0xdd61('0x28');})})[_0xdd61('0x1f')](function(){return _0x1247b6[_0xdd61('0x11')](0xc8)['json']({'output':_0xdd61('0x2e')+module[_0xdd61('0xd')]['version']+_0xdd61('0x2f')+_[_0xdd61('0x30')](_0x2d9621),'migrations':_[_0xdd61('0x31')](_0x2d9621)});})[_0xdd61('0x22')](function(_0x293c6d){if(_0x293c6d instanceof db[_0xdd61('0x2a')][_0xdd61('0x32')]){return _0x1247b6[_0xdd61('0x11')](0xc8)['json']({'output':_0xdd61('0x33')});}else{return _0x1247b6['status'](0x1f4)[_0xdd61('0x12')](_0x293c6d);}});}else{return _0x1247b6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 38dc914..5728f35 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 _0x0e87=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x58a872,_0x50d43a){var _0x3e1577=function(_0x21c808){while(--_0x21c808){_0x58a872['push'](_0x58a872['shift']());}};_0x3e1577(++_0x50d43a);}(_0x0e87,0xb7));var _0x70e8=function(_0x52284,_0xea39ec){_0x52284=_0x52284-0x0;var _0x3b78f7=_0x0e87[_0x52284];return _0x3b78f7;};'use strict';var multer=require('multer');var util=require(_0x70e8('0x0'));var path=require(_0x70e8('0x1'));var timeout=require(_0x70e8('0x2'));var express=require('express');var router=express[_0x70e8('0x3')]();var fs_extra=require(_0x70e8('0x4'));var auth=require(_0x70e8('0x5'));var interaction=require(_0x70e8('0x6'));var config=require(_0x70e8('0x7'));var controller=require(_0x70e8('0x8'));router[_0x70e8('0x9')]('/',auth[_0x70e8('0xa')](),controller[_0x70e8('0xb')]);router[_0x70e8('0x9')](_0x70e8('0xc'),auth['isAuthenticated'](),controller[_0x70e8('0xd')]);router[_0x70e8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x70e8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x70e8('0xf')]);router[_0x70e8('0x10')](_0x70e8('0x11'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x12')]);router[_0x70e8('0x13')](_0x70e8('0x11'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x14')]);module[_0x70e8('0x15')]=router; \ No newline at end of file +var _0xbeba=['describe','/:id','show','post','create','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbeba,0x7a));var _0xabeb=function(_0x393855,_0x320ac8){_0x393855=_0x393855-0x0;var _0x16cee3=_0xbeba[_0x393855];return _0x16cee3;};'use strict';var multer=require(_0xabeb('0x0'));var util=require('util');var path=require(_0xabeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xabeb('0x2'));var router=express[_0xabeb('0x3')]();var fs_extra=require(_0xabeb('0x4'));var auth=require(_0xabeb('0x5'));var interaction=require(_0xabeb('0x6'));var config=require(_0xabeb('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xabeb('0x8')]('/',auth['isAuthenticated'](),controller[_0xabeb('0x9')]);router[_0xabeb('0x8')]('/describe',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x8')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0xd')]);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['put'](_0xabeb('0xc'),auth['isAuthenticated'](),controller[_0xabeb('0x10')]);router[_0xabeb('0x11')]('/:id',auth[_0xabeb('0xa')](),controller[_0xabeb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b3e4dcb..7b8fe7b 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 _0xa866=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x326034,_0x2df5c0){var _0x2aea92=function(_0x5d15cd){while(--_0x5d15cd){_0x326034['push'](_0x326034['shift']());}};_0x2aea92(++_0x2df5c0);}(_0xa866,0x6a));var _0x6a86=function(_0x802c16,_0x207627){_0x802c16=_0x802c16-0x0;var _0x4d456d=_0xa866[_0x802c16];return _0x4d456d;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'type':{'type':Sequelize[_0x6a86('0x2')]},'uniqueid':{'type':Sequelize[_0x6a86('0x2')]},'calleridnum':{'type':Sequelize[_0x6a86('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6a86('0x2')]},'interface':{'type':Sequelize[_0x6a86('0x2')]},'membername':{'type':Sequelize[_0x6a86('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6a86('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6a86('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6a86('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6a86('0x4')]},'agentcomplete':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6a86('0x4')]},'agentacw':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a86('0x4')]},'reason':{'type':Sequelize[_0x6a86('0x2')]},'lastevent':{'type':Sequelize[_0x6a86('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6a86('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6a86('0x2')]},'accountcode':{'type':Sequelize[_0x6a86('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6a86('0x2')]},'destchannel':{'type':Sequelize[_0x6a86('0x2')]},'destchannelstate':{'type':Sequelize[_0x6a86('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridname':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6a86('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6a86('0x2')]},'destcontext':{'type':Sequelize[_0x6a86('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6a86('0x2')]},'destuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6a86('0x2')]},'transfer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a86('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6a86('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c52=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x1c52,0x7c));var _0x21c5=function(_0x3c7475,_0x24f8df){_0x3c7475=_0x3c7475-0x0;var _0x2f3a8d=_0x1c52[_0x3c7475];return _0x2f3a8d;};'use strict';var Sequelize=require(_0x21c5('0x0'));module[_0x21c5('0x1')]={'type':{'type':Sequelize[_0x21c5('0x2')]},'uniqueid':{'type':Sequelize[_0x21c5('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x21c5('0x2')]},'membername':{'type':Sequelize[_0x21c5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x21c5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x21c5('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x21c5('0x3')]},'agentdumpAt':{'type':Sequelize[_0x21c5('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x21c5('0x5')]},'agentacw':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x21c5('0x5')]},'reason':{'type':Sequelize[_0x21c5('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x21c5('0x2')]},'channelstate':{'type':Sequelize[_0x21c5('0x5')]},'channelstatedesc':{'type':Sequelize[_0x21c5('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x21c5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x21c5('0x2')]},'context':{'type':Sequelize[_0x21c5('0x2')]},'exten':{'type':Sequelize[_0x21c5('0x2')]},'priority':{'type':Sequelize[_0x21c5('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x21c5('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x21c5('0x2')]},'destcalleridname':{'type':Sequelize[_0x21c5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x21c5('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x21c5('0x2')]},'destexten':{'type':Sequelize[_0x21c5('0x2')]},'destpriority':{'type':Sequelize[_0x21c5('0x2')]},'destuniqueid':{'type':Sequelize[_0x21c5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x21c5('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x21c5('0x2')]},'transfer':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x21c5('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x21c5('0x5')],'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 94284cb..21bfda9 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 0a163db..4cca2e3 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 _0x5a5a=['moment','bluebird','path','rimraf','../../config/environment','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x2f2c27,_0x250129){var _0x1654af=function(_0x54a8cd){while(--_0x54a8cd){_0x2f2c27['push'](_0x2f2c27['shift']());}};_0x1654af(++_0x250129);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x5101f5,_0x16463e){_0x5101f5=_0x5101f5-0x0;var _0x56bf84=_0x5a5a[_0x5101f5];return _0x56bf84;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var logger=require(_0xa5a5('0x1'))(_0xa5a5('0x2'));var moment=require(_0xa5a5('0x3'));var BPromise=require(_0xa5a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a5('0x5'));var rimraf=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x43943d,_0x1fe96d){return _0x43943d['define'](_0xa5a5('0x8'),attributes,{'tableName':_0xa5a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a5('0xa'),_0xa5a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bac=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x3fb420,_0x135179){var _0x43fff8=function(_0x353b93){while(--_0x353b93){_0x3fb420['push'](_0x3fb420['shift']());}};_0x43fff8(++_0x135179);}(_0x6bac,0xa5));var _0xc6ba=function(_0xcf5837,_0x518ad6){_0xcf5837=_0xcf5837-0x0;var _0x252da3=_0x6bac[_0xcf5837];return _0x252da3;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var logger=require(_0xc6ba('0x1'))(_0xc6ba('0x2'));var moment=require(_0xc6ba('0x3'));var BPromise=require(_0xc6ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ba('0x5'));var attributes=require(_0xc6ba('0x6'));module['exports']=function(_0x222f20,_0x2a16af){return _0x222f20[_0xc6ba('0x7')](_0xc6ba('0x8'),attributes,{'tableName':_0xc6ba('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc6ba('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2fce695..d79aa11 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 _0x5841=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','UpdateVoiceAgentReport','update','options','limit','util','moment'];(function(_0xce5257,_0x461117){var _0x1d5cfd=function(_0x53270e){while(--_0x53270e){_0xce5257['push'](_0xce5257['shift']());}};_0x1d5cfd(++_0x461117);}(_0x5841,0x1be));var _0x1584=function(_0x2e095d,_0x18af1d){_0x2e095d=_0x2e095d-0x0;var _0x5cb8bd=_0x5841[_0x2e095d];return _0x5cb8bd;};'use strict';var _=require('lodash');var util=require(_0x1584('0x0'));var moment=require(_0x1584('0x1'));var BPromise=require(_0x1584('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1584('0x3'));var db=require(_0x1584('0x4'))['db'];var utils=require(_0x1584('0x5'));var logger=require(_0x1584('0x6'))(_0x1584('0x7'));var config=require(_0x1584('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1584('0x9')][_0x1584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59487f,_0x3458f8,_0x3a3097){return new BPromise(function(_0x165b2e,_0x207b2e){return client[_0x1584('0xb')](_0x59487f,_0x3a3097)['then'](function(_0x356089){logger[_0x1584('0xc')](_0x1584('0xd'),_0x3458f8,_0x1584('0xe'));logger[_0x1584('0xf')](_0x1584('0x10'),_0x3458f8,_0x1584('0xe'),JSON[_0x1584('0x11')](_0x356089));if(_0x356089[_0x1584('0x12')]){if(_0x356089['error'][_0x1584('0x13')]===0x1f4){logger[_0x1584('0x12')](_0x1584('0xd'),_0x3458f8,_0x356089[_0x1584('0x12')][_0x1584('0x14')]);return _0x207b2e(_0x356089[_0x1584('0x12')][_0x1584('0x14')]);}logger[_0x1584('0x12')](_0x1584('0xd'),_0x3458f8,_0x356089[_0x1584('0x12')][_0x1584('0x14')]);return _0x165b2e(_0x356089[_0x1584('0x12')][_0x1584('0x14')]);}else{logger['info'](_0x1584('0xd'),_0x3458f8,_0x1584('0xe'));_0x165b2e(_0x356089[_0x1584('0x15')][_0x1584('0x14')]);}})[_0x1584('0x16')](function(_0x132cf1){logger[_0x1584('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x3458f8,_0x132cf1);_0x207b2e(_0x132cf1);});});}exports[_0x1584('0x17')]=function(_0x750546){var _0x1bd9ca=this;return new Promise(function(_0x32e649,_0x5ab66f){return db[_0x1584('0x18')][_0x1584('0x19')](_0x750546[_0x1584('0x1a')],{'raw':_0x750546['options']?_0x750546['options'][_0x1584('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31c58a){logger[_0x1584('0xc')]('CreateVoiceAgentReport',_0x750546);logger[_0x1584('0xf')](_0x1584('0x17'),_0x750546,JSON[_0x1584('0x11')](_0x31c58a));_0x32e649(_0x31c58a);})['catch'](function(_0x20f0a6){logger[_0x1584('0x12')](_0x1584('0x17'),_0x20f0a6[_0x1584('0x14')],_0x750546);_0x5ab66f(_0x1bd9ca[_0x1584('0x12')](0x1f4,_0x20f0a6[_0x1584('0x14')]));});});};exports[_0x1584('0x1c')]=function(_0x124420){var _0x4a70b7=this;return new Promise(function(_0x413a1f,_0x432ada){return db[_0x1584('0x18')][_0x1584('0x1d')](_0x124420['body'],{'raw':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')]['where']||null:null,'attributes':_0x124420['options']?_0x124420[_0x1584('0x1e')]['attributes']||null:null,'limit':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')][_0x1584('0x1f')]||null:null})['then'](function(_0x2200a2){logger[_0x1584('0xc')](_0x1584('0x1c'),_0x124420);logger[_0x1584('0xf')]('UpdateVoiceAgentReport',_0x124420,JSON[_0x1584('0x11')](_0x2200a2));_0x413a1f(_0x2200a2);})[_0x1584('0x16')](function(_0x4951c8){logger[_0x1584('0x12')](_0x1584('0x1c'),_0x4951c8[_0x1584('0x14')],_0x124420);_0x432ada(_0x4a70b7['error'](0x1f4,_0x4951c8[_0x1584('0x14')]));});});}; \ No newline at end of file +var _0xd3b0=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd3b0,0x11a));var _0x0d3b=function(_0x528c98,_0x185c88){_0x528c98=_0x528c98-0x0;var _0x526594=_0xd3b0[_0x528c98];return _0x526594;};'use strict';var _=require('lodash');var util=require(_0x0d3b('0x0'));var moment=require(_0x0d3b('0x1'));var BPromise=require(_0x0d3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d3b('0x3'));var db=require(_0x0d3b('0x4'))['db'];var utils=require(_0x0d3b('0x5'));var logger=require(_0x0d3b('0x6'))(_0x0d3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d3b('0x8'));var client=jayson[_0x0d3b('0x9')][_0x0d3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23f811,_0x1d24a9,_0x586756){return new BPromise(function(_0x43e600,_0x17e26e){return client[_0x0d3b('0xb')](_0x23f811,_0x586756)[_0x0d3b('0xc')](function(_0x2145d6){logger[_0x0d3b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x0d3b('0xe'));logger[_0x0d3b('0xf')](_0x0d3b('0x10'),_0x1d24a9,'request\x20sent',JSON[_0x0d3b('0x11')](_0x2145d6));if(_0x2145d6[_0x0d3b('0x12')]){if(_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x13')]===0x1f4){logger[_0x0d3b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x14')]);return _0x17e26e(_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x14')]);}logger[_0x0d3b('0x12')](_0x0d3b('0x15'),_0x1d24a9,_0x2145d6['error'][_0x0d3b('0x14')]);return _0x43e600(_0x2145d6[_0x0d3b('0x12')]['message']);}else{logger[_0x0d3b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x0d3b('0xe'));_0x43e600(_0x2145d6[_0x0d3b('0x16')]['message']);}})[_0x0d3b('0x17')](function(_0x1fae22){logger[_0x0d3b('0x12')](_0x0d3b('0x15'),_0x1d24a9,_0x1fae22);_0x17e26e(_0x1fae22);});});}exports[_0x0d3b('0x18')]=function(_0x3766c3){var _0x32444f=this;return new Promise(function(_0x4b6eb2,_0x379e75){return db[_0x0d3b('0x19')][_0x0d3b('0x1a')](_0x3766c3[_0x0d3b('0x1b')],{'raw':_0x3766c3[_0x0d3b('0x1c')]?_0x3766c3[_0x0d3b('0x1c')][_0x0d3b('0x1d')]===undefined?!![]:![]:!![]})[_0x0d3b('0xc')](function(_0x2fdb73){logger['info'](_0x0d3b('0x18'),_0x3766c3);logger['debug'](_0x0d3b('0x18'),_0x3766c3,JSON[_0x0d3b('0x11')](_0x2fdb73));_0x4b6eb2(_0x2fdb73);})[_0x0d3b('0x17')](function(_0x337f0f){logger[_0x0d3b('0x12')](_0x0d3b('0x18'),_0x337f0f['message'],_0x3766c3);_0x379e75(_0x32444f[_0x0d3b('0x12')](0x1f4,_0x337f0f[_0x0d3b('0x14')]));});});};exports[_0x0d3b('0x1e')]=function(_0xd4eca){var _0x44bd11=this;return new Promise(function(_0x4e58ad,_0x34aadb){return db[_0x0d3b('0x19')][_0x0d3b('0x1f')](_0xd4eca[_0x0d3b('0x1b')],{'raw':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca[_0x0d3b('0x1c')][_0x0d3b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca[_0x0d3b('0x1c')][_0x0d3b('0x20')]||null:null,'attributes':_0xd4eca['options']?_0xd4eca[_0x0d3b('0x1c')]['attributes']||null:null,'limit':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca['options']['limit']||null:null})['then'](function(_0x4f4dc3){logger[_0x0d3b('0xd')](_0x0d3b('0x1e'),_0xd4eca);logger[_0x0d3b('0xf')](_0x0d3b('0x1e'),_0xd4eca,JSON[_0x0d3b('0x11')](_0x4f4dc3));_0x4e58ad(_0x4f4dc3);})['catch'](function(_0x16a371){logger['error']('UpdateVoiceAgentReport',_0x16a371[_0x0d3b('0x14')],_0xd4eca);_0x34aadb(_0x44bd11[_0x0d3b('0x12')](0x1f4,_0x16a371[_0x0d3b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a4740cc..b9bae71 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 _0x80bd=['show','put','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','../../components/auth/service','isAuthenticated','index','get','describe','/:id'];(function(_0x5aa8e0,_0x1e552c){var _0x4f4060=function(_0x247415){while(--_0x247415){_0x5aa8e0['push'](_0x5aa8e0['shift']());}};_0x4f4060(++_0x1e552c);}(_0x80bd,0x1f1));var _0xd80b=function(_0x3ddcfb,_0x46a1c9){_0x3ddcfb=_0x3ddcfb-0x0;var _0x4392bf=_0x80bd[_0x3ddcfb];return _0x4392bf;};'use strict';var express=require(_0xd80b('0x0'));var router=express['Router']();var auth=require(_0xd80b('0x1'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xd80b('0x2')](),controller[_0xd80b('0x3')]);router[_0xd80b('0x4')]('/describe',auth[_0xd80b('0x2')](),controller[_0xd80b('0x5')]);router[_0xd80b('0x4')](_0xd80b('0x6'),auth['isAuthenticated'](),controller[_0xd80b('0x7')]);router['post']('/',auth[_0xd80b('0x2')](),controller['create']);router[_0xd80b('0x8')](_0xd80b('0x6'),auth['isAuthenticated'](),controller['update']);router['put'](_0xd80b('0x9'),auth[_0xd80b('0x2')](),controller[_0xd80b('0xa')]);router[_0xd80b('0xb')](_0xd80b('0x6'),auth[_0xd80b('0x2')](),controller[_0xd80b('0xc')]);module[_0xd80b('0xd')]=router; \ No newline at end of file +var _0x5ffd=['express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','updateWithRetry','delete'];(function(_0x36305b,_0x261db5){var _0x50cfb5=function(_0x582d5d){while(--_0x582d5d){_0x36305b['push'](_0x36305b['shift']());}};_0x50cfb5(++_0x261db5);}(_0x5ffd,0x88));var _0xd5ff=function(_0x3e8da1,_0x577c14){_0x3e8da1=_0x3e8da1-0x0;var _0x255176=_0x5ffd[_0x3e8da1];return _0x255176;};'use strict';var express=require(_0xd5ff('0x0'));var router=express[_0xd5ff('0x1')]();var auth=require(_0xd5ff('0x2'));var controller=require(_0xd5ff('0x3'));router[_0xd5ff('0x4')]('/',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0x6')]);router['get'](_0xd5ff('0x7'),auth['isAuthenticated'](),controller[_0xd5ff('0x8')]);router['get']('/:id',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0x9')]);router[_0xd5ff('0xa')]('/',auth['isAuthenticated'](),controller[_0xd5ff('0xb')]);router[_0xd5ff('0xc')](_0xd5ff('0xd'),auth[_0xd5ff('0x5')](),controller[_0xd5ff('0xe')]);router['put']('/with-retry/:id',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0xf')]);router[_0xd5ff('0x10')]('/:id',auth[_0xd5ff('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9a035d6..68f881d 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 _0x7200=['dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x35e3b8,_0x1f543f){var _0xae5b9a=function(_0x483dd6){while(--_0x483dd6){_0x35e3b8['push'](_0x35e3b8['shift']());}};_0xae5b9a(++_0x1f543f);}(_0x7200,0x1a8));var _0x0720=function(_0x44e50a,_0x1cc4a2){_0x44e50a=_0x44e50a-0x0;var _0x1b5994=_0x7200[_0x44e50a];return _0x1b5994;};'use strict';var Sequelize=require(_0x0720('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0720('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0720('0x2'),_0x0720('0x3'),_0x0720('0x4'),_0x0720('0x5'),'outbound-fax',_0x0720('0x6'))},'tag':{'type':Sequelize[_0x0720('0x1')]},'accountcode':{'type':Sequelize[_0x0720('0x1')]},'source':{'type':Sequelize[_0x0720('0x1')]},'destination':{'type':Sequelize[_0x0720('0x1')]},'destinationcontext':{'type':Sequelize[_0x0720('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0720('0x1')]},'destinationchannel':{'type':Sequelize[_0x0720('0x1')]},'lastapplication':{'type':Sequelize[_0x0720('0x1')]},'lastdata':{'type':Sequelize[_0x0720('0x7')]},'starttime':{'type':Sequelize[_0x0720('0x8')]},'systemanswertime':{'type':Sequelize[_0x0720('0x8')]},'answertime':{'type':Sequelize[_0x0720('0x8')]},'endtime':{'type':Sequelize[_0x0720('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0720('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0720('0x1')]},'userfield':{'type':Sequelize[_0x0720('0x1')]},'userDisposition':{'type':Sequelize[_0x0720('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x0720('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x0720('0x1')]},'note':{'type':Sequelize[_0x0720('0x1')]},'prefix':{'type':Sequelize[_0x0720('0x1')]},'routeid':{'type':Sequelize[_0x0720('0x9')]},'sipcallid':{'type':Sequelize[_0x0720('0x1')]}}; \ No newline at end of file +var _0xc4e9=['sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc4e9,0x144));var _0x9c4e=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0xc4e9[_0x1b69aa];return _0x42647d;};'use strict';var Sequelize=require(_0x9c4e('0x0'));module[_0x9c4e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9c4e('0x2')](_0x9c4e('0x3'),_0x9c4e('0x4'),_0x9c4e('0x5'),_0x9c4e('0x6'),_0x9c4e('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9c4e('0x8')]},'source':{'type':Sequelize[_0x9c4e('0x8')]},'destination':{'type':Sequelize[_0x9c4e('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9c4e('0x8')]},'channel':{'type':Sequelize[_0x9c4e('0x8')]},'destinationchannel':{'type':Sequelize[_0x9c4e('0x8')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x9c4e('0x9')]},'starttime':{'type':Sequelize[_0x9c4e('0xa')]},'systemanswertime':{'type':Sequelize[_0x9c4e('0xa')]},'answertime':{'type':Sequelize[_0x9c4e('0xa')]},'endtime':{'type':Sequelize[_0x9c4e('0xa')]},'duration':{'type':Sequelize[_0x9c4e('0xb')]},'billableseconds':{'type':Sequelize[_0x9c4e('0xb')]},'mohtime':{'type':Sequelize[_0x9c4e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9c4e('0x8')]},'amaflags':{'type':Sequelize[_0x9c4e('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'note':{'type':Sequelize[_0x9c4e('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x9c4e('0xb')]},'sipcallid':{'type':Sequelize[_0x9c4e('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5d55a77..e1caa95 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 _0xa5c9=['status','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','VoiceCallReport','count','includeAll','include','alias','User','findAll','catch','show','keys','options','find','create','body','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','undefined','offset','limit'];(function(_0x5dc335,_0x1a2daa){var _0x3a35e7=function(_0x341c0f){while(--_0x341c0f){_0x5dc335['push'](_0x5dc335['shift']());}};_0x3a35e7(++_0x1a2daa);}(_0xa5c9,0x143));var _0x9a5c=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xa5c9[_0x289e64];return _0x30246c;};'use strict';var _=require(_0x9a5c('0x0'));var qs=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x2fbbbd,_0x1d80b0){_0x1d80b0=_0x1d80b0||0xc8;return function(_0x55bcf5){if(_0x55bcf5){return _0x2fbbbd['status'](_0x1d80b0)['json'](_0x55bcf5);}};}function respondWithFilteredResult(_0x2fef4c,_0x2a697c){return function(_0x2cac2a){if(_0x2cac2a){var _0x3bb6f2=typeof _0x2a697c['offset']===_0x9a5c('0x4')&&typeof _0x2a697c['limit']===_0x9a5c('0x4');var _0x33fcd8=_0x2cac2a['count'];var _0x127932=_0x3bb6f2?0x0:_0x2a697c[_0x9a5c('0x5')];var _0x1205e3=_0x3bb6f2?_0x2cac2a['count']:_0x2a697c['offset']+_0x2a697c[_0x9a5c('0x6')];var _0x7af197;if(_0x1205e3>=_0x33fcd8){_0x1205e3=_0x33fcd8;_0x7af197=0xc8;}else{_0x7af197=0xce;}_0x2fef4c[_0x9a5c('0x7')](_0x7af197);return _0x2fef4c[_0x9a5c('0x8')](_0x9a5c('0x9'),_0x127932+'-'+_0x1205e3+'/'+_0x33fcd8)[_0x9a5c('0xa')](_0x2cac2a);}return null;};}function saveUpdates(_0xa1c7d5){return function(_0x957b17){if(_0x957b17){return _0x957b17[_0x9a5c('0xb')](_0xa1c7d5)[_0x9a5c('0xc')](function(_0x229580){return _0x229580;});}return null;};}function removeEntity(_0x1bec7c){return function(_0x546c0b){if(_0x546c0b){return _0x546c0b[_0x9a5c('0xd')]()[_0x9a5c('0xc')](function(){_0x1bec7c[_0x9a5c('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320725){return function(_0x1f008e){if(!_0x1f008e){_0x320725['sendStatus'](0x194);}return _0x1f008e;};}function handleError(_0x16422d,_0x5ef98e){_0x5ef98e=_0x5ef98e||0x1f4;return function(_0x350bd5){logger['error'](_0x350bd5[_0x9a5c('0xe')]);if(_0x350bd5[_0x9a5c('0xf')]){delete _0x350bd5['name'];}_0x16422d[_0x9a5c('0x7')](_0x5ef98e)[_0x9a5c('0x10')](_0x350bd5);};}exports[_0x9a5c('0x11')]=function(_0x4bb262,_0x549a96){var _0x2ff36a={},_0x1b13d2={},_0x5e2bd3={'count':0x0,'rows':[]};var _0x139ec4=_[_0x9a5c('0x12')](db['VoiceCallReport'][_0x9a5c('0x13')],function(_0x41283c){return{'name':_0x41283c[_0x9a5c('0x14')],'type':_0x41283c['type'][_0x9a5c('0x15')]};});_0x1b13d2[_0x9a5c('0x16')]=_['map'](_0x139ec4,_0x9a5c('0xf'));_0x1b13d2[_0x9a5c('0x17')]=_['keys'](_0x4bb262[_0x9a5c('0x17')]);_0x1b13d2[_0x9a5c('0x18')]=_[_0x9a5c('0x19')](_0x1b13d2['model'],_0x1b13d2[_0x9a5c('0x17')]);_0x2ff36a[_0x9a5c('0x1a')]=_[_0x9a5c('0x19')](_0x1b13d2[_0x9a5c('0x16')],qs[_0x9a5c('0x1b')](_0x4bb262[_0x9a5c('0x17')]['fields']));_0x2ff36a['attributes']=_0x2ff36a[_0x9a5c('0x1a')][_0x9a5c('0x1c')]?_0x2ff36a[_0x9a5c('0x1a')]:_0x1b13d2[_0x9a5c('0x16')];if(!_0x4bb262['query'][_0x9a5c('0x1d')](_0x9a5c('0x1e'))){_0x2ff36a[_0x9a5c('0x6')]=qs[_0x9a5c('0x6')](_0x4bb262[_0x9a5c('0x17')][_0x9a5c('0x6')]);_0x2ff36a[_0x9a5c('0x5')]=qs[_0x9a5c('0x5')](_0x4bb262[_0x9a5c('0x17')]['offset']);}_0x2ff36a[_0x9a5c('0x1f')]=qs['sort'](_0x4bb262['query']['sort']);_0x2ff36a[_0x9a5c('0x20')]=qs[_0x9a5c('0x18')](_[_0x9a5c('0x21')](_0x4bb262[_0x9a5c('0x17')],_0x1b13d2[_0x9a5c('0x18')]),_0x139ec4);if(_0x4bb262[_0x9a5c('0x17')]['filter']){_0x2ff36a[_0x9a5c('0x20')]=_[_0x9a5c('0x22')](_0x2ff36a[_0x9a5c('0x20')],{'$or':_['map'](_0x139ec4,function(_0x39945c){if(_0x39945c[_0x9a5c('0x23')]!==_0x9a5c('0x24')){var _0x29bb2b={};_0x29bb2b[_0x39945c['name']]={'$like':'%'+_0x4bb262[_0x9a5c('0x17')]['filter']+'%'};return _0x29bb2b;}})});}_0x2ff36a=_[_0x9a5c('0x22')]({},_0x2ff36a,_0x4bb262['options']);var _0x234c32={'where':_0x2ff36a[_0x9a5c('0x20')]};return db[_0x9a5c('0x25')][_0x9a5c('0x26')](_0x234c32)[_0x9a5c('0xc')](function(_0x3792eb){_0x5e2bd3['count']=_0x3792eb;if(_0x4bb262[_0x9a5c('0x17')][_0x9a5c('0x27')]){_0x2ff36a[_0x9a5c('0x28')]=[{'attributes':['id',_0x9a5c('0xf'),'fullname',_0x9a5c('0x29')],'model':db[_0x9a5c('0x2a')],'as':'User'}];}return db[_0x9a5c('0x25')][_0x9a5c('0x2b')](_0x2ff36a);})['then'](function(_0x37146a){_0x5e2bd3['rows']=_0x37146a;return _0x5e2bd3;})[_0x9a5c('0xc')](respondWithFilteredResult(_0x549a96,_0x2ff36a))[_0x9a5c('0x2c')](handleError(_0x549a96,null));};exports[_0x9a5c('0x2d')]=function(_0x2f6302,_0xac97e4){var _0x55d06b={'raw':!![],'where':{'id':_0x2f6302['params']['id']}},_0x5ca745={};_0x5ca745['model']=_[_0x9a5c('0x2e')](db[_0x9a5c('0x25')][_0x9a5c('0x13')]);_0x5ca745[_0x9a5c('0x17')]=_[_0x9a5c('0x2e')](_0x2f6302[_0x9a5c('0x17')]);_0x5ca745[_0x9a5c('0x18')]=_[_0x9a5c('0x19')](_0x5ca745[_0x9a5c('0x16')],_0x5ca745[_0x9a5c('0x17')]);_0x55d06b[_0x9a5c('0x1a')]=_['intersection'](_0x5ca745[_0x9a5c('0x16')],qs[_0x9a5c('0x1b')](_0x2f6302[_0x9a5c('0x17')][_0x9a5c('0x1b')]));_0x55d06b['attributes']=_0x55d06b[_0x9a5c('0x1a')][_0x9a5c('0x1c')]?_0x55d06b['attributes']:_0x5ca745[_0x9a5c('0x16')];if(_0x2f6302[_0x9a5c('0x17')][_0x9a5c('0x27')]){_0x55d06b[_0x9a5c('0x28')]=[{'all':!![]}];}_0x55d06b=_[_0x9a5c('0x22')]({},_0x55d06b,_0x2f6302[_0x9a5c('0x2f')]);return db[_0x9a5c('0x25')][_0x9a5c('0x30')](_0x55d06b)[_0x9a5c('0xc')](handleEntityNotFound(_0xac97e4,null))[_0x9a5c('0xc')](respondWithResult(_0xac97e4,null))['catch'](handleError(_0xac97e4,null));};exports['create']=function(_0x13e866,_0x3456a7){return db[_0x9a5c('0x25')][_0x9a5c('0x31')](_0x13e866[_0x9a5c('0x32')],{})[_0x9a5c('0xc')](respondWithResult(_0x3456a7,0xc9))[_0x9a5c('0x2c')](handleError(_0x3456a7,null));};exports[_0x9a5c('0xd')]=function(_0x28775c,_0x38c031){return db[_0x9a5c('0x25')][_0x9a5c('0x30')]({'where':{'id':_0x28775c['params']['id']}})['then'](handleEntityNotFound(_0x38c031,null))[_0x9a5c('0xc')](removeEntity(_0x38c031,null))[_0x9a5c('0x2c')](handleError(_0x38c031,null));};exports['describe']=function(_0x5bb590,_0x311524){return db['VoiceCallReport']['describe']()['then'](respondWithResult(_0x311524,null))[_0x9a5c('0x2c')](handleError(_0x311524,null));};function findForUpdate(_0x53b8ad){return db[_0x9a5c('0x25')][_0x9a5c('0x30')]({'where':{'uniqueid':_0x53b8ad['params']['id'],'UserId':{'$or':[null,_0x53b8ad[_0x9a5c('0x33')]['id']]}}});}exports[_0x9a5c('0xb')]=function(_0x56ede0,_0x3f434e){if(_0x56ede0[_0x9a5c('0x32')]['uniqueid']){delete _0x56ede0['body'][_0x9a5c('0x34')];}return findForUpdate(_0x56ede0)[_0x9a5c('0xc')](handleEntityNotFound(_0x3f434e,null))[_0x9a5c('0xc')](saveUpdates(_0x56ede0['body'],null))[_0x9a5c('0xc')](respondWithResult(_0x3f434e,null))[_0x9a5c('0x2c')](handleError(_0x3f434e,null));};exports[_0x9a5c('0x35')]=function(_0x3f19c1,_0x49bc11,_0x46fb24){if(_0x3f19c1[_0x9a5c('0x32')]['uniqueid']){delete _0x3f19c1[_0x9a5c('0x32')][_0x9a5c('0x34')];}promiseRetry(function(_0x2831dc){return findForUpdate(_0x3f19c1)[_0x9a5c('0xc')](function(_0xab882b){if(_0xab882b!==null){return _0xab882b;}else{_0x2831dc(new Error(_0x9a5c('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x9a5c('0xc')](function(_0x5e0297){if(!_0x5e0297){return new Promise(function(_0x2782c4){_0x2782c4(handleEntityNotFound(_0x49bc11)());});}else{return _0x5e0297['update'](_0x3f19c1[_0x9a5c('0x32')])['then'](function(_0x45a394){return respondWithResult(_0x49bc11)(_0x45a394);});}},function(){handleEntityNotFound(_0x49bc11)();});}; \ No newline at end of file +var _0x11c8=['rows','include','find','create','body','catch','describe','params','user','uniqueid','updateWithRetry','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','sendStatus','error','stack','name','send','index','VoiceCallReport','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','alias','User','findAll'];(function(_0x19921b,_0x5c0c2d){var _0x273545=function(_0x387462){while(--_0x387462){_0x19921b['push'](_0x19921b['shift']());}};_0x273545(++_0x5c0c2d);}(_0x11c8,0x19a));var _0x811c=function(_0x3a8bf9,_0x5f2c5e){_0x3a8bf9=_0x3a8bf9-0x0;var _0x1f9611=_0x11c8[_0x3a8bf9];return _0x1f9611;};'use strict';var _=require('lodash');var qs=require(_0x811c('0x0'));var logger=require(_0x811c('0x1'))('api');var db=require(_0x811c('0x2'))['db'];const promiseRetry=require(_0x811c('0x3'));function respondWithResult(_0x46f72b,_0x85a54c){_0x85a54c=_0x85a54c||0xc8;return function(_0x16f1d6){if(_0x16f1d6){return _0x46f72b[_0x811c('0x4')](_0x85a54c)['json'](_0x16f1d6);}};}function respondWithFilteredResult(_0x10fecb,_0x40cc07){return function(_0x537216){if(_0x537216){var _0x126cc2=typeof _0x40cc07[_0x811c('0x5')]===_0x811c('0x6')&&typeof _0x40cc07[_0x811c('0x7')]==='undefined';var _0x47b070=_0x537216['count'];var _0x5be7fc=_0x126cc2?0x0:_0x40cc07['offset'];var _0x4ce7c4=_0x126cc2?_0x537216[_0x811c('0x8')]:_0x40cc07[_0x811c('0x5')]+_0x40cc07['limit'];var _0xd3eaf9;if(_0x4ce7c4>=_0x47b070){_0x4ce7c4=_0x47b070;_0xd3eaf9=0xc8;}else{_0xd3eaf9=0xce;}_0x10fecb[_0x811c('0x4')](_0xd3eaf9);return _0x10fecb[_0x811c('0x9')](_0x811c('0xa'),_0x5be7fc+'-'+_0x4ce7c4+'/'+_0x47b070)[_0x811c('0xb')](_0x537216);}return null;};}function saveUpdates(_0x5959e8){return function(_0x4daca7){if(_0x4daca7){return _0x4daca7[_0x811c('0xc')](_0x5959e8)['then'](function(_0x375244){return _0x375244;});}return null;};}function removeEntity(_0x5f20f7){return function(_0x5a1262){if(_0x5a1262){return _0x5a1262['destroy']()[_0x811c('0xd')](function(){_0x5f20f7[_0x811c('0x4')](0xcc)[_0x811c('0xe')]();});}};}function handleEntityNotFound(_0x12b12e){return function(_0xfd8681){if(!_0xfd8681){_0x12b12e[_0x811c('0xf')](0x194);}return _0xfd8681;};}function handleError(_0x520242,_0x585d94){_0x585d94=_0x585d94||0x1f4;return function(_0x7b7fd7){logger[_0x811c('0x10')](_0x7b7fd7[_0x811c('0x11')]);if(_0x7b7fd7[_0x811c('0x12')]){delete _0x7b7fd7[_0x811c('0x12')];}_0x520242[_0x811c('0x4')](_0x585d94)[_0x811c('0x13')](_0x7b7fd7);};}exports[_0x811c('0x14')]=function(_0x179636,_0x503bbc){var _0xb8a210={},_0x5686f1={},_0x291660={'count':0x0,'rows':[]};var _0x63a81f=_['map'](db[_0x811c('0x15')][_0x811c('0x16')],function(_0x3bcc6b){return{'name':_0x3bcc6b['fieldName'],'type':_0x3bcc6b['type']['key']};});_0x5686f1[_0x811c('0x17')]=_[_0x811c('0x18')](_0x63a81f,_0x811c('0x12'));_0x5686f1['query']=_[_0x811c('0x19')](_0x179636[_0x811c('0x1a')]);_0x5686f1[_0x811c('0x1b')]=_[_0x811c('0x1c')](_0x5686f1['model'],_0x5686f1[_0x811c('0x1a')]);_0xb8a210[_0x811c('0x1d')]=_[_0x811c('0x1c')](_0x5686f1[_0x811c('0x17')],qs[_0x811c('0x1e')](_0x179636[_0x811c('0x1a')]['fields']));_0xb8a210[_0x811c('0x1d')]=_0xb8a210['attributes'][_0x811c('0x1f')]?_0xb8a210[_0x811c('0x1d')]:_0x5686f1[_0x811c('0x17')];if(!_0x179636[_0x811c('0x1a')][_0x811c('0x20')](_0x811c('0x21'))){_0xb8a210['limit']=qs[_0x811c('0x7')](_0x179636[_0x811c('0x1a')][_0x811c('0x7')]);_0xb8a210[_0x811c('0x5')]=qs[_0x811c('0x5')](_0x179636[_0x811c('0x1a')]['offset']);}_0xb8a210[_0x811c('0x22')]=qs[_0x811c('0x23')](_0x179636['query']['sort']);_0xb8a210[_0x811c('0x24')]=qs[_0x811c('0x1b')](_[_0x811c('0x25')](_0x179636['query'],_0x5686f1[_0x811c('0x1b')]),_0x63a81f);if(_0x179636[_0x811c('0x1a')]['filter']){_0xb8a210['where']=_['merge'](_0xb8a210[_0x811c('0x24')],{'$or':_[_0x811c('0x18')](_0x63a81f,function(_0x55e3e7){if(_0x55e3e7[_0x811c('0x26')]!=='VIRTUAL'){var _0x4c43a1={};_0x4c43a1[_0x55e3e7[_0x811c('0x12')]]={'$like':'%'+_0x179636[_0x811c('0x1a')][_0x811c('0x27')]+'%'};return _0x4c43a1;}})});}_0xb8a210=_[_0x811c('0x28')]({},_0xb8a210,_0x179636[_0x811c('0x29')]);var _0x3a2c6f={'where':_0xb8a210[_0x811c('0x24')]};return db[_0x811c('0x15')]['count'](_0x3a2c6f)['then'](function(_0x368dd0){_0x291660[_0x811c('0x8')]=_0x368dd0;if(_0x179636['query'][_0x811c('0x2a')]){_0xb8a210['include']=[{'attributes':['id',_0x811c('0x12'),'fullname',_0x811c('0x2b')],'model':db[_0x811c('0x2c')],'as':'User'}];}return db[_0x811c('0x15')][_0x811c('0x2d')](_0xb8a210);})[_0x811c('0xd')](function(_0x54719d){_0x291660[_0x811c('0x2e')]=_0x54719d;return _0x291660;})['then'](respondWithFilteredResult(_0x503bbc,_0xb8a210))['catch'](handleError(_0x503bbc,null));};exports['show']=function(_0x200a91,_0x226dd7){var _0x5c961a={'raw':!![],'where':{'id':_0x200a91['params']['id']}},_0x5c6a90={};_0x5c6a90[_0x811c('0x17')]=_[_0x811c('0x19')](db[_0x811c('0x15')][_0x811c('0x16')]);_0x5c6a90[_0x811c('0x1a')]=_['keys'](_0x200a91[_0x811c('0x1a')]);_0x5c6a90['filters']=_[_0x811c('0x1c')](_0x5c6a90['model'],_0x5c6a90['query']);_0x5c961a[_0x811c('0x1d')]=_[_0x811c('0x1c')](_0x5c6a90['model'],qs[_0x811c('0x1e')](_0x200a91[_0x811c('0x1a')][_0x811c('0x1e')]));_0x5c961a[_0x811c('0x1d')]=_0x5c961a['attributes'][_0x811c('0x1f')]?_0x5c961a[_0x811c('0x1d')]:_0x5c6a90[_0x811c('0x17')];if(_0x200a91['query']['includeAll']){_0x5c961a[_0x811c('0x2f')]=[{'all':!![]}];}_0x5c961a=_[_0x811c('0x28')]({},_0x5c961a,_0x200a91[_0x811c('0x29')]);return db[_0x811c('0x15')][_0x811c('0x30')](_0x5c961a)[_0x811c('0xd')](handleEntityNotFound(_0x226dd7,null))[_0x811c('0xd')](respondWithResult(_0x226dd7,null))['catch'](handleError(_0x226dd7,null));};exports[_0x811c('0x31')]=function(_0x4a955e,_0x568995){return db[_0x811c('0x15')][_0x811c('0x31')](_0x4a955e[_0x811c('0x32')],{})[_0x811c('0xd')](respondWithResult(_0x568995,0xc9))[_0x811c('0x33')](handleError(_0x568995,null));};exports['destroy']=function(_0x5ca8ec,_0x2123c1){return db['VoiceCallReport'][_0x811c('0x30')]({'where':{'id':_0x5ca8ec['params']['id']}})[_0x811c('0xd')](handleEntityNotFound(_0x2123c1,null))['then'](removeEntity(_0x2123c1,null))['catch'](handleError(_0x2123c1,null));};exports[_0x811c('0x34')]=function(_0x35843e,_0x5589eb){return db[_0x811c('0x15')][_0x811c('0x34')]()[_0x811c('0xd')](respondWithResult(_0x5589eb,null))[_0x811c('0x33')](handleError(_0x5589eb,null));};function findForUpdate(_0x18d5c6){return db[_0x811c('0x15')][_0x811c('0x30')]({'where':{'uniqueid':_0x18d5c6[_0x811c('0x35')]['id'],'UserId':{'$or':[null,_0x18d5c6[_0x811c('0x36')]['id']]}}});}exports[_0x811c('0xc')]=function(_0x31ede3,_0x543d2d){if(_0x31ede3[_0x811c('0x32')][_0x811c('0x37')]){delete _0x31ede3[_0x811c('0x32')][_0x811c('0x37')];}return findForUpdate(_0x31ede3)[_0x811c('0xd')](handleEntityNotFound(_0x543d2d,null))['then'](saveUpdates(_0x31ede3['body'],null))[_0x811c('0xd')](respondWithResult(_0x543d2d,null))[_0x811c('0x33')](handleError(_0x543d2d,null));};exports[_0x811c('0x38')]=function(_0x1d82e7,_0x3b1bb8,_0x12583a){if(_0x1d82e7['body'][_0x811c('0x37')]){delete _0x1d82e7[_0x811c('0x32')][_0x811c('0x37')];}promiseRetry(function(_0x11c154){return findForUpdate(_0x1d82e7)[_0x811c('0xd')](function(_0x2c8ddb){if(_0x2c8ddb!==null){return _0x2c8ddb;}else{_0x11c154(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x811c('0xd')](function(_0x25eff2){if(!_0x25eff2){return new Promise(function(_0x4d8415){_0x4d8415(handleEntityNotFound(_0x3b1bb8)());});}else{return _0x25eff2[_0x811c('0xc')](_0x1d82e7[_0x811c('0x32')])[_0x811c('0xd')](function(_0x250123){return respondWithResult(_0x3b1bb8)(_0x250123);});}},function(){handleEntityNotFound(_0x3b1bb8)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 8a79e11..0200d9d 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 _0x1225=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x50457c,_0x581fae){var _0x4fceb7=function(_0x5174bb){while(--_0x5174bb){_0x50457c['push'](_0x50457c['shift']());}};_0x4fceb7(++_0x581fae);}(_0x1225,0x77));var _0x5122=function(_0x256522,_0x4b29a3){_0x256522=_0x256522-0x0;var _0x5f40b6=_0x1225[_0x256522];return _0x5f40b6;};'use strict';var _=require(_0x5122('0x0'));var util=require(_0x5122('0x1'));var logger=require(_0x5122('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5122('0x3'));var rp=require(_0x5122('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5122('0x5'));var config=require(_0x5122('0x6'));var attributes=require(_0x5122('0x7'));module[_0x5122('0x8')]=function(_0x18b8b9,_0x226365){return _0x18b8b9[_0x5122('0x9')](_0x5122('0xa'),attributes,{'tableName':_0x5122('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f57=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2f57,0x1a2));var _0x72f5=function(_0x480d67,_0x3110a9){_0x480d67=_0x480d67-0x0;var _0x32752b=_0x2f57[_0x480d67];return _0x32752b;};'use strict';var _=require(_0x72f5('0x0'));var util=require(_0x72f5('0x1'));var logger=require('../../config/logger')(_0x72f5('0x2'));var moment=require(_0x72f5('0x3'));var BPromise=require(_0x72f5('0x4'));var rp=require(_0x72f5('0x5'));var fs=require('fs');var path=require(_0x72f5('0x6'));var rimraf=require(_0x72f5('0x7'));var config=require(_0x72f5('0x8'));var attributes=require(_0x72f5('0x9'));module[_0x72f5('0xa')]=function(_0x253d27,_0x51fc13){return _0x253d27[_0x72f5('0xb')](_0x72f5('0xc'),attributes,{'tableName':_0x72f5('0xd'),'paranoid':![],'indexes':[{'fields':[_0x72f5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 06d101f..c635caf 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 _0xdef8=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdef8,0xcf));var _0x8def=function(_0x4dd1db,_0x55ebfd){_0x4dd1db=_0x4dd1db-0x0;var _0x4654bb=_0xdef8[_0x4dd1db];return _0x4654bb;};'use strict';var _=require(_0x8def('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8def('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8def('0x2'));var db=require(_0x8def('0x3'))['db'];var utils=require(_0x8def('0x4'));var logger=require(_0x8def('0x5'))(_0x8def('0x6'));var config=require(_0x8def('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x194fc8,_0x1cd046,_0x4c17db){return new BPromise(function(_0x4a5e95,_0x1e015f){return client['request'](_0x194fc8,_0x4c17db)[_0x8def('0x8')](function(_0xcdb1af){logger['info'](_0x8def('0x9'),_0x1cd046,_0x8def('0xa'));logger[_0x8def('0xb')](_0x8def('0xc'),_0x1cd046,_0x8def('0xa'),JSON['stringify'](_0xcdb1af));if(_0xcdb1af[_0x8def('0xd')]){if(_0xcdb1af[_0x8def('0xd')][_0x8def('0xe')]===0x1f4){logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0xcdb1af['error'][_0x8def('0xf')]);return _0x1e015f(_0xcdb1af[_0x8def('0xd')]['message']);}logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0xcdb1af[_0x8def('0xd')]['message']);return _0x4a5e95(_0xcdb1af['error'][_0x8def('0xf')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1cd046,_0x8def('0xa'));_0x4a5e95(_0xcdb1af[_0x8def('0x10')][_0x8def('0xf')]);}})[_0x8def('0x11')](function(_0x150599){logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0x150599);_0x1e015f(_0x150599);});});}exports[_0x8def('0x12')]=function(_0x340f1e){var _0x5a0557=this;return new Promise(function(_0x1021aa,_0x425a85){return db[_0x8def('0x13')][_0x8def('0x14')]({'raw':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![],'where':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x17')]||null:null,'attributes':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x18')]||null:null,'limit':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x19')]||null:null,'include':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x340f1e[_0x8def('0x15')][_0x8def('0x1a')],function(_0x1e893f){return{'model':db[_0x1e893f['model']],'as':_0x1e893f['as'],'attributes':_0x1e893f['attributes'],'include':_0x1e893f[_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x1e893f[_0x8def('0x1a')],function(_0x2e7e7e){return{'model':db[_0x2e7e7e[_0x8def('0x1c')]],'as':_0x2e7e7e['as'],'attributes':_0x2e7e7e[_0x8def('0x18')],'include':_0x2e7e7e[_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x2e7e7e[_0x8def('0x1a')],function(_0x2b92f1){return{'model':db[_0x2b92f1['model']],'as':_0x2b92f1['as'],'attributes':_0x2b92f1[_0x8def('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ab96){logger[_0x8def('0x1d')]('GetVoiceCallReport',_0x340f1e);logger['debug'](_0x8def('0x12'),_0x340f1e,JSON[_0x8def('0x1e')](_0x52ab96));_0x1021aa(_0x52ab96);})[_0x8def('0x11')](function(_0x1b009a){logger['error'](_0x8def('0x12'),_0x1b009a[_0x8def('0xf')],_0x340f1e);_0x425a85(_0x5a0557[_0x8def('0xd')](0x1f4,_0x1b009a['message']));});});};exports[_0x8def('0x1f')]=function(_0x57a812){var _0x5f0c35=this;return new Promise(function(_0x307a65,_0x26b622){return db[_0x8def('0x13')][_0x8def('0x20')](_0x57a812['body'],{'raw':_0x57a812['options']?_0x57a812[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![]})[_0x8def('0x8')](function(_0x422729){logger[_0x8def('0x1d')](_0x8def('0x1f'),_0x57a812);logger[_0x8def('0xb')](_0x8def('0x1f'),_0x57a812,JSON[_0x8def('0x1e')](_0x422729));_0x307a65(_0x422729);})[_0x8def('0x11')](function(_0x3c567a){logger[_0x8def('0xd')](_0x8def('0x1f'),_0x3c567a['message'],_0x57a812);_0x26b622(_0x5f0c35[_0x8def('0xd')](0x1f4,_0x3c567a[_0x8def('0xf')]));});});};exports[_0x8def('0x21')]=function(_0x3a20c4){var _0x16eeea=this;return new Promise(function(_0x2c2ce6,_0x3d83fd){return db[_0x8def('0x13')][_0x8def('0x22')](_0x3a20c4[_0x8def('0x23')],{'raw':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4['options']['where']||null:null,'attributes':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4[_0x8def('0x15')][_0x8def('0x18')]||null:null,'limit':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4['options']['limit']||null:null})[_0x8def('0x8')](function(_0xc77667){logger[_0x8def('0x1d')]('UpdateVoiceCallReport',_0x3a20c4);logger[_0x8def('0xb')](_0x8def('0x21'),_0x3a20c4,JSON[_0x8def('0x1e')](_0xc77667));_0x2c2ce6(_0xc77667);})[_0x8def('0x11')](function(_0xc9b051){logger[_0x8def('0xd')](_0x8def('0x21'),_0xc9b051[_0x8def('0xf')],_0x3a20c4);_0x3d83fd(_0x16eeea[_0x8def('0xd')](0x1f4,_0xc9b051[_0x8def('0xf')]));});});}; \ No newline at end of file +var _0x6d8c=['message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1d309b,_0x5f56f0){var _0x22d997=function(_0x3023be){while(--_0x3023be){_0x1d309b['push'](_0x1d309b['shift']());}};_0x22d997(++_0x5f56f0);}(_0x6d8c,0x89));var _0xc6d8=function(_0x24da33,_0xc48a65){_0x24da33=_0x24da33-0x0;var _0x189cda=_0x6d8c[_0x24da33];return _0x189cda;};'use strict';var _=require(_0xc6d8('0x0'));var util=require(_0xc6d8('0x1'));var moment=require(_0xc6d8('0x2'));var BPromise=require(_0xc6d8('0x3'));var rs=require(_0xc6d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6d8('0x5'));var logger=require(_0xc6d8('0x6'))('rpc');var config=require(_0xc6d8('0x7'));var jayson=require(_0xc6d8('0x8'));var client=jayson[_0xc6d8('0x9')][_0xc6d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12077d,_0xb39154,_0x7767f8){return new BPromise(function(_0x32b600,_0x204bf9){return client[_0xc6d8('0xb')](_0x12077d,_0x7767f8)['then'](function(_0xc3ba0a){logger[_0xc6d8('0xc')](_0xc6d8('0xd'),_0xb39154,_0xc6d8('0xe'));logger[_0xc6d8('0xf')](_0xc6d8('0x10'),_0xb39154,'request\x20sent',JSON['stringify'](_0xc3ba0a));if(_0xc3ba0a['error']){if(_0xc3ba0a[_0xc6d8('0x11')][_0xc6d8('0x12')]===0x1f4){logger[_0xc6d8('0x11')](_0xc6d8('0xd'),_0xb39154,_0xc3ba0a['error'][_0xc6d8('0x13')]);return _0x204bf9(_0xc3ba0a[_0xc6d8('0x11')][_0xc6d8('0x13')]);}logger[_0xc6d8('0x11')](_0xc6d8('0xd'),_0xb39154,_0xc3ba0a['error']['message']);return _0x32b600(_0xc3ba0a['error']['message']);}else{logger['info'](_0xc6d8('0xd'),_0xb39154,'request\x20sent');_0x32b600(_0xc3ba0a[_0xc6d8('0x14')][_0xc6d8('0x13')]);}})[_0xc6d8('0x15')](function(_0x1cce59){logger[_0xc6d8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xb39154,_0x1cce59);_0x204bf9(_0x1cce59);});});}exports[_0xc6d8('0x16')]=function(_0x175a74){var _0x16b75f=this;return new Promise(function(_0x258022,_0x459149){return db[_0xc6d8('0x17')]['findAll']({'raw':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x19')]===undefined?!![]:![]:!![],'where':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1a')]||null:null,'attributes':_0x175a74['options']?_0x175a74['options'][_0xc6d8('0x1b')]||null:null,'limit':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1c')]||null:null,'include':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x175a74[_0xc6d8('0x18')]['include'],function(_0x13d01f){return{'model':db[_0x13d01f[_0xc6d8('0x1f')]],'as':_0x13d01f['as'],'attributes':_0x13d01f[_0xc6d8('0x1b')],'include':_0x13d01f[_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x13d01f['include'],function(_0x569949){return{'model':db[_0x569949[_0xc6d8('0x1f')]],'as':_0x569949['as'],'attributes':_0x569949[_0xc6d8('0x1b')],'include':_0x569949[_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x569949['include'],function(_0x451a7e){return{'model':db[_0x451a7e[_0xc6d8('0x1f')]],'as':_0x451a7e['as'],'attributes':_0x451a7e[_0xc6d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc6d8('0x20')](function(_0x35fdf9){logger['info'](_0xc6d8('0x16'),_0x175a74);logger['debug'](_0xc6d8('0x16'),_0x175a74,JSON[_0xc6d8('0x21')](_0x35fdf9));_0x258022(_0x35fdf9);})[_0xc6d8('0x15')](function(_0x34c8d7){logger[_0xc6d8('0x11')](_0xc6d8('0x16'),_0x34c8d7[_0xc6d8('0x13')],_0x175a74);_0x459149(_0x16b75f[_0xc6d8('0x11')](0x1f4,_0x34c8d7['message']));});});};exports['CreateVoiceCallReport']=function(_0x5e4929){var _0x51ed9b=this;return new Promise(function(_0x2262cc,_0xf9671c){return db[_0xc6d8('0x17')][_0xc6d8('0x22')](_0x5e4929[_0xc6d8('0x23')],{'raw':_0x5e4929[_0xc6d8('0x18')]?_0x5e4929['options']['raw']===undefined?!![]:![]:!![]})[_0xc6d8('0x20')](function(_0x3d4568){logger[_0xc6d8('0xc')](_0xc6d8('0x24'),_0x5e4929);logger[_0xc6d8('0xf')](_0xc6d8('0x24'),_0x5e4929,JSON[_0xc6d8('0x21')](_0x3d4568));_0x2262cc(_0x3d4568);})['catch'](function(_0xe4ac76){logger['error'](_0xc6d8('0x24'),_0xe4ac76[_0xc6d8('0x13')],_0x5e4929);_0xf9671c(_0x51ed9b[_0xc6d8('0x11')](0x1f4,_0xe4ac76['message']));});});};exports[_0xc6d8('0x25')]=function(_0x37584e){var _0x230292=this;return new Promise(function(_0x3217f3,_0x3ffe9e){return db[_0xc6d8('0x17')][_0xc6d8('0x26')](_0x37584e['body'],{'raw':_0x37584e['options']?_0x37584e['options'][_0xc6d8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37584e['options']?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1a')]||null:null,'attributes':_0x37584e['options']?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1b')]||null:null,'limit':_0x37584e[_0xc6d8('0x18')]?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1c')]||null:null})[_0xc6d8('0x20')](function(_0x412586){logger['info'](_0xc6d8('0x25'),_0x37584e);logger[_0xc6d8('0xf')](_0xc6d8('0x25'),_0x37584e,JSON['stringify'](_0x412586));_0x3217f3(_0x412586);})[_0xc6d8('0x15')](function(_0x2b602a){logger[_0xc6d8('0x11')](_0xc6d8('0x25'),_0x2b602a[_0xc6d8('0x13')],_0x37584e);_0x3ffe9e(_0x230292['error'](0x1f4,_0x2b602a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ae4d1eb..01b1014 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 _0x1e3f=['Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x41fb9c,_0x8d6ffc){var _0x8c53ed=function(_0x4d7c50){while(--_0x4d7c50){_0x41fb9c['push'](_0x41fb9c['shift']());}};_0x8c53ed(++_0x8d6ffc);}(_0x1e3f,0x10a));var _0xf1e3=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x1e3f[_0xccf869];return _0x21a9db;};'use strict';var multer=require(_0xf1e3('0x0'));var util=require(_0xf1e3('0x1'));var path=require('path');var timeout=require(_0xf1e3('0x2'));var express=require(_0xf1e3('0x3'));var router=express[_0xf1e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1e3('0x5'));var interaction=require(_0xf1e3('0x6'));var config=require('../../config/environment');var controller=require(_0xf1e3('0x7'));router[_0xf1e3('0x8')]('/',auth[_0xf1e3('0x9')](),controller['index']);router[_0xf1e3('0x8')]('/:id',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xa')]);router[_0xf1e3('0xb')]('/',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xc')]);router['put']('/:id',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xd')]);router[_0xf1e3('0xe')](_0xf1e3('0xf'),auth['isAuthenticated'](),controller[_0xf1e3('0x10')]);module[_0xf1e3('0x11')]=router; \ No newline at end of file +var _0x4097=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','show','post','isAuthenticated','create','put','update','delete'];(function(_0x1100e0,_0x4d8ae5){var _0x303353=function(_0x4d21f6){while(--_0x4d21f6){_0x1100e0['push'](_0x1100e0['shift']());}};_0x303353(++_0x4d8ae5);}(_0x4097,0x169));var _0x7409=function(_0x628729,_0x4b3aca){_0x628729=_0x628729-0x0;var _0x5b5dad=_0x4097[_0x628729];return _0x5b5dad;};'use strict';var multer=require(_0x7409('0x0'));var util=require(_0x7409('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7409('0x2'));var router=express[_0x7409('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7409('0x4'));var interaction=require(_0x7409('0x5'));var config=require(_0x7409('0x6'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7409('0x7')]);router[_0x7409('0x8')]('/',auth[_0x7409('0x9')](),controller[_0x7409('0xa')]);router[_0x7409('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7409('0xc')]);router[_0x7409('0xd')]('/:id',auth[_0x7409('0x9')](),controller['destroy']);module[_0x7409('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c8d3621..a650548 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 _0x7133=['getDataValue','split','BOOLEAN','STRING','name','options','join'];(function(_0x4b12a6,_0x30c27b){var _0x54b426=function(_0x28ae18){while(--_0x28ae18){_0x4b12a6['push'](_0x4b12a6['shift']());}};_0x54b426(++_0x30c27b);}(_0x7133,0x1a7));var _0x3713=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7133[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3713('0x0')]},'prefix':{'type':Sequelize[_0x3713('0x0')],'unique':_0x3713('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x3713('0x0')],'set':function(_0x3ccc3a){this['setDataValue'](_0x3713('0x2'),_0x3ccc3a?_0x3ccc3a[_0x3713('0x3')](''):[]);},'get':function(){return this[_0x3713('0x4')](_0x3713('0x2'))?this['getDataValue'](_0x3713('0x2'))[_0x3713('0x5')](''):[];}},'auth':{'type':Sequelize[_0x3713('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3713('0x0')]},'description':{'type':Sequelize[_0x3713('0x0')]}}; \ No newline at end of file +var _0x14d6=['sequelize','STRING','name','options','getDataValue','BOOLEAN'];(function(_0x1363a6,_0x5b71e6){var _0x41f342=function(_0x20d2e6){while(--_0x20d2e6){_0x1363a6['push'](_0x1363a6['shift']());}};_0x41f342(++_0x5b71e6);}(_0x14d6,0x66));var _0x614d=function(_0x35e1f8,_0x5501d9){_0x35e1f8=_0x35e1f8-0x0;var _0x497b8d=_0x14d6[_0x35e1f8];return _0x497b8d;};'use strict';var Sequelize=require(_0x614d('0x0'));module['exports']={'name':{'type':Sequelize[_0x614d('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x614d('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x16e2a8){this['setDataValue'](_0x614d('0x3'),_0x16e2a8?_0x16e2a8['join'](''):[]);},'get':function(){return this[_0x614d('0x4')](_0x614d('0x3'))?this[_0x614d('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x614d('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0x614d('0x1')]},'record':{'type':Sequelize[_0x614d('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x614d('0x1')]},'description':{'type':Sequelize[_0x614d('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a70a0cb..d798505 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 _0xbf6e=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbf6e,0x149));var _0xebf6=function(_0x4be7a0,_0xfb3d5b){_0x4be7a0=_0x4be7a0-0x0;var _0x55482b=_0xbf6e[_0x4be7a0];return _0x55482b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){var _0x1d0078=_0x43c4e2[_0xebf6('0x29')]({'plain':!![]});var _0x1534b2=_0xebf6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1534b2,'resourceId':_0x1d0078['id']}})[_0xebf6('0x27')](function(){return _0x43c4e2;});})['then'](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x5a01ea,_0x4f39eb){return function(_0x37950c){if(!_0x37950c){_0x5a01ea[_0xebf6('0x19')](0x194);}return _0x37950c;};}function handleError(_0x3c3d5c,_0x7959c8){_0x7959c8=_0x7959c8||0x1f4;return function(_0xedaaeb){logger[_0xebf6('0x2b')](_0xedaaeb[_0xebf6('0x2c')]);if(_0xedaaeb[_0xebf6('0x2d')]){delete _0xedaaeb['name'];}_0x3c3d5c[_0xebf6('0x1a')](_0x7959c8)[_0xebf6('0x2e')](_0xedaaeb);};}exports['index']=function(_0x2fe3ee,_0x28bbea){var _0x5ea6b2={},_0x2901fc={},_0x1fa407={'count':0x0,'rows':[]};var _0x32afa3=_[_0xebf6('0x2f')](db[_0xebf6('0x30')][_0xebf6('0x31')],function(_0x4907d0){return{'name':_0x4907d0[_0xebf6('0x32')],'type':_0x4907d0[_0xebf6('0x33')]['key']};});_0x2901fc['model']=_[_0xebf6('0x2f')](_0x32afa3,_0xebf6('0x2d'));_0x2901fc['query']=_[_0xebf6('0x34')](_0x2fe3ee[_0xebf6('0x35')]);_0x2901fc['filters']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],_0x2901fc[_0xebf6('0x35')]);_0x5ea6b2['attributes']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],qs[_0xebf6('0x38')](_0x2fe3ee[_0xebf6('0x35')]['fields']));_0x5ea6b2['attributes']=_0x5ea6b2[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x5ea6b2['attributes']:_0x2901fc[_0xebf6('0x37')];if(!_0x2fe3ee[_0xebf6('0x35')]['hasOwnProperty'](_0xebf6('0x3b'))){_0x5ea6b2[_0xebf6('0x1f')]=qs[_0xebf6('0x1f')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x1f')]);_0x5ea6b2['offset']=qs[_0xebf6('0x1d')](_0x2fe3ee['query'][_0xebf6('0x1d')]);}_0x5ea6b2['order']=qs[_0xebf6('0x3c')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x3c')]);_0x5ea6b2[_0xebf6('0x3d')]=qs[_0xebf6('0x3e')](_[_0xebf6('0x3f')](_0x2fe3ee['query'],_0x2901fc[_0xebf6('0x3e')]),_0x32afa3);if(_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x40')]){_0x5ea6b2[_0xebf6('0x3d')]=_[_0xebf6('0x41')](_0x5ea6b2[_0xebf6('0x3d')],{'$or':_['map'](_0x32afa3,function(_0xcbe240){if(_0xcbe240[_0xebf6('0x33')]!==_0xebf6('0x42')){var _0x111ff7={};_0x111ff7[_0xcbe240[_0xebf6('0x2d')]]={'$like':'%'+_0x2fe3ee[_0xebf6('0x35')]['filter']+'%'};return _0x111ff7;}})});}_0x5ea6b2=_['merge']({},_0x5ea6b2,_0x2fe3ee['options']);var _0xd4d5f4={'where':_0x5ea6b2[_0xebf6('0x3d')]};return db[_0xebf6('0x30')]['count'](_0xd4d5f4)[_0xebf6('0x27')](function(_0x1c3809){_0x1fa407[_0xebf6('0x20')]=_0x1c3809;if(_0x2fe3ee['query'][_0xebf6('0x43')]){_0x5ea6b2[_0xebf6('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xebf6('0x45')](_0x5ea6b2);})[_0xebf6('0x27')](function(_0x17c4af){_0x1fa407['rows']=_0x17c4af;return _0x1fa407;})[_0xebf6('0x27')](respondWithFilteredResult(_0x28bbea,_0x5ea6b2))['catch'](handleError(_0x28bbea,null));};exports['show']=function(_0x256552,_0x470f62){var _0x10ca29={'raw':![],'where':{'id':_0x256552['params']['id']}},_0x2ac140={};_0x2ac140[_0xebf6('0x37')]=_['keys'](db[_0xebf6('0x30')][_0xebf6('0x31')]);_0x2ac140[_0xebf6('0x35')]=_[_0xebf6('0x34')](_0x256552[_0xebf6('0x35')]);_0x2ac140['filters']=_['intersection'](_0x2ac140[_0xebf6('0x37')],_0x2ac140[_0xebf6('0x35')]);_0x10ca29[_0xebf6('0x39')]=_[_0xebf6('0x36')](_0x2ac140['model'],qs[_0xebf6('0x38')](_0x256552[_0xebf6('0x35')][_0xebf6('0x38')]));_0x10ca29[_0xebf6('0x39')]=_0x10ca29[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x10ca29[_0xebf6('0x39')]:_0x2ac140['model'];if(_0x256552[_0xebf6('0x35')][_0xebf6('0x43')]){_0x10ca29[_0xebf6('0x44')]=[{'all':!![]}];}_0x10ca29=_[_0xebf6('0x41')]({},_0x10ca29,_0x256552[_0xebf6('0x46')]);return db[_0xebf6('0x30')][_0xebf6('0x47')](_0x10ca29)['then'](handleEntityNotFound(_0x470f62,null))[_0xebf6('0x27')](respondWithResult(_0x470f62,null))['catch'](handleError(_0x470f62,null));};exports[_0xebf6('0x48')]=function(_0x31d8ba,_0x5d84ac){return db[_0xebf6('0x30')]['create'](_0x31d8ba[_0xebf6('0x49')],{})[_0xebf6('0x27')](function(_0x186655){var _0x32c8b1=_0x31d8ba[_0xebf6('0x4a')]['get']({'plain':!![]});if(!_0x32c8b1)throw new Error(_0xebf6('0x4b'));if(_0x32c8b1[_0xebf6('0x4c')]==='user'){var _0x1f98fd=_0x186655[_0xebf6('0x29')]({'plain':!![]});var _0x1455c4=_0xebf6('0x2a');return db[_0xebf6('0x4d')]['find']({'where':{'name':_0x1455c4,'userProfileId':_0x32c8b1[_0xebf6('0x4e')]},'raw':!![]})[_0xebf6('0x27')](function(_0x212414){if(_0x212414&&_0x212414[_0xebf6('0x4f')]===0x0){return db['UserProfileResource'][_0xebf6('0x48')]({'name':_0x1f98fd[_0xebf6('0x2d')],'resourceId':_0x1f98fd['id'],'type':_0x212414[_0xebf6('0x2d')],'sectionId':_0x212414['id']},{})[_0xebf6('0x27')](function(){return _0x186655;});}else{return _0x186655;}})[_0xebf6('0x50')](function(_0x2e7e30){logger[_0xebf6('0x2b')](_0xebf6('0x51'),_0x2e7e30);throw _0x2e7e30;});}return _0x186655;})[_0xebf6('0x27')](respondWithResult(_0x5d84ac,0xc9))['catch'](handleError(_0x5d84ac,null));};exports[_0xebf6('0x26')]=function(_0xe78fe5,_0x24ed4e){if(_0xe78fe5['body']['id']){delete _0xe78fe5[_0xebf6('0x49')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0xe78fe5[_0xebf6('0x52')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x24ed4e,null))[_0xebf6('0x27')](saveUpdates(_0xe78fe5[_0xebf6('0x49')],null))[_0xebf6('0x27')](respondWithResult(_0x24ed4e,null))['catch'](handleError(_0x24ed4e,null));};exports[_0xebf6('0x28')]=function(_0x5a1b51,_0x4ed306){return db['VoiceChanSpy'][_0xebf6('0x47')]({'where':{'id':_0x5a1b51[_0xebf6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ed306,null))[_0xebf6('0x27')](removeEntity(_0x4ed306,null))[_0xebf6('0x50')](handleError(_0x4ed306,null));}; \ No newline at end of file +var _0xcfac=['keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','reject','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params'];(function(_0x59cb2c,_0x5b452c){var _0x552034=function(_0x29556c){while(--_0x29556c){_0x59cb2c['push'](_0x59cb2c['shift']());}};_0x552034(++_0x5b452c);}(_0xcfac,0x105));var _0xccfa=function(_0x215d3a,_0x59e31e){_0x215d3a=_0x215d3a-0x0;var _0x274f0c=_0xcfac[_0x215d3a];return _0x274f0c;};'use strict';var emlformat=require(_0xccfa('0x0'));var rimraf=require(_0xccfa('0x1'));var zipdir=require(_0xccfa('0x2'));var jsonpatch=require(_0xccfa('0x3'));var rp=require(_0xccfa('0x4'));var moment=require(_0xccfa('0x5'));var BPromise=require(_0xccfa('0x6'));var Mustache=require(_0xccfa('0x7'));var util=require(_0xccfa('0x8'));var path=require('path');var sox=require(_0xccfa('0x9'));var csv=require(_0xccfa('0xa'));var ejs=require(_0xccfa('0xb'));var fs=require('fs');var fs_extra=require(_0xccfa('0xc'));var _=require(_0xccfa('0xd'));var squel=require(_0xccfa('0xe'));var crypto=require(_0xccfa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xccfa('0x10'));var toCsv=require(_0xccfa('0xa'));var querystring=require(_0xccfa('0x11'));var Papa=require(_0xccfa('0x12'));var Redis=require(_0xccfa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xccfa('0x14'));var as=require(_0xccfa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfa('0x16'))(_0xccfa('0x17'));var utils=require(_0xccfa('0x18'));var config=require(_0xccfa('0x19'));var licenseUtil=require(_0xccfa('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29d643,_0x28d4e9){_0x28d4e9=_0x28d4e9||0xcc;return function(_0x73ab6d){if(_0x73ab6d){return _0x29d643[_0xccfa('0x1b')](_0x28d4e9);}return _0x29d643[_0xccfa('0x1c')](_0x28d4e9)[_0xccfa('0x1d')]();};}function respondWithResult(_0x11e577,_0xc43ebe){_0xc43ebe=_0xc43ebe||0xc8;return function(_0x411a73){if(_0x411a73){return _0x11e577[_0xccfa('0x1c')](_0xc43ebe)[_0xccfa('0x1e')](_0x411a73);}};}function respondWithFilteredResult(_0x2bcf8e,_0x4e83d6){return function(_0x89103f){if(_0x89103f){var _0x258db6=typeof _0x4e83d6['offset']==='undefined'&&typeof _0x4e83d6[_0xccfa('0x1f')]==='undefined';var _0x46cca0=_0x89103f[_0xccfa('0x20')];var _0x59c660=_0x258db6?0x0:_0x4e83d6['offset'];var _0xa3658=_0x258db6?_0x89103f[_0xccfa('0x20')]:_0x4e83d6[_0xccfa('0x21')]+_0x4e83d6[_0xccfa('0x1f')];var _0x3cc107;if(_0xa3658>=_0x46cca0){_0xa3658=_0x46cca0;_0x3cc107=0xc8;}else{_0x3cc107=0xce;}_0x2bcf8e[_0xccfa('0x1c')](_0x3cc107);return _0x2bcf8e['set']('Content-Range',_0x59c660+'-'+_0xa3658+'/'+_0x46cca0)['json'](_0x89103f);}return null;};}function patchUpdates(_0x23d235){return function(_0x4bdb04){try{jsonpatch['apply'](_0x4bdb04,_0x23d235,!![]);}catch(_0x4ff928){return BPromise[_0xccfa('0x22')](_0x4ff928);}return _0x4bdb04['save']();};}function saveUpdates(_0x5abfb6,_0x471e59){return function(_0x39b373){if(_0x39b373){return _0x39b373[_0xccfa('0x23')](_0x5abfb6)[_0xccfa('0x24')](function(_0x56b53c){return _0x56b53c;});}return null;};}function removeEntity(_0xbedc9,_0x485e6f){return function(_0x58cc2c){if(_0x58cc2c){return _0x58cc2c['destroy']()[_0xccfa('0x24')](function(){var _0x2b4a96=_0x58cc2c[_0xccfa('0x25')]({'plain':!![]});var _0x5cae20=_0xccfa('0x26');return db[_0xccfa('0x27')][_0xccfa('0x28')]({'where':{'type':_0x5cae20,'resourceId':_0x2b4a96['id']}})[_0xccfa('0x24')](function(){return _0x58cc2c;});})[_0xccfa('0x24')](function(){_0xbedc9[_0xccfa('0x1c')](0xcc)[_0xccfa('0x1d')]();});}};}function handleEntityNotFound(_0x40b2a4,_0x5c843c){return function(_0x113ef1){if(!_0x113ef1){_0x40b2a4[_0xccfa('0x1b')](0x194);}return _0x113ef1;};}function handleError(_0x18dccb,_0xae8934){_0xae8934=_0xae8934||0x1f4;return function(_0x1ae5a2){logger[_0xccfa('0x29')](_0x1ae5a2[_0xccfa('0x2a')]);if(_0x1ae5a2[_0xccfa('0x2b')]){delete _0x1ae5a2[_0xccfa('0x2b')];}_0x18dccb['status'](_0xae8934)[_0xccfa('0x2c')](_0x1ae5a2);};}exports[_0xccfa('0x2d')]=function(_0x28d008,_0x3b1488){var _0xfae349={},_0x29327b={},_0xb6d80a={'count':0x0,'rows':[]};var _0x1c140c=_[_0xccfa('0x2e')](db[_0xccfa('0x2f')][_0xccfa('0x30')],function(_0x321354){return{'name':_0x321354[_0xccfa('0x31')],'type':_0x321354[_0xccfa('0x32')][_0xccfa('0x33')]};});_0x29327b[_0xccfa('0x34')]=_[_0xccfa('0x2e')](_0x1c140c,_0xccfa('0x2b'));_0x29327b['query']=_['keys'](_0x28d008['query']);_0x29327b[_0xccfa('0x35')]=_[_0xccfa('0x36')](_0x29327b[_0xccfa('0x34')],_0x29327b[_0xccfa('0x37')]);_0xfae349['attributes']=_['intersection'](_0x29327b[_0xccfa('0x34')],qs[_0xccfa('0x38')](_0x28d008['query']['fields']));_0xfae349['attributes']=_0xfae349[_0xccfa('0x39')]['length']?_0xfae349['attributes']:_0x29327b[_0xccfa('0x34')];if(!_0x28d008[_0xccfa('0x37')][_0xccfa('0x3a')](_0xccfa('0x3b'))){_0xfae349[_0xccfa('0x1f')]=qs[_0xccfa('0x1f')](_0x28d008[_0xccfa('0x37')][_0xccfa('0x1f')]);_0xfae349[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0x28d008[_0xccfa('0x37')]['offset']);}_0xfae349[_0xccfa('0x3c')]=qs['sort'](_0x28d008['query']['sort']);_0xfae349[_0xccfa('0x3d')]=qs[_0xccfa('0x35')](_[_0xccfa('0x3e')](_0x28d008['query'],_0x29327b['filters']),_0x1c140c);if(_0x28d008['query'][_0xccfa('0x3f')]){_0xfae349[_0xccfa('0x3d')]=_[_0xccfa('0x40')](_0xfae349[_0xccfa('0x3d')],{'$or':_[_0xccfa('0x2e')](_0x1c140c,function(_0x122fc7){if(_0x122fc7[_0xccfa('0x32')]!==_0xccfa('0x41')){var _0xc51cc6={};_0xc51cc6[_0x122fc7[_0xccfa('0x2b')]]={'$like':'%'+_0x28d008[_0xccfa('0x37')]['filter']+'%'};return _0xc51cc6;}})});}_0xfae349=_['merge']({},_0xfae349,_0x28d008['options']);var _0x52b93c={'where':_0xfae349[_0xccfa('0x3d')]};return db[_0xccfa('0x2f')][_0xccfa('0x20')](_0x52b93c)[_0xccfa('0x24')](function(_0x51b0a0){_0xb6d80a[_0xccfa('0x20')]=_0x51b0a0;if(_0x28d008[_0xccfa('0x37')][_0xccfa('0x42')]){_0xfae349[_0xccfa('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0xfae349);})[_0xccfa('0x24')](function(_0x2d19fb){_0xb6d80a[_0xccfa('0x44')]=_0x2d19fb;return _0xb6d80a;})[_0xccfa('0x24')](respondWithFilteredResult(_0x3b1488,_0xfae349))[_0xccfa('0x45')](handleError(_0x3b1488,null));};exports['show']=function(_0x237b76,_0x14aa03){var _0x7a2990={'raw':![],'where':{'id':_0x237b76[_0xccfa('0x46')]['id']}},_0x492366={};_0x492366['model']=_['keys'](db[_0xccfa('0x2f')][_0xccfa('0x30')]);_0x492366[_0xccfa('0x37')]=_[_0xccfa('0x47')](_0x237b76[_0xccfa('0x37')]);_0x492366[_0xccfa('0x35')]=_['intersection'](_0x492366[_0xccfa('0x34')],_0x492366['query']);_0x7a2990['attributes']=_[_0xccfa('0x36')](_0x492366[_0xccfa('0x34')],qs[_0xccfa('0x38')](_0x237b76[_0xccfa('0x37')][_0xccfa('0x38')]));_0x7a2990[_0xccfa('0x39')]=_0x7a2990[_0xccfa('0x39')][_0xccfa('0x48')]?_0x7a2990[_0xccfa('0x39')]:_0x492366[_0xccfa('0x34')];if(_0x237b76[_0xccfa('0x37')][_0xccfa('0x42')]){_0x7a2990[_0xccfa('0x43')]=[{'all':!![]}];}_0x7a2990=_[_0xccfa('0x40')]({},_0x7a2990,_0x237b76['options']);return db[_0xccfa('0x2f')][_0xccfa('0x49')](_0x7a2990)[_0xccfa('0x24')](handleEntityNotFound(_0x14aa03,null))['then'](respondWithResult(_0x14aa03,null))['catch'](handleError(_0x14aa03,null));};exports[_0xccfa('0x4a')]=function(_0x291061,_0x3d9d85){return db['VoiceChanSpy']['create'](_0x291061[_0xccfa('0x4b')],{})['then'](function(_0xbac28c){var _0x5c2fa8=_0x291061[_0xccfa('0x4c')][_0xccfa('0x25')]({'plain':!![]});if(!_0x5c2fa8)throw new Error(_0xccfa('0x4d'));if(_0x5c2fa8[_0xccfa('0x4e')]===_0xccfa('0x4c')){var _0x3ad03a=_0xbac28c[_0xccfa('0x25')]({'plain':!![]});var _0x24bc69=_0xccfa('0x26');return db[_0xccfa('0x4f')]['find']({'where':{'name':_0x24bc69,'userProfileId':_0x5c2fa8[_0xccfa('0x50')]},'raw':!![]})[_0xccfa('0x24')](function(_0x531c0f){if(_0x531c0f&&_0x531c0f[_0xccfa('0x51')]===0x0){return db[_0xccfa('0x27')][_0xccfa('0x4a')]({'name':_0x3ad03a[_0xccfa('0x2b')],'resourceId':_0x3ad03a['id'],'type':_0x531c0f[_0xccfa('0x2b')],'sectionId':_0x531c0f['id']},{})[_0xccfa('0x24')](function(){return _0xbac28c;});}else{return _0xbac28c;}})[_0xccfa('0x45')](function(_0x15e661){logger['error'](_0xccfa('0x52'),_0x15e661);throw _0x15e661;});}return _0xbac28c;})[_0xccfa('0x24')](respondWithResult(_0x3d9d85,0xc9))['catch'](handleError(_0x3d9d85,null));};exports[_0xccfa('0x23')]=function(_0x1099c7,_0xb6cea9){if(_0x1099c7[_0xccfa('0x4b')]['id']){delete _0x1099c7[_0xccfa('0x4b')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x1099c7[_0xccfa('0x46')]['id']}})[_0xccfa('0x24')](handleEntityNotFound(_0xb6cea9,null))[_0xccfa('0x24')](saveUpdates(_0x1099c7['body'],null))[_0xccfa('0x24')](respondWithResult(_0xb6cea9,null))[_0xccfa('0x45')](handleError(_0xb6cea9,null));};exports['destroy']=function(_0x3d2999,_0x58cf3e){return db['VoiceChanSpy'][_0xccfa('0x49')]({'where':{'id':_0x3d2999['params']['id']}})[_0xccfa('0x24')](handleEntityNotFound(_0x58cf3e,null))[_0xccfa('0x24')](removeEntity(_0x58cf3e,null))[_0xccfa('0x45')](handleError(_0x58cf3e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 7619455..ba876bc 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 _0xe401=['util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','merge','Set','CDR(type)=%s','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','lodash'];(function(_0x12ea52,_0x496229){var _0xb8b08=function(_0x2ed77d){while(--_0x2ed77d){_0x12ea52['push'](_0x12ea52['shift']());}};_0xb8b08(++_0x496229);}(_0xe401,0x117));var _0x1e40=function(_0x3393cb,_0x38e8a3){_0x3393cb=_0x3393cb-0x0;var _0x508cb7=_0xe401[_0x3393cb];return _0x508cb7;};'use strict';var _=require(_0x1e40('0x0'));var util=require(_0x1e40('0x1'));var BPromise=require(_0x1e40('0x2'));var attributes=require(_0x1e40('0x3'));var getUserApplications=function(_0x50a4f2,_0x2ac12f,_0x2b337e){var _0x4d0ee1=0x1;var _0x57f93a=[];var _0x327d20={'context':_0x2ac12f[_0x1e40('0x4')]||_0x1e40('0x5'),'exten':util[_0x1e40('0x6')](_0x1e40('0x7'),_0x50a4f2[_0x1e40('0x8')],_0x2b337e),'type':'system','isApp':![],'ChanSpyId':_0x50a4f2['id'],'UserId':_0x2ac12f['id']};_0x57f93a['push'](_[_0x1e40('0x9')]({'app':_0x1e40('0xa'),'appdata':util[_0x1e40('0x6')](_0x1e40('0xb'),'chanspy'),'priority':_0x4d0ee1++},_0x327d20));if(_0x50a4f2['record']){_0x57f93a[_0x1e40('0xc')](_['merge']({'app':_0x1e40('0xd'),'appdata':util[_0x1e40('0x6')](_0x1e40('0xe'),_0x50a4f2[_0x1e40('0xf')]),'priority':_0x4d0ee1++},_0x327d20));}if(_0x50a4f2[_0x1e40('0x10')]){_0x57f93a['push'](_[_0x1e40('0x9')]({'app':_0x1e40('0x11'),'appdata':_0x50a4f2['password'],'priority':_0x4d0ee1++},_0x327d20));}_0x57f93a[_0x1e40('0xc')](_['merge']({'app':_0x1e40('0x12'),'appdata':util['format'](_0x1e40('0x13'),_0x2ac12f[_0x1e40('0x14')],_0x50a4f2[_0x1e40('0x15')]?_0x50a4f2[_0x1e40('0x15')][_0x1e40('0x16')](''):''),'priority':_0x4d0ee1++},_0x327d20));if(_0x50a4f2['record']){_0x57f93a[_0x1e40('0xc')](_[_0x1e40('0x9')]({'app':_0x1e40('0x17'),'priority':_0x4d0ee1++},_0x327d20));}return _0x57f93a;};var getChanSpyApplications=function(_0x7b1db7,_0x251700){var _0x582c91=[];for(var _0x11291f=0x0,_0x1cc1c7=0x1;_0x11291f<_0x251700[_0x1e40('0x18')];_0x11291f++,_0x1cc1c7=0x1){_0x582c91=_0x582c91[_0x1e40('0x19')](getUserApplications(_0x7b1db7,_0x251700[_0x11291f],_0x251700[_0x11291f]['internal']));if(_0x251700[_0x11291f]['internal']!=_0x251700[_0x11291f][_0x1e40('0x14')]){_0x582c91=_0x582c91[_0x1e40('0x19')](getUserApplications(_0x7b1db7,_0x251700[_0x11291f],_0x251700[_0x11291f]['name']));}}return _0x582c91;};var getChanSpyPromise=function(_0x248251,_0x4d0323){return new BPromise(function(_0x64e502,_0x5668c0){return _0x248251['User'][_0x1e40('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0x1e40('0x1b'),'chanspy':!![]},'raw':!![]})[_0x1e40('0x1c')](function(_0x57a099){if(_0x57a099){return _0x64e502(getChanSpyApplications(_0x4d0323,_0x57a099));}return _0x64e502([]);})[_0x1e40('0x1d')](function(_0x53f2ef){_0x5668c0(_0x53f2ef);});});};module[_0x1e40('0x1e')]=function(_0xf1266,_0x58c394){var _0x4d76d6=_0xf1266[_0x1e40('0x1f')];return _0xf1266[_0x1e40('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x1e40('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x320317,_0x18e89e,_0x4068b3){return getChanSpyPromise(_0x4d76d6,_0x320317)[_0x1e40('0x1c')](function(_0x44a46c){if(_0x44a46c&&_0x44a46c[_0x1e40('0x18')]){return _0x4d76d6[_0x1e40('0x22')]['bulkCreate'](_0x44a46c);}})[_0x1e40('0x1c')](function(){_0x4068b3();})[_0x1e40('0x1d')](function(_0x2e9339){_0x4068b3(_0x2e9339);});},'afterUpdate':function(_0x42e857,_0x360dc1,_0x42726a){return _0x4d76d6[_0x1e40('0x22')]['destroy']({'where':{'ChanSpyId':_0x42e857['id']}})[_0x1e40('0x1c')](function(){return getChanSpyPromise(_0x4d76d6,_0x42e857);})[_0x1e40('0x1c')](function(_0x6a37d2){if(_0x6a37d2&&_0x6a37d2['length']){return _0x4d76d6[_0x1e40('0x22')]['bulkCreate'](_0x6a37d2);}})[_0x1e40('0x1c')](function(){_0x42726a();})[_0x1e40('0x1d')](function(_0xf4fb11){_0x42726a(_0xf4fb11);});},'afterDestroy':function(_0xc9502d,_0x458c77,_0x2551eb){return _0x4d76d6[_0x1e40('0x22')]['destroy']({'where':{'ChanSpyId':_0xc9502d['id']}})[_0x1e40('0x1c')](function(){_0x2551eb();})['catch'](function(_0x1f39b4){_0x2551eb(_0x1f39b4);});}}});}; \ No newline at end of file +var _0x95cc=['./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','util','bluebird'];(function(_0x2533e3,_0xc740b5){var _0x203b68=function(_0x1395c4){while(--_0x1395c4){_0x2533e3['push'](_0x2533e3['shift']());}};_0x203b68(++_0xc740b5);}(_0x95cc,0xbc));var _0xc95c=function(_0x51e353,_0x485e7e){_0x51e353=_0x51e353-0x0;var _0x4c7c2d=_0x95cc[_0x51e353];return _0x4c7c2d;};'use strict';var _=require('lodash');var util=require(_0xc95c('0x0'));var BPromise=require(_0xc95c('0x1'));var attributes=require(_0xc95c('0x2'));var getUserApplications=function(_0x24e867,_0x111a5a,_0x6d106c){var _0x2c43e3=0x1;var _0x57670b=[];var _0xa5ac0e={'context':_0x111a5a[_0xc95c('0x3')]||_0xc95c('0x4'),'exten':util[_0xc95c('0x5')](_0xc95c('0x6'),_0x24e867[_0xc95c('0x7')],_0x6d106c),'type':_0xc95c('0x8'),'isApp':![],'ChanSpyId':_0x24e867['id'],'UserId':_0x111a5a['id']};_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':'Set','appdata':util[_0xc95c('0x5')](_0xc95c('0xb'),'chanspy'),'priority':_0x2c43e3++},_0xa5ac0e));if(_0x24e867[_0xc95c('0xc')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':'MixMonitor','appdata':util[_0xc95c('0x5')](_0xc95c('0xd'),_0x24e867[_0xc95c('0xe')]),'priority':_0x2c43e3++},_0xa5ac0e));}if(_0x24e867[_0xc95c('0xf')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':_0xc95c('0x10'),'appdata':_0x24e867[_0xc95c('0x11')],'priority':_0x2c43e3++},_0xa5ac0e));}_0x57670b['push'](_[_0xc95c('0xa')]({'app':'ChanSpy','appdata':util['format'](_0xc95c('0x12'),_0x111a5a[_0xc95c('0x13')],_0x24e867[_0xc95c('0x14')]?_0x24e867[_0xc95c('0x14')][_0xc95c('0x15')](''):''),'priority':_0x2c43e3++},_0xa5ac0e));if(_0x24e867[_0xc95c('0xc')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':_0xc95c('0x16'),'priority':_0x2c43e3++},_0xa5ac0e));}return _0x57670b;};var getChanSpyApplications=function(_0xf06678,_0x3f91ed){var _0x502110=[];for(var _0x451873=0x0,_0x288b6b=0x1;_0x451873<_0x3f91ed[_0xc95c('0x17')];_0x451873++,_0x288b6b=0x1){_0x502110=_0x502110[_0xc95c('0x18')](getUserApplications(_0xf06678,_0x3f91ed[_0x451873],_0x3f91ed[_0x451873][_0xc95c('0x19')]));if(_0x3f91ed[_0x451873][_0xc95c('0x19')]!=_0x3f91ed[_0x451873][_0xc95c('0x13')]){_0x502110=_0x502110['concat'](getUserApplications(_0xf06678,_0x3f91ed[_0x451873],_0x3f91ed[_0x451873]['name']));}}return _0x502110;};var getChanSpyPromise=function(_0x1e6e58,_0x3d2ab6){return new BPromise(function(_0x2c28c5,_0x46b75f){return _0x1e6e58[_0xc95c('0x1a')][_0xc95c('0x1b')]({'attributes':['id','name',_0xc95c('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc95c('0x1c')](function(_0x3b1b86){if(_0x3b1b86){return _0x2c28c5(getChanSpyApplications(_0x3d2ab6,_0x3b1b86));}return _0x2c28c5([]);})['catch'](function(_0x37b5fb){_0x46b75f(_0x37b5fb);});});};module[_0xc95c('0x1d')]=function(_0x311f09,_0x1a749c){var _0x15d03f=_0x311f09[_0xc95c('0x1e')];return _0x311f09[_0xc95c('0x1f')](_0xc95c('0x20'),attributes,{'tableName':_0xc95c('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x448230,_0x2ab9d6,_0x107d2f){return getChanSpyPromise(_0x15d03f,_0x448230)['then'](function(_0x21543a){if(_0x21543a&&_0x21543a['length']){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x23')](_0x21543a);}})[_0xc95c('0x1c')](function(){_0x107d2f();})[_0xc95c('0x24')](function(_0x3ace89){_0x107d2f(_0x3ace89);});},'afterUpdate':function(_0x27c2af,_0x46f551,_0x5b0b7f){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x25')]({'where':{'ChanSpyId':_0x27c2af['id']}})[_0xc95c('0x1c')](function(){return getChanSpyPromise(_0x15d03f,_0x27c2af);})['then'](function(_0xdf3b36){if(_0xdf3b36&&_0xdf3b36['length']){return _0x15d03f[_0xc95c('0x22')]['bulkCreate'](_0xdf3b36);}})[_0xc95c('0x1c')](function(){_0x5b0b7f();})['catch'](function(_0x5da8ee){_0x5b0b7f(_0x5da8ee);});},'afterDestroy':function(_0x1d07f6,_0x222b46,_0x33c57a){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x25')]({'where':{'ChanSpyId':_0x1d07f6['id']}})[_0xc95c('0x1c')](function(){_0x33c57a();})[_0xc95c('0x24')](function(_0x2c9fed){_0x33c57a(_0x2c9fed);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index df7a62a..4d3e347 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 _0x3a25=['then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x34acc3,_0x1d1233){var _0x418597=function(_0x1d80fc){while(--_0x1d80fc){_0x34acc3['push'](_0x34acc3['shift']());}};_0x418597(++_0x1d1233);}(_0x3a25,0x15d));var _0x53a2=function(_0x57d7e1,_0x22455f){_0x57d7e1=_0x57d7e1-0x0;var _0x1949ee=_0x3a25[_0x57d7e1];return _0x1949ee;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});} \ No newline at end of file +var _0xa699=['request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f37aa,_0x13f4ed){var _0x36956d=function(_0x49f578){while(--_0x49f578){_0x2f37aa['push'](_0x2f37aa['shift']());}};_0x36956d(++_0x13f4ed);}(_0xa699,0x6b));var _0x9a69=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xa699[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 892c881..ae13862 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 _0xb549=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x4ca1cd,_0x426a42){var _0x49ed57=function(_0x549f26){while(--_0x549f26){_0x4ca1cd['push'](_0x4ca1cd['shift']());}};_0x49ed57(++_0x426a42);}(_0xb549,0x13b));var _0x9b54=function(_0x3aa39d,_0x3d6d02){_0x3aa39d=_0x3aa39d-0x0;var _0x1bcde2=_0xb549[_0x3aa39d];return _0x1bcde2;};'use strict';var multer=require('multer');var util=require(_0x9b54('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b54('0x1'));var router=express[_0x9b54('0x2')]();var fs_extra=require(_0x9b54('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b54('0x4'));var config=require(_0x9b54('0x5'));var controller=require(_0x9b54('0x6'));router[_0x9b54('0x7')]('/',auth[_0x9b54('0x8')](),controller[_0x9b54('0x9')]);router['get']('/:id',auth[_0x9b54('0x8')](),controller[_0x9b54('0xa')]);router[_0x9b54('0xb')]('/',auth[_0x9b54('0x8')](),controller[_0x9b54('0xc')]);router[_0x9b54('0xd')](_0x9b54('0xe'),auth['isAuthenticated'](),controller[_0x9b54('0xf')]);router[_0x9b54('0x10')](_0x9b54('0xe'),auth['isAuthenticated'](),controller[_0x9b54('0x11')]);module[_0x9b54('0x12')]=router; \ No newline at end of file +var _0xe2d0=['../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e805d,_0x448766){var _0x5e474d=function(_0x253f30){while(--_0x253f30){_0x2e805d['push'](_0x2e805d['shift']());}};_0x5e474d(++_0x448766);}(_0xe2d0,0x65));var _0x0e2d=function(_0x6e4fa0,_0x5eebd1){_0x6e4fa0=_0x6e4fa0-0x0;var _0x347582=_0xe2d0[_0x6e4fa0];return _0x347582;};'use strict';var multer=require(_0x0e2d('0x0'));var util=require(_0x0e2d('0x1'));var path=require('path');var timeout=require(_0x0e2d('0x2'));var express=require(_0x0e2d('0x3'));var router=express['Router']();var fs_extra=require(_0x0e2d('0x4'));var auth=require(_0x0e2d('0x5'));var interaction=require(_0x0e2d('0x6'));var config=require(_0x0e2d('0x7'));var controller=require(_0x0e2d('0x8'));router['get']('/',auth[_0x0e2d('0x9')](),controller['index']);router[_0x0e2d('0xa')](_0x0e2d('0xb'),auth[_0x0e2d('0x9')](),controller[_0x0e2d('0xc')]);router[_0x0e2d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e2d('0xe')](_0x0e2d('0xb'),auth['isAuthenticated'](),controller[_0x0e2d('0xf')]);router[_0x0e2d('0x10')](_0x0e2d('0xb'),auth['isAuthenticated'](),controller[_0x0e2d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index df59b2f..9564157 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 _0x962d=['name','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x962d,0xc9));var _0xd962=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x962d[_0x38b14f];return _0x22a324;};'use strict';var Sequelize=require(_0xd962('0x0'));module[_0xd962('0x1')]={'name':{'type':Sequelize[_0xd962('0x2')],'unique':_0xd962('0x3')},'description':{'type':Sequelize[_0xd962('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa5d=['STRING','BOOLEAN','sequelize'];(function(_0x70fbac,_0x306e7c){var _0x437103=function(_0x4b4d37){while(--_0x4b4d37){_0x70fbac['push'](_0x70fbac['shift']());}};_0x437103(++_0x306e7c);}(_0xfa5d,0x140));var _0xdfa5=function(_0x424b31,_0x4182b4){_0x424b31=_0x424b31-0x0;var _0x7dcf7d=_0xfa5d[_0x424b31];return _0x7dcf7d;};'use strict';var Sequelize=require(_0xdfa5('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfa5('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xdfa5('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdfa5('0x2')],'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 ac587f8..56bcff9 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 _0xf3c4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','get','Contexts','UserProfileResource','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','keys','length','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','params','render','/etc/asterisk/extensions_xcally_contexts.conf','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2ddd0b,_0xff663b){var _0xfe258d=function(_0x31af0e){while(--_0x31af0e){_0x2ddd0b['push'](_0x2ddd0b['shift']());}};_0xfe258d(++_0xff663b);}(_0xf3c4,0x12c));var _0x4f3c=function(_0x2fc939,_0x325f8e){_0x2fc939=_0x2fc939-0x0;var _0x336018=_0xf3c4[_0x2fc939];return _0x336018;};'use strict';var emlformat=require(_0x4f3c('0x0'));var rimraf=require(_0x4f3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f3c('0x2'));var rp=require(_0x4f3c('0x3'));var moment=require(_0x4f3c('0x4'));var BPromise=require(_0x4f3c('0x5'));var Mustache=require('mustache');var util=require(_0x4f3c('0x6'));var path=require(_0x4f3c('0x7'));var sox=require(_0x4f3c('0x8'));var csv=require(_0x4f3c('0x9'));var ejs=require(_0x4f3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f3c('0xb'));var squel=require(_0x4f3c('0xc'));var crypto=require('crypto');var jsforce=require(_0x4f3c('0xd'));var deskjs=require(_0x4f3c('0xe'));var toCsv=require(_0x4f3c('0x9'));var querystring=require(_0x4f3c('0xf'));var Papa=require(_0x4f3c('0x10'));var Redis=require(_0x4f3c('0x11'));var authService=require(_0x4f3c('0x12'));var qs=require(_0x4f3c('0x13'));var as=require(_0x4f3c('0x14'));var hardwareService=require(_0x4f3c('0x15'));var logger=require(_0x4f3c('0x16'))(_0x4f3c('0x17'));var utils=require(_0x4f3c('0x18'));var config=require(_0x4f3c('0x19'));var licenseUtil=require(_0x4f3c('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4f3c('0x1b'));var client=jayson[_0x4f3c('0x1c')][_0x4f3c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x204b24,_0x118e12,_0x2cd70f,_0x246706){return new BPromise(function(_0x3973ac,_0x500d86){var _0x36bbb2=_0x246706||client;return _0x36bbb2[_0x4f3c('0x1e')](_0x204b24,_0x2cd70f)['then'](function(_0x422a5f){logger[_0x4f3c('0x1f')](_0x4f3c('0x20'),_0x118e12,_0x4f3c('0x21'));logger[_0x4f3c('0x22')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x118e12,'request\x20sent',JSON[_0x4f3c('0x23')](_0x422a5f));if(_0x422a5f[_0x4f3c('0x24')]){if(_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x25')]===0x1f4){logger['error'](_0x4f3c('0x20'),_0x118e12,_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x26')]);return _0x500d86(_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x26')]);}logger[_0x4f3c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x118e12,_0x422a5f[_0x4f3c('0x24')]['message']);return _0x3973ac(_0x422a5f[_0x4f3c('0x24')]['message']);}else{logger[_0x4f3c('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x118e12,_0x4f3c('0x21'));_0x3973ac(_0x422a5f[_0x4f3c('0x27')][_0x4f3c('0x26')]);}})[_0x4f3c('0x28')](function(_0x39553b){logger[_0x4f3c('0x24')](_0x4f3c('0x20'),_0x118e12,_0x39553b);_0x500d86(_0x39553b);});});}function respondWithStatusCode(_0x217868,_0x64e9df){_0x64e9df=_0x64e9df||0xcc;return function(_0x188f15){if(_0x188f15){return _0x217868['sendStatus'](_0x64e9df);}return _0x217868['status'](_0x64e9df)['end']();};}function respondWithResult(_0x9748f6,_0x49908f){_0x49908f=_0x49908f||0xc8;return function(_0x5efc74){if(_0x5efc74){return _0x9748f6[_0x4f3c('0x29')](_0x49908f)[_0x4f3c('0x2a')](_0x5efc74);}};}function respondWithFilteredResult(_0x5e85b3,_0x3307d4){return function(_0x37fb08){if(_0x37fb08){var _0x14a568=typeof _0x3307d4['offset']==='undefined'&&typeof _0x3307d4['limit']===_0x4f3c('0x2b');var _0x45eede=_0x37fb08[_0x4f3c('0x2c')];var _0x109f49=_0x14a568?0x0:_0x3307d4[_0x4f3c('0x2d')];var _0x550fa8=_0x14a568?_0x37fb08[_0x4f3c('0x2c')]:_0x3307d4[_0x4f3c('0x2d')]+_0x3307d4['limit'];var _0x5308c3;if(_0x550fa8>=_0x45eede){_0x550fa8=_0x45eede;_0x5308c3=0xc8;}else{_0x5308c3=0xce;}_0x5e85b3[_0x4f3c('0x29')](_0x5308c3);return _0x5e85b3[_0x4f3c('0x2e')](_0x4f3c('0x2f'),_0x109f49+'-'+_0x550fa8+'/'+_0x45eede)[_0x4f3c('0x2a')](_0x37fb08);}return null;};}function patchUpdates(_0x394cf3){return function(_0xd9ba49){try{jsonpatch[_0x4f3c('0x30')](_0xd9ba49,_0x394cf3,!![]);}catch(_0x4ea7c2){return BPromise[_0x4f3c('0x31')](_0x4ea7c2);}return _0xd9ba49['save']();};}function saveUpdates(_0x2abc4d,_0x140164){return function(_0x5c8975){if(_0x5c8975){return _0x5c8975[_0x4f3c('0x32')](_0x2abc4d)[_0x4f3c('0x33')](function(_0x4aaf38){return _0x4aaf38;});}return null;};}function removeEntity(_0xac1764,_0x5a6c73){return function(_0xab3153){if(_0xab3153){return _0xab3153['destroy']()[_0x4f3c('0x33')](function(){var _0x115634=_0xab3153[_0x4f3c('0x34')]({'plain':!![]});var _0x25c939=_0x4f3c('0x35');return db[_0x4f3c('0x36')]['destroy']({'where':{'type':_0x25c939,'resourceId':_0x115634['id']}})[_0x4f3c('0x33')](function(){return _0xab3153;});})[_0x4f3c('0x33')](function(){_0xac1764[_0x4f3c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b621c,_0x3ad10c){return function(_0x11954c){if(!_0x11954c){_0x2b621c['sendStatus'](0x194);}return _0x11954c;};}function handleError(_0x4249b8,_0x1b9898){_0x1b9898=_0x1b9898||0x1f4;return function(_0x53f61d){logger[_0x4f3c('0x24')](_0x53f61d[_0x4f3c('0x37')]);if(_0x53f61d[_0x4f3c('0x38')]){delete _0x53f61d[_0x4f3c('0x38')];}_0x4249b8['status'](_0x1b9898)[_0x4f3c('0x39')](_0x53f61d);};}exports['index']=function(_0x21b86d,_0x5154c2){var _0x307590={},_0x360bbf={},_0x556691={'count':0x0,'rows':[]};var _0x381979=_['map'](db[_0x4f3c('0x3a')][_0x4f3c('0x3b')],function(_0x10ef11){return{'name':_0x10ef11[_0x4f3c('0x3c')],'type':_0x10ef11[_0x4f3c('0x3d')][_0x4f3c('0x3e')]};});_0x360bbf[_0x4f3c('0x3f')]=_[_0x4f3c('0x40')](_0x381979,_0x4f3c('0x38'));_0x360bbf[_0x4f3c('0x41')]=_['keys'](_0x21b86d[_0x4f3c('0x41')]);_0x360bbf[_0x4f3c('0x42')]=_[_0x4f3c('0x43')](_0x360bbf[_0x4f3c('0x3f')],_0x360bbf[_0x4f3c('0x41')]);_0x307590[_0x4f3c('0x44')]=_['intersection'](_0x360bbf[_0x4f3c('0x3f')],qs[_0x4f3c('0x45')](_0x21b86d['query'][_0x4f3c('0x45')]));_0x307590[_0x4f3c('0x44')]=_0x307590[_0x4f3c('0x44')]['length']?_0x307590[_0x4f3c('0x44')]:_0x360bbf[_0x4f3c('0x3f')];if(!_0x21b86d['query']['hasOwnProperty'](_0x4f3c('0x46'))){_0x307590['limit']=qs[_0x4f3c('0x47')](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x47')]);_0x307590[_0x4f3c('0x2d')]=qs['offset'](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x2d')]);}_0x307590[_0x4f3c('0x48')]=qs[_0x4f3c('0x49')](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x49')]);_0x307590[_0x4f3c('0x4a')]=qs[_0x4f3c('0x42')](_[_0x4f3c('0x4b')](_0x21b86d[_0x4f3c('0x41')],_0x360bbf['filters']),_0x381979);if(_0x21b86d['query'][_0x4f3c('0x4c')]){_0x307590[_0x4f3c('0x4a')]=_[_0x4f3c('0x4d')](_0x307590[_0x4f3c('0x4a')],{'$or':_[_0x4f3c('0x40')](_0x381979,function(_0x225339){if(_0x225339[_0x4f3c('0x3d')]!==_0x4f3c('0x4e')){var _0x587ddb={};_0x587ddb[_0x225339['name']]={'$like':'%'+_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x4c')]+'%'};return _0x587ddb;}})});}_0x307590=_[_0x4f3c('0x4d')]({},_0x307590,_0x21b86d['options']);var _0x368bc4={'where':_0x307590[_0x4f3c('0x4a')]};return db[_0x4f3c('0x3a')][_0x4f3c('0x2c')](_0x368bc4)[_0x4f3c('0x33')](function(_0x41aec4){_0x556691[_0x4f3c('0x2c')]=_0x41aec4;if(_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x4f')]){_0x307590['include']=[{'all':!![]}];}return db[_0x4f3c('0x3a')][_0x4f3c('0x50')](_0x307590);})[_0x4f3c('0x33')](function(_0xb3d0cc){_0x556691[_0x4f3c('0x51')]=_0xb3d0cc;return _0x556691;})['then'](respondWithFilteredResult(_0x5154c2,_0x307590))[_0x4f3c('0x28')](handleError(_0x5154c2,null));};exports[_0x4f3c('0x52')]=function(_0x2c5330,_0x36c98d){var _0x43876c={'raw':![],'where':{'id':_0x2c5330['params']['id']}},_0x2944ee={};_0x2944ee[_0x4f3c('0x3f')]=_[_0x4f3c('0x53')](db[_0x4f3c('0x3a')][_0x4f3c('0x3b')]);_0x2944ee[_0x4f3c('0x41')]=_[_0x4f3c('0x53')](_0x2c5330[_0x4f3c('0x41')]);_0x2944ee[_0x4f3c('0x42')]=_[_0x4f3c('0x43')](_0x2944ee[_0x4f3c('0x3f')],_0x2944ee[_0x4f3c('0x41')]);_0x43876c['attributes']=_[_0x4f3c('0x43')](_0x2944ee[_0x4f3c('0x3f')],qs[_0x4f3c('0x45')](_0x2c5330[_0x4f3c('0x41')][_0x4f3c('0x45')]));_0x43876c['attributes']=_0x43876c[_0x4f3c('0x44')][_0x4f3c('0x54')]?_0x43876c[_0x4f3c('0x44')]:_0x2944ee[_0x4f3c('0x3f')];if(_0x2c5330[_0x4f3c('0x41')][_0x4f3c('0x4f')]){_0x43876c['include']=[{'all':!![]}];}_0x43876c=_['merge']({},_0x43876c,_0x2c5330[_0x4f3c('0x55')]);return db['VoiceContext'][_0x4f3c('0x56')](_0x43876c)[_0x4f3c('0x33')](handleEntityNotFound(_0x36c98d,null))[_0x4f3c('0x33')](respondWithResult(_0x36c98d,null))[_0x4f3c('0x28')](handleError(_0x36c98d,null));};exports[_0x4f3c('0x57')]=function(_0xb8b67d,_0xa6269a,_0x2b7877){var _0x47001d;return db['VoiceContext'][_0x4f3c('0x57')](_0xb8b67d[_0x4f3c('0x58')],{'raw':!![]})[_0x4f3c('0x33')](function(_0x55a09f){_0x47001d=_0x55a09f;return db[_0x4f3c('0x3a')][_0x4f3c('0x50')]({'raw':!![]});})[_0x4f3c('0x33')](function(_0x484bd6){var _0x2d360d=fs[_0x4f3c('0x59')](path[_0x4f3c('0x5a')](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x15542a=ejs['render'](_0x2d360d,{'contexts':_0x484bd6||[]});fs[_0x4f3c('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x15542a);})['then'](function(){return respondWithRpcPromise(_0x4f3c('0x5f'),_0x4f3c('0x57'),{'module':_0x4f3c('0x60')});})['then'](function(){var _0x2a67de=_0xb8b67d[_0x4f3c('0x61')][_0x4f3c('0x34')]({'plain':!![]});if(!_0x2a67de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a67de[_0x4f3c('0x62')]===_0x4f3c('0x61')){var _0x4d159b=_0x47001d[_0x4f3c('0x34')]({'plain':!![]});return db[_0x4f3c('0x63')][_0x4f3c('0x56')]({'where':{'name':_0x4f3c('0x35'),'userProfileId':_0x2a67de[_0x4f3c('0x64')]},'raw':!![]})[_0x4f3c('0x33')](function(_0xba9e77){if(_0xba9e77&&_0xba9e77[_0x4f3c('0x65')]===0x0){return db[_0x4f3c('0x36')][_0x4f3c('0x57')]({'name':_0x4d159b['name'],'resourceId':_0x4d159b['id'],'type':_0xba9e77[_0x4f3c('0x38')],'sectionId':_0xba9e77['id']},{})['then'](function(){return _0x47001d;});}else{return _0x47001d;}})[_0x4f3c('0x28')](function(_0x2370f6){logger[_0x4f3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2370f6);throw _0x2370f6;});}return _0x47001d;})[_0x4f3c('0x33')](respondWithResult(_0xa6269a,0xc9))['catch'](handleError(_0xa6269a,null));};exports['update']=function(_0x2fd38f,_0x47a8e8,_0x223007){var _0xf17a3e;return db[_0x4f3c('0x3a')][_0x4f3c('0x56')]({'where':{'id':_0x2fd38f[_0x4f3c('0x66')]['id']}})[_0x4f3c('0x33')](handleEntityNotFound(_0x47a8e8,null))['then'](saveUpdates(_0x2fd38f[_0x4f3c('0x58')],null))['then'](function(_0x55844c){if(_0x55844c){_0xf17a3e=_0x55844c;return db[_0x4f3c('0x3a')][_0x4f3c('0x50')]({'raw':!![]});}})[_0x4f3c('0x33')](function(_0x27fc87){var _0x431d0a=fs[_0x4f3c('0x59')](path['join'](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x5af55c=ejs[_0x4f3c('0x67')](_0x431d0a,{'contexts':_0x27fc87||[]});fs[_0x4f3c('0x5e')](_0x4f3c('0x68'),_0x5af55c);})[_0x4f3c('0x33')](function(){return respondWithRpcPromise('Reload',_0x4f3c('0x32'),{'module':_0x4f3c('0x60')});})['then'](function(){return _0xf17a3e;})[_0x4f3c('0x33')](respondWithResult(_0x47a8e8,null))[_0x4f3c('0x28')](handleError(_0x47a8e8,null));};exports['destroy']=function(_0xaf2792,_0x471f70,_0x1bd00b){var _0x24a8f2;return db['VoiceContext'][_0x4f3c('0x56')]({'where':{'id':_0xaf2792[_0x4f3c('0x66')]['id']}})[_0x4f3c('0x33')](handleEntityNotFound(_0x471f70,null))[_0x4f3c('0x33')](removeEntity(_0x471f70,null))[_0x4f3c('0x33')](function(){return db[_0x4f3c('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x1b7b89){var _0x397c9c=fs[_0x4f3c('0x59')](path[_0x4f3c('0x5a')](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x47eba3=ejs[_0x4f3c('0x67')](_0x397c9c,{'contexts':_0x1b7b89});fs[_0x4f3c('0x5e')](_0x4f3c('0x68'),_0x47eba3);return respondWithRpcPromise(_0x4f3c('0x5f'),_0x4f3c('0x69'),{'module':_0x4f3c('0x60')});})[_0x4f3c('0x28')](handleError(_0x471f70,null));}; \ No newline at end of file +var _0x845c=['Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','readFileSync','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x3b67d4,_0x5894b2){var _0x5eb7d4=function(_0x593f2a){while(--_0x593f2a){_0x3b67d4['push'](_0x3b67d4['shift']());}};_0x5eb7d4(++_0x5894b2);}(_0x845c,0xe4));var _0xc845=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x845c[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xc845('0x0'));var rimraf=require(_0xc845('0x1'));var zipdir=require(_0xc845('0x2'));var jsonpatch=require(_0xc845('0x3'));var rp=require(_0xc845('0x4'));var moment=require(_0xc845('0x5'));var BPromise=require(_0xc845('0x6'));var Mustache=require(_0xc845('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc845('0x8'));var csv=require(_0xc845('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc845('0xa'));var _=require(_0xc845('0xb'));var squel=require(_0xc845('0xc'));var crypto=require('crypto');var jsforce=require(_0xc845('0xd'));var deskjs=require(_0xc845('0xe'));var toCsv=require(_0xc845('0x9'));var querystring=require(_0xc845('0xf'));var Papa=require(_0xc845('0x10'));var Redis=require(_0xc845('0x11'));var authService=require(_0xc845('0x12'));var qs=require(_0xc845('0x13'));var as=require(_0xc845('0x14'));var hardwareService=require(_0xc845('0x15'));var logger=require('../../config/logger')(_0xc845('0x16'));var utils=require(_0xc845('0x17'));var config=require(_0xc845('0x18'));var licenseUtil=require(_0xc845('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc845('0x1a'));var client=jayson[_0xc845('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8745,_0x1b6e81,_0x13356c,_0x1cd9cf){return new BPromise(function(_0x2bb7cd,_0x1b2d3c){var _0x1d046a=_0x1cd9cf||client;return _0x1d046a[_0xc845('0x1c')](_0x5e8745,_0x13356c)[_0xc845('0x1d')](function(_0x4d25e7){logger[_0xc845('0x1e')](_0xc845('0x1f'),_0x1b6e81,_0xc845('0x20'));logger[_0xc845('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1b6e81,'request\x20sent',JSON[_0xc845('0x22')](_0x4d25e7));if(_0x4d25e7['error']){if(_0x4d25e7[_0xc845('0x23')][_0xc845('0x24')]===0x1f4){logger[_0xc845('0x23')](_0xc845('0x1f'),_0x1b6e81,_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);return _0x1b2d3c(_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);}logger[_0xc845('0x23')]('VoiceContext,\x20%s,\x20%s',_0x1b6e81,_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);return _0x2bb7cd(_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);}else{logger[_0xc845('0x1e')](_0xc845('0x1f'),_0x1b6e81,'request\x20sent');_0x2bb7cd(_0x4d25e7[_0xc845('0x26')]['message']);}})[_0xc845('0x27')](function(_0x3a2839){logger[_0xc845('0x23')](_0xc845('0x1f'),_0x1b6e81,_0x3a2839);_0x1b2d3c(_0x3a2839);});});}function respondWithStatusCode(_0x5e8b11,_0xb6b3ba){_0xb6b3ba=_0xb6b3ba||0xcc;return function(_0x557812){if(_0x557812){return _0x5e8b11[_0xc845('0x28')](_0xb6b3ba);}return _0x5e8b11[_0xc845('0x29')](_0xb6b3ba)['end']();};}function respondWithResult(_0x12d775,_0x5d2ab7){_0x5d2ab7=_0x5d2ab7||0xc8;return function(_0x4c5415){if(_0x4c5415){return _0x12d775[_0xc845('0x29')](_0x5d2ab7)['json'](_0x4c5415);}};}function respondWithFilteredResult(_0x200dd9,_0xba2f0c){return function(_0x5028ef){if(_0x5028ef){var _0x5ba574=typeof _0xba2f0c[_0xc845('0x2a')]===_0xc845('0x2b')&&typeof _0xba2f0c[_0xc845('0x2c')]==='undefined';var _0x31717b=_0x5028ef[_0xc845('0x2d')];var _0x467ce3=_0x5ba574?0x0:_0xba2f0c[_0xc845('0x2a')];var _0x10263c=_0x5ba574?_0x5028ef[_0xc845('0x2d')]:_0xba2f0c[_0xc845('0x2a')]+_0xba2f0c[_0xc845('0x2c')];var _0x329eca;if(_0x10263c>=_0x31717b){_0x10263c=_0x31717b;_0x329eca=0xc8;}else{_0x329eca=0xce;}_0x200dd9[_0xc845('0x29')](_0x329eca);return _0x200dd9[_0xc845('0x2e')](_0xc845('0x2f'),_0x467ce3+'-'+_0x10263c+'/'+_0x31717b)[_0xc845('0x30')](_0x5028ef);}return null;};}function patchUpdates(_0x9bd678){return function(_0x59fb71){try{jsonpatch[_0xc845('0x31')](_0x59fb71,_0x9bd678,!![]);}catch(_0x1807ba){return BPromise[_0xc845('0x32')](_0x1807ba);}return _0x59fb71[_0xc845('0x33')]();};}function saveUpdates(_0x56a640,_0x4e1944){return function(_0x12323d){if(_0x12323d){return _0x12323d[_0xc845('0x34')](_0x56a640)['then'](function(_0x4fb753){return _0x4fb753;});}return null;};}function removeEntity(_0x458f50,_0x57f7da){return function(_0x46805a){if(_0x46805a){return _0x46805a[_0xc845('0x35')]()[_0xc845('0x1d')](function(){var _0x404180=_0x46805a[_0xc845('0x36')]({'plain':!![]});var _0x48422a='Contexts';return db[_0xc845('0x37')]['destroy']({'where':{'type':_0x48422a,'resourceId':_0x404180['id']}})[_0xc845('0x1d')](function(){return _0x46805a;});})[_0xc845('0x1d')](function(){_0x458f50[_0xc845('0x29')](0xcc)[_0xc845('0x38')]();});}};}function handleEntityNotFound(_0x1040a5,_0x19bde2){return function(_0x626748){if(!_0x626748){_0x1040a5[_0xc845('0x28')](0x194);}return _0x626748;};}function handleError(_0x9e5dcf,_0x15562e){_0x15562e=_0x15562e||0x1f4;return function(_0x1d0c05){logger[_0xc845('0x23')](_0x1d0c05[_0xc845('0x39')]);if(_0x1d0c05[_0xc845('0x3a')]){delete _0x1d0c05[_0xc845('0x3a')];}_0x9e5dcf['status'](_0x15562e)[_0xc845('0x3b')](_0x1d0c05);};}exports['index']=function(_0x48aa0f,_0x26d84a){var _0x593982={},_0x223aa2={},_0x2ef191={'count':0x0,'rows':[]};var _0x1b1491=_[_0xc845('0x3c')](db[_0xc845('0x3d')]['rawAttributes'],function(_0x1b050a){return{'name':_0x1b050a[_0xc845('0x3e')],'type':_0x1b050a[_0xc845('0x3f')][_0xc845('0x40')]};});_0x223aa2[_0xc845('0x41')]=_[_0xc845('0x3c')](_0x1b1491,_0xc845('0x3a'));_0x223aa2[_0xc845('0x42')]=_[_0xc845('0x43')](_0x48aa0f[_0xc845('0x42')]);_0x223aa2['filters']=_[_0xc845('0x44')](_0x223aa2[_0xc845('0x41')],_0x223aa2[_0xc845('0x42')]);_0x593982['attributes']=_['intersection'](_0x223aa2['model'],qs[_0xc845('0x45')](_0x48aa0f['query'][_0xc845('0x45')]));_0x593982[_0xc845('0x46')]=_0x593982[_0xc845('0x46')]['length']?_0x593982[_0xc845('0x46')]:_0x223aa2[_0xc845('0x41')];if(!_0x48aa0f[_0xc845('0x42')][_0xc845('0x47')](_0xc845('0x48'))){_0x593982[_0xc845('0x2c')]=qs[_0xc845('0x2c')](_0x48aa0f['query']['limit']);_0x593982[_0xc845('0x2a')]=qs['offset'](_0x48aa0f['query'][_0xc845('0x2a')]);}_0x593982[_0xc845('0x49')]=qs[_0xc845('0x4a')](_0x48aa0f[_0xc845('0x42')][_0xc845('0x4a')]);_0x593982['where']=qs[_0xc845('0x4b')](_[_0xc845('0x4c')](_0x48aa0f['query'],_0x223aa2[_0xc845('0x4b')]),_0x1b1491);if(_0x48aa0f[_0xc845('0x42')][_0xc845('0x4d')]){_0x593982['where']=_[_0xc845('0x4e')](_0x593982[_0xc845('0x4f')],{'$or':_[_0xc845('0x3c')](_0x1b1491,function(_0x18463f){if(_0x18463f['type']!==_0xc845('0x50')){var _0x2c49d3={};_0x2c49d3[_0x18463f[_0xc845('0x3a')]]={'$like':'%'+_0x48aa0f[_0xc845('0x42')]['filter']+'%'};return _0x2c49d3;}})});}_0x593982=_[_0xc845('0x4e')]({},_0x593982,_0x48aa0f[_0xc845('0x51')]);var _0xab474d={'where':_0x593982[_0xc845('0x4f')]};return db[_0xc845('0x3d')][_0xc845('0x2d')](_0xab474d)['then'](function(_0x474472){_0x2ef191[_0xc845('0x2d')]=_0x474472;if(_0x48aa0f[_0xc845('0x42')][_0xc845('0x52')]){_0x593982[_0xc845('0x53')]=[{'all':!![]}];}return db[_0xc845('0x3d')][_0xc845('0x54')](_0x593982);})['then'](function(_0x4b4fb4){_0x2ef191[_0xc845('0x55')]=_0x4b4fb4;return _0x2ef191;})[_0xc845('0x1d')](respondWithFilteredResult(_0x26d84a,_0x593982))['catch'](handleError(_0x26d84a,null));};exports['show']=function(_0x49aee6,_0x5b0b9d){var _0x5ecd5c={'raw':![],'where':{'id':_0x49aee6[_0xc845('0x56')]['id']}},_0x151888={};_0x151888[_0xc845('0x41')]=_[_0xc845('0x43')](db[_0xc845('0x3d')][_0xc845('0x57')]);_0x151888[_0xc845('0x42')]=_[_0xc845('0x43')](_0x49aee6[_0xc845('0x42')]);_0x151888[_0xc845('0x4b')]=_[_0xc845('0x44')](_0x151888['model'],_0x151888[_0xc845('0x42')]);_0x5ecd5c['attributes']=_[_0xc845('0x44')](_0x151888[_0xc845('0x41')],qs[_0xc845('0x45')](_0x49aee6[_0xc845('0x42')][_0xc845('0x45')]));_0x5ecd5c['attributes']=_0x5ecd5c[_0xc845('0x46')]['length']?_0x5ecd5c[_0xc845('0x46')]:_0x151888['model'];if(_0x49aee6[_0xc845('0x42')][_0xc845('0x52')]){_0x5ecd5c[_0xc845('0x53')]=[{'all':!![]}];}_0x5ecd5c=_[_0xc845('0x4e')]({},_0x5ecd5c,_0x49aee6['options']);return db[_0xc845('0x3d')]['find'](_0x5ecd5c)[_0xc845('0x1d')](handleEntityNotFound(_0x5b0b9d,null))['then'](respondWithResult(_0x5b0b9d,null))[_0xc845('0x27')](handleError(_0x5b0b9d,null));};exports[_0xc845('0x58')]=function(_0x2691e1,_0x2e9073,_0x3fcfc1){var _0x1a6ebb;return db[_0xc845('0x3d')][_0xc845('0x58')](_0x2691e1[_0xc845('0x59')],{'raw':!![]})[_0xc845('0x1d')](function(_0x5e1dd1){_0x1a6ebb=_0x5e1dd1;return db[_0xc845('0x3d')][_0xc845('0x54')]({'raw':!![]});})[_0xc845('0x1d')](function(_0x33b073){var _0x6cd332=fs['readFileSync'](path[_0xc845('0x5a')](config[_0xc845('0x5b')],'server/files/templates/context.ejs'),_0xc845('0x5c'));var _0x50c266=ejs[_0xc845('0x5d')](_0x6cd332,{'contexts':_0x33b073||[]});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x50c266);})['then'](function(){return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x58'),{'module':_0xc845('0x61')});})['then'](function(){var _0x58e53a=_0x2691e1[_0xc845('0x62')][_0xc845('0x36')]({'plain':!![]});if(!_0x58e53a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58e53a[_0xc845('0x63')]===_0xc845('0x62')){var _0x307946=_0x1a6ebb[_0xc845('0x36')]({'plain':!![]});return db[_0xc845('0x64')]['find']({'where':{'name':_0xc845('0x65'),'userProfileId':_0x58e53a[_0xc845('0x66')]},'raw':!![]})[_0xc845('0x1d')](function(_0xe9aec){if(_0xe9aec&&_0xe9aec[_0xc845('0x67')]===0x0){return db[_0xc845('0x37')][_0xc845('0x58')]({'name':_0x307946[_0xc845('0x3a')],'resourceId':_0x307946['id'],'type':_0xe9aec[_0xc845('0x3a')],'sectionId':_0xe9aec['id']},{})[_0xc845('0x1d')](function(){return _0x1a6ebb;});}else{return _0x1a6ebb;}})[_0xc845('0x27')](function(_0x3bfbde){logger[_0xc845('0x23')](_0xc845('0x68'),_0x3bfbde);throw _0x3bfbde;});}return _0x1a6ebb;})['then'](respondWithResult(_0x2e9073,0xc9))[_0xc845('0x27')](handleError(_0x2e9073,null));};exports['update']=function(_0xe23907,_0x36af6a,_0x343ac5){var _0x414a0d;return db[_0xc845('0x3d')][_0xc845('0x69')]({'where':{'id':_0xe23907[_0xc845('0x56')]['id']}})[_0xc845('0x1d')](handleEntityNotFound(_0x36af6a,null))['then'](saveUpdates(_0xe23907[_0xc845('0x59')],null))[_0xc845('0x1d')](function(_0x55588c){if(_0x55588c){_0x414a0d=_0x55588c;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xc845('0x1d')](function(_0x3d3b61){var _0x5a5433=fs[_0xc845('0x6a')](path[_0xc845('0x5a')](config[_0xc845('0x5b')],_0xc845('0x6b')),'utf8');var _0x171b99=ejs['render'](_0x5a5433,{'contexts':_0x3d3b61||[]});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x171b99);})[_0xc845('0x1d')](function(){return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x34'),{'module':_0xc845('0x61')});})['then'](function(){return _0x414a0d;})[_0xc845('0x1d')](respondWithResult(_0x36af6a,null))[_0xc845('0x27')](handleError(_0x36af6a,null));};exports[_0xc845('0x35')]=function(_0x4b638a,_0x2f9f77,_0x5288a0){var _0x5c973c;return db[_0xc845('0x3d')]['find']({'where':{'id':_0x4b638a[_0xc845('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f9f77,null))[_0xc845('0x1d')](removeEntity(_0x2f9f77,null))[_0xc845('0x1d')](function(){return db[_0xc845('0x3d')]['findAll']({'raw':!![]});})[_0xc845('0x1d')](function(_0x245e6a){var _0xb5261c=fs[_0xc845('0x6a')](path[_0xc845('0x5a')](config['root'],_0xc845('0x6b')),_0xc845('0x5c'));var _0x44be69=ejs['render'](_0xb5261c,{'contexts':_0x245e6a});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x44be69);return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x35'),{'module':'chan_sip.so'});})[_0xc845('0x27')](handleError(_0x2f9f77,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1396c02..f1fd1a9 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 _0x54f7=['define','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x586ed,_0x56f823){var _0x294015=function(_0x138312){while(--_0x138312){_0x586ed['push'](_0x586ed['shift']());}};_0x294015(++_0x56f823);}(_0x54f7,0x6d));var _0x754f=function(_0x44d73c,_0x4c6366){_0x44d73c=_0x44d73c-0x0;var _0x670da6=_0x54f7[_0x44d73c];return _0x670da6;};'use strict';var _=require(_0x754f('0x0'));var util=require('util');var logger=require(_0x754f('0x1'))(_0x754f('0x2'));var moment=require('moment');var BPromise=require(_0x754f('0x3'));var rp=require(_0x754f('0x4'));var fs=require('fs');var path=require(_0x754f('0x5'));var rimraf=require('rimraf');var config=require(_0x754f('0x6'));var attributes=require('./voiceContext.attributes');module[_0x754f('0x7')]=function(_0x4afb3d,_0x5717cc){return _0x4afb3d[_0x754f('0x8')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8556=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2b3bb6,_0x521fdc){var _0x28d643=function(_0x10ddc2){while(--_0x10ddc2){_0x2b3bb6['push'](_0x2b3bb6['shift']());}};_0x28d643(++_0x521fdc);}(_0x8556,0x1da));var _0x6855=function(_0xbeb3fb,_0x289ba7){_0xbeb3fb=_0xbeb3fb-0x0;var _0x4b45d5=_0x8556[_0xbeb3fb];return _0x4b45d5;};'use strict';var _=require(_0x6855('0x0'));var util=require(_0x6855('0x1'));var logger=require(_0x6855('0x2'))('api');var moment=require(_0x6855('0x3'));var BPromise=require(_0x6855('0x4'));var rp=require(_0x6855('0x5'));var fs=require('fs');var path=require(_0x6855('0x6'));var rimraf=require(_0x6855('0x7'));var config=require(_0x6855('0x8'));var attributes=require(_0x6855('0x9'));module[_0x6855('0xa')]=function(_0x346b22,_0x2b02bf){return _0x346b22[_0x6855('0xb')]('VoiceContext',attributes,{'tableName':_0x6855('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 f9b42b6..0faab2b 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 _0x5269=['../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x103e9b,_0x380a0d){var _0x282b01=function(_0x268179){while(--_0x268179){_0x103e9b['push'](_0x103e9b['shift']());}};_0x282b01(++_0x380a0d);}(_0x5269,0x150));var _0x9526=function(_0x358064,_0x45d0f6){_0x358064=_0x358064-0x0;var _0x4d3000=_0x5269[_0x358064];return _0x4d3000;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9526('0x1'));var db=require(_0x9526('0x2'))['db'];var utils=require(_0x9526('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9526('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9526('0x5')][_0x9526('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2e217a,_0x2082b4,_0x1d4acf){return new BPromise(function(_0x4569a0,_0x161880){return client[_0x9526('0x7')](_0x2e217a,_0x1d4acf)[_0x9526('0x8')](function(_0x320908){logger[_0x9526('0x9')](_0x9526('0xa'),_0x2082b4,'request\x20sent');logger[_0x9526('0xb')](_0x9526('0xc'),_0x2082b4,'request\x20sent',JSON[_0x9526('0xd')](_0x320908));if(_0x320908[_0x9526('0xe')]){if(_0x320908[_0x9526('0xe')][_0x9526('0xf')]===0x1f4){logger[_0x9526('0xe')](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x161880(_0x320908[_0x9526('0xe')][_0x9526('0x10')]);}logger['error'](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x4569a0(_0x320908['error']['message']);}else{logger[_0x9526('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x9526('0x11'));_0x4569a0(_0x320908[_0x9526('0x12')][_0x9526('0x10')]);}})[_0x9526('0x13')](function(_0x3108ba){logger[_0x9526('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x3108ba);_0x161880(_0x3108ba);});});} \ No newline at end of file +var _0x345e=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2384f6,_0x167775){var _0x370294=function(_0x8f68f4){while(--_0x8f68f4){_0x2384f6['push'](_0x2384f6['shift']());}};_0x370294(++_0x167775);}(_0x345e,0x168));var _0xe345=function(_0x282ff9,_0x268bfe){_0x282ff9=_0x282ff9-0x0;var _0x542612=_0x345e[_0x282ff9];return _0x542612;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var moment=require('moment');var BPromise=require(_0xe345('0x2'));var rs=require(_0xe345('0x3'));var fs=require('fs');var Redis=require(_0xe345('0x4'));var db=require(_0xe345('0x5'))['db'];var utils=require(_0xe345('0x6'));var logger=require(_0xe345('0x7'))(_0xe345('0x8'));var config=require(_0xe345('0x9'));var jayson=require(_0xe345('0xa'));var client=jayson['client'][_0xe345('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cc87,_0x27fc55,_0x246b2f){return new BPromise(function(_0x24f14f,_0x18f9a3){return client['request'](_0x38cc87,_0x246b2f)['then'](function(_0x41bd55){logger[_0xe345('0xc')](_0xe345('0xd'),_0x27fc55,_0xe345('0xe'));logger[_0xe345('0xf')](_0xe345('0x10'),_0x27fc55,_0xe345('0xe'),JSON[_0xe345('0x11')](_0x41bd55));if(_0x41bd55[_0xe345('0x12')]){if(_0x41bd55[_0xe345('0x12')]['code']===0x1f4){logger[_0xe345('0x12')](_0xe345('0xd'),_0x27fc55,_0x41bd55['error']['message']);return _0x18f9a3(_0x41bd55[_0xe345('0x12')]['message']);}logger[_0xe345('0x12')]('VoiceContext,\x20%s,\x20%s',_0x27fc55,_0x41bd55['error'][_0xe345('0x13')]);return _0x24f14f(_0x41bd55[_0xe345('0x12')][_0xe345('0x13')]);}else{logger[_0xe345('0xc')](_0xe345('0xd'),_0x27fc55,_0xe345('0xe'));_0x24f14f(_0x41bd55[_0xe345('0x14')][_0xe345('0x13')]);}})[_0xe345('0x15')](function(_0x1f983c){logger['error']('VoiceContext,\x20%s,\x20%s',_0x27fc55,_0x1f983c);_0x18f9a3(_0x1f983c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e12a809..f4f74e6 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 _0xb6b5=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb6b5,0x1d5));var _0x5b6b=function(_0x2bced9,_0x239449){_0x2bced9=_0x2bced9-0x0;var _0x493a28=_0xb6b5[_0x2bced9];return _0x493a28;};'use strict';var multer=require(_0x5b6b('0x0'));var util=require(_0x5b6b('0x1'));var path=require(_0x5b6b('0x2'));var timeout=require(_0x5b6b('0x3'));var express=require(_0x5b6b('0x4'));var router=express[_0x5b6b('0x5')]();var fs_extra=require(_0x5b6b('0x6'));var auth=require(_0x5b6b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5b6b('0x8'));var controller=require('./voiceDialReport.controller');router[_0x5b6b('0x9')]('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5b6b('0xc')]);router['get'](_0x5b6b('0xd'),auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xe')]);router[_0x5b6b('0xf')]('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0x10')]);router[_0x5b6b('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5b6b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5b6b('0x13')]);module[_0x5b6b('0x14')]=router; \ No newline at end of file +var _0x62c8=['describe','/:id','show','post','create','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x62c8,0x1ad));var _0x862c=function(_0x16509d,_0x304198){_0x16509d=_0x16509d-0x0;var _0x2186bf=_0x62c8[_0x16509d];return _0x2186bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x862c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x862c('0x1')]();var fs_extra=require(_0x862c('0x2'));var auth=require(_0x862c('0x3'));var interaction=require(_0x862c('0x4'));var config=require(_0x862c('0x5'));var controller=require(_0x862c('0x6'));router['get']('/',auth[_0x862c('0x7')](),controller[_0x862c('0x8')]);router[_0x862c('0x9')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0xb')]);router[_0x862c('0x9')](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0xd')]);router[_0x862c('0xe')]('/',auth['isAuthenticated'](),controller[_0x862c('0xf')]);router[_0x862c('0x10')](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0x11')]);router['delete'](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0x12')]);module[_0x862c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 85957c7..1216bb2 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x597b5f,_0x4703b5){var _0x2b2b23=function(_0x11d973){while(--_0x11d973){_0x597b5f['push'](_0x597b5f['shift']());}};_0x2b2b23(++_0x4703b5);}(_0x55ca,0x126));var _0xa55c=function(_0x5d9a85,_0x55221e){_0x5d9a85=_0x5d9a85-0x0;var _0x1ef8aa=_0x55ca[_0x5d9a85];return _0x1ef8aa;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0xa86554,_0x48cad0){var _0xa8b033=function(_0x2ab23a){while(--_0x2ab23a){_0xa86554['push'](_0xa86554['shift']());}};_0xa8b033(++_0x48cad0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x4b84[_0x5c4585];return _0x21dede;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f52c50e..9b0977d 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 _0x390d=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x390d,0x1a3));var _0xd390=function(_0x129d00,_0x18ee94){_0x129d00=_0x129d00-0x0;var _0x3cbfe0=_0x390d[_0x129d00];return _0x3cbfe0;};'use strict';var emlformat=require(_0xd390('0x0'));var rimraf=require(_0xd390('0x1'));var zipdir=require(_0xd390('0x2'));var jsonpatch=require(_0xd390('0x3'));var rp=require(_0xd390('0x4'));var moment=require(_0xd390('0x5'));var BPromise=require(_0xd390('0x6'));var Mustache=require(_0xd390('0x7'));var util=require(_0xd390('0x8'));var path=require(_0xd390('0x9'));var sox=require('sox');var csv=require(_0xd390('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd390('0xb'));var _=require('lodash');var squel=require(_0xd390('0xc'));var crypto=require(_0xd390('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd390('0xa'));var querystring=require(_0xd390('0xe'));var Papa=require(_0xd390('0xf'));var Redis=require(_0xd390('0x10'));var authService=require(_0xd390('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd390('0x12'));var hardwareService=require(_0xd390('0x13'));var logger=require(_0xd390('0x14'))(_0xd390('0x15'));var utils=require(_0xd390('0x16'));var config=require(_0xd390('0x17'));var licenseUtil=require(_0xd390('0x18'));var db=require(_0xd390('0x19'))['db'];function respondWithStatusCode(_0x1f83ef,_0x5bd9be){_0x5bd9be=_0x5bd9be||0xcc;return function(_0x5bfc78){if(_0x5bfc78){return _0x1f83ef[_0xd390('0x1a')](_0x5bd9be);}return _0x1f83ef[_0xd390('0x1b')](_0x5bd9be)[_0xd390('0x1c')]();};}function respondWithResult(_0xc85afe,_0x5d4c05){_0x5d4c05=_0x5d4c05||0xc8;return function(_0x3b6b57){if(_0x3b6b57){return _0xc85afe['status'](_0x5d4c05)[_0xd390('0x1d')](_0x3b6b57);}};}function respondWithFilteredResult(_0x3d6ec0,_0x237509){return function(_0x30873c){if(_0x30873c){var _0x161d6e=typeof _0x237509[_0xd390('0x1e')]==='undefined'&&typeof _0x237509['limit']===_0xd390('0x1f');var _0x3ba048=_0x30873c[_0xd390('0x20')];var _0x367815=_0x161d6e?0x0:_0x237509['offset'];var _0x216ea6=_0x161d6e?_0x30873c[_0xd390('0x20')]:_0x237509[_0xd390('0x1e')]+_0x237509[_0xd390('0x21')];var _0xe12a3f;if(_0x216ea6>=_0x3ba048){_0x216ea6=_0x3ba048;_0xe12a3f=0xc8;}else{_0xe12a3f=0xce;}_0x3d6ec0['status'](_0xe12a3f);return _0x3d6ec0['set'](_0xd390('0x22'),_0x367815+'-'+_0x216ea6+'/'+_0x3ba048)[_0xd390('0x1d')](_0x30873c);}return null;};}function patchUpdates(_0x1ab38e){return function(_0x3bf8a4){try{jsonpatch[_0xd390('0x23')](_0x3bf8a4,_0x1ab38e,!![]);}catch(_0x3d1738){return BPromise['reject'](_0x3d1738);}return _0x3bf8a4[_0xd390('0x24')]();};}function saveUpdates(_0x55a8a6,_0x4d3a45){return function(_0x32c817){if(_0x32c817){return _0x32c817[_0xd390('0x25')](_0x55a8a6)[_0xd390('0x26')](function(_0x3d02cd){return _0x3d02cd;});}return null;};}function removeEntity(_0x130059,_0x1594d4){return function(_0x82231d){if(_0x82231d){return _0x82231d['destroy']()[_0xd390('0x26')](function(){_0x130059[_0xd390('0x1b')](0xcc)[_0xd390('0x1c')]();});}};}function handleEntityNotFound(_0xcc1ead,_0x51608b){return function(_0xc2ed09){if(!_0xc2ed09){_0xcc1ead[_0xd390('0x1a')](0x194);}return _0xc2ed09;};}function handleError(_0x5cd3bd,_0x7ffad2){_0x7ffad2=_0x7ffad2||0x1f4;return function(_0x1e8132){logger[_0xd390('0x27')](_0x1e8132[_0xd390('0x28')]);if(_0x1e8132[_0xd390('0x29')]){delete _0x1e8132[_0xd390('0x29')];}_0x5cd3bd[_0xd390('0x1b')](_0x7ffad2)[_0xd390('0x2a')](_0x1e8132);};}exports[_0xd390('0x2b')]=function(_0xd12f8d,_0x306b99){var _0x3c744a={},_0x5e040a={},_0x5b8967={'count':0x0,'rows':[]};var _0x1f58f5=_[_0xd390('0x2c')](db[_0xd390('0x2d')][_0xd390('0x2e')],function(_0xea3291){return{'name':_0xea3291[_0xd390('0x2f')],'type':_0xea3291[_0xd390('0x30')][_0xd390('0x31')]};});_0x5e040a[_0xd390('0x32')]=_['map'](_0x1f58f5,_0xd390('0x29'));_0x5e040a[_0xd390('0x33')]=_[_0xd390('0x34')](_0xd12f8d[_0xd390('0x33')]);_0x5e040a[_0xd390('0x35')]=_[_0xd390('0x36')](_0x5e040a['model'],_0x5e040a[_0xd390('0x33')]);_0x3c744a[_0xd390('0x37')]=_[_0xd390('0x36')](_0x5e040a[_0xd390('0x32')],qs[_0xd390('0x38')](_0xd12f8d[_0xd390('0x33')]['fields']));_0x3c744a[_0xd390('0x37')]=_0x3c744a[_0xd390('0x37')][_0xd390('0x39')]?_0x3c744a[_0xd390('0x37')]:_0x5e040a[_0xd390('0x32')];if(!_0xd12f8d[_0xd390('0x33')][_0xd390('0x3a')](_0xd390('0x3b'))){_0x3c744a[_0xd390('0x21')]=qs[_0xd390('0x21')](_0xd12f8d[_0xd390('0x33')][_0xd390('0x21')]);_0x3c744a[_0xd390('0x1e')]=qs['offset'](_0xd12f8d[_0xd390('0x33')][_0xd390('0x1e')]);}_0x3c744a[_0xd390('0x3c')]=qs[_0xd390('0x3d')](_0xd12f8d[_0xd390('0x33')][_0xd390('0x3d')]);_0x3c744a[_0xd390('0x3e')]=qs[_0xd390('0x35')](_[_0xd390('0x3f')](_0xd12f8d[_0xd390('0x33')],_0x5e040a['filters']),_0x1f58f5);if(_0xd12f8d[_0xd390('0x33')][_0xd390('0x40')]){_0x3c744a[_0xd390('0x3e')]=_[_0xd390('0x41')](_0x3c744a[_0xd390('0x3e')],{'$or':_['map'](_0x1f58f5,function(_0x5d3139){if(_0x5d3139[_0xd390('0x30')]!=='VIRTUAL'){var _0x130334={};_0x130334[_0x5d3139[_0xd390('0x29')]]={'$like':'%'+_0xd12f8d[_0xd390('0x33')][_0xd390('0x40')]+'%'};return _0x130334;}})});}_0x3c744a=_[_0xd390('0x41')]({},_0x3c744a,_0xd12f8d[_0xd390('0x42')]);var _0x52f97f={'where':_0x3c744a[_0xd390('0x3e')]};return db[_0xd390('0x2d')][_0xd390('0x20')](_0x52f97f)[_0xd390('0x26')](function(_0x4ecfe0){_0x5b8967[_0xd390('0x20')]=_0x4ecfe0;if(_0xd12f8d['query'][_0xd390('0x43')]){_0x3c744a['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xd390('0x44')](_0x3c744a);})['then'](function(_0x37d6e1){_0x5b8967[_0xd390('0x45')]=_0x37d6e1;return _0x5b8967;})[_0xd390('0x26')](respondWithFilteredResult(_0x306b99,_0x3c744a))[_0xd390('0x46')](handleError(_0x306b99,null));};exports[_0xd390('0x47')]=function(_0x2241e4,_0x56284b){var _0x3e078a={'raw':!![],'where':{'id':_0x2241e4[_0xd390('0x48')]['id']}},_0x411e37={};_0x411e37[_0xd390('0x32')]=_[_0xd390('0x34')](db['VoiceDialReport']['rawAttributes']);_0x411e37[_0xd390('0x33')]=_[_0xd390('0x34')](_0x2241e4['query']);_0x411e37[_0xd390('0x35')]=_['intersection'](_0x411e37['model'],_0x411e37[_0xd390('0x33')]);_0x3e078a['attributes']=_['intersection'](_0x411e37['model'],qs[_0xd390('0x38')](_0x2241e4[_0xd390('0x33')][_0xd390('0x38')]));_0x3e078a[_0xd390('0x37')]=_0x3e078a[_0xd390('0x37')][_0xd390('0x39')]?_0x3e078a['attributes']:_0x411e37['model'];if(_0x2241e4['query']['includeAll']){_0x3e078a['include']=[{'all':!![]}];}_0x3e078a=_['merge']({},_0x3e078a,_0x2241e4[_0xd390('0x42')]);return db['VoiceDialReport'][_0xd390('0x49')](_0x3e078a)[_0xd390('0x26')](handleEntityNotFound(_0x56284b,null))[_0xd390('0x26')](respondWithResult(_0x56284b,null))[_0xd390('0x46')](handleError(_0x56284b,null));};exports[_0xd390('0x4a')]=function(_0x174d0e,_0x17ff9c){return db['VoiceDialReport'][_0xd390('0x4a')](_0x174d0e[_0xd390('0x4b')],{})['then'](respondWithResult(_0x17ff9c,0xc9))['catch'](handleError(_0x17ff9c,null));};exports['update']=function(_0x8803e5,_0x433b5b){if(_0x8803e5[_0xd390('0x4b')]['id']){delete _0x8803e5[_0xd390('0x4b')]['id'];}return db[_0xd390('0x2d')]['find']({'where':{'id':_0x8803e5[_0xd390('0x48')]['id']}})['then'](handleEntityNotFound(_0x433b5b,null))['then'](saveUpdates(_0x8803e5[_0xd390('0x4b')],null))[_0xd390('0x26')](respondWithResult(_0x433b5b,null))['catch'](handleError(_0x433b5b,null));};exports[_0xd390('0x4c')]=function(_0x452f29,_0x5dd4f3){return db[_0xd390('0x2d')][_0xd390('0x49')]({'where':{'id':_0x452f29[_0xd390('0x48')]['id']}})[_0xd390('0x26')](handleEntityNotFound(_0x5dd4f3,null))[_0xd390('0x26')](removeEntity(_0x5dd4f3,null))[_0xd390('0x46')](handleError(_0x5dd4f3,null));};exports[_0xd390('0x4d')]=function(_0x2ba447,_0x274743){return db['VoiceDialReport'][_0xd390('0x4d')]()[_0xd390('0x26')](respondWithResult(_0x274743,null))['catch'](handleError(_0x274743,null));}; \ No newline at end of file +var _0x6f29=['params','keys','includeAll','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','rows','catch','show'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x6f29,0xa5));var _0x96f2=function(_0x373f3c,_0x44e12b){_0x373f3c=_0x373f3c-0x0;var _0x555326=_0x6f29[_0x373f3c];return _0x555326;};'use strict';var emlformat=require(_0x96f2('0x0'));var rimraf=require(_0x96f2('0x1'));var zipdir=require(_0x96f2('0x2'));var jsonpatch=require(_0x96f2('0x3'));var rp=require(_0x96f2('0x4'));var moment=require('moment');var BPromise=require(_0x96f2('0x5'));var Mustache=require(_0x96f2('0x6'));var util=require(_0x96f2('0x7'));var path=require(_0x96f2('0x8'));var sox=require(_0x96f2('0x9'));var csv=require(_0x96f2('0xa'));var ejs=require(_0x96f2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x96f2('0xc'));var crypto=require(_0x96f2('0xd'));var jsforce=require(_0x96f2('0xe'));var deskjs=require(_0x96f2('0xf'));var toCsv=require(_0x96f2('0xa'));var querystring=require(_0x96f2('0x10'));var Papa=require(_0x96f2('0x11'));var Redis=require(_0x96f2('0x12'));var authService=require(_0x96f2('0x13'));var qs=require(_0x96f2('0x14'));var as=require(_0x96f2('0x15'));var hardwareService=require(_0x96f2('0x16'));var logger=require(_0x96f2('0x17'))(_0x96f2('0x18'));var utils=require(_0x96f2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x96f2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e56a,_0x2636df){_0x2636df=_0x2636df||0xcc;return function(_0xfa95e4){if(_0xfa95e4){return _0x12e56a[_0x96f2('0x1b')](_0x2636df);}return _0x12e56a['status'](_0x2636df)['end']();};}function respondWithResult(_0x20d328,_0x4302cf){_0x4302cf=_0x4302cf||0xc8;return function(_0x2c10f1){if(_0x2c10f1){return _0x20d328[_0x96f2('0x1c')](_0x4302cf)[_0x96f2('0x1d')](_0x2c10f1);}};}function respondWithFilteredResult(_0x34278b,_0x3c653b){return function(_0x1a2746){if(_0x1a2746){var _0x139d40=typeof _0x3c653b[_0x96f2('0x1e')]==='undefined'&&typeof _0x3c653b[_0x96f2('0x1f')]===_0x96f2('0x20');var _0x497d71=_0x1a2746[_0x96f2('0x21')];var _0x31135f=_0x139d40?0x0:_0x3c653b[_0x96f2('0x1e')];var _0x4ef915=_0x139d40?_0x1a2746[_0x96f2('0x21')]:_0x3c653b[_0x96f2('0x1e')]+_0x3c653b[_0x96f2('0x1f')];var _0x3aebe8;if(_0x4ef915>=_0x497d71){_0x4ef915=_0x497d71;_0x3aebe8=0xc8;}else{_0x3aebe8=0xce;}_0x34278b[_0x96f2('0x1c')](_0x3aebe8);return _0x34278b[_0x96f2('0x22')]('Content-Range',_0x31135f+'-'+_0x4ef915+'/'+_0x497d71)['json'](_0x1a2746);}return null;};}function patchUpdates(_0x350a4a){return function(_0x492666){try{jsonpatch[_0x96f2('0x23')](_0x492666,_0x350a4a,!![]);}catch(_0x228750){return BPromise[_0x96f2('0x24')](_0x228750);}return _0x492666[_0x96f2('0x25')]();};}function saveUpdates(_0x51b008,_0x5084cd){return function(_0x394b73){if(_0x394b73){return _0x394b73[_0x96f2('0x26')](_0x51b008)['then'](function(_0x1a089b){return _0x1a089b;});}return null;};}function removeEntity(_0x10a715,_0x2ffdc6){return function(_0x39b2a3){if(_0x39b2a3){return _0x39b2a3[_0x96f2('0x27')]()[_0x96f2('0x28')](function(){_0x10a715[_0x96f2('0x1c')](0xcc)[_0x96f2('0x29')]();});}};}function handleEntityNotFound(_0x1bc41a,_0x55fb81){return function(_0x42076c){if(!_0x42076c){_0x1bc41a[_0x96f2('0x1b')](0x194);}return _0x42076c;};}function handleError(_0x2281e9,_0x10acb3){_0x10acb3=_0x10acb3||0x1f4;return function(_0x544557){logger[_0x96f2('0x2a')](_0x544557[_0x96f2('0x2b')]);if(_0x544557[_0x96f2('0x2c')]){delete _0x544557['name'];}_0x2281e9[_0x96f2('0x1c')](_0x10acb3)[_0x96f2('0x2d')](_0x544557);};}exports[_0x96f2('0x2e')]=function(_0x496a68,_0x588ccf){var _0x176de7={},_0xb0fcb={},_0x416fd9={'count':0x0,'rows':[]};var _0x441de9=_[_0x96f2('0x2f')](db[_0x96f2('0x30')][_0x96f2('0x31')],function(_0x3c4688){return{'name':_0x3c4688['fieldName'],'type':_0x3c4688[_0x96f2('0x32')]['key']};});_0xb0fcb[_0x96f2('0x33')]=_[_0x96f2('0x2f')](_0x441de9,'name');_0xb0fcb['query']=_['keys'](_0x496a68[_0x96f2('0x34')]);_0xb0fcb[_0x96f2('0x35')]=_['intersection'](_0xb0fcb[_0x96f2('0x33')],_0xb0fcb[_0x96f2('0x34')]);_0x176de7[_0x96f2('0x36')]=_[_0x96f2('0x37')](_0xb0fcb[_0x96f2('0x33')],qs[_0x96f2('0x38')](_0x496a68[_0x96f2('0x34')][_0x96f2('0x38')]));_0x176de7['attributes']=_0x176de7[_0x96f2('0x36')][_0x96f2('0x39')]?_0x176de7[_0x96f2('0x36')]:_0xb0fcb[_0x96f2('0x33')];if(!_0x496a68[_0x96f2('0x34')][_0x96f2('0x3a')](_0x96f2('0x3b'))){_0x176de7[_0x96f2('0x1f')]=qs['limit'](_0x496a68[_0x96f2('0x34')]['limit']);_0x176de7[_0x96f2('0x1e')]=qs['offset'](_0x496a68[_0x96f2('0x34')]['offset']);}_0x176de7[_0x96f2('0x3c')]=qs[_0x96f2('0x3d')](_0x496a68[_0x96f2('0x34')][_0x96f2('0x3d')]);_0x176de7[_0x96f2('0x3e')]=qs[_0x96f2('0x35')](_[_0x96f2('0x3f')](_0x496a68[_0x96f2('0x34')],_0xb0fcb[_0x96f2('0x35')]),_0x441de9);if(_0x496a68[_0x96f2('0x34')][_0x96f2('0x40')]){_0x176de7[_0x96f2('0x3e')]=_[_0x96f2('0x41')](_0x176de7[_0x96f2('0x3e')],{'$or':_[_0x96f2('0x2f')](_0x441de9,function(_0x2a74e3){if(_0x2a74e3[_0x96f2('0x32')]!=='VIRTUAL'){var _0x55fa89={};_0x55fa89[_0x2a74e3[_0x96f2('0x2c')]]={'$like':'%'+_0x496a68[_0x96f2('0x34')]['filter']+'%'};return _0x55fa89;}})});}_0x176de7=_[_0x96f2('0x41')]({},_0x176de7,_0x496a68['options']);var _0x2fb60b={'where':_0x176de7[_0x96f2('0x3e')]};return db[_0x96f2('0x30')][_0x96f2('0x21')](_0x2fb60b)[_0x96f2('0x28')](function(_0x44d303){_0x416fd9[_0x96f2('0x21')]=_0x44d303;if(_0x496a68[_0x96f2('0x34')]['includeAll']){_0x176de7['include']=[{'all':!![]}];}return db[_0x96f2('0x30')]['findAll'](_0x176de7);})[_0x96f2('0x28')](function(_0x178bf0){_0x416fd9[_0x96f2('0x42')]=_0x178bf0;return _0x416fd9;})[_0x96f2('0x28')](respondWithFilteredResult(_0x588ccf,_0x176de7))[_0x96f2('0x43')](handleError(_0x588ccf,null));};exports[_0x96f2('0x44')]=function(_0x51f2f1,_0x58c09f){var _0x4c004f={'raw':!![],'where':{'id':_0x51f2f1[_0x96f2('0x45')]['id']}},_0xc82562={};_0xc82562[_0x96f2('0x33')]=_[_0x96f2('0x46')](db['VoiceDialReport'][_0x96f2('0x31')]);_0xc82562[_0x96f2('0x34')]=_['keys'](_0x51f2f1[_0x96f2('0x34')]);_0xc82562[_0x96f2('0x35')]=_[_0x96f2('0x37')](_0xc82562[_0x96f2('0x33')],_0xc82562[_0x96f2('0x34')]);_0x4c004f[_0x96f2('0x36')]=_[_0x96f2('0x37')](_0xc82562[_0x96f2('0x33')],qs[_0x96f2('0x38')](_0x51f2f1[_0x96f2('0x34')][_0x96f2('0x38')]));_0x4c004f[_0x96f2('0x36')]=_0x4c004f[_0x96f2('0x36')][_0x96f2('0x39')]?_0x4c004f['attributes']:_0xc82562[_0x96f2('0x33')];if(_0x51f2f1[_0x96f2('0x34')][_0x96f2('0x47')]){_0x4c004f[_0x96f2('0x48')]=[{'all':!![]}];}_0x4c004f=_['merge']({},_0x4c004f,_0x51f2f1[_0x96f2('0x49')]);return db[_0x96f2('0x30')]['find'](_0x4c004f)[_0x96f2('0x28')](handleEntityNotFound(_0x58c09f,null))[_0x96f2('0x28')](respondWithResult(_0x58c09f,null))[_0x96f2('0x43')](handleError(_0x58c09f,null));};exports['create']=function(_0x3a0eb6,_0x24ceda){return db['VoiceDialReport'][_0x96f2('0x4a')](_0x3a0eb6[_0x96f2('0x4b')],{})['then'](respondWithResult(_0x24ceda,0xc9))[_0x96f2('0x43')](handleError(_0x24ceda,null));};exports[_0x96f2('0x26')]=function(_0x465d2a,_0x379042){if(_0x465d2a[_0x96f2('0x4b')]['id']){delete _0x465d2a[_0x96f2('0x4b')]['id'];}return db['VoiceDialReport'][_0x96f2('0x4c')]({'where':{'id':_0x465d2a['params']['id']}})[_0x96f2('0x28')](handleEntityNotFound(_0x379042,null))[_0x96f2('0x28')](saveUpdates(_0x465d2a['body'],null))[_0x96f2('0x28')](respondWithResult(_0x379042,null))['catch'](handleError(_0x379042,null));};exports[_0x96f2('0x27')]=function(_0x267e79,_0x5129e5){return db[_0x96f2('0x30')][_0x96f2('0x4c')]({'where':{'id':_0x267e79[_0x96f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5129e5,null))[_0x96f2('0x28')](removeEntity(_0x5129e5,null))[_0x96f2('0x43')](handleError(_0x5129e5,null));};exports[_0x96f2('0x4d')]=function(_0x14e2dc,_0x39f21b){return db[_0x96f2('0x30')][_0x96f2('0x4d')]()[_0x96f2('0x28')](respondWithResult(_0x39f21b,null))[_0x96f2('0x43')](handleError(_0x39f21b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a6e4f95..3963191 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 _0xa0d6=['uniqueid','lodash','util','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa0d6,0x1f0));var _0x6a0d=function(_0x131e10,_0x28cfea){_0x131e10=_0x131e10-0x0;var _0x18320e=_0xa0d6[_0x131e10];return _0x18320e;};'use strict';var _=require(_0x6a0d('0x0'));var util=require(_0x6a0d('0x1'));var logger=require('../../config/logger')(_0x6a0d('0x2'));var moment=require(_0x6a0d('0x3'));var BPromise=require(_0x6a0d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a0d('0x5'));var attributes=require(_0x6a0d('0x6'));module[_0x6a0d('0x7')]=function(_0x525d3b,_0x4ec26e){return _0x525d3b[_0x6a0d('0x8')]('VoiceDialReport',attributes,{'tableName':_0x6a0d('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6a0d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x388e=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceDialReport.attributes','exports','define'];(function(_0x1b0c0a,_0x152846){var _0x275c61=function(_0x1f1300){while(--_0x1f1300){_0x1b0c0a['push'](_0x1b0c0a['shift']());}};_0x275c61(++_0x152846);}(_0x388e,0x17d));var _0xe388=function(_0x1969d3,_0x35ffa1){_0x1969d3=_0x1969d3-0x0;var _0x363e76=_0x388e[_0x1969d3];return _0x363e76;};'use strict';var _=require(_0xe388('0x0'));var util=require(_0xe388('0x1'));var logger=require(_0xe388('0x2'))(_0xe388('0x3'));var moment=require(_0xe388('0x4'));var BPromise=require(_0xe388('0x5'));var rp=require(_0xe388('0x6'));var fs=require('fs');var path=require(_0xe388('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe388('0x8'));module[_0xe388('0x9')]=function(_0x55918f,_0x49345e){return _0x55918f[_0xe388('0xa')](_0xe388('0xb'),attributes,{'tableName':_0xe388('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe388('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6933b89..88eeab4 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 _0x4799=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateVoiceDialReport','body','raw','then','UpdateVoiceDialReport','VoiceDialReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x27d822,_0xdc4c20){var _0x1745c6=function(_0x40b389){while(--_0x40b389){_0x27d822['push'](_0x27d822['shift']());}};_0x1745c6(++_0xdc4c20);}(_0x4799,0x1ba));var _0x9479=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4799[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9479('0x0'));var util=require(_0x9479('0x1'));var moment=require(_0x9479('0x2'));var BPromise=require(_0x9479('0x3'));var rs=require(_0x9479('0x4'));var fs=require('fs');var Redis=require(_0x9479('0x5'));var db=require(_0x9479('0x6'))['db'];var utils=require(_0x9479('0x7'));var logger=require(_0x9479('0x8'))(_0x9479('0x9'));var config=require(_0x9479('0xa'));var jayson=require(_0x9479('0xb'));var client=jayson['client'][_0x9479('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f42cc,_0x3d9f2e,_0x149656){return new BPromise(function(_0x470230,_0x3779b6){return client['request'](_0x1f42cc,_0x149656)['then'](function(_0x3e6aed){logger[_0x9479('0xd')](_0x9479('0xe'),_0x3d9f2e,_0x9479('0xf'));logger[_0x9479('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3d9f2e,'request\x20sent',JSON[_0x9479('0x11')](_0x3e6aed));if(_0x3e6aed['error']){if(_0x3e6aed[_0x9479('0x12')]['code']===0x1f4){logger[_0x9479('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x3d9f2e,_0x3e6aed[_0x9479('0x12')][_0x9479('0x13')]);return _0x3779b6(_0x3e6aed[_0x9479('0x12')][_0x9479('0x13')]);}logger[_0x9479('0x12')](_0x9479('0xe'),_0x3d9f2e,_0x3e6aed['error'][_0x9479('0x13')]);return _0x470230(_0x3e6aed['error'][_0x9479('0x13')]);}else{logger[_0x9479('0xd')](_0x9479('0xe'),_0x3d9f2e,_0x9479('0xf'));_0x470230(_0x3e6aed['result']['message']);}})[_0x9479('0x14')](function(_0x11ecaf){logger[_0x9479('0x12')](_0x9479('0xe'),_0x3d9f2e,_0x11ecaf);_0x3779b6(_0x11ecaf);});});}exports[_0x9479('0x15')]=function(_0x3a4559){var _0x150b5a=this;return new Promise(function(_0x33ed5e,_0x5ad17f){return db['VoiceDialReport']['create'](_0x3a4559[_0x9479('0x16')],{'raw':_0x3a4559['options']?_0x3a4559['options'][_0x9479('0x17')]===undefined?!![]:![]:!![]})[_0x9479('0x18')](function(_0x5b5887){logger[_0x9479('0xd')](_0x9479('0x15'),_0x3a4559);logger['debug'](_0x9479('0x15'),_0x3a4559,JSON[_0x9479('0x11')](_0x5b5887));_0x33ed5e(_0x5b5887);})[_0x9479('0x14')](function(_0x5de498){logger[_0x9479('0x12')]('CreateVoiceDialReport',_0x5de498[_0x9479('0x13')],_0x3a4559);_0x5ad17f(_0x150b5a[_0x9479('0x12')](0x1f4,_0x5de498[_0x9479('0x13')]));});});};exports[_0x9479('0x19')]=function(_0x4d8d90){var _0x234501=this;return new Promise(function(_0x35372a,_0x118e2a){return db[_0x9479('0x1a')][_0x9479('0x1b')](_0x4d8d90[_0x9479('0x16')],{'raw':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90['options'][_0x9479('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1d')]||null:null,'attributes':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1e')]||null:null,'limit':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1f')]||null:null})[_0x9479('0x18')](function(_0x2068b9){logger[_0x9479('0xd')](_0x9479('0x19'),_0x4d8d90);logger[_0x9479('0x10')]('UpdateVoiceDialReport',_0x4d8d90,JSON[_0x9479('0x11')](_0x2068b9));_0x35372a(_0x2068b9);})[_0x9479('0x14')](function(_0x543db9){logger['error'](_0x9479('0x19'),_0x543db9[_0x9479('0x13')],_0x4d8d90);_0x118e2a(_0x234501[_0x9479('0x12')](0x1f4,_0x543db9[_0x9479('0x13')]));});});}; \ No newline at end of file +var _0xebcc=['raw','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xebcc,0x69));var _0xcebc=function(_0x4ae578,_0x47156f){_0x4ae578=_0x4ae578-0x0;var _0x386e83=_0xebcc[_0x4ae578];return _0x386e83;};'use strict';var _=require(_0xcebc('0x0'));var util=require(_0xcebc('0x1'));var moment=require(_0xcebc('0x2'));var BPromise=require(_0xcebc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcebc('0x4'));var db=require(_0xcebc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcebc('0x6'));var config=require(_0xcebc('0x7'));var jayson=require(_0xcebc('0x8'));var client=jayson[_0xcebc('0x9')][_0xcebc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef8c4,_0x20275d,_0x30d3f8){return new BPromise(function(_0x4762d4,_0x40c027){return client[_0xcebc('0xb')](_0x3ef8c4,_0x30d3f8)[_0xcebc('0xc')](function(_0x199b58){logger[_0xcebc('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x20275d,_0xcebc('0xe'));logger[_0xcebc('0xf')](_0xcebc('0x10'),_0x20275d,_0xcebc('0xe'),JSON[_0xcebc('0x11')](_0x199b58));if(_0x199b58[_0xcebc('0x12')]){if(_0x199b58[_0xcebc('0x12')]['code']===0x1f4){logger[_0xcebc('0x12')](_0xcebc('0x13'),_0x20275d,_0x199b58[_0xcebc('0x12')][_0xcebc('0x14')]);return _0x40c027(_0x199b58['error']['message']);}logger['error'](_0xcebc('0x13'),_0x20275d,_0x199b58[_0xcebc('0x12')][_0xcebc('0x14')]);return _0x4762d4(_0x199b58['error'][_0xcebc('0x14')]);}else{logger[_0xcebc('0xd')](_0xcebc('0x13'),_0x20275d,'request\x20sent');_0x4762d4(_0x199b58[_0xcebc('0x15')][_0xcebc('0x14')]);}})['catch'](function(_0x57dc0c){logger['error'](_0xcebc('0x13'),_0x20275d,_0x57dc0c);_0x40c027(_0x57dc0c);});});}exports[_0xcebc('0x16')]=function(_0x4be227){var _0x53470a=this;return new Promise(function(_0x3d2eea,_0x2a745f){return db[_0xcebc('0x17')][_0xcebc('0x18')](_0x4be227[_0xcebc('0x19')],{'raw':_0x4be227[_0xcebc('0x1a')]?_0x4be227[_0xcebc('0x1a')][_0xcebc('0x1b')]===undefined?!![]:![]:!![]})[_0xcebc('0xc')](function(_0x363b1c){logger[_0xcebc('0xd')](_0xcebc('0x16'),_0x4be227);logger[_0xcebc('0xf')](_0xcebc('0x16'),_0x4be227,JSON[_0xcebc('0x11')](_0x363b1c));_0x3d2eea(_0x363b1c);})[_0xcebc('0x1c')](function(_0x3a55c5){logger[_0xcebc('0x12')](_0xcebc('0x16'),_0x3a55c5['message'],_0x4be227);_0x2a745f(_0x53470a['error'](0x1f4,_0x3a55c5[_0xcebc('0x14')]));});});};exports[_0xcebc('0x1d')]=function(_0x3440d3){var _0x1bb4f2=this;return new Promise(function(_0x5e7bae,_0x517fc0){return db['VoiceDialReport'][_0xcebc('0x1e')](_0x3440d3[_0xcebc('0x19')],{'raw':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x1f')]||null:null,'attributes':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')]['attributes']||null:null,'limit':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x20')]||null:null})[_0xcebc('0xc')](function(_0x1a05ad){logger['info'](_0xcebc('0x1d'),_0x3440d3);logger[_0xcebc('0xf')](_0xcebc('0x1d'),_0x3440d3,JSON[_0xcebc('0x11')](_0x1a05ad));_0x5e7bae(_0x1a05ad);})[_0xcebc('0x1c')](function(_0x23e774){logger[_0xcebc('0x12')](_0xcebc('0x1d'),_0x23e774[_0xcebc('0x14')],_0x3440d3);_0x517fc0(_0x1bb4f2[_0xcebc('0x12')](0x1f4,_0x23e774[_0xcebc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 39527b7..990b931 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 _0xd34f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','create','post','/:id/applications','addApplications','put','/:id','delete','exports','multer','path','connect-timeout','express'];(function(_0x45cce9,_0x26a0e9){var _0x445b5b=function(_0x53f8a6){while(--_0x53f8a6){_0x45cce9['push'](_0x45cce9['shift']());}};_0x445b5b(++_0x26a0e9);}(_0xd34f,0x14c));var _0xfd34=function(_0x2a92a4,_0x5ca2ec){_0x2a92a4=_0x2a92a4-0x0;var _0x383acc=_0xd34f[_0x2a92a4];return _0x383acc;};'use strict';var multer=require(_0xfd34('0x0'));var util=require('util');var path=require(_0xfd34('0x1'));var timeout=require(_0xfd34('0x2'));var express=require(_0xfd34('0x3'));var router=express['Router']();var fs_extra=require(_0xfd34('0x4'));var auth=require(_0xfd34('0x5'));var interaction=require(_0xfd34('0x6'));var config=require(_0xfd34('0x7'));var controller=require(_0xfd34('0x8'));router['get']('/',auth[_0xfd34('0x9')](),controller[_0xfd34('0xa')]);router[_0xfd34('0xb')]('/:id',auth[_0xfd34('0x9')](),controller[_0xfd34('0xc')]);router['post']('/',auth[_0xfd34('0x9')](),controller[_0xfd34('0xd')]);router[_0xfd34('0xe')](_0xfd34('0xf'),auth[_0xfd34('0x9')](),controller[_0xfd34('0x10')]);router[_0xfd34('0x11')](_0xfd34('0x12'),auth[_0xfd34('0x9')](),controller['update']);router[_0xfd34('0x13')](_0xfd34('0x12'),auth[_0xfd34('0x9')](),controller['destroy']);module[_0xfd34('0x14')]=router; \ No newline at end of file +var _0x4031=['destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x28aebc,_0xd247dc){var _0x82d4ac=function(_0x2f491a){while(--_0x2f491a){_0x28aebc['push'](_0x28aebc['shift']());}};_0x82d4ac(++_0xd247dc);}(_0x4031,0x169));var _0x1403=function(_0x39e3eb,_0x352020){_0x39e3eb=_0x39e3eb-0x0;var _0x444c91=_0x4031[_0x39e3eb];return _0x444c91;};'use strict';var multer=require(_0x1403('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1403('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1403('0x2'));var auth=require(_0x1403('0x3'));var interaction=require(_0x1403('0x4'));var config=require(_0x1403('0x5'));var controller=require(_0x1403('0x6'));router[_0x1403('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1403('0x7')](_0x1403('0x8'),auth[_0x1403('0x9')](),controller['show']);router[_0x1403('0xa')]('/',auth[_0x1403('0x9')](),controller[_0x1403('0xb')]);router[_0x1403('0xa')](_0x1403('0xc'),auth[_0x1403('0x9')](),controller[_0x1403('0xd')]);router[_0x1403('0xe')](_0x1403('0x8'),auth['isAuthenticated'](),controller[_0x1403('0xf')]);router[_0x1403('0x10')](_0x1403('0x8'),auth[_0x1403('0x9')](),controller[_0x1403('0x11')]);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 b85703c..d431754 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(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x15fe15,_0x220851){var _0x25e4c6=function(_0x5be2dd){while(--_0x5be2dd){_0x15fe15['push'](_0x15fe15['shift']());}};_0x25e4c6(++_0x220851);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 6ba21e2..a3f3f42 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 _0xaf98=['ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','destroy','then','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','VoiceExtension','includeAll','include','findAll','rows','catch','params','fields','create','body','startsWith','exten','concat','get','user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction'];(function(_0x1227c0,_0x5d91ee){var _0x557d9d=function(_0xdd29c4){while(--_0xdd29c4){_0x1227c0['push'](_0x1227c0['shift']());}};_0x557d9d(++_0x5d91ee);}(_0xaf98,0x69));var _0x8af9=function(_0x259ac7,_0x3c65c6){_0x259ac7=_0x259ac7-0x0;var _0x185b01=_0xaf98[_0x259ac7];return _0x185b01;};'use strict';var _=require('lodash');var Redis=require(_0x8af9('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8af9('0x1'))('api');var config=require(_0x8af9('0x2'));var db=require(_0x8af9('0x3'))['db'];config[_0x8af9('0x4')]=_[_0x8af9('0x5')](config[_0x8af9('0x4')],{'host':_0x8af9('0x6'),'port':0x18eb});var socket=require(_0x8af9('0x7'))(new Redis(config[_0x8af9('0x4')]));require('./voiceExtension.socket')[_0x8af9('0x8')](socket);function respondWithStatusCode(_0x578e82,_0x5b93db){_0x5b93db=_0x5b93db||0xcc;return function(_0x149343){if(_0x149343){return _0x578e82[_0x8af9('0x9')](_0x5b93db);}return _0x578e82[_0x8af9('0xa')](_0x5b93db)['end']();};}function respondWithResult(_0x1f0a3d,_0x1a0882){_0x1a0882=_0x1a0882||0xc8;return function(_0x4ff400){if(_0x4ff400){return _0x1f0a3d[_0x8af9('0xa')](_0x1a0882)['json'](_0x4ff400);}};}function respondWithFilteredResult(_0x4a5c12,_0x1f9523){return function(_0x831ffa){if(_0x831ffa){var _0x5171c4=typeof _0x1f9523['offset']===_0x8af9('0xb')&&typeof _0x1f9523[_0x8af9('0xc')]===_0x8af9('0xb');var _0x2ac93f=_0x831ffa['count'];var _0x4234dd=_0x5171c4?0x0:_0x1f9523[_0x8af9('0xd')];var _0x5d5794=_0x5171c4?_0x831ffa[_0x8af9('0xe')]:_0x1f9523[_0x8af9('0xd')]+_0x1f9523[_0x8af9('0xc')];var _0x3baf3a;if(_0x5d5794>=_0x2ac93f){_0x5d5794=_0x2ac93f;_0x3baf3a=0xc8;}else{_0x3baf3a=0xce;}_0x4a5c12[_0x8af9('0xa')](_0x3baf3a);return _0x4a5c12[_0x8af9('0xf')](_0x8af9('0x10'),_0x4234dd+'-'+_0x5d5794+'/'+_0x2ac93f)[_0x8af9('0x11')](_0x831ffa);}return null;};}function removeEntity(_0x12afbf){return function(_0x16b0d7){if(_0x16b0d7){return _0x16b0d7[_0x8af9('0x12')]()[_0x8af9('0x13')](function(){var _0x4d46e2=_0x16b0d7['get']({'plain':!![]});var _0x5a20bb=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15'),'ignore':![]},{'name':_0x8af9('0x16'),'value':_0x8af9('0x17'),'ignore':![]}];var _0x385b16=_(_0x5a20bb)['filter'](_0x8af9('0x18'))[_0x8af9('0x19')](_0x8af9('0x1a'))[_0x8af9('0x1a')]();if(_[_0x8af9('0x1b')](_0x385b16,_0x4d46e2['type'])){return;}var _0x4b8c1f=_[_0x8af9('0x1c')](_0x5a20bb,['value',_0x4d46e2[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x1f')][_0x8af9('0x12')]({'where':{'type':_0x4b8c1f,'resourceId':_0x4d46e2['id']}})['then'](function(){return _0x16b0d7;});})[_0x8af9('0x13')](function(){_0x12afbf[_0x8af9('0xa')](0xcc)[_0x8af9('0x20')]();});}};}function handleEntityNotFound(_0x4242c5){return function(_0x2f02ed){if(!_0x2f02ed){_0x4242c5[_0x8af9('0x9')](0x194);}return _0x2f02ed;};}function handleError(_0x13d2a0,_0xa7547){_0xa7547=_0xa7547||0x1f4;return function(_0x4be93b){logger[_0x8af9('0x21')](_0x4be93b[_0x8af9('0x22')]);if(_0x4be93b[_0x8af9('0x1e')]){delete _0x4be93b[_0x8af9('0x1e')];}_0x13d2a0[_0x8af9('0xa')](_0xa7547)[_0x8af9('0x23')](_0x4be93b);};}exports[_0x8af9('0x24')]=function(_0x39ace3,_0x9bcb21){var _0x1d7d57={},_0x44c7ad={},_0x267764={'count':0x0,'rows':[]};var _0x31950b=_['map'](db['VoiceExtension'][_0x8af9('0x25')],function(_0x51f541){return{'name':_0x51f541[_0x8af9('0x26')],'type':_0x51f541['type'][_0x8af9('0x27')]};});_0x44c7ad[_0x8af9('0x28')]=_[_0x8af9('0x19')](_0x31950b,_0x8af9('0x1e'));_0x44c7ad[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x39ace3['query']);_0x44c7ad[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x44c7ad[_0x8af9('0x28')],_0x44c7ad[_0x8af9('0x29')]);_0x1d7d57[_0x8af9('0x2d')]=_[_0x8af9('0x2c')](_0x44c7ad['model'],qs['fields'](_0x39ace3[_0x8af9('0x29')]['fields']));_0x1d7d57[_0x8af9('0x2d')]=_0x1d7d57[_0x8af9('0x2d')][_0x8af9('0x2e')]?_0x1d7d57[_0x8af9('0x2d')]:_0x44c7ad[_0x8af9('0x28')];if(!_0x39ace3['query'][_0x8af9('0x2f')](_0x8af9('0x30'))){_0x1d7d57[_0x8af9('0xc')]=qs['limit'](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xc')]);_0x1d7d57[_0x8af9('0xd')]=qs[_0x8af9('0xd')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xd')]);}_0x1d7d57['order']=qs[_0x8af9('0x31')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0x31')]);_0x1d7d57['where']=qs[_0x8af9('0x2b')](_[_0x8af9('0x32')](_0x39ace3[_0x8af9('0x29')],_0x44c7ad[_0x8af9('0x2b')]),_0x31950b);if(_0x39ace3['query']['filter']){_0x1d7d57['where']=_[_0x8af9('0x33')](_0x1d7d57[_0x8af9('0x34')],{'$or':_[_0x8af9('0x19')](_0x31950b,function(_0x5d7498){if(_0x5d7498['type']!==_0x8af9('0x35')){var _0x4ab3a7={};_0x4ab3a7[_0x5d7498[_0x8af9('0x1e')]]={'$like':'%'+_0x39ace3[_0x8af9('0x29')][_0x8af9('0x36')]+'%'};return _0x4ab3a7;}})});}_0x1d7d57=_[_0x8af9('0x33')]({},_0x1d7d57,_0x39ace3[_0x8af9('0x37')]);var _0x13ed1e={'where':_0x1d7d57[_0x8af9('0x34')]};return db[_0x8af9('0x38')][_0x8af9('0xe')](_0x13ed1e)[_0x8af9('0x13')](function(_0x54a240){_0x267764[_0x8af9('0xe')]=_0x54a240;if(_0x39ace3[_0x8af9('0x29')][_0x8af9('0x39')]){_0x1d7d57[_0x8af9('0x3a')]=[{'all':!![]}];}return db[_0x8af9('0x38')][_0x8af9('0x3b')](_0x1d7d57);})[_0x8af9('0x13')](function(_0x6d52e2){_0x267764[_0x8af9('0x3c')]=_0x6d52e2;return _0x267764;})[_0x8af9('0x13')](respondWithFilteredResult(_0x9bcb21,_0x1d7d57))[_0x8af9('0x3d')](handleError(_0x9bcb21,null));};exports['show']=function(_0x1e0853,_0x307f3a){var _0x3e50e8={'raw':![],'where':{'id':_0x1e0853[_0x8af9('0x3e')]['id']}},_0x4b37cc={};_0x4b37cc[_0x8af9('0x28')]=_[_0x8af9('0x2a')](db['VoiceExtension']['rawAttributes']);_0x4b37cc[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x1e0853[_0x8af9('0x29')]);_0x4b37cc[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],_0x4b37cc['query']);_0x3e50e8['attributes']=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],qs['fields'](_0x1e0853[_0x8af9('0x29')][_0x8af9('0x3f')]));_0x3e50e8[_0x8af9('0x2d')]=_0x3e50e8['attributes'][_0x8af9('0x2e')]?_0x3e50e8[_0x8af9('0x2d')]:_0x4b37cc['model'];if(_0x1e0853[_0x8af9('0x29')][_0x8af9('0x39')]){_0x3e50e8[_0x8af9('0x3a')]=[{'all':!![]}];}_0x3e50e8=_[_0x8af9('0x33')]({},_0x3e50e8,_0x1e0853['options']);return db[_0x8af9('0x38')][_0x8af9('0x1c')](_0x3e50e8)['then'](handleEntityNotFound(_0x307f3a,null))[_0x8af9('0x13')](respondWithResult(_0x307f3a,null))[_0x8af9('0x3d')](handleError(_0x307f3a,null));};exports['destroy']=function(_0x145c9a,_0x18b2db){return db[_0x8af9('0x38')][_0x8af9('0x1c')]({'where':{'id':_0x145c9a[_0x8af9('0x3e')]['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x18b2db,null))[_0x8af9('0x13')](removeEntity(_0x18b2db,null))[_0x8af9('0x3d')](handleError(_0x18b2db,null));};exports[_0x8af9('0x40')]=function(_0x4131aa,_0x2c2441){if(_0x4131aa[_0x8af9('0x41')][_0x8af9('0x1d')]==='outbound'&&!_[_0x8af9('0x42')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')],'_')){_0x4131aa['body']['exten']='_'[_0x8af9('0x44')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')]);}return db[_0x8af9('0x38')][_0x8af9('0x40')](_0x4131aa['body'],{'raw':![]})[_0x8af9('0x13')](function(_0x3a99ca){var _0x15cc26=_0x4131aa['user'][_0x8af9('0x45')]({'plain':!![]});if(!_0x15cc26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15cc26['role']===_0x8af9('0x46')){var _0x7600cd=_0x3a99ca[_0x8af9('0x45')]({'plain':!![]});var _0x49162b=[{'name':_0x8af9('0x47'),'value':_0x8af9('0x48')},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15')},{'name':_0x8af9('0x16'),'value':'internal'}];var _0x3b05c8=_['find'](_0x49162b,[_0x8af9('0x1a'),_0x7600cd[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x49')][_0x8af9('0x1c')]({'where':{'name':_0x3b05c8,'userProfileId':_0x15cc26[_0x8af9('0x4a')]},'raw':!![]})[_0x8af9('0x13')](function(_0x5c0b4b){if(_0x5c0b4b&&_0x5c0b4b[_0x8af9('0x4b')]===0x0){return db[_0x8af9('0x1f')]['create']({'name':_0x7600cd[_0x8af9('0x1e')],'resourceId':_0x7600cd['id'],'type':_0x5c0b4b[_0x8af9('0x1e')],'sectionId':_0x5c0b4b['id']},{})['then'](function(){return _0x3a99ca;});}else{return _0x3a99ca;}})[_0x8af9('0x3d')](function(_0x209c99){logger[_0x8af9('0x21')](_0x8af9('0x4c'),_0x209c99);throw _0x209c99;});}return _0x3a99ca;})[_0x8af9('0x13')](respondWithResult(_0x2c2441,0xc9))[_0x8af9('0x3d')](handleError(_0x2c2441,null));};exports[_0x8af9('0x4d')]=function(_0x26b0fd,_0x490b0a){if(_0x26b0fd[_0x8af9('0x41')]['id']){delete _0x26b0fd[_0x8af9('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x26b0fd['params']['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x490b0a,null))[_0x8af9('0x13')](function(_0x464919){if(_0x464919){return db[_0x8af9('0x38')]['update'](_[_0x8af9('0x32')](_0x26b0fd[_0x8af9('0x41')],[_0x8af9('0x43'),_0x8af9('0x4e'),_0x8af9('0x4f'),_0x8af9('0x50'),'cutdigits',_0x8af9('0x51'),_0x8af9('0x52')]),{'where':{'context':_0x464919[_0x8af9('0x4e')],'exten':_0x464919[_0x8af9('0x43')]},'individualHooks':!![]})[_0x8af9('0x13')](function(_0x536853){return _0x536853;});}return null;})[_0x8af9('0x13')](respondWithStatusCode(_0x490b0a,null))[_0x8af9('0x3d')](handleError(_0x490b0a,null));};exports[_0x8af9('0x53')]=function(_0x248552,_0xd72267){var _0x24698c=_0x248552[_0x8af9('0x3e')]['id'];var _0x1a987e=_0x248552[_0x8af9('0x41')];var _0x56c11c=0xc8;var _0x3914e3=null;return db[_0x8af9('0x54')][_0x8af9('0x55')]({'isolationLevel':db[_0x8af9('0x54')][_0x8af9('0x56')][_0x8af9('0x57')]['READ_COMMITTED']},function(_0x2b31cf){return db['VoiceExtension'][_0x8af9('0x58')]({'where':{'id':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(_0x53670d){if(_0x53670d){return db[_0x8af9('0x38')][_0x8af9('0x12')]({'where':{'VoiceExtensionId':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(){var _0x2f5bdf=_[_0x8af9('0x19')](_0x1a987e,function(_0x24596b){_0x24596b[_0x8af9('0x59')]=_0x24698c;_0x24596b[_0x8af9('0x5a')]=!![];return _0x24596b;});return _0x53670d[_0x8af9('0x5b')](_0x2f5bdf);})[_0x8af9('0x13')](function(_0x9cf09a){return db[_0x8af9('0x38')][_0x8af9('0x5c')](_0x9cf09a,{'transaction':_0x2b31cf});});}else{_0x56c11c=0x194;_0x3914e3=[];}});})[_0x8af9('0x13')](function(){if(_0x56c11c!==0x194){return db[_0x8af9('0x38')][_0x8af9('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x24698c},'order':_0x8af9('0x5e')})[_0x8af9('0x13')](function(_0x2d9305){_0x3914e3=_0x2d9305;});}})[_0x8af9('0x3d')](function(_0x10c102){_0x56c11c=0x1f4;logger[_0x8af9('0x21')](_0x10c102[_0x8af9('0x22')]);if(_0x10c102[_0x8af9('0x1e')]){delete _0x10c102['name'];}_0x3914e3=_0x10c102;})[_0x8af9('0x5f')](function(){if(_0x3914e3===null){_0xd72267['sendStatus'](_0x56c11c);}else{if(_0x56c11c===0x1f4){_0xd72267[_0x8af9('0xa')](_0x56c11c)[_0x8af9('0x23')](_0x3914e3);}else{_0xd72267[_0x8af9('0xa')](_0x56c11c)['json'](_0x3914e3);}}});}; \ No newline at end of file +var _0x27f4=['Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','params','includeAll','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction'];(function(_0x3e74f7,_0x17b946){var _0xfd6763=function(_0x5e6185){while(--_0x5e6185){_0x3e74f7['push'](_0x3e74f7['shift']());}};_0xfd6763(++_0x17b946);}(_0x27f4,0xd0));var _0x427f=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0x27f4[_0x5c8628];return _0xcbd50e;};'use strict';var _=require(_0x427f('0x0'));var Redis=require(_0x427f('0x1'));var qs=require(_0x427f('0x2'));var logger=require(_0x427f('0x3'))(_0x427f('0x4'));var config=require(_0x427f('0x5'));var db=require(_0x427f('0x6'))['db'];config[_0x427f('0x7')]=_['defaults'](config[_0x427f('0x7')],{'host':_0x427f('0x8'),'port':0x18eb});var socket=require(_0x427f('0x9'))(new Redis(config[_0x427f('0x7')]));require('./voiceExtension.socket')[_0x427f('0xa')](socket);function respondWithStatusCode(_0x1a603c,_0x2d3c26){_0x2d3c26=_0x2d3c26||0xcc;return function(_0x5e398a){if(_0x5e398a){return _0x1a603c[_0x427f('0xb')](_0x2d3c26);}return _0x1a603c[_0x427f('0xc')](_0x2d3c26)[_0x427f('0xd')]();};}function respondWithResult(_0x7949e7,_0x5dc7a2){_0x5dc7a2=_0x5dc7a2||0xc8;return function(_0x2dfd83){if(_0x2dfd83){return _0x7949e7['status'](_0x5dc7a2)[_0x427f('0xe')](_0x2dfd83);}};}function respondWithFilteredResult(_0x44b953,_0x3cbca3){return function(_0x35c7df){if(_0x35c7df){var _0x3f7103=typeof _0x3cbca3[_0x427f('0xf')]===_0x427f('0x10')&&typeof _0x3cbca3['limit']===_0x427f('0x10');var _0x499d58=_0x35c7df['count'];var _0x1abac7=_0x3f7103?0x0:_0x3cbca3[_0x427f('0xf')];var _0x4172a2=_0x3f7103?_0x35c7df[_0x427f('0x11')]:_0x3cbca3[_0x427f('0xf')]+_0x3cbca3[_0x427f('0x12')];var _0x3879b0;if(_0x4172a2>=_0x499d58){_0x4172a2=_0x499d58;_0x3879b0=0xc8;}else{_0x3879b0=0xce;}_0x44b953['status'](_0x3879b0);return _0x44b953[_0x427f('0x13')]('Content-Range',_0x1abac7+'-'+_0x4172a2+'/'+_0x499d58)['json'](_0x35c7df);}return null;};}function removeEntity(_0x299db1){return function(_0x50162c){if(_0x50162c){return _0x50162c['destroy']()[_0x427f('0x14')](function(){var _0x23b672=_0x50162c[_0x427f('0x15')]({'plain':!![]});var _0x4a8d85=[{'name':_0x427f('0x16'),'value':'inbound','ignore':![]},{'name':_0x427f('0x17'),'value':_0x427f('0x18'),'ignore':![]},{'name':_0x427f('0x19'),'value':_0x427f('0x1a'),'ignore':![]}];var _0x290a96=_(_0x4a8d85)[_0x427f('0x1b')](_0x427f('0x1c'))[_0x427f('0x1d')](_0x427f('0x1e'))[_0x427f('0x1e')]();if(_['includes'](_0x290a96,_0x23b672['type'])){return;}var _0x3ef807=_[_0x427f('0x1f')](_0x4a8d85,['value',_0x23b672['type']])[_0x427f('0x20')];return db[_0x427f('0x21')][_0x427f('0x22')]({'where':{'type':_0x3ef807,'resourceId':_0x23b672['id']}})[_0x427f('0x14')](function(){return _0x50162c;});})['then'](function(){_0x299db1[_0x427f('0xc')](0xcc)[_0x427f('0xd')]();});}};}function handleEntityNotFound(_0x2684ce){return function(_0x93a8e9){if(!_0x93a8e9){_0x2684ce['sendStatus'](0x194);}return _0x93a8e9;};}function handleError(_0x4dd0f9,_0x25f47f){_0x25f47f=_0x25f47f||0x1f4;return function(_0x4cecc9){logger[_0x427f('0x23')](_0x4cecc9[_0x427f('0x24')]);if(_0x4cecc9[_0x427f('0x20')]){delete _0x4cecc9[_0x427f('0x20')];}_0x4dd0f9['status'](_0x25f47f)[_0x427f('0x25')](_0x4cecc9);};}exports[_0x427f('0x26')]=function(_0x5e65d5,_0x137cf0){var _0x40d482={},_0x101c9b={},_0x1b63a2={'count':0x0,'rows':[]};var _0xe5c736=_[_0x427f('0x1d')](db['VoiceExtension'][_0x427f('0x27')],function(_0x1a900b){return{'name':_0x1a900b[_0x427f('0x28')],'type':_0x1a900b[_0x427f('0x29')][_0x427f('0x2a')]};});_0x101c9b[_0x427f('0x2b')]=_[_0x427f('0x1d')](_0xe5c736,'name');_0x101c9b['query']=_[_0x427f('0x2c')](_0x5e65d5[_0x427f('0x2d')]);_0x101c9b['filters']=_[_0x427f('0x2e')](_0x101c9b[_0x427f('0x2b')],_0x101c9b['query']);_0x40d482[_0x427f('0x2f')]=_['intersection'](_0x101c9b[_0x427f('0x2b')],qs[_0x427f('0x30')](_0x5e65d5['query'][_0x427f('0x30')]));_0x40d482[_0x427f('0x2f')]=_0x40d482['attributes'][_0x427f('0x31')]?_0x40d482['attributes']:_0x101c9b[_0x427f('0x2b')];if(!_0x5e65d5['query'][_0x427f('0x32')](_0x427f('0x33'))){_0x40d482[_0x427f('0x12')]=qs['limit'](_0x5e65d5[_0x427f('0x2d')]['limit']);_0x40d482['offset']=qs[_0x427f('0xf')](_0x5e65d5[_0x427f('0x2d')][_0x427f('0xf')]);}_0x40d482['order']=qs[_0x427f('0x34')](_0x5e65d5['query'][_0x427f('0x34')]);_0x40d482[_0x427f('0x35')]=qs[_0x427f('0x36')](_[_0x427f('0x37')](_0x5e65d5[_0x427f('0x2d')],_0x101c9b[_0x427f('0x36')]),_0xe5c736);if(_0x5e65d5[_0x427f('0x2d')]['filter']){_0x40d482[_0x427f('0x35')]=_[_0x427f('0x38')](_0x40d482[_0x427f('0x35')],{'$or':_['map'](_0xe5c736,function(_0x337b98){if(_0x337b98[_0x427f('0x29')]!==_0x427f('0x39')){var _0x1446e9={};_0x1446e9[_0x337b98[_0x427f('0x20')]]={'$like':'%'+_0x5e65d5[_0x427f('0x2d')][_0x427f('0x1b')]+'%'};return _0x1446e9;}})});}_0x40d482=_[_0x427f('0x38')]({},_0x40d482,_0x5e65d5[_0x427f('0x3a')]);var _0x16f872={'where':_0x40d482[_0x427f('0x35')]};return db[_0x427f('0x3b')][_0x427f('0x11')](_0x16f872)[_0x427f('0x14')](function(_0x2851a5){_0x1b63a2[_0x427f('0x11')]=_0x2851a5;if(_0x5e65d5[_0x427f('0x2d')]['includeAll']){_0x40d482[_0x427f('0x3c')]=[{'all':!![]}];}return db[_0x427f('0x3b')][_0x427f('0x3d')](_0x40d482);})[_0x427f('0x14')](function(_0x44fe13){_0x1b63a2[_0x427f('0x3e')]=_0x44fe13;return _0x1b63a2;})[_0x427f('0x14')](respondWithFilteredResult(_0x137cf0,_0x40d482))['catch'](handleError(_0x137cf0,null));};exports['show']=function(_0x245704,_0x11be85){var _0x4a3511={'raw':![],'where':{'id':_0x245704[_0x427f('0x3f')]['id']}},_0x2bb168={};_0x2bb168['model']=_[_0x427f('0x2c')](db[_0x427f('0x3b')][_0x427f('0x27')]);_0x2bb168[_0x427f('0x2d')]=_[_0x427f('0x2c')](_0x245704[_0x427f('0x2d')]);_0x2bb168[_0x427f('0x36')]=_[_0x427f('0x2e')](_0x2bb168[_0x427f('0x2b')],_0x2bb168[_0x427f('0x2d')]);_0x4a3511[_0x427f('0x2f')]=_[_0x427f('0x2e')](_0x2bb168['model'],qs[_0x427f('0x30')](_0x245704[_0x427f('0x2d')][_0x427f('0x30')]));_0x4a3511[_0x427f('0x2f')]=_0x4a3511[_0x427f('0x2f')][_0x427f('0x31')]?_0x4a3511[_0x427f('0x2f')]:_0x2bb168[_0x427f('0x2b')];if(_0x245704[_0x427f('0x2d')][_0x427f('0x40')]){_0x4a3511['include']=[{'all':!![]}];}_0x4a3511=_[_0x427f('0x38')]({},_0x4a3511,_0x245704[_0x427f('0x3a')]);return db[_0x427f('0x3b')][_0x427f('0x1f')](_0x4a3511)[_0x427f('0x14')](handleEntityNotFound(_0x11be85,null))['then'](respondWithResult(_0x11be85,null))[_0x427f('0x41')](handleError(_0x11be85,null));};exports[_0x427f('0x22')]=function(_0x47304c,_0x109ebe){return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x47304c[_0x427f('0x3f')]['id']}})[_0x427f('0x14')](handleEntityNotFound(_0x109ebe,null))[_0x427f('0x14')](removeEntity(_0x109ebe,null))[_0x427f('0x41')](handleError(_0x109ebe,null));};exports[_0x427f('0x42')]=function(_0xf9cbad,_0x4b1ec5){if(_0xf9cbad[_0x427f('0x43')][_0x427f('0x29')]===_0x427f('0x18')&&!_[_0x427f('0x44')](_0xf9cbad[_0x427f('0x43')][_0x427f('0x45')],'_')){_0xf9cbad['body'][_0x427f('0x45')]='_'[_0x427f('0x46')](_0xf9cbad[_0x427f('0x43')]['exten']);}return db[_0x427f('0x3b')][_0x427f('0x42')](_0xf9cbad['body'],{'raw':![]})[_0x427f('0x14')](function(_0x2ec2aa){var _0x4c8076=_0xf9cbad['user']['get']({'plain':!![]});if(!_0x4c8076)throw new Error(_0x427f('0x47'));if(_0x4c8076[_0x427f('0x48')]===_0x427f('0x49')){var _0x3c901c=_0x2ec2aa[_0x427f('0x15')]({'plain':!![]});var _0x22c90f=[{'name':_0x427f('0x16'),'value':_0x427f('0x4a')},{'name':_0x427f('0x17'),'value':_0x427f('0x18')},{'name':_0x427f('0x19'),'value':_0x427f('0x1a')}];var _0x4861a4=_[_0x427f('0x1f')](_0x22c90f,[_0x427f('0x1e'),_0x3c901c['type']])[_0x427f('0x20')];return db[_0x427f('0x4b')][_0x427f('0x1f')]({'where':{'name':_0x4861a4,'userProfileId':_0x4c8076[_0x427f('0x4c')]},'raw':!![]})[_0x427f('0x14')](function(_0x544deb){if(_0x544deb&&_0x544deb[_0x427f('0x4d')]===0x0){return db[_0x427f('0x21')][_0x427f('0x42')]({'name':_0x3c901c[_0x427f('0x20')],'resourceId':_0x3c901c['id'],'type':_0x544deb['name'],'sectionId':_0x544deb['id']},{})['then'](function(){return _0x2ec2aa;});}else{return _0x2ec2aa;}})[_0x427f('0x41')](function(_0x66f091){logger[_0x427f('0x23')](_0x427f('0x4e'),_0x66f091);throw _0x66f091;});}return _0x2ec2aa;})['then'](respondWithResult(_0x4b1ec5,0xc9))[_0x427f('0x41')](handleError(_0x4b1ec5,null));};exports[_0x427f('0x4f')]=function(_0x4250d8,_0x481eb9){if(_0x4250d8[_0x427f('0x43')]['id']){delete _0x4250d8[_0x427f('0x43')]['id'];}return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x4250d8[_0x427f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x481eb9,null))['then'](function(_0x1c301c){if(_0x1c301c){return db['VoiceExtension'][_0x427f('0x4f')](_[_0x427f('0x37')](_0x4250d8[_0x427f('0x43')],[_0x427f('0x45'),_0x427f('0x50'),_0x427f('0x51'),_0x427f('0x52'),_0x427f('0x53'),_0x427f('0x54'),_0x427f('0x55')]),{'where':{'context':_0x1c301c['context'],'exten':_0x1c301c[_0x427f('0x45')]},'individualHooks':!![]})[_0x427f('0x14')](function(_0x3bd695){return _0x3bd695;});}return null;})[_0x427f('0x14')](respondWithStatusCode(_0x481eb9,null))[_0x427f('0x41')](handleError(_0x481eb9,null));};exports[_0x427f('0x56')]=function(_0x50b36b,_0x5184b5){var _0x22a0c7=_0x50b36b[_0x427f('0x3f')]['id'];var _0x1f6083=_0x50b36b[_0x427f('0x43')];var _0x556d5d=0xc8;var _0x4791e8=null;return db[_0x427f('0x57')][_0x427f('0x58')]({'isolationLevel':db[_0x427f('0x57')][_0x427f('0x59')]['ISOLATION_LEVELS'][_0x427f('0x5a')]},function(_0x15eb43){return db[_0x427f('0x3b')][_0x427f('0x5b')]({'where':{'id':_0x22a0c7},'transaction':_0x15eb43})[_0x427f('0x14')](function(_0x3ba2c9){if(_0x3ba2c9){return db[_0x427f('0x3b')]['destroy']({'where':{'VoiceExtensionId':_0x22a0c7},'transaction':_0x15eb43})['then'](function(){var _0x58e9a5=_[_0x427f('0x1d')](_0x1f6083,function(_0x3ce2f8){_0x3ce2f8[_0x427f('0x5c')]=_0x22a0c7;_0x3ce2f8[_0x427f('0x5d')]=!![];return _0x3ce2f8;});return _0x3ba2c9[_0x427f('0x5e')](_0x58e9a5);})[_0x427f('0x14')](function(_0x19235f){return db[_0x427f('0x3b')][_0x427f('0x5f')](_0x19235f,{'transaction':_0x15eb43});});}else{_0x556d5d=0x194;_0x4791e8=[];}});})['then'](function(){if(_0x556d5d!==0x194){return db[_0x427f('0x3b')][_0x427f('0x60')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22a0c7},'order':_0x427f('0x61')})[_0x427f('0x14')](function(_0x14cbce){_0x4791e8=_0x14cbce;});}})[_0x427f('0x41')](function(_0x4037d6){_0x556d5d=0x1f4;logger[_0x427f('0x23')](_0x4037d6[_0x427f('0x24')]);if(_0x4037d6[_0x427f('0x20')]){delete _0x4037d6[_0x427f('0x20')];}_0x4791e8=_0x4037d6;})[_0x427f('0x62')](function(){if(_0x4791e8===null){_0x5184b5[_0x427f('0xb')](_0x556d5d);}else{if(_0x556d5d===0x1f4){_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0x25')](_0x4791e8);}else{_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0xe')](_0x4791e8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ede1201..9876058 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 _0xfde2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfde2,0x164));var _0x2fde=function(_0x1998bb,_0x1f1da1){_0x1998bb=_0x1998bb-0x0;var _0x4ae4c9=_0xfde2[_0x1998bb];return _0x4ae4c9;};'use strict';var EventEmitter=require(_0x2fde('0x0'));var VoiceExtension=require(_0x2fde('0x1'))['db'][_0x2fde('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2fde('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2fde('0x4'),'afterDestroy':_0x2fde('0x5')};function emitEvent(_0x257843){return function(_0x5dcfc8,_0x20a4b5,_0x37bfaf){VoiceExtensionEvents[_0x2fde('0x6')](_0x257843+':'+_0x5dcfc8['id'],_0x5dcfc8);VoiceExtensionEvents['emit'](_0x257843,_0x5dcfc8);_0x37bfaf(null);};}for(var e in events){if(events[_0x2fde('0x7')](e)){var event=events[e];VoiceExtension[_0x2fde('0x8')](e,emitEvent(event));}}module[_0x2fde('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3026=['../../mysqldb','VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2b89e3,_0x4a8c51){var _0x54119a=function(_0x2ea97a){while(--_0x2ea97a){_0x2b89e3['push'](_0x2b89e3['shift']());}};_0x54119a(++_0x4a8c51);}(_0x3026,0xa8));var _0x6302=function(_0x3fac8e,_0x1e2634){_0x3fac8e=_0x3fac8e-0x0;var _0x21fcd9=_0x3026[_0x3fac8e];return _0x21fcd9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6302('0x0'))['db'][_0x6302('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6302('0x2')](0x0);var events={'afterCreate':_0x6302('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc0c1bd){return function(_0x1b3fe6,_0x4a786e,_0x553365){VoiceExtensionEvents[_0x6302('0x4')](_0xc0c1bd+':'+_0x1b3fe6['id'],_0x1b3fe6);VoiceExtensionEvents[_0x6302('0x4')](_0xc0c1bd,_0x1b3fe6);_0x553365(null);};}for(var e in events){if(events[_0x6302('0x5')](e)){var event=events[e];VoiceExtension[_0x6302('0x6')](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 c0df1b7..a870e19 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 _0xaee4=['define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','exten','inbound','context','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','length','name','trunk','param','prefix','phone','${EXTEN:','join','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','outboundDial','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xaee4,0xda));var _0x4aee=function(_0x16e173,_0x2f3704){_0x16e173=_0x16e173-0x0;var _0x357395=_0xaee4[_0x16e173];return _0x357395;};'use strict';var _=require('lodash');var attributes=require(_0x4aee('0x0'));module[_0x4aee('0x1')]=function(_0x139716){var _0x579d0f=_0x139716[_0x4aee('0x2')];function _0x5a2772(_0x3bbc5a){var _0x1bb33e=0x2;var _0x3c00cc=[{'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':'CDR(type)='+_0x3bbc5a[_0x4aee('0x3')],'context':_0x3bbc5a['context'],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']}];if(_0x3bbc5a[_0x4aee('0x3')]==='inbound'){_0x3c00cc['push']({'type':_0x4aee('0x6'),'app':_0x4aee('0x4'),'appdata':'CDR(routeid)='+_0x3bbc5a['id'],'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a['exten'],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']});}_0x3c00cc['push']({'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':_0x4aee('0x8'),'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a['exten'],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']},{'type':_0x3bbc5a['type'],'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']},{'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':_0x4aee('0x9'),'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']});return _0x3c00cc;}function _0x421c5e(_0x40394b){var _0x5783e4=0x2;var _0x577b65=[{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xb'),'context':_0x40394b['context'],'exten':_0x40394b['exten'],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xc')+(_0x40394b[_0x4aee('0xd')]?'${EXTEN:'+_0x40394b['cutdigits']+'}':_0x4aee('0xe')),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xf')+_0x40394b['id'],'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':'ExecIf','appdata':_0x4aee('0x10')+(_0x5783e4+0x2)+_0x4aee('0x11')+(_0x5783e4+0x1)+')','context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b['exten'],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x40394b[_0x4aee('0xd')]?'CDR(prefix)=${EXTEN:0:'+_0x40394b[_0x4aee('0xd')]+'}':'CDR(prefix)=noprefix','context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x8'),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':_0x4aee('0x12')+_0x40394b['id'],'context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']}];if(_0x40394b[_0x4aee('0x13')](_0x4aee('0x14'))&&_0x40394b['recordingFormat']!==_0x4aee('0x15')){_0x577b65[_0x4aee('0x16')]({'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x17'),'context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':_0x4aee('0x18')+_0x40394b[_0x4aee('0x14')]||_0x4aee('0x19'),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']});}return _0x577b65;}function _0x4ef333(_0x556896,_0x483099){var _0x54ebbb=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x4aee('0x1a'),'param':0x2},{'name':_0x4aee('0x1b'),'param':0x3}];var _0x44dac7={};var _0x3fd5e3=_0x483099[_0x4aee('0x1c')](',');var _0xc5739d=[];for(var _0x1301e4=0x0;_0x1301e4<_0x54ebbb[_0x4aee('0x1d')];_0x1301e4++){switch(_0x54ebbb[_0x1301e4][_0x4aee('0x1e')]){case'trunk':_0x44dac7[_0x4aee('0x1f')]=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]['split']('/')[0x1];_0x44dac7['phone']=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]['split']('/')[0x2];_0x44dac7[_0x4aee('0x21')]=_0x44dac7[_0x4aee('0x22')]?_0x44dac7[_0x4aee('0x22')]['split']('$')[0x0]:undefined;_0x44dac7[_0x4aee('0x22')]=_0x556896[_0x4aee('0xd')]?(_0x44dac7[_0x4aee('0x21')]||'')+_0x4aee('0x23')+_0x556896[_0x4aee('0xd')]+'}':(_0x44dac7[_0x4aee('0x21')]||'')+'${EXTEN}';_0xc5739d[_0x54ebbb[_0x1301e4]['param']]=['SIP',_0x44dac7[_0x4aee('0x1f')],_0x44dac7[_0x4aee('0x22')]][_0x4aee('0x24')]('/');break;case _0x4aee('0x1a'):_0x44dac7[_0x4aee('0x1a')]=_0x3fd5e3[_0x54ebbb[_0x1301e4]['param']];if(_0x556896[_0x4aee('0x14')]!==_0x4aee('0x15')){if(_0x44dac7['options']['indexOf'](_0x4aee('0x25'))<0x0){_0x44dac7[_0x4aee('0x1a')]+=_0x4aee('0x25');}}else{_0x44dac7['options']=_0x44dac7['options']['replace'](_0x4aee('0x25'),'');}_0xc5739d[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]=_0x44dac7[_0x4aee('0x1a')];break;default:_0xc5739d[_0x54ebbb[_0x1301e4]['param']]=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]];}}return _0xc5739d[_0x4aee('0x24')](',');}function _0x131de6(_0x4e863d,_0x55bd8e,_0x452a9c){return new Promise(function(_0x477b85,_0x2bea70){var _0x513bb9=[];if(_['isEmpty'](_0x55bd8e))return _0x477b85(_0x513bb9);_0x579d0f[_0x4aee('0x26')][_0x4aee('0x27')]({'attributes':['id',_0x4aee('0x28'),_0x4aee('0x29')],'raw':!![]})[_0x4aee('0x2a')](function(_0x364fb2){for(var _0x2b8f08=0x0,_0x431cfc=0x0;_0x2b8f08<_0x55bd8e[_0x4aee('0x1d')];_0x2b8f08++,_0x431cfc=0x0){var _0x3076d6=_0x55bd8e[_0x2b8f08];var _0x35a6e6=[];var _0x1c077d=[];delete _0x3076d6['id'];if(_0x3076d6[_0x4aee('0x28')]!==_0x4aee('0x2b')){_0x3076d6[_0x4aee('0x2c')]=[_0x3076d6['interval']];}else{_0x3076d6['intervals']=_0x3076d6['IntervalId']?_['map'](_['filter'](_0x364fb2,{'IntervalId':_0x3076d6[_0x4aee('0x29')]}),'interval'):[];}_0x3076d6['context']=_0x4e863d[_0x4aee('0x7')];_0x3076d6[_0x4aee('0x5')]=_0x4e863d['exten'];if(_0x3076d6['type'])_0x3076d6[_0x4aee('0x3')]=_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')]();if(_0x4e863d[_0x4aee('0x3')]===_0x4aee('0xa')){if(_0x3076d6['hasOwnProperty'](_0x4aee('0x2e'))&&_0x3076d6[_0x4aee('0x2e')]&&_0x3076d6[_0x4aee('0x2e')]!=='--'){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x2f')+_0x3076d6['tag'],'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d[_0x4aee('0x5')],'priority':_0x3076d6['intervals'][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6['type'][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x31')+(_0x3076d6[_0x4aee('0x32')]?_0x4aee('0x33')+_0x3076d6[_0x4aee('0x32')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4e863d['context'],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')]['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}else{if(_0x3076d6[_0x4aee('0x13')](_0x4aee('0x34'))){if(['queue',_0x4aee('0x35')][_0x4aee('0x36')](_0x3076d6[_0x4aee('0x37')][_0x4aee('0x2d')]())&&_0x3076d6[_0x4aee('0x38')]!=='custom'){if(_0x3076d6[_0x4aee('0x34')]){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x39'),'context':_0x4e863d['context'],'exten':_0x4e863d[_0x4aee('0x5')],'priority':_0x3076d6[_0x4aee('0x2c')]['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});_0x35a6e6['push']({'type':_0x3076d6['type'][_0x4aee('0x2d')](),'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4e863d['context'],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}else{_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x3a'),'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6['intervals']['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});_0x35a6e6['push']({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}}}}for(var _0x3b07ef=0x0;_0x3b07ef<_0x3076d6[_0x4aee('0x2c')]['length'];_0x3b07ef++){var _0x2e99cf=_0x452a9c+_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')];var _0x33bf88=_0x3b07ef===_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]-0x1?_0x452a9c+_0x35a6e6['length']+_0x1c077d[_0x4aee('0x1d')]+0x2:_0x452a9c+_0x3b07ef+0x1;_0x35a6e6['splice'](_0x3b07ef,0x0,{'type':_0x4e863d[_0x4aee('0x3')],'app':'GotoIfTime','appdata':_0x3076d6[_0x4aee('0x2c')][_0x3b07ef]+'?'+_0x4e863d[_0x4aee('0x7')]+_0x4aee('0x3b')+_0x2e99cf+':'+_0x4e863d[_0x4aee('0x7')]+',${EXTEN},'+_0x33bf88,'exten':_0x4e863d[_0x4aee('0x5')],'context':_0x4e863d[_0x4aee('0x7')],'priority':_0x452a9c+_0x3b07ef,'VoiceExtensionId':_0x4e863d['id']});}if(_0x3076d6['appType']===_0x4aee('0x3c')){_0x3076d6['appdata']=_0x4ef333(_0x4e863d,_0x3076d6['appdata']);}if(_0x3076d6['appType']==='agi'){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6['type']['toLowerCase'](),'app':'Set','appdata':_0x4aee('0x3d'),'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}_0x3076d6['priority']=_0x35a6e6['length']?_[_0x4aee('0x3e')](_0x35a6e6)[_0x4aee('0x3f')]+0x1:_0x452a9c;_0x513bb9=_[_0x4aee('0x40')](_0x513bb9,_0x35a6e6,[_0x3076d6],_0x1c077d);_0x452a9c=_[_0x4aee('0x3e')](_0x513bb9)[_0x4aee('0x3f')]+0x1;}return _0x477b85(_0x513bb9);})[_0x4aee('0x41')](function(_0x205d3b){_0x2bea70(_0x205d3b);});});}return _0x139716[_0x4aee('0x42')](_0x4aee('0x43'),attributes,{'tableName':_0x4aee('0x44'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4ddfa9){var _0x5cbf69=this[_0x4aee('0x45')]({'plain':!![]});var _0x2b114e=_0x5cbf69['type']===_0x4aee('0xa')?_0x421c5e(_0x5cbf69):_0x5a2772(_0x5cbf69);return _0x131de6(_0x5cbf69,_0x4ddfa9,_[_0x4aee('0x3e')](_0x2b114e)[_0x4aee('0x3f')]+0x1)['then'](function(_0x2b8879){var _0x380165=_[_0x4aee('0x40')](_0x2b114e,_0x2b8879);_0x380165[_0x4aee('0x16')]({'type':_0x5cbf69['type'],'app':_0x4aee('0x46'),'exten':_0x5cbf69['exten'],'context':_0x5cbf69[_0x4aee('0x7')],'priority':_[_0x4aee('0x3e')](_0x380165)['priority']+0x1,'VoiceExtensionId':_0x5cbf69['id']});return _0x380165;});}}});}; \ No newline at end of file +var _0x3a3b=['interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','appType','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','split','phone','param','prefix','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)'];(function(_0x2eb162,_0x495823){var _0x1a4ad9=function(_0x39aa10){while(--_0x39aa10){_0x2eb162['push'](_0x2eb162['shift']());}};_0x1a4ad9(++_0x495823);}(_0x3a3b,0x110));var _0xb3a3=function(_0x49ae3d,_0x45727a){_0x49ae3d=_0x49ae3d-0x0;var _0x172d78=_0x3a3b[_0x49ae3d];return _0x172d78;};'use strict';var _=require(_0xb3a3('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xb3a3('0x1')]=function(_0x1012c1){var _0x26b03e=_0x1012c1[_0xb3a3('0x2')];function _0x409904(_0x554b2c){var _0x2e64f7=0x2;var _0x273460=[{'type':_0x554b2c[_0xb3a3('0x3')],'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x5')+_0x554b2c[_0xb3a3('0x3')],'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']}];if(_0x554b2c[_0xb3a3('0x3')]===_0xb3a3('0x8')){_0x273460[_0xb3a3('0x9')]({'type':_0xb3a3('0x8'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xa')+_0x554b2c['id'],'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']});}_0x273460['push']({'type':_0x554b2c[_0xb3a3('0x3')],'app':'Set','appdata':_0xb3a3('0xb'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']},{'type':_0x554b2c[_0xb3a3('0x3')],'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xc'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']},{'type':_0x554b2c[_0xb3a3('0x3')],'app':'Set','appdata':_0xb3a3('0xd'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']});return _0x273460;}function _0x44d8c0(_0x5a83a5){var _0x1cda3c=0x2;var _0x4afe52=[{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xf'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':'Set','appdata':_0xb3a3('0x10')+(_0x5a83a5[_0xb3a3('0x11')]?_0xb3a3('0x12')+_0x5a83a5[_0xb3a3('0x11')]+'}':_0xb3a3('0x13')),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xa')+_0x5a83a5['id'],'context':_0x5a83a5['context'],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1cda3c+0x2)+_0xb3a3('0x15')+(_0x1cda3c+0x1)+')','context':_0x5a83a5['context'],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':'Set','appdata':_0x5a83a5[_0xb3a3('0x11')]?_0xb3a3('0x16')+_0x5a83a5[_0xb3a3('0x11')]+'}':_0xb3a3('0x17'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':'outbound','app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xb'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xd'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x18')+_0x5a83a5['id'],'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']}];if(_0x5a83a5['hasOwnProperty'](_0xb3a3('0x19'))&&_0x5a83a5['recordingFormat']!==_0xb3a3('0x1a')){_0x4afe52['push']({'type':'outbound','app':'Set','appdata':_0xb3a3('0x1b'),'context':_0x5a83a5['context'],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':'outbound','app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x1c')+_0x5a83a5[_0xb3a3('0x19')]||_0xb3a3('0x1d'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']});}return _0x4afe52;}function _0x1c04aa(_0x4fc968,_0x173691){var _0x39fdcd=[{'name':_0xb3a3('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xb3a3('0x1f'),'param':0x2},{'name':_0xb3a3('0x20'),'param':0x3}];var _0x26abcf={};var _0x4f59dd=_0x173691['split'](',');var _0x2b863f=[];for(var _0x573f0e=0x0;_0x573f0e<_0x39fdcd[_0xb3a3('0x21')];_0x573f0e++){switch(_0x39fdcd[_0x573f0e][_0xb3a3('0x22')]){case'trunk':_0x26abcf['trunk']=_0x4f59dd[_0x39fdcd[_0x573f0e]['param']][_0xb3a3('0x23')]('/')[0x1];_0x26abcf[_0xb3a3('0x24')]=_0x4f59dd[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]['split']('/')[0x2];_0x26abcf[_0xb3a3('0x26')]=_0x26abcf[_0xb3a3('0x24')]?_0x26abcf[_0xb3a3('0x24')][_0xb3a3('0x23')]('$')[0x0]:undefined;_0x26abcf[_0xb3a3('0x24')]=_0x4fc968['cutdigits']?(_0x26abcf[_0xb3a3('0x26')]||'')+_0xb3a3('0x12')+_0x4fc968[_0xb3a3('0x11')]+'}':(_0x26abcf[_0xb3a3('0x26')]||'')+_0xb3a3('0x13');_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=[_0xb3a3('0x27'),_0x26abcf[_0xb3a3('0x1e')],_0x26abcf[_0xb3a3('0x24')]][_0xb3a3('0x28')]('/');break;case'options':_0x26abcf[_0xb3a3('0x1f')]=_0x4f59dd[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]];if(_0x4fc968[_0xb3a3('0x19')]!==_0xb3a3('0x1a')){if(_0x26abcf[_0xb3a3('0x1f')][_0xb3a3('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x26abcf[_0xb3a3('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x26abcf['options']=_0x26abcf[_0xb3a3('0x1f')][_0xb3a3('0x2a')](_0xb3a3('0x2b'),'');}_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=_0x26abcf['options'];break;default:_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=_0x4f59dd[_0x39fdcd[_0x573f0e]['param']];}}return _0x2b863f[_0xb3a3('0x28')](',');}function _0x514602(_0x429adb,_0x44fe63,_0x4ed801){return new Promise(function(_0x78fc5e,_0x290c52){var _0x1e553c=[];if(_['isEmpty'](_0x44fe63))return _0x78fc5e(_0x1e553c);_0x26b03e['Interval']['findAll']({'attributes':['id',_0xb3a3('0x2c'),_0xb3a3('0x2d')],'raw':!![]})[_0xb3a3('0x2e')](function(_0x10149a){for(var _0x1a776d=0x0,_0xc9d2f4=0x0;_0x1a776d<_0x44fe63[_0xb3a3('0x21')];_0x1a776d++,_0xc9d2f4=0x0){var _0x39d882=_0x44fe63[_0x1a776d];var _0x258b98=[];var _0x1b8fbb=[];delete _0x39d882['id'];if(_0x39d882['interval']!=='*,*,*,*'){_0x39d882[_0xb3a3('0x2f')]=[_0x39d882[_0xb3a3('0x2c')]];}else{_0x39d882[_0xb3a3('0x2f')]=_0x39d882[_0xb3a3('0x2d')]?_[_0xb3a3('0x30')](_[_0xb3a3('0x31')](_0x10149a,{'IntervalId':_0x39d882[_0xb3a3('0x2d')]}),_0xb3a3('0x2c')):[];}_0x39d882['context']=_0x429adb[_0xb3a3('0x6')];_0x39d882[_0xb3a3('0x7')]=_0x429adb[_0xb3a3('0x7')];if(_0x39d882[_0xb3a3('0x3')])_0x39d882[_0xb3a3('0x3')]=_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')]();if(_0x429adb[_0xb3a3('0x3')]===_0xb3a3('0xe')){if(_0x39d882[_0xb3a3('0x33')](_0xb3a3('0x34'))&&_0x39d882[_0xb3a3('0x34')]&&_0x39d882[_0xb3a3('0x34')]!=='--'){_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882['type']['toLowerCase'](),'app':_0xb3a3('0x4'),'appdata':'CDR(tag)='+_0x39d882[_0xb3a3('0x34')],'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}_0x258b98['push']({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':_0xb3a3('0x35')+(_0x39d882[_0xb3a3('0x36')]?_0xb3a3('0x37')+_0x39d882['callerID']+')':_0xb3a3('0x38')),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}else{if(_0x39d882[_0xb3a3('0x33')]('answer')){if(['queue',_0xb3a3('0x39')][_0xb3a3('0x3a')](_0x39d882[_0xb3a3('0x3b')][_0xb3a3('0x32')]())&&_0x39d882[_0xb3a3('0x3c')]!=='custom'){if(_0x39d882[_0xb3a3('0x3d')]){_0x258b98['push']({'type':_0x39d882['type'][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb['exten'],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':'Set','appdata':_0xb3a3('0x3e'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb['exten'],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}else{_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':_0xb3a3('0x3f'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});_0x258b98['push']({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x40'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')]['length']+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}}}}for(var _0xc4c746=0x0;_0xc4c746<_0x39d882[_0xb3a3('0x2f')]['length'];_0xc4c746++){var _0x8d3864=_0x4ed801+_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')];var _0x3dfcb4=_0xc4c746===_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]-0x1?_0x4ed801+_0x258b98[_0xb3a3('0x21')]+_0x1b8fbb['length']+0x2:_0x4ed801+_0xc4c746+0x1;_0x258b98[_0xb3a3('0x41')](_0xc4c746,0x0,{'type':_0x429adb[_0xb3a3('0x3')],'app':_0xb3a3('0x42'),'appdata':_0x39d882['intervals'][_0xc4c746]+'?'+_0x429adb[_0xb3a3('0x6')]+_0xb3a3('0x43')+_0x8d3864+':'+_0x429adb[_0xb3a3('0x6')]+_0xb3a3('0x43')+_0x3dfcb4,'exten':_0x429adb[_0xb3a3('0x7')],'context':_0x429adb[_0xb3a3('0x6')],'priority':_0x4ed801+_0xc4c746,'VoiceExtensionId':_0x429adb['id']});}if(_0x39d882[_0xb3a3('0x3c')]===_0xb3a3('0x44')){_0x39d882[_0xb3a3('0x45')]=_0x1c04aa(_0x429adb,_0x39d882['appdata']);}if(_0x39d882[_0xb3a3('0x3c')]==='agi'){_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x429adb['context'],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}_0x39d882[_0xb3a3('0x46')]=_0x258b98['length']?_[_0xb3a3('0x47')](_0x258b98)[_0xb3a3('0x46')]+0x1:_0x4ed801;_0x1e553c=_[_0xb3a3('0x48')](_0x1e553c,_0x258b98,[_0x39d882],_0x1b8fbb);_0x4ed801=_[_0xb3a3('0x47')](_0x1e553c)['priority']+0x1;}return _0x78fc5e(_0x1e553c);})[_0xb3a3('0x49')](function(_0x2167bc){_0x290c52(_0x2167bc);});});}return _0x1012c1[_0xb3a3('0x4a')](_0xb3a3('0x4b'),attributes,{'tableName':_0xb3a3('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x24b3b3){var _0x195e86=this[_0xb3a3('0x4d')]({'plain':!![]});var _0x30ec82=_0x195e86[_0xb3a3('0x3')]===_0xb3a3('0xe')?_0x44d8c0(_0x195e86):_0x409904(_0x195e86);return _0x514602(_0x195e86,_0x24b3b3,_[_0xb3a3('0x47')](_0x30ec82)['priority']+0x1)[_0xb3a3('0x2e')](function(_0x56427a){var _0xc1c8ce=_[_0xb3a3('0x48')](_0x30ec82,_0x56427a);_0xc1c8ce[_0xb3a3('0x9')]({'type':_0x195e86[_0xb3a3('0x3')],'app':_0xb3a3('0x4e'),'exten':_0x195e86[_0xb3a3('0x7')],'context':_0x195e86[_0xb3a3('0x6')],'priority':_[_0xb3a3('0x47')](_0xc1c8ce)[_0xb3a3('0x46')]+0x1,'VoiceExtensionId':_0x195e86['id']});return _0xc1c8ce;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5c0fa34..03bbcff 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 _0x15c6=['attributes','map','model','GetVoiceExtension','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','options','raw','limit','include'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0x15c6,0x1cd));var _0x615c=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x15c6[_0x40822a];return _0x357420;};'use strict';var _=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var moment=require(_0x615c('0x2'));var BPromise=require(_0x615c('0x3'));var rs=require(_0x615c('0x4'));var fs=require('fs');var Redis=require(_0x615c('0x5'));var db=require(_0x615c('0x6'))['db'];var utils=require(_0x615c('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x615c('0x8'));var client=jayson[_0x615c('0x9')][_0x615c('0xa')]({'port':0x232a});config['redis']=_[_0x615c('0xb')](config[_0x615c('0xc')],{'host':_0x615c('0xd'),'port':0x18eb});var socket=require(_0x615c('0xe'))(new Redis(config['redis']));require(_0x615c('0xf'))['register'](socket);function respondWithRpcPromise(_0x3df139,_0x19f033,_0x2af037){return new BPromise(function(_0x8f4a1e,_0x51f114){return client['request'](_0x3df139,_0x2af037)[_0x615c('0x10')](function(_0x286731){logger[_0x615c('0x11')](_0x615c('0x12'),_0x19f033,'request\x20sent');logger['debug'](_0x615c('0x13'),_0x19f033,_0x615c('0x14'),JSON['stringify'](_0x286731));if(_0x286731[_0x615c('0x15')]){if(_0x286731['error']['code']===0x1f4){logger[_0x615c('0x15')](_0x615c('0x12'),_0x19f033,_0x286731[_0x615c('0x15')][_0x615c('0x16')]);return _0x51f114(_0x286731[_0x615c('0x15')][_0x615c('0x16')]);}logger['error'](_0x615c('0x12'),_0x19f033,_0x286731[_0x615c('0x15')][_0x615c('0x16')]);return _0x8f4a1e(_0x286731['error'][_0x615c('0x16')]);}else{logger[_0x615c('0x11')](_0x615c('0x12'),_0x19f033,_0x615c('0x14'));_0x8f4a1e(_0x286731[_0x615c('0x17')][_0x615c('0x16')]);}})[_0x615c('0x18')](function(_0x341344){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x19f033,_0x341344);_0x51f114(_0x341344);});});}exports['GetVoiceExtension']=function(_0x2cbe15){var _0x1179a3=this;return new Promise(function(_0x348280,_0x146c58){return db['VoiceExtension']['findAll']({'raw':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15['options'][_0x615c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cbe15['options']?_0x2cbe15[_0x615c('0x19')]['where']||null:null,'attributes':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15[_0x615c('0x19')]['attributes']||null:null,'limit':_0x2cbe15['options']?_0x2cbe15[_0x615c('0x19')][_0x615c('0x1b')]||null:null,'include':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15[_0x615c('0x19')][_0x615c('0x1c')]?_['map'](_0x2cbe15[_0x615c('0x19')][_0x615c('0x1c')],function(_0x5968aa){return{'model':db[_0x5968aa['model']],'as':_0x5968aa['as'],'attributes':_0x5968aa[_0x615c('0x1d')],'include':_0x5968aa[_0x615c('0x1c')]?_[_0x615c('0x1e')](_0x5968aa['include'],function(_0x32ce76){return{'model':db[_0x32ce76[_0x615c('0x1f')]],'as':_0x32ce76['as'],'attributes':_0x32ce76[_0x615c('0x1d')],'include':_0x32ce76[_0x615c('0x1c')]?_['map'](_0x32ce76[_0x615c('0x1c')],function(_0x174259){return{'model':db[_0x174259[_0x615c('0x1f')]],'as':_0x174259['as'],'attributes':_0x174259[_0x615c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x615c('0x10')](function(_0x266e46){logger[_0x615c('0x11')](_0x615c('0x20'),_0x2cbe15);logger[_0x615c('0x21')](_0x615c('0x20'),_0x2cbe15,JSON[_0x615c('0x22')](_0x266e46));_0x348280(_0x266e46);})[_0x615c('0x18')](function(_0x391211){logger[_0x615c('0x15')]('GetVoiceExtension',_0x391211[_0x615c('0x16')],_0x2cbe15);_0x146c58(_0x1179a3[_0x615c('0x15')](0x1f4,_0x391211[_0x615c('0x16')]));});});}; \ No newline at end of file +var _0x9fc5=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','limit','include','map','attributes','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x4e444b,_0x193e6b){var _0x38d910=function(_0x44f762){while(--_0x44f762){_0x4e444b['push'](_0x4e444b['shift']());}};_0x38d910(++_0x193e6b);}(_0x9fc5,0xb6));var _0x59fc=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x9fc5[_0x404cde];return _0x139882;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var moment=require(_0x59fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x59fc('0x2'));var fs=require('fs');var Redis=require(_0x59fc('0x3'));var db=require(_0x59fc('0x4'))['db'];var utils=require(_0x59fc('0x5'));var logger=require(_0x59fc('0x6'))(_0x59fc('0x7'));var config=require(_0x59fc('0x8'));var jayson=require(_0x59fc('0x9'));var client=jayson['client'][_0x59fc('0xa')]({'port':0x232a});config[_0x59fc('0xb')]=_[_0x59fc('0xc')](config['redis'],{'host':_0x59fc('0xd'),'port':0x18eb});var socket=require(_0x59fc('0xe'))(new Redis(config[_0x59fc('0xb')]));require(_0x59fc('0xf'))[_0x59fc('0x10')](socket);function respondWithRpcPromise(_0x212ec8,_0x2556f8,_0x4afc93){return new BPromise(function(_0x2de019,_0x33364e){return client[_0x59fc('0x11')](_0x212ec8,_0x4afc93)[_0x59fc('0x12')](function(_0x29e599){logger[_0x59fc('0x13')](_0x59fc('0x14'),_0x2556f8,'request\x20sent');logger[_0x59fc('0x15')](_0x59fc('0x16'),_0x2556f8,_0x59fc('0x17'),JSON[_0x59fc('0x18')](_0x29e599));if(_0x29e599[_0x59fc('0x19')]){if(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1a')]===0x1f4){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x33364e(_0x29e599['error'][_0x59fc('0x1b')]);}logger[_0x59fc('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x2de019(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);}else{logger[_0x59fc('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2556f8,_0x59fc('0x17'));_0x2de019(_0x29e599[_0x59fc('0x1c')][_0x59fc('0x1b')]);}})[_0x59fc('0x1d')](function(_0x395ede){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x395ede);_0x33364e(_0x395ede);});});}exports[_0x59fc('0x1e')]=function(_0x58a0bb){var _0x153c58=this;return new Promise(function(_0x530c11,_0xdcfddb){return db['VoiceExtension'][_0x59fc('0x1f')]({'raw':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x21')]===undefined?!![]:![]:!![],'where':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')]['where']||null:null,'attributes':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')]['attributes']||null:null,'limit':_0x58a0bb['options']?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x22')]||null:null,'include':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x23')]?_[_0x59fc('0x24')](_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x23')],function(_0x1bfbe0){return{'model':db[_0x1bfbe0['model']],'as':_0x1bfbe0['as'],'attributes':_0x1bfbe0[_0x59fc('0x25')],'include':_0x1bfbe0['include']?_[_0x59fc('0x24')](_0x1bfbe0['include'],function(_0x2b9e06){return{'model':db[_0x2b9e06[_0x59fc('0x26')]],'as':_0x2b9e06['as'],'attributes':_0x2b9e06['attributes'],'include':_0x2b9e06[_0x59fc('0x23')]?_[_0x59fc('0x24')](_0x2b9e06['include'],function(_0x1304ae){return{'model':db[_0x1304ae[_0x59fc('0x26')]],'as':_0x1304ae['as'],'attributes':_0x1304ae[_0x59fc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x59fc('0x12')](function(_0x252fa4){logger['info'](_0x59fc('0x1e'),_0x58a0bb);logger[_0x59fc('0x15')](_0x59fc('0x1e'),_0x58a0bb,JSON['stringify'](_0x252fa4));_0x530c11(_0x252fa4);})[_0x59fc('0x1d')](function(_0x1dd1a1){logger[_0x59fc('0x19')](_0x59fc('0x1e'),_0x1dd1a1[_0x59fc('0x1b')],_0x58a0bb);_0xdcfddb(_0x153c58[_0x59fc('0x19')](0x1f4,_0x1dd1a1[_0x59fc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 37f1d0b..839218c 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x3ac893,_0x462309){var _0x5dbec2=function(_0x36627d){while(--_0x36627d){_0x3ac893['push'](_0x3ac893['shift']());}};_0x5dbec2(++_0x462309);}(_0xf494,0x1c6));var _0x4f49=function(_0xce9363,_0x58cd6b){_0xce9363=_0xce9363-0x0;var _0x529f99=_0xf494[_0xce9363];return _0x529f99;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x363974,_0x34a5ef){var _0x524fdc=function(_0x6477af){while(--_0x6477af){_0x363974['push'](_0x363974['shift']());}};_0x524fdc(++_0x34a5ef);}(_0x2ef3,0xba));var _0x32ef=function(_0xe56e4a,_0x521cce){_0xe56e4a=_0xe56e4a-0x0;var _0x260672=_0x2ef3[_0xe56e4a];return _0x260672;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d4296db..c51fb6c 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 _0xfdbd=['get','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','show'];(function(_0xaa6625,_0x4ef31d){var _0xfd8be4=function(_0x4f3d20){while(--_0x4f3d20){_0xaa6625['push'](_0xaa6625['shift']());}};_0xfd8be4(++_0x4ef31d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xfdbd[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id/messages',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')]('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')](_0xdfdb('0x12'),auth['isAuthenticated'](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x15')]);module[_0xdfdb('0x16')]=router; \ No newline at end of file +var _0x27a0=['exports','util','path','connect-timeout','express','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x27a0,0xbf));var _0x027a=function(_0x12236a,_0x403ece){_0x12236a=_0x12236a-0x0;var _0x155ca4=_0x27a0[_0x12236a];return _0x155ca4;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0xe')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0xf')]);router[_0x027a('0x10')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0x11')]);module[_0x027a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 956bbfb..a20cc48 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 _0xb47b=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb47b,0x1e5));var _0xbb47=function(_0x2867e5,_0x8c540c){_0x2867e5=_0x2867e5-0x0;var _0x12a39f=_0xb47b[_0x2867e5];return _0x12a39f;};'use strict';var Sequelize=require(_0xbb47('0x0'));module[_0xbb47('0x1')]={'customer_id':{'type':Sequelize[_0xbb47('0x2')]},'context':{'type':Sequelize[_0xbb47('0x2')],'defaultValue':_0xbb47('0x3'),'unique':_0xbb47('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xbb47('0x4')},'password':{'type':Sequelize[_0xbb47('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbb47('0x2')],'validate':{'isEmail':!![]},'set':function(_0x292ba9){this[_0xbb47('0x5')](_0xbb47('0x6'),typeof _0x292ba9===_0xbb47('0x7')&&_0x292ba9[_0xbb47('0x8')]()?_0x292ba9[_0xbb47('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xbb47('0x9')},'attach':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbb47('0x2')]},'callback':{'type':Sequelize[_0xbb47('0x2')]},'review':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb47('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb47('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'stamp':{'type':_0xbb47('0xd')},'emailsubject':{'type':Sequelize[_0xbb47('0x2')]},'emailbody':{'type':Sequelize[_0xbb47('0x2')]},'maxsecs':{'type':Sequelize[_0xbb47('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb47('0xf')],'get':function(){return this[_0xbb47('0x10')](_0xbb47('0x11'))+'\x20-\x20'+this[_0xbb47('0x10')](_0xbb47('0x12'));}}}; \ No newline at end of file +var _0x04f3=['yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x04f3,0xf5));var _0x304f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x04f3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x304f('0x0'));module[_0x304f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x304f('0x2')],'defaultValue':_0x304f('0x3'),'unique':_0x304f('0x4')},'mailbox':{'type':Sequelize[_0x304f('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x304f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5d9cb0){this[_0x304f('0x5')](_0x304f('0x6'),typeof _0x5d9cb0===_0x304f('0x7')&&_0x5d9cb0['trim']()?_0x5d9cb0[_0x304f('0x8')]():null);}},'pager':{'type':Sequelize[_0x304f('0x2')]},'tz':{'type':Sequelize[_0x304f('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x304f('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'stamp':{'type':_0x304f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x304f('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x304f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x304f('0xd')],'get':function(){return this['getDataValue'](_0x304f('0xe'))+_0x304f('0xf')+this[_0x304f('0x10')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2bb30a4..217e511 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 _0x4024=['limit','count','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5f4c37,_0x46f099){var _0x2f2d4a=function(_0x2d7f79){while(--_0x2d7f79){_0x5f4c37['push'](_0x5f4c37['shift']());}};_0x2f2d4a(++_0x46f099);}(_0x4024,0x89));var _0x4402=function(_0x263487,_0x3fc21c){_0x263487=_0x263487-0x0;var _0x246e76=_0x4024[_0x263487];return _0x246e76;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){var _0x4d6846=_0x289a3e[_0x4402('0x21')]({'plain':!![]});var _0x4e1c04=_0x4402('0x22');return db[_0x4402('0x23')][_0x4402('0x20')]({'where':{'type':_0x4e1c04,'resourceId':_0x4d6846['id']}})[_0x4402('0x1f')](function(){return _0x289a3e;});})['then'](function(){_0x258d10[_0x4402('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d52f,_0x1be54d){return function(_0x395e49){if(!_0x395e49){_0x59d52f[_0x4402('0x13')](0x194);}return _0x395e49;};}function handleError(_0xabf61b,_0x3eb796){_0x3eb796=_0x3eb796||0x1f4;return function(_0x514e41){logger[_0x4402('0x24')](_0x514e41['stack']);if(_0x514e41[_0x4402('0x25')]){delete _0x514e41[_0x4402('0x25')];}_0xabf61b[_0x4402('0x14')](_0x3eb796)['send'](_0x514e41);};}exports[_0x4402('0x26')]=function(_0x6c87f6,_0x316239){var _0x3f4bcb={},_0x2526d1={},_0x605702={'count':0x0,'rows':[]};var _0x1189b8=_[_0x4402('0x27')](db[_0x4402('0x28')][_0x4402('0x29')],function(_0xcea26b){return{'name':_0xcea26b['fieldName'],'type':_0xcea26b[_0x4402('0x2a')]['key']};});_0x2526d1[_0x4402('0x2b')]=_['map'](_0x1189b8,_0x4402('0x25'));_0x2526d1[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x6c87f6[_0x4402('0x2c')]);_0x2526d1[_0x4402('0x2e')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],_0x2526d1[_0x4402('0x2c')]);_0x3f4bcb[_0x4402('0x2f')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x6c87f6['query'][_0x4402('0x30')]));_0x3f4bcb[_0x4402('0x2f')]=_0x3f4bcb[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f4bcb[_0x4402('0x2f')]:_0x2526d1[_0x4402('0x2b')];if(!_0x6c87f6[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3f4bcb['limit']=qs[_0x4402('0x19')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x19')]);_0x3f4bcb['offset']=qs[_0x4402('0x17')](_0x6c87f6[_0x4402('0x2c')]['offset']);}_0x3f4bcb['order']=qs[_0x4402('0x34')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x34')]);_0x3f4bcb[_0x4402('0x35')]=qs['filters'](_['pick'](_0x6c87f6['query'],_0x2526d1[_0x4402('0x2e')]),_0x1189b8);if(_0x6c87f6[_0x4402('0x2c')][_0x4402('0x36')]){_0x3f4bcb[_0x4402('0x35')]=_['merge'](_0x3f4bcb[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x1189b8,function(_0x35f877){if(_0x35f877['type']!==_0x4402('0x37')){var _0x5aca7b={};_0x5aca7b[_0x35f877[_0x4402('0x25')]]={'$like':'%'+_0x6c87f6[_0x4402('0x2c')]['filter']+'%'};return _0x5aca7b;}})});}_0x3f4bcb=_[_0x4402('0x38')]({},_0x3f4bcb,_0x6c87f6['options']);var _0x423628={'where':_0x3f4bcb[_0x4402('0x35')]};return db['VoiceMail'][_0x4402('0x1a')](_0x423628)[_0x4402('0x1f')](function(_0x250f09){_0x605702[_0x4402('0x1a')]=_0x250f09;if(_0x6c87f6['query']['includeAll']){_0x3f4bcb[_0x4402('0x39')]=[{'all':!![]}];}return db['VoiceMail'][_0x4402('0x3a')](_0x3f4bcb);})[_0x4402('0x1f')](function(_0xb9cf85){_0x605702[_0x4402('0x3b')]=_0xb9cf85;return _0x605702;})[_0x4402('0x1f')](respondWithFilteredResult(_0x316239,_0x3f4bcb))[_0x4402('0x3c')](handleError(_0x316239,null));};exports[_0x4402('0x3d')]=function(_0x390169,_0x1f9b3e){var _0x42812b={'raw':!![],'where':{'id':_0x390169[_0x4402('0x3e')]['id']}},_0x486e43={};_0x486e43[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x28')][_0x4402('0x29')]);_0x486e43['query']=_[_0x4402('0x2d')](_0x390169[_0x4402('0x2c')]);_0x486e43[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],_0x486e43['query']);_0x42812b[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x390169[_0x4402('0x2c')][_0x4402('0x30')]));_0x42812b[_0x4402('0x2f')]=_0x42812b[_0x4402('0x2f')][_0x4402('0x31')]?_0x42812b[_0x4402('0x2f')]:_0x486e43[_0x4402('0x2b')];if(_0x390169['query'][_0x4402('0x40')]){_0x42812b['include']=[{'all':!![]}];}_0x42812b=_[_0x4402('0x38')]({},_0x42812b,_0x390169[_0x4402('0x41')]);return db['VoiceMail'][_0x4402('0x42')](_0x42812b)[_0x4402('0x1f')](handleEntityNotFound(_0x1f9b3e,null))[_0x4402('0x1f')](respondWithResult(_0x1f9b3e,null))[_0x4402('0x3c')](handleError(_0x1f9b3e,null));};exports[_0x4402('0x43')]=function(_0x2503eb,_0x5b094b){return db[_0x4402('0x28')][_0x4402('0x43')](_0x2503eb[_0x4402('0x44')],{})[_0x4402('0x1f')](function(_0x2b2ed3){var _0x24d51c=_0x2503eb[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0x24d51c)throw new Error(_0x4402('0x46'));if(_0x24d51c['role']==='user'){var _0x5ab12b=_0x2b2ed3['get']({'plain':!![]});var _0x257010=_0x4402('0x22');return db[_0x4402('0x47')][_0x4402('0x42')]({'where':{'name':_0x257010,'userProfileId':_0x24d51c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x12d6de){if(_0x12d6de&&_0x12d6de[_0x4402('0x48')]===0x0){return db[_0x4402('0x23')][_0x4402('0x43')]({'name':_0x5ab12b[_0x4402('0x25')],'resourceId':_0x5ab12b['id'],'type':_0x12d6de[_0x4402('0x25')],'sectionId':_0x12d6de['id']},{})['then'](function(){return _0x2b2ed3;});}else{return _0x2b2ed3;}})[_0x4402('0x3c')](function(_0x2a8085){logger[_0x4402('0x24')](_0x4402('0x49'),_0x2a8085);throw _0x2a8085;});}return _0x2b2ed3;})[_0x4402('0x1f')](respondWithResult(_0x5b094b,0xc9))[_0x4402('0x3c')](handleError(_0x5b094b,null));};exports['update']=function(_0xe8a8e9,_0x642ab4){if(_0xe8a8e9[_0x4402('0x44')]['id']){delete _0xe8a8e9[_0x4402('0x44')]['id'];}return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0xe8a8e9[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x642ab4,null))['then'](saveUpdates(_0xe8a8e9[_0x4402('0x44')],null))[_0x4402('0x1f')](respondWithResult(_0x642ab4,null))[_0x4402('0x3c')](handleError(_0x642ab4,null));};exports['destroy']=function(_0x5a076a,_0x258926){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x5a076a[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x258926,null))[_0x4402('0x1f')](removeEntity(_0x258926,null))[_0x4402('0x3c')](handleError(_0x258926,null));};exports[_0x4402('0x4a')]=function(_0x394ac9,_0x3f2599,_0x353679){return db[_0x4402('0x28')][_0x4402('0x4b')]({'where':{'id':_0x394ac9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3f2599,null))['then'](function(_0xe4530a){var _0x55922e;var _0x3fb9f0={},_0x1e5891={};_0x1e5891[_0x4402('0x2b')]=_[_0x4402('0x2d')](db[_0x4402('0x4c')][_0x4402('0x29')]);_0x1e5891['query']=_[_0x4402('0x2d')](_0x394ac9[_0x4402('0x2c')]);_0x1e5891[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],_0x1e5891['query']);_0x3fb9f0[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x394ac9[_0x4402('0x2c')][_0x4402('0x30')]));_0x3fb9f0[_0x4402('0x2f')]=_0x3fb9f0[_0x4402('0x2f')]['length']?_0x3fb9f0[_0x4402('0x2f')]:_0x1e5891[_0x4402('0x2b')];if(!_0x394ac9['query'][_0x4402('0x32')](_0x4402('0x33'))){_0x3fb9f0['limit']=qs['limit'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x19')]);_0x3fb9f0[_0x4402('0x17')]=qs['offset'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x17')]);}_0x3fb9f0[_0x4402('0x4d')]=qs['sort'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x34')]);_0x3fb9f0[_0x4402('0x35')]=qs['filters'](_[_0x4402('0x4e')](_0x394ac9[_0x4402('0x2c')],_0x1e5891['filters']));if(_0x394ac9['query'][_0x4402('0x36')]){_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'$or':_['map'](_0x3fb9f0['attributes'],function(_0x432c2e){var _0x42cdd6={};_0x42cdd6[_0x432c2e]={'$like':'%'+_0x394ac9[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x42cdd6;})});}_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'mailboxuser':_0xe4530a[_0x4402('0x4f')]});_0x3fb9f0=_[_0x4402('0x38')]({},_0x3fb9f0,_0x394ac9[_0x4402('0x41')]);return db[_0x4402('0x4c')][_0x4402('0x50')](_0x3fb9f0)['then'](respondWithFilteredResult(_0x3f2599,_0x3fb9f0));})[_0x4402('0x3c')](handleError(_0x3f2599,null));}; \ No newline at end of file +var _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x1f78ad,_0x161e1e){var _0x2012d1=function(_0xd601fa){while(--_0xd601fa){_0x1f78ad['push'](_0x1f78ad['shift']());}};_0x2012d1(++_0x161e1e);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e32f09a..7ce45d8 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 _0x0343=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0343,0x1f4));var _0x3034=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0x0343[_0x3dd991];return _0x251609;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var logger=require(_0x3034('0x2'))(_0x3034('0x3'));var moment=require(_0x3034('0x4'));var BPromise=require(_0x3034('0x5'));var rp=require(_0x3034('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3034('0x7'));var config=require('../../config/environment');var attributes=require(_0x3034('0x8'));module[_0x3034('0x9')]=function(_0x4f2517,_0x617be1){return _0x4f2517[_0x3034('0xa')](_0x3034('0xb'),attributes,{'tableName':_0x3034('0xc'),'paranoid':![],'indexes':[{'name':_0x3034('0xd'),'fields':[_0x3034('0xe'),_0x3034('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22e0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','context','util','../../config/logger'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x22e0,0x178));var _0x022e=function(_0x1c2c84,_0x508d10){_0x1c2c84=_0x1c2c84-0x0;var _0x4d3105=_0x22e0[_0x1c2c84];return _0x4d3105;};'use strict';var _=require('lodash');var util=require(_0x022e('0x0'));var logger=require(_0x022e('0x1'))('api');var moment=require(_0x022e('0x2'));var BPromise=require(_0x022e('0x3'));var rp=require(_0x022e('0x4'));var fs=require('fs');var path=require(_0x022e('0x5'));var rimraf=require(_0x022e('0x6'));var config=require(_0x022e('0x7'));var attributes=require(_0x022e('0x8'));module[_0x022e('0x9')]=function(_0x4851aa,_0x3c1a1e){return _0x4851aa['define'](_0x022e('0xa'),attributes,{'tableName':_0x022e('0xb'),'paranoid':![],'indexes':[{'name':_0x022e('0xc'),'fields':['mailbox',_0x022e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index dcb1401..78461d3 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 _0x4da8=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x305a6e,_0x1f4a40){var _0xd23128=function(_0x230ce6){while(--_0x230ce6){_0x305a6e['push'](_0x305a6e['shift']());}};_0xd23128(++_0x1f4a40);}(_0x4da8,0xb1));var _0x84da=function(_0xcda9ea,_0x469a95){_0xcda9ea=_0xcda9ea-0x0;var _0x4a10db=_0x4da8[_0xcda9ea];return _0x4a10db;};'use strict';var _=require(_0x84da('0x0'));var util=require(_0x84da('0x1'));var moment=require(_0x84da('0x2'));var BPromise=require(_0x84da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84da('0x4'))['db'];var utils=require(_0x84da('0x5'));var logger=require('../../config/logger')(_0x84da('0x6'));var config=require(_0x84da('0x7'));var jayson=require(_0x84da('0x8'));var client=jayson[_0x84da('0x9')][_0x84da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x224acf,_0x304acf,_0x568f61){return new BPromise(function(_0x5ae13e,_0x3102b5){return client[_0x84da('0xb')](_0x224acf,_0x568f61)[_0x84da('0xc')](function(_0x41472c){logger['info'](_0x84da('0xd'),_0x304acf,'request\x20sent');logger['debug'](_0x84da('0xe'),_0x304acf,_0x84da('0xf'),JSON[_0x84da('0x10')](_0x41472c));if(_0x41472c[_0x84da('0x11')]){if(_0x41472c[_0x84da('0x11')][_0x84da('0x12')]===0x1f4){logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x41472c[_0x84da('0x11')][_0x84da('0x13')]);return _0x3102b5(_0x41472c[_0x84da('0x11')]['message']);}logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x41472c[_0x84da('0x11')][_0x84da('0x13')]);return _0x5ae13e(_0x41472c[_0x84da('0x11')]['message']);}else{logger[_0x84da('0x14')](_0x84da('0xd'),_0x304acf,_0x84da('0xf'));_0x5ae13e(_0x41472c[_0x84da('0x15')][_0x84da('0x13')]);}})['catch'](function(_0x2e75c4){logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x2e75c4);_0x3102b5(_0x2e75c4);});});} \ No newline at end of file +var _0xbc60=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xbc60,0x1b5));var _0x0bc6=function(_0x39e694,_0x1192c2){_0x39e694=_0x39e694-0x0;var _0x56c35f=_0xbc60[_0x39e694];return _0x56c35f;};'use strict';var _=require(_0x0bc6('0x0'));var util=require(_0x0bc6('0x1'));var moment=require(_0x0bc6('0x2'));var BPromise=require(_0x0bc6('0x3'));var rs=require(_0x0bc6('0x4'));var fs=require('fs');var Redis=require(_0x0bc6('0x5'));var db=require(_0x0bc6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0bc6('0x7'));var client=jayson[_0x0bc6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24eb81,_0x1f8a6c,_0x64163e){return new BPromise(function(_0x538256,_0xd38920){return client[_0x0bc6('0x9')](_0x24eb81,_0x64163e)[_0x0bc6('0xa')](function(_0x53337b){logger[_0x0bc6('0xb')](_0x0bc6('0xc'),_0x1f8a6c,_0x0bc6('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1f8a6c,'request\x20sent',JSON[_0x0bc6('0xe')](_0x53337b));if(_0x53337b['error']){if(_0x53337b['error']['code']===0x1f4){logger['error'](_0x0bc6('0xc'),_0x1f8a6c,_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);return _0xd38920(_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);}logger[_0x0bc6('0xf')](_0x0bc6('0xc'),_0x1f8a6c,_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);return _0x538256(_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);}else{logger['info'](_0x0bc6('0xc'),_0x1f8a6c,_0x0bc6('0xd'));_0x538256(_0x53337b[_0x0bc6('0x11')]['message']);}})[_0x0bc6('0x12')](function(_0x489ba0){logger[_0x0bc6('0xf')](_0x0bc6('0xc'),_0x1f8a6c,_0x489ba0);_0xd38920(_0x489ba0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 780f241..026c076 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 _0x8738=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8738,0x153));var _0x8873=function(_0x417f69,_0x260a0b){_0x417f69=_0x417f69-0x0;var _0x270654=_0x8738[_0x417f69];return _0x270654;};'use strict';var multer=require(_0x8873('0x0'));var util=require(_0x8873('0x1'));var path=require(_0x8873('0x2'));var timeout=require(_0x8873('0x3'));var express=require(_0x8873('0x4'));var router=express[_0x8873('0x5')]();var fs_extra=require(_0x8873('0x6'));var auth=require(_0x8873('0x7'));var interaction=require(_0x8873('0x8'));var config=require(_0x8873('0x9'));var controller=require(_0x8873('0xa'));router[_0x8873('0xb')]('/',auth['isAuthenticated'](),controller[_0x8873('0xc')]);router[_0x8873('0xb')]('/:id',auth[_0x8873('0xd')](),controller[_0x8873('0xe')]);router[_0x8873('0xb')](_0x8873('0xf'),auth['isAuthenticated'](),controller[_0x8873('0x10')]);router[_0x8873('0x11')]('/',auth[_0x8873('0xd')](),controller[_0x8873('0x12')]);router[_0x8873('0x13')](_0x8873('0x14'),auth[_0x8873('0xd')](),controller['update']);router[_0x8873('0x15')](_0x8873('0x14'),auth['isAuthenticated'](),controller[_0x8873('0x16')]);module[_0x8873('0x17')]=router; \ No newline at end of file +var _0x3ebd=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x420845,_0x3e037b){var _0x4a69bb=function(_0x534144){while(--_0x534144){_0x420845['push'](_0x420845['shift']());}};_0x4a69bb(++_0x3e037b);}(_0x3ebd,0x107));var _0xd3eb=function(_0x54f434,_0x14534e){_0x54f434=_0x54f434-0x0;var _0x5df143=_0x3ebd[_0x54f434];return _0x5df143;};'use strict';var multer=require(_0xd3eb('0x0'));var util=require(_0xd3eb('0x1'));var path=require(_0xd3eb('0x2'));var timeout=require(_0xd3eb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3eb('0x4'));var auth=require(_0xd3eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd3eb('0x6'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd3eb('0x7')](_0xd3eb('0x8'),auth[_0xd3eb('0x9')](),controller[_0xd3eb('0xa')]);router[_0xd3eb('0x7')]('/:id/download',auth[_0xd3eb('0x9')](),controller['download']);router[_0xd3eb('0xb')]('/',auth['isAuthenticated'](),controller[_0xd3eb('0xc')]);router[_0xd3eb('0xd')](_0xd3eb('0x8'),auth[_0xd3eb('0x9')](),controller[_0xd3eb('0xe')]);router[_0xd3eb('0xf')]('/:id',auth[_0xd3eb('0x9')](),controller[_0xd3eb('0x10')]);module[_0xd3eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9ef586a..c8e46e6 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 _0x74b0=['long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x38f509,_0x1886ab){var _0x456187=function(_0x8aae95){while(--_0x8aae95){_0x38f509['push'](_0x38f509['shift']());}};_0x456187(++_0x1886ab);}(_0x74b0,0xab));var _0x074b=function(_0x310448,_0x59f6bd){_0x310448=_0x310448-0x0;var _0xc0124b=_0x74b0[_0x310448];return _0xc0124b;};'use strict';var Sequelize=require(_0x074b('0x0'));module['exports']={'name':{'type':Sequelize[_0x074b('0x1')],'get':function(_0x12b266){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x074b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x074b('0x4')](_0x074b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'stamp':{'type':_0x074b('0x6'),'defaultValue':Sequelize['literal'](_0x074b('0x7'))}}; \ No newline at end of file +var _0x12c0=['exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x40221e,_0x1a8b60){var _0x46fa3a=function(_0x59f108){while(--_0x59f108){_0x40221e['push'](_0x40221e['shift']());}};_0x46fa3a(++_0x1a8b60);}(_0x12c0,0x1ee));var _0x012c=function(_0x4f22ff,_0x961200){_0x4f22ff=_0x4f22ff-0x0;var _0x1add2d=_0x12c0[_0x4f22ff];return _0x1add2d;};'use strict';var Sequelize=require(_0x012c('0x0'));module[_0x012c('0x1')]={'name':{'type':Sequelize[_0x012c('0x2')],'get':function(_0x39d095){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x012c('0x4')](_0x012c('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'stamp':{'type':_0x012c('0x6'),'defaultValue':Sequelize[_0x012c('0x7')](_0x012c('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7cddb24..9f45ee5 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 _0x424f=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','type','key','differenceBy','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv'];(function(_0x2d7c1d,_0x159c26){var _0x15c9cb=function(_0x3c0a92){while(--_0x3c0a92){_0x2d7c1d['push'](_0x2d7c1d['shift']());}};_0x15c9cb(++_0x159c26);}(_0x424f,0xf2));var _0xf424=function(_0x1ea8c9,_0x4d9d96){_0x1ea8c9=_0x1ea8c9-0x0;var _0x3eaa4c=_0x424f[_0x1ea8c9];return _0x3eaa4c;};'use strict';var emlformat=require(_0xf424('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf424('0x1'));var jsonpatch=require(_0xf424('0x2'));var rp=require('request-promise');var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var Mustache=require(_0xf424('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf424('0x6'));var ejs=require(_0xf424('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf424('0x8'));var squel=require(_0xf424('0x9'));var crypto=require(_0xf424('0xa'));var jsforce=require(_0xf424('0xb'));var deskjs=require(_0xf424('0xc'));var toCsv=require(_0xf424('0x6'));var querystring=require(_0xf424('0xd'));var Papa=require(_0xf424('0xe'));var Redis=require(_0xf424('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf424('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf424('0x11'));var logger=require(_0xf424('0x12'))(_0xf424('0x13'));var utils=require(_0xf424('0x14'));var config=require(_0xf424('0x15'));var licenseUtil=require(_0xf424('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a087,_0x51ff50){_0x51ff50=_0x51ff50||0xcc;return function(_0x47df9d){if(_0x47df9d){return _0x22a087['sendStatus'](_0x51ff50);}return _0x22a087[_0xf424('0x17')](_0x51ff50)[_0xf424('0x18')]();};}function respondWithResult(_0x257f36,_0x10c29f){_0x10c29f=_0x10c29f||0xc8;return function(_0x350f6a){if(_0x350f6a){return _0x257f36[_0xf424('0x17')](_0x10c29f)[_0xf424('0x19')](_0x350f6a);}};}function respondWithFilteredResult(_0x3a28e1,_0x384cc2){return function(_0x3f7e6a){if(_0x3f7e6a){var _0xd456c6=typeof _0x384cc2[_0xf424('0x1a')]===_0xf424('0x1b')&&typeof _0x384cc2['limit']==='undefined';var _0xb4a5c2=_0x3f7e6a[_0xf424('0x1c')];var _0x570cda=_0xd456c6?0x0:_0x384cc2['offset'];var _0xb961ef=_0xd456c6?_0x3f7e6a['count']:_0x384cc2[_0xf424('0x1a')]+_0x384cc2['limit'];var _0x48a7a6;if(_0xb961ef>=_0xb4a5c2){_0xb961ef=_0xb4a5c2;_0x48a7a6=0xc8;}else{_0x48a7a6=0xce;}_0x3a28e1[_0xf424('0x17')](_0x48a7a6);return _0x3a28e1[_0xf424('0x1d')]('Content-Range',_0x570cda+'-'+_0xb961ef+'/'+_0xb4a5c2)[_0xf424('0x19')](_0x3f7e6a);}return null;};}function patchUpdates(_0x1c66ea){return function(_0x4521b0){try{jsonpatch[_0xf424('0x1e')](_0x4521b0,_0x1c66ea,!![]);}catch(_0x2c1703){return BPromise[_0xf424('0x1f')](_0x2c1703);}return _0x4521b0['save']();};}function saveUpdates(_0x43e6c5,_0x58f9f3){return function(_0x49d73e){if(_0x49d73e){return _0x49d73e['update'](_0x43e6c5)[_0xf424('0x20')](function(_0x4a3f5f){return _0x4a3f5f;});}return null;};}function removeEntity(_0x232624,_0xb587df){return function(_0x561aeb){if(_0x561aeb){return _0x561aeb[_0xf424('0x21')]()['then'](function(){_0x232624[_0xf424('0x17')](0xcc)[_0xf424('0x18')]();});}};}function handleEntityNotFound(_0x47fb49,_0x204d4d){return function(_0x5612ee){if(!_0x5612ee){_0x47fb49['sendStatus'](0x194);}return _0x5612ee;};}function handleError(_0x5771c5,_0xf7032f){_0xf7032f=_0xf7032f||0x1f4;return function(_0x2196ac){logger[_0xf424('0x22')](_0x2196ac[_0xf424('0x23')]);if(_0x2196ac[_0xf424('0x24')]){delete _0x2196ac[_0xf424('0x24')];}_0x5771c5[_0xf424('0x17')](_0xf7032f)[_0xf424('0x25')](_0x2196ac);};}exports['index']=function(_0x365b0a,_0x12e860){var _0x3a6afa={},_0xb3c1d0={},_0x4389a9={'count':0x0,'rows':[]};var _0x32cc1b=_[_0xf424('0x26')](db[_0xf424('0x27')][_0xf424('0x28')],function(_0x514e3f){return{'name':_0x514e3f['fieldName'],'type':_0x514e3f[_0xf424('0x29')][_0xf424('0x2a')]};});_0xb3c1d0['model']=_[_0xf424('0x2b')](_[_0xf424('0x26')](_0x32cc1b,'name'),[_0xf424('0x24')]);_0xb3c1d0[_0xf424('0x2c')]=_[_0xf424('0x2d')](_0x365b0a[_0xf424('0x2c')]);_0xb3c1d0[_0xf424('0x2e')]=_['intersection'](_0xb3c1d0[_0xf424('0x2f')],_0xb3c1d0[_0xf424('0x2c')]);_0x3a6afa[_0xf424('0x30')]=_[_0xf424('0x31')](_0xb3c1d0['model'],qs['fields'](_0x365b0a[_0xf424('0x2c')][_0xf424('0x32')]));_0x3a6afa[_0xf424('0x30')]=_0x3a6afa[_0xf424('0x30')]['length']?_0x3a6afa['attributes']:_0xb3c1d0[_0xf424('0x2f')];if(!_0x365b0a['query'][_0xf424('0x33')](_0xf424('0x34'))){_0x3a6afa[_0xf424('0x35')]=qs[_0xf424('0x35')](_0x365b0a[_0xf424('0x2c')]['limit']);_0x3a6afa['offset']=qs[_0xf424('0x1a')](_0x365b0a[_0xf424('0x2c')]['offset']);}_0x3a6afa[_0xf424('0x36')]=qs[_0xf424('0x37')](_0x365b0a[_0xf424('0x2c')][_0xf424('0x37')]);_0x3a6afa[_0xf424('0x38')]=qs[_0xf424('0x2e')](_[_0xf424('0x39')](_0x365b0a[_0xf424('0x2c')],_0xb3c1d0[_0xf424('0x2e')]),_0x32cc1b);if(_0x365b0a['query'][_0xf424('0x3a')]){_0x3a6afa['where']=_['merge'](_0x3a6afa[_0xf424('0x38')],{'$or':_[_0xf424('0x26')](_0x32cc1b,function(_0x506d48){if(_0x506d48[_0xf424('0x29')]!==_0xf424('0x3b')){var _0xc5f0d9={};_0xc5f0d9[_0x506d48[_0xf424('0x24')]]={'$like':'%'+_0x365b0a[_0xf424('0x2c')][_0xf424('0x3a')]+'%'};return _0xc5f0d9;}})});}_0x3a6afa=_[_0xf424('0x3c')]({},_0x3a6afa,_0x365b0a[_0xf424('0x3d')]);var _0x308563={'where':_0x3a6afa[_0xf424('0x38')]};return db[_0xf424('0x27')][_0xf424('0x1c')](_0x308563)[_0xf424('0x20')](function(_0x4315ae){_0x4389a9['count']=_0x4315ae;if(_0x365b0a[_0xf424('0x2c')][_0xf424('0x3e')]){_0x3a6afa[_0xf424('0x3f')]=[{'all':!![]}];}return db[_0xf424('0x27')][_0xf424('0x40')](_0x3a6afa);})['then'](function(_0x62e930){_0x4389a9[_0xf424('0x41')]=_0x62e930;return _0x4389a9;})['then'](respondWithFilteredResult(_0x12e860,_0x3a6afa))[_0xf424('0x42')](handleError(_0x12e860,null));};exports[_0xf424('0x43')]=function(_0xe68ee8,_0x28e878){var _0xa67d87={'raw':!![],'where':{'id':_0xe68ee8[_0xf424('0x44')]['id']}},_0xe84f38={};_0xe84f38[_0xf424('0x2f')]=_['keys'](db[_0xf424('0x27')][_0xf424('0x28')]);_0xe84f38[_0xf424('0x2c')]=_['keys'](_0xe68ee8['query']);_0xe84f38[_0xf424('0x2e')]=_['intersection'](_0xe84f38['model'],_0xe84f38['query']);_0xa67d87['attributes']=_[_0xf424('0x31')](_0xe84f38[_0xf424('0x2f')],qs[_0xf424('0x32')](_0xe68ee8['query'][_0xf424('0x32')]));_0xa67d87[_0xf424('0x30')]=_0xa67d87['attributes'][_0xf424('0x45')]?_0xa67d87[_0xf424('0x30')]:_0xe84f38[_0xf424('0x2f')];if(_0xe68ee8[_0xf424('0x2c')]['includeAll']){_0xa67d87[_0xf424('0x3f')]=[{'all':!![]}];}_0xa67d87=_[_0xf424('0x3c')]({},_0xa67d87,_0xe68ee8[_0xf424('0x3d')]);return db[_0xf424('0x27')]['find'](_0xa67d87)[_0xf424('0x20')](handleEntityNotFound(_0x28e878,null))[_0xf424('0x20')](respondWithResult(_0x28e878,null))[_0xf424('0x42')](handleError(_0x28e878,null));};exports[_0xf424('0x46')]=function(_0x524fe1,_0x229730){return db[_0xf424('0x27')]['create'](_0x524fe1[_0xf424('0x47')],{})[_0xf424('0x20')](respondWithResult(_0x229730,0xc9))[_0xf424('0x42')](handleError(_0x229730,null));};exports[_0xf424('0x48')]=function(_0x570481,_0x2fd581){if(_0x570481[_0xf424('0x47')]['id']){delete _0x570481[_0xf424('0x47')]['id'];}return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x570481[_0xf424('0x44')]['id']}})[_0xf424('0x20')](handleEntityNotFound(_0x2fd581,null))[_0xf424('0x20')](saveUpdates(_0x570481['body'],null))[_0xf424('0x20')](respondWithResult(_0x2fd581,null))['catch'](handleError(_0x2fd581,null));};exports[_0xf424('0x21')]=function(_0x5d582e,_0x38c24a){return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x5d582e['params']['id']}})[_0xf424('0x20')](handleEntityNotFound(_0x38c24a,null))[_0xf424('0x20')](removeEntity(_0x38c24a,null))[_0xf424('0x42')](handleError(_0x38c24a,null));};exports[_0xf424('0x4a')]=function(_0x137667,_0x38450e,_0x33dc90){return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x137667[_0xf424('0x44')]['id']},'attributes':['id',_0xf424('0x4b'),_0xf424('0x4c')]})[_0xf424('0x20')](handleEntityNotFound(_0x38450e,null))['then'](function(_0x254e37){if(_0x254e37){if(!_0x254e37[_0xf424('0x4b')]){throw new db[(_0xf424('0x4d'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x3e1228={'Content-Type':_0xf424('0x4e'),'Content-Disposition':_0xf424('0x4f')};if(_0x254e37['msg_id']){_0x3e1228[_0xf424('0x50')]=_0xf424('0x51')+_0x254e37['msg_id']+_0xf424('0x52');}_0x38450e[_0xf424('0x1d')](_0x3e1228);return _0x38450e[_0xf424('0x25')](new Buffer(_0x254e37['recording']));}})[_0xf424('0x42')](handleError(_0x38450e,null));}; \ No newline at end of file +var _0xacf8=['Content-Range','apply','reject','update','then','destroy','end','stack','send','map','rawAttributes','fieldName','type','key','differenceBy','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','VoiceMailMessage','findAll','rows','catch','show','include','options','find','create','body','download','params','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xacf8,0x180));var _0x8acf=function(_0x45c61e,_0x59694d){_0x45c61e=_0x45c61e-0x0;var _0x19033c=_0xacf8[_0x45c61e];return _0x19033c;};'use strict';var emlformat=require(_0x8acf('0x0'));var rimraf=require(_0x8acf('0x1'));var zipdir=require(_0x8acf('0x2'));var jsonpatch=require(_0x8acf('0x3'));var rp=require('request-promise');var moment=require(_0x8acf('0x4'));var BPromise=require(_0x8acf('0x5'));var Mustache=require(_0x8acf('0x6'));var util=require(_0x8acf('0x7'));var path=require(_0x8acf('0x8'));var sox=require('sox');var csv=require(_0x8acf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8acf('0xa'));var _=require('lodash');var squel=require(_0x8acf('0xb'));var crypto=require(_0x8acf('0xc'));var jsforce=require(_0x8acf('0xd'));var deskjs=require(_0x8acf('0xe'));var toCsv=require(_0x8acf('0x9'));var querystring=require(_0x8acf('0xf'));var Papa=require('papaparse');var Redis=require(_0x8acf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8acf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8acf('0x12'));var utils=require(_0x8acf('0x13'));var config=require(_0x8acf('0x14'));var licenseUtil=require(_0x8acf('0x15'));var db=require(_0x8acf('0x16'))['db'];function respondWithStatusCode(_0x1e92ce,_0x2d6175){_0x2d6175=_0x2d6175||0xcc;return function(_0x23bbc2){if(_0x23bbc2){return _0x1e92ce[_0x8acf('0x17')](_0x2d6175);}return _0x1e92ce[_0x8acf('0x18')](_0x2d6175)['end']();};}function respondWithResult(_0x2f496b,_0x34d808){_0x34d808=_0x34d808||0xc8;return function(_0x21d2b4){if(_0x21d2b4){return _0x2f496b[_0x8acf('0x18')](_0x34d808)[_0x8acf('0x19')](_0x21d2b4);}};}function respondWithFilteredResult(_0x206763,_0xd6a263){return function(_0x291b5b){if(_0x291b5b){var _0x47b568=typeof _0xd6a263[_0x8acf('0x1a')]===_0x8acf('0x1b')&&typeof _0xd6a263[_0x8acf('0x1c')]===_0x8acf('0x1b');var _0x26c50f=_0x291b5b['count'];var _0x306a81=_0x47b568?0x0:_0xd6a263['offset'];var _0x3bcb30=_0x47b568?_0x291b5b[_0x8acf('0x1d')]:_0xd6a263['offset']+_0xd6a263[_0x8acf('0x1c')];var _0x5212f3;if(_0x3bcb30>=_0x26c50f){_0x3bcb30=_0x26c50f;_0x5212f3=0xc8;}else{_0x5212f3=0xce;}_0x206763[_0x8acf('0x18')](_0x5212f3);return _0x206763[_0x8acf('0x1e')](_0x8acf('0x1f'),_0x306a81+'-'+_0x3bcb30+'/'+_0x26c50f)[_0x8acf('0x19')](_0x291b5b);}return null;};}function patchUpdates(_0x5b7d77){return function(_0x573b90){try{jsonpatch[_0x8acf('0x20')](_0x573b90,_0x5b7d77,!![]);}catch(_0x401ead){return BPromise[_0x8acf('0x21')](_0x401ead);}return _0x573b90['save']();};}function saveUpdates(_0x49582e,_0x1f8d9e){return function(_0x3af0f0){if(_0x3af0f0){return _0x3af0f0[_0x8acf('0x22')](_0x49582e)[_0x8acf('0x23')](function(_0x242229){return _0x242229;});}return null;};}function removeEntity(_0x23bc94,_0x547e5b){return function(_0x131a6b){if(_0x131a6b){return _0x131a6b[_0x8acf('0x24')]()[_0x8acf('0x23')](function(){_0x23bc94[_0x8acf('0x18')](0xcc)[_0x8acf('0x25')]();});}};}function handleEntityNotFound(_0x359bc1,_0x46b644){return function(_0x1ecbe2){if(!_0x1ecbe2){_0x359bc1[_0x8acf('0x17')](0x194);}return _0x1ecbe2;};}function handleError(_0x4997fb,_0x233a32){_0x233a32=_0x233a32||0x1f4;return function(_0x168e9d){logger['error'](_0x168e9d[_0x8acf('0x26')]);if(_0x168e9d['name']){delete _0x168e9d['name'];}_0x4997fb[_0x8acf('0x18')](_0x233a32)[_0x8acf('0x27')](_0x168e9d);};}exports['index']=function(_0xa03505,_0x3de581){var _0x1dec44={},_0x37a57d={},_0x4f721e={'count':0x0,'rows':[]};var _0xea65b7=_[_0x8acf('0x28')](db['VoiceMailMessage'][_0x8acf('0x29')],function(_0x497cfc){return{'name':_0x497cfc[_0x8acf('0x2a')],'type':_0x497cfc[_0x8acf('0x2b')][_0x8acf('0x2c')]};});_0x37a57d['model']=_[_0x8acf('0x2d')](_[_0x8acf('0x28')](_0xea65b7,'name'),[_0x8acf('0x2e')]);_0x37a57d['query']=_[_0x8acf('0x2f')](_0xa03505[_0x8acf('0x30')]);_0x37a57d[_0x8acf('0x31')]=_[_0x8acf('0x32')](_0x37a57d[_0x8acf('0x33')],_0x37a57d[_0x8acf('0x30')]);_0x1dec44['attributes']=_['intersection'](_0x37a57d['model'],qs[_0x8acf('0x34')](_0xa03505[_0x8acf('0x30')][_0x8acf('0x34')]));_0x1dec44[_0x8acf('0x35')]=_0x1dec44[_0x8acf('0x35')][_0x8acf('0x36')]?_0x1dec44[_0x8acf('0x35')]:_0x37a57d[_0x8acf('0x33')];if(!_0xa03505[_0x8acf('0x30')][_0x8acf('0x37')](_0x8acf('0x38'))){_0x1dec44[_0x8acf('0x1c')]=qs[_0x8acf('0x1c')](_0xa03505[_0x8acf('0x30')][_0x8acf('0x1c')]);_0x1dec44[_0x8acf('0x1a')]=qs['offset'](_0xa03505['query']['offset']);}_0x1dec44['order']=qs['sort'](_0xa03505[_0x8acf('0x30')][_0x8acf('0x39')]);_0x1dec44[_0x8acf('0x3a')]=qs[_0x8acf('0x31')](_[_0x8acf('0x3b')](_0xa03505[_0x8acf('0x30')],_0x37a57d[_0x8acf('0x31')]),_0xea65b7);if(_0xa03505[_0x8acf('0x30')]['filter']){_0x1dec44[_0x8acf('0x3a')]=_[_0x8acf('0x3c')](_0x1dec44['where'],{'$or':_[_0x8acf('0x28')](_0xea65b7,function(_0x20ae3c){if(_0x20ae3c[_0x8acf('0x2b')]!==_0x8acf('0x3d')){var _0x5615e4={};_0x5615e4[_0x20ae3c[_0x8acf('0x2e')]]={'$like':'%'+_0xa03505[_0x8acf('0x30')][_0x8acf('0x3e')]+'%'};return _0x5615e4;}})});}_0x1dec44=_[_0x8acf('0x3c')]({},_0x1dec44,_0xa03505['options']);var _0x2ec46c={'where':_0x1dec44[_0x8acf('0x3a')]};return db['VoiceMailMessage'][_0x8acf('0x1d')](_0x2ec46c)[_0x8acf('0x23')](function(_0x253473){_0x4f721e[_0x8acf('0x1d')]=_0x253473;if(_0xa03505[_0x8acf('0x30')][_0x8acf('0x3f')]){_0x1dec44['include']=[{'all':!![]}];}return db[_0x8acf('0x40')][_0x8acf('0x41')](_0x1dec44);})[_0x8acf('0x23')](function(_0x1f09bc){_0x4f721e[_0x8acf('0x42')]=_0x1f09bc;return _0x4f721e;})[_0x8acf('0x23')](respondWithFilteredResult(_0x3de581,_0x1dec44))[_0x8acf('0x43')](handleError(_0x3de581,null));};exports[_0x8acf('0x44')]=function(_0x378a8f,_0x2e0c7d){var _0x539210={'raw':!![],'where':{'id':_0x378a8f['params']['id']}},_0xe35f9b={};_0xe35f9b[_0x8acf('0x33')]=_['keys'](db['VoiceMailMessage'][_0x8acf('0x29')]);_0xe35f9b['query']=_[_0x8acf('0x2f')](_0x378a8f[_0x8acf('0x30')]);_0xe35f9b[_0x8acf('0x31')]=_[_0x8acf('0x32')](_0xe35f9b[_0x8acf('0x33')],_0xe35f9b[_0x8acf('0x30')]);_0x539210[_0x8acf('0x35')]=_['intersection'](_0xe35f9b['model'],qs['fields'](_0x378a8f['query'][_0x8acf('0x34')]));_0x539210[_0x8acf('0x35')]=_0x539210['attributes'][_0x8acf('0x36')]?_0x539210[_0x8acf('0x35')]:_0xe35f9b['model'];if(_0x378a8f[_0x8acf('0x30')][_0x8acf('0x3f')]){_0x539210[_0x8acf('0x45')]=[{'all':!![]}];}_0x539210=_[_0x8acf('0x3c')]({},_0x539210,_0x378a8f[_0x8acf('0x46')]);return db[_0x8acf('0x40')][_0x8acf('0x47')](_0x539210)['then'](handleEntityNotFound(_0x2e0c7d,null))[_0x8acf('0x23')](respondWithResult(_0x2e0c7d,null))['catch'](handleError(_0x2e0c7d,null));};exports[_0x8acf('0x48')]=function(_0x5de8a2,_0x56803d){return db['VoiceMailMessage'][_0x8acf('0x48')](_0x5de8a2['body'],{})[_0x8acf('0x23')](respondWithResult(_0x56803d,0xc9))['catch'](handleError(_0x56803d,null));};exports[_0x8acf('0x22')]=function(_0x3e6125,_0x50b21b){if(_0x3e6125[_0x8acf('0x49')]['id']){delete _0x3e6125[_0x8acf('0x49')]['id'];}return db[_0x8acf('0x40')][_0x8acf('0x47')]({'where':{'id':_0x3e6125['params']['id']}})[_0x8acf('0x23')](handleEntityNotFound(_0x50b21b,null))[_0x8acf('0x23')](saveUpdates(_0x3e6125[_0x8acf('0x49')],null))[_0x8acf('0x23')](respondWithResult(_0x50b21b,null))[_0x8acf('0x43')](handleError(_0x50b21b,null));};exports['destroy']=function(_0x33d656,_0x128a19){return db[_0x8acf('0x40')][_0x8acf('0x47')]({'where':{'id':_0x33d656['params']['id']}})[_0x8acf('0x23')](handleEntityNotFound(_0x128a19,null))[_0x8acf('0x23')](removeEntity(_0x128a19,null))[_0x8acf('0x43')](handleError(_0x128a19,null));};exports[_0x8acf('0x4a')]=function(_0x3aa551,_0x4e3cd0,_0x464ef5){return db[_0x8acf('0x40')]['find']({'where':{'id':_0x3aa551[_0x8acf('0x4b')]['id']},'attributes':['id','recording',_0x8acf('0x4c')]})['then'](handleEntityNotFound(_0x4e3cd0,null))[_0x8acf('0x23')](function(_0x25a627){if(_0x25a627){if(!_0x25a627[_0x8acf('0x4d')]){throw new db['Sequelize'][(_0x8acf('0x4e'))](_0x8acf('0x4f'));}var _0x52e521={'Content-Type':'audio/wav','Content-Disposition':_0x8acf('0x50')};if(_0x25a627['msg_id']){_0x52e521[_0x8acf('0x51')]=_0x8acf('0x52')+_0x25a627[_0x8acf('0x4c')]+'.wav\x22';}_0x4e3cd0[_0x8acf('0x1e')](_0x52e521);return _0x4e3cd0[_0x8acf('0x27')](new Buffer(_0x25a627[_0x8acf('0x4d')]));}})[_0x8acf('0x43')](handleError(_0x4e3cd0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5ce9fef..f39b944 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 _0xd141=['voice_voicemail_messages','dir','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd141,0x152));var _0x1d14=function(_0x228277,_0x506989){_0x228277=_0x228277-0x0;var _0x1fd6c4=_0xd141[_0x228277];return _0x1fd6c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d14('0x0'))(_0x1d14('0x1'));var moment=require(_0x1d14('0x2'));var BPromise=require(_0x1d14('0x3'));var rp=require(_0x1d14('0x4'));var fs=require('fs');var path=require(_0x1d14('0x5'));var rimraf=require(_0x1d14('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d14('0x7'));module['exports']=function(_0x4c6e9b,_0x2c0280){return _0x4c6e9b[_0x1d14('0x8')](_0x1d14('0x9'),attributes,{'tableName':_0x1d14('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x1d14('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0e6d=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMailMessage.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0e6d,0x100));var _0xd0e6=function(_0x115b95,_0xa1f8b9){_0x115b95=_0x115b95-0x0;var _0x460b3d=_0x0e6d[_0x115b95];return _0x460b3d;};'use strict';var _=require(_0xd0e6('0x0'));var util=require(_0xd0e6('0x1'));var logger=require(_0xd0e6('0x2'))(_0xd0e6('0x3'));var moment=require(_0xd0e6('0x4'));var BPromise=require(_0xd0e6('0x5'));var rp=require(_0xd0e6('0x6'));var fs=require('fs');var path=require(_0xd0e6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd0e6('0x8'));module[_0xd0e6('0x9')]=function(_0x19b6c6,_0x520cb9){return _0x19b6c6[_0xd0e6('0xa')](_0xd0e6('0xb'),attributes,{'tableName':_0xd0e6('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd0e6('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8dce50e..944add7 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 _0xad16=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0xad16,0x8f));var _0x6ad1=function(_0x1d7cec,_0x1242a4){_0x1d7cec=_0x1d7cec-0x0;var _0x51e770=_0xad16[_0x1d7cec];return _0x51e770;};'use strict';var _=require(_0x6ad1('0x0'));var util=require(_0x6ad1('0x1'));var moment=require(_0x6ad1('0x2'));var BPromise=require(_0x6ad1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad1('0x4'));var db=require(_0x6ad1('0x5'))['db'];var utils=require(_0x6ad1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ad1('0x7'));var jayson=require(_0x6ad1('0x8'));var client=jayson[_0x6ad1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19f16d,_0x273a0d,_0x1b5cda){return new BPromise(function(_0x4cdc25,_0x4595d5){return client[_0x6ad1('0xa')](_0x19f16d,_0x1b5cda)[_0x6ad1('0xb')](function(_0x3a114b){logger[_0x6ad1('0xc')](_0x6ad1('0xd'),_0x273a0d,'request\x20sent');logger[_0x6ad1('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x273a0d,_0x6ad1('0xf'),JSON['stringify'](_0x3a114b));if(_0x3a114b[_0x6ad1('0x10')]){if(_0x3a114b['error'][_0x6ad1('0x11')]===0x1f4){logger[_0x6ad1('0x10')](_0x6ad1('0xd'),_0x273a0d,_0x3a114b[_0x6ad1('0x10')][_0x6ad1('0x12')]);return _0x4595d5(_0x3a114b['error'][_0x6ad1('0x12')]);}logger[_0x6ad1('0x10')](_0x6ad1('0xd'),_0x273a0d,_0x3a114b[_0x6ad1('0x10')]['message']);return _0x4cdc25(_0x3a114b[_0x6ad1('0x10')][_0x6ad1('0x12')]);}else{logger['info'](_0x6ad1('0xd'),_0x273a0d,_0x6ad1('0xf'));_0x4cdc25(_0x3a114b[_0x6ad1('0x13')]['message']);}})[_0x6ad1('0x14')](function(_0xf1e76c){logger[_0x6ad1('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x273a0d,_0xf1e76c);_0x4595d5(_0xf1e76c);});});} \ No newline at end of file +var _0x65f9=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x26c6c4,_0x12bdab){var _0x1ff6de=function(_0xd7f08a){while(--_0xd7f08a){_0x26c6c4['push'](_0x26c6c4['shift']());}};_0x1ff6de(++_0x12bdab);}(_0x65f9,0x131));var _0x965f=function(_0x14edd3,_0x3ac403){_0x14edd3=_0x14edd3-0x0;var _0x440f07=_0x65f9[_0x14edd3];return _0x440f07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x965f('0x0'));var BPromise=require('bluebird');var rs=require(_0x965f('0x1'));var fs=require('fs');var Redis=require(_0x965f('0x2'));var db=require(_0x965f('0x3'))['db'];var utils=require(_0x965f('0x4'));var logger=require(_0x965f('0x5'))(_0x965f('0x6'));var config=require(_0x965f('0x7'));var jayson=require(_0x965f('0x8'));var client=jayson[_0x965f('0x9')][_0x965f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e099,_0x23eaba,_0x218a21){return new BPromise(function(_0x629282,_0x503e7b){return client[_0x965f('0xb')](_0x32e099,_0x218a21)['then'](function(_0xf1028a){logger[_0x965f('0xc')](_0x965f('0xd'),_0x23eaba,_0x965f('0xe'));logger['debug'](_0x965f('0xf'),_0x23eaba,_0x965f('0xe'),JSON[_0x965f('0x10')](_0xf1028a));if(_0xf1028a[_0x965f('0x11')]){if(_0xf1028a[_0x965f('0x11')]['code']===0x1f4){logger[_0x965f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x23eaba,_0xf1028a['error'][_0x965f('0x12')]);return _0x503e7b(_0xf1028a['error'][_0x965f('0x12')]);}logger[_0x965f('0x11')](_0x965f('0xd'),_0x23eaba,_0xf1028a[_0x965f('0x11')][_0x965f('0x12')]);return _0x629282(_0xf1028a['error'][_0x965f('0x12')]);}else{logger[_0x965f('0xc')](_0x965f('0xd'),_0x23eaba,'request\x20sent');_0x629282(_0xf1028a['result']['message']);}})[_0x965f('0x13')](function(_0x2ecea2){logger[_0x965f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x23eaba,_0x2ecea2);_0x503e7b(_0x2ecea2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index cb0f1da..0887567 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 _0x61c9=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','update','delete','destroy','removeSound','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x552e0e,_0x4fbc60){var _0x570e10=function(_0x466429){while(--_0x466429){_0x552e0e['push'](_0x552e0e['shift']());}};_0x570e10(++_0x4fbc60);}(_0x61c9,0x1c9));var _0x961c=function(_0x53a00d,_0x462437){_0x53a00d=_0x53a00d-0x0;var _0x28b7f6=_0x61c9[_0x53a00d];return _0x28b7f6;};'use strict';var multer=require(_0x961c('0x0'));var util=require('util');var path=require(_0x961c('0x1'));var timeout=require(_0x961c('0x2'));var express=require(_0x961c('0x3'));var router=express['Router']();var fs_extra=require(_0x961c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x961c('0x5'));var config=require(_0x961c('0x6'));var controller=require(_0x961c('0x7'));router[_0x961c('0x8')]('/',auth[_0x961c('0x9')](),controller[_0x961c('0xa')]);router[_0x961c('0x8')](_0x961c('0xb'),auth[_0x961c('0x9')](),controller[_0x961c('0xc')]);router['get']('/:id/sounds',auth[_0x961c('0x9')](),controller[_0x961c('0xd')]);router[_0x961c('0xe')]('/',auth[_0x961c('0x9')](),controller['create']);router[_0x961c('0xe')](_0x961c('0xf'),auth[_0x961c('0x9')](),controller['addSound']);router['put']('/:id',auth[_0x961c('0x9')](),controller[_0x961c('0x10')]);router[_0x961c('0x11')](_0x961c('0xb'),auth['isAuthenticated'](),controller[_0x961c('0x12')]);router[_0x961c('0x11')]('/:id/sounds/:id2',auth[_0x961c('0x9')](),controller[_0x961c('0x13')]);module[_0x961c('0x14')]=router; \ No newline at end of file +var _0xf140=['isAuthenticated','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','get'];(function(_0xd19c12,_0xcd273b){var _0x1f64dd=function(_0x4ca44b){while(--_0x4ca44b){_0xd19c12['push'](_0xd19c12['shift']());}};_0x1f64dd(++_0xcd273b);}(_0xf140,0xcf));var _0x0f14=function(_0x1e5ad0,_0x58ffe3){_0x1e5ad0=_0x1e5ad0-0x0;var _0x46da3b=_0xf140[_0x1e5ad0];return _0x46da3b;};'use strict';var multer=require(_0x0f14('0x0'));var util=require(_0x0f14('0x1'));var path=require(_0x0f14('0x2'));var timeout=require(_0x0f14('0x3'));var express=require('express');var router=express[_0x0f14('0x4')]();var fs_extra=require(_0x0f14('0x5'));var auth=require(_0x0f14('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f14('0x7'));router[_0x0f14('0x8')]('/',auth[_0x0f14('0x9')](),controller['index']);router['get'](_0x0f14('0xa'),auth[_0x0f14('0x9')](),controller[_0x0f14('0xb')]);router[_0x0f14('0x8')]('/:id/sounds',auth[_0x0f14('0x9')](),controller[_0x0f14('0xc')]);router[_0x0f14('0xd')]('/',auth[_0x0f14('0x9')](),controller[_0x0f14('0xe')]);router[_0x0f14('0xd')](_0x0f14('0xf'),auth[_0x0f14('0x9')](),controller[_0x0f14('0x10')]);router[_0x0f14('0x11')]('/:id',auth[_0x0f14('0x9')](),controller[_0x0f14('0x12')]);router[_0x0f14('0x13')]('/:id',auth[_0x0f14('0x9')](),controller[_0x0f14('0x14')]);router[_0x0f14('0x13')](_0x0f14('0x15'),auth[_0x0f14('0x9')](),controller[_0x0f14('0x16')]);module[_0x0f14('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 92ea028..7634467 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 _0xaefa=['mp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','STRING','name','custom','files'];(function(_0x38d4ac,_0x19cf87){var _0x3497fb=function(_0x5dc7a0){while(--_0x5dc7a0){_0x38d4ac['push'](_0x38d4ac['shift']());}};_0x3497fb(++_0x19cf87);}(_0xaefa,0x163));var _0xaaef=function(_0x5799e0,_0x5a2b87){_0x5799e0=_0x5799e0-0x0;var _0x4730f4=_0xaefa[_0x5799e0];return _0x4730f4;};'use strict';var Sequelize=require(_0xaaef('0x0'));module['exports']={'name':{'type':Sequelize[_0xaaef('0x1')],'allowNull':![],'unique':_0xaaef('0x2')},'mode':{'type':Sequelize['ENUM'](_0xaaef('0x3'),_0xaaef('0x4'),_0xaaef('0x5'),'quietmp3nb',_0xaaef('0x6'),_0xaaef('0x7')),'allowNull':!![],'defaultValue':_0xaaef('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xaaef('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xaaef('0x1')],'allowNull':!![],'defaultValue':_0xaaef('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xaaef('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdaee=['STRING','name','custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdaee,0xee));var _0xedae=function(_0x25f4c6,_0x5ab218){_0x25f4c6=_0x25f4c6-0x0;var _0x1988b2=_0xdaee[_0x25f4c6];return _0x1988b2;};'use strict';var Sequelize=require(_0xedae('0x0'));module[_0xedae('0x1')]={'name':{'type':Sequelize[_0xedae('0x2')],'allowNull':![],'unique':_0xedae('0x3')},'mode':{'type':Sequelize['ENUM'](_0xedae('0x4'),_0xedae('0x5'),'mp3nb',_0xedae('0x6'),_0xedae('0x7'),_0xedae('0x8')),'allowNull':!![],'defaultValue':_0xedae('0x5')},'directory':{'type':Sequelize[_0xedae('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xedae('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xedae('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xedae('0xa')},'defaultEntry':{'type':Sequelize[_0xedae('0xb')],'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 be6a323..af990a9 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 _0x1c6e=['createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','id2','unlinkSync','getSounds','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','undefined','limit','count','offset','set','json','apply','save','update','then','UserProfileResource','destroy','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','body','find','sequelize','transaction','mode','files','join','create','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c6e,0x1b1));var _0xe1c6=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x1c6e[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1c6('0x0'));var zipdir=require(_0xe1c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1c6('0x2'));var moment=require(_0xe1c6('0x3'));var BPromise=require(_0xe1c6('0x4'));var Mustache=require(_0xe1c6('0x5'));var util=require('util');var path=require(_0xe1c6('0x6'));var sox=require(_0xe1c6('0x7'));var csv=require(_0xe1c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1c6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe1c6('0xb'));var toCsv=require(_0xe1c6('0x8'));var querystring=require(_0xe1c6('0xc'));var Papa=require(_0xe1c6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe1c6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1c6('0xf'));var logger=require(_0xe1c6('0x10'))(_0xe1c6('0x11'));var utils=require(_0xe1c6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b0c5,_0x21144b){_0x21144b=_0x21144b||0xcc;return function(_0x569a30){if(_0x569a30){return _0x31b0c5[_0xe1c6('0x13')](_0x21144b);}return _0x31b0c5[_0xe1c6('0x14')](_0x21144b)['end']();};}function respondWithResult(_0x20cefd,_0x3ac14b){_0x3ac14b=_0x3ac14b||0xc8;return function(_0x14ef22){if(_0x14ef22){return _0x20cefd[_0xe1c6('0x14')](_0x3ac14b)['json'](_0x14ef22);}};}function respondWithFilteredResult(_0xb43d2e,_0x429ec1){return function(_0x5e89c7){if(_0x5e89c7){var _0x374666=typeof _0x429ec1['offset']===_0xe1c6('0x15')&&typeof _0x429ec1[_0xe1c6('0x16')]===_0xe1c6('0x15');var _0x2d9176=_0x5e89c7[_0xe1c6('0x17')];var _0x244bd0=_0x374666?0x0:_0x429ec1[_0xe1c6('0x18')];var _0x1155b2=_0x374666?_0x5e89c7[_0xe1c6('0x17')]:_0x429ec1[_0xe1c6('0x18')]+_0x429ec1['limit'];var _0x8282ae;if(_0x1155b2>=_0x2d9176){_0x1155b2=_0x2d9176;_0x8282ae=0xc8;}else{_0x8282ae=0xce;}_0xb43d2e[_0xe1c6('0x14')](_0x8282ae);return _0xb43d2e[_0xe1c6('0x19')]('Content-Range',_0x244bd0+'-'+_0x1155b2+'/'+_0x2d9176)[_0xe1c6('0x1a')](_0x5e89c7);}return null;};}function patchUpdates(_0x28f0fa){return function(_0x38fa6f){try{jsonpatch[_0xe1c6('0x1b')](_0x38fa6f,_0x28f0fa,!![]);}catch(_0x34f159){return BPromise['reject'](_0x34f159);}return _0x38fa6f[_0xe1c6('0x1c')]();};}function saveUpdates(_0x111773,_0x4cdf0c){return function(_0x25e63f){if(_0x25e63f){return _0x25e63f[_0xe1c6('0x1d')](_0x111773)[_0xe1c6('0x1e')](function(_0x10ef3c){return _0x10ef3c;});}return null;};}function removeEntity(_0x464369,_0x27c198){return function(_0x2d0d9a){if(_0x2d0d9a){return _0x2d0d9a['destroy']()[_0xe1c6('0x1e')](function(){var _0xd17e15=_0x2d0d9a['get']({'plain':!![]});var _0x17e217='MusicOnHolds';return db[_0xe1c6('0x1f')][_0xe1c6('0x20')]({'where':{'type':_0x17e217,'resourceId':_0xd17e15['id']}})[_0xe1c6('0x1e')](function(){return _0x2d0d9a;});})[_0xe1c6('0x1e')](function(){_0x464369[_0xe1c6('0x14')](0xcc)[_0xe1c6('0x21')]();});}};}function handleEntityNotFound(_0x3ef592,_0x1c7170){return function(_0x23e4b0){if(!_0x23e4b0){_0x3ef592[_0xe1c6('0x13')](0x194);}return _0x23e4b0;};}function handleError(_0x5ac007,_0x51aa15){_0x51aa15=_0x51aa15||0x1f4;return function(_0x3f27cc){logger[_0xe1c6('0x22')](_0x3f27cc[_0xe1c6('0x23')]);if(_0x3f27cc[_0xe1c6('0x24')]){delete _0x3f27cc['name'];}_0x5ac007[_0xe1c6('0x14')](_0x51aa15)['send'](_0x3f27cc);};}exports[_0xe1c6('0x25')]=function(_0x584837,_0x2ec6e2){var _0x47e187={},_0x49e85e={},_0xb19b83={'count':0x0,'rows':[]};var _0x3525f6=_[_0xe1c6('0x26')](db[_0xe1c6('0x27')][_0xe1c6('0x28')],function(_0x268e3f){return{'name':_0x268e3f[_0xe1c6('0x29')],'type':_0x268e3f['type'][_0xe1c6('0x2a')]};});_0x49e85e[_0xe1c6('0x2b')]=_[_0xe1c6('0x26')](_0x3525f6,_0xe1c6('0x24'));_0x49e85e[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x584837[_0xe1c6('0x2c')]);_0x49e85e[_0xe1c6('0x2e')]=_['intersection'](_0x49e85e['model'],_0x49e85e[_0xe1c6('0x2c')]);_0x47e187[_0xe1c6('0x2f')]=_[_0xe1c6('0x30')](_0x49e85e[_0xe1c6('0x2b')],qs['fields'](_0x584837['query'][_0xe1c6('0x31')]));_0x47e187['attributes']=_0x47e187[_0xe1c6('0x2f')][_0xe1c6('0x32')]?_0x47e187[_0xe1c6('0x2f')]:_0x49e85e[_0xe1c6('0x2b')];if(!_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x33')]('nolimit')){_0x47e187[_0xe1c6('0x16')]=qs['limit'](_0x584837['query'][_0xe1c6('0x16')]);_0x47e187[_0xe1c6('0x18')]=qs[_0xe1c6('0x18')](_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x18')]);}_0x47e187[_0xe1c6('0x34')]=qs[_0xe1c6('0x35')](_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x35')]);delete _0x584837[_0xe1c6('0x2c')]['sort'];_0x47e187[_0xe1c6('0x36')]=qs['filters'](_['pick'](_0x584837['query'],_0x49e85e[_0xe1c6('0x2e')]),_0x3525f6);if(_0x584837['query'][_0xe1c6('0x37')]){_0x47e187[_0xe1c6('0x36')]=_[_0xe1c6('0x38')](_0x47e187[_0xe1c6('0x36')],{'$or':_['map'](_0x3525f6,function(_0x29910c){if(_0x29910c[_0xe1c6('0x39')]!==_0xe1c6('0x3a')){var _0x6eaffe={};_0x6eaffe[_0x29910c[_0xe1c6('0x24')]]={'$like':'%'+_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x37')]+'%'};return _0x6eaffe;}})});}_0x47e187=_[_0xe1c6('0x38')]({},_0x47e187,_0x584837[_0xe1c6('0x3b')]);var _0x14ef8d={'where':_0x47e187[_0xe1c6('0x36')]};return db['VoiceMusicOnHold']['count'](_0x14ef8d)[_0xe1c6('0x1e')](function(_0x31c3ac){_0xb19b83[_0xe1c6('0x17')]=_0x31c3ac;if(_0x584837['query'][_0xe1c6('0x3c')]){_0x47e187['include']=[{'all':!![]}];}return db[_0xe1c6('0x27')][_0xe1c6('0x3d')](_0x47e187);})[_0xe1c6('0x1e')](function(_0x3dcfe1){_0xb19b83['rows']=_0x3dcfe1;return _0xb19b83;})[_0xe1c6('0x1e')](respondWithFilteredResult(_0x2ec6e2,_0x47e187))[_0xe1c6('0x3e')](handleError(_0x2ec6e2,null));};exports[_0xe1c6('0x3f')]=function(_0x2f15b5,_0x31ffcb){var _0x4bcf01={'raw':![],'where':{'id':_0x2f15b5[_0xe1c6('0x40')]['id']}},_0x4cd673={};_0x4cd673[_0xe1c6('0x2b')]=_['keys'](db[_0xe1c6('0x27')][_0xe1c6('0x28')]);_0x4cd673[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x2f15b5['query']);_0x4cd673[_0xe1c6('0x2e')]=_[_0xe1c6('0x30')](_0x4cd673[_0xe1c6('0x2b')],_0x4cd673[_0xe1c6('0x2c')]);_0x4bcf01[_0xe1c6('0x2f')]=_['intersection'](_0x4cd673['model'],qs[_0xe1c6('0x31')](_0x2f15b5[_0xe1c6('0x2c')][_0xe1c6('0x31')]));_0x4bcf01['attributes']=_0x4bcf01[_0xe1c6('0x2f')][_0xe1c6('0x32')]?_0x4bcf01[_0xe1c6('0x2f')]:_0x4cd673[_0xe1c6('0x2b')];if(_0x2f15b5[_0xe1c6('0x2c')]['includeAll']){_0x4bcf01[_0xe1c6('0x41')]=[{'all':!![]}];}_0x4bcf01=_['merge']({},_0x4bcf01,_0x2f15b5[_0xe1c6('0x3b')]);return db[_0xe1c6('0x27')]['find'](_0x4bcf01)[_0xe1c6('0x1e')](handleEntityNotFound(_0x31ffcb,null))[_0xe1c6('0x1e')](respondWithResult(_0x31ffcb,null))[_0xe1c6('0x3e')](handleError(_0x31ffcb,null));};exports[_0xe1c6('0x1d')]=function(_0x511dd5,_0x33d098){if(_0x511dd5[_0xe1c6('0x42')]['id']){delete _0x511dd5[_0xe1c6('0x42')]['id'];}return db[_0xe1c6('0x27')][_0xe1c6('0x43')]({'where':{'id':_0x511dd5['params']['id']}})['then'](handleEntityNotFound(_0x33d098,null))[_0xe1c6('0x1e')](saveUpdates(_0x511dd5[_0xe1c6('0x42')],null))['then'](respondWithResult(_0x33d098,null))[_0xe1c6('0x3e')](handleError(_0x33d098,null));};exports['create']=function(_0x1bf6c5,_0x13d2b7,_0x5123ba){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x6887f1){if(_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x46')]===_0xe1c6('0x47')){_0x1bf6c5['body']['directory']=path[_0xe1c6('0x48')](config['root'],'server/files/moh',_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x24')]);}return db['VoiceMusicOnHold'][_0xe1c6('0x49')](_0x1bf6c5['body'],{'transaction':_0x6887f1})[_0xe1c6('0x1e')](function(_0x14fb1c){if(_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x46')]===_0xe1c6('0x47')){fs[_0xe1c6('0x4a')](_0x14fb1c[_0xe1c6('0x4b')],parseInt(_0xe1c6('0x4c'),0x8));}var _0x497a59=_0x1bf6c5['user'][_0xe1c6('0x4d')]({'plain':!![]});if(!_0x497a59)throw new Error(_0xe1c6('0x4e'));if(_0x497a59[_0xe1c6('0x4f')]===_0xe1c6('0x50')){var _0x3af661=_0x14fb1c[_0xe1c6('0x4d')]({'plain':!![]});return db[_0xe1c6('0x51')][_0xe1c6('0x43')]({'where':{'name':_0xe1c6('0x52'),'userProfileId':_0x497a59[_0xe1c6('0x53')]},'raw':!![]})['then'](function(_0x4f34e5){if(_0x4f34e5&&_0x4f34e5['autoAssociation']===0x0){return db['UserProfileResource'][_0xe1c6('0x49')]({'name':_0x3af661['name'],'resourceId':_0x3af661['id'],'type':_0x4f34e5['name'],'sectionId':_0x4f34e5['id']},{})[_0xe1c6('0x1e')](function(){return _0x14fb1c;});}else{return _0x14fb1c;}})[_0xe1c6('0x3e')](function(_0x2555b8){logger[_0xe1c6('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2555b8);});}return _0x14fb1c;});})[_0xe1c6('0x1e')](respondWithResult(_0x13d2b7,0xc9))[_0xe1c6('0x3e')](handleError(_0x13d2b7,null));};exports[_0xe1c6('0x20')]=function(_0x3edb5a,_0x42cf03,_0x37372a){var _0x421403;return db['VoiceMusicOnHold'][_0xe1c6('0x43')]({'where':{'id':_0x3edb5a[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x1e')](function(_0x42c5c2){if(_0x42c5c2){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x2bfe44){return _0x42c5c2['destroy']({'transaction':_0x2bfe44,'raw':!![]})[_0xe1c6('0x1e')](function(_0x26eca6){if(_0x26eca6[_0xe1c6('0x4b')]){fs['readdirSync'](_0x26eca6[_0xe1c6('0x4b')])['forEach'](function(_0x1ccd66){fs['unlinkSync'](path[_0xe1c6('0x48')](_0x26eca6[_0xe1c6('0x4b')],_0x1ccd66));});fs['rmdirSync'](_0x26eca6['directory']);}return _0x26eca6;});})['catch'](function(_0x1d3e30){throw new db[(_0xe1c6('0x54'))][(_0xe1c6('0x55'))](_0x1d3e30[_0xe1c6('0x56')]);});}})[_0xe1c6('0x1e')](handleEntityNotFound(_0x42cf03,null))[_0xe1c6('0x1e')](removeEntity(_0x42cf03,null))[_0xe1c6('0x3e')](handleError(_0x42cf03,null));};exports[_0xe1c6('0x57')]=function(_0x54514f,_0x5ed980,_0x1f720e){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x5af1f4){var _0x4ec5e0;return db[_0xe1c6('0x27')][_0xe1c6('0x43')]({'where':{'id':_0x54514f['params']['id']}})['then'](function(_0x495724){if(_0x495724){_0x4ec5e0=_0x495724;return _0x495724[_0xe1c6('0x57')](_0x54514f[_0xe1c6('0x42')]['id'],{'transaction':_0x5af1f4});}})[_0xe1c6('0x1e')](function(_0x332562){if(_0x332562){return db[_0xe1c6('0x58')][_0xe1c6('0x59')]({'where':{'id':_0x54514f[_0xe1c6('0x42')]['id']},'attributes':['id',_0xe1c6('0x24'),_0xe1c6('0x5a'),_0xe1c6('0x5b'),_0xe1c6('0x5c')],'raw':!![]});}})['then'](function(_0xe8487e){if(_0xe8487e){var _0x4890c1=path[_0xe1c6('0x48')](config['root'],_0xe1c6('0x5d'),util[_0xe1c6('0x5e')](_0xe1c6('0x5f'),path[_0xe1c6('0x60')](_0xe8487e[_0xe1c6('0x5a')],path[_0xe1c6('0x61')](_0xe8487e[_0xe1c6('0x5a')])),_0xe8487e[_0xe1c6('0x5b')]));var _0x198eb8=path[_0xe1c6('0x48')](config['root'],_0xe1c6('0x62'),_0x4ec5e0[_0xe1c6('0x24')],util[_0xe1c6('0x5e')]('%s.%s',_0xe8487e[_0xe1c6('0x24')],_0xe8487e['converted_format']));fs[_0xe1c6('0x63')](_0x4890c1,_0x198eb8);return _0xe8487e;}})[_0xe1c6('0x3e')](function(_0x3bec33){throw new db[(_0xe1c6('0x54'))][(_0xe1c6('0x55'))](_0x3bec33[_0xe1c6('0x56')]);});})[_0xe1c6('0x1e')](handleEntityNotFound(_0x5ed980,null))['then'](respondWithResult(_0x5ed980,0xc9))[_0xe1c6('0x3e')](handleError(_0x5ed980,null));};exports['removeSound']=function(_0x500ccc,_0x50a3a4,_0x4f5622){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x346702){var _0x37377e;return db[_0xe1c6('0x27')]['findOne']({'where':{'id':_0x500ccc[_0xe1c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x50a3a4,null))['then'](function(_0x212848){if(_0x212848){_0x37377e=_0x212848;return _0x212848[_0xe1c6('0x64')](_0x500ccc[_0xe1c6('0x40')]['id2']);}})['then'](function(_0x4d72cc){if(_0x4d72cc){return db[_0xe1c6('0x58')][_0xe1c6('0x59')]({'where':{'id':_0x500ccc[_0xe1c6('0x40')][_0xe1c6('0x65')]},'attributes':['id','name',_0xe1c6('0x5a'),'converted_format',_0xe1c6('0x5c')],'raw':!![]});}})['then'](function(_0x3c2691){if(_0x3c2691){fs[_0xe1c6('0x66')](path[_0xe1c6('0x48')](_0x37377e[_0xe1c6('0x4b')],util[_0xe1c6('0x5e')](_0xe1c6('0x5f'),_0x3c2691[_0xe1c6('0x24')],_0x3c2691[_0xe1c6('0x5b')])));return _0x3c2691;}})[_0xe1c6('0x3e')](function(_0x414244){throw new db['Sequelize'][(_0xe1c6('0x55'))](_0x414244[_0xe1c6('0x56')]);});})[_0xe1c6('0x1e')](handleEntityNotFound(_0x50a3a4,null))[_0xe1c6('0x1e')](respondWithStatusCode(_0x50a3a4,0xcc))['catch'](handleError(_0x50a3a4,null));};exports[_0xe1c6('0x67')]=function(_0x414591,_0xf440b2,_0x37832f){var _0x5d9541={};var _0x22f2d8={};var _0x112bc7;var _0x2c0ad1;return db['VoiceMusicOnHold'][_0xe1c6('0x59')]({'where':{'id':_0x414591[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x1e')](handleEntityNotFound(_0xf440b2,null))[_0xe1c6('0x1e')](function(_0x5982c9){if(_0x5982c9){_0x112bc7=_0x5982c9;_0x22f2d8['model']=_['keys'](db[_0xe1c6('0x58')][_0xe1c6('0x28')]);_0x22f2d8[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x414591['query']);_0x22f2d8[_0xe1c6('0x2e')]=_['intersection'](_0x22f2d8['model'],_0x22f2d8[_0xe1c6('0x2c')]);_0x5d9541['attributes']=_[_0xe1c6('0x30')](_0x22f2d8[_0xe1c6('0x2b')],qs['fields'](_0x414591['query'][_0xe1c6('0x31')]));_0x5d9541['attributes']=_0x5d9541[_0xe1c6('0x2f')]['length']?_0x5d9541['attributes']:_0x22f2d8['model'];_0x5d9541[_0xe1c6('0x34')]=qs[_0xe1c6('0x35')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x35')]);_0x5d9541['where']=qs[_0xe1c6('0x2e')](_['pick'](_0x414591['query'],_0x22f2d8['filters']));if(_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x37')]){_0x5d9541[_0xe1c6('0x36')]=_[_0xe1c6('0x38')](_0x5d9541[_0xe1c6('0x36')],{'$or':_['map'](_0x5d9541[_0xe1c6('0x2f')],function(_0x5f277d){var _0xa19983={};_0xa19983[_0x5f277d]={'$like':'%'+_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x37')]+'%'};return _0xa19983;})});}_0x5d9541=_['merge']({},_0x5d9541,_0x414591[_0xe1c6('0x3b')]);return _0x112bc7[_0xe1c6('0x67')](_0x5d9541);}})[_0xe1c6('0x1e')](function(_0x14d6ed){if(_0x14d6ed){_0x2c0ad1=_0x14d6ed['length'];if(!_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x33')](_0xe1c6('0x68'))){_0x5d9541[_0xe1c6('0x16')]=qs[_0xe1c6('0x16')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x16')]);_0x5d9541['offset']=qs[_0xe1c6('0x18')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x18')]);}return _0x112bc7[_0xe1c6('0x67')](_0x5d9541);}})[_0xe1c6('0x1e')](function(_0x107a19){if(_0x107a19){return _0x107a19?{'count':_0x2c0ad1,'rows':_0x107a19}:null;}})[_0xe1c6('0x1e')](respondWithResult(_0xf440b2,null))[_0xe1c6('0x3e')](handleError(_0xf440b2,null));}; \ No newline at end of file +var _0x322d=['sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','Sequelize','ValidationError','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','message','removeSound','id2','getSounds','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','body','find','catch'];(function(_0x645624,_0x5e26cb){var _0x25cd27=function(_0x2d5699){while(--_0x2d5699){_0x645624['push'](_0x645624['shift']());}};_0x25cd27(++_0x5e26cb);}(_0x322d,0x1e3));var _0xd322=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x322d[_0x61b4c7];return _0x5f57a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd322('0x0'));var zipdir=require(_0xd322('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd322('0x2'));var moment=require(_0xd322('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd322('0x4'));var util=require(_0xd322('0x5'));var path=require(_0xd322('0x6'));var sox=require(_0xd322('0x7'));var csv=require(_0xd322('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd322('0x9'));var _=require(_0xd322('0xa'));var squel=require(_0xd322('0xb'));var crypto=require(_0xd322('0xc'));var jsforce=require(_0xd322('0xd'));var deskjs=require(_0xd322('0xe'));var toCsv=require(_0xd322('0x8'));var querystring=require(_0xd322('0xf'));var Papa=require(_0xd322('0x10'));var Redis=require('ioredis');var authService=require(_0xd322('0x11'));var qs=require(_0xd322('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd322('0x13'));var logger=require('../../config/logger')(_0xd322('0x14'));var utils=require(_0xd322('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd322('0x16'));var db=require(_0xd322('0x17'))['db'];function respondWithStatusCode(_0x32b51c,_0x536036){_0x536036=_0x536036||0xcc;return function(_0x3a402b){if(_0x3a402b){return _0x32b51c['sendStatus'](_0x536036);}return _0x32b51c[_0xd322('0x18')](_0x536036)[_0xd322('0x19')]();};}function respondWithResult(_0x30032a,_0x3908b4){_0x3908b4=_0x3908b4||0xc8;return function(_0x132a3c){if(_0x132a3c){return _0x30032a['status'](_0x3908b4)[_0xd322('0x1a')](_0x132a3c);}};}function respondWithFilteredResult(_0x8f7e85,_0x370e88){return function(_0x146edb){if(_0x146edb){var _0x38fff9=typeof _0x370e88[_0xd322('0x1b')]==='undefined'&&typeof _0x370e88[_0xd322('0x1c')]===_0xd322('0x1d');var _0x5b1e9c=_0x146edb[_0xd322('0x1e')];var _0x1099bc=_0x38fff9?0x0:_0x370e88[_0xd322('0x1b')];var _0x21ebb9=_0x38fff9?_0x146edb[_0xd322('0x1e')]:_0x370e88[_0xd322('0x1b')]+_0x370e88[_0xd322('0x1c')];var _0x5baabe;if(_0x21ebb9>=_0x5b1e9c){_0x21ebb9=_0x5b1e9c;_0x5baabe=0xc8;}else{_0x5baabe=0xce;}_0x8f7e85[_0xd322('0x18')](_0x5baabe);return _0x8f7e85[_0xd322('0x1f')]('Content-Range',_0x1099bc+'-'+_0x21ebb9+'/'+_0x5b1e9c)[_0xd322('0x1a')](_0x146edb);}return null;};}function patchUpdates(_0x4b39a5){return function(_0x2cb8f8){try{jsonpatch[_0xd322('0x20')](_0x2cb8f8,_0x4b39a5,!![]);}catch(_0x1802c1){return BPromise[_0xd322('0x21')](_0x1802c1);}return _0x2cb8f8[_0xd322('0x22')]();};}function saveUpdates(_0x57beaf,_0x3b21b0){return function(_0x1bc570){if(_0x1bc570){return _0x1bc570[_0xd322('0x23')](_0x57beaf)[_0xd322('0x24')](function(_0x53d173){return _0x53d173;});}return null;};}function removeEntity(_0x245a34,_0x4383ed){return function(_0x4c6927){if(_0x4c6927){return _0x4c6927[_0xd322('0x25')]()['then'](function(){var _0x173b4f=_0x4c6927[_0xd322('0x26')]({'plain':!![]});var _0x159c3a=_0xd322('0x27');return db[_0xd322('0x28')][_0xd322('0x25')]({'where':{'type':_0x159c3a,'resourceId':_0x173b4f['id']}})[_0xd322('0x24')](function(){return _0x4c6927;});})[_0xd322('0x24')](function(){_0x245a34[_0xd322('0x18')](0xcc)[_0xd322('0x19')]();});}};}function handleEntityNotFound(_0x5d73d0,_0x182266){return function(_0x3b5573){if(!_0x3b5573){_0x5d73d0[_0xd322('0x29')](0x194);}return _0x3b5573;};}function handleError(_0x102955,_0x202d01){_0x202d01=_0x202d01||0x1f4;return function(_0x1f9fd5){logger[_0xd322('0x2a')](_0x1f9fd5[_0xd322('0x2b')]);if(_0x1f9fd5['name']){delete _0x1f9fd5[_0xd322('0x2c')];}_0x102955[_0xd322('0x18')](_0x202d01)[_0xd322('0x2d')](_0x1f9fd5);};}exports['index']=function(_0x4d3d09,_0x336ae7){var _0x16ce9e={},_0x1c3bb5={},_0x345b8b={'count':0x0,'rows':[]};var _0x3e9470=_[_0xd322('0x2e')](db[_0xd322('0x2f')][_0xd322('0x30')],function(_0xeb34be){return{'name':_0xeb34be[_0xd322('0x31')],'type':_0xeb34be[_0xd322('0x32')][_0xd322('0x33')]};});_0x1c3bb5[_0xd322('0x34')]=_[_0xd322('0x2e')](_0x3e9470,_0xd322('0x2c'));_0x1c3bb5[_0xd322('0x35')]=_[_0xd322('0x36')](_0x4d3d09[_0xd322('0x35')]);_0x1c3bb5[_0xd322('0x37')]=_[_0xd322('0x38')](_0x1c3bb5['model'],_0x1c3bb5[_0xd322('0x35')]);_0x16ce9e[_0xd322('0x39')]=_['intersection'](_0x1c3bb5[_0xd322('0x34')],qs[_0xd322('0x3a')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x3a')]));_0x16ce9e[_0xd322('0x39')]=_0x16ce9e[_0xd322('0x39')]['length']?_0x16ce9e[_0xd322('0x39')]:_0x1c3bb5[_0xd322('0x34')];if(!_0x4d3d09[_0xd322('0x35')][_0xd322('0x3b')](_0xd322('0x3c'))){_0x16ce9e[_0xd322('0x1c')]=qs[_0xd322('0x1c')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x1c')]);_0x16ce9e['offset']=qs[_0xd322('0x1b')](_0x4d3d09[_0xd322('0x35')]['offset']);}_0x16ce9e[_0xd322('0x3d')]=qs[_0xd322('0x3e')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x3e')]);delete _0x4d3d09[_0xd322('0x35')][_0xd322('0x3e')];_0x16ce9e[_0xd322('0x3f')]=qs['filters'](_[_0xd322('0x40')](_0x4d3d09[_0xd322('0x35')],_0x1c3bb5[_0xd322('0x37')]),_0x3e9470);if(_0x4d3d09[_0xd322('0x35')][_0xd322('0x41')]){_0x16ce9e[_0xd322('0x3f')]=_[_0xd322('0x42')](_0x16ce9e[_0xd322('0x3f')],{'$or':_['map'](_0x3e9470,function(_0x51c776){if(_0x51c776['type']!=='VIRTUAL'){var _0x49993b={};_0x49993b[_0x51c776['name']]={'$like':'%'+_0x4d3d09[_0xd322('0x35')][_0xd322('0x41')]+'%'};return _0x49993b;}})});}_0x16ce9e=_['merge']({},_0x16ce9e,_0x4d3d09[_0xd322('0x43')]);var _0x8d5c54={'where':_0x16ce9e[_0xd322('0x3f')]};return db[_0xd322('0x2f')][_0xd322('0x1e')](_0x8d5c54)[_0xd322('0x24')](function(_0x2d55d4){_0x345b8b['count']=_0x2d55d4;if(_0x4d3d09['query'][_0xd322('0x44')]){_0x16ce9e['include']=[{'all':!![]}];}return db[_0xd322('0x2f')][_0xd322('0x45')](_0x16ce9e);})[_0xd322('0x24')](function(_0x5a3a99){_0x345b8b[_0xd322('0x46')]=_0x5a3a99;return _0x345b8b;})[_0xd322('0x24')](respondWithFilteredResult(_0x336ae7,_0x16ce9e))['catch'](handleError(_0x336ae7,null));};exports[_0xd322('0x47')]=function(_0x3e41c8,_0x32512c){var _0x58aaaa={'raw':![],'where':{'id':_0x3e41c8[_0xd322('0x48')]['id']}},_0x5f574e={};_0x5f574e[_0xd322('0x34')]=_[_0xd322('0x36')](db[_0xd322('0x2f')][_0xd322('0x30')]);_0x5f574e['query']=_['keys'](_0x3e41c8['query']);_0x5f574e[_0xd322('0x37')]=_[_0xd322('0x38')](_0x5f574e['model'],_0x5f574e[_0xd322('0x35')]);_0x58aaaa[_0xd322('0x39')]=_['intersection'](_0x5f574e['model'],qs[_0xd322('0x3a')](_0x3e41c8[_0xd322('0x35')][_0xd322('0x3a')]));_0x58aaaa[_0xd322('0x39')]=_0x58aaaa[_0xd322('0x39')][_0xd322('0x49')]?_0x58aaaa[_0xd322('0x39')]:_0x5f574e['model'];if(_0x3e41c8[_0xd322('0x35')][_0xd322('0x44')]){_0x58aaaa['include']=[{'all':!![]}];}_0x58aaaa=_[_0xd322('0x42')]({},_0x58aaaa,_0x3e41c8[_0xd322('0x43')]);return db['VoiceMusicOnHold']['find'](_0x58aaaa)['then'](handleEntityNotFound(_0x32512c,null))[_0xd322('0x24')](respondWithResult(_0x32512c,null))['catch'](handleError(_0x32512c,null));};exports[_0xd322('0x23')]=function(_0x2e94d0,_0x35c533){if(_0x2e94d0['body']['id']){delete _0x2e94d0[_0xd322('0x4a')]['id'];}return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0x2e94d0[_0xd322('0x48')]['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x35c533,null))['then'](saveUpdates(_0x2e94d0[_0xd322('0x4a')],null))[_0xd322('0x24')](respondWithResult(_0x35c533,null))[_0xd322('0x4c')](handleError(_0x35c533,null));};exports['create']=function(_0x312fd5,_0x53abd9,_0x37734f){return db[_0xd322('0x4d')][_0xd322('0x4e')](function(_0x64c0a6){if(_0x312fd5[_0xd322('0x4a')][_0xd322('0x4f')]===_0xd322('0x50')){_0x312fd5['body'][_0xd322('0x51')]=path[_0xd322('0x52')](config[_0xd322('0x53')],_0xd322('0x54'),_0x312fd5[_0xd322('0x4a')][_0xd322('0x2c')]);}return db[_0xd322('0x2f')][_0xd322('0x55')](_0x312fd5['body'],{'transaction':_0x64c0a6})[_0xd322('0x24')](function(_0x30ab51){if(_0x312fd5['body'][_0xd322('0x4f')]===_0xd322('0x50')){fs[_0xd322('0x56')](_0x30ab51['directory'],parseInt(_0xd322('0x57'),0x8));}var _0xa3f9c4=_0x312fd5[_0xd322('0x58')][_0xd322('0x26')]({'plain':!![]});if(!_0xa3f9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa3f9c4[_0xd322('0x59')]==='user'){var _0x40f29c=_0x30ab51['get']({'plain':!![]});return db[_0xd322('0x5a')][_0xd322('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0xa3f9c4[_0xd322('0x5b')]},'raw':!![]})['then'](function(_0x1cb268){if(_0x1cb268&&_0x1cb268[_0xd322('0x5c')]===0x0){return db[_0xd322('0x28')][_0xd322('0x55')]({'name':_0x40f29c[_0xd322('0x2c')],'resourceId':_0x40f29c['id'],'type':_0x1cb268[_0xd322('0x2c')],'sectionId':_0x1cb268['id']},{})['then'](function(){return _0x30ab51;});}else{return _0x30ab51;}})['catch'](function(_0x1c24ec){logger['error'](_0xd322('0x5d'),_0x1c24ec);});}return _0x30ab51;});})[_0xd322('0x24')](respondWithResult(_0x53abd9,0xc9))[_0xd322('0x4c')](handleError(_0x53abd9,null));};exports[_0xd322('0x25')]=function(_0xbf8a22,_0x530211,_0x11d490){var _0x27e0b7;return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0xbf8a22[_0xd322('0x48')]['id']}})[_0xd322('0x24')](function(_0x4404a8){if(_0x4404a8){return db[_0xd322('0x4d')]['transaction'](function(_0x3ed1be){return _0x4404a8['destroy']({'transaction':_0x3ed1be,'raw':!![]})[_0xd322('0x24')](function(_0x19d1e0){if(_0x19d1e0[_0xd322('0x51')]){fs['readdirSync'](_0x19d1e0[_0xd322('0x51')])[_0xd322('0x5e')](function(_0x255708){fs[_0xd322('0x5f')](path[_0xd322('0x52')](_0x19d1e0['directory'],_0x255708));});fs['rmdirSync'](_0x19d1e0[_0xd322('0x51')]);}return _0x19d1e0;});})[_0xd322('0x4c')](function(_0x32e3c9){throw new db[(_0xd322('0x60'))][(_0xd322('0x61'))](_0x32e3c9['message']);});}})[_0xd322('0x24')](handleEntityNotFound(_0x530211,null))[_0xd322('0x24')](removeEntity(_0x530211,null))['catch'](handleError(_0x530211,null));};exports['addSound']=function(_0x1cd2bc,_0x33e809,_0x5b3357){return db[_0xd322('0x4d')][_0xd322('0x4e')](function(_0x6396c){var _0x4d87f8;return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0x1cd2bc[_0xd322('0x48')]['id']}})[_0xd322('0x24')](function(_0x4f0ae4){if(_0x4f0ae4){_0x4d87f8=_0x4f0ae4;return _0x4f0ae4['addSound'](_0x1cd2bc['body']['id'],{'transaction':_0x6396c});}})[_0xd322('0x24')](function(_0x5cbee8){if(_0x5cbee8){return db[_0xd322('0x62')][_0xd322('0x63')]({'where':{'id':_0x1cd2bc['body']['id']},'attributes':['id','name','save_name',_0xd322('0x64'),_0xd322('0x65')],'raw':!![]});}})[_0xd322('0x24')](function(_0x427539){if(_0x427539){var _0x8d8f1b=path[_0xd322('0x52')](config[_0xd322('0x53')],_0xd322('0x66'),util[_0xd322('0x67')](_0xd322('0x68'),path[_0xd322('0x69')](_0x427539[_0xd322('0x6a')],path[_0xd322('0x6b')](_0x427539[_0xd322('0x6a')])),_0x427539[_0xd322('0x64')]));var _0x2eb189=path['join'](config[_0xd322('0x53')],_0xd322('0x54'),_0x4d87f8[_0xd322('0x2c')],util['format']('%s.%s',_0x427539[_0xd322('0x2c')],_0x427539[_0xd322('0x64')]));fs['symlinkSync'](_0x8d8f1b,_0x2eb189);return _0x427539;}})[_0xd322('0x4c')](function(_0x35c3fa){throw new db['Sequelize'][(_0xd322('0x61'))](_0x35c3fa[_0xd322('0x6c')]);});})[_0xd322('0x24')](handleEntityNotFound(_0x33e809,null))[_0xd322('0x24')](respondWithResult(_0x33e809,0xc9))['catch'](handleError(_0x33e809,null));};exports[_0xd322('0x6d')]=function(_0x41384e,_0x2204a9,_0x5cb077){return db[_0xd322('0x4d')]['transaction'](function(_0x38c773){var _0x3d01eb;return db[_0xd322('0x2f')]['findOne']({'where':{'id':_0x41384e[_0xd322('0x48')]['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x2204a9,null))[_0xd322('0x24')](function(_0x586444){if(_0x586444){_0x3d01eb=_0x586444;return _0x586444['removeSound'](_0x41384e['params'][_0xd322('0x6e')]);}})['then'](function(_0x2c0bbe){if(_0x2c0bbe){return db[_0xd322('0x62')][_0xd322('0x63')]({'where':{'id':_0x41384e[_0xd322('0x48')][_0xd322('0x6e')]},'attributes':['id','name',_0xd322('0x6a'),'converted_format',_0xd322('0x65')],'raw':!![]});}})[_0xd322('0x24')](function(_0x556260){if(_0x556260){fs[_0xd322('0x5f')](path['join'](_0x3d01eb[_0xd322('0x51')],util[_0xd322('0x67')](_0xd322('0x68'),_0x556260[_0xd322('0x2c')],_0x556260[_0xd322('0x64')])));return _0x556260;}})[_0xd322('0x4c')](function(_0x4dbba8){throw new db[(_0xd322('0x60'))][(_0xd322('0x61'))](_0x4dbba8[_0xd322('0x6c')]);});})['then'](handleEntityNotFound(_0x2204a9,null))[_0xd322('0x24')](respondWithStatusCode(_0x2204a9,0xcc))[_0xd322('0x4c')](handleError(_0x2204a9,null));};exports[_0xd322('0x6f')]=function(_0x30569f,_0x49cbcd,_0x440197){var _0x175c85={};var _0x404a2d={};var _0x572df9;var _0x18b12b;return db[_0xd322('0x2f')]['findOne']({'where':{'id':_0x30569f['params']['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x49cbcd,null))[_0xd322('0x24')](function(_0x156aae){if(_0x156aae){_0x572df9=_0x156aae;_0x404a2d[_0xd322('0x34')]=_[_0xd322('0x36')](db['Sound'][_0xd322('0x30')]);_0x404a2d[_0xd322('0x35')]=_[_0xd322('0x36')](_0x30569f['query']);_0x404a2d[_0xd322('0x37')]=_['intersection'](_0x404a2d[_0xd322('0x34')],_0x404a2d[_0xd322('0x35')]);_0x175c85[_0xd322('0x39')]=_[_0xd322('0x38')](_0x404a2d['model'],qs[_0xd322('0x3a')](_0x30569f[_0xd322('0x35')]['fields']));_0x175c85['attributes']=_0x175c85[_0xd322('0x39')][_0xd322('0x49')]?_0x175c85[_0xd322('0x39')]:_0x404a2d[_0xd322('0x34')];_0x175c85['order']=qs['sort'](_0x30569f['query'][_0xd322('0x3e')]);_0x175c85[_0xd322('0x3f')]=qs['filters'](_[_0xd322('0x40')](_0x30569f[_0xd322('0x35')],_0x404a2d[_0xd322('0x37')]));if(_0x30569f['query'][_0xd322('0x41')]){_0x175c85[_0xd322('0x3f')]=_['merge'](_0x175c85[_0xd322('0x3f')],{'$or':_[_0xd322('0x2e')](_0x175c85[_0xd322('0x39')],function(_0x486481){var _0x44f17d={};_0x44f17d[_0x486481]={'$like':'%'+_0x30569f['query'][_0xd322('0x41')]+'%'};return _0x44f17d;})});}_0x175c85=_[_0xd322('0x42')]({},_0x175c85,_0x30569f[_0xd322('0x43')]);return _0x572df9['getSounds'](_0x175c85);}})['then'](function(_0x3ee2a4){if(_0x3ee2a4){_0x18b12b=_0x3ee2a4[_0xd322('0x49')];if(!_0x30569f[_0xd322('0x35')][_0xd322('0x3b')]('nolimit')){_0x175c85[_0xd322('0x1c')]=qs['limit'](_0x30569f[_0xd322('0x35')][_0xd322('0x1c')]);_0x175c85[_0xd322('0x1b')]=qs['offset'](_0x30569f[_0xd322('0x35')][_0xd322('0x1b')]);}return _0x572df9[_0xd322('0x6f')](_0x175c85);}})[_0xd322('0x24')](function(_0x381fac){if(_0x381fac){return _0x381fac?{'count':_0x18b12b,'rows':_0x381fac}:null;}})[_0xd322('0x24')](respondWithResult(_0x49cbcd,null))[_0xd322('0x4c')](handleError(_0x49cbcd,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7fcca8e..3e4e50a 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 _0x2dac=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','path','./voiceMusicOnHold.attributes'];(function(_0x2843da,_0x47a8ff){var _0x13147b=function(_0x4611a9){while(--_0x4611a9){_0x2843da['push'](_0x2843da['shift']());}};_0x13147b(++_0x47a8ff);}(_0x2dac,0x93));var _0xc2da=function(_0x2b8bf1,_0x3977d6){_0x2b8bf1=_0x2b8bf1-0x0;var _0x3d2a62=_0x2dac[_0x2b8bf1];return _0x3d2a62;};'use strict';var _=require(_0xc2da('0x0'));var util=require(_0xc2da('0x1'));var logger=require('../../config/logger')(_0xc2da('0x2'));var moment=require(_0xc2da('0x3'));var BPromise=require(_0xc2da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2da('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2da('0x6'));module[_0xc2da('0x7')]=function(_0x1bef3c,_0x5f4247){return _0x1bef3c[_0xc2da('0x8')](_0xc2da('0x9'),attributes,{'tableName':_0xc2da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x483a=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4e6131,_0x3c7e5c){var _0x26fee0=function(_0x2b98ea){while(--_0x2b98ea){_0x4e6131['push'](_0x4e6131['shift']());}};_0x26fee0(++_0x3c7e5c);}(_0x483a,0x18b));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa483('0x0'));var util=require(_0xa483('0x1'));var logger=require(_0xa483('0x2'))(_0xa483('0x3'));var moment=require(_0xa483('0x4'));var BPromise=require(_0xa483('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa483('0x6'));var rimraf=require(_0xa483('0x7'));var config=require(_0xa483('0x8'));var attributes=require(_0xa483('0x9'));module['exports']=function(_0x80a82a,_0xb8b604){return _0x80a82a[_0xa483('0xa')](_0xa483('0xb'),attributes,{'tableName':_0xa483('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index e47a29c..2fd9322 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ddc63,_0x4569ad){var _0x3a372e=function(_0x1c6f7c){while(--_0x1c6f7c){_0x2ddc63['push'](_0x2ddc63['shift']());}};_0x3a372e(++_0x4569ad);}(_0xe706,0xa3));var _0x6e70=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xe706[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2e1f4a,_0x40a526){var _0x254438=function(_0x1624de){while(--_0x1624de){_0x2e1f4a['push'](_0x2e1f4a['shift']());}};_0x254438(++_0x40a526);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 34018bf..b5f9e13 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 _0xa566=['../../config/environment','get','isAuthenticated','/:id','show','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa566,0x1c1));var _0x6a56=function(_0x1026e0,_0x62b8e0){_0x1026e0=_0x1026e0-0x0;var _0x536a17=_0xa566[_0x1026e0];return _0x536a17;};'use strict';var multer=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var path=require(_0x6a56('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a56('0x3'));var router=express[_0x6a56('0x4')]();var fs_extra=require(_0x6a56('0x5'));var auth=require(_0x6a56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a56('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6a56('0x8')]('/describe',auth[_0x6a56('0x9')](),controller['describe']);router[_0x6a56('0x8')](_0x6a56('0xa'),auth['isAuthenticated'](),controller[_0x6a56('0xb')]);router[_0x6a56('0x8')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller['getAgents']);router[_0x6a56('0x8')](_0x6a56('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6a56('0xe')]('/',auth[_0x6a56('0x9')](),controller[_0x6a56('0xf')]);router[_0x6a56('0xe')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x10')]);router['post'](_0x6a56('0xd'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x11')]);router[_0x6a56('0x12')](_0x6a56('0xa'),auth['isAuthenticated'](),controller[_0x6a56('0x13')]);router[_0x6a56('0x14')](_0x6a56('0xa'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x15')]);router['delete']('/:id/users',auth[_0x6a56('0x9')](),controller[_0x6a56('0x16')]);router['delete'](_0x6a56('0xd'),auth[_0x6a56('0x9')](),controller['removeTeams']);module[_0x6a56('0x17')]=router; \ No newline at end of file +var _0x7edb=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller'];(function(_0x375d37,_0x4f4032){var _0xdb1fae=function(_0x1c1c74){while(--_0x1c1c74){_0x375d37['push'](_0x375d37['shift']());}};_0xdb1fae(++_0x4f4032);}(_0x7edb,0x158));var _0xb7ed=function(_0x2e4416,_0x2e1d21){_0x2e4416=_0x2e4416-0x0;var _0xe35b8=_0x7edb[_0x2e4416];return _0xe35b8;};'use strict';var multer=require('multer');var util=require(_0xb7ed('0x0'));var path=require(_0xb7ed('0x1'));var timeout=require(_0xb7ed('0x2'));var express=require(_0xb7ed('0x3'));var router=express[_0xb7ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7ed('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7ed('0x6'));router[_0xb7ed('0x7')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x9')]);router[_0xb7ed('0x7')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xb')]);router[_0xb7ed('0x7')](_0xb7ed('0xc'),auth['isAuthenticated'](),controller[_0xb7ed('0xd')]);router[_0xb7ed('0x7')](_0xb7ed('0xe'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xf')]);router[_0xb7ed('0x7')](_0xb7ed('0x10'),auth['isAuthenticated'](),controller[_0xb7ed('0x11')]);router[_0xb7ed('0x12')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x13')]);router[_0xb7ed('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xb7ed('0x14')]);router['post'](_0xb7ed('0x10'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x15')]);router[_0xb7ed('0x16')](_0xb7ed('0xc'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x17')]);router[_0xb7ed('0x18')](_0xb7ed('0xc'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x19')]);router[_0xb7ed('0x18')]('/:id/users',auth[_0xb7ed('0x8')](),controller['removeAgents']);router[_0xb7ed('0x18')](_0xb7ed('0x10'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xb7ed('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index aa909d2..d221664 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 _0xf707=['INTEGER','sequelize','exports','STRING','VIRTUAL','system-','name'];(function(_0x901d57,_0x48d9b1){var _0x1eaa80=function(_0x23b382){while(--_0x23b382){_0x901d57['push'](_0x901d57['shift']());}};_0x1eaa80(++_0x48d9b1);}(_0xf707,0xf6));var _0x7f70=function(_0x2b8fe9,_0x5cac02){_0x2b8fe9=_0x2b8fe9-0x0;var _0x138c37=_0xf707[_0x2b8fe9];return _0x138c37;};'use strict';var Sequelize=require(_0x7f70('0x0'));module[_0x7f70('0x1')]={'name':{'type':Sequelize[_0x7f70('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x7f70('0x3')],'get':function(_0x27a7ab){return _0x7f70('0x4')+this['getDataValue'](_0x7f70('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7f70('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x7f70('0x6')]}}; \ No newline at end of file +var _0xb030=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0x3879d6,_0xe3cca0){var _0x473c88=function(_0x3e18f0){while(--_0x3e18f0){_0x3879d6['push'](_0x3879d6['shift']());}};_0x473c88(++_0xe3cca0);}(_0xb030,0xa2));var _0x0b03=function(_0x34c3ac,_0x40a7f4){_0x34c3ac=_0x34c3ac-0x0;var _0x6661a1=_0xb030[_0x34c3ac];return _0x6661a1;};'use strict';var Sequelize=require(_0x0b03('0x0'));module[_0x0b03('0x1')]={'name':{'type':Sequelize[_0x0b03('0x2')],'allowNull':![],'unique':_0x0b03('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x41f440){return _0x0b03('0x4')+this[_0x0b03('0x5')](_0x0b03('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x0b03('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x0b03('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0ec172c..f7f8319 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 _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x292a00,_0x46b033){var _0x3e9fa8=function(_0x438446){while(--_0x438446){_0x292a00['push'](_0x292a00['shift']());}};_0x3e9fa8(++_0x46b033);}(_0x2032,0xd9));var _0x2203=function(_0x1ab917,_0x5021e7){_0x1ab917=_0x1ab917-0x0;var _0x1dfdca=_0x2032[_0x1ab917];return _0x1dfdca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0xe820=['appdata','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','User','Agents','online','voicePause','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','value','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','sendStatus','error','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','describe','create','sequelize','transaction','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','priority'];(function(_0x22b597,_0x3c4ee0){var _0x4129b5=function(_0x2f87c7){while(--_0x2f87c7){_0x22b597['push'](_0x22b597['shift']());}};_0x4129b5(++_0x3c4ee0);}(_0xe820,0xd2));var _0x0e82=function(_0x40bcb3,_0x17e6e0){_0x40bcb3=_0x40bcb3-0x0;var _0x1032df=_0xe820[_0x40bcb3];return _0x1032df;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];config[_0x0e82('0x18')]=_[_0x0e82('0x19')](config[_0x0e82('0x18')],{'host':_0x0e82('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e82('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x1e4ddb,_0x4b748a){_0x4b748a=_0x4b748a||0xcc;return function(_0x5b4ffd){if(_0x5b4ffd){return _0x1e4ddb['sendStatus'](_0x4b748a);}return _0x1e4ddb[_0x0e82('0x1b')](_0x4b748a)['end']();};}function respondWithResult(_0x585b9b,_0x1149b1){_0x1149b1=_0x1149b1||0xc8;return function(_0x582f45){if(_0x582f45){return _0x585b9b[_0x0e82('0x1b')](_0x1149b1)[_0x0e82('0x1c')](_0x582f45);}};}function respondWithFilteredResult(_0x233c6d,_0x315ce4){return function(_0x53622b){if(_0x53622b){var _0x25ac21=typeof _0x315ce4[_0x0e82('0x1d')]===_0x0e82('0x1e')&&typeof _0x315ce4[_0x0e82('0x1f')]===_0x0e82('0x1e');var _0x1230e6=_0x53622b[_0x0e82('0x20')];var _0x3735c0=_0x25ac21?0x0:_0x315ce4[_0x0e82('0x1d')];var _0x224455=_0x25ac21?_0x53622b[_0x0e82('0x20')]:_0x315ce4['offset']+_0x315ce4['limit'];var _0x294696;if(_0x224455>=_0x1230e6){_0x224455=_0x1230e6;_0x294696=0xc8;}else{_0x294696=0xce;}_0x233c6d[_0x0e82('0x1b')](_0x294696);return _0x233c6d[_0x0e82('0x21')](_0x0e82('0x22'),_0x3735c0+'-'+_0x224455+'/'+_0x1230e6)[_0x0e82('0x1c')](_0x53622b);}return null;};}function patchUpdates(_0x1bdad4){return function(_0x39fcbe){try{jsonpatch[_0x0e82('0x23')](_0x39fcbe,_0x1bdad4,!![]);}catch(_0x56b3ad){return BPromise[_0x0e82('0x24')](_0x56b3ad);}return _0x39fcbe[_0x0e82('0x25')]();};}function saveUpdates(_0x3d6c28,_0x24f883){return function(_0x507f08){if(_0x507f08){return _0x507f08[_0x0e82('0x26')](_0x3d6c28)[_0x0e82('0x27')](function(_0x7a9399){return _0x7a9399;});}return null;};}function removeEntity(_0x16e11c,_0x4900d3){return function(_0x1ef751){if(_0x1ef751){return _0x1ef751['destroy']()['then'](function(){var _0x384f88=_0x1ef751[_0x0e82('0x28')]({'plain':!![]});var _0x4c5fc1=_0x0e82('0x29');return db[_0x0e82('0x2a')][_0x0e82('0x2b')]({'where':{'type':_0x4c5fc1,'resourceId':_0x384f88['id']}})['then'](function(){return _0x1ef751;});})[_0x0e82('0x27')](function(){_0x16e11c[_0x0e82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xabc536,_0x59a5b6){return function(_0x4300f9){if(!_0x4300f9){_0xabc536[_0x0e82('0x2c')](0x194);}return _0x4300f9;};}function handleError(_0x551f96,_0x38cbbc){_0x38cbbc=_0x38cbbc||0x1f4;return function(_0x268af5){logger[_0x0e82('0x2d')](_0x268af5['stack']);if(_0x268af5['name']){delete _0x268af5[_0x0e82('0x2e')];}_0x551f96['status'](_0x38cbbc)[_0x0e82('0x2f')](_0x268af5);};}exports['index']=function(_0x1a3b2e,_0x264022){var _0x44e177={},_0x56ca79={},_0x45a40e={'count':0x0,'rows':[]};var _0x59d2f8=_[_0x0e82('0x30')](db[_0x0e82('0x31')][_0x0e82('0x32')],function(_0x30c993){return{'name':_0x30c993[_0x0e82('0x33')],'type':_0x30c993[_0x0e82('0x34')]['key']};});_0x56ca79[_0x0e82('0x35')]=_[_0x0e82('0x30')](_0x59d2f8,_0x0e82('0x2e'));_0x56ca79[_0x0e82('0x36')]=_[_0x0e82('0x37')](_0x1a3b2e[_0x0e82('0x36')]);_0x56ca79[_0x0e82('0x38')]=_[_0x0e82('0x39')](_0x56ca79[_0x0e82('0x35')],_0x56ca79[_0x0e82('0x36')]);_0x44e177[_0x0e82('0x3a')]=_[_0x0e82('0x39')](_0x56ca79[_0x0e82('0x35')],qs[_0x0e82('0x3b')](_0x1a3b2e[_0x0e82('0x36')]['fields']));_0x44e177[_0x0e82('0x3a')]=_0x44e177[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x44e177[_0x0e82('0x3a')]:_0x56ca79['model'];if(!_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x3d')]('nolimit')){_0x44e177[_0x0e82('0x1f')]=qs['limit'](_0x1a3b2e['query'][_0x0e82('0x1f')]);_0x44e177[_0x0e82('0x1d')]=qs[_0x0e82('0x1d')](_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x1d')]);}_0x44e177[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x1a3b2e['query']['sort']);_0x44e177[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x1a3b2e[_0x0e82('0x36')],_0x56ca79[_0x0e82('0x38')]),_0x59d2f8);if(_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x42')]){_0x44e177[_0x0e82('0x40')]=_['merge'](_0x44e177[_0x0e82('0x40')],{'$or':_[_0x0e82('0x30')](_0x59d2f8,function(_0x233a18){if(_0x233a18[_0x0e82('0x34')]!==_0x0e82('0x43')){var _0x3d0a45={};_0x3d0a45[_0x233a18[_0x0e82('0x2e')]]={'$like':'%'+_0x1a3b2e['query'][_0x0e82('0x42')]+'%'};return _0x3d0a45;}})});}_0x44e177=_[_0x0e82('0x44')]({},_0x44e177,_0x1a3b2e[_0x0e82('0x45')]);var _0x36fe4c={'where':_0x44e177[_0x0e82('0x40')]};return db[_0x0e82('0x31')][_0x0e82('0x20')](_0x36fe4c)['then'](function(_0x581764){_0x45a40e['count']=_0x581764;if(_0x1a3b2e['query']['includeAll']){_0x44e177['include']=[{'all':!![]}];}return db[_0x0e82('0x31')][_0x0e82('0x46')](_0x44e177);})[_0x0e82('0x27')](function(_0x199495){_0x45a40e[_0x0e82('0x47')]=_0x199495;return _0x45a40e;})[_0x0e82('0x27')](respondWithFilteredResult(_0x264022,_0x44e177))[_0x0e82('0x48')](handleError(_0x264022,null));};exports[_0x0e82('0x49')]=function(_0x55b53a,_0x484f94){var _0x2ae914={'raw':![],'where':{'id':_0x55b53a[_0x0e82('0x4a')]['id']}},_0x36a0c2={};_0x36a0c2[_0x0e82('0x35')]=_[_0x0e82('0x37')](db[_0x0e82('0x31')][_0x0e82('0x32')]);_0x36a0c2[_0x0e82('0x36')]=_['keys'](_0x55b53a[_0x0e82('0x36')]);_0x36a0c2['filters']=_[_0x0e82('0x39')](_0x36a0c2['model'],_0x36a0c2[_0x0e82('0x36')]);_0x2ae914['attributes']=_[_0x0e82('0x39')](_0x36a0c2[_0x0e82('0x35')],qs[_0x0e82('0x3b')](_0x55b53a['query']['fields']));_0x2ae914[_0x0e82('0x3a')]=_0x2ae914[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x2ae914['attributes']:_0x36a0c2[_0x0e82('0x35')];if(_0x55b53a['query'][_0x0e82('0x4b')]){_0x2ae914[_0x0e82('0x4c')]=[{'all':!![]}];}_0x2ae914=_[_0x0e82('0x44')]({},_0x2ae914,_0x55b53a[_0x0e82('0x45')]);return db[_0x0e82('0x31')][_0x0e82('0x4d')](_0x2ae914)[_0x0e82('0x27')](handleEntityNotFound(_0x484f94,null))[_0x0e82('0x27')](respondWithResult(_0x484f94,null))[_0x0e82('0x48')](handleError(_0x484f94,null));};exports[_0x0e82('0x2b')]=function(_0x41e27e,_0x22c249){return db['VoicePrefix'][_0x0e82('0x4d')]({'where':{'id':_0x41e27e[_0x0e82('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22c249,null))[_0x0e82('0x27')](removeEntity(_0x22c249,null))['catch'](handleError(_0x22c249,null));};exports['describe']=function(_0x42a535,_0x505663){return db[_0x0e82('0x31')][_0x0e82('0x4e')]()[_0x0e82('0x27')](respondWithResult(_0x505663,null))[_0x0e82('0x48')](handleError(_0x505663,null));};exports[_0x0e82('0x4f')]=function(_0x535f6d,_0x104bfe){var _0x4cb6e7;return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x42c4a7){return db[_0x0e82('0x31')][_0x0e82('0x4f')](_0x535f6d['body'],{'transaction':_0x42c4a7})[_0x0e82('0x27')](function(_0x22d56b){_0x4cb6e7=_0x22d56b[_0x0e82('0x28')]({'plain':!![]});return db[_0x0e82('0x52')][_0x0e82('0x4d')]({'where':{'id':_0x4cb6e7['VoiceExtensionId']},'raw':!![]})[_0x0e82('0x27')](function(_0x348b00){return createVoicePrefixExtensions(_0x4cb6e7,_0x348b00,_0x42c4a7);});});})[_0x0e82('0x27')](function(){var _0x1e6d69=_0x535f6d[_0x0e82('0x53')][_0x0e82('0x28')]({'plain':!![]});if(!_0x1e6d69)throw new Error(_0x0e82('0x54'));if(_0x1e6d69[_0x0e82('0x55')]===_0x0e82('0x53')){var _0x2852d4=_0x4cb6e7;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x1e6d69[_0x0e82('0x56')]},'raw':!![]})['then'](function(_0x23741c){if(_0x23741c&&_0x23741c[_0x0e82('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x2852d4[_0x0e82('0x2e')],'resourceId':_0x2852d4['id'],'type':_0x23741c[_0x0e82('0x2e')],'sectionId':_0x23741c['id']},{})[_0x0e82('0x27')](function(){return _0x4cb6e7;});}else{return _0x4cb6e7;}})[_0x0e82('0x48')](function(_0x174da5){logger[_0x0e82('0x2d')](_0x0e82('0x58'),_0x174da5);throw _0x174da5;});}return _0x4cb6e7;})[_0x0e82('0x27')](respondWithResult(_0x104bfe,null))[_0x0e82('0x48')](handleError(_0x104bfe,null));};function Extension(_0x3b35e0,_0x4ce423,_0x30e9f1,_0x21aaac){this[_0x0e82('0x59')]=_0x0e82('0x5a');this[_0x0e82('0x5b')]=_0x3b35e0;this[_0x0e82('0x5c')]=_0x30e9f1;this[_0x0e82('0x34')]=_0x0e82('0x5d');this['description']=_0x0e82('0x5e');this[_0x0e82('0x5f')]=_0x4ce423;this[_0x0e82('0x60')]=_0x21aaac;}function createVoicePrefixExtensions(_0x1ea2fc,_0x21c870,_0x28f3b7){return new BPromise(function(_0x2d1e59,_0x11ef9e){var _0x20bf0c=new Extension(formatPrefixName(_0x1ea2fc['prefix']),0x1,_0x0e82('0x61'),'Voice\x20Prefix');_0x20bf0c[_0x0e82('0x62')]=_0x1ea2fc['id'];return db['VoiceExtension'][_0x0e82('0x4f')](_0x20bf0c,{'transaction':_0x28f3b7})[_0x0e82('0x27')](function(_0x5f3ec3){var _0x30e0a3=_0x5f3ec3[_0x0e82('0x28')]({'plain':!![]});var _0x244b42=_[_0x0e82('0x30')](addVoicePrefixExtensions(_0x1ea2fc,_0x21c870),function(_0x336df1){_0x336df1['VoiceExtensionId']=_0x30e0a3['id'];_0x336df1[_0x0e82('0x62')]=_0x1ea2fc['id'];return _0x336df1;});return db['VoiceExtension']['bulkCreate'](_0x244b42,{'transaction':_0x28f3b7})[_0x0e82('0x27')](function(_0x2cf29f){if(!_0x2cf29f){return _0x11ef9e(_0x0e82('0x63'));}else{return _0x2d1e59(_0x2cf29f);}})[_0x0e82('0x48')](function(_0x2bdca1){return _0x11ef9e(_0x2bdca1);});});;});};function addVoicePrefixExtensions(_0xa4fe1f,_0xb1a061){var _0x41ef93=[];var _0x277327=formatPrefixName(_0xa4fe1f[_0x0e82('0x64')]);_0x41ef93['push'](new Extension(_0x277327,0x2,'Set',_0x0e82('0x65')+_0xa4fe1f['name']));if(_0xa4fe1f[_0x0e82('0x66')]){_0x41ef93[_0x0e82('0x67')](new Extension(_0x277327,0x3,'Set',_0x0e82('0x68')+_0xa4fe1f[_0x0e82('0x66')]));}else{_0x41ef93['push'](new Extension(_0x277327,0x3,_0x0e82('0x61'),_0x0e82('0x69')));}_0x41ef93['push'](new Extension(_0x277327,0x4,_0x0e82('0x6a'),_0xb1a061['context']+','+_0x0e82('0x6b')+(0x8+_0xa4fe1f[_0x0e82('0x2e')][_0x0e82('0x3c')])+'}'+','+0x1));return _0x41ef93;}function formatPrefixName(_0x3bdc68){var _0x34faf5='_';for(var _0x75a64d=0x0;_0x75a64d<_0x3bdc68[_0x0e82('0x3c')];_0x75a64d++){if(_0x3bdc68[_0x0e82('0x6c')](_0x75a64d)=='-'){_0x34faf5+=_0x3bdc68[_0x0e82('0x6c')](_0x75a64d);}else{_0x34faf5+='['+_0x3bdc68[_0x0e82('0x6c')](_0x75a64d)+']';}}_0x34faf5+='.';return _0x34faf5;}exports['update']=function(_0x39911a,_0x4a696b,_0x131698){var _0x2dfd03=_0x39911a[_0x0e82('0x6d')];_0x2dfd03['prefix']=_0x0e82('0x6e')+_0x2dfd03[_0x0e82('0x2e')]+'-';return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x1a67bc){return db['VoicePrefix'][_0x0e82('0x26')](_0x2dfd03,{'where':{'id':_0x2dfd03['id']},'transaction':_0x1a67bc})['then'](function(){return db[_0x0e82('0x52')][_0x0e82('0x2b')]({'where':{'VoicePrefixId':_0x2dfd03['id']},'transaction':_0x1a67bc})['then'](function(){return db['VoiceExtension'][_0x0e82('0x4d')]({'where':{'id':_0x2dfd03[_0x0e82('0x6f')]},'raw':!![]})[_0x0e82('0x27')](function(_0x22791b){return createVoicePrefixExtensions(_0x2dfd03,_0x22791b,_0x1a67bc);});});});})[_0x0e82('0x27')](function(){return db[_0x0e82('0x31')][_0x0e82('0x70')](_0x2dfd03['id']);})[_0x0e82('0x27')](respondWithResult(_0x4a696b,null))[_0x0e82('0x48')](handleError(_0x4a696b,null));};exports['addAgents']=function(_0x4249fd,_0x328d74,_0x480d15){return db['VoicePrefix']['find']({'where':{'id':_0x4249fd[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x328d74,null))[_0x0e82('0x27')](function(_0x542b28){if(_0x542b28){return _0x542b28[_0x0e82('0x71')](_0x4249fd['body'][_0x0e82('0x72')],_[_0x0e82('0x73')](_0x4249fd[_0x0e82('0x6d')],[_0x0e82('0x72'),'id'])||{})[_0x0e82('0x74')](function(_0x48ac18){for(var _0x28097c=0x0;_0x28097c<_0x4249fd[_0x0e82('0x6d')]['ids'][_0x0e82('0x3c')];_0x28097c+=0x1){socket[_0x0e82('0x75')](_0x0e82('0x76'),{'UserId':Number(_0x4249fd['body'][_0x0e82('0x72')][_0x28097c]),'VoicePrefixId':Number(_0x4249fd['params']['id'])});}return _0x48ac18;});}})[_0x0e82('0x27')](respondWithResult(_0x328d74,null))[_0x0e82('0x48')](handleError(_0x328d74,null));};exports[_0x0e82('0x77')]=function(_0x5ca20d,_0xe258d4,_0x115800){return db[_0x0e82('0x31')][_0x0e82('0x4d')]({'where':{'id':_0x5ca20d['params']['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0xe258d4,null))[_0x0e82('0x27')](function(_0x168bf1){if(_0x168bf1){return _0x168bf1[_0x0e82('0x77')](_0x5ca20d[_0x0e82('0x36')]['ids'])[_0x0e82('0x27')](function(){if(_['isArray'](_0x5ca20d[_0x0e82('0x36')]['ids'])){for(var _0x40e10c=0x0;_0x40e10c<_0x5ca20d[_0x0e82('0x36')]['ids'][_0x0e82('0x3c')];_0x40e10c+=0x1){socket[_0x0e82('0x75')](_0x0e82('0x78'),{'UserId':Number(_0x5ca20d['query']['ids'][_0x40e10c]),'VoicePrefixId':Number(_0x5ca20d['params']['id'])});}}else{socket[_0x0e82('0x75')](_0x0e82('0x78'),{'UserId':Number(_0x5ca20d[_0x0e82('0x36')]['ids']),'VoicePrefixId':Number(_0x5ca20d[_0x0e82('0x4a')]['id'])});}});}})[_0x0e82('0x27')](respondWithStatusCode(_0xe258d4,null))[_0x0e82('0x48')](handleError(_0xe258d4,null));};exports[_0x0e82('0x79')]=function(_0x183fe7,_0x27928f,_0x6fcbe1){var _0x446a39={};var _0x556a2d={};var _0x445d82;var _0x384428;return db[_0x0e82('0x31')][_0x0e82('0x7a')]({'where':{'id':_0x183fe7[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x27928f,null))[_0x0e82('0x27')](function(_0x42b39c){if(_0x42b39c){_0x445d82=_0x42b39c;_0x556a2d['model']=_[_0x0e82('0x37')](db['User']['rawAttributes']);_0x556a2d['query']=_[_0x0e82('0x37')](_0x183fe7[_0x0e82('0x36')]);_0x556a2d[_0x0e82('0x38')]=_[_0x0e82('0x39')](_0x556a2d['model'],_0x556a2d[_0x0e82('0x36')]);_0x446a39['attributes']=_[_0x0e82('0x39')](_0x556a2d[_0x0e82('0x35')],qs['fields'](_0x183fe7[_0x0e82('0x36')]['fields']));_0x446a39['attributes']=_0x446a39[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x446a39['attributes']:_0x556a2d['model'];_0x446a39[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x183fe7[_0x0e82('0x36')][_0x0e82('0x3f')]);_0x446a39[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x183fe7[_0x0e82('0x36')],_0x556a2d['filters']));if(_0x183fe7['query'][_0x0e82('0x42')]){_0x446a39[_0x0e82('0x40')]=_[_0x0e82('0x44')](_0x446a39[_0x0e82('0x40')],{'$or':_[_0x0e82('0x30')](_0x446a39[_0x0e82('0x3a')],function(_0x350b6c){var _0x56804d={};_0x56804d[_0x350b6c]={'$like':'%'+_0x183fe7[_0x0e82('0x36')]['filter']+'%'};return _0x56804d;})});}_0x446a39=_['merge']({},_0x446a39,_0x183fe7[_0x0e82('0x45')]);return _0x445d82['getAgents'](_0x446a39);}})[_0x0e82('0x27')](function(_0x2ca1e2){if(_0x2ca1e2){_0x384428=_0x2ca1e2['length'];if(!_0x183fe7[_0x0e82('0x36')][_0x0e82('0x3d')](_0x0e82('0x7b'))){_0x446a39[_0x0e82('0x1f')]=qs[_0x0e82('0x1f')](_0x183fe7[_0x0e82('0x36')][_0x0e82('0x1f')]);_0x446a39['offset']=qs[_0x0e82('0x1d')](_0x183fe7['query']['offset']);}return _0x445d82['getAgents'](_0x446a39);}})[_0x0e82('0x27')](function(_0x30f947){if(_0x30f947){return _0x30f947?{'count':_0x384428,'rows':_0x30f947}:null;}})[_0x0e82('0x27')](respondWithResult(_0x27928f,null))[_0x0e82('0x48')](handleError(_0x27928f,null));};exports[_0x0e82('0x7c')]=function(_0x33eaa3,_0x57d238,_0x890f08){var _0x4a5773={};var _0x5f59f1={};var _0x48bd88;var _0x1fad5a;return db['VoicePrefix']['findOne']({'where':{'id':_0x33eaa3[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x57d238,null))['then'](function(_0x5800a5){if(_0x5800a5){_0x48bd88=_0x5800a5;_0x5f59f1[_0x0e82('0x35')]=_['keys'](db[_0x0e82('0x7d')][_0x0e82('0x32')]);_0x5f59f1[_0x0e82('0x36')]=_['keys'](_0x33eaa3[_0x0e82('0x36')]);_0x5f59f1[_0x0e82('0x38')]=_['intersection'](_0x5f59f1[_0x0e82('0x35')],_0x5f59f1[_0x0e82('0x36')]);_0x4a5773['attributes']=_[_0x0e82('0x39')](_0x5f59f1[_0x0e82('0x35')],qs['fields'](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3b')]));_0x4a5773[_0x0e82('0x3a')]=_0x4a5773[_0x0e82('0x3a')]['length']?_0x4a5773['attributes']:_0x5f59f1[_0x0e82('0x35')];_0x4a5773[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3f')]);_0x4a5773[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x33eaa3[_0x0e82('0x36')],_0x5f59f1['filters']));if(_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x42')]){_0x4a5773[_0x0e82('0x40')]=_[_0x0e82('0x44')](_0x4a5773['where'],{'$or':_[_0x0e82('0x30')](_0x4a5773[_0x0e82('0x3a')],function(_0x51b943){var _0x148a2f={};_0x148a2f[_0x51b943]={'$like':'%'+_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x42')]+'%'};return _0x148a2f;})});}_0x4a5773=_[_0x0e82('0x44')]({},_0x4a5773,_0x33eaa3[_0x0e82('0x45')]);return _0x48bd88[_0x0e82('0x7c')](_0x4a5773);}})['then'](function(_0x17a56d){if(_0x17a56d){_0x1fad5a=_0x17a56d['length'];if(!_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3d')](_0x0e82('0x7b'))){_0x4a5773[_0x0e82('0x1f')]=qs[_0x0e82('0x1f')](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x1f')]);_0x4a5773[_0x0e82('0x1d')]=qs['offset'](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x1d')]);}return _0x48bd88[_0x0e82('0x7c')](_0x4a5773);}})['then'](function(_0x273036){if(_0x273036){return _0x273036?{'count':_0x1fad5a,'rows':_0x273036}:null;}})['then'](respondWithResult(_0x57d238,null))[_0x0e82('0x48')](handleError(_0x57d238,null));};exports['addTeams']=function(_0x317358,_0x3691ac,_0x436572){var _0x532041=_0x317358[_0x0e82('0x6d')][_0x0e82('0x72')];var _0xae4be5;return db[_0x0e82('0x7d')]['findAll']({'where':{'id':_0x532041},'attributes':['id'],'include':[{'model':db[_0x0e82('0x7e')],'as':_0x0e82('0x7f'),'attributes':['id',_0x0e82('0x2e'),_0x0e82('0x80'),_0x0e82('0x81'),'interface'],'raw':!![]}]})[_0x0e82('0x27')](function(_0x252df2){if(_0x252df2){_0xae4be5=_0x252df2;var _0xca734b=_[_0x0e82('0x82')](_0x252df2,function(_0x456bad){var _0x4ed7ba=_0x456bad['get']({'plain':!![]});return _0x4ed7ba[_0x0e82('0x7f')];});return db[_0x0e82('0x31')]['find']({'where':{'id':_0x317358['params']['id']}})[_0x0e82('0x27')](function(_0x226726){return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x326ed0){return _0x226726[_0x0e82('0x83')](_0x532041,{'transaction':_0x326ed0})['then'](function(){return BPromise[_0x0e82('0x84')](_0xae4be5,function(_0x270ad0){return db[_0x0e82('0x85')][_0x0e82('0x86')]({'TeamId':_0x270ad0['id'],'VoicePrefixId':_0x317358['params']['id']},{'transaction':_0x326ed0});});})['then'](function(){return BPromise[_0x0e82('0x84')](_0xca734b,function(_0x38a73a){return db[_0x0e82('0x87')][_0x0e82('0x88')]({'where':{'UserId':_0x38a73a['id'],'VoicePrefixId':_0x317358[_0x0e82('0x4a')]['id']},'transaction':_0x326ed0});});})['then'](function(){_0xca734b['forEach'](function(_0x3ab464){socket['emit'](_0x0e82('0x76'),{'UserId':_0x3ab464['id'],'VoicePrefixId':_0x226726['id']});});});});});}})['then'](respondWithStatusCode(_0x3691ac,null))[_0x0e82('0x48')](handleError(_0x3691ac,null));};exports[_0x0e82('0x89')]=function(_0x33d446,_0x34d730,_0x1c1a0d){return db[_0x0e82('0x7d')]['findAll']({'where':{'id':_0x33d446['query'][_0x0e82('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e82('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x0e82('0x27')](handleEntityNotFound(_0x34d730,null))[_0x0e82('0x27')](function(_0x1c5350){var _0x396f44=_[_0x0e82('0x30')](_0x1c5350,'id');var _0x1d79b5=[];var _0x1e305f=[];var _0x25c63b=squel['select']();_0x25c63b[_0x0e82('0x8a')](_0x0e82('0x8b'))[_0x0e82('0x8c')](_0x0e82('0x8d'),'tq')[_0x0e82('0x8e')](_0x0e82('0x8f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0e82('0x40')](_0x0e82('0x90'),_0x33d446[_0x0e82('0x4a')]['id']);for(var _0x5d13ab=0x0;_0x5d13ab<_0x1c5350[_0x0e82('0x3c')];_0x5d13ab+=0x1){let _0xf8b029=_0x1c5350[_0x5d13ab];for(var _0x5581e6=0x0;_0x5581e6<_0xf8b029[_0x0e82('0x7f')][_0x0e82('0x3c')];_0x5581e6+=0x1){let _0x524665=_0xf8b029[_0x0e82('0x7f')][_0x5581e6];var _0x32264b=_0x25c63b[_0x0e82('0x91')]();_0x32264b[_0x0e82('0x40')](_0x0e82('0x92'),_0x524665['id']);_0x1e305f[_0x0e82('0x67')](db[_0x0e82('0x50')][_0x0e82('0x36')](_0x32264b[_0x0e82('0x93')](),{'type':db[_0x0e82('0x50')]['QueryTypes'][_0x0e82('0x94')]})['then'](function(_0x546f99){if(_0x546f99[_0x0e82('0x3c')]===0x1){return _0x524665['id'];}else{var _0x4b3009=_[_0x0e82('0x95')](_[_0x0e82('0x30')](_0x546f99,_0x0e82('0x96')),function(_0x414250){return _[_0x0e82('0x97')](_0x396f44,_0x414250);});if(_0x4b3009){return _0x524665['id'];}}}));}}return BPromise['all'](_0x1e305f)[_0x0e82('0x27')](function(_0x1df810){_0x1d79b5=_(_0x1d79b5)['union'](_0x1df810)['compact']()[_0x0e82('0x98')]();return db['VoicePrefix'][_0x0e82('0x4d')]({'where':{'id':_0x33d446[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](function(_0x4f2118){return db['sequelize'][_0x0e82('0x51')](function(_0x5e7f11){return _0x4f2118[_0x0e82('0x89')](_0x33d446['query'][_0x0e82('0x72')],{'transaction':_0x5e7f11})[_0x0e82('0x27')](function(){if(!_['isEmpty'](_0x1d79b5)){return _0x4f2118[_0x0e82('0x77')](_0x1d79b5,{'transaction':_0x5e7f11});}})[_0x0e82('0x27')](function(){_0x1d79b5['forEach'](function(_0x22da22){socket[_0x0e82('0x75')]('userVoicePrefix:remove',{'UserId':_0x22da22,'VoicePrefixId':_0x4f2118['id']});});});});});});})['then'](respondWithStatusCode(_0x34d730,null))[_0x0e82('0x48')](handleError(_0x34d730,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ca026c2..0a6d6f6 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 _0x341d=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x47c005,_0xa5c9a5){var _0x25bf04=function(_0x41c37e){while(--_0x41c37e){_0x47c005['push'](_0x47c005['shift']());}};_0x25bf04(++_0xa5c9a5);}(_0x341d,0xd0));var _0xd341=function(_0x539861,_0x205ca8){_0x539861=_0x539861-0x0;var _0x32f06d=_0x341d[_0x539861];return _0x32f06d;};'use strict';var EventEmitter=require(_0xd341('0x0'));var VoicePrefix=require(_0xd341('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd341('0x2')](0x0);var events={'afterCreate':_0xd341('0x3'),'afterUpdate':_0xd341('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf2bc08){return function(_0xe2d584,_0x486d3d,_0x14dc47){VoicePrefixEvents[_0xd341('0x5')](_0xf2bc08+':'+_0xe2d584['id'],_0xe2d584);VoicePrefixEvents[_0xd341('0x5')](_0xf2bc08,_0xe2d584);_0x14dc47(null);};}for(var e in events){if(events[_0xd341('0x6')](e)){var event=events[e];VoicePrefix[_0xd341('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x8e47=['remove','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x567647,_0x6e3e0d){var _0x440702=function(_0x1edaa0){while(--_0x1edaa0){_0x567647['push'](_0x567647['shift']());}};_0x440702(++_0x6e3e0d);}(_0x8e47,0xdb));var _0x78e4=function(_0xf9b7a3,_0x2a66f4){_0xf9b7a3=_0xf9b7a3-0x0;var _0x25f0a2=_0x8e47[_0xf9b7a3];return _0x25f0a2;};'use strict';var EventEmitter=require(_0x78e4('0x0'));var VoicePrefix=require(_0x78e4('0x1'))['db'][_0x78e4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x78e4('0x3')](0x0);var events={'afterCreate':_0x78e4('0x4'),'afterUpdate':_0x78e4('0x5'),'afterDestroy':_0x78e4('0x6')};function emitEvent(_0x235d3e){return function(_0x2bf9d2,_0x32905d,_0x1c2818){VoicePrefixEvents['emit'](_0x235d3e+':'+_0x2bf9d2['id'],_0x2bf9d2);VoicePrefixEvents['emit'](_0x235d3e,_0x2bf9d2);_0x1c2818(null);};}for(var e in events){if(events[_0x78e4('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x78e4('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 704eecb..2a6b82b 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 _0xfabd=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','util','../../config/logger','api','moment','bluebird'];(function(_0x501c32,_0x2f24c9){var _0x9bd372=function(_0x34c2be){while(--_0x34c2be){_0x501c32['push'](_0x501c32['shift']());}};_0x9bd372(++_0x2f24c9);}(_0xfabd,0x1e1));var _0xdfab=function(_0x174e68,_0xaaa417){_0x174e68=_0x174e68-0x0;var _0x12957e=_0xfabd[_0x174e68];return _0x12957e;};'use strict';var _=require('lodash');var util=require(_0xdfab('0x0'));var logger=require(_0xdfab('0x1'))(_0xdfab('0x2'));var moment=require(_0xdfab('0x3'));var BPromise=require(_0xdfab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdfab('0x5'));var attributes=require(_0xdfab('0x6'));module['exports']=function(_0x5f40f0,_0x110185){return _0x5f40f0[_0xdfab('0x7')](_0xdfab('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x393f=['request-promise','path','rimraf','./voicePrefix.attributes','exports','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x393f,0x74));var _0xf393=function(_0x121985,_0x252db3){_0x121985=_0x121985-0x0;var _0x20bc79=_0x393f[_0x121985];return _0x20bc79;};'use strict';var _=require('lodash');var util=require(_0xf393('0x0'));var logger=require(_0xf393('0x1'))(_0xf393('0x2'));var moment=require(_0xf393('0x3'));var BPromise=require('bluebird');var rp=require(_0xf393('0x4'));var fs=require('fs');var path=require(_0xf393('0x5'));var rimraf=require(_0xf393('0x6'));var config=require('../../config/environment');var attributes=require(_0xf393('0x7'));module[_0xf393('0x8')]=function(_0x4d1fc3,_0x329a86){return _0x4d1fc3['define']('VoicePrefix',attributes,{'tableName':_0xf393('0x9'),'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 6ac1eb9..bb4db5c 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 _0x794b=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0xff7781,_0x2a5edb){var _0x25b5d4=function(_0xd74778){while(--_0xd74778){_0xff7781['push'](_0xff7781['shift']());}};_0x25b5d4(++_0x2a5edb);}(_0x794b,0x1c2));var _0xb794=function(_0x51a07a,_0xbd0fc7){_0x51a07a=_0x51a07a-0x0;var _0x57531e=_0x794b[_0x51a07a];return _0x57531e;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});config[_0xb794('0x9')]=_[_0xb794('0xa')](config[_0xb794('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb794('0xb'))(new Redis(config[_0xb794('0x9')]));require(_0xb794('0xc'))[_0xb794('0xd')](socket);function respondWithRpcPromise(_0x2d0d36,_0xf87756,_0x13bd3d){return new BPromise(function(_0x1f224a,_0x19cfa0){return client[_0xb794('0xe')](_0x2d0d36,_0x13bd3d)[_0xb794('0xf')](function(_0x1b1cee){logger[_0xb794('0x10')](_0xb794('0x11'),_0xf87756,_0xb794('0x12'));logger[_0xb794('0x13')](_0xb794('0x14'),_0xf87756,_0xb794('0x12'),JSON[_0xb794('0x15')](_0x1b1cee));if(_0x1b1cee[_0xb794('0x16')]){if(_0x1b1cee[_0xb794('0x16')]['code']===0x1f4){logger[_0xb794('0x16')](_0xb794('0x11'),_0xf87756,_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);return _0x19cfa0(_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);}logger['error'](_0xb794('0x11'),_0xf87756,_0x1b1cee[_0xb794('0x16')]['message']);return _0x1f224a(_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);}else{logger['info'](_0xb794('0x11'),_0xf87756,_0xb794('0x12'));_0x1f224a(_0x1b1cee[_0xb794('0x18')]['message']);}})[_0xb794('0x19')](function(_0xa0c655){logger['error'](_0xb794('0x11'),_0xf87756,_0xa0c655);_0x19cfa0(_0xa0c655);});});} \ No newline at end of file +var _0xffd6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4f027d,_0x3f9587){var _0xc46890=function(_0x27d06c){while(--_0x27d06c){_0x4f027d['push'](_0x4f027d['shift']());}};_0xc46890(++_0x3f9587);}(_0xffd6,0x97));var _0x6ffd=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xffd6[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b697aa5..6c76916 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 _0xa62c=['./voicePrefix.events','save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x213856,_0x34af6b){var _0x522c80=function(_0x2f35e8){while(--_0x2f35e8){_0x213856['push'](_0x213856['shift']());}};_0x522c80(++_0x34af6b);}(_0xa62c,0x70));var _0xca62=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xa62c[_0x46111d];return _0xe82586;};'use strict';var VoicePrefixEvents=require(_0xca62('0x0'));var events=[_0xca62('0x1'),_0xca62('0x2'),_0xca62('0x3')];function createListener(_0x27ee5c,_0x1eed11){return function(_0x11ad76){_0x1eed11['emit'](_0x27ee5c,_0x11ad76);};}function removeListener(_0x35180a,_0x3da6b7){return function(){VoicePrefixEvents[_0xca62('0x4')](_0x35180a,_0x3da6b7);};}exports[_0xca62('0x5')]=function(_0x1e51ba){for(var _0x31d267=0x0,_0x310378=events[_0xca62('0x6')];_0x31d267<_0x310378;_0x31d267++){var _0x5da9b9=events[_0x31d267];var _0x2160c4=createListener(_0xca62('0x7')+_0x5da9b9,_0x1e51ba);VoicePrefixEvents['on'](_0x5da9b9,_0x2160c4);}}; \ No newline at end of file +var _0x4e61=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4e61,0x8c));var _0x14e6=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x4e61[_0x16dbcd];return _0x34706e;};'use strict';var VoicePrefixEvents=require(_0x14e6('0x0'));var events=[_0x14e6('0x1'),_0x14e6('0x2'),'update'];function createListener(_0x53cf7e,_0x1fc8bf){return function(_0x3ff2fb){_0x1fc8bf[_0x14e6('0x3')](_0x53cf7e,_0x3ff2fb);};}function removeListener(_0xdcdb2a,_0x1cef29){return function(){VoicePrefixEvents[_0x14e6('0x4')](_0xdcdb2a,_0x1cef29);};}exports[_0x14e6('0x5')]=function(_0x5ae983){for(var _0x78f960=0x0,_0x9f9c31=events[_0x14e6('0x6')];_0x78f960<_0x9f9c31;_0x78f960++){var _0x91ca48=events[_0x78f960];var _0x34b4eb=createListener(_0x14e6('0x7')+_0x91ca48,_0x5ae983);VoicePrefixEvents['on'](_0x91ca48,_0x34b4eb);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 99d9ba9..d352682 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xb10b,0x12a));var _0xbb10=function(_0x20d434,_0x3fb64f){_0x20d434=_0x20d434-0x0;var _0x1d90f1=_0xb10b[_0x20d434];return _0x1d90f1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2fecd5,_0x26c4cb){var _0x220b9b=function(_0x224fb3){while(--_0x224fb3){_0x2fecd5['push'](_0x2fecd5['shift']());}};_0x220b9b(++_0x26c4cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 267cf04..91c0701 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 _0x73e3=['wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','outbound','default','ringall','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','dialMethod','preview','booked','roundrobin','INTEGER','yes','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x73e3,0xcf));var _0x373e=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x73e3[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require('sequelize');module[_0x373e('0x0')]={'name':{'type':Sequelize[_0x373e('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x373e('0x2')]('inbound',_0x373e('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x4')},'announce':{'type':Sequelize[_0x373e('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x373e('0x2')]('rr',_0x373e('0x5'),'leastrecent','fewestcalls',_0x373e('0x6'),_0x373e('0x7'),_0x373e('0x8'),_0x373e('0x9'),_0x373e('0xa')),'allowNull':![],'defaultValue':_0x373e('0x5'),'set':function(_0x4f05c9){this['setDataValue'](_0x373e('0xb'),_0x4f05c9?_0x4f05c9:_0x373e('0x7'));},'get':function(){var _0x4244c8=this['getDataValue']('type');var _0x153003=this[_0x373e('0xc')](_0x373e('0xd'));var _0x2eeb32=this[_0x373e('0xc')]('strategy');if(_0x4244c8==='outbound'){if(_0x153003===_0x373e('0xe')){return null;}if(_0x153003===_0x373e('0xf')&&![_0x373e('0x7'),_0x373e('0x10')]['includes'](_0x2eeb32)){this['setDataValue'](_0x373e('0xb'),_0x373e('0x7'));}}return _0x2eeb32;}},'servicelevel':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x373e('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x373e('0x2')]('yes','no'),'defaultValue':_0x373e('0x12')},'autopause':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x373e('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x373e('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x373e('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x373e('0x2')]('yes','no'),'defaultValue':_0x373e('0x12')},'announce_holdtime':{'type':Sequelize[_0x373e('0x2')]('yes','no',_0x373e('0x13')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x373e('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x373e('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x373e('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x373e('0x1')]},'queue_youarenext':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x373e('0x1')]},'queue_quantity2':{'type':Sequelize[_0x373e('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x373e('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x44c38e){this[_0x373e('0x14')](_0x373e('0x15'),_0x44c38e?_0x44c38e[_0x373e('0x16')](','):[]);},'get':function(){return this[_0x373e('0xc')]('periodic_announce')?this[_0x373e('0xc')]('periodic_announce')[_0x373e('0x17')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x533d1e){this[_0x373e('0x14')](_0x373e('0x18'),_0x533d1e?_0x533d1e['join'](','):undefined);},'get':function(){return this[_0x373e('0xc')](_0x373e('0x18'))?this[_0x373e('0xc')](_0x373e('0x18'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x373e('0x1')],'defaultValue':'no','set':function(_0x3882f8){this[_0x373e('0x14')](_0x373e('0x19'),_0x3882f8?_0x3882f8[_0x373e('0x16')](','):undefined);},'get':function(){return this[_0x373e('0xc')](_0x373e('0x19'))?this[_0x373e('0xc')](_0x373e('0x19'))[_0x373e('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x373e('0x1')]},'description':{'type':Sequelize[_0x373e('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4e3259){this[_0x373e('0x14')](_0x373e('0x1a'),_0x4e3259);if(_0x4e3259){if(this[_0x373e('0xc')]('wrapuptime')<0x2){this[_0x373e('0x14')](_0x373e('0x1b'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':0x0,'comment':_0x373e('0x1d')},'dialMethod':{'type':Sequelize[_0x373e('0x2')](_0x373e('0xe'),_0x373e('0x1e'),_0x373e('0x1f'),_0x373e('0x20'),_0x373e('0xf')),'defaultValue':_0x373e('0x1e'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x373e('0x11')](0x4)[_0x373e('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x373e('0x22')},'dialLimitQueue':{'type':Sequelize[_0x373e('0x11')](0x4)[_0x373e('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x373e('0x23')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x373e('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x373e('0x24')),'defaultValue':_0x373e('0x24'),'comment':_0x373e('0x25')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x373e('0x26')](0x2)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x373e('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0x373e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x373e('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x28')},'dialQueueOptions':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x29'),'comment':_0x373e('0x2a')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2b')},'dialQueueProject':{'type':Sequelize[_0x373e('0x1')],'comment':_0x373e('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'comment':_0x373e('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x373e('0x33')},'dialTimezone':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x373e('0x2')]('always',_0x373e('0x35'),_0x373e('0x36')),'defaultValue':_0x373e('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x373e('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x373e('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x373e('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x373e('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x373e('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x373e('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x373e('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x373e('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':0x0,'comment':_0x373e('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x373e('0x2')]('DESC',_0x373e('0x3f')),'defaultValue':_0x373e('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x373e('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x373e('0x41')},'dialCutDigit':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x373e('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x373e('0x11')],'allowNull':!![],'comment':_0x373e('0x4a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x373e('0x4b'),'set':function(_0x1f0472){if(!_0x1f0472)this['setDataValue'](_0x373e('0x4c'),null);this[_0x373e('0x14')](_0x373e('0x4d'),_0x1f0472);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd121=['dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','outbound','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd121,0x186));var _0x1d12=function(_0x2582f1,_0x5210fd){_0x2582f1=_0x2582f1-0x0;var _0x2a2252=_0xd121[_0x2582f1];return _0x2a2252;};'use strict';var Sequelize=require(_0x1d12('0x0'));module[_0x1d12('0x1')]={'name':{'type':Sequelize[_0x1d12('0x2')],'allowNull':![],'unique':_0x1d12('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1d12('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':_0x1d12('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1d12('0x6')]('rr',_0x1d12('0x7'),_0x1d12('0x8'),_0x1d12('0x9'),_0x1d12('0xa'),_0x1d12('0xb'),_0x1d12('0xc'),_0x1d12('0xd'),_0x1d12('0xe')),'allowNull':![],'defaultValue':_0x1d12('0x7'),'set':function(_0x4eed85){this[_0x1d12('0xf')](_0x1d12('0x10'),_0x4eed85?_0x4eed85:'rrmemory');},'get':function(){var _0xe1c3e8=this[_0x1d12('0x11')]('type');var _0x444566=this[_0x1d12('0x11')]('dialMethod');var _0x24b80a=this[_0x1d12('0x11')](_0x1d12('0x10'));if(_0xe1c3e8===_0x1d12('0x12')){if(_0x444566===_0x1d12('0x13')){return null;}if(_0x444566===_0x1d12('0x14')&&![_0x1d12('0xb'),_0x1d12('0x15')]['includes'](_0x24b80a)){this['setDataValue'](_0x1d12('0x10'),'rrmemory');}}return _0x24b80a;}},'servicelevel':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1d12('0x16')](0xb)},'timeout':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1d12('0x2')]},'weight':{'type':Sequelize[_0x1d12('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':_0x1d12('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no',_0x1d12('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1d12('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1d12('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1d12('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':_0x1d12('0x17')},'announce_holdtime':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x1d12('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1d12('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1d12('0x2')]},'queue_youarenext':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1d12('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1d12('0x2')]},'queue_quantity2':{'type':Sequelize[_0x1d12('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1d12('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1d12('0x19')],'set':function(_0x18a7e5){this[_0x1d12('0xf')]('periodic_announce',_0x18a7e5?_0x18a7e5['join'](','):[]);},'get':function(){return this['getDataValue'](_0x1d12('0x1a'))?this[_0x1d12('0x11')](_0x1d12('0x1a'))[_0x1d12('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x1d12('0x17'),'set':function(_0x4ea12b){this[_0x1d12('0xf')](_0x1d12('0x1c'),_0x4ea12b?_0x4ea12b[_0x1d12('0x1d')](','):undefined);},'get':function(){return this[_0x1d12('0x11')]('joinempty')?this['getDataValue'](_0x1d12('0x1c'))[_0x1d12('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':'no','set':function(_0x470003){this[_0x1d12('0xf')](_0x1d12('0x1e'),_0x470003?_0x470003[_0x1d12('0x1d')](','):undefined);},'get':function(){return this[_0x1d12('0x11')](_0x1d12('0x1e'))?this[_0x1d12('0x11')](_0x1d12('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1d12('0x2')]},'description':{'type':Sequelize[_0x1d12('0x2')]},'acw':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':0x0,'set':function(_0x216013){this[_0x1d12('0xf')](_0x1d12('0x20'),_0x216013);if(_0x216013){if(this[_0x1d12('0x11')](_0x1d12('0x21'))<0x2){this[_0x1d12('0xf')](_0x1d12('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1d12('0x22')},'dialMethod':{'type':Sequelize[_0x1d12('0x6')]('preview','progressive',_0x1d12('0x23'),_0x1d12('0x24'),_0x1d12('0x14')),'defaultValue':_0x1d12('0x25'),'comment':_0x1d12('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1d12('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d12('0x28')},'dialLimitQueue':{'type':Sequelize[_0x1d12('0x16')](0x4)[_0x1d12('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d12('0x29')},'dialPowerLevel':{'type':Sequelize[_0x1d12('0x2a')](0x2)[_0x1d12('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1d12('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x2c'),'dropRate'),'defaultValue':_0x1d12('0x2d'),'comment':_0x1d12('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1d12('0x2a')](0x2)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1d12('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1d12('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d12('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1d12('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':_0x1d12('0x31'),'comment':_0x1d12('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x33')},'dialQueueProject':{'type':Sequelize[_0x1d12('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'comment':_0x1d12('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x3a'),_0x1d12('0x3b'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1d12('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1d12('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1d12('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d12('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d12('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d12('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d12('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1d12('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1d12('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1d12('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1d12('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d12('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1d12('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':0x0,'comment':_0x1d12('0x47')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x48'),_0x1d12('0x49')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x1d12('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d12('0x4a')},'dialCutDigit':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d12('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x51')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d12('0x16')],'allowNull':!![],'comment':_0x1d12('0x54')},'mandatoryDisposition':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![],'comment':_0x1d12('0x55'),'set':function(_0x28d544){if(!_0x28d544)this[_0x1d12('0xf')]('mandatoryDispositionPauseId',null);this[_0x1d12('0xf')](_0x1d12('0x56'),_0x28d544);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index b37115a..3986324 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x4da3fc,_0x30412f){var _0x5025be=function(_0x52577f){while(--_0x52577f){_0x4da3fc['push'](_0x4da3fc['shift']());}};_0x5025be(++_0x30412f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x5fc3[_0x466bc5];return _0x138952;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x35055e,_0x5ada66){var _0x1475aa=function(_0x1e2dbd){while(--_0x1e2dbd){_0x35055e['push'](_0x35055e['shift']());}};_0x1475aa(++_0x5ada66);}(_0xe14b,0x93));var _0xbe14=function(_0x3c9c5a,_0x476407){_0x3c9c5a=_0x3c9c5a-0x0;var _0x565441=_0xe14b[_0x3c9c5a];return _0x565441;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d37d6f9..1f553f6 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 _0x48e6=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4e23d8,_0x1495d7){var _0x99d01b=function(_0x8be219){while(--_0x8be219){_0x4e23d8['push'](_0x4e23d8['shift']());}};_0x99d01b(++_0x1495d7);}(_0x48e6,0xdd));var _0x648e=function(_0x532556,_0x36817f){_0x532556=_0x532556-0x0;var _0x57815f=_0x48e6[_0x532556];return _0x57815f;};'use strict';var EventEmitter=require(_0x648e('0x0'));var VoiceQueue=require(_0x648e('0x1'))['db'][_0x648e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x648e('0x3')](0x0);var events={'afterCreate':_0x648e('0x4'),'afterUpdate':_0x648e('0x5'),'afterDestroy':_0x648e('0x6')};function emitEvent(_0xcea1fc){return function(_0x23b1c4,_0x20a5f5,_0x1430fd){VoiceQueueEvents[_0x648e('0x7')](_0xcea1fc+':'+_0x23b1c4['id'],_0x23b1c4);VoiceQueueEvents[_0x648e('0x7')](_0xcea1fc,_0x23b1c4);_0x1430fd(null);};}for(var e in events){if(events[_0x648e('0x8')](e)){var event=events[e];VoiceQueue[_0x648e('0x9')](e,emitEvent(event));}}module[_0x648e('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x62be=['update','remove','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save'];(function(_0x1707c9,_0x13a573){var _0x19b212=function(_0x57ecc2){while(--_0x57ecc2){_0x1707c9['push'](_0x1707c9['shift']());}};_0x19b212(++_0x13a573);}(_0x62be,0x83));var _0xe62b=function(_0x33ebd4,_0x294358){_0x33ebd4=_0x33ebd4-0x0;var _0xad487a=_0x62be[_0x33ebd4];return _0xad487a;};'use strict';var EventEmitter=require(_0xe62b('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xe62b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe62b('0x2')](0x0);var events={'afterCreate':_0xe62b('0x3'),'afterUpdate':_0xe62b('0x4'),'afterDestroy':_0xe62b('0x5')};function emitEvent(_0x5880f6){return function(_0x2c99b9,_0x5b0e90,_0x1e856d){VoiceQueueEvents['emit'](_0x5880f6+':'+_0x2c99b9['id'],_0x2c99b9);VoiceQueueEvents['emit'](_0x5880f6,_0x2c99b9);_0x1e856d(null);};}for(var e in events){if(events[_0xe62b('0x6')](e)){var event=events[e];VoiceQueue[_0xe62b('0x7')](e,emitEvent(event));}}module[_0xe62b('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 825cf3f..6128e29 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5cc169,_0x3fb1d5){var _0x274ad8=function(_0x15fef2){while(--_0x15fef2){_0x5cc169['push'](_0x5cc169['shift']());}};_0x274ad8(++_0x3fb1d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1d7645,_0x27aa61){var _0x3aebe9=function(_0x4b8bfb){while(--_0x4b8bfb){_0x1d7645['push'](_0x1d7645['shift']());}};_0x3aebe9(++_0x27aa61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 145f20e..e8fb600 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 _0x31d2=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','moment','bluebird'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x31d2,0x18e));var _0x231d=function(_0xb9b1d4,_0x2220e7){_0xb9b1d4=_0xb9b1d4-0x0;var _0x47d0b0=_0x31d2[_0xb9b1d4];return _0x47d0b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x231d('0x0'));var BPromise=require(_0x231d('0x1'));var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x231d('0x4'));var logger=require(_0x231d('0x5'))(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')][_0x231d('0xa')]({'port':0x232a});config[_0x231d('0xb')]=_[_0x231d('0xc')](config['redis'],{'host':_0x231d('0xd'),'port':0x18eb});var socket=require(_0x231d('0xe'))(new Redis(config['redis']));require(_0x231d('0xf'))[_0x231d('0x10')](socket);function respondWithRpcPromise(_0x3e9e9e,_0x5c0eed,_0x2e4db0){return new BPromise(function(_0x4a79eb,_0x11ed50){return client[_0x231d('0x11')](_0x3e9e9e,_0x2e4db0)['then'](function(_0x14a3ba){logger[_0x231d('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x5c0eed,_0x231d('0x13'));logger[_0x231d('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c0eed,_0x231d('0x13'),JSON[_0x231d('0x15')](_0x14a3ba));if(_0x14a3ba[_0x231d('0x16')]){if(_0x14a3ba['error'][_0x231d('0x17')]===0x1f4){logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x14a3ba['error'][_0x231d('0x19')]);return _0x11ed50(_0x14a3ba[_0x231d('0x16')][_0x231d('0x19')]);}logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x14a3ba['error']['message']);return _0x4a79eb(_0x14a3ba[_0x231d('0x16')][_0x231d('0x19')]);}else{logger[_0x231d('0x12')](_0x231d('0x18'),_0x5c0eed,_0x231d('0x13'));_0x4a79eb(_0x14a3ba[_0x231d('0x1a')][_0x231d('0x19')]);}})[_0x231d('0x1b')](function(_0x178b6a){logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x178b6a);_0x11ed50(_0x178b6a);});});}exports['GetVoiceQueue']=function(_0x22513a){var _0x204dfc=this;return new Promise(function(_0x5dd9e6,_0x331788){return db[_0x231d('0x1c')]['findAll']({'raw':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x1e')]===undefined?!![]:![]:!![],'where':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x1f')]||null:null,'attributes':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x20')]||null:null,'limit':_0x22513a['options']?_0x22513a['options'][_0x231d('0x21')]||null:null,'include':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x22')]?_[_0x231d('0x23')](_0x22513a[_0x231d('0x1d')][_0x231d('0x22')],function(_0x525227){return{'model':db[_0x525227[_0x231d('0x24')]],'as':_0x525227['as'],'attributes':_0x525227[_0x231d('0x20')],'include':_0x525227[_0x231d('0x22')]?_[_0x231d('0x23')](_0x525227[_0x231d('0x22')],function(_0x49b3e9){return{'model':db[_0x49b3e9[_0x231d('0x24')]],'as':_0x49b3e9['as'],'attributes':_0x49b3e9[_0x231d('0x20')],'include':_0x49b3e9[_0x231d('0x22')]?_[_0x231d('0x23')](_0x49b3e9[_0x231d('0x22')],function(_0x5aa35d){return{'model':db[_0x5aa35d[_0x231d('0x24')]],'as':_0x5aa35d['as'],'attributes':_0x5aa35d[_0x231d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x231d('0x25')](function(_0x3a5eed){logger['info'](_0x231d('0x26'),_0x22513a);logger[_0x231d('0x14')](_0x231d('0x26'),_0x22513a,JSON[_0x231d('0x15')](_0x3a5eed));_0x5dd9e6(_0x3a5eed);})['catch'](function(_0x406eb2){logger[_0x231d('0x16')](_0x231d('0x26'),_0x406eb2[_0x231d('0x19')],_0x22513a);_0x331788(_0x204dfc[_0x231d('0x16')](0x1f4,_0x406eb2[_0x231d('0x19')]));});});};exports[_0x231d('0x27')]=function(_0x232b77){var _0x39cfc6=this;return new Promise(function(_0x5c24ea,_0x25fd81){return db[_0x231d('0x1c')]['find']({'raw':_0x232b77[_0x231d('0x1d')]?_0x232b77[_0x231d('0x1d')][_0x231d('0x1e')]===undefined?!![]:![]:!![],'where':_0x232b77['options']?_0x232b77[_0x231d('0x1d')]['where']||null:null,'attributes':_0x232b77['options']?_0x232b77[_0x231d('0x1d')][_0x231d('0x20')]||null:null,'include':_0x232b77[_0x231d('0x1d')]?_0x232b77[_0x231d('0x1d')][_0x231d('0x22')]?_[_0x231d('0x23')](_0x232b77[_0x231d('0x1d')]['include'],function(_0x3646dd){return{'model':db[_0x3646dd['model']],'as':_0x3646dd['as'],'attributes':_0x3646dd['attributes'],'include':_0x3646dd[_0x231d('0x22')]?_[_0x231d('0x23')](_0x3646dd[_0x231d('0x22')],function(_0x24ac90){return{'model':db[_0x24ac90[_0x231d('0x24')]],'as':_0x24ac90['as'],'attributes':_0x24ac90[_0x231d('0x20')],'include':_0x24ac90['include']?_[_0x231d('0x23')](_0x24ac90['include'],function(_0x5cf498){return{'model':db[_0x5cf498['model']],'as':_0x5cf498['as'],'attributes':_0x5cf498[_0x231d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3b5d){logger[_0x231d('0x12')](_0x231d('0x27'),_0x232b77);logger['debug'](_0x231d('0x27'),_0x232b77,JSON['stringify'](_0x2a3b5d));_0x5c24ea(_0x2a3b5d);})['catch'](function(_0x2fbf81){logger[_0x231d('0x16')](_0x231d('0x27'),_0x2fbf81[_0x231d('0x19')],_0x232b77);_0x25fd81(_0x39cfc6[_0x231d('0x16')](0x1f4,_0x2fbf81[_0x231d('0x19')]));});});}; \ No newline at end of file +var _0x8ca1=['jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','then','catch','find','where','ShowVoiceQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ca1,0x91));var _0x18ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ca1[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18ca('0x0'));var BPromise=require(_0x18ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18ca('0x2'));var db=require(_0x18ca('0x3'))['db'];var utils=require(_0x18ca('0x4'));var logger=require(_0x18ca('0x5'))(_0x18ca('0x6'));var config=require('../../config/environment');var jayson=require(_0x18ca('0x7'));var client=jayson[_0x18ca('0x8')][_0x18ca('0x9')]({'port':0x232a});config[_0x18ca('0xa')]=_['defaults'](config[_0x18ca('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18ca('0xb'))(new Redis(config[_0x18ca('0xa')]));require(_0x18ca('0xc'))['register'](socket);function respondWithRpcPromise(_0x350a19,_0x5bc02f,_0x5f0631){return new BPromise(function(_0x49d596,_0x348958){return client['request'](_0x350a19,_0x5f0631)['then'](function(_0xf8ffe6){logger[_0x18ca('0xd')](_0x18ca('0xe'),_0x5bc02f,_0x18ca('0xf'));logger[_0x18ca('0x10')](_0x18ca('0x11'),_0x5bc02f,'request\x20sent',JSON[_0x18ca('0x12')](_0xf8ffe6));if(_0xf8ffe6['error']){if(_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x14')]===0x1f4){logger[_0x18ca('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x5bc02f,_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x15')]);return _0x348958(_0xf8ffe6[_0x18ca('0x13')]['message']);}logger[_0x18ca('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x5bc02f,_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x15')]);return _0x49d596(_0xf8ffe6[_0x18ca('0x13')]['message']);}else{logger[_0x18ca('0xd')](_0x18ca('0xe'),_0x5bc02f,_0x18ca('0xf'));_0x49d596(_0xf8ffe6[_0x18ca('0x16')]['message']);}})['catch'](function(_0x32e410){logger[_0x18ca('0x13')](_0x18ca('0xe'),_0x5bc02f,_0x32e410);_0x348958(_0x32e410);});});}exports[_0x18ca('0x17')]=function(_0x99b0c8){var _0x2666cb=this;return new Promise(function(_0x408a64,_0x30fd05){return db[_0x18ca('0x18')][_0x18ca('0x19')]({'raw':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')]['where']||null:null,'attributes':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1c')]||null:null,'limit':_0x99b0c8['options']?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1d')]||null:null,'include':_0x99b0c8['options']?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x99b0c8[_0x18ca('0x1a')]['include'],function(_0x1e84e9){return{'model':db[_0x1e84e9['model']],'as':_0x1e84e9['as'],'attributes':_0x1e84e9[_0x18ca('0x1c')],'include':_0x1e84e9[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x1e84e9[_0x18ca('0x1e')],function(_0x2ecee2){return{'model':db[_0x2ecee2['model']],'as':_0x2ecee2['as'],'attributes':_0x2ecee2[_0x18ca('0x1c')],'include':_0x2ecee2[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x2ecee2[_0x18ca('0x1e')],function(_0x3c234b){return{'model':db[_0x3c234b[_0x18ca('0x20')]],'as':_0x3c234b['as'],'attributes':_0x3c234b[_0x18ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18ca('0x21')](function(_0x578b55){logger[_0x18ca('0xd')](_0x18ca('0x17'),_0x99b0c8);logger[_0x18ca('0x10')]('GetVoiceQueue',_0x99b0c8,JSON[_0x18ca('0x12')](_0x578b55));_0x408a64(_0x578b55);})[_0x18ca('0x22')](function(_0x1b8d99){logger[_0x18ca('0x13')](_0x18ca('0x17'),_0x1b8d99[_0x18ca('0x15')],_0x99b0c8);_0x30fd05(_0x2666cb[_0x18ca('0x13')](0x1f4,_0x1b8d99['message']));});});};exports['ShowVoiceQueue']=function(_0x49548c){var _0x290fc9=this;return new Promise(function(_0x5d0f7d,_0xc68d55){return db[_0x18ca('0x18')][_0x18ca('0x23')]({'raw':_0x49548c[_0x18ca('0x1a')]?_0x49548c[_0x18ca('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x49548c[_0x18ca('0x1a')]?_0x49548c['options'][_0x18ca('0x24')]||null:null,'attributes':_0x49548c['options']?_0x49548c[_0x18ca('0x1a')][_0x18ca('0x1c')]||null:null,'include':_0x49548c[_0x18ca('0x1a')]?_0x49548c['options'][_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x49548c['options'][_0x18ca('0x1e')],function(_0x7e8861){return{'model':db[_0x7e8861['model']],'as':_0x7e8861['as'],'attributes':_0x7e8861[_0x18ca('0x1c')],'include':_0x7e8861[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x7e8861[_0x18ca('0x1e')],function(_0x470d98){return{'model':db[_0x470d98[_0x18ca('0x20')]],'as':_0x470d98['as'],'attributes':_0x470d98['attributes'],'include':_0x470d98['include']?_['map'](_0x470d98['include'],function(_0x581d99){return{'model':db[_0x581d99[_0x18ca('0x20')]],'as':_0x581d99['as'],'attributes':_0x581d99[_0x18ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18ca('0x21')](function(_0x303a45){logger['info']('ShowVoiceQueue',_0x49548c);logger['debug']('ShowVoiceQueue',_0x49548c,JSON[_0x18ca('0x12')](_0x303a45));_0x5d0f7d(_0x303a45);})[_0x18ca('0x22')](function(_0x5ddcdf){logger[_0x18ca('0x13')](_0x18ca('0x25'),_0x5ddcdf['message'],_0x49548c);_0xc68d55(_0x290fc9[_0x18ca('0x13')](0x1f4,_0x5ddcdf[_0x18ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4edd251..792d04c 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 _0x183e=['removeListener','register','./voiceQueue.events','save','remove','update'];(function(_0x19b866,_0x274cd1){var _0x28aa24=function(_0x46e69a){while(--_0x46e69a){_0x19b866['push'](_0x19b866['shift']());}};_0x28aa24(++_0x274cd1);}(_0x183e,0x86));var _0xe183=function(_0x3522df,_0x189099){_0x3522df=_0x3522df-0x0;var _0x2b77dc=_0x183e[_0x3522df];return _0x2b77dc;};'use strict';var VoiceQueueEvents=require(_0xe183('0x0'));var events=[_0xe183('0x1'),_0xe183('0x2'),_0xe183('0x3')];function createListener(_0x2db71c,_0x16b668){return function(_0x419e66){_0x16b668['emit'](_0x2db71c,_0x419e66);};}function removeListener(_0x30f72c,_0xeb25c1){return function(){VoiceQueueEvents[_0xe183('0x4')](_0x30f72c,_0xeb25c1);};}exports[_0xe183('0x5')]=function(_0x28ad0f){for(var _0x221e47=0x0,_0x1f7356=events['length'];_0x221e47<_0x1f7356;_0x221e47++){var _0x30eaa4=events[_0x221e47];var _0x2380fe=createListener('voiceQueue:'+_0x30eaa4,_0x28ad0f);VoiceQueueEvents['on'](_0x30eaa4,_0x2380fe);}}; \ No newline at end of file +var _0xb01f=['update','emit','removeListener','register','length','./voiceQueue.events','remove'];(function(_0x49c32c,_0x250fdf){var _0x4fa641=function(_0xf882f7){while(--_0xf882f7){_0x49c32c['push'](_0x49c32c['shift']());}};_0x4fa641(++_0x250fdf);}(_0xb01f,0xd7));var _0xfb01=function(_0x386008,_0x384dab){_0x386008=_0x386008-0x0;var _0x31e3ef=_0xb01f[_0x386008];return _0x31e3ef;};'use strict';var VoiceQueueEvents=require(_0xfb01('0x0'));var events=['save',_0xfb01('0x1'),_0xfb01('0x2')];function createListener(_0x321378,_0x2b708e){return function(_0x3d5a34){_0x2b708e[_0xfb01('0x3')](_0x321378,_0x3d5a34);};}function removeListener(_0x4d4dfa,_0x1c2266){return function(){VoiceQueueEvents[_0xfb01('0x4')](_0x4d4dfa,_0x1c2266);};}exports[_0xfb01('0x5')]=function(_0x4a2fa6){for(var _0x42cab0=0x0,_0x34c340=events[_0xfb01('0x6')];_0x42cab0<_0x34c340;_0x42cab0++){var _0x5aa03b=events[_0x42cab0];var _0x3bf3a9=createListener('voiceQueue:'+_0x5aa03b,_0x4a2fa6);VoiceQueueEvents['on'](_0x5aa03b,_0x3bf3a9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 541630f..bca42b0 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 _0x06e2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','post','create','update','delete','destroy','util','path','express','Router','fs-extra'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x06e2,0xa3));var _0x206e=function(_0x5656bc,_0x3585b6){_0x5656bc=_0x5656bc-0x0;var _0x6e5f64=_0x06e2[_0x5656bc];return _0x6e5f64;};'use strict';var multer=require('multer');var util=require(_0x206e('0x0'));var path=require(_0x206e('0x1'));var timeout=require('connect-timeout');var express=require(_0x206e('0x2'));var router=express[_0x206e('0x3')]();var fs_extra=require(_0x206e('0x4'));var auth=require(_0x206e('0x5'));var interaction=require(_0x206e('0x6'));var config=require(_0x206e('0x7'));var controller=require(_0x206e('0x8'));router[_0x206e('0x9')]('/',auth[_0x206e('0xa')](),controller[_0x206e('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x206e('0xc')]);router['get'](_0x206e('0xd'),auth['isAuthenticated'](),controller[_0x206e('0xe')]);router[_0x206e('0x9')](_0x206e('0xf'),auth[_0x206e('0xa')](),controller['show']);router[_0x206e('0x10')]('/',auth[_0x206e('0xa')](),controller[_0x206e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x206e('0x12')]);router[_0x206e('0x13')]('/:id',auth[_0x206e('0xa')](),controller[_0x206e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x30bf=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x28fe4f,_0x28205c){var _0x2ad93e=function(_0x319848){while(--_0x319848){_0x28fe4f['push'](_0x28fe4f['shift']());}};_0x2ad93e(++_0x28205c);}(_0x30bf,0x67));var _0xf30b=function(_0x3ea5a4,_0x4ab044){_0x3ea5a4=_0x3ea5a4-0x0;var _0x2fcdfb=_0x30bf[_0x3ea5a4];return _0x2fcdfb;};'use strict';var multer=require(_0xf30b('0x0'));var util=require(_0xf30b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf30b('0x2'));var router=express['Router']();var fs_extra=require(_0xf30b('0x3'));var auth=require(_0xf30b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf30b('0x5'));var controller=require(_0xf30b('0x6'));router[_0xf30b('0x7')]('/',auth[_0xf30b('0x8')](),controller[_0xf30b('0x9')]);router[_0xf30b('0x7')](_0xf30b('0xa'),auth[_0xf30b('0x8')](),controller[_0xf30b('0xb')]);router[_0xf30b('0x7')](_0xf30b('0xc'),auth['isAuthenticated'](),controller[_0xf30b('0xd')]);router[_0xf30b('0x7')]('/:id',auth[_0xf30b('0x8')](),controller[_0xf30b('0xe')]);router['post']('/',auth[_0xf30b('0x8')](),controller[_0xf30b('0xf')]);router[_0xf30b('0x10')](_0xf30b('0x11'),auth['isAuthenticated'](),controller[_0xf30b('0x12')]);router[_0xf30b('0x13')](_0xf30b('0x11'),auth['isAuthenticated'](),controller[_0xf30b('0x14')]);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 e9d9388..ada3d3d 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 _0x262c=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','INTEGER'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x262c,0x1e1));var _0xc262=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x262c[_0x3d38ae];return _0x3757ee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc262('0x0'));module[_0xc262('0x1')]={'type':{'type':Sequelize[_0xc262('0x2')]},'uniqueid':{'type':Sequelize[_0xc262('0x2')]},'calleridnum':{'type':Sequelize[_0xc262('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc262('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xc262('0x3')],'set':function(_0x485d02){var _0x1d8e96=moment(_0x485d02);var _0x1f0304=moment(this[_0xc262('0x4')](_0xc262('0x5')))[_0xc262('0x6')](_0xc262('0x7'));var _0x363d3d=_0x1d8e96[_0xc262('0x8')](_0x1f0304,'seconds');this[_0xc262('0x9')](_0xc262('0xa'),_0x485d02);this[_0xc262('0x9')](_0xc262('0xb'),_0x363d3d||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc262('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc262('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xc262('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc262('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc262('0x2')]},'context':{'type':Sequelize[_0xc262('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xc262('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc262('0x2')]},'transfer':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc262('0x2')],'comment':_0xc262('0xe')},'transferexten':{'type':Sequelize[_0xc262('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc262('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc262('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc262('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc262('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xc262('0x2')]}}; \ No newline at end of file +var _0x0262=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x0262,0x1e6));var _0x2026=function(_0x15f540,_0x12d887){_0x15f540=_0x15f540-0x0;var _0x533516=_0x0262[_0x15f540];return _0x533516;};'use strict';var Sequelize=require(_0x2026('0x0'));var moment=require(_0x2026('0x1'));module[_0x2026('0x2')]={'type':{'type':Sequelize[_0x2026('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2026('0x3')]},'calleridname':{'type':Sequelize[_0x2026('0x3')]},'queue':{'type':Sequelize[_0x2026('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x2026('0x4')],'set':function(_0x35d4b0){var _0x3caa34=moment(_0x35d4b0);var _0x3a198e=moment(this[_0x2026('0x5')](_0x2026('0x6')))[_0x2026('0x7')](_0x2026('0x8'));var _0x1d572d=_0x3caa34[_0x2026('0x9')](_0x3a198e,_0x2026('0xa'));this['setDataValue'](_0x2026('0xb'),_0x35d4b0);this['setDataValue'](_0x2026('0xc'),_0x1d572d||null);}},'position':{'type':Sequelize[_0x2026('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallerexit':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2026('0x3')],'comment':_0x2026('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2026('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2026('0x3')]},'context':{'type':Sequelize[_0x2026('0x3')]},'exten':{'type':Sequelize[_0x2026('0x3')]},'priority':{'type':Sequelize[_0x2026('0x3')]},'holdtime':{'type':Sequelize[_0x2026('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2026('0x3')]},'transfer':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2026('0x3')],'comment':_0x2026('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2026('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2026('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x2026('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6314726..275bbb7 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 _0xd789=['rows','catch','show','params','include','find','create','body','describe','getVoiceQueuesReport','rimraf','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xd789,0x19a));var _0x9d78=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0xd789[_0x5b13c3];return _0x3d6780;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d78('0x1'));var rp=require(_0x9d78('0x2'));var moment=require('moment');var BPromise=require(_0x9d78('0x3'));var Mustache=require(_0x9d78('0x4'));var util=require(_0x9d78('0x5'));var path=require(_0x9d78('0x6'));var sox=require(_0x9d78('0x7'));var csv=require(_0x9d78('0x8'));var ejs=require(_0x9d78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d78('0xa'));var squel=require(_0x9d78('0xb'));var crypto=require(_0x9d78('0xc'));var jsforce=require(_0x9d78('0xd'));var deskjs=require(_0x9d78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d78('0xf'));var Papa=require(_0x9d78('0x10'));var Redis=require(_0x9d78('0x11'));var authService=require(_0x9d78('0x12'));var qs=require(_0x9d78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d78('0x14'));var logger=require('../../config/logger')(_0x9d78('0x15'));var utils=require(_0x9d78('0x16'));var config=require(_0x9d78('0x17'));var licenseUtil=require(_0x9d78('0x18'));var db=require('../../mysqldb')['db'];config[_0x9d78('0x19')]=_['defaults'](config[_0x9d78('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d78('0x1a'))(new Redis(config[_0x9d78('0x19')]));require('./voiceQueueReport.socket')[_0x9d78('0x1b')](socket);function respondWithStatusCode(_0xa5afd3,_0x195466){_0x195466=_0x195466||0xcc;return function(_0x2d649c){if(_0x2d649c){return _0xa5afd3[_0x9d78('0x1c')](_0x195466);}return _0xa5afd3['status'](_0x195466)[_0x9d78('0x1d')]();};}function respondWithResult(_0x57cb83,_0x108dc8){_0x108dc8=_0x108dc8||0xc8;return function(_0x3eda37){if(_0x3eda37){return _0x57cb83['status'](_0x108dc8)[_0x9d78('0x1e')](_0x3eda37);}};}function respondWithFilteredResult(_0x32bf78,_0x3ab017){return function(_0x3fdfa2){if(_0x3fdfa2){var _0x5d35d8=typeof _0x3ab017[_0x9d78('0x1f')]===_0x9d78('0x20')&&typeof _0x3ab017[_0x9d78('0x21')]===_0x9d78('0x20');var _0x2e4195=_0x3fdfa2[_0x9d78('0x22')];var _0x1c83ac=_0x5d35d8?0x0:_0x3ab017['offset'];var _0x170f8d=_0x5d35d8?_0x3fdfa2['count']:_0x3ab017[_0x9d78('0x1f')]+_0x3ab017[_0x9d78('0x21')];var _0x3e0f08;if(_0x170f8d>=_0x2e4195){_0x170f8d=_0x2e4195;_0x3e0f08=0xc8;}else{_0x3e0f08=0xce;}_0x32bf78[_0x9d78('0x23')](_0x3e0f08);return _0x32bf78['set'](_0x9d78('0x24'),_0x1c83ac+'-'+_0x170f8d+'/'+_0x2e4195)[_0x9d78('0x1e')](_0x3fdfa2);}return null;};}function patchUpdates(_0x5e3f45){return function(_0x1a00e9){try{jsonpatch[_0x9d78('0x25')](_0x1a00e9,_0x5e3f45,!![]);}catch(_0x424717){return BPromise['reject'](_0x424717);}return _0x1a00e9[_0x9d78('0x26')]();};}function saveUpdates(_0x532f0b,_0xa4dd0){return function(_0x4e3ea2){if(_0x4e3ea2){return _0x4e3ea2[_0x9d78('0x27')](_0x532f0b)[_0x9d78('0x28')](function(_0xc4fbc9){return _0xc4fbc9;});}return null;};}function removeEntity(_0x426632,_0x34de66){return function(_0x4b7315){if(_0x4b7315){return _0x4b7315[_0x9d78('0x29')]()['then'](function(){_0x426632[_0x9d78('0x23')](0xcc)[_0x9d78('0x1d')]();});}};}function handleEntityNotFound(_0x22b165,_0x31c93a){return function(_0x163216){if(!_0x163216){_0x22b165['sendStatus'](0x194);}return _0x163216;};}function handleError(_0x8d35dd,_0x24d6dc){_0x24d6dc=_0x24d6dc||0x1f4;return function(_0xa85476){logger[_0x9d78('0x2a')](_0xa85476[_0x9d78('0x2b')]);if(_0xa85476['name']){delete _0xa85476[_0x9d78('0x2c')];}_0x8d35dd['status'](_0x24d6dc)['send'](_0xa85476);};}exports[_0x9d78('0x2d')]=function(_0x1e8de3,_0x4cbf03){var _0x4c0881={},_0x25e49e={},_0x8c85d3={'count':0x0,'rows':[]};var _0x16da74=_[_0x9d78('0x2e')](db[_0x9d78('0x2f')][_0x9d78('0x30')],function(_0x59cab3){return{'name':_0x59cab3[_0x9d78('0x31')],'type':_0x59cab3[_0x9d78('0x32')]['key']};});_0x25e49e[_0x9d78('0x33')]=_[_0x9d78('0x2e')](_0x16da74,_0x9d78('0x2c'));_0x25e49e[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x1e8de3[_0x9d78('0x34')]);_0x25e49e['filters']=_[_0x9d78('0x36')](_0x25e49e[_0x9d78('0x33')],_0x25e49e[_0x9d78('0x34')]);_0x4c0881[_0x9d78('0x37')]=_[_0x9d78('0x36')](_0x25e49e[_0x9d78('0x33')],qs[_0x9d78('0x38')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x38')]));_0x4c0881[_0x9d78('0x37')]=_0x4c0881[_0x9d78('0x37')][_0x9d78('0x39')]?_0x4c0881[_0x9d78('0x37')]:_0x25e49e['model'];if(!_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x3a')]('nolimit')){_0x4c0881[_0x9d78('0x21')]=qs[_0x9d78('0x21')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x21')]);_0x4c0881['offset']=qs[_0x9d78('0x1f')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x1f')]);}_0x4c0881[_0x9d78('0x3b')]=qs[_0x9d78('0x3c')](_0x1e8de3['query'][_0x9d78('0x3c')]);_0x4c0881[_0x9d78('0x3d')]=qs[_0x9d78('0x3e')](_[_0x9d78('0x3f')](_0x1e8de3[_0x9d78('0x34')],_0x25e49e[_0x9d78('0x3e')]),_0x16da74);if(_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x40')]){_0x4c0881[_0x9d78('0x3d')]=_[_0x9d78('0x41')](_0x4c0881[_0x9d78('0x3d')],{'$or':_[_0x9d78('0x2e')](_0x16da74,function(_0x2d42a9){if(_0x2d42a9[_0x9d78('0x32')]!==_0x9d78('0x42')){var _0x731606={};_0x731606[_0x2d42a9['name']]={'$like':'%'+_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x40')]+'%'};return _0x731606;}})});}_0x4c0881=_[_0x9d78('0x41')]({},_0x4c0881,_0x1e8de3[_0x9d78('0x43')]);var _0x3dc376={'where':_0x4c0881[_0x9d78('0x3d')]};return db['VoiceQueueReport']['count'](_0x3dc376)[_0x9d78('0x28')](function(_0x283017){_0x8c85d3[_0x9d78('0x22')]=_0x283017;if(_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x44')]){_0x4c0881['include']=[{'all':!![]}];}return db[_0x9d78('0x2f')][_0x9d78('0x45')](_0x4c0881);})[_0x9d78('0x28')](function(_0x18ac17){_0x8c85d3[_0x9d78('0x46')]=_0x18ac17;return _0x8c85d3;})['then'](respondWithFilteredResult(_0x4cbf03,_0x4c0881))[_0x9d78('0x47')](handleError(_0x4cbf03,null));};exports[_0x9d78('0x48')]=function(_0x4c4240,_0x50854f){var _0x3c11b2={'raw':![],'where':{'id':_0x4c4240[_0x9d78('0x49')]['id']}},_0x226806={};_0x226806[_0x9d78('0x33')]=_['keys'](db[_0x9d78('0x2f')][_0x9d78('0x30')]);_0x226806[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x4c4240[_0x9d78('0x34')]);_0x226806[_0x9d78('0x3e')]=_['intersection'](_0x226806['model'],_0x226806[_0x9d78('0x34')]);_0x3c11b2[_0x9d78('0x37')]=_['intersection'](_0x226806[_0x9d78('0x33')],qs[_0x9d78('0x38')](_0x4c4240[_0x9d78('0x34')][_0x9d78('0x38')]));_0x3c11b2['attributes']=_0x3c11b2[_0x9d78('0x37')][_0x9d78('0x39')]?_0x3c11b2[_0x9d78('0x37')]:_0x226806[_0x9d78('0x33')];if(_0x4c4240[_0x9d78('0x34')]['includeAll']){_0x3c11b2[_0x9d78('0x4a')]=[{'all':!![]}];}_0x3c11b2=_[_0x9d78('0x41')]({},_0x3c11b2,_0x4c4240['options']);return db[_0x9d78('0x2f')][_0x9d78('0x4b')](_0x3c11b2)[_0x9d78('0x28')](handleEntityNotFound(_0x50854f,null))[_0x9d78('0x28')](respondWithResult(_0x50854f,null))['catch'](handleError(_0x50854f,null));};exports[_0x9d78('0x4c')]=function(_0x264c99,_0x10c2ee){return db[_0x9d78('0x2f')][_0x9d78('0x4c')](_0x264c99[_0x9d78('0x4d')],{})[_0x9d78('0x28')](respondWithResult(_0x10c2ee,0xc9))['catch'](handleError(_0x10c2ee,null));};exports[_0x9d78('0x27')]=function(_0x24d97e,_0x528846){if(_0x24d97e[_0x9d78('0x4d')]['id']){delete _0x24d97e[_0x9d78('0x4d')]['id'];}return db['VoiceQueueReport'][_0x9d78('0x4b')]({'where':{'id':_0x24d97e[_0x9d78('0x49')]['id']}})[_0x9d78('0x28')](handleEntityNotFound(_0x528846,null))['then'](saveUpdates(_0x24d97e[_0x9d78('0x4d')],null))[_0x9d78('0x28')](respondWithResult(_0x528846,null))[_0x9d78('0x47')](handleError(_0x528846,null));};exports[_0x9d78('0x29')]=function(_0x2b63ec,_0x50a687){return db[_0x9d78('0x2f')][_0x9d78('0x4b')]({'where':{'id':_0x2b63ec[_0x9d78('0x49')]['id']}})[_0x9d78('0x28')](handleEntityNotFound(_0x50a687,null))['then'](removeEntity(_0x50a687,null))[_0x9d78('0x47')](handleError(_0x50a687,null));};exports[_0x9d78('0x4e')]=function(_0x220aa9,_0x50a5bb){return db[_0x9d78('0x2f')][_0x9d78('0x4e')]()[_0x9d78('0x28')](respondWithResult(_0x50a5bb,null))[_0x9d78('0x47')](handleError(_0x50a5bb,null));};exports[_0x9d78('0x4f')]=function(_0x4b166f,_0x16ec45){var _0x12201b={},_0x222aa0={},_0xb7271b={'count':0x0,'rows':[]};_0x222aa0['model']=_['keys'](db['VoiceQueueReport'][_0x9d78('0x30')]);_0x222aa0[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x4b166f[_0x9d78('0x34')]);_0x222aa0[_0x9d78('0x3e')]=_[_0x9d78('0x36')](_0x222aa0[_0x9d78('0x33')],_0x222aa0[_0x9d78('0x34')]);_0x12201b[_0x9d78('0x37')]=_[_0x9d78('0x36')](_0x222aa0[_0x9d78('0x33')],qs['fields'](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x38')]));_0x12201b[_0x9d78('0x37')]=_0x12201b[_0x9d78('0x37')][_0x9d78('0x39')]?_0x12201b[_0x9d78('0x37')]:_0x222aa0[_0x9d78('0x33')];if(!_0x4b166f[_0x9d78('0x34')][_0x9d78('0x3a')]('nolimit')){_0x12201b['limit']=qs[_0x9d78('0x21')](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x21')]);_0x12201b[_0x9d78('0x1f')]=qs[_0x9d78('0x1f')](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x1f')]);}_0x12201b[_0x9d78('0x3b')]=qs[_0x9d78('0x3c')](_0x4b166f['query'][_0x9d78('0x3c')]);_0x12201b[_0x9d78('0x3d')]=qs[_0x9d78('0x3e')](_['pick'](_0x4b166f[_0x9d78('0x34')],_0x222aa0['filters']));if(_0x4b166f[_0x9d78('0x34')][_0x9d78('0x40')]){_0x12201b[_0x9d78('0x3d')]=_[_0x9d78('0x41')](_0x12201b[_0x9d78('0x3d')],{'$or':_[_0x9d78('0x2e')](_0x12201b[_0x9d78('0x37')],function(_0x334c23){var _0x1d4306={};_0x1d4306[_0x334c23]={'$like':'%'+_0x4b166f[_0x9d78('0x34')][_0x9d78('0x40')]+'%'};return _0x1d4306;})});}_0x12201b=_[_0x9d78('0x41')]({},_0x12201b,_0x4b166f[_0x9d78('0x43')]);var _0x3a3441={'where':_0x12201b[_0x9d78('0x3d')]};return db[_0x9d78('0x2f')][_0x9d78('0x22')](_0x3a3441)[_0x9d78('0x28')](function(_0x40e682){_0xb7271b[_0x9d78('0x22')]=_0x40e682;if(_0x4b166f[_0x9d78('0x34')][_0x9d78('0x44')]){_0x12201b[_0x9d78('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9d78('0x45')](_0x12201b);})[_0x9d78('0x28')](function(_0xc0b0a9){_0xb7271b[_0x9d78('0x46')]=_0xc0b0a9;return _0xb7271b;})[_0x9d78('0x28')](respondWithFilteredResult(_0x16ec45,_0x12201b,'getVoiceQueuesReport'))['catch'](handleError(_0x16ec45,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x2b51=['set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset'];(function(_0x52b155,_0x59d90f){var _0x47e348=function(_0x13211a){while(--_0x13211a){_0x52b155['push'](_0x52b155['shift']());}};_0x47e348(++_0x59d90f);}(_0x2b51,0x1d3));var _0x12b5=function(_0x4bae0e,_0x4b0f52){_0x4bae0e=_0x4bae0e-0x0;var _0x450e1f=_0x2b51[_0x4bae0e];return _0x450e1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12b5('0x0'));var zipdir=require(_0x12b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12b5('0x2'));var moment=require(_0x12b5('0x3'));var BPromise=require(_0x12b5('0x4'));var Mustache=require('mustache');var util=require(_0x12b5('0x5'));var path=require(_0x12b5('0x6'));var sox=require(_0x12b5('0x7'));var csv=require(_0x12b5('0x8'));var ejs=require(_0x12b5('0x9'));var fs=require('fs');var fs_extra=require(_0x12b5('0xa'));var _=require(_0x12b5('0xb'));var squel=require(_0x12b5('0xc'));var crypto=require(_0x12b5('0xd'));var jsforce=require(_0x12b5('0xe'));var deskjs=require(_0x12b5('0xf'));var toCsv=require(_0x12b5('0x8'));var querystring=require(_0x12b5('0x10'));var Papa=require(_0x12b5('0x11'));var Redis=require(_0x12b5('0x12'));var authService=require(_0x12b5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12b5('0x14'));var logger=require(_0x12b5('0x15'))(_0x12b5('0x16'));var utils=require('../../config/utils');var config=require(_0x12b5('0x17'));var licenseUtil=require(_0x12b5('0x18'));var db=require(_0x12b5('0x19'))['db'];config[_0x12b5('0x1a')]=_[_0x12b5('0x1b')](config[_0x12b5('0x1a')],{'host':_0x12b5('0x1c'),'port':0x18eb});var socket=require(_0x12b5('0x1d'))(new Redis(config[_0x12b5('0x1a')]));require('./voiceQueueReport.socket')[_0x12b5('0x1e')](socket);function respondWithStatusCode(_0x5c5185,_0x4602cf){_0x4602cf=_0x4602cf||0xcc;return function(_0x2f1ac5){if(_0x2f1ac5){return _0x5c5185[_0x12b5('0x1f')](_0x4602cf);}return _0x5c5185[_0x12b5('0x20')](_0x4602cf)[_0x12b5('0x21')]();};}function respondWithResult(_0x2f6612,_0x4463bd){_0x4463bd=_0x4463bd||0xc8;return function(_0x58b68c){if(_0x58b68c){return _0x2f6612['status'](_0x4463bd)['json'](_0x58b68c);}};}function respondWithFilteredResult(_0x33957d,_0x355b0c){return function(_0x5ce452){if(_0x5ce452){var _0xe50d2b=typeof _0x355b0c['offset']===_0x12b5('0x22')&&typeof _0x355b0c[_0x12b5('0x23')]===_0x12b5('0x22');var _0x3f6b02=_0x5ce452['count'];var _0x320dda=_0xe50d2b?0x0:_0x355b0c[_0x12b5('0x24')];var _0x1790af=_0xe50d2b?_0x5ce452['count']:_0x355b0c['offset']+_0x355b0c[_0x12b5('0x23')];var _0x37e74a;if(_0x1790af>=_0x3f6b02){_0x1790af=_0x3f6b02;_0x37e74a=0xc8;}else{_0x37e74a=0xce;}_0x33957d[_0x12b5('0x20')](_0x37e74a);return _0x33957d[_0x12b5('0x25')](_0x12b5('0x26'),_0x320dda+'-'+_0x1790af+'/'+_0x3f6b02)[_0x12b5('0x27')](_0x5ce452);}return null;};}function patchUpdates(_0x455c68){return function(_0x40908b){try{jsonpatch[_0x12b5('0x28')](_0x40908b,_0x455c68,!![]);}catch(_0x449ddc){return BPromise['reject'](_0x449ddc);}return _0x40908b[_0x12b5('0x29')]();};}function saveUpdates(_0x4371be,_0x18b2f8){return function(_0x2e7e3e){if(_0x2e7e3e){return _0x2e7e3e[_0x12b5('0x2a')](_0x4371be)[_0x12b5('0x2b')](function(_0x1a2874){return _0x1a2874;});}return null;};}function removeEntity(_0x4e6f5a,_0x5b9e3d){return function(_0x2ac34a){if(_0x2ac34a){return _0x2ac34a[_0x12b5('0x2c')]()[_0x12b5('0x2b')](function(){_0x4e6f5a[_0x12b5('0x20')](0xcc)[_0x12b5('0x21')]();});}};}function handleEntityNotFound(_0x1ab522,_0x1393a2){return function(_0x320f13){if(!_0x320f13){_0x1ab522[_0x12b5('0x1f')](0x194);}return _0x320f13;};}function handleError(_0x302ebb,_0x197550){_0x197550=_0x197550||0x1f4;return function(_0x3935b0){logger['error'](_0x3935b0[_0x12b5('0x2d')]);if(_0x3935b0['name']){delete _0x3935b0[_0x12b5('0x2e')];}_0x302ebb[_0x12b5('0x20')](_0x197550)[_0x12b5('0x2f')](_0x3935b0);};}exports[_0x12b5('0x30')]=function(_0x324b23,_0x5dbb3a){var _0x43671c={},_0x4110be={},_0x5ec4f0={'count':0x0,'rows':[]};var _0x45c322=_[_0x12b5('0x31')](db[_0x12b5('0x32')][_0x12b5('0x33')],function(_0x4f0090){return{'name':_0x4f0090[_0x12b5('0x34')],'type':_0x4f0090['type'][_0x12b5('0x35')]};});_0x4110be['model']=_['map'](_0x45c322,_0x12b5('0x2e'));_0x4110be[_0x12b5('0x36')]=_[_0x12b5('0x37')](_0x324b23[_0x12b5('0x36')]);_0x4110be[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x4110be[_0x12b5('0x3a')],_0x4110be[_0x12b5('0x36')]);_0x43671c[_0x12b5('0x3b')]=_[_0x12b5('0x39')](_0x4110be[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x324b23[_0x12b5('0x36')]['fields']));_0x43671c[_0x12b5('0x3b')]=_0x43671c[_0x12b5('0x3b')][_0x12b5('0x3d')]?_0x43671c[_0x12b5('0x3b')]:_0x4110be[_0x12b5('0x3a')];if(!_0x324b23[_0x12b5('0x36')]['hasOwnProperty']('nolimit')){_0x43671c[_0x12b5('0x23')]=qs['limit'](_0x324b23[_0x12b5('0x36')]['limit']);_0x43671c[_0x12b5('0x24')]=qs[_0x12b5('0x24')](_0x324b23[_0x12b5('0x36')][_0x12b5('0x24')]);}_0x43671c[_0x12b5('0x3e')]=qs[_0x12b5('0x3f')](_0x324b23[_0x12b5('0x36')][_0x12b5('0x3f')]);_0x43671c['where']=qs[_0x12b5('0x38')](_['pick'](_0x324b23[_0x12b5('0x36')],_0x4110be[_0x12b5('0x38')]),_0x45c322);if(_0x324b23[_0x12b5('0x36')][_0x12b5('0x40')]){_0x43671c[_0x12b5('0x41')]=_['merge'](_0x43671c[_0x12b5('0x41')],{'$or':_[_0x12b5('0x31')](_0x45c322,function(_0x38e602){if(_0x38e602[_0x12b5('0x42')]!==_0x12b5('0x43')){var _0x25dd65={};_0x25dd65[_0x38e602[_0x12b5('0x2e')]]={'$like':'%'+_0x324b23[_0x12b5('0x36')][_0x12b5('0x40')]+'%'};return _0x25dd65;}})});}_0x43671c=_[_0x12b5('0x44')]({},_0x43671c,_0x324b23[_0x12b5('0x45')]);var _0x30309a={'where':_0x43671c[_0x12b5('0x41')]};return db['VoiceQueueReport']['count'](_0x30309a)[_0x12b5('0x2b')](function(_0x47544d){_0x5ec4f0[_0x12b5('0x46')]=_0x47544d;if(_0x324b23[_0x12b5('0x36')][_0x12b5('0x47')]){_0x43671c[_0x12b5('0x48')]=[{'all':!![]}];}return db[_0x12b5('0x32')][_0x12b5('0x49')](_0x43671c);})['then'](function(_0x559b21){_0x5ec4f0[_0x12b5('0x4a')]=_0x559b21;return _0x5ec4f0;})[_0x12b5('0x2b')](respondWithFilteredResult(_0x5dbb3a,_0x43671c))[_0x12b5('0x4b')](handleError(_0x5dbb3a,null));};exports['show']=function(_0x2d4cee,_0x219265){var _0x15864a={'raw':![],'where':{'id':_0x2d4cee[_0x12b5('0x4c')]['id']}},_0x1a8b0a={};_0x1a8b0a['model']=_[_0x12b5('0x37')](db[_0x12b5('0x32')][_0x12b5('0x33')]);_0x1a8b0a['query']=_[_0x12b5('0x37')](_0x2d4cee[_0x12b5('0x36')]);_0x1a8b0a[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x1a8b0a[_0x12b5('0x3a')],_0x1a8b0a[_0x12b5('0x36')]);_0x15864a[_0x12b5('0x3b')]=_['intersection'](_0x1a8b0a[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x2d4cee[_0x12b5('0x36')][_0x12b5('0x3c')]));_0x15864a[_0x12b5('0x3b')]=_0x15864a[_0x12b5('0x3b')][_0x12b5('0x3d')]?_0x15864a[_0x12b5('0x3b')]:_0x1a8b0a[_0x12b5('0x3a')];if(_0x2d4cee['query']['includeAll']){_0x15864a['include']=[{'all':!![]}];}_0x15864a=_[_0x12b5('0x44')]({},_0x15864a,_0x2d4cee['options']);return db['VoiceQueueReport'][_0x12b5('0x4d')](_0x15864a)[_0x12b5('0x2b')](handleEntityNotFound(_0x219265,null))[_0x12b5('0x2b')](respondWithResult(_0x219265,null))['catch'](handleError(_0x219265,null));};exports['create']=function(_0xed0825,_0x3d1021){return db[_0x12b5('0x32')][_0x12b5('0x4e')](_0xed0825['body'],{})[_0x12b5('0x2b')](respondWithResult(_0x3d1021,0xc9))[_0x12b5('0x4b')](handleError(_0x3d1021,null));};exports[_0x12b5('0x2a')]=function(_0x1cca87,_0x4da699){if(_0x1cca87['body']['id']){delete _0x1cca87[_0x12b5('0x4f')]['id'];}return db[_0x12b5('0x32')][_0x12b5('0x4d')]({'where':{'id':_0x1cca87[_0x12b5('0x4c')]['id']}})[_0x12b5('0x2b')](handleEntityNotFound(_0x4da699,null))[_0x12b5('0x2b')](saveUpdates(_0x1cca87[_0x12b5('0x4f')],null))[_0x12b5('0x2b')](respondWithResult(_0x4da699,null))[_0x12b5('0x4b')](handleError(_0x4da699,null));};exports[_0x12b5('0x2c')]=function(_0x35feb0,_0x588286){return db[_0x12b5('0x32')]['find']({'where':{'id':_0x35feb0[_0x12b5('0x4c')]['id']}})[_0x12b5('0x2b')](handleEntityNotFound(_0x588286,null))[_0x12b5('0x2b')](removeEntity(_0x588286,null))[_0x12b5('0x4b')](handleError(_0x588286,null));};exports[_0x12b5('0x50')]=function(_0x546774,_0xe14632){return db[_0x12b5('0x32')]['describe']()['then'](respondWithResult(_0xe14632,null))[_0x12b5('0x4b')](handleError(_0xe14632,null));};exports[_0x12b5('0x51')]=function(_0x1b59a3,_0x10dad1){var _0x281dc9={},_0x3670d6={},_0x234f8f={'count':0x0,'rows':[]};_0x3670d6['model']=_[_0x12b5('0x37')](db[_0x12b5('0x32')]['rawAttributes']);_0x3670d6[_0x12b5('0x36')]=_[_0x12b5('0x37')](_0x1b59a3[_0x12b5('0x36')]);_0x3670d6[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x3670d6[_0x12b5('0x3a')],_0x3670d6[_0x12b5('0x36')]);_0x281dc9['attributes']=_['intersection'](_0x3670d6[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x1b59a3['query'][_0x12b5('0x3c')]));_0x281dc9[_0x12b5('0x3b')]=_0x281dc9['attributes'][_0x12b5('0x3d')]?_0x281dc9[_0x12b5('0x3b')]:_0x3670d6[_0x12b5('0x3a')];if(!_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x52')](_0x12b5('0x53'))){_0x281dc9['limit']=qs[_0x12b5('0x23')](_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x23')]);_0x281dc9[_0x12b5('0x24')]=qs['offset'](_0x1b59a3['query'][_0x12b5('0x24')]);}_0x281dc9['order']=qs[_0x12b5('0x3f')](_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x3f')]);_0x281dc9['where']=qs[_0x12b5('0x38')](_['pick'](_0x1b59a3[_0x12b5('0x36')],_0x3670d6['filters']));if(_0x1b59a3['query'][_0x12b5('0x40')]){_0x281dc9[_0x12b5('0x41')]=_['merge'](_0x281dc9[_0x12b5('0x41')],{'$or':_[_0x12b5('0x31')](_0x281dc9[_0x12b5('0x3b')],function(_0x29e2c5){var _0x3792ac={};_0x3792ac[_0x29e2c5]={'$like':'%'+_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x40')]+'%'};return _0x3792ac;})});}_0x281dc9=_[_0x12b5('0x44')]({},_0x281dc9,_0x1b59a3[_0x12b5('0x45')]);var _0x343d7f={'where':_0x281dc9[_0x12b5('0x41')]};return db[_0x12b5('0x32')][_0x12b5('0x46')](_0x343d7f)[_0x12b5('0x2b')](function(_0x302060){_0x234f8f[_0x12b5('0x46')]=_0x302060;if(_0x1b59a3[_0x12b5('0x36')]['includeAll']){_0x281dc9[_0x12b5('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x281dc9);})[_0x12b5('0x2b')](function(_0x52333d){_0x234f8f['rows']=_0x52333d;return _0x234f8f;})[_0x12b5('0x2b')](respondWithFilteredResult(_0x10dad1,_0x281dc9,_0x12b5('0x51')))[_0x12b5('0x4b')](handleError(_0x10dad1,null,_0x12b5('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f378224..5f787bb 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 _0xf450=['hasOwnProperty','hook','exports','VoiceQueueReport','save','emit'];(function(_0x20da9c,_0xcf292b){var _0x198ea5=function(_0x197a6a){while(--_0x197a6a){_0x20da9c['push'](_0x20da9c['shift']());}};_0x198ea5(++_0xcf292b);}(_0xf450,0xdb));var _0x0f45=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf450[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x0f45('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f45('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cc2ac){return function(_0xf58757,_0x578f9a,_0x36a807){VoiceQueueReportEvents[_0x0f45('0x2')](_0x4cc2ac+':'+_0xf58757['id'],_0xf58757);VoiceQueueReportEvents[_0x0f45('0x2')](_0x4cc2ac,_0xf58757);_0x36a807(null);};}for(var e in events){if(events[_0x0f45('0x3')](e)){var event=events[e];VoiceQueueReport[_0x0f45('0x4')](e,emitEvent(event));}}module[_0x0f45('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6f4c=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x5c47d6,_0x52cc9e){var _0x17eb3a=function(_0x164930){while(--_0x164930){_0x5c47d6['push'](_0x5c47d6['shift']());}};_0x17eb3a(++_0x52cc9e);}(_0x6f4c,0x10a));var _0xc6f4=function(_0x2178ec,_0x1f4c66){_0x2178ec=_0x2178ec-0x0;var _0x117c34=_0x6f4c[_0x2178ec];return _0x117c34;};'use strict';var EventEmitter=require(_0xc6f4('0x0'));var VoiceQueueReport=require(_0xc6f4('0x1'))['db'][_0xc6f4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc6f4('0x3')](0x0);var events={'afterCreate':_0xc6f4('0x4'),'afterUpdate':_0xc6f4('0x5'),'afterDestroy':_0xc6f4('0x6')};function emitEvent(_0x8f95df){return function(_0x2ec78a,_0x1c9ac4,_0x49d897){VoiceQueueReportEvents['emit'](_0x8f95df+':'+_0x2ec78a['id'],_0x2ec78a);VoiceQueueReportEvents['emit'](_0x8f95df,_0x2ec78a);_0x49d897(null);};}for(var e in events){if(events[_0xc6f4('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc6f4('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index dfc6055..f388c54 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 _0xdb7f=['rimraf','../../config/environment','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5bced2,_0x317e86){var _0x2f5c70=function(_0x5f314a){while(--_0x5f314a){_0x5bced2['push'](_0x5bced2['shift']());}};_0x2f5c70(++_0x317e86);}(_0xdb7f,0x1c0));var _0xfdb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb7f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfdb7('0x0'));var util=require(_0xfdb7('0x1'));var logger=require(_0xfdb7('0x2'))(_0xfdb7('0x3'));var moment=require('moment');var BPromise=require(_0xfdb7('0x4'));var rp=require(_0xfdb7('0x5'));var fs=require('fs');var path=require(_0xfdb7('0x6'));var rimraf=require(_0xfdb7('0x7'));var config=require(_0xfdb7('0x8'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x1ac359,_0x1c2765){return _0x1ac359[_0xfdb7('0x9')]('VoiceQueueReport',attributes,{'tableName':_0xfdb7('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfdb7('0xb')]},{'fields':[_0xfdb7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbce=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','calleridnum','lodash'];(function(_0x3fa9b5,_0x288393){var _0xaa38b=function(_0x3cf094){while(--_0x3cf094){_0x3fa9b5['push'](_0x3fa9b5['shift']());}};_0xaa38b(++_0x288393);}(_0xfbce,0x1a3));var _0xefbc=function(_0x283ef3,_0x136ad1){_0x283ef3=_0x283ef3-0x0;var _0x1d4c24=_0xfbce[_0x283ef3];return _0x1d4c24;};'use strict';var _=require(_0xefbc('0x0'));var util=require(_0xefbc('0x1'));var logger=require(_0xefbc('0x2'))(_0xefbc('0x3'));var moment=require(_0xefbc('0x4'));var BPromise=require(_0xefbc('0x5'));var rp=require(_0xefbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefbc('0x7'));var config=require('../../config/environment');var attributes=require(_0xefbc('0x8'));module['exports']=function(_0x156666,_0x590379){return _0x156666['define'](_0xefbc('0x9'),attributes,{'tableName':_0xefbc('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xefbc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6011d81..a6c6bf1 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 _0x9698=['raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','stringify','UpdateVoiceQueueReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x5008d6,_0xf4e1f1){var _0x2c82aa=function(_0x15f04f){while(--_0x15f04f){_0x5008d6['push'](_0x5008d6['shift']());}};_0x2c82aa(++_0xf4e1f1);}(_0x9698,0x13b));var _0x8969=function(_0x1f4a7d,_0x499f7d){_0x1f4a7d=_0x1f4a7d-0x0;var _0x2247b7=_0x9698[_0x1f4a7d];return _0x2247b7;};'use strict';var _=require('lodash');var util=require(_0x8969('0x0'));var moment=require(_0x8969('0x1'));var BPromise=require(_0x8969('0x2'));var rs=require(_0x8969('0x3'));var fs=require('fs');var Redis=require(_0x8969('0x4'));var db=require(_0x8969('0x5'))['db'];var utils=require(_0x8969('0x6'));var logger=require(_0x8969('0x7'))(_0x8969('0x8'));var config=require(_0x8969('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8969('0xa')][_0x8969('0xb')]({'port':0x232a});config['redis']=_[_0x8969('0xc')](config[_0x8969('0xd')],{'host':_0x8969('0xe'),'port':0x18eb});var socket=require(_0x8969('0xf'))(new Redis(config[_0x8969('0xd')]));require(_0x8969('0x10'))['register'](socket);function respondWithRpcPromise(_0x17de27,_0xd3d25a,_0x584d73){return new BPromise(function(_0x2e3b1e,_0x3ceb75){return client['request'](_0x17de27,_0x584d73)['then'](function(_0x339d30){logger[_0x8969('0x11')](_0x8969('0x12'),_0xd3d25a,_0x8969('0x13'));logger[_0x8969('0x14')](_0x8969('0x15'),_0xd3d25a,_0x8969('0x13'),JSON['stringify'](_0x339d30));if(_0x339d30[_0x8969('0x16')]){if(_0x339d30[_0x8969('0x16')]['code']===0x1f4){logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);return _0x3ceb75(_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);}logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);return _0x2e3b1e(_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);}else{logger[_0x8969('0x11')](_0x8969('0x12'),_0xd3d25a,_0x8969('0x13'));_0x2e3b1e(_0x339d30[_0x8969('0x18')][_0x8969('0x17')]);}})[_0x8969('0x19')](function(_0xec1f36){logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0xec1f36);_0x3ceb75(_0xec1f36);});});}exports[_0x8969('0x1a')]=function(_0x2b14aa){var _0x45abf2=this;return new Promise(function(_0x319255,_0xd4a0d3){return db[_0x8969('0x1b')]['findAll']({'raw':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa['options'][_0x8969('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x1e')]||null:null,'attributes':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x1f')]||null:null,'limit':_0x2b14aa['options']?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x20')]||null:null,'include':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa['options'][_0x8969('0x21')]?_[_0x8969('0x22')](_0x2b14aa['options'][_0x8969('0x21')],function(_0x18cd2d){return{'model':db[_0x18cd2d[_0x8969('0x23')]],'as':_0x18cd2d['as'],'attributes':_0x18cd2d[_0x8969('0x1f')],'include':_0x18cd2d[_0x8969('0x21')]?_[_0x8969('0x22')](_0x18cd2d['include'],function(_0x379167){return{'model':db[_0x379167['model']],'as':_0x379167['as'],'attributes':_0x379167[_0x8969('0x1f')],'include':_0x379167[_0x8969('0x21')]?_[_0x8969('0x22')](_0x379167[_0x8969('0x21')],function(_0x5aa93c){return{'model':db[_0x5aa93c[_0x8969('0x23')]],'as':_0x5aa93c['as'],'attributes':_0x5aa93c[_0x8969('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8969('0x24')](function(_0x5d611a){logger['info']('GetVoiceQueueReport',_0x2b14aa);logger['debug'](_0x8969('0x1a'),_0x2b14aa,JSON['stringify'](_0x5d611a));_0x319255(_0x5d611a);})[_0x8969('0x19')](function(_0x3ddacd){logger['error']('GetVoiceQueueReport',_0x3ddacd[_0x8969('0x17')],_0x2b14aa);_0xd4a0d3(_0x45abf2[_0x8969('0x16')](0x1f4,_0x3ddacd[_0x8969('0x17')]));});});};exports[_0x8969('0x25')]=function(_0x29ead1){var _0x3d1f78=this;return new Promise(function(_0xca53c2,_0x2133ea){return db['VoiceQueueReport'][_0x8969('0x26')](_0x29ead1['body'],{'raw':_0x29ead1['options']?_0x29ead1[_0x8969('0x1c')][_0x8969('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1fe60d){logger[_0x8969('0x11')](_0x8969('0x25'),_0x29ead1);logger[_0x8969('0x14')](_0x8969('0x25'),_0x29ead1,JSON[_0x8969('0x27')](_0x1fe60d));_0xca53c2(_0x1fe60d);})[_0x8969('0x19')](function(_0x6d0c9){logger[_0x8969('0x16')]('CreateVoiceQueueReport',_0x6d0c9[_0x8969('0x17')],_0x29ead1);_0x2133ea(_0x3d1f78[_0x8969('0x16')](0x1f4,_0x6d0c9[_0x8969('0x17')]));});});};exports[_0x8969('0x28')]=function(_0x52e908){var _0x5ddceb=this;return new Promise(function(_0x1925c3,_0x1ad2ab){return db[_0x8969('0x1b')][_0x8969('0x29')](_0x52e908[_0x8969('0x2a')],{'raw':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')][_0x8969('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')]['where']||null:null,'attributes':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')][_0x8969('0x1f')]||null:null,'limit':_0x52e908['options']?_0x52e908['options'][_0x8969('0x20')]||null:null})[_0x8969('0x24')](function(_0x4611e9){logger[_0x8969('0x11')](_0x8969('0x28'),_0x52e908);logger['debug'](_0x8969('0x28'),_0x52e908,JSON[_0x8969('0x27')](_0x4611e9));_0x1925c3(_0x4611e9);})['catch'](function(_0x517866){logger[_0x8969('0x16')]('UpdateVoiceQueueReport',_0x517866[_0x8969('0x17')],_0x52e908);_0x1ad2ab(_0x5ddceb[_0x8969('0x16')](0x1f4,_0x517866['message']));});});}; \ No newline at end of file +var _0xe228=['../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','include','map','model','attributes','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe228,0xf4));var _0x8e22=function(_0x4fc60d,_0x1e801c){_0x4fc60d=_0x4fc60d-0x0;var _0x500740=_0xe228[_0x4fc60d];return _0x500740;};'use strict';var _=require(_0x8e22('0x0'));var util=require(_0x8e22('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e22('0x2'));var fs=require('fs');var Redis=require(_0x8e22('0x3'));var db=require(_0x8e22('0x4'))['db'];var utils=require(_0x8e22('0x5'));var logger=require(_0x8e22('0x6'))(_0x8e22('0x7'));var config=require(_0x8e22('0x8'));var jayson=require(_0x8e22('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8e22('0xa')](config[_0x8e22('0xb')],{'host':_0x8e22('0xc'),'port':0x18eb});var socket=require(_0x8e22('0xd'))(new Redis(config[_0x8e22('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x581b6c,_0x13ffe6,_0x5a1a3d){return new BPromise(function(_0x24bd17,_0x12dfc3){return client[_0x8e22('0xe')](_0x581b6c,_0x5a1a3d)['then'](function(_0x380ad4){logger[_0x8e22('0xf')](_0x8e22('0x10'),_0x13ffe6,'request\x20sent');logger[_0x8e22('0x11')](_0x8e22('0x12'),_0x13ffe6,_0x8e22('0x13'),JSON[_0x8e22('0x14')](_0x380ad4));if(_0x380ad4[_0x8e22('0x15')]){if(_0x380ad4[_0x8e22('0x15')][_0x8e22('0x16')]===0x1f4){logger[_0x8e22('0x15')](_0x8e22('0x10'),_0x13ffe6,_0x380ad4[_0x8e22('0x15')][_0x8e22('0x17')]);return _0x12dfc3(_0x380ad4['error'][_0x8e22('0x17')]);}logger['error'](_0x8e22('0x10'),_0x13ffe6,_0x380ad4[_0x8e22('0x15')][_0x8e22('0x17')]);return _0x24bd17(_0x380ad4['error'][_0x8e22('0x17')]);}else{logger[_0x8e22('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x13ffe6,_0x8e22('0x13'));_0x24bd17(_0x380ad4[_0x8e22('0x18')]['message']);}})[_0x8e22('0x19')](function(_0x29f444){logger[_0x8e22('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x13ffe6,_0x29f444);_0x12dfc3(_0x29f444);});});}exports[_0x8e22('0x1a')]=function(_0x3b3c7d){var _0x14540b=this;return new Promise(function(_0x26ecaf,_0x393bab){return db[_0x8e22('0x1b')][_0x8e22('0x1c')]({'raw':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b3c7d['options']?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x1e')]||null:null,'attributes':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d['options']['attributes']||null:null,'limit':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x1f')]||null:null,'include':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x20')]?_[_0x8e22('0x21')](_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x20')],function(_0x3c915f){return{'model':db[_0x3c915f[_0x8e22('0x22')]],'as':_0x3c915f['as'],'attributes':_0x3c915f[_0x8e22('0x23')],'include':_0x3c915f[_0x8e22('0x20')]?_['map'](_0x3c915f[_0x8e22('0x20')],function(_0x3be28b){return{'model':db[_0x3be28b[_0x8e22('0x22')]],'as':_0x3be28b['as'],'attributes':_0x3be28b[_0x8e22('0x23')],'include':_0x3be28b[_0x8e22('0x20')]?_[_0x8e22('0x21')](_0x3be28b[_0x8e22('0x20')],function(_0x4f7c53){return{'model':db[_0x4f7c53[_0x8e22('0x22')]],'as':_0x4f7c53['as'],'attributes':_0x4f7c53['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e22('0x24')](function(_0x3f2a49){logger[_0x8e22('0xf')](_0x8e22('0x1a'),_0x3b3c7d);logger[_0x8e22('0x11')](_0x8e22('0x1a'),_0x3b3c7d,JSON[_0x8e22('0x14')](_0x3f2a49));_0x26ecaf(_0x3f2a49);})[_0x8e22('0x19')](function(_0x3be217){logger[_0x8e22('0x15')](_0x8e22('0x1a'),_0x3be217['message'],_0x3b3c7d);_0x393bab(_0x14540b[_0x8e22('0x15')](0x1f4,_0x3be217['message']));});});};exports[_0x8e22('0x25')]=function(_0x5239fb){var _0x4213ca=this;return new Promise(function(_0x53add6,_0x223c60){return db[_0x8e22('0x1b')][_0x8e22('0x26')](_0x5239fb[_0x8e22('0x27')],{'raw':_0x5239fb[_0x8e22('0x1d')]?_0x5239fb['options'][_0x8e22('0x28')]===undefined?!![]:![]:!![]})[_0x8e22('0x24')](function(_0x41d2ee){logger[_0x8e22('0xf')](_0x8e22('0x25'),_0x5239fb);logger[_0x8e22('0x11')]('CreateVoiceQueueReport',_0x5239fb,JSON['stringify'](_0x41d2ee));_0x53add6(_0x41d2ee);})[_0x8e22('0x19')](function(_0x307156){logger[_0x8e22('0x15')]('CreateVoiceQueueReport',_0x307156[_0x8e22('0x17')],_0x5239fb);_0x223c60(_0x4213ca[_0x8e22('0x15')](0x1f4,_0x307156[_0x8e22('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3b9699){var _0x572a3d=this;return new Promise(function(_0x2a4480,_0x2f815c){return db[_0x8e22('0x1b')]['update'](_0x3b9699['body'],{'raw':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699[_0x8e22('0x1d')][_0x8e22('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699['options']['where']||null:null,'attributes':_0x3b9699['options']?_0x3b9699[_0x8e22('0x1d')]['attributes']||null:null,'limit':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699['options'][_0x8e22('0x1f')]||null:null})[_0x8e22('0x24')](function(_0x4b7b75){logger[_0x8e22('0xf')](_0x8e22('0x29'),_0x3b9699);logger[_0x8e22('0x11')](_0x8e22('0x29'),_0x3b9699,JSON['stringify'](_0x4b7b75));_0x2a4480(_0x4b7b75);})['catch'](function(_0x334836){logger[_0x8e22('0x15')]('UpdateVoiceQueueReport',_0x334836[_0x8e22('0x17')],_0x3b9699);_0x2f815c(_0x572a3d[_0x8e22('0x15')](0x1f4,_0x334836['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c560391..8f1dbfc 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 _0x7da7=['save','remove','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0xbf4a92,_0x4cfd8a){var _0x3b9cdf=function(_0x29e794){while(--_0x29e794){_0xbf4a92['push'](_0xbf4a92['shift']());}};_0x3b9cdf(++_0x4cfd8a);}(_0x7da7,0x10d));var _0x77da=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x7da7[_0x364cf8];return _0x6a59ee;};'use strict';var VoiceQueueReportEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){VoiceQueueReportEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);VoiceQueueReportEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file +var _0x6dc0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x6dc0,0x18c));var _0x06dc=function(_0x24ee4d,_0x346b64){_0x24ee4d=_0x24ee4d-0x0;var _0x305b6d=_0x6dc0[_0x24ee4d];return _0x305b6d;};'use strict';var VoiceQueueReportEvents=require(_0x06dc('0x0'));var events=['save',_0x06dc('0x1'),_0x06dc('0x2')];function createListener(_0x4434e2,_0xc40894){return function(_0x414760){_0xc40894['emit'](_0x4434e2,_0x414760);};}function removeListener(_0x4effcf,_0x2cad0f){return function(){VoiceQueueReportEvents[_0x06dc('0x3')](_0x4effcf,_0x2cad0f);};}exports['register']=function(_0x45a093){for(var _0x26b287=0x0,_0x4ac3b4=events[_0x06dc('0x4')];_0x26b287<_0x4ac3b4;_0x26b287++){var _0x523fb5=events[_0x26b287];var _0xeac52b=createListener(_0x06dc('0x5')+_0x523fb5,_0x45a093);VoiceQueueReportEvents['on'](_0x523fb5,_0xeac52b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6591bfb..5732473 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 _0xa92e=['../../config/environment','get','isAuthenticated','index','/:id','show','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1258a3,_0x116c40){var _0x28d9bd=function(_0x26a2f0){while(--_0x26a2f0){_0x1258a3['push'](_0x1258a3['shift']());}};_0x28d9bd(++_0x116c40);}(_0xa92e,0x1e5));var _0xea92=function(_0x3200a8,_0x31132f){_0x3200a8=_0x3200a8-0x0;var _0x21f956=_0xa92e[_0x3200a8];return _0x21f956;};'use strict';var multer=require(_0xea92('0x0'));var util=require('util');var path=require(_0xea92('0x1'));var timeout=require(_0xea92('0x2'));var express=require(_0xea92('0x3'));var router=express[_0xea92('0x4')]();var fs_extra=require(_0xea92('0x5'));var auth=require(_0xea92('0x6'));var interaction=require(_0xea92('0x7'));var config=require(_0xea92('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0xea92('0x9')]('/',auth[_0xea92('0xa')](),controller[_0xea92('0xb')]);router[_0xea92('0x9')](_0xea92('0xc'),auth[_0xea92('0xa')](),controller[_0xea92('0xd')]);router['post']('/',auth[_0xea92('0xa')](),controller['create']);router[_0xea92('0xe')]('/:id',auth[_0xea92('0xa')](),controller[_0xea92('0xf')]);router['delete'](_0xea92('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xea92('0x10')]=router; \ No newline at end of file +var _0x12c0=['./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x204e63,_0x26854f){var _0x4b3a35=function(_0x41b2cb){while(--_0x41b2cb){_0x204e63['push'](_0x204e63['shift']());}};_0x4b3a35(++_0x26854f);}(_0x12c0,0x197));var _0x012c=function(_0x73946a,_0xb8a2cd){_0x73946a=_0x73946a-0x0;var _0x563574=_0x12c0[_0x73946a];return _0x563574;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x012c('0x0'));var timeout=require(_0x012c('0x1'));var express=require(_0x012c('0x2'));var router=express['Router']();var fs_extra=require(_0x012c('0x3'));var auth=require(_0x012c('0x4'));var interaction=require(_0x012c('0x5'));var config=require(_0x012c('0x6'));var controller=require(_0x012c('0x7'));router[_0x012c('0x8')]('/',auth['isAuthenticated'](),controller[_0x012c('0x9')]);router['get'](_0x012c('0xa'),auth[_0x012c('0xb')](),controller[_0x012c('0xc')]);router[_0x012c('0xd')]('/',auth[_0x012c('0xb')](),controller[_0x012c('0xe')]);router['put']('/:id',auth[_0x012c('0xb')](),controller[_0x012c('0xf')]);router[_0x012c('0x10')](_0x012c('0xa'),auth[_0x012c('0xb')](),controller['destroy']);module[_0x012c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cbfd790..76d5e71 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 _0xdfe6=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x2ca547,_0x50739a){var _0x2065bc=function(_0x31e2ab){while(--_0x31e2ab){_0x2ca547['push'](_0x2ca547['shift']());}};_0x2065bc(++_0x50739a);}(_0xdfe6,0xb6));var _0x6dfe=function(_0x86b378,_0x2bac7f){_0x86b378=_0x86b378-0x0;var _0x37cf95=_0xdfe6[_0x86b378];return _0x37cf95;};'use strict';var Sequelize=require(_0x6dfe('0x0'));var moment=require('moment');module[_0x6dfe('0x1')]={'time':{'type':Sequelize[_0x6dfe('0x2')]},'callid':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6dfe('0x3')](_0x6dfe('0x4'))}}; \ No newline at end of file +var _0x4a4a=['sequelize','moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4a4a,0x157));var _0xa4a4=function(_0x2bf51f,_0x280711){_0x2bf51f=_0x2bf51f-0x0;var _0x467f2c=_0x4a4a[_0x2bf51f];return _0x467f2c;};'use strict';var Sequelize=require(_0xa4a4('0x0'));var moment=require(_0xa4a4('0x1'));module[_0xa4a4('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa4a4('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xa4a4('0x5')](_0xa4a4('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 58d95f4..68a522d 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 _0x1648=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1648,0x85));var _0x8164=function(_0x47a6f8,_0x374775){_0x47a6f8=_0x47a6f8-0x0;var _0x3deee3=_0x1648[_0x47a6f8];return _0x3deee3;};'use strict';var emlformat=require(_0x8164('0x0'));var rimraf=require(_0x8164('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8164('0x2'));var rp=require(_0x8164('0x3'));var moment=require('moment');var BPromise=require(_0x8164('0x4'));var Mustache=require(_0x8164('0x5'));var util=require(_0x8164('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8164('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8164('0x8'));var _=require(_0x8164('0x9'));var squel=require('squel');var crypto=require(_0x8164('0xa'));var jsforce=require(_0x8164('0xb'));var deskjs=require(_0x8164('0xc'));var toCsv=require(_0x8164('0x7'));var querystring=require(_0x8164('0xd'));var Papa=require(_0x8164('0xe'));var Redis=require(_0x8164('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8164('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8164('0x11'))(_0x8164('0x12'));var utils=require('../../config/utils');var config=require(_0x8164('0x13'));var licenseUtil=require(_0x8164('0x14'));var db=require(_0x8164('0x15'))['db'];function respondWithStatusCode(_0x5f1f8d,_0xb13fc9){_0xb13fc9=_0xb13fc9||0xcc;return function(_0x364261){if(_0x364261){return _0x5f1f8d['sendStatus'](_0xb13fc9);}return _0x5f1f8d[_0x8164('0x16')](_0xb13fc9)[_0x8164('0x17')]();};}function respondWithResult(_0x468370,_0x3eb923){_0x3eb923=_0x3eb923||0xc8;return function(_0x342eaf){if(_0x342eaf){return _0x468370[_0x8164('0x16')](_0x3eb923)[_0x8164('0x18')](_0x342eaf);}};}function respondWithFilteredResult(_0x2866cc,_0x269e7c){return function(_0x25b415){if(_0x25b415){var _0x44fda0=typeof _0x269e7c[_0x8164('0x19')]===_0x8164('0x1a')&&typeof _0x269e7c[_0x8164('0x1b')]===_0x8164('0x1a');var _0x21689e=_0x25b415[_0x8164('0x1c')];var _0x4b0700=_0x44fda0?0x0:_0x269e7c[_0x8164('0x19')];var _0x41d900=_0x44fda0?_0x25b415['count']:_0x269e7c[_0x8164('0x19')]+_0x269e7c['limit'];var _0x5953db;if(_0x41d900>=_0x21689e){_0x41d900=_0x21689e;_0x5953db=0xc8;}else{_0x5953db=0xce;}_0x2866cc[_0x8164('0x16')](_0x5953db);return _0x2866cc[_0x8164('0x1d')](_0x8164('0x1e'),_0x4b0700+'-'+_0x41d900+'/'+_0x21689e)['json'](_0x25b415);}return null;};}function patchUpdates(_0x3c3103){return function(_0x52bb5b){try{jsonpatch[_0x8164('0x1f')](_0x52bb5b,_0x3c3103,!![]);}catch(_0x24a67b){return BPromise['reject'](_0x24a67b);}return _0x52bb5b[_0x8164('0x20')]();};}function saveUpdates(_0x1d4318,_0xa5564c){return function(_0x2d5256){if(_0x2d5256){return _0x2d5256[_0x8164('0x21')](_0x1d4318)['then'](function(_0x1d40ca){return _0x1d40ca;});}return null;};}function removeEntity(_0x3b95f1,_0x73c1cf){return function(_0x20effd){if(_0x20effd){return _0x20effd[_0x8164('0x22')]()['then'](function(){_0x3b95f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272479,_0x50acff){return function(_0x1b820e){if(!_0x1b820e){_0x272479[_0x8164('0x23')](0x194);}return _0x1b820e;};}function handleError(_0x5bea0a,_0x55c33c){_0x55c33c=_0x55c33c||0x1f4;return function(_0x435fd){logger[_0x8164('0x24')](_0x435fd[_0x8164('0x25')]);if(_0x435fd['name']){delete _0x435fd[_0x8164('0x26')];}_0x5bea0a[_0x8164('0x16')](_0x55c33c)['send'](_0x435fd);};}exports['index']=function(_0x520c48,_0x5b8545){var _0x10b93a={},_0x1ea708={},_0x3d0617={'count':0x0,'rows':[]};var _0x5c8e69=_['map'](db[_0x8164('0x27')][_0x8164('0x28')],function(_0x4bbdf6){return{'name':_0x4bbdf6[_0x8164('0x29')],'type':_0x4bbdf6[_0x8164('0x2a')][_0x8164('0x2b')]};});_0x1ea708[_0x8164('0x2c')]=_[_0x8164('0x2d')](_0x5c8e69,'name');_0x1ea708[_0x8164('0x2e')]=_['keys'](_0x520c48[_0x8164('0x2e')]);_0x1ea708[_0x8164('0x2f')]=_['intersection'](_0x1ea708[_0x8164('0x2c')],_0x1ea708[_0x8164('0x2e')]);_0x10b93a['attributes']=_[_0x8164('0x30')](_0x1ea708[_0x8164('0x2c')],qs[_0x8164('0x31')](_0x520c48[_0x8164('0x2e')][_0x8164('0x31')]));_0x10b93a[_0x8164('0x32')]=_0x10b93a['attributes'][_0x8164('0x33')]?_0x10b93a[_0x8164('0x32')]:_0x1ea708[_0x8164('0x2c')];if(!_0x520c48['query'][_0x8164('0x34')](_0x8164('0x35'))){_0x10b93a[_0x8164('0x1b')]=qs[_0x8164('0x1b')](_0x520c48[_0x8164('0x2e')]['limit']);_0x10b93a['offset']=qs[_0x8164('0x19')](_0x520c48[_0x8164('0x2e')][_0x8164('0x19')]);}_0x10b93a['order']=qs[_0x8164('0x36')](_0x520c48['query'][_0x8164('0x36')]);_0x10b93a[_0x8164('0x37')]=qs['filters'](_['pick'](_0x520c48[_0x8164('0x2e')],_0x1ea708[_0x8164('0x2f')]),_0x5c8e69);if(_0x520c48[_0x8164('0x2e')][_0x8164('0x38')]){_0x10b93a[_0x8164('0x37')]=_[_0x8164('0x39')](_0x10b93a[_0x8164('0x37')],{'$or':_[_0x8164('0x2d')](_0x5c8e69,function(_0x3a604c){if(_0x3a604c[_0x8164('0x2a')]!==_0x8164('0x3a')){var _0x512231={};_0x512231[_0x3a604c['name']]={'$like':'%'+_0x520c48[_0x8164('0x2e')][_0x8164('0x38')]+'%'};return _0x512231;}})});}_0x10b93a=_[_0x8164('0x39')]({},_0x10b93a,_0x520c48['options']);var _0x5160f9={'where':_0x10b93a[_0x8164('0x37')]};return db[_0x8164('0x27')]['count'](_0x5160f9)['then'](function(_0x47e303){_0x3d0617['count']=_0x47e303;if(_0x520c48[_0x8164('0x2e')][_0x8164('0x3b')]){_0x10b93a[_0x8164('0x3c')]=[{'all':!![]}];}return db[_0x8164('0x27')][_0x8164('0x3d')](_0x10b93a);})[_0x8164('0x3e')](function(_0x440eb7){_0x3d0617[_0x8164('0x3f')]=_0x440eb7;return _0x3d0617;})[_0x8164('0x3e')](respondWithFilteredResult(_0x5b8545,_0x10b93a))[_0x8164('0x40')](handleError(_0x5b8545,null));};exports[_0x8164('0x41')]=function(_0x3ee0a1,_0x2f0b73){var _0x21a461={'raw':!![],'where':{'id':_0x3ee0a1['params']['id']}},_0x1b5e5d={};_0x1b5e5d[_0x8164('0x2c')]=_['keys'](db['VoiceQueuesLog'][_0x8164('0x28')]);_0x1b5e5d[_0x8164('0x2e')]=_[_0x8164('0x42')](_0x3ee0a1[_0x8164('0x2e')]);_0x1b5e5d[_0x8164('0x2f')]=_['intersection'](_0x1b5e5d[_0x8164('0x2c')],_0x1b5e5d[_0x8164('0x2e')]);_0x21a461[_0x8164('0x32')]=_['intersection'](_0x1b5e5d[_0x8164('0x2c')],qs[_0x8164('0x31')](_0x3ee0a1[_0x8164('0x2e')]['fields']));_0x21a461[_0x8164('0x32')]=_0x21a461[_0x8164('0x32')][_0x8164('0x33')]?_0x21a461[_0x8164('0x32')]:_0x1b5e5d['model'];if(_0x3ee0a1['query'][_0x8164('0x3b')]){_0x21a461[_0x8164('0x3c')]=[{'all':!![]}];}_0x21a461=_['merge']({},_0x21a461,_0x3ee0a1[_0x8164('0x43')]);return db[_0x8164('0x27')][_0x8164('0x44')](_0x21a461)['then'](handleEntityNotFound(_0x2f0b73,null))[_0x8164('0x3e')](respondWithResult(_0x2f0b73,null))[_0x8164('0x40')](handleError(_0x2f0b73,null));};exports[_0x8164('0x45')]=function(_0x94405,_0x4c397e){return db[_0x8164('0x27')][_0x8164('0x45')](_0x94405[_0x8164('0x46')],{})[_0x8164('0x3e')](respondWithResult(_0x4c397e,0xc9))['catch'](handleError(_0x4c397e,null));};exports[_0x8164('0x21')]=function(_0x3830d9,_0x5e1531){if(_0x3830d9[_0x8164('0x46')]['id']){delete _0x3830d9[_0x8164('0x46')]['id'];}return db[_0x8164('0x27')][_0x8164('0x44')]({'where':{'id':_0x3830d9[_0x8164('0x47')]['id']}})[_0x8164('0x3e')](handleEntityNotFound(_0x5e1531,null))[_0x8164('0x3e')](saveUpdates(_0x3830d9[_0x8164('0x46')],null))[_0x8164('0x3e')](respondWithResult(_0x5e1531,null))['catch'](handleError(_0x5e1531,null));};exports[_0x8164('0x22')]=function(_0x52b28b,_0xb9678b){return db['VoiceQueuesLog']['find']({'where':{'id':_0x52b28b[_0x8164('0x47')]['id']}})[_0x8164('0x3e')](handleEntityNotFound(_0xb9678b,null))[_0x8164('0x3e')](removeEntity(_0xb9678b,null))[_0x8164('0x40')](handleError(_0xb9678b,null));}; \ No newline at end of file +var _0x46c3=['show','length','catch','create','body','params','find','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0x46c3,0x99));var _0x346c=function(_0x1ebdd1,_0x4dde9d){_0x1ebdd1=_0x1ebdd1-0x0;var _0x32efb6=_0x46c3[_0x1ebdd1];return _0x32efb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x346c('0x0'));var moment=require(_0x346c('0x1'));var BPromise=require(_0x346c('0x2'));var Mustache=require(_0x346c('0x3'));var util=require(_0x346c('0x4'));var path=require(_0x346c('0x5'));var sox=require('sox');var csv=require(_0x346c('0x6'));var ejs=require(_0x346c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x346c('0x8'));var squel=require(_0x346c('0x9'));var crypto=require('crypto');var jsforce=require(_0x346c('0xa'));var deskjs=require(_0x346c('0xb'));var toCsv=require(_0x346c('0x6'));var querystring=require(_0x346c('0xc'));var Papa=require(_0x346c('0xd'));var Redis=require(_0x346c('0xe'));var authService=require(_0x346c('0xf'));var qs=require(_0x346c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x346c('0x11'));var logger=require(_0x346c('0x12'))('api');var utils=require(_0x346c('0x13'));var config=require(_0x346c('0x14'));var licenseUtil=require(_0x346c('0x15'));var db=require(_0x346c('0x16'))['db'];function respondWithStatusCode(_0x4c89b4,_0x58d8f1){_0x58d8f1=_0x58d8f1||0xcc;return function(_0x1cf694){if(_0x1cf694){return _0x4c89b4[_0x346c('0x17')](_0x58d8f1);}return _0x4c89b4[_0x346c('0x18')](_0x58d8f1)[_0x346c('0x19')]();};}function respondWithResult(_0x4ff02b,_0x551f2f){_0x551f2f=_0x551f2f||0xc8;return function(_0x57b37d){if(_0x57b37d){return _0x4ff02b['status'](_0x551f2f)[_0x346c('0x1a')](_0x57b37d);}};}function respondWithFilteredResult(_0xf965f5,_0x15721a){return function(_0x3b83cb){if(_0x3b83cb){var _0x1530ac=typeof _0x15721a[_0x346c('0x1b')]===_0x346c('0x1c')&&typeof _0x15721a[_0x346c('0x1d')]===_0x346c('0x1c');var _0x532881=_0x3b83cb['count'];var _0x45a3ff=_0x1530ac?0x0:_0x15721a[_0x346c('0x1b')];var _0x525a3f=_0x1530ac?_0x3b83cb[_0x346c('0x1e')]:_0x15721a['offset']+_0x15721a[_0x346c('0x1d')];var _0x2e059b;if(_0x525a3f>=_0x532881){_0x525a3f=_0x532881;_0x2e059b=0xc8;}else{_0x2e059b=0xce;}_0xf965f5[_0x346c('0x18')](_0x2e059b);return _0xf965f5[_0x346c('0x1f')](_0x346c('0x20'),_0x45a3ff+'-'+_0x525a3f+'/'+_0x532881)[_0x346c('0x1a')](_0x3b83cb);}return null;};}function patchUpdates(_0x392e34){return function(_0x550d9c){try{jsonpatch[_0x346c('0x21')](_0x550d9c,_0x392e34,!![]);}catch(_0x4d822d){return BPromise[_0x346c('0x22')](_0x4d822d);}return _0x550d9c[_0x346c('0x23')]();};}function saveUpdates(_0x2e0d42,_0x26e04b){return function(_0x12d22a){if(_0x12d22a){return _0x12d22a[_0x346c('0x24')](_0x2e0d42)[_0x346c('0x25')](function(_0x1bf310){return _0x1bf310;});}return null;};}function removeEntity(_0x32a4e9,_0x557044){return function(_0x250c5e){if(_0x250c5e){return _0x250c5e['destroy']()['then'](function(){_0x32a4e9[_0x346c('0x18')](0xcc)[_0x346c('0x19')]();});}};}function handleEntityNotFound(_0x55bdec,_0x2c9b47){return function(_0x4c6c29){if(!_0x4c6c29){_0x55bdec[_0x346c('0x17')](0x194);}return _0x4c6c29;};}function handleError(_0x45cefb,_0x4975a4){_0x4975a4=_0x4975a4||0x1f4;return function(_0x3758b7){logger[_0x346c('0x26')](_0x3758b7['stack']);if(_0x3758b7[_0x346c('0x27')]){delete _0x3758b7[_0x346c('0x27')];}_0x45cefb[_0x346c('0x18')](_0x4975a4)[_0x346c('0x28')](_0x3758b7);};}exports[_0x346c('0x29')]=function(_0x1505c6,_0x55cb9f){var _0x1b177d={},_0x5ed1ae={},_0x5ecfb3={'count':0x0,'rows':[]};var _0x67db93=_[_0x346c('0x2a')](db[_0x346c('0x2b')][_0x346c('0x2c')],function(_0x4ca640){return{'name':_0x4ca640[_0x346c('0x2d')],'type':_0x4ca640[_0x346c('0x2e')][_0x346c('0x2f')]};});_0x5ed1ae[_0x346c('0x30')]=_[_0x346c('0x2a')](_0x67db93,_0x346c('0x27'));_0x5ed1ae[_0x346c('0x31')]=_[_0x346c('0x32')](_0x1505c6['query']);_0x5ed1ae[_0x346c('0x33')]=_['intersection'](_0x5ed1ae[_0x346c('0x30')],_0x5ed1ae[_0x346c('0x31')]);_0x1b177d[_0x346c('0x34')]=_[_0x346c('0x35')](_0x5ed1ae['model'],qs[_0x346c('0x36')](_0x1505c6['query']['fields']));_0x1b177d[_0x346c('0x34')]=_0x1b177d[_0x346c('0x34')]['length']?_0x1b177d[_0x346c('0x34')]:_0x5ed1ae[_0x346c('0x30')];if(!_0x1505c6[_0x346c('0x31')][_0x346c('0x37')](_0x346c('0x38'))){_0x1b177d[_0x346c('0x1d')]=qs['limit'](_0x1505c6['query'][_0x346c('0x1d')]);_0x1b177d['offset']=qs[_0x346c('0x1b')](_0x1505c6[_0x346c('0x31')][_0x346c('0x1b')]);}_0x1b177d['order']=qs[_0x346c('0x39')](_0x1505c6[_0x346c('0x31')]['sort']);_0x1b177d[_0x346c('0x3a')]=qs[_0x346c('0x33')](_['pick'](_0x1505c6[_0x346c('0x31')],_0x5ed1ae[_0x346c('0x33')]),_0x67db93);if(_0x1505c6['query'][_0x346c('0x3b')]){_0x1b177d[_0x346c('0x3a')]=_[_0x346c('0x3c')](_0x1b177d[_0x346c('0x3a')],{'$or':_[_0x346c('0x2a')](_0x67db93,function(_0x3f679c){if(_0x3f679c[_0x346c('0x2e')]!==_0x346c('0x3d')){var _0x13bd5e={};_0x13bd5e[_0x3f679c[_0x346c('0x27')]]={'$like':'%'+_0x1505c6[_0x346c('0x31')]['filter']+'%'};return _0x13bd5e;}})});}_0x1b177d=_[_0x346c('0x3c')]({},_0x1b177d,_0x1505c6[_0x346c('0x3e')]);var _0x38114d={'where':_0x1b177d[_0x346c('0x3a')]};return db['VoiceQueuesLog']['count'](_0x38114d)[_0x346c('0x25')](function(_0x2fc13c){_0x5ecfb3['count']=_0x2fc13c;if(_0x1505c6[_0x346c('0x31')][_0x346c('0x3f')]){_0x1b177d[_0x346c('0x40')]=[{'all':!![]}];}return db[_0x346c('0x2b')][_0x346c('0x41')](_0x1b177d);})[_0x346c('0x25')](function(_0x4e58df){_0x5ecfb3['rows']=_0x4e58df;return _0x5ecfb3;})['then'](respondWithFilteredResult(_0x55cb9f,_0x1b177d))['catch'](handleError(_0x55cb9f,null));};exports[_0x346c('0x42')]=function(_0x57ce7d,_0x33b3ff){var _0x387955={'raw':!![],'where':{'id':_0x57ce7d['params']['id']}},_0x156670={};_0x156670[_0x346c('0x30')]=_[_0x346c('0x32')](db['VoiceQueuesLog'][_0x346c('0x2c')]);_0x156670[_0x346c('0x31')]=_[_0x346c('0x32')](_0x57ce7d[_0x346c('0x31')]);_0x156670[_0x346c('0x33')]=_[_0x346c('0x35')](_0x156670[_0x346c('0x30')],_0x156670[_0x346c('0x31')]);_0x387955['attributes']=_[_0x346c('0x35')](_0x156670[_0x346c('0x30')],qs['fields'](_0x57ce7d['query'][_0x346c('0x36')]));_0x387955['attributes']=_0x387955[_0x346c('0x34')][_0x346c('0x43')]?_0x387955[_0x346c('0x34')]:_0x156670[_0x346c('0x30')];if(_0x57ce7d['query'][_0x346c('0x3f')]){_0x387955[_0x346c('0x40')]=[{'all':!![]}];}_0x387955=_['merge']({},_0x387955,_0x57ce7d[_0x346c('0x3e')]);return db['VoiceQueuesLog']['find'](_0x387955)[_0x346c('0x25')](handleEntityNotFound(_0x33b3ff,null))[_0x346c('0x25')](respondWithResult(_0x33b3ff,null))[_0x346c('0x44')](handleError(_0x33b3ff,null));};exports[_0x346c('0x45')]=function(_0x91e41b,_0x2e19c9){return db['VoiceQueuesLog']['create'](_0x91e41b['body'],{})[_0x346c('0x25')](respondWithResult(_0x2e19c9,0xc9))[_0x346c('0x44')](handleError(_0x2e19c9,null));};exports['update']=function(_0x3417d9,_0x539667){if(_0x3417d9['body']['id']){delete _0x3417d9[_0x346c('0x46')]['id'];}return db[_0x346c('0x2b')]['find']({'where':{'id':_0x3417d9[_0x346c('0x47')]['id']}})[_0x346c('0x25')](handleEntityNotFound(_0x539667,null))[_0x346c('0x25')](saveUpdates(_0x3417d9[_0x346c('0x46')],null))[_0x346c('0x25')](respondWithResult(_0x539667,null))['catch'](handleError(_0x539667,null));};exports['destroy']=function(_0x1b47dc,_0x2bd5d4){return db[_0x346c('0x2b')][_0x346c('0x48')]({'where':{'id':_0x1b47dc[_0x346c('0x47')]['id']}})[_0x346c('0x25')](handleEntityNotFound(_0x2bd5d4,null))[_0x346c('0x25')](removeEntity(_0x2bd5d4,null))[_0x346c('0x44')](handleError(_0x2bd5d4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2f23ec9..c3c86d3 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 _0xb0c5=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','lodash','moment'];(function(_0x34c7a8,_0x1fde1c){var _0x34fc72=function(_0x1e38f0){while(--_0x1e38f0){_0x34c7a8['push'](_0x34c7a8['shift']());}};_0x34fc72(++_0x1fde1c);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x19140d,_0x201c46){_0x19140d=_0x19140d-0x0;var _0x5c37c1=_0xb0c5[_0x19140d];return _0x5c37c1;};'use strict';var _=require(_0x5b0c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b0c('0x1'));var BPromise=require(_0x5b0c('0x2'));var rp=require(_0x5b0c('0x3'));var fs=require('fs');var path=require(_0x5b0c('0x4'));var rimraf=require(_0x5b0c('0x5'));var config=require(_0x5b0c('0x6'));var attributes=require(_0x5b0c('0x7'));module[_0x5b0c('0x8')]=function(_0x48ad35,_0x4ea937){return _0x48ad35['define'](_0x5b0c('0x9'),attributes,{'tableName':_0x5b0c('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x5b0c('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x067d=['bluebird','request-promise','path','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x259b24,_0x17127a){var _0x3dec70=function(_0x40a937){while(--_0x40a937){_0x259b24['push'](_0x259b24['shift']());}};_0x3dec70(++_0x17127a);}(_0x067d,0x1db));var _0xd067=function(_0x5c12f2,_0x5de043){_0x5c12f2=_0x5c12f2-0x0;var _0x5e8344=_0x067d[_0x5c12f2];return _0x5e8344;};'use strict';var _=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var logger=require(_0xd067('0x2'))(_0xd067('0x3'));var moment=require(_0xd067('0x4'));var BPromise=require(_0xd067('0x5'));var rp=require(_0xd067('0x6'));var fs=require('fs');var path=require(_0xd067('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd067('0x8'));module[_0xd067('0x9')]=function(_0x169cc4,_0x9b246){return _0x169cc4['define'](_0xd067('0xa'),attributes,{'tableName':_0xd067('0xb'),'paranoid':![],'indexes':[{'name':_0xd067('0xc'),'fields':[_0xd067('0xd'),_0xd067('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2b25cd7..16d92a8 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 _0x5e24=['request','then','info','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x5e24,0xb2));var _0x45e2=function(_0x10d89b,_0x13351a){_0x10d89b=_0x10d89b-0x0;var _0x4251db=_0x5e24[_0x10d89b];return _0x4251db;};'use strict';var _=require('lodash');var util=require(_0x45e2('0x0'));var moment=require('moment');var BPromise=require(_0x45e2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45e2('0x2'));var db=require(_0x45e2('0x3'))['db'];var utils=require(_0x45e2('0x4'));var logger=require(_0x45e2('0x5'))(_0x45e2('0x6'));var config=require(_0x45e2('0x7'));var jayson=require(_0x45e2('0x8'));var client=jayson[_0x45e2('0x9')][_0x45e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a1c24,_0x4df492,_0x3b19a2){return new BPromise(function(_0x4a0829,_0x35ea06){return client[_0x45e2('0xb')](_0x8a1c24,_0x3b19a2)[_0x45e2('0xc')](function(_0x43e8f8){logger[_0x45e2('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4df492,_0x45e2('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4df492,'request\x20sent',JSON[_0x45e2('0xf')](_0x43e8f8));if(_0x43e8f8[_0x45e2('0x10')]){if(_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x11')]===0x1f4){logger[_0x45e2('0x10')](_0x45e2('0x12'),_0x4df492,_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);return _0x35ea06(_0x43e8f8['error'][_0x45e2('0x13')]);}logger[_0x45e2('0x10')](_0x45e2('0x12'),_0x4df492,_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);return _0x4a0829(_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);}else{logger[_0x45e2('0xd')](_0x45e2('0x12'),_0x4df492,_0x45e2('0xe'));_0x4a0829(_0x43e8f8[_0x45e2('0x14')][_0x45e2('0x13')]);}})['catch'](function(_0x286035){logger['error'](_0x45e2('0x12'),_0x4df492,_0x286035);_0x35ea06(_0x286035);});});} \ No newline at end of file +var _0xd136=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd136,0x94));var _0x6d13=function(_0x522528,_0x405111){_0x522528=_0x522528-0x0;var _0x47de1d=_0xd136[_0x522528];return _0x47de1d;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c475457..314c613 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 _0xca2f=['index','/describe','isAuthenticated','describe','/:id','show','/:id/download','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','get'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xca2f,0x119));var _0xfca2=function(_0x12058d,_0x922975){_0x12058d=_0x12058d-0x0;var _0x152865=_0xca2f[_0x12058d];return _0x152865;};'use strict';var multer=require(_0xfca2('0x0'));var util=require(_0xfca2('0x1'));var path=require(_0xfca2('0x2'));var timeout=require('connect-timeout');var express=require(_0xfca2('0x3'));var router=express[_0xfca2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfca2('0x5'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xfca2('0x6')]('/',auth['isAuthenticated'](),controller[_0xfca2('0x7')]);router[_0xfca2('0x6')](_0xfca2('0x8'),auth[_0xfca2('0x9')](),controller[_0xfca2('0xa')]);router['get'](_0xfca2('0xb'),auth['isAuthenticated'](),controller[_0xfca2('0xc')]);router[_0xfca2('0x6')](_0xfca2('0xd'),auth[_0xfca2('0x9')](),controller['download']);router['get']('/:id/downloads',controller[_0xfca2('0xe')]);router[_0xfca2('0x6')](_0xfca2('0xf'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfca2('0x11')]);router[_0xfca2('0x12')](_0xfca2('0xf'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x13')]);router[_0xfca2('0x14')](_0xfca2('0xb'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x15')]);router[_0xfca2('0x16')](_0xfca2('0xb'),auth[_0xfca2('0x9')](),controller['destroy']);module[_0xfca2('0x17')]=router; \ No newline at end of file +var _0xe2ed=['downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x2eee5e,_0x4509eb){var _0x3f98bb=function(_0x423abe){while(--_0x423abe){_0x2eee5e['push'](_0x2eee5e['shift']());}};_0x3f98bb(++_0x4509eb);}(_0xe2ed,0x6d));var _0xde2e=function(_0x3a125e,_0x514908){_0x3a125e=_0x3a125e-0x0;var _0x47f020=_0xe2ed[_0x3a125e];return _0x47f020;};'use strict';var multer=require('multer');var util=require(_0xde2e('0x0'));var path=require('path');var timeout=require(_0xde2e('0x1'));var express=require(_0xde2e('0x2'));var router=express['Router']();var fs_extra=require(_0xde2e('0x3'));var auth=require(_0xde2e('0x4'));var interaction=require(_0xde2e('0x5'));var config=require(_0xde2e('0x6'));var controller=require(_0xde2e('0x7'));router[_0xde2e('0x8')]('/',auth[_0xde2e('0x9')](),controller[_0xde2e('0xa')]);router[_0xde2e('0x8')](_0xde2e('0xb'),auth['isAuthenticated'](),controller[_0xde2e('0xc')]);router[_0xde2e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xde2e('0xd')]);router[_0xde2e('0x8')](_0xde2e('0xe'),auth[_0xde2e('0x9')](),controller[_0xde2e('0xf')]);router[_0xde2e('0x8')]('/:id/downloads',controller[_0xde2e('0x10')]);router['get'](_0xde2e('0x11'),auth[_0xde2e('0x9')](),controller[_0xde2e('0x12')]);router[_0xde2e('0x13')]('/',auth[_0xde2e('0x9')](),controller['create']);router[_0xde2e('0x13')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xde2e('0x14')]);router[_0xde2e('0x15')](_0xde2e('0x16'),auth[_0xde2e('0x9')](),controller['update']);router['delete'](_0xde2e('0x16'),auth[_0xde2e('0x9')](),controller[_0xde2e('0x17')]);module[_0xde2e('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d89de34..77335ee 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 5a577aa..626abe9 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 _0x6690=['TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','options','create','body','find','describe','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','download','filename','extname','unlink','message','send','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','Sequelize','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','createBucket','upload'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6690,0xd3));var _0x0669=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6690[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x0669('0x0'));var rimraf=require(_0x0669('0x1'));var zipdir=require(_0x0669('0x2'));var jsonpatch=require(_0x0669('0x3'));var rp=require(_0x0669('0x4'));var moment=require(_0x0669('0x5'));var BPromise=require(_0x0669('0x6'));var Mustache=require(_0x0669('0x7'));var util=require(_0x0669('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0669('0x9'));var ejs=require(_0x0669('0xa'));var fs=require('fs');var fs_extra=require(_0x0669('0xb'));var _=require(_0x0669('0xc'));var squel=require(_0x0669('0xd'));var crypto=require(_0x0669('0xe'));var jsforce=require(_0x0669('0xf'));var deskjs=require(_0x0669('0x10'));var toCsv=require(_0x0669('0x9'));var querystring=require(_0x0669('0x11'));var Papa=require(_0x0669('0x12'));var AWS=require(_0x0669('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0x0669('0x14'));var authService=require(_0x0669('0x15'));var qs=require(_0x0669('0x16'));var as=require(_0x0669('0x17'));var hardwareService=require(_0x0669('0x18'));var logger=require('../../config/logger')(_0x0669('0x19'));var utils=require(_0x0669('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0669('0x1b'));var db=require(_0x0669('0x1c'))['db'];function respondWithStatusCode(_0x35c608,_0x38b0d8){_0x38b0d8=_0x38b0d8||0xcc;return function(_0x2a2b3a){if(_0x2a2b3a){return _0x35c608[_0x0669('0x1d')](_0x38b0d8);}return _0x35c608[_0x0669('0x1e')](_0x38b0d8)[_0x0669('0x1f')]();};}function respondWithResult(_0x3185d8,_0x6553ee){_0x6553ee=_0x6553ee||0xc8;return function(_0x14acbd){if(_0x14acbd){return _0x3185d8['status'](_0x6553ee)[_0x0669('0x20')](_0x14acbd);}};}function respondWithFilteredResult(_0x10b97b,_0x46e6d7){return function(_0x3e7a4a){if(_0x3e7a4a){var _0x3e1feb=typeof _0x46e6d7[_0x0669('0x21')]==='undefined'&&typeof _0x46e6d7[_0x0669('0x22')]===_0x0669('0x23');var _0x4c8276=_0x3e7a4a[_0x0669('0x24')];var _0x5e07c1=_0x3e1feb?0x0:_0x46e6d7['offset'];var _0xc25e00=_0x3e1feb?_0x3e7a4a[_0x0669('0x24')]:_0x46e6d7[_0x0669('0x21')]+_0x46e6d7[_0x0669('0x22')];var _0x46b291;if(_0xc25e00>=_0x4c8276){_0xc25e00=_0x4c8276;_0x46b291=0xc8;}else{_0x46b291=0xce;}_0x10b97b[_0x0669('0x1e')](_0x46b291);return _0x10b97b[_0x0669('0x25')](_0x0669('0x26'),_0x5e07c1+'-'+_0xc25e00+'/'+_0x4c8276)[_0x0669('0x20')](_0x3e7a4a);}return null;};}function patchUpdates(_0x5446c6){return function(_0x21031b){try{jsonpatch['apply'](_0x21031b,_0x5446c6,!![]);}catch(_0x361147){return BPromise['reject'](_0x361147);}return _0x21031b['save']();};}function saveUpdates(_0x1f137c,_0x5682f5){return function(_0x5049ae){if(_0x5049ae){return _0x5049ae[_0x0669('0x27')](_0x1f137c)[_0x0669('0x28')](function(_0x4f6731){return _0x4f6731;});}return null;};}function removeEntity(_0x1143e7,_0x37e9cd){return function(_0x3e7fd5){if(_0x3e7fd5){return _0x3e7fd5[_0x0669('0x29')]()[_0x0669('0x28')](function(){_0x1143e7[_0x0669('0x1e')](0xcc)[_0x0669('0x1f')]();});}};}function handleEntityNotFound(_0x2cbfee,_0x4a1f4f){return function(_0x172df1){if(!_0x172df1){_0x2cbfee[_0x0669('0x1d')](0x194);}return _0x172df1;};}function handleError(_0x169959,_0x20b257){_0x20b257=_0x20b257||0x1f4;return function(_0x51865f){logger[_0x0669('0x2a')](_0x51865f[_0x0669('0x2b')]);if(_0x51865f[_0x0669('0x2c')]){delete _0x51865f[_0x0669('0x2c')];}_0x169959['status'](_0x20b257)['send'](_0x51865f);};}exports[_0x0669('0x2d')]=function(_0x44434e,_0x2aaf8e){var _0x3985ea={},_0x32d13f={},_0x5f4e90={'count':0x0,'rows':[]};var _0x1d1e7d=_[_0x0669('0x2e')](db[_0x0669('0x2f')][_0x0669('0x30')],function(_0x340bcc){return{'name':_0x340bcc[_0x0669('0x31')],'type':_0x340bcc[_0x0669('0x32')][_0x0669('0x33')]};});_0x32d13f[_0x0669('0x34')]=_[_0x0669('0x35')](_[_0x0669('0x2e')](_0x1d1e7d,_0x0669('0x2c')),[_0x0669('0x36')]);_0x32d13f[_0x0669('0x37')]=_[_0x0669('0x38')](_0x44434e[_0x0669('0x37')]);_0x32d13f['filters']=_['intersection'](_0x32d13f[_0x0669('0x34')],_0x32d13f[_0x0669('0x37')]);_0x3985ea[_0x0669('0x39')]=_['intersection'](_0x32d13f[_0x0669('0x34')],qs[_0x0669('0x3a')](_0x44434e[_0x0669('0x37')]['fields']));_0x3985ea[_0x0669('0x39')]=_0x3985ea[_0x0669('0x39')][_0x0669('0x3b')]?_0x3985ea['attributes']:_0x32d13f[_0x0669('0x34')];if(!_0x44434e[_0x0669('0x37')][_0x0669('0x3c')](_0x0669('0x3d'))){_0x3985ea[_0x0669('0x22')]=qs['limit'](_0x44434e['query']['limit']);_0x3985ea[_0x0669('0x21')]=qs[_0x0669('0x21')](_0x44434e[_0x0669('0x37')][_0x0669('0x21')]);}_0x3985ea[_0x0669('0x3e')]=qs[_0x0669('0x3f')](_0x44434e[_0x0669('0x37')]['sort']);_0x3985ea[_0x0669('0x40')]=qs[_0x0669('0x41')](_['pick'](_0x44434e[_0x0669('0x37')],_0x32d13f[_0x0669('0x41')]),_0x1d1e7d);if(_0x44434e[_0x0669('0x37')][_0x0669('0x42')]){_0x3985ea[_0x0669('0x40')]=_[_0x0669('0x43')](_0x3985ea['where'],{'$or':_['map'](_0x1d1e7d,function(_0x47dc85){if(_0x47dc85[_0x0669('0x32')]!==_0x0669('0x44')){var _0x2df864={};_0x2df864[_0x47dc85['name']]={'$like':'%'+_0x44434e[_0x0669('0x37')][_0x0669('0x42')]+'%'};return _0x2df864;}})});}_0x3985ea=_['merge']({},_0x3985ea,_0x44434e['options']);var _0x2501e5={'where':_0x3985ea[_0x0669('0x40')]};return db[_0x0669('0x2f')]['count'](_0x2501e5)['then'](function(_0x17e333){_0x5f4e90[_0x0669('0x24')]=_0x17e333;if(_0x44434e[_0x0669('0x37')][_0x0669('0x45')]){_0x3985ea[_0x0669('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0x0669('0x47')](_0x3985ea);})[_0x0669('0x28')](function(_0x53cb4d){_0x5f4e90['rows']=_0x53cb4d;return _0x5f4e90;})[_0x0669('0x28')](respondWithFilteredResult(_0x2aaf8e,_0x3985ea))[_0x0669('0x48')](handleError(_0x2aaf8e,null));};exports[_0x0669('0x49')]=function(_0x1222f4,_0x58365c){var _0xccf3ca={'raw':![],'where':{'id':_0x1222f4[_0x0669('0x4a')]['id']}},_0x290888={};_0x290888[_0x0669('0x34')]=_['keys'](db[_0x0669('0x2f')][_0x0669('0x30')]);_0x290888[_0x0669('0x37')]=_[_0x0669('0x38')](_0x1222f4[_0x0669('0x37')]);_0x290888[_0x0669('0x41')]=_[_0x0669('0x4b')](_0x290888[_0x0669('0x34')],_0x290888[_0x0669('0x37')]);_0xccf3ca[_0x0669('0x39')]=_['intersection'](_0x290888[_0x0669('0x34')],qs[_0x0669('0x3a')](_0x1222f4[_0x0669('0x37')][_0x0669('0x3a')]));_0xccf3ca['attributes']=_0xccf3ca[_0x0669('0x39')][_0x0669('0x3b')]?_0xccf3ca[_0x0669('0x39')]:_0x290888[_0x0669('0x34')];if(_0x1222f4['query'][_0x0669('0x45')]){_0xccf3ca[_0x0669('0x46')]=[{'all':!![]}];}_0xccf3ca=_[_0x0669('0x43')]({},_0xccf3ca,_0x1222f4[_0x0669('0x4c')]);return db['VoiceRecording']['find'](_0xccf3ca)[_0x0669('0x28')](handleEntityNotFound(_0x58365c,null))['then'](respondWithResult(_0x58365c,null))[_0x0669('0x48')](handleError(_0x58365c,null));};exports[_0x0669('0x4d')]=function(_0x27a211,_0x3c6581){return db[_0x0669('0x2f')][_0x0669('0x4d')](_0x27a211[_0x0669('0x4e')],{})[_0x0669('0x28')](respondWithResult(_0x3c6581,0xc9))[_0x0669('0x48')](handleError(_0x3c6581,null));};exports[_0x0669('0x27')]=function(_0x296ea8,_0x831381){if(_0x296ea8[_0x0669('0x4e')]['id']){delete _0x296ea8[_0x0669('0x4e')]['id'];}return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':{'id':_0x296ea8[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](handleEntityNotFound(_0x831381,null))[_0x0669('0x28')](saveUpdates(_0x296ea8['body'],null))[_0x0669('0x28')](respondWithResult(_0x831381,null))[_0x0669('0x48')](handleError(_0x831381,null));};exports[_0x0669('0x50')]=function(_0x16f50f,_0x226394){return db[_0x0669('0x2f')][_0x0669('0x50')]()[_0x0669('0x28')](respondWithResult(_0x226394,null))[_0x0669('0x48')](handleError(_0x226394,null));};exports['download']=function(_0x75ef7d,_0x629385,_0x57b417){var _0x137d87=require(_0x0669('0x51'));var _0xa6d030=![];var _0xe55cf8={};if(_0x75ef7d[_0x0669('0x37')][_0x0669('0x32')]&&_0x75ef7d[_0x0669('0x37')][_0x0669('0x32')]===_0x0669('0x52')){_0xe55cf8['uniqueid']=_0x75ef7d[_0x0669('0x4a')]['id'];}else{_0xe55cf8['id']=_0x75ef7d[_0x0669('0x4a')]['id'];}return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':_0xe55cf8,'attributes':['id',_0x0669('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x629385,null))['then'](function(_0x1aa354){if(_0x1aa354){var _0x77eea1=_0x1aa354[_0x0669('0x53')];var _0x25b9e4=util[_0x0669('0x36')]('%s.cypher',_0x77eea1);if(fs['existsSync'](_0x25b9e4)){_0xa6d030=!![];return _0x137d87[_0x0669('0x54')](_0x25b9e4,_0x77eea1,config[_0x0669('0x55')][_0x0669('0x56')])['then'](function(){return _0x1aa354;});}return _0x1aa354;}})[_0x0669('0x28')](function(_0xb652bc){if(_0xb652bc){var _0x34d26a=_0xb652bc[_0x0669('0x53')];if(!fs[_0x0669('0x57')](_0x34d26a)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xb652bc['filename']){return _0x629385[_0x0669('0x58')](_0x34d26a,_0xb652bc[_0x0669('0x59')]+path[_0x0669('0x5a')](_0x34d26a),function(){if(_0xa6d030){fs[_0x0669('0x5b')](_0x34d26a);}});}else{return _0x629385[_0x0669('0x58')](_0x34d26a,function(_0x273749){if(_0xa6d030){fs[_0x0669('0x5b')](_0x34d26a);}});}}})['catch'](function(_0x14331b){if(_0x14331b[_0x0669('0x5c')]==='VoiceRecording\x20not\x20found'){_0x629385[_0x0669('0x1e')](0x194)[_0x0669('0x5d')]('Not\x20found');}else{return handleError(_0x629385,null);}});};exports[_0x0669('0x5e')]=function(_0x77c523,_0x57c45c,_0x25b623){var _0xbf1525=require(_0x0669('0x51'));var _0xca83cb=![];var _0x14a033={'$and':[db[_0x0669('0x5f')][_0x0669('0x40')](db[_0x0669('0x5f')]['fn'](_0x0669('0x60'),db[_0x0669('0x5f')][_0x0669('0x61')](_0x0669('0x52'))),_0x77c523['query'][_0x0669('0x62')])]};if(_0x77c523['query'][_0x0669('0x32')]&&_0x77c523[_0x0669('0x37')][_0x0669('0x32')]===_0x0669('0x52')){_0x14a033[_0x0669('0x63')][_0x0669('0x64')]({'uniqueid':_0x77c523[_0x0669('0x4a')]['id']});}else{_0x14a033[_0x0669('0x63')][_0x0669('0x64')]({'id':_0x77c523[_0x0669('0x4a')]['id']});}return db[_0x0669('0x2f')]['find']({'where':_0x14a033,'attributes':['id',_0x0669('0x53')],'raw':!![]})[_0x0669('0x28')](handleEntityNotFound(_0x57c45c,null))['then'](function(_0xabdf21){if(_0xabdf21){var _0x4f5712=util[_0x0669('0x36')](_0x0669('0x65'),_0xabdf21[_0x0669('0x53')]);if(fs[_0x0669('0x57')](_0x4f5712)){_0xca83cb=!![];return _0xbf1525[_0x0669('0x54')](_0x4f5712,_0xabdf21[_0x0669('0x53')],config[_0x0669('0x55')][_0x0669('0x56')])[_0x0669('0x28')](function(){return _0xabdf21;});}return _0xabdf21;}})[_0x0669('0x28')](function(_0x4cf56f){if(_0x4cf56f){if(!fs['existsSync'](_0x4cf56f[_0x0669('0x53')])){throw new db[(_0x0669('0x66'))]['ValidationError'](_0x0669('0x67'));}if(_0x4cf56f[_0x0669('0x59')]){return _0x57c45c[_0x0669('0x58')](_0x4cf56f[_0x0669('0x53')],_0x4cf56f[_0x0669('0x59')]+path['extname'](_0x4cf56f[_0x0669('0x53')]),function(){if(_0xca83cb){fs[_0x0669('0x5b')](_0x4cf56f[_0x0669('0x53')]);}});}else{return _0x57c45c['download'](_0x4cf56f[_0x0669('0x53')],function(_0x5aa96a){if(_0xca83cb){fs['unlink'](_0x4cf56f[_0x0669('0x53')]);}});}}})[_0x0669('0x48')](handleError(_0x57c45c,null));};exports[_0x0669('0x29')]=function(_0x43c576,_0x2b87ee){return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':{'id':_0x43c576[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](function(_0x17bd0f){if(_['isNil'](_0x17bd0f)){throw new ReferenceError(_0x0669('0x68'));}return _0x17bd0f;})[_0x0669('0x28')](function(_0x1613b8){var _0x5e7eb4=_0x1613b8[_0x0669('0x53')];logger[_0x0669('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x5e7eb4);if(!_[_0x0669('0x6a')](_0x1613b8['value'])&&fs[_0x0669('0x57')](_0x5e7eb4)){logger[_0x0669('0x69')]('File:\x20\x22'+_0x5e7eb4+_0x0669('0x6b'));fs[_0x0669('0x6c')](_0x5e7eb4);}_0x5e7eb4=_0x5e7eb4+_0x0669('0x6d');if(!_[_0x0669('0x6a')](_0x1613b8['value'])&&fs[_0x0669('0x57')](_0x5e7eb4)){logger[_0x0669('0x69')](_0x0669('0x6e')+_0x5e7eb4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5e7eb4);}return _0x1613b8;})[_0x0669('0x28')](function(_0x400f96){if(!_0x400f96)throw new InternalError();return _0x400f96['destroy']();})[_0x0669('0x28')](function(){_0x2b87ee['status'](0xcc)[_0x0669('0x1f')]();})[_0x0669('0x48')](handleError(_0x2b87ee,null));};function getBucketslist(_0x2959e4,_0x1a5eee,_0x5cf49c){return new Promise(function(_0x26263d,_0xb37aa1){var _0x53c93f=new AWS['S3']({'accessKeyId':_0x1a5eee,'secretAccessKey':_0x2959e4,'region':_0x5cf49c});_0x53c93f['listBuckets']({},function(_0x312ed7,_0x5cb16a){if(_0x312ed7){return _0xb37aa1(_0x312ed7);}else{return _0x26263d(_0x5cb16a);}});});}function createBucket(_0x2727cb,_0x238306,_0x55a30b,_0x972e16){return new Promise(function(_0x1f18ce,_0x6e6c8f){var _0x10648f=new AWS['S3']({'accessKeyId':_0x238306,'secretAccessKey':_0x2727cb,'region':_0x55a30b});_0x10648f[_0x0669('0x6f')]({'Bucket':_0x972e16},function(_0x2d42c4,_0x4d75e9){if(_0x2d42c4){return _0x6e6c8f(_0x2d42c4);}else{return _0x1f18ce(_0x4d75e9);}});});}function uploadFile(_0x175067,_0x41a99d,_0x33dda9,_0x553922,_0x255037,_0x17bd2e){return new Promise(function(_0x38746c,_0x265fdc){var _0x4fc752=new AWS['S3']({'accessKeyId':_0x41a99d,'secretAccessKey':_0x175067,'region':_0x33dda9});_0x4fc752[_0x0669('0x70')]({'Bucket':_0x553922,'Key':_0x255037,'Body':_0x17bd2e},function(_0xfb2649,_0x158e87){if(_0xfb2649){return _0x265fdc(_0xfb2649);}else{return _0x38746c(_0x158e87);}});});}function startTranscribe(_0x23962c,_0x222b0e,_0x278f33,_0x36bf9e,_0x4e43a2,_0x432473){return new Promise(function(_0x4b9ade,_0x6ec199){var _0x4b21e8=new AWS[(_0x0669('0x71'))]({'accessKeyId':_0x222b0e,'secretAccessKey':_0x23962c,'region':_0x278f33});_0x4b21e8[_0x0669('0x72')]({'TranscriptionJobName':_0x36bf9e,'LanguageCode':_0x4e43a2,'Media':{'MediaFileUri':_0x432473}},function(_0x1ccfbb,_0x3b217a){if(_0x1ccfbb){return _0x6ec199(_0x1ccfbb);}else{return _0x4b9ade(_0x3b217a);}});});}function transcribe(_0x26635d,_0x2476cc,_0x38f73b,_0x1b6854,_0x1df90d,_0xb756af,_0x551dd1){return new Promise(function(_0x4a6358,_0x4a94c7){var _0x5a1d21={};logger[_0x0669('0x69')](util[_0x0669('0x36')](_0x0669('0x73'),_0x26635d,_0x1df90d));return uploadFile(_0x2476cc,_0x38f73b,_0x1b6854,_0x1df90d,path[_0x0669('0x74')](_0xb756af),fs[_0x0669('0x75')](_0xb756af))[_0x0669('0x28')](function(_0x34e8ad){logger['info'](util[_0x0669('0x36')](_0x0669('0x76'),_0x26635d,_0x1df90d,_0x34e8ad[_0x0669('0x77')]));_0x5a1d21[_0x0669('0x78')]=_0x34e8ad[_0x0669('0x79')];_0x5a1d21['location']=_0x34e8ad[_0x0669('0x77')];logger[_0x0669('0x69')](util['format'](_0x0669('0x7a'),_0x26635d));return startTranscribe(_0x2476cc,_0x38f73b,_0x1b6854,uuidv4(),_0x551dd1,_0x34e8ad['Location']);})[_0x0669('0x28')](function(_0x4266cd){logger['info'](util[_0x0669('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x26635d,_0x4266cd[_0x0669('0x7b')]['TranscriptionJobName']));_0x5a1d21[_0x0669('0x7c')]=_0x4266cd['TranscriptionJob'][_0x0669('0x7d')];_0x5a1d21[_0x0669('0x7e')]=_0x4266cd[_0x0669('0x7b')][_0x0669('0x7f')];return _0x4a6358(_0x5a1d21);})[_0x0669('0x48')](function(_0x4b8ab2){return _0x4a94c7(_0x4b8ab2);});});}exports[_0x0669('0x80')]=function(_0x45faa6,_0x2455dc,_0x1db7ae){var _0x39b7de;var _0xf6d6c1;var _0x5c50eb;var _0x1acb4c=require('../../components/encryptor');return db[_0x0669('0x2f')]['findOne']({'where':{'id':_0x45faa6['params']['id']}})[_0x0669('0x28')](function(_0x1e1eb0){if(_0x1e1eb0){var _0x4436ac=util[_0x0669('0x36')](_0x0669('0x65'),_0x1e1eb0['value']);if(fs[_0x0669('0x57')](_0x4436ac)){cypher=!![];return _0x1acb4c['decryptFile'](_0x4436ac,_0x1e1eb0[_0x0669('0x53')],config[_0x0669('0x55')][_0x0669('0x56')])['then'](function(){return _0x1e1eb0;});}return _0x1e1eb0;}})['then'](function(_0x191528){if(!_0x191528){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x82'));}_0xf6d6c1=_0x191528;return db[_0x0669('0x83')]['findOne']({'where':{'id':0x1}});})[_0x0669('0x28')](handleEntityNotFound(_0x2455dc,null))[_0x0669('0x28')](function(_0x197593){if(_0x197593){_0x39b7de=_0x197593;if(!_0x39b7de[_0x0669('0x84')]||!_0x39b7de[_0x0669('0x85')]||!_0x39b7de[_0x0669('0x86')]||!_0x39b7de[_0x0669('0x87')]||!_0x39b7de[_0x0669('0x78')]){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x88'));}if(_0x45faa6[_0x0669('0x4e')][_0x0669('0x89')]&&(!_0x39b7de[_0x0669('0x8a')]||!_0x39b7de[_0x0669('0x8b')]||!_0x39b7de[_0x0669('0x8c')]||!_0x39b7de[_0x0669('0x87')]||!_0x39b7de[_0x0669('0x78')])){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x8d'));}return db[_0x0669('0x8e')]['findOne']({'where':{'id':_0x39b7de[_0x0669('0x85')]}});}})[_0x0669('0x28')](function(_0x4d558f){if(!_0x4d558f){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x8f'));}if(!_0x4d558f[_0x0669('0x90')]||!_0x4d558f[_0x0669('0x91')]){throw new db['Sequelize'][(_0x0669('0x81'))](_0x0669('0x92'));}_0x5c50eb=_0x4d558f;return getBucketslist(_0x5c50eb[_0x0669('0x90')],_0x5c50eb[_0x0669('0x91')],_0x39b7de['transcribeRegion']);})[_0x0669('0x28')](function(_0x19a6af){if(_0x19a6af&&_0x19a6af[_0x0669('0x93')]){var _0x496203=_[_0x0669('0x4f')](_0x19a6af[_0x0669('0x93')],function(_0x509e7e){return _0x509e7e[_0x0669('0x94')]===_0x39b7de[_0x0669('0x78')];});if(!_0x496203){logger[_0x0669('0x69')](util[_0x0669('0x36')](_0x0669('0x95'),_0x45faa6[_0x0669('0x4a')]['id'],_0x39b7de['bucket']));return createBucket(_0x5c50eb['data1'],_0x5c50eb['data2'],_0x39b7de[_0x0669('0x86')],_0x39b7de[_0x0669('0x78')]);}logger['info'](util[_0x0669('0x36')](_0x0669('0x96'),_0x45faa6[_0x0669('0x4a')]['id'],_0x39b7de['bucket']));return;}})['then'](function(_0x14e9fd){if(_0xf6d6c1[_0x0669('0x7e')]===_0x0669('0x97')){return transcribe(_0x45faa6[_0x0669('0x4a')]['id'],_0x5c50eb[_0x0669('0x90')],_0x5c50eb['data2'],_0x39b7de[_0x0669('0x86')],_0x39b7de[_0x0669('0x78')],_0xf6d6c1[_0x0669('0x53')],_0x39b7de['language']);}else{logger['info'](util[_0x0669('0x36')](_0x0669('0x98'),_0x45faa6[_0x0669('0x4a')]['id']));return{'transcribeStatus':_0x0669('0x99')};}})['then'](function(_0x2c0b82){if(_0x2c0b82){_0x2c0b82[_0x0669('0x9a')]=_0x45faa6[_0x0669('0x4e')]['runSentiment'];return _0xf6d6c1[_0x0669('0x9b')](_0x2c0b82);}})[_0x0669('0x28')](respondWithResult(_0x2455dc,null))[_0x0669('0x48')](handleError(_0x2455dc,null));};function writeFile(_0x51c923,_0x251994){return new Promise(function(_0x35212f,_0x4d5108){fs['writeFile'](_0x251994,_0x51c923,function(_0x1bc42e,_0xba75c5){if(_0x1bc42e){return _0x4d5108(_0x1bc42e);}else{return _0x35212f(_0xba75c5);}});});}exports[_0x0669('0x9c')]=function(_0x19d580,_0x328df7,_0x51bbc8){return db['VoiceRecording'][_0x0669('0x9d')]({'where':{'id':_0x19d580[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](handleEntityNotFound(_0x328df7))[_0x0669('0x28')](function(_0x115314){if(_0x115314&&_0x115314[_0x0669('0x9e')]){var _0x51454b=_0x115314['fileText'];var _0x29188a=config[_0x0669('0x9f')]+_0x0669('0xa0')+_0x115314['id']+_0x0669('0xa1');if(fs[_0x0669('0x57')](_0x29188a)){return _0x29188a;}return writeFile(_0x51454b,_0x29188a)['then'](function(){return _0x29188a;});}else{throw new db[(_0x0669('0x66'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x0669('0x28')](function(_0x19c9e){return _0x328df7[_0x0669('0x58')](_0x19c9e);})[_0x0669('0x48')](handleError(_0x328df7));}; \ No newline at end of file +var _0xbae1=['decryptFile','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','runTranscribe','findOne','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','language','IN_PROGRESS','tempSentiment','writeFile','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','intersection','options','catch','create','body','find','params','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','col','$and'];(function(_0x2509c7,_0x36e452){var _0x4e9c91=function(_0x59ca63){while(--_0x59ca63){_0x2509c7['push'](_0x2509c7['shift']());}};_0x4e9c91(++_0x36e452);}(_0xbae1,0x1e2));var _0x1bae=function(_0x55ab83,_0x1223b5){_0x55ab83=_0x55ab83-0x0;var _0x3d9c8f=_0xbae1[_0x55ab83];return _0x3d9c8f;};'use strict';var emlformat=require(_0x1bae('0x0'));var rimraf=require(_0x1bae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1bae('0x3'));var Mustache=require('mustache');var util=require(_0x1bae('0x4'));var path=require(_0x1bae('0x5'));var sox=require(_0x1bae('0x6'));var csv=require(_0x1bae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bae('0x8'));var _=require(_0x1bae('0x9'));var squel=require('squel');var crypto=require(_0x1bae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1bae('0xb'));var toCsv=require(_0x1bae('0x7'));var querystring=require(_0x1bae('0xc'));var Papa=require(_0x1bae('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x1bae('0xe'));var Redis=require(_0x1bae('0xf'));var authService=require(_0x1bae('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1bae('0x11'));var hardwareService=require(_0x1bae('0x12'));var logger=require(_0x1bae('0x13'))('api');var utils=require(_0x1bae('0x14'));var config=require(_0x1bae('0x15'));var licenseUtil=require(_0x1bae('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da007,_0x5e1cd8){_0x5e1cd8=_0x5e1cd8||0xcc;return function(_0x5ad3e1){if(_0x5ad3e1){return _0x3da007[_0x1bae('0x17')](_0x5e1cd8);}return _0x3da007['status'](_0x5e1cd8)[_0x1bae('0x18')]();};}function respondWithResult(_0x2a0065,_0x1435a9){_0x1435a9=_0x1435a9||0xc8;return function(_0x24fba8){if(_0x24fba8){return _0x2a0065[_0x1bae('0x19')](_0x1435a9)['json'](_0x24fba8);}};}function respondWithFilteredResult(_0x405c2e,_0x5e4187){return function(_0x1fcbfc){if(_0x1fcbfc){var _0xa0a922=typeof _0x5e4187[_0x1bae('0x1a')]===_0x1bae('0x1b')&&typeof _0x5e4187['limit']==='undefined';var _0x3414df=_0x1fcbfc[_0x1bae('0x1c')];var _0x1de58e=_0xa0a922?0x0:_0x5e4187[_0x1bae('0x1a')];var _0x250838=_0xa0a922?_0x1fcbfc[_0x1bae('0x1c')]:_0x5e4187[_0x1bae('0x1a')]+_0x5e4187[_0x1bae('0x1d')];var _0x435da9;if(_0x250838>=_0x3414df){_0x250838=_0x3414df;_0x435da9=0xc8;}else{_0x435da9=0xce;}_0x405c2e[_0x1bae('0x19')](_0x435da9);return _0x405c2e['set'](_0x1bae('0x1e'),_0x1de58e+'-'+_0x250838+'/'+_0x3414df)[_0x1bae('0x1f')](_0x1fcbfc);}return null;};}function patchUpdates(_0x42cd39){return function(_0x1e10d9){try{jsonpatch[_0x1bae('0x20')](_0x1e10d9,_0x42cd39,!![]);}catch(_0x20a6e2){return BPromise[_0x1bae('0x21')](_0x20a6e2);}return _0x1e10d9[_0x1bae('0x22')]();};}function saveUpdates(_0x41bc42,_0x4391b9){return function(_0x1d9615){if(_0x1d9615){return _0x1d9615[_0x1bae('0x23')](_0x41bc42)['then'](function(_0x5d7cc0){return _0x5d7cc0;});}return null;};}function removeEntity(_0x26f137,_0x5784d4){return function(_0x40f84c){if(_0x40f84c){return _0x40f84c[_0x1bae('0x24')]()[_0x1bae('0x25')](function(){_0x26f137[_0x1bae('0x19')](0xcc)[_0x1bae('0x18')]();});}};}function handleEntityNotFound(_0x34dc81,_0x25500a){return function(_0x332ef0){if(!_0x332ef0){_0x34dc81['sendStatus'](0x194);}return _0x332ef0;};}function handleError(_0x2cd196,_0x58b8b5){_0x58b8b5=_0x58b8b5||0x1f4;return function(_0x38a48a){logger[_0x1bae('0x26')](_0x38a48a['stack']);if(_0x38a48a['name']){delete _0x38a48a[_0x1bae('0x27')];}_0x2cd196['status'](_0x58b8b5)['send'](_0x38a48a);};}exports[_0x1bae('0x28')]=function(_0x2dd61a,_0xb3fadd){var _0x43d8a7={},_0x2203d7={},_0x2cacf2={'count':0x0,'rows':[]};var _0x35df17=_[_0x1bae('0x29')](db[_0x1bae('0x2a')][_0x1bae('0x2b')],function(_0x486368){return{'name':_0x486368[_0x1bae('0x2c')],'type':_0x486368[_0x1bae('0x2d')][_0x1bae('0x2e')]};});_0x2203d7[_0x1bae('0x2f')]=_['differenceBy'](_[_0x1bae('0x29')](_0x35df17,'name'),['format']);_0x2203d7['query']=_[_0x1bae('0x30')](_0x2dd61a[_0x1bae('0x31')]);_0x2203d7[_0x1bae('0x32')]=_['intersection'](_0x2203d7['model'],_0x2203d7[_0x1bae('0x31')]);_0x43d8a7[_0x1bae('0x33')]=_['intersection'](_0x2203d7['model'],qs[_0x1bae('0x34')](_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x34')]));_0x43d8a7[_0x1bae('0x33')]=_0x43d8a7['attributes'][_0x1bae('0x35')]?_0x43d8a7['attributes']:_0x2203d7['model'];if(!_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x36')](_0x1bae('0x37'))){_0x43d8a7[_0x1bae('0x1d')]=qs[_0x1bae('0x1d')](_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x1d')]);_0x43d8a7[_0x1bae('0x1a')]=qs[_0x1bae('0x1a')](_0x2dd61a['query'][_0x1bae('0x1a')]);}_0x43d8a7['order']=qs[_0x1bae('0x38')](_0x2dd61a[_0x1bae('0x31')]['sort']);_0x43d8a7['where']=qs[_0x1bae('0x32')](_[_0x1bae('0x39')](_0x2dd61a['query'],_0x2203d7['filters']),_0x35df17);if(_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3a')]){_0x43d8a7[_0x1bae('0x3b')]=_[_0x1bae('0x3c')](_0x43d8a7[_0x1bae('0x3b')],{'$or':_['map'](_0x35df17,function(_0x2e6682){if(_0x2e6682[_0x1bae('0x2d')]!==_0x1bae('0x3d')){var _0x47bc62={};_0x47bc62[_0x2e6682[_0x1bae('0x27')]]={'$like':'%'+_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3a')]+'%'};return _0x47bc62;}})});}_0x43d8a7=_[_0x1bae('0x3c')]({},_0x43d8a7,_0x2dd61a['options']);var _0xf02e77={'where':_0x43d8a7[_0x1bae('0x3b')]};return db[_0x1bae('0x2a')][_0x1bae('0x1c')](_0xf02e77)['then'](function(_0x5cfcb6){_0x2cacf2[_0x1bae('0x1c')]=_0x5cfcb6;if(_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3e')]){_0x43d8a7[_0x1bae('0x3f')]=[{'all':!![]}];}return db[_0x1bae('0x2a')][_0x1bae('0x40')](_0x43d8a7);})[_0x1bae('0x25')](function(_0x5e1e6c){_0x2cacf2['rows']=_0x5e1e6c;return _0x2cacf2;})[_0x1bae('0x25')](respondWithFilteredResult(_0xb3fadd,_0x43d8a7))['catch'](handleError(_0xb3fadd,null));};exports[_0x1bae('0x41')]=function(_0x566866,_0x5473c4){var _0x317559={'raw':![],'where':{'id':_0x566866['params']['id']}},_0xe4ed8a={};_0xe4ed8a[_0x1bae('0x2f')]=_[_0x1bae('0x30')](db['VoiceRecording'][_0x1bae('0x2b')]);_0xe4ed8a['query']=_[_0x1bae('0x30')](_0x566866[_0x1bae('0x31')]);_0xe4ed8a[_0x1bae('0x32')]=_[_0x1bae('0x42')](_0xe4ed8a[_0x1bae('0x2f')],_0xe4ed8a[_0x1bae('0x31')]);_0x317559[_0x1bae('0x33')]=_['intersection'](_0xe4ed8a[_0x1bae('0x2f')],qs[_0x1bae('0x34')](_0x566866[_0x1bae('0x31')][_0x1bae('0x34')]));_0x317559[_0x1bae('0x33')]=_0x317559['attributes'][_0x1bae('0x35')]?_0x317559['attributes']:_0xe4ed8a['model'];if(_0x566866[_0x1bae('0x31')]['includeAll']){_0x317559[_0x1bae('0x3f')]=[{'all':!![]}];}_0x317559=_['merge']({},_0x317559,_0x566866[_0x1bae('0x43')]);return db[_0x1bae('0x2a')]['find'](_0x317559)[_0x1bae('0x25')](handleEntityNotFound(_0x5473c4,null))[_0x1bae('0x25')](respondWithResult(_0x5473c4,null))[_0x1bae('0x44')](handleError(_0x5473c4,null));};exports[_0x1bae('0x45')]=function(_0x12daa4,_0x4c2285){return db['VoiceRecording']['create'](_0x12daa4[_0x1bae('0x46')],{})['then'](respondWithResult(_0x4c2285,0xc9))[_0x1bae('0x44')](handleError(_0x4c2285,null));};exports[_0x1bae('0x23')]=function(_0x24891f,_0x28ccc0){if(_0x24891f[_0x1bae('0x46')]['id']){delete _0x24891f['body']['id'];}return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':{'id':_0x24891f[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](handleEntityNotFound(_0x28ccc0,null))['then'](saveUpdates(_0x24891f[_0x1bae('0x46')],null))[_0x1bae('0x25')](respondWithResult(_0x28ccc0,null))[_0x1bae('0x44')](handleError(_0x28ccc0,null));};exports[_0x1bae('0x49')]=function(_0x1a61cf,_0x333ef6){return db[_0x1bae('0x2a')][_0x1bae('0x49')]()[_0x1bae('0x25')](respondWithResult(_0x333ef6,null))[_0x1bae('0x44')](handleError(_0x333ef6,null));};exports[_0x1bae('0x4a')]=function(_0x4f3e3,_0x5a407e,_0x1287e0){var _0x6192f6=require(_0x1bae('0x4b'));var _0x22f51a=![];var _0x488935={};if(_0x4f3e3['query'][_0x1bae('0x2d')]&&_0x4f3e3[_0x1bae('0x31')]['type']===_0x1bae('0x4c')){_0x488935[_0x1bae('0x4c')]=_0x4f3e3['params']['id'];}else{_0x488935['id']=_0x4f3e3['params']['id'];}return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':_0x488935,'attributes':['id',_0x1bae('0x4d')],'raw':!![]})[_0x1bae('0x25')](handleEntityNotFound(_0x5a407e,null))[_0x1bae('0x25')](function(_0x39a8ae){if(_0x39a8ae){var _0x5d1669=_0x39a8ae[_0x1bae('0x4d')];var _0x15b327=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x5d1669);if(fs[_0x1bae('0x50')](_0x15b327)){_0x22f51a=!![];return _0x6192f6['decryptFile'](_0x15b327,_0x5d1669,config[_0x1bae('0x51')][_0x1bae('0x52')])['then'](function(){return _0x39a8ae;});}return _0x39a8ae;}})[_0x1bae('0x25')](function(_0x1d598a){if(_0x1d598a){var _0x33d652=_0x1d598a[_0x1bae('0x4d')];if(!fs[_0x1bae('0x50')](_0x33d652)){throw new db[(_0x1bae('0x53'))]['ValidationError'](_0x1bae('0x54'));}if(_0x1d598a[_0x1bae('0x55')]){return _0x5a407e[_0x1bae('0x4a')](_0x33d652,_0x1d598a['filename']+path[_0x1bae('0x56')](_0x33d652),function(){if(_0x22f51a){fs['unlink'](_0x33d652);}});}else{return _0x5a407e[_0x1bae('0x4a')](_0x33d652,function(_0x89582f){if(_0x22f51a){fs[_0x1bae('0x57')](_0x33d652);}});}}})[_0x1bae('0x44')](function(_0x1cab1a){if(_0x1cab1a[_0x1bae('0x58')]===_0x1bae('0x54')){_0x5a407e[_0x1bae('0x19')](0x194)[_0x1bae('0x59')](_0x1bae('0x5a'));}else{return handleError(_0x5a407e,null);}});};exports['downloads']=function(_0x35dae8,_0x35e44a,_0x4861a1){var _0x120a4c=require(_0x1bae('0x4b'));var _0x2d5342=![];var _0x177565={'$and':[db[_0x1bae('0x5b')]['where'](db[_0x1bae('0x5b')]['fn']('MD5',db[_0x1bae('0x5b')][_0x1bae('0x5c')](_0x1bae('0x4c'))),_0x35dae8['query']['token'])]};if(_0x35dae8['query'][_0x1bae('0x2d')]&&_0x35dae8[_0x1bae('0x31')]['type']===_0x1bae('0x4c')){_0x177565[_0x1bae('0x5d')]['push']({'uniqueid':_0x35dae8[_0x1bae('0x48')]['id']});}else{_0x177565[_0x1bae('0x5d')]['push']({'id':_0x35dae8[_0x1bae('0x48')]['id']});}return db['VoiceRecording'][_0x1bae('0x47')]({'where':_0x177565,'attributes':['id',_0x1bae('0x4d')],'raw':!![]})[_0x1bae('0x25')](handleEntityNotFound(_0x35e44a,null))[_0x1bae('0x25')](function(_0x4fd795){if(_0x4fd795){var _0x2e1133=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x4fd795[_0x1bae('0x4d')]);if(fs[_0x1bae('0x50')](_0x2e1133)){_0x2d5342=!![];return _0x120a4c[_0x1bae('0x5e')](_0x2e1133,_0x4fd795[_0x1bae('0x4d')],config[_0x1bae('0x51')][_0x1bae('0x52')])[_0x1bae('0x25')](function(){return _0x4fd795;});}return _0x4fd795;}})['then'](function(_0x286acf){if(_0x286acf){if(!fs[_0x1bae('0x50')](_0x286acf['value'])){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x54'));}if(_0x286acf[_0x1bae('0x55')]){return _0x35e44a[_0x1bae('0x4a')](_0x286acf['value'],_0x286acf[_0x1bae('0x55')]+path[_0x1bae('0x56')](_0x286acf['value']),function(){if(_0x2d5342){fs[_0x1bae('0x57')](_0x286acf[_0x1bae('0x4d')]);}});}else{return _0x35e44a['download'](_0x286acf['value'],function(_0x293450){if(_0x2d5342){fs[_0x1bae('0x57')](_0x286acf['value']);}});}}})[_0x1bae('0x44')](handleError(_0x35e44a,null));};exports[_0x1bae('0x24')]=function(_0x417f6f,_0x49f63d){return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':{'id':_0x417f6f[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](function(_0xb71a11){if(_[_0x1bae('0x60')](_0xb71a11)){throw new ReferenceError(_0x1bae('0x61'));}return _0xb71a11;})[_0x1bae('0x25')](function(_0x2a7b1e){var _0x141430=_0x2a7b1e[_0x1bae('0x4d')];logger[_0x1bae('0x62')](_0x1bae('0x63'),_0x141430);if(!_[_0x1bae('0x60')](_0x2a7b1e[_0x1bae('0x4d')])&&fs[_0x1bae('0x50')](_0x141430)){logger[_0x1bae('0x62')](_0x1bae('0x64')+_0x141430+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x141430);}_0x141430=_0x141430+_0x1bae('0x65');if(!_[_0x1bae('0x60')](_0x2a7b1e[_0x1bae('0x4d')])&&fs[_0x1bae('0x50')](_0x141430)){logger['info'](_0x1bae('0x64')+_0x141430+_0x1bae('0x66'));fs[_0x1bae('0x67')](_0x141430);}return _0x2a7b1e;})[_0x1bae('0x25')](function(_0xd4722d){if(!_0xd4722d)throw new InternalError();return _0xd4722d[_0x1bae('0x24')]();})[_0x1bae('0x25')](function(){_0x49f63d['status'](0xcc)['end']();})['catch'](handleError(_0x49f63d,null));};function getBucketslist(_0x89320e,_0x1afeab,_0x362f39){return new Promise(function(_0x41924a,_0x2842fc){var _0x2244a1=new AWS['S3']({'accessKeyId':_0x1afeab,'secretAccessKey':_0x89320e,'region':_0x362f39});_0x2244a1[_0x1bae('0x68')]({},function(_0x2149e0,_0x401787){if(_0x2149e0){return _0x2842fc(_0x2149e0);}else{return _0x41924a(_0x401787);}});});}function createBucket(_0x566a98,_0x413e49,_0xcf0a45,_0x1241ff){return new Promise(function(_0x2c042f,_0x3f8b2f){var _0x1baf3d=new AWS['S3']({'accessKeyId':_0x413e49,'secretAccessKey':_0x566a98,'region':_0xcf0a45});_0x1baf3d[_0x1bae('0x69')]({'Bucket':_0x1241ff},function(_0x7e11ba,_0x4b771b){if(_0x7e11ba){return _0x3f8b2f(_0x7e11ba);}else{return _0x2c042f(_0x4b771b);}});});}function uploadFile(_0x212b43,_0x17d397,_0xdf21a9,_0x578f18,_0x499158,_0xb3dde4){return new Promise(function(_0x10053f,_0x248493){var _0x49d251=new AWS['S3']({'accessKeyId':_0x17d397,'secretAccessKey':_0x212b43,'region':_0xdf21a9});_0x49d251[_0x1bae('0x6a')]({'Bucket':_0x578f18,'Key':_0x499158,'Body':_0xb3dde4},function(_0x3e9d01,_0xb927d4){if(_0x3e9d01){return _0x248493(_0x3e9d01);}else{return _0x10053f(_0xb927d4);}});});}function startTranscribe(_0x38c3c6,_0x1733ce,_0x22ac17,_0x499501,_0x1ae877,_0x5c97c1){return new Promise(function(_0x340b13,_0x5d4f53){var _0x150c9a=new AWS[(_0x1bae('0x6b'))]({'accessKeyId':_0x1733ce,'secretAccessKey':_0x38c3c6,'region':_0x22ac17});_0x150c9a[_0x1bae('0x6c')]({'TranscriptionJobName':_0x499501,'LanguageCode':_0x1ae877,'Media':{'MediaFileUri':_0x5c97c1}},function(_0x1840f9,_0x2e3209){if(_0x1840f9){return _0x5d4f53(_0x1840f9);}else{return _0x340b13(_0x2e3209);}});});}function transcribe(_0x5dbc80,_0x57c2cc,_0x437452,_0x243ce8,_0x2e4902,_0x472935,_0x184bea){return new Promise(function(_0x36766e,_0x3eafae){var _0x2ceba5={};logger[_0x1bae('0x62')](util[_0x1bae('0x4e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5dbc80,_0x2e4902));return uploadFile(_0x57c2cc,_0x437452,_0x243ce8,_0x2e4902,path['basename'](_0x472935),fs['readFileSync'](_0x472935))[_0x1bae('0x25')](function(_0xf7fdfa){logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x6d'),_0x5dbc80,_0x2e4902,_0xf7fdfa[_0x1bae('0x6e')]));_0x2ceba5[_0x1bae('0x6f')]=_0xf7fdfa[_0x1bae('0x70')];_0x2ceba5[_0x1bae('0x71')]=_0xf7fdfa[_0x1bae('0x6e')];logger['info'](util['format'](_0x1bae('0x72'),_0x5dbc80));return startTranscribe(_0x57c2cc,_0x437452,_0x243ce8,uuidv4(),_0x184bea,_0xf7fdfa[_0x1bae('0x6e')]);})[_0x1bae('0x25')](function(_0x4fd1ab){logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x73'),_0x5dbc80,_0x4fd1ab[_0x1bae('0x74')][_0x1bae('0x75')]));_0x2ceba5[_0x1bae('0x76')]=_0x4fd1ab['TranscriptionJob'][_0x1bae('0x75')];_0x2ceba5['transcribeStatus']=_0x4fd1ab[_0x1bae('0x74')]['TranscriptionJobStatus'];return _0x36766e(_0x2ceba5);})['catch'](function(_0xb88683){return _0x3eafae(_0xb88683);});});}exports[_0x1bae('0x77')]=function(_0x5c1ce3,_0x1a86d8,_0x1529dc){var _0x1e9b47;var _0x20b4ec;var _0x509a5;var _0x5ae008=require(_0x1bae('0x4b'));return db[_0x1bae('0x2a')]['findOne']({'where':{'id':_0x5c1ce3['params']['id']}})['then'](function(_0x74db75){if(_0x74db75){var _0x26aeec=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x74db75[_0x1bae('0x4d')]);if(fs[_0x1bae('0x50')](_0x26aeec)){cypher=!![];return _0x5ae008[_0x1bae('0x5e')](_0x26aeec,_0x74db75['value'],config[_0x1bae('0x51')]['recording'])['then'](function(){return _0x74db75;});}return _0x74db75;}})['then'](function(_0x46c240){if(!_0x46c240){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))]('Voice\x20Recording\x20not\x20found');}_0x20b4ec=_0x46c240;return db['Setting'][_0x1bae('0x78')]({'where':{'id':0x1}});})[_0x1bae('0x25')](handleEntityNotFound(_0x1a86d8,null))['then'](function(_0x5cba8a){if(_0x5cba8a){_0x1e9b47=_0x5cba8a;if(!_0x1e9b47[_0x1bae('0x79')]||!_0x1e9b47[_0x1bae('0x7a')]||!_0x1e9b47['transcribeRegion']||!_0x1e9b47['language']||!_0x1e9b47[_0x1bae('0x6f')]){throw new db['Sequelize'][(_0x1bae('0x5f'))](_0x1bae('0x7b'));}if(_0x5c1ce3[_0x1bae('0x46')][_0x1bae('0x7c')]&&(!_0x1e9b47['sentiment']||!_0x1e9b47[_0x1bae('0x7d')]||!_0x1e9b47[_0x1bae('0x7e')]||!_0x1e9b47['language']||!_0x1e9b47[_0x1bae('0x6f')])){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x7f'));}return db['CloudProvider'][_0x1bae('0x78')]({'where':{'id':_0x1e9b47[_0x1bae('0x7a')]}});}})[_0x1bae('0x25')](function(_0x5f4a03){if(!_0x5f4a03){throw new db['Sequelize'][(_0x1bae('0x5f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5f4a03[_0x1bae('0x80')]||!_0x5f4a03['data2']){throw new db['Sequelize'][(_0x1bae('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x509a5=_0x5f4a03;return getBucketslist(_0x509a5[_0x1bae('0x80')],_0x509a5[_0x1bae('0x81')],_0x1e9b47[_0x1bae('0x82')]);})[_0x1bae('0x25')](function(_0xad7810){if(_0xad7810&&_0xad7810['Buckets']){var _0x4512d4=_[_0x1bae('0x47')](_0xad7810[_0x1bae('0x83')],function(_0x47a1e9){return _0x47a1e9[_0x1bae('0x84')]===_0x1e9b47[_0x1bae('0x6f')];});if(!_0x4512d4){logger[_0x1bae('0x62')](util['format'](_0x1bae('0x85'),_0x5c1ce3[_0x1bae('0x48')]['id'],_0x1e9b47['bucket']));return createBucket(_0x509a5[_0x1bae('0x80')],_0x509a5['data2'],_0x1e9b47['transcribeRegion'],_0x1e9b47[_0x1bae('0x6f')]);}logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x86'),_0x5c1ce3[_0x1bae('0x48')]['id'],_0x1e9b47[_0x1bae('0x6f')]));return;}})[_0x1bae('0x25')](function(_0x459f13){if(_0x20b4ec[_0x1bae('0x87')]===_0x1bae('0x88')){return transcribe(_0x5c1ce3[_0x1bae('0x48')]['id'],_0x509a5[_0x1bae('0x80')],_0x509a5['data2'],_0x1e9b47[_0x1bae('0x82')],_0x1e9b47[_0x1bae('0x6f')],_0x20b4ec[_0x1bae('0x4d')],_0x1e9b47[_0x1bae('0x89')]);}else{logger[_0x1bae('0x62')](util[_0x1bae('0x4e')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5c1ce3['params']['id']));return{'transcribeStatus':_0x1bae('0x8a')};}})['then'](function(_0x1705cd){if(_0x1705cd){_0x1705cd[_0x1bae('0x8b')]=_0x5c1ce3['body'][_0x1bae('0x7c')];return _0x20b4ec['updateAttributes'](_0x1705cd);}})[_0x1bae('0x25')](respondWithResult(_0x1a86d8,null))[_0x1bae('0x44')](handleError(_0x1a86d8,null));};function writeFile(_0x5b433d,_0x2fd567){return new Promise(function(_0x5ba630,_0x359e67){fs[_0x1bae('0x8c')](_0x2fd567,_0x5b433d,function(_0x53bf23,_0x9fcf2d){if(_0x53bf23){return _0x359e67(_0x53bf23);}else{return _0x5ba630(_0x9fcf2d);}});});}exports['downloadTranscribe']=function(_0x3b5803,_0x3a893a,_0x33964e){return db[_0x1bae('0x2a')][_0x1bae('0x78')]({'where':{'id':_0x3b5803[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](handleEntityNotFound(_0x3a893a))[_0x1bae('0x25')](function(_0x200ca4){if(_0x200ca4&&_0x200ca4['fileText']){var _0x1f7f9=_0x200ca4['fileText'];var _0x4b6a1b=config[_0x1bae('0x8d')]+'/server/files/transcribes/transcribe_'+_0x200ca4['id']+_0x1bae('0x8e');if(fs[_0x1bae('0x50')](_0x4b6a1b)){return _0x4b6a1b;}return writeFile(_0x1f7f9,_0x4b6a1b)[_0x1bae('0x25')](function(){return _0x4b6a1b;});}else{throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x8f'));}})[_0x1bae('0x25')](function(_0x10c210){return _0x3a893a[_0x1bae('0x4a')](_0x10c210);})[_0x1bae('0x44')](handleError(_0x3a893a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0482e85..b3ad9c9 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 _0x9585=['uniqueid','transcribeStatus','exports','define','VoiceRecording','voice_recordings'];(function(_0x46d6aa,_0x5fe46c){var _0x1ce8e6=function(_0x16ae58){while(--_0x16ae58){_0x46d6aa['push'](_0x46d6aa['shift']());}};_0x1ce8e6(++_0x5fe46c);}(_0x9585,0x15e));var _0x5958=function(_0x4ad6c2,_0x4e1364){_0x4ad6c2=_0x4ad6c2-0x0;var _0x58036a=_0x9585[_0x4ad6c2];return _0x58036a;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x5958('0x0')]=function(_0x57d84d,_0x35702f){return _0x57d84d[_0x5958('0x1')](_0x5958('0x2'),attributes,{'tableName':_0x5958('0x3'),'paranoid':![],'indexes':[{'name':_0x5958('0x4'),'fields':[_0x5958('0x4')]},{'name':_0x5958('0x5'),'fields':[_0x5958('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b37=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x181707,_0x47d753){var _0x1d2b7a=function(_0x508991){while(--_0x508991){_0x181707['push'](_0x181707['shift']());}};_0x1d2b7a(++_0x47d753);}(_0x2b37,0x12b));var _0x72b3=function(_0x34acae,_0x1472d8){_0x34acae=_0x34acae-0x0;var _0x2d475f=_0x2b37[_0x34acae];return _0x2d475f;};'use strict';var attributes=require(_0x72b3('0x0'));module[_0x72b3('0x1')]=function(_0x3fbc04,_0x22f924){return _0x3fbc04[_0x72b3('0x2')](_0x72b3('0x3'),attributes,{'tableName':_0x72b3('0x4'),'paranoid':![],'indexes':[{'name':_0x72b3('0x5'),'fields':[_0x72b3('0x5')]},{'name':_0x72b3('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0f3e511..e90f236 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 _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x3690db,_0x4febac){var _0x3562a8=function(_0x2a1ff7){while(--_0x2a1ff7){_0x3690db['push'](_0x3690db['shift']());}};_0x3562a8(++_0x4febac);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1b12b8,_0x51b75c){_0x1b12b8=_0x1b12b8-0x0;var _0x2907a7=_0x8f4c[_0x1b12b8];return _0x2907a7;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file +var _0x7096=['raw','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','create','existsSync','format','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options'];(function(_0x446026,_0x22647e){var _0x1b4681=function(_0x37503b){while(--_0x37503b){_0x446026['push'](_0x446026['shift']());}};_0x1b4681(++_0x22647e);}(_0x7096,0x10c));var _0x6709=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7096[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['update'](_0x235a54[_0x6709('0x18')],{'raw':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235a54['options']?_0x235a54[_0x6709('0x19')][_0x6709('0x1b')]||null:null,'attributes':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1c')]||null:null,'limit':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1d')]||null:null})[_0x6709('0xb')](function(_0x1c5153){logger[_0x6709('0xc')](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x1c5153));_0x9c1fd8(_0x1c5153);})[_0x6709('0x15')](function(_0x5c7982){logger[_0x6709('0x11')](_0x6709('0x16'),_0x5c7982[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e[_0x6709('0x11')](0x1f4,_0x5c7982['message']));});});};exports[_0x6709('0x1e')]=function(_0x3076fe){var _0x50f7d6=this;return new Promise(function(_0x585073,_0x39f6a9){var _0x5dbb87=require(_0x6709('0x1f'));var _0x2499a2;return db['Setting'][_0x6709('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6709('0xb')](function(_0x3cd555){_0x2499a2=_0x3cd555;return db['VoiceRecording'][_0x6709('0x21')](_0x3076fe['body']);})[_0x6709('0xb')](function(_0x388aee){if(_0x2499a2['callRecordingEncryption']&&fs[_0x6709('0x22')](_0x388aee['value'])){var _0x138318=util[_0x6709('0x23')]('%s.cypher',_0x388aee['value']);return _0x5dbb87[_0x6709('0x24')](_0x388aee[_0x6709('0x25')],_0x138318,config[_0x6709('0x26')][_0x6709('0x27')])[_0x6709('0xb')](function(){fs[_0x6709('0x28')](_0x388aee[_0x6709('0x25')]);logger[_0x6709('0xc')](_0x6709('0x29'));return _0x388aee;});}return _0x388aee;})['then'](function(_0x3d9501){logger[_0x6709('0xc')](_0x6709('0x1e'),_0x3076fe);logger[_0x6709('0xf')]('CreateVoiceRecording',_0x3076fe,JSON[_0x6709('0x10')](_0x3d9501));_0x585073(_0x3d9501);})[_0x6709('0x15')](function(_0x124e01){logger[_0x6709('0x11')]('CreateVoiceRecording',_0x124e01[_0x6709('0x13')],_0x3076fe);_0x39f6a9(_0x50f7d6[_0x6709('0x11')](0x1f4,_0x124e01['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6bb34d4..dfd7af2 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 _0xa64a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x111085,_0x572fa5){var _0x17738e=function(_0x3ab98b){while(--_0x3ab98b){_0x111085['push'](_0x111085['shift']());}};_0x17738e(++_0x572fa5);}(_0xa64a,0xaf));var _0xaa64=function(_0x2fd624,_0x38745d){_0x2fd624=_0x2fd624-0x0;var _0x56d3d8=_0xa64a[_0x2fd624];return _0x56d3d8;};'use strict';var multer=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var path=require(_0xaa64('0x2'));var timeout=require(_0xaa64('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaa64('0x4'));var auth=require(_0xaa64('0x5'));var interaction=require(_0xaa64('0x6'));var config=require(_0xaa64('0x7'));var controller=require(_0xaa64('0x8'));router['get']('/',auth[_0xaa64('0x9')](),controller['index']);router['get']('/describe',auth[_0xaa64('0x9')](),controller[_0xaa64('0xa')]);router[_0xaa64('0xb')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0xd')]);router['post']('/',auth[_0xaa64('0x9')](),controller[_0xaa64('0xe')]);router[_0xaa64('0xf')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0x10')]);router[_0xaa64('0x11')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0x12')]);module[_0xaa64('0x13')]=router; \ No newline at end of file +var _0x723f=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x8d739d,_0x3504c4){var _0x39dc07=function(_0x48bb29){while(--_0x48bb29){_0x8d739d['push'](_0x8d739d['shift']());}};_0x39dc07(++_0x3504c4);}(_0x723f,0x1d4));var _0xf723=function(_0x34cfdb,_0x34594b){_0x34cfdb=_0x34cfdb-0x0;var _0x17fa18=_0x723f[_0x34cfdb];return _0x17fa18;};'use strict';var multer=require(_0xf723('0x0'));var util=require(_0xf723('0x1'));var path=require(_0xf723('0x2'));var timeout=require(_0xf723('0x3'));var express=require(_0xf723('0x4'));var router=express['Router']();var fs_extra=require(_0xf723('0x5'));var auth=require(_0xf723('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf723('0x7'));var controller=require(_0xf723('0x8'));router[_0xf723('0x9')]('/',auth[_0xf723('0xa')](),controller['index']);router[_0xf723('0x9')](_0xf723('0xb'),auth['isAuthenticated'](),controller[_0xf723('0xc')]);router[_0xf723('0x9')](_0xf723('0xd'),auth[_0xf723('0xa')](),controller[_0xf723('0xe')]);router[_0xf723('0xf')]('/',auth[_0xf723('0xa')](),controller[_0xf723('0x10')]);router[_0xf723('0x11')](_0xf723('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf723('0xa')](),controller[_0xf723('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f84019a..c9cc72a 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 _0x6a74=['moment','exports','attended','STRING','ENUM','sequelize'];(function(_0x1b3f9f,_0x43af39){var _0x44e078=function(_0x327c8c){while(--_0x327c8c){_0x1b3f9f['push'](_0x1b3f9f['shift']());}};_0x44e078(++_0x43af39);}(_0x6a74,0xd1));var _0x46a7=function(_0x62b09a,_0x3e0e70){_0x62b09a=_0x62b09a-0x0;var _0x442042=_0x6a74[_0x62b09a];return _0x442042;};'use strict';var Sequelize=require(_0x46a7('0x0'));var moment=require(_0x46a7('0x1'));module[_0x46a7('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0x46a7('0x3'))},'result':{'type':Sequelize[_0x46a7('0x4')]},'transfererchannel':{'type':Sequelize[_0x46a7('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x46a7('0x4')]},'transferercalleridname':{'type':Sequelize[_0x46a7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x46a7('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x46a7('0x4')]},'transferercontext':{'type':Sequelize[_0x46a7('0x4')]},'transfererexten':{'type':Sequelize[_0x46a7('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x46a7('0x4')]},'transfereechannel':{'type':Sequelize[_0x46a7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x46a7('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x46a7('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x46a7('0x4')]},'transfereeexten':{'type':Sequelize[_0x46a7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x46a7('0x4')]},'isexternal':{'type':Sequelize[_0x46a7('0x5')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88cb=['sequelize','moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x26738b,_0x54f231){var _0x2851c8=function(_0x5b6768){while(--_0x5b6768){_0x26738b['push'](_0x26738b['shift']());}};_0x2851c8(++_0x54f231);}(_0x88cb,0x1a8));var _0xb88c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x88cb[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb88c('0x0'));var moment=require(_0xb88c('0x1'));module[_0xb88c('0x2')]={'type':{'type':Sequelize['ENUM'](_0xb88c('0x3'),_0xb88c('0x4'))},'result':{'type':Sequelize[_0xb88c('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xb88c('0x5')]},'transferercalleridname':{'type':Sequelize[_0xb88c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb88c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb88c('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xb88c('0x5')]},'transfererexten':{'type':Sequelize[_0xb88c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb88c('0x5')]},'transfereechannel':{'type':Sequelize[_0xb88c('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb88c('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xb88c('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb88c('0x5')]},'transfereecontext':{'type':Sequelize[_0xb88c('0x5')]},'transfereeexten':{'type':Sequelize[_0xb88c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb88c('0x5')]},'isexternal':{'type':Sequelize[_0xb88c('0x6')](_0xb88c('0x7'),'No')},'context':{'type':Sequelize[_0xb88c('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0a791dd..8c7bc5f 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 _0xb0a0=['findAll','rows','catch','show','params','keys','merge','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','VoiceTransferReport','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll'];(function(_0x5a7f59,_0x2e191a){var _0x2a0c89=function(_0x94427d){while(--_0x94427d){_0x5a7f59['push'](_0x5a7f59['shift']());}};_0x2a0c89(++_0x2e191a);}(_0xb0a0,0xa5));var _0x0b0a=function(_0x3f92bc,_0x482ad4){_0x3f92bc=_0x3f92bc-0x0;var _0xa15d20=_0xb0a0[_0x3f92bc];return _0xa15d20;};'use strict';var emlformat=require(_0x0b0a('0x0'));var rimraf=require(_0x0b0a('0x1'));var zipdir=require(_0x0b0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b0a('0x3'));var moment=require(_0x0b0a('0x4'));var BPromise=require(_0x0b0a('0x5'));var Mustache=require('mustache');var util=require(_0x0b0a('0x6'));var path=require(_0x0b0a('0x7'));var sox=require(_0x0b0a('0x8'));var csv=require(_0x0b0a('0x9'));var ejs=require(_0x0b0a('0xa'));var fs=require('fs');var fs_extra=require(_0x0b0a('0xb'));var _=require(_0x0b0a('0xc'));var squel=require(_0x0b0a('0xd'));var crypto=require(_0x0b0a('0xe'));var jsforce=require(_0x0b0a('0xf'));var deskjs=require(_0x0b0a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0b0a('0x11'));var Papa=require(_0x0b0a('0x12'));var Redis=require(_0x0b0a('0x13'));var authService=require(_0x0b0a('0x14'));var qs=require(_0x0b0a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0a('0x16'));var logger=require(_0x0b0a('0x17'))(_0x0b0a('0x18'));var utils=require(_0x0b0a('0x19'));var config=require(_0x0b0a('0x1a'));var licenseUtil=require(_0x0b0a('0x1b'));var db=require(_0x0b0a('0x1c'))['db'];function respondWithStatusCode(_0x198def,_0x245cd7){_0x245cd7=_0x245cd7||0xcc;return function(_0x10a5ef){if(_0x10a5ef){return _0x198def['sendStatus'](_0x245cd7);}return _0x198def[_0x0b0a('0x1d')](_0x245cd7)[_0x0b0a('0x1e')]();};}function respondWithResult(_0x1dc816,_0x311a96){_0x311a96=_0x311a96||0xc8;return function(_0x228e90){if(_0x228e90){return _0x1dc816[_0x0b0a('0x1d')](_0x311a96)[_0x0b0a('0x1f')](_0x228e90);}};}function respondWithFilteredResult(_0x4958a1,_0x28d072){return function(_0xce2089){if(_0xce2089){var _0x362263=typeof _0x28d072[_0x0b0a('0x20')]===_0x0b0a('0x21')&&typeof _0x28d072[_0x0b0a('0x22')]==='undefined';var _0x2a3b45=_0xce2089[_0x0b0a('0x23')];var _0x595de8=_0x362263?0x0:_0x28d072[_0x0b0a('0x20')];var _0x3ad39c=_0x362263?_0xce2089['count']:_0x28d072[_0x0b0a('0x20')]+_0x28d072['limit'];var _0x560475;if(_0x3ad39c>=_0x2a3b45){_0x3ad39c=_0x2a3b45;_0x560475=0xc8;}else{_0x560475=0xce;}_0x4958a1['status'](_0x560475);return _0x4958a1[_0x0b0a('0x24')](_0x0b0a('0x25'),_0x595de8+'-'+_0x3ad39c+'/'+_0x2a3b45)[_0x0b0a('0x1f')](_0xce2089);}return null;};}function patchUpdates(_0x197d4f){return function(_0x9dafb5){try{jsonpatch['apply'](_0x9dafb5,_0x197d4f,!![]);}catch(_0x152db5){return BPromise[_0x0b0a('0x26')](_0x152db5);}return _0x9dafb5['save']();};}function saveUpdates(_0x1c9fd5,_0x5b1d76){return function(_0xe515d4){if(_0xe515d4){return _0xe515d4[_0x0b0a('0x27')](_0x1c9fd5)[_0x0b0a('0x28')](function(_0xb21636){return _0xb21636;});}return null;};}function removeEntity(_0xc25bd0,_0x522e5a){return function(_0x5cda5e){if(_0x5cda5e){return _0x5cda5e[_0x0b0a('0x29')]()[_0x0b0a('0x28')](function(){_0xc25bd0[_0x0b0a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42eb22,_0x3efac2){return function(_0x260e6d){if(!_0x260e6d){_0x42eb22['sendStatus'](0x194);}return _0x260e6d;};}function handleError(_0x4b7290,_0x44c540){_0x44c540=_0x44c540||0x1f4;return function(_0x203f7e){logger[_0x0b0a('0x2a')](_0x203f7e['stack']);if(_0x203f7e[_0x0b0a('0x2b')]){delete _0x203f7e['name'];}_0x4b7290[_0x0b0a('0x1d')](_0x44c540)[_0x0b0a('0x2c')](_0x203f7e);};}exports[_0x0b0a('0x2d')]=function(_0x8479a0,_0x4970b2){var _0xfcfb11={},_0x1c621a={},_0x5aba51={'count':0x0,'rows':[]};var _0x3cb0d4=_['map'](db[_0x0b0a('0x2e')][_0x0b0a('0x2f')],function(_0x1c557a){return{'name':_0x1c557a['fieldName'],'type':_0x1c557a[_0x0b0a('0x30')][_0x0b0a('0x31')]};});_0x1c621a['model']=_[_0x0b0a('0x32')](_0x3cb0d4,_0x0b0a('0x2b'));_0x1c621a[_0x0b0a('0x33')]=_['keys'](_0x8479a0[_0x0b0a('0x33')]);_0x1c621a[_0x0b0a('0x34')]=_['intersection'](_0x1c621a[_0x0b0a('0x35')],_0x1c621a[_0x0b0a('0x33')]);_0xfcfb11[_0x0b0a('0x36')]=_[_0x0b0a('0x37')](_0x1c621a[_0x0b0a('0x35')],qs[_0x0b0a('0x38')](_0x8479a0[_0x0b0a('0x33')]['fields']));_0xfcfb11['attributes']=_0xfcfb11['attributes'][_0x0b0a('0x39')]?_0xfcfb11[_0x0b0a('0x36')]:_0x1c621a[_0x0b0a('0x35')];if(!_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3a')]('nolimit')){_0xfcfb11[_0x0b0a('0x22')]=qs[_0x0b0a('0x22')](_0x8479a0[_0x0b0a('0x33')]['limit']);_0xfcfb11[_0x0b0a('0x20')]=qs['offset'](_0x8479a0['query'][_0x0b0a('0x20')]);}_0xfcfb11[_0x0b0a('0x3b')]=qs['sort'](_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3c')]);_0xfcfb11[_0x0b0a('0x3d')]=qs[_0x0b0a('0x34')](_[_0x0b0a('0x3e')](_0x8479a0[_0x0b0a('0x33')],_0x1c621a[_0x0b0a('0x34')]),_0x3cb0d4);if(_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3f')]){_0xfcfb11[_0x0b0a('0x3d')]=_['merge'](_0xfcfb11[_0x0b0a('0x3d')],{'$or':_['map'](_0x3cb0d4,function(_0x47e53b){if(_0x47e53b[_0x0b0a('0x30')]!=='VIRTUAL'){var _0x3543ff={};_0x3543ff[_0x47e53b[_0x0b0a('0x2b')]]={'$like':'%'+_0x8479a0[_0x0b0a('0x33')]['filter']+'%'};return _0x3543ff;}})});}_0xfcfb11=_['merge']({},_0xfcfb11,_0x8479a0[_0x0b0a('0x40')]);var _0x33d332={'where':_0xfcfb11[_0x0b0a('0x3d')]};return db[_0x0b0a('0x2e')][_0x0b0a('0x23')](_0x33d332)[_0x0b0a('0x28')](function(_0x569c0c){_0x5aba51[_0x0b0a('0x23')]=_0x569c0c;if(_0x8479a0['query'][_0x0b0a('0x41')]){_0xfcfb11['include']=[{'all':!![]}];}return db[_0x0b0a('0x2e')][_0x0b0a('0x42')](_0xfcfb11);})[_0x0b0a('0x28')](function(_0x19d2df){_0x5aba51[_0x0b0a('0x43')]=_0x19d2df;return _0x5aba51;})[_0x0b0a('0x28')](respondWithFilteredResult(_0x4970b2,_0xfcfb11))[_0x0b0a('0x44')](handleError(_0x4970b2,null));};exports[_0x0b0a('0x45')]=function(_0x312360,_0x30a6a7){var _0x4da014={'raw':!![],'where':{'id':_0x312360[_0x0b0a('0x46')]['id']}},_0x36acf0={};_0x36acf0[_0x0b0a('0x35')]=_[_0x0b0a('0x47')](db['VoiceTransferReport'][_0x0b0a('0x2f')]);_0x36acf0[_0x0b0a('0x33')]=_['keys'](_0x312360[_0x0b0a('0x33')]);_0x36acf0[_0x0b0a('0x34')]=_[_0x0b0a('0x37')](_0x36acf0['model'],_0x36acf0[_0x0b0a('0x33')]);_0x4da014[_0x0b0a('0x36')]=_[_0x0b0a('0x37')](_0x36acf0[_0x0b0a('0x35')],qs[_0x0b0a('0x38')](_0x312360[_0x0b0a('0x33')][_0x0b0a('0x38')]));_0x4da014['attributes']=_0x4da014[_0x0b0a('0x36')][_0x0b0a('0x39')]?_0x4da014['attributes']:_0x36acf0[_0x0b0a('0x35')];if(_0x312360[_0x0b0a('0x33')][_0x0b0a('0x41')]){_0x4da014['include']=[{'all':!![]}];}_0x4da014=_[_0x0b0a('0x48')]({},_0x4da014,_0x312360['options']);return db[_0x0b0a('0x2e')][_0x0b0a('0x49')](_0x4da014)['then'](handleEntityNotFound(_0x30a6a7,null))[_0x0b0a('0x28')](respondWithResult(_0x30a6a7,null))['catch'](handleError(_0x30a6a7,null));};exports[_0x0b0a('0x4a')]=function(_0x41778a,_0x465c88){return db[_0x0b0a('0x2e')]['create'](_0x41778a[_0x0b0a('0x4b')],{})['then'](respondWithResult(_0x465c88,0xc9))['catch'](handleError(_0x465c88,null));};exports['update']=function(_0x363ef5,_0x5d769e){if(_0x363ef5['body']['id']){delete _0x363ef5[_0x0b0a('0x4b')]['id'];}return db[_0x0b0a('0x2e')][_0x0b0a('0x49')]({'where':{'id':_0x363ef5[_0x0b0a('0x46')]['id']}})[_0x0b0a('0x28')](handleEntityNotFound(_0x5d769e,null))[_0x0b0a('0x28')](saveUpdates(_0x363ef5['body'],null))[_0x0b0a('0x28')](respondWithResult(_0x5d769e,null))['catch'](handleError(_0x5d769e,null));};exports[_0x0b0a('0x29')]=function(_0x44c879,_0x4fc48a){return db[_0x0b0a('0x2e')]['find']({'where':{'id':_0x44c879[_0x0b0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fc48a,null))['then'](removeEntity(_0x4fc48a,null))[_0x0b0a('0x44')](handleError(_0x4fc48a,null));};exports[_0x0b0a('0x4c')]=function(_0x91968c,_0x1da7b5){return db[_0x0b0a('0x2e')][_0x0b0a('0x4c')]()[_0x0b0a('0x28')](respondWithResult(_0x1da7b5,null))['catch'](handleError(_0x1da7b5,null));}; \ No newline at end of file +var _0x073b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x27fcdf,_0x46d60e){var _0x1d9175=function(_0x290931){while(--_0x290931){_0x27fcdf['push'](_0x27fcdf['shift']());}};_0x1d9175(++_0x46d60e);}(_0x073b,0x16b));var _0xb073=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x073b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xb073('0x0'));var rimraf=require(_0xb073('0x1'));var zipdir=require(_0xb073('0x2'));var jsonpatch=require(_0xb073('0x3'));var rp=require(_0xb073('0x4'));var moment=require(_0xb073('0x5'));var BPromise=require(_0xb073('0x6'));var Mustache=require('mustache');var util=require(_0xb073('0x7'));var path=require(_0xb073('0x8'));var sox=require(_0xb073('0x9'));var csv=require('to-csv');var ejs=require(_0xb073('0xa'));var fs=require('fs');var fs_extra=require(_0xb073('0xb'));var _=require(_0xb073('0xc'));var squel=require('squel');var crypto=require(_0xb073('0xd'));var jsforce=require(_0xb073('0xe'));var deskjs=require(_0xb073('0xf'));var toCsv=require(_0xb073('0x10'));var querystring=require(_0xb073('0x11'));var Papa=require(_0xb073('0x12'));var Redis=require(_0xb073('0x13'));var authService=require(_0xb073('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb073('0x15'));var hardwareService=require(_0xb073('0x16'));var logger=require(_0xb073('0x17'))(_0xb073('0x18'));var utils=require(_0xb073('0x19'));var config=require(_0xb073('0x1a'));var licenseUtil=require(_0xb073('0x1b'));var db=require(_0xb073('0x1c'))['db'];function respondWithStatusCode(_0x281249,_0x107533){_0x107533=_0x107533||0xcc;return function(_0x54ad85){if(_0x54ad85){return _0x281249[_0xb073('0x1d')](_0x107533);}return _0x281249[_0xb073('0x1e')](_0x107533)['end']();};}function respondWithResult(_0x5728f5,_0x520716){_0x520716=_0x520716||0xc8;return function(_0x44d2a2){if(_0x44d2a2){return _0x5728f5[_0xb073('0x1e')](_0x520716)[_0xb073('0x1f')](_0x44d2a2);}};}function respondWithFilteredResult(_0x3eae60,_0x2d56c0){return function(_0x3c5fd8){if(_0x3c5fd8){var _0x28a152=typeof _0x2d56c0[_0xb073('0x20')]===_0xb073('0x21')&&typeof _0x2d56c0[_0xb073('0x22')]==='undefined';var _0x2f3ba3=_0x3c5fd8[_0xb073('0x23')];var _0x5b2da0=_0x28a152?0x0:_0x2d56c0[_0xb073('0x20')];var _0x23cc6e=_0x28a152?_0x3c5fd8['count']:_0x2d56c0[_0xb073('0x20')]+_0x2d56c0[_0xb073('0x22')];var _0x56858a;if(_0x23cc6e>=_0x2f3ba3){_0x23cc6e=_0x2f3ba3;_0x56858a=0xc8;}else{_0x56858a=0xce;}_0x3eae60[_0xb073('0x1e')](_0x56858a);return _0x3eae60[_0xb073('0x24')](_0xb073('0x25'),_0x5b2da0+'-'+_0x23cc6e+'/'+_0x2f3ba3)[_0xb073('0x1f')](_0x3c5fd8);}return null;};}function patchUpdates(_0x28e3b3){return function(_0x26749e){try{jsonpatch['apply'](_0x26749e,_0x28e3b3,!![]);}catch(_0x1a52f2){return BPromise[_0xb073('0x26')](_0x1a52f2);}return _0x26749e['save']();};}function saveUpdates(_0x581fc1,_0x4d3a2f){return function(_0x17fc62){if(_0x17fc62){return _0x17fc62['update'](_0x581fc1)[_0xb073('0x27')](function(_0x48803a){return _0x48803a;});}return null;};}function removeEntity(_0x4cd30d,_0x312245){return function(_0x4b66f1){if(_0x4b66f1){return _0x4b66f1[_0xb073('0x28')]()['then'](function(){_0x4cd30d[_0xb073('0x1e')](0xcc)[_0xb073('0x29')]();});}};}function handleEntityNotFound(_0x567700,_0x329270){return function(_0xee3863){if(!_0xee3863){_0x567700[_0xb073('0x1d')](0x194);}return _0xee3863;};}function handleError(_0x1c43d5,_0x2f1fe0){_0x2f1fe0=_0x2f1fe0||0x1f4;return function(_0x27976e){logger['error'](_0x27976e[_0xb073('0x2a')]);if(_0x27976e[_0xb073('0x2b')]){delete _0x27976e[_0xb073('0x2b')];}_0x1c43d5[_0xb073('0x1e')](_0x2f1fe0)['send'](_0x27976e);};}exports['index']=function(_0x5139f2,_0x47eaaa){var _0x28f8c5={},_0x424fa9={},_0x3eec63={'count':0x0,'rows':[]};var _0x38d694=_[_0xb073('0x2c')](db['VoiceTransferReport'][_0xb073('0x2d')],function(_0x3e0b0a){return{'name':_0x3e0b0a[_0xb073('0x2e')],'type':_0x3e0b0a[_0xb073('0x2f')][_0xb073('0x30')]};});_0x424fa9[_0xb073('0x31')]=_[_0xb073('0x2c')](_0x38d694,_0xb073('0x2b'));_0x424fa9[_0xb073('0x32')]=_[_0xb073('0x33')](_0x5139f2[_0xb073('0x32')]);_0x424fa9['filters']=_['intersection'](_0x424fa9['model'],_0x424fa9[_0xb073('0x32')]);_0x28f8c5[_0xb073('0x34')]=_[_0xb073('0x35')](_0x424fa9[_0xb073('0x31')],qs[_0xb073('0x36')](_0x5139f2[_0xb073('0x32')][_0xb073('0x36')]));_0x28f8c5['attributes']=_0x28f8c5[_0xb073('0x34')]['length']?_0x28f8c5['attributes']:_0x424fa9[_0xb073('0x31')];if(!_0x5139f2[_0xb073('0x32')][_0xb073('0x37')](_0xb073('0x38'))){_0x28f8c5[_0xb073('0x22')]=qs[_0xb073('0x22')](_0x5139f2[_0xb073('0x32')][_0xb073('0x22')]);_0x28f8c5[_0xb073('0x20')]=qs['offset'](_0x5139f2['query']['offset']);}_0x28f8c5['order']=qs[_0xb073('0x39')](_0x5139f2['query'][_0xb073('0x39')]);_0x28f8c5[_0xb073('0x3a')]=qs[_0xb073('0x3b')](_[_0xb073('0x3c')](_0x5139f2['query'],_0x424fa9['filters']),_0x38d694);if(_0x5139f2[_0xb073('0x32')]['filter']){_0x28f8c5[_0xb073('0x3a')]=_[_0xb073('0x3d')](_0x28f8c5[_0xb073('0x3a')],{'$or':_['map'](_0x38d694,function(_0x2911c8){if(_0x2911c8[_0xb073('0x2f')]!=='VIRTUAL'){var _0x1483ce={};_0x1483ce[_0x2911c8[_0xb073('0x2b')]]={'$like':'%'+_0x5139f2['query'][_0xb073('0x3e')]+'%'};return _0x1483ce;}})});}_0x28f8c5=_[_0xb073('0x3d')]({},_0x28f8c5,_0x5139f2[_0xb073('0x3f')]);var _0x2dc2de={'where':_0x28f8c5[_0xb073('0x3a')]};return db[_0xb073('0x40')][_0xb073('0x23')](_0x2dc2de)['then'](function(_0x45f265){_0x3eec63[_0xb073('0x23')]=_0x45f265;if(_0x5139f2[_0xb073('0x32')][_0xb073('0x41')]){_0x28f8c5[_0xb073('0x42')]=[{'all':!![]}];}return db[_0xb073('0x40')][_0xb073('0x43')](_0x28f8c5);})[_0xb073('0x27')](function(_0x29d0e2){_0x3eec63[_0xb073('0x44')]=_0x29d0e2;return _0x3eec63;})[_0xb073('0x27')](respondWithFilteredResult(_0x47eaaa,_0x28f8c5))[_0xb073('0x45')](handleError(_0x47eaaa,null));};exports[_0xb073('0x46')]=function(_0x3ede9e,_0x261d87){var _0x4a4523={'raw':!![],'where':{'id':_0x3ede9e[_0xb073('0x47')]['id']}},_0x4e6adb={};_0x4e6adb[_0xb073('0x31')]=_[_0xb073('0x33')](db[_0xb073('0x40')][_0xb073('0x2d')]);_0x4e6adb[_0xb073('0x32')]=_[_0xb073('0x33')](_0x3ede9e['query']);_0x4e6adb[_0xb073('0x3b')]=_[_0xb073('0x35')](_0x4e6adb[_0xb073('0x31')],_0x4e6adb[_0xb073('0x32')]);_0x4a4523[_0xb073('0x34')]=_[_0xb073('0x35')](_0x4e6adb[_0xb073('0x31')],qs['fields'](_0x3ede9e['query'][_0xb073('0x36')]));_0x4a4523[_0xb073('0x34')]=_0x4a4523[_0xb073('0x34')]['length']?_0x4a4523[_0xb073('0x34')]:_0x4e6adb['model'];if(_0x3ede9e['query']['includeAll']){_0x4a4523[_0xb073('0x42')]=[{'all':!![]}];}_0x4a4523=_['merge']({},_0x4a4523,_0x3ede9e[_0xb073('0x3f')]);return db[_0xb073('0x40')][_0xb073('0x48')](_0x4a4523)[_0xb073('0x27')](handleEntityNotFound(_0x261d87,null))[_0xb073('0x27')](respondWithResult(_0x261d87,null))['catch'](handleError(_0x261d87,null));};exports[_0xb073('0x49')]=function(_0x5e209e,_0xcafe42){return db['VoiceTransferReport'][_0xb073('0x49')](_0x5e209e[_0xb073('0x4a')],{})[_0xb073('0x27')](respondWithResult(_0xcafe42,0xc9))[_0xb073('0x45')](handleError(_0xcafe42,null));};exports[_0xb073('0x4b')]=function(_0x418f87,_0x22796e){if(_0x418f87[_0xb073('0x4a')]['id']){delete _0x418f87['body']['id'];}return db[_0xb073('0x40')][_0xb073('0x48')]({'where':{'id':_0x418f87[_0xb073('0x47')]['id']}})[_0xb073('0x27')](handleEntityNotFound(_0x22796e,null))['then'](saveUpdates(_0x418f87[_0xb073('0x4a')],null))[_0xb073('0x27')](respondWithResult(_0x22796e,null))[_0xb073('0x45')](handleError(_0x22796e,null));};exports[_0xb073('0x28')]=function(_0x21f7b9,_0x394225){return db['VoiceTransferReport']['find']({'where':{'id':_0x21f7b9[_0xb073('0x47')]['id']}})['then'](handleEntityNotFound(_0x394225,null))[_0xb073('0x27')](removeEntity(_0x394225,null))['catch'](handleError(_0x394225,null));};exports[_0xb073('0x4c')]=function(_0x479cef,_0x45ec94){return db[_0xb073('0x40')][_0xb073('0x4c')]()[_0xb073('0x27')](respondWithResult(_0x45ec94,null))[_0xb073('0x45')](handleError(_0x45ec94,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6e4c804..4e350f8 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 _0x22df=['VoiceTransferReport','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x150eda,_0x5d1eb3){var _0x4f5636=function(_0x27d6ed){while(--_0x27d6ed){_0x150eda['push'](_0x150eda['shift']());}};_0x4f5636(++_0x5d1eb3);}(_0x22df,0x156));var _0xf22d=function(_0x234aa6,_0x2e929d){_0x234aa6=_0x234aa6-0x0;var _0x2323d2=_0x22df[_0x234aa6];return _0x2323d2;};'use strict';var _=require(_0xf22d('0x0'));var util=require(_0xf22d('0x1'));var logger=require(_0xf22d('0x2'))(_0xf22d('0x3'));var moment=require('moment');var BPromise=require(_0xf22d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf22d('0x5'));var rimraf=require('rimraf');var config=require(_0xf22d('0x6'));var attributes=require(_0xf22d('0x7'));module[_0xf22d('0x8')]=function(_0x5c258c,_0x274e66){return _0x5c258c[_0xf22d('0x9')](_0xf22d('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4772=['request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4772,0x10e));var _0x2477=function(_0x4a4717,_0x3ed1ed){_0x4a4717=_0x4a4717-0x0;var _0x4ecaaa=_0x4772[_0x4a4717];return _0x4ecaaa;};'use strict';var _=require(_0x2477('0x0'));var util=require(_0x2477('0x1'));var logger=require(_0x2477('0x2'))('api');var moment=require(_0x2477('0x3'));var BPromise=require(_0x2477('0x4'));var rp=require(_0x2477('0x5'));var fs=require('fs');var path=require(_0x2477('0x6'));var rimraf=require('rimraf');var config=require(_0x2477('0x7'));var attributes=require(_0x2477('0x8'));module['exports']=function(_0x20b2a2,_0x55124b){return _0x20b2a2[_0x2477('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x2477('0xa'),'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 8d007dd..1f46f17 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 _0x5c32=['options','raw','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceTransferReport','create'];(function(_0x26e5c8,_0x1f10bf){var _0x217843=function(_0x577972){while(--_0x577972){_0x26e5c8['push'](_0x26e5c8['shift']());}};_0x217843(++_0x1f10bf);}(_0x5c32,0x199));var _0x25c3=function(_0x34f465,_0x524121){_0x34f465=_0x34f465-0x0;var _0x1a14f8=_0x5c32[_0x34f465];return _0x1a14f8;};'use strict';var _=require(_0x25c3('0x0'));var util=require(_0x25c3('0x1'));var moment=require(_0x25c3('0x2'));var BPromise=require(_0x25c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25c3('0x5'));var logger=require(_0x25c3('0x6'))(_0x25c3('0x7'));var config=require(_0x25c3('0x8'));var jayson=require(_0x25c3('0x9'));var client=jayson['client'][_0x25c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41062c,_0x2c4ad4,_0xeb0c83){return new BPromise(function(_0x16f6ca,_0x75b601){return client['request'](_0x41062c,_0xeb0c83)[_0x25c3('0xb')](function(_0x353f2e){logger[_0x25c3('0xc')](_0x25c3('0xd'),_0x2c4ad4,_0x25c3('0xe'));logger['debug'](_0x25c3('0xf'),_0x2c4ad4,_0x25c3('0xe'),JSON['stringify'](_0x353f2e));if(_0x353f2e['error']){if(_0x353f2e['error'][_0x25c3('0x10')]===0x1f4){logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x353f2e[_0x25c3('0x11')]['message']);return _0x75b601(_0x353f2e[_0x25c3('0x11')][_0x25c3('0x12')]);}logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x353f2e[_0x25c3('0x11')]['message']);return _0x16f6ca(_0x353f2e[_0x25c3('0x11')][_0x25c3('0x12')]);}else{logger[_0x25c3('0xc')](_0x25c3('0xd'),_0x2c4ad4,'request\x20sent');_0x16f6ca(_0x353f2e[_0x25c3('0x13')]['message']);}})[_0x25c3('0x14')](function(_0x1f37b1){logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x1f37b1);_0x75b601(_0x1f37b1);});});}exports['CreateVoiceTransferReport']=function(_0x50fec4){var _0x579575=this;return new Promise(function(_0x5f3b4d,_0x57ab10){return db[_0x25c3('0x15')][_0x25c3('0x16')](_0x50fec4['body'],{'raw':_0x50fec4[_0x25c3('0x17')]?_0x50fec4[_0x25c3('0x17')][_0x25c3('0x18')]===undefined?!![]:![]:!![]})[_0x25c3('0xb')](function(_0x1c2ae5){logger[_0x25c3('0xc')](_0x25c3('0x19'),_0x50fec4);logger[_0x25c3('0x1a')]('CreateVoiceTransferReport',_0x50fec4,JSON['stringify'](_0x1c2ae5));_0x5f3b4d(_0x1c2ae5);})['catch'](function(_0xa32b9a){logger['error'](_0x25c3('0x19'),_0xa32b9a[_0x25c3('0x12')],_0x50fec4);_0x57ab10(_0x579575[_0x25c3('0x11')](0x1f4,_0xa32b9a['message']));});});}; \ No newline at end of file +var _0x4f91=['stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','body','options','raw','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x25afe5,_0x169ade){var _0x5899ba=function(_0x1f8373){while(--_0x1f8373){_0x25afe5['push'](_0x25afe5['shift']());}};_0x5899ba(++_0x169ade);}(_0x4f91,0xeb));var _0x14f9=function(_0xc0cabe,_0xc81a11){_0xc0cabe=_0xc0cabe-0x0;var _0x4116b0=_0x4f91[_0xc0cabe];return _0x4116b0;};'use strict';var _=require(_0x14f9('0x0'));var util=require(_0x14f9('0x1'));var moment=require(_0x14f9('0x2'));var BPromise=require(_0x14f9('0x3'));var rs=require(_0x14f9('0x4'));var fs=require('fs');var Redis=require(_0x14f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x14f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x14f9('0x7'));var client=jayson[_0x14f9('0x8')][_0x14f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3e32,_0x36ecb3,_0x524e2c){return new BPromise(function(_0x23a3da,_0x46fe23){return client[_0x14f9('0xa')](_0x3f3e32,_0x524e2c)['then'](function(_0x3d5626){logger[_0x14f9('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x14f9('0xc'));logger[_0x14f9('0xd')](_0x14f9('0xe'),_0x36ecb3,_0x14f9('0xc'),JSON[_0x14f9('0xf')](_0x3d5626));if(_0x3d5626[_0x14f9('0x10')]){if(_0x3d5626[_0x14f9('0x10')]['code']===0x1f4){logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x3d5626[_0x14f9('0x10')][_0x14f9('0x11')]);return _0x46fe23(_0x3d5626[_0x14f9('0x10')][_0x14f9('0x11')]);}logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x3d5626['error'][_0x14f9('0x11')]);return _0x23a3da(_0x3d5626['error'][_0x14f9('0x11')]);}else{logger[_0x14f9('0xb')](_0x14f9('0x12'),_0x36ecb3,_0x14f9('0xc'));_0x23a3da(_0x3d5626[_0x14f9('0x13')][_0x14f9('0x11')]);}})['catch'](function(_0x576011){logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x576011);_0x46fe23(_0x576011);});});}exports['CreateVoiceTransferReport']=function(_0x14bfe1){var _0x5ac144=this;return new Promise(function(_0x55a77d,_0x5cac16){return db['VoiceTransferReport']['create'](_0x14bfe1[_0x14f9('0x14')],{'raw':_0x14bfe1[_0x14f9('0x15')]?_0x14bfe1[_0x14f9('0x15')][_0x14f9('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x30c977){logger[_0x14f9('0xb')](_0x14f9('0x17'),_0x14bfe1);logger['debug']('CreateVoiceTransferReport',_0x14bfe1,JSON[_0x14f9('0xf')](_0x30c977));_0x55a77d(_0x30c977);})[_0x14f9('0x18')](function(_0x5b2dce){logger[_0x14f9('0x10')](_0x14f9('0x17'),_0x5b2dce['message'],_0x14bfe1);_0x5cac16(_0x5ac144[_0x14f9('0x10')](0x1f4,_0x5b2dce[_0x14f9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 3a6a473..5fb1796 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 _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x42e36e,_0x3a9ac0){var _0x1d5a3b=function(_0x1ca245){while(--_0x1ca245){_0x42e36e['push'](_0x42e36e['shift']());}};_0x1d5a3b(++_0x3a9ac0);}(_0x9a19,0x114));var _0x99a1=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x9a19[_0x95411e];return _0x2c8718;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a50f33b..b6ef4df 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 _0xa01c=['User','findOne','then','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','body','validate','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','NotFound','request','code','error','message','result','catch'];(function(_0x19a806,_0x2f85b2){var _0x11f083=function(_0x5efbdf){while(--_0x5efbdf){_0x19a806['push'](_0x19a806['shift']());}};_0x11f083(++_0x2f85b2);}(_0xa01c,0x1f1));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xca01('0x0'));var fs=require('fs');var _=require(_0xca01('0x1'));var db=require(_0xca01('0x2'))['db'];var config=require(_0xca01('0x3'));var util=require('util');var BPromise=require(_0xca01('0x4'));var jayson=require(_0xca01('0x5'));var amiClient=jayson[_0xca01('0x6')][_0xca01('0x7')]({'port':0x232a});var logger=require(_0xca01('0x8'))(_0xca01('0x9'));var Redis=require(_0xca01('0xa'));config[_0xca01('0xb')]=_[_0xca01('0xc')](config[_0xca01('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xca01('0xd'))(new Redis(config[_0xca01('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]},'callNumber':{'type':'string','required':[!![],_0xca01('0x10')]},'callerId':{'type':_0xca01('0x11')},'callbackUrl':{'type':_0xca01('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xca01('0xf')]},'sessionId':{'type':_0xca01('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xca01('0x11'),'required':[!![],_0xca01('0x12')]},'transferNumber':{'type':_0xca01('0x11'),'required':[!![],_0xca01('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xca01('0xf')]},'sessionId':{'type':_0xca01('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]}});function emit(_0x55fbf4,_0x6f7df7,_0x117d5f){logger[_0xca01('0x14')](_0x55fbf4,_0x6f7df7,JSON[_0xca01('0x15')](_0x117d5f));io['to'](_0x55fbf4)[_0xca01('0x16')](_0x6f7df7,_0x117d5f);}function handleError(_0x598a30){return function(_0x16303c){console[_0xca01('0x17')](_0xca01('0x18'),_0x16303c,_0x16303c instanceof RangeError);logger['error'](_0x16303c[_0xca01('0x19')]);if(_0x16303c instanceof RangeError){if(_0x16303c[_0xca01('0x1a')]){delete _0x16303c[_0xca01('0x1a')];}_0x598a30[_0xca01('0x1b')](0x194)['send'](_0x16303c);}else{if(_0x16303c[_0xca01('0x1a')]){delete _0x16303c[_0xca01('0x1a')];}_0x598a30[_0xca01('0x1b')](0x1f4)['send'](_0x16303c);}};}function checkError(){return function(_0x162e8e){if(!_0x162e8e){throw new RangeError(_0xca01('0x1c'));}return _0x162e8e;};}function respondWithRpcPromise(_0x196678,_0x3238f7){return new BPromise(function(_0x3aef1d,_0x3d2b23){var _0x56a0f3=amiClient;return _0x56a0f3[_0xca01('0x1d')](_0x196678,_0x3238f7)['then'](function(_0x34c48e){if(_0x34c48e['error']){if(_0x34c48e['error'][_0xca01('0x1e')]===0x1f4){return _0x3d2b23(_0x34c48e[_0xca01('0x1f')][_0xca01('0x20')]);}return _0x3aef1d(_0x34c48e[_0xca01('0x1f')]['message']);}else{_0x3aef1d(_0x34c48e[_0xca01('0x21')]);}})[_0xca01('0x22')](function(_0x3d075a){_0x3d2b23(_0x3d075a);});});}function getAgent(_0x5f08d8){return db[_0xca01('0x23')][_0xca01('0x24')]({'where':{'id':_0x5f08d8,'role':'agent'}})[_0xca01('0x25')](checkError());}function getAgentCheckSession(_0xdeae48,_0x1c01f5){return new BPromise(function(_0x1403ad,_0x516682){var _0x3229bb=respondWithRpcPromise(_0xca01('0x26'));var _0x384df6=getAgent(_0xdeae48);Promise[_0xca01('0x27')]([_0x3229bb,_0x384df6])[_0xca01('0x25')](function(_0x2485c1){var _0x47241c=_0x2485c1[0x0];var _0x760e91=_0x2485c1[0x1];var _0x390e5b=_[_0xca01('0x28')](_0x47241c['rows'],function(_0x3675ce){return _0x3675ce[_0xca01('0x29')]==_0x760e91['id']&&_0x3675ce[_0xca01('0x2a')]==_0x1c01f5;});if(_0x390e5b['length']==0x1){_0x1403ad(_0x760e91);}else{_0x516682(new RangeError(_0xca01('0x2b')+_0x1c01f5+_0xca01('0x2c')));}});});}exports[_0xca01('0x2d')]=function(_0xeff93,_0x46e946){logger['info']('originate\x20fired:',_0xeff93[_0xca01('0x2e')]);var _0x3227a9=originateValidation[_0xca01('0x2f')](_0xeff93[_0xca01('0x2e')]);if(_0x3227a9[_0xca01('0x30')]>0x0){return _0x46e946['status'](0x190)[_0xca01('0x31')](_0x3227a9);}var _0x6438b0=_0xeff93['body'][_0xca01('0x32')];var _0x5776ef=_0xeff93[_0xca01('0x2e')][_0xca01('0x33')];var _0x31c83b=_0xeff93[_0xca01('0x2e')][_0xca01('0x34')];var _0x2c5c89=_0xeff93[_0xca01('0x2e')]['callbackUrl'];return getAgent(_0x6438b0)[_0xca01('0x25')](function(_0x38969b){logger[_0xca01('0x14')](_0xca01('0x35'),_0x38969b[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x38969b[_0xca01('0x1a')]),_0xca01('0x38'),{'callNumber':_0x5776ef,'callerId':_0x31c83b,'callbackUrl':_0x2c5c89});return _0x46e946[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x39')});})[_0xca01('0x22')](handleError(_0x46e946));};exports[_0xca01('0x3a')]=function(_0x45ed0e,_0x106903){logger[_0xca01('0x14')](_0xca01('0x3b'),_0x45ed0e[_0xca01('0x2e')]);var _0x34c51c=hangupValidation[_0xca01('0x2f')](_0x45ed0e[_0xca01('0x2e')]);if(_0x34c51c[_0xca01('0x30')]>0x0){return _0x106903[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x34c51c);}var _0x23f254=_0x45ed0e[_0xca01('0x2e')][_0xca01('0x32')];var _0x3a8114=_0x45ed0e[_0xca01('0x2e')]['sessionId'];return getAgent(_0x23f254)['then'](function(_0x4eeba4){logger['info'](_0xca01('0x35'),_0x4eeba4['name']);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x4eeba4[_0xca01('0x1a')]),'webbar:hangup',{'sessionId':_0x3a8114});return _0x106903[_0xca01('0x1b')](0xc8)['json']({'error':![],'message':_0xca01('0x3c')});})[_0xca01('0x22')](handleError(_0x106903));};exports[_0xca01('0x3d')]=function(_0xfad0e7,_0x1d19b6){logger[_0xca01('0x14')]('answer\x20fired:',_0xfad0e7[_0xca01('0x2e')]);var _0x523641=answerValidation[_0xca01('0x2f')](_0xfad0e7['body']);if(_0x523641[_0xca01('0x30')]>0x0){return _0x1d19b6[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x523641);}var _0x160b5e=_0xfad0e7[_0xca01('0x2e')][_0xca01('0x32')];var _0x552ae5=_0xfad0e7['body'][_0xca01('0x2a')];return getAgent(_0x160b5e)['then'](function(_0x949da3){logger[_0xca01('0x14')](_0xca01('0x35'),_0x949da3[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x949da3[_0xca01('0x1a')]),_0xca01('0x3e'),{'sessionId':_0x552ae5});return _0x1d19b6[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x3f')});})['catch'](handleError(_0x1d19b6));};exports['hold']=function(_0x2d3e44,_0x3ad9b6){logger[_0xca01('0x14')]('hold\x20fired:',_0x2d3e44[_0xca01('0x2e')]);var _0xde1b63=holdValidation[_0xca01('0x2f')](_0x2d3e44['body']);if(_0xde1b63['length']>0x0){return _0x3ad9b6[_0xca01('0x1b')](0x190)['json'](_0xde1b63);}var _0x2e4e6d=_0x2d3e44[_0xca01('0x2e')]['userId'];var _0x39acca=_0x2d3e44[_0xca01('0x2e')][_0xca01('0x2a')];return getAgent(_0x2e4e6d)['then'](function(_0x2455b6){logger[_0xca01('0x14')](_0xca01('0x35'),_0x2455b6[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x2455b6[_0xca01('0x1a')]),_0xca01('0x40'),{'sessionId':_0x39acca});return _0x3ad9b6[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x41')});})['catch'](handleError(_0x3ad9b6));};exports['unhold']=function(_0x17f8ec,_0x58bd98){logger[_0xca01('0x14')](_0xca01('0x42'),_0x17f8ec[_0xca01('0x2e')]);var _0x4e8041=unholdValidation[_0xca01('0x2f')](_0x17f8ec[_0xca01('0x2e')]);if(_0x4e8041[_0xca01('0x30')]>0x0){return _0x58bd98[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x4e8041);}var _0x320bcc=_0x17f8ec[_0xca01('0x2e')][_0xca01('0x32')];var _0x59af41=_0x17f8ec[_0xca01('0x2e')][_0xca01('0x2a')];return getAgent(_0x320bcc)['then'](function(_0x2a1c7b){logger[_0xca01('0x14')](_0xca01('0x35'),_0x2a1c7b[_0xca01('0x1a')]);emit(util[_0xca01('0x36')]('user:%s',_0x2a1c7b['name']),'webbar:unhold',{'sessionId':_0x59af41});return _0x58bd98[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x43')});})['catch'](handleError(_0x58bd98));};exports['calls']=function(_0x16f992,_0xd634bb){logger[_0xca01('0x14')]('calls\x20fired:',_0xd634bb[_0xca01('0x2e')]);var _0x6239e7=callsValidation['validate'](_0x16f992['body']);if(_0x6239e7[_0xca01('0x30')]>0x0){return _0xd634bb[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x6239e7);}var _0x116187=_0x16f992[_0xca01('0x2e')]['userId'];var _0x5d2831=respondWithRpcPromise(_0xca01('0x26'));var _0x538e63=getAgent(_0x116187);return Promise[_0xca01('0x27')]([_0x5d2831,_0x538e63])['then'](function(_0x52c9fc){var _0x576802=_0x52c9fc[0x0];var _0x1b5029=_0x52c9fc[0x1];var _0x510507=_[_0xca01('0x28')](_0x576802[_0xca01('0x44')],function(_0x580155){return _0x580155[_0xca01('0x29')]==_0x1b5029['id'];});return _0xd634bb[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'count':_0x510507[_0xca01('0x30')],'rows':_0x510507});})['catch'](handleError(_0xd634bb));};exports[_0xca01('0x45')]=function(_0x306ccb,_0x13a751){logger[_0xca01('0x14')](_0xca01('0x46'),_0x306ccb[_0xca01('0x2e')]);var _0x21b79b=conferenceValidation[_0xca01('0x2f')](_0x306ccb['body']);if(_0x21b79b[_0xca01('0x30')]>0x0){return _0x13a751[_0xca01('0x1b')](0x190)['json'](_0x21b79b);}var _0x43e007=_0x306ccb['body'][_0xca01('0x32')];return getAgent(_0x43e007)[_0xca01('0x25')](function(_0xd31301){logger['info'](_0xca01('0x35'),_0xd31301[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0xd31301[_0xca01('0x1a')]),_0xca01('0x47'));return _0x13a751[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x48')});})[_0xca01('0x22')](handleError(_0x13a751));};exports['transfer']=function(_0x29bff9,_0x1406c8){logger[_0xca01('0x14')](_0xca01('0x49'),_0x29bff9[_0xca01('0x2e')]);var _0x1eeb9c=transferValidation[_0xca01('0x2f')](_0x29bff9[_0xca01('0x2e')]);if(_0x1eeb9c[_0xca01('0x30')]>0x0){return _0x1406c8[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x1eeb9c);}var _0x1a3309=_0x29bff9[_0xca01('0x2e')][_0xca01('0x32')];var _0x446be4=_0x29bff9[_0xca01('0x2e')]['sessionId'];var _0x47b2e5=_0x29bff9[_0xca01('0x2e')][_0xca01('0x4a')];return getAgent(_0x1a3309)[_0xca01('0x25')](function(_0x232cc1){logger[_0xca01('0x14')]('entityFound:',_0x232cc1[_0xca01('0x1a')]);emit(util['format'](_0xca01('0x37'),_0x232cc1[_0xca01('0x1a')]),_0xca01('0x4b'),{'sessionId':_0x446be4,'transferNumber':_0x47b2e5});return _0x1406c8[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':'transfer\x20executed!'});})[_0xca01('0x22')](handleError(_0x1406c8));}; \ No newline at end of file +var _0xb344=['length','user:%s','hangup\x20executed!','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','error','status','send','NotFound','request','then','code','message','result','catch','User','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','name','format','webbar:originate','originate\x20executed!','hangup','info'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb344,0x99));var _0x4b34=function(_0x3ba095,_0x445aef){_0x3ba095=_0x3ba095-0x0;var _0x135e8c=_0xb344[_0x3ba095];return _0x135e8c;};'use strict';var path=require(_0x4b34('0x0'));var fs=require('fs');var _=require(_0x4b34('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x4b34('0x2'));var util=require(_0x4b34('0x3'));var BPromise=require('bluebird');var jayson=require(_0x4b34('0x4'));var amiClient=jayson[_0x4b34('0x5')]['http']({'port':0x232a});var logger=require(_0x4b34('0x6'))(_0x4b34('0x7'));var Redis=require(_0x4b34('0x8'));config[_0x4b34('0x9')]=_[_0x4b34('0xa')](config[_0x4b34('0x9')],{'host':_0x4b34('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b34('0x9')]));var Schema=require(_0x4b34('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4b34('0xd')},'callbackUrl':{'type':_0x4b34('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4b34('0xd'),'required':[!![],_0x4b34('0x10')]},'transferNumber':{'type':_0x4b34('0xd'),'required':[!![],_0x4b34('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],_0x4b34('0xf')]}});function emit(_0x1ed068,_0x2092f3,_0x577ac4){logger['info'](_0x1ed068,_0x2092f3,JSON[_0x4b34('0x12')](_0x577ac4));io['to'](_0x1ed068)['emit'](_0x2092f3,_0x577ac4);}function handleError(_0x3e1e0d){return function(_0x114899){console[_0x4b34('0x13')]('handleError:',_0x114899,_0x114899 instanceof RangeError);logger[_0x4b34('0x14')](_0x114899['stack']);if(_0x114899 instanceof RangeError){if(_0x114899['name']){delete _0x114899['name'];}_0x3e1e0d[_0x4b34('0x15')](0x194)[_0x4b34('0x16')](_0x114899);}else{if(_0x114899['name']){delete _0x114899['name'];}_0x3e1e0d[_0x4b34('0x15')](0x1f4)[_0x4b34('0x16')](_0x114899);}};}function checkError(){return function(_0x355482){if(!_0x355482){throw new RangeError(_0x4b34('0x17'));}return _0x355482;};}function respondWithRpcPromise(_0x4b191f,_0x5c0174){return new BPromise(function(_0x483fcb,_0x9a8ccf){var _0x36feb6=amiClient;return _0x36feb6[_0x4b34('0x18')](_0x4b191f,_0x5c0174)[_0x4b34('0x19')](function(_0x396edd){if(_0x396edd[_0x4b34('0x14')]){if(_0x396edd['error'][_0x4b34('0x1a')]===0x1f4){return _0x9a8ccf(_0x396edd[_0x4b34('0x14')][_0x4b34('0x1b')]);}return _0x483fcb(_0x396edd[_0x4b34('0x14')][_0x4b34('0x1b')]);}else{_0x483fcb(_0x396edd[_0x4b34('0x1c')]);}})[_0x4b34('0x1d')](function(_0x545b0a){_0x9a8ccf(_0x545b0a);});});}function getAgent(_0x5aff22){return db[_0x4b34('0x1e')]['findOne']({'where':{'id':_0x5aff22,'role':'agent'}})[_0x4b34('0x19')](checkError());}function getAgentCheckSession(_0x190555,_0x3bebb4){return new BPromise(function(_0x827b74,_0x2f2100){var _0xcd2ff6=respondWithRpcPromise(_0x4b34('0x1f'));var _0x1835ef=getAgent(_0x190555);Promise[_0x4b34('0x20')]([_0xcd2ff6,_0x1835ef])[_0x4b34('0x19')](function(_0x30bf7e){var _0x3c82d3=_0x30bf7e[0x0];var _0x3eaad0=_0x30bf7e[0x1];var _0x248de9=_[_0x4b34('0x21')](_0x3c82d3[_0x4b34('0x22')],function(_0x2aab1){return _0x2aab1[_0x4b34('0x23')]==_0x3eaad0['id']&&_0x2aab1[_0x4b34('0x24')]==_0x3bebb4;});if(_0x248de9['length']==0x1){_0x827b74(_0x3eaad0);}else{_0x2f2100(new RangeError(_0x4b34('0x25')+_0x3bebb4+'\x20not\x20found!'));}});});}exports['originate']=function(_0xb4846d,_0x10f211){logger['info'](_0x4b34('0x26'),_0xb4846d[_0x4b34('0x27')]);var _0x4fa531=originateValidation[_0x4b34('0xc')](_0xb4846d[_0x4b34('0x27')]);if(_0x4fa531['length']>0x0){return _0x10f211['status'](0x190)[_0x4b34('0x28')](_0x4fa531);}var _0x55f694=_0xb4846d['body'][_0x4b34('0x29')];var _0xfee938=_0xb4846d[_0x4b34('0x27')][_0x4b34('0x2a')];var _0xb1e96a=_0xb4846d['body'][_0x4b34('0x2b')];var _0xaf8c32=_0xb4846d[_0x4b34('0x27')]['callbackUrl'];return getAgent(_0x55f694)[_0x4b34('0x19')](function(_0x32eed2){logger['info'](_0x4b34('0x2c'),_0x32eed2[_0x4b34('0x2d')]);emit(util[_0x4b34('0x2e')]('user:%s',_0x32eed2[_0x4b34('0x2d')]),_0x4b34('0x2f'),{'callNumber':_0xfee938,'callerId':_0xb1e96a,'callbackUrl':_0xaf8c32});return _0x10f211[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x30')});})[_0x4b34('0x1d')](handleError(_0x10f211));};exports[_0x4b34('0x31')]=function(_0xe7224c,_0x4dbbb8){logger[_0x4b34('0x32')]('hangup\x20fired:',_0xe7224c[_0x4b34('0x27')]);var _0x37a4fc=hangupValidation[_0x4b34('0xc')](_0xe7224c[_0x4b34('0x27')]);if(_0x37a4fc[_0x4b34('0x33')]>0x0){return _0x4dbbb8['status'](0x190)[_0x4b34('0x28')](_0x37a4fc);}var _0x536e0b=_0xe7224c[_0x4b34('0x27')]['userId'];var _0x4fabf9=_0xe7224c[_0x4b34('0x27')][_0x4b34('0x24')];return getAgent(_0x536e0b)[_0x4b34('0x19')](function(_0x459a31){logger['info']('entityFound:',_0x459a31['name']);emit(util['format'](_0x4b34('0x34'),_0x459a31[_0x4b34('0x2d')]),'webbar:hangup',{'sessionId':_0x4fabf9});return _0x4dbbb8[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x35')});})['catch'](handleError(_0x4dbbb8));};exports[_0x4b34('0x36')]=function(_0x2f1167,_0x375203){logger['info']('answer\x20fired:',_0x2f1167['body']);var _0x3f9c27=answerValidation[_0x4b34('0xc')](_0x2f1167['body']);if(_0x3f9c27[_0x4b34('0x33')]>0x0){return _0x375203['status'](0x190)[_0x4b34('0x28')](_0x3f9c27);}var _0x5bc0dd=_0x2f1167[_0x4b34('0x27')][_0x4b34('0x29')];var _0x30d7c5=_0x2f1167[_0x4b34('0x27')]['sessionId'];return getAgent(_0x5bc0dd)[_0x4b34('0x19')](function(_0x90cac3){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x90cac3[_0x4b34('0x2d')]);emit(util[_0x4b34('0x2e')]('user:%s',_0x90cac3[_0x4b34('0x2d')]),'webbar:answer',{'sessionId':_0x30d7c5});return _0x375203[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x37')});})[_0x4b34('0x1d')](handleError(_0x375203));};exports[_0x4b34('0x38')]=function(_0x364202,_0x5d6901){logger[_0x4b34('0x32')](_0x4b34('0x39'),_0x364202[_0x4b34('0x27')]);var _0x29574d=holdValidation[_0x4b34('0xc')](_0x364202[_0x4b34('0x27')]);if(_0x29574d[_0x4b34('0x33')]>0x0){return _0x5d6901[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0x29574d);}var _0xbb37f2=_0x364202[_0x4b34('0x27')][_0x4b34('0x29')];var _0x1b4518=_0x364202['body']['sessionId'];return getAgent(_0xbb37f2)['then'](function(_0x1019b4){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x1019b4[_0x4b34('0x2d')]);emit(util['format'](_0x4b34('0x34'),_0x1019b4['name']),_0x4b34('0x3a'),{'sessionId':_0x1b4518});return _0x5d6901[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x3b')});})[_0x4b34('0x1d')](handleError(_0x5d6901));};exports[_0x4b34('0x3c')]=function(_0x1fc1e5,_0x20b824){logger[_0x4b34('0x32')]('unhold\x20fired:',_0x1fc1e5[_0x4b34('0x27')]);var _0xfab413=unholdValidation[_0x4b34('0xc')](_0x1fc1e5['body']);if(_0xfab413[_0x4b34('0x33')]>0x0){return _0x20b824[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0xfab413);}var _0x310b7d=_0x1fc1e5[_0x4b34('0x27')]['userId'];var _0x10c599=_0x1fc1e5['body'][_0x4b34('0x24')];return getAgent(_0x310b7d)[_0x4b34('0x19')](function(_0x2e807b){logger['info'](_0x4b34('0x2c'),_0x2e807b[_0x4b34('0x2d')]);emit(util['format'](_0x4b34('0x34'),_0x2e807b['name']),'webbar:unhold',{'sessionId':_0x10c599});return _0x20b824[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x20b824));};exports[_0x4b34('0x3d')]=function(_0x461e07,_0x4c044a){logger[_0x4b34('0x32')](_0x4b34('0x3e'),_0x4c044a[_0x4b34('0x27')]);var _0x50b478=callsValidation[_0x4b34('0xc')](_0x461e07['body']);if(_0x50b478[_0x4b34('0x33')]>0x0){return _0x4c044a[_0x4b34('0x15')](0x190)['json'](_0x50b478);}var _0xea542e=_0x461e07[_0x4b34('0x27')][_0x4b34('0x29')];var _0x1c625d=respondWithRpcPromise(_0x4b34('0x1f'));var _0x1408b2=getAgent(_0xea542e);return Promise[_0x4b34('0x20')]([_0x1c625d,_0x1408b2])[_0x4b34('0x19')](function(_0x269813){var _0x47f055=_0x269813[0x0];var _0x4013b9=_0x269813[0x1];var _0x32ea0c=_['filter'](_0x47f055['rows'],function(_0x359017){return _0x359017[_0x4b34('0x23')]==_0x4013b9['id'];});return _0x4c044a[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'count':_0x32ea0c[_0x4b34('0x33')],'rows':_0x32ea0c});})[_0x4b34('0x1d')](handleError(_0x4c044a));};exports['conference']=function(_0x3571cf,_0xffd9f){logger['info'](_0x4b34('0x3f'),_0x3571cf[_0x4b34('0x27')]);var _0xde6f8c=conferenceValidation[_0x4b34('0xc')](_0x3571cf[_0x4b34('0x27')]);if(_0xde6f8c[_0x4b34('0x33')]>0x0){return _0xffd9f[_0x4b34('0x15')](0x190)['json'](_0xde6f8c);}var _0x149fd0=_0x3571cf[_0x4b34('0x27')][_0x4b34('0x29')];return getAgent(_0x149fd0)['then'](function(_0x50233d){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x50233d[_0x4b34('0x2d')]);emit(util['format']('user:%s',_0x50233d[_0x4b34('0x2d')]),'webbar:conference');return _0xffd9f['status'](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x40')});})[_0x4b34('0x1d')](handleError(_0xffd9f));};exports[_0x4b34('0x41')]=function(_0x376017,_0x39c6ed){logger['info']('transfer\x20fired:',_0x376017[_0x4b34('0x27')]);var _0x32912b=transferValidation[_0x4b34('0xc')](_0x376017[_0x4b34('0x27')]);if(_0x32912b[_0x4b34('0x33')]>0x0){return _0x39c6ed[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0x32912b);}var _0x4888a9=_0x376017[_0x4b34('0x27')][_0x4b34('0x29')];var _0xbfed98=_0x376017[_0x4b34('0x27')][_0x4b34('0x24')];var _0x1d3e85=_0x376017['body'][_0x4b34('0x42')];return getAgent(_0x4888a9)[_0x4b34('0x19')](function(_0x13b186){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x13b186['name']);emit(util[_0x4b34('0x2e')](_0x4b34('0x34'),_0x13b186[_0x4b34('0x2d')]),'webbar:transfer',{'sessionId':_0xbfed98,'transferNumber':_0x1d3e85});return _0x39c6ed[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x43')});})[_0x4b34('0x1d')](handleError(_0x39c6ed));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5bf357e..46f58e8 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 _0x0754=['addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0x0754,0x17f));var _0x4075=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x0754[_0x26d386];return _0x4ef9a8;};'use strict';var multer=require(_0x4075('0x0'));var util=require(_0x4075('0x1'));var path=require(_0x4075('0x2'));var timeout=require(_0x4075('0x3'));var express=require(_0x4075('0x4'));var router=express[_0x4075('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4075('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4075('0x7'));var controller=require(_0x4075('0x8'));router[_0x4075('0x9')]('/',auth[_0x4075('0xa')](),controller[_0x4075('0xb')]);router[_0x4075('0x9')]('/describe',auth[_0x4075('0xa')](),controller['describe']);router[_0x4075('0x9')](_0x4075('0xc'),auth[_0x4075('0xa')](),controller[_0x4075('0xd')]);router[_0x4075('0x9')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller[_0x4075('0xf')]);router[_0x4075('0x9')](_0x4075('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4075('0x9')](_0x4075('0x11'),auth['isAuthenticated'](),controller[_0x4075('0x12')]);router[_0x4075('0x9')](_0x4075('0x13'),auth[_0x4075('0xa')](),controller[_0x4075('0x14')]);router[_0x4075('0x15')]('/',auth[_0x4075('0xa')](),controller[_0x4075('0x16')]);router[_0x4075('0x15')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller[_0x4075('0x17')]);router[_0x4075('0x15')](_0x4075('0x10'),auth[_0x4075('0xa')](),controller[_0x4075('0x18')]);router['post'](_0x4075('0x11'),auth[_0x4075('0xa')](),controller[_0x4075('0x19')]);router['post'](_0x4075('0x13'),auth[_0x4075('0xa')](),controller[_0x4075('0x1a')]);router[_0x4075('0x15')](_0x4075('0x1b'),controller[_0x4075('0x1c')]);router[_0x4075('0x15')](_0x4075('0x1d'),auth[_0x4075('0xa')](),controller[_0x4075('0x1e')]);router[_0x4075('0x1f')]('/:id',auth[_0x4075('0xa')](),controller[_0x4075('0x20')]);router[_0x4075('0x21')]('/:id',auth[_0x4075('0xa')](),controller[_0x4075('0x22')]);router[_0x4075('0x21')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller['removeDispositions']);router[_0x4075('0x21')](_0x4075('0x10'),auth[_0x4075('0xa')](),controller[_0x4075('0x23')]);router['delete'](_0x4075('0x11'),auth['isAuthenticated'](),controller[_0x4075('0x24')]);module['exports']=router; \ No newline at end of file +var _0x4d32=['express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','notify','delete','removeDispositions','exports','multer','util','connect-timeout'];(function(_0x1a20bd,_0x536b6e){var _0x3824a4=function(_0x274756){while(--_0x274756){_0x1a20bd['push'](_0x1a20bd['shift']());}};_0x3824a4(++_0x536b6e);}(_0x4d32,0x79));var _0x24d3=function(_0x47cd84,_0x3056b9){_0x47cd84=_0x47cd84-0x0;var _0x800299=_0x4d32[_0x47cd84];return _0x800299;};'use strict';var multer=require(_0x24d3('0x0'));var util=require(_0x24d3('0x1'));var path=require('path');var timeout=require(_0x24d3('0x2'));var express=require(_0x24d3('0x3'));var router=express['Router']();var fs_extra=require(_0x24d3('0x4'));var auth=require(_0x24d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24d3('0x6'));var controller=require('./whatsappAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x24d3('0x7')]);router['get'](_0x24d3('0x8'),auth['isAuthenticated'](),controller[_0x24d3('0x9')]);router[_0x24d3('0xa')](_0x24d3('0xb'),auth[_0x24d3('0xc')](),controller[_0x24d3('0xd')]);router[_0x24d3('0xa')](_0x24d3('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x24d3('0xa')](_0x24d3('0xf'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x10')]);router[_0x24d3('0xa')](_0x24d3('0x11'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x12')]);router['get'](_0x24d3('0x13'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x14')]);router['post']('/',auth[_0x24d3('0xc')](),controller[_0x24d3('0x15')]);router[_0x24d3('0x16')](_0x24d3('0xe'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x17')]);router[_0x24d3('0x16')]('/:id/canned_answers',auth[_0x24d3('0xc')](),controller[_0x24d3('0x18')]);router['post'](_0x24d3('0x11'),auth['isAuthenticated'](),controller[_0x24d3('0x19')]);router['post'](_0x24d3('0x13'),auth['isAuthenticated'](),controller[_0x24d3('0x1a')]);router[_0x24d3('0x16')]('/:id/notify',controller[_0x24d3('0x1b')]);router[_0x24d3('0x16')]('/:id/send',auth[_0x24d3('0xc')](),controller['send']);router['put']('/:id',auth[_0x24d3('0xc')](),controller['update']);router['delete'](_0x24d3('0xb'),auth[_0x24d3('0xc')](),controller['destroy']);router[_0x24d3('0x1c')](_0x24d3('0xe'),auth['isAuthenticated'](),controller[_0x24d3('0x1d')]);router[_0x24d3('0x1c')](_0x24d3('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x24d3('0x1c')](_0x24d3('0x11'),auth[_0x24d3('0xc')](),controller['removeAgents']);module[_0x24d3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9e88b05..89bc3e7 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 _0x8ea8=['name','sinch','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','STRING'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x8ea8,0xca));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x88ea('0x0'));module['exports']={'name':{'type':Sequelize[_0x88ea('0x1')],'unique':_0x88ea('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x88ea('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x88ea('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x88ea('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x88ea('0x1')]},'type':{'type':Sequelize['ENUM']('twilio',_0x88ea('0x3'))},'accountSid':{'type':Sequelize[_0x88ea('0x1')]},'baseUrl':{'type':Sequelize[_0x88ea('0x1')]},'authToken':{'type':Sequelize[_0x88ea('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x88ea('0x4');}},'notificationSound':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x88ea('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![],'comment':_0x88ea('0x8'),'set':function(_0x2f50c0){if(!_0x2f50c0){this[_0x88ea('0x9')](_0x88ea('0xa'),null);}this[_0x88ea('0x9')](_0x88ea('0xb'),_0x2f50c0);}},'description':{'type':Sequelize[_0x88ea('0x1')]}}; \ No newline at end of file +var _0x8bbb=['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','exports','STRING','name','generate','ENUM','sinch'];(function(_0x23c33c,_0x1d1aad){var _0x2c6c21=function(_0x5bfdb9){while(--_0x5bfdb9){_0x23c33c['push'](_0x23c33c['shift']());}};_0x2c6c21(++_0x1d1aad);}(_0x8bbb,0x18e));var _0xb8bb=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x8bbb[_0x48b5e0];return _0x4287ea;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb8bb('0x0'));module[_0xb8bb('0x1')]={'name':{'type':Sequelize[_0xb8bb('0x2')],'unique':_0xb8bb('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb8bb('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb8bb('0x2')],'defaultValue':function(){return rs[_0xb8bb('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb8bb('0x5')]('twilio',_0xb8bb('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb8bb('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8bb('0x9')],'comment':_0xb8bb('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![],'comment':_0xb8bb('0xb'),'set':function(_0x206312){if(!_0x206312){this[_0xb8bb('0xc')](_0xb8bb('0xd'),null);}this['setDataValue'](_0xb8bb('0xe'),_0x206312);}},'description':{'type':Sequelize[_0xb8bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 4b7eed1..e08cf52 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 _0x6e9c=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','Pause','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','findOne','nolimit','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','rows','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','order','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','From','replace','whatsapp:','Body','MessageSid','from','messageId','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x11ba09,_0x2a01a8){var _0x44f298=function(_0x59bcc5){while(--_0x59bcc5){_0x11ba09['push'](_0x11ba09['shift']());}};_0x44f298(++_0x2a01a8);}(_0x6e9c,0x153));var _0xc6e9=function(_0x27ad96,_0x2431f9){_0x27ad96=_0x27ad96-0x0;var _0xd75b77=_0x6e9c[_0x27ad96];return _0xd75b77;};'use strict';var emlformat=require(_0xc6e9('0x0'));var rimraf=require(_0xc6e9('0x1'));var zipdir=require(_0xc6e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6e9('0x3'));var moment=require(_0xc6e9('0x4'));var BPromise=require(_0xc6e9('0x5'));var Mustache=require('mustache');var util=require(_0xc6e9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc6e9('0x7'));var fs=require('fs');var fs_extra=require(_0xc6e9('0x8'));var _=require(_0xc6e9('0x9'));var squel=require(_0xc6e9('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6e9('0xb'));var deskjs=require(_0xc6e9('0xc'));var toCsv=require(_0xc6e9('0xd'));var querystring=require(_0xc6e9('0xe'));var Papa=require(_0xc6e9('0xf'));var Redis=require(_0xc6e9('0x10'));var authService=require(_0xc6e9('0x11'));var qs=require(_0xc6e9('0x12'));var as=require(_0xc6e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc6e9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc6e9('0x15'));var db=require(_0xc6e9('0x16'))['db'];config[_0xc6e9('0x17')]=_[_0xc6e9('0x18')](config[_0xc6e9('0x17')],{'host':_0xc6e9('0x19'),'port':0x18eb});var socket=require(_0xc6e9('0x1a'))(new Redis(config['redis']));require(_0xc6e9('0x1b'))['register'](socket);var jayson=require(_0xc6e9('0x1c'));var client=jayson[_0xc6e9('0x1d')][_0xc6e9('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x4939da,_0x5e9fba,_0x57a204,_0xf615e5){return new BPromise(function(_0x44eb58,_0x3004fd){var _0x49dd5c=_0xf615e5||client;return _0x49dd5c['request'](_0x4939da,_0x57a204)[_0xc6e9('0x1f')](function(_0x137ecf){logger[_0xc6e9('0x20')](_0xc6e9('0x21'),_0x5e9fba,_0xc6e9('0x22'));logger['debug'](_0xc6e9('0x23'),_0x5e9fba,_0xc6e9('0x22'),JSON['stringify'](_0x137ecf));if(_0x137ecf['error']){if(_0x137ecf[_0xc6e9('0x24')]['code']===0x1f4){logger[_0xc6e9('0x24')](_0xc6e9('0x21'),_0x5e9fba,_0x137ecf['error'][_0xc6e9('0x25')]);return _0x3004fd(_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);}logger[_0xc6e9('0x24')](_0xc6e9('0x21'),_0x5e9fba,_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);return _0x44eb58(_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);}else{logger[_0xc6e9('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5e9fba,_0xc6e9('0x22'));_0x44eb58(_0x137ecf[_0xc6e9('0x26')][_0xc6e9('0x25')]);}})['catch'](function(_0x5257cc){logger[_0xc6e9('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5e9fba,_0x5257cc);_0x3004fd(_0x5257cc);});});}function respondWithStatusCode(_0x45693b,_0x20f5f8){_0x20f5f8=_0x20f5f8||0xcc;return function(_0x87928e){if(_0x87928e){return _0x45693b[_0xc6e9('0x27')](_0x20f5f8);}return _0x45693b['status'](_0x20f5f8)[_0xc6e9('0x28')]();};}function respondWithResult(_0x238e79,_0x2eabf1){_0x2eabf1=_0x2eabf1||0xc8;return function(_0x2611bf){if(_0x2611bf){return _0x238e79[_0xc6e9('0x29')](_0x2eabf1)[_0xc6e9('0x2a')](_0x2611bf);}};}function respondWithFilteredResult(_0x2ccead,_0x4c7d2b){return function(_0x497f97){if(_0x497f97){var _0x26cbc5=typeof _0x4c7d2b[_0xc6e9('0x2b')]===_0xc6e9('0x2c')&&typeof _0x4c7d2b['limit']===_0xc6e9('0x2c');var _0x3a9c14=_0x497f97['count'];var _0x4787bd=_0x26cbc5?0x0:_0x4c7d2b[_0xc6e9('0x2b')];var _0x3760bf=_0x26cbc5?_0x497f97[_0xc6e9('0x2d')]:_0x4c7d2b[_0xc6e9('0x2b')]+_0x4c7d2b['limit'];var _0x4aef05;if(_0x3760bf>=_0x3a9c14){_0x3760bf=_0x3a9c14;_0x4aef05=0xc8;}else{_0x4aef05=0xce;}_0x2ccead[_0xc6e9('0x29')](_0x4aef05);return _0x2ccead[_0xc6e9('0x2e')](_0xc6e9('0x2f'),_0x4787bd+'-'+_0x3760bf+'/'+_0x3a9c14)[_0xc6e9('0x2a')](_0x497f97);}return null;};}function patchUpdates(_0x5db620){return function(_0x5b94ff){try{jsonpatch['apply'](_0x5b94ff,_0x5db620,!![]);}catch(_0x31669a){return BPromise[_0xc6e9('0x30')](_0x31669a);}return _0x5b94ff['save']();};}function saveUpdates(_0x1b5f3e,_0xac8c94){return function(_0x464c3d){if(_0x464c3d){return _0x464c3d[_0xc6e9('0x31')](_0x1b5f3e)['then'](function(_0x117c40){return _0x117c40;});}return null;};}function removeEntity(_0x38657e,_0x3e8ffb){return function(_0x427814){if(_0x427814){return _0x427814[_0xc6e9('0x32')]()['then'](function(){var _0x34ffcb=_0x427814[_0xc6e9('0x33')]({'plain':!![]});var _0x1fde88=_0xc6e9('0x34');return db[_0xc6e9('0x35')]['destroy']({'where':{'type':_0x1fde88,'resourceId':_0x34ffcb['id']}})[_0xc6e9('0x1f')](function(){return _0x427814;});})[_0xc6e9('0x1f')](function(){_0x38657e[_0xc6e9('0x29')](0xcc)[_0xc6e9('0x28')]();});}};}function handleEntityNotFound(_0x1a00ea,_0x132bb8){return function(_0x76f049){if(!_0x76f049){_0x1a00ea[_0xc6e9('0x27')](0x194);}return _0x76f049;};}function handleError(_0x5a9d3a,_0x5a0c38){_0x5a0c38=_0x5a0c38||0x1f4;return function(_0x3f3d60){logger[_0xc6e9('0x24')](_0x3f3d60['stack']);if(_0x3f3d60[_0xc6e9('0x36')]){delete _0x3f3d60[_0xc6e9('0x36')];}_0x5a9d3a[_0xc6e9('0x29')](_0x5a0c38)[_0xc6e9('0x37')](_0x3f3d60);};}exports[_0xc6e9('0x38')]=function(_0x279eca,_0xde2354){var _0x28afd3={'include':[{'model':db['Pause'],'as':_0xc6e9('0x39')}]},_0x1ca222={},_0x42ee89={'count':0x0,'rows':[]};var _0x4dc3a5=_[_0xc6e9('0x3a')](db[_0xc6e9('0x3b')][_0xc6e9('0x3c')],function(_0x34dd2a){return{'name':_0x34dd2a[_0xc6e9('0x3d')],'type':_0x34dd2a[_0xc6e9('0x3e')][_0xc6e9('0x3f')]};});_0x1ca222[_0xc6e9('0x40')]=_[_0xc6e9('0x3a')](_0x4dc3a5,'name');_0x1ca222[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x279eca[_0xc6e9('0x41')]);_0x1ca222[_0xc6e9('0x43')]=_['intersection'](_0x1ca222[_0xc6e9('0x40')],_0x1ca222[_0xc6e9('0x41')]);_0x28afd3[_0xc6e9('0x44')]=_[_0xc6e9('0x45')](_0x1ca222['model'],qs[_0xc6e9('0x46')](_0x279eca['query']['fields']));_0x28afd3[_0xc6e9('0x44')]=_0x28afd3[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x28afd3['attributes']:_0x1ca222[_0xc6e9('0x40')];if(!_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x48')]('nolimit')){_0x28afd3[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x279eca[_0xc6e9('0x41')]['limit']);_0x28afd3['offset']=qs[_0xc6e9('0x2b')](_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x28afd3['order']=qs[_0xc6e9('0x4a')](_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x28afd3['where']=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x279eca[_0xc6e9('0x41')],_0x1ca222[_0xc6e9('0x43')]),_0x4dc3a5);if(_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x28afd3[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x28afd3['where'],{'$or':_[_0xc6e9('0x3a')](_0x4dc3a5,function(_0x51dcd1){if(_0x51dcd1[_0xc6e9('0x3e')]!==_0xc6e9('0x4f')){var _0x5bcbd4={};_0x5bcbd4[_0x51dcd1[_0xc6e9('0x36')]]={'$like':'%'+_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4c')]+'%'};return _0x5bcbd4;}})});}_0x28afd3=_['merge']({},_0x28afd3,_0x279eca[_0xc6e9('0x50')]);var _0x390f43={'where':_0x28afd3['where']};return db[_0xc6e9('0x3b')][_0xc6e9('0x2d')](_0x390f43)[_0xc6e9('0x1f')](function(_0x85ddf5){_0x42ee89[_0xc6e9('0x2d')]=_0x85ddf5;if(_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x28afd3[_0xc6e9('0x52')]=[{'all':!![]}];}return db[_0xc6e9('0x3b')][_0xc6e9('0x53')](_0x28afd3);})[_0xc6e9('0x1f')](function(_0x389c2d){_0x42ee89['rows']=_0x389c2d;return _0x42ee89;})['then'](respondWithFilteredResult(_0xde2354,_0x28afd3))[_0xc6e9('0x54')](handleError(_0xde2354,null));};exports[_0xc6e9('0x55')]=function(_0x2e364e,_0x2f55d6){var _0x7e49c8={'raw':![],'where':{'id':_0x2e364e['params']['id']},'include':[{'model':db[_0xc6e9('0x56')],'as':'mandatoryDispositionPause'}]},_0x33ed6d={};_0x33ed6d['model']=_['keys'](db[_0xc6e9('0x3b')]['rawAttributes']);_0x33ed6d[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x2e364e[_0xc6e9('0x41')]);_0x33ed6d[_0xc6e9('0x43')]=_['intersection'](_0x33ed6d[_0xc6e9('0x40')],_0x33ed6d[_0xc6e9('0x41')]);_0x7e49c8['attributes']=_['intersection'](_0x33ed6d['model'],qs['fields'](_0x2e364e['query'][_0xc6e9('0x46')]));_0x7e49c8[_0xc6e9('0x44')]=_0x7e49c8[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x7e49c8['attributes']:_0x33ed6d['model'];if(_0x2e364e[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x7e49c8['include']=[{'all':!![]}];}_0x7e49c8=_[_0xc6e9('0x4e')]({},_0x7e49c8,_0x2e364e[_0xc6e9('0x50')]);return db[_0xc6e9('0x3b')][_0xc6e9('0x57')](_0x7e49c8)[_0xc6e9('0x1f')](handleEntityNotFound(_0x2f55d6,null))['then'](respondWithResult(_0x2f55d6,null))['catch'](handleError(_0x2f55d6,null));};exports['create']=function(_0x2796b4,_0x1bf6a4){return db['WhatsappAccount'][_0xc6e9('0x58')](_0x2796b4[_0xc6e9('0x59')],{})[_0xc6e9('0x1f')](function(_0x598d54){var _0x55154d=_0x2796b4['user']['get']({'plain':!![]});if(!_0x55154d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55154d[_0xc6e9('0x5a')]===_0xc6e9('0x5b')){var _0xfcc03=_0x598d54[_0xc6e9('0x33')]({'plain':!![]});var _0x17ccf8='WhatsappAccounts';return db[_0xc6e9('0x5c')][_0xc6e9('0x57')]({'where':{'name':_0x17ccf8,'userProfileId':_0x55154d[_0xc6e9('0x5d')]},'raw':!![]})['then'](function(_0x237809){if(_0x237809&&_0x237809[_0xc6e9('0x5e')]===0x0){return db[_0xc6e9('0x35')][_0xc6e9('0x58')]({'name':_0xfcc03[_0xc6e9('0x36')],'resourceId':_0xfcc03['id'],'type':_0x237809[_0xc6e9('0x36')],'sectionId':_0x237809['id']},{})[_0xc6e9('0x1f')](function(){return _0x598d54;});}else{return _0x598d54;}})['catch'](function(_0xd08f6c){logger[_0xc6e9('0x24')](_0xc6e9('0x5f'),_0xd08f6c);throw _0xd08f6c;});}return _0x598d54;})['then'](respondWithResult(_0x1bf6a4,0xc9))['catch'](handleError(_0x1bf6a4,null));};exports[_0xc6e9('0x31')]=function(_0x30b83c,_0x535308){if(_0x30b83c[_0xc6e9('0x59')]['id']){delete _0x30b83c[_0xc6e9('0x59')]['id'];}return db[_0xc6e9('0x3b')][_0xc6e9('0x57')]({'where':{'id':_0x30b83c['params']['id']},'include':[{'model':db[_0xc6e9('0x56')],'as':'mandatoryDispositionPause'}]})[_0xc6e9('0x1f')](handleEntityNotFound(_0x535308,null))['then'](saveUpdates(_0x30b83c[_0xc6e9('0x59')],null))[_0xc6e9('0x1f')](respondWithResult(_0x535308,null))[_0xc6e9('0x54')](handleError(_0x535308,null));};exports[_0xc6e9('0x32')]=function(_0x5e8810,_0x63113a){return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x5e8810['params']['id']}})['then'](handleEntityNotFound(_0x63113a,null))[_0xc6e9('0x1f')](removeEntity(_0x63113a,null))[_0xc6e9('0x54')](handleError(_0x63113a,null));};exports['describe']=function(_0x4f1a78,_0xedda93){return db[_0xc6e9('0x3b')][_0xc6e9('0x60')]()['then'](respondWithResult(_0xedda93,null))['catch'](handleError(_0xedda93,null));};exports[_0xc6e9('0x61')]=function(_0x475f00,_0x111464,_0xf1f822){if(_0x475f00[_0xc6e9('0x59')]['id']){delete _0x475f00[_0xc6e9('0x59')]['id'];}return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x475f00[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x111464,null))[_0xc6e9('0x1f')](function(_0x4f67f6){if(_0x4f67f6){_0x475f00[_0xc6e9('0x59')]['WhatsappAccountId']=_0x4f67f6['id'];return db[_0xc6e9('0x63')]['create'](_0x475f00['body']);}})[_0xc6e9('0x1f')](respondWithResult(_0x111464,null))['catch'](handleError(_0x111464,null));};exports['getDispositions']=function(_0x2a5c8d,_0x1c30ed,_0x32cbb2){var _0x37fb41={'raw':![],'where':{}};var _0x412580={};var _0x185ba4={'count':0x0,'rows':[]};return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x2a5c8d['params']['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x1c30ed,null))[_0xc6e9('0x1f')](function(_0x1517ab){if(_0x1517ab){_0x412580[_0xc6e9('0x40')]=_['keys'](db[_0xc6e9('0x63')][_0xc6e9('0x3c')]);_0x412580[_0xc6e9('0x41')]=_['keys'](_0x2a5c8d[_0xc6e9('0x41')]);_0x412580[_0xc6e9('0x43')]=_[_0xc6e9('0x45')](_0x412580[_0xc6e9('0x40')],_0x412580[_0xc6e9('0x41')]);_0x37fb41['attributes']=_[_0xc6e9('0x45')](_0x412580[_0xc6e9('0x40')],qs[_0xc6e9('0x46')](_0x2a5c8d['query'][_0xc6e9('0x46')]));_0x37fb41[_0xc6e9('0x44')]=_0x37fb41[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x37fb41[_0xc6e9('0x44')]:_0x412580[_0xc6e9('0x40')];if(!_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x37fb41['limit']=qs[_0xc6e9('0x49')](_0x2a5c8d[_0xc6e9('0x41')]['limit']);_0x37fb41[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x37fb41['order']=qs['sort'](_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x37fb41[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x2a5c8d[_0xc6e9('0x41')],_0x412580[_0xc6e9('0x43')]));_0x37fb41[_0xc6e9('0x4d')][_0xc6e9('0x66')]=_0x1517ab['id'];if(_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x37fb41[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x37fb41[_0xc6e9('0x4d')],{'$or':_[_0xc6e9('0x3a')](_0x37fb41[_0xc6e9('0x44')],function(_0x26615b){var _0x2e7e75={};_0x2e7e75[_0x26615b]={'$like':'%'+_0x2a5c8d['query'][_0xc6e9('0x4c')]+'%'};return _0x2e7e75;})});}_0x37fb41=_[_0xc6e9('0x4e')]({},_0x37fb41,_0x2a5c8d[_0xc6e9('0x50')]);return db[_0xc6e9('0x63')][_0xc6e9('0x2d')]({'where':_0x37fb41[_0xc6e9('0x4d')]})[_0xc6e9('0x1f')](function(_0x19bd28){_0x185ba4['count']=_0x19bd28;if(_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x37fb41['include']=[{'all':!![]}];}return db[_0xc6e9('0x63')][_0xc6e9('0x53')](_0x37fb41);})[_0xc6e9('0x1f')](function(_0x194449){_0x185ba4['rows']=_0x194449;return _0x185ba4;});}})['then'](respondWithFilteredResult(_0x1c30ed,_0x37fb41))[_0xc6e9('0x54')](handleError(_0x1c30ed,null));};exports['removeDispositions']=function(_0x3f77b7,_0x59d52b,_0x1c265f){return db[_0xc6e9('0x3b')][_0xc6e9('0x57')]({'where':{'id':_0x3f77b7['params']['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x59d52b,null))[_0xc6e9('0x1f')](function(_0x42b4c5){if(_0x42b4c5){return _0x42b4c5[_0xc6e9('0x67')](_0x3f77b7[_0xc6e9('0x41')][_0xc6e9('0x68')]);}})[_0xc6e9('0x1f')](respondWithStatusCode(_0x59d52b,null))[_0xc6e9('0x54')](handleError(_0x59d52b,null));};exports[_0xc6e9('0x69')]=function(_0x5e4f72,_0x17e22d,_0x5a2775){if(_0x5e4f72[_0xc6e9('0x59')]['id']){delete _0x5e4f72[_0xc6e9('0x59')]['id'];}return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x5e4f72[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x17e22d,null))['then'](function(_0x33c8ae){if(_0x33c8ae){_0x5e4f72[_0xc6e9('0x59')][_0xc6e9('0x66')]=_0x33c8ae['id'];return db[_0xc6e9('0x6a')]['create'](_0x5e4f72[_0xc6e9('0x59')]);}})[_0xc6e9('0x1f')](respondWithResult(_0x17e22d,null))[_0xc6e9('0x54')](handleError(_0x17e22d,null));};exports['getAnswers']=function(_0x154348,_0x18c222,_0x3d9271){var _0x183dd0={'raw':![],'where':{}};var _0x28919f={};var _0x54714c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc6e9('0x64')]({'where':{'id':_0x154348[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x18c222,null))[_0xc6e9('0x1f')](function(_0x377cdd){if(_0x377cdd){_0x28919f[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db[_0xc6e9('0x6a')][_0xc6e9('0x3c')]);_0x28919f[_0xc6e9('0x41')]=_['keys'](_0x154348[_0xc6e9('0x41')]);_0x28919f[_0xc6e9('0x43')]=_[_0xc6e9('0x45')](_0x28919f[_0xc6e9('0x40')],_0x28919f[_0xc6e9('0x41')]);_0x183dd0[_0xc6e9('0x44')]=_['intersection'](_0x28919f['model'],qs[_0xc6e9('0x46')](_0x154348['query'][_0xc6e9('0x46')]));_0x183dd0[_0xc6e9('0x44')]=_0x183dd0[_0xc6e9('0x44')]['length']?_0x183dd0[_0xc6e9('0x44')]:_0x28919f[_0xc6e9('0x40')];if(!_0x154348[_0xc6e9('0x41')]['hasOwnProperty'](_0xc6e9('0x65'))){_0x183dd0[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x183dd0[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x183dd0['order']=qs['sort'](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x183dd0[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x154348[_0xc6e9('0x41')],_0x28919f[_0xc6e9('0x43')]));_0x183dd0[_0xc6e9('0x4d')]['WhatsappAccountId']=_0x377cdd['id'];if(_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x183dd0[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x183dd0[_0xc6e9('0x4d')],{'$or':_['map'](_0x183dd0[_0xc6e9('0x44')],function(_0xcf1d7b){var _0x59fef0={};_0x59fef0[_0xcf1d7b]={'$like':'%'+_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4c')]+'%'};return _0x59fef0;})});}_0x183dd0=_[_0xc6e9('0x4e')]({},_0x183dd0,_0x154348[_0xc6e9('0x50')]);return db[_0xc6e9('0x6a')][_0xc6e9('0x2d')]({'where':_0x183dd0['where']})['then'](function(_0x3bb84f){_0x54714c['count']=_0x3bb84f;if(_0x154348[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x183dd0[_0xc6e9('0x52')]=[{'all':!![]}];}return db[_0xc6e9('0x6a')][_0xc6e9('0x53')](_0x183dd0);})['then'](function(_0x5b266b){_0x54714c[_0xc6e9('0x6b')]=_0x5b266b;return _0x54714c;});}})[_0xc6e9('0x1f')](respondWithFilteredResult(_0x18c222,_0x183dd0))['catch'](handleError(_0x18c222,null));};exports['removeAnswers']=function(_0x43fa4b,_0x321b62,_0x5a84dd){return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x43fa4b[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x321b62,null))['then'](function(_0x4edbaf){if(_0x4edbaf){return _0x4edbaf['removeAnswers'](_0x43fa4b[_0xc6e9('0x41')][_0xc6e9('0x68')]);}})[_0xc6e9('0x1f')](respondWithStatusCode(_0x321b62,null))[_0xc6e9('0x54')](handleError(_0x321b62,null));};exports[_0xc6e9('0x6c')]=function(_0x551df1,_0x15bcf2,_0x3b76c1){return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x551df1[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x15bcf2,null))[_0xc6e9('0x1f')](function(_0x54a47f){if(_0x54a47f){return _0x54a47f[_0xc6e9('0x6c')](_0x551df1['body'][_0xc6e9('0x68')],_[_0xc6e9('0x6d')](_0x551df1[_0xc6e9('0x59')],[_0xc6e9('0x68'),'id'])||{})['spread'](function(_0x420fa1){for(var _0x24fc91=0x0;_0x24fc91<_0x551df1[_0xc6e9('0x59')][_0xc6e9('0x68')][_0xc6e9('0x47')];_0x24fc91+=0x1){socket[_0xc6e9('0x6e')]('userWhatsappAccount:save',{'UserId':Number(_0x551df1[_0xc6e9('0x59')]['ids'][_0x24fc91]),'WhatsappAccountId':Number(_0x551df1[_0xc6e9('0x62')]['id'])});}return _0x420fa1;});}})['then'](respondWithResult(_0x15bcf2,null))[_0xc6e9('0x54')](handleError(_0x15bcf2,null));};exports[_0xc6e9('0x6f')]=function(_0x1029de,_0x14a557,_0x2d6be0){return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x1029de[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x14a557,null))['then'](function(_0x291c15){if(_0x291c15){return _0x291c15[_0xc6e9('0x6f')](_0x1029de[_0xc6e9('0x41')]['ids'])[_0xc6e9('0x1f')](function(){if(_[_0xc6e9('0x70')](_0x1029de['query'][_0xc6e9('0x68')])){for(var _0x125be1=0x0;_0x125be1<_0x1029de[_0xc6e9('0x41')][_0xc6e9('0x68')][_0xc6e9('0x47')];_0x125be1+=0x1){socket[_0xc6e9('0x6e')](_0xc6e9('0x71'),{'UserId':Number(_0x1029de[_0xc6e9('0x41')][_0xc6e9('0x68')][_0x125be1]),'WhatsappAccountId':Number(_0x1029de[_0xc6e9('0x62')]['id'])});}}else{socket['emit'](_0xc6e9('0x71'),{'UserId':Number(_0x1029de['query'][_0xc6e9('0x68')]),'WhatsappAccountId':Number(_0x1029de[_0xc6e9('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x14a557,null))[_0xc6e9('0x54')](handleError(_0x14a557,null));};exports[_0xc6e9('0x72')]=function(_0xdbb2bf,_0x462856,_0x409a21){var _0x4ba435={};var _0x35f560={};var _0x8a1abf;var _0x44abc5;return db[_0xc6e9('0x3b')]['findOne']({'where':{'id':_0xdbb2bf[_0xc6e9('0x62')]['id']}})['then'](handleEntityNotFound(_0x462856,null))['then'](function(_0x4c01bf){if(_0x4c01bf){_0x8a1abf=_0x4c01bf;_0x35f560[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db['User'][_0xc6e9('0x3c')]);_0x35f560[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0xdbb2bf[_0xc6e9('0x41')]);_0x35f560[_0xc6e9('0x43')]=_['intersection'](_0x35f560[_0xc6e9('0x40')],_0x35f560['query']);_0x4ba435[_0xc6e9('0x44')]=_[_0xc6e9('0x45')](_0x35f560[_0xc6e9('0x40')],qs[_0xc6e9('0x46')](_0xdbb2bf['query'][_0xc6e9('0x46')]));_0x4ba435['attributes']=_0x4ba435[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x4ba435[_0xc6e9('0x44')]:_0x35f560[_0xc6e9('0x40')];_0x4ba435[_0xc6e9('0x73')]=qs[_0xc6e9('0x4a')](_0xdbb2bf[_0xc6e9('0x41')]['sort']);_0x4ba435[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_['pick'](_0xdbb2bf[_0xc6e9('0x41')],_0x35f560[_0xc6e9('0x43')]));if(_0xdbb2bf[_0xc6e9('0x41')]['filter']){_0x4ba435[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x4ba435[_0xc6e9('0x4d')],{'$or':_['map'](_0x4ba435[_0xc6e9('0x44')],function(_0x4d6302){var _0x2dc00e={};_0x2dc00e[_0x4d6302]={'$like':'%'+_0xdbb2bf[_0xc6e9('0x41')]['filter']+'%'};return _0x2dc00e;})});}_0x4ba435=_[_0xc6e9('0x4e')]({},_0x4ba435,_0xdbb2bf[_0xc6e9('0x50')]);return _0x8a1abf[_0xc6e9('0x72')](_0x4ba435);}})[_0xc6e9('0x1f')](function(_0x57219d){if(_0x57219d){_0x44abc5=_0x57219d[_0xc6e9('0x47')];if(!_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x4ba435[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x4ba435['offset']=qs[_0xc6e9('0x2b')](_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}return _0x8a1abf[_0xc6e9('0x72')](_0x4ba435);}})[_0xc6e9('0x1f')](function(_0x2629b1){if(_0x2629b1){return _0x2629b1?{'count':_0x44abc5,'rows':_0x2629b1}:null;}})[_0xc6e9('0x1f')](respondWithResult(_0x462856,null))['catch'](handleError(_0x462856,null));};exports[_0xc6e9('0x74')]=function(_0x59818f,_0x35c91a){var _0x1cf773=_0x59818f[_0xc6e9('0x62')]['id'];var _0x44acf9=_0x59818f['body'];var _0x13d0ea=0xc8;var _0x45d786=null;return db[_0xc6e9('0x75')][_0xc6e9('0x76')]({'isolationLevel':db[_0xc6e9('0x75')][_0xc6e9('0x77')][_0xc6e9('0x78')][_0xc6e9('0x79')]},function(_0x125e4c){return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x1cf773},'transaction':_0x125e4c})['then'](function(_0x1a96df){if(_0x1a96df){return db['WhatsappApplication'][_0xc6e9('0x32')]({'where':{'WhatsappAccountId':_0x1cf773},'transaction':_0x125e4c})[_0xc6e9('0x1f')](function(){var _0x197d15=_['map'](_0x44acf9,function(_0x1d113f){_0x1d113f[_0xc6e9('0x66')]=_0x1cf773;return _0x1d113f;});return db['WhatsappApplication'][_0xc6e9('0x7a')](_0x197d15,{'transaction':_0x125e4c});});}else{_0x13d0ea=0x194;_0x45d786=[];}});})['then'](function(){if(_0x13d0ea!==0x194){return db[_0xc6e9('0x7b')][_0xc6e9('0x7c')]({'where':{'WhatsappAccountId':_0x1cf773},'order':_0xc6e9('0x7d')})[_0xc6e9('0x1f')](function(_0x10e46c){_0x45d786=_0x10e46c;});}})[_0xc6e9('0x54')](function(_0x4d2adb){_0x13d0ea=0x1f4;logger[_0xc6e9('0x24')](_0x4d2adb[_0xc6e9('0x7e')]);if(_0x4d2adb[_0xc6e9('0x36')]){delete _0x4d2adb['name'];}_0x45d786=_0x4d2adb;})[_0xc6e9('0x7f')](function(){if(_0x45d786===null){_0x35c91a[_0xc6e9('0x27')](_0x13d0ea);}else{if(_0x13d0ea===0x1f4){_0x35c91a['status'](_0x13d0ea)['send'](_0x45d786);}else{_0x35c91a[_0xc6e9('0x29')](_0x13d0ea)['json'](_0x45d786);}}});};exports[_0xc6e9('0x80')]=function(_0x29013a,_0x212fab,_0xa3154f){var _0x13eab1={};var _0x4ce093={};var _0x3f9c35;var _0x517457;return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x29013a[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x212fab,null))[_0xc6e9('0x1f')](function(_0x1c091c){if(_0x1c091c){_0x3f9c35=_0x1c091c;_0x4ce093[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db[_0xc6e9('0x7b')][_0xc6e9('0x3c')]);_0x4ce093[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x29013a[_0xc6e9('0x41')]);_0x4ce093[_0xc6e9('0x43')]=_['intersection'](_0x4ce093[_0xc6e9('0x40')],_0x4ce093['query']);_0x13eab1['attributes']=_['intersection'](_0x4ce093['model'],qs[_0xc6e9('0x46')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x46')]));_0x13eab1['attributes']=_0x13eab1[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x13eab1[_0xc6e9('0x44')]:_0x4ce093['model'];_0x13eab1['order']=qs[_0xc6e9('0x4a')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x13eab1[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_['pick'](_0x29013a[_0xc6e9('0x41')],_0x4ce093['filters']));if(_0x29013a[_0xc6e9('0x41')]['filter']){_0x13eab1['where']=_[_0xc6e9('0x4e')](_0x13eab1[_0xc6e9('0x4d')],{'$or':_[_0xc6e9('0x3a')](_0x13eab1[_0xc6e9('0x44')],function(_0x54a8ce){var _0x4f6d5b={};_0x4f6d5b[_0x54a8ce]={'$like':'%'+_0x29013a[_0xc6e9('0x41')]['filter']+'%'};return _0x4f6d5b;})});}_0x13eab1=_[_0xc6e9('0x4e')]({},_0x13eab1,_0x29013a[_0xc6e9('0x50')]);return _0x3f9c35[_0xc6e9('0x80')](_0x13eab1);}})[_0xc6e9('0x1f')](function(_0x221456){if(_0x221456){_0x517457=_0x221456[_0xc6e9('0x47')];if(!_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x13eab1[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x13eab1[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}return _0x3f9c35[_0xc6e9('0x80')](_0x13eab1);}})[_0xc6e9('0x1f')](function(_0x5437b7){if(_0x5437b7){return _0x5437b7?{'count':_0x517457,'rows':_0x5437b7}:null;}})['then'](respondWithResult(_0x212fab,null))['catch'](handleError(_0x212fab,null));};exports[_0xc6e9('0x81')]=function(_0x1b6892,_0xcc44aa,_0x437e09){var _0x3e23b5={'channel':_0xc6e9('0x82')};var _0x446ff2=[];var _0x3a05a6=[];var _0x209164={};return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x1b6892[_0xc6e9('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))[_0xc6e9('0x1f')](function(_0x5494e1){_0x3e23b5[_0xc6e9('0x83')]=_0x5494e1;if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]===_0xc6e9('0x84')&&_0x1b6892[_0xc6e9('0x59')]['statuses']){if(_0x1b6892['body'][_0xc6e9('0x85')][_0xc6e9('0x47')]===0x0)return;if(_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0][_0xc6e9('0x86')]!==_0xc6e9('0x87'))return;return db[_0xc6e9('0x88')][_0xc6e9('0x31')]({'read':!![],'readAt':_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0][_0xc6e9('0x89')]},{'where':{'messageId':_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0]['message_id']},'individualHooks':!![]})[_0xc6e9('0x1f')](function(_0x217b57){return _0xcc44aa['status'](0xc8)[_0xc6e9('0x2a')](_0x217b57);});}_0x3e23b5['applications']=_[_0xc6e9('0x8a')](_0x5494e1[_0xc6e9('0x8b')],['priority'],[_0xc6e9('0x8c')]);if(_0x3e23b5['account'][_0xc6e9('0x8b')]){delete _0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x8b')];}return db[_0xc6e9('0x8d')]['describe']()[_0xc6e9('0x1f')](function(_0x389a96){if(!_0x389a96){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))](_0xc6e9('0x90'));}_0x446ff2=_['difference'](_[_0xc6e9('0x42')](_0x389a96),['createdAt',_0xc6e9('0x91')]);_0x3a05a6=_[_0xc6e9('0x92')](_[_0xc6e9('0x42')](_0x389a96),[_0xc6e9('0x93'),_0xc6e9('0x91'),'CompanyId',_0xc6e9('0x94')]);_0x3e23b5[_0xc6e9('0x59')]={'mapKey':_0xc6e9('0x95')};if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]==='twilio'){_0x3e23b5[_0xc6e9('0x59')]['from']=_0x1b6892['body'][_0xc6e9('0x96')][_0xc6e9('0x97')](_0xc6e9('0x98'),'');_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x99')];_0x3e23b5[_0xc6e9('0x59')]['messageId']=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x9a')];}if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5['account'][_0xc6e9('0x3e')]==='sinch'){_0x3e23b5['body'][_0xc6e9('0x9b')]=_0x1b6892[_0xc6e9('0x59')]['notifications'][0x0][_0xc6e9('0x9b')];_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]=_0x1b6892['body']['notifications'][0x0][_0xc6e9('0x25')][_0xc6e9('0x59')];_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9c')]=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x9d')][0x0][_0xc6e9('0x9e')];}if(_0x3e23b5[_0xc6e9('0x59')]['id']){delete _0x3e23b5[_0xc6e9('0x59')]['id'];}if(_[_0xc6e9('0x9f')](_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')])){throw new db['Sequelize']['ValidationError'](_0xc6e9('0xa0'));}if(_['isNil'](_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')])||_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]===''){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc6e9('0x9f')](_0x3e23b5[_0xc6e9('0x59')]['mapKey'])){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))](_0xc6e9('0xa1')+_0x3a05a6);}if(!_[_0xc6e9('0xa2')](_0x3a05a6,_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0xa3')])){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a05a6);}_0x209164[_0x3e23b5['body']['mapKey']]=_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')];return db['CmList'][_0xc6e9('0x57')]({'where':{'id':_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x94')]},'include':[{'model':db['CmContact'],'as':_0xc6e9('0xa4'),'where':_0x209164,'limit':0x1,'order':[[_0xc6e9('0x91'),_0xc6e9('0xa5')]]}]});})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))['then'](function(_0x58e778){if(_0x58e778){_0x3e23b5[_0xc6e9('0xa6')]=_[_0xc6e9('0x6d')](_0x58e778,[_0xc6e9('0xa4')]);if(_0x58e778[_0xc6e9('0xa4')]['length']){return _0x58e778['Contacts'][0x0];}var _0x1a5175=_[_0xc6e9('0x18')](_0x3e23b5[_0xc6e9('0x59')],{'firstName':_0x3e23b5['body'][_0xc6e9('0x9b')],'ListId':_0x58e778['id']});_0x1a5175[_0x3e23b5['body'][_0xc6e9('0xa3')]]=_0x3e23b5['body'][_0xc6e9('0x9b')];return db[_0xc6e9('0x8d')][_0xc6e9('0x58')](_0x1a5175,{'fields':_0x446ff2,'raw':!![]});}})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))[_0xc6e9('0x1f')](function(_0x11c84f){if(_0x11c84f){_0x3e23b5[_0xc6e9('0xa7')]=_0x11c84f;var _0x111420={'ContactId':_0x11c84f['id'],'phone':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')],'WhatsappAccountId':_0x1b6892['params']['id']};var _0x39b1da={'ContactId':_0x11c84f['id'],'WhatsappAccountId':_0x1b6892[_0xc6e9('0x62')]['id'],'closed':![]};return db[_0xc6e9('0xa8')][_0xc6e9('0x57')]({'where':_0x39b1da})[_0xc6e9('0x1f')](function(_0x4797c5){if(_0x4797c5){return[_0x4797c5,![]];}return db[_0xc6e9('0xa8')][_0xc6e9('0x58')](_0x111420)[_0xc6e9('0x1f')](function(_0x3a891a){return[_0x3a891a,!![]];});});}})[_0xc6e9('0xa9')](function(_0x1220a5,_0x265ffe){_0x3e23b5[_0xc6e9('0xaa')]=_0x1220a5['get']({'plain':!![]});_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xab')]=![];if(_0x265ffe){if(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xac')]){_0x3e23b5['applications'][_0xc6e9('0xad')]({'id':0x0,'priority':_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0x47')]+0x1,'app':_0xc6e9('0xaf'),'appdata':_0xc6e9('0xb0'),'interval':_0xc6e9('0xb1')});}_0x3e23b5[_0xc6e9('0xaa')]['created']=!![];}return db[_0xc6e9('0x88')][_0xc6e9('0x58')]({'phone':_0x3e23b5[_0xc6e9('0x59')]['from'],'messageId':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9c')],'body':_0x3e23b5['body'][_0xc6e9('0x59')],'WhatsappAccountId':_0x1b6892[_0xc6e9('0x62')]['id'],'WhatsappInteractionId':_0x1220a5['id'],'direction':'in','ContactId':_0x1220a5[_0xc6e9('0xb2')],'AttachmentId':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0xb3')]});})['then'](function(_0x4fd31a){_0x3e23b5[_0xc6e9('0x25')]=_0x4fd31a;if(!_0x3e23b5[_0xc6e9('0xaa')]['UserId'])return;return db[_0xc6e9('0xb4')][_0xc6e9('0x57')]({'attributes':['id',_0xc6e9('0x36')],'where':{'id':_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb5')]}});})['then'](function(_0x4d5a27){if(_0x4d5a27){_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0xb6')]({'id':0x0,'priority':0x0,'app':_0xc6e9('0xb7'),'appdata':_0x4d5a27[_0xc6e9('0x36')]+','+(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xb8')]||0xa),'interval':_0xc6e9('0xb1')});}if(!_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb9')])return;return db[_0xc6e9('0xba')][_0xc6e9('0x57')]({'attributes':['id',_0xc6e9('0x36')],'where':{'id':_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb9')]}});})['then'](function(_0x12e34d){if(_0x12e34d){_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12e34d[_0xc6e9('0x36')]+','+(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xbb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc6e9('0xbc'),_0xc6e9('0xbd'),_0x3e23b5);})[_0xc6e9('0x1f')](function(_0x4da538){if(_0x4da538){var _0x3579b4=0xc8;var _0x3b6ece=_0xc6e9('0xbe');logger[_0xc6e9('0x20')](_0xc6e9('0x23'),_0x3b6ece,_0x3579b4,_0xc6e9('0xbf'));logger['debug'](_0xc6e9('0xc0'),_0x3b6ece,_0x3579b4,_0xc6e9('0xbf'),JSON['stringify'](_0x4da538));if(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]===_0xc6e9('0xc1')){return _0xcc44aa[_0xc6e9('0x29')](_0x3579b4)[_0xc6e9('0x2e')](_0xc6e9('0xc2'),_0xc6e9('0xc3'))[_0xc6e9('0x37')](_0xc6e9('0xc4'));}else{return _0xcc44aa[_0xc6e9('0x29')](_0x3579b4)[_0xc6e9('0x2a')](_0x4da538);}}});})[_0xc6e9('0x54')](handleError(_0xcc44aa,null));};exports[_0xc6e9('0x37')]=function(_0x14a409,_0x201579,_0x36ccea){var _0x4f1283,_0x4d30bd,_0x5600d2;if(_[_0xc6e9('0x9f')](_0x14a409[_0xc6e9('0x59')]['body'])||_0x14a409[_0xc6e9('0x59')][_0xc6e9('0x59')]===''){throw new db['Sequelize'][(_0xc6e9('0x8f'))](_0xc6e9('0xc5'));}if(_[_0xc6e9('0x9f')](_0x14a409[_0xc6e9('0x59')]['to'])){throw new db['Sequelize'][(_0xc6e9('0x8f'))](_0xc6e9('0xc6'));}_0x4f1283=_0x14a409['body']['to'];return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x14a409[_0xc6e9('0x62')]['id']},'include':[{'model':db[_0xc6e9('0xc7')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc6e9('0xa4'),'where':{'mobile':_0x4f1283},'limit':0x1,'order':[[_0xc6e9('0x91'),_0xc6e9('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x201579,null))[_0xc6e9('0x1f')](function(_0x2e6ba8){if(_0x2e6ba8&&_0x2e6ba8['List']){_0x4d30bd=_0x2e6ba8['get']({'plain':!![]});if(_0x4d30bd[_0xc6e9('0xc8')]&&_0x4d30bd[_0xc6e9('0xc8')][_0xc6e9('0xa4')]['length']){return _0x4d30bd['List'][_0xc6e9('0xa4')][0x0];}return db['CmContact'][_0xc6e9('0x58')](_[_0xc6e9('0x18')](_0x14a409[_0xc6e9('0x59')],{'firstName':_0x4f1283,'mobile':_0x4f1283,'phone':_0x4f1283,'ListId':_0x4d30bd['ListId']}));}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x201579,null))[_0xc6e9('0x1f')](function(_0x5d462e){if(_0x5d462e){_0x5600d2=_0x5d462e;return db[_0xc6e9('0xa8')][_0xc6e9('0x57')]({'where':{'ContactId':_0x5600d2['id'],'closed':![],'WhatsappAccountId':_0x4d30bd['id']}})[_0xc6e9('0x1f')](function(_0x10bf51){if(_0x10bf51){return[_0x10bf51,![]];}return db[_0xc6e9('0xa8')]['create']({'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id'],'WhatsappAccountId':_0x4d30bd['id'],'phone':_0x4f1283,'firstMsgDirection':'out','Messages':[_['merge'](_0x14a409[_0xc6e9('0x59')],{'read':![],'body':_0x14a409[_0xc6e9('0x59')]['body'],'phone':_0x4f1283,'WhatsappAccountId':_0x4d30bd['id'],'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xc6e9('0xc9')}]})['then'](function(_0x184c9b){return[_0x184c9b,!![]];});});}})[_0xc6e9('0xa9')](function(_0x2b8490,_0x277149){if(_0x277149){return _0x2b8490;}return db[_0xc6e9('0x88')]['create'](_[_0xc6e9('0x4e')](_0x14a409[_0xc6e9('0x59')],{'read':![],'body':_0x14a409[_0xc6e9('0x59')][_0xc6e9('0x59')],'phone':_0x4f1283,'WhatsappAccountId':_0x4d30bd['id'],'WhatsappInteractionId':_0x2b8490['id'],'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id']}))[_0xc6e9('0x1f')](function(_0x17b6e7){_0x2b8490[_0xc6e9('0xca')][_0xc6e9('0xc9')]=[];_0x2b8490[_0xc6e9('0xca')][_0xc6e9('0xc9')]['push'](_0x17b6e7[_0xc6e9('0xca')]);return _0x2b8490;});})['then'](respondWithResult(_0x201579,null))[_0xc6e9('0x54')](handleError(_0x201579,null));}; \ No newline at end of file +var _0x5934=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','WhatsappAccount','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','findOne','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','update','timestamp','message_id','orderBy','asc','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','mapKey','contact','WhatsappInteraction','created','autoclose','applications','unmanaged','*,*,*,*','interaction','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','stringify','Content-Type','text/xml','\x0a','send','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length'];(function(_0x1521b5,_0x51ec2d){var _0x152e4b=function(_0x36f3cc){while(--_0x36f3cc){_0x1521b5['push'](_0x1521b5['shift']());}};_0x152e4b(++_0x51ec2d);}(_0x5934,0x84));var _0x4593=function(_0x1dc2e2,_0x4948ef){_0x1dc2e2=_0x1dc2e2-0x0;var _0xdca95b=_0x5934[_0x1dc2e2];return _0xdca95b;};'use strict';var emlformat=require(_0x4593('0x0'));var rimraf=require(_0x4593('0x1'));var zipdir=require(_0x4593('0x2'));var jsonpatch=require(_0x4593('0x3'));var rp=require(_0x4593('0x4'));var moment=require(_0x4593('0x5'));var BPromise=require(_0x4593('0x6'));var Mustache=require('mustache');var util=require(_0x4593('0x7'));var path=require(_0x4593('0x8'));var sox=require(_0x4593('0x9'));var csv=require(_0x4593('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4593('0xb'));var jsforce=require(_0x4593('0xc'));var deskjs=require(_0x4593('0xd'));var toCsv=require(_0x4593('0xa'));var querystring=require(_0x4593('0xe'));var Papa=require('papaparse');var Redis=require(_0x4593('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4593('0x10'));var as=require(_0x4593('0x11'));var hardwareService=require(_0x4593('0x12'));var logger=require('../../config/logger')(_0x4593('0x13'));var utils=require('../../config/utils');var config=require(_0x4593('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4593('0x15'))['db'];config[_0x4593('0x16')]=_[_0x4593('0x17')](config[_0x4593('0x16')],{'host':_0x4593('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4593('0x19'))[_0x4593('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4593('0x1b')][_0x4593('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2e773d,_0x294c1,_0xd0553c,_0x51a264){return new BPromise(function(_0x412e56,_0xf7b735){var _0x5c4b10=_0x51a264||client;return _0x5c4b10[_0x4593('0x1d')](_0x2e773d,_0xd0553c)[_0x4593('0x1e')](function(_0x538e4a){logger[_0x4593('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x294c1,_0x4593('0x20'));logger['debug'](_0x4593('0x21'),_0x294c1,_0x4593('0x20'),JSON['stringify'](_0x538e4a));if(_0x538e4a['error']){if(_0x538e4a[_0x4593('0x22')]['code']===0x1f4){logger[_0x4593('0x22')](_0x4593('0x23'),_0x294c1,_0x538e4a[_0x4593('0x22')][_0x4593('0x24')]);return _0xf7b735(_0x538e4a[_0x4593('0x22')][_0x4593('0x24')]);}logger['error'](_0x4593('0x23'),_0x294c1,_0x538e4a['error']['message']);return _0x412e56(_0x538e4a[_0x4593('0x22')]['message']);}else{logger[_0x4593('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x294c1,_0x4593('0x20'));_0x412e56(_0x538e4a[_0x4593('0x25')][_0x4593('0x24')]);}})['catch'](function(_0x5f43de){logger[_0x4593('0x22')](_0x4593('0x23'),_0x294c1,_0x5f43de);_0xf7b735(_0x5f43de);});});}function respondWithStatusCode(_0x4458ae,_0x5a078a){_0x5a078a=_0x5a078a||0xcc;return function(_0x551aec){if(_0x551aec){return _0x4458ae[_0x4593('0x26')](_0x5a078a);}return _0x4458ae['status'](_0x5a078a)['end']();};}function respondWithResult(_0x1f12cf,_0x5cc52e){_0x5cc52e=_0x5cc52e||0xc8;return function(_0xdebb23){if(_0xdebb23){return _0x1f12cf[_0x4593('0x27')](_0x5cc52e)[_0x4593('0x28')](_0xdebb23);}};}function respondWithFilteredResult(_0x5559f9,_0x151691){return function(_0x1c469b){if(_0x1c469b){var _0x2bf78d=typeof _0x151691['offset']===_0x4593('0x29')&&typeof _0x151691[_0x4593('0x2a')]===_0x4593('0x29');var _0x3d1dda=_0x1c469b['count'];var _0x45ddb7=_0x2bf78d?0x0:_0x151691[_0x4593('0x2b')];var _0x42f96d=_0x2bf78d?_0x1c469b[_0x4593('0x2c')]:_0x151691[_0x4593('0x2b')]+_0x151691[_0x4593('0x2a')];var _0x3916ad;if(_0x42f96d>=_0x3d1dda){_0x42f96d=_0x3d1dda;_0x3916ad=0xc8;}else{_0x3916ad=0xce;}_0x5559f9[_0x4593('0x27')](_0x3916ad);return _0x5559f9[_0x4593('0x2d')](_0x4593('0x2e'),_0x45ddb7+'-'+_0x42f96d+'/'+_0x3d1dda)[_0x4593('0x28')](_0x1c469b);}return null;};}function patchUpdates(_0x55bbef){return function(_0x12d60d){try{jsonpatch[_0x4593('0x2f')](_0x12d60d,_0x55bbef,!![]);}catch(_0x1ad323){return BPromise[_0x4593('0x30')](_0x1ad323);}return _0x12d60d['save']();};}function saveUpdates(_0xb5c97,_0x3355b3){return function(_0x498689){if(_0x498689){return _0x498689['update'](_0xb5c97)[_0x4593('0x1e')](function(_0x2fc4a3){return _0x2fc4a3;});}return null;};}function removeEntity(_0x27aee5,_0x58e672){return function(_0x7097e4){if(_0x7097e4){return _0x7097e4[_0x4593('0x31')]()['then'](function(){var _0x155c22=_0x7097e4[_0x4593('0x32')]({'plain':!![]});var _0x579cce=_0x4593('0x33');return db[_0x4593('0x34')][_0x4593('0x31')]({'where':{'type':_0x579cce,'resourceId':_0x155c22['id']}})[_0x4593('0x1e')](function(){return _0x7097e4;});})['then'](function(){_0x27aee5[_0x4593('0x27')](0xcc)[_0x4593('0x35')]();});}};}function handleEntityNotFound(_0x1ba353,_0x1b3ae9){return function(_0x194aaf){if(!_0x194aaf){_0x1ba353[_0x4593('0x26')](0x194);}return _0x194aaf;};}function handleError(_0x23bbac,_0x409ca5){_0x409ca5=_0x409ca5||0x1f4;return function(_0x1fe564){logger['error'](_0x1fe564[_0x4593('0x36')]);if(_0x1fe564[_0x4593('0x37')]){delete _0x1fe564[_0x4593('0x37')];}_0x23bbac[_0x4593('0x27')](_0x409ca5)['send'](_0x1fe564);};}exports[_0x4593('0x38')]=function(_0x1c9bfa,_0x1015b4){var _0x40aa1e={'include':[{'model':db[_0x4593('0x39')],'as':_0x4593('0x3a')}]},_0x48ace0={},_0x18abf3={'count':0x0,'rows':[]};var _0x258e70=_['map'](db['WhatsappAccount']['rawAttributes'],function(_0x4daa44){return{'name':_0x4daa44[_0x4593('0x3b')],'type':_0x4daa44[_0x4593('0x3c')][_0x4593('0x3d')]};});_0x48ace0[_0x4593('0x3e')]=_[_0x4593('0x3f')](_0x258e70,_0x4593('0x37'));_0x48ace0['query']=_[_0x4593('0x40')](_0x1c9bfa[_0x4593('0x41')]);_0x48ace0['filters']=_[_0x4593('0x42')](_0x48ace0[_0x4593('0x3e')],_0x48ace0['query']);_0x40aa1e['attributes']=_['intersection'](_0x48ace0['model'],qs[_0x4593('0x43')](_0x1c9bfa[_0x4593('0x41')][_0x4593('0x43')]));_0x40aa1e[_0x4593('0x44')]=_0x40aa1e[_0x4593('0x44')][_0x4593('0x45')]?_0x40aa1e['attributes']:_0x48ace0['model'];if(!_0x1c9bfa['query'][_0x4593('0x46')](_0x4593('0x47'))){_0x40aa1e['limit']=qs[_0x4593('0x2a')](_0x1c9bfa['query'][_0x4593('0x2a')]);_0x40aa1e[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x1c9bfa[_0x4593('0x41')]['offset']);}_0x40aa1e[_0x4593('0x48')]=qs[_0x4593('0x49')](_0x1c9bfa['query'][_0x4593('0x49')]);_0x40aa1e[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x1c9bfa[_0x4593('0x41')],_0x48ace0[_0x4593('0x4b')]),_0x258e70);if(_0x1c9bfa['query'][_0x4593('0x4d')]){_0x40aa1e[_0x4593('0x4a')]=_['merge'](_0x40aa1e[_0x4593('0x4a')],{'$or':_[_0x4593('0x3f')](_0x258e70,function(_0x3284dc){if(_0x3284dc[_0x4593('0x3c')]!=='VIRTUAL'){var _0x5a4672={};_0x5a4672[_0x3284dc[_0x4593('0x37')]]={'$like':'%'+_0x1c9bfa[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0x5a4672;}})});}_0x40aa1e=_['merge']({},_0x40aa1e,_0x1c9bfa[_0x4593('0x4e')]);var _0xc0b91a={'where':_0x40aa1e[_0x4593('0x4a')]};return db['WhatsappAccount']['count'](_0xc0b91a)[_0x4593('0x1e')](function(_0x260c54){_0x18abf3[_0x4593('0x2c')]=_0x260c54;if(_0x1c9bfa[_0x4593('0x41')][_0x4593('0x4f')]){_0x40aa1e[_0x4593('0x50')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x4593('0x51')](_0x40aa1e);})[_0x4593('0x1e')](function(_0x3974d9){_0x18abf3[_0x4593('0x52')]=_0x3974d9;return _0x18abf3;})[_0x4593('0x1e')](respondWithFilteredResult(_0x1015b4,_0x40aa1e))[_0x4593('0x53')](handleError(_0x1015b4,null));};exports[_0x4593('0x54')]=function(_0xdd3023,_0x4a0c46){var _0x5b616b={'raw':![],'where':{'id':_0xdd3023[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x39')],'as':'mandatoryDispositionPause'}]},_0x450be0={};_0x450be0['model']=_['keys'](db['WhatsappAccount'][_0x4593('0x56')]);_0x450be0[_0x4593('0x41')]=_[_0x4593('0x40')](_0xdd3023[_0x4593('0x41')]);_0x450be0[_0x4593('0x4b')]=_[_0x4593('0x42')](_0x450be0[_0x4593('0x3e')],_0x450be0[_0x4593('0x41')]);_0x5b616b[_0x4593('0x44')]=_[_0x4593('0x42')](_0x450be0['model'],qs[_0x4593('0x43')](_0xdd3023[_0x4593('0x41')]['fields']));_0x5b616b['attributes']=_0x5b616b[_0x4593('0x44')][_0x4593('0x45')]?_0x5b616b[_0x4593('0x44')]:_0x450be0[_0x4593('0x3e')];if(_0xdd3023[_0x4593('0x41')][_0x4593('0x4f')]){_0x5b616b['include']=[{'all':!![]}];}_0x5b616b=_[_0x4593('0x57')]({},_0x5b616b,_0xdd3023[_0x4593('0x4e')]);return db['WhatsappAccount'][_0x4593('0x58')](_0x5b616b)[_0x4593('0x1e')](handleEntityNotFound(_0x4a0c46,null))[_0x4593('0x1e')](respondWithResult(_0x4a0c46,null))[_0x4593('0x53')](handleError(_0x4a0c46,null));};exports['create']=function(_0x1aebd6,_0x1cab5a){return db[_0x4593('0x59')][_0x4593('0x5a')](_0x1aebd6['body'],{})['then'](function(_0x2fef9f){var _0x23d770=_0x1aebd6[_0x4593('0x5b')][_0x4593('0x32')]({'plain':!![]});if(!_0x23d770)throw new Error(_0x4593('0x5c'));if(_0x23d770[_0x4593('0x5d')]===_0x4593('0x5b')){var _0x5ee311=_0x2fef9f['get']({'plain':!![]});var _0x326448='WhatsappAccounts';return db[_0x4593('0x5e')][_0x4593('0x58')]({'where':{'name':_0x326448,'userProfileId':_0x23d770[_0x4593('0x5f')]},'raw':!![]})[_0x4593('0x1e')](function(_0x20258e){if(_0x20258e&&_0x20258e[_0x4593('0x60')]===0x0){return db[_0x4593('0x34')][_0x4593('0x5a')]({'name':_0x5ee311['name'],'resourceId':_0x5ee311['id'],'type':_0x20258e[_0x4593('0x37')],'sectionId':_0x20258e['id']},{})[_0x4593('0x1e')](function(){return _0x2fef9f;});}else{return _0x2fef9f;}})[_0x4593('0x53')](function(_0x31d6a6){logger[_0x4593('0x22')](_0x4593('0x61'),_0x31d6a6);throw _0x31d6a6;});}return _0x2fef9f;})[_0x4593('0x1e')](respondWithResult(_0x1cab5a,0xc9))[_0x4593('0x53')](handleError(_0x1cab5a,null));};exports['update']=function(_0x502a5f,_0xe438d1){if(_0x502a5f[_0x4593('0x62')]['id']){delete _0x502a5f[_0x4593('0x62')]['id'];}return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x502a5f[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x39')],'as':_0x4593('0x3a')}]})[_0x4593('0x1e')](handleEntityNotFound(_0xe438d1,null))['then'](saveUpdates(_0x502a5f[_0x4593('0x62')],null))['then'](respondWithResult(_0xe438d1,null))[_0x4593('0x53')](handleError(_0xe438d1,null));};exports['destroy']=function(_0x7155af,_0x118c87){return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x7155af[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x118c87,null))['then'](removeEntity(_0x118c87,null))[_0x4593('0x53')](handleError(_0x118c87,null));};exports['describe']=function(_0xd3bf0f,_0x56cbcc){return db[_0x4593('0x59')]['describe']()[_0x4593('0x1e')](respondWithResult(_0x56cbcc,null))[_0x4593('0x53')](handleError(_0x56cbcc,null));};exports['addDisposition']=function(_0x4bff88,_0x2392ef,_0x41a685){if(_0x4bff88[_0x4593('0x62')]['id']){delete _0x4bff88[_0x4593('0x62')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4bff88[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x2392ef,null))[_0x4593('0x1e')](function(_0x45a8eb){if(_0x45a8eb){_0x4bff88[_0x4593('0x62')][_0x4593('0x63')]=_0x45a8eb['id'];return db[_0x4593('0x64')][_0x4593('0x5a')](_0x4bff88[_0x4593('0x62')]);}})[_0x4593('0x1e')](respondWithResult(_0x2392ef,null))['catch'](handleError(_0x2392ef,null));};exports['getDispositions']=function(_0x4a109e,_0x36bc7a,_0x172a94){var _0x509880={'raw':![],'where':{}};var _0x46e8fa={};var _0x15e107={'count':0x0,'rows':[]};return db[_0x4593('0x59')]['findOne']({'where':{'id':_0x4a109e[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x36bc7a,null))[_0x4593('0x1e')](function(_0x35ff5a){if(_0x35ff5a){_0x46e8fa[_0x4593('0x3e')]=_['keys'](db[_0x4593('0x64')][_0x4593('0x56')]);_0x46e8fa[_0x4593('0x41')]=_[_0x4593('0x40')](_0x4a109e[_0x4593('0x41')]);_0x46e8fa['filters']=_[_0x4593('0x42')](_0x46e8fa['model'],_0x46e8fa[_0x4593('0x41')]);_0x509880[_0x4593('0x44')]=_[_0x4593('0x42')](_0x46e8fa[_0x4593('0x3e')],qs[_0x4593('0x43')](_0x4a109e['query'][_0x4593('0x43')]));_0x509880['attributes']=_0x509880[_0x4593('0x44')][_0x4593('0x45')]?_0x509880[_0x4593('0x44')]:_0x46e8fa[_0x4593('0x3e')];if(!_0x4a109e['query']['hasOwnProperty'](_0x4593('0x47'))){_0x509880[_0x4593('0x2a')]=qs['limit'](_0x4a109e[_0x4593('0x41')][_0x4593('0x2a')]);_0x509880[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x4a109e[_0x4593('0x41')][_0x4593('0x2b')]);}_0x509880[_0x4593('0x48')]=qs['sort'](_0x4a109e['query'][_0x4593('0x49')]);_0x509880[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x4a109e[_0x4593('0x41')],_0x46e8fa[_0x4593('0x4b')]));_0x509880[_0x4593('0x4a')][_0x4593('0x63')]=_0x35ff5a['id'];if(_0x4a109e[_0x4593('0x41')][_0x4593('0x4d')]){_0x509880[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x509880['where'],{'$or':_['map'](_0x509880[_0x4593('0x44')],function(_0x54db75){var _0xac7dae={};_0xac7dae[_0x54db75]={'$like':'%'+_0x4a109e[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0xac7dae;})});}_0x509880=_[_0x4593('0x57')]({},_0x509880,_0x4a109e['options']);return db['Disposition']['count']({'where':_0x509880['where']})[_0x4593('0x1e')](function(_0x20f2ec){_0x15e107['count']=_0x20f2ec;if(_0x4a109e[_0x4593('0x41')][_0x4593('0x4f')]){_0x509880[_0x4593('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x509880);})[_0x4593('0x1e')](function(_0x2e9233){_0x15e107[_0x4593('0x52')]=_0x2e9233;return _0x15e107;});}})[_0x4593('0x1e')](respondWithFilteredResult(_0x36bc7a,_0x509880))['catch'](handleError(_0x36bc7a,null));};exports[_0x4593('0x65')]=function(_0x411f5e,_0x2ce372,_0x2c5b23){return db['WhatsappAccount']['find']({'where':{'id':_0x411f5e[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x2ce372,null))['then'](function(_0x515c7c){if(_0x515c7c){return _0x515c7c[_0x4593('0x65')](_0x411f5e['query'][_0x4593('0x66')]);}})[_0x4593('0x1e')](respondWithStatusCode(_0x2ce372,null))[_0x4593('0x53')](handleError(_0x2ce372,null));};exports['addAnswer']=function(_0x44d6fa,_0x5976a7,_0x2fb308){if(_0x44d6fa[_0x4593('0x62')]['id']){delete _0x44d6fa[_0x4593('0x62')]['id'];}return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x44d6fa[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x5976a7,null))[_0x4593('0x1e')](function(_0x5c2034){if(_0x5c2034){_0x44d6fa[_0x4593('0x62')][_0x4593('0x63')]=_0x5c2034['id'];return db[_0x4593('0x67')][_0x4593('0x5a')](_0x44d6fa['body']);}})['then'](respondWithResult(_0x5976a7,null))[_0x4593('0x53')](handleError(_0x5976a7,null));};exports[_0x4593('0x68')]=function(_0x4d17c0,_0x33c8e1,_0x1779d2){var _0x47b3b9={'raw':![],'where':{}};var _0x462351={};var _0x13bdec={'count':0x0,'rows':[]};return db[_0x4593('0x59')]['findOne']({'where':{'id':_0x4d17c0['params']['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x33c8e1,null))[_0x4593('0x1e')](function(_0x2b462c){if(_0x2b462c){_0x462351[_0x4593('0x3e')]=_[_0x4593('0x40')](db[_0x4593('0x67')]['rawAttributes']);_0x462351[_0x4593('0x41')]=_[_0x4593('0x40')](_0x4d17c0[_0x4593('0x41')]);_0x462351[_0x4593('0x4b')]=_['intersection'](_0x462351[_0x4593('0x3e')],_0x462351[_0x4593('0x41')]);_0x47b3b9['attributes']=_['intersection'](_0x462351[_0x4593('0x3e')],qs[_0x4593('0x43')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x43')]));_0x47b3b9[_0x4593('0x44')]=_0x47b3b9[_0x4593('0x44')][_0x4593('0x45')]?_0x47b3b9[_0x4593('0x44')]:_0x462351[_0x4593('0x3e')];if(!_0x4d17c0[_0x4593('0x41')][_0x4593('0x46')]('nolimit')){_0x47b3b9[_0x4593('0x2a')]=qs['limit'](_0x4d17c0['query']['limit']);_0x47b3b9[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x2b')]);}_0x47b3b9[_0x4593('0x48')]=qs[_0x4593('0x49')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x49')]);_0x47b3b9[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x4d17c0[_0x4593('0x41')],_0x462351[_0x4593('0x4b')]));_0x47b3b9[_0x4593('0x4a')][_0x4593('0x63')]=_0x2b462c['id'];if(_0x4d17c0[_0x4593('0x41')][_0x4593('0x4d')]){_0x47b3b9[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x47b3b9[_0x4593('0x4a')],{'$or':_[_0x4593('0x3f')](_0x47b3b9[_0x4593('0x44')],function(_0x51a101){var _0x505117={};_0x505117[_0x51a101]={'$like':'%'+_0x4d17c0[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0x505117;})});}_0x47b3b9=_[_0x4593('0x57')]({},_0x47b3b9,_0x4d17c0[_0x4593('0x4e')]);return db[_0x4593('0x67')][_0x4593('0x2c')]({'where':_0x47b3b9[_0x4593('0x4a')]})[_0x4593('0x1e')](function(_0x318aa9){_0x13bdec['count']=_0x318aa9;if(_0x4d17c0[_0x4593('0x41')][_0x4593('0x4f')]){_0x47b3b9['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x47b3b9);})[_0x4593('0x1e')](function(_0x266224){_0x13bdec['rows']=_0x266224;return _0x13bdec;});}})[_0x4593('0x1e')](respondWithFilteredResult(_0x33c8e1,_0x47b3b9))[_0x4593('0x53')](handleError(_0x33c8e1,null));};exports[_0x4593('0x69')]=function(_0x1d49e7,_0x4e8b13,_0x1d6f89){return db['WhatsappAccount']['find']({'where':{'id':_0x1d49e7[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x4e8b13,null))['then'](function(_0x23c173){if(_0x23c173){return _0x23c173[_0x4593('0x69')](_0x1d49e7[_0x4593('0x41')][_0x4593('0x66')]);}})['then'](respondWithStatusCode(_0x4e8b13,null))['catch'](handleError(_0x4e8b13,null));};exports[_0x4593('0x6a')]=function(_0x5665a2,_0x4c9e45,_0x450a4e){return db[_0x4593('0x59')]['find']({'where':{'id':_0x5665a2[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x4c9e45,null))[_0x4593('0x1e')](function(_0x25ba97){if(_0x25ba97){return _0x25ba97[_0x4593('0x6a')](_0x5665a2[_0x4593('0x62')][_0x4593('0x66')],_['omit'](_0x5665a2[_0x4593('0x62')],[_0x4593('0x66'),'id'])||{})[_0x4593('0x6b')](function(_0x1bd7dd){for(var _0x31a0c9=0x0;_0x31a0c9<_0x5665a2[_0x4593('0x62')]['ids'][_0x4593('0x45')];_0x31a0c9+=0x1){socket['emit'](_0x4593('0x6c'),{'UserId':Number(_0x5665a2['body'][_0x4593('0x66')][_0x31a0c9]),'WhatsappAccountId':Number(_0x5665a2[_0x4593('0x55')]['id'])});}return _0x1bd7dd;});}})[_0x4593('0x1e')](respondWithResult(_0x4c9e45,null))[_0x4593('0x53')](handleError(_0x4c9e45,null));};exports[_0x4593('0x6d')]=function(_0x16297f,_0x1ce519,_0x25719d){return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x16297f['params']['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x1ce519,null))[_0x4593('0x1e')](function(_0x271d24){if(_0x271d24){return _0x271d24[_0x4593('0x6d')](_0x16297f['query'][_0x4593('0x66')])[_0x4593('0x1e')](function(){if(_[_0x4593('0x6e')](_0x16297f['query'][_0x4593('0x66')])){for(var _0x36990d=0x0;_0x36990d<_0x16297f[_0x4593('0x41')][_0x4593('0x66')]['length'];_0x36990d+=0x1){socket[_0x4593('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x16297f['query']['ids'][_0x36990d]),'WhatsappAccountId':Number(_0x16297f[_0x4593('0x55')]['id'])});}}else{socket[_0x4593('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x16297f[_0x4593('0x41')][_0x4593('0x66')]),'WhatsappAccountId':Number(_0x16297f[_0x4593('0x55')]['id'])});}});}})[_0x4593('0x1e')](respondWithStatusCode(_0x1ce519,null))[_0x4593('0x53')](handleError(_0x1ce519,null));};exports['getAgents']=function(_0x2681bf,_0x545867,_0xfde5c0){var _0x59e598={};var _0x19cbce={};var _0x51fd2f;var _0x43c944;return db[_0x4593('0x59')][_0x4593('0x70')]({'where':{'id':_0x2681bf[_0x4593('0x55')]['id']}})['then'](handleEntityNotFound(_0x545867,null))[_0x4593('0x1e')](function(_0x33499f){if(_0x33499f){_0x51fd2f=_0x33499f;_0x19cbce[_0x4593('0x3e')]=_['keys'](db[_0x4593('0x71')]['rawAttributes']);_0x19cbce[_0x4593('0x41')]=_[_0x4593('0x40')](_0x2681bf[_0x4593('0x41')]);_0x19cbce['filters']=_[_0x4593('0x42')](_0x19cbce[_0x4593('0x3e')],_0x19cbce[_0x4593('0x41')]);_0x59e598[_0x4593('0x44')]=_[_0x4593('0x42')](_0x19cbce['model'],qs[_0x4593('0x43')](_0x2681bf[_0x4593('0x41')][_0x4593('0x43')]));_0x59e598[_0x4593('0x44')]=_0x59e598[_0x4593('0x44')]['length']?_0x59e598[_0x4593('0x44')]:_0x19cbce[_0x4593('0x3e')];_0x59e598['order']=qs['sort'](_0x2681bf[_0x4593('0x41')]['sort']);_0x59e598['where']=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x2681bf[_0x4593('0x41')],_0x19cbce['filters']));if(_0x2681bf[_0x4593('0x41')][_0x4593('0x4d')]){_0x59e598[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x59e598['where'],{'$or':_[_0x4593('0x3f')](_0x59e598[_0x4593('0x44')],function(_0x11388a){var _0x1a509d={};_0x1a509d[_0x11388a]={'$like':'%'+_0x2681bf['query'][_0x4593('0x4d')]+'%'};return _0x1a509d;})});}_0x59e598=_['merge']({},_0x59e598,_0x2681bf[_0x4593('0x4e')]);return _0x51fd2f[_0x4593('0x72')](_0x59e598);}})[_0x4593('0x1e')](function(_0x47bc40){if(_0x47bc40){_0x43c944=_0x47bc40[_0x4593('0x45')];if(!_0x2681bf[_0x4593('0x41')][_0x4593('0x46')](_0x4593('0x47'))){_0x59e598[_0x4593('0x2a')]=qs['limit'](_0x2681bf['query'][_0x4593('0x2a')]);_0x59e598[_0x4593('0x2b')]=qs['offset'](_0x2681bf[_0x4593('0x41')][_0x4593('0x2b')]);}return _0x51fd2f['getAgents'](_0x59e598);}})[_0x4593('0x1e')](function(_0x4b91a7){if(_0x4b91a7){return _0x4b91a7?{'count':_0x43c944,'rows':_0x4b91a7}:null;}})[_0x4593('0x1e')](respondWithResult(_0x545867,null))[_0x4593('0x53')](handleError(_0x545867,null));};exports[_0x4593('0x73')]=function(_0x28f8b1,_0xcad172){var _0x4f158f=_0x28f8b1['params']['id'];var _0x1416d4=_0x28f8b1[_0x4593('0x62')];var _0x2b83f9=0xc8;var _0x517fd3=null;return db[_0x4593('0x74')][_0x4593('0x75')]({'isolationLevel':db['sequelize'][_0x4593('0x76')][_0x4593('0x77')][_0x4593('0x78')]},function(_0x3af7fc){return db['WhatsappAccount'][_0x4593('0x70')]({'where':{'id':_0x4f158f},'transaction':_0x3af7fc})[_0x4593('0x1e')](function(_0x342a97){if(_0x342a97){return db[_0x4593('0x79')][_0x4593('0x31')]({'where':{'WhatsappAccountId':_0x4f158f},'transaction':_0x3af7fc})['then'](function(){var _0xb0a3a9=_[_0x4593('0x3f')](_0x1416d4,function(_0x5aa1ac){_0x5aa1ac[_0x4593('0x63')]=_0x4f158f;return _0x5aa1ac;});return db[_0x4593('0x79')][_0x4593('0x7a')](_0xb0a3a9,{'transaction':_0x3af7fc});});}else{_0x2b83f9=0x194;_0x517fd3=[];}});})[_0x4593('0x1e')](function(){if(_0x2b83f9!==0x194){return db[_0x4593('0x79')][_0x4593('0x7b')]({'where':{'WhatsappAccountId':_0x4f158f},'order':_0x4593('0x7c')})[_0x4593('0x1e')](function(_0x4b296c){_0x517fd3=_0x4b296c;});}})[_0x4593('0x53')](function(_0xf12eb9){_0x2b83f9=0x1f4;logger['error'](_0xf12eb9[_0x4593('0x36')]);if(_0xf12eb9[_0x4593('0x37')]){delete _0xf12eb9[_0x4593('0x37')];}_0x517fd3=_0xf12eb9;})[_0x4593('0x7d')](function(){if(_0x517fd3===null){_0xcad172[_0x4593('0x26')](_0x2b83f9);}else{if(_0x2b83f9===0x1f4){_0xcad172[_0x4593('0x27')](_0x2b83f9)['send'](_0x517fd3);}else{_0xcad172['status'](_0x2b83f9)['json'](_0x517fd3);}}});};exports[_0x4593('0x7e')]=function(_0xdcf281,_0x12f09d,_0x24df9b){var _0x50947a={};var _0x38cb1b={};var _0x2c3c90;var _0x154ecf;return db[_0x4593('0x59')][_0x4593('0x70')]({'where':{'id':_0xdcf281[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x12f09d,null))[_0x4593('0x1e')](function(_0x129612){if(_0x129612){_0x2c3c90=_0x129612;_0x38cb1b['model']=_[_0x4593('0x40')](db[_0x4593('0x79')]['rawAttributes']);_0x38cb1b[_0x4593('0x41')]=_[_0x4593('0x40')](_0xdcf281['query']);_0x38cb1b[_0x4593('0x4b')]=_[_0x4593('0x42')](_0x38cb1b['model'],_0x38cb1b['query']);_0x50947a[_0x4593('0x44')]=_[_0x4593('0x42')](_0x38cb1b[_0x4593('0x3e')],qs[_0x4593('0x43')](_0xdcf281[_0x4593('0x41')]['fields']));_0x50947a['attributes']=_0x50947a[_0x4593('0x44')][_0x4593('0x45')]?_0x50947a[_0x4593('0x44')]:_0x38cb1b[_0x4593('0x3e')];_0x50947a[_0x4593('0x48')]=qs[_0x4593('0x49')](_0xdcf281[_0x4593('0x41')][_0x4593('0x49')]);_0x50947a['where']=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0xdcf281[_0x4593('0x41')],_0x38cb1b[_0x4593('0x4b')]));if(_0xdcf281['query'][_0x4593('0x4d')]){_0x50947a[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x50947a['where'],{'$or':_[_0x4593('0x3f')](_0x50947a[_0x4593('0x44')],function(_0x2dd6ff){var _0xaf495c={};_0xaf495c[_0x2dd6ff]={'$like':'%'+_0xdcf281[_0x4593('0x41')]['filter']+'%'};return _0xaf495c;})});}_0x50947a=_[_0x4593('0x57')]({},_0x50947a,_0xdcf281[_0x4593('0x4e')]);return _0x2c3c90[_0x4593('0x7e')](_0x50947a);}})[_0x4593('0x1e')](function(_0x447036){if(_0x447036){_0x154ecf=_0x447036[_0x4593('0x45')];if(!_0xdcf281[_0x4593('0x41')][_0x4593('0x46')]('nolimit')){_0x50947a[_0x4593('0x2a')]=qs[_0x4593('0x2a')](_0xdcf281[_0x4593('0x41')][_0x4593('0x2a')]);_0x50947a['offset']=qs['offset'](_0xdcf281[_0x4593('0x41')][_0x4593('0x2b')]);}return _0x2c3c90[_0x4593('0x7e')](_0x50947a);}})[_0x4593('0x1e')](function(_0x4ce758){if(_0x4ce758){return _0x4ce758?{'count':_0x154ecf,'rows':_0x4ce758}:null;}})[_0x4593('0x1e')](respondWithResult(_0x12f09d,null))[_0x4593('0x53')](handleError(_0x12f09d,null));};exports[_0x4593('0x7f')]=function(_0x2db598,_0x9775f9,_0x423c10){var _0x2422fb={'channel':_0x4593('0x80')};var _0x2cd2b4=[];var _0x4935d8=[];var _0x5e6585={};return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x2db598[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x79')],'as':_0x4593('0x81')}]})[_0x4593('0x1e')](handleEntityNotFound(_0x9775f9,null))['then'](function(_0x2f8b32){_0x2422fb[_0x4593('0x82')]=_0x2f8b32;if(_0x2422fb['account']&&_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x83')&&_0x2db598[_0x4593('0x62')][_0x4593('0x84')]){if(_0x2db598[_0x4593('0x62')]['statuses'][_0x4593('0x45')]===0x0)return;if(_0x2db598['body'][_0x4593('0x84')][0x0][_0x4593('0x85')]!==_0x4593('0x86'))return;return db[_0x4593('0x87')][_0x4593('0x88')]({'read':!![],'readAt':_0x2db598[_0x4593('0x62')][_0x4593('0x84')][0x0][_0x4593('0x89')]},{'where':{'messageId':_0x2db598[_0x4593('0x62')][_0x4593('0x84')][0x0][_0x4593('0x8a')]},'individualHooks':!![]})['then'](function(_0x3bb228){return _0x9775f9[_0x4593('0x27')](0xc8)[_0x4593('0x28')](_0x3bb228);});}_0x2422fb['applications']=_[_0x4593('0x8b')](_0x2f8b32[_0x4593('0x81')],[_0x4593('0x7c')],[_0x4593('0x8c')]);if(_0x2422fb[_0x4593('0x82')]['Applications']){delete _0x2422fb[_0x4593('0x82')][_0x4593('0x81')];}return db[_0x4593('0x8d')][_0x4593('0x8e')]()[_0x4593('0x1e')](function(_0x1ccdb5){if(!_0x1ccdb5){throw new db[(_0x4593('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x2cd2b4=_[_0x4593('0x90')](_[_0x4593('0x40')](_0x1ccdb5),[_0x4593('0x91'),_0x4593('0x92')]);_0x4935d8=_['difference'](_[_0x4593('0x40')](_0x1ccdb5),['createdAt',_0x4593('0x92'),_0x4593('0x93'),_0x4593('0x94')]);_0x2422fb['body']={'mapKey':'mobile'};if(_0x2422fb['account']&&_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x95')){_0x2422fb[_0x4593('0x62')]['from']=_0x2db598[_0x4593('0x62')][_0x4593('0x96')][_0x4593('0x97')](_0x4593('0x98'),'');_0x2422fb[_0x4593('0x62')]['body']=_0x2db598['body'][_0x4593('0x99')];_0x2422fb[_0x4593('0x62')][_0x4593('0x9a')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9b')];}if(_0x2422fb[_0x4593('0x82')]&&_0x2422fb[_0x4593('0x82')][_0x4593('0x3c')]==='sinch'){_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9d')][0x0]['from'];_0x2422fb['body'][_0x4593('0x62')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9d')][0x0][_0x4593('0x24')][_0x4593('0x62')];_0x2422fb['body'][_0x4593('0x9a')]=_0x2db598[_0x4593('0x62')]['notifications'][0x0][_0x4593('0x8a')];}if(_0x2422fb[_0x4593('0x62')]['id']){delete _0x2422fb[_0x4593('0x62')]['id'];}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xa0'));}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')][_0x4593('0x62')])||_0x2422fb[_0x4593('0x62')][_0x4593('0x62')]===''){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xa1'));}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')]['mapKey'])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4935d8);}if(!_[_0x4593('0xa2')](_0x4935d8,_0x2422fb['body']['mapKey'])){throw new db['Sequelize'][(_0x4593('0x9f'))](_0x4593('0xa3')+_0x4935d8);}_0x5e6585[_0x2422fb[_0x4593('0x62')]['mapKey']]=_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')];return db[_0x4593('0xa4')][_0x4593('0x58')]({'where':{'id':_0x2422fb[_0x4593('0x82')][_0x4593('0x94')]},'include':[{'model':db[_0x4593('0x8d')],'as':'Contacts','where':_0x5e6585,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x9775f9,null))['then'](function(_0x174005){if(_0x174005){_0x2422fb[_0x4593('0xa5')]=_[_0x4593('0xa6')](_0x174005,[_0x4593('0xa7')]);if(_0x174005[_0x4593('0xa7')][_0x4593('0x45')]){return _0x174005['Contacts'][0x0];}var _0xf943c0=_[_0x4593('0x17')](_0x2422fb[_0x4593('0x62')],{'firstName':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'ListId':_0x174005['id']});_0xf943c0[_0x2422fb['body'][_0x4593('0xa8')]]=_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')];return db['CmContact'][_0x4593('0x5a')](_0xf943c0,{'fields':_0x2cd2b4,'raw':!![]});}})['then'](handleEntityNotFound(_0x9775f9,null))[_0x4593('0x1e')](function(_0x154f13){if(_0x154f13){_0x2422fb[_0x4593('0xa9')]=_0x154f13;var _0xdb85ae={'ContactId':_0x154f13['id'],'phone':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'WhatsappAccountId':_0x2db598[_0x4593('0x55')]['id']};var _0x572010={'ContactId':_0x154f13['id'],'WhatsappAccountId':_0x2db598[_0x4593('0x55')]['id'],'closed':![]};return db[_0x4593('0xaa')][_0x4593('0x58')]({'where':_0x572010})[_0x4593('0x1e')](function(_0x4208e4){if(_0x4208e4){return[_0x4208e4,![]];}return db[_0x4593('0xaa')][_0x4593('0x5a')](_0xdb85ae)['then'](function(_0x40b809){return[_0x40b809,!![]];});});}})['spread'](function(_0xd4c6af,_0x3af30c){_0x2422fb['interaction']=_0xd4c6af[_0x4593('0x32')]({'plain':!![]});_0x2422fb['interaction'][_0x4593('0xab')]=![];if(_0x3af30c){if(_0x2422fb[_0x4593('0x82')][_0x4593('0xac')]){_0x2422fb[_0x4593('0xad')]['push']({'id':0x0,'priority':_0x2422fb[_0x4593('0xad')]['length']+0x1,'app':'close','appdata':_0x4593('0xae'),'interval':_0x4593('0xaf')});}_0x2422fb[_0x4593('0xb0')]['created']=!![];}return db['WhatsappMessage']['create']({'phone':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'messageId':_0x2422fb[_0x4593('0x62')][_0x4593('0x9a')],'body':_0x2422fb[_0x4593('0x62')][_0x4593('0x62')],'WhatsappAccountId':_0x2db598['params']['id'],'WhatsappInteractionId':_0xd4c6af['id'],'direction':'in','ContactId':_0xd4c6af[_0x4593('0xb1')],'AttachmentId':_0x2422fb[_0x4593('0x62')][_0x4593('0xb2')]});})['then'](function(_0x3d4efb){_0x2422fb['message']=_0x3d4efb;if(!_0x2422fb[_0x4593('0xb0')]['UserId'])return;return db[_0x4593('0x71')][_0x4593('0x58')]({'attributes':['id',_0x4593('0x37')],'where':{'id':_0x2422fb['interaction'][_0x4593('0xb3')]}});})['then'](function(_0x564903){if(_0x564903){_0x2422fb[_0x4593('0xad')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4593('0xb4'),'appdata':_0x564903['name']+','+(_0x2422fb['account'][_0x4593('0xb5')]||0xa),'interval':'*,*,*,*'});}if(!_0x2422fb[_0x4593('0xb0')]['queueId'])return;return db['WhatsappQueue'][_0x4593('0x58')]({'attributes':['id','name'],'where':{'id':_0x2422fb[_0x4593('0xb0')][_0x4593('0xb6')]}});})[_0x4593('0x1e')](function(_0x2e5726){if(_0x2e5726){_0x2422fb[_0x4593('0xad')][_0x4593('0xb7')]({'id':0x0,'priority':0x1,'app':_0x4593('0xb8'),'appdata':_0x2e5726[_0x4593('0x37')]+','+(_0x2422fb[_0x4593('0x82')][_0x4593('0xb9')]||0x12c),'interval':_0x4593('0xaf')});}return respondWithRpcPromise(_0x4593('0xba'),_0x4593('0xbb'),_0x2422fb);})['then'](function(_0x4199e0){if(_0x4199e0){var _0x4ab0ef=0xc8;var _0x26ef3a='receiveMessage';logger['info'](_0x4593('0x21'),_0x26ef3a,_0x4ab0ef,_0x4593('0xbc'));logger[_0x4593('0xbd')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26ef3a,_0x4ab0ef,_0x4593('0xbc'),JSON[_0x4593('0xbe')](_0x4199e0));if(_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x95')){return _0x9775f9[_0x4593('0x27')](_0x4ab0ef)[_0x4593('0x2d')](_0x4593('0xbf'),_0x4593('0xc0'))['send'](_0x4593('0xc1'));}else{return _0x9775f9[_0x4593('0x27')](_0x4ab0ef)[_0x4593('0x28')](_0x4199e0);}}});})[_0x4593('0x53')](handleError(_0x9775f9,null));};exports[_0x4593('0xc2')]=function(_0x5978ec,_0x1ebea5,_0x5abd7c){var _0x1d2376,_0x26337d,_0x1da911;if(_['isNil'](_0x5978ec[_0x4593('0x62')]['body'])||_0x5978ec['body'][_0x4593('0x62')]===''){throw new db[(_0x4593('0x8f'))]['ValidationError'](_0x4593('0xa1'));}if(_[_0x4593('0x9e')](_0x5978ec[_0x4593('0x62')]['to'])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xc3'));}_0x1d2376=_0x5978ec['body']['to'];return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x5978ec['params']['id']},'include':[{'model':db[_0x4593('0xa4')],'as':_0x4593('0xc4'),'include':[{'model':db[_0x4593('0x8d')],'as':'Contacts','where':{'mobile':_0x1d2376},'limit':0x1,'order':[['updatedAt',_0x4593('0xc5')]]}]}]})[_0x4593('0x1e')](handleEntityNotFound(_0x1ebea5,null))[_0x4593('0x1e')](function(_0x56ff24){if(_0x56ff24&&_0x56ff24[_0x4593('0xc4')]){_0x26337d=_0x56ff24[_0x4593('0x32')]({'plain':!![]});if(_0x26337d['List']&&_0x26337d[_0x4593('0xc4')][_0x4593('0xa7')][_0x4593('0x45')]){return _0x26337d[_0x4593('0xc4')][_0x4593('0xa7')][0x0];}return db['CmContact'][_0x4593('0x5a')](_[_0x4593('0x17')](_0x5978ec['body'],{'firstName':_0x1d2376,'mobile':_0x1d2376,'phone':_0x1d2376,'ListId':_0x26337d[_0x4593('0x94')]}));}})[_0x4593('0x1e')](handleEntityNotFound(_0x1ebea5,null))['then'](function(_0x1bf5b1){if(_0x1bf5b1){_0x1da911=_0x1bf5b1;return db['WhatsappInteraction'][_0x4593('0x58')]({'where':{'ContactId':_0x1da911['id'],'closed':![],'WhatsappAccountId':_0x26337d['id']}})[_0x4593('0x1e')](function(_0x53a8db){if(_0x53a8db){return[_0x53a8db,![]];}return db[_0x4593('0xaa')][_0x4593('0x5a')]({'UserId':_0x5978ec['user']['id'],'ContactId':_0x1da911['id'],'WhatsappAccountId':_0x26337d['id'],'phone':_0x1d2376,'firstMsgDirection':_0x4593('0xc6'),'Messages':[_[_0x4593('0x57')](_0x5978ec['body'],{'read':![],'body':_0x5978ec['body'][_0x4593('0x62')],'phone':_0x1d2376,'WhatsappAccountId':_0x26337d['id'],'UserId':_0x5978ec[_0x4593('0x5b')]['id'],'ContactId':_0x1da911['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x4593('0x1e')](function(_0x49eea5){return[_0x49eea5,!![]];});});}})['spread'](function(_0x29fbb4,_0x5571e0){if(_0x5571e0){return _0x29fbb4;}return db[_0x4593('0x87')][_0x4593('0x5a')](_[_0x4593('0x57')](_0x5978ec[_0x4593('0x62')],{'read':![],'body':_0x5978ec[_0x4593('0x62')]['body'],'phone':_0x1d2376,'WhatsappAccountId':_0x26337d['id'],'WhatsappInteractionId':_0x29fbb4['id'],'UserId':_0x5978ec['user']['id'],'ContactId':_0x1da911['id']}))[_0x4593('0x1e')](function(_0x4e99bd){_0x29fbb4[_0x4593('0xc7')][_0x4593('0xc8')]=[];_0x29fbb4['dataValues'][_0x4593('0xc8')][_0x4593('0xc9')](_0x4e99bd[_0x4593('0xc7')]);return _0x29fbb4;});})['then'](respondWithResult(_0x1ebea5,null))[_0x4593('0x53')](handleError(_0x1ebea5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index bf08fd0..eaef045 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 _0xcbc5=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1c02de,_0x421e46){var _0x42a55f=function(_0x26fb96){while(--_0x26fb96){_0x1c02de['push'](_0x1c02de['shift']());}};_0x42a55f(++_0x421e46);}(_0xcbc5,0x160));var _0x5cbc=function(_0x23e8ee,_0x259afd){_0x23e8ee=_0x23e8ee-0x0;var _0x952c2=_0xcbc5[_0x23e8ee];return _0x952c2;};'use strict';var EventEmitter=require(_0x5cbc('0x0'));var WhatsappAccount=require(_0x5cbc('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cbc('0x2'),'afterUpdate':_0x5cbc('0x3'),'afterDestroy':_0x5cbc('0x4')};function emitEvent(_0x2cc5ed){return function(_0x432183,_0xa5a447,_0x3ce1be){WhatsappAccountEvents[_0x5cbc('0x5')](_0x2cc5ed+':'+_0x432183['id'],_0x432183);WhatsappAccountEvents[_0x5cbc('0x5')](_0x2cc5ed,_0x432183);_0x3ce1be(null);};}for(var e in events){if(events[_0x5cbc('0x6')](e)){var event=events[e];WhatsappAccount[_0x5cbc('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x1ba7=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x1ba7,0xc2));var _0x71ba=function(_0x4d0812,_0x3dd7a8){_0x4d0812=_0x4d0812-0x0;var _0x505107=_0x1ba7[_0x4d0812];return _0x505107;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x71ba('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x71ba('0x1')](0x0);var events={'afterCreate':_0x71ba('0x2'),'afterUpdate':_0x71ba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b2ed7){return function(_0x24f9e1,_0x192fa9,_0x4f1797){WhatsappAccountEvents['emit'](_0x4b2ed7+':'+_0x24f9e1['id'],_0x24f9e1);WhatsappAccountEvents[_0x71ba('0x4')](_0x4b2ed7,_0x24f9e1);_0x4f1797(null);};}for(var e in events){if(events[_0x71ba('0x5')](e)){var event=events[e];WhatsappAccount[_0x71ba('0x6')](e,emitEvent(event));}}module[_0x71ba('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b47a802..d7f5436 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 _0xd837=['util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xd837,0x120));var _0x7d83=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xd837[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require('lodash');var util=require(_0x7d83('0x0'));var logger=require(_0x7d83('0x1'))(_0x7d83('0x2'));var moment=require(_0x7d83('0x3'));var BPromise=require(_0x7d83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d83('0x5'));var rimraf=require(_0x7d83('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d83('0x7'));module[_0x7d83('0x8')]=function(_0x7405be,_0xf42ab5){return _0x7405be['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x536a=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2aa316,_0x4191bf){var _0x55a546=function(_0x3211fc){while(--_0x3211fc){_0x2aa316['push'](_0x2aa316['shift']());}};_0x55a546(++_0x4191bf);}(_0x536a,0x102));var _0xa536=function(_0x43d89b,_0x3f7d13){_0x43d89b=_0x43d89b-0x0;var _0x174ffe=_0x536a[_0x43d89b];return _0x174ffe;};'use strict';var _=require('lodash');var util=require(_0xa536('0x0'));var logger=require(_0xa536('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa536('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa536('0x3'));var rimraf=require(_0xa536('0x4'));var config=require(_0xa536('0x5'));var attributes=require(_0xa536('0x6'));module[_0xa536('0x7')]=function(_0xe7be1d,_0xf2ee6a){return _0xe7be1d[_0xa536('0x8')](_0xa536('0x9'),attributes,{'tableName':_0xa536('0xa'),'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 bab4044..c948da6 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 _0xb961=['catch','ShowWhatsappAccount','find','options','raw','include','map','model','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x385fcc,_0x438ca3){var _0x50c842=function(_0x2d8dd0){while(--_0x2d8dd0){_0x385fcc['push'](_0x385fcc['shift']());}};_0x50c842(++_0x438ca3);}(_0xb961,0x114));var _0x1b96=function(_0x33862b,_0x583ddc){_0x33862b=_0x33862b-0x0;var _0x1b15a0=_0xb961[_0x33862b];return _0x1b15a0;};'use strict';var _=require(_0x1b96('0x0'));var util=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var BPromise=require(_0x1b96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b96('0x4'));var db=require(_0x1b96('0x5'))['db'];var utils=require(_0x1b96('0x6'));var logger=require(_0x1b96('0x7'))(_0x1b96('0x8'));var config=require(_0x1b96('0x9'));var jayson=require(_0x1b96('0xa'));var client=jayson['client'][_0x1b96('0xb')]({'port':0x232a});config[_0x1b96('0xc')]=_[_0x1b96('0xd')](config[_0x1b96('0xc')],{'host':_0x1b96('0xe'),'port':0x18eb});var socket=require(_0x1b96('0xf'))(new Redis(config['redis']));require(_0x1b96('0x10'))[_0x1b96('0x11')](socket);function respondWithRpcPromise(_0x26d17f,_0x43cd97,_0x4f9ea8){return new BPromise(function(_0x3bf8e0,_0x6f9d79){return client[_0x1b96('0x12')](_0x26d17f,_0x4f9ea8)[_0x1b96('0x13')](function(_0xfab0f3){logger[_0x1b96('0x14')](_0x1b96('0x15'),_0x43cd97,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x43cd97,_0x1b96('0x16'),JSON[_0x1b96('0x17')](_0xfab0f3));if(_0xfab0f3[_0x1b96('0x18')]){if(_0xfab0f3['error'][_0x1b96('0x19')]===0x1f4){logger['error'](_0x1b96('0x15'),_0x43cd97,_0xfab0f3[_0x1b96('0x18')]['message']);return _0x6f9d79(_0xfab0f3[_0x1b96('0x18')]['message']);}logger[_0x1b96('0x18')](_0x1b96('0x15'),_0x43cd97,_0xfab0f3['error'][_0x1b96('0x1a')]);return _0x3bf8e0(_0xfab0f3[_0x1b96('0x18')][_0x1b96('0x1a')]);}else{logger[_0x1b96('0x14')](_0x1b96('0x15'),_0x43cd97,_0x1b96('0x16'));_0x3bf8e0(_0xfab0f3[_0x1b96('0x1b')][_0x1b96('0x1a')]);}})[_0x1b96('0x1c')](function(_0x14673a){logger[_0x1b96('0x18')](_0x1b96('0x15'),_0x43cd97,_0x14673a);_0x6f9d79(_0x14673a);});});}exports[_0x1b96('0x1d')]=function(_0x58715f){var _0x112a05=this;return new Promise(function(_0x340751,_0x1f2e1a){return db['WhatsappAccount'][_0x1b96('0x1e')]({'raw':_0x58715f[_0x1b96('0x1f')]?_0x58715f[_0x1b96('0x1f')][_0x1b96('0x20')]===undefined?!![]:![]:!![],'where':_0x58715f['options']?_0x58715f[_0x1b96('0x1f')]['where']||null:null,'attributes':_0x58715f[_0x1b96('0x1f')]?_0x58715f['options']['attributes']||null:null,'include':_0x58715f['options']?_0x58715f['options'][_0x1b96('0x21')]?_[_0x1b96('0x22')](_0x58715f['options'][_0x1b96('0x21')],function(_0xf68f62){return{'model':db[_0xf68f62[_0x1b96('0x23')]],'as':_0xf68f62['as'],'attributes':_0xf68f62[_0x1b96('0x24')],'include':_0xf68f62['include']?_[_0x1b96('0x22')](_0xf68f62[_0x1b96('0x21')],function(_0x2cd651){return{'model':db[_0x2cd651[_0x1b96('0x23')]],'as':_0x2cd651['as'],'attributes':_0x2cd651[_0x1b96('0x24')],'include':_0x2cd651[_0x1b96('0x21')]?_[_0x1b96('0x22')](_0x2cd651[_0x1b96('0x21')],function(_0x7b4650){return{'model':db[_0x7b4650[_0x1b96('0x23')]],'as':_0x7b4650['as'],'attributes':_0x7b4650[_0x1b96('0x24')]};}):[]};}):[]};}):[]:[]})[_0x1b96('0x13')](function(_0x26a763){logger[_0x1b96('0x14')](_0x1b96('0x1d'),_0x58715f);logger[_0x1b96('0x25')](_0x1b96('0x1d'),_0x58715f,JSON[_0x1b96('0x17')](_0x26a763));_0x340751(_0x26a763);})[_0x1b96('0x1c')](function(_0x42c497){logger[_0x1b96('0x18')](_0x1b96('0x1d'),_0x42c497[_0x1b96('0x1a')],_0x58715f);_0x1f2e1a(_0x112a05[_0x1b96('0x18')](0x1f4,_0x42c497[_0x1b96('0x1a')]));});});}; \ No newline at end of file +var _0xe51d=['find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount'];(function(_0x54086c,_0x386657){var _0x4ea3e0=function(_0x117ffd){while(--_0x117ffd){_0x54086c['push'](_0x54086c['shift']());}};_0x4ea3e0(++_0x386657);}(_0xe51d,0x9c));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var moment=require('moment');var BPromise=require(_0xde51('0x2'));var rs=require(_0xde51('0x3'));var fs=require('fs');var Redis=require(_0xde51('0x4'));var db=require(_0xde51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde51('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde51('0x7'));var client=jayson[_0xde51('0x8')][_0xde51('0x9')]({'port':0x232a});config['redis']=_[_0xde51('0xa')](config[_0xde51('0xb')],{'host':_0xde51('0xc'),'port':0x18eb});var socket=require(_0xde51('0xd'))(new Redis(config[_0xde51('0xb')]));require('./whatsappAccount.socket')[_0xde51('0xe')](socket);function respondWithRpcPromise(_0x52ab38,_0x4dbda5,_0x4a5999){return new BPromise(function(_0x5e1b5a,_0x49c5ef){return client[_0xde51('0xf')](_0x52ab38,_0x4a5999)[_0xde51('0x10')](function(_0x4a203f){logger[_0xde51('0x11')](_0xde51('0x12'),_0x4dbda5,_0xde51('0x13'));logger[_0xde51('0x14')](_0xde51('0x15'),_0x4dbda5,_0xde51('0x13'),JSON[_0xde51('0x16')](_0x4a203f));if(_0x4a203f[_0xde51('0x17')]){if(_0x4a203f[_0xde51('0x17')][_0xde51('0x18')]===0x1f4){logger[_0xde51('0x17')](_0xde51('0x12'),_0x4dbda5,_0x4a203f['error'][_0xde51('0x19')]);return _0x49c5ef(_0x4a203f[_0xde51('0x17')][_0xde51('0x19')]);}logger['error'](_0xde51('0x12'),_0x4dbda5,_0x4a203f[_0xde51('0x17')]['message']);return _0x5e1b5a(_0x4a203f[_0xde51('0x17')][_0xde51('0x19')]);}else{logger[_0xde51('0x11')](_0xde51('0x12'),_0x4dbda5,_0xde51('0x13'));_0x5e1b5a(_0x4a203f[_0xde51('0x1a')][_0xde51('0x19')]);}})[_0xde51('0x1b')](function(_0x513efc){logger[_0xde51('0x17')](_0xde51('0x12'),_0x4dbda5,_0x513efc);_0x49c5ef(_0x513efc);});});}exports[_0xde51('0x1c')]=function(_0x240d21){var _0x103ae3=this;return new Promise(function(_0x4052c1,_0x3bb692){return db['WhatsappAccount'][_0xde51('0x1d')]({'raw':_0x240d21[_0xde51('0x1e')]?_0x240d21[_0xde51('0x1e')][_0xde51('0x1f')]===undefined?!![]:![]:!![],'where':_0x240d21[_0xde51('0x1e')]?_0x240d21['options'][_0xde51('0x20')]||null:null,'attributes':_0x240d21[_0xde51('0x1e')]?_0x240d21['options'][_0xde51('0x21')]||null:null,'include':_0x240d21[_0xde51('0x1e')]?_0x240d21[_0xde51('0x1e')][_0xde51('0x22')]?_[_0xde51('0x23')](_0x240d21[_0xde51('0x1e')][_0xde51('0x22')],function(_0x241dc5){return{'model':db[_0x241dc5[_0xde51('0x24')]],'as':_0x241dc5['as'],'attributes':_0x241dc5[_0xde51('0x21')],'include':_0x241dc5[_0xde51('0x22')]?_[_0xde51('0x23')](_0x241dc5[_0xde51('0x22')],function(_0xc62246){return{'model':db[_0xc62246[_0xde51('0x24')]],'as':_0xc62246['as'],'attributes':_0xc62246[_0xde51('0x21')],'include':_0xc62246[_0xde51('0x22')]?_[_0xde51('0x23')](_0xc62246[_0xde51('0x22')],function(_0xdc6d31){return{'model':db[_0xdc6d31['model']],'as':_0xdc6d31['as'],'attributes':_0xdc6d31[_0xde51('0x21')]};}):[]};}):[]};}):[]:[]})[_0xde51('0x10')](function(_0x322bbc){logger[_0xde51('0x11')](_0xde51('0x1c'),_0x240d21);logger[_0xde51('0x14')](_0xde51('0x1c'),_0x240d21,JSON[_0xde51('0x16')](_0x322bbc));_0x4052c1(_0x322bbc);})[_0xde51('0x1b')](function(_0x36a663){logger[_0xde51('0x17')](_0xde51('0x1c'),_0x36a663[_0xde51('0x19')],_0x240d21);_0x3bb692(_0x103ae3['error'](0x1f4,_0x36a663[_0xde51('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 434a176..8951c29 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 _0x450f=['emit','removeListener','length','whatsappAccount:','save','remove','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x450f,0x162));var _0xf450=function(_0x430244,_0x3b8a5e){_0x430244=_0x430244-0x0;var _0x2ed66c=_0x450f[_0x430244];return _0x2ed66c;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xf450('0x0'),_0xf450('0x1'),_0xf450('0x2')];function createListener(_0x1f1dfd,_0x53a021){return function(_0x46ad1b){_0x53a021[_0xf450('0x3')](_0x1f1dfd,_0x46ad1b);};}function removeListener(_0x129544,_0x23e789){return function(){WhatsappAccountEvents[_0xf450('0x4')](_0x129544,_0x23e789);};}exports['register']=function(_0x4a8475){for(var _0x9707f=0x0,_0x18cf9f=events[_0xf450('0x5')];_0x9707f<_0x18cf9f;_0x9707f++){var _0x4950ca=events[_0x9707f];var _0x4ba135=createListener(_0xf450('0x6')+_0x4950ca,_0x4a8475);WhatsappAccountEvents['on'](_0x4950ca,_0x4ba135);}}; \ No newline at end of file +var _0x7cd9=['update','removeListener','register','length','remove'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x7cd9,0x7c));var _0x97cd=function(_0x1cefa3,_0x40aed0){_0x1cefa3=_0x1cefa3-0x0;var _0x45ab2e=_0x7cd9[_0x1cefa3];return _0x45ab2e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x97cd('0x0'),_0x97cd('0x1')];function createListener(_0x2e335d,_0x3b00ce){return function(_0x3461f7){_0x3b00ce['emit'](_0x2e335d,_0x3461f7);};}function removeListener(_0x458503,_0x135f60){return function(){WhatsappAccountEvents[_0x97cd('0x2')](_0x458503,_0x135f60);};}exports[_0x97cd('0x3')]=function(_0xf98e13){for(var _0x120f24=0x0,_0x343568=events[_0x97cd('0x4')];_0x120f24<_0x343568;_0x120f24++){var _0x285d5d=events[_0x120f24];var _0x4e484b=createListener('whatsappAccount:'+_0x285d5d,_0xf98e13);WhatsappAccountEvents['on'](_0x285d5d,_0x4e484b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4cff4c9..1a81998 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 _0xe5c5=['../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4766f6,_0x4ec6a5){var _0x92f94c=function(_0x44d7a5){while(--_0x44d7a5){_0x4766f6['push'](_0x4766f6['shift']());}};_0x92f94c(++_0x4ec6a5);}(_0xe5c5,0x190));var _0x5e5c=function(_0x15e205,_0x3e4958){_0x15e205=_0x15e205-0x0;var _0xed40f2=_0xe5c5[_0x15e205];return _0xed40f2;};'use strict';var multer=require(_0x5e5c('0x0'));var util=require(_0x5e5c('0x1'));var path=require('path');var timeout=require(_0x5e5c('0x2'));var express=require(_0x5e5c('0x3'));var router=express[_0x5e5c('0x4')]();var fs_extra=require(_0x5e5c('0x5'));var auth=require(_0x5e5c('0x6'));var interaction=require(_0x5e5c('0x7'));var config=require(_0x5e5c('0x8'));var controller=require(_0x5e5c('0x9'));router[_0x5e5c('0xa')]('/',auth['isAuthenticated'](),controller[_0x5e5c('0xb')]);router[_0x5e5c('0xa')](_0x5e5c('0xc'),auth[_0x5e5c('0xd')](),controller[_0x5e5c('0xe')]);router['post']('/',auth[_0x5e5c('0xd')](),controller['create']);router[_0x5e5c('0xf')](_0x5e5c('0xc'),auth[_0x5e5c('0xd')](),controller['update']);router[_0x5e5c('0x10')](_0x5e5c('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4bd7=['../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x4bd7,0xd9));var _0x74bd=function(_0x2db59f,_0x236c36){_0x2db59f=_0x2db59f-0x0;var _0x8e74b8=_0x4bd7[_0x2db59f];return _0x8e74b8;};'use strict';var multer=require('multer');var util=require(_0x74bd('0x0'));var path=require('path');var timeout=require(_0x74bd('0x1'));var express=require(_0x74bd('0x2'));var router=express[_0x74bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74bd('0x4'));var interaction=require(_0x74bd('0x5'));var config=require('../../config/environment');var controller=require(_0x74bd('0x6'));router[_0x74bd('0x7')]('/',auth[_0x74bd('0x8')](),controller['index']);router[_0x74bd('0x7')](_0x74bd('0x9'),auth['isAuthenticated'](),controller[_0x74bd('0xa')]);router['post']('/',auth[_0x74bd('0x8')](),controller[_0x74bd('0xb')]);router[_0x74bd('0xc')](_0x74bd('0x9'),auth[_0x74bd('0x8')](),controller[_0x74bd('0xd')]);router[_0x74bd('0xe')]('/:id',auth[_0x74bd('0x8')](),controller[_0x74bd('0xf')]);module[_0x74bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index caf7ffb..41a5e1c 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 _0x5996=['exports','noop','TEXT','STRING','sequelize'];(function(_0x193432,_0x5b5efc){var _0xf8d4e=function(_0x2afa86){while(--_0x2afa86){_0x193432['push'](_0x193432['shift']());}};_0xf8d4e(++_0x5b5efc);}(_0x5996,0x6d));var _0x6599=function(_0x37eaf5,_0x4bd2ec){_0x37eaf5=_0x37eaf5-0x0;var _0x154060=_0x5996[_0x37eaf5];return _0x154060;};'use strict';var Sequelize=require(_0x6599('0x0'));module[_0x6599('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6599('0x2')},'appdata':{'type':Sequelize[_0x6599('0x3')]()},'description':{'type':Sequelize[_0x6599('0x4')]},'interval':{'type':Sequelize[_0x6599('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x78b7=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78b7,0x14c));var _0x778b=function(_0x243e52,_0x1915d9){_0x243e52=_0x243e52-0x0;var _0x1d42ab=_0x78b7[_0x243e52];return _0x1d42ab;};'use strict';var Sequelize=require(_0x778b('0x0'));module[_0x778b('0x1')]={'priority':{'type':Sequelize[_0x778b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x778b('0x3')},'appdata':{'type':Sequelize[_0x778b('0x4')]()},'description':{'type':Sequelize[_0x778b('0x5')]},'interval':{'type':Sequelize[_0x778b('0x5')],'defaultValue':_0x778b('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2070194..78ca7a9 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 _0x955f=['undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0x955f,0x1eb));var _0xf955=function(_0x415c5a,_0x49a851){_0x415c5a=_0x415c5a-0x0;var _0xb8f5ca=_0x955f[_0x415c5a];return _0xb8f5ca;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x552cf3,_0x18f435){return function(_0x1acf33){if(!_0x1acf33){_0x552cf3[_0xf955('0x17')](0x194);}return _0x1acf33;};}function handleError(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0x1f4;return function(_0x13a86d){logger[_0xf955('0x26')](_0x13a86d['stack']);if(_0x13a86d[_0xf955('0x27')]){delete _0x13a86d[_0xf955('0x27')];}_0x406632[_0xf955('0x18')](_0x2dcd55)[_0xf955('0x28')](_0x13a86d);};}exports[_0xf955('0x29')]=function(_0x264f6d,_0x4d4af0){var _0x2232a7={},_0x1e5d37={},_0x4ec3e8={'count':0x0,'rows':[]};var _0x256df5=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x59bfb5){return{'name':_0x59bfb5[_0xf955('0x2d')],'type':_0x59bfb5['type'][_0xf955('0x2e')]};});_0x1e5d37[_0xf955('0x2f')]=_[_0xf955('0x2a')](_0x256df5,_0xf955('0x27'));_0x1e5d37[_0xf955('0x30')]=_[_0xf955('0x31')](_0x264f6d[_0xf955('0x30')]);_0x1e5d37[_0xf955('0x32')]=_['intersection'](_0x1e5d37[_0xf955('0x2f')],_0x1e5d37[_0xf955('0x30')]);_0x2232a7[_0xf955('0x33')]=_[_0xf955('0x34')](_0x1e5d37['model'],qs[_0xf955('0x35')](_0x264f6d[_0xf955('0x30')][_0xf955('0x35')]));_0x2232a7[_0xf955('0x33')]=_0x2232a7[_0xf955('0x33')]['length']?_0x2232a7['attributes']:_0x1e5d37['model'];if(!_0x264f6d[_0xf955('0x30')][_0xf955('0x36')](_0xf955('0x37'))){_0x2232a7[_0xf955('0x1c')]=qs[_0xf955('0x1c')](_0x264f6d[_0xf955('0x30')]['limit']);_0x2232a7[_0xf955('0x1d')]=qs['offset'](_0x264f6d[_0xf955('0x30')][_0xf955('0x1d')]);}_0x2232a7[_0xf955('0x38')]=qs['sort'](_0x264f6d[_0xf955('0x30')]['sort']);_0x2232a7[_0xf955('0x39')]=qs[_0xf955('0x32')](_[_0xf955('0x3a')](_0x264f6d[_0xf955('0x30')],_0x1e5d37['filters']),_0x256df5);if(_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]){_0x2232a7['where']=_[_0xf955('0x3c')](_0x2232a7[_0xf955('0x39')],{'$or':_[_0xf955('0x2a')](_0x256df5,function(_0x547ed9){if(_0x547ed9[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x11b7e2={};_0x11b7e2[_0x547ed9['name']]={'$like':'%'+_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]+'%'};return _0x11b7e2;}})});}_0x2232a7=_[_0xf955('0x3c')]({},_0x2232a7,_0x264f6d[_0xf955('0x3f')]);var _0x2bfbe4={'where':_0x2232a7[_0xf955('0x39')]};return db[_0xf955('0x2b')][_0xf955('0x1e')](_0x2bfbe4)['then'](function(_0x8fa41b){_0x4ec3e8[_0xf955('0x1e')]=_0x8fa41b;if(_0x264f6d[_0xf955('0x30')][_0xf955('0x40')]){_0x2232a7[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x2b')][_0xf955('0x42')](_0x2232a7);})[_0xf955('0x24')](function(_0x47651b){_0x4ec3e8[_0xf955('0x43')]=_0x47651b;return _0x4ec3e8;})[_0xf955('0x24')](respondWithFilteredResult(_0x4d4af0,_0x2232a7))[_0xf955('0x44')](handleError(_0x4d4af0,null));};exports[_0xf955('0x45')]=function(_0x159ae3,_0x3557b5){var _0x248f60={'raw':!![],'where':{'id':_0x159ae3[_0xf955('0x46')]['id']}},_0x356ec2={};_0x356ec2[_0xf955('0x2f')]=_['keys'](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x356ec2[_0xf955('0x30')]=_['keys'](_0x159ae3[_0xf955('0x30')]);_0x356ec2['filters']=_[_0xf955('0x34')](_0x356ec2['model'],_0x356ec2[_0xf955('0x30')]);_0x248f60[_0xf955('0x33')]=_[_0xf955('0x34')](_0x356ec2[_0xf955('0x2f')],qs['fields'](_0x159ae3[_0xf955('0x30')][_0xf955('0x35')]));_0x248f60[_0xf955('0x33')]=_0x248f60['attributes']['length']?_0x248f60[_0xf955('0x33')]:_0x356ec2[_0xf955('0x2f')];if(_0x159ae3[_0xf955('0x30')][_0xf955('0x40')]){_0x248f60['include']=[{'all':!![]}];}_0x248f60=_[_0xf955('0x3c')]({},_0x248f60,_0x159ae3[_0xf955('0x3f')]);return db[_0xf955('0x2b')]['find'](_0x248f60)[_0xf955('0x24')](handleEntityNotFound(_0x3557b5,null))['then'](respondWithResult(_0x3557b5,null))[_0xf955('0x44')](handleError(_0x3557b5,null));};exports[_0xf955('0x47')]=function(_0x2c867f,_0x4dd592){return db[_0xf955('0x2b')][_0xf955('0x47')](_0x2c867f[_0xf955('0x48')],{})[_0xf955('0x24')](respondWithResult(_0x4dd592,0xc9))['catch'](handleError(_0x4dd592,null));};exports[_0xf955('0x23')]=function(_0x4ff0f1,_0x1c6d76){if(_0x4ff0f1[_0xf955('0x48')]['id']){delete _0x4ff0f1[_0xf955('0x48')]['id'];}return db['WhatsappApplication'][_0xf955('0x49')]({'where':{'id':_0x4ff0f1['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x4ff0f1[_0xf955('0x48')],null))['then'](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports[_0xf955('0x25')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['find']({'where':{'id':_0x45c7fe['params']['id']}})['then'](handleEntityNotFound(_0x4961cc,null))['then'](removeEntity(_0x4961cc,null))[_0xf955('0x44')](handleError(_0x4961cc,null));}; \ No newline at end of file +var _0xfa94=['order','sort','where','pick','filter','merge','rows','show','params','length','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5ea417,_0x309035){var _0x4e9bce=function(_0x2151a7){while(--_0x2151a7){_0x5ea417['push'](_0x5ea417['shift']());}};_0x4e9bce(++_0x309035);}(_0xfa94,0xef));var _0x4fa9=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0xfa94[_0x398d85];return _0x33c2bb;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];function respondWithStatusCode(_0x57df6a,_0x85f1e5){_0x85f1e5=_0x85f1e5||0xcc;return function(_0x54d8c5){if(_0x54d8c5){return _0x57df6a[_0x4fa9('0x16')](_0x85f1e5);}return _0x57df6a[_0x4fa9('0x17')](_0x85f1e5)['end']();};}function respondWithResult(_0x47953e,_0x4279c0){_0x4279c0=_0x4279c0||0xc8;return function(_0x43b71d){if(_0x43b71d){return _0x47953e[_0x4fa9('0x17')](_0x4279c0)[_0x4fa9('0x18')](_0x43b71d);}};}function respondWithFilteredResult(_0x36af3a,_0x438850){return function(_0x2c28be){if(_0x2c28be){var _0x328770=typeof _0x438850['offset']===_0x4fa9('0x19')&&typeof _0x438850[_0x4fa9('0x1a')]==='undefined';var _0x56cf7d=_0x2c28be[_0x4fa9('0x1b')];var _0x4f58bd=_0x328770?0x0:_0x438850[_0x4fa9('0x1c')];var _0x416e08=_0x328770?_0x2c28be['count']:_0x438850[_0x4fa9('0x1c')]+_0x438850['limit'];var _0x3f8036;if(_0x416e08>=_0x56cf7d){_0x416e08=_0x56cf7d;_0x3f8036=0xc8;}else{_0x3f8036=0xce;}_0x36af3a[_0x4fa9('0x17')](_0x3f8036);return _0x36af3a[_0x4fa9('0x1d')](_0x4fa9('0x1e'),_0x4f58bd+'-'+_0x416e08+'/'+_0x56cf7d)[_0x4fa9('0x18')](_0x2c28be);}return null;};}function patchUpdates(_0x5e2576){return function(_0x2e5142){try{jsonpatch[_0x4fa9('0x1f')](_0x2e5142,_0x5e2576,!![]);}catch(_0xa43250){return BPromise['reject'](_0xa43250);}return _0x2e5142[_0x4fa9('0x20')]();};}function saveUpdates(_0x1544b1,_0x31333c){return function(_0x475624){if(_0x475624){return _0x475624[_0x4fa9('0x21')](_0x1544b1)[_0x4fa9('0x22')](function(_0x360262){return _0x360262;});}return null;};}function removeEntity(_0x261db9,_0x185806){return function(_0x1189c6){if(_0x1189c6){return _0x1189c6[_0x4fa9('0x23')]()[_0x4fa9('0x22')](function(){_0x261db9[_0x4fa9('0x17')](0xcc)[_0x4fa9('0x24')]();});}};}function handleEntityNotFound(_0x1d00c9,_0x244c95){return function(_0x1bac66){if(!_0x1bac66){_0x1d00c9[_0x4fa9('0x16')](0x194);}return _0x1bac66;};}function handleError(_0x1fe8ba,_0x31a3fb){_0x31a3fb=_0x31a3fb||0x1f4;return function(_0x498a6f){logger[_0x4fa9('0x25')](_0x498a6f[_0x4fa9('0x26')]);if(_0x498a6f[_0x4fa9('0x27')]){delete _0x498a6f[_0x4fa9('0x27')];}_0x1fe8ba[_0x4fa9('0x17')](_0x31a3fb)[_0x4fa9('0x28')](_0x498a6f);};}exports[_0x4fa9('0x29')]=function(_0x5545b9,_0x384d4e){var _0x1185df={},_0x13cf76={},_0x383d27={'count':0x0,'rows':[]};var _0x112673=_[_0x4fa9('0x2a')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')],function(_0xa9932f){return{'name':_0xa9932f[_0x4fa9('0x2d')],'type':_0xa9932f[_0x4fa9('0x2e')][_0x4fa9('0x2f')]};});_0x13cf76[_0x4fa9('0x30')]=_[_0x4fa9('0x2a')](_0x112673,_0x4fa9('0x27'));_0x13cf76[_0x4fa9('0x31')]=_[_0x4fa9('0x32')](_0x5545b9['query']);_0x13cf76[_0x4fa9('0x33')]=_[_0x4fa9('0x34')](_0x13cf76[_0x4fa9('0x30')],_0x13cf76[_0x4fa9('0x31')]);_0x1185df[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x13cf76['model'],qs[_0x4fa9('0x36')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x1185df['attributes']=_0x1185df[_0x4fa9('0x35')]['length']?_0x1185df['attributes']:_0x13cf76[_0x4fa9('0x30')];if(!_0x5545b9['query'][_0x4fa9('0x37')](_0x4fa9('0x38'))){_0x1185df[_0x4fa9('0x1a')]=qs[_0x4fa9('0x1a')](_0x5545b9['query'][_0x4fa9('0x1a')]);_0x1185df[_0x4fa9('0x1c')]=qs[_0x4fa9('0x1c')](_0x5545b9['query'][_0x4fa9('0x1c')]);}_0x1185df[_0x4fa9('0x39')]=qs[_0x4fa9('0x3a')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3a')]);_0x1185df[_0x4fa9('0x3b')]=qs[_0x4fa9('0x33')](_[_0x4fa9('0x3c')](_0x5545b9[_0x4fa9('0x31')],_0x13cf76[_0x4fa9('0x33')]),_0x112673);if(_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3d')]){_0x1185df['where']=_[_0x4fa9('0x3e')](_0x1185df['where'],{'$or':_['map'](_0x112673,function(_0x21578d){if(_0x21578d['type']!=='VIRTUAL'){var _0x4b05a6={};_0x4b05a6[_0x21578d[_0x4fa9('0x27')]]={'$like':'%'+_0x5545b9[_0x4fa9('0x31')]['filter']+'%'};return _0x4b05a6;}})});}_0x1185df=_[_0x4fa9('0x3e')]({},_0x1185df,_0x5545b9['options']);var _0x493c4f={'where':_0x1185df[_0x4fa9('0x3b')]};return db[_0x4fa9('0x2b')][_0x4fa9('0x1b')](_0x493c4f)[_0x4fa9('0x22')](function(_0x167112){_0x383d27[_0x4fa9('0x1b')]=_0x167112;if(_0x5545b9[_0x4fa9('0x31')]['includeAll']){_0x1185df['include']=[{'all':!![]}];}return db[_0x4fa9('0x2b')]['findAll'](_0x1185df);})[_0x4fa9('0x22')](function(_0x19fe0f){_0x383d27[_0x4fa9('0x3f')]=_0x19fe0f;return _0x383d27;})[_0x4fa9('0x22')](respondWithFilteredResult(_0x384d4e,_0x1185df))['catch'](handleError(_0x384d4e,null));};exports[_0x4fa9('0x40')]=function(_0x51e105,_0xd28126){var _0x2c39bf={'raw':!![],'where':{'id':_0x51e105[_0x4fa9('0x41')]['id']}},_0x14eb12={};_0x14eb12[_0x4fa9('0x30')]=_[_0x4fa9('0x32')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')]);_0x14eb12['query']=_[_0x4fa9('0x32')](_0x51e105[_0x4fa9('0x31')]);_0x14eb12[_0x4fa9('0x33')]=_['intersection'](_0x14eb12[_0x4fa9('0x30')],_0x14eb12[_0x4fa9('0x31')]);_0x2c39bf[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x14eb12[_0x4fa9('0x30')],qs[_0x4fa9('0x36')](_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x2c39bf[_0x4fa9('0x35')]=_0x2c39bf[_0x4fa9('0x35')][_0x4fa9('0x42')]?_0x2c39bf[_0x4fa9('0x35')]:_0x14eb12['model'];if(_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x43')]){_0x2c39bf[_0x4fa9('0x44')]=[{'all':!![]}];}_0x2c39bf=_[_0x4fa9('0x3e')]({},_0x2c39bf,_0x51e105[_0x4fa9('0x45')]);return db[_0x4fa9('0x2b')][_0x4fa9('0x46')](_0x2c39bf)[_0x4fa9('0x22')](handleEntityNotFound(_0xd28126,null))[_0x4fa9('0x22')](respondWithResult(_0xd28126,null))[_0x4fa9('0x47')](handleError(_0xd28126,null));};exports[_0x4fa9('0x48')]=function(_0x5d3b12,_0x5d838c){return db[_0x4fa9('0x2b')]['create'](_0x5d3b12[_0x4fa9('0x49')],{})[_0x4fa9('0x22')](respondWithResult(_0x5d838c,0xc9))[_0x4fa9('0x47')](handleError(_0x5d838c,null));};exports[_0x4fa9('0x21')]=function(_0x306096,_0x12e735){if(_0x306096['body']['id']){delete _0x306096['body']['id'];}return db['WhatsappApplication'][_0x4fa9('0x46')]({'where':{'id':_0x306096['params']['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x12e735,null))[_0x4fa9('0x22')](saveUpdates(_0x306096[_0x4fa9('0x49')],null))[_0x4fa9('0x22')](respondWithResult(_0x12e735,null))['catch'](handleError(_0x12e735,null));};exports[_0x4fa9('0x23')]=function(_0x463bd4,_0x5cd8d1){return db[_0x4fa9('0x2b')][_0x4fa9('0x46')]({'where':{'id':_0x463bd4[_0x4fa9('0x41')]['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x5cd8d1,null))[_0x4fa9('0x22')](removeEntity(_0x5cd8d1,null))[_0x4fa9('0x47')](handleError(_0x5cd8d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1e593c8..8d219bb 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 _0x102b=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0xa5cbbc,_0x312aa4){var _0x109cdd=function(_0x3b712d){while(--_0x3b712d){_0xa5cbbc['push'](_0xa5cbbc['shift']());}};_0x109cdd(++_0x312aa4);}(_0x102b,0x1be));var _0xb102=function(_0x222f2d,_0x4e8292){_0x222f2d=_0x222f2d-0x0;var _0x113192=_0x102b[_0x222f2d];return _0x113192;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var logger=require('../../config/logger')(_0xb102('0x1'));var moment=require(_0xb102('0x2'));var BPromise=require(_0xb102('0x3'));var rp=require(_0xb102('0x4'));var fs=require('fs');var path=require(_0xb102('0x5'));var rimraf=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var attributes=require(_0xb102('0x8'));module['exports']=function(_0x3325b7,_0x370baa){return _0x3325b7[_0xb102('0x9')](_0xb102('0xa'),attributes,{'tableName':_0xb102('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb102('0xc')});}; \ No newline at end of file +var _0xb903=['api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xb903,0x185));var _0x3b90=function(_0x1a70fa,_0x4d1bc1){_0x1a70fa=_0x1a70fa-0x0;var _0x5d1257=_0xb903[_0x1a70fa];return _0x5d1257;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('WhatsappApplication',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b90('0xc'),'collate':_0x3b90('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7094506..9ba8a63 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0x99e9,0xb4));var _0x999e=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x99e9[_0x289a67];return _0x572b49;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x47b858,_0x26f9d8){var _0x26ad0f=function(_0x4af27b){while(--_0x4af27b){_0x47b858['push'](_0x47b858['shift']());}};_0x26ad0f(++_0x26f9d8);}(_0x70e0,0x17b));var _0x070e=function(_0x42d188,_0x43f531){_0x42d188=_0x42d188-0x0;var _0x14a4af=_0x70e0[_0x42d188];return _0x14a4af;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e82e61b..672d923 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 _0xfc17=['create','/:id/messages','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsappinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','post'];(function(_0x534000,_0x48d4be){var _0xfb39ac=function(_0x39d9b7){while(--_0x39d9b7){_0x534000['push'](_0x534000['shift']());}};_0xfb39ac(++_0x48d4be);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x38dea3,_0x5591cc){_0x38dea3=_0x38dea3-0x0;var _0x350734=_0xfc17[_0x38dea3];return _0x350734;};'use strict';var multer=require(_0x7fc1('0x0'));var util=require(_0x7fc1('0x1'));var path=require(_0x7fc1('0x2'));var timeout=require(_0x7fc1('0x3'));var express=require('express');var router=express[_0x7fc1('0x4')]();var fs_extra=require(_0x7fc1('0x5'));var auth=require(_0x7fc1('0x6'));var interaction=require(_0x7fc1('0x7'));var config=require(_0x7fc1('0x8'));var controller=require(_0x7fc1('0x9'));router['get']('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xb')]);router[_0x7fc1('0xc')](_0x7fc1('0xd'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xe')]);router[_0x7fc1('0xc')]('/:id',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xf')]);router[_0x7fc1('0xc')]('/:id/messages',auth[_0x7fc1('0xa')](),controller['getMessages']);router['get'](_0x7fc1('0x10'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x11')]);router[_0x7fc1('0x12')]('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x13')]);router[_0x7fc1('0x12')](_0x7fc1('0x14'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x15')]);router[_0x7fc1('0x12')](_0x7fc1('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x7fc1('0x17'),_0x7fc1('0x18')),controller[_0x7fc1('0x19')]);router[_0x7fc1('0x1a')](_0x7fc1('0x1b'),auth[_0x7fc1('0xa')](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),_0x7fc1('0x1d')),controller[_0x7fc1('0x1e')]);router['delete'](_0x7fc1('0x1b'),auth['isAuthenticated'](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),'whatsappinteraction:destroy'),controller[_0x7fc1('0x1f')]);router[_0x7fc1('0x20')]('/:id/tags',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x21')]);module[_0x7fc1('0x22')]=router; \ No newline at end of file +var _0xa46e=['get','index','isAuthenticated','describe','/:id','getMessages','/:id/download','download','create','/:id/messages','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0xa46e,0x8a));var _0xea46=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xa46e[_0x18b344];return _0x5ef6bb;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['get'](_0xea46('0xd'),auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router['post']('/',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);router['post'](_0xea46('0x10'),auth[_0xea46('0x9')](),controller['addMessage']);router[_0xea46('0x11')]('/:id/tags',auth[_0xea46('0x9')](),interaction[_0xea46('0x12')](_0xea46('0x13'),_0xea46('0x14')),controller[_0xea46('0x15')]);router[_0xea46('0x16')](_0xea46('0xb'),auth[_0xea46('0x9')](),interaction[_0xea46('0x12')]('whatsapp',_0xea46('0x17')),controller[_0xea46('0x18')]);router[_0xea46('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xea46('0x12')](_0xea46('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xea46('0x19')](_0xea46('0x1a'),auth['isAuthenticated'](),controller[_0xea46('0x1b')]);module[_0xea46('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 372770c..c3ef2fa 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 _0xf954=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x3579fa,_0x3a34a9){var _0x114b1b=function(_0x27b094){while(--_0x27b094){_0x3579fa['push'](_0x3579fa['shift']());}};_0x114b1b(++_0x3a34a9);}(_0xf954,0x10e));var _0x4f95=function(_0x3cd881,_0x525fbd){_0x3cd881=_0x3cd881-0x0;var _0x16907d=_0xf954[_0x3cd881];return _0x16907d;};'use strict';var Sequelize=require(_0x4f95('0x0'));var moment=require(_0x4f95('0x1'));module[_0x4f95('0x2')]={'closed':{'type':Sequelize[_0x4f95('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f95('0x4')]},'disposition':{'type':Sequelize[_0x4f95('0x5')]},'secondDisposition':{'type':Sequelize[_0x4f95('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4f95('0x5')]},'read1stAt':{'type':Sequelize[_0x4f95('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4f95('0x6')]('in',_0x4f95('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4f95('0x6')]('in',_0x4f95('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4f95('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4f95('0x8')]}}; \ No newline at end of file +var _0xad9f=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x2fba6f,_0x46cea4){var _0x4731c9=function(_0x1c08ad){while(--_0x1c08ad){_0x2fba6f['push'](_0x2fba6f['shift']());}};_0x4731c9(++_0x46cea4);}(_0xad9f,0x1be));var _0xfad9=function(_0x235f8f,_0x20898a){_0x235f8f=_0x235f8f-0x0;var _0x2c28bd=_0xad9f[_0x235f8f];return _0x2c28bd;};'use strict';var Sequelize=require(_0xfad9('0x0'));var moment=require(_0xfad9('0x1'));module[_0xfad9('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfad9('0x3')]},'disposition':{'type':Sequelize[_0xfad9('0x4')]},'secondDisposition':{'type':Sequelize[_0xfad9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfad9('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfad9('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfad9('0x5')]('in',_0xfad9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfad9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfad9('0x5')]('in',_0xfad9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfad9('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index aa20418..7b884a6 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 _0x1cce=['path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','options','create','body','catch','describe','addMessage','WhatsappMessage','find','omit','ids','getMessages','hasOwnProperty','nolimit','order','where','pick','WhatsappInteractionId','filter','merge','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','Account','Owner','fullname','mkdirSync','Whatsapp','N.A.','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x1cce,0x7e));var _0xe1cc=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x1cce[_0x476b00];return _0x44ec8e;};'use strict';var rimraf=require(_0xe1cc('0x0'));var zipdir=require(_0xe1cc('0x1'));var moment=require(_0xe1cc('0x2'));var BPromise=require(_0xe1cc('0x3'));var util=require(_0xe1cc('0x4'));var path=require(_0xe1cc('0x5'));var ejs=require(_0xe1cc('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe1cc('0x7'));var interaction=require(_0xe1cc('0x8'));var qs=require(_0xe1cc('0x9'));var pdf=require(_0xe1cc('0xa'));var logger=require('../../config/logger')(_0xe1cc('0xb'));var config=require(_0xe1cc('0xc'));var db=require(_0xe1cc('0xd'))['db'];config[_0xe1cc('0xe')]=_[_0xe1cc('0xf')](config[_0xe1cc('0xe')],{'host':_0xe1cc('0x10'),'port':0x18eb});var socket=require(_0xe1cc('0x11'))(new Redis(config[_0xe1cc('0xe')]));require(_0xe1cc('0x12'))[_0xe1cc('0x13')](socket);function respondWithStatusCode(_0x3327bc,_0x14a93a){_0x14a93a=_0x14a93a||0xcc;return function(_0x212c3a){if(_0x212c3a){return _0x3327bc[_0xe1cc('0x14')](_0x14a93a);}return _0x3327bc[_0xe1cc('0x15')](_0x14a93a)[_0xe1cc('0x16')]();};}function respondWithResult(_0x1b8c7d,_0x458b61){_0x458b61=_0x458b61||0xc8;return function(_0x1f61eb){if(_0x1f61eb){return _0x1b8c7d['status'](_0x458b61)[_0xe1cc('0x17')](_0x1f61eb);}};}function respondWithFilteredResult(_0x2a8341,_0x4a5cbe){return function(_0x28b38d){if(_0x28b38d){var _0x3d3340=typeof _0x4a5cbe[_0xe1cc('0x18')]==='undefined'&&typeof _0x4a5cbe[_0xe1cc('0x19')]===_0xe1cc('0x1a');var _0x4e5c3a=_0x28b38d['count'];var _0x571d13=_0x3d3340?0x0:_0x4a5cbe[_0xe1cc('0x18')];var _0xb45115=_0x3d3340?_0x28b38d[_0xe1cc('0x1b')]:_0x4a5cbe[_0xe1cc('0x18')]+_0x4a5cbe[_0xe1cc('0x19')];var _0x5dd612;if(_0xb45115>=_0x4e5c3a){_0xb45115=_0x4e5c3a;_0x5dd612=0xc8;}else{_0x5dd612=0xce;}_0x2a8341[_0xe1cc('0x15')](_0x5dd612);return _0x2a8341['set'](_0xe1cc('0x1c'),_0x571d13+'-'+_0xb45115+'/'+_0x4e5c3a)[_0xe1cc('0x17')](_0x28b38d);}return null;};}function saveUpdates(_0x2a6543){return function(_0x1ab552){if(_0x1ab552){return _0x1ab552[_0xe1cc('0x1d')](_0x2a6543)[_0xe1cc('0x1e')](function(_0x348aa0){return _0x348aa0;});}return null;};}function removeEntity(_0x100cfc){return function(_0x31b05b){if(_0x31b05b){return _0x31b05b[_0xe1cc('0x1f')]()[_0xe1cc('0x1e')](function(){_0x100cfc[_0xe1cc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbbab5a){return function(_0x1cb52b){if(!_0x1cb52b){_0xbbab5a[_0xe1cc('0x14')](0x194);}return _0x1cb52b;};}function handleError(_0x53717a,_0x1a531e){_0x1a531e=_0x1a531e||0x1f4;return function(_0xaa6964){logger[_0xe1cc('0x20')](_0xaa6964[_0xe1cc('0x21')]);if(_0xaa6964['name']){delete _0xaa6964[_0xe1cc('0x22')];}_0x53717a[_0xe1cc('0x15')](_0x1a531e)[_0xe1cc('0x23')](_0xaa6964);};}exports[_0xe1cc('0x24')]=function(_0xbccc7c,_0x151952){var _0x48aa38={};var _0x116fb2=_[_0xe1cc('0x25')](db[_0xe1cc('0x26')][_0xe1cc('0x27')],function(_0x476095){return{'name':_0x476095['fieldName'],'type':_0x476095[_0xe1cc('0x28')][_0xe1cc('0x29')]};});_0x48aa38=qs[_0xe1cc('0x2a')](_0x116fb2,_0xbccc7c);return interaction[_0xe1cc('0x2b')](_0xe1cc('0x2c'),_0xbccc7c[_0xe1cc('0x2d')],_0xbccc7c['user'],_0x48aa38,_0x116fb2)[_0xe1cc('0x1e')](respondWithFilteredResult(_0x151952,_0x48aa38))['catch'](handleError(_0x151952,null));};exports[_0xe1cc('0x2e')]=function(_0x36c31f,_0x58f279){var _0x57bf8a={'raw':![],'where':{'id':_0x36c31f[_0xe1cc('0x2f')]['id']}},_0x56a707={};_0x56a707['model']=_[_0xe1cc('0x30')](db[_0xe1cc('0x26')]['rawAttributes']);_0x56a707[_0xe1cc('0x2d')]=_[_0xe1cc('0x30')](_0x36c31f[_0xe1cc('0x2d')]);_0x56a707[_0xe1cc('0x31')]=_[_0xe1cc('0x32')](_0x56a707['model'],_0x56a707[_0xe1cc('0x2d')]);_0x57bf8a[_0xe1cc('0x33')]=_[_0xe1cc('0x32')](_0x56a707[_0xe1cc('0x34')],qs[_0xe1cc('0x35')](_0x36c31f['query'][_0xe1cc('0x35')]));_0x57bf8a[_0xe1cc('0x33')]=_0x57bf8a['attributes'][_0xe1cc('0x36')]?_0x57bf8a[_0xe1cc('0x33')]:_0x56a707[_0xe1cc('0x34')];if(_0x36c31f[_0xe1cc('0x2d')][_0xe1cc('0x37')]){_0x57bf8a[_0xe1cc('0x38')]=[{'all':!![]}];}_0x57bf8a=_['merge']({},_0x57bf8a,_0x36c31f[_0xe1cc('0x39')]);return db[_0xe1cc('0x26')]['find'](_0x57bf8a)['then'](handleEntityNotFound(_0x58f279,null))[_0xe1cc('0x1e')](respondWithResult(_0x58f279,null))['catch'](handleError(_0x58f279,null));};exports[_0xe1cc('0x3a')]=function(_0x5996db,_0x45b364){return db[_0xe1cc('0x26')]['create'](_0x5996db[_0xe1cc('0x3b')],{})[_0xe1cc('0x1e')](respondWithResult(_0x45b364,0xc9))[_0xe1cc('0x3c')](handleError(_0x45b364,null));};exports['update']=function(_0x57ff81,_0x9bf969){if(_0x57ff81[_0xe1cc('0x3b')]['id']){delete _0x57ff81['body']['id'];}return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x57ff81[_0xe1cc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x9bf969,null))['then'](saveUpdates(_0x57ff81[_0xe1cc('0x3b')],null))['then'](respondWithResult(_0x9bf969,null))['catch'](handleError(_0x9bf969,null));};exports[_0xe1cc('0x1f')]=function(_0x528a2b,_0x93dc51){return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x528a2b['params']['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x93dc51,null))['then'](removeEntity(_0x93dc51,null))[_0xe1cc('0x3c')](handleError(_0x93dc51,null));};exports['describe']=function(_0x44eeb1,_0x56dfd5){return db[_0xe1cc('0x26')][_0xe1cc('0x3d')]()[_0xe1cc('0x1e')](respondWithResult(_0x56dfd5,null))[_0xe1cc('0x3c')](handleError(_0x56dfd5,null));};exports[_0xe1cc('0x3e')]=function(_0x5b41fd,_0x2676f1){return db[_0xe1cc('0x3f')][_0xe1cc('0x40')]({'where':{'id':_0x5b41fd[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x2676f1,null))[_0xe1cc('0x1e')](function(_0x46c48e){if(_0x46c48e){return _0x46c48e[_0xe1cc('0x3e')](_0x5b41fd['body']['ids'],_[_0xe1cc('0x41')](_0x5b41fd[_0xe1cc('0x3b')],[_0xe1cc('0x42'),'id'])||{});}})[_0xe1cc('0x1e')](respondWithResult(_0x2676f1,null))[_0xe1cc('0x3c')](handleError(_0x2676f1,null));};exports[_0xe1cc('0x43')]=function(_0x312bf9,_0x256514){var _0x597ff5={'raw':![],'where':{}};var _0x388184={};var _0xd95fac={'count':0x0,'rows':[]};return db[_0xe1cc('0x26')]['findOne']({'where':{'id':_0x312bf9[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x256514,null))['then'](function(_0x20b7fb){if(_0x20b7fb){_0x388184['model']=_['keys'](db[_0xe1cc('0x3f')]['rawAttributes']);_0x388184['query']=_['keys'](_0x312bf9[_0xe1cc('0x2d')]);_0x388184[_0xe1cc('0x31')]=_[_0xe1cc('0x32')](_0x388184[_0xe1cc('0x34')],_0x388184[_0xe1cc('0x2d')]);_0x597ff5[_0xe1cc('0x33')]=_['intersection'](_0x388184[_0xe1cc('0x34')],qs[_0xe1cc('0x35')](_0x312bf9[_0xe1cc('0x2d')]['fields']));_0x597ff5[_0xe1cc('0x33')]=_0x597ff5[_0xe1cc('0x33')]['length']?_0x597ff5[_0xe1cc('0x33')]:_0x388184[_0xe1cc('0x34')];if(!_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x44')](_0xe1cc('0x45'))){_0x597ff5[_0xe1cc('0x19')]=qs[_0xe1cc('0x19')](_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x19')]);_0x597ff5['offset']=qs[_0xe1cc('0x18')](_0x312bf9[_0xe1cc('0x2d')]['offset']);}_0x597ff5[_0xe1cc('0x46')]=qs['sort'](_0x312bf9['query']['sort']);_0x597ff5[_0xe1cc('0x47')]=qs[_0xe1cc('0x31')](_[_0xe1cc('0x48')](_0x312bf9[_0xe1cc('0x2d')],_0x388184[_0xe1cc('0x31')]));_0x597ff5['where'][_0xe1cc('0x49')]=_0x20b7fb['id'];if(_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x4a')]){_0x597ff5[_0xe1cc('0x47')]=_[_0xe1cc('0x4b')](_0x597ff5[_0xe1cc('0x47')],{'$or':_[_0xe1cc('0x25')](_0x597ff5[_0xe1cc('0x33')],function(_0x3fbac5){var _0x4fff46={};_0x4fff46[_0x3fbac5]={'$like':'%'+_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x4a')]+'%'};return _0x4fff46;})});}if(_0x312bf9[_0xe1cc('0x2d')]['$gte']){var _0x754fa0=_0x312bf9[_0xe1cc('0x2d')]['$gte']['split'](',');var _0x3b8a66={};_0x3b8a66[_0x754fa0[0x0]]={'$gte':moment(_0x754fa0[0x1])[_0xe1cc('0x4c')](_0xe1cc('0x4d'))};_0x597ff5[_0xe1cc('0x47')]=_['merge'](_0x597ff5[_0xe1cc('0x47')],_0x3b8a66);}_0x597ff5=_[_0xe1cc('0x4b')]({},_0x597ff5,_0x312bf9[_0xe1cc('0x39')]);return db[_0xe1cc('0x3f')]['count']({'where':_0x597ff5[_0xe1cc('0x47')]})['then'](function(_0x547fe9){_0xd95fac[_0xe1cc('0x1b')]=_0x547fe9;if(_0x312bf9['query'][_0xe1cc('0x37')]){_0x597ff5['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xe1cc('0x2b')](_0x597ff5);})[_0xe1cc('0x1e')](function(_0x4e4d7e){_0xd95fac[_0xe1cc('0x4e')]=_0x4e4d7e;return _0xd95fac;});}})[_0xe1cc('0x1e')](respondWithFilteredResult(_0x256514,_0x597ff5))[_0xe1cc('0x3c')](handleError(_0x256514,null));};exports[_0xe1cc('0x4f')]=function(_0x4e2c2e,_0x5cb2d2){return db[_0xe1cc('0x26')][_0xe1cc('0x40')]({'where':{'id':_0x4e2c2e[_0xe1cc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5cb2d2,null))['then'](function(_0x49382f){if(_0x49382f){return _0x49382f['setTags'](_0x4e2c2e[_0xe1cc('0x3b')][_0xe1cc('0x42')],_[_0xe1cc('0x41')](_0x4e2c2e[_0xe1cc('0x3b')],['ids','id'])||{})[_0xe1cc('0x50')](function(){return db[_0xe1cc('0x51')]['findAll']({'attributes':['id',_0xe1cc('0x22'),_0xe1cc('0x52')],'where':{'id':_0x4e2c2e['body'][_0xe1cc('0x42')]}});})[_0xe1cc('0x1e')](function(_0x58a1c8){socket[_0xe1cc('0x53')](_0xe1cc('0x54'),{'id':Number(_0x4e2c2e['params']['id']),'tags':_0x58a1c8||[]});return{'id':Number(_0x4e2c2e['params']['id']),'tags':_0x58a1c8||[]};});}})['then'](respondWithResult(_0x5cb2d2,null))[_0xe1cc('0x3c')](handleError(_0x5cb2d2,null));};exports[_0xe1cc('0x55')]=function(_0x42da72,_0x298c12){return db['WhatsappInteraction']['find']({'where':{'id':_0x42da72[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x298c12,null))[_0xe1cc('0x1e')](function(_0x14a222){if(_0x14a222){return _0x14a222['removeTags'](_0x42da72[_0xe1cc('0x2d')]['ids']);}})[_0xe1cc('0x1e')](respondWithStatusCode(_0x298c12,null))[_0xe1cc('0x3c')](handleError(_0x298c12,null));};exports[_0xe1cc('0x56')]=function(_0x3b4cbd,_0x54d018){var _0x279c80=moment()['unix']()['toString']();var _0x3f9960=path[_0xe1cc('0x57')](config['root'],_0xe1cc('0x58'),_0xe1cc('0x59'),_0xe1cc('0x5a'));var _0x1c380f=path['join'](config[_0xe1cc('0x5b')],'server',_0xe1cc('0x59'),_0xe1cc('0x5c'));var _0x1910a7=path[_0xe1cc('0x57')](_0x3f9960,_0x279c80);var _0x13d9ae=util[_0xe1cc('0x4c')](_0xe1cc('0x5d'),_0x3b4cbd[_0xe1cc('0x2f')]['id'],_0x279c80);var _0xe5606=path['join'](_0x3f9960,_0x13d9ae);var _0xbdddfa=[];_0xbdddfa[_0xe1cc('0x5e')]({'model':db[_0xe1cc('0x5f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xbdddfa['push']({'model':db['CmContact'],'as':_0xe1cc('0x60'),'attributes':['id',_0xe1cc('0x61'),_0xe1cc('0x62')],'raw':!![]});if(_0x3b4cbd[_0xe1cc('0x2d')][_0xe1cc('0x5c')]){_0xbdddfa[_0xe1cc('0x5e')]({'model':db['Attachment'],'as':_0xe1cc('0x63'),'raw':!![]});}var _0x508eb1=[{'model':db[_0xe1cc('0x3f')],'as':_0xe1cc('0x64'),'attributes':['id',_0xe1cc('0x3b'),_0xe1cc('0x65'),'direction','secret','read'],'include':_0xbdddfa}];_0x508eb1[_0xe1cc('0x5e')]({'model':db['WhatsappAccount'],'as':_0xe1cc('0x66'),'attributes':['id',_0xe1cc('0x22')]});_0x508eb1[_0xe1cc('0x5e')]({'model':db[_0xe1cc('0x5f')],'as':_0xe1cc('0x67'),'attributes':['id',_0xe1cc('0x68')]});return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x3b4cbd[_0xe1cc('0x2f')]['id']},'include':_0x508eb1})[_0xe1cc('0x1e')](handleEntityNotFound(_0x54d018,null))[_0xe1cc('0x1e')](function(_0x1ed5c6){if(_0x1ed5c6){var _0x267449=_0x1ed5c6['get']({'plain':!![]});fs[_0xe1cc('0x69')](_0x1910a7);var _0x22f88b={'channel':_0xe1cc('0x6a'),'account':_0x267449[_0xe1cc('0x66')][_0xe1cc('0x22')],'agent':_0x267449[_0xe1cc('0x67')]?_0x267449['Owner'][_0xe1cc('0x68')]:_0xe1cc('0x6b'),'createdAt':moment(_0x267449[_0xe1cc('0x65')])[_0xe1cc('0x4c')](_0xe1cc('0x4d'))[_0xe1cc('0x6c')](),'closedAt':_0x267449[_0xe1cc('0x6d')]?moment(_0x267449[_0xe1cc('0x6e')])['format'](_0xe1cc('0x4d'))['toString']():'','disposition':_0x267449[_0xe1cc('0x6f')],'messages':_(_0x267449[_0xe1cc('0x64')])[_0xe1cc('0x4a')]({'secret':![]})[_0xe1cc('0x25')](function(_0x5331af){if(_0x5331af['Attachment']){var _0x8059b3=path[_0xe1cc('0x57')](_0x1c380f,_0x5331af[_0xe1cc('0x63')][_0xe1cc('0x70')]);if(fs[_0xe1cc('0x71')](_0x8059b3)){fs[_0xe1cc('0x72')](_0x8059b3)[_0xe1cc('0x73')](fs[_0xe1cc('0x74')](path[_0xe1cc('0x57')](_0x1910a7,_0x5331af['Attachment']['basename'])));}}return{'date':moment(_0x5331af[_0xe1cc('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5331af[_0xe1cc('0x75')]===_0xe1cc('0x76')?_0x5331af[_0xe1cc('0x5f')]?_0x5331af[_0xe1cc('0x5f')]['fullname']:_0xe1cc('0x77'):_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x61')]+(_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x62')]?'\x20'+_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x62')]:''),'body':_0x5331af[_0xe1cc('0x63')]?_0x5331af[_0xe1cc('0x63')][_0xe1cc('0x70')]:_0x5331af[_0xe1cc('0x3b')],'direction':_0x5331af['direction']===_0xe1cc('0x76')?'A':'C','secret':_0x5331af[_0xe1cc('0x78')],'read':_0x5331af[_0xe1cc('0x79')],'attachment':_0x5331af['Attachment']};})[_0xe1cc('0x7a')]()};return ejs[_0xe1cc('0x7b')](path[_0xe1cc('0x57')](config[_0xe1cc('0x5b')],_0xe1cc('0x58'),_0xe1cc('0x7c'),_0xe1cc('0x7d')),{'interaction':_0x22f88b})[_0xe1cc('0x1e')](function(_0xd41f23){var _0x3d21e1=path['join'](_0x1910a7,_0xe1cc('0x7e')+_0x267449['id']+'-'+_0x279c80+'.pdf');var _0x240d68={'path':_0x3d21e1,'channel':'Whatsapp','interactionId':_0x267449['id']};return pdf[_0xe1cc('0x7f')](_0xd41f23,_0x240d68);})[_0xe1cc('0x1e')](function(){return new BPromise(function(_0x46ef60,_0x8d01b9){zipdir(_0x1910a7,{'saveTo':_0xe5606},function(_0x3f0cbe,_0x5db10f){if(_0x3f0cbe)return _0x8d01b9(_0x3f0cbe);return _0x46ef60(_0x5db10f);});})[_0xe1cc('0x1e')](function(){return new BPromise(function(_0x90624e,_0x259f46){rimraf(_0x1910a7,function(_0x191276){if(_0x191276)_0x259f46(_0x191276);return _0x90624e();});});})[_0xe1cc('0x1e')](function(){return _0x54d018[_0xe1cc('0x56')](_0xe5606,_0x13d9ae,function(_0x103b92){if(_0x103b92){console[_0xe1cc('0x80')](_0xe1cc('0x81'),_0x103b92);}else{fs[_0xe1cc('0x82')](_0xe5606);}});});});}else{return _0x54d018[_0xe1cc('0x14')](0xc8);}})[_0xe1cc('0x3c')](handleError(_0x54d018,null));}; \ No newline at end of file +var _0x5fb7=['filters','intersection','fields','attributes','includeAll','include','merge','find','create','body','update','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','rawAttributes','length','hasOwnProperty','nolimit','order','pick','where','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','tmp','server','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','createReadStream','pipe','direction','out','System','lastName','basename','secret','value','renderFile','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','type','getOptions','findAll','whatsapp','catch','show','model','keys','WhatsappInteraction','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fb7,0xd8));var _0x75fb=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5fb7[_0x344a3f];return _0x264712;};'use strict';var rimraf=require(_0x75fb('0x0'));var zipdir=require('zip-dir');var moment=require(_0x75fb('0x1'));var BPromise=require(_0x75fb('0x2'));var util=require(_0x75fb('0x3'));var path=require('path');var ejs=require(_0x75fb('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x75fb('0x5'));var interaction=require(_0x75fb('0x6'));var qs=require(_0x75fb('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x75fb('0x8'))(_0x75fb('0x9'));var config=require(_0x75fb('0xa'));var db=require(_0x75fb('0xb'))['db'];config[_0x75fb('0xc')]=_[_0x75fb('0xd')](config[_0x75fb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x75fb('0xe'))(new Redis(config[_0x75fb('0xc')]));require(_0x75fb('0xf'))[_0x75fb('0x10')](socket);function respondWithStatusCode(_0x2cece0,_0x3ed86b){_0x3ed86b=_0x3ed86b||0xcc;return function(_0x1a7368){if(_0x1a7368){return _0x2cece0[_0x75fb('0x11')](_0x3ed86b);}return _0x2cece0[_0x75fb('0x12')](_0x3ed86b)['end']();};}function respondWithResult(_0x2cf160,_0x23597e){_0x23597e=_0x23597e||0xc8;return function(_0x185a9f){if(_0x185a9f){return _0x2cf160['status'](_0x23597e)[_0x75fb('0x13')](_0x185a9f);}};}function respondWithFilteredResult(_0x36558a,_0xb83552){return function(_0x45f607){if(_0x45f607){var _0x1ecd64=typeof _0xb83552[_0x75fb('0x14')]===_0x75fb('0x15')&&typeof _0xb83552[_0x75fb('0x16')]==='undefined';var _0x88722d=_0x45f607[_0x75fb('0x17')];var _0x29d9b3=_0x1ecd64?0x0:_0xb83552['offset'];var _0x7236cc=_0x1ecd64?_0x45f607['count']:_0xb83552[_0x75fb('0x14')]+_0xb83552['limit'];var _0x399d6f;if(_0x7236cc>=_0x88722d){_0x7236cc=_0x88722d;_0x399d6f=0xc8;}else{_0x399d6f=0xce;}_0x36558a[_0x75fb('0x12')](_0x399d6f);return _0x36558a[_0x75fb('0x18')](_0x75fb('0x19'),_0x29d9b3+'-'+_0x7236cc+'/'+_0x88722d)[_0x75fb('0x13')](_0x45f607);}return null;};}function saveUpdates(_0xa30d0f){return function(_0x24ab0e){if(_0x24ab0e){return _0x24ab0e['update'](_0xa30d0f)[_0x75fb('0x1a')](function(_0x35a8d5){return _0x35a8d5;});}return null;};}function removeEntity(_0x5cf8ba){return function(_0x48a747){if(_0x48a747){return _0x48a747[_0x75fb('0x1b')]()['then'](function(){_0x5cf8ba[_0x75fb('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x581104){return function(_0x14d782){if(!_0x14d782){_0x581104[_0x75fb('0x11')](0x194);}return _0x14d782;};}function handleError(_0x5729ac,_0x5e12b2){_0x5e12b2=_0x5e12b2||0x1f4;return function(_0x6021f3){logger[_0x75fb('0x1c')](_0x6021f3[_0x75fb('0x1d')]);if(_0x6021f3['name']){delete _0x6021f3[_0x75fb('0x1e')];}_0x5729ac['status'](_0x5e12b2)[_0x75fb('0x1f')](_0x6021f3);};}exports[_0x75fb('0x20')]=function(_0x21eb03,_0x10f2ad){var _0x3e3725={};var _0x565c61=_[_0x75fb('0x21')](db['WhatsappInteraction']['rawAttributes'],function(_0x175a3e){return{'name':_0x175a3e['fieldName'],'type':_0x175a3e[_0x75fb('0x22')]['key']};});_0x3e3725=qs[_0x75fb('0x23')](_0x565c61,_0x21eb03);return interaction[_0x75fb('0x24')](_0x75fb('0x25'),_0x21eb03['query'],_0x21eb03['user'],_0x3e3725,_0x565c61)['then'](respondWithFilteredResult(_0x10f2ad,_0x3e3725))[_0x75fb('0x26')](handleError(_0x10f2ad,null));};exports[_0x75fb('0x27')]=function(_0x21a9aa,_0x4d64ee){var _0x3cac11={'raw':![],'where':{'id':_0x21a9aa['params']['id']}},_0x2c3386={};_0x2c3386[_0x75fb('0x28')]=_[_0x75fb('0x29')](db[_0x75fb('0x2a')]['rawAttributes']);_0x2c3386[_0x75fb('0x2b')]=_['keys'](_0x21a9aa[_0x75fb('0x2b')]);_0x2c3386[_0x75fb('0x2c')]=_[_0x75fb('0x2d')](_0x2c3386[_0x75fb('0x28')],_0x2c3386[_0x75fb('0x2b')]);_0x3cac11['attributes']=_[_0x75fb('0x2d')](_0x2c3386[_0x75fb('0x28')],qs[_0x75fb('0x2e')](_0x21a9aa[_0x75fb('0x2b')][_0x75fb('0x2e')]));_0x3cac11[_0x75fb('0x2f')]=_0x3cac11['attributes']['length']?_0x3cac11[_0x75fb('0x2f')]:_0x2c3386[_0x75fb('0x28')];if(_0x21a9aa[_0x75fb('0x2b')][_0x75fb('0x30')]){_0x3cac11[_0x75fb('0x31')]=[{'all':!![]}];}_0x3cac11=_[_0x75fb('0x32')]({},_0x3cac11,_0x21a9aa['options']);return db[_0x75fb('0x2a')][_0x75fb('0x33')](_0x3cac11)[_0x75fb('0x1a')](handleEntityNotFound(_0x4d64ee,null))[_0x75fb('0x1a')](respondWithResult(_0x4d64ee,null))['catch'](handleError(_0x4d64ee,null));};exports['create']=function(_0x3c6e53,_0x372819){return db[_0x75fb('0x2a')][_0x75fb('0x34')](_0x3c6e53[_0x75fb('0x35')],{})[_0x75fb('0x1a')](respondWithResult(_0x372819,0xc9))[_0x75fb('0x26')](handleError(_0x372819,null));};exports[_0x75fb('0x36')]=function(_0x951a84,_0x2e5803){if(_0x951a84[_0x75fb('0x35')]['id']){delete _0x951a84[_0x75fb('0x35')]['id'];}return db[_0x75fb('0x2a')][_0x75fb('0x33')]({'where':{'id':_0x951a84[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x2e5803,null))[_0x75fb('0x1a')](saveUpdates(_0x951a84[_0x75fb('0x35')],null))['then'](respondWithResult(_0x2e5803,null))[_0x75fb('0x26')](handleError(_0x2e5803,null));};exports['destroy']=function(_0x30e45d,_0x3f8779){return db[_0x75fb('0x2a')][_0x75fb('0x33')]({'where':{'id':_0x30e45d[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x3f8779,null))[_0x75fb('0x1a')](removeEntity(_0x3f8779,null))['catch'](handleError(_0x3f8779,null));};exports['describe']=function(_0x4f4e32,_0x546e47){return db['WhatsappInteraction'][_0x75fb('0x38')]()[_0x75fb('0x1a')](respondWithResult(_0x546e47,null))['catch'](handleError(_0x546e47,null));};exports[_0x75fb('0x39')]=function(_0x4209b4,_0x51b74e){return db['WhatsappMessage'][_0x75fb('0x33')]({'where':{'id':_0x4209b4[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x51b74e,null))['then'](function(_0x10d2ac){if(_0x10d2ac){return _0x10d2ac[_0x75fb('0x39')](_0x4209b4['body'][_0x75fb('0x3a')],_[_0x75fb('0x3b')](_0x4209b4[_0x75fb('0x35')],['ids','id'])||{});}})[_0x75fb('0x1a')](respondWithResult(_0x51b74e,null))['catch'](handleError(_0x51b74e,null));};exports[_0x75fb('0x3c')]=function(_0x20e2ce,_0x586b6b){var _0x327ec9={'raw':![],'where':{}};var _0x28c85a={};var _0x39b517={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x75fb('0x3d')]({'where':{'id':_0x20e2ce[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x586b6b,null))[_0x75fb('0x1a')](function(_0x4fdbb0){if(_0x4fdbb0){_0x28c85a[_0x75fb('0x28')]=_['keys'](db[_0x75fb('0x3e')][_0x75fb('0x3f')]);_0x28c85a[_0x75fb('0x2b')]=_[_0x75fb('0x29')](_0x20e2ce[_0x75fb('0x2b')]);_0x28c85a[_0x75fb('0x2c')]=_[_0x75fb('0x2d')](_0x28c85a[_0x75fb('0x28')],_0x28c85a['query']);_0x327ec9[_0x75fb('0x2f')]=_['intersection'](_0x28c85a[_0x75fb('0x28')],qs[_0x75fb('0x2e')](_0x20e2ce['query'][_0x75fb('0x2e')]));_0x327ec9[_0x75fb('0x2f')]=_0x327ec9[_0x75fb('0x2f')][_0x75fb('0x40')]?_0x327ec9[_0x75fb('0x2f')]:_0x28c85a[_0x75fb('0x28')];if(!_0x20e2ce['query'][_0x75fb('0x41')](_0x75fb('0x42'))){_0x327ec9['limit']=qs[_0x75fb('0x16')](_0x20e2ce['query']['limit']);_0x327ec9[_0x75fb('0x14')]=qs[_0x75fb('0x14')](_0x20e2ce['query'][_0x75fb('0x14')]);}_0x327ec9[_0x75fb('0x43')]=qs['sort'](_0x20e2ce[_0x75fb('0x2b')]['sort']);_0x327ec9['where']=qs[_0x75fb('0x2c')](_[_0x75fb('0x44')](_0x20e2ce[_0x75fb('0x2b')],_0x28c85a[_0x75fb('0x2c')]));_0x327ec9[_0x75fb('0x45')][_0x75fb('0x46')]=_0x4fdbb0['id'];if(_0x20e2ce[_0x75fb('0x2b')][_0x75fb('0x47')]){_0x327ec9[_0x75fb('0x45')]=_[_0x75fb('0x32')](_0x327ec9['where'],{'$or':_[_0x75fb('0x21')](_0x327ec9[_0x75fb('0x2f')],function(_0x8160a9){var _0x1e65f1={};_0x1e65f1[_0x8160a9]={'$like':'%'+_0x20e2ce['query']['filter']+'%'};return _0x1e65f1;})});}if(_0x20e2ce[_0x75fb('0x2b')]['$gte']){var _0x27a7f4=_0x20e2ce['query'][_0x75fb('0x48')][_0x75fb('0x49')](',');var _0x5dd70a={};_0x5dd70a[_0x27a7f4[0x0]]={'$gte':moment(_0x27a7f4[0x1])['format'](_0x75fb('0x4a'))};_0x327ec9[_0x75fb('0x45')]=_['merge'](_0x327ec9[_0x75fb('0x45')],_0x5dd70a);}_0x327ec9=_[_0x75fb('0x32')]({},_0x327ec9,_0x20e2ce[_0x75fb('0x4b')]);return db[_0x75fb('0x3e')][_0x75fb('0x17')]({'where':_0x327ec9['where']})['then'](function(_0x3996eb){_0x39b517['count']=_0x3996eb;if(_0x20e2ce[_0x75fb('0x2b')][_0x75fb('0x30')]){_0x327ec9[_0x75fb('0x31')]=[{'all':!![]}];}return db[_0x75fb('0x3e')][_0x75fb('0x24')](_0x327ec9);})[_0x75fb('0x1a')](function(_0x503a56){_0x39b517[_0x75fb('0x4c')]=_0x503a56;return _0x39b517;});}})[_0x75fb('0x1a')](respondWithFilteredResult(_0x586b6b,_0x327ec9))[_0x75fb('0x26')](handleError(_0x586b6b,null));};exports[_0x75fb('0x4d')]=function(_0xf7b702,_0x2eef85){return db['WhatsappInteraction'][_0x75fb('0x33')]({'where':{'id':_0xf7b702[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x2eef85,null))[_0x75fb('0x1a')](function(_0x56fd9a){if(_0x56fd9a){return _0x56fd9a[_0x75fb('0x4e')](_0xf7b702['body'][_0x75fb('0x3a')],_[_0x75fb('0x3b')](_0xf7b702['body'],[_0x75fb('0x3a'),'id'])||{})[_0x75fb('0x4f')](function(){return db[_0x75fb('0x50')][_0x75fb('0x24')]({'attributes':['id',_0x75fb('0x1e'),_0x75fb('0x51')],'where':{'id':_0xf7b702[_0x75fb('0x35')][_0x75fb('0x3a')]}});})[_0x75fb('0x1a')](function(_0x1e47a7){socket[_0x75fb('0x52')]('whatsappInteractionTags:save',{'id':Number(_0xf7b702[_0x75fb('0x37')]['id']),'tags':_0x1e47a7||[]});return{'id':Number(_0xf7b702[_0x75fb('0x37')]['id']),'tags':_0x1e47a7||[]};});}})[_0x75fb('0x1a')](respondWithResult(_0x2eef85,null))[_0x75fb('0x26')](handleError(_0x2eef85,null));};exports[_0x75fb('0x53')]=function(_0x76e7d8,_0x246024){return db[_0x75fb('0x2a')]['find']({'where':{'id':_0x76e7d8[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x246024,null))[_0x75fb('0x1a')](function(_0x5dce58){if(_0x5dce58){return _0x5dce58['removeTags'](_0x76e7d8['query'][_0x75fb('0x3a')]);}})[_0x75fb('0x1a')](respondWithStatusCode(_0x246024,null))[_0x75fb('0x26')](handleError(_0x246024,null));};exports['download']=function(_0x1e6319,_0x14acaf){var _0x1a3933=moment()[_0x75fb('0x54')]()[_0x75fb('0x55')]();var _0x58876e=path[_0x75fb('0x56')](config['root'],'server','files',_0x75fb('0x57'));var _0x39f015=path['join'](config['root'],_0x75fb('0x58'),_0x75fb('0x59'),_0x75fb('0x5a'));var _0x17001d=path[_0x75fb('0x56')](_0x58876e,_0x1a3933);var _0x210ffa=util[_0x75fb('0x5b')](_0x75fb('0x5c'),_0x1e6319[_0x75fb('0x37')]['id'],_0x1a3933);var _0x4eef9a=path['join'](_0x58876e,_0x210ffa);var _0x3e4672=[];_0x3e4672[_0x75fb('0x5d')]({'model':db[_0x75fb('0x5e')],'as':_0x75fb('0x5e'),'attributes':['id',_0x75fb('0x5f')],'raw':!![]});_0x3e4672[_0x75fb('0x5d')]({'model':db[_0x75fb('0x60')],'as':_0x75fb('0x61'),'attributes':['id',_0x75fb('0x62'),'lastName'],'raw':!![]});if(_0x1e6319[_0x75fb('0x2b')][_0x75fb('0x5a')]){_0x3e4672['push']({'model':db['Attachment'],'as':_0x75fb('0x63'),'raw':!![]});}var _0x481357=[{'model':db['WhatsappMessage'],'as':_0x75fb('0x64'),'attributes':['id',_0x75fb('0x35'),_0x75fb('0x65'),'direction','secret',_0x75fb('0x66')],'include':_0x3e4672}];_0x481357[_0x75fb('0x5d')]({'model':db[_0x75fb('0x67')],'as':_0x75fb('0x68'),'attributes':['id','name']});_0x481357[_0x75fb('0x5d')]({'model':db[_0x75fb('0x5e')],'as':'Owner','attributes':['id',_0x75fb('0x5f')]});return db['WhatsappInteraction'][_0x75fb('0x33')]({'where':{'id':_0x1e6319[_0x75fb('0x37')]['id']},'include':_0x481357})['then'](handleEntityNotFound(_0x14acaf,null))['then'](function(_0x1fa6dd){if(_0x1fa6dd){var _0x54e427=_0x1fa6dd[_0x75fb('0x69')]({'plain':!![]});fs[_0x75fb('0x6a')](_0x17001d);var _0x217373={'channel':_0x75fb('0x6b'),'account':_0x54e427[_0x75fb('0x68')][_0x75fb('0x1e')],'agent':_0x54e427['Owner']?_0x54e427[_0x75fb('0x6c')][_0x75fb('0x5f')]:_0x75fb('0x6d'),'createdAt':moment(_0x54e427[_0x75fb('0x65')])[_0x75fb('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x54e427[_0x75fb('0x6e')]?moment(_0x54e427[_0x75fb('0x6f')])[_0x75fb('0x5b')](_0x75fb('0x4a'))['toString']():'','disposition':_0x54e427[_0x75fb('0x70')],'messages':_(_0x54e427[_0x75fb('0x64')])[_0x75fb('0x47')]({'secret':![]})[_0x75fb('0x21')](function(_0x155b26){if(_0x155b26[_0x75fb('0x63')]){var _0x701b73=path[_0x75fb('0x56')](_0x39f015,_0x155b26[_0x75fb('0x63')]['basename']);if(fs['existsSync'](_0x701b73)){fs[_0x75fb('0x71')](_0x701b73)[_0x75fb('0x72')](fs['createWriteStream'](path[_0x75fb('0x56')](_0x17001d,_0x155b26[_0x75fb('0x63')]['basename'])));}}return{'date':moment(_0x155b26[_0x75fb('0x65')])['format'](_0x75fb('0x4a'))[_0x75fb('0x55')](),'sender':_0x155b26[_0x75fb('0x73')]===_0x75fb('0x74')?_0x155b26[_0x75fb('0x5e')]?_0x155b26[_0x75fb('0x5e')][_0x75fb('0x5f')]:_0x75fb('0x75'):_0x155b26[_0x75fb('0x61')]['firstName']+(_0x155b26['Contact'][_0x75fb('0x76')]?'\x20'+_0x155b26['Contact']['lastName']:''),'body':_0x155b26[_0x75fb('0x63')]?_0x155b26[_0x75fb('0x63')][_0x75fb('0x77')]:_0x155b26[_0x75fb('0x35')],'direction':_0x155b26[_0x75fb('0x73')]==='out'?'A':'C','secret':_0x155b26[_0x75fb('0x78')],'read':_0x155b26[_0x75fb('0x66')],'attachment':_0x155b26[_0x75fb('0x63')]};})[_0x75fb('0x79')]()};return ejs[_0x75fb('0x7a')](path['join'](config['root'],_0x75fb('0x58'),'views','downloadInteraction.ejs'),{'interaction':_0x217373})[_0x75fb('0x1a')](function(_0x49acca){var _0x4eeaee=path[_0x75fb('0x56')](_0x17001d,_0x75fb('0x7b')+_0x54e427['id']+'-'+_0x1a3933+_0x75fb('0x7c'));var _0x1c53a8={'path':_0x4eeaee,'channel':'Whatsapp','interactionId':_0x54e427['id']};return pdf[_0x75fb('0x7d')](_0x49acca,_0x1c53a8);})['then'](function(){return new BPromise(function(_0x4bf789,_0x30eec9){zipdir(_0x17001d,{'saveTo':_0x4eef9a},function(_0x3aa628,_0xb252ec){if(_0x3aa628)return _0x30eec9(_0x3aa628);return _0x4bf789(_0xb252ec);});})[_0x75fb('0x1a')](function(){return new BPromise(function(_0x2b4b38,_0x1dddb1){rimraf(_0x17001d,function(_0x258cb4){if(_0x258cb4)_0x1dddb1(_0x258cb4);return _0x2b4b38();});});})[_0x75fb('0x1a')](function(){return _0x14acaf[_0x75fb('0x7e')](_0x4eef9a,_0x210ffa,function(_0x3e5567){if(_0x3e5567){console[_0x75fb('0x7f')](_0x75fb('0x80'),_0x3e5567);}else{fs[_0x75fb('0x81')](_0x4eef9a);}});});});}else{return _0x14acaf[_0x75fb('0x11')](0xc8);}})[_0x75fb('0x26')](handleError(_0x14acaf,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e6da052..d9ba60b 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 _0x4058=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x4058,0x129));var _0x8405=function(_0x670f1b,_0x51e927){_0x670f1b=_0x670f1b-0x0;var _0x339c8e=_0x4058[_0x670f1b];return _0x339c8e;};'use strict';var EventEmitter=require(_0x8405('0x0'));var WhatsappInteraction=require(_0x8405('0x1'))['db'][_0x8405('0x2')];var WhatsappMessage=require(_0x8405('0x1'))['db'][_0x8405('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8405('0x4')](0x0);var events={'afterCreate':_0x8405('0x5'),'afterUpdate':_0x8405('0x6'),'afterDestroy':_0x8405('0x7')};function emitEvent(_0x4948b2){return function(_0x5ebf0e,_0x57fb07,_0x1db7ea){_0x5ebf0e[_0x8405('0x8')]({'attributes':['id'],'raw':!![]})[_0x8405('0x9')](function(_0x1322e5){_0x5ebf0e[_0x8405('0xa')]('Users',_0x1322e5[_0x8405('0xb')](function(_0x2b1c0a){return{'id':_0x2b1c0a['id']};}));return WhatsappMessage[_0x8405('0xc')]({'where':{'WhatsappInteractionId':_0x5ebf0e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30705f){_0x5ebf0e['setDataValue'](_0x8405('0xd'),_0x30705f[_0x8405('0xe')]);WhatsappInteractionEvents['emit'](_0x4948b2+':'+_0x5ebf0e['id'],_0x5ebf0e);WhatsappInteractionEvents[_0x8405('0xf')](_0x4948b2,_0x5ebf0e);_0x1db7ea(null);})[_0x8405('0x10')](_0x1db7ea(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xfaa4=['then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x900cfd,_0x139881){var _0x106425=function(_0x29a8a3){while(--_0x29a8a3){_0x900cfd['push'](_0x900cfd['shift']());}};_0x106425(++_0x139881);}(_0xfaa4,0x1a8));var _0x4faa=function(_0xe69010,_0x2e650b){_0xe69010=_0xe69010-0x0;var _0x2b44d6=_0xfaa4[_0xe69010];return _0x2b44d6;};'use strict';var EventEmitter=require(_0x4faa('0x0'));var WhatsappInteraction=require(_0x4faa('0x1'))['db'][_0x4faa('0x2')];var WhatsappMessage=require(_0x4faa('0x1'))['db'][_0x4faa('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4faa('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4faa('0x5'),'afterDestroy':_0x4faa('0x6')};function emitEvent(_0x144600){return function(_0x349d09,_0x5d753f,_0x8117c3){_0x349d09[_0x4faa('0x7')]({'attributes':['id'],'raw':!![]})[_0x4faa('0x8')](function(_0x504f83){_0x349d09['setDataValue']('Users',_0x504f83[_0x4faa('0x9')](function(_0xa0edee){return{'id':_0xa0edee['id']};}));return WhatsappMessage[_0x4faa('0xa')]({'where':{'WhatsappInteractionId':_0x349d09['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x37dad5){_0x349d09[_0x4faa('0xb')](_0x4faa('0xc'),_0x37dad5[_0x4faa('0xd')]);WhatsappInteractionEvents[_0x4faa('0xe')](_0x144600+':'+_0x349d09['id'],_0x349d09);WhatsappInteractionEvents['emit'](_0x144600,_0x349d09);_0x8117c3(null);})['catch'](_0x8117c3(null));};}for(var e in events){if(events[_0x4faa('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4faa('0x10')](e,emitEvent(event));}}module[_0x4faa('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2c5ff0c..283f9ca 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 _0x1d21=['./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x1d21,0x158));var _0x11d2=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0x1d21[_0x3ff0f0];return _0x5dc82a;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d8792,_0xd6d34c,_0x7f0625){if(_0x4d8792['changed'](_0x11d2('0xd'))){_0x4d8792['closedAt']=moment()[_0x11d2('0xe')](_0x11d2('0xf'));}_0x7f0625(null,_0x4d8792);}}});}; \ No newline at end of file +var _0x72e2=['exports','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','path','rimraf'];(function(_0x1c3b15,_0x280290){var _0x44329a=function(_0x529157){while(--_0x529157){_0x1c3b15['push'](_0x1c3b15['shift']());}};_0x44329a(++_0x280290);}(_0x72e2,0x1c3));var _0x272e=function(_0x422e9b,_0x2d73f2){_0x422e9b=_0x422e9b-0x0;var _0x243924=_0x72e2[_0x422e9b];return _0x243924;};'use strict';var _=require(_0x272e('0x0'));var util=require('util');var logger=require(_0x272e('0x1'))(_0x272e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x272e('0x3'));var rimraf=require(_0x272e('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x272e('0x5')]=function(_0x1f6c6e,_0x2f9ae5){return _0x1f6c6e[_0x272e('0x6')](_0x272e('0x7'),attributes,{'tableName':_0x272e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31cb05,_0x50ca45,_0x16685d){if(_0x31cb05['changed']('closed')){_0x31cb05[_0x272e('0x9')]=moment()[_0x272e('0xa')](_0x272e('0xb'));}_0x16685d(null,_0x31cb05);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 06eb26b..674c3b2 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 _0x6985=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','body','options','raw','where','limit','then','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9a23df,_0x2edc93){var _0x44c94e=function(_0xb17494){while(--_0xb17494){_0x9a23df['push'](_0x9a23df['shift']());}};_0x44c94e(++_0x2edc93);}(_0x6985,0x77));var _0x5698=function(_0x27652f,_0x385de4){_0x27652f=_0x27652f-0x0;var _0x3e4ada=_0x6985[_0x27652f];return _0x3e4ada;};'use strict';var _=require(_0x5698('0x0'));var util=require(_0x5698('0x1'));var moment=require(_0x5698('0x2'));var BPromise=require(_0x5698('0x3'));var rs=require(_0x5698('0x4'));var fs=require('fs');var Redis=require(_0x5698('0x5'));var db=require(_0x5698('0x6'))['db'];var utils=require(_0x5698('0x7'));var logger=require(_0x5698('0x8'))(_0x5698('0x9'));var config=require(_0x5698('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5698('0xb')][_0x5698('0xc')]({'port':0x232a});config[_0x5698('0xd')]=_[_0x5698('0xe')](config[_0x5698('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5698('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x5698('0x10')](socket);function respondWithRpcPromise(_0x311e1c,_0x5f23b7,_0x2950c0){return new BPromise(function(_0x15ca84,_0x11c3ee){return client[_0x5698('0x11')](_0x311e1c,_0x2950c0)['then'](function(_0x2ea0d3){logger[_0x5698('0x12')](_0x5698('0x13'),_0x5f23b7,_0x5698('0x14'));logger[_0x5698('0x15')](_0x5698('0x16'),_0x5f23b7,_0x5698('0x14'),JSON['stringify'](_0x2ea0d3));if(_0x2ea0d3[_0x5698('0x17')]){if(_0x2ea0d3[_0x5698('0x17')][_0x5698('0x18')]===0x1f4){logger['error'](_0x5698('0x13'),_0x5f23b7,_0x2ea0d3['error'][_0x5698('0x19')]);return _0x11c3ee(_0x2ea0d3['error'][_0x5698('0x19')]);}logger[_0x5698('0x17')](_0x5698('0x13'),_0x5f23b7,_0x2ea0d3[_0x5698('0x17')][_0x5698('0x19')]);return _0x15ca84(_0x2ea0d3[_0x5698('0x17')][_0x5698('0x19')]);}else{logger['info'](_0x5698('0x13'),_0x5f23b7,_0x5698('0x14'));_0x15ca84(_0x2ea0d3['result'][_0x5698('0x19')]);}})[_0x5698('0x1a')](function(_0x4d0dbc){logger[_0x5698('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x5f23b7,_0x4d0dbc);_0x11c3ee(_0x4d0dbc);});});}exports['UpdateWhatsappInteraction']=function(_0x13736c){var _0x1b8635=this;return new Promise(function(_0x3f9f9b,_0x5012dd){return db['WhatsappInteraction'][_0x5698('0x1b')](_0x13736c[_0x5698('0x1c')],{'raw':_0x13736c[_0x5698('0x1d')]?_0x13736c[_0x5698('0x1d')][_0x5698('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13736c[_0x5698('0x1d')]?_0x13736c['options'][_0x5698('0x1f')]||null:null,'attributes':_0x13736c[_0x5698('0x1d')]?_0x13736c['options']['attributes']||null:null,'limit':_0x13736c['options']?_0x13736c[_0x5698('0x1d')][_0x5698('0x20')]||null:null})[_0x5698('0x21')](function(_0x2f3f3){logger['info'](_0x5698('0x22'),_0x13736c);logger[_0x5698('0x15')](_0x5698('0x22'),_0x13736c,JSON[_0x5698('0x23')](_0x2f3f3));_0x3f9f9b(_0x2f3f3);})['catch'](function(_0x2c725c){logger['error']('UpdateWhatsappInteraction',_0x2c725c[_0x5698('0x19')],_0x13736c);_0x5012dd(_0x1b8635[_0x5698('0x17')](0x1f4,_0x2c725c[_0x5698('0x19')]));});});};exports[_0x5698('0x24')]=function(_0x3c11cd){return new Promise(function(_0xffc343,_0x45dc35){return db[_0x5698('0x25')]['find']({'where':_0x3c11cd[_0x5698('0x1d')]?_0x3c11cd[_0x5698('0x1d')][_0x5698('0x1f')]||null:null})[_0x5698('0x21')](function(_0x2ad8be){if(_0x2ad8be){return _0x2ad8be['addTags'](_0x3c11cd[_0x5698('0x1c')][_0x5698('0x26')],_[_0x5698('0x27')](_0x3c11cd['body'],[_0x5698('0x26'),'id'])||{});}})[_0x5698('0x28')](function(_0x22c5b9){logger[_0x5698('0x12')](_0x5698('0x29'),_0x3c11cd);logger[_0x5698('0x15')]('AddTags',_0x3c11cd,JSON['stringify'](_0x22c5b9));_0xffc343(_0x22c5b9);})['catch'](function(_0x2f70cc){logger['error']('AddTags',_0x2f70cc['message'],_0x3c11cd);_0x45dc35(_this[_0x5698('0x17')](0x1f4,_0x2f70cc[_0x5698('0x19')]));});});}; \ No newline at end of file +var _0xff75=['stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2eed96,_0x3acd75){var _0x2fffd8=function(_0x43df82){while(--_0x43df82){_0x2eed96['push'](_0x2eed96['shift']());}};_0x2fffd8(++_0x3acd75);}(_0xff75,0x1da));var _0x5ff7=function(_0x28cab5,_0x312218){_0x28cab5=_0x28cab5-0x0;var _0x4c85e1=_0xff75[_0x28cab5];return _0x4c85e1;};'use strict';var _=require(_0x5ff7('0x0'));var util=require(_0x5ff7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ff7('0x2'));var fs=require('fs');var Redis=require(_0x5ff7('0x3'));var db=require(_0x5ff7('0x4'))['db'];var utils=require(_0x5ff7('0x5'));var logger=require(_0x5ff7('0x6'))(_0x5ff7('0x7'));var config=require(_0x5ff7('0x8'));var jayson=require(_0x5ff7('0x9'));var client=jayson[_0x5ff7('0xa')][_0x5ff7('0xb')]({'port':0x232a});config[_0x5ff7('0xc')]=_[_0x5ff7('0xd')](config[_0x5ff7('0xc')],{'host':_0x5ff7('0xe'),'port':0x18eb});var socket=require(_0x5ff7('0xf'))(new Redis(config[_0x5ff7('0xc')]));require(_0x5ff7('0x10'))[_0x5ff7('0x11')](socket);function respondWithRpcPromise(_0x3048e8,_0x4d5307,_0x343e41){return new BPromise(function(_0x41b64b,_0xdc8979){return client[_0x5ff7('0x12')](_0x3048e8,_0x343e41)['then'](function(_0x10843a){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,_0x5ff7('0x13'));logger['debug'](_0x5ff7('0x14'),_0x4d5307,_0x5ff7('0x13'),JSON[_0x5ff7('0x15')](_0x10843a));if(_0x10843a['error']){if(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x17')]===0x1f4){logger['error'](_0x5ff7('0x18'),_0x4d5307,_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);return _0xdc8979(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);}logger[_0x5ff7('0x16')](_0x5ff7('0x18'),_0x4d5307,_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);return _0x41b64b(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);}else{logger[_0x5ff7('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,'request\x20sent');_0x41b64b(_0x10843a[_0x5ff7('0x1b')]['message']);}})[_0x5ff7('0x1c')](function(_0x4ead16){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,_0x4ead16);_0xdc8979(_0x4ead16);});});}exports[_0x5ff7('0x1d')]=function(_0x58637b){var _0x333ec9=this;return new Promise(function(_0x44174d,_0x10d8eb){return db[_0x5ff7('0x1e')][_0x5ff7('0x1f')](_0x58637b[_0x5ff7('0x20')],{'raw':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58637b['options']?_0x58637b['options'][_0x5ff7('0x23')]||null:null,'attributes':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x24')]||null:null,'limit':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x25')]||null:null})[_0x5ff7('0x26')](function(_0x4e64d6){logger['info'](_0x5ff7('0x1d'),_0x58637b);logger['debug'](_0x5ff7('0x1d'),_0x58637b,JSON[_0x5ff7('0x15')](_0x4e64d6));_0x44174d(_0x4e64d6);})[_0x5ff7('0x1c')](function(_0x3a09f1){logger[_0x5ff7('0x16')](_0x5ff7('0x1d'),_0x3a09f1['message'],_0x58637b);_0x10d8eb(_0x333ec9[_0x5ff7('0x16')](0x1f4,_0x3a09f1[_0x5ff7('0x19')]));});});};exports[_0x5ff7('0x27')]=function(_0x34a47a){return new Promise(function(_0x5ccc1a,_0x27be34){return db[_0x5ff7('0x1e')][_0x5ff7('0x28')]({'where':_0x34a47a[_0x5ff7('0x21')]?_0x34a47a[_0x5ff7('0x21')]['where']||null:null})['then'](function(_0x4aea1c){if(_0x4aea1c){return _0x4aea1c['addTags'](_0x34a47a[_0x5ff7('0x20')][_0x5ff7('0x29')],_['omit'](_0x34a47a[_0x5ff7('0x20')],[_0x5ff7('0x29'),'id'])||{});}})[_0x5ff7('0x2a')](function(_0x532eb5){logger[_0x5ff7('0x1a')](_0x5ff7('0x2b'),_0x34a47a);logger[_0x5ff7('0x2c')](_0x5ff7('0x2b'),_0x34a47a,JSON['stringify'](_0x532eb5));_0x5ccc1a(_0x532eb5);})['catch'](function(_0x1ce94b){logger[_0x5ff7('0x16')](_0x5ff7('0x2b'),_0x1ce94b[_0x5ff7('0x19')],_0x34a47a);_0x27be34(_this[_0x5ff7('0x16')](0x1f4,_0x1ce94b[_0x5ff7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index dd1b2e8..d47b196 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 _0x5f34=['whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x5f34,0x141));var _0x45f3=function(_0xaf7e3d,_0x13d52e){_0xaf7e3d=_0xaf7e3d-0x0;var _0x4e042c=_0x5f34[_0xaf7e3d];return _0x4e042c;};'use strict';var WhatsappInteractionEvents=require(_0x45f3('0x0'));var events=[_0x45f3('0x1'),_0x45f3('0x2'),'update'];function createListener(_0x423f3b,_0x2362f1){return function(_0x1012a8){_0x2362f1[_0x45f3('0x3')](_0x423f3b,_0x1012a8);};}function removeListener(_0x3c2d0e,_0x1678bf){return function(){WhatsappInteractionEvents[_0x45f3('0x4')](_0x3c2d0e,_0x1678bf);};}exports[_0x45f3('0x5')]=function(_0x3a21bd){for(var _0x3d6f7c=0x0,_0x31c442=events[_0x45f3('0x6')];_0x3d6f7c<_0x31c442;_0x3d6f7c++){var _0x262ff6=events[_0x3d6f7c];var _0x19138e=createListener(_0x45f3('0x7')+_0x262ff6,_0x3a21bd);WhatsappInteractionEvents['on'](_0x262ff6,_0x19138e);}}; \ No newline at end of file +var _0x970c=['update','emit','removeListener','length','./whatsappInteraction.events','save','remove'];(function(_0x36f00d,_0x350098){var _0x526479=function(_0x4c2645){while(--_0x4c2645){_0x36f00d['push'](_0x36f00d['shift']());}};_0x526479(++_0x350098);}(_0x970c,0x131));var _0xc970=function(_0x5ec5c0,_0x32ceea){_0x5ec5c0=_0x5ec5c0-0x0;var _0x49781c=_0x970c[_0x5ec5c0];return _0x49781c;};'use strict';var WhatsappInteractionEvents=require(_0xc970('0x0'));var events=[_0xc970('0x1'),_0xc970('0x2'),_0xc970('0x3')];function createListener(_0x1bfe68,_0x4309ce){return function(_0x574328){_0x4309ce[_0xc970('0x4')](_0x1bfe68,_0x574328);};}function removeListener(_0x573281,_0x3c0289){return function(){WhatsappInteractionEvents[_0xc970('0x5')](_0x573281,_0x3c0289);};}exports['register']=function(_0x39f7db){for(var _0x534901=0x0,_0x38a037=events[_0xc970('0x6')];_0x534901<_0x38a037;_0x534901++){var _0xab857f=events[_0x534901];var _0x2a2403=createListener('whatsappInteraction:'+_0xab857f,_0x39f7db);WhatsappInteractionEvents['on'](_0xab857f,_0x2a2403);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 207f5ce..9cefbbe 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 _0xb947=['put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status'];(function(_0x39d08a,_0x1ab2df){var _0x177e59=function(_0x1a5148){while(--_0x1a5148){_0x39d08a['push'](_0x39d08a['shift']());}};_0x177e59(++_0x1ab2df);}(_0xb947,0x146));var _0x7b94=function(_0x7f672d,_0xe22310){_0x7f672d=_0x7f672d-0x0;var _0x52d480=_0xb947[_0x7f672d];return _0x52d480;};'use strict';var multer=require('multer');var util=require(_0x7b94('0x0'));var path=require(_0x7b94('0x1'));var timeout=require(_0x7b94('0x2'));var express=require('express');var router=express[_0x7b94('0x3')]();var fs_extra=require(_0x7b94('0x4'));var auth=require(_0x7b94('0x5'));var interaction=require(_0x7b94('0x6'));var config=require(_0x7b94('0x7'));var controller=require(_0x7b94('0x8'));router[_0x7b94('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b94('0xa')]);router[_0x7b94('0x9')](_0x7b94('0xb'),auth[_0x7b94('0xc')](),controller['describe']);router['get'](_0x7b94('0xd'),auth[_0x7b94('0xc')](),controller[_0x7b94('0xe')]);router[_0x7b94('0xf')]('/',auth[_0x7b94('0xc')](),interaction[_0x7b94('0x10')](_0x7b94('0x11'),_0x7b94('0x12')),controller[_0x7b94('0x13')]);router[_0x7b94('0xf')](_0x7b94('0x14'),controller[_0x7b94('0x15')]);router[_0x7b94('0x16')](_0x7b94('0xd'),auth[_0x7b94('0xc')](),controller[_0x7b94('0x17')]);router[_0x7b94('0x16')](_0x7b94('0x18'),auth[_0x7b94('0xc')](),controller[_0x7b94('0x19')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7b94('0x1a')]);router[_0x7b94('0x1b')](_0x7b94('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b94('0x1c')]=router; \ No newline at end of file +var _0x86cd=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsappmessage:create','create','status','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x3e81cc,_0x3b5204){var _0x542413=function(_0x3bcbb0){while(--_0x3bcbb0){_0x3e81cc['push'](_0x3e81cc['shift']());}};_0x542413(++_0x3b5204);}(_0x86cd,0x12e));var _0xd86c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x86cd[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xd86c('0x0'));var util=require('util');var path=require(_0xd86c('0x1'));var timeout=require(_0xd86c('0x2'));var express=require(_0xd86c('0x3'));var router=express[_0xd86c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd86c('0x5'));var interaction=require(_0xd86c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xd86c('0x7')]('/',auth[_0xd86c('0x8')](),controller[_0xd86c('0x9')]);router[_0xd86c('0x7')](_0xd86c('0xa'),auth[_0xd86c('0x8')](),controller[_0xd86c('0xb')]);router[_0xd86c('0x7')](_0xd86c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd86c('0xd')]('/',auth['isAuthenticated'](),interaction[_0xd86c('0xe')]('whatsapp',_0xd86c('0xf')),controller[_0xd86c('0x10')]);router[_0xd86c('0xd')]('/:id/status',controller[_0xd86c('0x11')]);router[_0xd86c('0x12')](_0xd86c('0xc'),auth[_0xd86c('0x8')](),controller['update']);router['put'](_0xd86c('0x13'),auth[_0xd86c('0x8')](),controller['accept']);router['put'](_0xd86c('0x14'),auth[_0xd86c('0x8')](),controller[_0xd86c('0x15')]);router[_0xd86c('0x16')](_0xd86c('0xc'),auth[_0xd86c('0x8')](),controller[_0xd86c('0x17')]);module[_0xd86c('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3e3fb10..d250fc7 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 _0xa63a=['TEXT','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x38b770,_0x1bd8f1){var _0x208f58=function(_0x247b19){while(--_0x247b19){_0x38b770['push'](_0x38b770['shift']());}};_0x208f58(++_0x1bd8f1);}(_0xa63a,0xa9));var _0xaa63=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xa63a[_0x1bf809];return _0x1caa4e;};'use strict';var Sequelize=require('sequelize');module[_0xaa63('0x0')]={'body':{'type':Sequelize['TEXT'](_0xaa63('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaa63('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa63('0x3')]('in',_0xaa63('0x4')),'defaultValue':_0xaa63('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa63('0x5')](0xbe)},'phone':{'type':Sequelize[_0xaa63('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xaa63('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaa63('0x5')]},'providerResponse':{'type':Sequelize[_0xaa63('0x6')]}}; \ No newline at end of file +var _0x889d=['sequelize','exports','TEXT','BOOLEAN','out','STRING','DATE'];(function(_0x4294da,_0x1c4b0f){var _0x33ea8a=function(_0x5559d7){while(--_0x5559d7){_0x4294da['push'](_0x4294da['shift']());}};_0x33ea8a(++_0x1c4b0f);}(_0x889d,0x142));var _0xd889=function(_0x176231,_0x43db84){_0x176231=_0x176231-0x0;var _0x456c46=_0x889d[_0x176231];return _0x456c46;};'use strict';var Sequelize=require(_0xd889('0x0'));module[_0xd889('0x1')]={'body':{'type':Sequelize[_0xd889('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd889('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xd889('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd889('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd889('0x5')]},'readAt':{'type':Sequelize[_0xd889('0x6')]},'secret':{'type':Sequelize[_0xd889('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd889('0x5')]},'providerResponse':{'type':Sequelize[_0xd889('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b136732..0b51cf8 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 _0xef25=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','accept','whatsapp','acceptMessage','UserId','user','agent','get','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','email','internal','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','whatsapp-interactions','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','count','limit','status','set','update','destroy','end','sendStatus','name','send','index','WhatsappMessage','fieldName','type','key','map','query','keys','filters','intersection','attributes','model'];(function(_0x174f3f,_0x37af67){var _0x15175d=function(_0x210ad4){while(--_0x210ad4){_0x174f3f['push'](_0x174f3f['shift']());}};_0x15175d(++_0x37af67);}(_0xef25,0xa4));var _0x5ef2=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xef25[_0x56740a];return _0x257144;};'use strict';var util=require(_0x5ef2('0x0'));var _=require(_0x5ef2('0x1'));var Redis=require(_0x5ef2('0x2'));var interactionService=require(_0x5ef2('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x5ef2('0x4'))(_0x5ef2('0x5'));var config=require(_0x5ef2('0x6'));var db=require('../../mysqldb')['db'];config[_0x5ef2('0x7')]=_[_0x5ef2('0x8')](config['redis'],{'host':_0x5ef2('0x9'),'port':0x18eb});var socket=require(_0x5ef2('0xa'))(new Redis(config['redis']));require(_0x5ef2('0xb'))[_0x5ef2('0xc')](socket);var jayson=require(_0x5ef2('0xd'));var client=jayson['client'][_0x5ef2('0xe')]({'port':0x232c});var client9002=jayson[_0x5ef2('0xf')]['http']({'port':0x232a});var interaction_log=require(_0x5ef2('0x4'))(_0x5ef2('0x10'));function respondWithRpcPromise(_0x3601fb,_0x306571,_0x4a6748,_0xefe33b){return new Promise(function(_0x51ac8a,_0x4170a7){var _0x23aa9b=_0xefe33b||client;return _0x23aa9b['request'](_0x3601fb,_0x4a6748)[_0x5ef2('0x11')](function(_0x204845){logger[_0x5ef2('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x306571,_0x5ef2('0x13'));logger[_0x5ef2('0x14')](_0x5ef2('0x15'),_0x306571,_0x5ef2('0x13'),JSON[_0x5ef2('0x16')](_0x204845));if(_0x204845['error']){if(_0x204845[_0x5ef2('0x17')][_0x5ef2('0x18')]===0x1f4){logger[_0x5ef2('0x17')](_0x5ef2('0x19'),_0x306571,_0x204845['error']['message']);return _0x4170a7(_0x204845['error'][_0x5ef2('0x1a')]);}logger['error'](_0x5ef2('0x19'),_0x306571,_0x204845['error'][_0x5ef2('0x1a')]);return _0x51ac8a(_0x204845[_0x5ef2('0x17')][_0x5ef2('0x1a')]);}else{logger[_0x5ef2('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x306571,_0x5ef2('0x13'));_0x51ac8a(_0x204845[_0x5ef2('0x1b')]['message']);}})[_0x5ef2('0x1c')](function(_0x1cb752){logger[_0x5ef2('0x17')](_0x5ef2('0x19'),_0x306571,_0x1cb752);_0x4170a7(_0x1cb752);});});}function respondWithResult(_0x5528d9,_0x51bf6c){_0x51bf6c=_0x51bf6c||0xc8;return function(_0x2103b0){if(_0x2103b0){return _0x5528d9['status'](_0x51bf6c)[_0x5ef2('0x1d')](_0x2103b0);}};}function respondWithFilteredResult(_0x55ed9d,_0x5c93e1){return function(_0x461b45){if(_0x461b45){var _0x36f516=typeof _0x5c93e1[_0x5ef2('0x1e')]===_0x5ef2('0x1f')&&typeof _0x5c93e1['limit']===_0x5ef2('0x1f');var _0x71a130=_0x461b45[_0x5ef2('0x20')];var _0x17d968=_0x36f516?0x0:_0x5c93e1[_0x5ef2('0x1e')];var _0x26e78b=_0x36f516?_0x461b45[_0x5ef2('0x20')]:_0x5c93e1[_0x5ef2('0x1e')]+_0x5c93e1[_0x5ef2('0x21')];var _0x25b732;if(_0x26e78b>=_0x71a130){_0x26e78b=_0x71a130;_0x25b732=0xc8;}else{_0x25b732=0xce;}_0x55ed9d[_0x5ef2('0x22')](_0x25b732);return _0x55ed9d[_0x5ef2('0x23')]('Content-Range',_0x17d968+'-'+_0x26e78b+'/'+_0x71a130)[_0x5ef2('0x1d')](_0x461b45);}return null;};}function saveUpdates(_0x59e39f){return function(_0x180fc0){if(_0x180fc0){return _0x180fc0[_0x5ef2('0x24')](_0x59e39f)[_0x5ef2('0x11')](function(_0xb92c26){return _0xb92c26;});}return null;};}function removeEntity(_0x15439b){return function(_0x158da5){if(_0x158da5){return _0x158da5[_0x5ef2('0x25')]()[_0x5ef2('0x11')](function(){_0x15439b[_0x5ef2('0x22')](0xcc)[_0x5ef2('0x26')]();});}};}function handleEntityNotFound(_0x32dd94){return function(_0x2aba60){if(!_0x2aba60){_0x32dd94[_0x5ef2('0x27')](0x194);}return _0x2aba60;};}function handleError(_0x391fb9,_0x2ddcd7){_0x2ddcd7=_0x2ddcd7||0x1f4;return function(_0xfa4ad2){logger[_0x5ef2('0x17')](_0xfa4ad2['stack']);if(_0xfa4ad2[_0x5ef2('0x28')]){delete _0xfa4ad2[_0x5ef2('0x28')];}_0x391fb9[_0x5ef2('0x22')](_0x2ddcd7)[_0x5ef2('0x29')](_0xfa4ad2);};}exports[_0x5ef2('0x2a')]=function(_0x3bf747,_0x13ebc9){var _0x383af5={},_0x26075c={},_0x1d21a0={'count':0x0,'rows':[]};var _0x6788c9=_['map'](db[_0x5ef2('0x2b')]['rawAttributes'],function(_0x486007){return{'name':_0x486007[_0x5ef2('0x2c')],'type':_0x486007[_0x5ef2('0x2d')][_0x5ef2('0x2e')]};});_0x26075c['model']=_[_0x5ef2('0x2f')](_0x6788c9,_0x5ef2('0x28'));_0x26075c[_0x5ef2('0x30')]=_[_0x5ef2('0x31')](_0x3bf747[_0x5ef2('0x30')]);_0x26075c[_0x5ef2('0x32')]=_[_0x5ef2('0x33')](_0x26075c['model'],_0x26075c[_0x5ef2('0x30')]);_0x383af5[_0x5ef2('0x34')]=_['intersection'](_0x26075c[_0x5ef2('0x35')],qs[_0x5ef2('0x36')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x36')]));_0x383af5[_0x5ef2('0x34')]=_0x383af5[_0x5ef2('0x34')][_0x5ef2('0x37')]?_0x383af5[_0x5ef2('0x34')]:_0x26075c['model'];if(!_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x38')](_0x5ef2('0x39'))){_0x383af5[_0x5ef2('0x21')]=qs[_0x5ef2('0x21')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x21')]);_0x383af5[_0x5ef2('0x1e')]=qs[_0x5ef2('0x1e')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x1e')]);}_0x383af5[_0x5ef2('0x3a')]=qs[_0x5ef2('0x3b')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x3b')]);_0x383af5[_0x5ef2('0x3c')]=qs[_0x5ef2('0x32')](_[_0x5ef2('0x3d')](_0x3bf747[_0x5ef2('0x30')],_0x26075c[_0x5ef2('0x32')]),_0x6788c9);if(_0x3bf747[_0x5ef2('0x30')]['filter']){_0x383af5[_0x5ef2('0x3c')]=_[_0x5ef2('0x3e')](_0x383af5[_0x5ef2('0x3c')],{'$or':_[_0x5ef2('0x2f')](_0x6788c9,function(_0x5c5d5b){if(_0x5c5d5b[_0x5ef2('0x2d')]!=='VIRTUAL'){var _0x167fb3={};_0x167fb3[_0x5c5d5b[_0x5ef2('0x28')]]={'$like':'%'+_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x3f')]+'%'};return _0x167fb3;}})});}_0x383af5=_['merge']({},_0x383af5,_0x3bf747[_0x5ef2('0x40')]);var _0xd5366b={'where':_0x383af5[_0x5ef2('0x3c')]};return db['WhatsappMessage'][_0x5ef2('0x20')](_0xd5366b)[_0x5ef2('0x11')](function(_0x47c6cc){_0x1d21a0[_0x5ef2('0x20')]=_0x47c6cc;if(_0x3bf747[_0x5ef2('0x30')]['includeAll']){_0x383af5[_0x5ef2('0x41')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x5ef2('0x42')](_0x383af5);})[_0x5ef2('0x11')](function(_0x195b59){_0x1d21a0[_0x5ef2('0x43')]=_0x195b59;return _0x1d21a0;})['then'](respondWithFilteredResult(_0x13ebc9,_0x383af5))[_0x5ef2('0x1c')](handleError(_0x13ebc9,null));};exports[_0x5ef2('0x44')]=function(_0x117b74,_0x191bf5){var _0x57353a={'raw':!![],'where':{'id':_0x117b74[_0x5ef2('0x45')]['id']}},_0x4cf55c={};_0x4cf55c[_0x5ef2('0x35')]=_['keys'](db[_0x5ef2('0x2b')][_0x5ef2('0x46')]);_0x4cf55c[_0x5ef2('0x30')]=_[_0x5ef2('0x31')](_0x117b74[_0x5ef2('0x30')]);_0x4cf55c[_0x5ef2('0x32')]=_[_0x5ef2('0x33')](_0x4cf55c['model'],_0x4cf55c[_0x5ef2('0x30')]);_0x57353a['attributes']=_[_0x5ef2('0x33')](_0x4cf55c[_0x5ef2('0x35')],qs['fields'](_0x117b74['query'][_0x5ef2('0x36')]));_0x57353a['attributes']=_0x57353a[_0x5ef2('0x34')]['length']?_0x57353a[_0x5ef2('0x34')]:_0x4cf55c[_0x5ef2('0x35')];if(_0x117b74['query']['includeAll']){_0x57353a[_0x5ef2('0x41')]=[{'all':!![]}];}_0x57353a=_[_0x5ef2('0x3e')]({},_0x57353a,_0x117b74[_0x5ef2('0x40')]);return db[_0x5ef2('0x2b')][_0x5ef2('0x47')](_0x57353a)[_0x5ef2('0x11')](handleEntityNotFound(_0x191bf5,null))[_0x5ef2('0x11')](respondWithResult(_0x191bf5,null))['catch'](handleError(_0x191bf5,null));};exports[_0x5ef2('0x48')]=function(_0x157f75,_0x4d4832){return db[_0x5ef2('0x2b')]['create'](_0x157f75[_0x5ef2('0x49')],{})['then'](respondWithResult(_0x4d4832,0xc9))[_0x5ef2('0x1c')](handleError(_0x4d4832,null));};exports[_0x5ef2('0x24')]=function(_0x2d8254,_0x261aec){if(_0x2d8254[_0x5ef2('0x49')]['id']){delete _0x2d8254[_0x5ef2('0x49')]['id'];}return db[_0x5ef2('0x2b')][_0x5ef2('0x47')]({'where':{'id':_0x2d8254[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x261aec,null))[_0x5ef2('0x11')](saveUpdates(_0x2d8254[_0x5ef2('0x49')],null))[_0x5ef2('0x11')](respondWithResult(_0x261aec,null))[_0x5ef2('0x1c')](handleError(_0x261aec,null));};exports[_0x5ef2('0x25')]=function(_0x3efc17,_0x491dcc){return db[_0x5ef2('0x2b')][_0x5ef2('0x47')]({'where':{'id':_0x3efc17[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x491dcc,null))[_0x5ef2('0x11')](removeEntity(_0x491dcc,null))[_0x5ef2('0x1c')](handleError(_0x491dcc,null));};exports['describe']=function(_0x389ef5,_0x201020){return db[_0x5ef2('0x2b')][_0x5ef2('0x4a')]()[_0x5ef2('0x11')](respondWithResult(_0x201020,null))[_0x5ef2('0x1c')](handleError(_0x201020,null));};exports[_0x5ef2('0x4b')]=function(_0xeb78f3,_0x52b40b){var _0x31ff51=_0x5ef2('0x4c');return interactionService[_0x5ef2('0x4d')](_0xeb78f3,_0x31ff51)[_0x5ef2('0x11')](respondWithResult(_0x52b40b,null))[_0x5ef2('0x1c')](handleError(_0x52b40b,null));};exports['reject']=function(_0x1103a0,_0x177080){var _0x1ae652={'agent':{},'channel':_0x5ef2('0x4c')};if(_0x1103a0[_0x5ef2('0x49')]['id']){delete _0x1103a0[_0x5ef2('0x49')]['id'];}_0x1103a0['body'][_0x5ef2('0x4e')]=_0x1103a0['body']['UserId']||_0x1103a0[_0x5ef2('0x4f')]['id'];_0x1ae652[_0x5ef2('0x50')]['id']=_0x1103a0[_0x5ef2('0x49')]['UserId'];return db['WhatsappMessage'][_0x5ef2('0x47')]({'where':{'id':_0x1103a0[_0x5ef2('0x45')]['id'],'UserId':null}})[_0x5ef2('0x11')](handleEntityNotFound(_0x177080,null))[_0x5ef2('0x11')](function(_0x15d1e5){if(_0x15d1e5){_0x1ae652[_0x5ef2('0x1a')]=_0x15d1e5[_0x5ef2('0x51')]({'plain':!![]});return db['WhatsappInteraction'][_0x5ef2('0x47')]({'where':{'id':_0x15d1e5['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x177080,null))[_0x5ef2('0x11')](function(_0x48663b){if(_0x48663b){_0x1ae652[_0x5ef2('0x52')]=_0x48663b['get']({'plain':!![]});interaction_log[_0x5ef2('0x12')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1103a0[_0x5ef2('0x4f')]['id'],_0x1103a0[_0x5ef2('0x4f')][_0x5ef2('0x28')],_0x1103a0[_0x5ef2('0x4f')]['role'],_0x1ae652[_0x5ef2('0x52')]['id'],_0x1103a0[_0x5ef2('0x49')]?JSON[_0x5ef2('0x16')](_0x1103a0[_0x5ef2('0x49')]):_0x5ef2('0x53'));return respondWithRpcPromise(_0x5ef2('0x54'),_0x5ef2('0x55'),_0x1ae652);}return null;})['then'](function(_0x549551){var _0xa5d7f2=_0x5ef2('0x56')+_0x549551[_0x5ef2('0x1a')]['ContactId'];return db[_0x5ef2('0x57')][_0x5ef2('0x30')](_0xa5d7f2,{'type':db[_0x5ef2('0x58')][_0x5ef2('0x59')]['SELECT'],'raw':!![]})[_0x5ef2('0x11')](function(_0x48fd6f){return _0x48fd6f;});})[_0x5ef2('0x11')](function(_0x19e51b){if(_0x19e51b){_0x1ae652['message'][_0x5ef2('0x5a')]=_0x19e51b[0x0];if(!_0x1103a0['body'][_0x5ef2('0x4e')])return;return db[_0x5ef2('0x5b')][_0x5ef2('0x47')]({'where':{'id':_0x1103a0[_0x5ef2('0x49')][_0x5ef2('0x4e')],'role':_0x5ef2('0x50')},'attributes':['id',_0x5ef2('0x28'),'fullname',_0x5ef2('0x5c'),_0x5ef2('0x5d')],'raw':!![]});}return null;})[_0x5ef2('0x11')](function(_0x3f0ad5){if(!_0x3f0ad5)return null;_0x1ae652['message'][_0x5ef2('0x50')]=_0x3f0ad5;return _0x1ae652;})[_0x5ef2('0x11')](function(_0x41ee96){if(_0x41ee96){_0x41ee96[_0x5ef2('0x1a')]['interface']=util['format'](_0x5ef2('0x5e'),_0x1103a0[_0x5ef2('0x4f')][_0x5ef2('0x28')]);_0x41ee96[_0x5ef2('0x1a')][_0x5ef2('0x5f')]=_0x1ae652[_0x5ef2('0x5f')];_0x41ee96[_0x5ef2('0x1a')][_0x5ef2('0x60')]=_0x1ae652[_0x5ef2('0x5f')];_0x41ee96[_0x5ef2('0x1a')]['event']=_0x5ef2('0x61');respondWithRpcPromise(_0x5ef2('0x62'),_0x5ef2('0x62'),{'event':_0x5ef2('0x63'),'message':_0x41ee96[_0x5ef2('0x1a')]},client9002);return _0x1ae652;}return null;})[_0x5ef2('0x11')](respondWithResult(_0x177080,null))[_0x5ef2('0x1c')](handleError(_0x177080,null));};exports[_0x5ef2('0x22')]=function(_0x596673,_0x5a975e){if(_0x596673['body']['id']){delete _0x596673[_0x5ef2('0x49')]['id'];}var _0x27d3e8;return db['WhatsappMessage'][_0x5ef2('0x47')]({'where':{'id':_0x596673[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x5a975e,null))[_0x5ef2('0x11')](function(_0xf223c9){if(_0xf223c9){_0x27d3e8=_0xf223c9;return db[_0x5ef2('0x64')][_0x5ef2('0x47')]({'where':{'id':_0xf223c9[_0x5ef2('0x65')]}});}})[_0x5ef2('0x11')](handleEntityNotFound(_0x5a975e,null))[_0x5ef2('0x11')](function(_0x175cec){if(_0x175cec){logger[_0x5ef2('0x14')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x5ef2('0x22'),_0x5ef2('0x66'),_0x175cec[_0x5ef2('0x2d')],util[_0x5ef2('0x67')](_0x596673[_0x5ef2('0x49')],{'showHidden':![],'depth':null}));switch(_0x175cec['type']){case _0x5ef2('0x68'):if(_0x596673[_0x5ef2('0x49')]['MessageSid']&&_0x596673[_0x5ef2('0x49')][_0x5ef2('0x69')]===_0x27d3e8[_0x5ef2('0x6a')]&&_0x596673[_0x5ef2('0x49')]['MessageStatus']&&_0x596673[_0x5ef2('0x49')]['MessageStatus']===_0x5ef2('0x6b')){return _0x27d3e8['update']({'read':!![]});}else{logger[_0x5ef2('0x17')](_0x5ef2('0x6c'),'status',_0x5ef2('0x68'),util[_0x5ef2('0x67')](_0x596673['body'],{'showHidden':![],'depth':null}));}break;}return _0x27d3e8;}})[_0x5ef2('0x11')](respondWithResult(_0x5a975e,null))[_0x5ef2('0x1c')](handleError(_0x5a975e,null));}; \ No newline at end of file +var _0x085d=['internal','interface','format','channel','EventManager','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','whatsapp-interactions','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','destroy','describe','accept','reject','whatsapp','UserId','user','agent','WhatsappInteractionId','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email'];(function(_0x153676,_0x47a834){var _0x4752dd=function(_0x162d90){while(--_0x162d90){_0x153676['push'](_0x153676['shift']());}};_0x4752dd(++_0x47a834);}(_0x085d,0xed));var _0xd085=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x085d[_0x3df871];return _0x570f7b;};'use strict';var util=require(_0xd085('0x0'));var _=require(_0xd085('0x1'));var Redis=require(_0xd085('0x2'));var interactionService=require(_0xd085('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd085('0x4'))(_0xd085('0x5'));var config=require(_0xd085('0x6'));var db=require(_0xd085('0x7'))['db'];config[_0xd085('0x8')]=_[_0xd085('0x9')](config[_0xd085('0x8')],{'host':_0xd085('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd085('0x8')]));require(_0xd085('0xb'))['register'](socket);var jayson=require(_0xd085('0xc'));var client=jayson[_0xd085('0xd')]['http']({'port':0x232c});var client9002=jayson[_0xd085('0xd')][_0xd085('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xd085('0xf'));function respondWithRpcPromise(_0x2703a3,_0x5b7db8,_0x572873,_0x1fbaeb){return new Promise(function(_0x15a4af,_0x70fb27){var _0x55ac85=_0x1fbaeb||client;return _0x55ac85[_0xd085('0x10')](_0x2703a3,_0x572873)[_0xd085('0x11')](function(_0x1c22ef){logger[_0xd085('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x5b7db8,_0xd085('0x13'));logger[_0xd085('0x14')](_0xd085('0x15'),_0x5b7db8,_0xd085('0x13'),JSON[_0xd085('0x16')](_0x1c22ef));if(_0x1c22ef[_0xd085('0x17')]){if(_0x1c22ef[_0xd085('0x17')][_0xd085('0x18')]===0x1f4){logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x1c22ef['error'][_0xd085('0x1a')]);return _0x70fb27(_0x1c22ef[_0xd085('0x17')][_0xd085('0x1a')]);}logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x1c22ef[_0xd085('0x17')][_0xd085('0x1a')]);return _0x15a4af(_0x1c22ef['error'][_0xd085('0x1a')]);}else{logger[_0xd085('0x12')](_0xd085('0x19'),_0x5b7db8,_0xd085('0x13'));_0x15a4af(_0x1c22ef['result'][_0xd085('0x1a')]);}})[_0xd085('0x1b')](function(_0x4236ad){logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x4236ad);_0x70fb27(_0x4236ad);});});}function respondWithResult(_0x2e7bac,_0x54835c){_0x54835c=_0x54835c||0xc8;return function(_0x31c312){if(_0x31c312){return _0x2e7bac[_0xd085('0x1c')](_0x54835c)[_0xd085('0x1d')](_0x31c312);}};}function respondWithFilteredResult(_0x4080b5,_0x42f638){return function(_0x253efb){if(_0x253efb){var _0xfec688=typeof _0x42f638[_0xd085('0x1e')]===_0xd085('0x1f')&&typeof _0x42f638[_0xd085('0x20')]==='undefined';var _0x5b004b=_0x253efb[_0xd085('0x21')];var _0x41b997=_0xfec688?0x0:_0x42f638[_0xd085('0x1e')];var _0x5bb438=_0xfec688?_0x253efb[_0xd085('0x21')]:_0x42f638[_0xd085('0x1e')]+_0x42f638[_0xd085('0x20')];var _0x11d882;if(_0x5bb438>=_0x5b004b){_0x5bb438=_0x5b004b;_0x11d882=0xc8;}else{_0x11d882=0xce;}_0x4080b5[_0xd085('0x1c')](_0x11d882);return _0x4080b5[_0xd085('0x22')](_0xd085('0x23'),_0x41b997+'-'+_0x5bb438+'/'+_0x5b004b)[_0xd085('0x1d')](_0x253efb);}return null;};}function saveUpdates(_0xe15ebe){return function(_0x52627a){if(_0x52627a){return _0x52627a[_0xd085('0x24')](_0xe15ebe)[_0xd085('0x11')](function(_0xfbb092){return _0xfbb092;});}return null;};}function removeEntity(_0x3d69f6){return function(_0x42bf9a){if(_0x42bf9a){return _0x42bf9a['destroy']()[_0xd085('0x11')](function(){_0x3d69f6['status'](0xcc)[_0xd085('0x25')]();});}};}function handleEntityNotFound(_0x427481){return function(_0x55c372){if(!_0x55c372){_0x427481[_0xd085('0x26')](0x194);}return _0x55c372;};}function handleError(_0x7f71cf,_0x566a88){_0x566a88=_0x566a88||0x1f4;return function(_0x8cafa){logger[_0xd085('0x17')](_0x8cafa[_0xd085('0x27')]);if(_0x8cafa[_0xd085('0x28')]){delete _0x8cafa[_0xd085('0x28')];}_0x7f71cf['status'](_0x566a88)['send'](_0x8cafa);};}exports[_0xd085('0x29')]=function(_0x33cee9,_0x5842bd){var _0x5b9688={},_0x29024b={},_0x14ffd1={'count':0x0,'rows':[]};var _0x10408b=_[_0xd085('0x2a')](db[_0xd085('0x2b')]['rawAttributes'],function(_0x3fcb93){return{'name':_0x3fcb93[_0xd085('0x2c')],'type':_0x3fcb93[_0xd085('0x2d')][_0xd085('0x2e')]};});_0x29024b[_0xd085('0x2f')]=_[_0xd085('0x2a')](_0x10408b,'name');_0x29024b[_0xd085('0x30')]=_[_0xd085('0x31')](_0x33cee9[_0xd085('0x30')]);_0x29024b['filters']=_[_0xd085('0x32')](_0x29024b['model'],_0x29024b[_0xd085('0x30')]);_0x5b9688[_0xd085('0x33')]=_['intersection'](_0x29024b['model'],qs[_0xd085('0x34')](_0x33cee9[_0xd085('0x30')][_0xd085('0x34')]));_0x5b9688[_0xd085('0x33')]=_0x5b9688[_0xd085('0x33')]['length']?_0x5b9688[_0xd085('0x33')]:_0x29024b[_0xd085('0x2f')];if(!_0x33cee9[_0xd085('0x30')][_0xd085('0x35')](_0xd085('0x36'))){_0x5b9688[_0xd085('0x20')]=qs[_0xd085('0x20')](_0x33cee9['query'][_0xd085('0x20')]);_0x5b9688['offset']=qs[_0xd085('0x1e')](_0x33cee9[_0xd085('0x30')][_0xd085('0x1e')]);}_0x5b9688[_0xd085('0x37')]=qs['sort'](_0x33cee9[_0xd085('0x30')][_0xd085('0x38')]);_0x5b9688[_0xd085('0x39')]=qs[_0xd085('0x3a')](_[_0xd085('0x3b')](_0x33cee9['query'],_0x29024b[_0xd085('0x3a')]),_0x10408b);if(_0x33cee9[_0xd085('0x30')][_0xd085('0x3c')]){_0x5b9688[_0xd085('0x39')]=_[_0xd085('0x3d')](_0x5b9688[_0xd085('0x39')],{'$or':_[_0xd085('0x2a')](_0x10408b,function(_0x187016){if(_0x187016[_0xd085('0x2d')]!=='VIRTUAL'){var _0x50f1ed={};_0x50f1ed[_0x187016[_0xd085('0x28')]]={'$like':'%'+_0x33cee9[_0xd085('0x30')]['filter']+'%'};return _0x50f1ed;}})});}_0x5b9688=_[_0xd085('0x3d')]({},_0x5b9688,_0x33cee9[_0xd085('0x3e')]);var _0x1ed809={'where':_0x5b9688[_0xd085('0x39')]};return db[_0xd085('0x2b')][_0xd085('0x21')](_0x1ed809)[_0xd085('0x11')](function(_0x2d18c9){_0x14ffd1[_0xd085('0x21')]=_0x2d18c9;if(_0x33cee9[_0xd085('0x30')][_0xd085('0x3f')]){_0x5b9688[_0xd085('0x40')]=[{'all':!![]}];}return db[_0xd085('0x2b')][_0xd085('0x41')](_0x5b9688);})[_0xd085('0x11')](function(_0x139ae8){_0x14ffd1[_0xd085('0x42')]=_0x139ae8;return _0x14ffd1;})[_0xd085('0x11')](respondWithFilteredResult(_0x5842bd,_0x5b9688))['catch'](handleError(_0x5842bd,null));};exports[_0xd085('0x43')]=function(_0x4f651c,_0x1b0226){var _0x216126={'raw':!![],'where':{'id':_0x4f651c[_0xd085('0x44')]['id']}},_0xc7465b={};_0xc7465b[_0xd085('0x2f')]=_[_0xd085('0x31')](db[_0xd085('0x2b')][_0xd085('0x45')]);_0xc7465b[_0xd085('0x30')]=_[_0xd085('0x31')](_0x4f651c[_0xd085('0x30')]);_0xc7465b['filters']=_[_0xd085('0x32')](_0xc7465b[_0xd085('0x2f')],_0xc7465b[_0xd085('0x30')]);_0x216126['attributes']=_[_0xd085('0x32')](_0xc7465b['model'],qs[_0xd085('0x34')](_0x4f651c[_0xd085('0x30')][_0xd085('0x34')]));_0x216126[_0xd085('0x33')]=_0x216126[_0xd085('0x33')][_0xd085('0x46')]?_0x216126[_0xd085('0x33')]:_0xc7465b[_0xd085('0x2f')];if(_0x4f651c[_0xd085('0x30')][_0xd085('0x3f')]){_0x216126[_0xd085('0x40')]=[{'all':!![]}];}_0x216126=_['merge']({},_0x216126,_0x4f651c[_0xd085('0x3e')]);return db[_0xd085('0x2b')][_0xd085('0x47')](_0x216126)[_0xd085('0x11')](handleEntityNotFound(_0x1b0226,null))[_0xd085('0x11')](respondWithResult(_0x1b0226,null))['catch'](handleError(_0x1b0226,null));};exports[_0xd085('0x48')]=function(_0x74cd4f,_0x52e6e4){return db[_0xd085('0x2b')][_0xd085('0x48')](_0x74cd4f['body'],{})[_0xd085('0x11')](respondWithResult(_0x52e6e4,0xc9))['catch'](handleError(_0x52e6e4,null));};exports[_0xd085('0x24')]=function(_0x5342eb,_0x1b50ba){if(_0x5342eb[_0xd085('0x49')]['id']){delete _0x5342eb[_0xd085('0x49')]['id'];}return db[_0xd085('0x2b')][_0xd085('0x47')]({'where':{'id':_0x5342eb['params']['id']}})[_0xd085('0x11')](handleEntityNotFound(_0x1b50ba,null))[_0xd085('0x11')](saveUpdates(_0x5342eb[_0xd085('0x49')],null))[_0xd085('0x11')](respondWithResult(_0x1b50ba,null))[_0xd085('0x1b')](handleError(_0x1b50ba,null));};exports[_0xd085('0x4a')]=function(_0x344d5c,_0x589cd2){return db['WhatsappMessage'][_0xd085('0x47')]({'where':{'id':_0x344d5c[_0xd085('0x44')]['id']}})['then'](handleEntityNotFound(_0x589cd2,null))['then'](removeEntity(_0x589cd2,null))[_0xd085('0x1b')](handleError(_0x589cd2,null));};exports['describe']=function(_0x3f7afe,_0x3c9c1e){return db[_0xd085('0x2b')][_0xd085('0x4b')]()['then'](respondWithResult(_0x3c9c1e,null))[_0xd085('0x1b')](handleError(_0x3c9c1e,null));};exports[_0xd085('0x4c')]=function(_0x649f55,_0x281539){var _0x2c1aa5='whatsapp';return interactionService['acceptMessage'](_0x649f55,_0x2c1aa5)[_0xd085('0x11')](respondWithResult(_0x281539,null))[_0xd085('0x1b')](handleError(_0x281539,null));};exports[_0xd085('0x4d')]=function(_0x279fad,_0x20f19c){var _0x4fc7e4={'agent':{},'channel':_0xd085('0x4e')};if(_0x279fad[_0xd085('0x49')]['id']){delete _0x279fad['body']['id'];}_0x279fad[_0xd085('0x49')][_0xd085('0x4f')]=_0x279fad[_0xd085('0x49')][_0xd085('0x4f')]||_0x279fad[_0xd085('0x50')]['id'];_0x4fc7e4[_0xd085('0x51')]['id']=_0x279fad[_0xd085('0x49')]['UserId'];return db[_0xd085('0x2b')][_0xd085('0x47')]({'where':{'id':_0x279fad[_0xd085('0x44')]['id'],'UserId':null}})[_0xd085('0x11')](handleEntityNotFound(_0x20f19c,null))['then'](function(_0x399a91){if(_0x399a91){_0x4fc7e4['message']=_0x399a91['get']({'plain':!![]});return db['WhatsappInteraction'][_0xd085('0x47')]({'where':{'id':_0x399a91[_0xd085('0x52')]}});}return null;})[_0xd085('0x11')](handleEntityNotFound(_0x20f19c,null))['then'](function(_0x5a6304){if(_0x5a6304){_0x4fc7e4['interaction']=_0x5a6304[_0xd085('0x53')]({'plain':!![]});interaction_log[_0xd085('0x12')](_0xd085('0x54'),_0x279fad[_0xd085('0x50')]['id'],_0x279fad['user']['name'],_0x279fad[_0xd085('0x50')][_0xd085('0x55')],_0x4fc7e4[_0xd085('0x56')]['id'],_0x279fad['body']?JSON['stringify'](_0x279fad[_0xd085('0x49')]):_0xd085('0x57'));return respondWithRpcPromise('RejectMessage',_0xd085('0x58'),_0x4fc7e4);}return null;})[_0xd085('0x11')](function(_0x1c3352){var _0x3ef583='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c3352['message'][_0xd085('0x59')];return db[_0xd085('0x5a')][_0xd085('0x30')](_0x3ef583,{'type':db[_0xd085('0x5b')][_0xd085('0x5c')]['SELECT'],'raw':!![]})[_0xd085('0x11')](function(_0x546e93){return _0x546e93;});})['then'](function(_0x4ca2ef){if(_0x4ca2ef){_0x4fc7e4['message']['contact']=_0x4ca2ef[0x0];if(!_0x279fad[_0xd085('0x49')][_0xd085('0x4f')])return;return db[_0xd085('0x5d')][_0xd085('0x47')]({'where':{'id':_0x279fad[_0xd085('0x49')]['UserId'],'role':_0xd085('0x51')},'attributes':['id','name',_0xd085('0x5e'),_0xd085('0x5f'),_0xd085('0x60')],'raw':!![]});}return null;})[_0xd085('0x11')](function(_0x36bc7f){if(!_0x36bc7f)return null;_0x4fc7e4['message'][_0xd085('0x51')]=_0x36bc7f;return _0x4fc7e4;})[_0xd085('0x11')](function(_0x458875){if(_0x458875){_0x458875[_0xd085('0x1a')][_0xd085('0x61')]=util[_0xd085('0x62')]('SIP/%s',_0x279fad[_0xd085('0x50')]['name']);_0x458875[_0xd085('0x1a')][_0xd085('0x63')]=_0x4fc7e4[_0xd085('0x63')];_0x458875[_0xd085('0x1a')]['motionChannel']=_0x4fc7e4[_0xd085('0x63')];_0x458875['message']['event']='reject';respondWithRpcPromise(_0xd085('0x64'),'EventManager',{'event':_0xd085('0x65'),'message':_0x458875[_0xd085('0x1a')]},client9002);return _0x4fc7e4;}return null;})['then'](respondWithResult(_0x20f19c,null))['catch'](handleError(_0x20f19c,null));};exports['status']=function(_0x5bd444,_0x552010){if(_0x5bd444[_0xd085('0x49')]['id']){delete _0x5bd444['body']['id'];}var _0x1139e2;return db['WhatsappMessage']['find']({'where':{'id':_0x5bd444[_0xd085('0x44')]['id']}})['then'](handleEntityNotFound(_0x552010,null))[_0xd085('0x11')](function(_0x3abb05){if(_0x3abb05){_0x1139e2=_0x3abb05;return db[_0xd085('0x66')][_0xd085('0x47')]({'where':{'id':_0x3abb05['WhatsappAccountId']}});}})[_0xd085('0x11')](handleEntityNotFound(_0x552010,null))['then'](function(_0x4bebba){if(_0x4bebba){logger[_0xd085('0x14')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xd085('0x67'),_0x4bebba[_0xd085('0x2d')],util[_0xd085('0x68')](_0x5bd444['body'],{'showHidden':![],'depth':null}));switch(_0x4bebba[_0xd085('0x2d')]){case _0xd085('0x69'):if(_0x5bd444[_0xd085('0x49')][_0xd085('0x6a')]&&_0x5bd444['body']['MessageSid']===_0x1139e2[_0xd085('0x6b')]&&_0x5bd444['body'][_0xd085('0x6c')]&&_0x5bd444['body']['MessageStatus']===_0xd085('0x6d')){return _0x1139e2['update']({'read':!![]});}else{logger[_0xd085('0x17')](_0xd085('0x6e'),_0xd085('0x1c'),_0xd085('0x69'),util[_0xd085('0x68')](_0x5bd444[_0xd085('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x1139e2;}})[_0xd085('0x11')](respondWithResult(_0x552010,null))[_0xd085('0x1b')](handleError(_0x552010,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index eb8dc78..3ea0810 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 _0xcffe=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x23be40,_0x26e1b6){var _0x216312=function(_0x4b03e0){while(--_0x4b03e0){_0x23be40['push'](_0x23be40['shift']());}};_0x216312(++_0x26e1b6);}(_0xcffe,0x1a1));var _0xecff=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xcffe[_0x3b632f];return _0x10e788;};'use strict';var EventEmitter=require(_0xecff('0x0'));var WhatsappMessage=require(_0xecff('0x1'))['db'][_0xecff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xecff('0x3')](0x0);var events={'afterCreate':_0xecff('0x4'),'afterUpdate':_0xecff('0x5'),'afterDestroy':_0xecff('0x6')};function emitEvent(_0x2045b6){return function(_0x352a15,_0xfffe9b,_0x5410f4){WhatsappMessageEvents['emit'](_0x2045b6+':'+_0x352a15['id'],_0x352a15);WhatsappMessageEvents[_0xecff('0x7')](_0x2045b6,_0x352a15);_0x5410f4(null);};}for(var e in events){if(events[_0xecff('0x8')](e)){var event=events[e];WhatsappMessage[_0xecff('0x9')](e,emitEvent(event));}}module[_0xecff('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x49f8=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49f8,0xff));var _0x849f=function(_0x4cca9e,_0x2ce3c3){_0x4cca9e=_0x4cca9e-0x0;var _0x2ee98e=_0x49f8[_0x4cca9e];return _0x2ee98e;};'use strict';var EventEmitter=require(_0x849f('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x849f('0x1')](0x0);var events={'afterCreate':_0x849f('0x2'),'afterUpdate':'update','afterDestroy':_0x849f('0x3')};function emitEvent(_0x5bd156){return function(_0xdf19d3,_0x59d2a8,_0x4786cc){WhatsappMessageEvents['emit'](_0x5bd156+':'+_0xdf19d3['id'],_0xdf19d3);WhatsappMessageEvents[_0x849f('0x4')](_0x5bd156,_0xdf19d3);_0x4786cc(null);};}for(var e in events){if(events[_0x849f('0x5')](e)){var event=events[e];WhatsappMessage[_0x849f('0x6')](e,emitEvent(event));}}module[_0x849f('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1f62837..b023be9 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 _0x0c7b=['isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','secret','find','type','twilio','accountSid','authToken','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0x0c7b,0x189));var _0xb0c7=function(_0x4c05fd,_0x42151a){_0x4c05fd=_0x4c05fd-0x0;var _0x59b2d0=_0x0c7b[_0x4c05fd];return _0x59b2d0;};'use strict';var _=require('lodash');var util=require(_0xb0c7('0x0'));var logger=require(_0xb0c7('0x1'))(_0xb0c7('0x2'));var moment=require(_0xb0c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0c7('0x4'));var fetch=require(_0xb0c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0c7('0x6'));var config=require(_0xb0c7('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb0c7('0x8')]=function(_0x35f764,_0xd16417){return _0x35f764[_0xb0c7('0x9')](_0xb0c7('0xa'),attributes,{'tableName':_0xb0c7('0xb'),'paranoid':![],'indexes':[{'name':_0xb0c7('0xc'),'fields':[_0xb0c7('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0xb0c7('0xd')],'type':_0xb0c7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ecab2,_0x44ba22,_0x59cf4e){var _0x14ace1=_0x35f764[_0xb0c7('0xf')];var _0x18933e=_0x3ecab2[_0xb0c7('0x10')]({'plain':!![]});if(_0x18933e[_0xb0c7('0x11')][_0xb0c7('0x12')]()==='in'||_0x18933e[_0xb0c7('0x11')][_0xb0c7('0x12')]()===_0xb0c7('0x13')&&!_0x18933e['secret']&&!_[_0xb0c7('0x14')](_0x18933e[_0xb0c7('0x15')])){_0x14ace1[_0xb0c7('0x16')]['findOne']({'where':{'id':_0x18933e[_0xb0c7('0x17')]}})[_0xb0c7('0x18')](function(_0x2f7f63){if(_0x2f7f63){_0x2f7f63[_0xb0c7('0x19')]({'lastMsgAt':_0x18933e[_0xb0c7('0x1a')],'lastMsgDirection':_0x18933e['direction'][_0xb0c7('0x12')]()});}})['catch'](function(_0x2cb97d){console[_0xb0c7('0x1b')](_0x2cb97d);});}if(_0x18933e[_0xb0c7('0x11')]===_0xb0c7('0x13')&&!_0x18933e[_0xb0c7('0x1c')]){var _0x5813c4;_0x14ace1['WhatsappAccount'][_0xb0c7('0x1d')]({'where':{'id':_0x18933e['WhatsappAccountId']},'raw':!![]})[_0xb0c7('0x18')](function(_0xb9f91d){_0x5813c4=_0xb9f91d;if(_0x5813c4&&_0x5813c4['type']){switch(_0x5813c4[_0xb0c7('0x1e')]){case _0xb0c7('0x1f'):var _0xa8e3f4=require(_0xb0c7('0x1f'));if(_0x5813c4[_0xb0c7('0x20')]&&_0x5813c4[_0xb0c7('0x21')]&&_0x5813c4['phone']){var _0x2c19db=new _0xa8e3f4(_0x5813c4['accountSid'],_0x5813c4['authToken']);_0x2c19db['messages'][_0xb0c7('0x22')]({'body':_0x18933e[_0xb0c7('0xd')],'to':_0xb0c7('0x23')+_0x18933e['phone'],'from':_0xb0c7('0x23')+_0x5813c4[_0xb0c7('0x24')],'statusCallback':_0x5813c4['remote']+_0xb0c7('0x25')+_0x18933e['id']+_0xb0c7('0x26')+_0x5813c4[_0xb0c7('0x27')]})[_0xb0c7('0x18')](function(_0x3bc3a9){if(_0x3bc3a9[_0xb0c7('0x28')]){return _0x3ecab2[_0xb0c7('0x19')]({'messageId':_0x3bc3a9[_0xb0c7('0x28')]});}})[_0xb0c7('0x29')](function(_0x45d2a0){logger[_0xb0c7('0x1b')](_0xb0c7('0x2a'),_0xb0c7('0x2b'),'twilio',util[_0xb0c7('0x2c')](_0x45d2a0,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb0c7('0x2b'),_0xb0c7('0x1f'),_0xb0c7('0x2d'));}break;case _0xb0c7('0x2e'):var _0x30e2a2=_0x5813c4[_0xb0c7('0x20')];var _0x1deef0=_0x5813c4['authToken'];var _0x4a2976=_0x5813c4[_0xb0c7('0x2f')]+_0xb0c7('0x30')+_0x30e2a2+_0xb0c7('0x31');var _0x51baf0={'to':[_0x18933e[_0xb0c7('0x24')]],'message':{'type':_0xb0c7('0x32'),'text':_0x18933e[_0xb0c7('0xd')]}};var _0x175930={'method':_0xb0c7('0x33'),'uri':_0x4a2976,'headers':{'Authorization':'Bearer\x20'+_0x1deef0,'Content-Type':'application/json'},'body':_0x51baf0,'json':!![]};rp(_0x175930)[_0xb0c7('0x18')](function(_0x2a387f){if(_0x2a387f[_0xb0c7('0x34')][0x0][_0xb0c7('0x35')]){return _0x3ecab2[_0xb0c7('0x19')]({'messageId':_0x2a387f[_0xb0c7('0x34')][0x0]['message_id']});}})[_0xb0c7('0x29')](function(_0x246e45){logger[_0xb0c7('0x36')](_0xb0c7('0x37'),_0x246e45);});break;}}})[_0xb0c7('0x38')](function(){_0x59cf4e();});}else{_0x59cf4e();}}},'charset':_0xb0c7('0x39'),'collate':_0xb0c7('0x3a')});}; \ No newline at end of file +var _0x0698=['exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','find','WhatsappAccountId','twilio','authToken','phone','messages','body','whatsapp:','remote','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes'];(function(_0x2e7c69,_0x24a2c5){var _0xb28b40=function(_0x166325){while(--_0x166325){_0x2e7c69['push'](_0x2e7c69['shift']());}};_0xb28b40(++_0x24a2c5);}(_0x0698,0xc4));var _0x8069=function(_0x452502,_0x11f2a9){_0x452502=_0x452502-0x0;var _0x386ac0=_0x0698[_0x452502];return _0x386ac0;};'use strict';var _=require(_0x8069('0x0'));var util=require(_0x8069('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8069('0x2'));var BPromise=require(_0x8069('0x3'));var rp=require(_0x8069('0x4'));var fetch=require(_0x8069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8069('0x6'));var attributes=require(_0x8069('0x7'));module[_0x8069('0x8')]=function(_0x54bb0d,_0x58507c){return _0x54bb0d[_0x8069('0x9')](_0x8069('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x8069('0xb'),'fields':['messageId']},{'name':_0x8069('0xc'),'fields':['body'],'type':_0x8069('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1174e5,_0x52b5a7,_0x1228ff){var _0x54bdb8=_0x54bb0d['models'];var _0x3269e5=_0x1174e5[_0x8069('0xe')]({'plain':!![]});if(_0x3269e5[_0x8069('0xf')][_0x8069('0x10')]()==='in'||_0x3269e5[_0x8069('0xf')]['toLowerCase']()===_0x8069('0x11')&&!_0x3269e5['secret']&&!_[_0x8069('0x12')](_0x3269e5[_0x8069('0x13')])){_0x54bdb8['WhatsappInteraction']['findOne']({'where':{'id':_0x3269e5[_0x8069('0x14')]}})[_0x8069('0x15')](function(_0x131e3b){if(_0x131e3b){_0x131e3b[_0x8069('0x16')]({'lastMsgAt':_0x3269e5[_0x8069('0x17')],'lastMsgDirection':_0x3269e5[_0x8069('0xf')][_0x8069('0x10')]()});}})[_0x8069('0x18')](function(_0x2c252b){console['error'](_0x2c252b);});}if(_0x3269e5['direction']===_0x8069('0x11')&&!_0x3269e5['secret']){var _0x29aadf;_0x54bdb8['WhatsappAccount'][_0x8069('0x19')]({'where':{'id':_0x3269e5[_0x8069('0x1a')]},'raw':!![]})[_0x8069('0x15')](function(_0x17fd65){_0x29aadf=_0x17fd65;if(_0x29aadf&&_0x29aadf['type']){switch(_0x29aadf['type']){case _0x8069('0x1b'):var _0x1aef99=require(_0x8069('0x1b'));if(_0x29aadf['accountSid']&&_0x29aadf[_0x8069('0x1c')]&&_0x29aadf[_0x8069('0x1d')]){var _0x254138=new _0x1aef99(_0x29aadf['accountSid'],_0x29aadf[_0x8069('0x1c')]);_0x254138[_0x8069('0x1e')]['create']({'body':_0x3269e5[_0x8069('0x1f')],'to':_0x8069('0x20')+_0x3269e5[_0x8069('0x1d')],'from':'whatsapp:'+_0x29aadf[_0x8069('0x1d')],'statusCallback':_0x29aadf[_0x8069('0x21')]+'/api/whatsapp/messages/'+_0x3269e5['id']+'/status?token='+_0x29aadf[_0x8069('0x22')]})[_0x8069('0x15')](function(_0x4c3566){if(_0x4c3566[_0x8069('0x23')]){return _0x1174e5[_0x8069('0x16')]({'messageId':_0x4c3566[_0x8069('0x23')]});}})['catch'](function(_0x1e496f){logger[_0x8069('0x24')](_0x8069('0x25'),'afterCreate',_0x8069('0x1b'),util[_0x8069('0x26')](_0x1e496f,{'showHidden':![],'depth':null}));});}else{logger[_0x8069('0x24')](_0x8069('0x25'),'afterCreate','twilio',_0x8069('0x27'));}break;case'sinch':var _0x56bed4=_0x29aadf['accountSid'];var _0x29584=_0x29aadf[_0x8069('0x1c')];var _0x395f5a=_0x29aadf['baseUrl']+_0x8069('0x28')+_0x56bed4+_0x8069('0x29');var _0xb7e946={'to':[_0x3269e5[_0x8069('0x1d')]],'message':{'type':_0x8069('0x2a'),'text':_0x3269e5[_0x8069('0x1f')]}};var _0x25a341={'method':_0x8069('0x2b'),'uri':_0x395f5a,'headers':{'Authorization':_0x8069('0x2c')+_0x29584,'Content-Type':_0x8069('0x2d')},'body':_0xb7e946,'json':!![]};rp(_0x25a341)[_0x8069('0x15')](function(_0x1ca228){if(_0x1ca228[_0x8069('0x2e')][0x0][_0x8069('0x2f')]){return _0x1174e5['update']({'messageId':_0x1ca228['statuses'][0x0][_0x8069('0x2f')]});}})[_0x8069('0x18')](function(_0x52e30c){logger['err'](_0x8069('0x30'),_0x52e30c);});break;}}})['finally'](function(){_0x1228ff();});}else{_0x1228ff();}}},'charset':_0x8069('0x31'),'collate':_0x8069('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a59b72c..bf2a7e3 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 _0xf854=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird'];(function(_0x2be445,_0x282275){var _0x459614=function(_0x6add12){while(--_0x6add12){_0x2be445['push'](_0x2be445['shift']());}};_0x459614(++_0x282275);}(_0xf854,0xda));var _0x4f85=function(_0x224c4d,_0x473e47){_0x224c4d=_0x224c4d-0x0;var _0x3677c9=_0xf854[_0x224c4d];return _0x3677c9;};'use strict';var _=require(_0x4f85('0x0'));var util=require(_0x4f85('0x1'));var moment=require(_0x4f85('0x2'));var BPromise=require(_0x4f85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f85('0x4'));var db=require(_0x4f85('0x5'))['db'];var utils=require(_0x4f85('0x6'));var logger=require(_0x4f85('0x7'))(_0x4f85('0x8'));var config=require(_0x4f85('0x9'));var jayson=require(_0x4f85('0xa'));var client=jayson[_0x4f85('0xb')][_0x4f85('0xc')]({'port':0x232a});config[_0x4f85('0xd')]=_[_0x4f85('0xe')](config[_0x4f85('0xd')],{'host':_0x4f85('0xf'),'port':0x18eb});var socket=require(_0x4f85('0x10'))(new Redis(config['redis']));require(_0x4f85('0x11'))[_0x4f85('0x12')](socket);function respondWithRpcPromise(_0x4b3adb,_0x192180,_0x17b686){return new BPromise(function(_0x4ed4b1,_0x48668a){return client[_0x4f85('0x13')](_0x4b3adb,_0x17b686)[_0x4f85('0x14')](function(_0x25434f){logger[_0x4f85('0x15')](_0x4f85('0x16'),_0x192180,_0x4f85('0x17'));logger[_0x4f85('0x18')](_0x4f85('0x19'),_0x192180,'request\x20sent',JSON[_0x4f85('0x1a')](_0x25434f));if(_0x25434f[_0x4f85('0x1b')]){if(_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1c')]===0x1f4){logger[_0x4f85('0x1b')](_0x4f85('0x16'),_0x192180,_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);return _0x48668a(_0x25434f[_0x4f85('0x1b')]['message']);}logger[_0x4f85('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x192180,_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);return _0x4ed4b1(_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);}else{logger[_0x4f85('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x192180,_0x4f85('0x17'));_0x4ed4b1(_0x25434f[_0x4f85('0x1e')]['message']);}})[_0x4f85('0x1f')](function(_0x1403f0){logger['error'](_0x4f85('0x16'),_0x192180,_0x1403f0);_0x48668a(_0x1403f0);});});}exports['CreateWhatsappMessage']=function(_0x29ea48){var _0x3dbcea=this;return new Promise(function(_0x12a7d1,_0xd6c3f3){return db[_0x4f85('0x20')][_0x4f85('0x21')](_0x29ea48['body'],{'raw':_0x29ea48[_0x4f85('0x22')]?_0x29ea48[_0x4f85('0x22')][_0x4f85('0x23')]===undefined?!![]:![]:!![]})[_0x4f85('0x14')](function(_0x7a2142){logger[_0x4f85('0x15')](_0x4f85('0x24'),_0x29ea48);logger[_0x4f85('0x18')]('CreateWhatsappMessage',_0x29ea48,JSON[_0x4f85('0x1a')](_0x7a2142));_0x12a7d1(_0x7a2142);})[_0x4f85('0x1f')](function(_0x4375d9){logger[_0x4f85('0x1b')](_0x4f85('0x24'),_0x4375d9['message'],_0x29ea48);_0xd6c3f3(_0x3dbcea[_0x4f85('0x1b')](0x1f4,_0x4375d9[_0x4f85('0x1d')]));});});}; \ No newline at end of file +var _0x5d40=['message','result','catch','CreateWhatsappMessage','options','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2a9b63,_0x27b47d){var _0x1dfd9a=function(_0xfba043){while(--_0xfba043){_0x2a9b63['push'](_0x2a9b63['shift']());}};_0x1dfd9a(++_0x27b47d);}(_0x5d40,0x114));var _0x05d4=function(_0x454000,_0x3499a0){_0x454000=_0x454000-0x0;var _0x2bdffd=_0x5d40[_0x454000];return _0x2bdffd;};'use strict';var _=require(_0x05d4('0x0'));var util=require(_0x05d4('0x1'));var moment=require(_0x05d4('0x2'));var BPromise=require(_0x05d4('0x3'));var rs=require(_0x05d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d4('0x5'))['db'];var utils=require(_0x05d4('0x6'));var logger=require(_0x05d4('0x7'))(_0x05d4('0x8'));var config=require(_0x05d4('0x9'));var jayson=require(_0x05d4('0xa'));var client=jayson[_0x05d4('0xb')]['http']({'port':0x232a});config[_0x05d4('0xc')]=_[_0x05d4('0xd')](config['redis'],{'host':_0x05d4('0xe'),'port':0x18eb});var socket=require(_0x05d4('0xf'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x05d4('0x10')](socket);function respondWithRpcPromise(_0x12fc35,_0x4c9ee5,_0x2fdb94){return new BPromise(function(_0x5110f0,_0x708f3f){return client['request'](_0x12fc35,_0x2fdb94)['then'](function(_0x25a880){logger[_0x05d4('0x11')](_0x05d4('0x12'),_0x4c9ee5,'request\x20sent');logger[_0x05d4('0x13')](_0x05d4('0x14'),_0x4c9ee5,_0x05d4('0x15'),JSON['stringify'](_0x25a880));if(_0x25a880[_0x05d4('0x16')]){if(_0x25a880[_0x05d4('0x16')][_0x05d4('0x17')]===0x1f4){logger['error'](_0x05d4('0x12'),_0x4c9ee5,_0x25a880['error'][_0x05d4('0x18')]);return _0x708f3f(_0x25a880['error'][_0x05d4('0x18')]);}logger['error'](_0x05d4('0x12'),_0x4c9ee5,_0x25a880[_0x05d4('0x16')][_0x05d4('0x18')]);return _0x5110f0(_0x25a880[_0x05d4('0x16')][_0x05d4('0x18')]);}else{logger[_0x05d4('0x11')](_0x05d4('0x12'),_0x4c9ee5,'request\x20sent');_0x5110f0(_0x25a880[_0x05d4('0x19')]['message']);}})[_0x05d4('0x1a')](function(_0x290079){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4c9ee5,_0x290079);_0x708f3f(_0x290079);});});}exports[_0x05d4('0x1b')]=function(_0x4e0bcc){var _0x33f064=this;return new Promise(function(_0x55e8cf,_0x3df2ad){return db['WhatsappMessage']['create'](_0x4e0bcc['body'],{'raw':_0x4e0bcc[_0x05d4('0x1c')]?_0x4e0bcc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c8f96){logger[_0x05d4('0x11')](_0x05d4('0x1b'),_0x4e0bcc);logger[_0x05d4('0x13')](_0x05d4('0x1b'),_0x4e0bcc,JSON[_0x05d4('0x1d')](_0x5c8f96));_0x55e8cf(_0x5c8f96);})[_0x05d4('0x1a')](function(_0xaa7467){logger['error'](_0x05d4('0x1b'),_0xaa7467[_0x05d4('0x18')],_0x4e0bcc);_0x3df2ad(_0x33f064['error'](0x1f4,_0xaa7467[_0x05d4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index a85aafc..8ce091b 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 _0x57ac=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x2faa8a,_0x5668ab){var _0x288d30=function(_0x5e3650){while(--_0x5e3650){_0x2faa8a['push'](_0x2faa8a['shift']());}};_0x288d30(++_0x5668ab);}(_0x57ac,0x127));var _0xc57a=function(_0x403e26,_0x52cfda){_0x403e26=_0x403e26-0x0;var _0x5136e3=_0x57ac[_0x403e26];return _0x5136e3;};'use strict';var WhatsappMessageEvents=require(_0xc57a('0x0'));var events=[_0xc57a('0x1'),_0xc57a('0x2'),_0xc57a('0x3')];function createListener(_0x1dd941,_0x4b5dfa){return function(_0x25872f){_0x4b5dfa[_0xc57a('0x4')](_0x1dd941,_0x25872f);};}function removeListener(_0x38f607,_0x531f27){return function(){WhatsappMessageEvents[_0xc57a('0x5')](_0x38f607,_0x531f27);};}exports[_0xc57a('0x6')]=function(_0x4a2e8c){for(var _0x2e01f7=0x0,_0x27a9e6=events[_0xc57a('0x7')];_0x2e01f7<_0x27a9e6;_0x2e01f7++){var _0xe789ec=events[_0x2e01f7];var _0x441703=createListener(_0xc57a('0x8')+_0xe789ec,_0x4a2e8c);WhatsappMessageEvents['on'](_0xe789ec,_0x441703);}}; \ No newline at end of file +var _0x1e7a=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1e7a,0x1a1));var _0xa1e7=function(_0x2c34b2,_0x1d9ecf){_0x2c34b2=_0x2c34b2-0x0;var _0x1d31b8=_0x1e7a[_0x2c34b2];return _0x1d31b8;};'use strict';var WhatsappMessageEvents=require(_0xa1e7('0x0'));var events=[_0xa1e7('0x1'),_0xa1e7('0x2'),_0xa1e7('0x3')];function createListener(_0x2a1e52,_0x5d00d6){return function(_0x79da7d){_0x5d00d6[_0xa1e7('0x4')](_0x2a1e52,_0x79da7d);};}function removeListener(_0x22e59c,_0x9fd539){return function(){WhatsappMessageEvents[_0xa1e7('0x5')](_0x22e59c,_0x9fd539);};}exports[_0xa1e7('0x6')]=function(_0x2741bb){for(var _0x520352=0x0,_0x300c3c=events[_0xa1e7('0x7')];_0x520352<_0x300c3c;_0x520352++){var _0x447b24=events[_0x520352];var _0x4117f4=createListener(_0xa1e7('0x8')+_0x447b24,_0x2741bb);WhatsappMessageEvents['on'](_0x447b24,_0x4117f4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 245c97a..cc1fd6a 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 _0x9e25=['post','create','addAgents','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x430dfd,_0x4b3e82){var _0x567dfa=function(_0x11175c){while(--_0x11175c){_0x430dfd['push'](_0x430dfd['shift']());}};_0x567dfa(++_0x4b3e82);}(_0x9e25,0x12a));var _0x59e2=function(_0xccf334,_0x603759){_0xccf334=_0xccf334-0x0;var _0x123cf8=_0x9e25[_0xccf334];return _0x123cf8;};'use strict';var multer=require(_0x59e2('0x0'));var util=require(_0x59e2('0x1'));var path=require('path');var timeout=require(_0x59e2('0x2'));var express=require(_0x59e2('0x3'));var router=express[_0x59e2('0x4')]();var fs_extra=require(_0x59e2('0x5'));var auth=require(_0x59e2('0x6'));var interaction=require(_0x59e2('0x7'));var config=require(_0x59e2('0x8'));var controller=require(_0x59e2('0x9'));router[_0x59e2('0xa')]('/',auth[_0x59e2('0xb')](),controller['index']);router['get'](_0x59e2('0xc'),auth[_0x59e2('0xb')](),controller[_0x59e2('0xd')]);router[_0x59e2('0xa')](_0x59e2('0xe'),auth[_0x59e2('0xb')](),controller['show']);router[_0x59e2('0xa')](_0x59e2('0xf'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x10')]);router[_0x59e2('0xa')](_0x59e2('0x11'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x12')]);router[_0x59e2('0xa')](_0x59e2('0x13'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x14')]);router[_0x59e2('0x15')]('/',auth[_0x59e2('0xb')](),controller[_0x59e2('0x16')]);router[_0x59e2('0x15')](_0x59e2('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x59e2('0x15')](_0x59e2('0x13'),auth['isAuthenticated'](),controller[_0x59e2('0x17')]);router['put'](_0x59e2('0xe'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x18')]);router[_0x59e2('0x19')]('/:id',auth[_0x59e2('0xb')](),controller[_0x59e2('0x1a')]);router['delete'](_0x59e2('0x11'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x1b')]);router[_0x59e2('0x19')](_0x59e2('0x13'),auth[_0x59e2('0xb')](),controller['removeAgents']);module[_0x59e2('0x1c')]=router; \ No newline at end of file +var _0xadb3=['show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xadb3,0x1b2));var _0x3adb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xadb3[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x3adb('0x0'));var util=require('util');var path=require(_0x3adb('0x1'));var timeout=require(_0x3adb('0x2'));var express=require('express');var router=express[_0x3adb('0x3')]();var fs_extra=require(_0x3adb('0x4'));var auth=require(_0x3adb('0x5'));var interaction=require(_0x3adb('0x6'));var config=require(_0x3adb('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x3adb('0x8')](),controller[_0x3adb('0x9')]);router[_0x3adb('0xa')](_0x3adb('0xb'),auth[_0x3adb('0x8')](),controller[_0x3adb('0xc')]);router[_0x3adb('0xa')](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0xe')]);router[_0x3adb('0xa')](_0x3adb('0xf'),auth[_0x3adb('0x8')](),controller['getMembers']);router['get'](_0x3adb('0x10'),auth[_0x3adb('0x8')](),controller['getTeams']);router[_0x3adb('0xa')](_0x3adb('0x11'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x12')]);router[_0x3adb('0x13')]('/',auth[_0x3adb('0x8')](),controller[_0x3adb('0x14')]);router[_0x3adb('0x13')](_0x3adb('0x10'),auth['isAuthenticated'](),controller[_0x3adb('0x15')]);router[_0x3adb('0x13')](_0x3adb('0x11'),auth['isAuthenticated'](),controller[_0x3adb('0x16')]);router['put'](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x17')]);router[_0x3adb('0x18')](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x19')]);router[_0x3adb('0x18')](_0x3adb('0x10'),auth['isAuthenticated'](),controller[_0x3adb('0x1a')]);router[_0x3adb('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x3adb('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6a36a33..bce1b6a 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 _0x9c44=['INTEGER','ENUM','rrmemory','beepall','STRING','name'];(function(_0x391b36,_0x51a6a1){var _0x17adc8=function(_0x332491){while(--_0x332491){_0x391b36['push'](_0x391b36['shift']());}};_0x17adc8(++_0x51a6a1);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x49c4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x49c4('0x3')](_0x49c4('0x4'),_0x49c4('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3140=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x3140,0xaf));var _0x0314=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0x3140[_0x1546c2];return _0x24583c;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'name':{'type':Sequelize[_0x0314('0x2')],'unique':_0x0314('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0314('0x4'),_0x0314('0x5'),_0x0314('0x6'))},'description':{'type':Sequelize[_0x0314('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index fe15061..d826853 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 _0x0bc2=['removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','all','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','emit','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','keys','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','WhatsappQueueId','map','filter','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','pick','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0bc2,0x9a));var _0x20bc=function(_0x25731b,_0x473a2f){_0x25731b=_0x25731b-0x0;var _0x4a46cd=_0x0bc2[_0x25731b];return _0x4a46cd;};'use strict';var BPromise=require('bluebird');var util=require(_0x20bc('0x0'));var _=require(_0x20bc('0x1'));var squel=require(_0x20bc('0x2'));var Redis=require(_0x20bc('0x3'));var qs=require(_0x20bc('0x4'));var logger=require(_0x20bc('0x5'))('api');var config=require(_0x20bc('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x20bc('0x7')](config[_0x20bc('0x8')],{'host':_0x20bc('0x9'),'port':0x18eb});var socket=require(_0x20bc('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x20bc('0xb')](socket);function respondWithStatusCode(_0x53b353,_0x59ab94){_0x59ab94=_0x59ab94||0xcc;return function(_0x3dfccd){if(_0x3dfccd){return _0x53b353[_0x20bc('0xc')](_0x59ab94);}return _0x53b353[_0x20bc('0xd')](_0x59ab94)[_0x20bc('0xe')]();};}function respondWithResult(_0x486ed8,_0x483750){_0x483750=_0x483750||0xc8;return function(_0x53dc14){if(_0x53dc14){return _0x486ed8[_0x20bc('0xd')](_0x483750)[_0x20bc('0xf')](_0x53dc14);}};}function respondWithFilteredResult(_0x394072,_0xfef678){return function(_0x3f35a2){if(_0x3f35a2){var _0x5a70b3=typeof _0xfef678[_0x20bc('0x10')]==='undefined'&&typeof _0xfef678['limit']===_0x20bc('0x11');var _0x44a62b=_0x3f35a2[_0x20bc('0x12')];var _0x30aa1e=_0x5a70b3?0x0:_0xfef678['offset'];var _0x2b29de=_0x5a70b3?_0x3f35a2[_0x20bc('0x12')]:_0xfef678[_0x20bc('0x10')]+_0xfef678[_0x20bc('0x13')];var _0x2df78e;if(_0x2b29de>=_0x44a62b){_0x2b29de=_0x44a62b;_0x2df78e=0xc8;}else{_0x2df78e=0xce;}_0x394072[_0x20bc('0xd')](_0x2df78e);return _0x394072[_0x20bc('0x14')](_0x20bc('0x15'),_0x30aa1e+'-'+_0x2b29de+'/'+_0x44a62b)[_0x20bc('0xf')](_0x3f35a2);}return null;};}function saveUpdates(_0x5bab72){return function(_0x2ab64a){if(_0x2ab64a){return _0x2ab64a[_0x20bc('0x16')](_0x5bab72)[_0x20bc('0x17')](function(_0x3b573d){return _0x3b573d;});}return null;};}function removeEntity(_0x1622e8){return function(_0x41b6e2){if(_0x41b6e2){return _0x41b6e2['destroy']()[_0x20bc('0x17')](function(){var _0x168c79=_0x41b6e2[_0x20bc('0x18')]({'plain':!![]});var _0x31e1a2=_0x20bc('0x19');return db[_0x20bc('0x1a')]['destroy']({'where':{'type':_0x31e1a2,'resourceId':_0x168c79['id']}})[_0x20bc('0x17')](function(){return _0x41b6e2;});})['then'](function(){_0x1622e8['status'](0xcc)[_0x20bc('0xe')]();});}};}function handleEntityNotFound(_0xe4bdc6){return function(_0x41cb85){if(!_0x41cb85){_0xe4bdc6[_0x20bc('0xc')](0x194);}return _0x41cb85;};}function handleError(_0x179d08,_0x53adb8){_0x53adb8=_0x53adb8||0x1f4;return function(_0x182f82){logger[_0x20bc('0x1b')](_0x182f82[_0x20bc('0x1c')]);if(_0x182f82['name']){delete _0x182f82[_0x20bc('0x1d')];}_0x179d08[_0x20bc('0xd')](_0x53adb8)[_0x20bc('0x1e')](_0x182f82);};}exports[_0x20bc('0x1f')]=function(_0x28f96f,_0x1ff059){var _0x5c579f={};var _0x4b1630={'count':0x0,'rows':[]};var _0x4d1e7a=_['map'](db[_0x20bc('0x20')][_0x20bc('0x21')],function(_0x2f5d7b){return{'name':_0x2f5d7b['fieldName'],'type':_0x2f5d7b[_0x20bc('0x22')][_0x20bc('0x23')]};});_0x5c579f=qs[_0x20bc('0x24')](_0x4d1e7a,_0x28f96f);var _0x2695ea={'where':_0x5c579f[_0x20bc('0x25')]};return db[_0x20bc('0x20')][_0x20bc('0x12')](_0x2695ea)[_0x20bc('0x17')](function(_0x4dbbab){_0x4b1630[_0x20bc('0x12')]=_0x4dbbab;_0x5c579f['include']=qs[_0x20bc('0x26')](_0x28f96f[_0x20bc('0x27')]);return db[_0x20bc('0x20')][_0x20bc('0x28')](_0x5c579f);})['then'](function(_0x27b5b7){_0x4b1630[_0x20bc('0x29')]=_0x27b5b7;return _0x4b1630;})[_0x20bc('0x17')](respondWithFilteredResult(_0x1ff059,_0x5c579f))[_0x20bc('0x2a')](handleError(_0x1ff059,null));};exports[_0x20bc('0x2b')]=function(_0x406a7b,_0x5d35a4){var _0x4d9e77={'raw':!![],'where':{'id':_0x406a7b[_0x20bc('0x2c')]['id']}},_0x525f4f={};_0x525f4f[_0x20bc('0x2d')]=_['keys'](db[_0x20bc('0x20')][_0x20bc('0x21')]);_0x525f4f[_0x20bc('0x27')]=_['keys'](_0x406a7b[_0x20bc('0x27')]);_0x525f4f[_0x20bc('0x2e')]=_[_0x20bc('0x2f')](_0x525f4f[_0x20bc('0x2d')],_0x525f4f[_0x20bc('0x27')]);_0x4d9e77[_0x20bc('0x30')]=_[_0x20bc('0x2f')](_0x525f4f[_0x20bc('0x2d')],qs[_0x20bc('0x31')](_0x406a7b[_0x20bc('0x27')][_0x20bc('0x31')]));_0x4d9e77[_0x20bc('0x30')]=_0x4d9e77['attributes'][_0x20bc('0x32')]?_0x4d9e77[_0x20bc('0x30')]:_0x525f4f['model'];if(_0x406a7b[_0x20bc('0x27')][_0x20bc('0x33')]){_0x4d9e77[_0x20bc('0x26')]=[{'all':!![]}];}_0x4d9e77=_[_0x20bc('0x34')]({},_0x4d9e77,_0x406a7b[_0x20bc('0x35')]);return db['WhatsappQueue'][_0x20bc('0x36')](_0x4d9e77)[_0x20bc('0x17')](handleEntityNotFound(_0x5d35a4,null))[_0x20bc('0x17')](respondWithResult(_0x5d35a4,null))[_0x20bc('0x2a')](handleError(_0x5d35a4,null));};exports[_0x20bc('0x37')]=function(_0x8cde91,_0x4f80c6){return db[_0x20bc('0x20')][_0x20bc('0x37')](_0x8cde91[_0x20bc('0x38')],{})[_0x20bc('0x17')](function(_0x4a16a2){var _0x10e449=_0x8cde91[_0x20bc('0x39')][_0x20bc('0x18')]({'plain':!![]});if(!_0x10e449)throw new Error(_0x20bc('0x3a'));if(_0x10e449['role']==='user'){var _0x2e12d9=_0x4a16a2[_0x20bc('0x18')]({'plain':!![]});var _0x5a6bba='WhatsappQueues';return db[_0x20bc('0x3b')][_0x20bc('0x36')]({'where':{'name':_0x5a6bba,'userProfileId':_0x10e449[_0x20bc('0x3c')]},'raw':!![]})['then'](function(_0x3cd394){if(_0x3cd394&&_0x3cd394[_0x20bc('0x3d')]===0x0){return db[_0x20bc('0x1a')][_0x20bc('0x37')]({'name':_0x2e12d9['name'],'resourceId':_0x2e12d9['id'],'type':_0x3cd394[_0x20bc('0x1d')],'sectionId':_0x3cd394['id']},{})['then'](function(){return _0x4a16a2;});}else{return _0x4a16a2;}})[_0x20bc('0x2a')](function(_0x7a9e85){logger['error'](_0x20bc('0x3e'),_0x7a9e85);throw _0x7a9e85;});}return _0x4a16a2;})[_0x20bc('0x17')](respondWithResult(_0x4f80c6,0xc9))[_0x20bc('0x2a')](handleError(_0x4f80c6,null));};exports[_0x20bc('0x16')]=function(_0xe93a2e,_0x2e9962){if(_0xe93a2e[_0x20bc('0x38')]['id']){delete _0xe93a2e[_0x20bc('0x38')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0xe93a2e[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x2e9962,null))['then'](saveUpdates(_0xe93a2e[_0x20bc('0x38')],null))[_0x20bc('0x17')](respondWithResult(_0x2e9962,null))[_0x20bc('0x2a')](handleError(_0x2e9962,null));};exports[_0x20bc('0x3f')]=function(_0x445608,_0x55fb31){return db['WhatsappQueue']['find']({'where':{'id':_0x445608[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x55fb31,null))[_0x20bc('0x17')](removeEntity(_0x55fb31,null))[_0x20bc('0x2a')](handleError(_0x55fb31,null));};exports[_0x20bc('0x40')]=function(_0x33fa99,_0x38e2dc){return db[_0x20bc('0x20')]['describe']()[_0x20bc('0x17')](respondWithResult(_0x38e2dc,null))['catch'](handleError(_0x38e2dc,null));};exports[_0x20bc('0x41')]=function(_0x2d30e3,_0x52d7f2){var _0xddbf9e={'raw':!![],'where':{}},_0x24282b={},_0x33b417;return db[_0x20bc('0x20')][_0x20bc('0x42')]({'where':{'id':_0x2d30e3[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x52d7f2,null))[_0x20bc('0x17')](function(_0x4a2c1d){if(_0x4a2c1d){_0x33b417=_0x4a2c1d['get']({'plain':!![]});_0x24282b[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db[_0x20bc('0x44')][_0x20bc('0x21')]);_0x24282b[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x2d30e3[_0x20bc('0x27')]);_0x24282b['filters']=_[_0x20bc('0x2f')](_0x24282b[_0x20bc('0x2d')],_0x24282b[_0x20bc('0x27')]);_0xddbf9e[_0x20bc('0x30')]=_[_0x20bc('0x2f')](_0x24282b[_0x20bc('0x2d')],qs[_0x20bc('0x31')](_0x2d30e3['query'][_0x20bc('0x31')]));_0xddbf9e[_0x20bc('0x30')]=_0xddbf9e[_0x20bc('0x30')][_0x20bc('0x32')]?_0xddbf9e[_0x20bc('0x30')]:_0x24282b[_0x20bc('0x2d')];if(!_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x45')](_0x20bc('0x46'))){_0xddbf9e[_0x20bc('0x13')]=qs[_0x20bc('0x13')](_0x2d30e3['query'][_0x20bc('0x13')]);_0xddbf9e[_0x20bc('0x10')]=qs['offset'](_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x10')]);}_0xddbf9e[_0x20bc('0x47')]=qs[_0x20bc('0x48')](_0x2d30e3['query']['sort']);_0xddbf9e[_0x20bc('0x25')]=qs['filters'](_['pick'](_0x2d30e3[_0x20bc('0x27')],_0x24282b[_0x20bc('0x2e')]));_0xddbf9e[_0x20bc('0x25')][_0x20bc('0x49')]=_0x4a2c1d['id'];if(_0x2d30e3[_0x20bc('0x27')]['filter']){_0xddbf9e[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0xddbf9e['where'],{'$or':_[_0x20bc('0x4a')](_0xddbf9e[_0x20bc('0x30')],function(_0x385d41){var _0x2b6f82={};_0x2b6f82[_0x385d41]={'$like':'%'+_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0x2b6f82;})});}_0xddbf9e=_[_0x20bc('0x34')]({},_0xddbf9e,_0x2d30e3['options']);return db[_0x20bc('0x44')][_0x20bc('0x28')](_0xddbf9e);}})[_0x20bc('0x17')](function(_0x2353fc){if(_0x2353fc){return db[_0x20bc('0x4c')]['findAndCountAll']({'where':{'id':_[_0x20bc('0x4a')](_0x2353fc,_0x20bc('0x4d')),'role':_0x20bc('0x4e')},'attributes':['id',_0x20bc('0x1d'),_0x20bc('0x4f'),'updatedAt',_0x20bc('0x50')]});}})[_0x20bc('0x17')](function(_0x25230f){if(_0x25230f){return{'count':_0x25230f[_0x20bc('0x12')],'rows':_[_0x20bc('0x4a')](_0x25230f[_0x20bc('0x29')],function(_0x2e8482){return{'membername':_0x2e8482[_0x20bc('0x1d')],'UserId':_0x2e8482['id'],'queue_name':_0x33b417[_0x20bc('0x1d')],'WhatsappQueueId':_0x33b417['id'],'interface':util[_0x20bc('0x51')](_0x20bc('0x52'),_0x20bc('0x53'),_0x2e8482[_0x20bc('0x1d')]),'penalty':0x0,'paused':_0x2e8482[_0x20bc('0x4f')],'createdAt':_0x2e8482[_0x20bc('0x50')],'updatedAt':_0x2e8482[_0x20bc('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x20bc('0x17')](respondWithFilteredResult(_0x52d7f2,_0xddbf9e))[_0x20bc('0x2a')](handleError(_0x52d7f2,null));};exports[_0x20bc('0x55')]=function(_0x402070,_0x3c4e52){var _0x444416={};var _0x4a6170={};var _0x5a2322;var _0x44495f;return db['WhatsappQueue'][_0x20bc('0x42')]({'where':{'id':_0x402070[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x3c4e52,null))[_0x20bc('0x17')](function(_0x402508){if(_0x402508){_0x5a2322=_0x402508;_0x4a6170[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db[_0x20bc('0x56')][_0x20bc('0x21')]);_0x4a6170[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x402070[_0x20bc('0x27')]);_0x4a6170['filters']=_[_0x20bc('0x2f')](_0x4a6170['model'],_0x4a6170[_0x20bc('0x27')]);_0x444416[_0x20bc('0x30')]=_['intersection'](_0x4a6170[_0x20bc('0x2d')],qs['fields'](_0x402070[_0x20bc('0x27')]['fields']));_0x444416[_0x20bc('0x30')]=_0x444416['attributes'][_0x20bc('0x32')]?_0x444416[_0x20bc('0x30')]:_0x4a6170['model'];_0x444416['order']=qs[_0x20bc('0x48')](_0x402070[_0x20bc('0x27')]['sort']);_0x444416['where']=qs[_0x20bc('0x2e')](_[_0x20bc('0x57')](_0x402070[_0x20bc('0x27')],_0x4a6170[_0x20bc('0x2e')]));if(_0x402070[_0x20bc('0x27')][_0x20bc('0x4b')]){_0x444416[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0x444416[_0x20bc('0x25')],{'$or':_[_0x20bc('0x4a')](_0x444416[_0x20bc('0x30')],function(_0x28d93f){var _0xb28346={};_0xb28346[_0x28d93f]={'$like':'%'+_0x402070[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0xb28346;})});}_0x444416=_[_0x20bc('0x34')]({},_0x444416,_0x402070[_0x20bc('0x35')]);return _0x5a2322[_0x20bc('0x55')](_0x444416);}})['then'](function(_0x29a73c){if(_0x29a73c){_0x44495f=_0x29a73c['length'];if(!_0x402070[_0x20bc('0x27')][_0x20bc('0x45')](_0x20bc('0x46'))){_0x444416[_0x20bc('0x13')]=qs[_0x20bc('0x13')](_0x402070[_0x20bc('0x27')][_0x20bc('0x13')]);_0x444416[_0x20bc('0x10')]=qs[_0x20bc('0x10')](_0x402070['query']['offset']);}return _0x5a2322[_0x20bc('0x55')](_0x444416);}})[_0x20bc('0x17')](function(_0x5c8db7){if(_0x5c8db7){return _0x5c8db7?{'count':_0x44495f,'rows':_0x5c8db7}:null;}})[_0x20bc('0x17')](respondWithResult(_0x3c4e52,null))['catch'](handleError(_0x3c4e52,null));};exports['addTeams']=function(_0x162261,_0x13d417){var _0x22e400=_0x162261[_0x20bc('0x38')][_0x20bc('0x58')];return db[_0x20bc('0x56')][_0x20bc('0x28')]({'where':{'id':_0x22e400},'attributes':['id'],'include':[{'model':db['User'],'as':_0x20bc('0x59'),'attributes':['id',_0x20bc('0x1d'),_0x20bc('0x5a'),_0x20bc('0x5b'),_0x20bc('0x5c')],'raw':!![]}]})['then'](function(_0x35a4a7){if(_0x35a4a7){var _0x2ef624=_[_0x20bc('0x5d')](_0x35a4a7,function(_0x442e68){var _0x24df67=_0x442e68[_0x20bc('0x18')]({'plain':!![]});return _0x24df67[_0x20bc('0x59')];});return db['WhatsappQueue'][_0x20bc('0x36')]({'where':{'id':_0x162261['params']['id']}})['then'](function(_0xd17165){return db['sequelize']['transaction'](function(_0xa0f608){return _0xd17165[_0x20bc('0x5e')](_0x22e400,{'transaction':_0xa0f608})[_0x20bc('0x17')](function(){return BPromise[_0x20bc('0x5f')](_0x2ef624,function(_0x15c080){return db['UserWhatsappQueue'][_0x20bc('0x60')]({'where':{'UserId':_0x15c080['id'],'WhatsappQueueId':_0x162261[_0x20bc('0x2c')]['id']},'transaction':_0xa0f608});});})[_0x20bc('0x17')](function(){_0x2ef624[_0x20bc('0x61')](function(_0x1a519e){socket['emit']('userWhatsappQueue:save',{'UserId':_0x1a519e['id'],'WhatsappQueueId':_0xd17165['id']});});});});});}})[_0x20bc('0x17')](respondWithStatusCode(_0x13d417,null))[_0x20bc('0x2a')](handleError(_0x13d417,null));};exports[_0x20bc('0x62')]=function(_0x541160,_0x401ffd){return db['Team'][_0x20bc('0x28')]({'where':{'id':_0x541160[_0x20bc('0x27')][_0x20bc('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x20bc('0x59'),'attributes':['id'],'raw':!![]}]})[_0x20bc('0x17')](handleEntityNotFound(_0x401ffd,null))[_0x20bc('0x17')](function(_0x72c36e){var _0x25bf52=_[_0x20bc('0x4a')](_0x72c36e,'id');var _0x572e07=[];var _0x408ba4=[];var _0x416657=squel[_0x20bc('0x63')]();_0x416657['field'](_0x20bc('0x64'))[_0x20bc('0x65')](_0x20bc('0x66'),'tq')[_0x20bc('0x67')]('user_has_teams','ut',_0x20bc('0x68'))['where'](_0x20bc('0x69'),_0x541160[_0x20bc('0x2c')]['id']);for(var _0x3d0b90=0x0;_0x3d0b90<_0x72c36e[_0x20bc('0x32')];_0x3d0b90+=0x1){let _0x25dae7=_0x72c36e[_0x3d0b90];for(var _0x54a1c4=0x0;_0x54a1c4<_0x25dae7[_0x20bc('0x59')][_0x20bc('0x32')];_0x54a1c4+=0x1){let _0x494dd7=_0x25dae7[_0x20bc('0x59')][_0x54a1c4];var _0x569a13=_0x416657[_0x20bc('0x6a')]();_0x569a13['where'](_0x20bc('0x6b'),_0x494dd7['id']);_0x408ba4['push'](db['sequelize'][_0x20bc('0x27')](_0x569a13[_0x20bc('0x6c')](),{'type':db[_0x20bc('0x6d')][_0x20bc('0x6e')][_0x20bc('0x6f')]})['then'](function(_0x3fd960){if(_0x3fd960[_0x20bc('0x32')]===0x1){return _0x494dd7['id'];}else{var _0xd44c7=_['every'](_[_0x20bc('0x4a')](_0x3fd960,'TeamId'),function(_0x49a79a){return _['includes'](_0x25bf52,_0x49a79a);});if(_0xd44c7){return _0x494dd7['id'];}}}));}}return BPromise[_0x20bc('0x70')](_0x408ba4)[_0x20bc('0x17')](function(_0x51bb3a){_0x572e07=_(_0x572e07)['union'](_0x51bb3a)[_0x20bc('0x71')]()[_0x20bc('0x72')]();return db[_0x20bc('0x20')][_0x20bc('0x36')]({'where':{'id':_0x541160[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](function(_0x5edbe4){return db['sequelize'][_0x20bc('0x73')](function(_0xf481c8){return _0x5edbe4['removeTeams'](_0x541160[_0x20bc('0x27')]['ids'],{'transaction':_0xf481c8})[_0x20bc('0x17')](function(){if(!_[_0x20bc('0x74')](_0x572e07)){return _0x5edbe4[_0x20bc('0x75')](_0x572e07,{'transaction':_0xf481c8});}})['then'](function(){_0x572e07[_0x20bc('0x61')](function(_0x101a1d){socket['emit'](_0x20bc('0x76'),{'UserId':_0x101a1d,'WhatsappQueueId':_0x5edbe4['id']});});});});});});})[_0x20bc('0x17')](respondWithStatusCode(_0x401ffd,null))[_0x20bc('0x2a')](handleError(_0x401ffd,null));};exports['addAgents']=function(_0x5700a1,_0x2ee76){return db[_0x20bc('0x20')][_0x20bc('0x36')]({'where':{'id':_0x5700a1['params']['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x2ee76,null))[_0x20bc('0x17')](function(_0x51ad23){if(_0x51ad23){return _0x51ad23[_0x20bc('0x77')](_0x5700a1['body'][_0x20bc('0x58')],_[_0x20bc('0x78')](_0x5700a1[_0x20bc('0x38')],['ids','id'])||{})[_0x20bc('0x79')](function(_0x39a7c8){for(var _0x3f5f02=0x0;_0x3f5f02<_0x5700a1['body'][_0x20bc('0x58')]['length'];_0x3f5f02+=0x1){socket['emit'](_0x20bc('0x7a'),{'UserId':Number(_0x5700a1[_0x20bc('0x38')]['ids'][_0x3f5f02]),'WhatsappQueueId':Number(_0x5700a1['params']['id'])});}return _0x39a7c8;});}})[_0x20bc('0x17')](respondWithResult(_0x2ee76,null))['catch'](handleError(_0x2ee76,null));};exports[_0x20bc('0x75')]=function(_0x5c379a,_0x22c997){return db['WhatsappQueue'][_0x20bc('0x36')]({'where':{'id':_0x5c379a[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x22c997,null))[_0x20bc('0x17')](function(_0x58f26c){if(_0x58f26c){return _0x58f26c[_0x20bc('0x75')](_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')])[_0x20bc('0x17')](function(){if(_[_0x20bc('0x7b')](_0x5c379a['query']['ids'])){for(var _0x5b84b3=0x0;_0x5b84b3<_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')][_0x20bc('0x32')];_0x5b84b3+=0x1){socket['emit'](_0x20bc('0x76'),{'UserId':Number(_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')][_0x5b84b3]),'WhatsappQueueId':Number(_0x5c379a[_0x20bc('0x2c')]['id'])});}}else{socket[_0x20bc('0x7c')]('userWhatsappQueue:remove',{'UserId':Number(_0x5c379a['query'][_0x20bc('0x58')]),'WhatsappQueueId':Number(_0x5c379a['params']['id'])});}});}})[_0x20bc('0x17')](respondWithStatusCode(_0x22c997,null))[_0x20bc('0x2a')](handleError(_0x22c997,null));};exports[_0x20bc('0x7d')]=function(_0x413611,_0x5be9d8){var _0x3fe9d5={};var _0x24f759={};var _0x4fa78d;var _0x2524d2;return db[_0x20bc('0x20')]['findOne']({'where':{'id':_0x413611['params']['id']}})['then'](handleEntityNotFound(_0x5be9d8,null))[_0x20bc('0x17')](function(_0x470b04){if(_0x470b04){_0x4fa78d=_0x470b04;_0x24f759[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db['User'][_0x20bc('0x21')]);_0x24f759[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x413611['query']);_0x24f759[_0x20bc('0x2e')]=_['intersection'](_0x24f759[_0x20bc('0x2d')],_0x24f759[_0x20bc('0x27')]);_0x3fe9d5[_0x20bc('0x30')]=_['intersection'](_0x24f759['model'],qs['fields'](_0x413611[_0x20bc('0x27')][_0x20bc('0x31')]));_0x3fe9d5[_0x20bc('0x30')]=_0x3fe9d5[_0x20bc('0x30')]['length']?_0x3fe9d5[_0x20bc('0x30')]:_0x24f759[_0x20bc('0x2d')];_0x3fe9d5[_0x20bc('0x47')]=qs[_0x20bc('0x48')](_0x413611['query'][_0x20bc('0x48')]);_0x3fe9d5['where']=qs['filters'](_[_0x20bc('0x57')](_0x413611['query'],_0x24f759['filters']));if(_0x413611[_0x20bc('0x27')][_0x20bc('0x4b')]){_0x3fe9d5[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0x3fe9d5[_0x20bc('0x25')],{'$or':_[_0x20bc('0x4a')](_0x3fe9d5[_0x20bc('0x30')],function(_0x54eee9){var _0x2edd35={};_0x2edd35[_0x54eee9]={'$like':'%'+_0x413611[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0x2edd35;})});}_0x3fe9d5=_[_0x20bc('0x34')]({},_0x3fe9d5,_0x413611[_0x20bc('0x35')]);return _0x4fa78d['getAgents'](_0x3fe9d5);}})[_0x20bc('0x17')](function(_0x86dabf){if(_0x86dabf){_0x2524d2=_0x86dabf['length'];if(!_0x413611[_0x20bc('0x27')][_0x20bc('0x45')]('nolimit')){_0x3fe9d5[_0x20bc('0x13')]=qs['limit'](_0x413611[_0x20bc('0x27')]['limit']);_0x3fe9d5[_0x20bc('0x10')]=qs[_0x20bc('0x10')](_0x413611[_0x20bc('0x27')]['offset']);}return _0x4fa78d['getAgents'](_0x3fe9d5);}})[_0x20bc('0x17')](function(_0x28b5be){if(_0x28b5be){return _0x28b5be?{'count':_0x2524d2,'rows':_0x28b5be}:null;}})[_0x20bc('0x17')](respondWithResult(_0x5be9d8,null))[_0x20bc('0x2a')](handleError(_0x5be9d8,null));}; \ No newline at end of file +var _0x3372=['addAgents','omit','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','where','WhatsappQueue','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','findOne','nolimit','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','SIP','updatedAt','getTeams','Team','length','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove'];(function(_0x7b7a8c,_0x7e6e0){var _0x1b3486=function(_0x46c4ee){while(--_0x46c4ee){_0x7b7a8c['push'](_0x7b7a8c['shift']());}};_0x1b3486(++_0x7e6e0);}(_0x3372,0x1f4));var _0x2337=function(_0x26a0a4,_0x5be4cb){_0x26a0a4=_0x26a0a4-0x0;var _0x2481a3=_0x3372[_0x26a0a4];return _0x2481a3;};'use strict';var BPromise=require(_0x2337('0x0'));var util=require(_0x2337('0x1'));var _=require('lodash');var squel=require(_0x2337('0x2'));var Redis=require(_0x2337('0x3'));var qs=require(_0x2337('0x4'));var logger=require(_0x2337('0x5'))('api');var config=require(_0x2337('0x6'));var db=require(_0x2337('0x7'))['db'];config[_0x2337('0x8')]=_[_0x2337('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2337('0xa'))(new Redis(config['redis']));require(_0x2337('0xb'))[_0x2337('0xc')](socket);function respondWithStatusCode(_0x5d5a7c,_0x524a1b){_0x524a1b=_0x524a1b||0xcc;return function(_0x2792e3){if(_0x2792e3){return _0x5d5a7c[_0x2337('0xd')](_0x524a1b);}return _0x5d5a7c['status'](_0x524a1b)[_0x2337('0xe')]();};}function respondWithResult(_0x5ee82a,_0x516543){_0x516543=_0x516543||0xc8;return function(_0x351188){if(_0x351188){return _0x5ee82a['status'](_0x516543)[_0x2337('0xf')](_0x351188);}};}function respondWithFilteredResult(_0x2defba,_0x2b3584){return function(_0x3565a5){if(_0x3565a5){var _0x4c0b01=typeof _0x2b3584[_0x2337('0x10')]===_0x2337('0x11')&&typeof _0x2b3584[_0x2337('0x12')]===_0x2337('0x11');var _0x1ba094=_0x3565a5[_0x2337('0x13')];var _0x108235=_0x4c0b01?0x0:_0x2b3584['offset'];var _0x2137d3=_0x4c0b01?_0x3565a5[_0x2337('0x13')]:_0x2b3584[_0x2337('0x10')]+_0x2b3584[_0x2337('0x12')];var _0x4c889b;if(_0x2137d3>=_0x1ba094){_0x2137d3=_0x1ba094;_0x4c889b=0xc8;}else{_0x4c889b=0xce;}_0x2defba[_0x2337('0x14')](_0x4c889b);return _0x2defba['set'](_0x2337('0x15'),_0x108235+'-'+_0x2137d3+'/'+_0x1ba094)[_0x2337('0xf')](_0x3565a5);}return null;};}function saveUpdates(_0x56bb3a){return function(_0x4311c4){if(_0x4311c4){return _0x4311c4[_0x2337('0x16')](_0x56bb3a)[_0x2337('0x17')](function(_0x89e569){return _0x89e569;});}return null;};}function removeEntity(_0x18c243){return function(_0x113373){if(_0x113373){return _0x113373['destroy']()[_0x2337('0x17')](function(){var _0x5a1229=_0x113373[_0x2337('0x18')]({'plain':!![]});var _0x11f5cb='WhatsappQueues';return db[_0x2337('0x19')][_0x2337('0x1a')]({'where':{'type':_0x11f5cb,'resourceId':_0x5a1229['id']}})[_0x2337('0x17')](function(){return _0x113373;});})[_0x2337('0x17')](function(){_0x18c243[_0x2337('0x14')](0xcc)[_0x2337('0xe')]();});}};}function handleEntityNotFound(_0x3cce8d){return function(_0x3cdcef){if(!_0x3cdcef){_0x3cce8d[_0x2337('0xd')](0x194);}return _0x3cdcef;};}function handleError(_0x53dd8f,_0x49baf1){_0x49baf1=_0x49baf1||0x1f4;return function(_0x599975){logger[_0x2337('0x1b')](_0x599975[_0x2337('0x1c')]);if(_0x599975[_0x2337('0x1d')]){delete _0x599975[_0x2337('0x1d')];}_0x53dd8f['status'](_0x49baf1)[_0x2337('0x1e')](_0x599975);};}exports[_0x2337('0x1f')]=function(_0x5c977f,_0x5d5d2e){var _0x44a5b0={};var _0x4259e1={'count':0x0,'rows':[]};var _0x188264=_[_0x2337('0x20')](db['WhatsappQueue'][_0x2337('0x21')],function(_0x539abf){return{'name':_0x539abf[_0x2337('0x22')],'type':_0x539abf[_0x2337('0x23')]['key']};});_0x44a5b0=qs['getOptions'](_0x188264,_0x5c977f);var _0x4e0885={'where':_0x44a5b0[_0x2337('0x24')]};return db[_0x2337('0x25')][_0x2337('0x13')](_0x4e0885)[_0x2337('0x17')](function(_0x4973ae){_0x4259e1[_0x2337('0x13')]=_0x4973ae;_0x44a5b0['include']=qs[_0x2337('0x26')](_0x5c977f[_0x2337('0x27')]);return db[_0x2337('0x25')][_0x2337('0x28')](_0x44a5b0);})[_0x2337('0x17')](function(_0x1d3e96){_0x4259e1[_0x2337('0x29')]=_0x1d3e96;return _0x4259e1;})[_0x2337('0x17')](respondWithFilteredResult(_0x5d5d2e,_0x44a5b0))[_0x2337('0x2a')](handleError(_0x5d5d2e,null));};exports['show']=function(_0xaaf7c5,_0x1e3117){var _0x2ae26f={'raw':!![],'where':{'id':_0xaaf7c5[_0x2337('0x2b')]['id']}},_0x32ebcc={};_0x32ebcc[_0x2337('0x2c')]=_['keys'](db[_0x2337('0x25')][_0x2337('0x21')]);_0x32ebcc[_0x2337('0x27')]=_[_0x2337('0x2d')](_0xaaf7c5[_0x2337('0x27')]);_0x32ebcc[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x32ebcc['model'],_0x32ebcc[_0x2337('0x27')]);_0x2ae26f[_0x2337('0x30')]=_[_0x2337('0x2f')](_0x32ebcc[_0x2337('0x2c')],qs[_0x2337('0x31')](_0xaaf7c5[_0x2337('0x27')][_0x2337('0x31')]));_0x2ae26f[_0x2337('0x30')]=_0x2ae26f[_0x2337('0x30')]['length']?_0x2ae26f['attributes']:_0x32ebcc[_0x2337('0x2c')];if(_0xaaf7c5[_0x2337('0x27')]['includeAll']){_0x2ae26f[_0x2337('0x26')]=[{'all':!![]}];}_0x2ae26f=_[_0x2337('0x32')]({},_0x2ae26f,_0xaaf7c5[_0x2337('0x33')]);return db[_0x2337('0x25')][_0x2337('0x34')](_0x2ae26f)['then'](handleEntityNotFound(_0x1e3117,null))[_0x2337('0x17')](respondWithResult(_0x1e3117,null))['catch'](handleError(_0x1e3117,null));};exports[_0x2337('0x35')]=function(_0x3e7302,_0x102293){return db[_0x2337('0x25')]['create'](_0x3e7302[_0x2337('0x36')],{})[_0x2337('0x17')](function(_0x5167d8){var _0x469c21=_0x3e7302[_0x2337('0x37')][_0x2337('0x18')]({'plain':!![]});if(!_0x469c21)throw new Error(_0x2337('0x38'));if(_0x469c21[_0x2337('0x39')]===_0x2337('0x37')){var _0x4e01fa=_0x5167d8[_0x2337('0x18')]({'plain':!![]});var _0xbb2e08=_0x2337('0x3a');return db[_0x2337('0x3b')][_0x2337('0x34')]({'where':{'name':_0xbb2e08,'userProfileId':_0x469c21[_0x2337('0x3c')]},'raw':!![]})['then'](function(_0x33436e){if(_0x33436e&&_0x33436e[_0x2337('0x3d')]===0x0){return db['UserProfileResource'][_0x2337('0x35')]({'name':_0x4e01fa[_0x2337('0x1d')],'resourceId':_0x4e01fa['id'],'type':_0x33436e[_0x2337('0x1d')],'sectionId':_0x33436e['id']},{})['then'](function(){return _0x5167d8;});}else{return _0x5167d8;}})[_0x2337('0x2a')](function(_0x2ef1bf){logger[_0x2337('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef1bf);throw _0x2ef1bf;});}return _0x5167d8;})[_0x2337('0x17')](respondWithResult(_0x102293,0xc9))['catch'](handleError(_0x102293,null));};exports[_0x2337('0x16')]=function(_0x580ffb,_0x58251a){if(_0x580ffb['body']['id']){delete _0x580ffb['body']['id'];}return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x580ffb[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x58251a,null))[_0x2337('0x17')](saveUpdates(_0x580ffb['body'],null))[_0x2337('0x17')](respondWithResult(_0x58251a,null))[_0x2337('0x2a')](handleError(_0x58251a,null));};exports['destroy']=function(_0x197f2e,_0x51703b){return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x197f2e['params']['id']}})['then'](handleEntityNotFound(_0x51703b,null))[_0x2337('0x17')](removeEntity(_0x51703b,null))[_0x2337('0x2a')](handleError(_0x51703b,null));};exports[_0x2337('0x3e')]=function(_0x46c4e4,_0x26ba1){return db[_0x2337('0x25')][_0x2337('0x3e')]()[_0x2337('0x17')](respondWithResult(_0x26ba1,null))[_0x2337('0x2a')](handleError(_0x26ba1,null));};exports['getMembers']=function(_0x2f0787,_0x573807){var _0x462f4c={'raw':!![],'where':{}},_0x474067={},_0x82d3c1;return db[_0x2337('0x25')][_0x2337('0x3f')]({'where':{'id':_0x2f0787[_0x2337('0x2b')]['id']}})['then'](handleEntityNotFound(_0x573807,null))[_0x2337('0x17')](function(_0x38d74e){if(_0x38d74e){_0x82d3c1=_0x38d74e['get']({'plain':!![]});_0x474067[_0x2337('0x2c')]=_[_0x2337('0x2d')](db['UserWhatsappQueue'][_0x2337('0x21')]);_0x474067[_0x2337('0x27')]=_['keys'](_0x2f0787['query']);_0x474067[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x474067[_0x2337('0x2c')],_0x474067[_0x2337('0x27')]);_0x462f4c['attributes']=_['intersection'](_0x474067[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x2f0787[_0x2337('0x27')][_0x2337('0x31')]));_0x462f4c['attributes']=_0x462f4c['attributes']['length']?_0x462f4c[_0x2337('0x30')]:_0x474067['model'];if(!_0x2f0787[_0x2337('0x27')]['hasOwnProperty'](_0x2337('0x40'))){_0x462f4c[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x2f0787[_0x2337('0x27')][_0x2337('0x12')]);_0x462f4c[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x2f0787[_0x2337('0x27')]['offset']);}_0x462f4c[_0x2337('0x41')]=qs[_0x2337('0x42')](_0x2f0787[_0x2337('0x27')][_0x2337('0x42')]);_0x462f4c[_0x2337('0x24')]=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x2f0787[_0x2337('0x27')],_0x474067[_0x2337('0x2e')]));_0x462f4c['where'][_0x2337('0x44')]=_0x38d74e['id'];if(_0x2f0787[_0x2337('0x27')][_0x2337('0x45')]){_0x462f4c[_0x2337('0x24')]=_['merge'](_0x462f4c[_0x2337('0x24')],{'$or':_[_0x2337('0x20')](_0x462f4c[_0x2337('0x30')],function(_0x32007b){var _0x17c282={};_0x17c282[_0x32007b]={'$like':'%'+_0x2f0787['query']['filter']+'%'};return _0x17c282;})});}_0x462f4c=_[_0x2337('0x32')]({},_0x462f4c,_0x2f0787[_0x2337('0x33')]);return db[_0x2337('0x46')]['findAll'](_0x462f4c);}})['then'](function(_0x421da9){if(_0x421da9){return db[_0x2337('0x47')][_0x2337('0x48')]({'where':{'id':_[_0x2337('0x20')](_0x421da9,_0x2337('0x49')),'role':_0x2337('0x4a')},'attributes':['id',_0x2337('0x1d'),_0x2337('0x4b'),'updatedAt',_0x2337('0x4c')]});}})[_0x2337('0x17')](function(_0x4705a1){if(_0x4705a1){return{'count':_0x4705a1[_0x2337('0x13')],'rows':_[_0x2337('0x20')](_0x4705a1['rows'],function(_0x46b16a){return{'membername':_0x46b16a[_0x2337('0x1d')],'UserId':_0x46b16a['id'],'queue_name':_0x82d3c1[_0x2337('0x1d')],'WhatsappQueueId':_0x82d3c1['id'],'interface':util[_0x2337('0x4d')]('%s/%s',_0x2337('0x4e'),_0x46b16a['name']),'penalty':0x0,'paused':_0x46b16a[_0x2337('0x4b')],'createdAt':_0x46b16a[_0x2337('0x4c')],'updatedAt':_0x46b16a[_0x2337('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2337('0x17')](respondWithFilteredResult(_0x573807,_0x462f4c))[_0x2337('0x2a')](handleError(_0x573807,null));};exports[_0x2337('0x50')]=function(_0x126bb3,_0x1fb922){var _0x3cee31={};var _0x5e58cb={};var _0x4d04bd;var _0x5e7072;return db[_0x2337('0x25')]['findOne']({'where':{'id':_0x126bb3[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x1fb922,null))[_0x2337('0x17')](function(_0x54ca6c){if(_0x54ca6c){_0x4d04bd=_0x54ca6c;_0x5e58cb[_0x2337('0x2c')]=_[_0x2337('0x2d')](db[_0x2337('0x51')]['rawAttributes']);_0x5e58cb['query']=_[_0x2337('0x2d')](_0x126bb3['query']);_0x5e58cb[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x5e58cb[_0x2337('0x2c')],_0x5e58cb['query']);_0x3cee31[_0x2337('0x30')]=_[_0x2337('0x2f')](_0x5e58cb[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x126bb3[_0x2337('0x27')][_0x2337('0x31')]));_0x3cee31[_0x2337('0x30')]=_0x3cee31['attributes'][_0x2337('0x52')]?_0x3cee31[_0x2337('0x30')]:_0x5e58cb[_0x2337('0x2c')];_0x3cee31[_0x2337('0x41')]=qs['sort'](_0x126bb3[_0x2337('0x27')][_0x2337('0x42')]);_0x3cee31['where']=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x126bb3[_0x2337('0x27')],_0x5e58cb[_0x2337('0x2e')]));if(_0x126bb3[_0x2337('0x27')][_0x2337('0x45')]){_0x3cee31[_0x2337('0x24')]=_[_0x2337('0x32')](_0x3cee31[_0x2337('0x24')],{'$or':_['map'](_0x3cee31[_0x2337('0x30')],function(_0x5e0142){var _0x306a52={};_0x306a52[_0x5e0142]={'$like':'%'+_0x126bb3['query'][_0x2337('0x45')]+'%'};return _0x306a52;})});}_0x3cee31=_[_0x2337('0x32')]({},_0x3cee31,_0x126bb3[_0x2337('0x33')]);return _0x4d04bd[_0x2337('0x50')](_0x3cee31);}})[_0x2337('0x17')](function(_0x5b4a66){if(_0x5b4a66){_0x5e7072=_0x5b4a66[_0x2337('0x52')];if(!_0x126bb3[_0x2337('0x27')][_0x2337('0x53')](_0x2337('0x40'))){_0x3cee31[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x126bb3['query']['limit']);_0x3cee31[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x126bb3[_0x2337('0x27')][_0x2337('0x10')]);}return _0x4d04bd[_0x2337('0x50')](_0x3cee31);}})['then'](function(_0x5b287e){if(_0x5b287e){return _0x5b287e?{'count':_0x5e7072,'rows':_0x5b287e}:null;}})[_0x2337('0x17')](respondWithResult(_0x1fb922,null))[_0x2337('0x2a')](handleError(_0x1fb922,null));};exports['addTeams']=function(_0x4c7b6c,_0x791942){var _0x10fbcf=_0x4c7b6c['body'][_0x2337('0x54')];return db[_0x2337('0x51')]['findAll']({'where':{'id':_0x10fbcf},'attributes':['id'],'include':[{'model':db[_0x2337('0x47')],'as':_0x2337('0x55'),'attributes':['id','name',_0x2337('0x56'),_0x2337('0x57'),_0x2337('0x58')],'raw':!![]}]})['then'](function(_0x1e679e){if(_0x1e679e){var _0x35776b=_[_0x2337('0x59')](_0x1e679e,function(_0x2b8cee){var _0x2627d5=_0x2b8cee['get']({'plain':!![]});return _0x2627d5[_0x2337('0x55')];});return db['WhatsappQueue'][_0x2337('0x34')]({'where':{'id':_0x4c7b6c[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](function(_0x26a1a1){return db[_0x2337('0x5a')][_0x2337('0x5b')](function(_0x4045fc){return _0x26a1a1[_0x2337('0x5c')](_0x10fbcf,{'transaction':_0x4045fc})['then'](function(){return BPromise[_0x2337('0x5d')](_0x35776b,function(_0x3b15df){return db['UserWhatsappQueue'][_0x2337('0x5e')]({'where':{'UserId':_0x3b15df['id'],'WhatsappQueueId':_0x4c7b6c['params']['id']},'transaction':_0x4045fc});});})[_0x2337('0x17')](function(){_0x35776b[_0x2337('0x5f')](function(_0xe4d1e8){socket[_0x2337('0x60')](_0x2337('0x61'),{'UserId':_0xe4d1e8['id'],'WhatsappQueueId':_0x26a1a1['id']});});});});});}})['then'](respondWithStatusCode(_0x791942,null))[_0x2337('0x2a')](handleError(_0x791942,null));};exports[_0x2337('0x62')]=function(_0x274f7a,_0x3793bc){return db[_0x2337('0x51')][_0x2337('0x28')]({'where':{'id':_0x274f7a[_0x2337('0x27')][_0x2337('0x54')]},'attributes':['id'],'include':[{'model':db[_0x2337('0x47')],'as':_0x2337('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3793bc,null))[_0x2337('0x17')](function(_0x5a9363){var _0x3587a4=_[_0x2337('0x20')](_0x5a9363,'id');var _0x346444=[];var _0x2bdcd8=[];var _0x443739=squel[_0x2337('0x63')]();_0x443739[_0x2337('0x64')](_0x2337('0x65'))[_0x2337('0x66')](_0x2337('0x67'),'tq')['join'](_0x2337('0x68'),'ut',_0x2337('0x69'))[_0x2337('0x24')](_0x2337('0x6a'),_0x274f7a[_0x2337('0x2b')]['id']);for(var _0x16c121=0x0;_0x16c121<_0x5a9363[_0x2337('0x52')];_0x16c121+=0x1){let _0x3af7c6=_0x5a9363[_0x16c121];for(var _0x1ba30f=0x0;_0x1ba30f<_0x3af7c6[_0x2337('0x55')][_0x2337('0x52')];_0x1ba30f+=0x1){let _0x273af1=_0x3af7c6['Agents'][_0x1ba30f];var _0x39c47f=_0x443739[_0x2337('0x6b')]();_0x39c47f[_0x2337('0x24')](_0x2337('0x6c'),_0x273af1['id']);_0x2bdcd8['push'](db[_0x2337('0x5a')][_0x2337('0x27')](_0x39c47f[_0x2337('0x6d')](),{'type':db[_0x2337('0x5a')]['QueryTypes'][_0x2337('0x6e')]})[_0x2337('0x17')](function(_0x54793c){if(_0x54793c[_0x2337('0x52')]===0x1){return _0x273af1['id'];}else{var _0x5956a6=_[_0x2337('0x6f')](_[_0x2337('0x20')](_0x54793c,_0x2337('0x70')),function(_0x843db6){return _[_0x2337('0x71')](_0x3587a4,_0x843db6);});if(_0x5956a6){return _0x273af1['id'];}}}));}}return BPromise[_0x2337('0x72')](_0x2bdcd8)[_0x2337('0x17')](function(_0x43e9){_0x346444=_(_0x346444)[_0x2337('0x73')](_0x43e9)[_0x2337('0x74')]()['value']();return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x274f7a[_0x2337('0x2b')]['id']}})['then'](function(_0x48e936){return db[_0x2337('0x5a')][_0x2337('0x5b')](function(_0x12189a){return _0x48e936[_0x2337('0x62')](_0x274f7a[_0x2337('0x27')][_0x2337('0x54')],{'transaction':_0x12189a})['then'](function(){if(!_[_0x2337('0x75')](_0x346444)){return _0x48e936[_0x2337('0x76')](_0x346444,{'transaction':_0x12189a});}})[_0x2337('0x17')](function(){_0x346444[_0x2337('0x5f')](function(_0x168053){socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':_0x168053,'WhatsappQueueId':_0x48e936['id']});});});});});});})['then'](respondWithStatusCode(_0x3793bc,null))[_0x2337('0x2a')](handleError(_0x3793bc,null));};exports['addAgents']=function(_0x3a13ed,_0x59b356){return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x3a13ed['params']['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x59b356,null))[_0x2337('0x17')](function(_0x30151a){if(_0x30151a){return _0x30151a[_0x2337('0x78')](_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')],_[_0x2337('0x79')](_0x3a13ed[_0x2337('0x36')],['ids','id'])||{})['spread'](function(_0xe3e987){for(var _0x5d123e=0x0;_0x5d123e<_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')][_0x2337('0x52')];_0x5d123e+=0x1){socket[_0x2337('0x60')](_0x2337('0x61'),{'UserId':Number(_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')][_0x5d123e]),'WhatsappQueueId':Number(_0x3a13ed[_0x2337('0x2b')]['id'])});}return _0xe3e987;});}})[_0x2337('0x17')](respondWithResult(_0x59b356,null))[_0x2337('0x2a')](handleError(_0x59b356,null));};exports['removeAgents']=function(_0x4f4267,_0x181736){return db[_0x2337('0x25')]['find']({'where':{'id':_0x4f4267[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x181736,null))[_0x2337('0x17')](function(_0x57a8fd){if(_0x57a8fd){return _0x57a8fd['removeAgents'](_0x4f4267['query'][_0x2337('0x54')])[_0x2337('0x17')](function(){if(_[_0x2337('0x7a')](_0x4f4267[_0x2337('0x27')][_0x2337('0x54')])){for(var _0x1f70e0=0x0;_0x1f70e0<_0x4f4267[_0x2337('0x27')][_0x2337('0x54')][_0x2337('0x52')];_0x1f70e0+=0x1){socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':Number(_0x4f4267[_0x2337('0x27')][_0x2337('0x54')][_0x1f70e0]),'WhatsappQueueId':Number(_0x4f4267[_0x2337('0x2b')]['id'])});}}else{socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':Number(_0x4f4267[_0x2337('0x27')]['ids']),'WhatsappQueueId':Number(_0x4f4267[_0x2337('0x2b')]['id'])});}});}})[_0x2337('0x17')](respondWithStatusCode(_0x181736,null))[_0x2337('0x2a')](handleError(_0x181736,null));};exports[_0x2337('0x7b')]=function(_0x3aec94,_0x19d9ab){var _0x493e99={};var _0x569bff={};var _0x29b1a4;var _0x49fa49;return db[_0x2337('0x25')][_0x2337('0x3f')]({'where':{'id':_0x3aec94['params']['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x19d9ab,null))['then'](function(_0x1a92a2){if(_0x1a92a2){_0x29b1a4=_0x1a92a2;_0x569bff[_0x2337('0x2c')]=_[_0x2337('0x2d')](db[_0x2337('0x47')]['rawAttributes']);_0x569bff['query']=_[_0x2337('0x2d')](_0x3aec94[_0x2337('0x27')]);_0x569bff[_0x2337('0x2e')]=_['intersection'](_0x569bff[_0x2337('0x2c')],_0x569bff[_0x2337('0x27')]);_0x493e99[_0x2337('0x30')]=_['intersection'](_0x569bff[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x3aec94[_0x2337('0x27')][_0x2337('0x31')]));_0x493e99[_0x2337('0x30')]=_0x493e99[_0x2337('0x30')][_0x2337('0x52')]?_0x493e99[_0x2337('0x30')]:_0x569bff[_0x2337('0x2c')];_0x493e99[_0x2337('0x41')]=qs[_0x2337('0x42')](_0x3aec94['query'][_0x2337('0x42')]);_0x493e99['where']=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x3aec94[_0x2337('0x27')],_0x569bff[_0x2337('0x2e')]));if(_0x3aec94[_0x2337('0x27')][_0x2337('0x45')]){_0x493e99[_0x2337('0x24')]=_[_0x2337('0x32')](_0x493e99['where'],{'$or':_['map'](_0x493e99[_0x2337('0x30')],function(_0xca3616){var _0x5249d8={};_0x5249d8[_0xca3616]={'$like':'%'+_0x3aec94['query'][_0x2337('0x45')]+'%'};return _0x5249d8;})});}_0x493e99=_[_0x2337('0x32')]({},_0x493e99,_0x3aec94['options']);return _0x29b1a4[_0x2337('0x7b')](_0x493e99);}})[_0x2337('0x17')](function(_0x17e549){if(_0x17e549){_0x49fa49=_0x17e549[_0x2337('0x52')];if(!_0x3aec94['query'][_0x2337('0x53')](_0x2337('0x40'))){_0x493e99[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x3aec94[_0x2337('0x27')]['limit']);_0x493e99[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x3aec94[_0x2337('0x27')][_0x2337('0x10')]);}return _0x29b1a4[_0x2337('0x7b')](_0x493e99);}})[_0x2337('0x17')](function(_0x39d405){if(_0x39d405){return _0x39d405?{'count':_0x49fa49,'rows':_0x39d405}:null;}})[_0x2337('0x17')](respondWithResult(_0x19d9ab,null))['catch'](handleError(_0x19d9ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 50c458e..6f231bf 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 _0xec51=['WhatsappQueue','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xec51,0xa1));var _0x1ec5=function(_0xa34f01,_0x4dfd44){_0xa34f01=_0xa34f01-0x0;var _0x34c117=_0xec51[_0xa34f01];return _0x34c117;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x1ec5('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ec5('0x1'),'afterDestroy':_0x1ec5('0x2')};function emitEvent(_0xff72e4){return function(_0x27c46f,_0x426fa9,_0x31e414){WhatsappQueueEvents[_0x1ec5('0x3')](_0xff72e4+':'+_0x27c46f['id'],_0x27c46f);WhatsappQueueEvents['emit'](_0xff72e4,_0x27c46f);_0x31e414(null);};}for(var e in events){if(events[_0x1ec5('0x4')](e)){var event=events[e];WhatsappQueue[_0x1ec5('0x5')](e,emitEvent(event));}}module[_0x1ec5('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9072=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x16787a,_0x1038d1){var _0x465ccb=function(_0x378066){while(--_0x378066){_0x16787a['push'](_0x16787a['shift']());}};_0x465ccb(++_0x1038d1);}(_0x9072,0x1e3));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2907('0x0'));var WhatsappQueue=require(_0x2907('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2907('0x2')](0x0);var events={'afterCreate':_0x2907('0x3'),'afterUpdate':_0x2907('0x4'),'afterDestroy':_0x2907('0x5')};function emitEvent(_0x1e1168){return function(_0xc0de29,_0x1ce2cf,_0x21ab71){WhatsappQueueEvents['emit'](_0x1e1168+':'+_0xc0de29['id'],_0xc0de29);WhatsappQueueEvents[_0x2907('0x6')](_0x1e1168,_0xc0de29);_0x21ab71(null);};}for(var e in events){if(events[_0x2907('0x7')](e)){var event=events[e];WhatsappQueue[_0x2907('0x8')](e,emitEvent(event));}}module[_0x2907('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9f13620..0cffb60 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 _0xd5b0=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59d7f1,_0x43a185){var _0x5b6e21=function(_0x1388c4){while(--_0x1388c4){_0x59d7f1['push'](_0x59d7f1['shift']());}};_0x5b6e21(++_0x43a185);}(_0xd5b0,0x182));var _0x0d5b=function(_0x11f75e,_0x10a020){_0x11f75e=_0x11f75e-0x0;var _0x11f58a=_0xd5b0[_0x11f75e];return _0x11f58a;};'use strict';var _=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var logger=require(_0x0d5b('0x2'))(_0x0d5b('0x3'));var moment=require('moment');var BPromise=require(_0x0d5b('0x4'));var rp=require(_0x0d5b('0x5'));var fs=require('fs');var path=require(_0x0d5b('0x6'));var rimraf=require(_0x0d5b('0x7'));var config=require(_0x0d5b('0x8'));var attributes=require(_0x0d5b('0x9'));module[_0x0d5b('0xa')]=function(_0x3c2339,_0x235da1){return _0x3c2339[_0x0d5b('0xb')](_0x0d5b('0xc'),attributes,{'tableName':_0x0d5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf592=['define','WhatsappQueue','whatsapp_queues','lodash','api','path','rimraf'];(function(_0x3b4cbb,_0x40e989){var _0x35ae45=function(_0x11e53b){while(--_0x11e53b){_0x3b4cbb['push'](_0x3b4cbb['shift']());}};_0x35ae45(++_0x40e989);}(_0xf592,0x7a));var _0x2f59=function(_0x578b52,_0x26ffe1){_0x578b52=_0x578b52-0x0;var _0x4702b5=_0xf592[_0x578b52];return _0x4702b5;};'use strict';var _=require(_0x2f59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f59('0x2'));var rimraf=require(_0x2f59('0x3'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x2c1446,_0x5384f9){return _0x2c1446[_0x2f59('0x4')](_0x2f59('0x5'),attributes,{'tableName':_0x2f59('0x6'),'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 835092c..9b6dd50 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 _0x3a82=['raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3a82,0xb9));var _0x23a8=function(_0x433993,_0x54adeb){_0x433993=_0x433993-0x0;var _0x1e9ddf=_0x3a82[_0x433993];return _0x1e9ddf;};'use strict';var _=require(_0x23a8('0x0'));var util=require(_0x23a8('0x1'));var moment=require(_0x23a8('0x2'));var BPromise=require(_0x23a8('0x3'));var rs=require(_0x23a8('0x4'));var fs=require('fs');var Redis=require(_0x23a8('0x5'));var db=require(_0x23a8('0x6'))['db'];var utils=require(_0x23a8('0x7'));var logger=require(_0x23a8('0x8'))(_0x23a8('0x9'));var config=require(_0x23a8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x23a8('0xb')][_0x23a8('0xc')]({'port':0x232a});config[_0x23a8('0xd')]=_[_0x23a8('0xe')](config[_0x23a8('0xd')],{'host':_0x23a8('0xf'),'port':0x18eb});var socket=require(_0x23a8('0x10'))(new Redis(config[_0x23a8('0xd')]));require(_0x23a8('0x11'))[_0x23a8('0x12')](socket);function respondWithRpcPromise(_0x31bc7c,_0x165c77,_0x1f7d72){return new BPromise(function(_0x4554cf,_0x44e0fa){return client[_0x23a8('0x13')](_0x31bc7c,_0x1f7d72)[_0x23a8('0x14')](function(_0x5351d3){logger[_0x23a8('0x15')](_0x23a8('0x16'),_0x165c77,'request\x20sent');logger[_0x23a8('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x165c77,_0x23a8('0x18'),JSON[_0x23a8('0x19')](_0x5351d3));if(_0x5351d3[_0x23a8('0x1a')]){if(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1b')]===0x1f4){logger[_0x23a8('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x165c77,_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);return _0x44e0fa(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);}logger['error'](_0x23a8('0x16'),_0x165c77,_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);return _0x4554cf(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);}else{logger[_0x23a8('0x15')](_0x23a8('0x16'),_0x165c77,'request\x20sent');_0x4554cf(_0x5351d3[_0x23a8('0x1d')]['message']);}})[_0x23a8('0x1e')](function(_0x5c05c3){logger[_0x23a8('0x1a')](_0x23a8('0x16'),_0x165c77,_0x5c05c3);_0x44e0fa(_0x5c05c3);});});}exports[_0x23a8('0x1f')]=function(_0x3048bd){var _0x5ea7e1=this;return new Promise(function(_0x12a583,_0x1a119a){return db[_0x23a8('0x20')][_0x23a8('0x21')]({'raw':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x23')]===undefined?!![]:![]:!![],'where':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x24')]||null:null,'attributes':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x25')]||null:null,'limit':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x26')]||null:null,'include':_0x3048bd[_0x23a8('0x22')]?_0x3048bd['options'][_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x3048bd[_0x23a8('0x22')][_0x23a8('0x27')],function(_0x48fa6d){return{'model':db[_0x48fa6d[_0x23a8('0x29')]],'as':_0x48fa6d['as'],'attributes':_0x48fa6d[_0x23a8('0x25')],'include':_0x48fa6d[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x48fa6d[_0x23a8('0x27')],function(_0x1a2c92){return{'model':db[_0x1a2c92[_0x23a8('0x29')]],'as':_0x1a2c92['as'],'attributes':_0x1a2c92[_0x23a8('0x25')],'include':_0x1a2c92[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x1a2c92[_0x23a8('0x27')],function(_0x26b13f){return{'model':db[_0x26b13f[_0x23a8('0x29')]],'as':_0x26b13f['as'],'attributes':_0x26b13f[_0x23a8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x23a8('0x14')](function(_0x2ce4c9){logger['info'](_0x23a8('0x1f'),_0x3048bd);logger['debug'](_0x23a8('0x1f'),_0x3048bd,JSON[_0x23a8('0x19')](_0x2ce4c9));_0x12a583(_0x2ce4c9);})[_0x23a8('0x1e')](function(_0x4e4452){logger[_0x23a8('0x1a')](_0x23a8('0x1f'),_0x4e4452[_0x23a8('0x1c')],_0x3048bd);_0x1a119a(_0x5ea7e1[_0x23a8('0x1a')](0x1f4,_0x4e4452[_0x23a8('0x1c')]));});});};exports[_0x23a8('0x2a')]=function(_0x57d081){var _0x20d77f=this;return new Promise(function(_0x59006d,_0x3f4552){return db[_0x23a8('0x20')][_0x23a8('0x2b')]({'raw':_0x57d081['options']?_0x57d081[_0x23a8('0x22')][_0x23a8('0x23')]===undefined?!![]:![]:!![],'where':_0x57d081[_0x23a8('0x22')]?_0x57d081['options']['where']||null:null,'attributes':_0x57d081['options']?_0x57d081['options']['attributes']||null:null,'include':_0x57d081['options']?_0x57d081[_0x23a8('0x22')]['include']?_['map'](_0x57d081['options'][_0x23a8('0x27')],function(_0x5e8ed7){return{'model':db[_0x5e8ed7['model']],'as':_0x5e8ed7['as'],'attributes':_0x5e8ed7['attributes'],'include':_0x5e8ed7[_0x23a8('0x27')]?_['map'](_0x5e8ed7[_0x23a8('0x27')],function(_0x2d90a4){return{'model':db[_0x2d90a4['model']],'as':_0x2d90a4['as'],'attributes':_0x2d90a4[_0x23a8('0x25')],'include':_0x2d90a4[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x2d90a4[_0x23a8('0x27')],function(_0xa9030d){return{'model':db[_0xa9030d[_0x23a8('0x29')]],'as':_0xa9030d['as'],'attributes':_0xa9030d[_0x23a8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x23a8('0x14')](function(_0x52572c){logger[_0x23a8('0x15')]('ShowWhatsappQueue',_0x57d081);logger['debug']('ShowWhatsappQueue',_0x57d081,JSON['stringify'](_0x52572c));_0x59006d(_0x52572c);})[_0x23a8('0x1e')](function(_0x288663){logger['error'](_0x23a8('0x2a'),_0x288663[_0x23a8('0x1c')],_0x57d081);_0x3f4552(_0x20d77f[_0x23a8('0x1a')](0x1f4,_0x288663[_0x23a8('0x1c')]));});});}; \ No newline at end of file +var _0x8f01=['stringify','error','code','message','result','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map','model','info','debug','GetWhatsappQueue','ShowWhatsappQueue','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x8f01,0x144));var _0x18f0=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x8f01[_0x4b5813];return _0x423465;};'use strict';var _=require('lodash');var util=require(_0x18f0('0x0'));var moment=require(_0x18f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x18f0('0x2'));var fs=require('fs');var Redis=require(_0x18f0('0x3'));var db=require(_0x18f0('0x4'))['db'];var utils=require(_0x18f0('0x5'));var logger=require(_0x18f0('0x6'))('rpc');var config=require(_0x18f0('0x7'));var jayson=require(_0x18f0('0x8'));var client=jayson[_0x18f0('0x9')]['http']({'port':0x232a});config[_0x18f0('0xa')]=_[_0x18f0('0xb')](config[_0x18f0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18f0('0xc'))(new Redis(config[_0x18f0('0xa')]));require(_0x18f0('0xd'))[_0x18f0('0xe')](socket);function respondWithRpcPromise(_0xf92cf0,_0x2bf8ff,_0x30bdcd){return new BPromise(function(_0x25450a,_0x193a20){return client['request'](_0xf92cf0,_0x30bdcd)[_0x18f0('0xf')](function(_0x3b06b0){logger['info'](_0x18f0('0x10'),_0x2bf8ff,_0x18f0('0x11'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2bf8ff,_0x18f0('0x11'),JSON[_0x18f0('0x12')](_0x3b06b0));if(_0x3b06b0[_0x18f0('0x13')]){if(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x14')]===0x1f4){logger[_0x18f0('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x2bf8ff,_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);return _0x193a20(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);}logger['error'](_0x18f0('0x10'),_0x2bf8ff,_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);return _0x25450a(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);}else{logger['info'](_0x18f0('0x10'),_0x2bf8ff,_0x18f0('0x11'));_0x25450a(_0x3b06b0[_0x18f0('0x16')][_0x18f0('0x15')]);}})['catch'](function(_0x219877){logger[_0x18f0('0x13')](_0x18f0('0x10'),_0x2bf8ff,_0x219877);_0x193a20(_0x219877);});});}exports['GetWhatsappQueue']=function(_0x564d89){var _0x237ff3=this;return new Promise(function(_0x27fd29,_0x2a1bfb){return db[_0x18f0('0x17')][_0x18f0('0x18')]({'raw':_0x564d89['options']?_0x564d89['options'][_0x18f0('0x19')]===undefined?!![]:![]:!![],'where':_0x564d89[_0x18f0('0x1a')]?_0x564d89['options'][_0x18f0('0x1b')]||null:null,'attributes':_0x564d89[_0x18f0('0x1a')]?_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1c')]||null:null,'limit':_0x564d89['options']?_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1d')]||null:null,'include':_0x564d89[_0x18f0('0x1a')]?_0x564d89['options'][_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1e')],function(_0x6a534f){return{'model':db[_0x6a534f[_0x18f0('0x20')]],'as':_0x6a534f['as'],'attributes':_0x6a534f['attributes'],'include':_0x6a534f[_0x18f0('0x1e')]?_['map'](_0x6a534f['include'],function(_0x5e0fbc){return{'model':db[_0x5e0fbc[_0x18f0('0x20')]],'as':_0x5e0fbc['as'],'attributes':_0x5e0fbc['attributes'],'include':_0x5e0fbc[_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x5e0fbc[_0x18f0('0x1e')],function(_0x3a7e0d){return{'model':db[_0x3a7e0d[_0x18f0('0x20')]],'as':_0x3a7e0d['as'],'attributes':_0x3a7e0d[_0x18f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f0('0xf')](function(_0x575b20){logger[_0x18f0('0x21')]('GetWhatsappQueue',_0x564d89);logger[_0x18f0('0x22')](_0x18f0('0x23'),_0x564d89,JSON[_0x18f0('0x12')](_0x575b20));_0x27fd29(_0x575b20);})['catch'](function(_0x35ec1d){logger[_0x18f0('0x13')](_0x18f0('0x23'),_0x35ec1d[_0x18f0('0x15')],_0x564d89);_0x2a1bfb(_0x237ff3[_0x18f0('0x13')](0x1f4,_0x35ec1d['message']));});});};exports[_0x18f0('0x24')]=function(_0x15d76c){var _0x836e95=this;return new Promise(function(_0xfd828e,_0x37d6b7){return db[_0x18f0('0x17')]['find']({'raw':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x19')]===undefined?!![]:![]:!![],'where':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x1b')]||null:null,'attributes':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x1c')]||null:null,'include':_0x15d76c['options']?_0x15d76c['options'][_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x15d76c['options'][_0x18f0('0x1e')],function(_0x2fba1f){return{'model':db[_0x2fba1f['model']],'as':_0x2fba1f['as'],'attributes':_0x2fba1f[_0x18f0('0x1c')],'include':_0x2fba1f[_0x18f0('0x1e')]?_['map'](_0x2fba1f[_0x18f0('0x1e')],function(_0x53064d){return{'model':db[_0x53064d[_0x18f0('0x20')]],'as':_0x53064d['as'],'attributes':_0x53064d[_0x18f0('0x1c')],'include':_0x53064d[_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x53064d[_0x18f0('0x1e')],function(_0x93d21b){return{'model':db[_0x93d21b[_0x18f0('0x20')]],'as':_0x93d21b['as'],'attributes':_0x93d21b[_0x18f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f0('0xf')](function(_0x924951){logger[_0x18f0('0x21')](_0x18f0('0x24'),_0x15d76c);logger[_0x18f0('0x22')]('ShowWhatsappQueue',_0x15d76c,JSON[_0x18f0('0x12')](_0x924951));_0xfd828e(_0x924951);})[_0x18f0('0x25')](function(_0x546d74){logger[_0x18f0('0x13')](_0x18f0('0x24'),_0x546d74[_0x18f0('0x15')],_0x15d76c);_0x37d6b7(_0x836e95[_0x18f0('0x13')](0x1f4,_0x546d74[_0x18f0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 690c2e6..352ba09 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 _0x41e6=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener','register','length'];(function(_0x2eb0c2,_0x4d98ab){var _0x1b4616=function(_0xb5f552){while(--_0xb5f552){_0x2eb0c2['push'](_0x2eb0c2['shift']());}};_0x1b4616(++_0x4d98ab);}(_0x41e6,0x1dd));var _0x641e=function(_0x2d321f,_0x196439){_0x2d321f=_0x2d321f-0x0;var _0x16744f=_0x41e6[_0x2d321f];return _0x16744f;};'use strict';var WhatsappQueueEvents=require(_0x641e('0x0'));var events=[_0x641e('0x1'),'remove','update'];function createListener(_0x555893,_0x27a772){return function(_0x413b4b){_0x27a772[_0x641e('0x2')](_0x555893,_0x413b4b);};}function removeListener(_0xb3513c,_0x2428f7){return function(){WhatsappQueueEvents[_0x641e('0x3')](_0xb3513c,_0x2428f7);};}exports[_0x641e('0x4')]=function(_0x416459){for(var _0x5f523e=0x0,_0x1224be=events[_0x641e('0x5')];_0x5f523e<_0x1224be;_0x5f523e++){var _0x153ffa=events[_0x5f523e];var _0x28c4dc=createListener(_0x641e('0x6')+_0x153ffa,_0x416459);WhatsappQueueEvents['on'](_0x153ffa,_0x28c4dc);}}; \ No newline at end of file +var _0xe06a=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x37747c,_0x54c385){var _0x4b841d=function(_0x3ae596){while(--_0x3ae596){_0x37747c['push'](_0x37747c['shift']());}};_0x4b841d(++_0x54c385);}(_0xe06a,0x66));var _0xae06=function(_0x5cf7a4,_0x3e4531){_0x5cf7a4=_0x5cf7a4-0x0;var _0x2af8aa=_0xe06a[_0x5cf7a4];return _0x2af8aa;};'use strict';var WhatsappQueueEvents=require(_0xae06('0x0'));var events=[_0xae06('0x1'),_0xae06('0x2'),_0xae06('0x3')];function createListener(_0x17651e,_0x4f0b4f){return function(_0xf5c87d){_0x4f0b4f[_0xae06('0x4')](_0x17651e,_0xf5c87d);};}function removeListener(_0x435226,_0x34111f){return function(){WhatsappQueueEvents[_0xae06('0x5')](_0x435226,_0x34111f);};}exports[_0xae06('0x6')]=function(_0x1d375a){for(var _0x42b5ff=0x0,_0x13d490=events[_0xae06('0x7')];_0x42b5ff<_0x13d490;_0x42b5ff++){var _0x25b829=events[_0x42b5ff];var _0x202af6=createListener(_0xae06('0x8')+_0x25b829,_0x1d375a);WhatsappQueueEvents['on'](_0x25b829,_0x202af6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 19258ff..c29cd79 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 _0xa5ed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','exports','multer','util','path','Router'];(function(_0x4201a0,_0x1cd7a6){var _0x43e04e=function(_0xfbf783){while(--_0xfbf783){_0x4201a0['push'](_0x4201a0['shift']());}};_0x43e04e(++_0x1cd7a6);}(_0xa5ed,0x150));var _0xda5e=function(_0x5ec60f,_0x32a220){_0x5ec60f=_0x5ec60f-0x0;var _0x618e2b=_0xa5ed[_0x5ec60f];return _0x618e2b;};'use strict';var multer=require(_0xda5e('0x0'));var util=require(_0xda5e('0x1'));var path=require(_0xda5e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda5e('0x3')]();var fs_extra=require(_0xda5e('0x4'));var auth=require(_0xda5e('0x5'));var interaction=require(_0xda5e('0x6'));var config=require(_0xda5e('0x7'));var controller=require(_0xda5e('0x8'));router[_0xda5e('0x9')]('/',auth[_0xda5e('0xa')](),controller[_0xda5e('0xb')]);router[_0xda5e('0x9')](_0xda5e('0xc'),auth[_0xda5e('0xa')](),controller[_0xda5e('0xd')]);router[_0xda5e('0x9')](_0xda5e('0xe'),auth[_0xda5e('0xa')](),controller['show']);router[_0xda5e('0xf')]('/',auth['isAuthenticated'](),controller[_0xda5e('0x10')]);router['put']('/:id',auth[_0xda5e('0xa')](),controller[_0xda5e('0x11')]);router[_0xda5e('0x12')](_0xda5e('0xe'),auth[_0xda5e('0xa')](),controller['destroy']);module[_0xda5e('0x13')]=router; \ No newline at end of file +var _0x4b33=['show','post','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5b9cc5,_0x18e69b){var _0x2d679f=function(_0x3fdb98){while(--_0x3fdb98){_0x5b9cc5['push'](_0x5b9cc5['shift']());}};_0x2d679f(++_0x18e69b);}(_0x4b33,0x1be));var _0x34b3=function(_0x11c951,_0x43f94d){_0x11c951=_0x11c951-0x0;var _0x2e767f=_0x4b33[_0x11c951];return _0x2e767f;};'use strict';var multer=require(_0x34b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x34b3('0x1'));var express=require('express');var router=express[_0x34b3('0x2')]();var fs_extra=require(_0x34b3('0x3'));var auth=require(_0x34b3('0x4'));var interaction=require(_0x34b3('0x5'));var config=require('../../config/environment');var controller=require(_0x34b3('0x6'));router[_0x34b3('0x7')]('/',auth[_0x34b3('0x8')](),controller[_0x34b3('0x9')]);router[_0x34b3('0x7')](_0x34b3('0xa'),auth[_0x34b3('0x8')](),controller[_0x34b3('0xb')]);router[_0x34b3('0x7')](_0x34b3('0xc'),auth[_0x34b3('0x8')](),controller[_0x34b3('0xd')]);router[_0x34b3('0xe')]('/',auth[_0x34b3('0x8')](),controller['create']);router['put']('/:id',auth[_0x34b3('0x8')](),controller['update']);router[_0x34b3('0xf')](_0x34b3('0xc'),auth[_0x34b3('0x8')](),controller['destroy']);module[_0x34b3('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c2be102..f2f0e4d 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x297f6d,_0x536724){var _0x2d6516=function(_0x46daa4){while(--_0x46daa4){_0x297f6d['push'](_0x297f6d['shift']());}};_0x2d6516(++_0x536724);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1a7768,_0x22bdcf){var _0x230019=function(_0x1b8cc9){while(--_0x1b8cc9){_0x1a7768['push'](_0x1a7768['shift']());}};_0x230019(++_0x22bdcf);}(_0x7a54,0x106));var _0x47a5=function(_0xe49cf6,_0x38840f){_0xe49cf6=_0xe49cf6-0x0;var _0x212e79=_0x7a54[_0xe49cf6];return _0x212e79;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 93e6332..8ff96f2 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 _0xdd4f=['intersection','includeAll','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys'];(function(_0x1d7146,_0x217930){var _0x2a215a=function(_0x32f845){while(--_0x32f845){_0x1d7146['push'](_0x1d7146['shift']());}};_0x2a215a(++_0x217930);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1db8b9,_0x46a5a5){_0x1db8b9=_0x1db8b9-0x0;var _0xabd59f=_0xdd4f[_0x1db8b9];return _0xabd59f;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];function respondWithStatusCode(_0x3f07f1,_0x4565e6){_0x4565e6=_0x4565e6||0xcc;return function(_0x1bf37b){if(_0x1bf37b){return _0x3f07f1['sendStatus'](_0x4565e6);}return _0x3f07f1[_0xfdd4('0x17')](_0x4565e6)[_0xfdd4('0x18')]();};}function respondWithResult(_0x227099,_0x57b21f){_0x57b21f=_0x57b21f||0xc8;return function(_0x1b7da1){if(_0x1b7da1){return _0x227099['status'](_0x57b21f)[_0xfdd4('0x19')](_0x1b7da1);}};}function respondWithFilteredResult(_0x42c3a8,_0x2f34ec){return function(_0x431255){if(_0x431255){var _0x37b05f=typeof _0x2f34ec['offset']==='undefined'&&typeof _0x2f34ec['limit']===_0xfdd4('0x1a');var _0x216c7e=_0x431255[_0xfdd4('0x1b')];var _0x2ccc88=_0x37b05f?0x0:_0x2f34ec[_0xfdd4('0x1c')];var _0x33d752=_0x37b05f?_0x431255[_0xfdd4('0x1b')]:_0x2f34ec[_0xfdd4('0x1c')]+_0x2f34ec[_0xfdd4('0x1d')];var _0x52ce34;if(_0x33d752>=_0x216c7e){_0x33d752=_0x216c7e;_0x52ce34=0xc8;}else{_0x52ce34=0xce;}_0x42c3a8[_0xfdd4('0x17')](_0x52ce34);return _0x42c3a8[_0xfdd4('0x1e')](_0xfdd4('0x1f'),_0x2ccc88+'-'+_0x33d752+'/'+_0x216c7e)[_0xfdd4('0x19')](_0x431255);}return null;};}function patchUpdates(_0x1454f1){return function(_0x29cc8d){try{jsonpatch[_0xfdd4('0x20')](_0x29cc8d,_0x1454f1,!![]);}catch(_0x34dfa8){return BPromise['reject'](_0x34dfa8);}return _0x29cc8d[_0xfdd4('0x21')]();};}function saveUpdates(_0x17302b,_0x2a24e8){return function(_0x16e81b){if(_0x16e81b){return _0x16e81b[_0xfdd4('0x22')](_0x17302b)[_0xfdd4('0x23')](function(_0x451767){return _0x451767;});}return null;};}function removeEntity(_0x277ec1,_0x538b00){return function(_0x1e14da){if(_0x1e14da){return _0x1e14da[_0xfdd4('0x24')]()[_0xfdd4('0x23')](function(){_0x277ec1['status'](0xcc)[_0xfdd4('0x18')]();});}};}function handleEntityNotFound(_0x39b712,_0xf9c346){return function(_0x2f8268){if(!_0x2f8268){_0x39b712[_0xfdd4('0x25')](0x194);}return _0x2f8268;};}function handleError(_0x4a8790,_0x18bafb){_0x18bafb=_0x18bafb||0x1f4;return function(_0x2c88ad){logger[_0xfdd4('0x26')](_0x2c88ad[_0xfdd4('0x27')]);if(_0x2c88ad[_0xfdd4('0x28')]){delete _0x2c88ad[_0xfdd4('0x28')];}_0x4a8790[_0xfdd4('0x17')](_0x18bafb)[_0xfdd4('0x29')](_0x2c88ad);};}exports['index']=function(_0xcbd1fb,_0x39981f){var _0x385a68={},_0xef012e={},_0x2207ae={'count':0x0,'rows':[]};var _0x4a36a2=_[_0xfdd4('0x2a')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')],function(_0x2bb793){return{'name':_0x2bb793[_0xfdd4('0x2d')],'type':_0x2bb793['type'][_0xfdd4('0x2e')]};});_0xef012e[_0xfdd4('0x2f')]=_[_0xfdd4('0x2a')](_0x4a36a2,'name');_0xef012e[_0xfdd4('0x30')]=_['keys'](_0xcbd1fb[_0xfdd4('0x30')]);_0xef012e[_0xfdd4('0x31')]=_['intersection'](_0xef012e['model'],_0xef012e[_0xfdd4('0x30')]);_0x385a68[_0xfdd4('0x32')]=_['intersection'](_0xef012e['model'],qs[_0xfdd4('0x33')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x385a68[_0xfdd4('0x32')]=_0x385a68[_0xfdd4('0x32')][_0xfdd4('0x34')]?_0x385a68[_0xfdd4('0x32')]:_0xef012e[_0xfdd4('0x2f')];if(!_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x35')](_0xfdd4('0x36'))){_0x385a68[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1d')]);_0x385a68[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1c')]);}_0x385a68[_0xfdd4('0x37')]=qs[_0xfdd4('0x38')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x38')]);_0x385a68[_0xfdd4('0x39')]=qs[_0xfdd4('0x31')](_[_0xfdd4('0x3a')](_0xcbd1fb['query'],_0xef012e[_0xfdd4('0x31')]),_0x4a36a2);if(_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x3b')]){_0x385a68[_0xfdd4('0x39')]=_[_0xfdd4('0x3c')](_0x385a68[_0xfdd4('0x39')],{'$or':_['map'](_0x4a36a2,function(_0x245ce4){if(_0x245ce4['type']!==_0xfdd4('0x3d')){var _0x2c5199={};_0x2c5199[_0x245ce4[_0xfdd4('0x28')]]={'$like':'%'+_0xcbd1fb[_0xfdd4('0x30')]['filter']+'%'};return _0x2c5199;}})});}_0x385a68=_[_0xfdd4('0x3c')]({},_0x385a68,_0xcbd1fb[_0xfdd4('0x3e')]);var _0x1040e8={'where':_0x385a68[_0xfdd4('0x39')]};return db[_0xfdd4('0x2b')][_0xfdd4('0x1b')](_0x1040e8)[_0xfdd4('0x23')](function(_0x55fcec){_0x2207ae[_0xfdd4('0x1b')]=_0x55fcec;if(_0xcbd1fb[_0xfdd4('0x30')]['includeAll']){_0x385a68[_0xfdd4('0x3f')]=[{'all':!![]}];}return db[_0xfdd4('0x2b')][_0xfdd4('0x40')](_0x385a68);})[_0xfdd4('0x23')](function(_0x5173db){_0x2207ae[_0xfdd4('0x41')]=_0x5173db;return _0x2207ae;})[_0xfdd4('0x23')](respondWithFilteredResult(_0x39981f,_0x385a68))[_0xfdd4('0x42')](handleError(_0x39981f,null));};exports[_0xfdd4('0x43')]=function(_0x362c4f,_0x496747){var _0x1411e0={'raw':!![],'where':{'id':_0x362c4f[_0xfdd4('0x44')]['id']}},_0x23af2a={};_0x23af2a[_0xfdd4('0x2f')]=_[_0xfdd4('0x45')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')]);_0x23af2a['query']=_[_0xfdd4('0x45')](_0x362c4f['query']);_0x23af2a[_0xfdd4('0x31')]=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],_0x23af2a[_0xfdd4('0x30')]);_0x1411e0['attributes']=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],qs['fields'](_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x1411e0['attributes']=_0x1411e0[_0xfdd4('0x32')]['length']?_0x1411e0['attributes']:_0x23af2a['model'];if(_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x47')]){_0x1411e0[_0xfdd4('0x3f')]=[{'all':!![]}];}_0x1411e0=_['merge']({},_0x1411e0,_0x362c4f[_0xfdd4('0x3e')]);return db[_0xfdd4('0x2b')]['find'](_0x1411e0)[_0xfdd4('0x23')](handleEntityNotFound(_0x496747,null))[_0xfdd4('0x23')](respondWithResult(_0x496747,null))[_0xfdd4('0x42')](handleError(_0x496747,null));};exports[_0xfdd4('0x48')]=function(_0x746f6a,_0x3817fe){return db[_0xfdd4('0x2b')][_0xfdd4('0x48')](_0x746f6a[_0xfdd4('0x49')],{})[_0xfdd4('0x23')](respondWithResult(_0x3817fe,0xc9))[_0xfdd4('0x42')](handleError(_0x3817fe,null));};exports[_0xfdd4('0x22')]=function(_0x300965,_0x3c0ee1){if(_0x300965['body']['id']){delete _0x300965['body']['id'];}return db[_0xfdd4('0x2b')][_0xfdd4('0x4a')]({'where':{'id':_0x300965[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x3c0ee1,null))['then'](saveUpdates(_0x300965[_0xfdd4('0x49')],null))[_0xfdd4('0x23')](respondWithResult(_0x3c0ee1,null))['catch'](handleError(_0x3c0ee1,null));};exports['destroy']=function(_0x53c66d,_0x51dd34){return db['WhatsappQueueReport'][_0xfdd4('0x4a')]({'where':{'id':_0x53c66d[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x51dd34,null))[_0xfdd4('0x23')](removeEntity(_0x51dd34,null))[_0xfdd4('0x42')](handleError(_0x51dd34,null));};exports[_0xfdd4('0x4b')]=function(_0x4d0332,_0x17bbab){return db[_0xfdd4('0x2b')][_0xfdd4('0x4b')]()[_0xfdd4('0x23')](respondWithResult(_0x17bbab,null))['catch'](handleError(_0x17bbab,null));}; \ No newline at end of file +var _0x2547=['order','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2547,0x1cd));var _0x7254=function(_0x4e56f2,_0x27075d){_0x4e56f2=_0x4e56f2-0x0;var _0x51f1c5=_0x2547[_0x4e56f2];return _0x51f1c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['WhatsappQueueReport'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['WhatsappQueueReport'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['WhatsappQueueReport'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));};exports['describe']=function(_0x5e66c6,_0x24c532){return db[_0x7254('0x40')][_0x7254('0x49')]()[_0x7254('0x25')](respondWithResult(_0x24c532,null))[_0x7254('0x44')](handleError(_0x24c532,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 464d9a3..0efec32 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 _0x08b4=['define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x440f7a,_0x4368eb){var _0x5325e1=function(_0x1324a7){while(--_0x1324a7){_0x440f7a['push'](_0x440f7a['shift']());}};_0x5325e1(++_0x4368eb);}(_0x08b4,0x1b3));var _0x408b=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x08b4[_0x53b594];return _0x1e616f;};'use strict';var _=require(_0x408b('0x0'));var util=require(_0x408b('0x1'));var logger=require(_0x408b('0x2'))('api');var moment=require(_0x408b('0x3'));var BPromise=require(_0x408b('0x4'));var rp=require(_0x408b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x408b('0x6'));var config=require(_0x408b('0x7'));var attributes=require(_0x408b('0x8'));module['exports']=function(_0x2e5806,_0x39562c){return _0x2e5806[_0x408b('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x408b('0xa'),'paranoid':![],'indexes':[{'name':_0x408b('0xb'),'fields':[_0x408b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcda2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1c5976,_0x409f3d){var _0x350ea1=function(_0x3f7658){while(--_0x3f7658){_0x1c5976['push'](_0x1c5976['shift']());}};_0x350ea1(++_0x409f3d);}(_0xcda2,0xf8));var _0x2cda=function(_0x4deb18,_0x5e76b0){_0x4deb18=_0x4deb18-0x0;var _0x571a30=_0xcda2[_0x4deb18];return _0x571a30;};'use strict';var _=require(_0x2cda('0x0'));var util=require(_0x2cda('0x1'));var logger=require(_0x2cda('0x2'))(_0x2cda('0x3'));var moment=require(_0x2cda('0x4'));var BPromise=require(_0x2cda('0x5'));var rp=require(_0x2cda('0x6'));var fs=require('fs');var path=require(_0x2cda('0x7'));var rimraf=require(_0x2cda('0x8'));var config=require(_0x2cda('0x9'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x3a7ea0,_0xaed8c0){return _0x3a7ea0[_0x2cda('0xa')](_0x2cda('0xb'),attributes,{'tableName':_0x2cda('0xc'),'paranoid':![],'indexes':[{'name':_0x2cda('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 40defa6..1bd58ef 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 _0xe45f=['WhatsappQueueReport','create','body','options','raw','debug','catch','UpdateWhatsappQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe45f,0x6d));var _0xfe45=function(_0x43b0c3,_0x25a62a){_0x43b0c3=_0x43b0c3-0x0;var _0xc5107a=_0xe45f[_0x43b0c3];return _0xc5107a;};'use strict';var _=require(_0xfe45('0x0'));var util=require(_0xfe45('0x1'));var moment=require(_0xfe45('0x2'));var BPromise=require(_0xfe45('0x3'));var rs=require(_0xfe45('0x4'));var fs=require('fs');var Redis=require(_0xfe45('0x5'));var db=require(_0xfe45('0x6'))['db'];var utils=require(_0xfe45('0x7'));var logger=require(_0xfe45('0x8'))(_0xfe45('0x9'));var config=require(_0xfe45('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfe45('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7f46d,_0x1d722b,_0x5ca5bb){return new BPromise(function(_0x19d372,_0x3511e1){return client[_0xfe45('0xc')](_0xc7f46d,_0x5ca5bb)[_0xfe45('0xd')](function(_0x44243c){logger[_0xfe45('0xe')](_0xfe45('0xf'),_0x1d722b,_0xfe45('0x10'));logger['debug'](_0xfe45('0x11'),_0x1d722b,'request\x20sent',JSON[_0xfe45('0x12')](_0x44243c));if(_0x44243c[_0xfe45('0x13')]){if(_0x44243c[_0xfe45('0x13')]['code']===0x1f4){logger['error'](_0xfe45('0xf'),_0x1d722b,_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);return _0x3511e1(_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);}logger[_0xfe45('0x13')](_0xfe45('0xf'),_0x1d722b,_0x44243c[_0xfe45('0x13')]['message']);return _0x19d372(_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);}else{logger[_0xfe45('0xe')](_0xfe45('0xf'),_0x1d722b,_0xfe45('0x10'));_0x19d372(_0x44243c[_0xfe45('0x15')][_0xfe45('0x14')]);}})['catch'](function(_0x19d086){logger[_0xfe45('0x13')](_0xfe45('0xf'),_0x1d722b,_0x19d086);_0x3511e1(_0x19d086);});});}exports[_0xfe45('0x16')]=function(_0x4b9e29){var _0x36e351=this;return new Promise(function(_0x578429,_0xa8e57d){return db[_0xfe45('0x17')][_0xfe45('0x18')](_0x4b9e29[_0xfe45('0x19')],{'raw':_0x4b9e29['options']?_0x4b9e29[_0xfe45('0x1a')][_0xfe45('0x1b')]===undefined?!![]:![]:!![]})[_0xfe45('0xd')](function(_0x1b5d42){logger[_0xfe45('0xe')](_0xfe45('0x16'),_0x4b9e29);logger[_0xfe45('0x1c')](_0xfe45('0x16'),_0x4b9e29,JSON[_0xfe45('0x12')](_0x1b5d42));_0x578429(_0x1b5d42);})[_0xfe45('0x1d')](function(_0x16f48d){logger[_0xfe45('0x13')](_0xfe45('0x16'),_0x16f48d[_0xfe45('0x14')],_0x4b9e29);_0xa8e57d(_0x36e351[_0xfe45('0x13')](0x1f4,_0x16f48d[_0xfe45('0x14')]));});});};exports[_0xfe45('0x1e')]=function(_0x5e3b59){var _0x4e4b46=this;return new Promise(function(_0x3e1800,_0x4c739b){return db['WhatsappQueueReport'][_0xfe45('0x1f')](_0x5e3b59[_0xfe45('0x19')],{'raw':_0x5e3b59['options']?_0x5e3b59[_0xfe45('0x1a')][_0xfe45('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59['options'][_0xfe45('0x20')]||null:null,'attributes':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59['options']['attributes']||null:null,'limit':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59[_0xfe45('0x1a')]['limit']||null:null})[_0xfe45('0xd')](function(_0x14f3f8){logger['info']('UpdateWhatsappQueueReport',_0x5e3b59);logger[_0xfe45('0x1c')]('UpdateWhatsappQueueReport',_0x5e3b59,JSON[_0xfe45('0x12')](_0x14f3f8));_0x3e1800(_0x14f3f8);})[_0xfe45('0x1d')](function(_0x75fda0){logger[_0xfe45('0x13')](_0xfe45('0x1e'),_0x75fda0[_0xfe45('0x14')],_0x5e3b59);_0x4c739b(_0x4e4b46[_0xfe45('0x13')](0x1f4,_0x75fda0[_0xfe45('0x14')]));});});}; \ No newline at end of file +var _0x4d01=['UpdateWhatsappQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','catch','body','where','attributes','limit'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x4d01,0x1f1));var _0x14d0=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x4d01[_0x1ff575];return _0x48fc9e;};'use strict';var _=require(_0x14d0('0x0'));var util=require(_0x14d0('0x1'));var moment=require(_0x14d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d0('0x3'));var fs=require('fs');var Redis=require(_0x14d0('0x4'));var db=require(_0x14d0('0x5'))['db'];var utils=require(_0x14d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x14d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x14d0('0x8')][_0x14d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2fc7,_0x189f4c,_0x590f6e){return new BPromise(function(_0x21309d,_0x54b35f){return client[_0x14d0('0xa')](_0x1c2fc7,_0x590f6e)[_0x14d0('0xb')](function(_0x3d8f1f){logger[_0x14d0('0xc')](_0x14d0('0xd'),_0x189f4c,_0x14d0('0xe'));logger[_0x14d0('0xf')](_0x14d0('0x10'),_0x189f4c,_0x14d0('0xe'),JSON[_0x14d0('0x11')](_0x3d8f1f));if(_0x3d8f1f['error']){if(_0x3d8f1f[_0x14d0('0x12')]['code']===0x1f4){logger[_0x14d0('0x12')](_0x14d0('0xd'),_0x189f4c,_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);return _0x54b35f(_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);}logger['error'](_0x14d0('0xd'),_0x189f4c,_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);return _0x21309d(_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);}else{logger[_0x14d0('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x189f4c,_0x14d0('0xe'));_0x21309d(_0x3d8f1f[_0x14d0('0x14')][_0x14d0('0x13')]);}})['catch'](function(_0x2ac0e1){logger['error'](_0x14d0('0xd'),_0x189f4c,_0x2ac0e1);_0x54b35f(_0x2ac0e1);});});}exports[_0x14d0('0x15')]=function(_0x5e079b){var _0x4da504=this;return new Promise(function(_0x502d19,_0x2e7780){return db[_0x14d0('0x16')]['create'](_0x5e079b['body'],{'raw':_0x5e079b['options']?_0x5e079b[_0x14d0('0x17')][_0x14d0('0x18')]===undefined?!![]:![]:!![]})[_0x14d0('0xb')](function(_0x41cfc0){logger[_0x14d0('0xc')](_0x14d0('0x15'),_0x5e079b);logger[_0x14d0('0xf')](_0x14d0('0x15'),_0x5e079b,JSON[_0x14d0('0x11')](_0x41cfc0));_0x502d19(_0x41cfc0);})[_0x14d0('0x19')](function(_0x3004aa){logger[_0x14d0('0x12')](_0x14d0('0x15'),_0x3004aa[_0x14d0('0x13')],_0x5e079b);_0x2e7780(_0x4da504['error'](0x1f4,_0x3004aa[_0x14d0('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x20d37a){var _0x921855=this;return new Promise(function(_0x1a81d3,_0x2a47b9){return db['WhatsappQueueReport']['update'](_0x20d37a[_0x14d0('0x1a')],{'raw':_0x20d37a[_0x14d0('0x17')]?_0x20d37a['options'][_0x14d0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1b')]||null:null,'attributes':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1c')]||null:null,'limit':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1d')]||null:null})[_0x14d0('0xb')](function(_0xe48871){logger['info'](_0x14d0('0x1e'),_0x20d37a);logger[_0x14d0('0xf')](_0x14d0('0x1e'),_0x20d37a,JSON[_0x14d0('0x11')](_0xe48871));_0x1a81d3(_0xe48871);})[_0x14d0('0x19')](function(_0x87fb25){logger[_0x14d0('0x12')](_0x14d0('0x1e'),_0x87fb25[_0x14d0('0x13')],_0x20d37a);_0x2a47b9(_0x921855[_0x14d0('0x12')](0x1f4,_0x87fb25['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e99e1a7..78f7b20 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 _0x2dae=['describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x1e636a,_0x494535){var _0x33cf14=function(_0x363715){while(--_0x363715){_0x1e636a['push'](_0x1e636a['shift']());}};_0x33cf14(++_0x494535);}(_0x2dae,0xec));var _0xe2da=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x2dae[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0xe2da('0x0'));var util=require(_0xe2da('0x1'));var path=require(_0xe2da('0x2'));var timeout=require(_0xe2da('0x3'));var express=require(_0xe2da('0x4'));var router=express['Router']();var fs_extra=require(_0xe2da('0x5'));var auth=require(_0xe2da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xb')]);router[_0xe2da('0x8')](_0xe2da('0xc'),auth['isAuthenticated'](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xf')]);router['put'](_0xe2da('0xc'),auth[_0xe2da('0x9')](),controller['update']);router[_0xe2da('0x10')]('/:id',auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file +var _0x141b=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x141b,0x1ca));var _0xb141=function(_0x78a4ef,_0x59b9a1){_0x78a4ef=_0x78a4ef-0x0;var _0x515092=_0x141b[_0x78a4ef];return _0x515092;};'use strict';var multer=require(_0xb141('0x0'));var util=require(_0xb141('0x1'));var path=require(_0xb141('0x2'));var timeout=require(_0xb141('0x3'));var express=require('express');var router=express[_0xb141('0x4')]();var fs_extra=require(_0xb141('0x5'));var auth=require(_0xb141('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb141('0x7'));var controller=require(_0xb141('0x8'));router[_0xb141('0x9')]('/',auth[_0xb141('0xa')](),controller['index']);router['get'](_0xb141('0xb'),auth[_0xb141('0xa')](),controller[_0xb141('0xc')]);router['get']('/:id',auth[_0xb141('0xa')](),controller[_0xb141('0xd')]);router[_0xb141('0xe')]('/',auth[_0xb141('0xa')](),controller[_0xb141('0xf')]);router[_0xb141('0x10')](_0xb141('0x11'),auth[_0xb141('0xa')](),controller['update']);router['delete'](_0xb141('0x11'),auth[_0xb141('0xa')](),controller[_0xb141('0x12')]);module[_0xb141('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 cb20e2b..37f66eb 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 _0xd0e4=['exports','STRING','ENUM','queue','DATE','sequelize'];(function(_0x438d6b,_0x105026){var _0x261104=function(_0x56916b){while(--_0x56916b){_0x438d6b['push'](_0x438d6b['shift']());}};_0x261104(++_0x105026);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0xd0e4[_0x28111f];return _0x5203e6;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'uniqueid':{'type':Sequelize[_0x4d0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d0e('0x3')]('account','agent',_0x4d0e('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4d0e('0x5')]}}; \ No newline at end of file +var _0xa32b=['STRING','agent','queue','DATE','sequelize'];(function(_0x5426d0,_0x4a4f10){var _0x37be89=function(_0x1fc9e1){while(--_0x1fc9e1){_0x5426d0['push'](_0x5426d0['shift']());}};_0x37be89(++_0x4a4f10);}(_0xa32b,0x68));var _0xba32=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0xa32b[_0x3c8832];return _0xacf303;};'use strict';var Sequelize=require(_0xba32('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xba32('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xba32('0x2'),_0xba32('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xba32('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2e1b5a5..edec918 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 _0xd566=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','update','then','end','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','catch','rawAttributes','options','create','body','find','params','destroy','describe'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd566,0x8e));var _0x6d56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd566[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x6d56('0x0'));var rimraf=require(_0x6d56('0x1'));var zipdir=require(_0x6d56('0x2'));var jsonpatch=require(_0x6d56('0x3'));var rp=require('request-promise');var moment=require(_0x6d56('0x4'));var BPromise=require(_0x6d56('0x5'));var Mustache=require(_0x6d56('0x6'));var util=require(_0x6d56('0x7'));var path=require(_0x6d56('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6d56('0x9'));var fs=require('fs');var fs_extra=require(_0x6d56('0xa'));var _=require(_0x6d56('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d56('0xc'));var toCsv=require(_0x6d56('0xd'));var querystring=require(_0x6d56('0xe'));var Papa=require(_0x6d56('0xf'));var Redis=require(_0x6d56('0x10'));var authService=require(_0x6d56('0x11'));var qs=require(_0x6d56('0x12'));var as=require(_0x6d56('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d56('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d56('0x15'));var db=require(_0x6d56('0x16'))['db'];function respondWithStatusCode(_0x1a3546,_0x124e53){_0x124e53=_0x124e53||0xcc;return function(_0x1e8863){if(_0x1e8863){return _0x1a3546[_0x6d56('0x17')](_0x124e53);}return _0x1a3546['status'](_0x124e53)['end']();};}function respondWithResult(_0x2be4ec,_0x343884){_0x343884=_0x343884||0xc8;return function(_0x567f59){if(_0x567f59){return _0x2be4ec[_0x6d56('0x18')](_0x343884)[_0x6d56('0x19')](_0x567f59);}};}function respondWithFilteredResult(_0x44b568,_0x33013a){return function(_0x2aa29b){if(_0x2aa29b){var _0x4fcc84=typeof _0x33013a['offset']===_0x6d56('0x1a')&&typeof _0x33013a[_0x6d56('0x1b')]===_0x6d56('0x1a');var _0x334647=_0x2aa29b[_0x6d56('0x1c')];var _0x3a4b37=_0x4fcc84?0x0:_0x33013a[_0x6d56('0x1d')];var _0x365de9=_0x4fcc84?_0x2aa29b[_0x6d56('0x1c')]:_0x33013a['offset']+_0x33013a[_0x6d56('0x1b')];var _0x193a1f;if(_0x365de9>=_0x334647){_0x365de9=_0x334647;_0x193a1f=0xc8;}else{_0x193a1f=0xce;}_0x44b568[_0x6d56('0x18')](_0x193a1f);return _0x44b568['set'](_0x6d56('0x1e'),_0x3a4b37+'-'+_0x365de9+'/'+_0x334647)['json'](_0x2aa29b);}return null;};}function patchUpdates(_0x5dff77){return function(_0xfcf821){try{jsonpatch['apply'](_0xfcf821,_0x5dff77,!![]);}catch(_0x11b417){return BPromise['reject'](_0x11b417);}return _0xfcf821[_0x6d56('0x1f')]();};}function saveUpdates(_0x1b4de3,_0xe4c783){return function(_0x3fac7c){if(_0x3fac7c){return _0x3fac7c[_0x6d56('0x20')](_0x1b4de3)[_0x6d56('0x21')](function(_0x391f7e){return _0x391f7e;});}return null;};}function removeEntity(_0x5b192d,_0x107f70){return function(_0x4d8c75){if(_0x4d8c75){return _0x4d8c75['destroy']()[_0x6d56('0x21')](function(){_0x5b192d['status'](0xcc)[_0x6d56('0x22')]();});}};}function handleEntityNotFound(_0x31a8dd,_0x4a9968){return function(_0x3dc74f){if(!_0x3dc74f){_0x31a8dd[_0x6d56('0x17')](0x194);}return _0x3dc74f;};}function handleError(_0x4123ac,_0xfc8580){_0xfc8580=_0xfc8580||0x1f4;return function(_0x3cc1d9){logger['error'](_0x3cc1d9[_0x6d56('0x23')]);if(_0x3cc1d9[_0x6d56('0x24')]){delete _0x3cc1d9['name'];}_0x4123ac['status'](_0xfc8580)[_0x6d56('0x25')](_0x3cc1d9);};}exports[_0x6d56('0x26')]=function(_0x2f3981,_0xc37546){var _0x52d45b={},_0x4e5e46={},_0xfa466d={'count':0x0,'rows':[]};var _0x40a30b=_[_0x6d56('0x27')](db[_0x6d56('0x28')]['rawAttributes'],function(_0x555f44){return{'name':_0x555f44[_0x6d56('0x29')],'type':_0x555f44[_0x6d56('0x2a')][_0x6d56('0x2b')]};});_0x4e5e46[_0x6d56('0x2c')]=_[_0x6d56('0x27')](_0x40a30b,_0x6d56('0x24'));_0x4e5e46['query']=_[_0x6d56('0x2d')](_0x2f3981[_0x6d56('0x2e')]);_0x4e5e46[_0x6d56('0x2f')]=_[_0x6d56('0x30')](_0x4e5e46[_0x6d56('0x2c')],_0x4e5e46['query']);_0x52d45b[_0x6d56('0x31')]=_[_0x6d56('0x30')](_0x4e5e46[_0x6d56('0x2c')],qs[_0x6d56('0x32')](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x32')]));_0x52d45b['attributes']=_0x52d45b['attributes'][_0x6d56('0x33')]?_0x52d45b[_0x6d56('0x31')]:_0x4e5e46[_0x6d56('0x2c')];if(!_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x34')](_0x6d56('0x35'))){_0x52d45b[_0x6d56('0x1b')]=qs[_0x6d56('0x1b')](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x1b')]);_0x52d45b[_0x6d56('0x1d')]=qs['offset'](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x1d')]);}_0x52d45b[_0x6d56('0x36')]=qs['sort'](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x37')]);_0x52d45b[_0x6d56('0x38')]=qs['filters'](_['pick'](_0x2f3981[_0x6d56('0x2e')],_0x4e5e46[_0x6d56('0x2f')]),_0x40a30b);if(_0x2f3981['query'][_0x6d56('0x39')]){_0x52d45b['where']=_[_0x6d56('0x3a')](_0x52d45b[_0x6d56('0x38')],{'$or':_['map'](_0x40a30b,function(_0x41b9b7){if(_0x41b9b7[_0x6d56('0x2a')]!==_0x6d56('0x3b')){var _0x4ca866={};_0x4ca866[_0x41b9b7[_0x6d56('0x24')]]={'$like':'%'+_0x2f3981['query'][_0x6d56('0x39')]+'%'};return _0x4ca866;}})});}_0x52d45b=_[_0x6d56('0x3a')]({},_0x52d45b,_0x2f3981['options']);var _0x47e1a8={'where':_0x52d45b['where']};return db[_0x6d56('0x28')]['count'](_0x47e1a8)[_0x6d56('0x21')](function(_0x537d41){_0xfa466d[_0x6d56('0x1c')]=_0x537d41;if(_0x2f3981[_0x6d56('0x2e')]['includeAll']){_0x52d45b[_0x6d56('0x3c')]=[{'all':!![]}];}return db[_0x6d56('0x28')][_0x6d56('0x3d')](_0x52d45b);})[_0x6d56('0x21')](function(_0x382b4f){_0xfa466d['rows']=_0x382b4f;return _0xfa466d;})[_0x6d56('0x21')](respondWithFilteredResult(_0xc37546,_0x52d45b))[_0x6d56('0x3e')](handleError(_0xc37546,null));};exports['show']=function(_0x1ee39e,_0x335d9e){var _0x4e83d7={'raw':!![],'where':{'id':_0x1ee39e['params']['id']}},_0x3df4c4={};_0x3df4c4[_0x6d56('0x2c')]=_[_0x6d56('0x2d')](db[_0x6d56('0x28')][_0x6d56('0x3f')]);_0x3df4c4['query']=_[_0x6d56('0x2d')](_0x1ee39e[_0x6d56('0x2e')]);_0x3df4c4[_0x6d56('0x2f')]=_[_0x6d56('0x30')](_0x3df4c4['model'],_0x3df4c4[_0x6d56('0x2e')]);_0x4e83d7[_0x6d56('0x31')]=_[_0x6d56('0x30')](_0x3df4c4[_0x6d56('0x2c')],qs['fields'](_0x1ee39e[_0x6d56('0x2e')]['fields']));_0x4e83d7[_0x6d56('0x31')]=_0x4e83d7[_0x6d56('0x31')]['length']?_0x4e83d7[_0x6d56('0x31')]:_0x3df4c4[_0x6d56('0x2c')];if(_0x1ee39e[_0x6d56('0x2e')]['includeAll']){_0x4e83d7[_0x6d56('0x3c')]=[{'all':!![]}];}_0x4e83d7=_[_0x6d56('0x3a')]({},_0x4e83d7,_0x1ee39e[_0x6d56('0x40')]);return db[_0x6d56('0x28')]['find'](_0x4e83d7)[_0x6d56('0x21')](handleEntityNotFound(_0x335d9e,null))[_0x6d56('0x21')](respondWithResult(_0x335d9e,null))['catch'](handleError(_0x335d9e,null));};exports[_0x6d56('0x41')]=function(_0x43c2f0,_0x4689a0){return db[_0x6d56('0x28')]['create'](_0x43c2f0[_0x6d56('0x42')],{})[_0x6d56('0x21')](respondWithResult(_0x4689a0,0xc9))[_0x6d56('0x3e')](handleError(_0x4689a0,null));};exports[_0x6d56('0x20')]=function(_0xd6ab0a,_0x4bec42){if(_0xd6ab0a['body']['id']){delete _0xd6ab0a[_0x6d56('0x42')]['id'];}return db[_0x6d56('0x28')][_0x6d56('0x43')]({'where':{'id':_0xd6ab0a[_0x6d56('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bec42,null))[_0x6d56('0x21')](saveUpdates(_0xd6ab0a[_0x6d56('0x42')],null))[_0x6d56('0x21')](respondWithResult(_0x4bec42,null))[_0x6d56('0x3e')](handleError(_0x4bec42,null));};exports[_0x6d56('0x45')]=function(_0x1f4b3,_0x40e593){return db['WhatsappTransferReport']['find']({'where':{'id':_0x1f4b3[_0x6d56('0x44')]['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x40e593,null))['then'](removeEntity(_0x40e593,null))['catch'](handleError(_0x40e593,null));};exports[_0x6d56('0x46')]=function(_0x4e69b5,_0x331968){return db[_0x6d56('0x28')][_0x6d56('0x46')]()[_0x6d56('0x21')](respondWithResult(_0x331968,null))[_0x6d56('0x3e')](handleError(_0x331968,null));}; \ No newline at end of file +var _0x3391=['count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','WhatsappTransferReport','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x5184bd,_0x164321){var _0x231940=function(_0xe7b7a7){while(--_0xe7b7a7){_0x5184bd['push'](_0x5184bd['shift']());}};_0x231940(++_0x164321);}(_0x3391,0x13f));var _0x1339=function(_0x53d6f3,_0x31f6c4){_0x53d6f3=_0x53d6f3-0x0;var _0x2d6876=_0x3391[_0x53d6f3];return _0x2d6876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1339('0x0'));var zipdir=require(_0x1339('0x1'));var jsonpatch=require(_0x1339('0x2'));var rp=require(_0x1339('0x3'));var moment=require(_0x1339('0x4'));var BPromise=require(_0x1339('0x5'));var Mustache=require(_0x1339('0x6'));var util=require('util');var path=require(_0x1339('0x7'));var sox=require(_0x1339('0x8'));var csv=require('to-csv');var ejs=require(_0x1339('0x9'));var fs=require('fs');var fs_extra=require(_0x1339('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1339('0xb'));var jsforce=require(_0x1339('0xc'));var deskjs=require(_0x1339('0xd'));var toCsv=require(_0x1339('0xe'));var querystring=require(_0x1339('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1339('0x10'));var config=require(_0x1339('0x11'));var licenseUtil=require(_0x1339('0x12'));var db=require(_0x1339('0x13'))['db'];function respondWithStatusCode(_0x52fc6d,_0x45bf72){_0x45bf72=_0x45bf72||0xcc;return function(_0x57b5f9){if(_0x57b5f9){return _0x52fc6d[_0x1339('0x14')](_0x45bf72);}return _0x52fc6d[_0x1339('0x15')](_0x45bf72)[_0x1339('0x16')]();};}function respondWithResult(_0x23e26f,_0x2943d6){_0x2943d6=_0x2943d6||0xc8;return function(_0x1113a3){if(_0x1113a3){return _0x23e26f[_0x1339('0x15')](_0x2943d6)[_0x1339('0x17')](_0x1113a3);}};}function respondWithFilteredResult(_0x5258ff,_0x47ec95){return function(_0x20dd43){if(_0x20dd43){var _0x3168a4=typeof _0x47ec95['offset']===_0x1339('0x18')&&typeof _0x47ec95[_0x1339('0x19')]===_0x1339('0x18');var _0x136c9a=_0x20dd43[_0x1339('0x1a')];var _0x2dc63e=_0x3168a4?0x0:_0x47ec95['offset'];var _0x5872e1=_0x3168a4?_0x20dd43['count']:_0x47ec95[_0x1339('0x1b')]+_0x47ec95[_0x1339('0x19')];var _0x28c3b8;if(_0x5872e1>=_0x136c9a){_0x5872e1=_0x136c9a;_0x28c3b8=0xc8;}else{_0x28c3b8=0xce;}_0x5258ff[_0x1339('0x15')](_0x28c3b8);return _0x5258ff[_0x1339('0x1c')](_0x1339('0x1d'),_0x2dc63e+'-'+_0x5872e1+'/'+_0x136c9a)[_0x1339('0x17')](_0x20dd43);}return null;};}function patchUpdates(_0x24a6e1){return function(_0x28ba02){try{jsonpatch[_0x1339('0x1e')](_0x28ba02,_0x24a6e1,!![]);}catch(_0x1129af){return BPromise[_0x1339('0x1f')](_0x1129af);}return _0x28ba02[_0x1339('0x20')]();};}function saveUpdates(_0x4a2257,_0x1f71c4){return function(_0x1b97b4){if(_0x1b97b4){return _0x1b97b4['update'](_0x4a2257)[_0x1339('0x21')](function(_0x220a4d){return _0x220a4d;});}return null;};}function removeEntity(_0x35afbe,_0x227058){return function(_0x3d32bc){if(_0x3d32bc){return _0x3d32bc[_0x1339('0x22')]()[_0x1339('0x21')](function(){_0x35afbe[_0x1339('0x15')](0xcc)[_0x1339('0x16')]();});}};}function handleEntityNotFound(_0x4f4695,_0x5ce012){return function(_0x3ec89e){if(!_0x3ec89e){_0x4f4695[_0x1339('0x14')](0x194);}return _0x3ec89e;};}function handleError(_0x20adcc,_0x20e506){_0x20e506=_0x20e506||0x1f4;return function(_0x5cd5ae){logger['error'](_0x5cd5ae[_0x1339('0x23')]);if(_0x5cd5ae[_0x1339('0x24')]){delete _0x5cd5ae[_0x1339('0x24')];}_0x20adcc['status'](_0x20e506)['send'](_0x5cd5ae);};}exports[_0x1339('0x25')]=function(_0x47b71f,_0x950861){var _0x488955={},_0x55df89={},_0x29e519={'count':0x0,'rows':[]};var _0x539c54=_['map'](db[_0x1339('0x26')]['rawAttributes'],function(_0x44773e){return{'name':_0x44773e[_0x1339('0x27')],'type':_0x44773e[_0x1339('0x28')][_0x1339('0x29')]};});_0x55df89[_0x1339('0x2a')]=_[_0x1339('0x2b')](_0x539c54,'name');_0x55df89['query']=_[_0x1339('0x2c')](_0x47b71f[_0x1339('0x2d')]);_0x55df89[_0x1339('0x2e')]=_[_0x1339('0x2f')](_0x55df89[_0x1339('0x2a')],_0x55df89[_0x1339('0x2d')]);_0x488955['attributes']=_['intersection'](_0x55df89['model'],qs[_0x1339('0x30')](_0x47b71f[_0x1339('0x2d')][_0x1339('0x30')]));_0x488955['attributes']=_0x488955[_0x1339('0x31')][_0x1339('0x32')]?_0x488955[_0x1339('0x31')]:_0x55df89['model'];if(!_0x47b71f[_0x1339('0x2d')][_0x1339('0x33')](_0x1339('0x34'))){_0x488955[_0x1339('0x19')]=qs['limit'](_0x47b71f[_0x1339('0x2d')][_0x1339('0x19')]);_0x488955[_0x1339('0x1b')]=qs[_0x1339('0x1b')](_0x47b71f['query'][_0x1339('0x1b')]);}_0x488955[_0x1339('0x35')]=qs[_0x1339('0x36')](_0x47b71f[_0x1339('0x2d')][_0x1339('0x36')]);_0x488955[_0x1339('0x37')]=qs[_0x1339('0x2e')](_['pick'](_0x47b71f[_0x1339('0x2d')],_0x55df89[_0x1339('0x2e')]),_0x539c54);if(_0x47b71f['query']['filter']){_0x488955[_0x1339('0x37')]=_[_0x1339('0x38')](_0x488955[_0x1339('0x37')],{'$or':_['map'](_0x539c54,function(_0x470dd6){if(_0x470dd6[_0x1339('0x28')]!=='VIRTUAL'){var _0x3671de={};_0x3671de[_0x470dd6[_0x1339('0x24')]]={'$like':'%'+_0x47b71f[_0x1339('0x2d')][_0x1339('0x39')]+'%'};return _0x3671de;}})});}_0x488955=_['merge']({},_0x488955,_0x47b71f[_0x1339('0x3a')]);var _0x36ccb6={'where':_0x488955[_0x1339('0x37')]};return db[_0x1339('0x26')]['count'](_0x36ccb6)[_0x1339('0x21')](function(_0x26520f){_0x29e519[_0x1339('0x1a')]=_0x26520f;if(_0x47b71f[_0x1339('0x2d')][_0x1339('0x3b')]){_0x488955[_0x1339('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x488955);})[_0x1339('0x21')](function(_0x123284){_0x29e519['rows']=_0x123284;return _0x29e519;})[_0x1339('0x21')](respondWithFilteredResult(_0x950861,_0x488955))[_0x1339('0x3d')](handleError(_0x950861,null));};exports[_0x1339('0x3e')]=function(_0x5a9ee3,_0x2a424c){var _0x27f1f8={'raw':!![],'where':{'id':_0x5a9ee3[_0x1339('0x3f')]['id']}},_0x24aab3={};_0x24aab3['model']=_[_0x1339('0x2c')](db['WhatsappTransferReport']['rawAttributes']);_0x24aab3[_0x1339('0x2d')]=_['keys'](_0x5a9ee3['query']);_0x24aab3[_0x1339('0x2e')]=_[_0x1339('0x2f')](_0x24aab3['model'],_0x24aab3[_0x1339('0x2d')]);_0x27f1f8[_0x1339('0x31')]=_['intersection'](_0x24aab3[_0x1339('0x2a')],qs[_0x1339('0x30')](_0x5a9ee3[_0x1339('0x2d')][_0x1339('0x30')]));_0x27f1f8[_0x1339('0x31')]=_0x27f1f8[_0x1339('0x31')][_0x1339('0x32')]?_0x27f1f8[_0x1339('0x31')]:_0x24aab3['model'];if(_0x5a9ee3[_0x1339('0x2d')][_0x1339('0x3b')]){_0x27f1f8['include']=[{'all':!![]}];}_0x27f1f8=_[_0x1339('0x38')]({},_0x27f1f8,_0x5a9ee3[_0x1339('0x3a')]);return db[_0x1339('0x26')][_0x1339('0x40')](_0x27f1f8)[_0x1339('0x21')](handleEntityNotFound(_0x2a424c,null))[_0x1339('0x21')](respondWithResult(_0x2a424c,null))[_0x1339('0x3d')](handleError(_0x2a424c,null));};exports[_0x1339('0x41')]=function(_0xd349ed,_0x3a8a75){return db[_0x1339('0x26')][_0x1339('0x41')](_0xd349ed[_0x1339('0x42')],{})['then'](respondWithResult(_0x3a8a75,0xc9))[_0x1339('0x3d')](handleError(_0x3a8a75,null));};exports[_0x1339('0x43')]=function(_0x2fc36e,_0x3bf12a){if(_0x2fc36e[_0x1339('0x42')]['id']){delete _0x2fc36e[_0x1339('0x42')]['id'];}return db[_0x1339('0x26')][_0x1339('0x40')]({'where':{'id':_0x2fc36e[_0x1339('0x3f')]['id']}})[_0x1339('0x21')](handleEntityNotFound(_0x3bf12a,null))['then'](saveUpdates(_0x2fc36e[_0x1339('0x42')],null))[_0x1339('0x21')](respondWithResult(_0x3bf12a,null))[_0x1339('0x3d')](handleError(_0x3bf12a,null));};exports[_0x1339('0x22')]=function(_0xd8b5eb,_0x4f8d6e){return db[_0x1339('0x26')][_0x1339('0x40')]({'where':{'id':_0xd8b5eb[_0x1339('0x3f')]['id']}})[_0x1339('0x21')](handleEntityNotFound(_0x4f8d6e,null))[_0x1339('0x21')](removeEntity(_0x4f8d6e,null))['catch'](handleError(_0x4f8d6e,null));};exports[_0x1339('0x44')]=function(_0x2f3b6c,_0xb179){return db[_0x1339('0x26')][_0x1339('0x44')]()[_0x1339('0x21')](respondWithResult(_0xb179,null))[_0x1339('0x3d')](handleError(_0xb179,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e1a4f52..ae33ecf 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 _0x56a1=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4cd1ae,_0x48ff9d){var _0x23e09f=function(_0x1f5745){while(--_0x1f5745){_0x4cd1ae['push'](_0x4cd1ae['shift']());}};_0x23e09f(++_0x48ff9d);}(_0x56a1,0xdc));var _0x156a=function(_0x3c8618,_0x54ada2){_0x3c8618=_0x3c8618-0x0;var _0x2deb98=_0x56a1[_0x3c8618];return _0x2deb98;};'use strict';var _=require(_0x156a('0x0'));var util=require(_0x156a('0x1'));var logger=require(_0x156a('0x2'))(_0x156a('0x3'));var moment=require(_0x156a('0x4'));var BPromise=require('bluebird');var rp=require(_0x156a('0x5'));var fs=require('fs');var path=require(_0x156a('0x6'));var rimraf=require(_0x156a('0x7'));var config=require(_0x156a('0x8'));var attributes=require(_0x156a('0x9'));module[_0x156a('0xa')]=function(_0x243f43,_0x1bb2ce){return _0x243f43[_0x156a('0xb')](_0x156a('0xc'),attributes,{'tableName':_0x156a('0xd'),'paranoid':![],'indexes':[{'name':_0x156a('0xe'),'fields':[_0x156a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa445=['../../config/logger','api','moment','bluebird','rimraf','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid'];(function(_0x33e9cc,_0x4ac288){var _0x4603fd=function(_0x21eb18){while(--_0x21eb18){_0x33e9cc['push'](_0x33e9cc['shift']());}};_0x4603fd(++_0x4ac288);}(_0xa445,0x168));var _0x5a44=function(_0x4b510d,_0x7830d0){_0x4b510d=_0x4b510d-0x0;var _0x2f9dd1=_0xa445[_0x4b510d];return _0x2f9dd1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a44('0x0'))(_0x5a44('0x1'));var moment=require(_0x5a44('0x2'));var BPromise=require(_0x5a44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5a44('0x4'));var config=require('../../config/environment');var attributes=require(_0x5a44('0x5'));module['exports']=function(_0x889438,_0x28a619){return _0x889438[_0x5a44('0x6')]('WhatsappTransferReport',attributes,{'tableName':_0x5a44('0x7'),'paranoid':![],'indexes':[{'name':_0x5a44('0x8'),'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 61f85fa..a604a46 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 _0x6a6b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x6a6b,0xd0));var _0xb6a6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a6b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb6a6('0x0'));var util=require(_0xb6a6('0x1'));var moment=require(_0xb6a6('0x2'));var BPromise=require(_0xb6a6('0x3'));var rs=require(_0xb6a6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a6('0x5'))['db'];var utils=require(_0xb6a6('0x6'));var logger=require(_0xb6a6('0x7'))(_0xb6a6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca54f,_0x157b82,_0x3a84a1){return new BPromise(function(_0xd71fbf,_0x5aca5d){return client[_0xb6a6('0xa')](_0x5ca54f,_0x3a84a1)[_0xb6a6('0xb')](function(_0x294fdc){logger[_0xb6a6('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x157b82,_0xb6a6('0xd'));logger['debug'](_0xb6a6('0xe'),_0x157b82,_0xb6a6('0xd'),JSON[_0xb6a6('0xf')](_0x294fdc));if(_0x294fdc[_0xb6a6('0x10')]){if(_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x11')]===0x1f4){logger[_0xb6a6('0x10')](_0xb6a6('0x12'),_0x157b82,_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x13')]);return _0x5aca5d(_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x13')]);}logger[_0xb6a6('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x157b82,_0x294fdc['error'][_0xb6a6('0x13')]);return _0xd71fbf(_0x294fdc['error'][_0xb6a6('0x13')]);}else{logger[_0xb6a6('0xc')](_0xb6a6('0x12'),_0x157b82,_0xb6a6('0xd'));_0xd71fbf(_0x294fdc['result'][_0xb6a6('0x13')]);}})[_0xb6a6('0x14')](function(_0x10f421){logger[_0xb6a6('0x10')](_0xb6a6('0x12'),_0x157b82,_0x10f421);_0x5aca5d(_0x10f421);});});} \ No newline at end of file +var _0xad21=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xad21,0x18e));var _0x1ad2=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xad21[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0x1ad2('0x0'));var util=require(_0x1ad2('0x1'));var moment=require('moment');var BPromise=require(_0x1ad2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ad2('0x3'));var db=require(_0x1ad2('0x4'))['db'];var utils=require(_0x1ad2('0x5'));var logger=require(_0x1ad2('0x6'))(_0x1ad2('0x7'));var config=require(_0x1ad2('0x8'));var jayson=require(_0x1ad2('0x9'));var client=jayson[_0x1ad2('0xa')][_0x1ad2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7b51,_0x22eb81,_0x32c003){return new BPromise(function(_0x2c96b3,_0x197e07){return client[_0x1ad2('0xc')](_0x3a7b51,_0x32c003)[_0x1ad2('0xd')](function(_0x98ff69){logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x22eb81,_0x1ad2('0x10'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x22eb81,_0x1ad2('0x10'),JSON[_0x1ad2('0x11')](_0x98ff69));if(_0x98ff69['error']){if(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x13')]===0x1f4){logger[_0x1ad2('0x12')](_0x1ad2('0xf'),_0x22eb81,_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);return _0x197e07(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);}logger['error'](_0x1ad2('0xf'),_0x22eb81,_0x98ff69['error'][_0x1ad2('0x14')]);return _0x2c96b3(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);}else{logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x22eb81,_0x1ad2('0x10'));_0x2c96b3(_0x98ff69[_0x1ad2('0x15')]['message']);}})[_0x1ad2('0x16')](function(_0x2122e4){logger['error'](_0x1ad2('0xf'),_0x22eb81,_0x2122e4);_0x197e07(_0x2122e4);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b0a0de4..02f9a79 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43fd=['app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5d6900,_0x34e763){_0x5d6900=_0x5d6900-0x0;var _0x46adcc=_0x43fd[_0x5d6900];return _0x46adcc;};'use strict';var _=require('lodash');var db=require(_0xd43f('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xd43f('0x1'));var config=require(_0xd43f('0x2'));var logger=require('./config/logger')(_0xd43f('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xd43f('0x4'));var schedule=require(_0xd43f('0x5'));var chat=require(_0xd43f('0x6'));var whatsapp=require(_0xd43f('0x7'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xd43f('0x8'));function main(){return db[_0xd43f('0x9')][_0xd43f('0xa')]()[_0xd43f('0xb')](function(){if(config['seedDB']){return seedDb[_0xd43f('0xc')]();}})[_0xd43f('0xb')](function(){return checkLicense['default']();})[_0xd43f('0xb')](function(){return rpc[_0xd43f('0xd')]();})[_0xd43f('0xb')](function(_0x1a91e9){logger[_0xd43f('0xe')](_0x1a91e9);return chat['start']();})[_0xd43f('0xb')](function(){return whatsapp[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return schedule[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return transcribe[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return provider[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(_0x1bed70){logger[_0xd43f('0xe')](_0x1bed70);return pm2['start'](pm2Config);})[_0xd43f('0xb')](function(_0x922f49){var _0x41be43=_0x922f49['filter'](function(_0x4c576e){return typeof _0x4c576e['exitCode']===_0xd43f('0x10')&&_0x4c576e[_0xd43f('0x11')]>=0x0;});if(_0x41be43['length']>0x0){throw new Error(_0x41be43[_0xd43f('0x12')]+_0xd43f('0x13')+_['map'](_0x41be43,function(_0x5ced70){return'\x22'+_0x5ced70['pm2_env']['name']+'\x22';}));}logger[_0xd43f('0xe')](_0xd43f('0x14'),_['map'](_[_0xd43f('0x15')](_0x922f49,{'status':_0xd43f('0x16')}),_0xd43f('0x17'))[_0xd43f('0x18')]());logger['info'](_0xd43f('0x19'),_[_0xd43f('0x1a')](_[_0xd43f('0x15')](_0x922f49,function(_0x564261){return _0x564261['status']!=='online';}),_0xd43f('0x17'))[_0xd43f('0x18')]()||_0xd43f('0x1b'));console[_0xd43f('0x1c')](_0xd43f('0x1d'));})[_0xd43f('0x1e')](function(_0x296a77){console['log'](_0xd43f('0x1f'),_0x296a77);logger['error'](_0xd43f('0x20'),_0x296a77);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x34f2=['./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x34f2,0x15a));var _0x234f=function(_0x17f89a,_0x366c7f){_0x17f89a=_0x17f89a-0x0;var _0xaf4d56=_0x34f2[_0x17f89a];return _0xaf4d56;};'use strict';var _=require(_0x234f('0x0'));var db=require(_0x234f('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x234f('0x2'));var rpc=require(_0x234f('0x3'));var config=require(_0x234f('0x4'));var logger=require(_0x234f('0x5'))(_0x234f('0x6'));var pm2=require(_0x234f('0x7'));var pm2Config=require(_0x234f('0x8'));var schedule=require(_0x234f('0x9'));var chat=require(_0x234f('0xa'));var whatsapp=require(_0x234f('0xb'));var transcribe=require(_0x234f('0xc'));var provider=require(_0x234f('0xd'));function main(){return db[_0x234f('0xe')][_0x234f('0xf')]()[_0x234f('0x10')](function(){if(config['seedDB']){return seedDb[_0x234f('0x11')]();}})[_0x234f('0x10')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x234f('0x12')]();})[_0x234f('0x10')](function(_0x128c04){logger[_0x234f('0x13')](_0x128c04);return chat[_0x234f('0x14')]();})['then'](function(){return whatsapp[_0x234f('0x14')]();})[_0x234f('0x10')](function(){return schedule[_0x234f('0x14')]();})[_0x234f('0x10')](function(){return transcribe['start']();})[_0x234f('0x10')](function(){return provider['start']();})[_0x234f('0x10')](function(_0x1d4899){logger[_0x234f('0x13')](_0x1d4899);return pm2[_0x234f('0x14')](pm2Config);})[_0x234f('0x10')](function(_0x10ee30){var _0x296c3a=_0x10ee30['filter'](function(_0x5ada71){return typeof _0x5ada71[_0x234f('0x15')]===_0x234f('0x16')&&_0x5ada71['exitCode']>=0x0;});if(_0x296c3a[_0x234f('0x17')]>0x0){throw new Error(_0x296c3a[_0x234f('0x17')]+_0x234f('0x18')+_[_0x234f('0x19')](_0x296c3a,function(_0x304c08){return'\x22'+_0x304c08[_0x234f('0x1a')][_0x234f('0x1b')]+'\x22';}));}logger[_0x234f('0x13')](_0x234f('0x1c'),_['map'](_[_0x234f('0x1d')](_0x10ee30,{'status':_0x234f('0x1e')}),_0x234f('0x1b'))[_0x234f('0x1f')]());logger[_0x234f('0x13')](_0x234f('0x20'),_[_0x234f('0x19')](_[_0x234f('0x1d')](_0x10ee30,function(_0x45b3c0){return _0x45b3c0['status']!=='online';}),_0x234f('0x1b'))[_0x234f('0x1f')]()||'None');console[_0x234f('0x21')]('App\x20Ready!');})[_0x234f('0x22')](function(_0x3f441a){console[_0x234f('0x21')](_0x234f('0x23'),_0x3f441a);logger[_0x234f('0x24')](_0x234f('0x25'),_0x3f441a);process[_0x234f('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fb27ad1..faa9b73 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 _0xeced=['permissions','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','disposition','then','closed','query','forceDownload','status','unmanaged','json','Unmanaged.','isAuthenticated','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','util','secrets','role','name','internal'];(function(_0x10b6ae,_0x56a559){var _0x1321e9=function(_0x9b0eb2){while(--_0x9b0eb2){_0x10b6ae['push'](_0x10b6ae['shift']());}};_0x1321e9(++_0x56a559);}(_0xeced,0x10f));var _0xdece=function(_0x2c680d,_0x1cb29f){_0x2c680d=_0x2c680d-0x0;var _0x43bc53=_0xeced[_0x2c680d];return _0x43bc53;};'use strict';var db=require(_0xdece('0x0'))['db'];var config=require(_0xdece('0x1'));var hardwareConf=require(_0xdece('0x2'));var licenseUtil=require(_0xdece('0x3'));var encryptor=require(_0xdece('0x4'));var _=require(_0xdece('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xdece('0x6'));var basicAuth=require(_0xdece('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xdece('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xdece('0x9')]['session']});var userAttributes=['id',_0xdece('0xa'),'fullname',_0xdece('0xb'),_0xdece('0xc'),'email','userpic',_0xdece('0xd'),_0xdece('0xe'),_0xdece('0xf'),_0xdece('0x10'),'mailPause',_0xdece('0x11'),'smsPause',_0xdece('0x12'),_0xdece('0x13'),_0xdece('0x14'),_0xdece('0x15'),_0xdece('0x16'),_0xdece('0x17'),_0xdece('0x18'),_0xdece('0x19'),_0xdece('0x1a'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd',_0xdece('0x1b'),_0xdece('0x1c'),_0xdece('0x1d'),_0xdece('0x1e'),_0xdece('0x1f'),_0xdece('0x20'),_0xdece('0x21'),_0xdece('0x22'),_0xdece('0x23'),_0xdece('0x24'),_0xdece('0x25'),'settingsEnabled',_0xdece('0x26'),_0xdece('0x27'),_0xdece('0x28'),_0xdece('0x29'),'ignorePauseForPreviewCalls',_0xdece('0x2a'),'chatAutoanswer',_0xdece('0x2b'),_0xdece('0x2c'),'emailAutoanswerDelay','smsAutoanswer',_0xdece('0x2d'),_0xdece('0x2e'),_0xdece('0x2f'),_0xdece('0x30'),_0xdece('0x31'),_0xdece('0x32'),_0xdece('0x33'),'messengerSoundNotification'];exports[_0xdece('0x34')]=function(){return this['isAuthenticated'](!![])[_0xdece('0x35')](function(_0x1158f5,_0x54700f,_0x1a05a8){if(_0x1158f5[_0xdece('0x36')]){_0x1a05a8();}else{return db[_0xdece('0x37')]['findOne']({'where':{'id':_0x1158f5[_0xdece('0x38')]['id']},'attributes':['id','closed',_0xdece('0x39')],'raw':!![]})[_0xdece('0x3a')](function(_0x48b9d5){if(_0x48b9d5&&_0x48b9d5[_0xdece('0x3b')]&&!_0x1158f5[_0xdece('0x3c')][_0xdece('0x3d')]){return _0x54700f[_0xdece('0x3e')](_0x48b9d5['disposition']===_0xdece('0x3f')?0x195:0x193)[_0xdece('0x40')]({'message':_0x48b9d5[_0xdece('0x39')]===_0xdece('0x3f')?_0xdece('0x41'):'Forbidden.'});}else{_0x1a05a8();}})['catch'](function(_0x3f1330){_0x1a05a8(_0x3f1330);});}});};exports[_0xdece('0x42')]=function isAuthenticated(_0x77959d){return compose()[_0xdece('0x35')](function(_0x568788,_0x2e3c3d,_0x47eb54){var _0x23603c;if(_0x568788[_0xdece('0x43')][_0xdece('0x44')]){if(_[_0xdece('0x45')](_0x568788[_0xdece('0x43')][_0xdece('0x44')],_0xdece('0x46'))){var _0x5d0e40=basicAuth(_0x568788);db[_0xdece('0x47')]['find']({'where':{'name':_0x5d0e40[_0xdece('0xb')]}})['then'](function(_0x3e37dc){if(!_0x3e37dc||!_0x3e37dc[_0xdece('0x48')](_0x5d0e40[_0xdece('0x49')])){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x4a')});}_0x568788['user']={'id':_0x3e37dc['id']};_0x47eb54();})[_0xdece('0x4b')](function(_0xbf6e73){_0x47eb54(_0xbf6e73);});}else if(_[_0xdece('0x45')](_0x568788[_0xdece('0x43')][_0xdece('0x44')],_0xdece('0x4c'))){validateJwt(_0x568788,_0x2e3c3d,_0x47eb54);}else{if(_0x77959d){_0x47eb54();}else{return _0x2e3c3d[_0xdece('0x3e')](0x193)['json']({'message':_0xdece('0x4d')});}}}else if(_0x568788[_0xdece('0x3c')][_0xdece('0x4e')]){try{var _0x3a51b4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdece('0x4f')]()};verifyJwt(_0x568788[_0xdece('0x3c')][_0xdece('0x4e')],_0x3a51b4)[_0xdece('0x3a')](function(_0x1759e9){return db[_0xdece('0x47')][_0xdece('0x50')]({'where':{'id':_0x1759e9[_0xdece('0x51')]}})['then'](function(_0x739f3c){_0x23603c=_0x739f3c;return db[_0xdece('0x52')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xdece('0x53')],'raw':!![]});})['then'](function(_0x43b80a){if(!_0x23603c||!_[_0xdece('0x54')](_0x23603c[_0xdece('0x55')],_0x1759e9[_0xdece('0x56')])){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x57')});}if(_0x23603c['disabled']){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}if(_0x23603c['blocked']){if(_0x43b80a[_0xdece('0x53')]>0x0){if(moment(_0x23603c['blockedAt'])[_0xdece('0x59')](_0x43b80a[_0xdece('0x53')],_0xdece('0x5a'))>moment()){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}}else{return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}}_0x568788['user']={'id':_0x23603c['id']};_0x47eb54();});})[_0xdece('0x4b')](function(){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x45f9c8){_0x47eb54(_0x45f9c8);}}else if(_0x77959d){_0x47eb54();}else{return _0x2e3c3d[_0xdece('0x3e')](0x193)[_0xdece('0x40')]({'message':_0xdece('0x4d')});}})['use'](function(_0x511a97,_0x2db5de,_0x1874f8){if(_0x511a97['user']){db[_0xdece('0x47')][_0xdece('0x50')]({'where':{'id':_0x511a97[_0xdece('0x36')]['id']},'attributes':userAttributes})[_0xdece('0x3a')](function(_0x56081c){if(!_0x56081c){return _0x2db5de[_0xdece('0x3e')](0x194)['json']({'message':_0xdece('0x5b')});}_0x511a97[_0xdece('0x36')]=_0x56081c;_0x1874f8();})[_0xdece('0x4b')](function(_0x1d26ae){_0x1874f8(_0x1d26ae);});}else if(_0x77959d){_0x1874f8();}else{return _0x2db5de[_0xdece('0x3e')](0x194)['json']({'message':_0xdece('0x5c')});}});};exports[_0xdece('0x5d')]=function canUpdate(){return compose()[_0xdece('0x35')](function(_0x3193f3,_0x29916c,_0x30aa17){return licenseUtil['getLicense']()[_0xdece('0x3a')](function(_0x205e06){if(_0x205e06[_0xdece('0x5e')]){_0x30aa17();}else{return _0x29916c[_0xdece('0x3e')](0x193)[_0xdece('0x40')]({'message':_0xdece('0x5f')});}})['catch'](function(_0x4e66b9){_0x30aa17(_0x4e66b9);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xdece('0x35')](function(_0x14075c,_0x20504a,_0x4f7bef){return licenseUtil[_0xdece('0x60')]()[_0xdece('0x3a')](function(_0x551cd7){if(_0x551cd7[_0xdece('0x61')]){_0x4f7bef();}else{return _0x20504a[_0xdece('0x3e')](0x193)['json']({'message':_0xdece('0x5f')});}})['catch'](function(_0x1c7015){_0x4f7bef(_0x1c7015);});});};exports[_0xdece('0x62')]=function(_0x5b55c0,_0x1031ac,_0x6bb1d5){_0x5b55c0['isMiddleware']=!![];return _0x6bb1d5();};exports[_0xdece('0x63')]=function signToken(_0x3d022b){return signJwt(_0x3d022b);};exports[_0xdece('0x64')]=function(_0x763b56,_0x3b0ed6){if(!_0x763b56[_0xdece('0x36')]){return _0x3b0ed6[_0xdece('0x3e')](0x194)[_0xdece('0x40')]({'message':_0xdece('0x65')});}var _0x212a50={'payload':{'id':_0x763b56[_0xdece('0x36')]['id'],'role':_0x763b56[_0xdece('0x36')][_0xdece('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x212a50)[_0xdece('0x3a')](function(_0x4026eb){_0x3b0ed6[_0xdece('0x66')](_0xdece('0x67'),_0x4026eb);_0x3b0ed6[_0xdece('0x68')](_0xdece('0x69'));})[_0xdece('0x4b')](function(_0x2b41ef){return _0x3b0ed6[_0xdece('0x3e')](0x1f4)[_0xdece('0x6a')](_0x2b41ef);});};exports[_0xdece('0x6b')]=function(_0x1b8033){if(_['isNil'](_0x1b8033[_0xdece('0x55')])||_[_0xdece('0x6c')](_0x1b8033[_0xdece('0x6d')])){return null;}else{return createJwt(_0x1b8033);}};exports[_0xdece('0x6e')]=function(_0x22934e){_0x22934e[_0xdece('0x55')]=generateNonce();_0x22934e['apiKeyIat']=generateIssuedAt();return createJwt(_0x22934e);};exports[_0xdece('0x6f')]=function(_0x47c96c,_0x2f34f7){var _0x254f2f=_0x47c96c['query']['apikey'];if(_0x254f2f){var _0x2f494b={'nonce':_0x2f34f7['apiKeyNonce'],'iat':_0x2f34f7[_0xdece('0x6d')],'audience':hardwareConf[_0xdece('0x4f')](),'issuer':hardwareConf[_0xdece('0x4f')]()};return verifyJwt(_0x254f2f,_0x2f494b)[_0xdece('0x3a')](function(){return generateApiKey(_0x2f34f7);});}else{throw{'message':_0xdece('0x70')};}};exports[_0xdece('0x71')]=function(_0x2e1400){var _0x4e591b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4e591b[_0xdece('0x72')](_0x2e1400))throw new db['Sequelize'][(_0xdece('0x73'))](_0xdece('0x74'));return;};exports[_0xdece('0x75')]=function(_0x439a8b,_0x2eb1f0,_0x52d40a){var _0x115258=encryptor[_0xdece('0x76')](_0x2eb1f0)[_0xdece('0x77')](',');for(var _0x1b9b12=0x0;_0x1b9b12<_0x52d40a;_0x1b9b12++){if(!_0x115258[_0x1b9b12])break;if(_0x439a8b[_0xdece('0x78')]()===_0x115258[_0x1b9b12][_0xdece('0x78')]()){var _0x4a5ba0=util[_0xdece('0x79')](_0xdece('0x7a'),_0x52d40a);if(_0x52d40a===0x1){_0x4a5ba0=_0xdece('0x7b');}throw new db[(_0xdece('0x7c'))]['ValidationError'](_0x4a5ba0);}}return;};exports[_0xdece('0x7d')]=function(_0x271b76,_0x152e8f){var _0x47a990=_0x152e8f?encryptor[_0xdece('0x76')](_0x152e8f)[_0xdece('0x77')](','):[];if(_0x47a990[_0xdece('0x7e')]===0x5){_0x47a990['splice'](-0x1,0x1);}_0x47a990[_0xdece('0x7f')](_0x271b76);return encryptor[_0xdece('0x80')](_0x47a990['join'](','));};function signJwt(_0xe94051){var _0x5eec50=BPromise[_0xdece('0x81')](jwt[_0xdece('0x82')],{'context':jwt});var _0x1be83f=_0xe94051[_0xdece('0x83')]||config[_0xdece('0x9')]['session'];return new BPromise(function(_0x228326,_0xc59016){_0x5eec50(_0xe94051[_0xdece('0x84')],_0x1be83f,_0xe94051[_0xdece('0x85')])[_0xdece('0x3a')](function(_0x389338){_0x228326(_0x389338);})['catch'](function(_0x13a1bd){_0xc59016(_0x13a1bd);});});}function verifyJwt(_0x4dc8aa,_0x1a7165,_0x58590c){var _0x44fb2d=BPromise['promisify'](jwt[_0xdece('0x86')],{'context':jwt});var _0x22956e=_0x58590c||config['secrets'][_0xdece('0x87')];return new BPromise(function(_0x518279,_0x20e398){_0x44fb2d(_0x4dc8aa,_0x22956e,_0x1a7165)[_0xdece('0x3a')](function(_0x26b01c){_0x518279(_0x26b01c);})['catch'](function(_0x2f1994){_0x20e398(_0x2f1994);});});}function generateNonce(){return crypto[_0xdece('0x88')](0x10)[_0xdece('0x89')](_0xdece('0x8a'));}function generateIssuedAt(){return Math[_0xdece('0x8b')](Date[_0xdece('0x8c')]()/0x3e8)[_0xdece('0x89')]();}function createJwt(_0xd08440){var _0x5f01d4={'payload':{'iat':_0xd08440[_0xdece('0x6d')],'nonce':_0xd08440[_0xdece('0x55')]},'options':{'algorithm':_0xdece('0x8d'),'subject':_0xd08440['id'][_0xdece('0x89')](),'issuer':hardwareConf[_0xdece('0x4f')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5f01d4)[_0xdece('0x3a')](function(_0x374be9){return{'iat':_0xd08440[_0xdece('0x6d')],'nonce':_0xd08440['apiKeyNonce'],'token':_0x374be9};});} \ No newline at end of file +var _0x38e7=['update','Forbidden','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','join','promisify','sign','secret','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','basic-auth','crypto','bluebird','util','moment','secrets','session','role','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','query','forceDownload','status','unmanaged','Unmanaged.','catch','headers','startsWith','authorization','User','find','name','authenticate','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','apikey','sub','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense'];(function(_0x18a794,_0x335c63){var _0x4fadaa=function(_0x49b618){while(--_0x49b618){_0x18a794['push'](_0x18a794['shift']());}};_0x4fadaa(++_0x335c63);}(_0x38e7,0xa7));var _0x738e=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x38e7[_0x1e393b];return _0x3d0bfe;};'use strict';var db=require(_0x738e('0x0'))['db'];var config=require(_0x738e('0x1'));var hardwareConf=require(_0x738e('0x2'));var licenseUtil=require(_0x738e('0x3'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x738e('0x4'));var crypto=require(_0x738e('0x5'));var BPromise=require(_0x738e('0x6'));var util=require(_0x738e('0x7'));var moment=require(_0x738e('0x8'));var validateJwt=expressJwt({'secret':config[_0x738e('0x9')][_0x738e('0xa')]});var userAttributes=['id',_0x738e('0xb'),'fullname','name','internal','email','userpic',_0x738e('0xc'),_0x738e('0xd'),_0x738e('0xe'),_0x738e('0xf'),'mailPause',_0x738e('0x10'),_0x738e('0x11'),_0x738e('0x12'),_0x738e('0x13'),_0x738e('0x14'),_0x738e('0x15'),_0x738e('0x16'),_0x738e('0x17'),_0x738e('0x18'),'passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x738e('0x19'),_0x738e('0x1a'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x738e('0x1b'),_0x738e('0x1c'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x738e('0x1d'),_0x738e('0x1e'),_0x738e('0x1f'),_0x738e('0x20'),'settingsEnabled',_0x738e('0x21'),_0x738e('0x22'),_0x738e('0x23'),_0x738e('0x24'),_0x738e('0x25'),'selectRecallMeCampaign',_0x738e('0x26'),_0x738e('0x27'),_0x738e('0x28'),_0x738e('0x29'),_0x738e('0x2a'),_0x738e('0x2b'),_0x738e('0x2c'),_0x738e('0x2d'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x738e('0x2e'),_0x738e('0x2f')];exports[_0x738e('0x30')]=function(){return this[_0x738e('0x31')](!![])[_0x738e('0x32')](function(_0x1dbaa2,_0x3bc810,_0x204f57){if(_0x1dbaa2[_0x738e('0x33')]){_0x204f57();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1dbaa2[_0x738e('0x34')]['id']},'attributes':['id',_0x738e('0x35'),_0x738e('0x36')],'raw':!![]})[_0x738e('0x37')](function(_0x231370){if(_0x231370&&_0x231370[_0x738e('0x35')]&&!_0x1dbaa2[_0x738e('0x38')][_0x738e('0x39')]){return _0x3bc810[_0x738e('0x3a')](_0x231370[_0x738e('0x36')]===_0x738e('0x3b')?0x195:0x193)['json']({'message':_0x231370[_0x738e('0x36')]===_0x738e('0x3b')?_0x738e('0x3c'):'Forbidden.'});}else{_0x204f57();}})[_0x738e('0x3d')](function(_0x522acf){_0x204f57(_0x522acf);});}});};exports[_0x738e('0x31')]=function isAuthenticated(_0x39efff){return compose()[_0x738e('0x32')](function(_0x10d04d,_0x120774,_0x56acb8){var _0x113ab1;if(_0x10d04d[_0x738e('0x3e')]['authorization']){if(_[_0x738e('0x3f')](_0x10d04d[_0x738e('0x3e')][_0x738e('0x40')],'Basic')){var _0x5109f0=basicAuth(_0x10d04d);db[_0x738e('0x41')][_0x738e('0x42')]({'where':{'name':_0x5109f0[_0x738e('0x43')]}})[_0x738e('0x37')](function(_0x805056){if(!_0x805056||!_0x805056[_0x738e('0x44')](_0x5109f0[_0x738e('0x45')])){return _0x120774['status'](0x191)[_0x738e('0x46')]({'message':_0x738e('0x47')});}_0x10d04d[_0x738e('0x33')]={'id':_0x805056['id']};_0x56acb8();})[_0x738e('0x3d')](function(_0x1c6a3a){_0x56acb8(_0x1c6a3a);});}else if(_[_0x738e('0x3f')](_0x10d04d[_0x738e('0x3e')][_0x738e('0x40')],_0x738e('0x48'))){validateJwt(_0x10d04d,_0x120774,_0x56acb8);}else{if(_0x39efff){_0x56acb8();}else{return _0x120774[_0x738e('0x3a')](0x193)['json']({'message':_0x738e('0x49')});}}}else if(_0x10d04d['query']['apikey']){try{var _0x5b7d20={'audience':hardwareConf[_0x738e('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x10d04d[_0x738e('0x38')][_0x738e('0x4b')],_0x5b7d20)[_0x738e('0x37')](function(_0x26c992){return db[_0x738e('0x41')][_0x738e('0x42')]({'where':{'id':_0x26c992[_0x738e('0x4c')]}})['then'](function(_0x56e906){_0x113ab1=_0x56e906;return db['Setting'][_0x738e('0x4d')]({'where':{'id':0x1},'attributes':[_0x738e('0x4e'),_0x738e('0x4f')],'raw':!![]});})['then'](function(_0x124c5f){if(!_0x113ab1||!_[_0x738e('0x50')](_0x113ab1[_0x738e('0x51')],_0x26c992[_0x738e('0x52')])){return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x53')});}if(_0x113ab1[_0x738e('0x54')]){return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x55')});}if(_0x113ab1['blocked']){if(_0x124c5f['blockDuration']>0x0){if(moment(_0x113ab1['blockedAt'])[_0x738e('0x56')](_0x124c5f[_0x738e('0x4f')],'minutes')>moment()){return _0x120774[_0x738e('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x55')});}}_0x10d04d[_0x738e('0x33')]={'id':_0x113ab1['id']};_0x56acb8();});})['catch'](function(){return _0x120774['status'](0x191)[_0x738e('0x46')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x466679){_0x56acb8(_0x466679);}}else if(_0x39efff){_0x56acb8();}else{return _0x120774['status'](0x193)[_0x738e('0x46')]({'message':_0x738e('0x49')});}})[_0x738e('0x32')](function(_0x8009a8,_0x177a40,_0x5df901){if(_0x8009a8[_0x738e('0x33')]){db['User']['find']({'where':{'id':_0x8009a8['user']['id']},'attributes':userAttributes})[_0x738e('0x37')](function(_0x441a0d){if(!_0x441a0d){return _0x177a40['status'](0x194)[_0x738e('0x46')]({'message':_0x738e('0x57')});}_0x8009a8[_0x738e('0x33')]=_0x441a0d;_0x5df901();})['catch'](function(_0x3b75e0){_0x5df901(_0x3b75e0);});}else if(_0x39efff){_0x5df901();}else{return _0x177a40[_0x738e('0x3a')](0x194)[_0x738e('0x46')]({'message':_0x738e('0x58')});}});};exports[_0x738e('0x59')]=function canUpdate(){return compose()[_0x738e('0x32')](function(_0x1d2b0e,_0x22f201,_0x91044b){return licenseUtil[_0x738e('0x5a')]()['then'](function(_0x233473){if(_0x233473[_0x738e('0x5b')]){_0x91044b();}else{return _0x22f201['status'](0x193)[_0x738e('0x46')]({'message':_0x738e('0x5c')});}})[_0x738e('0x3d')](function(_0x191bfb){_0x91044b(_0x191bfb);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x738e('0x32')](function(_0x22c019,_0x351ee5,_0x1eace9){return licenseUtil[_0x738e('0x5a')]()['then'](function(_0x25e848){if(_0x25e848[_0x738e('0x5d')]){_0x1eace9();}else{return _0x351ee5[_0x738e('0x3a')](0x193)[_0x738e('0x46')]({'message':_0x738e('0x5c')});}})[_0x738e('0x3d')](function(_0xf166a4){_0x1eace9(_0xf166a4);});});};exports[_0x738e('0x5e')]=function(_0x4abd51,_0x5a5ce3,_0x19e846){_0x4abd51[_0x738e('0x5e')]=!![];return _0x19e846();};exports['signToken']=function signToken(_0x59524c){return signJwt(_0x59524c);};exports[_0x738e('0x5f')]=function(_0x12cbf0,_0x5b6b2c){if(!_0x12cbf0[_0x738e('0x33')]){return _0x5b6b2c[_0x738e('0x3a')](0x194)[_0x738e('0x46')]({'message':_0x738e('0x60')});}var _0x5a5329={'payload':{'id':_0x12cbf0[_0x738e('0x33')]['id'],'role':_0x12cbf0[_0x738e('0x33')][_0x738e('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5a5329)[_0x738e('0x37')](function(_0x51652a){_0x5b6b2c['cookie'](_0x738e('0x61'),_0x51652a);_0x5b6b2c['redirect'](_0x738e('0x62'));})[_0x738e('0x3d')](function(_0x3b273f){return _0x5b6b2c['status'](0x1f4)[_0x738e('0x63')](_0x3b273f);});};exports[_0x738e('0x64')]=function(_0x4f9317){if(_[_0x738e('0x65')](_0x4f9317['apiKeyNonce'])||_['isNil'](_0x4f9317[_0x738e('0x66')])){return null;}else{return createJwt(_0x4f9317);}};exports[_0x738e('0x67')]=function(_0x46bb1d){_0x46bb1d[_0x738e('0x51')]=generateNonce();_0x46bb1d[_0x738e('0x66')]=generateIssuedAt();return createJwt(_0x46bb1d);};exports[_0x738e('0x68')]=function(_0x1e6e41,_0x4c2218){var _0x51218b=_0x1e6e41[_0x738e('0x38')][_0x738e('0x4b')];if(_0x51218b){var _0x20d617={'nonce':_0x4c2218['apiKeyNonce'],'iat':_0x4c2218[_0x738e('0x66')],'audience':hardwareConf[_0x738e('0x4a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x51218b,_0x20d617)[_0x738e('0x37')](function(){return generateApiKey(_0x4c2218);});}else{throw{'message':_0x738e('0x69')};}};exports[_0x738e('0x6a')]=function(_0x121c59){var _0x2e0f26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2e0f26['test'](_0x121c59))throw new db[(_0x738e('0x6b'))][(_0x738e('0x6c'))](_0x738e('0x6d'));return;};exports[_0x738e('0x6e')]=function(_0x23b17e,_0x52cbe0,_0x233adb){var _0xbf3bd=encryptor['decryptString'](_0x52cbe0)['split'](',');for(var _0x434aa7=0x0;_0x434aa7<_0x233adb;_0x434aa7++){if(!_0xbf3bd[_0x434aa7])break;if(_0x23b17e['toLowerCase']()===_0xbf3bd[_0x434aa7][_0x738e('0x6f')]()){var _0x16f3ce=util[_0x738e('0x70')](_0x738e('0x71'),_0x233adb);if(_0x233adb===0x1){_0x16f3ce='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x738e('0x6b'))][(_0x738e('0x6c'))](_0x16f3ce);}}return;};exports[_0x738e('0x72')]=function(_0x3c4dee,_0x3134cf){var _0x59c66c=_0x3134cf?encryptor['decryptString'](_0x3134cf)[_0x738e('0x73')](','):[];if(_0x59c66c['length']===0x5){_0x59c66c[_0x738e('0x74')](-0x1,0x1);}_0x59c66c['unshift'](_0x3c4dee);return encryptor['encryptString'](_0x59c66c[_0x738e('0x75')](','));};function signJwt(_0x4d2573){var _0x5bc8c9=BPromise[_0x738e('0x76')](jwt[_0x738e('0x77')],{'context':jwt});var _0x2327ed=_0x4d2573[_0x738e('0x78')]||config[_0x738e('0x9')][_0x738e('0xa')];return new BPromise(function(_0x4e28c5,_0x477b45){_0x5bc8c9(_0x4d2573['payload'],_0x2327ed,_0x4d2573[_0x738e('0x79')])[_0x738e('0x37')](function(_0x40b80b){_0x4e28c5(_0x40b80b);})['catch'](function(_0x564210){_0x477b45(_0x564210);});});}function verifyJwt(_0xc52ca2,_0x7027a,_0x266b60){var _0x125e2b=BPromise[_0x738e('0x76')](jwt[_0x738e('0x7a')],{'context':jwt});var _0x515954=_0x266b60||config[_0x738e('0x9')][_0x738e('0xa')];return new BPromise(function(_0x2f5e8e,_0x1b4605){_0x125e2b(_0xc52ca2,_0x515954,_0x7027a)[_0x738e('0x37')](function(_0x669dfa){_0x2f5e8e(_0x669dfa);})[_0x738e('0x3d')](function(_0x4987d7){_0x1b4605(_0x4987d7);});});}function generateNonce(){return crypto[_0x738e('0x7b')](0x10)['toString'](_0x738e('0x7c'));}function generateIssuedAt(){return Math[_0x738e('0x7d')](Date[_0x738e('0x7e')]()/0x3e8)[_0x738e('0x7f')]();}function createJwt(_0x4bbc52){var _0x2ddfe6={'payload':{'iat':_0x4bbc52[_0x738e('0x66')],'nonce':_0x4bbc52[_0x738e('0x51')]},'options':{'algorithm':_0x738e('0x80'),'subject':_0x4bbc52['id'][_0x738e('0x7f')](),'issuer':hardwareConf[_0x738e('0x4a')](),'audience':hardwareConf[_0x738e('0x4a')]()}};return signJwt(_0x2ddfe6)['then'](function(_0x231f5a){return{'iat':_0x4bbc52['apiKeyIat'],'nonce':_0x4bbc52['apiKeyNonce'],'token':_0x231f5a};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 5f1d8be..f8336f1 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd1d=['slice','all','length','type','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','fields','clause','getFilteredContacts','rows','catch','describe','keys','cf_','map','CmCustomField'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcd1d,0x16f));var _0xdcd1=function(_0x5532d9,_0x2a43ce){_0x5532d9=_0x5532d9-0x0;var _0x25469d=_0xcd1d[_0x5532d9];return _0x25469d;};'use strict';var _=require('lodash');var sqlUtils=require(_0xdcd1('0x0'));var db=require(_0xdcd1('0x1'))['db'];exports[_0xdcd1('0x2')]=function(_0xfb403c,_0x53ddf3,_0x511ebe,_0x243ff8){var _0x6f9aea={'count':0x0,'rows':[]};var _0x2726af=sqlUtils['skipContactsQuery'](_0x53ddf3,_0xfb403c);if(_0x2726af){return Promise[_0xdcd1('0x3')](_0x6f9aea);}var _0xec2fe3=sqlUtils[_0xdcd1('0x4')]();var _0x41df36={};var _0x337784=![];var _0x25ffe5=![];return Promise[_0xdcd1('0x3')]()[_0xdcd1('0x5')](function(){if(_0xfb403c[_0xdcd1('0x6')]){return sqlUtils[_0xdcd1('0x7')](_0xfb403c[_0xdcd1('0x6')],_0x243ff8);}else{return sqlUtils[_0xdcd1('0x8')](_0xfb403c,_0x243ff8);}})[_0xdcd1('0x5')](function(_0x164136){_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xa')]);_0xec2fe3[_0xdcd1('0x9')](_0x164136['fields']);_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xb')]);_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xc')]['clause']);_0x41df36=_0x164136['tags'];_0x25ffe5=_0x164136[_0xdcd1('0xc')]['skip'];return sqlUtils[_0xdcd1('0xd')](_0x53ddf3,_0xfb403c,_0x25ffe5);})[_0xdcd1('0x5')](function(_0x14f1a5){_0xec2fe3[_0xdcd1('0x9')](_0x14f1a5);var _0x556094=_0xfb403c[_0xdcd1('0x6')]?_0x41df36[_0xdcd1('0xe')]:_0xfb403c[_0xdcd1('0xf')];_0x337784=_0x556094?!![]:![];return sqlUtils[_0xdcd1('0x10')](_0xec2fe3,_0x556094);})[_0xdcd1('0x5')](function(_0x4ef809){_0x6f9aea[_0xdcd1('0x11')]=_0x4ef809;if(_0x6f9aea[_0xdcd1('0x11')]===0x0){return;}if(_0xfb403c['User']){_0x25ffe5=!![];}return sqlUtils[_0xdcd1('0x12')](_0xec2fe3,_0xfb403c[_0xdcd1('0x13')],_0x511ebe,_0x337784,_0x41df36[_0xdcd1('0x14')],_0x25ffe5);})['then'](function(_0x414219){if(!_0x414219){return[];}return sqlUtils[_0xdcd1('0x15')](_0x414219,_0xfb403c,_0x511ebe);})[_0xdcd1('0x5')](function(_0x2f4355){_0x6f9aea[_0xdcd1('0x16')]=_0x2f4355;return _0x6f9aea;})[_0xdcd1('0x17')](function(_0x4346a0){throw _0x4346a0;});};exports['describe']=function(){var _0x4e08a2={};var _0x299227=[];return db['CmContact'][_0xdcd1('0x18')]()['then'](function(_0x48752b){_0x4e08a2=_0x48752b;var _0x5af484=Object[_0xdcd1('0x19')](_0x4e08a2)[_0xdcd1('0xb')](function(_0x510656){return _['startsWith'](_0x510656,_0xdcd1('0x1a'))?_0x510656:undefined;});var _0x2b51ba=_0x5af484[_0xdcd1('0x1b')](function(_0x89b7a1){return db[_0xdcd1('0x1c')]['findOne']({'where':{'id':_0x89b7a1[_0xdcd1('0x1d')](0x3)},'raw':!![]});});return Promise[_0xdcd1('0x1e')](_0x2b51ba);})[_0xdcd1('0x5')](function(_0x636c2){for(var _0x1d5841=0x0;_0x1d5841<_0x636c2[_0xdcd1('0x1f')];_0x1d5841++){if(_0x636c2[_0x1d5841]){var _0xb5950e=_0xdcd1('0x1a')+_0x636c2[_0x1d5841]['id'];_0x4e08a2[_0xb5950e]['fieldType']=_0x636c2[_0x1d5841][_0xdcd1('0x20')];}}_0x299227=_['map'](Object[_0xdcd1('0x19')](_0x4e08a2),function(_0x5e305e){return{'name':_0x5e305e,'type':_0x4e08a2[_0x5e305e][_0xdcd1('0x20')]};});return _0x299227;})[_0xdcd1('0x17')](function(_0x391d1d){throw _0x391d1d;});}; \ No newline at end of file +var _0xd96b=['fields','filter','clause','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','where','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd96b,0x67));var _0xbd96=function(_0x31e5bf,_0x3d8b97){_0x31e5bf=_0x31e5bf-0x0;var _0x5a32d1=_0xd96b[_0x31e5bf];return _0x5a32d1;};'use strict';var _=require(_0xbd96('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbd96('0x1'))['db'];exports[_0xbd96('0x2')]=function(_0x167355,_0x171f40,_0x356974,_0x479d39){var _0x53e132={'count':0x0,'rows':[]};var _0x37a8a3=sqlUtils[_0xbd96('0x3')](_0x171f40,_0x167355);if(_0x37a8a3){return Promise[_0xbd96('0x4')](_0x53e132);}var _0xe39154=sqlUtils[_0xbd96('0x5')]();var _0x154a38={};var _0x2f9bab=![];var _0x4da6db=![];return Promise[_0xbd96('0x4')]()[_0xbd96('0x6')](function(){if(_0x167355[_0xbd96('0x7')]){return sqlUtils[_0xbd96('0x8')](_0x167355[_0xbd96('0x7')],_0x479d39);}else{return sqlUtils['parseQueryParameters'](_0x167355,_0x479d39);}})['then'](function(_0x41d3d7){_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xa')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xb')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xc')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7['user'][_0xbd96('0xd')]);_0x154a38=_0x41d3d7[_0xbd96('0xe')];_0x4da6db=_0x41d3d7[_0xbd96('0xf')][_0xbd96('0x10')];return sqlUtils[_0xbd96('0x11')](_0x171f40,_0x167355,_0x4da6db);})[_0xbd96('0x6')](function(_0x310948){_0xe39154[_0xbd96('0x9')](_0x310948);var _0x1c3d5a=_0x167355[_0xbd96('0x7')]?_0x154a38[_0xbd96('0x12')]:_0x167355['tag'];_0x2f9bab=_0x1c3d5a?!![]:![];return sqlUtils[_0xbd96('0x13')](_0xe39154,_0x1c3d5a);})['then'](function(_0x1a0cfd){_0x53e132[_0xbd96('0x14')]=_0x1a0cfd;if(_0x53e132[_0xbd96('0x14')]===0x0){return;}if(_0x167355[_0xbd96('0x15')]){_0x4da6db=!![];}return sqlUtils[_0xbd96('0x16')](_0xe39154,_0x167355[_0xbd96('0xb')],_0x356974,_0x2f9bab,_0x154a38[_0xbd96('0xd')],_0x4da6db);})[_0xbd96('0x6')](function(_0x2fad9b){if(!_0x2fad9b){return[];}return sqlUtils[_0xbd96('0x17')](_0x2fad9b,_0x167355,_0x356974);})[_0xbd96('0x6')](function(_0x595055){_0x53e132[_0xbd96('0x18')]=_0x595055;return _0x53e132;})[_0xbd96('0x19')](function(_0x205b2e){throw _0x205b2e;});};exports[_0xbd96('0x1a')]=function(){var _0x3206ed={};var _0xab5f6b=[];return db[_0xbd96('0x1b')]['describe']()[_0xbd96('0x6')](function(_0x1fb35e){_0x3206ed=_0x1fb35e;var _0x458778=Object[_0xbd96('0x1c')](_0x3206ed)['filter'](function(_0x1ddc98){return _[_0xbd96('0x1d')](_0x1ddc98,_0xbd96('0x1e'))?_0x1ddc98:undefined;});var _0x3e32b1=_0x458778[_0xbd96('0x1f')](function(_0x1c70e2){return db[_0xbd96('0x20')][_0xbd96('0x21')]({'where':{'id':_0x1c70e2['slice'](0x3)},'raw':!![]});});return Promise[_0xbd96('0x22')](_0x3e32b1);})[_0xbd96('0x6')](function(_0x2d26cd){for(var _0x519f46=0x0;_0x519f46<_0x2d26cd[_0xbd96('0x23')];_0x519f46++){if(_0x2d26cd[_0x519f46]){var _0x23bae1=_0xbd96('0x1e')+_0x2d26cd[_0x519f46]['id'];_0x3206ed[_0x23bae1][_0xbd96('0x24')]=_0x2d26cd[_0x519f46][_0xbd96('0x25')];}}_0xab5f6b=_[_0xbd96('0x1f')](Object[_0xbd96('0x1c')](_0x3206ed),function(_0x42a3ab){return{'name':_0x42a3ab,'type':_0x3206ed[_0x42a3ab][_0xbd96('0x25')]};});return _0xab5f6b;})[_0xbd96('0x19')](function(_0x33ddcb){throw _0x33ddcb;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 78dd9f6..d274826 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc21a=['MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','clause','and','ids','User','user','skip','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','tag','tags','filter','agent','getLists','c.ListId\x20IN\x20?','attributes','select','group','limit','offset','subqry.id','having','order','subqry.','Tag','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../interaction/utils','../../mysqldb','search','ListId','autocomplete','true','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length'];(function(_0x1edb87,_0x55bc63){var _0x4e864e=function(_0x23e58e){while(--_0x23e58e){_0x1edb87['push'](_0x1edb87['shift']());}};_0x4e864e(++_0x55bc63);}(_0xc21a,0x1dc));var _0xac21=function(_0x20ad7e,_0x44ddf7){_0x20ad7e=_0x20ad7e-0x0;var _0x519be3=_0xc21a[_0x20ad7e];return _0x519be3;};'use strict';var _=require(_0xac21('0x0'));var squel=require(_0xac21('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xac21('0x2'));var db=require(_0xac21('0x3'))['db'];function skipContactsQuery(_0x293f54,_0x3fe353){var _0x484b43=![];if(_0x293f54['role']==='agent'&&!_0x3fe353[_0xac21('0x4')]&&!_0x3fe353[_0xac21('0x5')]&&_0x3fe353[_0xac21('0x6')]!==_0xac21('0x7')){_0x484b43=!![];}return _0x484b43;}function getContactsSubquery(){return squel['select']()[_0xac21('0x8')](_0xac21('0x9'),'c')['where'](_0xac21('0xa'));}function applyJoinClauses(_0x25890b,_0x34137b){var _0x372025=_0x34137b?'c':_0xac21('0xb');_0x25890b[_0xac21('0xc')](_0xac21('0xd'),'uc',_0xac21('0xe')+_0x372025+_0xac21('0xf'))[_0xac21('0xc')](_0xac21('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x372025+_0xac21('0xf'))[_0xac21('0xc')](_0xac21('0x11'),'t',_0xac21('0x12'));return _0x25890b;}function addFieldsToQuery(_0x47c94d,_0x418397,_0xc8fb61,_0x116a28,_0x35e0f8){var _0x590b9b=_0x35e0f8?'c':_0xac21('0xb');if(!_0x418397){_0x418397=['id',_0xac21('0x13'),'lastName',_0xac21('0x14'),_0xac21('0x15'),_0xac21('0x16'),_0xac21('0x17'),_0xac21('0x5'),_0xac21('0x18'),_0xac21('0x19'),_0xac21('0x1a'),_0xac21('0x1b'),_0xac21('0x1c')];}else if(!_0x418397['includes']('id')){_0x418397[_0xac21('0x1d')]('id');}var _0x5a1dca=_0xc8fb61&&_0x35e0f8||!_0xc8fb61&&!_0x35e0f8;if(_0x116a28){_0x5a1dca=_0x116a28&&_0x35e0f8||!_0x116a28&&!_0x35e0f8;}_0x418397[_0xac21('0x1e')](function(_0x90519e){if(_0x90519e===_0xac21('0x1c')){if(_0x5a1dca){_0x47c94d[_0xac21('0x1f')](_0xac21('0x20'),_0x90519e);}else if(_0xc8fb61||_0x116a28){_0x47c94d[_0xac21('0x1f')](_0x590b9b+'.'+_0x90519e);}}else{_0x47c94d['field'](_0x590b9b+'.'+_0x90519e);}});return _0x47c94d;}function getSqlClauses(){var _0x26d2b6={'default':squel[_0xac21('0x21')](),'fields':squel[_0xac21('0x21')](),'filter':squel[_0xac21('0x21')](),'tags':{'clause':squel[_0xac21('0x21')](),'ids':null},'user':{'clause':squel[_0xac21('0x21')](),'skip':![]}};return _0x26d2b6;}function parseTagParameter(_0x3bf724){var _0x1fe061=squel[_0xac21('0x21')]();if(_0x3bf724){var _0x23484c=utils[_0xac21('0x22')](_0x3bf724);_0x23484c['forEach'](function(_0x4533af){_0x1fe061['or'](_0xac21('0x23'),'%,'+_0x4533af+',%');});}return _0x1fe061;}function parseSearchFilter(_0x5f201a){var _0xe3729f=squel['expr']();if(_0x5f201a){var _0x568c6e=_0x5f201a[_0xac21('0x24')]('\x5c','\x5c\x5c')[_0xac21('0x24')](/'/g,'\x27\x27');var _0x11f2aa=qs['escapeLIKESpecialChars'](_0x568c6e);if(_0x568c6e[_0xac21('0x25')]('\x20')[_0xac21('0x26')]>0x1){_0xe3729f['or'](_0xac21('0x27'),qs[_0xac21('0x28')](_0x568c6e,!![]),null);}else{if(qs[_0xac21('0x29')](_0x568c6e)){_0xe3729f['or'](_0xac21('0x2a'),_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2b'),_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2c'),_0x11f2aa+'%');_0xe3729f['or']('c.fax\x20LIKE\x20?',_0x11f2aa+'%');}else if(qs[_0xac21('0x2d')](_0x568c6e)){_0xe3729f['or']('c.email\x20LIKE\x20?',_0x11f2aa+'%');}else{_0xe3729f['or'](_0xac21('0x2e'),'%'+_0x11f2aa+'%');_0xe3729f['or']('c.lastName\x20LIKE\x20?','%'+_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2f'),'%'+_0x11f2aa+'%');}}}return _0xe3729f;}function parseAdvancedSearchFilter(_0x57ab53,_0x13a1a8){var _0x34148d=getSqlClauses();var _0x2ce319=as[_0xac21('0x30')](_0x57ab53);var _0x200491=_0x2ce319['sqlOperator'];for(var _0x36eee8=0x0;_0x36eee8<_0x2ce319[_0xac21('0x31')][_0xac21('0x26')];_0x36eee8++){var _0x5dfb1e=_0x2ce319[_0xac21('0x31')][_0x36eee8];var _0x3e0d45='c';var _0x22b6ff=_[_0xac21('0x32')](_0x13a1a8,[_0xac21('0x33'),_0x5dfb1e[_0xac21('0x1f')]]);if(_0x22b6ff){if(_0x5dfb1e[_0xac21('0x1f')]===_0xac21('0x34')||_0x22b6ff[_0xac21('0x35')]===_0xac21('0x36')){_0x5dfb1e[_0xac21('0x37')]=_0xac21('0x38');}var _0x542922=as[_0xac21('0x39')](_0x3e0d45,_0x22b6ff['type'],_0x5dfb1e);_0x34148d[_0xac21('0x3a')][_0x200491](_0x542922[_0xac21('0x3b')],_0x542922['value']['start'],_0x542922['value']['end']);}else{if(_0x5dfb1e[_0xac21('0x1f')]==='Tag'){var _0x3214f2=_0x5dfb1e[_0xac21('0x3c')][_0xac21('0x25')](',')['map'](function(_0x20b1c8){return Number(_0x20b1c8);});var _0x5905a5=parseTagParameter(_0x3214f2);_0x34148d['tags'][_0xac21('0x3d')][_0xac21('0x3e')](_0x5905a5);_0x34148d['tags'][_0xac21('0x3f')]=_0x3214f2;}else if(_0x5dfb1e[_0xac21('0x1f')]===_0xac21('0x40')){_0x34148d['user']['clause'][_0xac21('0x3e')]('uc.UserId\x20=\x20?',_0x5dfb1e[_0xac21('0x3c')]);_0x34148d[_0xac21('0x41')][_0xac21('0x42')]=!![];}}}return _0x34148d;}function parseModelFields(_0xc2c632,_0x431930){var _0x2c39f0=squel[_0xac21('0x21')]();var _0x2051de=_(_0xc2c632)['keys']()['map'](function(_0x5aee11){return _[_0xac21('0x43')](_0x431930,['name',_0x5aee11])?_0x5aee11:undefined;})[_0xac21('0x44')]()[_0xac21('0x3c')]();if(_0xc2c632[_0xac21('0x45')]){_0x2051de[_0xac21('0x1d')](_0xac21('0x45'));}if(_0xc2c632[_0xac21('0x40')]){_0x2051de['push']('User');}if(_0x2051de['length']>0x0){_0x2051de[_0xac21('0x1e')](function(_0x17e20b){if(_0x17e20b===_0xac21('0x5')){_0x2c39f0[_0xac21('0x3e')]('c.ListId\x20IN\x20?',[][_0xac21('0x46')](_0xc2c632[_0x17e20b]));}else if(_0x17e20b===_0xac21('0x45')){var _0x450c66='%'+_0xc2c632[_0x17e20b]+'%';_0x2c39f0[_0xac21('0x3e')](_0xac21('0x47'),_0x450c66);}else if(_0x17e20b===_0xac21('0x40')){_0x2c39f0['and'](_0xac21('0x48'),_0xc2c632[_0x17e20b]);}else{_0x2c39f0[_0xac21('0x3e')]('c.'+_0x17e20b+'\x20=\x20?',_0xc2c632[_0x17e20b]);}});}return _0x2c39f0;}function parseQueryParameters(_0xeddc9b,_0x5f2701){var _0x207ffb=getSqlClauses();return Promise[_0xac21('0x49')]()[_0xac21('0x4a')](function(){return parseModelFields(_0xeddc9b,_0x5f2701);})[_0xac21('0x4a')](function(_0x5ac23e){_0x207ffb['fields'][_0xac21('0x3e')](_0x5ac23e);return parseTagParameter(_0xeddc9b[_0xac21('0x4b')]);})[_0xac21('0x4a')](function(_0x49dafb){_0x207ffb[_0xac21('0x4c')][_0xac21('0x3d')][_0xac21('0x3e')](_0x49dafb);return parseSearchFilter(_0xeddc9b[_0xac21('0x4d')]);})[_0xac21('0x4a')](function(_0x39b816){_0x207ffb[_0xac21('0x4d')]=_0x39b816;return _0x207ffb;});}function checkListsRestrictions(_0x4430bd,_0x49b8ff,_0x161611){var _0x1fc77f=squel['expr']();return Promise[_0xac21('0x49')]()[_0xac21('0x4a')](function(){if(_0x49b8ff[_0xac21('0x4')]&&_0x4430bd['role']===_0xac21('0x4e')&&!_0x161611){return _0x4430bd[_0xac21('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4e0226){if(_0x4e0226){if(_0x4e0226[_0xac21('0x26')]===0x0){_0x1fc77f[_0xac21('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0x1fc77f[_0xac21('0x3e')](_0xac21('0x50'),_['map'](_0x4e0226,'id'));}}})[_0xac21('0x4a')](function(){return _0x1fc77f;});}function buildContactsQuery(_0x117e49,_0x29b24f,_0x1dbaa1,_0x38e988,_0x53d777,_0x3e1451){if(_0x29b24f){_0x29b24f=_0x1dbaa1[_0xac21('0x51')];}_0x117e49=addFieldsToQuery(_0x117e49,_0x29b24f,_0x38e988,_0x3e1451,!![]);var _0x4cca38=squel[_0xac21('0x52')]();_0x4cca38=addFieldsToQuery(_0x4cca38,_0x29b24f,_0x38e988,_0x3e1451,![]);if(_0x38e988||_0x3e1451){_0x117e49=applyJoinClauses(_0x117e49,!![]);_0x117e49[_0xac21('0x53')]('c.id');if(_0x1dbaa1[_0xac21('0x54')]){_0x4cca38[_0xac21('0x54')](_0x1dbaa1[_0xac21('0x54')]);}if(_0x1dbaa1[_0xac21('0x55')]){_0x4cca38['offset'](_0x1dbaa1[_0xac21('0x55')]);}}else{_0x4cca38=applyJoinClauses(_0x4cca38,![]);_0x4cca38['group'](_0xac21('0x56'));if(_0x1dbaa1['limit']){_0x117e49[_0xac21('0x54')](_0x1dbaa1[_0xac21('0x54')]);}if(_0x1dbaa1[_0xac21('0x55')]){_0x117e49[_0xac21('0x55')](_0x1dbaa1[_0xac21('0x55')]);}}_0x4cca38[_0xac21('0x57')](_0x53d777);if(_0x1dbaa1['order']){_0x1dbaa1['order'][_0xac21('0x1e')](function(_0x297dd7){_0x117e49[_0xac21('0x58')]('c.'+_0x297dd7[0x0],_0x297dd7[0x1]==='DESC'?![]:!![]);_0x4cca38[_0xac21('0x58')](_0xac21('0x59')+_0x297dd7[0x0],_0x297dd7[0x1]==='DESC'?![]:!![]);});}_0x4cca38[_0xac21('0x8')](_0x117e49,_0xac21('0xb'));return _0x4cca38;}function getFilteredContacts(_0x1d647c){var _0x165441=[];return db[_0xac21('0x5a')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0xac21('0x4a')](function(_0x23b765){_0x165441=_[_0xac21('0x5b')](_0x23b765,'id');var _0x29465c={'type':db[_0xac21('0x5c')][_0xac21('0x5d')][_0xac21('0x5e')],'model':db[_0xac21('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xac21('0x60')][_0xac21('0x61')](_0x1d647c['toString'](),_0x29465c);})[_0xac21('0x4a')](function(_0x5b508f){_0x5b508f[_0xac21('0x1e')](function(_0x51b80d){if(_0x51b80d[_0xac21('0x1c')]){_0x51b80d[_0xac21('0x62')]=[];_0x51b80d[_0xac21('0x1c')][_0xac21('0x25')](',')[_0xac21('0x1e')](function(_0x510717){_0x51b80d[_0xac21('0x62')][_0xac21('0x1d')](_0x165441[_0x510717]);});}delete _0x51b80d[_0xac21('0x1c')];});return _0x5b508f;});}function countFilteredContacts(_0x51c088,_0x3f26aa){var _0x281900=_0x51c088[_0xac21('0x63')]();_0x281900['field']('COUNT(*)');_0x281900=applyJoinClauses(_0x281900,!![]);_0x51c088['group']('c.id');var _0x326960=utils[_0xac21('0x22')](_0x3f26aa);if(!_[_0xac21('0x64')](_0x326960)){_0x281900['where'](_0xac21('0x65'),_0x326960);}var _0x2373ab={'type':db['Sequelize']['QueryTypes'][_0xac21('0x5e')],'raw':!![]};return db[_0xac21('0x60')][_0xac21('0x61')](_0x281900['toString'](),_0x2373ab)['then'](function(_0x257169){return _0x257169[0x0]['COUNT(*)'];});}module[_0xac21('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5171=['../interaction/utils','../../mysqldb','role','agent','search','ListId','true','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','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?','parseSearch','conditions','find','name','dateOfBirth','fieldType','buildExpression','type','default','text','start','value','end','map','and','tags','User','user','clause','uc.UserId\x20=\x20?','skip','some','compact','Contact','forEach','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','TagIds','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs'];(function(_0x161c51,_0x2d6bb3){var _0x7c222d=function(_0x1dce53){while(--_0x1dce53){_0x161c51['push'](_0x161c51['shift']());}};_0x7c222d(++_0x2d6bb3);}(_0x5171,0x1a4));var _0x1517=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x5171[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x1517('0x0'));var squel=require(_0x1517('0x1'));var as=require(_0x1517('0x2'));var qs=require(_0x1517('0x3'));var utils=require(_0x1517('0x4'));var db=require(_0x1517('0x5'))['db'];function skipContactsQuery(_0x5cc5cb,_0x2bef31){var _0x24bd94=![];if(_0x5cc5cb[_0x1517('0x6')]===_0x1517('0x7')&&!_0x2bef31[_0x1517('0x8')]&&!_0x2bef31[_0x1517('0x9')]&&_0x2bef31['autocomplete']!==_0x1517('0xa')){_0x24bd94=!![];}return _0x24bd94;}function getContactsSubquery(){return squel['select']()['from'](_0x1517('0xb'),'c')['where'](_0x1517('0xc'));}function applyJoinClauses(_0x3f34e0,_0x462f9d){var _0x5464c8=_0x462f9d?'c':_0x1517('0xd');_0x3f34e0[_0x1517('0xe')](_0x1517('0xf'),'uc',_0x1517('0x10')+_0x5464c8+_0x1517('0x11'))['left_join']('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x5464c8+_0x1517('0x11'))[_0x1517('0xe')](_0x1517('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x3f34e0;}function addFieldsToQuery(_0x45c767,_0x1c3846,_0x1d2f86,_0x12dcc3,_0x4673){var _0x410bb9=_0x4673?'c':'subqry';if(!_0x1c3846){_0x1c3846=['id',_0x1517('0x13'),_0x1517('0x14'),'phone',_0x1517('0x15'),_0x1517('0x16'),'email',_0x1517('0x9'),_0x1517('0x17'),_0x1517('0x18'),_0x1517('0x19'),_0x1517('0x1a'),'TagIds'];}else if(!_0x1c3846[_0x1517('0x1b')]('id')){_0x1c3846[_0x1517('0x1c')]('id');}var _0x1a6607=_0x1d2f86&&_0x4673||!_0x1d2f86&&!_0x4673;if(_0x12dcc3){_0x1a6607=_0x12dcc3&&_0x4673||!_0x12dcc3&&!_0x4673;}_0x1c3846['forEach'](function(_0x59acc9){if(_0x59acc9==='TagIds'){if(_0x1a6607){_0x45c767[_0x1517('0x1d')](_0x1517('0x1e'),_0x59acc9);}else if(_0x1d2f86||_0x12dcc3){_0x45c767[_0x1517('0x1d')](_0x410bb9+'.'+_0x59acc9);}}else{_0x45c767['field'](_0x410bb9+'.'+_0x59acc9);}});return _0x45c767;}function getSqlClauses(){var _0x5bebf4={'default':squel[_0x1517('0x1f')](),'fields':squel[_0x1517('0x1f')](),'filter':squel[_0x1517('0x1f')](),'tags':{'clause':squel[_0x1517('0x1f')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5bebf4;}function parseTagParameter(_0x3a5beb){var _0x180923=squel[_0x1517('0x1f')]();if(_0x3a5beb){var _0x1ea2bb=utils[_0x1517('0x20')](_0x3a5beb);_0x1ea2bb['forEach'](function(_0x202adb){_0x180923['or'](_0x1517('0x21'),'%,'+_0x202adb+',%');});}return _0x180923;}function parseSearchFilter(_0x5bd057){var _0x1232b9=squel[_0x1517('0x1f')]();if(_0x5bd057){var _0x7bff05=_0x5bd057[_0x1517('0x22')]('\x5c','\x5c\x5c')[_0x1517('0x22')](/'/g,'\x27\x27');var _0x3f4b39=qs['escapeLIKESpecialChars'](_0x7bff05);if(_0x7bff05[_0x1517('0x23')]('\x20')[_0x1517('0x24')]>0x1){_0x1232b9['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1517('0x25')](_0x7bff05,!![]),null);}else{if(qs['isNumeric'](_0x7bff05)){_0x1232b9['or'](_0x1517('0x26'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x27'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x28'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x29'),_0x3f4b39+'%');}else if(qs[_0x1517('0x2a')](_0x7bff05)){_0x1232b9['or'](_0x1517('0x2b'),_0x3f4b39+'%');}else{_0x1232b9['or'](_0x1517('0x2c'),'%'+_0x3f4b39+'%');_0x1232b9['or']('c.lastName\x20LIKE\x20?','%'+_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x2b'),'%'+_0x3f4b39+'%');}}}return _0x1232b9;}function parseAdvancedSearchFilter(_0x582881,_0xdf99aa){var _0x280978=getSqlClauses();var _0x9ef275=as[_0x1517('0x2d')](_0x582881);var _0x5584ad=_0x9ef275['sqlOperator'];for(var _0x50e1b5=0x0;_0x50e1b5<_0x9ef275[_0x1517('0x2e')][_0x1517('0x24')];_0x50e1b5++){var _0x2e4309=_0x9ef275[_0x1517('0x2e')][_0x50e1b5];var _0x2b4c31='c';var _0x1f8cc7=_[_0x1517('0x2f')](_0xdf99aa,[_0x1517('0x30'),_0x2e4309[_0x1517('0x1d')]]);if(_0x1f8cc7){if(_0x2e4309['field']===_0x1517('0x31')||_0x1f8cc7[_0x1517('0x32')]==='datetime'){_0x2e4309['castTo']='DATE';}var _0x44ddcd=as[_0x1517('0x33')](_0x2b4c31,_0x1f8cc7[_0x1517('0x34')],_0x2e4309);_0x280978[_0x1517('0x35')][_0x5584ad](_0x44ddcd[_0x1517('0x36')],_0x44ddcd['value'][_0x1517('0x37')],_0x44ddcd[_0x1517('0x38')][_0x1517('0x39')]);}else{if(_0x2e4309[_0x1517('0x1d')]==='Tag'){var _0x6189f0=_0x2e4309[_0x1517('0x38')][_0x1517('0x23')](',')[_0x1517('0x3a')](function(_0x59e718){return Number(_0x59e718);});var _0x343ad5=parseTagParameter(_0x6189f0);_0x280978['tags']['clause'][_0x1517('0x3b')](_0x343ad5);_0x280978[_0x1517('0x3c')]['ids']=_0x6189f0;}else if(_0x2e4309[_0x1517('0x1d')]===_0x1517('0x3d')){_0x280978[_0x1517('0x3e')][_0x1517('0x3f')][_0x1517('0x3b')](_0x1517('0x40'),_0x2e4309[_0x1517('0x38')]);_0x280978[_0x1517('0x3e')][_0x1517('0x41')]=!![];}}}return _0x280978;}function parseModelFields(_0x5e9146,_0x14ce78){var _0x21f5a5=squel[_0x1517('0x1f')]();var _0x151d13=_(_0x5e9146)['keys']()[_0x1517('0x3a')](function(_0x14d5db){return _[_0x1517('0x42')](_0x14ce78,[_0x1517('0x30'),_0x14d5db])?_0x14d5db:undefined;})[_0x1517('0x43')]()[_0x1517('0x38')]();if(_0x5e9146['Contact']){_0x151d13[_0x1517('0x1c')](_0x1517('0x44'));}if(_0x5e9146[_0x1517('0x3d')]){_0x151d13[_0x1517('0x1c')](_0x1517('0x3d'));}if(_0x151d13[_0x1517('0x24')]>0x0){_0x151d13[_0x1517('0x45')](function(_0x30c867){if(_0x30c867===_0x1517('0x9')){_0x21f5a5[_0x1517('0x3b')](_0x1517('0x46'),[]['concat'](_0x5e9146[_0x30c867]));}else if(_0x30c867===_0x1517('0x44')){var _0x4e8ce8='%'+_0x5e9146[_0x30c867]+'%';_0x21f5a5['and'](_0x1517('0x47'),_0x4e8ce8);}else if(_0x30c867===_0x1517('0x3d')){_0x21f5a5[_0x1517('0x3b')]('uc.UserId\x20=\x20?',_0x5e9146[_0x30c867]);}else{_0x21f5a5['and']('c.'+_0x30c867+_0x1517('0x48'),_0x5e9146[_0x30c867]);}});}return _0x21f5a5;}function parseQueryParameters(_0x2ac577,_0x5199e0){var _0x2d97f0=getSqlClauses();return Promise[_0x1517('0x49')]()[_0x1517('0x4a')](function(){return parseModelFields(_0x2ac577,_0x5199e0);})[_0x1517('0x4a')](function(_0x385ba2){_0x2d97f0[_0x1517('0x4b')]['and'](_0x385ba2);return parseTagParameter(_0x2ac577['tag']);})[_0x1517('0x4a')](function(_0x4d81bc){_0x2d97f0['tags'][_0x1517('0x3f')][_0x1517('0x3b')](_0x4d81bc);return parseSearchFilter(_0x2ac577[_0x1517('0x4c')]);})['then'](function(_0x51de8f){_0x2d97f0[_0x1517('0x4c')]=_0x51de8f;return _0x2d97f0;});}function checkListsRestrictions(_0x1bce2d,_0x3d09ae,_0x1695b6){var _0x3a1f74=squel[_0x1517('0x1f')]();return Promise[_0x1517('0x49')]()['then'](function(){if(_0x3d09ae[_0x1517('0x8')]&&_0x1bce2d[_0x1517('0x6')]===_0x1517('0x7')&&!_0x1695b6){return _0x1bce2d[_0x1517('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x1517('0x4a')](function(_0x3bc4cf){if(_0x3bc4cf){if(_0x3bc4cf['length']===0x0){_0x3a1f74[_0x1517('0x3b')](_0x1517('0x4e'));}else{_0x3a1f74[_0x1517('0x3b')]('c.ListId\x20IN\x20?',_[_0x1517('0x3a')](_0x3bc4cf,'id'));}}})[_0x1517('0x4a')](function(){return _0x3a1f74;});}function buildContactsQuery(_0x1e3509,_0x39c1e7,_0x19a773,_0x2fffb1,_0x367316,_0x82af01){if(_0x39c1e7){_0x39c1e7=_0x19a773[_0x1517('0x4f')];}_0x1e3509=addFieldsToQuery(_0x1e3509,_0x39c1e7,_0x2fffb1,_0x82af01,!![]);var _0x189330=squel[_0x1517('0x50')]();_0x189330=addFieldsToQuery(_0x189330,_0x39c1e7,_0x2fffb1,_0x82af01,![]);if(_0x2fffb1||_0x82af01){_0x1e3509=applyJoinClauses(_0x1e3509,!![]);_0x1e3509[_0x1517('0x51')](_0x1517('0x52'));if(_0x19a773[_0x1517('0x53')]){_0x189330[_0x1517('0x53')](_0x19a773[_0x1517('0x53')]);}if(_0x19a773[_0x1517('0x54')]){_0x189330[_0x1517('0x54')](_0x19a773[_0x1517('0x54')]);}}else{_0x189330=applyJoinClauses(_0x189330,![]);_0x189330['group']('subqry.id');if(_0x19a773[_0x1517('0x53')]){_0x1e3509[_0x1517('0x53')](_0x19a773['limit']);}if(_0x19a773[_0x1517('0x54')]){_0x1e3509[_0x1517('0x54')](_0x19a773[_0x1517('0x54')]);}}_0x189330[_0x1517('0x55')](_0x367316);if(_0x19a773[_0x1517('0x56')]){_0x19a773[_0x1517('0x56')][_0x1517('0x45')](function(_0x38657c){_0x1e3509[_0x1517('0x56')]('c.'+_0x38657c[0x0],_0x38657c[0x1]===_0x1517('0x57')?![]:!![]);_0x189330[_0x1517('0x56')](_0x1517('0x58')+_0x38657c[0x0],_0x38657c[0x1]===_0x1517('0x57')?![]:!![]);});}_0x189330['from'](_0x1e3509,_0x1517('0xd'));return _0x189330;}function getFilteredContacts(_0x59aedf){var _0x5e2410=[];return db['Tag'][_0x1517('0x59')]({'attributes':['id','name',_0x1517('0x5a')],'raw':!![]})[_0x1517('0x4a')](function(_0x2c1ba0){_0x5e2410=_[_0x1517('0x5b')](_0x2c1ba0,'id');var _0x3f4fa0={'type':db['Sequelize'][_0x1517('0x5c')][_0x1517('0x5d')],'model':db[_0x1517('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1517('0x5f')][_0x1517('0x60')](_0x59aedf[_0x1517('0x61')](),_0x3f4fa0);})[_0x1517('0x4a')](function(_0x3fddd0){_0x3fddd0['forEach'](function(_0x210f23){if(_0x210f23[_0x1517('0x62')]){_0x210f23[_0x1517('0x63')]=[];_0x210f23[_0x1517('0x62')]['split'](',')[_0x1517('0x45')](function(_0x5d6659){_0x210f23[_0x1517('0x63')][_0x1517('0x1c')](_0x5e2410[_0x5d6659]);});}delete _0x210f23[_0x1517('0x62')];});return _0x3fddd0;});}function countFilteredContacts(_0x32a622,_0x42a290){var _0x568ee4=_0x32a622[_0x1517('0x64')]();_0x568ee4[_0x1517('0x1d')](_0x1517('0x65'));_0x568ee4=applyJoinClauses(_0x568ee4,!![]);_0x32a622[_0x1517('0x51')](_0x1517('0x52'));var _0x43ed55=utils[_0x1517('0x20')](_0x42a290);if(!_[_0x1517('0x66')](_0x43ed55)){_0x568ee4['where'](_0x1517('0x67'),_0x43ed55);}var _0x1f3c71={'type':db[_0x1517('0x68')]['QueryTypes'][_0x1517('0x5d')],'raw':!![]};return db[_0x1517('0x5f')]['query'](_0x568ee4[_0x1517('0x61')](),_0x1f3c71)['then'](function(_0xd3dd5a){return _0xd3dd5a[0x0]['COUNT(*)'];});}module[_0x1517('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ad39971..38d4847 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 _0x4886=['final','encryptString','secret','update','utf8','base64','decryptString','createDecipher','crypto','../../config/environment','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','close','unlink','decryptFile'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0x4886,0x1e4));var _0x6488=function(_0xeef6af,_0x3ce84c){_0xeef6af=_0xeef6af-0x0;var _0x3061d7=_0x4886[_0xeef6af];return _0x3061d7;};'use strict';var crypto=require(_0x6488('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x6488('0x1'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6488('0x2')],'algorithm':_0x6488('0x3')};const fileOptions={'algorithm':_0x6488('0x4')};if(config['encrypt']&&config[_0x6488('0x5')][_0x6488('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6488('0x6')]);if(isSupported){fileOptions[_0x6488('0x6')]=config[_0x6488('0x5')][_0x6488('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6488('0x7')](',\x20');logger[_0x6488('0x8')](config[_0x6488('0x5')][_0x6488('0x6')],_0x6488('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0xaea69f){return AES_SUPPORTED_RX[_0x6488('0xa')](_0xaea69f);}function getSupportedCiphers(){return crypto[_0x6488('0xb')]()[_0x6488('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x469c47){return getSupportedCiphers()[_0x6488('0xd')](_0x469c47)>-0x1;}function combineOptions(_0x2ca5c7){var _0x2934f0={};for(var _0x215a4a in fileOptions){if(fileOptions[_0x6488('0xe')](_0x215a4a)){_0x2934f0[_0x215a4a]=fileOptions[_0x215a4a];}}if(_0x2ca5c7){for(var _0x36c39 in _0x2ca5c7){if(_0x2ca5c7[_0x6488('0xe')](_0x36c39)){_0x2934f0[_0x36c39]=_0x2ca5c7[_0x36c39];}}}return _0x2934f0;}exports[_0x6488('0xf')]=function(_0x4cdf08,_0x3ae701,_0x167083,_0x45a16e){return new BPromise(function(_0x6b74b7,_0xae8859){_0x45a16e=combineOptions(_0x45a16e);var _0xaa0faf=new Buffer(_0x167083);var _0x597b48=fs[_0x6488('0x10')](_0x4cdf08);var _0x22d1e0=fs[_0x6488('0x11')](_0x3ae701);var _0x1fcaea=crypto[_0x6488('0x12')](_0x45a16e[_0x6488('0x6')],_0xaa0faf);_0x597b48['on'](_0x6488('0x13'),function(_0x4aa306){var _0x42575a=new Buffer(_0x1fcaea['update'](_0x4aa306),_0x6488('0x14'));_0x22d1e0[_0x6488('0x15')](_0x42575a);});_0x597b48['on'](_0x6488('0x16'),function(){try{var _0x1cede5=new Buffer(_0x1fcaea['final'](_0x6488('0x14')),'binary');_0x22d1e0[_0x6488('0x15')](_0x1cede5);_0x22d1e0[_0x6488('0x16')]();_0x22d1e0['on'](_0x6488('0x17'),function(){return _0x6b74b7(_0x3ae701);});}catch(_0x3e2d00){fs[_0x6488('0x18')](_0x3ae701);return _0xae8859(_0x3e2d00);}});});};exports[_0x6488('0x19')]=function(_0x1f58ad,_0x5d018c,_0x1f1b48,_0xa0223e){return new BPromise(function(_0x165b75,_0xf2bd43){_0xa0223e=combineOptions(_0xa0223e);var _0x400202=new Buffer(_0x1f1b48);var _0x5cf781=fs[_0x6488('0x10')](_0x1f58ad);var _0x3ac869=fs['createWriteStream'](_0x5d018c);var _0x37df9f=crypto['createDecipher'](_0xa0223e[_0x6488('0x6')],_0x400202);_0x5cf781['on']('data',function(_0x1cf74f){var _0x546d3c=new Buffer(_0x37df9f['update'](_0x1cf74f),_0x6488('0x14'));_0x3ac869[_0x6488('0x15')](_0x546d3c);});_0x5cf781['on'](_0x6488('0x16'),function(){try{var _0x1df87b=new Buffer(_0x37df9f[_0x6488('0x1a')](_0x6488('0x14')),_0x6488('0x14'));_0x3ac869['write'](_0x1df87b);_0x3ac869['end']();_0x3ac869['on'](_0x6488('0x17'),function(){return _0x165b75(_0x5d018c);});}catch(_0x3cf2f8){fs[_0x6488('0x18')](_0x5d018c);return _0xf2bd43(_0x3cf2f8);}});});};exports[_0x6488('0x1b')]=function(_0x5027c7,_0x119543,_0xe4c30){var _0x53eeb=_0xe4c30||stringOptions[_0x6488('0x6')];var _0x58eea5=_0x119543||stringOptions[_0x6488('0x1c')];var _0x36900b=crypto[_0x6488('0x12')](_0x53eeb,_0x58eea5);var _0x4a7d2e=_0x36900b[_0x6488('0x1d')](_0x5027c7,_0x6488('0x1e'),_0x6488('0x1f'));_0x4a7d2e+=_0x36900b[_0x6488('0x1a')](_0x6488('0x1f'));return _0x4a7d2e;};exports[_0x6488('0x20')]=function(_0x197220,_0x30fa71,_0x38e2a4){var _0x1148c3=_0x38e2a4||stringOptions[_0x6488('0x6')];var _0x446243=_0x30fa71||stringOptions[_0x6488('0x1c')];var _0x29af61=crypto[_0x6488('0x21')](_0x1148c3,_0x446243);var _0x26800f=_0x29af61[_0x6488('0x1d')](_0x197220,_0x6488('0x1f'),'utf8');_0x26800f+=_0x29af61['final']('utf8');return _0x26800f;}; \ No newline at end of file +var _0x7900=['binary','write','end','unlink','decryptFile','update','final','close','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','createReadStream','data'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x7900,0x6e));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x0790('0x0'));var fs=require('fs');var BPromise=require(_0x0790('0x1'));var _=require(_0x0790('0x2'));var config=require('../../config/environment');var logger=require(_0x0790('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0790('0x4')][_0x0790('0x5')],'algorithm':_0x0790('0x6')};const fileOptions={'algorithm':_0x0790('0x7')};if(config['encrypt']&&config[_0x0790('0x8')][_0x0790('0x9')]){var isSupported=isAlgorithmSupported(config[_0x0790('0x8')][_0x0790('0x9')]);if(isSupported){fileOptions[_0x0790('0x9')]=config[_0x0790('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0790('0xa')](',\x20');logger[_0x0790('0xb')](config[_0x0790('0x8')]['algorithm'],_0x0790('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x441b3e){return AES_SUPPORTED_RX['test'](_0x441b3e);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0790('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x3232c7){return getSupportedCiphers()[_0x0790('0xe')](_0x3232c7)>-0x1;}function combineOptions(_0x3e69c7){var _0x51af8e={};for(var _0x38403d in fileOptions){if(fileOptions[_0x0790('0xf')](_0x38403d)){_0x51af8e[_0x38403d]=fileOptions[_0x38403d];}}if(_0x3e69c7){for(var _0x1f9852 in _0x3e69c7){if(_0x3e69c7['hasOwnProperty'](_0x1f9852)){_0x51af8e[_0x1f9852]=_0x3e69c7[_0x1f9852];}}}return _0x51af8e;}exports['encryptFile']=function(_0x99bbc9,_0x499463,_0x4c581a,_0x169a6b){return new BPromise(function(_0x92f5ff,_0x51c57e){_0x169a6b=combineOptions(_0x169a6b);var _0x3d1e6a=new Buffer(_0x4c581a);var _0x339544=fs[_0x0790('0x10')](_0x99bbc9);var _0x26de10=fs['createWriteStream'](_0x499463);var _0x2e1c7f=crypto['createCipher'](_0x169a6b[_0x0790('0x9')],_0x3d1e6a);_0x339544['on'](_0x0790('0x11'),function(_0x12f54f){var _0x56f2ef=new Buffer(_0x2e1c7f['update'](_0x12f54f),_0x0790('0x12'));_0x26de10[_0x0790('0x13')](_0x56f2ef);});_0x339544['on'](_0x0790('0x14'),function(){try{var _0x11f235=new Buffer(_0x2e1c7f['final'](_0x0790('0x12')),_0x0790('0x12'));_0x26de10[_0x0790('0x13')](_0x11f235);_0x26de10[_0x0790('0x14')]();_0x26de10['on']('close',function(){return _0x92f5ff(_0x499463);});}catch(_0x1b9827){fs[_0x0790('0x15')](_0x499463);return _0x51c57e(_0x1b9827);}});});};exports[_0x0790('0x16')]=function(_0x1e61b3,_0x2525d4,_0x1c4d95,_0x3303bb){return new BPromise(function(_0x14d9b0,_0x524bc6){_0x3303bb=combineOptions(_0x3303bb);var _0x4518b0=new Buffer(_0x1c4d95);var _0x582f87=fs[_0x0790('0x10')](_0x1e61b3);var _0x3cfae2=fs['createWriteStream'](_0x2525d4);var _0xa67ae4=crypto['createDecipher'](_0x3303bb[_0x0790('0x9')],_0x4518b0);_0x582f87['on']('data',function(_0x3f276d){var _0x4ffa73=new Buffer(_0xa67ae4[_0x0790('0x17')](_0x3f276d),_0x0790('0x12'));_0x3cfae2[_0x0790('0x13')](_0x4ffa73);});_0x582f87['on'](_0x0790('0x14'),function(){try{var _0x126f13=new Buffer(_0xa67ae4[_0x0790('0x18')](_0x0790('0x12')),_0x0790('0x12'));_0x3cfae2[_0x0790('0x13')](_0x126f13);_0x3cfae2[_0x0790('0x14')]();_0x3cfae2['on'](_0x0790('0x19'),function(){return _0x14d9b0(_0x2525d4);});}catch(_0x387d49){fs['unlink'](_0x2525d4);return _0x524bc6(_0x387d49);}});});};exports[_0x0790('0x1a')]=function(_0x310676,_0x115b75,_0x5f1b37){var _0x104d2e=_0x5f1b37||stringOptions[_0x0790('0x9')];var _0x29c132=_0x115b75||stringOptions[_0x0790('0x1b')];var _0x1a73ad=crypto[_0x0790('0x1c')](_0x104d2e,_0x29c132);var _0x5be98a=_0x1a73ad[_0x0790('0x17')](_0x310676,_0x0790('0x1d'),_0x0790('0x1e'));_0x5be98a+=_0x1a73ad[_0x0790('0x18')]('base64');return _0x5be98a;};exports[_0x0790('0x1f')]=function(_0x2de836,_0x3b5d96,_0x3c2df1){var _0x56adce=_0x3c2df1||stringOptions[_0x0790('0x9')];var _0x4d7b09=_0x3b5d96||stringOptions[_0x0790('0x1b')];var _0x4548ae=crypto['createDecipher'](_0x56adce,_0x4d7b09);var _0x409807=_0x4548ae[_0x0790('0x17')](_0x2de836,_0x0790('0x1e'),_0x0790('0x1d'));_0x409807+=_0x4548ae[_0x0790('0x18')]('utf8');return _0x409807;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2f92a49..ea2a195 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 _0xbe89=['join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync'];(function(_0x4c3f13,_0x4c1782){var _0x74adc6=function(_0x7c96b1){while(--_0x7c96b1){_0x4c3f13['push'](_0x4c3f13['shift']());}};_0x74adc6(++_0x4c1782);}(_0xbe89,0x17e));var _0x9be8=function(_0x3ae107,_0x5804fa){_0x3ae107=_0x3ae107-0x0;var _0x3ecfad=_0xbe89[_0x3ae107];return _0x3ecfad;};'use strict';var util=require(_0x9be8('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9be8('0x1'));var zipdir=require(_0x9be8('0x2'));var rimraf=require(_0x9be8('0x3'));var db=require(_0x9be8('0x4'))['db'];var dbH=require(_0x9be8('0x4'))[_0x9be8('0x5')];var logger=require(_0x9be8('0x6'))(_0x9be8('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9be8('0x8')][0x2]);var QUERY=process[_0x9be8('0x8')][0x3];var PATH=process[_0x9be8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32ef68,_0x163a37){var _0x8ecde8={'status':_0x32ef68};var _0x5ecf91={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x163a37){_0x8ecde8[_0x9be8('0x9')]=_0x163a37;}return db[_0x9be8('0xa')][_0x9be8('0xb')](_0x8ecde8,_0x5ecf91);}function main(){var _0x125a7d=0x1388;var _0x5651cd;logger[_0x9be8('0xc')](util[_0x9be8('0xd')](_0x9be8('0xe'),EXTRACTED_REPORT_ID,_0x9be8('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9be8('0x10'),_0x9be8('0x11')]})[_0x9be8('0x12')](function(_0x54a8f1){if(_0x54a8f1){_0x5651cd=_0x54a8f1;_0x125a7d=_0x5651cd[_0x9be8('0x11')]||0x1388;}})[_0x9be8('0x12')](function(){return dbH[_0x9be8('0x13')][_0x9be8('0x14')](util[_0x9be8('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9be8('0x13')][_0x9be8('0x15')][_0x9be8('0x16')]});})[_0x9be8('0x12')](function(_0x2af6d0){if(!_0x2af6d0[0x0][_0x9be8('0x17')]){return analyticExtractedReport('Empty');}var _0x2c19f1=[];var _0x3c973d=0x0;if(_0x5651cd[_0x9be8('0x10')]){if(_0x2af6d0&&_0x2af6d0[_0x9be8('0x18')]){var _0x1f56fe=_['range'](_0x2af6d0[0x0][_0x9be8('0x17')]/_0x125a7d);var _0x463d92=Number[_0x9be8('0x19')](_0x2af6d0[0x0][_0x9be8('0x17')]/_0x125a7d)?_0x2af6d0[0x0]['num']%_0x125a7d:0x0;_0x1f56fe[_0x9be8('0x1a')](function(_0x1d27f4){if(_0x1d27f4>0x0){_0x3c973d+=_0x125a7d;}_0x2c19f1['push'](dbH[_0x9be8('0x13')]['query'](util[_0x9be8('0xd')](_0x9be8('0x1b'),QUERY,_0x125a7d,_0x3c973d),{'type':dbH[_0x9be8('0x13')]['QueryTypes'][_0x9be8('0x16')]}));});if(_0x463d92>0x0){_0x3c973d+=_0x125a7d;_0x2c19f1[_0x9be8('0x1c')](dbH['sequelize'][_0x9be8('0x14')](util[_0x9be8('0xd')](_0x9be8('0x1b'),QUERY,_0x463d92,_0x3c973d),{'type':dbH[_0x9be8('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x2c19f1[_0x9be8('0x1c')](dbH[_0x9be8('0x13')][_0x9be8('0x14')](QUERY,{'type':dbH[_0x9be8('0x13')]['QueryTypes'][_0x9be8('0x16')]}));}var _0x5855eb=path[_0x9be8('0x1d')](PATH);var _0x3b18fc=path[_0x9be8('0x1e')](PATH,'.csv');var _0x25313c=_0x5651cd[_0x9be8('0x10')]&&_0x2c19f1[_0x9be8('0x18')]>0x1;var _0x3dd322=[];if(!fs[_0x9be8('0x1f')](path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc))&&_0x25313c){fs[_0x9be8('0x21')](path['join'](_0x5855eb,_0x3b18fc));}return BPromise[_0x9be8('0x22')](_0x2c19f1,function(_0x3520b6){_0x3dd322[_0x9be8('0x1c')](_0x3520b6);})[_0x9be8('0x12')](function(){for(var _0x57647c=0x0;_0x57647c<_0x3dd322['length'];_0x57647c+=0x1){var _0x19478a;var _0x5af08e=_0x3dd322[_0x57647c];if(_0x25313c){_0x19478a=path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc,util[_0x9be8('0xd')](_0x9be8('0x23'),_0x3b18fc,_0x57647c,_0x9be8('0x24')));}else{_0x19478a=path[_0x9be8('0x20')](_0x5855eb,util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x9be8('0x24')));}fs[_0x9be8('0x26')](_0x19478a,csv(_0x5af08e));}})[_0x9be8('0x12')](function(){if(_0x25313c){return new Promise(function(_0x30124d){zipdir(path['join'](_0x5855eb,_0x3b18fc),{'saveTo':path[_0x9be8('0x20')](_0x5855eb,util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x9be8('0x27')))},function(_0x5cdbc6,_0x5358aa){rimraf(path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc),function(){});_0x30124d(_0x9be8('0x28'));});});}})[_0x9be8('0x12')](function(){logger[_0x9be8('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9be8('0xf')));return analyticExtractedReport(_0x9be8('0x29'),_0x25313c?util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x25313c?'zip':_0x9be8('0x24')):null);});})[_0x9be8('0x2a')](function(_0x45603d){logger[_0x9be8('0xc')](util[_0x9be8('0xd')](_0x9be8('0x2b'),EXTRACTED_REPORT_ID,_0x9be8('0xf')),util[_0x9be8('0x2c')](_0x45603d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x9be8('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x608e=['analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','find','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','split','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s.%s','csv','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','bluebird','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x608e,0x86));var _0xe608=function(_0x38d438,_0x5a2309){_0x38d438=_0x38d438-0x0;var _0x5af2b6=_0x608e[_0x38d438];return _0x5af2b6;};'use strict';var util=require(_0xe608('0x0'));var path=require(_0xe608('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xe608('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xe608('0x3'));var db=require(_0xe608('0x4'))['db'];var dbH=require('../../mysqldb')[_0xe608('0x5')];var logger=require(_0xe608('0x6'))(_0xe608('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xe608('0x8')][0x2]);var QUERY=process[_0xe608('0x8')][0x3];var PATH=process[_0xe608('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd711e3,_0x3e99f8){var _0x534539={'status':_0xd711e3};var _0x47a9f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e99f8){_0x534539[_0xe608('0x9')]=_0x3e99f8;}return db[_0xe608('0xa')]['update'](_0x534539,_0x47a9f1);}function main(){var _0x574611=0x1388;var _0x2add55;logger[_0xe608('0xb')](util[_0xe608('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe608('0xd')));return db['Setting'][_0xe608('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe608('0xf')]})['then'](function(_0x36d203){if(_0x36d203){_0x2add55=_0x36d203;_0x574611=_0x2add55['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xe608('0x10')](util[_0xe608('0xc')](_0xe608('0x11'),QUERY),{'type':dbH['sequelize'][_0xe608('0x12')][_0xe608('0x13')]});})[_0xe608('0x14')](function(_0x3959d4){if(!_0x3959d4[0x0]['num']){return analyticExtractedReport('Empty');}var _0x607cb6=[];var _0x2e4ad9=0x0;if(_0x2add55[_0xe608('0x15')]){if(_0x3959d4&&_0x3959d4[_0xe608('0x16')]){var _0xe39089=_[_0xe608('0x17')](_0x3959d4[0x0][_0xe608('0x18')]/_0x574611);var _0x136738=Number[_0xe608('0x19')](_0x3959d4[0x0]['num']/_0x574611)?_0x3959d4[0x0][_0xe608('0x18')]%_0x574611:0x0;_0xe39089[_0xe608('0x1a')](function(_0x3d137d){if(_0x3d137d>0x0){_0x2e4ad9+=_0x574611;}_0x607cb6[_0xe608('0x1b')](dbH['sequelize'][_0xe608('0x10')](util['format'](_0xe608('0x1c'),QUERY,_0x574611,_0x2e4ad9),{'type':dbH['sequelize'][_0xe608('0x12')][_0xe608('0x13')]}));});if(_0x136738>0x0){_0x2e4ad9+=_0x574611;_0x607cb6[_0xe608('0x1b')](dbH[_0xe608('0x1d')][_0xe608('0x10')](util[_0xe608('0xc')](_0xe608('0x1c'),QUERY,_0x136738,_0x2e4ad9),{'type':dbH[_0xe608('0x1d')]['QueryTypes'][_0xe608('0x13')]}));}}}else{_0x607cb6[_0xe608('0x1b')](dbH[_0xe608('0x1d')][_0xe608('0x10')](QUERY,{'type':dbH[_0xe608('0x1d')][_0xe608('0x12')]['SELECT']}));}var _0x651c06=path[_0xe608('0x1e')](PATH);var _0x1fcacf=path[_0xe608('0x1f')](PATH,_0xe608('0x20'));var _0x4ddba4=_0x2add55[_0xe608('0x15')]&&_0x607cb6[_0xe608('0x16')]>0x1;var _0xf319ef=[];if(!fs[_0xe608('0x21')](path['join'](_0x651c06,_0x1fcacf))&&_0x4ddba4){fs[_0xe608('0x22')](path[_0xe608('0x23')](_0x651c06,_0x1fcacf));}return BPromise[_0xe608('0x24')](_0x607cb6,function(_0x9f83){_0xf319ef[_0xe608('0x1b')](_0x9f83);})['then'](function(){for(var _0x37b007=0x0;_0x37b007<_0xf319ef[_0xe608('0x16')];_0x37b007+=0x1){var _0x474ff4;var _0x49639c=_0xf319ef[_0x37b007];if(_0x4ddba4){_0x474ff4=path[_0xe608('0x23')](_0x651c06,_0x1fcacf,util[_0xe608('0xc')]('%s%d.%s',_0x1fcacf,_0x37b007,'csv'));}else{_0x474ff4=path[_0xe608('0x23')](_0x651c06,util['format'](_0xe608('0x25'),_0x1fcacf,_0xe608('0x26')));}fs[_0xe608('0x27')](_0x474ff4,csv(_0x49639c));}})[_0xe608('0x14')](function(){if(_0x4ddba4){return new Promise(function(_0x52f206){zipdir(path[_0xe608('0x23')](_0x651c06,_0x1fcacf),{'saveTo':path['join'](_0x651c06,util[_0xe608('0xc')](_0xe608('0x25'),_0x1fcacf,_0xe608('0x28')))},function(_0x279b2f,_0x59c2d7){rimraf(path[_0xe608('0x23')](_0x651c06,_0x1fcacf),function(){});_0x52f206('zip\x20finished');});});}})[_0xe608('0x14')](function(){logger[_0xe608('0xb')](util[_0xe608('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe608('0xd')));return analyticExtractedReport('Completed',_0x4ddba4?util[_0xe608('0xc')]('%s.%s',_0x1fcacf,_0x4ddba4?_0xe608('0x28'):_0xe608('0x26')):null);});})[_0xe608('0x29')](function(_0xc6f1e5){logger[_0xe608('0xb')](util[_0xe608('0xc')](_0xe608('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0xe608('0x2b')](_0xc6f1e5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe608('0x2c'));})[_0xe608('0x2d')](function(){process[_0xe608('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index dde6c88..4e2e46c 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 _0x5e14=['zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','toString','value','fill','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','header','pageBreak','margin','landscape','\x20/\x20','footer','black','right','num','Setting','find','split','then','splitSizePdf','length','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','mkdirSync','join','each','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','path','catch','lodash','util','pdfmake/src/printer'];(function(_0x344e34,_0x27b9c8){var _0xdde948=function(_0x6b4afc){while(--_0x6b4afc){_0x344e34['push'](_0x344e34['shift']());}};_0xdde948(++_0x27b9c8);}(_0x5e14,0xb5));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var fs=require('fs');var util=require(_0x45e1('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x45e1('0x2'));var zipdir=require(_0x45e1('0x3'));var rimraf=require(_0x45e1('0x4'));var JSDOM=require(_0x45e1('0x5'))[_0x45e1('0x6')];var window=new JSDOM('')[_0x45e1('0x7')];var BPromise=require(_0x45e1('0x8'));var db=require(_0x45e1('0x9'))['db'];var dbH=require('../../mysqldb')[_0x45e1('0xa')];var logger=require('../../config/logger')(_0x45e1('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x45e1('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x45e1('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x45e1('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f4e5a,_0x325232){var _0x3c289e={'status':_0x3f4e5a};var _0x53f539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x325232){_0x3c289e[_0x45e1('0xe')]=_0x325232;}return db['AnalyticExtractedReport'][_0x45e1('0xf')](_0x3c289e,_0x53f539);}function getHeaders(_0x2cffab){return _[_0x45e1('0x10')](_0x2cffab,function(_0x5e35ab){return{'text':_0x5e35ab,'style':_0x45e1('0x11')};});}function getRows(_0x1af27c,_0x4e906f){return _[_0x45e1('0x10')](_0x4e906f,function(_0x2cf231){return _(_0x2cf231)['pick'](_0x1af27c)[_0x45e1('0x10')](function(_0x2ae5b9){return _0x2ae5b9?_[_0x45e1('0x12')](_0x2ae5b9):'';})[_0x45e1('0x13')]();});}function createTable(_0xe831f1,_0x312a09){var _0x1b2f84={'widths':_[_0x45e1('0x14')](Array(_0xe831f1['length']),0x91),'heights':function(_0xc19c24){return _0xc19c24===0x0?_0x45e1('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x37d55e=getHeaders(_0xe831f1);_0x1b2f84[_0x45e1('0x16')][_0x45e1('0x17')](_0x37d55e);var _0x5d07e6=getRows(_0xe831f1,_0x312a09);_0x1b2f84['body']=_0x1b2f84[_0x45e1('0x16')][_0x45e1('0x18')](_0x5d07e6);return _0x1b2f84;}function createTables(_0x198036){var _0x8eac6d=[];var _0x495b50=_[_0x45e1('0x19')](Object['keys'](_0x198036[0x0]),0x5);_0x495b50[_0x45e1('0x1a')](function(_0x4bfa19){_0x8eac6d[_0x45e1('0x17')](createTable(_0x4bfa19,_0x198036));});return _0x8eac6d;}function getPDFDocDefinition(_0x4d2b03){var _0x5ab24a=util['format'](_0x45e1('0x1b'),NAME,EXTRACTED_REPORT[_0x45e1('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x45e1('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x45e1('0x1d')](FORMAT));var _0x330702=[];for(var _0x4ab7fc=0x0;_0x4ab7fc<_0x4d2b03['length'];_0x4ab7fc++){var _0x1e3d4c=[];if(_0x4ab7fc===0x0){_0x1e3d4c[_0x45e1('0x17')]({'text':_0x5ab24a,'style':_0x45e1('0x1e')});}var _0xf54f3f={'table':_0x4d2b03[_0x4ab7fc]};if(_0x4ab7fc>0x0){_0xf54f3f[_0x45e1('0x1f')]='before';_0xf54f3f[_0x45e1('0x20')]=[0x0,0x46,0x0,0x0];}_0x1e3d4c[_0x45e1('0x17')](_0xf54f3f);_0x330702[_0x45e1('0x17')](_0x1e3d4c);}return{'pageSize':'A4','pageOrientation':_0x45e1('0x21'),'content':_0x330702,'footer':function(_0x578988,_0x470746){return{'text':_0x578988[_0x45e1('0x12')]()+_0x45e1('0x22')+_0x470746,'style':_0x45e1('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x45e1('0x24')},'footer':{'alignment':_0x45e1('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b3316){var _0x2a660b=0x1388;var _0x4954bf;if(!_0x5b3316[0x0][_0x45e1('0x26')]){return analyticExtractedReport('Empty');}return db[_0x45e1('0x27')][_0x45e1('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x45e1('0x29'),'splitSizePdf']})[_0x45e1('0x2a')](function(_0x10bdf2){if(_0x10bdf2){_0x4954bf=_0x10bdf2;_0x2a660b=_0x4954bf[_0x45e1('0x2b')]||0x3e8;}})[_0x45e1('0x2a')](function(){var _0x5698f8=[];var _0x3bc23b=0x0;if(_0x4954bf[_0x45e1('0x29')]){if(_0x5b3316&&_0x5b3316[_0x45e1('0x2c')]){var _0x2eb851=_['range'](_0x5b3316[0x0]['num']/_0x2a660b);var _0x5e37c5=Number[_0x45e1('0x2d')](_0x5b3316[0x0]['num']/_0x2a660b)?_0x5b3316[0x0]['num']%_0x2a660b:0x0;_0x2eb851['forEach'](function(_0xc22bc9){if(_0xc22bc9>0x0){_0x3bc23b+=_0x2a660b;}_0x5698f8[_0x45e1('0x17')](dbH[_0x45e1('0x2e')][_0x45e1('0x2f')](util[_0x45e1('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2a660b,_0x3bc23b),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));});if(_0x5e37c5>0x0){_0x3bc23b+=_0x2a660b;_0x5698f8[_0x45e1('0x17')](dbH[_0x45e1('0x2e')][_0x45e1('0x2f')](util[_0x45e1('0x1d')](_0x45e1('0x32'),QUERY,_0x5e37c5,_0x3bc23b),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));}}}else{_0x5698f8['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));}var _0x1f91ef=path['dirname'](PATH);var _0xfc8afa=path[_0x45e1('0x33')](PATH,_0x45e1('0x34'));var _0x3bb063=_0x4954bf[_0x45e1('0x29')]&&_0x5698f8[_0x45e1('0x2c')]>0x1;var _0x31ce40=[];if(!fs[_0x45e1('0x35')](path['join'](_0x1f91ef,_0xfc8afa))&&_0x3bb063){fs[_0x45e1('0x36')](path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa));}return BPromise[_0x45e1('0x38')](_0x5698f8,function(_0x41c901){_0x31ce40['push'](_0x41c901);})[_0x45e1('0x2a')](function(){var _0x4242ad=[];for(var _0x3926fa=0x0;_0x3926fa<_0x31ce40[_0x45e1('0x2c')];_0x3926fa+=0x1){var _0xdb9444=_0x31ce40[_0x3926fa];var _0x483d3f=createTables(_['flatten'](_0xdb9444));var _0x792143;var _0xbbcb48=getPDFDocDefinition(_0x483d3f);var _0x9d5be1=getPDFPrinter();var _0x13d630=_0x9d5be1[_0x45e1('0x39')](_0xbbcb48);if(_0x3bb063){_0x792143=path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa,util[_0x45e1('0x1d')]('%s%d.%s',_0xfc8afa,_0x3926fa,_0x45e1('0x3a')));}else{_0x792143=path['join'](_0x1f91ef,util[_0x45e1('0x1d')](_0x45e1('0x3b'),_0xfc8afa,_0x45e1('0x3a')));}_0x4242ad[_0x45e1('0x17')](writePDFDocument(_0x13d630,_0x792143));}return Promise[_0x45e1('0x3c')](_0x4242ad);})[_0x45e1('0x2a')](function(){if(_0x3bb063){return new Promise(function(_0x26140d){zipdir(path['join'](_0x1f91ef,_0xfc8afa),{'saveTo':path[_0x45e1('0x37')](_0x1f91ef,util['format'](_0x45e1('0x3b'),_0xfc8afa,_0x45e1('0x3d')))},function(){rimraf(path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa),function(){});_0x26140d(_0x45e1('0x3e'));});});}})[_0x45e1('0x2a')](function(){if(!_0x3bb063)return;rimraf(path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa),function(){});})[_0x45e1('0x2a')](function(){logger[_0x45e1('0x3f')](util['format'](_0x45e1('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x45e1('0x41'),_0x3bb063?util['format'](_0x45e1('0x3b'),_0xfc8afa,_0x3bb063?_0x45e1('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x45e1('0x3f')](util[_0x45e1('0x1d')](_0x45e1('0x42'),EXTRACTED_REPORT_ID,_0x45e1('0x43')));return db[_0x45e1('0x44')][_0x45e1('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x9489e9){EXTRACTED_REPORT=_0x9489e9;return dbH[_0x45e1('0x2e')]['query'](util['format'](_0x45e1('0x46'),QUERY),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]});})['then'](extractReport)['catch'](function(_0x5ac706){logger[_0x45e1('0x3f')](util[_0x45e1('0x1d')](_0x45e1('0x47'),EXTRACTED_REPORT_ID,_0x45e1('0x43')),util['inspect'](_0x5ac706,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x45e1('0x48'));})[_0x45e1('0x49')](function(){process[_0x45e1('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3999a8=new PdfPrinter({'Arial':{'normal':__dirname+_0x45e1('0x4b'),'bold':__dirname+_0x45e1('0x4c'),'italics':__dirname+_0x45e1('0x4d'),'bolditalics':__dirname+_0x45e1('0x4e')}});return _0x3999a8;}function getPDFDocDefinitionFromHTML(_0x243229,_0x1cd5f8){var _0x2f33c6=util[_0x45e1('0x1d')](_0x45e1('0x4f'),_0x1cd5f8[_0x45e1('0x50')],_0x1cd5f8[_0x45e1('0x51')]);var _0x1d3055=moment()[_0x45e1('0x1d')]('YYYY-MM-DD')[_0x45e1('0x12')]();var _0x406bb5=htmlToPdfmake(_0x243229,{'window':window,'tableAutoSize':!![]});return{'content':[_0x406bb5],'defaultStyle':{'font':_0x45e1('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x45e1('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x45e1('0x53')}},'header':function(){return[{'text':_0x45e1('0x54'),'style':_0x45e1('0x1e')}];},'footer':function(_0x4c48f7,_0x70201c){return[{'text':util[_0x45e1('0x1d')](_0x45e1('0x55'),_0x2f33c6,_0x4c48f7,_0x70201c,_0x1d3055),'style':_0x45e1('0x23')}];}};}function writePDFDocument(_0x51a00e,_0x28b9f9){return new Promise(function(_0x52bd71,_0x379107){var _0x142ca3=_0x51a00e['pipe'](fs[_0x45e1('0x56')](_0x28b9f9));_0x142ca3['on'](_0x45e1('0x57'),function(){_0x52bd71(_0x45e1('0x57'));});_0x142ca3['on'](_0x45e1('0x58'),function(_0x58a472){_0x379107(_0x58a472);});_0x51a00e[_0x45e1('0x59')]();});}exports['createPdfFromHTML']=function(_0xb5157e,_0x47f278){var _0x473eb6=getPDFPrinter();var _0x37c9bd=getPDFDocDefinitionFromHTML(_0xb5157e,_0x47f278);var _0x52289d=_0x473eb6[_0x45e1('0x39')](_0x37c9bd);return writePDFDocument(_0x52289d,_0x47f278[_0x45e1('0x5a')])[_0x45e1('0x5b')](function(_0x73206){throw _0x73206;});}; \ No newline at end of file +var _0x416c=['fill','length','body','chunk','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','before','margin','\x20/\x20','footer','black','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','html-to-pdfmake','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x416c,0x199));var _0xc416=function(_0x1d6e98,_0x589a34){_0x1d6e98=_0x1d6e98-0x0;var _0x126cca=_0x416c[_0x1d6e98];return _0x126cca;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xc416('0x0'));var moment=require('moment');var htmlToPdfmake=require(_0xc416('0x1'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xc416('0x2'))[_0xc416('0x3')];var window=new JSDOM('')[_0xc416('0x4')];var BPromise=require(_0xc416('0x5'));var db=require(_0xc416('0x6'))['db'];var dbH=require(_0xc416('0x6'))['dbH'];var logger=require('../../config/logger')(_0xc416('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xc416('0x8')][0x2]);var QUERY=process[_0xc416('0x8')][0x3];var PATH=process[_0xc416('0x8')][0x4];var NAME=process[_0xc416('0x8')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x534fa9,_0xe46134){var _0x253a5a={'status':_0x534fa9};var _0x58b031={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe46134){_0x253a5a[_0xc416('0x9')]=_0xe46134;}return db[_0xc416('0xa')][_0xc416('0xb')](_0x253a5a,_0x58b031);}function getHeaders(_0x2682e4){return _[_0xc416('0xc')](_0x2682e4,function(_0x1beead){return{'text':_0x1beead,'style':_0xc416('0xd')};});}function getRows(_0x168cc7,_0x568c20){return _[_0xc416('0xc')](_0x568c20,function(_0x3ecd77){return _(_0x3ecd77)['pick'](_0x168cc7)['map'](function(_0x18840f){return _0x18840f?_[_0xc416('0xe')](_0x18840f):'';})[_0xc416('0xf')]();});}function createTable(_0x9296c7,_0x2e9c4b){var _0x25d104={'widths':_[_0xc416('0x10')](Array(_0x9296c7[_0xc416('0x11')]),0x91),'heights':function(_0x33e3e0){return _0x33e3e0===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1cf5ab=getHeaders(_0x9296c7);_0x25d104[_0xc416('0x12')]['push'](_0x1cf5ab);var _0x2b582b=getRows(_0x9296c7,_0x2e9c4b);_0x25d104[_0xc416('0x12')]=_0x25d104[_0xc416('0x12')]['concat'](_0x2b582b);return _0x25d104;}function createTables(_0x2033f3){var _0x44d1fa=[];var _0x5e17f9=_[_0xc416('0x13')](Object['keys'](_0x2033f3[0x0]),0x5);_0x5e17f9[_0xc416('0x14')](function(_0xb6c1){_0x44d1fa[_0xc416('0x15')](createTable(_0xb6c1,_0x2033f3));});return _0x44d1fa;}function getPDFDocDefinition(_0x467c30){var _0x289789=util['format'](_0xc416('0x16'),NAME,EXTRACTED_REPORT[_0xc416('0x17')],moment(EXTRACTED_REPORT[_0xc416('0x18')])[_0xc416('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x25d27b=[];for(var _0xa8f46e=0x0;_0xa8f46e<_0x467c30[_0xc416('0x11')];_0xa8f46e++){var _0x3c0c52=[];if(_0xa8f46e===0x0){_0x3c0c52[_0xc416('0x15')]({'text':_0x289789,'style':'header'});}var _0x4efb07={'table':_0x467c30[_0xa8f46e]};if(_0xa8f46e>0x0){_0x4efb07['pageBreak']=_0xc416('0x1a');_0x4efb07[_0xc416('0x1b')]=[0x0,0x46,0x0,0x0];}_0x3c0c52[_0xc416('0x15')](_0x4efb07);_0x25d27b[_0xc416('0x15')](_0x3c0c52);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x25d27b,'footer':function(_0x3e5c1a,_0x58a217){return{'text':_0x3e5c1a[_0xc416('0xe')]()+_0xc416('0x1c')+_0x58a217,'style':_0xc416('0x1d')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc416('0x1e')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x450589){var _0x33f5d2=0x1388;var _0x23a238;if(!_0x450589[0x0]['num']){return analyticExtractedReport(_0xc416('0x1f'));}return db[_0xc416('0x20')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc416('0x21'),_0xc416('0x22')]})[_0xc416('0x23')](function(_0x4d3327){if(_0x4d3327){_0x23a238=_0x4d3327;_0x33f5d2=_0x23a238[_0xc416('0x22')]||0x3e8;}})[_0xc416('0x23')](function(){var _0x4318a5=[];var _0x4f5b32=0x0;if(_0x23a238['split']){if(_0x450589&&_0x450589['length']){var _0x37b209=_[_0xc416('0x24')](_0x450589[0x0][_0xc416('0x25')]/_0x33f5d2);var _0x2728c9=Number[_0xc416('0x26')](_0x450589[0x0][_0xc416('0x25')]/_0x33f5d2)?_0x450589[0x0][_0xc416('0x25')]%_0x33f5d2:0x0;_0x37b209[_0xc416('0x14')](function(_0x353d3e){if(_0x353d3e>0x0){_0x4f5b32+=_0x33f5d2;}_0x4318a5[_0xc416('0x15')](dbH[_0xc416('0x27')]['query'](util['format'](_0xc416('0x28'),QUERY,_0x33f5d2,_0x4f5b32),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));});if(_0x2728c9>0x0){_0x4f5b32+=_0x33f5d2;_0x4318a5[_0xc416('0x15')](dbH['sequelize'][_0xc416('0x2b')](util['format'](_0xc416('0x28'),QUERY,_0x2728c9,_0x4f5b32),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));}}}else{_0x4318a5[_0xc416('0x15')](dbH[_0xc416('0x27')][_0xc416('0x2b')](QUERY,{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));}var _0x5b85d5=path[_0xc416('0x2c')](PATH);var _0xbd6407=path[_0xc416('0x2d')](PATH,_0xc416('0x2e'));var _0xc7436b=_0x23a238[_0xc416('0x21')]&&_0x4318a5[_0xc416('0x11')]>0x1;var _0x1113be=[];if(!fs['existsSync'](path['join'](_0x5b85d5,_0xbd6407))&&_0xc7436b){fs[_0xc416('0x2f')](path[_0xc416('0x30')](_0x5b85d5,_0xbd6407));}return BPromise[_0xc416('0x31')](_0x4318a5,function(_0xe6c9e){_0x1113be['push'](_0xe6c9e);})[_0xc416('0x23')](function(){var _0x2f600e=[];for(var _0x36e542=0x0;_0x36e542<_0x1113be['length'];_0x36e542+=0x1){var _0x36c636=_0x1113be[_0x36e542];var _0x3e4222=createTables(_[_0xc416('0x32')](_0x36c636));var _0x317eef;var _0x1be4d5=getPDFDocDefinition(_0x3e4222);var _0x3e5589=getPDFPrinter();var _0x2507d3=_0x3e5589[_0xc416('0x33')](_0x1be4d5);if(_0xc7436b){_0x317eef=path[_0xc416('0x30')](_0x5b85d5,_0xbd6407,util['format'](_0xc416('0x34'),_0xbd6407,_0x36e542,'pdf'));}else{_0x317eef=path[_0xc416('0x30')](_0x5b85d5,util[_0xc416('0x19')](_0xc416('0x35'),_0xbd6407,_0xc416('0x36')));}_0x2f600e[_0xc416('0x15')](writePDFDocument(_0x2507d3,_0x317eef));}return Promise['all'](_0x2f600e);})['then'](function(){if(_0xc7436b){return new Promise(function(_0x5b66b9){zipdir(path['join'](_0x5b85d5,_0xbd6407),{'saveTo':path['join'](_0x5b85d5,util['format'](_0xc416('0x35'),_0xbd6407,_0xc416('0x37')))},function(){rimraf(path[_0xc416('0x30')](_0x5b85d5,_0xbd6407),function(){});_0x5b66b9(_0xc416('0x38'));});});}})['then'](function(){if(!_0xc7436b)return;rimraf(path['join'](_0x5b85d5,_0xbd6407),function(){});})['then'](function(){logger['info'](util[_0xc416('0x19')](_0xc416('0x39'),EXTRACTED_REPORT_ID,_0xc416('0x3a')));return analyticExtractedReport(_0xc416('0x3b'),_0xc7436b?util[_0xc416('0x19')](_0xc416('0x35'),_0xbd6407,_0xc7436b?_0xc416('0x37'):_0xc416('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc416('0x3c')](util[_0xc416('0x19')](_0xc416('0x3d'),EXTRACTED_REPORT_ID,_0xc416('0x3a')));return db[_0xc416('0xa')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x51c802){EXTRACTED_REPORT=_0x51c802;return dbH[_0xc416('0x27')][_0xc416('0x2b')](util[_0xc416('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]});})[_0xc416('0x23')](extractReport)[_0xc416('0x3e')](function(_0x54cea3){logger[_0xc416('0x3c')](util[_0xc416('0x19')](_0xc416('0x3f'),EXTRACTED_REPORT_ID,'PDF'),util[_0xc416('0x40')](_0x54cea3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc416('0x41'));})[_0xc416('0x42')](function(){process[_0xc416('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x401409=new PdfPrinter({'Arial':{'normal':__dirname+_0xc416('0x44'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xc416('0x45'),'bolditalics':__dirname+_0xc416('0x46')}});return _0x401409;}function getPDFDocDefinitionFromHTML(_0x50912d,_0x384d85){var _0x4d321e=util[_0xc416('0x19')](_0xc416('0x47'),_0x384d85[_0xc416('0x48')],_0x384d85[_0xc416('0x49')]);var _0x5cb996=moment()['format']('YYYY-MM-DD')['toString']();var _0x1129aa=htmlToPdfmake(_0x50912d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1129aa],'defaultStyle':{'font':_0xc416('0x4a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc416('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc416('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc416('0x4b')}},'header':function(){return[{'text':_0xc416('0x4c'),'style':_0xc416('0x4d')}];},'footer':function(_0x59ce36,_0x5a3c32){return[{'text':util[_0xc416('0x19')](_0xc416('0x4e'),_0x4d321e,_0x59ce36,_0x5a3c32,_0x5cb996),'style':_0xc416('0x1d')}];}};}function writePDFDocument(_0xf6d20a,_0x599e84){return new Promise(function(_0x52d2fb,_0x44bb4c){var _0x210873=_0xf6d20a[_0xc416('0x4f')](fs[_0xc416('0x50')](_0x599e84));_0x210873['on'](_0xc416('0x51'),function(){_0x52d2fb(_0xc416('0x51'));});_0x210873['on'](_0xc416('0x52'),function(_0x38f6c2){_0x44bb4c(_0x38f6c2);});_0xf6d20a[_0xc416('0x53')]();});}exports[_0xc416('0x54')]=function(_0x38e794,_0x4781b9){var _0x3fc5ad=getPDFPrinter();var _0x410a02=getPDFDocDefinitionFromHTML(_0x38e794,_0x4781b9);var _0x58ee7f=_0x3fc5ad['createPdfKitDocument'](_0x410a02);return writePDFDocument(_0x58ee7f,_0x4781b9['path'])[_0xc416('0x3e')](function(_0x38e9fa){throw _0x38e9fa;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 40181fd..d2ead92 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 _0x674a=['each','%s%d.%s','xlsx','%s.%s','binary','info','Completed','Failed','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','XLSX','Setting','find','then','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','length','range','num','isInteger','push','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync'];(function(_0x35ad84,_0x2a0067){var _0x50ea13=function(_0xc5dc88){while(--_0xc5dc88){_0x35ad84['push'](_0x35ad84['shift']());}};_0x50ea13(++_0x2a0067);}(_0x674a,0x111));var _0xa674=function(_0x2e740d,_0x531abe){_0x2e740d=_0x2e740d-0x0;var _0x2295e4=_0x674a[_0x2e740d];return _0x2295e4;};'use strict';var util=require(_0xa674('0x0'));var path=require('path');var _=require(_0xa674('0x1'));var fs=require('fs');var json2xls=require(_0xa674('0x2'));var BPromise=require(_0xa674('0x3'));var zipdir=require(_0xa674('0x4'));var rimraf=require(_0xa674('0x5'));var db=require(_0xa674('0x6'))['db'];var dbH=require(_0xa674('0x6'))['dbH'];var logger=require('../../config/logger')(_0xa674('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa674('0x8')][0x3];var PATH=process[_0xa674('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52a5c0,_0x318d05){var _0x5658ea={'status':_0x52a5c0};var _0x3fe5f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x318d05){_0x5658ea[_0xa674('0x9')]=_0x318d05;}return db[_0xa674('0xa')][_0xa674('0xb')](_0x5658ea,_0x3fe5f1);}function main(){var _0x4a33c8=0x1388;var _0x37b0c3;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa674('0xc')));return db[_0xa674('0xd')][_0xa674('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xa674('0xf')](function(_0x4a0833){if(_0x4a0833){_0x37b0c3=_0x4a0833;_0x4a33c8=_0x37b0c3[_0xa674('0x10')]||0x1388;}})[_0xa674('0xf')](function(){return dbH[_0xa674('0x11')]['query'](util['format'](_0xa674('0x12'),QUERY),{'type':dbH['sequelize'][_0xa674('0x13')][_0xa674('0x14')]});})[_0xa674('0xf')](function(_0x285723){if(!_0x285723[0x0]['num']){return analyticExtractedReport('Empty');}var _0x31ce02=[];var _0x11dfc0=0x0;if(_0x37b0c3[_0xa674('0x15')]){if(_0x285723&&_0x285723[_0xa674('0x16')]){var _0x33a679=_[_0xa674('0x17')](_0x285723[0x0][_0xa674('0x18')]/_0x4a33c8);var _0x53e243=Number[_0xa674('0x19')](_0x285723[0x0]['num']/_0x4a33c8)?_0x285723[0x0][_0xa674('0x18')]%_0x4a33c8:0x0;_0x33a679['forEach'](function(_0x1eb468){if(_0x1eb468>0x0){_0x11dfc0+=_0x4a33c8;}_0x31ce02[_0xa674('0x1a')](dbH[_0xa674('0x11')][_0xa674('0x1b')](util[_0xa674('0x1c')](_0xa674('0x1d'),QUERY,_0x4a33c8,_0x11dfc0),{'type':dbH[_0xa674('0x11')]['QueryTypes'][_0xa674('0x14')]}));});if(_0x53e243>0x0){_0x11dfc0+=_0x4a33c8;_0x31ce02[_0xa674('0x1a')](dbH[_0xa674('0x11')]['query'](util[_0xa674('0x1c')](_0xa674('0x1d'),QUERY,_0x53e243,_0x11dfc0),{'type':dbH[_0xa674('0x11')][_0xa674('0x13')][_0xa674('0x14')]}));}}}else{_0x31ce02['push'](dbH[_0xa674('0x11')][_0xa674('0x1b')](QUERY,{'type':dbH[_0xa674('0x11')]['QueryTypes'][_0xa674('0x14')]}));}var _0x12c486=path[_0xa674('0x1e')](PATH);var _0x241eee=path[_0xa674('0x1f')](PATH,_0xa674('0x20'));var _0x407c23=_0x37b0c3[_0xa674('0x15')]&&_0x31ce02[_0xa674('0x16')]>0x1;var _0x4b18d8=[];if(!fs['existsSync'](path[_0xa674('0x21')](_0x12c486,_0x241eee))&&_0x407c23){fs[_0xa674('0x22')](path[_0xa674('0x21')](_0x12c486,_0x241eee));}return BPromise[_0xa674('0x23')](_0x31ce02,function(_0xdbdcaa){_0x4b18d8['push'](_0xdbdcaa);})[_0xa674('0xf')](function(){for(var _0x4d6762=0x0;_0x4d6762<_0x4b18d8[_0xa674('0x16')];_0x4d6762+=0x1){var _0x4281c8;var _0x5f5f1=_0x4b18d8[_0x4d6762];if(_0x407c23){_0x4281c8=path[_0xa674('0x21')](_0x12c486,_0x241eee,util[_0xa674('0x1c')](_0xa674('0x24'),_0x241eee,_0x4d6762,_0xa674('0x25')));}else{_0x4281c8=path[_0xa674('0x21')](_0x12c486,util['format'](_0xa674('0x26'),_0x241eee,'xlsx'));}fs['writeFileSync'](_0x4281c8,json2xls(_0x5f5f1),_0xa674('0x27'));}})[_0xa674('0xf')](function(){if(_0x407c23){return new Promise(function(_0x223638){zipdir(path[_0xa674('0x21')](_0x12c486,_0x241eee),{'saveTo':path['join'](_0x12c486,util['format']('%s.%s',_0x241eee,'zip'))},function(_0x439e14,_0x271cc1){rimraf(path['join'](_0x12c486,_0x241eee),function(){});_0x223638('zip\x20finished');});});}})[_0xa674('0xf')](function(){logger[_0xa674('0x28')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa674('0xc')));return analyticExtractedReport(_0xa674('0x29'),_0x407c23?util[_0xa674('0x1c')](_0xa674('0x26'),_0x241eee,_0x407c23?'zip':'xlsx'):null);});})['catch'](function(_0x253c8a){logger[_0xa674('0x28')](util[_0xa674('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa674('0xc')),util['inspect'](_0x253c8a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa674('0x2a'));})['finally'](function(){process[_0xa674('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x93b5=['format','XLSX','find','split','then','splitSizeXlsx','sequelize','QueryTypes','SELECT','Empty','length','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','update','info'];(function(_0x2eec39,_0x24b14d){var _0x429715=function(_0x5def86){while(--_0x5def86){_0x2eec39['push'](_0x2eec39['shift']());}};_0x429715(++_0x24b14d);}(_0x93b5,0x178));var _0x593b=function(_0xb9121d,_0xd091ca){_0xb9121d=_0xb9121d-0x0;var _0x4d2fc4=_0x93b5[_0xb9121d];return _0x4d2fc4;};'use strict';var util=require(_0x593b('0x0'));var path=require(_0x593b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x593b('0x2'));var zipdir=require(_0x593b('0x3'));var rimraf=require(_0x593b('0x4'));var db=require(_0x593b('0x5'))['db'];var dbH=require('../../mysqldb')[_0x593b('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x593b('0x7')][0x2]);var QUERY=process[_0x593b('0x7')][0x3];var PATH=process[_0x593b('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x11f366,_0x1ba963){var _0x5dddbc={'status':_0x11f366};var _0x53dddf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ba963){_0x5dddbc[_0x593b('0x8')]=_0x1ba963;}return db['AnalyticExtractedReport'][_0x593b('0x9')](_0x5dddbc,_0x53dddf);}function main(){var _0xfeb441=0x1388;var _0x3b0162;logger[_0x593b('0xa')](util[_0x593b('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x593b('0xc')));return db['Setting'][_0x593b('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x593b('0xe'),'splitSizeXlsx']})[_0x593b('0xf')](function(_0x127148){if(_0x127148){_0x3b0162=_0x127148;_0xfeb441=_0x3b0162[_0x593b('0x10')]||0x1388;}})[_0x593b('0xf')](function(){return dbH[_0x593b('0x11')]['query'](util[_0x593b('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]});})[_0x593b('0xf')](function(_0x2d7631){if(!_0x2d7631[0x0]['num']){return analyticExtractedReport(_0x593b('0x14'));}var _0x16311e=[];var _0x4d9b9d=0x0;if(_0x3b0162[_0x593b('0xe')]){if(_0x2d7631&&_0x2d7631[_0x593b('0x15')]){var _0x388f1f=_['range'](_0x2d7631[0x0][_0x593b('0x16')]/_0xfeb441);var _0x280de5=Number[_0x593b('0x17')](_0x2d7631[0x0][_0x593b('0x16')]/_0xfeb441)?_0x2d7631[0x0][_0x593b('0x16')]%_0xfeb441:0x0;_0x388f1f['forEach'](function(_0x532f7e){if(_0x532f7e>0x0){_0x4d9b9d+=_0xfeb441;}_0x16311e[_0x593b('0x18')](dbH[_0x593b('0x11')][_0x593b('0x19')](util['format'](_0x593b('0x1a'),QUERY,_0xfeb441,_0x4d9b9d),{'type':dbH['sequelize'][_0x593b('0x12')]['SELECT']}));});if(_0x280de5>0x0){_0x4d9b9d+=_0xfeb441;_0x16311e[_0x593b('0x18')](dbH[_0x593b('0x11')][_0x593b('0x19')](util[_0x593b('0xb')](_0x593b('0x1a'),QUERY,_0x280de5,_0x4d9b9d),{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]}));}}}else{_0x16311e['push'](dbH[_0x593b('0x11')][_0x593b('0x19')](QUERY,{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]}));}var _0x55c813=path[_0x593b('0x1b')](PATH);var _0x3a34d2=path[_0x593b('0x1c')](PATH,_0x593b('0x1d'));var _0x4bb67b=_0x3b0162[_0x593b('0xe')]&&_0x16311e[_0x593b('0x15')]>0x1;var _0x189863=[];if(!fs['existsSync'](path[_0x593b('0x1e')](_0x55c813,_0x3a34d2))&&_0x4bb67b){fs[_0x593b('0x1f')](path[_0x593b('0x1e')](_0x55c813,_0x3a34d2));}return BPromise[_0x593b('0x20')](_0x16311e,function(_0x4f3917){_0x189863['push'](_0x4f3917);})[_0x593b('0xf')](function(){for(var _0x3341d1=0x0;_0x3341d1<_0x189863[_0x593b('0x15')];_0x3341d1+=0x1){var _0x781630;var _0x335d55=_0x189863[_0x3341d1];if(_0x4bb67b){_0x781630=path[_0x593b('0x1e')](_0x55c813,_0x3a34d2,util[_0x593b('0xb')]('%s%d.%s',_0x3a34d2,_0x3341d1,_0x593b('0x21')));}else{_0x781630=path['join'](_0x55c813,util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x593b('0x21')));}fs[_0x593b('0x23')](_0x781630,json2xls(_0x335d55),_0x593b('0x24'));}})[_0x593b('0xf')](function(){if(_0x4bb67b){return new Promise(function(_0x19b84b){zipdir(path['join'](_0x55c813,_0x3a34d2),{'saveTo':path['join'](_0x55c813,util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x593b('0x25')))},function(_0x4f73e4,_0x28b78a){rimraf(path['join'](_0x55c813,_0x3a34d2),function(){});_0x19b84b('zip\x20finished');});});}})[_0x593b('0xf')](function(){logger[_0x593b('0xa')](util[_0x593b('0xb')](_0x593b('0x26'),EXTRACTED_REPORT_ID,_0x593b('0xc')));return analyticExtractedReport(_0x593b('0x27'),_0x4bb67b?util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x4bb67b?_0x593b('0x25'):_0x593b('0x21')):null);});})[_0x593b('0x28')](function(_0x477ffc){logger[_0x593b('0xa')](util[_0x593b('0xb')](_0x593b('0x29'),EXTRACTED_REPORT_ID,_0x593b('0xc')),util[_0x593b('0x2a')](_0x477ffc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 209cc92..6775738 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 _0xcc59=['VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','Interval','then','intervals','findAll','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','push','Set','format','CDR(type)=%s','type','context','priority'];(function(_0x3e2b0f,_0x3bfb86){var _0x1bc6fb=function(_0x15d460){while(--_0x15d460){_0x3e2b0f['push'](_0x3e2b0f['shift']());}};_0x1bc6fb(++_0x3bfb86);}(_0xcc59,0x100));var _0x9cc5=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xcc59[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x9cc5('0x0'));var util=require(_0x9cc5('0x1'));function rewrite(_0x2effc1,_0x5acd4d){var _0x97e182=this;return _0x2effc1['models'][_0x9cc5('0x2')]['findAll']({'raw':!![]})[_0x9cc5('0x3')](function(_0x112f52){_0x97e182[_0x9cc5('0x4')]=_0x112f52;return _0x2effc1['models']['VoiceExtension'][_0x9cc5('0x5')]({'where':{'IntervalId':_0x5acd4d['IntervalId']},'raw':!![]});})[_0x9cc5('0x3')](function(_0x4f8b04){return _0x2effc1[_0x9cc5('0x6')][_0x9cc5('0x7')][_0x9cc5('0x5')]({'where':{'exten':{'$in':_[_0x9cc5('0x8')](_[_0x9cc5('0x9')](_0x4f8b04,_0x9cc5('0xa')))}},'order':[{'raw':_0x9cc5('0xb')}],'raw':!![]});})[_0x9cc5('0x3')](function(_0x27300f){var _0x476aa9=_[_0x9cc5('0xc')](_0x27300f,{'priority':'1'});var _0x419c1a=_[_0x9cc5('0xc')](_0x27300f,{'isApp':0x1});var _0xf4ae2e=_[_0x9cc5('0xd')](_0x419c1a,_0x9cc5('0xa'));var _0x1fe546=['queue','playback'];var _0x1cf362=[];var _0x208418=[];for(var _0x1d2beb in _0xf4ae2e){if(_0xf4ae2e[_0x9cc5('0xe')](_0x1d2beb)){_0x97e182['priority']=0x2;_0x97e182[_0x9cc5('0xf')]=[];_0x97e182[_0x9cc5('0x10')]=_['find'](_0x476aa9,{'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')]});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':util[_0x9cc5('0x13')](_0x9cc5('0x14'),_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});if(_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]===_0x9cc5('0x19')){_0x97e182[_0x9cc5('0xf')]['push']({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1a')+_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}else if(_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]===_0x9cc5('0x1b')){if(_0x97e182['extension']){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1c')+(_0x97e182['extension']['cutdigits']?'${EXTEN:'+_0x97e182[_0x9cc5('0x10')][_0x9cc5('0x1d')]+'}':_0x9cc5('0x1e')),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1a')+_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId'],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});var _0x598d75=_0x97e182['priority']++;_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x20')+(_0x598d75+0x2)+_0x9cc5('0x21')+(_0x598d75+0x1)+')','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x598d75,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});if(_0x97e182[_0x9cc5('0x10')]){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x97e182['extension'][_0x9cc5('0x1d')]?_0x9cc5('0x22')+_0x97e182['extension']['cutdigits']+'}':_0x9cc5('0x23'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x24')+_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});if(_0x97e182[_0x9cc5('0x10')]&&_0x97e182[_0x9cc5('0x10')][_0x9cc5('0xe')](_0x9cc5('0x25'))&&_0x97e182[_0x9cc5('0x10')][_0x9cc5('0x25')]!=='none'){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':'Set','appdata':_0x9cc5('0x26'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x97e182['extension'][_0x9cc5('0x25')]||'wav','context':_0xf4ae2e[_0x1d2beb][0x0]['context'],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}}_0x97e182[_0x9cc5('0xf')]['push']({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x27'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x97e182['extensions'][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});for(var _0x5e06fb=0x0,_0x38e58e=0x0;_0x5e06fb<_0xf4ae2e[_0x1d2beb]['length'];_0x5e06fb+=0x1,_0x38e58e=0x0){var _0x2014f3=_0xf4ae2e[_0x1d2beb][_0x5e06fb];if(_0x2014f3['type']){_0x2014f3[_0x9cc5('0x15')]=_0x2014f3['type'][_0x9cc5('0x28')]();}var _0x36feeb=[];var _0x483656=[];delete _0x2014f3['id'];delete _0x2014f3[_0x9cc5('0x29')];delete _0x2014f3[_0x9cc5('0x2a')];var _0x34fa2b=_0x2014f3[_0x9cc5('0x2b')]!==_0x9cc5('0x2c')?[_0x2014f3[_0x9cc5('0x2b')]]:_0x2014f3[_0x9cc5('0x2d')]?_[_0x9cc5('0x9')](_[_0x9cc5('0xc')](_0x97e182['intervals'],{'IntervalId':_0x2014f3[_0x9cc5('0x2d')]}),_0x9cc5('0x2b')):[];if(_0x2014f3[_0x9cc5('0xe')](_0x9cc5('0x2e'))){if(_0x2014f3[_0x9cc5('0x2e')]&&_0x2014f3[_0x9cc5('0x2e')]!=='--'){_0x36feeb['push']({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x2f')+_0x2014f3[_0x9cc5('0x2e')],'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}if(_0x2014f3[_0x9cc5('0x15')]===_0x9cc5('0x1b')&&_0x2014f3[_0x9cc5('0xe')]('callerID')){if(_0x2014f3[_0x9cc5('0x31')]){_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x32')+_0x2014f3['callerID']+')','context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3['VoiceExtensionId']});}else{_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3['type'],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x33'),'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3['exten'],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}if(_0x2014f3[_0x9cc5('0xe')](_0x9cc5('0x34'))){if(_0x1fe546['indexOf'](_0x2014f3[_0x9cc5('0x35')][_0x9cc5('0x28')]())>=0x0&&_0x2014f3[_0x9cc5('0x36')]!==_0x9cc5('0x37')){if(_0x2014f3[_0x9cc5('0x34')]){_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b['length']+_0x97e182['priority']+_0x38e58e++,'VoiceExtensionId':_0x2014f3['VoiceExtensionId']});_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x38'),'context':_0x2014f3['context'],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b['length']+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}else{_0x36feeb['push']({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x39'),'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182['priority']+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x3a'),'context':_0x2014f3['context'],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}}for(var _0x2015da=0x0;_0x2015da<_0x34fa2b[_0x9cc5('0x30')];_0x2015da+=0x1){var _0x3c587d=_0x97e182[_0x9cc5('0x17')]+_0x34fa2b[_0x9cc5('0x30')];var _0x3c8961=_0x2015da===_0x34fa2b['length']-0x1?_0x97e182[_0x9cc5('0x17')]+_0x36feeb['length']+_0x483656[_0x9cc5('0x30')]+0x2:_0x97e182[_0x9cc5('0x17')]+_0x2015da+0x1;_0x36feeb[_0x9cc5('0x3b')](_0x2015da,0x0,{'type':_0x2014f3[_0x9cc5('0x15')],'app':'GotoIfTime','appdata':_0x34fa2b[_0x2015da]+'?'+_0x2014f3[_0x9cc5('0x16')]+_0x9cc5('0x3c')+_0x3c587d+':'+_0x2014f3[_0x9cc5('0x16')]+_0x9cc5('0x3c')+_0x3c8961,'exten':_0x2014f3[_0x9cc5('0xa')],'context':_0x2014f3[_0x9cc5('0x16')],'priority':_0x97e182['priority']+_0x2015da,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}_0x2014f3[_0x9cc5('0x17')]=_0x36feeb[_0x9cc5('0x30')]?_[_0x9cc5('0x3d')](_0x36feeb)[_0x9cc5('0x17')]+0x1:_0x97e182['priority'];_0x97e182['priority']=(_0x483656[_0x9cc5('0x30')]?_['last'](_0x483656)[_0x9cc5('0x17')]:_0x2014f3[_0x9cc5('0x17')])+0x1;_0x97e182[_0x9cc5('0xf')]=_[_0x9cc5('0x3e')](_0x97e182[_0x9cc5('0xf')],_0x36feeb,[_0x2014f3],_0x483656);}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x3f'),'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'context':_0xf4ae2e[_0x1d2beb][0x0]['context'],'priority':_0x97e182[_0x9cc5('0x17')],'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x1cf362[_0x9cc5('0x11')](_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']);_0x208418=_[_0x9cc5('0x3e')](_0x208418,_0x97e182[_0x9cc5('0xf')]);}}return _0x2effc1[_0x9cc5('0x40')](function(_0x2402d9){return _0x2effc1[_0x9cc5('0x6')][_0x9cc5('0x7')][_0x9cc5('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1cf362}},'transaction':_0x2402d9})['then'](function(_0x33156b){return _0x2effc1['models'][_0x9cc5('0x7')][_0x9cc5('0x42')](_[_0x9cc5('0x43')](_0x208418,_0x9cc5('0x17')),{'transaction':_0x2402d9});});});})[_0x9cc5('0x44')](function(_0x6e02b9){console[_0x9cc5('0x45')](_0x6e02b9);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xde9e=['then','intervals','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','Set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','VoiceExtension','destroy','sortBy','error','rewrite','lodash','util','models','Interval','findAll'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xde9e,0xe2));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede9('0x0'));var util=require(_0xede9('0x1'));function rewrite(_0x1c819b,_0xcd01d){var _0x24ac4f=this;return _0x1c819b[_0xede9('0x2')][_0xede9('0x3')][_0xede9('0x4')]({'raw':!![]})[_0xede9('0x5')](function(_0x19ae72){_0x24ac4f[_0xede9('0x6')]=_0x19ae72;return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'IntervalId':_0xcd01d[_0xede9('0x7')]},'raw':!![]});})[_0xede9('0x5')](function(_0x3e03d7){return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'exten':{'$in':_[_0xede9('0x8')](_[_0xede9('0x9')](_0x3e03d7,_0xede9('0xa')))}},'order':[{'raw':_0xede9('0xb')}],'raw':!![]});})['then'](function(_0x41f3f8){var _0x5ada3=_[_0xede9('0xc')](_0x41f3f8,{'priority':'1'});var _0x5482f2=_[_0xede9('0xc')](_0x41f3f8,{'isApp':0x1});var _0x4fc681=_[_0xede9('0xd')](_0x5482f2,_0xede9('0xa'));var _0x27f277=[_0xede9('0xe'),_0xede9('0xf')];var _0x5688a6=[];var _0x198e4b=[];for(var _0xa231b1 in _0x4fc681){if(_0x4fc681[_0xede9('0x10')](_0xa231b1)){_0x24ac4f[_0xede9('0x11')]=0x2;_0x24ac4f[_0xede9('0x12')]=[];_0x24ac4f[_0xede9('0x13')]=_[_0xede9('0x14')](_0x5ada3,{'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':util[_0xede9('0x15')](_0xede9('0x16'),_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1a')){_0x24ac4f['extensions']['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':_0xede9('0x1b')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}else if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1c')){if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x1f')+(_0x24ac4f[_0xede9('0x13')]['cutdigits']?'${EXTEN:'+_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]+'}':_0xede9('0x21')),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':'CDR(routeid)='+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});var _0xab5c80=_0x24ac4f['priority']++;_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x23')+(_0xab5c80+0x2)+_0xede9('0x24')+(_0xab5c80+0x1)+')','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0xab5c80,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]?_0xede9('0x25')+_0x24ac4f[_0xede9('0x13')]['cutdigits']+'}':_0xede9('0x26'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x27')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]&&_0x24ac4f[_0xede9('0x13')]['hasOwnProperty'](_0xede9('0x28'))&&_0x24ac4f['extension'][_0xede9('0x28')]!==_0xede9('0x29')){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x2a'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2b')+_0x24ac4f[_0xede9('0x13')][_0xede9('0x28')]||_0xede9('0x2c'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2d'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2e'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});for(var _0xd4a0fb=0x0,_0x248aae=0x0;_0xd4a0fb<_0x4fc681[_0xa231b1][_0xede9('0x2f')];_0xd4a0fb+=0x1,_0x248aae=0x0){var _0x4bc4b9=_0x4fc681[_0xa231b1][_0xd4a0fb];if(_0x4bc4b9[_0xede9('0x17')]){_0x4bc4b9['type']=_0x4bc4b9['type'][_0xede9('0x30')]();}var _0x8e3a1a=[];var _0x3286f6=[];delete _0x4bc4b9['id'];delete _0x4bc4b9[_0xede9('0x31')];delete _0x4bc4b9[_0xede9('0x32')];var _0x3b370d=_0x4bc4b9[_0xede9('0x33')]!==_0xede9('0x34')?[_0x4bc4b9[_0xede9('0x33')]]:_0x4bc4b9[_0xede9('0x7')]?_[_0xede9('0x9')](_[_0xede9('0xc')](_0x24ac4f[_0xede9('0x6')],{'IntervalId':_0x4bc4b9[_0xede9('0x7')]}),_0xede9('0x33')):[];if(_0x4bc4b9['hasOwnProperty'](_0xede9('0x35'))){if(_0x4bc4b9[_0xede9('0x35')]&&_0x4bc4b9[_0xede9('0x35')]!=='--'){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x36')+_0x4bc4b9['tag'],'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}if(_0x4bc4b9[_0xede9('0x17')]===_0xede9('0x1c')&&_0x4bc4b9[_0xede9('0x10')](_0xede9('0x37'))){if(_0x4bc4b9[_0xede9('0x37')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':'ExecIf','appdata':_0xede9('0x38')+_0x4bc4b9['callerID']+')','context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d['length']+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}else{_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x39'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}}if(_0x4bc4b9[_0xede9('0x10')](_0xede9('0x3a'))){if(_0x27f277[_0xede9('0x3b')](_0x4bc4b9[_0xede9('0x3c')][_0xede9('0x30')]())>=0x0&&_0x4bc4b9[_0xede9('0x3d')]!==_0xede9('0x3e')){if(_0x4bc4b9[_0xede9('0x3a')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':_0xede9('0x3f'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x40'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}else{_0x8e3a1a['push']({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x41'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9['exten'],'priority':_0x3b370d['length']+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}}for(var _0x1bbfa4=0x0;_0x1bbfa4<_0x3b370d[_0xede9('0x2f')];_0x1bbfa4+=0x1){var _0x133d39=_0x24ac4f[_0xede9('0x11')]+_0x3b370d['length'];var _0xd8eb7f=_0x1bbfa4===_0x3b370d['length']-0x1?_0x24ac4f['priority']+_0x8e3a1a[_0xede9('0x2f')]+_0x3286f6[_0xede9('0x2f')]+0x2:_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4+0x1;_0x8e3a1a[_0xede9('0x42')](_0x1bbfa4,0x0,{'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x43'),'appdata':_0x3b370d[_0x1bbfa4]+'?'+_0x4bc4b9[_0xede9('0x18')]+',${EXTEN},'+_0x133d39+':'+_0x4bc4b9[_0xede9('0x18')]+_0xede9('0x44')+_0xd8eb7f,'exten':_0x4bc4b9[_0xede9('0xa')],'context':_0x4bc4b9[_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x4bc4b9[_0xede9('0x11')]=_0x8e3a1a[_0xede9('0x2f')]?_['last'](_0x8e3a1a)[_0xede9('0x11')]+0x1:_0x24ac4f[_0xede9('0x11')];_0x24ac4f[_0xede9('0x11')]=(_0x3286f6[_0xede9('0x2f')]?_[_0xede9('0x45')](_0x3286f6)[_0xede9('0x11')]:_0x4bc4b9[_0xede9('0x11')])+0x1;_0x24ac4f[_0xede9('0x12')]=_[_0xede9('0x46')](_0x24ac4f[_0xede9('0x12')],_0x8e3a1a,[_0x4bc4b9],_0x3286f6);}_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Hangup','exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')],'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x5688a6[_0xede9('0x1d')](_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']);_0x198e4b=_['concat'](_0x198e4b,_0x24ac4f[_0xede9('0x12')]);}}return _0x1c819b[_0xede9('0x47')](function(_0x49a5af){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')][_0xede9('0x49')]({'where':{'VoiceExtensionId':{'$in':_0x5688a6}},'transaction':_0x49a5af})[_0xede9('0x5')](function(_0x59ba43){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')]['bulkCreate'](_[_0xede9('0x4a')](_0x198e4b,_0xede9('0x11')),{'transaction':_0x49a5af});});});})['catch'](function(_0xb86b07){console[_0xede9('0x4b')](_0xb86b07);});}exports[_0xede9('0x4c')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a83ebce..a6f1ec7 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 _0x63dd=['email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','findAll','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x63dd,0x125));var _0xd63d=function(_0x5887f2,_0x23a73c){_0x5887f2=_0x5887f2-0x0;var _0x489c62=_0x63dd[_0x5887f2];return _0x489c62;};'use strict';var BPromise=require('bluebird');var util=require(_0xd63d('0x0'));var _=require(_0xd63d('0x1'));var fs=require('fs');var squel=require(_0xd63d('0x2'));var Papa=require(_0xd63d('0x3'));var Redis=require(_0xd63d('0x4'));var db=require(_0xd63d('0x5'))['db'];var config=require(_0xd63d('0x6'));var logger=require(_0xd63d('0x7'))(_0xd63d('0x8'));config[_0xd63d('0x9')]=_[_0xd63d('0xa')](config[_0xd63d('0x9')],{'host':_0xd63d('0xb'),'port':0x18eb});var socket=require(_0xd63d('0xc'))(new Redis(config['redis']));require(_0xd63d('0xd'))['register'](socket);try{if(!process[_0xd63d('0xe')][0x2]||process[_0xd63d('0xe')][0x2]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x2]===_0xd63d('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xd63d('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0xd63d('0xe')][0x3]===_0xd63d('0x10')||!process[_0xd63d('0xe')][0x4]||process[_0xd63d('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xd63d('0x10')){throw new Error(_0xd63d('0x11'));}var FIELDS=_[_0xd63d('0x12')](process[_0xd63d('0xe')][0x3][_0xd63d('0x13')](','),process['argv'][0x4][_0xd63d('0x13')](','));if(!process[_0xd63d('0xe')][0x5]||process[_0xd63d('0xe')][0x5]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x5]===_0xd63d('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xd63d('0xe')][0x5];var COMPANYID=process[_0xd63d('0xe')][0x6]&&process['argv'][0x6]!==_0xd63d('0xf')&&process['argv'][0x6]!==_0xd63d('0x10')?process[_0xd63d('0xe')][0x6]:null;var DUPLICATES=process[_0xd63d('0xe')][0x7]&&process[_0xd63d('0xe')][0x7]!==_0xd63d('0xf')&&process[_0xd63d('0xe')][0x7]!=='null'?process[_0xd63d('0xe')][0x7]:null;if(!process[_0xd63d('0xe')][0x8]||process[_0xd63d('0xe')][0x8]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4a1bbd){logger[_0xd63d('0x14')](_0x4a1bbd);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(_0x5d7856,_0x59aa36,_0x1e157c,_0x58a6eb){var _0x2b02c9={'message':_0x59aa36};_0x2b02c9[_0x5d7856]=!![];if(_0x1e157c){_0x2b02c9[_0xd63d('0x15')]=_0x1e157c;}if(_0x58a6eb){_0x2b02c9[_0xd63d('0x16')]=_0x58a6eb;}return _0x2b02c9;}function isEmail(_0x44f35f){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))*$/[_0xd63d('0x17')](_0x44f35f);}function checkRow(_0xbfa7f6,_0x4f7afe,_0x554783){return new BPromise(function(_0x2e098e,_0x52436b){if(_[_0xd63d('0x18')](_0xbfa7f6)){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x554783));}if(_0xbfa7f6[_0xd63d('0x19')]&&_0xbfa7f6['errors'][_0xd63d('0x1a')]){var _0x2173c3=_['map'](_0xbfa7f6[_0xd63d('0x19')],_0xd63d('0x1b'))[_0xd63d('0x1c')](';');return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0x2173c3,null,_0x554783));}var _0x400bf5={};for(var _0x2c06b2 in FIELDS){if(FIELDS[_0xd63d('0x1d')](_0x2c06b2)&&FIELDS[_0x2c06b2]){_0x400bf5[_0x2c06b2]=_0xbfa7f6[_0xd63d('0x1e')][0x0][FIELDS[_0x2c06b2]]||_0xbfa7f6['data'][0x0]['\ufeff'+FIELDS[_0x2c06b2]];}}if(!_0x400bf5['firstName']){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x1f'),null,_0x554783));}if(!_0x400bf5[_0xd63d('0x20')]){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x21'),null,_0x554783));}if(_0x400bf5[_0xd63d('0x22')]){var _0xb1ac30=moment(_0x400bf5[_0xd63d('0x22')],_0xd63d('0x23'));if(!_0xb1ac30[_0xd63d('0x24')]()){return _0x52436b(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x554783));}}if(_0x400bf5['email']){if(!isEmail(_0x400bf5[_0xd63d('0x25')])){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x26'),null,_0x554783));}}_0x400bf5['ListId']=LISTID;_0x400bf5[_0xd63d('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4f7afe){var _0x19b108={};for(var _0x2c0db6=0x0,_0xb80fb3=DUPLICATES[_0xd63d('0x1a')];_0x2c0db6<_0xb80fb3;_0x2c0db6+=0x1){_0x19b108[DUPLICATES[_0x2c0db6]]=_0x400bf5[DUPLICATES[_0x2c0db6]];}var _0x2ac3c9=_[_0xd63d('0x28')](_0x4f7afe,_0x19b108);if(_0x2ac3c9){return _0x52436b(handleCheckRowError(_0xd63d('0x29'),_0xd63d('0x2a'),_0x2ac3c9,_0x554783));}}return db[_0xd63d('0x2b')][_0xd63d('0x2c')](_0x400bf5,{'raw':!![],'hooks':![],'fields':_[_0xd63d('0x2d')](_0x400bf5)})[_0xd63d('0x2e')](function(_0x103ee6){if(DUPLICATES&&DUPLICATES[_0xd63d('0x1a')]&&_0x4f7afe){_0x4f7afe[_0xd63d('0x2f')](_['pick'](_0x400bf5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x103ee6['id'];return _0x2e098e();})[_0xd63d('0x30')](function(_0x1e10d0){return _0x52436b(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x1e10d0[_0xd63d('0x1b')]||JSON[_0xd63d('0x31')](_0x1e10d0)),null,_0x554783));});});}function checkHopper(){function _0x1ca6f2(){return function(_0x3c8141){logger[_0xd63d('0x14')](_0xd63d('0x32'),_0xd63d('0x33'),util[_0xd63d('0x34')](_0x3c8141,{'showHidden':![],'depth':null}));};}var _0x29c1d3=function(_0x3f2bec,_0x4d2b64){var _0x4fc8f5=squel[_0xd63d('0x35')]()[_0xd63d('0x36')](_0xd63d('0x37'))[_0xd63d('0x38')]([_0xd63d('0x20'),'scheduledAt',_0xd63d('0x39'),_0xd63d('0x3a'),_0x4d2b64,_0xd63d('0x3b'),_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field'](_0xd63d('0x20'),'phone')[_0xd63d('0x3e')](_0xd63d('0x3f'),'scheduledAt')[_0xd63d('0x3e')]('id','ContactId')[_0xd63d('0x3e')](LISTID[_0xd63d('0x40')](),_0xd63d('0x3a'))['field'](_0x3f2bec['id'][_0xd63d('0x40')](),_0x4d2b64)['field'](_0xd63d('0x3f'),_0xd63d('0x3b'))[_0xd63d('0x3e')](_0xd63d('0x3f'),'updatedAt')[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))['where'](_0xd63d('0x45'),LISTID[_0xd63d('0x40')]())[_0xd63d('0x43')](_0xd63d('0x46'))[_0xd63d('0x43')](_0xd63d('0x47'),squel['select']()[_0xd63d('0x3e')]('phone')[_0xd63d('0x41')]('cm_hopper')[_0xd63d('0x43')](_0x4d2b64+_0xd63d('0x48'),_0x3f2bec['id']['toString']())))[_0xd63d('0x40')]();return _0x4fc8f5;};var _0x155a0d=function(_0x47f034,_0x3c64a8){var _0x1af3e5=squel[_0xd63d('0x35')]()['into'](_0xd63d('0x37'))[_0xd63d('0x38')]([_0xd63d('0x20'),_0xd63d('0x49'),_0xd63d('0x39'),_0xd63d('0x3a'),_0x3c64a8,_0xd63d('0x3b'),_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field']('phone',_0xd63d('0x20'))['field'](_0xd63d('0x3f'),_0xd63d('0x49'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))['field'](LISTID[_0xd63d('0x40')](),'ListId')[_0xd63d('0x3e')](_0x47f034['id']['toString'](),_0x3c64a8)[_0xd63d('0x3e')](_0xd63d('0x3f'),'createdAt')[_0xd63d('0x3e')]('NOW()',_0xd63d('0x3c'))[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))[_0xd63d('0x43')](_0xd63d('0x45'),LISTID['toString']())[_0xd63d('0x43')](_0xd63d('0x4a'),squel[_0xd63d('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xd63d('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd63d('0x3d')]()[_0xd63d('0x3e')](_0xd63d('0x4c'))[_0xd63d('0x41')](_0xd63d('0x4d'))[_0xd63d('0x43')](_0x3c64a8+_0xd63d('0x48'),_0x47f034['id'][_0xd63d('0x40')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd63d('0x3d')]()[_0xd63d('0x3e')](_0xd63d('0x20'))[_0xd63d('0x41')](_0xd63d('0x37'))[_0xd63d('0x43')](_0x3c64a8+_0xd63d('0x48'),_0x47f034['id']['toString']())))[_0xd63d('0x40')]();return _0x1af3e5;};function _0x14f3cb(_0x518591,_0x87c0d1){var _0x39988d=squel[_0xd63d('0x35')]()[_0xd63d('0x36')]('cm_hopper')[_0xd63d('0x38')]([_0xd63d('0x20'),'scheduledAt',_0xd63d('0x39'),_0xd63d('0x3a'),_0x87c0d1,'createdAt',_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field']('phone',_0xd63d('0x20'))[_0xd63d('0x3e')](_0xd63d('0x3f'),_0xd63d('0x49'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))[_0xd63d('0x3e')](LISTID['toString'](),_0xd63d('0x3a'))[_0xd63d('0x3e')](_0x518591['id'][_0xd63d('0x40')](),_0x87c0d1)['field'](_0xd63d('0x3f'),_0xd63d('0x3b'))[_0xd63d('0x3e')](_0xd63d('0x3f'),_0xd63d('0x3c'))[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')]('deletedAt\x20IS\x20NULL')[_0xd63d('0x43')](_0xd63d('0x45'),LISTID['toString']())[_0xd63d('0x43')]('id\x20IN\x20?',squel[_0xd63d('0x4b')](hopperContacts))['where'](_0xd63d('0x46')))['toString']();return _0x39988d;}function _0x5eea32(_0x30e9a5,_0x4aca8a){var _0x3a9e49=squel[_0xd63d('0x35')]()[_0xd63d('0x36')]('cm_hopper_black')[_0xd63d('0x38')]([_0xd63d('0x20'),_0xd63d('0x39'),'ListId',_0x4aca8a,_0xd63d('0x3b'),_0xd63d('0x3c')],squel['select']()[_0xd63d('0x3e')](_0xd63d('0x20'),_0xd63d('0x20'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))[_0xd63d('0x3e')](LISTID['toString'](),'ListId')[_0xd63d('0x3e')](_0x30e9a5['id']['toString'](),_0x4aca8a)[_0xd63d('0x3e')](_0xd63d('0x3f'),'createdAt')[_0xd63d('0x3e')](_0xd63d('0x3f'),'updatedAt')['from'](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))[_0xd63d('0x43')](_0xd63d('0x45'),LISTID[_0xd63d('0x40')]())['where']('id\x20IN\x20?',squel[_0xd63d('0x4b')](hopperContacts))[_0xd63d('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xd63d('0x40')]();return _0x3a9e49;}return db[_0xd63d('0x4e')]['findAll']({'where':{'type':_0xd63d('0x4f')},'attributes':['id',_0xd63d('0x50')],'include':[{'model':db[_0xd63d('0x51')],'as':_0xd63d('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x168e71){var _0x34c298=[];if(_0x168e71){var _0x53b835;for(var _0x1357da=0x0,_0x1bbb17;_0x1357da<_0x168e71[_0xd63d('0x1a')];_0x1357da+=0x1){_0x1bbb17=_0x168e71[_0x1357da]['get']({'plain':!![]});switch(_0x1bbb17[_0xd63d('0x50')]){case _0xd63d('0x53'):_0x34c298[_0xd63d('0x2f')](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x155a0d(_0x1bbb17,'VoiceQueueId'))['then'](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;case _0xd63d('0x56'):_0x34c298[_0xd63d('0x2f')](db[_0xd63d('0x54')]['query'](_0x29c1d3(_0x1bbb17,_0xd63d('0x57')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;default:_0x34c298[_0xd63d('0x2f')](db['sequelize'][_0xd63d('0x55')](_0x14f3cb(_0x1bbb17,_0xd63d('0x57')))['then'](function(){})[_0xd63d('0x30')](_0x1ca6f2()));}}}return _0x34c298;})[_0xd63d('0x58')]()[_0xd63d('0x2e')](function(){return db[_0xd63d('0x4e')][_0xd63d('0x59')]({'where':{'type':_0xd63d('0x4f')},'attributes':['id'],'include':[{'model':db[_0xd63d('0x51')],'as':_0xd63d('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x27bfc4){var _0x52dc51=[];if(_0x27bfc4){var _0x39af25;for(var _0x5a4284=0x0,_0x11e839;_0x5a4284<_0x27bfc4[_0xd63d('0x1a')];_0x5a4284+=0x1){_0x11e839=_0x27bfc4[_0x5a4284][_0xd63d('0x5b')]({'plain':!![]});_0x52dc51[_0xd63d('0x2f')](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x5eea32(_0x11e839,_0xd63d('0x57')))[_0xd63d('0x2e')](function(){})['catch'](_0x1ca6f2()));}}return _0x52dc51;})[_0xd63d('0x58')]();})[_0xd63d('0x2e')](function(){return db[_0xd63d('0x5c')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xd63d('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xd63d('0x2e')](function(_0x40ca67){var _0x1f8331=[];if(_0x40ca67){for(var _0x46a5f9=0x0,_0x3e52b1;_0x46a5f9<_0x40ca67[_0xd63d('0x1a')];_0x46a5f9+=0x1){_0x3e52b1=_0x40ca67[_0x46a5f9][_0xd63d('0x5b')]({'plain':!![]});switch(_0x3e52b1[_0xd63d('0x50')]){case _0xd63d('0x53'):_0x1f8331[_0xd63d('0x2f')](db[_0xd63d('0x54')]['query'](_0x155a0d(_0x3e52b1,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;case _0xd63d('0x56'):_0x1f8331[_0xd63d('0x2f')](db['sequelize']['query'](_0x29c1d3(_0x3e52b1,_0xd63d('0x5d')))['then'](function(){})['catch'](_0x1ca6f2()));break;default:_0x1f8331['push'](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x14f3cb(_0x3e52b1,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})['catch'](_0x1ca6f2()));}}}return _0x1f8331;})[_0xd63d('0x58')]();})[_0xd63d('0x2e')](function(){return db[_0xd63d('0x5c')][_0xd63d('0x59')]({'attributes':['id'],'include':[{'model':db[_0xd63d('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd63d('0x2e')](function(_0x3e8cd5){var _0x56610c=[];if(_0x3e8cd5){for(var _0x3335e4=0x0,_0x950b4a;_0x3335e4<_0x3e8cd5['length'];_0x3335e4+=0x1){_0x950b4a=_0x3e8cd5[_0x3335e4][_0xd63d('0x5b')]({'plain':!![]});_0x56610c['push'](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x5eea32(_0x950b4a,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));}}return _0x56610c;})[_0xd63d('0x58')]();})[_0xd63d('0x30')](function(_0x1eb87e){logger[_0xd63d('0x14')](_0xd63d('0x5e'),_0xd63d('0x5f'),_0x1eb87e[_0xd63d('0x1b')]);});}var processPromises=function(_0x2cf7e4){return BPromise['all'](promises)[_0xd63d('0x2e')](function(_0x53e5b8){})[_0xd63d('0x30')](function(_0x3c1004){logger[_0xd63d('0x14')](_0xd63d('0x60'),JSON[_0xd63d('0x31')](_0x3c1004));})[_0xd63d('0x61')](function(){socket[_0xd63d('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2cf7e4){return _0x2cf7e4[_0xd63d('0x63')]();}});};var endCsv=function(){return BPromise[_0xd63d('0x64')]()[_0xd63d('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd63d('0x62')](_0xd63d('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd63d('0x66')](FILEPATH);}catch(_0x227e56){logger[_0xd63d('0x14')](_0xd63d('0x67'),JSON[_0xd63d('0x31')](_0x227e56));}finally{process['exit'](0x0);}});};process['on'](_0xd63d('0x68'),function(){logger[_0xd63d('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xd63d('0x64')]()[_0xd63d('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd63d('0x13')](',');return db['CmContact'][_0xd63d('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd63d('0x2e')](function(_0x5180a5){var _0x526021=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd63d('0x6a')](_0x526021,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42ecff,_0x4bf08a){total+=0x1;var _0x673f83=total;promises[_0xd63d('0x2f')](checkRow(_0x42ecff,_0x5180a5,_0x673f83)['then'](function(){success+=0x1;})['catch'](function(_0x20b5ef){if(_0x20b5ef[_0xd63d('0x14')]){errors+=0x1;delete _0x20b5ef[_0xd63d('0x14')];}else if(_0x20b5ef[_0xd63d('0x29')]){duplicates+=0x1;delete _0x20b5ef[_0xd63d('0x29')];}rows[_0xd63d('0x2f')](_0x20b5ef);}));if(total%0xc8===0x0){_0x4bf08a[_0xd63d('0x6b')]();return processPromises(_0x4bf08a);}},'complete':function(){return processPromises()[_0xd63d('0x2e')](function(){logger[_0xd63d('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4329de,_0x4de20b){logger[_0xd63d('0x69')](_0xd63d('0x6c'),JSON[_0xd63d('0x31')](_0x4329de));endCsv();}});})[_0xd63d('0x30')](function(_0x519fc1){logger[_0xd63d('0x14')](_0xd63d('0x6d'),JSON[_0xd63d('0x31')](_0x519fc1));});}main(); \ No newline at end of file +var _0x24a6=['keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','scheduledAt','ContactId','select','field','NOW()','toString','createdAt','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','str','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','CmList','BlackLists','all','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','info','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create'];(function(_0x174715,_0x4e9e3a){var _0x591b6e=function(_0x1f2112){while(--_0x1f2112){_0x174715['push'](_0x174715['shift']());}};_0x591b6e(++_0x4e9e3a);}(_0x24a6,0x122));var _0x624a=function(_0x25b03e,_0xe5c5e5){_0x25b03e=_0x25b03e-0x0;var _0x1a9129=_0x24a6[_0x25b03e];return _0x1a9129;};'use strict';var BPromise=require(_0x624a('0x0'));var util=require(_0x624a('0x1'));var _=require(_0x624a('0x2'));var fs=require('fs');var squel=require(_0x624a('0x3'));var Papa=require(_0x624a('0x4'));var Redis=require(_0x624a('0x5'));var db=require(_0x624a('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x624a('0x7'))('api');config[_0x624a('0x8')]=_[_0x624a('0x9')](config[_0x624a('0x8')],{'host':_0x624a('0xa'),'port':0x18eb});var socket=require(_0x624a('0xb'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x624a('0xc')](socket);try{if(!process[_0x624a('0xd')][0x2]||process[_0x624a('0xd')][0x2]===_0x624a('0xe')||process[_0x624a('0xd')][0x2]===_0x624a('0xf')){throw new Error(_0x624a('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x624a('0xd')][0x3]||process[_0x624a('0xd')][0x3]==='undefined'||process[_0x624a('0xd')][0x3]===_0x624a('0xf')||!process[_0x624a('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x624a('0xd')][0x4]===_0x624a('0xf')){throw new Error(_0x624a('0x11'));}var FIELDS=_[_0x624a('0x12')](process[_0x624a('0xd')][0x3][_0x624a('0x13')](','),process[_0x624a('0xd')][0x4][_0x624a('0x13')](','));if(!process['argv'][0x5]||process[_0x624a('0xd')][0x5]===_0x624a('0xe')||process[_0x624a('0xd')][0x5]===_0x624a('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x624a('0xd')][0x6]&&process['argv'][0x6]!==_0x624a('0xe')&&process['argv'][0x6]!==_0x624a('0xf')?process[_0x624a('0xd')][0x6]:null;var DUPLICATES=process[_0x624a('0xd')][0x7]&&process[_0x624a('0xd')][0x7]!=='undefined'&&process[_0x624a('0xd')][0x7]!=='null'?process[_0x624a('0xd')][0x7]:null;if(!process[_0x624a('0xd')][0x8]||process[_0x624a('0xd')][0x8]===_0x624a('0xe')||process[_0x624a('0xd')][0x8]===_0x624a('0xf')){throw new Error(_0x624a('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2ef66b){logger[_0x624a('0x15')](_0x2ef66b);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(_0xdf5bbe,_0x234e25,_0x17e34b,_0x438bac){var _0x52a4e0={'message':_0x234e25};_0x52a4e0[_0xdf5bbe]=!![];if(_0x17e34b){_0x52a4e0[_0x624a('0x16')]=_0x17e34b;}if(_0x438bac){_0x52a4e0[_0x624a('0x17')]=_0x438bac;}return _0x52a4e0;}function isEmail(_0x1c6563){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))*$/[_0x624a('0x18')](_0x1c6563);}function checkRow(_0x25e2b5,_0x21f59b,_0x2b827c){return new BPromise(function(_0x4451fd,_0x2e3eeb){if(_[_0x624a('0x19')](_0x25e2b5)){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x1a'),null,_0x2b827c));}if(_0x25e2b5[_0x624a('0x1b')]&&_0x25e2b5['errors'][_0x624a('0x1c')]){var _0x1371e5=_[_0x624a('0x1d')](_0x25e2b5[_0x624a('0x1b')],_0x624a('0x1e'))[_0x624a('0x1f')](';');return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x1371e5,null,_0x2b827c));}var _0x3c52c8={};for(var _0x1a2660 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1a2660)&&FIELDS[_0x1a2660]){_0x3c52c8[_0x1a2660]=_0x25e2b5[_0x624a('0x20')][0x0][FIELDS[_0x1a2660]]||_0x25e2b5[_0x624a('0x20')][0x0]['\ufeff'+FIELDS[_0x1a2660]];}}if(!_0x3c52c8[_0x624a('0x21')]){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x22'),null,_0x2b827c));}if(!_0x3c52c8[_0x624a('0x23')]){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x24'),null,_0x2b827c));}if(_0x3c52c8[_0x624a('0x25')]){var _0xfd78b6=moment(_0x3c52c8[_0x624a('0x25')],_0x624a('0x26'));if(!_0xfd78b6[_0x624a('0x27')]()){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x28'),null,_0x2b827c));}}if(_0x3c52c8[_0x624a('0x29')]){if(!isEmail(_0x3c52c8[_0x624a('0x29')])){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x2a'),null,_0x2b827c));}}_0x3c52c8[_0x624a('0x2b')]=LISTID;_0x3c52c8[_0x624a('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x624a('0x1c')]&&_0x21f59b){var _0x259096={};for(var _0x124e6a=0x0,_0x57e166=DUPLICATES[_0x624a('0x1c')];_0x124e6a<_0x57e166;_0x124e6a+=0x1){_0x259096[DUPLICATES[_0x124e6a]]=_0x3c52c8[DUPLICATES[_0x124e6a]];}var _0x527fbc=_[_0x624a('0x2d')](_0x21f59b,_0x259096);if(_0x527fbc){return _0x2e3eeb(handleCheckRowError('duplicate',_0x624a('0x2e'),_0x527fbc,_0x2b827c));}}return db[_0x624a('0x2f')][_0x624a('0x30')](_0x3c52c8,{'raw':!![],'hooks':![],'fields':_[_0x624a('0x31')](_0x3c52c8)})[_0x624a('0x32')](function(_0x2ab1cf){if(DUPLICATES&&DUPLICATES[_0x624a('0x1c')]&&_0x21f59b){_0x21f59b['push'](_[_0x624a('0x33')](_0x3c52c8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2ab1cf['id'];return _0x4451fd();})[_0x624a('0x34')](function(_0x386c16){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x35')+(_0x386c16[_0x624a('0x1e')]||JSON[_0x624a('0x36')](_0x386c16)),null,_0x2b827c));});});}function checkHopper(){function _0x9df37(){return function(_0x111256){logger[_0x624a('0x15')]('cmContact',_0x624a('0x37'),util['inspect'](_0x111256,{'showHidden':![],'depth':null}));};}var _0x2e062d=function(_0x31ae7f,_0x1e991){var _0xd7168f=squel[_0x624a('0x38')]()[_0x624a('0x39')](_0x624a('0x3a'))['fromQuery'](['phone',_0x624a('0x3b'),_0x624a('0x3c'),_0x624a('0x2b'),_0x1e991,'createdAt','updatedAt'],squel[_0x624a('0x3d')]()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x3b'))[_0x624a('0x3e')]('id',_0x624a('0x3c'))[_0x624a('0x3e')](LISTID['toString'](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x31ae7f['id'][_0x624a('0x40')](),_0x1e991)[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x42'))[_0x624a('0x43')](_0x624a('0x44'))[_0x624a('0x45')](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID[_0x624a('0x40')]())[_0x624a('0x45')](_0x624a('0x48'))[_0x624a('0x45')](_0x624a('0x49'),squel[_0x624a('0x3d')]()[_0x624a('0x3e')](_0x624a('0x23'))[_0x624a('0x43')](_0x624a('0x3a'))[_0x624a('0x45')](_0x1e991+_0x624a('0x4a'),_0x31ae7f['id']['toString']())))[_0x624a('0x40')]();return _0xd7168f;};var _0x2c07bd=function(_0xb4b42,_0xbdccdc){var _0x1ef061=squel[_0x624a('0x38')]()['into']('cm_hopper')[_0x624a('0x4b')]([_0x624a('0x23'),_0x624a('0x3b'),'ContactId',_0x624a('0x2b'),_0xbdccdc,_0x624a('0x41'),'updatedAt'],squel[_0x624a('0x3d')]()[_0x624a('0x3e')]('phone','phone')[_0x624a('0x3e')](_0x624a('0x3f'),'scheduledAt')[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0xb4b42['id'][_0x624a('0x40')](),_0xbdccdc)[_0x624a('0x3e')]('NOW()',_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x42'))[_0x624a('0x43')](_0x624a('0x44'))[_0x624a('0x45')](_0x624a('0x46'))['where'](_0x624a('0x47'),LISTID[_0x624a('0x40')]())[_0x624a('0x45')]('id\x20IN\x20?',squel[_0x624a('0x4c')](hopperContacts))['where'](_0x624a('0x48'))[_0x624a('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x624a('0x3d')]()[_0x624a('0x3e')]('calleridnum')[_0x624a('0x43')](_0x624a('0x4d'))['where'](_0xbdccdc+_0x624a('0x4a'),_0xb4b42['id'][_0x624a('0x40')]()))[_0x624a('0x45')](_0x624a('0x49'),squel[_0x624a('0x3d')]()['field'](_0x624a('0x23'))[_0x624a('0x43')](_0x624a('0x3a'))[_0x624a('0x45')](_0xbdccdc+'\x20=\x20?',_0xb4b42['id'][_0x624a('0x40')]())))[_0x624a('0x40')]();return _0x1ef061;};function _0x1d3687(_0x8f3d45,_0xafcba4){var _0x5da0c3=squel[_0x624a('0x38')]()[_0x624a('0x39')]('cm_hopper')[_0x624a('0x4b')]([_0x624a('0x23'),_0x624a('0x3b'),_0x624a('0x3c'),'ListId',_0xafcba4,_0x624a('0x41'),_0x624a('0x42')],squel['select']()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')]('NOW()',_0x624a('0x3b'))[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x8f3d45['id'][_0x624a('0x40')](),_0xafcba4)[_0x624a('0x3e')](_0x624a('0x3f'),'createdAt')['field']('NOW()',_0x624a('0x42'))['from']('cm_contacts')['where'](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID['toString']())[_0x624a('0x45')](_0x624a('0x4e'),squel[_0x624a('0x4c')](hopperContacts))[_0x624a('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x624a('0x40')]();return _0x5da0c3;}function _0x4da107(_0x914401,_0x259438){var _0x2442a2=squel['insert']()[_0x624a('0x39')](_0x624a('0x4f'))[_0x624a('0x4b')]([_0x624a('0x23'),'ContactId',_0x624a('0x2b'),_0x259438,'createdAt',_0x624a('0x42')],squel['select']()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x914401['id']['toString'](),_0x259438)[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),'updatedAt')['from'](_0x624a('0x44'))['where'](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID[_0x624a('0x40')]())['where'](_0x624a('0x4e'),squel[_0x624a('0x4c')](hopperContacts))['where'](_0x624a('0x48')))[_0x624a('0x40')]();return _0x2442a2;}return db[_0x624a('0x50')][_0x624a('0x51')]({'where':{'type':_0x624a('0x52')},'attributes':['id',_0x624a('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x624a('0x32')](function(_0x5745c7){var _0x1d7755=[];if(_0x5745c7){var _0x10d939;for(var _0x5ac99f=0x0,_0x3d8cc0;_0x5ac99f<_0x5745c7['length'];_0x5ac99f+=0x1){_0x3d8cc0=_0x5745c7[_0x5ac99f][_0x624a('0x54')]({'plain':!![]});switch(_0x3d8cc0[_0x624a('0x53')]){case _0x624a('0x55'):_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2c07bd(_0x3d8cc0,_0x624a('0x59')))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));break;case _0x624a('0x5a'):_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2e062d(_0x3d8cc0,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));break;default:_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x1d3687(_0x3d8cc0,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}}return _0x1d7755;})['all']()[_0x624a('0x32')](function(){return db[_0x624a('0x50')][_0x624a('0x51')]({'where':{'type':_0x624a('0x52')},'attributes':['id'],'include':[{'model':db[_0x624a('0x5b')],'as':_0x624a('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x514d33){var _0x283db3=[];if(_0x514d33){var _0x313791;for(var _0x17c56e=0x0,_0x300b75;_0x17c56e<_0x514d33['length'];_0x17c56e+=0x1){_0x300b75=_0x514d33[_0x17c56e]['get']({'plain':!![]});_0x283db3[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x4da107(_0x300b75,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}return _0x283db3;})[_0x624a('0x5d')]();})[_0x624a('0x32')](function(){return db['Campaign'][_0x624a('0x51')]({'attributes':['id',_0x624a('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x50f6cd){var _0xe4bef2=[];if(_0x50f6cd){for(var _0x1f0755=0x0,_0x100207;_0x1f0755<_0x50f6cd[_0x624a('0x1c')];_0x1f0755+=0x1){_0x100207=_0x50f6cd[_0x1f0755][_0x624a('0x54')]({'plain':!![]});switch(_0x100207[_0x624a('0x53')]){case _0x624a('0x55'):_0xe4bef2['push'](db[_0x624a('0x57')]['query'](_0x2c07bd(_0x100207,_0x624a('0x5e')))['then'](function(){})['catch'](_0x9df37()));break;case _0x624a('0x5a'):_0xe4bef2[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2e062d(_0x100207,_0x624a('0x5e')))[_0x624a('0x32')](function(){})['catch'](_0x9df37()));break;default:_0xe4bef2[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x1d3687(_0x100207,'CampaignId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}}return _0xe4bef2;})[_0x624a('0x5d')]();})[_0x624a('0x32')](function(){return db[_0x624a('0x5f')][_0x624a('0x51')]({'attributes':['id'],'include':[{'model':db[_0x624a('0x5b')],'as':_0x624a('0x5c'),'where':{'id':LISTID}}]})[_0x624a('0x32')](function(_0x324294){var _0xd20af4=[];if(_0x324294){for(var _0xbf9158=0x0,_0x142224;_0xbf9158<_0x324294[_0x624a('0x1c')];_0xbf9158+=0x1){_0x142224=_0x324294[_0xbf9158][_0x624a('0x54')]({'plain':!![]});_0xd20af4['push'](db[_0x624a('0x57')][_0x624a('0x58')](_0x4da107(_0x142224,_0x624a('0x5e')))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}return _0xd20af4;})['all']();})[_0x624a('0x34')](function(_0x4b77dd){logger['error'](_0x624a('0x60'),'generalCheckHopper',_0x4b77dd[_0x624a('0x1e')]);});}var processPromises=function(_0x32396a){return BPromise[_0x624a('0x5d')](promises)[_0x624a('0x32')](function(_0x21d6c7){})[_0x624a('0x34')](function(_0x52ea7d){logger[_0x624a('0x15')](_0x624a('0x61'),JSON['stringify'](_0x52ea7d));})[_0x624a('0x62')](function(){socket[_0x624a('0x63')](_0x624a('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x32396a){return _0x32396a[_0x624a('0x65')]();}});};var endCsv=function(){return BPromise[_0x624a('0x66')]()[_0x624a('0x32')](function(){if(hopperContacts){return checkHopper();}})[_0x624a('0x32')](function(){socket['emit'](_0x624a('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x624a('0x67')](FILEPATH);}catch(_0x762a89){logger['error'](_0x624a('0x68'),JSON[_0x624a('0x36')](_0x762a89));}finally{process[_0x624a('0x69')](0x0);}});};process['on'](_0x624a('0x6a'),function(){logger['info'](_0x624a('0x6b'));endCsv();});function main(){return BPromise[_0x624a('0x66')]()[_0x624a('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x624a('0x2f')][_0x624a('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x624a('0x32')](function(_0x15db7b){var _0x5e6ca1=fs[_0x624a('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x624a('0x6d')](_0x5e6ca1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb140a7,_0xc99407){total+=0x1;var _0x3cef54=total;promises[_0x624a('0x56')](checkRow(_0xb140a7,_0x15db7b,_0x3cef54)[_0x624a('0x32')](function(){success+=0x1;})[_0x624a('0x34')](function(_0x6b9206){if(_0x6b9206[_0x624a('0x15')]){errors+=0x1;delete _0x6b9206['error'];}else if(_0x6b9206[_0x624a('0x6e')]){duplicates+=0x1;delete _0x6b9206[_0x624a('0x6e')];}rows[_0x624a('0x56')](_0x6b9206);}));if(total%0xc8===0x0){_0xc99407[_0x624a('0x6f')]();return processPromises(_0xc99407);}},'complete':function(){return processPromises()[_0x624a('0x32')](function(){logger[_0x624a('0x70')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x35f4ac,_0x57159b){logger[_0x624a('0x70')]('CSV\x20parse\x20error',JSON[_0x624a('0x36')](_0x35f4ac));endCsv();}});})[_0x624a('0x34')](function(_0x8461ed){logger[_0x624a('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x624a('0x36')](_0x8461ed));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 8a22d97..a0eeae4 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 _0x52ee=['campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','then','split','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','scheduledat','ListId','createdAt','updatedAt','priority','recallme','fields','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','fromQuery','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','\x22always\x22','ContactId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','message','exit','errors','code','info','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','error','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId'];(function(_0x433194,_0x44240a){var _0xc2fac4=function(_0x744f93){while(--_0x744f93){_0x433194['push'](_0x433194['shift']());}};_0xc2fac4(++_0x44240a);}(_0x52ee,0xc9));var _0xe52e=function(_0x1d8b9c,_0xc2cdd3){_0x1d8b9c=_0x1d8b9c-0x0;var _0x459bf4=_0x52ee[_0x1d8b9c];return _0x459bf4;};'use strict';var fs=require('fs');var path=require(_0xe52e('0x0'));var _=require(_0xe52e('0x1'));var Papa=require('papaparse');var util=require(_0xe52e('0x2'));var BPromise=require(_0xe52e('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xe52e('0x4'));var db=require(_0xe52e('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0xe52e('0x6'));var logger=require(_0xe52e('0x7'))('import');config['redis']=_[_0xe52e('0x8')](config[_0xe52e('0x9')],{'host':_0xe52e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe52e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xe52e('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xe52e('0xc')](_0xe52e('0xb'));function isEmail(_0x2a7b1c){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))*$/[_0xe52e('0xd')](_0x2a7b1c);}function selectNotIn(_0x427883,_0x489b82,_0x1ffa2f,_0x3f0ab4,_0x402a0a){return squel[_0xe52e('0xe')]()[_0xe52e('0xf')](_0xe52e('0x10'))[_0xe52e('0x11')](_0x3f0ab4)[_0xe52e('0x12')](_0x489b82,null,_0x489b82+_0xe52e('0x13')+_0x3f0ab4+'.'+_0x1ffa2f)['where'](_0x3f0ab4+'.'+_0x1ffa2f+_0xe52e('0x14')+_0x427883+'.'+_0x1ffa2f)[_0xe52e('0x15')](_0x489b82+_0xe52e('0x16')+_0x402a0a[_0xe52e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x29f6c6,_0x10f8ee){promisesAdditionalPhones=[];return db[_0xe52e('0x17')][_0xe52e('0x18')]({'raw':!![],'attributes':['id',_0xe52e('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x2adf72){if(_0x2adf72!==null){var _0x12074c=[];for(var _0x1a2450=0x0;_0x1a2450<_0x2adf72[_0xe52e('0x1a')];_0x1a2450++){var _0x2132a6=_0x2adf72[_0x1a2450];_0x12074c[_0xe52e('0x1b')](insertAdditionalPhones(_0x2132a6));}}Promise[_0xe52e('0x1c')](_0x12074c)[_0xe52e('0x1d')](function(){_0x29f6c6({'val':0x1});});});});}function insertAdditionalPhones(_0x5a45f0){return new Promise(function(_0x57ecc7,_0x44f61c){var _0x5da303=_0x5a45f0[_0xe52e('0x19')];var _0x3ad5cf=_0x5da303[_0xe52e('0x1e')](';');var _0x460376=[];orderBy=0x0;for(var _0x1a8c91=0x0;_0x1a8c91<_0x3ad5cf[_0xe52e('0x1a')];_0x1a8c91++){_0x460376['push'](splitAdditionalPhone(_0x5a45f0['id'],_0x3ad5cf[_0x1a8c91]));}Promise['all'](_0x460376)['then'](function(){_0x57ecc7({'val':_0x3ad5cf[_0xe52e('0x1a')]});});});}function splitAdditionalPhone(_0x1a46a6,_0x19fff2){return new Promise(function(_0x474337,_0x2bf555){var _0x13c1bf=_0x19fff2[_0xe52e('0x1e')](':');var _0x1eee6c=_0x13c1bf[0x0];var _0x1f95f7=_0x13c1bf[0x1];if(!_['isNil'](_0x1f95f7)){var _0x4054e9=_0x1f95f7[_0xe52e('0x1e')]('|');var _0x76764=[];for(var _0x543e9c=0x0;_0x543e9c<_0x4054e9['length'];_0x543e9c++){if(_0x4054e9[_0x543e9c]!==''){var _0x3f2af1=_[_0xe52e('0x1f')](promisesAdditionalPhones,{'contactId':_0x1a46a6,'phone':_0x4054e9[_0x543e9c]});if(_0x3f2af1[_0xe52e('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xe52e('0x1b')]({'contactId':_0x1a46a6,'contactTypeId':_0x1eee6c,'phone':_0x4054e9[_0x543e9c],'orderBy':orderBy});}}}_0x474337({'ok':0x1});}else _0x474337({'res':0x0});});}function createAdditionalPhone(_0x58b0d6,_0x34fd95,_0x3186b5,_0x1c2c0c){var _0x2bc091='';var _0x2621c9='';var _0x4b1808=_0x3186b5['split']('§');_0x2bc091=_0x4b1808[0x0];if(_0x4b1808[_0xe52e('0x1a')]==0x2)_0x2621c9=_0x4b1808[0x1];return new Promise(function(_0x55fe98,_0x442e58){return db[_0xe52e('0x20')]['findOne']({'where':{'CmContactId':_0x58b0d6,'item':_0x2bc091}})[_0xe52e('0x1d')](function(_0xba82d1){if(_0xba82d1){return db['CmContactHasItem']['update']({'ItemTypeId':_0x34fd95,'description':_0x2621c9,'OrderBy':_0x1c2c0c},{'where':{'CmContactId':_0x58b0d6,'item':_0x2bc091}})[_0xe52e('0x1d')](function(_0xe3b532){_0x55fe98({'res':_0xe52e('0x21')});});}else{return db[_0xe52e('0x20')][_0xe52e('0x22')]({'CmContactId':_0x58b0d6,'item':_0x2bc091,'description':_0x2621c9,'ItemTypeId':_0x34fd95,'OrderBy':_0x1c2c0c,'ItemClass':_0xe52e('0x23')})[_0xe52e('0x1d')](function(_0x434200){_0x55fe98({'res':_0xe52e('0x24')});});}});});}function insertCmHopper(_0x272e88,_0x1e7bf5,_0x1dace1,_0x44dd42,_0x4e1ab5){var _0x16f3b5=[_0xe52e('0x25'),_0xe52e('0x26'),_0xe52e('0x27'),'cm_contacts.ListId',_0x1e7bf5+'.'+_0x44dd42,_0xe52e('0x28'),_0xe52e('0x29'),_0xe52e('0x2a'),'cm_contacts.UserId','\x22'+_0x4e1ab5+'\x22'];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')]('cm_hopper')['fromQuery']([_0xe52e('0x10'),_0xe52e('0x2d'),'ContactId',_0xe52e('0x2e'),_0x44dd42,_0xe52e('0x2f'),_0xe52e('0x30'),_0xe52e('0x31'),'UserId',_0xe52e('0x32')],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x16f3b5)[_0xe52e('0x11')](_0x1e7bf5)[_0xe52e('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1e7bf5+_0xe52e('0x34'))[_0xe52e('0x12')](_0x1dace1,null,_0x1dace1+'.id\x20=\x20'+_0x1e7bf5+'.'+_0x44dd42)[_0xe52e('0x15')](_0x1e7bf5+'.CmListId\x20=\x20?',_0x272e88)['where'](_0xe52e('0x35'),NOW)[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x1e7bf5,_0x1dace1,_0x44dd42,_0xe52e('0x37'),['\x22always\x22',_0xe52e('0x38')]))[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x1e7bf5,_0x1dace1,_0x44dd42,'cm_hopper',['\x22always\x22'])))[_0xe52e('0x39')]();}function insertCmHopperBlack(_0x389a27,_0x3b6913,_0xf02811,_0x55d8ce){var _0x3d7f6a=[_0xe52e('0x25'),_0xe52e('0x27'),_0xe52e('0x3a'),_0x3b6913+'.'+_0x55d8ce,_0xe52e('0x28'),_0xe52e('0x29')];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x3b'))[_0xe52e('0x3c')]([_0xe52e('0x10'),'ContactId','ListId',_0x55d8ce,_0xe52e('0x2f'),_0xe52e('0x30')],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x3d7f6a)[_0xe52e('0x11')](_0x3b6913)[_0xe52e('0x12')](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x3b6913+_0xe52e('0x34'))['join'](_0xf02811,null,_0xf02811+'.id\x20=\x20'+_0x3b6913+'.'+_0x55d8ce)[_0xe52e('0x15')](_0x3b6913+_0xe52e('0x3f'),_0x389a27)[_0xe52e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe52e('0x15')](_0xe52e('0x36'),squel[_0xe52e('0xe')]()['field'](_0xe52e('0x10'))['from'](_0xe52e('0x3b'))[_0xe52e('0x15')]('ListId\x20=\x20?',_0x389a27)['where'](_0x55d8ce+_0xe52e('0x14')+_0x3b6913+'.'+_0x55d8ce)))[_0xe52e('0x39')]();}function insertTzCmHopper(_0x2331bf,_0x13e934,_0x29ebbf,_0x4220d6,_0x34f079,_0x26ed84){var _0x3addcd=['cm_contacts.phone',_0xe52e('0x40')+_0x26ed84+_0xe52e('0x41'),'cm_contacts.id',_0xe52e('0x3a'),_0x13e934+'.'+_0x4220d6,_0xe52e('0x28'),_0xe52e('0x29'),_0xe52e('0x2a'),'cm_contacts.UserId','\x22'+_0x34f079+'\x22'];var _0x4f2412=squel['insert']()[_0xe52e('0x2c')]('cm_hopper')['fromQuery']([_0xe52e('0x10'),'scheduledat','ContactId',_0xe52e('0x2e'),_0x4220d6,_0xe52e('0x2f'),_0xe52e('0x30'),_0xe52e('0x31'),'UserId',_0xe52e('0x32')],squel['select']()[_0xe52e('0x33')](_0x3addcd)[_0xe52e('0x11')](_0x13e934)[_0xe52e('0x12')](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x13e934+_0xe52e('0x34'))[_0xe52e('0x12')](_0x29ebbf,null,_0x29ebbf+_0xe52e('0x13')+_0x13e934+'.'+_0x4220d6)['join'](_0x26ed84,null,_0x26ed84+'.id\x20=\x20'+_0x13e934+'.'+_0x4220d6)[_0xe52e('0x15')](_0x13e934+_0xe52e('0x3f'),_0x2331bf)['where'](_0xe52e('0x35'),NOW)[_0xe52e('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x13e934,_0x29ebbf,_0x4220d6,'cm_hopper',[_0xe52e('0x42'),'\x22onlyIfOpen\x22']))[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x13e934,_0x29ebbf,_0x4220d6,'cm_hopper',[_0xe52e('0x42')])))[_0xe52e('0x39')]();return _0x4f2412;}function insertTzCmHopperBlack(_0x29c4d4,_0x3e82dd,_0x24376e,_0x374623){var _0x56fceb=[_0xe52e('0x25'),_0xe52e('0x27'),'cm_contacts.ListId',_0x3e82dd+'.'+_0x374623,_0xe52e('0x28'),_0xe52e('0x29')];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x3b'))[_0xe52e('0x3c')]([_0xe52e('0x10'),_0xe52e('0x43'),_0xe52e('0x2e'),_0x374623,_0xe52e('0x2f'),_0xe52e('0x30')],squel[_0xe52e('0xe')]()['fields'](_0x56fceb)['from'](_0x3e82dd)['join'](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x3e82dd+'.CmListId')[_0xe52e('0x12')](_0x24376e,null,_0x24376e+_0xe52e('0x13')+_0x3e82dd+'.'+_0x374623)[_0xe52e('0x15')](_0x3e82dd+_0xe52e('0x3f'),_0x29c4d4)[_0xe52e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe52e('0x15')](_0xe52e('0x36'),squel[_0xe52e('0xe')]()[_0xe52e('0xf')](_0xe52e('0x10'))[_0xe52e('0x11')](_0xe52e('0x3b'))[_0xe52e('0x15')](_0xe52e('0x44'),_0x29c4d4)['where'](_0x374623+_0xe52e('0x14')+_0x3e82dd+'.'+_0x374623)))[_0xe52e('0x39')]();}function insertCmHopperAdditionalPhones(_0x59577f){var _0x4b6467=[_0xe52e('0x45'),_0xe52e('0x46'),_0xe52e('0x47'),_0xe52e('0x48'),'cm_contact_has_items.updatedAt'];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x49'))[_0xe52e('0x3c')]([_0xe52e('0x4a'),_0xe52e('0x10'),_0xe52e('0x4b'),_0xe52e('0x2f'),'updatedAt'],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x4b6467)[_0xe52e('0x11')](_0xe52e('0x37'))[_0xe52e('0x12')](_0xe52e('0x3d'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xe52e('0x12')](_0xe52e('0x4c'),null,_0xe52e('0x4d'))[_0xe52e('0x15')](_0xe52e('0x4e'),_0x59577f)[_0xe52e('0x15')](_0xe52e('0x35'),NOW))[_0xe52e('0x39')]();}function insertCmContact(_0x59443a,_0x2b140b,_0x46a359,_0xd2f6a9){var _0x286bab=_[_0xe52e('0x4f')](_[_0xe52e('0x50')](_0xd2f6a9),[_0xe52e('0x2e'),_0xe52e('0x51'),'createdAt',_0xe52e('0x30'),_0xe52e('0x52')]);return squel[_0xe52e('0x2b')]()['into'](_0xe52e('0x3d'))['fromQuery'](_0x286bab,squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x286bab)[_0xe52e('0x11')](_0x2b140b)[_0xe52e('0x15')]('('+_0x46a359[_0xe52e('0x12')](',')+_0xe52e('0x53'),squel['select']()[_0xe52e('0x33')](_0x46a359)[_0xe52e('0x11')]('cm_contacts')[_0xe52e('0x15')](_0xe52e('0x44'),_0x59443a)[_0xe52e('0x15')](_0xe52e('0x54')))['where'](_0xe52e('0x55'),squel[_0xe52e('0xe')]()['field']('MIN(id)',_0xe52e('0x56'))[_0xe52e('0x11')](_0x2b140b)[_0xe52e('0x57')](_0x46a359[_0xe52e('0x12')](','))))[_0xe52e('0x39')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x26a1e5){logger['error'](_0x26a1e5[_0xe52e('0x58')]);process[_0xe52e('0x59')](0x1);}function handleError(_0x4e9d88,_0x26adf8){stats[_0xe52e('0x5a')][_0xe52e('0x1b')]({'name':_0x26adf8[_0xe52e('0x5b')],'message':_0x26adf8[_0xe52e('0x58')],'row':_0x4e9d88});}function handleQuery(_0xe84896){logger[_0xe52e('0x5c')](_0xe84896);return db['sequelize']['query'](_0xe84896)[_0xe52e('0x5d')](function(_0x1b47bb){results['push'](_0x1b47bb);})[_0xe52e('0x5e')](function(_0x5e70c6){logger['error'](_0x5e70c6[_0xe52e('0x58')]);});}function updateTzCampaigns(_0x54e8d4){return new Promise(function(_0x28802a,_0x40a89c){var _0x39ed93=squel[_0xe52e('0xe')]()[_0xe52e('0x33')]([_0xe52e('0x5f'),_0xe52e('0x60')])[_0xe52e('0x11')](_0xe52e('0x61'))['join'](_0xe52e('0x62'),null,_0xe52e('0x63'))['where'](_0xe52e('0x64')+_0x54e8d4);db[_0xe52e('0x65')][_0xe52e('0x66')](_0x39ed93[_0xe52e('0x39')]())[_0xe52e('0x5d')](function(_0x233ef6){var _0x50b514=[];for(var _0xbbd9f=0x0;_0xbbd9f<_0x233ef6[_0xe52e('0x1a')];_0xbbd9f++){_0x50b514[_0xe52e('0x1b')](getTimezoneData(_0x233ef6[_0xbbd9f],tmp_campaigns));}BPromise[_0xe52e('0x1c')](_0x50b514)['then'](function(){_0x28802a({'val':0x1});});})[_0xe52e('0x5e')](function(_0x5dddb9){logger['error'](_0x5dddb9['message']);_0x28802a({'val':0x0});});});}function updateTzVoiceQueues(_0x34761){return new Promise(function(_0x59ba62,_0x2ae7c8){var _0x328562=squel[_0xe52e('0xe')]()['fields']([_0xe52e('0x67'),'voice_queues.dialTimezone'])['from'](_0xe52e('0x68'))[_0xe52e('0x12')]('voice_queues_has_cm_lists',null,_0xe52e('0x69'))[_0xe52e('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x34761);db[_0xe52e('0x65')][_0xe52e('0x66')](_0x328562['toString']())[_0xe52e('0x5d')](function(_0x3e7e8f){var _0x1f3ab4=[];for(var _0x3af79b=0x0;_0x3af79b<_0x3e7e8f['length'];_0x3af79b++){_0x1f3ab4[_0xe52e('0x1b')](getTimezoneData(_0x3e7e8f[_0x3af79b],tmp_voice_queues));}BPromise[_0xe52e('0x1c')](_0x1f3ab4)['then'](function(){_0x59ba62({'val':0x1});});})[_0xe52e('0x5e')](function(_0x5a4e92){logger[_0xe52e('0x6a')](_0x5a4e92['message']);_0x59ba62({'val':0x0});});});}function getTimezoneData(_0x12d5d9,_0x406323){return new Promise(function(_0x471dd4,_0x42e299){var _0x364519=shared['timezones'];var _0x5f7d94=_0x364519[_0x12d5d9[_0xe52e('0x6b')]];if(_[_0xe52e('0x6c')](_0x5f7d94)){_0x471dd4({'ret':0x1});}else{var _0x1f4305=_0x5f7d94[_0xe52e('0x6d')];var _0x28f062=squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0x406323)['set']('id',_0x12d5d9['id'])[_0xe52e('0x6e')](_0xe52e('0x6f'),_0x1f4305)[_0xe52e('0x6e')](_0xe52e('0x6b'),_0x12d5d9['dialTimezone'])[_0xe52e('0x39')]();return db[_0xe52e('0x65')][_0xe52e('0x66')](_0x28f062)[_0xe52e('0x5d')](function(_0x2a8714){_0x471dd4({'ret':0x1});})['catch'](function(_0x3501c8){logger[_0xe52e('0x6a')](_0x3501c8[_0xe52e('0x58')]);_0x42e299({'ret':0x1});});}});}function handleTZQuery(_0x8c089f){logger[_0xe52e('0x5c')](_0x8c089f);return db[_0xe52e('0x65')][_0xe52e('0x66')](_0x8c089f)[_0xe52e('0x5d')](function(_0x109cc8){})[_0xe52e('0x5e')](function(_0x107d72){logger[_0xe52e('0x6a')](_0x107d72[_0xe52e('0x58')]);});}function main(_0x183a4f,_0x275678,_0x1a41eb,_0x297701){logger[_0xe52e('0x5c')](_0xe52e('0x70'),_0x183a4f,JSON[_0xe52e('0x71')](_0x275678));process['send'](_0xe52e('0x72'));var _0xede4dc=_0x275678['binding'];var _0x150af6=_[_0xe52e('0x73')](_0xede4dc);var _0x173288=_0x275678[_0xe52e('0x74')];var _0x64bd81=path[_0xe52e('0x12')](config[_0xe52e('0x75')],_0xe52e('0x76'),_0x173288+'.csv');hasTZ=_[_0xe52e('0x50')](_0xede4dc)['includes'](_0xe52e('0x6b'));var _0x1cabed=_['keys'](_0xede4dc)[_0xe52e('0x12')]();logger[_0xe52e('0x5c')]('header',_0x1cabed);db[_0xe52e('0x77')]['findAll']({'raw':!![],'attributes':['id',_0xe52e('0x78')]})[_0xe52e('0x1d')](function(_0x3a6e77){for(var _0x2ba3cb=0x0;_0x2ba3cb<_0x3a6e77['length'];_0x2ba3cb++){if(_0x3a6e77[_0x2ba3cb]['name']in _0xede4dc){contactItemTypes['push'](_0x3a6e77[_0x2ba3cb]);delete _0x150af6[_0x3a6e77[_0x2ba3cb][_0xe52e('0x78')]];hasAdditionalPhones=!![];}for(var _0xd35a92 in _0xede4dc){if(_0x3a6e77[_0x2ba3cb]['name']+'_description'===_0xd35a92){phoneDescriptions[_0xe52e('0x1b')]({'itemTypeId':_0x3a6e77[_0x2ba3cb]['id'],'description':_0xd35a92});delete _0x150af6[_0xd35a92];}}}if(hasAdditionalPhones)_0x150af6[_0xe52e('0x19')]='';var _0x490e36=_['keys'](_0x150af6)[_0xe52e('0x12')]();logger[_0xe52e('0x5c')]('header',_0x490e36);fs[_0xe52e('0x79')](_0x64bd81,_0x490e36+'\x0a');Papa[_0xe52e('0x7a')](fs[_0xe52e('0x7b')](_0x183a4f),{'header':!![],'skipEmptyLines':!![],'step':function(_0xe17d29,_0x1bf924){try{for(var _0x27b4ca=0x0,_0x141d25=[];_0x27b4ca<_0xe17d29[_0xe52e('0x7c')][_0xe52e('0x1a')];_0x27b4ca++){stats[_0xe52e('0x7d')]+=0x1;if(_0xe17d29['errors'][_0x27b4ca]){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],_0xe17d29[_0xe52e('0x5a')][_0x27b4ca]);}else{var _0x52131e=[];var _0x708d40=[];var _0x29b224={};for(var _0xef4994 in _0xede4dc){let _0x339687=contactItemTypes[_0xe52e('0x7e')](_0x21884b=>_0x21884b[_0xe52e('0x78')]===_0xef4994);let _0x3f4a03=contactItemTypes[_0xe52e('0x7e')](_0x47a294=>_0x47a294[_0xe52e('0x78')]+_0xe52e('0x7f')===_0xef4994);if(_[_0xe52e('0x6c')](_0x339687)&&_[_0xe52e('0x6c')](_0x3f4a03)){if(_0xede4dc['hasOwnProperty'](_0xef4994)){if(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]]){var _0x33fa75=_['trim'](_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]][_0xe52e('0x80')](/"/g,'\x27'));switch(_0xef4994){case'scheduledat':var _0x17812f=moment(_0x33fa75,_0xe52e('0xb'),!![]);if(_0x17812f[_0xe52e('0x81')]()){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x82'));}break;case'priority':var _0x2fe0e8=parseInt(_0x33fa75);_0x33fa75=_[_0xe52e('0x83')](_0x2fe0e8)||_0x2fe0e8<0x0||_0x2fe0e8>0x4?_0x297701?0x3:0x2:_0x2fe0e8;_0x141d25['push']('\x22'+_0x33fa75+'\x22');break;case'UserId':var _0x43a426=parseInt(_0x33fa75);if(_[_0xe52e('0x84')](_0x43a426)&&_[_0xe52e('0x85')](_0x1a41eb,_0x43a426)){_0x141d25['push']('\x22'+_0x43a426+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x86'));}break;case'email':if(isEmail(_0x33fa75)){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x87'));}break;case _0xe52e('0x88'):var _0x395d40=moment(_0x33fa75,_0xe52e('0x89'),!![]);if(_0x395d40[_0xe52e('0x81')]()){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x8a'));}break;case'dialTimezone':var _0x367e6b=shared['timezones'];var _0x4444d2=_0x367e6b[_0x33fa75];if(!_[_0xe52e('0x6c')](_0x4444d2)){var _0x3b99a0=_0x4444d2[_0xe52e('0x6d')];_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');_0x141d25[_0xe52e('0x1b')]('\x22'+_0x3b99a0+'\x22');}break;default:_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}}else{switch(_0xef4994){case'firstName':case _0xe52e('0x10'):_0x52131e[_0xe52e('0x1b')](_0xef4994+_0xe52e('0x8b'));break;default:_0x141d25[_0xe52e('0x1b')]('\x22\x22');}}}}else{var _0x299998='';if(!_['isNil'](_0x339687)){if(!_0x29b224['hasOwnProperty'](_0x339687['id'])){if(!_[_0xe52e('0x6c')](_0xe17d29['data'][_0x27b4ca][_0xede4dc[_0xef4994]])){var _0x33fa75=_[_0xe52e('0x8c')](_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]][_0xe52e('0x80')](/"/g,'\x27'));var _0x7336d6=phoneDescriptions['find'](_0x32cf7d=>_0x32cf7d[_0xe52e('0x8d')]===_0x339687['id']);if(!_[_0xe52e('0x6c')](_0x7336d6)){var _0x446360=_['trim'](_0xe17d29['data'][_0x27b4ca][_0xede4dc[_0x7336d6[_0xe52e('0x8e')]]][_0xe52e('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x446360))_0x33fa75=_0x33fa75+'§'+_0x446360;}if(_0x299998=='')_0x299998=_0x33fa75;else _0x299998+='|'+_0x33fa75;}_0x708d40['push'](_0x339687['id']+':'+_0x299998);_0x29b224[_0x339687['id']]=0x1;}}}}if(hasAdditionalPhones){_0x141d25['push']('\x22'+_0x708d40[_0xe52e('0x12')](';')+'\x22');}if(_0x52131e[_0xe52e('0x1a')]){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],{'code':_0xe52e('0x8f'),'message':_0x52131e[_0xe52e('0x12')]()});}else{fs[_0xe52e('0x90')](_0x64bd81,_0x141d25[_0xe52e('0x12')]()+'\x0a');}_0x141d25=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xe52e('0x91')+_0x173288,stats);stats[_0xe52e('0x5a')]=[];}}if(stopped){logger[_0xe52e('0x5c')](_0xe52e('0x92'));_0x1bf924[_0xe52e('0x93')]();}}catch(_0x14e21){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],{'code':'SystemError','message':_0x14e21[_0xe52e('0x58')]});logger[_0xe52e('0x6a')](_0xe52e('0x94'),_0x14e21[_0xe52e('0x58')]);}},'complete':function(){try{var _0x181549=[];var _0x48443a=[];var _0x38ec02='cm_contacts';if(_0x275678[_0xe52e('0x95')]&&_0x275678[_0xe52e('0x95')][_0xe52e('0x1a')]){_0x38ec02='cm_contacts_'+_0x173288;_0x181549[_0xe52e('0x1b')](_0xe52e('0x96')+_0x38ec02+_0xe52e('0x97'));}tmp_campaigns=_0xe52e('0x98')+_0x173288;tmp_voice_queues='voice_queues_'+_0x173288;_0x48443a[_0xe52e('0x1b')](_0xe52e('0x96')+tmp_campaigns+_0xe52e('0x99'));_0x48443a[_0xe52e('0x1b')](_0xe52e('0x96')+tmp_voice_queues+_0xe52e('0x99'));BPromise[_0xe52e('0x9a')](_0x48443a,handleTZQuery)[_0xe52e('0x1d')](function(_0x539f1e){updateTzCampaigns(_0x275678['ListId'])['then'](function(_0x18594b){updateTzVoiceQueues(_0x275678[_0xe52e('0x2e')])[_0xe52e('0x1d')](function(_0x513d3e){if(hasTZ)_0x490e36=_0x490e36[_0xe52e('0x80')](_0xe52e('0x6b'),_0xe52e('0x9b'));var _0x457283=util['format'](_0xe52e('0x9c'),_0x64bd81,_0x38ec02,_0x490e36,_0x275678['ListId'],_0x275678['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xede4dc['scheduledat'])){_0x457283+=_0xe52e('0x9d');}_0x181549['push'](_0x457283);if(_0x275678[_0xe52e('0x95')]&&_0x275678[_0xe52e('0x95')][_0xe52e('0x1a')]){_0x181549[_0xe52e('0x1b')](insertCmContact(_0x275678[_0xe52e('0x2e')],_0x38ec02,_0x275678[_0xe52e('0x95')],_0xede4dc));_0x181549['push'](_0xe52e('0x9e')+_0x38ec02+';');}BPromise[_0xe52e('0x9a')](_0x181549,handleQuery)['then'](function(_0xdce264){BPromise[_0xe52e('0x1c')]([handleAdditionalPhones()])[_0xe52e('0x1d')](function(){_0x181549=[];for(var _0x1cf290=0x0;_0x1cf290_0x419808['name']===_0x390d20);let _0x2792e3=contactItemTypes[_0xc040('0x81')](_0x4dbb0a=>_0x4dbb0a[_0xc040('0x7b')]+_0xc040('0x7c')===_0x390d20);if(_[_0xc040('0x20')](_0x2d7005)&&_['isNil'](_0x2792e3)){if(_0x4e5d85['hasOwnProperty'](_0x390d20)){if(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]]){var _0x5d12e2=_[_0xc040('0x82')](_0x13d3ea['data'][_0x45d2e5][_0x4e5d85[_0x390d20]]['replace'](/"/g,'\x27'));switch(_0x390d20){case _0xc040('0x2e'):var _0x5c8ae3=moment(_0x5d12e2,_0xc040('0xe'),!![]);if(_0x5c8ae3[_0xc040('0x83')]()){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783['push'](_0xc040('0x84'));}break;case _0xc040('0x2f'):var _0x12628e=parseInt(_0x5d12e2);_0x5d12e2=_['isNaN'](_0x12628e)||_0x12628e<0x0||_0x12628e>0x4?_0x4356cf?0x3:0x2:_0x12628e;_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');break;case'UserId':var _0x586f72=parseInt(_0x5d12e2);if(_[_0xc040('0x85')](_0x586f72)&&_[_0xc040('0x86')](_0x274cb2,_0x586f72)){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x586f72+'\x22');}else{_0x43d783['push']('agent\x20not\x20exists');}break;case _0xc040('0x87'):if(isEmail(_0x5d12e2)){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783[_0xc040('0x1c')](_0xc040('0x88'));}break;case'dateOfBirth':var _0x3b9905=moment(_0x5d12e2,_0xc040('0x89'),!![]);if(_0x3b9905[_0xc040('0x83')]()){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783['push'](_0xc040('0x8a'));}break;case _0xc040('0x6f'):var _0x379533=shared[_0xc040('0x6c')];var _0x3dfeea=_0x379533[_0x5d12e2];if(!_[_0xc040('0x20')](_0x3dfeea)){var _0x3d7e77=_0x3dfeea[_0xc040('0x8b')];_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');_0x36f14a[_0xc040('0x1c')]('\x22'+_0x3d7e77+'\x22');}break;default:_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}}else{switch(_0x390d20){case _0xc040('0x8c'):case _0xc040('0x12'):_0x43d783['push'](_0x390d20+_0xc040('0x8d'));break;default:_0x36f14a[_0xc040('0x1c')]('\x22\x22');}}}}else{var _0x490368='';if(!_[_0xc040('0x20')](_0x2d7005)){if(!_0x488592[_0xc040('0x8e')](_0x2d7005['id'])){if(!_[_0xc040('0x20')](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]])){var _0x5d12e2=_['trim'](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]]['replace'](/"/g,'\x27'));var _0x4d3aaf=phoneDescriptions['find'](_0xf5fedd=>_0xf5fedd[_0xc040('0x8f')]===_0x2d7005['id']);if(!_[_0xc040('0x20')](_0x4d3aaf)){var _0xf649f6=_['trim'](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x4d3aaf[_0xc040('0x90')]]][_0xc040('0x91')](/"/g,'\x27'));if(!_['isNil'](_0xf649f6))_0x5d12e2=_0x5d12e2+'§'+_0xf649f6;}if(_0x490368=='')_0x490368=_0x5d12e2;else _0x490368+='|'+_0x5d12e2;}_0x58de77[_0xc040('0x1c')](_0x2d7005['id']+':'+_0x490368);_0x488592[_0x2d7005['id']]=0x1;}}}}if(hasAdditionalPhones){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x58de77['join'](';')+'\x22');}if(_0x43d783['length']){handleError(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5],{'code':'SystemRow','message':_0x43d783[_0xc040('0x14')]()});}else{fs['appendFileSync'](_0x2b32aa,_0x36f14a[_0xc040('0x14')]()+'\x0a');}_0x36f14a=[];}if(!(stats['rows']%0xc8)){socket[_0xc040('0x92')](_0xc040('0x93')+_0x4b94c3,stats);stats['errors']=[];}}if(stopped){logger[_0xc040('0x57')](_0xc040('0x94'));_0x5641b0[_0xc040('0x95')]();}}catch(_0x19c099){handleError(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5],{'code':_0xc040('0x96'),'message':_0x19c099[_0xc040('0x5b')]});logger[_0xc040('0x65')](_0xc040('0x97'),_0x19c099[_0xc040('0x5b')]);}},'complete':function(){try{var _0x5c9021=[];var _0x1e2f25=[];var _0x4f7bcf='cm_contacts';if(_0x2af864['duplicates']&&_0x2af864[_0xc040('0x98')][_0xc040('0x1f')]){_0x4f7bcf=_0xc040('0x99')+_0x4b94c3;_0x5c9021['push'](_0xc040('0x9a')+_0x4f7bcf+_0xc040('0x9b'));}tmp_campaigns=_0xc040('0x9c')+_0x4b94c3;tmp_voice_queues='voice_queues_'+_0x4b94c3;_0x1e2f25[_0xc040('0x1c')](_0xc040('0x9a')+tmp_campaigns+_0xc040('0x9d'));_0x1e2f25['push'](_0xc040('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc040('0x9e')](_0x1e2f25,handleTZQuery)[_0xc040('0x1b')](function(_0x3599b0){updateTzCampaigns(_0x2af864[_0xc040('0x3d')])[_0xc040('0x1b')](function(_0xd64033){updateTzVoiceQueues(_0x2af864[_0xc040('0x3d')])['then'](function(_0x373abe){if(hasTZ)_0x50da0e=_0x50da0e[_0xc040('0x91')](_0xc040('0x6f'),_0xc040('0x9f'));var _0x24e147=util[_0xc040('0xd')](_0xc040('0xa0'),_0x2b32aa,_0x4f7bcf,_0x50da0e,_0x2af864[_0xc040('0x3d')],_0x2af864[_0xc040('0xa1')]||null,NOW,NOW);if(_[_0xc040('0x20')](_0x4e5d85[_0xc040('0x2e')])){_0x24e147+=',\x20scheduledAt\x20=\x20NOW()';}_0x5c9021[_0xc040('0x1c')](_0x24e147);if(_0x2af864[_0xc040('0x98')]&&_0x2af864[_0xc040('0x98')]['length']){_0x5c9021[_0xc040('0x1c')](insertCmContact(_0x2af864[_0xc040('0x3d')],_0x4f7bcf,_0x2af864[_0xc040('0x98')],_0x4e5d85));_0x5c9021[_0xc040('0x1c')](_0xc040('0xa2')+_0x4f7bcf+';');}BPromise[_0xc040('0x9e')](_0x5c9021,handleQuery)['then'](function(_0x4d41aa){BPromise[_0xc040('0x1d')]([handleAdditionalPhones()])[_0xc040('0x1b')](function(){_0x5c9021=[];for(var _0xa7ae10=0x0;_0xa7ae10\x20\x20');}var _0x28c5fc=path[_0xc040('0x14')](config[_0xc040('0x77')],_0xc040('0xae'),process[_0xc040('0xad')][0x2]);if(!fs[_0xc040('0xaf')](_0x28c5fc)){throw new Error(_0xc040('0xb0'));}var _0x33f6d4={};try{_0x33f6d4=JSON[_0xc040('0x7e')](process[_0xc040('0xad')][0x3]);if(!_0x33f6d4[_0xc040('0x75')]){throw new Error(_0xc040('0xb1'));}if(!_0x33f6d4[_0xc040('0x75')][_0xc040('0x12')]){throw new Error(_0xc040('0xb2'));}if(!_0x33f6d4[_0xc040('0x75')][_0xc040('0x8c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x13084c=0x0;if(_0x33f6d4[_0xc040('0x75')]['UserId']){_0x13084c=0x1;}if(!_0x33f6d4[_0xc040('0x3d')]){throw new Error(_0xc040('0xb3'));}}catch(_0x171dcc){throw new Error('body\x20id\x20mandatory');}var _0x5c7872=[];try{_0x5c7872=_[_0xc040('0xb4')](JSON[_0xc040('0x7e')](process[_0xc040('0xad')][0x4]),'id');}catch(_0x218eb5){logger[_0xc040('0x57')](_0xc040('0xb5'));}main(_0x28c5fc,_0x33f6d4,_0x5c7872,_0x13084c);}validate();process['on'](_0xc040('0xb6'),handleStop);process['on'](_0xc040('0xb7'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index d3671de..3c439ec 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeca8=['\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','from','join','where','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','error','split','length','filter','findOne','CmContactHasItem','update','updated','inserted','CmContact','phone','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.updatedAt','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_hopper','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','message','exit','code','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','errors','data','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','CREATE\x20TABLE\x20'];(function(_0x4d6e5d,_0x4cf785){var _0x51c166=function(_0x30ef09){while(--_0x30ef09){_0x4d6e5d['push'](_0x4d6e5d['shift']());}};_0x51c166(++_0x4cf785);}(_0xeca8,0x1f2));var _0x8eca=function(_0x258f0b,_0x4833e3){_0x258f0b=_0x258f0b-0x0;var _0x10af40=_0xeca8[_0x258f0b];return _0x10af40;};'use strict';var fs=require('fs');var path=require(_0x8eca('0x0'));var _=require(_0x8eca('0x1'));var Papa=require(_0x8eca('0x2'));var util=require(_0x8eca('0x3'));var BPromise=require(_0x8eca('0x4'));var moment=require(_0x8eca('0x5'));var squel=require('squel');var Redis=require(_0x8eca('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x8eca('0x7'));var logger=require(_0x8eca('0x8'))(_0x8eca('0x9'));config['redis']=_[_0x8eca('0xa')](config[_0x8eca('0xb')],{'host':_0x8eca('0xc'),'port':0x18eb});var socket=require(_0x8eca('0xd'))(new Redis(config[_0x8eca('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x8eca('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x8eca('0xf')+moment()[_0x8eca('0xe')](_0x8eca('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10184f){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))*$/[_0x8eca('0x11')](_0x10184f);}function selectNotIn(_0x24b0ca,_0x40e285,_0x2653b7,_0x220093,_0x38301b){return squel['select']()[_0x8eca('0x12')]('phone')[_0x8eca('0x13')](_0x220093)[_0x8eca('0x14')](_0x40e285,null,_0x40e285+'.id\x20=\x20'+_0x220093+'.'+_0x2653b7)[_0x8eca('0x15')](_0x220093+'.'+_0x2653b7+'\x20=\x20'+_0x24b0ca+'.'+_0x2653b7)['where'](_0x40e285+'.dialCheckDuplicateType\x20IN\x20('+_0x38301b[_0x8eca('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36b8f1,_0x2b901f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8eca('0x16')][_0x8eca('0x17')](_0x8eca('0x18')+tempTableName)[_0x8eca('0x19')](function(_0x4e390c){if(_0x4e390c!==null){var _0x15be36=[];for(var _0x1f7012=0x0;_0x1f7012<_0x4e390c['length'];_0x1f7012++){var _0x41ca2d=_0x4e390c[_0x1f7012];if(!_[_0x8eca('0x1a')](_0x41ca2d['phone'])){if(!_['isNil'](_0x41ca2d[_0x8eca('0x1b')]))_0x15be36['push'](insertAdditionalPhones(_0x41ca2d));promisesContact[_0x8eca('0x1c')]({'contact':_0x41ca2d});}}}Promise[_0x8eca('0x1d')](_0x15be36)[_0x8eca('0x1e')](function(){_0x36b8f1({'val':0x1});});})[_0x8eca('0x1f')](function(_0x5180c8){logger[_0x8eca('0x20')](_0x5180c8['message']);});});}function insertAdditionalPhones(_0x449434){return new Promise(function(_0x536d40,_0x373117){var _0x14af03=_0x449434[_0x8eca('0x1b')];if(_[_0x8eca('0x1a')](_0x14af03))_0x373117({'val':0x0});else{var _0x1cf97a=_0x14af03[_0x8eca('0x21')](';');var _0x4cecf6=[];orderBy=0x0;for(var _0xacfa9c=0x0;_0xacfa9c<_0x1cf97a['length'];_0xacfa9c++){_0x4cecf6['push'](splitAdditionalPhone(_0x449434['id'],_0x1cf97a[_0xacfa9c]));}Promise[_0x8eca('0x1d')](_0x4cecf6)[_0x8eca('0x1e')](function(){_0x536d40({'val':_0x1cf97a[_0x8eca('0x22')]});});}});}function splitAdditionalPhone(_0x14d9c9,_0x271179){return new Promise(function(_0x5ac424,_0x472c54){var _0x5484aa=_0x271179[_0x8eca('0x21')](':');var _0x15823b=_0x5484aa[0x0];var _0x18ae97=_0x5484aa[0x1];if(_0x18ae97!==''){var _0x3e1f66=_0x18ae97[_0x8eca('0x21')]('|');var _0xb3ffd7=[];for(var _0x33e4db=0x0;_0x33e4db<_0x3e1f66[_0x8eca('0x22')];_0x33e4db++){if(_0x3e1f66[_0x33e4db]!==''){var _0x4e524f=_[_0x8eca('0x23')](promisesAdditionalPhones,{'contactId':_0x14d9c9,'phone':_0x3e1f66[_0x33e4db]});if(_0x4e524f[_0x8eca('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0x8eca('0x1c')]({'contactId':_0x14d9c9,'contactTypeId':_0x15823b,'phone':_0x3e1f66[_0x33e4db],'orderBy':orderBy});}}}_0x5ac424({'ok':0x1});}else _0x5ac424({'res':0x0});});}function createAdditionalPhone(_0x205b0d,_0x1b3e41,_0x8b406b,_0x39e04f){var _0x189ecf='';var _0x36b286='';var _0x497122=_0x8b406b[_0x8eca('0x21')]('§');_0x189ecf=_0x497122[0x0];if(_0x497122[_0x8eca('0x22')]==0x2)_0x36b286=_0x497122[0x1];return new Promise(function(_0x372f13,_0x1f6ed5){return db['CmContactHasItem'][_0x8eca('0x24')]({'where':{'CmContactId':_0x205b0d,'item':_0x189ecf}})[_0x8eca('0x1e')](function(_0x3701f6){if(_0x3701f6){return db[_0x8eca('0x25')][_0x8eca('0x26')]({'ItemTypeId':_0x1b3e41,'description':_0x36b286,'OrderBy':_0x39e04f},{'where':{'CmContactId':_0x205b0d,'item':_0x189ecf}})[_0x8eca('0x1e')](function(_0x20e7ba){_0x372f13({'res':_0x8eca('0x27')});});}else{return db[_0x8eca('0x25')]['create']({'CmContactId':_0x205b0d,'item':_0x189ecf,'ItemTypeId':_0x1b3e41,'description':_0x36b286,'OrderBy':_0x39e04f,'ItemClass':'PHONE'})[_0x8eca('0x1e')](function(_0x8abf4d){_0x372f13({'res':_0x8eca('0x28')});});}});});}function updateContact(_0xe283b1){return new Promise(function(_0x3a1175,_0x194eed){var _0x220e33=_0xe283b1['id'];delete _0xe283b1['id'];return db[_0x8eca('0x29')][_0x8eca('0x26')](_0xe283b1,{'where':{'id':_0x220e33}})[_0x8eca('0x1e')](function(_0x49cee8){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0xe283b1[_0x8eca('0x2a')]},{'where':{'ContactId':_0x220e33}})[_0x8eca('0x1e')](function(_0xfaaf1f){_0x3a1175({'ret':'OK'});});});});}function insertCmHopper(_0x1d680c,_0x2fe644,_0x35b2bc,_0x2f6df4,_0xa0a7f5){var _0x35b57e=[_0x8eca('0x2b'),_0x8eca('0x2c'),_0x8eca('0x2d'),_0x8eca('0x2e'),_0x2fe644+'.'+_0x2f6df4,_0x8eca('0x2f'),'cm_contacts.updatedAt',_0x8eca('0x30'),'cm_contacts.UserId','\x22'+_0xa0a7f5+'\x22'];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')]('cm_hopper')[_0x8eca('0x33')](['phone',_0x8eca('0x34'),_0x8eca('0x35'),_0x8eca('0x36'),_0x2f6df4,_0x8eca('0x37'),_0x8eca('0x38'),_0x8eca('0x39'),_0x8eca('0x3a'),_0x8eca('0x3b')],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x35b57e)[_0x8eca('0x13')](_0x2fe644)[_0x8eca('0x14')](_0x8eca('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x2fe644+_0x8eca('0x3f'))[_0x8eca('0x14')](_0x35b2bc,null,_0x35b2bc+_0x8eca('0x40')+_0x2fe644+'.'+_0x2f6df4)['where'](_0x2fe644+_0x8eca('0x41'),_0x1d680c)['where'](_0x8eca('0x42'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2fe644,_0x35b2bc,_0x2f6df4,'cm_hopper',[_0x8eca('0x43'),'\x22onlyIfOpen\x22']))[_0x8eca('0x15')](_0x8eca('0x44'),selectNotIn(_0x2fe644,_0x35b2bc,_0x2f6df4,'cm_hopper',[_0x8eca('0x43')])))['toString']();}function insertCmHopperBlack(_0x489666,_0x4bdcc5,_0x569b60,_0x29f030){var _0x5135e8=[_0x8eca('0x2b'),_0x8eca('0x2d'),'cm_contacts.ListId',_0x4bdcc5+'.'+_0x29f030,_0x8eca('0x2f'),_0x8eca('0x45')];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')]('cm_hopper_black')[_0x8eca('0x33')]([_0x8eca('0x2a'),_0x8eca('0x35'),'ListId',_0x29f030,_0x8eca('0x37'),_0x8eca('0x38')],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x5135e8)[_0x8eca('0x13')](_0x4bdcc5)['join'](_0x8eca('0x3e'),null,_0x8eca('0x46')+_0x4bdcc5+_0x8eca('0x3f'))[_0x8eca('0x14')](_0x569b60,null,_0x569b60+'.id\x20=\x20'+_0x4bdcc5+'.'+_0x29f030)['where'](_0x4bdcc5+'.CmListId\x20=\x20?',_0x489666)[_0x8eca('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8eca('0x15')](_0x8eca('0x44'),squel['select']()[_0x8eca('0x12')](_0x8eca('0x2a'))['from'](_0x8eca('0x47'))['where'](_0x8eca('0x48'),_0x489666)[_0x8eca('0x15')](_0x29f030+_0x8eca('0x49'),_0x4bdcc5+'.'+_0x29f030)))[_0x8eca('0x4a')]();}function insertCmHopperAdditionalPhones(_0x5dd642){var _0x5cea41=['cm_hopper.id',_0x8eca('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x8eca('0x4c')];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')](_0x8eca('0x4d'))[_0x8eca('0x33')]([_0x8eca('0x4e'),'phone',_0x8eca('0x4f'),_0x8eca('0x37'),'updatedAt'],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x5cea41)['from'](_0x8eca('0x50'))[_0x8eca('0x14')](_0x8eca('0x3e'),null,_0x8eca('0x51'))['join']('cm_contact_has_items',null,_0x8eca('0x52'))['where'](_0x8eca('0x53'),_0x5dd642)[_0x8eca('0x15')](_0x8eca('0x42'),NOW))[_0x8eca('0x4a')]();}function insertCmContact(_0x1af9fb,_0x45da41,_0x3f5a85,_0x5eed95){var _0xfdd3ab=_[_0x8eca('0x54')](_[_0x8eca('0x55')](_0x5eed95),[_0x8eca('0x36'),'CompanyId',_0x8eca('0x37'),_0x8eca('0x38')]);return squel[_0x8eca('0x31')]()['into'](_0x8eca('0x3e'))['fromQuery'](_0xfdd3ab,squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0xfdd3ab)[_0x8eca('0x13')](_0x45da41)[_0x8eca('0x15')]('('+_0x3f5a85[_0x8eca('0x14')](',')+_0x8eca('0x56'),squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x3f5a85)[_0x8eca('0x13')](_0x8eca('0x3e'))[_0x8eca('0x15')](_0x8eca('0x48'),_0x1af9fb))['where'](_0x8eca('0x57'),squel[_0x8eca('0x3c')]()['field'](_0x8eca('0x58'),'min_id')[_0x8eca('0x13')](_0x45da41)[_0x8eca('0x59')](_0x3f5a85[_0x8eca('0x14')](','))))['toString']();}function handleStop(){logger[_0x8eca('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x9ef9e9){logger[_0x8eca('0x20')](_0x9ef9e9[_0x8eca('0x5b')]);process[_0x8eca('0x5c')](0x1);}function handleError(_0x61d452,_0x480713){stats['errors'][_0x8eca('0x1c')]({'name':_0x480713[_0x8eca('0x5d')],'message':_0x480713[_0x8eca('0x5b')],'row':_0x61d452});}function handleQuery(_0x380eac){logger[_0x8eca('0x5a')](_0x380eac);return db['sequelize'][_0x8eca('0x17')](_0x380eac)[_0x8eca('0x19')](function(_0x4366a0){results[_0x8eca('0x1c')](_0x4366a0);})[_0x8eca('0x1f')](function(_0x3f5274){logger[_0x8eca('0x20')](_0x3f5274['message']);});}function main(_0xb86773,_0x35e24e,_0x54ef41,_0x163541){logger['info']('main',_0xb86773,JSON[_0x8eca('0x5e')](_0x35e24e));process['send'](_0x8eca('0x5f'));var _0x20ab07=_0x35e24e['binding'];var _0x1178a2=_[_0x8eca('0x60')](_0x20ab07);var _0xcd593a=_0x35e24e[_0x8eca('0x61')];var _0x8e61a5=path[_0x8eca('0x14')](config[_0x8eca('0x62')],_0x8eca('0x63'),_0xcd593a+_0x8eca('0x64'));logger[_0x8eca('0x5a')]('body',_0x35e24e);db[_0x8eca('0x65')][_0x8eca('0x66')]({'raw':!![],'attributes':['id',_0x8eca('0x67')]})[_0x8eca('0x1e')](function(_0x4921e2){for(var _0x57d28d=0x0;_0x57d28d<_0x4921e2['length'];_0x57d28d++){if(_0x4921e2[_0x57d28d][_0x8eca('0x67')]in _0x20ab07){contactItemTypes[_0x8eca('0x1c')](_0x4921e2[_0x57d28d]);delete _0x1178a2[_0x4921e2[_0x57d28d][_0x8eca('0x67')]];hasAdditionalPhones=!![];}for(var _0x528df7 in _0x20ab07){if(_0x4921e2[_0x57d28d][_0x8eca('0x67')]+_0x8eca('0x68')===_0x528df7){phoneDescriptions[_0x8eca('0x1c')]({'itemTypeId':_0x4921e2[_0x57d28d]['id'],'description':_0x528df7});delete _0x1178a2[_0x528df7];}}}if(hasAdditionalPhones)_0x1178a2['AdditionalPhones']='';var _0x3a0025=_['keys'](_0x1178a2)[_0x8eca('0x14')]();logger[_0x8eca('0x5a')](_0x8eca('0x69'),_0x3a0025);fs[_0x8eca('0x6a')](_0x8e61a5,_0x3a0025+'\x0a');Papa[_0x8eca('0x6b')](fs[_0x8eca('0x6c')](_0xb86773),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c0631,_0x11cfb6){try{for(var _0x3d9df4=0x0,_0x5b71bc=[];_0x3d9df4<_0x2c0631['data'][_0x8eca('0x22')];_0x3d9df4++){stats['rows']+=0x1;if(_0x2c0631[_0x8eca('0x6d')][_0x3d9df4]){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],_0x2c0631[_0x8eca('0x6d')][_0x3d9df4]);}else{var _0x2e7991=[];var _0x166f21=[];var _0x1f9ecb={};for(var _0x28f71a in _0x20ab07){let _0x191d34=contactItemTypes[_0x8eca('0x6f')](_0x395497=>_0x395497[_0x8eca('0x67')]===_0x28f71a);let _0x52fa88=contactItemTypes[_0x8eca('0x6f')](_0x3cae49=>_0x3cae49[_0x8eca('0x67')]+'_description'===_0x28f71a);if(_[_0x8eca('0x1a')](_0x191d34)&&_[_0x8eca('0x1a')](_0x52fa88)){if(_0x20ab07['hasOwnProperty'](_0x28f71a)){if(_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a]]){var _0x3e725e=_[_0x8eca('0x70')](_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a]][_0x8eca('0x71')](/"/g,'\x27'));switch(_0x28f71a){case _0x8eca('0x34'):var _0x5d1841=moment(_0x3e725e,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5d1841['isValid']()){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991[_0x8eca('0x1c')](_0x8eca('0x72'));}break;case _0x8eca('0x39'):var _0x184cdc=parseInt(_0x3e725e);_0x3e725e=_[_0x8eca('0x73')](_0x184cdc)||_0x184cdc<0x0||_0x184cdc>0x4?_0x163541?0x3:0x2:_0x184cdc;_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');break;case _0x8eca('0x3a'):var _0xd74de7=parseInt(_0x3e725e);if(_['isNumber'](_0xd74de7)&&_[_0x8eca('0x74')](_0x54ef41,_0xd74de7)){_0x5b71bc['push']('\x22'+_0xd74de7+'\x22');}else{_0x2e7991['push'](_0x8eca('0x75'));}break;case _0x8eca('0x76'):if(isEmail(_0x3e725e)){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991[_0x8eca('0x1c')](_0x8eca('0x77'));}break;case _0x8eca('0x78'):var _0x13c7ec=moment(_0x3e725e,_0x8eca('0x79'),!![]);if(_0x13c7ec['isValid']()){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991['push'](_0x8eca('0x7a'));}break;default:_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}}else{switch(_0x28f71a){case _0x8eca('0x7b'):case _0x8eca('0x2a'):_0x2e7991[_0x8eca('0x1c')](_0x28f71a+_0x8eca('0x7c'));break;default:_0x5b71bc['push']('\x22\x22');}}}}else{var _0x273dfc='';if(!_[_0x8eca('0x1a')](_0x191d34)){if(!_0x1f9ecb['hasOwnProperty'](_0x191d34['id'])){for(var _0x33da06=0x0;_0x33da06<_0x20ab07[_0x28f71a][_0x8eca('0x22')];_0x33da06++){var _0x3e725e=_[_0x8eca('0x70')](_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a][_0x33da06]][_0x8eca('0x71')](/"/g,'\x27'));var _0x1ffa2e=phoneDescriptions[_0x8eca('0x6f')](_0x13a4d4=>_0x13a4d4[_0x8eca('0x7d')]===_0x191d34['id']);if(!_[_0x8eca('0x1a')](_0x1ffa2e)){var _0xa22072=_[_0x8eca('0x70')](_0x2c0631[_0x8eca('0x6e')][_0x3d9df4][_0x20ab07[_0x1ffa2e[_0x8eca('0x7e')]][0x0]][_0x8eca('0x71')](/"/g,'\x27'));if(!_['isNil'](_0xa22072))_0x3e725e=_0x3e725e+'§'+_0xa22072;}if(_0x273dfc=='')_0x273dfc=_0x3e725e;else _0x273dfc+='|'+_0x3e725e;}_0x166f21[_0x8eca('0x1c')](_0x191d34['id']+':'+_0x273dfc);_0x1f9ecb[_0x191d34['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5b71bc['push']('\x22'+_0x166f21[_0x8eca('0x14')](';')+'\x22');}if(_0x2e7991[_0x8eca('0x22')]){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],{'code':_0x8eca('0x7f'),'message':_0x2e7991[_0x8eca('0x14')]()});}else{fs[_0x8eca('0x80')](_0x8e61a5,_0x5b71bc[_0x8eca('0x14')]()+'\x0a');}_0x5b71bc=[];}if(!(stats[_0x8eca('0x81')]%0xc8)){socket[_0x8eca('0x82')]('contact:import:'+_0xcd593a,stats);stats[_0x8eca('0x6d')]=[];}}if(stopped){logger[_0x8eca('0x5a')](_0x8eca('0x83'));_0x11cfb6[_0x8eca('0x84')]();}}catch(_0x1c1ab5){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],{'code':'SystemError','message':_0x1c1ab5['message']});logger[_0x8eca('0x20')]('step',_0x1c1ab5[_0x8eca('0x5b')]);}},'complete':function(){try{var _0x501642=[];var _0x3a4c9e=tempTableName;_0x501642['push'](_0x8eca('0x85')+_0x3a4c9e+_0x8eca('0x86'));logger['info'](_0x8eca('0x87'),contactItemTypes[_0x8eca('0x22')]);var _0x2d1898=util[_0x8eca('0xe')](_0x8eca('0x88'),_0x8e61a5,_0x3a4c9e,_0x3a0025,_0x35e24e['ListId'],_0x35e24e['CompanyId']||null,NOW,NOW);if(_[_0x8eca('0x1a')](_0x20ab07['scheduledat'])){_0x2d1898+=_0x8eca('0x89');}_0x501642[_0x8eca('0x1c')](_0x2d1898);BPromise[_0x8eca('0x8a')](_0x501642,handleQuery)[_0x8eca('0x1e')](function(_0x109f1e){BPromise['all']([handleAdditionalPhones()])[_0x8eca('0x1e')](function(){_0x501642=[];for(var _0x26099d=0x0;_0x26099d\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa321,0x9d));var _0x1a32=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xa321[_0x4c0622];return _0x1799d8;};'use strict';var fs=require('fs');var path=require(_0x1a32('0x0'));var _=require(_0x1a32('0x1'));var Papa=require(_0x1a32('0x2'));var util=require(_0x1a32('0x3'));var BPromise=require('bluebird');var moment=require(_0x1a32('0x4'));var squel=require(_0x1a32('0x5'));var Redis=require('ioredis');var db=require(_0x1a32('0x6'))['db'];var config=require(_0x1a32('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x1a32('0x8')](config['redis'],{'host':_0x1a32('0x9'),'port':0x18eb});var socket=require(_0x1a32('0xa'))(new Redis(config[_0x1a32('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x1a32('0xc')](_0x1a32('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x1a32('0xc')](_0x1a32('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5d034a){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))*$/[_0x1a32('0xf')](_0x5d034a);}function selectNotIn(_0x3cf338,_0x1ce64e,_0x1d2439,_0x2d99fc,_0x31f14f){return squel['select']()[_0x1a32('0x10')](_0x1a32('0x11'))[_0x1a32('0x12')](_0x2d99fc)['join'](_0x1ce64e,null,_0x1ce64e+_0x1a32('0x13')+_0x2d99fc+'.'+_0x1d2439)[_0x1a32('0x14')](_0x2d99fc+'.'+_0x1d2439+_0x1a32('0x15')+_0x3cf338+'.'+_0x1d2439)[_0x1a32('0x14')](_0x1ce64e+_0x1a32('0x16')+_0x31f14f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4498c7,_0x456e81){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1a32('0x17')][_0x1a32('0x18')](_0x1a32('0x19')+tempTableName)[_0x1a32('0x1a')](function(_0x5c272a){if(_0x5c272a!==null){var _0x29c53d=[];for(var _0x463763=0x0;_0x463763<_0x5c272a['length'];_0x463763++){var _0x2954a4=_0x5c272a[_0x463763];if(!_[_0x1a32('0x1b')](_0x2954a4[_0x1a32('0x11')])){if(!_[_0x1a32('0x1b')](_0x2954a4[_0x1a32('0x1c')]))_0x29c53d[_0x1a32('0x1d')](insertAdditionalPhones(_0x2954a4));promisesContact[_0x1a32('0x1d')]({'contact':_0x2954a4});}}}Promise[_0x1a32('0x1e')](_0x29c53d)[_0x1a32('0x1f')](function(){_0x4498c7({'val':0x1});});})[_0x1a32('0x20')](function(_0x2f6381){logger['error'](_0x2f6381[_0x1a32('0x21')]);});});}function insertAdditionalPhones(_0x16896e){return new Promise(function(_0x235fd0,_0x5a12d5){var _0x17e938=_0x16896e[_0x1a32('0x1c')];if(_['isNil'](_0x17e938))_0x5a12d5({'val':0x0});else{var _0x1250dc=_0x17e938['split'](';');var _0x125504=[];orderBy=0x0;for(var _0x3f1409=0x0;_0x3f1409<_0x1250dc['length'];_0x3f1409++){_0x125504[_0x1a32('0x1d')](splitAdditionalPhone(_0x16896e['id'],_0x1250dc[_0x3f1409]));}Promise[_0x1a32('0x1e')](_0x125504)[_0x1a32('0x1f')](function(){_0x235fd0({'val':_0x1250dc['length']});});}});}function splitAdditionalPhone(_0x2d6637,_0x1fe746){return new Promise(function(_0x4bf0a0,_0x372b95){var _0x3b46e4=_0x1fe746['split'](':');var _0x41c892=_0x3b46e4[0x0];var _0x4b3b33=_0x3b46e4[0x1];if(_0x4b3b33!==''){var _0x4c183c=_0x4b3b33['split']('|');var _0x4c24b0=[];for(var _0x57eb3c=0x0;_0x57eb3c<_0x4c183c[_0x1a32('0x22')];_0x57eb3c++){if(_0x4c183c[_0x57eb3c]!==''){var _0x2309b3=_[_0x1a32('0x23')](promisesAdditionalPhones,{'contactId':_0x2d6637,'phone':_0x4c183c[_0x57eb3c]});if(_0x2309b3[_0x1a32('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0x1a32('0x1d')]({'contactId':_0x2d6637,'contactTypeId':_0x41c892,'phone':_0x4c183c[_0x57eb3c],'orderBy':orderBy});}}}_0x4bf0a0({'ok':0x1});}else _0x4bf0a0({'res':0x0});});}function createAdditionalPhone(_0x35af58,_0x19e0e6,_0x2edc3e,_0x48d69d){var _0x3a51e2='';var _0x2fe917='';var _0x37d660=_0x2edc3e[_0x1a32('0x24')]('§');_0x3a51e2=_0x37d660[0x0];if(_0x37d660[_0x1a32('0x22')]==0x2)_0x2fe917=_0x37d660[0x1];return new Promise(function(_0x1a8b5c,_0x821dbf){return db[_0x1a32('0x25')][_0x1a32('0x26')]({'where':{'CmContactId':_0x35af58,'item':_0x3a51e2}})['then'](function(_0x1af0dc){if(_0x1af0dc){return db[_0x1a32('0x25')]['update']({'ItemTypeId':_0x19e0e6,'description':_0x2fe917,'OrderBy':_0x48d69d},{'where':{'CmContactId':_0x35af58,'item':_0x3a51e2}})['then'](function(_0xd3bf6e){_0x1a8b5c({'res':'updated'});});}else{return db['CmContactHasItem'][_0x1a32('0x27')]({'CmContactId':_0x35af58,'item':_0x3a51e2,'ItemTypeId':_0x19e0e6,'description':_0x2fe917,'OrderBy':_0x48d69d,'ItemClass':'PHONE'})['then'](function(_0x488d58){_0x1a8b5c({'res':'inserted'});});}});});}function updateContact(_0x23015f){return new Promise(function(_0x1eeec4,_0x7c255c){var _0x277359=_0x23015f['id'];delete _0x23015f['id'];return db[_0x1a32('0x28')]['update'](_0x23015f,{'where':{'id':_0x277359}})['then'](function(_0x3d6385){updatedRows+=0x1;return db['CmHopper'][_0x1a32('0x29')]({'phone':_0x23015f[_0x1a32('0x11')]},{'where':{'ContactId':_0x277359}})[_0x1a32('0x1f')](function(_0x4cecdc){_0x1eeec4({'ret':'OK'});});});});}function insertCmHopper(_0x24afda,_0x276626,_0x2121e2,_0x4648b7,_0x3acb50){var _0x454e69=[_0x1a32('0x2a'),_0x1a32('0x2b'),_0x1a32('0x2c'),'cm_contacts.ListId',_0x276626+'.'+_0x4648b7,_0x1a32('0x2d'),_0x1a32('0x2e'),_0x1a32('0x2f'),'cm_contacts.UserId','\x22'+_0x3acb50+'\x22'];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x32'))[_0x1a32('0x33')]([_0x1a32('0x11'),_0x1a32('0x34'),_0x1a32('0x35'),_0x1a32('0x36'),_0x4648b7,_0x1a32('0x37'),_0x1a32('0x38'),_0x1a32('0x39'),_0x1a32('0x3a'),_0x1a32('0x3b')],squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0x454e69)['from'](_0x276626)['join']('cm_contacts',null,_0x1a32('0x3e')+_0x276626+_0x1a32('0x3f'))[_0x1a32('0x40')](_0x2121e2,null,_0x2121e2+_0x1a32('0x13')+_0x276626+'.'+_0x4648b7)[_0x1a32('0x14')](_0x276626+'.CmListId\x20=\x20?',_0x24afda)[_0x1a32('0x14')](_0x1a32('0x41'),NOW)[_0x1a32('0x14')](_0x1a32('0x42'),selectNotIn(_0x276626,_0x2121e2,_0x4648b7,_0x1a32('0x32'),[_0x1a32('0x43'),'\x22onlyIfOpen\x22']))[_0x1a32('0x14')](_0x1a32('0x42'),selectNotIn(_0x276626,_0x2121e2,_0x4648b7,_0x1a32('0x32'),[_0x1a32('0x43')])))[_0x1a32('0x44')]();}function insertCmHopperBlack(_0x4d779c,_0x4b8551,_0x4dbab5,_0x5e58f7){var _0x3ce446=[_0x1a32('0x2a'),'cm_contacts.id',_0x1a32('0x45'),_0x4b8551+'.'+_0x5e58f7,_0x1a32('0x2d'),_0x1a32('0x2e')];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x46'))[_0x1a32('0x33')]([_0x1a32('0x11'),_0x1a32('0x35'),_0x1a32('0x36'),_0x5e58f7,_0x1a32('0x37'),_0x1a32('0x38')],squel[_0x1a32('0x3c')]()['fields'](_0x3ce446)[_0x1a32('0x12')](_0x4b8551)['join']('cm_contacts',null,_0x1a32('0x3e')+_0x4b8551+'.CmListId')[_0x1a32('0x40')](_0x4dbab5,null,_0x4dbab5+'.id\x20=\x20'+_0x4b8551+'.'+_0x5e58f7)[_0x1a32('0x14')](_0x4b8551+_0x1a32('0x47'),_0x4d779c)[_0x1a32('0x14')](_0x1a32('0x41'),NOW)[_0x1a32('0x14')](_0x1a32('0x42'),squel[_0x1a32('0x3c')]()[_0x1a32('0x10')](_0x1a32('0x11'))['from'](_0x1a32('0x46'))[_0x1a32('0x14')](_0x1a32('0x48'),_0x4d779c)['where'](_0x5e58f7+_0x1a32('0x49'),_0x4b8551+'.'+_0x5e58f7)))[_0x1a32('0x44')]();}function insertCmHopperAdditionalPhones(_0x3eb072){var _0x2862d6=[_0x1a32('0x4a'),'cm_contact_has_items.item',_0x1a32('0x4b'),_0x1a32('0x4c'),_0x1a32('0x4d')];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x4e'))[_0x1a32('0x33')]([_0x1a32('0x4f'),_0x1a32('0x11'),'OrderBy',_0x1a32('0x37'),_0x1a32('0x38')],squel[_0x1a32('0x3c')]()['fields'](_0x2862d6)[_0x1a32('0x12')](_0x1a32('0x32'))['join'](_0x1a32('0x50'),null,_0x1a32('0x51'))[_0x1a32('0x40')]('cm_contact_has_items',null,_0x1a32('0x52'))[_0x1a32('0x14')]('cm_hopper.ListId\x20=\x20?',_0x3eb072)[_0x1a32('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x196206,_0x4bf957,_0x5b4235,_0x1970b0){var _0xde3465=_[_0x1a32('0x53')](_[_0x1a32('0x54')](_0x1970b0),[_0x1a32('0x36'),_0x1a32('0x55'),_0x1a32('0x37'),'updatedAt']);return squel['insert']()[_0x1a32('0x31')]('cm_contacts')[_0x1a32('0x33')](_0xde3465,squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0xde3465)[_0x1a32('0x12')](_0x4bf957)[_0x1a32('0x14')]('('+_0x5b4235['join'](',')+_0x1a32('0x56'),squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0x5b4235)['from']('cm_contacts')['where'](_0x1a32('0x48'),_0x196206))[_0x1a32('0x14')](_0x1a32('0x57'),squel[_0x1a32('0x3c')]()[_0x1a32('0x10')](_0x1a32('0x58'),'min_id')['from'](_0x4bf957)[_0x1a32('0x59')](_0x5b4235[_0x1a32('0x40')](','))))[_0x1a32('0x44')]();}function handleStop(){logger[_0x1a32('0x5a')](_0x1a32('0x5b'));stopped=!![];}function handleUncaughtException(_0x3d1f6a){logger[_0x1a32('0x5c')](_0x3d1f6a['message']);process[_0x1a32('0x5d')](0x1);}function handleError(_0x142d88,_0x15a37c){stats[_0x1a32('0x5e')]['push']({'name':_0x15a37c[_0x1a32('0x5f')],'message':_0x15a37c[_0x1a32('0x21')],'row':_0x142d88});}function handleQuery(_0x5c1cb6){logger[_0x1a32('0x5a')](_0x5c1cb6);return db[_0x1a32('0x17')][_0x1a32('0x18')](_0x5c1cb6)[_0x1a32('0x1a')](function(_0x2bc60f){results[_0x1a32('0x1d')](_0x2bc60f);})[_0x1a32('0x20')](function(_0x3d55c8){logger[_0x1a32('0x5c')](_0x3d55c8[_0x1a32('0x21')]);});}function main(_0x493194,_0x11f231,_0x3d0b2e,_0x5b6bc8){logger[_0x1a32('0x5a')](_0x1a32('0x60'),_0x493194,JSON['stringify'](_0x11f231));process['send'](_0x1a32('0x61'));var _0x3f0803=_0x11f231[_0x1a32('0x62')];var _0x32b3cb=_[_0x1a32('0x63')](_0x3f0803);var _0x3b5084=_0x11f231[_0x1a32('0x64')];var _0x552536=path[_0x1a32('0x40')](config[_0x1a32('0x65')],'server/files/tmp',_0x3b5084+_0x1a32('0x66'));logger[_0x1a32('0x5a')](_0x1a32('0x67'),_0x11f231);db[_0x1a32('0x68')][_0x1a32('0x69')]({'raw':!![],'attributes':['id',_0x1a32('0x6a')]})[_0x1a32('0x1f')](function(_0x3ea785){for(var _0x2c6405=0x0;_0x2c6405<_0x3ea785[_0x1a32('0x22')];_0x2c6405++){if(_0x3ea785[_0x2c6405][_0x1a32('0x6a')]in _0x3f0803){contactItemTypes[_0x1a32('0x1d')](_0x3ea785[_0x2c6405]);delete _0x32b3cb[_0x3ea785[_0x2c6405]['name']];hasAdditionalPhones=!![];}for(var _0x573c03 in _0x3f0803){if(_0x3ea785[_0x2c6405][_0x1a32('0x6a')]+_0x1a32('0x6b')===_0x573c03){phoneDescriptions[_0x1a32('0x1d')]({'itemTypeId':_0x3ea785[_0x2c6405]['id'],'description':_0x573c03});delete _0x32b3cb[_0x573c03];}}}if(hasAdditionalPhones)_0x32b3cb[_0x1a32('0x1c')]='';var _0x27e088=_['keys'](_0x32b3cb)['join']();logger[_0x1a32('0x5a')](_0x1a32('0x6c'),_0x27e088);fs['writeFileSync'](_0x552536,_0x27e088+'\x0a');Papa[_0x1a32('0x6d')](fs[_0x1a32('0x6e')](_0x493194),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d32f1,_0x5d2de7){try{for(var _0x4bd526=0x0,_0x322f79=[];_0x4bd526<_0x3d32f1[_0x1a32('0x6f')][_0x1a32('0x22')];_0x4bd526++){stats[_0x1a32('0x70')]+=0x1;if(_0x3d32f1[_0x1a32('0x5e')][_0x4bd526]){handleError(_0x3d32f1['data'][_0x4bd526],_0x3d32f1['errors'][_0x4bd526]);}else{var _0x241d6b=[];var _0x125b2=[];var _0x297a79={};for(var _0x539e38 in _0x3f0803){let _0x46b333=contactItemTypes[_0x1a32('0x71')](_0x2276c1=>_0x2276c1['name']===_0x539e38);let _0x4bc025=contactItemTypes['find'](_0x26c6b3=>_0x26c6b3[_0x1a32('0x6a')]+_0x1a32('0x6b')===_0x539e38);if(_['isNil'](_0x46b333)&&_[_0x1a32('0x1b')](_0x4bc025)){if(_0x3f0803[_0x1a32('0x72')](_0x539e38)){if(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38]]){var _0x1fbe2a=_[_0x1a32('0x73')](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38]][_0x1a32('0x74')](/"/g,'\x27'));switch(_0x539e38){case _0x1a32('0x34'):var _0x242090=moment(_0x1fbe2a,_0x1a32('0xd'),!![]);if(_0x242090['isValid']()){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x75'));}break;case _0x1a32('0x39'):var _0x3109d6=parseInt(_0x1fbe2a);_0x1fbe2a=_[_0x1a32('0x76')](_0x3109d6)||_0x3109d6<0x0||_0x3109d6>0x4?_0x5b6bc8?0x3:0x2:_0x3109d6;_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');break;case _0x1a32('0x3a'):var _0x1aee45=parseInt(_0x1fbe2a);if(_[_0x1a32('0x77')](_0x1aee45)&&_[_0x1a32('0x78')](_0x3d0b2e,_0x1aee45)){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1aee45+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x79'));}break;case'email':if(isEmail(_0x1fbe2a)){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x104ddb=moment(_0x1fbe2a,_0x1a32('0x7a'),!![]);if(_0x104ddb[_0x1a32('0x7b')]()){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x7c'));}break;default:_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}}else{switch(_0x539e38){case _0x1a32('0x7d'):case _0x1a32('0x11'):_0x241d6b[_0x1a32('0x1d')](_0x539e38+_0x1a32('0x7e'));break;default:_0x322f79[_0x1a32('0x1d')]('\x22\x22');}}}}else{var _0x46de0f='';if(!_[_0x1a32('0x1b')](_0x46b333)){if(!_0x297a79[_0x1a32('0x72')](_0x46b333['id'])){for(var _0x1439d0=0x0;_0x1439d0<_0x3f0803[_0x539e38][_0x1a32('0x22')];_0x1439d0++){var _0x1fbe2a=_[_0x1a32('0x73')](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38][_0x1439d0]][_0x1a32('0x74')](/"/g,'\x27'));var _0x139d47=phoneDescriptions[_0x1a32('0x71')](_0x3adbf9=>_0x3adbf9['itemTypeId']===_0x46b333['id']);if(!_['isNil'](_0x139d47)){var _0xffd369=_['trim'](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x139d47[_0x1a32('0x7f')]][0x0]][_0x1a32('0x74')](/"/g,'\x27'));if(!_[_0x1a32('0x1b')](_0xffd369))_0x1fbe2a=_0x1fbe2a+'§'+_0xffd369;}if(_0x46de0f=='')_0x46de0f=_0x1fbe2a;else _0x46de0f+='|'+_0x1fbe2a;}_0x125b2[_0x1a32('0x1d')](_0x46b333['id']+':'+_0x46de0f);_0x297a79[_0x46b333['id']]=0x1;}}}}if(hasAdditionalPhones){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x125b2[_0x1a32('0x40')](';')+'\x22');}if(_0x241d6b['length']){handleError(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526],{'code':_0x1a32('0x80'),'message':_0x241d6b[_0x1a32('0x40')]()});}else{fs[_0x1a32('0x81')](_0x552536,_0x322f79[_0x1a32('0x40')]()+'\x0a');}_0x322f79=[];}if(!(stats[_0x1a32('0x70')]%0xc8)){socket[_0x1a32('0x82')](_0x1a32('0x83')+_0x3b5084,stats);stats[_0x1a32('0x5e')]=[];}}if(stopped){logger[_0x1a32('0x5a')](_0x1a32('0x84'));_0x5d2de7['abort']();}}catch(_0x55d980){handleError(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526],{'code':_0x1a32('0x85'),'message':_0x55d980[_0x1a32('0x21')]});logger[_0x1a32('0x5c')](_0x1a32('0x86'),_0x55d980[_0x1a32('0x21')]);}},'complete':function(){try{var _0x346493=[];var _0x8f3c6b=tempTableName;_0x346493['push']('CREATE\x20TABLE\x20'+_0x8f3c6b+_0x1a32('0x87'));logger[_0x1a32('0x5a')](_0x1a32('0x88'),contactItemTypes['length']);var _0x31be82=util['format'](_0x1a32('0x89'),_0x552536,_0x8f3c6b,_0x27e088,_0x11f231['ListId'],_0x11f231[_0x1a32('0x55')]||null,NOW,NOW);if(_[_0x1a32('0x1b')](_0x3f0803[_0x1a32('0x34')])){_0x31be82+=_0x1a32('0x8a');}_0x346493[_0x1a32('0x1d')](_0x31be82);BPromise['each'](_0x346493,handleQuery)['then'](function(_0x37dde6){BPromise[_0x1a32('0x1e')]([handleAdditionalPhones()])[_0x1a32('0x1f')](function(){_0x346493=[];for(var _0xbdd559=0x0;_0xbdd559\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','replace','{OPERATOR}','escapeLIKESpecialChars','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','length','find','buildExpression'];(function(_0x5ba206,_0x19ae8b){var _0x52c199=function(_0x5a06a5){while(--_0x5a06a5){_0x5ba206['push'](_0x5ba206['shift']());}};_0x52c199(++_0x19ae8b);}(_0x869e,0x1b0));var _0xe869=function(_0x9ffa53,_0x5d2878){_0x9ffa53=_0x9ffa53-0x0;var _0x5bc2f9=_0x869e[_0x9ffa53];return _0x5bc2f9;};'use strict';var _=require(_0xe869('0x0'));var squel=require(_0xe869('0x1'));var as=require(_0xe869('0x2'));var qs=require(_0xe869('0x3'));var updateInteraction=require(_0xe869('0x4'))[_0xe869('0x5')];var utils=require(_0xe869('0x6'));var db=require(_0xe869('0x7'))['db'];function skipInteractionsQuery(_0x5c1230,_0x5ae504,_0x4ce6af){var _0x30bafb=![];var _0x402ebe=utils[_0xe869('0x8')](_0x5c1230);if(_0x5ae504[_0xe869('0x9')]===_0xe869('0xa')&&!_0x4ce6af[_0xe869('0xb')]&&!_0x4ce6af[_0x402ebe]){_0x30bafb=!![];}return _0x30bafb;}function getTagsQuery(){return squel[_0xe869('0xc')]()[_0xe869('0xd')]('id')[_0xe869('0xd')](_0xe869('0xe'))[_0xe869('0xd')](_0xe869('0xf'))[_0xe869('0x10')](_0xe869('0x11'));}function getUsersQuery(_0x1f16c1,_0x19fc36){var _0x169899=utils['getInteractionFK'](_0x1f16c1);var _0x5b39a0=_0xe869('0x12')+_0x1f16c1+_0xe869('0x13');var _0x9eb474=squel[_0xe869('0xc')]()['field'](_0xe869('0x14'))[_0xe869('0xd')]('u.fullname')['field'](_0xe869('0x15')+_0x169899)[_0xe869('0x10')](_0x5b39a0,'ui')[_0xe869('0x16')]('users','u',_0xe869('0x17'));if(_0x19fc36['length']>0x0){_0x9eb474['where']('ui.'+_0x169899+'\x20IN\x20?',_[_0xe869('0x18')](_0x19fc36,'id'));}return _0x9eb474;}function getInteractionsQuery(_0x5f0a67){var _0x4248b8=utils[_0xe869('0x19')](_0x5f0a67);var _0x238255=utils[_0xe869('0x8')](_0x5f0a67);var _0x52c24c=utils[_0xe869('0x1a')](_0x5f0a67);return squel[_0xe869('0xc')]()[_0xe869('0x10')](_0x4248b8[_0xe869('0x1b')],'i')[_0xe869('0x16')](_0xe869('0x1c'),'c',_0xe869('0x1d'))['left_join'](_0xe869('0x1e'),'o',_0xe869('0x1f'))[_0xe869('0x16')](_0x4248b8[_0xe869('0x20')],'a',_0xe869('0x21')+_0x238255)[_0xe869('0x16')](_0x4248b8[_0xe869('0x22')],'me',_0xe869('0x23')+_0x52c24c+_0xe869('0x24'))[_0xe869('0x16')](_0x4248b8[_0xe869('0x25')],'it',_0xe869('0x26')+_0x52c24c+_0xe869('0x24'))['left_join'](_0xe869('0x11'),'t',_0xe869('0x27'));}function getSqlClauses(){var _0xc4a8a8={'body':squel[_0xe869('0x28')](),'contact':squel[_0xe869('0x28')](),'default':squel['expr'](),'fields':squel[_0xe869('0x28')](),'filter':squel[_0xe869('0x28')](),'read':squel[_0xe869('0x28')](),'tags':{'clause':squel[_0xe869('0x28')](),'ids':null},'user':squel[_0xe869('0x28')]()};return _0xc4a8a8;}function parseTagParameter(_0x111113){var _0x463641=squel[_0xe869('0x28')]();if(_0x111113){var _0x56126c=utils[_0xe869('0x29')](_0x111113);_0x56126c['forEach'](function(_0x4be34b){_0x463641['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4be34b+',%');});}return _0x463641;}function parseReadParameter(_0x616b40){var _0x4e0a91='';if(_0x616b40){_0x4e0a91='unreadMessages\x20{OPERATOR}\x200';if(_0x616b40==='1'){_0x4e0a91=_0x4e0a91[_0xe869('0x2a')](_0xe869('0x2b'),'=');}else{_0x4e0a91=_0x4e0a91[_0xe869('0x2a')](_0xe869('0x2b'),'>');}}return _0x4e0a91;}function parseSearchFilter(_0x69a3fe,_0x335bd8){var _0x19465a=squel[_0xe869('0x28')]();if(_0x335bd8){var _0x5b2e8e=_0x335bd8[_0xe869('0x2a')]('\x5c','\x5c\x5c')[_0xe869('0x2a')](/'/g,'\x27\x27');var _0x3463e1=qs[_0xe869('0x2c')](_0x5b2e8e);if(qs['isNumeric'](_0x5b2e8e)){_0x19465a['or']('i.id\x20LIKE\x20?',_0x3463e1+'%');if([_0xe869('0x2d'),_0xe869('0x2e')]['includes'](_0x69a3fe)){_0x19465a['or'](_0xe869('0x2f'),_0x3463e1+'%');}else if(_0x69a3fe===_0xe869('0x30')){_0x19465a['or'](_0xe869('0x31'),_0x3463e1+'%');}else if(_0x69a3fe==='openchannel'){_0x19465a['or'](_0xe869('0x32'),_0x3463e1+'%');}}else if(_0x69a3fe==='mail'&&qs['isEmail'](_0x5b2e8e)){_0x19465a['or'](_0xe869('0x33'),_0x3463e1+'%');}else{if(_0x69a3fe===_0xe869('0x34')){_0x19465a['or'](_0xe869('0x35'),qs['getFullTextValue'](_0x5b2e8e,!![]))['or'](_0xe869('0x36'),qs[_0xe869('0x37')](_0x5b2e8e));}else if(_0x69a3fe!==_0xe869('0x30')){_0x19465a['or'](_0xe869('0x38'),qs[_0xe869('0x37')](_0x5b2e8e));}_0x19465a['or'](_0xe869('0x39'),qs[_0xe869('0x37')](_0x5b2e8e,!![]),null);}}return _0x19465a;}function parseAdvancedSearchFilter(_0x3a5878,_0x5aa2b5){var _0x3144e8=getSqlClauses();var _0x53ac03=as[_0xe869('0x3a')](_0x3a5878);var _0x127cef=_0x53ac03['sqlOperator'];for(var _0x283d77=0x0;_0x283d77<_0x53ac03[_0xe869('0x3b')][_0xe869('0x3c')];_0x283d77++){var _0x288cc4=_0x53ac03[_0xe869('0x3b')][_0x283d77];var _0x3552be='i';var _0x37d95c=_[_0xe869('0x3d')](_0x5aa2b5,[_0xe869('0xe'),_0x288cc4['field']]);if(_0x37d95c){var _0xd384ff=as[_0xe869('0x3e')](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8[_0xe869('0x40')][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff['value'][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')]['end']);}else{switch(_0x288cc4['field']){case _0xe869('0x44'):var _0x55adcc=parseReadParameter(_0x288cc4[_0xe869('0x43')]);_0x3144e8['read'][_0xe869('0x45')](_0x55adcc);break;case _0xe869('0x46'):if(_0x288cc4['operator']===_0xe869('0x47')){if(_0x288cc4['value'][_0xe869('0x48')]('\x20')[_0xe869('0x3c')]>0x1){_0x3144e8[_0xe869('0x49')][_0x127cef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe869('0x37')](_0x288cc4['value'],!![]),null);}else{var _0x4e9559='%'+_0x288cc4['value']+'%';_0x3144e8['contact'][_0x127cef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e9559,_0x4e9559,_0x4e9559);}}else{_0x37d95c=_[_0xe869('0x3d')](_0x5aa2b5,['name',_0xe869('0x4a')]);_0x288cc4['field']=_0xe869('0x4a');_0xd384ff=as['buildExpression'](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8['contact'][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff[_0xe869('0x43')]['start'],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);}break;case _0xe869('0x4c'):var _0x2d45ab=_0x288cc4[_0xe869('0x43')][_0xe869('0x48')](',')[_0xe869('0x18')](function(_0x1906ef){return Number(_0x1906ef);});var _0x134050=parseTagParameter(_0x2d45ab);_0x3144e8[_0xe869('0x4d')][_0xe869('0x4e')][_0xe869('0x45')](_0x134050);_0x3144e8[_0xe869('0x4d')]['ids']=_0x2d45ab;break;case _0xe869('0x4f'):if(_0x288cc4['operator']===_0xe869('0x47')){_0x3144e8[_0xe869('0x50')][_0x127cef](_0xe869('0x51'),'%'+_0x288cc4['value']+'%',null);}else{_0x37d95c=_['find'](_0x5aa2b5,[_0xe869('0xe'),_0xe869('0x52')]);_0x288cc4[_0xe869('0xd')]=_0xe869('0x52');_0xd384ff=as['buildExpression'](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8[_0xe869('0x50')][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff[_0xe869('0x43')][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);}break;case _0xe869('0x53'):case _0xe869('0x54'):_0xd384ff=as['buildExpression']('me',null,_0x288cc4);_0x3144e8[_0xe869('0x53')][_0x127cef](_0xd384ff['text'],_0xd384ff[_0xe869('0x43')][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);break;}}}return _0x3144e8;}function parseModelFields(_0x11f840,_0x8b068c,_0x40fb0d){var _0x44b515=utils[_0xe869('0x8')](_0x11f840);var _0x27dd4b=squel[_0xe869('0x28')]();var _0xb53a85=_(_0x8b068c)['keys']()[_0xe869('0x18')](function(_0x4b8734){return _['some'](_0x40fb0d,[_0xe869('0xe'),_0x4b8734])?_0x4b8734:undefined;})[_0xe869('0x55')]()[_0xe869('0x43')]();if(_0xb53a85[_0xe869('0x3c')]>0x0){_0xb53a85['forEach'](function(_0x9b17c9){if(_0x9b17c9===_0x44b515){_0x27dd4b[_0xe869('0x45')]('i.'+_0x44b515+_0xe869('0x56'),[]['concat'](_0x8b068c[_0x9b17c9]));}else if(_0x9b17c9===_0xe869('0x57')){var _0xf79fcc=JSON[_0xe869('0x58')](_0x8b068c[_0x9b17c9])[_0xe869('0x59')];var _0x40f4bb=JSON['parse'](_0x8b068c[_0x9b17c9])['$lte'];_0x27dd4b[_0xe869('0x45')](_0xe869('0x5a'),_0xf79fcc,_0x40f4bb);}else{if(_0x8b068c[_0x9b17c9]==='null'){_0x27dd4b[_0xe869('0x45')]('i.'+_0x9b17c9+_0xe869('0x5b'));}else{_0x27dd4b[_0xe869('0x45')]('i.'+_0x9b17c9+_0xe869('0x5c'),_0x8b068c[_0x9b17c9]);}}});}return _0x27dd4b;}function parseQueryParameters(_0x5d5716,_0x37d65e,_0x108429){var _0x39a4ce=getSqlClauses();return Promise['resolve']()[_0xe869('0x5d')](function(){return parseModelFields(_0x5d5716,_0x37d65e,_0x108429);})[_0xe869('0x5d')](function(_0x93f09e){_0x39a4ce[_0xe869('0x5e')][_0xe869('0x45')](_0x93f09e);return parseReadParameter(_0x37d65e[_0xe869('0x5f')]);})['then'](function(_0x42fdb9){_0x39a4ce[_0xe869('0x5f')][_0xe869('0x45')](_0x42fdb9);return parseTagParameter(_0x37d65e['tag']);})[_0xe869('0x5d')](function(_0x5e6917){_0x39a4ce[_0xe869('0x4d')][_0xe869('0x4e')][_0xe869('0x45')](_0x5e6917);return parseSearchFilter(_0x5d5716,_0x37d65e[_0xe869('0x60')]);})['then'](function(_0x3a2603){_0x39a4ce['filter']=_0x3a2603;return _0x39a4ce;});}function checkAccountsRestrictions(_0x5466a1,_0x388817,_0x477453){var _0x4a1485=utils[_0xe869('0x8')](_0x5466a1);var _0x255f18=_0xe869('0x61')+_[_0xe869('0x62')](_0x5466a1)+(_0x5466a1===_0xe869('0x63')?_0xe869('0x64'):_0xe869('0x65'));var _0x4831cf=squel[_0xe869('0x28')]();return Promise[_0xe869('0x66')]()[_0xe869('0x5d')](function(){if(_0x477453[_0xe869('0xb')]&&_0x388817[_0xe869('0x9')]===_0xe869('0xa')){return _0x388817[_0x255f18]({'attributes':['id'],'raw':!![]});}})[_0xe869('0x5d')](function(_0x403f30){if(_0x403f30){if(_0x403f30['length']===0x0){_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+'\x20IS\x20NULL');}else{_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+_0xe869('0x56'),_[_0xe869('0x18')](_0x403f30,'id'));}}else if(!_0x477453[_0x4a1485]){_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+_0xe869('0x67'));}})[_0xe869('0x5d')](function(){return _0x4831cf;});}function getClosedOrderClause(_0x5888e3,_0xf799e2){var _0x3c8a89='';var _0x1266d9=[_0xe869('0x68'),_0xe869('0x69'),_0xe869('0x6a')];if(_0x5888e3===_0xe869('0x34')){_0x1266d9['unshift'](_0xe869('0x6b'));}if(_0xf799e2['closed']==='0'&&_0x5888e3==='mail'){_0x3c8a89=_0xe869('0x6b');}else{if(_0xf799e2[_0xe869('0x6c')]==='1'){_0x1266d9[_0xe869('0x6d')]();}_0x3c8a89=_0xe869('0x6e')+_0x1266d9['join'](',\x20')+')';}return _0x3c8a89;}function getFilteredInteractions(_0x317ac0,_0x4b722c,_0x9d0b57,_0xe259ce){var _0x9896bc=utils[_0xe869('0x1a')](_0x317ac0);var _0xa1d97d=_[_0xe869('0x62')](_0x317ac0)+_0xe869('0x6f');var _0x51c9cb=[];var _0x26385b=getTagsQuery();var _0x5ab39b={'type':db[_0xe869('0x70')]['QueryTypes']['SELECT'],'raw':!![]};var _0x234679=[];var _0x44e158=[];return db[_0xe869('0x71')][_0xe869('0x72')](_0x26385b[_0xe869('0x73')](),_0x5ab39b)['then'](function(_0x4cdbf6){_0x51c9cb=_[_0xe869('0x74')](_0x4cdbf6,'id');_0x5ab39b=_[_0xe869('0x75')](_0x5ab39b,{'model':db[_0xa1d97d],'mapToModel':!![],'nest':!![]});if(_0x9d0b57[_0xe869('0x5e')]){_0xe259ce[_0xe869('0x76')]['forEach'](function(_0x1b9a54){_0x4b722c[_0xe869('0xd')]('i.'+_0x1b9a54);});}else{_0x4b722c[_0xe869('0xd')](_0xe869('0x77'),_0xe869('0x44'));_0x4b722c['field'](_0xe869('0x78'),_0xe869('0x79'));_0x4b722c['field'](_0xe869('0x7a'),'Account.mandatoryDisposition');if(_0x317ac0===_0xe869('0x34')){_0x4b722c[_0xe869('0xd')](_0xe869('0x7b'),'Account.email');_0x4b722c[_0xe869('0xd')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe869('0x7c'));_0x4b722c[_0xe869('0xd')](_0xe869('0x7d'));_0x4b722c[_0xe869('0xd')](_0xe869('0x7e'));_0x4b722c[_0xe869('0xd')]('i.updatedAt');_0x4b722c['field'](_0xe869('0x7f'));_0x4b722c[_0xe869('0xd')](_0xe869('0x80'));_0x4b722c[_0xe869('0xd')]('i.attach');_0x4b722c['field'](_0xe869('0x81'));_0x4b722c['field'](_0xe869('0x82'));_0x4b722c[_0xe869('0xd')](_0xe869('0x83'));_0x4b722c['field']('i.disposition');_0x4b722c[_0xe869('0xd')](_0xe869('0x69'));_0x4b722c[_0xe869('0xd')]('i.thirdDisposition');_0x4b722c[_0xe869('0xd')](_0xe869('0x6b'));_0x4b722c['field'](_0xe869('0x84'));_0x4b722c[_0xe869('0xd')](_0xe869('0x85'));_0x4b722c[_0xe869('0xd')](_0xe869('0x86'));_0x4b722c[_0xe869('0xd')]('i.UserId');}else if(_0x317ac0===_0xe869('0x87')){_0x4b722c[_0xe869('0xd')](_0xe869('0x88'),_0xe869('0x7c'));}else{_0x4b722c[_0xe869('0xd')](_0xe869('0x89'),_0xe869('0x7c'));}if(_0x317ac0!==_0xe869('0x34')){_0x4b722c[_0xe869('0xd')](_0xe869('0x8a'));}_0x4b722c[_0xe869('0xd')](_0xe869('0x8b'),_0xe869('0x8c'));_0x4b722c['field']('c.lastName',_0xe869('0x8d'));_0x4b722c[_0xe869('0xd')](_0xe869('0x8e'),_0xe869('0x8f'));_0x4b722c['field']('c.phone',_0xe869('0x90'));_0x4b722c['field'](_0xe869('0x91'),_0xe869('0x92'));_0x4b722c[_0xe869('0xd')](_0xe869('0x93'),'Contact.fax');_0x4b722c['field'](_0xe869('0x94'),_0xe869('0x95'));_0x4b722c[_0xe869('0xd')](_0xe869('0x96'),_0xe869('0x97'));_0x4b722c[_0xe869('0xd')](_0xe869('0x98'),_0xe869('0x99'));}if(_0xe259ce[_0xe869('0x9a')]){_0x4b722c[_0xe869('0x9a')](_0xe259ce[_0xe869('0x9a')]);}if(_0xe259ce[_0xe869('0x9b')]){_0x4b722c[_0xe869('0x9b')](_0xe259ce['offset']);}return db[_0xe869('0x71')]['query'](_0x4b722c['toString'](),_0x5ab39b);})[_0xe869('0x5d')](function(_0x188eaa){_0x234679=_0x188eaa;var _0x5b6cb2=getUsersQuery(_0x317ac0,_0x234679);return db[_0xe869('0x71')][_0xe869('0x72')](_0x5b6cb2['toString'](),_0x5ab39b);})[_0xe869('0x5d')](function(_0x55aeb6){_0x44e158=_[_0xe869('0x9c')](_0x55aeb6,_0x9896bc);if(_0x317ac0===_0xe869('0x34')){return db[_0xe869('0x9d')][_0xe869('0x9e')]({'attributes':[_0xe869('0x9f')],'raw':!![]});}})['then'](function(_0x2a32b9){var _0x51cd14=_0x2a32b9?_0x2a32b9['enableEmailPreview']:undefined;var _0x227e13=_0x234679[_0xe869('0x18')](function(_0x464de6){return updateInteraction(_0x464de6,_0x51c9cb,_0x44e158,_0x51cd14);});return Promise[_0xe869('0xa0')](_0x227e13);});}function countFilteredInteractions(_0x14940b,_0x1976a7){var _0x48dfbd=_0x14940b['clone']();_0x48dfbd[_0xe869('0xd')](_0xe869('0xa1'));_0x48dfbd[_0xe869('0xd')](_0xe869('0x77'),_0xe869('0x44'));var _0x3570d6=utils['getSelectedTags'](_0x1976a7);if(!_['isEmpty'](_0x3570d6)){_0x48dfbd['where'](_0xe869('0xa2'),_0x3570d6);}var _0x5ef769={'type':db['Sequelize'][_0xe869('0xa3')]['SELECT'],'raw':!![]};return db[_0xe869('0x71')][_0xe869('0x72')](_0x48dfbd['toString'](),_0x5ef769);}module[_0xe869('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd424=['it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','length','find','name','buildExpression','default','text','value','start','unreadMessages','read','and','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','end','Tag','tags','clause','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','capitalize','Websites','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','Interaction','Sequelize','QueryTypes','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','Account.email','contactName','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.substatus','i.ContactId','i.MailAccountId','i.UserId','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','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','agent','search','select','field','from','user_has_','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags'];(function(_0x53481c,_0x411919){var _0x15bd43=function(_0x209111){while(--_0x209111){_0x53481c['push'](_0x53481c['shift']());}};_0x15bd43(++_0x411919);}(_0xd424,0x115));var _0x4d42=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd424[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var squel=require(_0x4d42('0x0'));var as=require(_0x4d42('0x1'));var qs=require(_0x4d42('0x2'));var updateInteraction=require('./update-interaction')[_0x4d42('0x3')];var utils=require('./utils');var db=require(_0x4d42('0x4'))['db'];function skipInteractionsQuery(_0x1d2b72,_0x4c3d9b,_0x3918d5){var _0xc234fc=![];var _0x904bcd=utils[_0x4d42('0x5')](_0x1d2b72);if(_0x4c3d9b['role']===_0x4d42('0x6')&&!_0x3918d5[_0x4d42('0x7')]&&!_0x3918d5[_0x904bcd]){_0xc234fc=!![];}return _0xc234fc;}function getTagsQuery(){return squel[_0x4d42('0x8')]()[_0x4d42('0x9')]('id')[_0x4d42('0x9')]('name')[_0x4d42('0x9')]('color')[_0x4d42('0xa')]('tools_tags');}function getUsersQuery(_0x40c868,_0x5d9568){var _0x2d0f50=utils['getInteractionFK'](_0x40c868);var _0x584703=_0x4d42('0xb')+_0x40c868+'_interactions';var _0x2ac3fa=squel[_0x4d42('0x8')]()[_0x4d42('0x9')](_0x4d42('0xc'))['field'](_0x4d42('0xd'))[_0x4d42('0x9')](_0x4d42('0xe')+_0x2d0f50)[_0x4d42('0xa')](_0x584703,'ui')['left_join']('users','u',_0x4d42('0xf'));if(_0x5d9568['length']>0x0){_0x2ac3fa[_0x4d42('0x10')]('ui.'+_0x2d0f50+_0x4d42('0x11'),_[_0x4d42('0x12')](_0x5d9568,'id'));}return _0x2ac3fa;}function getInteractionsQuery(_0x212e5e){var _0x2950f4=utils[_0x4d42('0x13')](_0x212e5e);var _0x4340a5=utils[_0x4d42('0x5')](_0x212e5e);var _0x35d776=utils[_0x4d42('0x14')](_0x212e5e);return squel['select']()[_0x4d42('0xa')](_0x2950f4[_0x4d42('0x15')],'i')['left_join']('cm_contacts','c',_0x4d42('0x16'))[_0x4d42('0x17')](_0x4d42('0x18'),'o','o.id\x20=\x20i.UserId')[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x19')],'a',_0x4d42('0x1a')+_0x4340a5)[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x1b')],'me',_0x4d42('0x1c')+_0x35d776+_0x4d42('0x1d'))[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x1e')],'it',_0x4d42('0x1f')+_0x35d776+'\x20=\x20i.id')[_0x4d42('0x17')](_0x4d42('0x20'),'t',_0x4d42('0x21'));}function getSqlClauses(){var _0x35713b={'body':squel[_0x4d42('0x22')](),'contact':squel['expr'](),'default':squel[_0x4d42('0x22')](),'fields':squel[_0x4d42('0x22')](),'filter':squel[_0x4d42('0x22')](),'read':squel[_0x4d42('0x22')](),'tags':{'clause':squel[_0x4d42('0x22')](),'ids':null},'user':squel[_0x4d42('0x22')]()};return _0x35713b;}function parseTagParameter(_0x3989b8){var _0x440bf8=squel['expr']();if(_0x3989b8){var _0x5200c8=utils[_0x4d42('0x23')](_0x3989b8);_0x5200c8[_0x4d42('0x24')](function(_0x1509eb){_0x440bf8['or'](_0x4d42('0x25'),'%,'+_0x1509eb+',%');});}return _0x440bf8;}function parseReadParameter(_0xb47fc4){var _0xd5777c='';if(_0xb47fc4){_0xd5777c='unreadMessages\x20{OPERATOR}\x200';if(_0xb47fc4==='1'){_0xd5777c=_0xd5777c['replace'](_0x4d42('0x26'),'=');}else{_0xd5777c=_0xd5777c[_0x4d42('0x27')](_0x4d42('0x26'),'>');}}return _0xd5777c;}function parseSearchFilter(_0x3f5052,_0x33036e){var _0x5b4836=squel[_0x4d42('0x22')]();if(_0x33036e){var _0x3b7fb6=_0x33036e[_0x4d42('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x30a871=qs[_0x4d42('0x28')](_0x3b7fb6);if(qs['isNumeric'](_0x3b7fb6)){_0x5b4836['or'](_0x4d42('0x29'),_0x30a871+'%');if([_0x4d42('0x2a'),_0x4d42('0x2b')][_0x4d42('0x2c')](_0x3f5052)){_0x5b4836['or']('i.phone\x20LIKE\x20?',_0x30a871+'%');}else if(_0x3f5052===_0x4d42('0x2d')){_0x5b4836['or']('i.fax\x20LIKE\x20?',_0x30a871+'%');}else if(_0x3f5052===_0x4d42('0x2e')){_0x5b4836['or']('i.from\x20LIKE\x20?',_0x30a871+'%');}}else if(_0x3f5052===_0x4d42('0x2f')&&qs[_0x4d42('0x30')](_0x3b7fb6)){_0x5b4836['or'](_0x4d42('0x31'),_0x30a871+'%');}else{if(_0x3f5052===_0x4d42('0x2f')){_0x5b4836['or'](_0x4d42('0x32'),qs[_0x4d42('0x33')](_0x3b7fb6,!![]))['or'](_0x4d42('0x34'),qs[_0x4d42('0x33')](_0x3b7fb6));}else if(_0x3f5052!==_0x4d42('0x2d')){_0x5b4836['or'](_0x4d42('0x35'),qs['getFullTextValue'](_0x3b7fb6));}_0x5b4836['or'](_0x4d42('0x36'),qs[_0x4d42('0x33')](_0x3b7fb6,!![]),null);}}return _0x5b4836;}function parseAdvancedSearchFilter(_0x41e1e4,_0x498d74){var _0x2195da=getSqlClauses();var _0x4a65c8=as['parseSearch'](_0x41e1e4);var _0x122e37=_0x4a65c8[_0x4d42('0x37')];for(var _0x2a02c7=0x0;_0x2a02c7<_0x4a65c8[_0x4d42('0x38')][_0x4d42('0x39')];_0x2a02c7++){var _0x566e36=_0x4a65c8[_0x4d42('0x38')][_0x2a02c7];var _0x4450f4='i';var _0x16bf82=_[_0x4d42('0x3a')](_0x498d74,[_0x4d42('0x3b'),_0x566e36[_0x4d42('0x9')]]);if(_0x16bf82){var _0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82['type'],_0x566e36);_0x2195da[_0x4d42('0x3d')][_0x122e37](_0x524841[_0x4d42('0x3e')],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841[_0x4d42('0x3f')]['end']);}else{switch(_0x566e36[_0x4d42('0x9')]){case _0x4d42('0x41'):var _0x135ff8=parseReadParameter(_0x566e36['value']);_0x2195da[_0x4d42('0x42')][_0x4d42('0x43')](_0x135ff8);break;case _0x4d42('0x44'):if(_0x566e36[_0x4d42('0x45')]==='$substring'){if(_0x566e36[_0x4d42('0x3f')][_0x4d42('0x46')]('\x20')[_0x4d42('0x39')]>0x1){_0x2195da[_0x4d42('0x47')][_0x122e37](_0x4d42('0x36'),qs[_0x4d42('0x33')](_0x566e36['value'],!![]),null);}else{var _0x31e257='%'+_0x566e36[_0x4d42('0x3f')]+'%';_0x2195da[_0x4d42('0x47')][_0x122e37](_0x4d42('0x48'),_0x31e257,_0x31e257,_0x31e257);}}else{_0x16bf82=_[_0x4d42('0x3a')](_0x498d74,['name',_0x4d42('0x49')]);_0x566e36[_0x4d42('0x9')]=_0x4d42('0x49');_0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82[_0x4d42('0x4a')],_0x566e36);_0x2195da['contact'][_0x122e37](_0x524841['text'],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841['value'][_0x4d42('0x4b')]);}break;case _0x4d42('0x4c'):var _0x1b8994=_0x566e36['value'][_0x4d42('0x46')](',')['map'](function(_0x1cfdc4){return Number(_0x1cfdc4);});var _0x3b7f39=parseTagParameter(_0x1b8994);_0x2195da[_0x4d42('0x4d')][_0x4d42('0x4e')]['and'](_0x3b7f39);_0x2195da['tags'][_0x4d42('0x4f')]=_0x1b8994;break;case'User':if(_0x566e36[_0x4d42('0x45')]==='$substring'){_0x2195da['user'][_0x122e37](_0x4d42('0x50'),'%'+_0x566e36[_0x4d42('0x3f')]+'%',null);}else{_0x16bf82=_[_0x4d42('0x3a')](_0x498d74,[_0x4d42('0x3b'),_0x4d42('0x51')]);_0x566e36[_0x4d42('0x9')]='UserId';_0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82[_0x4d42('0x4a')],_0x566e36);_0x2195da['user'][_0x122e37](_0x524841['text'],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841['value']['end']);}break;case'body':case'plainBody':_0x524841=as[_0x4d42('0x3c')]('me',null,_0x566e36);_0x2195da[_0x4d42('0x52')][_0x122e37](_0x524841[_0x4d42('0x3e')],_0x524841['value'][_0x4d42('0x40')],_0x524841[_0x4d42('0x3f')][_0x4d42('0x4b')]);break;}}}return _0x2195da;}function parseModelFields(_0x363ab1,_0x311687,_0x183a3a){var _0x30c967=utils['getAccountFK'](_0x363ab1);var _0x361089=squel[_0x4d42('0x22')]();var _0x941ffc=_(_0x311687)[_0x4d42('0x53')]()['map'](function(_0x2ae5e0){return _[_0x4d42('0x54')](_0x183a3a,['name',_0x2ae5e0])?_0x2ae5e0:undefined;})[_0x4d42('0x55')]()[_0x4d42('0x3f')]();if(_0x941ffc['length']>0x0){_0x941ffc[_0x4d42('0x24')](function(_0x231727){if(_0x231727===_0x30c967){_0x361089['and']('i.'+_0x30c967+_0x4d42('0x11'),[][_0x4d42('0x56')](_0x311687[_0x231727]));}else if(_0x231727===_0x4d42('0x57')){var _0x1b6efe=JSON[_0x4d42('0x58')](_0x311687[_0x231727])[_0x4d42('0x59')];var _0x500c57=JSON[_0x4d42('0x58')](_0x311687[_0x231727])['$lte'];_0x361089[_0x4d42('0x43')](_0x4d42('0x5a'),_0x1b6efe,_0x500c57);}else{if(_0x311687[_0x231727]===_0x4d42('0x5b')){_0x361089[_0x4d42('0x43')]('i.'+_0x231727+_0x4d42('0x5c'));}else{_0x361089['and']('i.'+_0x231727+_0x4d42('0x5d'),_0x311687[_0x231727]);}}});}return _0x361089;}function parseQueryParameters(_0x2b1637,_0xeff49b,_0x1a71a0){var _0x56f669=getSqlClauses();return Promise[_0x4d42('0x5e')]()['then'](function(){return parseModelFields(_0x2b1637,_0xeff49b,_0x1a71a0);})[_0x4d42('0x5f')](function(_0xf077c4){_0x56f669[_0x4d42('0x60')][_0x4d42('0x43')](_0xf077c4);return parseReadParameter(_0xeff49b['read']);})[_0x4d42('0x5f')](function(_0x48e5dc){_0x56f669[_0x4d42('0x42')][_0x4d42('0x43')](_0x48e5dc);return parseTagParameter(_0xeff49b[_0x4d42('0x61')]);})[_0x4d42('0x5f')](function(_0x3babf4){_0x56f669[_0x4d42('0x4d')]['clause'][_0x4d42('0x43')](_0x3babf4);return parseSearchFilter(_0x2b1637,_0xeff49b['filter']);})['then'](function(_0x2a4490){_0x56f669['filter']=_0x2a4490;return _0x56f669;});}function checkAccountsRestrictions(_0x202c26,_0x82d945,_0x3213d8){var _0xf0fddd=utils[_0x4d42('0x5')](_0x202c26);var _0x3fc12e='get'+_[_0x4d42('0x62')](_0x202c26)+(_0x202c26==='chat'?_0x4d42('0x63'):'Accounts');var _0x22fb3a=squel['expr']();return Promise[_0x4d42('0x5e')]()[_0x4d42('0x5f')](function(){if(_0x3213d8[_0x4d42('0x7')]&&_0x82d945[_0x4d42('0x64')]===_0x4d42('0x6')){return _0x82d945[_0x3fc12e]({'attributes':['id'],'raw':!![]});}})[_0x4d42('0x5f')](function(_0x36530a){if(_0x36530a){if(_0x36530a['length']===0x0){_0x22fb3a[_0x4d42('0x43')]('i.'+_0xf0fddd+_0x4d42('0x5c'));}else{_0x22fb3a['and']('i.'+_0xf0fddd+_0x4d42('0x11'),_[_0x4d42('0x12')](_0x36530a,'id'));}}else if(!_0x3213d8[_0xf0fddd]){_0x22fb3a[_0x4d42('0x43')]('i.'+_0xf0fddd+_0x4d42('0x65'));}})[_0x4d42('0x5f')](function(){return _0x22fb3a;});}function getClosedOrderClause(_0x397772,_0x374d8e){var _0x5ddbed='';var _0x20f6c9=[_0x4d42('0x66'),_0x4d42('0x67'),_0x4d42('0x68')];if(_0x397772==='mail'){_0x20f6c9[_0x4d42('0x69')]('i.substatus');}if(_0x374d8e[_0x4d42('0x6a')]==='0'&&_0x397772===_0x4d42('0x2f')){_0x5ddbed='i.substatus';}else{if(_0x374d8e[_0x4d42('0x6a')]==='1'){_0x20f6c9['shift']();}_0x5ddbed='CONCAT_WS(\x27\x27,\x20'+_0x20f6c9['join'](',\x20')+')';}return _0x5ddbed;}function getFilteredInteractions(_0x263b0b,_0x5b6805,_0x31d7e4,_0x5858b4){var _0x1c6f98=utils[_0x4d42('0x14')](_0x263b0b);var _0x1c3f62=_[_0x4d42('0x62')](_0x263b0b)+_0x4d42('0x6b');var _0xa10d1d=[];var _0x534816=getTagsQuery();var _0x357009={'type':db[_0x4d42('0x6c')][_0x4d42('0x6d')]['SELECT'],'raw':!![]};var _0x3e7856=[];var _0x103867=[];return db['sequelize'][_0x4d42('0x6e')](_0x534816[_0x4d42('0x6f')](),_0x357009)[_0x4d42('0x5f')](function(_0x3fa983){_0xa10d1d=_['keyBy'](_0x3fa983,'id');_0x357009=_[_0x4d42('0x70')](_0x357009,{'model':db[_0x1c3f62],'mapToModel':!![],'nest':!![]});if(_0x31d7e4[_0x4d42('0x60')]){_0x5858b4[_0x4d42('0x71')][_0x4d42('0x24')](function(_0x506294){_0x5b6805[_0x4d42('0x9')]('i.'+_0x506294);});}else{_0x5b6805[_0x4d42('0x9')](_0x4d42('0x72'),_0x4d42('0x41'));_0x5b6805['field'](_0x4d42('0x73'),_0x4d42('0x74'));_0x5b6805[_0x4d42('0x9')]('a.mandatoryDisposition',_0x4d42('0x75'));if(_0x263b0b===_0x4d42('0x2f')){_0x5b6805[_0x4d42('0x9')]('a.email',_0x4d42('0x76'));_0x5b6805[_0x4d42('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x4d42('0x77'));_0x5b6805['field']('i.id');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x78'));_0x5b6805['field'](_0x4d42('0x79'));_0x5b6805[_0x4d42('0x9')]('i.closed');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7a'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7b'));_0x5b6805[_0x4d42('0x9')]('i.lastMsgAt');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7c'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7d'));_0x5b6805[_0x4d42('0x9')]('i.disposition');_0x5b6805[_0x4d42('0x9')]('i.secondDisposition');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x66'));_0x5b6805['field'](_0x4d42('0x7e'));_0x5b6805['field']('i.to');_0x5b6805['field'](_0x4d42('0x7f'));_0x5b6805['field'](_0x4d42('0x80'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x81'));}else if(_0x263b0b==='openchannel'){_0x5b6805[_0x4d42('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x4d42('0x77'));}else{_0x5b6805[_0x4d42('0x9')](_0x4d42('0x82'),_0x4d42('0x77'));}if(_0x263b0b!==_0x4d42('0x2f')){_0x5b6805[_0x4d42('0x9')]('i.*');}_0x5b6805[_0x4d42('0x9')](_0x4d42('0x83'),'Contact.firstName');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x84'),_0x4d42('0x85'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x86'),'Contact.email');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x87'),_0x4d42('0x88'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x89'),_0x4d42('0x8a'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8b'),'Contact.fax');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8c'),'Owner.fullname');_0x5b6805[_0x4d42('0x9')]('o.internal','Owner.internal');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8d'),_0x4d42('0x8e'));}if(_0x5858b4['limit']){_0x5b6805[_0x4d42('0x8f')](_0x5858b4[_0x4d42('0x8f')]);}if(_0x5858b4[_0x4d42('0x90')]){_0x5b6805['offset'](_0x5858b4[_0x4d42('0x90')]);}return db[_0x4d42('0x91')][_0x4d42('0x6e')](_0x5b6805[_0x4d42('0x6f')](),_0x357009);})[_0x4d42('0x5f')](function(_0x1b796e){_0x3e7856=_0x1b796e;var _0x105e5d=getUsersQuery(_0x263b0b,_0x3e7856);return db[_0x4d42('0x91')][_0x4d42('0x6e')](_0x105e5d[_0x4d42('0x6f')](),_0x357009);})['then'](function(_0x53ae8c){_0x103867=_['groupBy'](_0x53ae8c,_0x1c6f98);if(_0x263b0b===_0x4d42('0x2f')){return db['Setting'][_0x4d42('0x92')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x4d42('0x5f')](function(_0x72efd1){var _0x538c8b=_0x72efd1?_0x72efd1[_0x4d42('0x93')]:undefined;var _0x26aea1=_0x3e7856[_0x4d42('0x12')](function(_0x39c540){return updateInteraction(_0x39c540,_0xa10d1d,_0x103867,_0x538c8b);});return Promise['all'](_0x26aea1);});}function countFilteredInteractions(_0x183b22,_0x4a13d2){var _0x3dad4a=_0x183b22[_0x4d42('0x94')]();_0x3dad4a['field'](_0x4d42('0x95'));_0x3dad4a[_0x4d42('0x9')](_0x4d42('0x72'),'unreadMessages');var _0x2d3221=utils[_0x4d42('0x23')](_0x4a13d2);if(!_[_0x4d42('0x96')](_0x2d3221)){_0x3dad4a[_0x4d42('0x10')](_0x4d42('0x97'),_0x2d3221);}var _0x1665d0={'type':db[_0x4d42('0x6c')][_0x4d42('0x6d')][_0x4d42('0x98')],'raw':!![]};return db['sequelize'][_0x4d42('0x6e')](_0x3dad4a[_0x4d42('0x6f')](),_0x1665d0);}module[_0x4d42('0x99')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 2fac348..67b301a 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20a6=['plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','MailMessage','findOne','out','then'];(function(_0xf04aa,_0x3eecca){var _0x2dfdc0=function(_0x39f9ab){while(--_0x39f9ab){_0xf04aa['push'](_0xf04aa['shift']());}};_0x2dfdc0(++_0x3eecca);}(_0x20a6,0x1b1));var _0x620a=function(_0x531b8c,_0x3d63dc){_0x531b8c=_0x531b8c-0x0;var _0x4c011e=_0x20a6[_0x531b8c];return _0x4c011e;};'use strict';var _=require('lodash');var db=require(_0x620a('0x0'))['db'];function getInteractionUsers(_0x1a731f,_0x2c3de1){return new Promise(function(_0xb1d02b,_0x143dc4){try{var _0x187cf1=[];if(_0x2c3de1[_0x1a731f]){_0x187cf1=_0x2c3de1[_0x1a731f][_0x620a('0x1')](function(_0x1360a6){return{'id':_0x1360a6['id'],'fullname':_0x1360a6[_0x620a('0x2')]};});}return _0xb1d02b(_0x187cf1);}catch(_0x2e47ce){_0x143dc4(_0x2e47ce);}});}function getInteractionTags(_0x445a01,_0x5712bf){var _0x3d061b=[];if(_0x445a01){_0x445a01['split'](',')['forEach'](function(_0x2e4219){_0x3d061b[_0x620a('0x3')](_0x5712bf[_0x2e4219]);});}return _0x3d061b;}function updateWaitingCounter(_0xf7d5f0){if(_0xf7d5f0[_0x620a('0x4')]){_0xf7d5f0['waiting']-=0x1;}}function updateInteractionCounters(_0xf1a1d1){_0xf1a1d1[_0x620a('0x4')]=0x0;_0xf1a1d1[_0x620a('0x5')]=0x0;_0xf1a1d1[_0x620a('0x6')]=0x0;_0xf1a1d1['unmanaged']=0x0;_0xf1a1d1[_0x620a('0x7')]=0x0;_0xf1a1d1[_0x620a('0x8')]=0x0;if(_0xf1a1d1[_0x620a('0x9')]){if(_0xf1a1d1['disposition']===_0x620a('0x7')){_0xf1a1d1[_0x620a('0x7')]+=0x1;updateWaitingCounter(_0xf1a1d1);}if(_0xf1a1d1[_0x620a('0xa')]){_0xf1a1d1[_0x620a('0x6')]+=0x1;if(_0xf1a1d1[_0x620a('0x5')]){_0xf1a1d1[_0x620a('0x5')]-=0x1;}}else{if(_0xf1a1d1[_0x620a('0xb')]){_0xf1a1d1[_0x620a('0xc')]+=0x1;updateWaitingCounter(_0xf1a1d1);}}}else{if(!_0xf1a1d1[_0x620a('0xa')]){_0xf1a1d1['waiting']+=0x1;}if(_0xf1a1d1['UserId']){_0xf1a1d1[_0x620a('0x5')]+=0x1;updateWaitingCounter(_0xf1a1d1);}}_0xf1a1d1[_0x620a('0x8')]+=0x1;return _0xf1a1d1;}function getLastMessageText(_0x3cf665){return db[_0x620a('0xd')][_0x620a('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3cf665['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x620a('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x620a('0x10')](function(_0x3199a9){if(_0x3199a9&&_0x3199a9[_0x620a('0x11')]){_0x3cf665[_0x620a('0x12')]=_[_0x620a('0x13')](_0x3199a9['plainBody']);}return _0x3cf665;})[_0x620a('0x14')](function(_0x2406d6){throw _0x2406d6;});}exports[_0x620a('0x15')]=function(_0x1afd54,_0x24a2cd,_0x14e22c,_0x465235){return new Promise(function(_0xd40c5,_0xa8c330){return getInteractionUsers(_0x1afd54['id'],_0x14e22c)[_0x620a('0x10')](function(_0x5d38e3){_0x1afd54[_0x620a('0x16')]=_0x5d38e3;return getInteractionTags(_0x1afd54[_0x620a('0x17')],_0x24a2cd);})[_0x620a('0x10')](function(_0x2def67){_0x1afd54[_0x620a('0x18')]=_0x2def67;delete _0x1afd54[_0x620a('0x17')];return updateInteractionCounters(_0x1afd54);})[_0x620a('0x10')](function(_0xe2594){if(_0x465235){return getLastMessageText(_0xe2594);}else{return _0xe2594;}})['then'](function(_0x362070){_0xd40c5(_0x362070);})[_0x620a('0x14')](function(_0x2d9f25){_0xa8c330(_0x2d9f25);});});}; \ No newline at end of file +var _0x6d31=['MailMessage','out','-id','then','lastMsgText','trimStart','plainBody','catch','updateInteraction','Users','Tags','TagIds','lodash','map','fullname','forEach','push','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','waiting'];(function(_0x3bccaf,_0xf6a282){var _0x20de01=function(_0x5349a1){while(--_0x5349a1){_0x3bccaf['push'](_0x3bccaf['shift']());}};_0x20de01(++_0xf6a282);}(_0x6d31,0xa8));var _0x16d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d31[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x16d3('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x595d39,_0x53c870){return new Promise(function(_0x32c3d0,_0x11974e){try{var _0x3e5966=[];if(_0x53c870[_0x595d39]){_0x3e5966=_0x53c870[_0x595d39][_0x16d3('0x1')](function(_0x25b638){return{'id':_0x25b638['id'],'fullname':_0x25b638[_0x16d3('0x2')]};});}return _0x32c3d0(_0x3e5966);}catch(_0x26aac7){_0x11974e(_0x26aac7);}});}function getInteractionTags(_0x1d4657,_0x3ca72e){var _0x5a5d55=[];if(_0x1d4657){_0x1d4657['split'](',')[_0x16d3('0x3')](function(_0x4efffd){_0x5a5d55[_0x16d3('0x4')](_0x3ca72e[_0x4efffd]);});}return _0x5a5d55;}function updateWaitingCounter(_0x19b1ba){if(_0x19b1ba['waiting']){_0x19b1ba['waiting']-=0x1;}}function updateInteractionCounters(_0x3ea4aa){_0x3ea4aa['waiting']=0x0;_0x3ea4aa[_0x16d3('0x5')]=0x0;_0x3ea4aa[_0x16d3('0x6')]=0x0;_0x3ea4aa['unmanaged']=0x0;_0x3ea4aa[_0x16d3('0x7')]=0x0;_0x3ea4aa[_0x16d3('0x8')]=0x0;if(_0x3ea4aa[_0x16d3('0x9')]){if(_0x3ea4aa[_0x16d3('0xa')]===_0x16d3('0x7')){_0x3ea4aa[_0x16d3('0x7')]+=0x1;updateWaitingCounter(_0x3ea4aa);}if(_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0x6')]+=0x1;if(_0x3ea4aa[_0x16d3('0x5')]){_0x3ea4aa[_0x16d3('0x5')]-=0x1;}}else{if(_0x3ea4aa[_0x16d3('0xa')]){_0x3ea4aa[_0x16d3('0xc')]+=0x1;updateWaitingCounter(_0x3ea4aa);}}}else{if(!_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0xd')]+=0x1;}if(_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0x5')]+=0x1;updateWaitingCounter(_0x3ea4aa);}}_0x3ea4aa['total']+=0x1;return _0x3ea4aa;}function getLastMessageText(_0x4d9650){return db[_0x16d3('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4d9650['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x16d3('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x16d3('0x10'),'raw':!![]})[_0x16d3('0x11')](function(_0x582a40){if(_0x582a40&&_0x582a40['plainBody']){_0x4d9650[_0x16d3('0x12')]=_[_0x16d3('0x13')](_0x582a40[_0x16d3('0x14')]);}return _0x4d9650;})[_0x16d3('0x15')](function(_0x1035fc){throw _0x1035fc;});}exports[_0x16d3('0x16')]=function(_0xb19c2c,_0x58e6e9,_0x71fd56,_0x40dca3){return new Promise(function(_0x3a7fa7,_0x453ad3){return getInteractionUsers(_0xb19c2c['id'],_0x71fd56)['then'](function(_0x584983){_0xb19c2c[_0x16d3('0x17')]=_0x584983;return getInteractionTags(_0xb19c2c['TagIds'],_0x58e6e9);})[_0x16d3('0x11')](function(_0x61775e){_0xb19c2c[_0x16d3('0x18')]=_0x61775e;delete _0xb19c2c[_0x16d3('0x19')];return updateInteractionCounters(_0xb19c2c);})[_0x16d3('0x11')](function(_0x1c9a31){if(_0x40dca3){return getLastMessageText(_0x1c9a31);}else{return _0x1c9a31;}})[_0x16d3('0x11')](function(_0x52e162){_0x3a7fa7(_0x52e162);})['catch'](function(_0x24ab2a){_0x453ad3(_0x24ab2a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7ab9d88..1f5b9f4 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b1e=['unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','then','update','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst'];(function(_0x436d8c,_0x241d05){var _0x184f8b=function(_0x2ff4c6){while(--_0x2ff4c6){_0x436d8c['push'](_0x436d8c['shift']());}};_0x184f8b(++_0x241d05);}(_0x0b1e,0x1f2));var _0xe0b1=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0x0b1e[_0x21a2b2];return _0x2060b4;};'use strict';var _=require(_0xe0b1('0x0'));var db=require(_0xe0b1('0x1'))['db'];var loggers={'openchannel':require(_0xe0b1('0x2'))(_0xe0b1('0x3')),'mail':require(_0xe0b1('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0xe0b1('0x4')),'sms':require(_0xe0b1('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0xe0b1('0x5')),'whatsapp':require(_0xe0b1('0x2'))(_0xe0b1('0x6'))};function getAccountFK(_0x400b78){return _[_0xe0b1('0x7')](_0x400b78)+(_0x400b78===_0xe0b1('0x8')?_0xe0b1('0x9'):'Account')+'Id';}function getInteractionFK(_0x1b0a2f){return _[_0xe0b1('0x7')](_0x1b0a2f)+_0xe0b1('0xa');}function getInteractionId(_0x28846e,_0x75a09a,_0x4ea091){if(_0x28846e&&_0x28846e[_[_0xe0b1('0xb')](_0x4ea091)+_0xe0b1('0xa')]){return _0x28846e[_[_0xe0b1('0xb')](_0x4ea091)+'InteractionId'];}else if(_0x28846e&&_0x28846e['id']){return _0x28846e['id'];}else if(_0x75a09a&&_0x75a09a['id']){return _0x75a09a['id'];}else{return _0xe0b1('0xc');}}function getInteractionsTables(_0x44d582){return{'accounts':_0x44d582+'_'+(_0x44d582===_0xe0b1('0x8')?'websites':_0xe0b1('0xd')),'interactions':_0x44d582+_0xe0b1('0xe'),'interactionsTags':_0x44d582+_0xe0b1('0xf'),'messages':_0x44d582+_0xe0b1('0x10'),'userInteractions':_0xe0b1('0x11')+_0x44d582+_0xe0b1('0xe')};}function getSelectedTags(_0x520da4){var _0x1cc729=[];if(_0x520da4){_0x1cc729=Array[_0xe0b1('0x12')](_0x520da4)?_0x520da4:[_0x520da4];}return _0x1cc729;}function log(_0x1270fe,_0x19666a,_0x257de5,_0x5b9e72,_0xb6de13,_0x21e113){loggers[_0xb6de13[_0xe0b1('0x13')]()][_0x1270fe]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21e113[_0xe0b1('0x14')](),_0x19666a?_0x19666a['id']:null,_0x19666a?_0x19666a[_0xe0b1('0x15')]:null,_0x19666a?_0x19666a[_0xe0b1('0x16')]:null,getInteractionId(_0x257de5,_0x5b9e72,_0xb6de13),_0x257de5?JSON[_0xe0b1('0x17')](_0x257de5):_0xe0b1('0x18'));}function updateUser(_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7){db[_[_0xe0b1('0xb')](_0x221baf)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x228e7a,_0x567204,_0x221baf)}})[_0xe0b1('0x19')](function(_0x2bba20){if(_0x2bba20){return _0x2bba20[_0xe0b1('0x1a')]({'UserId':_0x54da78?_0x54da78['id']:null});}})[_0xe0b1('0x19')](function(_0x5d7dfa){if(_0x5d7dfa){log(_0xe0b1('0x1b'),_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7);}})['catch'](function(){log('error',_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7);});}function logAcceptMessage(_0x4abe8f,_0x5878e7,_0x383154,_0x162663){var _0x77d9b=loggers[_0x4abe8f[_0xe0b1('0x13')]()];var _0x52fc4d=_0x5878e7['id'];var _0x336282=_0x5878e7[_0xe0b1('0x15')];var _0x4e64da=_0x5878e7[_0xe0b1('0x16')];var _0x25687d=JSON[_0xe0b1('0x17')](_0x162663||null);_0x77d9b[_0xe0b1('0x1b')]('['+_0x4abe8f['toUpperCase']()+_0xe0b1('0x1c')+_0x52fc4d+_0xe0b1('0x1d')+_0x336282+_0xe0b1('0x1e')+_0x4e64da+_0xe0b1('0x1f')+_0x383154+_0xe0b1('0x20')+_0x25687d);}module[_0xe0b1('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x09c6=['InteractionId','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','name','role','stringify','upperFirst','Interaction','findOne','then','update','info','catch','error','toUpperCase','\x20name=','\x20role=','\x20interaction=','exports','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','chat','Website','Account'];(function(_0x3b1e6f,_0x17e752){var _0x5760a2=function(_0x271694){while(--_0x271694){_0x3b1e6f['push'](_0x3b1e6f['shift']());}};_0x5760a2(++_0x17e752);}(_0x09c6,0x116));var _0x609c=function(_0xa01175,_0x3fa71a){_0xa01175=_0xa01175-0x0;var _0x303748=_0x09c6[_0xa01175];return _0x303748;};'use strict';var _=require('lodash');var db=require(_0x609c('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x609c('0x1')),'mail':require(_0x609c('0x2'))(_0x609c('0x3')),'fax':require(_0x609c('0x2'))(_0x609c('0x4')),'sms':require(_0x609c('0x2'))(_0x609c('0x5')),'chat':require('../../config/logger')(_0x609c('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x190a7f){return _['capitalize'](_0x190a7f)+(_0x190a7f===_0x609c('0x7')?_0x609c('0x8'):_0x609c('0x9'))+'Id';}function getInteractionFK(_0x13eaf2){return _['capitalize'](_0x13eaf2)+_0x609c('0xa');}function getInteractionId(_0x344630,_0x2462d7,_0x42c91b){if(_0x344630&&_0x344630[_['upperFirst'](_0x42c91b)+_0x609c('0xa')]){return _0x344630[_['upperFirst'](_0x42c91b)+_0x609c('0xa')];}else if(_0x344630&&_0x344630['id']){return _0x344630['id'];}else if(_0x2462d7&&_0x2462d7['id']){return _0x2462d7['id'];}else{return _0x609c('0xb');}}function getInteractionsTables(_0x3c8cd3){return{'accounts':_0x3c8cd3+'_'+(_0x3c8cd3===_0x609c('0x7')?_0x609c('0xc'):_0x609c('0xd')),'interactions':_0x3c8cd3+'_interactions','interactionsTags':_0x3c8cd3+_0x609c('0xe'),'messages':_0x3c8cd3+_0x609c('0xf'),'userInteractions':_0x609c('0x10')+_0x3c8cd3+_0x609c('0x11')};}function getSelectedTags(_0x30c9ab){var _0x5656a3=[];if(_0x30c9ab){_0x5656a3=Array[_0x609c('0x12')](_0x30c9ab)?_0x30c9ab:[_0x30c9ab];}return _0x5656a3;}function log(_0x43b5e8,_0x269390,_0xd84cef,_0x5c242c,_0x88cd1c,_0x4c0f06){loggers[_0x88cd1c[_0x609c('0x13')]()][_0x43b5e8]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c0f06['toUpperCase'](),_0x269390?_0x269390['id']:null,_0x269390?_0x269390[_0x609c('0x14')]:null,_0x269390?_0x269390[_0x609c('0x15')]:null,getInteractionId(_0xd84cef,_0x5c242c,_0x88cd1c),_0xd84cef?JSON[_0x609c('0x16')](_0xd84cef):'null');}function updateUser(_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee){db[_[_0x609c('0x17')](_0x262fc0)+_0x609c('0x18')][_0x609c('0x19')]({'where':{'id':getInteractionId(_0x5d65a0,_0x17f342,_0x262fc0)}})[_0x609c('0x1a')](function(_0x32f221){if(_0x32f221){return _0x32f221[_0x609c('0x1b')]({'UserId':_0x3d37e5?_0x3d37e5['id']:null});}})[_0x609c('0x1a')](function(_0x43df24){if(_0x43df24){log(_0x609c('0x1c'),_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee);}})[_0x609c('0x1d')](function(){log(_0x609c('0x1e'),_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee);});}function logAcceptMessage(_0x123aba,_0x466808,_0x10c461,_0x2e24da){var _0x29331b=loggers[_0x123aba['toLowerCase']()];var _0x14ecb1=_0x466808['id'];var _0x20c1b1=_0x466808['name'];var _0x30d399=_0x466808['role'];var _0x4e7836=JSON[_0x609c('0x16')](_0x2e24da||null);_0x29331b['info']('['+_0x123aba[_0x609c('0x1f')]()+'MESSAGE:ACCEPT]\x20id='+_0x14ecb1+_0x609c('0x20')+_0x20c1b1+_0x609c('0x21')+_0x30d399+_0x609c('0x22')+_0x10c461+'\x20body='+_0x4e7836);}module[_0x609c('0x23')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a36fac8..b68f12d 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 _0xec82=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','crypto','composable-middleware','../../mysqldb','data1','license'];(function(_0x273b7e,_0x1b642f){var _0x5df145=function(_0x58e003){while(--_0x58e003){_0x273b7e['push'](_0x273b7e['shift']());}};_0x5df145(++_0x1b642f);}(_0xec82,0x95));var _0x2ec8=function(_0xccac79,_0x30c43c){_0xccac79=_0xccac79-0x0;var _0x3776cf=_0xec82[_0xccac79];return _0x3776cf;};'use strict';var crypto=require(_0x2ec8('0x0'));var util=require('util');var compose=require(_0x2ec8('0x1'));var db=require(_0x2ec8('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5e247e,_0x59d330){if(_0x5e247e&&_0x59d330){if(_0x59d330[_0x2ec8('0x3')]&&_0x59d330['license']){var _0x5c2e16=_0x59d330['data1'];var _0x72df4d=_0x59d330[_0x2ec8('0x4')];var _0x6263b9=_0x5c2e16[_0x2ec8('0x5')]('-')[0x4];var _0x44b152=_0x5c2e16[_0x2ec8('0x5')]('-')[0x0];var _0x4c3c37=crypto[_0x2ec8('0x6')]('aes-256-ctr',util[_0x2ec8('0x7')](_0x2ec8('0x8'),_0x6263b9,_0x5c2e16,_0x44b152));var _0x598c03=_0x4c3c37[_0x2ec8('0x9')](_0x72df4d,_0x2ec8('0xa'),_0x2ec8('0xb'));_0x598c03+=_0x4c3c37[_0x2ec8('0xc')]('utf8');var _0x3839a7=JSON['parse'](_0x598c03);return _0x3839a7[_0x2ec8('0xd')](_0x5e247e)?_0x3839a7[_0x5e247e]:null;}}return null;}function isLimit(_0x2fda5b,_0x53b607,_0x48315e,_0x10a091){var _0x5acae7=_0x53b607;return compose()[_0x2ec8('0xe')](function(_0x14486b,_0x4d0f5b,_0xd26761){return db[_0x2ec8('0xf')][_0x2ec8('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2ec8('0x11')](function(_0x393918){var _0x2abe27=getValueFromLicense(_0x2fda5b,_0x393918);return _0x2abe27?_0x2abe27:_0x5acae7;})[_0x2ec8('0x11')](function(_0x19ef0d){_0x5acae7=_0x19ef0d;return _0x48315e['count'](_0x10a091);})[_0x2ec8('0x11')](function(_0x5983cd){if(_0x5983cd>=_0x5acae7){return _0x4d0f5b['status'](0x193)[_0x2ec8('0x12')]({'message':util['format'](_0x2ec8('0x13'),_0x2fda5b)});}_0xd26761();})['catch'](function(_0xfc8335){_0xd26761(_0xfc8335);});});}function isUserLimit(){return isLimit(_0x2ec8('0x14'),0x1,db[_0x2ec8('0x15')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x0ab7=['license','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','crypto','../../mysqldb'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x0ab7,0x136));var _0x70ab=function(_0x18e713,_0x3fcdfa){_0x18e713=_0x18e713-0x0;var _0x1d9f38=_0x0ab7[_0x18e713];return _0x1d9f38;};'use strict';var crypto=require(_0x70ab('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x70ab('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4ca3cd,_0x725965){if(_0x4ca3cd&&_0x725965){if(_0x725965['data1']&&_0x725965[_0x70ab('0x2')]){var _0x49cd43=_0x725965[_0x70ab('0x3')];var _0x24a0f5=_0x725965[_0x70ab('0x2')];var _0x973c2a=_0x49cd43[_0x70ab('0x4')]('-')[0x4];var _0x1823b3=_0x49cd43[_0x70ab('0x4')]('-')[0x0];var _0x105c12=crypto['createDecipher'](_0x70ab('0x5'),util[_0x70ab('0x6')](_0x70ab('0x7'),_0x973c2a,_0x49cd43,_0x1823b3));var _0x987fb0=_0x105c12[_0x70ab('0x8')](_0x24a0f5,_0x70ab('0x9'),_0x70ab('0xa'));_0x987fb0+=_0x105c12[_0x70ab('0xb')](_0x70ab('0xa'));var _0x3150f6=JSON[_0x70ab('0xc')](_0x987fb0);return _0x3150f6[_0x70ab('0xd')](_0x4ca3cd)?_0x3150f6[_0x4ca3cd]:null;}}return null;}function isLimit(_0x444f62,_0x335943,_0x295720,_0xd143f6){var _0xc2723a=_0x335943;return compose()[_0x70ab('0xe')](function(_0x1099cd,_0x406fdb,_0x23900a){return db[_0x70ab('0xf')][_0x70ab('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x48b07d){var _0x3e4f1d=getValueFromLicense(_0x444f62,_0x48b07d);return _0x3e4f1d?_0x3e4f1d:_0xc2723a;})['then'](function(_0x8c51ce){_0xc2723a=_0x8c51ce;return _0x295720['count'](_0xd143f6);})[_0x70ab('0x11')](function(_0x37dd2a){if(_0x37dd2a>=_0xc2723a){return _0x406fdb['status'](0x193)[_0x70ab('0x12')]({'message':util[_0x70ab('0x6')](_0x70ab('0x13'),_0x444f62)});}_0x23900a();})[_0x70ab('0x14')](function(_0x19f05a){_0x23900a(_0x19f05a);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x70ab('0x15')},{'role':_0x70ab('0x16')}]}});}exports[_0x70ab('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d6cd0a9..1ec39f8 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 _0xbb81=['days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','$eq','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$between','utcOffset','hours','seconds','lodash','moment','parseSearch','startsWith','and','replace','[$or]','split','slice','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','operator','value','includes','$gt','$lte','add'];(function(_0x489291,_0x3f78a8){var _0x2935f1=function(_0x129be3){while(--_0x129be3){_0x489291['push'](_0x489291['shift']());}};_0x2935f1(++_0x3f78a8);}(_0xbb81,0x126));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bb8('0x0'));var moment=require(_0x1bb8('0x1'));exports[_0x1bb8('0x2')]=function(_0x201c28){var _0x192248={'conditions':[]};_0x192248['sqlOperator']=_[_0x1bb8('0x3')](_0x201c28,'[$or]')?'or':_0x1bb8('0x4');var _0x457ac1=_0x201c28[_0x1bb8('0x5')]('[$and]','')[_0x1bb8('0x5')](_0x1bb8('0x6'),'')[_0x1bb8('0x7')]('||');for(var _0x1bf88d=0x0;_0x1bf88d<_0x457ac1['length'];_0x1bf88d++){var _0x127069=_0x457ac1[_0x1bf88d]['split'](':=');var _0x49c5e6=_0x127069[0x0];var _0xb5ea3e=_0x127069[_0x1bb8('0x8')](0x1);_0xb5ea3e[_0x1bb8('0x9')](function(_0x5ac7d2){var _0x2af84b=_0x5ac7d2[_0x1bb8('0x7')]('[')[_0x1bb8('0xa')]();var _0x53b4eb=_0x5ac7d2[_0x1bb8('0xb')](/\[(.*?)\]/g);_0x53b4eb[_0x1bb8('0x9')](function(_0x470693){var _0x39068e=_0x470693[_0x1bb8('0x7')]('[')[_0x1bb8('0xc')](function(_0x31fd11){return _0x31fd11[_0x1bb8('0xd')](']')>-0x1;})[_0x1bb8('0xe')](function(_0x39b200){return _0x39b200[_0x1bb8('0x7')](']')[0x0];})[0x0];_0x192248['conditions'][_0x1bb8('0xf')]({'field':_0x49c5e6,'operator':_0x2af84b,'value':_0x39068e});});});}return _0x192248;};exports[_0x1bb8('0x10')]=function(_0x4d5044,_0x19b81f,_0x45d2b1){var _0x257a6d={};if(_0x19b81f===_0x1bb8('0x11')){if(_0x45d2b1[_0x1bb8('0x12')]==='$eq'){_0x45d2b1[_0x1bb8('0x12')]='$between';_0x45d2b1[_0x1bb8('0x13')]+=','+_0x45d2b1[_0x1bb8('0x13')];}else if(_[_0x1bb8('0x14')]([_0x1bb8('0x15'),_0x1bb8('0x16')],_0x45d2b1[_0x1bb8('0x12')])){_0x45d2b1['value']=moment(_0x45d2b1['value'])[_0x1bb8('0x17')](0x1,_0x1bb8('0x18'))[_0x1bb8('0x19')](_0x1bb8('0x1a'));}}if(_0x45d2b1[_0x1bb8('0x1b')]){_0x19b81f=_0x45d2b1[_0x1bb8('0x1b')];_0x257a6d[_0x1bb8('0x1c')]=_0x1bb8('0x1d')+_0x4d5044+'.'+_0x45d2b1[_0x1bb8('0x1e')]+_0x1bb8('0x1f')+_0x45d2b1['castTo']+')\x20'+parseOperator(_0x45d2b1[_0x1bb8('0x12')]);}else{_0x257a6d[_0x1bb8('0x1c')]=_0x4d5044+'.'+_0x45d2b1[_0x1bb8('0x1e')]+'\x20'+parseOperator(_0x45d2b1[_0x1bb8('0x12')]);}if(_['includes']([_0x1bb8('0x20'),_0x1bb8('0x21')],_0x45d2b1[_0x1bb8('0x12')]))_0x257a6d[_0x1bb8('0x1c')]='('+_0x257a6d[_0x1bb8('0x1c')]+_0x1bb8('0x22')+_0x4d5044+'.'+_0x45d2b1['field']+_0x1bb8('0x23');_0x257a6d[_0x1bb8('0x13')]=parseValue(_0x19b81f,_0x45d2b1[_0x1bb8('0x12')],_0x45d2b1['value']);return _0x257a6d;};function parseOperator(_0x72e5cb){var _0x2bc78a;switch(_0x72e5cb){case _0x1bb8('0x24'):_0x2bc78a='IN\x20?';break;case _0x1bb8('0x21'):_0x2bc78a='NOT\x20IN\x20?';break;case _0x1bb8('0x25'):_0x2bc78a='=\x20?';break;case _0x1bb8('0x20'):_0x2bc78a=_0x1bb8('0x26');break;case _0x1bb8('0x27'):case'$startsWith':case'$endsWith':_0x2bc78a=_0x1bb8('0x28');break;case _0x1bb8('0x29'):_0x2bc78a=_0x1bb8('0x2a');break;case'$gt':_0x2bc78a='>\x20?';break;case _0x1bb8('0x16'):_0x2bc78a=_0x1bb8('0x2b');break;case _0x1bb8('0x2c'):_0x2bc78a=_0x1bb8('0x2d');break;case'$between':_0x2bc78a=_0x1bb8('0x2e');break;}return _0x2bc78a;}function parseValue(_0x6328af,_0x5dee30,_0x39cc28){var _0x39d8b1={'start':undefined,'end':undefined};switch(_0x5dee30){case'$in':case _0x1bb8('0x21'):_0x39d8b1['start']=_0x39cc28[_0x1bb8('0x7')](',');break;case _0x1bb8('0x27'):_0x39d8b1[_0x1bb8('0x2f')]='%'+_0x39cc28+'%';break;case _0x1bb8('0x30'):_0x39d8b1[_0x1bb8('0x2f')]=_0x39cc28+'%';break;case'$endsWith':_0x39d8b1[_0x1bb8('0x2f')]='%'+_0x39cc28;break;case _0x1bb8('0x31'):var _0x48182c=_0x39cc28[_0x1bb8('0x7')](',');var _0x39cc28=_0x48182c[_0x1bb8('0xa')]();var _0x706145=_0x48182c['pop']();if(_0x6328af===_0x1bb8('0x11')){_0x39cc28=moment(_0x39cc28)[_0x1bb8('0x32')](0x0,!![])[_0x1bb8('0x19')]();_0x706145=moment(_0x706145)[_0x1bb8('0x32')](0x0,!![])[_0x1bb8('0x17')](0x17,_0x1bb8('0x33'))['add'](0x3b,'minutes')[_0x1bb8('0x17')](0x3b,_0x1bb8('0x34'))['format']();}_0x39d8b1={'start':_0x39cc28,'end':_0x706145};break;default:_0x39d8b1[_0x1bb8('0x2f')]=_0x39cc28;break;}return _0x39d8b1;} \ No newline at end of file +var _0xb623=['$startsWith','LIKE\x20?','$lt','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','includes','$ne','$notIn','field','\x20IS\x20NULL)','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring'];(function(_0x1011f8,_0x26294c){var _0x51d5f9=function(_0x328304){while(--_0x328304){_0x1011f8['push'](_0x1011f8['shift']());}};_0x51d5f9(++_0x26294c);}(_0xb623,0x16b));var _0x3b62=function(_0x472414,_0x43e7d2){_0x472414=_0x472414-0x0;var _0x54345e=_0xb623[_0x472414];return _0x54345e;};'use strict';var _=require(_0x3b62('0x0'));var moment=require(_0x3b62('0x1'));exports[_0x3b62('0x2')]=function(_0x196d2a){var _0x5b4ef5={'conditions':[]};_0x5b4ef5[_0x3b62('0x3')]=_[_0x3b62('0x4')](_0x196d2a,_0x3b62('0x5'))?'or':_0x3b62('0x6');var _0x2606c3=_0x196d2a[_0x3b62('0x7')](_0x3b62('0x8'),'')['replace'](_0x3b62('0x5'),'')[_0x3b62('0x9')]('||');for(var _0x18de05=0x0;_0x18de05<_0x2606c3[_0x3b62('0xa')];_0x18de05++){var _0x21895b=_0x2606c3[_0x18de05]['split'](':=');var _0x549120=_0x21895b[0x0];var _0x4c72eb=_0x21895b[_0x3b62('0xb')](0x1);_0x4c72eb[_0x3b62('0xc')](function(_0x37ca34){var _0x3ef088=_0x37ca34[_0x3b62('0x9')]('[')[_0x3b62('0xd')]();var _0x572011=_0x37ca34[_0x3b62('0xe')](/\[(.*?)\]/g);_0x572011['forEach'](function(_0x1e3349){var _0x2eed1a=_0x1e3349['split']('[')['filter'](function(_0x318add){return _0x318add[_0x3b62('0xf')](']')>-0x1;})[_0x3b62('0x10')](function(_0x311391){return _0x311391[_0x3b62('0x9')](']')[0x0];})[0x0];_0x5b4ef5[_0x3b62('0x11')][_0x3b62('0x12')]({'field':_0x549120,'operator':_0x3ef088,'value':_0x2eed1a});});});}return _0x5b4ef5;};exports[_0x3b62('0x13')]=function(_0x55f1f7,_0x1174ed,_0x45e222){var _0x445f12={};if(_0x1174ed===_0x3b62('0x14')){if(_0x45e222[_0x3b62('0x15')]==='$eq'){_0x45e222[_0x3b62('0x15')]=_0x3b62('0x16');_0x45e222[_0x3b62('0x17')]+=','+_0x45e222[_0x3b62('0x17')];}else if(_['includes']([_0x3b62('0x18'),'$lte'],_0x45e222[_0x3b62('0x15')])){_0x45e222[_0x3b62('0x17')]=moment(_0x45e222['value'])[_0x3b62('0x19')](0x1,_0x3b62('0x1a'))[_0x3b62('0x1b')](_0x3b62('0x1c'));}}if(_0x45e222[_0x3b62('0x1d')]){_0x1174ed=_0x45e222[_0x3b62('0x1d')];_0x445f12['text']=_0x3b62('0x1e')+_0x55f1f7+'.'+_0x45e222['field']+_0x3b62('0x1f')+_0x45e222[_0x3b62('0x1d')]+')\x20'+parseOperator(_0x45e222[_0x3b62('0x15')]);}else{_0x445f12[_0x3b62('0x20')]=_0x55f1f7+'.'+_0x45e222['field']+'\x20'+parseOperator(_0x45e222['operator']);}if(_[_0x3b62('0x21')]([_0x3b62('0x22'),_0x3b62('0x23')],_0x45e222[_0x3b62('0x15')]))_0x445f12[_0x3b62('0x20')]='('+_0x445f12[_0x3b62('0x20')]+'\x20OR\x20'+_0x55f1f7+'.'+_0x45e222[_0x3b62('0x24')]+_0x3b62('0x25');_0x445f12[_0x3b62('0x17')]=parseValue(_0x1174ed,_0x45e222['operator'],_0x45e222['value']);return _0x445f12;};function parseOperator(_0x24e9c6){var _0x67ad4b;switch(_0x24e9c6){case'$in':_0x67ad4b='IN\x20?';break;case _0x3b62('0x23'):_0x67ad4b=_0x3b62('0x26');break;case _0x3b62('0x27'):_0x67ad4b=_0x3b62('0x28');break;case'$ne':_0x67ad4b=_0x3b62('0x29');break;case _0x3b62('0x2a'):case _0x3b62('0x2b'):case'$endsWith':_0x67ad4b=_0x3b62('0x2c');break;case _0x3b62('0x2d'):_0x67ad4b='<\x20?';break;case _0x3b62('0x18'):_0x67ad4b='>\x20?';break;case _0x3b62('0x2e'):_0x67ad4b=_0x3b62('0x2f');break;case _0x3b62('0x30'):_0x67ad4b=_0x3b62('0x31');break;case'$between':_0x67ad4b=_0x3b62('0x32');break;}return _0x67ad4b;}function parseValue(_0x3123fc,_0x13e02c,_0x20f2f8){var _0x50bfbc={'start':undefined,'end':undefined};switch(_0x13e02c){case _0x3b62('0x33'):case _0x3b62('0x23'):_0x50bfbc[_0x3b62('0x34')]=_0x20f2f8[_0x3b62('0x9')](',');break;case _0x3b62('0x2a'):_0x50bfbc['start']='%'+_0x20f2f8+'%';break;case _0x3b62('0x2b'):_0x50bfbc[_0x3b62('0x34')]=_0x20f2f8+'%';break;case _0x3b62('0x35'):_0x50bfbc[_0x3b62('0x34')]='%'+_0x20f2f8;break;case _0x3b62('0x16'):var _0x45c018=_0x20f2f8[_0x3b62('0x9')](',');var _0x20f2f8=_0x45c018['shift']();var _0x204ff8=_0x45c018[_0x3b62('0x36')]();if(_0x3123fc===_0x3b62('0x14')){_0x20f2f8=moment(_0x20f2f8)['utcOffset'](0x0,!![])[_0x3b62('0x1b')]();_0x204ff8=moment(_0x204ff8)[_0x3b62('0x37')](0x0,!![])[_0x3b62('0x19')](0x17,_0x3b62('0x38'))[_0x3b62('0x19')](0x3b,'minutes')[_0x3b62('0x19')](0x3b,_0x3b62('0x39'))['format']();}_0x50bfbc={'start':_0x20f2f8,'end':_0x204ff8};break;default:_0x50bfbc['start']=_0x20f2f8;break;}return _0x50bfbc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e5f2070..dc01c81 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 _0x7aca=['split','offset','sort','map','indexOf','priority','col','DESC','cast','unsigned','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','getOptions','query','$id','model','name','attributes','nolimit','limit','where','filter','columns','value','merge','VIRTUAL','lower','options','include','escapeLIKESpecialChars','lodash','moment','../../mysqldb','parse','keys','alias','fields','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','uniqueid','isArray'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7aca,0x1ea));var _0xa7ac=function(_0x569d72,_0x415be2){_0x569d72=_0x569d72-0x0;var _0xa891a0=_0x7aca[_0x569d72];return _0xa891a0;};'use strict';var _=require(_0xa7ac('0x0'));var sequelize=require('sequelize');var moment=require(_0xa7ac('0x1'));var db=require(_0xa7ac('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2012e7){var _0x1c4859=['ne'];try{var _0x274013=JSON[_0xa7ac('0x3')](_0x2012e7);var _0x112b86=Object[_0xa7ac('0x4')](_0x274013)[0x0];return _0x1c4859['includes'](_0x112b86);}catch(_0x36cd05){return![];}}function getOperatorValue(_0x3fb9d2){var _0x39f5ce=JSON['parse'](_0x3fb9d2);var _0x443d26=Object[_0xa7ac('0x4')](_0x39f5ce)[0x0];var _0x5af0df=_0x39f5ce[_0x443d26];return{['$'+_0x443d26]:_0x5af0df};}function parseIncludeModel(_0x972742){var _0x3017ca=JSON[_0xa7ac('0x3')](_0x972742);return{'model':db[_0x3017ca['model']],'as':_0x3017ca[_0xa7ac('0x5')],'attributes':_0x3017ca[_0xa7ac('0x6')],'raw':_0x3017ca[_0xa7ac('0x7')]};}exports[_0xa7ac('0x6')]=function(_0x5dd18e){var _0x2ab819=null;if(_0x5dd18e){_0x2ab819=_0x5dd18e['split'](',');}return _0x2ab819;};exports[_0xa7ac('0x8')]=function(_0x4047e4,_0x3b0001){var _0x4aca56={};if(!_[_0xa7ac('0x9')](_0x4047e4)){_[_0xa7ac('0xa')](_0x4047e4,function(_0x1fdc15,_0x13b974){try{if(_0x3b0001){var _0x4b21c0=_[_0xa7ac('0xb')](_0x3b0001,{'name':_0x13b974})||{};if(hasSequelizeOperator(_0x1fdc15)){_0x4aca56[_0x13b974]=getOperatorValue(_0x1fdc15);}else if(_0x4b21c0[_0xa7ac('0xc')]===_0xa7ac('0xd')&&_[_0xa7ac('0xe')](_0x1fdc15)){var _0x13e77e=JSON[_0xa7ac('0x3')](_0x1fdc15);var _0x2ab680={'$gte':moment(moment(_0x13e77e[_0xa7ac('0xf')])[_0xa7ac('0x10')](_0xa7ac('0x11')))[_0xa7ac('0x12')]()[_0xa7ac('0x10')](),'$lte':moment(moment(_0x13e77e[_0xa7ac('0x13')])[_0xa7ac('0x10')](_0xa7ac('0x11')))['utc']()['subtract'](0x1,'s')[_0xa7ac('0x10')]()};_0x4aca56[_0x13b974]=_0x2ab680;}else if(_0x4b21c0['name']===_0xa7ac('0x14')){_0x4aca56[_0x13b974]=_0x1fdc15;}else{_0x4aca56[_0x13b974]=_['isArray'](_0x1fdc15)?_0x1fdc15:JSON[_0xa7ac('0x3')](_0x1fdc15);}}else{_0x4aca56[_0x13b974]=_[_0xa7ac('0x15')](_0x1fdc15)?_0x1fdc15:JSON[_0xa7ac('0x3')](_0x1fdc15);}}catch(_0x50fd80){_0x4aca56[_0x13b974]=_0x1fdc15[_0xa7ac('0x16')](',');}});}return _0x4aca56;};exports['limit']=function(_0x409ddb){_0x409ddb=parseInt(_0x409ddb,0xa);if(!_0x409ddb||_0x409ddb<0x0){_0x409ddb=LIMIT_VALUE;}return _0x409ddb;};exports[_0xa7ac('0x17')]=function(_0x4cbae4){_0x4cbae4=parseInt(_0x4cbae4,0xa);if(!_0x4cbae4||_0x4cbae4<0x0){_0x4cbae4=0x0;}return _0x4cbae4;};exports[_0xa7ac('0x18')]=function(_0x22e91f){var _0x5c33b8,_0xe657=null;if(_0x22e91f){_0x5c33b8=_0x22e91f[_0xa7ac('0x16')](',');_0xe657=_[_0xa7ac('0x19')](_0x5c33b8,function(_0x3a8e02){if(_0x3a8e02[_0xa7ac('0x1a')]('-')===0x0){return[_0x3a8e02===_0xa7ac('0x1b')?sequelize['cast'](sequelize[_0xa7ac('0x1c')](_0xa7ac('0x1b')),'unsigned'):_0x3a8e02['substr'](0x1),_0xa7ac('0x1d')];}else{return[_0x3a8e02===_0xa7ac('0x1b')?sequelize[_0xa7ac('0x1e')](sequelize[_0xa7ac('0x1c')](_0xa7ac('0x1b')),_0xa7ac('0x1f')):_0x3a8e02,'ASC'];}});}return _0xe657;};exports[_0xa7ac('0x20')]=function(_0x56902b,_0x27174d){if(_[_0xa7ac('0x9')](_0x56902b)){return _0x56902b;}if(_[_0xa7ac('0x15')](_0x56902b)){for(var _0xba9720=0x0;_0xba9720<_0x56902b[_0xa7ac('0x21')];_0xba9720+=0x1){_0x56902b[_0xba9720]=this[_0xa7ac('0x20')](_0x56902b[_0xba9720],_0x27174d);}return _0x56902b;}if(!_[_0xa7ac('0x22')](_0x56902b)){return _0x56902b;}if(_[_0xa7ac('0x23')](_0x27174d)){_0x27174d=[_0x27174d];}if(!_[_0xa7ac('0x15')](_0x27174d)){return _0x56902b;}for(var _0x1f3d15=0x0;_0x1f3d15<_0x27174d['length'];_0x1f3d15+=0x1){_[_0xa7ac('0x24')](_0x56902b,_0x27174d[_0x1f3d15]);}for(var _0x27e94c in _0x56902b){if(_0x56902b[_0xa7ac('0x25')](_0x27e94c)){_0x56902b[_0x27e94c]=this[_0xa7ac('0x20')](_0x56902b[_0x27e94c],_0x27174d);}}return _0x56902b;};exports[_0xa7ac('0x26')]=function(_0x352361){return _0x352361[_0xa7ac('0x27')](RegExp(_0xa7ac('0x28')))?!![]:![];};exports['isEmail']=function(_0x5ccf19){return _0x5ccf19[_0xa7ac('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x39fd85,_0x2d3ff7){var _0x281177=[];var _0x48031b=/([^:]")"+/g;var _0x20ebb3=/[*<>~@-]/g;var _0x23aca1=/[ `!@#$%^&*()_\-?~<>]/;var _0x256a97=/[ ,]+/;var _0x2f8553=_0x2d3ff7?_0xa7ac('0x29'):_0xa7ac('0x2a');if(_0x2d3ff7){_0x39fd85=_0x39fd85[_0xa7ac('0x2b')](_0x20ebb3,'\x20')['trim']();}_0x39fd85[_0xa7ac('0x16')](_0x256a97)[_0xa7ac('0x2c')](function(_0x1fc256){_0x1fc256=_0x1fc256[_0xa7ac('0x2b')](_0x48031b,'$1');_0x1fc256='+'+_0x1fc256+'*';var _0x11f28b=_0x1fc256[_0xa7ac('0x27')](_0x23aca1);if(_0x11f28b){_0x1fc256='\x22'+_0x1fc256+'\x22';}_0x281177[_0xa7ac('0x2d')](_0x1fc256);});_0x2f8553=_0x2f8553[_0xa7ac('0x2b')](_0xa7ac('0x2a'),_0x281177['join']('\x20'));return _0x2f8553;};exports[_0xa7ac('0x2e')]=function(_0x5521f4,_0x36f7ba,_0x28bc6e){var _0x193c8d={},_0x41cb51={};if(_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')]){_0x36f7ba[_0xa7ac('0x2f')]['id']=_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')];delete _0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')];}_0x193c8d[_0xa7ac('0x31')]=_[_0xa7ac('0x19')](_0x5521f4,_0xa7ac('0x32'));_0x193c8d['query']=_[_0xa7ac('0x4')](_0x36f7ba[_0xa7ac('0x2f')]);_0x193c8d[_0xa7ac('0x8')]=_['intersection'](_0x193c8d[_0xa7ac('0x31')],_0x193c8d[_0xa7ac('0x2f')]);_0x41cb51[_0xa7ac('0x33')]=_['intersection'](_0x193c8d[_0xa7ac('0x31')],this['fields'](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x6')]));_0x41cb51[_0xa7ac('0x33')]=_0x41cb51['attributes'][_0xa7ac('0x21')]?_0x41cb51['attributes']:_0x193c8d[_0xa7ac('0x31')];if(!_0x36f7ba['query']['hasOwnProperty'](_0xa7ac('0x34'))){_0x41cb51['limit']=this[_0xa7ac('0x35')](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x35')]);_0x41cb51[_0xa7ac('0x17')]=this[_0xa7ac('0x17')](_0x36f7ba['query'][_0xa7ac('0x17')]);}_0x41cb51['order']=this[_0xa7ac('0x18')](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x18')]);_0x41cb51[_0xa7ac('0x36')]=this[_0xa7ac('0x8')](_['pick'](_0x36f7ba[_0xa7ac('0x2f')],_0x193c8d[_0xa7ac('0x8')]),_0x5521f4);if(_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x37')]){var _0x1995fd=_0x5521f4;var _0x56bf7a=_0x36f7ba['query'][_0xa7ac('0x37')];if(typeof _0x56bf7a==='object'){_0x1995fd=_[_0xa7ac('0x37')](_0x5521f4,function(_0x3cefdb){return _['includes'](_0x56bf7a[_0xa7ac('0x38')],_0x3cefdb[_0xa7ac('0x32')]);});_0x56bf7a=_0x56bf7a[_0xa7ac('0x39')];}_0x41cb51[_0xa7ac('0x36')]=_[_0xa7ac('0x3a')](_0x41cb51[_0xa7ac('0x36')],{'$or':_['map'](_0x1995fd,function(_0x4408c9){if(_0x4408c9[_0xa7ac('0xc')]!==_0xa7ac('0x3b')){if(_0x28bc6e){return sequelize['where'](sequelize['fn'](_0xa7ac('0x3c'),sequelize[_0xa7ac('0x1c')](_0x4408c9['name'])),{'$like':sequelize['fn'](_0xa7ac('0x3c'),'%'+_0x36f7ba['query'][_0xa7ac('0x37')]+'%')});}else{var _0x24fc51={};_0x24fc51[_0x4408c9[_0xa7ac('0x32')]]={'$like':'%'+_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x37')]+'%'};return _0x24fc51;}}})});}_0x41cb51=_[_0xa7ac('0x3a')]({},_0x41cb51,_0x36f7ba[_0xa7ac('0x3d')]);return _0x41cb51;};exports[_0xa7ac('0x3e')]=function(_0x251e7a){var _0x389bd9=[];if(_0x251e7a['includeAll']){_0x389bd9[_0xa7ac('0x2d')]({'all':!![]});}else if(_0x251e7a['include']){if(Array['isArray'](_0x251e7a[_0xa7ac('0x3e')])){_0x389bd9=Object[_0xa7ac('0x4')](_0x251e7a[_0xa7ac('0x3e')])['map'](function(_0x650452){return parseIncludeModel(_0x251e7a[_0xa7ac('0x3e')][_0x650452]);});}else{var _0x5271c2=parseIncludeModel(_0x251e7a[_0xa7ac('0x3e')]);_0x389bd9['push'](_0x5271c2);}}return _0x389bd9;};exports[_0xa7ac('0x3f')]=function(_0x33f69a){return _0x33f69a[_0xa7ac('0x2b')](/[%_^-]/g,function(_0x472460){return'\x5c'+_0x472460;});}; \ No newline at end of file +var _0xc6b9=['match','\x22{EXPR}\x22','replace','trim','forEach','push','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','object','includes','columns','value','merge','VIRTUAL','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','keys','parse','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','map','cast','col','priority','unsigned','substr','DESC','omit','length','isObject','isString','unset'];(function(_0x39c2cc,_0x21d2f1){var _0x51e14b=function(_0x1c0820){while(--_0x1c0820){_0x39c2cc['push'](_0x39c2cc['shift']());}};_0x51e14b(++_0x21d2f1);}(_0xc6b9,0x167));var _0x9c6b=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xc6b9[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x9c6b('0x0'));var sequelize=require(_0x9c6b('0x1'));var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4fd05a){var _0x1e1c7f=['ne'];try{var _0x5833f9=JSON['parse'](_0x4fd05a);var _0x2c5bf6=Object[_0x9c6b('0x2')](_0x5833f9)[0x0];return _0x1e1c7f['includes'](_0x2c5bf6);}catch(_0x259ec1){return![];}}function getOperatorValue(_0x4ac523){var _0x1c463c=JSON['parse'](_0x4ac523);var _0x4287aa=Object[_0x9c6b('0x2')](_0x1c463c)[0x0];var _0x238bd9=_0x1c463c[_0x4287aa];return{['$'+_0x4287aa]:_0x238bd9};}function parseIncludeModel(_0x102968){var _0x32a65f=JSON[_0x9c6b('0x3')](_0x102968);return{'model':db[_0x32a65f[_0x9c6b('0x4')]],'as':_0x32a65f[_0x9c6b('0x5')],'attributes':_0x32a65f[_0x9c6b('0x6')],'raw':_0x32a65f[_0x9c6b('0x7')]};}exports[_0x9c6b('0x6')]=function(_0x10fa0b){var _0x1a8536=null;if(_0x10fa0b){_0x1a8536=_0x10fa0b[_0x9c6b('0x8')](',');}return _0x1a8536;};exports['filters']=function(_0x47e5c8,_0xa734d2){var _0x367701={};if(!_[_0x9c6b('0x9')](_0x47e5c8)){_[_0x9c6b('0xa')](_0x47e5c8,function(_0x1f5218,_0x2a6126){try{if(_0xa734d2){var _0x2ae238=_[_0x9c6b('0xb')](_0xa734d2,{'name':_0x2a6126})||{};if(hasSequelizeOperator(_0x1f5218)){_0x367701[_0x2a6126]=getOperatorValue(_0x1f5218);}else if(_0x2ae238[_0x9c6b('0xc')]===_0x9c6b('0xd')&&_[_0x9c6b('0xe')](_0x1f5218)){var _0x41c206=JSON[_0x9c6b('0x3')](_0x1f5218);var _0x57d8a3={'$gte':moment(moment(_0x41c206[_0x9c6b('0xf')])[_0x9c6b('0x10')](_0x9c6b('0x11')))[_0x9c6b('0x12')]()[_0x9c6b('0x10')](),'$lte':moment(moment(_0x41c206[_0x9c6b('0x13')])[_0x9c6b('0x10')](_0x9c6b('0x11')))[_0x9c6b('0x12')]()[_0x9c6b('0x14')](0x1,'s')[_0x9c6b('0x10')]()};_0x367701[_0x2a6126]=_0x57d8a3;}else if(_0x2ae238[_0x9c6b('0x15')]===_0x9c6b('0x16')){_0x367701[_0x2a6126]=_0x1f5218;}else{_0x367701[_0x2a6126]=_['isArray'](_0x1f5218)?_0x1f5218:JSON['parse'](_0x1f5218);}}else{_0x367701[_0x2a6126]=_[_0x9c6b('0x17')](_0x1f5218)?_0x1f5218:JSON[_0x9c6b('0x3')](_0x1f5218);}}catch(_0x34bd45){_0x367701[_0x2a6126]=_0x1f5218[_0x9c6b('0x8')](',');}});}return _0x367701;};exports['limit']=function(_0x5b522d){_0x5b522d=parseInt(_0x5b522d,0xa);if(!_0x5b522d||_0x5b522d<0x0){_0x5b522d=LIMIT_VALUE;}return _0x5b522d;};exports[_0x9c6b('0x18')]=function(_0x4a73de){_0x4a73de=parseInt(_0x4a73de,0xa);if(!_0x4a73de||_0x4a73de<0x0){_0x4a73de=0x0;}return _0x4a73de;};exports['sort']=function(_0x452a68){var _0x4d6b42,_0x51c463=null;if(_0x452a68){_0x4d6b42=_0x452a68[_0x9c6b('0x8')](',');_0x51c463=_[_0x9c6b('0x19')](_0x4d6b42,function(_0x1212f4){if(_0x1212f4['indexOf']('-')===0x0){return[_0x1212f4==='priority'?sequelize[_0x9c6b('0x1a')](sequelize[_0x9c6b('0x1b')](_0x9c6b('0x1c')),_0x9c6b('0x1d')):_0x1212f4[_0x9c6b('0x1e')](0x1),_0x9c6b('0x1f')];}else{return[_0x1212f4===_0x9c6b('0x1c')?sequelize[_0x9c6b('0x1a')](sequelize[_0x9c6b('0x1b')](_0x9c6b('0x1c')),'unsigned'):_0x1212f4,'ASC'];}});}return _0x51c463;};exports[_0x9c6b('0x20')]=function(_0x5ae8e7,_0x1ea7c4){if(_[_0x9c6b('0x9')](_0x5ae8e7)){return _0x5ae8e7;}if(_[_0x9c6b('0x17')](_0x5ae8e7)){for(var _0x78f45e=0x0;_0x78f45e<_0x5ae8e7[_0x9c6b('0x21')];_0x78f45e+=0x1){_0x5ae8e7[_0x78f45e]=this[_0x9c6b('0x20')](_0x5ae8e7[_0x78f45e],_0x1ea7c4);}return _0x5ae8e7;}if(!_[_0x9c6b('0x22')](_0x5ae8e7)){return _0x5ae8e7;}if(_[_0x9c6b('0x23')](_0x1ea7c4)){_0x1ea7c4=[_0x1ea7c4];}if(!_[_0x9c6b('0x17')](_0x1ea7c4)){return _0x5ae8e7;}for(var _0x3831d1=0x0;_0x3831d1<_0x1ea7c4[_0x9c6b('0x21')];_0x3831d1+=0x1){_[_0x9c6b('0x24')](_0x5ae8e7,_0x1ea7c4[_0x3831d1]);}for(var _0x21f447 in _0x5ae8e7){if(_0x5ae8e7['hasOwnProperty'](_0x21f447)){_0x5ae8e7[_0x21f447]=this[_0x9c6b('0x20')](_0x5ae8e7[_0x21f447],_0x1ea7c4);}}return _0x5ae8e7;};exports['isNumeric']=function(_0x4b15a2){return _0x4b15a2[_0x9c6b('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0xac80b2){return _0xac80b2[_0x9c6b('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3df8a2,_0x493ddf){var _0x18a203=[];var _0x8643bc=/([^:]")"+/g;var _0x4743c6=/[*<>~@-]/g;var _0x48e19b=/[ `!@#$%^&*()_\-?~<>]/;var _0x127e74=/[ ,]+/;var _0x12dc16=_0x493ddf?_0x9c6b('0x26'):'{EXPR}';if(_0x493ddf){_0x3df8a2=_0x3df8a2[_0x9c6b('0x27')](_0x4743c6,'\x20')[_0x9c6b('0x28')]();}_0x3df8a2[_0x9c6b('0x8')](_0x127e74)[_0x9c6b('0x29')](function(_0x20ecb2){_0x20ecb2=_0x20ecb2['replace'](_0x8643bc,'$1');_0x20ecb2='+'+_0x20ecb2+'*';var _0x55c16e=_0x20ecb2[_0x9c6b('0x25')](_0x48e19b);if(_0x55c16e){_0x20ecb2='\x22'+_0x20ecb2+'\x22';}_0x18a203[_0x9c6b('0x2a')](_0x20ecb2);});_0x12dc16=_0x12dc16['replace']('{EXPR}',_0x18a203['join']('\x20'));return _0x12dc16;};exports['getOptions']=function(_0x413ac6,_0x26f428,_0x3de6b4){var _0x280683={},_0x468801={};if(_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')]){_0x26f428[_0x9c6b('0x2b')]['id']=_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')];delete _0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')];}_0x280683[_0x9c6b('0x4')]=_[_0x9c6b('0x19')](_0x413ac6,_0x9c6b('0x15'));_0x280683[_0x9c6b('0x2b')]=_['keys'](_0x26f428[_0x9c6b('0x2b')]);_0x280683['filters']=_[_0x9c6b('0x2d')](_0x280683[_0x9c6b('0x4')],_0x280683[_0x9c6b('0x2b')]);_0x468801[_0x9c6b('0x2e')]=_[_0x9c6b('0x2d')](_0x280683[_0x9c6b('0x4')],this[_0x9c6b('0x6')](_0x26f428['query']['fields']));_0x468801['attributes']=_0x468801[_0x9c6b('0x2e')]['length']?_0x468801[_0x9c6b('0x2e')]:_0x280683[_0x9c6b('0x4')];if(!_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2f')](_0x9c6b('0x30'))){_0x468801[_0x9c6b('0x31')]=this[_0x9c6b('0x31')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x31')]);_0x468801['offset']=this[_0x9c6b('0x18')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x18')]);}_0x468801[_0x9c6b('0x32')]=this[_0x9c6b('0x33')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x33')]);_0x468801[_0x9c6b('0x34')]=this['filters'](_['pick'](_0x26f428[_0x9c6b('0x2b')],_0x280683[_0x9c6b('0x35')]),_0x413ac6);if(_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x36')]){var _0x528ba2=_0x413ac6;var _0x5082a4=_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x36')];if(typeof _0x5082a4===_0x9c6b('0x37')){_0x528ba2=_[_0x9c6b('0x36')](_0x413ac6,function(_0x498fdc){return _[_0x9c6b('0x38')](_0x5082a4[_0x9c6b('0x39')],_0x498fdc[_0x9c6b('0x15')]);});_0x5082a4=_0x5082a4[_0x9c6b('0x3a')];}_0x468801[_0x9c6b('0x34')]=_[_0x9c6b('0x3b')](_0x468801[_0x9c6b('0x34')],{'$or':_['map'](_0x528ba2,function(_0x32acd0){if(_0x32acd0[_0x9c6b('0xc')]!==_0x9c6b('0x3c')){if(_0x3de6b4){return sequelize[_0x9c6b('0x34')](sequelize['fn'](_0x9c6b('0x3d'),sequelize[_0x9c6b('0x1b')](_0x32acd0[_0x9c6b('0x15')])),{'$like':sequelize['fn'](_0x9c6b('0x3d'),'%'+_0x26f428[_0x9c6b('0x2b')]['filter']+'%')});}else{var _0x4707be={};_0x4707be[_0x32acd0['name']]={'$like':'%'+_0x26f428['query']['filter']+'%'};return _0x4707be;}}})});}_0x468801=_[_0x9c6b('0x3b')]({},_0x468801,_0x26f428[_0x9c6b('0x3e')]);return _0x468801;};exports[_0x9c6b('0x3f')]=function(_0xe9d9){var _0x4ee127=[];if(_0xe9d9[_0x9c6b('0x40')]){_0x4ee127[_0x9c6b('0x2a')]({'all':!![]});}else if(_0xe9d9['include']){if(Array['isArray'](_0xe9d9[_0x9c6b('0x3f')])){_0x4ee127=Object[_0x9c6b('0x2')](_0xe9d9[_0x9c6b('0x3f')])[_0x9c6b('0x19')](function(_0x40bbf1){return parseIncludeModel(_0xe9d9['include'][_0x40bbf1]);});}else{var _0x491604=parseIncludeModel(_0xe9d9['include']);_0x4ee127[_0x9c6b('0x2a')](_0x491604);}}return _0x4ee127;};exports[_0x9c6b('0x41')]=function(_0x469b46){return _0x469b46[_0x9c6b('0x27')](/[%_^-]/g,function(_0x3fd62a){return'\x5c'+_0x3fd62a;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 1d4f21d..c0ecf09 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7aa=['voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','findAll','fullname','chatPause','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','fullname,internal','internal','substring','validateSortParameter','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','name','role','openchannelStatus','chatCapacity','faxCapacity','openchannelCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil'];(function(_0x2e2c26,_0x1b3e84){var _0x345643=function(_0x564df5){while(--_0x564df5){_0x2e2c26['push'](_0x2e2c26['shift']());}};_0x345643(++_0x1b3e84);}(_0xb7aa,0x11a));var _0xab7a=function(_0x5c56ec,_0xc7f70b){_0x5c56ec=_0x5c56ec-0x0;var _0x438537=_0xb7aa[_0x5c56ec];return _0x438537;};'use strict';var _=require(_0xab7a('0x0'));var jayson=require(_0xab7a('0x1'));var db=require(_0xab7a('0x2'))['db'];var amiClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232a});var routingClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232c});function isAgentPaused(_0x242521,_0x34adc3){var _0x3b0621=[_0x242521['chatPause'],_0x242521[_0xab7a('0x5')],_0x242521[_0xab7a('0x6')],_0x242521[_0xab7a('0x7')],_0x242521[_0xab7a('0x8')],_0x242521['voicePause'],_0x242521[_0xab7a('0x9')]];if(!_0x34adc3)return _[_0xab7a('0xa')](_0x3b0621);var _0x520d21=_[_0xab7a('0xb')](_0x3b0621);return _0x520d21[_0xab7a('0xc')]>0x0&&_0x520d21[_0xab7a('0xc')]<_0x3b0621[_0xab7a('0xc')]?!![]:![];}function isIdle(_0x40cc81){return _0x40cc81===_0xab7a('0xd')||_0x40cc81===_0xab7a('0xe')||_0x40cc81===_0xab7a('0xf')||_0x40cc81===_0xab7a('0x10')||_[_0xab7a('0x11')](_0x40cc81);}function isAgentIdle(_0x563b84){if(_0x563b84[_0xab7a('0x12')]!==_0xab7a('0xd')&&_0x563b84[_0xab7a('0x13')]){_0x563b84[_0xab7a('0x12')]='pause';return![];}return _[_0xab7a('0xa')]([_0x563b84[_0xab7a('0x14')],_0x563b84[_0xab7a('0x15')],_0x563b84[_0xab7a('0x16')],_0x563b84['openchannelStatus'],_0x563b84[_0xab7a('0x17')],_0x563b84[_0xab7a('0x12')],_0x563b84['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xab7a('0x18')](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x8ddb0d){if(_0x8ddb0d[_0xab7a('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x198e78=_0x8ddb0d[_0xab7a('0x1c')];return routingClient['request'](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x187f51){if(_0x187f51[_0xab7a('0x1b')]){throw new Error(_0xab7a('0x1d'));}var _0x14b2b5=_0x187f51[_0xab7a('0x1c')];return _['merge']({},_0x198e78,_0x14b2b5);});})[_0xab7a('0x1e')](function(_0x2ea6c8){throw _0x2ea6c8;});}exports[_0xab7a('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x9db11a){var _0x2fa287=_0xab7a('0xe');if(isAgentPaused(_0x9db11a))_0x2fa287=_0xab7a('0x20');else if(isAgentPaused(_0x9db11a,!![]))_0x2fa287=_0xab7a('0x21');else if(isAgentIdle(_0x9db11a))_0x2fa287=_0xab7a('0xd');else _0x2fa287=_0xab7a('0x22');return _0x2fa287;}exports[_0xab7a('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x5b7ee4,_0x4b65f0){var _0x5c4c3e=_[_0xab7a('0x24')](_0x5b7ee4)?_0x5b7ee4:[_0x5b7ee4];var _0x210ac6=_[_0xab7a('0x25')](_0x4b65f0)+_0xab7a('0x26');var _0x41ecb5=_[_0xab7a('0x27')](_0x5c4c3e,function(_0x3324f2){return db[_0x210ac6]['findOne']({'where':{'id':_0x3324f2}})['then'](function(_0x2c62dc){if(!_0x2c62dc)return[];return _0x2c62dc['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x41ecb5)[_0xab7a('0x1a')](function(_0x570a8b){var _0x169417=_(_0x570a8b)[_0xab7a('0x28')]()[_0xab7a('0x27')]('id')[_0xab7a('0x29')]()[_0xab7a('0x2a')]();return _0x169417;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x14fbee,_0x47f1e1,_0x26c106){try{if(_0x47f1e1['length']>0x0){_0x14fbee=_0x14fbee[_0xab7a('0xb')](function(_0x311dfa){return _0x47f1e1[_0xab7a('0x2b')](_0x311dfa['id']);});}var _0x599375=_0x14fbee['filter'](function(_0x2e0600){var _0x5b5501=_0xab7a('0x22');if(isAgentIdle(_0x2e0600)){_0x5b5501=_0xab7a('0xd');}return _0x5b5501===_0x26c106;});return _['map'](_0x599375,'id');}catch(_0x14065b){throw _0x14065b;}}exports[_0xab7a('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x467dce,_0x6e0d82,_0x36b71e){return Promise[_0xab7a('0x2d')]()['then'](function(){if(_0x6e0d82[_0xab7a('0xc')]>0x0){_0x467dce=_0x467dce['filter'](function(_0x304af8){return _0x6e0d82[_0xab7a('0x2b')](_0x304af8['id']);});}return _0x467dce;})[_0xab7a('0x1a')](function(){return db['User'][_0xab7a('0x2e')]({'attributes':['id','name',_0xab7a('0x2f'),_0xab7a('0x30'),_0xab7a('0x5'),_0xab7a('0x6'),_0xab7a('0x7'),_0xab7a('0x8'),_0xab7a('0x13'),_0xab7a('0x9'),'pauseType'],'where':{'id':{'$in':_[_0xab7a('0x27')](_0x467dce,'id')}},'raw':!![]});})[_0xab7a('0x1a')](function(_0x2ac036){return _0x2ac036[_0xab7a('0x27')](function(_0x4ad5ff){var _0x2df446=_[_0xab7a('0x31')](_0x467dce,['id',_0x4ad5ff['id']]);var _0x2377d9=filterAgentAttributes(_0x2df446);_['merge'](_0x4ad5ff,_0x2377d9);_0x4ad5ff[_0xab7a('0x32')]=getAgentStatus(_0x4ad5ff);return _0x4ad5ff;});})[_0xab7a('0x1a')](function(_0x2243aa){var _0x1db644=sortAgentsByStatus(_0x2243aa,_0x36b71e);return _['map'](_0x1db644,'id');})[_0xab7a('0x1e')](function(_0x4d178f){throw _0x4d178f;});}exports[_0xab7a('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4fa7c9){var _0x4bdbea={'fields':[],'order':null};var _0x8e145b=_0x4fa7c9['split'](',');_0x4bdbea[_0xab7a('0x34')]=_[_0xab7a('0xb')](_0x8e145b,function(_0x5aadb1){if(!_0x5aadb1['includes'](_0xab7a('0x32'))){return!![];}_0x4bdbea[_0xab7a('0x35')]=_[_0xab7a('0x36')](_0x5aadb1,'-')?_0xab7a('0x37'):'ASC';return![];});return _0x4bdbea;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1dd395){if(!_0x1dd395){_0x1dd395=_0xab7a('0x38');}if(_0x1dd395[_0xab7a('0x2b')](_0xab7a('0x2f'))&&!_0x1dd395['includes'](_0xab7a('0x39'))){var _0xcac61=_0x1dd395[_0xab7a('0x3a')](0x0,_0x1dd395['indexOf'](_0xab7a('0x2f')));_0x1dd395+=','+_0xcac61+_0xab7a('0x39');}return _0x1dd395;}exports[_0xab7a('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x9cfc25,_0x4d9303){var _0x1e431d=_0x9cfc25['sort'](function(_0x6bfc12,_0x1bf286){if(_0x6bfc12[_0xab7a('0x32')]===_0x1bf286['globalStatus']){if(_0x6bfc12[_0xab7a('0x32')]===_0xab7a('0x20')){if(_0x4d9303===_0xab7a('0x37')){return(_0x6bfc12[_0xab7a('0x3c')]||'')<(_0x1bf286['pauseType']||'')||_0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()>_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return(_0x6bfc12['pauseType']||'')<(_0x1bf286[_0xab7a('0x3c')]||'')||_0x6bfc12['fullname'][_0xab7a('0x3d')]()>_0x1bf286['fullname'][_0xab7a('0x3d')]()?-0x1:0x1;}}else{if(_0x4d9303===_0xab7a('0x37')){return _0x6bfc12['fullname'][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4d9303==='DESC'){return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?-0x1:0x1;}}});return _0x1e431d;}exports[_0xab7a('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0xbaef59){var _0x2930c5=[_0xab7a('0x3f'),_0xab7a('0x40'),_0xab7a('0x41'),_0xab7a('0x42'),_0xab7a('0x3c'),'lastPauseAt','internal',_0xab7a('0x43'),_0xab7a('0x30'),_0xab7a('0x7'),'mailPause',_0xab7a('0x8'),'whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'chatCapacity','openchannelCapacity','mailCapacity',_0xab7a('0x44'),_0xab7a('0x45'),'faxCapacity','chatCurrentCapacity',_0xab7a('0x46'),_0xab7a('0x47'),_0xab7a('0x48'),_0xab7a('0x49'),_0xab7a('0x4a'),'chatStatus','openchannelStatus',_0xab7a('0x16'),'smsStatus',_0xab7a('0x4b'),'faxStatus',_0xab7a('0x12'),_0xab7a('0x4c'),_0xab7a('0x4d'),_0xab7a('0x4e'),_0xab7a('0x4f'),_0xab7a('0x50'),_0xab7a('0x51'),_0xab7a('0x52'),_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xab7a('0x56')];var _0xafeb36=[_0xab7a('0x30'),_0xab7a('0x7'),'mailPause','smsPause','whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'online'];var _0x7ccec9=_(_0xbaef59)[_0xab7a('0x57')](_0xafeb36)[_0xab7a('0x58')](_0x2930c5)[_0xab7a('0x2a')]();return _0x7ccec9;}exports[_0xab7a('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xab7a('0x5a'),_0xab7a('0x2f'),_0xab7a('0x5b'),_0xab7a('0x39'),_0xab7a('0x40'),_0xab7a('0x32'),_0xab7a('0x3f'),'lastLoginAt','pauseType',_0xab7a('0x42'),_0xab7a('0x5'),_0xab7a('0x30'),'mailPause',_0xab7a('0x7'),'smsPause',_0xab7a('0x13'),'whatsappPause',_0xab7a('0x14'),'faxStatus',_0xab7a('0x16'),_0xab7a('0x5c'),_0xab7a('0x17'),_0xab7a('0x12'),_0xab7a('0x4b'),_0xab7a('0x4c'),_0xab7a('0x51'),_0xab7a('0x4e'),_0xab7a('0x4d'),'smsStatusTime','voiceStatusTime','whatsappStatusTime',_0xab7a('0x5d'),_0xab7a('0x5e'),'mailCapacity',_0xab7a('0x5f'),_0xab7a('0x44'),_0xab7a('0x45'),_0xab7a('0x60'),_0xab7a('0x4a'),_0xab7a('0x47'),_0xab7a('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xab7a('0x61'),_0xab7a('0x56'),_0xab7a('0x54'),_0xab7a('0x62'),_0xab7a('0x53'),_0xab7a('0x55')];}exports[_0xab7a('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x530f=['mailPause','whatsappPause','pauseType','find','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxStatus','smsStatusTime','mailCurrentCapacity','jayson/promise','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname'];(function(_0x1dee62,_0x275e18){var _0x37c117=function(_0x3f7c8c){while(--_0x3f7c8c){_0x1dee62['push'](_0x1dee62['shift']());}};_0x37c117(++_0x275e18);}(_0x530f,0x167));var _0xf530=function(_0x32faa6,_0x231c1f){_0x32faa6=_0x32faa6-0x0;var _0x1526dd=_0x530f[_0x32faa6];return _0x1526dd;};'use strict';var _=require('lodash');var jayson=require(_0xf530('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xf530('0x1')]({'port':0x232a});var routingClient=jayson[_0xf530('0x2')][_0xf530('0x1')]({'port':0x232c});function isAgentPaused(_0x206a5d,_0x464b2e){var _0x2bacf8=[_0x206a5d[_0xf530('0x3')],_0x206a5d[_0xf530('0x4')],_0x206a5d['mailPause'],_0x206a5d[_0xf530('0x5')],_0x206a5d[_0xf530('0x6')],_0x206a5d[_0xf530('0x7')],_0x206a5d['whatsappPause']];if(!_0x464b2e)return _[_0xf530('0x8')](_0x2bacf8);var _0xf205be=_[_0xf530('0x9')](_0x2bacf8);return _0xf205be[_0xf530('0xa')]>0x0&&_0xf205be[_0xf530('0xa')]<_0x2bacf8[_0xf530('0xa')]?!![]:![];}function isIdle(_0x4b8336){return _0x4b8336===_0xf530('0xb')||_0x4b8336===_0xf530('0xc')||_0x4b8336===_0xf530('0xd')||_0x4b8336===_0xf530('0xe')||_[_0xf530('0xf')](_0x4b8336);}function isAgentIdle(_0x39912f){if(_0x39912f['voiceStatus']!=='idle'&&_0x39912f[_0xf530('0x7')]){_0x39912f[_0xf530('0x10')]=_0xf530('0x11');return![];}return _[_0xf530('0x8')]([_0x39912f[_0xf530('0x12')],_0x39912f['faxStatus'],_0x39912f[_0xf530('0x13')],_0x39912f[_0xf530('0x14')],_0x39912f[_0xf530('0x15')],_0x39912f[_0xf530('0x10')],_0x39912f[_0xf530('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xf530('0x17')](_0xf530('0x18'),{})[_0xf530('0x19')](function(_0x4cbfc0){if(_0x4cbfc0[_0xf530('0x1a')]){throw new Error(_0xf530('0x1b'));}var _0x47e156=_0x4cbfc0[_0xf530('0x1c')];return routingClient[_0xf530('0x17')]('Agents',{})[_0xf530('0x19')](function(_0x255bb3){if(_0x255bb3[_0xf530('0x1a')]){throw new Error(_0xf530('0x1d'));}var _0x52c10f=_0x255bb3[_0xf530('0x1c')];return _[_0xf530('0x1e')]({},_0x47e156,_0x52c10f);});})[_0xf530('0x1f')](function(_0x384f92){throw _0x384f92;});}exports[_0xf530('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3cb0f7){var _0x48f834=_0xf530('0xc');if(isAgentPaused(_0x3cb0f7))_0x48f834=_0xf530('0x11');else if(isAgentPaused(_0x3cb0f7,!![]))_0x48f834=_0xf530('0x21');else if(isAgentIdle(_0x3cb0f7))_0x48f834=_0xf530('0xb');else _0x48f834=_0xf530('0x22');return _0x48f834;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x4dbbaf,_0x5679ce){var _0x4375af=_[_0xf530('0x23')](_0x4dbbaf)?_0x4dbbaf:[_0x4dbbaf];var _0x3e6b3b=_[_0xf530('0x24')](_0x5679ce)+_0xf530('0x25');var _0x4bb1b3=_[_0xf530('0x26')](_0x4375af,function(_0x1473b6){return db[_0x3e6b3b][_0xf530('0x27')]({'where':{'id':_0x1473b6}})[_0xf530('0x19')](function(_0x21b89d){if(!_0x21b89d)return[];return _0x21b89d[_0xf530('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf530('0x29')](_0x4bb1b3)[_0xf530('0x19')](function(_0x32f17a){var _0x1f3c88=_(_0x32f17a)[_0xf530('0x2a')]()['map']('id')[_0xf530('0x2b')]()[_0xf530('0x2c')]();return _0x1f3c88;});}exports[_0xf530('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58a41a,_0x21b792,_0x5b7837){try{if(_0x21b792['length']>0x0){_0x58a41a=_0x58a41a[_0xf530('0x9')](function(_0x3efab8){return _0x21b792[_0xf530('0x2e')](_0x3efab8['id']);});}var _0x5dea4d=_0x58a41a[_0xf530('0x9')](function(_0x3f3480){var _0x3170f7=_0xf530('0x22');if(isAgentIdle(_0x3f3480)){_0x3170f7=_0xf530('0xb');}return _0x3170f7===_0x5b7837;});return _[_0xf530('0x26')](_0x5dea4d,'id');}catch(_0x39b429){throw _0x39b429;}}exports[_0xf530('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x26dece,_0x321fb7,_0x5572ba){return Promise[_0xf530('0x30')]()['then'](function(){if(_0x321fb7[_0xf530('0xa')]>0x0){_0x26dece=_0x26dece[_0xf530('0x9')](function(_0x4d60ad){return _0x321fb7['includes'](_0x4d60ad['id']);});}return _0x26dece;})['then'](function(){return db[_0xf530('0x31')][_0xf530('0x32')]({'attributes':['id',_0xf530('0x33'),_0xf530('0x34'),'chatPause','faxPause',_0xf530('0x35'),_0xf530('0x5'),_0xf530('0x6'),_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x37')],'where':{'id':{'$in':_[_0xf530('0x26')](_0x26dece,'id')}},'raw':!![]});})['then'](function(_0x1cef3b){return _0x1cef3b[_0xf530('0x26')](function(_0x11292b){var _0x1375de=_[_0xf530('0x38')](_0x26dece,['id',_0x11292b['id']]);var _0x4b75af=filterAgentAttributes(_0x1375de);_[_0xf530('0x1e')](_0x11292b,_0x4b75af);_0x11292b['globalStatus']=getAgentStatus(_0x11292b);return _0x11292b;});})[_0xf530('0x19')](function(_0x53c95a){var _0xa3ce3f=sortAgentsByStatus(_0x53c95a,_0x5572ba);return _[_0xf530('0x26')](_0xa3ce3f,'id');})[_0xf530('0x1f')](function(_0x46fe51){throw _0x46fe51;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44bd4d){var _0x4b77d9={'fields':[],'order':null};var _0x5b7bfc=_0x44bd4d[_0xf530('0x39')](',');_0x4b77d9[_0xf530('0x3a')]=_[_0xf530('0x9')](_0x5b7bfc,function(_0x43a308){if(!_0x43a308[_0xf530('0x2e')](_0xf530('0x3b'))){return!![];}_0x4b77d9[_0xf530('0x3c')]=_[_0xf530('0x3d')](_0x43a308,'-')?_0xf530('0x3e'):_0xf530('0x3f');return![];});return _0x4b77d9;}exports[_0xf530('0x40')]=getUpdatedSortOptions;function validateSortParameter(_0x2551f1){if(!_0x2551f1){_0x2551f1='fullname,internal';}if(_0x2551f1[_0xf530('0x2e')](_0xf530('0x34'))&&!_0x2551f1[_0xf530('0x2e')](_0xf530('0x41'))){var _0x20aefd=_0x2551f1[_0xf530('0x42')](0x0,_0x2551f1[_0xf530('0x43')]('fullname'));_0x2551f1+=','+_0x20aefd+'internal';}return _0x2551f1;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xe016,_0x1b4e94){var _0x3e1cda=_0xe016[_0xf530('0x44')](function(_0x1f202f,_0x4cb84f){if(_0x1f202f[_0xf530('0x3b')]===_0x4cb84f['globalStatus']){if(_0x1f202f[_0xf530('0x3b')]===_0xf530('0x11')){if(_0x1b4e94===_0xf530('0x3e')){return(_0x1f202f[_0xf530('0x37')]||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f['fullname'][_0xf530('0x45')]()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1f202f['pauseType']||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f[_0xf530('0x34')]['toLowerCase']()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x34')][_0xf530('0x45')]()<_0x4cb84f['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x1f202f[_0xf530('0x34')]['toLowerCase']()<_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x3b')]<_0x4cb84f['globalStatus']?0x1:-0x1;}else{return _0x1f202f['globalStatus']<_0x4cb84f['globalStatus']?-0x1:0x1;}}});return _0x3e1cda;}exports[_0xf530('0x46')]=sortAgentsByStatus;function filterAgentAttributes(_0x56063f){var _0x3948e0=[_0xf530('0x47'),_0xf530('0x48'),_0xf530('0x49'),_0xf530('0x4a'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x41'),_0xf530('0x4b'),_0xf530('0x3'),_0xf530('0x5'),_0xf530('0x35'),_0xf530('0x6'),_0xf530('0x36'),_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x4c'),_0xf530('0x4d'),_0xf530('0x4e'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x51'),_0xf530('0x52'),_0xf530('0x53'),'mailCurrentCapacity',_0xf530('0x54'),_0xf530('0x55'),_0xf530('0x56'),_0xf530('0x12'),_0xf530('0x14'),'mailStatus',_0xf530('0x15'),_0xf530('0x16'),'faxStatus',_0xf530('0x10'),_0xf530('0x57'),_0xf530('0x58'),_0xf530('0x59'),'smsStatusTime',_0xf530('0x5a'),_0xf530('0x5b'),_0xf530('0x5c'),_0xf530('0x5d'),_0xf530('0x5e'),_0xf530('0x5f'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60')];var _0x769171=[_0xf530('0x3'),_0xf530('0x5'),'mailPause',_0xf530('0x6'),'whatsappPause',_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x48')];var _0x497e3b=_(_0x56063f)[_0xf530('0x61')](_0x769171)['pick'](_0x3948e0)[_0xf530('0x2c')]();return _0x497e3b;}exports[_0xf530('0x62')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf530('0x33'),_0xf530('0x34'),_0xf530('0x63'),'internal','online','globalStatus',_0xf530('0x47'),_0xf530('0x49'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x4'),'chatPause','mailPause',_0xf530('0x5'),'smsPause',_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x12'),_0xf530('0x64'),'mailStatus',_0xf530('0x14'),_0xf530('0x15'),'voiceStatus',_0xf530('0x16'),_0xf530('0x57'),_0xf530('0x5b'),_0xf530('0x59'),_0xf530('0x58'),_0xf530('0x65'),_0xf530('0x5c'),'whatsappStatusTime','chatCapacity',_0xf530('0x51'),'mailCapacity',_0xf530('0x4d'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x52'),_0xf530('0x56'),_0xf530('0x66'),_0xf530('0x53'),_0xf530('0x54'),_0xf530('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60'),_0xf530('0x5e'),'onhold',_0xf530('0x5d'),_0xf530('0x5f')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 2ea4637..5e8dddd 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2917=['outbound','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','map','get'];(function(_0x35b7c7,_0x382abb){var _0x2061c1=function(_0x4b0e79){while(--_0x4b0e79){_0x35b7c7['push'](_0x35b7c7['shift']());}};_0x2061c1(++_0x382abb);}(_0x2917,0x16e));var _0x7291=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x2917[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7291('0x0'));var jayson=require('jayson/promise');var util=require(_0x7291('0x1'));var amiClient=jayson[_0x7291('0x2')][_0x7291('0x3')]({'port':0x232a});var routingClient=jayson[_0x7291('0x2')][_0x7291('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7291('0x4'),_0x7291('0x5'),_0x7291('0x6'),_0x7291('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x7291('0x8'),_0x7291('0x9'),_0x7291('0xa'),_0x7291('0xb'),_0x7291('0xc'),_0x7291('0xd'),_0x7291('0xe'),'ringInUse',_0x7291('0xf'),'unavailable',_0x7291('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7291('0x11'),_0x7291('0x12'),_0x7291('0x13'),_0x7291('0x14'),_0x7291('0x15'),_0x7291('0x16'),_0x7291('0x17'),'startPredictive',_0x7291('0x18'),_0x7291('0x19'),_0x7291('0x1a'),_0x7291('0x1b'),_0x7291('0x1c'),'dialPredictiveInterval',_0x7291('0x1d'),_0x7291('0x1e'),_0x7291('0x1f'),_0x7291('0x20'),_0x7291('0x21'),_0x7291('0x22'),_0x7291('0x23'),_0x7291('0x24'),_0x7291('0x25')];function getRealtimeQueues(_0x1ed54b,_0x547569){var _0x2b5bb0=_0x547569===_0x7291('0x26')?amiClient:routingClient;return _0x2b5bb0[_0x7291('0x27')](_[_0x7291('0x28')](_0x547569)+'Queues',_0x1ed54b)[_0x7291('0x29')](function(_0x4c3b59){if(_0x4c3b59[_0x7291('0x2a')])throw new Error(util['format'](_0x7291('0x2b'),_0x547569));return _0x4c3b59[_0x7291('0x2c')];})[_0x7291('0x2d')](function(_0x2cdd10){throw _0x2cdd10;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x588e54,_0x7cf8a3,_0x4f74c4,_0x421538){var _0x4d6b26=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4f74c4===_0x7291('0x26')){if(_0x421538===_0x7291('0x2e')){_0x4d6b26=_0x4d6b26[_0x7291('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x421538==='outbound'){_0x4d6b26=_0x4d6b26[_0x7291('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x588e54[_0x7291('0x30')](function(_0x4cbfcb){var _0x712ed0=_0x4cbfcb[_0x7291('0x31')]({'plain':!![]});_0x712ed0[_0x7291('0x6')]=0x0;_0x712ed0[_0x7291('0xb')]=0x0;_0x712ed0['loggedIn']=0x0;_0x712ed0['available']=0x0;_0x712ed0['waiting']=0x0;if(_0x4f74c4==='voice'){_0x712ed0[_0x7291('0xf')]=0x0;_0x712ed0[_0x7291('0x8')]=0x0;if(_0x421538===_0x7291('0x32')){_0x712ed0[_0x7291('0x11')]=0x0;_0x712ed0[_0x7291('0x12')]=0x0;}}var _0x39643c=_['find'](_0x7cf8a3,['id',_0x712ed0['id']]);if(_0x39643c){_['merge'](_0x712ed0,_['pick'](_0x39643c,_0x4d6b26));}return _0x712ed0;});}exports[_0x7291('0x33')]=initializeQueues; \ No newline at end of file +var _0xcf64=['initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','onHold','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','find','merge'];(function(_0x58ced2,_0x189c6d){var _0x1f2617=function(_0x45f5b2){while(--_0x45f5b2){_0x58ced2['push'](_0x58ced2['shift']());}};_0x1f2617(++_0x189c6d);}(_0xcf64,0x1a1));var _0x4cf6=function(_0x11414f,_0x819df){_0x11414f=_0x11414f-0x0;var _0x43de3f=_0xcf64[_0x11414f];return _0x43de3f;};'use strict';var _=require('lodash');var jayson=require(_0x4cf6('0x0'));var util=require(_0x4cf6('0x1'));var amiClient=jayson[_0x4cf6('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4cf6('0x2')][_0x4cf6('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4cf6('0x4'),_0x4cf6('0x5'),_0x4cf6('0x6'),_0x4cf6('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x4cf6('0x8'),_0x4cf6('0x9'),_0x4cf6('0xa'),'loggedInDb','notInUse',_0x4cf6('0xb'),'ringing',_0x4cf6('0xc'),_0x4cf6('0xd'),_0x4cf6('0xe'),_0x4cf6('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x4cf6('0x10'),'originated',_0x4cf6('0x11'),_0x4cf6('0x12'),'dialActive',_0x4cf6('0x13'),_0x4cf6('0x14'),_0x4cf6('0x15'),'startProgressive',_0x4cf6('0x16'),_0x4cf6('0x17'),_0x4cf6('0x18'),_0x4cf6('0x19'),_0x4cf6('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x4cf6('0x1b'),_0x4cf6('0x1c'),_0x4cf6('0x1d'),_0x4cf6('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x4cf6('0x1f'),'predictiveIntervalAvgHoldtime',_0x4cf6('0x20')];function getRealtimeQueues(_0x4ee7ea,_0x8e630f){var _0x51e2e6=_0x8e630f===_0x4cf6('0x21')?amiClient:routingClient;return _0x51e2e6[_0x4cf6('0x22')](_['startCase'](_0x8e630f)+_0x4cf6('0x23'),_0x4ee7ea)[_0x4cf6('0x24')](function(_0x36185a){if(_0x36185a[_0x4cf6('0x25')])throw new Error(util[_0x4cf6('0x26')](_0x4cf6('0x27'),_0x8e630f));return _0x36185a[_0x4cf6('0x28')];})[_0x4cf6('0x29')](function(_0x1c60d8){throw _0x1c60d8;});}exports[_0x4cf6('0x2a')]=getRealtimeQueues;function initializeQueues(_0x29fc16,_0x298e89,_0x594f33,_0x1de7cc){var _0x6d5847=DEFAULT_QUEUE_ATTRIBUTES;if(_0x594f33===_0x4cf6('0x21')){if(_0x1de7cc===_0x4cf6('0x2b')){_0x6d5847=_0x6d5847[_0x4cf6('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1de7cc===_0x4cf6('0x2d')){_0x6d5847=_0x6d5847['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x29fc16[_0x4cf6('0x2e')](function(_0x4b3ea3){var _0x10f8c4=_0x4b3ea3[_0x4cf6('0x2f')]({'plain':!![]});_0x10f8c4['paused']=0x0;_0x10f8c4[_0x4cf6('0x30')]=0x0;_0x10f8c4[_0x4cf6('0x5')]=0x0;_0x10f8c4[_0x4cf6('0x4')]=0x0;_0x10f8c4[_0x4cf6('0x7')]=0x0;if(_0x594f33===_0x4cf6('0x21')){_0x10f8c4['talking']=0x0;_0x10f8c4[_0x4cf6('0x8')]=0x0;if(_0x1de7cc==='outbound'){_0x10f8c4['pTalking']=0x0;_0x10f8c4['originated']=0x0;}}var _0x39e469=_[_0x4cf6('0x31')](_0x298e89,['id',_0x10f8c4['id']]);if(_0x39e469){_[_0x4cf6('0x32')](_0x10f8c4,_['pick'](_0x39e469,_0x6d5847));}return _0x10f8c4;});}exports[_0x4cf6('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index da67d0b..a7b9020 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x819e48,_0x430040){var _0x522d4a=function(_0x1bb24f){while(--_0x1bb24f){_0x819e48['push'](_0x819e48['shift']());}};_0x522d4a(++_0x430040);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 99a5f34..42d4c91 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 _0x3990=['substring','bimedia-machine-uuid','child_process','execSync','orderBy','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','macAddress'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x3990,0x145));var _0x0399=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0x3990[_0x36211c];return _0xd2487b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x0399('0x0'));var exec=require(_0x0399('0x1'))[_0x0399('0x2')];var config=require('../environment');function getInterfaces(){var _0x29927a=[];var _0x3f335e=os['networkInterfaces']();var _0x5d315a=_[_0x0399('0x3')](_['keys'](_0x3f335e));for(var _0x4170dd=0x0;_0x4170dd<_0x5d315a[_0x0399('0x4')];_0x4170dd++){var _0x1435f3=_0x3f335e[_0x5d315a[_0x4170dd]][_0x0399('0x5')](function(_0x13fe37){return _0x13fe37['family']===_0x0399('0x6')&&_0x13fe37['internal']===![];});_0x29927a=_0x29927a[_0x0399('0x7')](_0x1435f3);}return _0x29927a;}function getFirstInterface(){var _0x3fe29c=_[_0x0399('0x8')](getInterfaces());return{'macAddress':_0x3fe29c&&_0x3fe29c[_0x0399('0x9')]?_0x3fe29c[_0x0399('0x9')]:_0x0399('0xa'),'ipAddress':_0x3fe29c&&_0x3fe29c['address']?_0x3fe29c[_0x0399('0xb')]:_0x0399('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3edee5=_[_0x0399('0x3')](os[_0x0399('0xd')]()['map'](function(_0x3547c5){return _0x3547c5[_0x0399('0xe')];}))[_0x0399('0xf')](':');return crypto[_0x0399('0x10')](_0x0399('0x11'))[_0x0399('0x12')](_0x3edee5)[_0x0399('0x13')](_0x0399('0x14'));}exports['getUuid']=function(){var _0xa2d548=os[_0x0399('0x15')]();var _0x16877f=/[0-9a-f-]{36}/;if(config[_0x0399('0x16')]&&_0x16877f['test'](config[_0x0399('0x16')])){return config[_0x0399('0x16')];}else if(_0xa2d548==='win32'){return exec(_0x0399('0x17'),{'encoding':_0x0399('0x18')})['replace']('\x0d\x0a','');}else{var _0x4b6d91=getFirstInterface();var _0x1dd5d7=getCPUhash();var _0x30a0bd=_0x1dd5d7+'|'+os['hostname']()+'|'+_0x4b6d91[_0x0399('0x19')]+'|'+_0x4b6d91['ipAddress'];var _0x5e2af6=crypto[_0x0399('0x10')](_0x0399('0x11'))[_0x0399('0x12')](_0x30a0bd)['digest'](_0x0399('0x14'));return _0x5e2af6[_0x0399('0x1a')](0x0,0x8)+'-'+_0x5e2af6['substring'](0x8,0xc)+'-'+_0x5e2af6['substring'](0xc,0x10)+'-'+_0x5e2af6[_0x0399('0x1a')](0x10,0x14)+'-'+_0x5e2af6['substring'](0x14);}}; \ No newline at end of file +var _0x7e18=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','orderBy','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test'];(function(_0x144e23,_0x4a1144){var _0x458f03=function(_0x2ce156){while(--_0x2ce156){_0x144e23['push'](_0x144e23['shift']());}};_0x458f03(++_0x4a1144);}(_0x7e18,0x92));var _0x87e1=function(_0x2b20b3,_0x124c9e){_0x2b20b3=_0x2b20b3-0x0;var _0x4dad4b=_0x7e18[_0x2b20b3];return _0x4dad4b;};'use strict';var _=require(_0x87e1('0x0'));var os=require('os');var crypto=require(_0x87e1('0x1'));var machine=require(_0x87e1('0x2'));var exec=require(_0x87e1('0x3'))[_0x87e1('0x4')];var config=require(_0x87e1('0x5'));function getInterfaces(){var _0x4e5b56=[];var _0x103733=os[_0x87e1('0x6')]();var _0x4868bd=_['orderBy'](_['keys'](_0x103733));for(var _0x395f77=0x0;_0x395f77<_0x4868bd[_0x87e1('0x7')];_0x395f77++){var _0x5c61ba=_0x103733[_0x4868bd[_0x395f77]][_0x87e1('0x8')](function(_0xba5d35){return _0xba5d35[_0x87e1('0x9')]==='IPv4'&&_0xba5d35[_0x87e1('0xa')]===![];});_0x4e5b56=_0x4e5b56[_0x87e1('0xb')](_0x5c61ba);}return _0x4e5b56;}function getFirstInterface(){var _0x23e6a4=_[_0x87e1('0xc')](getInterfaces());return{'macAddress':_0x23e6a4&&_0x23e6a4['mac']?_0x23e6a4[_0x87e1('0xd')]:_0x87e1('0xe'),'ipAddress':_0x23e6a4&&_0x23e6a4[_0x87e1('0xf')]?_0x23e6a4[_0x87e1('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x22c7b2=_[_0x87e1('0x10')](os[_0x87e1('0x11')]()['map'](function(_0x5e5947){return _0x5e5947[_0x87e1('0x12')];}))[_0x87e1('0x13')](':');return crypto[_0x87e1('0x14')](_0x87e1('0x15'))[_0x87e1('0x16')](_0x22c7b2)[_0x87e1('0x17')](_0x87e1('0x18'));}exports[_0x87e1('0x19')]=function(){var _0x2a9efa=os[_0x87e1('0x1a')]();var _0x3fe582=/[0-9a-f-]{36}/;if(config[_0x87e1('0x1b')]&&_0x3fe582[_0x87e1('0x1c')](config[_0x87e1('0x1b')])){return config['licenseToken'];}else if(_0x2a9efa===_0x87e1('0x1d')){return exec(_0x87e1('0x1e'),{'encoding':_0x87e1('0x1f')})[_0x87e1('0x20')]('\x0d\x0a','');}else{var _0x419120=getFirstInterface();var _0x31732d=getCPUhash();var _0x3547ee=_0x31732d+'|'+os[_0x87e1('0x21')]()+'|'+_0x419120['macAddress']+'|'+_0x419120['ipAddress'];var _0x1948ac=crypto[_0x87e1('0x14')]('md5')['update'](_0x3547ee)[_0x87e1('0x17')]('hex');return _0x1948ac[_0x87e1('0x22')](0x0,0x8)+'-'+_0x1948ac[_0x87e1('0x22')](0x8,0xc)+'-'+_0x1948ac['substring'](0xc,0x10)+'-'+_0x1948ac[_0x87e1('0x22')](0x10,0x14)+'-'+_0x1948ac[_0x87e1('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b3c6c70..ee80cab 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 _0x007b=['decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x28eec9,_0x34eece){var _0xb99c09=function(_0x386a11){while(--_0x386a11){_0x28eec9['push'](_0x28eec9['shift']());}};_0xb99c09(++_0x34eece);}(_0x007b,0xd2));var _0xb007=function(_0x192f9a,_0x12fee2){_0x192f9a=_0x192f9a-0x0;var _0x99d99=_0x007b[_0x192f9a];return _0x99d99;};'use strict';var util=require(_0xb007('0x0'));var moment=require(_0xb007('0x1'));var rp=require(_0xb007('0x2'));var BPromise=require(_0xb007('0x3'));var pkginfo=require(_0xb007('0x4'))(module,'version');var db=require(_0xb007('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xb007('0x6'))(_0xb007('0x7'));var HOST=_0xb007('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46873){return new BPromise(function(_0x495622,_0xdfa657){var _0x2af13d=util['format'](_0xb007('0x9'),HOST,_0x46873,module[_0xb007('0xa')][_0xb007('0xb')]);if(oldToken){_0x2af13d=util[_0xb007('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x46873,module[_0xb007('0xa')]['version'],oldToken);}var _0xd5333c={'uri':_0x2af13d,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xd5333c)['then'](function(_0x198da3){_0x495622(_0x198da3);})[_0xb007('0xd')](function(_0x4561d9){_0xdfa657(_0x4561d9);});});}function manageLicense(_0x7f6659,_0x3af160){var _0x4deb6b=_0x3af160[_0xb007('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4deb6b[_0xb007('0xf')]!==_0x7f6659&&!_0x4deb6b[_0xb007('0x10')]){oldToken=_0x4deb6b[_0xb007('0xf')];}httpRequest(_0x7f6659)[_0xb007('0x11')](function(_0x7439a5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7439a5[_0xb007('0x12')]){isOldTokenSent=![];if(!_0x4deb6b[_0xb007('0x7')]&&_0x4deb6b['license']!=_0x7439a5[_0xb007('0x7')]||_0x4deb6b['license']&&_0x4deb6b[_0xb007('0x10')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4deb6b[_0xb007('0x7')]&&!_0x4deb6b['data2']&&_0x4deb6b[_0xb007('0x7')]!=_0x7439a5[_0xb007('0x7')]){logger[_0xb007('0x13')](_0xb007('0x14'));}if(_0x4deb6b['license']&&!_0x4deb6b['data2']&&_0x4deb6b[_0xb007('0x7')]==_0x7439a5[_0xb007('0x7')]){return _0x3af160;}return _0x3af160[_0xb007('0x15')]({'data1':_0x7f6659,'data2':null,'license':_0x7439a5[_0xb007('0x7')]});}else{if(_0x7439a5[_0xb007('0x7')]||_0x4deb6b[_0xb007('0x7')]){if(!_0x4deb6b[_0xb007('0x10')]){if(_0x4deb6b[_0xb007('0xf')]==_0x7f6659){GRAY_PERIOD_REASON=_0xb007('0x16');logger[_0xb007('0x13')](_0xb007('0x17'));}else{GRAY_PERIOD_REASON=_0xb007('0x18');logger[_0xb007('0x13')](_0xb007('0x19'),_0x4deb6b[_0xb007('0xf')],_0x7f6659);}logger[_0xb007('0x13')](_0xb007('0x1a'),GRAY_PERIOD_REASON[_0xb007('0x1b')](),moment()[_0xb007('0xc')](_0xb007('0x1c')));return _0x3af160[_0xb007('0x15')]({'data2':encryptor['encryptString'](moment()[_0xb007('0xc')](_0xb007('0x1c')))});}else{if(moment()[_0xb007('0x1d')](encryptor[_0xb007('0x1e')](_0x4deb6b['data2']),_0xb007('0x1f'))>DAYS){logger['info'](_0xb007('0x20'),moment()[_0xb007('0xc')](_0xb007('0x1c')));isOldTokenSent=![];return _0x3af160[_0xb007('0x15')]({'data1':_0x7f6659,'data2':null,'license':null});}}}else{if(_0x4deb6b[_0xb007('0xf')]!=_0x7f6659){logger[_0xb007('0x13')](_0xb007('0x19'),_0x4deb6b[_0xb007('0xf')],_0x7f6659);return _0x3af160['update']({'data1':_0x7f6659,'data2':null,'license':null});}}}return _0x3af160;})['then'](function(_0x3d1871){_0x3af160=_0x3d1871;})[_0xb007('0xd')](function(_0x2d58a8){logger[_0xb007('0x21')](_0x2d58a8[_0xb007('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xb007('0x23')](),_0x3af160);},TIME);});}function defaultLicense(){var _0x377b56=hardware['getUuid']();if(_0x377b56){return db[_0xb007('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x377b56}})[_0xb007('0x25')](function(_0x5c9a55,_0x4538aa){logger[_0xb007('0x13')](_0xb007('0x26'),_0x377b56);manageLicense(_0x377b56,_0x5c9a55);})['catch'](function(_0x2eb52f){logger[_0xb007('0x21')](_0x2eb52f['message']);});}}exports[_0xb007('0x27')]=defaultLicense; \ No newline at end of file +var _0xb173=['../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0xb173,0xfb));var _0x3b17=function(_0x3f5e74,_0x27efd1){_0x3f5e74=_0x3f5e74-0x0;var _0x18c571=_0xb173[_0x3f5e74];return _0x18c571;};'use strict';var util=require('util');var moment=require(_0x3b17('0x0'));var rp=require('request-promise');var BPromise=require(_0x3b17('0x1'));var pkginfo=require(_0x3b17('0x2'))(module,_0x3b17('0x3'));var db=require(_0x3b17('0x4'))['db'];var encryptor=require(_0x3b17('0x5'));var hardware=require(_0x3b17('0x6'));var logger=require(_0x3b17('0x7'))(_0x3b17('0x8'));var HOST=_0x3b17('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x15e37c){return new BPromise(function(_0x151555,_0x3f62f4){var _0x10a2b9=util['format'](_0x3b17('0xa'),HOST,_0x15e37c,module[_0x3b17('0xb')]['version']);if(oldToken){_0x10a2b9=util[_0x3b17('0xc')](_0x3b17('0xd'),HOST,_0x15e37c,module[_0x3b17('0xb')][_0x3b17('0x3')],oldToken);}var _0x3bc9c9={'uri':_0x10a2b9,'method':_0x3b17('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3bc9c9)[_0x3b17('0xf')](function(_0x510130){_0x151555(_0x510130);})[_0x3b17('0x10')](function(_0xeae020){_0x3f62f4(_0xeae020);});});}function manageLicense(_0x4f9048,_0x5e6189){var _0x55499b=_0x5e6189['get']({'plain':!![]});if(!isOldTokenSent&&_0x55499b[_0x3b17('0x11')]!==_0x4f9048&&!_0x55499b['data2']){oldToken=_0x55499b['data1'];}httpRequest(_0x4f9048)[_0x3b17('0xf')](function(_0x1cf3b5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1cf3b5[_0x3b17('0x12')]){isOldTokenSent=![];if(!_0x55499b[_0x3b17('0x8')]&&_0x55499b['license']!=_0x1cf3b5[_0x3b17('0x8')]||_0x55499b['license']&&_0x55499b['data2']){logger[_0x3b17('0x13')](_0x3b17('0x14'));}if(_0x55499b[_0x3b17('0x8')]&&!_0x55499b[_0x3b17('0x15')]&&_0x55499b[_0x3b17('0x8')]!=_0x1cf3b5[_0x3b17('0x8')]){logger[_0x3b17('0x13')](_0x3b17('0x16'));}if(_0x55499b['license']&&!_0x55499b[_0x3b17('0x15')]&&_0x55499b[_0x3b17('0x8')]==_0x1cf3b5[_0x3b17('0x8')]){return _0x5e6189;}return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':_0x1cf3b5[_0x3b17('0x8')]});}else{if(_0x1cf3b5[_0x3b17('0x8')]||_0x55499b[_0x3b17('0x8')]){if(!_0x55499b[_0x3b17('0x15')]){if(_0x55499b[_0x3b17('0x11')]==_0x4f9048){GRAY_PERIOD_REASON=_0x3b17('0x18');logger[_0x3b17('0x13')](_0x3b17('0x19'));}else{GRAY_PERIOD_REASON=_0x3b17('0x1a');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x55499b[_0x3b17('0x11')],_0x4f9048);}logger[_0x3b17('0x13')](_0x3b17('0x1b'),GRAY_PERIOD_REASON[_0x3b17('0x1c')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5e6189[_0x3b17('0x17')]({'data2':encryptor['encryptString'](moment()[_0x3b17('0xc')](_0x3b17('0x1d')))});}else{if(moment()[_0x3b17('0x1e')](encryptor[_0x3b17('0x1f')](_0x55499b[_0x3b17('0x15')]),_0x3b17('0x20'))>DAYS){logger[_0x3b17('0x13')](_0x3b17('0x21'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':null});}}}else{if(_0x55499b[_0x3b17('0x11')]!=_0x4f9048){logger['info'](_0x3b17('0x22'),_0x55499b[_0x3b17('0x11')],_0x4f9048);return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':null});}}}return _0x5e6189;})[_0x3b17('0xf')](function(_0x352df2){_0x5e6189=_0x352df2;})[_0x3b17('0x10')](function(_0x1535f2){logger[_0x3b17('0x23')](_0x1535f2[_0x3b17('0x24')]);})[_0x3b17('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x3b17('0x26')](),_0x5e6189);},TIME);});}function defaultLicense(){var _0x54a33e=hardware[_0x3b17('0x26')]();if(_0x54a33e){return db[_0x3b17('0x27')][_0x3b17('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x54a33e}})['spread'](function(_0x59bbff,_0x1ebfd1){logger['info'](_0x3b17('0x29'),_0x54a33e);manageLicense(_0x54a33e,_0x59bbff);})[_0x3b17('0x10')](function(_0x32e393){logger['error'](_0x32e393['message']);});}}exports[_0x3b17('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e61c793..a878e33 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 _0xd7a1=['users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','uuid','data1','isEmpty','data2','split','decryptString','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','format','grayReason','changed','message','User','role','sequelize','COUNT','col','count','admin','user','telephone'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd7a1,0x180));var _0x1d7a=function(_0x41fcb8,_0x12c1e9){_0x41fcb8=_0x41fcb8-0x0;var _0x3c7d62=_0xd7a1[_0x41fcb8];return _0x3c7d62;};'use strict';var util=require(_0x1d7a('0x0'));var _=require(_0x1d7a('0x1'));var moment=require(_0x1d7a('0x2'));var BPromise=require(_0x1d7a('0x3'));var hardware=require(_0x1d7a('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x1d7a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1d7a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1d7a('0x7'),'machineUuid':hardware[_0x1d7a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1d7a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x1d7a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21ba7d){return new BPromise(function(_0x40c85f,_0xae8f91){return db[_0x1d7a('0x9')][_0x1d7a('0xa')](_[_0x1d7a('0xb')](_0x21ba7d,{'raw':!![],'where':{'id':0x1}}))[_0x1d7a('0xc')](function(_0x5dc3f8){return checkLicense(_0x5dc3f8,null);})['then'](function(_0x17dceb){_0x40c85f(_0x17dceb);return;})['catch'](function(_0x16c117){_0xae8f91(_0x16c117);});});}function checkLicense(_0x32ae35,_0x2b30a8){if(!_0x32ae35){demoLicense[_0x1d7a('0xd')]=_0x32ae35[_0x1d7a('0xe')];return demoLicense;}try{var _0x596f28=_0x2b30a8||_0x32ae35['license'];if(_[_0x1d7a('0xf')](_0x596f28)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x537328=_0x32ae35[_0x1d7a('0xe')];var _0x395395=_0x32ae35[_0x1d7a('0x10')];var _0x1b726c=_0x537328[_0x1d7a('0x11')]('-')[0x4];var _0x1a0be5=_0x537328[_0x1d7a('0x11')]('-')[0x0];var _0x306be9=encryptor[_0x1d7a('0x12')](_0x596f28,util['format'](_0x1d7a('0x13'),_0x1b726c,_0x537328,_0x1a0be5));var _0x3c99b8=JSON['parse'](_0x306be9);_0x3c99b8[_0x1d7a('0x14')]=![];_0x3c99b8[_0x1d7a('0xd')]=_0x537328;_0x3c99b8[_0x1d7a('0x15')]=hardware[_0x1d7a('0x8')]();if(_0x395395){var _0x3391ab=encryptor['decryptString'](_0x395395);_0x3c99b8[_0x1d7a('0x16')]=_0x3391ab;_0x3c99b8[_0x1d7a('0x17')]=moment(_0x3391ab)[_0x1d7a('0x18')](0x7,_0x1d7a('0x19'))[_0x1d7a('0x1a')]();_0x3c99b8[_0x1d7a('0x1b')]=_0x3c99b8[_0x1d7a('0xd')]!=_0x3c99b8[_0x1d7a('0x15')]?_0x1d7a('0x1c'):'disabled';}return _0x3c99b8;}catch(_0x325ca2){breakingLicense[_0x1d7a('0xd')]=_0x32ae35[_0x1d7a('0xe')];breakingLicense[_0x1d7a('0x1d')]=_0x325ca2['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x35a185,_0x33f0a1){getLicense()[_0x1d7a('0xc')](function(_0x4bad0d){return db[_0x1d7a('0x1e')]['findAll']({'attributes':[_0x1d7a('0x1f'),[db[_0x1d7a('0x20')]['fn'](_0x1d7a('0x21'),db[_0x1d7a('0x20')][_0x1d7a('0x22')](_0x1d7a('0x1f'))),_0x1d7a('0x23')]],'group':'role','where':{'role':{'$or':[_0x1d7a('0x24'),_0x1d7a('0x25'),_0x1d7a('0x26')]}},'raw':!![]})['then'](function(_0x3d6184){var _0x3830e7={'user':_0x4bad0d[_0x1d7a('0x27')]||0x0,'telephone':_0x4bad0d[_0x1d7a('0x28')]||0x0};_0x3d6184[_0x1d7a('0x29')](function(_0x3a2cf9){var _0x3dd40d=_0x3a2cf9[_0x1d7a('0x1f')]==='admin'?_0x1d7a('0x25'):_0x3a2cf9[_0x1d7a('0x1f')];_0x3830e7[_0x3dd40d]-=_0x3a2cf9[_0x1d7a('0x23')];if(_0x3830e7[_0x3dd40d]<0x0)_0x3830e7[_0x3dd40d]=0x0;});_0x35a185(_0x3830e7);return;});})[_0x1d7a('0x2a')](function(_0x30b65a){_0x33f0a1(_0x30b65a);});});}function checkUserLimits(_0x1d4e6b){return new BPromise(function(_0x27264f,_0x31674d){getLimits()[_0x1d7a('0xc')](function(_0x2165fa){var _0x33718a=_[_0x1d7a('0x2b')](_[_0x1d7a('0x2c')](_0x1d4e6b,_0x1d7a('0x1f')),[_0x1d7a('0x24'),_0x1d7a('0x25'),_0x1d7a('0x26')]);var _0x5f84a5=(_0x33718a[_0x1d7a('0x24')]||0x0)+(_0x33718a['user']||0x0);var _0x575d90=_0x33718a[_0x1d7a('0x26')]||0x0;if(_0x5f84a5>_0x2165fa[_0x1d7a('0x25')])return _0x31674d(_0x1d7a('0x2d'));if(_0x575d90>_0x2165fa[_0x1d7a('0x26')])return _0x31674d('License\x20limit\x20reached\x20for\x20telephones');return _0x27264f();})[_0x1d7a('0x2a')](function(_0x4bf07b){_0x31674d(_0x4bf07b);});});}module[_0x1d7a('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7776=['./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','telephone','users','forEach','user','catch','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird'];(function(_0x31ada2,_0x1ff020){var _0x3c1540=function(_0x4e5898){while(--_0x4e5898){_0x31ada2['push'](_0x31ada2['shift']());}};_0x3c1540(++_0x1ff020);}(_0x7776,0x155));var _0x6777=function(_0x1d3c79,_0x974181){_0x1d3c79=_0x1d3c79-0x0;var _0x4b9695=_0x7776[_0x1d3c79];return _0x4b9695;};'use strict';var util=require(_0x6777('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x6777('0x1'));var hardware=require(_0x6777('0x2'));var encryptor=require(_0x6777('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6777('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6777('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6777('0x6'),'machineUuid':hardware[_0x6777('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18d5b8){return new BPromise(function(_0x5e6ca3,_0x58f762){return db[_0x6777('0x8')][_0x6777('0x9')](_[_0x6777('0xa')](_0x18d5b8,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1bd522){return checkLicense(_0x1bd522,null);})[_0x6777('0xb')](function(_0xa4a27f){_0x5e6ca3(_0xa4a27f);return;})['catch'](function(_0x29299c){_0x58f762(_0x29299c);});});}function checkLicense(_0x5430f0,_0x3549cd){if(!_0x5430f0){demoLicense[_0x6777('0xc')]=_0x5430f0[_0x6777('0xd')];return demoLicense;}try{var _0x584fc1=_0x3549cd||_0x5430f0[_0x6777('0xe')];if(_['isEmpty'](_0x584fc1)){throw new Error(_0x6777('0xf'));}var _0x44dd0e=_0x5430f0['data1'];var _0x5bdd19=_0x5430f0[_0x6777('0x10')];var _0x4bf4bf=_0x44dd0e[_0x6777('0x11')]('-')[0x4];var _0x303843=_0x44dd0e[_0x6777('0x11')]('-')[0x0];var _0x5e378f=encryptor[_0x6777('0x12')](_0x584fc1,util[_0x6777('0x13')](_0x6777('0x14'),_0x4bf4bf,_0x44dd0e,_0x303843));var _0xa582a=JSON[_0x6777('0x15')](_0x5e378f);_0xa582a[_0x6777('0x16')]=![];_0xa582a['uuid']=_0x44dd0e;_0xa582a[_0x6777('0x17')]=hardware[_0x6777('0x7')]();if(_0x5bdd19){var _0x3c72ac=encryptor[_0x6777('0x12')](_0x5bdd19);_0xa582a[_0x6777('0x18')]=_0x3c72ac;_0xa582a[_0x6777('0x19')]=moment(_0x3c72ac)[_0x6777('0x1a')](0x7,'days')[_0x6777('0x13')]();_0xa582a[_0x6777('0x1b')]=_0xa582a[_0x6777('0xc')]!=_0xa582a['machineUuid']?_0x6777('0x1c'):_0x6777('0x1d');}return _0xa582a;}catch(_0x32018f){breakingLicense['uuid']=_0x5430f0[_0x6777('0xd')];breakingLicense[_0x6777('0x1e')]=_0x32018f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1621b2,_0x38ba65){getLicense()[_0x6777('0xb')](function(_0x29d6ab){return db[_0x6777('0x1f')][_0x6777('0x20')]({'attributes':[_0x6777('0x21'),[db[_0x6777('0x22')]['fn'](_0x6777('0x23'),db[_0x6777('0x22')][_0x6777('0x24')](_0x6777('0x21'))),_0x6777('0x25')]],'group':_0x6777('0x21'),'where':{'role':{'$or':['admin','user',_0x6777('0x26')]}},'raw':!![]})['then'](function(_0x85baf3){var _0x4adf0e={'user':_0x29d6ab[_0x6777('0x27')]||0x0,'telephone':_0x29d6ab['telephones']||0x0};_0x85baf3[_0x6777('0x28')](function(_0x13aa48){var _0x583fed=_0x13aa48[_0x6777('0x21')]==='admin'?_0x6777('0x29'):_0x13aa48[_0x6777('0x21')];_0x4adf0e[_0x583fed]-=_0x13aa48[_0x6777('0x25')];if(_0x4adf0e[_0x583fed]<0x0)_0x4adf0e[_0x583fed]=0x0;});_0x1621b2(_0x4adf0e);return;});})[_0x6777('0x2a')](function(_0x456f91){_0x38ba65(_0x456f91);});});}function checkUserLimits(_0x55be1a){return new BPromise(function(_0x5cd7bc,_0x245742){getLimits()[_0x6777('0xb')](function(_0x3a7550){var _0x459d06=_[_0x6777('0x2b')](_[_0x6777('0x2c')](_0x55be1a,_0x6777('0x21')),['admin',_0x6777('0x29'),_0x6777('0x26')]);var _0x1997e4=(_0x459d06[_0x6777('0x2d')]||0x0)+(_0x459d06[_0x6777('0x29')]||0x0);var _0x4f7625=_0x459d06[_0x6777('0x26')]||0x0;if(_0x1997e4>_0x3a7550[_0x6777('0x29')])return _0x245742(_0x6777('0x2e'));if(_0x4f7625>_0x3a7550[_0x6777('0x26')])return _0x245742(_0x6777('0x2f'));return _0x5cd7bc();})[_0x6777('0x2a')](function(_0x563988){_0x245742(_0x563988);});});}module[_0x6777('0x30')]={'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 60cdd03..4099dc5 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 _0x9f0e=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x4adbfe,_0x44732a){var _0x2170ad=function(_0x249e43){while(--_0x249e43){_0x4adbfe['push'](_0x4adbfe['shift']());}};_0x2170ad(++_0x44732a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2972fa,_0x3ced9a){_0x2972fa=_0x2972fa-0x0;var _0x5942d9=_0x9f0e[_0x2972fa];return _0x5942d9;};'use strict';module[_0xe9f0('0x0')]={'DOMAIN':_0xe9f0('0x1'),'SESSION_SECRET':_0xe9f0('0x2'),'GOOGLE_ID':_0xe9f0('0x3'),'GOOGLE_SECRET':_0xe9f0('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb9be=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x52cbaa,_0x4dd3d3){var _0x38698e=function(_0x5c3b98){while(--_0x5c3b98){_0x52cbaa['push'](_0x52cbaa['shift']());}};_0x38698e(++_0x4dd3d3);}(_0xb9be,0xc5));var _0xeb9b=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xb9be[_0x409353];return _0x4f4b59;};'use strict';module[_0xeb9b('0x0')]={'DOMAIN':_0xeb9b('0x1'),'SESSION_SECRET':_0xeb9b('0x2'),'GOOGLE_ID':_0xeb9b('0x3'),'GOOGLE_SECRET':_0xeb9b('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0bbf7e5..5b3a85c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdaa=['fileLogger','exports','../utils/loggers'];(function(_0x462b3a,_0x52fa71){var _0xbc5daa=function(_0x10dc88){while(--_0x10dc88){_0x462b3a['push'](_0x462b3a['shift']());}};_0xbc5daa(++_0x52fa71);}(_0xcdaa,0xb6));var _0xacda=function(_0x52e367,_0xdb16be){_0x52e367=_0x52e367-0x0;var _0x53d936=_0xcdaa[_0x52e367];return _0x53d936;};'use strict';var fileLogger=require(_0xacda('0x0'))[_0xacda('0x1')];module[_0xacda('0x2')]=fileLogger; \ No newline at end of file +var _0x77ec=['exports','fileLogger'];(function(_0x12cf92,_0x3f7046){var _0x9abbd0=function(_0x1998c6){while(--_0x1998c6){_0x12cf92['push'](_0x12cf92['shift']());}};_0x9abbd0(++_0x3f7046);}(_0x77ec,0x149));var _0xc77e=function(_0x5d9cb2,_0x6aeefa){_0x5d9cb2=_0x5d9cb2-0x0;var _0x508ae3=_0x77ec[_0x5d9cb2];return _0x508ae3;};'use strict';var fileLogger=require('../utils/loggers')[_0xc77e('0x0')];module[_0xc77e('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5a06917..ec69d0b 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 _0xc482=['routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','legacy-libs','join','../../services/express/index.js','email','../../services/email/index.js'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc482,0x70));var _0x2c48=function(_0x2c84c7,_0x553577){_0x2c84c7=_0x2c84c7-0x0;var _0x3dc9c3=_0xc482[_0x2c84c7];return _0x3dc9c3;};'use strict';var path=require(_0x2c48('0x0'));var cfg=require(_0x2c48('0x1'));var env={'NODE_PATH':path[_0x2c48('0x2')](path['join'](cfg['root'],_0x2c48('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x2c48('0x4')](__dirname,_0x2c48('0x5')),'env':env},{'name':'ami','script':path[_0x2c48('0x4')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x2c48('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2c48('0x6'),'script':path[_0x2c48('0x4')](__dirname,_0x2c48('0x7')),'env':env},{'name':_0x2c48('0x8'),'script':path[_0x2c48('0x4')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x2c48('0x9'),'script':path['join'](__dirname,_0x2c48('0xa')),'env':env}]};module[_0x2c48('0xb')]=pm2config; \ No newline at end of file +var _0x161e=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x40945a,_0x863740){var _0x36e374=function(_0x8d98bc){while(--_0x8d98bc){_0x40945a['push'](_0x40945a['shift']());}};_0x36e374(++_0x863740);}(_0x161e,0x9c));var _0xe161=function(_0xf07990,_0x18e150){_0xf07990=_0xf07990-0x0;var _0x587c6b=_0x161e[_0xf07990];return _0x587c6b;};'use strict';var path=require(_0xe161('0x0'));var cfg=require(_0xe161('0x1'));var env={'NODE_PATH':path[_0xe161('0x2')](path[_0xe161('0x3')](cfg[_0xe161('0x4')],_0xe161('0x5')))};var pm2config={'apps':[{'name':_0xe161('0x6'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0x7')),'env':env},{'name':_0xe161('0x8'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0x9')),'env':env},{'name':_0xe161('0xa'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xb')),'env':env},{'name':_0xe161('0xc'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xd')),'env':env},{'name':_0xe161('0xe'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xf')),'env':env},{'name':_0xe161('0x10'),'script':path['join'](__dirname,_0xe161('0x11')),'env':env}]};module[_0xe161('0x12')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7f4be3a..6a721ba 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 _0x8eeb=['list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8eeb,0x171));var _0xb8ee=function(_0x6e1fd4,_0x5352bc){_0x6e1fd4=_0x6e1fd4-0x0;var _0x3fbf5b=_0x8eeb[_0x6e1fd4];return _0x3fbf5b;};'use strict';var pm2=require(_0xb8ee('0x0'));var BPromise=require(_0xb8ee('0x1'));var config=require(_0xb8ee('0x2'));function connect(){return new BPromise(function(_0x1fc9f4,_0x5440fa){return pm2[_0xb8ee('0x3')](function(_0x22ee6a){if(_0x22ee6a){return _0x5440fa(_0x22ee6a);}return _0x1fc9f4(_0xb8ee('0x4'));});});};exports[_0xb8ee('0x5')]=function(_0x3152be){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0xcb30fd,_0x593a5f){return pm2[_0xb8ee('0x5')](_0x3152be,function(_0x13e473,_0x444546){if(_0x13e473){return _0x593a5f(_0x13e473);}pm2['disconnect']();return _0xcb30fd(_0x444546);});});});};exports['stop']=function(_0x2abd03){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x4c1782,_0x5c8b20){return pm2[_0xb8ee('0x7')](_0x2abd03,function(_0x3b8367,_0x38c81c){if(_0x3b8367){return _0x5c8b20(_0x3b8367);}pm2[_0xb8ee('0x8')]();return _0x4c1782(_0x38c81c);});});});};exports['restart']=function(_0x3365ad){return connect()['then'](function(){return new BPromise(function(_0x2f31eb,_0x1bcee5){return pm2['restart'](_0x3365ad,function(_0x3c1994,_0x441c67){if(_0x3c1994){return _0x1bcee5(_0x3c1994);}pm2[_0xb8ee('0x8')]();return _0x2f31eb(_0x441c67);});});});};exports[_0xb8ee('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x420fd8,_0x10931c){return pm2[_0xb8ee('0x9')](function(_0x4ed5c5,_0x28fe4d){if(_0x4ed5c5){return _0x10931c(_0x4ed5c5);}pm2[_0xb8ee('0x8')]();return _0x420fd8(_0x28fe4d);});});});};exports[_0xb8ee('0xa')]=function(_0x4c03fa){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x522fb3,_0x4ec87c){return pm2[_0xb8ee('0xa')](_0x4c03fa,function(_0x5990e1,_0x332219){if(_0x5990e1){return _0x4ec87c(_0x5990e1);}pm2[_0xb8ee('0x8')]();return _0x522fb3(_0x332219);});});});};exports[_0xb8ee('0xb')]=function(_0x248726){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x2b4721,_0x539170){return pm2[_0xb8ee('0xb')](_0x248726,function(_0x515141,_0x27ef6d){if(_0x515141){return _0x539170(_0x515141);}pm2[_0xb8ee('0x8')]();return _0x2b4721(_0x27ef6d);});});});};exports[_0xb8ee('0xc')]=function(){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x27d544,_0xc1f5f1){return pm2[_0xb8ee('0xc')](function(_0xd5075b){if(_0xd5075b){return _0xc1f5f1(_0xd5075b);}return _0x27d544(_0xb8ee('0xd'));});});});}; \ No newline at end of file +var _0x3ab9=['list','describe','dump','saved','pm2','bluebird','./config','connect','start','disconnect','stop','then','restart'];(function(_0x10e938,_0x3d860b){var _0x33d03c=function(_0x55ed75){while(--_0x55ed75){_0x10e938['push'](_0x10e938['shift']());}};_0x33d03c(++_0x3d860b);}(_0x3ab9,0x108));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x93ab('0x0'));var BPromise=require(_0x93ab('0x1'));var config=require(_0x93ab('0x2'));function connect(){return new BPromise(function(_0x3afb2e,_0x2a7bc8){return pm2[_0x93ab('0x3')](function(_0x1ce3d2){if(_0x1ce3d2){return _0x2a7bc8(_0x1ce3d2);}return _0x3afb2e('connected');});});};exports[_0x93ab('0x4')]=function(_0x1106e6){return connect()['then'](function(){return new BPromise(function(_0x35e693,_0x36f488){return pm2[_0x93ab('0x4')](_0x1106e6,function(_0x30e5c8,_0x5253af){if(_0x30e5c8){return _0x36f488(_0x30e5c8);}pm2[_0x93ab('0x5')]();return _0x35e693(_0x5253af);});});});};exports[_0x93ab('0x6')]=function(_0x230f3b){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0xceec35,_0x106ec8){return pm2[_0x93ab('0x6')](_0x230f3b,function(_0x5b9442,_0x20da1d){if(_0x5b9442){return _0x106ec8(_0x5b9442);}pm2['disconnect']();return _0xceec35(_0x20da1d);});});});};exports[_0x93ab('0x8')]=function(_0xb54672){return connect()['then'](function(){return new BPromise(function(_0x21202a,_0x525451){return pm2[_0x93ab('0x8')](_0xb54672,function(_0x26c655,_0x190f9d){if(_0x26c655){return _0x525451(_0x26c655);}pm2[_0x93ab('0x5')]();return _0x21202a(_0x190f9d);});});});};exports[_0x93ab('0x9')]=function(){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x3ea6c7,_0x38327f){return pm2[_0x93ab('0x9')](function(_0x556e3e,_0x65b017){if(_0x556e3e){return _0x38327f(_0x556e3e);}pm2[_0x93ab('0x5')]();return _0x3ea6c7(_0x65b017);});});});};exports[_0x93ab('0xa')]=function(_0x17a67d){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x4ee7e3,_0xa5d0cd){return pm2['describe'](_0x17a67d,function(_0x16ea74,_0x214919){if(_0x16ea74){return _0xa5d0cd(_0x16ea74);}pm2[_0x93ab('0x5')]();return _0x4ee7e3(_0x214919);});});});};exports['delete']=function(_0x2edefa){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x27acf8,_0x1bfbc6){return pm2['delete'](_0x2edefa,function(_0x2ffe77,_0x2b3e54){if(_0x2ffe77){return _0x1bfbc6(_0x2ffe77);}pm2[_0x93ab('0x5')]();return _0x27acf8(_0x2b3e54);});});});};exports['dump']=function(){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x4073bb,_0x59ccc5){return pm2[_0x93ab('0xb')](function(_0x251f63){if(_0x251f63){return _0x59ccc5(_0x251f63);}return _0x4073bb(_0x93ab('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 86b9858..43b5062 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 _0xc2f1=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x33c090,_0x184b69){var _0x4081df=function(_0x109a20){while(--_0x109a20){_0x33c090['push'](_0x33c090['shift']());}};_0x4081df(++_0x184b69);}(_0xc2f1,0x68));var _0x1c2f=function(_0x1ff0f0,_0x4a62d4){_0x1ff0f0=_0x1ff0f0-0x0;var _0x46932a=_0xc2f1[_0x1ff0f0];return _0x46932a;};'use strict';var _=require(_0x1c2f('0x0'));var moment=require(_0x1c2f('0x1'));var Redis=require('ioredis');var util=require(_0x1c2f('0x2'));var config=require(_0x1c2f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x1c2f('0x4'))(_0x1c2f('0x5'));config['redis']=_[_0x1c2f('0x6')](config[_0x1c2f('0x7')],{'host':_0x1c2f('0x8'),'port':0x18eb});var io=require(_0x1c2f('0x9'))(new Redis(config[_0x1c2f('0x7')]));function closeInteractions(){var _0x34d76c=0x0;var _0x2986b4=[];return db[_0x1c2f('0xa')][_0x1c2f('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x1c2f('0xc')](function(_0x33071d){_0x34d76c=_0x33071d[_0x1c2f('0xd')];if(_0x34d76c){return db[_0x1c2f('0xe')][_0x1c2f('0xf')]({'raw':!![],'attributes':['id',_0x1c2f('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x33071d[_0x1c2f('0xd')],'minutes')}}});}else{return[];}})[_0x1c2f('0xc')](function(_0x370038){if(_0x370038&&_0x370038[_0x1c2f('0x11')]){_0x2986b4=_['map'](_0x370038||[],'id');logger[_0x1c2f('0x12')](_0x1c2f('0x13'),_0x2986b4['join']());return db[_0x1c2f('0xe')]['update']({'closeReason':_0x1c2f('0x14'),'disposition':_0x1c2f('0x15'),'closed':!![],'closedAt':moment()[_0x1c2f('0x16')](_0x1c2f('0x17'))},{'where':{'id':_0x2986b4}});}})[_0x1c2f('0xc')](function(){if(_0x2986b4&&_0x2986b4[_0x1c2f('0x11')]){logger[_0x1c2f('0x12')](_0x1c2f('0x18'),_0x2986b4[_0x1c2f('0x19')]());for(var _0x37bf93=0x0;_0x37bf93<_0x2986b4['length'];_0x37bf93++){io[_0x1c2f('0x1a')](_0x1c2f('0x1b'),{'id':_0x2986b4[_0x37bf93],'closed':!![]});}}})[_0x1c2f('0x1c')](function(_0x5411b8){logger[_0x1c2f('0x1d')](_0x1c2f('0x1e'),_0x5411b8?util['inspect'](_0x5411b8,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb10c=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xb10c,0xf8));var _0xcb10=function(_0x422f63,_0x40bd6d){_0x422f63=_0x422f63-0x0;var _0x5c61e1=_0xb10c[_0x422f63];return _0x5c61e1;};'use strict';var _=require(_0xcb10('0x0'));var moment=require(_0xcb10('0x1'));var Redis=require(_0xcb10('0x2'));var util=require('util');var config=require(_0xcb10('0x3'));var db=require(_0xcb10('0x4'))['db'];var logger=require(_0xcb10('0x5'))(_0xcb10('0x6'));config[_0xcb10('0x7')]=_['defaults'](config['redis'],{'host':_0xcb10('0x8'),'port':0x18eb});var io=require(_0xcb10('0x9'))(new Redis(config[_0xcb10('0x7')]));function closeInteractions(){var _0x4ab714=0x0;var _0xecfd07=[];return db[_0xcb10('0xa')][_0xcb10('0xb')]({'raw':!![],'attributes':['id',_0xcb10('0xc')],'where':{'id':0x1}})[_0xcb10('0xd')](function(_0x34f4b4){_0x4ab714=_0x34f4b4[_0xcb10('0xc')];if(_0x4ab714){return db[_0xcb10('0xe')][_0xcb10('0xf')]({'raw':!![],'attributes':['id',_0xcb10('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x34f4b4[_0xcb10('0xc')],_0xcb10('0x11'))}}});}else{return[];}})[_0xcb10('0xd')](function(_0x66e040){if(_0x66e040&&_0x66e040[_0xcb10('0x12')]){_0xecfd07=_[_0xcb10('0x13')](_0x66e040||[],'id');logger[_0xcb10('0x14')](_0xcb10('0x15'),_0xecfd07[_0xcb10('0x16')]());return db['ChatInteraction']['update']({'closeReason':_0xcb10('0x17'),'disposition':_0xcb10('0x18'),'closed':!![],'closedAt':moment()[_0xcb10('0x19')](_0xcb10('0x1a'))},{'where':{'id':_0xecfd07}});}})[_0xcb10('0xd')](function(){if(_0xecfd07&&_0xecfd07[_0xcb10('0x12')]){logger[_0xcb10('0x14')](_0xcb10('0x1b'),_0xecfd07[_0xcb10('0x16')]());for(var _0xbcc05f=0x0;_0xbcc05f<_0xecfd07[_0xcb10('0x12')];_0xbcc05f++){io[_0xcb10('0x1c')](_0xcb10('0x1d'),{'id':_0xecfd07[_0xbcc05f],'closed':!![]});}}})[_0xcb10('0x1e')](function(_0xff277c){logger[_0xcb10('0x1f')](_0xcb10('0x20'),_0xff277c?util['inspect'](_0xff277c,{'showHidden':![],'depth':null}):'');});}exports[_0xcb10('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 79eab27..945f933 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9917=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1dc48e,_0x2a9e57){var _0x34035a=function(_0x5f4612){while(--_0x5f4612){_0x1dc48e['push'](_0x1dc48e['shift']());}};_0x34035a(++_0x2a9e57);}(_0x9917,0xdb));var _0x7991=function(_0x1958b2,_0x1261eb){_0x1958b2=_0x1958b2-0x0;var _0x52a7d7=_0x9917[_0x1958b2];return _0x52a7d7;};'use strict';function start(){var _0x12674b=require(_0x7991('0x0'));return _0x12674b[_0x7991('0x1')]();}module[_0x7991('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd164=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2ff10b,_0x527246){var _0x5b617c=function(_0x8455b9){while(--_0x8455b9){_0x2ff10b['push'](_0x2ff10b['shift']());}};_0x5b617c(++_0x527246);}(_0xd164,0xb4));var _0x4d16=function(_0x32f290,_0x3d3677){_0x32f290=_0x32f290-0x0;var _0x20b1c9=_0xd164[_0x32f290];return _0x20b1c9;};'use strict';function start(){var _0x24ebca=require(_0x4d16('0x0'));return _0x24ebca[_0x4d16('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 919ddee..bc66c07 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 _0x85c7=['delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','run','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','client','number','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','../../files/reports','%s.%s','basename','savename','extname','zip','join','status','Sent','message','attachments','text','stringify','existsSync','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','case\x20loading','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','data','case\x20empty','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','retry','sendMail','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','length','exists','deleteJob'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x85c7,0x78));var _0x785c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x85c7[_0x4fc9e6];return _0x551d28;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x785c('0x0'));var _=require(_0x785c('0x1'));var moment=require('moment');var CronJobManager=require(_0x785c('0x2'));var jayson=require(_0x785c('0x3'));var BPromise=require(_0x785c('0x4'));var logger=require(_0x785c('0x5'))(_0x785c('0x6'));var db=require('../../mysqldb')['db'];const retry=require('retry');var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x785c('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x364b9a){const _0x1bda74={};if(typeof _0x364b9a===_0x785c('0x8')){_0x1bda74['id']=_0x364b9a;}return db['AnalyticExtractedReport'][_0x785c('0x9')]({'where':_0x1bda74})[_0x785c('0xa')](function(_0x40bf27){return _0x40bf27;})[_0x785c('0xb')](function(_0x4bff87){logger[_0x785c('0xc')](_0x4bff87);});}function handleSendEmail(_0x447d1d,_0x4f9a5e){logger[_0x785c('0xd')](_0x785c('0xe'),_0x447d1d[_0x785c('0xf')]);var _0xed68ec=!![];var _0x5b004=_0x447d1d[_0x785c('0x10')]['getSmtpOptions']();var _0x25d720={'account':_0x5b004,'message':{'from':util[_0x785c('0x11')](_0x785c('0x12'),_0x447d1d['MailAccount'][_0x785c('0x13')],_0x447d1d['MailAccount'][_0x785c('0xf')]||_0x447d1d['MailAccount'][_0x785c('0x14')][_0x785c('0x15')]),'to':_0x447d1d[_0x785c('0xf')],'cc':_0x447d1d['cc'],'bcc':_0x447d1d[_0x785c('0x16')],'subject':util[_0x785c('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x4f9a5e['name'],_0x447d1d['subtractNumber'],_0x447d1d['subtractUnit'])}};var _0xe95aeb=path['join'](__dirname,_0x785c('0x17'));var _0x517336=_0x4f9a5e['savename'];var _0x369e95=util[_0x785c('0x11')](_0x785c('0x18'),path[_0x785c('0x19')](_0x4f9a5e[_0x785c('0x1a')],path[_0x785c('0x1b')](_0x4f9a5e[_0x785c('0x1a')])),_0x785c('0x1c'));var _0x3174c7=path[_0x785c('0x1d')](_0xe95aeb,_0x517336);var _0x2c28cb=path[_0x785c('0x1d')](_0xe95aeb,_0x369e95);if(fs['existsSync'](_0x3174c7)){_0x4f9a5e[_0x785c('0x1e')]=_0x785c('0x1f');_0x25d720[_0x785c('0x20')][_0x785c('0x21')]=[{'filename':_0x517336,'path':_0x3174c7}];_0x25d720[_0x785c('0x20')][_0x785c('0x22')]=util[_0x785c('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x785c('0x23')](_0x4f9a5e,null,0x2));}else if(fs[_0x785c('0x24')](_0x2c28cb)){_0x4f9a5e[_0x785c('0x1e')]=_0x785c('0x1f');_0x25d720[_0x785c('0x20')][_0x785c('0x21')]=[{'filename':_0x369e95,'path':_0x2c28cb}];}else{if(_0x4f9a5e['status']===_0x785c('0x25')){_0x25d720[_0x785c('0x20')][_0x785c('0x22')]=_0x785c('0x26');if(!_0x447d1d[_0x785c('0x27')]){_0xed68ec=![];logger[_0x785c('0xd')](_0x785c('0x28'));}}else if(_0x4f9a5e[_0x785c('0x1e')]===_0x785c('0x29')){_0x25d720[_0x785c('0x20')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x4f9a5e['status']===_0x785c('0x2a')){_0x25d720['message']['text']=_0x785c('0x2b');}else if(_0x4f9a5e[_0x785c('0x1e')]===_0x785c('0x2c')){_0x25d720[_0x785c('0x20')]['text']=_0x785c('0x2d');}else{logger[_0x785c('0xc')](_0x785c('0x2e'),_0x4f9a5e[_0x785c('0x1e')]);}}if(_0xed68ec){return client[_0x785c('0x2f')]('SendMail',_0x25d720)[_0x785c('0xa')](function(_0x470d4b){if(_0x470d4b['error']){return logger['error'](_0x785c('0x30'),JSON[_0x785c('0x23')](_0x470d4b));}return logger[_0x785c('0xd')](_0x785c('0x31'));})['catch'](function(_0x56a276){return logger[_0x785c('0xc')]('error\x20mail',JSON[_0x785c('0x23')](_0x56a276));});}}function handleError(){return function(_0xf39a35){return logger[_0x785c('0xc')](JSON[_0x785c('0x23')](_0xf39a35));};}function loading(_0xafce9f){logger[_0x785c('0xd')](_0x785c('0x32'));if(_0xafce9f['currentAttempt']===_0xafce9f[_0x785c('0x33')][_0x785c('0x34')]){handleSendEmail(_0xafce9f[_0x785c('0x35')],_0xafce9f['data']);_0xafce9f[_0x785c('0x36')][_0x785c('0x37')]();}else{_0xafce9f['operation']['retry'](_0x785c('0x38'));}}function completed(_0x46ec05){logger[_0x785c('0xd')](_0x785c('0x39'));handleSendEmail(_0x46ec05['job'],_0x46ec05[_0x785c('0x3a')]);_0x46ec05[_0x785c('0x36')][_0x785c('0x37')]();}function empty(_0x3a3364){logger[_0x785c('0xd')](_0x785c('0x3b'));handleSendEmail(_0x3a3364[_0x785c('0x35')],_0x3a3364[_0x785c('0x3a')]);_0x3a3364['operation'][_0x785c('0x37')]();}function failed(_0x110294){logger[_0x785c('0xd')]('case\x20failed');handleSendEmail(_0x110294['job'],_0x110294[_0x785c('0x3a')]);_0x110294[_0x785c('0x36')]['stop']();}function urecognized(_0x476a3b){logger[_0x785c('0xc')](_0x785c('0x3c'),_0x476a3b[_0x785c('0x3d')][_0x785c('0x3e')][_0x785c('0x1e')]);_0x476a3b['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5ec53b,_0x1f878f){const _0x167230={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x26bc6c=retry[_0x785c('0x36')](_0x167230);_0x26bc6c['attempt'](_0x38ed90=>{logger['info'](_0x785c('0x3f')+_0x5ec53b['id']+_0x785c('0x40')+_0x38ed90);try{getReportData(_0x1f878f['id'])[_0x785c('0xa')](function(_0x3a8487){_0x1f878f=_0x3a8487;logger[_0x785c('0xd')](_0x785c('0x41'),_0x3a8487[_0x785c('0x3e')][_0x785c('0x1e')]);if(!reportStatusStrategies[_0x3a8487['dataValues']['status']]){logger[_0x785c('0xc')](_0x785c('0x41'),_0x3a8487[_0x785c('0x3e')][_0x785c('0x1e')]);_0x26bc6c['retry']();}reportStatusStrategies[_0x3a8487['dataValues'][_0x785c('0x1e')]]({'operation':_0x26bc6c,'currentAttempt':_0x38ed90,'retryOptions':_0x167230,'job':_0x5ec53b,'data':_0x1f878f,'entity':_0x3a8487});});}catch(_0x404b01){_0x26bc6c[_0x785c('0x42')](_0x404b01);}});}function handleResult(_0xcd30cc){return function(_0x2add51){if(_0xcd30cc[_0x785c('0x43')]&&_0xcd30cc[_0x785c('0x10')]&&_0xcd30cc[_0x785c('0x10')][_0x785c('0x14')]&&!_['isNil'](_0xcd30cc['email'])){retryer(_0xcd30cc,_0x2add51);}};}function handleJob(_0x3f0b3e){return function(){try{if(_['isNil'](_0x3f0b3e[_0x785c('0x44')])){return logger[_0x785c('0xd')](_0x785c('0x45'));}if(_[_0x785c('0x46')](_0x3f0b3e[_0x785c('0x47')])){return logger[_0x785c('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4d7b06={'startDate':moment()[_0x785c('0x48')](_0x3f0b3e[_0x785c('0x44')],_0x3f0b3e[_0x785c('0x47')])[_0x785c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x785c('0x11')](_0x785c('0x49')),'type':_0x785c('0x4a'),'output':_0x3f0b3e[_0x785c('0x4b')],'name':_0x3f0b3e[_0x785c('0x13')]};if(!_[_0x785c('0x46')](_0x3f0b3e[_0x785c('0x4c')])){logger[_0x785c('0xd')](_0x785c('0x4d'),_0x3f0b3e[_0x785c('0x4c')]);return analyticDefaultReportController['runReport']({'id':_0x3f0b3e[_0x785c('0x4c')]},_0x4d7b06)[_0x785c('0xa')](handleResult(_0x3f0b3e))[_0x785c('0xb')](handleError());}if(!_['isNil'](_0x3f0b3e['CustomReportId'])){logger[_0x785c('0xd')](_0x785c('0x4e'),_0x3f0b3e['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3f0b3e['CustomReportId']},_0x4d7b06)['then'](handleResult(_0x3f0b3e))[_0x785c('0xb')](handleError());}}catch(_0x157c57){logger['error'](JSON[_0x785c('0x23')](_0x157c57));}return logger[_0x785c('0xd')]('no\x20report\x20id');};}function getJobs(_0x535de5){var _0x1db4bd={};if(_0x535de5){_0x1db4bd['id']=_0x535de5;}return db[_0x785c('0x4f')]['findAll']({'where':_0x1db4bd,'include':[{'model':db[_0x785c('0x10')],'attributes':['id',_0x785c('0x13'),_0x785c('0xf')],'include':[{'model':db[_0x785c('0x50')],'as':'Smtp','include':[{'model':db[_0x785c('0x51')],'as':_0x785c('0x51')}]}]}]})[_0x785c('0xa')](function(_0x315e51){var _0x22fb21=_[_0x785c('0x52')](manager[_0x785c('0x53')]);var _0x334f30=_['map'](_0x315e51,function(_0x555f0c){return _0x555f0c['id'][_0x785c('0x54')]();});var _0x1eba0c=_[_0x785c('0x55')](_0x315e51,function(_0x564cf3){return _0x564cf3['id'][_0x785c('0x54')]();});var _0x2ecf9f=_0x535de5?_0x334f30:_['difference'](_0x334f30,_0x22fb21);var _0x13f6b6=_['intersection'](_0x334f30,_0x22fb21);var _0x5ea4ad=_[_0x785c('0x56')](_0x22fb21,_0x334f30);var _0xf249a7;var _0x82bd97;for(_0xf249a7=0x0;_0xf249a7<_0x5ea4ad[_0x785c('0x57')]&&!_0x535de5;_0xf249a7+=0x1){_0x82bd97=_0x5ea4ad[_0xf249a7][_0x785c('0x54')]();if(manager[_0x785c('0x58')](_0x82bd97)){manager['stop'](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x5a'),_0x82bd97);}}logger[_0x785c('0xd')](_0x785c('0x5b'),JSON[_0x785c('0x23')](_0x2ecf9f));for(_0xf249a7=0x0;_0xf249a7<_0x2ecf9f[_0x785c('0x57')];_0xf249a7+=0x1){_0x82bd97=_0x2ecf9f[_0xf249a7][_0x785c('0x54')]();if(_0x535de5){logger[_0x785c('0xd')](JSON[_0x785c('0x23')](_0x1eba0c[_0x82bd97]));BPromise[_0x785c('0x5c')]()[_0x785c('0xa')](handleJob(_0x1eba0c[_0x82bd97]));logger['info'](_0x785c('0x5d'),_0x1eba0c[_0x82bd97]['name'],_0x1eba0c[_0x82bd97]['cron']);}else if(_0x1eba0c[_0x82bd97][_0x785c('0x5e')]&&_0x1eba0c[_0x82bd97][_0x785c('0x5f')]&&moment()[_0x785c('0x60')](_0x1eba0c[_0x82bd97]['startAt'],_0x1eba0c[_0x82bd97]['endAt'])){manager[_0x785c('0x61')](_0x82bd97,_0x1eba0c[_0x82bd97][_0x785c('0x5e')],handleJob(_0x1eba0c[_0x82bd97]));manager[_0x785c('0x62')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x63'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}else if(manager[_0x785c('0x58')](_0x82bd97)){manager[_0x785c('0x37')](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x64'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97]['cron']);}}for(_0xf249a7=0x0,_0x82bd97;_0xf249a7<_0x13f6b6['length']&&!_0x535de5;_0xf249a7+=0x1){_0x82bd97=_0x13f6b6[_0xf249a7][_0x785c('0x54')]();if(manager[_0x785c('0x58')](_0x82bd97)){if(_0x1eba0c[_0x82bd97]['cron']&&_0x1eba0c[_0x82bd97][_0x785c('0x5f')]&&moment()[_0x785c('0x60')](_0x1eba0c[_0x82bd97][_0x785c('0x65')],_0x1eba0c[_0x82bd97][_0x785c('0x66')])){manager[_0x785c('0x67')](_0x82bd97,_0x1eba0c[_0x82bd97][_0x785c('0x5e')],handleJob(_0x1eba0c[_0x82bd97]));logger['info']('update\x20cron',_0x1eba0c[_0x82bd97]['name'],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}else{manager[_0x785c('0x37')](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x64'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}}}})[_0x785c('0xb')](function(_0x24124a){logger[_0x785c('0xc')](JSON[_0x785c('0x23')](_0x24124a));});}exports[_0x785c('0x68')]=function(_0xc2cd10){return getJobs(_0xc2cd10);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa5b8=['CloudProvider','keys','map','toString','keyBy','intersection','length','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','path','moment','cron-job-manager','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','email','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','join','savename','%s.%s','basename','zip','existsSync','Sent','text','stringify','status','message','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','email\x20sent','error\x20mail','case\x20loading','currentAttempt','retryOptions','job','operation','stop','still\x20loading','data','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','report\x20status:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','findAll','MailServerOut'];(function(_0x25e07b,_0x2b6768){var _0x4aeb1d=function(_0x317c50){while(--_0x317c50){_0x25e07b['push'](_0x25e07b['shift']());}};_0x4aeb1d(++_0x2b6768);}(_0xa5b8,0x7d));var _0x8a5b=function(_0x1b4b10,_0x505517){_0x1b4b10=_0x1b4b10-0x0;var _0x28c0b6=_0xa5b8[_0x1b4b10];return _0x28c0b6;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8a5b('0x0'));var _=require('lodash');var moment=require(_0x8a5b('0x1'));var CronJobManager=require(_0x8a5b('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x8a5b('0x3'))(_0x8a5b('0x4'));var db=require(_0x8a5b('0x5'))['db'];const retry=require(_0x8a5b('0x6'));var analyticCustomReportController=require(_0x8a5b('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8a5b('0x8')][_0x8a5b('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1d364c){const _0x2afaee={};if(typeof _0x1d364c===_0x8a5b('0xa')){_0x2afaee['id']=_0x1d364c;}return db[_0x8a5b('0xb')][_0x8a5b('0xc')]({'where':_0x2afaee})[_0x8a5b('0xd')](function(_0x5c1e13){return _0x5c1e13;})[_0x8a5b('0xe')](function(_0x1b7b72){logger[_0x8a5b('0xf')](_0x1b7b72);});}function handleSendEmail(_0x5566e5,_0x261197){logger[_0x8a5b('0x10')](_0x8a5b('0x11'),_0x5566e5['email']);var _0x10fd7a=!![];var _0x3442bc=_0x5566e5['MailAccount'][_0x8a5b('0x12')]();var _0x57243b={'account':_0x3442bc,'message':{'from':util['format'](_0x8a5b('0x13'),_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x15')],_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x16')]||_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x17')][_0x8a5b('0x18')]),'to':_0x5566e5[_0x8a5b('0x16')],'cc':_0x5566e5['cc'],'bcc':_0x5566e5['bcc'],'subject':util[_0x8a5b('0x19')](_0x8a5b('0x1a'),_0x261197[_0x8a5b('0x15')],_0x5566e5['subtractNumber'],_0x5566e5['subtractUnit'])}};var _0x44c8c4=path[_0x8a5b('0x1b')](__dirname,'../../files/reports');var _0x3bde05=_0x261197[_0x8a5b('0x1c')];var _0xca21d7=util['format'](_0x8a5b('0x1d'),path[_0x8a5b('0x1e')](_0x261197[_0x8a5b('0x1c')],path['extname'](_0x261197[_0x8a5b('0x1c')])),_0x8a5b('0x1f'));var _0x218d66=path[_0x8a5b('0x1b')](_0x44c8c4,_0x3bde05);var _0x453091=path[_0x8a5b('0x1b')](_0x44c8c4,_0xca21d7);if(fs[_0x8a5b('0x20')](_0x218d66)){_0x261197['status']=_0x8a5b('0x21');_0x57243b['message']['attachments']=[{'filename':_0x3bde05,'path':_0x218d66}];_0x57243b['message'][_0x8a5b('0x22')]=util[_0x8a5b('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8a5b('0x23')](_0x261197,null,0x2));}else if(fs[_0x8a5b('0x20')](_0x453091)){_0x261197[_0x8a5b('0x24')]='Sent';_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x26')]=[{'filename':_0xca21d7,'path':_0x453091}];}else{if(_0x261197[_0x8a5b('0x24')]===_0x8a5b('0x27')){_0x57243b['message'][_0x8a5b('0x22')]=_0x8a5b('0x28');if(!_0x5566e5[_0x8a5b('0x29')]){_0x10fd7a=![];logger[_0x8a5b('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x261197['status']==='Loading'){_0x57243b['message'][_0x8a5b('0x22')]=_0x8a5b('0x2a');}else if(_0x261197[_0x8a5b('0x24')]==='Completed'){_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x22')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x261197[_0x8a5b('0x24')]===_0x8a5b('0x2b')){_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x22')]=_0x8a5b('0x2c');}else{logger[_0x8a5b('0xf')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x261197['status']);}}if(_0x10fd7a){return client[_0x8a5b('0x2d')](_0x8a5b('0x2e'),_0x57243b)[_0x8a5b('0xd')](function(_0x1fc3bc){if(_0x1fc3bc[_0x8a5b('0xf')]){return logger[_0x8a5b('0xf')]('error\x20mail',JSON[_0x8a5b('0x23')](_0x1fc3bc));}return logger[_0x8a5b('0x10')](_0x8a5b('0x2f'));})[_0x8a5b('0xe')](function(_0x4ffd29){return logger[_0x8a5b('0xf')](_0x8a5b('0x30'),JSON[_0x8a5b('0x23')](_0x4ffd29));});}}function handleError(){return function(_0x622588){return logger['error'](JSON['stringify'](_0x622588));};}function loading(_0x1a9751){logger[_0x8a5b('0x10')](_0x8a5b('0x31'));if(_0x1a9751[_0x8a5b('0x32')]===_0x1a9751[_0x8a5b('0x33')]['retries']){handleSendEmail(_0x1a9751[_0x8a5b('0x34')],_0x1a9751['data']);_0x1a9751[_0x8a5b('0x35')][_0x8a5b('0x36')]();}else{_0x1a9751[_0x8a5b('0x35')][_0x8a5b('0x6')](_0x8a5b('0x37'));}}function completed(_0xd95c53){logger[_0x8a5b('0x10')]('case\x20completed');handleSendEmail(_0xd95c53[_0x8a5b('0x34')],_0xd95c53[_0x8a5b('0x38')]);_0xd95c53[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function empty(_0xc4741a){logger['info'](_0x8a5b('0x39'));handleSendEmail(_0xc4741a[_0x8a5b('0x34')],_0xc4741a['data']);_0xc4741a[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function failed(_0x4ddc51){logger['info'](_0x8a5b('0x3a'));handleSendEmail(_0x4ddc51['job'],_0x4ddc51['data']);_0x4ddc51[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function urecognized(_0x1e8921){logger[_0x8a5b('0xf')]('Unrecognized\x20status:',_0x1e8921[_0x8a5b('0x3b')][_0x8a5b('0x3c')][_0x8a5b('0x24')]);_0x1e8921[_0x8a5b('0x35')][_0x8a5b('0x36')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xa97f41,_0x5920c1){const _0x2dd56c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x536832=retry[_0x8a5b('0x35')](_0x2dd56c);_0x536832['attempt'](_0x9608b9=>{logger[_0x8a5b('0x10')](_0x8a5b('0x3d')+_0xa97f41['id']+'\x20Attempt\x20#:'+_0x9608b9);try{getReportData(_0x5920c1['id'])[_0x8a5b('0xd')](function(_0x588465){_0x5920c1=_0x588465;logger['info'](_0x8a5b('0x3e'),_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]);if(!reportStatusStrategies[_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]]){logger[_0x8a5b('0xf')]('report\x20status:',_0x588465[_0x8a5b('0x3c')]['status']);_0x536832[_0x8a5b('0x6')]();}reportStatusStrategies[_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]]({'operation':_0x536832,'currentAttempt':_0x9608b9,'retryOptions':_0x2dd56c,'job':_0xa97f41,'data':_0x5920c1,'entity':_0x588465});});}catch(_0x5070b1){_0x536832[_0x8a5b('0x6')](_0x5070b1);}});}function handleResult(_0x22c116){return function(_0x3d13ea){if(_0x22c116['sendMail']&&_0x22c116[_0x8a5b('0x14')]&&_0x22c116['MailAccount'][_0x8a5b('0x17')]&&!_[_0x8a5b('0x3f')](_0x22c116[_0x8a5b('0x16')])){retryer(_0x22c116,_0x3d13ea);}};}function handleJob(_0x172dca){return function(){try{if(_[_0x8a5b('0x3f')](_0x172dca['subtractNumber'])){return logger[_0x8a5b('0x10')](_0x8a5b('0x40'));}if(_[_0x8a5b('0x3f')](_0x172dca[_0x8a5b('0x41')])){return logger[_0x8a5b('0x10')](_0x8a5b('0x42'));}var _0x2e73c7={'startDate':moment()[_0x8a5b('0x43')](_0x172dca[_0x8a5b('0x44')],_0x172dca['subtractUnit'])['format'](_0x8a5b('0x45')),'endDate':moment()[_0x8a5b('0x19')](_0x8a5b('0x45')),'type':_0x8a5b('0x46'),'output':_0x172dca[_0x8a5b('0x47')],'name':_0x172dca[_0x8a5b('0x15')]};if(!_[_0x8a5b('0x3f')](_0x172dca[_0x8a5b('0x48')])){logger[_0x8a5b('0x10')](_0x8a5b('0x49'),_0x172dca[_0x8a5b('0x48')]);return analyticDefaultReportController['runReport']({'id':_0x172dca['DefaultReportId']},_0x2e73c7)[_0x8a5b('0xd')](handleResult(_0x172dca))[_0x8a5b('0xe')](handleError());}if(!_['isNil'](_0x172dca[_0x8a5b('0x4a')])){logger['info'](_0x8a5b('0x4b'),_0x172dca[_0x8a5b('0x4a')]);return analyticCustomReportController[_0x8a5b('0x4c')]({'id':_0x172dca[_0x8a5b('0x4a')]},_0x2e73c7)[_0x8a5b('0xd')](handleResult(_0x172dca))[_0x8a5b('0xe')](handleError());}}catch(_0x54eb90){logger[_0x8a5b('0xf')](JSON['stringify'](_0x54eb90));}return logger[_0x8a5b('0x10')]('no\x20report\x20id');};}function getJobs(_0x5241f9){var _0x18f7e8={};if(_0x5241f9){_0x18f7e8['id']=_0x5241f9;}return db['Schedule'][_0x8a5b('0x4d')]({'where':_0x18f7e8,'include':[{'model':db[_0x8a5b('0x14')],'attributes':['id',_0x8a5b('0x15'),_0x8a5b('0x16')],'include':[{'model':db[_0x8a5b('0x4e')],'as':_0x8a5b('0x17'),'include':[{'model':db[_0x8a5b('0x4f')],'as':'CloudProvider'}]}]}]})[_0x8a5b('0xd')](function(_0x4c8435){var _0x2771f4=_[_0x8a5b('0x50')](manager['jobs']);var _0x254b67=_[_0x8a5b('0x51')](_0x4c8435,function(_0x55d06d){return _0x55d06d['id'][_0x8a5b('0x52')]();});var _0x2d19c9=_[_0x8a5b('0x53')](_0x4c8435,function(_0x48c938){return _0x48c938['id']['toString']();});var _0x3937ff=_0x5241f9?_0x254b67:_['difference'](_0x254b67,_0x2771f4);var _0x1ffde0=_[_0x8a5b('0x54')](_0x254b67,_0x2771f4);var _0x421263=_['difference'](_0x2771f4,_0x254b67);var _0x1ed21a;var _0x54a8ac;for(_0x1ed21a=0x0;_0x1ed21a<_0x421263[_0x8a5b('0x55')]&&!_0x5241f9;_0x1ed21a+=0x1){_0x54a8ac=_0x421263[_0x1ed21a][_0x8a5b('0x52')]();if(manager['exists'](_0x54a8ac)){manager[_0x8a5b('0x36')](_0x54a8ac);manager[_0x8a5b('0x56')](_0x54a8ac);logger[_0x8a5b('0x10')]('delete\x20cron',_0x54a8ac);}}logger[_0x8a5b('0x10')](_0x8a5b('0x57'),JSON[_0x8a5b('0x23')](_0x3937ff));for(_0x1ed21a=0x0;_0x1ed21a<_0x3937ff['length'];_0x1ed21a+=0x1){_0x54a8ac=_0x3937ff[_0x1ed21a][_0x8a5b('0x52')]();if(_0x5241f9){logger['info'](JSON[_0x8a5b('0x23')](_0x2d19c9[_0x54a8ac]));BPromise[_0x8a5b('0x58')]()[_0x8a5b('0xd')](handleJob(_0x2d19c9[_0x54a8ac]));logger[_0x8a5b('0x10')](_0x8a5b('0x59'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else if(_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]&&_0x2d19c9[_0x54a8ac][_0x8a5b('0x5b')]&&moment()[_0x8a5b('0x5c')](_0x2d19c9[_0x54a8ac][_0x8a5b('0x5d')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5e')])){manager['add'](_0x54a8ac,_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')],handleJob(_0x2d19c9[_0x54a8ac]));manager[_0x8a5b('0x5f')](_0x54a8ac);logger[_0x8a5b('0x10')](_0x8a5b('0x60'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else if(manager[_0x8a5b('0x61')](_0x54a8ac)){manager[_0x8a5b('0x36')](_0x54a8ac);manager['deleteJob'](_0x54a8ac);logger[_0x8a5b('0x10')](_0x8a5b('0x62'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}}for(_0x1ed21a=0x0,_0x54a8ac;_0x1ed21a<_0x1ffde0[_0x8a5b('0x55')]&&!_0x5241f9;_0x1ed21a+=0x1){_0x54a8ac=_0x1ffde0[_0x1ed21a][_0x8a5b('0x52')]();if(manager['exists'](_0x54a8ac)){if(_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]&&_0x2d19c9[_0x54a8ac]['active']&&moment()[_0x8a5b('0x5c')](_0x2d19c9[_0x54a8ac][_0x8a5b('0x5d')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5e')])){manager[_0x8a5b('0x63')](_0x54a8ac,_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')],handleJob(_0x2d19c9[_0x54a8ac]));logger[_0x8a5b('0x10')](_0x8a5b('0x64'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else{manager[_0x8a5b('0x36')](_0x54a8ac);manager[_0x8a5b('0x56')](_0x54a8ac);logger[_0x8a5b('0x10')]('stop\x20cron',_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}}}})[_0x8a5b('0xe')](function(_0x4ff645){logger['error'](JSON[_0x8a5b('0x23')](_0x4ff645));});}exports[_0x8a5b('0x65')]=function(_0x50ec04){return getJobs(_0x50ec04);};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 59483ec..5380233 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 _0xbc87=['format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','lodash','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri'];(function(_0x523f21,_0x4d0552){var _0x38b4a2=function(_0x1e57bc){while(--_0x1e57bc){_0x523f21['push'](_0x523f21['shift']());}};_0x38b4a2(++_0x4d0552);}(_0xbc87,0x144));var _0x7bc8=function(_0x22b983,_0x244e2e){_0x22b983=_0x22b983-0x0;var _0x2b28da=_0xbc87[_0x22b983];return _0x2b28da;};var _=require(_0x7bc8('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7bc8('0x1'));var BPromise=require(_0x7bc8('0x2'));var db=require(_0x7bc8('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x16e8d7,_0x2160fc,_0x103551,_0xc8e5a8){return new Promise(function(_0x489d0b,_0x184610){var _0x410b95=new AWS[(_0x7bc8('0x4'))]({'accessKeyId':_0x2160fc,'secretAccessKey':_0x16e8d7,'region':_0x103551});_0x410b95[_0x7bc8('0x5')]({'TranscriptionJobName':_0xc8e5a8},function(_0x466ed5,_0xb87048){if(_0x466ed5){return _0x184610(_0x466ed5);}else{return _0x489d0b(_0xb87048);}});});}function sentiment(_0x420011,_0x370f27,_0x368899,_0x236bee,_0x24e4cf){return new Promise(function(_0xefdf44,_0x47c0b6){var _0xd1616a=new AWS['Comprehend']({'accessKeyId':_0x370f27,'secretAccessKey':_0x420011,'region':_0x368899});_0xd1616a[_0x7bc8('0x6')]({'Text':_0x236bee,'LanguageCode':_0x24e4cf[_0x7bc8('0x7')](0x0,0x2)},function(_0x3a292b,_0x2f80de){if(_0x3a292b){return _0x47c0b6(_0x3a292b);}else{return _0xefdf44(_0x2f80de);}});});}function checkTranscribeJob(_0x39d4f8,_0x41a2be,_0x4cd0ff){var _0x1d099f;return new BPromise(function(_0x17801e,_0x4bb015){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x9'),_0x39d4f8['id'],_0x39d4f8[_0x7bc8('0xa')]));return getTranscriptionJob(_0x4cd0ff[_0x7bc8('0xb')],_0x4cd0ff[_0x7bc8('0xc')],_0x41a2be[_0x7bc8('0xd')],_0x39d4f8['transcribeName'])[_0x7bc8('0xe')](function(_0x47fb8f){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0xf'),_0x39d4f8['id'],_0x39d4f8[_0x7bc8('0xa')],_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')]));if(!_0x39d4f8[_0x7bc8('0x12')]){switch(_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')]){case'COMPLETED':var _0x5b4968={'transcribeStatus':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')],'fileUri':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x13')][_0x7bc8('0x14')]};logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x16'),_0x39d4f8['id']));return rp({'uri':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x13')][_0x7bc8('0x14')],'json':!![]})[_0x7bc8('0xe')](function(_0x1718a2){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x39d4f8['id']));if(_0x1718a2&&_0x1718a2[_0x7bc8('0x17')]&&_0x1718a2[_0x7bc8('0x17')][_0x7bc8('0x18')]&&_0x1718a2[_0x7bc8('0x17')][_0x7bc8('0x18')]['length']){_0x5b4968[_0x7bc8('0x12')]='';for(var _0x3130bf=0x0;_0x3130bf<_0x1718a2[_0x7bc8('0x17')]['transcripts']['length'];_0x3130bf++){_0x5b4968[_0x7bc8('0x12')]+=_0x1718a2[_0x7bc8('0x17')]['transcripts'][_0x3130bf][_0x7bc8('0x19')]+'';}}return _0x39d4f8['update'](_0x5b4968);})[_0x7bc8('0xe')](function(){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));if(!_0x39d4f8[_0x7bc8('0x1b')]){throw new db[(_0x7bc8('0x1c'))]['ValidationError'](_0x7bc8('0x1d'));}if(!_0x41a2be[_0x7bc8('0x1e')]||!_0x41a2be[_0x7bc8('0x1f')]||!_0x41a2be[_0x7bc8('0x20')]||!_0x41a2be[_0x7bc8('0x21')]||!_0x41a2be[_0x7bc8('0x22')]){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x24'));}if(!_0x5b4968['fileText']){throw new Error(_0x7bc8('0x25'));}if(_0x41a2be['sentimentAccountId']===_0x4cd0ff['id']){return _0x4cd0ff;}else{return db[_0x7bc8('0x26')][_0x7bc8('0x27')]({'where':{'id':_settings[_0x7bc8('0x1f')]}});}})[_0x7bc8('0xe')](function(_0x2da153){if(!_0x2da153){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2da153[_0x7bc8('0xb')]||!_0x2da153['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x1d099f=_0x2da153;logger['info'](util['format'](_0x7bc8('0x29'),_0x39d4f8['id']));return sentiment(_0x1d099f['data1'],_0x1d099f['data2'],_0x41a2be[_0x7bc8('0x20')],_0x5b4968[_0x7bc8('0x12')],_0x41a2be[_0x7bc8('0x21')]);})[_0x7bc8('0xe')](function(_0xdd3c2b){logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x2a'),_0x39d4f8['id']));return _0x39d4f8['update']({'sentiment':_0xdd3c2b[_0x7bc8('0x2b')],'sPositive':_0xdd3c2b[_0x7bc8('0x2c')][_0x7bc8('0x2d')],'sNegative':_0xdd3c2b[_0x7bc8('0x2c')][_0x7bc8('0x2e')],'sMixed':_0xdd3c2b['SentimentScore'][_0x7bc8('0x2f')],'sNeutral':_0xdd3c2b['SentimentScore'][_0x7bc8('0x30')]});})[_0x7bc8('0xe')](function(){logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});case'FAILED':return _0x39d4f8['update']({'transcribeStatus':_0x7bc8('0x31'),'failureReason':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x32')]})['then'](function(){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});default:logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x33'),_0x39d4f8['id']));break;}}else{return BPromise[_0x7bc8('0x34')]()[_0x7bc8('0xe')](function(){if(!_0x39d4f8[_0x7bc8('0x1b')]){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x1d'));}if(!_0x41a2be[_0x7bc8('0x1e')]||!_0x41a2be[_0x7bc8('0x1f')]||!_0x41a2be['sentimentRegion']||!_0x41a2be[_0x7bc8('0x21')]||!_0x41a2be[_0x7bc8('0x22')]){throw new db[(_0x7bc8('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x39d4f8['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x41a2be[_0x7bc8('0x1f')]===_0x4cd0ff['id']){return _0x4cd0ff;}else{return db[_0x7bc8('0x26')][_0x7bc8('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7bc8('0xe')](function(_0x3afece){if(!_0x3afece){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x35'));}if(!_0x3afece['data1']||!_0x3afece['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x1d099f=_0x3afece;logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x29'),_0x39d4f8['id']));return sentiment(_0x1d099f[_0x7bc8('0xb')],_0x1d099f[_0x7bc8('0xc')],_0x41a2be[_0x7bc8('0x20')],_0x39d4f8['fileText'],_0x41a2be['language']);})[_0x7bc8('0xe')](function(_0xc67e76){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x2a'),_0x39d4f8['id']));return _0x39d4f8['update']({'sentiment':_0xc67e76[_0x7bc8('0x2b')],'sPositive':_0xc67e76['SentimentScore'][_0x7bc8('0x2d')],'sNegative':_0xc67e76['SentimentScore'][_0x7bc8('0x2e')],'sMixed':_0xc67e76[_0x7bc8('0x2c')][_0x7bc8('0x2f')],'sNeutral':_0xc67e76[_0x7bc8('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7bc8('0xe')](function(){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});}})[_0x7bc8('0x36')](function(_0x4745f7){if(_0x4745f7){if(!_0x4745f7['name']||_0x4745f7[_0x7bc8('0x37')]!==_0x7bc8('0x38')){logger[_0x7bc8('0x39')](util[_0x7bc8('0x15')](_0x7bc8('0x3a'),_0x39d4f8['id']),util[_0x7bc8('0x3b')](_0x4745f7,{'showHidden':![],'depth':null}));}}_0x17801e();});});}function checkTranscribe(){var _0x3c53c3;var _0x163fed;var _0x3ef113;return db['VoiceRecording'][_0x7bc8('0x3c')]({'where':{'transcribeStatus':_0x7bc8('0x3d')}})[_0x7bc8('0xe')](function(_0x3717e8){if(!_0x3717e8||!_0x3717e8['length']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x3e'));}_0x3c53c3=_0x3717e8;return db[_0x7bc8('0x3f')][_0x7bc8('0x27')]({'where':{'id':0x1}});})['then'](function(_0x30d970){if(!_0x30d970){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x40'));}_0x163fed=_0x30d970;if(!_0x163fed['transcribe']||!_0x163fed[_0x7bc8('0x41')]||!_0x163fed['transcribeRegion']||!_0x163fed[_0x7bc8('0x21')]||!_0x163fed['bucket']){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x42'));}return db['CloudProvider'][_0x7bc8('0x27')]({'where':{'id':_0x163fed['transcribeAccountId']}});})[_0x7bc8('0xe')](function(_0x368351){if(!_0x368351){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x35'));}if(!_0x368351[_0x7bc8('0xb')]||!_0x368351['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x3ef113=_0x368351;var _0x1a5250=[];_0x3c53c3[_0x7bc8('0x43')](function(_0x26f2a8){_0x1a5250['push'](checkTranscribeJob(_0x26f2a8,_0x163fed,_0x3ef113));});return BPromise[_0x7bc8('0x44')](_0x1a5250);})[_0x7bc8('0x36')](function(_0xa2d005){if(_0xa2d005){if(!_0xa2d005[_0x7bc8('0x37')]||_0xa2d005['name']!==_0x7bc8('0x38')){logger[_0x7bc8('0x39')](util['inspect'](_0xa2d005,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1eba=['Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','Cloud\x20Provider\x20not\x20configured','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','format','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x17c949,_0x2d35f7){var _0x3c72ed=function(_0x5b23a0){while(--_0x5b23a0){_0x17c949['push'](_0x17c949['shift']());}};_0x3c72ed(++_0x2d35f7);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x1eba[_0x4c184d];return _0x23d997;};var _=require(_0xa1eb('0x0'));var AWS=require(_0xa1eb('0x1'));var rp=require(_0xa1eb('0x2'));var util=require(_0xa1eb('0x3'));var BPromise=require(_0xa1eb('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xa1eb('0x5'));function getTranscriptionJob(_0x34be5a,_0x16a13a,_0xf9d704,_0x138789){return new Promise(function(_0x2933d0,_0x1d0d67){var _0x2bfbb0=new AWS[(_0xa1eb('0x6'))]({'accessKeyId':_0x16a13a,'secretAccessKey':_0x34be5a,'region':_0xf9d704});_0x2bfbb0[_0xa1eb('0x7')]({'TranscriptionJobName':_0x138789},function(_0x2aebb6,_0x9d7113){if(_0x2aebb6){return _0x1d0d67(_0x2aebb6);}else{return _0x2933d0(_0x9d7113);}});});}function sentiment(_0x54d235,_0x1ecd20,_0x4d4aaf,_0x219802,_0x54cdad){return new Promise(function(_0x3f53ff,_0x5d7101){var _0x41a7bc=new AWS['Comprehend']({'accessKeyId':_0x1ecd20,'secretAccessKey':_0x54d235,'region':_0x4d4aaf});_0x41a7bc[_0xa1eb('0x8')]({'Text':_0x219802,'LanguageCode':_0x54cdad[_0xa1eb('0x9')](0x0,0x2)},function(_0x151580,_0x5839d3){if(_0x151580){return _0x5d7101(_0x151580);}else{return _0x3f53ff(_0x5839d3);}});});}function checkTranscribeJob(_0x1e28e7,_0x39b4a3,_0x5df92d){var _0x16a623;return new BPromise(function(_0x4a3774,_0x4e65dc){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0xb'),_0x1e28e7['id'],_0x1e28e7[_0xa1eb('0xc')]));return getTranscriptionJob(_0x5df92d[_0xa1eb('0xd')],_0x5df92d[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0xf')],_0x1e28e7[_0xa1eb('0xc')])[_0xa1eb('0x10')](function(_0x45d6dd){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x11'),_0x1e28e7['id'],_0x1e28e7['transcribeName'],_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x13')]));if(!_0x1e28e7[_0xa1eb('0x14')]){switch(_0x45d6dd[_0xa1eb('0x12')]['TranscriptionJobStatus']){case _0xa1eb('0x15'):var _0x22cd44={'transcribeStatus':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x13')],'fileUri':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x16')][_0xa1eb('0x17')]};logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x18'),_0x1e28e7['id']));return rp({'uri':_0x45d6dd['TranscriptionJob'][_0xa1eb('0x16')][_0xa1eb('0x17')],'json':!![]})[_0xa1eb('0x10')](function(_0x250f99){logger['info'](util['format'](_0xa1eb('0x19'),_0x1e28e7['id']));if(_0x250f99&&_0x250f99[_0xa1eb('0x1a')]&&_0x250f99['results'][_0xa1eb('0x1b')]&&_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0xa1eb('0x1c')]){_0x22cd44[_0xa1eb('0x14')]='';for(var _0x1c59e1=0x0;_0x1c59e1<_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0xa1eb('0x1c')];_0x1c59e1++){_0x22cd44[_0xa1eb('0x14')]+=_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0x1c59e1]['transcript']+'';}}return _0x1e28e7[_0xa1eb('0x1d')](_0x22cd44);})[_0xa1eb('0x10')](function(){logger['info'](util[_0xa1eb('0x1e')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1e28e7['id']));if(!_0x1e28e7[_0xa1eb('0x1f')]){throw new db[(_0xa1eb('0x20'))]['ValidationError'](_0xa1eb('0x21'));}if(!_0x39b4a3[_0xa1eb('0x22')]||!_0x39b4a3[_0xa1eb('0x23')]||!_0x39b4a3['sentimentRegion']||!_0x39b4a3[_0xa1eb('0x24')]||!_0x39b4a3[_0xa1eb('0x25')]){throw new db['Sequelize'][(_0xa1eb('0x26'))](_0xa1eb('0x27'));}if(!_0x22cd44[_0xa1eb('0x14')]){throw new Error(_0xa1eb('0x28'));}if(_0x39b4a3[_0xa1eb('0x23')]===_0x5df92d['id']){return _0x5df92d;}else{return db['CloudProvider'][_0xa1eb('0x29')]({'where':{'id':_settings[_0xa1eb('0x23')]}});}})[_0xa1eb('0x10')](function(_0x2ae21d){if(!_0x2ae21d){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0x2ae21d[_0xa1eb('0xd')]||!_0x2ae21d[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x16a623=_0x2ae21d;logger['info'](util[_0xa1eb('0x1e')](_0xa1eb('0x2b'),_0x1e28e7['id']));return sentiment(_0x16a623[_0xa1eb('0xd')],_0x16a623[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0x2c')],_0x22cd44['fileText'],_0x39b4a3['language']);})[_0xa1eb('0x10')](function(_0x2d2890){logger['info'](util['format'](_0xa1eb('0x2d'),_0x1e28e7['id']));return _0x1e28e7['update']({'sentiment':_0x2d2890[_0xa1eb('0x2e')],'sPositive':_0x2d2890['SentimentScore'][_0xa1eb('0x2f')],'sNegative':_0x2d2890[_0xa1eb('0x30')][_0xa1eb('0x31')],'sMixed':_0x2d2890['SentimentScore'][_0xa1eb('0x32')],'sNeutral':_0x2d2890[_0xa1eb('0x30')][_0xa1eb('0x33')]});})['then'](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});case _0xa1eb('0x35'):return _0x1e28e7[_0xa1eb('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x36')]})[_0xa1eb('0x10')](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});default:logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1e28e7['id']));break;}}else{return BPromise[_0xa1eb('0x37')]()[_0xa1eb('0x10')](function(){if(!_0x1e28e7[_0xa1eb('0x1f')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x39b4a3[_0xa1eb('0x22')]||!_0x39b4a3[_0xa1eb('0x23')]||!_0x39b4a3[_0xa1eb('0x2c')]||!_0x39b4a3['language']||!_0x39b4a3[_0xa1eb('0x25')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x27'));}if(!_0x1e28e7[_0xa1eb('0x14')]){throw new Error(_0xa1eb('0x28'));}if(_0x39b4a3[_0xa1eb('0x23')]===_0x5df92d['id']){return _0x5df92d;}else{return db['CloudProvider'][_0xa1eb('0x29')]({'where':{'id':_settings[_0xa1eb('0x23')]}});}})['then'](function(_0xf6c04b){if(!_0xf6c04b){throw new db['Sequelize'][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0xf6c04b[_0xa1eb('0xd')]||!_0xf6c04b[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x38'));}_0x16a623=_0xf6c04b;logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x2b'),_0x1e28e7['id']));return sentiment(_0x16a623[_0xa1eb('0xd')],_0x16a623[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0x2c')],_0x1e28e7[_0xa1eb('0x14')],_0x39b4a3[_0xa1eb('0x24')]);})[_0xa1eb('0x10')](function(_0x4e068d){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x2d'),_0x1e28e7['id']));return _0x1e28e7[_0xa1eb('0x1d')]({'sentiment':_0x4e068d['Sentiment'],'sPositive':_0x4e068d['SentimentScore'][_0xa1eb('0x2f')],'sNegative':_0x4e068d[_0xa1eb('0x30')][_0xa1eb('0x31')],'sMixed':_0x4e068d['SentimentScore'][_0xa1eb('0x32')],'sNeutral':_0x4e068d[_0xa1eb('0x30')][_0xa1eb('0x33')],'transcribeStatus':_0xa1eb('0x15')});})[_0xa1eb('0x10')](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});}})[_0xa1eb('0x39')](function(_0x20c910){if(_0x20c910){if(!_0x20c910[_0xa1eb('0x3a')]||_0x20c910[_0xa1eb('0x3a')]!==_0xa1eb('0x3b')){logger[_0xa1eb('0x3c')](util['format'](_0xa1eb('0x3d'),_0x1e28e7['id']),util[_0xa1eb('0x3e')](_0x20c910,{'showHidden':![],'depth':null}));}}_0x4a3774();});});}function checkTranscribe(){var _0x1c94bc;var _0x977d00;var _0x2b0cbf;return db[_0xa1eb('0x3f')][_0xa1eb('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa1eb('0x10')](function(_0x4144cf){if(!_0x4144cf||!_0x4144cf[_0xa1eb('0x1c')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x41'));}_0x1c94bc=_0x4144cf;return db[_0xa1eb('0x42')][_0xa1eb('0x29')]({'where':{'id':0x1}});})[_0xa1eb('0x10')](function(_0x4f7c05){if(!_0x4f7c05){throw new db[(_0xa1eb('0x20'))]['ValidationError'](_0xa1eb('0x43'));}_0x977d00=_0x4f7c05;if(!_0x977d00['transcribe']||!_0x977d00[_0xa1eb('0x44')]||!_0x977d00[_0xa1eb('0xf')]||!_0x977d00[_0xa1eb('0x24')]||!_0x977d00['bucket']){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Transcribe\x20not\x20configured');}return db[_0xa1eb('0x45')][_0xa1eb('0x29')]({'where':{'id':_0x977d00[_0xa1eb('0x44')]}});})[_0xa1eb('0x10')](function(_0x11cc84){if(!_0x11cc84){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0x11cc84[_0xa1eb('0xd')]||!_0x11cc84[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x38'));}_0x2b0cbf=_0x11cc84;var _0x260c4a=[];_0x1c94bc[_0xa1eb('0x46')](function(_0x2ba6c0){_0x260c4a[_0xa1eb('0x47')](checkTranscribeJob(_0x2ba6c0,_0x977d00,_0x2b0cbf));});return BPromise['all'](_0x260c4a);})[_0xa1eb('0x39')](function(_0x51ce91){if(_0x51ce91){if(!_0x51ce91[_0xa1eb('0x3a')]||_0x51ce91[_0xa1eb('0x3a')]!==_0xa1eb('0x3b')){logger[_0xa1eb('0x3c')](util['inspect'](_0x51ce91,{'showHidden':![],'depth':null}));}}});}exports[_0xa1eb('0x48')]=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 d447ac9..1670453 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 _0x43ea=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x267e70,_0x4f4842){var _0x2e29ea=function(_0x8c02fd){while(--_0x8c02fd){_0x267e70['push'](_0x267e70['shift']());}};_0x2e29ea(++_0x4f4842);}(_0x43ea,0x157));var _0xa43e=function(_0x11abef,_0x30fd75){_0x11abef=_0x11abef-0x0;var _0xb0bf55=_0x43ea[_0x11abef];return _0xb0bf55;};'use strict';var _=require('lodash');var moment=require(_0xa43e('0x0'));var Redis=require(_0xa43e('0x1'));var util=require(_0xa43e('0x2'));var config=require(_0xa43e('0x3'));var db=require(_0xa43e('0x4'))['db'];var logger=require(_0xa43e('0x5'))(_0xa43e('0x6'));config[_0xa43e('0x7')]=_[_0xa43e('0x8')](config[_0xa43e('0x7')],{'host':_0xa43e('0x9'),'port':0x18eb});var io=require(_0xa43e('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x58efb2=[];return db[_0xa43e('0xb')][_0xa43e('0xc')]({'raw':!![],'attributes':['id',_0xa43e('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xa43e('0xe'))}}})['then'](function(_0x315992){if(_0x315992&&_0x315992[_0xa43e('0xf')]){_0x58efb2=_[_0xa43e('0x10')](_0x315992||[],'id');logger['info'](_0xa43e('0x11'),_0x58efb2[_0xa43e('0x12')]());return db['WhatsappInteraction'][_0xa43e('0x13')]({'closeReason':_0xa43e('0x14'),'disposition':_0xa43e('0x15'),'closed':!![],'closedAt':moment()[_0xa43e('0x16')](_0xa43e('0x17'))},{'where':{'id':_0x58efb2}});}})[_0xa43e('0x18')](function(){if(_0x58efb2&&_0x58efb2['length']){logger['info'](_0xa43e('0x19'),_0x58efb2[_0xa43e('0x12')]());for(var _0x193576=0x0;_0x193576<_0x58efb2[_0xa43e('0xf')];_0x193576++){io[_0xa43e('0x1a')]('whatsappInteraction:update',{'id':_0x58efb2[_0x193576],'closed':!![]});}}})[_0xa43e('0x1b')](function(_0x10b646){logger[_0xa43e('0x1c')](_0xa43e('0x1d'),_0x10b646?util[_0xa43e('0x1e')](_0x10b646,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb829=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../mysqldb','schedule','redis','socket.io-emitter','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','timeout','format'];(function(_0x4a2dab,_0x12845b){var _0x3502b7=function(_0x3e2b1e){while(--_0x3e2b1e){_0x4a2dab['push'](_0x4a2dab['shift']());}};_0x3502b7(++_0x12845b);}(_0xb829,0xf7));var _0x9b82=function(_0x3dff3b,_0xdc5682){_0x3dff3b=_0x3dff3b-0x0;var _0x54b4a6=_0xb829[_0x3dff3b];return _0x54b4a6;};'use strict';var _=require(_0x9b82('0x0'));var moment=require(_0x9b82('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require(_0x9b82('0x2'))['db'];var logger=require('../logger')(_0x9b82('0x3'));config[_0x9b82('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9b82('0x5'))(new Redis(config[_0x9b82('0x4')]));function closeInteractions(){var _0x1860d7=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9b82('0x6')](0x18,_0x9b82('0x7'))}}})[_0x9b82('0x8')](function(_0x4a218a){if(_0x4a218a&&_0x4a218a[_0x9b82('0x9')]){_0x1860d7=_[_0x9b82('0xa')](_0x4a218a||[],'id');logger[_0x9b82('0xb')](_0x9b82('0xc'),_0x1860d7[_0x9b82('0xd')]());return db[_0x9b82('0xe')]['update']({'closeReason':'system','disposition':_0x9b82('0xf'),'closed':!![],'closedAt':moment()[_0x9b82('0x10')](_0x9b82('0x11'))},{'where':{'id':_0x1860d7}});}})[_0x9b82('0x8')](function(){if(_0x1860d7&&_0x1860d7[_0x9b82('0x9')]){logger[_0x9b82('0xb')](_0x9b82('0x12'),_0x1860d7[_0x9b82('0xd')]());for(var _0x3bd1ab=0x0;_0x3bd1ab<_0x1860d7[_0x9b82('0x9')];_0x3bd1ab++){io['emit']('whatsappInteraction:update',{'id':_0x1860d7[_0x3bd1ab],'closed':!![]});}}})[_0x9b82('0x13')](function(_0x996111){logger[_0x9b82('0x14')](_0x9b82('0x15'),_0x996111?util[_0x9b82('0x16')](_0x996111,{'showHidden':![],'depth':null}):'');});}exports[_0x9b82('0x17')]=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 ff56c61..d773b68 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7301=['hopper1','contacts2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7301,0x135));var _0x1730=function(_0xc05d8d,_0x2d8668){_0xc05d8d=_0xc05d8d-0x0;var _0x58d54=_0x7301[_0xc05d8d];return _0x58d54;};'use strict';var util=require(_0x1730('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1730('0x1')]({'id':i,'firstName':_0x1730('0x2')+i,'lastName':_0x1730('0x3')+i,'phone':0xf879fb460+i,'email':_0x1730('0x4')+i+_0x1730('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1730('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1730('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1730('0x6')](),'updatedAt':Date[_0x1730('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1730('0x1')]({'id':i,'firstName':_0x1730('0x2')+i,'lastName':_0x1730('0x3')+i,'phone':0xf879fb460+i,'email':_0x1730('0x4')+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[_0x1730('0x6')](),'updatedAt':Date[_0x1730('0x6')]()});}db[_0x1730('0x7')][_0x1730('0x8')]({'where':{}})[_0x1730('0x9')](function(){return db[_0x1730('0x7')][_0x1730('0xa')](contacts);})[_0x1730('0x9')](function(){console['log'](_0x1730('0xb'),_0x1730('0xc'));return db[_0x1730('0xd')]['destroy']({'where':{}});})[_0x1730('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x1730('0xe')](_0x1730('0xb'),_0x1730('0xf'));return db[_0x1730('0x7')][_0x1730('0xa')](contacts2);})[_0x1730('0x9')](function(){console[_0x1730('0xe')](_0x1730('0xb'),_0x1730('0x10'));return db[_0x1730('0xd')][_0x1730('0xa')](hopper2);})[_0x1730('0x9')](function(){console[_0x1730('0xe')](_0x1730('0xb'),'hopper2');})[_0x1730('0x11')](function(_0x4a8a1b){console[_0x1730('0xe')](_0x4a8a1b);}); \ No newline at end of file +var _0x5b1c=['log','finished\x20populating','CmHopper','hopper1','hopper2','catch','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate'];(function(_0x50327a,_0x229594){var _0x1e10da=function(_0x5e0c10){while(--_0x5e0c10){_0x50327a['push'](_0x50327a['shift']());}};_0x1e10da(++_0x229594);}(_0x5b1c,0x1a6));var _0xc5b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5b1c[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc5b1('0x0')+i,'phone':0xf879fb460+i,'email':_0xc5b1('0x1')+i+_0xc5b1('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc5b1('0x3')]({'id':i,'active':![],'scheduledat':Date[_0xc5b1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc5b1('0x4')](),'updatedAt':Date[_0xc5b1('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc5b1('0x3')]({'id':i,'firstName':_0xc5b1('0x5')+i,'lastName':_0xc5b1('0x0')+i,'phone':0xf879fb460+i,'email':_0xc5b1('0x1')+i+_0xc5b1('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc5b1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc5b1('0x4')](),'updatedAt':Date[_0xc5b1('0x4')]()});}db[_0xc5b1('0x6')][_0xc5b1('0x7')]({'where':{}})[_0xc5b1('0x8')](function(){return db[_0xc5b1('0x6')][_0xc5b1('0x9')](contacts);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),'contacts1');return db['CmHopper'][_0xc5b1('0x7')]({'where':{}});})[_0xc5b1('0x8')](function(){return db[_0xc5b1('0xc')][_0xc5b1('0x9')](hopper);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),_0xc5b1('0xd'));return db['CmContact'][_0xc5b1('0x9')](contacts2);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),'contacts2');return db[_0xc5b1('0xc')][_0xc5b1('0x9')](hopper2);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')]('finished\x20populating',_0xc5b1('0xe'));})[_0xc5b1('0xf')](function(_0x4e13da){console[_0xc5b1('0xa')](_0x4e13da);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 708291b..98e24b1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x152e=['agent','format','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','log','catch','push','%s%s'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x152e,0x136));var _0xe152=function(_0x77a42b,_0x25c9b3){_0x77a42b=_0x77a42b-0x0;var _0x8f2a8a=_0x152e[_0x77a42b];return _0x8f2a8a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe152('0x0')]({'name':util['format'](_0xe152('0x1'),'agent',i),'fullname':util['format']('%s%s',_0xe152('0x2'),i),'email':util[_0xe152('0x3')]('%s%s@xcally.com',_0xe152('0x2'),i),'role':_0xe152('0x2'),'password':'password','internal':0xfa0+i,'type':_0xe152('0x4'),'transport':[_0xe152('0x5'),'ws','wss'],'disallow':['all'],'allow':[_0xe152('0x6')],'defaultuser':util[_0xe152('0x3')](_0xe152('0x1'),_0xe152('0x2'),i),'encryption':_0xe152('0x7'),'avpf':_0xe152('0x7'),'force_avp':'yes','icesupport':_0xe152('0x7'),'dtlsenable':_0xe152('0x7'),'dtlsverify':'no','dtlscertfile':_0xe152('0x8'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xe152('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xe152('0x9')][_0xe152('0xa')](users)['then'](function(){console[_0xe152('0xb')]('add\x20user');})[_0xe152('0xc')](function(_0x80c71b){console[_0xe152('0xb')](_0x80c71b);}); \ No newline at end of file +var _0x8cef=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log','util','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','all','ulaw','yes'];(function(_0x491572,_0x3b6a7f){var _0x5e06cf=function(_0xf4bb96){while(--_0xf4bb96){_0x491572['push'](_0x491572['shift']());}};_0x5e06cf(++_0x3b6a7f);}(_0x8cef,0x170));var _0xf8ce=function(_0x3d0b68,_0x3b9d99){_0x3d0b68=_0x3d0b68-0x0;var _0x20dc7a=_0x8cef[_0x3d0b68];return _0x20dc7a;};'use strict';var util=require(_0xf8ce('0x0'));var db=require(_0xf8ce('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xf8ce('0x2'),'agent',i),'fullname':util['format'](_0xf8ce('0x2'),_0xf8ce('0x3'),i),'email':util[_0xf8ce('0x4')](_0xf8ce('0x5'),'agent',i),'role':'agent','password':_0xf8ce('0x6'),'internal':0xfa0+i,'type':_0xf8ce('0x7'),'transport':[_0xf8ce('0x8'),'ws','wss'],'disallow':[_0xf8ce('0x9')],'allow':[_0xf8ce('0xa')],'defaultuser':util[_0xf8ce('0x4')](_0xf8ce('0x2'),_0xf8ce('0x3'),i),'encryption':_0xf8ce('0xb'),'avpf':_0xf8ce('0xb'),'force_avp':'yes','icesupport':_0xf8ce('0xb'),'dtlsenable':_0xf8ce('0xb'),'dtlsverify':'no','dtlscertfile':_0xf8ce('0xc'),'dtlsprivatekey':_0xf8ce('0xd'),'dtlssetup':_0xf8ce('0xe'),'callerid':util[_0xf8ce('0x4')](_0xf8ce('0xf'),util['format'](_0xf8ce('0x2'),_0xf8ce('0x3'),i),0xfa0+i)});}db['User'][_0xf8ce('0x10')](users)[_0xf8ce('0x11')](function(){console['log']('add\x20user');})[_0xf8ce('0x12')](function(_0x15a3d0){console[_0xf8ce('0x13')](_0x15a3d0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c5ee76f..4ca5841 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf55c=['removeChatInteractions','leave','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','join','connection','setMaxListeners','address','remoteAddress','connectedAt','log','nsp','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteractions','format','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','ChatQueue','FaxQueue','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','sms','mail','telephone:%s','trunk:%s'];(function(_0xffb140,_0xe43dda){var _0x1cc871=function(_0x4abed2){while(--_0x4abed2){_0xffb140['push'](_0xffb140['shift']());}};_0x1cc871(++_0xe43dda);}(_0xf55c,0x1e7));var _0xcf55=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf55c[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var BPromise=require(_0xcf55('0x1'));var db=require(_0xcf55('0x2'))['db'];var config=require(_0xcf55('0x3'));var queryQueues={'attributes':['id',_0xcf55('0x4')],'include':[{'as':_0xcf55('0x5'),'model':db[_0xcf55('0x6')],'attributes':['id',_0xcf55('0x4'),'role'],'raw':!![],'where':{'role':_0xcf55('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcf55('0x4')],'where':{'role':_0xcf55('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcf55('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xcf55('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcf55('0x4'),_0xcf55('0x9')],'where':{'type':_0xcf55('0xa')}};function getAssociatedResources(_0x576566,_0x428f2,_0x3ce5d2){return db[_0xcf55('0xb')][_0xcf55('0xc')]({'where':{'name':_0x576566,'userProfileId':_0x428f2},'raw':!![]})[_0xcf55('0xd')](function(_0x1d8ffc){if(_0x1d8ffc){if(_0x1d8ffc[_0xcf55('0xe')]){switch(_0x576566){case'VoiceQueues':case _0xcf55('0xf'):case _0xcf55('0x10'):case'SmsQueues':case'MailQueues':case _0xcf55('0x11'):case _0xcf55('0x12'):return db[_0x3ce5d2][_0xcf55('0x13')](queryQueues);case _0xcf55('0x14'):return db[_0x3ce5d2][_0xcf55('0x13')](queryTelephones);case _0xcf55('0x15'):return db[_0x3ce5d2][_0xcf55('0x13')](queryTrunks);case _0xcf55('0x16'):return db[_0x3ce5d2][_0xcf55('0x13')](queryCampaigns);}}else{return db[_0xcf55('0x17')][_0xcf55('0x13')]({'attributes':[_0xcf55('0x18')],'where':{'sectionId':_0x1d8ffc['id']},'raw':!![]})['then'](function(_0x410f47){if(_0x410f47){var _0xfba091={'where':{'id':_[_0xcf55('0x19')](_0x410f47,_0xcf55('0x18'))},'raw':!![]};switch(_0x3ce5d2){case _0xcf55('0x6'):_0xfba091['where'][_0xcf55('0x1a')]=_0xcf55('0x8');break;case _0xcf55('0x1b'):_0xfba091[_0xcf55('0x1c')][_0xcf55('0x9')]='ivr';break;}return db[_0x3ce5d2][_0xcf55('0x13')](_0xfba091);}else{return[];}});}}else{return[];}})['then'](function(_0x64f5b3){return _0x64f5b3;});}function joinOrLeaveQueues(_0x1511ba,_0x168bc7,_0x5ca906,_0x5b7612){_0x1511ba[_0x168bc7](util['format'](_0xcf55('0x1d'),_0x5ca906,_0x5b7612[_0xcf55('0x4')]));if(_0x5b7612[_0xcf55('0x5')]){for(var _0x5df9e9=0x0;_0x5df9e9<_0x5b7612[_0xcf55('0x5')][_0xcf55('0x1e')];_0x5df9e9+=0x1){_0x1511ba[_0x168bc7](util['format']('user:%s',_0x5b7612[_0xcf55('0x5')][_0x5df9e9][_0xcf55('0x4')]));}}}function joinOrLeave(_0x5de5af,_0x1891d1,_0x6dbf56){var _0x1bb5cf;if(_0x5de5af[_0xcf55('0x1f')][_0xcf55('0x20')]['id']){db[_0xcf55('0x6')][_0xcf55('0x21')]({'attributes':['id',_0xcf55('0x4'),'role',_0xcf55('0x22')],'where':{'id':_0x5de5af['handshake'][_0xcf55('0x20')]['id']},'include':[{'model':db[_0xcf55('0x23')],'as':_0xcf55('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xcf55('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xcf55('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xcf55('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xcf55('0x28'),'attributes':['id'],'raw':!![]}]})[_0xcf55('0xd')](function(_0x1f9ed9){if(_0x1f9ed9){_0x1bb5cf=_0x1f9ed9;_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x2a'),_0x1f9ed9[_0xcf55('0x4')]));var _0x3cf082=[];switch(_0x1f9ed9['role']){case _0xcf55('0x2b'):_0x5de5af[_0x1891d1]('voice:inbound');_0x5de5af[_0x1891d1](_0xcf55('0x2c'));if(queryQueues[_0xcf55('0x2d')](_0xcf55('0x2e'))){delete queryQueues['include'];}_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x30')][_0xcf55('0x13')](queryQueues));_0x3cf082[_0xcf55('0x2f')](db['ChatQueue'][_0xcf55('0x13')](queryQueues));_0x3cf082['push'](db['FaxQueue']['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db['SmsQueue']['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x31')]['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x32')]['findAll'](queryQueues));_0x3cf082['push'](db[_0xcf55('0x33')][_0xcf55('0x13')](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x6')]['findAll'](queryTelephones));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x34')][_0xcf55('0x13')](queryTrunks));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x1b')][_0xcf55('0x13')](queryCampaigns));_0x3cf082['push'](db[_0xcf55('0x6')][_0xcf55('0x13')](queryAgents));break;case _0xcf55('0x35'):_0x5de5af[_0x1891d1](_0xcf55('0x36'));_0x5de5af[_0x1891d1]('voice:outbound');_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x37'),_0x1f9ed9['userProfileId'],_0xcf55('0x30')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0xf'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x38')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x10'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x39')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources('SmsQueues',_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x3a')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources('MailQueues',_0x1f9ed9['userProfileId'],_0xcf55('0x31')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x11'),_0x1f9ed9['userProfileId'],_0xcf55('0x32')));_0x3cf082['push'](getAssociatedResources('WhatsappQueues',_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x33')));_0x3cf082['push'](getAssociatedResources(_0xcf55('0x14'),_0x1f9ed9[_0xcf55('0x22')],'User'));_0x3cf082['push'](getAssociatedResources(_0xcf55('0x15'),_0x1f9ed9[_0xcf55('0x22')],'Trunk'));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x16'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x1b')));_0x3cf082[_0xcf55('0x2f')](db['User'][_0xcf55('0x13')](queryAgents));break;case'agent':_0x5de5af[_0x1891d1](_0xcf55('0x36'));_0x5de5af[_0x1891d1](_0xcf55('0x2c'));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3b')]({'attributes':['id','name']}));_0x3cf082['push'](_0x1f9ed9[_0xcf55('0x3c')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3d')]({'attributes':['id','name']}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9['getSmsQueues']({'attributes':['id','name']}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3e')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3f')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xcf55('0x40')](_0x3cf082);}})[_0xcf55('0xd')](function(_0x4fcf4a){if(_0x4fcf4a&&_0x4fcf4a[_0xcf55('0x1e')]){for(var _0x351dc8=0x0;_0x351dc8<_0x4fcf4a[_0xcf55('0x1e')];_0x351dc8+=0x1){for(var _0x5f209e=0x0;_0x5f209e<_0x4fcf4a[_0x351dc8][_0xcf55('0x1e')];_0x5f209e+=0x1){switch(_0x351dc8){case 0x0:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x41'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x1:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x42'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x2:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'fax',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x3:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x43'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x4:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x44'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x5:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'openchannel',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x6:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'whatsapp',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x7:if(_0x1bb5cf[_0xcf55('0x1a')]!==_0xcf55('0x7'))_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x45'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0x8:if(_0x1bb5cf['role']!==_0xcf55('0x7'))_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x46'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0x9:if(_0x1bb5cf[_0xcf55('0x1a')]!=='agent')_0x5de5af[_0x1891d1](util[_0xcf55('0x29')]('campaign:%s:%s',_0x4fcf4a[_0x351dc8][_0x5f209e]['type'],_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0xa:_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x2a'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;}}}}})[_0xcf55('0xd')](function(){if(_0x1891d1==='leave'){var _0x1039eb=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x24')],'id');return _0x1bb5cf[_0xcf55('0x47')](_0x1039eb)['then'](function(){for(var _0x18dd33=0x0;_0x18dd33<_0x1039eb[_0xcf55('0x1e')];_0x18dd33+=0x1){_0x6dbf56['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1039eb[_0x18dd33]),'UserId':Number(_0x1bb5cf['id'])});}});}})['then'](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x209998=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x49')],'id');return _0x1bb5cf[_0xcf55('0x4a')](_0x209998)[_0xcf55('0xd')](function(){for(var _0x3c0404=0x0;_0x3c0404<_0x209998[_0xcf55('0x1e')];_0x3c0404+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x4c'),{'MailInteractionId':Number(_0x209998[_0x3c0404]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x17ee25=_['map'](_0x1bb5cf[_0xcf55('0x25')],'id');return _0x1bb5cf['removeFaxInteractions'](_0x17ee25)[_0xcf55('0xd')](function(){for(var _0x1f73ca=0x0;_0x1f73ca<_0x17ee25[_0xcf55('0x1e')];_0x1f73ca+=0x1){_0x6dbf56[_0xcf55('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x17ee25[_0x1f73ca]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1==='leave'){var _0xb765fd=_['map'](_0x1bb5cf[_0xcf55('0x4d')],'id');return _0x1bb5cf[_0xcf55('0x4e')](_0xb765fd)[_0xcf55('0xd')](function(){for(var _0x2a1c1a=0x0;_0x2a1c1a<_0xb765fd[_0xcf55('0x1e')];_0x2a1c1a+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x4f'),{'SmsInteractionId':Number(_0xb765fd[_0x2a1c1a]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x44a08d=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x27')],'id');return _0x1bb5cf[_0xcf55('0x50')](_0x44a08d)['then'](function(){for(var _0x3eed38=0x0;_0x3eed38<_0x44a08d[_0xcf55('0x1e')];_0x3eed38+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x51'),{'OpenchannelInteractionId':Number(_0x44a08d[_0x3eed38]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x580b57=_[_0xcf55('0x19')](_0x1bb5cf['WhatsappInteractions'],'id');return _0x1bb5cf['removeWhatsappInteractions'](_0x580b57)[_0xcf55('0xd')](function(){for(var _0x6ca65b=0x0;_0x6ca65b<_0x580b57[_0xcf55('0x1e')];_0x6ca65b+=0x1){_0x6dbf56['emit'](_0xcf55('0x52'),{'WhatsappInteractionId':Number(_0x580b57[_0x6ca65b]),'UserId':Number(_0x1bb5cf['id'])});}});}})['catch'](function(_0x50f0e8){_0x5de5af['log'](_0x50f0e8);});}}function onDisconnect(_0x1a705f,_0x18ba1e){joinOrLeave(_0x1a705f,_0xcf55('0x48'),_0x18ba1e);}function onConnect(_0x13ad88){joinOrLeave(_0x13ad88,_0xcf55('0x53'));}exports['default']=function(_0x367808){_0x367808['on'](_0xcf55('0x54'),function(_0x5e3b9e){_0x5e3b9e[_0xcf55('0x55')](0x0);_0x5e3b9e[_0xcf55('0x56')]=_0x5e3b9e['request'][_0xcf55('0x54')][_0xcf55('0x57')]+':'+_0x5e3b9e['request'][_0xcf55('0x54')]['remotePort'];_0x5e3b9e[_0xcf55('0x58')]=new Date();_0x5e3b9e[_0xcf55('0x59')]=function(_0x5c0909){console[_0xcf55('0x59')]('SocketIO\x20'+_0x5e3b9e[_0xcf55('0x5a')][_0xcf55('0x4')]+'['+_0x5e3b9e[_0xcf55('0x56')]+']',_0x5c0909);};_0x5e3b9e['on'](_0xcf55('0x5b'),function(){onDisconnect(_0x5e3b9e,_0x367808);_0x5e3b9e[_0xcf55('0x59')](_0xcf55('0x5c'));});onConnect(_0x5e3b9e);_0x5e3b9e['log']('CONNECTED');});}; \ No newline at end of file +var _0xffd6=['push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','length','format','handshake','query','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xffd6,0x97));var _0x6ffd=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0xffd6[_0x188d31];return _0x30ed33;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var BPromise=require(_0x6ffd('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6ffd('0x3')],'include':[{'as':_0x6ffd('0x4'),'model':db[_0x6ffd('0x5')],'attributes':['id','name',_0x6ffd('0x6')],'raw':!![],'where':{'role':_0x6ffd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x9')],'where':{'type':_0x6ffd('0xa')}};function getAssociatedResources(_0x4a9f85,_0x455dda,_0x417f34){return db['UserProfileSection'][_0x6ffd('0xb')]({'where':{'name':_0x4a9f85,'userProfileId':_0x455dda},'raw':!![]})[_0x6ffd('0xc')](function(_0x23f7f2){if(_0x23f7f2){if(_0x23f7f2[_0x6ffd('0xd')]){switch(_0x4a9f85){case _0x6ffd('0xe'):case _0x6ffd('0xf'):case _0x6ffd('0x10'):case'SmsQueues':case _0x6ffd('0x11'):case _0x6ffd('0x12'):case'WhatsappQueues':return db[_0x417f34][_0x6ffd('0x13')](queryQueues);case _0x6ffd('0x14'):return db[_0x417f34][_0x6ffd('0x13')](queryTelephones);case _0x6ffd('0x15'):return db[_0x417f34]['findAll'](queryTrunks);case _0x6ffd('0x16'):return db[_0x417f34]['findAll'](queryCampaigns);}}else{return db[_0x6ffd('0x17')]['findAll']({'attributes':[_0x6ffd('0x18')],'where':{'sectionId':_0x23f7f2['id']},'raw':!![]})[_0x6ffd('0xc')](function(_0x45db49){if(_0x45db49){var _0x5d8aff={'where':{'id':_[_0x6ffd('0x19')](_0x45db49,_0x6ffd('0x18'))},'raw':!![]};switch(_0x417f34){case _0x6ffd('0x5'):_0x5d8aff[_0x6ffd('0x1a')][_0x6ffd('0x6')]=_0x6ffd('0x8');break;case _0x6ffd('0x1b'):_0x5d8aff[_0x6ffd('0x1a')]['type']=_0x6ffd('0xa');break;}return db[_0x417f34]['findAll'](_0x5d8aff);}else{return[];}});}}else{return[];}})['then'](function(_0x2f5ec4){return _0x2f5ec4;});}function joinOrLeaveQueues(_0x359d09,_0x50aaa2,_0x34c3c1,_0x4612a3){_0x359d09[_0x50aaa2](util['format']('%s:queue:%s',_0x34c3c1,_0x4612a3[_0x6ffd('0x3')]));if(_0x4612a3[_0x6ffd('0x4')]){for(var _0x4dcc50=0x0;_0x4dcc50<_0x4612a3[_0x6ffd('0x4')][_0x6ffd('0x1c')];_0x4dcc50+=0x1){_0x359d09[_0x50aaa2](util[_0x6ffd('0x1d')]('user:%s',_0x4612a3[_0x6ffd('0x4')][_0x4dcc50][_0x6ffd('0x3')]));}}}function joinOrLeave(_0x50896b,_0x356c9c,_0x438d1a){var _0x50c19a;if(_0x50896b[_0x6ffd('0x1e')][_0x6ffd('0x1f')]['id']){db[_0x6ffd('0x5')]['find']({'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x6'),_0x6ffd('0x20')],'where':{'id':_0x50896b['handshake'][_0x6ffd('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6ffd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6ffd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x24')],'as':_0x6ffd('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x6ffd('0xc')](function(_0x20c007){if(_0x20c007){_0x50c19a=_0x20c007;_0x50896b[_0x356c9c](util['format'](_0x6ffd('0x27'),_0x20c007[_0x6ffd('0x3')]));var _0x442b2c=[];switch(_0x20c007[_0x6ffd('0x6')]){case _0x6ffd('0x28'):_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));if(queryQueues[_0x6ffd('0x2b')](_0x6ffd('0x2c'))){delete queryQueues[_0x6ffd('0x2c')];}_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2e')][_0x6ffd('0x13')](queryQueues));_0x442b2c['push'](db['ChatQueue']['findAll'](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2f')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x30')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x31')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x32')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db['WhatsappQueue'][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryTelephones));_0x442b2c['push'](db[_0x6ffd('0x33')]['findAll'](queryTrunks));_0x442b2c['push'](db[_0x6ffd('0x1b')][_0x6ffd('0x13')](queryCampaigns));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')]['findAll'](queryAgents));break;case _0x6ffd('0x34'):_0x50896b[_0x356c9c]('voice:inbound');_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0xe'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2e')));_0x442b2c['push'](getAssociatedResources('ChatQueues',_0x20c007[_0x6ffd('0x20')],'ChatQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x10'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2f')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x35'),_0x20c007['userProfileId'],_0x6ffd('0x30')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x11'),_0x20c007[_0x6ffd('0x20')],'MailQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('OpenchannelQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x32')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('WhatsappQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x36')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x14'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x5')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('Trunks',_0x20c007['userProfileId'],'Trunk'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x16'),_0x20c007['userProfileId'],_0x6ffd('0x1b')));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryAgents));break;case'agent':_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x37')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x38')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x39')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c['push'](_0x20c007['getSmsQueues']({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3a')]({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3b')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x6ffd('0x3d')](_0x442b2c);}})[_0x6ffd('0xc')](function(_0x45f4aa){if(_0x45f4aa&&_0x45f4aa['length']){for(var _0x2bf7c3=0x0;_0x2bf7c3<_0x45f4aa[_0x6ffd('0x1c')];_0x2bf7c3+=0x1){for(var _0x2f8dfb=0x0;_0x2f8dfb<_0x45f4aa[_0x2bf7c3][_0x6ffd('0x1c')];_0x2f8dfb+=0x1){switch(_0x2bf7c3){case 0x0:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3e'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x1:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3f'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x2:joinOrLeaveQueues(_0x50896b,_0x356c9c,'fax',_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x3:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x40'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x4:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x41'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x5:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x42'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x6:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x43'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x7:if(_0x50c19a[_0x6ffd('0x6')]!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')]('telephone:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x8:if(_0x50c19a[_0x6ffd('0x6')]!=='agent')_0x50896b[_0x356c9c](util['format']('trunk:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x9:if(_0x50c19a['role']!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x44'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x9')],_0x45f4aa[_0x2bf7c3][_0x2f8dfb]['name']));break;case 0xa:_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x27'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;}}}}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x16b6b5=_['map'](_0x50c19a['ChatInteractions'],'id');return _0x50c19a[_0x6ffd('0x46')](_0x16b6b5)[_0x6ffd('0xc')](function(){for(var _0x25d7e3=0x0;_0x25d7e3<_0x16b6b5[_0x6ffd('0x1c')];_0x25d7e3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x48'),{'ChatInteractionId':Number(_0x16b6b5[_0x25d7e3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x1e5834=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x49')],'id');return _0x50c19a['removeMailInteractions'](_0x1e5834)['then'](function(){for(var _0x41043f=0x0;_0x41043f<_0x1e5834[_0x6ffd('0x1c')];_0x41043f+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4a'),{'MailInteractionId':Number(_0x1e5834[_0x41043f]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x3fc72f=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x23')],'id');return _0x50c19a[_0x6ffd('0x4b')](_0x3fc72f)[_0x6ffd('0xc')](function(){for(var _0x4ca29b=0x0;_0x4ca29b<_0x3fc72f[_0x6ffd('0x1c')];_0x4ca29b+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4c'),{'FaxInteractionId':Number(_0x3fc72f[_0x4ca29b]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x4b87fc=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x25')],'id');return _0x50c19a[_0x6ffd('0x4d')](_0x4b87fc)[_0x6ffd('0xc')](function(){for(var _0x3f8ef3=0x0;_0x3f8ef3<_0x4b87fc['length'];_0x3f8ef3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4e'),{'SmsInteractionId':Number(_0x4b87fc[_0x3f8ef3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x3ba9c5=_[_0x6ffd('0x19')](_0x50c19a['OpenchannelInteractions'],'id');return _0x50c19a[_0x6ffd('0x4f')](_0x3ba9c5)['then'](function(){for(var _0x1c060a=0x0;_0x1c060a<_0x3ba9c5[_0x6ffd('0x1c')];_0x1c060a+=0x1){_0x438d1a['emit'](_0x6ffd('0x50'),{'OpenchannelInteractionId':Number(_0x3ba9c5[_0x1c060a]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x186f1e=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x51')],'id');return _0x50c19a[_0x6ffd('0x52')](_0x186f1e)['then'](function(){for(var _0x111a7d=0x0;_0x111a7d<_0x186f1e[_0x6ffd('0x1c')];_0x111a7d+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x53'),{'WhatsappInteractionId':Number(_0x186f1e[_0x111a7d]),'UserId':Number(_0x50c19a['id'])});}});}})['catch'](function(_0x38a627){_0x50896b[_0x6ffd('0x54')](_0x38a627);});}}function onDisconnect(_0x46f9bc,_0x4e1198){joinOrLeave(_0x46f9bc,_0x6ffd('0x45'),_0x4e1198);}function onConnect(_0x51cf91){joinOrLeave(_0x51cf91,_0x6ffd('0x55'));}exports['default']=function(_0x363959){_0x363959['on'](_0x6ffd('0x56'),function(_0xb618ef){_0xb618ef[_0x6ffd('0x57')](0x0);_0xb618ef['address']=_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x59')]+':'+_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x5a')];_0xb618ef[_0x6ffd('0x5b')]=new Date();_0xb618ef[_0x6ffd('0x54')]=function(_0x3c9f20){console[_0x6ffd('0x54')](_0x6ffd('0x5c')+_0xb618ef[_0x6ffd('0x5d')][_0x6ffd('0x3')]+'['+_0xb618ef[_0x6ffd('0x5e')]+']',_0x3c9f20);};_0xb618ef['on'](_0x6ffd('0x5f'),function(){onDisconnect(_0xb618ef,_0x363959);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x60'));});onConnect(_0xb618ef);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 709ca4c..51edc6a 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 _0x0cbc=['substatus','agent','AfterUpdate','User','find','fullname','email','hasOwnProperty','model','hook','callback','../../mysqldb','jayson/promise','triggers','http','Chat','afterCreate','ChatInteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','WhatsappInteraction','newinteraction','Whatsapp','FaxInteraction','Fax','afterUpdate','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','error','code','Trigger,\x20%s','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','incomingmessage','AfterCreateMessage','get','offlineMessage','opened','sequelize','catch','AfterCreate','changed','closed'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x0cbc,0x1e7));var _0xc0cb=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x0cbc[_0x487496];return _0x539dc8;};'use strict';var util=require('util');var db=require(_0xc0cb('0x0'))['db'];var jayson=require(_0xc0cb('0x1'));var logger=require('../logger')(_0xc0cb('0x2'));var client=jayson['client'][_0xc0cb('0x3')]({'port':0x232a});var triggers=[{'channel':_0xc0cb('0x4'),'model':'ChatInteraction','event':_0xc0cb('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xc0cb('0x4'),'model':_0xc0cb('0x6'),'event':'afterUpdate','condition':_0xc0cb('0x7'),'callback':afterUpdate},{'channel':_0xc0cb('0x4'),'model':_0xc0cb('0x8'),'event':'afterCreate','condition':_0xc0cb('0x9'),'callback':afterCreateMessage},{'channel':_0xc0cb('0x4'),'model':'ChatOfflineMessage','event':_0xc0cb('0x5'),'condition':_0xc0cb('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0xc0cb('0xa'),'model':_0xc0cb('0xb'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xc0cb('0xa'),'model':_0xc0cb('0xb'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc0cb('0xa'),'model':'SmsMessage','event':_0xc0cb('0x5'),'condition':_0xc0cb('0x9'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xc0cb('0xc'),'event':'afterCreate','condition':_0xc0cb('0xd'),'callback':afterCreate},{'channel':_0xc0cb('0xe'),'model':_0xc0cb('0xc'),'event':'afterUpdate','condition':_0xc0cb('0x7'),'callback':afterUpdate},{'channel':_0xc0cb('0xe'),'model':'WhatsappMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xc0cb('0xf'),'event':_0xc0cb('0x5'),'condition':_0xc0cb('0xd'),'callback':afterCreate},{'channel':_0xc0cb('0x10'),'model':_0xc0cb('0xf'),'event':_0xc0cb('0x11'),'condition':_0xc0cb('0x7'),'callback':afterUpdate},{'channel':_0xc0cb('0x10'),'model':_0xc0cb('0x12'),'event':_0xc0cb('0x5'),'condition':_0xc0cb('0x9'),'callback':afterCreateMessage},{'channel':_0xc0cb('0x13'),'model':_0xc0cb('0x14'),'event':_0xc0cb('0x5'),'condition':_0xc0cb('0xd'),'callback':afterCreate},{'channel':_0xc0cb('0x13'),'model':_0xc0cb('0x14'),'event':'afterUpdate','condition':_0xc0cb('0x7'),'callback':afterUpdate},{'channel':_0xc0cb('0x13'),'model':'MailMessage','event':_0xc0cb('0x5'),'condition':_0xc0cb('0x9'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xc0cb('0x15'),'event':_0xc0cb('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xc0cb('0x16'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0xc0cb('0x7'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xc0cb('0x17'),'event':_0xc0cb('0x5'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x531f87){return client['request'](_0xc0cb('0x18'),_0x531f87)[_0xc0cb('0x19')](function(_0xae3169){logger[_0xc0cb('0x1a')]('Trigger,\x20%s','EventManager',_0xae3169);if(_0xae3169['error']){if(_0xae3169[_0xc0cb('0x1b')][_0xc0cb('0x1c')]===0x1f4){logger[_0xc0cb('0x1b')](_0xc0cb('0x1d'),_0xc0cb('0x18'),_0xae3169[_0xc0cb('0x1b')]);}}})['catch'](function(_0x31065e){logger[_0xc0cb('0x1b')]('Trigger,\x20%s',_0xc0cb('0x18'),_0x31065e);});}function afterCreateMessage(_0x40077d){return function(_0x13c94b){_0x13c94b=_0x13c94b['get']({'plain':!![]});_0x13c94b[_0xc0cb('0x1e')]=_0x40077d;_0x13c94b[_0xc0cb('0x1f')]=_0x40077d;_0x13c94b[_0xc0cb('0x20')]=_0x13c94b[_0xc0cb('0x21')];Promise[_0xc0cb('0x22')]()[_0xc0cb('0x19')](function(){if(typeof _0x13c94b[_0xc0cb('0x23')]===_0xc0cb('0x24'))return null;var _0x5aa60e=_0xc0cb('0x25')+_0x13c94b[_0xc0cb('0x23')];return db['sequelize'][_0xc0cb('0x26')](_0x5aa60e,{'type':db['Sequelize'][_0xc0cb('0x27')][_0xc0cb('0x28')],'raw':!![]});})['then'](function(_0x364498){if(_0x364498){_0x13c94b[_0xc0cb('0x29')]=_0x364498[0x0];}if(typeof _0x13c94b[_0xc0cb('0x2a')]===_0xc0cb('0x24'))return;return getAgent(_0x13c94b[_0xc0cb('0x2a')]);})[_0xc0cb('0x19')](function(_0x589bac){if(_0x589bac){_0x13c94b[_0xc0cb('0x2b')]=util[_0xc0cb('0x2c')](_0xc0cb('0x2d'),_0x589bac[_0xc0cb('0x2e')]);_0x13c94b['agent']=_0x589bac;_0x13c94b[_0xc0cb('0x1e')]=_0x40077d;return request({'event':_0xc0cb('0x2f'),'message':_0x13c94b});}else{return request({'event':'outgoingmessage','message':_0x13c94b});}})['catch'](function(_0x13305f){logger['error']('Trigger,\x20%s',_0xc0cb('0x30'),_0x13305f);});};}function afterCreateOfflineMessage(_0x56b48b){return function(_0x371fd4){_0x371fd4=_0x371fd4[_0xc0cb('0x31')]({'plain':!![]});_0x371fd4[_0xc0cb('0x1e')]=_0x56b48b;_0x371fd4['motionChannel']=_0x56b48b;_0x371fd4['event']=_0xc0cb('0x32');return request({'event':_0x371fd4['event'],'message':_0x371fd4});};}function afterCreate(_0x5e23cc,_0x3ebefe){return function(_0x2bab1b){var _0x3cdda5=_0x2bab1b[_0xc0cb('0x31')]({'plain':!![]});_0x3cdda5[_0xc0cb('0x1e')]=_0x5e23cc;_0x3cdda5['motionChannel']=_0x5e23cc;_0x3cdda5['event']=_0xc0cb('0x33');Promise['resolve']()[_0xc0cb('0x19')](function(){var _0x5150d8=_0xc0cb('0x25')+_0x3cdda5['ContactId'];return db[_0xc0cb('0x34')][_0xc0cb('0x26')](_0x5150d8,{'type':db['Sequelize'][_0xc0cb('0x27')]['SELECT'],'raw':!![]});})[_0xc0cb('0x19')](function(_0x144bad){if(_0x144bad){_0x3cdda5[_0xc0cb('0x29')]=_0x144bad[0x0];}if(_0x3cdda5[_0xc0cb('0x2a')]){return getAgent(_0x3cdda5['UserId']);}return;})[_0xc0cb('0x19')](function(_0x8dc6c6){if(_0x8dc6c6){_0x3cdda5[_0xc0cb('0x2b')]=util['format'](_0xc0cb('0x2d'),_0x8dc6c6['name']);_0x3cdda5['agent']=_0x8dc6c6;}return request({'event':_0x3ebefe,'message':_0x3cdda5});})[_0xc0cb('0x35')](function(_0x2118b9){logger['error'](_0xc0cb('0x1d'),_0xc0cb('0x36'),_0x2118b9);});};}function afterUpdate(_0x3908e9){return function(_0x231d36){var _0x307432=_0x231d36[_0xc0cb('0x37')](_0xc0cb('0x38'))&&_0x231d36[_0xc0cb('0x38')];var _0x284695=_0x231d36['changed'](_0xc0cb('0x39'));if(_0x307432||_0x284695){var _0x4c1475=_0x307432?'closedinteraction':_0xc0cb('0x39');var _0x1e3d6a=_0x231d36[_0xc0cb('0x31')]({'plain':!![]});_0x1e3d6a[_0xc0cb('0x1e')]=_0x3908e9;_0x1e3d6a['motionChannel']=_0x3908e9;_0x1e3d6a[_0xc0cb('0x20')]=_0x307432?_0xc0cb('0x38'):_0xc0cb('0x39');var _0x77a094=_0xc0cb('0x25')+_0x1e3d6a[_0xc0cb('0x23')];return db[_0xc0cb('0x34')][_0xc0cb('0x26')](_0x77a094,{'type':db['Sequelize'][_0xc0cb('0x27')]['SELECT'],'raw':!![]})[_0xc0cb('0x19')](function(_0x123057){if(_0x123057){_0x1e3d6a[_0xc0cb('0x29')]=_0x123057[0x0];}if(typeof _0x1e3d6a['UserId']===_0xc0cb('0x24'))return;return getAgent(_0x1e3d6a['UserId']);})[_0xc0cb('0x19')](function(_0x576cb5){if(_0x576cb5){_0x1e3d6a[_0xc0cb('0x2b')]=util['format'](_0xc0cb('0x2d'),_0x576cb5[_0xc0cb('0x2e')]);_0x1e3d6a[_0xc0cb('0x3a')]=_0x576cb5;}return request({'event':_0x4c1475,'message':_0x1e3d6a});})[_0xc0cb('0x35')](function(_0x3de0e7){logger['error'](_0xc0cb('0x1d'),_0xc0cb('0x3b'),_0x3de0e7);});}};}function getAgent(_0x5a4548){return db[_0xc0cb('0x3c')][_0xc0cb('0x3d')]({'where':{'id':_0x5a4548},'attributes':['id',_0xc0cb('0x2e'),_0xc0cb('0x3e'),_0xc0cb('0x3f'),'internal'],'raw':!![]})[_0xc0cb('0x19')](function(_0x3cc5b7){return _0x3cc5b7;});}exports['default']=function(){for(var _0x25dba5=0x0;_0x25dba5=_0x6e2ad7[_0xf479('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x417fea(_0x29d6a2);})[_0xf479('0x11')](function(_0x51d3ac){_0x1c2024(_0x51d3ac);});});}; \ No newline at end of file +var _0xba14=['getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt'];(function(_0x4a7bec,_0x624f89){var _0x3dcbf1=function(_0x598545){while(--_0x598545){_0x4a7bec['push'](_0x4a7bec['shift']());}};_0x3dcbf1(++_0x624f89);}(_0xba14,0x18f));var _0x4ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4ba1('0x0'));var BPromise=require(_0x4ba1('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x4ba1('0x2'));var channels=[_0x4ba1('0x3'),_0x4ba1('0x4'),'chat',_0x4ba1('0x5'),_0x4ba1('0x6'),_0x4ba1('0x7'),_0x4ba1('0x8')];exports['getChannels']=function(){return channels;};exports[_0x4ba1('0x9')]=function(_0x406523){_0x406523=_0x406523[_0x4ba1('0xa')]();return _[_0x4ba1('0xb')](channels,_0x406523);};exports[_0x4ba1('0xc')]=function(_0xe44cbc,_0x40d886,_0xe5f93e,_0x251675){var _0x145e32={'loginAttempts':_0x40d886,'blocked':_0xe5f93e};if(!_[_0x4ba1('0xd')](_0x251675)){_0x145e32[_0x4ba1('0xe')]=_0x251675;}return _0xe44cbc['updateAttributes'](_0x145e32);};exports[_0x4ba1('0xf')]=function(_0x372c87){return new BPromise(function(_0x8f0c90,_0xfe7846){var _0x43fa0c=0x0;if(_0x372c87[_0x4ba1('0x10')]!==_0x4ba1('0x11')){_0x8f0c90(_0x372c87);}db['User'][_0x4ba1('0x12')]({'where':{'role':_0x4ba1('0x11'),'online':!![],'id':{'$ne':_0x372c87['id']}}})[_0x4ba1('0x13')](function(_0x1679c0){_0x43fa0c=_0x1679c0;return util['getLicense']();})[_0x4ba1('0x13')](function(_0x5c6716){if(_0x5c6716&&_0x5c6716[_0x4ba1('0x14')]&&_0x43fa0c>=_0x5c6716[_0x4ba1('0x14')]){throw Error(_0x4ba1('0x15'));}_0x8f0c90(_0x372c87);})[_0x4ba1('0x16')](function(_0x9cdab4){_0xfe7846(_0x9cdab4);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 3804e67..1ae88ee 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa02c=['name','Error','Bad\x20Request','Forbidden','inherits','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','status','send','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xa02c,0x1db));var _0xca02=function(_0x1fe918,_0x458654){_0x1fe918=_0x1fe918-0x0;var _0x12954c=_0xa02c[_0x1fe918];return _0x12954c;};'use strict';var util=require(_0xca02('0x0'));var logger=require(_0xca02('0x1'))(_0xca02('0x2'));var APIError=function(_0x3f32db,_0x5a239c){this[_0xca02('0x3')]=_0x3f32db||_0xca02('0x4');this[_0xca02('0x5')]=_0x5a239c||_0xca02('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1c7c59){this['message']=_0x1c7c59||_0xca02('0x7');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x567458){this[_0xca02('0x3')]=_0x567458||_0xca02('0x8');this[_0xca02('0x5')]=_0xca02('0x8');util[_0xca02('0x9')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x13ca1b){this[_0xca02('0x3')]=_0x13ca1b||'Entity\x20not\x20found';this[_0xca02('0x5')]=_0xca02('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x34789d){this['message']=_0x34789d||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xca02('0x5')]=_0xca02('0xb');this[_0xca02('0xc')]=0x193;this[_0xca02('0xd')]={'type':_0xca02('0xe')};util[_0xca02('0x9')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x45ec61){this['message']=_0x45ec61||_0xca02('0xf');this['name']=_0xca02('0x10');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x28674c){switch(_0x28674c){case _0xca02('0x7'):return 0x190;case _0xca02('0x8'),_0xca02('0xb'):return 0x193;case _0xca02('0xa'):return 0x194;case _0xca02('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x8fffc3){if(_0x8fffc3===_0xca02('0xb'))return _0x8fffc3;return null;}function handleError(_0x4c9c67){return function(_0x3cb986){logger[_0xca02('0x11')](_0x3cb986['stack']);var _0xf5ea19=getStatusCode(_0x3cb986[_0xca02('0x5')]);var _0x4162f1=getCustomStatusMessage(_0x3cb986[_0xca02('0x5')]);if(_0x3cb986['name']){delete _0x3cb986[_0xca02('0x5')];}if(_0x4162f1){_0x4c9c67['statusMessage']=_0x4162f1;}return _0x4c9c67[_0xca02('0x12')](_0xf5ea19)[_0xca02('0x13')](_0x3cb986);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x5839=['Resource\x20Conflict','error','stack','statusMessage','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5839,0x1e5));var _0x9583=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x5839[_0x5459b0];return _0x675a35;};'use strict';var util=require(_0x9583('0x0'));var logger=require(_0x9583('0x1'))(_0x9583('0x2'));var APIError=function(_0x4ab028,_0x195701){this['message']=_0x4ab028||_0x9583('0x3');this[_0x9583('0x4')]=_0x195701||_0x9583('0x5');util[_0x9583('0x6')](APIError,Error);};var APIBadRequestError=function(_0xb2ccc5){this[_0x9583('0x7')]=_0xb2ccc5||'Bad\x20Request';this[_0x9583('0x4')]=_0x9583('0x8');util[_0x9583('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3f01fb){this['message']=_0x3f01fb||_0x9583('0x9');this['name']=_0x9583('0x9');util[_0x9583('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x18f2dc){this[_0x9583('0x7')]=_0x18f2dc||'Entity\x20not\x20found';this[_0x9583('0x4')]=_0x9583('0xa');util[_0x9583('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x12ed67){this[_0x9583('0x7')]=_0x12ed67||_0x9583('0xb');this[_0x9583('0x4')]=_0x9583('0xc');this[_0x9583('0xd')]=0x193;this[_0x9583('0xe')]={'type':'OutOfInterval'};util[_0x9583('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x221c16){this[_0x9583('0x7')]=_0x221c16||_0x9583('0xf');this[_0x9583('0x4')]='Conflict';util[_0x9583('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x5b81d5){switch(_0x5b81d5){case _0x9583('0x8'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x7ef345){if(_0x7ef345===_0x9583('0xc'))return _0x7ef345;return null;}function handleError(_0x1e971d){return function(_0x1afdb2){logger[_0x9583('0x10')](_0x1afdb2[_0x9583('0x11')]);var _0x14471a=getStatusCode(_0x1afdb2['name']);var _0x5eb8ee=getCustomStatusMessage(_0x1afdb2[_0x9583('0x4')]);if(_0x1afdb2[_0x9583('0x4')]){delete _0x1afdb2[_0x9583('0x4')];}if(_0x5eb8ee){_0x1e971d[_0x9583('0x12')]=_0x5eb8ee;}return _0x1e971d['status'](_0x14471a)['send'](_0x1afdb2);};}module[_0x9583('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 480c169..823b31a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4046=['404','status','json'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0x4046,0x126));var _0x6404=function(_0x53d5b9,_0x50836d){_0x53d5b9=_0x53d5b9-0x0;var _0x23426b=_0x4046[_0x53d5b9];return _0x23426b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x224071,_0x435baa){var _0x3345a9=_0x6404('0x0');var _0x15ac05=0x194;var _0x4e2695={'status':_0x15ac05};_0x435baa['status'](_0x4e2695['status']);_0x435baa['render'](_0x3345a9,{},function(_0x230d7a,_0x2e4062){if(_0x230d7a){return _0x435baa[_0x6404('0x1')](_0x4e2695[_0x6404('0x1')])[_0x6404('0x2')](_0x4e2695);}_0x435baa['send'](_0x2e4062);});}; \ No newline at end of file +var _0xa454=['status','json','404'];(function(_0x5c869b,_0x1bc7f8){var _0x26e6b8=function(_0x314768){while(--_0x314768){_0x5c869b['push'](_0x5c869b['shift']());}};_0x26e6b8(++_0x1bc7f8);}(_0xa454,0xc8));var _0x4a45=function(_0x4b9e38,_0x47e700){_0x4b9e38=_0x4b9e38-0x0;var _0xfe5081=_0xa454[_0x4b9e38];return _0xfe5081;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3c6ded,_0x26c368){var _0x2c20db=_0x4a45('0x0');var _0x573f8b=0x194;var _0x502b3b={'status':_0x573f8b};_0x26c368[_0x4a45('0x1')](_0x502b3b[_0x4a45('0x1')]);_0x26c368['render'](_0x2c20db,{},function(_0x29c254,_0x5d0cd4){if(_0x29c254){return _0x26c368[_0x4a45('0x1')](_0x502b3b['status'])[_0x4a45('0x2')](_0x502b3b);}_0x26c368['send'](_0x5d0cd4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index cadd386..a6702a1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2ab=['user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','belongsTo','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','TemplateId','Teams','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','List','fax_interaction_has_tags','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatMessage','user_has_chat_websites','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','Hoppers','HopperHistories','JscriptySessions','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Agent','All','OneAll','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','AccountId','SalesforceField','SubjectId','Descriptions','FieldId','SalesforceAccount','DescriptionId','VariableId','Configurations','Subjects','Subject','Description','DeskAccount','int_desk_configuration_has_tags','Field','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','team_has_fax_queues','FaxQueues','team_has_whatsapp_queues','WhatsappQueues','CampaignId','TrunkBackupId','SquareProject','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToSmsAccountId','Contacts','HopperHistory','Queues','TeamVoicePrefix','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','mysql','name','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','utf8','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','SmsInteraction','SmsInteractions','MailInteraction','MailInteractions','WhatsappInteraction','SenderId','SET\x20NULL','userProfileId','Groups','chat_group_has_users','cm_user_has_contacts','belongsToMany','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','cm_user_has_lists','ChatWebsites','FaxAccounts'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x1a32e1,_0x401c10){_0x1a32e1=_0x1a32e1-0x0;var _0x4658c6=_0xe2ab[_0x1a32e1];return _0x4658c6;};'use strict';var config=require(_0xbe2a('0x0'));var Sequelize=require(_0xbe2a('0x1'));var _=require(_0xbe2a('0x2'));var jstz=require(_0xbe2a('0x3'));var timezone=jstz[_0xbe2a('0x4')]();config[_0xbe2a('0x1')]=_['defaultsDeep'](config[_0xbe2a('0x1')],{'database':_0xbe2a('0x5'),'username':_0xbe2a('0x6'),'password':_0xbe2a('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe2a('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbe2a('0x9')](),'define':{'charset':'utf8','collate':_0xbe2a('0xa')}}});config[_0xbe2a('0xb')]=_[_0xbe2a('0xc')](config['sequelizeHistory'],{'database':'motion2','username':_0xbe2a('0x6'),'password':_0xbe2a('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe2a('0x8'),'dialectOptions':{'charset':_0xbe2a('0xd')},'logging':![],'timezone':timezone[_0xbe2a('0x9')](),'define':{'charset':_0xbe2a('0xe'),'collate':_0xbe2a('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0xbe2a('0xf')],config[_0xbe2a('0x1')][_0xbe2a('0x10')],config[_0xbe2a('0x1')][_0xbe2a('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xbe2a('0x12')],config[_0xbe2a('0xb')][_0xbe2a('0xf')],config['sequelizeHistory'][_0xbe2a('0x10')],config[_0xbe2a('0xb')][_0xbe2a('0x11')])};db[_0xbe2a('0x13')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x15'));db[_0xbe2a('0x16')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x17'));db[_0xbe2a('0x18')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceContext/voiceContext.model');db[_0xbe2a('0x19')]=db[_0xbe2a('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xbe2a('0x1a')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x1b'));db['VoiceQueue']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x1c'));db[_0xbe2a('0x1d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xbe2a('0x1e')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/screenRecording/screenRecording.model');db[_0xbe2a('0x1f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x20'));db[_0xbe2a('0x21')]=db['sequelize']['import'](_0xbe2a('0x22'));db[_0xbe2a('0x23')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0xbe2a('0x24')]=db['sequelize'][_0xbe2a('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xbe2a('0x25')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x26'));db[_0xbe2a('0x27')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x28'));db[_0xbe2a('0x29')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/memberReport/memberReport.model');db[_0xbe2a('0x2a')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x2b'));db[_0xbe2a('0x2c')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x2d'));db[_0xbe2a('0x2e')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x2f'));db[_0xbe2a('0x30')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x31'));db[_0xbe2a('0x32')]=db['sequelize']['import']('../api/userMailQueue/userMailQueue.model');db[_0xbe2a('0x33')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xbe2a('0x34')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x35'));db[_0xbe2a('0x36')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x37'));db['UserWhatsappQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x38'));db['MailServerIn']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x39'));db[_0xbe2a('0x3a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x3b'));db[_0xbe2a('0x3c')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/mailAccount/mailAccount.model');db[_0xbe2a('0x3d')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x3e'));db[_0xbe2a('0x3f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x40'));db['MailInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x41'));db[_0xbe2a('0x42')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x43'));db[_0xbe2a('0x44')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x45'));db['MailQueueReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x46'));db[_0xbe2a('0x47')]=db['sequelize']['import'](_0xbe2a('0x48'));db[_0xbe2a('0x49')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x4a'));db[_0xbe2a('0x4b')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x4c'));db[_0xbe2a('0x4d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/faxApplication/faxApplication.model');db[_0xbe2a('0x4e')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x4f'));db[_0xbe2a('0x50')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x51'));db[_0xbe2a('0x52')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x53'));db['FaxQueueReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x54'));db[_0xbe2a('0x55')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x56'));db[_0xbe2a('0x57')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x58'));db['SmsInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x59'));db[_0xbe2a('0x5a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x5b'));db[_0xbe2a('0x5c')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x5d'));db[_0xbe2a('0x5e')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xbe2a('0x5f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x60'));db['OpenchannelInteraction']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x61'));db[_0xbe2a('0x62')]=db['sequelize']['import'](_0xbe2a('0x63'));db['OpenchannelQueue']=db[_0xbe2a('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xbe2a('0x64')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x65'));db[_0xbe2a('0x66')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x67'));db[_0xbe2a('0x68')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x69'));db[_0xbe2a('0x6a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x6b'));db['ChatMessage']=db[_0xbe2a('0x1')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x6c'));db[_0xbe2a('0x6d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x6e'));db[_0xbe2a('0x6f')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x70'));db[_0xbe2a('0x71')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x72'));db['CmCompany']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x73'));db[_0xbe2a('0x74')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x75'));db[_0xbe2a('0x76')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x77'));db[_0xbe2a('0x78')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x79'));db[_0xbe2a('0x7a')]=db[_0xbe2a('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xbe2a('0x7b')]=db['sequelize']['import'](_0xbe2a('0x7c'));db[_0xbe2a('0x7d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x7e'));db[_0xbe2a('0x7f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x80'));db['Action']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x81'));db[_0xbe2a('0x82')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x83'));db[_0xbe2a('0x84')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x85'));db['Disposition']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x86'));db[_0xbe2a('0x87')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x88'));db[_0xbe2a('0x89')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x8a'));db[_0xbe2a('0x8b')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x8c'));db[_0xbe2a('0x8d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x8e'));db[_0xbe2a('0x8f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x90'));db[_0xbe2a('0x91')]=db['sequelize']['import'](_0xbe2a('0x92'));db[_0xbe2a('0x93')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x94'));db[_0xbe2a('0x95')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x96'));db['ContactItemType']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x97'));db[_0xbe2a('0x98')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xbe2a('0x99')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9a'));db[_0xbe2a('0x9b')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9c'));db[_0xbe2a('0x9d')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9e'));db[_0xbe2a('0x9f')]=db['sequelize'][_0xbe2a('0x14')]('../api/integration/integration.model');db[_0xbe2a('0xa0')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xa1'));db[_0xbe2a('0xa2')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xa3'));db[_0xbe2a('0xa4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xbe2a('0xa5')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xa6'));db[_0xbe2a('0xa7')]=db['sequelize'][_0xbe2a('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xbe2a('0xa8')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xa9'));db['SalesforceAccount']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xaa'));db['SalesforceConfiguration']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xab'));db[_0xbe2a('0xac')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xad'));db[_0xbe2a('0xae')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xaf'));db[_0xbe2a('0xb0')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xb1'));db['DeskAccount']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xb2'));db[_0xbe2a('0xb3')]=db['sequelize']['import'](_0xbe2a('0xb4'));db[_0xbe2a('0xb5')]=db['sequelize'][_0xbe2a('0x14')]('../api/intDeskField/intDeskField.model');db[_0xbe2a('0xb6')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xbe2a('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xbe2a('0xb7')]=db['sequelize']['import'](_0xbe2a('0xb8'));db[_0xbe2a('0xb9')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xbe2a('0xba')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xbb'));db[_0xbe2a('0xbc')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xbd'));db[_0xbe2a('0xbe')]=db[_0xbe2a('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xbe2a('0xbf')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xc0'));db[_0xbe2a('0xc1')]=db['sequelize']['import'](_0xbe2a('0xc2'));db[_0xbe2a('0xc3')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc4'));db[_0xbe2a('0xc5')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc6'));db[_0xbe2a('0xc7')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0xbe2a('0xc8')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc9'));db['ServicenowField']=db[_0xbe2a('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xbe2a('0xca')]=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xbe2a('0xcb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xcc'));db[_0xbe2a('0xcd')]=db[_0xbe2a('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xbe2a('0xce')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xcf'));db['FreshsalesConfiguration']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xd0'));db[_0xbe2a('0xd1')]=db['sequelize'][_0xbe2a('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xbe2a('0x9f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd2'));db['Network']=db['sequelize'][_0xbe2a('0x14')]('../api/network/network.model');db[_0xbe2a('0xd3')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xbe2a('0xd4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd5'));db['JscriptyAnswerReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd6'));db['JscriptyQuestionReport']=db['sequelize'][_0xbe2a('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xbe2a('0xd7')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xbe2a('0xd8')]=db['sequelize']['import'](_0xbe2a('0xd9'));db[_0xbe2a('0xda')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/squareReport/squareReport.model');db[_0xbe2a('0xdb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xbe2a('0xdc')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xbe2a('0xdd')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xde'));db['SquareOdbc']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xdf'));db['SquareProject']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xe0'));db['SquareRecording']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xe1'));db['SquareMessage']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe2'));db[_0xbe2a('0xe3')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xe4'));db[_0xbe2a('0xe5')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe6'));db[_0xbe2a('0xe7')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe8'));db[_0xbe2a('0xe9')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xea'));db[_0xbe2a('0xeb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xec'));db['Plugin']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/plugin/plugin.model');db[_0xbe2a('0xed')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xbe2a('0xee')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xef'));db['FaxTransferReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf0'));db[_0xbe2a('0xf1')]=db[_0xbe2a('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xbe2a('0xf2')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf3'));db[_0xbe2a('0xf4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf5'));db['VoicePrefix']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf6'));db[_0xbe2a('0xf7')]=db['sequelize'][_0xbe2a('0x14')]('../api/userProfile/userProfile.model');db[_0xbe2a('0xf8')]=db['sequelize']['import'](_0xbe2a('0xf9'));db['UserProfileResource']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xbe2a('0xfa')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userNotification/userNotification.model');db[_0xbe2a('0xfb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xfc'));db[_0xbe2a('0xfd')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xfe'));db['WhatsappInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xff'));db[_0xbe2a('0x100')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x101'));db[_0xbe2a('0x102')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x103'));db[_0xbe2a('0x104')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0xbe2a('0x105')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x106'));db[_0xbe2a('0x107')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x108'));db['TeamVoicePrefix']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x109'));db[_0xbe2a('0x10a')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x10b'));db[_0xbe2a('0x10c')]=db['sequelize'][_0xbe2a('0x14')]('../api/user-setting/user-setting.model');db[_0xbe2a('0x10d')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x10e'));db[_0xbe2a('0x13')][_0xbe2a('0x10f')](db[_0xbe2a('0x1f')],{'as':_0xbe2a('0x1f'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x10f')](db[_0xbe2a('0x10c')],{'as':_0xbe2a('0x112'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x111')});db['User']['hasMany'](db[_0xbe2a('0x7b')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x7d')],{'as':_0xbe2a('0x7d'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x116')],{'as':_0xbe2a('0x117'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x4e')],{'as':'FaxInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x11c')],{'as':'WhatsappInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0xbe2a('0x11d')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x11e')});db[_0xbe2a('0x13')]['belongsTo'](db[_0xbe2a('0xf7')],{'as':_0xbe2a('0xf7'),'foreignKey':_0xbe2a('0x11f')});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x6f')],{'as':_0xbe2a('0x120'),'through':_0xbe2a('0x121')});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x74')],{'as':'Contacts','through':_0xbe2a('0x122')});db['User'][_0xbe2a('0x123')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x124')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'through':_0xbe2a('0x125')});db['User'][_0xbe2a('0x123')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','through':_0xbe2a('0x126')});db['User'][_0xbe2a('0x123')](db['FaxInteraction'],{'as':_0xbe2a('0x127'),'through':'user_has_fax_interactions'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'through':_0xbe2a('0x128')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xbe2a('0x117'),'through':_0xbe2a('0x129')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x11c')],{'as':'WhatsappInteractions','through':_0xbe2a('0x12a')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x12b')],{'as':_0xbe2a('0x12c'),'through':'UserVoiceQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x12d')],{'as':_0xbe2a('0x12e'),'through':'UserVoicePrefix','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x3d')],{'as':_0xbe2a('0x12f'),'through':'UserMailQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db['ChatQueue'],{'as':_0xbe2a('0x130'),'through':_0xbe2a('0x131'),'required':![],'hooks':!![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x52')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x5c')],{'as':_0xbe2a('0x132'),'through':_0xbe2a('0x34'),'required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x133')],{'as':_0xbe2a('0x134'),'through':_0xbe2a('0x36'),'required':![]});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x135')],{'as':'WhatsappQueues','through':_0xbe2a('0x136'),'required':![]});db['User'][_0xbe2a('0x123')](db['CmList'],{'through':_0xbe2a('0x137')});db[_0xbe2a('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0xbe2a('0x138'),'through':'user_has_chat_websites'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x4b')],{'as':_0xbe2a('0x139'),'through':_0xbe2a('0x13a')});db['User']['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0xbe2a('0x13b')});db['User'][_0xbe2a('0x123')](db['OpenchannelAccount'],{'as':_0xbe2a('0x13c'),'through':'user_has_openchannel_accounts'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x55')],{'as':_0xbe2a('0x13d'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0xbe2a('0xfb')],{'as':_0xbe2a('0x13e'),'through':_0xbe2a('0x13f')});db['VoiceChanSpy'][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x140'),'onDelete':_0xbe2a('0x110'),'foreignKey':'ChanSpyId'});db[_0xbe2a('0x18')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'onDelete':'cascade'});db[_0xbe2a('0x19')][_0xbe2a('0x113')](db['VoiceExtension'],{'as':_0xbe2a('0x141'),'onDelete':'cascade'});db[_0xbe2a('0x1a')]['belongsToMany'](db[_0xbe2a('0x93')],{'as':_0xbe2a('0x142'),'through':_0xbe2a('0x143')});db['VoiceQueue'][_0xbe2a('0x113')](db[_0xbe2a('0x2e')],{'as':_0xbe2a('0x144'),'foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')]['hasMany'](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7a')],{'as':_0xbe2a('0x115'),'foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7b')],{'as':'HopperHistories','foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7d')],{'as':_0xbe2a('0x7d'),'foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x78')],{'as':_0xbe2a('0x146'),'foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')]['hasMany'](db[_0xbe2a('0xd7')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a'),'foreignKey':_0xbe2a('0x148')});db[_0xbe2a('0x12b')][_0xbe2a('0x147')](db['Trunk'],{'as':_0xbe2a('0x149'),'foreignKey':'TrunkBackupId'});db[_0xbe2a('0x12b')]['belongsTo'](db['Interval'],{'as':_0xbe2a('0x89'),'foreignKey':_0xbe2a('0x14a')});db['VoiceQueue'][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['VoiceQueue'][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x14d'),'through':_0xbe2a('0x14e')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x30')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'as':'Teams','through':_0xbe2a('0x107')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x150'),'through':_0xbe2a('0x151')});db[_0xbe2a('0x1d')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x1e')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x1f')][_0xbe2a('0x113')](db[_0xbe2a('0x21')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xbe2a('0x21')][_0xbe2a('0x147')](db['VoiceMail'],{'foreignKey':_0xbe2a('0x153'),'targetKey':_0xbe2a('0x154')});db[_0xbe2a('0x23')][_0xbe2a('0x113')](db['VoiceQueueReport'],{'as':_0xbe2a('0x155'),'foreignKey':'uniqueid','constraints':![]});db[_0xbe2a('0x23')][_0xbe2a('0x113')](db[_0xbe2a('0x25')],{'as':_0xbe2a('0x156'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':'User','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x23')]['belongsTo'](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x158')][_0xbe2a('0x147')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x158')][_0xbe2a('0x147')](db['CloudProvider'],{'as':_0xbe2a('0x105'),'foreignKey':_0xbe2a('0x15a'),'onDelete':_0xbe2a('0x15b')});db['MailServerOut'][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x3c'),'foreignKey':'MailAccountId'});db[_0xbe2a('0x3a')]['belongsTo'](db[_0xbe2a('0x105')],{'as':_0xbe2a('0x105'),'foreignKey':_0xbe2a('0x15a'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x3c')][_0xbe2a('0x10f')](db[_0xbe2a('0x158')],{'as':_0xbe2a('0x15c'),'onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x10f')](db['MailServerOut'],{'as':_0xbe2a('0x15d'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':'MailAccountId'});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db['MailMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x44')],{'as':_0xbe2a('0x141'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0xbe2a('0x3c')][_0xbe2a('0x147')](db[_0xbe2a('0x99')],{'as':'Template','foreignKey':_0xbe2a('0x162')});db['MailAccount'][_0xbe2a('0x147')](db['Pause'],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x3c')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x13b')});db['MailQueue'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x32')});db['MailQueue']['belongsToMany'](db[_0xbe2a('0xe3')],{'through':'team_has_mail_queues','as':_0xbe2a('0x163')});db[_0xbe2a('0x11a')][_0xbe2a('0x113')](db[_0xbe2a('0x42')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'MailInteractionId'});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x11a')]['belongsToMany'](db['Tag'],{'through':_0xbe2a('0x167'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x11a')][_0xbe2a('0x123')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xbe2a('0x169')});db['MailInteraction'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0xbe2a('0x16b')});db['MailMessage'][_0xbe2a('0x113')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0x16c'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db['User'],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x16b')});db[_0xbe2a('0x42')]['belongsTo'](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x159')});db['MailMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'as':_0xbe2a('0x64'),'foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db['ChatOfflineMessage'],{'as':_0xbe2a('0x16f'),'foreignKey':_0xbe2a('0x170')});db['MailApplication'][_0xbe2a('0x147')](db['User'],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x44')][_0xbe2a('0x147')](db[_0xbe2a('0x3d')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x44')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'onDelete':_0xbe2a('0x15b')});db['MailApplication'][_0xbe2a('0x147')](db[_0xbe2a('0x89')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x44')]['belongsTo'](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x172')]['belongsTo'](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x42')],{});db[_0xbe2a('0x172')]['belongsTo'](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x3d')],{});db['Dashboard']['hasMany'](db[_0xbe2a('0x49')],{'as':_0xbe2a('0x174'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x175'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xbe2a('0x4b')]['hasMany'](db['FaxInteraction'],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x4d')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x175'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x176'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x50')],{'as':_0xbe2a('0x152')});db['FaxAccount'][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a')});db['FaxAccount'][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x4b')][_0xbe2a('0x147')](db['Pause'],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x4b')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x13a')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db['User'],{'onDelete':'restrict'});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x52')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x4e')]['hasMany'](db['FaxMessage'],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'FaxInteractionId'});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x4b')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x13')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xbe2a('0x123')](db['Tag'],{'through':_0xbe2a('0x178'),'as':'Tags'});db[_0xbe2a('0x4e')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x178'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x4e')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':'user_has_fax_interactions','foreignKey':_0xbe2a('0x179')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':'cascade','as':'User'});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{'as':'Interaction','foreignKey':_0xbe2a('0x179')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{'as':'Account','foreignKey':_0xbe2a('0x175')});db['FaxQueue']['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x33')});db['FaxQueue'][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':'team_has_fax_queues','as':_0xbe2a('0x163')});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x50')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x17b')]['belongsTo'](db['FaxQueue'],{});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'SmsAccountId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db['SmsMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':'Interactions'});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x57')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x17c'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x55')]['belongsTo'](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x55')]['belongsTo'](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['SmsAccount'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x17d')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x5c')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{'onDelete':'restrict'});db[_0xbe2a('0x57')]['belongsTo'](db[_0xbe2a('0x89')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x118')]['hasMany'](db[_0xbe2a('0x5a')],{'as':_0xbe2a('0x152'),'onDelete':'cascade','foreignKey':_0xbe2a('0x17e')});db[_0xbe2a('0x118')]['belongsTo'](db[_0xbe2a('0x55')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x118')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x118')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':'UserId'});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db['Tag'],{'through':_0xbe2a('0x17f'),'as':'Tags'});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x17f'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x5a')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':'Contact'});db[_0xbe2a('0x5a')]['belongsTo'](db[_0xbe2a('0x118')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x17e')});db['SmsMessage']['belongsTo'](db[_0xbe2a('0x55')],{'as':'Account','foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xbe2a('0x34'),'foreignKey':_0xbe2a('0x180')});db[_0xbe2a('0x5c')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x181'),'as':_0xbe2a('0x163')});db['OpenchannelAccount'][_0xbe2a('0x113')](db['Disposition'],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x182'),'onDelete':_0xbe2a('0x110')});db['OpenchannelAccount'][_0xbe2a('0x113')](db['CannedAnswer'],{'as':_0xbe2a('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x5e')][_0xbe2a('0x113')](db[_0xbe2a('0x116')],{'as':'Interactions','foreignKey':_0xbe2a('0x182')});db[_0xbe2a('0x5e')]['hasMany'](db['OpenchannelMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x182')});db[_0xbe2a('0x5e')][_0xbe2a('0x113')](db[_0xbe2a('0x5f')],{'as':'Applications','foreignKey':_0xbe2a('0x182'),'onDelete':_0xbe2a('0x110')});db['OpenchannelAccount'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db['OpenchannelAccount']['belongsTo'](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x5e')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x183')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db[_0xbe2a('0x133')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x184')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db['OpenchannelAccount'],{'onDelete':_0xbe2a('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbe2a('0x116')][_0xbe2a('0x113')](db[_0xbe2a('0x62')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x116')][_0xbe2a('0x147')](db['OpenchannelAccount'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x182')});db['OpenchannelInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db['OpenchannelInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x116')]['belongsToMany'](db['Tag'],{'through':_0xbe2a('0x186'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x116')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x186'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x116')][_0xbe2a('0x123')](db['User'],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x129'),'foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x62')]['belongsTo'](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x13')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0x116')],{'onDelete':_0xbe2a('0x110'),'as':'Interaction','foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db['OpenchannelMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x5e')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x133')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0xbe2a('0x187'),'as':'Teams'});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'ChatWebsiteId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':'ChatWebsiteId'});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x71')],{'as':_0xbe2a('0x188')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db['ChatInteraction'],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x68')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x16e'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x189')],{'as':'Messages'});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db[_0xbe2a('0x89')],{'as':'Interval','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x3c'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['ChatWebsite']['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x18a')});db['OpenchannelQueueReport'][_0xbe2a('0x147')](db['OpenchannelAccount'],{});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0x116')],{});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db['OpenchannelMessage'],{});db[_0xbe2a('0x66')]['belongsTo'](db[_0xbe2a('0x13')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0xbe2a('0x68')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':'Agent','foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x68')][_0xbe2a('0x147')](db[_0xbe2a('0x6d')],{'as':_0xbe2a('0x18b'),'foreignKey':'ChatQueueId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x68')]['belongsTo'](db[_0xbe2a('0x64')],{'as':_0xbe2a('0x18c'),'foreignKey':_0xbe2a('0x16e'),'onDelete':_0xbe2a('0x15b')});db['ChatApplication'][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x6a')]['hasMany'](db[_0xbe2a('0x189')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x18d')});db['ChatInteraction'][_0xbe2a('0x147')](db['ChatWebsite'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x6a')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x6a')][_0xbe2a('0x147')](db['User'],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db['ChatInteraction'][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x18e'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x6a')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':'chat_interaction_has_tags','as':_0xbe2a('0x169')});db[_0xbe2a('0x6a')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x126'),'foreignKey':_0xbe2a('0x18d')});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db['User'],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x13')});db['ChatMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db[_0xbe2a('0x6a')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':'ChatInteractionId'});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db[_0xbe2a('0x189')]['belongsTo'](db['ChatWebsite'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x16e')});db['ChatOfflineMessage'][_0xbe2a('0x113')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0x16c'),'foreignKey':_0xbe2a('0x170'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x16f')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':'cascade','as':_0xbe2a('0x165'),'foreignKey':'ContactId'});db[_0xbe2a('0x16f')][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'as':'Account','foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x6d')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x131'),'hooks':!![]});db[_0xbe2a('0x6d')]['belongsToMany'](db['Team'],{'through':_0xbe2a('0x18f'),'as':_0xbe2a('0x163')});db[_0xbe2a('0x6f')]['hasMany'](db['ChatInternalMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x190'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x6f')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x144'),'through':'chat_group_has_users'});db[_0xbe2a('0x71')][_0xbe2a('0x147')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x191')][_0xbe2a('0x113')](db[_0xbe2a('0x74')],{'as':'Contacts','foreignKey':_0xbe2a('0x192')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['CmContactHasItem'],{'as':_0xbe2a('0x193'),'foreignKey':_0xbe2a('0x194')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':_0xbe2a('0x195'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x157')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0xbe2a('0x196'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbe2a('0x157')});db['CmContact'][_0xbe2a('0x113')](db[_0xbe2a('0xd7')],{'as':_0xbe2a('0x197'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')]['hasMany'](db[_0xbe2a('0x116')],{'as':_0xbe2a('0x117'),'foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db['CmContact'][_0xbe2a('0x113')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x4e')],{'as':_0xbe2a('0x127'),'foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')]['hasMany'](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbe2a('0x74')][_0xbe2a('0x147')](db['CmCompany'],{'as':'Company','foreignKey':_0xbe2a('0x192')});db[_0xbe2a('0x74')][_0xbe2a('0x147')](db['CmList'],{'as':'List','foreignKey':_0xbe2a('0x173'),'onDelete':_0xbe2a('0x110')});db['CmContact'][_0xbe2a('0x123')](db['User'],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x122')});db[_0xbe2a('0x74')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'as':_0xbe2a('0x168'),'through':'cm_contact_has_tags'});db[_0xbe2a('0x74')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x198'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x76')][_0xbe2a('0x113')](db[_0xbe2a('0x199')],{'as':_0xbe2a('0x19a'),'foreignKey':_0xbe2a('0x19b')});db['CmHopper'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173'),'onDelete':'cascade'});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x19c'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x76')]['belongsTo'](db[_0xbe2a('0x12b')],{'as':'Queue','foreignKey':_0xbe2a('0x145'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0xe7')],{'as':_0xbe2a('0xe7'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':'OwnerId'});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db['VoiceQueue'],{'as':_0xbe2a('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db[_0xbe2a('0xe7')],{'as':_0xbe2a('0xe7'),'foreignKey':'CampaignId','onDelete':_0xbe2a('0x110')});db['Automation'][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x19d'),'singular':_0xbe2a('0x19e')},'foreignKey':'AutomationAllId','onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x82')][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x19f'),'singular':_0xbe2a('0x1a0')},'foreignKey':_0xbe2a('0x1a1'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xbe2a('0x113')](db[_0xbe2a('0x1a2')],{'as':_0xbe2a('0x1a3'),'foreignKey':_0xbe2a('0x1a4'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x15e')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x1a5'),'onDelete':'cascade'});db[_0xbe2a('0x89')]['hasMany'](db[_0xbe2a('0x89')],{'as':'Intervals','foreignKey':_0xbe2a('0x14a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'foreignKey':'IntervalId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x89')]['hasMany'](db[_0xbe2a('0x44')],{'as':_0xbe2a('0x1a6'),'foreignKey':'IntervalId'});db[_0xbe2a('0x89')]['hasMany'](db['ChatApplication'],{'as':_0xbe2a('0x1a7'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db[_0xbe2a('0x4d')],{'as':_0xbe2a('0x1a8'),'foreignKey':'IntervalId'});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x91')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{});db[_0xbe2a('0x91')][_0xbe2a('0x147')](db[_0xbe2a('0xa4')],{'foreignKey':_0xbe2a('0x1a9')});db[_0xbe2a('0x91')]['belongsTo'](db[_0xbe2a('0xa2')],{'foreignKey':_0xbe2a('0x1aa')});db['Sound'][_0xbe2a('0x123')](db[_0xbe2a('0x1a')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xbe2a('0x15b')});db['Tag']['belongsToMany'](db[_0xbe2a('0x74')],{'through':'cm_contact_has_tags'});db['Tag'][_0xbe2a('0x123')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag'][_0xbe2a('0x123')](db['MailInteraction'],{'through':_0xbe2a('0x167')});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db[_0xbe2a('0x118')],{'through':'sms_interaction_has_tags'});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db['FaxInteraction'],{'through':_0xbe2a('0x178')});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db[_0xbe2a('0x116')],{'through':_0xbe2a('0x186')});db['Tag'][_0xbe2a('0x123')](db[_0xbe2a('0x11c')],{'through':_0xbe2a('0x1ab')});db[_0xbe2a('0x98')][_0xbe2a('0x147')](db[_0xbe2a('0x1ac')],{'as':_0xbe2a('0x1ad'),'foreignKey':_0xbe2a('0x1ae')});db[_0xbe2a('0x199')][_0xbe2a('0x147')](db[_0xbe2a('0x76')],{'as':_0xbe2a('0x1af'),'foreignKey':_0xbe2a('0x19b')});db[_0xbe2a('0x98')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x194')});db[_0xbe2a('0x9b')][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x1b0'),'singular':_0xbe2a('0x1b1')},'foreignKey':_0xbe2a('0x1b2'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['Trigger'][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x1b3'),'singular':_0xbe2a('0x1b4')},'foreignKey':_0xbe2a('0x1b5'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xbe2a('0x1a2')],{'as':_0xbe2a('0x1a3'),'foreignKey':_0xbe2a('0x1b6'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1aa'),'hooks':!![]});db[_0xbe2a('0xa4')][_0xbe2a('0x113')](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1a9')});db[_0xbe2a('0xa5')][_0xbe2a('0x113')](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xbe2a('0x1b8')});db['SalesforceAccount'][_0xbe2a('0x113')](db[_0xbe2a('0x1b9')],{'as':'Configurations','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1b9')][_0xbe2a('0x113')](db[_0xbe2a('0x1bb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1b9')]['hasMany'](db[_0xbe2a('0x1bb')],{'as':_0xbe2a('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xbe2a('0x113')](db['SalesforceField'],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1b9')][_0xbe2a('0x147')](db[_0xbe2a('0x1bf')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1bb')][_0xbe2a('0x113')](db[_0xbe2a('0x1bb')],{'as':'Subject','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1bb')]['hasMany'](db[_0xbe2a('0x1bb')],{'as':'Description','foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0x1bb')][_0xbe2a('0x113')](db['SalesforceField'],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1bb')]['belongsTo'](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xac')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1ba')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xbe2a('0x1c3'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xae')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xae')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xae')]['belongsTo'](db[_0xbe2a('0xac')],{'as':'Account','foreignKey':'AccountId'});db[_0xbe2a('0xb0')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb0')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['SugarcrmField'][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb0')]['belongsTo'](db['Variable'],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0x1c6')][_0xbe2a('0x113')](db[_0xbe2a('0xb3')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db['DeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb3')][_0xbe2a('0x113')](db['DeskField'],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db['DeskConfiguration']['hasMany'](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb3')][_0xbe2a('0x147')](db[_0xbe2a('0x1c6')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xb3')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1c7')});db[_0xbe2a('0xb5')][_0xbe2a('0x113')](db['DeskField'],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb5')][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['DeskField'][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb5')]['belongsTo'](db['Variable'],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xbe2a('0x113')](db[_0xbe2a('0x1c9')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db['ZohoConfiguration']['hasMany'](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1c3'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db['ZohoConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0x1c9')][_0xbe2a('0x113')](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1c9')][_0xbe2a('0x147')](db[_0xbe2a('0xb6')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xb7')][_0xbe2a('0x113')](db['ZohoField'],{'as':_0xbe2a('0x1c4'),'foreignKey':'SubjectId'});db[_0xbe2a('0xb7')]['hasMany'](db[_0xbe2a('0xb7')],{'as':'Description','foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0xb7')][_0xbe2a('0x113')](db['ZohoField'],{'as':_0xbe2a('0x1c8'),'foreignKey':'FieldId'});db[_0xbe2a('0xb7')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db[_0xbe2a('0xb9')]['hasMany'](db[_0xbe2a('0x1ca')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ca')][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db['ZendeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':_0xbe2a('0x1bd'),'foreignKey':_0xbe2a('0x1c0')});db['ZendeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':'Fields','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1ca')][_0xbe2a('0x147')](db[_0xbe2a('0xb9')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ca')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1cb')});db[_0xbe2a('0xba')]['hasMany'](db['ZendeskField'],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xba')][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['ZendeskField'][_0xbe2a('0x113')](db['ZendeskField'],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xba')]['belongsTo'](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xbe2a('0x113')](db[_0xbe2a('0xbe')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xbe')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c3'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xbe')]['hasMany'](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xbe')][_0xbe2a('0x147')](db[_0xbe2a('0xbc')],{'as':_0xbe2a('0x164'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1cc')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db['FreshdeskField'],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xbf')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':'Variable','foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xc1')]['hasMany'](db[_0xbe2a('0xc3')],{'as':'Configurations','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xc3')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc3')]['hasMany'](db[_0xbe2a('0xc5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xbe2a('0xc3')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':_0xbe2a('0x1b7'),'foreignKey':_0xbe2a('0x1be')});db['VtigerConfiguration'][_0xbe2a('0x147')](db[_0xbe2a('0xc1')],{'as':'Account','foreignKey':'AccountId'});db['VtigerField']['hasMany'](db[_0xbe2a('0xc5')],{'as':'Subject','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc5')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['VtigerField'][_0xbe2a('0x113')](db['VtigerField'],{'as':_0xbe2a('0x1c8'),'foreignKey':'FieldId'});db['VtigerField'][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xc7')][_0xbe2a('0x113')](db['ServicenowConfiguration'],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc8')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1bd'),'foreignKey':_0xbe2a('0x1c0')});db['ServicenowConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1b7'),'foreignKey':'FieldId'});db[_0xbe2a('0xc8')][_0xbe2a('0x147')](db[_0xbe2a('0xc7')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db['ServicenowField'],{'as':_0xbe2a('0x1c5'),'foreignKey':'DescriptionId'});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1cd')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db['Dynamics365Account'][_0xbe2a('0x113')](db[_0xbe2a('0xcb')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xca')][_0xbe2a('0x147')](db[_0xbe2a('0x105')],{'as':'CloudProvider','foreignKey':_0xbe2a('0x15a')});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db['Dynamics365Field'],{'as':_0xbe2a('0x1c3'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':'Descriptions','onDelete':_0xbe2a('0x110'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xcb')][_0xbe2a('0x147')](db[_0xbe2a('0xca')],{'as':'Account','foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':_0xbe2a('0x1c5'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xcd')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db[_0xbe2a('0xce')][_0xbe2a('0x113')](db[_0xbe2a('0x1ce')],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ce')][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c3'),'foreignKey':'SubjectId'});db[_0xbe2a('0x1ce')]['hasMany'](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1bd'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xbe2a('0x113')](db['FreshsalesField'],{'as':_0xbe2a('0x1b7'),'foreignKey':'FieldId'});db[_0xbe2a('0x1ce')][_0xbe2a('0x147')](db[_0xbe2a('0xce')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xd1')][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db['FreshsalesField'][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['FreshsalesField'][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db['FreshsalesField'][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db['ChatQueueReport']['belongsTo'](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0x189')],{});db[_0xbe2a('0xd3')]['belongsTo'](db['User'],{});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db[_0xbe2a('0x6d')],{});db[_0xbe2a('0xd4')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1cf')});db['ChatInternalMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':'cascade','foreignKey':_0xbe2a('0x1d0')});db[_0xbe2a('0xd7')][_0xbe2a('0x113')](db[_0xbe2a('0x1d1')],{'foreignKey':_0xbe2a('0x1d2'),'onDelete':'cascade'});db[_0xbe2a('0xd7')][_0xbe2a('0x113')](db[_0xbe2a('0x1d3')],{'foreignKey':_0xbe2a('0x1d2'),'onDelete':'cascade'});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{});db['SmsQueueReport'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xd8')]['belongsTo'](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db['SmsInteraction'],{});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x5a')],{});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db['SmsQueueReport']['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0xbe2a('0x113')](db['JscriptySessionReport'],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xdc')]['hasMany'](db[_0xbe2a('0x1d1')],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xdc')][_0xbe2a('0x113')](db[_0xbe2a('0x1d3')],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x124')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x12b')],{'through':_0xbe2a('0x107'),'as':_0xbe2a('0x12c')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x3d')],{'through':_0xbe2a('0x1d5'),'as':_0xbe2a('0x12f')});db[_0xbe2a('0xe3')]['belongsToMany'](db[_0xbe2a('0x6d')],{'through':_0xbe2a('0x18f'),'as':'ChatQueues'});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x52')],{'through':_0xbe2a('0x1d6'),'as':_0xbe2a('0x1d7')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db['SmsQueue'],{'through':_0xbe2a('0x181'),'as':_0xbe2a('0x132')});db[_0xbe2a('0xe3')]['belongsToMany'](db[_0xbe2a('0x133')],{'through':_0xbe2a('0x187'),'as':_0xbe2a('0x134')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x135')],{'through':_0xbe2a('0x1d8'),'as':_0xbe2a('0x1d9')});db['Team'][_0xbe2a('0x123')](db[_0xbe2a('0x12d')],{'through':'TeamVoicePrefix','as':_0xbe2a('0x12e')});db['Campaign'][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')][_0xbe2a('0x113')](db[_0xbe2a('0x7a')],{'as':'HopperFinals','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')]['hasMany'](db[_0xbe2a('0x7b')],{'as':_0xbe2a('0x196'),'foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')]['hasMany'](db[_0xbe2a('0x78')],{'as':'HopperBlacks','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a'),'foreignKey':_0xbe2a('0x148')});db['Campaign'][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x149'),'foreignKey':_0xbe2a('0x1db')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0xbe2a('0x89'),'foreignKey':'IntervalId'});db[_0xbe2a('0xe7')][_0xbe2a('0x147')](db['SquareProject'],{'as':_0xbe2a('0x1dc'),'foreignKey':_0xbe2a('0x1dd')});db['Campaign'][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x14d'),'through':'campaigns_has_cm_lists'});db[_0xbe2a('0xe7')][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x150'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0xbe2a('0x147')](db[_0xbe2a('0x16f')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x42')],{});db['MailTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db['MailAccount'],{'foreignKey':_0xbe2a('0x1de'),'as':_0xbe2a('0x1df')});db['MailTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db['MailTransferReport'][_0xbe2a('0x147')](db['MailQueue'],{'foreignKey':_0xbe2a('0x1e4'),'as':'ToQueue'});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'foreignKey':_0xbe2a('0x1e5'),'as':'ToAccount'});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x189')],{});db[_0xbe2a('0xee')]['belongsTo'](db[_0xbe2a('0x6a')],{});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'foreignKey':_0xbe2a('0x1e6'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db[_0xbe2a('0xee')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db['ChatTransferReport'][_0xbe2a('0x147')](db['ChatQueue'],{'foreignKey':_0xbe2a('0x1e7'),'as':_0xbe2a('0x1e8')});db['ChatTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'foreignKey':'ToChatWebsiteId','as':_0xbe2a('0x1e9')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x50')],{});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{});db['FaxTransferReport']['belongsTo'](db[_0xbe2a('0x4b')],{'foreignKey':_0xbe2a('0x1eb'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0x1ea')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x52')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db['FaxAccount'],{'foreignKey':_0xbe2a('0x1ec'),'as':'ToAccount'});db[_0xbe2a('0xf1')]['belongsTo'](db[_0xbe2a('0x62')],{});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db['OpenchannelInteraction'],{});db[_0xbe2a('0xf1')]['belongsTo'](db[_0xbe2a('0x5e')],{'foreignKey':_0xbe2a('0x1ed'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':'ToAgent'});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x133')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbe2a('0x1e8')});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':_0xbe2a('0x1e9')});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db['SmsMessage'],{});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x118')],{});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0xf2')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0xbe2a('0x5c')],{'foreignKey':'ToSmsQueueId','as':_0xbe2a('0x1e8')});db['SmsTransferReport']['belongsTo'](db[_0xbe2a('0x55')],{'foreignKey':_0xbe2a('0x1ee'),'as':_0xbe2a('0x1e9')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x173'),'onDelete':'cascade'});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmContact'],{'as':_0xbe2a('0x1ef'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x173')});db['CmList'][_0xbe2a('0x113')](db['CmHopperHistory'],{'as':_0xbe2a('0x1f0'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')]['belongsToMany'](db[_0xbe2a('0x12b')],{'as':_0xbe2a('0x1f1'),'through':'voice_queues_has_cm_lists'});db[_0xbe2a('0xf4')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'onDelete':'cascade'});db[_0xbe2a('0x12d')][_0xbe2a('0x123')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xbe2a('0x12d')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x1f2'),'as':'Teams'});db[_0xbe2a('0xf7')][_0xbe2a('0x113')](db['User'],{'as':'Users','foreignKey':_0xbe2a('0x11f')});db['UserProfile'][_0xbe2a('0x113')](db[_0xbe2a('0xf8')],{'as':_0xbe2a('0x1f3'),'foreignKey':'userProfileId','onDelete':_0xbe2a('0x110')});db['UserProfileSection'][_0xbe2a('0x113')](db[_0xbe2a('0x1f4')],{'as':_0xbe2a('0x1f5'),'foreignKey':_0xbe2a('0x1f6'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':'Dispositions','foreignKey':_0xbe2a('0x1f7'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0xfb')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbe2a('0x1f7')});db[_0xbe2a('0xfb')]['hasMany'](db[_0xbe2a('0x100')],{'as':_0xbe2a('0x152'),'foreignKey':'WhatsappAccountId'});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0x11c')],{'as':'Interactions'});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0xfd')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x1f7'),'onDelete':'cascade'});db['WhatsappAccount'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xfb')][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0xfb')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':'user_has_whatsapp_accounts'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0xfd')]['belongsTo'](db[_0xbe2a('0x135')],{'onDelete':'restrict'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x11c')]['hasMany'](db[_0xbe2a('0x100')],{'as':'Messages','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1f8')});db[_0xbe2a('0x11c')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1f7')});db['WhatsappInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x11c')]['belongsTo'](db['User'],{'as':_0xbe2a('0x166'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xbe2a('0x95')],{'through':'whatsapp_interaction_has_tags','as':_0xbe2a('0x168')});db[_0xbe2a('0x11c')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1ab'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x11c')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x12a'),'foreignKey':_0xbe2a('0x1f8')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db['WhatsappInteraction'],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x1f8')});db['WhatsappMessage'][_0xbe2a('0x147')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xbe2a('0x1f7')});db[_0xbe2a('0x102')]['belongsTo'](db[_0xbe2a('0xfb')],{});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0x11c')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xbe2a('0x135')],{});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0x100')],{});db['WhatsappQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0x100')],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db['WhatsappInteraction'],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'foreignKey':_0xbe2a('0x1f9'),'as':_0xbe2a('0x1df')});db['WhatsappTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'foreignKey':_0xbe2a('0x1fa'),'as':_0xbe2a('0x1e9')});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0x135')],{'foreignKey':'ToQueueId','as':_0xbe2a('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xbe2a('0x135')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x136'),'foreignKey':_0xbe2a('0x1fb')});db[_0xbe2a('0x135')][_0xbe2a('0x123')](db['Team'],{'through':_0xbe2a('0x1d8'),'as':'Teams'});db[_0xbe2a('0x10c')]['belongsTo'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x1fc'),'foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db[_0xbe2a('0xca')],{'as':_0xbe2a('0xca'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db['MailServerIn'],{'as':'Imap','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db[_0xbe2a('0x3a')],{'as':'Smtp','onDelete':'restrict'});module[_0xbe2a('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa647=['../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','VoiceMail','UserSetting','userSetting','cascade','hasMany','Recordings','UserId','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','Contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','MailQueue','MailQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','CmList','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','JscriptySessions','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Dispositions','Answers','Applications','ListId','TemplateId','Agents','team_has_mail_queues','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','List','Items','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','CmCompany','CompanyId','CmContactId','HopperHistories','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','Condition','OneAll','Any','OneAny','Automation','Actions','MailApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','ItemTypeId','Hopper','AllConditions','AllCondition','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmAccount','Descriptions','Field','int_desk_configuration_has_tags','ZohoField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_chat_queues','ChatQueues','team_has_fax_queues','team_has_whatsapp_queues','VoicePrefixes','HopperFinals','HopperBlacks','TrunkBackup','TrunkBackupId','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToQueueId','user','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','xcall','utf8mb4','database','password','sequelizeHistory','options','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','Pause','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../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','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign'];(function(_0x1156af,_0x302fce){var _0x6722f9=function(_0x265070){while(--_0x265070){_0x1156af['push'](_0x1156af['shift']());}};_0x6722f9(++_0x302fce);}(_0xa647,0x11a));var _0x7a64=function(_0x5078f4,_0x78597){_0x5078f4=_0x5078f4-0x0;var _0x57698b=_0xa647[_0x5078f4];return _0x57698b;};'use strict';var config=require(_0x7a64('0x0'));var Sequelize=require(_0x7a64('0x1'));var _=require(_0x7a64('0x2'));var jstz=require(_0x7a64('0x3'));var timezone=jstz[_0x7a64('0x4')]();config[_0x7a64('0x1')]=_[_0x7a64('0x5')](config['sequelize'],{'database':_0x7a64('0x6'),'username':'xcall','password':_0x7a64('0x7'),'options':{'host':_0x7a64('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x7a64('0x9')](),'define':{'charset':_0x7a64('0xa'),'collate':_0x7a64('0xb')}}});config['sequelizeHistory']=_[_0x7a64('0x5')](config['sequelizeHistory'],{'database':_0x7a64('0x6'),'username':_0x7a64('0xc'),'password':_0x7a64('0x7'),'options':{'host':_0x7a64('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7a64('0xd')},'logging':![],'timezone':timezone[_0x7a64('0x9')](),'define':{'charset':_0x7a64('0xa'),'collate':_0x7a64('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7a64('0x1')][_0x7a64('0xe')],config['sequelize']['username'],config[_0x7a64('0x1')][_0x7a64('0xf')],config[_0x7a64('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7a64('0x10')]['database'],config[_0x7a64('0x10')]['username'],config[_0x7a64('0x10')][_0x7a64('0xf')],config[_0x7a64('0x10')][_0x7a64('0x11')])};db['User']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x13'));db['VoiceChanSpy']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x14'));db[_0x7a64('0x15')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/voiceContext/voiceContext.model');db[_0x7a64('0x16')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x17'));db[_0x7a64('0x18')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x19'));db[_0x7a64('0x1a')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x7a64('0x1b')]=db[_0x7a64('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x1c'));db['VoiceMail']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x1d'));db[_0x7a64('0x1e')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x1f'));db[_0x7a64('0x20')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x21'));db[_0x7a64('0x22')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x23'));db[_0x7a64('0x24')]=db['sequelize'][_0x7a64('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x7a64('0x25')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x26'));db[_0x7a64('0x27')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x28'));db[_0x7a64('0x29')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x2a'));db[_0x7a64('0x2b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x2c'));db[_0x7a64('0x2d')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x2e'));db[_0x7a64('0x2f')]=db['sequelize']['import'](_0x7a64('0x30'));db[_0x7a64('0x31')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x7a64('0x32')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x33'));db['UserFaxQueue']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x34'));db[_0x7a64('0x35')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x36'));db['UserOpenchannelQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x37'));db[_0x7a64('0x38')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x39'));db[_0x7a64('0x3a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3b'));db['MailServerOut']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3c'));db[_0x7a64('0x3d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3e'));db['MailQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3f'));db[_0x7a64('0x40')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x41'));db[_0x7a64('0x42')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x43'));db[_0x7a64('0x44')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x45'));db[_0x7a64('0x46')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x47'));db[_0x7a64('0x48')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x49'));db[_0x7a64('0x4a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4b'));db['FaxAccount']=db[_0x7a64('0x1')]['import'](_0x7a64('0x4c'));db[_0x7a64('0x4d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4e'));db['FaxInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4f'));db[_0x7a64('0x50')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x51'));db['FaxQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x52'));db['FaxQueueReport']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x53'));db['SmsAccount']=db[_0x7a64('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x7a64('0x54')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsApplication/smsApplication.model');db[_0x7a64('0x55')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x56'));db[_0x7a64('0x57')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsMessage/smsMessage.model');db[_0x7a64('0x58')]=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db[_0x7a64('0x59')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5a'));db['OpenchannelApplication']=db[_0x7a64('0x1')]['import'](_0x7a64('0x5b'));db['OpenchannelInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5c'));db['OpenchannelMessage']=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x7a64('0x5d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5e'));db[_0x7a64('0x5f')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x60'));db[_0x7a64('0x61')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x62'));db[_0x7a64('0x63')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x64'));db[_0x7a64('0x65')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x66'));db['ChatMessage']=db['sequelize'][_0x7a64('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x7a64('0x67')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x68'));db[_0x7a64('0x69')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6a'));db[_0x7a64('0x6b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6c'));db['CmCompany']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6d'));db['CmContact']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6e'));db[_0x7a64('0x6f')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x70'));db[_0x7a64('0x71')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x72'));db[_0x7a64('0x73')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x74'));db['CmHopperHistory']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x75'));db[_0x7a64('0x76')]=db[_0x7a64('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x7a64('0x77')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x7a64('0x78')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x79'));db['Automation']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x7a'));db[_0x7a64('0x7b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x7c'));db[_0x7a64('0x7d')]=db['sequelize'][_0x7a64('0x12')]('../api/disposition/disposition.model');db['Condition']=db[_0x7a64('0x1')]['import'](_0x7a64('0x7e'));db[_0x7a64('0x7f')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/interval/interval.model');db[_0x7a64('0x80')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/pause/pause.model');db[_0x7a64('0x81')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/cdr/cdr.model');db[_0x7a64('0x82')]=db['sequelize']['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7a64('0x83')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x84'));db[_0x7a64('0x85')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x86'));db[_0x7a64('0x87')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x88'));db[_0x7a64('0x89')]=db['sequelize']['import'](_0x7a64('0x8a'));db[_0x7a64('0x8b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x8c'));db[_0x7a64('0x8d')]=db['sequelize']['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x7a64('0x8e')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/template/template.model');db[_0x7a64('0x8f')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x90'));db[_0x7a64('0x91')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x92'));db[_0x7a64('0x93')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x94'));db[_0x7a64('0x95')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x96'));db[_0x7a64('0x97')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x98'));db['AnalyticDefaultReport']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x99'));db[_0x7a64('0x9a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9b'));db[_0x7a64('0x9c')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9d'));db[_0x7a64('0x9e')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9f'));db['AnalyticTreeReport']=db['sequelize'][_0x7a64('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7a64('0xa0')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7a64('0xa1')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa2'));db[_0x7a64('0xa3')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa4'));db['SugarcrmAccount']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa5'));db[_0x7a64('0xa6')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xa7'));db[_0x7a64('0xa8')]=db['sequelize']['import'](_0x7a64('0xa9'));db[_0x7a64('0xaa')]=db[_0x7a64('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x7a64('0xab')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xac'));db[_0x7a64('0xad')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xae'));db[_0x7a64('0xaf')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb0'));db[_0x7a64('0xb1')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb2'));db['ZohoField']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xb3'));db[_0x7a64('0xb4')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb5'));db[_0x7a64('0xb6')]=db['sequelize']['import'](_0x7a64('0xb7'));db[_0x7a64('0xb8')]=db['sequelize']['import'](_0x7a64('0xb9'));db[_0x7a64('0xba')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xbb'));db[_0x7a64('0xbc')]=db['sequelize']['import'](_0x7a64('0xbd'));db[_0x7a64('0xbe')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xbf'));db[_0x7a64('0xc0')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xc1'));db[_0x7a64('0xc2')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7a64('0xc3')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xc4'));db[_0x7a64('0xc5')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xc6'));db[_0x7a64('0xc7')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7a64('0xc8')]=db['sequelize']['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x7a64('0x1')]['import'](_0x7a64('0xc9'));db['Dynamics365Configuration']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xca'));db['Dynamics365Field']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xcb'));db[_0x7a64('0xcc')]=db['sequelize']['import'](_0x7a64('0xcd'));db['FreshsalesConfiguration']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xce'));db[_0x7a64('0xcf')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xd0'));db[_0x7a64('0x93')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x94'));db['Network']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd1'));db[_0x7a64('0xd2')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd3'));db[_0x7a64('0xd4')]=db[_0x7a64('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd5'));db[_0x7a64('0xd6')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd7'));db[_0x7a64('0xd8')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xd9'));db[_0x7a64('0xda')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x7a64('0xdb')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xdc'));db['SquareDetailsReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xdd'));db[_0x7a64('0xde')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x7a64('0xdf')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe0'));db[_0x7a64('0xe1')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe2'));db[_0x7a64('0xe3')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe4'));db[_0x7a64('0xe5')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xe6'));db[_0x7a64('0xe7')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xe8'));db['Team']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe9'));db['License']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xea'));db[_0x7a64('0xeb')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xec'));db[_0x7a64('0xed')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xee'));db[_0x7a64('0xef')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xf0'));db['Plugin']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf1'));db[_0x7a64('0xf2')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf3'));db[_0x7a64('0xf4')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf5'));db['FaxTransferReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf6'));db['OpenchannelTransferReport']=db[_0x7a64('0x1')]['import'](_0x7a64('0xf7'));db['SmsTransferReport']=db[_0x7a64('0x1')]['import'](_0x7a64('0xf8'));db['CmList']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf9'));db[_0x7a64('0xfa')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xfb'));db[_0x7a64('0xfc')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x7a64('0xfd')]=db['sequelize']['import']('../api/userProfileSection/userProfileSection.model');db[_0x7a64('0xfe')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xff'));db[_0x7a64('0x100')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x101'));db['WhatsappAccount']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x102'));db[_0x7a64('0x103')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x104'));db['WhatsappInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x105'));db[_0x7a64('0x106')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x107'));db[_0x7a64('0x108')]=db[_0x7a64('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x7a64('0x109')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x10a'));db['WhatsappQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x10b'));db[_0x7a64('0x10c')]=db['sequelize']['import'](_0x7a64('0x10d'));db[_0x7a64('0x10e')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x10f'));db[_0x7a64('0x110')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x111'));db[_0x7a64('0x112')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x113'));db['UserSetting']=db['sequelize']['import'](_0x7a64('0x114'));db['MailInteractionHasTag']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x115'));db[_0x7a64('0x116')][_0x7a64('0x117')](db[_0x7a64('0x118')],{'as':_0x7a64('0x118'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x117')](db[_0x7a64('0x119')],{'as':_0x7a64('0x11a'),'onDelete':_0x7a64('0x11b'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['VoiceRecording'],{'as':_0x7a64('0x11d'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['UserVoiceQueueRt'],{'as':_0x7a64('0x11f'),'foreignKey':_0x7a64('0x11e')});db['User'][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x73')],{'as':'HopperFinals','foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x121')],{'as':_0x7a64('0x122'),'foreignKey':_0x7a64('0x11e')});db['User'][_0x7a64('0x11c')](db['ReportAgentPreview'],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['OpenchannelInteraction'],{'as':_0x7a64('0x123'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['ChatInteraction'],{'as':_0x7a64('0x124'),'foreignKey':'UserId'});db[_0x7a64('0x116')]['hasMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['FaxInteraction'],{'as':_0x7a64('0x126'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')]['hasMany'](db[_0x7a64('0x127')],{'as':_0x7a64('0x128'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x129')],{'as':_0x7a64('0x12a'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x100')],{'as':'UserNotifications','foreignKey':_0x7a64('0x12b')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['CmHopper'],{'as':_0x7a64('0x12c'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x7a64('0x116')][_0x7a64('0x12d')](db[_0x7a64('0xfc')],{'as':_0x7a64('0xfc'),'foreignKey':_0x7a64('0x12e')});db['User'][_0x7a64('0x12f')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['CmContact'],{'as':_0x7a64('0x130'),'through':'cm_user_has_contacts'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x131'),'through':_0x7a64('0x132')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x133')],{'through':_0x7a64('0x134')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x127')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x65')],{'as':_0x7a64('0x124'),'through':_0x7a64('0x135')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x136')],{'as':_0x7a64('0x126'),'through':_0x7a64('0x137')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'through':_0x7a64('0x138')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x139')],{'as':'OpenchannelInteractions','through':_0x7a64('0x13a')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x129')],{'as':_0x7a64('0x12a'),'through':'user_has_whatsapp_interactions'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x7a64('0x2f'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0xfa')],{'as':'VoicePrefixes','through':_0x7a64('0x112'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x13b')],{'as':_0x7a64('0x13c'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x7a64('0x67')],{'as':'ChatQueues','through':_0x7a64('0x31'),'required':![],'hooks':!![]});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x13d')],{'as':_0x7a64('0x13e'),'through':_0x7a64('0x13f'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x58')],{'as':_0x7a64('0x140'),'through':'UserSmsQueue','required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x5d')],{'as':_0x7a64('0x141'),'through':_0x7a64('0x142'),'required':![]});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x143')],{'as':_0x7a64('0x144'),'through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x7a64('0x145')],{'through':'cm_user_has_lists'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x5f')],{'as':'ChatWebsites','through':_0x7a64('0x146')});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x147')],{'as':_0x7a64('0x148'),'through':_0x7a64('0x149')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x14a'),'through':_0x7a64('0x14b')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['OpenchannelAccount'],{'as':_0x7a64('0x14c'),'through':'user_has_openchannel_accounts'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x14d')],{'as':_0x7a64('0x14e'),'through':_0x7a64('0x14f')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x150')],{'as':_0x7a64('0x151'),'through':_0x7a64('0x152')});db[_0x7a64('0x153')][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x154'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x155')});db[_0x7a64('0x15')][_0x7a64('0x11c')](db['VoiceExtension'],{'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x16')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db[_0x7a64('0x18')][_0x7a64('0x12f')](db[_0x7a64('0x85')],{'as':_0x7a64('0x156'),'through':_0x7a64('0x157')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x2d')],{'as':_0x7a64('0x158'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x12c'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x73')],{'as':'HopperFinals','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')]['hasMany'](db[_0x7a64('0x121')],{'as':'HopperHistories','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db['ReportAgentPreview'],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x159')});db['VoiceQueue'][_0x7a64('0x11c')](db[_0x7a64('0x71')],{'as':'HopperBlacks','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'as':_0x7a64('0x15a'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29'),'foreignKey':_0x7a64('0x15b')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'as':'Interval','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db['Pause'],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x131'),'through':_0x7a64('0x15f')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['User'],{'as':'Agents','through':'UserVoiceQueue'});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'as':_0x7a64('0x160'),'through':_0x7a64('0x10e')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['CmList'],{'as':'BlackLists','through':_0x7a64('0x161')});db[_0x7a64('0x1b')]['belongsTo'](db['User'],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db['ScreenRecording'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x118')][_0x7a64('0x11c')](db[_0x7a64('0x1e')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x163'),'sourceKey':_0x7a64('0x164')});db[_0x7a64('0x1e')][_0x7a64('0x12d')](db['VoiceMail'],{'foreignKey':_0x7a64('0x163'),'targetKey':_0x7a64('0x164')});db[_0x7a64('0x20')]['hasMany'](db[_0x7a64('0x25')],{'as':_0x7a64('0x165'),'foreignKey':_0x7a64('0x166'),'constraints':![]});db[_0x7a64('0x20')]['hasMany'](db[_0x7a64('0x24')],{'as':_0x7a64('0x167'),'foreignKey':_0x7a64('0x166'),'constraints':![]});db['VoiceCallReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x20')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x3a')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x3a')][_0x7a64('0x12d')](db[_0x7a64('0x10c')],{'as':_0x7a64('0x10c'),'foreignKey':_0x7a64('0x16c'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x16e')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x16e')][_0x7a64('0x12d')](db[_0x7a64('0x10c')],{'as':'CloudProvider','foreignKey':_0x7a64('0x16c'),'onDelete':_0x7a64('0x16d')});db['MailAccount']['hasOne'](db[_0x7a64('0x3a')],{'as':_0x7a64('0x16f'),'onDelete':'cascade'});db[_0x7a64('0x3d')][_0x7a64('0x117')](db[_0x7a64('0x16e')],{'as':'Smtp','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':'MailAccountId','onDelete':_0x7a64('0x11b')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':_0x7a64('0x171'),'foreignKey':'MailAccountId'});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x42')],{'as':'Messages','foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x127')],{'as':'Interactions'});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db['MailApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x16b'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x3d')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0x3d')][_0x7a64('0x12d')](db[_0x7a64('0x8e')],{'as':_0x7a64('0x8e'),'foreignKey':_0x7a64('0x174')});db['MailAccount'][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db['MailAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x7a64('0x14b')});db['MailQueue']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x32')});db[_0x7a64('0x13b')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x176'),'as':_0x7a64('0x160')});db[_0x7a64('0x127')][_0x7a64('0x11c')](db[_0x7a64('0x42')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x7a64('0x127')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x127')][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x127')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db['MailInteraction'][_0x7a64('0x12f')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x7a64('0x179')});db[_0x7a64('0x127')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x17a'),'as':_0x7a64('0x17b')});db['MailInteraction']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x17d'),'foreignKey':_0x7a64('0x17e')});db[_0x7a64('0x42')][_0x7a64('0x11c')](db[_0x7a64('0xef')],{'as':_0x7a64('0x17f'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x127')],{'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x17e')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db['MailAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x5f'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db['ChatOfflineMessage'],{'as':_0x7a64('0x182'),'foreignKey':_0x7a64('0x183')});db['MailApplication'][_0x7a64('0x12d')](db['User'],{'onDelete':_0x7a64('0x16d')});db['MailApplication'][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{'onDelete':_0x7a64('0x16d')});db['MailApplication']['belongsTo'](db[_0x7a64('0x3d')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x44')]['belongsTo'](db['Interval'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x15c')});db['MailApplication'][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{});db[_0x7a64('0x46')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x46')][_0x7a64('0x12d')](db[_0x7a64('0x127')],{});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x42')],{});db[_0x7a64('0x46')]['belongsTo'](db[_0x7a64('0x116')],{});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{});db['Dashboard'][_0x7a64('0x11c')](db[_0x7a64('0x4a')],{'as':_0x7a64('0x186'),'onDelete':'cascade'});db[_0x7a64('0x147')][_0x7a64('0x11c')](db['Disposition'],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x187'),'onDelete':_0x7a64('0x11b')});db['FaxAccount'][_0x7a64('0x11c')](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x187')});db[_0x7a64('0x147')]['hasMany'](db['FaxInteraction'],{'as':_0x7a64('0x188')});db['FaxAccount'][_0x7a64('0x11c')](db['FaxApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x187'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x147')][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x189'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x147')][_0x7a64('0x11c')](db['FaxMessage'],{'as':_0x7a64('0x162')});db[_0x7a64('0x147')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29')});db['FaxAccount'][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':'ListId'});db[_0x7a64('0x147')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7a64('0x147')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x149')});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{'onDelete':'restrict'});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db['FaxAccount'],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x4d')]['belongsTo'](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db[_0x7a64('0x136')][_0x7a64('0x11c')](db['FaxMessage'],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x18a')});db['FaxInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x7a64('0x136')]['belongsTo'](db[_0x7a64('0x168')],{'as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x136')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x18b'),'as':_0x7a64('0x179')});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x18b'),'as':_0x7a64('0x17b')});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Users','through':_0x7a64('0x137'),'foreignKey':_0x7a64('0x18a')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':'cascade','as':_0x7a64('0x116')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x136')],{'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x18a')});db['FaxMessage'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0xef')],{'as':_0x7a64('0xef'),'foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x187')});db['FaxQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x13f')});db[_0x7a64('0x13d')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':'team_has_fax_queues','as':_0x7a64('0x160')});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{});db[_0x7a64('0x18d')]['belongsTo'](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x136')],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db['FaxMessage'],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db['User'],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['Disposition'],{'as':_0x7a64('0x170'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['CannedAnswer'],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x18e')});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db[_0x7a64('0x57')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x18e')});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['SmsInteraction'],{'as':'Interactions'});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['SmsApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x18e'),'onDelete':_0x7a64('0x11b')});db['SmsAccount'][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0x14d')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db['SmsAccount'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x14f')});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x58')],{'onDelete':'restrict'});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'onDelete':_0x7a64('0x16d')});db['SmsApplication'][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'onDelete':'restrict','foreignKey':_0x7a64('0x15c')});db['SmsApplication'][_0x7a64('0x12d')](db['Tag'],{'onDelete':_0x7a64('0x16d'),'foreignKey':'TagId'});db['SmsInteraction'][_0x7a64('0x11c')](db[_0x7a64('0x57')],{'as':_0x7a64('0x162'),'onDelete':'cascade','foreignKey':_0x7a64('0x18f')});db[_0x7a64('0x55')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'as':'Account','foreignKey':_0x7a64('0x18e')});db['SmsInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x55')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x190'),'as':_0x7a64('0x179')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x190'),'as':_0x7a64('0x17b')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x138'),'foreignKey':'SmsInteractionId'});db[_0x7a64('0x57')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x116')});db[_0x7a64('0x57')]['belongsTo'](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db['SmsMessage'][_0x7a64('0x12d')](db[_0x7a64('0x55')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x18f')});db['SmsMessage'][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x18e')});db['SmsQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x35'),'foreignKey':_0x7a64('0x191')});db[_0x7a64('0x58')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x192'),'as':_0x7a64('0x160')});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x193'),'onDelete':'cascade'});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x7a64('0x59')][_0x7a64('0x11c')](db['OpenchannelInteraction'],{'as':_0x7a64('0x188'),'foreignKey':_0x7a64('0x193')});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x194')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x193')});db['OpenchannelAccount'][_0x7a64('0x11c')](db[_0x7a64('0x195')],{'as':'Applications','foreignKey':_0x7a64('0x193'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x59')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x59')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x7a64('0x15e')});db[_0x7a64('0x59')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':'user_has_openchannel_accounts'});db[_0x7a64('0x195')]['belongsTo'](db[_0x7a64('0x116')],{'onDelete':'restrict'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{'onDelete':_0x7a64('0x16d'),'foreignKey':'OpenchannelQueueId'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db['OpenchannelAccount'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x193')});db[_0x7a64('0x195')]['belongsTo'](db[_0x7a64('0x7f')],{'onDelete':_0x7a64('0x16d'),'foreignKey':'IntervalId'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db[_0x7a64('0x139')][_0x7a64('0x11c')](db[_0x7a64('0x194')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x196')});db['OpenchannelInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x59')],{'as':_0x7a64('0x177'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db['OpenchannelInteraction']['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x139')]['belongsToMany'](db[_0x7a64('0x87')],{'through':_0x7a64('0x197'),'as':'Tags'});db[_0x7a64('0x139')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x197'),'as':_0x7a64('0x17b')});db[_0x7a64('0x139')]['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x13a'),'foreignKey':_0x7a64('0x196')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x116')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db['OpenchannelMessage'][_0x7a64('0x12d')](db[_0x7a64('0x139')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x196')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0xef')],{'as':_0x7a64('0xef'),'foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db['OpenchannelAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x193')});db['OpenchannelQueue']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x7a64('0x12f')](db['Team'],{'through':_0x7a64('0x198'),'as':'Teams'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x6b')],{'as':'ProactiveActions'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x65')],{'as':_0x7a64('0x188')});db['ChatWebsite'][_0x7a64('0x11c')](db[_0x7a64('0x63')],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x199')],{'as':'Messages'});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db['ChatWebsite'][_0x7a64('0x12d')](db['Interval'],{'as':'Interval','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db['MailAccount'],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7a64('0x5f')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x146')});db[_0x7a64('0x61')]['belongsTo'](db[_0x7a64('0x59')],{});db[_0x7a64('0x61')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x61')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x61')][_0x7a64('0x12d')](db['OpenchannelInteraction'],{});db[_0x7a64('0x61')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x7a64('0x61')][_0x7a64('0x12d')](db['User'],{});db['OpenchannelQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{});db[_0x7a64('0x63')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x19a'),'foreignKey':_0x7a64('0x11e'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x63')]['belongsTo'](db[_0x7a64('0x67')],{'as':_0x7a64('0x19b'),'foreignKey':_0x7a64('0x19c'),'onDelete':'restrict'});db[_0x7a64('0x63')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x19d'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x63')][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x19e')});db[_0x7a64('0x65')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x177'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x65')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x65')][_0x7a64('0x12f')](db['Tag'],{'through':_0x7a64('0x19f'),'as':'Tags'});db[_0x7a64('0x65')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0x7a64('0x65')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x135'),'foreignKey':_0x7a64('0x19e')});db[_0x7a64('0x199')]['belongsTo'](db[_0x7a64('0x116')],{'onDelete':'cascade','as':'User'});db[_0x7a64('0x199')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x199')]['belongsTo'](db[_0x7a64('0x65')],{'onDelete':_0x7a64('0x11b'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x7a64('0x199')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x199')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x182')][_0x7a64('0x11c')](db[_0x7a64('0xef')],{'as':_0x7a64('0x17f'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x182')]['belongsTo'](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x182')][_0x7a64('0x12d')](db['ChatWebsite'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x67')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x31'),'hooks':!![]});db[_0x7a64('0x67')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':'team_has_chat_queues','as':_0x7a64('0x160')});db[_0x7a64('0x69')][_0x7a64('0x11c')](db[_0x7a64('0xd4')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x1a0'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x69')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x158'),'through':_0x7a64('0x1a1')});db[_0x7a64('0x6b')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x19d'),'foreignKey':'ChatWebsiteId'});db[_0x7a64('0x1a2')][_0x7a64('0x11c')](db[_0x7a64('0x168')],{'as':_0x7a64('0x130'),'foreignKey':_0x7a64('0x1a3')});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x7a64('0x1a4')});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x12c'),'foreignKey':'ContactId'});db['CmContact'][_0x7a64('0x11c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x121')],{'as':_0x7a64('0x1a5'),'foreignKey':_0x7a64('0x16a')});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x76')],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'as':_0x7a64('0x15a'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x139')],{'as':_0x7a64('0x123'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x65')],{'as':_0x7a64('0x124'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')]['hasMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x136')],{'as':_0x7a64('0x126'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7a64('0x168')][_0x7a64('0x11c')](db['MailInteraction'],{'as':_0x7a64('0x128'),'foreignKey':'ContactId','onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x12d')](db[_0x7a64('0x1a2')],{'as':'Company','foreignKey':_0x7a64('0x1a3')});db[_0x7a64('0x168')]['belongsTo'](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x168')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x17c'),'through':'cm_user_has_contacts'});db['CmContact'][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'as':_0x7a64('0x179'),'through':_0x7a64('0x1a6')});db[_0x7a64('0x168')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x1a6'),'as':_0x7a64('0x17b')});db[_0x7a64('0x6f')][_0x7a64('0x11c')](db[_0x7a64('0x8d')],{'as':_0x7a64('0x1a7'),'foreignKey':_0x7a64('0x1a8')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x6f')]['belongsTo'](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':'ListId','onDelete':_0x7a64('0x11b')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':'Agent','foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x6f')]['belongsTo'](db[_0x7a64('0x1a')],{'as':'Queue','foreignKey':_0x7a64('0x159'),'onDelete':_0x7a64('0x11b')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0xeb')],{'as':_0x7a64('0xeb'),'foreignKey':'CampaignId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x6f')][_0x7a64('0x12d')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0x7a64('0x71')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x7a64('0x159'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db[_0x7a64('0xeb')],{'as':_0x7a64('0xeb'),'foreignKey':_0x7a64('0x1a9'),'onDelete':_0x7a64('0x11b')});db['Automation']['hasMany'](db[_0x7a64('0x1aa')],{'as':{'plural':'All','singular':_0x7a64('0x1ab')},'foreignKey':'AutomationAllId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db['Automation'][_0x7a64('0x11c')](db['Condition'],{'as':{'plural':_0x7a64('0x1ac'),'singular':_0x7a64('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x7a64('0x1ae')][_0x7a64('0x11c')](db[_0x7a64('0x78')],{'as':_0x7a64('0x1af'),'foreignKey':'AutomationId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x7d')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':'ParentId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x7f')][_0x7a64('0x11c')](db['Interval'],{'as':'Intervals','foreignKey':_0x7a64('0x15c'),'onDelete':_0x7a64('0x11b'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'foreignKey':'IntervalId','onDelete':_0x7a64('0x16d')});db['Interval']['hasMany'](db[_0x7a64('0x44')],{'as':_0x7a64('0x1b0'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x7f')][_0x7a64('0x11c')](db[_0x7a64('0x63')],{'as':'ChatApplications','foreignKey':_0x7a64('0x15c')});db['Interval'][_0x7a64('0x11c')](db[_0x7a64('0x4d')],{'as':_0x7a64('0x1b1'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x7f')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x83')]['belongsTo'](db['MailAccount'],{});db[_0x7a64('0x83')][_0x7a64('0x12d')](db[_0x7a64('0x1b2')],{'foreignKey':_0x7a64('0x1b3')});db[_0x7a64('0x83')][_0x7a64('0x12d')](db[_0x7a64('0x97')],{'foreignKey':_0x7a64('0x1b4')});db[_0x7a64('0x85')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x7a64('0x16d')});db['Tag'][_0x7a64('0x12f')](db[_0x7a64('0x168')],{'through':_0x7a64('0x1a6')});db[_0x7a64('0x87')]['belongsToMany'](db['ChatInteraction'],{'through':_0x7a64('0x19f')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x55')],{'through':_0x7a64('0x190')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x136')],{'through':_0x7a64('0x18b')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x139')],{'through':_0x7a64('0x197')});db['Tag'][_0x7a64('0x12f')](db[_0x7a64('0x129')],{'through':'whatsapp_interaction_has_tags'});db[_0x7a64('0x8b')][_0x7a64('0x12d')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x7a64('0x1b5')});db['CmHopperAdditionalPhone'][_0x7a64('0x12d')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x1b6'),'foreignKey':'CmHopperId'});db[_0x7a64('0x8b')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x1a4')});db['Trigger'][_0x7a64('0x11c')](db[_0x7a64('0x1aa')],{'as':{'plural':_0x7a64('0x1b7'),'singular':_0x7a64('0x1b8')},'foreignKey':'TriggerAllId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db['Trigger'][_0x7a64('0x11c')](db[_0x7a64('0x1aa')],{'as':{'plural':'AnyConditions','singular':_0x7a64('0x1b9')},'foreignKey':_0x7a64('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0x7a64('0x8f')][_0x7a64('0x11c')](db['Action'],{'as':_0x7a64('0x1af'),'foreignKey':_0x7a64('0x1bb'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x97')][_0x7a64('0x11c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7a64('0x1b4'),'hooks':!![]});db[_0x7a64('0x1b2')][_0x7a64('0x11c')](db[_0x7a64('0x9e')],{'as':_0x7a64('0x1bc'),'onDelete':'cascade','foreignKey':_0x7a64('0x1b3')});db[_0x7a64('0x9c')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bd')});db[_0x7a64('0x9e')][_0x7a64('0x12d')](db[_0x7a64('0x9c')],{'foreignKey':_0x7a64('0x1bd')});db[_0x7a64('0xa0')][_0x7a64('0x11c')](db['SalesforceConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db['SalesforceConfiguration'][_0x7a64('0x11c')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7a64('0xa1')]['hasMany'](db[_0x7a64('0xa3')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa3')]['hasMany'](db['SalesforceField'],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db['SalesforceField'][_0x7a64('0x11c')](db[_0x7a64('0xa3')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xa3')][_0x7a64('0x11c')](db[_0x7a64('0xa3')],{'as':'Field','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xa3')][_0x7a64('0x12d')](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0x1c7')]['hasMany'](db[_0x7a64('0xa6')],{'as':'Configurations','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa6')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c1')});db['SugarcrmConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c8'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c5')});db['SugarcrmConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':'FieldId'});db[_0x7a64('0xa6')][_0x7a64('0x12d')](db[_0x7a64('0x1c7')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa8')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xa8')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':'Description','foreignKey':_0x7a64('0x1c5')});db['SugarcrmField'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xa8')]['belongsTo'](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xaa')][_0x7a64('0x11c')](db['DeskConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':'Fields','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xab')][_0x7a64('0x12d')](db[_0x7a64('0xaa')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xab')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x1ca')});db['DeskField'][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xad')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xad')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c9'),'foreignKey':'FieldId'});db['DeskField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0xaf')][_0x7a64('0x11c')](db[_0x7a64('0xb1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb1')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xb1')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xb1')]['hasMany'](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xb1')][_0x7a64('0x12d')](db['ZohoAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1cb')][_0x7a64('0x11c')](db['ZohoField'],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cb')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1cb')]['hasMany'](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0x1cb')]['belongsTo'](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db['ZendeskAccount'][_0x7a64('0x11c')](db['ZendeskConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb6')]['hasMany'](db['ZendeskField'],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xb6')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':'Descriptions','foreignKey':_0x7a64('0x1c5')});db['ZendeskConfiguration'][_0x7a64('0x11c')](db['ZendeskField'],{'as':_0x7a64('0x1bc'),'foreignKey':_0x7a64('0x1c2')});db['ZendeskConfiguration'][_0x7a64('0x12d')](db[_0x7a64('0xb4')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb6')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':'int_zendesk_configuration_has_tags'});db[_0x7a64('0xb8')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x7a64('0x11c')](db['ZendeskField'],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xb8')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db['ZendeskField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0xba')][_0x7a64('0x11c')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['FreshdeskConfiguration']['hasMany'](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7a64('0xbc')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xbc')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1bc'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xbc')][_0x7a64('0x12d')](db['FreshdeskAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xbc')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c4'),'foreignKey':'DescriptionId'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db['FreshdeskField'],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xbe')]['belongsTo'](db[_0x7a64('0x91')],{'as':'Variable','foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xc0')][_0x7a64('0x11c')](db['VtigerConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':'AccountId'});db[_0x7a64('0xc2')][_0x7a64('0x11c')](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xc2')]['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xc2')][_0x7a64('0x11c')](db['VtigerField'],{'as':'Fields','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xc2')][_0x7a64('0x12d')](db[_0x7a64('0xc0')],{'as':_0x7a64('0x177'),'foreignKey':'AccountId'});db['VtigerField'][_0x7a64('0x11c')](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db['VtigerField']['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c9'),'foreignKey':'FieldId'});db[_0x7a64('0xc3')][_0x7a64('0x12d')](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xc5')]['hasMany'](db[_0x7a64('0xc7')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xc7')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xc7')][_0x7a64('0x11c')](db['ServicenowField'],{'as':_0x7a64('0x1bc'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xc7')][_0x7a64('0x12d')](db[_0x7a64('0xc5')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xc8')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x7a64('0x11c')](db['ServicenowField'],{'as':_0x7a64('0x1c4'),'foreignKey':'DescriptionId'});db[_0x7a64('0xc8')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':'Field','foreignKey':_0x7a64('0x1c2')});db['ServicenowField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0x1cc')]['hasMany'](db[_0x7a64('0x1cd')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1cc')]['belongsTo'](db[_0x7a64('0x10c')],{'as':_0x7a64('0x10c'),'foreignKey':_0x7a64('0x16c')});db[_0x7a64('0x1cd')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':'DescriptionId'});db[_0x7a64('0x1cd')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db['Dynamics365Configuration'][_0x7a64('0x12d')](db[_0x7a64('0x1cc')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1ce')]['hasMany'](db[_0x7a64('0x1ce')],{'as':'Subject','foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1ce')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1ce')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db['Dynamics365Field'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xcc')][_0x7a64('0x11c')](db[_0x7a64('0x1cf')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1cf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':'Fields','foreignKey':_0x7a64('0x1c2')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xcf')]['hasMany'](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xcf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':'Description','foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xcf')][_0x7a64('0x11c')](db['FreshsalesField'],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{});db[_0x7a64('0xd2')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db['ChatQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x65')],{});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x199')],{});db['ChatQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x67')],{});db[_0x7a64('0xd4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1d0')});db[_0x7a64('0xd4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1d1')});db['JscriptySessionReport'][_0x7a64('0x11c')](db[_0x7a64('0xd6')],{'foreignKey':_0x7a64('0x1d2'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x7a64('0x11c')](db[_0x7a64('0x1d3')],{'foreignKey':'SessionId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0xda')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{});db[_0x7a64('0xda')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db['SmsQueueReport']['belongsTo'](db[_0x7a64('0x168')],{'as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0xda')]['belongsTo'](db[_0x7a64('0x55')],{});db['SmsQueueReport'][_0x7a64('0x12d')](db['SmsMessage'],{});db['SmsQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db['SmsQueueReport']['belongsTo'](db[_0x7a64('0x58')],{});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0xd6')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0x1d3')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x134')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0x1a')],{'through':_0x7a64('0x10e'),'as':_0x7a64('0x1d5')});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x13b')],{'through':_0x7a64('0x176'),'as':'MailQueues'});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x67')],{'through':_0x7a64('0x1d6'),'as':_0x7a64('0x1d7')});db['Team'][_0x7a64('0x12f')](db[_0x7a64('0x13d')],{'through':_0x7a64('0x1d8'),'as':_0x7a64('0x13e')});db['Team'][_0x7a64('0x12f')](db[_0x7a64('0x58')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x7a64('0x133')][_0x7a64('0x12f')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x143')],{'through':_0x7a64('0x1d9'),'as':_0x7a64('0x144')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0xfa')],{'through':_0x7a64('0x110'),'as':_0x7a64('0x1da')});db['Campaign'][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':'Hoppers','foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')]['hasMany'](db[_0x7a64('0x73')],{'as':_0x7a64('0x1db'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')][_0x7a64('0x11c')](db['CmHopperHistory'],{'as':_0x7a64('0x1a5'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')]['hasMany'](db[_0x7a64('0x71')],{'as':_0x7a64('0x1dc'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29'),'foreignKey':_0x7a64('0x15b')});db[_0x7a64('0xeb')]['belongsTo'](db[_0x7a64('0x29')],{'as':_0x7a64('0x1dd'),'foreignKey':_0x7a64('0x1de')});db[_0x7a64('0xeb')][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x7a64('0xeb')]['belongsTo'](db[_0x7a64('0xe3')],{'as':_0x7a64('0xe3'),'foreignKey':_0x7a64('0x1df')});db[_0x7a64('0xeb')][_0x7a64('0x12f')](db[_0x7a64('0x145')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x7a64('0xeb')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x1e0'),'through':_0x7a64('0x1e1')});db[_0x7a64('0xef')][_0x7a64('0x12d')](db[_0x7a64('0x182')],{'as':_0x7a64('0x182'),'foreignKey':_0x7a64('0x183')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x42')],{});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db['MailInteraction'],{});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'foreignKey':_0x7a64('0x1e2'),'as':_0x7a64('0x1e3')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'FromUserId','as':_0x7a64('0x1e4')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{'foreignKey':_0x7a64('0x1e5'),'as':_0x7a64('0x1e6')});db['MailTransferReport']['belongsTo'](db[_0x7a64('0x3d')],{'foreignKey':_0x7a64('0x1e7'),'as':_0x7a64('0x1e8')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x199')],{});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x65')],{});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db['ChatWebsite'],{'foreignKey':_0x7a64('0x1e9'),'as':_0x7a64('0x1e3')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x67')],{'foreignKey':_0x7a64('0x1ed'),'as':_0x7a64('0x1e6')});db[_0x7a64('0xf4')]['belongsTo'](db[_0x7a64('0x5f')],{'foreignKey':_0x7a64('0x1ee'),'as':'ToAccount'});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db[_0x7a64('0x50')],{});db[_0x7a64('0x1ef')]['belongsTo'](db[_0x7a64('0x136')],{});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db['FaxAccount'],{'foreignKey':_0x7a64('0x1f0'),'as':_0x7a64('0x1e3')});db[_0x7a64('0x1ef')]['belongsTo'](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db['FaxTransferReport'][_0x7a64('0x12d')](db['User'],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db['FaxTransferReport'][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{'foreignKey':_0x7a64('0x1f1'),'as':_0x7a64('0x1e6')});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x194')],{});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x139')],{});db[_0x7a64('0x1f2')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x7a64('0x1f3'),'as':'FromAccount'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'FromUserId','as':_0x7a64('0x1e4')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x7a64('0x1eb'),'as':'ToAgent'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{'foreignKey':_0x7a64('0x1f4'),'as':_0x7a64('0x1e6')});db['OpenchannelTransferReport'][_0x7a64('0x12d')](db['OpenchannelAccount'],{'foreignKey':_0x7a64('0x1f5'),'as':_0x7a64('0x1e8')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x57')],{});db['SmsTransferReport'][_0x7a64('0x12d')](db['SmsInteraction'],{});db['SmsTransferReport']['belongsTo'](db[_0x7a64('0x14d')],{'foreignKey':_0x7a64('0x1f7'),'as':'FromAccount'});db[_0x7a64('0x1f6')]['belongsTo'](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':'FromAgent'});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db['SmsQueue'],{'foreignKey':_0x7a64('0x1f8'),'as':_0x7a64('0x1e6')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'foreignKey':_0x7a64('0x1f9'),'as':_0x7a64('0x1e8')});db['CmList'][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x145')][_0x7a64('0x11c')](db['CmCustomField'],{'as':_0x7a64('0x1fa'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x7a64('0x11b'),'foreignKey':'ListId'});db[_0x7a64('0x145')][_0x7a64('0x11c')](db['CmHopperFinal'],{'as':_0x7a64('0x1db'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x145')]['hasMany'](db[_0x7a64('0x121')],{'as':_0x7a64('0x122'),'foreignKey':'ListId'});db['CmList'][_0x7a64('0x11c')](db[_0x7a64('0x76')],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x145')][_0x7a64('0x12f')](db[_0x7a64('0x1a')],{'as':'Queues','through':_0x7a64('0x15f')});db[_0x7a64('0x145')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x132')});db['VoicePrefix'][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'onDelete':'cascade'});db[_0x7a64('0xfa')]['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x112')});db[_0x7a64('0xfa')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x110'),'as':_0x7a64('0x160')});db[_0x7a64('0xfc')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x7a64('0x12e')});db[_0x7a64('0xfc')][_0x7a64('0x11c')](db[_0x7a64('0xfd')],{'as':_0x7a64('0x1fb'),'foreignKey':_0x7a64('0x12e'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0xfd')][_0x7a64('0x11c')](db['UserProfileResource'],{'as':_0x7a64('0x1fc'),'foreignKey':_0x7a64('0x1fd'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x150')]['hasMany'](db[_0x7a64('0x7d')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x7a64('0x11b')});db['WhatsappAccount']['hasMany'](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x1fe')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0x7a64('0x1fe')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db[_0x7a64('0x129')],{'as':_0x7a64('0x188')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db[_0x7a64('0x103')],{'as':_0x7a64('0x172'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x7a64('0x150')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x150')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x7a64('0x15e')});db['WhatsappAccount']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x152')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x7a64('0x103')][_0x7a64('0x12d')](db[_0x7a64('0x150')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['Interval'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7a64('0x184')});db[_0x7a64('0x129')][_0x7a64('0x11c')](db[_0x7a64('0x106')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1ff')});db['WhatsappInteraction'][_0x7a64('0x12d')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x7a64('0x1fe')});db['WhatsappInteraction']['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x129')][_0x7a64('0x12d')](db['User'],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x129')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x200'),'as':'Tags'});db[_0x7a64('0x129')][_0x7a64('0x12f')](db['Tag'],{'through':_0x7a64('0x200'),'as':'ThroughTags'});db[_0x7a64('0x129')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7a64('0x1ff')});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':'User'});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x129')],{'onDelete':'cascade','as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x1ff')});db['WhatsappMessage'][_0x7a64('0x12d')](db['WhatsappAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1fe')});db['WhatsappQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x150')],{});db['WhatsappQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x108')][_0x7a64('0x12d')](db['WhatsappInteraction'],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db['WhatsappQueue'],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x106')],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x106')],{});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x129')],{});db['WhatsappTransferReport'][_0x7a64('0x12d')](db['WhatsappAccount'],{'foreignKey':_0x7a64('0x201'),'as':_0x7a64('0x1e3')});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x150')],{'foreignKey':'ToWhatsappAccountId','as':_0x7a64('0x1e8')});db[_0x7a64('0x109')]['belongsTo'](db[_0x7a64('0x143')],{'foreignKey':_0x7a64('0x202'),'as':_0x7a64('0x1e6')});db['WhatsappTransferReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':'ToAgent'});db['WhatsappQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x38'),'foreignKey':'WhatsappQueueId'});db[_0x7a64('0x143')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x1d9'),'as':_0x7a64('0x160')});db[_0x7a64('0x119')][_0x7a64('0x12d')](db['User'],{'as':_0x7a64('0x203'),'foreignKey':_0x7a64('0x11e'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x7a64('0x1cc')],{'as':'Dynamics365Account','onDelete':_0x7a64('0x16d')});db[_0x7a64('0x10c')][_0x7a64('0x117')](db['MailServerIn'],{'as':_0x7a64('0x16f'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x10c')][_0x7a64('0x117')](db[_0x7a64('0x16e')],{'as':_0x7a64('0x204'),'onDelete':_0x7a64('0x16d')});module[_0x7a64('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8fbf51e..7d8f220 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd117=['/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./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/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','/api/logs','/apidoc','static','root','join','/www','/demo','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/messages','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd117,0x182));var _0x7d11=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xd117[_0x3c487b];return _0x1d65f6;};'use strict';var path=require(_0x7d11('0x0'));var express=require(_0x7d11('0x1'));var errors=require(_0x7d11('0x2'));var config=require(_0x7d11('0x3'));var setupLoggers=require(_0x7d11('0x4'))[_0x7d11('0x5')];var clientSideLogs=require(_0x7d11('0x6'));exports[_0x7d11('0x7')]=function(_0x3c07be){return setupLoggers(_0x3c07be)[_0x7d11('0x8')](function(){_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa'),require(_0x7d11('0xb')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc'),require(_0x7d11('0xd')));_0x3c07be['use'](_0x7d11('0xe'),require(_0x7d11('0xf')));_0x3c07be[_0x7d11('0x9')]('/api/voice/extensions',require(_0x7d11('0x10')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x11'),require('./api/voiceMusicOnHold'));_0x3c07be[_0x7d11('0x9')]('/api/voice/queues',require('./api/voiceQueue'));_0x3c07be[_0x7d11('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x3c07be[_0x7d11('0x9')]('/api/screen/recordings',require(_0x7d11('0x12')));_0x3c07be[_0x7d11('0x9')]('/api/voice/mails',require(_0x7d11('0x13')));_0x3c07be[_0x7d11('0x9')]('/api/voice/mails/messages',require(_0x7d11('0x14')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x15'),require(_0x7d11('0x16')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x17'),require(_0x7d11('0x18')));_0x3c07be[_0x7d11('0x9')]('/api/voice/agents/reports',require(_0x7d11('0x19')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x1a'),require(_0x7d11('0x1b')));_0x3c07be[_0x7d11('0x9')]('/api/members/reports',require(_0x7d11('0x1c')));_0x3c07be[_0x7d11('0x9')]('/api/trunks',require('./api/trunk'));_0x3c07be[_0x7d11('0x9')]('/api/voice/transfers/reports',require(_0x7d11('0x1d')));_0x3c07be['use'](_0x7d11('0x1e'),require(_0x7d11('0x1f')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x20'),require(_0x7d11('0x21')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x22'),require(_0x7d11('0x23')));_0x3c07be['use'](_0x7d11('0x24'),require('./api/mailSubstatus'));_0x3c07be['use']('/api/mail/interactions',require(_0x7d11('0x25')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x26'),require(_0x7d11('0x27')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x28'),require(_0x7d11('0x29')));_0x3c07be[_0x7d11('0x9')]('/api/mail/reports/queue',require(_0x7d11('0x2a')));_0x3c07be['use']('/api/dashboards',require('./api/dashboard'));_0x3c07be[_0x7d11('0x9')]('/api/dashboards/items',require(_0x7d11('0x2b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x2c'),require('./api/faxAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x2d'),require(_0x7d11('0x2e')));_0x3c07be['use'](_0x7d11('0x2f'),require(_0x7d11('0x30')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x31'),require('./api/faxMessage'));_0x3c07be[_0x7d11('0x9')]('/api/fax/queues',require(_0x7d11('0x32')));_0x3c07be['use'](_0x7d11('0x33'),require(_0x7d11('0x34')));_0x3c07be[_0x7d11('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x35'),require('./api/smsApplication'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x36'),require(_0x7d11('0x37')));_0x3c07be['use'](_0x7d11('0x38'),require('./api/smsMessage'));_0x3c07be['use'](_0x7d11('0x39'),require('./api/smsQueue'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3a'),require(_0x7d11('0x3b')));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/applications',require(_0x7d11('0x3c')));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3d'),require('./api/openchannelMessage'));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3c07be[_0x7d11('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3e'),require(_0x7d11('0x3f')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x40'),require(_0x7d11('0x41')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x42'),require(_0x7d11('0x43')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x44'),require(_0x7d11('0x45')));_0x3c07be['use'](_0x7d11('0x46'),require('./api/chatOfflineMessage'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x47'),require(_0x7d11('0x48')));_0x3c07be[_0x7d11('0x9')]('/api/chat/groups',require(_0x7d11('0x49')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x4a'),require(_0x7d11('0x4b')));_0x3c07be['use'](_0x7d11('0x4c'),require('./api/cmCompany'));_0x3c07be[_0x7d11('0x9')]('/api/cm/contacts',require(_0x7d11('0x4d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x4e'),require(_0x7d11('0x4f')));_0x3c07be['use']('/api/cm/hopper_black',require(_0x7d11('0x50')));_0x3c07be[_0x7d11('0x9')]('/api/cm/hopper_final',require(_0x7d11('0x51')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x52'),require(_0x7d11('0x53')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x54'),require('./api/cmCustomField'));_0x3c07be[_0x7d11('0x9')]('/api/actions',require(_0x7d11('0x55')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x56'),require(_0x7d11('0x57')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x58'),require('./api/cannedAnswer'));_0x3c07be['use']('/api/dispositions',require(_0x7d11('0x59')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5a'),require(_0x7d11('0x5b')));_0x3c07be[_0x7d11('0x9')]('/api/intervals',require(_0x7d11('0x5c')));_0x3c07be[_0x7d11('0x9')]('/api/pauses',require(_0x7d11('0x5d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5e'),require('./api/cdr'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5f'),require(_0x7d11('0x60')));_0x3c07be['use'](_0x7d11('0x61'),require('./api/schedule'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x62'),require(_0x7d11('0x63')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x64'),require(_0x7d11('0x65')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x66'),require(_0x7d11('0x67')));_0x3c07be['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x68'),require(_0x7d11('0x69')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6a'),require(_0x7d11('0x6b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6c'),require(_0x7d11('0x6d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6e'),require(_0x7d11('0x6f')));_0x3c07be['use'](_0x7d11('0x70'),require(_0x7d11('0x71')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/reports',require('./api/integrationReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x72'),require(_0x7d11('0x73')));_0x3c07be['use']('/api/analytics/default_reports',require(_0x7d11('0x74')));_0x3c07be[_0x7d11('0x9')]('/api/analytics/extracted_reports',require(_0x7d11('0x75')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x76'),require(_0x7d11('0x77')));_0x3c07be['use'](_0x7d11('0x78'),require(_0x7d11('0x79')));_0x3c07be[_0x7d11('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7a'),require(_0x7d11('0x7b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7c'),require('./api/intSalesforceConfiguration'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7d'),require(_0x7d11('0x7e')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7f'),require(_0x7d11('0x80')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x81'),require(_0x7d11('0x82')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x83'),require(_0x7d11('0x84')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3c07be['use'](_0x7d11('0x85'),require(_0x7d11('0x86')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/zoho/accounts',require(_0x7d11('0x87')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x88'),require(_0x7d11('0x89')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8a'),require('./api/intZohoField'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8b'),require(_0x7d11('0x8c')));_0x3c07be['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x3c07be['use'](_0x7d11('0x8d'),require('./api/intZendeskField'));_0x3c07be['use']('/api/integrations/freshdesk/accounts',require(_0x7d11('0x8e')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8f'),require(_0x7d11('0x90')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x91'),require('./api/intFreshdeskField'));_0x3c07be[_0x7d11('0x9')]('/api/integrations/vtiger/accounts',require(_0x7d11('0x92')));_0x3c07be['use'](_0x7d11('0x93'),require(_0x7d11('0x94')));_0x3c07be['use'](_0x7d11('0x95'),require(_0x7d11('0x96')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x97'),require('./api/intServicenowAccount'));_0x3c07be['use'](_0x7d11('0x98'),require(_0x7d11('0x99')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x9a'),require(_0x7d11('0x9b')));_0x3c07be['use'](_0x7d11('0x9c'),require('./api/intDynamics365Account'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x9d'),require(_0x7d11('0x9e')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/dynamics365/fields',require(_0x7d11('0x9f')));_0x3c07be['use'](_0x7d11('0xa0'),require(_0x7d11('0xa1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa2'),require(_0x7d11('0xa3')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa4'),require(_0x7d11('0xa5')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa6'),require(_0x7d11('0xa7')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa8'),require(_0x7d11('0xa9')));_0x3c07be['use'](_0x7d11('0xaa'),require('./api/chatInternalMessage'));_0x3c07be[_0x7d11('0x9')]('/api/jscripty/answers/reports',require(_0x7d11('0xab')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xac'),require(_0x7d11('0xad')));_0x3c07be['use']('/api/jscripty/sessions/reports',require(_0x7d11('0xae')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xaf'),require('./api/smsQueueReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb0'),require(_0x7d11('0xb1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb2'),require(_0x7d11('0xb3')));_0x3c07be['use'](_0x7d11('0xb4'),require('./api/jscriptyProject'));_0x3c07be[_0x7d11('0x9')]('/api/settings',require('./api/setting'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb5'),require(_0x7d11('0xb6')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb7'),require(_0x7d11('0xb8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb9'),require(_0x7d11('0xba')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbb'),require('./api/squareMessage'));_0x3c07be[_0x7d11('0x9')]('/api/teams',require(_0x7d11('0xbc')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbd'),require(_0x7d11('0xbe')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbf'),require(_0x7d11('0xc0')));_0x3c07be['use']('/api/migrations',require(_0x7d11('0xc1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc2'),require(_0x7d11('0xc3')));_0x3c07be[_0x7d11('0x9')]('/api/plugins',require(_0x7d11('0xc4')));_0x3c07be['use'](_0x7d11('0xc5'),require(_0x7d11('0xc6')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc7'),require(_0x7d11('0xc8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc9'),require(_0x7d11('0xca')));_0x3c07be['use']('/api/openchannel/reports/transfer',require(_0x7d11('0xcb')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xcc'),require('./api/smsTransferReport'));_0x3c07be['use'](_0x7d11('0xcd'),require('./api/cmList'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xce'),require(_0x7d11('0xcf')));_0x3c07be[_0x7d11('0x9')]('/api/userProfiles',require(_0x7d11('0xd0')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd1'),require(_0x7d11('0xd2')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd3'),require(_0x7d11('0xd4')));_0x3c07be[_0x7d11('0x9')]('/api/userNotifications',require(_0x7d11('0xd5')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd6'),require(_0x7d11('0xd7')));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/applications',require(_0x7d11('0xd8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd9'),require(_0x7d11('0xda')));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x3c07be['use'](_0x7d11('0xdb'),require('./api/whatsappQueueReport'));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xdc'),require(_0x7d11('0xdd')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xde'),require(_0x7d11('0xdf')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe0'),require(_0x7d11('0xe1')));_0x3c07be[_0x7d11('0x9')]('/api/user-settings',require(_0x7d11('0xe2')));_0x3c07be[_0x7d11('0x9')]('/api/mail_interaction_has_tags',require(_0x7d11('0xe3')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe4'),require(_0x7d11('0xe5')));_0x3c07be['use']('/api/auth/google',require(_0x7d11('0xe6')));_0x3c07be['use'](_0x7d11('0xe7'),require(_0x7d11('0xe8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe9'),require(_0x7d11('0xea')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xeb'),require('./api/rpc'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xec'),require(_0x7d11('0xed')));_0x3c07be[_0x7d11('0x9')]('/api/system',require(_0x7d11('0xee')));_0x3c07be[_0x7d11('0x9')]('/api/pm2',require(_0x7d11('0xef')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf0'),require('./api/webbar'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf1'),clientSideLogs);_0x3c07be['use'](_0x7d11('0xf2'),express[_0x7d11('0xf3')](path['join'](config[_0x7d11('0xf4')],'/apidoc')));_0x3c07be['use']('/www',express['static'](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],_0x7d11('0xf6'))));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf7'),express[_0x7d11('0xf3')](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],_0x7d11('0xf7'))));_0x3c07be[_0x7d11('0x9')]('/snippet',express['static'](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],'snippet','3.13.0')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf8'),express[_0x7d11('0xf3')](path[_0x7d11('0xf5')](config['root'],'/server/files/plugins')));_0x3c07be['route'](_0x7d11('0xf9'))[_0x7d11('0xfa')](errors[0x194]);_0x3c07be[_0x7d11('0xfb')]('/*')['get'](function(_0x3ce304,_0x238cfd){_0x238cfd['sendFile'](path[_0x7d11('0xfc')](_0x3c07be[_0x7d11('0xfa')]('appPath')+'/index.html'));});return _0x3c07be;});}; \ No newline at end of file +var _0xc1c6=['/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/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/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./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/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/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/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','/www','join','root','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','/api/users','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x55859d,_0x3465b7){_0x55859d=_0x55859d-0x0;var _0x154817=_0xc1c6[_0x55859d];return _0x154817;};'use strict';var path=require(_0x6c1c('0x0'));var express=require(_0x6c1c('0x1'));var errors=require(_0x6c1c('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x6c1c('0x3'))['setupLoggers'];var clientSideLogs=require(_0x6c1c('0x4'));exports[_0x6c1c('0x5')]=function(_0x265d2c){return setupLoggers(_0x265d2c)['then'](function(){_0x265d2c['use'](_0x6c1c('0x6'),require('./api/user'));_0x265d2c[_0x6c1c('0x7')]('/api/voice/chanspy',require(_0x6c1c('0x8')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9'),require(_0x6c1c('0xa')));_0x265d2c['use'](_0x6c1c('0xb'),require(_0x6c1c('0xc')));_0x265d2c['use'](_0x6c1c('0xd'),require(_0x6c1c('0xe')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf'),require('./api/voiceQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x10'),require(_0x6c1c('0x11')));_0x265d2c['use'](_0x6c1c('0x12'),require(_0x6c1c('0x13')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/mails',require(_0x6c1c('0x14')));_0x265d2c['use'](_0x6c1c('0x15'),require(_0x6c1c('0x16')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x17'),require(_0x6c1c('0x18')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x19'),require(_0x6c1c('0x1a')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/agents/reports',require(_0x6c1c('0x1b')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/queues/reports',require(_0x6c1c('0x1c')));_0x265d2c[_0x6c1c('0x7')]('/api/members/reports',require(_0x6c1c('0x1d')));_0x265d2c['use'](_0x6c1c('0x1e'),require(_0x6c1c('0x1f')));_0x265d2c['use'](_0x6c1c('0x20'),require('./api/voiceTransferReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x21'),require(_0x6c1c('0x22')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x23'),require(_0x6c1c('0x24')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x25'),require(_0x6c1c('0x26')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x27'),require(_0x6c1c('0x28')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x29'),require(_0x6c1c('0x2a')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2b'),require(_0x6c1c('0x2c')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2d'),require(_0x6c1c('0x2e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2f'),require(_0x6c1c('0x30')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x31'),require(_0x6c1c('0x32')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x33'),require('./api/dashboardItem'));_0x265d2c[_0x6c1c('0x7')]('/api/fax/accounts',require(_0x6c1c('0x34')));_0x265d2c['use'](_0x6c1c('0x35'),require('./api/faxApplication'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x36'),require('./api/faxInteraction'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x37'),require('./api/faxMessage'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x38'),require(_0x6c1c('0x39')));_0x265d2c[_0x6c1c('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x3a'),require(_0x6c1c('0x3b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x3c'),require(_0x6c1c('0x3d')));_0x265d2c['use'](_0x6c1c('0x3e'),require(_0x6c1c('0x3f')));_0x265d2c['use'](_0x6c1c('0x40'),require(_0x6c1c('0x41')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x42'),require('./api/smsQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x43'),require(_0x6c1c('0x44')));_0x265d2c['use'](_0x6c1c('0x45'),require('./api/openchannelApplication'));_0x265d2c[_0x6c1c('0x7')]('/api/openchannel/interactions',require(_0x6c1c('0x46')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x47'),require('./api/openchannelMessage'));_0x265d2c['use'](_0x6c1c('0x48'),require(_0x6c1c('0x49')));_0x265d2c[_0x6c1c('0x7')]('/api/chat/websites',require(_0x6c1c('0x4a')));_0x265d2c['use']('/api/openchannel/reports/queue',require(_0x6c1c('0x4b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x4c'),require(_0x6c1c('0x4d')));_0x265d2c['use'](_0x6c1c('0x4e'),require(_0x6c1c('0x4f')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x50'),require(_0x6c1c('0x51')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x52'),require(_0x6c1c('0x53')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x54'),require('./api/chatQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x55'),require(_0x6c1c('0x56')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x57'),require('./api/chatProactiveAction'));_0x265d2c['use']('/api/cm/companies',require(_0x6c1c('0x58')));_0x265d2c['use']('/api/cm/contacts',require(_0x6c1c('0x59')));_0x265d2c[_0x6c1c('0x7')]('/api/cm/hopper',require(_0x6c1c('0x5a')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5b'),require('./api/cmHopperBlack'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5c'),require('./api/cmHopperFinal'));_0x265d2c[_0x6c1c('0x7')]('/api/cm/hopper_history',require(_0x6c1c('0x5d')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5e'),require(_0x6c1c('0x5f')));_0x265d2c[_0x6c1c('0x7')]('/api/actions',require(_0x6c1c('0x60')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x61'),require('./api/automation'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x62'),require(_0x6c1c('0x63')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x64'),require('./api/disposition'));_0x265d2c[_0x6c1c('0x7')]('/api/conditions',require('./api/condition'));_0x265d2c['use'](_0x6c1c('0x65'),require(_0x6c1c('0x66')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x67'),require(_0x6c1c('0x68')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x69'),require(_0x6c1c('0x6a')));_0x265d2c['use'](_0x6c1c('0x6b'),require(_0x6c1c('0x6c')));_0x265d2c['use'](_0x6c1c('0x6d'),require('./api/schedule'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x6e'),require(_0x6c1c('0x6f')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x70'),require('./api/tag'));_0x265d2c[_0x6c1c('0x7')]('/api/contact_item_types',require(_0x6c1c('0x71')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x72'),require(_0x6c1c('0x73')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x74'),require('./api/cmHopperAdditionalPhone'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x75'),require('./api/template'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x76'),require(_0x6c1c('0x77')));_0x265d2c[_0x6c1c('0x7')]('/api/variables',require(_0x6c1c('0x78')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x79'),require('./api/integration'));_0x265d2c['use']('/api/integrations/reports',require('./api/integrationReport'));_0x265d2c['use'](_0x6c1c('0x7a'),require(_0x6c1c('0x7b')));_0x265d2c['use'](_0x6c1c('0x7c'),require(_0x6c1c('0x7d')));_0x265d2c[_0x6c1c('0x7')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x7e'),require('./api/analyticMetric'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x7f'),require(_0x6c1c('0x80')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x81'),require(_0x6c1c('0x82')));_0x265d2c['use'](_0x6c1c('0x83'),require(_0x6c1c('0x84')));_0x265d2c['use']('/api/integrations/salesforce/configurations',require(_0x6c1c('0x85')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x86'),require('./api/intSalesforceField'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x87'),require(_0x6c1c('0x88')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x89'),require(_0x6c1c('0x8a')));_0x265d2c['use']('/api/integrations/desk/accounts',require(_0x6c1c('0x8b')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/desk/configurations',require(_0x6c1c('0x8c')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x8d'),require(_0x6c1c('0x8e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x8f'),require('./api/intZohoAccount'));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/zoho/configurations',require(_0x6c1c('0x90')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x91'),require(_0x6c1c('0x92')));_0x265d2c['use']('/api/integrations/zendesk/accounts',require(_0x6c1c('0x93')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x94'),require('./api/intZendeskConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x95'),require(_0x6c1c('0x96')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x97'),require(_0x6c1c('0x98')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/freshdesk/configurations',require(_0x6c1c('0x99')));_0x265d2c['use'](_0x6c1c('0x9a'),require(_0x6c1c('0x9b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9c'),require('./api/intVtigerAccount'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9d'),require(_0x6c1c('0x9e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9f'),require(_0x6c1c('0xa0')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa1'),require(_0x6c1c('0xa2')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa3'),require('./api/intServicenowConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa4'),require(_0x6c1c('0xa5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa6'),require('./api/intDynamics365Account'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa7'),require('./api/intDynamics365Configuration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa8'),require(_0x6c1c('0xa9')));_0x265d2c['use'](_0x6c1c('0xaa'),require(_0x6c1c('0xab')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xac'),require(_0x6c1c('0xad')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xae'),require('./api/network'));_0x265d2c['use']('/api/chat/reports/queue',require(_0x6c1c('0xaf')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb0'),require(_0x6c1c('0xb1')));_0x265d2c['use'](_0x6c1c('0xb2'),require('./api/jscriptyAnswerReport'));_0x265d2c['use']('/api/jscripty/questions/reports',require(_0x6c1c('0xb3')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb4'),require(_0x6c1c('0xb5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb6'),require('./api/smsQueueReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb7'),require(_0x6c1c('0xb8')));_0x265d2c['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb9'),require('./api/jscriptyProject'));_0x265d2c[_0x6c1c('0x7')]('/api/settings',require(_0x6c1c('0xba')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xbb'),require(_0x6c1c('0xbc')));_0x265d2c['use'](_0x6c1c('0xbd'),require(_0x6c1c('0xbe')));_0x265d2c['use']('/api/square/recordings',require(_0x6c1c('0xbf')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc0'),require('./api/squareMessage'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc1'),require('./api/team'));_0x265d2c['use']('/api/license',require('./api/license'));_0x265d2c[_0x6c1c('0x7')]('/api/campaigns',require(_0x6c1c('0xc2')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc3'),require('./api/migration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc4'),require(_0x6c1c('0xc5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc6'),require('./api/plugin'));_0x265d2c[_0x6c1c('0x7')]('/api/mail/reports/transfer',require(_0x6c1c('0xc7')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc8'),require(_0x6c1c('0xc9')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xca'),require(_0x6c1c('0xcb')));_0x265d2c[_0x6c1c('0x7')]('/api/openchannel/reports/transfer',require(_0x6c1c('0xcc')));_0x265d2c['use']('/api/sms/reports/transfer',require(_0x6c1c('0xcd')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xce'),require(_0x6c1c('0xcf')));_0x265d2c['use'](_0x6c1c('0xd0'),require('./api/voicePrefix'));_0x265d2c[_0x6c1c('0x7')]('/api/userProfiles',require(_0x6c1c('0xd1')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd2'),require('./api/userProfileSection'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd3'),require(_0x6c1c('0xd4')));_0x265d2c['use'](_0x6c1c('0xd5'),require(_0x6c1c('0xd6')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd7'),require('./api/whatsappAccount'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd8'),require(_0x6c1c('0xd9')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xda'),require('./api/whatsappInteraction'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xdb'),require(_0x6c1c('0xdc')));_0x265d2c[_0x6c1c('0x7')]('/api/whatsapp/reports/queue',require(_0x6c1c('0xdd')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xde'),require('./api/whatsappTransferReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xdf'),require('./api/whatsappQueue'));_0x265d2c[_0x6c1c('0x7')]('/api/cloudProviders',require(_0x6c1c('0xe0')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xe1'),require(_0x6c1c('0xe2')));_0x265d2c['use'](_0x6c1c('0xe3'),require(_0x6c1c('0xe4')));_0x265d2c[_0x6c1c('0x7')]('/api/mail_interaction_has_tags',require(_0x6c1c('0xe5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xe6'),require(_0x6c1c('0xe7')));_0x265d2c['use'](_0x6c1c('0xe8'),require(_0x6c1c('0xe9')));_0x265d2c[_0x6c1c('0x7')]('/api/auth/activedirectory',require(_0x6c1c('0xea')));_0x265d2c['use'](_0x6c1c('0xeb'),require(_0x6c1c('0xec')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xed'),require(_0x6c1c('0xee')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xef'),require(_0x6c1c('0xf0')));_0x265d2c['use'](_0x6c1c('0xf1'),require('./api/system'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf2'),require(_0x6c1c('0xf3')));_0x265d2c[_0x6c1c('0x7')]('/api/webbar',require(_0x6c1c('0xf4')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf5'),clientSideLogs);_0x265d2c['use'](_0x6c1c('0xf6'),express[_0x6c1c('0xf7')](path['join'](config['root'],_0x6c1c('0xf6'))));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf8'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],_0x6c1c('0xf8'))));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xfb'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],'/demo')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xfc'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],_0x6c1c('0xfd'),_0x6c1c('0xfe'))));_0x265d2c['use'](_0x6c1c('0xff'),express['static'](path['join'](config[_0x6c1c('0xfa')],_0x6c1c('0x100'))));_0x265d2c[_0x6c1c('0x101')](_0x6c1c('0x102'))[_0x6c1c('0x103')](errors[0x194]);_0x265d2c[_0x6c1c('0x101')]('/*')[_0x6c1c('0x103')](function(_0x2a2797,_0x3543c8){_0x3543c8[_0x6c1c('0x104')](path['resolve'](_0x265d2c[_0x6c1c('0x103')](_0x6c1c('0x105'))+_0x6c1c('0x106')));});return _0x265d2c;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index cc422ea..0330347 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76c1=['listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.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/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment'];(function(_0x388072,_0x426c3c){var _0x316b06=function(_0x4aa5a3){while(--_0x4aa5a3){_0x388072['push'](_0x388072['shift']());}};_0x316b06(++_0x426c3c);}(_0x76c1,0x87));var _0x176c=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x76c1[_0x12f688];return _0x59c3de;};'use strict';var jayson=require(_0x176c('0x0'));var _=require(_0x176c('0x1'));var config=require(_0x176c('0x2'));exports[_0x176c('0x3')]=function(){return new Promise(function(_0x2ad0a7,_0x478001){var _0xecc8cb={};_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x4')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x6')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x7')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x8')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x9')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/trunk/trunk.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0xa')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xb')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/mailQueue/mailQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/mailInteraction/mailInteraction.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0xc')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xd')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xe')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xf')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x10')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x11')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x12')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x13')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x14')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x15')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/smsInteraction/smsInteraction.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x16')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x17')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x18')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x19')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1a')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1b')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1c')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/chatQueue/chatQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1d')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1e')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1f')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x20')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/interval/interval.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x21')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x22')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x23')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x24')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x25')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/variable/variable.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x26')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x27')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x28')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x29')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2a')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2b')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2c')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2d')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2e')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x2f')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x30')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x31')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x32')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x33')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x34')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x35')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x36')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x37')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x38')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/plugin/plugin.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x39')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x3a')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2496e2=jayson[_0x176c('0x3b')](_0xecc8cb)[_0x176c('0x3c')]();var _0x5b78b9=config[_0x176c('0x3d')]['port']||config['port']+0x1;var _0x200f78=config['rpc']['ip']||_0x176c('0x3e');_0x2496e2['on'](_0x176c('0x3f'),function(_0x3e1588){return _0x478001(_0x3e1588);});_0x2496e2['listen'](_0x5b78b9,_0x200f78,function(){console[_0x176c('0x40')](_0x176c('0x41'),_0x200f78,_0x5b78b9);require(_0x176c('0x42'))[_0x176c('0x43')]();return _0x2ad0a7(_0x176c('0x44')+_0x200f78+':'+_0x5b78b9);});});}; \ No newline at end of file +var _0xd02a=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x5ef25f,_0x2bdffa){var _0x39349c=function(_0xb3a53a){while(--_0xb3a53a){_0x5ef25f['push'](_0x5ef25f['shift']());}};_0x39349c(++_0x2bdffa);}(_0xd02a,0x1b2));var _0xad02=function(_0xc1d423,_0x415fa9){_0xc1d423=_0xc1d423-0x0;var _0x5d1b9a=_0xd02a[_0xc1d423];return _0x5d1b9a;};'use strict';var jayson=require(_0xad02('0x0'));var _=require('lodash');var config=require(_0xad02('0x1'));exports[_0xad02('0x2')]=function(){return new Promise(function(_0x529826,_0x306e2d){var _0x31b5ab={};_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x3')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x5')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x6')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x7')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x8')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x9')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0xa')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/trunk/trunk.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xb')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xc')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xd')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xe')));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/mailQueue/mailQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xf')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x10')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x11')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x12')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxApplication/faxApplication.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x13')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x14')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxQueue/faxQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x15')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x16')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x17')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x18')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x19')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1a')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1b')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1c')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/chatInteraction/chatInteraction.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/chatMessage/chatMessage.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/chatQueue/chatQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/cmContact/cmContact.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x1d')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1e')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1f')));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/interval/interval.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x20')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/sound/sound.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x21')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/template/template.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x22')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x23')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x24')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x25')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x26')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x27')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x28')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x29')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x2a')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2b')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2c')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2d')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2e')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2f')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x30')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x31')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x32')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/squareRecording/squareRecording.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x33')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x34')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x35')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x36')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x37')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x38')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x39')));var _0x4511d2=jayson[_0xad02('0x3a')](_0x31b5ab)['http']();var _0x2ea733=config['rpc'][_0xad02('0x3b')]||config[_0xad02('0x3b')]+0x1;var _0x2dbb5e=config['rpc']['ip']||_0xad02('0x3c');_0x4511d2['on'](_0xad02('0x3d'),function(_0x3340c1){return _0x306e2d(_0x3340c1);});_0x4511d2[_0xad02('0x2')](_0x2ea733,_0x2dbb5e,function(){console[_0xad02('0x3e')](_0xad02('0x3f'),_0x2dbb5e,_0x2ea733);require(_0xad02('0x40'))['default']();return _0x529826(_0xad02('0x41')+_0x2dbb5e+':'+_0x2ea733);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cc8d654..74363d2 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 _0x8604=['hangup','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','emit','ready','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sendRequest','sync','prototype','answer','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s'];(function(_0x45e2cd,_0x522b9a){var _0x4006f5=function(_0x9da299){while(--_0x9da299){_0x45e2cd['push'](_0x45e2cd['shift']());}};_0x4006f5(++_0x522b9a);}(_0x8604,0x100));var _0x4860=function(_0x300bcb,_0x59a0f2){_0x300bcb=_0x300bcb-0x0;var _0x50fdca=_0x8604[_0x300bcb];return _0x50fdca;};'use strict';var util=require(_0x4860('0x0'));var _=require(_0x4860('0x1'));var EventEmitter=require(_0x4860('0x2'))[_0x4860('0x3')];var AGIReply=require(_0x4860('0x4'));var AGIError=require(_0x4860('0x5'));function AGIChannel(_0x1fdd37){var _0x53474a=this,_0x13b1ad=new AGIReply(),_0x6c95b0=![],_0xb90d93={};EventEmitter[_0x4860('0x6')](_0x53474a);_0x1fdd37['setEncoding'](_0x4860('0x7'));_0x1fdd37[_0x4860('0x8')](0x8*0x3c*0x3c*0x3e8);_0x13b1ad['setEncoding']('utf8');_0x13b1ad['on'](_0x4860('0x9'),function(_0x528623){for(var _0xd389c3 in _0x528623){_0x53474a[_0xd389c3]=_0x528623[_0xd389c3];}_0x53474a[_0x4860('0xa')](_0x4860('0xb'));});_0x13b1ad['on']('line',function(_0x3a531b){if(_0x3a531b['toLowerCase']()=='hangup'){_0x53474a['emit']('hangup');return;}if(_0x3a531b[_0x4860('0xc')](0x0,0xb)==_0x4860('0xd')){_0x6c95b0=!![];}if(_0x6c95b0){_0xb90d93['rx']+=_0x3a531b+'\x0a';if(_0x3a531b[_0x4860('0xe')](_0x4860('0xf'))!=-0x1){_0x6c95b0=![];}}else{_0xb90d93['rx']=_0x3a531b;}if(_0x6c95b0){return;}if(typeof _0xb90d93['cb']==_0x4860('0x10')){var _0x237c66=_0xb90d93['rx'][_0x4860('0xc')](0x0,0x3),_0x4a0fc1=null,_0x5b6f47=null;_0x237c66=parseInt(_0x237c66);if(isNaN(_0x237c66)){_0xb90d93['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4860('0x11')});return;}if(_0x237c66!=0xc8){_0xb90d93['cb'](null,{'code':_0x237c66,'result':-0x1,'extra':'KO'});return;}_0x4a0fc1=_0xb90d93['rx'][_0x4860('0xc')](0x4)[_0x4860('0x12')](_0x4860('0x13'),'');if(_0x4a0fc1['indexOf']('\x20')!=-0x1){_0x4a0fc1=_0x4a0fc1[_0x4860('0x14')](0x0,_0x4a0fc1[_0x4860('0x15')]('\x20'));}if(_[_0x4860('0x16')](_0x4a0fc1,'-1')){_0x4a0fc1=parseInt(_0x4a0fc1);}_0x5b6f47=_0xb90d93['rx'][_0x4860('0x17')]('\x20');if(_0x5b6f47[_0x4860('0x18')]==0x3){_0x5b6f47=_0x5b6f47[0x2][_0x4860('0xc')](0x1,_0x5b6f47[0x2][_0x4860('0x18')]-0x1);}else if(_0x5b6f47['length']>0x3){var _0x4c36a4=/\((.+)\)/;var _0xd5ce7=_0xb90d93['rx'][_0x4860('0x19')](_0x4c36a4);if(_0xd5ce7){_0x5b6f47=_0xd5ce7[0x1];}else{_0x5b6f47=null;}}else{_0x5b6f47=null;}_0xb90d93['cb'](null,{'code':_0x237c66,'result':_0x4a0fc1,'extra':_0x5b6f47});}});_0x1fdd37['on']('error',function(_0x408daf){_0x53474a['emit'](_0x4860('0x1a'),new AGIError(_0x4860('0x1b'),_0x408daf[_0x4860('0x1c')]));});_0x1fdd37['on'](_0x4860('0x1d'),function(){_0x53474a[_0x4860('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1fdd37['on'](_0x4860('0x1e'),function(){_0x53474a[_0x4860('0xa')](_0x4860('0x1e'),new AGIError(_0x4860('0x1f')));_0x1fdd37['destroy']();});_0x1fdd37[_0x4860('0x20')](_0x13b1ad);this[_0x4860('0x21')]=function(_0x334716,_0x3cf453){var _0x334716=_0x334716||'',_0x3cf453=typeof _0x3cf453==_0x4860('0x10')?_0x3cf453:new Function();_0xb90d93={'tx':_0x334716,'rx':'','cb':_0x3cf453};_0x1fdd37[_0x4860('0x22')](_0x334716+'\x0a');},this['close']=function(){_0x1fdd37[_0x4860('0x23')]();};}util[_0x4860('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x4860('0x25')]=function(_0x343954){return this[_0x4860('0x21')][_0x4860('0x26')](this,_0x343954);};AGIChannel[_0x4860('0x27')][_0x4860('0x28')]=function(){return this['sendRequest'](_0x4860('0x29'));};AGIChannel[_0x4860('0x27')]['getData']=function(_0x11ea2b,_0x525086,_0x3ca770){_0x11ea2b=_0x11ea2b===undefined?'beep':_0x11ea2b;_0x525086=_0x525086===undefined?'5':_0x525086;_0x3ca770=_0x3ca770===undefined?'1':_0x3ca770;return this[_0x4860('0x25')](util['format'](_0x4860('0x2a'),_0x11ea2b,_0x525086*0x3e8,_0x3ca770));};AGIChannel[_0x4860('0x27')][_0x4860('0x2b')]=function(_0x3a9da7){_0x3a9da7=_0x3a9da7||_0x4860('0x2c');return this[_0x4860('0x25')](util[_0x4860('0x2d')]('VERBOSE\x20\x22%s\x22',_0x3a9da7));};AGIChannel[_0x4860('0x27')][_0x4860('0x2e')]=function(_0x5aee47,_0x3fa15b){if(_['isArray'](_0x3fa15b)){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x2f'),_0x5aee47,_0x3fa15b['join'](',')));}return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x2f'),_0x5aee47,_0x3fa15b));};AGIChannel[_0x4860('0x27')][_0x4860('0x30')]=function(_0x213047){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x31'),_0x213047));};AGIChannel[_0x4860('0x27')]['setExtension']=function(_0x4436b8){return this[_0x4860('0x25')](util['format'](_0x4860('0x32'),_0x4436b8));};AGIChannel['prototype']['setPriority']=function(_0x19649b){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x33'),_0x19649b));};AGIChannel[_0x4860('0x27')][_0x4860('0x34')]=function(){return this[_0x4860('0x25')]('HANGUP');};AGIChannel[_0x4860('0x27')][_0x4860('0x35')]=function(_0xbad421,_0x5880a0){var _0x3df978=_[_0x4860('0x36')](_0x5880a0)||_['isNumber'](_0x5880a0)?_0x5880a0[_0x4860('0x37')]():_0x5880a0;return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x38'),_0xbad421,_0x3df978?_0x3df978[_0x4860('0x37')]()[_0x4860('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x2b315f,_0x5d6f25){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x39'),_0x2b315f,_0x5d6f25));};AGIChannel['prototype'][_0x4860('0x3a')]=function(_0x42a0ef,_0xd6b068){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x3b'),_0x42a0ef,_0xd6b068));};AGIChannel['prototype'][_0x4860('0x3c')]=function(_0x1a8704,_0x5c167b){return this['sendRequest'](util[_0x4860('0x2d')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1a8704,_0x5c167b));};AGIChannel[_0x4860('0x27')][_0x4860('0x3d')]=function(_0x5089a4,_0x4bc3ea,_0x197865){_0x4bc3ea=_0x4bc3ea||this[_0x4860('0x3e')];_0x197865=_0x197865||0x1;this[_0x4860('0x30')](_0x5089a4);this[_0x4860('0x3f')](_0x4bc3ea);this[_0x4860('0x40')](_0x197865);return this[_0x4860('0x2b')](util[_0x4860('0x2d')](_0x4860('0x41'),_0x5089a4,_0x4bc3ea,_0x197865));};AGIChannel[_0x4860('0x27')]['getVariable']=function(_0x3dcace){return this['sendRequest'](util[_0x4860('0x2d')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3dcace));};AGIChannel[_0x4860('0x27')][_0x4860('0x42')]=function(_0x28fe3a,_0x22c183,_0x34eb63,_0x4c406c,_0x303b6f,_0x3743dc){_0x22c183=_0x22c183||'wav';_0x34eb63=_0x34eb63||'';_0x4c406c=_0x4c406c===undefined?-0x1:_0x4c406c==='-1'?-0x1:_0x4c406c*0x3e8;_0x303b6f=_0x303b6f===undefined?'':'s='+_0x303b6f;_0x3743dc=_0x3743dc?_0x4860('0x43'):'';return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x44'),_0x28fe3a,_0x22c183,_0x34eb63,_0x4c406c,_0x3743dc,_0x303b6f));};AGIChannel['prototype'][_0x4860('0x45')]=function(_0x51be0d,_0x16737a){_0x16737a=_0x16737a||'';return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x46'),_0x51be0d,_0x16737a));};AGIChannel[_0x4860('0x27')][_0x4860('0x47')]=function(_0x348715){return this[_0x4860('0x2e')](_0x4860('0x48'),_0x348715);};AGIChannel[_0x4860('0x27')][_0x4860('0x49')]=function(_0x47ea4f){return this[_0x4860('0x2e')](_0x4860('0x4a'),_0x47ea4f);};AGIChannel[_0x4860('0x27')][_0x4860('0x1a')]=function(_0x32d953,_0x3c5459){this[_0x4860('0x2b')](util[_0x4860('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x32d953['id'],_0x32d953[_0x4860('0x4b')],_0x3c5459));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4860('0x4c')]=AGIChannel; \ No newline at end of file +var _0x0427=['SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s'];(function(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_0x0427,0x6c));var _0x7042=function(_0x1eebef,_0x11fd05){_0x1eebef=_0x1eebef-0x0;var _0xda5cb1=_0x0427[_0x1eebef];return _0xda5cb1;};'use strict';var util=require(_0x7042('0x0'));var _=require(_0x7042('0x1'));var EventEmitter=require('events')[_0x7042('0x2')];var AGIReply=require(_0x7042('0x3'));var AGIError=require(_0x7042('0x4'));function AGIChannel(_0x40ee39){var _0x5f9c9b=this,_0x5e33c5=new AGIReply(),_0x1ab30e=![],_0x1c9b6f={};EventEmitter[_0x7042('0x5')](_0x5f9c9b);_0x40ee39[_0x7042('0x6')](_0x7042('0x7'));_0x40ee39[_0x7042('0x8')](0x8*0x3c*0x3c*0x3e8);_0x5e33c5[_0x7042('0x6')]('utf8');_0x5e33c5['on'](_0x7042('0x9'),function(_0x258baa){for(var _0x1d34ae in _0x258baa){_0x5f9c9b[_0x1d34ae]=_0x258baa[_0x1d34ae];}_0x5f9c9b[_0x7042('0xa')](_0x7042('0xb'));});_0x5e33c5['on'](_0x7042('0xc'),function(_0x3d5652){if(_0x3d5652['toLowerCase']()=='hangup'){_0x5f9c9b[_0x7042('0xa')](_0x7042('0xd'));return;}if(_0x3d5652[_0x7042('0xe')](0x0,0xb)=='520-Invalid'){_0x1ab30e=!![];}if(_0x1ab30e){_0x1c9b6f['rx']+=_0x3d5652+'\x0a';if(_0x3d5652[_0x7042('0xf')](_0x7042('0x10'))!=-0x1){_0x1ab30e=![];}}else{_0x1c9b6f['rx']=_0x3d5652;}if(_0x1ab30e){return;}if(typeof _0x1c9b6f['cb']==_0x7042('0x11')){var _0x2c2a4b=_0x1c9b6f['rx'][_0x7042('0xe')](0x0,0x3),_0x11f723=null,_0x22e4dd=null;_0x2c2a4b=parseInt(_0x2c2a4b);if(isNaN(_0x2c2a4b)){_0x1c9b6f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7042('0x12')});return;}if(_0x2c2a4b!=0xc8){_0x1c9b6f['cb'](null,{'code':_0x2c2a4b,'result':-0x1,'extra':'KO'});return;}_0x11f723=_0x1c9b6f['rx'][_0x7042('0xe')](0x4)['replace'](_0x7042('0x13'),'');if(_0x11f723[_0x7042('0x14')]('\x20')!=-0x1){_0x11f723=_0x11f723['substr'](0x0,_0x11f723['indexOf']('\x20'));}if(_[_0x7042('0x15')](_0x11f723,'-1')){_0x11f723=parseInt(_0x11f723);}_0x22e4dd=_0x1c9b6f['rx'][_0x7042('0x16')]('\x20');if(_0x22e4dd['length']==0x3){_0x22e4dd=_0x22e4dd[0x2][_0x7042('0xe')](0x1,_0x22e4dd[0x2][_0x7042('0x17')]-0x1);}else if(_0x22e4dd[_0x7042('0x17')]>0x3){var _0x497efe=/\((.+)\)/;var _0x299151=_0x1c9b6f['rx'][_0x7042('0x18')](_0x497efe);if(_0x299151){_0x22e4dd=_0x299151[0x1];}else{_0x22e4dd=null;}}else{_0x22e4dd=null;}_0x1c9b6f['cb'](null,{'code':_0x2c2a4b,'result':_0x11f723,'extra':_0x22e4dd});}});_0x40ee39['on'](_0x7042('0x19'),function(_0x479a0c){_0x5f9c9b[_0x7042('0xa')](_0x7042('0x19'),new AGIError(_0x7042('0x1a'),_0x479a0c[_0x7042('0x1b')]));});_0x40ee39['on'](_0x7042('0x1c'),function(){_0x5f9c9b[_0x7042('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x40ee39['on']('timeout',function(){_0x5f9c9b[_0x7042('0xa')](_0x7042('0x1d'),new AGIError(_0x7042('0x1e')));_0x40ee39[_0x7042('0x1f')]();});_0x40ee39[_0x7042('0x20')](_0x5e33c5);this[_0x7042('0x21')]=function(_0x239cf3,_0x5bbc97){var _0x239cf3=_0x239cf3||'',_0x5bbc97=typeof _0x5bbc97==_0x7042('0x11')?_0x5bbc97:new Function();_0x1c9b6f={'tx':_0x239cf3,'rx':'','cb':_0x5bbc97};_0x40ee39[_0x7042('0x22')](_0x239cf3+'\x0a');},this[_0x7042('0x1c')]=function(){_0x40ee39[_0x7042('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x7042('0x23')][_0x7042('0x24')]=function(_0x42306f){return this['command']['sync'](this,_0x42306f);};AGIChannel[_0x7042('0x23')][_0x7042('0x25')]=function(){return this['sendRequest'](_0x7042('0x26'));};AGIChannel[_0x7042('0x23')][_0x7042('0x27')]=function(_0x1ddc6f,_0x4ec0bf,_0x599bc4){_0x1ddc6f=_0x1ddc6f===undefined?'beep':_0x1ddc6f;_0x4ec0bf=_0x4ec0bf===undefined?'5':_0x4ec0bf;_0x599bc4=_0x599bc4===undefined?'1':_0x599bc4;return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x29'),_0x1ddc6f,_0x4ec0bf*0x3e8,_0x599bc4));};AGIChannel[_0x7042('0x23')][_0x7042('0x2a')]=function(_0x5c4358){_0x5c4358=_0x5c4358||_0x7042('0x2b');return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x2c'),_0x5c4358));};AGIChannel[_0x7042('0x23')]['exec']=function(_0x32cf31,_0x5b10c1){if(_[_0x7042('0x2d')](_0x5b10c1)){return this['sendRequest'](util['format'](_0x7042('0x2e'),_0x32cf31,_0x5b10c1[_0x7042('0x2f')](',')));}return this[_0x7042('0x24')](util['format'](_0x7042('0x2e'),_0x32cf31,_0x5b10c1));};AGIChannel[_0x7042('0x23')][_0x7042('0x30')]=function(_0x3c599c){return this[_0x7042('0x24')](util['format'](_0x7042('0x31'),_0x3c599c));};AGIChannel[_0x7042('0x23')]['setExtension']=function(_0x2f9a7a){return this[_0x7042('0x24')](util['format'](_0x7042('0x32'),_0x2f9a7a));};AGIChannel[_0x7042('0x23')][_0x7042('0x33')]=function(_0x2675a8){return this[_0x7042('0x24')](util[_0x7042('0x28')]('SET\x20PRIORITY\x20%s',_0x2675a8));};AGIChannel[_0x7042('0x23')][_0x7042('0xd')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x7042('0x23')][_0x7042('0x34')]=function(_0x5aa5e0,_0x5a3cd7){var _0x557b9c=_[_0x7042('0x35')](_0x5a3cd7)||_[_0x7042('0x36')](_0x5a3cd7)?_0x5a3cd7['toString']():_0x5a3cd7;return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x37'),_0x5aa5e0,_0x557b9c?_0x557b9c[_0x7042('0x38')]()[_0x7042('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7042('0x23')][_0x7042('0x3a')]=function(_0x59a0b8,_0x266197){return this['sendRequest'](util[_0x7042('0x28')](_0x7042('0x3b'),_0x59a0b8,_0x266197));};AGIChannel[_0x7042('0x23')]['sayDigits']=function(_0x45aaef,_0xb1acee){return this['sendRequest'](util['format'](_0x7042('0x3c'),_0x45aaef,_0xb1acee));};AGIChannel[_0x7042('0x23')][_0x7042('0x3d')]=function(_0x2c891b,_0x1153e7){return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x3e'),_0x2c891b,_0x1153e7));};AGIChannel[_0x7042('0x23')][_0x7042('0x3f')]=function(_0x7fa648,_0x5b6a63,_0x27c813){_0x5b6a63=_0x5b6a63||this['extension'];_0x27c813=_0x27c813||0x1;this['setContext'](_0x7fa648);this[_0x7042('0x40')](_0x5b6a63);this['setPriority'](_0x27c813);return this[_0x7042('0x2a')](util[_0x7042('0x28')](_0x7042('0x41'),_0x7fa648,_0x5b6a63,_0x27c813));};AGIChannel[_0x7042('0x23')][_0x7042('0x42')]=function(_0x570db1){return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x43'),_0x570db1));};AGIChannel['prototype'][_0x7042('0x44')]=function(_0x5de4ba,_0x2fd47c,_0x15d0fd,_0x3d6d8a,_0x3fd9c0,_0x345f25){_0x2fd47c=_0x2fd47c||'wav';_0x15d0fd=_0x15d0fd||'';_0x3d6d8a=_0x3d6d8a===undefined?-0x1:_0x3d6d8a==='-1'?-0x1:_0x3d6d8a*0x3e8;_0x3fd9c0=_0x3fd9c0===undefined?'':'s='+_0x3fd9c0;_0x345f25=_0x345f25?'BEEP':'';return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x45'),_0x5de4ba,_0x2fd47c,_0x15d0fd,_0x3d6d8a,_0x345f25,_0x3fd9c0));};AGIChannel[_0x7042('0x23')][_0x7042('0x46')]=function(_0x2675ca,_0x215346){_0x215346=_0x215346||'';return this['sendRequest'](util[_0x7042('0x28')](_0x7042('0x47'),_0x2675ca,_0x215346));};AGIChannel['prototype']['agi']=function(_0x178395){return this[_0x7042('0x48')](_0x7042('0x49'),_0x178395);};AGIChannel[_0x7042('0x23')][_0x7042('0x4a')]=function(_0x256ed2){return this['exec'](_0x7042('0x4b'),_0x256ed2);};AGIChannel['prototype'][_0x7042('0x19')]=function(_0xef9be9,_0x23d7ca){this[_0x7042('0x2a')](util[_0x7042('0x28')](_0x7042('0x4c'),_0xef9be9['id'],_0xef9be9[_0x7042('0x4d')],_0x23d7ca));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7042('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 2bb98cb..4252e60 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 _0x92f7=['exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name'];(function(_0x526aa6,_0x29e8cb){var _0x245735=function(_0xae5def){while(--_0xae5def){_0x526aa6['push'](_0x526aa6['shift']());}};_0x245735(++_0x29e8cb);}(_0x92f7,0x1c1));var _0x792f=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0x92f7[_0x1138c4];return _0x200cc1;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x792f('0x0'),'E_AGI_SERVER_ERROR':_0x792f('0x1'),'E_AGI_SERVER_CLOSE':_0x792f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x792f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x792f('0x4'),'E_AGI_SOCKET_ERROR':_0x792f('0x5'),'E_AGI_SOCKET_CLOSE':_0x792f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x792f('0x7'),'E_AGI_COMMAND_EMPTY':_0x792f('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x792f('0x9'),'E_AGI_IVR_ENTRY':_0x792f('0xa')};function AGIError(_0x494907){var _0x494907=_0x494907||null,_0x508ca0=_0x508ca0||[],_0x472abe=0x1,_0x4c774f='';if(!error[_0x494907]){_0x494907=_0x792f('0xb');}_0x508ca0[_0x792f('0xc')](error[_0x494907]);while(arguments[_0x472abe]){_0x508ca0[_0x792f('0xc')](arguments[_0x472abe]);_0x472abe++;}_0x4c774f=util[_0x792f('0xd')]['apply'](util,_0x508ca0);this['message']=_0x4c774f;this[_0x792f('0xe')]=_0x494907;}module[_0x792f('0xf')]=AGIError; \ No newline at end of file +var _0x6321=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.'];(function(_0x5bcf1d,_0x4ddf5d){var _0x10655a=function(_0x2cbcc0){while(--_0x2cbcc0){_0x5bcf1d['push'](_0x5bcf1d['shift']());}};_0x10655a(++_0x4ddf5d);}(_0x6321,0xe9));var _0x1632=function(_0x291780,_0x2fc1d8){_0x291780=_0x291780-0x0;var _0x58dae5=_0x6321[_0x291780];return _0x58dae5;};'use strict';var util=require(_0x1632('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x1632('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1632('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x1632('0x3'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1632('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1632('0x5'),'E_AGI_IVR_ENTRY':_0x1632('0x6')};function AGIError(_0x165947){var _0x165947=_0x165947||null,_0x22723c=_0x22723c||[],_0x33576c=0x1,_0x509b99='';if(!error[_0x165947]){_0x165947=_0x1632('0x7');}_0x22723c[_0x1632('0x8')](error[_0x165947]);while(arguments[_0x33576c]){_0x22723c[_0x1632('0x8')](arguments[_0x33576c]);_0x33576c++;}_0x509b99=util[_0x1632('0x9')][_0x1632('0xa')](util,_0x22723c);this[_0x1632('0xb')]=_0x509b99;this[_0x1632('0xc')]=_0x165947;}module[_0x1632('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0ff0fd3..6c92826 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d27=['EventEmitter','ioredis','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x5d27,0x13a));var _0x75d2=function(_0x8d244d,_0x49c04a){_0x8d244d=_0x8d244d-0x0;var _0x30fcd2=_0x5d27[_0x8d244d];return _0x30fcd2;};'use strict';var _=require(_0x75d2('0x0'));var EventEmitter=require('events')[_0x75d2('0x1')];var Redis=require(_0x75d2('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x75d2('0x3')]=_[_0x75d2('0x4')](config[_0x75d2('0x3')],{'host':_0x75d2('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x75d2('0x6')]('agi',function(_0x2a0e3c){if(_0x2a0e3c)return eventEmitter[_0x75d2('0x7')](_0x75d2('0x8'),new AGIError(_0x75d2('0x9'),_0x2a0e3c));});sub['on'](_0x75d2('0xa'),function(_0x14ac1d,_0xcf32cd){if(_0x14ac1d!==_0x75d2('0xb'))return;try{var _0x3957c0=JSON[_0x75d2('0xc')](_0xcf32cd);eventEmitter[_0x75d2('0x7')](_0x75d2('0xd'),_0x3957c0);}catch(_0x2bc3c4){eventEmitter[_0x75d2('0x7')](_0x75d2('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x2bc3c4));}});module[_0x75d2('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa3bc=['lodash','events','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports'];(function(_0x432ccd,_0x51dbdc){var _0x4c56c6=function(_0xbc77ad){while(--_0xbc77ad){_0x432ccd['push'](_0x432ccd['shift']());}};_0x4c56c6(++_0x51dbdc);}(_0xa3bc,0x1dc));var _0xca3b=function(_0x280377,_0x453032){_0x280377=_0x280377-0x0;var _0x2e6703=_0xa3bc[_0x280377];return _0x2e6703;};'use strict';var _=require(_0xca3b('0x0'));var EventEmitter=require(_0xca3b('0x1'))['EventEmitter'];var Redis=require(_0xca3b('0x2'));var AGIError=require(_0xca3b('0x3'));var config=require(_0xca3b('0x4'));config[_0xca3b('0x5')]=_[_0xca3b('0x6')](config[_0xca3b('0x5')],{'host':_0xca3b('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xca3b('0x5')]);sub[_0xca3b('0x8')](_0xca3b('0x9'),function(_0x374184){if(_0x374184)return eventEmitter[_0xca3b('0xa')](_0xca3b('0xb'),new AGIError(_0xca3b('0xc'),_0x374184));});sub['on'](_0xca3b('0xd'),function(_0x297da7,_0x33b569){if(_0x297da7!=='agi')return;try{var _0x5eaee3=JSON[_0xca3b('0xe')](_0x33b569);eventEmitter[_0xca3b('0xa')](_0xca3b('0xf'),_0x5eaee3);}catch(_0x85d3e0){eventEmitter[_0xca3b('0xa')]('error',new AGIError(_0xca3b('0xc'),_0x85d3e0));}});module[_0xca3b('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index bab93ec..aec4ffc 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 _0x1cbe=['edges','prototype','addVertex','vertices','addEdge','push','numberOfEdges','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','target','default','agicommand','invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0x10ae4a,_0x103de6){var _0x24cbb8=function(_0x50f543){while(--_0x50f543){_0x10ae4a['push'](_0x10ae4a['shift']());}};_0x24cbb8(++_0x103de6);}(_0x1cbe,0x1c9));var _0xe1cb=function(_0x29ed07,_0x54ee3f){_0x29ed07=_0x29ed07-0x0;var _0xa75d4b=_0x1cbe[_0x29ed07];return _0xa75d4b;};'use strict';var _=require(_0xe1cb('0x0'));var logger=require(_0xe1cb('0x1'))(_0xe1cb('0x2'));var verticesWithRetry=[_0xe1cb('0x3'),_0xe1cb('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0xe1cb('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xe1cb('0x6')][_0xe1cb('0x7')]=function(_0x265ecf){this[_0xe1cb('0x8')][_0x265ecf['id']]=_0x265ecf;this[_0xe1cb('0x5')][_0x265ecf['id']]=[];};Graph[_0xe1cb('0x6')][_0xe1cb('0x9')]=function(_0x1860ee,_0x6190e5,_0x4fb091){this['edges'][_0x1860ee][_0xe1cb('0xa')]({'target':_0x6190e5,'condition':_0x4fb091});this[_0xe1cb('0xb')]+=0x1;};Graph[_0xe1cb('0x6')][_0xe1cb('0xc')]=function(){return _[_0xe1cb('0xc')](this[_0xe1cb('0x8')]);};Graph[_0xe1cb('0x6')][_0xe1cb('0xd')]=function(){return this[_0xe1cb('0xb')];};Graph[_0xe1cb('0x6')][_0xe1cb('0xe')]=function(_0x2c821a){return this[_0xe1cb('0x8')][_0x2c821a];};Graph[_0xe1cb('0x6')]['traverseBFS']=function(_0x346128,_0x34b7aa){if(!this[_0xe1cb('0x8')][_0x346128]){return logger[_0xe1cb('0xf')](_0xe1cb('0x10'));}var _0x1cc2ff=_0x34b7aa(this[_0xe1cb('0x8')][_0x346128]);if(!_0x1cc2ff){return logger[_0xe1cb('0xf')](_0xe1cb('0x11'));}if(this[_0xe1cb('0x5')][_0x346128][_0xe1cb('0x12')]===0x0){return logger[_0xe1cb('0xf')](_0xe1cb('0x13'));}for(var _0x8f3954=0x0,_0x251aef=[],_0x823d4d=![];_0x8f3954\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2c46d5,_0xe2384c){var _0x5c4088=function(_0x132d40){while(--_0x132d40){_0x2c46d5['push'](_0x2c46d5['shift']());}};_0x5c4088(++_0xe2384c);}(_0xac32,0x183));var _0x2ac3=function(_0x15a7dc,_0x228979){_0x15a7dc=_0x15a7dc-0x0;var _0x4f21bf=_0xac32[_0x15a7dc];return _0x4f21bf;};'use strict';var _=require(_0x2ac3('0x0'));var syncho=require(_0x2ac3('0x1'));var util=require(_0x2ac3('0x2'));var config=require(_0x2ac3('0x3'));var logger=require('../../config/logger')(_0x2ac3('0x4'));var utilLicense=require(_0x2ac3('0x5'));var rpc=require('./rpc');var Project=require(_0x2ac3('0x6'));var AGIEmitter=require(_0x2ac3('0x7'))[_0x2ac3('0x8')];var projects=[];config[_0x2ac3('0x4')]=_[_0x2ac3('0x9')](config[_0x2ac3('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x2ac3('0xa'),projectUpdateHandler);function connectionHandler(_0x5569a7){process[_0x2ac3('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5569a7);agiHandler(_0x5569a7);}catch(_0x13c283){logger[_0x2ac3('0xc')](_0x13c283[_0x2ac3('0xd')]);}});});}function projectUpdateHandler(_0xa796b){try{var _0x6a91c2=_[_0x2ac3('0xe')](projects,['id',_0xa796b['id']]);if(_0x6a91c2>-0x1){if(_0xa796b[_0x2ac3('0xf')]===!![]){projects[_0x2ac3('0x10')](_0x6a91c2,0x1);}else{projects[_0x6a91c2]=_0xa796b;}}else{projects['push'](_0xa796b);}}catch(_0x512971){logger[_0x2ac3('0xc')](_0x512971[_0x2ac3('0xd')]);}}function listeningHandler(){var _0x4b9947=config[_0x2ac3('0x11')]===_0x2ac3('0x12')||![];console['log'](_0x2ac3('0x13'),config[_0x2ac3('0x4')]['port']);logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x16'),_0x4b9947?config['agi']['ip']:_0x2ac3('0x17'),config[_0x2ac3('0x4')][_0x2ac3('0x18')]));}function errorHandler(_0x5b66c8){if(_0x5b66c8&&_0x5b66c8[_0x2ac3('0x19')]&&_0x5b66c8[_0x2ac3('0x1a')]){logger[_0x2ac3('0xc')](util['format'](_0x2ac3('0x1b'),_0x5b66c8[_0x2ac3('0x19')],_0x5b66c8[_0x2ac3('0x1a')]));}else{logger[_0x2ac3('0xc')](util[_0x2ac3('0x15')](_0x2ac3('0x1c'),_0x5b66c8['stack']));}}function closeHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x1d'),this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this[_0x2ac3('0x20')],this[_0x2ac3('0x21')],this[_0x2ac3('0x22')]));try{createSquareReport(this);}catch(_0x1ce97d){logger['error'](_0x1ce97d['stack']);}}function timeoutHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x23'),this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this[_0x2ac3('0x20')],this[_0x2ac3('0x21')],this[_0x2ac3('0x22')]));}function hangupHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this['callerid'],this[_0x2ac3('0x21')],this['uniqueid']));this[_0x2ac3('0x24')]=!![];}function createSquareReport(_0x2e3fbb,_0x175cc9){rpc[_0x2ac3('0x25')](_0x2e3fbb)['then'](function(_0xd09fa5){if(_0x175cc9){_0x175cc9(null,_0xd09fa5);}})[_0x2ac3('0x26')](function(_0x19de49){if(_0x175cc9){_0x175cc9(null,_0x19de49);}});}function setChannelVariables(_0x4e04a3){for(var _0x3e3f9f in _0x4e04a3){if(_0x4e04a3[_0x2ac3('0x27')](_0x3e3f9f)){if(_0x3e3f9f[_0x2ac3('0x28')](_0x2ac3('0x29'))===0x0){_0x4e04a3[_0x3e3f9f[_0x2ac3('0x2a')](0x4)]=_0x4e04a3[_0x3e3f9f];delete _0x4e04a3[_0x3e3f9f];}}}}function agiHandler(_0x1e8088){logger[_0x2ac3('0x2b')](_0x2ac3('0x2c'),JSON[_0x2ac3('0x2d')](_0x1e8088,null,0x2));logger[_0x2ac3('0x14')](util['format'](_0x2ac3('0x2e'),_0x1e8088['arg_1'],_0x1e8088[_0x2ac3('0x1f')],_0x1e8088[_0x2ac3('0x20')],_0x1e8088[_0x2ac3('0x21')],_0x1e8088[_0x2ac3('0x22')]));_0x1e8088['on'](_0x2ac3('0xc'),errorHandler);_0x1e8088['on'](_0x2ac3('0x2f'),closeHandler);_0x1e8088['on']('timeout',timeoutHandler);_0x1e8088[_0x2ac3('0x24')]=![];_0x1e8088['on'](_0x2ac3('0x30'),hangupHandler);var _0x2e342a=_[_0x2ac3('0x31')](projects,[_0x2ac3('0x19'),_0x1e8088[_0x2ac3('0x1e')]]);if(!_0x2e342a)return Project[_0x2ac3('0x32')](_0x1e8088);if(!_0x2e342a[_0x2ac3('0x12')])return Project[_0x2ac3('0x33')](_0x1e8088);return Project[_0x2ac3('0x34')](_0x2e342a,_0x1e8088);}function main(){var _0x3e3a54;return utilLicense[_0x2ac3('0x35')]()['then'](function(_0xcacbb3){if(!_0xcacbb3)return;if(_0xcacbb3['voice']){if(_0xcacbb3[_0x2ac3('0x36')]&&_0xcacbb3[_0x2ac3('0x36')]>0x0){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0xcacbb3[_0x2ac3('0x36')]));_0x3e3a54=_0xcacbb3['callysquare'];}else{logger[_0x2ac3('0x14')](_0x2ac3('0x37'));}}else{logger[_0x2ac3('0x14')](_0x2ac3('0x38'));_0x3e3a54=-0x1;}})[_0x2ac3('0x39')](function(){return Project['getAll']();})[_0x2ac3('0x39')](function(_0xc0a06d){projects=_0xc0a06d;return;})[_0x2ac3('0x26')](function(_0x32493){logger['error'](_0x2ac3('0x3a'),_0x32493[_0x2ac3('0xd')]);})['finally'](function(){var _0x2a7987=require(_0x2ac3('0x3b'))(config[_0x2ac3('0x4')][_0x2ac3('0x18')],config['agi']['ip'],_0x3e3a54);_0x2a7987['on'](_0x2ac3('0xc'),errorHandler);_0x2a7987['on'](_0x2ac3('0x3c'),listeningHandler);_0x2a7987['on'](_0x2ac3('0x3d'),connectionHandler);_0x2a7987['on'](_0x2ac3('0x2f'),closeHandler);});}main(); \ No newline at end of file +var _0xd95c=['env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','host.docker.internal','port','name','error','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','calleridname','close','timeout','hangup','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/environment','agi','./project','./events','EventEmitter','projectUpdate','nextTick','stack','findIndex','deleted','splice','push'];(function(_0x4b6bfe,_0x4356cb){var _0x1ceecc=function(_0x192914){while(--_0x192914){_0x4b6bfe['push'](_0x4b6bfe['shift']());}};_0x1ceecc(++_0x4356cb);}(_0xd95c,0x65));var _0xcd95=function(_0x1c3cbe,_0x2725e4){_0x1c3cbe=_0x1c3cbe-0x0;var _0x4aee5d=_0xd95c[_0x1c3cbe];return _0x4aee5d;};'use strict';var _=require(_0xcd95('0x0'));var syncho=require(_0xcd95('0x1'));var util=require(_0xcd95('0x2'));var config=require(_0xcd95('0x3'));var logger=require('../../config/logger')(_0xcd95('0x4'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xcd95('0x5'));var AGIEmitter=require(_0xcd95('0x6'))[_0xcd95('0x7')];var projects=[];config['agi']=_['defaults'](config[_0xcd95('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xcd95('0x8'),projectUpdateHandler);function connectionHandler(_0x22f791){process[_0xcd95('0x9')](function(){syncho(function(){try{setChannelVariables(_0x22f791);agiHandler(_0x22f791);}catch(_0x2658cd){logger['error'](_0x2658cd[_0xcd95('0xa')]);}});});}function projectUpdateHandler(_0x56560b){try{var _0x2b7c5b=_[_0xcd95('0xb')](projects,['id',_0x56560b['id']]);if(_0x2b7c5b>-0x1){if(_0x56560b[_0xcd95('0xc')]===!![]){projects[_0xcd95('0xd')](_0x2b7c5b,0x1);}else{projects[_0x2b7c5b]=_0x56560b;}}else{projects[_0xcd95('0xe')](_0x56560b);}}catch(_0xd5c4f2){logger['error'](_0xd5c4f2[_0xcd95('0xa')]);}}function listeningHandler(){var _0xdfe4e1=config[_0xcd95('0xf')]===_0xcd95('0x10')||![];console['log'](_0xcd95('0x11'),config['agi']['port']);logger[_0xcd95('0x12')](util[_0xcd95('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0xdfe4e1?config['agi']['ip']:_0xcd95('0x14'),config[_0xcd95('0x4')][_0xcd95('0x15')]));}function errorHandler(_0x19acf1){if(_0x19acf1&&_0x19acf1[_0xcd95('0x16')]&&_0x19acf1['message']){logger[_0xcd95('0x17')](util[_0xcd95('0x13')](_0xcd95('0x18'),_0x19acf1[_0xcd95('0x16')],_0x19acf1[_0xcd95('0x19')]));}else{logger['error'](util[_0xcd95('0x13')](_0xcd95('0x1a'),_0x19acf1[_0xcd95('0xa')]));}}function closeHandler(){logger[_0xcd95('0x12')](util['format'](_0xcd95('0x1b'),this[_0xcd95('0x1c')],this['calleridname'],this['callerid'],this[_0xcd95('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x32457e){logger['error'](_0x32457e['stack']);}}function timeoutHandler(){logger[_0xcd95('0x12')](util[_0xcd95('0x13')](_0xcd95('0x1e'),this[_0xcd95('0x1c')],this['calleridname'],this[_0xcd95('0x1f')],this['dnid'],this[_0xcd95('0x20')]));}function hangupHandler(){logger['info'](util['format'](_0xcd95('0x21'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xcd95('0x1d')],this[_0xcd95('0x20')]));this[_0xcd95('0x22')]=!![];}function createSquareReport(_0x3177bb,_0x36da85){rpc[_0xcd95('0x23')](_0x3177bb)[_0xcd95('0x24')](function(_0x1bffa3){if(_0x36da85){_0x36da85(null,_0x1bffa3);}})[_0xcd95('0x25')](function(_0x4b1d40){if(_0x36da85){_0x36da85(null,_0x4b1d40);}});}function setChannelVariables(_0x46701d){for(var _0x10b3ea in _0x46701d){if(_0x46701d[_0xcd95('0x26')](_0x10b3ea)){if(_0x10b3ea[_0xcd95('0x27')]('agi_')===0x0){_0x46701d[_0x10b3ea[_0xcd95('0x28')](0x4)]=_0x46701d[_0x10b3ea];delete _0x46701d[_0x10b3ea];}}}}function agiHandler(_0x42b203){logger[_0xcd95('0x29')](_0xcd95('0x2a'),JSON[_0xcd95('0x2b')](_0x42b203,null,0x2));logger['info'](util[_0xcd95('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42b203[_0xcd95('0x1c')],_0x42b203[_0xcd95('0x2c')],_0x42b203[_0xcd95('0x1f')],_0x42b203['dnid'],_0x42b203['uniqueid']));_0x42b203['on'](_0xcd95('0x17'),errorHandler);_0x42b203['on'](_0xcd95('0x2d'),closeHandler);_0x42b203['on'](_0xcd95('0x2e'),timeoutHandler);_0x42b203[_0xcd95('0x22')]=![];_0x42b203['on'](_0xcd95('0x2f'),hangupHandler);var _0x1c7f1b=_['find'](projects,[_0xcd95('0x16'),_0x42b203['arg_1']]);if(!_0x1c7f1b)return Project['handleNotFound'](_0x42b203);if(!_0x1c7f1b['production'])return Project[_0xcd95('0x30')](_0x42b203);return Project[_0xcd95('0x31')](_0x1c7f1b,_0x42b203);}function main(){var _0x2f525d;return utilLicense['getLicense']()[_0xcd95('0x24')](function(_0x5ad2ea){if(!_0x5ad2ea)return;if(_0x5ad2ea[_0xcd95('0x32')]){if(_0x5ad2ea[_0xcd95('0x33')]&&_0x5ad2ea[_0xcd95('0x33')]>0x0){logger[_0xcd95('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5ad2ea[_0xcd95('0x33')]));_0x2f525d=_0x5ad2ea[_0xcd95('0x33')];}else{logger['info'](_0xcd95('0x34'));}}else{logger[_0xcd95('0x12')](_0xcd95('0x35'));_0x2f525d=-0x1;}})['then'](function(){return Project['getAll']();})['then'](function(_0x41f876){projects=_0x41f876;return;})[_0xcd95('0x25')](function(_0xd4a7d9){logger['error'](_0xcd95('0x36'),_0xd4a7d9[_0xcd95('0xa')]);})['finally'](function(){var _0x5bbd72=require(_0xcd95('0x37'))(config[_0xcd95('0x4')]['port'],config['agi']['ip'],_0x2f525d);_0x5bbd72['on'](_0xcd95('0x17'),errorHandler);_0x5bbd72['on'](_0xcd95('0x38'),listeningHandler);_0x5bbd72['on'](_0xcd95('0x39'),connectionHandler);_0x5bbd72['on']('close',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 d18aeb2..22e2d27 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 _0x6f07=['client','http','request','then','error','message','result','catch','bluebird'];(function(_0x38306c,_0x4f3df2){var _0x40a472=function(_0x1d08b5){while(--_0x1d08b5){_0x38306c['push'](_0x38306c['shift']());}};_0x40a472(++_0x4f3df2);}(_0x6f07,0x19d));var _0x76f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6f07[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0x76f0('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x76f0('0x1')][_0x76f0('0x2')]({'port':0x232b});function request(_0x1addb6,_0x1fe603){return new BPromise(function(_0x418d96,_0x2e0721){return client[_0x76f0('0x3')](_0x1addb6,_0x1fe603)[_0x76f0('0x4')](function(_0x3e1be8){if(_0x3e1be8[_0x76f0('0x5')]){return _0x2e0721(_0x3e1be8[_0x76f0('0x5')][_0x76f0('0x6')]);}else{return _0x418d96(_0x3e1be8[_0x76f0('0x7')]);}})[_0x76f0('0x8')](function(_0x52a009){return _0x2e0721(_0x52a009);});});}exports['sendMailMessage']=function(_0x2f1be1,_0x3321a0){return request('SendMail',{'account':_0x2f1be1,'message':_0x3321a0});}; \ No newline at end of file +var _0x048d=['bluebird','client','http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x46f804,_0x4e5334){var _0x20b6c9=function(_0x1d4140){while(--_0x1d4140){_0x46f804['push'](_0x46f804['shift']());}};_0x20b6c9(++_0x4e5334);}(_0x048d,0x171));var _0xd048=function(_0x49fda7,_0x1d84db){_0x49fda7=_0x49fda7-0x0;var _0x4c6f1f=_0x048d[_0x49fda7];return _0x4c6f1f;};'use strict';var BPromise=require(_0xd048('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xd048('0x1')][_0xd048('0x2')]({'port':0x232b});function request(_0x14b00c,_0x2aa602){return new BPromise(function(_0x1d7f5b,_0x3933e5){return client[_0xd048('0x3')](_0x14b00c,_0x2aa602)['then'](function(_0x1b327f){if(_0x1b327f[_0xd048('0x4')]){return _0x3933e5(_0x1b327f[_0xd048('0x4')][_0xd048('0x5')]);}else{return _0x1d7f5b(_0x1b327f[_0xd048('0x6')]);}})['catch'](function(_0x59469c){return _0x3933e5(_0x59469c);});});}exports[_0xd048('0x7')]=function(_0x131252,_0x5733bb){return request(_0xd048('0x8'),{'account':_0x131252,'message':_0x5733bb});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 1725e15..a6d7879 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0be=['target','value','mxGraphModel','inspect','start','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','moment','xml2json','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xb0be,0xa3));var _0xeb0b=function(_0x59c765,_0x1b14cb){_0x59c765=_0x59c765-0x0;var _0x731b6d=_0xb0be[_0x59c765];return _0x731b6d;};'use strict';var _=require('lodash');var moment=require(_0xeb0b('0x0'));var parser=require(_0xeb0b('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xeb0b('0x2'));var rpc=require('./rpc');var mailRpc=require(_0xeb0b('0x3'));var Graph=require(_0xeb0b('0x4'));var Vertices=require(_0xeb0b('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xeb0b('0x6')]()[_0xeb0b('0x7')](function(_0x14224e){logger[_0xeb0b('0x8')](_0xeb0b('0x9'),_0x14224e[_0xeb0b('0xa')]);return[];});}function addVertex(_0x11feb6,_0xd48e22,_0x2269e0){_0xd48e22[_0xeb0b('0xb')]=_0x2269e0;if(_0xd48e22['hasOwnProperty'](_0xeb0b('0xc'))){_0xd48e22[_0xeb0b('0xd')]=parseInt(_0xd48e22['retry'],0xa);}_0x11feb6[_0xeb0b('0xe')](_[_0xeb0b('0xf')](_0xd48e22,'mxCell'));}function initGraph(_0x8c49f3,_0x253d2f){var _0x5b4114=new Graph();for(var _0x16b992 in _0x8c49f3){if(_0x8c49f3[_0xeb0b('0x10')](_0x16b992)){if(_[_0xeb0b('0x11')](_0x8c49f3[_0x16b992])){for(var _0x3a80ef=0x0;_0x3a80ef<_0x8c49f3[_0x16b992]['length'];_0x3a80ef+=0x1){addVertex(_0x5b4114,_0x8c49f3[_0x16b992][_0x3a80ef],_0x16b992);}}else{addVertex(_0x5b4114,_0x8c49f3[_0x16b992],_0x16b992);}}}for(var _0x2b0ca4=0x0;_0x2b0ca4<_0x253d2f[_0xeb0b('0x12')];_0x2b0ca4+=0x1){if(_0x253d2f[_0x2b0ca4][_0xeb0b('0x13')]&&_0x253d2f[_0x2b0ca4]['target']){_0x5b4114['addEdge'](_0x253d2f[_0x2b0ca4][_0xeb0b('0x13')],_0x253d2f[_0x2b0ca4][_0xeb0b('0x14')],_0x253d2f[_0x2b0ca4][_0xeb0b('0x15')]);}}return _0x5b4114;}function getRoot(_0x2a75b0){return parser['toJson'](_0x2a75b0,{'object':!![]})[_0xeb0b('0x16')]['root'];}function inspect(_0x33a675){return util[_0xeb0b('0x17')](_0x33a675,{'showHidden':![],'depth':null});}function initialize(_0x460e10,_0x371608){var _0x1a1e81=getRoot(_0x460e10['production']);if(!_0x1a1e81||!_0x1a1e81[_0xeb0b('0x18')])return;var _0x231e1b,_0x59e913,_0x31351f;logger['debug'](_0xeb0b('0x19'),JSON['stringify'](_0x1a1e81,null,0x2));_0x371608[_0xeb0b('0x1a')]=moment()[_0xeb0b('0x1b')](_0xeb0b('0x1c'));_0x231e1b=initGraph(_['omit'](_0x1a1e81,_0xeb0b('0x1d')),_0x1a1e81[_0xeb0b('0x1d')]);_0x59e913=new Vertices(_0x371608,rpc,mailRpc);logger[_0xeb0b('0x1e')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x371608[_0xeb0b('0x1f')],_0x371608[_0xeb0b('0x20')],_0x371608['callerid'],_0x371608[_0xeb0b('0x21')],_0x371608['uniqueid']));_0x231e1b[_0xeb0b('0x22')](_0x1a1e81[_0xeb0b('0x18')]['id'],function(_0x45a79e){try{_0x45a79e=_0x59e913[_0xeb0b('0x23')](_0x45a79e);logger[_0xeb0b('0x24')](_0xeb0b('0x25'),JSON[_0xeb0b('0x26')](_0x45a79e,null,0x2));if(_0x45a79e[_0xeb0b('0xb')]===_0xeb0b('0x27')){logger[_0xeb0b('0x1e')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x371608[_0xeb0b('0x28')]=_0x45a79e[_0xeb0b('0x28')]||_0x371608[_0xeb0b('0x28')];_0x371608['extension']=_0x45a79e[_0xeb0b('0x29')];_0x371608['priority']=_0x45a79e['priority']?_0x45a79e[_0xeb0b('0x2a')]-0x1:0x1;return null;}else if(_0x45a79e&&_0x59e913[_0x45a79e['agicommand']]){_0x31351f=_0x59e913[_0x45a79e['agicommand']](_0x45a79e);logger['info']('response',JSON[_0xeb0b('0x26')](_0x31351f,null,0x2));if(_0x31351f&&_0x31351f[_0xeb0b('0x2b')]===AGI_CODE_SUCCESS&&_0x31351f[_0xeb0b('0x2c')]!==AGI_RESULT_ERROR&&!_0x371608[_0xeb0b('0x2d')]){logger[_0xeb0b('0x24')](_0xeb0b('0x2e'),inspect(_0x31351f));return _[_0xeb0b('0x2f')](_0x31351f[_0xeb0b('0x2c')])?null:_0x31351f[_0xeb0b('0x2c')][_0xeb0b('0x30')]();}else{logger[_0xeb0b('0x8')]('response',inspect(_0x31351f));return null;}}else{logger['error'](_0xeb0b('0x31'));return null;}}catch(_0x2d61a1){logger['error'](_0x2d61a1[_0xeb0b('0xa')]);return null;}});if(_0x1a1e81[_0xeb0b('0x32')]){logger[_0xeb0b('0x1e')](util['format'](_0xeb0b('0x33'),_0x371608[_0xeb0b('0x1f')],_0x371608[_0xeb0b('0x20')],_0x371608[_0xeb0b('0x34')],_0x371608[_0xeb0b('0x21')],_0x371608[_0xeb0b('0x35')]));_0x231e1b[_0xeb0b('0x22')](_0x1a1e81['finally']['id'],function(_0x46c72c){try{_0x46c72c=_0x59e913[_0xeb0b('0x23')](_0x46c72c);logger[_0xeb0b('0x24')](_0xeb0b('0x25'),JSON[_0xeb0b('0x26')](_0x46c72c,null,0x2));if(_0x46c72c&&_0x59e913[_0x46c72c[_0xeb0b('0xb')]]){_0x31351f=_0x59e913[_0x46c72c[_0xeb0b('0xb')]](_0x46c72c);if(_0x31351f){logger['debug'](_0xeb0b('0x2e'),inspect(_0x31351f));return _[_0xeb0b('0x2f')](_0x31351f['result'])?null:_0x31351f[_0xeb0b('0x2c')][_0xeb0b('0x30')]();}else{logger[_0xeb0b('0x8')]('response',inspect(_0x31351f));return null;}}else{logger[_0xeb0b('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0xf6e576){logger[_0xeb0b('0x8')](_0xf6e576[_0xeb0b('0xa')]);return null;}});}logger[_0xeb0b('0x1e')](util['format'](_0xeb0b('0x36'),_0x371608['arg_1'],_0x371608[_0xeb0b('0x20')],_0x371608[_0xeb0b('0x34')],_0x371608['dnid'],_0x371608[_0xeb0b('0x35')]));logger[_0xeb0b('0x1e')](util[_0xeb0b('0x1b')](_0xeb0b('0x37'),_0x371608['context'],_0x371608[_0xeb0b('0x29')],parseInt(_0x371608[_0xeb0b('0x2a')],0xa)+0x1));_0x371608[_0xeb0b('0x38')](_0x371608[_0xeb0b('0x28')],_0x371608['extension'],parseInt(_0x371608['priority'],0xa)+0x1);_0x371608['close']();}function handleNotFound(_0x367195){logger[_0xeb0b('0x8')](util[_0xeb0b('0x1b')](_0xeb0b('0x39'),_0x367195[_0xeb0b('0x1f')]));_0x367195['continueAt'](_0x367195[_0xeb0b('0x28')],_0x367195[_0xeb0b('0x29')],parseInt(_0x367195[_0xeb0b('0x2a')],0xa)+0x1);_0x367195['close']();}function handleUnpublished(_0x58eda7){logger[_0xeb0b('0x8')](util[_0xeb0b('0x1b')](_0xeb0b('0x3a'),_0x58eda7['arg_1']));_0x58eda7[_0xeb0b('0x38')](_0x58eda7[_0xeb0b('0x28')],_0x58eda7[_0xeb0b('0x29')],parseInt(_0x58eda7[_0xeb0b('0x2a')],0xa)+0x1);_0x58eda7[_0xeb0b('0x3b')]();}module[_0xeb0b('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x9dc4=['gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','addEdge','source','value','toJson','inspect','production','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','calleridname','dnid','uniqueid','traverseBFS','start','vertex','agicommand','gotoc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9dc4,0x166));var _0x49dc=function(_0x1605bc,_0x582823){_0x1605bc=_0x1605bc-0x0;var _0x48c10a=_0x9dc4[_0x1605bc];return _0x48c10a;};'use strict';var _=require('lodash');var moment=require(_0x49dc('0x0'));var parser=require(_0x49dc('0x1'));var util=require(_0x49dc('0x2'));var logger=require(_0x49dc('0x3'))(_0x49dc('0x4'));var rpc=require(_0x49dc('0x5'));var mailRpc=require(_0x49dc('0x6'));var Graph=require(_0x49dc('0x7'));var Vertices=require(_0x49dc('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x49dc('0x9')]()['catch'](function(_0x29b611){logger[_0x49dc('0xa')](_0x49dc('0xb'),_0x29b611[_0x49dc('0xc')]);return[];});}function addVertex(_0x1be2ea,_0x6b8a5c,_0x318eb6){_0x6b8a5c['agicommand']=_0x318eb6;if(_0x6b8a5c['hasOwnProperty'](_0x49dc('0xd'))){_0x6b8a5c[_0x49dc('0xe')]=parseInt(_0x6b8a5c[_0x49dc('0xd')],0xa);}_0x1be2ea[_0x49dc('0xf')](_['omit'](_0x6b8a5c,_0x49dc('0x10')));}function initGraph(_0xb8ad0d,_0x298af0){var _0x57f230=new Graph();for(var _0x2a0319 in _0xb8ad0d){if(_0xb8ad0d[_0x49dc('0x11')](_0x2a0319)){if(_[_0x49dc('0x12')](_0xb8ad0d[_0x2a0319])){for(var _0x48b5e6=0x0;_0x48b5e6<_0xb8ad0d[_0x2a0319][_0x49dc('0x13')];_0x48b5e6+=0x1){addVertex(_0x57f230,_0xb8ad0d[_0x2a0319][_0x48b5e6],_0x2a0319);}}else{addVertex(_0x57f230,_0xb8ad0d[_0x2a0319],_0x2a0319);}}}for(var _0x4ec437=0x0;_0x4ec437<_0x298af0['length'];_0x4ec437+=0x1){if(_0x298af0[_0x4ec437]['source']&&_0x298af0[_0x4ec437]['target']){_0x57f230[_0x49dc('0x14')](_0x298af0[_0x4ec437][_0x49dc('0x15')],_0x298af0[_0x4ec437]['target'],_0x298af0[_0x4ec437][_0x49dc('0x16')]);}}return _0x57f230;}function getRoot(_0x2fc3eb){return parser[_0x49dc('0x17')](_0x2fc3eb,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x532506){return util[_0x49dc('0x18')](_0x532506,{'showHidden':![],'depth':null});}function initialize(_0x470908,_0x13b512){var _0x3281fc=getRoot(_0x470908[_0x49dc('0x19')]);if(!_0x3281fc||!_0x3281fc['start'])return;var _0x15a3cd,_0x26a962,_0x525240;logger[_0x49dc('0x1a')](_0x49dc('0x1b'),JSON[_0x49dc('0x1c')](_0x3281fc,null,0x2));_0x13b512['joinAt']=moment()[_0x49dc('0x1d')](_0x49dc('0x1e'));_0x15a3cd=initGraph(_['omit'](_0x3281fc,_0x49dc('0x10')),_0x3281fc[_0x49dc('0x10')]);_0x26a962=new Vertices(_0x13b512,rpc,mailRpc);logger[_0x49dc('0x1f')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512['callerid'],_0x13b512[_0x49dc('0x22')],_0x13b512[_0x49dc('0x23')]));_0x15a3cd[_0x49dc('0x24')](_0x3281fc[_0x49dc('0x25')]['id'],function(_0x3e8480){try{_0x3e8480=_0x26a962['clear'](_0x3e8480);logger[_0x49dc('0x1a')](_0x49dc('0x26'),JSON[_0x49dc('0x1c')](_0x3e8480,null,0x2));if(_0x3e8480[_0x49dc('0x27')]===_0x49dc('0x28')){logger['info'](_0x49dc('0x29'));_0x13b512[_0x49dc('0x2a')]=_0x3e8480[_0x49dc('0x2a')]||_0x13b512[_0x49dc('0x2a')];_0x13b512[_0x49dc('0x2b')]=_0x3e8480['extension'];_0x13b512[_0x49dc('0x2c')]=_0x3e8480[_0x49dc('0x2c')]?_0x3e8480[_0x49dc('0x2c')]-0x1:0x1;return null;}else if(_0x3e8480&&_0x26a962[_0x3e8480[_0x49dc('0x27')]]){_0x525240=_0x26a962[_0x3e8480[_0x49dc('0x27')]](_0x3e8480);logger[_0x49dc('0x1f')](_0x49dc('0x2d'),JSON[_0x49dc('0x1c')](_0x525240,null,0x2));if(_0x525240&&_0x525240['code']===AGI_CODE_SUCCESS&&_0x525240['result']!==AGI_RESULT_ERROR&&!_0x13b512[_0x49dc('0x2e')]){logger[_0x49dc('0x1a')](_0x49dc('0x2d'),inspect(_0x525240));return _['isUndefined'](_0x525240['result'])?null:_0x525240[_0x49dc('0x2f')][_0x49dc('0x30')]();}else{logger['error'](_0x49dc('0x2d'),inspect(_0x525240));return null;}}else{logger['error'](_0x49dc('0x31'));return null;}}catch(_0x2a7e76){logger[_0x49dc('0xa')](_0x2a7e76[_0x49dc('0xc')]);return null;}});if(_0x3281fc[_0x49dc('0x32')]){logger[_0x49dc('0x1f')](util[_0x49dc('0x1d')](_0x49dc('0x33'),_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512[_0x49dc('0x34')],_0x13b512['dnid'],_0x13b512['uniqueid']));_0x15a3cd[_0x49dc('0x24')](_0x3281fc[_0x49dc('0x32')]['id'],function(_0x2477cc){try{_0x2477cc=_0x26a962[_0x49dc('0x35')](_0x2477cc);logger[_0x49dc('0x1a')]('vertex',JSON[_0x49dc('0x1c')](_0x2477cc,null,0x2));if(_0x2477cc&&_0x26a962[_0x2477cc[_0x49dc('0x27')]]){_0x525240=_0x26a962[_0x2477cc[_0x49dc('0x27')]](_0x2477cc);if(_0x525240){logger[_0x49dc('0x1a')](_0x49dc('0x2d'),inspect(_0x525240));return _['isUndefined'](_0x525240[_0x49dc('0x2f')])?null:_0x525240[_0x49dc('0x2f')]['toString']();}else{logger[_0x49dc('0xa')](_0x49dc('0x2d'),inspect(_0x525240));return null;}}else{logger[_0x49dc('0xa')](_0x49dc('0x31'));return null;}}catch(_0x35a0bb){logger['error'](_0x35a0bb['stack']);return null;}});}logger[_0x49dc('0x1f')](util[_0x49dc('0x1d')](_0x49dc('0x36'),_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512[_0x49dc('0x34')],_0x13b512[_0x49dc('0x22')],_0x13b512[_0x49dc('0x23')]));logger['info'](util[_0x49dc('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x13b512[_0x49dc('0x2a')],_0x13b512[_0x49dc('0x2b')],parseInt(_0x13b512['priority'],0xa)+0x1));_0x13b512[_0x49dc('0x37')](_0x13b512[_0x49dc('0x2a')],_0x13b512['extension'],parseInt(_0x13b512[_0x49dc('0x2c')],0xa)+0x1);_0x13b512['close']();}function handleNotFound(_0x57832b){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x57832b['arg_1']));_0x57832b['continueAt'](_0x57832b['context'],_0x57832b[_0x49dc('0x2b')],parseInt(_0x57832b['priority'],0xa)+0x1);_0x57832b['close']();}function handleUnpublished(_0x10f3c4){logger[_0x49dc('0xa')](util[_0x49dc('0x1d')]('Project\x20%s\x20not\x20published',_0x10f3c4[_0x49dc('0x20')]));_0x10f3c4[_0x49dc('0x37')](_0x10f3c4[_0x49dc('0x2a')],_0x10f3c4[_0x49dc('0x2b')],parseInt(_0x10f3c4[_0x49dc('0x2c')],0xa)+0x1);_0x10f3c4[_0x49dc('0x38')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6dec2f4..7a9a753 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 _0x2b81=['\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','emit','headers','line','length','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x37c30d,_0x306072){var _0x48512f=function(_0x232f14){while(--_0x232f14){_0x37c30d['push'](_0x37c30d['shift']());}};_0x48512f(++_0x306072);}(_0x2b81,0x1ef));var _0x12b8=function(_0x21f9e9,_0x307ffb){_0x21f9e9=_0x21f9e9-0x0;var _0x153a53=_0x2b81[_0x21f9e9];return _0x153a53;};'use strict';var util=require(_0x12b8('0x0'));var Transform=require(_0x12b8('0x1'))[_0x12b8('0x2')];function AGIReply(_0x427db8){Transform[_0x12b8('0x3')](this,_0x427db8);this[_0x12b8('0x4')]='';this[_0x12b8('0x5')]=![];}util[_0x12b8('0x6')](AGIReply,Transform);AGIReply[_0x12b8('0x7')][_0x12b8('0x8')]=function(_0x554505,_0x41db95,_0x490284){var _0x2f8abc='\x0a',_0x29eb3d=['\x0a\x0a',_0x12b8('0x9')],_0x3f9216=-0x1,_0x119d5b=-0x1,_0x50a615='',_0x3e8473=0x0,_0x12f442='',_0x3727c3='';this[_0x12b8('0x4')]+=_0x554505[_0x12b8('0xa')]();_0x12f442=this[_0x12b8('0x4')];if(!this[_0x12b8('0x5')]){_0x3e8473=0x0;while(_0x29eb3d[_0x3e8473]){while((_0x119d5b=_0x12f442['indexOf'](_0x29eb3d[_0x3e8473]))!=-0x1){_0x50a615=_0x29eb3d[_0x3e8473];_0x3727c3=_0x12f442[_0x12b8('0xb')](0x0,_0x119d5b);_0x12f442=_0x12f442['substring'](_0x119d5b+_0x50a615['length']);var _0x4451fa=_0x3727c3[_0x12b8('0xc')](_0x2f8abc),_0x379990=0x0,_0xca9f1b={},_0x582c19='',_0x425900='',_0x39826c=-0x1;while(_0x4451fa[_0x379990]){_0x39826c=_0x4451fa[_0x379990][_0x12b8('0xd')](':');if(_0x39826c!=-0x1){_0x582c19=_0x4451fa[_0x379990][_0x12b8('0xe')](0x0,_0x39826c)[_0x12b8('0xf')]();_0x425900=_0x4451fa[_0x379990][_0x12b8('0xe')](_0x39826c+0x1)['trim']();if(_0x582c19['length']>0x0){_0xca9f1b[_0x582c19]=_0x425900;}}else{}_0x379990++;}this[_0x12b8('0x10')](_0x12b8('0x11'),_0xca9f1b);this[_0x12b8('0x5')]=!![];}_0x3e8473++;}this['_localBuffer']=_0x12f442;}else{while((_0x3f9216=_0x12f442['indexOf'](_0x2f8abc))!=-0x1){_0x3727c3=_0x12f442[_0x12b8('0xb')](0x0,_0x3f9216);this[_0x12b8('0x10')](_0x12b8('0x12'),_0x3727c3);_0x12f442=_0x12f442[_0x12b8('0xb')](_0x3f9216+_0x2f8abc[_0x12b8('0x13')]);}this[_0x12b8('0x4')]=_0x12f442;}_0x490284();};module[_0x12b8('0x14')]=AGIReply; \ No newline at end of file +var _0xb50c=['toString','indexOf','substring','split','slice','trim','length','emit','headers','line','exports','util','stream','Transform','_localBuffer','_inBody','prototype','_transform'];(function(_0x4716ae,_0x35a488){var _0x526078=function(_0x9c69b6){while(--_0x9c69b6){_0x4716ae['push'](_0x4716ae['shift']());}};_0x526078(++_0x35a488);}(_0xb50c,0x1bb));var _0xcb50=function(_0xd0c886,_0x4f71a3){_0xd0c886=_0xd0c886-0x0;var _0x4faf54=_0xb50c[_0xd0c886];return _0x4faf54;};'use strict';var util=require(_0xcb50('0x0'));var Transform=require(_0xcb50('0x1'))[_0xcb50('0x2')];function AGIReply(_0x581b63){Transform['call'](this,_0x581b63);this[_0xcb50('0x3')]='';this[_0xcb50('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xcb50('0x5')][_0xcb50('0x6')]=function(_0x360a0a,_0x425944,_0x144411){var _0x59fbb9='\x0a',_0x52127e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3e0058=-0x1,_0x46f25b=-0x1,_0x4d321a='',_0x32f434=0x0,_0xd84b20='',_0x2671ce='';this[_0xcb50('0x3')]+=_0x360a0a[_0xcb50('0x7')]();_0xd84b20=this[_0xcb50('0x3')];if(!this[_0xcb50('0x4')]){_0x32f434=0x0;while(_0x52127e[_0x32f434]){while((_0x46f25b=_0xd84b20[_0xcb50('0x8')](_0x52127e[_0x32f434]))!=-0x1){_0x4d321a=_0x52127e[_0x32f434];_0x2671ce=_0xd84b20[_0xcb50('0x9')](0x0,_0x46f25b);_0xd84b20=_0xd84b20['substring'](_0x46f25b+_0x4d321a['length']);var _0x123496=_0x2671ce[_0xcb50('0xa')](_0x59fbb9),_0x314d7b=0x0,_0x596de9={},_0x4ac015='',_0x22bf7a='',_0x14f3f9=-0x1;while(_0x123496[_0x314d7b]){_0x14f3f9=_0x123496[_0x314d7b]['indexOf'](':');if(_0x14f3f9!=-0x1){_0x4ac015=_0x123496[_0x314d7b][_0xcb50('0xb')](0x0,_0x14f3f9)[_0xcb50('0xc')]();_0x22bf7a=_0x123496[_0x314d7b][_0xcb50('0xb')](_0x14f3f9+0x1)[_0xcb50('0xc')]();if(_0x4ac015[_0xcb50('0xd')]>0x0){_0x596de9[_0x4ac015]=_0x22bf7a;}}else{}_0x314d7b++;}this[_0xcb50('0xe')](_0xcb50('0xf'),_0x596de9);this['_inBody']=!![];}_0x32f434++;}this[_0xcb50('0x3')]=_0xd84b20;}else{while((_0x3e0058=_0xd84b20[_0xcb50('0x8')](_0x59fbb9))!=-0x1){_0x2671ce=_0xd84b20['substring'](0x0,_0x3e0058);this[_0xcb50('0xe')](_0xcb50('0x10'),_0x2671ce);_0xd84b20=_0xd84b20[_0xcb50('0x9')](_0x3e0058+_0x59fbb9[_0xcb50('0xd')]);}this[_0xcb50('0x3')]=_0xd84b20;}_0x144411();};module[_0xcb50('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c355c97..844546b 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 _0x12c9=['YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ListId','agentLogin','LoginUser','agentUnpause','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','production','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format'];(function(_0x4dab7b,_0x1b80a1){var _0xc84024=function(_0x6b6c2e){while(--_0x6b6c2e){_0x4dab7b['push'](_0x4dab7b['shift']());}};_0xc84024(++_0x1b80a1);}(_0x12c9,0x1c9));var _0x912c=function(_0x424f22,_0x26b347){_0x424f22=_0x424f22-0x0;var _0x15daea=_0x12c9[_0x424f22];return _0x15daea;};'use strict';var _=require(_0x912c('0x0'));var moment=require(_0x912c('0x1'));var jayson=require(_0x912c('0x2'));var client=jayson[_0x912c('0x3')][_0x912c('0x4')]({'port':0x2329});function request(_0x5420d6,_0x10ebce){return new Promise(function(_0xcb7adc,_0x2c8059){return client[_0x912c('0x5')](_0x5420d6,_0x10ebce)[_0x912c('0x6')](function(_0x505262){if(_0x505262['error']){return _0x2c8059(_0x505262[_0x912c('0x7')][_0x912c('0x8')]);}else{return _0xcb7adc(_0x505262[_0x912c('0x9')]);}})[_0x912c('0xa')](function(_0x312a7f){return _0x2c8059(_0x312a7f);});});}exports['getSquareProjects']=function(){return request(_0x912c('0xb'),{'options':{'raw':![],'attributes':['id','name',_0x912c('0xc')]}});};exports['getSquareProject']=function(_0xf95487){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xf95487},'attributes':[_0x912c('0xc')]}});};exports['getMailAccountById']=function(_0x370b91){return request(_0x912c('0xd'),{'options':{'raw':![],'where':{'id':_0x370b91},'include':[{'model':'MailServerOut','as':_0x912c('0xe'),'include':[{'model':'CloudProvider','as':_0x912c('0xf')}]}],'attributes':['id',_0x912c('0x10'),_0x912c('0x11')],'smtp':!![]}});};exports[_0x912c('0x12')]=function(_0x325880){return request('ShowSquareProject',{'options':{'where':{'id':_0x325880},'attributes':[_0x912c('0x10')]}});};exports['getVoiceQueueById']=function(_0x28cdb4){return request(_0x912c('0x13'),{'options':{'where':{'id':_0x28cdb4},'attributes':['name']}});};exports[_0x912c('0x14')]=function(_0xc48e52){return request(_0x912c('0x15'),{'options':{'where':{'id':_0xc48e52},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x16')]=function(_0x11c2a6){return request(_0x912c('0x17'),{'options':{'where':{'id':_0x11c2a6},'attributes':[_0x912c('0x18')]}});};exports[_0x912c('0x19')]=function(_0x26cb90){return request('ShowUser',{'options':{'where':{'id':_0x26cb90},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x1a')]=function(_0x2a7693){return request(_0x912c('0x1b'),{'options':{'where':{'phone':_0x2a7693[_0x912c('0x1c')]},'attributes':['id']}});};exports[_0x912c('0x1d')]=function(_0x2a22d3){return request(_0x912c('0x1e'),{'options':{'where':{'id':_0x2a22d3},'attributes':[_0x912c('0x10')]}});};exports['getSoundById']=function(_0x5ca648){return request(_0x912c('0x1f'),{'options':{'where':{'id':_0x5ca648},'attributes':[_0x912c('0x20')]}});};exports['getIntervalById']=function(_0x49cb1e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x49cb1e},'include':[{'model':_0x912c('0x21'),'as':_0x912c('0x22')}]}});};exports['getSmsAccountById']=function(_0x5afd32){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5afd32},'attributes':['id',_0x912c('0x10')]}});};exports[_0x912c('0x23')]=function(_0x4293f2){return request(_0x912c('0x24'),{'body':_0x4293f2});};exports[_0x912c('0x25')]=function(_0x11ea1c){return request(_0x912c('0x26'),{'body':_0x11ea1c});};exports['createSquareReport']=function(_0x18b398){return request('CreateSquareReport',{'body':_[_0x912c('0x27')](_0x18b398,{'project_name':_0x18b398[_0x912c('0x28')],'prev_project_name':_0x18b398[_0x912c('0x29')]||'','is_subproject':_0x18b398[_0x912c('0x29')]?!![]:![],'leaveAt':moment()[_0x912c('0x2a')](_0x912c('0x2b'))})});};exports[_0x912c('0x2c')]=function(_0x71b2e6){return request('CreateSquareRecording',{'body':_0x71b2e6});};exports['createSquareMessage']=function(_0x302687){return request('CreateSquareMessage',{'body':_0x302687});};exports[_0x912c('0x2d')]=function(_0x24c2f2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x24c2f2[_0x912c('0x1c')],'ListId':_0x24c2f2[_0x912c('0x2e')]}}})[_0x912c('0x6')](function(_0x188790){if(_0x188790){return _0x188790;}return request('CreateCmContact',{'body':_0x24c2f2});});};exports['getPauseById']=function(_0xb58718){return request('ShowPause',{'options':{'where':{'id':_0xb58718},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x2f')]=function(_0x3b112e,_0x654542){return request(_0x912c('0x30'),{'body':{'interface':_0x654542},'options':{'where':_0x3b112e}});};exports['agentPause']=function(_0x41366f,_0x3492e7,_0x10bd1a){return request('PauseUser',{'body':{'type':_0x3492e7,'uniqueid':_0x10bd1a},'options':{'where':_0x41366f}});};exports[_0x912c('0x31')]=function(_0x5973ba){return request('UnpauseUser',{'body':{},'options':{'where':_0x5973ba}});};exports['agentLogout']=function(_0x1e29b0){return request('LogoutUser',{'body':{},'options':{'where':_0x1e29b0}});}; \ No newline at end of file +var _0xed95=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport'];(function(_0x2f06e0,_0x2e1c2a){var _0xf2711b=function(_0x32036c){while(--_0x32036c){_0x2f06e0['push'](_0x2f06e0['shift']());}};_0xf2711b(++_0x2e1c2a);}(_0xed95,0xb9));var _0x5ed9=function(_0x39b819,_0x2bd3ce){_0x39b819=_0x39b819-0x0;var _0x1c71f1=_0xed95[_0x39b819];return _0x1c71f1;};'use strict';var _=require(_0x5ed9('0x0'));var moment=require(_0x5ed9('0x1'));var jayson=require(_0x5ed9('0x2'));var client=jayson[_0x5ed9('0x3')][_0x5ed9('0x4')]({'port':0x2329});function request(_0x7b6960,_0x453f85){return new Promise(function(_0x3e2272,_0x2a28e9){return client[_0x5ed9('0x5')](_0x7b6960,_0x453f85)[_0x5ed9('0x6')](function(_0x15b734){if(_0x15b734['error']){return _0x2a28e9(_0x15b734['error'][_0x5ed9('0x7')]);}else{return _0x3e2272(_0x15b734[_0x5ed9('0x8')]);}})[_0x5ed9('0x9')](function(_0x34688d){return _0x2a28e9(_0x34688d);});});}exports[_0x5ed9('0xa')]=function(){return request(_0x5ed9('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x5ed9('0xc')]=function(_0xbe4c01){return request(_0x5ed9('0xd'),{'options':{'raw':![],'where':{'name':_0xbe4c01},'attributes':[_0x5ed9('0xe')]}});};exports['getMailAccountById']=function(_0x575782){return request(_0x5ed9('0xf'),{'options':{'raw':![],'where':{'id':_0x575782},'include':[{'model':_0x5ed9('0x10'),'as':_0x5ed9('0x11'),'include':[{'model':_0x5ed9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x5ed9('0x13'),_0x5ed9('0x14')],'smtp':!![]}});};exports[_0x5ed9('0x15')]=function(_0x5e463c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e463c},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x16')]=function(_0x5e952c){return request(_0x5ed9('0x17'),{'options':{'where':{'id':_0x5e952c},'attributes':[_0x5ed9('0x13')]}});};exports['getVariableById']=function(_0x57692b){return request(_0x5ed9('0x18'),{'options':{'where':{'id':_0x57692b},'attributes':[_0x5ed9('0x13')]}});};exports['getSquareOdbcById']=function(_0x3de09e){return request(_0x5ed9('0x19'),{'options':{'where':{'id':_0x3de09e},'attributes':['dsn']}});};exports[_0x5ed9('0x1a')]=function(_0xc6e591){return request('ShowUser',{'options':{'where':{'id':_0xc6e591},'attributes':['name']}});};exports['getContactByPhone']=function(_0x510ffe){return request(_0x5ed9('0x1b'),{'options':{'where':{'phone':_0x510ffe[_0x5ed9('0x1c')]},'attributes':['id']}});};exports[_0x5ed9('0x1d')]=function(_0x44b8ca){return request('ShowTrunk',{'options':{'where':{'id':_0x44b8ca},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x1e')]=function(_0x5cb2c1){return request('ShowSound',{'options':{'where':{'id':_0x5cb2c1},'attributes':['save_name']}});};exports[_0x5ed9('0x1f')]=function(_0x26a3c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26a3c8},'include':[{'model':_0x5ed9('0x20'),'as':_0x5ed9('0x21')}]}});};exports[_0x5ed9('0x22')]=function(_0x71e104){return request('ShowSmsAccount',{'options':{'where':{'id':_0x71e104},'attributes':['id',_0x5ed9('0x13')]}});};exports[_0x5ed9('0x23')]=function(_0x38b462){return request(_0x5ed9('0x24'),{'body':_0x38b462});};exports[_0x5ed9('0x25')]=function(_0x14ae7b){return request('CreateSquareDetailsReport',{'body':_0x14ae7b});};exports['createSquareReport']=function(_0x36d7d5){return request(_0x5ed9('0x26'),{'body':_[_0x5ed9('0x27')](_0x36d7d5,{'project_name':_0x36d7d5['arg_1'],'prev_project_name':_0x36d7d5['arg_2']||'','is_subproject':_0x36d7d5[_0x5ed9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ed9('0x29')](_0x5ed9('0x2a'))})});};exports['createSquareRecording']=function(_0x1bc137){return request(_0x5ed9('0x2b'),{'body':_0x1bc137});};exports[_0x5ed9('0x2c')]=function(_0x5a805b){return request(_0x5ed9('0x2d'),{'body':_0x5a805b});};exports[_0x5ed9('0x2e')]=function(_0x411729){return request(_0x5ed9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x411729['phone'],'ListId':_0x411729['ListId']}}})[_0x5ed9('0x6')](function(_0x5d6599){if(_0x5d6599){return _0x5d6599;}return request(_0x5ed9('0x30'),{'body':_0x411729});});};exports[_0x5ed9('0x31')]=function(_0x1585e3){return request(_0x5ed9('0x32'),{'options':{'where':{'id':_0x1585e3},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x33')]=function(_0xba5b97,_0x4a47f5){return request('LoginUser',{'body':{'interface':_0x4a47f5},'options':{'where':_0xba5b97}});};exports['agentPause']=function(_0x39771f,_0x36d050,_0x2cb3d2){return request('PauseUser',{'body':{'type':_0x36d050,'uniqueid':_0x2cb3d2},'options':{'where':_0x39771f}});};exports[_0x5ed9('0x34')]=function(_0x53575b){return request(_0x5ed9('0x35'),{'body':{},'options':{'where':_0x53575b}});};exports[_0x5ed9('0x36')]=function(_0x3061cd){return request(_0x5ed9('0x37'),{'body':{},'options':{'where':_0x3061cd}});}; \ 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 e56d9b8..967ab45 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 _0x5f71=['exports','./polly'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x5f71,0xc9));var _0x15f7=function(_0x5a01bc,_0x4b0b27){_0x5a01bc=_0x5a01bc-0x0;var _0x2eefda=_0x5f71[_0x5a01bc];return _0x2eefda;};var polly=require(_0x15f7('0x0'));var lex=require('./lex');module[_0x15f7('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x15b2=['./lex'];(function(_0x146784,_0x599c9f){var _0x22ec90=function(_0x2a983a){while(--_0x2a983a){_0x146784['push'](_0x146784['shift']());}};_0x22ec90(++_0x599c9f);}(_0x15b2,0x145));var _0x215b=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0x15b2[_0x26c12e];return _0xbab0c7;};var polly=require('./polly');var lex=require(_0x215b('0x0'));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 3cc517d..63c66fb 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(_0x4e2f96,_0x289db4){var _0x35b8d5=function(_0x2fde81){while(--_0x2fde81){_0x4e2f96['push'](_0x4e2f96['shift']());}};_0x35b8d5(++_0x289db4);}(_0x41bb,0xc5));var _0xb41b=function(_0x54e7af,_0x3906b7){_0x54e7af=_0x54e7af-0x0;var _0xa1fce0=_0x41bb[_0x54e7af];return _0xa1fce0;};'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 _0x0bb5=['./lib/api','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0bb5,0x148));var _0x50bb=function(_0x3cd5a7,_0x3e3a9f){_0x3cd5a7=_0x3cd5a7-0x0;var _0x53c0c9=_0x0bb5[_0x3cd5a7];return _0x53c0c9;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ 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 281ee59..bb87f61 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1db9ea,_0x54d6d3){var _0x1a7ee4=function(_0x40e66f){while(--_0x40e66f){_0x1db9ea['push'](_0x1db9ea['shift']());}};_0x1a7ee4(++_0x54d6d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x3bb897,_0x35e375){var _0x25839f=function(_0x1dfe16){while(--_0x1dfe16){_0x3bb897['push'](_0x3bb897['shift']());}};_0x25839f(++_0x35e375);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 2fd829b..52ea151 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 _0x7767=['./lib/api'];(function(_0x25bdd0,_0x28ed57){var _0x11430e=function(_0x5891fe){while(--_0x5891fe){_0x25bdd0['push'](_0x25bdd0['shift']());}};_0x11430e(++_0x28ed57);}(_0x7767,0x101));var _0x7776=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7767[_0x4b2863];return _0x567d67;};'use strict';var polly=require(_0x7776('0x0'));module['exports']=function(_0x20165c,_0xad750b,_0x40be84,_0x4229fb,_0x3bd919,_0x62387c,_0x3ae4ed){return polly(_0x20165c,_0xad750b,_0x40be84,_0x4229fb,_0x3bd919,_0x62387c,_0x3ae4ed);}; \ No newline at end of file +var _0x33e6=['exports'];(function(_0x7f23c1,_0x2d8e38){var _0x4c4447=function(_0x41f975){while(--_0x41f975){_0x7f23c1['push'](_0x7f23c1['shift']());}};_0x4c4447(++_0x2d8e38);}(_0x33e6,0x175));var _0x633e=function(_0x441da8,_0x47dd43){_0x441da8=_0x441da8-0x0;var _0x52e658=_0x33e6[_0x441da8];return _0x52e658;};'use strict';var polly=require('./lib/api');module[_0x633e('0x0')]=function(_0x142fe4,_0x54f89a,_0x42db6f,_0x58c179,_0x57dcd3,_0x53ef2b,_0x266801){return polly(_0x142fe4,_0x54f89a,_0x42db6f,_0x58c179,_0x57dcd3,_0x53ef2b,_0x266801);}; \ 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 021961c..995e50d 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 _0x2a79=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0x2a79,0xb4));var _0x92a7=function(_0x1f8e09,_0x30778c){_0x1f8e09=_0x1f8e09-0x0;var _0xbd9c10=_0x2a79[_0x1f8e09];return _0xbd9c10;};'use strict';var fs=require('fs');var path=require(_0x92a7('0x0'));var BPromise=require(_0x92a7('0x1'));var rs=require(_0x92a7('0x2'));var AWS=require(_0x92a7('0x3'));function pollyResult(_0x34723c,_0x12c6f7,_0x34bd48){return new BPromise(function(_0x334fe3,_0x24459c){_0x34723c[_0x92a7('0x4')](_0x12c6f7,function(_0x46a240,_0x250498){if(_0x46a240){_0x24459c(_0x46a240);}else if(_0x250498){if(_0x250498[_0x92a7('0x5')]instanceof Buffer){fs[_0x92a7('0x6')](_0x34bd48,_0x250498[_0x92a7('0x5')],function(_0x18070f){if(_0x18070f){_0x24459c(_0x18070f);}else{_0x334fe3();}});}else{_0x24459c(new Error(_0x92a7('0x7')));}}else{_0x24459c(new Error(_0x92a7('0x8')));}});});}module['exports']=function(_0x2880fc,_0x3cb8fc,_0x1847ff,_0x5ddab5,_0x21367b,_0x31caa5,_0x4d39cd){var _0x1067e3=new AWS[(_0x92a7('0x9'))]({'accessKeyId':_0x2880fc,'secretAccessKey':_0x3cb8fc,'region':_0x1847ff});var _0x52d4c3={'Text':_0x21367b,'TextType':_0x31caa5||_0x92a7('0xa'),'OutputFormat':_0x92a7('0xb'),'VoiceId':_0x5ddab5};return pollyResult(_0x1067e3,_0x52d4c3,_0x4d39cd);}; \ No newline at end of file +var _0x0011=['aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0011,0xde));var _0x1001=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0011[_0x618414];return _0x21c19a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x1001('0x0'));function pollyResult(_0x2436c6,_0x4984c7,_0x495e74){return new BPromise(function(_0x47e32e,_0xffdc02){_0x2436c6['synthesizeSpeech'](_0x4984c7,function(_0x5befa0,_0x11d356){if(_0x5befa0){_0xffdc02(_0x5befa0);}else if(_0x11d356){if(_0x11d356['AudioStream']instanceof Buffer){fs['writeFile'](_0x495e74,_0x11d356[_0x1001('0x1')],function(_0x549af6){if(_0x549af6){_0xffdc02(_0x549af6);}else{_0x47e32e();}});}else{_0xffdc02(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xffdc02(new Error(_0x1001('0x2')));}});});}module[_0x1001('0x3')]=function(_0x12d13d,_0x5e0b36,_0x3de0ee,_0x4b914b,_0x55cb9e,_0x189e02,_0x5a77be){var _0x3e82e6=new AWS['Polly']({'accessKeyId':_0x12d13d,'secretAccessKey':_0x5e0b36,'region':_0x3de0ee});var _0x4d2011={'Text':_0x55cb9e,'TextType':_0x189e02||_0x1001('0x4'),'OutputFormat':_0x1001('0x5'),'VoiceId':_0x4b914b};return pollyResult(_0x3e82e6,_0x4d2011,_0x5a77be);}; \ 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 34e913d..b9d4a2c 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 _0x175b=['./lib/api'];(function(_0x2135a8,_0x2d5706){var _0x3dd593=function(_0x3c4c5d){while(--_0x3c4c5d){_0x2135a8['push'](_0x2135a8['shift']());}};_0x3dd593(++_0x2d5706);}(_0x175b,0x155));var _0xb175=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x175b[_0x188a93];return _0x23b40d;};'use strict';var asr=require(_0xb175('0x0'));module['exports']=function(_0x5936a4,_0x409501,_0x178186,_0x4a3e9c){return asr(_0x5936a4,_0x409501,_0x178186);}; \ No newline at end of file +var _0x39e6=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e6,0x1e2));var _0x639e=function(_0x3ae9e5,_0x2464b9){_0x3ae9e5=_0x3ae9e5-0x0;var _0x5204d0=_0x39e6[_0x3ae9e5];return _0x5204d0;};'use strict';var asr=require(_0x639e('0x0'));module[_0x639e('0x1')]=function(_0x1f830a,_0x4b3d45,_0x259484,_0x341d92){return asr(_0x1f830a,_0x4b3d45,_0x259484);}; \ 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 0423f03..2ae1f70 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 _0x26c2=['readFileSync','toString','POST','8000','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string'];(function(_0x38d682,_0x5766ef){var _0x4c22b5=function(_0x2ee576){while(--_0x2ee576){_0x38d682['push'](_0x38d682['shift']());}};_0x4c22b5(++_0x5766ef);}(_0x26c2,0x130));var _0x226c=function(_0x279171,_0x195a91){_0x279171=_0x279171-0x0;var _0x574ab0=_0x26c2[_0x279171];return _0x574ab0;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x226c('0x0')]=function(_0x23ec98,_0x674a14,_0x3b56e8){return new BPromise(function(_0x5e55b3,_0x2f79d3){var _0x117899;if(typeof _0x23ec98!=='string'||_0x23ec98[_0x226c('0x1')]===0x0){return _0x2f79d3(_0x226c('0x2'));}if(typeof _0x674a14!==_0x226c('0x3')||_0x674a14[_0x226c('0x1')]===0x0){return _0x2f79d3(_0x226c('0x4'));}if(typeof _0x3b56e8!=='undefined'&&(typeof _0x3b56e8!==_0x226c('0x3')||_0x3b56e8[_0x226c('0x1')]===0x0)){return _0x2f79d3(_0x226c('0x5'));}try{_0x117899=fs[_0x226c('0x6')](_0x23ec98)[_0x226c('0x7')]('base64');}catch(_0x16cbbd){return _0x2f79d3(_0x16cbbd);}return _0x5e55b3({'method':_0x226c('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x674a14,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x226c('0x9'),'languageCode':_0x3b56e8},'audio':{'content':_0x117899}},'json':!![]});});}; \ No newline at end of file +var _0x407f=['readFileSync','toString','base64','8000','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0xa4203f,_0x23eb49){var _0x26e454=function(_0x25f1a6){while(--_0x25f1a6){_0xa4203f['push'](_0xa4203f['shift']());}};_0x26e454(++_0x23eb49);}(_0x407f,0xc2));var _0xf407=function(_0x14bf64,_0x17ebcb){_0x14bf64=_0x14bf64-0x0;var _0x7be0be=_0x407f[_0x14bf64];return _0x7be0be;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf407('0x0')]=function(_0x2fcdc7,_0x6a58dd,_0x1ec297){return new BPromise(function(_0x1441bd,_0x886ba){var _0x185726;if(typeof _0x2fcdc7!==_0xf407('0x1')||_0x2fcdc7[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x3'));}if(typeof _0x6a58dd!==_0xf407('0x1')||_0x6a58dd[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x4'));}if(typeof _0x1ec297!==_0xf407('0x5')&&(typeof _0x1ec297!==_0xf407('0x1')||_0x1ec297[_0xf407('0x2')]===0x0)){return _0x886ba('lang\x20should\x20be\x20a\x20string');}try{_0x185726=fs[_0xf407('0x6')](_0x2fcdc7)[_0xf407('0x7')](_0xf407('0x8'));}catch(_0x5af7b8){return _0x886ba(_0x5af7b8);}return _0x1441bd({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x6a58dd,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf407('0x9'),'languageCode':_0x1ec297},'audio':{'content':_0x185726}},'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 2f03ed5..d252278 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 _0x208f=['./asr','exports'];(function(_0x5c3432,_0x37e25d){var _0x350bee=function(_0x4cf95c){while(--_0x4cf95c){_0x5c3432['push'](_0x5c3432['shift']());}};_0x350bee(++_0x37e25d);}(_0x208f,0x1d6));var _0xf208=function(_0x35abf6,_0x43902d){_0x35abf6=_0x35abf6-0x0;var _0x30587a=_0x208f[_0x35abf6];return _0x30587a;};var asr=require(_0xf208('0x0'));module[_0xf208('0x1')]={'asr':asr}; \ No newline at end of file +var _0x542f=['exports','./asr'];(function(_0x5c1223,_0x1dd2bf){var _0xea34b9=function(_0x2a9a93){while(--_0x2a9a93){_0x5c1223['push'](_0x5c1223['shift']());}};_0xea34b9(++_0x1dd2bf);}(_0x542f,0x16b));var _0xf542=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x542f[_0x382c73];return _0x1dd0bf;};var asr=require(_0xf542('0x0'));module[_0xf542('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 7ec6b98..82f414e 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 _0x3714=['alternatives','join','map','confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','querystring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','path','request\x20to\x20','data','transcode','wav','end','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','resolve','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr'];(function(_0x512ea8,_0x309b1a){var _0x5d2659=function(_0x2ba87f){while(--_0x2ba87f){_0x512ea8['push'](_0x512ea8['shift']());}};_0x5d2659(++_0x309b1a);}(_0x3714,0xc1));var _0x4371=function(_0x3b5662,_0x39145b){_0x3b5662=_0x3b5662-0x0;var _0x1d4da=_0x3714[_0x3b5662];return _0x1d4da;};'use strict';var apiai=require(_0x4371('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x4371('0x1'));var fs=require('fs');var http=require(_0x4371('0x2'));var https=require(_0x4371('0x3'));var md5=require(_0x4371('0x4'));var path=require('path');var querystring=require(_0x4371('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x4371('0x6'));var tts=require(_0x4371('0x7'));var urlParse=require(_0x4371('0x8'))[_0x4371('0x9')];var util=require('util');var aws=require(_0x4371('0xa'));var google=require(_0x4371('0xb'));var sestek=require(_0x4371('0xc'));var tilde=require(_0x4371('0xd'));var logger=require(_0x4371('0xe'))(_0x4371('0xf'));var ISPEECH_API=_0x4371('0x10');function downloadFile(_0x42ce59,_0x16a4af){return new BPromise(function(_0x19d86c,_0x403eec){var _0x139dc0=urlParse(_0x42ce59);var _0x3453e2=_0x139dc0[_0x4371('0x11')]===_0x4371('0x12')?https:http;var _0x4f704f={'host':_0x139dc0[_0x4371('0x13')],'path':_0x139dc0['path'],'headers':{'user-agent':_0x4371('0x14')}};_0x3453e2[_0x4371('0x15')](_0x4f704f,function(_0x231bf5){if(_0x231bf5['statusCode']!==0xc8){logger[_0x4371('0x16')]('request\x20to\x20'+_0x42ce59+_0x4371('0x17')+_0x231bf5[_0x4371('0x18')]+'\x20('+_0x231bf5[_0x4371('0x19')]+')');_0x403eec(new Error('request\x20to\x20'+_0x42ce59+'\x20failed,\x20status\x20code\x20=\x20'+_0x231bf5[_0x4371('0x18')]+'\x20('+_0x231bf5['statusMessage']+')'));return;}var _0x2c4d50=fs[_0x4371('0x1a')](_0x16a4af);_0x2c4d50['on'](_0x4371('0x1b'),function(){logger[_0x4371('0x1c')](_0x4371('0x1d'));_0x2c4d50[_0x4371('0x1e')](_0x19d86c);});_0x2c4d50['on']('error',function(_0x3112ab){fs[_0x4371('0x1f')](_0x16a4af);logger[_0x4371('0x16')]('download\x20error',_0x3112ab);_0x403eec(_0x3112ab);});_0x231bf5[_0x4371('0x20')](_0x2c4d50);})['on'](_0x4371('0x16'),function(_0x286b96){logger['error'](_0x286b96);_0x403eec(_0x286b96);})['end']();});}function uploadFile(_0x146f06){return new BPromise(function(_0xada9e1,_0x1133fb){var _0x587835=urlParse(_0x146f06);var _0x296a3b=_0x587835[_0x4371('0x11')]==='https:'?https:http;var _0x1c3485={'host':_0x587835['host'],'path':_0x587835[_0x4371('0x21')],'headers':{'user-agent':_0x4371('0x14')}};_0x296a3b[_0x4371('0x15')](_0x1c3485,function(_0x35b656){if(_0x35b656[_0x4371('0x18')]!==0xc8){_0x1133fb(new Error(_0x4371('0x22')+_0x146f06+_0x4371('0x17')+_0x35b656[_0x4371('0x18')]+'\x20('+_0x35b656[_0x4371('0x19')]+')'));return;}var _0x55eec2='';_0x35b656['on'](_0x4371('0x23'),function(_0x2ad315){_0x55eec2+=_0x2ad315;});_0x35b656['on']('end',function(){_0xada9e1(_0x55eec2);});})['on']('error',function(_0x56c52e){_0x1133fb(_0x56c52e);})['end']();});}function convertFile(_0x2bd0b9,_0x489006){return new BPromise(function(_0x5e48e5,_0x8c2b00){var _0x5d6fda=sox[_0x4371('0x24')](_0x2bd0b9,_0x489006,{'sampleRate':0x1f40,'format':_0x4371('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d6fda['on'](_0x4371('0x16'),function(_0x237d57){logger[_0x4371('0x16')]('error\x20convert',_0x237d57);_0x8c2b00(_0x237d57);});_0x5d6fda['on'](_0x4371('0x26'),function(){logger[_0x4371('0x1c')](_0x4371('0x27'));_0x5e48e5();});_0x5d6fda['start']();});}function base64Decode(_0x3a5249,_0xfad4b2){var _0x353651=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));fs[_0x4371('0x2b')](_0x353651,_0x3a5249,_0x4371('0x2c'));return convertFile(_0x353651,_0xfad4b2)[_0x4371('0x2d')](function(){try{fs[_0x4371('0x1f')](_0x353651);fs[_0x4371('0x2e')](_0xfad4b2,_0x4371('0x2f'));}catch(_0x4b499f){logger[_0x4371('0x16')](_0x4b499f);}return _0xfad4b2[_0x4371('0x30')]('.')[0x0];});}function base64Encode(_0x2e3c63){var _0x1f6a1c=fs['readFileSync'](_0x2e3c63);return new Buffer(_0x1f6a1c)[_0x4371('0x31')](_0x4371('0x2c'));}exports['googleCloudTTS']=function(_0x49e2fc,_0x52d4b0,_0xd5441c,_0x14a901,_0x29b79f,_0x2196a6){var _0x123f9a,_0x4df34b;var _0x528146=_0x4371('0x32');var _0xd7248a=_0x4371('0x33')+_0x49e2fc;var _0x2561b2={};if(_0x52d4b0==='ssml'){_0x2561b2[_0x4371('0x34')]={'ssml':_0xd5441c};}else{_0x2561b2['input']={'text':_0xd5441c};};_0x2561b2['voice']={'languageCode':_0x14a901,'ssmlGender':_0x29b79f};_0x2561b2[_0x4371('0x35')]={'audioEncoding':_0x4371('0x36'),'sampleRateHertz':0x1f40};var _0x3f5ca5={'url':_0x528146+'text:synthesize'+_0xd7248a,'method':_0x4371('0x37'),'json':!![],'body':_0x2561b2};return rp(_0x3f5ca5)[_0x4371('0x2d')](function(_0x160d3e){return new BPromise(function(_0x5c1749,_0x347a18){_0x123f9a=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));var _0x2e0d48=Buffer['from'](_0x160d3e[_0x4371('0x3a')],_0x4371('0x2c'));return fs[_0x4371('0x3b')](_0x123f9a,_0x2e0d48,function(_0x2e4ef3){_0x347a18(_0x2e4ef3);},function(_0x1c12c4){fs[_0x4371('0x2e')](_0x123f9a,_0x4371('0x2f'));_0x5c1749(_0x1c12c4);});});})[_0x4371('0x2d')](function(_0x3c2645){_0x4df34b=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));return convertFile(_0x123f9a,_0x4df34b);})[_0x4371('0x2d')](function(){try{fs[_0x4371('0x1f')](_0x123f9a);fs[_0x4371('0x2e')](_0x4df34b,_0x4371('0x2f'));}catch(_0x84e01b){logger[_0x4371('0x16')](_0x84e01b);}logger[_0x4371('0x1c')](_0x4371('0x3c'),_0x4df34b['split']('.')[0x0]);return _0x4df34b[_0x4371('0x30')]('.')[0x0];});};exports[_0x4371('0x3d')]=function(_0x1e594a,_0xff9ccd){var _0x1f905c=_0x4371('0x3e');var _0x54b727,_0x3cda4d;var _0x45beff;var _0x2567bd={'encoding':_0x4371('0x3f'),'method':_0x4371('0x37'),'timeout':0x2710,'url':_0x1f905c,'headers':{'Content-Type':_0x4371('0x40')},'body':_0x4371('0x41')+encodeURIComponent(JSON[_0x4371('0x42')]([[['jQ1olc',JSON[_0x4371('0x42')]([_0x1e594a,_0xff9ccd||'en',![],_0x4371('0x43')]),null,_0x4371('0x44')]]]))};return rp(_0x2567bd)['then'](function(_0x1967b2){try{_0x45beff=eval(_0x1967b2[_0x4371('0x45')](0x5))[0x0][0x2];}catch(_0x2b2a5b){throw new Error(_0x4371('0x46')+_0x1967b2[_0x4371('0x23')]);}if(!_0x45beff){if(_0x1e594a[_0x4371('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x4371('0x48')+_0xff9ccd+_0x4371('0x49'));}}try{_0x45beff=eval(_0x45beff)[0x0];}catch(_0x218f8e){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4371('0x23')]);}const _0x7ad1c3=_0x45beff;_0x54b727=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));fs['writeFileSync'](_0x54b727,_0x45beff,{'encoding':'base64'});_0x3cda4d=path['resolve'](__dirname,'tmp',rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));return convertFile(_0x54b727,_0x3cda4d);})['then'](function(){try{fs[_0x4371('0x1f')](_0x54b727);fs[_0x4371('0x2e')](_0x3cda4d,_0x4371('0x2f'));}catch(_0x18b346){logger[_0x4371('0x16')](_0x18b346);}logger[_0x4371('0x1c')](_0x4371('0x4a'),_0x3cda4d['split']('.')[0x0]);return _0x3cda4d[_0x4371('0x30')]('.')[0x0];});};exports[_0x4371('0x4b')]=function(_0x4c8b2c,_0x18359f,_0x18ad89){return google[_0x4371('0x4c')](_0x4c8b2c,_0x18359f,_0x18ad89)[_0x4371('0x2d')](function(_0x416283){logger[_0x4371('0x1c')](_0x416283['uri']);return rp(_0x416283);})['then'](function(_0x4003b8){var _0x3db745='';var _0x22fa07=0x0;try{fs[_0x4371('0x1f')](_0x4c8b2c);}catch(_0x6984b2){logger[_0x4371('0x16')](_0x6984b2);}if(_0x4003b8&&_0x4003b8['results']){_0x3db745=_0x4003b8['results']['map'](function(_0x3cc314){return _0x3cc314&&_0x3cc314[_0x4371('0x4d')][0x0]&&_0x3cc314['alternatives'][0x0]['transcript']?_0x3cc314[_0x4371('0x4d')][0x0]['transcript']:'';})[_0x4371('0x4e')]('\x0a');_0x22fa07=_0x4003b8['results'][_0x4371('0x4f')](function(_0x37d5fe){return _0x37d5fe&&_0x37d5fe[_0x4371('0x4d')][0x0]&&_0x37d5fe[_0x4371('0x4d')][0x0][_0x4371('0x50')]?_0x37d5fe[_0x4371('0x4d')][0x0][_0x4371('0x50')]:0x0;})[_0x4371('0x4e')]('\x0a');}logger['info']('googleASR\x20transcription',_0x3db745);logger[_0x4371('0x1c')]('googleASR\x20confidence',_0x22fa07);return{'transcript':_0x3db745,'confidence':_0x22fa07};})[_0x4371('0x51')](function(_0x430d18){logger['error'](_0x4371('0x52'),_0x430d18[_0x4371('0x18')],_0x430d18['name'],_0x430d18[_0x4371('0x53')]);});};exports[_0x4371('0x54')]=function(_0x30759b,_0x2df6de,_0x19d9b1,_0x13335f){var _0x11b61c=apiai(_0x2df6de,{'language':_0x13335f||'en'});return _0x11b61c[_0x4371('0x55')](_0x19d9b1,{'sessionId':md5(_0x30759b)})[_0x4371('0x2d')](function(_0x1f44b5){logger[_0x4371('0x1c')](JSON['stringify'](_0x1f44b5));return{'source':_0x1f44b5['result'][_0x4371('0x56')],'resolvedQuery':_0x1f44b5[_0x4371('0x57')][_0x4371('0x58')],'action':_0x1f44b5[_0x4371('0x57')][_0x4371('0x59')],'actionIncomplete':_0x1f44b5['result'][_0x4371('0x5a')],'speech':_0x1f44b5['result'][_0x4371('0x5b')][_0x4371('0x5c')],'score':_0x1f44b5[_0x4371('0x57')][_0x4371('0x5d')],'statusCode':_0x1f44b5[_0x4371('0x5e')][_0x4371('0x5f')],'endConversation':_0x1f44b5[_0x4371('0x57')][_0x4371('0x60')][_0x4371('0x61')]||![],'isFallbackIntent':_0x1f44b5['result'][_0x4371('0x60')][_0x4371('0x62')]};});};exports['googleDialogflowV2']=function(_0x10a87e,_0x15c271,_0x185b92,_0x2ebc64,_0x392698,_0x24c3e8){var _0x1a7deb=_0x2ebc64[_0x4371('0x63')](/\\n/g,'\x0a');var _0x4ae2a2={'credentials':{'private_key':_0x1a7deb,'client_email':_0x185b92}};var _0x1eda24=new dialogflow[(_0x4371('0x64'))](_0x4ae2a2);var _0x20c877=_0x1eda24[_0x4371('0x65')](_0x15c271,md5(_0x10a87e));var _0x37f7e1={'session':_0x20c877,'queryInput':{'text':{'text':_0x392698,'languageCode':_0x24c3e8}}};return _0x1eda24[_0x4371('0x66')](_0x37f7e1)[_0x4371('0x2d')](function(_0x5d8d7a){if(_0x5d8d7a&&_0x5d8d7a[_0x4371('0x47')]){logger['info'](_0x4371('0x67'),JSON['stringify'](_0x5d8d7a));var _0x1234cc=_0x5d8d7a[0x0];if(_0x1234cc){var _0x3ad14e={'action':_0x1234cc[_0x4371('0x68')][_0x4371('0x59')],'allRequiredParamsPresent':_0x1234cc[_0x4371('0x68')]['allRequiredParamsPresent'],'endConversation':_0x1234cc[_0x4371('0x68')][_0x4371('0x69')]&&_0x1234cc[_0x4371('0x68')][_0x4371('0x69')][_0x4371('0x6a')]?_0x1234cc[_0x4371('0x68')][_0x4371('0x69')][_0x4371('0x6a')][_0x4371('0x6b')]['boolValue']:![],'fulfillmentText':_0x1234cc['queryResult'][_0x4371('0x6c')],'intentName':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x6e')],'intentDisplayName':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x6f')],'isFallbackIntent':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x70')],'languageCode':_0x1234cc[_0x4371('0x68')][_0x4371('0x71')],'queryText':_0x1234cc[_0x4371('0x68')][_0x4371('0x72')],'responseId':_0x1234cc[_0x4371('0x73')],'score':_0x1234cc['queryResult'][_0x4371('0x74')],'speech':_0x1234cc['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x4371('0x42')](_0x5d8d7a)};return _0x3ad14e;}}});};exports[_0x4371('0x75')]=function(_0x5554cc,_0x3f5e3b,_0x2cbea6,_0x52c374){return tilde[_0x4371('0x4c')](_0x5554cc,_0x3f5e3b,_0x2cbea6,_0x52c374)[_0x4371('0x2d')](function(_0x39b146){try{fs[_0x4371('0x1f')](_0x5554cc);}catch(_0x5570fc){logger['error'](_0x5570fc);}logger['info'](_0x4371('0x76'),_0x39b146[_0x4371('0x77')]);logger['info'](_0x4371('0x78'),_0x39b146[_0x4371('0x50')]);return _0x39b146;});};exports[_0x4371('0x79')]=function(_0x21d980,_0x15c463,_0x24bab5,_0x72e04d,_0x39c8eb,_0xd81af5){var _0x26688a=path[_0x4371('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0x4371('0x39'));var _0x15bd54;return aws[_0x4371('0x7a')](_0x21d980,_0x15c463,_0x24bab5,_0x72e04d,_0x39c8eb,_0xd81af5,_0x26688a)['then'](function(){_0x15bd54=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs['generate'](0x4)+_0x4371('0x2a'));return convertFile(_0x26688a,_0x15bd54);})[_0x4371('0x2d')](function(){try{fs['unlink'](_0x26688a);fs[_0x4371('0x2e')](_0x15bd54,'777');}catch(_0x339ea4){logger[_0x4371('0x16')](_0x339ea4);}return _0x15bd54[_0x4371('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x532e51,_0x462795,_0x4b1103,_0x5b864d,_0x480b1e,_0x2fb6a3){return aws[_0x4371('0x7b')](_0x532e51,_0x462795,_0x4b1103,_0x5b864d,_0x480b1e,_0x2fb6a3)[_0x4371('0x2d')](function(_0x12004e){logger[_0x4371('0x1c')](JSON['stringify'](_0x12004e));return _0x12004e;});};exports[_0x4371('0x7c')]=function(_0x3fbbed,_0x39585c,_0x3d1727,_0x35e96f){var _0x231d05=util['format'](_0x4371('0x7d'),ISPEECH_API,_0x3fbbed,encodeURIComponent(_0x39585c),_0x3d1727,_0x35e96f);var _0x4ca12e=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));var _0x1856dc;return downloadFile(_0x231d05,_0x4ca12e)[_0x4371('0x2d')](function(){_0x1856dc=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs['generate'](0x4)+_0x4371('0x2a'));return convertFile(_0x4ca12e,_0x1856dc);})[_0x4371('0x2d')](function(){try{fs['unlink'](_0x4ca12e);fs[_0x4371('0x2e')](_0x1856dc,_0x4371('0x2f'));}catch(_0x3a24ec){logger[_0x4371('0x16')](_0x3a24ec);}return _0x1856dc[_0x4371('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0xbef4ea,_0x3491a0,_0x492ac5,_0x2e750c){var _0x4ea717=util[_0x4371('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3491a0,_0x492ac5,base64Encode(_0xbef4ea),_0x2e750c?util['format'](_0x4371('0x7f'),encodeURIComponent(_0x2e750c)):'freeform=3');return uploadFile(_0x4ea717)[_0x4371('0x2d')](function(_0x109022){return querystring['parse'](_0x109022);});};exports[_0x4371('0x80')]=function(_0x3b42bb,_0x4ef35f){return sestek[_0x4371('0x81')](_0x3b42bb,_0x4ef35f)['then'](function(_0x31ef36){logger[_0x4371('0x1c')](JSON[_0x4371('0x42')](_0x31ef36));var _0xb7ca0d={'speech':_0x31ef36['text'],'action':_0x31ef36[_0x4371('0x82')]?_0x31ef36[_0x4371('0x82')]['CustomAction']:undefined,'actiondata':_0x31ef36[_0x4371('0x82')]?_0x31ef36[_0x4371('0x82')][_0x4371('0x83')]:undefined};if(_0x31ef36[_0x4371('0x82')]&&_0x31ef36[_0x4371('0x82')][_0x4371('0x84')]){return base64Decode(_0x31ef36['channelData'][_0x4371('0x84')]['Data'],path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a')))[_0x4371('0x2d')](function(_0xc6540e){_0xb7ca0d[_0x4371('0x85')]=_0xc6540e;return _0xb7ca0d;});}return _0xb7ca0d;});};exports[_0x4371('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x7d71=['freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','path','randomstring','sox','google-tts-api','./aws','./google','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','end','get','data','wav','error\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s'];(function(_0x79b7c0,_0x31862d){var _0xb2c932=function(_0x5711a4){while(--_0x5711a4){_0x79b7c0['push'](_0x79b7c0['shift']());}};_0xb2c932(++_0x31862d);}(_0x7d71,0x18d));var _0x17d7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x7d71[_0x68c979];return _0x4f0001;};'use strict';var apiai=require(_0x17d7('0x0'));var BPromise=require(_0x17d7('0x1'));var dialogflow=require(_0x17d7('0x2'));var fs=require('fs');var http=require(_0x17d7('0x3'));var https=require('https');var md5=require('md5');var path=require(_0x17d7('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x17d7('0x5'));var sox=require(_0x17d7('0x6'));var tts=require(_0x17d7('0x7'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x17d7('0x8'));var google=require(_0x17d7('0x9'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x17d7('0xa'))('agi');var ISPEECH_API=_0x17d7('0xb');function downloadFile(_0xe6fdb9,_0x4d4fb1){return new BPromise(function(_0x577807,_0x169383){var _0x4ae9c3=urlParse(_0xe6fdb9);var _0x143bdb=_0x4ae9c3[_0x17d7('0xc')]===_0x17d7('0xd')?https:http;var _0x2380ce={'host':_0x4ae9c3[_0x17d7('0xe')],'path':_0x4ae9c3['path'],'headers':{'user-agent':_0x17d7('0xf')}};_0x143bdb['get'](_0x2380ce,function(_0x66615b){if(_0x66615b['statusCode']!==0xc8){logger[_0x17d7('0x10')]('request\x20to\x20'+_0xe6fdb9+_0x17d7('0x11')+_0x66615b[_0x17d7('0x12')]+'\x20('+_0x66615b[_0x17d7('0x13')]+')');_0x169383(new Error(_0x17d7('0x14')+_0xe6fdb9+_0x17d7('0x11')+_0x66615b['statusCode']+'\x20('+_0x66615b[_0x17d7('0x13')]+')'));return;}var _0x406ba4=fs[_0x17d7('0x15')](_0x4d4fb1);_0x406ba4['on'](_0x17d7('0x16'),function(){logger[_0x17d7('0x17')](_0x17d7('0x18'));_0x406ba4[_0x17d7('0x19')](_0x577807);});_0x406ba4['on'](_0x17d7('0x10'),function(_0x518e1d){fs['unlink'](_0x4d4fb1);logger['error']('download\x20error',_0x518e1d);_0x169383(_0x518e1d);});_0x66615b[_0x17d7('0x1a')](_0x406ba4);})['on']('error',function(_0x203c82){logger[_0x17d7('0x10')](_0x203c82);_0x169383(_0x203c82);})[_0x17d7('0x1b')]();});}function uploadFile(_0x8ca6c7){return new BPromise(function(_0x568d47,_0x562d71){var _0x3f7c0a=urlParse(_0x8ca6c7);var _0x1c0576=_0x3f7c0a[_0x17d7('0xc')]===_0x17d7('0xd')?https:http;var _0x1ee593={'host':_0x3f7c0a[_0x17d7('0xe')],'path':_0x3f7c0a[_0x17d7('0x4')],'headers':{'user-agent':_0x17d7('0xf')}};_0x1c0576[_0x17d7('0x1c')](_0x1ee593,function(_0x53c5a3){if(_0x53c5a3[_0x17d7('0x12')]!==0xc8){_0x562d71(new Error(_0x17d7('0x14')+_0x8ca6c7+_0x17d7('0x11')+_0x53c5a3[_0x17d7('0x12')]+'\x20('+_0x53c5a3[_0x17d7('0x13')]+')'));return;}var _0x53bbd0='';_0x53c5a3['on'](_0x17d7('0x1d'),function(_0x57f614){_0x53bbd0+=_0x57f614;});_0x53c5a3['on'](_0x17d7('0x1b'),function(){_0x568d47(_0x53bbd0);});})['on']('error',function(_0x842871){_0x562d71(_0x842871);})[_0x17d7('0x1b')]();});}function convertFile(_0x202ac7,_0x4afc38){return new BPromise(function(_0x16e077,_0x4ab291){var _0x5bdb8f=sox['transcode'](_0x202ac7,_0x4afc38,{'sampleRate':0x1f40,'format':_0x17d7('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bdb8f['on'](_0x17d7('0x10'),function(_0x11c4d0){logger[_0x17d7('0x10')](_0x17d7('0x1f'),_0x11c4d0);_0x4ab291(_0x11c4d0);});_0x5bdb8f['on'](_0x17d7('0x1b'),function(){logger[_0x17d7('0x17')]('finish\x20to\x20convert');_0x16e077();});_0x5bdb8f['start']();});}function base64Decode(_0x579d91,_0x71b645){var _0x2fb589=path[_0x17d7('0x20')](__dirname,'tmp',rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));fs[_0x17d7('0x23')](_0x2fb589,_0x579d91,_0x17d7('0x24'));return convertFile(_0x2fb589,_0x71b645)[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x2fb589);fs[_0x17d7('0x27')](_0x71b645,_0x17d7('0x28'));}catch(_0x5ac430){logger[_0x17d7('0x10')](_0x5ac430);}return _0x71b645[_0x17d7('0x29')]('.')[0x0];});}function base64Encode(_0x1bc0b7){var _0x184818=fs[_0x17d7('0x2a')](_0x1bc0b7);return new Buffer(_0x184818)[_0x17d7('0x2b')](_0x17d7('0x24'));}exports[_0x17d7('0x2c')]=function(_0x2049ae,_0x3f276b,_0x308726,_0x3736bc,_0x30fc7c,_0x3807d2){var _0x23e97d,_0x46cbd7;var _0x5e2eaf='https://texttospeech.googleapis.com/v1/';var _0x30ddd9=_0x17d7('0x2d')+_0x2049ae;var _0x14d730={};if(_0x3f276b===_0x17d7('0x2e')){_0x14d730[_0x17d7('0x2f')]={'ssml':_0x308726};}else{_0x14d730[_0x17d7('0x2f')]={'text':_0x308726};};_0x14d730['voice']={'languageCode':_0x3736bc,'ssmlGender':_0x30fc7c};_0x14d730[_0x17d7('0x30')]={'audioEncoding':_0x17d7('0x31'),'sampleRateHertz':0x1f40};var _0x3dbc3c={'url':_0x5e2eaf+_0x17d7('0x32')+_0x30ddd9,'method':'POST','json':!![],'body':_0x14d730};return rp(_0x3dbc3c)[_0x17d7('0x25')](function(_0x5f2e1a){return new BPromise(function(_0x2ec4a6,_0x3cb42f){_0x23e97d=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x34'));var _0x3a00fc=Buffer[_0x17d7('0x35')](_0x5f2e1a[_0x17d7('0x36')],_0x17d7('0x24'));return fs[_0x17d7('0x37')](_0x23e97d,_0x3a00fc,function(_0x4a7b19){_0x3cb42f(_0x4a7b19);},function(_0x370e8b){fs['chmodSync'](_0x23e97d,_0x17d7('0x28'));_0x2ec4a6(_0x370e8b);});});})[_0x17d7('0x25')](function(_0x3369a2){_0x46cbd7=path['resolve'](__dirname,'tmp',rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x23e97d,_0x46cbd7);})['then'](function(){try{fs['unlink'](_0x23e97d);fs[_0x17d7('0x27')](_0x46cbd7,_0x17d7('0x28'));}catch(_0x314e91){logger[_0x17d7('0x10')](_0x314e91);}logger[_0x17d7('0x17')](_0x17d7('0x38'),_0x46cbd7[_0x17d7('0x29')]('.')[0x0]);return _0x46cbd7[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x39')]=function(_0x2537f9,_0x495f21){var _0x518a90=_0x17d7('0x3a');var _0x532b73,_0x4c280f;var _0x24f571;var _0x40170b={'encoding':_0x17d7('0x3b'),'method':'POST','timeout':0x2710,'url':_0x518a90,'headers':{'Content-Type':_0x17d7('0x3c')},'body':_0x17d7('0x3d')+encodeURIComponent(JSON[_0x17d7('0x3e')]([[[_0x17d7('0x3f'),JSON[_0x17d7('0x3e')]([_0x2537f9,_0x495f21||'en',![],_0x17d7('0x40')]),null,_0x17d7('0x41')]]]))};return rp(_0x40170b)[_0x17d7('0x25')](function(_0x56a2d4){try{_0x24f571=eval(_0x56a2d4[_0x17d7('0x42')](0x5))[0x0][0x2];}catch(_0x286022){throw new Error(_0x17d7('0x43')+_0x56a2d4[_0x17d7('0x1d')]);}if(!_0x24f571){if(_0x2537f9[_0x17d7('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x17d7('0x45')+_0x495f21+'\x22\x20might\x20not\x20exist');}}try{_0x24f571=eval(_0x24f571)[0x0];}catch(_0x4bc662){throw new Error(_0x17d7('0x43')+res['data']);}const _0x2b2f34=_0x24f571;_0x532b73=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x532b73,_0x24f571,{'encoding':_0x17d7('0x24')});_0x4c280f=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+'.wav');return convertFile(_0x532b73,_0x4c280f);})[_0x17d7('0x25')](function(){try{fs['unlink'](_0x532b73);fs['chmodSync'](_0x4c280f,_0x17d7('0x28'));}catch(_0x1d4a49){logger[_0x17d7('0x10')](_0x1d4a49);}logger[_0x17d7('0x17')](_0x17d7('0x46'),_0x4c280f['split']('.')[0x0]);return _0x4c280f[_0x17d7('0x29')]('.')[0x0];});};exports['googleASR']=function(_0xe3b5e3,_0x803f12,_0x5a770e){return google[_0x17d7('0x47')](_0xe3b5e3,_0x803f12,_0x5a770e)['then'](function(_0x4b9514){logger[_0x17d7('0x17')](_0x4b9514[_0x17d7('0x48')]);return rp(_0x4b9514);})[_0x17d7('0x25')](function(_0x34e343){var _0x4ad205='';var _0x1e7b5e=0x0;try{fs[_0x17d7('0x26')](_0xe3b5e3);}catch(_0x2679dd){logger[_0x17d7('0x10')](_0x2679dd);}if(_0x34e343&&_0x34e343['results']){_0x4ad205=_0x34e343[_0x17d7('0x49')][_0x17d7('0x4a')](function(_0x25257b){return _0x25257b&&_0x25257b[_0x17d7('0x4b')][0x0]&&_0x25257b[_0x17d7('0x4b')][0x0][_0x17d7('0x4c')]?_0x25257b['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x1e7b5e=_0x34e343[_0x17d7('0x49')][_0x17d7('0x4a')](function(_0x86f32c){return _0x86f32c&&_0x86f32c[_0x17d7('0x4b')][0x0]&&_0x86f32c['alternatives'][0x0][_0x17d7('0x4d')]?_0x86f32c[_0x17d7('0x4b')][0x0][_0x17d7('0x4d')]:0x0;})['join']('\x0a');}logger[_0x17d7('0x17')](_0x17d7('0x4e'),_0x4ad205);logger[_0x17d7('0x17')](_0x17d7('0x4f'),_0x1e7b5e);return{'transcript':_0x4ad205,'confidence':_0x1e7b5e};})['catch'](function(_0x306a43){logger['error']('[%s]\x20%s:%s',_0x306a43[_0x17d7('0x12')],_0x306a43['name'],_0x306a43['message']);});};exports[_0x17d7('0x50')]=function(_0x11165b,_0x3cd79,_0x56799b,_0x410ce7){var _0x34a6c5=apiai(_0x3cd79,{'language':_0x410ce7||'en'});return _0x34a6c5[_0x17d7('0x51')](_0x56799b,{'sessionId':md5(_0x11165b)})[_0x17d7('0x25')](function(_0x3180c3){logger['info'](JSON[_0x17d7('0x3e')](_0x3180c3));return{'source':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x53')],'resolvedQuery':_0x3180c3[_0x17d7('0x52')]['resolvedQuery'],'action':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x54')],'actionIncomplete':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x55')],'speech':_0x3180c3['result'][_0x17d7('0x56')][_0x17d7('0x57')],'score':_0x3180c3['result'][_0x17d7('0x58')],'statusCode':_0x3180c3['status']['code'],'endConversation':_0x3180c3['result'][_0x17d7('0x59')]['endConversation']||![],'isFallbackIntent':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x59')][_0x17d7('0x5a')]};});};exports[_0x17d7('0x5b')]=function(_0x2666ca,_0x41135f,_0x2de13a,_0x54e6f7,_0x5b50c4,_0x3dc736){var _0x2d2172=_0x54e6f7[_0x17d7('0x5c')](/\\n/g,'\x0a');var _0x13c15b={'credentials':{'private_key':_0x2d2172,'client_email':_0x2de13a}};var _0x37c648=new dialogflow['SessionsClient'](_0x13c15b);var _0x23b1fc=_0x37c648[_0x17d7('0x5d')](_0x41135f,md5(_0x2666ca));var _0x496b72={'session':_0x23b1fc,'queryInput':{'text':{'text':_0x5b50c4,'languageCode':_0x3dc736}}};return _0x37c648['detectIntent'](_0x496b72)['then'](function(_0x281fa0){if(_0x281fa0&&_0x281fa0[_0x17d7('0x44')]){logger[_0x17d7('0x17')](_0x17d7('0x5e'),JSON[_0x17d7('0x3e')](_0x281fa0));var _0x53c17e=_0x281fa0[0x0];if(_0x53c17e){var _0x4da6fe={'action':_0x53c17e['queryResult'][_0x17d7('0x54')],'allRequiredParamsPresent':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x60')],'endConversation':_0x53c17e[_0x17d7('0x5f')]['diagnosticInfo']&&_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x61')][_0x17d7('0x62')]?_0x53c17e['queryResult'][_0x17d7('0x61')][_0x17d7('0x62')]['end_conversation'][_0x17d7('0x63')]:![],'fulfillmentText':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x64')],'intentName':_0x53c17e['queryResult'][_0x17d7('0x65')][_0x17d7('0x66')],'intentDisplayName':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x65')][_0x17d7('0x67')],'isFallbackIntent':_0x53c17e[_0x17d7('0x5f')]['intent'][_0x17d7('0x68')],'languageCode':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x69')],'queryText':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x6a')],'responseId':_0x53c17e['responseId'],'score':_0x53c17e['queryResult'][_0x17d7('0x6b')],'speech':_0x53c17e[_0x17d7('0x5f')]['fulfillmentText'],'providerResponse':JSON[_0x17d7('0x3e')](_0x281fa0)};return _0x4da6fe;}}});};exports[_0x17d7('0x6c')]=function(_0xd7eeb3,_0x2ee23e,_0x22a83d,_0x1ff472){return tilde[_0x17d7('0x47')](_0xd7eeb3,_0x2ee23e,_0x22a83d,_0x1ff472)[_0x17d7('0x25')](function(_0x1beff4){try{fs[_0x17d7('0x26')](_0xd7eeb3);}catch(_0x5bd6fe){logger['error'](_0x5bd6fe);}logger[_0x17d7('0x17')](_0x17d7('0x6d'),_0x1beff4['transcript']);logger[_0x17d7('0x17')]('Tilde\x20ASR\x20confidence',_0x1beff4[_0x17d7('0x4d')]);return _0x1beff4;});};exports[_0x17d7('0x6e')]=function(_0x293002,_0x47c72f,_0x2c0b5b,_0x12364c,_0x1f9d64,_0x5f11b1){var _0x1b2f41=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs['generate'](0x4)+'.mp3');var _0x52d723;return aws[_0x17d7('0x6f')](_0x293002,_0x47c72f,_0x2c0b5b,_0x12364c,_0x1f9d64,_0x5f11b1,_0x1b2f41)[_0x17d7('0x25')](function(){_0x52d723=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x1b2f41,_0x52d723);})[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x1b2f41);fs['chmodSync'](_0x52d723,_0x17d7('0x28'));}catch(_0x28448d){logger[_0x17d7('0x10')](_0x28448d);}return _0x52d723[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x70')]=function(_0x3520f0,_0x432115,_0x5aec3c,_0x37e868,_0x2ed717,_0x344ccb){return aws[_0x17d7('0x71')](_0x3520f0,_0x432115,_0x5aec3c,_0x37e868,_0x2ed717,_0x344ccb)[_0x17d7('0x25')](function(_0x2823aa){logger[_0x17d7('0x17')](JSON['stringify'](_0x2823aa));return _0x2823aa;});};exports[_0x17d7('0x72')]=function(_0xbbcf23,_0x5a21bf,_0x31b204,_0x450853){var _0x3d1900=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xbbcf23,encodeURIComponent(_0x5a21bf),_0x31b204,_0x450853);var _0x2bccf4=path[_0x17d7('0x20')](__dirname,'tmp',rs['generate'](0x4)+_0x17d7('0x34'));var _0x622d9b;return downloadFile(_0x3d1900,_0x2bccf4)[_0x17d7('0x25')](function(){_0x622d9b=path['resolve'](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x2bccf4,_0x622d9b);})[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x2bccf4);fs[_0x17d7('0x27')](_0x622d9b,_0x17d7('0x28'));}catch(_0x13ed77){logger[_0x17d7('0x10')](_0x13ed77);}return _0x622d9b[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x73')]=function(_0x37d00c,_0x47d158,_0xd8ac3c,_0x329ee0){var _0x47730d=util[_0x17d7('0x74')](_0x17d7('0x75'),ISPEECH_API,_0x47d158,_0xd8ac3c,base64Encode(_0x37d00c),_0x329ee0?util[_0x17d7('0x74')](_0x17d7('0x76'),encodeURIComponent(_0x329ee0)):_0x17d7('0x77'));return uploadFile(_0x47730d)['then'](function(_0x4af26c){return querystring['parse'](_0x4af26c);});};exports[_0x17d7('0x78')]=function(_0x369f3c,_0x9c0d6f){return sestek[_0x17d7('0x79')](_0x369f3c,_0x9c0d6f)['then'](function(_0x278347){logger[_0x17d7('0x17')](JSON[_0x17d7('0x3e')](_0x278347));var _0x213be5={'speech':_0x278347[_0x17d7('0x7a')],'action':_0x278347[_0x17d7('0x7b')]?_0x278347[_0x17d7('0x7b')][_0x17d7('0x7c')]:undefined,'actiondata':_0x278347['channelData']?_0x278347['channelData'][_0x17d7('0x7d')]:undefined};if(_0x278347['channelData']&&_0x278347[_0x17d7('0x7b')]['AudioFromTts']){return base64Decode(_0x278347[_0x17d7('0x7b')][_0x17d7('0x7e')][_0x17d7('0x7f')],path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs['generate'](0x4)+_0x17d7('0x22')))[_0x17d7('0x25')](function(_0x1a4d7c){_0x213be5[_0x17d7('0x80')]=_0x1a4d7c;return _0x213be5;});}return _0x213be5;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 4a90cbf..cf14acd 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 _0x72f7=['./nda'];(function(_0x3acc81,_0xf7c3cc){var _0x3308e6=function(_0x1063b1){while(--_0x1063b1){_0x3acc81['push'](_0x3acc81['shift']());}};_0x3308e6(++_0xf7c3cc);}(_0x72f7,0x93));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};var nda=require(_0x772f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x24be=['./nda'];(function(_0x17baf7,_0x36bcba){var _0x3b4ccc=function(_0x358870){while(--_0x358870){_0x17baf7['push'](_0x17baf7['shift']());}};_0x3b4ccc(++_0x36bcba);}(_0x24be,0xd0));var _0xe24b=function(_0x857e60,_0x40a0c4){_0x857e60=_0x857e60-0x0;var _0x21a214=_0x24be[_0x857e60];return _0x21a214;};var nda=require(_0xe24b('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 23a04bd..383a1af 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 _0xc36d=['custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x389859,_0x156658){var _0x520d21=function(_0x4ac6a6){while(--_0x4ac6a6){_0x389859['push'](_0x389859['shift']());}};_0x520d21(++_0x156658);}(_0xc36d,0x7d));var _0xdc36=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xc36d[_0x25f3e3];return _0xa89b6d;};'use strict';var rp=require(_0xdc36('0x0'));var url=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));module[_0xdc36('0x4')]=function(_0x2d5df5,_0x4c42dd){var _0x42522b={'method':_0xdc36('0x5'),'uri':url['resolve'](_0x4c42dd[_0xdc36('0x6')],_0xdc36('0x7')),'form':{'grant_type':_0xdc36('0x8'),'username':_0x4c42dd[_0xdc36('0x9')],'password':_0x4c42dd[_0xdc36('0x8')]},'json':!![]};return rp(_0x42522b)['then'](function(_0x20ba02){var _0x456897={'method':_0xdc36('0x5'),'uri':url[_0xdc36('0xa')](_0x4c42dd['ndassistant_url'],_0xdc36('0xb')),'body':{'type':_0x4c42dd[_0xdc36('0xc')]||'message','channelId':_0xdc36('0xd'),'conversation':{'id':_0x2d5df5[_0xdc36('0xe')]},'from':{'id':_0x2d5df5[_0xdc36('0xf')],'name':_0x2d5df5['calleridname']},'recipient':{'id':_0x2d5df5[_0xdc36('0x10')],'name':_0x2d5df5[_0xdc36('0x11')]},'text':_0x4c42dd['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x20ba02[_0xdc36('0x12')]},'json':!![]};if(_0x4c42dd[_0xdc36('0x13')]){_0x456897[_0xdc36('0x14')][_0xdc36('0x15')]['ProjectName']=_0x4c42dd[_0xdc36('0x13')];}if(_0x4c42dd[_0xdc36('0x16')]=='1'){_0x456897[_0xdc36('0x14')][_0xdc36('0x15')][_0xdc36('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdc36('0x18')};}if(_0x4c42dd[_0xdc36('0x19')]){_0x456897[_0xdc36('0x14')]['channelData'][_0xdc36('0x1a')]=_0x4c42dd['custom_action'];if(_0x4c42dd['custom_action_data']){_0x456897['body'][_0xdc36('0x15')][_0xdc36('0x1b')]=_0x4c42dd['custom_action_data'];}}logger[_0xdc36('0x1c')](JSON[_0xdc36('0x1d')](_0x456897));return rp(_0x456897);});}; \ No newline at end of file +var _0xf2a6=['POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','exports'];(function(_0x2c1c4c,_0x40c066){var _0x1907c2=function(_0x4558e8){while(--_0x4558e8){_0x2c1c4c['push'](_0x2c1c4c['shift']());}};_0x1907c2(++_0x40c066);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5ebd5a,_0x1fe518){_0x5ebd5a=_0x5ebd5a-0x0;var _0xa8c6ff=_0xf2a6[_0x5ebd5a];return _0xa8c6ff;};'use strict';var rp=require(_0x6f2a('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module[_0x6f2a('0x1')]=function(_0x5b2cbc,_0x3b14e2){var _0xf60faa={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x4')],_0x6f2a('0x5')),'form':{'grant_type':_0x6f2a('0x6'),'username':_0x3b14e2[_0x6f2a('0x7')],'password':_0x3b14e2[_0x6f2a('0x6')]},'json':!![]};return rp(_0xf60faa)[_0x6f2a('0x8')](function(_0x4b4fde){var _0x379b80={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3b14e2[_0x6f2a('0xa')]||'message','channelId':_0x6f2a('0xb'),'conversation':{'id':_0x5b2cbc[_0x6f2a('0xc')]},'from':{'id':_0x5b2cbc[_0x6f2a('0xd')],'name':_0x5b2cbc['calleridname']},'recipient':{'id':_0x5b2cbc[_0x6f2a('0xe')],'name':_0x5b2cbc['extension']},'text':_0x3b14e2[_0x6f2a('0xf')],'channelData':{}},'headers':{'Authorization':_0x6f2a('0x10')+_0x4b4fde[_0x6f2a('0x11')]},'json':!![]};if(_0x3b14e2['project']){_0x379b80[_0x6f2a('0x12')]['channelData'][_0x6f2a('0x13')]=_0x3b14e2[_0x6f2a('0x14')];}if(_0x3b14e2[_0x6f2a('0x15')]=='1'){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6f2a('0x17')};}if(_0x3b14e2[_0x6f2a('0x18')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x19')]=_0x3b14e2[_0x6f2a('0x18')];if(_0x3b14e2[_0x6f2a('0x1a')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x1b')]=_0x3b14e2[_0x6f2a('0x1a')];}}logger[_0x6f2a('0x1c')](JSON['stringify'](_0x379b80));return rp(_0x379b80);});}; \ 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 0032d25..bbc8c0c 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 _0x4c37=['./lib/api','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c37,0x19a));var _0x74c3=function(_0x14c2c2,_0x5aaba4){_0x14c2c2=_0x14c2c2-0x0;var _0x3f88a5=_0x4c37[_0x14c2c2];return _0x3f88a5;};'use strict';var asr=require(_0x74c3('0x0'));module[_0x74c3('0x1')]=function(_0x45bb66,_0x174b03,_0xbfbb6a,_0x9433e1){return asr(_0x45bb66,_0x174b03,_0xbfbb6a,_0x9433e1);}; \ No newline at end of file +var _0xa568=['exports','./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa568,0x197));var _0x8a56=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa568[_0x57b54c];return _0x59cc19;};'use strict';var asr=require(_0x8a56('0x0'));module[_0x8a56('0x1')]=function(_0x4ac5b8,_0xe401a6,_0x25000b,_0x3a94ef){return asr(_0x4ac5b8,_0xe401a6,_0x25000b,_0x3a94ef);}; \ 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 0e84d66..db69bfa 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 _0xa70f=['EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','final','Tilde\x20ASR\x20hypoteses','hypotheses','result','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','stringify','createReadStream','send','close'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa70f,0xba));var _0xfa70=function(_0x705c3c,_0x1c44c8){_0x705c3c=_0x705c3c-0x0;var _0x5a7578=_0xa70f[_0x705c3c];return _0x5a7578;};'use strict';var BPromise=require(_0xfa70('0x0'));var _=require(_0xfa70('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfa70('0x2'));var crypto=require(_0xfa70('0x3'));var logger=require('../../../../../../config/logger')(_0xfa70('0x4'));module['exports']=function(_0x1a136f,_0x46319d,_0x322937,_0x5da584){return new BPromise(function(_0x516f39,_0x8cde41){logger[_0xfa70('0x5')](_0xfa70('0x6'),_0x5da584||_0xfa70('0x7'));var _0x39f39e=new WebSocket(_0x5da584||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2c857a='';var _0x1583c0='0';var _0x24bdb3='1';var _0xfbc47d=_0xfa70('0x8');function _0x13ab0a(_0x22eb2c){var _0x2380b8=crypto[_0xfa70('0x9')](_0xfa70('0xa'));_0x2380b8[_0xfa70('0xb')](_0x22eb2c);return _0x2380b8[_0xfa70('0xc')](_0xfa70('0xd'));}function _0x2d4da6(){try{logger[_0xfa70('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x28c4ae=moment()[_0xfa70('0xe')]();var _0x457e0c=_0x13ab0a(_0x28c4ae+_0x46319d+_0x322937);_0x39f39e['send'](JSON[_0xfa70('0xf')]({'appID':_0x46319d,'timestamp':_0x28c4ae,'appKey':_0x457e0c}));var _0x42f255=fs[_0xfa70('0x10')](_0x1a136f);_0x42f255['on']('data',function(_0x43e0f0){_0x39f39e[_0xfa70('0x11')](_0x43e0f0);});_0x42f255['on'](_0xfa70('0x12'),function(){_0x39f39e[_0xfa70('0x11')](_0xfa70('0x13'));});}catch(_0x5cabab){logger[_0xfa70('0x14')](_0xfa70('0x15'),JSON[_0xfa70('0xf')](_0x5cabab));_0x39f39e['terminate']();}}function _0x203c1b(_0x4b2396){try{if(_0x4b2396){var _0x30e40e=JSON[_0xfa70('0x16')](_0x4b2396);switch(_0x30e40e[_0xfa70('0x17')]){case 0x0:if(_0x30e40e['result']){if(_0x30e40e['result'][_0xfa70('0x18')]){logger[_0xfa70('0x5')](_0xfa70('0x19'),JSON[_0xfa70('0xf')](_0x30e40e['result'][_0xfa70('0x1a')]));_0x2c857a=_0x30e40e[_0xfa70('0x1b')][_0xfa70('0x1a')][0x0][_0xfa70('0x1c')];_0x1583c0=_0x30e40e['result'][_0xfa70('0x1a')][0x0]['likelihood'];_0x24bdb3='0';_0xfbc47d='Success.';_0x39f39e['terminate']();}}break;case 0x1:logger[_0xfa70('0x5')](_0xfa70('0x8'));_0x24bdb3='1';_0xfbc47d=_0xfa70('0x8');break;case 0x2:logger['info'](_0xfa70('0x1d'));_0x24bdb3='2';_0xfbc47d=_0xfa70('0x1d');break;case 0x9:logger[_0xfa70('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x24bdb3='9';_0xfbc47d=_0xfa70('0x1e');break;case 0xa:logger['info'](_0xfa70('0x1f'));_0x24bdb3='10';_0xfbc47d=_0xfa70('0x1f');break;case 0xb:logger[_0xfa70('0x5')](_0xfa70('0x20'));_0x24bdb3='11';_0xfbc47d='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x682cc2){logger[_0xfa70('0x14')](_0xfa70('0x21'),JSON[_0xfa70('0xf')](_0x682cc2));_0x39f39e[_0xfa70('0x22')]();}}function _0x130c11(){logger[_0xfa70('0x5')](_0xfa70('0x23'));_0x516f39({'transcript':_0x2c857a,'confidence':_0x1583c0,'status':_0x24bdb3,'status_message':_0xfbc47d});}function _0x5d2dab(_0x5f5a4c){logger[_0xfa70('0x14')](_0xfa70('0x24'));if(!_[_0xfa70('0x25')](_0x5f5a4c)){logger[_0xfa70('0x14')](_[_0xfa70('0x26')](_0x5f5a4c)?JSON[_0xfa70('0xf')](_0x5f5a4c):_0x5f5a4c);}}_0x39f39e['on'](_0xfa70('0x27'),_0x2d4da6);_0x39f39e['on'](_0xfa70('0x28'),_0x203c1b);_0x39f39e['on']('close',_0x130c11);_0x39f39e['on'](_0xfa70('0x14'),_0x5d2dab);});}; \ No newline at end of file +var _0xfe21=['sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x46f8d6,_0x117e5d){var _0x4fa236=function(_0x341c89){while(--_0x341c89){_0x46f8d6['push'](_0x46f8d6['shift']());}};_0x4fa236(++_0x117e5d);}(_0xfe21,0x1af));var _0x1fe2=function(_0x3094f8,_0x391321){_0x3094f8=_0x3094f8-0x0;var _0x4df439=_0xfe21[_0x3094f8];return _0x4df439;};'use strict';var BPromise=require(_0x1fe2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1fe2('0x1'));var crypto=require('crypto');var logger=require(_0x1fe2('0x2'))(_0x1fe2('0x3'));module['exports']=function(_0x3c0f02,_0x5e2f93,_0x1752e0,_0x109fe5){return new BPromise(function(_0x3df235,_0x34b492){logger[_0x1fe2('0x4')](_0x1fe2('0x5'),_0x109fe5||_0x1fe2('0x6'));var _0x12aacf=new WebSocket(_0x109fe5||_0x1fe2('0x6'),{'perMessageDeflate':![]});var _0x484f4b='';var _0x19b205='0';var _0x31262c='1';var _0x133e45=_0x1fe2('0x7');function _0x59ac28(_0xc753cb){var _0x31711b=crypto[_0x1fe2('0x8')](_0x1fe2('0x9'));_0x31711b[_0x1fe2('0xa')](_0xc753cb);return _0x31711b[_0x1fe2('0xb')]('hex');}function _0x518dde(){try{logger[_0x1fe2('0x4')](_0x1fe2('0xc'));var _0x224a96=moment()[_0x1fe2('0xd')]();var _0x1f8b39=_0x59ac28(_0x224a96+_0x5e2f93+_0x1752e0);_0x12aacf[_0x1fe2('0xe')](JSON['stringify']({'appID':_0x5e2f93,'timestamp':_0x224a96,'appKey':_0x1f8b39}));var _0x9064f0=fs[_0x1fe2('0xf')](_0x3c0f02);_0x9064f0['on'](_0x1fe2('0x10'),function(_0x51eeb6){_0x12aacf[_0x1fe2('0xe')](_0x51eeb6);});_0x9064f0['on'](_0x1fe2('0x11'),function(){_0x12aacf[_0x1fe2('0xe')](_0x1fe2('0x12'));});}catch(_0x5d15ad){logger['error'](_0x1fe2('0x13'),JSON[_0x1fe2('0x14')](_0x5d15ad));_0x12aacf['terminate']();}}function _0x448a8b(_0x3e901d){try{if(_0x3e901d){var _0x3500f5=JSON[_0x1fe2('0x15')](_0x3e901d);switch(_0x3500f5[_0x1fe2('0x16')]){case 0x0:if(_0x3500f5['result']){if(_0x3500f5['result'][_0x1fe2('0x17')]){logger[_0x1fe2('0x4')](_0x1fe2('0x18'),JSON[_0x1fe2('0x14')](_0x3500f5[_0x1fe2('0x19')][_0x1fe2('0x1a')]));_0x484f4b=_0x3500f5['result'][_0x1fe2('0x1a')][0x0]['transcript'];_0x19b205=_0x3500f5[_0x1fe2('0x19')][_0x1fe2('0x1a')][0x0][_0x1fe2('0x1b')];_0x31262c='0';_0x133e45=_0x1fe2('0x1c');_0x12aacf[_0x1fe2('0x1d')]();}}break;case 0x1:logger[_0x1fe2('0x4')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x31262c='1';_0x133e45=_0x1fe2('0x7');break;case 0x2:logger[_0x1fe2('0x4')](_0x1fe2('0x1e'));_0x31262c='2';_0x133e45='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x1fe2('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x31262c='9';_0x133e45=_0x1fe2('0x1f');break;case 0xa:logger[_0x1fe2('0x4')](_0x1fe2('0x20'));_0x31262c='10';_0x133e45='Authentication\x20failed.';break;case 0xb:logger[_0x1fe2('0x4')](_0x1fe2('0x21'));_0x31262c='11';_0x133e45=_0x1fe2('0x21');}}}catch(_0xf66fb0){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0xf66fb0));_0x12aacf['terminate']();}}function _0x2d0f3e(){logger[_0x1fe2('0x4')](_0x1fe2('0x22'));_0x3df235({'transcript':_0x484f4b,'confidence':_0x19b205,'status':_0x31262c,'status_message':_0x133e45});}function _0x255661(_0x20d685){logger[_0x1fe2('0x23')](_0x1fe2('0x24'));if(!_['isNil'](_0x20d685)){logger[_0x1fe2('0x23')](_[_0x1fe2('0x25')](_0x20d685)?JSON[_0x1fe2('0x14')](_0x20d685):_0x20d685);}}_0x12aacf['on'](_0x1fe2('0x26'),_0x518dde);_0x12aacf['on'](_0x1fe2('0x27'),_0x448a8b);_0x12aacf['on']('close',_0x2d0f3e);_0x12aacf['on'](_0x1fe2('0x23'),_0x255661);});}; \ 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 23290c7..715cab2 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 _0xddcc=['./asr','exports'];(function(_0x894081,_0x1764c6){var _0x182845=function(_0xfc78fc){while(--_0xfc78fc){_0x894081['push'](_0x894081['shift']());}};_0x182845(++_0x1764c6);}(_0xddcc,0x96));var _0xcddc=function(_0x93ef34,_0x7070f8){_0x93ef34=_0x93ef34-0x0;var _0x4f35c6=_0xddcc[_0x93ef34];return _0x4f35c6;};var asr=require(_0xcddc('0x0'));module[_0xcddc('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf5d9=['./asr'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xf5d9,0xbd));var _0x9f5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf5d9[_0x3ab51d];return _0x29a04e;};var asr=require(_0x9f5d('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2bd3c3d..6c79a70 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0xe706,0xa3));var _0x6e70=function(_0x405ac9,_0x2c795c){_0x405ac9=_0x405ac9-0x0;var _0x2d200f=_0xe706[_0x405ac9];return _0x2d200f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7096e6d..928fe5a 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 _0xb138=['vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','getVariableById','then','name','catch','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','rawBody','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','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_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','isString','replaceObjectAllVariables','isPlainObject','isArray','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','hasOwnProperty','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s.%s','NOBEEP','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','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','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','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20found','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL'];(function(_0x38ff6c,_0x3b8e2b){var _0x1ee0c1=function(_0x10533d){while(--_0x10533d){_0x38ff6c['push'](_0x38ff6c['shift']());}};_0x1ee0c1(++_0x3b8e2b);}(_0xb138,0x1dd));var _0x8b13=function(_0x374888,_0x4fe130){_0x374888=_0x374888-0x0;var _0x39fc0a=_0xb138[_0x374888];return _0x39fc0a;};'use strict';var fs=require('fs');var util=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var sh=require(_0x8b13('0x2'));var odbc=require(_0x8b13('0x3'))();var rs=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var Mustache=require(_0x8b13('0x6'));var rp=require('request-promise');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var scripts=require('./scripts');var FILES_PATH=_0x8b13('0xa');var recursiveMapAttributes=[_0x8b13('0xb'),'rawBody'];var verticesWithRetry=[_0x8b13('0xc'),_0x8b13('0xd'),_0x8b13('0xe')];var AGIVertices=function(_0x498832,_0x8570b0,_0x1aed6f){this['channel']=_0x498832;this['rpc']=_0x8570b0;this[_0x8b13('0xf')]=_0x1aed6f;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x11')]=function(_0x439451,_0x3e8eca){this['rpc'][_0x8b13('0x12')](_0x439451)[_0x8b13('0x13')](function(_0x1a93c4){_0x3e8eca(null,_0x1a93c4?_0x1a93c4[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x1893b1){_0x3e8eca(_0x1893b1);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x3dcde6,_0x130a6f){this['rpc']['getVoiceQueueById'](_0x3dcde6)['then'](function(_0x272cb0){_0x130a6f(null,_0x272cb0?_0x272cb0[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x2c615a){_0x130a6f(_0x2c615a);});};AGIVertices[_0x8b13('0x10')]['getSquareProject']=function(_0x1c6c99,_0xea7881){this[_0x8b13('0x16')][_0x8b13('0x17')](_0x1c6c99)[_0x8b13('0x13')](function(_0x1fcfe6){_0xea7881(null,_0x1fcfe6?_0x1fcfe6[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x4989d3){_0xea7881(_0x4989d3);});};AGIVertices['prototype'][_0x8b13('0x18')]=function(_0x335709,_0x14a8ac){this[_0x8b13('0x16')][_0x8b13('0x19')](_0x335709)[_0x8b13('0x13')](function(_0x559442){_0x14a8ac(null,_0x559442?_0x559442[_0x8b13('0x1a')]:![]);})[_0x8b13('0x15')](function(_0x1595d8){_0x14a8ac(_0x1595d8);});};AGIVertices['prototype']['getUser']=function(_0xe73329,_0xcb7621){this['rpc'][_0x8b13('0x1b')](_0xe73329)[_0x8b13('0x13')](function(_0x37ca5f){_0xcb7621(null,_0x37ca5f?_0x37ca5f[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x583639){_0xcb7621(_0x583639);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1c')]=function(_0x5f15f0,_0x33422f){this['rpc'][_0x8b13('0x1d')](_0x5f15f0)[_0x8b13('0x13')](function(_0x54786a){_0x33422f(null,_0x54786a?_0x54786a[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x4f8e58){_0x33422f(_0x4f8e58);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1e')]=function(_0x410122,_0x4048e4){var _0x27fef3=this;this['rpc'][_0x8b13('0x1f')](_0x410122)[_0x8b13('0x13')](function(_0x3475d8){_0x4048e4(null,_0x3475d8?_0x27fef3[_0x8b13('0x20')](_0x3475d8[_0x8b13('0x21')]):![]);})[_0x8b13('0x15')](function(_0x5ab161){_0x4048e4(_0x5ab161);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x22')]=function(_0x109f0e,_0x9d2377){this[_0x8b13('0x16')][_0x8b13('0x23')](_0x109f0e)[_0x8b13('0x13')](function(_0x44bce2){_0x9d2377(null,_0x44bce2?_0x44bce2:![]);})[_0x8b13('0x15')](function(_0x5751db){_0x9d2377(_0x5751db);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x24')]=function(_0x288ff7,_0x2878a6,_0x51a334){this['mailRpc'][_0x8b13('0x24')](_0x288ff7,_0x2878a6)['then'](function(){_0x51a334(null);})['catch'](function(_0x3b1dfa){_0x51a334(_0x3b1dfa);});};AGIVertices['prototype'][_0x8b13('0x25')]=function(_0x408626,_0x40fc29){this[_0x8b13('0x16')][_0x8b13('0x26')](_0x408626)[_0x8b13('0x13')](function(_0x1fcd82){if(_0x1fcd82){if(_0x1fcd82[_0x8b13('0x27')]){_0x40fc29(null,[_0x1fcd82[_0x8b13('0x28')]]);}else{_0x40fc29(null,_[_0x8b13('0x29')](_0x1fcd82['Intervals'],_0x8b13('0x28')));}}else{_0x40fc29(null,![]);}})[_0x8b13('0x15')](function(_0x19b21c){_0x40fc29(_0x19b21c);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x20')]=function(_0x24179a){return util[_0x8b13('0x2a')](_0x8b13('0x2b'),FILES_PATH,_0x24179a);};AGIVertices['prototype'][_0x8b13('0x2c')]=function(_0x5089c6,_0x3826a5,_0x37732c){odbc[_0x8b13('0x2d')](_0x5089c6,function(_0x5e63f6){if(_0x5e63f6){logger[_0x8b13('0x2e')](_0x8b13('0x2f'),_0x5e63f6);_0x37732c(_0x5e63f6);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x8b13('0x30')](_0x3826a5,function(_0x5daee9,_0x3ed902){if(_0x5daee9){logger['info'](_0x8b13('0x31'),_0x3826a5);_0x37732c(_0x5daee9);}else{logger[_0x8b13('0x32')](_0x8b13('0x33'),_0x3826a5);odbc[_0x8b13('0x34')](function(_0x3a221d){if(_0x3a221d){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3a221d);}_0x37732c(null,_0x3ed902);});}});}});};AGIVertices[_0x8b13('0x10')]['getSmsAccount']=function(_0x6ba2f3,_0x9f2d81){this['rpc'][_0x8b13('0x35')](_0x6ba2f3)[_0x8b13('0x13')](function(_0x35c1d6){_0x9f2d81(null,_0x35c1d6?_0x35c1d6:![]);})[_0x8b13('0x15')](function(_0x2f4e7f){_0x9f2d81(_0x2f4e7f);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x36')]=function(_0x516c70,_0x5a3f5c){this['rpc'][_0x8b13('0x36')](_0x516c70)[_0x8b13('0x13')](function(_0x27cfe5){_0x5a3f5c(null,_0x27cfe5);})[_0x8b13('0x15')](function(_0x2e6e78){_0x5a3f5c(_0x2e6e78);});};AGIVertices[_0x8b13('0x10')]['createSquareDetailsReport']=function(_0x4342db,_0x50e535,_0x13d0ef){this['rpc'][_0x8b13('0x37')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'node':_0x4342db[_0x8b13('0x3a')],'application':_0x4342db[_0x8b13('0x3b')],'data':_0x50e535||null,'project_name':this[_0x8b13('0x38')][_0x8b13('0x3c')],'callerid':this['channel']['callerid']})['then'](function(_0xbe4d36){if(_0x13d0ef){_0x13d0ef(null,_0xbe4d36);}})[_0x8b13('0x15')](function(_0x288faa){if(_0x13d0ef){_0x13d0ef(_0x288faa);}});};AGIVertices[_0x8b13('0x10')]['createSquareRecording']=function(_0x5e9d93,_0x3f420d,_0x54d19d,_0x24262a){this[_0x8b13('0x16')][_0x8b13('0x3d')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'callerid':this['channel'][_0x8b13('0x3e')],'calleridname':this[_0x8b13('0x38')][_0x8b13('0x3f')],'context':this[_0x8b13('0x38')][_0x8b13('0x40')],'extension':this[_0x8b13('0x38')][_0x8b13('0x41')],'priority':this[_0x8b13('0x38')][_0x8b13('0x42')],'accountcode':this['channel'][_0x8b13('0x43')],'dnid':this['channel'][_0x8b13('0x44')],'projectName':this[_0x8b13('0x38')][_0x8b13('0x3c')],'saveName':_0x3f420d,'filename':_0x5e9d93['file']||_0x3f420d,'savePath':_0x54d19d})[_0x8b13('0x13')](function(_0x35f612){_0x24262a(null,_0x35f612);})[_0x8b13('0x15')](function(_0x4129c0){_0x24262a(_0x4129c0);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x45')]=function(_0x453cd4,_0x534636,_0x2c8594,_0x4c833d,_0x19b70b){this[_0x8b13('0x16')][_0x8b13('0x45')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'body':_0x453cd4,'direction':_0x534636,'providerName':_0x2c8594,'providerResponse':_0x4c833d})[_0x8b13('0x13')](function(_0x411ad2){if(_0x19b70b){_0x19b70b(null,_0x411ad2);}})[_0x8b13('0x15')](function(_0x3de913){if(_0x19b70b){_0x19b70b(_0x3de913);}});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x46')]=function(_0xddac8e,_0xd55f3b){this[_0x8b13('0x16')][_0x8b13('0x46')]({'firstName':_[_0x8b13('0x47')](_0xddac8e[_0x8b13('0x14')])||_['isNil'](_0xddac8e[_0x8b13('0x14')])?_0x8b13('0x48')+Math['random']():_0xddac8e[_0x8b13('0x14')],'lastName':_[_0x8b13('0x47')](_0xddac8e[_0x8b13('0x49')])||_[_0x8b13('0x4a')](_0xddac8e[_0x8b13('0x49')])?null:_0xddac8e[_0x8b13('0x49')],'phone':_0xddac8e[_0x8b13('0x4b')],'ListId':_0xddac8e[_0x8b13('0x4c')],'scheduledat':_0xddac8e[_0x8b13('0x4d')],'callbackUniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'tags':_0x8b13('0x4e'),'description':_0x8b13('0x4f')+_0xddac8e[_0x8b13('0x4d')][_0x8b13('0x50')](),'priority':_0xddac8e['callback_priority']})[_0x8b13('0x13')](function(_0x2f065f){_0xd55f3b(null,_0x2f065f);})['catch'](function(_0x11e8af){_0xd55f3b(_0x11e8af);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x51')]=function(_0x46c595,_0x1263f4){this['rpc'][_0x8b13('0x52')](_0x46c595)[_0x8b13('0x13')](function(_0x46850a){_0x1263f4(null,_0x46850a?_0x46850a['name']:![]);})[_0x8b13('0x15')](function(_0x17ab12){_0x1263f4(_0x17ab12);});};AGIVertices['prototype'][_0x8b13('0x53')]=function(_0x348c11,_0x475c8d,_0xd29067){var _0x49e5cd={'role':_0x8b13('0x54')};_0x49e5cd[_0x348c11]=this[_0x8b13('0x38')]['callerid'];this[_0x8b13('0x16')][_0x8b13('0x53')](_0x49e5cd,_0x475c8d,this[_0x8b13('0x38')][_0x8b13('0x39')])['then'](function(_0x2bdc5c){_0xd29067(null,_[_0x8b13('0x4a')](_0x2bdc5c)?![]:!![]);})[_0x8b13('0x15')](function(_0xd54429){logger[_0x8b13('0x2e')](_0xd54429);_0xd29067(null,![]);});};AGIVertices[_0x8b13('0x10')]['agentUnpause']=function(_0x123f52,_0x1082d9){var _0x445283={'role':'agent'};_0x445283[_0x123f52]=this[_0x8b13('0x38')][_0x8b13('0x3e')];this[_0x8b13('0x16')][_0x8b13('0x55')](_0x445283)['then'](function(_0x59a6b3){_0x1082d9(null,_['isNil'](_0x59a6b3)?![]:!![]);})['catch'](function(_0x4fedbf){logger[_0x8b13('0x2e')](_0x4fedbf);_0x1082d9(null,![]);});};AGIVertices[_0x8b13('0x10')]['agentLogout']=function(_0x2934c8,_0x5c3928){var _0x274bad={'role':_0x8b13('0x54')};_0x274bad[_0x2934c8]=this[_0x8b13('0x38')][_0x8b13('0x3e')];this[_0x8b13('0x16')][_0x8b13('0x56')](_0x274bad)[_0x8b13('0x13')](function(_0x4c433c){_0x5c3928(null,_[_0x8b13('0x4a')](_0x4c433c)?![]:!![]);})['catch'](function(_0xa31d7d){logger[_0x8b13('0x2e')](_0xa31d7d);_0x5c3928(null,![]);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x57')]=function(_0x3fff75,_0x41a033){var _0x10f1bf={'role':'agent'};_0x10f1bf[_0x3fff75]=this[_0x8b13('0x38')]['callerid'];var _0x2b109c=_0x3fff75!=_0x8b13('0x58')?util[_0x8b13('0x2a')](_0x8b13('0x59'),_0x8b13('0x5a'),this['channel']['callerid']):undefined;this[_0x8b13('0x16')][_0x8b13('0x57')](_0x10f1bf,_0x2b109c)['then'](function(_0x180866){_0x41a033(null,_[_0x8b13('0x4a')](_0x180866)?![]:!![]);})[_0x8b13('0x15')](function(_0x51545e){logger[_0x8b13('0x2e')](_0x51545e);_0x41a033(null,![]);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x5b')]=function(_0x228e63,_0x52850c){sh[_0x8b13('0x5c')](_[_0x8b13('0x5d')](_0x228e63),function(_0x4f062d,_0x215f9b){var _0x3bfd74=_0x215f9b[_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'');_0x52850c(null,_0x3bfd74);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x5f')]=function(_0x1243f8,_0x4334c1){scripts[_0x8b13('0x5f')](_0x1243f8[_0x8b13('0x60')],_0x1243f8[_0x8b13('0x61')]||_0x8b13('0x62'),_0x1243f8[_0x8b13('0x62')],_0x1243f8[_0x8b13('0x63')]||_0x8b13('0x64'),_0x1243f8['ssmlGender']||_0x8b13('0x65'),_0x1243f8['audioEncoding']||_0x8b13('0x66'))[_0x8b13('0x13')](function(_0x31fc95){_0x4334c1(null,_0x31fc95);})[_0x8b13('0x15')](function(_0x564b4d){_0x4334c1(_0x564b4d);});};AGIVertices['prototype'][_0x8b13('0x67')]=function(_0x2236b5,_0x4d8c62){scripts[_0x8b13('0x67')](_0x2236b5[_0x8b13('0x62')],_0x2236b5[_0x8b13('0x68')]||'en',0x1)[_0x8b13('0x13')](function(_0x7499cb){_0x4d8c62(null,_0x7499cb);})[_0x8b13('0x15')](function(_0x15b553){_0x4d8c62(_0x15b553);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x69')]=function(_0x24211c,_0x48fd36){var _0x2a1fd3={'uri':_0x24211c[_0x8b13('0x6a')],'method':_0x24211c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24211c[_0x8b13('0x6b')])===_0x8b13('0x6c')&&parseInt(_0x24211c['timeout'])>=0x1?parseInt(_0x24211c[_0x8b13('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x8b13('0x6d')]([_0x8b13('0x6e'),_0x8b13('0x6f')],_0x2a1fd3[_0x8b13('0x70')][_0x8b13('0x71')]())){try{_0x2a1fd3[_0x8b13('0x72')]=_0x24211c[_0x8b13('0x73')]?JSON['parse'](_0x24211c[_0x8b13('0x73')]):{};}catch(_0x213b43){logger[_0x8b13('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x213b43);}}try{_0x2a1fd3[_0x8b13('0x74')]=_0x24211c['rawHeaders']?JSON[_0x8b13('0x75')](_0x24211c[_0x8b13('0xb')]):{};}catch(_0x38a1ce){logger[_0x8b13('0x2e')](_0x8b13('0x76'),_0x38a1ce);}if(_0x24211c[_0x8b13('0x77')]){try{var _0x41cefe=require(_0x24211c[_0x8b13('0x77')])[_0x8b13('0x78')](this,_0x2a1fd3);_0x2a1fd3[_0x8b13('0x79')]=Mustache['render'](_0x24211c[_0x8b13('0x6a')],_0x41cefe,{},['$$','$$']);if(_0x2a1fd3[_0x8b13('0x74')]){_0x2a1fd3[_0x8b13('0x74')]=JSON[_0x8b13('0x75')](Mustache[_0x8b13('0x7a')](JSON[_0x8b13('0x7b')](_0x2a1fd3[_0x8b13('0x74')]),_0x41cefe,{},['$$','$$']));}if(_0x2a1fd3[_0x8b13('0x72')]){_0x2a1fd3[_0x8b13('0x72')]=JSON[_0x8b13('0x75')](Mustache[_0x8b13('0x7a')](JSON[_0x8b13('0x7b')](_0x2a1fd3[_0x8b13('0x72')]),_0x41cefe,{},['$$','$$']));}}catch(_0x4bb71a){logger['error'](_0x8b13('0x7c'),_0x4bb71a);}}rp(_0x2a1fd3)['then'](function(_0x22e10a){var _0x38a1de={'statusCode':_0x22e10a['statusCode']||0xc8,'statusMessage':_0x22e10a['statusMessage']||'OK','headers':_0x22e10a[_0x8b13('0x74')]||{},'body':_0x22e10a[_0x8b13('0x72')]||{}};_0x48fd36(null,_0x38a1de);})[_0x8b13('0x15')](function(_0x1d037a){var _0xed5531={'statusCode':_0x1d037a['statusCode']||0x1f4,'statusMessage':_0x1d037a[_0x8b13('0x7d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1d037a[_0x8b13('0x7e')][_0x8b13('0x74')]||{},'body':_0x1d037a['options'][_0x8b13('0x72')]||{}};_0x48fd36(null,_0xed5531);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x7f')]=function(_0x34cee5,_0x2f1ddf){scripts['googleDialogflow'](this[_0x8b13('0x38')][_0x8b13('0x39')],_0x34cee5[_0x8b13('0x80')],_0x34cee5['text'],_0x34cee5[_0x8b13('0x81')]||'en')['then'](function(_0x3bfb06){_0x2f1ddf(null,_0x3bfb06);})[_0x8b13('0x15')](function(_0x3f9df4){_0x2f1ddf(_0x3f9df4);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x82')]=function(_0xe70f1b,_0x441173){scripts[_0x8b13('0x82')](this[_0x8b13('0x38')][_0x8b13('0x39')],_0xe70f1b['dialogflowV2_project_id'],_0xe70f1b[_0x8b13('0x83')],_0xe70f1b[_0x8b13('0x84')],_0xe70f1b[_0x8b13('0x62')],_0xe70f1b[_0x8b13('0x85')]||'en')[_0x8b13('0x13')](function(_0x52e7d6){_0x441173(null,_0x52e7d6);})[_0x8b13('0x15')](function(_0x45dc31){_0x441173(_0x45dc31);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x86')]=function(_0x4f601d,_0x3ea823){scripts['sestekNDA'](this[_0x8b13('0x38')],_0x4f601d)[_0x8b13('0x13')](function(_0x556a92){_0x3ea823(null,_0x556a92);})[_0x8b13('0x15')](function(_0x48269c){_0x3ea823(_0x48269c);});};AGIVertices[_0x8b13('0x10')]['ispeechTTS']=function(_0x135053,_0x291a30){scripts[_0x8b13('0x87')](_0x135053[_0x8b13('0x80')],_0x135053[_0x8b13('0x62')],_0x135053[_0x8b13('0x88')]||_0x8b13('0x64'),_0x135053[_0x8b13('0x89')])['then'](function(_0x800c3c){_0x291a30(null,_0x800c3c);})[_0x8b13('0x15')](function(_0x5f190a){_0x291a30(_0x5f190a);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8a')]=function(_0x4d33f3,_0xa97f27,_0x304862){scripts[_0x8b13('0x8a')](_0xa97f27,_0x4d33f3[_0x8b13('0x80')],_0x4d33f3[_0x8b13('0x8b')]||'en-US',this['isConfigured'](_0x4d33f3[_0x8b13('0x8c')])?_0x4d33f3[_0x8b13('0x8c')]:undefined)[_0x8b13('0x13')](function(_0x36f3af){_0x304862(null,_0x36f3af);})[_0x8b13('0x15')](function(_0x3ffd8c){_0x304862(_0x3ffd8c);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8d')]=function(_0x45d6d5,_0xfac180){scripts[_0x8b13('0x8d')](_0x45d6d5[_0x8b13('0x8e')],_0x45d6d5[_0x8b13('0x8f')],_0x45d6d5[_0x8b13('0x90')],_0x45d6d5[_0x8b13('0x91')]||_0x8b13('0x92'),_0x45d6d5['text'],_0x45d6d5[_0x8b13('0x93')]||'text')[_0x8b13('0x13')](function(_0x111085){_0xfac180(null,_0x111085);})[_0x8b13('0x15')](function(_0x394932){_0xfac180(_0x394932);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x94')]=function(_0x7e200e,_0x4c1146){scripts[_0x8b13('0x94')](this['channel'][_0x8b13('0x39')],_0x7e200e[_0x8b13('0x8e')],_0x7e200e['aws_secret_access_key'],_0x7e200e['aws_lex_region'],_0x7e200e[_0x8b13('0x62')],_0x7e200e[_0x8b13('0x95')])[_0x8b13('0x13')](function(_0x220abd){_0x4c1146(null,_0x220abd);})[_0x8b13('0x15')](function(_0x3b131d){_0x4c1146(_0x3b131d);});};AGIVertices['prototype'][_0x8b13('0x96')]=function(_0x429c1d,_0x4ed244,_0x528f3b){scripts['googleASR'](_0x4ed244,_0x429c1d[_0x8b13('0x80')],_0x429c1d[_0x8b13('0x97')]||_0x8b13('0x64'))[_0x8b13('0x13')](function(_0x44b19b){_0x528f3b(null,_0x44b19b);})[_0x8b13('0x15')](function(_0x270b56){_0x528f3b(_0x270b56);});};AGIVertices[_0x8b13('0x10')]['tildeASR']=function(_0x38b8fc,_0x598662,_0x3a7bc9){scripts['tildeASR'](_0x598662,_0x38b8fc[_0x8b13('0x98')],_0x38b8fc[_0x8b13('0x99')],_0x38b8fc['uri'])[_0x8b13('0x13')](function(_0x2fa301){_0x3a7bc9(null,_0x2fa301);})[_0x8b13('0x15')](function(_0x20b397){_0x3a7bc9(_0x20b397);});};AGIVertices[_0x8b13('0x10')]['clear']=function(_0x931432){var _0x7827e6=_[_0x8b13('0x6d')](verticesWithRetry,_0x931432[_0x8b13('0x3b')])?_0x931432:_['clone'](_0x931432);for(var _0x197d38 in _0x7827e6){if(_0x7827e6['hasOwnProperty'](_0x197d38)){if(_0x7827e6[_0x197d38]&&_[_0x8b13('0x9a')](_0x7827e6[_0x197d38])){if(_[_0x8b13('0x6d')](recursiveMapAttributes,_0x197d38)){_0x7827e6[_0x197d38]=this[_0x8b13('0x9b')](_0x7827e6[_0x197d38]);}else{_0x7827e6[_0x197d38]=this['replaceAllVariables'](_0x7827e6[_0x197d38]);}}}}return _0x7827e6;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x5a9f3e){for(var _0x265f60 in _0x5a9f3e){if(_0x5a9f3e['hasOwnProperty'](_0x265f60)){if(_[_0x8b13('0x9c')](_0x5a9f3e[_0x265f60])){this['recursiveNodeIndex'](_0x5a9f3e[_0x265f60]);}else if(_[_0x8b13('0x9d')](_0x5a9f3e[_0x265f60])){for(var _0x4196d8=0x0;_0x4196d8<_0x5a9f3e[_0x265f60][_0x8b13('0x9e')];_0x4196d8++){this[_0x8b13('0x9f')](_0x5a9f3e[_0x265f60][_0x4196d8]);}}else if(_[_0x8b13('0x9a')](_0x5a9f3e[_0x265f60])){_0x5a9f3e[_0x265f60]=this[_0x8b13('0xa0')](_0x5a9f3e[_0x265f60]);}}}};AGIVertices[_0x8b13('0x10')][_0x8b13('0xa1')]=function(_0x2a5ed3,_0x414daf){for(var _0x2fcc82 in _0x2a5ed3){if(_0x2a5ed3[_0x8b13('0xa2')](_0x2fcc82)){if(_[_0x8b13('0x9c')](_0x2a5ed3[_0x2fcc82])){if(!_['isEmpty'](_0x2a5ed3[_0x2fcc82])){this[_0x8b13('0xa1')](_0x2a5ed3[_0x2fcc82],util['format']('%s.%s',_0x414daf,_0x2fcc82));}}else if(_['isArray'](_0x2a5ed3[_0x2fcc82])){for(var _0x1ae046=0x0;_0x1ae046<_0x2a5ed3[_0x2fcc82][_0x8b13('0x9e')];_0x1ae046++){this[_0x8b13('0xa1')](_0x2a5ed3[_0x2fcc82][_0x1ae046],util[_0x8b13('0x2a')]('%s.%s',_0x414daf,_0x2fcc82+'['+_0x1ae046+']'));}}else{if(!_[_0x8b13('0x4a')](_0x2a5ed3[_0x2fcc82])){this['channel'][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s.%s',_0x414daf,_0x2fcc82),_0x2a5ed3[_0x2fcc82]);}}}}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x9b')]=function(_0x25d770){try{var _0x4a52d9=JSON[_0x8b13('0x75')](_0x25d770);this[_0x8b13('0x9f')](_0x4a52d9);return JSON[_0x8b13('0x7b')](_0x4a52d9);}catch(_0xf629c6){return this[_0x8b13('0xa0')](_0x25d770);}};AGIVertices[_0x8b13('0x10')][_0x8b13('0xa0')]=function(_0x4132c9){var _0x1e0f26=_0x4132c9[_0x8b13('0xa4')]('{');for(var _0x2329e2=0x1;_0x2329e2<_0x1e0f26[_0x8b13('0x9e')];_0x2329e2+=0x1){var _0x1fd2cd=_0x1e0f26[_0x2329e2][_0x8b13('0xa4')]('}');if(_0x1fd2cd[_0x8b13('0x9e')]>0x1){_0x4132c9=_0x4132c9[_0x8b13('0xa5')]('{'+_0x1fd2cd[0x0]+'}',this['channel'][_0x8b13('0x11')](_0x1fd2cd[0x0])[_0x8b13('0xa6')]||_0x1fd2cd[0x0]);}}if(_0x1e0f26[_0x8b13('0x9e')]===0x1){return _0x4132c9['toString']();}return this[_0x8b13('0xa0')](_0x4132c9);};AGIVertices['prototype'][_0x8b13('0xa7')]=function(_0x1e104d,_0x75d844){var _0x595a21=this[_0x8b13('0x38')][_0x8b13('0x11')](_0x1e104d);if(_0x595a21[_0x8b13('0xa8')]===-0x1){return _0x595a21;}logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xa9'),_0x75d844,_0x595a21['extra']));return this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x75d844,_0x595a21[_0x8b13('0xa6')]);};AGIVertices[_0x8b13('0x10')]['isConfigured']=function(_0xfb71ff){return _0xfb71ff&&_0xfb71ff!=='0'&&_0xfb71ff!=='-1'&&_0xfb71ff!=='';};AGIVertices[_0x8b13('0x10')][_0x8b13('0xaa')]=function(_0x588987){this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x588987,'-');_0x588987['retry']=_0x588987[_0x8b13('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x8b13('0xab')]=function(_0x178d6b){logger['info'](util['format'](_0x8b13('0xac'),_0x178d6b[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x178d6b[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}var _0x490a0='\x22'+_0x178d6b[_0x8b13('0x62')]+'\x22';if(this[_0x8b13('0xad')](_0x178d6b[_0x8b13('0x7e')])){_0x490a0+=','+_0x178d6b['options'];}var _0x305103=this[_0x8b13('0x38')]['exec'](_0x8b13('0xb0'),_0x490a0);if(_0x305103['result']===-0x1){return _0x305103;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x490a0));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xb1')]=function(_0xbd12b2){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xbd12b2[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0xbd12b2[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xb3'));}var _0x57a094=_0xbd12b2[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0xbd12b2[_0x8b13('0x7e')])){_0x57a094+=','+_0xbd12b2[_0x8b13('0x7e')];}var _0x4e3bac=this[_0x8b13('0x38')]['exec']('MRCPRecog',_0x57a094);if(_0x4e3bac[_0x8b13('0xa8')]===-0x1){return _0x4e3bac;}var _0xd45634=this['getAndSetVariable'](_0x8b13('0xb4'),'MRCP_RECOG_CONFIDENCE');if(_0xd45634[_0x8b13('0xa8')]===-0x1){return _0xd45634;}var _0x5ac718=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xb6'));if(_0x5ac718[_0x8b13('0xa8')]===-0x1){return _0x5ac718;}var _0x284211=this[_0x8b13('0xa7')](_0x8b13('0xb7'),_0x8b13('0xb8'));if(_0x284211[_0x8b13('0xa8')]===-0x1){return _0x284211;}return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x57a094));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8')]=function(_0x95cfa6){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xb9'),_0x95cfa6[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['agi']([_0x95cfa6[_0x8b13('0xba')],_0x95cfa6[_0x8b13('0xbb')]]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0xbc')]=function(_0x2a44a7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xbd'),_0x2a44a7[_0x8b13('0x3a')]));if(this[_0x8b13('0xad')](_0x2a44a7[_0x8b13('0x6b')])){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xbe'),_0x2a44a7['timeout']));var _0x191ddf=this['channel'][_0x8b13('0xbf')](_0x2a44a7[_0x8b13('0x6b')]);if(_0x191ddf[_0x8b13('0xa8')]===-0x1){return _0x191ddf;}}return this[_0x8b13('0x38')][_0x8b13('0xbc')]();};AGIVertices[_0x8b13('0x10')][_0x8b13('0x4e')]=function(_0x17af45){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc0'),_0x17af45[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x17af45[_0x8b13('0x4c')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x17af45,_0x8b13('0xc1'));}_0x17af45[_0x8b13('0x4d')]=moment();if(this[_0x8b13('0xad')](_0x17af45[_0x8b13('0xc2')])){_0x17af45['scheduledAt']=moment()[_0x8b13('0xc3')](_0x17af45['delay'],_0x8b13('0xc4'));}if(!this['isConfigured'](_0x17af45[_0x8b13('0xc5')])){_0x17af45['callback_priority']=0x2;}this[_0x8b13('0x46')]['sync'](this,_0x17af45);return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x17af45[_0x8b13('0x4b')],_0x17af45[_0x8b13('0x4c')],_0x17af45[_0x8b13('0x4d')]));};AGIVertices[_0x8b13('0x10')]['custom_app']=function(_0x3b795d){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc6'),_0x3b795d[_0x8b13('0x3a')]));var _0x5f1130=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x3b795d[_0x8b13('0xc7')],_0x3b795d[_0x8b13('0x7e')]);if(_0x5f1130[_0x8b13('0xa8')]===-0x1){return _0x5f1130;}return this['channel']['noop'](util[_0x8b13('0x2a')]('Executed\x20command\x20%s\x20%s',_0x3b795d[_0x8b13('0xc7')],_0x3b795d[_0x8b13('0x7e')]));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xc8')]=function(_0x2154a1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc9'),_0x2154a1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x2154a1[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop']('no\x20text\x20configured');}var _0x537246='\x22'+_0x2154a1['text']+'\x22';if(this['isConfigured'](_0x2154a1[_0x8b13('0x7e')])){_0x537246+=','+_0x2154a1[_0x8b13('0x7e')];}var _0x1369d6=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xb0'),_0x537246);if(_0x1369d6[_0x8b13('0xa8')]===-0x1){return _0x1369d6;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x537246));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xca')]=function(_0x41cd1a){logger['info'](util['format'](_0x8b13('0xcb'),_0x41cd1a[_0x8b13('0x3a')]));if(!this['isConfigured'](_0x41cd1a[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}var _0x112d5c='\x22'+_0x41cd1a[_0x8b13('0x62')]+'\x22';if(this[_0x8b13('0xad')](_0x41cd1a[_0x8b13('0x7e')])){_0x112d5c+=','+_0x41cd1a['options'];}var _0x57d632=this[_0x8b13('0x38')]['exec'](_0x8b13('0xb0'),_0x112d5c);if(_0x57d632[_0x8b13('0xa8')]===-0x1){return _0x57d632;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xcc'),_0x112d5c));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xcd')]=function(_0x4c8718){logger[_0x8b13('0x32')](util['format'](_0x8b13('0xce'),_0x4c8718['label']));if(!this[_0x8b13('0xad')](_0x4c8718[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xb3'));}var _0x3858b3=_0x4c8718[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0x4c8718[_0x8b13('0x7e')])){_0x3858b3+=','+_0x4c8718[_0x8b13('0x7e')];}var _0x5e5f63=this['channel'][_0x8b13('0x5c')](_0x8b13('0xcf'),_0x3858b3);if(_0x5e5f63['result']===-0x1){return _0x5e5f63;}var _0x3dbd02=this[_0x8b13('0xa7')](_0x8b13('0xb4'),_0x8b13('0xd0'));if(_0x3dbd02[_0x8b13('0xa8')]===-0x1){return _0x3dbd02;}var _0x16bc2f=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xd1'));if(_0x16bc2f[_0x8b13('0xa8')]===-0x1){return _0x16bc2f;}var _0x56a419=this[_0x8b13('0xa7')]('RECOG_INSTANCE()',_0x8b13('0xd2'));if(_0x56a419['result']===-0x1){return _0x56a419;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3858b3));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd3')]=function(_0x6de05){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xd4'),_0x6de05[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x6de05[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20grammar\x20configured');}var _0x410c8a=_0x6de05[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0x6de05[_0x8b13('0x7e')])){_0x410c8a+=','+_0x6de05['options'];}var _0x50ba6e=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xcf'),_0x410c8a);if(_0x50ba6e[_0x8b13('0xa8')]===-0x1){return _0x50ba6e;}var _0x1e8478=this['getAndSetVariable'](_0x8b13('0xb4'),_0x8b13('0xd5'));if(_0x1e8478[_0x8b13('0xa8')]===-0x1){return _0x1e8478;}var _0x2a65f4=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xd6'));if(_0x2a65f4[_0x8b13('0xa8')]===-0x1){return _0x2a65f4;}var _0x1dc063=this[_0x8b13('0xa7')]('RECOG_INSTANCE()',_0x8b13('0xd7'));if(_0x1dc063[_0x8b13('0xa8')]===-0x1){return _0x1dc063;}return this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0xd8'),_0x410c8a));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd9')]=function(_0x13d00d){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xda'),_0x13d00d['label']));if(!this[_0x8b13('0xad')](_0x13d00d['odbc_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x13d00d,_0x8b13('0xdb'));}var _0x258df1=this[_0x8b13('0x18')][_0x8b13('0x78')](this,_0x13d00d[_0x8b13('0xdc')]);if(!_0x258df1){return this['channel'][_0x8b13('0x2e')](_0x13d00d,_0x8b13('0xdd'));}if(!this[_0x8b13('0xad')](_0x13d00d[_0x8b13('0x30')])){return this['channel']['error'](_0x13d00d,'no\x20query\x20configured');}var _0x1e02cf=_0x13d00d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xde'),_0x1e02cf));var _0xaf6322=this[_0x8b13('0x2c')][_0x8b13('0x78')](this,_0x258df1,_0x1e02cf);this['createSquareDetailsReport']['sync'](this,_0x13d00d,_0x1e02cf);if(!this[_0x8b13('0xad')](_0x13d00d['variable_id'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xdf'));}var _0x5a9644=this[_0x8b13('0x11')]['sync'](this,_0x13d00d[_0x8b13('0xe0')]);if(!_0x5a9644){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x13d00d,'no\x20variable\x20found');}var _0x2ed842=this;_0xaf6322[_0x8b13('0xe1')](function(_0x34cc89,_0x3cc463){Object[_0x8b13('0xe2')](_0x34cc89)[_0x8b13('0xe1')](function(_0x28c061){_0x2ed842['channel']['setVariable'](util['format'](_0x8b13('0xe3'),_0x5a9644,_0x3cc463,_0x28c061),_0x34cc89[_0x28c061]);});});this[_0x8b13('0x38')]['setVariable'](util[_0x8b13('0x2a')]('%s_ROWS_COUNT',_0x5a9644),_0xaf6322[_0x8b13('0x9e')]);return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xe4'),_0x5a9644));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xe5')]=function(_0x450ed2){logger['debug'](util['format'](_0x8b13('0xe6'),_0x450ed2[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x450ed2[_0x8b13('0xe7')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x450ed2,_0x8b13('0xe8'));}var _0x29e355=this['getUser'][_0x8b13('0x78')](this,_0x450ed2['sip_id']);if(!_0x29e355){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x450ed2,_0x8b13('0xe9'));}var _0x3537aa=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xea'),[util[_0x8b13('0x2a')](_0x8b13('0xeb'),_0x29e355),_0x450ed2[_0x8b13('0x6b')],_0x450ed2[_0x8b13('0xec')],_0x450ed2[_0x8b13('0x6a')]]);if(_0x3537aa[_0x8b13('0xa8')]===-0x1){return _0x3537aa;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xed'),_0x8b13('0xea')));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xee')]=function(_0xb72e0){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xef'),_0xb72e0[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0xb72e0[_0x8b13('0x80')])){return this[_0x8b13('0x38')]['noop']('no\x20key\x20configured');}if(!this[_0x8b13('0xad')](_0xb72e0[_0x8b13('0x62')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this['createSquareDetailsReport'](_0xb72e0);this['createSquareMessage'](_0xb72e0[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xf1'),_0xb72e0[_0x8b13('0x62')]));var _0x5b4874=this[_0x8b13('0x7f')][_0x8b13('0x78')](this,_0xb72e0);if(_0x5b4874){for(var _0x562845 in _0x5b4874){if(_0x5b4874['hasOwnProperty'](_0x562845)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('DIALOGFLOW_%s',_0x562845[_0x8b13('0x71')]()),_0x5b4874[_0x562845]);}}this['createSquareMessage'](_0x5b4874['speech'],_0x8b13('0xf2'),_0x8b13('0xee'),'');return this['channel']['noop'](util[_0x8b13('0x2a')]('Dialogflow\x20Result\x20%s',_0x5b4874[_0x8b13('0xf3')]));}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xb72e0,_0x8b13('0xf4'));};AGIVertices[_0x8b13('0x10')]['dialogflowV2']=function(_0x4902e1){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4902e1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0xf5')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf6'));}if(!this['isConfigured'](_0x4902e1[_0x8b13('0x83')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf7'));}if(!this['isConfigured'](_0x4902e1['private_key'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf8'));}if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0x85')])){return this['channel'][_0x8b13('0xae')]('no\x20anguage\x20configured');}if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this['createSquareDetailsReport'](_0x4902e1);this[_0x8b13('0x45')](_0x4902e1[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xf9'),_0x4902e1['text']));var _0x4262ee=this[_0x8b13('0x82')]['sync'](this,_0x4902e1);if(_0x4262ee){for(var _0x504950 in _0x4262ee){if(_0x4262ee['hasOwnProperty'](_0x504950)){if(_0x504950!==_0x8b13('0xfa')){this['channel'][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0xfb'),_0x504950['toUpperCase']()),_0x4262ee[_0x504950]);}}}this['createSquareMessage'](_0x4262ee['speech'],_0x8b13('0xf2'),_0x8b13('0xfc'),_0x4262ee[_0x8b13('0xfa')]);return this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0xfd'),_0x4262ee['speech']));}return this['channel'][_0x8b13('0x2e')](_0x4902e1,_0x8b13('0xfe'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xff')]=function(_0x5b033b){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x100'),_0x5b033b['label']));if(!this['isConfigured'](_0x5b033b[_0x8b13('0x101')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x102'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x103')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x104'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x105')])){return this['channel']['noop'](_0x8b13('0x106'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x107')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')]['bot']=!![];this[_0x8b13('0x37')](_0x5b033b);this['createSquareMessage'](_0x5b033b[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x108'),_0x5b033b[_0x8b13('0x62')]));var _0x151268=this['sestekNDA'][_0x8b13('0x78')](this,_0x5b033b);if(_0x151268){for(var _0x5ae351 in _0x151268){if(_0x151268['hasOwnProperty'](_0x5ae351)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x109'),_0x5ae351['toUpperCase']()),_0x151268[_0x5ae351]);}}this[_0x8b13('0x45')](_0x151268[_0x8b13('0xf3')],_0x8b13('0xf2'),'sesteknda','');if(_0x151268[_0x8b13('0x10a')]){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x10b'),_0x151268[_0x8b13('0x10a')]));var _0x3e832f=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x151268['audiofile']);try{fs[_0x8b13('0x10d')](_0x151268[_0x8b13('0x10a')]+_0x8b13('0x10e'));}catch(_0x104e89){logger['error'](_0x104e89);}return _0x3e832f;}else{return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x10f'),_0x151268[_0x8b13('0xf3')]));}}return this[_0x8b13('0x38')]['error'](_0x5b033b,_0x8b13('0x110'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x111')]=function(_0x49a92f){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x49a92f[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['noop'](_0x8b13('0x111'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x112')]=function(_0x935fa2){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x113'),_0x935fa2['label']));var _0x54f121='';if(_0x935fa2[_0x8b13('0x114')]){if(!this[_0x8b13('0xad')](_0x935fa2[_0x8b13('0x114')])){return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x115'));}else{var _0x123cba=parseInt(_0x935fa2['trunk_id'],0xa);if(isNaN(_0x123cba)){_0x54f121=_0x935fa2[_0x8b13('0x114')];}else{_0x54f121=this[_0x8b13('0x1c')]['sync'](this,_0x935fa2[_0x8b13('0x114')]);if(!_0x54f121){return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x116'));}}}}else if(_0x935fa2[_0x8b13('0x117')]){_0x54f121=_0x935fa2[_0x8b13('0x117')];}else{return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x115'));}var _0x582b64=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xea'),[util[_0x8b13('0x2a')](_0x8b13('0x118'),_0x54f121,_0x935fa2[_0x8b13('0x4b')]),_0x935fa2[_0x8b13('0x6b')],_0x935fa2[_0x8b13('0xec')],_0x935fa2[_0x8b13('0x6a')]]);if(_0x582b64[_0x8b13('0xa8')]===-0x1){return _0x582b64;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20%s',_0x8b13('0xea')));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x119')]=function(_0xf36af8){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x11a'),_0xf36af8['label']));return this['channel'][_0x8b13('0xae')](_0x8b13('0x119'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd')]=function(_0x4236d5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x11b'),_0x4236d5['label']));if(_0x4236d5['retry']===0x0){return this['maxRetry'](_0x4236d5);}_0x4236d5[_0x8b13('0x11c')]-=0x1;if(!this[_0x8b13('0xad')](_0x4236d5[_0x8b13('0x11d')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4236d5,'no\x20file\x20audio\x20selected');}var _0x1981be=this[_0x8b13('0x1e')][_0x8b13('0x78')](this,_0x4236d5['file_id']);if(!_0x1981be){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4236d5,_0x8b13('0x11e'));}if(!this[_0x8b13('0xad')](_0x4236d5[_0x8b13('0xe0')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3c10b1=this[_0x8b13('0x38')][_0x8b13('0x11f')](_0x1981be,_0x4236d5[_0x8b13('0x120')],_0x4236d5[_0x8b13('0x121')]);var _0x3b08bb=_0x3c10b1['result']?_0x3c10b1[_0x8b13('0xa8')][_0x8b13('0x50')]():'';logger['info']('test',JSON['stringify'](_0x3c10b1));if(_0x3c10b1[_0x8b13('0xa8')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4236d5,_0x3b08bb);return _0x3c10b1;}else if(_0x3c10b1[_0x8b13('0xa6')]==='timeout'){_0x3c10b1[_0x8b13('0xa8')]=_0x3b08bb[_0x8b13('0x9e')]>=parseInt(_0x4236d5[_0x8b13('0x122')])?'x':'i';}else{_0x3c10b1['result']=_0x3b08bb['length']>=parseInt(_0x4236d5[_0x8b13('0x122')])&&_0x3b08bb[_0x8b13('0x9e')]<=parseInt(_0x4236d5['maxdigit'])?'x':'i';}var _0x18e2b0=this['getVariable'][_0x8b13('0x78')](this,_0x4236d5[_0x8b13('0xe0')]);if(!_0x18e2b0){return this['channel'][_0x8b13('0x2e')](_0x4236d5,'no\x20variable\x20found');}this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x18e2b0,_0x3b08bb);if(this[_0x8b13('0xad')](_0x4236d5['hiddendigitsnum'])){var _0x7f7f53=parseInt(_0x4236d5[_0x8b13('0x123')],0xa);var _0x2b15ca=rs[_0x8b13('0x124')]({'charset':'*','length':_0x7f7f53});var _0xe550ff=_0x3b08bb[_0x8b13('0x9e')];if(_0xe550ff>0x0){if(_0xe550ff>_0x7f7f53){this[_0x8b13('0x37')]['sync'](this,_0x4236d5,_0x4236d5[_0x8b13('0x125')]===_0x8b13('0x126')?_0x2b15ca+_0x3b08bb[_0x8b13('0x127')](_0x7f7f53):_0x3b08bb[_0x8b13('0x127')](0x0,_0xe550ff-_0x7f7f53)+_0x2b15ca);}else{this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4236d5,rs['generate']({'charset':'*','length':_0xe550ff}));}}else{this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x4236d5,'');}}else{this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4236d5,_0x3b08bb);}return _0x3c10b1;};AGIVertices[_0x8b13('0x10')]['getsecretdigits']=function(_0x3f60f9){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3f60f9[_0x8b13('0x3a')]));return this[_0x8b13('0xd')](_0x3f60f9);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x128')]=function(_0x341513){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x129'),_0x341513[_0x8b13('0x3a')]));this[_0x8b13('0x37')]['sync'](this,_0x341513,_0x341513[_0x8b13('0x12a')]);return this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x12b'),_0x341513[_0x8b13('0x12a')]));};AGIVertices['prototype']['awspolly']=function(_0xf3a99b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x12c'),_0xf3a99b['label']));if(!this['isConfigured'](_0xf3a99b[_0x8b13('0x8e')])||!this[_0x8b13('0xad')](_0xf3a99b[_0x8b13('0x8f')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x12d'));}if(!this['isConfigured'](_0xf3a99b[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x12e'),_0xf3a99b['text']));var _0x43f7ff=this[_0x8b13('0x8d')][_0x8b13('0x78')](this,_0xf3a99b);if(_0x43f7ff){this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x43f7ff));var _0x19f701=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x43f7ff);try{fs['unlink'](_0x43f7ff+'.wav');}catch(_0x389c47){logger['error'](_0x389c47);}return _0x19f701;}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xf3a99b,_0x8b13('0x12f'));};AGIVertices['prototype'][_0x8b13('0x130')]=function(_0x58ce30){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x131'),_0x58ce30[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x58ce30[_0x8b13('0x8e')])||!this[_0x8b13('0xad')](_0x58ce30['aws_secret_access_key'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x12d'));}if(!this[_0x8b13('0xad')](_0x58ce30['aws_bot_name'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x132'));}if(!this[_0x8b13('0xad')](_0x58ce30[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20text\x20configured');}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this[_0x8b13('0x37')](_0x58ce30);this[_0x8b13('0x45')](_0x58ce30[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x58ce30[_0x8b13('0x62')]));var _0x5886ee=this[_0x8b13('0x94')][_0x8b13('0x78')](this,_0x58ce30);if(_0x5886ee){for(var _0x1f0508 in _0x5886ee){if(_0x5886ee[_0x8b13('0xa2')](_0x1f0508)&&_[_0x8b13('0x9a')](_0x5886ee[_0x1f0508])){this[_0x8b13('0x38')]['setVariable'](util[_0x8b13('0x2a')](_0x8b13('0x133'),_0x1f0508['toUpperCase']()),_0x5886ee[_0x1f0508]);}}if(_['isNil'](_0x5886ee['message'])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x134'));}else{this[_0x8b13('0x45')](_0x5886ee[_0x8b13('0x7d')],_0x8b13('0xf2'),_0x8b13('0x135'),'');return this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x136'),_0x5886ee[_0x8b13('0x7d')]));}}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x58ce30,_0x8b13('0x137'));};AGIVertices[_0x8b13('0x10')]['googleasr']=function(_0xa42b85){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xa42b85['label'],_0xa42b85[_0x8b13('0x6b')]));if(!this['isConfigured'](_0xa42b85[_0x8b13('0x80')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x138'));}var _0x17df3f=_0x8b13('0x139');var _0x68adf4=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x2263f8=util['format']('%s.%s',_0x68adf4,_0x17df3f);var _0x326dd7=!![];if(_0xa42b85[_0x8b13('0x13b')]==='NOBEEP'){_0x326dd7=![];}var _0x1f541e=this[_0x8b13('0x38')][_0x8b13('0x13c')](_0x68adf4,_0x17df3f,_0xa42b85[_0x8b13('0x13d')],_0xa42b85[_0x8b13('0x6b')],undefined,_0x326dd7);if(_0x1f541e[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x13e'),_0x2263f8));var _0x1ae199=this[_0x8b13('0x96')][_0x8b13('0x78')](this,_0xa42b85,_0x2263f8);if(_0x1ae199){for(var _0x142be0 in _0x1ae199){if(_0x1ae199[_0x8b13('0xa2')](_0x142be0)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x13f'),_0x142be0['toUpperCase']()),_0x1ae199[_0x142be0]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x140'),JSON['stringify'](_0x1ae199)));}}return _0x1f541e;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x141')]=function(_0x402c06){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x142'),_0x402c06[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x402c06[_0x8b13('0x98')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x143'));}if(!this[_0x8b13('0xad')](_0x402c06[_0x8b13('0x99')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x144'));}var _0x3349ac='wav';var _0x3c60ac=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs[_0x8b13('0x124')](0x4));var _0x20dd8f=util['format'](_0x8b13('0x145'),_0x3c60ac,_0x3349ac);var _0x19d65c=!![];if(_0x402c06[_0x8b13('0x13b')]===_0x8b13('0x146')){_0x19d65c=![];}var _0x208af8=this[_0x8b13('0x38')]['recordFile'](_0x3c60ac,_0x3349ac,_0x402c06[_0x8b13('0x13d')],_0x402c06[_0x8b13('0x6b')],undefined,_0x19d65c);if(_0x208af8[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x147'),_0x20dd8f));var _0x4ec843=this[_0x8b13('0x148')][_0x8b13('0x78')](this,_0x402c06,_0x20dd8f);if(_0x4ec843){for(var _0x4e9ce9 in _0x4ec843){if(_0x4ec843[_0x8b13('0xa2')](_0x4e9ce9)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x149'),_0x4e9ce9[_0x8b13('0x71')]()),_0x4ec843[_0x4e9ce9]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0x8b13('0x7b')](_0x4ec843)));}}return _0x208af8;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x14a')]=function(_0x29503b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x14b'),_0x29503b[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['continueAt'](_0x29503b['context'],_0x29503b[_0x8b13('0x41')],_0x29503b[_0x8b13('0x42')]);};AGIVertices['prototype'][_0x8b13('0x14c')]=function(_0x5a77b2){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x14d'),_0x5a77b2['label']));if(!this['isConfigured'](_0x5a77b2[_0x8b13('0x14e')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5a77b2,_0x8b13('0x14f'));}try{var _0x14a2c0=eval(_0x5a77b2[_0x8b13('0x14e')])?_0x8b13('0x150'):_0x8b13('0x151');this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x152'),_0x5a77b2[_0x8b13('0x14e')],_0x14a2c0));return{'code':0xc8,'result':_0x14a2c0};}catch(_0x297d3a){return{'code':0xc8,'result':_0x8b13('0x151')};}};AGIVertices['prototype']['gotoiftime']=function(_0xfb6e4c){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x153'),_0xfb6e4c[_0x8b13('0x3a')]));if(!this['isConfigured'](_0xfb6e4c['interval_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xfb6e4c,_0x8b13('0x154'));}var _0x393e7e=this[_0x8b13('0x25')]['sync'](this,_0xfb6e4c[_0x8b13('0x155')]);if(!_0x393e7e){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xfb6e4c,_0x8b13('0x156'));}for(var _0x2e84cb=0x0;_0x2e84cb<_0x393e7e[_0x8b13('0x9e')];_0x2e84cb+=0x1){var _0x442c57=this[_0x8b13('0x38')][_0x8b13('0x11')](util[_0x8b13('0x2a')](_0x8b13('0x157'),_0x393e7e[_0x2e84cb]));if(_0x442c57[_0x8b13('0xa8')]===-0x1){return _0x442c57;}logger[_0x8b13('0x32')](util['format']('IFTIME\x20%s\x20%s',_0x393e7e[_0x2e84cb],_0x442c57['extra']));if(_0x442c57['extra']==='true'){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x150')));this['channel']['noop'](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x150')));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x151')));this[_0x8b13('0x38')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x393e7e[_0x2e84cb],_0x8b13('0x151')));}}return{'code':0xc8,'result':_0x8b13('0x151')};};AGIVertices[_0x8b13('0x10')][_0x8b13('0x159')]=function(_0x837ba5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x15a'),_0x837ba5[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['hangup']();};AGIVertices[_0x8b13('0x10')][_0x8b13('0x15b')]=function(_0x282adb){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x15c'),_0x282adb['label']));if(!this[_0x8b13('0xad')](_0x282adb[_0x8b13('0x80')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x138'));}var _0x5c2864=_0x8b13('0x139');var _0x472011=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs[_0x8b13('0x124')](0x4));var _0x4ad638=util[_0x8b13('0x2a')](_0x8b13('0x145'),_0x472011,_0x5c2864);var _0x22e934=!![];if(_0x282adb[_0x8b13('0x13b')]===_0x8b13('0x146')){_0x22e934=![];}var _0x52fde6=this[_0x8b13('0x38')]['recordFile'](_0x472011,_0x5c2864,_0x282adb['intKey'],_0x282adb['timeout'],undefined,_0x22e934);if(_0x52fde6[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x15d'),_0x4ad638));var _0xb1500d=this[_0x8b13('0x8a')][_0x8b13('0x78')](this,_0x282adb,_0x4ad638);if(_0xb1500d){for(var _0x45bccc in _0xb1500d){if(_0xb1500d[_0x8b13('0xa2')](_0x45bccc)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x15e'),_0x45bccc['toUpperCase']()),_0xb1500d[_0x45bccc]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xb1500d)));}}return _0x52fde6;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x15f')]=function(_0x5e0767){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x160'),_0x5e0767[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x5e0767[_0x8b13('0x80')])){return this[_0x8b13('0x38')]['noop']('no\x20key\x20configured');}if(!this[_0x8b13('0xad')](_0x5e0767[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x161'),_0x5e0767[_0x8b13('0x62')]));var _0x152b87=this[_0x8b13('0x87')][_0x8b13('0x78')](this,_0x5e0767);if(_0x152b87){this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x15d'),_0x152b87));var _0x28439f=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x152b87,_0x5e0767[_0x8b13('0x13d')]);try{fs['unlink'](_0x152b87+_0x8b13('0x10e'));}catch(_0x3aa01e){logger[_0x8b13('0x2e')](_0x3aa01e);}return _0x28439f;}return this[_0x8b13('0x38')]['error'](_0x5e0767,_0x8b13('0x162'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x163')]=function(_0x39de4e){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x164'),_0x39de4e[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x39de4e[_0x8b13('0x165')])){return this[_0x8b13('0x38')]['error'](_0x39de4e,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x167'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));var _0x38be9f=this[_0x8b13('0x57')][_0x8b13('0x78')](this,_0x39de4e['findBy']);if(_0x38be9f){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8b13('0x38')]['callerid'],_0x39de4e[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util['format'](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x39de4e[_0x8b13('0x165')]));this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x16c')]=function(_0xc43aba){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xc43aba[_0x8b13('0x3a')]));if(!this['isConfigured'](_0xc43aba[_0x8b13('0x165')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xc43aba,'no\x20find\x20by\x20configured');}logger[_0x8b13('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba['findBy']));var _0x1f2a30=this[_0x8b13('0x56')][_0x8b13('0x78')](this,_0xc43aba[_0x8b13('0x165')]);if(_0x1f2a30){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this['channel'][_0x8b13('0x3e')],_0xc43aba['findBy']));this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba['findBy']));this[_0x8b13('0x38')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8b13('0x38')]['callerid'],_0xc43aba[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x16d')]=function(_0x3a92d6){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x16e'),_0x3a92d6[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x3a92d6[_0x8b13('0x16f')])){return this['channel'][_0x8b13('0x2e')](_0x3a92d6,'no\x20operation\x20configured');}this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x170'),_0x3a92d6['operation']));var _0x555589=eval(_0x3a92d6[_0x8b13('0x16f')]);if(!this[_0x8b13('0xad')](_0x3a92d6[_0x8b13('0xe0')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xdf'));}var _0x3e0f5f=this[_0x8b13('0x11')]['sync'](this,_0x3a92d6[_0x8b13('0xe0')]);if(!_0x3e0f5f){return this['channel'][_0x8b13('0x2e')](_0x3a92d6,_0x8b13('0x171'));}if(_[_0x8b13('0x9d')](_0x555589)){var _0x3bddea=this;_0x555589[_0x8b13('0xe1')](function(_0x4e8288,_0x4241de){_0x3bddea[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s[%s]',_0x3e0f5f,_0x4241de),_0x4e8288);});return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format']('variable\x20%s[key]\x20set',_0x3e0f5f));}else{return this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x3e0f5f,_0x555589);}};AGIVertices['prototype'][_0x8b13('0xc')]=function(_0x3419cb){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x172'),_0x3419cb[_0x8b13('0x3a')]));if(_0x3419cb[_0x8b13('0x11c')]===0x0){return this['maxRetry'](_0x3419cb);}_0x3419cb[_0x8b13('0x11c')]-=0x1;if(!this[_0x8b13('0xad')](_0x3419cb['file_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,'no\x20file\x20audio\x20selected');}var _0x4dbfc0=this['getSound'][_0x8b13('0x78')](this,_0x3419cb[_0x8b13('0x11d')]);if(!_0x4dbfc0){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,_0x8b13('0x11e'));}var _0x153cbb=this[_0x8b13('0x38')][_0x8b13('0x11f')](_0x4dbfc0,_0x3419cb['response'],_0x3419cb[_0x8b13('0x173')]);var _0x280127=_0x153cbb[_0x8b13('0xa8')];if(_0x153cbb[_0x8b13('0xa8')]===-0x1){this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x3419cb,'-1');return _0x153cbb;}else if(_0x153cbb[_0x8b13('0xa6')]===_0x8b13('0x6b')){_0x153cbb['result']=_0x153cbb[_0x8b13('0xa8')][_0x8b13('0x9e')]>0x0?_0x153cbb[_0x8b13('0xa8')]:'t';}else if(_[_0x8b13('0x47')](_0x153cbb['result'])){_0x153cbb[_0x8b13('0xa8')]='#';_0x280127='#';}if(!this[_0x8b13('0xad')](_0x3419cb[_0x8b13('0xe0')])){this['channel'][_0x8b13('0xae')](_0x8b13('0xdf'));}else{var _0x33d693=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x3419cb[_0x8b13('0xe0')]);if(!_0x33d693){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,_0x8b13('0x171'));}this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x33d693,_0x280127);}this[_0x8b13('0x37')]['sync'](this,_0x3419cb,_0x280127);return _0x153cbb;};AGIVertices[_0x8b13('0x10')][_0x8b13('0xae')]=function(_0x5262c7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5262c7[_0x8b13('0x3a')]));return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x5262c7[_0x8b13('0x174')]||_0x5262c7[_0x8b13('0x3a')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x175')]=function(_0x564edf){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x176'),_0x564edf[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x564edf[_0x8b13('0x165')])){return this['channel']['error'](_0x564edf,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x167'),this['channel']['callerid'],_0x564edf[_0x8b13('0x165')]));var _0xdf8d30=this[_0x8b13('0x51')]['sync'](this,_0x564edf[_0x8b13('0x177')]);var _0x75287a=this['agentPause'][_0x8b13('0x78')](this,_0x564edf[_0x8b13('0x165')],_0xdf8d30);if(_0x75287a){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x564edf[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x564edf['findBy']));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x564edf[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')]['callerid'],_0x564edf[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices['prototype'][_0x8b13('0x178')]=function(_0x269c37){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x179'),_0x269c37[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x269c37[_0x8b13('0x11d')])){return this['channel']['error'](_0x269c37,_0x8b13('0x17a'));}var _0x108b1a=this[_0x8b13('0x1e')][_0x8b13('0x78')](this,_0x269c37[_0x8b13('0x11d')]);if(!_0x108b1a){return this['channel'][_0x8b13('0x2e')](_0x269c37,_0x8b13('0x11e'));}var _0x59032b=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x17b'),[_0x108b1a,_0x269c37['opts']]);if(_0x59032b[_0x8b13('0xa8')]===-0x1){return _0x59032b;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x17c'),_0x8b13('0x17b'),_0x108b1a));};AGIVertices['prototype'][_0x8b13('0x17d')]=function(_0x52b982){logger['info'](util['format'](_0x8b13('0x17e'),_0x52b982['label']));if(!this[_0x8b13('0xad')](_0x52b982[_0x8b13('0x17f')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x52b982,_0x8b13('0x180'));}var _0xf4c3b1='';var _0x25bc42=parseInt(_0x52b982['queue_id'],0xa);if(isNaN(_0x25bc42)){_0xf4c3b1=_0x52b982[_0x8b13('0x17f')];}else{_0xf4c3b1=this['getVoiceQueue'][_0x8b13('0x78')](this,_0x52b982[_0x8b13('0x17f')]);if(!_0xf4c3b1){return this[_0x8b13('0x38')]['error'](_0x52b982,_0x8b13('0x181'));}}var _0x4ebfc7='';if(this[_0x8b13('0xad')](_0x52b982[_0x8b13('0x11d')])){var _0x307c9d=this['getSound'][_0x8b13('0x78')](this,_0x52b982[_0x8b13('0x11d')]);if(_0x307c9d){_0x4ebfc7=_0x307c9d;}}this[_0x8b13('0x37')]['sync'](this,_0x52b982,_0xf4c3b1);if(_0x52b982[_0x8b13('0xec')][_0x8b13('0x182')]('x')<0x0){_0x52b982['opts']+='x';}if(_0x52b982[_0x8b13('0xec')][_0x8b13('0x182')]('X')<0x0){_0x52b982['opts']+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0xf4c3b1?_0xf4c3b1[_0x8b13('0x183')]():'');var _0x250d82=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x184'),[_0xf4c3b1,_0x52b982[_0x8b13('0xec')],_0x52b982[_0x8b13('0x6a')],_0x4ebfc7,_0x52b982[_0x8b13('0x6b')],_0x52b982['agi'],_0x52b982[_0x8b13('0x185')],_0x52b982[_0x8b13('0x186')],'',_0x52b982[_0x8b13('0x187')]]);if(_0x250d82[_0x8b13('0xa8')]===-0x1){return _0x250d82;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0xf4c3b1));};AGIVertices[_0x8b13('0x10')]['record']=function(_0x46c04f){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x46c04f['label']));var _0x208425=_0x46c04f[_0x8b13('0x188')]||'wav';var _0x23bdc4=util[_0x8b13('0x2a')](_0x8b13('0x189'),this[_0x8b13('0x38')][_0x8b13('0x39')],rs['generate'](0x5));var _0x28a912=util[_0x8b13('0x2a')](_0x8b13('0x18a'),FILES_PATH,_0x23bdc4,_0x208425);var _0x4075c6=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,_0x23bdc4);this['createSquareRecording'][_0x8b13('0x78')](this,_0x46c04f,_0x23bdc4,_0x28a912);this[_0x8b13('0x38')][_0x8b13('0xa3')]('RECORDING_SAVENAME',_0x23bdc4);logger['info'](_0x8b13('0x18b'),_0x4075c6,_0x208425,_0x46c04f[_0x8b13('0x18c')],_0x46c04f[_0x8b13('0x6b')]);return this[_0x8b13('0x38')][_0x8b13('0x13c')](_0x4075c6,_0x208425,_0x46c04f[_0x8b13('0x18c')],_0x46c04f[_0x8b13('0x6b')],undefined,!![]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x18d')]=function(_0x3fff1c){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3fff1c[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x3fff1c[_0x8b13('0x6a')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x18e'));}var _0x33c2e7=this[_0x8b13('0x69')][_0x8b13('0x78')](this,_0x3fff1c);logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x18f'),util[_0x8b13('0x190')](_0x33c2e7,{'showHidden':![],'depth':null})));if(!this[_0x8b13('0xad')](_0x3fff1c[_0x8b13('0xe0')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x191'));}var _0x33ca8f=this[_0x8b13('0x11')]['sync'](this,_0x3fff1c['variable_id']);if(!_0x33ca8f){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3fff1c,_0x8b13('0x171'));}this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s_STATUS_CODE',_0x33ca8f),_0x33c2e7['statusCode']?_0x33c2e7[_0x8b13('0x192')]:_0x8b13('0x193'));this[_0x8b13('0x38')][_0x8b13('0xa3')](util['format'](_0x8b13('0x194'),_0x33ca8f),_0x33c2e7['statusMessage']?_0x33c2e7[_0x8b13('0x195')]:'OK');if(_0x33c2e7[_0x8b13('0x72')]){try{this[_0x8b13('0xa1')](_0x33c2e7[_0x8b13('0x72')],_0x33ca8f);}catch(_0x399703){logger[_0x8b13('0x2e')](util[_0x8b13('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x33ca8f));}}return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xe4'),_0x33ca8f));};AGIVertices[_0x8b13('0x10')]['saydigits']=function(_0x289ee9){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x196'),_0x289ee9['label']));return this[_0x8b13('0x38')]['sayDigits'](_0x289ee9[_0x8b13('0x197')][_0x8b13('0x5e')](/\s+/g,''),_0x289ee9['escape_digits']);};AGIVertices['prototype'][_0x8b13('0x198')]=function(_0x23f7aa){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x199'),_0x23f7aa[_0x8b13('0x3a')]));return this['channel']['sayNumber'](_0x23f7aa[_0x8b13('0x6c')]['replace'](/\s+/g,''),_0x23f7aa['escape_digits']);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x19a')]=function(_0x12fe4b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x19b'),_0x12fe4b[_0x8b13('0x3a')]));return this[_0x8b13('0x38')][_0x8b13('0x19c')](_0x12fe4b[_0x8b13('0x62')],_0x12fe4b[_0x8b13('0x18c')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x19d')]=function(_0x6b78f6){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x19e'),_0x6b78f6['label']));if(!this[_0x8b13('0xad')](_0x6b78f6['account_id'])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0x19f'));}var _0xbe27cf=this[_0x8b13('0x22')][_0x8b13('0x78')](this,_0x6b78f6[_0x8b13('0x1a0')]);if(!_0xbe27cf||!_0xbe27cf[_0x8b13('0x1a1')]){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x6b78f6,_0x8b13('0x1a2'));}var _0x4da52a={'from':util['format'](_0x8b13('0x1a3'),_0xbe27cf['name'],_0xbe27cf[_0x8b13('0x1a4')]||_0xbe27cf[_0x8b13('0x1a1')]['user']),'to':_0x6b78f6['to']||'','cc':_0x6b78f6['cc']||'','bcc':_0x6b78f6[_0x8b13('0x1a5')]||'','subject':_0x6b78f6[_0x8b13('0x1a6')],'html':_0x6b78f6[_0x8b13('0x62')],'text':_0x6b78f6[_0x8b13('0x62')]};if(this[_0x8b13('0xad')](_0x6b78f6[_0x8b13('0x1a7')])){}logger[_0x8b13('0x1a8')](_0x8b13('0x1a9'),JSON['stringify'](_0x4da52a));this[_0x8b13('0x37')]['sync'](this,_0x6b78f6,_0x6b78f6[_0x8b13('0x1a0')]);this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0x1aa'),_0xbe27cf[_0x8b13('0x14')]));this[_0x8b13('0x24')]['sync'](this,_0xbe27cf[_0x8b13('0x1ab')],_0x4da52a);return this[_0x8b13('0x38')][_0x8b13('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8b13('0x10')]['sendFax']=function(_0x2cb68a){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2cb68a[_0x8b13('0x3a')]));return this['channel']['noop'](_0x8b13('0x1ac'));};AGIVertices[_0x8b13('0x10')]['sendSMS']=function(_0x2728c5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1ad'),_0x2728c5[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x2728c5[_0x8b13('0x1ae')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1af'));}var _0x508ae6=this[_0x8b13('0x1b0')]['sync'](this,_0x2728c5[_0x8b13('0x1ae')]);if(!_0x508ae6){return this[_0x8b13('0x38')]['error'](_0x2728c5,'no\x20sms\x20account\x20found');}var _0x3645c7={'body':_0x2728c5[_0x8b13('0x1b1')],'phone':_0x2728c5['to']||'','SmsAccountId':_0x508ae6['id']};logger[_0x8b13('0x1a8')]('sendSMS\x20message',JSON[_0x8b13('0x7b')](_0x3645c7));this[_0x8b13('0x37')]['sync'](this,_0x2728c5,_0x2728c5[_0x8b13('0x1ae')]);this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1b2'),_0x508ae6[_0x8b13('0x14')]));this['createSmsMessage'][_0x8b13('0x78')](this,_0x3645c7);return this[_0x8b13('0x38')]['noop'](_0x8b13('0x1b3'));};AGIVertices[_0x8b13('0x10')]['set']=function(_0x5219bc){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5219bc[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x5219bc['variable_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5219bc,_0x8b13('0x1b4'));}var _0x25ee4c=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x5219bc[_0x8b13('0xe0')]);if(!_0x25ee4c){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5219bc,'no\x20variable\x20found');}return this['channel'][_0x8b13('0xa3')](_0x25ee4c,_0x5219bc[_0x8b13('0x1b5')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1b6')]=function(_0x25fde4){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1b7'),_0x25fde4['label']));this[_0x8b13('0x38')]['noop']('START\x20CALLY\x20SQUARE');var _0x381d7d=this[_0x8b13('0x38')]['getVariable'](_0x8b13('0x1b8'));if(!_[_0x8b13('0x47')](_0x381d7d[_0x8b13('0xa6')])){this[_0x8b13('0x38')][_0x8b13('0x39')]=_0x381d7d[_0x8b13('0xa6')];}if(_0x25fde4['answer']==='yes'){this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1b9'));return this[_0x8b13('0x38')][_0x8b13('0xbc')]();}return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1ba'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1bb')]=function(_0x4ed2f1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4ed2f1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x4ed2f1['project_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4ed2f1,_0x8b13('0x1bc'));}var _0x51c000=this[_0x8b13('0x1bd')][_0x8b13('0x78')](this,_0x4ed2f1[_0x8b13('0x1be')]);if(!this[_0x8b13('0xad')](_0x51c000)){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4ed2f1,util[_0x8b13('0x2a')](_0x8b13('0x1bf'),_0x4ed2f1[_0x8b13('0x1be')]));}if(_0x51c000===this[_0x8b13('0x38')][_0x8b13('0x3c')]){return this['channel'][_0x8b13('0x2e')](_0x4ed2f1,_0x8b13('0x1c0'));}this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4ed2f1,_0x51c000);var _0x3b7d8c=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x1c1'),util[_0x8b13('0x2a')](_0x8b13('0x1c2'),config[_0x8b13('0x8')][_0x8b13('0x1c3')]||_0x8b13('0x1c4'),_0x51c000,this[_0x8b13('0x38')][_0x8b13('0x3c')]));if(_0x3b7d8c['result']===-0x1){return _0x3b7d8c;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x17c'),_0x8b13('0x1c1'),_0x51c000));};AGIVertices[_0x8b13('0x10')]['system']=function(_0x3fdcf0){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x1c5'),_0x3fdcf0[_0x8b13('0x3a')]));var _0x45f48e=this[_0x8b13('0x5b')][_0x8b13('0x78')](this,_0x3fdcf0[_0x8b13('0xba')]);this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x3fdcf0,_0x3fdcf0['command']);if(this[_0x8b13('0xad')](_0x3fdcf0[_0x8b13('0xe0')])){var _0x43fcc9=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x3fdcf0[_0x8b13('0xe0')]);if(_0x43fcc9){this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x43fcc9,_0x45f48e);return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1c6'),_0x3fdcf0[_0x8b13('0xba')],_0x43fcc9));}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1c7'),_0x3fdcf0[_0x8b13('0xba')]));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1c8')]=function(_0xb289f7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1c9'),_0xb289f7[_0x8b13('0x3a')]));_0xb289f7[_0x8b13('0x62')]=_0xb289f7[_0x8b13('0x62')][_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8b13('0xad')](_0xb289f7[_0x8b13('0x60')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0x1ca'));}if(!this[_0x8b13('0xad')](_0xb289f7[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1cb'),_0xb289f7['text']));var _0x2bb067=this[_0x8b13('0x5f')][_0x8b13('0x78')](this,_0xb289f7);if(_0x2bb067){this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0x1cc'),_0x2bb067));var _0x1e5619=this['channel'][_0x8b13('0x10c')](_0x2bb067);try{fs[_0x8b13('0x10d')](_0x2bb067+_0x8b13('0x10e'));}catch(_0x2dba50){logger[_0x8b13('0x2e')](_0x2dba50);}return _0x1e5619;}return this[_0x8b13('0x38')]['error'](_0xb289f7,_0x8b13('0x1cd'));};AGIVertices['prototype'][_0x8b13('0x1ce')]=function(_0x21c7e1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1cf'),_0x21c7e1['label']));_0x21c7e1[_0x8b13('0x62')]=_0x21c7e1['text'][_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8b13('0xad')](_0x21c7e1[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20text\x20configured');}this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x21c7e1[_0x8b13('0x62')]));var _0x342252=this[_0x8b13('0x67')]['sync'](this,_0x21c7e1);if(_0x342252){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x342252));var _0x4025b1=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x342252);try{fs[_0x8b13('0x10d')](_0x342252+_0x8b13('0x10e'));}catch(_0x3815d3){logger[_0x8b13('0x2e')](_0x3815d3);}return _0x4025b1;}return this[_0x8b13('0x38')]['error'](_0x21c7e1,_0x8b13('0x1d0'));};AGIVertices[_0x8b13('0x10')]['unpause']=function(_0x515152){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x1d1'),_0x515152['label']));if(!this['isConfigured'](_0x515152['findBy'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x515152,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util['format'](_0x8b13('0x167'),this[_0x8b13('0x38')]['callerid'],_0x515152[_0x8b13('0x165')]));var _0x4f5075=this['agentUnpause'][_0x8b13('0x78')](this,_0x515152['findBy']);if(_0x4f5075){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x515152[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x515152['findBy']));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this['channel'][_0x8b13('0x3e')],_0x515152[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x515152[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices['prototype'][_0x8b13('0x1d2')]=function(_0x483c0c){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x1d3'),_0x483c0c[_0x8b13('0x3a')]));var _0x32589e=this['channel'][_0x8b13('0x5c')]('VOICEMAIL',[_0x483c0c['mailbox'],_0x483c0c[_0x8b13('0x7e')]]);if(_0x32589e['result']===-0x1){return _0x32589e;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x17c'),_0x8b13('0x1d4'),_0x483c0c['mailbox']));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1d5')]=function(_0x27ca47){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1d6'),_0x27ca47['label']));if(!this[_0x8b13('0xad')](_0x27ca47[_0x8b13('0xe0')])){return this[_0x8b13('0x38')]['error'](_0x27ca47,'no\x20variable\x20selected');}var _0x3c87e4=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x27ca47[_0x8b13('0xe0')]);if(!_0x3c87e4){return this['channel'][_0x8b13('0x2e')](_0x27ca47,_0x8b13('0x171'));}var _0x17d5cd=this[_0x8b13('0x38')][_0x8b13('0x11')](_0x3c87e4);return{'code':0xc8,'result':_0x17d5cd[_0x8b13('0xa6')]?_0x17d5cd[_0x8b13('0xa6')]:'-'};};String[_0x8b13('0x10')][_0x8b13('0xa5')]=function(_0x3a6607,_0x37f533){return this[_0x8b13('0xa4')](_0x3a6607)[_0x8b13('0x1d7')](_0x37f533);};module[_0x8b13('0x1d8')]=AGIVertices; \ No newline at end of file +var _0x0faf=['replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','setVariable','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','TILDE_ASR_%s','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','playback','opts','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','then','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','open','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','MALE','MP3','google_tts_language','restAPI','method','timeout','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','url','render','stringify','parse','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','hasOwnProperty','saveRestApiResult','%s.%s','split'];(function(_0x544e70,_0x56f122){var _0x1bb38b=function(_0x21418c){while(--_0x21418c){_0x544e70['push'](_0x544e70['shift']());}};_0x1bb38b(++_0x56f122);}(_0x0faf,0x132));var _0xf0fa=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x0faf[_0x3f4891];return _0x54f2d8;};'use strict';var fs=require('fs');var util=require(_0xf0fa('0x0'));var _=require('lodash');var sh=require(_0xf0fa('0x1'));var odbc=require(_0xf0fa('0x2'))();var rs=require(_0xf0fa('0x3'));var moment=require(_0xf0fa('0x4'));var Mustache=require(_0xf0fa('0x5'));var rp=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xf0fa('0xa');var recursiveMapAttributes=[_0xf0fa('0xb'),_0xf0fa('0xc')];var verticesWithRetry=[_0xf0fa('0xd'),_0xf0fa('0xe'),'getsecretdigits'];var AGIVertices=function(_0x42f7fd,_0x18db40,_0x481a42){this['channel']=_0x42f7fd;this[_0xf0fa('0xf')]=_0x18db40;this[_0xf0fa('0x10')]=_0x481a42;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x12')]=function(_0x2bd807,_0x1151ea){this[_0xf0fa('0xf')][_0xf0fa('0x13')](_0x2bd807)['then'](function(_0x2b88c1){_0x1151ea(null,_0x2b88c1?_0x2b88c1['name']:![]);})[_0xf0fa('0x14')](function(_0x521034){_0x1151ea(_0x521034);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x15')]=function(_0x39a086,_0x547952){this['rpc'][_0xf0fa('0x16')](_0x39a086)['then'](function(_0x1f7159){_0x547952(null,_0x1f7159?_0x1f7159[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x3203ce){_0x547952(_0x3203ce);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x18')]=function(_0x28bab8,_0x3f3bb7){this['rpc'][_0xf0fa('0x19')](_0x28bab8)[_0xf0fa('0x1a')](function(_0x30ce17){_0x3f3bb7(null,_0x30ce17?_0x30ce17[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x386e5f){_0x3f3bb7(_0x386e5f);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x2f376d,_0x2751cc){this[_0xf0fa('0xf')][_0xf0fa('0x1b')](_0x2f376d)[_0xf0fa('0x1a')](function(_0x403e7d){_0x2751cc(null,_0x403e7d?_0x403e7d[_0xf0fa('0x1c')]:![]);})[_0xf0fa('0x14')](function(_0x3b87a2){_0x2751cc(_0x3b87a2);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1d')]=function(_0x5bead8,_0x10c93e){this[_0xf0fa('0xf')][_0xf0fa('0x1e')](_0x5bead8)[_0xf0fa('0x1a')](function(_0x3273b9){_0x10c93e(null,_0x3273b9?_0x3273b9[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x1f0eaf){_0x10c93e(_0x1f0eaf);});};AGIVertices[_0xf0fa('0x11')]['getTrunk']=function(_0xeb86a9,_0x19e392){this['rpc'][_0xf0fa('0x1f')](_0xeb86a9)[_0xf0fa('0x1a')](function(_0x2efe88){_0x19e392(null,_0x2efe88?_0x2efe88['name']:![]);})[_0xf0fa('0x14')](function(_0x284499){_0x19e392(_0x284499);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x20')]=function(_0x4e6eef,_0x4be235){var _0x287810=this;this[_0xf0fa('0xf')][_0xf0fa('0x21')](_0x4e6eef)[_0xf0fa('0x1a')](function(_0x57b8e9){_0x4be235(null,_0x57b8e9?_0x287810[_0xf0fa('0x22')](_0x57b8e9[_0xf0fa('0x23')]):![]);})[_0xf0fa('0x14')](function(_0x5a4fd3){_0x4be235(_0x5a4fd3);});};AGIVertices[_0xf0fa('0x11')]['getMailAccount']=function(_0x42c656,_0x1e3875){this[_0xf0fa('0xf')]['getMailAccountById'](_0x42c656)[_0xf0fa('0x1a')](function(_0x33cc64){_0x1e3875(null,_0x33cc64?_0x33cc64:![]);})[_0xf0fa('0x14')](function(_0x212986){_0x1e3875(_0x212986);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x24')]=function(_0x490613,_0x534c10,_0x36173a){this[_0xf0fa('0x10')]['sendMailMessage'](_0x490613,_0x534c10)[_0xf0fa('0x1a')](function(){_0x36173a(null);})['catch'](function(_0x5ca1b2){_0x36173a(_0x5ca1b2);});};AGIVertices['prototype'][_0xf0fa('0x25')]=function(_0x5c82d7,_0x2c0721){this[_0xf0fa('0xf')][_0xf0fa('0x26')](_0x5c82d7)[_0xf0fa('0x1a')](function(_0x19c97e){if(_0x19c97e){if(_0x19c97e[_0xf0fa('0x27')]){_0x2c0721(null,[_0x19c97e[_0xf0fa('0x28')]]);}else{_0x2c0721(null,_[_0xf0fa('0x29')](_0x19c97e['Intervals'],_0xf0fa('0x28')));}}else{_0x2c0721(null,![]);}})[_0xf0fa('0x14')](function(_0x36dd2b){_0x2c0721(_0x36dd2b);});};AGIVertices['prototype'][_0xf0fa('0x22')]=function(_0x114feb){return util[_0xf0fa('0x2a')](_0xf0fa('0x2b'),FILES_PATH,_0x114feb);};AGIVertices['prototype']['getQueryOdbc']=function(_0x2a9f4b,_0x68b3fe,_0x2a6560){odbc[_0xf0fa('0x2c')](_0x2a9f4b,function(_0x3a238d){if(_0x3a238d){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3a238d);_0x2a6560(_0x3a238d);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xf0fa('0x2d')](_0x68b3fe,function(_0x778121,_0x5ef93e){if(_0x778121){logger['info'](_0xf0fa('0x2e'),_0x68b3fe);_0x2a6560(_0x778121);}else{logger[_0xf0fa('0x2f')](_0xf0fa('0x30'),_0x68b3fe);odbc[_0xf0fa('0x31')](function(_0x2202de){if(_0x2202de){logger[_0xf0fa('0x32')](_0xf0fa('0x33'),_0x2202de);}_0x2a6560(null,_0x5ef93e);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x344bb0,_0x1d4830){this[_0xf0fa('0xf')][_0xf0fa('0x34')](_0x344bb0)[_0xf0fa('0x1a')](function(_0x1d0129){_0x1d4830(null,_0x1d0129?_0x1d0129:![]);})['catch'](function(_0x17d3a5){_0x1d4830(_0x17d3a5);});};AGIVertices['prototype'][_0xf0fa('0x35')]=function(_0x466369,_0x6e1fd9){this[_0xf0fa('0xf')][_0xf0fa('0x35')](_0x466369)[_0xf0fa('0x1a')](function(_0x14c962){_0x6e1fd9(null,_0x14c962);})[_0xf0fa('0x14')](function(_0x2fc4b1){_0x6e1fd9(_0x2fc4b1);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x52221a,_0x304bae,_0x34be72){this['rpc'][_0xf0fa('0x36')]({'uniqueid':this[_0xf0fa('0x37')][_0xf0fa('0x38')],'node':_0x52221a[_0xf0fa('0x39')],'application':_0x52221a['agicommand'],'data':_0x304bae||null,'project_name':this[_0xf0fa('0x37')][_0xf0fa('0x3a')],'callerid':this[_0xf0fa('0x37')][_0xf0fa('0x3b')]})[_0xf0fa('0x1a')](function(_0x207a9d){if(_0x34be72){_0x34be72(null,_0x207a9d);}})[_0xf0fa('0x14')](function(_0x295edd){if(_0x34be72){_0x34be72(_0x295edd);}});};AGIVertices[_0xf0fa('0x11')]['createSquareRecording']=function(_0x45c0e8,_0x3b5bfa,_0x896adf,_0x24ae12){this[_0xf0fa('0xf')][_0xf0fa('0x3c')]({'uniqueid':this['channel'][_0xf0fa('0x38')],'callerid':this[_0xf0fa('0x37')]['callerid'],'calleridname':this[_0xf0fa('0x37')][_0xf0fa('0x3d')],'context':this[_0xf0fa('0x37')][_0xf0fa('0x3e')],'extension':this[_0xf0fa('0x37')][_0xf0fa('0x3f')],'priority':this[_0xf0fa('0x37')][_0xf0fa('0x40')],'accountcode':this[_0xf0fa('0x37')]['accountcode'],'dnid':this[_0xf0fa('0x37')]['dnid'],'projectName':this[_0xf0fa('0x37')][_0xf0fa('0x3a')],'saveName':_0x3b5bfa,'filename':_0x45c0e8[_0xf0fa('0x41')]||_0x3b5bfa,'savePath':_0x896adf})['then'](function(_0x324765){_0x24ae12(null,_0x324765);})[_0xf0fa('0x14')](function(_0x354f03){_0x24ae12(_0x354f03);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x42')]=function(_0x521106,_0xbfcbff,_0x4cda3e,_0x19c22f,_0x821e40){this[_0xf0fa('0xf')][_0xf0fa('0x42')]({'uniqueid':this[_0xf0fa('0x37')]['uniqueid'],'body':_0x521106,'direction':_0xbfcbff,'providerName':_0x4cda3e,'providerResponse':_0x19c22f})[_0xf0fa('0x1a')](function(_0x1ea31d){if(_0x821e40){_0x821e40(null,_0x1ea31d);}})[_0xf0fa('0x14')](function(_0x401995){if(_0x821e40){_0x821e40(_0x401995);}});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x43')]=function(_0x52e781,_0x44a3bf){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x52e781[_0xf0fa('0x17')])||_[_0xf0fa('0x44')](_0x52e781[_0xf0fa('0x17')])?_0xf0fa('0x45')+Math[_0xf0fa('0x46')]():_0x52e781[_0xf0fa('0x17')],'lastName':_[_0xf0fa('0x47')](_0x52e781[_0xf0fa('0x48')])||_[_0xf0fa('0x44')](_0x52e781['lastName'])?null:_0x52e781[_0xf0fa('0x48')],'phone':_0x52e781['phone'],'ListId':_0x52e781[_0xf0fa('0x49')],'scheduledat':_0x52e781[_0xf0fa('0x4a')],'callbackUniqueid':this[_0xf0fa('0x37')][_0xf0fa('0x38')],'tags':'callback','description':_0xf0fa('0x4b')+_0x52e781['scheduledAt'][_0xf0fa('0x4c')](),'priority':_0x52e781[_0xf0fa('0x4d')]})[_0xf0fa('0x1a')](function(_0x1d6a27){_0x44a3bf(null,_0x1d6a27);})[_0xf0fa('0x14')](function(_0x1fad44){_0x44a3bf(_0x1fad44);});};AGIVertices['prototype'][_0xf0fa('0x4e')]=function(_0x119816,_0x4a20f4){this[_0xf0fa('0xf')][_0xf0fa('0x4f')](_0x119816)['then'](function(_0x48d769){_0x4a20f4(null,_0x48d769?_0x48d769[_0xf0fa('0x17')]:![]);})['catch'](function(_0xd01a7a){_0x4a20f4(_0xd01a7a);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x50')]=function(_0x4db972,_0x2a3b50,_0x190f2b){var _0x480dc0={'role':_0xf0fa('0x51')};_0x480dc0[_0x4db972]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this['rpc'][_0xf0fa('0x50')](_0x480dc0,_0x2a3b50,this[_0xf0fa('0x37')]['uniqueid'])[_0xf0fa('0x1a')](function(_0x76b183){_0x190f2b(null,_[_0xf0fa('0x44')](_0x76b183)?![]:!![]);})[_0xf0fa('0x14')](function(_0x32367e){logger[_0xf0fa('0x32')](_0x32367e);_0x190f2b(null,![]);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x52')]=function(_0x32c846,_0x2c2c30){var _0x53f45c={'role':_0xf0fa('0x51')};_0x53f45c[_0x32c846]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this[_0xf0fa('0xf')][_0xf0fa('0x52')](_0x53f45c)[_0xf0fa('0x1a')](function(_0x15010d){_0x2c2c30(null,_['isNil'](_0x15010d)?![]:!![]);})[_0xf0fa('0x14')](function(_0x195632){logger[_0xf0fa('0x32')](_0x195632);_0x2c2c30(null,![]);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x53')]=function(_0x173166,_0x38fd3f){var _0x543a2c={'role':_0xf0fa('0x51')};_0x543a2c[_0x173166]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this[_0xf0fa('0xf')][_0xf0fa('0x53')](_0x543a2c)['then'](function(_0x5f023b){_0x38fd3f(null,_['isNil'](_0x5f023b)?![]:!![]);})[_0xf0fa('0x14')](function(_0x29c996){logger[_0xf0fa('0x32')](_0x29c996);_0x38fd3f(null,![]);});};AGIVertices[_0xf0fa('0x11')]['agentLogin']=function(_0x4a7326,_0x2faa6f){var _0x5f4921={'role':_0xf0fa('0x51')};_0x5f4921[_0x4a7326]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];var _0x23b368=_0x4a7326!=_0xf0fa('0x54')?util['format'](_0xf0fa('0x55'),_0xf0fa('0x56'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')]):undefined;this[_0xf0fa('0xf')][_0xf0fa('0x57')](_0x5f4921,_0x23b368)[_0xf0fa('0x1a')](function(_0x35e7e7){_0x2faa6f(null,_[_0xf0fa('0x44')](_0x35e7e7)?![]:!![]);})['catch'](function(_0x5b166d){logger[_0xf0fa('0x32')](_0x5b166d);_0x2faa6f(null,![]);});};AGIVertices['prototype'][_0xf0fa('0x58')]=function(_0x583a0b,_0x4b3cb6){sh['exec'](_[_0xf0fa('0x59')](_0x583a0b),function(_0x415a1b,_0x735e07){var _0xb31dcf=_0x735e07[_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'');_0x4b3cb6(null,_0xb31dcf);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x5b')]=function(_0x2b7965,_0x2a5a11){scripts[_0xf0fa('0x5b')](_0x2b7965['apiKey'],_0x2b7965[_0xf0fa('0x5c')]||'text',_0x2b7965[_0xf0fa('0x5d')],_0x2b7965['languageCode']||_0xf0fa('0x5e'),_0x2b7965['ssmlGender']||_0xf0fa('0x5f'),_0x2b7965['audioEncoding']||_0xf0fa('0x60'))[_0xf0fa('0x1a')](function(_0x274ae3){_0x2a5a11(null,_0x274ae3);})[_0xf0fa('0x14')](function(_0xf11c3c){_0x2a5a11(_0xf11c3c);});};AGIVertices['prototype']['googleTTS']=function(_0x4224ce,_0x157772){scripts['googleTTS'](_0x4224ce['text'],_0x4224ce[_0xf0fa('0x61')]||'en',0x1)[_0xf0fa('0x1a')](function(_0x176ae6){_0x157772(null,_0x176ae6);})[_0xf0fa('0x14')](function(_0x2748ef){_0x157772(_0x2748ef);});};AGIVertices['prototype'][_0xf0fa('0x62')]=function(_0x3bdb88,_0x16492b){var _0x5ab304={'uri':_0x3bdb88['url'],'method':_0x3bdb88[_0xf0fa('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3bdb88[_0xf0fa('0x64')])==='number'&&parseInt(_0x3bdb88['timeout'])>=0x1?parseInt(_0x3bdb88[_0xf0fa('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xf0fa('0x65')]([_0xf0fa('0x66'),'PUT'],_0x5ab304['method']['toUpperCase']())){try{_0x5ab304[_0xf0fa('0x67')]=_0x3bdb88['rawBody']?JSON['parse'](_0x3bdb88[_0xf0fa('0xc')]):{};}catch(_0xfb68fd){logger[_0xf0fa('0x32')](_0xf0fa('0x68'),_0xfb68fd);}}try{_0x5ab304[_0xf0fa('0x69')]=_0x3bdb88[_0xf0fa('0xb')]?JSON['parse'](_0x3bdb88[_0xf0fa('0xb')]):{};}catch(_0x18281f){logger[_0xf0fa('0x32')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x18281f);}if(_0x3bdb88[_0xf0fa('0x6a')]){try{var _0x4b803f=require(_0x3bdb88['computedVariables'])[_0xf0fa('0x6b')](this,_0x5ab304);_0x5ab304['uri']=Mustache['render'](_0x3bdb88[_0xf0fa('0x6c')],_0x4b803f,{},['$$','$$']);if(_0x5ab304[_0xf0fa('0x69')]){_0x5ab304[_0xf0fa('0x69')]=JSON['parse'](Mustache[_0xf0fa('0x6d')](JSON[_0xf0fa('0x6e')](_0x5ab304['headers']),_0x4b803f,{},['$$','$$']));}if(_0x5ab304[_0xf0fa('0x67')]){_0x5ab304[_0xf0fa('0x67')]=JSON[_0xf0fa('0x6f')](Mustache[_0xf0fa('0x6d')](JSON[_0xf0fa('0x6e')](_0x5ab304[_0xf0fa('0x67')]),_0x4b803f,{},['$$','$$']));}}catch(_0x56265f){logger[_0xf0fa('0x32')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x56265f);}}rp(_0x5ab304)[_0xf0fa('0x1a')](function(_0x1371d1){var _0x15987a={'statusCode':_0x1371d1[_0xf0fa('0x70')]||0xc8,'statusMessage':_0x1371d1[_0xf0fa('0x71')]||'OK','headers':_0x1371d1[_0xf0fa('0x69')]||{},'body':_0x1371d1[_0xf0fa('0x67')]||{}};_0x16492b(null,_0x15987a);})['catch'](function(_0x5b0bdd){var _0x9700df={'statusCode':_0x5b0bdd[_0xf0fa('0x70')]||0x1f4,'statusMessage':_0x5b0bdd['message']||_0xf0fa('0x72'),'headers':_0x5b0bdd['options']['headers']||{},'body':_0x5b0bdd[_0xf0fa('0x73')][_0xf0fa('0x67')]||{}};_0x16492b(null,_0x9700df);});};AGIVertices['prototype']['googleDialogflow']=function(_0x2fe9b0,_0x5fbd7f){scripts[_0xf0fa('0x74')](this[_0xf0fa('0x37')][_0xf0fa('0x38')],_0x2fe9b0[_0xf0fa('0x75')],_0x2fe9b0['text'],_0x2fe9b0[_0xf0fa('0x76')]||'en')[_0xf0fa('0x1a')](function(_0x4c5de4){_0x5fbd7f(null,_0x4c5de4);})[_0xf0fa('0x14')](function(_0x509d8a){_0x5fbd7f(_0x509d8a);});};AGIVertices[_0xf0fa('0x11')]['googleDialogflowV2']=function(_0x4867ca,_0x2bb0bf){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x4867ca['dialogflowV2_project_id'],_0x4867ca[_0xf0fa('0x77')],_0x4867ca['private_key'],_0x4867ca[_0xf0fa('0x5d')],_0x4867ca[_0xf0fa('0x78')]||'en')['then'](function(_0x462917){_0x2bb0bf(null,_0x462917);})[_0xf0fa('0x14')](function(_0x2d22b9){_0x2bb0bf(_0x2d22b9);});};AGIVertices[_0xf0fa('0x11')]['sestekNDA']=function(_0x335e53,_0x5d5adb){scripts[_0xf0fa('0x79')](this['channel'],_0x335e53)[_0xf0fa('0x1a')](function(_0x1c5b5e){_0x5d5adb(null,_0x1c5b5e);})[_0xf0fa('0x14')](function(_0x3c5191){_0x5d5adb(_0x3c5191);});};AGIVertices['prototype']['ispeechTTS']=function(_0x107e5b,_0x516e13){scripts[_0xf0fa('0x7a')](_0x107e5b[_0xf0fa('0x75')],_0x107e5b[_0xf0fa('0x5d')],_0x107e5b['ispeech_tts_language']||_0xf0fa('0x5e'),_0x107e5b['speed'])[_0xf0fa('0x1a')](function(_0x2d4e61){_0x516e13(null,_0x2d4e61);})[_0xf0fa('0x14')](function(_0x52cf85){_0x516e13(_0x52cf85);});};AGIVertices[_0xf0fa('0x11')]['ispeechASR']=function(_0xb03a62,_0x378536,_0x5089d1){scripts[_0xf0fa('0x7b')](_0x378536,_0xb03a62[_0xf0fa('0x75')],_0xb03a62[_0xf0fa('0x7c')]||_0xf0fa('0x5e'),this['isConfigured'](_0xb03a62[_0xf0fa('0x7d')])?_0xb03a62['model']:undefined)['then'](function(_0x2ea054){_0x5089d1(null,_0x2ea054);})[_0xf0fa('0x14')](function(_0x559954){_0x5089d1(_0x559954);});};AGIVertices['prototype'][_0xf0fa('0x7e')]=function(_0x428a1b,_0x518fa0){scripts[_0xf0fa('0x7e')](_0x428a1b['aws_access_key_id'],_0x428a1b[_0xf0fa('0x7f')],_0x428a1b[_0xf0fa('0x80')],_0x428a1b['aws_polly_voice']||'Amy',_0x428a1b[_0xf0fa('0x5d')],_0x428a1b['aws_text_type']||_0xf0fa('0x5d'))[_0xf0fa('0x1a')](function(_0x2b79df){_0x518fa0(null,_0x2b79df);})['catch'](function(_0x577ea1){_0x518fa0(_0x577ea1);});};AGIVertices[_0xf0fa('0x11')]['awsLex']=function(_0x24b4d7,_0x3efb38){scripts['awsLex'](this[_0xf0fa('0x37')]['uniqueid'],_0x24b4d7[_0xf0fa('0x81')],_0x24b4d7[_0xf0fa('0x7f')],_0x24b4d7[_0xf0fa('0x82')],_0x24b4d7[_0xf0fa('0x5d')],_0x24b4d7['aws_bot_name'])['then'](function(_0x13d530){_0x3efb38(null,_0x13d530);})['catch'](function(_0x3185f9){_0x3efb38(_0x3185f9);});};AGIVertices['prototype']['googleASR']=function(_0x1222fa,_0x501bd3,_0x49e7ea){scripts[_0xf0fa('0x83')](_0x501bd3,_0x1222fa['key'],_0x1222fa['google_asr_language']||_0xf0fa('0x5e'))[_0xf0fa('0x1a')](function(_0x4a784d){_0x49e7ea(null,_0x4a784d);})[_0xf0fa('0x14')](function(_0x4e6958){_0x49e7ea(_0x4e6958);});};AGIVertices['prototype'][_0xf0fa('0x84')]=function(_0x5bf4d8,_0x585899,_0x3fa423){scripts['tildeASR'](_0x585899,_0x5bf4d8[_0xf0fa('0x85')],_0x5bf4d8[_0xf0fa('0x86')],_0x5bf4d8['uri'])[_0xf0fa('0x1a')](function(_0x41abf7){_0x3fa423(null,_0x41abf7);})[_0xf0fa('0x14')](function(_0x52f89e){_0x3fa423(_0x52f89e);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x87')]=function(_0x4980fd){var _0x5b641c=_[_0xf0fa('0x65')](verticesWithRetry,_0x4980fd['agicommand'])?_0x4980fd:_['clone'](_0x4980fd);for(var _0xca1bd in _0x5b641c){if(_0x5b641c['hasOwnProperty'](_0xca1bd)){if(_0x5b641c[_0xca1bd]&&_['isString'](_0x5b641c[_0xca1bd])){if(_[_0xf0fa('0x65')](recursiveMapAttributes,_0xca1bd)){_0x5b641c[_0xca1bd]=this['replaceObjectAllVariables'](_0x5b641c[_0xca1bd]);}else{_0x5b641c[_0xca1bd]=this[_0xf0fa('0x88')](_0x5b641c[_0xca1bd]);}}}}return _0x5b641c;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x89')]=function(_0x2cb50b){for(var _0x941975 in _0x2cb50b){if(_0x2cb50b['hasOwnProperty'](_0x941975)){if(_[_0xf0fa('0x8a')](_0x2cb50b[_0x941975])){this[_0xf0fa('0x89')](_0x2cb50b[_0x941975]);}else if(_[_0xf0fa('0x8b')](_0x2cb50b[_0x941975])){for(var _0x390a37=0x0;_0x390a37<_0x2cb50b[_0x941975][_0xf0fa('0x8c')];_0x390a37++){this[_0xf0fa('0x89')](_0x2cb50b[_0x941975][_0x390a37]);}}else if(_[_0xf0fa('0x8d')](_0x2cb50b[_0x941975])){_0x2cb50b[_0x941975]=this[_0xf0fa('0x88')](_0x2cb50b[_0x941975]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x397378,_0x55dade){for(var _0x4c3271 in _0x397378){if(_0x397378[_0xf0fa('0x8e')](_0x4c3271)){if(_[_0xf0fa('0x8a')](_0x397378[_0x4c3271])){if(!_[_0xf0fa('0x47')](_0x397378[_0x4c3271])){this[_0xf0fa('0x8f')](_0x397378[_0x4c3271],util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x55dade,_0x4c3271));}}else if(_[_0xf0fa('0x8b')](_0x397378[_0x4c3271])){for(var _0x11b75c=0x0;_0x11b75c<_0x397378[_0x4c3271]['length'];_0x11b75c++){this['saveRestApiResult'](_0x397378[_0x4c3271][_0x11b75c],util['format']('%s.%s',_0x55dade,_0x4c3271+'['+_0x11b75c+']'));}}else{if(!_[_0xf0fa('0x44')](_0x397378[_0x4c3271])){this[_0xf0fa('0x37')]['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x55dade,_0x4c3271),_0x397378[_0x4c3271]);}}}}};AGIVertices[_0xf0fa('0x11')]['replaceObjectAllVariables']=function(_0x5c3729){try{var _0x893912=JSON[_0xf0fa('0x6f')](_0x5c3729);this[_0xf0fa('0x89')](_0x893912);return JSON[_0xf0fa('0x6e')](_0x893912);}catch(_0x44b3cf){return this[_0xf0fa('0x88')](_0x5c3729);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x460bbf){var _0x4e1d72=_0x460bbf[_0xf0fa('0x91')]('{');for(var _0x1cfd96=0x1;_0x1cfd96<_0x4e1d72[_0xf0fa('0x8c')];_0x1cfd96+=0x1){var _0x276e6c=_0x4e1d72[_0x1cfd96][_0xf0fa('0x91')]('}');if(_0x276e6c[_0xf0fa('0x8c')]>0x1){_0x460bbf=_0x460bbf[_0xf0fa('0x92')]('{'+_0x276e6c[0x0]+'}',this[_0xf0fa('0x37')][_0xf0fa('0x12')](_0x276e6c[0x0])['extra']||_0x276e6c[0x0]);}}if(_0x4e1d72[_0xf0fa('0x8c')]===0x1){return _0x460bbf['toString']();}return this['replaceAllVariables'](_0x460bbf);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x93')]=function(_0x5d67a8,_0x244987){var _0x70f9ac=this['channel'][_0xf0fa('0x12')](_0x5d67a8);if(_0x70f9ac[_0xf0fa('0x94')]===-0x1){return _0x70f9ac;}logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x95'),_0x244987,_0x70f9ac[_0xf0fa('0x96')]));return this[_0xf0fa('0x37')]['setVariable'](_0x244987,_0x70f9ac[_0xf0fa('0x96')]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x97')]=function(_0x33b25d){return _0x33b25d&&_0x33b25d!=='0'&&_0x33b25d!=='-1'&&_0x33b25d!=='';};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x98')]=function(_0x3cdfbb){this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x3cdfbb,'-');_0x3cdfbb[_0xf0fa('0x99')]=_0x3cdfbb[_0xf0fa('0x98')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x9a')]=function(_0x284e7d){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x9b'),_0x284e7d[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x284e7d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x4a8cda='\x22'+_0x284e7d['text']+'\x22';if(this[_0xf0fa('0x97')](_0x284e7d[_0xf0fa('0x73')])){_0x4a8cda+=','+_0x284e7d[_0xf0fa('0x73')];}var _0x15291c=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x9f'),_0x4a8cda);if(_0x15291c[_0xf0fa('0x94')]===-0x1){return _0x15291c;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xa0'),_0x4a8cda));};AGIVertices['prototype'][_0xf0fa('0xa1')]=function(_0x4c85b9){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4c85b9[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x4c85b9[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0xa1d2e2=_0x4c85b9['grammar'];if(this['isConfigured'](_0x4c85b9[_0xf0fa('0x73')])){_0xa1d2e2+=','+_0x4c85b9[_0xf0fa('0x73')];}var _0x2f2a97=this['channel'][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0xa1d2e2);if(_0x2f2a97[_0xf0fa('0x94')]===-0x1){return _0x2f2a97;}var _0x37685c=this[_0xf0fa('0x93')](_0xf0fa('0xa5'),_0xf0fa('0xa6'));if(_0x37685c[_0xf0fa('0x94')]===-0x1){return _0x37685c;}var _0x18fe3d=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xa7'));if(_0x18fe3d['result']===-0x1){return _0x18fe3d;}var _0x2906b4=this[_0xf0fa('0x93')](_0xf0fa('0xa8'),_0xf0fa('0xa9'));if(_0x2906b4[_0xf0fa('0x94')]===-0x1){return _0x2906b4;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa1d2e2));};AGIVertices['prototype'][_0xf0fa('0x8')]=function(_0x351a37){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xaa'),_0x351a37[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['agi']([_0x351a37[_0xf0fa('0xab')],_0x351a37[_0xf0fa('0xac')]]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xad')]=function(_0x3f068f){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3f068f[_0xf0fa('0x39')]));if(this[_0xf0fa('0x97')](_0x3f068f[_0xf0fa('0x64')])){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3f068f[_0xf0fa('0x64')]));var _0x5b40d9=this[_0xf0fa('0x37')][_0xf0fa('0xae')](_0x3f068f[_0xf0fa('0x64')]);if(_0x5b40d9['result']===-0x1){return _0x5b40d9;}}return this['channel'][_0xf0fa('0xad')]();};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xaf')]=function(_0x26ccd4){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xb0'),_0x26ccd4[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x26ccd4[_0xf0fa('0x49')])){return this[_0xf0fa('0x37')]['error'](_0x26ccd4,_0xf0fa('0xb1'));}_0x26ccd4['scheduledAt']=moment();if(this['isConfigured'](_0x26ccd4[_0xf0fa('0xb2')])){_0x26ccd4[_0xf0fa('0x4a')]=moment()['add'](_0x26ccd4[_0xf0fa('0xb2')],'minutes');}if(!this[_0xf0fa('0x97')](_0x26ccd4['callback_priority'])){_0x26ccd4['callback_priority']=0x2;}this[_0xf0fa('0x43')][_0xf0fa('0x6b')](this,_0x26ccd4);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb3'),_0x26ccd4['phone'],_0x26ccd4[_0xf0fa('0x49')],_0x26ccd4[_0xf0fa('0x4a')]));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xb4')]=function(_0x2abf2c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xb5'),_0x2abf2c['label']));var _0x32d4bf=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0x2abf2c[_0xf0fa('0xb6')],_0x2abf2c[_0xf0fa('0x73')]);if(_0x32d4bf[_0xf0fa('0x94')]===-0x1){return _0x32d4bf;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0x2abf2c[_0xf0fa('0xb6')],_0x2abf2c['options']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xb8')]=function(_0x31fd29){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xb9'),_0x31fd29[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x31fd29['text'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x5eb4a1='\x22'+_0x31fd29[_0xf0fa('0x5d')]+'\x22';if(this[_0xf0fa('0x97')](_0x31fd29[_0xf0fa('0x73')])){_0x5eb4a1+=','+_0x31fd29['options'];}var _0x3db914=this[_0xf0fa('0x37')][_0xf0fa('0x9e')]('MRCPSynth',_0x5eb4a1);if(_0x3db914[_0xf0fa('0x94')]===-0x1){return _0x3db914;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xa0'),_0x5eb4a1));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xba')]=function(_0x5252e1){logger['info'](util[_0xf0fa('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5252e1[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x5252e1[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x5b9e3f='\x22'+_0x5252e1[_0xf0fa('0x5d')]+'\x22';if(this['isConfigured'](_0x5252e1[_0xf0fa('0x73')])){_0x5b9e3f+=','+_0x5252e1[_0xf0fa('0x73')];}var _0xf185c0=this['channel']['exec']('MRCPSynth',_0x5b9e3f);if(_0xf185c0['result']===-0x1){return _0xf185c0;}return this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0xa0'),_0x5b9e3f));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xbb')]=function(_0x22fb88){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x22fb88[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x22fb88[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0x54e88d=_0x22fb88[_0xf0fa('0xa2')];if(this['isConfigured'](_0x22fb88[_0xf0fa('0x73')])){_0x54e88d+=','+_0x22fb88[_0xf0fa('0x73')];}var _0x2f236f=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0x54e88d);if(_0x2f236f[_0xf0fa('0x94')]===-0x1){return _0x2f236f;}var _0x52c1b4=this[_0xf0fa('0x93')](_0xf0fa('0xa5'),_0xf0fa('0xbc'));if(_0x52c1b4[_0xf0fa('0x94')]===-0x1){return _0x52c1b4;}var _0x124343=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xbd'));if(_0x124343[_0xf0fa('0x94')]===-0x1){return _0x124343;}var _0x22df0d=this[_0xf0fa('0x93')](_0xf0fa('0xa8'),_0xf0fa('0xbe'));if(_0x22df0d[_0xf0fa('0x94')]===-0x1){return _0x22df0d;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xbf'),_0x54e88d));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xc0')]=function(_0x44415c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x44415c[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x44415c[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0x218e30=_0x44415c[_0xf0fa('0xa2')];if(this[_0xf0fa('0x97')](_0x44415c[_0xf0fa('0x73')])){_0x218e30+=','+_0x44415c[_0xf0fa('0x73')];}var _0x4fb7e8=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0x218e30);if(_0x4fb7e8[_0xf0fa('0x94')]===-0x1){return _0x4fb7e8;}var _0x101424=this[_0xf0fa('0x93')]('RECOG_CONFIDENCE()',_0xf0fa('0xc1'));if(_0x101424[_0xf0fa('0x94')]===-0x1){return _0x101424;}var _0x1e8e9f=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xc2'));if(_0x1e8e9f[_0xf0fa('0x94')]===-0x1){return _0x1e8e9f;}var _0x19e118=this['getAndSetVariable'](_0xf0fa('0xa8'),_0xf0fa('0xc3'));if(_0x19e118[_0xf0fa('0x94')]===-0x1){return _0x19e118;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0xbf'),_0x218e30));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xc4')]=function(_0xd237e6){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0xc5'),_0xd237e6[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0xc6')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xd237e6,'no\x20database\x20selected');}var _0x2624ee=this['getSquareOdbc'][_0xf0fa('0x6b')](this,_0xd237e6[_0xf0fa('0xc6')]);if(!_0x2624ee){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xd237e6,_0xf0fa('0xc7'));}if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0x2d')])){return this['channel'][_0xf0fa('0x32')](_0xd237e6,_0xf0fa('0xc8'));}var _0x2fa4b5=_0xd237e6['query'][_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xf0fa('0xc9'),_0x2fa4b5));var _0x576bb3=this[_0xf0fa('0xca')][_0xf0fa('0x6b')](this,_0x2624ee,_0x2fa4b5);this['createSquareDetailsReport']['sync'](this,_0xd237e6,_0x2fa4b5);if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x9c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5ca895=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0xd237e6[_0xf0fa('0xcb')]);if(!_0x5ca895){return this[_0xf0fa('0x37')]['error'](_0xd237e6,'no\x20variable\x20found');}var _0x42d32e=this;_0x576bb3[_0xf0fa('0xcc')](function(_0x2fc1e6,_0x22b9b6){Object[_0xf0fa('0xcd')](_0x2fc1e6)['forEach'](function(_0x158f27){_0x42d32e[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0xcf'),_0x5ca895,_0x22b9b6,_0x158f27),_0x2fc1e6[_0x158f27]);});});this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('%s_ROWS_COUNT',_0x5ca895),_0x576bb3[_0xf0fa('0x8c')]);return this['channel']['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd0'),_0x5ca895));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xd1')]=function(_0x1282c5){logger[_0xf0fa('0xd2')](util['format'](_0xf0fa('0xd3'),_0x1282c5[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x1282c5[_0xf0fa('0xd4')])){return this[_0xf0fa('0x37')]['error'](_0x1282c5,_0xf0fa('0xd5'));}var _0x5c7a08=this[_0xf0fa('0x1d')]['sync'](this,_0x1282c5[_0xf0fa('0xd4')]);if(!_0x5c7a08){return this[_0xf0fa('0x37')]['error'](_0x1282c5,_0xf0fa('0xd6'));}var _0x44ab6e=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xd7'),[util['format'](_0xf0fa('0xd8'),_0x5c7a08),_0x1282c5[_0xf0fa('0x64')],_0x1282c5['opts'],_0x1282c5[_0xf0fa('0x6c')]]);if(_0x44ab6e[_0xf0fa('0x94')]===-0x1){return _0x44ab6e;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd9'),'DIAL'));};AGIVertices[_0xf0fa('0x11')]['dialogflow']=function(_0x1d8b98){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xda'),_0x1d8b98[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x1d8b98[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0xf0fa('0x97')](_0x1d8b98[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')]('no\x20text\x20configured');}this['channel'][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x1d8b98);this[_0xf0fa('0x42')](_0x1d8b98['text'],'in','','');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xdc'),_0x1d8b98[_0xf0fa('0x5d')]));var _0x5492dc=this['googleDialogflow'][_0xf0fa('0x6b')](this,_0x1d8b98);if(_0x5492dc){for(var _0x4db6c5 in _0x5492dc){if(_0x5492dc[_0xf0fa('0x8e')](_0x4db6c5)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('DIALOGFLOW_%s',_0x4db6c5[_0xf0fa('0xdd')]()),_0x5492dc[_0x4db6c5]);}}this['createSquareMessage'](_0x5492dc[_0xf0fa('0xde')],'out','dialogflow','');return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xdf'),_0x5492dc[_0xf0fa('0xde')]));}return this['channel'][_0xf0fa('0x32')](_0x1d8b98,_0xf0fa('0xe0'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xe1')]=function(_0x3743b7){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0xe2'),_0x3743b7[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x3743b7['dialogflowV2_project_id'])){return this['channel']['noop'](_0xf0fa('0xe3'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x77')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x3743b7[_0xf0fa('0xe4')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0xe5'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x78')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xe6'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x3743b7);this[_0xf0fa('0x42')](_0x3743b7[_0xf0fa('0x5d')],'in','','');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0xe7'),_0x3743b7['text']));var _0x4ee033=this['googleDialogflowV2']['sync'](this,_0x3743b7);if(_0x4ee033){for(var _0x2f6641 in _0x4ee033){if(_0x4ee033[_0xf0fa('0x8e')](_0x2f6641)){if(_0x2f6641!=='providerResponse'){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util['format'](_0xf0fa('0xe8'),_0x2f6641['toUpperCase']()),_0x4ee033[_0x2f6641]);}}}this[_0xf0fa('0x42')](_0x4ee033[_0xf0fa('0xde')],_0xf0fa('0xe9'),_0xf0fa('0xe1'),_0x4ee033['providerResponse']);return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xea'),_0x4ee033[_0xf0fa('0xde')]));}return this['channel'][_0xf0fa('0x32')](_0x3743b7,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xeb')]=function(_0x4238f0){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xec'),_0x4238f0['label']));if(!this[_0xf0fa('0x97')](_0x4238f0['ndauth_url'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xed'));}if(!this['isConfigured'](_0x4238f0[_0xf0fa('0xee')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xef'));}if(!this[_0xf0fa('0x97')](_0x4238f0[_0xf0fa('0xf0')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xf1'));}if(!this['isConfigured'](_0x4238f0[_0xf0fa('0xf2')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x4238f0);this[_0xf0fa('0x42')](_0x4238f0['text'],'in','','');this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0xf3'),_0x4238f0[_0xf0fa('0x5d')]));var _0x569138=this[_0xf0fa('0x79')]['sync'](this,_0x4238f0);if(_0x569138){for(var _0xc56274 in _0x569138){if(_0x569138[_0xf0fa('0x8e')](_0xc56274)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('SESTEK_NDA_%s',_0xc56274[_0xf0fa('0xdd')]()),_0x569138[_0xc56274]);}}this['createSquareMessage'](_0x569138[_0xf0fa('0xde')],_0xf0fa('0xe9'),_0xf0fa('0xeb'),'');if(_0x569138['audiofile']){this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xf4'),_0x569138[_0xf0fa('0xf5')]));var _0xb2d762=this['channel'][_0xf0fa('0xf6')](_0x569138['audiofile']);try{fs[_0xf0fa('0xf7')](_0x569138[_0xf0fa('0xf5')]+_0xf0fa('0xf8'));}catch(_0x2e7035){logger[_0xf0fa('0x32')](_0x2e7035);}return _0xb2d762;}else{return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xf9'),_0x569138[_0xf0fa('0xde')]));}}return this['channel']['error'](_0x4238f0,_0xf0fa('0xfa'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xfb')]=function(_0x1b7959){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xfc'),_0x1b7959[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0xfb'));};AGIVertices['prototype'][_0xf0fa('0xfd')]=function(_0x16ec49){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xfe'),_0x16ec49[_0xf0fa('0x39')]));var _0x575619='';if(_0x16ec49[_0xf0fa('0xff')]){if(!this['isConfigured'](_0x16ec49[_0xf0fa('0xff')])){return this[_0xf0fa('0x37')]['error'](_0x16ec49,_0xf0fa('0x100'));}else{var _0x2ceef7=parseInt(_0x16ec49[_0xf0fa('0xff')],0xa);if(isNaN(_0x2ceef7)){_0x575619=_0x16ec49[_0xf0fa('0xff')];}else{_0x575619=this[_0xf0fa('0x101')][_0xf0fa('0x6b')](this,_0x16ec49['trunk_id']);if(!_0x575619){return this[_0xf0fa('0x37')]['error'](_0x16ec49,_0xf0fa('0x102'));}}}}else if(_0x16ec49[_0xf0fa('0x103')]){_0x575619=_0x16ec49[_0xf0fa('0x103')];}else{return this['channel']['error'](_0x16ec49,'no\x20trunk\x20selected');}var _0x7fcb48=this['channel'][_0xf0fa('0x9e')]('DIAL',[util[_0xf0fa('0x2a')]('SIP/%s/%s',_0x575619,_0x16ec49[_0xf0fa('0x104')]),_0x16ec49[_0xf0fa('0x64')],_0x16ec49['opts'],_0x16ec49['url']]);if(_0x7fcb48[_0xf0fa('0x94')]===-0x1){return _0x7fcb48;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd9'),_0xf0fa('0xd7')));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x105')]=function(_0x3ca331){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x106'),_0x3ca331[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x105'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xe')]=function(_0x216e67){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x107'),_0x216e67[_0xf0fa('0x39')]));if(_0x216e67['retry']===0x0){return this[_0xf0fa('0x98')](_0x216e67);}_0x216e67['retry']-=0x1;if(!this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0x108')])){return this['channel'][_0xf0fa('0x32')](_0x216e67,_0xf0fa('0x109'));}var _0x18abdd=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x216e67['file_id']);if(!_0x18abdd){return this[_0xf0fa('0x37')]['error'](_0x216e67,_0xf0fa('0x10a'));}if(!this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0xf0fa('0x10b'));}var _0x4d3b6d=this['channel'][_0xf0fa('0x10c')](_0x18abdd,_0x216e67['response'],_0x216e67[_0xf0fa('0x10d')]);var _0x288164=_0x4d3b6d['result']?_0x4d3b6d[_0xf0fa('0x94')][_0xf0fa('0x4c')]():'';logger['info'](_0xf0fa('0x10e'),JSON['stringify'](_0x4d3b6d));if(_0x4d3b6d[_0xf0fa('0x94')]===-0x1){this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x216e67,_0x288164);return _0x4d3b6d;}else if(_0x4d3b6d[_0xf0fa('0x96')]===_0xf0fa('0x64')){_0x4d3b6d['result']=_0x288164[_0xf0fa('0x8c')]>=parseInt(_0x216e67['mindigit'])?'x':'i';}else{_0x4d3b6d['result']=_0x288164[_0xf0fa('0x8c')]>=parseInt(_0x216e67[_0xf0fa('0x10f')])&&_0x288164['length']<=parseInt(_0x216e67[_0xf0fa('0x10d')])?'x':'i';}var _0x45be27=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x216e67[_0xf0fa('0xcb')]);if(!_0x45be27){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x216e67,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x45be27,_0x288164);if(this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0x111')])){var _0x249c71=parseInt(_0x216e67[_0xf0fa('0x111')],0xa);var _0x55817b=rs['generate']({'charset':'*','length':_0x249c71});var _0x958d79=_0x288164[_0xf0fa('0x8c')];if(_0x958d79>0x0){if(_0x958d79>_0x249c71){this[_0xf0fa('0x36')]['sync'](this,_0x216e67,_0x216e67['hiddendigitspos']===_0xf0fa('0x112')?_0x55817b+_0x288164[_0xf0fa('0x113')](_0x249c71):_0x288164[_0xf0fa('0x113')](0x0,_0x958d79-_0x249c71)+_0x55817b);}else{this['createSquareDetailsReport']['sync'](this,_0x216e67,rs[_0xf0fa('0x114')]({'charset':'*','length':_0x958d79}));}}else{this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x216e67,'');}}else{this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x216e67,_0x288164);}return _0x4d3b6d;};AGIVertices['prototype'][_0xf0fa('0x115')]=function(_0x4a5c05){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4a5c05[_0xf0fa('0x39')]));return this[_0xf0fa('0xe')](_0x4a5c05);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x116')]=function(_0x530431){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x117'),_0x530431[_0xf0fa('0x39')]));this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x530431,_0x530431[_0xf0fa('0x118')]);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x119'),_0x530431['goalname']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x11a')]=function(_0x31b02c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x11b'),_0x31b02c[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x31b02c[_0xf0fa('0x81')])||!this[_0xf0fa('0x97')](_0x31b02c[_0xf0fa('0x7f')])){return this['channel'][_0xf0fa('0x9c')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x31b02c[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x31b02c['text']));var _0x10182b=this[_0xf0fa('0x7e')]['sync'](this,_0x31b02c);if(_0x10182b){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x11c'),_0x10182b));var _0x37e3c9=this['channel'][_0xf0fa('0xf6')](_0x10182b);try{fs['unlink'](_0x10182b+'.wav');}catch(_0x47aa5b){logger[_0xf0fa('0x32')](_0x47aa5b);}return _0x37e3c9;}return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x31b02c,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')]['awslex']=function(_0x160c3d){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x11d'),_0x160c3d[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x160c3d[_0xf0fa('0x81')])||!this[_0xf0fa('0x97')](_0x160c3d[_0xf0fa('0x7f')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x11e'));}if(!this[_0xf0fa('0x97')](_0x160c3d[_0xf0fa('0x11f')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x120'));}if(!this['isConfigured'](_0x160c3d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x160c3d);this[_0xf0fa('0x42')](_0x160c3d[_0xf0fa('0x5d')],'in','','');this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0x121'),_0x160c3d[_0xf0fa('0x5d')]));var _0x13d202=this[_0xf0fa('0x122')][_0xf0fa('0x6b')](this,_0x160c3d);if(_0x13d202){for(var _0x960a4c in _0x13d202){if(_0x13d202[_0xf0fa('0x8e')](_0x960a4c)&&_['isString'](_0x13d202[_0x960a4c])){this['channel'][_0xf0fa('0xce')](util['format'](_0xf0fa('0x123'),_0x960a4c[_0xf0fa('0xdd')]()),_0x13d202[_0x960a4c]);}}if(_[_0xf0fa('0x44')](_0x13d202['message'])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x124'));}else{this[_0xf0fa('0x42')](_0x13d202['message'],'out',_0xf0fa('0x125'),'');return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0x13d202['message']));}}return this['channel'][_0xf0fa('0x32')](_0x160c3d,_0xf0fa('0x126'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x127')]=function(_0x33aceb){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x128'),_0x33aceb[_0xf0fa('0x39')],_0x33aceb[_0xf0fa('0x64')]));if(!this[_0xf0fa('0x97')](_0x33aceb[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')]['noop']('no\x20key\x20configured');}var _0x52e00b=_0xf0fa('0x129');var _0x90a29e=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x119673=util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x90a29e,_0x52e00b);var _0x246e04=!![];if(_0x33aceb['beep']===_0xf0fa('0x12a')){_0x246e04=![];}var _0x5e5999=this[_0xf0fa('0x37')][_0xf0fa('0x12b')](_0x90a29e,_0x52e00b,_0x33aceb[_0xf0fa('0x12c')],_0x33aceb[_0xf0fa('0x64')],undefined,_0x246e04);if(_0x5e5999[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x12d'),_0x119673));var _0x815bcd=this[_0xf0fa('0x83')]['sync'](this,_0x33aceb,_0x119673);if(_0x815bcd){for(var _0x3b52dc in _0x815bcd){if(_0x815bcd[_0xf0fa('0x8e')](_0x3b52dc)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0x12e'),_0x3b52dc[_0xf0fa('0xdd')]()),_0x815bcd[_0x3b52dc]);}}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x12f'),JSON[_0xf0fa('0x6e')](_0x815bcd)));}}return _0x5e5999;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x130')]=function(_0x2513f7){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x131'),_0x2513f7['label']));if(!this[_0xf0fa('0x97')](_0x2513f7[_0xf0fa('0x85')])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0xf0fa('0x97')](_0x2513f7[_0xf0fa('0x86')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20appsecret\x20configured');}var _0x3f1558=_0xf0fa('0x129');var _0xe1fe69=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x5c2ff7=util[_0xf0fa('0x2a')]('%s.%s',_0xe1fe69,_0x3f1558);var _0x339a29=!![];if(_0x2513f7[_0xf0fa('0x132')]==='NOBEEP'){_0x339a29=![];}var _0x54abd0=this['channel'][_0xf0fa('0x12b')](_0xe1fe69,_0x3f1558,_0x2513f7['intKey'],_0x2513f7['timeout'],undefined,_0x339a29);if(_0x54abd0[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format']('tilde\x20%s\x20file\x20created',_0x5c2ff7));var _0xdc47ae=this[_0xf0fa('0x84')][_0xf0fa('0x6b')](this,_0x2513f7,_0x5c2ff7);if(_0xdc47ae){for(var _0x22b099 in _0xdc47ae){if(_0xdc47ae[_0xf0fa('0x8e')](_0x22b099)){this[_0xf0fa('0x37')]['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x133'),_0x22b099[_0xf0fa('0xdd')]()),_0xdc47ae[_0x22b099]);}}return this['channel']['noop'](util[_0xf0fa('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0xf0fa('0x6e')](_0xdc47ae)));}}return _0x54abd0;};AGIVertices['prototype']['gotoc']=function(_0x401c07){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x401c07[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['continueAt'](_0x401c07[_0xf0fa('0x3e')],_0x401c07[_0xf0fa('0x3f')],_0x401c07[_0xf0fa('0x40')]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x134')]=function(_0x146b57){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x146b57[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x146b57[_0xf0fa('0x135')])){return this[_0xf0fa('0x37')]['error'](_0x146b57,_0xf0fa('0x136'));}try{var _0x261a22=eval(_0x146b57[_0xf0fa('0x135')])?_0xf0fa('0x137'):_0xf0fa('0x138');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x146b57[_0xf0fa('0x135')],_0x261a22));return{'code':0xc8,'result':_0x261a22};}catch(_0xd24cac){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x139')]=function(_0x5a6af3){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a6af3[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x5a6af3[_0xf0fa('0x13a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x5a6af3,_0xf0fa('0x13b'));}var _0x338f3f=this[_0xf0fa('0x25')]['sync'](this,_0x5a6af3[_0xf0fa('0x13a')]);if(!_0x338f3f){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x5a6af3,_0xf0fa('0x13c'));}for(var _0x36570f=0x0;_0x36570f<_0x338f3f[_0xf0fa('0x8c')];_0x36570f+=0x1){var _0x356efb=this[_0xf0fa('0x37')]['getVariable'](util['format'](_0xf0fa('0x13d'),_0x338f3f[_0x36570f]));if(_0x356efb['result']===-0x1){return _0x356efb;}logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0x356efb['extra']));if(_0x356efb[_0xf0fa('0x96')]===_0xf0fa('0x137')){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x137')));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x137')));return{'code':0xc8,'result':_0xf0fa('0x137')};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x138')));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format']('IFTIME\x20%s\x20%s',_0x338f3f[_0x36570f],_0xf0fa('0x138')));}}return{'code':0xc8,'result':_0xf0fa('0x138')};};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x13f')]=function(_0x1c15a2){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1c15a2['label']));return this[_0xf0fa('0x37')]['hangup']();};AGIVertices['prototype'][_0xf0fa('0x140')]=function(_0x57ef8f){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x141'),_0x57ef8f[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x57ef8f[_0xf0fa('0x75')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x142'));}var _0x5932e5='wav';var _0x1b796a=util[_0xf0fa('0x2a')](_0xf0fa('0x143'),FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x43ccb7=util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x1b796a,_0x5932e5);var _0x138c3f=!![];if(_0x57ef8f['beep']==='NOBEEP'){_0x138c3f=![];}var _0x11e8d7=this[_0xf0fa('0x37')]['recordFile'](_0x1b796a,_0x5932e5,_0x57ef8f['intKey'],_0x57ef8f[_0xf0fa('0x64')],undefined,_0x138c3f);if(_0x11e8d7[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x144'),_0x43ccb7));var _0x226732=this['ispeechASR'][_0xf0fa('0x6b')](this,_0x57ef8f,_0x43ccb7);if(_0x226732){for(var _0x243ab8 in _0x226732){if(_0x226732[_0xf0fa('0x8e')](_0x243ab8)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('ISPEECH_ASR_%s',_0x243ab8['toUpperCase']()),_0x226732[_0x243ab8]);}}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x145'),JSON[_0xf0fa('0x6e')](_0x226732)));}}return _0x11e8d7;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x146')]=function(_0x76f5e1){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x76f5e1['label']));if(!this[_0xf0fa('0x97')](_0x76f5e1[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x142'));}if(!this[_0xf0fa('0x97')](_0x76f5e1[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x147'),_0x76f5e1[_0xf0fa('0x5d')]));var _0x32e875=this['ispeechTTS'][_0xf0fa('0x6b')](this,_0x76f5e1);if(_0x32e875){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x144'),_0x32e875));var _0x1a74f9=this[_0xf0fa('0x37')]['streamFile'](_0x32e875,_0x76f5e1['intKey']);try{fs[_0xf0fa('0xf7')](_0x32e875+_0xf0fa('0xf8'));}catch(_0x2b7dcd){logger['error'](_0x2b7dcd);}return _0x1a74f9;}return this[_0xf0fa('0x37')]['error'](_0x76f5e1,_0xf0fa('0x148'));};AGIVertices['prototype'][_0xf0fa('0x149')]=function(_0x200031){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x200031[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x200031[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x200031,'no\x20find\x20by\x20configured');}logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x200031[_0xf0fa('0x14a')]));var _0x2bcc7b=this[_0xf0fa('0x57')][_0xf0fa('0x6b')](this,_0x200031[_0xf0fa('0x14a')]);if(_0x2bcc7b){logger['info'](util['format'](_0xf0fa('0x14b'),this[_0xf0fa('0x37')]['callerid'],_0x200031[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf0fa('0x37')]['callerid'],_0x200031[_0xf0fa('0x14a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this['channel'][_0xf0fa('0x3b')],_0x200031['findBy']));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x200031[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices['prototype'][_0xf0fa('0x14e')]=function(_0x3e3672){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14f'),_0x3e3672['label']));if(!this[_0xf0fa('0x97')](_0x3e3672[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x3e3672,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x150'),this[_0xf0fa('0x37')]['callerid'],_0x3e3672[_0xf0fa('0x14a')]));var _0x57878a=this['agentLogout'][_0xf0fa('0x6b')](this,_0x3e3672[_0xf0fa('0x14a')]);if(_0x57878a){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e3672[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0x3e3672[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this[_0xf0fa('0x37')]['callerid'],_0x3e3672['findBy']));this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x14c'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e3672['findBy']));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices['prototype'][_0xf0fa('0x152')]=function(_0x22feda){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x153'),_0x22feda[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x22feda[_0xf0fa('0x154')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x22feda,_0xf0fa('0x155'));}this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')]('math\x20%s',_0x22feda[_0xf0fa('0x154')]));var _0x274673=eval(_0x22feda[_0xf0fa('0x154')]);if(!this[_0xf0fa('0x97')](_0x22feda[_0xf0fa('0xcb')])){return this['channel']['noop'](_0xf0fa('0x10b'));}var _0x4aea20=this['getVariable'][_0xf0fa('0x6b')](this,_0x22feda[_0xf0fa('0xcb')]);if(!_0x4aea20){return this['channel']['error'](_0x22feda,_0xf0fa('0x110'));}if(_[_0xf0fa('0x8b')](_0x274673)){var _0x504b00=this;_0x274673[_0xf0fa('0xcc')](function(_0x500216,_0x12ebc3){_0x504b00['channel']['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x156'),_0x4aea20,_0x12ebc3),_0x500216);});return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x157'),_0x4aea20));}else{return this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x4aea20,_0x274673);}};AGIVertices['prototype'][_0xf0fa('0xd')]=function(_0x593c76){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x158'),_0x593c76['label']));if(_0x593c76['retry']===0x0){return this[_0xf0fa('0x98')](_0x593c76);}_0x593c76[_0xf0fa('0x99')]-=0x1;if(!this['isConfigured'](_0x593c76[_0xf0fa('0x108')])){return this[_0xf0fa('0x37')]['error'](_0x593c76,_0xf0fa('0x109'));}var _0x22291e=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x593c76[_0xf0fa('0x108')]);if(!_0x22291e){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x593c76,'no\x20file\x20audio\x20found');}var _0x3894d0=this['channel']['getData'](_0x22291e,_0x593c76[_0xf0fa('0x159')],_0x593c76[_0xf0fa('0x15a')]);var _0x558c37=_0x3894d0[_0xf0fa('0x94')];if(_0x3894d0['result']===-0x1){this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x593c76,'-1');return _0x3894d0;}else if(_0x3894d0[_0xf0fa('0x96')]===_0xf0fa('0x64')){_0x3894d0[_0xf0fa('0x94')]=_0x3894d0[_0xf0fa('0x94')][_0xf0fa('0x8c')]>0x0?_0x3894d0[_0xf0fa('0x94')]:'t';}else if(_['isEmpty'](_0x3894d0[_0xf0fa('0x94')])){_0x3894d0['result']='#';_0x558c37='#';}if(!this['isConfigured'](_0x593c76[_0xf0fa('0xcb')])){this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x10b'));}else{var _0x5abd1d=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x593c76[_0xf0fa('0xcb')]);if(!_0x5abd1d){return this[_0xf0fa('0x37')]['error'](_0x593c76,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x5abd1d,_0x558c37);}this[_0xf0fa('0x36')]['sync'](this,_0x593c76,_0x558c37);return _0x3894d0;};AGIVertices['prototype'][_0xf0fa('0x9c')]=function(_0x131bca){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x15b'),_0x131bca[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0x131bca[_0xf0fa('0x15c')]||_0x131bca[_0xf0fa('0x39')]);};AGIVertices[_0xf0fa('0x11')]['pause']=function(_0xdbe933){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x15d'),_0xdbe933[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0xdbe933[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xdbe933,_0xf0fa('0x15e'));}logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x150'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933['findBy']));var _0x5e3d16=this['getPause'][_0xf0fa('0x6b')](this,_0xdbe933['pause_id']);var _0x484d41=this['agentPause'][_0xf0fa('0x6b')](this,_0xdbe933[_0xf0fa('0x14a')],_0x5e3d16);if(_0x484d41){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')]['callerid'],_0xdbe933[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x15f')]=function(_0x40358b){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x40358b[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x40358b['file_id'])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x40358b,_0xf0fa('0x109'));}var _0x5dcf18=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x40358b[_0xf0fa('0x108')]);if(!_0x5dcf18){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x40358b,_0xf0fa('0x10a'));}var _0x3b915d=this['channel'][_0xf0fa('0x9e')]('PLAYBACK',[_0x5dcf18,_0x40358b[_0xf0fa('0x160')]]);if(_0x3b915d[_0xf0fa('0x94')]===-0x1){return _0x3b915d;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x161'),_0x5dcf18));};AGIVertices['prototype'][_0xf0fa('0x162')]=function(_0x16e247){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x163'),_0x16e247['label']));if(!this['isConfigured'](_0x16e247['queue_id'])){return this['channel'][_0xf0fa('0x32')](_0x16e247,_0xf0fa('0x164'));}var _0x3154f9='';var _0x181170=parseInt(_0x16e247[_0xf0fa('0x165')],0xa);if(isNaN(_0x181170)){_0x3154f9=_0x16e247[_0xf0fa('0x165')];}else{_0x3154f9=this['getVoiceQueue'][_0xf0fa('0x6b')](this,_0x16e247[_0xf0fa('0x165')]);if(!_0x3154f9){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x16e247,_0xf0fa('0x166'));}}var _0x5440e1='';if(this[_0xf0fa('0x97')](_0x16e247[_0xf0fa('0x108')])){var _0x5077f9=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x16e247[_0xf0fa('0x108')]);if(_0x5077f9){_0x5440e1=_0x5077f9;}}this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x16e247,_0x3154f9);if(_0x16e247[_0xf0fa('0x160')][_0xf0fa('0x167')]('x')<0x0){_0x16e247[_0xf0fa('0x160')]+='x';}if(_0x16e247['opts']['indexOf']('X')<0x0){_0x16e247[_0xf0fa('0x160')]+='X';}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0xf0fa('0x168'),_0x3154f9?_0x3154f9[_0xf0fa('0x169')]():'');var _0x1ae1c0=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x16a'),[_0x3154f9,_0x16e247[_0xf0fa('0x160')],_0x16e247[_0xf0fa('0x6c')],_0x5440e1,_0x16e247[_0xf0fa('0x64')],_0x16e247[_0xf0fa('0x8')],_0x16e247[_0xf0fa('0x16b')],_0x16e247['gosub'],'',_0x16e247['position']]);if(_0x1ae1c0['result']===-0x1){return _0x1ae1c0;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x3154f9));};AGIVertices['prototype'][_0xf0fa('0x16c')]=function(_0xea4c58){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x16d'),_0xea4c58['label']));var _0x2bdbaa=_0xea4c58[_0xf0fa('0x16e')]||_0xf0fa('0x129');var _0x1038fe=util['format'](_0xf0fa('0x16f'),this['channel'][_0xf0fa('0x38')],rs[_0xf0fa('0x114')](0x5));var _0x32ffd9=util[_0xf0fa('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x1038fe,_0x2bdbaa);var _0xf71b7f=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,_0x1038fe);this[_0xf0fa('0x3c')][_0xf0fa('0x6b')](this,_0xea4c58,_0x1038fe,_0x32ffd9);this[_0xf0fa('0x37')]['setVariable'](_0xf0fa('0x170'),_0x1038fe);logger['info'](_0xf0fa('0x171'),_0xf71b7f,_0x2bdbaa,_0xea4c58[_0xf0fa('0x172')],_0xea4c58[_0xf0fa('0x64')]);return this[_0xf0fa('0x37')][_0xf0fa('0x12b')](_0xf71b7f,_0x2bdbaa,_0xea4c58['escape_digits'],_0xea4c58[_0xf0fa('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xf0fa('0x173')]=function(_0x39f3f9){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x174'),_0x39f3f9[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x39f3f9[_0xf0fa('0x6c')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x175'));}var _0x481815=this[_0xf0fa('0x62')][_0xf0fa('0x6b')](this,_0x39f3f9);logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x176'),util[_0xf0fa('0x177')](_0x481815,{'showHidden':![],'depth':null})));if(!this[_0xf0fa('0x97')](_0x39f3f9[_0xf0fa('0xcb')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x178'));}var _0x11f1ad=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x39f3f9['variable_id']);if(!_0x11f1ad){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x39f3f9,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0x179'),_0x11f1ad),_0x481815[_0xf0fa('0x70')]?_0x481815[_0xf0fa('0x70')]:_0xf0fa('0x17a'));this[_0xf0fa('0x37')]['setVariable'](util['format'](_0xf0fa('0x17b'),_0x11f1ad),_0x481815[_0xf0fa('0x71')]?_0x481815[_0xf0fa('0x71')]:'OK');if(_0x481815['body']){try{this[_0xf0fa('0x8f')](_0x481815[_0xf0fa('0x67')],_0x11f1ad);}catch(_0xb04cc4){logger[_0xf0fa('0x32')](util[_0xf0fa('0x2a')](_0xf0fa('0x17c'),_0x11f1ad));}}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('variable\x20%s\x20set',_0x11f1ad));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x17d')]=function(_0x57f957){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x17e'),_0x57f957['label']));return this['channel'][_0xf0fa('0x17f')](_0x57f957[_0xf0fa('0x180')][_0xf0fa('0x5a')](/\s+/g,''),_0x57f957['escape_digits']);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x181')]=function(_0x105f5e){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x182'),_0x105f5e[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')][_0xf0fa('0x183')](_0x105f5e[_0xf0fa('0x184')][_0xf0fa('0x5a')](/\s+/g,''),_0x105f5e[_0xf0fa('0x172')]);};AGIVertices['prototype'][_0xf0fa('0x185')]=function(_0x39ab19){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x186'),_0x39ab19[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['sayPhonetic'](_0x39ab19[_0xf0fa('0x5d')],_0x39ab19['escape_digits']);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x187')]=function(_0x2f8259){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2f8259[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x2f8259['account_id'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x188'));}var _0x4df27e=this[_0xf0fa('0x189')][_0xf0fa('0x6b')](this,_0x2f8259[_0xf0fa('0x18a')]);if(!_0x4df27e||!_0x4df27e[_0xf0fa('0x18b')]){return this['channel'][_0xf0fa('0x32')](_0x2f8259,_0xf0fa('0x18c'));}var _0x55c261={'from':util[_0xf0fa('0x2a')](_0xf0fa('0x18d'),_0x4df27e[_0xf0fa('0x17')],_0x4df27e[_0xf0fa('0x18e')]||_0x4df27e['Smtp'][_0xf0fa('0x18f')]),'to':_0x2f8259['to']||'','cc':_0x2f8259['cc']||'','bcc':_0x2f8259[_0xf0fa('0x190')]||'','subject':_0x2f8259['subject'],'html':_0x2f8259[_0xf0fa('0x5d')],'text':_0x2f8259[_0xf0fa('0x5d')]};if(this[_0xf0fa('0x97')](_0x2f8259[_0xf0fa('0x191')])){}logger['debug'](_0xf0fa('0x192'),JSON[_0xf0fa('0x6e')](_0x55c261));this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x2f8259,_0x2f8259[_0xf0fa('0x18a')]);this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x193'),_0x4df27e[_0xf0fa('0x17')]));this[_0xf0fa('0x24')][_0xf0fa('0x6b')](this,_0x4df27e[_0xf0fa('0x194')],_0x55c261);return this['channel']['noop'](_0xf0fa('0x195'));};AGIVertices['prototype']['sendFax']=function(_0xf6880b){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xf6880b[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x196'));};AGIVertices['prototype'][_0xf0fa('0x197')]=function(_0x4d71d4){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x198'),_0x4d71d4[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x4d71d4[_0xf0fa('0x199')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20sms\x20account\x20configured');}var _0x15abb=this['getSmsAccount']['sync'](this,_0x4d71d4[_0xf0fa('0x199')]);if(!_0x15abb){return this['channel']['error'](_0x4d71d4,_0xf0fa('0x19a'));}var _0x487f92={'body':_0x4d71d4[_0xf0fa('0x19b')],'phone':_0x4d71d4['to']||'','SmsAccountId':_0x15abb['id']};logger[_0xf0fa('0xd2')](_0xf0fa('0x19c'),JSON[_0xf0fa('0x6e')](_0x487f92));this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x4d71d4,_0x4d71d4['sms_account_id']);this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x19d'),_0x15abb[_0xf0fa('0x17')]));this[_0xf0fa('0x35')][_0xf0fa('0x6b')](this,_0x487f92);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xf0fa('0x11')]['set']=function(_0x1ee0f3){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x19e'),_0x1ee0f3[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x1ee0f3[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0x1ee0f3,_0xf0fa('0x19f'));}var _0x573897=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x1ee0f3['variable_id']);if(!_0x573897){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x1ee0f3,_0xf0fa('0x110'));}return this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x573897,_0x1ee0f3[_0xf0fa('0x1a0')]);};AGIVertices[_0xf0fa('0x11')]['start']=function(_0x2d711a){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x1a1'),_0x2d711a['label']));this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x1a2'));var _0x5e0522=this[_0xf0fa('0x37')]['getVariable']('XMCS-UNIQUEID');if(!_[_0xf0fa('0x47')](_0x5e0522[_0xf0fa('0x96')])){this[_0xf0fa('0x37')][_0xf0fa('0x38')]=_0x5e0522['extra'];}if(_0x2d711a[_0xf0fa('0xad')]===_0xf0fa('0x1a3')){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x1a4'));return this[_0xf0fa('0x37')][_0xf0fa('0xad')]();}return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x1a5'));};AGIVertices[_0xf0fa('0x11')]['subproject']=function(_0x211edb){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1a6'),_0x211edb[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x211edb['project_id'])){return this[_0xf0fa('0x37')]['error'](_0x211edb,_0xf0fa('0x1a7'));}var _0x4994ec=this[_0xf0fa('0x18')]['sync'](this,_0x211edb[_0xf0fa('0x1a8')]);if(!this['isConfigured'](_0x4994ec)){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x211edb,util[_0xf0fa('0x2a')](_0xf0fa('0x1a9'),_0x211edb['project_id']));}if(_0x4994ec===this[_0xf0fa('0x37')][_0xf0fa('0x3a')]){return this['channel'][_0xf0fa('0x32')](_0x211edb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x211edb,_0x4994ec);var _0xd45105=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x1aa'),util['format'](_0xf0fa('0x1ab'),config['agi'][_0xf0fa('0x1ac')]||_0xf0fa('0x1ad'),_0x4994ec,this[_0xf0fa('0x37')][_0xf0fa('0x3a')]));if(_0xd45105[_0xf0fa('0x94')]===-0x1){return _0xd45105;}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x1aa'),_0x4994ec));};AGIVertices[_0xf0fa('0x11')]['system']=function(_0x2cc938){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x1ae'),_0x2cc938[_0xf0fa('0x39')]));var _0x20342a=this[_0xf0fa('0x58')][_0xf0fa('0x6b')](this,_0x2cc938[_0xf0fa('0xab')]);this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x2cc938,_0x2cc938[_0xf0fa('0xab')]);if(this['isConfigured'](_0x2cc938[_0xf0fa('0xcb')])){var _0x6ef653=this['getVariable'][_0xf0fa('0x6b')](this,_0x2cc938[_0xf0fa('0xcb')]);if(_0x6ef653){this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x6ef653,_0x20342a);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x1af'),_0x2cc938['command'],_0x6ef653));}}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0x1b0'),_0x2cc938[_0xf0fa('0xab')]));};AGIVertices['prototype'][_0xf0fa('0x1b1')]=function(_0x3c5b1b){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1b2'),_0x3c5b1b['label']));_0x3c5b1b[_0xf0fa('0x5d')]=_0x3c5b1b['text'][_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf0fa('0x97')](_0x3c5b1b[_0xf0fa('0x1b3')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x1b4'));}if(!this[_0xf0fa('0x97')](_0x3c5b1b[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x1b5'),_0x3c5b1b['text']));var _0x1db7af=this[_0xf0fa('0x5b')][_0xf0fa('0x6b')](this,_0x3c5b1b);if(_0x1db7af){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x1b6'),_0x1db7af));var _0x45eb9f=this[_0xf0fa('0x37')][_0xf0fa('0xf6')](_0x1db7af);try{fs[_0xf0fa('0xf7')](_0x1db7af+'.wav');}catch(_0x1941bc){logger[_0xf0fa('0x32')](_0x1941bc);}return _0x45eb9f;}return this['channel'][_0xf0fa('0x32')](_0x3c5b1b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1b7')]=function(_0x307f5d){logger['info'](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x307f5d[_0xf0fa('0x39')]));_0x307f5d['text']=_0x307f5d[_0xf0fa('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x307f5d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x307f5d[_0xf0fa('0x5d')]));var _0x1c02e3=this[_0xf0fa('0x1b8')]['sync'](this,_0x307f5d);if(_0x1c02e3){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x1b9'),_0x1c02e3));var _0x223ef2=this[_0xf0fa('0x37')][_0xf0fa('0xf6')](_0x1c02e3);try{fs['unlink'](_0x1c02e3+'.wav');}catch(_0x192bb0){logger[_0xf0fa('0x32')](_0x192bb0);}return _0x223ef2;}return this[_0xf0fa('0x37')]['error'](_0x307f5d,_0xf0fa('0x1ba'));};AGIVertices[_0xf0fa('0x11')]['unpause']=function(_0x3e97d5){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1bb'),_0x3e97d5['label']));if(!this[_0xf0fa('0x97')](_0x3e97d5[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x3e97d5,_0xf0fa('0x15e'));}logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x150'),this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));var _0xd6fa55=this[_0xf0fa('0x52')][_0xf0fa('0x6b')](this,_0x3e97d5[_0xf0fa('0x14a')]);if(_0xd6fa55){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger['info'](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e97d5['findBy']));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1bc')]=function(_0x10a7fc){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x1bd'),_0x10a7fc['label']));var _0x523177=this['channel'][_0xf0fa('0x9e')](_0xf0fa('0x1be'),[_0x10a7fc[_0xf0fa('0x1bf')],_0x10a7fc['options']]);if(_0x523177[_0xf0fa('0x94')]===-0x1){return _0x523177;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x1be'),_0x10a7fc['mailbox']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1c0')]=function(_0x4973d7){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1c1'),_0x4973d7[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x4973d7[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0x4973d7,_0xf0fa('0x19f'));}var _0x484fe2=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x4973d7[_0xf0fa('0xcb')]);if(!_0x484fe2){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x4973d7,_0xf0fa('0x110'));}var _0x207003=this[_0xf0fa('0x37')][_0xf0fa('0x12')](_0x484fe2);return{'code':0xc8,'result':_0x207003[_0xf0fa('0x96')]?_0x207003['extra']:'-'};};String[_0xf0fa('0x11')][_0xf0fa('0x92')]=function(_0x225e1e,_0x40a915){return this[_0xf0fa('0x91')](_0x225e1e)[_0xf0fa('0x1c2')](_0x40a915);};module[_0xf0fa('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ff5a5ec..96bf321 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 _0x7d66=['milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','mandatoryDispositionPause','name','Action','then','agents','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','acw','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview'];(function(_0x3ede5e,_0x2634de){var _0x317ddf=function(_0xa4cdb4){while(--_0xa4cdb4){_0x3ede5e['push'](_0x3ede5e['shift']());}};_0x317ddf(++_0x2634de);}(_0x7d66,0xe6));var _0x67d6=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x7d66[_0x1ebeea];return _0x576465;};'use strict';var _=require(_0x67d6('0x0'));var moment=require('moment');var ami=require(_0x67d6('0x1'));var logger=require('../../../config/logger')(_0x67d6('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x67d6('0x3'));function Acw(_0x35f166){this[_0x67d6('0x4')]=_0x35f166['voiceQueues'];this['agents']=_0x35f166['agents'];this[_0x67d6('0x5')]=_0x35f166[_0x67d6('0x5')];this[_0x67d6('0x6')]={};ami['on']('agentconnect',this[_0x67d6('0x7')]['bind'](this));ami['on']('hanguprequest',this[_0x67d6('0x8')][_0x67d6('0x9')](this));ami['on'](_0x67d6('0xa'),this['syncHangup'][_0x67d6('0x9')](this));ami['on']('agentringnoanswer',this[_0x67d6('0xb')][_0x67d6('0x9')](this));ami['on']('attendedtransfer',this[_0x67d6('0xc')]['bind'](this));ami['on'](_0x67d6('0xd'),this[_0x67d6('0xe')][_0x67d6('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x67d6('0xf')][_0x67d6('0x9')](this));}function getDiff(_0x1c6209){var _0x2e82dd=moment()[_0x67d6('0x10')](0x0);var _0x374361=moment(_0x1c6209)[_0x67d6('0x10')](0x0);return _0x2e82dd[_0x67d6('0x11')](_0x374361,_0x67d6('0x12'));}Acw[_0x67d6('0x13')][_0x67d6('0x14')]=function(_0x2c07e0,_0x55b68d){var _0x25effe=this;var _0x30a5a0=getDiff(_0x25effe[_0x67d6('0x5')][_0x2c07e0][_0x67d6('0x15')]);clearTimeout(_0x25effe[_0x67d6('0x5')][_0x2c07e0]['timer']);_0x25effe[_0x67d6('0x5')][_0x2c07e0][_0x67d6('0x16')]=![];return RpcVoiceAgentReport[_0x67d6('0x17')]({'acwtime':_0x30a5a0},_0x25effe['timers'][_0x2c07e0][_0x67d6('0x18')],_0x2c07e0)['then'](function(_0x269388){logger[_0x67d6('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x55b68d,_0x30a5a0,_0x269388);})[_0x67d6('0x1a')](function(_0xd3d1ca){logger[_0x67d6('0x1b')](_0x67d6('0x1c'),_0x55b68d,_0xd3d1ca);})[_0x67d6('0x1d')](function(){delete _0x25effe['timers'][_0x2c07e0];});};Acw[_0x67d6('0x13')][_0x67d6('0x1e')]=function(_0x44a963){try{var _0xf0f3fb=this;var _0x30c237=this[_0x67d6('0x6')][_0x44a963][_0x67d6('0x1f')];var _0x4e6b1d=this[_0x67d6('0x6')][_0x44a963]['queue'];var _0x51eefa=this[_0x67d6('0x4')][_0x4e6b1d];var _0x5e8819=![];var _0x5eea6a=_0x67d6('0x20');if(_0x51eefa['mandatoryDisposition']&&_0x51eefa[_0x67d6('0x21')][_0x67d6('0x22')]){_0x5e8819=!![];_0x5eea6a=_0x51eefa[_0x67d6('0x21')][_0x67d6('0x22')];}return ami[_0x67d6('0x23')]({'action':'QueuePause','interface':_0x30c237,'paused':!![],'reason':_0x5eea6a})[_0x67d6('0x24')](function(){if(_0xf0f3fb[_0x67d6('0x25')][_0x30c237]){return RpcUser[_0x67d6('0x26')](_0xf0f3fb[_0x67d6('0x25')][_0x30c237]['id'])['then'](function(_0x403ab3){if(!_0x403ab3||_0x403ab3['voicePause']){logger['info'](_0x67d6('0x27'),_0x44a963,_0x30c237,_0x4e6b1d);return;}logger['info'](_0x67d6('0x28'),_0x44a963,_0x30c237,_0x4e6b1d);var _0x1b7c88=_0xf0f3fb[_0x67d6('0x6')][_0x44a963][_0x67d6('0x29')]&&_0xf0f3fb['channels'][_0x44a963][_0x67d6('0x2a')]?_0xf0f3fb[_0x67d6('0x6')][_0x44a963][_0x67d6('0x2a')]:_0x44a963;return RpcUser[_0x67d6('0x2b')](_0xf0f3fb[_0x67d6('0x25')][_0x30c237],_0x5eea6a,_0x1b7c88)[_0x67d6('0x24')](function(_0x46ddd3){_0xf0f3fb['voiceQueues'][_0x4e6b1d][_0x67d6('0x2c')]-=0x1;_0xf0f3fb['voiceQueues'][_0x4e6b1d]['paused']+=0x1;return _0x46ddd3;});})[_0x67d6('0x24')](function(_0x3bdf32){if(_0x5e8819||!_0x3bdf32){return;}_0xf0f3fb[_0x67d6('0x5')][_0x30c237]={};logger[_0x67d6('0x19')](_0x67d6('0x2d'),_0x44a963,_0xf0f3fb[_0x67d6('0x4')][_0x4e6b1d][_0x67d6('0x2e')],_0x30c237,_0x4e6b1d);_0xf0f3fb['timers'][_0x30c237]['timer']=setTimeout(_0xf0f3fb[_0x67d6('0x2f')]['bind'](_0xf0f3fb,_0x30c237),_0xf0f3fb[_0x67d6('0x4')][_0x4e6b1d][_0x67d6('0x2e')]*0x3e8);_0xf0f3fb[_0x67d6('0x5')][_0x30c237]['lastPauseAt']=moment()[_0x67d6('0x30')](_0x67d6('0x31'));_0xf0f3fb['timers'][_0x30c237][_0x67d6('0x18')]=_0x44a963;_0xf0f3fb[_0x67d6('0x5')][_0x30c237][_0x67d6('0x32')]=_0x4e6b1d;_0xf0f3fb[_0x67d6('0x5')][_0x30c237][_0x67d6('0x14')]=_0xf0f3fb[_0x67d6('0x14')][_0x67d6('0x9')](_0xf0f3fb,_0x30c237,_0x44a963);});}})['catch'](function(){logger['error'](_0x67d6('0x2d'),_0x44a963,_0xf0f3fb['voiceQueues'][_0x4e6b1d][_0x67d6('0x2e')],_0x30c237,_0x4e6b1d);})[_0x67d6('0x1d')](function(){delete _0xf0f3fb[_0x67d6('0x6')][_0x44a963];});}catch(_0x5d7a4b){logger[_0x67d6('0x1b')]('[ACW][START]\x20%s',_0x5d7a4b[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x2f')]=function(_0xdc0869){try{var _0x11bed2=this;if(_0x11bed2[_0x67d6('0x5')][_0xdc0869]){_0x11bed2[_0x67d6('0x5')][_0xdc0869][_0x67d6('0x16')]=![];var _0x4fa8da=_0x11bed2['timers'][_0xdc0869][_0x67d6('0x18')];var _0x34a0b7=_0x11bed2[_0x67d6('0x5')][_0xdc0869][_0x67d6('0x32')];var _0x170954=_0x11bed2[_0x67d6('0x4')][_0x34a0b7][_0x67d6('0x2e')];logger['info'](_0x67d6('0x34'),_0x4fa8da,_0xdc0869);RpcUser[_0x67d6('0x26')](this[_0x67d6('0x25')][_0xdc0869]['id'])[_0x67d6('0x24')](function(_0x8ee5d2){if(_0x8ee5d2[_0x67d6('0x35')]===_0x67d6('0x20')){return RpcUser['saveUnpause'](_0x11bed2[_0x67d6('0x25')][_0xdc0869]);}});RpcVoiceAgentReport['update']({'acwtime':_0x170954,'agentacw':!![]},_0x4fa8da,_0xdc0869)[_0x67d6('0x24')](function(_0x2d1615){logger['info'](_0x67d6('0x36'),_0x4fa8da,_0x170954,_0x2d1615);})[_0x67d6('0x1a')](function(_0x11cc14){logger[_0x67d6('0x1b')](_0x67d6('0x1c'),_0x4fa8da,_0x11cc14);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xdc0869);if(_0x11bed2[_0x67d6('0x5')]){logger[_0x67d6('0x19')](_0x67d6('0x37'),JSON[_0x67d6('0x38')](_0x11bed2['timers']));}}}catch(_0x5b0166){logger[_0x67d6('0x1b')](_0x67d6('0x39'),_0x5b0166[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x7')]=function(_0x4bd7fc){try{if(this[_0x67d6('0x4')][_0x4bd7fc[_0x67d6('0x32')]]&&(this[_0x67d6('0x4')][_0x4bd7fc[_0x67d6('0x32')]][_0x67d6('0x2')]||this['voiceQueues'][_0x4bd7fc[_0x67d6('0x32')]]['mandatoryDisposition'])){if(this['agents'][_0x4bd7fc[_0x67d6('0x1f')]]){this[_0x67d6('0x6')][_0x4bd7fc[_0x67d6('0x18')]]={'queue':_0x4bd7fc['queue'],'interface':_0x4bd7fc[_0x67d6('0x1f')],'destlinkedid':_0x4bd7fc[_0x67d6('0x2a')]};}}}catch(_0x4d5d4f){logger[_0x67d6('0x1b')](_0x67d6('0x3a'),_0x4d5d4f['message']);}};Acw[_0x67d6('0x13')][_0x67d6('0xf')]=function(_0x2fa60f){try{if(this[_0x67d6('0x4')][_0x2fa60f[_0x67d6('0x32')]]&&(this[_0x67d6('0x4')][_0x2fa60f['queue']][_0x67d6('0x2')]||this[_0x67d6('0x4')][_0x2fa60f['queue']][_0x67d6('0x3b')])){if(this[_0x67d6('0x25')][_0x2fa60f[_0x67d6('0x1f')]]){this[_0x67d6('0x6')][_0x2fa60f[_0x67d6('0x18')]]={'queue':_0x2fa60f['queue'],'interface':_0x2fa60f[_0x67d6('0x1f')]};}}}catch(_0x336bd0){logger[_0x67d6('0x1b')](_0x67d6('0x3c'),_0x336bd0[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x8')]=function(_0x55fe56){try{if(this['channels'][_0x55fe56['uniqueid']]&&_[_0x67d6('0x3d')](this['channels'][_0x55fe56[_0x67d6('0x18')]][_0x67d6('0x29')])){logger[_0x67d6('0x19')]('[%s][HANGUP:UNIQUEID]',_0x55fe56[_0x67d6('0x18')]);this[_0x67d6('0x1e')](_0x55fe56[_0x67d6('0x18')]);}else if(this[_0x67d6('0x6')][_0x55fe56['linkedid']]&&_[_0x67d6('0x3d')](this[_0x67d6('0x6')][_0x55fe56[_0x67d6('0x3e')]]['attended'])){logger[_0x67d6('0x19')](_0x67d6('0x3f'),_0x55fe56['linkedid']);this[_0x67d6('0x1e')](_0x55fe56[_0x67d6('0x3e')]);}}catch(_0x5624db){logger['error'](_0x67d6('0x40'),_0x5624db[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x41')]=function(_0x532a98){try{if(this[_0x67d6('0x6')][_0x532a98['uniqueid']]&&this[_0x67d6('0x6')][_0x532a98['uniqueid']][_0x67d6('0x29')]){logger[_0x67d6('0x19')](_0x67d6('0x42'),_0x532a98[_0x67d6('0x18')]);this[_0x67d6('0x1e')](_0x532a98[_0x67d6('0x18')]);}else if(this['channels'][_0x532a98[_0x67d6('0x3e')]]&&this[_0x67d6('0x6')][_0x532a98[_0x67d6('0x3e')]][_0x67d6('0x29')]){logger[_0x67d6('0x19')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x532a98[_0x67d6('0x3e')]);this['startAcw'](_0x532a98[_0x67d6('0x3e')]);}}catch(_0x18154a){logger[_0x67d6('0x1b')](_0x67d6('0x43'),_0x18154a[_0x67d6('0x33')]);}};Acw['prototype'][_0x67d6('0xc')]=function(_0x5d9bc3){try{if(!_['isNil'](this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x44')]])){this[_0x67d6('0x1e')](_0x5d9bc3[_0x67d6('0x44')]);if(this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]]){this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]]['attended']=!![];this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x46')]]=this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]];this[_0x67d6('0x47')](_0x5d9bc3['secondtransfereruniqueid']);}}else if(!_[_0x67d6('0x48')](this[_0x67d6('0x6')][_0x5d9bc3['transfertargetuniqueid']])){this['startAcw'](_0x5d9bc3[_0x67d6('0x46')]);if(this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x49')]]){this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x49')]][_0x67d6('0x29')]=!![];this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x44')]]=this['channels'][_0x5d9bc3['origtransfereruniqueid']];this[_0x67d6('0x47')](_0x5d9bc3[_0x67d6('0x49')]);}}}catch(_0x160b0e){logger[_0x67d6('0x1b')](_0x67d6('0x4a'),_0x160b0e[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0xe')]=function(_0x31d761){try{if(this['channels'][_0x31d761[_0x67d6('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x67d6('0x38')](_0x31d761['transfereruniqueid']));this['startAcw'](_0x31d761[_0x67d6('0x4b')]);}else if(this['channels'][_0x31d761['transfererlinkedid']]){logger[_0x67d6('0x19')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x67d6('0x38')](_0x31d761['transfererlinkedid']));this[_0x67d6('0x1e')](_0x31d761['transfererlinkedid']);}}catch(_0x64586b){logger[_0x67d6('0x1b')](_0x67d6('0x4c'),_0x64586b['message']);}};Acw[_0x67d6('0x13')]['syncAgentRingNoAnswer']=function(_0x3f894d){try{if(this[_0x67d6('0x4')][_0x3f894d[_0x67d6('0x32')]]&&this[_0x67d6('0x4')][_0x3f894d['queue']][_0x67d6('0x4d')]===_0x67d6('0x4e')){if(this[_0x67d6('0x25')][_0x3f894d[_0x67d6('0x1f')]]){logger[_0x67d6('0x19')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f894d[_0x67d6('0x18')],_0x3f894d[_0x67d6('0x1f')],_0x3f894d[_0x67d6('0x32')]);return RpcUser[_0x67d6('0x2b')](this['agents'][_0x3f894d[_0x67d6('0x1f')]],_0x67d6('0x4f'),_0x3f894d[_0x67d6('0x18')]);}}}catch(_0x2cb45d){logger[_0x67d6('0x1b')](_0x67d6('0x50'),_0x2cb45d['message']);}};Acw[_0x67d6('0x13')][_0x67d6('0x47')]=function(_0x25328f,_0x2519e0=0x2710){if(this[_0x67d6('0x6')][_0x25328f]){setTimeout(()=>{delete this['channels'][_0x25328f];},_0x2519e0);}};module[_0x67d6('0x51')]=Acw; \ No newline at end of file +var _0x5325=['savePause','available','paused','acwTimeout','stopAcw','catch','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x54b447,_0x4adfc2){var _0x1e0bbd=function(_0x209b5a){while(--_0x209b5a){_0x54b447['push'](_0x54b447['shift']());}};_0x1e0bbd(++_0x4adfc2);}(_0x5325,0x88));var _0x5532=function(_0x571758,_0xf017c1){_0x571758=_0x571758-0x0;var _0x4087b4=_0x5325[_0x571758];return _0x4087b4;};'use strict';var _=require(_0x5532('0x0'));var moment=require('moment');var ami=require(_0x5532('0x1'));var logger=require(_0x5532('0x2'))(_0x5532('0x3'));var RpcUser=require(_0x5532('0x4'));var RpcVoiceAgentReport=require(_0x5532('0x5'));function Acw(_0x1c9142){this[_0x5532('0x6')]=_0x1c9142[_0x5532('0x6')];this['agents']=_0x1c9142[_0x5532('0x7')];this[_0x5532('0x8')]=_0x1c9142[_0x5532('0x8')];this['channels']={};ami['on'](_0x5532('0x9'),this['syncAgentConnect'][_0x5532('0xa')](this));ami['on']('hanguprequest',this[_0x5532('0xb')]['bind'](this));ami['on'](_0x5532('0xc'),this[_0x5532('0xd')]['bind'](this));ami['on'](_0x5532('0xe'),this[_0x5532('0xf')][_0x5532('0xa')](this));ami['on'](_0x5532('0x10'),this[_0x5532('0x11')][_0x5532('0xa')](this));ami['on'](_0x5532('0x12'),this['syncBlindTransfer'][_0x5532('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x5532('0xa')](this));}function getDiff(_0xbc2fdc){var _0x1c5725=moment()[_0x5532('0x13')](0x0);var _0x37498a=moment(_0xbc2fdc)['milliseconds'](0x0);return _0x1c5725[_0x5532('0x14')](_0x37498a,'seconds');}Acw[_0x5532('0x15')][_0x5532('0x16')]=function(_0x5f2f94,_0x31a857){var _0x3e8a32=this;var _0x44cbfe=getDiff(_0x3e8a32['timers'][_0x5f2f94][_0x5532('0x17')]);clearTimeout(_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x18')]);_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x18')]=![];return RpcVoiceAgentReport[_0x5532('0x19')]({'acwtime':_0x44cbfe},_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x1a')],_0x5f2f94)[_0x5532('0x1b')](function(_0x2ba8e6){logger[_0x5532('0x1c')](_0x5532('0x1d'),_0x31a857,_0x44cbfe,_0x2ba8e6);})['catch'](function(_0x1a99ee){logger['error'](_0x5532('0x1e'),_0x31a857,_0x1a99ee);})[_0x5532('0x1f')](function(){delete _0x3e8a32[_0x5532('0x8')][_0x5f2f94];});};Acw[_0x5532('0x15')][_0x5532('0x20')]=function(_0x30be03){try{var _0x5c62e1=this;var _0x360905=this[_0x5532('0x21')][_0x30be03][_0x5532('0x22')];var _0x254bc1=this[_0x5532('0x21')][_0x30be03][_0x5532('0x23')];var _0x1617d6=this['voiceQueues'][_0x254bc1];var _0x568f3a=![];var _0x524e52=_0x5532('0x24');if(_0x1617d6[_0x5532('0x25')]&&_0x1617d6[_0x5532('0x26')][_0x5532('0x27')]){_0x568f3a=!![];_0x524e52=_0x1617d6['mandatoryDispositionPause'][_0x5532('0x27')];}return ami[_0x5532('0x28')]({'action':_0x5532('0x29'),'interface':_0x360905,'paused':!![],'reason':_0x524e52})[_0x5532('0x1b')](function(){if(_0x5c62e1[_0x5532('0x7')][_0x360905]){return RpcUser[_0x5532('0x2a')](_0x5c62e1['agents'][_0x360905]['id'])[_0x5532('0x1b')](function(_0x976076){if(!_0x976076||_0x976076[_0x5532('0x2b')]){logger['info'](_0x5532('0x2c'),_0x30be03,_0x360905,_0x254bc1);return;}logger['info'](_0x5532('0x2d'),_0x30be03,_0x360905,_0x254bc1);var _0x4bfbd1=_0x5c62e1[_0x5532('0x21')][_0x30be03][_0x5532('0x2e')]&&_0x5c62e1['channels'][_0x30be03][_0x5532('0x2f')]?_0x5c62e1['channels'][_0x30be03][_0x5532('0x2f')]:_0x30be03;return RpcUser[_0x5532('0x30')](_0x5c62e1['agents'][_0x360905],_0x524e52,_0x4bfbd1)[_0x5532('0x1b')](function(_0x5a1837){_0x5c62e1[_0x5532('0x6')][_0x254bc1][_0x5532('0x31')]-=0x1;_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x32')]+=0x1;return _0x5a1837;});})[_0x5532('0x1b')](function(_0x1d9186){if(_0x568f3a||!_0x1d9186){return;}_0x5c62e1[_0x5532('0x8')][_0x360905]={};logger[_0x5532('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30be03,_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x33')],_0x360905,_0x254bc1);_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x18')]=setTimeout(_0x5c62e1[_0x5532('0x34')]['bind'](_0x5c62e1,_0x360905),_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x33')]*0x3e8);_0x5c62e1['timers'][_0x360905][_0x5532('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x1a')]=_0x30be03;_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x23')]=_0x254bc1;_0x5c62e1[_0x5532('0x8')][_0x360905]['updateAcw']=_0x5c62e1[_0x5532('0x16')]['bind'](_0x5c62e1,_0x360905,_0x30be03);});}})[_0x5532('0x35')](function(){logger[_0x5532('0x36')](_0x5532('0x37'),_0x30be03,_0x5c62e1[_0x5532('0x6')][_0x254bc1][_0x5532('0x33')],_0x360905,_0x254bc1);})[_0x5532('0x1f')](function(){delete _0x5c62e1[_0x5532('0x21')][_0x30be03];});}catch(_0x5c35e4){logger[_0x5532('0x36')](_0x5532('0x38'),_0x5c35e4[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x34')]=function(_0x3e415f){try{var _0x20fd56=this;if(_0x20fd56[_0x5532('0x8')][_0x3e415f]){_0x20fd56['timers'][_0x3e415f][_0x5532('0x18')]=![];var _0x2b8662=_0x20fd56[_0x5532('0x8')][_0x3e415f][_0x5532('0x1a')];var _0x4d68ce=_0x20fd56[_0x5532('0x8')][_0x3e415f]['queue'];var _0x4f674c=_0x20fd56[_0x5532('0x6')][_0x4d68ce][_0x5532('0x33')];logger[_0x5532('0x1c')](_0x5532('0x3a'),_0x2b8662,_0x3e415f);RpcUser[_0x5532('0x2a')](this[_0x5532('0x7')][_0x3e415f]['id'])[_0x5532('0x1b')](function(_0x44f07c){if(_0x44f07c[_0x5532('0x3b')]===_0x5532('0x24')){return RpcUser[_0x5532('0x3c')](_0x20fd56['agents'][_0x3e415f]);}});RpcVoiceAgentReport[_0x5532('0x19')]({'acwtime':_0x4f674c,'agentacw':!![]},_0x2b8662,_0x3e415f)[_0x5532('0x1b')](function(_0x138fe4){logger['info'](_0x5532('0x1d'),_0x2b8662,_0x4f674c,_0x138fe4);})[_0x5532('0x35')](function(_0x2ab6d4){logger['error'](_0x5532('0x1e'),_0x2b8662,_0x2ab6d4);});}else{logger[_0x5532('0x36')](_0x5532('0x3d'),_0x3e415f);if(_0x20fd56['timers']){logger[_0x5532('0x1c')](_0x5532('0x3e'),JSON[_0x5532('0x3f')](_0x20fd56[_0x5532('0x8')]));}}}catch(_0x4d2638){logger[_0x5532('0x36')]('[ACW][STOP]\x20%s',_0x4d2638[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x40')]=function(_0x5c052a){try{if(this[_0x5532('0x6')][_0x5c052a[_0x5532('0x23')]]&&(this['voiceQueues'][_0x5c052a[_0x5532('0x23')]][_0x5532('0x3')]||this[_0x5532('0x6')][_0x5c052a[_0x5532('0x23')]]['mandatoryDisposition'])){if(this[_0x5532('0x7')][_0x5c052a['interface']]){this[_0x5532('0x21')][_0x5c052a[_0x5532('0x1a')]]={'queue':_0x5c052a['queue'],'interface':_0x5c052a[_0x5532('0x22')],'destlinkedid':_0x5c052a[_0x5532('0x2f')]};}}}catch(_0x2f1ad6){logger['error'](_0x5532('0x41'),_0x2f1ad6['message']);}};Acw[_0x5532('0x15')][_0x5532('0x42')]=function(_0x69f2bc){try{if(this[_0x5532('0x6')][_0x69f2bc[_0x5532('0x23')]]&&(this[_0x5532('0x6')][_0x69f2bc['queue']][_0x5532('0x3')]||this[_0x5532('0x6')][_0x69f2bc['queue']][_0x5532('0x25')])){if(this[_0x5532('0x7')][_0x69f2bc[_0x5532('0x22')]]){this[_0x5532('0x21')][_0x69f2bc[_0x5532('0x1a')]]={'queue':_0x69f2bc[_0x5532('0x23')],'interface':_0x69f2bc[_0x5532('0x22')]};}}}catch(_0x531b2a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x531b2a[_0x5532('0x39')]);}};Acw[_0x5532('0x15')]['syncHangupRequest']=function(_0x42f39c){try{if(this[_0x5532('0x21')][_0x42f39c[_0x5532('0x1a')]]&&_['isUndefined'](this[_0x5532('0x21')][_0x42f39c[_0x5532('0x1a')]][_0x5532('0x2e')])){logger[_0x5532('0x1c')](_0x5532('0x43'),_0x42f39c[_0x5532('0x1a')]);this['startAcw'](_0x42f39c[_0x5532('0x1a')]);}else if(this[_0x5532('0x21')][_0x42f39c[_0x5532('0x44')]]&&_[_0x5532('0x45')](this[_0x5532('0x21')][_0x42f39c[_0x5532('0x44')]][_0x5532('0x2e')])){logger[_0x5532('0x1c')](_0x5532('0x46'),_0x42f39c[_0x5532('0x44')]);this['startAcw'](_0x42f39c[_0x5532('0x44')]);}}catch(_0x5c4fb6){logger[_0x5532('0x36')](_0x5532('0x47'),_0x5c4fb6[_0x5532('0x39')]);}};Acw[_0x5532('0x15')]['syncHangup']=function(_0x57d3aa){try{if(this['channels'][_0x57d3aa[_0x5532('0x1a')]]&&this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x1a')]][_0x5532('0x2e')]){logger['info'](_0x5532('0x48'),_0x57d3aa[_0x5532('0x1a')]);this['startAcw'](_0x57d3aa[_0x5532('0x1a')]);}else if(this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x44')]]&&this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x44')]][_0x5532('0x2e')]){logger['info'](_0x5532('0x49'),_0x57d3aa[_0x5532('0x44')]);this['startAcw'](_0x57d3aa['linkedid']);}}catch(_0x567298){logger[_0x5532('0x36')](_0x5532('0x4a'),_0x567298[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x11')]=function(_0x290939){try{if(!_['isNil'](this[_0x5532('0x21')][_0x290939['transfereeuniqueid']])){this[_0x5532('0x20')](_0x290939[_0x5532('0x4b')]);if(this[_0x5532('0x21')][_0x290939[_0x5532('0x4c')]]){this[_0x5532('0x21')][_0x290939['secondtransfereruniqueid']][_0x5532('0x2e')]=!![];this[_0x5532('0x21')][_0x290939[_0x5532('0x4d')]]=this[_0x5532('0x21')][_0x290939[_0x5532('0x4c')]];this[_0x5532('0x4e')](_0x290939[_0x5532('0x4c')]);}}else if(!_[_0x5532('0x4f')](this[_0x5532('0x21')][_0x290939['transfertargetuniqueid']])){this['startAcw'](_0x290939[_0x5532('0x4d')]);if(this['channels'][_0x290939[_0x5532('0x50')]]){this['channels'][_0x290939['origtransfereruniqueid']][_0x5532('0x2e')]=!![];this[_0x5532('0x21')][_0x290939[_0x5532('0x4b')]]=this[_0x5532('0x21')][_0x290939['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x290939[_0x5532('0x50')]);}}}catch(_0x112d86){logger[_0x5532('0x36')](_0x5532('0x51'),_0x112d86[_0x5532('0x39')]);}};Acw['prototype'][_0x5532('0x52')]=function(_0x154b93){try{if(this[_0x5532('0x21')][_0x154b93['transfereruniqueid']]){logger[_0x5532('0x1c')](_0x5532('0x53'),JSON[_0x5532('0x3f')](_0x154b93[_0x5532('0x54')]));this[_0x5532('0x20')](_0x154b93[_0x5532('0x54')]);}else if(this['channels'][_0x154b93[_0x5532('0x55')]]){logger['info'](_0x5532('0x56'),JSON[_0x5532('0x3f')](_0x154b93[_0x5532('0x55')]));this[_0x5532('0x20')](_0x154b93['transfererlinkedid']);}}catch(_0x21d0f5){logger[_0x5532('0x36')](_0x5532('0x57'),_0x21d0f5[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0xf')]=function(_0x1a28da){try{if(this['voiceQueues'][_0x1a28da[_0x5532('0x23')]]&&this['voiceQueues'][_0x1a28da[_0x5532('0x23')]][_0x5532('0x58')]==='all'){if(this[_0x5532('0x7')][_0x1a28da['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1a28da[_0x5532('0x1a')],_0x1a28da[_0x5532('0x22')],_0x1a28da[_0x5532('0x23')]);return RpcUser['savePause'](this[_0x5532('0x7')][_0x1a28da[_0x5532('0x22')]],_0x5532('0x59'),_0x1a28da[_0x5532('0x1a')]);}}}catch(_0x42950d){logger[_0x5532('0x36')](_0x5532('0x5a'),_0x42950d[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x4e')]=function(_0xb833bf,_0x1ea387=0x2710){if(this[_0x5532('0x21')][_0xb833bf]){setTimeout(()=>{delete this['channels'][_0xb833bf];},_0x1ea387);}};module[_0x5532('0x5b')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c0a295e..2ce9796 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 _0xe80a=['close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','inspect','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x1e801c,_0x22d0e4){var _0x5a7146=function(_0x346a03){while(--_0x346a03){_0x1e801c['push'](_0x1e801c['shift']());}};_0x5a7146(++_0x22d0e4);}(_0xe80a,0x1c5));var _0xae80=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe80a[_0x164eca];return _0x2ce562;};'use strict';var Manager=require(_0xae80('0x0'));var BPromise=require(_0xae80('0x1'));var util=require(_0xae80('0x2'));var logger=require(_0xae80('0x3'))(_0xae80('0x4'));var config=require(_0xae80('0x5'));var ami=new Manager(config[_0xae80('0x6')][_0xae80('0x7')],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')][_0xae80('0x8')],config[_0xae80('0x6')][_0xae80('0x9')],!![]);ami[_0xae80('0xa')]();ami['Action']=BPromise[_0xae80('0xb')](ami[_0xae80('0xc')]);function error(_0x3292a8){logger['error'](util[_0xae80('0xd')](_0xae80('0xe'),config[_0xae80('0x6')]['username'],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')]['port'],util['inspect'](_0x3292a8,![],null)));}function close(){logger[_0xae80('0xf')](util[_0xae80('0xd')](_0xae80('0x10'),config[_0xae80('0x6')][_0xae80('0x8')],config['asterisk']['ip'],config[_0xae80('0x6')][_0xae80('0x7')]));}ami[_0xae80('0x11')]=function(){return function(){return ami[_0xae80('0x12')]({'action':_0xae80('0x13')});};};ami[_0xae80('0x14')]=function(){return function(){return ami[_0xae80('0x12')]({'action':'devicestatelist'});};};ami[_0xae80('0x15')]=function(){return function(){return ami[_0xae80('0x12')]({'action':_0xae80('0x16')});};};ami[_0xae80('0x17')]=function(){return function(){return ami['Action']({'action':_0xae80('0x18')});};};ami[_0xae80('0x19')]=function(){return function(){return ami[_0xae80('0x12')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0xae80('0xd')](_0xae80('0x1a'),config['asterisk']['username'],config[_0xae80('0x6')]['ip'],config['asterisk'][_0xae80('0x7')]));ami[_0xae80('0x1b')](_0xae80('0xf'),error);ami[_0xae80('0x1b')](_0xae80('0x1c'),close);}ami['on'](_0xae80('0x1d'),connect);ami['on']('shutdown',function(_0x58f086){logger[_0xae80('0x1e')](util['format'](_0xae80('0x1f'),config[_0xae80('0x6')][_0xae80('0x8')],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')][_0xae80('0x7')],util['inspect'](_0x58f086,![],null)));});ami['on'](_0xae80('0x20'),function(){logger[_0xae80('0x1e')](util[_0xae80('0xd')](_0xae80('0x21'),config[_0xae80('0x6')][_0xae80('0x8')],config['asterisk']['ip'],config[_0xae80('0x6')][_0xae80('0x7')]));return Promise['resolve']()['then'](ami[_0xae80('0x11')]())[_0xae80('0x22')](ami[_0xae80('0x14')]())['then'](ami[_0xae80('0x15')]())[_0xae80('0x22')](ami[_0xae80('0x17')]())[_0xae80('0x22')](ami[_0xae80('0x19')]())[_0xae80('0x23')](function(_0x5ba2c){logger[_0xae80('0xf')]('[ami.js][fullybooted]',util[_0xae80('0x24')](_0x5ba2c,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xae80('0x1b')](_0xae80('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0x60f3=['util','asterisk','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','format','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','asterisk-manager','bluebird'];(function(_0x281e7f,_0x373eaa){var _0x395242=function(_0x5ca938){while(--_0x5ca938){_0x281e7f['push'](_0x281e7f['shift']());}};_0x395242(++_0x373eaa);}(_0x60f3,0x1de));var _0x360f=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x60f3[_0x257841];return _0x1b87ed;};'use strict';var Manager=require(_0x360f('0x0'));var BPromise=require(_0x360f('0x1'));var util=require(_0x360f('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')]['username'],config['asterisk']['password'],!![]);ami[_0x360f('0x4')]();ami[_0x360f('0x5')]=BPromise[_0x360f('0x6')](ami[_0x360f('0x7')]);function error(_0x3a70d4){logger[_0x360f('0x8')](util['format'](_0x360f('0x9'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')][_0x360f('0xb')],util[_0x360f('0xc')](_0x3a70d4,![],null)));}function close(){logger[_0x360f('0x8')](util[_0x360f('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x360f('0x3')][_0x360f('0xa')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x360f('0xe')]=function(){return function(){return ami[_0x360f('0x5')]({'action':_0x360f('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x360f('0x5')]({'action':'devicestatelist'});};};ami[_0x360f('0x10')]=function(){return function(){return ami[_0x360f('0x5')]({'action':_0x360f('0x11')});};};ami[_0x360f('0x12')]=function(){return function(){return ami[_0x360f('0x5')]({'action':'queuesummary'});};};ami[_0x360f('0x13')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0x360f('0x14')](util[_0x360f('0xd')](_0x360f('0x15'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')]['port']));ami[_0x360f('0x16')](_0x360f('0x8'),error);ami[_0x360f('0x16')](_0x360f('0x17'),close);}ami['on'](_0x360f('0x18'),connect);ami['on']('shutdown',function(_0x5a4c4e){logger[_0x360f('0x14')](util[_0x360f('0xd')](_0x360f('0x19'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')][_0x360f('0xb')],util['inspect'](_0x5a4c4e,![],null)));});ami['on'](_0x360f('0x1a'),function(){logger['info'](util[_0x360f('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x360f('0x3')]['username'],config[_0x360f('0x3')]['ip'],config['asterisk'][_0x360f('0xb')]));return Promise[_0x360f('0x1b')]()['then'](ami[_0x360f('0xe')]())[_0x360f('0x1c')](ami[_0x360f('0x1d')]())['then'](ami['actionSipPeerStatus']())[_0x360f('0x1c')](ami[_0x360f('0x12')]())[_0x360f('0x1c')](ami['actionCoreShowChannels']())[_0x360f('0x1e')](function(_0x4d34e7){logger['error'](_0x360f('0x1f'),util[_0x360f('0xc')](_0x4d34e7,{'showHidden':![],'depth':null}));});});ami[_0x360f('0x16')](_0x360f('0x8'),error);ami[_0x360f('0x16')](_0x360f('0x17'),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 4f7597e..2a9689c 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x5de397,_0x4dedad){_0x5de397=_0x5de397-0x0;var _0x28407a=_0x70e0[_0x5de397];return _0x28407a;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x2aef86,_0x35b7be){var _0x2981bf=function(_0x360496){while(--_0x360496){_0x2aef86['push'](_0x2aef86['shift']());}};_0x2981bf(++_0x35b7be);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4f0f27,_0x51deba){_0x4f0f27=_0x4f0f27-0x0;var _0x2ce661=_0xbdb7[_0x4f0f27];return _0x2ce661;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a017c8b..d244f98 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 _0x5735=['resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','progressive','dialPowerLevel','Queue','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ListId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','add','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','stateinterface','locked','paused','strategy','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','rescheduleContact','ContactId','[unlock][syncQueueStatusComplete]','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','idHopper','run','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','response','Success','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','[syncVarSet]','Machine','countmachineretry','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','createStateFinal','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','outboundUnknownCallsDay','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','notFound','[emptyContact]','UserId','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','TrunkBackup','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','handlePower','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','loggedIn','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','dialMethod','booked','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','temp','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','moment','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','defaults','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','handlePredictive','error','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','Error','prototype','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','length','push','Action','command','timezones','then','indexOf','true','catch','content','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined'];(function(_0x47093c,_0x50be47){var _0x3218db=function(_0x2c5511){while(--_0x2c5511){_0x47093c['push'](_0x47093c['shift']());}};_0x3218db(++_0x50be47);}(_0x5735,0x16a));var _0x5573=function(_0x132a9a,_0x4da489){_0x132a9a=_0x132a9a-0x0;var _0x9dd201=_0x5735[_0x132a9a];return _0x9dd201;};'use strict';var util=require(_0x5573('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x5573('0x1'));var rr=require('rr');var Redis=require(_0x5573('0x2'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x5573('0x3'));var logger=require(_0x5573('0x4'))(_0x5573('0x5'));var loggerBooked=require(_0x5573('0x4'))('booked');var loggerPredictive=require(_0x5573('0x4'))(_0x5573('0x6'));var loggerPredictiveCalls=require(_0x5573('0x4'))(_0x5573('0x7'));var loggerSyncQueueSummary=require(_0x5573('0x4'))(_0x5573('0x8'));var ami=require('../ami');config['redis']=_[_0x5573('0x9')](config[_0x5573('0xa')],{'host':_0x5573('0xb'),'port':0x18eb});var io=require(_0x5573('0xc'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5573('0xd'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x5573('0xe'));var Action=require(_0x5573('0xf'));var History=require(_0x5573('0x10'));var Final=require(_0x5573('0x11'));var AgentComplete=require(_0x5573('0x12'));var QueueCallerAbandon=require(_0x5573('0x13'));var Hangup=require(_0x5573('0x14'));var ipAgi=process[_0x5573('0x15')][_0x5573('0x16')]||_0x5573('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x5573('0x18')]=function(_0x42251f){this['tail']=this[_0x5573('0x19')]?this[_0x5573('0x19')][_0x5573('0x1a')](_0x42251f):_0x42251f();};function Dialer(_0x57596a,_0xd36213){this['sequence']=new Sequence();this[_0x5573('0x1b')]=_0xd36213;this[_0x5573('0x1c')]=_0x57596a[_0x5573('0x1c')];this[_0x5573('0x1d')]=_0x57596a[_0x5573('0x1d')];this[_0x5573('0x1e')]=_0x57596a[_0x5573('0x1e')];this[_0x5573('0x1f')]=_0x57596a[_0x5573('0x1f')];this[_0x5573('0x20')]=config['maxNumberOriginate']||0x2;this[_0x5573('0x21')]={};this[_0x5573('0x22')]={};this[_0x5573('0x23')]={};this[_0x5573('0x24')]={};this[_0x5573('0x25')]={};this[_0x5573('0x26')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x5573('0x27')]={};this[_0x5573('0x28')]={};this[_0x5573('0x29')]={};ami['on'](_0x5573('0x2a'),this[_0x5573('0x2b')]['bind'](this));ami['on'](_0x5573('0x2c'),this['syncQueueCallerAbandon'][_0x5573('0x2d')](this));ami['on'](_0x5573('0x2e'),this['syncOriginateResponse'][_0x5573('0x2d')](this));ami['on']('agentcomplete',this[_0x5573('0x2f')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x30'),this[_0x5573('0x8')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x31'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x5573('0x32'),this[_0x5573('0x33')][_0x5573('0x2d')](this));ami['on']('newexten',this[_0x5573('0x34')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x35'),this['syncVarSet'][_0x5573('0x2d')](this));ami['on'](_0x5573('0x36'),this[_0x5573('0x37')][_0x5573('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x5573('0x38')]['bind'](this));this[_0x5573('0x39')]();this[_0x5573('0x3a')]();RpcSetting[_0x5573('0x3b')]()['then'](function(_0x1b3c53){previewRecallmeReminderInterval=_0x1b3c53[_0x5573('0x3c')];});}function isNotNull(_0x46db01){return _0x46db01!==null&&!_[_0x5573('0x3d')](_0x46db01);}function msgResponse(_0x202069,_0x14c0a2,_0x5931be){return{'action':_0x202069,'response':_0x14c0a2,'message':_0x5931be,'stack':_0x5931be};}function emit(_0x1cee8a,_0x1f08b5,_0x212f43){io['to'](_0x1cee8a)[_0x5573('0x3e')](_0x1f08b5,_0x212f43);}function emitOutboundVoiceQueueSummary(_0x4501b3){if(_0x4501b3[_0x5573('0x3f')]===_0x5573('0x40')){logger[_0x5573('0x41')](_0x5573('0x42'),util[_0x5573('0x43')](_0x4501b3,{'showHidden':![],'depth':null}));emit(util[_0x5573('0x44')](_0x5573('0x45'),_0x4501b3[_0x5573('0x46')]),_0x5573('0x47'),_0x4501b3);}}function checkGetDataPredictive(_0x5d0904){if(isNotNull(_0x5d0904)&&!_['isEmpty'](_0x5d0904)){loggerPredictive[_0x5573('0x48')](_0x5573('0x49'));loggerPredictive[_0x5573('0x48')](_0x5573('0x4a'),_0x5d0904[_0x5573('0x4b')]);loggerPredictive['info'](_0x5573('0x4c'),_0x5d0904[_0x5573('0x4d')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d0904['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x5573('0x48')](_0x5573('0x4e'),_0x5d0904[_0x5573('0x4f')]);loggerPredictive['info'](_0x5573('0x50'),_0x5d0904[_0x5573('0x51')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x52'),_0x5d0904['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));if(_0x5d0904[_0x5573('0x4b')]>0x0){if(!_['isUndefined'](_0x5d0904[_0x5573('0x54')])&&_0x5d0904['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x5573('0x3d')](_0x5d0904[_0x5573('0x51')])&&_0x5d0904['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x5573('0x55'));}else{loggerPredictive[_0x5573('0x48')](_0x5573('0x56'));}}else{loggerPredictive[_0x5573('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2b44b0){return function(_0x72823d){loggerPredictive[_0x5573('0x48')](_0x5573('0x57'));loggerPredictive[_0x5573('0x48')](_0x5573('0x58'),_0x72823d['erlangCalls']);loggerPredictive[_0x5573('0x48')](_0x5573('0x59'),_0x72823d[_0x5573('0x5a')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x5b'),_0x72823d[_0x5573('0x5c')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x5d'),_0x72823d['erlangBusyFactor']);loggerPredictive[_0x5573('0x48')](_0x5573('0x5b'),_0x72823d['erlangAbandonmentRate']);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));_[_0x5573('0x5e')](_0x2b44b0,_0x72823d);};}function ifInterval(_0x427fcf,_0x54d4a5){if(_['isUndefined'](_0x54d4a5)){return![];}return utils[_0x5573('0x5f')](undefined,_0x54d4a5)<_0x427fcf*0x3c;}function clearPredictiveAttributes(_0x4ffff2){if(_0x4ffff2[_0x5573('0x60')]){_0x4ffff2[_0x5573('0x60')]=undefined;loggerPredictive[_0x5573('0x41')](_0x4ffff2[_0x5573('0x46')],_0x5573('0x61'));}if(_0x4ffff2[_0x5573('0x26')]){_0x4ffff2[_0x5573('0x26')]=undefined;loggerPredictive['debug'](_0x4ffff2[_0x5573('0x46')],'startPredictive\x20value\x20cleared');}if(_0x4ffff2[_0x5573('0x62')]){clearInterval(_0x4ffff2['handlePredictive']);_0x4ffff2[_0x5573('0x62')]=undefined;loggerPredictive[_0x5573('0x41')](_0x4ffff2[_0x5573('0x46')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4636d,_0x99faaa){return function(_0x399ff8){loggerPredictive['error'](_0x99faaa[_0x5573('0x46')],_0x4636d);loggerPredictive[_0x5573('0x63')](_0x399ff8['stack']);clearPredictiveAttributes(_0x99faaa);};}function loggerCatch(_0x468ae8){return function(_0x21f36b){logger['error'](_0x468ae8,util[_0x5573('0x43')](_0x21f36b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5d0a9d){return function(_0x7fe9d2){if(isNotNull(_0x7fe9d2)&&isNotNull(_0x7fe9d2[0x0])){if(_0x7fe9d2[0x0][_0x5573('0x64')]>0x0){_0x5d0a9d['message']=utils[_0x5573('0x65')][_0x5573('0x66')];logger[_0x5573('0x48')](_0x5573('0x67')+_0x5d0a9d[_0x5573('0x46')],_0x7fe9d2[0x0][_0x5573('0x64')],'contacts');}else{_0x5d0a9d['message']=utils[_0x5573('0x65')][_0x5573('0x68')];logger[_0x5573('0x48')](_0x5573('0x69')+_0x5d0a9d[_0x5573('0x46')]);}}};}function createObjHistory(_0x3380f2,_0x1703e5,_0x2ec331,_0xffde84,_0x533349){_0x3380f2[_0x5573('0x6a')]=_0x2ec331;var _0x325376=new Action(_0x3380f2,_0x1703e5);var _0xeca05d=new History(_0x325376);_0xeca05d[_0x5573('0x6b')]=_0xffde84;_0xeca05d[_0x5573('0x6c')]=_0x533349;_0xeca05d[_0x5573('0x6d')]=_0x325376[_0x5573('0x6e')];return _0xeca05d;}function unlockQueueStatus(_0x4f3a1f,_0x4c0b67){setTimeout(function(){if(_['isUndefined'](_0x4f3a1f[_0x5573('0x6f')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x4c0b67);}_0x4f3a1f[_0x5573('0x6f')]=!![];loggerBooked[_0x5573('0x48')](_0x5573('0x70'),_0x4c0b67,JSON[_0x5573('0x71')](_[_0x5573('0x72')](_0x4f3a1f,[_0x5573('0x46'),_0x5573('0x6f')])));},0x1f3);}function checkInterval(_0x43a8ed){return function(){if(!isNotNull(_0x43a8ed[_0x5573('0x73')])){_0x43a8ed[_0x5573('0x6a')]=utils[_0x5573('0x65')]['NULL_INTERVAL'];throw _0x43a8ed[_0x5573('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x43a8ed[_0x5573('0x73')][_0x5573('0x74')])){_0x43a8ed['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x43a8ed[_0x5573('0x46')]+_0x5573('0x75');}if(!isNotNull(_[_0x5573('0x76')](_0x43a8ed[_0x5573('0x73')][_0x5573('0x74')]))){_0x43a8ed[_0x5573('0x6a')]=utils[_0x5573('0x65')][_0x5573('0x77')];throw _0x43a8ed[_0x5573('0x46')]+_0x5573('0x75');}};}function checkIsIVRCampaignActive(_0x5e25d0){return function(){if(!utils['isIVRCampaignActive'](_0x5e25d0)){_0x5e25d0[_0x5573('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5573('0x78')];throw _0x5e25d0[_0x5573('0x46')]+_0x5573('0x79');}};}function emitCampaignSummary(_0x23b9b4){if(utils[_0x5573('0x7a')](_0x23b9b4)){emit(util[_0x5573('0x44')]('campaign:ivr:%s',_0x23b9b4[_0x5573('0x46')]),_0x5573('0x7b'),_0x23b9b4);}}function loggerCatchQueueSummary(_0xe4bb73,_0x5c4649){return function(_0x257feb){clearPredictiveAttributes(_0x5c4649);emitCampaignSummary(_0x5c4649);loggerSyncQueueSummary[_0x5573('0x41')](_0xe4bb73,util[_0x5573('0x43')](_0x257feb,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xc0ed6a){if(_0xc0ed6a[_0x5573('0x7c')]){if(_0xc0ed6a[_0x5573('0x7d')]===0x0){_0xc0ed6a[_0x5573('0x7c')]=![];_0xc0ed6a[_0x5573('0x6a')]=utils[_0x5573('0x65')][_0x5573('0x78')];loggerSyncQueueSummary[_0x5573('0x41')](_0x5573('0x7e'),_0xc0ed6a[_0x5573('0x46')],'is\x20not\x20active');}else{_0xc0ed6a[_0x5573('0x6a')]=utils[_0x5573('0x65')]['DISACTIVED'];loggerSyncQueueSummary[_0x5573('0x41')](_0x5573('0x7e'),_0xc0ed6a[_0x5573('0x46')],'is\x20deactivated');}emitCampaignSummary(_0xc0ed6a);}}function myreject(_0x1717d2){return function(_0x432610){return _0x1717d2(msgResponse('[ifTime][Action]',_0x5573('0x7f'),JSON['stringify'](_0x432610)));};}Dialer[_0x5573('0x80')]['isTrunkReachable']=function(_0x344faf){return!_[_0x5573('0x3d')](_0x344faf)&&_0x344faf&&!_[_0x5573('0x3d')](_0x344faf[_0x5573('0x46')])&&!_[_0x5573('0x3d')](_0x344faf[_0x5573('0x81')])&&_0x344faf[_0x5573('0x81')]&&(this[_0x5573('0x1f')][util['format'](_0x5573('0x82'),_0x344faf['name'])][_0x5573('0x83')]===_0x5573('0x84')||this[_0x5573('0x1f')][util[_0x5573('0x44')](_0x5573('0x82'),_0x344faf[_0x5573('0x46')])][_0x5573('0x83')]===_0x5573('0x85'));};Dialer[_0x5573('0x80')][_0x5573('0x86')]=function(_0x488d79){var _0x91bca6=this;return function(){if(!_0x91bca6[_0x5573('0x87')](_0x488d79[_0x5573('0x88')])){if(!_0x91bca6['isTrunkReachable'](_0x488d79['TrunkBackup'])){_0x488d79['message']=utils[_0x5573('0x65')][_0x5573('0x89')];throw _0x488d79['name']+_0x5573('0x8a');}}};};Dialer[_0x5573('0x80')][_0x5573('0x8b')]=function(_0xdb703b,_0x4b4390,_0x3a3180,_0x572bc1){var _0x5d9e0b=this;return function(){var _0x44d910=!![];return _0x5d9e0b[_0x5573('0x8c')](_0xdb703b,_0x4b4390,_0x3a3180,_0x572bc1,_0x44d910);};};Dialer['prototype'][_0x5573('0x8d')]=function(_0xddca5f,_0x4ab0d4,_0x778817,_0x259e4c){var _0x519e97=this;return function(){var _0x57aafd=![];return _0x519e97[_0x5573('0x8c')](_0xddca5f['Intervals'],_0x4ab0d4,_0x778817,_0x259e4c,_0x57aafd);};};Dialer['prototype'][_0x5573('0x8c')]=function(_0x334c31,_0x29c0d,_0x22e5fe,_0x5d50af,_0x131291){var _0x5ae0a6=[];return new Promise(function(_0x1c47fe,_0x4c9f6f){if(!isNotNull(_0x334c31)){_0x5d50af[_0x5573('0x6a')]=utils[_0x5573('0x65')]['NULL_INTERVAL'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),_0x22e5fe+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x5573('0x76')](_0x334c31)){_0x5d50af[_0x5573('0x6a')]=utils[_0x5573('0x65')]['EMPTY_INTERVAL'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),_0x22e5fe+_0x5573('0x90')));}if(_0x29c0d&&_['isUndefined'](config['timezones'][_0x29c0d])){_0x5d50af['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),'Failure',_0x22e5fe+_0x5573('0x91')+_0x29c0d));}if(_['isArray'](_0x334c31)){for(var _0x34f68d=0x0;_0x34f68d<_0x334c31[_0x5573('0x92')];_0x34f68d+=0x1){_0x5ae0a6[_0x5573('0x93')](ami[_0x5573('0x94')]({'action':_0x5573('0x95'),'command':util['format']('iftime\x20%s,%s',_0x334c31[_0x34f68d]['interval'],!_['isUndefined'](config[_0x5573('0x96')][_0x29c0d])?_0x29c0d:'')})[_0x5573('0x97')](function(_0x197715){return _0x197715['content'][_0x5573('0x98')](_0x5573('0x99'))>=0x0;})[_0x5573('0x9a')](myreject(_0x4c9f6f)));}}else{_0x5ae0a6['push'](ami[_0x5573('0x94')]({'action':_0x5573('0x95'),'command':util[_0x5573('0x44')]('iftime\x20%s,%s',_0x334c31,!_[_0x5573('0x3d')](config[_0x5573('0x96')][_0x29c0d])?_0x29c0d:'')})[_0x5573('0x97')](function(_0x5d1fbb){return _0x5d1fbb[_0x5573('0x9b')][_0x5573('0x98')]('true')>=0x0;})[_0x5573('0x9a')](myreject(_0x4c9f6f)));}Promise[_0x5573('0x9c')](_0x5ae0a6)[_0x5573('0x97')](function(_0x1f3533){var _0xa3a405=_['some'](_0x1f3533);if(_0xa3a405){return _0x1c47fe(_0xa3a405);}else{_0x5d50af[_0x5573('0x6a')]=_0x131291?utils[_0x5573('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x5573('0x65')][_0x5573('0x9d')];return _0x4c9f6f(msgResponse(_0x5573('0x9e'),'Failure','Global:\x20'+_0x131291+'\x20'+_0x22e5fe+_0x5573('0x9f')+util[_0x5573('0x43')](_0x334c31,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x29c0d));}})[_0x5573('0x9a')](function(_0x1a0c34){return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),JSON[_0x5573('0x71')](_0x1a0c34)));});});};Dialer[_0x5573('0x80')]['loopCampaigns']=function(){var _0x404265=this;return cmHopper[_0x5573('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0x5573('0x97')](function(){setInterval(function(){_0x404265[_0x5573('0xa1')]();},0x3e8);});};Dialer[_0x5573('0x80')][_0x5573('0xa1')]=function(){var _0x5baf53=this;var _0x47c9bc;for(var _0x1ad2b2 in this[_0x5573('0x1d')]){if(typeof this[_0x5573('0x1d')][_0x1ad2b2]!==_0x5573('0xa2')){_0x47c9bc=this[_0x5573('0x1d')][_0x1ad2b2];if(utils[_0x5573('0x7a')](_0x47c9bc)&&utils['isIVRCampaignActive'](_0x47c9bc)){_0x47c9bc['sendMessageOneNotActive']=!![];Promise[_0x5573('0xa3')]()[_0x5573('0x97')](checkIsIVRCampaignActive(_0x47c9bc))[_0x5573('0x97')](checkInterval(_0x47c9bc))['then'](_0x5baf53[_0x5573('0x86')](_0x47c9bc))[_0x5573('0x97')](_0x5baf53[_0x5573('0x8b')](_0x47c9bc['dialGlobalInterval'],_0x47c9bc[_0x5573('0xa4')],_0x47c9bc['name'],_0x47c9bc))['then'](_0x5baf53[_0x5573('0x8d')](_0x47c9bc[_0x5573('0x73')],_0x47c9bc[_0x5573('0xa4')],_0x47c9bc[_0x5573('0x46')],_0x47c9bc))[_0x5573('0x97')](_0x5baf53[_0x5573('0xa5')](_0x47c9bc))[_0x5573('0x9a')](loggerCatchQueueSummary(_0x5573('0xa6'),_0x47c9bc));}else{notSendMessagesCampaign(_0x47c9bc);}}}};Dialer[_0x5573('0x80')][_0x5573('0xa7')]=function(_0x3f63fd){if(_0x3f63fd['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x3f63fd);}switch(_0x3f63fd['dialMethod']){case _0x5573('0xa8'):this['handlePower'](_0x3f63fd,0x1);break;case'power':this['handlePower'](_0x3f63fd,_0x3f63fd[_0x5573('0xa9')]);break;case _0x5573('0x6'):this[_0x5573('0x6')](_0x3f63fd);break;case'booked':this['handlePower'](_0x3f63fd,0x1);break;default:logger[_0x5573('0x63')](_0x5573('0xaa'),_0x3f63fd['name'],'method\x20not\x20recognized');}};Dialer[_0x5573('0x80')]['ifTime']=function(_0x17c27a,_0x45c1b7){var _0x1bbf77=_0x17c27a[_0x5573('0xa4')];var _0x28af2e=_0x45c1b7?_0x17c27a[_0x5573('0xab')]:_0x17c27a[_0x5573('0x73')][_0x5573('0x74')];logger[_0x5573('0xac')](_0x5573('0xad'),_0x28af2e,_0x1bbf77,_0x17c27a[_0x5573('0x46')],util['format'](_0x5573('0xae'),_0x17c27a[_0x5573('0x46')],_0x17c27a['id']));var _0x3f9c72=null;return Interval[_0x5573('0xaf')](_0x28af2e,_0x1bbf77)['then'](function(_0xf5c499){if(_0xf5c499===!![]){return _0xf5c499;}else{_0x17c27a[_0x5573('0x6a')]=_0x45c1b7?utils[_0x5573('0x65')][_0x5573('0xb0')]:utils[_0x5573('0x65')][_0x5573('0x9d')];_0x3f9c72=msgResponse('[ifTime][promiseAll]',_0x5573('0x8f'),'Global:\x20'+_0x45c1b7+'\x20'+_0x17c27a['name']+_0x5573('0x9f')+util['inspect'](_0x28af2e,{'showHidden':![],'depth':null})+_0x5573('0xb1')+_0x1bbf77);}if(_0x3f9c72!==null){logger[_0x5573('0xac')](_0x5573('0xb2'),_0x3f9c72);_0x3f9c72[_0x5573('0xb3')]=_0x45c1b7;throw _0x3f9c72;}})[_0x5573('0x9a')](function(_0x3ccc60){logger[_0x5573('0x63')](_0x5573('0xb4'),_0x3ccc60);throw msgResponse(_0x5573('0xb5'),_0x5573('0x7f'),util['inspect'](_0x3ccc60,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x271b7b){if(this['voiceQueues'][_0x271b7b[_0x5573('0xb6')]]){if(this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]]&&this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]][_0x5573('0x3f')]!==_0x5573('0xb8')){utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x271b7b[_0x5573('0xb6')]],_0x5573('0xba'));this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]][_0x5573('0xbb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5573('0x80')][_0x5573('0x2f')]=function(_0x5c598e){var _0x2cd227=this['uniqueId'][_0x5c598e[_0x5573('0xb7')]];if(this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]]){if(_0x2cd227&&_0x2cd227[_0x5573('0x3f')]!=='ivr'){delete this[_0x5573('0x24')][_0x5c598e[_0x5573('0xb7')]];this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;var _0x1446bd=new AgentComplete(_0x2cd227,_0x5c598e);if(_0x5c598e[_0x5573('0xbd')]===_0x5573('0xbe')){_0x1446bd[_0x5573('0xbf')]=this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xc0')]&&this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xc1')]?moment()[_0x5573('0x44')](_0x5573('0xc2')):undefined;}hopperUtils[_0x5573('0xc3')](_0x1446bd)[_0x5573('0x9a')](loggerCatch(_0x5573('0xc4')));hopperUtils['moveContactManagedDialer'](_0x1446bd)['catch'](loggerCatch(_0x5573('0xc5')));}}};Dialer[_0x5573('0x80')][_0x5573('0xc6')]=function(_0x3fb84a){var _0x308ec0=this[_0x5573('0x24')][_0x3fb84a['uniqueid']];var _0x5ccc65=this;var _0x2469ac=![];var _0x2607c1;var _0x360101;if(this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]){if(_0x308ec0&&_0x308ec0[_0x5573('0x3f')]!==_0x5573('0xb8')){delete this[_0x5573('0x24')][_0x3fb84a[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]],_0x5573('0xc7'));_0x308ec0[_0x5573('0xc8')]=moment()[_0x5573('0x44')](_0x5573('0xc2'));var _0xd4288=new QueueCallerAbandon(_0x308ec0,_0x3fb84a);if(utils[_0x5573('0x5f')](_0x308ec0[_0x5573('0xc8')],_0x308ec0[_0x5573('0xc9')])>=_0x308ec0[_0x5573('0xca')]){this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcb')]+=0x1;this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcc')]+=0x1;this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcd')]+=0x1;_0xd4288[_0x5573('0x6b')]=0xa;_0xd4288[_0x5573('0x6c')]=_0x5573('0xce');_0xd4288[_0x5573('0xcf')]=_0x5573('0xd0');_0xd4288[_0x5573('0xbf')]=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xc0')]?moment()[_0x5573('0x44')](_0x5573('0xc2')):undefined;_0xd4288[_0x5573('0xd1')]+=0x1;_0xd4288[_0x5573('0xd2')]+=0x1;_0x2607c1=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialDropRetryFrequency'];_0x360101=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd3')];hopperUtils[_0x5573('0xd4')](_0xd4288,_0xd4288[_0x5573('0x6b')],_0x308ec0[_0x5573('0xd5')])['then'](function(_0x30676e){_0x2469ac=_0x30676e[_0x5573('0xd6')]==0x1;if(_0xd4288['countdropretry']>=_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialDropMaxRetry']){_0x5ccc65[_0x5573('0xd7')](_0xd4288,_0x30676e[_0x5573('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xd4288[_0x5573('0xd1')],'scheduledat':moment()['add'](_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd8')],_0x5573('0xd9'))['format'](_0x5573('0xc2')),'ContactId':_0x308ec0['ContactId'],'ListId':_0x308ec0[_0x5573('0xda')],'VoiceQueueId':_0x308ec0['VoiceQueueId']||undefined,'CampaignId':_0x308ec0[_0x5573('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x323f7a=new History(_0xd4288);_0x323f7a['state']=0xa;_0x323f7a[_0x5573('0x6c')]='Drop';_0x323f7a[_0x5573('0x6e')]=moment()[_0x5573('0x44')](_0x5573('0xc2'));_0x323f7a['endtime']=_0x323f7a[_0x5573('0x6e')];_0x323f7a[_0x5573('0xdc')]=_0xd4288[_0x5573('0xdc')];_0x323f7a['calleridnum']=_0xd4288[_0x5573('0xdd')];hopperUtils['createHistory'](_0x323f7a)[_0x5573('0x9a')](loggerCatch(_0x5573('0xde')));}})[_0x5573('0x97')](function(){if(_0x2469ac)hopperUtils[_0x5573('0xdf')](_0xd4288,_0x2607c1,_0x360101)[_0x5573('0x97')](function(){return 0x1;});});}else{this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0x4f')]+=0x1;this['voiceQueues'][_0x3fb84a[_0x5573('0xb6')]]['outboundDropCallsDayCallersExit']+=0x1;_0xd4288[_0x5573('0x6b')]=0xb;_0xd4288[_0x5573('0x6c')]=_0x5573('0xe0');_0xd4288[_0x5573('0xcf')]=_0x5573('0xe1');_0xd4288['countabandonedretry']+=0x1;_0xd4288[_0x5573('0xd2')]+=0x1;_0x2607c1=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xe2')];_0x360101=this['voiceQueues'][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd3')];hopperUtils[_0x5573('0xd4')](_0xd4288,_0xd4288[_0x5573('0x6b')],_0x308ec0['voiceQueue'])['then'](function(_0x1cf83e){if(_0xd4288[_0x5573('0xe3')]>=_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialAbandonedMaxRetry']){_0x5ccc65[_0x5573('0xd7')](_0xd4288,_0x1cf83e[_0x5573('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xd4288[_0x5573('0xe3')],'scheduledat':moment()[_0x5573('0xe4')](_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialAbandonedRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x308ec0['ContactId'],'ListId':_0x308ec0['ListId'],'VoiceQueueId':_0x308ec0[_0x5573('0xe5')]||undefined,'CampaignId':_0x308ec0[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xe6')));var _0xe78c37=new History(_0xd4288);_0xe78c37[_0x5573('0x6b')]=0xb;_0xe78c37[_0x5573('0x6c')]=_0x5573('0xe0');_0xe78c37[_0x5573('0x6e')]=moment()[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0xe78c37[_0x5573('0x6d')]=_0xe78c37[_0x5573('0x6e')];_0xe78c37['calleridname']=_0xd4288[_0x5573('0xdc')];_0xe78c37['calleridnum']=_0xd4288[_0x5573('0xdd')];hopperUtils[_0x5573('0xc3')](_0xe78c37)[_0x5573('0x9a')](loggerCatch(_0x5573('0xe7')));}})[_0x5573('0x97')](function(){if(_0x2469ac)hopperUtils[_0x5573('0xdf')](_0xd4288,_0x2607c1,_0x360101)[_0x5573('0x97')](function(){return 0x1;});});}}}};Dialer[_0x5573('0x80')][_0x5573('0x34')]=function(_0x2dd843){if(this[_0x5573('0x22')][_0x2dd843['uniqueid']]){this[_0x5573('0x22')][_0x2dd843[_0x5573('0xb7')]][_0x5573('0xe8')]=_0x2dd843[_0x5573('0xe8')];}if(this['uniqueId'][_0x2dd843[_0x5573('0xb7')]]){this[_0x5573('0x24')][_0x2dd843[_0x5573('0xb7')]][_0x5573('0xe8')]=_0x2dd843[_0x5573('0xe8')];}};Dialer[_0x5573('0x80')]['syncQueueMember']=function(_0x532563){if(!this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]){return;}var _0x2dc78d=this[_0x5573('0x1c')][this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]['queue']]['strategy']||_0x5573('0xea');if(_0x2dc78d===_0x5573('0xeb')){if(this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]&&_['isNil'](this['actions'][_0x532563[_0x5573('0xe9')]]['locked'])&&_0x532563[_0x5573('0x83')]==='1'&&_0x532563['paused']==='0'){if(this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]]){if(!this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]][_0x5573('0xed')]){this['agents'][_0x532563[_0x5573('0xec')]][_0x5573('0xed')]=!![];this['actions'][_0x532563[_0x5573('0xe9')]][_0x5573('0xed')]=!![];this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]][_0x5573('0xec')]=_0x532563['stateinterface'];}}}}else if(_0x2dc78d===_0x5573('0xea')){if(this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]){if(this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]]){this['actions'][_0x532563[_0x5573('0xe9')]][_0x5573('0xec')]=_0x532563[_0x5573('0xec')];if(_['isNil'](this[_0x5573('0x27')][this[_0x5573('0x22')][_0x532563['actionid']]['queue']])){this['queueBooked'][this['actions'][_0x532563[_0x5573('0xe9')]]['queue']]=[];}this[_0x5573('0x27')][this[_0x5573('0x22')][_0x532563['actionid']][_0x5573('0xb6')]][_0x5573('0x93')](_[_0x5573('0x5e')](_[_0x5573('0x72')](this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]],['idHopper',_0x5573('0xec')]),{'status':_0x532563[_0x5573('0x83')],'paused':_0x532563[_0x5573('0xee')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x3a8e22){if(!this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]){return;}var _0x250ddf=this;var _0x2d50be=this['voiceQueues'][this[_0x5573('0x22')][_0x3a8e22['actionid']]['queue']];var _0xfa9710=_0x2d50be[_0x5573('0xef')]||_0x5573('0xea');if(_0xfa9710===_0x5573('0xeb')){if(this[_0x5573('0x22')][_0x3a8e22['actionid']]&&this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')]){this['preview']['run'](this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]['idHopper'],this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')])[_0x5573('0x9a')](function(_0x48273a){logger[_0x5573('0x63')](_0x5573('0xf0'),util[_0x5573('0x43')](_0x48273a,{'showHidden':![],'depth':null}));})[_0x5573('0x1a')](function(){utils['decrementOriginate'](_0x250ddf[_0x5573('0x1c')][_0x250ddf['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]],_0x5573('0xf1'));_0x250ddf[_0x5573('0x1e')][_0x250ddf['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')]][_0x5573('0xed')]=![];delete _0x250ddf['actions'][_0x3a8e22['actionid']];unlockQueueStatus(_0x2d50be);});}else{utils[_0x5573('0xb9')](this['voiceQueues'][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]],'[syncQueueStatusComplete]');hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':this['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xf3')],'ListId':this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xda')],'VoiceQueueId':this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xf4')));delete this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]];unlockQueueStatus(_0x2d50be);}}else if(_0xfa9710==='rrmemory'){var _0x470774;if(this['actions'][_0x3a8e22[_0x5573('0xe9')]]&&!_[_0x5573('0x76')](this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]])){if(this[_0x5573('0x28')][_0x250ddf[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]){this[_0x5573('0x28')][_0x250ddf[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]=this[_0x5573('0x28')][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]]?this[_0x5573('0x28')][this['actions'][_0x3a8e22['actionid']][_0x5573('0xb6')]]:this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]?this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]][_0x5573('0xf5')]||0x0:0x0;}this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]][_0x5573('0xf5')]=this[_0x5573('0x28')][this['actions'][_0x3a8e22['actionid']][_0x5573('0xb6')]];for(var _0x4bd058=0x0;_0x4bd058=_0x10eee5[_0x5573('0x11e')]){_0x3ff1fd[_0x5573('0x11f')](_0x2ef50f,_0x1083bd,_0x57c978,_0x5573('0x120'));}else{if(_0x2ef50f[_0x5573('0x117')]>=_0x10eee5['dialMachineMaxRetry']){_0x3ff1fd['createStateFinal'](_0x2ef50f,_0x1083bd,_0x57c978,_0x5573('0x121'));}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0x2ef50f[_0x5573('0x117')],'scheduledat':moment()[_0x5573('0xe4')](_0x10eee5['dialMachineRetryFrequency'],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0x2ef50f[_0x5573('0xf3')],'ListId':_0x2ef50f[_0x5573('0xda')],'VoiceQueueId':_0x2ef50f['VoiceQueueId']||undefined,'CampaignId':_0x2ef50f['CampaignId']||undefined})['catch'](loggerCatch(_0x5573('0x122')));_0x1083bd({'reschedule':0x1});}}});}if(_0x7fad7a[_0x5573('0x3f')]===_0x5573('0xb8')&&this['campaigns'][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0x112')]&&_0x3a7002[_0x5573('0x113')]===_0x5573('0x109')){delete this[_0x5573('0x24')][_0x3a7002[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]],'[syncVarSet]');_0x5d225d=new Hangup(_0x7fad7a,_0x3a7002);_0x5d225d[_0x5573('0x6b')]=0x12;_0x5d225d[_0x5573('0x6c')]='HangupInAMD';_0x5d225d[_0x5573('0x10b')]='AMD';ami[_0x5573('0x3e')](_0x5573('0x10d'),ut[_0x5573('0x118')](_0x5d225d,_0x5573('0x10e')));this[_0x5573('0x10f')](_0x5d225d,'[syncHangupInAMDIvr][createHistory]',_0x5573('0x123'));}if(_0x7fad7a[_0x5573('0x3f')]===_0x5573('0xb8')&&this[_0x5573('0x1d')][_0x7fad7a['queue']][_0x5573('0x112')]&&_0x3a7002[_0x5573('0x113')]===_0x5573('0x114')){return new Promise(function(_0x539d37,_0x39ce9c){delete _0x3ff1fd[_0x5573('0x24')][_0x3a7002[_0x5573('0xb7')]];utils['decrementOriginate'](_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]],_0x5573('0x115'));_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;_0x3ff1fd['campaigns'][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0x10a')]+=0x1;var _0x3f781f=_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]];var _0x385a47=new Hangup(_0x7fad7a,_0x3a7002);_0x385a47[_0x5573('0x6b')]=0x13;_0x385a47['statedesc']=_0x5573('0x116');_0x385a47[_0x5573('0x10b')]=_0x5573('0x10c');_0x385a47[_0x5573('0x117')]+=0x1;_0x385a47[_0x5573('0xd2')]+=0x1;_0x385a47[_0x5573('0x10e')]=!![];ami[_0x5573('0x3e')](_0x5573('0x10d'),ut[_0x5573('0x118')](_0x385a47,_0x5573('0x10e')));hopperUtils[_0x5573('0xc3')](_0x385a47)[_0x5573('0x9a')](loggerCatch(_0x5573('0x124')));if(_0x385a47[_0x5573('0x119')]+_0x385a47[_0x5573('0x11a')]+_0x385a47[_0x5573('0x11b')]+_0x385a47[_0x5573('0x11c')]+_0x385a47[_0x5573('0xd1')]+_0x385a47[_0x5573('0xe3')]+_0x385a47[_0x5573('0x117')]+_0x385a47[_0x5573('0x11d')]>=_0x3f781f[_0x5573('0x11e')]){_0x3ff1fd[_0x5573('0x11f')](_0x385a47,_0x539d37,_0x39ce9c,'reason19\x20machine....');}else{if(_0x385a47[_0x5573('0x117')]>=_0x3f781f['dialMachineMaxRetry']){_0x3ff1fd[_0x5573('0x125')](_0x385a47,_0x539d37,_0x39ce9c,_0x5573('0x121'));}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0x385a47[_0x5573('0x117')],'scheduledat':moment()['add'](_0x3f781f[_0x5573('0x126')],'minutes')['format'](_0x5573('0xc2')),'ContactId':_0x385a47['ContactId'],'ListId':_0x385a47[_0x5573('0xda')],'VoiceQueueId':_0x385a47[_0x5573('0xe5')]||undefined,'CampaignId':_0x385a47[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x122')));_0x539d37({'reschedule':0x1});}}});}}};Dialer[_0x5573('0x80')][_0x5573('0x33')]=function(_0x58e14a){var _0x58400f=this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];var _0x30b6c4;if(!_0x58400f){return;}if(_0x58400f['type']==='ivr'){delete this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1d')][_0x58400f['queue']],_0x5573('0x127'));this[_0x5573('0x1d')][_0x58400f[_0x5573('0xb6')]][_0x5573('0x128')]+=0x1;if(_0x58e14a['cause-txt']===_0x5573('0x129')){const _0x3924dd=new AgentComplete(_0x58400f,_0x58e14a);_0x3924dd[_0x5573('0xdb')]=this[_0x5573('0x1d')][_0x58400f['queue']]['id'];hopperUtils[_0x5573('0xc3')](_0x3924dd)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12a')));hopperUtils[_0x5573('0x12b')](_0x3924dd)['catch'](loggerCatch(_0x5573('0x12c')));}else{_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12d')));hopperUtils[_0x5573('0x12b')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12e')));}}else{if(isNotNull(this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0x12f')])){delete this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];utils['decrementOriginate'](this['voiceQueues'][_0x58400f[_0x5573('0xb6')]],_0x5573('0x127'));this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]][_0x5573('0x10a')]+=0x1;_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);_0x30b6c4[_0x5573('0x6b')]=0x10;_0x30b6c4[_0x5573('0x6c')]='AnswerAGI';_0x30b6c4['membername']=_0x5573('0x130');hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12d')));hopperUtils[_0x5573('0x12b')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x5573('0x24')][_0x58e14a['uniqueid']];utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]],'[syncHangup2]');if(_0x58e14a[_0x5573('0x131')]==='Normal\x20Clearing'){this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]]['outboundAnswerCallsDay']+=0x1;const _0x2ab1f4=new AgentComplete(_0x58400f,_0x58e14a);_0x2ab1f4[_0x5573('0xe5')]=this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]]['id'];hopperUtils['createHistory'](_0x2ab1f4)[_0x5573('0x9a')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5573('0x12b')](_0x2ab1f4)['catch'](loggerCatch(_0x5573('0xc5')));}else{this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0x132')]+=0x1;_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);_0x30b6c4[_0x5573('0x6b')]=0xc;_0x30b6c4[_0x5573('0x6c')]=_0x58e14a[_0x5573('0x131')];_0x30b6c4[_0x5573('0x10b')]='Unknown';hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0x5573('0x12b')](_0x30b6c4)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer[_0x5573('0x80')][_0x5573('0x8')]=function(_0x1ed661){var _0x137604=this;if(!_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]]){_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]]={'running':![]};}else if(_0x137604['queuesSummary'][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]===!![]){return;}else if(_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]===![]){_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]=!![];}var _0x1f9271=_0x137604['voiceQueues'][_0x1ed661[_0x5573('0x46')]];var _0x3a53c1=_0x1f9271[_0x5573('0x6a')]!==utils['CAMPAIGN_STATUS'][_0x5573('0x78')];var _0x207acb=utils[_0x5573('0x134')](_0x1f9271);_0x1f9271['statusMessage']=utils[_0x5573('0x135')](_0x1f9271,_0x137604['trunks']);Promise[_0x5573('0xa3')]()[_0x5573('0x97')](function(){if(_0x1f9271[_0x5573('0x136')]===utils[_0x5573('0x65')][_0x5573('0x78')]){if(_0x3a53c1){clearPredictiveAttributes(_0x1f9271);_0x1ed661[_0x5573('0x26')]=undefined;_0x1ed661[_0x5573('0x60')]=undefined;}if(_0x1f9271[_0x5573('0x136')]===utils['CAMPAIGN_STATUS'][_0x5573('0x78')]){_0x1ed661[_0x5573('0x137')]=0x0;_0x1ed661[_0x5573('0xee')]=0x0;_0x1ed661[_0x5573('0x138')]=0x0;_0x1ed661[_0x5573('0x139')]=0x0;_0x1ed661[_0x5573('0x13a')]=0x0;}}else if(_0x1f9271['statusMessage']===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x207acb){return _0x137604['ifTime'](_0x1f9271,!![])[_0x5573('0x97')](function(){return _0x137604[_0x5573('0x8e')](_0x1f9271,![]);})[_0x5573('0x97')](function(){return _0x137604[_0x5573('0xa7')](_0x1f9271);})[_0x5573('0x9a')](function(_0x5c03e1){loggerSyncQueueSummary['debug'](_0x5573('0x13b'),util[_0x5573('0x43')](_0x5c03e1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1f9271);});}else{clearPredictiveAttributes(_0x1f9271);}})[_0x5573('0x97')](function(){var _0x34026e=_0x1ed661['compareToOutboundQueue'](_0x1f9271);if(_0x34026e||_0x1f9271[_0x5573('0x13c')]){_0x1f9271[_0x5573('0x13c')]=![];_0x1ed661['updateReportFromOutboundQueue'](_0x1f9271);Object[_0x5573('0x13d')](_0x1f9271,_0x1ed661);emitOutboundVoiceQueueSummary(_0x1ed661);}_0x137604[_0x5573('0x29')][_0x1f9271[_0x5573('0x46')]][_0x5573('0x133')]=![];})[_0x5573('0x9a')](function(_0x593521){logger[_0x5573('0x63')](_0x5573('0x13b'),util[_0x5573('0x43')](_0x593521,{'showHidden':![],'depth':null}));_0x137604[_0x5573('0x29')][_0x1f9271[_0x5573('0x46')]][_0x5573('0x133')]=![];});};Dialer[_0x5573('0x80')][_0x5573('0x13e')]=_['throttle'](function(){var _0x3b2d18=_[_0x5573('0x13f')](this[_0x5573('0x1c')],function(_0x2bbc35){return _0x2bbc35['dialPreviewRecallmeReminder'];});var _0x4c4a35=_[_0x5573('0x13f')](this[_0x5573('0x1e')],function(_0x29f2dc){return _0x29f2dc['online']&&_0x29f2dc[_0x5573('0x83')]===_0x5573('0x84');});if(_0x3b2d18[_0x5573('0x92')]>0x0&&_0x4c4a35[_0x5573('0x92')]>0x0){return Promise[_0x5573('0xa3')]()[_0x5573('0x97')](cmHopper[_0x5573('0x140')](_[_0x5573('0x141')](_0x3b2d18,'id'),previewRecallmeReminderInterval,_[_0x5573('0x141')](_0x4c4a35,'id')))[_0x5573('0x97')](function(_0x144e59){for(var _0x1e1e72=0x0;_0x1e1e72<_0x144e59[_0x5573('0x92')];_0x1e1e72++){var _0x1f35e3=_0x144e59[_0x1e1e72][_0x5573('0x142')]['name'];if(_0x1f35e3)io['to'](util[_0x5573('0x44')](_0x5573('0x143'),_0x1f35e3))['emit'](_0x5573('0x144'),{'hopper':_0x144e59[_0x1e1e72]});}})[_0x5573('0x9a')](function(_0x32d75d){logger[_0x5573('0x63')](_0x5573('0x145'),_0x32d75d);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5330c6=this;setInterval(function(){_0x5330c6[_0x5573('0x146')](_0x5330c6[_0x5573('0x24')],_0x5573('0x147'));_0x5330c6[_0x5573('0x146')](_0x5330c6[_0x5573('0x22')],_0x5573('0x148'));},0x32c8);};Dialer[_0x5573('0x80')][_0x5573('0x146')]=function(_0x464ed2,_0x5b0ced){var _0x50e911=this;for(var _0x35f4d2 in _0x464ed2){if(typeof _0x464ed2[_0x35f4d2]!==_0x5573('0xa2')){this[_0x5573('0x149')][_0x5573('0x18')](function(){if(!_[_0x5573('0xf6')](_0x464ed2[_0x35f4d2])){return ami[_0x5573('0x94')]({'action':_0x5573('0x83'),'channel':_0x464ed2[_0x35f4d2][_0x5573('0xe8')]})[_0x5573('0x9a')](function(_0x3f7013){if(_0x3f7013[_0x5573('0x6a')]===_0x5573('0x14a')){setTimeout(function(){if(_0x464ed2[_0x35f4d2]&&_0x464ed2[_0x35f4d2][_0x5573('0x3f')]!==_0x5573('0xb8')){utils[_0x5573('0xb9')](_0x50e911[_0x5573('0x1c')][_0x464ed2[_0x35f4d2]['queue']],_0x5573('0x14b'));logger[_0x5573('0x63')]('[Dialer][checkChannel]',_0x5b0ced,_0x35f4d2,_0x464ed2[_0x35f4d2][_0x5573('0xb6')]);delete _0x464ed2[_0x35f4d2];}if(_0x464ed2[_0x35f4d2]&&_0x464ed2[_0x35f4d2][_0x5573('0x3f')]==='ivr'){utils[_0x5573('0xb9')](_0x50e911[_0x5573('0x1d')][_0x464ed2[_0x35f4d2]['queue']],'[clearZombieChannels]');logger[_0x5573('0x63')](_0x5573('0x14c'),_0x5b0ced,_0x35f4d2,_0x464ed2[_0x35f4d2]['queue']);delete _0x464ed2[_0x35f4d2];}},0x2328);}});}});}}};Dialer[_0x5573('0x80')][_0x5573('0x14d')]=function(_0x4cbc94){return Promise[_0x5573('0xa3')]()[_0x5573('0x97')](voiceQueueRt['getVoiceQueueRtPauses'](_0x4cbc94))[_0x5573('0x9a')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x5573('0x80')]['emptyContact']=function(_0x3965fd,_0x346e8c,_0x3365d4){var _0x1e9556={'state':0x19,'statedesc':_0x5573('0x14e')};utils[_0x5573('0xb9')](_0x346e8c,_0x5573('0x14f')+_0x3965fd);this[_0x5573('0x10f')](_[_0x5573('0x5e')](_0x1e9556,_[_0x5573('0x72')](_0x3365d4,[_0x5573('0xf3'),_0x5573('0xda'),_0x5573('0x150'),_0x5573('0xe5'),_0x5573('0xdb')])),'[emptyContact][createHistory]',_0x5573('0x14f'));logger['error'](_0x3965fd);};Dialer[_0x5573('0x80')][_0x5573('0x10f')]=function(_0x4bda37,_0x2ce8ca,_0x2e9120){hopperUtils[_0x5573('0xc3')](_0x4bda37)[_0x5573('0x9a')](loggerCatch(_0x2ce8ca));hopperUtils[_0x5573('0x12b')](_0x4bda37)['catch'](loggerCatch(_0x2e9120));};Dialer['prototype'][_0x5573('0xd7')]=function(_0x347347,_0x75c315){hopperUtils[_0x5573('0xc3')](_0x347347)['catch'](loggerCatch(_0x5573('0xc4')));if(_0x75c315==0x0){hopperUtils[_0x5573('0x12b')](_0x347347)['catch'](loggerCatch(_0x5573('0x151')));}};Dialer[_0x5573('0x80')]['checkPreviewRecallReminder']=function(_0x2f3523){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_0x2f3523['id'],previewRecallmeReminderInterval))['then'](function(_0x452bf9){for(var _0x84a24c=0x0;_0x84a24c<_0x452bf9[_0x5573('0x92')];_0x84a24c++){var _0x2cb31e=_0x452bf9[_0x84a24c][_0x5573('0x142')][_0x5573('0x46')];if(_0x2cb31e)io['to'](util[_0x5573('0x44')]('user:%s',_0x2cb31e))[_0x5573('0x3e')](_0x5573('0x144'),{'hopper':_0x452bf9[_0x84a24c]});}})['catch'](function(){});};Dialer[_0x5573('0x80')]['launchHandleIvr']=function(_0x2285e3){var _0x365173=this;return function(){_0x365173[_0x5573('0x152')](_0x2285e3);};};Dialer[_0x5573('0x80')][_0x5573('0x153')]=function(_0x4a9c7d,_0xcc82e9){var _0xd4a547=this;var _0x1c236b=uuid['v4']();this[_0x5573('0x22')][_0x1c236b]=new Action(_0x4a9c7d,_0xcc82e9,_0x1c236b);return new Promise(function(_0x47d1c2,_0x4fcf3f){if(_[_0x5573('0x3d')](_0x4a9c7d)&&typeof _0x4a9c7d!==_0x5573('0x154')){return _0x4fcf3f(msgResponse(_0x5573('0x155'),_0x5573('0x8f'),_0x5573('0x156')));}if(_[_0x5573('0x3d')](_0xcc82e9[_0x5573('0x157')])||_0xcc82e9[_0x5573('0x157')]===null){return _0x4fcf3f(msgResponse('originate',_0x5573('0x8f'),_0x5573('0x158')));}var _0x3fa347={'XMD-CALLERID':_0xd4a547[_0x5573('0x22')][_0x1c236b][_0x5573('0x159')](),'XMD-AGI':_0x4a9c7d[_0x5573('0x12f')]?util[_0x5573('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4a9c7d[_0x5573('0x12f')]):_0x5573('0x15a'),'XMD-AGIAFTER':_0x4a9c7d['dialQueueProject2']?util['format'](_0x5573('0x15b'),ipAgi,_0x4a9c7d[_0x5573('0xc0')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x4a9c7d)?util[_0x5573('0x44')](_0x5573('0x15c'),_0x4a9c7d[_0x5573('0x46')],_0x4a9c7d[_0x5573('0x15d')]||'',_0x4a9c7d['dialAgiAfterHangupAgent']?'c':'',_0x4a9c7d[_0x5573('0xca')]||0x3):_0x5573('0x15a'),'XMD-CONTACTID':_0xcc82e9[_0x5573('0xf3')],'XMD-CDRTYPE':_0x5573('0x5'),'CALLERID(all)':_0xd4a547['actions'][_0x1c236b][_0x5573('0x159')](),'XMD-AMD':_0x4a9c7d[_0x5573('0x112')]?_0x5573('0x15e'):_0x5573('0x15a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4a9c7d[_0x5573('0x112')]){_0x3fa347[_0x5573('0x15f')]=_0x4a9c7d['dialAMDInitialSilence']||0x9c4;_0x3fa347[_0x5573('0x160')]=_0x4a9c7d[_0x5573('0x161')]||0x5dc;_0x3fa347['XMD-AMDAFTERGREETINGSILENCE']=_0x4a9c7d[_0x5573('0x162')]||0x320;_0x3fa347['XMD-AMDTOTALANALYSISTIME']=_0x4a9c7d['dialAMDTotalAnalysisTime']||0x1388;_0x3fa347[_0x5573('0x163')]=_0x4a9c7d['dialAMDMinWordLength']||0x64;_0x3fa347['XMD-AMDBETWEENWORDSSILENCE']=_0x4a9c7d[_0x5573('0x164')]||0x32;_0x3fa347[_0x5573('0x165')]=_0x4a9c7d[_0x5573('0x166')]||0x3;_0x3fa347[_0x5573('0x167')]=_0x4a9c7d[_0x5573('0x168')]||0x100;_0x3fa347[_0x5573('0x169')]=_0x4a9c7d[_0x5573('0x16a')]||0x1388;}if(utils['isOutboundQueue'](_0x4a9c7d)){_0x3fa347[_0x5573('0x16b')]=_0xcc82e9['VoiceQueueId'];}else{_0x3fa347['XMD-CAMPAIGNID']=_0xcc82e9['CampaignId'];}var _0x275385=utils[_0x5573('0x16c')](_0xcc82e9[_0x5573('0x16d')]);Object['assign'](_0x3fa347,_0x275385);var _0x36d847=_0xd4a547[_0x5573('0x87')](_0x4a9c7d[_0x5573('0x88')])?utils[_0x5573('0x16e')](_0x4a9c7d['Trunk'][_0x5573('0x16f')],_0x4a9c7d[_0x5573('0x170')],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5573('0x171')](_0x4a9c7d['dialOriginateCallerIdNumber'],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']):_0x4a9c7d[_0x5573('0x172')]):utils[_0x5573('0x16e')](_[_0x5573('0xf6')](_0x4a9c7d['TrunkBackup'])?_0x4a9c7d[_0x5573('0x88')][_0x5573('0x16f')]:_0x4a9c7d['TrunkBackup'][_0x5573('0x16f')],_0x4a9c7d['dialOriginateCallerIdName'],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5573('0x171')](_0x4a9c7d[_0x5573('0x172')],_0x4a9c7d[_0x5573('0x173')]):_0x4a9c7d[_0x5573('0x172')]);if(_0x36d847){_0x3fa347[_0x5573('0x174')]=_0xd4a547[_0x5573('0x22')][_0x1c236b][_0x5573('0x175')]=utils[_0x5573('0x176')](_0x36d847);_0x3fa347['XMD-ORIGINATECALLERIDNUM']=_0xcc82e9['phone'];}_0x4a9c7d[_0x5573('0x177')]=_0x3fa347;return ami[_0x5573('0x94')]({'actionid':_0x1c236b,'action':_0x5573('0x155'),'channel':_0xd4a547[_0x5573('0x87')](_0x4a9c7d['Trunk'])?util[_0x5573('0x44')]('SIP/%s/%s%s',_0x4a9c7d[_0x5573('0x88')][_0x5573('0x46')],isNotNull(_0x4a9c7d[_0x5573('0x178')])?_0x4a9c7d[_0x5573('0x178')][_0x5573('0x179')]()||'':'',_0x4a9c7d[_0x5573('0x17a')]>0x0?_0xcc82e9['phone']['substring'](_0x4a9c7d[_0x5573('0x17a')]):_0xcc82e9[_0x5573('0x157')]):util[_0x5573('0x44')]('SIP/%s/%s%s',_['isNil'](_0x4a9c7d[_0x5573('0x17b')])?_0x4a9c7d['Trunk'][_0x5573('0x46')]:_0x4a9c7d[_0x5573('0x17b')][_0x5573('0x46')],isNotNull(_0x4a9c7d[_0x5573('0x178')])?_0x4a9c7d[_0x5573('0x178')][_0x5573('0x179')]()||'':'',_0x4a9c7d['dialCutDigit']>0x0?_0xcc82e9[_0x5573('0x157')][_0x5573('0x17c')](_0x4a9c7d['dialCutDigit']):_0xcc82e9['phone']),'callerid':_0x36d847,'Exten':_0x5573('0x108'),'Context':'from-sip','Priority':'1','variable':_0x3fa347,'timeout':(_0x4a9c7d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1c236b})[_0x5573('0x97')](function(_0x30f4e5){return _0x47d1c2(_0x30f4e5);})[_0x5573('0x9a')](function(_0x5580ea){_0x4a9c7d[_0x5573('0x17d')]+=0x1;var _0x1b0ead=new History(_0xd4a547[_0x5573('0x22')][_0x1c236b]);logger[_0x5573('0x63')](util[_0x5573('0x44')](_0x5573('0x17e'),JSON['stringify'](_0x5580ea)));_0x1b0ead[_0x5573('0x6b')]=0xe;_0x1b0ead[_0x5573('0x6c')]=_0x5573('0x17f');_0x1b0ead[_0x5573('0x6e')]=moment()['format'](_0x5573('0xc2'));_0x1b0ead[_0x5573('0x6d')]=_0x1b0ead[_0x5573('0x6e')];hopperUtils[_0x5573('0xc3')](_0x1b0ead)[_0x5573('0x9a')](loggerCatch(_0x5573('0x180')));_0xd4a547['moveContactManagedDialer'](_0x1b0ead)[_0x5573('0x9a')](loggerCatch(_0x5573('0x180')))[_0x5573('0x1a')](function(){delete _0xd4a547[_0x5573('0x22')][_0x1c236b];return _0x4fcf3f(msgResponse(_0x5573('0x155'),_0x5573('0x7f'),'originate\x20action\x20Error'));});});});};Dialer[_0x5573('0x80')][_0x5573('0x181')]=function(_0x1d90a8,_0x4258c6,_0xfadb40){var _0xe46ad2=new History(_0x4258c6);if(_0xe46ad2[_0x5573('0x119')]+_0xe46ad2['countcongestionretry']+_0xe46ad2[_0x5573('0x11b')]+_0xe46ad2[_0x5573('0x11c')]+_0xe46ad2[_0x5573('0xd1')]+_0xe46ad2[_0x5573('0xe3')]+_0xe46ad2[_0x5573('0x117')]+_0xe46ad2[_0x5573('0x11d')]>=_0xfadb40[_0x5573('0x11e')]-0x1){return!![];}switch(_0x1d90a8){case 0x3:if(_0xe46ad2[_0x5573('0x11b')]>=_0xfadb40[_0x5573('0x182')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xe46ad2[_0x5573('0x11b')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x183')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xe46ad2[_0x5573('0x119')]>=_0xfadb40['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countbusyretry':_0xe46ad2[_0x5573('0x119')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40['dialBusyRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xe46ad2['countcongestionretry']>=_0xfadb40['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countcongestionretry':_0xe46ad2[_0x5573('0x11a')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x184')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})['catch'](loggerCatch(_0x5573('0x185')));break;case 0x0:if(_0xe46ad2[_0x5573('0x11c')]>=_0xfadb40['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countnosuchnumberretry':_0xe46ad2[_0x5573('0x11c')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40['dialNoSuchNumberRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2['ListId'],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xe46ad2['countdropretry']>=_0xfadb40['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countdropretry':_0xe46ad2[_0x5573('0xd1')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0xd8')],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x186')));break;case 0xb:if(_0xe46ad2[_0x5573('0xe3')]>=_0xfadb40[_0x5573('0x187')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xe46ad2['countabandonedretry']+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0xe2')],_0x5573('0xd9'))['format'](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xe6')));break;case 0x13:if(_0xe46ad2[_0x5573('0x117')]>=_0xfadb40[_0x5573('0x188')]-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0xe46ad2[_0x5573('0x117')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x126')],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2['ContactId'],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x122')));break;case 0x14:if(_0xe46ad2[_0x5573('0x11d')]>=_0xfadb40['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xe46ad2[_0x5573('0x11d')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x189')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x18a')));break;default:return!![];}};Dialer['prototype'][_0x5573('0x18b')]=function(_0x1f820f,_0x10e90f,_0x40c992){var _0x5d19df=this;var _0x369419=new History(_0x1f820f);var _0x1fcaf7=![];var _0x412a4c;var _0x270e5f;return new Promise(function(_0x225825,_0x3d42ed){if(_[_0x5573('0x3d')](_0x10e90f)&&typeof _0x10e90f!==_0x5573('0x154')){return _0x3d42ed(msgResponse(_0x5573('0x18c'),_0x5573('0x8f'),'entity\x20is\x20undefine'));}if(_[_0x5573('0x3d')](_0x40c992)&&typeof _0x40c992!==_0x5573('0x154')){return _0x3d42ed(msgResponse(_0x5573('0x18c'),_0x5573('0x8f'),_0x5573('0x18d')));}hopperUtils[_0x5573('0xd4')](_0x369419,_0x40c992[_0x5573('0xbd')],_0x10e90f)[_0x5573('0x97')](function(_0x307556){if(_0x307556[_0x5573('0xd6')]==0x1)_0x1fcaf7=!![];switch(_0x40c992['reason']){case'0':_0x10e90f[_0x5573('0x18e')]+=0x1;_0x369419['state']=0x0;_0x369419[_0x5573('0x6c')]=_0x5573('0x18f');_0x369419[_0x5573('0x11c')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;ami[_0x5573('0x3e')]('custom:agentnosuchnumber',ut['buildObj'](_0x1f820f,_0x5573('0x190')));_0x412a4c=_0x10e90f[_0x5573('0x191')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x124')));if(_0x5d19df[_0x5573('0x181')](0x0,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countnosuchnumberretry']>=_0x10e90f[_0x5573('0x192')]){_0x5d19df['createStateFinal'](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x193'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x193'));}}break;case'3':_0x10e90f[_0x5573('0x194')]+=0x1;_0x369419[_0x5573('0x6b')]=0x3;_0x369419[_0x5573('0x6c')]='NoAnswer';_0x369419[_0x5573('0x11b')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;var _0x5e5f11=ut[_0x5573('0x195')](_0x1f820f,_0x10e90f);ami[_0x5573('0x3e')](_0x5573('0x196'),_0x5e5f11);_0x412a4c=_0x10e90f[_0x5573('0x183')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils['createHistory'](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5d19df[_0x5573('0x181')](0x3,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countnoanswerretry']>=_0x10e90f[_0x5573('0x182')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x197'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x197'));}}break;case'5':_0x10e90f[_0x5573('0x198')]+=0x1;_0x369419[_0x5573('0x6b')]=0x5;_0x369419[_0x5573('0x6c')]='Busy';_0x369419[_0x5573('0x119')]+=0x1;_0x369419['countglobal']+=0x1;ami[_0x5573('0x3e')](_0x5573('0x199'),ut['buildObj'](_0x1f820f,_0x5573('0x19a')));_0x412a4c=_0x10e90f[_0x5573('0x19b')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x19c')));if(_0x5d19df[_0x5573('0x181')](0x5,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0x119')]>=_0x10e90f[_0x5573('0x19d')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x19e'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x19e'));}}break;case'8':_0x10e90f[_0x5573('0x19f')]+=0x1;_0x369419['state']=0x8;_0x369419[_0x5573('0x6c')]=_0x5573('0x1a0');_0x369419[_0x5573('0x11a')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;_0x412a4c=_0x10e90f[_0x5573('0x184')];_0x270e5f=_0x10e90f['callAdditionalPhoneAfterMin'];ami[_0x5573('0x3e')](_0x5573('0x1a1'),ut[_0x5573('0x118')](_0x1f820f,'congestion'));hopperUtils[_0x5573('0xc3')](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5d19df[_0x5573('0x181')](0x8,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0x11a')]>=_0x10e90f['dialCongestionMaxRetry']){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a2'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a2'));}}break;case'11':_0x10e90f['outboundAbandonedCallsDay']+=0x1;_0x369419[_0x5573('0x6b')]=0xb;_0x369419[_0x5573('0x6c')]=_0x5573('0xe0');_0x369419['countabandonedretry']+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;_0x412a4c=_0x10e90f[_0x5573('0xe2')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5d19df['checkRetriveMax'](0xb,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0xe3')]>=_0x10e90f[_0x5573('0x187')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a3'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,'reason\x2011\x20abandoned');}}break;case'20':_0x10e90f[_0x5573('0x1a4')]+=0x1;_0x369419[_0x5573('0x6b')]=0x14;_0x369419['statedesc']=_0x5573('0x1a5');_0x369419[_0x5573('0x11d')]+=0x1;_0x369419['countglobal']+=0x1;_0x412a4c=_0x10e90f[_0x5573('0x189')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];ami[_0x5573('0x3e')](_0x5573('0x1a6'),ut[_0x5573('0x118')](_0x1f820f,_0x5573('0x1a7')));hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x1a8')));if(_0x5d19df['checkRetriveMax'](0x14,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countagentrejectretry']>=_0x10e90f[_0x5573('0x1a9')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1aa'));}else{_0x5d19df['stateGlobal'](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1aa'));}}break;default:_0x10e90f[_0x5573('0x132')]+=0x1;_0x369419['state']=0xc;_0x369419[_0x5573('0x6c')]=_0x40c992[_0x5573('0xbd')];_0x412a4c=_0x10e90f[_0x5573('0x189')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils['createHistory'](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x1ab')));if(_0x5d19df[_0x5573('0x181')](_0x40c992['reason'],_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countbusyretry']+_0x369419[_0x5573('0x11a')]+_0x369419['countnoanswerretry']+_0x369419[_0x5573('0x11c')]+_0x369419[_0x5573('0xd1')]+_0x369419[_0x5573('0xe3')]+_0x369419['countmachineretry']+_0x369419[_0x5573('0x11d')]>=_0x10e90f['dialGlobalMaxRetry']){_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x40c992[_0x5573('0xbd')]);}else{_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x40c992[_0x5573('0xbd')]);}}}})[_0x5573('0x97')](function(){if(_0x1fcaf7){hopperUtils[_0x5573('0xdf')](_0x369419,_0x412a4c,_0x270e5f)['then'](function(){return _0x225825(0x1);});}});});};Dialer[_0x5573('0x80')][_0x5573('0x11f')]=function(_0x29e79d,_0x363efd,_0x125714,_0x5e3ad9){var _0x42808c=new Final(_0x29e79d);_0x42808c['state']=0xf;_0x42808c[_0x5573('0x6c')]=_0x5573('0x1ac');this[_0x5573('0x125')](_0x42808c,_0x363efd,_0x125714,_0x5e3ad9);};Dialer['prototype']['createStateFinal']=function(_0x3767e5,_0x296de2,_0x46a47f,_0x254297){hopperUtils['moveContactManagedDialer'](_0x3767e5)['then'](function(){return _0x296de2(msgResponse('[callProgressDetecting]',_0x5573('0x102'),_0x254297));})[_0x5573('0x9a')](function(){return _0x46a47f(msgResponse('[moveContactManagedDialer][0]',_0x5573('0x8f'),_0x5573('0x1ad')));});};Dialer[_0x5573('0x80')]['predictive']=function(_0x2f9539){var _0x151016=_0x2f9539[_0x5573('0x1ae')]/0x64;var _0x339310=_0x2f9539[_0x5573('0xcc')]/(_0x2f9539['outboundDropCallsDayTimeout']+_0x2f9539[_0x5573('0xbc')]);var _0x32ebc=Math[_0x5573('0x1af')](_0x2f9539['predictiveIntervalAvailable']*(_0x2f9539[_0x5573('0x1b0')]/0x64));var _0x122127=Math[_0x5573('0x1af')](_0x2f9539[_0x5573('0x1b1')]*(_0x2f9539['predictiveIntervalMinThreshold']/0x64));var _0x11ace6=_0x2f9539[_0x5573('0x137')]+_0x2f9539[_0x5573('0x139')];var _0x59d867=Math[_0x5573('0x1b2')](_0x2f9539[_0x5573('0x1b3')]*_0x2f9539[_0x5573('0x5c')]*_0x2f9539[_0x5573('0x1b4')]*_0x2f9539['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2f9539[_0x5573('0x60')])){if(!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x26')])){_0x2f9539['startPredictive']=undefined;loggerPredictive[_0x5573('0x63')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x62')])){loggerPredictive[_0x5573('0x63')](_0x5573('0x1b5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2f9539[_0x5573('0x62')]);_0x2f9539[_0x5573('0x62')]=undefined;}_0x2f9539[_0x5573('0x60')]=moment()[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2f9539[_0x5573('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x2f9539['startProgressive']);this[_0x5573('0x1b6')](_0x2f9539,0x1);}else if(ifInterval(_0x2f9539['dialPredictiveInterval'],_0x2f9539['startProgressive'])){this[_0x5573('0x1b6')](_0x2f9539,0x1);loggerPredictiveCalls[_0x5573('0x48')](_0x5573('0x1b7'),_0x2f9539[_0x5573('0x60')],_0x2f9539[_0x5573('0x46')]);_0x2f9539[_0x5573('0x1b3')]=0x0;_0x2f9539[_0x5573('0xcd')]=0x0;}else if(_0x151016<_0x339310&&_0x2f9539[_0x5573('0x1b8')]===_0x5573('0x1b9')){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5573('0x1ba'),_0x339310,_0x5573('0x60'),_0x2f9539['name']);}else if(_0x59d867<_0x2f9539[_0x5573('0xcd')]&&_0x2f9539['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x5573('0x1bb'),_0x5573('0x1bc'),_0x59d867,_0x5573('0x1bd'),_0x2f9539[_0x5573('0xcd')],_0x5573('0x60'),_0x2f9539[_0x5573('0x46')]);}else if(!ifInterval(_0x2f9539[_0x5573('0x1be')],_0x2f9539['startProgressive'])&&_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x26')])&&!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x60')])){_0x2f9539['startPredictive']=moment()['format'](_0x5573('0xc2'));loggerPredictive['info'](_0x2f9539['name'],_0x5573('0x1bf'),_0x2f9539[_0x5573('0x26')]);hopperUtils['avgHandleTime'](_0x2f9539['dialPredictiveInterval'])[_0x5573('0x97')](this[_0x5573('0x1c0')](_0x2f9539))[_0x5573('0x97')](mergeDataErlangB(_0x2f9539))['then'](this[_0x5573('0x1c1')](_0x2f9539))[_0x5573('0x9a')](loggerCatchPredictive(_0x5573('0x1c2'),_0x2f9539));}else if(!ifInterval(_0x2f9539['dialPredictiveInterval'],_0x2f9539['startPredictive'])){_0x2f9539[_0x5573('0xcd')]=0x0;_0x2f9539['startPredictive']=moment()[_0x5573('0x44')](_0x5573('0xc2'));loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c3'),_0x2f9539[_0x5573('0x26')]);clearInterval(_0x2f9539[_0x5573('0x62')]);_0x2f9539[_0x5573('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x2f9539[_0x5573('0x1be')])[_0x5573('0x97')](this[_0x5573('0x1c0')](_0x2f9539))[_0x5573('0x97')](mergeDataErlangB(_0x2f9539))[_0x5573('0x97')](this['startMethodPredictive'](_0x2f9539))[_0x5573('0x9a')](loggerCatchPredictive(_0x5573('0x1c4'),_0x2f9539));}else if(_0x2f9539['predictiveIntervalAvailable']&&_0x11ace6<_0x2f9539['predictiveIntervalAvailable']-_0x122127){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c5'),_0x11ace6,')\x20are\x20less\x20than\x20threshold\x20(',_0x2f9539[_0x5573('0x1b1')],'-',_0x122127,'=',_0x2f9539[_0x5573('0x1b1')]-_0x122127,')');}else if(_0x2f9539[_0x5573('0x1b1')]&&_0x11ace6>_0x2f9539['predictiveIntervalAvailable']+_0x32ebc){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c5'),_0x11ace6,_0x5573('0x1c6'),_0x2f9539[_0x5573('0x1b1')],'+',_0x32ebc,'=',_0x2f9539[_0x5573('0x1b1')]+_0x32ebc,')');}};Dialer[_0x5573('0x80')]['getDataPredictive']=function(_0x4744ad){var _0x5ab99c=this;return function(_0x36451d){return new Promise(function(_0x5280d7,_0xa10000){_[_0x5573('0x5e')](_0x4744ad,_0x36451d[0x0]);if(checkGetDataPredictive(_0x36451d[0x0])){var _0x3e21d9=_0x4744ad[_0x5573('0x1b1')]=_0x4744ad['talking']+_0x4744ad[_0x5573('0x137')];var _0x478923=_0x4744ad[_0x5573('0x1be')]*0x3c;var _0x22febf=_0x36451d[0x0]['predictiveIntervalAvgTalktime']+_0x36451d[0x0][_0x5573('0x51')];var _0x2b40a3=(_0x36451d[0x0][_0x5573('0x4d')]+_0x36451d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36451d[0x0][_0x5573('0x4f')])/_0x36451d[0x0][_0x5573('0x4b')];_0x4744ad[_0x5573('0x1b4')]=_0x2b40a3>0x0?_0x2b40a3:0x1;switch(_0x4744ad[_0x5573('0x1b8')]){case'dropRate':var _0x1b0fab=_0x4744ad['dialPredictiveOptimizationPercentage']/0x64;return _0x5ab99c['abandonmentRate'](_0x3e21d9,_0x478923,_0x22febf,_0x2b40a3,_0x1b0fab)[_0x5573('0x97')](function(_0x3df344){return _0x5280d7(_0x3df344);});case _0x5573('0x1c7'):var _0x1cb182=_0x4744ad[_0x5573('0x1ae')]/0x64;return _0x5ab99c['busyFactor'](_0x3e21d9,_0x478923,_0x22febf,_0x2b40a3,_0x1cb182)[_0x5573('0x97')](function(_0x577807){return _0x5280d7(_0x577807);});default:return _0xa10000(msgResponse(_0x5573('0x1c8'),'Failure','Unknown\x20Predictive'));}}else{return _0xa10000(msgResponse(_0x5573('0x1c8'),'Failure',_0x5573('0x1c9')));}});};};Dialer[_0x5573('0x80')][_0x5573('0x1ca')]=function(_0x59185a){var _0x56b460=this;return function(_0x3a625d){return new Promise(function(_0x11dac7,_0xaf96){_[_0x5573('0x5e')](_0x59185a,_0x3a625d[0x0]);if(checkGetDataPredictive(_0x3a625d[0x0])){loggerPredictive[_0x5573('0x48')](JSON['stringify'](_0x3a625d[0x0]));if(_0x59185a[_0x5573('0x1b8')]===_0x5573('0x1b9')){return _0x56b460[_0x5573('0x14d')](_0x59185a['id'])[_0x5573('0x97')](function(_0x3555f1){var _0x3dd3ea=_0x59185a['loggedIn']-_0x3555f1[0x0][_0x5573('0x1cb')];var _0x514c3a=_0x59185a['dialPredictiveInterval']*0x3c;var _0x5a82ac=_0x3a625d[0x0][_0x5573('0x54')]+_0x3a625d[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b0b41=(_0x3a625d[0x0][_0x5573('0x4d')]+_0x3a625d[0x0][_0x5573('0xcb')]+_0x3a625d[0x0][_0x5573('0x4f')])/_0x3a625d[0x0][_0x5573('0x4b')];var _0x34ebad=_0x59185a['dialPredictiveOptimizationPercentage']/0x64;_0x59185a[_0x5573('0x1cc')]=_0x3555f1[0x0]['outboundQueuePauses']||0x0;_0x59185a[_0x5573('0x1b4')]=_0x5b0b41>0x0?_0x5b0b41:0x1;return _0x56b460[_0x5573('0x1cd')](_0x3dd3ea,_0x514c3a,_0x5a82ac,_0x5b0b41,_0x34ebad);})[_0x5573('0x97')](function(_0x4de4c2){return _0x11dac7(_0x4de4c2);})[_0x5573('0x9a')](function(_0x5e6099){return _0xaf96(msgResponse(_0x5573('0x1ce'),'Failure',JSON[_0x5573('0x71')](_0x5e6099)));});}if(_0x59185a['dialPredictiveOptimization']==='agentBusyFactor'){return _0x56b460[_0x5573('0x14d')](_0x59185a['id'])['then'](function(_0x1adec4){var _0x31219d=_0x59185a[_0x5573('0x1cf')]-_0x1adec4[0x0][_0x5573('0x1cb')];var _0x439b62=_0x59185a[_0x5573('0x1be')]*0x3c;var _0x1c3867=_0x3a625d[0x0]['predictiveIntervalAvgTalktime']+_0x3a625d[0x0]['predictiveIntervalAvgHoldtime'];var _0x56daa8=(_0x3a625d[0x0]['predictiveIntervalAnsweredCalls']+_0x3a625d[0x0][_0x5573('0xcb')]+_0x3a625d[0x0][_0x5573('0x4f')])/_0x3a625d[0x0][_0x5573('0x4b')];var _0x24e584=_0x59185a[_0x5573('0x1ae')]/0x64;_0x59185a[_0x5573('0x1cc')]=_0x1adec4[0x0][_0x5573('0x1cb')]||0x0;_0x59185a['predictiveIntervalHitRate']=_0x56daa8>0x0?_0x56daa8:0x1;return _0x56b460['busyFactor'](_0x31219d,_0x439b62,_0x1c3867,_0x56daa8,_0x24e584);})[_0x5573('0x97')](function(_0x128bcd){return _0x11dac7(_0x128bcd);})['catch'](function(_0xc390c4){return _0xaf96(msgResponse(_0x5573('0x1ce'),_0x5573('0x8f'),JSON[_0x5573('0x71')](_0xc390c4)));});}}else{return _0xaf96(msgResponse(_0x5573('0x1c8'),_0x5573('0x8f'),'check\x20failure'));}});};};Dialer[_0x5573('0x80')][_0x5573('0x1c1')]=function(_0x3298c8){var _0x1cc9c8=this;return function(){var _0x3e5371=0x0;var _0x5180c9=Math[_0x5573('0x1b2')](_0x3298c8[_0x5573('0x5a')]*0x3e8);if(_0x5180c9>0x0){_0x5180c9=_0x5180c9<0x64?0x64:_0x5180c9;loggerPredictive[_0x5573('0x48')](_0x3298c8['name'],_0x5573('0x1d0'),_0x5180c9,'milliseconds');_0x3298c8['handlePredictive']=setInterval(function(){_0x1cc9c8[_0x5573('0x62')](_0x3298c8);loggerPredictiveCalls['info'](_0x5573('0x1d1'),_0x3e5371+=0x1);},_0x5180c9);}else{loggerPredictive[_0x5573('0x48')](_0x3298c8[_0x5573('0x46')],_0x5573('0x1d2'));}};};Dialer[_0x5573('0x80')][_0x5573('0x1d3')]=function(_0x2a2980,_0x196a90){var _0x49fce6=this;return function(_0xd1b027){if(_[_0x5573('0x76')](_0xd1b027)){if(_['isNil'](_0x196a90['UserId'])||!_0x196a90[_0x5573('0x1d4')]){if(_0x2a2980[_0x5573('0x1d5')]===_0x5573('0x1d6')){_0x2a2980[_0x5573('0x6f')]=_[_0x5573('0x3d')](_0x2a2980[_0x5573('0x6f')])?!![]:_0x2a2980[_0x5573('0x6f')];var _0x53711a=uuid['v4']();_0x49fce6[_0x5573('0x22')][_0x53711a]=new Action(_0x2a2980,_0x196a90,_0x53711a);loggerBooked['info']('[booked][checkContactBlack]',_0x53711a,_0x5573('0x1d7'),JSON[_0x5573('0x71')](_0x2a2980['queueStatusComplete']),_0x5573('0x1d8'),_0x2a2980['name']);if(_0x2a2980['queueStatusComplete']){_0x2a2980['queueStatusComplete']=![];_0x49fce6[_0x5573('0x27')][_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xb6')]]=[];ami[_0x5573('0x94')]({'actionid':_0x53711a,'action':_0x5573('0x1d9'),'queue':_0x2a2980[_0x5573('0x46')]})[_0x5573('0x9a')](function(){utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xf3')],'ListId':_0x49fce6['actions'][_0x53711a][_0x5573('0xda')],'VoiceQueueId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xe5')]||undefined,'CampaignId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xdb')]||undefined})['catch'](loggerCatch(_0x5573('0x1db')));delete _0x49fce6[_0x5573('0x22')][_0x53711a];});}else{loggerBooked[_0x5573('0x48')](_0x5573('0x1dc'),JSON[_0x5573('0x71')](_0x2a2980[_0x5573('0x6f')]),'Queue:\x20',_0x2a2980['name']);utils[_0x5573('0xb9')](_0x2a2980,'[checkContactBlack]');hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xf3')],'ListId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xda')],'VoiceQueueId':_0x49fce6['actions'][_0x53711a][_0x5573('0xe5')]||undefined,'CampaignId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x1db')));delete _0x49fce6['actions'][_0x53711a];}}else{return _0x49fce6[_0x5573('0x153')](_0x2a2980,_0x196a90);}}else{if(utils[_0x5573('0x5f')](undefined,_0x196a90[_0x5573('0x1dd')])<_0x2a2980[_0x5573('0x1de')]*0x3c){if(_0x196a90[_0x5573('0x142')]&&!_0x196a90[_0x5573('0x142')][_0x5573('0x1df')]){_0x49fce6['preview'][_0x5573('0xfb')](_0x196a90['id'])['finally'](function(){utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));});}else{hopperUtils[_0x5573('0x1e0')]({'active':![]},_0x196a90['id'],0x1)[_0x5573('0x1a')](function(){utils['decrementOriginate'](_0x2a2980,_0x5573('0x1da'));});}}else{_0x2a2980['outboundReCallsDay']+=0x1;utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));if(_0x2a2980[_0x5573('0x1e1')]){hopperUtils[_0x5573('0xf2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x196a90['ContactId'],'ListId':_0x196a90[_0x5573('0xda')],'VoiceQueueId':_0x196a90[_0x5573('0xe5')]||undefined,'CampaignId':_0x196a90[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x5573('0xc3')](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')]['QUEUE_RECALL'],0x17,_0x5573('0x1e2')))[_0x5573('0x9a')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x49fce6['saveInDb'](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')][_0x5573('0x1e3')],0x16,_0x5573('0x1e4')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2a2980[_0x5573('0x1e5')]+=0x1;_0x49fce6['saveInDb'](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')][_0x5573('0x1e6')],0xd,'Blacklist'),_0x5573('0x1e7'),'[Originate][MoveBlacklist]');throw _0x5573('0x1e8');}};};Dialer['prototype']['handleIvr']=function(_0x541f38){var _0x22af25=this;var _0x44d4e6=_0x541f38['limitCalls']-_0x541f38[_0x5573('0x7d')];emitCampaignSummary(_0x541f38);if(_0x44d4e6>0x0&&_0x541f38['temp']==0x0){if(_0x44d4e6>this[_0x5573('0x20')]){_0x44d4e6=this['maxNumberOriginate'];}_0x541f38['temp']=0x1;hopperUtils[_0x5573('0x1e9')](_0x541f38,_0x44d4e6)[_0x5573('0x97')](function(_0x201d16){_0x541f38['temp']=0x0;if(_0x201d16){if(!utils[_0x5573('0x1ea')](_0x201d16)){_0x541f38['message']=utils[_0x5573('0x65')]['NO_AVAILABLE_CONTACTS'];logger[_0x5573('0x48')](_0x5573('0x1eb')+_0x541f38['name']);}else{_0x541f38[_0x5573('0x7d')]+=_0x201d16[_0x5573('0x92')];_0x541f38[_0x5573('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5573('0x1ec')];for(var _0x125e52=0x0;_0x125e52<_0x201d16[_0x5573('0x92')];_0x125e52+=0x1){_0x541f38['ivrTotalCallsDays']+=0x1;if(_[_0x5573('0xf6')](_0x201d16[_0x125e52])||_['isNil'](_0x201d16[_0x125e52][_0x5573('0x16d')])||_[_0x5573('0xf6')](_0x201d16[_0x125e52][_0x5573('0x157')])){_0x22af25[_0x5573('0x1ed')](_0x5573('0x1ee'),_0x541f38,_0x201d16[_0x125e52]);}else{hopperUtils[_0x5573('0x1ef')](_[_0x5573('0x72')](_0x201d16[_0x125e52],['CampaignId',_0x5573('0x157')]))[_0x5573('0x97')](_0x22af25[_0x5573('0x1d3')](_0x541f38,_0x201d16[_0x125e52]))[_0x5573('0x9a')](function(_0x364608){logger[_0x5573('0x63')](_0x5573('0x1f0'),_0x364608);utils[_0x5573('0xb9')](_0x541f38,'[handleIvr]');});}}}}})[_0x5573('0x9a')](function(_0x3bd168){_0x541f38[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0x3bd168);});}};Dialer[_0x5573('0x80')]['handlePower']=function(_0x1a34fa,_0x41e32c){var _0x577da5=this;var _0x1d453d=[];if(_0x41e32c<0x1||_0x1a34fa[_0x5573('0x1d5')]===_0x5573('0x1d6')){_0x41e32c=0x1;}var _0x32c7dc=Math[_0x5573('0x1b2')](_0x1a34fa['available']*_0x41e32c)-_0x1a34fa[_0x5573('0x7d')];if(_0x1a34fa[_0x5573('0x1f3')]>0x0){var _0x3d3542=_0x1a34fa['dialLimitQueue']-_0x1a34fa[_0x5573('0x7d')]-_0x1a34fa[_0x5573('0x139')]-_0x1a34fa[_0x5573('0x13a')];if(_0x32c7dc>_0x3d3542){_0x32c7dc=_0x3d3542;}}if(_0x32c7dc>0x0&&_0x1a34fa['temp']==0x0){if(_0x1a34fa[_0x5573('0x1d5')]==='booked'){_0x32c7dc=0x1;}if(_0x32c7dc>this[_0x5573('0x20')]){_0x32c7dc=this['maxNumberOriginate'];}for(var _0x445f53 in this[_0x5573('0x1e')]){if(typeof this[_0x5573('0x1e')][_0x445f53]!=='undefined'){if(this['agents'][_0x445f53][_0x5573('0x6b')]===_0x5573('0x1f4')&&this['agents'][_0x445f53][_0x5573('0x83')]==='reachable'){_0x1d453d[_0x5573('0x93')](this[_0x5573('0x1e')][_0x445f53]['id']);}}}_0x1a34fa[_0x5573('0x1f1')]=0x1;hopperUtils[_0x5573('0x1f5')](_0x1a34fa,_0x1d453d,_0x32c7dc)['then'](function(_0x360406){_0x1a34fa[_0x5573('0x1f1')]=0x0;if(_0x360406){if(!utils['checkContactEmpty'](_0x360406)){hopperUtils[_0x5573('0x1f6')](_0x1a34fa)['then'](sendMessageReschedule(_0x1a34fa))[_0x5573('0x9a')](loggerCatch(_0x5573('0x1f7')));}else{_0x1a34fa[_0x5573('0x7d')]+=_0x360406[_0x5573('0x92')];_0x1a34fa[_0x5573('0x6a')]=_0x1a34fa['dialMethod']==='booked'?utils[_0x5573('0x65')][_0x5573('0x15e')]:utils[_0x5573('0x65')][_0x5573('0x1ec')];for(var _0x132016=0x0;_0x132016<_0x360406['length'];_0x132016+=0x1){if(_[_0x5573('0xf6')](_0x360406[_0x132016])||_[_0x5573('0xf6')](_0x360406[_0x132016][_0x5573('0x16d')])||_[_0x5573('0xf6')](_0x360406[_0x132016][_0x5573('0x157')])){_0x577da5['emptyContact'](_0x5573('0x1ee'),_0x1a34fa,_0x360406[_0x132016]);}else{hopperUtils['checkIsBlackList'](_[_0x5573('0x72')](_0x360406[_0x132016],['VoiceQueueId',_0x5573('0x157')]))['then'](_0x577da5[_0x5573('0x1d3')](_0x1a34fa,_0x360406[_0x132016]))[_0x5573('0x9a')](function(_0x4fb485){logger['error']('[actionOriginate]',_0x4fb485);utils[_0x5573('0xb9')](_0x1a34fa,'[handlePower]');});}}}}})['catch'](function(_0x13f897){_0x1a34fa[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0x13f897);});}};Dialer[_0x5573('0x80')][_0x5573('0x62')]=function(_0x30b570){if(_0x30b570[_0x5573('0x1f3')]>0x0){var _0x4c999a=_0x30b570['dialLimitQueue']-_0x30b570['originated']-_0x30b570[_0x5573('0x139')];if(_0x4c999a>0x0&&_0x30b570[_0x5573('0x1f1')]==0x0){this[_0x5573('0x1f8')](_0x30b570);}else{loggerPredictiveCalls[_0x5573('0x48')]('[handlePredictive][limitChannel]');}}else{this[_0x5573('0x1f8')](_0x30b570);}};Dialer[_0x5573('0x80')][_0x5573('0x1f8')]=function(_0x18b352){var _0x80a7bc=this;var _0x1d6d34=[];_0x18b352[_0x5573('0x7d')]+=0x1;for(var _0x4e4de3 in this[_0x5573('0x1e')]){if(typeof this[_0x5573('0x1e')][_0x4e4de3]!=='undefined'){if(this[_0x5573('0x1e')][_0x4e4de3][_0x5573('0x6b')]===_0x5573('0x1f4')&&this[_0x5573('0x1e')][_0x4e4de3]['status']===_0x5573('0x84')){_0x1d6d34[_0x5573('0x93')](this[_0x5573('0x1e')][_0x4e4de3]['id']);}}}_0x18b352[_0x5573('0x1f1')]=0x1;return this[_0x5573('0x1f5')](_0x18b352['id'],_0x1d6d34,0x1,_0x18b352[_0x5573('0x1f9')],_0x18b352)[_0x5573('0x97')](function(_0x437d98){_0x18b352[_0x5573('0x1f1')]=0x1;if(_0x437d98){if(!utils[_0x5573('0x1ea')](_0x437d98)){utils[_0x5573('0x1fa')](_0x18b352,0x1,0x0);return hopperUtils[_0x5573('0x1f6')](_0x18b352)[_0x5573('0x97')](sendMessageReschedule(_0x18b352))[_0x5573('0x9a')](loggerCatch('[countReScheduled]\x20'));}else{_0x18b352['message']=utils[_0x5573('0x65')][_0x5573('0x1ec')];if(_[_0x5573('0xf6')](_0x437d98[0x0])||_[_0x5573('0xf6')](_0x437d98[0x0]['Contact'])||_['isNil'](_0x437d98[0x0][_0x5573('0x157')])){_0x80a7bc[_0x5573('0x1ed')]('[actionOriginate]\x20',_0x18b352,_0x437d98[0x0]);}else{return hopperUtils[_0x5573('0x1fb')](_[_0x5573('0x72')](_0x437d98[0x0],[_0x5573('0xe5'),_0x5573('0x157')]))[_0x5573('0x97')](_0x80a7bc['checkContactBlack'](_0x18b352,_0x437d98[0x0]))[_0x5573('0x9a')](function(_0x47f9eb){logger[_0x5573('0x63')](_0x5573('0x1fc'),_0x47f9eb);utils[_0x5573('0xb9')](_0x18b352,'[actionOriginatePredictive]');});}}}})[_0x5573('0x9a')](function(_0xd092db){_0x18b352[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0xd092db);});};Dialer[_0x5573('0x80')][_0x5573('0x1cd')]=function(_0x25a54c,_0x3a7f83,_0x3aeb60,_0x2b1d04,_0x15ce79,_0xbfaa88){loggerPredictive['info'](_0x5573('0x1fd'));loggerPredictive[_0x5573('0x48')]('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',_0x25a54c);loggerPredictive[_0x5573('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a7f83);loggerPredictive[_0x5573('0x48')](_0x5573('0x1fe'),_0x3aeb60);loggerPredictive['info'](_0x5573('0x1ff'),_0x2b1d04);loggerPredictive[_0x5573('0x48')](_0x5573('0x200'),_0x15ce79);loggerPredictive['info'](_0x5573('0x53'));return new Promise(function(_0x4a7492,_0x4b885a){if(_0x25a54c<=0x0||isNaN(_0x25a54c)){return _0x4b885a(msgResponse('[abandonmentRate]',_0x5573('0x7f'),_0x5573('0x201')+_0x25a54c));}if(_0x3aeb60<=0x0||isNaN(_0x3aeb60)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x203')+_0x3aeb60));}if(_0x2b1d04<=0x0||isNaN(_0x2b1d04)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x204')+_0x2b1d04));}if(_0x3a7f83<=0x0||isNaN(_0x3a7f83)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x205')+_0x3a7f83));}if(_0x15ce79<=0x0||isNaN(_0x15ce79)){return _0x4b885a(msgResponse(_0x5573('0x202'),'Error','Amax\x20=\x20'+_0x15ce79));}_0xbfaa88=_0xbfaa88||0x0;var _0x7d687e=0x1/_0x3aeb60;var _0x53a61f=0x0;var _0x1fe152=0x0;var _0x529a92=0x0;var _0x527188=0x0;for(var _0x38f0e8=0x0;_0x529a92<_0x15ce79;_0x38f0e8+=0x1){_0x1fe152=_0x38f0e8/_0x3a7f83;_0x53a61f=(_0x2b1d04*_0x1fe152+_0xbfaa88)/_0x7d687e;_0x529a92=utils[_0x5573('0x206')](_0x53a61f,_0x25a54c);_0x527188=_0x53a61f/_0x25a54c*(0x1-utils[_0x5573('0x206')](_0x53a61f,_0x25a54c));}return _0x4a7492({'erlangCalls':_0x38f0e8,'erlangCallToSecond':_0x3a7f83/_0x38f0e8,'erlangAbandonmentRate':_0x529a92,'erlangBusyFactor':_0x527188});});};Dialer[_0x5573('0x80')]['busyFactor']=function(_0x5273f3,_0xd08948,_0x4e9593,_0x179d15,_0x29b6ff,_0x3a6b96){loggerPredictive['info'](_0x5573('0x207'));loggerPredictive[_0x5573('0x48')](_0x5573('0x208'),_0x5273f3);loggerPredictive[_0x5573('0x48')](_0x5573('0x209'),_0xd08948);loggerPredictive[_0x5573('0x48')](_0x5573('0x1fe'),_0x4e9593);loggerPredictive[_0x5573('0x48')](_0x5573('0x1ff'),_0x179d15);loggerPredictive[_0x5573('0x48')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29b6ff);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));return new Promise(function(_0x3fa46e,_0x535023){if(_0x5273f3<=0x0||isNaN(_0x5273f3)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'m\x20=\x20'+_0x5273f3));}if(_0x4e9593<=0x0||isNaN(_0x4e9593)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'Ts\x20=\x20'+_0x4e9593));}if(_0x179d15<=0x0||isNaN(_0x179d15)){return _0x535023(msgResponse('[busyFactor]','Error',_0x5573('0x204')+_0x179d15));}if(_0xd08948<=0x0||isNaN(_0xd08948)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'interval\x20=\x20'+_0xd08948));}if(_0x29b6ff<=0x0||isNaN(_0x29b6ff)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),_0x5573('0x20b')+_0x29b6ff));}_0x3a6b96=_0x3a6b96||0x0;var _0x319ed3=0x1/_0x4e9593;var _0x223f9d=0x0;var _0x397c7b=0x0;var _0x5e5219=0x0;var _0x78b4dd=0x0;for(var _0x1a9d49=0x0;_0x78b4dd<_0x29b6ff;_0x1a9d49+=0x1){_0x397c7b=_0x1a9d49/_0xd08948;_0x223f9d=(_0x179d15*_0x397c7b+_0x3a6b96)/_0x319ed3;_0x5e5219=utils[_0x5573('0x206')](_0x223f9d,_0x5273f3);_0x78b4dd=_0x223f9d/_0x5273f3*(0x1-utils[_0x5573('0x206')](_0x223f9d,_0x5273f3));}return _0x3fa46e({'erlangCalls':_0x1a9d49,'erlangCallToSecond':_0xd08948/_0x1a9d49,'erlangAbandonmentRate':_0x5e5219,'erlangBusyFactor':_0x78b4dd});});};module[_0x5573('0x20c')]=Dialer; \ No newline at end of file +var _0x155d=['[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','dropRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','[actionOriginate]\x20','checkIsBlackList','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\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]','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','then','debug','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','state','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','active','reachable','SIP/%s','prototype','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','checkIsTrunkReachable','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','type','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','rescheduleContact','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','starttime','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','calleridname','createHistory','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','status','paused','stateinterface','locked','isNil','idHopper','syncQueueStatusComplete','strategy','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','buildObj','saveInDb','[syncHangupInAMD]','dialAMDActive','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncVarSet]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','countnosuchnumberretry','createStateFinal','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','assign','isTrunkReachable','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]'];(function(_0x8d931a,_0x2c5af2){var _0xeb6594=function(_0x5e8e9c){while(--_0x5e8e9c){_0x8d931a['push'](_0x8d931a['shift']());}};_0xeb6594(++_0x2c5af2);}(_0x155d,0x89));var _0xd155=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x155d[_0x403c20];return _0x2b271a;};'use strict';var util=require(_0xd155('0x0'));var _=require(_0xd155('0x1'));var uuid=require(_0xd155('0x2'));var moment=require(_0xd155('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xd155('0x4'));var hopperUtils=require(_0xd155('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xd155('0x6'))(_0xd155('0x7'));var loggerPredictive=require(_0xd155('0x6'))(_0xd155('0x8'));var loggerPredictiveCalls=require(_0xd155('0x6'))(_0xd155('0x9'));var loggerSyncQueueSummary=require(_0xd155('0x6'))(_0xd155('0xa'));var ami=require(_0xd155('0xb'));config[_0xd155('0xc')]=_['defaults'](config[_0xd155('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xd155('0xd'))(new Redis(config[_0xd155('0xc')]));var cmHopper=require(_0xd155('0xe'));var voiceQueueRt=require(_0xd155('0xf'));var RpcSetting=require(_0xd155('0x10'));var Interval=require(_0xd155('0x11'));var Action=require(_0xd155('0x12'));var History=require(_0xd155('0x13'));var Final=require(_0xd155('0x14'));var AgentComplete=require(_0xd155('0x15'));var QueueCallerAbandon=require(_0xd155('0x16'));var Hangup=require(_0xd155('0x17'));var ipAgi=process['env'][_0xd155('0x18')]||_0xd155('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x464f3b){this['tail']=this['tail']?this[_0xd155('0x1a')][_0xd155('0x1b')](_0x464f3b):_0x464f3b();};function Dialer(_0x41dc3d,_0x39d2e6){this[_0xd155('0x1c')]=new Sequence();this[_0xd155('0x1d')]=_0x39d2e6;this[_0xd155('0x1e')]=_0x41dc3d[_0xd155('0x1e')];this[_0xd155('0x1f')]=_0x41dc3d['campaigns'];this[_0xd155('0x20')]=_0x41dc3d['agents'];this['trunks']=_0x41dc3d[_0xd155('0x21')];this[_0xd155('0x22')]=config[_0xd155('0x22')]||0x2;this['channels']={};this[_0xd155('0x23')]={};this[_0xd155('0x24')]={};this[_0xd155('0x25')]={};this[_0xd155('0x26')]={};this[_0xd155('0x27')]={};this[_0xd155('0x28')]={};this[_0xd155('0x29')]={};this[_0xd155('0x2a')]={};this['queueBookedRR']={};this[_0xd155('0x2b')]={};ami['on'](_0xd155('0x2c'),this[_0xd155('0x2d')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x2f'),this[_0xd155('0x30')]['bind'](this));ami['on'](_0xd155('0x31'),this['syncOriginateResponse'][_0xd155('0x2e')](this));ami['on'](_0xd155('0x32'),this[_0xd155('0x33')][_0xd155('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xd155('0x2e')](this));ami['on'](_0xd155('0x34'),this[_0xd155('0x35')][_0xd155('0x2e')](this));ami['on']('hangup',this[_0xd155('0x36')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x37'),this[_0xd155('0x38')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0xd155('0x3a'),this[_0xd155('0x3b')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x3c'),this['syncQueueStatusComplete'][_0xd155('0x2e')](this));this['loopCampaigns']();this[_0xd155('0x3d')]();RpcSetting['getSettings']()[_0xd155('0x3e')](function(_0x16bec7){previewRecallmeReminderInterval=_0x16bec7['previewRecallmeReminderInterval'];});}function isNotNull(_0xaf9f39){return _0xaf9f39!==null&&!_['isUndefined'](_0xaf9f39);}function msgResponse(_0x44cc00,_0x26b705,_0x20010a){return{'action':_0x44cc00,'response':_0x26b705,'message':_0x20010a,'stack':_0x20010a};}function emit(_0x2b9cdc,_0x5f5104,_0x1622e0){io['to'](_0x2b9cdc)['emit'](_0x5f5104,_0x1622e0);}function emitOutboundVoiceQueueSummary(_0xec8c83){if(_0xec8c83['type']==='outbound'){logger[_0xd155('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xd155('0x40')](_0xec8c83,{'showHidden':![],'depth':null}));emit(util['format'](_0xd155('0x41'),_0xec8c83[_0xd155('0x42')]),_0xd155('0x43'),_0xec8c83);}}function checkGetDataPredictive(_0x27a090){if(isNotNull(_0x27a090)&&!_['isEmpty'](_0x27a090)){loggerPredictive[_0xd155('0x44')](_0xd155('0x45'));loggerPredictive[_0xd155('0x44')](_0xd155('0x46'),_0x27a090[_0xd155('0x47')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x48'),_0x27a090[_0xd155('0x49')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x4a'),_0x27a090[_0xd155('0x4b')]);loggerPredictive[_0xd155('0x44')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27a090[_0xd155('0x4c')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x4d'),_0x27a090['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd155('0x44')](_0xd155('0x4e'),_0x27a090[_0xd155('0x4f')]);loggerPredictive['info'](_0xd155('0x50'));if(_0x27a090[_0xd155('0x47')]>0x0){if(!_[_0xd155('0x51')](_0x27a090['predictiveIntervalAvgTalktime'])&&_0x27a090[_0xd155('0x4f')]>0x0){return!![];}loggerPredictive[_0xd155('0x44')](_0xd155('0x52'));if(!_[_0xd155('0x51')](_0x27a090[_0xd155('0x53')])&&_0x27a090[_0xd155('0x53')]>0x0){return!![];}loggerPredictive[_0xd155('0x44')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xd155('0x44')](_0xd155('0x54'));}}else{loggerPredictive[_0xd155('0x44')](_0xd155('0x55'));}return![];}function mergeDataErlangB(_0x5a38ab){return function(_0x264bf6){loggerPredictive[_0xd155('0x44')](_0xd155('0x56'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x264bf6[_0xd155('0x57')]);loggerPredictive['info'](_0xd155('0x58'),_0x264bf6[_0xd155('0x59')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5a'),_0x264bf6[_0xd155('0x5b')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5c'),_0x264bf6[_0xd155('0x5d')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5a'),_0x264bf6[_0xd155('0x5b')]);loggerPredictive['info'](_0xd155('0x50'));_[_0xd155('0x5e')](_0x5a38ab,_0x264bf6);};}function ifInterval(_0x404d2c,_0x179d80){if(_[_0xd155('0x51')](_0x179d80)){return![];}return utils[_0xd155('0x5f')](undefined,_0x179d80)<_0x404d2c*0x3c;}function clearPredictiveAttributes(_0x306511){if(_0x306511[_0xd155('0x28')]){_0x306511[_0xd155('0x28')]=undefined;loggerPredictive[_0xd155('0x3f')](_0x306511[_0xd155('0x42')],'startProgressive\x20value\x20cleared');}if(_0x306511['startPredictive']){_0x306511['startPredictive']=undefined;loggerPredictive['debug'](_0x306511[_0xd155('0x42')],_0xd155('0x60'));}if(_0x306511['handlePredictive']){clearInterval(_0x306511[_0xd155('0x61')]);_0x306511[_0xd155('0x61')]=undefined;loggerPredictive[_0xd155('0x3f')](_0x306511['name'],_0xd155('0x62'));}}function loggerCatchPredictive(_0x270b17,_0x48105d){return function(_0x4d51f5){loggerPredictive[_0xd155('0x63')](_0x48105d[_0xd155('0x42')],_0x270b17);loggerPredictive[_0xd155('0x63')](_0x4d51f5[_0xd155('0x64')]);clearPredictiveAttributes(_0x48105d);};}function loggerCatch(_0x2fd390){return function(_0x3d921d){logger[_0xd155('0x63')](_0x2fd390,util[_0xd155('0x40')](_0x3d921d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x506bb7){return function(_0x12a457){if(isNotNull(_0x12a457)&&isNotNull(_0x12a457[0x0])){if(_0x12a457[0x0][_0xd155('0x65')]>0x0){_0x506bb7[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x68')];logger['info'](_0xd155('0x69')+_0x506bb7[_0xd155('0x42')],_0x12a457[0x0][_0xd155('0x65')],_0xd155('0x6a'));}else{_0x506bb7[_0xd155('0x66')]=utils[_0xd155('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0xd155('0x44')]('[getContactDialer2][Empty]'+_0x506bb7[_0xd155('0x42')]);}}};}function createObjHistory(_0x22b627,_0x1327a7,_0x14b3c7,_0x27c06d,_0xbd7bdc){_0x22b627['message']=_0x14b3c7;var _0x565800=new Action(_0x22b627,_0x1327a7);var _0x23a44b=new History(_0x565800);_0x23a44b[_0xd155('0x6b')]=_0x27c06d;_0x23a44b['statedesc']=_0xbd7bdc;_0x23a44b[_0xd155('0x6c')]=_0x565800['starttime'];return _0x23a44b;}function unlockQueueStatus(_0x4ab1ce,_0x4919aa){setTimeout(function(){if(_[_0xd155('0x51')](_0x4ab1ce[_0xd155('0x6d')])){loggerBooked[_0xd155('0x63')](_0xd155('0x6e'),_0x4919aa);}_0x4ab1ce[_0xd155('0x6d')]=!![];loggerBooked[_0xd155('0x44')](_0xd155('0x6f'),_0x4919aa,JSON[_0xd155('0x70')](_[_0xd155('0x71')](_0x4ab1ce,['name',_0xd155('0x6d')])));},0x1f3);}function checkInterval(_0x4b7205){return function(){if(!isNotNull(_0x4b7205[_0xd155('0x72')])){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4b7205[_0xd155('0x72')][_0xd155('0x74')])){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+_0xd155('0x75');}if(!isNotNull(_['isEmpty'](_0x4b7205[_0xd155('0x72')][_0xd155('0x74')]))){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+_0xd155('0x75');}};}function checkIsIVRCampaignActive(_0x560062){return function(){if(!utils[_0xd155('0x76')](_0x560062)){_0x560062[_0xd155('0x66')]=utils['CAMPAIGN_STATUS'][_0xd155('0x77')];throw _0x560062['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x84c73e){if(utils[_0xd155('0x78')](_0x84c73e)){emit(util[_0xd155('0x79')](_0xd155('0x7a'),_0x84c73e[_0xd155('0x42')]),_0xd155('0x7b'),_0x84c73e);}}function loggerCatchQueueSummary(_0x32f814,_0x339445){return function(_0x231421){clearPredictiveAttributes(_0x339445);emitCampaignSummary(_0x339445);loggerSyncQueueSummary[_0xd155('0x3f')](_0x32f814,util[_0xd155('0x40')](_0x231421,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1a2fc8){if(_0x1a2fc8['sendMessageOneNotActive']){if(_0x1a2fc8['originated']===0x0){_0x1a2fc8[_0xd155('0x7c')]=![];_0x1a2fc8[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x77')];loggerSyncQueueSummary[_0xd155('0x3f')](_0xd155('0x7d'),_0x1a2fc8[_0xd155('0x42')],_0xd155('0x7e'));}else{_0x1a2fc8['message']=utils[_0xd155('0x67')][_0xd155('0x7f')];loggerSyncQueueSummary[_0xd155('0x3f')](_0xd155('0x7d'),_0x1a2fc8[_0xd155('0x42')],'is\x20deactivated');}emitCampaignSummary(_0x1a2fc8);}}function myreject(_0x4e9084){return function(_0x1f191e){return _0x4e9084(msgResponse('[ifTime][Action]','Error',JSON[_0xd155('0x70')](_0x1f191e)));};}Dialer['prototype']['isTrunkReachable']=function(_0xc9bd06){return!_[_0xd155('0x51')](_0xc9bd06)&&_0xc9bd06&&!_[_0xd155('0x51')](_0xc9bd06[_0xd155('0x42')])&&!_[_0xd155('0x51')](_0xc9bd06['active'])&&_0xc9bd06[_0xd155('0x80')]&&(this[_0xd155('0x21')][util[_0xd155('0x79')]('SIP/%s',_0xc9bd06[_0xd155('0x42')])]['status']===_0xd155('0x81')||this[_0xd155('0x21')][util[_0xd155('0x79')](_0xd155('0x82'),_0xc9bd06[_0xd155('0x42')])]['status']==='unmonitored');};Dialer[_0xd155('0x83')]['checkIsTrunkReachable']=function(_0x359a10){var _0x177e9a=this;return function(){if(!_0x177e9a['isTrunkReachable'](_0x359a10[_0xd155('0x84')])){if(!_0x177e9a['isTrunkReachable'](_0x359a10[_0xd155('0x85')])){_0x359a10['message']=utils[_0xd155('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x359a10[_0xd155('0x42')]+_0xd155('0x86');}}};};Dialer[_0xd155('0x83')][_0xd155('0x87')]=function(_0x5bb63d,_0x4719a8,_0x23f365,_0x314b48){var _0x1c8c4e=this;return function(){var _0xf3a693=!![];return _0x1c8c4e[_0xd155('0x88')](_0x5bb63d,_0x4719a8,_0x23f365,_0x314b48,_0xf3a693);};};Dialer[_0xd155('0x83')][_0xd155('0x89')]=function(_0xf6bbc2,_0x2cbe5e,_0x3b8b9e,_0x1b6d72){var _0xba4744=this;return function(){var _0x404f3b=![];return _0xba4744[_0xd155('0x88')](_0xf6bbc2[_0xd155('0x74')],_0x2cbe5e,_0x3b8b9e,_0x1b6d72,_0x404f3b);};};Dialer[_0xd155('0x83')][_0xd155('0x88')]=function(_0x2282ab,_0x2d8511,_0x2687df,_0x5e44ac,_0x439e66){var _0x5c4490=[];return new Promise(function(_0x573adc,_0x555d1a){if(!isNotNull(_0x2282ab)){_0x5e44ac['message']=utils[_0xd155('0x67')]['NULL_INTERVAL'];return _0x555d1a(msgResponse(_0xd155('0x8a'),'Failure',_0x2687df+_0xd155('0x8b')));}if(_[_0xd155('0x8c')](_0x2282ab)){_0x5e44ac[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x8d')];return _0x555d1a(msgResponse('ifTime',_0xd155('0x8e'),_0x2687df+_0xd155('0x8f')));}if(_0x2d8511&&_['isUndefined'](config[_0xd155('0x90')][_0x2d8511])){_0x5e44ac['message']=utils['CAMPAIGN_STATUS'][_0xd155('0x91')];return _0x555d1a(msgResponse(_0xd155('0x8a'),_0xd155('0x8e'),_0x2687df+_0xd155('0x92')+_0x2d8511));}if(_[_0xd155('0x93')](_0x2282ab)){for(var _0x55df94=0x0;_0x55df94<_0x2282ab[_0xd155('0x94')];_0x55df94+=0x1){_0x5c4490[_0xd155('0x95')](ami[_0xd155('0x96')]({'action':_0xd155('0x97'),'command':util[_0xd155('0x79')](_0xd155('0x98'),_0x2282ab[_0x55df94][_0xd155('0x99')],!_[_0xd155('0x51')](config[_0xd155('0x90')][_0x2d8511])?_0x2d8511:'')})['then'](function(_0x383b30){return _0x383b30[_0xd155('0x9a')][_0xd155('0x9b')](_0xd155('0x9c'))>=0x0;})[_0xd155('0x9d')](myreject(_0x555d1a)));}}else{_0x5c4490[_0xd155('0x95')](ami[_0xd155('0x96')]({'action':_0xd155('0x97'),'command':util[_0xd155('0x79')](_0xd155('0x98'),_0x2282ab,!_['isUndefined'](config['timezones'][_0x2d8511])?_0x2d8511:'')})['then'](function(_0xc235b){return _0xc235b['content'][_0xd155('0x9b')]('true')>=0x0;})[_0xd155('0x9d')](myreject(_0x555d1a)));}Promise[_0xd155('0x9e')](_0x5c4490)[_0xd155('0x3e')](function(_0xe2d8da){var _0x345529=_[_0xd155('0x9f')](_0xe2d8da);if(_0x345529){return _0x573adc(_0x345529);}else{_0x5e44ac[_0xd155('0x66')]=_0x439e66?utils[_0xd155('0x67')][_0xd155('0xa0')]:utils[_0xd155('0x67')][_0xd155('0xa1')];return _0x555d1a(msgResponse('[ifTime][promiseAll]',_0xd155('0x8e'),'Global:\x20'+_0x439e66+'\x20'+_0x2687df+_0xd155('0xa2')+util[_0xd155('0x40')](_0x2282ab,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2d8511));}})[_0xd155('0x9d')](function(_0xd544df){return _0x555d1a(msgResponse(_0xd155('0x8a'),_0xd155('0x8e'),JSON['stringify'](_0xd544df)));});});};Dialer[_0xd155('0x83')]['loopCampaigns']=function(){var _0x503713=this;return cmHopper[_0xd155('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0xd155('0x3e')](function(){setInterval(function(){_0x503713[_0xd155('0xa4')]();},0x3e8);});};Dialer[_0xd155('0x83')][_0xd155('0xa4')]=function(){var _0x36b035=this;var _0x916ba0;for(var _0x540e29 in this[_0xd155('0x1f')]){if(typeof this[_0xd155('0x1f')][_0x540e29]!==_0xd155('0xa5')){_0x916ba0=this['campaigns'][_0x540e29];if(utils[_0xd155('0x78')](_0x916ba0)&&utils[_0xd155('0x76')](_0x916ba0)){_0x916ba0[_0xd155('0x7c')]=!![];Promise['resolve']()[_0xd155('0x3e')](checkIsIVRCampaignActive(_0x916ba0))['then'](checkInterval(_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0xa6')](_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0x87')](_0x916ba0['dialGlobalInterval'],_0x916ba0[_0xd155('0xa7')],_0x916ba0[_0xd155('0x42')],_0x916ba0))['then'](_0x36b035[_0xd155('0x89')](_0x916ba0[_0xd155('0x72')],_0x916ba0['dialTimezone'],_0x916ba0['name'],_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0xa8')](_0x916ba0))['catch'](loggerCatchQueueSummary(_0xd155('0xa9'),_0x916ba0));}else{notSendMessagesCampaign(_0x916ba0);}}}};Dialer[_0xd155('0x83')][_0xd155('0xaa')]=function(_0x299e05){if(_0x299e05[_0xd155('0xab')]!=='predictive'){clearPredictiveAttributes(_0x299e05);}switch(_0x299e05[_0xd155('0xab')]){case _0xd155('0xac'):this['handlePower'](_0x299e05,0x1);break;case'power':this[_0xd155('0xad')](_0x299e05,_0x299e05[_0xd155('0xae')]);break;case'predictive':this[_0xd155('0x8')](_0x299e05);break;case _0xd155('0x7'):this[_0xd155('0xad')](_0x299e05,0x1);break;default:logger[_0xd155('0x63')](_0xd155('0xaf'),_0x299e05['name'],'method\x20not\x20recognized');}};Dialer['prototype'][_0xd155('0x8a')]=function(_0x1251e9,_0x5122d9){var _0x20ce57=_0x1251e9[_0xd155('0xa7')];var _0x112d83=_0x5122d9?_0x1251e9[_0xd155('0xb0')]:_0x1251e9['Interval']['Intervals'];logger['silly'](_0xd155('0xb1'),_0x112d83,_0x20ce57,_0x1251e9[_0xd155('0x42')],util[_0xd155('0x79')](_0xd155('0xb2'),_0x1251e9['name'],_0x1251e9['id']));var _0x9c9465=null;return Interval[_0xd155('0xb3')](_0x112d83,_0x20ce57)[_0xd155('0x3e')](function(_0x3405de){if(_0x3405de===!![]){return _0x3405de;}else{_0x1251e9[_0xd155('0x66')]=_0x5122d9?utils[_0xd155('0x67')][_0xd155('0xa0')]:utils[_0xd155('0x67')][_0xd155('0xa1')];_0x9c9465=msgResponse('[ifTime][promiseAll]',_0xd155('0x8e'),_0xd155('0xb4')+_0x5122d9+'\x20'+_0x1251e9['name']+_0xd155('0xa2')+util['inspect'](_0x112d83,{'showHidden':![],'depth':null})+_0xd155('0xb5')+_0x20ce57);}if(_0x9c9465!==null){logger[_0xd155('0xb6')](_0xd155('0xb7'),_0x9c9465);_0x9c9465[_0xd155('0xb8')]=_0x5122d9;throw _0x9c9465;}})[_0xd155('0x9d')](function(_0x13b806){logger[_0xd155('0x63')](_0xd155('0xb9'),_0x13b806);throw msgResponse(_0xd155('0xba'),'Error',util[_0xd155('0x40')](_0x13b806,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xd155('0x2d')]=function(_0x1ac093){if(this[_0xd155('0x1e')][_0x1ac093[_0xd155('0xbb')]]){if(this[_0xd155('0x25')][_0x1ac093[_0xd155('0xbc')]]&&this['uniqueId'][_0x1ac093['uniqueid']][_0xd155('0xbd')]!==_0xd155('0xbe')){utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x1ac093[_0xd155('0xbb')]],_0xd155('0xc0'));this[_0xd155('0x25')][_0x1ac093[_0xd155('0xbc')]][_0xd155('0xc1')]=moment()['format'](_0xd155('0xc2'));}}};Dialer[_0xd155('0x83')][_0xd155('0x33')]=function(_0x52f0a3){var _0x2aa25b=this[_0xd155('0x25')][_0x52f0a3[_0xd155('0xbc')]];if(this[_0xd155('0x1e')][_0x52f0a3[_0xd155('0xbb')]]){if(_0x2aa25b&&_0x2aa25b['type']!==_0xd155('0xbe')){delete this[_0xd155('0x25')][_0x52f0a3[_0xd155('0xbc')]];this['voiceQueues'][_0x52f0a3[_0xd155('0xbb')]][_0xd155('0xc3')]+=0x1;var _0x328f5c=new AgentComplete(_0x2aa25b,_0x52f0a3);if(_0x52f0a3[_0xd155('0xc4')]==='agent'){_0x328f5c[_0xd155('0xc5')]=this[_0xd155('0x1e')][_0x52f0a3[_0xd155('0xbb')]][_0xd155('0xc6')]&&this[_0xd155('0x1e')][_0x52f0a3['queue']][_0xd155('0xc7')]?moment()[_0xd155('0x79')](_0xd155('0xc2')):undefined;}hopperUtils['createHistory'](_0x328f5c)[_0xd155('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xd155('0xc8')](_0x328f5c)['catch'](loggerCatch(_0xd155('0xc9')));}}};Dialer[_0xd155('0x83')][_0xd155('0x30')]=function(_0x7d4695){var _0x1d6257=this[_0xd155('0x25')][_0x7d4695[_0xd155('0xbc')]];var _0x4398a5=this;var _0x1ed0ff=![];var _0x23f9ac;var _0x2c0292;if(this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]){if(_0x1d6257&&_0x1d6257[_0xd155('0xbd')]!==_0xd155('0xbe')){delete this[_0xd155('0x25')][_0x7d4695['uniqueid']];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]],_0xd155('0xca'));_0x1d6257[_0xd155('0xcb')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));var _0x5555f9=new QueueCallerAbandon(_0x1d6257,_0x7d4695);if(utils[_0xd155('0x5f')](_0x1d6257['droptime'],_0x1d6257[_0xd155('0xcc')])>=_0x1d6257[_0xd155('0xcd')]){this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]][_0xd155('0x4b')]+=0x1;this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xce')]+=0x1;_0x5555f9[_0xd155('0x6b')]=0xa;_0x5555f9[_0xd155('0xcf')]=_0xd155('0xd0');_0x5555f9[_0xd155('0xd1')]=_0xd155('0xd2');_0x5555f9['agiafterat']=this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xc6')]?moment()[_0xd155('0x79')](_0xd155('0xc2')):undefined;_0x5555f9['countdropretry']+=0x1;_0x5555f9['countglobal']+=0x1;_0x23f9ac=this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xd3')];_0x2c0292=this['voiceQueues'][_0x7d4695['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xd4')](_0x5555f9,_0x5555f9[_0xd155('0x6b')],_0x1d6257[_0xd155('0xd5')])['then'](function(_0x40a9cf){_0x1ed0ff=_0x40a9cf[_0xd155('0xd6')]==0x1;if(_0x5555f9[_0xd155('0xd7')]>=_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['dialDropMaxRetry']){_0x4398a5['queueCallerAbandonCreateState'](_0x5555f9,_0x40a9cf[_0xd155('0xd6')]);}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countdropretry':_0x5555f9[_0xd155('0xd7')],'scheduledat':moment()[_0xd155('0xd9')](_0x4398a5['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xd3')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d6257[_0xd155('0xda')],'ListId':_0x1d6257[_0xd155('0xdb')],'VoiceQueueId':_0x1d6257['VoiceQueueId']||undefined,'CampaignId':_0x1d6257[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0xdd')));var _0x310c13=new History(_0x5555f9);_0x310c13['state']=0xa;_0x310c13['statedesc']=_0xd155('0xd0');_0x310c13[_0xd155('0xde')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));_0x310c13[_0xd155('0x6c')]=_0x310c13[_0xd155('0xde')];_0x310c13['calleridname']=_0x5555f9['calleridname'];_0x310c13[_0xd155('0xdf')]=_0x5555f9[_0xd155('0xdf')];hopperUtils['createHistory'](_0x310c13)['catch'](loggerCatch(_0xd155('0xe0')));}})['then'](function(){if(_0x1ed0ff)hopperUtils[_0xd155('0xe1')](_0x5555f9,_0x23f9ac,_0x2c0292)[_0xd155('0x3e')](function(){return 0x1;});});}else{this[_0xd155('0x1e')][_0x7d4695['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe2')]+=0x1;_0x5555f9[_0xd155('0x6b')]=0xb;_0x5555f9['statedesc']='Abandoned';_0x5555f9[_0xd155('0xd1')]=_0xd155('0xe3');_0x5555f9[_0xd155('0xe4')]+=0x1;_0x5555f9['countglobal']+=0x1;_0x23f9ac=this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe5')];_0x2c0292=this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe6')];hopperUtils['verifyAdditionalPhones'](_0x5555f9,_0x5555f9[_0xd155('0x6b')],_0x1d6257[_0xd155('0xd5')])[_0xd155('0x3e')](function(_0x155605){if(_0x5555f9[_0xd155('0xe4')]>=_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xe7')]){_0x4398a5[_0xd155('0xe8')](_0x5555f9,_0x155605[_0xd155('0xd6')]);}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countabandonedretry':_0x5555f9[_0xd155('0xe4')],'scheduledat':moment()[_0xd155('0xd9')](_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['dialAbandonedRetryFrequency'],_0xd155('0xe9'))[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d6257[_0xd155('0xda')],'ListId':_0x1d6257['ListId'],'VoiceQueueId':_0x1d6257['VoiceQueueId']||undefined,'CampaignId':_0x1d6257[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x37483f=new History(_0x5555f9);_0x37483f['state']=0xb;_0x37483f[_0xd155('0xcf')]='Abandoned';_0x37483f[_0xd155('0xde')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));_0x37483f[_0xd155('0x6c')]=_0x37483f[_0xd155('0xde')];_0x37483f[_0xd155('0xea')]=_0x5555f9['calleridname'];_0x37483f[_0xd155('0xdf')]=_0x5555f9[_0xd155('0xdf')];hopperUtils[_0xd155('0xeb')](_0x37483f)['catch'](loggerCatch(_0xd155('0xec')));}})[_0xd155('0x3e')](function(){if(_0x1ed0ff)hopperUtils[_0xd155('0xe1')](_0x5555f9,_0x23f9ac,_0x2c0292)[_0xd155('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xd155('0x83')][_0xd155('0x38')]=function(_0x2420b6){if(this[_0xd155('0x23')][_0x2420b6[_0xd155('0xbc')]]){this['actions'][_0x2420b6[_0xd155('0xbc')]][_0xd155('0xed')]=_0x2420b6[_0xd155('0xed')];}if(this[_0xd155('0x25')][_0x2420b6[_0xd155('0xbc')]]){this[_0xd155('0x25')][_0x2420b6[_0xd155('0xbc')]]['channel']=_0x2420b6[_0xd155('0xed')];}};Dialer[_0xd155('0x83')]['syncQueueMember']=function(_0x3cee2){if(!this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]]){return;}var _0x4f1987=this[_0xd155('0x1e')][this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xbb')]]['strategy']||_0xd155('0xef');if(_0x4f1987==='roundrobin'){if(this[_0xd155('0x23')][_0x3cee2['actionid']]&&_['isNil'](this['actions'][_0x3cee2[_0xd155('0xee')]]['locked'])&&_0x3cee2[_0xd155('0xf0')]==='1'&&_0x3cee2[_0xd155('0xf1')]==='0'){if(this['agents'][_0x3cee2[_0xd155('0xf2')]]){if(!this['agents'][_0x3cee2[_0xd155('0xf2')]][_0xd155('0xf3')]){this['agents'][_0x3cee2[_0xd155('0xf2')]][_0xd155('0xf3')]=!![];this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf3')]=!![];this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf2')]=_0x3cee2[_0xd155('0xf2')];}}}}else if(_0x4f1987===_0xd155('0xef')){if(this[_0xd155('0x23')][_0x3cee2['actionid']]){if(this[_0xd155('0x20')][_0x3cee2['stateinterface']]){this['actions'][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf2')]=_0x3cee2['stateinterface'];if(_[_0xd155('0xf4')](this[_0xd155('0x2a')][this['actions'][_0x3cee2[_0xd155('0xee')]]['queue']])){this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xbb')]]=[];}this['queueBooked'][this[_0xd155('0x23')][_0x3cee2['actionid']][_0xd155('0xbb')]][_0xd155('0x95')](_[_0xd155('0x5e')](_[_0xd155('0x71')](this['actions'][_0x3cee2[_0xd155('0xee')]],[_0xd155('0xf5'),_0xd155('0xf2')]),{'status':_0x3cee2[_0xd155('0xf0')],'paused':_0x3cee2[_0xd155('0xf1')]}));}}}};Dialer[_0xd155('0x83')][_0xd155('0xf6')]=function(_0x1aef48){if(!this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]){return;}var _0x2d85eb=this;var _0x4bc9ae=this['voiceQueues'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]];var _0x3e4080=_0x4bc9ae[_0xd155('0xf7')]||_0xd155('0xef');if(_0x3e4080===_0xd155('0xf8')){if(this['actions'][_0x1aef48['actionid']]&&this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')]){this[_0xd155('0x1d')][_0xd155('0xf9')](this['actions'][_0x1aef48[_0xd155('0xee')]]['idHopper'],this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')])[_0xd155('0x9d')](function(_0x302c1b){logger[_0xd155('0x63')](_0xd155('0xfa'),util[_0xd155('0x40')](_0x302c1b,{'showHidden':![],'depth':null}));})[_0xd155('0x1b')](function(){utils[_0xd155('0xbf')](_0x2d85eb[_0xd155('0x1e')][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['queue']],_0xd155('0xfb'));_0x2d85eb[_0xd155('0x20')][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')]][_0xd155('0xf3')]=![];delete _0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]];unlockQueueStatus(_0x4bc9ae);});}else{utils[_0xd155('0xbf')](this[_0xd155('0x1e')][this[_0xd155('0x23')][_0x1aef48['actionid']][_0xd155('0xbb')]],_0xd155('0xfb'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xda')],'ListId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xdb')],'VoiceQueueId':this['actions'][_0x1aef48[_0xd155('0xee')]][_0xd155('0xfc')]||undefined,'CampaignId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xd155('0xfd')));delete this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]];unlockQueueStatus(_0x4bc9ae);}}else if(_0x3e4080===_0xd155('0xef')){var _0x2731ee;if(this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]&&!_[_0xd155('0x8c')](this['queueBooked'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]])){if(this['queueBookedRR'][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['queue']]){this[_0xd155('0xfe')][_0x2d85eb['actions'][_0x1aef48['actionid']][_0xd155('0xbb')]]=this['queueBookedRR'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]?this[_0xd155('0xfe')][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]:this[_0xd155('0x2a')][this['actions'][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]?this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]][_0xd155('0xff')]||0x0:0x0;}this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x1aef48['actionid']][_0xd155('0xbb')]]['_rr']=this[_0xd155('0xfe')][this['actions'][_0x1aef48['actionid']][_0xd155('0xbb')]];for(var _0x95b632=0x0;_0x95b632=_0x23597c[_0xd155('0x124')]){_0x2a560a[_0xd155('0x125')](_0x2c82ed,_0x169aec,_0x5ba7eb,_0xd155('0x126'));}else{if(_0x2c82ed[_0xd155('0x11d')]>=_0x23597c[_0xd155('0x127')]){_0x2a560a['createStateFinal'](_0x2c82ed,_0x169aec,_0x5ba7eb,_0xd155('0x128'));}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countmachineretry':_0x2c82ed['countmachineretry'],'scheduledat':moment()[_0xd155('0xd9')](_0x23597c[_0xd155('0x129')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x2c82ed['ContactId'],'ListId':_0x2c82ed[_0xd155('0xdb')],'VoiceQueueId':_0x2c82ed[_0xd155('0xfc')]||undefined,'CampaignId':_0x2c82ed[_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x12a')));_0x169aec({'reschedule':0x1});}}});}if(_0x1f6b01['type']==='ivr'&&this[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]]['dialAMDActive']&&_0xbd0f12[_0xd155('0x111')]===_0xd155('0x112')){delete this['uniqueId'][_0xbd0f12['uniqueid']];utils[_0xd155('0xbf')](this['campaigns'][_0x1f6b01[_0xd155('0xbb')]],_0xd155('0x12b'));_0x11f727=new Hangup(_0x1f6b01,_0xbd0f12);_0x11f727[_0xd155('0x6b')]=0x12;_0x11f727[_0xd155('0xcf')]=_0xd155('0x114');_0x11f727['membername']='AMD';ami[_0xd155('0x116')]('custom:amd',ut['buildObj'](_0x11f727,'amd'));this['saveInDb'](_0x11f727,_0xd155('0x12c'),'[syncHangupInAMDIvr]');}if(_0x1f6b01[_0xd155('0xbd')]===_0xd155('0xbe')&&this[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0x11a')]&&_0xbd0f12['value']==='MACHINE'){return new Promise(function(_0x3f5e7d,_0x13265e){delete _0x2a560a[_0xd155('0x25')][_0xbd0f12[_0xd155('0xbc')]];utils[_0xd155('0xbf')](_0x2a560a[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]],_0xd155('0x12b'));_0x2a560a[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0xc3')]+=0x1;_0x2a560a[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0x113')]+=0x1;var _0x5d1848=_0x2a560a[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]];var _0x3f16bd=new Hangup(_0x1f6b01,_0xbd0f12);_0x3f16bd[_0xd155('0x6b')]=0x13;_0x3f16bd[_0xd155('0xcf')]='Machine';_0x3f16bd[_0xd155('0x11c')]=_0xd155('0x115');_0x3f16bd[_0xd155('0x11d')]+=0x1;_0x3f16bd[_0xd155('0x11e')]+=0x1;_0x3f16bd['amd']=!![];ami[_0xd155('0x116')]('custom:amd',ut[_0xd155('0x117')](_0x3f16bd,_0xd155('0x11f')));hopperUtils[_0xd155('0xeb')](_0x3f16bd)[_0xd155('0x9d')](loggerCatch(_0xd155('0x120')));if(_0x3f16bd[_0xd155('0x121')]+_0x3f16bd[_0xd155('0x12d')]+_0x3f16bd[_0xd155('0x122')]+_0x3f16bd[_0xd155('0x12e')]+_0x3f16bd[_0xd155('0xd7')]+_0x3f16bd[_0xd155('0xe4')]+_0x3f16bd[_0xd155('0x11d')]+_0x3f16bd[_0xd155('0x123')]>=_0x5d1848[_0xd155('0x124')]){_0x2a560a[_0xd155('0x125')](_0x3f16bd,_0x3f5e7d,_0x13265e,_0xd155('0x126'));}else{if(_0x3f16bd[_0xd155('0x11d')]>=_0x5d1848[_0xd155('0x127')]){_0x2a560a[_0xd155('0x12f')](_0x3f16bd,_0x3f5e7d,_0x13265e,_0xd155('0x128'));}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countmachineretry':_0x3f16bd[_0xd155('0x11d')],'scheduledat':moment()['add'](_0x5d1848[_0xd155('0x129')],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x3f16bd['ContactId'],'ListId':_0x3f16bd['ListId'],'VoiceQueueId':_0x3f16bd[_0xd155('0xfc')]||undefined,'CampaignId':_0x3f16bd[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3f5e7d({'reschedule':0x1});}}});}}};Dialer[_0xd155('0x83')][_0xd155('0x36')]=function(_0x51d2a4){var _0x2d35cb=this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];var _0x506cee;if(!_0x2d35cb){return;}if(_0x2d35cb['type']==='ivr'){delete this['uniqueId'][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this['campaigns'][_0x2d35cb[_0xd155('0xbb')]],_0xd155('0x130'));this['campaigns'][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x131')]+=0x1;if(_0x51d2a4[_0xd155('0x132')]===_0xd155('0x133')){const _0x3e849b=new AgentComplete(_0x2d35cb,_0x51d2a4);_0x3e849b[_0xd155('0xdc')]=this['campaigns'][_0x2d35cb[_0xd155('0xbb')]]['id'];hopperUtils[_0xd155('0xeb')](_0x3e849b)[_0xd155('0x9d')](loggerCatch(_0xd155('0x134')));hopperUtils[_0xd155('0xc8')](_0x3e849b)[_0xd155('0x9d')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);hopperUtils[_0xd155('0xeb')](_0x506cee)[_0xd155('0x9d')](loggerCatch(_0xd155('0x135')));hopperUtils[_0xd155('0xc8')](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this['voiceQueues'][_0x2d35cb['queue']][_0xd155('0x136')])){delete this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]],_0xd155('0x130'));this['voiceQueues'][_0x2d35cb['queue']][_0xd155('0xc3')]+=0x1;this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x113')]+=0x1;_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);_0x506cee['state']=0x10;_0x506cee[_0xd155('0xcf')]=_0xd155('0x137');_0x506cee['membername']=_0xd155('0x138');hopperUtils['createHistory'](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xd155('0xc8')](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x2d35cb['queue']],_0xd155('0x139'));if(_0x51d2a4[_0xd155('0x132')]===_0xd155('0x133')){this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0xc3')]+=0x1;const _0x3828bf=new AgentComplete(_0x2d35cb,_0x51d2a4);_0x3828bf[_0xd155('0xfc')]=this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]]['id'];hopperUtils[_0xd155('0xeb')](_0x3828bf)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13a')));hopperUtils[_0xd155('0xc8')](_0x3828bf)[_0xd155('0x9d')](loggerCatch(_0xd155('0xc9')));}else{this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x13b')]+=0x1;_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);_0x506cee[_0xd155('0x6b')]=0xc;_0x506cee[_0xd155('0xcf')]=_0x51d2a4['cause-txt'];_0x506cee[_0xd155('0x11c')]=_0xd155('0x13c');hopperUtils[_0xd155('0xeb')](_0x506cee)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13d')));hopperUtils[_0xd155('0xc8')](_0x506cee)['catch'](loggerCatch(_0xd155('0x130')));}}}};Dialer[_0xd155('0x83')][_0xd155('0xa')]=function(_0x459163){var _0x299898=this;if(!_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]]){_0x299898['queuesSummary'][_0x459163['name']]={'running':![]};}else if(_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]][_0xd155('0x13e')]===!![]){return;}else if(_0x299898['queuesSummary'][_0x459163['name']][_0xd155('0x13e')]===![]){_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]][_0xd155('0x13e')]=!![];}var _0x3c6d6f=_0x299898[_0xd155('0x1e')][_0x459163[_0xd155('0x42')]];var _0x55f1a5=_0x3c6d6f[_0xd155('0x66')]!==utils[_0xd155('0x67')][_0xd155('0x77')];var _0x147a58=utils[_0xd155('0x13f')](_0x3c6d6f);_0x3c6d6f[_0xd155('0x140')]=utils[_0xd155('0x141')](_0x3c6d6f,_0x299898['trunks']);Promise[_0xd155('0x142')]()[_0xd155('0x3e')](function(){if(_0x3c6d6f['statusMessage']===utils[_0xd155('0x67')]['INACTIVE']){if(_0x55f1a5){clearPredictiveAttributes(_0x3c6d6f);_0x459163[_0xd155('0x27')]=undefined;_0x459163[_0xd155('0x28')]=undefined;}if(_0x3c6d6f[_0xd155('0x140')]===utils[_0xd155('0x67')][_0xd155('0x77')]){_0x459163[_0xd155('0x143')]=0x0;_0x459163['paused']=0x0;_0x459163[_0xd155('0x144')]=0x0;_0x459163[_0xd155('0x145')]=0x0;_0x459163[_0xd155('0x146')]=0x0;}}else if(_0x3c6d6f['statusMessage']===utils['CAMPAIGN_STATUS'][_0xd155('0x147')]&&!_0x147a58){return _0x299898[_0xd155('0x8a')](_0x3c6d6f,!![])[_0xd155('0x3e')](function(){return _0x299898['ifTime'](_0x3c6d6f,![]);})['then'](function(){return _0x299898[_0xd155('0xaa')](_0x3c6d6f);})['catch'](function(_0x3717d8){loggerSyncQueueSummary['debug'](_0xd155('0x148'),util[_0xd155('0x40')](_0x3717d8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3c6d6f);});}else{clearPredictiveAttributes(_0x3c6d6f);}})[_0xd155('0x3e')](function(){var _0x35f77e=_0x459163['compareToOutboundQueue'](_0x3c6d6f);if(_0x35f77e||_0x3c6d6f['queueSummaryCountersUpdated']){_0x3c6d6f[_0xd155('0x149')]=![];_0x459163[_0xd155('0x14a')](_0x3c6d6f);Object['assign'](_0x3c6d6f,_0x459163);emitOutboundVoiceQueueSummary(_0x459163);}_0x299898[_0xd155('0x2b')][_0x3c6d6f['name']][_0xd155('0x13e')]=![];})[_0xd155('0x9d')](function(_0x4c28a2){logger[_0xd155('0x63')](_0xd155('0x148'),util['inspect'](_0x4c28a2,{'showHidden':![],'depth':null}));_0x299898['queuesSummary'][_0x3c6d6f['name']][_0xd155('0x13e')]=![];});};Dialer[_0xd155('0x83')][_0xd155('0x35')]=_['throttle'](function(){var _0x332e60=_[_0xd155('0x14b')](this[_0xd155('0x1e')],function(_0xea64ba){return _0xea64ba['dialPreviewRecallmeReminder'];});var _0x599266=_['filter'](this[_0xd155('0x20')],function(_0x44535d){return _0x44535d[_0xd155('0x14c')]&&_0x44535d['status']==='reachable';});if(_0x332e60[_0xd155('0x94')]>0x0&&_0x599266[_0xd155('0x94')]>0x0){return Promise[_0xd155('0x142')]()[_0xd155('0x3e')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x332e60,'id'),previewRecallmeReminderInterval,_[_0xd155('0x14d')](_0x599266,'id')))['then'](function(_0x25e54a){for(var _0x179f32=0x0;_0x179f32<_0x25e54a[_0xd155('0x94')];_0x179f32++){var _0xdd1d05=_0x25e54a[_0x179f32][_0xd155('0x14e')][_0xd155('0x42')];if(_0xdd1d05)io['to'](util['format'](_0xd155('0x14f'),_0xdd1d05))[_0xd155('0x116')](_0xd155('0x150'),{'hopper':_0x25e54a[_0x179f32]});}})[_0xd155('0x9d')](function(_0x5198b6){logger['error'](_0xd155('0x151'),_0x5198b6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd155('0x83')]['loopClearZombieChannels']=function(){var _0x31b52c=this;setInterval(function(){_0x31b52c['clearZombieChannels'](_0x31b52c['uniqueId'],_0xd155('0x152'));_0x31b52c['clearZombieChannels'](_0x31b52c[_0xd155('0x23')],_0xd155('0x153'));},0x32c8);};Dialer[_0xd155('0x83')][_0xd155('0x154')]=function(_0x257c8f,_0x4f06ab){var _0x27b878=this;for(var _0x549381 in _0x257c8f){if(typeof _0x257c8f[_0x549381]!==_0xd155('0xa5')){this[_0xd155('0x1c')]['enqueue'](function(){if(!_[_0xd155('0xf4')](_0x257c8f[_0x549381])){return ami['Action']({'action':'status','channel':_0x257c8f[_0x549381][_0xd155('0xed')]})[_0xd155('0x9d')](function(_0x5067a3){if(_0x5067a3[_0xd155('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x257c8f[_0x549381]&&_0x257c8f[_0x549381][_0xd155('0xbd')]!==_0xd155('0xbe')){utils['decrementOriginate'](_0x27b878[_0xd155('0x1e')][_0x257c8f[_0x549381]['queue']],_0xd155('0x155'));logger[_0xd155('0x63')](_0xd155('0x156'),_0x4f06ab,_0x549381,_0x257c8f[_0x549381][_0xd155('0xbb')]);delete _0x257c8f[_0x549381];}if(_0x257c8f[_0x549381]&&_0x257c8f[_0x549381][_0xd155('0xbd')]===_0xd155('0xbe')){utils['decrementOriginate'](_0x27b878[_0xd155('0x1f')][_0x257c8f[_0x549381]['queue']],_0xd155('0x155'));logger['error'](_0xd155('0x157'),_0x4f06ab,_0x549381,_0x257c8f[_0x549381][_0xd155('0xbb')]);delete _0x257c8f[_0x549381];}},0x2328);}});}});}}};Dialer[_0xd155('0x83')][_0xd155('0x158')]=function(_0x25d3ea){return Promise[_0xd155('0x142')]()[_0xd155('0x3e')](voiceQueueRt[_0xd155('0x158')](_0x25d3ea))[_0xd155('0x9d')](loggerCatch(_0xd155('0x159')));};Dialer['prototype'][_0xd155('0x15a')]=function(_0x5eba10,_0x327150,_0x1bb51d){var _0x1a966f={'state':0x19,'statedesc':_0xd155('0x15b')};utils[_0xd155('0xbf')](_0x327150,_0xd155('0x15c')+_0x5eba10);this[_0xd155('0x118')](_[_0xd155('0x5e')](_0x1a966f,_[_0xd155('0x71')](_0x1bb51d,[_0xd155('0xda'),_0xd155('0xdb'),_0xd155('0x15d'),_0xd155('0xfc'),_0xd155('0xdc')])),_0xd155('0x15e'),'[emptyContact]');logger[_0xd155('0x63')](_0x5eba10);};Dialer[_0xd155('0x83')][_0xd155('0x118')]=function(_0x3388c6,_0x22f04e,_0x20cec7){hopperUtils[_0xd155('0xeb')](_0x3388c6)['catch'](loggerCatch(_0x22f04e));hopperUtils[_0xd155('0xc8')](_0x3388c6)[_0xd155('0x9d')](loggerCatch(_0x20cec7));};Dialer[_0xd155('0x83')][_0xd155('0xe8')]=function(_0x3774d6,_0x38f01f){hopperUtils['createHistory'](_0x3774d6)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13a')));if(_0x38f01f==0x0){hopperUtils[_0xd155('0xc8')](_0x3774d6)[_0xd155('0x9d')](loggerCatch(_0xd155('0x15f')));}};Dialer[_0xd155('0x83')][_0xd155('0x151')]=function(_0x385a9d){return Promise[_0xd155('0x142')]()['then'](cmHopper[_0xd155('0x160')](_0x385a9d['id'],previewRecallmeReminderInterval))['then'](function(_0x377e9e){for(var _0x2272b6=0x0;_0x2272b6<_0x377e9e[_0xd155('0x94')];_0x2272b6++){var _0x2a98e8=_0x377e9e[_0x2272b6][_0xd155('0x14e')][_0xd155('0x42')];if(_0x2a98e8)io['to'](util[_0xd155('0x79')](_0xd155('0x14f'),_0x2a98e8))[_0xd155('0x116')](_0xd155('0x150'),{'hopper':_0x377e9e[_0x2272b6]});}})[_0xd155('0x9d')](function(){});};Dialer[_0xd155('0x83')][_0xd155('0xa8')]=function(_0x34ba3a){var _0x55bba1=this;return function(){_0x55bba1['handleIvr'](_0x34ba3a);};};Dialer[_0xd155('0x83')][_0xd155('0x161')]=function(_0x3add51,_0x3821d7){var _0x2b3093=this;var _0x81828d=uuid['v4']();this['actions'][_0x81828d]=new Action(_0x3add51,_0x3821d7,_0x81828d);return new Promise(function(_0x13e801,_0x4aa012){if(_[_0xd155('0x51')](_0x3add51)&&typeof _0x3add51!==_0xd155('0x162')){return _0x4aa012(msgResponse('originate',_0xd155('0x8e'),'voiceQueue\x20is\x20undefine'));}if(_[_0xd155('0x51')](_0x3821d7[_0xd155('0x163')])||_0x3821d7['phone']===null){return _0x4aa012(msgResponse(_0xd155('0x164'),'Failure',_0xd155('0x165')));}var _0x1b8491={'XMD-CALLERID':_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x166')](),'XMD-AGI':_0x3add51[_0xd155('0x136')]?util[_0xd155('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3add51['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3add51[_0xd155('0xc6')]?util[_0xd155('0x79')](_0xd155('0x167'),ipAgi,_0x3add51[_0xd155('0xc6')]):_0xd155('0x168'),'XMD-QUEUE':utils[_0xd155('0x169')](_0x3add51)?util[_0xd155('0x79')](_0xd155('0x16a'),_0x3add51['name'],_0x3add51['dialQueueOptions']||'',_0x3add51[_0xd155('0xc7')]?'c':'',_0x3add51['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3821d7[_0xd155('0xda')],'XMD-CDRTYPE':_0xd155('0x16b'),'CALLERID(all)':_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x166')](),'XMD-AMD':_0x3add51[_0xd155('0x11a')]?_0xd155('0x147'):_0xd155('0x168'),'XMD-DESTINATION':_0xd155('0x110')};if(_0x3add51[_0xd155('0x11a')]){_0x1b8491[_0xd155('0x16c')]=_0x3add51['dialAMDInitialSilence']||0x9c4;_0x1b8491[_0xd155('0x16d')]=_0x3add51[_0xd155('0x16e')]||0x5dc;_0x1b8491[_0xd155('0x16f')]=_0x3add51['dialAMDAfterGreetingSilence']||0x320;_0x1b8491[_0xd155('0x170')]=_0x3add51['dialAMDTotalAnalysisTime']||0x1388;_0x1b8491[_0xd155('0x171')]=_0x3add51[_0xd155('0x172')]||0x64;_0x1b8491[_0xd155('0x173')]=_0x3add51[_0xd155('0x174')]||0x32;_0x1b8491[_0xd155('0x175')]=_0x3add51[_0xd155('0x176')]||0x3;_0x1b8491[_0xd155('0x177')]=_0x3add51[_0xd155('0x178')]||0x100;_0x1b8491[_0xd155('0x179')]=_0x3add51['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xd155('0x169')](_0x3add51)){_0x1b8491[_0xd155('0x17a')]=_0x3821d7[_0xd155('0xfc')];}else{_0x1b8491[_0xd155('0x17b')]=_0x3821d7[_0xd155('0xdc')];}var _0x251eec=utils['setXMDContactVariables'](_0x3821d7['Contact']);Object[_0xd155('0x17c')](_0x1b8491,_0x251eec);var _0x37d0d8=_0x2b3093[_0xd155('0x17d')](_0x3add51[_0xd155('0x84')])?utils[_0xd155('0x17e')](_0x3add51[_0xd155('0x84')][_0xd155('0x17f')],_0x3add51[_0xd155('0x180')],_0x3add51['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xd155('0x181')](_0x3add51[_0xd155('0x182')],_0x3add51['dialRandomLastDigitCallerIdNumber']):_0x3add51[_0xd155('0x182')]):utils[_0xd155('0x17e')](_[_0xd155('0xf4')](_0x3add51[_0xd155('0x85')])?_0x3add51[_0xd155('0x84')][_0xd155('0x17f')]:_0x3add51[_0xd155('0x85')]['callerid'],_0x3add51['dialOriginateCallerIdName'],_0x3add51['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xd155('0x181')](_0x3add51[_0xd155('0x182')],_0x3add51['dialRandomLastDigitCallerIdNumber']):_0x3add51[_0xd155('0x182')]);if(_0x37d0d8){_0x1b8491[_0xd155('0x183')]=_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x184')]=utils[_0xd155('0x185')](_0x37d0d8);_0x1b8491['XMD-ORIGINATECALLERIDNUM']=_0x3821d7[_0xd155('0x163')];}_0x3add51[_0xd155('0x186')]=_0x1b8491;return ami[_0xd155('0x96')]({'actionid':_0x81828d,'action':_0xd155('0x164'),'channel':_0x2b3093[_0xd155('0x17d')](_0x3add51[_0xd155('0x84')])?util[_0xd155('0x79')](_0xd155('0x187'),_0x3add51[_0xd155('0x84')][_0xd155('0x42')],isNotNull(_0x3add51[_0xd155('0x188')])?_0x3add51['dialPrefix'][_0xd155('0x189')]()||'':'',_0x3add51['dialCutDigit']>0x0?_0x3821d7[_0xd155('0x163')][_0xd155('0x18a')](_0x3add51[_0xd155('0x18b')]):_0x3821d7[_0xd155('0x163')]):util['format'](_0xd155('0x187'),_[_0xd155('0xf4')](_0x3add51[_0xd155('0x85')])?_0x3add51[_0xd155('0x84')]['name']:_0x3add51[_0xd155('0x85')][_0xd155('0x42')],isNotNull(_0x3add51['dialPrefix'])?_0x3add51[_0xd155('0x188')]['trim']()||'':'',_0x3add51[_0xd155('0x18b')]>0x0?_0x3821d7[_0xd155('0x163')]['substring'](_0x3add51[_0xd155('0x18b')]):_0x3821d7[_0xd155('0x163')]),'callerid':_0x37d0d8,'Exten':_0xd155('0x110'),'Context':_0xd155('0x18c'),'Priority':'1','variable':_0x1b8491,'timeout':(_0x3add51[_0xd155('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x81828d})[_0xd155('0x3e')](function(_0x2eceb3){return _0x13e801(_0x2eceb3);})['catch'](function(_0x328dcc){_0x3add51[_0xd155('0x18e')]+=0x1;var _0x5d1da3=new History(_0x2b3093['actions'][_0x81828d]);logger[_0xd155('0x63')](util['format'](_0xd155('0x18f'),JSON['stringify'](_0x328dcc)));_0x5d1da3[_0xd155('0x6b')]=0xe;_0x5d1da3[_0xd155('0xcf')]=_0xd155('0x190');_0x5d1da3['starttime']=moment()['format'](_0xd155('0xc2'));_0x5d1da3[_0xd155('0x6c')]=_0x5d1da3[_0xd155('0xde')];hopperUtils[_0xd155('0xeb')](_0x5d1da3)['catch'](loggerCatch(_0xd155('0x191')));_0x2b3093[_0xd155('0xc8')](_0x5d1da3)[_0xd155('0x9d')](loggerCatch(_0xd155('0x191')))[_0xd155('0x1b')](function(){delete _0x2b3093[_0xd155('0x23')][_0x81828d];return _0x4aa012(msgResponse(_0xd155('0x164'),_0xd155('0x192'),_0xd155('0x193')));});});});};Dialer[_0xd155('0x83')][_0xd155('0x194')]=function(_0x43f50d,_0x23a87e,_0x21bcc6){var _0x50ed77=new History(_0x23a87e);if(_0x50ed77[_0xd155('0x121')]+_0x50ed77[_0xd155('0x12d')]+_0x50ed77[_0xd155('0x122')]+_0x50ed77[_0xd155('0x12e')]+_0x50ed77[_0xd155('0xd7')]+_0x50ed77[_0xd155('0xe4')]+_0x50ed77[_0xd155('0x11d')]+_0x50ed77['countagentrejectretry']>=_0x21bcc6['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x43f50d){case 0x3:if(_0x50ed77['countnoanswerretry']>=_0x21bcc6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x50ed77[_0xd155('0x122')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x195')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x196')));break;case 0x5:if(_0x50ed77[_0xd155('0x121')]>=_0x21bcc6[_0xd155('0x197')]-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countbusyretry':_0x50ed77['countbusyretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x198')],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x50ed77[_0xd155('0x12d')]>=_0x21bcc6[_0xd155('0x199')]-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countcongestionretry':_0x50ed77['countcongestionretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x19a')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x19b')));break;case 0x0:if(_0x50ed77['countnosuchnumberretry']>=_0x21bcc6[_0xd155('0x19c')]-0x1){return!![];}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countnosuchnumberretry':_0x50ed77[_0xd155('0x12e')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6['dialNoSuchNumberRetryFrequency'],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77['VoiceQueueId']||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x19d')));}break;case 0xa:if(_0x50ed77[_0xd155('0xd7')]>=_0x21bcc6[_0xd155('0x19e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x50ed77['countdropretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0xd3')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0xdd')));break;case 0xb:if(_0x50ed77[_0xd155('0xe4')]>=_0x21bcc6['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countabandonedretry':_0x50ed77['countabandonedretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0xe5')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77['ContactId'],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77['VoiceQueueId']||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x50ed77['countmachineretry']>=_0x21bcc6['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x50ed77[_0xd155('0x11d')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x129')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x12a')));break;case 0x14:if(_0x50ed77[_0xd155('0x123')]>=_0x21bcc6['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x50ed77[_0xd155('0x123')]+=0x1,'scheduledat':moment()['add'](_0x21bcc6[_0xd155('0x19f')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x1a0')));break;default:return!![];}};Dialer[_0xd155('0x83')][_0xd155('0x10c')]=function(_0x314c21,_0x249b17,_0x37a88f){var _0x49270b=this;var _0x5cc76e=new History(_0x314c21);var _0xc50d00=![];var _0x5bebb6;var _0x9d90e8;return new Promise(function(_0x1a84b1,_0x29694c){if(_[_0xd155('0x51')](_0x249b17)&&typeof _0x249b17!==_0xd155('0x162')){return _0x29694c(msgResponse(_0xd155('0x1a1'),_0xd155('0x8e'),_0xd155('0x1a2')));}if(_[_0xd155('0x51')](_0x37a88f)&&typeof _0x37a88f!==_0xd155('0x162')){return _0x29694c(msgResponse(_0xd155('0x1a1'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x5cc76e,_0x37a88f[_0xd155('0xc4')],_0x249b17)[_0xd155('0x3e')](function(_0xe5ec18){if(_0xe5ec18['additional']==0x1)_0xc50d00=!![];switch(_0x37a88f['reason']){case'0':_0x249b17['outboundNoSuchCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x0;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1a3');_0x5cc76e[_0xd155('0x12e')]+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;ami[_0xd155('0x116')](_0xd155('0x1a4'),ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1a5')));_0x5bebb6=_0x249b17[_0xd155('0x1a6')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x49270b[_0xd155('0x194')](0x0,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countnosuchnumberretry']>=_0x249b17[_0xd155('0x19c')]){_0x49270b['createStateFinal'](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1a7'));}else{_0x49270b['stateGlobal'](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x249b17[_0xd155('0x1a8')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x3;_0x5cc76e['statedesc']=_0xd155('0x1a9');_0x5cc76e['countnoanswerretry']+=0x1;_0x5cc76e['countglobal']+=0x1;var _0x560e1a=ut[_0xd155('0x1aa')](_0x314c21,_0x249b17);ami['emit'](_0xd155('0x1ab'),_0x560e1a);_0x5bebb6=_0x249b17['dialNoAnswerRetryFrequency'];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1ac')));if(_0x49270b['checkRetriveMax'](0x3,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countnoanswerretry']>=_0x249b17[_0xd155('0x1ad')]){_0x49270b['createStateFinal'](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1ae'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1ae'));}}break;case'5':_0x249b17['outboundBusyCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x5;_0x5cc76e[_0xd155('0xcf')]='Busy';_0x5cc76e[_0xd155('0x121')]+=0x1;_0x5cc76e['countglobal']+=0x1;ami['emit'](_0xd155('0x1af'),ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1b0')));_0x5bebb6=_0x249b17[_0xd155('0x198')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils['createHistory'](_0x5cc76e)['catch'](loggerCatch(_0xd155('0x1b1')));if(_0x49270b['checkRetriveMax'](0x5,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x121')]>=_0x249b17[_0xd155('0x197')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b2'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x205\x20busy');}}break;case'8':_0x249b17['outboundCongestionCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x8;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1b3');_0x5cc76e[_0xd155('0x12d')]+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0x19a')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];ami[_0xd155('0x116')]('custom:agentcongestion',ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1b4')));hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1b5')));if(_0x49270b[_0xd155('0x194')](0x8,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x12d')]>=_0x249b17[_0xd155('0x199')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b6'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b6'));}}break;case'11':_0x249b17[_0xd155('0x1b7')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0xb;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1b8');_0x5cc76e['countabandonedretry']+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0xe5')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0xec')));if(_0x49270b[_0xd155('0x194')](0xb,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countabandonedretry']>=_0x249b17['dialAbandonedMaxRetry']){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b9'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x2011\x20abandoned');}}break;case'20':_0x249b17[_0xd155('0x1ba')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x14;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1bb');_0x5cc76e['countagentrejectretry']+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0x19f')];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1bc')));hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1bd')));if(_0x49270b[_0xd155('0x194')](0x14,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x123')]>=_0x249b17[_0xd155('0x1be')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1bf'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1bf'));}}break;default:_0x249b17[_0xd155('0x13b')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0xc;_0x5cc76e['statedesc']=_0x37a88f['reason'];_0x5bebb6=_0x249b17[_0xd155('0x19f')];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1c0')));if(_0x49270b[_0xd155('0x194')](_0x37a88f[_0xd155('0xc4')],_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x121')]+_0x5cc76e[_0xd155('0x12d')]+_0x5cc76e[_0xd155('0x122')]+_0x5cc76e[_0xd155('0x12e')]+_0x5cc76e[_0xd155('0xd7')]+_0x5cc76e['countabandonedretry']+_0x5cc76e['countmachineretry']+_0x5cc76e[_0xd155('0x123')]>=_0x249b17['dialGlobalMaxRetry']){_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0x37a88f[_0xd155('0xc4')]);}else{_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0x37a88f['reason']);}}}})['then'](function(){if(_0xc50d00){hopperUtils['swapAdditionalPhones'](_0x5cc76e,_0x5bebb6,_0x9d90e8)[_0xd155('0x3e')](function(){return _0x1a84b1(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2a5d44,_0x69a9bb,_0x20bea9,_0x407490){var _0x424ba5=new Final(_0x2a5d44);_0x424ba5[_0xd155('0x6b')]=0xf;_0x424ba5['statedesc']='Global';this[_0xd155('0x12f')](_0x424ba5,_0x69a9bb,_0x20bea9,_0x407490);};Dialer[_0xd155('0x83')][_0xd155('0x12f')]=function(_0x2372ae,_0x2c0305,_0x309742,_0x4cbd8c){hopperUtils['moveContactManagedDialer'](_0x2372ae)[_0xd155('0x3e')](function(){return _0x2c0305(msgResponse(_0xd155('0x1a1'),_0xd155('0x10a'),_0x4cbd8c));})['catch'](function(){return _0x309742(msgResponse('[moveContactManagedDialer][0]',_0xd155('0x8e'),_0xd155('0x1c1')));});};Dialer['prototype'][_0xd155('0x8')]=function(_0x1b3860){var _0x3de9c7=_0x1b3860[_0xd155('0x1c2')]/0x64;var _0x2b9cfe=_0x1b3860['outboundDropCallsDayTimeout']/(_0x1b3860[_0xd155('0x1c3')]+_0x1b3860[_0xd155('0xc3')]);var _0x139eb0=Math['round'](_0x1b3860[_0xd155('0x1c4')]*(_0x1b3860[_0xd155('0x1c5')]/0x64));var _0x5209c6=Math[_0xd155('0x1c6')](_0x1b3860[_0xd155('0x1c4')]*(_0x1b3860[_0xd155('0x1c7')]/0x64));var _0x183044=_0x1b3860[_0xd155('0x143')]+_0x1b3860['talking'];var _0x34c6de=Math[_0xd155('0x1c8')](_0x1b3860['erlangCalls']*_0x1b3860[_0xd155('0x5b')]*_0x1b3860['predictiveIntervalHitRate']*_0x1b3860[_0xd155('0x1c9')]);if(_[_0xd155('0x51')](_0x1b3860['startProgressive'])){if(!_[_0xd155('0x51')](_0x1b3860[_0xd155('0x27')])){_0x1b3860[_0xd155('0x27')]=undefined;loggerPredictive[_0xd155('0x63')](_0xd155('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd155('0x51')](_0x1b3860[_0xd155('0x61')])){loggerPredictive[_0xd155('0x63')]('[startMethodPredictive][StartProgressive]',_0xd155('0x1cb'));clearInterval(_0x1b3860[_0xd155('0x61')]);_0x1b3860['handlePredictive']=undefined;}_0x1b3860['startProgressive']=moment()[_0xd155('0x79')](_0xd155('0xc2'));loggerPredictive['info'](_0x1b3860[_0xd155('0x42')],_0xd155('0x1cc'),_0x1b3860['startProgressive']);this[_0xd155('0xad')](_0x1b3860,0x1);}else if(ifInterval(_0x1b3860['dialPredictiveInterval'],_0x1b3860['startProgressive'])){this[_0xd155('0xad')](_0x1b3860,0x1);loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x1cd'),_0x1b3860[_0xd155('0x28')],_0x1b3860[_0xd155('0x42')]);_0x1b3860[_0xd155('0x57')]=0x0;_0x1b3860['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3de9c7<_0x2b9cfe&&_0x1b3860[_0xd155('0x1ce')]==='dropRate'){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0xd155('0x1cf'),_0xd155('0x1d0'),_0x2b9cfe,_0xd155('0x28'),_0x1b3860[_0xd155('0x42')]);}else if(_0x34c6de<_0x1b3860[_0xd155('0xce')]&&_0x1b3860[_0xd155('0x1ce')]==='dropRate'){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x34c6de,_0xd155('0x1d1'),_0x1b3860['predictiveIntervalErlangCallsDroppedCalls'],_0xd155('0x28'),_0x1b3860[_0xd155('0x42')]);}else if(!ifInterval(_0x1b3860['dialPredictiveInterval'],_0x1b3860[_0xd155('0x28')])&&_[_0xd155('0x51')](_0x1b3860['startPredictive'])&&!_['isUndefined'](_0x1b3860[_0xd155('0x28')])){_0x1b3860[_0xd155('0x27')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));loggerPredictive[_0xd155('0x44')](_0x1b3860['name'],'started\x20in\x20predictive\x20at',_0x1b3860[_0xd155('0x27')]);hopperUtils[_0xd155('0x1d2')](_0x1b3860['dialPredictiveInterval'])[_0xd155('0x3e')](this[_0xd155('0x1d3')](_0x1b3860))[_0xd155('0x3e')](mergeDataErlangB(_0x1b3860))['then'](this[_0xd155('0x1d4')](_0x1b3860))[_0xd155('0x9d')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1b3860));}else if(!ifInterval(_0x1b3860[_0xd155('0x1d5')],_0x1b3860[_0xd155('0x27')])){_0x1b3860[_0xd155('0xce')]=0x0;_0x1b3860[_0xd155('0x27')]=moment()['format'](_0xd155('0xc2'));loggerPredictive['info'](_0x1b3860[_0xd155('0x42')],_0xd155('0x1d6'),_0x1b3860['startPredictive']);clearInterval(_0x1b3860[_0xd155('0x61')]);_0x1b3860[_0xd155('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x1b3860[_0xd155('0x1d5')])[_0xd155('0x3e')](this['getDataPredictive'](_0x1b3860))['then'](mergeDataErlangB(_0x1b3860))['then'](this[_0xd155('0x1d4')](_0x1b3860))[_0xd155('0x9d')](loggerCatchPredictive(_0xd155('0x1d7'),_0x1b3860));}else if(_0x1b3860['predictiveIntervalAvailable']&&_0x183044<_0x1b3860['predictiveIntervalAvailable']-_0x5209c6){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0x1b3860['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x183044,_0xd155('0x1d8'),_0x1b3860[_0xd155('0x1c4')],'-',_0x5209c6,'=',_0x1b3860[_0xd155('0x1c4')]-_0x5209c6,')');}else if(_0x1b3860[_0xd155('0x1c4')]&&_0x183044>_0x1b3860['predictiveIntervalAvailable']+_0x139eb0){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0x1b3860[_0xd155('0x42')],_0xd155('0x1d9'),_0x183044,_0xd155('0x1da'),_0x1b3860[_0xd155('0x1c4')],'+',_0x139eb0,'=',_0x1b3860[_0xd155('0x1c4')]+_0x139eb0,')');}};Dialer['prototype'][_0xd155('0x1d3')]=function(_0x281b8f){var _0x411e42=this;return function(_0x558d98){return new Promise(function(_0x43b3a3,_0x3e50ee){_['merge'](_0x281b8f,_0x558d98[0x0]);if(checkGetDataPredictive(_0x558d98[0x0])){var _0x1a599d=_0x281b8f[_0xd155('0x1c4')]=_0x281b8f[_0xd155('0x145')]+_0x281b8f['available'];var _0x2666d7=_0x281b8f[_0xd155('0x1d5')]*0x3c;var _0x246025=_0x558d98[0x0][_0xd155('0x4f')]+_0x558d98[0x0][_0xd155('0x53')];var _0x4803f6=(_0x558d98[0x0][_0xd155('0x49')]+_0x558d98[0x0][_0xd155('0x4b')]+_0x558d98[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x558d98[0x0]['predictiveIntervalTotalCalls'];_0x281b8f[_0xd155('0x1db')]=_0x4803f6>0x0?_0x4803f6:0x1;switch(_0x281b8f[_0xd155('0x1ce')]){case _0xd155('0x1dc'):var _0x263cc6=_0x281b8f[_0xd155('0x1c2')]/0x64;return _0x411e42[_0xd155('0x1dd')](_0x1a599d,_0x2666d7,_0x246025,_0x4803f6,_0x263cc6)[_0xd155('0x3e')](function(_0x6d9d22){return _0x43b3a3(_0x6d9d22);});case _0xd155('0x1de'):var _0x545ee4=_0x281b8f[_0xd155('0x1c2')]/0x64;return _0x411e42[_0xd155('0x1df')](_0x1a599d,_0x2666d7,_0x246025,_0x4803f6,_0x545ee4)['then'](function(_0x34618e){return _0x43b3a3(_0x34618e);});default:return _0x3e50ee(msgResponse('[getDataPredictive]','Failure',_0xd155('0x1e0')));}}else{return _0x3e50ee(msgResponse(_0xd155('0x1e1'),_0xd155('0x8e'),_0xd155('0x1e2')));}});};};Dialer[_0xd155('0x83')][_0xd155('0x1e3')]=function(_0x2f0c11){var _0x52433a=this;return function(_0x34599b){return new Promise(function(_0x2320ab,_0x22449d){_['merge'](_0x2f0c11,_0x34599b[0x0]);if(checkGetDataPredictive(_0x34599b[0x0])){loggerPredictive[_0xd155('0x44')](JSON['stringify'](_0x34599b[0x0]));if(_0x2f0c11[_0xd155('0x1ce')]===_0xd155('0x1dc')){return _0x52433a[_0xd155('0x158')](_0x2f0c11['id'])[_0xd155('0x3e')](function(_0x54e3a2){var _0x3d2ca0=_0x2f0c11[_0xd155('0x1e4')]-_0x54e3a2[0x0][_0xd155('0x1e5')];var _0x4d3f2e=_0x2f0c11[_0xd155('0x1d5')]*0x3c;var _0x5d3649=_0x34599b[0x0][_0xd155('0x4f')]+_0x34599b[0x0][_0xd155('0x53')];var _0x138574=(_0x34599b[0x0][_0xd155('0x49')]+_0x34599b[0x0][_0xd155('0x4b')]+_0x34599b[0x0][_0xd155('0x4c')])/_0x34599b[0x0][_0xd155('0x47')];var _0x48dc7e=_0x2f0c11[_0xd155('0x1c2')]/0x64;_0x2f0c11[_0xd155('0x1e6')]=_0x54e3a2[0x0]['outboundQueuePauses']||0x0;_0x2f0c11[_0xd155('0x1db')]=_0x138574>0x0?_0x138574:0x1;return _0x52433a[_0xd155('0x1dd')](_0x3d2ca0,_0x4d3f2e,_0x5d3649,_0x138574,_0x48dc7e);})[_0xd155('0x3e')](function(_0x4c7204){return _0x2320ab(_0x4c7204);})[_0xd155('0x9d')](function(_0x12adc9){return _0x22449d(msgResponse(_0xd155('0x1e7'),_0xd155('0x8e'),JSON[_0xd155('0x70')](_0x12adc9)));});}if(_0x2f0c11[_0xd155('0x1ce')]===_0xd155('0x1de')){return _0x52433a[_0xd155('0x158')](_0x2f0c11['id'])[_0xd155('0x3e')](function(_0x52c897){var _0x2de4f5=_0x2f0c11[_0xd155('0x1e4')]-_0x52c897[0x0][_0xd155('0x1e5')];var _0x5d3a94=_0x2f0c11[_0xd155('0x1d5')]*0x3c;var _0x226ff8=_0x34599b[0x0][_0xd155('0x4f')]+_0x34599b[0x0][_0xd155('0x53')];var _0x38221c=(_0x34599b[0x0][_0xd155('0x49')]+_0x34599b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x34599b[0x0][_0xd155('0x4c')])/_0x34599b[0x0][_0xd155('0x47')];var _0x45bd87=_0x2f0c11[_0xd155('0x1c2')]/0x64;_0x2f0c11[_0xd155('0x1e6')]=_0x52c897[0x0]['outboundQueuePauses']||0x0;_0x2f0c11['predictiveIntervalHitRate']=_0x38221c>0x0?_0x38221c:0x1;return _0x52433a[_0xd155('0x1df')](_0x2de4f5,_0x5d3a94,_0x226ff8,_0x38221c,_0x45bd87);})['then'](function(_0x11e783){return _0x2320ab(_0x11e783);})[_0xd155('0x9d')](function(_0x10fd74){return _0x22449d(msgResponse('[CatchErlangB]',_0xd155('0x8e'),JSON[_0xd155('0x70')](_0x10fd74)));});}}else{return _0x22449d(msgResponse('[getDataPredictive]',_0xd155('0x8e'),'check\x20failure'));}});};};Dialer[_0xd155('0x83')][_0xd155('0x1d4')]=function(_0x1528ba){var _0x44f67b=this;return function(){var _0x1853bd=0x0;var _0x3c6b40=Math[_0xd155('0x1c8')](_0x1528ba[_0xd155('0x59')]*0x3e8);if(_0x3c6b40>0x0){_0x3c6b40=_0x3c6b40<0x64?0x64:_0x3c6b40;loggerPredictive[_0xd155('0x44')](_0x1528ba[_0xd155('0x42')],'one\x20call\x20every:',_0x3c6b40,'milliseconds');_0x1528ba[_0xd155('0x61')]=setInterval(function(){_0x44f67b['handlePredictive'](_0x1528ba);loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x1e8'),_0x1853bd+=0x1);},_0x3c6b40);}else{loggerPredictive[_0xd155('0x44')](_0x1528ba['name'],_0xd155('0x1e9'));}};};Dialer[_0xd155('0x83')][_0xd155('0x1ea')]=function(_0x405211,_0x3bfea5){var _0x2add2b=this;return function(_0x444646){if(_[_0xd155('0x8c')](_0x444646)){if(_[_0xd155('0xf4')](_0x3bfea5[_0xd155('0x15d')])||!_0x3bfea5[_0xd155('0x1eb')]){if(_0x405211[_0xd155('0xab')]===_0xd155('0x7')){_0x405211[_0xd155('0x6d')]=_[_0xd155('0x51')](_0x405211[_0xd155('0x6d')])?!![]:_0x405211[_0xd155('0x6d')];var _0x2de3c0=uuid['v4']();_0x2add2b['actions'][_0x2de3c0]=new Action(_0x405211,_0x3bfea5,_0x2de3c0);loggerBooked[_0xd155('0x44')]('[booked][checkContactBlack]',_0x2de3c0,'queueStatusComplete:\x20',JSON[_0xd155('0x70')](_0x405211['queueStatusComplete']),'Queue:\x20',_0x405211[_0xd155('0x42')]);if(_0x405211[_0xd155('0x6d')]){_0x405211[_0xd155('0x6d')]=![];_0x2add2b[_0xd155('0x2a')][_0x2add2b[_0xd155('0x23')][_0x2de3c0]['queue']]=[];ami[_0xd155('0x96')]({'actionid':_0x2de3c0,'action':'queuestatus','queue':_0x405211['name']})[_0xd155('0x9d')](function(){utils[_0xd155('0xbf')](_0x405211,_0xd155('0x1ec'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':_0x2add2b[_0xd155('0x23')][_0x2de3c0]['ContactId'],'ListId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdb')],'VoiceQueueId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xfc')]||undefined,'CampaignId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x1ed')));delete _0x2add2b[_0xd155('0x23')][_0x2de3c0];});}else{loggerBooked[_0xd155('0x44')](_0xd155('0x1ee'),JSON[_0xd155('0x70')](_0x405211[_0xd155('0x6d')]),_0xd155('0x1ef'),_0x405211[_0xd155('0x42')]);utils[_0xd155('0xbf')](_0x405211,_0xd155('0x1ec'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xda')],'ListId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdb')],'VoiceQueueId':_0x2add2b['actions'][_0x2de3c0][_0xd155('0xfc')]||undefined,'CampaignId':_0x2add2b['actions'][_0x2de3c0]['CampaignId']||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x1ed')));delete _0x2add2b[_0xd155('0x23')][_0x2de3c0];}}else{return _0x2add2b[_0xd155('0x161')](_0x405211,_0x3bfea5);}}else{if(utils[_0xd155('0x5f')](undefined,_0x3bfea5[_0xd155('0x1f0')])<_0x405211['dialRecallMeTimeout']*0x3c){if(_0x3bfea5[_0xd155('0x14e')]&&!_0x3bfea5[_0xd155('0x14e')][_0xd155('0x1f1')]){_0x2add2b[_0xd155('0x1d')][_0xd155('0xf9')](_0x3bfea5['id'])['finally'](function(){utils[_0xd155('0xbf')](_0x405211,'[checkContactBlack]');});}else{hopperUtils[_0xd155('0x1f2')]({'active':![]},_0x3bfea5['id'],0x1)['finally'](function(){utils['decrementOriginate'](_0x405211,_0xd155('0x1ec'));});}}else{_0x405211[_0xd155('0x1f3')]+=0x1;utils['decrementOriginate'](_0x405211,_0xd155('0x1ec'));if(_0x405211[_0xd155('0x1f4')]){hopperUtils[_0xd155('0xd8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3bfea5['ContactId'],'ListId':_0x3bfea5[_0xd155('0xdb')],'VoiceQueueId':_0x3bfea5[_0xd155('0xfc')]||undefined,'CampaignId':_0x3bfea5[_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x1f5')));hopperUtils[_0xd155('0xeb')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')]['QUEUE_RECALL'],0x17,_0xd155('0x1f6')))['catch'](loggerCatch(_0xd155('0x1f7')));}else{_0x2add2b[_0xd155('0x118')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')][_0xd155('0x1f8')],0x16,'RecallFailedTimeout'),_0xd155('0x1f9'),_0xd155('0x1fa'));}}}}else{_0x405211[_0xd155('0x1fb')]+=0x1;_0x2add2b[_0xd155('0x118')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')][_0xd155('0x1fc')],0xd,_0xd155('0x1fd')),_0xd155('0x1fe'),_0xd155('0x1ff'));throw _0xd155('0x200');}};};Dialer['prototype'][_0xd155('0x201')]=function(_0x51be4e){var _0x8a051=this;var _0x7c22f1=_0x51be4e[_0xd155('0x202')]-_0x51be4e[_0xd155('0x203')];emitCampaignSummary(_0x51be4e);if(_0x7c22f1>0x0&&_0x51be4e[_0xd155('0x204')]==0x0){if(_0x7c22f1>this['maxNumberOriginate']){_0x7c22f1=this[_0xd155('0x22')];}_0x51be4e[_0xd155('0x204')]=0x1;hopperUtils[_0xd155('0x205')](_0x51be4e,_0x7c22f1)[_0xd155('0x3e')](function(_0x20a742){_0x51be4e[_0xd155('0x204')]=0x0;if(_0x20a742){if(!utils[_0xd155('0x206')](_0x20a742)){_0x51be4e[_0xd155('0x66')]=utils['CAMPAIGN_STATUS'][_0xd155('0x207')];logger[_0xd155('0x44')](_0xd155('0x208')+_0x51be4e[_0xd155('0x42')]);}else{_0x51be4e[_0xd155('0x203')]+=_0x20a742[_0xd155('0x94')];_0x51be4e['message']=utils[_0xd155('0x67')][_0xd155('0x209')];for(var _0x405bae=0x0;_0x405bae<_0x20a742[_0xd155('0x94')];_0x405bae+=0x1){_0x51be4e[_0xd155('0x20a')]+=0x1;if(_[_0xd155('0xf4')](_0x20a742[_0x405bae])||_[_0xd155('0xf4')](_0x20a742[_0x405bae][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x20a742[_0x405bae][_0xd155('0x163')])){_0x8a051[_0xd155('0x15a')]('[actionOriginate]\x20',_0x51be4e,_0x20a742[_0x405bae]);}else{hopperUtils[_0xd155('0x20c')](_[_0xd155('0x71')](_0x20a742[_0x405bae],[_0xd155('0xdc'),_0xd155('0x163')]))[_0xd155('0x3e')](_0x8a051['checkContactBlack'](_0x51be4e,_0x20a742[_0x405bae]))[_0xd155('0x9d')](function(_0x52c845){logger['error']('[actionOriginateIvr]',_0x52c845);utils[_0xd155('0xbf')](_0x51be4e,'[handleIvr]');});}}}}})[_0xd155('0x9d')](function(_0xcf3696){_0x51be4e[_0xd155('0x204')]=0x0;logger[_0xd155('0x63')](_0xd155('0x20d'),_0xcf3696);});}};Dialer[_0xd155('0x83')][_0xd155('0xad')]=function(_0x249e5a,_0x2d782a){var _0xdbb133=this;var _0x2ff982=[];if(_0x2d782a<0x1||_0x249e5a[_0xd155('0xab')]===_0xd155('0x7')){_0x2d782a=0x1;}var _0x1c9ff3=Math[_0xd155('0x1c8')](_0x249e5a[_0xd155('0x143')]*_0x2d782a)-_0x249e5a[_0xd155('0x203')];if(_0x249e5a['dialLimitQueue']>0x0){var _0x5ae52d=_0x249e5a[_0xd155('0x20e')]-_0x249e5a[_0xd155('0x203')]-_0x249e5a['talking']-_0x249e5a[_0xd155('0x146')];if(_0x1c9ff3>_0x5ae52d){_0x1c9ff3=_0x5ae52d;}}if(_0x1c9ff3>0x0&&_0x249e5a[_0xd155('0x204')]==0x0){if(_0x249e5a[_0xd155('0xab')]==='booked'){_0x1c9ff3=0x1;}if(_0x1c9ff3>this['maxNumberOriginate']){_0x1c9ff3=this[_0xd155('0x22')];}for(var _0x385197 in this['agents']){if(typeof this[_0xd155('0x20')][_0x385197]!==_0xd155('0xa5')){if(this[_0xd155('0x20')][_0x385197][_0xd155('0x6b')]===_0xd155('0x20f')&&this['agents'][_0x385197][_0xd155('0xf0')]===_0xd155('0x81')){_0x2ff982[_0xd155('0x95')](this[_0xd155('0x20')][_0x385197]['id']);}}}_0x249e5a['temp']=0x1;hopperUtils['getContactDialer'](_0x249e5a,_0x2ff982,_0x1c9ff3)['then'](function(_0x229dd5){_0x249e5a['temp']=0x0;if(_0x229dd5){if(!utils[_0xd155('0x206')](_0x229dd5)){hopperUtils['countReScheduled'](_0x249e5a)[_0xd155('0x3e')](sendMessageReschedule(_0x249e5a))[_0xd155('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x249e5a[_0xd155('0x203')]+=_0x229dd5[_0xd155('0x94')];_0x249e5a[_0xd155('0x66')]=_0x249e5a[_0xd155('0xab')]==='booked'?utils[_0xd155('0x67')][_0xd155('0x147')]:utils[_0xd155('0x67')]['RUNNING'];for(var _0x9193e1=0x0;_0x9193e1<_0x229dd5[_0xd155('0x94')];_0x9193e1+=0x1){if(_[_0xd155('0xf4')](_0x229dd5[_0x9193e1])||_[_0xd155('0xf4')](_0x229dd5[_0x9193e1][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x229dd5[_0x9193e1]['phone'])){_0xdbb133[_0xd155('0x15a')](_0xd155('0x210'),_0x249e5a,_0x229dd5[_0x9193e1]);}else{hopperUtils[_0xd155('0x211')](_[_0xd155('0x71')](_0x229dd5[_0x9193e1],[_0xd155('0xfc'),_0xd155('0x163')]))[_0xd155('0x3e')](_0xdbb133[_0xd155('0x1ea')](_0x249e5a,_0x229dd5[_0x9193e1]))[_0xd155('0x9d')](function(_0x3aaa63){logger[_0xd155('0x63')](_0xd155('0x212'),_0x3aaa63);utils[_0xd155('0xbf')](_0x249e5a,'[handlePower]');});}}}}})[_0xd155('0x9d')](function(_0x22dcf){_0x249e5a[_0xd155('0x204')]=0x0;logger[_0xd155('0x63')]('[getContactCampaign2]',_0x22dcf);});}};Dialer[_0xd155('0x83')][_0xd155('0x61')]=function(_0x16f9d4){if(_0x16f9d4[_0xd155('0x20e')]>0x0){var _0xe252dd=_0x16f9d4['dialLimitQueue']-_0x16f9d4[_0xd155('0x203')]-_0x16f9d4[_0xd155('0x145')];if(_0xe252dd>0x0&&_0x16f9d4[_0xd155('0x204')]==0x0){this[_0xd155('0x213')](_0x16f9d4);}else{loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x214'));}}else{this[_0xd155('0x213')](_0x16f9d4);}};Dialer[_0xd155('0x83')]['tryOriginatePredictive']=function(_0x591119){var _0x9309af=this;var _0x11f036=[];_0x591119[_0xd155('0x203')]+=0x1;for(var _0x22b199 in this['agents']){if(typeof this[_0xd155('0x20')][_0x22b199]!==_0xd155('0xa5')){if(this[_0xd155('0x20')][_0x22b199][_0xd155('0x6b')]===_0xd155('0x20f')&&this[_0xd155('0x20')][_0x22b199][_0xd155('0xf0')]===_0xd155('0x81')){_0x11f036[_0xd155('0x95')](this[_0xd155('0x20')][_0x22b199]['id']);}}}_0x591119[_0xd155('0x204')]=0x1;return this[_0xd155('0x215')](_0x591119['id'],_0x11f036,0x1,_0x591119[_0xd155('0x216')],_0x591119)[_0xd155('0x3e')](function(_0x367932){_0x591119['temp']=0x1;if(_0x367932){if(!utils[_0xd155('0x206')](_0x367932)){utils[_0xd155('0x217')](_0x591119,0x1,0x0);return hopperUtils[_0xd155('0x218')](_0x591119)[_0xd155('0x3e')](sendMessageReschedule(_0x591119))[_0xd155('0x9d')](loggerCatch(_0xd155('0x219')));}else{_0x591119[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x209')];if(_[_0xd155('0xf4')](_0x367932[0x0])||_[_0xd155('0xf4')](_0x367932[0x0][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x367932[0x0]['phone'])){_0x9309af[_0xd155('0x15a')](_0xd155('0x210'),_0x591119,_0x367932[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xd155('0x71')](_0x367932[0x0],[_0xd155('0xfc'),_0xd155('0x163')]))['then'](_0x9309af[_0xd155('0x1ea')](_0x591119,_0x367932[0x0]))[_0xd155('0x9d')](function(_0x3c9323){logger['error']('[actionOriginatePredictive]',_0x3c9323);utils[_0xd155('0xbf')](_0x591119,_0xd155('0x21a'));});}}}})[_0xd155('0x9d')](function(_0x2a2e45){_0x591119[_0xd155('0x204')]=0x0;logger['error'](_0xd155('0x20d'),_0x2a2e45);});};Dialer[_0xd155('0x83')][_0xd155('0x1dd')]=function(_0x541c75,_0x2dd666,_0x5d1138,_0x524bff,_0x401f44,_0x301ce8){loggerPredictive[_0xd155('0x44')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xd155('0x44')](_0xd155('0x21b'),_0x541c75);loggerPredictive[_0xd155('0x44')](_0xd155('0x21c'),_0x2dd666);loggerPredictive[_0xd155('0x44')](_0xd155('0x21d'),_0x5d1138);loggerPredictive[_0xd155('0x44')]('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',_0x524bff);loggerPredictive[_0xd155('0x44')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x401f44);loggerPredictive[_0xd155('0x44')](_0xd155('0x50'));return new Promise(function(_0x422278,_0x4cf0aa){if(_0x541c75<=0x0||isNaN(_0x541c75)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x21f')+_0x541c75));}if(_0x5d1138<=0x0||isNaN(_0x5d1138)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x220')+_0x5d1138));}if(_0x524bff<=0x0||isNaN(_0x524bff)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),'Error',_0xd155('0x221')+_0x524bff));}if(_0x2dd666<=0x0||isNaN(_0x2dd666)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x222')+_0x2dd666));}if(_0x401f44<=0x0||isNaN(_0x401f44)){return _0x4cf0aa(msgResponse('[abandonmentRate]',_0xd155('0x192'),_0xd155('0x223')+_0x401f44));}_0x301ce8=_0x301ce8||0x0;var _0x5a5ba2=0x1/_0x5d1138;var _0x4e180b=0x0;var _0x85987b=0x0;var _0x35dfb9=0x0;var _0xacb256=0x0;for(var _0x24e23f=0x0;_0x35dfb9<_0x401f44;_0x24e23f+=0x1){_0x85987b=_0x24e23f/_0x2dd666;_0x4e180b=(_0x524bff*_0x85987b+_0x301ce8)/_0x5a5ba2;_0x35dfb9=utils[_0xd155('0x224')](_0x4e180b,_0x541c75);_0xacb256=_0x4e180b/_0x541c75*(0x1-utils['erlangb'](_0x4e180b,_0x541c75));}return _0x422278({'erlangCalls':_0x24e23f,'erlangCallToSecond':_0x2dd666/_0x24e23f,'erlangAbandonmentRate':_0x35dfb9,'erlangBusyFactor':_0xacb256});});};Dialer[_0xd155('0x83')][_0xd155('0x1df')]=function(_0x20afdd,_0x5a6599,_0x1afea2,_0x5f6716,_0x267bcf,_0x49546d){loggerPredictive[_0xd155('0x44')](_0xd155('0x225'));loggerPredictive[_0xd155('0x44')](_0xd155('0x21b'),_0x20afdd);loggerPredictive[_0xd155('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a6599);loggerPredictive[_0xd155('0x44')](_0xd155('0x21d'),_0x1afea2);loggerPredictive['info'](_0xd155('0x226'),_0x5f6716);loggerPredictive[_0xd155('0x44')](_0xd155('0x227'),_0x267bcf);loggerPredictive[_0xd155('0x44')](_0xd155('0x50'));return new Promise(function(_0x2e6434,_0x514780){if(_0x20afdd<=0x0||isNaN(_0x20afdd)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x21f')+_0x20afdd));}if(_0x1afea2<=0x0||isNaN(_0x1afea2)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),'Ts\x20=\x20'+_0x1afea2));}if(_0x5f6716<=0x0||isNaN(_0x5f6716)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x221')+_0x5f6716));}if(_0x5a6599<=0x0||isNaN(_0x5a6599)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x222')+_0x5a6599));}if(_0x267bcf<=0x0||isNaN(_0x267bcf)){return _0x514780(msgResponse('[busyFactor]',_0xd155('0x192'),'Umin\x20=\x20'+_0x267bcf));}_0x49546d=_0x49546d||0x0;var _0x17cf35=0x1/_0x1afea2;var _0x567d6d=0x0;var _0x5d02e7=0x0;var _0xae2f31=0x0;var _0x24b5b7=0x0;for(var _0x3c9071=0x0;_0x24b5b7<_0x267bcf;_0x3c9071+=0x1){_0x5d02e7=_0x3c9071/_0x5a6599;_0x567d6d=(_0x5f6716*_0x5d02e7+_0x49546d)/_0x17cf35;_0xae2f31=utils[_0xd155('0x224')](_0x567d6d,_0x20afdd);_0x24b5b7=_0x567d6d/_0x20afdd*(0x1-utils[_0xd155('0x224')](_0x567d6d,_0x20afdd));}return _0x2e6434({'erlangCalls':_0x3c9071,'erlangCallToSecond':_0x5a6599/_0x3c9071,'erlangAbandonmentRate':_0xae2f31,'erlangBusyFactor':_0x24b5b7});});};module[_0xd155('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 3cba02e..26f3474 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16e2=['\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x483d2b,_0x4a18d7){var _0x37524d=function(_0x544a03){while(--_0x544a03){_0x483d2b['push'](_0x483d2b['shift']());}};_0x37524d(++_0x4a18d7);}(_0x16e2,0x13a));var _0x216e=function(_0x1628c4,_0xf5244a){_0x1628c4=_0x1628c4-0x0;var _0xb4a5af=_0x16e2[_0x1628c4];return _0xb4a5af;};'use strict';var util=require(_0x216e('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x402155,_0x1e4abc,_0x54abcb){var _0x2db3b4='';if(!_[_0x216e('0x1')](_0x1e4abc)&&_0x216e('0x2')===typeof _0x1e4abc){_0x2db3b4+=_0x1e4abc;}if(!_[_0x216e('0x1')](_0x54abcb)&&_0x216e('0x2')===typeof _0x54abcb){_0x2db3b4+='\x20'+_0x54abcb;}if(_0x2db3b4!==''){return _0x2db3b4;}return _0x402155;}function Action(_0x4ea7f3,_0x202257,_0x3de8ee){this[_0x216e('0x3')]=_0x4ea7f3;this[_0x216e('0x4')]=_0x3de8ee||undefined;this[_0x216e('0x5')]=checkNameSurname(_0x202257['Contact'][_0x216e('0x6')],_0x202257[_0x216e('0x7')][_0x216e('0x8')],_0x202257[_0x216e('0x7')][_0x216e('0x9')]);this['number']=_0x202257['phone'];this[_0x216e('0xa')]=_0x4ea7f3[_0x216e('0x5')];this[_0x216e('0xb')]=_0x202257[_0x216e('0xb')]||![];this[_0x216e('0xc')]=_0x4ea7f3[_0x216e('0xc')];this[_0x216e('0xd')]=_0x4ea7f3[_0x216e('0xd')]||0x3;this[_0x216e('0xe')]=_0x202257[_0x216e('0xe')];this[_0x216e('0xf')]=_0x202257[_0x216e('0xf')];this[_0x216e('0x10')]=_0x202257[_0x216e('0x10')];this[_0x216e('0x11')]=_0x202257[_0x216e('0x11')];this['countnosuchnumberretry']=_0x202257[_0x216e('0x12')];this['countdropretry']=_0x202257[_0x216e('0x13')];this[_0x216e('0x14')]=_0x202257['countabandonedretry'];this[_0x216e('0x15')]=_0x202257['countmachineretry'];this[_0x216e('0x16')]=_0x202257[_0x216e('0x16')];this[_0x216e('0x17')]=_0x202257[_0x216e('0x17')];this[_0x216e('0x18')]=_0x202257[_0x216e('0x18')];this[_0x216e('0x19')]=_0x202257[_0x216e('0x19')];this[_0x216e('0x1a')]=_0x202257[_0x216e('0x1a')];this[_0x216e('0x1b')]=_0x202257[_0x216e('0x1b')];this[_0x216e('0x1c')]=_0x202257['id'];this['ContactFirstName']=_0x202257[_0x216e('0x7')][_0x216e('0x8')]||'';this['starttime']=moment()[_0x216e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x216e('0x1e')]=_0x202257[_0x216e('0x1e')];this[_0x216e('0x1f')]=_0x202257['callbackuniqueid'];this[_0x216e('0x20')]=_0x202257[_0x216e('0x20')];this[_0x216e('0x21')]=_0x202257[_0x216e('0x21')];this[_0x216e('0x22')]='';this[_0x216e('0x23')]='';}Action[_0x216e('0x24')][_0x216e('0x25')]=function(){return util['format'](_0x216e('0x26'),this['name'],this[_0x216e('0x3')][_0x216e('0x27')]>0x0?this['number'][_0x216e('0x28')](this[_0x216e('0x3')]['dialCutDigit']):this[_0x216e('0x29')]);};Action[_0x216e('0x24')][_0x216e('0x2a')]=function(){return this['queue'];};module[_0x216e('0x2b')]=Action; \ No newline at end of file +var _0x955a=['\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','format'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x955a,0x85));var _0xa955=function(_0x4f8a8f,_0x3ee402){_0x4f8a8f=_0x4f8a8f-0x0;var _0x1c99fb=_0x955a[_0x4f8a8f];return _0x1c99fb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa955('0x0'));function checkNameSurname(_0xaee4f8,_0x3f9184,_0x2f20c4){var _0x242cfc='';if(!_[_0xa955('0x1')](_0x3f9184)&&_0xa955('0x2')===typeof _0x3f9184){_0x242cfc+=_0x3f9184;}if(!_['isNil'](_0x2f20c4)&&_0xa955('0x2')===typeof _0x2f20c4){_0x242cfc+='\x20'+_0x2f20c4;}if(_0x242cfc!==''){return _0x242cfc;}return _0xaee4f8;}function Action(_0xd9e58b,_0x5d4dae,_0xa34a86){this['voiceQueue']=_0xd9e58b;this[_0xa955('0x3')]=_0xa34a86||undefined;this[_0xa955('0x4')]=checkNameSurname(_0x5d4dae[_0xa955('0x5')][_0xa955('0x6')],_0x5d4dae['Contact'][_0xa955('0x7')],_0x5d4dae['Contact'][_0xa955('0x8')]);this['number']=_0x5d4dae[_0xa955('0x6')];this[_0xa955('0x9')]=_0xd9e58b[_0xa955('0x4')];this['active']=_0x5d4dae[_0xa955('0xa')]||![];this[_0xa955('0xb')]=_0xd9e58b[_0xa955('0xb')];this['dialQueueTimeout']=_0xd9e58b['dialQueueTimeout']||0x3;this[_0xa955('0xc')]=_0x5d4dae[_0xa955('0xc')];this['countbusyretry']=_0x5d4dae[_0xa955('0xd')];this[_0xa955('0xe')]=_0x5d4dae[_0xa955('0xe')];this['countnoanswerretry']=_0x5d4dae[_0xa955('0xf')];this[_0xa955('0x10')]=_0x5d4dae[_0xa955('0x10')];this[_0xa955('0x11')]=_0x5d4dae['countdropretry'];this[_0xa955('0x12')]=_0x5d4dae[_0xa955('0x12')];this[_0xa955('0x13')]=_0x5d4dae[_0xa955('0x13')];this[_0xa955('0x14')]=_0x5d4dae[_0xa955('0x14')];this[_0xa955('0x15')]=_0x5d4dae[_0xa955('0x15')];this[_0xa955('0x16')]=_0x5d4dae['ListId'];this[_0xa955('0x17')]=_0x5d4dae[_0xa955('0x17')];this[_0xa955('0x18')]=_0x5d4dae[_0xa955('0x18')];this[_0xa955('0x19')]=_0x5d4dae[_0xa955('0x19')];this[_0xa955('0x1a')]=_0x5d4dae['id'];this['ContactFirstName']=_0x5d4dae[_0xa955('0x5')][_0xa955('0x7')]||'';this['starttime']=moment()['format'](_0xa955('0x1b'));this[_0xa955('0x1c')]=_0x5d4dae[_0xa955('0x1c')];this[_0xa955('0x1d')]=_0x5d4dae['callbackuniqueid'];this['callbackat']=_0x5d4dae[_0xa955('0x1e')];this[_0xa955('0x1f')]=_0x5d4dae[_0xa955('0x1f')];this[_0xa955('0x20')]='';this['originatecalleridname']='';}Action[_0xa955('0x21')]['getCaller']=function(){return util[_0xa955('0x22')](_0xa955('0x23'),this[_0xa955('0x4')],this[_0xa955('0x24')][_0xa955('0x25')]>0x0?this[_0xa955('0x26')][_0xa955('0x27')](this['voiceQueue']['dialCutDigit']):this['number']);};Action['prototype'][_0xa955('0x28')]=function(){return this[_0xa955('0x9')];};module[_0xa955('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 5c06e30..f90fc91 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x599c=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x351f3b,_0x1dc907){var _0x10dfa8=function(_0x636b6a){while(--_0x636b6a){_0x351f3b['push'](_0x351f3b['shift']());}};_0x10dfa8(++_0x1dc907);}(_0x599c,0x191));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc599('0x0'));var utils=require(_0xc599('0x1'));function AgentComplete(_0x1dfc6c,_0x119473){this['state']=0x4;this['statedesc']='Answer';this[_0xc599('0x2')]=_0x1dfc6c['scheduledat'];this[_0xc599('0x3')]=_0x1dfc6c[_0xc599('0x3')];this[_0xc599('0x4')]=_0x1dfc6c[_0xc599('0x3')]===_0xc599('0x5')?'queue':_0x1dfc6c[_0xc599('0x3')];this[_0xc599('0x6')]=_0x1dfc6c[_0xc599('0x6')];this['countcongestionretry']=_0x1dfc6c[_0xc599('0x7')];this[_0xc599('0x8')]=_0x1dfc6c['countnoanswerretry'];this[_0xc599('0x9')]=_0x1dfc6c[_0xc599('0x6')]+_0x1dfc6c[_0xc599('0x7')]+_0x1dfc6c[_0xc599('0x8')]+_0x1dfc6c[_0xc599('0xa')]+_0x1dfc6c[_0xc599('0xb')]+_0x1dfc6c['countabandonedretry']+_0x1dfc6c[_0xc599('0xc')]+_0x1dfc6c['countagentrejectretry'];this[_0xc599('0xa')]=_0x1dfc6c[_0xc599('0xa')];this[_0xc599('0xb')]=_0x1dfc6c[_0xc599('0xb')];this['countabandonedretry']=_0x1dfc6c[_0xc599('0xd')];this[_0xc599('0xc')]=_0x1dfc6c[_0xc599('0xc')];this[_0xc599('0xe')]=_0x1dfc6c[_0xc599('0xe')];this[_0xc599('0xf')]=_0x119473[_0xc599('0xf')];this[_0xc599('0x10')]=_0x1dfc6c[_0xc599('0x11')];this[_0xc599('0x12')]=_0x1dfc6c[_0xc599('0x13')];this['starttime']=_0x1dfc6c[_0xc599('0x14')];this[_0xc599('0x15')]=_0x1dfc6c[_0xc599('0x15')];this[_0xc599('0x16')]=_0x1dfc6c['answertime'];this[_0xc599('0x17')]=moment()[_0xc599('0x18')](_0xc599('0x19'));this[_0xc599('0x1a')]=utils['getSeconds'](_0x1dfc6c[_0xc599('0x15')],_0x1dfc6c[_0xc599('0x14')]);this[_0xc599('0x1b')]=utils[_0xc599('0x1c')](_0x1dfc6c[_0xc599('0x16')],_0x1dfc6c[_0xc599('0x15')]);this[_0xc599('0x1d')]=utils[_0xc599('0x1c')](this['endtime'],_0x1dfc6c[_0xc599('0x16')]);this[_0xc599('0x1e')]=_0x119473[_0xc599('0x1e')];this['membername']=_0x119473['membername'];this[_0xc599('0x1f')]=_0x119473[_0xc599('0x1f')];this[_0xc599('0x20')]=_0x1dfc6c[_0xc599('0x20')];this[_0xc599('0x21')]=_0x1dfc6c['callbackuniqueid'];this[_0xc599('0x22')]=_0x1dfc6c['callbackat'];this[_0xc599('0x23')]=_0x1dfc6c['recallme'];this['ContactId']=_0x1dfc6c[_0xc599('0x24')];this[_0xc599('0x25')]=_0x1dfc6c['ListId'];this[_0xc599('0x26')]=_0x1dfc6c[_0xc599('0x26')];this[_0xc599('0x27')]=_0x1dfc6c['VoiceQueueId'];this[_0xc599('0x28')]=_0x1dfc6c[_0xc599('0x28')];this[_0xc599('0x29')]=_0x1dfc6c[_0xc599('0x29')]||'';this[_0xc599('0x2a')]=_0x1dfc6c[_0xc599('0x2a')]||'';this['agiafterat']=_0x1dfc6c[_0xc599('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0xb4fa=['countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x224ad0,_0x2482bd){var _0x2e04fc=function(_0x5ee761){while(--_0x5ee761){_0x224ad0['push'](_0x224ad0['shift']());}};_0x2e04fc(++_0x2482bd);}(_0xb4fa,0x1ae));var _0xab4f=function(_0x43be7e,_0x21db9e){_0x43be7e=_0x43be7e-0x0;var _0x41b589=_0xb4fa[_0x43be7e];return _0x41b589;};'use strict';var moment=require(_0xab4f('0x0'));var utils=require('../utils');function AgentComplete(_0x57edd2,_0x29ac40){this['state']=0x4;this[_0xab4f('0x1')]='Answer';this[_0xab4f('0x2')]=_0x57edd2[_0xab4f('0x2')];this[_0xab4f('0x3')]=_0x57edd2['type'];this[_0xab4f('0x4')]=_0x57edd2[_0xab4f('0x3')]===_0xab4f('0x5')?'queue':_0x57edd2[_0xab4f('0x3')];this[_0xab4f('0x6')]=_0x57edd2['countbusyretry'];this[_0xab4f('0x7')]=_0x57edd2[_0xab4f('0x7')];this[_0xab4f('0x8')]=_0x57edd2[_0xab4f('0x8')];this['countglobal']=_0x57edd2[_0xab4f('0x6')]+_0x57edd2[_0xab4f('0x7')]+_0x57edd2[_0xab4f('0x8')]+_0x57edd2['countnosuchnumberretry']+_0x57edd2[_0xab4f('0x9')]+_0x57edd2[_0xab4f('0xa')]+_0x57edd2['countmachineretry']+_0x57edd2[_0xab4f('0xb')];this[_0xab4f('0xc')]=_0x57edd2['countnosuchnumberretry'];this[_0xab4f('0x9')]=_0x57edd2[_0xab4f('0x9')];this['countabandonedretry']=_0x57edd2[_0xab4f('0xa')];this[_0xab4f('0xd')]=_0x57edd2[_0xab4f('0xd')];this[_0xab4f('0xb')]=_0x57edd2[_0xab4f('0xb')];this[_0xab4f('0xe')]=_0x29ac40[_0xab4f('0xe')];this['calleridname']=_0x57edd2[_0xab4f('0xf')];this[_0xab4f('0x10')]=_0x57edd2[_0xab4f('0x11')];this[_0xab4f('0x12')]=_0x57edd2[_0xab4f('0x12')];this['responsetime']=_0x57edd2[_0xab4f('0x13')];this[_0xab4f('0x14')]=_0x57edd2['answertime'];this[_0xab4f('0x15')]=moment()['format'](_0xab4f('0x16'));this['ringtime']=utils[_0xab4f('0x17')](_0x57edd2['responsetime'],_0x57edd2[_0xab4f('0x12')]);this[_0xab4f('0x18')]=utils['getSeconds'](_0x57edd2[_0xab4f('0x14')],_0x57edd2[_0xab4f('0x13')]);this['talktime']=utils[_0xab4f('0x17')](this[_0xab4f('0x15')],_0x57edd2[_0xab4f('0x14')]);this[_0xab4f('0x19')]=_0x29ac40[_0xab4f('0x19')];this[_0xab4f('0x1a')]=_0x29ac40[_0xab4f('0x1a')];this[_0xab4f('0x1b')]=_0x29ac40[_0xab4f('0x1b')];this[_0xab4f('0x1c')]=_0x57edd2[_0xab4f('0x1c')];this[_0xab4f('0x1d')]=_0x57edd2['callbackuniqueid'];this[_0xab4f('0x1e')]=_0x57edd2[_0xab4f('0x1e')];this[_0xab4f('0x1f')]=_0x57edd2['recallme'];this[_0xab4f('0x20')]=_0x57edd2['ContactId'];this['ListId']=_0x57edd2[_0xab4f('0x21')];this[_0xab4f('0x22')]=_0x57edd2[_0xab4f('0x22')];this['VoiceQueueId']=_0x57edd2['VoiceQueueId'];this[_0xab4f('0x23')]=_0x57edd2[_0xab4f('0x23')];this[_0xab4f('0x24')]=_0x57edd2['originatecalleridnum']||'';this[_0xab4f('0x25')]=_0x57edd2['originatecalleridname']||'';this[_0xab4f('0x26')]=_0x57edd2[_0xab4f('0x26')];}module[_0xab4f('0x27')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 51a32f9..fb30bd7 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9379=['responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x5ce130,_0x107a68){var _0x57125b=function(_0x7578b0){while(--_0x7578b0){_0x5ce130['push'](_0x5ce130['shift']());}};_0x57125b(++_0x107a68);}(_0x9379,0x6c));var _0x9937=function(_0x56e2ec,_0x2d5f2f){_0x56e2ec=_0x56e2ec-0x0;var _0x357e52=_0x9379[_0x56e2ec];return _0x357e52;};'use strict';function Final(_0x70c656){this[_0x9937('0x0')]=_0x70c656[_0x9937('0x0')];this[_0x9937('0x1')]=_0x70c656[_0x9937('0x1')];this[_0x9937('0x2')]=_0x70c656['type'];this['campaigntype']=_0x70c656[_0x9937('0x2')]===_0x9937('0x3')?_0x9937('0x4'):_0x70c656['type'];this[_0x9937('0x5')]=_0x70c656['countbusyretry'];this['countcongestionretry']=_0x70c656[_0x9937('0x6')];this[_0x9937('0x7')]=_0x70c656[_0x9937('0x7')];this['countglobal']=_0x70c656[_0x9937('0x5')]+_0x70c656['countcongestionretry']+_0x70c656[_0x9937('0x7')]+_0x70c656[_0x9937('0x8')]+_0x70c656[_0x9937('0x9')]+_0x70c656[_0x9937('0xa')]+_0x70c656[_0x9937('0xb')]+_0x70c656['countagentrejectretry'];this[_0x9937('0x8')]=_0x70c656['countnosuchnumberretry'];this[_0x9937('0x9')]=_0x70c656[_0x9937('0x9')];this['countabandonedretry']=_0x70c656[_0x9937('0xa')];this[_0x9937('0xb')]=_0x70c656[_0x9937('0xb')];this[_0x9937('0xc')]=_0x70c656[_0x9937('0xc')];this[_0x9937('0x4')]=_0x70c656[_0x9937('0x4')];this[_0x9937('0xd')]=_0x70c656[_0x9937('0xd')];this[_0x9937('0xe')]=_0x70c656['calleridnum'];this['starttime']=_0x70c656[_0x9937('0xf')];this[_0x9937('0x10')]=_0x70c656[_0x9937('0x10')];this['endtime']=_0x70c656[_0x9937('0x10')];this[_0x9937('0x11')]=_0x70c656[_0x9937('0x11')]||0x0;this['holdtime']=_0x70c656['holdtime']||0x0;this['talktime']=_0x70c656['talktime']||0x0;this[_0x9937('0x12')]=_0x70c656[_0x9937('0x12')];this['callbackuniqueid']=_0x70c656[_0x9937('0x13')];this['callbackat']=_0x70c656[_0x9937('0x14')];this[_0x9937('0x15')]=_0x70c656[_0x9937('0x15')];this[_0x9937('0x16')]=_0x70c656[_0x9937('0x16')];this['ListId']=_0x70c656[_0x9937('0x17')];this[_0x9937('0x18')]=_0x70c656[_0x9937('0x18')];this['VoiceQueueId']=_0x70c656[_0x9937('0x19')];this[_0x9937('0x1a')]=_0x70c656[_0x9937('0x1a')];this[_0x9937('0x1b')]=_0x70c656[_0x9937('0x1b')]||'';this['originatecalleridname']=_0x70c656['originatecalleridname']||'';this['state']=_0x70c656[_0x9937('0x1c')];this['statedesc']=_0x70c656[_0x9937('0x1d')];}module[_0x9937('0x1e')]=Final; \ No newline at end of file +var _0x6af8=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','type'];(function(_0x2a87fc,_0x30a039){var _0x32d9f5=function(_0x2e157c){while(--_0x2e157c){_0x2a87fc['push'](_0x2a87fc['shift']());}};_0x32d9f5(++_0x30a039);}(_0x6af8,0x64));var _0x86af=function(_0x2eb8df,_0x389390){_0x2eb8df=_0x2eb8df-0x0;var _0x187963=_0x6af8[_0x2eb8df];return _0x187963;};'use strict';function Final(_0x4618ab){this[_0x86af('0x0')]=_0x4618ab[_0x86af('0x0')];this['scheduledat']=_0x4618ab['scheduledat'];this['type']=_0x4618ab[_0x86af('0x1')];this[_0x86af('0x2')]=_0x4618ab[_0x86af('0x1')]===_0x86af('0x3')?'queue':_0x4618ab[_0x86af('0x1')];this[_0x86af('0x4')]=_0x4618ab['countbusyretry'];this[_0x86af('0x5')]=_0x4618ab[_0x86af('0x5')];this[_0x86af('0x6')]=_0x4618ab[_0x86af('0x6')];this[_0x86af('0x7')]=_0x4618ab[_0x86af('0x4')]+_0x4618ab['countcongestionretry']+_0x4618ab[_0x86af('0x6')]+_0x4618ab[_0x86af('0x8')]+_0x4618ab[_0x86af('0x9')]+_0x4618ab[_0x86af('0xa')]+_0x4618ab[_0x86af('0xb')]+_0x4618ab[_0x86af('0xc')];this['countnosuchnumberretry']=_0x4618ab['countnosuchnumberretry'];this[_0x86af('0x9')]=_0x4618ab[_0x86af('0x9')];this[_0x86af('0xa')]=_0x4618ab[_0x86af('0xa')];this[_0x86af('0xb')]=_0x4618ab[_0x86af('0xb')];this[_0x86af('0xc')]=_0x4618ab[_0x86af('0xc')];this['queue']=_0x4618ab[_0x86af('0xd')];this[_0x86af('0xe')]=_0x4618ab[_0x86af('0xe')];this[_0x86af('0xf')]=_0x4618ab[_0x86af('0xf')];this[_0x86af('0x10')]=_0x4618ab[_0x86af('0x10')];this[_0x86af('0x11')]=_0x4618ab[_0x86af('0x11')];this[_0x86af('0x12')]=_0x4618ab[_0x86af('0x11')];this[_0x86af('0x13')]=_0x4618ab[_0x86af('0x13')]||0x0;this[_0x86af('0x14')]=_0x4618ab['holdtime']||0x0;this[_0x86af('0x15')]=_0x4618ab[_0x86af('0x15')]||0x0;this[_0x86af('0x16')]=_0x4618ab[_0x86af('0x16')];this['callbackuniqueid']=_0x4618ab['callbackuniqueid'];this[_0x86af('0x17')]=_0x4618ab[_0x86af('0x17')];this[_0x86af('0x18')]=_0x4618ab[_0x86af('0x18')];this[_0x86af('0x19')]=_0x4618ab['ContactId'];this[_0x86af('0x1a')]=_0x4618ab['ListId'];this['UserId']=_0x4618ab[_0x86af('0x1b')];this['VoiceQueueId']=_0x4618ab[_0x86af('0x1c')];this['CampaignId']=_0x4618ab['CampaignId'];this[_0x86af('0x1d')]=_0x4618ab[_0x86af('0x1d')]||'';this[_0x86af('0x1e')]=_0x4618ab[_0x86af('0x1e')]||'';this[_0x86af('0x1f')]=_0x4618ab[_0x86af('0x1f')];this[_0x86af('0x20')]=_0x4618ab[_0x86af('0x20')];}module[_0x86af('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index b0dd848..f037329 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7371=['calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid'];(function(_0x3c206f,_0x45b3e2){var _0x529cee=function(_0x4942d9){while(--_0x4942d9){_0x3c206f['push'](_0x3c206f['shift']());}};_0x529cee(++_0x45b3e2);}(_0x7371,0x7c));var _0x1737=function(_0x41db16,_0x564c03){_0x41db16=_0x41db16-0x0;var _0x28f7af=_0x7371[_0x41db16];return _0x28f7af;};'use strict';var moment=require(_0x1737('0x0'));var utils=require(_0x1737('0x1'));function Hangup(_0x491494,_0xdd3c0b){this[_0x1737('0x2')]=0x4;this[_0x1737('0x3')]=_0x1737('0x4');this[_0x1737('0x5')]=_0x491494[_0x1737('0x5')];this[_0x1737('0x6')]=_0x491494[_0x1737('0x6')];this[_0x1737('0x7')]=_0x491494['type']===_0x1737('0x8')?'queue':_0x491494[_0x1737('0x6')];this[_0x1737('0x9')]=_0x491494[_0x1737('0x9')]||![];this['countbusyretry']=_0x491494[_0x1737('0xa')];this[_0x1737('0xb')]=_0x491494[_0x1737('0xb')];this[_0x1737('0xc')]=_0x491494['countnoanswerretry'];this[_0x1737('0xd')]=_0x491494[_0x1737('0xa')]+_0x491494[_0x1737('0xb')]+_0x491494[_0x1737('0xc')]+_0x491494[_0x1737('0xe')]+_0x491494['countdropretry']+_0x491494['countabandonedretry']+_0x491494['countmachineretry']+_0x491494[_0x1737('0xf')];this[_0x1737('0xe')]=_0x491494['countnosuchnumberretry'];this[_0x1737('0x10')]=_0x491494[_0x1737('0x10')];this[_0x1737('0x11')]=_0x491494['countabandonedretry'];this[_0x1737('0x12')]=_0x491494['countmachineretry'];this[_0x1737('0xf')]=_0x491494[_0x1737('0xf')];this['uniqueid']=_0xdd3c0b[_0x1737('0x13')];this[_0x1737('0x14')]=_0x491494[_0x1737('0x15')];this[_0x1737('0x16')]=_0x491494[_0x1737('0x17')];this['starttime']=_0x491494[_0x1737('0x18')];this[_0x1737('0x19')]=_0x491494['responsetime'];this['endtime']=moment()[_0x1737('0x1a')](_0x1737('0x1b'));this[_0x1737('0x1c')]=utils[_0x1737('0x1d')](_0x491494[_0x1737('0x19')],_0x491494[_0x1737('0x18')]);this[_0x1737('0x1e')]=0x0;this[_0x1737('0x1f')]=utils[_0x1737('0x1d')](this[_0x1737('0x20')],_0x491494[_0x1737('0x19')]);this[_0x1737('0x21')]=_0x491494[_0x1737('0x21')];this[_0x1737('0x22')]=_0x1737('0x23');this[_0x1737('0x24')]=_0xdd3c0b[_0x1737('0x25')];this[_0x1737('0x26')]=_0x491494[_0x1737('0x26')];this[_0x1737('0x27')]=_0x491494[_0x1737('0x27')];this[_0x1737('0x28')]=_0x491494[_0x1737('0x28')];this[_0x1737('0x29')]=_0x491494[_0x1737('0x29')];this[_0x1737('0x2a')]=_0x491494[_0x1737('0x2a')];this['ListId']=_0x491494[_0x1737('0x2b')];this[_0x1737('0x2c')]=_0x491494[_0x1737('0x2c')];this['VoiceQueueId']=_0x491494[_0x1737('0x2d')];this[_0x1737('0x2e')]=_0x491494[_0x1737('0x2e')];}module[_0x1737('0x2f')]=Hangup; \ No newline at end of file +var _0xab3e=['moment','../utils','statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports'];(function(_0x18c7a8,_0x5d60a6){var _0x36b1ac=function(_0x16a458){while(--_0x16a458){_0x18c7a8['push'](_0x18c7a8['shift']());}};_0x36b1ac(++_0x5d60a6);}(_0xab3e,0xa8));var _0xeab3=function(_0x358de0,_0x319365){_0x358de0=_0x358de0-0x0;var _0x83f818=_0xab3e[_0x358de0];return _0x83f818;};'use strict';var moment=require(_0xeab3('0x0'));var utils=require(_0xeab3('0x1'));function Hangup(_0x5cb556,_0x49f031){this['state']=0x4;this[_0xeab3('0x2')]=_0xeab3('0x3');this[_0xeab3('0x4')]=_0x5cb556['scheduledat'];this[_0xeab3('0x5')]=_0x5cb556['type'];this['campaigntype']=_0x5cb556[_0xeab3('0x5')]===_0xeab3('0x6')?'queue':_0x5cb556[_0xeab3('0x5')];this[_0xeab3('0x7')]=_0x5cb556['amd']||![];this[_0xeab3('0x8')]=_0x5cb556[_0xeab3('0x8')];this['countcongestionretry']=_0x5cb556['countcongestionretry'];this['countnoanswerretry']=_0x5cb556[_0xeab3('0x9')];this[_0xeab3('0xa')]=_0x5cb556['countbusyretry']+_0x5cb556[_0xeab3('0xb')]+_0x5cb556[_0xeab3('0x9')]+_0x5cb556['countnosuchnumberretry']+_0x5cb556[_0xeab3('0xc')]+_0x5cb556[_0xeab3('0xd')]+_0x5cb556[_0xeab3('0xe')]+_0x5cb556[_0xeab3('0xf')];this['countnosuchnumberretry']=_0x5cb556[_0xeab3('0x10')];this[_0xeab3('0xc')]=_0x5cb556[_0xeab3('0xc')];this[_0xeab3('0xd')]=_0x5cb556[_0xeab3('0xd')];this[_0xeab3('0xe')]=_0x5cb556[_0xeab3('0xe')];this[_0xeab3('0xf')]=_0x5cb556[_0xeab3('0xf')];this[_0xeab3('0x11')]=_0x49f031['uniqueid'];this['calleridname']=_0x5cb556[_0xeab3('0x12')];this['calleridnum']=_0x5cb556[_0xeab3('0x13')];this[_0xeab3('0x14')]=_0x5cb556[_0xeab3('0x14')];this['responsetime']=_0x5cb556[_0xeab3('0x15')];this[_0xeab3('0x16')]=moment()[_0xeab3('0x17')](_0xeab3('0x18'));this[_0xeab3('0x19')]=utils[_0xeab3('0x1a')](_0x5cb556[_0xeab3('0x15')],_0x5cb556[_0xeab3('0x14')]);this[_0xeab3('0x1b')]=0x0;this[_0xeab3('0x1c')]=utils[_0xeab3('0x1a')](this[_0xeab3('0x16')],_0x5cb556[_0xeab3('0x15')]);this['queue']=_0x5cb556[_0xeab3('0x1d')];this['membername']=_0xeab3('0x1e');this[_0xeab3('0x1f')]=_0x49f031[_0xeab3('0x20')];this[_0xeab3('0x21')]=_0x5cb556[_0xeab3('0x21')];this[_0xeab3('0x22')]=_0x5cb556[_0xeab3('0x22')];this[_0xeab3('0x23')]=_0x5cb556[_0xeab3('0x23')];this[_0xeab3('0x24')]=_0x5cb556['recallme'];this[_0xeab3('0x25')]=_0x5cb556[_0xeab3('0x25')];this[_0xeab3('0x26')]=_0x5cb556[_0xeab3('0x26')];this[_0xeab3('0x27')]=_0x5cb556[_0xeab3('0x27')];this[_0xeab3('0x28')]=_0x5cb556['VoiceQueueId'];this['CampaignId']=_0x5cb556['CampaignId'];}module[_0xeab3('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index c0b61ec..95031a8 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95cd=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x5d9550,_0x253c1a){var _0x1d08a1=function(_0x37817a){while(--_0x37817a){_0x5d9550['push'](_0x5d9550['shift']());}};_0x1d08a1(++_0x253c1a);}(_0x95cd,0x6a));var _0xd95c=function(_0x3145bc,_0x4abbc0){_0x3145bc=_0x3145bc-0x0;var _0x545378=_0x95cd[_0x3145bc];return _0x545378;};'use strict';var utils=require(_0xd95c('0x0'));function History(_0x3bd56d){this['uniqueid']=_0x3bd56d[_0xd95c('0x1')];this[_0xd95c('0x2')]=_0x3bd56d[_0xd95c('0x2')]||undefined;this[_0xd95c('0x3')]=_0x3bd56d[_0xd95c('0x3')];this[_0xd95c('0x4')]=_0x3bd56d['type']==='outbound'?_0xd95c('0x5'):_0x3bd56d[_0xd95c('0x3')];this[_0xd95c('0x6')]=_0x3bd56d[_0xd95c('0x6')];this[_0xd95c('0x7')]=_0x3bd56d[_0xd95c('0x7')];this[_0xd95c('0x8')]=_0x3bd56d[_0xd95c('0x8')];this['countglobal']=_0x3bd56d[_0xd95c('0x6')]+_0x3bd56d[_0xd95c('0x7')]+_0x3bd56d[_0xd95c('0x8')]+_0x3bd56d[_0xd95c('0x9')]+_0x3bd56d[_0xd95c('0xa')]+_0x3bd56d[_0xd95c('0xb')]+_0x3bd56d[_0xd95c('0xc')]+_0x3bd56d[_0xd95c('0xd')];this[_0xd95c('0x9')]=_0x3bd56d['countnosuchnumberretry'];this[_0xd95c('0xa')]=_0x3bd56d[_0xd95c('0xa')];this[_0xd95c('0xb')]=_0x3bd56d['countabandonedretry'];this[_0xd95c('0xc')]=_0x3bd56d[_0xd95c('0xc')];this[_0xd95c('0xd')]=_0x3bd56d['countagentrejectretry'];this['queue']=_0x3bd56d[_0xd95c('0x5')];this[_0xd95c('0xe')]=_0x3bd56d[_0xd95c('0xf')];this[_0xd95c('0x10')]=_0x3bd56d[_0xd95c('0x11')];this[_0xd95c('0x12')]=_0x3bd56d['starttime'];this['responsetime']=_0x3bd56d[_0xd95c('0x13')];this['endtime']=_0x3bd56d[_0xd95c('0x13')];this['ringtime']=utils[_0xd95c('0x14')](_0x3bd56d[_0xd95c('0x13')],_0x3bd56d[_0xd95c('0x12')]);this[_0xd95c('0x15')]=0x0;this[_0xd95c('0x16')]=0x0;this[_0xd95c('0x17')]=_0x3bd56d[_0xd95c('0x17')];this['callbackuniqueid']=_0x3bd56d[_0xd95c('0x18')];this[_0xd95c('0x19')]=_0x3bd56d[_0xd95c('0x19')];this[_0xd95c('0x1a')]=_0x3bd56d['recallme'];this[_0xd95c('0x1b')]=_0x3bd56d['ContactId'];this[_0xd95c('0x1c')]=_0x3bd56d[_0xd95c('0x1c')];this['UserId']=_0x3bd56d[_0xd95c('0x1d')];this[_0xd95c('0x1e')]=_0x3bd56d[_0xd95c('0x1e')];this[_0xd95c('0x1f')]=_0x3bd56d['CampaignId'];this[_0xd95c('0x20')]=_0x3bd56d[_0xd95c('0x20')]||'';this[_0xd95c('0x21')]=_0x3bd56d[_0xd95c('0x21')]||'';this[_0xd95c('0x22')]=_0x3bd56d['state'];this[_0xd95c('0x23')]=_0x3bd56d['statedesc'];}module[_0xd95c('0x24')]=History; \ No newline at end of file +var _0xcf34=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x15d38f,_0x2202e0){var _0x331044=function(_0x390bdd){while(--_0x390bdd){_0x15d38f['push'](_0x15d38f['shift']());}};_0x331044(++_0x2202e0);}(_0xcf34,0x17a));var _0x4cf3=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0xcf34[_0x1b0597];return _0x2b6a2a;};'use strict';var utils=require(_0x4cf3('0x0'));function History(_0x1b6695){this['uniqueid']=_0x1b6695['uniqueid'];this['scheduledat']=_0x1b6695[_0x4cf3('0x1')]||undefined;this[_0x4cf3('0x2')]=_0x1b6695[_0x4cf3('0x2')];this['campaigntype']=_0x1b6695[_0x4cf3('0x2')]==='outbound'?'queue':_0x1b6695[_0x4cf3('0x2')];this['countbusyretry']=_0x1b6695[_0x4cf3('0x3')];this[_0x4cf3('0x4')]=_0x1b6695[_0x4cf3('0x4')];this[_0x4cf3('0x5')]=_0x1b6695['countnoanswerretry'];this['countglobal']=_0x1b6695[_0x4cf3('0x3')]+_0x1b6695[_0x4cf3('0x4')]+_0x1b6695[_0x4cf3('0x5')]+_0x1b6695[_0x4cf3('0x6')]+_0x1b6695[_0x4cf3('0x7')]+_0x1b6695[_0x4cf3('0x8')]+_0x1b6695[_0x4cf3('0x9')]+_0x1b6695[_0x4cf3('0xa')];this['countnosuchnumberretry']=_0x1b6695[_0x4cf3('0x6')];this[_0x4cf3('0x7')]=_0x1b6695[_0x4cf3('0x7')];this['countabandonedretry']=_0x1b6695[_0x4cf3('0x8')];this[_0x4cf3('0x9')]=_0x1b6695['countmachineretry'];this['countagentrejectretry']=_0x1b6695[_0x4cf3('0xa')];this[_0x4cf3('0xb')]=_0x1b6695[_0x4cf3('0xb')];this[_0x4cf3('0xc')]=_0x1b6695['name'];this[_0x4cf3('0xd')]=_0x1b6695['number'];this['starttime']=_0x1b6695[_0x4cf3('0xe')];this[_0x4cf3('0xf')]=_0x1b6695[_0x4cf3('0xf')];this[_0x4cf3('0x10')]=_0x1b6695[_0x4cf3('0xf')];this[_0x4cf3('0x11')]=utils[_0x4cf3('0x12')](_0x1b6695[_0x4cf3('0xf')],_0x1b6695['starttime']);this[_0x4cf3('0x13')]=0x0;this[_0x4cf3('0x14')]=0x0;this[_0x4cf3('0x15')]=_0x1b6695[_0x4cf3('0x15')];this['callbackuniqueid']=_0x1b6695[_0x4cf3('0x16')];this[_0x4cf3('0x17')]=_0x1b6695[_0x4cf3('0x17')];this[_0x4cf3('0x18')]=_0x1b6695[_0x4cf3('0x18')];this[_0x4cf3('0x19')]=_0x1b6695[_0x4cf3('0x19')];this[_0x4cf3('0x1a')]=_0x1b6695[_0x4cf3('0x1a')];this[_0x4cf3('0x1b')]=_0x1b6695['UserId'];this['VoiceQueueId']=_0x1b6695[_0x4cf3('0x1c')];this[_0x4cf3('0x1d')]=_0x1b6695[_0x4cf3('0x1d')];this[_0x4cf3('0x1e')]=_0x1b6695['originatecalleridnum']||'';this[_0x4cf3('0x1f')]=_0x1b6695[_0x4cf3('0x1f')]||'';this[_0x4cf3('0x20')]=_0x1b6695[_0x4cf3('0x20')];this[_0x4cf3('0x21')]=_0x1b6695[_0x4cf3('0x21')];}module[_0x4cf3('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 7bf2b1d..dae0b96 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ed2=['responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime'];(function(_0x1e7935,_0x3bb652){var _0x3eb2aa=function(_0x665b78){while(--_0x665b78){_0x1e7935['push'](_0x1e7935['shift']());}};_0x3eb2aa(++_0x3bb652);}(_0x6ed2,0xde));var _0x26ed=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x6ed2[_0x593752];return _0x4612be;};'use strict';var utils=require(_0x26ed('0x0'));function QueueCallerAbandon(_0x4224b4,_0x3e2903){this[_0x26ed('0x1')]=_0x4224b4['scheduledat'];this[_0x26ed('0x2')]=_0x4224b4[_0x26ed('0x2')];this['campaigntype']=_0x4224b4[_0x26ed('0x2')]===_0x26ed('0x3')?_0x26ed('0x4'):_0x4224b4[_0x26ed('0x2')];this['countbusyretry']=_0x4224b4[_0x26ed('0x5')];this['countcongestionretry']=_0x4224b4['countcongestionretry'];this[_0x26ed('0x6')]=_0x4224b4[_0x26ed('0x6')];this['countglobal']=_0x4224b4[_0x26ed('0x5')]+_0x4224b4[_0x26ed('0x7')]+_0x4224b4[_0x26ed('0x6')]+_0x4224b4[_0x26ed('0x8')]+_0x4224b4[_0x26ed('0x9')]+_0x4224b4[_0x26ed('0xa')]+_0x4224b4['countmachineretry']+_0x4224b4[_0x26ed('0xb')];this[_0x26ed('0x8')]=_0x4224b4[_0x26ed('0x8')];this[_0x26ed('0x9')]=_0x4224b4[_0x26ed('0x9')];this[_0x26ed('0xa')]=_0x4224b4[_0x26ed('0xa')];this[_0x26ed('0xc')]=_0x4224b4['countmachineretry'];this[_0x26ed('0xb')]=_0x4224b4[_0x26ed('0xb')];this[_0x26ed('0xd')]=_0x3e2903['uniqueid'];this[_0x26ed('0xe')]=_0x4224b4[_0x26ed('0xf')];this['calleridnum']=_0x4224b4[_0x26ed('0x10')];this[_0x26ed('0x11')]=_0x4224b4[_0x26ed('0x11')];this['responsetime']=_0x4224b4[_0x26ed('0x12')];this['droptime']=_0x4224b4[_0x26ed('0x13')];this['dropreason']=_0x4224b4[_0x26ed('0x14')];this[_0x26ed('0x15')]=this['droptime'];this['ringtime']=utils[_0x26ed('0x16')](_0x4224b4[_0x26ed('0x12')],_0x4224b4[_0x26ed('0x11')]);this[_0x26ed('0x17')]=utils['getSeconds'](this['droptime'],_0x4224b4['responsetime']);this[_0x26ed('0x18')]=0x0;this[_0x26ed('0x4')]=_0x3e2903[_0x26ed('0x4')];this[_0x26ed('0x19')]=_0x3e2903['connectedlinename'];this[_0x26ed('0x1a')]=_0x3e2903[_0x26ed('0x1a')];this['callback']=_0x4224b4[_0x26ed('0x1b')];this[_0x26ed('0x1c')]=_0x4224b4[_0x26ed('0x1c')];this[_0x26ed('0x1d')]=_0x4224b4['callbackat'];this[_0x26ed('0x1e')]=_0x4224b4['recallme'];this[_0x26ed('0x1f')]=_0x4224b4[_0x26ed('0x1f')];this[_0x26ed('0x20')]=_0x4224b4[_0x26ed('0x20')];this[_0x26ed('0x21')]=_0x4224b4['UserId'];this[_0x26ed('0x22')]=_0x4224b4[_0x26ed('0x22')];this[_0x26ed('0x23')]=_0x4224b4[_0x26ed('0x23')];this[_0x26ed('0x24')]=_0x4224b4[_0x26ed('0x24')]||'';this['originatecalleridname']=_0x4224b4['originatecalleridname']||'';this['agiafterat']=_0x4224b4[_0x26ed('0x25')];this[_0x26ed('0x26')]=_0x4224b4[_0x26ed('0x26')];this[_0x26ed('0x27')]=_0x4224b4[_0x26ed('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x1171=['scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils'];(function(_0x41643f,_0x5743b2){var _0x3ef28c=function(_0x31d548){while(--_0x31d548){_0x41643f['push'](_0x41643f['shift']());}};_0x3ef28c(++_0x5743b2);}(_0x1171,0x83));var _0x1117=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0x1171[_0x552041];return _0x198a1a;};'use strict';var utils=require(_0x1117('0x0'));function QueueCallerAbandon(_0x461b32,_0x3c87c9){this[_0x1117('0x1')]=_0x461b32[_0x1117('0x1')];this[_0x1117('0x2')]=_0x461b32[_0x1117('0x2')];this[_0x1117('0x3')]=_0x461b32['type']===_0x1117('0x4')?'queue':_0x461b32[_0x1117('0x2')];this['countbusyretry']=_0x461b32[_0x1117('0x5')];this['countcongestionretry']=_0x461b32[_0x1117('0x6')];this['countnoanswerretry']=_0x461b32['countnoanswerretry'];this[_0x1117('0x7')]=_0x461b32[_0x1117('0x5')]+_0x461b32[_0x1117('0x6')]+_0x461b32['countnoanswerretry']+_0x461b32[_0x1117('0x8')]+_0x461b32[_0x1117('0x9')]+_0x461b32[_0x1117('0xa')]+_0x461b32[_0x1117('0xb')]+_0x461b32[_0x1117('0xc')];this[_0x1117('0x8')]=_0x461b32['countnosuchnumberretry'];this[_0x1117('0x9')]=_0x461b32['countdropretry'];this[_0x1117('0xa')]=_0x461b32[_0x1117('0xa')];this[_0x1117('0xb')]=_0x461b32[_0x1117('0xb')];this['countagentrejectretry']=_0x461b32[_0x1117('0xc')];this['uniqueid']=_0x3c87c9[_0x1117('0xd')];this['calleridname']=_0x461b32[_0x1117('0xe')];this[_0x1117('0xf')]=_0x461b32[_0x1117('0x10')];this[_0x1117('0x11')]=_0x461b32['starttime'];this[_0x1117('0x12')]=_0x461b32['responsetime'];this[_0x1117('0x13')]=_0x461b32['droptime'];this[_0x1117('0x14')]=_0x461b32[_0x1117('0x14')];this[_0x1117('0x15')]=this[_0x1117('0x13')];this[_0x1117('0x16')]=utils['getSeconds'](_0x461b32[_0x1117('0x12')],_0x461b32[_0x1117('0x11')]);this[_0x1117('0x17')]=utils['getSeconds'](this[_0x1117('0x13')],_0x461b32['responsetime']);this[_0x1117('0x18')]=0x0;this[_0x1117('0x19')]=_0x3c87c9['queue'];this[_0x1117('0x1a')]=_0x3c87c9[_0x1117('0x1b')];this['reason']=_0x3c87c9[_0x1117('0x1c')];this[_0x1117('0x1d')]=_0x461b32[_0x1117('0x1d')];this['callbackuniqueid']=_0x461b32[_0x1117('0x1e')];this[_0x1117('0x1f')]=_0x461b32['callbackat'];this['recallme']=_0x461b32[_0x1117('0x20')];this[_0x1117('0x21')]=_0x461b32[_0x1117('0x21')];this[_0x1117('0x22')]=_0x461b32[_0x1117('0x22')];this[_0x1117('0x23')]=_0x461b32[_0x1117('0x23')];this[_0x1117('0x24')]=_0x461b32[_0x1117('0x24')];this[_0x1117('0x25')]=_0x461b32[_0x1117('0x25')];this[_0x1117('0x26')]=_0x461b32[_0x1117('0x26')]||'';this[_0x1117('0x27')]=_0x461b32['originatecalleridname']||'';this[_0x1117('0x28')]=_0x461b32[_0x1117('0x28')];this[_0x1117('0x29')]=_0x461b32[_0x1117('0x29')];this[_0x1117('0x2a')]=_0x461b32[_0x1117('0x2a')];}module[_0x1117('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index dc1edee..b3ceb0e 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdf55,0x83));var _0x5df5=function(_0x3d71ba,_0x49a38b){_0x3d71ba=_0x3d71ba-0x0;var _0x5e0ed0=_0xdf55[_0x3d71ba];return _0x5e0ed0;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=createHistory; \ No newline at end of file +var _0x27a0=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x284d91,_0xbdba80){var _0xc2df44=function(_0x53adea){while(--_0x53adea){_0x284d91['push'](_0x284d91['shift']());}};_0xc2df44(++_0xbdba80);}(_0x27a0,0xbf));var _0x027a=function(_0x1bd113,_0x39258f){_0x1bd113=_0x1bd113-0x0;var _0x54944b=_0x27a0[_0x1bd113];return _0x54944b;};'use strict';var util=require('util');var logger=require(_0x027a('0x0'))(_0x027a('0x1'));var cmHopper=require(_0x027a('0x2'));var cmHopperAdditionalPhone=require(_0x027a('0x3'));var cmHopperBlack=require(_0x027a('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x58a58b){return util['inspect'](_0x58a58b,{'showHidden':![],'depth':null});}function getContactDialer(_0x47cd65,_0x30a54d,_0x2a409a){return cmHopper[_0x027a('0x5')](_0x47cd65['id'],_0x30a54d,_0x2a409a,_0x47cd65[_0x027a('0x6')])[_0x027a('0x7')](function(_0x3c7d67){_0x47cd65['temp']=0x0;logger[_0x027a('0x8')](_0x027a('0x9'),inspectError(_0x3c7d67));});}exports[_0x027a('0x5')]=getContactDialer;function getContactDialerIvr(_0x4ccee2,_0x44c56a){return cmHopper[_0x027a('0xa')](_0x4ccee2['id'],_0x44c56a,_0x4ccee2[_0x027a('0x6')])['catch'](function(_0x6d5b04){_0x4ccee2[_0x027a('0xb')]=0x0;logger[_0x027a('0x8')](_0x027a('0xc'),inspectError(_0x6d5b04));});}exports[_0x027a('0xa')]=getContactDialerIvr;function countReScheduled(_0x267afc){return cmHopper[_0x027a('0xd')](_0x267afc)[_0x027a('0x7')](function(_0x351d7e){logger[_0x027a('0x8')](_0x027a('0xe'),inspectError(_0x351d7e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe64d3a){return cmHopper[_0x027a('0xf')](_0xe64d3a)[_0x027a('0x7')](function(_0x21da53){logger[_0x027a('0x8')]('[rescheduleContact]',inspectError(_0x21da53));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x1d680d,_0x5cfc6d,_0x2b3870){return cmHopper['unlockContact'](_0x1d680d,_0x5cfc6d,_0x2b3870)[_0x027a('0x7')](function(_0x5a1224){logger['error']('[unlockContact]',inspectError(_0x5a1224));});}exports[_0x027a('0x10')]=unlockContact;function moveContactManagedDialer(_0x2f04e9){return cmHopper[_0x027a('0x11')](_0x2f04e9)[_0x027a('0x7')](function(_0x52125e){logger[_0x027a('0x8')](_0x027a('0x12'),inspectError(_0x52125e));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f8c3d){return cmHopperBlack[_0x027a('0x13')](_0x4f8c3d)['catch'](function(_0x1d4a7a){logger['error']('[checkIsBlackList]',inspectError(_0x1d4a7a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4b4f90){return cmHopperBlack[_0x027a('0x14')](_0x4b4f90)[_0x027a('0x7')](function(_0x266c9e){logger[_0x027a('0x8')]('[checkIsBlackListIvr]',inspectError(_0x266c9e));});}exports[_0x027a('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x119a5c,_0x20e2da,_0x3dee99){return cmHopperAdditionalPhone[_0x027a('0x15')](_0x119a5c,_0x20e2da,_0x3dee99)[_0x027a('0x7')](function(_0x595f0e){logger[_0x027a('0x8')]('[verifyAdditionalPhone]',inspectError(_0x595f0e));});}exports[_0x027a('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2e97c5,_0x1b1a13,_0x83fe3e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2e97c5,_0x1b1a13,_0x83fe3e)['catch'](function(_0x18458f){logger[_0x027a('0x8')](_0x027a('0x16'),inspectError(_0x18458f));});}exports[_0x027a('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x511c7a){return cmHopperHistory[_0x027a('0x18')](_0x511c7a)['catch'](function(_0x953887){logger['error'](_0x027a('0x19'),inspectError(_0x953887));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x578ea5){return cmHopperHistory[_0x027a('0x1a')](_0x578ea5)['catch'](function(_0x47a365){logger[_0x027a('0x8')]('[createHistory]',inspectError(_0x47a365));});}exports[_0x027a('0x1a')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 81713f4..60281f5 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15ac=['getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x15ac,0x6f));var _0xc15a=function(_0x3d1753,_0x5c1b01){_0x3d1753=_0x3d1753-0x0;var _0x5e2bc3=_0x15ac[_0x3d1753];return _0x5e2bc3;};'use strict';var _=require(_0xc15a('0x0'));var moment=require(_0xc15a('0x1'));var util=require(_0xc15a('0x2'));var logger=require(_0xc15a('0x3'))(_0xc15a('0x4'));var timezones=require(_0xc15a('0x5'))[_0xc15a('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc15a('0x7'),'DEACTIVATED':_0xc15a('0x8'),'DISACTIVED':_0xc15a('0x9'),'EMPTY_INTERVAL':_0xc15a('0xa'),'INACTIVE':_0xc15a('0xb'),'NO_AGENTS_LOGGED':_0xc15a('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xc15a('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xc15a('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc15a('0xf'),'UNKNOWN_TIMEZONE':_0xc15a('0x10'),'UNREACHABLE_TRUNK':_0xc15a('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x19649f){return _0x19649f[_0xc15a('0x12')]===_0xc15a('0x13');}exports[_0xc15a('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x31f16f){return _0x31f16f[_0xc15a('0x15')]===_0xc15a('0x16');}exports[_0xc15a('0x17')]=isIVRCampaign;function isOutboundQueue(_0xf3bf28){return _0xf3bf28[_0xc15a('0x15')]===_0xc15a('0x18');}exports[_0xc15a('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0xb18229){return _0xb18229[_0xc15a('0x1a')];}exports[_0xc15a('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x43f334){return _0x43f334['active'];}exports[_0xc15a('0x1c')]=isIVRCampaignActive;function getSeconds(_0x1847ab,_0x50c2a4){var _0x32eadb=moment(_0x1847ab)[_0xc15a('0x1d')](0x0);var _0x50808d=moment(_0x50c2a4)[_0xc15a('0x1d')](0x0);return _0x32eadb['diff'](_0x50808d,'seconds');}exports[_0xc15a('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x4734ae,_0x154f65){var _0x2962d5=![];var _0x524d71=_0x4734ae[_0xc15a('0x12')]!==_0x154f65['dialMethod']||_0x4734ae[_0xc15a('0x1a')]!==_0x154f65[_0xc15a('0x1a')]||_0x4734ae[_0xc15a('0x1f')]!==_0x154f65['message'];var _0x2646b6=_0x4734ae[_0xc15a('0x20')]!==_0x154f65[_0xc15a('0x20')]||_0x4734ae['loggedIn']!==_0x154f65[_0xc15a('0x21')]||_0x4734ae['loggedInDb']!==_0x154f65['loggedInDb']||_0x4734ae[_0xc15a('0x22')]!==_0x154f65[_0xc15a('0x22')]||_0x4734ae[_0xc15a('0x23')]!==_0x154f65[_0xc15a('0x23')]||_0x4734ae[_0xc15a('0x24')]!==_0x154f65[_0xc15a('0x24')]||_0x4734ae[_0xc15a('0x25')]!==_0x154f65['waiting']||_0x4734ae[_0xc15a('0x26')]!==_0x154f65[_0xc15a('0x26')]||_0x4734ae['originated']!==_0x154f65[_0xc15a('0x27')];if(_0x4734ae[_0xc15a('0x28')]&&_0x154f65[_0xc15a('0x28')]){_0x2962d5=_0x4734ae[_0xc15a('0x28')][_0xc15a('0x29')]!==_0x154f65['Trunk'][_0xc15a('0x29')]||_0x4734ae[_0xc15a('0x28')][_0xc15a('0x2a')]!==_0x154f65[_0xc15a('0x28')][_0xc15a('0x2a')];}return _0x524d71||_0x2646b6||_0x2962d5;}exports[_0xc15a('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4c19c1){var _0x2d86c8=null;var _0x3eff9d=_0x4c19c1[_0xc15a('0x2c')];if(_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2e')])||_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2f')])||_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2f')][_0xc15a('0x30')])){_0x2d86c8=CAMPAIGN_STATUS[_0xc15a('0x31')];}else if(_[_0xc15a('0x32')](_0x4c19c1['dialGlobalInterval'])||_[_0xc15a('0x32')](_0x4c19c1[_0xc15a('0x2f')][_0xc15a('0x30')])){_0x2d86c8=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x3eff9d&&!timezones[_0x3eff9d]){_0x2d86c8=CAMPAIGN_STATUS[_0xc15a('0x33')];}return _0x2d86c8;}function checkAnyValidTrunk(_0x4ac130,_0x131516){var _0x3cbc6f=null;var _0x204457=_0xc15a('0x34');var _0x16473e=[_0xc15a('0x35'),_0xc15a('0x36')];var _0xc3f4a4=!![];if(_0x4ac130['Trunk']&&_0x4ac130['Trunk']['active']){_0x204457+=_0x4ac130['Trunk'][_0xc15a('0x29')];_0x3cbc6f=_0x131516[_0x204457];_0xc3f4a4=_0x16473e['includes'](_0x3cbc6f[_0xc15a('0x37')]);}else if(_0x4ac130['TrunkBackup']&&_0x4ac130[_0xc15a('0x38')][_0xc15a('0x2a')]){_0x204457+=_0x4ac130[_0xc15a('0x38')][_0xc15a('0x29')];_0x3cbc6f=_0x131516[_0x204457];_0xc3f4a4=_0x16473e[_0xc15a('0x39')](_0x3cbc6f[_0xc15a('0x37')]);}return _0xc3f4a4;}function getQueueCampaignStatusMessage(_0x2fe998,_0x159df9){var _0x441771=CAMPAIGN_STATUS[_0xc15a('0x3a')];var _0x48d7fd=isPreviewCampaign(_0x2fe998);if(!isQueueCampaignActive(_0x2fe998)){if(_0x48d7fd){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3b')];}else{if(_0x2fe998[_0xc15a('0x27')]===0x0&&_0x2fe998[_0xc15a('0x23')]===0x0&&_0x2fe998[_0xc15a('0x25')]===0x0&&(_0x2fe998['pTalking']||0x0)===0x0){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3b')];}else{_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3c')];}}}else if(_0x2fe998['loggedIn']===0x0){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3d')];}else if(!checkAnyValidTrunk(_0x2fe998,_0x159df9)){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3e')];}else if(!isPreviewCampaign(_0x2fe998)){var _0x40db6c=checkAnyValidQueueCampaignInterval(_0x2fe998);if(_0x40db6c){_0x441771=_0x40db6c;}}return _0x441771;}exports[_0xc15a('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xbfa833){var _0x38eeb8=CAMPAIGN_STATUS[_0xc15a('0x3c')];if(_0xbfa833[_0xc15a('0x27')]===0x0&&_0xbfa833[_0xc15a('0x23')]===0x0&&_0xbfa833['waiting']===0x0&&(_0xbfa833['pTalking']||0x0)===0x0){_0x38eeb8=CAMPAIGN_STATUS[_0xc15a('0x3b')];}return _0x38eeb8;}exports[_0xc15a('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1cb2ac){var _0x16d156=_0x1cb2ac[_0xc15a('0x41')](/"(.*?)"/);return _0x16d156?_0x16d156[0x1]:_0x1cb2ac;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2d759d,_0x34d9a1,_0x22d720){if(!_[_0xc15a('0x42')](_0x22d720)&&typeof _0x22d720===_0xc15a('0x43')&&!_[_0xc15a('0x32')](_0x22d720)){if(!_[_0xc15a('0x42')](_0x34d9a1)&&typeof _0x34d9a1===_0xc15a('0x43')&&!_[_0xc15a('0x32')](_0x34d9a1)){return util[_0xc15a('0x44')](_0xc15a('0x45'),_0x34d9a1,_0x22d720);}return util[_0xc15a('0x44')](_0xc15a('0x45'),_0x22d720,_0x22d720);}if(!_[_0xc15a('0x42')](_0x2d759d)&&typeof _0x2d759d==='string'&&!_[_0xc15a('0x32')](_0x2d759d)){return _0x2d759d;}return _0xc15a('0x46');}exports[_0xc15a('0x47')]=getCallerId;function getCallerIdRandom(_0x17aa58,_0x5693d1){var _0x4cac9d;var _0x3b5d67;var _0x2b3cad;if(_0x5693d1<=0x0){_0x5693d1=0x1;}_0x4cac9d=new RegExp(_0xc15a('0x48')+_0x5693d1+'}$');_0x3b5d67=Math[_0xc15a('0x49')](0xa,_0x5693d1-0x1);_0x2b3cad=Math['pow'](0xa,_0x5693d1)-0x1;return util[_0xc15a('0x44')]('%s',_[_0xc15a('0x4a')](_0x17aa58,_0x4cac9d,_[_0xc15a('0x4b')](_0x3b5d67,_0x2b3cad)[_0xc15a('0x4c')]()));}exports[_0xc15a('0x4d')]=getCallerIdRandom;function decrementOriginate(_0xb053e5,_0x4ad1a0){if(_0xb053e5[_0xc15a('0x27')]&&_0xb053e5[_0xc15a('0x27')]>0x0){_0xb053e5[_0xc15a('0x27')]-=0x1;}else{logger[_0xc15a('0x4e')](_0xc15a('0x4f'),_0x4ad1a0);}}exports[_0xc15a('0x50')]=decrementOriginate;function checkContactEmpty(_0x578413){return _0x578413&&_0x578413[_0xc15a('0x51')]>0x0;}exports[_0xc15a('0x52')]=checkContactEmpty;function erlangb(_0x22d7d4,_0x2999d5){if(_0x2999d5===0x0){return 0x0;}var _0x171d12=0x1;for(var _0x147323=0x1;_0x147323<=_0x2999d5;_0x147323+=0x1){_0x171d12=0x1+_0x171d12*_0x147323/_0x22d7d4;}return 0x1/_0x171d12;}exports[_0xc15a('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x74d2e7,_0x2cbad9,_0x329980){if(_0x2cbad9>_0x329980){for(var _0x4e3d2a=0x0;_0x4e3d2a<_0x2cbad9-_0x329980;_0x4e3d2a+=0x1){decrementOriginate(_0x74d2e7,_0xc15a('0x54'));}}}exports[_0xc15a('0x55')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x110f8e){var _0x24e5dc={};var _0x4fec06=['id',_0xc15a('0x56'),_0xc15a('0x57'),_0xc15a('0x58')];const _0x493bb5=0xfa;if(_0x110f8e){for(var _0x2ff781 in _0x110f8e){if(typeof _0x110f8e[_0x2ff781]!==_0xc15a('0x59')){if(!_[_0xc15a('0x2d')](_0x110f8e[_0x2ff781])&&!_0x4fec06['includes'](_0x2ff781)){if(_0x2ff781==='description'&&_0x110f8e[_0x2ff781][_0xc15a('0x51')]>_0x493bb5){_0x24e5dc['XMD-'+_0x2ff781[_0xc15a('0x5a')]()]=_0x110f8e[_0x2ff781]['toString']()[_0xc15a('0x5b')](0x0,_0x493bb5);}else{_0x24e5dc[_0xc15a('0x5c')+_0x2ff781['toUpperCase']()]=_0x110f8e[_0x2ff781];}}}}}return _0x24e5dc;}exports[_0xc15a('0x5d')]=setXMDContactVariables; \ No newline at end of file +var _0x1f88=['XMD-','toUpperCase','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','getSeconds','dialActive','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','substring'];(function(_0x3949b5,_0x4bd4ae){var _0x3ace93=function(_0x4361db){while(--_0x4361db){_0x3949b5['push'](_0x3949b5['shift']());}};_0x3ace93(++_0x4bd4ae);}(_0x1f88,0x10a));var _0x81f8=function(_0x4fafa9,_0x134473){_0x4fafa9=_0x4fafa9-0x0;var _0x5ba9a2=_0x1f88[_0x4fafa9];return _0x5ba9a2;};'use strict';var _=require('lodash');var moment=require(_0x81f8('0x0'));var util=require(_0x81f8('0x1'));var logger=require(_0x81f8('0x2'))(_0x81f8('0x3'));var timezones=require(_0x81f8('0x4'))[_0x81f8('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x81f8('0x6'),'BLACKLIST':_0x81f8('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x81f8('0x8'),'EMPTY_INTERVAL':_0x81f8('0x9'),'INACTIVE':_0x81f8('0xa'),'NO_AGENTS_LOGGED':_0x81f8('0xb'),'NO_AVAILABLE_CONTACTS':_0x81f8('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x81f8('0xd'),'RECALL_TIMEOUT':_0x81f8('0xe'),'RUNNING':_0x81f8('0xf'),'UNKNOWN_TIMEZONE':_0x81f8('0x10'),'UNREACHABLE_TRUNK':_0x81f8('0x11')};exports[_0x81f8('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5b67cc){return _0x5b67cc[_0x81f8('0x13')]===_0x81f8('0x14');}exports[_0x81f8('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x485607){return _0x485607['type']===_0x81f8('0x16');}exports[_0x81f8('0x17')]=isIVRCampaign;function isOutboundQueue(_0x55af98){return _0x55af98[_0x81f8('0x18')]===_0x81f8('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x15348c){return _0x15348c['dialActive'];}exports[_0x81f8('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x386e0f){return _0x386e0f['active'];}exports[_0x81f8('0x1b')]=isIVRCampaignActive;function getSeconds(_0x3b2a16,_0xfe70bf){var _0x1e0311=moment(_0x3b2a16)[_0x81f8('0x1c')](0x0);var _0x42f957=moment(_0xfe70bf)[_0x81f8('0x1c')](0x0);return _0x1e0311[_0x81f8('0x1d')](_0x42f957,'seconds');}exports[_0x81f8('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x3348d2,_0x4e63d0){var _0x114083=![];var _0x508b2a=_0x3348d2[_0x81f8('0x13')]!==_0x4e63d0[_0x81f8('0x13')]||_0x3348d2[_0x81f8('0x1f')]!==_0x4e63d0[_0x81f8('0x1f')]||_0x3348d2['message']!==_0x4e63d0['message'];var _0x3917f6=_0x3348d2['available']!==_0x4e63d0[_0x81f8('0x20')]||_0x3348d2[_0x81f8('0x21')]!==_0x4e63d0[_0x81f8('0x21')]||_0x3348d2[_0x81f8('0x22')]!==_0x4e63d0['loggedInDb']||_0x3348d2[_0x81f8('0x23')]!==_0x4e63d0[_0x81f8('0x23')]||_0x3348d2[_0x81f8('0x24')]!==_0x4e63d0[_0x81f8('0x24')]||_0x3348d2[_0x81f8('0x25')]!==_0x4e63d0[_0x81f8('0x25')]||_0x3348d2[_0x81f8('0x26')]!==_0x4e63d0[_0x81f8('0x26')]||_0x3348d2[_0x81f8('0x27')]!==_0x4e63d0[_0x81f8('0x27')]||_0x3348d2['originated']!==_0x4e63d0[_0x81f8('0x28')];if(_0x3348d2[_0x81f8('0x29')]&&_0x4e63d0['Trunk']){_0x114083=_0x3348d2[_0x81f8('0x29')][_0x81f8('0x2a')]!==_0x4e63d0[_0x81f8('0x29')]['name']||_0x3348d2[_0x81f8('0x29')][_0x81f8('0x2b')]!==_0x4e63d0['Trunk'][_0x81f8('0x2b')];}return _0x508b2a||_0x3917f6||_0x114083;}exports[_0x81f8('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xb44752){var _0x35218a=null;var _0x162bbb=_0xb44752[_0x81f8('0x2d')];if(_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x2f')])||_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x30')])||_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x30')]['Intervals'])){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x31')];}else if(_[_0x81f8('0x32')](_0xb44752[_0x81f8('0x2f')])||_['isEmpty'](_0xb44752['Interval'][_0x81f8('0x33')])){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x34')];}else if(_0x162bbb&&!timezones[_0x162bbb]){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x35')];}return _0x35218a;}function checkAnyValidTrunk(_0x13f57a,_0x3080b4){var _0x4277f3=null;var _0x1a594b=_0x81f8('0x36');var _0xe5802f=['reachable',_0x81f8('0x37')];var _0xec7c8c=!![];if(_0x13f57a[_0x81f8('0x29')]&&_0x13f57a['Trunk'][_0x81f8('0x2b')]){_0x1a594b+=_0x13f57a['Trunk'][_0x81f8('0x2a')];_0x4277f3=_0x3080b4[_0x1a594b];_0xec7c8c=_0xe5802f[_0x81f8('0x38')](_0x4277f3['status']);}else if(_0x13f57a[_0x81f8('0x39')]&&_0x13f57a[_0x81f8('0x39')][_0x81f8('0x2b')]){_0x1a594b+=_0x13f57a[_0x81f8('0x39')][_0x81f8('0x2a')];_0x4277f3=_0x3080b4[_0x1a594b];_0xec7c8c=_0xe5802f[_0x81f8('0x38')](_0x4277f3[_0x81f8('0x3a')]);}return _0xec7c8c;}function getQueueCampaignStatusMessage(_0x2583b4,_0x7bbf5f){var _0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x6')];var _0x1266ba=isPreviewCampaign(_0x2583b4);if(!isQueueCampaignActive(_0x2583b4)){if(_0x1266ba){_0x5089e1=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2583b4[_0x81f8('0x28')]===0x0&&_0x2583b4['talking']===0x0&&_0x2583b4[_0x81f8('0x26')]===0x0&&(_0x2583b4[_0x81f8('0x25')]||0x0)===0x0){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3b')];}else{_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3c')];}}}else if(_0x2583b4[_0x81f8('0x21')]===0x0){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3d')];}else if(!checkAnyValidTrunk(_0x2583b4,_0x7bbf5f)){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3e')];}else if(!isPreviewCampaign(_0x2583b4)){var _0xb13ffc=checkAnyValidQueueCampaignInterval(_0x2583b4);if(_0xb13ffc){_0x5089e1=_0xb13ffc;}}return _0x5089e1;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3382ac){var _0x4606e8=CAMPAIGN_STATUS[_0x81f8('0x3c')];if(_0x3382ac['originated']===0x0&&_0x3382ac[_0x81f8('0x24')]===0x0&&_0x3382ac[_0x81f8('0x26')]===0x0&&(_0x3382ac['pTalking']||0x0)===0x0){_0x4606e8=CAMPAIGN_STATUS['INACTIVE'];}return _0x4606e8;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x285e49){var _0x1ed546=_0x285e49['match'](/"(.*?)"/);return _0x1ed546?_0x1ed546[0x1]:_0x285e49;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xdb92d9,_0x448c94,_0x53ec5e){if(!_['isUndefined'](_0x53ec5e)&&typeof _0x53ec5e===_0x81f8('0x3f')&&!_[_0x81f8('0x32')](_0x53ec5e)){if(!_[_0x81f8('0x40')](_0x448c94)&&typeof _0x448c94===_0x81f8('0x3f')&&!_['isEmpty'](_0x448c94)){return util[_0x81f8('0x41')](_0x81f8('0x42'),_0x448c94,_0x53ec5e);}return util[_0x81f8('0x41')](_0x81f8('0x42'),_0x53ec5e,_0x53ec5e);}if(!_[_0x81f8('0x40')](_0xdb92d9)&&typeof _0xdb92d9===_0x81f8('0x3f')&&!_[_0x81f8('0x32')](_0xdb92d9)){return _0xdb92d9;}return _0x81f8('0x43');}exports[_0x81f8('0x44')]=getCallerId;function getCallerIdRandom(_0x35922b,_0x217fa1){var _0x9c399;var _0x2dc72a;var _0x13ea92;if(_0x217fa1<=0x0){_0x217fa1=0x1;}_0x9c399=new RegExp(_0x81f8('0x45')+_0x217fa1+'}$');_0x2dc72a=Math[_0x81f8('0x46')](0xa,_0x217fa1-0x1);_0x13ea92=Math['pow'](0xa,_0x217fa1)-0x1;return util[_0x81f8('0x41')]('%s',_['replace'](_0x35922b,_0x9c399,_[_0x81f8('0x47')](_0x2dc72a,_0x13ea92)[_0x81f8('0x48')]()));}exports[_0x81f8('0x49')]=getCallerIdRandom;function decrementOriginate(_0x4f7209,_0x56d4c3){if(_0x4f7209[_0x81f8('0x28')]&&_0x4f7209[_0x81f8('0x28')]>0x0){_0x4f7209[_0x81f8('0x28')]-=0x1;}else{logger['error'](_0x81f8('0x4a'),_0x56d4c3);}}exports[_0x81f8('0x4b')]=decrementOriginate;function checkContactEmpty(_0x3590c3){return _0x3590c3&&_0x3590c3[_0x81f8('0x4c')]>0x0;}exports[_0x81f8('0x4d')]=checkContactEmpty;function erlangb(_0x37f4d4,_0x9eec9d){if(_0x9eec9d===0x0){return 0x0;}var _0x2ac33a=0x1;for(var _0x22bef0=0x1;_0x22bef0<=_0x9eec9d;_0x22bef0+=0x1){_0x2ac33a=0x1+_0x2ac33a*_0x22bef0/_0x37f4d4;}return 0x1/_0x2ac33a;}exports[_0x81f8('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x2546c6,_0x24b2eb,_0x4895ff){if(_0x24b2eb>_0x4895ff){for(var _0x1edb7b=0x0;_0x1edb7b<_0x24b2eb-_0x4895ff;_0x1edb7b+=0x1){decrementOriginate(_0x2546c6,_0x81f8('0x4f'));}}}exports[_0x81f8('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xb1824f){var _0x1da83b={};var _0x1d25e1=['id',_0x81f8('0x51'),'tags',_0x81f8('0x52')];const _0x44f7e0=0xfa;if(_0xb1824f){for(var _0x139ebb in _0xb1824f){if(typeof _0xb1824f[_0x139ebb]!==_0x81f8('0x53')){if(!_['isNil'](_0xb1824f[_0x139ebb])&&!_0x1d25e1[_0x81f8('0x38')](_0x139ebb)){if(_0x139ebb===_0x81f8('0x54')&&_0xb1824f[_0x139ebb][_0x81f8('0x4c')]>_0x44f7e0){_0x1da83b['XMD-'+_0x139ebb['toUpperCase']()]=_0xb1824f[_0x139ebb][_0x81f8('0x48')]()[_0x81f8('0x55')](0x0,_0x44f7e0);}else{_0x1da83b[_0x81f8('0x56')+_0x139ebb[_0x81f8('0x57')]()]=_0xb1824f[_0x139ebb];}}}}}return _0x1da83b;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d3f73d1..1656db3 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x67a2fe,_0x47c07a){var _0x3cd6e3=function(_0x5d48d2){while(--_0x5d48d2){_0x67a2fe['push'](_0x67a2fe['shift']());}};_0x3cd6e3(++_0x47c07a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4f2a68,_0x309542){var _0x474071=function(_0xb94b16){while(--_0xb94b16){_0x4f2a68['push'](_0x4f2a68['shift']());}};_0x474071(++_0x309542);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0d3d67c..3540652 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 _0x2d27=['catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','format','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify'];(function(_0x3ab6bf,_0x710fa2){var _0x166506=function(_0xe66634){while(--_0xe66634){_0x3ab6bf['push'](_0x3ab6bf['shift']());}};_0x166506(++_0x710fa2);}(_0x2d27,0x1ac));var _0x72d2=function(_0x26cb03,_0x38d271){_0x26cb03=_0x26cb03-0x0;var _0x5b7ac9=_0x2d27[_0x26cb03];return _0x5b7ac9;};'use strict';var util=require(_0x72d2('0x0'));var _=require(_0x72d2('0x1'));var BPromise=require(_0x72d2('0x2'));var uuid=require(_0x72d2('0x3'));var moment=require('moment');var path=require(_0x72d2('0x4'));var tiff2pdf=require(_0x72d2('0x5'));var gs=require(_0x72d2('0x6'));var logger=require('../../../config/logger')(_0x72d2('0x7'));var ami=require('../ami');var rpcDb=require(_0x72d2('0x8'));var Channel=require('./channel');var ut=require(_0x72d2('0x9'));var Action=require(_0x72d2('0xa'));var faxAccount=require(_0x72d2('0xb'));var attachment=require(_0x72d2('0xc'));var faxMessage=require(_0x72d2('0xd'));function Fax(_0x54e1ef){this[_0x72d2('0xe')]={};this['faxAccounts']=_0x54e1ef[_0x72d2('0xf')];this[_0x72d2('0x10')]=_0x54e1ef[_0x72d2('0x10')];this[_0x72d2('0x11')]={};ami['on'](_0x72d2('0x12'),this[_0x72d2('0x13')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x15'),this[_0x72d2('0x16')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x17'),this['syncNewState'][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x18'),this[_0x72d2('0x19')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1a'),this[_0x72d2('0x1b')]['bind'](this));ami['on']('receivefax',this[_0x72d2('0x1c')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1d'),this[_0x72d2('0x1e')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1f'),this[_0x72d2('0x20')][_0x72d2('0x14')](this));}Fax[_0x72d2('0x21')]['syncNewchannel']=function(_0x15faa7){if(_0x15faa7[_0x72d2('0x22')]==='from-voip-provider'){for(var _0x3c4df3 in this[_0x72d2('0xf')]){if(this[_0x72d2('0xf')][_0x72d2('0x23')](_0x3c4df3)){if(_0x15faa7[_0x72d2('0x24')]===this[_0x72d2('0xf')][_0x3c4df3][_0x72d2('0x25')]){this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]]={};this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]][_0x72d2('0x27')]=_0x15faa7[_0x72d2('0x27')];this[_0x72d2('0xe')][_0x15faa7['uniqueid']]['id']=this[_0x72d2('0xf')][_0x3c4df3]['id'];this[_0x72d2('0xe')][_0x15faa7['uniqueid']][_0x72d2('0x28')]=this[_0x72d2('0xf')][_0x3c4df3]['name'];logger[_0x72d2('0x29')](_0x15faa7[_0x72d2('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x72d2('0x11')][_0x15faa7[_0x72d2('0x26')]]){this['channels'][_0x15faa7['uniqueid']]={};this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]][_0x72d2('0x27')]=_0x15faa7[_0x72d2('0x27')];logger[_0x72d2('0x29')](_0x15faa7['uniqueid'],_0x72d2('0x2a'));}};Fax[_0x72d2('0x21')][_0x72d2('0x16')]=function(_0x5e2402){if(this[_0x72d2('0xe')][_0x5e2402[_0x72d2('0x26')]]){for(var _0x4d911e in _0x5e2402['variable']){if(_0x5e2402[_0x72d2('0x2b')][_0x72d2('0x23')](_0x4d911e)){this[_0x72d2('0xe')][_0x5e2402[_0x72d2('0x26')]][_0x4d911e]=_0x5e2402[_0x72d2('0x2c')];}}}};Fax[_0x72d2('0x21')][_0x72d2('0x2d')]=function(_0x1ef29c){if(this[_0x72d2('0xe')][_0x1ef29c[_0x72d2('0x26')]]){this[_0x72d2('0xe')][_0x1ef29c['uniqueid']][_0x72d2('0x2e')]=_0x1ef29c['channelstate'];this['channels'][_0x1ef29c['uniqueid']]['channelstatedesc']=_0x1ef29c[_0x72d2('0x2f')];}};Fax[_0x72d2('0x21')]['syncNewExten']=function(_0x59d6d0){if(this[_0x72d2('0xe')][_0x59d6d0[_0x72d2('0x26')]]){for(var _0x5ede92 in _0x59d6d0[_0x72d2('0x2b')]){if(_0x59d6d0['variable'][_0x72d2('0x23')](_0x5ede92)){this[_0x72d2('0xe')][_0x59d6d0[_0x72d2('0x26')]][_0x5ede92]=_0x59d6d0[_0x72d2('0x2c')];}}}};Fax[_0x72d2('0x21')][_0x72d2('0x1b')]=function(_0x15ff3c){if(this[_0x72d2('0xe')][_0x15ff3c['uniqueid']]){this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]][_0x72d2('0x30')]=_0x15ff3c[_0x72d2('0x30')];this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]]['status']=_0x15ff3c[_0x72d2('0x31')];this['channels'][_0x15ff3c['uniqueid']][_0x72d2('0x25')]=_0x15ff3c[_0x72d2('0x25')];this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]][_0x72d2('0x32')]=_0x15ff3c[_0x72d2('0x32')];logger[_0x72d2('0x29')](_0x15ff3c[_0x72d2('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x4fff64){var _0x1c8788=this;if(this[_0x72d2('0xe')][_0x4fff64['uniqueid']]){var _0x132342=this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]]['id'];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x33')]=_0x4fff64[_0x72d2('0x33')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x34')]=_0x4fff64[_0x72d2('0x34')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]]['localstationid']=_0x4fff64['localstationid'];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x35')]=_0x4fff64[_0x72d2('0x35')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x36')]=_0x4fff64[_0x72d2('0x36')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x32')]=_0x4fff64[_0x72d2('0x32')];this['channels'][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x37')]=_0x4fff64['calleridnum'];if(this[_0x72d2('0xe')][_0x4fff64['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4fff64[_0x72d2('0x32')],_0x72d2('0x38'),function(_0x473a08){logger[_0x72d2('0x29')](_0x4fff64[_0x72d2('0x26')],_0x72d2('0x39'),_0x473a08[_0x72d2('0x3a')]);attachment[_0x72d2('0x3b')]({'name':path[_0x72d2('0x3c')](_0x4fff64[_0x72d2('0x32')])[_0x72d2('0x28')],'basename':path[_0x72d2('0x3c')](_0x4fff64[_0x72d2('0x32')])[_0x72d2('0x28')]+'.pdf','type':_0x72d2('0x3d')})[_0x72d2('0x3e')](function(_0x2b6586){faxAccount[_0x72d2('0x3f')](_0x132342,{'from':_0x4fff64[_0x72d2('0x37')],'mapKey':_0x72d2('0x7'),'body':path[_0x72d2('0x3c')](_0x4fff64['filename'])['name']+'.pdf','AttachmentId':_0x2b6586['id']})[_0x72d2('0x40')](function(_0x244fa2){logger[_0x72d2('0x41')](_0x4fff64['uniqueid'],_0x72d2('0x42'),JSON[_0x72d2('0x43')](_0x244fa2));});})[_0x72d2('0x40')](function(_0x2bd5a9){logger[_0x72d2('0x41')](_0x4fff64['uniqueid'],_0x72d2('0x44'),JSON[_0x72d2('0x43')](_0x2bd5a9));});});}logger['info'](_0x4fff64[_0x72d2('0x26')],'\x20receiveFax\x20');}};Fax[_0x72d2('0x21')][_0x72d2('0x20')]=function(_0x2926e3){if(this[_0x72d2('0x11')][_0x2926e3['uniqueid']]){_[_0x72d2('0x45')](this[_0x72d2('0xe')][_0x2926e3[_0x72d2('0x26')]],_[_0x72d2('0x46')](_0x2926e3,[_0x72d2('0x47'),_0x72d2('0x48')]));}};function updateStatus(_0x5d6e3c){if(_0x5d6e3c[_0x72d2('0x49')]){faxMessage[_0x72d2('0x4a')](_0x5d6e3c[_0x72d2('0x49')],{'failMessage':_0x72d2('0x4b')})[_0x72d2('0x3e')](function(_0x2d67dd){ut['logger']('[Fax][Message][Error][Updated]',_0x2d67dd);})['catch'](function(_0x384210){ut[_0x72d2('0x4c')](_0x72d2('0x4d'),_0x384210);});}else{ut[_0x72d2('0x4c')](_0x72d2('0x4e'));}}Fax[_0x72d2('0x21')]['updateStatus']=function(_0x254714,_0x3f4751,_0x2d6c64){var _0x4fffba=this;var _0x20d906={};if(_0x3f4751){_0x20d906={'read':_0x3f4751};}else{_0x20d906={'failMessage':_0x2d6c64};}if(this[_0x72d2('0x11')][_0x254714][_0x72d2('0x49')]){faxMessage[_0x72d2('0x4a')](this[_0x72d2('0x11')][_0x254714][_0x72d2('0x49')],_0x20d906)['then'](function(_0x5f4c4a){ut[_0x72d2('0x4c')]('[Fax][Message][Updated]',_0x5f4c4a);})['catch'](function(_0x11204b){ut[_0x72d2('0x4c')](_0x72d2('0x4f'),_0x11204b);})[_0x72d2('0x50')](function(){delete _0x4fffba[_0x72d2('0xe')][_0x254714];delete _0x4fffba[_0x72d2('0x11')][_0x254714];});}else{ut[_0x72d2('0x4c')](_0x72d2('0x51'));this[_0x72d2('0x52')](_0x254714);delete this[_0x72d2('0x11')][_0x254714];}};Fax[_0x72d2('0x21')][_0x72d2('0x1e')]=function(_0x1d9806){var _0x3ba20d=this;if(this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]]){if(this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]){this[_0x72d2('0xe')][_0x1d9806['uniqueid']]['id']=this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]['id'];this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x28')]=this['actions'][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x28')];}logger[_0x72d2('0x29')](_0x1d9806['uniqueid'],this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]?_0x72d2('0x53'):_0x72d2('0x54'),JSON[_0x72d2('0x43')](this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]]));if(this[_0x72d2('0x11')][_0x1d9806['uniqueid']]){if(this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x55')]>0x0&&this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x1a')]===_0x72d2('0x56')){this[_0x72d2('0x57')](_0x1d9806[_0x72d2('0x26')],!![]);}else{this[_0x72d2('0x57')](_0x1d9806[_0x72d2('0x26')],![],this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x58')]?_0x72d2('0x59')+this['channels'][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x58')]:_0x72d2('0x5a'));}}}};Fax['prototype'][_0x72d2('0x5b')]=function(_0x121059){var _0x4d5bfd=this;return new BPromise(function(_0x44e3fa,_0x2b0b70){_0x4d5bfd[_0x72d2('0x5c')](_0x121059,_0x4d5bfd[_0x72d2('0xf')][_0x121059[_0x72d2('0x5d')]])['then'](function(_0x534f99){ut[_0x72d2('0x4c')](_0x72d2('0x5e'),_0x534f99);_0x44e3fa(ut['message'](_0x72d2('0x5f')));})['catch'](function(_0x4f0677){ut[_0x72d2('0x4c')](_0x72d2('0x60'),_0x4f0677);updateStatus(_0x121059);_0x2b0b70(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x72d2('0x61')]=function(_0x438e13){var _0x1dc614=this;return new BPromise(function(_0x21a452,_0x12816d){var _0x1889c1=_0x1dc614[_0x72d2('0x62')](_0x1dc614[_0x72d2('0xf')][_0x438e13[_0x72d2('0x5d')]][_0x72d2('0x63')],_0x438e13);if(_0x1889c1[_0x72d2('0x64')]){_0x21a452(ut['message']('Trunk\x20Reachable'));}else{_0x12816d(ut[_0x72d2('0x3a')](_0x1889c1[_0x72d2('0x3a')]));}});};function originate(_0xf6b3ac,_0x5f0fe8,_0x3a4084){return new BPromise(function(_0x2b76a2,_0x39d1dc){if(_0x3a4084){var _0x4d39ed=util[_0x72d2('0x65')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x72d2('0x3c')](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x28')],_0xf6b3ac[_0x72d2('0x4')]);gs[_0x72d2('0x66')](_0x4d39ed)['then'](function(){_0xf6b3ac[_0x72d2('0x4')]=util[_0x72d2('0x65')]('%s/%s.tif',path[_0x72d2('0x3c')](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x67')],path['parse'](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x28')]);_0x5f0fe8[_0x72d2('0x68')]=_0xf6b3ac['path'];ut[_0x72d2('0x4c')](_0x72d2('0x69'),'');ami[_0x72d2('0x6a')](ut[_0x72d2('0x6b')](_0xf6b3ac,_0x5f0fe8))[_0x72d2('0x3e')](function(_0x9a8aca){_0x2b76a2(_0x9a8aca);})['catch'](function(_0x169f13){_0x39d1dc(_0x169f13);});})[_0x72d2('0x40')](function(_0x301625){_0x39d1dc(_0x301625);});}else{ami[_0x72d2('0x6a')](ut[_0x72d2('0x6b')](_0xf6b3ac,_0x5f0fe8))['then'](function(_0x3d5a3c){_0x2b76a2(_0x3d5a3c);})['catch'](function(_0x434186){_0x39d1dc(_0x434186);});}});}Fax['prototype']['execOriginate']=function(_0x2cb421,_0x1c520a){var _0x58a21d=this;return new BPromise(function(_0x1a5708,_0x46caf4){var _0x46efb0=uuid['v4']();var _0x2f5eda=ut[_0x72d2('0x6c')](_0x2cb421,_0x1c520a);_0x58a21d[_0x72d2('0x11')][_0x46efb0]=new Action(_0x46efb0,_0x1c520a,_0x2cb421);var _0x9a7156=_0x58a21d['actions'][_0x46efb0];if(path[_0x72d2('0x3c')](_0x2cb421[_0x72d2('0x4')])[_0x72d2('0x6d')]===_0x72d2('0x6e')){originate(_0x9a7156,_0x2f5eda,!![])[_0x72d2('0x3e')](function(_0x5057b0){_0x1a5708(_0x5057b0);})[_0x72d2('0x40')](function(_0x26804b){_0x46caf4(_0x26804b);});}else{originate(_0x9a7156,_0x2f5eda,![])['then'](function(_0x1e834d){_0x1a5708(_0x1e834d);})['catch'](function(_0x287fcf){_0x46caf4(_0x287fcf);});}});};Fax['prototype'][_0x72d2('0x6f')]=function(_0x138b51){return!_[_0x72d2('0x70')](_0x138b51)&&!_['isNil'](_0x138b51[_0x72d2('0x28')])&&!_[_0x72d2('0x70')](_0x138b51[_0x72d2('0x71')])&&_0x138b51[_0x72d2('0x71')]&&!_['isNil'](this[_0x72d2('0x10')][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])])&&!_['isNil'](this['trunks'][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])]['status'])&&(this[_0x72d2('0x10')][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])][_0x72d2('0x31')]===_0x72d2('0x73')||this[_0x72d2('0x10')][util[_0x72d2('0x65')](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])][_0x72d2('0x31')]===_0x72d2('0x74'));};Fax['prototype'][_0x72d2('0x62')]=function(_0x494005,_0x42a55e){if(!this['isTrunkReachable'](_0x494005)){ut[_0x72d2('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x72d2('0x70')](_0x494005)?'':_0x494005[_0x72d2('0x28')]+_0x72d2('0x75'));return{'isValid':![],'message':_0x72d2('0x76')};}if(_[_0x72d2('0x70')](_0x42a55e[_0x72d2('0x7')])){ut['logger'](_0x72d2('0x77'),JSON[_0x72d2('0x43')](_0x42a55e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x42a55e['path'])){ut[_0x72d2('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x72d2('0x43')](_0x42a55e));return{'isValid':![],'message':_0x72d2('0x78')};}return{'isValid':!![],'message':_0x72d2('0x79')};};Fax[_0x72d2('0x21')]['deleteChannelAfterTimeout']=function(_0x4997c4,_0x4e994e=0x2710){if(this[_0x72d2('0xe')][_0x4997c4]){setTimeout(()=>{delete this['channels'][_0x4997c4];},_0x4e994e);}};module[_0x72d2('0x7a')]=Fax; \ No newline at end of file +var _0xda51=['send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','path','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED'];(function(_0x975fe0,_0x4b6fd1){var _0x439aae=function(_0x17c7b8){while(--_0x17c7b8){_0x975fe0['push'](_0x975fe0['shift']());}};_0x439aae(++_0x4b6fd1);}(_0xda51,0x192));var _0x1da5=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0xda51[_0xf35bc1];return _0xa6b162;};'use strict';var util=require(_0x1da5('0x0'));var _=require(_0x1da5('0x1'));var BPromise=require(_0x1da5('0x2'));var uuid=require(_0x1da5('0x3'));var moment=require(_0x1da5('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x1da5('0x5'));var logger=require(_0x1da5('0x6'))(_0x1da5('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x1da5('0x8'));var ut=require(_0x1da5('0x9'));var Action=require('./action');var faxAccount=require(_0x1da5('0xa'));var attachment=require(_0x1da5('0xb'));var faxMessage=require(_0x1da5('0xc'));function Fax(_0xc3019b){this[_0x1da5('0xd')]={};this[_0x1da5('0xe')]=_0xc3019b[_0x1da5('0xe')];this[_0x1da5('0xf')]=_0xc3019b[_0x1da5('0xf')];this[_0x1da5('0x10')]={};ami['on'](_0x1da5('0x11'),this['syncNewchannel'][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x13'),this[_0x1da5('0x14')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x15'),this[_0x1da5('0x16')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x17'),this['syncNewExten'][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x18'),this[_0x1da5('0x19')]['bind'](this));ami['on'](_0x1da5('0x1a'),this[_0x1da5('0x1b')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x1c'),this['syncHangup'][_0x1da5('0x12')](this));ami['on']('originateresponse',this[_0x1da5('0x1d')][_0x1da5('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x33abe1){if(_0x33abe1[_0x1da5('0x1e')]===_0x1da5('0x1f')){for(var _0x45c190 in this[_0x1da5('0xe')]){if(this['faxAccounts'][_0x1da5('0x20')](_0x45c190)){if(_0x33abe1[_0x1da5('0x21')]===this[_0x1da5('0xe')][_0x45c190][_0x1da5('0x22')]){this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]={};this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]['channel']=_0x33abe1[_0x1da5('0x24')];this['channels'][_0x33abe1['uniqueid']]['id']=this[_0x1da5('0xe')][_0x45c190]['id'];this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]][_0x1da5('0x25')]=this['faxAccounts'][_0x45c190][_0x1da5('0x25')];logger[_0x1da5('0x26')](_0x33abe1[_0x1da5('0x23')],_0x1da5('0x27'));}}}}if(this['actions'][_0x33abe1[_0x1da5('0x23')]]){this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]={};this['channels'][_0x33abe1[_0x1da5('0x23')]][_0x1da5('0x24')]=_0x33abe1['channel'];logger[_0x1da5('0x26')](_0x33abe1[_0x1da5('0x23')],_0x1da5('0x27'));}};Fax[_0x1da5('0x28')][_0x1da5('0x14')]=function(_0x5f281e){if(this[_0x1da5('0xd')][_0x5f281e[_0x1da5('0x23')]]){for(var _0x478cc1 in _0x5f281e[_0x1da5('0x29')]){if(_0x5f281e['variable'][_0x1da5('0x20')](_0x478cc1)){this['channels'][_0x5f281e[_0x1da5('0x23')]][_0x478cc1]=_0x5f281e[_0x1da5('0x2a')];}}}};Fax[_0x1da5('0x28')][_0x1da5('0x16')]=function(_0x37e21e){if(this['channels'][_0x37e21e[_0x1da5('0x23')]]){this['channels'][_0x37e21e['uniqueid']][_0x1da5('0x2b')]=_0x37e21e[_0x1da5('0x2b')];this[_0x1da5('0xd')][_0x37e21e[_0x1da5('0x23')]][_0x1da5('0x2c')]=_0x37e21e['channelstatedesc'];}};Fax[_0x1da5('0x28')][_0x1da5('0x2d')]=function(_0x19afb1){if(this[_0x1da5('0xd')][_0x19afb1[_0x1da5('0x23')]]){for(var _0x382023 in _0x19afb1[_0x1da5('0x29')]){if(_0x19afb1[_0x1da5('0x29')][_0x1da5('0x20')](_0x382023)){this[_0x1da5('0xd')][_0x19afb1[_0x1da5('0x23')]][_0x382023]=_0x19afb1[_0x1da5('0x2a')];}}}};Fax[_0x1da5('0x28')]['syncFaxStatus']=function(_0x50d3c7){if(this[_0x1da5('0xd')][_0x50d3c7['uniqueid']]){this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]][_0x1da5('0x2e')]=_0x50d3c7[_0x1da5('0x2e')];this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]]['status']=_0x50d3c7[_0x1da5('0x2f')];this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]][_0x1da5('0x22')]=_0x50d3c7[_0x1da5('0x22')];this[_0x1da5('0xd')][_0x50d3c7['uniqueid']][_0x1da5('0x30')]=_0x50d3c7[_0x1da5('0x30')];logger[_0x1da5('0x26')](_0x50d3c7[_0x1da5('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x1da5('0x28')][_0x1da5('0x1b')]=function(_0x4f4463){var _0x23005a=this;if(this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]]){var _0x17db10=this['channels'][_0x4f4463['uniqueid']]['id'];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x31')]=_0x4f4463['remotestationid'];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x32')]=_0x4f4463[_0x1da5('0x32')];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x22')]=_0x4f4463[_0x1da5('0x22')];this['channels'][_0x4f4463[_0x1da5('0x23')]]['resolution']=_0x4f4463[_0x1da5('0x33')];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]]['transferrate']=_0x4f4463[_0x1da5('0x34')];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x30')]=_0x4f4463[_0x1da5('0x30')];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x35')]=_0x4f4463['calleridnum'];if(this['channels'][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x32')]>0x0){tiff2pdf(_0x4f4463[_0x1da5('0x30')],_0x1da5('0x36'),function(_0x138afc){logger[_0x1da5('0x26')](_0x4f4463['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x138afc[_0x1da5('0x37')]);attachment[_0x1da5('0x38')]({'name':path[_0x1da5('0x39')](_0x4f4463[_0x1da5('0x30')])['name'],'basename':path[_0x1da5('0x39')](_0x4f4463['filename'])[_0x1da5('0x25')]+_0x1da5('0x3a'),'type':_0x1da5('0x3b')})[_0x1da5('0x3c')](function(_0x4671cd){faxAccount[_0x1da5('0x3d')](_0x17db10,{'from':_0x4f4463[_0x1da5('0x35')],'mapKey':'fax','body':path['parse'](_0x4f4463[_0x1da5('0x30')])[_0x1da5('0x25')]+_0x1da5('0x3a'),'AttachmentId':_0x4671cd['id']})['catch'](function(_0x52e912){logger[_0x1da5('0x3e')](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x3f'),JSON[_0x1da5('0x40')](_0x52e912));});})[_0x1da5('0x41')](function(_0x2b9d45){logger[_0x1da5('0x3e')](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x42'),JSON['stringify'](_0x2b9d45));});});}logger['info'](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x42'));}};Fax['prototype'][_0x1da5('0x1d')]=function(_0x2a1438){if(this[_0x1da5('0x10')][_0x2a1438[_0x1da5('0x23')]]){_['merge'](this[_0x1da5('0xd')][_0x2a1438[_0x1da5('0x23')]],_[_0x1da5('0x43')](_0x2a1438,['response',_0x1da5('0x44')]));}};function updateStatus(_0x4b8116){if(_0x4b8116[_0x1da5('0x45')]){faxMessage['update'](_0x4b8116[_0x1da5('0x45')],{'failMessage':_0x1da5('0x46')})[_0x1da5('0x3c')](function(_0x3045f9){ut[_0x1da5('0x47')](_0x1da5('0x48'),_0x3045f9);})[_0x1da5('0x41')](function(_0x1e5672){ut[_0x1da5('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x1e5672);});}else{ut[_0x1da5('0x47')](_0x1da5('0x49'));}}Fax[_0x1da5('0x28')][_0x1da5('0x4a')]=function(_0x2d2595,_0x58719b,_0x18a7df){var _0x561ba8=this;var _0x2a039a={};if(_0x58719b){_0x2a039a={'read':_0x58719b};}else{_0x2a039a={'failMessage':_0x18a7df};}if(this['actions'][_0x2d2595][_0x1da5('0x45')]){faxMessage['update'](this[_0x1da5('0x10')][_0x2d2595][_0x1da5('0x45')],_0x2a039a)['then'](function(_0x57f8d0){ut[_0x1da5('0x47')](_0x1da5('0x4b'),_0x57f8d0);})[_0x1da5('0x41')](function(_0x9d2831){ut[_0x1da5('0x47')](_0x1da5('0x4c'),_0x9d2831);})[_0x1da5('0x4d')](function(){delete _0x561ba8[_0x1da5('0xd')][_0x2d2595];delete _0x561ba8[_0x1da5('0x10')][_0x2d2595];});}else{ut[_0x1da5('0x47')](_0x1da5('0x4e'));this['deleteChannelAfterTimeout'](_0x2d2595);delete this[_0x1da5('0x10')][_0x2d2595];}};Fax[_0x1da5('0x28')][_0x1da5('0x4f')]=function(_0x5792d3){var _0x560ea4=this;if(this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]){if(this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]){this['channels'][_0x5792d3[_0x1da5('0x23')]]['id']=this['actions'][_0x5792d3[_0x1da5('0x23')]]['id'];this['channels'][_0x5792d3[_0x1da5('0x23')]]['name']=this['actions'][_0x5792d3[_0x1da5('0x23')]][_0x1da5('0x25')];}logger[_0x1da5('0x26')](_0x5792d3[_0x1da5('0x23')],this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]?'\x20hangup\x20sendFile\x20':_0x1da5('0x50'),JSON[_0x1da5('0x40')](this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]));if(this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]){if(this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]][_0x1da5('0x51')]>0x0&&this[_0x1da5('0xd')][_0x5792d3['uniqueid']][_0x1da5('0x18')]===_0x1da5('0x52')){this[_0x1da5('0x4a')](_0x5792d3[_0x1da5('0x23')],!![]);}else{this['updateStatus'](_0x5792d3[_0x1da5('0x23')],![],this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]['faxstatusstring']?_0x1da5('0x53')+this['channels'][_0x5792d3['uniqueid']][_0x1da5('0x54')]:_0x1da5('0x55'));}}}};Fax[_0x1da5('0x28')][_0x1da5('0x56')]=function(_0x48224c){var _0x351d44=this;return new BPromise(function(_0x24cf54,_0x3b097a){_0x351d44[_0x1da5('0x57')](_0x48224c,_0x351d44[_0x1da5('0xe')][_0x48224c[_0x1da5('0x58')]])[_0x1da5('0x3c')](function(_0x34785e){ut[_0x1da5('0x47')](_0x1da5('0x59'),_0x34785e);_0x24cf54(ut['message'](_0x1da5('0x5a')));})[_0x1da5('0x41')](function(_0x1f16b6){ut[_0x1da5('0x47')](_0x1da5('0x5b'),_0x1f16b6);updateStatus(_0x48224c);_0x3b097a(ut[_0x1da5('0x37')](_0x1da5('0x5c')));});});};Fax['prototype'][_0x1da5('0x5d')]=function(_0x34ecb2){var _0x2d2c6e=this;return new BPromise(function(_0x3f5fdb,_0xe40790){var _0x4e0341=_0x2d2c6e[_0x1da5('0x5e')](_0x2d2c6e[_0x1da5('0xe')][_0x34ecb2['FaxAccountId']][_0x1da5('0x5f')],_0x34ecb2);if(_0x4e0341[_0x1da5('0x60')]){_0x3f5fdb(ut['message']('Trunk\x20Reachable'));}else{_0xe40790(ut[_0x1da5('0x37')](_0x4e0341[_0x1da5('0x37')]));}});};function originate(_0x3cfd50,_0x281ab5,_0x2760d9){return new BPromise(function(_0x557875,_0x42c671){if(_0x2760d9){var _0x431595=util['format'](_0x1da5('0x61'),path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x25')],_0x3cfd50[_0x1da5('0x62')]);gs[_0x1da5('0x63')](_0x431595)[_0x1da5('0x3c')](function(){_0x3cfd50[_0x1da5('0x62')]=util[_0x1da5('0x64')]('%s/%s.tif',path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x65')],path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x25')]);_0x281ab5[_0x1da5('0x66')]=_0x3cfd50[_0x1da5('0x62')];ut[_0x1da5('0x47')](_0x1da5('0x67'),'');ami[_0x1da5('0x68')](ut['variablesAction'](_0x3cfd50,_0x281ab5))['then'](function(_0x1afa12){_0x557875(_0x1afa12);})['catch'](function(_0x10d9c2){_0x42c671(_0x10d9c2);});})[_0x1da5('0x41')](function(_0x2e3df8){_0x42c671(_0x2e3df8);});}else{ami[_0x1da5('0x68')](ut[_0x1da5('0x69')](_0x3cfd50,_0x281ab5))[_0x1da5('0x3c')](function(_0x2eec81){_0x557875(_0x2eec81);})[_0x1da5('0x41')](function(_0x3ac483){_0x42c671(_0x3ac483);});}});}Fax[_0x1da5('0x28')][_0x1da5('0x57')]=function(_0x49a51e,_0x15d7b6){var _0x3bbdb5=this;return new BPromise(function(_0x18c582,_0x3f2788){var _0x16e2f5=uuid['v4']();var _0x45b968=ut[_0x1da5('0x6a')](_0x49a51e,_0x15d7b6);_0x3bbdb5[_0x1da5('0x10')][_0x16e2f5]=new Action(_0x16e2f5,_0x15d7b6,_0x49a51e);var _0x51026c=_0x3bbdb5['actions'][_0x16e2f5];if(path[_0x1da5('0x39')](_0x49a51e[_0x1da5('0x62')])['ext']===_0x1da5('0x3a')){originate(_0x51026c,_0x45b968,!![])[_0x1da5('0x3c')](function(_0x556755){_0x18c582(_0x556755);})['catch'](function(_0x5bb1a6){_0x3f2788(_0x5bb1a6);});}else{originate(_0x51026c,_0x45b968,![])[_0x1da5('0x3c')](function(_0x2396bc){_0x18c582(_0x2396bc);})[_0x1da5('0x41')](function(_0x25f11d){_0x3f2788(_0x25f11d);});}});};Fax[_0x1da5('0x28')][_0x1da5('0x6b')]=function(_0x7e6875){return!_[_0x1da5('0x6c')](_0x7e6875)&&!_[_0x1da5('0x6c')](_0x7e6875[_0x1da5('0x25')])&&!_[_0x1da5('0x6c')](_0x7e6875[_0x1da5('0x6d')])&&_0x7e6875[_0x1da5('0x6d')]&&!_[_0x1da5('0x6c')](this[_0x1da5('0xf')][util[_0x1da5('0x64')]('SIP/%s',_0x7e6875['name'])])&&!_[_0x1da5('0x6c')](this[_0x1da5('0xf')][util[_0x1da5('0x64')](_0x1da5('0x6e'),_0x7e6875['name'])][_0x1da5('0x2f')])&&(this['trunks'][util[_0x1da5('0x64')]('SIP/%s',_0x7e6875[_0x1da5('0x25')])][_0x1da5('0x2f')]===_0x1da5('0x6f')||this[_0x1da5('0xf')][util[_0x1da5('0x64')](_0x1da5('0x6e'),_0x7e6875['name'])]['status']===_0x1da5('0x70'));};Fax[_0x1da5('0x28')][_0x1da5('0x5e')]=function(_0x2f1586,_0x571071){if(!this[_0x1da5('0x6b')](_0x2f1586)){ut[_0x1da5('0x47')](_0x1da5('0x71'),_[_0x1da5('0x6c')](_0x2f1586)?'':_0x2f1586[_0x1da5('0x25')]+_0x1da5('0x72'));return{'isValid':![],'message':_0x1da5('0x73')};}if(_[_0x1da5('0x6c')](_0x571071[_0x1da5('0x7')])){ut[_0x1da5('0x47')](_0x1da5('0x74'),JSON[_0x1da5('0x40')](_0x571071));return{'isValid':![],'message':_0x1da5('0x75')};}if(_[_0x1da5('0x6c')](_0x571071[_0x1da5('0x62')])){ut['logger'](_0x1da5('0x76'),JSON[_0x1da5('0x40')](_0x571071));return{'isValid':![],'message':_0x1da5('0x77')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x1da5('0x28')][_0x1da5('0x78')]=function(_0x22aad5,_0xf8cd2d=0x2710){if(this[_0x1da5('0xd')][_0x22aad5]){setTimeout(()=>{delete this[_0x1da5('0xd')][_0x22aad5];},_0xf8cd2d);}};module[_0x1da5('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c14b7bc..0c38591 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 _0x7b47=['notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x4db439,_0x162edf){var _0x3f46da=function(_0x1416ff){while(--_0x1416ff){_0x4db439['push'](_0x4db439['shift']());}};_0x3f46da(++_0x162edf);}(_0x7b47,0x138));var _0x77b4=function(_0x301062,_0x3f40a1){_0x301062=_0x301062-0x0;var _0x38fc91=_0x7b47[_0x301062];return _0x38fc91;};'use strict';var util=require(_0x77b4('0x0'));var BPromise=require(_0x77b4('0x1'));var logger=require(_0x77b4('0x2'))(_0x77b4('0x3'));var _=require(_0x77b4('0x4'));var faxAccount=require(_0x77b4('0x5'));function loggerCatch(_0x2cb90b){return function(_0x39b73d){logger['error'](_0x2cb90b,util[_0x77b4('0x6')](_0x39b73d,{'showHidden':![],'depth':null}));};}exports[_0x77b4('0x7')]=function(_0x4113ef,_0x2a8e74){return BPromise[_0x77b4('0x8')]()['then'](faxAccount['notify'](_0x4113ef,_0x2a8e74))[_0x77b4('0x9')](loggerCatch(_0x77b4('0xa')));}; \ No newline at end of file +var _0x22c3=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount'];(function(_0x4d6b49,_0x5c6cef){var _0x2a0107=function(_0x143a9a){while(--_0x143a9a){_0x4d6b49['push'](_0x4d6b49['shift']());}};_0x2a0107(++_0x5c6cef);}(_0x22c3,0x8b));var _0x322c=function(_0x2cd548,_0x28b9f6){_0x2cd548=_0x2cd548-0x0;var _0x1c281c=_0x22c3[_0x2cd548];return _0x1c281c;};'use strict';var util=require(_0x322c('0x0'));var BPromise=require(_0x322c('0x1'));var logger=require('../../../config/logger')(_0x322c('0x2'));var _=require(_0x322c('0x3'));var faxAccount=require(_0x322c('0x4'));function loggerCatch(_0x39872e){return function(_0x299fec){logger[_0x322c('0x5')](_0x39872e,util[_0x322c('0x6')](_0x299fec,{'showHidden':![],'depth':null}));};}exports[_0x322c('0x7')]=function(_0x24e76d,_0x59217b){return BPromise[_0x322c('0x8')]()[_0x322c('0x9')](faxAccount[_0x322c('0x7')](_0x24e76d,_0x59217b))[_0x322c('0xa')](loggerCatch(_0x322c('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 52b19e3..c2d3c14 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 _0xc49f=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xc49f,0x1ba));var _0xfc49=function(_0x25a3ca,_0x5df664){_0x25a3ca=_0x25a3ca-0x0;var _0xe12513=_0xc49f[_0x25a3ca];return _0xe12513;};'use strict';var util=require(_0xfc49('0x0'));var logger=require(_0xfc49('0x1'))(_0xfc49('0x2'));var BPromise=require(_0xfc49('0x3'));var exec=require(_0xfc49('0x4'))[_0xfc49('0x5')];exports[_0xfc49('0x6')]=function(_0x11dacf){return new BPromise(function(_0x8700fe,_0x55bb53){exec(_0x11dacf,function(_0x3e87c6,_0x56002e,_0xc727c2){logger[_0xfc49('0x7')](_0xfc49('0x8'),_0x56002e);if(_0x3e87c6){logger['info'](_0xfc49('0x8'),_0xfc49('0x9'),util[_0xfc49('0xa')](_0x3e87c6,{'showHidden':![],'depth':null}),_0x56002e,_0xc727c2);_0x55bb53(_0x3e87c6);}_0x8700fe(_0x56002e);});});}; \ No newline at end of file +var _0x3c3f=['util','../../../../config/logger','fax','bluebird','exec','\x20Error\x20:','inspect'];(function(_0x450b2a,_0x174591){var _0x37a7ff=function(_0x259a26){while(--_0x259a26){_0x450b2a['push'](_0x450b2a['shift']());}};_0x37a7ff(++_0x174591);}(_0x3c3f,0x7e));var _0xf3c3=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0x3c3f[_0x4e2272];return _0x45511c;};'use strict';var util=require(_0xf3c3('0x0'));var logger=require(_0xf3c3('0x1'))(_0xf3c3('0x2'));var BPromise=require(_0xf3c3('0x3'));var exec=require('child_process')[_0xf3c3('0x4')];exports['execute']=function(_0x33445d){return new BPromise(function(_0x3cba37,_0x38604f){exec(_0x33445d,function(_0x36afe7,_0x524cdf,_0x565534){logger['info']('Exec\x20gs',_0x524cdf);if(_0x36afe7){logger['info']('Exec\x20gs',_0xf3c3('0x5'),util[_0xf3c3('0x6')](_0x36afe7,{'showHidden':![],'depth':null}),_0x524cdf,_0x565534);_0x38604f(_0x36afe7);}_0x3cba37(_0x524cdf);});});}; \ 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 a470058..c01e9ee 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 _0x2abc=['inspect','addVariables','ecm','maxrate','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','util','lodash','../../../../config/logger','logger'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x2abc,0xc2));var _0xc2ab=function(_0x579387,_0x45c7ce){_0x579387=_0x579387-0x0;var _0x5517b4=_0x2abc[_0x579387];return _0x5517b4;};'use strict';var util=require(_0xc2ab('0x0'));var _=require(_0xc2ab('0x1'));var moment=require('moment');var logger=require(_0xc2ab('0x2'))('fax');exports['message']=function(_0x463b45){return{'message':_0x463b45};};exports[_0xc2ab('0x3')]=function(_0x1e85da,_0x20e67c){logger['info'](_0x1e85da,util[_0xc2ab('0x4')](_0x20e67c,{'showHidden':![],'depth':null}));};exports[_0xc2ab('0x5')]=function(_0xef0c23,_0x47a493){var _0x3192bd={'XMF-ECM':_0x47a493[_0xc2ab('0x6')],'XMF-HEADERINFO':_0x47a493['headerinfo'],'XMF-MINRATE':_0x47a493['minrate'],'XMF-MAXRATE':_0x47a493[_0xc2ab('0x7')],'XMF-MODEM':util['format']('\x22%s\x22',_0x47a493[_0xc2ab('0x8')]),'XMF-GATEWAY':_0x47a493['gateway'],'XMF-FAXDETECT':_0x47a493[_0xc2ab('0x9')],'XMF-T38TIMEOUT':_0x47a493[_0xc2ab('0xa')],'XMF-LOCALSTATIONID':_0x47a493[_0xc2ab('0xb')],'XMF-PATH':_0xef0c23[_0xc2ab('0xc')]};return _0x3192bd;};exports[_0xc2ab('0xd')]=function(_0x144de5,_0x4550d9){return{'actionid':_0x144de5[_0xc2ab('0xe')],'action':_0xc2ab('0xf'),'channel':_0x144de5[_0xc2ab('0x10')],'Exten':_0xc2ab('0x11'),'Context':_0xc2ab('0x12'),'Priority':'1','callerid':util[_0xc2ab('0x13')](_0xc2ab('0x14'),_0x144de5[_0xc2ab('0x15')]?_0x144de5[_0xc2ab('0x15')]:'',_0x144de5[_0xc2ab('0xb')]),'variable':_0x4550d9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x144de5['uniqueid']};}; \ No newline at end of file +var _0x95fa=['message','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','fax'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x95fa,0xda));var _0xa95f=function(_0x439518,_0x473f89){_0x439518=_0x439518-0x0;var _0x446a47=_0x95fa[_0x439518];return _0x446a47;};'use strict';var util=require(_0xa95f('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xa95f('0x1'));exports[_0xa95f('0x2')]=function(_0x424d1a){return{'message':_0x424d1a};};exports['logger']=function(_0x332c99,_0x4f31a6){logger['info'](_0x332c99,util[_0xa95f('0x3')](_0x4f31a6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2e390f,_0x2022d0){var _0x1b4ee1={'XMF-ECM':_0x2022d0[_0xa95f('0x4')],'XMF-HEADERINFO':_0x2022d0[_0xa95f('0x5')],'XMF-MINRATE':_0x2022d0[_0xa95f('0x6')],'XMF-MAXRATE':_0x2022d0[_0xa95f('0x7')],'XMF-MODEM':util[_0xa95f('0x8')](_0xa95f('0x9'),_0x2022d0[_0xa95f('0xa')]),'XMF-GATEWAY':_0x2022d0[_0xa95f('0xb')],'XMF-FAXDETECT':_0x2022d0['faxdetect'],'XMF-T38TIMEOUT':_0x2022d0[_0xa95f('0xc')],'XMF-LOCALSTATIONID':_0x2022d0[_0xa95f('0xd')],'XMF-PATH':_0x2e390f[_0xa95f('0xe')]};return _0x1b4ee1;};exports[_0xa95f('0xf')]=function(_0x39f0fa,_0x2c197c){return{'actionid':_0x39f0fa[_0xa95f('0x10')],'action':_0xa95f('0x11'),'channel':_0x39f0fa[_0xa95f('0x12')],'Exten':_0xa95f('0x13'),'Context':_0xa95f('0x14'),'Priority':'1','callerid':util['format'](_0xa95f('0x15'),_0x39f0fa[_0xa95f('0x5')]?_0x39f0fa[_0xa95f('0x5')]:'',_0x39f0fa['localstationid']),'variable':_0x2c197c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x39f0fa['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9320a91..425bb63 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 _0x02f0=['getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','listen','error','[index.js][main]','inspect','util','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory'];(function(_0x5da2c5,_0x6306e){var _0x2c0749=function(_0x5cf155){while(--_0x5cf155){_0x5da2c5['push'](_0x5da2c5['shift']());}};_0x2c0749(++_0x6306e);}(_0x02f0,0x1de));var _0x002f=function(_0x467f45,_0x7eb058){_0x467f45=_0x467f45-0x0;var _0x56e5a6=_0x02f0[_0x467f45];return _0x56e5a6;};'use strict';var util=require(_0x002f('0x0'));var moment=require('moment');var server=require(_0x002f('0x1'));var Realtime=require(_0x002f('0x2'));var Report=require(_0x002f('0x3'));var Acw=require('./acw');var Trigger=require(_0x002f('0x4'));var Dialer=require(_0x002f('0x5'));var Preview=require(_0x002f('0x6'));var Fax=require(_0x002f('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x002f('0x8'));var voiceQueueReport=require(_0x002f('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x002f('0xa'));var trigger=require(_0x002f('0xb'));var template=require(_0x002f('0xc'));var cmHopperHistory=require(_0x002f('0xd'));var campaign=require(_0x002f('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x002f('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x002f('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x002f('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x002f('0x12'));var freshsales=require(_0x002f('0x13'));var servicenow=require(_0x002f('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x002f('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x002f('0x16')](_0x002f('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x002f('0x18')]()[_0x002f('0x19')](user[_0x002f('0x1a')]())[_0x002f('0x19')](realtime['initAgents']())[_0x002f('0x19')](user[_0x002f('0x1b')]())[_0x002f('0x19')](realtime[_0x002f('0x1c')]())['then'](trunk[_0x002f('0x1d')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x002f('0x1e')]())[_0x002f('0x19')](realtime[_0x002f('0x1f')]())[_0x002f('0x19')](trigger[_0x002f('0x20')]())[_0x002f('0x19')](realtime[_0x002f('0x21')]())['then'](template[_0x002f('0x22')]())[_0x002f('0x19')](realtime[_0x002f('0x23')]())[_0x002f('0x19')](zendesk[_0x002f('0x24')]())[_0x002f('0x19')](realtime[_0x002f('0x25')]())[_0x002f('0x19')](salesforce[_0x002f('0x26')]())[_0x002f('0x19')](realtime[_0x002f('0x27')]())[_0x002f('0x19')](sugarcrm[_0x002f('0x28')]())[_0x002f('0x19')](realtime['initSugarcrmAccounts']())[_0x002f('0x19')](freshdesk[_0x002f('0x29')]())[_0x002f('0x19')](realtime[_0x002f('0x2a')]())[_0x002f('0x19')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x002f('0x19')](zoho[_0x002f('0x2b')]())[_0x002f('0x19')](realtime[_0x002f('0x2c')]())[_0x002f('0x19')](vtiger[_0x002f('0x2d')]())[_0x002f('0x19')](realtime[_0x002f('0x2e')]())[_0x002f('0x19')](freshsales[_0x002f('0x2f')]())['then'](realtime['initFreshsalesAccounts']())[_0x002f('0x19')](servicenow[_0x002f('0x30')]())[_0x002f('0x19')](realtime[_0x002f('0x31')]())[_0x002f('0x19')](dynamics365[_0x002f('0x32')]())['then'](realtime[_0x002f('0x33')]())[_0x002f('0x19')](campaign[_0x002f('0x34')]())[_0x002f('0x19')](realtime[_0x002f('0x35')]())['then'](voiceExtension[_0x002f('0x36')]())[_0x002f('0x19')](realtime['initVoiceExtensions']())[_0x002f('0x19')](faxAccount[_0x002f('0x37')]())[_0x002f('0x19')](realtime[_0x002f('0x38')]())[_0x002f('0x19')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x002f('0x19')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x002f('0x39')]())[_0x002f('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x002f('0x19')](cmHopperHistory[_0x002f('0x3a')]())[_0x002f('0x19')](realtime[_0x002f('0x3b')]())[_0x002f('0x19')](voiceCallReport[_0x002f('0x3c')]())['then'](realtime['initVoiceCallReports']())[_0x002f('0x3d')](function(_0x219bb8){logger['error'](_0x002f('0x3e'),util['inspect'](_0x219bb8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x002f('0x3f')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x002f('0x19')](function(){return initParams();})[_0x002f('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x002f('0x3d')](function(_0x17bdf9){logger[_0x002f('0x40')](_0x002f('0x41'),util[_0x002f('0x42')](_0x17bdf9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x48ee=['initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x5f3cf8,_0x415429){var _0xa43c9b=function(_0x2c135e){while(--_0x2c135e){_0x5f3cf8['push'](_0x5f3cf8['shift']());}};_0xa43c9b(++_0x415429);}(_0x48ee,0x9a));var _0xe48e=function(_0x4609dc,_0x233a96){_0x4609dc=_0x4609dc-0x0;var _0x112df7=_0x48ee[_0x4609dc];return _0x112df7;};'use strict';var util=require('util');var moment=require(_0xe48e('0x0'));var server=require(_0xe48e('0x1'));var Realtime=require(_0xe48e('0x2'));var Report=require(_0xe48e('0x3'));var Acw=require(_0xe48e('0x4'));var Trigger=require(_0xe48e('0x5'));var Dialer=require(_0xe48e('0x6'));var Preview=require(_0xe48e('0x7'));var Fax=require(_0xe48e('0x8'));var user=require(_0xe48e('0x9'));var voiceQueue=require(_0xe48e('0xa'));var voiceQueueReport=require(_0xe48e('0xb'));var voiceCallReport=require(_0xe48e('0xc'));var trunk=require(_0xe48e('0xd'));var trigger=require(_0xe48e('0xe'));var template=require(_0xe48e('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe48e('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe48e('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xe48e('0x12'));var desk=require(_0xe48e('0x13'));var zoho=require(_0xe48e('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe48e('0x15'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe48e('0x16'))(_0xe48e('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe48e('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe48e('0x18')](_0xe48e('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xe48e('0x1a')](user['getAgents']())[_0xe48e('0x1a')](realtime['initAgents']())[_0xe48e('0x1a')](user['getTelephones']())['then'](realtime[_0xe48e('0x1b')]())['then'](trunk[_0xe48e('0x1c')]())[_0xe48e('0x1a')](realtime['initTrunks']())[_0xe48e('0x1a')](voiceQueue[_0xe48e('0x1d')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x1e')]())[_0xe48e('0x1a')](trigger[_0xe48e('0x1f')]())[_0xe48e('0x1a')](realtime['initTriggers']())[_0xe48e('0x1a')](template[_0xe48e('0x20')]())[_0xe48e('0x1a')](realtime['initTemplates']())[_0xe48e('0x1a')](zendesk[_0xe48e('0x21')]())['then'](realtime[_0xe48e('0x22')]())['then'](salesforce['getSalesforceAccounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x23')]())[_0xe48e('0x1a')](sugarcrm[_0xe48e('0x24')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x25')]())['then'](freshdesk[_0xe48e('0x26')]())['then'](realtime[_0xe48e('0x27')]())['then'](desk[_0xe48e('0x28')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x29')]())[_0xe48e('0x1a')](zoho['getZohoAccounts']())[_0xe48e('0x1a')](realtime['initZohoAccounts']())[_0xe48e('0x1a')](vtiger[_0xe48e('0x2a')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x2b')]())[_0xe48e('0x1a')](freshsales['getFreshsalesAccounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x2c')]())[_0xe48e('0x1a')](servicenow[_0xe48e('0x2d')]())['then'](realtime[_0xe48e('0x2e')]())[_0xe48e('0x1a')](dynamics365['getDynamics365Accounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x2f')]())[_0xe48e('0x1a')](campaign[_0xe48e('0x30')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x31')]())['then'](voiceExtension['getVoiceExtensions']())[_0xe48e('0x1a')](realtime[_0xe48e('0x32')]())[_0xe48e('0x1a')](faxAccount[_0xe48e('0x33')]())[_0xe48e('0x1a')](realtime['initFaxAccounts']())[_0xe48e('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0xe48e('0x34')]()[_0xe48e('0x1a')](voiceQueueReport[_0xe48e('0x35')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x36')]())[_0xe48e('0x1a')](cmHopperHistory[_0xe48e('0x37')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x38')]())[_0xe48e('0x1a')](cmHopperHistory[_0xe48e('0x39')]())['then'](realtime[_0xe48e('0x3a')]())[_0xe48e('0x1a')](voiceCallReport[_0xe48e('0x3b')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x3c')]())[_0xe48e('0x3d')](function(_0x4bd994){logger[_0xe48e('0x3e')]('[index.js][initParams]',util[_0xe48e('0x3f')](_0x4bd994,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe48e('0x40')](realtime,preview,fax)[_0xe48e('0x1a')](function(){return initRealtime();})[_0xe48e('0x1a')](function(){return initParams();})[_0xe48e('0x1a')](function(){report[_0xe48e('0x41')]();setInterval(initRealtime,0x1388);})[_0xe48e('0x3d')](function(_0x4fe8bf){logger[_0xe48e('0x3e')](_0xe48e('0x42'),util[_0xe48e('0x3f')](_0x4fe8bf,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index f1d7379..7d6de6d 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 _0x5ae4=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','toLowerCase','not_inuse','idle','inuse','talking','toNumber','stateTime','address','format','user:%s','user:ami:update','omit','emit','user:presence','exports','util','moment','md5','../../../config/environment','redis','defaults'];(function(_0x4a2d48,_0x4c8529){var _0x5b30f3=function(_0x4ef8ad){while(--_0x4ef8ad){_0x4a2d48['push'](_0x4a2d48['shift']());}};_0x5b30f3(++_0x4c8529);}(_0x5ae4,0x72));var _0x45ae=function(_0x3cfe5a,_0x1466f3){_0x3cfe5a=_0x3cfe5a-0x0;var _0x2e0b64=_0x5ae4[_0x3cfe5a];return _0x2e0b64;};'use strict';var _=require('lodash');var util=require(_0x45ae('0x0'));var moment=require(_0x45ae('0x1'));var md5=require(_0x45ae('0x2'));var Redis=require('ioredis');var config=require(_0x45ae('0x3'));config[_0x45ae('0x4')]=_[_0x45ae('0x5')](config[_0x45ae('0x4')],{'host':_0x45ae('0x6'),'port':0x18eb});var io=require(_0x45ae('0x7'))(new Redis(config['redis']));function Agent(_0x528a76){this['id']=_0x528a76['id']||0x0;this[_0x45ae('0x8')]=_0x528a76['name']||'';this[_0x45ae('0x9')]=_0x528a76[_0x45ae('0x9')]||'';this[_0x45ae('0xa')]=_0x528a76[_0x45ae('0xa')]||'';this[_0x45ae('0xb')]=_0x528a76[_0x45ae('0xb')]||'';this[_0x45ae('0xc')]='unknown';this['stateTime']=0x0;this[_0x45ae('0xd')]=_0x45ae('0xe');this['address']='';this[_0x45ae('0xf')]='';this[_0x45ae('0x10')]='';this[_0x45ae('0x11')]='';this['online']=_0x528a76[_0x45ae('0x12')]||![];this[_0x45ae('0x13')]=_0x45ae('0xe');this[_0x45ae('0x14')]=0x0;this[_0x45ae('0x15')]='';this[_0x45ae('0x16')]='';this[_0x45ae('0x17')]=![];this['local']=![];this[_0x45ae('0x2')]='';}Agent[_0x45ae('0x18')]['updateStatusRealtime']=function(_0xf98e81){var _0x1ffbc9;if(_0xf98e81&&_0xf98e81['state']){_0x1ffbc9=_0xf98e81['state'][_0x45ae('0x19')]();switch(_0x1ffbc9){case _0x45ae('0x1a'):_0x1ffbc9=_0x45ae('0x1b');break;case _0x45ae('0x1c'):_0x1ffbc9=_0x45ae('0x1d');break;}}if(_0x1ffbc9&&this['voiceStatus']!==_0x1ffbc9||_0xf98e81['statePause']){this[_0x45ae('0x14')]=_[_0x45ae('0x1e')](moment()['format']('x'));}if(_0x1ffbc9){this[_0x45ae('0x13')]=_0x1ffbc9;}var _0xef7e91={'id':this['id'],'name':this[_0x45ae('0x8')],'email':this[_0x45ae('0x9')],'accountcode':this[_0x45ae('0xa')],'fullname':this[_0x45ae('0xb')],'state':this['state'],'stateTime':this[_0x45ae('0x1f')],'status':this['status'],'address':this[_0x45ae('0x20')],'online':this['online'],'voiceStatus':this[_0x45ae('0x13')],'voiceStatusTime':this[_0x45ae('0x14')],'voiceStatusCallerIdNumber':this[_0x45ae('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x45ae('0x17')]};var _0x535d69=md5(JSON['stringify'](_0xef7e91));if(this['md5']!==_0x535d69){this[_0x45ae('0x2')]=_0x535d69;io['to'](util[_0x45ae('0x21')](_0x45ae('0x22'),_0xef7e91[_0x45ae('0x8')]))['emit'](_0x45ae('0x23'),_[_0x45ae('0x24')](_0xef7e91,[_0x45ae('0x12')]));io[_0x45ae('0x25')](_0x45ae('0x26'),_0xef7e91);}};module[_0x45ae('0x27')]=Agent; \ No newline at end of file +var _0x973b=['fullname','unknown','stateTime','status','mobile','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','address','online','user:ami:update','omit','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x400955,_0xd0898a){var _0x2466af=function(_0x5f3b99){while(--_0x5f3b99){_0x400955['push'](_0x400955['shift']());}};_0x2466af(++_0xd0898a);}(_0x973b,0x6e));var _0xb973=function(_0x2cbbad,_0x1cfe1d){_0x2cbbad=_0x2cbbad-0x0;var _0x49aae6=_0x973b[_0x2cbbad];return _0x49aae6;};'use strict';var _=require(_0xb973('0x0'));var util=require(_0xb973('0x1'));var moment=require(_0xb973('0x2'));var md5=require(_0xb973('0x3'));var Redis=require(_0xb973('0x4'));var config=require(_0xb973('0x5'));config[_0xb973('0x6')]=_[_0xb973('0x7')](config[_0xb973('0x6')],{'host':_0xb973('0x8'),'port':0x18eb});var io=require(_0xb973('0x9'))(new Redis(config['redis']));function Agent(_0xa48248){this['id']=_0xa48248['id']||0x0;this[_0xb973('0xa')]=_0xa48248['name']||'';this[_0xb973('0xb')]=_0xa48248['email']||'';this['accountcode']=_0xa48248[_0xb973('0xc')]||'';this[_0xb973('0xd')]=_0xa48248['fullname']||'';this['state']=_0xb973('0xe');this[_0xb973('0xf')]=0x0;this[_0xb973('0x10')]=_0xb973('0xe');this['address']='';this['phone']='';this[_0xb973('0x11')]='';this[_0xb973('0x12')]='';this['online']=_0xa48248['online']||![];this[_0xb973('0x13')]=_0xb973('0xe');this[_0xb973('0x14')]=0x0;this[_0xb973('0x15')]='';this[_0xb973('0x16')]='';this[_0xb973('0x17')]=![];this[_0xb973('0x18')]=![];this[_0xb973('0x3')]='';}Agent['prototype'][_0xb973('0x19')]=function(_0x5721b5){var _0x89fab6;if(_0x5721b5&&_0x5721b5[_0xb973('0x1a')]){_0x89fab6=_0x5721b5[_0xb973('0x1a')][_0xb973('0x1b')]();switch(_0x89fab6){case _0xb973('0x1c'):_0x89fab6=_0xb973('0x1d');break;case _0xb973('0x1e'):_0x89fab6=_0xb973('0x1f');break;}}if(_0x89fab6&&this[_0xb973('0x13')]!==_0x89fab6||_0x5721b5[_0xb973('0x20')]){this[_0xb973('0x14')]=_[_0xb973('0x21')](moment()[_0xb973('0x22')]('x'));}if(_0x89fab6){this[_0xb973('0x13')]=_0x89fab6;}var _0x119d55={'id':this['id'],'name':this['name'],'email':this[_0xb973('0xb')],'accountcode':this['accountcode'],'fullname':this[_0xb973('0xd')],'state':this[_0xb973('0x1a')],'stateTime':this['stateTime'],'status':this[_0xb973('0x10')],'address':this[_0xb973('0x23')],'online':this[_0xb973('0x24')],'voiceStatus':this[_0xb973('0x13')],'voiceStatusTime':this[_0xb973('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xb973('0x16')],'interface':this[_0xb973('0x12')],'onhold':this[_0xb973('0x17')]};var _0x51ab30=md5(JSON['stringify'](_0x119d55));if(this[_0xb973('0x3')]!==_0x51ab30){this['md5']=_0x51ab30;io['to'](util[_0xb973('0x22')]('user:%s',_0x119d55[_0xb973('0xa')]))['emit'](_0xb973('0x25'),_[_0xb973('0x26')](_0x119d55,[_0xb973('0x24')]));io[_0xb973('0x27')]('user:presence',_0x119d55);}};module[_0xb973('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 673d276..2967a0e 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 _0x4da8=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x4126b3,_0x2f64c8){var _0x378ac0=function(_0x4431c9){while(--_0x4431c9){_0x4126b3['push'](_0x4126b3['shift']());}};_0x378ac0(++_0x2f64c8);}(_0x4da8,0x18b));var _0x84da=function(_0x49a399,_0x3aea91){_0x49a399=_0x49a399-0x0;var _0x668ad4=_0x4da8[_0x49a399];return _0x668ad4;};'use strict';function Campaign(_0x261426){this['id']=_0x261426['id']||0x0;this[_0x84da('0x0')]=_0x261426['name']||'';this['type']=_0x261426[_0x84da('0x1')]||_0x84da('0x2');this[_0x84da('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x84da('0x4')]=0x0;this['message']='';this[_0x84da('0x5')]=!![];this[_0x84da('0x6')]=_0x261426[_0x84da('0x6')];this[_0x84da('0x7')]=_0x261426['limitCalls'];this['dialTimezone']=_0x261426[_0x84da('0x8')]||null;this['dialGlobalInterval']=_0x261426['dialGlobalInterval']?_0x261426['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x261426[_0x84da('0x9')];this['dialOriginateCallerIdNumber']=_0x261426['dialOriginateCallerIdNumber'];this[_0x84da('0xa')]=_0x261426[_0x84da('0xa')]||0x1e;this[_0x84da('0xb')]=_0x261426['dialCongestionMaxRetry'];this[_0x84da('0xc')]=_0x261426[_0x84da('0xc')];this[_0x84da('0xd')]=_0x261426[_0x84da('0xd')];this[_0x84da('0xe')]=_0x261426[_0x84da('0xe')];this[_0x84da('0xf')]=_0x261426[_0x84da('0xf')];this[_0x84da('0x10')]=_0x261426[_0x84da('0x10')];this[_0x84da('0x11')]=_0x261426[_0x84da('0x11')];this['dialNoSuchNumberMaxRetry']=_0x261426[_0x84da('0x12')]||0x3;this[_0x84da('0x13')]=_0x261426[_0x84da('0x13')]||0x96;this['dialDropMaxRetry']=_0x261426[_0x84da('0x14')]||0x3;this['dialDropRetryFrequency']=_0x261426[_0x84da('0x15')]||0x96;this[_0x84da('0x16')]=_0x261426[_0x84da('0x16')]||0x3;this[_0x84da('0x17')]=_0x261426[_0x84da('0x17')]||0x96;this['dialMachineMaxRetry']=_0x261426[_0x84da('0x18')]||0x3;this[_0x84da('0x19')]=_0x261426[_0x84da('0x19')]||0x96;this[_0x84da('0x1a')]=_0x261426[_0x84da('0x1a')]||0x3;this[_0x84da('0x1b')]=_0x261426['dialAgentRejectRetryFrequency']||0x96;this[_0x84da('0x1c')]=_0x261426[_0x84da('0x1c')]||_0x84da('0x1d');this[_0x84da('0x1e')]=_0x261426['dialPrefix']||undefined;this[_0x84da('0x1f')]=_0x261426[_0x84da('0x1f')]||undefined;this['dialCutDigit']=_0x261426[_0x84da('0x20')]||undefined;this['TrunkBackup']=_0x261426[_0x84da('0x21')]?_0x261426['TrunkBackup']:undefined;this[_0x84da('0x22')]=_0x261426[_0x84da('0x22')]?_0x261426[_0x84da('0x22')]:undefined;this['Interval']=_0x261426['Interval']?_0x261426['Interval']:undefined;this[_0x84da('0x23')]=_0x261426[_0x84da('0x23')]?_0x261426['SquareProject']:undefined;this[_0x84da('0x24')]=_0x261426[_0x84da('0x23')]?_0x261426[_0x84da('0x23')][_0x84da('0x0')]:undefined;this['dialAMDActive']=_0x261426[_0x84da('0x25')]||![];this['dialAMDInitialSilence']=_0x261426['dialAMDInitialSilence'];this[_0x84da('0x26')]=_0x261426[_0x84da('0x26')];this['dialAMDAfterGreetingSilence']=_0x261426['dialAMDAfterGreetingSilence'];this[_0x84da('0x27')]=_0x261426['dialAMDTotalAnalysisTime'];this[_0x84da('0x28')]=_0x261426['dialAMDMinWordLength'];this[_0x84da('0x29')]=_0x261426[_0x84da('0x29')];this[_0x84da('0x2a')]=_0x261426[_0x84da('0x2a')];this[_0x84da('0x2b')]=_0x261426[_0x84da('0x2b')];this[_0x84da('0x2c')]=_0x261426[_0x84da('0x2c')];}module[_0x84da('0x2d')]=Campaign; \ No newline at end of file +var _0xce02=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x47289f,_0x342476){var _0x3923c8=function(_0x346cbe){while(--_0x346cbe){_0x47289f['push'](_0x47289f['shift']());}};_0x3923c8(++_0x342476);}(_0xce02,0x161));var _0x2ce0=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xce02[_0x3f0b30];return _0x2748a5;};'use strict';function Campaign(_0x405cc6){this['id']=_0x405cc6['id']||0x0;this['name']=_0x405cc6['name']||'';this[_0x2ce0('0x0')]=_0x405cc6[_0x2ce0('0x0')]||_0x2ce0('0x1');this[_0x2ce0('0x2')]=0x0;this['temp']=0x0;this[_0x2ce0('0x3')]=0x0;this[_0x2ce0('0x4')]=0x0;this[_0x2ce0('0x5')]='';this[_0x2ce0('0x6')]=!![];this[_0x2ce0('0x7')]=_0x405cc6[_0x2ce0('0x7')];this[_0x2ce0('0x8')]=_0x405cc6[_0x2ce0('0x8')];this['dialTimezone']=_0x405cc6[_0x2ce0('0x9')]||null;this[_0x2ce0('0xa')]=_0x405cc6['dialGlobalInterval']?_0x405cc6[_0x2ce0('0xa')]:null;this[_0x2ce0('0xb')]=_0x405cc6[_0x2ce0('0xb')];this[_0x2ce0('0xc')]=_0x405cc6[_0x2ce0('0xc')];this[_0x2ce0('0xd')]=_0x405cc6['dialOriginateTimeout']||0x1e;this[_0x2ce0('0xe')]=_0x405cc6[_0x2ce0('0xe')];this['dialCongestionRetryFrequency']=_0x405cc6[_0x2ce0('0xf')];this[_0x2ce0('0x10')]=_0x405cc6['dialBusyMaxRetry'];this[_0x2ce0('0x11')]=_0x405cc6[_0x2ce0('0x11')];this[_0x2ce0('0x12')]=_0x405cc6[_0x2ce0('0x12')];this[_0x2ce0('0x13')]=_0x405cc6[_0x2ce0('0x13')];this['dialGlobalMaxRetry']=_0x405cc6[_0x2ce0('0x14')];this[_0x2ce0('0x15')]=_0x405cc6[_0x2ce0('0x15')]||0x3;this[_0x2ce0('0x16')]=_0x405cc6[_0x2ce0('0x16')]||0x96;this[_0x2ce0('0x17')]=_0x405cc6[_0x2ce0('0x17')]||0x3;this[_0x2ce0('0x18')]=_0x405cc6[_0x2ce0('0x18')]||0x96;this[_0x2ce0('0x19')]=_0x405cc6['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x405cc6['dialAbandonedRetryFrequency']||0x96;this[_0x2ce0('0x1a')]=_0x405cc6[_0x2ce0('0x1a')]||0x3;this[_0x2ce0('0x1b')]=_0x405cc6['dialMachineRetryFrequency']||0x96;this[_0x2ce0('0x1c')]=_0x405cc6[_0x2ce0('0x1c')]||0x3;this[_0x2ce0('0x1d')]=_0x405cc6[_0x2ce0('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x405cc6[_0x2ce0('0x1e')]||_0x2ce0('0x1f');this['dialPrefix']=_0x405cc6[_0x2ce0('0x20')]||undefined;this[_0x2ce0('0x21')]=_0x405cc6['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2ce0('0x22')]=_0x405cc6[_0x2ce0('0x22')]||undefined;this[_0x2ce0('0x23')]=_0x405cc6[_0x2ce0('0x23')]?_0x405cc6['TrunkBackup']:undefined;this[_0x2ce0('0x24')]=_0x405cc6[_0x2ce0('0x24')]?_0x405cc6[_0x2ce0('0x24')]:undefined;this[_0x2ce0('0x25')]=_0x405cc6[_0x2ce0('0x25')]?_0x405cc6[_0x2ce0('0x25')]:undefined;this['SquareProject']=_0x405cc6[_0x2ce0('0x26')]?_0x405cc6[_0x2ce0('0x26')]:undefined;this[_0x2ce0('0x27')]=_0x405cc6[_0x2ce0('0x26')]?_0x405cc6[_0x2ce0('0x26')][_0x2ce0('0x28')]:undefined;this[_0x2ce0('0x29')]=_0x405cc6['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x405cc6['dialAMDInitialSilence'];this[_0x2ce0('0x2a')]=_0x405cc6['dialAMDGreeting'];this[_0x2ce0('0x2b')]=_0x405cc6[_0x2ce0('0x2b')];this['dialAMDTotalAnalysisTime']=_0x405cc6[_0x2ce0('0x2c')];this['dialAMDMinWordLength']=_0x405cc6['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x405cc6[_0x2ce0('0x2d')];this[_0x2ce0('0x2e')]=_0x405cc6[_0x2ce0('0x2e')];this[_0x2ce0('0x2f')]=_0x405cc6['dialAMDSilenceThreshold'];this[_0x2ce0('0x30')]=_0x405cc6[_0x2ce0('0x30')];}module[_0x2ce0('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6c7c923..eb47aad 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 _0x110e=['lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','answered','endtime','unmanaged','abandoned'];(function(_0x17a3b7,_0x44450e){var _0x121d4b=function(_0x1257e0){while(--_0x1257e0){_0x17a3b7['push'](_0x17a3b7['shift']());}};_0x121d4b(++_0x44450e);}(_0x110e,0x68));var _0xe110=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x110e[_0x57b54c];return _0x59cc19;};'use strict';function Channel(){this[_0xe110('0x0')]=null;this[_0xe110('0x1')]='';this['destinationchannel']='';this[_0xe110('0x2')]=0x0;this[_0xe110('0x3')]='';this[_0xe110('0x4')]=undefined;this[_0xe110('0x5')]=undefined;this[_0xe110('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xe110('0x7')]=![];this['answertime']=null;this[_0xe110('0x8')]=null;this[_0xe110('0x9')]=![];this[_0xe110('0xa')]=![];this[_0xe110('0xb')]='';this[_0xe110('0xc')]='';this[_0xe110('0xd')]=0x0;this[_0xe110('0xe')]=0x0;this[_0xe110('0xf')]=0x0;this[_0xe110('0x10')]=null;this['tag']=null;this[_0xe110('0x11')]=null;this[_0xe110('0x12')]=![];this['monitorFilename']=null;this[_0xe110('0x13')]=null;this[_0xe110('0x14')]=[];this[_0xe110('0x15')]=undefined;this[_0xe110('0x16')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x8ff9=['disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','type','tag'];(function(_0x106200,_0x3e5b7a){var _0xa9ba85=function(_0x362c7b){while(--_0x362c7b){_0x106200['push'](_0x106200['shift']());}};_0xa9ba85(++_0x3e5b7a);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x1b72d1,_0x5581c6){_0x1b72d1=_0x1b72d1-0x0;var _0x14b098=_0x8ff9[_0x1b72d1];return _0x14b098;};'use strict';function Channel(){this[_0x98ff('0x0')]=null;this[_0x98ff('0x1')]='';this[_0x98ff('0x2')]='';this[_0x98ff('0x3')]=0x0;this[_0x98ff('0x4')]='';this[_0x98ff('0x5')]=undefined;this[_0x98ff('0x6')]=undefined;this[_0x98ff('0x7')]=0x0;this[_0x98ff('0x8')]='';this[_0x98ff('0x9')]=0x0;this[_0x98ff('0xa')]=0x0;this['exten']=0x0;this[_0x98ff('0xb')]=![];this[_0x98ff('0xc')]=null;this[_0x98ff('0xd')]=null;this[_0x98ff('0xe')]=![];this[_0x98ff('0xf')]=![];this[_0x98ff('0x10')]='';this['lastdata']='';this[_0x98ff('0x11')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x98ff('0x12')]=null;this[_0x98ff('0x13')]=null;this[_0x98ff('0x14')]=null;this[_0x98ff('0x15')]=![];this[_0x98ff('0x16')]=null;this['queue']=null;this[_0x98ff('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x98ff('0x18')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x98ff('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 13998c7..4f06bb9 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 _0xc7fa=['authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4508ea,_0x5aad3c){var _0x29912f=function(_0x3b7f3a){while(--_0x3b7f3a){_0x4508ea['push'](_0x4508ea['shift']());}};_0x29912f(++_0x5aad3c);}(_0xc7fa,0x135));var _0xac7f=function(_0x189cbc,_0x20b722){_0x189cbc=_0x189cbc-0x0;var _0x5ad834=_0xc7fa[_0x189cbc];return _0x5ad834;};'use strict';function DeskAccount(_0x443fad){this['id']=_0x443fad['id']||0x0;this[_0xac7f('0x0')]=_0x443fad['name']||'';this[_0xac7f('0x1')]=_0x443fad[_0xac7f('0x1')]||'';this['remoteUri']=_0x443fad[_0xac7f('0x2')]||'';this[_0xac7f('0x3')]=_0x443fad[_0xac7f('0x3')]||'';this[_0xac7f('0x4')]=_0x443fad[_0xac7f('0x4')]||'';this['consumerKey']=_0x443fad['consumerKey']||'';this[_0xac7f('0x5')]=_0x443fad[_0xac7f('0x5')]||'';this['token']=_0x443fad[_0xac7f('0x6')]||'';this[_0xac7f('0x7')]=_0x443fad['tokenSecret']||'';this[_0xac7f('0x8')]=_0x443fad[_0xac7f('0x8')]||'';this[_0xac7f('0x9')]=_0x443fad[_0xac7f('0x9')]||'';this[_0xac7f('0xa')]=_0x443fad[_0xac7f('0xa')]||{};}module[_0xac7f('0xb')]=DeskAccount; \ No newline at end of file +var _0xda6d=['name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xda6d,0x1b0));var _0xdda6=function(_0x2c388a,_0x3f4e18){_0x2c388a=_0x2c388a-0x0;var _0x47a4a2=_0xda6d[_0x2c388a];return _0x47a4a2;};'use strict';function DeskAccount(_0x265c7e){this['id']=_0x265c7e['id']||0x0;this['name']=_0x265c7e[_0xdda6('0x0')]||'';this['username']=_0x265c7e['username']||'';this[_0xdda6('0x1')]=_0x265c7e[_0xdda6('0x1')]||'';this[_0xdda6('0x2')]=_0x265c7e['authType']||'';this['password']=_0x265c7e[_0xdda6('0x3')]||'';this['consumerKey']=_0x265c7e[_0xdda6('0x4')]||'';this[_0xdda6('0x5')]=_0x265c7e[_0xdda6('0x5')]||'';this[_0xdda6('0x6')]=_0x265c7e[_0xdda6('0x6')]||'';this[_0xdda6('0x7')]=_0x265c7e[_0xdda6('0x7')]||'';this[_0xdda6('0x8')]=_0x265c7e[_0xdda6('0x8')]||'';this[_0xdda6('0x9')]=_0x265c7e['serverUrl']||'';this['Configurations']=_0x265c7e[_0xdda6('0xa')]||{};}module[_0xdda6('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 236f8f4..d971521 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 _0x9320=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x28ed56,_0x285010){var _0x5c975d=function(_0x4b89cc){while(--_0x4b89cc){_0x28ed56['push'](_0x28ed56['shift']());}};_0x5c975d(++_0x285010);}(_0x9320,0x10f));var _0x0932=function(_0x47918b,_0x409a33){_0x47918b=_0x47918b-0x0;var _0x49c60e=_0x9320[_0x47918b];return _0x49c60e;};'use strict';function Dynamics365Account(_0x318373){this['id']=_0x318373['id']||0x0;this[_0x0932('0x0')]=_0x318373[_0x0932('0x0')]||'';this[_0x0932('0x1')]=_0x318373[_0x0932('0x1')]||'';this['password']=_0x318373[_0x0932('0x2')]||'';this[_0x0932('0x3')]=_0x318373[_0x0932('0x3')]||'';this['tenantId']=_0x318373[_0x0932('0x4')]||'';this[_0x0932('0x5')]=_0x318373[_0x0932('0x5')]||'';this[_0x0932('0x6')]=_0x318373[_0x0932('0x6')]||{};this[_0x0932('0x7')]=_0x318373[_0x0932('0x7')]||'';this[_0x0932('0x8')]=_0x318373['modernAuthentication']||![];this[_0x0932('0x9')]=_0x318373[_0x0932('0x9')]||{};this[_0x0932('0xa')]=_0x318373[_0x0932('0xa')]||{};}module[_0x0932('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x7408=['username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x2a74f5,_0x542b0b){var _0x358258=function(_0x52e19e){while(--_0x52e19e){_0x2a74f5['push'](_0x2a74f5['shift']());}};_0x358258(++_0x542b0b);}(_0x7408,0x18b));var _0x8740=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x7408[_0x3b3cc6];return _0x1161e4;};'use strict';function Dynamics365Account(_0x4f7f57){this['id']=_0x4f7f57['id']||0x0;this[_0x8740('0x0')]=_0x4f7f57[_0x8740('0x0')]||'';this[_0x8740('0x1')]=_0x4f7f57[_0x8740('0x1')]||'';this[_0x8740('0x2')]=_0x4f7f57[_0x8740('0x2')]||'';this['remoteUri']=_0x4f7f57['remoteUri']||'';this[_0x8740('0x3')]=_0x4f7f57[_0x8740('0x3')]||'';this[_0x8740('0x4')]=_0x4f7f57[_0x8740('0x4')]||'';this[_0x8740('0x5')]=_0x4f7f57[_0x8740('0x5')]||{};this[_0x8740('0x6')]=_0x4f7f57['serverUrl']||'';this[_0x8740('0x7')]=_0x4f7f57['modernAuthentication']||![];this['Configurations']=_0x4f7f57[_0x8740('0x8')]||{};this[_0x8740('0x9')]=_0x4f7f57[_0x8740('0x9')]||{};}module[_0x8740('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index fe162de..cd12fc0 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 _0x71b4=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x71b4,0x1a9));var _0x471b=function(_0x3684d3,_0x445320){_0x3684d3=_0x3684d3-0x0;var _0xae45dc=_0x71b4[_0x3684d3];return _0xae45dc;};'use strict';function FaxAccount(_0x20c065){this['id']=_0x20c065['id']||0x0;this['name']=_0x20c065['name']||'';this['description']=_0x20c065[_0x471b('0x0')];this[_0x471b('0x1')]=_0x20c065[_0x471b('0x1')];this[_0x471b('0x2')]=_0x20c065[_0x471b('0x2')];this[_0x471b('0x3')]=_0x20c065[_0x471b('0x3')];this[_0x471b('0x4')]=_0x20c065['minrate']||0x960;this[_0x471b('0x5')]=_0x20c065['maxrate']||0x3840;this[_0x471b('0x6')]=_0x20c065[_0x471b('0x6')]||_0x471b('0x7');this['gateway']=_0x20c065[_0x471b('0x8')]||'no';this['faxdetect']=_0x20c065[_0x471b('0x9')]||'no';this[_0x471b('0xa')]=_0x20c065[_0x471b('0xa')]||0x1388;this[_0x471b('0xb')]=_0x20c065[_0x471b('0xb')]||'SIP';this[_0x471b('0xc')]=_0x20c065[_0x471b('0xc')]?_0x20c065['Trunk']:undefined;this[_0x471b('0xd')]=_0x20c065['ListId'];this['key']=_0x20c065[_0x471b('0xe')];}module[_0x471b('0xf')]=FaxAccount; \ No newline at end of file +var _0x093f=['t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x50c2c3,_0x30ab87){var _0x325469=function(_0x59e226){while(--_0x59e226){_0x50c2c3['push'](_0x50c2c3['shift']());}};_0x325469(++_0x30ab87);}(_0x093f,0xd2));var _0xf093=function(_0x1a630e,_0x10aba9){_0x1a630e=_0x1a630e-0x0;var _0x311f9f=_0x093f[_0x1a630e];return _0x311f9f;};'use strict';function FaxAccount(_0x85209a){this['id']=_0x85209a['id']||0x0;this[_0xf093('0x0')]=_0x85209a[_0xf093('0x0')]||'';this[_0xf093('0x1')]=_0x85209a[_0xf093('0x1')];this[_0xf093('0x2')]=_0x85209a[_0xf093('0x2')];this['headerinfo']=_0x85209a[_0xf093('0x3')];this[_0xf093('0x4')]=_0x85209a['localstationid'];this[_0xf093('0x5')]=_0x85209a[_0xf093('0x5')]||0x960;this[_0xf093('0x6')]=_0x85209a[_0xf093('0x6')]||0x3840;this[_0xf093('0x7')]=_0x85209a[_0xf093('0x7')]||_0xf093('0x8');this[_0xf093('0x9')]=_0x85209a[_0xf093('0x9')]||'no';this[_0xf093('0xa')]=_0x85209a[_0xf093('0xa')]||'no';this[_0xf093('0xb')]=_0x85209a[_0xf093('0xb')]||0x1388;this['tech']=_0x85209a['tech']||_0xf093('0xc');this['Trunk']=_0x85209a[_0xf093('0xd')]?_0x85209a[_0xf093('0xd')]:undefined;this[_0xf093('0xe')]=_0x85209a['ListId'];this[_0xf093('0xf')]=_0x85209a['key'];}module[_0xf093('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ade1195..31da00c 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 _0xd5b2=['token','remoteUri','serverUrl','exports','name','username','apiKey'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xd5b2,0x74));var _0x2d5b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd5b2[_0xae7c2f];return _0x5d7001;};'use strict';function FreshdeskAccount(_0x36a696){this['id']=_0x36a696['id']||0x0;this[_0x2d5b('0x0')]=_0x36a696[_0x2d5b('0x0')]||'';this[_0x2d5b('0x1')]=_0x36a696[_0x2d5b('0x1')]||'';this[_0x2d5b('0x2')]=_0x36a696[_0x2d5b('0x3')]||'';this['remoteUri']=_0x36a696[_0x2d5b('0x4')]||'';this[_0x2d5b('0x5')]=_0x36a696[_0x2d5b('0x5')]||'';this['Configurations']=_0x36a696['Configurations']||{};}module[_0x2d5b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x7d04=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x7d04,0x7b));var _0x47d0=function(_0x106d1c,_0x5edb2c){_0x106d1c=_0x106d1c-0x0;var _0x5c0ae4=_0x7d04[_0x106d1c];return _0x5c0ae4;};'use strict';function FreshdeskAccount(_0x16a301){this['id']=_0x16a301['id']||0x0;this[_0x47d0('0x0')]=_0x16a301[_0x47d0('0x0')]||'';this[_0x47d0('0x1')]=_0x16a301['username']||'';this[_0x47d0('0x2')]=_0x16a301[_0x47d0('0x3')]||'';this[_0x47d0('0x4')]=_0x16a301[_0x47d0('0x4')]||'';this[_0x47d0('0x5')]=_0x16a301[_0x47d0('0x5')]||'';this[_0x47d0('0x6')]=_0x16a301[_0x47d0('0x6')]||{};}module[_0x47d0('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 20f2bb2..74cd892 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 _0x0619=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2bf4f4,_0x45af4d){var _0x1d488e=function(_0x2cc19f){while(--_0x2cc19f){_0x2bf4f4['push'](_0x2bf4f4['shift']());}};_0x1d488e(++_0x45af4d);}(_0x0619,0x90));var _0x9061=function(_0xa9765a,_0x18205d){_0xa9765a=_0xa9765a-0x0;var _0xa57b49=_0x0619[_0xa9765a];return _0xa57b49;};'use strict';function FreshsalesAccount(_0xe5b0cb){this['id']=_0xe5b0cb['id']||0x0;this[_0x9061('0x0')]=_0xe5b0cb[_0x9061('0x0')]||'';this[_0x9061('0x1')]=_0xe5b0cb['username']||'';this[_0x9061('0x2')]=_0xe5b0cb[_0x9061('0x3')]||'';this[_0x9061('0x4')]=_0xe5b0cb[_0x9061('0x4')]||'';this[_0x9061('0x5')]=_0xe5b0cb[_0x9061('0x5')]||'';this[_0x9061('0x6')]=_0xe5b0cb[_0x9061('0x6')]||{};}module[_0x9061('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x07d7=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x07d7,0x85));var _0x707d=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x07d7[_0x4df1f5];return _0x56585b;};'use strict';function FreshsalesAccount(_0x3cc60f){this['id']=_0x3cc60f['id']||0x0;this[_0x707d('0x0')]=_0x3cc60f[_0x707d('0x0')]||'';this[_0x707d('0x1')]=_0x3cc60f[_0x707d('0x1')]||'';this[_0x707d('0x2')]=_0x3cc60f[_0x707d('0x3')]||'';this[_0x707d('0x4')]=_0x3cc60f[_0x707d('0x4')]||'';this[_0x707d('0x5')]=_0x3cc60f[_0x707d('0x5')]||'';this[_0x707d('0x6')]=_0x3cc60f[_0x707d('0x6')]||{};}module[_0x707d('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 77835b0..b4eceb9 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 _0xf27a=['inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xf27a,0x1ca));var _0xaf27=function(_0x11e6b1,_0x2f41c8){_0x11e6b1=_0x11e6b1-0x0;var _0x1585c6=_0xf27a[_0x11e6b1];return _0x1585c6;};'use strict';function QueueReport(){this[_0xaf27('0x0')]=_0xaf27('0x1');this[_0xaf27('0x2')]='';this['calleridnum']='';this[_0xaf27('0x3')]='';this[_0xaf27('0x4')]='';this[_0xaf27('0x5')]=null;this[_0xaf27('0x6')]=null;this['position']=0x1;this['count']=0x1;this[_0xaf27('0x7')]=![];this[_0xaf27('0x8')]=null;this[_0xaf27('0x9')]=![];this[_0xaf27('0xa')]=null;this[_0xaf27('0xb')]=![];this[_0xaf27('0xc')]=null;this['originalposition']=0x1;this[_0xaf27('0xd')]='';this[_0xaf27('0xe')]='';this['connectedlinename']='';this[_0xaf27('0xf')]='';this[_0xaf27('0x10')]='';this[_0xaf27('0x11')]='';this[_0xaf27('0x12')]='';this[_0xaf27('0x13')]=0x0;this[_0xaf27('0x14')]=![];this[_0xaf27('0x15')]='';this[_0xaf27('0x16')]=_0xaf27('0x17');this[_0xaf27('0x18')]=0x0;this[_0xaf27('0x19')]={};}module[_0xaf27('0x1a')]=QueueReport; \ No newline at end of file +var _0x9f7d=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','type','inbound','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename'];(function(_0x4e460,_0x15af99){var _0x18b013=function(_0x35478b){while(--_0x35478b){_0x4e460['push'](_0x4e460['shift']());}};_0x18b013(++_0x15af99);}(_0x9f7d,0xfa));var _0xd9f7=function(_0x23b7a7,_0x2fd1bc){_0x23b7a7=_0x23b7a7-0x0;var _0x229859=_0x9f7d[_0x23b7a7];return _0x229859;};'use strict';function QueueReport(){this[_0xd9f7('0x0')]=_0xd9f7('0x1');this['uniqueid']='';this[_0xd9f7('0x2')]='';this['calleridname']='';this[_0xd9f7('0x3')]='';this[_0xd9f7('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xd9f7('0x5')]=0x1;this[_0xd9f7('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xd9f7('0x7')]=null;this[_0xd9f7('0x8')]=![];this[_0xd9f7('0x9')]=null;this[_0xd9f7('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xd9f7('0xb')]='';this[_0xd9f7('0xc')]='';this[_0xd9f7('0xd')]='';this[_0xd9f7('0xe')]='';this[_0xd9f7('0xf')]='';this[_0xd9f7('0x10')]='';this[_0xd9f7('0x11')]='';this[_0xd9f7('0x12')]=0x0;this[_0xd9f7('0x13')]=![];this[_0xd9f7('0x14')]='';this['motionChannel']=_0xd9f7('0x15');this[_0xd9f7('0x16')]=0x0;this[_0xd9f7('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a50880e..8d0ad25 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 _0x8014=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x576481,_0x17626d){var _0x7f4b1a=function(_0x26dc06){while(--_0x26dc06){_0x576481['push'](_0x576481['shift']());}};_0x7f4b1a(++_0x17626d);}(_0x8014,0x163));var _0x4801=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x8014[_0x10f6e8];return _0x35bb3c;};'use strict';function SalesforceAccount(_0x479809){this['id']=_0x479809['id']||0x0;this['name']=_0x479809[_0x4801('0x0')]||'';this[_0x4801('0x1')]=_0x479809[_0x4801('0x1')]||'';this['remoteUri']=_0x479809[_0x4801('0x2')]||'';this[_0x4801('0x3')]=_0x479809[_0x4801('0x3')]||'';this[_0x4801('0x4')]=_0x479809['clientId']||'';this[_0x4801('0x5')]=_0x479809['clientSecret']||'';this[_0x4801('0x6')]=_0x479809[_0x4801('0x6')]||'';this['type']=_0x479809[_0x4801('0x7')]||_0x4801('0x8');this[_0x4801('0x9')]=_0x479809[_0x4801('0x9')]||'';this[_0x4801('0xa')]=_0x479809[_0x4801('0xa')]||{};}module[_0x4801('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x9931=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name','username'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9931,0x1b6));var _0x1993=function(_0x3e529a,_0x2ca07b){_0x3e529a=_0x3e529a-0x0;var _0x32cfa8=_0x9931[_0x3e529a];return _0x32cfa8;};'use strict';function SalesforceAccount(_0xa53aca){this['id']=_0xa53aca['id']||0x0;this[_0x1993('0x0')]=_0xa53aca['name']||'';this[_0x1993('0x1')]=_0xa53aca[_0x1993('0x1')]||'';this[_0x1993('0x2')]=_0xa53aca[_0x1993('0x2')]||'';this[_0x1993('0x3')]=_0xa53aca[_0x1993('0x3')]||'';this[_0x1993('0x4')]=_0xa53aca[_0x1993('0x4')]||'';this[_0x1993('0x5')]=_0xa53aca[_0x1993('0x5')]||'';this[_0x1993('0x6')]=_0xa53aca[_0x1993('0x6')]||'';this[_0x1993('0x7')]=_0xa53aca[_0x1993('0x7')]||_0x1993('0x8');this[_0x1993('0x9')]=_0xa53aca[_0x1993('0x9')]||'';this['Configurations']=_0xa53aca['Configurations']||{};}module[_0x1993('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index acb12e8..1eace99 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 _0x6396=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x467b77,_0x2a55bb){var _0x584e3c=function(_0x13cebf){while(--_0x13cebf){_0x467b77['push'](_0x467b77['shift']());}};_0x584e3c(++_0x2a55bb);}(_0x6396,0x1d1));var _0x6639=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x6396[_0x40be86];return _0xda3c3b;};'use strict';function ServicenowAccount(_0x17188a){this['id']=_0x17188a['id']||0x0;this[_0x6639('0x0')]=_0x17188a[_0x6639('0x0')]||'';this['username']=_0x17188a[_0x6639('0x1')]||'';this[_0x6639('0x2')]=_0x17188a[_0x6639('0x2')]||'';this[_0x6639('0x3')]=_0x17188a[_0x6639('0x3')]||'';this[_0x6639('0x4')]=_0x17188a[_0x6639('0x4')]||'';this['Configurations']=_0x17188a[_0x6639('0x5')]||{};}module[_0x6639('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x89d3=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x89d3,0x134));var _0x389d=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x89d3[_0x3a2a3c];return _0x50ac9a;};'use strict';function ServicenowAccount(_0x21c44d){this['id']=_0x21c44d['id']||0x0;this[_0x389d('0x0')]=_0x21c44d[_0x389d('0x0')]||'';this[_0x389d('0x1')]=_0x21c44d[_0x389d('0x1')]||'';this[_0x389d('0x2')]=_0x21c44d[_0x389d('0x2')]||'';this['remoteUri']=_0x21c44d[_0x389d('0x3')]||'';this[_0x389d('0x4')]=_0x21c44d[_0x389d('0x4')]||'';this[_0x389d('0x5')]=_0x21c44d[_0x389d('0x5')]||{};}module[_0x389d('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fea5d53..6c90e8c 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 _0xe214=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x13a541,_0x3919f3){var _0x6eaf11=function(_0x54eb87){while(--_0x54eb87){_0x13a541['push'](_0x13a541['shift']());}};_0x6eaf11(++_0x3919f3);}(_0xe214,0x11e));var _0x4e21=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe214[_0x21a9d9];return _0x46adce;};'use strict';function SugarcrmAccount(_0x3fd633){this['id']=_0x3fd633['id']||0x0;this[_0x4e21('0x0')]=_0x3fd633[_0x4e21('0x0')]||'';this[_0x4e21('0x1')]=_0x3fd633[_0x4e21('0x1')]||'';this['password']=_0x3fd633['password']||'';this[_0x4e21('0x2')]=_0x3fd633[_0x4e21('0x2')]||'';this[_0x4e21('0x3')]=_0x3fd633[_0x4e21('0x3')]||'';this[_0x4e21('0x4')]=_0x3fd633['Configurations']||{};}module[_0x4e21('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x15a9=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xdbac11,_0x4aff44){var _0x5a262a=function(_0x16a8b8){while(--_0x16a8b8){_0xdbac11['push'](_0xdbac11['shift']());}};_0x5a262a(++_0x4aff44);}(_0x15a9,0x18a));var _0x915a=function(_0x1a2b52,_0x2fa31d){_0x1a2b52=_0x1a2b52-0x0;var _0x39c914=_0x15a9[_0x1a2b52];return _0x39c914;};'use strict';function SugarcrmAccount(_0x4199b9){this['id']=_0x4199b9['id']||0x0;this[_0x915a('0x0')]=_0x4199b9[_0x915a('0x0')]||'';this[_0x915a('0x1')]=_0x4199b9['username']||'';this[_0x915a('0x2')]=_0x4199b9[_0x915a('0x2')]||'';this[_0x915a('0x3')]=_0x4199b9[_0x915a('0x3')]||'';this[_0x915a('0x4')]=_0x4199b9[_0x915a('0x4')]||'';this[_0x915a('0x5')]=_0x4199b9[_0x915a('0x5')]||{};}module[_0x915a('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 848aab4..a9c6caf 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 _0x2baa=['stateTime','status','unknown','exports','name','accountcode','state'];(function(_0x499e77,_0x2bc8ba){var _0x813198=function(_0x2750b3){while(--_0x2750b3){_0x499e77['push'](_0x499e77['shift']());}};_0x813198(++_0x2bc8ba);}(_0x2baa,0xdd));var _0xa2ba=function(_0xb60ae4,_0x48b458){_0xb60ae4=_0xb60ae4-0x0;var _0x53d530=_0x2baa[_0xb60ae4];return _0x53d530;};'use strict';function Telephone(_0x63174d){this['id']=_0x63174d['id']||0x0;this[_0xa2ba('0x0')]=_0x63174d[_0xa2ba('0x0')]||'';this[_0xa2ba('0x1')]=_0x63174d[_0xa2ba('0x1')]||'';this[_0xa2ba('0x2')]='unknown';this[_0xa2ba('0x3')]=0x0;this[_0xa2ba('0x4')]=_0xa2ba('0x5');this['address']='';}module[_0xa2ba('0x6')]=Telephone; \ No newline at end of file +var _0xe7a0=['stateTime','address','exports','name','accountcode','state','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7a0,0x10d));var _0x0e7a=function(_0x179e01,_0x59f71a){_0x179e01=_0x179e01-0x0;var _0x276c89=_0xe7a0[_0x179e01];return _0x276c89;};'use strict';function Telephone(_0x75968b){this['id']=_0x75968b['id']||0x0;this[_0x0e7a('0x0')]=_0x75968b[_0x0e7a('0x0')]||'';this[_0x0e7a('0x1')]=_0x75968b[_0x0e7a('0x1')]||'';this[_0x0e7a('0x2')]=_0x0e7a('0x3');this[_0x0e7a('0x4')]=0x0;this['status']=_0x0e7a('0x3');this[_0x0e7a('0x5')]='';}module[_0x0e7a('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 7c535fc..1d98b0d 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x548701,_0x42eb21){var _0x504c6c=function(_0x4a602b){while(--_0x4a602b){_0x548701['push'](_0x548701['shift']());}};_0x504c6c(++_0x42eb21);}(_0xb10b,0x12a));var _0xbb10=function(_0x7ba032,_0x19c3ae){_0x7ba032=_0x7ba032-0x0;var _0x255dee=_0xb10b[_0x7ba032];return _0x255dee;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x105fe5,_0x11889d){var _0x5c7eb0=function(_0x14681b){while(--_0x14681b){_0x105fe5['push'](_0x105fe5['shift']());}};_0x5c7eb0(++_0x11889d);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b7b3,_0x62c34e){_0x35b7b3=_0x35b7b3-0x0;var _0x5afb26=_0xb10b[_0x35b7b3];return _0x5afb26;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6623a94..09ebd15 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c170a34..4c6f574 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 _0xc0f9=['host','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','state','unknown','status','registry','split'];(function(_0x234783,_0x5df303){var _0x11633e=function(_0x167fba){while(--_0x167fba){_0x234783['push'](_0x234783['shift']());}};_0x11633e(++_0x5df303);}(_0xc0f9,0x190));var _0x9c0f=function(_0xbb0ce8,_0xb63549){_0xbb0ce8=_0xbb0ce8-0x0;var _0x1a1b17=_0xc0f9[_0xbb0ce8];return _0x1a1b17;};'use strict';function Trunk(_0x322c20){this['id']=_0x322c20['id']||0x0;this[_0x9c0f('0x0')]=_0x322c20[_0x9c0f('0x0')]||![];this['name']=_0x322c20['name']||'';this[_0x9c0f('0x1')]=_0x9c0f('0x2');this['stateTime']=0x0;this[_0x9c0f('0x3')]='unknown';this[_0x9c0f('0x4')]=_0x322c20[_0x9c0f('0x4')]&&_0x322c20['registry']['indexOf'](':')?_0x322c20['registry'][_0x9c0f('0x5')](':')[0x0]:'';this[_0x9c0f('0x6')]='';this['port']='';this[_0x9c0f('0x7')]='';this[_0x9c0f('0x8')]='';this[_0x9c0f('0x9')]='';this[_0x9c0f('0xa')]='unknown';this[_0x9c0f('0xb')]='';this['address']='';this[_0x9c0f('0xc')]=_0x322c20['defaultuser']||'';}module[_0x9c0f('0xd')]=Trunk; \ No newline at end of file +var _0xfe43=['host','domain','domainport','refresh','address','defaultuser','active','name','state','unknown','stateTime','indexOf','registry','split'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xfe43,0xae));var _0x3fe4=function(_0xbabce1,_0x36f0ca){_0xbabce1=_0xbabce1-0x0;var _0x438df0=_0xfe43[_0xbabce1];return _0x438df0;};'use strict';function Trunk(_0x3b6c51){this['id']=_0x3b6c51['id']||0x0;this[_0x3fe4('0x0')]=_0x3b6c51['active']||![];this[_0x3fe4('0x1')]=_0x3b6c51[_0x3fe4('0x1')]||'';this[_0x3fe4('0x2')]=_0x3fe4('0x3');this[_0x3fe4('0x4')]=0x0;this['status']='unknown';this['registry']=_0x3b6c51['registry']&&_0x3b6c51['registry'][_0x3fe4('0x5')](':')?_0x3b6c51[_0x3fe4('0x6')][_0x3fe4('0x7')](':')[0x0]:'';this[_0x3fe4('0x8')]='';this['port']='';this[_0x3fe4('0x9')]='';this[_0x3fe4('0xa')]='';this[_0x3fe4('0xb')]='';this['stateRegistry']=_0x3fe4('0x3');this['registrationtime']='';this[_0x3fe4('0xc')]='';this['defaultuser']=_0x3b6c51[_0x3fe4('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2b452da..9483062 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 _0x2b32=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x57d8a0,_0x57795f){var _0x1086a1=function(_0x484452){while(--_0x484452){_0x57d8a0['push'](_0x57d8a0['shift']());}};_0x1086a1(++_0x57795f);}(_0x2b32,0x7f));var _0x22b3=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x2b32[_0x2a4fe2];return _0x225c4a;};'use strict';function voiceExtension(_0x229f26){this['id']=_0x229f26['id']||0x0;this[_0x22b3('0x0')]=_0x229f26[_0x22b3('0x0')]||'';this[_0x22b3('0x1')]=_0x229f26['recordingFormat']||_0x22b3('0x2');this[_0x22b3('0x3')]=_0x229f26[_0x22b3('0x3')]||![];}module[_0x22b3('0x4')]=voiceExtension; \ No newline at end of file +var _0xb7a8=['mandatoryDisposition','exports','exten','none'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb7a8,0x182));var _0x8b7a=function(_0xb926f2,_0x36814f){_0xb926f2=_0xb926f2-0x0;var _0x25ca96=_0xb7a8[_0xb926f2];return _0x25ca96;};'use strict';function voiceExtension(_0x356473){this['id']=_0x356473['id']||0x0;this[_0x8b7a('0x0')]=_0x356473[_0x8b7a('0x0')]||'';this['recordingFormat']=_0x356473['recordingFormat']||_0x8b7a('0x1');this[_0x8b7a('0x2')]=_0x356473[_0x8b7a('0x2')]||![];}module[_0x8b7a('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index df0ca72..18dfad9 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 _0xbb05=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','wav','wav49','gsm','leastrecent','linear','random','rrmemory','rrordered','name','monitor_format','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','available','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x711472,_0x10715d){_0x711472=_0x711472-0x0;var _0x238cb3=_0xbb05[_0x711472];return _0x238cb3;};'use strict';var monitorFormat={'wav':_0x5bb0('0x0'),'wav49':_0x5bb0('0x1'),'gsm':_0x5bb0('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x5bb0('0x3'),'linear':_0x5bb0('0x4'),'random':_0x5bb0('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x5bb0('0x6'),'rrordered':_0x5bb0('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x5854e0){this['id']=_0x5854e0['id']||0x0;this[_0x5bb0('0x8')]=_0x5854e0[_0x5bb0('0x8')]||'';this[_0x5bb0('0x9')]=_0x5854e0[_0x5bb0('0x9')]||'';this['type']=_0x5854e0['type']||_0x5bb0('0xa');this[_0x5bb0('0xb')]=0x0;this[_0x5bb0('0xc')]=0x0;this[_0x5bb0('0xd')]=0x0;this[_0x5bb0('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0x5bb0('0xf')]=0x0;this['unmanaged']=0x0;this[_0x5bb0('0x10')]=0x0;this[_0x5bb0('0x11')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x5bb0('0x12')]=0x0;this[_0x5bb0('0x13')]=0x0;this[_0x5bb0('0x14')]=0x0;this[_0x5bb0('0x15')]=0x0;this[_0x5bb0('0x16')]=0x0;this[_0x5bb0('0x17')]=0x0;this[_0x5bb0('0x18')]=0x0;this[_0x5bb0('0x19')]=0x0;this[_0x5bb0('0x1a')]=_0x5854e0[_0x5bb0('0x1a')]||![];this[_0x5bb0('0x1b')]=_0x5854e0[_0x5bb0('0x1b')]||0xa;this[_0x5bb0('0x1c')]=_0x5854e0[_0x5bb0('0x1c')]||'no';this[_0x5bb0('0x1d')]=!![];this['message']='';this[_0x5bb0('0x1e')]='';this[_0x5bb0('0x1f')]=0x0;this[_0x5bb0('0x20')]=0x0;this[_0x5bb0('0x21')]=_0x5854e0[_0x5bb0('0x21')]||null;this['dialGlobalInterval']=_0x5854e0[_0x5bb0('0x22')]?_0x5854e0['dialGlobalInterval']:null;this[_0x5bb0('0x23')]=_0x5854e0[_0x5bb0('0x23')];this[_0x5bb0('0x24')]=_0x5854e0['dialMethod']||_0x5bb0('0x25');this[_0x5bb0('0x26')]=_0x5854e0['dialLimitChannel']||0x0;this[_0x5bb0('0x27')]=_0x5854e0[_0x5bb0('0x27')]||0x0;this['dialPowerLevel']=_0x5854e0[_0x5bb0('0x28')]||0x1;this[_0x5bb0('0x29')]=_0x5854e0[_0x5bb0('0x29')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x5854e0[_0x5bb0('0x2a')]||0.03;this['dialPredictiveInterval']=_0x5854e0[_0x5bb0('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0x5854e0['dialOriginateCallerIdName']||'anonymous';this[_0x5bb0('0x2c')]=_0x5854e0[_0x5bb0('0x2c')]||_0x5bb0('0x2d');this['dialOriginateTimeout']=_0x5854e0[_0x5bb0('0x2e')]||0x1e;this[_0x5bb0('0x2f')]=_0x5854e0[_0x5bb0('0x2f')]||_0x5bb0('0x30');this[_0x5bb0('0x31')]=_0x5854e0[_0x5bb0('0x31')]||0x3;this['dialQueueProject']=_0x5854e0[_0x5bb0('0x32')]||undefined;this[_0x5bb0('0x33')]=_0x5854e0['dialCongestionMaxRetry']||0x3;this[_0x5bb0('0x34')]=_0x5854e0[_0x5bb0('0x34')]||0x96;this[_0x5bb0('0x35')]=_0x5854e0[_0x5bb0('0x35')]||0x3;this[_0x5bb0('0x36')]=_0x5854e0[_0x5bb0('0x36')]||0x96;this[_0x5bb0('0x37')]=_0x5854e0[_0x5bb0('0x37')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5854e0['dialNoAnswerRetryFrequency']||0x96;this[_0x5bb0('0x38')]=_0x5854e0[_0x5bb0('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5854e0[_0x5bb0('0x39')]||0x96;this[_0x5bb0('0x3a')]=_0x5854e0[_0x5bb0('0x3a')]||0x3;this['dialDropRetryFrequency']=_0x5854e0['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x5854e0['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5854e0[_0x5bb0('0x3b')]||0x96;this[_0x5bb0('0x3c')]=_0x5854e0['dialMachineMaxRetry']||0x3;this[_0x5bb0('0x3d')]=_0x5854e0[_0x5bb0('0x3d')]||0x96;this[_0x5bb0('0x3e')]=_0x5854e0[_0x5bb0('0x3e')]||0x3;this[_0x5bb0('0x3f')]=_0x5854e0['dialAgentRejectRetryFrequency']||0x96;this[_0x5bb0('0x40')]=_0x5854e0[_0x5bb0('0x40')]||0x3;this[_0x5bb0('0x41')]=_0x5854e0['dialGlobalMaxRetry']||0x4;this[_0x5bb0('0x42')]=_0x5854e0[_0x5bb0('0x42')]?_0x5854e0[_0x5bb0('0x42')]:undefined;this['TrunkBackup']=_0x5854e0['TrunkBackup']?_0x5854e0[_0x5bb0('0x43')]:undefined;this[_0x5bb0('0x44')]=_0x5854e0[_0x5bb0('0x44')]||undefined;this['Interval']=_0x5854e0['Interval']?_0x5854e0[_0x5bb0('0x45')]:undefined;this[_0x5bb0('0x46')]=_0x5854e0[_0x5bb0('0x46')]||_0x5bb0('0x47');this[_0x5bb0('0x48')]=_0x5854e0[_0x5bb0('0x48')]||undefined;this[_0x5bb0('0x49')]=_0x5854e0['dialCutDigit']||undefined;this[_0x5bb0('0x4a')]=strategy[_0x5854e0['strategy']];this[_0x5bb0('0x4b')]=!![];this['dialAMDActive']=_0x5854e0[_0x5bb0('0x4c')]||![];this['dialAMDInitialSilence']=_0x5854e0['dialAMDInitialSilence'];this[_0x5bb0('0x4d')]=_0x5854e0[_0x5bb0('0x4d')];this[_0x5bb0('0x4e')]=_0x5854e0[_0x5bb0('0x4e')];this[_0x5bb0('0x4f')]=_0x5854e0[_0x5bb0('0x4f')];this[_0x5bb0('0x50')]=_0x5854e0[_0x5bb0('0x50')];this[_0x5bb0('0x51')]=_0x5854e0[_0x5bb0('0x51')];this[_0x5bb0('0x52')]=_0x5854e0[_0x5bb0('0x52')];this[_0x5bb0('0x53')]=_0x5854e0['dialAMDSilenceThreshold'];this[_0x5bb0('0x54')]=_0x5854e0['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x5bb0('0x55')]=_0x5854e0['timeout'];this[_0x5bb0('0x56')]=0x0;this[_0x5bb0('0x57')]=0x0;this[_0x5bb0('0x58')]=0x0;this[_0x5bb0('0x59')]=0x0;this[_0x5bb0('0x5a')]=0x0;this[_0x5bb0('0x5b')]=0x0;this[_0x5bb0('0x5c')]=0x0;this[_0x5bb0('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5bb0('0x5e')]=0x0;this[_0x5bb0('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5bb0('0x60')]=0x0;this[_0x5bb0('0x61')]=0x0;this[_0x5bb0('0x62')]=undefined;this[_0x5bb0('0x63')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x5bb0('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5bb0('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5bb0('0x66')]=0x0;this[_0x5bb0('0x67')]=0x0;this[_0x5bb0('0x68')]=0x0;this[_0x5bb0('0x69')]=0x0;this[_0x5bb0('0x6a')]=_0x5854e0[_0x5bb0('0x6b')]||0x14;this[_0x5bb0('0x6c')]=_0x5854e0[_0x5bb0('0x6b')]||0xa;this[_0x5bb0('0x6d')]=0x0;this[_0x5bb0('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x5bb0('0x6f')]=0x0;this[_0x5bb0('0x70')]=0x0;this[_0x5bb0('0x71')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x5854e0[_0x5bb0('0x72')]||0x1e;this[_0x5bb0('0x73')]=_0x5854e0['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x5854e0[_0x5bb0('0x74')]||![];this[_0x5bb0('0x75')]=!!_0x5854e0['dialPreviewRecallmeReminder']||![];this[_0x5bb0('0x76')]=_0x5854e0[_0x5bb0('0x76')]||undefined;this[_0x5bb0('0x77')]=_0x5854e0[_0x5bb0('0x77')]||![];this[_0x5bb0('0x78')]=_0x5854e0[_0x5bb0('0x78')]||![];this[_0x5bb0('0x9')]=monitorFormat[_0x5854e0[_0x5bb0('0x9')]]?monitorFormat[_0x5854e0[_0x5bb0('0x9')]]:undefined;this['mandatoryDisposition']=_0x5854e0['mandatoryDisposition']||![];this[_0x5bb0('0x79')]=_0x5854e0[_0x5bb0('0x79')]?_0x5854e0[_0x5bb0('0x79')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x4233=['dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','wrandom','monitor_format','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold'];(function(_0x422559,_0x1b67f2){var _0x2e296a=function(_0x39ce06){while(--_0x39ce06){_0x422559['push'](_0x422559['shift']());}};_0x2e296a(++_0x1b67f2);}(_0x4233,0x199));var _0x3423=function(_0x4f064d,_0x18422b){_0x4f064d=_0x4f064d-0x0;var _0x35651f=_0x4233[_0x4f064d];return _0x35651f;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x3423('0x0'),'gsm':_0x3423('0x1')};var strategy={'fewestcalls':_0x3423('0x2'),'leastrecent':'leastrecent','linear':_0x3423('0x3'),'random':_0x3423('0x4'),'ringall':_0x3423('0x5'),'rr':_0x3423('0x6'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x3423('0x7')};function VoiceQueue(_0x26c566){this['id']=_0x26c566['id']||0x0;this['name']=_0x26c566['name']||'';this[_0x3423('0x8')]=_0x26c566['monitor_format']||'';this['type']=_0x26c566['type']||_0x3423('0x9');this[_0x3423('0xa')]=0x0;this[_0x3423('0xb')]=0x0;this[_0x3423('0xc')]=0x0;this[_0x3423('0xd')]=0x0;this[_0x3423('0xe')]=0x0;this[_0x3423('0xf')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0x3423('0x10')]=0x0;this[_0x3423('0x11')]=0x0;this[_0x3423('0x12')]=0x0;this[_0x3423('0x13')]=0x0;this[_0x3423('0x14')]=0x0;this[_0x3423('0x15')]=0x0;this[_0x3423('0x16')]=0x0;this[_0x3423('0x17')]=0x0;this['ringInUse']=0x0;this[_0x3423('0x18')]=0x0;this[_0x3423('0x19')]=0x0;this[_0x3423('0x1a')]=0x0;this[_0x3423('0x1b')]=_0x26c566[_0x3423('0x1b')]||![];this[_0x3423('0x1c')]=_0x26c566[_0x3423('0x1c')]||0xa;this[_0x3423('0x1d')]=_0x26c566[_0x3423('0x1d')]||'no';this[_0x3423('0x1e')]=!![];this['message']='';this[_0x3423('0x1f')]='';this[_0x3423('0x20')]=0x0;this[_0x3423('0x21')]=0x0;this[_0x3423('0x22')]=_0x26c566[_0x3423('0x22')]||null;this['dialGlobalInterval']=_0x26c566[_0x3423('0x23')]?_0x26c566[_0x3423('0x23')]:null;this[_0x3423('0x24')]=_0x26c566[_0x3423('0x24')];this[_0x3423('0x25')]=_0x26c566[_0x3423('0x25')]||_0x3423('0x26');this[_0x3423('0x27')]=_0x26c566[_0x3423('0x27')]||0x0;this[_0x3423('0x28')]=_0x26c566['dialLimitQueue']||0x0;this[_0x3423('0x29')]=_0x26c566[_0x3423('0x29')]||0x1;this['dialPredictiveOptimization']=_0x26c566[_0x3423('0x2a')]||_0x3423('0x2b');this[_0x3423('0x2c')]=_0x26c566[_0x3423('0x2c')]||0.03;this[_0x3423('0x2d')]=_0x26c566['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x26c566[_0x3423('0x2e')]||_0x3423('0x2f');this[_0x3423('0x30')]=_0x26c566[_0x3423('0x30')]||_0x3423('0x2f');this[_0x3423('0x31')]=_0x26c566['dialOriginateTimeout']||0x1e;this[_0x3423('0x32')]=_0x26c566[_0x3423('0x32')]||_0x3423('0x33');this['dialQueueTimeout']=_0x26c566[_0x3423('0x34')]||0x3;this[_0x3423('0x35')]=_0x26c566[_0x3423('0x35')]||undefined;this['dialCongestionMaxRetry']=_0x26c566[_0x3423('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x26c566['dialCongestionRetryFrequency']||0x96;this[_0x3423('0x37')]=_0x26c566['dialBusyMaxRetry']||0x3;this[_0x3423('0x38')]=_0x26c566[_0x3423('0x38')]||0x96;this[_0x3423('0x39')]=_0x26c566['dialNoAnswerMaxRetry']||0x3;this[_0x3423('0x3a')]=_0x26c566[_0x3423('0x3a')]||0x96;this[_0x3423('0x3b')]=_0x26c566[_0x3423('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x26c566[_0x3423('0x3c')]||0x96;this[_0x3423('0x3d')]=_0x26c566[_0x3423('0x3d')]||0x3;this['dialDropRetryFrequency']=_0x26c566[_0x3423('0x3e')]||0x96;this[_0x3423('0x3f')]=_0x26c566[_0x3423('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x26c566[_0x3423('0x40')]||0x96;this[_0x3423('0x41')]=_0x26c566['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x26c566['dialMachineRetryFrequency']||0x96;this[_0x3423('0x42')]=_0x26c566['dialAgentRejectMaxRetry']||0x3;this[_0x3423('0x43')]=_0x26c566['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x26c566[_0x3423('0x44')]||0x3;this[_0x3423('0x45')]=_0x26c566[_0x3423('0x45')]||0x4;this[_0x3423('0x46')]=_0x26c566['Trunk']?_0x26c566['Trunk']:undefined;this['TrunkBackup']=_0x26c566['TrunkBackup']?_0x26c566['TrunkBackup']:undefined;this[_0x3423('0x47')]=_0x26c566[_0x3423('0x47')]||undefined;this['Interval']=_0x26c566[_0x3423('0x48')]?_0x26c566[_0x3423('0x48')]:undefined;this[_0x3423('0x49')]=_0x26c566[_0x3423('0x49')]||_0x3423('0x4a');this[_0x3423('0x4b')]=_0x26c566[_0x3423('0x4b')]||undefined;this[_0x3423('0x4c')]=_0x26c566[_0x3423('0x4c')]||undefined;this[_0x3423('0x4d')]=strategy[_0x26c566[_0x3423('0x4d')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x26c566[_0x3423('0x4e')]||![];this[_0x3423('0x4f')]=_0x26c566['dialAMDInitialSilence'];this[_0x3423('0x50')]=_0x26c566[_0x3423('0x50')];this[_0x3423('0x51')]=_0x26c566[_0x3423('0x51')];this[_0x3423('0x52')]=_0x26c566[_0x3423('0x52')];this['dialAMDMinWordLength']=_0x26c566[_0x3423('0x53')];this[_0x3423('0x54')]=_0x26c566['dialAMDBetweenWordsSilence'];this[_0x3423('0x55')]=_0x26c566[_0x3423('0x55')];this[_0x3423('0x56')]=_0x26c566[_0x3423('0x56')];this['dialAMDMaximumWordLength']=_0x26c566[_0x3423('0x57')];this[_0x3423('0x58')]=0x0;this['pTalking']=0x0;this[_0x3423('0x59')]=_0x26c566[_0x3423('0x59')];this[_0x3423('0x5a')]=0x0;this[_0x3423('0x5b')]=0x0;this[_0x3423('0x5c')]=0x0;this[_0x3423('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3423('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x3423('0x5f')]=0x0;this[_0x3423('0x60')]=0x0;this[_0x3423('0x61')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x3423('0x62')]=0x0;this[_0x3423('0x63')]=0x0;this[_0x3423('0x64')]=undefined;this[_0x3423('0x65')]=undefined;this[_0x3423('0x66')]=undefined;this[_0x3423('0x67')]=1.05;this[_0x3423('0x68')]=0x0;this[_0x3423('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3423('0x6a')]=0x0;this[_0x3423('0x6b')]=0x0;this[_0x3423('0x6c')]=0x0;this[_0x3423('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x3423('0x6e')]=_0x26c566[_0x3423('0x6f')]||0x14;this['predictiveIntervalMinThreshold']=_0x26c566[_0x3423('0x6f')]||0xa;this[_0x3423('0x70')]=0x0;this[_0x3423('0x71')]=0x0;this[_0x3423('0x72')]=0x1;this[_0x3423('0x73')]=0x0;this[_0x3423('0x74')]=0x0;this[_0x3423('0x75')]=0x0;this[_0x3423('0x76')]=0x0;this['dialRecallMeTimeout']=_0x26c566[_0x3423('0x77')]||0x1e;this['dialRecallInQueue']=_0x26c566[_0x3423('0x78')]||![];this[_0x3423('0x79')]=!!_0x26c566[_0x3423('0x79')]||![];this[_0x3423('0x7a')]=!!_0x26c566['dialPreviewRecallmeReminder']||![];this[_0x3423('0x7b')]=_0x26c566['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x26c566[_0x3423('0x7c')]||![];this[_0x3423('0x7d')]=_0x26c566['dialAgiAfterHangupAgent']||![];this[_0x3423('0x8')]=monitorFormat[_0x26c566[_0x3423('0x8')]]?monitorFormat[_0x26c566[_0x3423('0x8')]]:undefined;this['mandatoryDisposition']=_0x26c566[_0x3423('0x7e')]||![];this['mandatoryDispositionPause']=_0x26c566[_0x3423('0x7f')]?_0x26c566[_0x3423('0x7f')]:undefined;this[_0x3423('0x80')]=![];}module[_0x3423('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index fa40c20..0a01eb3 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc492=['dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','status','booked','keys','length','queue','dialer','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','talking','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','paused','ringing','ringInUse','sumBillable','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x32dc08,_0x61f53b){var _0x22ef51=function(_0x494d12){while(--_0x494d12){_0x32dc08['push'](_0x32dc08['shift']());}};_0x22ef51(++_0x61f53b);}(_0xc492,0xd7));var _0x2c49=function(_0x263cdf,_0x4123b9){_0x263cdf=_0x263cdf-0x0;var _0x2c8a91=_0xc492[_0x263cdf];return _0x2c8a91;};'use strict';var INBOUND_COUNTERS=[_0x2c49('0x0'),_0x2c49('0x1'),_0x2c49('0x2'),'paused','ringing',_0x2c49('0x3'),'waiting'];var OUTBOUND_COUNTERS=['available',_0x2c49('0x4'),_0x2c49('0x5'),'loggedIn',_0x2c49('0x2'),'originated',_0x2c49('0x6'),_0x2c49('0x7'),'outboundBlacklistCallsDay',_0x2c49('0x8'),_0x2c49('0x9'),_0x2c49('0xa'),_0x2c49('0xb'),_0x2c49('0xc'),'outboundRejectCallsDay',_0x2c49('0xd'),'paused','pTalking','talking','sumBillable',_0x2c49('0xe'),'total',_0x2c49('0xf')];function VoiceQueueSummary(_0x2a998e){this['id']=_0x2a998e['id'];this['name']=_0x2a998e[_0x2c49('0x10')];this[_0x2c49('0x11')]=_0x2a998e[_0x2c49('0x11')];this[_0x2c49('0x12')]=_0x2a998e[_0x2c49('0x12')]||0x0;this[_0x2c49('0x4')]=_0x2a998e['answered']||0x0;this[_0x2c49('0x0')]=_0x2a998e[_0x2c49('0x0')]||0x0;this[_0x2c49('0x13')]=_0x2a998e[_0x2c49('0x13')]||0x0;this[_0x2c49('0x5')]=_0x2a998e['inUse']||0x0;this[_0x2c49('0x14')]=_0x2a998e[_0x2c49('0x14')]||0x0;this[_0x2c49('0x1')]=_0x2a998e[_0x2c49('0x1')]||0x0;this[_0x2c49('0x2')]=_0x2a998e[_0x2c49('0x2')]||0x0;this[_0x2c49('0x15')]=_0x2a998e[_0x2c49('0x15')]||0x0;this[_0x2c49('0x16')]=_0x2a998e[_0x2c49('0x16')]||0x0;this['paused']=_0x2a998e[_0x2c49('0x17')]||0x0;this[_0x2c49('0x18')]=_0x2a998e[_0x2c49('0x18')]||0x0;this[_0x2c49('0x19')]=_0x2a998e['ringInUse'];this[_0x2c49('0x1a')]=_0x2a998e['sumBillable'];this[_0x2c49('0xe')]=_0x2a998e[_0x2c49('0xe')];this['sumHoldTime']=_0x2a998e['sumHoldTime']||0x0;this[_0x2c49('0x3')]=_0x2a998e[_0x2c49('0x3')]||0x0;this[_0x2c49('0x1b')]=_0x2a998e[_0x2c49('0x1b')]||0x0;this[_0x2c49('0x1c')]=_0x2a998e[_0x2c49('0x1c')];this[_0x2c49('0x1d')]=_0x2a998e[_0x2c49('0x1d')]||0x0;this[_0x2c49('0x1e')]=_0x2a998e['unknown']||0x0;this[_0x2c49('0x1f')]=_0x2a998e[_0x2c49('0x1f')]||0x0;this[_0x2c49('0xf')]=_0x2a998e[_0x2c49('0xf')]||0x0;if(_0x2a998e['type']===_0x2c49('0x20')){this[_0x2c49('0x21')]=_0x2a998e[_0x2c49('0x21')]||0x0;this[_0x2c49('0x22')]=_0x2a998e['dialActive'];this[_0x2c49('0x23')]=_0x2a998e[_0x2c49('0x23')];this[_0x2c49('0x24')]=_0x2a998e['dialOriginateCallerIdName'];this[_0x2c49('0x25')]=_0x2a998e[_0x2c49('0x25')];this['dialOriginateTimeout']=_0x2a998e[_0x2c49('0x26')];this['dialPrefix']=_0x2a998e['dialPrefix'];this[_0x2c49('0x27')]=_0x2a998e['temp'];this[_0x2c49('0x28')]=_0x2a998e['outboundAnswerAgiCallsDay'];this[_0x2c49('0x7')]=_0x2a998e[_0x2c49('0x7')];this[_0x2c49('0x29')]=_0x2a998e[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x2a998e[_0x2c49('0x8')];this[_0x2c49('0x9')]=_0x2a998e[_0x2c49('0x9')];this[_0x2c49('0x2a')]=_0x2a998e[_0x2c49('0x2a')];this['outboundDropCallsDayCallersExit']=_0x2a998e[_0x2c49('0x2b')];this['outboundDropCallsDayTimeout']=_0x2a998e[_0x2c49('0x2c')];this[_0x2c49('0xa')]=_0x2a998e[_0x2c49('0xa')];this[_0x2c49('0xb')]=_0x2a998e[_0x2c49('0xb')];this[_0x2c49('0x2d')]=_0x2a998e[_0x2c49('0x2d')];this[_0x2c49('0xc')]=_0x2a998e[_0x2c49('0xc')];this[_0x2c49('0x2e')]=_0x2a998e[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x2a998e[_0x2c49('0xd')];this[_0x2c49('0x2f')]=_0x2a998e['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x2a998e[_0x2c49('0x30')];this[_0x2c49('0x31')]=_0x2a998e['predictiveIntervalAvgTalktime'];this[_0x2c49('0x32')]=_0x2a998e[_0x2c49('0x32')];this[_0x2c49('0x33')]=_0x2a998e[_0x2c49('0x33')];this[_0x2c49('0x34')]=_0x2a998e[_0x2c49('0x34')];this[_0x2c49('0x35')]=_0x2a998e[_0x2c49('0x35')];this['predictiveIntervalHitRate']=_0x2a998e[_0x2c49('0x36')];this[_0x2c49('0x37')]=_0x2a998e['predictiveIntervalMultiplicativeFactor'];this[_0x2c49('0x38')]=_0x2a998e[_0x2c49('0x38')];this[_0x2c49('0x39')]=_0x2a998e['predictiveIntervalAvailable'];this[_0x2c49('0x3a')]=_0x2a998e[_0x2c49('0x3a')];this[_0x2c49('0x3b')]=_0x2a998e[_0x2c49('0x3b')];this[_0x2c49('0x3c')]=_0x2a998e[_0x2c49('0x3c')];this['erlangCallToSecond']=_0x2a998e[_0x2c49('0x3d')];this[_0x2c49('0x3e')]=_0x2a998e['erlangAbandonmentRate'];this[_0x2c49('0x3f')]=_0x2a998e[_0x2c49('0x3f')];this['startPredictive']=_0x2a998e[_0x2c49('0x40')];this['startProgressive']=_0x2a998e[_0x2c49('0x41')];this[_0x2c49('0x42')]=_0x2a998e[_0x2c49('0x42')];this['statusMessage']=_0x2a998e[_0x2c49('0x43')];}if(_0x2a998e['Trunk']){this[_0x2c49('0x44')]={'id':_0x2a998e[_0x2c49('0x44')]['id'],'name':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x10')],'active':_0x2a998e[_0x2c49('0x44')]['active'],'callerid':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x45')]};}}VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x47')]=function(_0x251c8d,_0x130410,_0x3c25b6,_0x40f640){this['loggedInDb']=0x0;this[_0x2c49('0x3')]=0x0;this[_0x2c49('0x17')]=0x0;this['unknown']=0x0;this[_0x2c49('0x16')]=0x0;this[_0x2c49('0x5')]=0x0;this['busy']=0x0;this[_0x2c49('0x14')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x3c25b6){if(_0x3c25b6[_0x2c49('0x0')]){this[_0x2c49('0x0')]=Number(_0x3c25b6[_0x2c49('0x0')]);}if(_0x3c25b6[_0x2c49('0x48')]){this[_0x2c49('0x1')]=Number(_0x3c25b6['loggedin']);}if(_0x3c25b6['callers']){this['waiting']=Number(_0x3c25b6['callers']);}}for(var _0x43b5ca=0x0;_0x43b5ca<_0x251c8d['length'];_0x43b5ca++){var _0x341fd6=_0x130410['SIP/'+_0x251c8d[_0x43b5ca]['name']];if(_0x341fd6&&_0x341fd6['online']){this[_0x2c49('0x2')]+=0x1;}if(_0x251c8d[_0x43b5ca]['incall']==='1'){this[_0x2c49('0x3')]+=0x1;}if(_0x251c8d[_0x43b5ca][_0x2c49('0x17')]==='1'&&!['2','7','8']['includes'](_0x251c8d[_0x43b5ca]['status'])){this[_0x2c49('0x17')]+=0x1;}switch(_0x251c8d[_0x43b5ca][_0x2c49('0x49')]){case'0':this[_0x2c49('0x1e')]+=0x1;break;case'1':this[_0x2c49('0x16')]+=0x1;break;case'2':this[_0x2c49('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x2c49('0x1d')]+=0x1;break;case'6':this[_0x2c49('0x18')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x2c49('0x4a')){var _0x267a32=Object[_0x2c49('0x4b')](_0x40f640);for(var _0x55e4cd=0x0;_0x55e4cd<_0x267a32[_0x2c49('0x4c')];_0x55e4cd++){var _0xea11c4=_0x267a32[_0x55e4cd];var _0x43a7fd=_0x40f640[_0xea11c4];if(_0x43a7fd[_0x2c49('0x4d')]===this[_0x2c49('0x10')]&&_0x43a7fd[_0x2c49('0x1c')]===_0x2c49('0x4e')&&_0x43a7fd['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0x2c49('0x3')]>this[_0x2c49('0x5')]){this['talking']=this[_0x2c49('0x5')];}this[_0x2c49('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x4f')]=function(_0x199b26){var _0x38d901=![];if(_0x199b26){_0x38d901=INBOUND_COUNTERS[_0x2c49('0x50')](function(_0x11878d){return this[_0x11878d]!==_0x199b26[_0x11878d];},this);}return _0x38d901;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x51')]=function(_0x56d647){var _0x46a0c6=![];var _0xe026bf=![];var _0xfcdbaf=![];if(_0x56d647){_0x46a0c6=this['dialMethod']!==_0x56d647[_0x2c49('0x23')]||this[_0x2c49('0x22')]!==_0x56d647['dialActive']||this[_0x2c49('0x42')]!==_0x56d647[_0x2c49('0x42')]||this[_0x2c49('0x43')]!==_0x56d647[_0x2c49('0x43')];_0xe026bf=OUTBOUND_COUNTERS['some'](function(_0x34e69e){return this[_0x34e69e]!==_0x56d647[_0x34e69e];},this);if(this[_0x2c49('0x44')]&&_0x56d647[_0x2c49('0x44')]){_0xfcdbaf=this[_0x2c49('0x44')]['name']!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x10')]||this[_0x2c49('0x44')][_0x2c49('0x52')]!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x52')];}}return _0x46a0c6||_0xe026bf||_0xfcdbaf;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x53')]=function(_0x3b62ee){this['answered']=_0x3b62ee['answered'];this[_0x2c49('0x42')]=_0x3b62ee[_0x2c49('0x42')];this['statusMessage']=_0x3b62ee[_0x2c49('0x43')];this['originated']=_0x3b62ee[_0x2c49('0x3b')];this[_0x2c49('0x6')]=_0x3b62ee[_0x2c49('0x6')];this[_0x2c49('0x7')]=_0x3b62ee[_0x2c49('0x7')];this['outboundBlacklistCallsDay']=_0x3b62ee[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x3b62ee[_0x2c49('0x8')];this['outboundCongestionCallsDay']=_0x3b62ee[_0x2c49('0x9')];this[_0x2c49('0xa')]=_0x3b62ee['outboundNoAnswerCallsDay'];this[_0x2c49('0xb')]=_0x3b62ee[_0x2c49('0xb')];this['outboundReCallsDay']=_0x3b62ee[_0x2c49('0xc')];this['outboundRejectCallsDay']=_0x3b62ee[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x3b62ee[_0x2c49('0xd')];this[_0x2c49('0x1a')]=_0x3b62ee[_0x2c49('0x1a')];this[_0x2c49('0xe')]=_0x3b62ee['sumDuration'];this[_0x2c49('0x1b')]=_0x3b62ee[_0x2c49('0x1b')];if(this[_0x2c49('0x23')]==='preview'){this[_0x2c49('0x21')]=_0x3b62ee['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x7a2d=['type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','loggedin','callers','length','SIP/','status','keys','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','unavailable','unknown','unmanaged'];(function(_0x4c275f,_0x5654bf){var _0x324221=function(_0x31d9f0){while(--_0x31d9f0){_0x4c275f['push'](_0x4c275f['shift']());}};_0x324221(++_0x5654bf);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3f6b0f,_0x5150fc){_0x3f6b0f=_0x3f6b0f-0x0;var _0x472e36=_0x7a2d[_0x3f6b0f];return _0x472e36;};'use strict';var INBOUND_COUNTERS=[_0xd7a2('0x0'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x3'),_0xd7a2('0x4'),_0xd7a2('0x5'),_0xd7a2('0x6')];var OUTBOUND_COUNTERS=['available','answered',_0xd7a2('0x7'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x8'),'outboundAbandonedCallsDay',_0xd7a2('0x9'),_0xd7a2('0xa'),_0xd7a2('0xb'),_0xd7a2('0xc'),_0xd7a2('0xd'),_0xd7a2('0xe'),_0xd7a2('0xf'),_0xd7a2('0x10'),_0xd7a2('0x11'),'paused',_0xd7a2('0x12'),_0xd7a2('0x5'),_0xd7a2('0x13'),_0xd7a2('0x14'),_0xd7a2('0x15'),_0xd7a2('0x6')];function VoiceQueueSummary(_0xe2feee){this['id']=_0xe2feee['id'];this['name']=_0xe2feee['name'];this[_0xd7a2('0x16')]=_0xe2feee['strategy'];this[_0xd7a2('0x17')]=_0xe2feee[_0xd7a2('0x17')]||0x0;this[_0xd7a2('0x18')]=_0xe2feee[_0xd7a2('0x18')]||0x0;this[_0xd7a2('0x0')]=_0xe2feee[_0xd7a2('0x0')]||0x0;this[_0xd7a2('0x19')]=_0xe2feee[_0xd7a2('0x19')]||0x0;this[_0xd7a2('0x7')]=_0xe2feee[_0xd7a2('0x7')]||0x0;this[_0xd7a2('0x1a')]=_0xe2feee['invalid']||0x0;this[_0xd7a2('0x1')]=_0xe2feee['loggedIn']||0x0;this['loggedInDb']=_0xe2feee[_0xd7a2('0x2')]||0x0;this[_0xd7a2('0x1b')]=_0xe2feee[_0xd7a2('0x1b')]||0x0;this[_0xd7a2('0x1c')]=_0xe2feee[_0xd7a2('0x1c')]||0x0;this[_0xd7a2('0x3')]=_0xe2feee['paused']||0x0;this['ringing']=_0xe2feee[_0xd7a2('0x4')]||0x0;this[_0xd7a2('0x1d')]=_0xe2feee[_0xd7a2('0x1d')];this['sumBillable']=_0xe2feee['sumBillable'];this[_0xd7a2('0x14')]=_0xe2feee['sumDuration'];this['sumHoldTime']=_0xe2feee[_0xd7a2('0x1e')]||0x0;this['talking']=_0xe2feee['talking']||0x0;this[_0xd7a2('0x15')]=_0xe2feee['total']||0x0;this['type']=_0xe2feee['type'];this[_0xd7a2('0x1f')]=_0xe2feee[_0xd7a2('0x1f')]||0x0;this[_0xd7a2('0x20')]=_0xe2feee[_0xd7a2('0x20')]||0x0;this[_0xd7a2('0x21')]=_0xe2feee[_0xd7a2('0x21')]||0x0;this[_0xd7a2('0x6')]=_0xe2feee[_0xd7a2('0x6')]||0x0;if(_0xe2feee[_0xd7a2('0x22')]===_0xd7a2('0x23')){this[_0xd7a2('0x12')]=_0xe2feee[_0xd7a2('0x12')]||0x0;this[_0xd7a2('0x24')]=_0xe2feee['dialActive'];this['dialMethod']=_0xe2feee[_0xd7a2('0x25')];this['dialOriginateCallerIdName']=_0xe2feee[_0xd7a2('0x26')];this['dialOriginateCallerIdNumber']=_0xe2feee[_0xd7a2('0x27')];this[_0xd7a2('0x28')]=_0xe2feee[_0xd7a2('0x28')];this[_0xd7a2('0x29')]=_0xe2feee[_0xd7a2('0x29')];this[_0xd7a2('0x2a')]=_0xe2feee[_0xd7a2('0x2a')];this[_0xd7a2('0x2b')]=_0xe2feee[_0xd7a2('0x2b')];this[_0xd7a2('0x9')]=_0xe2feee[_0xd7a2('0x9')];this[_0xd7a2('0xa')]=_0xe2feee[_0xd7a2('0xa')];this[_0xd7a2('0xb')]=_0xe2feee[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0xe2feee[_0xd7a2('0xc')];this[_0xd7a2('0x2c')]=_0xe2feee['outboundDropCallsDayACS'];this[_0xd7a2('0x2d')]=_0xe2feee[_0xd7a2('0x2d')];this['outboundDropCallsDayTimeout']=_0xe2feee[_0xd7a2('0x2e')];this[_0xd7a2('0xd')]=_0xe2feee[_0xd7a2('0xd')];this['outboundNoSuchCallsDay']=_0xe2feee[_0xd7a2('0xe')];this[_0xd7a2('0x2f')]=_0xe2feee[_0xd7a2('0x2f')];this['outboundReCallsDay']=_0xe2feee[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0xe2feee[_0xd7a2('0x10')];this[_0xd7a2('0x11')]=_0xe2feee[_0xd7a2('0x11')];this[_0xd7a2('0x30')]=_0xe2feee['predictiveIntervalAnsweredCalls'];this[_0xd7a2('0x31')]=_0xe2feee[_0xd7a2('0x31')];this[_0xd7a2('0x32')]=_0xe2feee[_0xd7a2('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0xe2feee[_0xd7a2('0x33')];this[_0xd7a2('0x34')]=_0xe2feee[_0xd7a2('0x34')];this[_0xd7a2('0x35')]=_0xe2feee[_0xd7a2('0x35')];this[_0xd7a2('0x36')]=_0xe2feee[_0xd7a2('0x36')];this[_0xd7a2('0x37')]=_0xe2feee[_0xd7a2('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0xe2feee[_0xd7a2('0x38')];this[_0xd7a2('0x39')]=_0xe2feee[_0xd7a2('0x39')];this[_0xd7a2('0x3a')]=_0xe2feee['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0xe2feee[_0xd7a2('0x3b')];this['originated']=_0xe2feee[_0xd7a2('0x8')];this[_0xd7a2('0x3c')]=_0xe2feee['erlangCalls'];this[_0xd7a2('0x3d')]=_0xe2feee[_0xd7a2('0x3d')];this[_0xd7a2('0x3e')]=_0xe2feee[_0xd7a2('0x3e')];this[_0xd7a2('0x3f')]=_0xe2feee[_0xd7a2('0x3f')];this[_0xd7a2('0x40')]=_0xe2feee['startPredictive'];this['startProgressive']=_0xe2feee[_0xd7a2('0x41')];this[_0xd7a2('0x42')]=_0xe2feee['message'];this[_0xd7a2('0x43')]=_0xe2feee[_0xd7a2('0x43')];}if(_0xe2feee[_0xd7a2('0x44')]){this[_0xd7a2('0x44')]={'id':_0xe2feee[_0xd7a2('0x44')]['id'],'name':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x45')],'active':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x46')],'callerid':_0xe2feee['Trunk'][_0xd7a2('0x47')]};}}VoiceQueueSummary[_0xd7a2('0x48')]['createReport']=function(_0x509e00,_0x5c86bd,_0xa77a40,_0x305a63){this[_0xd7a2('0x2')]=0x0;this[_0xd7a2('0x5')]=0x0;this[_0xd7a2('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xd7a2('0x7')]=0x0;this[_0xd7a2('0x19')]=0x0;this[_0xd7a2('0x1a')]=0x0;this[_0xd7a2('0x1f')]=0x0;this['ringing']=0x0;this[_0xd7a2('0x1d')]=0x0;this[_0xd7a2('0x1b')]=0x0;if(_0xa77a40){if(_0xa77a40[_0xd7a2('0x0')]){this[_0xd7a2('0x0')]=Number(_0xa77a40['available']);}if(_0xa77a40[_0xd7a2('0x49')]){this[_0xd7a2('0x1')]=Number(_0xa77a40['loggedin']);}if(_0xa77a40['callers']){this['waiting']=Number(_0xa77a40[_0xd7a2('0x4a')]);}}for(var _0x1b8416=0x0;_0x1b8416<_0x509e00[_0xd7a2('0x4b')];_0x1b8416++){var _0x287426=_0x5c86bd[_0xd7a2('0x4c')+_0x509e00[_0x1b8416][_0xd7a2('0x45')]];if(_0x287426&&_0x287426['online']){this[_0xd7a2('0x2')]+=0x1;}if(_0x509e00[_0x1b8416]['incall']==='1'){this[_0xd7a2('0x5')]+=0x1;}if(_0x509e00[_0x1b8416][_0xd7a2('0x3')]==='1'&&!['2','7','8']['includes'](_0x509e00[_0x1b8416][_0xd7a2('0x4d')])){this[_0xd7a2('0x3')]+=0x1;}switch(_0x509e00[_0x1b8416][_0xd7a2('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xd7a2('0x1c')]+=0x1;break;case'2':this[_0xd7a2('0x7')]+=0x1;break;case'3':this[_0xd7a2('0x19')]+=0x1;break;case'4':this[_0xd7a2('0x1a')]+=0x1;break;case'5':this[_0xd7a2('0x1f')]+=0x1;break;case'6':this[_0xd7a2('0x4')]+=0x1;break;case'7':this[_0xd7a2('0x1d')]+=0x1;break;case'8':this[_0xd7a2('0x1b')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x3c5c54=Object[_0xd7a2('0x4e')](_0x305a63);for(var _0x5a282c=0x0;_0x5a282c<_0x3c5c54[_0xd7a2('0x4b')];_0x5a282c++){var _0x4cbf90=_0x3c5c54[_0x5a282c];var _0x4382d6=_0x305a63[_0x4cbf90];if(_0x4382d6[_0xd7a2('0x4f')]===this[_0xd7a2('0x45')]&&_0x4382d6[_0xd7a2('0x22')]===_0xd7a2('0x50')&&_0x4382d6[_0xd7a2('0x51')]===_0xd7a2('0x52')){this['talking']+=0x1;}}if(this[_0xd7a2('0x5')]>this[_0xd7a2('0x7')]){this['talking']=this[_0xd7a2('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xd7a2('0x48')]['compareToInboundQueue']=function(_0x357ce0){var _0xc420a8=![];if(_0x357ce0){_0xc420a8=INBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x89824d){return this[_0x89824d]!==_0x357ce0[_0x89824d];},this);}return _0xc420a8;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x54')]=function(_0x213f6e){var _0x2d9d5d=![];var _0x1bb573=![];var _0x2f3ec5=![];if(_0x213f6e){_0x2d9d5d=this[_0xd7a2('0x25')]!==_0x213f6e[_0xd7a2('0x25')]||this[_0xd7a2('0x24')]!==_0x213f6e[_0xd7a2('0x24')]||this[_0xd7a2('0x42')]!==_0x213f6e[_0xd7a2('0x42')]||this['statusMessage']!==_0x213f6e['statusMessage'];_0x1bb573=OUTBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x466c30){return this[_0x466c30]!==_0x213f6e[_0x466c30];},this);if(this[_0xd7a2('0x44')]&&_0x213f6e[_0xd7a2('0x44')]){_0x2f3ec5=this[_0xd7a2('0x44')][_0xd7a2('0x45')]!==_0x213f6e[_0xd7a2('0x44')][_0xd7a2('0x45')]||this[_0xd7a2('0x44')][_0xd7a2('0x46')]!==_0x213f6e[_0xd7a2('0x44')]['active'];}}return _0x2d9d5d||_0x1bb573||_0x2f3ec5;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x55')]=function(_0x28751e){this[_0xd7a2('0x18')]=_0x28751e[_0xd7a2('0x18')];this['message']=_0x28751e[_0xd7a2('0x42')];this[_0xd7a2('0x43')]=_0x28751e[_0xd7a2('0x43')];this['originated']=_0x28751e['originated'];this['outboundAbandonedCallsDay']=_0x28751e[_0xd7a2('0x56')];this[_0xd7a2('0x9')]=_0x28751e[_0xd7a2('0x9')];this['outboundBlacklistCallsDay']=_0x28751e[_0xd7a2('0xa')];this['outboundBusyCallsDay']=_0x28751e[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0x28751e[_0xd7a2('0xc')];this[_0xd7a2('0xd')]=_0x28751e[_0xd7a2('0xd')];this[_0xd7a2('0xe')]=_0x28751e['outboundNoSuchCallsDay'];this[_0xd7a2('0xf')]=_0x28751e[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0x28751e['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x28751e[_0xd7a2('0x11')];this[_0xd7a2('0x13')]=_0x28751e[_0xd7a2('0x13')];this['sumDuration']=_0x28751e[_0xd7a2('0x14')];this[_0xd7a2('0x15')]=_0x28751e[_0xd7a2('0x15')];if(this[_0xd7a2('0x25')]===_0xd7a2('0x57')){this[_0xd7a2('0x12')]=_0x28751e[_0xd7a2('0x12')];}};module[_0xd7a2('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 82e887b..eed26f8 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 _0x3339=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x3339,0xf0));var _0x9333=function(_0x596b22,_0x1a2593){_0x596b22=_0x596b22-0x0;var _0x509cbb=_0x3339[_0x596b22];return _0x509cbb;};'use strict';function VtigerAccount(_0x4236c6){this['id']=_0x4236c6['id']||0x0;this[_0x9333('0x0')]=_0x4236c6[_0x9333('0x0')]||'';this['username']=_0x4236c6[_0x9333('0x1')]||'';this[_0x9333('0x2')]=_0x4236c6['accessKey']||'';this['remoteUri']=_0x4236c6[_0x9333('0x3')]||'';this[_0x9333('0x4')]=_0x4236c6['serverUrl']||'';this[_0x9333('0x5')]=_0x4236c6['Configurations']||{};}module[_0x9333('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe299=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xe299,0x78));var _0x9e29=function(_0x20ae87,_0x3e9885){_0x20ae87=_0x20ae87-0x0;var _0x62d57d=_0xe299[_0x20ae87];return _0x62d57d;};'use strict';function VtigerAccount(_0x9c970){this['id']=_0x9c970['id']||0x0;this['name']=_0x9c970[_0x9e29('0x0')]||'';this[_0x9e29('0x1')]=_0x9c970[_0x9e29('0x1')]||'';this[_0x9e29('0x2')]=_0x9c970[_0x9e29('0x2')]||'';this['remoteUri']=_0x9c970[_0x9e29('0x3')]||'';this[_0x9e29('0x4')]=_0x9c970[_0x9e29('0x4')]||'';this[_0x9e29('0x5')]=_0x9c970[_0x9e29('0x5')]||{};}module[_0x9e29('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 83f4cee..5566888 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 _0xde30=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0xa4b8e1,_0x49d30b){var _0x507e42=function(_0xca2abc){while(--_0xca2abc){_0xa4b8e1['push'](_0xa4b8e1['shift']());}};_0x507e42(++_0x49d30b);}(_0xde30,0x15e));var _0x0de3=function(_0x53dbaf,_0x534a3c){_0x53dbaf=_0x53dbaf-0x0;var _0x5b74ed=_0xde30[_0x53dbaf];return _0x5b74ed;};'use strict';function ZendeskAccount(_0x49212d){this['id']=_0x49212d['id']||0x0;this['name']=_0x49212d[_0x0de3('0x0')]||'';this[_0x0de3('0x1')]=_0x49212d['username']||'';this[_0x0de3('0x2')]=_0x49212d[_0x0de3('0x2')]||'';this[_0x0de3('0x3')]=_0x49212d[_0x0de3('0x3')]||'';this[_0x0de3('0x4')]=_0x49212d['remoteUri']||'';this[_0x0de3('0x5')]=_0x49212d[_0x0de3('0x5')]||'';this[_0x0de3('0x6')]=_0x49212d[_0x0de3('0x6')]||_0x0de3('0x7');this['serverUrl']=_0x49212d[_0x0de3('0x8')]||'';this[_0x0de3('0x9')]=_0x49212d[_0x0de3('0x9')]||{};}module[_0x0de3('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xd14c=['password','token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0xd14c,0xa1));var _0xcd14=function(_0x57605e,_0x323f35){_0x57605e=_0x57605e-0x0;var _0x369842=_0xd14c[_0x57605e];return _0x369842;};'use strict';function ZendeskAccount(_0x1ec6a5){this['id']=_0x1ec6a5['id']||0x0;this[_0xcd14('0x0')]=_0x1ec6a5[_0xcd14('0x0')]||'';this['username']=_0x1ec6a5['username']||'';this[_0xcd14('0x1')]=_0x1ec6a5[_0xcd14('0x1')]||'';this[_0xcd14('0x2')]=_0x1ec6a5['token']||'';this['remoteUri']=_0x1ec6a5[_0xcd14('0x3')]||'';this[_0xcd14('0x4')]=_0x1ec6a5['authType']||'';this['type']=_0x1ec6a5['type']||_0xcd14('0x5');this[_0xcd14('0x6')]=_0x1ec6a5[_0xcd14('0x6')]||'';this[_0xcd14('0x7')]=_0x1ec6a5[_0xcd14('0x7')]||{};}module[_0xcd14('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ceb2b4e..27457ae 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 _0x3b48=['code','refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0xc45596,_0x5c410e){var _0x425ffe=function(_0x3c327d){while(--_0x3c327d){_0xc45596['push'](_0xc45596['shift']());}};_0x425ffe(++_0x5c410e);}(_0x3b48,0x130));var _0x83b4=function(_0x2461ba,_0x53d2ea){_0x2461ba=_0x2461ba-0x0;var _0x356f18=_0x3b48[_0x2461ba];return _0x356f18;};'use strict';function ZohoAccount(_0x3d7053){this['id']=_0x3d7053['id']||0x0;this[_0x83b4('0x0')]=_0x3d7053[_0x83b4('0x0')]||'';this['description']=_0x3d7053['description']||'';this['host']=_0x3d7053[_0x83b4('0x1')]||'';this['zone']=_0x3d7053[_0x83b4('0x2')]||'';this[_0x83b4('0x3')]=_0x3d7053[_0x83b4('0x3')]||'';this[_0x83b4('0x4')]=_0x3d7053[_0x83b4('0x4')]||'';this[_0x83b4('0x5')]=_0x3d7053['serverUrl']||'';this['code']=_0x3d7053[_0x83b4('0x6')]||'';this[_0x83b4('0x7')]=_0x3d7053[_0x83b4('0x7')]||'';this[_0x83b4('0x8')]=_0x3d7053[_0x83b4('0x8')]||{};}module[_0x83b4('0x9')]=ZohoAccount; \ No newline at end of file +var _0xf964=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x1b6f10,_0x7daab2){var _0x3a6ed5=function(_0x41c4e9){while(--_0x41c4e9){_0x1b6f10['push'](_0x1b6f10['shift']());}};_0x3a6ed5(++_0x7daab2);}(_0xf964,0x152));var _0x4f96=function(_0x37737c,_0x17bcce){_0x37737c=_0x37737c-0x0;var _0x3a403e=_0xf964[_0x37737c];return _0x3a403e;};'use strict';function ZohoAccount(_0x5b8d63){this['id']=_0x5b8d63['id']||0x0;this[_0x4f96('0x0')]=_0x5b8d63[_0x4f96('0x0')]||'';this[_0x4f96('0x1')]=_0x5b8d63[_0x4f96('0x1')]||'';this[_0x4f96('0x2')]=_0x5b8d63['host']||'';this[_0x4f96('0x3')]=_0x5b8d63[_0x4f96('0x3')]||'';this[_0x4f96('0x4')]=_0x5b8d63[_0x4f96('0x4')]||'';this[_0x4f96('0x5')]=_0x5b8d63[_0x4f96('0x5')]||'';this[_0x4f96('0x6')]=_0x5b8d63[_0x4f96('0x6')]||'';this['code']=_0x5b8d63[_0x4f96('0x7')]||'';this[_0x4f96('0x8')]=_0x5b8d63[_0x4f96('0x8')]||'';this[_0x4f96('0x9')]=_0x5b8d63[_0x4f96('0x9')]||{};}module[_0x4f96('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 0ac67dc..c36c3fb 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 _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x36eede,_0x2fa917){var _0x11dbb0=function(_0x31066e){while(--_0x31066e){_0x36eede['push'](_0x36eede['shift']());}};_0x11dbb0(++_0x2fa917);}(_0xe820,0xd2));var _0x0e82=function(_0x3cdd49,_0x31a518){_0x3cdd49=_0x3cdd49-0x0;var _0x3d62b5=_0xe820[_0x3cdd49];return _0x3d62b5;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file +var _0x7d25=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','uniqueid','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x7ced95,_0x350af8){var _0x1296b3=function(_0x5c5331){while(--_0x5c5331){_0x7ced95['push'](_0x7ced95['shift']());}};_0x1296b3(++_0x350af8);}(_0x7d25,0x8a));var _0x57d2=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x7d25[_0x4e7d25];return _0x526fe6;};'use strict';var util=require('util');var _=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));function checkNameSurname(_0x35bca8,_0x286bd3,_0x34bad5){var _0x56e08b='';if(!_[_0x57d2('0x2')](_0x286bd3)&&'string'===typeof _0x286bd3){_0x56e08b+=_0x286bd3;}if(!_['isNil'](_0x34bad5)&&'string'===typeof _0x34bad5){_0x56e08b+='\x20'+_0x34bad5;}if(_0x56e08b!==''){return _0x56e08b;}return _0x35bca8;}function Action(_0x5dea84,_0x3c5511,_0x49cc5f,_0x1f43b2,_0x263d35){this[_0x57d2('0x3')]=_0x49cc5f||undefined;this['idContact']=_0x5dea84['id'];this['queue']=_0x3c5511[_0x57d2('0x4')];this['type']=_0x3c5511[_0x57d2('0x5')];this[_0x57d2('0x6')]=_0x57d2('0x7');this['dialAnswer']=![];this[_0x57d2('0x8')]=_[_0x57d2('0x2')](_0x5dea84[_0x57d2('0x9')])?undefined:_0x5dea84[_0x57d2('0x9')][_0x57d2('0x4')];this[_0x57d2('0xa')]=this[_0x57d2('0x8')]?util[_0x57d2('0xb')](_0x57d2('0xc'),this[_0x57d2('0x8')]):_0x1f43b2||undefined;this[_0x57d2('0xd')]=checkNameSurname(_0x5dea84[_0x57d2('0xe')][_0x57d2('0xf')],_0x5dea84[_0x57d2('0xe')][_0x57d2('0x10')],_0x5dea84[_0x57d2('0xe')]['lastName']);this['active']=_0x5dea84[_0x57d2('0x11')]||![];this[_0x57d2('0x12')]=_0x5dea84['phone'];this[_0x57d2('0x13')]=_0x5dea84[_0x57d2('0x13')];this['countbusyretry']=_0x5dea84[_0x57d2('0x14')]||0x0;this['countcongestionretry']=_0x5dea84[_0x57d2('0x15')]||0x0;this['countnoanswerretry']=_0x5dea84[_0x57d2('0x16')]||0x0;this[_0x57d2('0x17')]=(_0x5dea84[_0x57d2('0x14')]||0x0)+(_0x5dea84['countcongestionretry']||0x0)+(_0x5dea84['countnoanswerretry']||0x0)+(_0x5dea84[_0x57d2('0x18')]||0x0)+(_0x5dea84[_0x57d2('0x19')]||0x0)+(_0x5dea84[_0x57d2('0x1a')]||0x0)+(_0x5dea84[_0x57d2('0x1b')]||0x0)+(_0x5dea84['countagentrejectretry']||0x0);this[_0x57d2('0x18')]=_0x5dea84[_0x57d2('0x18')]||0x0;this['countdropretry']=_0x5dea84['countdropretry']||0x0;this[_0x57d2('0x1a')]=_0x5dea84[_0x57d2('0x1a')]||0x0;this[_0x57d2('0x1b')]=_0x5dea84[_0x57d2('0x1b')]||0x0;this[_0x57d2('0x1c')]=_0x5dea84[_0x57d2('0x1c')]||0x0;this[_0x57d2('0x1d')]=_0x5dea84[_0x57d2('0x1d')];this[_0x57d2('0x1e')]=_0x5dea84[_0x57d2('0x1e')];this[_0x57d2('0x1f')]=_0x5dea84[_0x57d2('0x1f')];this[_0x57d2('0x20')]=_0x5dea84[_0x57d2('0x20')];this['ContactId']=_0x5dea84[_0x57d2('0x21')];this[_0x57d2('0x22')]=_0x5dea84[_0x57d2('0x22')];this[_0x57d2('0x23')]=_[_0x57d2('0x2')](_0x5dea84['Agent'])?_0x5dea84[_0x57d2('0x23')]:_0x5dea84[_0x57d2('0x9')]['id'];this[_0x57d2('0x24')]=_0x5dea84[_0x57d2('0x24')];this[_0x57d2('0x25')]='';this[_0x57d2('0x26')]='';}Action[_0x57d2('0x27')]['getCaller']=function(){return util[_0x57d2('0xb')](_0x57d2('0x28'),this[_0x57d2('0xd')],this[_0x57d2('0x29')]);};module[_0x57d2('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e54ad32..81d03c4 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 _0x930d=['ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','trunks','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','logger','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','mandatoryDisposition','channelAgent','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','activeContact','swapAdditionalPhones','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry'];(function(_0x68cae0,_0x7d78cd){var _0x5e7200=function(_0x4a709f){while(--_0x4a709f){_0x68cae0['push'](_0x68cae0['shift']());}};_0x5e7200(++_0x7d78cd);}(_0x930d,0x1c3));var _0xd930=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x930d[_0x53e3de];return _0x7b905b;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0xd930('0x0'));var moment=require(_0xd930('0x1'));var Redis=require(_0xd930('0x2'));var config=require(_0xd930('0x3'));var logger=require('../../../config/logger')(_0xd930('0x4'));var loggerAction=require(_0xd930('0x5'))(_0xd930('0x6'));var ami=require('../ami');var rpcDb=require(_0xd930('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xd930('0x8'));var utils=require(_0xd930('0x9'));config[_0xd930('0xa')]=_[_0xd930('0xb')](config['redis'],{'host':_0xd930('0xc'),'port':0x18eb});var io=require(_0xd930('0xd'))(new Redis(config[_0xd930('0xa')]));var Sequence=function(){};Sequence[_0xd930('0xe')]['enqueue']=function(_0x5c951d){this[_0xd930('0xf')]=this['tail']?this[_0xd930('0xf')][_0xd930('0x10')](_0x5c951d):_0x5c951d();};function Preview(_0x4cf65e){this[_0xd930('0x11')]=new Sequence();this['campaignsPreview']=_0x4cf65e['voiceQueues'];this['trunks']=_0x4cf65e[_0xd930('0x12')];this['actions']={};this['agents']=_0x4cf65e[_0xd930('0x13')];this[_0xd930('0x14')]=0x0;ami['on'](_0xd930('0x15'),this['syncOriginateResponse'][_0xd930('0x16')](this));ami['on']('hangup',this[_0xd930('0x17')]['bind'](this));ami['on']('hanguprequest',this[_0xd930('0x18')][_0xd930('0x16')](this));ami['on'](_0xd930('0x19'),this[_0xd930('0x1a')][_0xd930('0x16')](this));ami['on'](_0xd930('0x1b'),this[_0xd930('0x1c')][_0xd930('0x16')](this));ami['on'](_0xd930('0x1d'),this[_0xd930('0x1e')][_0xd930('0x16')](this));ami['on']('attendedtransfer',this[_0xd930('0x1f')][_0xd930('0x16')](this));ami['on'](_0xd930('0x20'),this[_0xd930('0x21')]['bind'](this));this['loopCampaigns'](this[_0xd930('0x22')]);}function emit(_0x75cf24,_0x112784,_0x182db5){io['to'](_0x75cf24)['emit'](_0x112784,_0x182db5);}function emitVoiceQueueChannelRemove(_0x5b0068){logger[_0xd930('0x23')](_0xd930('0x24'),JSON['stringify'](_0x5b0068));emit(util[_0xd930('0x25')](_0xd930('0x26'),_0x5b0068[_0xd930('0x27')]),_0xd930('0x28'),_0x5b0068);io[_0xd930('0x29')](_0xd930('0x2a'),_0x5b0068);}function notSendMessagesQueue(_0x14de4c){if(_0x14de4c[_0xd930('0x2b')]){if(_0x14de4c[_0xd930('0x2c')]===0x0&&_0x14de4c[_0xd930('0x2d')]===0x0){_0x14de4c['sendMessageOneNotActive']=![];_0x14de4c['available']=0x0;_0x14de4c[_0xd930('0x2e')]=0x0;_0x14de4c[_0xd930('0x2f')]=utils['CAMPAIGN_STATUS'][_0xd930('0x30')];ut['logger'](_0xd930('0x31'),_0x14de4c[_0xd930('0x27')]+_0xd930('0x32'));}else{_0x14de4c[_0xd930('0x2f')]=utils[_0xd930('0x33')]['DEACTIVATED'];ut[_0xd930('0x34')](_0xd930('0x31'),_0x14de4c[_0xd930('0x27')]+'\x20is\x20deactivated');}}}Preview[_0xd930('0xe')][_0xd930('0x35')]=function(){var _0x53ae99=this;setInterval(function(){_0x53ae99[_0xd930('0x36')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x214706=this[_0xd930('0x22')];this['clockClearZombieChannels']+=0x1;for(var _0x3c2807 in _0x214706){if(_0x214706[_0xd930('0x37')](_0x3c2807)&&(_0x214706[_0x3c2807][_0xd930('0x38')]===_0xd930('0x4')||_0x214706[_0x3c2807]['dialMethod']===_0xd930('0x39'))&&_0x214706[_0x3c2807]['type']===_0xd930('0x3a')){if(this['clockClearZombieChannels']>0x7){this[_0xd930('0x14')]=0x0;this[_0xd930('0x3b')]();}}if(_0x214706[_0xd930('0x37')](_0x3c2807)&&_0x214706[_0x3c2807]['dialMethod']===_0xd930('0x4')&&_0x214706[_0x3c2807][_0xd930('0x3c')]==='outbound'){if(_0x214706[_0x3c2807][_0xd930('0x3d')]){this['setMessage'](_0x214706[_0x3c2807]);if(_0x214706[_0x3c2807]['dialPreviewAutoRecallMe'])this[_0xd930('0x3e')](_0x214706[_0x3c2807]);}else{notSendMessagesQueue(_0x214706[_0x3c2807]);}}}};Preview[_0xd930('0xe')][_0xd930('0x3f')]=function(_0x53764c){var _0x231094=this;this[_0xd930('0x11')]['enqueue'](function(){if(!_[_0xd930('0x40')](_0x231094['actions'][_0x53764c])){loggerAction['info'](_0xd930('0x41'),_0x53764c,_0xd930('0x42'),_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')],_0xd930('0x45'),JSON[_0xd930('0x46')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]][_0xd930('0x2c')]),_0xd930('0x47'),JSON['stringify'](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]][_0xd930('0x2d')]),JSON[_0xd930('0x46')](_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x48')]),JSON[_0xd930('0x46')](_[_0xd930('0x49')](_0x231094[_0xd930('0x43')][_0x53764c],[_0xd930('0x4a'),_0xd930('0x4b'),_0xd930('0x4c'),'ListId'])));return ami['Action']({'action':_0xd930('0x4d'),'channel':_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x4e')]})[_0xd930('0x4f')](function(_0x420e81){if(_0x420e81[_0xd930('0x2f')]===_0xd930('0x50')){setTimeout(function(){if(_0x231094[_0xd930('0x43')][_0x53764c]){utils[_0xd930('0x51')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]],_0xd930('0x52'));if(_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x48')]===!![]){ut[_0xd930('0x53')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c]['queue']],_0xd930('0x52'));ut[_0xd930('0x54')](_0xd930('0x55')+_0x53764c,_0x231094[_0xd930('0x43')][_0x53764c]['queue']);}ut[_0xd930('0x54')](_0xd930('0x56')+_0x53764c,_0x231094[_0xd930('0x43')][_0x53764c]['queue']);delete _0x231094['actions'][_0x53764c];}},0x2328);}});}});};Preview['prototype'][_0xd930('0x3b')]=function(){var _0x3ae58a=this;loggerAction[_0xd930('0x23')](_0xd930('0x57'),_['size'](this['actions']));for(var _0x5b02aa in this[_0xd930('0x43')]){if(_0x3ae58a[_0xd930('0x43')][_0xd930('0x37')](_0x5b02aa)){_0x3ae58a[_0xd930('0x3f')](_0x5b02aa);}}};Preview[_0xd930('0xe')]['recallMe']=function(_0x222180){var _0x215a5b=this;rpcDb['getContactRecallMe'](_0x222180['id'],ut['agentReadyId'](this[_0xd930('0x13')]))['then'](function(_0x375293){if(!_[_0xd930('0x40')](_0x375293)){for(var _0x411312=0x0;_0x411312<_0x375293[_0xd930('0x58')];_0x411312+=0x1){if(ut[_0xd930('0x59')](_0x375293[_0x411312][_0xd930('0x5a')])<_0x222180[_0xd930('0x5b')]*0x3c){if(_0x375293[_0x411312][_0xd930('0x5c')]&&!_0x375293[_0x411312][_0xd930('0x5c')][_0xd930('0x5d')]){_0x215a5b[_0xd930('0x5e')](_0x375293[_0x411312]['id'])[_0xd930('0x5f')](ut[_0xd930('0x60')]('[RecallMe]'))[_0xd930('0x4f')](ut[_0xd930('0x60')](_0xd930('0x61')));}else{rpcDb['disableContact'](_0x375293[_0x411312]['id']);}}else{var _0x2306ff=new Action(_0x375293[_0x411312],_0x222180);_0x2306ff['starttime']=moment()[_0xd930('0x25')](_0xd930('0x62'));_0x222180['outboundReCallsDay']+=0x1;ut[_0xd930('0x63')](_0x2306ff,0x17,_0xd930('0x64'));if(_0x222180['dialRecallInQueue']){rpcDb[_0xd930('0x65')](ut['createBody'](_0x375293[_0x411312]));rpcDb[_0xd930('0x66')](_0x2306ff,_0xd930('0x67'));}else{ut['logCustomer'](_0x2306ff,0x16,_0xd930('0x68'));rpcDb[_0xd930('0x66')](_0x2306ff,_0xd930('0x69'));rpcDb[_0xd930('0x6a')](_0x2306ff,'[HistoryRecallClose]');}}}}})[_0xd930('0x4f')](ut[_0xd930('0x60')]('[getContactRecallMe]'));};Preview['prototype'][_0xd930('0x6b')]=function(_0xba073a){_0xba073a['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0xba073a[_0xd930('0x6c')])){_0xba073a['message']=utils[_0xd930('0x33')][_0xd930('0x6d')];}else if(!ut[_0xd930('0x6e')](_0xba073a['dialActive'])){_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x30')];}else if(!this[_0xd930('0x6f')](_0xba073a[_0xd930('0x70')])){if(!this[_0xd930('0x6f')](_0xba073a['TrunkBackup'])){_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x71')];}else{_0xba073a['message']=utils[_0xd930('0x33')]['ACTIVE'];}}else{_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x72')];}};Preview['prototype'][_0xd930('0x73')]=function(_0x4615af,_0x5b6514,_0x667a5){var _0x541d4d=this;var _0x291cdf=this[_0xd930('0x43')][_0x5b6514];var _0x3cc142=this[_0xd930('0x22')][_0x291cdf['queue']];var _0x3ffec1;var _0x35787d=![];var _0x5b58cf=0x2;var _0x2f39cc=0x3;if(_0x3cc142){switch(_0x667a5){case'1':_0x3cc142[_0xd930('0x74')]+=0x1;_0x291cdf[_0xd930('0x75')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x0,_0xd930('0x78'));ami[_0xd930('0x29')](_0xd930('0x79'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0x7b')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0x7c'));_0x541d4d['verifyAdditionalPhones'](_0x291cdf,'0',_0x3cc142)[_0xd930('0x5f')](function(_0x4d6b58){_0x35787d=_0x4d6b58[_0xd930('0x7d')]==0x1;_0x5b58cf=_0x3cc142['dialNoSuchNumberRetryFrequency'];_0x2f39cc=_0x3cc142['callAdditionalPhoneAfterMin'];if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,'Global');rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0x80'));}else{if(_0x291cdf['countnosuchnumberretry']>=_0x3cc142[_0xd930('0x81')]){rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0x80'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0x75'),_0x3cc142[_0xd930('0x84')]),_0x291cdf[_0xd930('0x85')],_0x291cdf['activeContact']);}}delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];}else{_0x291cdf['countnosuchnumberretry']++;logger[_0xd930('0x23')](_0xd930('0x87'),_0x291cdf[_0xd930('0x75')]);logger[_0xd930('0x23')]('id',_0x291cdf[_0xd930('0x88')]);_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnosuchnumberretry':_0x291cdf['countnosuchnumberretry']}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)['then'](function(){});});}});break;case _0xd930('0x8a'):var _0x354668=moment()['format'](_0xd930('0x62'));_0x291cdf[_0xd930('0x8b')]=_0x354668;_0x291cdf['answertime']=_0x354668;_0x291cdf[_0xd930('0x48')]=!![];_0x3cc142[_0xd930('0x2d')]+=0x1;logger[_0xd930('0x23')](_0xd930('0x8c'),_0x291cdf[_0xd930('0x8d')],_0xd930('0x8e'),_0x3cc142['name'],_0xd930('0x47'),_0x3cc142[_0xd930('0x2d')]);ami[_0xd930('0x29')](_0xd930('0x8f'),ut[_0xd930('0x7a')](_0x291cdf,'connect',this[_0xd930('0x22')][_0x291cdf[_0xd930('0x44')]]));if(_0x3cc142[_0xd930('0x90')]||_0x3cc142[_0xd930('0x91')]){ami[_0xd930('0x29')]('custom:agentConnectPreview',{'queue':_0x291cdf[_0xd930('0x44')],'interface':_0x291cdf[_0xd930('0x92')],'uniqueid':_0x291cdf[_0xd930('0x8d')]});}break;case'16':ami[_0xd930('0x29')](_0xd930('0x93'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0x94'),this[_0xd930('0x22')][_0x291cdf[_0xd930('0x44')]]));emitVoiceQueueChannelRemove(ut[_0xd930('0x7a')](_0x291cdf,'complete'));_0x3cc142['outboundAnswerCallsDay']+=0x1;_0x3cc142[_0xd930('0x95')]+=0x1;_0x3cc142['answered']+=0x1;ut[_0xd930('0x53')](_0x3cc142,'[16]');_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x4,_0xd930('0x96'));rpcDb['createCustomerHistory'](_0x291cdf,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0x97'));rpcDb[_0xd930('0x98')](_0x291cdf);_0x3cc142[_0xd930('0x99')]+=_0x291cdf[_0xd930('0x9a')];_0x3cc142[_0xd930('0x9b')]+=_0x291cdf[_0xd930('0x9a')];logger[_0xd930('0x23')]('[syncHangup][talking][decrement]',_0x291cdf[_0xd930('0x8d')],'\x20Queue',_0x3cc142[_0xd930('0x27')],_0xd930('0x47'),_0x3cc142['pTalking']);delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;case _0xd930('0x9c'):_0x3cc142[_0xd930('0x9d')]+=0x1;_0x291cdf[_0xd930('0x9e')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x5,'Busy');_0x5b58cf=_0x3cc142[_0xd930('0x9f')];_0x2f39cc=_0x3cc142['callAdditionalPhoneAfterMin'];ami[_0xd930('0x29')](_0xd930('0xa0'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xa1')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xa2'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'5',_0x3cc142)[_0xd930('0x5f')](function(_0x3f4b06){_0x35787d=_0x3f4b06[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb['createCustomerFinal'](_0x3ffec1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x291cdf[_0xd930('0x9e')]>=_0x3cc142['dialBusyMaxRetry']){rpcDb[_0xd930('0x6a')](_0x291cdf,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0x9e'),_0x3cc142[_0xd930('0x9f')]),_0x291cdf['unlockAgent'],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0x9e')]++;_0x541d4d['incrementPreviewCounters']({'id':_0x291cdf[_0xd930('0x88')],'field':{'countbusyretry':_0x291cdf[_0xd930('0x9e')]}})['then'](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)['then'](function(){});});}});break;case'NOANSWER':_0x3cc142[_0xd930('0xa7')]+=0x1;_0x291cdf['countnoanswerretry']+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x3,_0xd930('0xa8'));_0x5b58cf=_0x3cc142[_0xd930('0xa9')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];var _0x2dfe05=ut[_0xd930('0xab')](_0x291cdf,_0x3cc142);ami[_0xd930('0x29')](_0xd930('0xac'),_0x2dfe05);rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xad'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'3',_0x3cc142)[_0xd930('0x5f')](function(_0xee84b0){_0x35787d=_0xee84b0[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x291cdf['countnoanswerretry']>=_0x3cc142[_0xd930('0xae')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xad'));}else{rpcDb[_0xd930('0x82')](ut['scheduledAt'](_0x291cdf,_0xd930('0xaf'),_0x3cc142[_0xd930('0xa9')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d['incrementPreviewCounters']({'id':_0x291cdf['idContact'],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xb0'):_0x3cc142[_0xd930('0xb1')]+=0x1;_0x291cdf[_0xd930('0xb2')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x8,_0xd930('0xb3'));_0x5b58cf=_0x3cc142['dialCongestionRetryFrequency'];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];ami[_0xd930('0x29')](_0xd930('0xb4'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xb5')));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xb6'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'8',_0x3cc142)[_0xd930('0x5f')](function(_0x23567e){_0x35787d=_0x23567e[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb['createCustomerFinal'](_0x3ffec1,_0xd930('0xb7'));}else{if(_0x291cdf['countcongestionretry']>=_0x3cc142[_0xd930('0xb8')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xb6'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,'countcongestionretry',_0x3cc142[_0xd930('0x9f')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xb2')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf['idContact'],'field':{'countcongestionretry':_0x291cdf[_0xd930('0xb2')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xb9'):_0x3cc142[_0xd930('0xba')]+=0x1;_0x291cdf[_0xd930('0xbb')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x14,_0xd930('0xbc'));_0x5b58cf=_0x3cc142[_0xd930('0xbd')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];ami['emit'](_0xd930('0xbe'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xbf')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xc0'));_0x541d4d['verifyAdditionalPhones'](_0x291cdf,'20',_0x3cc142)[_0xd930('0x5f')](function(_0x2fa269){_0x35787d=_0x2fa269['additional']==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut['cloneAction'](_0x291cdf,0x14,_0xd930('0xbc'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xc1'));}else{if(_0x291cdf['countagentrejectretry']>=_0x3cc142[_0xd930('0xc2')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xc1'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0xbb'),_0x3cc142[_0xd930('0xbd')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xc3'):_0x3cc142[_0xd930('0xc4')]+=0x1;_0x291cdf[_0xd930('0xc5')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut['totalGlobal'](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0xb,_0xd930('0xc6'));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xc7'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'11',_0x3cc142)[_0xd930('0x5f')](function(_0x3aa715){_0x35787d=_0x3aa715[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142['dialGlobalMaxRetry']){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xc7'));}else{if(_0x291cdf[_0xd930('0xc8')]>=_0x3cc142[_0xd930('0xc9')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xc7'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0xc5'),_0x3cc142[_0xd930('0xca')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf['countnoanswerretry']}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case'18':_0x3cc142[_0xd930('0xcb')]+=0x1;_0x291cdf['countmachineretry']+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x12,_0x4615af[_0xd930('0xcc')]||_0x4615af['dialstatus']);ami['emit'](_0xd930('0xcd'),ut[_0xd930('0x7a')](_0x291cdf,'amd'));rpcDb[_0xd930('0x66')](_0x291cdf,'[callProgressDetectingCustomer][hangupInAMD]');_0x541d4d[_0xd930('0xa3')](_0x291cdf,'18',_0x3cc142)[_0xd930('0x5f')](function(_0x40b7f0){_0x35787d=_0x40b7f0[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut['totalGlobal'](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0x12,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xce'));}else{rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0xce'));}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;case'19':_0x3cc142[_0xd930('0xcb')]+=0x1;_0x291cdf['countglobal']=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x13,_0x4615af[_0xd930('0xcc')]||_0x4615af[_0xd930('0xcf')]);ami[_0xd930('0x29')]('custom:amd',ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xd0')));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xd1'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'18',_0x3cc142)[_0xd930('0x5f')](function(_0x2bd373){_0x35787d=_0x2bd373['additional']==0x1;if(!_0x35787d){if(ut['totalGlobal'](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xd1'));}else{rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xd1'));}}else{_0x291cdf['countnoanswerretry']++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;default:if(_0x291cdf['dialAnswer']){ut[_0xd930('0x53')](_0x3cc142,'[default]');ut[_0xd930('0x54')](_0xd930('0xd2')+_0x3cc142[_0xd930('0x27')],_0x4615af);}_0x3cc142['outboundUnknownCallsDay']+=0x1;_0x291cdf[_0xd930('0x76')]=ut['totalGlobal'](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0xc,_0x4615af[_0xd930('0xcc')]||_0x4615af[_0xd930('0xcf')]);_0x5b58cf=_0x3cc142[_0xd930('0xbd')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xd3'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'20',_0x3cc142)[_0xd930('0x5f')](function(_0x27bdba){_0x35787d=_0x27bdba[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142['dialGlobalMaxRetry']){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xd4'));}delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];}else{_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});}});}if(!(_0x291cdf['dialAnswer']&&_0x667a5==='16')){utils[_0xd930('0x51')](_0x3cc142,_0xd930('0xd5'));logger[_0xd930('0x23')](_0xd930('0xd6'),_0x291cdf[_0xd930('0x8d')],_0xd930('0x8e'),_0x3cc142[_0xd930('0x27')],'originated:\x20',_0x3cc142[_0xd930('0x2c')]);}if(_0x667a5!==_0xd930('0x8a')){delete this['actions'][_0x4615af['linkedid']];delete this['actions'][_0x4615af['destlinkedid']];}_0x3cc142[_0xd930('0xd7')]=!![];}};Preview[_0xd930('0xe')][_0xd930('0xd8')]=function(_0x52cf8c,_0x5e8040,_0x318e0f){if(_['isUndefined'](_0x5e8040)&&'object'!==typeof _0x5e8040){return;}if(_[_0xd930('0xd9')](_0x318e0f)&&_0xd930('0xda')!==typeof _0x318e0f){return;}switch(_0x318e0f[_0xd930('0xdb')]){case'0':ut['logAgent'](_0x52cf8c,0x0,_0xd930('0x78'));rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xdd'));break;case'3':ut[_0xd930('0xde')](_0x52cf8c,0x3,_0xd930('0xa8'));rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xdf'));break;case'5':ut[_0xd930('0xde')](_0x52cf8c,0x5,_0xd930('0xe0'));rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xd930('0xde')](_0x52cf8c,0x8,_0xd930('0xb3'));rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd930('0xde')](_0x52cf8c,0x16,'AnswerAGI');rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd930('0xde')](_0x52cf8c,0xc,_0x318e0f['reason']);rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xe1'));}utils['decrementOriginate'](_0x5e8040,_0xd930('0xe2'));logger[_0xd930('0x23')](_0xd930('0xe3'),_0x52cf8c[_0xd930('0x8d')],_0xd930('0x8e'),_0x5e8040['name'],_0xd930('0x45'),_0x5e8040[_0xd930('0x2c')]);delete this[_0xd930('0x43')][_0x52cf8c[_0xd930('0x8d')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x114963,_0x3b189d,_0x21b3c7){return cmHopperAdditionalPhone[_0xd930('0xa3')](_0x114963,_0x3b189d,_0x21b3c7)['catch'](logger[_0xd930('0x23')](_0xd930('0xe4')));};Preview[_0xd930('0xe')][_0xd930('0xa6')]=function(_0x22a21e,_0x6941a1,_0xe38aee){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x22a21e,_0x6941a1,_0xe38aee)['catch'](logger[_0xd930('0x23')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xd930('0x89')]=function(_0x22fa47){return Promise[_0xd930('0xe5')]()[_0xd930('0x5f')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x22fa47))[_0xd930('0x4f')](logger['info'](_0xd930('0xe6')));};Preview['prototype']['checkInBlack']=function(_0x320042,_0x1b717c,_0x3e7db7,_0x2df9e3,_0x4ee5ed){var _0xe84e5=this;return new Promise(function(_0x2cd048,_0x4a8c4f){if(_[_0xd930('0x40')](_0x1b717c)||_['isNil'](_0x1b717c[_0xd930('0xe7')])||_[_0xd930('0x40')](_0x1b717c[_0xd930('0xe8')])||_[_0xd930('0x40')](_0x1b717c[_0xd930('0x4c')])){_0x4a8c4f(ut['message'](_0xd930('0xe9'),_0x2df9e3,_0x4ee5ed));return;}var _0x31c448=uuid['v4']();var _0x3b0856=_0xe84e5[_0xd930('0x22')][_0x1b717c['Queue']['name']];var _0x32c70a=_0x3e7db7?_0xe84e5[_0xd930('0x13')][_0x3e7db7]['id']:undefined;_0xe84e5[_0xd930('0x43')][_0x31c448]=new Action(_0x1b717c,_0x3b0856,_0x31c448,_0x3e7db7,_0x32c70a);var _0x5448f8=_0xe84e5[_0xd930('0x43')][_0x31c448];_0x5448f8[_0xd930('0x85')]=_0x2df9e3;_0x5448f8[_0xd930('0xa5')]=_0x4ee5ed;_0x5448f8[_0xd930('0xea')]=_0x3e7db7;if(_[_0xd930('0xeb')](_0x320042)){_0xe84e5[_0xd930('0xec')](_0x5448f8,_0x3b0856,_0x1b717c,_0x3e7db7)[_0xd930('0x5f')](function(_0x2999b0){logger[_0xd930('0x23')](_0xd930('0xed'),_0xd930('0xee')+_0x5448f8[_0xd930('0x44')]+_0xd930('0xef')+_0x5448f8[_0xd930('0x88')],JSON[_0xd930('0x46')](_0x2999b0));ami[_0xd930('0x29')]('custom:agentcalled',ut[_0xd930('0x7a')](_0x5448f8,_0xd930('0xf0'),_0xe84e5[_0xd930('0x22')][_0x5448f8[_0xd930('0x44')]]));_0x2cd048(ut[_0xd930('0x2f')](_0xd930('0xf1')));})[_0xd930('0x4f')](function(_0x383668){ut[_0xd930('0x34')](_0xd930('0xf2'),_0x383668);_0x4a8c4f(ut[_0xd930('0x2f')](_0xd930('0xf3'),_0x2df9e3,_0x4ee5ed));});}else{_0x3b0856[_0xd930('0xf4')]+=0x1;ut[_0xd930('0xf5')](_0x5448f8);rpcDb[_0xd930('0xf6')](_0x5448f8,_0xd930('0xf7'));delete _0xe84e5['actions'][_0x31c448];_0x4a8c4f(ut[_0xd930('0x2f')]('Contact\x20in\x20black\x20List',_0x2df9e3,_0x4ee5ed));}});};Preview[_0xd930('0xe')][_0xd930('0x6f')]=function(_0x4853ea){return!_[_0xd930('0x40')](_0x4853ea)&&!_[_0xd930('0x40')](_0x4853ea[_0xd930('0x27')])&&!_[_0xd930('0x40')](_0x4853ea[_0xd930('0xf8')])&&_0x4853ea[_0xd930('0xf8')]&&!_[_0xd930('0x40')](this[_0xd930('0x12')][util['format'](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])])&&!_[_0xd930('0x40')](this[_0xd930('0x12')][util[_0xd930('0x25')]('SIP/%s',_0x4853ea[_0xd930('0x27')])]['status'])&&(this[_0xd930('0x12')][util[_0xd930('0x25')](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])]['status']===_0xd930('0xfa')||this[_0xd930('0x12')][util[_0xd930('0x25')](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])][_0xd930('0x4d')]==='unmonitored');};Preview[_0xd930('0xe')][_0xd930('0x5e')]=function(_0x532283,_0x611fe5){return this['execRun'](_0x532283,_0x611fe5)[_0xd930('0x5f')](function(_0x46e478){return _[_0xd930('0x49')](_0x46e478,[_0xd930('0x2f')]);})[_0xd930('0x4f')](function(_0x4cddc6){if(_0x4cddc6[_0xd930('0xfb')]){rpcDb[_0xd930('0xfc')](_0x532283);}if(_0x4cddc6[_0xd930('0xf8')]){rpcDb[_0xd930('0xfd')](_0x532283);}throw _[_0xd930('0x49')](_0x4cddc6,[_0xd930('0x2f')]);});};Preview[_0xd930('0xe')][_0xd930('0xfe')]=function(_0x4baf91,_0x267def){var _0x3f3f5f=this;var _0x41389c,_0x1b256f;return rpcDb[_0xd930('0xff')](_0x4baf91)['then'](function(_0x10c36e){if(!_[_0xd930('0x40')](_0x10c36e[0x0])){_0x1b256f=_0x10c36e[0x0][_0xd930('0x100')]?![]:!![];_0x41389c=_0x10c36e[0x0][_0xd930('0x100')]?!![]:![];_0x41389c=_0x267def?!![]:_0x41389c;}var _0xd14e8f=_0x3f3f5f[_0xd930('0x101')](_0x10c36e);if(_0xd14e8f['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x10c36e[0x0],['VoiceQueueId','phone']))[_0xd930('0x5f')](function(_0x43d2f3){_0x3f3f5f['checkInBlack'](_0x43d2f3,_0x10c36e[0x0],_0x267def,_0x1b256f,_0x41389c)[_0xd930('0x5f')](function(_0x4db6a9){return _0x4db6a9;})[_0xd930('0x4f')](function(_0x5b0e85){throw _0x5b0e85;});})['catch'](function(_0x503d1d){ut['logger'](_0xd930('0x102'),_0x503d1d);throw ut['message']('Call\x20unsuccessful',_0x1b256f,_0x41389c);});}else{throw ut[_0xd930('0x2f')](_0xd14e8f[_0xd930('0x2f')],_0x1b256f,_0x41389c);}})[_0xd930('0x4f')](function(_0x5e09b7){ut['logger'](_0xd930('0x103'),_0x5e09b7);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xd930('0xe')][_0xd930('0x101')]=function(_0x30bfaa){if(_['isNil'](_0x30bfaa)||_['isEmpty'](_0x30bfaa)||!_[_0xd930('0x40')](_0x30bfaa[0x0][_0xd930('0x5c')])&&_[_0xd930('0x40')](_0x30bfaa[0x0][_0xd930('0x5c')][_0xd930('0x27')])){ut[_0xd930('0x34')](_0xd930('0x104'),_0x30bfaa);return{'isValid':![],'message':_0xd930('0x105')};}var _0x303d35=this['campaignsPreview'][_0x30bfaa[0x0]['Queue'][_0xd930('0x27')]];_0x303d35[_0xd930('0x2f')]=utils[_0xd930('0x33')]['ACTIVE'];if(_['isNil'](_0x303d35)){ut[_0xd930('0x34')]('[Preview][validateContact][Empty\x20Campaign]',_0x303d35);return{'isValid':![],'message':_0xd930('0x106')};}if(!this[_0xd930('0x6f')](_0x303d35[_0xd930('0x70')])){ut[_0xd930('0x34')](_0xd930('0x107'),'campaign\x20Name:\x20'+_0x303d35[_0xd930('0x27')]+_0xd930('0x108'));if(!this['isTrunkReachable'](_0x303d35[_0xd930('0x109')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x303d35[_0xd930('0x27')]+_0xd930('0x10a'));return{'isValid':![],'message':_0xd930('0x10b')};}}if(!ut['isActive'](_0x303d35[_0xd930('0x3d')])){ut[_0xd930('0x34')](_0xd930('0x10c'),_0x303d35[_0xd930('0x27')]+_0xd930('0x10d'));return{'isValid':![],'message':_0xd930('0x10e')+_0x303d35[_0xd930('0x27')]+_0xd930('0x10d')};}return{'isValid':!![],'message':_0xd930('0x10f')};};Preview[_0xd930('0xe')][_0xd930('0xec')]=function(_0x358004,_0x21ede1,_0xd52918,_0x49e512){var _0x377226=this;return new Promise(function(_0x534514,_0x2519e1){var _0x423d26=_0x358004['uniqueid'];var _0x3be54e=_0x377226[_0xd930('0x6f')](_0x21ede1[_0xd930('0x70')])?util[_0xd930('0x25')](_0xd930('0x110'),_0x21ede1[_0xd930('0x70')]['name'],_[_0xd930('0x40')](_0x21ede1[_0xd930('0x111')])?'':_0x21ede1[_0xd930('0x111')][_0xd930('0x112')]()||'',_0x21ede1['dialCutDigit']>0x0?_0xd52918['phone'][_0xd930('0x113')](_0x21ede1[_0xd930('0x114')]):_0xd52918[_0xd930('0xe8')]):util[_0xd930('0x25')](_0xd930('0x110'),_[_0xd930('0x40')](_0x21ede1[_0xd930('0x109')])?_0x21ede1[_0xd930('0x70')][_0xd930('0x27')]:_0x21ede1['TrunkBackup']['name'],_['isNil'](_0x21ede1['dialPrefix'])?'':_0x21ede1['dialPrefix'][_0xd930('0x112')]()||'',_0x21ede1['dialCutDigit']>0x0?_0xd52918[_0xd930('0xe8')]['substring'](_0x21ede1[_0xd930('0x114')]):_0xd52918['phone']);var _0x557e2b=_0x377226['isTrunkReachable'](_0x21ede1[_0xd930('0x70')])?ut[_0xd930('0x115')](_0x21ede1[_0xd930('0x70')][_0xd930('0x116')],_0x21ede1[_0xd930('0x117')],_0x21ede1[_0xd930('0x118')]>0x0?ut[_0xd930('0x119')](_0x21ede1['dialOriginateCallerIdNumber'],_0x21ede1[_0xd930('0x118')]):_0x21ede1[_0xd930('0x11a')]):ut[_0xd930('0x115')](_[_0xd930('0x40')](_0x21ede1[_0xd930('0x109')])?_0x21ede1['Trunk']['callerid']:_0x21ede1[_0xd930('0x109')][_0xd930('0x116')],_0x21ede1[_0xd930('0x117')],_0x21ede1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd930('0x119')](_0x21ede1[_0xd930('0x11a')],_0x21ede1[_0xd930('0x118')]):_0x21ede1[_0xd930('0x11a')]);if(_0x557e2b){_0x358004[_0xd930('0x11b')]=ut[_0xd930('0x11c')](_0x557e2b);_0x358004[_0xd930('0x11d')]=ut[_0xd930('0x11e')](_0x557e2b);}var _0xac10f6=ut[_0xd930('0x11f')](_0x21ede1,_0xd52918,_0x3be54e,_0x557e2b,_0x423d26,_0x358004);var _0x63ab9b=utils[_0xd930('0x120')](_0xd52918[_0xd930('0xe7')]);Object[_0xd930('0x121')](_0xac10f6,_0x63ab9b);_[_0xd930('0x122')](_0x358004,ut[_0xd930('0x123')](_0xac10f6));_0x358004[_0xd930('0x124')]=moment()[_0xd930('0x25')]('YYYY-MM-DD\x20HH:mm:ss');_0x21ede1[_0xd930('0x125')]=_0xac10f6;var _0x5b6444=ut['variablesAction'](_0x358004,_0x21ede1,_0xac10f6,_0x358004[_0xd930('0xa5')],_0x49e512);return ami[_0xd930('0x126')](_0x5b6444)[_0xd930('0x5f')](function(_0x514b7b){_0x21ede1[_0xd930('0x2c')]+=0x1;logger[_0xd930('0x23')](_0xd930('0x127'),_0x423d26,_0xd930('0x8e'),_0x21ede1[_0xd930('0x27')],'originated:\x20',_0x21ede1[_0xd930('0x2c')]);_0x534514(_0x514b7b);})[_0xd930('0x4f')](function(_0x37c67c){ut['logAgent'](_0x358004,0xe,_0xd930('0x128'));rpcDb['createAgentHistory'](_0x358004,_0xd930('0x129'));_0x2519e1(_0x37c67c);});});};Preview[_0xd930('0xe')][_0xd930('0x1c')]=function(_0x161bb6){if(this[_0xd930('0x43')][_0x161bb6[_0xd930('0x86')]]){this[_0xd930('0x43')][_0x161bb6[_0xd930('0x86')]][_0xd930('0x4e')]=_0x161bb6['channel'];}};Preview[_0xd930('0xe')][_0xd930('0x12a')]=function(_0x237be3){var _0x3e1b99=this;var _0x5d1bda=this[_0xd930('0x43')][_0x237be3[_0xd930('0x12b')]];if(_0x5d1bda){if(_0x5d1bda[_0xd930('0xea')]&&this[_0xd930('0x13')][_0x5d1bda['lookAgent']]){ut[_0xd930('0x12c')](_0x5d1bda,this['agents'][_0x5d1bda[_0xd930('0xea')]][_0xd930('0x27')],this[_0xd930('0x13')][_0x5d1bda[_0xd930('0xea')]]['id']);}var _0x5f13f4=_['clone'](_0x5d1bda);_0x5f13f4[_0xd930('0x8b')]=moment()[_0xd930('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4990ca=_0x3e1b99[_0xd930('0x22')][_0x5d1bda[_0xd930('0x44')]];if(ut[_0xd930('0x12d')](_0x237be3[_0xd930('0x12e')])){if(_0x5d1bda[_0xd930('0x85')]){rpcDb[_0xd930('0xfc')](_0x5d1bda['idContact']);}if(_0x5d1bda[_0xd930('0xa5')]){rpcDb['disableContact'](_0x5d1bda[_0xd930('0x88')]);}ami[_0xd930('0x29')](_0xd930('0x12f'),ut['buildObj'](_0x5d1bda,'rejected',this[_0xd930('0x22')][_0x5d1bda['queue']]));this[_0xd930('0xd8')](_0x5f13f4,_0x4990ca,_0x237be3);}else{_0x5d1bda[_0xd930('0x124')]=moment()[_0xd930('0x25')](_0xd930('0x62'));ut[_0xd930('0xde')](_0x5f13f4,0x4,_0xd930('0x96'));rpcDb[_0xd930('0xdc')](_0x5f13f4,_0xd930('0x130'));}}};Preview['prototype'][_0xd930('0x17')]=function(_0x493e20){var _0x556c4a=this['actions'][_0x493e20[_0xd930('0x86')]];var _0xd8d0e7;if(_0x556c4a){_0xd8d0e7=this[_0xd930('0x22')][_0x556c4a['queue']];logger[_0xd930('0x23')](_0xd930('0x131'),_0x493e20[_0xd930('0x86')],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],_0xd930('0x47'),_0xd8d0e7[_0xd930('0x2d')]);}if(this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]]&&_0x493e20['linkedid']!==_0x493e20[_0xd930('0x8d')]){if(_0x493e20[_0xd930('0x132')]==='16'&&this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){this[_0xd930('0x73')](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')]);}else if(this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){logger[_0xd930('0x23')](_0xd930('0x133'),_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')],'\x20Queue',_0xd8d0e7[_0xd930('0x27')],_0xd930('0x47'),_0xd8d0e7['pTalking']);this[_0xd930('0x73')](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')]);}}else if(_0x556c4a&&_['isNil'](_0x556c4a[_0xd930('0x134')])&&_0xd8d0e7[_0xd930('0x135')]&&_0x493e20[_0xd930('0x86')]===_0x493e20[_0xd930('0x8d')]&&_[_0xd930('0x40')](_0x493e20[_0xd930('0xdb')])&&_0x493e20['cause']==='16'&&_0x493e20[_0xd930('0x136')]==='6'&&_[_0xd930('0xd9')](_0x556c4a[_0xd930('0x137')])){if(_0x556c4a['unlockAgent']){rpcDb[_0xd930('0xfc')](_0x556c4a['idContact']);}if(_0x556c4a['activeContact']){rpcDb[_0xd930('0xfd')](_0x556c4a[_0xd930('0x88')]);}_0x493e20['reason']='22';this[_0xd930('0xd8')](_0x556c4a,_0xd8d0e7,_0x493e20);}else if(_0x556c4a&&_0x556c4a[_0xd930('0x137')]){if(_0x493e20[_0xd930('0x132')]==='16'&&this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]]['dialAnswer']){logger[_0xd930('0x23')](_0xd930('0x138'),_0x493e20[_0xd930('0x86')],_0x493e20['cause'],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],'pTalking:\x20',_0xd8d0e7[_0xd930('0x2d')]);this[_0xd930('0x73')](_0x493e20,_0x493e20['linkedid'],_0x493e20[_0xd930('0x132')]);}else if(this['actions'][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){logger[_0xd930('0x23')]('[syncHangup][talking][cause]',_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],'pTalking:\x20',_0xd8d0e7[_0xd930('0x2d')]);this['callProgressDetectingCustomer'](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20['cause']);}}};Preview[_0xd930('0xe')][_0xd930('0x1a')]=function(_0x3891e5){if(this[_0xd930('0x43')][_0x3891e5['destlinkedid']]&&_0x3891e5[_0xd930('0x139')]!==_0x3891e5[_0xd930('0x13a')]){this[_0xd930('0x73')](_0x3891e5,_0x3891e5[_0xd930('0x139')],_0x3891e5[_0xd930('0xcf')]);}};Preview['prototype']['syncHangupRequest']=function(_0x352a26){if(this[_0xd930('0x43')][_0x352a26['linkedid']]&&_0x352a26['linkedid']!==_0x352a26[_0xd930('0x8d')]&&!this[_0xd930('0x43')][_0x352a26[_0xd930('0x86')]][_0xd930('0x48')]){if(_0x352a26['cause']==='1'){this[_0xd930('0x73')](_0x352a26,_0x352a26[_0xd930('0x86')],_0x352a26['cause']);}}};Preview[_0xd930('0xe')][_0xd930('0x13b')]=function(_0x5ead01,_0x1489e9,_0x2acb2d){if(this['actions'][_0x5ead01]){if(_['isNil'](this[_0xd930('0x43')][_0x5ead01][_0xd930('0x125')])){this['actions'][_0x5ead01][_0xd930('0x125')]={};}this[_0xd930('0x43')][_0x5ead01][_0xd930('0x125')][_0x1489e9]=_0x2acb2d;}};Preview[_0xd930('0xe')][_0xd930('0x1e')]=function(_0x439b65){try{if(!_[_0xd930('0x40')](_0x439b65)){if(ut['filterKey'](_[_0xd930('0x13c')](_0x439b65['variable'])[0x0])){this[_0xd930('0x13b')](_0x439b65[_0xd930('0x8d')],_[_0xd930('0x13c')](_0x439b65['variable'])[0x0],_0x439b65[_0xd930('0x13d')]);}}}catch(_0xd7c678){logger[_0xd930('0x13e')](_0xd930('0x13f'),util['inspect'](_0xd7c678,{'showHidden':![],'depth':null}));}};Preview[_0xd930('0xe')][_0xd930('0x1f')]=function(_0x3e28a4){if(_0x3e28a4){if(this[_0xd930('0x43')][_0x3e28a4[_0xd930('0x140')]]){this['actions'][_0x3e28a4[_0xd930('0x140')]]['transfer']=!![];}}};Preview[_0xd930('0xe')][_0xd930('0x21')]=function(_0x3260e8){if(_0x3260e8){if(this['actions'][_0x3260e8[_0xd930('0x141')]]){this[_0xd930('0x43')][_0x3260e8[_0xd930('0x141')]][_0xd930('0x137')]=!![];}}};module[_0xd930('0x142')]=Preview; \ No newline at end of file +var _0xffe6=['attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','message','INACTIVE','logger','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','UserId','ListId','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','CAMPAIGN_STATUS','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','decrementTalking','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','newexten','syncNewExten','varset','syncVarSet'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xffe6,0x126));var _0x6ffe=function(_0x517b3c,_0x3d8077){_0x517b3c=_0x517b3c-0x0;var _0x4538a1=_0xffe6[_0x517b3c];return _0x4538a1;};'use strict';var util=require(_0x6ffe('0x0'));var _=require(_0x6ffe('0x1'));var uuid=require(_0x6ffe('0x2'));var moment=require(_0x6ffe('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x6ffe('0x4'));var rpcDb=require(_0x6ffe('0x5'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x6ffe('0x6'));var ut=require(_0x6ffe('0x7'));var utils=require('../dialer/utils');config['redis']=_[_0x6ffe('0x8')](config[_0x6ffe('0x9')],{'host':_0x6ffe('0xa'),'port':0x18eb});var io=require(_0x6ffe('0xb'))(new Redis(config[_0x6ffe('0x9')]));var Sequence=function(){};Sequence[_0x6ffe('0xc')][_0x6ffe('0xd')]=function(_0x195593){this[_0x6ffe('0xe')]=this['tail']?this['tail'][_0x6ffe('0xf')](_0x195593):_0x195593();};function Preview(_0x4afac4){this[_0x6ffe('0x10')]=new Sequence();this[_0x6ffe('0x11')]=_0x4afac4[_0x6ffe('0x12')];this[_0x6ffe('0x13')]=_0x4afac4[_0x6ffe('0x13')];this['actions']={};this[_0x6ffe('0x14')]=_0x4afac4['agents'];this[_0x6ffe('0x15')]=0x0;ami['on']('originateresponse',this[_0x6ffe('0x16')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x18'),this[_0x6ffe('0x19')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0x6ffe('0x1b'),this['syncDialEnd'][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1c'),this[_0x6ffe('0x1d')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1e'),this[_0x6ffe('0x1f')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x20'),this[_0x6ffe('0x21')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x22'),this['syncBlindTransfer'][_0x6ffe('0x17')](this));this[_0x6ffe('0x23')](this[_0x6ffe('0x11')]);}function emit(_0x3bd041,_0x4b353f,_0x54462d){io['to'](_0x3bd041)[_0x6ffe('0x24')](_0x4b353f,_0x54462d);}function emitVoiceQueueChannelRemove(_0x95a2c5){logger[_0x6ffe('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6ffe('0x26')](_0x95a2c5));emit(util[_0x6ffe('0x27')](_0x6ffe('0x28'),_0x95a2c5[_0x6ffe('0x29')]),_0x6ffe('0x2a'),_0x95a2c5);io[_0x6ffe('0x24')]('voice_queue_presence:remove',_0x95a2c5);}function notSendMessagesQueue(_0x20c9c8){if(_0x20c9c8[_0x6ffe('0x2b')]){if(_0x20c9c8[_0x6ffe('0x2c')]===0x0&&_0x20c9c8['pTalking']===0x0){_0x20c9c8[_0x6ffe('0x2b')]=![];_0x20c9c8[_0x6ffe('0x2d')]=0x0;_0x20c9c8[_0x6ffe('0x2e')]=0x0;_0x20c9c8[_0x6ffe('0x2f')]=utils['CAMPAIGN_STATUS'][_0x6ffe('0x30')];ut[_0x6ffe('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x20c9c8[_0x6ffe('0x29')]+'\x20is\x20not\x20active');}else{_0x20c9c8[_0x6ffe('0x2f')]=utils['CAMPAIGN_STATUS'][_0x6ffe('0x32')];ut[_0x6ffe('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x20c9c8[_0x6ffe('0x29')]+_0x6ffe('0x33'));}}}Preview[_0x6ffe('0xc')][_0x6ffe('0x23')]=function(){var _0x420627=this;setInterval(function(){_0x420627[_0x6ffe('0x34')]();},0x7cf);};Preview['prototype'][_0x6ffe('0x34')]=function(){var _0x2ca965=this['campaignsPreview'];this[_0x6ffe('0x15')]+=0x1;for(var _0x33de7c in _0x2ca965){if(_0x2ca965[_0x6ffe('0x35')](_0x33de7c)&&(_0x2ca965[_0x33de7c][_0x6ffe('0x36')]===_0x6ffe('0x37')||_0x2ca965[_0x33de7c][_0x6ffe('0x36')]===_0x6ffe('0x38'))&&_0x2ca965[_0x33de7c][_0x6ffe('0x39')]===_0x6ffe('0x3a')){if(this[_0x6ffe('0x15')]>0x7){this[_0x6ffe('0x15')]=0x0;this[_0x6ffe('0x3b')]();}}if(_0x2ca965[_0x6ffe('0x35')](_0x33de7c)&&_0x2ca965[_0x33de7c]['dialMethod']===_0x6ffe('0x37')&&_0x2ca965[_0x33de7c][_0x6ffe('0x39')]===_0x6ffe('0x3a')){if(_0x2ca965[_0x33de7c][_0x6ffe('0x3c')]){this['setMessage'](_0x2ca965[_0x33de7c]);if(_0x2ca965[_0x33de7c][_0x6ffe('0x3d')])this[_0x6ffe('0x3e')](_0x2ca965[_0x33de7c]);}else{notSendMessagesQueue(_0x2ca965[_0x33de7c]);}}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x3f')]=function(_0x5b898d){var _0x35a0b0=this;this[_0x6ffe('0x10')][_0x6ffe('0xd')](function(){if(!_[_0x6ffe('0x40')](_0x35a0b0['actions'][_0x5b898d])){loggerAction[_0x6ffe('0x25')](_0x6ffe('0x41'),_0x5b898d,'Queue',_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')],_0x6ffe('0x44'),JSON[_0x6ffe('0x26')](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]['queue']][_0x6ffe('0x2c')]),_0x6ffe('0x45'),JSON[_0x6ffe('0x26')](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0['actions'][_0x5b898d][_0x6ffe('0x43')]][_0x6ffe('0x46')]),JSON[_0x6ffe('0x26')](_0x35a0b0['actions'][_0x5b898d][_0x6ffe('0x47')]),JSON['stringify'](_[_0x6ffe('0x48')](_0x35a0b0[_0x6ffe('0x42')][_0x5b898d],['contactId',_0x6ffe('0x49'),'VoiceQueueId',_0x6ffe('0x4a')])));return ami['Action']({'action':'status','channel':_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x4b')]})[_0x6ffe('0x4c')](function(_0x59cd2b){if(_0x59cd2b[_0x6ffe('0x2f')]===_0x6ffe('0x4d')){setTimeout(function(){if(_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]){utils['decrementOriginate'](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]],_0x6ffe('0x4e'));if(_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]['dialAnswer']===!![]){ut['decrementTalking'](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]],_0x6ffe('0x4e'));ut[_0x6ffe('0x4f')](_0x6ffe('0x50')+_0x5b898d,_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]);}ut['loggerError'](_0x6ffe('0x51')+_0x5b898d,_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]);delete _0x35a0b0['actions'][_0x5b898d];}},0x2328);}});}});};Preview['prototype'][_0x6ffe('0x3b')]=function(){var _0x497d8a=this;loggerAction[_0x6ffe('0x25')](_0x6ffe('0x52'),_['size'](this[_0x6ffe('0x42')]));for(var _0x40be0b in this[_0x6ffe('0x42')]){if(_0x497d8a[_0x6ffe('0x42')]['hasOwnProperty'](_0x40be0b)){_0x497d8a[_0x6ffe('0x3f')](_0x40be0b);}}};Preview[_0x6ffe('0xc')]['recallMe']=function(_0x38b026){var _0x1981c0=this;rpcDb[_0x6ffe('0x53')](_0x38b026['id'],ut[_0x6ffe('0x54')](this[_0x6ffe('0x14')]))['then'](function(_0x394bff){if(!_[_0x6ffe('0x40')](_0x394bff)){for(var _0x3a8041=0x0;_0x3a8041<_0x394bff[_0x6ffe('0x55')];_0x3a8041+=0x1){if(ut[_0x6ffe('0x56')](_0x394bff[_0x3a8041][_0x6ffe('0x57')])<_0x38b026[_0x6ffe('0x58')]*0x3c){if(_0x394bff[_0x3a8041][_0x6ffe('0x59')]&&!_0x394bff[_0x3a8041][_0x6ffe('0x59')][_0x6ffe('0x5a')]){_0x1981c0[_0x6ffe('0x5b')](_0x394bff[_0x3a8041]['id'])['then'](ut['logger2'](_0x6ffe('0x5c')))[_0x6ffe('0x4c')](ut[_0x6ffe('0x5d')](_0x6ffe('0x5c')));}else{rpcDb[_0x6ffe('0x5e')](_0x394bff[_0x3a8041]['id']);}}else{var _0x2d239e=new Action(_0x394bff[_0x3a8041],_0x38b026);_0x2d239e[_0x6ffe('0x5f')]=moment()[_0x6ffe('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x38b026[_0x6ffe('0x60')]+=0x1;ut[_0x6ffe('0x61')](_0x2d239e,0x17,'RecallInQueue');if(_0x38b026[_0x6ffe('0x62')]){rpcDb[_0x6ffe('0x63')](ut['createBody'](_0x394bff[_0x3a8041]));rpcDb[_0x6ffe('0x64')](_0x2d239e,_0x6ffe('0x65'));}else{ut[_0x6ffe('0x61')](_0x2d239e,0x16,'RecallFailedTimeout');rpcDb[_0x6ffe('0x64')](_0x2d239e,_0x6ffe('0x66'));rpcDb[_0x6ffe('0x67')](_0x2d239e,'[HistoryRecallClose]');}}}}})[_0x6ffe('0x4c')](ut[_0x6ffe('0x5d')](_0x6ffe('0x68')));};Preview[_0x6ffe('0xc')][_0x6ffe('0x69')]=function(_0x396e09){_0x396e09[_0x6ffe('0x2b')]=!![];if(ut[_0x6ffe('0x6a')](_0x396e09[_0x6ffe('0x6b')])){_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')][_0x6ffe('0x6d')];}else if(!ut[_0x6ffe('0x6e')](_0x396e09[_0x6ffe('0x3c')])){_0x396e09['message']=utils[_0x6ffe('0x6c')][_0x6ffe('0x30')];}else if(!this[_0x6ffe('0x6f')](_0x396e09[_0x6ffe('0x70')])){if(!this['isTrunkReachable'](_0x396e09[_0x6ffe('0x71')])){_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')][_0x6ffe('0x72')];}else{_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')]['ACTIVE'];}}else{_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')]['ACTIVE'];}};Preview[_0x6ffe('0xc')][_0x6ffe('0x73')]=function(_0x36fc8b,_0x11db18,_0x4f98d9){var _0x3621e6=this;var _0xfba65=this['actions'][_0x11db18];var _0x1f5ffd=this[_0x6ffe('0x11')][_0xfba65['queue']];var _0xb3c9f2;var _0xc392e5=![];var _0x116d22=0x2;var _0x379934=0x3;if(_0x1f5ffd){switch(_0x4f98d9){case'1':_0x1f5ffd[_0x6ffe('0x74')]+=0x1;_0xfba65[_0x6ffe('0x75')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x0,_0x6ffe('0x77'));ami[_0x6ffe('0x24')]('custom:agentnosuchnumber',ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x79')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0x7a'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'0',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x1f19cf){_0xc392e5=_0x1f19cf[_0x6ffe('0x7d')]==0x1;_0x116d22=_0x1f5ffd[_0x6ffe('0x7e')];_0x379934=_0x1f5ffd['callAdditionalPhoneAfterMin'];if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut['cloneAction'](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0x82'));}else{if(_0xfba65['countnosuchnumberretry']>=_0x1f5ffd['dialNoSuchNumberMaxRetry']){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0x82'));}else{rpcDb['rescheduleContact'](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0x75'),_0x1f5ffd[_0x6ffe('0x7e')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];}else{_0xfba65['countnosuchnumberretry']++;logger['info'](_0x6ffe('0x87'),_0xfba65[_0x6ffe('0x75')]);logger[_0x6ffe('0x25')]('id',_0xfba65[_0x6ffe('0x88')]);_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnosuchnumberretry':_0xfba65[_0x6ffe('0x75')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case _0x6ffe('0x8a'):var _0x3259ee=moment()[_0x6ffe('0x27')](_0x6ffe('0x8b'));_0xfba65['responsetime']=_0x3259ee;_0xfba65['answertime']=_0x3259ee;_0xfba65['dialAnswer']=!![];_0x1f5ffd[_0x6ffe('0x46')]+=0x1;logger[_0x6ffe('0x25')](_0x6ffe('0x8c'),_0xfba65[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x1f5ffd[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x1f5ffd[_0x6ffe('0x46')]);ami['emit']('custom:agentconnect',ut['buildObj'](_0xfba65,_0x6ffe('0x8f'),this['campaignsPreview'][_0xfba65['queue']]));if(_0x1f5ffd[_0x6ffe('0x90')]||_0x1f5ffd[_0x6ffe('0x91')]){ami[_0x6ffe('0x24')](_0x6ffe('0x92'),{'queue':_0xfba65[_0x6ffe('0x43')],'interface':_0xfba65[_0x6ffe('0x93')],'uniqueid':_0xfba65[_0x6ffe('0x8d')]});}break;case'16':ami[_0x6ffe('0x24')](_0x6ffe('0x94'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x95'),this[_0x6ffe('0x11')][_0xfba65[_0x6ffe('0x43')]]));emitVoiceQueueChannelRemove(ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x95')));_0x1f5ffd[_0x6ffe('0x96')]+=0x1;_0x1f5ffd['total']+=0x1;_0x1f5ffd[_0x6ffe('0x97')]+=0x1;ut[_0x6ffe('0x98')](_0x1f5ffd,'[16]');_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x4,_0x6ffe('0x99'));rpcDb[_0x6ffe('0x64')](_0xfba65,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0xfba65,_0x6ffe('0x9a'));rpcDb[_0x6ffe('0x9b')](_0xfba65);_0x1f5ffd[_0x6ffe('0x9c')]+=_0xfba65[_0x6ffe('0x9d')];_0x1f5ffd[_0x6ffe('0x9e')]+=_0xfba65[_0x6ffe('0x9d')];logger[_0x6ffe('0x25')](_0x6ffe('0x9f'),_0xfba65[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x1f5ffd['name'],_0x6ffe('0x45'),_0x1f5ffd[_0x6ffe('0x46')]);delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];break;case _0x6ffe('0xa0'):_0x1f5ffd['outboundBusyCallsDay']+=0x1;_0xfba65[_0x6ffe('0xa1')]+=0x1;_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x5,_0x6ffe('0xa2'));_0x116d22=_0x1f5ffd['dialBusyRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];ami['emit'](_0x6ffe('0xa4'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xa5')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xa6'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'5',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x48d12b){_0xc392e5=_0x48d12b[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xfba65[_0x6ffe('0xa1')]>=_0x1f5ffd['dialBusyMaxRetry']){rpcDb[_0x6ffe('0x67')](_0xfba65,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xa1'),_0x1f5ffd[_0x6ffe('0xa9')]),_0xfba65[_0x6ffe('0x84')],_0xfba65['activeContact']);}}}else{_0xfba65[_0x6ffe('0xa1')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countbusyretry':_0xfba65['countbusyretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case _0x6ffe('0xaa'):_0x1f5ffd[_0x6ffe('0xab')]+=0x1;_0xfba65[_0x6ffe('0xac')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut['logCustomer'](_0xfba65,0x3,_0x6ffe('0xad'));_0x116d22=_0x1f5ffd[_0x6ffe('0xae')];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];var _0x5c0118=ut[_0x6ffe('0xaf')](_0xfba65,_0x1f5ffd);ami[_0x6ffe('0x24')](_0x6ffe('0xb0'),_0x5c0118);rpcDb['createCustomerHistory'](_0xfba65,'[callProgressDetectingCustomer][logNoAnswer]');_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'3',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x30900f){_0xc392e5=_0x30900f[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut['cloneAction'](_0xfba65,0xf,'Global');rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xb1'));}else{if(_0xfba65[_0x6ffe('0xac')]>=_0x1f5ffd[_0x6ffe('0xb2')]){rpcDb['createCustomerFinal'](_0xfba65,_0x6ffe('0xb3'));}else{rpcDb[_0x6ffe('0xa8')](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0xac'),_0x1f5ffd[_0x6ffe('0xae')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65['countnoanswerretry']++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})['then'](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case _0x6ffe('0xb5'):_0x1f5ffd[_0x6ffe('0xb6')]+=0x1;_0xfba65[_0x6ffe('0xb7')]+=0x1;_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x8,'Congestion');_0x116d22=_0x1f5ffd['dialCongestionRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];ami[_0x6ffe('0x24')](_0x6ffe('0xb8'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xb9')));rpcDb[_0x6ffe('0x64')](_0xfba65,'[callProgressDetectingCustomer][logCongestion]');_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'8',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x2bd882){_0xc392e5=_0x2bd882['additional']==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xfba65['countcongestionretry']>=_0x1f5ffd[_0x6ffe('0xba')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xbb'));}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xb7'),_0x1f5ffd[_0x6ffe('0xa9')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65[_0x6ffe('0xb7')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countcongestionretry':_0xfba65['countcongestionretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case'CANCEL':_0x1f5ffd['outboundRejectCallsDay']+=0x1;_0xfba65['countagentrejectretry']+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x14,_0x6ffe('0xbc'));_0x116d22=_0x1f5ffd['dialAgentRejectRetryFrequency'];_0x379934=_0x1f5ffd['callAdditionalPhoneAfterMin'];ami[_0x6ffe('0x24')](_0x6ffe('0xbd'),ut[_0x6ffe('0x78')](_0xfba65,'agentreject'));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xbe'));_0x3621e6['verifyAdditionalPhones'](_0xfba65,'20',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x218a40){_0xc392e5=_0x218a40[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0x14,_0x6ffe('0xbc'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xbf'));}else{if(_0xfba65['countagentrejectretry']>=_0x1f5ffd[_0x6ffe('0xc0')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xbf'));}else{rpcDb[_0x6ffe('0xa8')](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0xc1'),_0x1f5ffd[_0x6ffe('0xc2')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case'ABANDONED':_0x1f5ffd[_0x6ffe('0xc3')]+=0x1;_0xfba65[_0x6ffe('0xc4')]+=0x1;_0xfba65['countglobal']=ut['totalGlobal'](_0xfba65);ut['logCustomer'](_0xfba65,0xb,_0x6ffe('0xc5'));rpcDb['createCustomerHistory'](_0xfba65,_0x6ffe('0xc6'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'11',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x3c9e10){_0xc392e5=_0x3c9e10[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xc6'));}else{if(_0xfba65[_0x6ffe('0xc7')]>=_0x1f5ffd[_0x6ffe('0xc8')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xc6'));}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xc4'),_0x1f5ffd['dialAbandonedRetryFrequency']),_0xfba65[_0x6ffe('0x84')],_0xfba65['activeContact']);}}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65['idContact'],'field':{'countnoanswerretry':_0xfba65['countnoanswerretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case'18':_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65[_0x6ffe('0xca')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x12,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b['dialstatus']);ami['emit'](_0x6ffe('0xcc'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xcd')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xce'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'18',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x3914e0){_0xc392e5=_0x3914e0[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0x12,_0x6ffe('0x81'));rpcDb['createCustomerFinal'](_0xb3c9f2,_0x6ffe('0xce'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xce'));}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});delete this[_0x6ffe('0x42')][_0x36fc8b['linkedid']];break;case'19':_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65['countglobal']=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x13,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b[_0x6ffe('0xcf')]);ami['emit'](_0x6ffe('0xcc'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xcd')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xd0'));_0x3621e6['verifyAdditionalPhones'](_0xfba65,'18',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x5b6d20){_0xc392e5=_0x5b6d20['additional']==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,'Global');rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xd0'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,'[callProgressDetectingCustomer][machine]');}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6['incrementPreviewCounters']({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];break;default:if(_0xfba65['dialAnswer']){ut[_0x6ffe('0x98')](_0x1f5ffd,_0x6ffe('0xd1'));ut['loggerError'](_0x6ffe('0xd2')+_0x1f5ffd[_0x6ffe('0x29')],_0x36fc8b);}_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0xc,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b[_0x6ffe('0xcf')]);_0x116d22=_0x1f5ffd['dialAgentRejectRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xd3'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'20',_0x1f5ffd)['then'](function(_0x205841){_0xc392e5=_0x205841[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xd4'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xd4'));}delete this['actions'][_0x36fc8b[_0x6ffe('0x86')]];}else{_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});}});}if(!(_0xfba65[_0x6ffe('0x47')]&&_0x4f98d9==='16')){utils[_0x6ffe('0xd5')](_0x1f5ffd,_0x6ffe('0xd6'));logger[_0x6ffe('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0xfba65[_0x6ffe('0x8d')],'\x20Queue',_0x1f5ffd['name'],_0x6ffe('0x44'),_0x1f5ffd[_0x6ffe('0x2c')]);}if(_0x4f98d9!==_0x6ffe('0x8a')){delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];delete this[_0x6ffe('0x42')][_0x36fc8b['destlinkedid']];}_0x1f5ffd[_0x6ffe('0xd7')]=!![];}};Preview[_0x6ffe('0xc')]['callProgressDetectingAgent']=function(_0x498ec3,_0x50251c,_0x7b42c){if(_[_0x6ffe('0xd8')](_0x50251c)&&_0x6ffe('0xd9')!==typeof _0x50251c){return;}if(_[_0x6ffe('0xd8')](_0x7b42c)&&_0x6ffe('0xd9')!==typeof _0x7b42c){return;}switch(_0x7b42c[_0x6ffe('0xda')]){case'0':ut[_0x6ffe('0xdb')](_0x498ec3,0x0,_0x6ffe('0x77'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xdd'));break;case'3':ut[_0x6ffe('0xdb')](_0x498ec3,0x3,'NoAnswer');rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xde'));break;case'5':ut['logAgent'](_0x498ec3,0x5,_0x6ffe('0xa2'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xdf'));break;case'8':ut['logAgent'](_0x498ec3,0x8,_0x6ffe('0xe0'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x6ffe('0xdb')](_0x498ec3,0x16,'AnswerAGI');rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xe1'));break;default:ut['logAgent'](_0x498ec3,0xc,_0x7b42c[_0x6ffe('0xda')]);rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xe2'));}utils['decrementOriginate'](_0x50251c,'[callProgressDetectingAgent]');logger[_0x6ffe('0x25')](_0x6ffe('0xe3'),_0x498ec3[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x50251c[_0x6ffe('0x29')],_0x6ffe('0x44'),_0x50251c[_0x6ffe('0x2c')]);delete this[_0x6ffe('0x42')][_0x498ec3['uniqueid']];};Preview['prototype']['verifyAdditionalPhones']=function(_0x45e369,_0x23afc0,_0x2caa3e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x45e369,_0x23afc0,_0x2caa3e)[_0x6ffe('0x4c')](logger[_0x6ffe('0x25')](_0x6ffe('0xe4')));};Preview[_0x6ffe('0xc')][_0x6ffe('0xb4')]=function(_0x502073,_0x253094,_0x460ad2){return cmHopperAdditionalPhone[_0x6ffe('0xb4')](_0x502073,_0x253094,_0x460ad2)[_0x6ffe('0x4c')](logger['info'](_0x6ffe('0xe5')));};Preview[_0x6ffe('0xc')]['incrementPreviewCounters']=function(_0xf1d1cf){return Promise[_0x6ffe('0xe6')]()[_0x6ffe('0x7c')](cmHopperAdditionalPhone[_0x6ffe('0x89')](_0xf1d1cf))[_0x6ffe('0x4c')](logger[_0x6ffe('0x25')](_0x6ffe('0xe7')));};Preview[_0x6ffe('0xc')][_0x6ffe('0xe8')]=function(_0xc19422,_0x2de4ea,_0x59cd46,_0x29d661,_0x9678af){var _0x50d54f=this;return new Promise(function(_0x1c5f87,_0x2a2b55){if(_[_0x6ffe('0x40')](_0x2de4ea)||_[_0x6ffe('0x40')](_0x2de4ea[_0x6ffe('0xe9')])||_['isNil'](_0x2de4ea[_0x6ffe('0xea')])||_[_0x6ffe('0x40')](_0x2de4ea['VoiceQueueId'])){_0x2a2b55(ut['message'](_0x6ffe('0xeb'),_0x29d661,_0x9678af));return;}var _0x1a23d2=uuid['v4']();var _0x493ae6=_0x50d54f[_0x6ffe('0x11')][_0x2de4ea[_0x6ffe('0xec')][_0x6ffe('0x29')]];var _0x11cb41=_0x59cd46?_0x50d54f['agents'][_0x59cd46]['id']:undefined;_0x50d54f['actions'][_0x1a23d2]=new Action(_0x2de4ea,_0x493ae6,_0x1a23d2,_0x59cd46,_0x11cb41);var _0x556cf3=_0x50d54f[_0x6ffe('0x42')][_0x1a23d2];_0x556cf3[_0x6ffe('0x84')]=_0x29d661;_0x556cf3['activeContact']=_0x9678af;_0x556cf3['lookAgent']=_0x59cd46;if(_[_0x6ffe('0xed')](_0xc19422)){_0x50d54f['execCall'](_0x556cf3,_0x493ae6,_0x2de4ea,_0x59cd46)[_0x6ffe('0x7c')](function(_0x2ad8d0){logger[_0x6ffe('0x25')](_0x6ffe('0xee'),_0x6ffe('0xef')+_0x556cf3[_0x6ffe('0x43')]+'\x20IdHopper:\x20'+_0x556cf3[_0x6ffe('0x88')],JSON[_0x6ffe('0x26')](_0x2ad8d0));ami[_0x6ffe('0x24')]('custom:agentcalled',ut['buildObj'](_0x556cf3,_0x6ffe('0xf0'),_0x50d54f[_0x6ffe('0x11')][_0x556cf3['queue']]));_0x1c5f87(ut[_0x6ffe('0x2f')]('Calling'));})['catch'](function(_0x50476b){ut[_0x6ffe('0x31')](_0x6ffe('0xf1'),_0x50476b);_0x2a2b55(ut[_0x6ffe('0x2f')](_0x6ffe('0xf2'),_0x29d661,_0x9678af));});}else{_0x493ae6[_0x6ffe('0xf3')]+=0x1;ut[_0x6ffe('0xf4')](_0x556cf3);rpcDb[_0x6ffe('0xf5')](_0x556cf3,_0x6ffe('0xf6'));delete _0x50d54f[_0x6ffe('0x42')][_0x1a23d2];_0x2a2b55(ut[_0x6ffe('0x2f')](_0x6ffe('0xf7'),_0x29d661,_0x9678af));}});};Preview[_0x6ffe('0xc')][_0x6ffe('0x6f')]=function(_0x88ada1){return!_[_0x6ffe('0x40')](_0x88ada1)&&!_[_0x6ffe('0x40')](_0x88ada1[_0x6ffe('0x29')])&&!_[_0x6ffe('0x40')](_0x88ada1[_0x6ffe('0xf8')])&&_0x88ada1[_0x6ffe('0xf8')]&&!_[_0x6ffe('0x40')](this[_0x6ffe('0x13')][util[_0x6ffe('0x27')]('SIP/%s',_0x88ada1['name'])])&&!_[_0x6ffe('0x40')](this[_0x6ffe('0x13')][util[_0x6ffe('0x27')](_0x6ffe('0xf9'),_0x88ada1[_0x6ffe('0x29')])][_0x6ffe('0xfa')])&&(this['trunks'][util[_0x6ffe('0x27')]('SIP/%s',_0x88ada1['name'])]['status']===_0x6ffe('0xfb')||this['trunks'][util[_0x6ffe('0x27')](_0x6ffe('0xf9'),_0x88ada1['name'])]['status']===_0x6ffe('0xfc'));};Preview[_0x6ffe('0xc')]['run']=function(_0x213195,_0x5b2f6d){return this[_0x6ffe('0xfd')](_0x213195,_0x5b2f6d)[_0x6ffe('0x7c')](function(_0x1adbb0){return _['pick'](_0x1adbb0,[_0x6ffe('0x2f')]);})[_0x6ffe('0x4c')](function(_0x3e323b){if(_0x3e323b['unlock']){rpcDb['unlockContact'](_0x213195);}if(_0x3e323b[_0x6ffe('0xf8')]){rpcDb[_0x6ffe('0x5e')](_0x213195);}throw _[_0x6ffe('0x48')](_0x3e323b,[_0x6ffe('0x2f')]);});};Preview[_0x6ffe('0xc')][_0x6ffe('0xfd')]=function(_0x2d8e74,_0x5e14a6){var _0x1cf836=this;var _0x3256f7,_0xde2db2;return rpcDb[_0x6ffe('0xfe')](_0x2d8e74)[_0x6ffe('0x7c')](function(_0xdcf73c){if(!_[_0x6ffe('0x40')](_0xdcf73c[0x0])){_0xde2db2=_0xdcf73c[0x0]['recallme']?![]:!![];_0x3256f7=_0xdcf73c[0x0][_0x6ffe('0xff')]?!![]:![];_0x3256f7=_0x5e14a6?!![]:_0x3256f7;}var _0x2c29e5=_0x1cf836[_0x6ffe('0x100')](_0xdcf73c);if(_0x2c29e5[_0x6ffe('0x101')]){rpcDb[_0x6ffe('0x102')](_['pick'](_0xdcf73c[0x0],[_0x6ffe('0x103'),_0x6ffe('0xea')]))[_0x6ffe('0x7c')](function(_0x2673fe){_0x1cf836[_0x6ffe('0xe8')](_0x2673fe,_0xdcf73c[0x0],_0x5e14a6,_0xde2db2,_0x3256f7)[_0x6ffe('0x7c')](function(_0x1a839c){return _0x1a839c;})[_0x6ffe('0x4c')](function(_0x1d780c){throw _0x1d780c;});})[_0x6ffe('0x4c')](function(_0x188109){ut['logger'](_0x6ffe('0x104'),_0x188109);throw ut['message'](_0x6ffe('0x105'),_0xde2db2,_0x3256f7);});}else{throw ut[_0x6ffe('0x2f')](_0x2c29e5['message'],_0xde2db2,_0x3256f7);}})[_0x6ffe('0x4c')](function(_0x2efa26){ut[_0x6ffe('0x31')](_0x6ffe('0x106'),_0x2efa26);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0x6ffe('0xc')][_0x6ffe('0x100')]=function(_0x9ae6fc){if(_[_0x6ffe('0x40')](_0x9ae6fc)||_[_0x6ffe('0xed')](_0x9ae6fc)||!_[_0x6ffe('0x40')](_0x9ae6fc[0x0][_0x6ffe('0x59')])&&_[_0x6ffe('0x40')](_0x9ae6fc[0x0][_0x6ffe('0x59')][_0x6ffe('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x9ae6fc);return{'isValid':![],'message':_0x6ffe('0x107')};}var _0x3faf13=this['campaignsPreview'][_0x9ae6fc[0x0][_0x6ffe('0xec')][_0x6ffe('0x29')]];_0x3faf13['message']=utils[_0x6ffe('0x6c')][_0x6ffe('0x108')];if(_[_0x6ffe('0x40')](_0x3faf13)){ut[_0x6ffe('0x31')]('[Preview][validateContact][Empty\x20Campaign]',_0x3faf13);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x6ffe('0x6f')](_0x3faf13[_0x6ffe('0x70')])){ut[_0x6ffe('0x31')](_0x6ffe('0x109'),_0x6ffe('0x10a')+_0x3faf13['name']+_0x6ffe('0x10b'));if(!this['isTrunkReachable'](_0x3faf13[_0x6ffe('0x71')])){ut[_0x6ffe('0x31')](_0x6ffe('0x109'),_0x3faf13[_0x6ffe('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6ffe('0x10c')};}}if(!ut['isActive'](_0x3faf13[_0x6ffe('0x3c')])){ut[_0x6ffe('0x31')](_0x6ffe('0x10d'),_0x3faf13[_0x6ffe('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x6ffe('0x10a')+_0x3faf13[_0x6ffe('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x6ffe('0x10e')};};Preview[_0x6ffe('0xc')][_0x6ffe('0x10f')]=function(_0x25fbcb,_0x33973c,_0x14e113,_0x4fb42a){var _0x1e7289=this;return new Promise(function(_0x41a80c,_0x1d56f1){var _0x48a6c7=_0x25fbcb['uniqueid'];var _0xdefac4=_0x1e7289[_0x6ffe('0x6f')](_0x33973c[_0x6ffe('0x70')])?util['format']('SIP/%s/%s%s',_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x29')],_[_0x6ffe('0x40')](_0x33973c[_0x6ffe('0x110')])?'':_0x33973c[_0x6ffe('0x110')][_0x6ffe('0x111')]()||'',_0x33973c[_0x6ffe('0x112')]>0x0?_0x14e113['phone'][_0x6ffe('0x113')](_0x33973c['dialCutDigit']):_0x14e113['phone']):util['format']('SIP/%s/%s%s',_[_0x6ffe('0x40')](_0x33973c['TrunkBackup'])?_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x29')]:_0x33973c['TrunkBackup'][_0x6ffe('0x29')],_['isNil'](_0x33973c[_0x6ffe('0x110')])?'':_0x33973c['dialPrefix']['trim']()||'',_0x33973c['dialCutDigit']>0x0?_0x14e113[_0x6ffe('0xea')][_0x6ffe('0x113')](_0x33973c[_0x6ffe('0x112')]):_0x14e113['phone']);var _0xd063ea=_0x1e7289[_0x6ffe('0x6f')](_0x33973c[_0x6ffe('0x70')])?ut[_0x6ffe('0x114')](_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x115')],_0x33973c[_0x6ffe('0x116')],_0x33973c[_0x6ffe('0x117')]>0x0?ut[_0x6ffe('0x118')](_0x33973c[_0x6ffe('0x119')],_0x33973c[_0x6ffe('0x117')]):_0x33973c[_0x6ffe('0x119')]):ut['getCallerId'](_[_0x6ffe('0x40')](_0x33973c[_0x6ffe('0x71')])?_0x33973c[_0x6ffe('0x70')]['callerid']:_0x33973c[_0x6ffe('0x71')][_0x6ffe('0x115')],_0x33973c['dialOriginateCallerIdName'],_0x33973c['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x6ffe('0x118')](_0x33973c[_0x6ffe('0x119')],_0x33973c[_0x6ffe('0x117')]):_0x33973c[_0x6ffe('0x119')]);if(_0xd063ea){_0x25fbcb[_0x6ffe('0x11a')]=ut[_0x6ffe('0x11b')](_0xd063ea);_0x25fbcb[_0x6ffe('0x11c')]=ut[_0x6ffe('0x11d')](_0xd063ea);}var _0x191321=ut[_0x6ffe('0x11e')](_0x33973c,_0x14e113,_0xdefac4,_0xd063ea,_0x48a6c7,_0x25fbcb);var _0x3067aa=utils[_0x6ffe('0x11f')](_0x14e113[_0x6ffe('0xe9')]);Object[_0x6ffe('0x120')](_0x191321,_0x3067aa);_['merge'](_0x25fbcb,ut[_0x6ffe('0x121')](_0x191321));_0x25fbcb[_0x6ffe('0x5f')]=moment()['format'](_0x6ffe('0x8b'));_0x33973c[_0x6ffe('0x122')]=_0x191321;var _0x15440c=ut[_0x6ffe('0x123')](_0x25fbcb,_0x33973c,_0x191321,_0x25fbcb[_0x6ffe('0x85')],_0x4fb42a);return ami['Action'](_0x15440c)['then'](function(_0x1f4e38){_0x33973c['originated']+=0x1;logger[_0x6ffe('0x25')](_0x6ffe('0x124'),_0x48a6c7,_0x6ffe('0x8e'),_0x33973c[_0x6ffe('0x29')],_0x6ffe('0x44'),_0x33973c[_0x6ffe('0x2c')]);_0x41a80c(_0x1f4e38);})[_0x6ffe('0x4c')](function(_0x5110b0){ut['logAgent'](_0x25fbcb,0xe,_0x6ffe('0x125'));rpcDb[_0x6ffe('0xdc')](_0x25fbcb,'[originateFailure][logOriginateFailure]');_0x1d56f1(_0x5110b0);});});};Preview[_0x6ffe('0xc')][_0x6ffe('0x1d')]=function(_0x20b06f){if(this['actions'][_0x20b06f[_0x6ffe('0x86')]]){this[_0x6ffe('0x42')][_0x20b06f[_0x6ffe('0x86')]][_0x6ffe('0x4b')]=_0x20b06f[_0x6ffe('0x4b')];}};Preview[_0x6ffe('0xc')][_0x6ffe('0x16')]=function(_0x5c3b43){var _0x54fe6f=this;var _0x42dd0c=this[_0x6ffe('0x42')][_0x5c3b43[_0x6ffe('0x126')]];if(_0x42dd0c){if(_0x42dd0c[_0x6ffe('0x127')]&&this['agents'][_0x42dd0c['lookAgent']]){ut[_0x6ffe('0x128')](_0x42dd0c,this[_0x6ffe('0x14')][_0x42dd0c[_0x6ffe('0x127')]][_0x6ffe('0x29')],this['agents'][_0x42dd0c['lookAgent']]['id']);}var _0x1198d5=_[_0x6ffe('0x129')](_0x42dd0c);_0x1198d5[_0x6ffe('0x12a')]=moment()[_0x6ffe('0x27')](_0x6ffe('0x8b'));var _0x57dad7=_0x54fe6f[_0x6ffe('0x11')][_0x42dd0c[_0x6ffe('0x43')]];if(ut[_0x6ffe('0x12b')](_0x5c3b43['response'])){if(_0x42dd0c[_0x6ffe('0x84')]){rpcDb[_0x6ffe('0x12c')](_0x42dd0c[_0x6ffe('0x88')]);}if(_0x42dd0c[_0x6ffe('0x85')]){rpcDb['disableContact'](_0x42dd0c[_0x6ffe('0x88')]);}ami[_0x6ffe('0x24')](_0x6ffe('0x12d'),ut[_0x6ffe('0x78')](_0x42dd0c,_0x6ffe('0x12e'),this[_0x6ffe('0x11')][_0x42dd0c['queue']]));this['callProgressDetectingAgent'](_0x1198d5,_0x57dad7,_0x5c3b43);}else{_0x42dd0c[_0x6ffe('0x5f')]=moment()['format'](_0x6ffe('0x8b'));ut[_0x6ffe('0xdb')](_0x1198d5,0x4,'Answer');rpcDb[_0x6ffe('0xdc')](_0x1198d5,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x108b69){var _0x11e11e=this[_0x6ffe('0x42')][_0x108b69['linkedid']];var _0x208153;if(_0x11e11e){_0x208153=this[_0x6ffe('0x11')][_0x11e11e[_0x6ffe('0x43')]];logger[_0x6ffe('0x25')](_0x6ffe('0x12f'),_0x108b69[_0x6ffe('0x86')],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153[_0x6ffe('0x46')]);}if(this[_0x6ffe('0x42')][_0x108b69['linkedid']]&&_0x108b69[_0x6ffe('0x86')]!==_0x108b69[_0x6ffe('0x8d')]){if(_0x108b69[_0x6ffe('0x130')]==='16'&&this[_0x6ffe('0x42')][_0x108b69[_0x6ffe('0x86')]]['dialAnswer']){this[_0x6ffe('0x73')](_0x108b69,_0x108b69['linkedid'],_0x108b69['cause']);}else if(this[_0x6ffe('0x42')][_0x108b69[_0x6ffe('0x86')]][_0x6ffe('0x47')]){logger[_0x6ffe('0x25')](_0x6ffe('0x131'),_0x108b69[_0x6ffe('0x86')],_0x108b69['cause'],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153['pTalking']);this['callProgressDetectingCustomer'](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}}else if(_0x11e11e&&_[_0x6ffe('0x40')](_0x11e11e[_0x6ffe('0x132')])&&_0x208153[_0x6ffe('0x133')]&&_0x108b69[_0x6ffe('0x86')]===_0x108b69[_0x6ffe('0x8d')]&&_[_0x6ffe('0x40')](_0x108b69[_0x6ffe('0xda')])&&_0x108b69[_0x6ffe('0x130')]==='16'&&_0x108b69[_0x6ffe('0x134')]==='6'&&_[_0x6ffe('0xd8')](_0x11e11e[_0x6ffe('0x135')])){if(_0x11e11e[_0x6ffe('0x84')]){rpcDb[_0x6ffe('0x12c')](_0x11e11e[_0x6ffe('0x88')]);}if(_0x11e11e['activeContact']){rpcDb[_0x6ffe('0x5e')](_0x11e11e['idContact']);}_0x108b69['reason']='22';this['callProgressDetectingAgent'](_0x11e11e,_0x208153,_0x108b69);}else if(_0x11e11e&&_0x11e11e[_0x6ffe('0x135')]){if(_0x108b69[_0x6ffe('0x130')]==='16'&&this['actions'][_0x108b69[_0x6ffe('0x86')]][_0x6ffe('0x47')]){logger['info'](_0x6ffe('0x136'),_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153[_0x6ffe('0x46')]);this[_0x6ffe('0x73')](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}else if(this['actions'][_0x108b69['linkedid']]['dialAnswer']){logger['info'](_0x6ffe('0x131'),_0x108b69[_0x6ffe('0x86')],_0x108b69['cause'],'\x20Queue',_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153['pTalking']);this[_0x6ffe('0x73')](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}}};Preview['prototype'][_0x6ffe('0x137')]=function(_0xeeb06c){if(this[_0x6ffe('0x42')][_0xeeb06c['destlinkedid']]&&_0xeeb06c[_0x6ffe('0x138')]!==_0xeeb06c[_0x6ffe('0x139')]){this[_0x6ffe('0x73')](_0xeeb06c,_0xeeb06c[_0x6ffe('0x138')],_0xeeb06c['dialstatus']);}};Preview[_0x6ffe('0xc')]['syncHangupRequest']=function(_0xc4c14d){if(this[_0x6ffe('0x42')][_0xc4c14d[_0x6ffe('0x86')]]&&_0xc4c14d[_0x6ffe('0x86')]!==_0xc4c14d['uniqueid']&&!this[_0x6ffe('0x42')][_0xc4c14d[_0x6ffe('0x86')]][_0x6ffe('0x47')]){if(_0xc4c14d[_0x6ffe('0x130')]==='1'){this[_0x6ffe('0x73')](_0xc4c14d,_0xc4c14d[_0x6ffe('0x86')],_0xc4c14d['cause']);}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x13a')]=function(_0x160da9,_0x29d30e,_0x240d14){if(this['actions'][_0x160da9]){if(_[_0x6ffe('0x40')](this['actions'][_0x160da9][_0x6ffe('0x122')])){this[_0x6ffe('0x42')][_0x160da9][_0x6ffe('0x122')]={};}this[_0x6ffe('0x42')][_0x160da9]['variables'][_0x29d30e]=_0x240d14;}};Preview[_0x6ffe('0xc')][_0x6ffe('0x1f')]=function(_0x27c49a){try{if(!_[_0x6ffe('0x40')](_0x27c49a)){if(ut[_0x6ffe('0x13b')](_['keys'](_0x27c49a[_0x6ffe('0x13c')])[0x0])){this[_0x6ffe('0x13a')](_0x27c49a[_0x6ffe('0x8d')],_[_0x6ffe('0x13d')](_0x27c49a['variable'])[0x0],_0x27c49a[_0x6ffe('0x13e')]);}}}catch(_0x1ac965){logger[_0x6ffe('0x13f')](_0x6ffe('0x140'),util[_0x6ffe('0x141')](_0x1ac965,{'showHidden':![],'depth':null}));}};Preview[_0x6ffe('0xc')][_0x6ffe('0x21')]=function(_0x33819b){if(_0x33819b){if(this[_0x6ffe('0x42')][_0x33819b[_0x6ffe('0x142')]]){this[_0x6ffe('0x42')][_0x33819b[_0x6ffe('0x142')]]['transfer']=!![];}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x143')]=function(_0x4d0222){if(_0x4d0222){if(this[_0x6ffe('0x42')][_0x4d0222[_0x6ffe('0x144')]]){this[_0x6ffe('0x42')][_0x4d0222[_0x6ffe('0x144')]][_0x6ffe('0x135')]=!![];}}};module[_0x6ffe('0x145')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 680f0fb..3ca37fb 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 _0x3c59=['type','uniqueid','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','catch','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x3490e3,_0x32ca0c){var _0x7031d=function(_0x53ac24){while(--_0x53ac24){_0x3490e3['push'](_0x3490e3['shift']());}};_0x7031d(++_0x32ca0c);}(_0x3c59,0xe7));var _0x93c5=function(_0x4d34c7,_0x2c4a29){_0x4d34c7=_0x4d34c7-0x0;var _0x353aed=_0x3c59[_0x4d34c7];return _0x353aed;};'use strict';var util=require(_0x93c5('0x0'));var BPromise=require(_0x93c5('0x1'));var logger=require(_0x93c5('0x2'))(_0x93c5('0x3'));var cmHopper=require(_0x93c5('0x4'));var cmHopperHistory=require(_0x93c5('0x5'));var cmHopperBlack=require(_0x93c5('0x6'));var agentReportPreview=require(_0x93c5('0x7'));var voiceQueueReport=require(_0x93c5('0x8'));function loggerCatch(_0x1eb6b9){return function(_0x266e83){logger['error'](_0x1eb6b9,util[_0x93c5('0x9')](_0x266e83,{'showHidden':![],'depth':null}));};}function create(_0x4f1319){return cmHopperHistory['createHistory'](_0x4f1319)[_0x93c5('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x186dab){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](agentReportPreview[_0x93c5('0xd')](_0x186dab))[_0x93c5('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x541bb1){return cmHopper[_0x93c5('0xe')](_0x541bb1,!![])[_0x93c5('0xa')](loggerCatch(_0x93c5('0xf')));}exports['checkIsBlackList']=function(_0x2a95bd){return cmHopperBlack['checkIsBlackList'](_0x2a95bd)[_0x93c5('0xa')](loggerCatch(_0x93c5('0x10')));};exports[_0x93c5('0x11')]=function(_0x493d38){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](cmHopper[_0x93c5('0x11')](_0x493d38))[_0x93c5('0xa')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x8569b3,_0x4bd0dd){create(_0x8569b3)['catch'](loggerCatch(_0x4bd0dd));moveContact(_0x8569b3)[_0x93c5('0xa')](loggerCatch(_0x4bd0dd));};exports[_0x93c5('0x12')]=function(_0x42cf00,_0x70408e){createAgent(_0x42cf00)[_0x93c5('0xa')](loggerCatch(_0x70408e));};exports['createCustomerHistory']=function(_0x24471e,_0x56b716){create(_0x24471e)['catch'](loggerCatch(_0x56b716));};exports[_0x93c5('0x13')]=function(_0x27bc06,_0x5186c9){moveContact(_0x27bc06)[_0x93c5('0xa')](loggerCatch(_0x5186c9));};exports[_0x93c5('0x14')]=function(_0x24b910,_0x1ff9d5,_0x45104c){if(_0x1ff9d5){_0x24b910[_0x93c5('0x15')]=null;}if(_0x45104c){_0x24b910['active']=![];}return cmHopper[_0x93c5('0x14')](_0x24b910)['catch'](loggerCatch(_0x93c5('0x16')));};exports[_0x93c5('0x17')]=function(_0x287f7e){return cmHopper[_0x93c5('0x17')](_0x287f7e)[_0x93c5('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x27a366){return cmHopper[_0x93c5('0x18')]({'UserId':null},_0x27a366,0x1)['catch'](loggerCatch(_0x93c5('0x19')));};exports[_0x93c5('0x1a')]=function(_0x5c0924){return cmHopper[_0x93c5('0x18')]({'active':![]},_0x5c0924,0x1)['catch'](loggerCatch(_0x93c5('0x1b')));};exports[_0x93c5('0x1c')]=function(_0x3c765e){var _0x33c6ae={};_0x33c6ae[_0x93c5('0x1d')]=_0x3c765e[_0x93c5('0x1d')];_0x33c6ae[_0x93c5('0x1e')]=_0x3c765e[_0x93c5('0x1e')];_0x33c6ae['calleridnum']=_0x3c765e['calleridnum'];_0x33c6ae[_0x93c5('0x1f')]=_0x3c765e[_0x93c5('0x1f')];_0x33c6ae['queue']=_0x3c765e['queue'];_0x33c6ae[_0x93c5('0x20')]=_0x3c765e[_0x93c5('0x21')];_0x33c6ae['queuecallerleaveAt']=_0x3c765e[_0x93c5('0x21')];_0x33c6ae[_0x93c5('0x22')]=0x1;_0x33c6ae[_0x93c5('0x23')]=_0x3c765e[_0x93c5('0x24')];_0x33c6ae[_0x93c5('0x25')]=_0x3c765e[_0x93c5('0x26')];_0x33c6ae[_0x93c5('0x27')]=_0x93c5('0x28');_0x33c6ae[_0x93c5('0x29')]='xcally-motion-preview';_0x33c6ae[_0x93c5('0x2a')]=0x0;_0x33c6ae['assigned']=0x1;_0x33c6ae[_0x93c5('0x2b')]=_0x3c765e[_0x93c5('0x26')];_0x33c6ae[_0x93c5('0x2c')]=_0x93c5('0x2d');return BPromise['resolve']()['then'](voiceQueueReport[_0x93c5('0x2e')](_0x33c6ae))[_0x93c5('0xa')](loggerCatch(_0x93c5('0x2f')));};exports[_0x93c5('0x30')]=function(_0x2a63b1,_0x552143){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](cmHopper['getContactRecallMe'](_0x2a63b1,_0x552143))['catch'](loggerCatch(_0x93c5('0x31')));};exports[_0x93c5('0x32')]=function(_0x3f7586){return cmHopper['rescheduleContact'](_0x3f7586,!![],!![])[_0x93c5('0xa')](loggerCatch(_0x93c5('0x33')));}; \ No newline at end of file +var _0xe77e=['../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','[createHistory]\x20','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper'];(function(_0x5dd293,_0x497bee){var _0xde50a4=function(_0x586246){while(--_0x586246){_0x5dd293['push'](_0x5dd293['shift']());}};_0xde50a4(++_0x497bee);}(_0xe77e,0x1ac));var _0xee77=function(_0xc827ef,_0x5eb01c){_0xc827ef=_0xc827ef-0x0;var _0x2b2e55=_0xe77e[_0xc827ef];return _0x2b2e55;};'use strict';var util=require(_0xee77('0x0'));var BPromise=require(_0xee77('0x1'));var logger=require('../../../config/logger')(_0xee77('0x2'));var cmHopper=require(_0xee77('0x3'));var cmHopperHistory=require(_0xee77('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xee77('0x5'));var voiceQueueReport=require(_0xee77('0x6'));function loggerCatch(_0x2c44e5){return function(_0x4e2734){logger['error'](_0x2c44e5,util['inspect'](_0x4e2734,{'showHidden':![],'depth':null}));};}function create(_0x4d9afa){return cmHopperHistory['createHistory'](_0x4d9afa)['catch'](loggerCatch(_0xee77('0x7')));}function createAgent(_0x33247f){return BPromise['resolve']()[_0xee77('0x8')](agentReportPreview[_0xee77('0x9')](_0x33247f))[_0xee77('0xa')](loggerCatch(_0xee77('0x7')));}function moveContact(_0xd6890d){return cmHopper[_0xee77('0xb')](_0xd6890d,!![])[_0xee77('0xa')](loggerCatch(_0xee77('0xc')));}exports['checkIsBlackList']=function(_0x13eaa4){return cmHopperBlack[_0xee77('0xd')](_0x13eaa4)[_0xee77('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xee77('0xe')]=function(_0x14fd0c){return BPromise[_0xee77('0xf')]()[_0xee77('0x8')](cmHopper[_0xee77('0xe')](_0x14fd0c))[_0xee77('0xa')](loggerCatch(_0xee77('0x10')));};exports[_0xee77('0x9')]=function(_0xe383dc,_0x5f2d70){create(_0xe383dc)[_0xee77('0xa')](loggerCatch(_0x5f2d70));moveContact(_0xe383dc)[_0xee77('0xa')](loggerCatch(_0x5f2d70));};exports[_0xee77('0x11')]=function(_0x5edf02,_0x15ab12){createAgent(_0x5edf02)[_0xee77('0xa')](loggerCatch(_0x15ab12));};exports['createCustomerHistory']=function(_0xfd6744,_0x1af4e8){create(_0xfd6744)['catch'](loggerCatch(_0x1af4e8));};exports[_0xee77('0x12')]=function(_0xfc07d1,_0x4cc925){moveContact(_0xfc07d1)['catch'](loggerCatch(_0x4cc925));};exports[_0xee77('0x13')]=function(_0xeeeb25,_0x512d03,_0x5d7016){if(_0x512d03){_0xeeeb25[_0xee77('0x14')]=null;}if(_0x5d7016){_0xeeeb25[_0xee77('0x15')]=![];}return cmHopper[_0xee77('0x13')](_0xeeeb25)[_0xee77('0xa')](loggerCatch(_0xee77('0x16')));};exports[_0xee77('0x17')]=function(_0x51aadc){return cmHopper[_0xee77('0x17')](_0x51aadc)[_0xee77('0xa')](loggerCatch(_0xee77('0x18')));};exports[_0xee77('0x19')]=function(_0x4c05fb){return cmHopper[_0xee77('0x19')]({'UserId':null},_0x4c05fb,0x1)[_0xee77('0xa')](loggerCatch(_0xee77('0x1a')));};exports['disableContact']=function(_0x76d6c2){return cmHopper[_0xee77('0x19')]({'active':![]},_0x76d6c2,0x1)[_0xee77('0xa')](loggerCatch(_0xee77('0x1b')));};exports[_0xee77('0x1c')]=function(_0x343c7e){var _0x105941={};_0x105941[_0xee77('0x1d')]=_0x343c7e[_0xee77('0x1d')];_0x105941[_0xee77('0x1e')]=_0x343c7e[_0xee77('0x1e')];_0x105941[_0xee77('0x1f')]=_0x343c7e[_0xee77('0x1f')];_0x105941[_0xee77('0x20')]=_0x343c7e[_0xee77('0x20')];_0x105941['queue']=_0x343c7e[_0xee77('0x21')];_0x105941[_0xee77('0x22')]=_0x343c7e[_0xee77('0x23')];_0x105941[_0xee77('0x24')]=_0x343c7e[_0xee77('0x23')];_0x105941['queuecallercomplete']=0x1;_0x105941[_0xee77('0x25')]=_0x343c7e['endtime'];_0x105941[_0xee77('0x26')]=_0x343c7e[_0xee77('0x27')];_0x105941[_0xee77('0x28')]=_0xee77('0x29');_0x105941[_0xee77('0x2a')]=_0xee77('0x2b');_0x105941[_0xee77('0x2c')]=0x0;_0x105941[_0xee77('0x2d')]=0x1;_0x105941[_0xee77('0x2e')]=_0x343c7e['membername'];_0x105941[_0xee77('0x2f')]=_0xee77('0x30');return BPromise['resolve']()[_0xee77('0x8')](voiceQueueReport[_0xee77('0x31')](_0x105941))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x518300,_0x2130e3){return BPromise[_0xee77('0xf')]()[_0xee77('0x8')](cmHopper[_0xee77('0x32')](_0x518300,_0x2130e3))[_0xee77('0xa')](loggerCatch(_0xee77('0x33')));};exports[_0xee77('0x34')]=function(_0xa568dd){return cmHopper[_0xee77('0x13')](_0xa568dd,!![],!![])[_0xee77('0xa')](loggerCatch(_0xee77('0x35')));}; \ 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 c83b2a7..c6622b1 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 _0x50ab=['pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking'];(function(_0x44ad29,_0x24c3f7){var _0x311885=function(_0x52d7dd){while(--_0x52d7dd){_0x44ad29['push'](_0x44ad29['shift']());}};_0x311885(++_0x24c3f7);}(_0x50ab,0x1eb));var _0xb50a=function(_0x3f9fef,_0x3577bf){_0x3f9fef=_0x3f9fef-0x0;var _0x4f29c7=_0x50ab[_0x3f9fef];return _0x4f29c7;};'use strict';var util=require(_0xb50a('0x0'));var _=require(_0xb50a('0x1'));var moment=require(_0xb50a('0x2'));var logger=require(_0xb50a('0x3'))('preview');var ipAgi=process[_0xb50a('0x4')][_0xb50a('0x5')]||_0xb50a('0x6');var utils=require('../../dialer/utils');exports[_0xb50a('0x7')]=function(_0x36dfd){return function(_0x4f1360){logger[_0xb50a('0x8')](_0x36dfd,util['inspect'](_0x4f1360,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0x9')]=function(_0x2f97ba,_0x60b6c5){logger[_0xb50a('0xa')](_0x2f97ba,util[_0xb50a('0xb')](_0x60b6c5,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xc')]=function(_0x22fd68,_0x27e5fc){logger[_0xb50a('0x8')](_0x22fd68,util[_0xb50a('0xb')](_0x27e5fc,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xd')]=function(_0x5d6f5c){return function(_0x5c26be){logger[_0xb50a('0xa')](_0x5d6f5c,util[_0xb50a('0xb')](_0x5c26be,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0xe')]=function(_0x5308b3,_0x471fc9,_0x26f772){return{'message':_0x5308b3,'unlock':_0x471fc9,'active':_0x26f772};};exports['getCallerId']=function(_0x4a139b,_0x12031,_0x448236){if(!_['isUndefined'](_0x448236)&&_0xb50a('0xf')===typeof _0x448236&&!_[_0xb50a('0x10')](_0x448236)){if(!_[_0xb50a('0x11')](_0x12031)&&_0xb50a('0xf')===typeof _0x12031&&!_['isEmpty'](_0x12031)){return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x12031,_0x448236);}return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x448236,_0x448236);}if(!_['isUndefined'](_0x4a139b)&&_0xb50a('0xf')===typeof _0x4a139b&&!_['isEmpty'](_0x4a139b)){return _0x4a139b;}return _0xb50a('0x14');};exports[_0xb50a('0x15')]=function(_0x478299){if(_[_0xb50a('0x16')](_0x478299)){return![];}return _0x478299;};exports[_0xb50a('0x17')]=function(_0xee4cef,_0x35c554,_0x3ccf0c,_0x171c22,_0x275ece,_0x56a0d3){var _0x438249={'XMD-QUEUE':_0x35c554['Queue']?_0x35c554[_0xb50a('0x18')][_0xb50a('0x19')]:'','XMD-CALLERID':_0x171c22,'XMD-CALLERID-PREVIEW':_0x56a0d3?util[_0xb50a('0x12')](_0xb50a('0x13'),_0x56a0d3[_0xb50a('0x1a')],_0x56a0d3[_0xb50a('0x1b')]):_0x171c22,'XMD-DIALID':_0x275ece,'XMD-CONTACTID':_0x35c554[_0xb50a('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x171c22,'XMD-VOICEQUEUEID':_0x35c554['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3ccf0c,'XMD-DIALTIMEOUT':_0xee4cef['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb50a('0x12')]('\x22rtTxX%s%s\x22',_0xee4cef[_0xb50a('0x1d')]?'g':'',_['isEmpty'](_0xee4cef['monitor_format'])?'':_0xb50a('0x1e')),'XMD-DIALURL':_0xee4cef[_0xb50a('0x1f')]||'','XMD-AGI':_0xee4cef[_0xb50a('0x20')]?util['format'](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x20')]):'NONE','XMD-AGIAFTER':_0xee4cef[_0xb50a('0x1d')]?util[_0xb50a('0x12')](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x1d')]):_0xb50a('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x56a0d3?_0x56a0d3[_0xb50a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x56a0d3?_0x56a0d3['originatecalleridname']:'','XMD-DESTINATION':_0xb50a('0x24'),'SIPADDHEADER':_0xb50a('0x25')};if(!_[_0xb50a('0x10')](_0xee4cef[_0xb50a('0x26')])){_0x438249[util['format']('%s',_0xb50a('0x27'))]=_0xee4cef[_0xb50a('0x26')];_0x438249[util[_0xb50a('0x12')]('%s',_0xb50a('0x28'))]=_0x275ece;}return _0x438249;};exports[_0xb50a('0x29')]=function(_0x93ffff){var _0x5fa9b8={};for(var _0x50343d in _0x93ffff){if(_0x93ffff[_0xb50a('0x2a')](_0x50343d)){_0x5fa9b8[util['format']('%s',_[_0xb50a('0x2b')](_0x50343d))]=_0x93ffff[_0x50343d];}}return{'variables':_0x5fa9b8};};exports[_0xb50a('0x2c')]=function(_0x4310e7){var _0x59c51a=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4310e7[_0xb50a('0x2e')]=0xd;_0x4310e7[_0xb50a('0x2f')]='Blacklist';_0x4310e7[_0xb50a('0x30')]=_0x59c51a;_0x4310e7[_0xb50a('0x31')]=_0x59c51a;_0x4310e7['endtime']=_0x59c51a;};exports['logAgent']=function(_0x229601,_0x237f0c,_0x32f8a6){var _0x5d2396=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x229601[_0xb50a('0x2e')]=_0x237f0c;_0x229601[_0xb50a('0x2f')]=_0x32f8a6;_0x229601['responsetime']=_0x5d2396;_0x229601[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x229601[_0xb50a('0x31')],_0x229601['starttime']);};exports[_0xb50a('0x34')]=function(_0xbade32,_0x317e18,_0xe11c65){_0xbade32['membername']=_0x317e18;_0xbade32[_0xb50a('0x35')]=_0xe11c65;};exports[_0xb50a('0x36')]=function(_0x25d80a,_0x4bf1a4,_0x244d15){var _0x3a7ebb=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x25d80a[_0xb50a('0x2e')]=_0x4bf1a4;_0x25d80a['statedesc']=_0x244d15;_0x25d80a[_0xb50a('0x31')]=_0x25d80a[_0xb50a('0x31')]?_0x25d80a[_0xb50a('0x31')]:_0x3a7ebb;_0x25d80a[_0xb50a('0x37')]=_0x25d80a['endtime']?_0x25d80a['endtime']:_0x3a7ebb;_0x25d80a[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x25d80a['responsetime']||0x0,_0x25d80a[_0xb50a('0x30')]||0x0);_0x25d80a[_0xb50a('0x38')]=_0x25d80a[_0xb50a('0x39')]?utils[_0xb50a('0x33')](_0x25d80a[_0xb50a('0x37')],_0x25d80a[_0xb50a('0x39')]):0x0;};exports['isFailure']=function(_0x3d08c6){return _0x3d08c6==='Failure';};exports[_0xb50a('0x3a')]=function(_0x5b0429,_0x5c902d,_0x333cac,_0x537e62,_0x45a251){var _0x1cd660=_0x537e62?_0xb50a('0x3b'):_0x5b0429[_0xb50a('0x1a')];_0x1cd660=_0x45a251?'BOOKED':_0x1cd660;return{'actionid':_0x5b0429[_0xb50a('0x3c')],'action':'originate','channel':_0x5b0429[_0xb50a('0x3d')],'callerid':util[_0xb50a('0x12')](_0xb50a('0x13'),_0x1cd660,_0x5b0429['calleridnum']),'Exten':_0xb50a('0x24'),'Context':_0xb50a('0x3e'),'Priority':'1','variable':_0x333cac,'timeout':(_0x5c902d[_0xb50a('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b0429[_0xb50a('0x3c')]};};exports[_0xb50a('0x40')]=function(_0x4a1dca){return _0x4a1dca[_0xb50a('0x41')]+_0x4a1dca[_0xb50a('0x42')]+_0x4a1dca[_0xb50a('0x43')]+_0x4a1dca['countagentrejectretry']+_0x4a1dca['countnosuchnumberretry'];};exports[_0xb50a('0x44')]=function(_0x12d6b3){var _0x52d340=_[_0xb50a('0x45')](_0x12d6b3);_0x52d340[_0xb50a('0x2e')]=0xf;_0x52d340[_0xb50a('0x2f')]=_0xb50a('0x46');return _0x52d340;};exports[_0xb50a('0x47')]=function(_0x2280fe,_0x25ff25,_0x5b5417){var _0x4cec87={};_0x4cec87[_0x25ff25]=_0x2280fe[_0x25ff25];_0x4cec87[_0xb50a('0x48')]=![];_0x4cec87['scheduledat']=moment()[_0xb50a('0x49')](_0x5b5417,'minutes')[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4cec87['ContactId']=_0x2280fe['ContactId'];_0x4cec87[_0xb50a('0x4a')]=_0x2280fe[_0xb50a('0x4a')];_0x4cec87['VoiceQueueId']=_0x2280fe[_0xb50a('0x4b')]||undefined;return _0x4cec87;};exports[_0xb50a('0x4c')]=function(_0x4b7408,_0x20ff41){if(!_['isNil'](_0x4b7408)){if(_0x4b7408['pTalking']>0x0){_0x4b7408[_0xb50a('0x4d')]-=0x1;}else{logger['info'](_0x20ff41,_0xb50a('0x4e'));}}else{logger['error'](_0x20ff41,_0xb50a('0x4f'));}};exports[_0xb50a('0x50')]=function(_0x1a5282){if(_0x1a5282<=0x0){return!![];}return![];};function buildObj(_0x327fe8,_0xebdc3d,_0x6065b8){_0x327fe8[_0xb50a('0x51')]=_0xebdc3d;_0x327fe8[_0xb50a('0x19')]=_0x327fe8[_0xb50a('0x52')];_0x327fe8[_0xb50a('0x53')]=_0x327fe8['channelAgent'];_0x327fe8[_0xb50a('0x54')]=_0xb50a('0x55');if(_0x6065b8){_0x327fe8[_0xb50a('0x56')]=_0x6065b8[_0xb50a('0x56')];}return _0x327fe8;}exports['buildObj']=buildObj;exports[_0xb50a('0x57')]=function(_0xb94726){var _0x164a43=[];for(var _0x29e03e in _0xb94726){if(_0xb94726[_0xb50a('0x2a')](_0x29e03e)){if(!_[_0xb50a('0x16')](_0xb94726[_0x29e03e])&&_0xb94726[_0x29e03e]['state']==='not_inuse'&&_0xb94726[_0x29e03e][_0xb50a('0x58')]===_0xb50a('0x59')){_0x164a43[_0xb50a('0x5a')](_0xb94726[_0x29e03e]['id']);}}}return _0x164a43;};exports[_0xb50a('0x5b')]=function(_0x43ae63){var _0x139993=moment()[_0xb50a('0x5c')](0x0);var _0x161635=moment(_0x43ae63)[_0xb50a('0x5c')](0x0);return _0x139993[_0xb50a('0x5d')](_0x161635,'seconds');};exports[_0xb50a('0x5e')]=function(_0x380f7a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x380f7a[_0xb50a('0x1c')],'ListId':_0x380f7a[_0xb50a('0x4a')],'VoiceQueueId':_0x380f7a[_0xb50a('0x4b')]||undefined,'CampaignId':_0x380f7a[_0xb50a('0x5f')]||undefined};};exports[_0xb50a('0x60')]=function(_0x5a7606){if(_0x5a7606==='uniqueid'||_0x5a7606===_0xb50a('0x61')||_0x5a7606===_0xb50a('0x52')||_0x5a7606==='type'||_0x5a7606===_0xb50a('0x62')||_0x5a7606===_0xb50a('0x63')||_0x5a7606===_0xb50a('0x64')||_0x5a7606==='channelAgent'||_0x5a7606===_0xb50a('0x1a')||_0x5a7606===_0xb50a('0x48')||_0x5a7606===_0xb50a('0x1b')||_0x5a7606===_0xb50a('0x65')||_0x5a7606===_0xb50a('0x41')||_0x5a7606==='countcongestionretry'||_0x5a7606==='countnoanswerretry'||_0x5a7606===_0xb50a('0x66')||_0x5a7606===_0xb50a('0x67')||_0x5a7606===_0xb50a('0x68')||_0x5a7606===_0xb50a('0x69')||_0x5a7606===_0xb50a('0x6a')||_0x5a7606===_0xb50a('0x1c')||_0x5a7606===_0xb50a('0x4a')||_0x5a7606===_0xb50a('0x35')||_0x5a7606===_0xb50a('0x4b')||_0x5a7606==='sipcallid'||_0x5a7606===_0xb50a('0x6b')||_0x5a7606===_0xb50a('0x6c')||_0x5a7606===_0xb50a('0x6d')||_0x5a7606===_0xb50a('0x6e')||_0x5a7606===_0xb50a('0x6f')||_0x5a7606===_0xb50a('0x70')||_0x5a7606===_0xb50a('0x71')||_0x5a7606===_0xb50a('0x72')||_0x5a7606===_0xb50a('0x73')||_0x5a7606===_0xb50a('0x74')||_0x5a7606===_0xb50a('0x75')||_0x5a7606===_0xb50a('0x76')||_0x5a7606===_0xb50a('0x77')||_0x5a7606===_0xb50a('0x78')||_0x5a7606===_0xb50a('0x79')||_0x5a7606===_0xb50a('0x7a')||_0x5a7606===_0xb50a('0x7b')||_0x5a7606==='rtpaudioqosjitterbridged'||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606==='rtpaudioqosrtt'||_0x5a7606==='rtpaudioqosrttbridged'||_0x5a7606===_0xb50a('0x79')||_0x5a7606==='rtpaudioqosbridged'||_0x5a7606==='rtpaudioqosjitter'||_0x5a7606===_0xb50a('0x7e')||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606===_0xb50a('0x7f')||_0x5a7606===_0xb50a('0x80')||_0x5a7606===_0xb50a('0x81')||_0x5a7606===_0xb50a('0x82')||_0x5a7606===_0xb50a('0x2e')||_0x5a7606===_0xb50a('0x2f')){return![];}return!![];};exports[_0xb50a('0x83')]=function(_0xbb237e,_0x5639b6){var _0x428fa1,_0x1b5853,_0x24a743;if(_0x5639b6<=0x0){_0x5639b6=0x1;}_0x428fa1=new RegExp(_0xb50a('0x84')+_0x5639b6+'}$');_0x1b5853=Math['pow'](0xa,_0x5639b6-0x1);_0x24a743=Math[_0xb50a('0x85')](0xa,_0x5639b6)-0x1;return util[_0xb50a('0x12')]('%s',_[_0xb50a('0x86')](_0xbb237e,_0x428fa1,_[_0xb50a('0x87')](_0x1b5853,_0x24a743)));};exports['extractCalleridName']=function(_0x5da9b5){var _0x527485=_0x5da9b5[_0xb50a('0x88')](/"(.*?)"/);return _0x527485?_0x527485[0x1]:_0x5da9b5;};exports['extractCalleridNumber']=function(_0x4945e0){var _0x57525c=_0x4945e0['match'](/<(.*?)>/);return _0x57525c?_0x57525c[0x1]:_0x4945e0;};function buildNoAnswerEventPayload(_0x3b7e53,_0x44524e){var _0x97f1ad=buildObj(_0x3b7e53,_0xb50a('0x89'));if(!_['isEmpty'](_0x44524e[_0xb50a('0x8a')])){Object[_0xb50a('0x8b')](_0x44524e['variables'])[_0xb50a('0x8c')](function(_0x4be676){_0x97f1ad[_0x4be676['toLowerCase']()]=_0x44524e[_0xb50a('0x8a')][_0x4be676];});}return _0x97f1ad;}exports[_0xb50a('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xd71d=['isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','isFailure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalking','info','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','queue','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','keys','forEach','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','logger','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0x41fc70,_0x266337){var _0x56c859=function(_0x3d7449){while(--_0x3d7449){_0x41fc70['push'](_0x41fc70['shift']());}};_0x56c859(++_0x266337);}(_0xd71d,0xfd));var _0xdd71=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xd71d[_0x154192];return _0x3c2792;};'use strict';var util=require('util');var _=require(_0xdd71('0x0'));var moment=require(_0xdd71('0x1'));var logger=require(_0xdd71('0x2'))(_0xdd71('0x3'));var ipAgi=process[_0xdd71('0x4')][_0xdd71('0x5')]||_0xdd71('0x6');var utils=require('../../dialer/utils');exports[_0xdd71('0x7')]=function(_0x4a0f71){return function(_0x50a29b){logger['error'](_0x4a0f71,util[_0xdd71('0x8')](_0x50a29b,{'showHidden':![],'depth':null}));};};exports[_0xdd71('0x9')]=function(_0x12888f,_0x7bb3f4){logger['info'](_0x12888f,util[_0xdd71('0x8')](_0x7bb3f4,{'showHidden':![],'depth':null}));};exports[_0xdd71('0xa')]=function(_0x239fdb,_0x273e73){logger[_0xdd71('0xb')](_0x239fdb,util[_0xdd71('0x8')](_0x273e73,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2e30f7){return function(_0xc5cc49){logger['info'](_0x2e30f7,util[_0xdd71('0x8')](_0xc5cc49,{'showHidden':![],'depth':null}));};};exports[_0xdd71('0xc')]=function(_0x5f3394,_0x49877c,_0x540c77){return{'message':_0x5f3394,'unlock':_0x49877c,'active':_0x540c77};};exports[_0xdd71('0xd')]=function(_0x54578a,_0x48c4f0,_0x57a533){if(!_[_0xdd71('0xe')](_0x57a533)&&'string'===typeof _0x57a533&&!_['isEmpty'](_0x57a533)){if(!_[_0xdd71('0xe')](_0x48c4f0)&&_0xdd71('0xf')===typeof _0x48c4f0&&!_[_0xdd71('0x10')](_0x48c4f0)){return util[_0xdd71('0x11')]('\x22%s\x22\x20<%s>',_0x48c4f0,_0x57a533);}return util[_0xdd71('0x11')](_0xdd71('0x12'),_0x57a533,_0x57a533);}if(!_['isUndefined'](_0x54578a)&&'string'===typeof _0x54578a&&!_['isEmpty'](_0x54578a)){return _0x54578a;}return _0xdd71('0x13');};exports[_0xdd71('0x14')]=function(_0x241c9c){if(_[_0xdd71('0x15')](_0x241c9c)){return![];}return _0x241c9c;};exports[_0xdd71('0x16')]=function(_0x40a3ef,_0x26dc5c,_0x544dd8,_0x1914de,_0x44c9de,_0x3bd280){var _0xa23d8c={'XMD-QUEUE':_0x26dc5c[_0xdd71('0x17')]?_0x26dc5c[_0xdd71('0x17')][_0xdd71('0x18')]:'','XMD-CALLERID':_0x1914de,'XMD-CALLERID-PREVIEW':_0x3bd280?util[_0xdd71('0x11')]('\x22%s\x22\x20<%s>',_0x3bd280[_0xdd71('0x19')],_0x3bd280['calleridnum']):_0x1914de,'XMD-DIALID':_0x44c9de,'XMD-CONTACTID':_0x26dc5c[_0xdd71('0x1a')],'XMD-CDRTYPE':_0xdd71('0x1b'),'CALLERID(all)':_0x1914de,'XMD-VOICEQUEUEID':_0x26dc5c[_0xdd71('0x1c')],'XMD-DIALCHANNEL':_0x544dd8,'XMD-DIALTIMEOUT':_0x40a3ef[_0xdd71('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xdd71('0x1e'),_0x40a3ef[_0xdd71('0x1f')]?'g':'',_['isEmpty'](_0x40a3ef[_0xdd71('0x20')])?'':_0xdd71('0x21')),'XMD-DIALURL':_0x40a3ef['dialPreviewUrl']||'','XMD-AGI':_0x40a3ef['dialQueueProject']?util[_0xdd71('0x11')](_0xdd71('0x22'),ipAgi,_0x40a3ef[_0xdd71('0x23')]):_0xdd71('0x24'),'XMD-AGIAFTER':_0x40a3ef[_0xdd71('0x1f')]?util[_0xdd71('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x40a3ef[_0xdd71('0x1f')]):_0xdd71('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x3bd280?_0x3bd280[_0xdd71('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3bd280?_0x3bd280[_0xdd71('0x26')]:'','XMD-DESTINATION':_0xdd71('0x27'),'SIPADDHEADER':_0xdd71('0x28')};if(!_[_0xdd71('0x10')](_0x40a3ef[_0xdd71('0x20')])){_0xa23d8c[util[_0xdd71('0x11')]('%s',_0xdd71('0x29'))]=_0x40a3ef['monitor_format'];_0xa23d8c[util['format']('%s',_0xdd71('0x2a'))]=_0x44c9de;}return _0xa23d8c;};exports[_0xdd71('0x2b')]=function(_0x46b231){var _0x40165d={};for(var _0x380135 in _0x46b231){if(_0x46b231[_0xdd71('0x2c')](_0x380135)){_0x40165d[util['format']('%s',_[_0xdd71('0x2d')](_0x380135))]=_0x46b231[_0x380135];}}return{'variables':_0x40165d};};exports[_0xdd71('0x2e')]=function(_0x1f0462){var _0xcaf3b3=moment()['format'](_0xdd71('0x2f'));_0x1f0462[_0xdd71('0x30')]=0xd;_0x1f0462[_0xdd71('0x31')]=_0xdd71('0x32');_0x1f0462[_0xdd71('0x33')]=_0xcaf3b3;_0x1f0462[_0xdd71('0x34')]=_0xcaf3b3;_0x1f0462[_0xdd71('0x35')]=_0xcaf3b3;};exports[_0xdd71('0x36')]=function(_0x530225,_0x244d35,_0x3ad04e){var _0x3f328b=moment()[_0xdd71('0x11')](_0xdd71('0x2f'));_0x530225[_0xdd71('0x30')]=_0x244d35;_0x530225[_0xdd71('0x31')]=_0x3ad04e;_0x530225[_0xdd71('0x34')]=_0x3f328b;_0x530225[_0xdd71('0x37')]=utils[_0xdd71('0x38')](_0x530225[_0xdd71('0x34')],_0x530225[_0xdd71('0x33')]);};exports[_0xdd71('0x39')]=function(_0x1819b9,_0x2a7be7,_0x2814ce){_0x1819b9[_0xdd71('0x3a')]=_0x2a7be7;_0x1819b9[_0xdd71('0x3b')]=_0x2814ce;};exports[_0xdd71('0x3c')]=function(_0x54229a,_0x3d3a61,_0x3b5103){var _0x104446=moment()['format'](_0xdd71('0x2f'));_0x54229a[_0xdd71('0x30')]=_0x3d3a61;_0x54229a[_0xdd71('0x31')]=_0x3b5103;_0x54229a[_0xdd71('0x34')]=_0x54229a['responsetime']?_0x54229a['responsetime']:_0x104446;_0x54229a['endtime']=_0x54229a[_0xdd71('0x35')]?_0x54229a[_0xdd71('0x35')]:_0x104446;_0x54229a['ringtime']=utils[_0xdd71('0x38')](_0x54229a[_0xdd71('0x34')]||0x0,_0x54229a[_0xdd71('0x33')]||0x0);_0x54229a[_0xdd71('0x3d')]=_0x54229a['answertime']?utils[_0xdd71('0x38')](_0x54229a[_0xdd71('0x35')],_0x54229a['answertime']):0x0;};exports[_0xdd71('0x3e')]=function(_0x597647){return _0x597647==='Failure';};exports[_0xdd71('0x3f')]=function(_0x20a7ba,_0x28beb8,_0x5f54bb,_0x291488,_0x34fd95){var _0x47b54a=_0x291488?'RECALL':_0x20a7ba['calleridname'];_0x47b54a=_0x34fd95?_0xdd71('0x40'):_0x47b54a;return{'actionid':_0x20a7ba[_0xdd71('0x41')],'action':_0xdd71('0x42'),'channel':_0x20a7ba[_0xdd71('0x43')],'callerid':util[_0xdd71('0x11')](_0xdd71('0x12'),_0x47b54a,_0x20a7ba[_0xdd71('0x44')]),'Exten':_0xdd71('0x27'),'Context':_0xdd71('0x45'),'Priority':'1','variable':_0x5f54bb,'timeout':(_0x28beb8[_0xdd71('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20a7ba[_0xdd71('0x41')]};};exports['totalGlobal']=function(_0x6bd20e){return _0x6bd20e[_0xdd71('0x47')]+_0x6bd20e['countcongestionretry']+_0x6bd20e[_0xdd71('0x48')]+_0x6bd20e[_0xdd71('0x49')]+_0x6bd20e[_0xdd71('0x4a')];};exports[_0xdd71('0x4b')]=function(_0x2e8681){var _0x2d1080=_[_0xdd71('0x4c')](_0x2e8681);_0x2d1080[_0xdd71('0x30')]=0xf;_0x2d1080[_0xdd71('0x31')]='Global';return _0x2d1080;};exports[_0xdd71('0x4d')]=function(_0x4df644,_0x3a9d84,_0x1efd92){var _0x310ace={};_0x310ace[_0x3a9d84]=_0x4df644[_0x3a9d84];_0x310ace[_0xdd71('0x4e')]=![];_0x310ace[_0xdd71('0x4f')]=moment()[_0xdd71('0x50')](_0x1efd92,_0xdd71('0x51'))[_0xdd71('0x11')](_0xdd71('0x2f'));_0x310ace[_0xdd71('0x1a')]=_0x4df644[_0xdd71('0x1a')];_0x310ace[_0xdd71('0x52')]=_0x4df644[_0xdd71('0x52')];_0x310ace['VoiceQueueId']=_0x4df644[_0xdd71('0x1c')]||undefined;return _0x310ace;};exports[_0xdd71('0x53')]=function(_0x55718d,_0x146645){if(!_[_0xdd71('0x15')](_0x55718d)){if(_0x55718d['pTalking']>0x0){_0x55718d['pTalking']-=0x1;}else{logger[_0xdd71('0x54')](_0x146645,_0xdd71('0x55'));}}else{logger[_0xdd71('0xb')](_0x146645,_0xdd71('0x56'));}};exports['IsNotLoggedIn']=function(_0x2494a4){if(_0x2494a4<=0x0){return!![];}return![];};function buildObj(_0x462289,_0x3f4eb8,_0x4203a3){_0x462289[_0xdd71('0x57')]=_0x3f4eb8;_0x462289[_0xdd71('0x18')]=_0x462289['queue'];_0x462289['interface']=_0x462289['channelAgent'];_0x462289[_0xdd71('0x58')]='voice';if(_0x4203a3){_0x462289[_0xdd71('0x59')]=_0x4203a3[_0xdd71('0x59')];}return _0x462289;}exports[_0xdd71('0x5a')]=buildObj;exports[_0xdd71('0x5b')]=function(_0x35886a){var _0x753d7=[];for(var _0x598714 in _0x35886a){if(_0x35886a['hasOwnProperty'](_0x598714)){if(!_[_0xdd71('0x15')](_0x35886a[_0x598714])&&_0x35886a[_0x598714][_0xdd71('0x30')]===_0xdd71('0x5c')&&_0x35886a[_0x598714]['status']===_0xdd71('0x5d')){_0x753d7[_0xdd71('0x5e')](_0x35886a[_0x598714]['id']);}}}return _0x753d7;};exports[_0xdd71('0x5f')]=function(_0x1d8c5d){var _0x5d6412=moment()[_0xdd71('0x60')](0x0);var _0x39f547=moment(_0x1d8c5d)[_0xdd71('0x60')](0x0);return _0x5d6412[_0xdd71('0x61')](_0x39f547,_0xdd71('0x62'));};exports[_0xdd71('0x63')]=function(_0x342731){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x342731[_0xdd71('0x1a')],'ListId':_0x342731['ListId'],'VoiceQueueId':_0x342731[_0xdd71('0x1c')]||undefined,'CampaignId':_0x342731['CampaignId']||undefined};};exports[_0xdd71('0x64')]=function(_0xcfc49a){if(_0xcfc49a===_0xdd71('0x41')||_0xcfc49a===_0xdd71('0x65')||_0xcfc49a===_0xdd71('0x66')||_0xcfc49a===_0xdd71('0x67')||_0xcfc49a===_0xdd71('0x68')||_0xcfc49a===_0xdd71('0x69')||_0xcfc49a===_0xdd71('0x3a')||_0xcfc49a===_0xdd71('0x43')||_0xcfc49a===_0xdd71('0x19')||_0xcfc49a===_0xdd71('0x4e')||_0xcfc49a===_0xdd71('0x44')||_0xcfc49a==='scheduledat'||_0xcfc49a===_0xdd71('0x47')||_0xcfc49a===_0xdd71('0x6a')||_0xcfc49a===_0xdd71('0x48')||_0xcfc49a===_0xdd71('0x6b')||_0xcfc49a===_0xdd71('0x6c')||_0xcfc49a==='callbackuniqueid'||_0xcfc49a==='callbackat'||_0xcfc49a===_0xdd71('0x6d')||_0xcfc49a===_0xdd71('0x1a')||_0xcfc49a===_0xdd71('0x52')||_0xcfc49a===_0xdd71('0x3b')||_0xcfc49a===_0xdd71('0x1c')||_0xcfc49a===_0xdd71('0x6e')||_0xcfc49a===_0xdd71('0x6f')||_0xcfc49a===_0xdd71('0x70')||_0xcfc49a===_0xdd71('0x71')||_0xcfc49a==='xmd-listid'||_0xcfc49a===_0xdd71('0x72')||_0xcfc49a==='xmd-dialtimeout'||_0xcfc49a===_0xdd71('0x73')||_0xcfc49a===_0xdd71('0x74')||_0xcfc49a==='xmd-dialchannel'||_0xcfc49a==='xmd-contactid'||_0xcfc49a===_0xdd71('0x75')||_0xcfc49a==='xmd-callerid'||_0xcfc49a===_0xdd71('0x76')||_0xcfc49a===_0xdd71('0x77')||_0xcfc49a===_0xdd71('0x78')||_0xcfc49a==='rtpaudioqosbridged'||_0xcfc49a===_0xdd71('0x79')||_0xcfc49a===_0xdd71('0x7a')||_0xcfc49a===_0xdd71('0x7b')||_0xcfc49a===_0xdd71('0x7c')||_0xcfc49a==='rtpaudioqosrtt'||_0xcfc49a==='rtpaudioqosrttbridged'||_0xcfc49a===_0xdd71('0x78')||_0xcfc49a===_0xdd71('0x7d')||_0xcfc49a==='rtpaudioqosjitter'||_0xcfc49a===_0xdd71('0x7a')||_0xcfc49a===_0xdd71('0x7b')||_0xcfc49a==='rtpaudioqoslossbridged'||_0xcfc49a===_0xdd71('0x7e')||_0xcfc49a==='rtpaudioqosrttbridged'||_0xcfc49a===_0xdd71('0x7f')||_0xcfc49a===_0xdd71('0x80')||_0xcfc49a===_0xdd71('0x30')||_0xcfc49a===_0xdd71('0x31')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x20facd,_0x5b206){var _0x11c4c5,_0x28a772,_0x264238;if(_0x5b206<=0x0){_0x5b206=0x1;}_0x11c4c5=new RegExp(_0xdd71('0x81')+_0x5b206+'}$');_0x28a772=Math['pow'](0xa,_0x5b206-0x1);_0x264238=Math[_0xdd71('0x82')](0xa,_0x5b206)-0x1;return util['format']('%s',_[_0xdd71('0x83')](_0x20facd,_0x11c4c5,_['random'](_0x28a772,_0x264238)));};exports[_0xdd71('0x84')]=function(_0x36485f){var _0x31177f=_0x36485f[_0xdd71('0x85')](/"(.*?)"/);return _0x31177f?_0x31177f[0x1]:_0x36485f;};exports['extractCalleridNumber']=function(_0x306210){var _0x38eb52=_0x306210[_0xdd71('0x85')](/<(.*?)>/);return _0x38eb52?_0x38eb52[0x1]:_0x306210;};function buildNoAnswerEventPayload(_0x1c3b67,_0x5af192){var _0x721077=buildObj(_0x1c3b67,_0xdd71('0x86'));if(!_[_0xdd71('0x10')](_0x5af192['variables'])){Object[_0xdd71('0x87')](_0x5af192['variables'])[_0xdd71('0x88')](function(_0x504444){_0x721077[_0x504444['toLowerCase']()]=_0x5af192['variables'][_0x504444];});}return _0x721077;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 63df2be..bf0ab8c 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 _0xe244=['queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x83ad74,_0x51caeb){var _0x233894=function(_0x473549){while(--_0x473549){_0x83ad74['push'](_0x83ad74['shift']());}};_0x233894(++_0x51caeb);}(_0xe244,0x1ea));var _0x4e24=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe244[_0xbca1b1];return _0x4e1686;};'use strict';exports[_0x4e24('0x0')]={'queue':{'type':_0x4e24('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x4e24('0x2'),'required':![]}};exports[_0x4e24('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x4e24('0x1'),'required':!![]}};exports[_0x4e24('0x4')]={'interface':{'type':_0x4e24('0x1'),'required':!![]},'paused':{'type':_0x4e24('0x2')},'reason':{'type':_0x4e24('0x1'),'required':![]}};exports[_0x4e24('0x5')]={'module':{'type':_0x4e24('0x1'),'required':![]}};exports[_0x4e24('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x4e24('0x1')},'format':{'type':_0x4e24('0x1')},'mixmonitorid':{'type':_0x4e24('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x4e24('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x8921=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel'];(function(_0x50fb35,_0x5be470){var _0x5f42e4=function(_0x1d0557){while(--_0x1d0557){_0x50fb35['push'](_0x50fb35['shift']());}};_0x5f42e4(++_0x5be470);}(_0x8921,0x124));var _0x1892=function(_0x487a50,_0x4a04c2){_0x487a50=_0x487a50-0x0;var _0x55a7f7=_0x8921[_0x487a50];return _0x55a7f7;};'use strict';exports[_0x1892('0x0')]={'queue':{'type':_0x1892('0x1'),'required':!![]},'interface':{'type':_0x1892('0x1'),'required':!![]},'membername':{'type':_0x1892('0x1'),'required':!![]},'penalty':{'type':_0x1892('0x2'),'required':![]},'paused':{'type':_0x1892('0x3'),'required':![]}};exports[_0x1892('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1892('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x1892('0x1'),'required':!![]},'paused':{'type':_0x1892('0x3')},'reason':{'type':_0x1892('0x1'),'required':![]}};exports[_0x1892('0x5')]={'module':{'type':_0x1892('0x1'),'required':![]}};exports[_0x1892('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x1892('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x1892('0x1')},'mixmonitorid':{'type':_0x1892('0x1')}};exports[_0x1892('0x8')]={'uniqueid':{'type':_0x1892('0x1'),'required':!![]}};exports[_0x1892('0x9')]={'uniqueid':{'type':_0x1892('0x1'),'required':!![]},'exten':{'type':_0x1892('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 75765bc..b53d6e9 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x80ca76,_0x12de88){var _0x57e984=function(_0x56afd8){while(--_0x56afd8){_0x80ca76['push'](_0x80ca76['shift']());}};_0x57e984(++_0x12de88);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x8caa3b,_0x24c42c){var _0x455bc4=function(_0x4bc850){while(--_0x4bc850){_0x8caa3b['push'](_0x8caa3b['shift']());}};_0x455bc4(++_0x24c42c);}(_0xb10b,0x12a));var _0xbb10=function(_0x42e1ec,_0x19aacc){_0x42e1ec=_0x42e1ec-0x0;var _0xe8c124=_0xb10b[_0x42e1ec];return _0xe8c124;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6afc3cc..daf4d7a 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa701=['assign','hasOwnProperty'];(function(_0x398890,_0xaeae6){var _0x39aa7c=function(_0xfc30c8){while(--_0xfc30c8){_0x398890['push'](_0x398890['shift']());}};_0x39aa7c(++_0xaeae6);}(_0xa701,0x1d4));var _0x1a70=function(_0x1e9f47,_0x5950eb){_0x1e9f47=_0x1e9f47-0x0;var _0x5d46d2=_0xa701[_0x1e9f47];return _0x5d46d2;};'use strict';function mergeDBDataToRealtime(_0x3550a9,_0x110e53){var _0x1d8619=Object[_0x1a70('0x0')]({},_0x3550a9);for(var _0x2d2ad8 in _0x110e53){if(_0x1d8619[_0x1a70('0x1')](_0x2d2ad8)){_0x1d8619[_0x2d2ad8]=_0x110e53[_0x2d2ad8];}}return _0x1d8619;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +'use strict';function mergeDBDataToRealtime(_0x1ae256,_0x75f433){var _0x57102f=Object['assign']({},_0x1ae256);for(var _0x11fbc8 in _0x75f433){if(_0x57102f['hasOwnProperty'](_0x11fbc8)){_0x57102f[_0x11fbc8]=_0x75f433[_0x11fbc8];}}return _0x57102f;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 06d9401..e4aa4ea 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 _0x68f0=['from-voip-provider','destination','xcally-motion-preview','calleridpreview','destinationchannel','callerid','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','lodash','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','find','accountcode','name','isNil','interface','format','SIP/%s','length','findAgent','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','exten','type','dialer','lastapplication','queue','lastdata','context'];(function(_0x23603,_0x281eee){var _0x2357a1=function(_0x265b78){while(--_0x265b78){_0x23603['push'](_0x23603['shift']());}};_0x2357a1(++_0x281eee);}(_0x68f0,0x131));var _0x068f=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0x68f0[_0x27e2bc];return _0x303eed;};'use strict';var _=require(_0x068f('0x0'));var moment=require(_0x068f('0x1'));var util=require(_0x068f('0x2'));var config=require(_0x068f('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x068f('0x4'));var RpcVoiceDialReport=require(_0x068f('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x068f('0x6'));var RpcVoiceTransferReport=require(_0x068f('0x7'));var VoiceQueueReport=require(_0x068f('0x8'));var VoiceCallReport=require(_0x068f('0x9'));var VoiceAgentReport=require(_0x068f('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x068f('0xb'));function Report(_0x2c627c){this[_0x068f('0xc')]=_0x2c627c;this['agents']=_0x2c627c[_0x068f('0xd')];this[_0x068f('0xe')]=_0x2c627c[_0x068f('0xe')];}Report['prototype']['sync']=function(_0x318a18){var _0x26e9aa=new VoiceQueueReport(this[_0x068f('0xc')]);var _0x3d79f6=new VoiceAgentReport(this[_0x068f('0xc')]);var _0x24b436=new VoiceDialReport(this[_0x068f('0xc')]);var _0x48312e=new VoiceCallReport(this[_0x068f('0xc')]);var _0x1e3fcc=new UserReport(this[_0x068f('0xc')]);if(config[_0x068f('0xf')]&&config['xdr'][_0x068f('0x10')]){ami['on'](_0x068f('0x11'),this[_0x068f('0x12')][_0x068f('0x13')](this));ami['on'](_0x068f('0x14'),this['voiceCallReport'][_0x068f('0x13')](this));ami['on'](_0x068f('0x15'),this[_0x068f('0x16')][_0x068f('0x13')](this));ami['on'](_0x068f('0x17'),this[_0x068f('0x18')][_0x068f('0x13')](this));ami['on'](_0x068f('0x19'),this[_0x068f('0x1a')][_0x068f('0x13')](this));ami['on']('attendedtransfer',this[_0x068f('0x1b')][_0x068f('0x13')](this));}};Report[_0x068f('0x1c')]['findAgent']=function(_0x257bc7){var _0x4ff0f9;_0x4ff0f9=_[_0x068f('0x1d')](this[_0x068f('0xd')],function(_0x27a2de){return _0x27a2de[_0x068f('0x1e')]==_0x257bc7||_0x27a2de[_0x068f('0x1f')]==_0x257bc7;});if(_[_0x068f('0x20')](_0x4ff0f9)){var _0x1413d7=_['find'](this[_0x068f('0xe')],function(_0x3d3a87){return _0x3d3a87[_0x068f('0x1e')]==_0x257bc7||_0x3d3a87[_0x068f('0x1f')]==_0x257bc7;});if(_0x1413d7){_0x4ff0f9=_['find'](this[_0x068f('0xd')],function(_0x4cc3dd){return _0x4cc3dd[_0x068f('0x21')]==util[_0x068f('0x22')](_0x068f('0x23'),_0x1413d7['name']);});}}return _0x4ff0f9;};Report['prototype'][_0x068f('0x12')]=function(_0x3af8da){for(var _0x34d263=0x0;_0x34d263<_0x3af8da[_0x068f('0x24')];_0x34d263+=0x1){var _0x48d6b6=this[_0x068f('0x25')](_0x3af8da[_0x34d263]['connectedlinenum']);if(_0x48d6b6){_0x3af8da[_0x34d263][_0x068f('0x1e')]=_0x48d6b6[_0x068f('0x1e')];_0x3af8da[_0x34d263]['assigned']=!![];_0x3af8da[_0x34d263][_0x068f('0x26')]=_0x48d6b6[_0x068f('0x1f')];_0x3af8da[_0x34d263][_0x068f('0x21')]=_[_0x068f('0x20')](_0x48d6b6['interface'])?util[_0x068f('0x22')](_0x068f('0x23'),_0x48d6b6[_0x068f('0x1f')]):_0x48d6b6[_0x068f('0x21')];if(_0x3af8da[_0x34d263]['queuecallercomplete']){_0x3af8da[_0x34d263][_0x068f('0x27')]=moment()[_0x068f('0x22')](_0x068f('0x28'));}if(_0x3af8da[_0x34d263][_0x068f('0x29')]){_0x3af8da[_0x34d263][_0x068f('0x2a')]=moment()[_0x068f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x068f('0x12')](_0x3af8da[_0x34d263]);}RpcVoiceQueueReport[_0x068f('0x2b')](_0x3af8da[_0x34d263]);}};function extractCalleridNumber(_0x3cada8){var _0x4cfb8d=_0x3cada8[_0x068f('0x2c')](/<(.*?)>/);return _0x4cfb8d?_0x4cfb8d[0x1]:_0x3cada8;}Report['prototype'][_0x068f('0x2d')]=function(_0x11f0aa){for(var _0x3636ed=0x0;_0x3636ed','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','type','split','UserId','membername','monitor','monitors','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','assigned','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','lastdata','context','callerid'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x7699,0x78));var _0x9769=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x7699[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x9769('0x0'));var moment=require('moment');var util=require(_0x9769('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9769('0x2'));var RpcVoiceCallReport=require(_0x9769('0x3'));var RpcVoiceDialReport=require(_0x9769('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9769('0x5'));var RpcVoiceRecording=require(_0x9769('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x9769('0x7'));var VoiceCallReport=require(_0x9769('0x8'));var VoiceAgentReport=require(_0x9769('0x9'));var VoiceDialReport=require(_0x9769('0xa'));var UserReport=require('./userReport');function Report(_0x4b192c){this['realtime']=_0x4b192c;this[_0x9769('0xb')]=_0x4b192c['agents'];this['telephones']=_0x4b192c[_0x9769('0xc')];}Report['prototype']['sync']=function(_0x4a7651){var _0x1995f9=new VoiceQueueReport(this[_0x9769('0xd')]);var _0x554cd3=new VoiceAgentReport(this['realtime']);var _0x349488=new VoiceDialReport(this[_0x9769('0xd')]);var _0x147e9b=new VoiceCallReport(this[_0x9769('0xd')]);var _0x38cb7a=new UserReport(this[_0x9769('0xd')]);if(config[_0x9769('0xe')]&&config[_0x9769('0xe')][_0x9769('0xf')]){ami['on'](_0x9769('0x10'),this['voiceQueueReport'][_0x9769('0x11')](this));ami['on'](_0x9769('0x12'),this['voiceCallReport'][_0x9769('0x11')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x9769('0x11')](this));ami['on']('custom:voiceDialReport',this[_0x9769('0x13')]['bind'](this));ami['on'](_0x9769('0x14'),this[_0x9769('0x15')][_0x9769('0x11')](this));ami['on'](_0x9769('0x16'),this[_0x9769('0x17')]['bind'](this));}};Report['prototype'][_0x9769('0x18')]=function(_0xf0cbc7){var _0x363dd2;_0x363dd2=_[_0x9769('0x19')](this[_0x9769('0xb')],function(_0x550d15){return _0x550d15[_0x9769('0x1a')]==_0xf0cbc7||_0x550d15[_0x9769('0x1b')]==_0xf0cbc7;});if(_[_0x9769('0x1c')](_0x363dd2)){var _0x59bbb4=_[_0x9769('0x19')](this[_0x9769('0xc')],function(_0xec0ea1){return _0xec0ea1[_0x9769('0x1a')]==_0xf0cbc7||_0xec0ea1[_0x9769('0x1b')]==_0xf0cbc7;});if(_0x59bbb4){_0x363dd2=_[_0x9769('0x19')](this[_0x9769('0xb')],function(_0x428b84){return _0x428b84[_0x9769('0x1d')]==util[_0x9769('0x1e')](_0x9769('0x1f'),_0x59bbb4['name']);});}}return _0x363dd2;};Report[_0x9769('0x20')][_0x9769('0x21')]=function(_0x1a38fe){for(var _0x3132a3=0x0;_0x3132a3<_0x1a38fe[_0x9769('0x22')];_0x3132a3+=0x1){var _0x1d9948=this[_0x9769('0x18')](_0x1a38fe[_0x3132a3][_0x9769('0x23')]);if(_0x1d9948){_0x1a38fe[_0x3132a3]['accountcode']=_0x1d9948[_0x9769('0x1a')];_0x1a38fe[_0x3132a3][_0x9769('0x24')]=!![];_0x1a38fe[_0x3132a3]['lastAssignedTo']=_0x1d9948[_0x9769('0x1b')];_0x1a38fe[_0x3132a3][_0x9769('0x1d')]=_[_0x9769('0x1c')](_0x1d9948['interface'])?util['format'](_0x9769('0x1f'),_0x1d9948[_0x9769('0x1b')]):_0x1d9948['interface'];if(_0x1a38fe[_0x3132a3]['queuecallercomplete']){_0x1a38fe[_0x3132a3]['queuecallercompleteAt']=moment()[_0x9769('0x1e')](_0x9769('0x25'));}if(_0x1a38fe[_0x3132a3]['queuecallerexit']){_0x1a38fe[_0x3132a3]['queuecallerexitAt']=moment()[_0x9769('0x1e')](_0x9769('0x25'));}RpcMemberReport[_0x9769('0x21')](_0x1a38fe[_0x3132a3]);}RpcVoiceQueueReport[_0x9769('0x26')](_0x1a38fe[_0x3132a3]);}};function extractCalleridNumber(_0x20b934){var _0x50ba3d=_0x20b934[_0x9769('0x27')](/<(.*?)>/);return _0x50ba3d?_0x50ba3d[0x1]:_0x20b934;}Report['prototype'][_0x9769('0x28')]=function(_0x1b2954){for(var _0x53d1f4=0x0;_0x53d1f4{delete this[_0xb508('0x7')][_0x3074e2];},_0x2a2ea0);}};module[_0xb508('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0x682a=['seconds','syncMusicOnHoldStart','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','agentcompleteAt','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete'];(function(_0x4b82e9,_0x4252ac){var _0x5247c4=function(_0x2fcf9c){while(--_0x2fcf9c){_0x4b82e9['push'](_0x4b82e9['shift']());}};_0x5247c4(++_0x4252ac);}(_0x682a,0x148));var _0xa682=function(_0x2decb3,_0x5553a8){_0x2decb3=_0x2decb3-0x0;var _0x3e4189=_0x682a[_0x2decb3];return _0x3e4189;};'use strict';var _=require('lodash');var moment=require(_0xa682('0x0'));var util=require(_0xa682('0x1'));var Redis=require(_0xa682('0x2'));var config=require(_0xa682('0x3'));var logger=require(_0xa682('0x4'))('ami');var ami=require(_0xa682('0x5'));config['redis']=_[_0xa682('0x6')](config[_0xa682('0x7')],{'host':_0xa682('0x8'),'port':0x18eb});var io=require(_0xa682('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0xe11ef7){this[_0xa682('0xa')]={};this[_0xa682('0xb')]=_0xe11ef7[_0xa682('0xa')];this[_0xa682('0xc')]=_0xe11ef7[_0xa682('0xc')];this['agents']=_0xe11ef7[_0xa682('0xd')];this[_0xa682('0xe')]={};ami['on'](_0xa682('0xf'),this[_0xa682('0x10')][_0xa682('0x11')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this[_0xa682('0x12')][_0xa682('0x11')](this));ami['on'](_0xa682('0x13'),this[_0xa682('0x14')][_0xa682('0x11')](this));ami['on'](_0xa682('0x15'),this['syncAgentComplete'][_0xa682('0x11')](this));ami['on']('varset',this['syncVarSet'][_0xa682('0x11')](this));ami['on'](_0xa682('0x16'),this[_0xa682('0x17')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa682('0x11')](this));ami['on'](_0xa682('0x18'),this[_0xa682('0x19')]['bind'](this));ami['on'](_0xa682('0x1a'),this[_0xa682('0x1b')][_0xa682('0x11')](this));ami['on'](_0xa682('0x1c'),this[_0xa682('0x1d')][_0xa682('0x11')](this));}VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1f')]=function(_0x1c12fa,_0x3b4796,_0x3220a9){io['to'](_0x1c12fa)['emit'](_0x3b4796,_0x3220a9);};VoiceAgentReport['prototype'][_0xa682('0x20')]=function(_0x2f76c5){return _0x2f76c5!==null&&!_[_0xa682('0x21')](_0x2f76c5);};VoiceAgentReport['prototype'][_0xa682('0x10')]=function(_0x363f6c){try{if(this['isNotNull'](_0x363f6c)){logger[_0xa682('0x22')](_0xa682('0x23'),_0x363f6c['uniqueid'],_0x363f6c[_0xa682('0x24')],_0x363f6c[_0xa682('0x25')]);logger[_0xa682('0x26')](_0xa682('0x27'),_0x363f6c[_0xa682('0x28')],util[_0xa682('0x29')](_0x363f6c,{'showHidden':![],'depth':null}));if(_[_0xa682('0x21')](this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]])){this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]]={};}var _0x102cd2=this['agents'][_0x363f6c[_0xa682('0x2a')]];var _0x1c3fd1=this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]][_0x363f6c[_0xa682('0x25')]];var _0x328a72=this[_0xa682('0xc')][_0x363f6c['queue']];var _0x55377c=this[_0xa682('0xe')][_0x363f6c['uniqueid']];if(_['isUndefined'](_0x1c3fd1)){_0x1c3fd1={'agentcalledAt':moment()[_0xa682('0x2b')](_0xa682('0x2c')),'lastevent':_0xa682('0x2d'),'mandatoryDisposition':_0x328a72&&_0x328a72[_0xa682('0x2e')]?_0x328a72['mandatoryDisposition']:![],'type':_0x328a72&&_0x328a72[_0xa682('0x2f')]?_0x328a72['type']:_0xa682('0x30'),'variables':_0x55377c,'motionChannel':_0xa682('0x31')};}Object[_0xa682('0x32')](_0x1c3fd1,_[_0xa682('0x33')](_0x363f6c,[_0xa682('0x34'),_0xa682('0x35')]));this[_0xa682('0xa')][_0x363f6c['uniqueid']][_0x363f6c[_0xa682('0x25')]]=_0x1c3fd1;logger[_0xa682('0x26')](_0xa682('0x36'),_0x363f6c[_0xa682('0x28')],util[_0xa682('0x29')](_0x1c3fd1,{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x37'),_0x1c3fd1);var _0x231f8a={'id':_0x102cd2['id'],'calleridnum':_0x1c3fd1['calleridnum'],'queue':_0x1c3fd1[_0xa682('0x38')],'variables':_0x1c3fd1[_0xa682('0xe')],'uniqueid':_0x363f6c['uniqueid']};logger[_0xa682('0x26')](_0xa682('0x39'),_0x363f6c['uniqueid'],util[_0xa682('0x29')](_0x231f8a,{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x363f6c['membername']),_0xa682('0x3b'),_0x231f8a);}}catch(_0x3f242d){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentcalled]',_0x363f6c['uniqueid'],util['inspect'](_0x3f242d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x3d')]=function(_0x5cb68b){try{if(this['isNotNull'](_0x5cb68b)){if(this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]]){for(var _0x40739f in this['channels'][_0x5cb68b[_0xa682('0x28')]]){if(this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0xa682('0x3e')](_0x40739f)){if(_0x5cb68b[_0xa682('0x25')]===_0x40739f){logger[_0xa682('0x22')](_0xa682('0x3f'),_0x5cb68b[_0xa682('0x28')],_0x5cb68b[_0xa682('0x24')],_0x5cb68b[_0xa682('0x25')]);this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['agentconnectAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x40')]=_0x5cb68b['connectedlinename'];this['channels'][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x41')]=_0x5cb68b[_0xa682('0x41')];this['channels'][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x42')]=_0x5cb68b['destchannelstate'];this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x43')]=_0x5cb68b[_0xa682('0x43')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['holdtime']=_0x5cb68b[_0xa682('0x44')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['lastevent']='connect';_[_0xa682('0x45')](this[_0xa682('0xd')][_0x5cb68b['interface']],_[_0xa682('0x46')](_0x5cb68b,[_0xa682('0x38'),_0xa682('0x47')]));var _0x12ae68=this[_0xa682('0xd')][_0x5cb68b['interface']];var _0x23e06b={'id':_0x12ae68['id'],'name':_0x12ae68[_0xa682('0x48')],'agentconnected':!![],'destaccountcode':_0x12ae68[_0xa682('0x49')],'destconnectedlinenum':this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x5cb68b[_0xa682('0x25')]][_0xa682('0x4a')],'queue':this['channels'][_0x5cb68b['uniqueid']][_0x5cb68b[_0xa682('0x25')]][_0xa682('0x38')],'uniqueid':this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x5cb68b['destuniqueid']]['uniqueid']};ami[_0xa682('0x1f')](_0xa682('0x4b'),this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x5cb68b['destuniqueid']]);this[_0xa682('0x1f')](util['format']('user:%s',_0x5cb68b[_0xa682('0x24')]),_0xa682('0x4c'),_0x23e06b);}else if(!this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f]['agentringnoanswer']&&!this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x15')]){logger['info'](_0xa682('0x4d'),_0x5cb68b['uniqueid'],this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['membername'],_0x40739f);this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x4e')]=!![];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['agentringnoanswerAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f]['answeredelsewheredestinationuniqueid']=_0x5cb68b[_0xa682('0x25')];this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x4f')]=_0x5cb68b[_0xa682('0x24')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x50')]=_0xa682('0x51');this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['reason']=_0xa682('0x51');logger[_0xa682('0x26')](_0xa682('0x52'),_0x5cb68b['uniqueid'],util[_0xa682('0x29')](this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x53'),this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]);}else{logger[_0xa682('0x26')](_0xa682('0x54'),_0x5cb68b[_0xa682('0x28')]);}}}}}}catch(_0x328705){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentconnect]',_0x5cb68b[_0xa682('0x28')],util[_0xa682('0x29')](_0x328705,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa682('0x12')]=function(_0x59ddb3){try{if(this[_0xa682('0x20')](_0x59ddb3)){logger[_0xa682('0x26')](_0xa682('0x55'),_0x59ddb3[_0xa682('0x28')],util['inspect'](_0x59ddb3,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x59ddb3[_0xa682('0x28')]]&&this['channels'][_0x59ddb3['uniqueid']][_0x59ddb3[_0xa682('0x25')]]){logger[_0xa682('0x22')](_0xa682('0x56'),_0x59ddb3['uniqueid'],_0x59ddb3[_0xa682('0x24')],_0x59ddb3[_0xa682('0x25')]);var _0x2e2a25=this['agents'][_0x59ddb3['interface']];var _0x58f1b3=this[_0xa682('0xa')][_0x59ddb3[_0xa682('0x28')]][_0x59ddb3[_0xa682('0x25')]];_0x58f1b3[_0xa682('0x4e')]=!![];_0x58f1b3[_0xa682('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58f1b3[_0xa682('0x50')]=_0xa682('0x58');_0x58f1b3[_0xa682('0x59')]=_0xa682('0x58');var _0x58f19a={'id':_0x2e2a25['id'],'name':_0x2e2a25[_0xa682('0x48')],'queue':_0x58f1b3[_0xa682('0x38')],'uniqueid':_0x58f1b3[_0xa682('0x28')]};logger[_0xa682('0x26')](_0xa682('0x5a'),_0x59ddb3['uniqueid'],util[_0xa682('0x29')](_0x58f19a,{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x2e2a25['name']),_0xa682('0x5b'),_0x58f19a);ami['emit'](_0xa682('0x5c'),_0x58f1b3);this['channels'][_0x59ddb3[_0xa682('0x28')]][_0x59ddb3[_0xa682('0x25')]]=Object[_0xa682('0x32')]({},_0x58f1b3);}}}catch(_0x498744){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0x59ddb3['uniqueid'],util[_0xa682('0x29')](_0x498744,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa682('0x14')]=function(_0xf8a952){try{if(this['isNotNull'](_0xf8a952)){logger['debug'](_0xa682('0x5d'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](_0xf8a952,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]]){for(var _0x5e0c81 in this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]]){if(this['channels'][_0xf8a952[_0xa682('0x28')]]['hasOwnProperty'](_0x5e0c81)&&!this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81]['agentringnoanswer']&&!this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x15')]){logger[_0xa682('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xf8a952[_0xa682('0x28')],this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x24')],_0x5e0c81);this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81]['agentringnoanswer']=!![];this['channels'][_0xf8a952['uniqueid']][_0x5e0c81][_0xa682('0x57')]=moment()[_0xa682('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa682('0xa')][_0xf8a952['uniqueid']][_0x5e0c81][_0xa682('0x50')]=_0xa682('0x5e');this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x59')]=_0xa682('0x5e');logger[_0xa682('0x26')](_0xa682('0x5f'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x60'),this['channels'][_0xf8a952['uniqueid']][_0x5e0c81]);}}}}}catch(_0xef453c){logger['error'](_0xa682('0x61'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](_0xef453c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x62')]=function(_0x2d86ab){try{if(this[_0xa682('0x20')](_0x2d86ab)){logger['debug'](_0xa682('0x63'),_0x2d86ab[_0xa682('0x28')],util[_0xa682('0x29')](_0x2d86ab,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]]){for(var _0x40b162 in this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]]){if(this['channels'][_0x2d86ab[_0xa682('0x28')]][_0xa682('0x3e')](_0x40b162)){if(this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162][_0xa682('0x64')]&&!this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x15')]){logger[_0xa682('0x22')](_0xa682('0x65'),_0x2d86ab['uniqueid'],this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x24')],_0x40b162);this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x15')]=!![];this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162]['agentcompleteAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162][_0xa682('0x50')]='complete';this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162]['reason']=_0x2d86ab[_0xa682('0x59')]==_0xa682('0x66')?_0xa682('0x67'):_0x2d86ab[_0xa682('0x59')];this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x68')]=_0x2d86ab['talktime'];if(this[_0xa682('0xc')][_0x2d86ab[_0xa682('0x38')]]&&this['voiceQueues'][_0x2d86ab['queue']][_0xa682('0x69')]){this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x6a')]=this[_0xa682('0xc')][_0x2d86ab[_0xa682('0x38')]][_0xa682('0x6b')];this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x6c')]=!![];}this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]=_[_0xa682('0x33')](this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]],[_0xa682('0x38'),_0xa682('0x47')]);logger[_0xa682('0x26')](_0xa682('0x6d'),_0x2d86ab[_0xa682('0x28')],util['inspect'](this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x6e'),this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2d86ab['uniqueid'],util[_0xa682('0x29')]({'id':this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]['id'],'destaccountcode':_0x2d86ab[_0xa682('0x6f')]},{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x2d86ab[_0xa682('0x24')]),_0xa682('0x70'),{'id':this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]['id'],'destaccountcode':Number(_0x2d86ab[_0xa682('0x6f')])});}}}}}}catch(_0xd6c38f){logger[_0xa682('0x3c')](_0xa682('0x71'),_0x2d86ab[_0xa682('0x28')],util[_0xa682('0x29')](_0xd6c38f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x72')]=function(_0x4393f2){try{if(this[_0xa682('0x20')](_0x4393f2)){logger['debug'](_0xa682('0x73'),_0x4393f2[_0xa682('0x28')],util[_0xa682('0x29')](_0x4393f2,{'showHidden':![],'depth':null}));this[_0xa682('0x74')](_0x4393f2['uniqueid'],_[_0xa682('0x75')](_0x4393f2[_0xa682('0x76')])[0x0],_0x4393f2[_0xa682('0x77')]);if(this[_0xa682('0xa')][_0x4393f2['uniqueid']]){for(var _0x434492 in this[_0xa682('0xa')][_0x4393f2['uniqueid']]){if(this[_0xa682('0xa')][_0x4393f2['uniqueid']][_0xa682('0x3e')](_0x434492)){logger[_0xa682('0x22')](_0xa682('0x78'),_0x4393f2[_0xa682('0x28')],_0x434492,_['keys'](_0x4393f2[_0xa682('0x76')])[0x0],_0x4393f2[_0xa682('0x77')]);if(_[_0xa682('0x21')](this[_0xa682('0xa')][_0x4393f2[_0xa682('0x28')]][_0x434492]['variables'])){this['channels'][_0x4393f2['uniqueid']][_0x434492][_0xa682('0xe')]={};}this[_0xa682('0xa')][_0x4393f2[_0xa682('0x28')]][_0x434492][_0xa682('0xe')]=this['variables'][_0x4393f2[_0xa682('0x28')]];}}}}}catch(_0x451e51){logger[_0xa682('0x3c')](_0xa682('0x79'),_0x4393f2[_0xa682('0x28')],util['inspect'](_0x451e51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')]['addVariable']=function(_0x464063,_0x18b92f,_0x188679){var _0x5962b7=[_0xa682('0x7a'),'rtpaudioqosbridged',_0xa682('0x7b'),_0xa682('0x7c'),_0xa682('0x7d'),_0xa682('0x7e'),'rtpaudioqosrtt',_0xa682('0x7f'),_0xa682('0x80'),_0xa682('0x81'),_0xa682('0x82'),_0xa682('0x83'),_0xa682('0x84'),_0xa682('0x85'),_0xa682('0x86'),_0xa682('0x87'),'membername',_0xa682('0x88'),_0xa682('0x89')];if(!_[_0xa682('0x8a')](_0x18b92f)&&!_['includes'](_0x5962b7,_0x18b92f)){if(_['isUndefined'](this[_0xa682('0xe')][_0x464063])){this[_0xa682('0xe')][_0x464063]={};}this[_0xa682('0xe')][_0x464063][_0x18b92f]=_0x188679;}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x17')]=function(_0x5e399b){try{if(this[_0xa682('0x20')](_0x5e399b)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][hangup]\x20event:',_0x5e399b['uniqueid'],util[_0xa682('0x29')](_0x5e399b,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x5e399b['uniqueid']]){for(var _0x382533 in this[_0xa682('0xa')][_0x5e399b['uniqueid']]){if(this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]][_0xa682('0x3e')](_0x382533)){if(this[_0xa682('0xa')][_0x5e399b['uniqueid']][_0x382533][_0xa682('0x59')]==_0xa682('0x66')&&this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]][_0x382533][_0xa682('0x15')]){logger[_0xa682('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5e399b[_0xa682('0x28')],_0x382533);this['channels'][_0x5e399b[_0xa682('0x28')]][_0x382533][_0xa682('0x8b')]=moment()[_0xa682('0x2b')](_0xa682('0x2c'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5e399b[_0xa682('0x28')],util[_0xa682('0x29')](_[_0xa682('0x8c')](this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]]),{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')]('custom:voiceAgentReport',_[_0xa682('0x8c')](this[_0xa682('0xa')][_0x5e399b['uniqueid']]));this[_0xa682('0x8d')](_0x5e399b['uniqueid']);}if(this[_0xa682('0xe')][_0x5e399b[_0xa682('0x28')]]){delete this[_0xa682('0xe')][_0x5e399b[_0xa682('0x28')]];}}}catch(_0x38c691){logger[_0xa682('0x3c')](_0xa682('0x8e'),_0x5e399b['uniqueid'],util[_0xa682('0x29')](_0x38c691,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1b')]=function(_0x4fcb82){try{if(this[_0xa682('0x20')](_0x4fcb82)){logger['debug'](_0xa682('0x8f'),_0x4fcb82[_0xa682('0x28')],util[_0xa682('0x29')](_0x4fcb82,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]){for(var _0x523787 in this['channels'][_0x4fcb82[_0xa682('0x90')]]){if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]['hasOwnProperty'](_0x523787)){if(_0x4fcb82['origtransfereruniqueid']===_0x523787){logger[_0xa682('0x22')](_0xa682('0x91'),_0x4fcb82[_0xa682('0x28')],this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x24')],_0x523787);var _0x168aa8=moment();this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x15')]=!![];this['channels'][_0x4fcb82[_0xa682('0x90')]][_0x523787]['agentcompleteAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x50')]=_0xa682('0x92');this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787]['reason']='transfer';this['channels'][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x68')]=_0x168aa8[_0xa682('0x93')](this[_0xa682('0xa')][_0x4fcb82['transfereeuniqueid']][_0x523787][_0xa682('0x64')],'seconds');}}}}if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]]){var _0x5c8a13=this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]];this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]]=this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]];this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]=_0x5c8a13;}}}catch(_0x1dfcba){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][attendedtransfer]',_0x4fcb82['uniqueid'],util[_0xa682('0x29')](_0x1dfcba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1d')]=function(_0x10858d){try{if(this[_0xa682('0x20')](_0x10858d)){logger[_0xa682('0x26')](_0xa682('0x95'),_0x10858d['uniqueid'],util['inspect'](_0x10858d,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x10858d['transfereeuniqueid']]){for(var _0x4ad7d9 in this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]]){if(this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]]['hasOwnProperty'](_0x4ad7d9)){if(_0x10858d[_0xa682('0x96')]===_0x4ad7d9){logger['info'](_0xa682('0x97'),_0x10858d[_0xa682('0x28')],this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x24')],_0x4ad7d9);var _0x12cdcc=moment();this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x15')]=!![];this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x8b')]=_0x12cdcc;this['channels'][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x50')]='complete';this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9]['reason']=_0xa682('0x66');this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x68')]=_0x12cdcc[_0xa682('0x93')](this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9]['agentconnectAt'],_0xa682('0x98'));}}}}}}catch(_0xcec2e3){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][blindtransfer]',_0x10858d[_0xa682('0x28')],util['inspect'](_0xcec2e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x99')]=function(_0x22ce75){var _0x4a326e='';try{if(this['isNotNull'](_0x22ce75)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x22ce75[_0xa682('0x28')],util[_0xa682('0x29')](_0x22ce75,{'showHidden':![],'depth':null}));if(_0x22ce75[_0xa682('0x9a')]){_0x4a326e=_0x22ce75['channel']['substring'](0x0,_0x22ce75['channel'][_0xa682('0x9b')]('-'));if(this[_0xa682('0xd')][_0x4a326e]){logger[_0xa682('0x22')](_0xa682('0x9c'),_0x22ce75[_0xa682('0x28')],_0x4a326e);this[_0xa682('0xd')][_0x4a326e][_0xa682('0x9d')]=!![];}}}}catch(_0x79053b){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x22ce75[_0xa682('0x28')],util['inspect'](_0x79053b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x19')]=function(_0x9550bb){var _0x104685='';try{if(this[_0xa682('0x20')](_0x9550bb)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x9550bb[_0xa682('0x28')],util[_0xa682('0x29')](_0x9550bb,{'showHidden':![],'depth':null}));if(_0x9550bb[_0xa682('0x9a')]){_0x104685=_0x9550bb['channel'][_0xa682('0x9e')](0x0,_0x9550bb[_0xa682('0x9a')]['lastIndexOf']('-'));if(this[_0xa682('0xd')][_0x104685]){logger[_0xa682('0x22')](_0xa682('0x9f'),_0x9550bb['uniqueid'],_0x104685);this['agents'][_0x104685][_0xa682('0x9d')]=![];}}}}catch(_0x5cbcea){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][musiconholdstop]',_0x9550bb[_0xa682('0x28')],util[_0xa682('0x29')](_0x5cbcea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')]['deleteChannelAfterTimeout']=function(_0x4dee9b,_0x512d56=0x2710){if(this['channels'][_0x4dee9b]){setTimeout(()=>{delete this['channels'][_0x4dee9b];},_0x512d56);}};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 fdf1549..92a8d69 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 _0xcb66=['BlindTransfer','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','playback','NO\x20ANSWER','FAILED','ANSWERED','redis','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','channel','xcally-motion-preview','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','pick','from-sip','split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','emit','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','membername','answered','answertime','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\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','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','monitors','getSettings','catch','Action','StopMixMonitor','finally','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum'];(function(_0x4f7a71,_0x30be7c){var _0x4ed97f=function(_0x53de66){while(--_0x53de66){_0x4f7a71['push'](_0x4f7a71['shift']());}};_0x4ed97f(++_0x30be7c);}(_0xcb66,0x19c));var _0x6cb6=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xcb66[_0x319e2e];return _0x302524;};'use strict';var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var util=require(_0x6cb6('0x2'));var path=require(_0x6cb6('0x3'));var Redis=require(_0x6cb6('0x4'));var config=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var ami=require(_0x6cb6('0x8'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x6cb6('0x9'),'queue','agi','dial',_0x6cb6('0xa'),'voicemail'];var dispositions=[_0x6cb6('0xb'),'FAILED',_0x6cb6('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0x6cb6('0xb'),_0x6cb6('0xd'),'BUSY','FAILED',_0x6cb6('0xc'),_0x6cb6('0xc')];config[_0x6cb6('0xe')]=_['defaults'](config[_0x6cb6('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x6cb6('0xf'))(new Redis(config[_0x6cb6('0xe')]));function VoiceCallReport(_0x51c627){this[_0x6cb6('0x10')]=_0x51c627[_0x6cb6('0x10')];this['agents']=_0x51c627[_0x6cb6('0x11')];this[_0x6cb6('0x12')]={};ami['on'](_0x6cb6('0x13'),this[_0x6cb6('0x14')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x16'),this['syncNewExten'][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x17'),this['syncNewChannel'][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x18'),this[_0x6cb6('0x19')][_0x6cb6('0x15')](this));ami['on']('varset',this[_0x6cb6('0x1a')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1b'),this[_0x6cb6('0x1c')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1d'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0x6cb6('0x1e')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1f'),this[_0x6cb6('0x20')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x21'),this[_0x6cb6('0x22')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x23'),this[_0x6cb6('0x24')][_0x6cb6('0x15')](this));try{logger[_0x6cb6('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x421702){logger[_0x6cb6('0x26')](_0x6cb6('0x27'),util[_0x6cb6('0x28')](_0x421702,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x2a')]=function(_0x14df6b){return _0x14df6b!==null&&!_[_0x6cb6('0x2b')](_0x14df6b);};VoiceCallReport[_0x6cb6('0x29')]['emit']=function(_0x19ff94,_0x41fdb6,_0x19a577){io['to'](_0x19ff94)['emit'](_0x41fdb6,_0x19a577);};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x2c')]=function(_0x109b74){try{if(this[_0x6cb6('0x2a')](_0x109b74)){logger['info'](_0x6cb6('0x2d'),_0x109b74[_0x6cb6('0x2e')],_0x109b74[_0x6cb6('0x2f')],_0x109b74[_0x6cb6('0x30')]);logger[_0x6cb6('0x31')](_0x6cb6('0x32'),_0x109b74[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x109b74,{'showHidden':![],'depth':null}));if(_0x109b74[_0x6cb6('0x2e')]===_0x109b74[_0x6cb6('0x33')]){if(!_[_0x6cb6('0x2b')](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]])){_['merge'](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]],_['pick'](_0x109b74,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]])));}}if(_0x109b74[_0x6cb6('0x35')]==='from-sip'){var _0x434c8b=this['agents'][_0x109b74[_0x6cb6('0x36')]['split']('-')[0x0]];if(_0x434c8b){if(_0x109b74['exten']==_0x6cb6('0x37')){_0x434c8b[_0x6cb6('0x38')]=_0x109b74['connectedlinenum'];this['emit'](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),_0x434c8b[_0x6cb6('0x3b')]),_0x6cb6('0x3c'),{'id':_0x434c8b['id'],'destaccountcode':_0x434c8b[_0x6cb6('0x3d')],'destconnectedlinenum':_0x109b74['connectedlinenum']});}}}}}catch(_0x2d81d3){logger['error'](_0x6cb6('0x3e'),_0x109b74[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x2d81d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')]['syncNewChannel']=function(_0x14fbbb){try{if(this[_0x6cb6('0x2a')](_0x14fbbb)){logger[_0x6cb6('0x31')](_0x6cb6('0x3f'),_0x14fbbb[_0x6cb6('0x2e')],util['inspect'](_0x14fbbb,{'showHidden':![],'depth':null}));if(this['channels'][_0x14fbbb[_0x6cb6('0x2e')]]){return;}if(_0x14fbbb[_0x6cb6('0x36')]===_0x6cb6('0x40')){return;}if(_0x14fbbb[_0x6cb6('0x2e')]!==_0x14fbbb[_0x6cb6('0x33')]&&!this[_0x6cb6('0x12')][_0x14fbbb[_0x6cb6('0x33')]]){return;}logger[_0x6cb6('0x25')](_0x6cb6('0x41'),_0x14fbbb[_0x6cb6('0x2e')],_0x14fbbb[_0x6cb6('0x35')],_0x14fbbb[_0x6cb6('0x42')]);this['channels'][_0x14fbbb[_0x6cb6('0x2e')]]=new Channel();this[_0x6cb6('0x10')][_0x14fbbb['uniqueid']][_0x6cb6('0x43')]=moment()[_0x6cb6('0x39')](_0x6cb6('0x44'));this[_0x6cb6('0x10')][_0x14fbbb[_0x6cb6('0x2e')]][_0x6cb6('0x45')]=dispositions[_[_0x6cb6('0x46')](_0x14fbbb[_0x6cb6('0x47')])];_[_0x6cb6('0x48')](this['channels'][_0x14fbbb[_0x6cb6('0x2e')]],_[_0x6cb6('0x49')](_0x14fbbb,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x14fbbb['uniqueid']])));if(_0x14fbbb['context']===_0x6cb6('0x4a')){var _0x5547e6=this[_0x6cb6('0x11')][_0x14fbbb[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]];if(_0x5547e6&&typeof _0x5547e6[_0x6cb6('0x38')]===_0x6cb6('0x4c')){_0x5547e6[_0x6cb6('0x38')]=_0x14fbbb[_0x6cb6('0x42')];logger[_0x6cb6('0x31')](_0x6cb6('0x4d'),_0x14fbbb[_0x6cb6('0x2e')],util[_0x6cb6('0x28')]({'id':_0x5547e6['id'],'destaccountcode':_0x5547e6[_0x6cb6('0x3d')],'destconnectedlinenum':_0x14fbbb[_0x6cb6('0x42')]},{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),_0x5547e6[_0x6cb6('0x3b')]),_0x6cb6('0x3c'),{'id':_0x5547e6['id'],'destaccountcode':_0x5547e6[_0x6cb6('0x3d')],'destconnectedlinenum':_0x14fbbb[_0x6cb6('0x42')]});}}}}catch(_0x33cec4){logger[_0x6cb6('0x26')](_0x6cb6('0x4f'),_0x14fbbb[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x33cec4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x14')]=function(_0x242525){try{if(this[_0x6cb6('0x2a')](_0x242525)){logger[_0x6cb6('0x31')](_0x6cb6('0x50'),_0x242525['uniqueid'],util['inspect'](_0x242525,{'showHidden':![],'depth':null}));if(_0x242525['channel']==='OutgoingSpoolFailed'||_0x242525[_0x6cb6('0x42')]==='h')return;if(_0x242525[_0x6cb6('0x2e')]===_0x242525[_0x6cb6('0x33')]||this[_0x6cb6('0x12')][_0x242525[_0x6cb6('0x33')]]){_0x242525[_0x6cb6('0x51')]=_0x242525[_0x6cb6('0x51')]?_0x242525[_0x6cb6('0x51')][_0x6cb6('0x52')]():undefined;_0x242525[_0x6cb6('0x53')]=_0x242525[_0x6cb6('0x54')]||_0x242525['applicationdata'];if(_0x242525['appdata']&&_0x242525[_0x6cb6('0x51')]!==_0x6cb6('0x55')){_0x242525[_0x6cb6('0x53')]=_0x242525[_0x6cb6('0x53')][_0x6cb6('0x52')]();}logger['info'](_0x6cb6('0x56'),_0x242525['uniqueid'],_0x242525[_0x6cb6('0x51')],_0x242525[_0x6cb6('0x53')]);if(_[_0x6cb6('0x2b')](this['channels'][_0x242525[_0x6cb6('0x2e')]])){this[_0x6cb6('0x10')][_0x242525['uniqueid']]=new Channel();this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x43')]=_0x242525['duration']?moment()['subtract'](moment[_0x6cb6('0x57')](_0x242525[_0x6cb6('0x57')])[_0x6cb6('0x58')](),_0x6cb6('0x58'))['format'](_0x6cb6('0x44')):moment()[_0x6cb6('0x39')](_0x6cb6('0x44'));this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x45')]='NO\x20ANSWER';}_[_0x6cb6('0x48')](this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]],_[_0x6cb6('0x49')](_0x242525,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x242525['uniqueid']])));if(_[_0x6cb6('0x59')](applications,_0x242525[_0x6cb6('0x51')])){this[_0x6cb6('0x10')][_0x242525['uniqueid']][_0x6cb6('0x5a')]=_0x242525['application'];this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x5b')]=_0x242525[_0x6cb6('0x53')];if(_0x242525[_0x6cb6('0x51')]===_0x6cb6('0x9')&&_[_0x6cb6('0x5c')](_0x242525[_0x6cb6('0x53')]['toLowerCase'](),_0x6cb6('0x5d'))){var _0x57c9fe=_0x242525['applicationdata'][_0x6cb6('0x4b')]('=');var _0x513540=_0x57c9fe[0x0][_0x6cb6('0x52')]()['match'](/cdr\((.*)\)/);if(_0x513540){if(_0x513540[0x1]===_0x6cb6('0x5e')&&!_[_0x6cb6('0x5f')](this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]][_0x513540[0x1]]))return;this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x513540[0x1]]=_0x57c9fe[0x1];}}else if(_0x242525[_0x6cb6('0x51')]===_0x6cb6('0x55')){this['channels'][_0x242525['uniqueid']][_0x6cb6('0x55')]=_0x242525[_0x6cb6('0x53')][_0x6cb6('0x4b')](',')[0x0];}}}}}catch(_0x4ebabf){logger['error'](_0x6cb6('0x60'),_0x242525[_0x6cb6('0x2e')],util['inspect'](_0x4ebabf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x19')]=function(_0x425d2b){try{if(this[_0x6cb6('0x2a')](_0x425d2b)){logger[_0x6cb6('0x25')](_0x6cb6('0x61'),_0x425d2b[_0x6cb6('0x2e')],_0x425d2b[_0x6cb6('0x33')],_0x425d2b[_0x6cb6('0x2f')],_0x425d2b[_0x6cb6('0x30')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x425d2b[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x425d2b,{'showHidden':![],'depth':null}));if(_0x425d2b[_0x6cb6('0x47')]!=='6')return;var _0x526aae=this['agents'][_0x425d2b[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]];if(_0x425d2b[_0x6cb6('0x2e')]!==_0x425d2b[_0x6cb6('0x33')]){var _0x3a9d7b=moment();if(this['channels'][_0x425d2b[_0x6cb6('0x33')]]){if(!this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]]['answered']){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]]['answered']=!![];this['channels'][_0x425d2b[_0x6cb6('0x33')]]['answertime']=_0x3a9d7b['format'](_0x6cb6('0x44'));if(this[_0x6cb6('0x10')][_0x425d2b['linkedid']][_0x6cb6('0x43')]){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x62')]=_0x3a9d7b[_0x6cb6('0x63')](this['channels'][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x43')],_0x6cb6('0x58'));}}this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x33')]=_0x425d2b[_0x6cb6('0x2e')];if(_0x425d2b[_0x6cb6('0x30')]!=='xcally-motion-preview'){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x64')]=_0x425d2b[_0x6cb6('0x30')];}this[_0x6cb6('0x10')][_0x425d2b['linkedid']][_0x6cb6('0x65')]=_0x425d2b[_0x6cb6('0x2f')];this['channels'][_0x425d2b['linkedid']][_0x6cb6('0x66')]=_0x425d2b[_0x6cb6('0x36')];this[_0x6cb6('0x10')][_0x425d2b['linkedid']]['disposition']=dispositions[_[_0x6cb6('0x46')](_0x425d2b[_0x6cb6('0x47')])];if(_0x526aae){this[_0x6cb6('0x10')][_0x425d2b['linkedid']]['UserId']=_0x526aae['id'];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x67')]=_0x526aae[_0x6cb6('0x3b')];}}if(this[_0x6cb6('0x10')][_0x425d2b['uniqueid']]){if(!this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]['answered']){this['channels'][_0x425d2b['uniqueid']][_0x6cb6('0x68')]=!![];this['channels'][_0x425d2b['uniqueid']][_0x6cb6('0x69')]=_0x3a9d7b[_0x6cb6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x43')]){this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x62')]=_0x3a9d7b[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x425d2b['uniqueid']][_0x6cb6('0x43')],'seconds');}}if(_0x425d2b[_0x6cb6('0x30')]!=='xcally-motion-preview'){this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x64')]=_0x425d2b[_0x6cb6('0x30')];}this[_0x6cb6('0x10')][_0x425d2b['uniqueid']][_0x6cb6('0x65')]=_0x425d2b[_0x6cb6('0x2f')];this[_0x6cb6('0x10')][_0x425d2b['uniqueid']]['destinationchannel']=_0x425d2b[_0x6cb6('0x36')];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x45')]=dispositions[_['toNumber'](_0x425d2b[_0x6cb6('0x47')])];}}else{if(this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]){if(_0x526aae){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x6a')]=_0x526aae['id'];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]['membername']=_0x526aae[_0x6cb6('0x3b')];}}}if(_0x425d2b['context']===_0x6cb6('0x4a')){if(_0x526aae){_0x526aae[_0x6cb6('0x38')]=_0x425d2b[_0x6cb6('0x42')];var _0x293d4e;if(this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]){_0x293d4e=this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x55')];}else if(this['channels'][_0x425d2b[_0x6cb6('0x33')]]){_0x293d4e=this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x55')];}_0x526aae[_0x6cb6('0x55')]=_0x293d4e;var _0x4a3e5b={'id':_0x526aae['id'],'name':_0x526aae['name'],'agentconnected':!![],'destaccountcode':_0x526aae[_0x6cb6('0x3d')],'destconnectedlinenum':_0x425d2b[_0x6cb6('0x42')],'queue':_0x293d4e||undefined,'uniqueid':_0x425d2b['linkedid']};logger[_0x6cb6('0x31')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x425d2b[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x4a3e5b,{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util['format'](_0x6cb6('0x3a'),_0x526aae['name']),'user:agentconnect',_0x4a3e5b);}}}}catch(_0x18f588){logger[_0x6cb6('0x26')](_0x6cb6('0x6b'),_0x425d2b['uniqueid'],util['inspect'](_0x18f588,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x6c')]=function(_0x2d2d8b,_0xe23799){try{if(this[_0x6cb6('0x10')][_0x2d2d8b]){logger[_0x6cb6('0x25')](_0x6cb6('0x6d'),_0x2d2d8b,_0xe23799);this['channels'][_0x2d2d8b][_0x6cb6('0x6e')]=!![];if(_[_0x6cb6('0x6f')](_0xe23799,_0x6cb6('0x70'))){_0xe23799=_0xe23799[_0x6cb6('0x71')](_0x6cb6('0x70'),'.WAV');}this[_0x6cb6('0x10')][_0x2d2d8b][_0x6cb6('0x72')]=_0xe23799;var _0x3c1445=_[_0x6cb6('0x73')](this[_0x6cb6('0x10')][_0x2d2d8b]['monitors'],{'filename':_0xe23799});if(_[_0x6cb6('0x5f')](_0x3c1445)){this['channels'][_0x2d2d8b]['monitors'][_0x6cb6('0x74')]({'filename':_0xe23799,'createdAt':moment()[_0x6cb6('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6cb6('0x75')});}}}catch(_0x4e170a){logger[_0x6cb6('0x26')](_0x6cb6('0x76'),_0x2d2d8b,util[_0x6cb6('0x28')](_0x4e170a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x1a')]=function(_0x552eb8){try{if(this[_0x6cb6('0x2a')](_0x552eb8)){logger[_0x6cb6('0x31')](_0x6cb6('0x77'),_0x552eb8['uniqueid'],util[_0x6cb6('0x28')](_0x552eb8,{'showHidden':![],'depth':null}));if(this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]&&_0x552eb8['channel']!='OutgoingSpoolFailed'){if(this[_0x6cb6('0x2a')](_0x552eb8['variable'])){if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')]['mixmonitor_filename'])){logger[_0x6cb6('0x25')](_0x6cb6('0x79'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this['syncMixMonitorFilename'](_0x552eb8['uniqueid'],_0x552eb8[_0x6cb6('0x7a')]);}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x7b')])){logger[_0x6cb6('0x25')](_0x6cb6('0x7c'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x30')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x7d')])){logger[_0x6cb6('0x25')](_0x6cb6('0x7e'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x7f')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8['variable'][_0x6cb6('0x80')])){logger[_0x6cb6('0x25')](_0x6cb6('0x81'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]['type']=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')]['xmd-queue'])){logger[_0x6cb6('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')][_0x6cb6('0x4b')](',')[0x0]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x55')]=_0x552eb8[_0x6cb6('0x7a')][_0x6cb6('0x4b')](',')[0x0];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x82')])){logger[_0x6cb6('0x25')](_0x6cb6('0x83'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x84')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x85')])){logger['info'](_0x6cb6('0x86'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]['destination']=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x87')])){logger[_0x6cb6('0x25')](_0x6cb6('0x88'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x89')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x8a')])){logger[_0x6cb6('0x25')](_0x6cb6('0x8b'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']]['queue']=_0x552eb8[_0x6cb6('0x7a')];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')]['sipcallid'])){logger[_0x6cb6('0x25')](_0x6cb6('0x8c'),_0x552eb8['uniqueid'],_0x552eb8['value']);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x8d')]=_0x552eb8['value'];}}}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x8e')])){if(_0x552eb8[_0x6cb6('0x7a')]){var _0x9bcf01=path[_0x6cb6('0x8f')](_0x552eb8['value'])['name'];logger[_0x6cb6('0x25')](_0x6cb6('0x79'),_0x9bcf01,_0x552eb8['value']);this['syncMixMonitorFilename'](_0x9bcf01,_0x552eb8[_0x6cb6('0x7a')]);}}else if(this['channels'][_0x552eb8['linkedid']]){if(this[_0x6cb6('0x2a')](_0x552eb8['variable'])){if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x90')])){logger[_0x6cb6('0x25')](_0x6cb6('0x8c'),_0x552eb8[_0x6cb6('0x33')],_0x552eb8['value']);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x33')]]['sipcalllinkedid']=_0x552eb8[_0x6cb6('0x7a')];}}}}}catch(_0x50666e){logger[_0x6cb6('0x26')](_0x6cb6('0x91'),_0x552eb8[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x50666e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x1c')]=function(_0x335511){try{if(this['isNotNull'](_0x335511)){logger['debug'](_0x6cb6('0x92'),_0x335511[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x335511,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x335511[_0x6cb6('0x33')]]){if(this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]){this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']]['linkedid']][_0x6cb6('0x2e')]=_0x335511[_0x6cb6('0x2e')];this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]['answered']=this['channels'][_0x335511['uniqueid']][_0x6cb6('0x68')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']]['answertime']=this[_0x6cb6('0x10')][_0x335511['uniqueid']]['answertime'];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]['destinationchannel']=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]][_0x6cb6('0x36')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']][_0x6cb6('0x45')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x45')];this['channels'][_0x335511['uniqueid']]=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']];this['deleteChannelAfterTimeout'](this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]);}else if(this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]]){this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x2e')]=[this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x33')],this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']][_0x6cb6('0x2e')]]['linkedid']=this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x2e')]][0x0];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']][_0x6cb6('0x2e')]][_0x6cb6('0x68')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x68')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x69')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x69')];this['channels'][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['uniqueid']][_0x6cb6('0x66')]=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x36')];this['channels'][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x45')]=this['channels'][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x45')];this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]=this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]);}}if(this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]){logger[_0x6cb6('0x25')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x335511[_0x6cb6('0x2e')],_0x335511[_0x6cb6('0x93')]);var _0x5959b3=moment();this[_0x6cb6('0x10')][_0x335511['uniqueid']][_0x6cb6('0x94')]=_0x5959b3[_0x6cb6('0x39')](_0x6cb6('0x44'));this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x57')]=_0x5959b3[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x43')],'seconds');if(this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]['answered']){this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]['billableseconds']=_0x5959b3[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x69')],_0x6cb6('0x58'));this['channels'][_0x335511['uniqueid']]['holdtime']=this['channels'][_0x335511[_0x6cb6('0x2e')]]['duration']-this['channels'][_0x335511[_0x6cb6('0x2e')]]['billableseconds'];}if(_0x335511[_0x6cb6('0x35')]===_0x6cb6('0x4a')){if(this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]]){this['agents'][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]]=_[_0x6cb6('0x95')](this['agents'][_0x335511[_0x6cb6('0x36')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x6cb6('0x31')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x335511[_0x6cb6('0x2e')],util[_0x6cb6('0x28')]({'id':this['agents'][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3d')]},{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3b')]),_0x6cb6('0x96'),{'id':this['agents'][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0x6cb6('0x11')][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3d')]});for(var _0x6769da=0x0;_0x6769da{delete this[_0x6cb6('0x10')][_0x431c55];},_0x441479);}};module[_0x6cb6('0xc6')]=VoiceCallReport; \ No newline at end of file +var _0x494a=['error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','context','from-sip','agents','channel','split','exten','xcally-motion-preview','destconnectedlinenum','format','name','user:agentconnect','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newchannel]','syncNewExten','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','includes','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','YYYY-MM-DD\x20HH:mm:ss','holdtime','destinationchannel','UserId','membername','answertime','diff','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%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','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','keys','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','path','ioredis','../../../config/environment','../ami','../model/channel','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','blindTransfers','coreshowchannel','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels'];(function(_0x5ab26e,_0x3d5c3a){var _0x54a540=function(_0x51c54b){while(--_0x51c54b){_0x5ab26e['push'](_0x5ab26e['shift']());}};_0x54a540(++_0x3d5c3a);}(_0x494a,0x161));var _0xa494=function(_0xdd0412,_0x5dc266){_0xdd0412=_0xdd0412-0x0;var _0x331ac5=_0x494a[_0xdd0412];return _0x331ac5;};'use strict';var _=require(_0xa494('0x0'));var moment=require(_0xa494('0x1'));var util=require('util');var path=require(_0xa494('0x2'));var Redis=require(_0xa494('0x3'));var config=require(_0xa494('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xa494('0x5'));var Channel=require(_0xa494('0x6'));var RpcSetting=require('../rpc/setting');var applications=[_0xa494('0x7'),_0xa494('0x8'),'agi',_0xa494('0x9'),'playback',_0xa494('0xa')];var dispositions=[_0xa494('0xb'),_0xa494('0xc'),_0xa494('0xc'),_0xa494('0xb'),_0xa494('0xb'),_0xa494('0xb'),'ANSWERED',_0xa494('0xd'),_0xa494('0xc'),_0xa494('0xc'),_0xa494('0xc')];config[_0xa494('0xe')]=_[_0xa494('0xf')](config[_0xa494('0xe')],{'host':_0xa494('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa494('0xe')]));function VoiceCallReport(_0x8e062){this[_0xa494('0x11')]=_0x8e062[_0xa494('0x11')];this['agents']=_0x8e062['agents'];this[_0xa494('0x12')]={};ami['on'](_0xa494('0x13'),this['syncNewExten'][_0xa494('0x14')](this));ami['on'](_0xa494('0x15'),this['syncNewExten']['bind'](this));ami['on'](_0xa494('0x16'),this[_0xa494('0x17')][_0xa494('0x14')](this));ami['on'](_0xa494('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xa494('0x19'),this[_0xa494('0x1a')][_0xa494('0x14')](this));ami['on'](_0xa494('0x1b'),this[_0xa494('0x1c')][_0xa494('0x14')](this));ami['on']('newcallerid',this[_0xa494('0x1d')][_0xa494('0x14')](this));ami['on'](_0xa494('0x1e'),this[_0xa494('0x1f')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa494('0x14')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa494('0x14')](this));ami['on'](_0xa494('0x20'),this[_0xa494('0x21')][_0xa494('0x14')](this));try{logger[_0xa494('0x22')](_0xa494('0x23'));ami[_0xa494('0x24')]();}catch(_0xc74035){logger[_0xa494('0x25')](_0xa494('0x26'),util[_0xa494('0x27')](_0xc74035,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa494('0x28')][_0xa494('0x29')]=function(_0x1e99d6){return _0x1e99d6!==null&&!_['isUndefined'](_0x1e99d6);};VoiceCallReport[_0xa494('0x28')][_0xa494('0x2a')]=function(_0x274d7b,_0x19354c,_0x59b1c6){io['to'](_0x274d7b)[_0xa494('0x2a')](_0x19354c,_0x59b1c6);};VoiceCallReport[_0xa494('0x28')][_0xa494('0x1d')]=function(_0x1cf01b){try{if(this[_0xa494('0x29')](_0x1cf01b)){logger[_0xa494('0x22')](_0xa494('0x2b'),_0x1cf01b[_0xa494('0x2c')],_0x1cf01b[_0xa494('0x2d')],_0x1cf01b[_0xa494('0x2e')]);logger['debug'](_0xa494('0x2f'),_0x1cf01b['uniqueid'],util[_0xa494('0x27')](_0x1cf01b,{'showHidden':![],'depth':null}));if(_0x1cf01b[_0xa494('0x2c')]===_0x1cf01b[_0xa494('0x30')]){if(!_[_0xa494('0x31')](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]])){_[_0xa494('0x32')](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]],_[_0xa494('0x33')](_0x1cf01b,_['keys'](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]])));}}if(_0x1cf01b[_0xa494('0x34')]===_0xa494('0x35')){var _0x27840a=this[_0xa494('0x36')][_0x1cf01b[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x27840a){if(_0x1cf01b[_0xa494('0x39')]==_0xa494('0x3a')){_0x27840a[_0xa494('0x3b')]=_0x1cf01b['connectedlinenum'];this[_0xa494('0x2a')](util[_0xa494('0x3c')]('user:%s',_0x27840a[_0xa494('0x3d')]),_0xa494('0x3e'),{'id':_0x27840a['id'],'destaccountcode':_0x27840a[_0xa494('0x3f')],'destconnectedlinenum':_0x1cf01b[_0xa494('0x40')]});}}}}}catch(_0x2826b9){logger[_0xa494('0x25')](_0xa494('0x41'),_0x1cf01b[_0xa494('0x2c')],util[_0xa494('0x27')](_0x2826b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x17')]=function(_0x13a32d){try{if(this[_0xa494('0x29')](_0x13a32d)){logger[_0xa494('0x42')](_0xa494('0x43'),_0x13a32d['uniqueid'],util[_0xa494('0x27')](_0x13a32d,{'showHidden':![],'depth':null}));if(this[_0xa494('0x11')][_0x13a32d['uniqueid']]){return;}if(_0x13a32d[_0xa494('0x37')]===_0xa494('0x44')){return;}if(_0x13a32d[_0xa494('0x2c')]!==_0x13a32d[_0xa494('0x30')]&&!this[_0xa494('0x12')][_0x13a32d[_0xa494('0x30')]]){return;}logger[_0xa494('0x22')](_0xa494('0x45'),_0x13a32d[_0xa494('0x2c')],_0x13a32d[_0xa494('0x34')],_0x13a32d['exten']);this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]]=new Channel();this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]][_0xa494('0x46')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x13a32d[_0xa494('0x49')])];_['merge'](this['channels'][_0x13a32d[_0xa494('0x2c')]],_[_0xa494('0x33')](_0x13a32d,_['keys'](this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]])));if(_0x13a32d[_0xa494('0x34')]===_0xa494('0x35')){var _0x372678=this[_0xa494('0x36')][_0x13a32d[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x372678&&typeof _0x372678[_0xa494('0x3b')]===_0xa494('0x4a')){_0x372678[_0xa494('0x3b')]=_0x13a32d['exten'];logger['debug'](_0xa494('0x4b'),_0x13a32d[_0xa494('0x2c')],util[_0xa494('0x27')]({'id':_0x372678['id'],'destaccountcode':_0x372678[_0xa494('0x3f')],'destconnectedlinenum':_0x13a32d[_0xa494('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xa494('0x4c'),_0x372678[_0xa494('0x3d')]),_0xa494('0x3e'),{'id':_0x372678['id'],'destaccountcode':_0x372678[_0xa494('0x3f')],'destconnectedlinenum':_0x13a32d['exten']});}}}}catch(_0x26ee93){logger[_0xa494('0x25')](_0xa494('0x4d'),_0x13a32d[_0xa494('0x2c')],util[_0xa494('0x27')](_0x26ee93,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x4e')]=function(_0x2ca212){try{if(this[_0xa494('0x29')](_0x2ca212)){logger[_0xa494('0x42')]('[%s][voiceCallReport][newexten]\x20event:',_0x2ca212[_0xa494('0x2c')],util[_0xa494('0x27')](_0x2ca212,{'showHidden':![],'depth':null}));if(_0x2ca212[_0xa494('0x37')]==='OutgoingSpoolFailed'||_0x2ca212[_0xa494('0x39')]==='h')return;if(_0x2ca212[_0xa494('0x2c')]===_0x2ca212['linkedid']||this['blindTransfers'][_0x2ca212['linkedid']]){_0x2ca212[_0xa494('0x4f')]=_0x2ca212[_0xa494('0x4f')]?_0x2ca212[_0xa494('0x4f')][_0xa494('0x50')]():undefined;_0x2ca212[_0xa494('0x51')]=_0x2ca212['appdata']||_0x2ca212[_0xa494('0x51')];if(_0x2ca212[_0xa494('0x52')]&&_0x2ca212[_0xa494('0x4f')]!=='queue'){_0x2ca212[_0xa494('0x51')]=_0x2ca212[_0xa494('0x51')][_0xa494('0x50')]();}logger[_0xa494('0x22')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2ca212[_0xa494('0x2c')],_0x2ca212['application'],_0x2ca212['applicationdata']);if(_[_0xa494('0x31')](this['channels'][_0x2ca212['uniqueid']])){this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]]=new Channel();this[_0xa494('0x11')][_0x2ca212['uniqueid']][_0xa494('0x46')]=_0x2ca212['duration']?moment()[_0xa494('0x53')](moment[_0xa494('0x54')](_0x2ca212[_0xa494('0x54')])[_0xa494('0x55')](),_0xa494('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]][_0xa494('0x47')]=_0xa494('0xb');}_[_0xa494('0x32')](this[_0xa494('0x11')][_0x2ca212['uniqueid']],_[_0xa494('0x33')](_0x2ca212,_['keys'](this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]])));if(_[_0xa494('0x56')](applications,_0x2ca212[_0xa494('0x4f')])){this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]]['lastapplication']=_0x2ca212[_0xa494('0x4f')];this['channels'][_0x2ca212[_0xa494('0x2c')]]['lastdata']=_0x2ca212[_0xa494('0x51')];if(_0x2ca212[_0xa494('0x4f')]===_0xa494('0x7')&&_['startsWith'](_0x2ca212['applicationdata'][_0xa494('0x50')](),_0xa494('0x57'))){var _0x3cbe85=_0x2ca212[_0xa494('0x51')][_0xa494('0x38')]('=');var _0xdf6ce=_0x3cbe85[0x0]['toLowerCase']()[_0xa494('0x58')](/cdr\((.*)\)/);if(_0xdf6ce){if(_0xdf6ce[0x1]===_0xa494('0x59')&&!_[_0xa494('0x5a')](this['channels'][_0x2ca212[_0xa494('0x2c')]][_0xdf6ce[0x1]]))return;this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]][_0xdf6ce[0x1]]=_0x3cbe85[0x1];}}else if(_0x2ca212['application']===_0xa494('0x8')){this['channels'][_0x2ca212[_0xa494('0x2c')]]['queue']=_0x2ca212[_0xa494('0x51')][_0xa494('0x38')](',')[0x0];}}}}}catch(_0x494609){logger['error'](_0xa494('0x5b'),_0x2ca212[_0xa494('0x2c')],util[_0xa494('0x27')](_0x494609,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')]['syncNewState']=function(_0x5346e8){try{if(this['isNotNull'](_0x5346e8)){logger[_0xa494('0x22')](_0xa494('0x5c'),_0x5346e8[_0xa494('0x2c')],_0x5346e8['linkedid'],_0x5346e8['calleridname'],_0x5346e8[_0xa494('0x2e')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x5346e8['uniqueid'],util['inspect'](_0x5346e8,{'showHidden':![],'depth':null}));if(_0x5346e8[_0xa494('0x49')]!=='6')return;var _0x4ae68c=this[_0xa494('0x36')][_0x5346e8[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x5346e8['uniqueid']!==_0x5346e8['linkedid']){var _0x44fbea=moment();if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]){if(!this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]['answered']=!![];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]['answertime']=_0x44fbea[_0xa494('0x3c')](_0xa494('0x5e'));if(this[_0xa494('0x11')][_0x5346e8['linkedid']][_0xa494('0x46')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x5f')]=_0x44fbea['diff'](this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x46')],'seconds');}}this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x30')]=_0x5346e8[_0xa494('0x2c')];if(_0x5346e8[_0xa494('0x2e')]!==_0xa494('0x3a')){this['channels'][_0x5346e8[_0xa494('0x30')]][_0xa494('0x40')]=_0x5346e8[_0xa494('0x2e')];}this['channels'][_0x5346e8[_0xa494('0x30')]]['connectedlinename']=_0x5346e8['calleridname'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x60')]=_0x5346e8[_0xa494('0x37')];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x5346e8[_0xa494('0x49')])];if(_0x4ae68c){this[_0xa494('0x11')][_0x5346e8['linkedid']][_0xa494('0x61')]=_0x4ae68c['id'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x62')]=_0x4ae68c[_0xa494('0x3d')];}}if(this[_0xa494('0x11')][_0x5346e8['uniqueid']]){if(!this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x5d')]=!![];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x63')]=_0x44fbea['format'](_0xa494('0x5e'));if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x46')]){this['channels'][_0x5346e8['uniqueid']][_0xa494('0x5f')]=_0x44fbea[_0xa494('0x64')](this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x46')],_0xa494('0x55'));}}if(_0x5346e8[_0xa494('0x2e')]!==_0xa494('0x3a')){this['channels'][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x40')]=_0x5346e8[_0xa494('0x2e')];}this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x65')]=_0x5346e8[_0xa494('0x2d')];this[_0xa494('0x11')][_0x5346e8['uniqueid']][_0xa494('0x60')]=_0x5346e8[_0xa494('0x37')];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x5346e8[_0xa494('0x49')])];}}else{if(this[_0xa494('0x11')][_0x5346e8['uniqueid']]){if(_0x4ae68c){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x61')]=_0x4ae68c['id'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x62')]=_0x4ae68c[_0xa494('0x3d')];}}}if(_0x5346e8[_0xa494('0x34')]===_0xa494('0x35')){if(_0x4ae68c){_0x4ae68c[_0xa494('0x3b')]=_0x5346e8['exten'];var _0x44f6f1;if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]]){_0x44f6f1=this['channels'][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x8')];}else if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]){_0x44f6f1=this['channels'][_0x5346e8[_0xa494('0x30')]][_0xa494('0x8')];}_0x4ae68c['queue']=_0x44f6f1;var _0x36f5f3={'id':_0x4ae68c['id'],'name':_0x4ae68c['name'],'agentconnected':!![],'destaccountcode':_0x4ae68c[_0xa494('0x3f')],'destconnectedlinenum':_0x5346e8[_0xa494('0x39')],'queue':_0x44f6f1||undefined,'uniqueid':_0x5346e8['linkedid']};logger[_0xa494('0x42')](_0xa494('0x66'),_0x5346e8[_0xa494('0x2c')],util[_0xa494('0x27')](_0x36f5f3,{'showHidden':![],'depth':null}));this[_0xa494('0x2a')](util[_0xa494('0x3c')]('user:%s',_0x4ae68c['name']),_0xa494('0x3e'),_0x36f5f3);}}}}catch(_0x333e89){logger[_0xa494('0x25')]('[%s][voiceCallReport][newstate]',_0x5346e8[_0xa494('0x2c')],util[_0xa494('0x27')](_0x333e89,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x67')]=function(_0x30087f,_0x6e3999){try{if(this[_0xa494('0x11')][_0x30087f]){logger[_0xa494('0x22')](_0xa494('0x68'),_0x30087f,_0x6e3999);this[_0xa494('0x11')][_0x30087f][_0xa494('0x69')]=!![];if(_[_0xa494('0x6a')](_0x6e3999,'.wav49')){_0x6e3999=_0x6e3999[_0xa494('0x6b')](_0xa494('0x6c'),'.WAV');}this[_0xa494('0x11')][_0x30087f][_0xa494('0x6d')]=_0x6e3999;var _0x526c11=_[_0xa494('0x6e')](this[_0xa494('0x11')][_0x30087f][_0xa494('0x6f')],{'filename':_0x6e3999});if(_[_0xa494('0x5a')](_0x526c11)){this[_0xa494('0x11')][_0x30087f][_0xa494('0x6f')]['push']({'filename':_0x6e3999,'createdAt':moment()[_0xa494('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xa494('0x70')});}}}catch(_0x4a6616){logger[_0xa494('0x25')](_0xa494('0x71'),_0x30087f,util['inspect'](_0x4a6616,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x1a')]=function(_0x233cbf){try{if(this[_0xa494('0x29')](_0x233cbf)){logger[_0xa494('0x42')]('[%s][voiceCallReport][varset]\x20event:',_0x233cbf[_0xa494('0x2c')],util[_0xa494('0x27')](_0x233cbf,{'showHidden':![],'depth':null}));if(this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]]&&_0x233cbf[_0xa494('0x37')]!=_0xa494('0x44')){if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')])){if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x73')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this['syncMixMonitorFilename'](_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x75')])){logger['info'](_0xa494('0x76'),_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x2e')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf['variable']['xmd-callerid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x77')]=_0x233cbf[_0xa494('0x74')];}else if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')][_0xa494('0x78')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this['channels'][_0x233cbf['uniqueid']][_0xa494('0x59')]=_0x233cbf['value'];}else if(this[_0xa494('0x29')](_0x233cbf['variable'][_0xa494('0x79')])){logger[_0xa494('0x22')](_0xa494('0x7a'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value'][_0xa494('0x38')](',')[0x0]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]]['queue']=_0x233cbf[_0xa494('0x74')][_0xa494('0x38')](',')[0x0];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x7b')])){logger['info'](_0xa494('0x7c'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x7d')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x7e')])){logger['info'](_0xa494('0x7f'),_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x80')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x81')])){logger[_0xa494('0x22')](_0xa494('0x82'),_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x83')]=_0x233cbf['value'];}else if(this['isNotNull'](_0x233cbf['variable']['xmcs-queue'])){logger[_0xa494('0x22')](_0xa494('0x84'),_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf[_0xa494('0x2c')]]['queue']=_0x233cbf[_0xa494('0x74')];}else if(this[_0xa494('0x29')](_0x233cbf['variable'][_0xa494('0x85')])){logger[_0xa494('0x22')](_0xa494('0x86'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x87')]=_0x233cbf[_0xa494('0x74')];}}}else if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')]['mixmonitor_filename'])){if(_0x233cbf['value']){var _0x4bdb1d=path[_0xa494('0x88')](_0x233cbf[_0xa494('0x74')])[_0xa494('0x3d')];logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4bdb1d,_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x67')](_0x4bdb1d,_0x233cbf['value']);}}else if(this[_0xa494('0x11')][_0x233cbf[_0xa494('0x30')]]){if(this['isNotNull'](_0x233cbf[_0xa494('0x72')])){if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')][_0xa494('0x85')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x233cbf[_0xa494('0x30')],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf['linkedid']][_0xa494('0x89')]=_0x233cbf['value'];}}}}}catch(_0x213438){logger[_0xa494('0x25')](_0xa494('0x8a'),_0x233cbf[_0xa494('0x2c')],util[_0xa494('0x27')](_0x213438,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')]['syncHangup']=function(_0x273de7){try{if(this[_0xa494('0x29')](_0x273de7)){logger[_0xa494('0x42')](_0xa494('0x8b'),_0x273de7[_0xa494('0x2c')],util['inspect'](_0x273de7,{'showHidden':![],'depth':null}));if(this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]){if(this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x30')]]){this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['uniqueid']=_0x273de7['uniqueid'];this['channels'][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]]['answered']=this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x5d')];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['answertime']=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x63')];this['channels'][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]]['destinationchannel']=this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['channel'];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x30')]]['disposition']=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x47')];this[_0xa494('0x11')][_0x273de7['uniqueid']]=this[_0xa494('0x11')][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]];this[_0xa494('0x8c')](this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]);}else if(this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]]){this['channels'][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x2c')]=[this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x30')],this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]['uniqueid']]['linkedid']=this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]['uniqueid']][_0xa494('0x2c')]][0x0];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x5d')]=this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x5d')];this['channels'][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x63')]=this['channels'][_0x273de7[_0xa494('0x2c')]]['answertime'];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]]['destinationchannel']=this['channels'][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x37')];this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x47')]=this['channels'][_0x273de7[_0xa494('0x2c')]][_0xa494('0x47')];this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]=this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x2c')]];this['deleteChannelAfterTimeout'](this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]);}}if(this['channels'][_0x273de7[_0xa494('0x2c')]]){logger['info'](_0xa494('0x8d'),_0x273de7[_0xa494('0x2c')],_0x273de7[_0xa494('0x8e')]);var _0x5e1fbb=moment();this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x8f')]=_0x5e1fbb[_0xa494('0x3c')](_0xa494('0x5e'));this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x54')]=_0x5e1fbb[_0xa494('0x64')](this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]['starttime'],_0xa494('0x55'));if(this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x90')]=_0x5e1fbb[_0xa494('0x64')](this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x63')],_0xa494('0x55'));this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x5f')]=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]['duration']-this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x90')];}if(_0x273de7['context']==='from-sip'){if(this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]){this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')]['split']('-')[0x0]]=_[_0xa494('0x91')](this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]],[_0xa494('0x3b')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x273de7['uniqueid'],util[_0xa494('0x27')]({'id':this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3f')]},{'showHidden':![],'depth':null}));this[_0xa494('0x2a')](util['format'](_0xa494('0x4c'),this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3d')]),_0xa494('0x92'),{'id':this['agents'][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0xa494('0x36')][_0x273de7['channel'][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3f')]});for(var _0x6ceca1=0x0;_0x6ceca1{delete this['channels'][_0x18a41f];},_0x1a6498);}};module[_0xa494('0xc2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 21775ff..25177d9 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 _0x4020=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','holdtime','billableseconds','sumHoldTime','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'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x4020,0x1f0));var _0x0402=function(_0x5d6968,_0x4f7cef){_0x5d6968=_0x5d6968-0x0;var _0x131ead=_0x4020[_0x5d6968];return _0x131ead;};'use strict';var _=require('lodash');var moment=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var Redis=require(_0x0402('0x2'));var config=require(_0x0402('0x3'));var logger=require(_0x0402('0x4'))(_0x0402('0x5'));var ami=require('../ami');config[_0x0402('0x6')]=_[_0x0402('0x7')](config[_0x0402('0x6')],{'host':_0x0402('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0402('0x6')]));function VoiceDialReport(_0x48f4d2){this[_0x0402('0x9')]=_0x48f4d2[_0x0402('0xa')];this[_0x0402('0xb')]=_0x48f4d2[_0x0402('0xb')];this[_0x0402('0xc')]={};this[_0x0402('0xd')]={};ami['on'](_0x0402('0xe'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x0402('0xf')](this));ami['on'](_0x0402('0x10'),this[_0x0402('0x11')]['bind'](this));ami['on'](_0x0402('0x12'),this[_0x0402('0x13')]['bind'](this));}VoiceDialReport[_0x0402('0x14')]['isNotNull']=function(_0x3e9d6c){return _0x3e9d6c!==null&&!_[_0x0402('0x15')](_0x3e9d6c);};VoiceDialReport['prototype'][_0x0402('0x16')]=function(_0x907f68,_0x5959af,_0x1648e1){io['to'](_0x907f68)[_0x0402('0x16')](_0x5959af,_0x1648e1);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x59000d){try{if(this[_0x0402('0x17')](_0x59000d)){logger['debug'](_0x0402('0x18'),_0x59000d[_0x0402('0x19')],util['inspect'](_0x59000d,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]){_[_0x0402('0x1a')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'starttime':moment()[_0x0402('0x1b')](_0x0402('0x1c')),'lastevent':'called','interface':_0x59000d[_0x0402('0x1d')]['substring'](0x0,_0x59000d['channel'][_0x0402('0x1e')]('-')),'membername':_0x59000d[_0x0402('0x1d')][_0x0402('0x1f')](_0x59000d[_0x0402('0x1d')][_0x0402('0x1e')]('/')+0x1,_0x59000d[_0x0402('0x1d')]['lastIndexOf']('-'))},_[_0x0402('0x20')](_0x59000d,[_0x0402('0x21'),_0x0402('0x22')]));logger[_0x0402('0x23')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x59000d[_0x0402('0x19')],this[_0x0402('0x9')][_0x59000d['uniqueid']]['membername'],this['channels'][_0x59000d[_0x0402('0x19')]][_0x0402('0x24')]);logger[_0x0402('0x25')](_0x0402('0x26'),_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x0402('0xc')][_0x59000d[_0x0402('0x19')]])_[_0x0402('0x1a')](this['channels'][_0x59000d[_0x0402('0x19')]],this[_0x0402('0xc')][_0x59000d['uniqueid']]);this[_0x0402('0x16')](_0x0402('0x28'),_0x0402('0x29'),this['channels'][_0x59000d[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x2a'),this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]);}}}catch(_0x5d75e5){logger[_0x0402('0x2b')](_0x0402('0x2c'),_0x59000d['uniqueid'],util[_0x0402('0x27')](_0x5d75e5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x2d')]=function(_0x25d163){try{if(this[_0x0402('0x17')](_0x25d163)){logger[_0x0402('0x25')](_0x0402('0x2e'),_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](_0x25d163,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x25d163['uniqueid']]){this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x2f')]=_0x25d163[_0x0402('0x2f')];if(_0x25d163['dialstatus']===_0x0402('0x30')){this[_0x0402('0x9')][_0x25d163['uniqueid']]['connectedlinenum']=_0x25d163['connectedlinenum'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['connectedlinename']=_0x25d163['connectedlinename'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x31')]=moment()[_0x0402('0x1b')](_0x0402('0x1c'));this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['lastevent']=_0x0402('0x32');logger[_0x0402('0x23')](_0x0402('0x33'),_0x25d163['uniqueid'],_0x25d163[_0x0402('0x1d')][_0x0402('0x1f')](_0x25d163['channel'][_0x0402('0x1e')]('/')+0x1,_0x25d163['channel'][_0x0402('0x1e')]('-')));logger['debug'](_0x0402('0x34'),_0x25d163['uniqueid'],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x35'),this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}}}catch(_0x2b1d7f){logger['error'](_0x0402('0x36'),_0x25d163['uniqueid'],util[_0x0402('0x27')](_0x2b1d7f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x11')]=function(_0x3d4004){try{if(this['isNotNull'](_0x3d4004)){logger[_0x0402('0x25')](_0x0402('0x37'),_0x3d4004['uniqueid'],util[_0x0402('0x27')](_0x3d4004,{'showHidden':![],'depth':null}));this[_0x0402('0x38')](_0x3d4004[_0x0402('0x19')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);if(this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')])&&this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')])){if(_['isUndefined'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]])){this['channels'][_0x3d4004[_0x0402('0x19')]]={'routeId':_0x3d4004[_0x0402('0x3b')],'variables':this[_0x0402('0xd')][_0x3d4004[_0x0402('0x19')]],'motionChannel':_0x0402('0x3d')};logger[_0x0402('0x23')](_0x0402('0x3e'),_0x3d4004[_0x0402('0x19')],_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);logger[_0x0402('0x25')](_0x0402('0x3f'),_0x3d4004[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x29'),this['channels'][_0x3d4004['uniqueid']]);}}}}catch(_0x1db004){logger[_0x0402('0x2b')](_0x0402('0x40'),_0x3d4004[_0x0402('0x19')],util[_0x0402('0x27')](_0x1db004,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x38')]=function(_0x1d2087,_0x1e74cd,_0x178ee2){var _0x2d06ab=[_0x0402('0x41'),_0x0402('0x42'),_0x0402('0x43'),_0x0402('0x44'),_0x0402('0x45'),_0x0402('0x46'),_0x0402('0x47'),_0x0402('0x48'),_0x0402('0x49'),'sipuri',_0x0402('0x4a'),'bridgepvtcallid',_0x0402('0x4b'),_0x0402('0x4c'),_0x0402('0x4d'),_0x0402('0x4e'),_0x0402('0x4f'),_0x0402('0x50'),_0x0402('0x51')];if(!_[_0x0402('0x52')](_0x1e74cd)&&!_[_0x0402('0x53')](_0x2d06ab,_0x1e74cd)){if(_['isUndefined'](this[_0x0402('0xd')][_0x1d2087])){this[_0x0402('0xd')][_0x1d2087]={};}this['variables'][_0x1d2087][_0x1e74cd]=_0x178ee2;}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x13')]=function(_0x2ea6fe){try{if(this[_0x0402('0x17')](_0x2ea6fe)){logger[_0x0402('0x25')](_0x0402('0x54'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](_0x2ea6fe,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]){logger[_0x0402('0x23')](_0x0402('0x55'),_0x2ea6fe[_0x0402('0x19')],_0x2ea6fe[_0x0402('0x56')]);this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')]=moment()['format'](_0x0402('0x1c'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')]=moment(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['lastevent']='complete';this[_0x0402('0xb')]['total']+=0x1;if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x31')]){this[_0x0402('0xb')]['answered']+=0x1;this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]=moment(this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x31')])['diff'](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')]=moment(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['answertime'],'seconds');this[_0x0402('0xb')][_0x0402('0x5e')]+=this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]||0x0;this[_0x0402('0xb')][_0x0402('0x5f')]+=this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')];}this[_0x0402('0xb')][_0x0402('0x60')]+=this['channels'][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')];logger[_0x0402('0x25')](_0x0402('0x61'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x62'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0402('0x63'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger[_0x0402('0x25')](_0x0402('0x64'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x65'),this[_0x0402('0xb')]);logger['info'](_0x0402('0x66'),JSON[_0x0402('0x67')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]));logger[_0x0402('0x25')](_0x0402('0x68'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0402('0x28'),'voice_outbound_channel:remove',this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);this[_0x0402('0x69')](_0x2ea6fe[_0x0402('0x19')]);}else if(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]]){this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]][_0x0402('0x19')]=this[_0x0402('0x9')][_0x2ea6fe['linkedid']][_0x0402('0x6b')];}if(this[_0x0402('0xd')][_0x2ea6fe[_0x0402('0x19')]]){delete this['variables'][_0x2ea6fe['uniqueid']];}}}catch(_0x114ffd){logger[_0x0402('0x2b')](_0x0402('0x6c'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](_0x114ffd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x6d')]=function(_0xf3c05d){try{if(this['isNotNull'](_0xf3c05d)){logger[_0x0402('0x25')](_0x0402('0x6e'),_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0xf3c05d,{'showHidden':![],'depth':null}));if(_0xf3c05d['application'][_0x0402('0x6f')]()==='set'){_0xf3c05d[_0x0402('0x70')]=(_0xf3c05d[_0x0402('0x71')]||_0xf3c05d[_0x0402('0x70')])[_0x0402('0x6f')]();if(_[_0x0402('0x72')](_0xf3c05d['applicationdata'],_0x0402('0x73'))){if(_[_0x0402('0x15')](this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]))this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]={};logger[_0x0402('0x23')](_0x0402('0x74'),_0xf3c05d[_0x0402('0x19')],_0xf3c05d['application'],_0xf3c05d[_0x0402('0x70')]);var _0x373971=_0xf3c05d[_0x0402('0x70')][_0x0402('0x75')]('=');var _0xd04699=_0x373971[0x0][_0x0402('0x76')](/cdr\((.*)\)/);if(_0xd04699)this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]][_0xd04699[0x1]]=_0x373971[0x1];}}}}catch(_0x24ed10){logger[_0x0402('0x2b')]('[%s][voiceDialReport][newexten]',_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0x24ed10,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')]['deleteChannelAfterTimeout']=function(_0x1d2f8b,_0x476647=0x2710){if(this[_0x0402('0x9')][_0x1d2f8b]){setTimeout(()=>{delete this[_0x0402('0x9')][_0x1d2f8b];},_0x476647);}};module[_0x0402('0x77')]=VoiceDialReport; \ No newline at end of file +var _0x691a=['defaults','localhost','socket.io-emitter','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncHangup','isUndefined','prototype','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','complete','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x691a,0x1df));var _0xa691=function(_0xb4cc1d,_0x276e3c){_0xb4cc1d=_0xb4cc1d-0x0;var _0xc51935=_0x691a[_0xb4cc1d];return _0xc51935;};'use strict';var _=require(_0xa691('0x0'));var moment=require(_0xa691('0x1'));var util=require(_0xa691('0x2'));var Redis=require(_0xa691('0x3'));var config=require(_0xa691('0x4'));var logger=require(_0xa691('0x5'))(_0xa691('0x6'));var ami=require(_0xa691('0x7'));config[_0xa691('0x8')]=_[_0xa691('0x9')](config['redis'],{'host':_0xa691('0xa'),'port':0x18eb});var io=require(_0xa691('0xb'))(new Redis(config['redis']));function VoiceDialReport(_0x173d1d){this['channels']=_0x173d1d[_0xa691('0xc')];this[_0xa691('0xd')]=_0x173d1d[_0xa691('0xd')];this[_0xa691('0xe')]={};this['variables']={};ami['on'](_0xa691('0xf'),this[_0xa691('0x10')][_0xa691('0x11')](this));ami['on']('dialend',this[_0xa691('0x12')][_0xa691('0x11')](this));ami['on'](_0xa691('0x13'),this['syncVarSet'][_0xa691('0x11')](this));ami['on']('hangup',this[_0xa691('0x14')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x2d66c9){return _0x2d66c9!==null&&!_[_0xa691('0x15')](_0x2d66c9);};VoiceDialReport[_0xa691('0x16')][_0xa691('0x17')]=function(_0x4b8ce0,_0x2c2ac9,_0x3ceecb){io['to'](_0x4b8ce0)[_0xa691('0x17')](_0x2c2ac9,_0x3ceecb);};VoiceDialReport[_0xa691('0x16')]['syncDialBegin']=function(_0x4064ea){try{if(this[_0xa691('0x18')](_0x4064ea)){logger['debug'](_0xa691('0x19'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x4064ea,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]){_[_0xa691('0x1d')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'starttime':moment()[_0xa691('0x1e')](_0xa691('0x1f')),'lastevent':_0xa691('0x20'),'interface':_0x4064ea['channel']['substring'](0x0,_0x4064ea[_0xa691('0x21')][_0xa691('0x22')]('-')),'membername':_0x4064ea[_0xa691('0x21')][_0xa691('0x23')](_0x4064ea[_0xa691('0x21')][_0xa691('0x22')]('/')+0x1,_0x4064ea['channel'][_0xa691('0x22')]('-'))},_[_0xa691('0x24')](_0x4064ea,['event','privilege']));logger[_0xa691('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4064ea[_0xa691('0x1a')],this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]][_0xa691('0x26')],this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]][_0xa691('0x27')]);logger[_0xa691('0x28')](_0xa691('0x29'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4064ea[_0xa691('0x1a')]])_[_0xa691('0x1d')](this[_0xa691('0x1c')][_0x4064ea['uniqueid']],this[_0xa691('0xe')][_0x4064ea[_0xa691('0x1a')]]);this[_0xa691('0x17')](_0xa691('0x2a'),'voice_outbound_channel:save',this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]);logger[_0xa691('0x28')](_0xa691('0x2b'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa691('0x2c'),this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]);}}}catch(_0x235381){logger[_0xa691('0x2d')](_0xa691('0x2e'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x235381,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa691('0x12')]=function(_0x45489c){try{if(this[_0xa691('0x18')](_0x45489c)){logger[_0xa691('0x28')](_0xa691('0x2f'),_0x45489c[_0xa691('0x1a')],util['inspect'](_0x45489c,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]){this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x30')]=_0x45489c['dialstatus'];if(_0x45489c[_0xa691('0x30')]===_0xa691('0x31')){this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]['connectedlinenum']=_0x45489c[_0xa691('0x32')];this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x33')]=_0x45489c[_0xa691('0x33')];this['channels'][_0x45489c[_0xa691('0x1a')]][_0xa691('0x34')]=moment()[_0xa691('0x1e')](_0xa691('0x1f'));this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x35')]='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x45489c[_0xa691('0x1a')],_0x45489c['channel'][_0xa691('0x23')](_0x45489c[_0xa691('0x21')]['lastIndexOf']('/')+0x1,_0x45489c['channel'][_0xa691('0x22')]('-')));logger[_0xa691('0x28')](_0xa691('0x36'),_0x45489c[_0xa691('0x1a')],util['inspect'](this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')](_0xa691('0x37'),this['channels'][_0x45489c[_0xa691('0x1a')]]);}logger[_0xa691('0x28')](_0xa691('0x38'),_0x45489c['uniqueid'],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x45489c['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa691('0x17')]('voice:outbound',_0xa691('0x39'),this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]);}}}catch(_0x525801){logger[_0xa691('0x2d')]('[%s][voiceDialReport][dialend]',_0x45489c[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x525801,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x3a')]=function(_0x295f9b){try{if(this[_0xa691('0x18')](_0x295f9b)){logger[_0xa691('0x28')](_0xa691('0x3b'),_0x295f9b[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x295f9b,{'showHidden':![],'depth':null}));this['addVariable'](_0x295f9b[_0xa691('0x1a')],_[_0xa691('0x3c')](_0x295f9b[_0xa691('0x3d')])[0x0],_0x295f9b[_0xa691('0x3e')]);if(this['isNotNull'](_0x295f9b[_0xa691('0x3d')])&&this[_0xa691('0x18')](_0x295f9b[_0xa691('0x3d')][_0xa691('0x3f')])){if(_[_0xa691('0x15')](this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]])){this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]]={'routeId':_0x295f9b[_0xa691('0x3e')],'variables':this[_0xa691('0x40')][_0x295f9b[_0xa691('0x1a')]],'motionChannel':_0xa691('0x41')};logger[_0xa691('0x25')](_0xa691('0x42'),_0x295f9b[_0xa691('0x1a')],_0x295f9b[_0xa691('0x3d')][_0xa691('0x3f')],_[_0xa691('0x3c')](_0x295f9b[_0xa691('0x3d')])[0x0],_0x295f9b[_0xa691('0x3e')]);logger[_0xa691('0x28')](_0xa691('0x43'),_0x295f9b[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')]('voice:outbound',_0xa691('0x39'),this[_0xa691('0x1c')][_0x295f9b['uniqueid']]);}}}}catch(_0x18cfe0){logger[_0xa691('0x2d')](_0xa691('0x44'),_0x295f9b[_0xa691('0x1a')],util['inspect'](_0x18cfe0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')]['addVariable']=function(_0x4ea2c7,_0x32565b,_0xef03b2){var _0x475207=[_0xa691('0x45'),_0xa691('0x46'),_0xa691('0x47'),_0xa691('0x48'),_0xa691('0x49'),_0xa691('0x4a'),_0xa691('0x4b'),_0xa691('0x4c'),_0xa691('0x4d'),_0xa691('0x4e'),_0xa691('0x4f'),_0xa691('0x50'),_0xa691('0x51'),_0xa691('0x52'),_0xa691('0x53'),_0xa691('0x54'),_0xa691('0x26'),'memberpenalty','memberrealtime'];if(!_[_0xa691('0x55')](_0x32565b)&&!_[_0xa691('0x56')](_0x475207,_0x32565b)){if(_[_0xa691('0x15')](this[_0xa691('0x40')][_0x4ea2c7])){this[_0xa691('0x40')][_0x4ea2c7]={};}this['variables'][_0x4ea2c7][_0x32565b]=_0xef03b2;}};VoiceDialReport[_0xa691('0x16')]['syncHangup']=function(_0x1e0abe){try{if(this[_0xa691('0x18')](_0x1e0abe)){logger[_0xa691('0x28')](_0xa691('0x57'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x1e0abe,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]){logger[_0xa691('0x25')](_0xa691('0x58'),_0x1e0abe[_0xa691('0x1a')],_0x1e0abe[_0xa691('0x59')]);this['channels'][_0x1e0abe['uniqueid']][_0xa691('0x5a')]=moment()[_0xa691('0x1e')](_0xa691('0x1f'));this['channels'][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5b')]=moment(this['channels'][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5a')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]['starttime'],_0xa691('0x5d'));this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x35')]=_0xa691('0x5e');this['outbound']['total']+=0x1;if(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')]){this[_0xa691('0xd')][_0xa691('0x5f')]+=0x1;this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]['holdtime']=moment(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x60')],_0xa691('0x5d'));this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x61')]=moment(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5a')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')],'seconds');this[_0xa691('0xd')][_0xa691('0x62')]+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x63')]||0x0;this[_0xa691('0xd')][_0xa691('0x64')]+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x61')];}this[_0xa691('0xd')]['sumDuration']+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5b')];logger[_0xa691('0x28')](_0xa691('0x65'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')](_0xa691('0x66'),this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]);logger[_0xa691('0x28')](_0xa691('0x67'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')]('custom:dialend',this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]);logger[_0xa691('0x28')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x1e0abe['uniqueid'],util['inspect'](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')](_0xa691('0x2a'),_0xa691('0x68'),this[_0xa691('0xd')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xa691('0x69')](this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]));logger[_0xa691('0x28')](_0xa691('0x6a'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')](_0xa691('0x2a'),'voice_outbound_channel:remove',this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]);this[_0xa691('0x6b')](_0x1e0abe['uniqueid']);}else if(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]]){this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]][_0xa691('0x1a')]=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]][_0xa691('0x6d')];}if(this[_0xa691('0x40')][_0x1e0abe[_0xa691('0x1a')]]){delete this[_0xa691('0x40')][_0x1e0abe['uniqueid']];}}}catch(_0x9fa426){logger[_0xa691('0x2d')]('[%s][voiceDialReport][hangup]',_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x9fa426,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x6e')]=function(_0xddf86){try{if(this[_0xa691('0x18')](_0xddf86)){logger[_0xa691('0x28')](_0xa691('0x6f'),_0xddf86['uniqueid'],util['inspect'](_0xddf86,{'showHidden':![],'depth':null}));if(_0xddf86[_0xa691('0x70')][_0xa691('0x71')]()==='set'){_0xddf86['applicationdata']=(_0xddf86[_0xa691('0x72')]||_0xddf86[_0xa691('0x73')])[_0xa691('0x71')]();if(_['startsWith'](_0xddf86['applicationdata'],_0xa691('0x74'))){if(_['isUndefined'](this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]]))this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]]={};logger[_0xa691('0x25')](_0xa691('0x75'),_0xddf86['uniqueid'],_0xddf86[_0xa691('0x70')],_0xddf86[_0xa691('0x73')]);var _0x53558d=_0xddf86[_0xa691('0x73')][_0xa691('0x76')]('=');var _0x1c1c57=_0x53558d[0x0][_0xa691('0x77')](/cdr\((.*)\)/);if(_0x1c1c57)this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]][_0x1c1c57[0x1]]=_0x53558d[0x1];}}}}catch(_0x137716){logger['error'](_0xa691('0x78'),_0xddf86[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x137716,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x6b')]=function(_0x4b08a0,_0x1da038=0x2710){if(this[_0xa691('0x1c')][_0x4b08a0]){setTimeout(()=>{delete this[_0xa691('0x1c')][_0x4b08a0];},_0x1da038);}};module[_0xa691('0x79')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index bd9fffc..9c5d652 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 _0x01bc=['clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isUndefined','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','type','outbound','custom:queuesummary','statusRequests','completeEvent','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','info','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','sumHoldTime','diff','COMPLETEDBYAGENT','milliseconds','total','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','tail','finally','sequence','queueReports','agents','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','prototype','clearZombieChannels','channels','switch','enqueue','Action','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime'];(function(_0x1993a8,_0xd34e39){var _0x353428=function(_0x1b5ab5){while(--_0x1b5ab5){_0x1993a8['push'](_0x1993a8['shift']());}};_0x353428(++_0xd34e39);}(_0x01bc,0xb0));var _0xc01b=function(_0x420657,_0xe7d083){_0x420657=_0x420657-0x0;var _0x4bc9d5=_0x01bc[_0x420657];return _0x4bc9d5;};'use strict';var _=require('lodash');var moment=require(_0xc01b('0x0'));var util=require(_0xc01b('0x1'));var Redis=require(_0xc01b('0x2'));var config=require('../../../config/environment');var logger=require(_0xc01b('0x3'))(_0xc01b('0x4'));var ami=require(_0xc01b('0x5'));var QueueReport=require(_0xc01b('0x6'));var VoiceQueueSummary=require(_0xc01b('0x7'));config[_0xc01b('0x8')]=_[_0xc01b('0x9')](config[_0xc01b('0x8')],{'host':_0xc01b('0xa'),'port':0x18eb});var io=require(_0xc01b('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x497f1d){this[_0xc01b('0xc')]=this[_0xc01b('0xc')]?this['tail'][_0xc01b('0xd')](_0x497f1d):_0x497f1d();};function VoiceQueueReport(_0x21a2a2){this[_0xc01b('0xe')]=new Sequence();this[_0xc01b('0xf')]={};this['realtime']=_0x21a2a2;this['agents']=_0x21a2a2[_0xc01b('0x10')];this['channels']=_0x21a2a2['queueChannels'];this[_0xc01b('0x11')]=_0x21a2a2[_0xc01b('0x11')];this[_0xc01b('0x12')]=_0x21a2a2[_0xc01b('0x12')];this[_0xc01b('0x13')]=initializeSummary();this[_0xc01b('0x14')]={};ami['on'](_0xc01b('0x15'),this[_0xc01b('0x16')]['bind'](this));ami['on'](_0xc01b('0x17'),this[_0xc01b('0x18')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x1a'),this[_0xc01b('0x1b')]['bind'](this));ami['on'](_0xc01b('0x1c'),this[_0xc01b('0x1d')]['bind'](this));ami['on'](_0xc01b('0x1e'),this[_0xc01b('0x1f')]['bind'](this));ami['on']('queuecallerabandon',this[_0xc01b('0x20')]['bind'](this));ami['on'](_0xc01b('0x21'),this[_0xc01b('0x22')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x23'),this['syncAgentComplete'][_0xc01b('0x19')](this));ami['on']('agentconnect',this[_0xc01b('0x24')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x25'),this[_0xc01b('0x26')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x27'),this['syncHangup'][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x28'),this[_0xc01b('0x29')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x2a'),this[_0xc01b('0x2b')]['bind'](this));ami['on'](_0xc01b('0x2c'),this[_0xc01b('0x2d')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x2e'),this['syncAttendedTransfer'][_0xc01b('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xc01b('0x19')](this));this[_0xc01b('0x2f')]();this[_0xc01b('0x30')]();}function clearChannels(_0x28a788){if(!_['isEmpty'](_0x28a788)){for(var _0x12f122 in _0x28a788){if(_0x28a788[_0xc01b('0x31')](_0x12f122)){delete _0x28a788[_0x12f122];}}}}function clearCampaigns(_0xc7c7ac){if(!_[_0xc01b('0x32')](_0xc7c7ac)){for(var _0x3d23e6 in _0xc7c7ac){if(_0xc7c7ac['hasOwnProperty'](_0x3d23e6)){_0xc7c7ac[_0x3d23e6][_0xc01b('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4d8e4f){if(!_['isEmpty'](_0x4d8e4f)){for(var _0x4d40c2 in _0x4d8e4f){if(_0x4d8e4f['hasOwnProperty'](_0x4d40c2)){_0x4d8e4f[_0x4d40c2][_0xc01b('0x33')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x34')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x35')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x36')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x37')]=!![];}}}}function clearAgentBooked(_0x4ca052){if(!_[_0xc01b('0x32')](_0x4ca052)){for(var _0x165012 in _0x4ca052){if(_0x4ca052[_0xc01b('0x31')](_0x165012)){_0x4ca052[_0x165012][_0xc01b('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x3edf18){return _0x3edf18[_0xc01b('0x39')]||_0x3edf18[_0xc01b('0x3a')]||_0x3edf18[_0xc01b('0x3b')];}VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x3d')]=function(){var _0x57d2f3=this;for(var _0x2088e3 in this[_0xc01b('0x3e')]){if(this[_0xc01b('0x3e')]['hasOwnProperty'](_0x2088e3)&&!this[_0xc01b('0x3e')][_0x2088e3][_0xc01b('0x3f')]){this[_0xc01b('0xe')][_0xc01b('0x40')](function(){if(!_['isNil'](_0x57d2f3[_0xc01b('0x3e')][_0x2088e3])){return ami[_0xc01b('0x41')]({'action':_0xc01b('0x42'),'channel':_0x57d2f3[_0xc01b('0x3e')][_0x2088e3][_0xc01b('0x43')]})[_0xc01b('0x44')](function(_0x57f41f){if(_0x57f41f['message']===_0xc01b('0x45')){setTimeout(function(){if(_0x57d2f3[_0xc01b('0x3e')][_0x2088e3]){delete _0x57d2f3[_0xc01b('0x3e')][_0x2088e3];logger[_0xc01b('0x46')]('[%s][voiceQueueReport][checkChannel]',_0x2088e3,util['inspect'](_0x57f41f,{'showHidden':![],'depth':null}));}if(_0x57d2f3[_0xc01b('0xf')][_0x2088e3]){delete _0x57d2f3[_0xc01b('0xf')][_0x2088e3];logger[_0xc01b('0x46')](_0xc01b('0x47'),_0x2088e3,util[_0xc01b('0x48')](_0x57f41f,{'showHidden':![],'depth':null}));}if(_0x57d2f3['variables'][_0x2088e3]){delete _0x57d2f3[_0xc01b('0x14')][_0x2088e3];logger[_0xc01b('0x46')]('[%s][voiceQueueReport][checkVariables]',_0x2088e3,util[_0xc01b('0x48')](_0x57f41f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x29')]=function(){logger[_0xc01b('0x46')](_0xc01b('0x49'));clearChannels(this[_0xc01b('0x3e')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xc01b('0x11')]);clearCampaigns(this['campaigns']);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0xc01b('0x4a')]=function(_0x28bc91){var _0x46e3df=this;if(!_['isEmpty'](_0x28bc91)){for(var _0x5de4dd in _0x28bc91){if(_0x28bc91[_0xc01b('0x31')](_0x5de4dd)){_0x46e3df['emitVoiceQueueChannelRemove'](_0x28bc91[_0x5de4dd],_0xc01b('0x4b'));delete _0x28bc91[_0x5de4dd];}}}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x4c')]=function(_0x185deb,_0x4c4fb1,_0x5ee183){io['to'](_0x185deb)['emit'](_0x4c4fb1,_0x5ee183);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x4d')]=function(_0x4904e3,_0x38f6a9){logger[_0xc01b('0x4e')](_0xc01b('0x4f')+_0x38f6a9+_0xc01b('0x50'),_0x4904e3['uniqueid'],util[_0xc01b('0x48')](_0x4904e3,{'showHidden':![],'depth':null}));this['emit'](util[_0xc01b('0x51')]('voice:queue:%s',_0x4904e3[_0xc01b('0x52')]),_0xc01b('0x53'),_0x4904e3);io[_0xc01b('0x4c')](_0xc01b('0x54'),_0x4904e3);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x5de3b0,_0x4b7ab1){logger[_0xc01b('0x4e')](_0xc01b('0x4f')+_0x4b7ab1+_0xc01b('0x55'),_0x5de3b0[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5de3b0,{'showHidden':![],'depth':null}));if(_0x5de3b0[_0xc01b('0x57')]===_0xc01b('0x58')){return;}this['emit'](util[_0xc01b('0x51')](_0xc01b('0x59'),_0x5de3b0[_0xc01b('0x52')]),_0xc01b('0x5a'),_0x5de3b0);io[_0xc01b('0x4c')]('voice_queue_presence:remove',_0x5de3b0);};VoiceQueueReport['prototype'][_0xc01b('0x5b')]=function(_0x591f96){if(_0x591f96['type']===_0xc01b('0x5c')){logger[_0xc01b('0x4e')](_0xc01b('0x5d'),util[_0xc01b('0x48')](_0x591f96,{'showHidden':![],'depth':null}));this[_0xc01b('0x4c')](util[_0xc01b('0x51')]('voice:queue:%s',_0x591f96[_0xc01b('0x5e')]),'voice_queue:save',_0x591f96);}};VoiceQueueReport[_0xc01b('0x3c')]['isNotNull']=function(_0x54310f){return _0x54310f!==null&&!_[_0xc01b('0x5f')](_0x54310f);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x30')]=function(){var _0x57e933=this;setInterval(function(){_0x57e933[_0xc01b('0x3d')]();ami[_0xc01b('0x41')]({'action':'queues'})[_0xc01b('0x44')](function(_0x368cf5){logger[_0xc01b('0x46')](_0xc01b('0x60'),util[_0xc01b('0x48')](_0x368cf5,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x2f')]=function(){var _0x4a62f5=this;setInterval(function(){if(!_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x61')]){return ami[_0xc01b('0x41')]({'action':_0xc01b('0x15')})[_0xc01b('0x62')](function(_0x233b13){_0x4a62f5['summary']['id']=_0x233b13[_0xc01b('0x63')];_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x61')]=!![];_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x64')][_0x233b13[_0xc01b('0x63')]]={};})[_0xc01b('0x44')](function(_0x145f36){logger[_0xc01b('0x46')](_0xc01b('0x65'),util[_0xc01b('0x48')](_0x145f36,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x66')]=function(_0x5d8660,_0x5be4ff){var _0x3727b3;if(this['summary']&&this[_0xc01b('0x13')][_0xc01b('0x67')]&&this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8660[_0xc01b('0x5e')]]){_0x3727b3=this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8660[_0xc01b('0x5e')]][_0xc01b('0x68')];}var _0x45c11c=new VoiceQueueSummary(_0x5d8660);return _0x45c11c[_0xc01b('0x69')](_0x5be4ff[_0xc01b('0x10')],this[_0xc01b('0x10')],_0x3727b3,this[_0xc01b('0x6a')]['channels']);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x6b')]=function(_0x1d92a7,_0x4425a8){var _0x2cc2ab=this[_0xc01b('0x66')](_0x1d92a7,_0x4425a8);var _0x2473fe=![];_0x2473fe=_0x2cc2ab[_0xc01b('0x6c')](_0x1d92a7);if(_0x2473fe){Object[_0xc01b('0x6d')](_0x1d92a7,_0x2cc2ab);this[_0xc01b('0x6a')][_0xc01b('0x11')][_0x1d92a7[_0xc01b('0x5e')]]=_0x1d92a7;this[_0xc01b('0x5b')](_0x2cc2ab);}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1d')]=function(_0x5b12bb){var _0x3804f3=null;var _0x3e060c=this[_0xc01b('0x13')]['id'];if(this[_0xc01b('0x13')][_0xc01b('0x64')][_0x3e060c]){_0x3804f3=this['summary'][_0xc01b('0x64')][_0x3e060c][_0x5b12bb[_0xc01b('0x63')]];}if(!_0x3804f3){this['summary']=initializeSummary();return;}var _0x469ea5=this[_0xc01b('0x11')][_0x3804f3[_0xc01b('0x52')]];if(_0x469ea5[_0xc01b('0x6e')]==='inbound'){this[_0xc01b('0x6b')](_0x469ea5,_0x3804f3);}else if(_0x469ea5[_0xc01b('0x6e')]===_0xc01b('0x6f')){var _0x2f187c=this[_0xc01b('0x66')](_0x469ea5,_0x3804f3);ami['emit'](_0xc01b('0x70'),_0x2f187c);}this[_0xc01b('0x13')][_0xc01b('0x71')]-=0x1;var _0x5eabc0=this[_0xc01b('0x13')][_0xc01b('0x71')]>0x0?!![]:![];if(!_0x5eabc0){return this[_0xc01b('0x18')](this[_0xc01b('0x13')][_0xc01b('0x72')]);}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1b')]=function(_0x40544c){var _0x58651b=this['summary']['id'];if(this[_0xc01b('0x13')][_0xc01b('0x64')][_0x58651b]&&this['summary'][_0xc01b('0x64')][_0x58651b][_0x40544c[_0xc01b('0x63')]]){this[_0xc01b('0x13')]['queuestatus'][_0x58651b][_0x40544c[_0xc01b('0x63')]][_0xc01b('0x10')]['push'](_0x40544c);}};VoiceQueueReport[_0xc01b('0x3c')]['syncQueueSummary']=function(_0x389ed9){var _0x33acd2=this;try{if(this[_0xc01b('0x73')](_0x389ed9)&&this[_0xc01b('0x73')](_0x389ed9[_0xc01b('0x52')])){logger[_0xc01b('0x4e')](_0xc01b('0x74'),util['inspect'](_0x389ed9,{'showHidden':![],'depth':null}));var _0x5d8e77=this[_0xc01b('0x11')][_0x389ed9[_0xc01b('0x52')]];if(_0x5d8e77){logger[_0xc01b('0x4e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x5d8e77[_0xc01b('0x5e')]);this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8e77['name']]={'summaryEvent':_0x389ed9};this[_0xc01b('0x13')]['statusRequests']+=0x1;return ami[_0xc01b('0x41')]({'action':_0xc01b('0x64'),'queue':_0x5d8e77['name']})[_0xc01b('0x62')](function(_0x6f2303){if(!_0x33acd2['summary']['queuestatus'][_0x389ed9[_0xc01b('0x63')]]){_0x33acd2[_0xc01b('0x13')][_0xc01b('0x64')][_0x389ed9['actionid']]={};}_0x33acd2[_0xc01b('0x13')][_0xc01b('0x64')][_0x389ed9['actionid']][_0x6f2303['actionid']]={'queue':_0x5d8e77[_0xc01b('0x5e')],'agents':[]};})['catch'](function(_0x3b9074){throw _0x3b9074;});}}}catch(_0x2bcfe3){logger['error'](_0xc01b('0x65'),util[_0xc01b('0x48')](_0x2bcfe3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x18')]=function(_0x3ad67d){if(this[_0xc01b('0x13')][_0xc01b('0x71')]>0x0){this[_0xc01b('0x13')][_0xc01b('0x72')]=_0x3ad67d;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xc01b('0x48')](_0x3ad67d,{'showHidden':![],'depth':null}));this[_0xc01b('0x13')]=initializeSummary();ami[_0xc01b('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1f')]=function(_0x2e5f70){try{if(this['isNotNull'](_0x2e5f70)){logger[_0xc01b('0x4e')](_0xc01b('0x75'),_0x2e5f70[_0xc01b('0x56')],util['inspect'](_0x2e5f70,{'showHidden':![],'depth':null}));if(_[_0xc01b('0x5f')](this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]])){this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]]=[];}if(_[_0xc01b('0x5f')](this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]])){this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]]={};}var _0x140b43=new QueueReport();_0x140b43['queue']=_0x2e5f70['queue'];_0x140b43['type']=this[_0xc01b('0x11')][_0x140b43[_0xc01b('0x52')]]&&this[_0xc01b('0x11')][_0x140b43[_0xc01b('0x52')]]['type']?this[_0xc01b('0x11')][_0x140b43['queue']][_0xc01b('0x6e')]||_0xc01b('0x5c'):'inbound';_0x140b43[_0xc01b('0x76')]=moment()[_0xc01b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x140b43[_0xc01b('0x77')]=_0x2e5f70[_0xc01b('0x77')];_0x140b43[_0xc01b('0x78')]=_0x2e5f70[_0xc01b('0x78')];_0x140b43['uniqueid']=_0x2e5f70[_0xc01b('0x56')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x140b43[_0xc01b('0x52')],_0x140b43[_0xc01b('0x6e')]);Object[_0xc01b('0x6d')](_0x140b43,_[_0xc01b('0x79')](_0x2e5f70,_[_0xc01b('0x7a')](_0x140b43)));this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]][_0xc01b('0x7b')](_0x140b43);this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]]=_0x140b43;this['emitVoiceQueueChannelSave'](_0x140b43,_0xc01b('0x1e'));}}catch(_0x5d0bfe){logger[_0xc01b('0x46')](_0xc01b('0x75'),_0x2e5f70[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5d0bfe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')]['syncQueueCallerAbandon']=function(_0x202256){try{if(this[_0xc01b('0x73')](_0x202256)){logger['debug'](_0xc01b('0x7c'),_0x202256[_0xc01b('0x56')],util['inspect'](_0x202256,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x202256[_0xc01b('0x56')]]){var _0x4273ec=_['last'](this[_0xc01b('0xf')][_0x202256[_0xc01b('0x56')]]);_0x4273ec['queuecallercomplete']=![];_0x4273ec[_0xc01b('0x7d')]=null;_0x4273ec[_0xc01b('0x7e')]=_0x202256[_0xc01b('0x7e')];_0x4273ec[_0xc01b('0x7f')]=_0x202256[_0xc01b('0x7f')];_0x4273ec['queuecallerabandon']=!![];_0x4273ec[_0xc01b('0x80')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x4273ec[_0xc01b('0x57')]=_0xc01b('0x82');_0x4273ec[_0xc01b('0x83')]=null;logger[_0xc01b('0x84')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4273ec[_0xc01b('0x52')],_0x4273ec[_0xc01b('0x6e')]);this['channels'][_0x202256['uniqueid']]=_0x4273ec;this[_0xc01b('0x85')](_0x4273ec,_0xc01b('0x3a'));}}}catch(_0x29ea3e){logger[_0xc01b('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x202256['uniqueid'],util[_0xc01b('0x48')](_0x29ea3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01b('0x22')]=function(_0x501025){try{if(this[_0xc01b('0x73')](_0x501025)){logger[_0xc01b('0x4e')](_0xc01b('0x86'),_0x501025['uniqueid'],util[_0xc01b('0x48')](_0x501025,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x501025['uniqueid']]){var _0x40c580=_[_0xc01b('0x87')](this['queueReports'][_0x501025[_0xc01b('0x56')]]);_0x40c580[_0xc01b('0x88')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x40c580['connectedlinenum']=_0x501025['connectedlinenum'];_0x40c580[_0xc01b('0x89')]=_0x501025[_0xc01b('0x89')];logger[_0xc01b('0x84')](_0xc01b('0x8a'),_0x40c580['queue'],_0x40c580[_0xc01b('0x6e')],_0x501025['connectedlinenum'],_0x501025[_0xc01b('0x89')]);this['channels'][_0x501025[_0xc01b('0x56')]]=_0x40c580;this[_0xc01b('0x4d')](_0x40c580,_0xc01b('0x21'));}}}catch(_0x498f9b){logger[_0xc01b('0x46')](_0xc01b('0x86'),_0x501025[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x498f9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x24')]=function(_0x50208b){try{if(this[_0xc01b('0x73')](_0x50208b)){logger[_0xc01b('0x4e')](_0xc01b('0x8b'),_0x50208b[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x50208b,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x50208b['uniqueid']]){var _0x407b02=_[_0xc01b('0x87')](this['queueReports'][_0x50208b[_0xc01b('0x56')]]);_0x407b02[_0xc01b('0x3b')]=!![];_0x407b02[_0xc01b('0x57')]='COMPLETEDBYAGENT';logger[_0xc01b('0x84')](_0xc01b('0x8c'),_0x407b02[_0xc01b('0x52')],_0x407b02['type']);}}}catch(_0x3fa5ef){logger['error'](_0xc01b('0x8b'),_0x50208b['uniqueid'],util[_0xc01b('0x48')](_0x3fa5ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01b('0x8d')]=function(_0x16a054){try{if(this['isNotNull'](_0x16a054)){logger[_0xc01b('0x4e')](_0xc01b('0x8e'),_0x16a054[_0xc01b('0x56')],util['inspect'](_0x16a054,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x16a054['uniqueid']]){var _0x3f6df8=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x56')]]);_0x3f6df8['queuecallerabandon']=![];_0x3f6df8[_0xc01b('0x80')]=null;_0x3f6df8['assigned']=!![];_0x3f6df8[_0xc01b('0x83')]=_0x16a054[_0xc01b('0x8f')];_0x3f6df8[_0xc01b('0x7e')]=_0x16a054['holdtime'];_0x3f6df8[_0xc01b('0x3b')]=!![];_0x3f6df8[_0xc01b('0x39')]=![];_0x3f6df8[_0xc01b('0x90')]=null;if(!_0x3f6df8[_0xc01b('0x91')]){if(_0x16a054[_0xc01b('0x92')]=='transfer'){_0x3f6df8['queuecallerexitreason']=_0xc01b('0x93');logger[_0xc01b('0x84')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3f6df8['queue'],_0x3f6df8[_0xc01b('0x6e')]);}else{if(_[_0xc01b('0x94')](_0x16a054[_0xc01b('0x43')][_0xc01b('0x95')](),_0xc01b('0x96'))){if(this['queueReports'][_0x16a054['linkedid']]){var _0x340bf9=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x97')]]);_0x340bf9['queuecallercomplete']=![];_0x340bf9[_0xc01b('0x39')]=!![];_0x340bf9[_0xc01b('0x90')]=moment(_0x3f6df8['queuecallerjoinAt'])[_0xc01b('0x98')](_0x16a054['holdtime'],_0xc01b('0x99'))[_0xc01b('0x51')](_0xc01b('0x81'));_0x340bf9[_0xc01b('0x57')]=_0xc01b('0x9a');_0x340bf9['transfer']=!![];_0x340bf9[_0xc01b('0x9b')]=_0xc01b('0x9c');_0x340bf9[_0xc01b('0x9d')]=_0x16a054[_0xc01b('0x9e')];_0x340bf9[_0xc01b('0x9f')]=_0x16a054[_0xc01b('0x56')];logger[_0xc01b('0x84')](_0xc01b('0xa0'),_0x340bf9[_0xc01b('0x52')],_0x340bf9[_0xc01b('0x6e')]);var _0x2d4aec=this['queueReports'][_0x16a054[_0xc01b('0x97')]];this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x97')]]=this['queueReports'][_0x16a054[_0xc01b('0x56')]];this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x56')]]=_0x2d4aec;}}else{_0x3f6df8[_0xc01b('0x57')]=_0xc01b('0xa1')+_0x16a054[_0xc01b('0x92')][_0xc01b('0xa2')]();logger[_0xc01b('0x84')](_0xc01b('0xa3'),_0x3f6df8[_0xc01b('0x52')],_0x3f6df8[_0xc01b('0x6e')],_0x3f6df8[_0xc01b('0x57')]);}}}this[_0xc01b('0x3e')][_0x16a054[_0xc01b('0x56')]]=_0x3f6df8;}}}catch(_0x50865c){logger[_0xc01b('0x46')](_0xc01b('0x8e'),_0x16a054['uniqueid'],util[_0xc01b('0x48')](_0x50865c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')]['syncVarSet']=function(_0x4864ed){try{if(this[_0xc01b('0x73')](_0x4864ed)){logger['debug'](_0xc01b('0xa4'),_0x4864ed['uniqueid'],util[_0xc01b('0x48')](_0x4864ed,{'showHidden':![],'depth':null}));this['addVariable'](_0x4864ed['uniqueid'],_[_0xc01b('0x7a')](_0x4864ed[_0xc01b('0xa5')])[0x0],_0x4864ed[_0xc01b('0xa6')]);if(this[_0xc01b('0xf')][_0x4864ed[_0xc01b('0x56')]]){var _0x16d1f4=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x4864ed[_0xc01b('0x56')]]);if(_0x16d1f4){if(this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')])&&this[_0xc01b('0x73')](_0x4864ed['variable']['queuestatus'])){switch(_0x4864ed[_0xc01b('0xa6')]){case _0xc01b('0xa7'):_0x16d1f4[_0xc01b('0x39')]=![];_0x16d1f4[_0xc01b('0x90')]=null;break;case _0xc01b('0xa8'):_0x16d1f4[_0xc01b('0xa9')]='timeout';_0x16d1f4[_0xc01b('0x39')]=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4['queuecallerleaveAt']=moment()[_0xc01b('0x51')](_0xc01b('0x81'));logger[_0xc01b('0x4e')](_0xc01b('0xaa'),_0x4864ed[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x16d1f4,{'showHidden':![],'depth':null}));ami[_0xc01b('0x4c')](_0xc01b('0xab'),_0x16d1f4);break;default:_0x16d1f4['queuecallerexit']=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4[_0xc01b('0x88')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));}_0x16d1f4[_0xc01b('0x3a')]=![];_0x16d1f4['queuecallerabandonAt']=null;_0x16d1f4[_0xc01b('0x57')]=_0x4864ed[_0xc01b('0xa6')];this[_0xc01b('0x3e')][_0x4864ed[_0xc01b('0x56')]]=_0x16d1f4;this[_0xc01b('0x85')](_0x16d1f4,_0xc01b('0x25'));}else if(this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')])&&this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')][_0xc01b('0xac')])){if(!_0x16d1f4['queuecallerabandon']){_0x16d1f4[_0xc01b('0x39')]=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4[_0xc01b('0x57')]=_0xc01b('0xad');_0x16d1f4['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4864ed[_0xc01b('0x56')]]=_0x16d1f4;}}logger[_0xc01b('0x84')](_0xc01b('0xae'),_0x4864ed[_0xc01b('0x56')],_0x16d1f4[_0xc01b('0x52')],_0x16d1f4[_0xc01b('0x6e')],_['keys'](_0x4864ed[_0xc01b('0xa5')])[0x0],_0x4864ed[_0xc01b('0xa6')]);_0x16d1f4[_0xc01b('0x14')]=this[_0xc01b('0x14')][_0x4864ed[_0xc01b('0x56')]];}}}}catch(_0x5f02f5){logger[_0xc01b('0x46')]('[%s][voiceQueueReport][varset]',_0x4864ed[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5f02f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0xaf')]=function(_0x50f76b,_0x32986a,_0x4a873f){var _0x1e132a=[_0xc01b('0xb0'),_0xc01b('0xb1'),_0xc01b('0xb2'),_0xc01b('0xb3'),_0xc01b('0xb4'),_0xc01b('0xb5'),_0xc01b('0xb6'),_0xc01b('0xb7'),_0xc01b('0xb8'),'sipuri',_0xc01b('0xb9'),_0xc01b('0xba'),_0xc01b('0xbb'),_0xc01b('0xbc'),'memberinterface',_0xc01b('0xbd'),'membername',_0xc01b('0xbe'),_0xc01b('0xbf')];if(!_[_0xc01b('0xc0')](_0x32986a)&&!_[_0xc01b('0xc1')](_0x1e132a,_0x32986a)){if(_['isUndefined'](this['variables'][_0x50f76b])){this[_0xc01b('0x14')][_0x50f76b]={};}this[_0xc01b('0x14')][_0x50f76b][_0x32986a]=_0x4a873f;}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0xc2')]=function(_0x4c1df2,_0x5dd6a8,_0xcfa48a){try{var _0x36bcd7={};if(this[_0xc01b('0xf')][_0x4c1df2]){for(var _0x36b58e=0x0;_0x36b58e{delete this['channels'][_0x5ee116];},_0x5952cd);}};module[_0xc01b('0xf9')]=VoiceQueueReport; \ No newline at end of file +var _0x7179=['emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isUndefined','Action','queues','catch','[voiceQueueReport][queues]','isRunning','actionid','queuestatus','createReport','realtime','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','type','custom:queuesummary','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','local/','linkedid','queuecallerjoinAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','keys','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','diff','milliseconds','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transferexten','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','deleteChannelAfterTimeout','exports','moment','util','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','enqueue','tail','finally','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','syncVarSet','syncHangup','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','unlockRR','queuecallerexit','queuecallercomplete','prototype','clearZombieChannels','isNil','status','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','summary','clearQueueReport'];(function(_0x172922,_0x1ef014){var _0x5815f2=function(_0x5da309){while(--_0x5da309){_0x172922['push'](_0x172922['shift']());}};_0x5815f2(++_0x1ef014);}(_0x7179,0x1a1));var _0x9717=function(_0x213156,_0x291700){_0x213156=_0x213156-0x0;var _0x33d622=_0x7179[_0x213156];return _0x33d622;};'use strict';var _=require('lodash');var moment=require(_0x9717('0x0'));var util=require(_0x9717('0x1'));var Redis=require('ioredis');var config=require(_0x9717('0x2'));var logger=require(_0x9717('0x3'))(_0x9717('0x4'));var ami=require('../ami');var QueueReport=require(_0x9717('0x5'));var VoiceQueueSummary=require(_0x9717('0x6'));config['redis']=_[_0x9717('0x7')](config[_0x9717('0x8')],{'host':_0x9717('0x9'),'port':0x18eb});var io=require(_0x9717('0xa'))(new Redis(config[_0x9717('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x9717('0xb')]=function(_0x3ca894){this[_0x9717('0xc')]=this['tail']?this['tail'][_0x9717('0xd')](_0x3ca894):_0x3ca894();};function VoiceQueueReport(_0x4c7753){this['sequence']=new Sequence();this['queueReports']={};this['realtime']=_0x4c7753;this[_0x9717('0xe')]=_0x4c7753[_0x9717('0xe')];this[_0x9717('0xf')]=_0x4c7753[_0x9717('0x10')];this[_0x9717('0x11')]=_0x4c7753[_0x9717('0x11')];this[_0x9717('0x12')]=_0x4c7753[_0x9717('0x12')];this['summary']=initializeSummary();this['variables']={};ami['on'](_0x9717('0x13'),this[_0x9717('0x14')][_0x9717('0x15')](this));ami['on'](_0x9717('0x16'),this[_0x9717('0x17')][_0x9717('0x15')](this));ami['on'](_0x9717('0x18'),this['syncQueueMember'][_0x9717('0x15')](this));ami['on'](_0x9717('0x19'),this['syncQueueStatusComplete'][_0x9717('0x15')](this));ami['on'](_0x9717('0x1a'),this[_0x9717('0x1b')][_0x9717('0x15')](this));ami['on'](_0x9717('0x1c'),this[_0x9717('0x1d')]['bind'](this));ami['on'](_0x9717('0x1e'),this[_0x9717('0x1f')]['bind'](this));ami['on'](_0x9717('0x20'),this[_0x9717('0x21')][_0x9717('0x15')](this));ami['on']('agentconnect',this[_0x9717('0x22')]['bind'](this));ami['on']('varset',this[_0x9717('0x23')][_0x9717('0x15')](this));ami['on']('hangup',this[_0x9717('0x24')][_0x9717('0x15')](this));ami['on']('fullybooted',this[_0x9717('0x25')]['bind'](this));ami['on']('musiconholdstart',this[_0x9717('0x26')][_0x9717('0x15')](this));ami['on'](_0x9717('0x27'),this[_0x9717('0x28')][_0x9717('0x15')](this));ami['on'](_0x9717('0x29'),this[_0x9717('0x2a')][_0x9717('0x15')](this));ami['on'](_0x9717('0x2b'),this['syncBlindTransfer']['bind'](this));this[_0x9717('0x2c')]();this[_0x9717('0x2d')]();}function clearChannels(_0x417202){if(!_[_0x9717('0x2e')](_0x417202)){for(var _0xcbfa5d in _0x417202){if(_0x417202['hasOwnProperty'](_0xcbfa5d)){delete _0x417202[_0xcbfa5d];}}}}function clearCampaigns(_0x37081a){if(!_[_0x9717('0x2e')](_0x37081a)){for(var _0x551e58 in _0x37081a){if(_0x37081a[_0x9717('0x2f')](_0x551e58)){_0x37081a[_0x551e58][_0x9717('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4f795c){if(!_['isEmpty'](_0x4f795c)){for(var _0x1c5cd1 in _0x4f795c){if(_0x4f795c['hasOwnProperty'](_0x1c5cd1)){_0x4f795c[_0x1c5cd1][_0x9717('0x30')]=0x0;_0x4f795c[_0x1c5cd1]['talking']=0x0;_0x4f795c[_0x1c5cd1][_0x9717('0x31')]=0x0;_0x4f795c[_0x1c5cd1][_0x9717('0x32')]=0x0;_0x4f795c[_0x1c5cd1]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xe7a82f){if(!_[_0x9717('0x2e')](_0xe7a82f)){for(var _0x1f0d61 in _0xe7a82f){if(_0xe7a82f['hasOwnProperty'](_0x1f0d61)){_0xe7a82f[_0x1f0d61][_0x9717('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x14fbb9){return _0x14fbb9[_0x9717('0x34')]||_0x14fbb9[_0x9717('0x1c')]||_0x14fbb9[_0x9717('0x35')];}VoiceQueueReport[_0x9717('0x36')][_0x9717('0x37')]=function(){var _0x3f18ab=this;for(var _0x43e69a in this['channels']){if(this[_0x9717('0xf')][_0x9717('0x2f')](_0x43e69a)&&!this['channels'][_0x43e69a]['switch']){this['sequence'][_0x9717('0xb')](function(){if(!_[_0x9717('0x38')](_0x3f18ab[_0x9717('0xf')][_0x43e69a])){return ami['Action']({'action':_0x9717('0x39'),'channel':_0x3f18ab[_0x9717('0xf')][_0x43e69a]['channel']})['catch'](function(_0x4aa45d){if(_0x4aa45d[_0x9717('0x3a')]===_0x9717('0x3b')){setTimeout(function(){if(_0x3f18ab[_0x9717('0xf')][_0x43e69a]){delete _0x3f18ab[_0x9717('0xf')][_0x43e69a];logger[_0x9717('0x3c')](_0x9717('0x3d'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}if(_0x3f18ab[_0x9717('0x3f')][_0x43e69a]){delete _0x3f18ab[_0x9717('0x3f')][_0x43e69a];logger['error'](_0x9717('0x40'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}if(_0x3f18ab['variables'][_0x43e69a]){delete _0x3f18ab[_0x9717('0x41')][_0x43e69a];logger['error'](_0x9717('0x42'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9717('0x25')]=function(){logger[_0x9717('0x3c')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this['clearQueueReport'](this[_0x9717('0x3f')]);clearAgentBooked(this[_0x9717('0xe')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x9717('0x12')]);this[_0x9717('0x43')]=initializeSummary();};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x44')]=function(_0x234224){var _0x556cea=this;if(!_[_0x9717('0x2e')](_0x234224)){for(var _0x3c4640 in _0x234224){if(_0x234224[_0x9717('0x2f')](_0x3c4640)){_0x556cea[_0x9717('0x45')](_0x234224[_0x3c4640],_0x9717('0x46'));delete _0x234224[_0x3c4640];}}}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x47')]=function(_0x1e6306,_0x1c7ae7,_0x3a2fb5){io['to'](_0x1e6306)[_0x9717('0x47')](_0x1c7ae7,_0x3a2fb5);};VoiceQueueReport['prototype'][_0x9717('0x48')]=function(_0x3b2b6c,_0x31d425){logger[_0x9717('0x49')](_0x9717('0x4a')+_0x31d425+']\x20sending\x20voice_queue_channel:save\x20event:',_0x3b2b6c[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x3b2b6c,{'showHidden':![],'depth':null}));this[_0x9717('0x47')](util['format']('voice:queue:%s',_0x3b2b6c[_0x9717('0x4c')]),_0x9717('0x4d'),_0x3b2b6c);io[_0x9717('0x47')](_0x9717('0x4e'),_0x3b2b6c);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x45')]=function(_0x35a127,_0x3bd9d8){logger[_0x9717('0x49')]('[%s][voiceQueueReport]['+_0x3bd9d8+_0x9717('0x4f'),_0x35a127['uniqueid'],util[_0x9717('0x3e')](_0x35a127,{'showHidden':![],'depth':null}));if(_0x35a127[_0x9717('0x50')]===_0x9717('0x51')){return;}this[_0x9717('0x47')](util['format'](_0x9717('0x52'),_0x35a127[_0x9717('0x4c')]),_0x9717('0x53'),_0x35a127);io[_0x9717('0x47')](_0x9717('0x54'),_0x35a127);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x55')]=function(_0x30b64b){if(_0x30b64b['type']===_0x9717('0x56')){logger[_0x9717('0x49')](_0x9717('0x57'),util[_0x9717('0x3e')](_0x30b64b,{'showHidden':![],'depth':null}));this[_0x9717('0x47')](util[_0x9717('0x58')]('voice:queue:%s',_0x30b64b[_0x9717('0x59')]),_0x9717('0x5a'),_0x30b64b);}};VoiceQueueReport[_0x9717('0x36')]['isNotNull']=function(_0x707ff3){return _0x707ff3!==null&&!_[_0x9717('0x5b')](_0x707ff3);};VoiceQueueReport[_0x9717('0x36')]['loopQueueShow']=function(){var _0x4817cf=this;setInterval(function(){_0x4817cf[_0x9717('0x37')]();ami[_0x9717('0x5c')]({'action':_0x9717('0x5d')})[_0x9717('0x5e')](function(_0x137270){logger[_0x9717('0x3c')](_0x9717('0x5f'),util[_0x9717('0x3e')](_0x137270,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x2c')]=function(){var _0x41f7ab=this;setInterval(function(){if(!_0x41f7ab['summary'][_0x9717('0x60')]){return ami[_0x9717('0x5c')]({'action':_0x9717('0x13')})['then'](function(_0x2ce55a){_0x41f7ab[_0x9717('0x43')]['id']=_0x2ce55a[_0x9717('0x61')];_0x41f7ab[_0x9717('0x43')][_0x9717('0x60')]=!![];_0x41f7ab[_0x9717('0x43')][_0x9717('0x62')][_0x2ce55a['actionid']]={};})['catch'](function(_0x479c91){logger['error']('[voiceQueueReport][queuesummary]',util[_0x9717('0x3e')](_0x479c91,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x24f2f7,_0x1915f6){var _0x5102a7;if(this['summary']&&this[_0x9717('0x43')][_0x9717('0x5d')]&&this[_0x9717('0x43')][_0x9717('0x5d')][_0x24f2f7[_0x9717('0x59')]]){_0x5102a7=this['summary'][_0x9717('0x5d')][_0x24f2f7[_0x9717('0x59')]]['summaryEvent'];}var _0x598d1a=new VoiceQueueSummary(_0x24f2f7);return _0x598d1a[_0x9717('0x63')](_0x1915f6['agents'],this['agents'],_0x5102a7,this[_0x9717('0x64')]['channels']);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x65')]=function(_0x24b40d,_0x3e5570){var _0x3ecbe4=this[_0x9717('0x66')](_0x24b40d,_0x3e5570);var _0x1cc150=![];_0x1cc150=_0x3ecbe4[_0x9717('0x67')](_0x24b40d);if(_0x1cc150){Object[_0x9717('0x68')](_0x24b40d,_0x3ecbe4);this[_0x9717('0x64')]['voiceQueues'][_0x24b40d[_0x9717('0x59')]]=_0x24b40d;this['emitInboundVoiceQueueSummary'](_0x3ecbe4);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x359da5){var _0x37632a=null;var _0x3b30a0=this[_0x9717('0x43')]['id'];if(this[_0x9717('0x43')][_0x9717('0x62')][_0x3b30a0]){_0x37632a=this[_0x9717('0x43')][_0x9717('0x62')][_0x3b30a0][_0x359da5[_0x9717('0x61')]];}if(!_0x37632a){this[_0x9717('0x43')]=initializeSummary();return;}var _0x8424fb=this[_0x9717('0x11')][_0x37632a[_0x9717('0x4c')]];if(_0x8424fb[_0x9717('0x69')]===_0x9717('0x56')){this[_0x9717('0x65')](_0x8424fb,_0x37632a);}else if(_0x8424fb[_0x9717('0x69')]==='outbound'){var _0x6d43e1=this[_0x9717('0x66')](_0x8424fb,_0x37632a);ami[_0x9717('0x47')](_0x9717('0x6a'),_0x6d43e1);}this[_0x9717('0x43')]['statusRequests']-=0x1;var _0x5db542=this['summary'][_0x9717('0x6b')]>0x0?!![]:![];if(!_0x5db542){return this[_0x9717('0x17')](this['summary'][_0x9717('0x6c')]);}};VoiceQueueReport[_0x9717('0x36')]['syncQueueMember']=function(_0x116ef3){var _0x55f8f8=this['summary']['id'];if(this[_0x9717('0x43')]['queuestatus'][_0x55f8f8]&&this['summary'][_0x9717('0x62')][_0x55f8f8][_0x116ef3[_0x9717('0x61')]]){this[_0x9717('0x43')][_0x9717('0x62')][_0x55f8f8][_0x116ef3[_0x9717('0x61')]]['agents'][_0x9717('0x6d')](_0x116ef3);}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x14')]=function(_0x14ca65){var _0x1a564a=this;try{if(this[_0x9717('0x6e')](_0x14ca65)&&this['isNotNull'](_0x14ca65['queue'])){logger['debug'](_0x9717('0x6f'),util[_0x9717('0x3e')](_0x14ca65,{'showHidden':![],'depth':null}));var _0x38960b=this[_0x9717('0x11')][_0x14ca65[_0x9717('0x4c')]];if(_0x38960b){logger['debug'](_0x9717('0x70'),_0x38960b[_0x9717('0x59')]);this['summary'][_0x9717('0x5d')][_0x38960b[_0x9717('0x59')]]={'summaryEvent':_0x14ca65};this[_0x9717('0x43')]['statusRequests']+=0x1;return ami[_0x9717('0x5c')]({'action':'queuestatus','queue':_0x38960b[_0x9717('0x59')]})[_0x9717('0x71')](function(_0x2f43e0){if(!_0x1a564a[_0x9717('0x43')][_0x9717('0x62')][_0x14ca65[_0x9717('0x61')]]){_0x1a564a[_0x9717('0x43')]['queuestatus'][_0x14ca65[_0x9717('0x61')]]={};}_0x1a564a[_0x9717('0x43')][_0x9717('0x62')][_0x14ca65[_0x9717('0x61')]][_0x2f43e0['actionid']]={'queue':_0x38960b['name'],'agents':[]};})[_0x9717('0x5e')](function(_0x3cfe6d){throw _0x3cfe6d;});}}}catch(_0x1e2ab1){logger[_0x9717('0x3c')](_0x9717('0x72'),util[_0x9717('0x3e')](_0x1e2ab1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x17')]=function(_0x2f4a9c){if(this[_0x9717('0x43')][_0x9717('0x6b')]>0x0){this[_0x9717('0x43')]['completeEvent']=_0x2f4a9c;return;}logger[_0x9717('0x49')](_0x9717('0x73'),util['inspect'](_0x2f4a9c,{'showHidden':![],'depth':null}));this[_0x9717('0x43')]=initializeSummary();ami[_0x9717('0x47')](_0x9717('0x74'),{});};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1b')]=function(_0x44bda7){try{if(this[_0x9717('0x6e')](_0x44bda7)){logger[_0x9717('0x49')](_0x9717('0x75'),_0x44bda7[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x44bda7,{'showHidden':![],'depth':null}));if(_[_0x9717('0x5b')](this[_0x9717('0x3f')][_0x44bda7['uniqueid']])){this[_0x9717('0x3f')][_0x44bda7[_0x9717('0x4b')]]=[];}if(_['isUndefined'](this[_0x9717('0xf')][_0x44bda7['uniqueid']])){this[_0x9717('0xf')][_0x44bda7[_0x9717('0x4b')]]={};}var _0x511929=new QueueReport();_0x511929[_0x9717('0x4c')]=_0x44bda7['queue'];_0x511929[_0x9717('0x69')]=this['voiceQueues'][_0x511929[_0x9717('0x4c')]]&&this['voiceQueues'][_0x511929['queue']][_0x9717('0x69')]?this['voiceQueues'][_0x511929['queue']][_0x9717('0x69')]||_0x9717('0x56'):_0x9717('0x56');_0x511929['queuecallerjoinAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x511929[_0x9717('0x77')]=_0x44bda7[_0x9717('0x77')];_0x511929['count']=_0x44bda7[_0x9717('0x78')];_0x511929[_0x9717('0x4b')]=_0x44bda7[_0x9717('0x4b')];logger[_0x9717('0x79')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x511929['queue'],_0x511929[_0x9717('0x69')]);Object[_0x9717('0x68')](_0x511929,_[_0x9717('0x7a')](_0x44bda7,_['keys'](_0x511929)));this['queueReports'][_0x44bda7['uniqueid']][_0x9717('0x6d')](_0x511929);this['channels'][_0x44bda7['uniqueid']]=_0x511929;this['emitVoiceQueueChannelSave'](_0x511929,_0x9717('0x1a'));}}catch(_0x56d210){logger[_0x9717('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x44bda7[_0x9717('0x4b')],util['inspect'](_0x56d210,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1d')]=function(_0x31c36f){try{if(this['isNotNull'](_0x31c36f)){logger['debug'](_0x9717('0x7b'),_0x31c36f['uniqueid'],util[_0x9717('0x3e')](_0x31c36f,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x31c36f['uniqueid']]){var _0x446aa9=_[_0x9717('0x7c')](this['queueReports'][_0x31c36f['uniqueid']]);_0x446aa9[_0x9717('0x35')]=![];_0x446aa9[_0x9717('0x7d')]=null;_0x446aa9['holdtime']=_0x31c36f[_0x9717('0x7e')];_0x446aa9['originalposition']=_0x31c36f[_0x9717('0x7f')];_0x446aa9[_0x9717('0x1c')]=!![];_0x446aa9[_0x9717('0x80')]=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x446aa9[_0x9717('0x50')]=_0x9717('0x81');_0x446aa9[_0x9717('0x82')]=null;logger['info'](_0x9717('0x83'),_0x446aa9[_0x9717('0x4c')],_0x446aa9[_0x9717('0x69')]);this[_0x9717('0xf')][_0x31c36f[_0x9717('0x4b')]]=_0x446aa9;this[_0x9717('0x45')](_0x446aa9,'queuecallerabandon');}}}catch(_0x240234){logger[_0x9717('0x3c')](_0x9717('0x7b'),_0x31c36f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x240234,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1f')]=function(_0x40d513){try{if(this[_0x9717('0x6e')](_0x40d513)){logger['debug'](_0x9717('0x84'),_0x40d513[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x40d513,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x40d513[_0x9717('0x4b')]]){var _0x1d742d=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x40d513[_0x9717('0x4b')]]);_0x1d742d[_0x9717('0x85')]=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x1d742d[_0x9717('0x86')]=_0x40d513['connectedlinenum'];_0x1d742d[_0x9717('0x87')]=_0x40d513[_0x9717('0x87')];logger[_0x9717('0x79')](_0x9717('0x88'),_0x1d742d[_0x9717('0x4c')],_0x1d742d['type'],_0x40d513[_0x9717('0x86')],_0x40d513[_0x9717('0x87')]);this[_0x9717('0xf')][_0x40d513['uniqueid']]=_0x1d742d;this[_0x9717('0x48')](_0x1d742d,_0x9717('0x1e'));}}}catch(_0x56b0ee){logger[_0x9717('0x3c')](_0x9717('0x84'),_0x40d513[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x56b0ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9717('0x22')]=function(_0xbbaf05){try{if(this['isNotNull'](_0xbbaf05)){logger[_0x9717('0x49')]('[%s][voiceQueueReport][agentconnect]',_0xbbaf05[_0x9717('0x4b')],util[_0x9717('0x3e')](_0xbbaf05,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0xbbaf05['uniqueid']]){var _0x48d56f=_[_0x9717('0x7c')](this['queueReports'][_0xbbaf05[_0x9717('0x4b')]]);_0x48d56f[_0x9717('0x35')]=!![];_0x48d56f[_0x9717('0x50')]=_0x9717('0x89');logger[_0x9717('0x79')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x48d56f['queue'],_0x48d56f[_0x9717('0x69')]);}}}catch(_0x271a91){logger['error']('[%s][voiceQueueReport][agentconnect]',_0xbbaf05['uniqueid'],util[_0x9717('0x3e')](_0x271a91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')]['syncAgentComplete']=function(_0x58076a){try{if(this[_0x9717('0x6e')](_0x58076a)){logger['debug'](_0x9717('0x8a'),_0x58076a[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x58076a,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]){var _0xe86a12=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]);_0xe86a12[_0x9717('0x1c')]=![];_0xe86a12[_0x9717('0x80')]=null;_0xe86a12[_0x9717('0x8b')]=!![];_0xe86a12['lastAssignedTo']=_0x58076a['membername'];_0xe86a12[_0x9717('0x7e')]=_0x58076a['holdtime'];_0xe86a12[_0x9717('0x35')]=!![];_0xe86a12[_0x9717('0x34')]=![];_0xe86a12[_0x9717('0x8c')]=null;if(!_0xe86a12[_0x9717('0x8d')]){if(_0x58076a[_0x9717('0x8e')]==_0x9717('0x8d')){_0xe86a12[_0x9717('0x50')]=_0x9717('0x8f');logger[_0x9717('0x79')](_0x9717('0x90'),_0xe86a12[_0x9717('0x4c')],_0xe86a12[_0x9717('0x69')]);}else{if(_[_0x9717('0x91')](_0x58076a[_0x9717('0x92')]['toLowerCase'](),_0x9717('0x93'))){if(this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]]){var _0x5c749a=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]]);_0x5c749a[_0x9717('0x35')]=![];_0x5c749a[_0x9717('0x34')]=!![];_0x5c749a['queuecallerexitAt']=moment(_0xe86a12[_0x9717('0x95')])['add'](_0x58076a[_0x9717('0x7e')],_0x9717('0x96'))[_0x9717('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c749a['queuecallerexitreason']=_0x9717('0x97');_0x5c749a['transfer']=!![];_0x5c749a[_0x9717('0x98')]=_0x9717('0x99');_0x5c749a['transferexten']=_0x58076a[_0x9717('0x9a')];_0x5c749a[_0x9717('0x9b')]=_0x58076a[_0x9717('0x4b')];logger[_0x9717('0x79')](_0x9717('0x9c'),_0x5c749a[_0x9717('0x4c')],_0x5c749a[_0x9717('0x69')]);var _0x540dbe=this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]];this[_0x9717('0x3f')][_0x58076a['linkedid']]=this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]];this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]=_0x540dbe;}}else{_0xe86a12[_0x9717('0x50')]=_0x9717('0x9d')+_0x58076a['reason'][_0x9717('0x9e')]();logger[_0x9717('0x79')](_0x9717('0x9f'),_0xe86a12[_0x9717('0x4c')],_0xe86a12[_0x9717('0x69')],_0xe86a12[_0x9717('0x50')]);}}}this[_0x9717('0xf')][_0x58076a[_0x9717('0x4b')]]=_0xe86a12;}}}catch(_0x12af8e){logger[_0x9717('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x58076a[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x12af8e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x23')]=function(_0x3d1e6f){try{if(this['isNotNull'](_0x3d1e6f)){logger[_0x9717('0x49')]('[%s][voiceQueueReport][varset]',_0x3d1e6f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x3d1e6f,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d1e6f[_0x9717('0x4b')],_[_0x9717('0xa0')](_0x3d1e6f['variable'])[0x0],_0x3d1e6f[_0x9717('0xa1')]);if(this[_0x9717('0x3f')][_0x3d1e6f[_0x9717('0x4b')]]){var _0x257852=_['last'](this[_0x9717('0x3f')][_0x3d1e6f[_0x9717('0x4b')]]);if(_0x257852){if(this[_0x9717('0x6e')](_0x3d1e6f['variable'])&&this['isNotNull'](_0x3d1e6f[_0x9717('0xa2')][_0x9717('0x62')])){switch(_0x3d1e6f[_0x9717('0xa1')]){case _0x9717('0xa3'):_0x257852['queuecallerexit']=![];_0x257852[_0x9717('0x8c')]=null;break;case _0x9717('0xa4'):_0x257852[_0x9717('0xa5')]=_0x9717('0xa6');_0x257852[_0x9717('0x34')]=!![];_0x257852[_0x9717('0x8c')]=moment()['format'](_0x9717('0x76'));_0x257852[_0x9717('0x85')]=moment()['format'](_0x9717('0x76'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3d1e6f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x257852,{'showHidden':![],'depth':null}));ami[_0x9717('0x47')](_0x9717('0xa7'),_0x257852);break;default:_0x257852[_0x9717('0x34')]=!![];_0x257852['queuecallerexitAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x257852[_0x9717('0x85')]=moment()[_0x9717('0x58')](_0x9717('0x76'));}_0x257852[_0x9717('0x1c')]=![];_0x257852[_0x9717('0x80')]=null;_0x257852['queuecallerexitreason']=_0x3d1e6f[_0x9717('0xa1')];this[_0x9717('0xf')][_0x3d1e6f[_0x9717('0x4b')]]=_0x257852;this['emitVoiceQueueChannelRemove'](_0x257852,_0x9717('0xa8'));}else if(this[_0x9717('0x6e')](_0x3d1e6f[_0x9717('0xa2')])&&this[_0x9717('0x6e')](_0x3d1e6f['variable'][_0x9717('0xa9')])){if(!_0x257852[_0x9717('0x1c')]){_0x257852[_0x9717('0x34')]=!![];_0x257852[_0x9717('0x8c')]=moment()[_0x9717('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x257852[_0x9717('0x50')]=_0x9717('0xaa');_0x257852['queuecallerleaveAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));this[_0x9717('0xf')][_0x3d1e6f[_0x9717('0x4b')]]=_0x257852;}}logger[_0x9717('0x79')](_0x9717('0xab'),_0x3d1e6f[_0x9717('0x4b')],_0x257852[_0x9717('0x4c')],_0x257852[_0x9717('0x69')],_[_0x9717('0xa0')](_0x3d1e6f[_0x9717('0xa2')])[0x0],_0x3d1e6f[_0x9717('0xa1')]);_0x257852[_0x9717('0x41')]=this['variables'][_0x3d1e6f[_0x9717('0x4b')]];}}}}catch(_0x3ab6ff){logger[_0x9717('0x3c')](_0x9717('0xac'),_0x3d1e6f[_0x9717('0x4b')],util['inspect'](_0x3ab6ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')]['addVariable']=function(_0x3ff294,_0x1599fd,_0x342a1d){var _0x268b4e=['rtpaudioqos',_0x9717('0xad'),_0x9717('0xae'),'rtpaudioqosjitterbridged',_0x9717('0xaf'),_0x9717('0xb0'),'rtpaudioqosrtt',_0x9717('0xb1'),_0x9717('0xb2'),_0x9717('0xb3'),_0x9717('0xb4'),_0x9717('0xb5'),_0x9717('0xb6'),_0x9717('0xb7'),_0x9717('0xb8'),_0x9717('0xb9'),'membername',_0x9717('0xba'),_0x9717('0xbb')];if(!_[_0x9717('0x38')](_0x1599fd)&&!_['includes'](_0x268b4e,_0x1599fd)){if(_['isUndefined'](this['variables'][_0x3ff294])){this[_0x9717('0x41')][_0x3ff294]={};}this[_0x9717('0x41')][_0x3ff294][_0x1599fd]=_0x342a1d;}};VoiceQueueReport['prototype'][_0x9717('0xbc')]=function(_0x448267,_0x468d90,_0x151d6f){try{var _0x556475={};if(this[_0x9717('0x3f')][_0x448267]){for(var _0x46d68a=0x0;_0x46d68a{delete this[_0x9717('0xf')][_0x48d980];},_0x5b34c0);}};module[_0x9717('0xf2')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index c987eb8..3c9c808 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe397=['Request','CreateReportAgentPreview','../client','createHistory','queue'];(function(_0x4d3764,_0x449577){var _0x3b2f0e=function(_0x1e331f){while(--_0x1e331f){_0x4d3764['push'](_0x4d3764['shift']());}};_0x3b2f0e(++_0x449577);}(_0xe397,0x142));var _0x7e39=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0xe397[_0x5c0979];return _0x309972;};'use strict';var client=require(_0x7e39('0x0'));exports[_0x7e39('0x1')]=function(_0x572fec){return function(){_0x572fec['campaign']=_0x572fec[_0x7e39('0x2')];return client[_0x7e39('0x3')](_0x7e39('0x4'),{'body':_0x572fec,'log':_0x7e39('0x4')});};}; \ No newline at end of file +var _0x6c99=['queue','../client','createHistory','campaign'];(function(_0x544512,_0x351ab0){var _0x14c0b1=function(_0x434a10){while(--_0x434a10){_0x544512['push'](_0x544512['shift']());}};_0x14c0b1(++_0x351ab0);}(_0x6c99,0x171));var _0x96c9=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x6c99[_0x3de7e0];return _0x11d0b3;};'use strict';var client=require(_0x96c9('0x0'));exports[_0x96c9('0x1')]=function(_0x2fb7bf){return function(){_0x2fb7bf[_0x96c9('0x2')]=_0x2fb7bf[_0x96c9('0x3')];return client['Request']('CreateReportAgentPreview',{'body':_0x2fb7bf,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 1b37f61..32625ef 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe69a=['CreateAttachment','../client','Request'];(function(_0x4344b6,_0x406287){var _0x20c00b=function(_0x3326ed){while(--_0x3326ed){_0x4344b6['push'](_0x4344b6['shift']());}};_0x20c00b(++_0x406287);}(_0xe69a,0x1bd));var _0xae69=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe69a[_0x4ae625];return _0x31accf;};'use strict';var client=require(_0xae69('0x0'));exports['create']=function(_0x260f71){return client[_0xae69('0x1')](_0xae69('0x2'),{'body':_0x260f71,'log':_0xae69('0x2')});}; \ No newline at end of file +var _0x5ec1=['../client','create','Request','CreateAttachment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5ec1,0xa4));var _0x15ec=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x5ec1[_0xee3051];return _0x139e81;};'use strict';var client=require(_0x15ec('0x0'));exports[_0x15ec('0x1')]=function(_0x1f7e0f){return client[_0x15ec('0x2')](_0x15ec('0x3'),{'body':_0x1f7e0f,'log':_0x15ec('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 0428640..9470980 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x53f29b,_0x22cf73){var _0x18b486=function(_0x4db84d){while(--_0x4db84d){_0x53f29b['push'](_0x53f29b['shift']());}};_0x18b486(++_0x22cf73);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x2ef3,0xba));var _0x32ef=function(_0x26e78a,_0x4b9031){_0x26e78a=_0x26e78a-0x0;var _0x20e970=_0x2ef3[_0x26e78a];return _0x20e970;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index f99b739..ebed859 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa83=['Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xfa83,0x110));var _0x3fa8=function(_0x235331,_0x2a03a5){_0x235331=_0x235331-0x0;var _0x54b79c=_0xfa83[_0x235331];return _0x54b79c;};'use strict';var client=require('../client');exports['createContact']=function(_0xa63b7b){return function(){return client[_0x3fa8('0x0')]('CreateCmContact',{'body':_0xa63b7b,'log':_0x3fa8('0x1')});};};exports[_0x3fa8('0x2')]=function(_0x4a310b){return function(){return client[_0x3fa8('0x0')]('GetCmContact',{'options':_0x4a310b,'log':_0x3fa8('0x3')});};}; \ No newline at end of file +var _0x384d=['CreateCmContact','getContacts','GetCmContact','../client','createContact','Request'];(function(_0x45b89f,_0x1112f7){var _0xa2d3a6=function(_0x186d45){while(--_0x186d45){_0x45b89f['push'](_0x45b89f['shift']());}};_0xa2d3a6(++_0x1112f7);}(_0x384d,0xab));var _0xd384=function(_0x5efc69,_0x1d90fe){_0x5efc69=_0x5efc69-0x0;var _0xf44b79=_0x384d[_0x5efc69];return _0xf44b79;};'use strict';var client=require(_0xd384('0x0'));exports[_0xd384('0x1')]=function(_0x14acdf){return function(){return client[_0xd384('0x2')]('CreateCmContact',{'body':_0x14acdf,'log':_0xd384('0x3')});};};exports[_0xd384('0x4')]=function(_0x1b401d){return function(){return client[_0xd384('0x2')](_0xd384('0x5'),{'options':_0x1b401d,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 0349965..ee2a720 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5292=['Contact','updateContacts','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','CmContact'];(function(_0x4c00a0,_0x11e753){var _0x1770e1=function(_0x551275){while(--_0x551275){_0x4c00a0['push'](_0x4c00a0['shift']());}};_0x1770e1(++_0x11e753);}(_0x5292,0xf7));var _0x2529=function(_0x1b776e,_0x1d341e){_0x1b776e=_0x1b776e-0x0;var _0x3b8294=_0x5292[_0x1b776e];return _0x3b8294;};'use strict';var client=require(_0x2529('0x0'));var moment=require(_0x2529('0x1'));exports['getContacts']=function(_0x2ec817,_0x522ab4){return function(){return client[_0x2529('0x2')](_0x2529('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ec817},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'limit':_0x522ab4,'raw':![]},'log':'getCmHopper'});};};exports[_0x2529('0x6')]=function(_0x482dba,_0x4c9b4c,_0x4e7a9e){return function(){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x482dba,'options':{'where':{'VoiceQueueId':_0x4c9b4c,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x4e7a9e},'log':_0x2529('0x7')});};};exports[_0x2529('0x8')]=function(_0x5850a7){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x5850a7,'options':{'where':{'ContactId':_0x5850a7[_0x2529('0x9')],'ListId':_0x5850a7[_0x2529('0xa')],'VoiceQueueId':_0x5850a7[_0x2529('0xb')],'CampaignId':_0x5850a7[_0x2529('0xc')]}},'log':_0x2529('0x8')});};exports[_0x2529('0xd')]=function(_0x4f3cf9,_0x42f613,_0x4fb3e0){return function(){return client['Request'](_0x2529('0xe'),{'options':{'where':{'VoiceQueueId':_0x4f3cf9,'ListId':_0x42f613,'ContactId':_0x4fb3e0}},'log':_0x2529('0xe')});};};exports[_0x2529('0xf')]=function(_0xfb9ae2,_0x2c6a91,_0x31c39c,_0x3f3b40){return client['Request'](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfb9ae2,'active':![],'scheduledat':{'$lte':moment()[_0x2529('0x11')](_0x2529('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2c6a91}}]},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x3f3b40],['id',_0x2529('0x16')]],'raw':!![],'limit':_0x31c39c},'log':_0x2529('0x10')});};exports['getContactDialerIvr']=function(_0x163bf4,_0x502ea8,_0x337720){return client[_0x2529('0x2')](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x163bf4,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x337720],['id','ASC']],'raw':!![],'limit':_0x502ea8},'log':_0x2529('0x17')});};exports[_0x2529('0x18')]=function(_0x1ca15f,_0xeff5a6){_0x1ca15f['campaign']=_0x1ca15f[_0x2529('0x19')];return client[_0x2529('0x2')](_0x2529('0x1a'),{'body':_0x1ca15f,'options':{'where':{'ContactId':_0x1ca15f['ContactId'],'ListId':_0x1ca15f[_0x2529('0xa')],'VoiceQueueId':_0x1ca15f[_0x2529('0xb')],'CampaignId':_0x1ca15f[_0x2529('0xc')],'active':_0xeff5a6?undefined:!![]}},'log':_0x2529('0x1a')});};exports['countReScheduled']=function(_0x2736f6){return client[_0x2529('0x2')](_0x2529('0x1b'),{'options':{'where':{'VoiceQueueId':_0x2736f6['id']?_0x2736f6['id']||null:null}},'log':_0x2529('0x1c')});};exports[_0x2529('0x1d')]=function(_0xbb3c1b){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0xbb3c1b},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20')]},{'model':_0x2529('0x21'),'as':_0x2529('0x22'),'attributes':['id',_0x2529('0x20')]}],'raw':!![]},'log':_0x2529('0x23')});};};exports[_0x2529('0x24')]=function(_0x5852aa,_0x1c5209,_0x6d26cb){return client['Request'](_0x2529('0x7'),{'body':_0x5852aa,'options':{'where':{'id':_0x1c5209},'limit':_0x6d26cb},'log':_0x2529('0x7')});};exports['getContactRecallMe']=function(_0x17bcbd,_0x1d7e98){return function(){return client['Request'](_0x2529('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x17bcbd,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x2529('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x1d7e98}},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x2529('0x14')],['id',_0x2529('0x16')]],'include':[{'model':'CmContact','as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20'),_0x2529('0x26')]}],'group':_0x2529('0x27'),'raw':!![]},'log':_0x2529('0x10')});};};exports['resetActiveCalls']=function(_0x4ab0ed,_0x14aabd){return client['Request'](_0x2529('0x28'),{'body':_0x4ab0ed,'options':_0x14aabd||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x543ac5,_0x30cdfb,_0x3c815f){return function(){return client[_0x2529('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x543ac5,'interval':_0x30cdfb,'availableAgentsIds':_0x3c815f}},'log':_0x2529('0x29')});};}; \ No newline at end of file +var _0x6869=['Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','getContactDialerIvr','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','name','VoiceQueue','Queue','unlockContact','User'];(function(_0x59e5cb,_0x2b209a){var _0x4e69c1=function(_0x5c77f5){while(--_0x5c77f5){_0x59e5cb['push'](_0x59e5cb['shift']());}};_0x4e69c1(++_0x2b209a);}(_0x6869,0xe2));var _0x9686=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6869[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x9686('0x0'));var moment=require(_0x9686('0x1'));exports[_0x9686('0x2')]=function(_0x5d3664,_0x3b8c92){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x5d3664},'include':[{'model':_0x9686('0x3'),'as':_0x9686('0x4')}],'limit':_0x3b8c92,'raw':![]},'log':_0x9686('0x5')});};};exports[_0x9686('0x6')]=function(_0x27412c,_0x4a0657,_0x35591e){return function(){return client[_0x9686('0x7')](_0x9686('0x8'),{'body':_0x27412c,'options':{'where':{'VoiceQueueId':_0x4a0657,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x35591e},'log':_0x9686('0x8')});};};exports[_0x9686('0x9')]=function(_0x285148){return client[_0x9686('0x7')]('UpdateCmHopper',{'body':_0x285148,'options':{'where':{'ContactId':_0x285148[_0x9686('0xa')],'ListId':_0x285148[_0x9686('0xb')],'VoiceQueueId':_0x285148[_0x9686('0xc')],'CampaignId':_0x285148[_0x9686('0xd')]}},'log':_0x9686('0x9')});};exports['destroyContact']=function(_0x58d9b6,_0x5d5768,_0x2cb7c2){return function(){return client[_0x9686('0x7')](_0x9686('0xe'),{'options':{'where':{'VoiceQueueId':_0x58d9b6,'ListId':_0x5d5768,'ContactId':_0x2cb7c2}},'log':_0x9686('0xe')});};};exports[_0x9686('0xf')]=function(_0x152abf,_0x4b07d8,_0xd24b8f,_0x39ab7e){return client['Request'](_0x9686('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x152abf,'active':![],'scheduledat':{'$lte':moment()[_0x9686('0x11')](_0x9686('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4b07d8}}]},'order':[[_0x9686('0x13'),_0x9686('0x14')],[_0x9686('0x15'),_0x39ab7e],['id','ASC']],'raw':!![],'limit':_0xd24b8f},'log':_0x9686('0x10')});};exports[_0x9686('0x16')]=function(_0x33026f,_0x2b5301,_0x13b6fd){return client[_0x9686('0x7')](_0x9686('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x33026f,'active':![],'scheduledat':{'$lte':moment()[_0x9686('0x11')](_0x9686('0x12'))}},'include':[{'model':'CmContact','as':_0x9686('0x4')}],'order':[[_0x9686('0x13'),_0x9686('0x14')],[_0x9686('0x15'),_0x13b6fd],['id',_0x9686('0x17')]],'raw':!![],'limit':_0x2b5301},'log':_0x9686('0x18')});};exports[_0x9686('0x19')]=function(_0x13f9da,_0x21a0fd){_0x13f9da[_0x9686('0x1a')]=_0x13f9da[_0x9686('0x1b')];return client['Request'](_0x9686('0x1c'),{'body':_0x13f9da,'options':{'where':{'ContactId':_0x13f9da['ContactId'],'ListId':_0x13f9da[_0x9686('0xb')],'VoiceQueueId':_0x13f9da[_0x9686('0xc')],'CampaignId':_0x13f9da[_0x9686('0xd')],'active':_0x21a0fd?undefined:!![]}},'log':_0x9686('0x1c')});};exports[_0x9686('0x1d')]=function(_0x4ec2a8){return client[_0x9686('0x7')](_0x9686('0x1e'),{'options':{'where':{'VoiceQueueId':_0x4ec2a8['id']?_0x4ec2a8['id']||null:null}},'log':_0x9686('0x1d')});};exports[_0x9686('0x1f')]=function(_0x160654){return function(){return client[_0x9686('0x7')](_0x9686('0x20'),{'options':{'where':{'id':_0x160654},'include':[{'model':_0x9686('0x3'),'as':'Contact'},{'model':'User','as':'Agent','attributes':['id',_0x9686('0x21')]},{'model':_0x9686('0x22'),'as':_0x9686('0x23'),'attributes':['id',_0x9686('0x21')]}],'raw':!![]},'log':_0x9686('0x5')});};};exports[_0x9686('0x24')]=function(_0x144c69,_0xe37630,_0x2e45e3){return client[_0x9686('0x7')](_0x9686('0x8'),{'body':_0x144c69,'options':{'where':{'id':_0xe37630},'limit':_0x2e45e3},'log':_0x9686('0x8')});};exports['getContactRecallMe']=function(_0x5b571c,_0x2533c1){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5b571c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9686('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x2533c1}},'order':[[_0x9686('0x13'),'DESC'],[_0x9686('0x15'),_0x9686('0x14')],['id',_0x9686('0x17')]],'include':[{'model':'CmContact','as':_0x9686('0x4')},{'model':_0x9686('0x25'),'as':_0x9686('0x26'),'attributes':['id','name',_0x9686('0x27')]}],'group':_0x9686('0x28'),'raw':!![]},'log':_0x9686('0x10')});};};exports[_0x9686('0x29')]=function(_0x30dec9,_0x4f4acd){return client[_0x9686('0x7')](_0x9686('0x2a'),{'body':_0x30dec9,'options':_0x4f4acd||{},'log':'ResetActiveCalls'});};exports[_0x9686('0x2b')]=function(_0x397f45,_0x2133fb,_0x3bd1ee){return function(){return client[_0x9686('0x7')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x397f45,'interval':_0x2133fb,'availableAgentsIds':_0x3bd1ee}},'log':_0x9686('0x2b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index eb1b05d..443498d 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d73=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7d73,0x130));var _0x37d7=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x7d73[_0x2ef8f1];return _0x17498d;};'use strict';var client=require('../client');exports[_0x37d7('0x0')]=function(_0x661c99,_0x4bc53e,_0x3a8aa2){return client['Request']('VerifyAdditionalPhones',{'body':_0x661c99,'reason':_0x4bc53e,'entity':_0x3a8aa2,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x15bd91,_0x142acc,_0x6e2a7a){return client[_0x37d7('0x1')](_0x37d7('0x2'),{'body':_0x15bd91,'duration':_0x142acc,'waitTime':_0x6e2a7a,'log':'SwapAdditionalPhones'});};exports[_0x37d7('0x3')]=function(_0x5157b0){return function(){return client[_0x37d7('0x1')](_0x37d7('0x4'),{'body':_0x5157b0,'log':_0x37d7('0x4')});};}; \ No newline at end of file +var _0x75aa=['../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones','Request','SwapAdditionalPhones','IncrementPreviewCounters'];(function(_0x325b65,_0x745ac3){var _0x53dfb6=function(_0x654a54){while(--_0x654a54){_0x325b65['push'](_0x325b65['shift']());}};_0x53dfb6(++_0x745ac3);}(_0x75aa,0x103));var _0xa75a=function(_0x393e45,_0x2b0b05){_0x393e45=_0x393e45-0x0;var _0x24c7a9=_0x75aa[_0x393e45];return _0x24c7a9;};'use strict';var client=require(_0xa75a('0x0'));exports[_0xa75a('0x1')]=function(_0x20b0e3,_0x39f4f2,_0x5894da){return client['Request'](_0xa75a('0x2'),{'body':_0x20b0e3,'reason':_0x39f4f2,'entity':_0x5894da,'log':_0xa75a('0x2')});};exports[_0xa75a('0x3')]=function(_0xf594d2,_0x5a906f,_0x21fe9b){return client[_0xa75a('0x4')](_0xa75a('0x5'),{'body':_0xf594d2,'duration':_0x5a906f,'waitTime':_0x21fe9b,'log':_0xa75a('0x5')});};exports['incrementPreviewCounters']=function(_0x4b83bf){return function(){return client[_0xa75a('0x4')](_0xa75a('0x6'),{'body':_0x4b83bf,'log':_0xa75a('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index d99fbe2..29c3ef6 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6caa=['checkIsBlackListIvr','checkIsBlackList','Request','phone','GetCmHopperBlack'];(function(_0x524668,_0x1773a3){var _0x2d4d47=function(_0x2b8683){while(--_0x2b8683){_0x524668['push'](_0x524668['shift']());}};_0x2d4d47(++_0x1773a3);}(_0x6caa,0xbf));var _0xa6ca=function(_0x14273a,_0x149476){_0x14273a=_0x14273a-0x0;var _0xa60515=_0x6caa[_0x14273a];return _0xa60515;};'use strict';var client=require('../client');exports[_0xa6ca('0x0')]=function(_0x2c3f85){return client[_0xa6ca('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2c3f85['VoiceQueueId'],'phone':_0x2c3f85[_0xa6ca('0x2')]},'raw':![]},'log':_0xa6ca('0x3')});};exports[_0xa6ca('0x4')]=function(_0x5a3a48){return client['Request']('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x5a3a48['CampaignId'],'phone':_0x5a3a48[_0xa6ca('0x2')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0x694b=['GetCmHopperBlackIvr','../client','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId'];(function(_0xc67212,_0x3fee2f){var _0x33e7e9=function(_0x40d675){while(--_0x40d675){_0xc67212['push'](_0xc67212['shift']());}};_0x33e7e9(++_0x3fee2f);}(_0x694b,0x119));var _0xb694=function(_0x3477f7,_0x56a2bc){_0x3477f7=_0x3477f7-0x0;var _0x2657bc=_0x694b[_0x3477f7];return _0x2657bc;};'use strict';var client=require(_0xb694('0x0'));exports['checkIsBlackList']=function(_0x55d28a){return client[_0xb694('0x1')](_0xb694('0x2'),{'options':{'where':{'VoiceQueueId':_0x55d28a[_0xb694('0x3')],'phone':_0x55d28a[_0xb694('0x4')]},'raw':![]},'log':_0xb694('0x2')});};exports[_0xb694('0x5')]=function(_0x5527a6){return client[_0xb694('0x1')](_0xb694('0x2'),{'options':{'where':{'CampaignId':_0x5527a6[_0xb694('0x6')],'phone':_0x5527a6['phone']},'raw':![]},'log':_0xb694('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 063bad6..2dc1314 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1537=['campaign','queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x312837,_0x59f2b7){var _0xd82cf2=function(_0x56af54){while(--_0x56af54){_0x312837['push'](_0x312837['shift']());}};_0xd82cf2(++_0x59f2b7);}(_0x1537,0x172));var _0x7153=function(_0x3ae6c9,_0x5ae096){_0x3ae6c9=_0x3ae6c9-0x0;var _0x2be036=_0x1537[_0x3ae6c9];return _0x2be036;};'use strict';var client=require(_0x7153('0x0'));exports[_0x7153('0x1')]=function(_0x576713){return function(){_0x576713[_0x7153('0x2')]=_0x576713[_0x7153('0x3')];return client[_0x7153('0x4')](_0x7153('0x5'),{'body':_0x576713,'log':_0x7153('0x5')});};}; \ No newline at end of file +var _0x03d2=['Request','CreateCmHopperFinal','campaign'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x03d2,0x131));var _0x203d=function(_0x3a77b5,_0x21d2b2){_0x3a77b5=_0x3a77b5-0x0;var _0x4ba99e=_0x03d2[_0x3a77b5];return _0x4ba99e;};'use strict';var client=require('../client');exports['createContact']=function(_0x10c878){return function(){_0x10c878[_0x203d('0x0')]=_0x10c878['queue'];return client[_0x203d('0x1')](_0x203d('0x2'),{'body':_0x10c878,'log':_0x203d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 9f9bcf2..b82b778 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d3d=['avgHandleTime','Request','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','endOf','day','queue','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','../client','moment','CreateCmHopperHistory'];(function(_0x50f30c,_0x13179a){var _0x144937=function(_0xda11b1){while(--_0xda11b1){_0x50f30c['push'](_0x50f30c['shift']());}};_0x144937(++_0x13179a);}(_0x4d3d,0xda));var _0xd4d3=function(_0x53c466,_0x52823a){_0x53c466=_0x53c466-0x0;var _0x1236e7=_0x4d3d[_0x53c466];return _0x1236e7;};'use strict';var client=require(_0xd4d3('0x0'));var moment=require(_0xd4d3('0x1'));exports['createHistory']=function(_0x2d0a08){_0x2d0a08['campaign']=_0x2d0a08['queue'];return client['Request']('CreateCmHopperHistory',{'body':_0x2d0a08,'log':_0xd4d3('0x2')});};exports[_0xd4d3('0x3')]=function(_0x242d7e){return client[_0xd4d3('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xd4d3('0x5')](_0x242d7e,_0xd4d3('0x6'))[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0xd4d3('0x9')]=function(){return function(){return client[_0xd4d3('0x4')](_0xd4d3('0xa'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()[_0xd4d3('0xb')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8'))]},'campaigntype':_0xd4d3('0xd')},'raw':![]},'log':_0xd4d3('0xa')});};};exports[_0xd4d3('0xe')]=function(){return function(){return client[_0xd4d3('0x4')](_0xd4d3('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd4d3('0x10')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()[_0xd4d3('0xb')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8'))]},'campaigntype':'ivr'},'raw':![]},'log':_0xd4d3('0xf')});};}; \ No newline at end of file +var _0x71b6=['format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','GetCampaignHopperHistory','ivr','../client','createHistory','queue','Request','CreateCmHopperHistory','AvgHandleTime','minutes'];(function(_0x2fea40,_0x59c8cf){var _0x14a53d=function(_0xe0b263){while(--_0xe0b263){_0x2fea40['push'](_0x2fea40['shift']());}};_0x14a53d(++_0x59c8cf);}(_0x71b6,0xc9));var _0x671b=function(_0xaa6a54,_0x501b52){_0xaa6a54=_0xaa6a54-0x0;var _0x4edf6e=_0x71b6[_0xaa6a54];return _0x4edf6e;};'use strict';var client=require(_0x671b('0x0'));var moment=require('moment');exports[_0x671b('0x1')]=function(_0x1f0c04){_0x1f0c04['campaign']=_0x1f0c04[_0x671b('0x2')];return client[_0x671b('0x3')]('CreateCmHopperHistory',{'body':_0x1f0c04,'log':_0x671b('0x4')});};exports['avgHandleTime']=function(_0x55d783){return client[_0x671b('0x3')](_0x671b('0x5'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x55d783,_0x671b('0x6'))[_0x671b('0x7')](_0x671b('0x8')),moment()[_0x671b('0x7')](_0x671b('0x8'))]}},'raw':![]},'log':_0x671b('0x9')});};exports[_0x671b('0xa')]=function(){return function(){return client[_0x671b('0x3')](_0x671b('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8')),moment()[_0x671b('0xd')](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8'))]},'campaigntype':'queue'},'raw':![]},'log':_0x671b('0xb')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x671b('0x3')](_0x671b('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x671b('0xc'))[_0x671b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8'))]},'campaigntype':_0x671b('0xf')},'raw':![]},'log':_0x671b('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index f0e75f6..9a5d7eb 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x078f=['ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','active','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','name','description'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x078f,0x1b4));var _0xf078=function(_0x1c16f3,_0x5c0720){_0x1c16f3=_0x1c16f3-0x0;var _0x43226e=_0x078f[_0x1c16f3];return _0x43226e;};'use strict';var client=require('../client');exports[_0xf078('0x0')]=function(){return function(){return client[_0xf078('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xf078('0x2'),_0xf078('0x3'),_0xf078('0x4'),_0xf078('0x5'),'localstationid',_0xf078('0x6'),_0xf078('0x7'),_0xf078('0x8'),_0xf078('0x9'),_0xf078('0xa'),_0xf078('0xb'),_0xf078('0xc'),_0xf078('0xd'),_0xf078('0xe'),_0xf078('0xf')],'include':[{'model':'Trunk','as':_0xf078('0x10'),'attributes':['id','name',_0xf078('0x11'),_0xf078('0x12')]}]},'log':_0xf078('0x13')});};};exports[_0xf078('0x14')]=function(_0x5946f5,_0x316c56){return client['Request'](_0xf078('0x15'),{'account':{'id':_0x5946f5},'body':_0x316c56,'log':_0xf078('0x15')});}; \ No newline at end of file +var _0x02a7=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','faxdetect','tech','TrunkId','callerid','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount'];(function(_0x43dfd9,_0x4521a5){var _0x4281f7=function(_0x2e011c){while(--_0x2e011c){_0x43dfd9['push'](_0x43dfd9['shift']());}};_0x4281f7(++_0x4521a5);}(_0x02a7,0x1a6));var _0x702a=function(_0x3f3d82,_0x6f4e8f){_0x3f3d82=_0x3f3d82-0x0;var _0x16bd2e=_0x02a7[_0x3f3d82];return _0x16bd2e;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5'),_0x702a('0x6'),_0x702a('0x7'),_0x702a('0x8'),_0x702a('0x9'),'modem','gateway',_0x702a('0xa'),'t38timeout',_0x702a('0xb'),_0x702a('0xc'),'ListId','key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x702a('0x3'),_0x702a('0xd'),'active']}]},'log':_0x702a('0xe')});};};exports[_0x702a('0xf')]=function(_0xebee92,_0x25920c){return client[_0x702a('0x1')](_0x702a('0x10'),{'account':{'id':_0xebee92},'body':_0x25920c,'log':_0x702a('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index c8b69d2..d5a7017 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1947=['update','Request','UpdateFaxMessage','../client'];(function(_0x5b7bbb,_0x3028c6){var _0x32cd52=function(_0x2cd3c2){while(--_0x2cd3c2){_0x5b7bbb['push'](_0x5b7bbb['shift']());}};_0x32cd52(++_0x3028c6);}(_0x1947,0x97));var _0x7194=function(_0x361ab9,_0x4f58db){_0x361ab9=_0x361ab9-0x0;var _0x4bc023=_0x1947[_0x361ab9];return _0x4bc023;};'use strict';var client=require(_0x7194('0x0'));exports[_0x7194('0x1')]=function(_0x47b524,_0x494384){return client[_0x7194('0x2')]('UpdateFaxMessage',{'body':_0x494384,'options':{'where':{'AttachmentId':_0x47b524}},'log':_0x7194('0x3')});}; \ No newline at end of file +var _0xaf70=['UpdateFaxMessage','../client','update'];(function(_0x36ec99,_0x8d75da){var _0x4db975=function(_0x2a4441){while(--_0x2a4441){_0x36ec99['push'](_0x36ec99['shift']());}};_0x4db975(++_0x8d75da);}(_0xaf70,0x13f));var _0x0af7=function(_0xc7602e,_0x3f1247){_0xc7602e=_0xc7602e-0x0;var _0x151f45=_0xaf70[_0xc7602e];return _0x151f45;};'use strict';var client=require(_0x0af7('0x0'));exports[_0x0af7('0x1')]=function(_0x4371d5,_0x5454b9){return client['Request']('UpdateFaxMessage',{'body':_0x5454b9,'options':{'where':{'AttachmentId':_0x4371d5}},'log':_0x0af7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 7ef9e46..c366073 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c88=['Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','description','password','remoteUri','authType','type','DeskConfiguration','DeskField','Subjects','content','variableName'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5c88,0x172));var _0x85c8=function(_0x408ed9,_0x1010ff){_0x408ed9=_0x408ed9-0x0;var _0x48fced=_0x5c88[_0x408ed9];return _0x48fced;};'use strict';var client=require(_0x85c8('0x0'));exports['getDeskAccounts']=function(){return function(_0x4e41ae){return client[_0x85c8('0x1')](_0x85c8('0x2'),{'options':{'raw':![],'attributes':['id',_0x85c8('0x3'),_0x85c8('0x4'),'username',_0x85c8('0x5'),_0x85c8('0x6'),_0x85c8('0x7'),_0x85c8('0x8'),'serverUrl'],'include':[{'model':_0x85c8('0x9'),'as':'Configurations','attributes':['id',_0x85c8('0x3')],'include':[{'model':_0x85c8('0xa'),'as':_0x85c8('0xb'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0xd')],'include':[{'model':'Variable','as':_0x85c8('0xe'),'attributes':['id',_0x85c8('0x3')]}]},{'model':_0x85c8('0xa'),'as':_0x85c8('0xf'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0x10'),_0x85c8('0x11'),_0x85c8('0x12'),_0x85c8('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x85c8('0x3')]}]},{'model':'DeskField','as':_0x85c8('0x13'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0x14'),'nameField',_0x85c8('0x15'),_0x85c8('0xd')],'include':[{'model':_0x85c8('0xe'),'as':'Variable','attributes':['id',_0x85c8('0x3')]}]},{'model':_0x85c8('0x16'),'as':_0x85c8('0x17'),'attributes':['id',_0x85c8('0x3')]}]}]},'log':_0x85c8('0x2')});};}; \ No newline at end of file +var _0x32d0=['DeskConfiguration','name','DeskField','Subjects','variableName','Variable','Descriptions','content','keyType','keyContent','Fields','nameField','customField','Tag','Request','description','username','password','remoteUri','authType','type','serverUrl'];(function(_0x32c305,_0x5378eb){var _0x39ecaa=function(_0x1264a5){while(--_0x1264a5){_0x32c305['push'](_0x32c305['shift']());}};_0x39ecaa(++_0x5378eb);}(_0x32d0,0x1f2));var _0x032d=function(_0x3ccffd,_0x525c43){_0x3ccffd=_0x3ccffd-0x0;var _0x3398fc=_0x32d0[_0x3ccffd];return _0x3398fc;};'use strict';var client=require('../../client');exports['getDeskAccounts']=function(){return function(_0x21ec85){return client[_0x032d('0x0')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x032d('0x1'),_0x032d('0x2'),_0x032d('0x3'),_0x032d('0x4'),_0x032d('0x5'),_0x032d('0x6'),_0x032d('0x7')],'include':[{'model':_0x032d('0x8'),'as':'Configurations','attributes':['id',_0x032d('0x9')],'include':[{'model':_0x032d('0xa'),'as':_0x032d('0xb'),'attributes':['id','type','content',_0x032d('0xc')],'include':[{'model':_0x032d('0xd'),'as':_0x032d('0xd'),'attributes':['id','name']}]},{'model':_0x032d('0xa'),'as':_0x032d('0xe'),'attributes':['id','type',_0x032d('0xf'),'key',_0x032d('0x10'),_0x032d('0x11'),_0x032d('0xc')],'include':[{'model':'Variable','as':_0x032d('0xd'),'attributes':['id',_0x032d('0x9')]}]},{'model':_0x032d('0xa'),'as':_0x032d('0x12'),'attributes':['id',_0x032d('0x6'),_0x032d('0xf'),'idField',_0x032d('0x13'),_0x032d('0x14'),_0x032d('0xc')],'include':[{'model':_0x032d('0xd'),'as':_0x032d('0xd'),'attributes':['id',_0x032d('0x9')]}]},{'model':_0x032d('0x15'),'as':'Tags','attributes':['id','name']}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 0344864..f104833 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7894=['serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','moduleCreate','openNewTab','Dynamics365Field','Subjects','content','Variable','type','key','keyContent','variableName','Fields','idField','nameField','CloudProvider','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','password','remoteUri','clientId','clientSecret'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x7894,0x170));var _0x4789=function(_0x3eba48,_0x1f2425){_0x3eba48=_0x3eba48-0x0;var _0x46294d=_0x7894[_0x3eba48];return _0x46294d;};'use strict';var client=require(_0x4789('0x0'));exports[_0x4789('0x1')]=function(){return function(_0x2dfc22){return client[_0x4789('0x2')](_0x4789('0x3'),{'options':{'raw':![],'attributes':['id',_0x4789('0x4'),'username',_0x4789('0x5'),_0x4789('0x6'),'tenantId',_0x4789('0x7'),_0x4789('0x8'),_0x4789('0x9'),_0x4789('0xa'),_0x4789('0xb')],'include':[{'model':_0x4789('0xc'),'as':_0x4789('0xd'),'attributes':['id','name','ticketType',_0x4789('0xe'),'additionalSearchContact',_0x4789('0xf')],'include':[{'model':_0x4789('0x10'),'as':_0x4789('0x11'),'attributes':['id','type',_0x4789('0x12'),'variableName'],'include':[{'model':_0x4789('0x13'),'as':_0x4789('0x13'),'attributes':['id',_0x4789('0x4')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x4789('0x14'),'content',_0x4789('0x15'),'keyType',_0x4789('0x16'),_0x4789('0x17')],'include':[{'model':'Variable','as':_0x4789('0x13'),'attributes':['id','name']}]},{'model':_0x4789('0x10'),'as':_0x4789('0x18'),'attributes':['id',_0x4789('0x14'),'content',_0x4789('0x19'),_0x4789('0x1a'),'customField',_0x4789('0x17')],'include':[{'model':'Variable','as':_0x4789('0x13'),'attributes':['id',_0x4789('0x4')]}]}]},{'model':'CloudProvider','as':_0x4789('0x1b'),'attributes':['id','data2',_0x4789('0x1c'),'data7']}]},'log':_0x4789('0x3')});};}; \ No newline at end of file +var _0x0bb4=['description','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','CloudProvider','data2','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri','clientId','serverUrl'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x0bb4,0x77));var _0x40bb=function(_0x2a166a,_0xf7981a){_0x2a166a=_0x2a166a-0x0;var _0x1f1ebe=_0x0bb4[_0x2a166a];return _0x1f1ebe;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return function(_0x4c9712){return client[_0x40bb('0x2')](_0x40bb('0x3'),{'options':{'raw':![],'attributes':['id',_0x40bb('0x4'),_0x40bb('0x5'),'password',_0x40bb('0x6'),'tenantId',_0x40bb('0x7'),'clientSecret',_0x40bb('0x8'),_0x40bb('0x9'),'modernAuthentication'],'include':[{'model':_0x40bb('0xa'),'as':_0x40bb('0xb'),'attributes':['id','name',_0x40bb('0xc'),'moduleCreate',_0x40bb('0xd'),_0x40bb('0xe')],'include':[{'model':_0x40bb('0xf'),'as':_0x40bb('0x10'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x13')],'include':[{'model':_0x40bb('0x14'),'as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0xf'),'as':_0x40bb('0x15'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x16'),_0x40bb('0x17'),_0x40bb('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0xf'),'as':_0x40bb('0x19'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x1a'),_0x40bb('0x1b'),'customField',_0x40bb('0x13')],'include':[{'model':_0x40bb('0x14'),'as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]}]},{'model':_0x40bb('0x1c'),'as':'CloudProvider','attributes':['id',_0x40bb('0x1d'),_0x40bb('0x1e'),_0x40bb('0x1f')]}]},'log':_0x40bb('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index aa39233..7d1b2b4 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc902=['type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xc902,0x15c));var _0x2c90=function(_0xde34ca,_0x413606){_0xde34ca=_0xde34ca-0x0;var _0x2faa67=_0xc902[_0xde34ca];return _0x2faa67;};'use strict';var client=require(_0x2c90('0x0'));exports[_0x2c90('0x1')]=function(){return function(_0x40c2ce){return client[_0x2c90('0x2')](_0x2c90('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c90('0x4'),'username',_0x2c90('0x5'),_0x2c90('0x6'),_0x2c90('0x7')],'include':[{'model':_0x2c90('0x8'),'as':_0x2c90('0x9'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id',_0x2c90('0x4')]},{'model':_0x2c90('0xa'),'as':_0x2c90('0xb'),'attributes':['id',_0x2c90('0xc'),_0x2c90('0xd'),'variableName'],'include':[{'model':'Variable','as':_0x2c90('0xe'),'attributes':['id','name']}]},{'model':_0x2c90('0xa'),'as':_0x2c90('0xf'),'attributes':['id',_0x2c90('0xc'),_0x2c90('0xd'),_0x2c90('0x10'),_0x2c90('0x11'),_0x2c90('0x12'),_0x2c90('0x13')],'include':[{'model':'Variable','as':_0x2c90('0xe'),'attributes':['id',_0x2c90('0x4')]}]},{'model':'FreshdeskField','as':_0x2c90('0x14'),'attributes':['id','type',_0x2c90('0xd'),_0x2c90('0x15'),_0x2c90('0x16'),_0x2c90('0x17'),_0x2c90('0x13')],'include':[{'model':_0x2c90('0xe'),'as':'Variable','attributes':['id',_0x2c90('0x4')]}]}]}]},'log':_0x2c90('0x3')});};}; \ No newline at end of file +var _0x2964=['type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','Tag','FreshdeskField'];(function(_0x1e5f0c,_0x31aa12){var _0x3d083b=function(_0x1a8df2){while(--_0x1a8df2){_0x1e5f0c['push'](_0x1e5f0c['shift']());}};_0x3d083b(++_0x31aa12);}(_0x2964,0x108));var _0x4296=function(_0x390d7b,_0x3b893b){_0x390d7b=_0x390d7b-0x0;var _0x2648f3=_0x2964[_0x390d7b];return _0x2648f3;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return function(_0x31be5e){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':![],'attributes':['id',_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6'),_0x4296('0x7'),'serverUrl'],'include':[{'model':_0x4296('0x8'),'as':_0x4296('0x9'),'attributes':['id',_0x4296('0x4')],'include':[{'model':_0x4296('0xa'),'attributes':['id',_0x4296('0x4')]},{'model':_0x4296('0xb'),'as':'Subjects','attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x10'),'attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0x11'),_0x4296('0x12'),'keyContent',_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x13'),'attributes':['id',_0x4296('0xc'),'content',_0x4296('0x14'),_0x4296('0x15'),_0x4296('0x16'),'variableName'],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index ee22b3d..94373dd 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['Configurations','FreshsalesField','Subjects','type','content','variableName','Descriptions','keyType','keyContent','Variable','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','FreshsalesConfiguration'];(function(_0x1ada0c,_0x12fe1e){var _0x592b83=function(_0x4eeaf9){while(--_0x4eeaf9){_0x1ada0c['push'](_0x1ada0c['shift']());}};_0x592b83(++_0x12fe1e);}(_0xacf4,0xe7));var _0x4acf=function(_0x3f6106,_0x35ca26){_0x3f6106=_0x3f6106-0x0;var _0x1ff77e=_0xacf4[_0x3f6106];return _0x1ff77e;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x867c40){return client[_0x4acf('0x0')](_0x4acf('0x1'),{'options':{'raw':![],'attributes':['id',_0x4acf('0x2'),_0x4acf('0x3'),_0x4acf('0x4'),_0x4acf('0x5'),'serverUrl'],'include':[{'model':_0x4acf('0x6'),'as':_0x4acf('0x7'),'attributes':['id','name'],'include':[{'model':_0x4acf('0x8'),'as':_0x4acf('0x9'),'attributes':['id',_0x4acf('0xa'),_0x4acf('0xb'),_0x4acf('0xc')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x4acf('0x2')]}]},{'model':'FreshsalesField','as':_0x4acf('0xd'),'attributes':['id',_0x4acf('0xa'),_0x4acf('0xb'),'key',_0x4acf('0xe'),_0x4acf('0xf'),'variableName'],'include':[{'model':'Variable','as':_0x4acf('0x10'),'attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x06ae=['GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','getFreshsalesAccounts','Request'];(function(_0x3d51d6,_0x333eb3){var _0x57b86c=function(_0x299d55){while(--_0x299d55){_0x3d51d6['push'](_0x3d51d6['shift']());}};_0x57b86c(++_0x333eb3);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var client=require('../../client');exports[_0xe06a('0x0')]=function(){return function(_0x188bb9){return client[_0xe06a('0x1')](_0xe06a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe06a('0x3'),_0xe06a('0x4'),_0xe06a('0x5'),_0xe06a('0x6'),_0xe06a('0x7')],'include':[{'model':'FreshsalesConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0xe06a('0x8'),'as':_0xe06a('0x9'),'attributes':['id',_0xe06a('0xa'),_0xe06a('0xb'),_0xe06a('0xc')],'include':[{'model':'Variable','as':_0xe06a('0xd'),'attributes':['id','name']}]},{'model':'FreshsalesField','as':_0xe06a('0xe'),'attributes':['id','type',_0xe06a('0xb'),'key','keyType',_0xe06a('0xf'),_0xe06a('0xc')],'include':[{'model':'Variable','as':_0xe06a('0xd'),'attributes':['id',_0xe06a('0x3')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 22735f6..e7a417c 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5bf=['password','remoteUri','clientId','clientSecret','securityToken','type','SalesforceConfiguration','Configurations','name','moduleSearch','moduleCreate','additionalSearchContact','SalesforceField','Variable','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','username'];(function(_0x289ff9,_0x473dbb){var _0x271867=function(_0x216d15){while(--_0x216d15){_0x289ff9['push'](_0x289ff9['shift']());}};_0x271867(++_0x473dbb);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xb5bf[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0xfb5b('0x0'));exports[_0xfb5b('0x1')]=function(){return function(_0x2abb01){return client['Request'](_0xfb5b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfb5b('0x3'),_0xfb5b('0x4'),_0xfb5b('0x5'),_0xfb5b('0x6'),_0xfb5b('0x7'),_0xfb5b('0x8'),'serverUrl',_0xfb5b('0x9')],'include':[{'model':_0xfb5b('0xa'),'as':_0xfb5b('0xb'),'attributes':['id',_0xfb5b('0xc'),_0xfb5b('0xd'),_0xfb5b('0xe'),'ticketType','leadId','additionalSearchAccount',_0xfb5b('0xf'),'additionalSearchLead'],'include':[{'model':_0xfb5b('0x10'),'as':'Subjects','include':[{'model':'Variable','as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]},{'model':_0xfb5b('0x10'),'as':'Descriptions','include':[{'model':_0xfb5b('0x11'),'as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]},{'model':_0xfb5b('0x10'),'as':_0xfb5b('0x12'),'include':[{'model':_0xfb5b('0x11'),'as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x80e0=['clientSecret','securityToken','serverUrl','name','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Variable','Descriptions','Fields','Request','GetSalesforceAccount','username','password','remoteUri'];(function(_0x2f6c5a,_0x3e32ac){var _0x27dda4=function(_0x19a243){while(--_0x19a243){_0x2f6c5a['push'](_0x2f6c5a['shift']());}};_0x27dda4(++_0x3e32ac);}(_0x80e0,0x9d));var _0x080e=function(_0x4c5070,_0x1dfc46){_0x4c5070=_0x4c5070-0x0;var _0x1c5d59=_0x80e0[_0x4c5070];return _0x1c5d59;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x148d40){return client[_0x080e('0x0')](_0x080e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x080e('0x2'),_0x080e('0x3'),_0x080e('0x4'),'clientId',_0x080e('0x5'),_0x080e('0x6'),_0x080e('0x7'),'type'],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x080e('0x8'),'moduleSearch',_0x080e('0x9'),'ticketType',_0x080e('0xa'),_0x080e('0xb'),_0x080e('0xc'),_0x080e('0xd')],'include':[{'model':_0x080e('0xe'),'as':'Subjects','include':[{'model':'Variable','as':_0x080e('0xf'),'attributes':['id',_0x080e('0x8')]}]},{'model':_0x080e('0xe'),'as':_0x080e('0x10'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x080e('0x8')]}]},{'model':_0x080e('0xe'),'as':_0x080e('0x11'),'include':[{'model':'Variable','as':_0x080e('0xf'),'attributes':['id',_0x080e('0x8')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index d6a892d..08c7e4e 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['type','variableName','Variable','Descriptions','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','name','description','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x57ca,0x108));var _0xa57c=function(_0x42110e,_0x15bcd5){_0x42110e=_0x42110e-0x0;var _0x42f379=_0x57ca[_0x42110e];return _0x42f379;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'email',_0xa57c('0x6'),_0xa57c('0x7')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0xa'),'as':_0xa57c('0xb'),'attributes':['id',_0xa57c('0xc'),'content',_0xa57c('0xd')],'include':[{'model':'Variable','as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':'ServicenowField','as':_0xa57c('0xf'),'attributes':['id','type',_0xa57c('0x10'),_0xa57c('0x11'),'keyType',_0xa57c('0x12'),'variableName'],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0xa'),'as':_0xa57c('0x13'),'attributes':['id','type',_0xa57c('0x10'),'idField',_0xa57c('0x14'),_0xa57c('0x15'),_0xa57c('0xd')],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x16')});};}; \ No newline at end of file +var _0x2675=['ServicenowField','type','content','Variable','Descriptions','keyType','variableName','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','GetServicenowAccount','name','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations'];(function(_0x24dd1a,_0x51f0fe){var _0x14fc9a=function(_0x294e42){while(--_0x294e42){_0x24dd1a['push'](_0x24dd1a['shift']());}};_0x14fc9a(++_0x51f0fe);}(_0x2675,0x75));var _0x5267=function(_0x4fda50,_0x10b212){_0x4fda50=_0x4fda50-0x0;var _0x15129c=_0x2675[_0x4fda50];return _0x15129c;};'use strict';var client=require(_0x5267('0x0'));exports['getServicenowAccounts']=function(){return function(_0x53e71f){return client['Request'](_0x5267('0x1'),{'options':{'raw':![],'attributes':['id',_0x5267('0x2'),'description',_0x5267('0x3'),_0x5267('0x4'),'email',_0x5267('0x5'),_0x5267('0x6')],'include':[{'model':_0x5267('0x7'),'as':_0x5267('0x8'),'attributes':['id',_0x5267('0x2')],'include':[{'model':_0x5267('0x9'),'as':'Subjects','attributes':['id',_0x5267('0xa'),_0x5267('0xb'),'variableName'],'include':[{'model':_0x5267('0xc'),'as':'Variable','attributes':['id',_0x5267('0x2')]}]},{'model':_0x5267('0x9'),'as':_0x5267('0xd'),'attributes':['id','type',_0x5267('0xb'),'key',_0x5267('0xe'),'keyContent',_0x5267('0xf')],'include':[{'model':_0x5267('0xc'),'as':_0x5267('0xc'),'attributes':['id',_0x5267('0x2')]}]},{'model':_0x5267('0x9'),'as':_0x5267('0x10'),'attributes':['id',_0x5267('0xa'),_0x5267('0xb'),_0x5267('0x11'),_0x5267('0x12'),_0x5267('0x13'),_0x5267('0xf')],'include':[{'model':_0x5267('0xc'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x5267('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 95bde05..411149c 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['remoteUri','serverUrl','SugarcrmConfiguration','Configurations','name','SugarcrmField','Subjects','Variable','Descriptions','content','key','keyType','variableName','Fields','customField','GetSugarcrmAccount','../../client','Request','username','password'];(function(_0x32e237,_0x49e5f3){var _0x18bbe8=function(_0x324a07){while(--_0x324a07){_0x32e237['push'](_0x32e237['shift']());}};_0x18bbe8(++_0x49e5f3);}(_0x0295,0x1f0));var _0x5029=function(_0x56e027,_0x496a98){_0x56e027=_0x56e027-0x0;var _0x33ffc4=_0x0295[_0x56e027];return _0x33ffc4;};'use strict';var client=require(_0x5029('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0x5e71d0){return client[_0x5029('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5')],'include':[{'model':_0x5029('0x6'),'as':_0x5029('0x7'),'attributes':['id',_0x5029('0x8')],'include':[{'model':_0x5029('0x9'),'as':_0x5029('0xa'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x5029('0xb'),'as':'Variable','attributes':['id',_0x5029('0x8')]}]},{'model':'SugarcrmField','as':_0x5029('0xc'),'attributes':['id','type',_0x5029('0xd'),_0x5029('0xe'),_0x5029('0xf'),'keyContent',_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id','name']}]},{'model':_0x5029('0x9'),'as':_0x5029('0x11'),'attributes':['id','type','content','idField','nameField',_0x5029('0x12'),_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id',_0x5029('0x8')]}]}]}]},'log':_0x5029('0x13')});};}; \ No newline at end of file +var _0x14a0=['variableName','key','keyContent','Variable','SugarcrmField','Fields','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','SugarcrmConfiguration','Configurations','type','content'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x14a0,0x8e));var _0x014a=function(_0x4643bc,_0x42f1fb){_0x4643bc=_0x4643bc-0x0;var _0x3ca0a4=_0x14a0[_0x4643bc];return _0x3ca0a4;};'use strict';var client=require('../../client');exports[_0x014a('0x0')]=function(){return function(_0x451138){return client[_0x014a('0x1')](_0x014a('0x2'),{'options':{'raw':![],'attributes':['id',_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x014a('0x6'),'as':_0x014a('0x7'),'attributes':['id',_0x014a('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x014a('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id','type','content',_0x014a('0xb'),'keyType',_0x014a('0xc'),_0x014a('0xa')],'include':[{'model':'Variable','as':_0x014a('0xd'),'attributes':['id',_0x014a('0x3')]}]},{'model':_0x014a('0xe'),'as':_0x014a('0xf'),'attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0x10'),_0x014a('0x11'),_0x014a('0x12'),_0x014a('0xa')],'include':[{'model':_0x014a('0xd'),'as':_0x014a('0xd'),'attributes':['id','name']}]}]}]},'log':_0x014a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 5aa2ccc..6b403c1 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe01d=['content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','variableName','Request','GetVtigerAccount','name','description','username','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type'];(function(_0x5c17d8,_0x51cc20){var _0x1841de=function(_0x128311){while(--_0x128311){_0x5c17d8['push'](_0x5c17d8['shift']());}};_0x1841de(++_0x51cc20);}(_0xe01d,0xd1));var _0xde01=function(_0x509083,_0xa6676b){_0x509083=_0x509083-0x0;var _0x4b2495=_0xe01d[_0x509083];return _0x4b2495;};'use strict';var client=require('../../client');exports['getVtigerAccounts']=function(){return function(_0x7447dc){return client[_0xde01('0x0')](_0xde01('0x1'),{'options':{'raw':![],'attributes':['id',_0xde01('0x2'),_0xde01('0x3'),_0xde01('0x4'),'accessKey','remoteUri',_0xde01('0x5')],'include':[{'model':_0xde01('0x6'),'as':_0xde01('0x7'),'attributes':['id',_0xde01('0x2')],'include':[{'model':_0xde01('0x8'),'as':_0xde01('0x9'),'attributes':['id',_0xde01('0xa'),_0xde01('0xb'),'variableName'],'include':[{'model':_0xde01('0xc'),'as':_0xde01('0xc'),'attributes':['id',_0xde01('0x2')]}]},{'model':_0xde01('0x8'),'as':_0xde01('0xd'),'attributes':['id',_0xde01('0xa'),'content',_0xde01('0xe'),_0xde01('0xf'),_0xde01('0x10'),'variableName'],'include':[{'model':_0xde01('0xc'),'as':_0xde01('0xc'),'attributes':['id',_0xde01('0x2')]}]},{'model':_0xde01('0x8'),'as':_0xde01('0x11'),'attributes':['id','type',_0xde01('0xb'),_0xde01('0x12'),_0xde01('0x13'),_0xde01('0x14'),_0xde01('0x15')],'include':[{'model':_0xde01('0xc'),'as':'Variable','attributes':['id',_0xde01('0x2')]}]}]}]},'log':_0xde01('0x1')});};}; \ No newline at end of file +var _0xcb82=['Descriptions','type','key','keyType','keyContent','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','Configurations','Subjects','content','variableName','Variable','VtigerField'];(function(_0xa908d1,_0x221b19){var _0x1c1e0b=function(_0x482c94){while(--_0x482c94){_0xa908d1['push'](_0xa908d1['shift']());}};_0x1c1e0b(++_0x221b19);}(_0xcb82,0xc0));var _0x2cb8=function(_0x2c7125,_0x45d69e){_0x2c7125=_0x2c7125-0x0;var _0x59fb12=_0xcb82[_0x2c7125];return _0x59fb12;};'use strict';var client=require(_0x2cb8('0x0'));exports[_0x2cb8('0x1')]=function(){return function(_0x1d5e6c){return client[_0x2cb8('0x2')](_0x2cb8('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cb8('0x4'),_0x2cb8('0x5'),_0x2cb8('0x6'),_0x2cb8('0x7'),'remoteUri',_0x2cb8('0x8')],'include':[{'model':'VtigerConfiguration','as':_0x2cb8('0x9'),'attributes':['id',_0x2cb8('0x4')],'include':[{'model':'VtigerField','as':_0x2cb8('0xa'),'attributes':['id','type',_0x2cb8('0xb'),_0x2cb8('0xc')],'include':[{'model':_0x2cb8('0xd'),'as':_0x2cb8('0xd'),'attributes':['id','name']}]},{'model':_0x2cb8('0xe'),'as':_0x2cb8('0xf'),'attributes':['id',_0x2cb8('0x10'),_0x2cb8('0xb'),_0x2cb8('0x11'),_0x2cb8('0x12'),_0x2cb8('0x13'),_0x2cb8('0xc')],'include':[{'model':_0x2cb8('0xd'),'as':_0x2cb8('0xd'),'attributes':['id',_0x2cb8('0x4')]}]},{'model':_0x2cb8('0xe'),'as':'Fields','attributes':['id','type',_0x2cb8('0xb'),_0x2cb8('0x14'),_0x2cb8('0x15'),_0x2cb8('0x16'),'variableName'],'include':[{'model':_0x2cb8('0xd'),'as':'Variable','attributes':['id',_0x2cb8('0x4')]}]}]}]},'log':_0x2cb8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index b65b214..0e71c2d 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2557=['ZendeskConfiguration','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','nameField','customField','GetZendeskAccount','../../client','Request','name','password','token','remoteUri','authType','type'];(function(_0x3bcb7c,_0x5af870){var _0x584411=function(_0x4b9a67){while(--_0x4b9a67){_0x3bcb7c['push'](_0x3bcb7c['shift']());}};_0x584411(++_0x5af870);}(_0x2557,0xde));var _0x7255=function(_0x50222b,_0x535589){_0x50222b=_0x50222b-0x0;var _0x4d14c8=_0x2557[_0x50222b];return _0x4d14c8;};'use strict';var client=require(_0x7255('0x0'));exports['getZendeskAccounts']=function(){return function(_0xd1425c){return client[_0x7255('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x7255('0x2'),'username',_0x7255('0x3'),_0x7255('0x4'),_0x7255('0x5'),_0x7255('0x6'),'serverUrl',_0x7255('0x7')],'include':[{'model':_0x7255('0x8'),'as':'Configurations','attributes':['id',_0x7255('0x2')],'include':[{'model':_0x7255('0x9'),'attributes':['id',_0x7255('0x2')]},{'model':_0x7255('0xa'),'as':_0x7255('0xb'),'attributes':['id',_0x7255('0x7'),_0x7255('0xc'),_0x7255('0xd')],'include':[{'model':'Variable','as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]},{'model':_0x7255('0xa'),'as':_0x7255('0xf'),'attributes':['id','type',_0x7255('0xc'),_0x7255('0x10'),_0x7255('0x11'),_0x7255('0x12'),_0x7255('0xd')],'include':[{'model':_0x7255('0xe'),'as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]},{'model':_0x7255('0xa'),'as':_0x7255('0x13'),'attributes':['id',_0x7255('0x7'),_0x7255('0xc'),'idField',_0x7255('0x14'),_0x7255('0x15'),_0x7255('0xd')],'include':[{'model':_0x7255('0xe'),'as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]}]}]},'log':_0x7255('0x16')});};}; \ No newline at end of file +var _0x9059=['name','username','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','ZendeskField','content','variableName','Variable','Descriptions','key','keyType','idField','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request'];(function(_0x5b06f2,_0x181952){var _0x545785=function(_0x129974){while(--_0x129974){_0x5b06f2['push'](_0x5b06f2['shift']());}};_0x545785(++_0x181952);}(_0x9059,0x1b2));var _0x9905=function(_0x3d1a63,_0x29bc32){_0x3d1a63=_0x3d1a63-0x0;var _0x3b8217=_0x9059[_0x3d1a63];return _0x3b8217;};'use strict';var client=require(_0x9905('0x0'));exports[_0x9905('0x1')]=function(){return function(_0x1425a6){return client[_0x9905('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x9905('0x3'),_0x9905('0x4'),'password',_0x9905('0x5'),_0x9905('0x6'),_0x9905('0x7'),_0x9905('0x8'),_0x9905('0x9')],'include':[{'model':_0x9905('0xa'),'as':_0x9905('0xb'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':_0x9905('0xc'),'as':'Subjects','attributes':['id','type',_0x9905('0xd'),_0x9905('0xe')],'include':[{'model':_0x9905('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':'ZendeskField','as':_0x9905('0x10'),'attributes':['id','type',_0x9905('0xd'),_0x9905('0x11'),_0x9905('0x12'),'keyContent',_0x9905('0xe')],'include':[{'model':'Variable','as':_0x9905('0xf'),'attributes':['id','name']}]},{'model':_0x9905('0xc'),'as':'Fields','attributes':['id','type',_0x9905('0xd'),_0x9905('0x13'),_0x9905('0x14'),_0x9905('0x15'),'variableName'],'include':[{'model':_0x9905('0xf'),'as':_0x9905('0xf'),'attributes':['id',_0x9905('0x3')]}]}]}]},'log':_0x9905('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 5e00357..bc8d749 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00e3=['type','content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','variableName','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','serverUrl','code','ZohoConfiguration','moduleCreate','ZohoField','Subjects'];(function(_0x4144a2,_0x4941e0){var _0x1dcb50=function(_0x43e737){while(--_0x43e737){_0x4144a2['push'](_0x4144a2['shift']());}};_0x1dcb50(++_0x4941e0);}(_0x00e3,0x182));var _0x300e=function(_0xc9a48e,_0x4d3e72){_0xc9a48e=_0xc9a48e-0x0;var _0x419127=_0x00e3[_0xc9a48e];return _0x419127;};'use strict';var client=require(_0x300e('0x0'));exports[_0x300e('0x1')]=function(){return function(_0xd5f94d){return client[_0x300e('0x2')](_0x300e('0x3'),{'options':{'raw':![],'attributes':['id',_0x300e('0x4'),_0x300e('0x5'),_0x300e('0x6'),_0x300e('0x7'),'clientId','clientSecret',_0x300e('0x8'),_0x300e('0x9'),'refreshToken'],'include':[{'model':_0x300e('0xa'),'as':'Configurations','attributes':['id',_0x300e('0x4'),_0x300e('0xb'),'moduleSearch',_0x300e('0x5')],'include':[{'model':_0x300e('0xc'),'as':_0x300e('0xd'),'attributes':['id',_0x300e('0xe'),_0x300e('0xf'),'variableName'],'include':[{'model':_0x300e('0x10'),'as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]},{'model':_0x300e('0xc'),'as':_0x300e('0x11'),'attributes':['id',_0x300e('0xe'),'content',_0x300e('0x12'),_0x300e('0x13'),_0x300e('0x14'),'variableName'],'include':[{'model':_0x300e('0x10'),'as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]},{'model':'ZohoField','as':_0x300e('0x15'),'attributes':['id',_0x300e('0xe'),_0x300e('0xf'),_0x300e('0x16'),'nameField',_0x300e('0x17'),_0x300e('0x18')],'include':[{'model':'Variable','as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x3b2f=['Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','GetZohoAccount','../../client','getZohoAccounts','Request','name','description','host','zone','clientId','serverUrl','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField'];(function(_0x2fb1e5,_0x87006a){var _0x61f96c=function(_0x4cc6f0){while(--_0x4cc6f0){_0x2fb1e5['push'](_0x2fb1e5['shift']());}};_0x61f96c(++_0x87006a);}(_0x3b2f,0x15e));var _0xf3b2=function(_0x531f5c,_0x16c5ec){_0x531f5c=_0x531f5c-0x0;var _0x160bc6=_0x3b2f[_0x531f5c];return _0x160bc6;};'use strict';var client=require(_0xf3b2('0x0'));exports[_0xf3b2('0x1')]=function(){return function(_0x49d6f5){return client[_0xf3b2('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xf3b2('0x3'),_0xf3b2('0x4'),_0xf3b2('0x5'),_0xf3b2('0x6'),_0xf3b2('0x7'),'clientSecret',_0xf3b2('0x8'),'code',_0xf3b2('0x9')],'include':[{'model':_0xf3b2('0xa'),'as':_0xf3b2('0xb'),'attributes':['id',_0xf3b2('0x3'),'moduleCreate',_0xf3b2('0xc'),_0xf3b2('0x4')],'include':[{'model':_0xf3b2('0xd'),'as':_0xf3b2('0xe'),'attributes':['id',_0xf3b2('0xf'),_0xf3b2('0x10'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':_0xf3b2('0x12'),'attributes':['id',_0xf3b2('0x3')]}]},{'model':_0xf3b2('0xd'),'as':_0xf3b2('0x13'),'attributes':['id',_0xf3b2('0xf'),'content',_0xf3b2('0x14'),'keyType',_0xf3b2('0x15'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':'Variable','attributes':['id',_0xf3b2('0x3')]}]},{'model':_0xf3b2('0xd'),'as':'Fields','attributes':['id',_0xf3b2('0xf'),_0xf3b2('0x10'),_0xf3b2('0x16'),_0xf3b2('0x17'),_0xf3b2('0x18'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':_0xf3b2('0x12'),'attributes':['id','name']}]}]}]},'log':_0xf3b2('0x19')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 46d69c9..581a81b 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80f2=['../client','stack','trim','intervalIftime\x20called\x20with','isArray','every','number','map','length','interval','concat','IntervalIftime','intervalIftime','../../../config/logger','dialer'];(function(_0xce46e8,_0x1a0d79){var _0x400c7d=function(_0x46a4e4){while(--_0x46a4e4){_0xce46e8['push'](_0xce46e8['shift']());}};_0x400c7d(++_0x1a0d79);}(_0x80f2,0xfd));var _0x280f=function(_0xde12cd,_0x269a1f){_0xde12cd=_0xde12cd-0x0;var _0x93a6e2=_0x80f2[_0xde12cd];return _0x93a6e2;};var logger=require(_0x280f('0x0'))(_0x280f('0x1'));var client=require(_0x280f('0x2'));function intervalIftime(_0x1ab85a,_0x53cb4c){const _0x3eb174=new Error()[_0x280f('0x3')]['replace'](/^Error/,'')[_0x280f('0x4')]();logger['silly'](_0x280f('0x5'),_0x1ab85a,_0x53cb4c,_0x3eb174);const _0x58a65f=Array[_0x280f('0x6')](_0x1ab85a);if(!_0x1ab85a||_0x58a65f&&_0x1ab85a['length']===0x0){return Promise['resolve'](![]);}else{var _0x473389=[];var _0x300763=[];var _0x527fae=_0x58a65f?_0x1ab85a:[_0x1ab85a];var _0x47c548=_0x527fae[_0x280f('0x7')](function(_0xccad78){return typeof _0xccad78===_0x280f('0x8');});var _0xee133f=_0x527fae[_0x280f('0x7')](function(_0x4f2c19){return typeof _0x4f2c19==='string';});if(!_0x47c548&&!_0xee133f){_0x473389=_0x527fae[_0x280f('0x9')](function(_0x51b0be){return _0x51b0be['id'];});if(_0x473389[_0x280f('0xa')]===0x0){_0x300763=_0x527fae[_0x280f('0x9')](function(_0x4be690){return _0x4be690[_0x280f('0xb')];});}}else{if(_0x47c548){_0x473389=_0x473389['concat'](_0x527fae);}if(_0xee133f){_0x300763=_0x300763[_0x280f('0xc')](_0x527fae);}}return client['Request'](_0x280f('0xd'),{'intervalIds':_0x473389,'intervals':_0x300763,'timezone':_0x53cb4c,'log':_0x280f('0xd')});}}exports[_0x280f('0xe')]=intervalIftime; \ No newline at end of file +var _0x344e=['map','interval','Request','IntervalIftime','intervalIftime','dialer','stack','trim','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x344e,0x7d));var _0xe344=function(_0x4ec10d,_0x24c958){_0x4ec10d=_0x4ec10d-0x0;var _0x43d0bc=_0x344e[_0x4ec10d];return _0x43d0bc;};var logger=require('../../../config/logger')(_0xe344('0x0'));var client=require('../client');function intervalIftime(_0x505beb,_0x49a14c){const _0x4a7c51=new Error()[_0xe344('0x1')]['replace'](/^Error/,'')[_0xe344('0x2')]();logger['silly'](_0xe344('0x3'),_0x505beb,_0x49a14c,_0x4a7c51);const _0x1ff35a=Array[_0xe344('0x4')](_0x505beb);if(!_0x505beb||_0x1ff35a&&_0x505beb[_0xe344('0x5')]===0x0){return Promise[_0xe344('0x6')](![]);}else{var _0xd27838=[];var _0x1b5432=[];var _0x25d905=_0x1ff35a?_0x505beb:[_0x505beb];var _0x574825=_0x25d905[_0xe344('0x7')](function(_0x4fe426){return typeof _0x4fe426===_0xe344('0x8');});var _0xdf5055=_0x25d905[_0xe344('0x7')](function(_0x14b6b2){return typeof _0x14b6b2===_0xe344('0x9');});if(!_0x574825&&!_0xdf5055){_0xd27838=_0x25d905[_0xe344('0xa')](function(_0x2d1548){return _0x2d1548['id'];});if(_0xd27838['length']===0x0){_0x1b5432=_0x25d905['map'](function(_0x4537a9){return _0x4537a9[_0xe344('0xb')];});}}else{if(_0x574825){_0xd27838=_0xd27838['concat'](_0x25d905);}if(_0xdf5055){_0x1b5432=_0x1b5432['concat'](_0x25d905);}}return client[_0xe344('0xc')]('IntervalIftime',{'intervalIds':_0xd27838,'intervals':_0x1b5432,'timezone':_0x49a14c,'log':_0xe344('0xd')});}}exports[_0xe344('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 10a6cfc..3939fe5 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9c2=['toNumber','moment','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','queuecallerleaveAt','diff','queue','agent','accountcode','uniqueid','membername','TALKING','starttime','endtime','exten','dialstring'];(function(_0x1e6c8f,_0x30a019){var _0x1c9a45=function(_0x534e95){while(--_0x534e95){_0x1e6c8f['push'](_0x1e6c8f['shift']());}};_0x1c9a45(++_0x30a019);}(_0xe9c2,0x79));var _0x2e9c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe9c2[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x2e9c('0x0'));var _=require('lodash');var util=require('util');var client=require('../client');exports[_0x2e9c('0x1')]=function(_0xe6ca59){var _0x300cb6=_0xe6ca59[_0x2e9c('0x2')]||_0xe6ca59[_0x2e9c('0x3')];return client[_0x2e9c('0x4')](_0x2e9c('0x5'),{'body':{'channel':_0x2e9c('0x6'),'membername':_0xe6ca59[_0x2e9c('0x7')],'interface':_['isNil'](_0xe6ca59[_0x2e9c('0x8')])?util[_0x2e9c('0x9')](_0x2e9c('0xa'),_0xe6ca59['lastAssignedTo']):_0xe6ca59[_0x2e9c('0x8')],'type':'TALKING','enterAt':_0xe6ca59[_0x2e9c('0xb')],'exitAt':_0x300cb6,'duration':moment(_0x300cb6)[_0x2e9c('0xc')](_0xe6ca59[_0x2e9c('0xb')],'seconds'),'data1':'inbound','data2':_0xe6ca59['calleridnum'],'data3':_0xe6ca59['exten'],'data4':null,'data5':_0xe6ca59[_0x2e9c('0xd')],'role':_0x2e9c('0xe'),'internal':_0xe6ca59['accountcode']?_['toNumber'](_0xe6ca59[_0x2e9c('0xf')]):undefined,'uniqueid':_0xe6ca59[_0x2e9c('0x10')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x2fbc0a){return client[_0x2e9c('0x4')](_0x2e9c('0x5'),{'body':{'channel':_0x2e9c('0x6'),'membername':_0x2fbc0a[_0x2e9c('0x11')],'interface':_0x2fbc0a[_0x2e9c('0x8')],'type':_0x2e9c('0x12'),'enterAt':_0x2fbc0a[_0x2e9c('0x13')],'exitAt':_0x2fbc0a['endtime'],'duration':moment(_0x2fbc0a[_0x2e9c('0x14')])[_0x2e9c('0xc')](_0x2fbc0a[_0x2e9c('0x13')],'seconds')>=0x0?moment(_0x2fbc0a[_0x2e9c('0x14')])['diff'](_0x2fbc0a[_0x2e9c('0x13')],'seconds'):null,'data1':'outbound','data2':_0x2fbc0a[_0x2e9c('0xf')],'data3':_0x2fbc0a[_0x2e9c('0x15')],'data4':_0x2fbc0a[_0x2e9c('0x16')]||null,'role':_0x2e9c('0xe'),'internal':_0x2fbc0a[_0x2e9c('0xf')]?_[_0x2e9c('0x17')](_0x2fbc0a[_0x2e9c('0xf')]):undefined,'uniqueid':_0x2fbc0a[_0x2e9c('0x10')]},'log':_0x2e9c('0x5')});}; \ No newline at end of file +var _0xdd24=['queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','CreateMemberReport','voiceDialReport','membername','starttime','endtime','seconds','dialstring','uniqueid','moment','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0xdd24,0x174));var _0x4dd2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd24[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x4dd2('0x0'));var _=require('lodash');var util=require(_0x4dd2('0x1'));var client=require(_0x4dd2('0x2'));exports[_0x4dd2('0x3')]=function(_0x4d2c49){var _0x327fbc=_0x4d2c49[_0x4dd2('0x4')]||_0x4d2c49[_0x4dd2('0x5')];return client[_0x4dd2('0x6')]('CreateMemberReport',{'body':{'channel':_0x4dd2('0x7'),'membername':_0x4d2c49[_0x4dd2('0x8')],'interface':_[_0x4dd2('0x9')](_0x4d2c49[_0x4dd2('0xa')])?util['format'](_0x4dd2('0xb'),_0x4d2c49[_0x4dd2('0x8')]):_0x4d2c49[_0x4dd2('0xa')],'type':'TALKING','enterAt':_0x4d2c49[_0x4dd2('0xc')],'exitAt':_0x327fbc,'duration':moment(_0x327fbc)[_0x4dd2('0xd')](_0x4d2c49[_0x4dd2('0xc')],'seconds'),'data1':_0x4dd2('0xe'),'data2':_0x4d2c49[_0x4dd2('0xf')],'data3':_0x4d2c49[_0x4dd2('0x10')],'data4':null,'data5':_0x4d2c49[_0x4dd2('0x11')],'role':_0x4dd2('0x12'),'internal':_0x4d2c49[_0x4dd2('0x13')]?_[_0x4dd2('0x14')](_0x4d2c49['accountcode']):undefined,'uniqueid':_0x4d2c49['uniqueid']},'log':_0x4dd2('0x15')});};exports[_0x4dd2('0x16')]=function(_0x49091e){return client[_0x4dd2('0x6')]('CreateMemberReport',{'body':{'channel':_0x4dd2('0x7'),'membername':_0x49091e[_0x4dd2('0x17')],'interface':_0x49091e['interface'],'type':'TALKING','enterAt':_0x49091e[_0x4dd2('0x18')],'exitAt':_0x49091e['endtime'],'duration':moment(_0x49091e[_0x4dd2('0x19')])[_0x4dd2('0xd')](_0x49091e[_0x4dd2('0x18')],'seconds')>=0x0?moment(_0x49091e[_0x4dd2('0x19')])[_0x4dd2('0xd')](_0x49091e['starttime'],_0x4dd2('0x1a')):null,'data1':'outbound','data2':_0x49091e[_0x4dd2('0x13')],'data3':_0x49091e['exten'],'data4':_0x49091e[_0x4dd2('0x1b')]||null,'role':_0x4dd2('0x12'),'internal':_0x49091e[_0x4dd2('0x13')]?_[_0x4dd2('0x14')](_0x49091e[_0x4dd2('0x13')]):undefined,'uniqueid':_0x49091e[_0x4dd2('0x1c')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3df132d..96e0083 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eef=['Request','stopRecordingOnTransfer','GetSettings'];(function(_0x335bf3,_0x218da7){var _0x3097c7=function(_0x9ec832){while(--_0x9ec832){_0x335bf3['push'](_0x335bf3['shift']());}};_0x3097c7(++_0x218da7);}(_0x5eef,0x9c));var _0xf5ee=function(_0x43402d,_0x2037c8){_0x43402d=_0x43402d-0x0;var _0x402c94=_0x5eef[_0x43402d];return _0x402c94;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xf5ee('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf5ee('0x1'),'previewRecallmeReminderInterval']},'log':_0xf5ee('0x2')});}; \ No newline at end of file +var _0x315f=['../client','Request','previewRecallmeReminderInterval'];(function(_0x4d6c9c,_0x257c78){var _0x1b904f=function(_0x343e68){while(--_0x343e68){_0x4d6c9c['push'](_0x4d6c9c['shift']());}};_0x1b904f(++_0x257c78);}(_0x315f,0x174));var _0xf315=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x315f[_0x1b7368];return _0x25d54c;};'use strict';var client=require(_0xf315('0x0'));exports['getSettings']=function(){return client[_0xf315('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xf315('0x2')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 94c2f04..f32f7c0 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 _0xcefd=['getTemplates','Request','GetTemplate','name','html'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0xcefd,0x1bd));var _0xdcef=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xcefd[_0x55daf2];return _0x1c8500;};'use strict';var client=require('../client');exports[_0xdcef('0x0')]=function(_0x1508f9){return function(_0x341ca6){return client[_0xdcef('0x1')](_0xdcef('0x2'),{'options':{'raw':!![],'attributes':['id',_0xdcef('0x3'),_0xdcef('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xf47b=['getTemplates','Request','GetTemplate','html','../client'];(function(_0x42c5cd,_0x5390a6){var _0xd4a04a=function(_0x1ebaaf){while(--_0x1ebaaf){_0x42c5cd['push'](_0x42c5cd['shift']());}};_0xd4a04a(++_0x5390a6);}(_0xf47b,0x15d));var _0xbf47=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf47b[_0x173441];return _0x2423a8;};'use strict';var client=require(_0xbf47('0x0'));exports[_0xbf47('0x1')]=function(_0x3585b7){return function(_0x4f851e){return client[_0xbf47('0x2')](_0xbf47('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xbf47('0x4')]},'log':_0xbf47('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 1102748..05270d7 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 _0x843b=['channel','Condition','field','operator','value','Action','Actions','action','data3','data5','data6','data7','GetTrigger','../client','getTriggers','name'];(function(_0x40b723,_0x118b22){var _0x1981ad=function(_0x1dbe18){while(--_0x1dbe18){_0x40b723['push'](_0x40b723['shift']());}};_0x1981ad(++_0x118b22);}(_0x843b,0x9d));var _0xb843=function(_0x1db7bd,_0x1637fa){_0x1db7bd=_0x1db7bd-0x0;var _0x3b0a45=_0x843b[_0x1db7bd];return _0x3b0a45;};'use strict';var client=require(_0xb843('0x0'));exports[_0xb843('0x1')]=function(_0x53a4c9){return function(_0x566d0f){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xb843('0x2'),_0xb843('0x3'),'status'],'include':[{'model':_0xb843('0x4'),'as':'AllConditions','attributes':['id',_0xb843('0x5'),_0xb843('0x6'),_0xb843('0x7')]},{'model':_0xb843('0x4'),'as':'AnyConditions','attributes':['id',_0xb843('0x5'),_0xb843('0x6'),'value']},{'model':_0xb843('0x8'),'as':_0xb843('0x9'),'attributes':['id',_0xb843('0xa'),'data1','data2',_0xb843('0xb'),'data4',_0xb843('0xc'),_0xb843('0xd'),_0xb843('0xe')]}]},'log':_0xb843('0xf')});};}; \ No newline at end of file +var _0xb34a=['Actions','action','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','field','operator','value','Condition','Action'];(function(_0x1f27d7,_0x47eda3){var _0x1574b3=function(_0x34782f){while(--_0x34782f){_0x1f27d7['push'](_0x1f27d7['shift']());}};_0x1574b3(++_0x47eda3);}(_0xb34a,0x181));var _0xab34=function(_0x48d75a,_0x92e69e){_0x48d75a=_0x48d75a-0x0;var _0x18a15c=_0xb34a[_0x48d75a];return _0x18a15c;};'use strict';var client=require(_0xab34('0x0'));exports[_0xab34('0x1')]=function(_0x6dea04){return function(_0x256b6d){return client[_0xab34('0x2')](_0xab34('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xab34('0x4'),_0xab34('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xab34('0x6'),_0xab34('0x7'),_0xab34('0x8')]},{'model':_0xab34('0x9'),'as':'AnyConditions','attributes':['id',_0xab34('0x6'),_0xab34('0x7'),'value']},{'model':_0xab34('0xa'),'as':_0xab34('0xb'),'attributes':['id',_0xab34('0xc'),'data1',_0xab34('0xd'),_0xab34('0xe'),_0xab34('0xf'),_0xab34('0x10'),'data6',_0xab34('0x11')]}]},'log':_0xab34('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ed4b585..d000cc1 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 _0xa25a=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x1280fc,_0x534530){var _0x244efc=function(_0x4a1e04){while(--_0x4a1e04){_0x1280fc['push'](_0x1280fc['shift']());}};_0x244efc(++_0x534530);}(_0xa25a,0x160));var _0xaa25=function(_0x37bcdd,_0x4fea5c){_0x37bcdd=_0x37bcdd-0x0;var _0x4d32de=_0xa25a[_0x37bcdd];return _0x4d32de;};'use strict';var client=require(_0xaa25('0x0'));exports[_0xaa25('0x1')]=function(_0x212df1){return function(_0x22c967){return client[_0xaa25('0x2')](_0xaa25('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaa25('0x4'),_0xaa25('0x5'),_0xaa25('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x0a67=['registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0a67,0x1c4));var _0x70a6=function(_0x43a8ea,_0x359c48){_0x43a8ea=_0x43a8ea-0x0;var _0x55235b=_0x0a67[_0x43a8ea];return _0x55235b;};'use strict';var client=require(_0x70a6('0x0'));exports[_0x70a6('0x1')]=function(_0x476502){return function(_0x1a00b2){return client['Request'](_0x70a6('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x70a6('0x3'),_0x70a6('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 b2f7ac6..2f1857b 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe706,0xa3));var _0x6e70=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0xe706[_0x50abc4];return _0x5a745d;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x56161a,_0x536c32){var _0x11a565=function(_0x1b53f7){while(--_0x1b53f7){_0x56161a['push'](_0x56161a['shift']());}};_0x11a565(++_0x536c32);}(_0x34e8,0x12c));var _0x834e=function(_0x2c61c7,_0x2674aa){_0x2c61c7=_0x2c61c7-0x0;var _0x3993d0=_0x34e8[_0x2c61c7];return _0x3993d0;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 93e2b32..ef7451e 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 _0xd034=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5ce7d6,_0x6d9f74){var _0x49ee1d=function(_0x33e003){while(--_0x33e003){_0x5ce7d6['push'](_0x5ce7d6['shift']());}};_0x49ee1d(++_0x6d9f74);}(_0xd034,0x9c));var _0x4d03=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0xd034[_0x2a8255];return _0x20d7a5;};'use strict';var client=require(_0x4d03('0x0'));exports[_0x4d03('0x1')]=function(_0x3d951a){return client[_0x4d03('0x2')]('CreateVoiceAgentReport',{'body':_0x3d951a,'log':_0x4d03('0x3')});};exports[_0x4d03('0x4')]=function(_0x3534ec,_0x11c04d,_0x2887f5){return client[_0x4d03('0x2')](_0x4d03('0x5'),{'body':_0x3534ec,'options':{'where':{'uniqueid':_0x11c04d,'interface':_0x2887f5,'agentcomplete':!![]}},'log':_0x4d03('0x5')});}; \ No newline at end of file +var _0xe112=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0xf8be6a,_0x1b7bd7){var _0x471e7f=function(_0x2eacd7){while(--_0x2eacd7){_0xf8be6a['push'](_0xf8be6a['shift']());}};_0x471e7f(++_0x1b7bd7);}(_0xe112,0x148));var _0x2e11=function(_0x3c3d90,_0x3a9723){_0x3c3d90=_0x3c3d90-0x0;var _0x3dea61=_0xe112[_0x3c3d90];return _0x3dea61;};'use strict';var client=require(_0x2e11('0x0'));exports[_0x2e11('0x1')]=function(_0x239b59){return client[_0x2e11('0x2')]('CreateVoiceAgentReport',{'body':_0x239b59,'log':_0x2e11('0x3')});};exports['update']=function(_0x54d542,_0x5543a9,_0x17da0a){return client[_0x2e11('0x2')](_0x2e11('0x4'),{'body':_0x54d542,'options':{'where':{'uniqueid':_0x5543a9,'interface':_0x17da0a,'agentcomplete':!![]}},'log':_0x2e11('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2bd6c08..6e5f01f 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 _0xf4c8=['GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds'];(function(_0x13513c,_0x11d5a0){var _0x19e6f8=function(_0x1d7c71){while(--_0x1d7c71){_0x13513c['push'](_0x13513c['shift']());}};_0x19e6f8(++_0x11d5a0);}(_0xf4c8,0x166));var _0x8f4c=function(_0x4d3cd6,_0x4c8e7a){_0x4d3cd6=_0x4d3cd6-0x0;var _0x1a258e=_0xf4c8[_0x4d3cd6];return _0x1a258e;};'use strict';var moment=require(_0x8f4c('0x0'));var util=require(_0x8f4c('0x1'));var _=require(_0x8f4c('0x2'));var client=require(_0x8f4c('0x3'));exports['create']=function(_0xdc26c3){return client['Request'](_0x8f4c('0x4'),{'body':_[_0x8f4c('0x5')](_0xdc26c3,{'source':_0xdc26c3[_0x8f4c('0x6')],'destinationcontext':_0xdc26c3[_0x8f4c('0x7')],'callerid':_0xdc26c3['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x8f4c('0x4')});};exports[_0x8f4c('0x8')]=function(){return function(){return client[_0x8f4c('0x9')](_0x8f4c('0xa'),{'options':{'where':{'type':[_0x8f4c('0xb')],'createdAt':{'$between':[moment()[_0x8f4c('0xc')](_0x8f4c('0xd'))[_0x8f4c('0xe')](_0x8f4c('0xf')),moment()['endOf'](_0x8f4c('0xd'))[_0x8f4c('0xe')](_0x8f4c('0xf'))]}},'attributes':[_0x8f4c('0x10'),_0x8f4c('0x11'),_0x8f4c('0x12'),_0x8f4c('0x13')]},'log':_0x8f4c('0x14')});};}; \ No newline at end of file +var _0x11cb=['format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x11cb,0x167));var _0xb11c=function(_0x58e718,_0x1e757f){_0x58e718=_0x58e718-0x0;var _0x373fb7=_0x11cb[_0x58e718];return _0x373fb7;};'use strict';var moment=require(_0xb11c('0x0'));var util=require(_0xb11c('0x1'));var _=require(_0xb11c('0x2'));var client=require(_0xb11c('0x3'));exports[_0xb11c('0x4')]=function(_0x46fc1c){return client['Request'](_0xb11c('0x5'),{'body':_['merge'](_0x46fc1c,{'source':_0x46fc1c[_0xb11c('0x6')],'destinationcontext':_0x46fc1c[_0xb11c('0x7')],'callerid':_0x46fc1c[_0xb11c('0x8')],'amaflags':_0xb11c('0x9')}),'log':_0xb11c('0x5')});};exports[_0xb11c('0xa')]=function(){return function(){return client['Request'](_0xb11c('0xb'),{'options':{'where':{'type':[_0xb11c('0xc')],'createdAt':{'$between':[moment()[_0xb11c('0xd')](_0xb11c('0xe'))[_0xb11c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb11c('0x10')]('day')[_0xb11c('0xf')](_0xb11c('0x11'))]}},'attributes':[_0xb11c('0x12'),_0xb11c('0x13'),'duration',_0xb11c('0x14')]},'log':_0xb11c('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3f674b7..a5ac038 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 _0x151e=['create','Request','CreateVoiceDialReport'];(function(_0x14333b,_0x382bb1){var _0x37795f=function(_0x108d4d){while(--_0x108d4d){_0x14333b['push'](_0x14333b['shift']());}};_0x37795f(++_0x382bb1);}(_0x151e,0x72));var _0xe151=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x151e[_0x4c06ac];return _0x2333cb;};'use strict';var client=require('../client');exports[_0xe151('0x0')]=function(_0x20327c){return client[_0xe151('0x1')](_0xe151('0x2'),{'body':_0x20327c,'log':_0xe151('0x2')});}; \ No newline at end of file +var _0x452b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1f4982,_0x1a358e){var _0xae85d1=function(_0x11258f){while(--_0x11258f){_0x1f4982['push'](_0x1f4982['shift']());}};_0xae85d1(++_0x1a358e);}(_0x452b,0x100));var _0xb452=function(_0xca9594,_0x9c91c5){_0xca9594=_0xca9594-0x0;var _0x4db75a=_0x452b[_0xca9594];return _0x4db75a;};'use strict';var client=require(_0xb452('0x0'));exports[_0xb452('0x1')]=function(_0x46d098){return client[_0xb452('0x2')](_0xb452('0x3'),{'body':_0x46d098,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b8d55a7..afdb17b 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 _0x823c=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x823c,0x143));var _0xc823=function(_0x507290,_0x29a5fc){_0x507290=_0x507290-0x0;var _0x2438e7=_0x823c[_0x507290];return _0x2438e7;};'use strict';var client=require(_0xc823('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc823('0x5')});};}; \ No newline at end of file +var _0xc112=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xc112,0xec));var _0x2c11=function(_0x2351e5,_0x4537b5){_0x2351e5=_0x2351e5-0x0;var _0x4f6189=_0xc112[_0x2351e5];return _0x4f6189;};'use strict';var client=require(_0x2c11('0x0'));exports[_0x2c11('0x1')]=function(){return function(){return client[_0x2c11('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2c11('0x3'),_0x2c11('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2c11('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ec25387..6a39ae1 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 _0x7971=['Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','../client','getVoiceQueues','name','acw','acwTimeout','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x1e46f0,_0x12c59d){var _0x9f7325=function(_0x350a26){while(--_0x350a26){_0x1e46f0['push'](_0x1e46f0['shift']());}};_0x9f7325(++_0x12c59d);}(_0x7971,0x197));var _0x1797=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x7971[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0x1797('0x0'));exports[_0x1797('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1797('0x2'),_0x1797('0x3'),_0x1797('0x4'),'autopause','monitor_format','type',_0x1797('0x5'),_0x1797('0x6'),'dialLimitChannel',_0x1797('0x7'),_0x1797('0x8'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x1797('0x9'),_0x1797('0xa'),_0x1797('0xb'),_0x1797('0xc'),_0x1797('0xd'),_0x1797('0xe'),_0x1797('0xf'),_0x1797('0x10'),'dialCongestionRetryFrequency',_0x1797('0x11'),_0x1797('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x1797('0x13'),'dialTimezone',_0x1797('0x14'),_0x1797('0x15'),'dialCheckDuplicateType',_0x1797('0x16'),'dialAMDInitialSilence',_0x1797('0x17'),_0x1797('0x18'),_0x1797('0x19'),'dialAMDMinWordLength',_0x1797('0x1a'),_0x1797('0x1b'),_0x1797('0x1c'),_0x1797('0x1d'),'timeout',_0x1797('0x1e'),'dialRecallInQueue',_0x1797('0x1f'),_0x1797('0x20'),'dialAgiAfterHangupClient',_0x1797('0x21'),_0x1797('0x22'),_0x1797('0x23'),_0x1797('0x24'),_0x1797('0x25'),_0x1797('0x26'),_0x1797('0x27'),_0x1797('0x28'),_0x1797('0x29'),_0x1797('0x2a'),'dialAbandonedRetryFrequency',_0x1797('0x2b'),_0x1797('0x2c'),'dialAgentRejectMaxRetry',_0x1797('0x2d'),_0x1797('0x2e'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x1797('0x2f'),_0x1797('0x30')],'include':[{'model':_0x1797('0x31'),'as':_0x1797('0x31'),'attributes':['id',_0x1797('0x2'),_0x1797('0x32'),'active']},{'model':_0x1797('0x33'),'as':_0x1797('0x34'),'attributes':['id',_0x1797('0x2')]},{'model':_0x1797('0x31'),'as':_0x1797('0x35'),'attributes':['id',_0x1797('0x2'),_0x1797('0x32'),_0x1797('0x36')]},{'model':'Interval','as':_0x1797('0x37'),'attributes':['id',_0x1797('0x2')],'include':[{'model':_0x1797('0x37'),'as':'Intervals','attributes':['id',_0x1797('0x2'),_0x1797('0x38')]}]}]},'log':_0x1797('0x1')});};}; \ No newline at end of file +var _0x6483=['timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x202c66,_0x380f21){var _0x3548ff=function(_0x4e6d7a){while(--_0x4e6d7a){_0x202c66['push'](_0x202c66['shift']());}};_0x3548ff(++_0x380f21);}(_0x6483,0x1e2));var _0x3648=function(_0x42dfd8,_0x1d246b){_0x42dfd8=_0x42dfd8-0x0;var _0x4e87d9=_0x6483[_0x42dfd8];return _0x4e87d9;};'use strict';var client=require(_0x3648('0x0'));exports[_0x3648('0x1')]=function(){return function(){return client[_0x3648('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3648('0x3'),'acw',_0x3648('0x4'),_0x3648('0x5'),_0x3648('0x6'),_0x3648('0x7'),_0x3648('0x8'),'dialMethod','dialLimitChannel',_0x3648('0x9'),'dialPowerLevel',_0x3648('0xa'),_0x3648('0xb'),_0x3648('0xc'),_0x3648('0xd'),_0x3648('0xe'),_0x3648('0xf'),'dialQueueOptions','dialQueueTimeout',_0x3648('0x10'),_0x3648('0x11'),'dialCongestionRetryFrequency',_0x3648('0x12'),_0x3648('0x13'),_0x3648('0x14'),'dialNoAnswerRetryFrequency',_0x3648('0x15'),_0x3648('0x16'),_0x3648('0x17'),'dialPrefix',_0x3648('0x18'),'dialAMDActive','dialAMDInitialSilence',_0x3648('0x19'),_0x3648('0x1a'),'dialAMDTotalAnalysisTime',_0x3648('0x1b'),'dialAMDBetweenWordsSilence',_0x3648('0x1c'),_0x3648('0x1d'),_0x3648('0x1e'),_0x3648('0x1f'),_0x3648('0x20'),'dialRecallInQueue',_0x3648('0x21'),'dialAgiAfterHangupAgent',_0x3648('0x22'),_0x3648('0x23'),_0x3648('0x6'),_0x3648('0x24'),_0x3648('0x25'),_0x3648('0x26'),_0x3648('0x27'),_0x3648('0x28'),_0x3648('0x29'),'dialDropRetryFrequency',_0x3648('0x2a'),_0x3648('0x2b'),_0x3648('0x2c'),_0x3648('0x2d'),_0x3648('0x2e'),_0x3648('0x2f'),'mandatoryDisposition',_0x3648('0x30'),_0x3648('0x31'),_0x3648('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x3648('0x33'),'as':_0x3648('0x33'),'attributes':['id',_0x3648('0x3'),_0x3648('0x34'),_0x3648('0x35')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x3648('0x33'),'as':_0x3648('0x36'),'attributes':['id','name','callerid','active']},{'model':_0x3648('0x37'),'as':'Interval','attributes':['id',_0x3648('0x3')],'include':[{'model':_0x3648('0x37'),'as':_0x3648('0x38'),'attributes':['id','name','interval']}]}]},'log':_0x3648('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index fb1b818..dfdd262 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x30ec83,_0x31fe48){var _0x232efc=function(_0x42d1a1){while(--_0x42d1a1){_0x30ec83['push'](_0x30ec83['shift']());}};_0x232efc(++_0x31fe48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2fd648,_0x30d2ce){var _0x5661a1=function(_0x3ad75a){while(--_0x3ad75a){_0x2fd648['push'](_0x2fd648['shift']());}};_0x5661a1(++_0x30d2ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 1a5c00e..444df8e 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 _0x49cc=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x58fccb,_0x391352){var _0x1ab554=function(_0x28c767){while(--_0x28c767){_0x58fccb['push'](_0x58fccb['shift']());}};_0x1ab554(++_0x391352);}(_0x49cc,0x19c));var _0xc49c=function(_0x464d42,_0x4f1d09){_0x464d42=_0x464d42-0x0;var _0x1483d3=_0x49cc[_0x464d42];return _0x1483d3;};'use strict';var client=require(_0xc49c('0x0'));exports[_0xc49c('0x1')]=function(_0x591565){return function(){return client['Request'](_0xc49c('0x2'),{'options':{'where':{'VoiceQueueId':_0x591565,'paused':!![]},'raw':!![]},'log':_0xc49c('0x1')});};}; \ No newline at end of file +var _0xc3ca=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x22c3f6,_0x1ddda0){var _0x18b3cf=function(_0x59572b){while(--_0x59572b){_0x22c3f6['push'](_0x22c3f6['shift']());}};_0x18b3cf(++_0x1ddda0);}(_0xc3ca,0x199));var _0xac3c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc3ca[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0xac3c('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4b6031){return function(){return client[_0xac3c('0x1')](_0xac3c('0x2'),{'options':{'where':{'VoiceQueueId':_0x4b6031,'paused':!![]},'raw':!![]},'log':_0xac3c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 07c0405..b18c45c 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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x239ef2,_0x58ccf1){var _0x4bcd37=function(_0xf5b262){while(--_0xf5b262){_0x239ef2['push'](_0x239ef2['shift']());}};_0x4bcd37(++_0x58ccf1);}(_0x7a54,0x106));var _0x47a5=function(_0x22bded,_0x57ba9b){_0x22bded=_0x22bded-0x0;var _0xd57bb9=_0x7a54[_0x22bded];return _0xd57bb9;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x530a76,_0x37fd66){var _0x1b7a4d=function(_0xf58347){while(--_0xf58347){_0x530a76['push'](_0x530a76['shift']());}};_0x1b7a4d(++_0x37fd66);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index caf0cc5..4bc7b13 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 _0xfa79=['transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x19a79c,_0x18a3c5){var _0xbd43df=function(_0x31b5ae){while(--_0x31b5ae){_0x19a79c['push'](_0x19a79c['shift']());}};_0xbd43df(++_0x18a3c5);}(_0xfa79,0x121));var _0x9fa7=function(_0x5d05b4,_0x42b6ba){_0x5d05b4=_0x5d05b4-0x0;var _0x13108c=_0xfa79[_0x5d05b4];return _0x13108c;};'use strict';var client=require(_0x9fa7('0x0'));exports[_0x9fa7('0x1')]={};exports[_0x9fa7('0x2')]=function(_0x7c6efa){return client[_0x9fa7('0x3')](_0x9fa7('0x4'),{'body':{'result':_0x7c6efa[_0x9fa7('0x5')],'transfererchannel':_0x7c6efa[_0x9fa7('0x6')],'transferercalleridnum':_0x7c6efa['transferercalleridnum'],'transferercalleridname':_0x7c6efa[_0x9fa7('0x7')],'transfererconnectedlinenum':_0x7c6efa['transfererconnectedlinenum'],'transfererconnectedlinename':_0x7c6efa[_0x9fa7('0x8')],'transfereraccountcode':_0x7c6efa[_0x9fa7('0x9')],'transferercontext':_0x7c6efa[_0x9fa7('0xa')],'transfererexten':_0x7c6efa[_0x9fa7('0xb')],'transfererlinkedid':_0x7c6efa[_0x9fa7('0xc')],'transfereechannel':_0x7c6efa['transfereechannel'],'transfereecalleridnum':_0x7c6efa[_0x9fa7('0xd')],'transfereecalleridname':_0x7c6efa['transfereecalleridname'],'transfereeconnectedlinenum':_0x7c6efa['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x7c6efa[_0x9fa7('0xe')],'transfereeaccountcode':_0x7c6efa[_0x9fa7('0xf')],'transfereecontext':_0x7c6efa[_0x9fa7('0x10')],'transfereeexten':_0x7c6efa[_0x9fa7('0x11')],'transfereelinkedid':_0x7c6efa[_0x9fa7('0x12')],'isexternal':_0x7c6efa[_0x9fa7('0x13')],'context':_0x7c6efa[_0x9fa7('0x14')],'extension':_0x7c6efa['extension'],'type':_0x9fa7('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x9fa7('0x16')]=function(_0x11b91f){return client[_0x9fa7('0x3')](_0x9fa7('0x4'),{'body':{'result':_0x11b91f[_0x9fa7('0x5')],'transfererchannel':_0x11b91f[_0x9fa7('0x17')],'transferercalleridnum':_0x11b91f['origtransferercalleridnum'],'transferercalleridname':_0x11b91f[_0x9fa7('0x18')],'transfererconnectedlinenum':_0x11b91f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x11b91f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x11b91f[_0x9fa7('0x19')],'transferercontext':_0x11b91f[_0x9fa7('0x1a')],'transfererexten':_0x11b91f[_0x9fa7('0x1b')],'transfererlinkedid':_0x11b91f['origtransfererlinkedid'],'transfereechannel':_0x11b91f[_0x9fa7('0x1c')],'transfereecalleridnum':_0x11b91f[_0x9fa7('0x1d')],'transfereecalleridname':_0x11b91f[_0x9fa7('0x1e')],'transfereeconnectedlinenum':_0x11b91f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x11b91f[_0x9fa7('0x1f')],'transfereeaccountcode':_0x11b91f[_0x9fa7('0x20')],'transfereecontext':_0x11b91f[_0x9fa7('0x21')],'transfereeexten':_0x11b91f[_0x9fa7('0x22')],'transfereelinkedid':_0x11b91f[_0x9fa7('0x23')],'isexternal':_0x11b91f[_0x9fa7('0x13')],'context':_0x11b91f['origtransferercontext'],'extension':_0x11b91f['origtransfererexten'],'type':_0x9fa7('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x318b=['transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname'];(function(_0x4a394c,_0x26053d){var _0x1bd9b3=function(_0x583ffd){while(--_0x583ffd){_0x4a394c['push'](_0x4a394c['shift']());}};_0x1bd9b3(++_0x26053d);}(_0x318b,0x146));var _0xb318=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x318b[_0xd9c529];return _0x146760;};'use strict';var client=require(_0xb318('0x0'));exports[_0xb318('0x1')]={};exports[_0xb318('0x2')]=function(_0x19bfd7){return client[_0xb318('0x3')](_0xb318('0x4'),{'body':{'result':_0x19bfd7[_0xb318('0x5')],'transfererchannel':_0x19bfd7[_0xb318('0x6')],'transferercalleridnum':_0x19bfd7[_0xb318('0x7')],'transferercalleridname':_0x19bfd7['transferercalleridname'],'transfererconnectedlinenum':_0x19bfd7[_0xb318('0x8')],'transfererconnectedlinename':_0x19bfd7[_0xb318('0x9')],'transfereraccountcode':_0x19bfd7['transfereraccountcode'],'transferercontext':_0x19bfd7[_0xb318('0xa')],'transfererexten':_0x19bfd7[_0xb318('0xb')],'transfererlinkedid':_0x19bfd7['transfererlinkedid'],'transfereechannel':_0x19bfd7[_0xb318('0xc')],'transfereecalleridnum':_0x19bfd7['transfereecalleridnum'],'transfereecalleridname':_0x19bfd7[_0xb318('0xd')],'transfereeconnectedlinenum':_0x19bfd7[_0xb318('0xe')],'transfereeconnectedlinename':_0x19bfd7['transfereeconnectedlinename'],'transfereeaccountcode':_0x19bfd7[_0xb318('0xf')],'transfereecontext':_0x19bfd7['transfereecontext'],'transfereeexten':_0x19bfd7[_0xb318('0x10')],'transfereelinkedid':_0x19bfd7[_0xb318('0x11')],'isexternal':_0x19bfd7[_0xb318('0x12')],'context':_0x19bfd7[_0xb318('0x13')],'extension':_0x19bfd7['extension'],'type':'blind'},'log':_0xb318('0x4')});};exports[_0xb318('0x14')]=function(_0x3a0be2){return client[_0xb318('0x3')](_0xb318('0x4'),{'body':{'result':_0x3a0be2[_0xb318('0x5')],'transfererchannel':_0x3a0be2[_0xb318('0x15')],'transferercalleridnum':_0x3a0be2['origtransferercalleridnum'],'transferercalleridname':_0x3a0be2[_0xb318('0x16')],'transfererconnectedlinenum':_0x3a0be2['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3a0be2['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3a0be2['origtransfereraccountcode'],'transferercontext':_0x3a0be2[_0xb318('0x17')],'transfererexten':_0x3a0be2['secondtransfererexten'],'transfererlinkedid':_0x3a0be2[_0xb318('0x18')],'transfereechannel':_0x3a0be2[_0xb318('0x19')],'transfereecalleridnum':_0x3a0be2[_0xb318('0x1a')],'transfereecalleridname':_0x3a0be2[_0xb318('0x1b')],'transfereeconnectedlinenum':_0x3a0be2[_0xb318('0x1c')],'transfereeconnectedlinename':_0x3a0be2[_0xb318('0x1d')],'transfereeaccountcode':_0x3a0be2[_0xb318('0x1e')],'transfereecontext':_0x3a0be2['transfertargetcontext'],'transfereeexten':_0x3a0be2[_0xb318('0x1f')],'transfereelinkedid':_0x3a0be2['transfertargetlinkedid'],'isexternal':_0x3a0be2[_0xb318('0x12')],'context':_0x3a0be2[_0xb318('0x20')],'extension':_0x3a0be2[_0xb318('0x21')],'type':'attended'},'log':_0xb318('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index dfe4220..dd28e57 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2bebef,_0x5f49e5){var _0x5b05e0=function(_0x343faa){while(--_0x343faa){_0x2bebef['push'](_0x2bebef['shift']());}};_0x5b05e0(++_0x5f49e5);}(_0x7a54,0x106));var _0x47a5=function(_0x1b7459,_0x5a8536){_0x1b7459=_0x1b7459-0x0;var _0x3873d3=_0x7a54[_0x1b7459];return _0x3873d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3fa5dd,_0x444d81){var _0x52309f=function(_0x3b8429){while(--_0x3b8429){_0x3fa5dd['push'](_0x3fa5dd['shift']());}};_0x52309f(++_0x444d81);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a6269,_0x5deea5){_0x1a6269=_0x1a6269-0x0;var _0x536f68=_0xb10b[_0x1a6269];return _0x536f68;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index f457c20..e129595 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 _0x9e59=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','length','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x5ddf53,_0x32dd66){var _0x233178=function(_0xed1061){while(--_0xed1061){_0x5ddf53['push'](_0x5ddf53['shift']());}};_0x233178(++_0x32dd66);}(_0x9e59,0x1da));var _0x99e5=function(_0x2dd6ac,_0xb7639f){_0x2dd6ac=_0x2dd6ac-0x0;var _0x39cd9f=_0x9e59[_0x2dd6ac];return _0x39cd9f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x99e5('0x0'));var util=require(_0x99e5('0x1'));var config=require(_0x99e5('0x2'));var logger=require(_0x99e5('0x3'))(_0x99e5('0x4'));var cmContactRpc=require(_0x99e5('0x5'));config[_0x99e5('0x6')]=_[_0x99e5('0x7')](config[_0x99e5('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x99e5('0x8'))(new Redis(config[_0x99e5('0x6')]));function emit(_0x3eaeec,_0xd9e56c,_0x9aea32,_0x6feb16,_0x29f360){logger[_0x99e5('0x9')]('[CM][%s][%s]',_0x3eaeec,_0xd9e56c['id'],_0x9aea32,_0x6feb16,JSON['stringify'](_0x29f360));io['to'](_0x9aea32)[_0x99e5('0xa')](_0x6feb16,_0x29f360);}exports[_0x99e5('0xb')]=function(_0x262b52,_0x5ce4a6,_0x234724,_0x4d05ee){var _0x28073e,_0x3d11e7;var _0x4a4328={};var _0x28e0af;var _0x592bd8=Number(_0x234724[_0x99e5('0xc')]);var _0x408cb0=_0x234724[_0x99e5('0xd')]?Boolean(Number(_0x234724[_0x99e5('0xd')])):![];var _0x4ec09a;var _0xb7c440=![];if(!_[_0x99e5('0xe')](_0x234724[_0x99e5('0xf')])){if(_0x234724[_0x99e5('0xf')]=='1')_0xb7c440=!![];}if(!_0xb7c440){if(_0x4d05ee[_0x99e5('0x10')]){_0x4a4328['id']=_0x4d05ee[_0x99e5('0x10')];}}if(!_0x4a4328['id']){_0x4a4328[_0x99e5('0x11')]=_0x592bd8;_0x4ec09a=_0x234724['data3']&&_0x234724[_0x99e5('0x12')]!=='0'?_0x234724['data3'][_0x99e5('0x13')](','):[_0x99e5('0x14')];_0x4a4328[_0x99e5('0x15')]=_['map'](_0x4ec09a,function(_0x346eb8){var _0xd68665={};_0xd68665[_0x346eb8]=_0x4d05ee[_0x99e5('0x16')]?_0x4d05ee['destcalleridnum']:_0x4d05ee['calleridnum'];return _0xd68665;});_0x28e0af=_0x4d05ee[_0x99e5('0x16')]?_0x4d05ee[_0x99e5('0x17')]:_0x4d05ee[_0x99e5('0x18')];}var _0x38805a=['id',_0x99e5('0x19'),_0x99e5('0x1a'),_0x99e5('0x14'),_0x99e5('0x1b'),_0x99e5('0x1c'),_0x99e5('0x11'),_0x99e5('0x1d'),_0x99e5('0x1e'),'updatedAt'];var _0xda826c=_['union'](_0x38805a,_0x4ec09a);BPromise['resolve']()[_0x99e5('0x1f')](cmContactRpc[_0x99e5('0x20')]({'attributes':_0xda826c,'where':_0x4a4328,'phone':_0x28e0af}))[_0x99e5('0x1f')](function(_0x1efbff){_0x3d11e7=_0x1efbff;if(!_[_0x99e5('0x21')](_0x3d11e7)){if(_0x3d11e7['length']===0x1){_0x28073e=_0x3d11e7[0x0];logger[_0x99e5('0x9')](_0x99e5('0x22'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id'],_0x28073e['id']);}else{logger[_0x99e5('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id'],_[_0x99e5('0x24')](_0x3d11e7,'id')[_0x99e5('0x25')](','));}return;}else{logger[_0x99e5('0x9')](_0x99e5('0x26'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id']);var _0x2c3af0={'ListId':_0x592bd8};var _0x921154=_0x234724[_0x99e5('0x27')]&&_0x234724[_0x99e5('0x27')]!=='0'?_0x234724[_0x99e5('0x27')]:'phone';if(_0x408cb0){logger[_0x99e5('0x9')](_0x99e5('0x28'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id']);_0x2c3af0[_0x921154]=_[_0x99e5('0xe')](_0x4d05ee['routeId'])?_0x4d05ee['calleridnum']:_0x4d05ee[_0x99e5('0x17')];if(_[_0x99e5('0xe')](_0x4d05ee[_0x99e5('0x16')])){_0x2c3af0[_0x99e5('0x19')]=_0x4d05ee['calleridname']&&_0x4d05ee[_0x99e5('0x29')]!==_0x99e5('0x2a')?_0x4d05ee['calleridname']:'Unknown';}else{_0x2c3af0['firstName']=_0x4d05ee[_0x99e5('0x2b')]&&_0x4d05ee[_0x99e5('0x2b')]!==_0x99e5('0x2a')?_0x4d05ee[_0x99e5('0x2b')]:_0x99e5('0x2c');}return BPromise[_0x99e5('0x2d')]()['then'](cmContactRpc[_0x99e5('0x2e')](_0x2c3af0))['then'](function(_0x552c00){_0x28073e=_0x552c00;_0x3d11e7[_0x99e5('0x2f')](_0x552c00);if(_0x28073e){logger['info'](_0x99e5('0x30'),_0x4d05ee['uniqueid'],_0x5ce4a6['id'],_0x28073e['id']);}return;});}else{logger[_0x99e5('0x9')](_0x99e5('0x31'),_0x4d05ee['uniqueid'],_0x5ce4a6['id']);_0x2c3af0[_0x921154]=_[_0x99e5('0xe')](_0x4d05ee['routeId'])?_0x4d05ee[_0x99e5('0x18')]:_0x4d05ee['destcalleridnum'];if(_['isNil'](_0x4d05ee[_0x99e5('0x16')])){_0x2c3af0[_0x99e5('0x19')]=_0x4d05ee[_0x99e5('0x29')]&&_0x4d05ee[_0x99e5('0x29')]!==''?_0x4d05ee[_0x99e5('0x29')]:'Unknown';}else{_0x2c3af0['firstName']=_0x4d05ee[_0x99e5('0x2b')]&&_0x4d05ee[_0x99e5('0x2b')]!==''?_0x4d05ee[_0x99e5('0x2b')]:_0x99e5('0x2c');}_0x28073e=_0x2c3af0;_0x3d11e7[_0x99e5('0x2f')](_0x2c3af0);return;}}})['then'](function(){if(_0x262b52){emit(_0x4d05ee['uniqueid'],_0x5ce4a6,util[_0x99e5('0x32')]('user:%s',_0x262b52[_0x99e5('0x33')]),util[_0x99e5('0x32')](_0x99e5('0x34'),_0x234724[_0x99e5('0x35')][_0x99e5('0x36')]()),{'evt':_[_0x99e5('0x37')](_0x4d05ee,{'autoCreate':_0x408cb0}),'contact':_0x28073e===undefined?{}:_0x28073e,'contacts':_0x3d11e7[_0x99e5('0x38')]===0x0?undefined:_0x3d11e7});}});}; \ No newline at end of file +var _0xd5b0=['../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger'];(function(_0x2d2b5a,_0xd64ef9){var _0x8a90c9=function(_0x1a2352){while(--_0x1a2352){_0x2d2b5a['push'](_0x2d2b5a['shift']());}};_0x8a90c9(++_0xd64ef9);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x396afa,_0x336270){_0x396afa=_0x396afa-0x0;var _0x56aceb=_0xd5b0[_0x396afa];return _0x56aceb;};'use strict';var _=require(_0x0d5b('0x0'));var BPromise=require(_0x0d5b('0x1'));var Redis=require(_0x0d5b('0x2'));var util=require(_0x0d5b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0d5b('0x4'))(_0x0d5b('0x5'));var cmContactRpc=require(_0x0d5b('0x6'));config[_0x0d5b('0x7')]=_[_0x0d5b('0x8')](config[_0x0d5b('0x7')],{'host':_0x0d5b('0x9'),'port':0x18eb});var io=require(_0x0d5b('0xa'))(new Redis(config[_0x0d5b('0x7')]));function emit(_0x2d9d31,_0x5f118b,_0x5eb09c,_0x275e62,_0x2e70a9){logger[_0x0d5b('0xb')](_0x0d5b('0xc'),_0x2d9d31,_0x5f118b['id'],_0x5eb09c,_0x275e62,JSON[_0x0d5b('0xd')](_0x2e70a9));io['to'](_0x5eb09c)[_0x0d5b('0xe')](_0x275e62,_0x2e70a9);}exports[_0x0d5b('0xf')]=function(_0x534c21,_0x3e6b86,_0x5082ea,_0x207871){var _0x38242e,_0x3e256e;var _0x127974={};var _0x570d70;var _0x29fcd0=Number(_0x5082ea[_0x0d5b('0x10')]);var _0x14d782=_0x5082ea['data2']?Boolean(Number(_0x5082ea[_0x0d5b('0x11')])):![];var _0x4d5318;var _0x1886e8=![];if(!_['isNil'](_0x5082ea['data5'])){if(_0x5082ea['data5']=='1')_0x1886e8=!![];}if(!_0x1886e8){if(_0x207871[_0x0d5b('0x12')]){_0x127974['id']=_0x207871['xmd-contactid'];}}if(!_0x127974['id']){_0x127974[_0x0d5b('0x13')]=_0x29fcd0;_0x4d5318=_0x5082ea[_0x0d5b('0x14')]&&_0x5082ea[_0x0d5b('0x14')]!=='0'?_0x5082ea[_0x0d5b('0x14')][_0x0d5b('0x15')](','):[_0x0d5b('0x16')];_0x127974[_0x0d5b('0x17')]=_[_0x0d5b('0x18')](_0x4d5318,function(_0x3cbae3){var _0x2e482f={};_0x2e482f[_0x3cbae3]=_0x207871[_0x0d5b('0x19')]?_0x207871['destcalleridnum']:_0x207871['calleridnum'];return _0x2e482f;});_0x570d70=_0x207871[_0x0d5b('0x19')]?_0x207871[_0x0d5b('0x1a')]:_0x207871['calleridnum'];}var _0x318e1e=['id',_0x0d5b('0x1b'),_0x0d5b('0x1c'),_0x0d5b('0x16'),_0x0d5b('0x1d'),_0x0d5b('0x1e'),_0x0d5b('0x13'),_0x0d5b('0x1f'),_0x0d5b('0x20'),_0x0d5b('0x21')];var _0x16738b=_[_0x0d5b('0x22')](_0x318e1e,_0x4d5318);BPromise[_0x0d5b('0x23')]()[_0x0d5b('0x24')](cmContactRpc[_0x0d5b('0x25')]({'attributes':_0x16738b,'where':_0x127974,'phone':_0x570d70}))[_0x0d5b('0x24')](function(_0x4e3993){_0x3e256e=_0x4e3993;if(!_[_0x0d5b('0x26')](_0x3e256e)){if(_0x3e256e[_0x0d5b('0x27')]===0x1){_0x38242e=_0x3e256e[0x0];logger[_0x0d5b('0xb')](_0x0d5b('0x28'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_0x38242e['id']);}else{logger['info'](_0x0d5b('0x2a'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_['map'](_0x3e256e,'id')[_0x0d5b('0x2b')](','));}return;}else{logger[_0x0d5b('0xb')](_0x0d5b('0x2c'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);var _0xc9a5d9={'ListId':_0x29fcd0};var _0x25abb1=_0x5082ea[_0x0d5b('0x2d')]&&_0x5082ea['data4']!=='0'?_0x5082ea[_0x0d5b('0x2d')]:_0x0d5b('0x16');if(_0x14d782){logger[_0x0d5b('0xb')](_0x0d5b('0x2e'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);_0xc9a5d9[_0x25abb1]=_[_0x0d5b('0x2f')](_0x207871['routeId'])?_0x207871[_0x0d5b('0x30')]:_0x207871['destcalleridnum'];if(_[_0x0d5b('0x2f')](_0x207871[_0x0d5b('0x19')])){_0xc9a5d9[_0x0d5b('0x1b')]=_0x207871[_0x0d5b('0x31')]&&_0x207871[_0x0d5b('0x31')]!==_0x0d5b('0x32')?_0x207871[_0x0d5b('0x31')]:_0x0d5b('0x33');}else{_0xc9a5d9['firstName']=_0x207871[_0x0d5b('0x34')]&&_0x207871[_0x0d5b('0x34')]!==_0x0d5b('0x32')?_0x207871['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0x0d5b('0x24')](cmContactRpc['createContact'](_0xc9a5d9))[_0x0d5b('0x24')](function(_0x33c09a){_0x38242e=_0x33c09a;_0x3e256e[_0x0d5b('0x35')](_0x33c09a);if(_0x38242e){logger['info'](_0x0d5b('0x36'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_0x38242e['id']);}return;});}else{logger[_0x0d5b('0xb')](_0x0d5b('0x37'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);_0xc9a5d9[_0x25abb1]=_[_0x0d5b('0x2f')](_0x207871[_0x0d5b('0x19')])?_0x207871[_0x0d5b('0x30')]:_0x207871[_0x0d5b('0x1a')];if(_[_0x0d5b('0x2f')](_0x207871['routeId'])){_0xc9a5d9['firstName']=_0x207871[_0x0d5b('0x31')]&&_0x207871['calleridname']!==''?_0x207871['calleridname']:_0x0d5b('0x33');}else{_0xc9a5d9[_0x0d5b('0x1b')]=_0x207871[_0x0d5b('0x34')]&&_0x207871[_0x0d5b('0x34')]!==_0x0d5b('0x32')?_0x207871[_0x0d5b('0x34')]:_0x0d5b('0x33');}_0x38242e=_0xc9a5d9;_0x3e256e[_0x0d5b('0x35')](_0xc9a5d9);return;}}})[_0x0d5b('0x24')](function(){if(_0x534c21){emit(_0x207871['uniqueid'],_0x3e6b86,util[_0x0d5b('0x38')](_0x0d5b('0x39'),_0x534c21[_0x0d5b('0x3a')]),util[_0x0d5b('0x38')](_0x0d5b('0x3b'),_0x5082ea['action'][_0x0d5b('0x3c')]()),{'evt':_[_0x0d5b('0x3d')](_0x207871,{'autoCreate':_0x14d782}),'contact':_0x38242e===undefined?{}:_0x38242e,'contacts':_0x3e256e[_0x0d5b('0x27')]===0x0?undefined:_0x3e256e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a83cd16..54bafcb 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 _0x9560=['custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','undefined','motionChannel','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','browser','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','data1','jscripty','format','user:%s','name','trigger:%s','action','exec','integration','queue','urlforward','script','parse','query','channel','checkConditions','AnyConditions','debug','evt','inspect','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','message','event','agent','membername','lastevent','routeId','null','substatus','offlineMessage','equals','lodash','url','./urlforward','./integration','./cmContact','trigger','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentcomplete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9560,0x14c));var _0x0956=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x9560[_0x57eb2d];return _0xd8e18;};'use strict';var util=require('util');var _=require(_0x0956('0x0'));var url=require(_0x0956('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x0956('0x2'));var integration=require(_0x0956('0x3'));var cmContact=require(_0x0956('0x4'));var script=require('./script');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x0956('0x5'));var ami=require(_0x0956('0x6'));config[_0x0956('0x7')]=_[_0x0956('0x8')](config[_0x0956('0x7')],{'host':_0x0956('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0956('0x7')]));var operators={'equals':function(_0x437d98,_0x5f0f1e){return _0x437d98==_0x5f0f1e;},'not_equals':function(_0x280f53,_0x4f1b8e){return _0x280f53!=_0x4f1b8e;}};var barAndWebActions=[_0x0956('0xa'),_0x0956('0x1'),_0x0956('0xb')];function Trigger(_0xa48f53){this['triggers']=_0xa48f53[_0x0956('0xc')];this[_0x0956('0xd')]=_0xa48f53[_0x0956('0xd')];this[_0x0956('0xe')]=_0xa48f53[_0x0956('0xe')];this[_0x0956('0xf')]=_0xa48f53['templates'];this[_0x0956('0x10')]=_0xa48f53['voiceExtensions'];this['zendeskAccounts']=_0xa48f53[_0x0956('0x11')];this['freshdeskAccounts']=_0xa48f53[_0x0956('0x12')];this[_0x0956('0x13')]=_0xa48f53[_0x0956('0x13')];this[_0x0956('0x14')]=_0xa48f53[_0x0956('0x14')];this['zohoAccounts']=_0xa48f53[_0x0956('0x15')];this[_0x0956('0x16')]=_0xa48f53[_0x0956('0x16')];this[_0x0956('0x17')]=_0xa48f53[_0x0956('0x17')];this[_0x0956('0x18')]=_0xa48f53[_0x0956('0x18')];this[_0x0956('0x19')]=_0xa48f53[_0x0956('0x19')];this[_0x0956('0x1a')]=_0xa48f53['freshsalesAccounts'];this[_0x0956('0x1b')]={'zendesk':this[_0x0956('0x11')],'salesforce':this[_0x0956('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x0956('0x15')],'desk':this[_0x0956('0x16')],'vtiger':this[_0x0956('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x0956('0x1a')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x0956('0x1c')]['bind'](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x0956('0x1d')](this));ami['on']('custom:agentringnoanswer',this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x1e'),this[_0x0956('0x1c')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x0956('0x1d')](this));ami['on'](_0x0956('0x1f'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on']('custom:agentbusy',this[_0x0956('0x1c')]['bind'](this));ami['on'](_0x0956('0x20'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x21'),this[_0x0956('0x1c')]['bind'](this));ami['on'](_0x0956('0x22'),this[_0x0956('0x1c')]['bind'](this));ami['on'](_0x0956('0x23'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x24'),this['syncCustomEvent'][_0x0956('0x1d')](this));ami['on']('custom:dialbegin',this[_0x0956('0x25')]['bind'](this));ami['on'](_0x0956('0x26'),this[_0x0956('0x25')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x27'),this[_0x0956('0x25')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x28'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x29'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x2a'),this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on'](_0x0956('0x2b'),this[_0x0956('0x1c')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0x0956('0x1c')][_0x0956('0x1d')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x0956('0x2c'),this[_0x0956('0x1c')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x0956('0x1c')][_0x0956('0x1d')](this));}Trigger['prototype'][_0x0956('0x2d')]=function(_0x5e3fd4,_0x41329d,_0x1af219){logger[_0x0956('0x2e')](_0x5e3fd4,_0x41329d,JSON[_0x0956('0x2f')](_0x1af219));io['to'](_0x5e3fd4)[_0x0956('0x2d')](_0x41329d,_0x1af219);};Trigger[_0x0956('0x30')][_0x0956('0x1c')]=function(_0xce58aa){var _0x80ce9b=_[_0x0956('0x31')](_0xce58aa);if(typeof _0x80ce9b['motionChannel']===_0x0956('0x32')){_0x80ce9b[_0x0956('0x33')]=_0x0956('0x34');}logger['debug'](_0x0956('0x1c'),util['inspect'](_0x80ce9b,{'showHidden':!![],'depth':null}));this[_0x0956('0x35')](_0x80ce9b);};Trigger[_0x0956('0x30')]['syncAgentDial']=function(_0x178c2){if(this[_0x0956('0xd')][_0x178c2[_0x0956('0x36')]]){this[_0x0956('0x1c')](_0x178c2);}};Trigger[_0x0956('0x30')][_0x0956('0x35')]=function(_0x4ad3b0){var _0x143f2a;for(var _0x4de56b in this[_0x0956('0xc')]){if(this[_0x0956('0xc')][_0x0956('0x37')](_0x4de56b)){if(this['triggers'][_0x4de56b]['status']){_0x143f2a=this[_0x0956('0x38')](this[_0x0956('0xc')][_0x4de56b],_0x4ad3b0);if(_0x143f2a){_[_0x0956('0x39')](_0x4ad3b0,_0x4ad3b0[_0x0956('0x3a')]);for(var _0x22033f=0x0,_0x3b2266,_0x4947d4,_0x488fbf;_0x22033f0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x3ac169,_0x260b11){var _0x238c12=function(_0x2026e5){while(--_0x2026e5){_0x3ac169['push'](_0x3ac169['shift']());}};_0x238c12(++_0x260b11);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 4e994a4..c2a17b1 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 _0xad97=['modernAuthentication','remoteUri','CloudProvider','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','userId','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','queue','/contacts(','callDirection','phonecalls','headers','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad97,0x67));var _0x7ad9=function(_0x467c92,_0x3e54b6){_0x467c92=_0x467c92-0x0;var _0x5c691c=_0xad97[_0x467c92];return _0x5c691c;};'use strict';var _=require('lodash');var rp=require(_0x7ad9('0x0'));var util=require(_0x7ad9('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x7ad9('0x2'))(_0x7ad9('0x3'));var config=require('../../../../config/environment');config['redis']=_[_0x7ad9('0x4')](config[_0x7ad9('0x5')],{'host':_0x7ad9('0x6'),'port':0x18eb});var io=require(_0x7ad9('0x7'))(new Redis(config['redis']));function getAuthToken(_0x22b91f,_0x2d31ef,_0x33129b){if(_0x22b91f[_0x7ad9('0x8')]){_0x22b91f[_0x7ad9('0x9')]=_0x22b91f[_0x7ad9('0xa')]['data7'];_0x22b91f[_0x7ad9('0xb')]=_0x22b91f[_0x7ad9('0xa')]['data2'];return Promise[_0x7ad9('0xc')](_0x22b91f[_0x7ad9('0xa')][_0x7ad9('0xd')]);}var _0x32d0f7={'method':_0x7ad9('0xe'),'uri':_0x2d31ef,'form':{'client_id':_0x22b91f[_0x7ad9('0xf')],'resource':_0x22b91f[_0x7ad9('0x9')],'username':_0x22b91f[_0x7ad9('0x10')],'password':_0x22b91f[_0x7ad9('0x11')],'grant_type':'password','client_secret':_0x22b91f[_0x7ad9('0x12')]},'json':!![]};return rp(_0x32d0f7)[_0x7ad9('0x13')](function(_0x1e991d){return _0x1e991d[_0x7ad9('0x14')];})[_0x7ad9('0x15')](function(_0x46585a){logger[_0x7ad9('0x16')]('['+[_0x33129b['toUpperCase']()]+_0x7ad9('0x17'));return _0x46585a[_0x7ad9('0x18')];});}function getUser(_0x4efdd0,_0x253385,_0x325a38,_0x4dc5f6,_0x105884,_0x3eab6e){return new Promise(function(_0x35ef70,_0x3826d1){return getAuthToken(_0x253385,_0x4dc5f6,_0x3eab6e)[_0x7ad9('0x13')](function(_0x32ddde){var _0x174020={'method':_0x7ad9('0x19'),'uri':_0x105884+_0x7ad9('0x1a'),'headers':{'Authorization':_0x7ad9('0x1b')+_0x32ddde,'OData-Version':_0x7ad9('0x1c')},'json':!![]};return rp(_0x174020);})['then'](function(_0x42dba6){var _0xfc4e3a=_0x42dba6[_0x7ad9('0x1d')];var _0x2ce6d9=![];var _0x19cdb9=null;if(!_[_0x7ad9('0x1e')](_0x325a38)){if(intUtil[_0x7ad9('0x1f')](_0x325a38[_0x7ad9('0x20')])){_0x4efdd0[_0x7ad9('0x21')]=_0x325a38[_0x7ad9('0x20')];for(_0x19cdb9=0x0;_0x19cdb9<_0xfc4e3a[_0x7ad9('0x22')];_0x19cdb9++){if(_0xfc4e3a[_0x19cdb9][_0x7ad9('0x23')]===_0x325a38[_0x7ad9('0x20')]&&!_0xfc4e3a[_0x19cdb9][_0x7ad9('0x24')]){_0x2ce6d9=!![];logger[_0x7ad9('0x25')]('['+[_0x3eab6e['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xfc4e3a[_0x19cdb9][_0x7ad9('0x26')]+'!');_0x4efdd0['userId']=_0xfc4e3a[_0x19cdb9][_0x7ad9('0x26')];}}}}if(!_0x2ce6d9){logger[_0x7ad9('0x25')]('['+[_0x3eab6e[_0x7ad9('0x27')]()]+_0x7ad9('0x28'));_0x4efdd0['userEmail']=_0x253385[_0x7ad9('0x10')];for(_0x19cdb9=0x0;_0x19cdb9<_0xfc4e3a[_0x7ad9('0x22')];_0x19cdb9++){if(_0xfc4e3a[_0x19cdb9][_0x7ad9('0x23')]===_0x253385[_0x7ad9('0x10')]){_0x4efdd0['userId']=_0xfc4e3a[_0x19cdb9]['systemuserid'];}}}_0x35ef70(_0x4efdd0);})[_0x7ad9('0x15')](function(_0x300c4a){_0x3826d1(_0x300c4a[_0x7ad9('0x18')]);});});}function createEndUser(_0x506477,_0x2bc97c,_0x4d2351,_0x23710d,_0x76de47,_0x3937ab,_0x42675b){return new Promise(function(_0x32b729,_0x16fe76){return getAuthToken(_0x2bc97c,_0x4d2351,_0x3937ab)[_0x7ad9('0x13')](function(_0x281bc1){var _0x2f90eb=_0x3937ab[_0x7ad9('0x29')]()===_0x7ad9('0x2a')?_0x76de47[_0x7ad9('0x2b')]:_0x76de47[_0x7ad9('0x2c')];var _0x1ff76d={'method':_0x7ad9('0xe'),'uri':_0x23710d+'contacts','body':{'fullname':_0x2f90eb,'firstname':_0x2f90eb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7ad9('0x2d')+_0x506477[_0x7ad9('0x2e')]+')'},'headers':{'Authorization':_0x7ad9('0x1b')+_0x281bc1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1ff76d['body'][_0x42675b]=_0x2f90eb;return rp(_0x1ff76d);})[_0x7ad9('0x13')](function(_0x21bb41){var _0x3108f6=_0x21bb41['headers'][_0x7ad9('0x2f')];var _0x2975a7=_0x3108f6[_0x7ad9('0x30')](_0x3108f6[_0x7ad9('0x31')]('(')+0x1,_0x3108f6[_0x7ad9('0x31')](')'));_0x506477[_0x7ad9('0x32')]=_0x2975a7;_0x32b729(_0x506477);})['catch'](function(_0x5e1fa0){_0x16fe76(_0x5e1fa0[_0x7ad9('0x18')]);});});}function getEndUser(_0x40831f,_0x1ca6b6,_0x257e77,_0x2ae1d3,_0x1021a2,_0x24b872,_0x4c976d,_0x580f83){var _0x9e255=_0x24b872[_0x7ad9('0x29')]()===_0x7ad9('0x2a')?_0x1021a2[_0x7ad9('0x2b')]:_0x1021a2[_0x7ad9('0x2c')];return getAuthToken(_0x1ca6b6,_0x257e77,_0x24b872)[_0x7ad9('0x13')](function(_0x559511){_0x580f83=_0x580f83?_0x580f83:_0x7ad9('0x33');var _0x31afb8={'method':_0x7ad9('0x19'),'uri':_0x2ae1d3+_0x7ad9('0x34')+_0x580f83+_0x7ad9('0x35')+_0x580f83+_0x7ad9('0x36')+_0x9e255[_0x7ad9('0x37')]('+',_0x7ad9('0x38'))+'\x27','headers':{'Authorization':_0x7ad9('0x1b')+_0x559511,'If-None-Match':null,'OData-Version':_0x7ad9('0x1c')},'json':!![]};return rp(_0x31afb8);})['then'](function(_0x5d7bef){var _0x2ba01e=![];if(!_0x5d7bef)return _0x2ba01e;var _0x76a183=_0x5d7bef[_0x7ad9('0x1d')];for(var _0x3984f1=0x0;_0x3984f1<_0x76a183[_0x7ad9('0x22')];_0x3984f1++){if(_0x76a183[_0x3984f1][_0x580f83]===_0x9e255){_0x2ba01e=!![];_0x40831f[_0x7ad9('0x32')]=_0x76a183[_0x3984f1][_0x7ad9('0x39')];}}return _0x2ba01e;})[_0x7ad9('0x13')](function(_0x4152ed){if(_0x4152ed)return _0x40831f;if(_0x4c976d===_0x7ad9('0x3a')){logger[_0x7ad9('0x25')]('['+[_0x24b872['toUpperCase']()]+_0x7ad9('0x3b'));return _0x40831f;}return createEndUser(_0x40831f,_0x1ca6b6,_0x257e77,_0x2ae1d3,_0x1021a2,_0x24b872,_0x580f83)['then'](function(_0x59f20){logger[_0x7ad9('0x25')]('['+[_0x24b872[_0x7ad9('0x27')]()]+']\x20Enduser\x20created!',_0x59f20[_0x7ad9('0x32')]);return _0x59f20;});});}function getCustomFields(_0x5c5fdb,_0x4a664d,_0x1368c0){var _0x289376={};if(_0x5c5fdb[_0x7ad9('0x22')]>0x0){_[_0x7ad9('0x3c')](_0x5c5fdb,function(_0xf12700){if(_[_0x7ad9('0x3d')]([_0x7ad9('0x3e'),_0x7ad9('0x3f')],_0xf12700['type'])&&_0xf12700[_0x7ad9('0x40')]&&!_0xf12700[_0x7ad9('0x41')]){var _0x1eb20a=_0xf12700[_0x7ad9('0x42')][_0x7ad9('0x29')]();var _0x4457d1=_0x1eb20a[_0x7ad9('0x30')](0x0,_0x1eb20a[_0x7ad9('0x43')]('_'));var _0x5c6f79=_0x1eb20a[_0x7ad9('0x30')](_0x1eb20a[_0x7ad9('0x43')]('_')+0x1);if(_0x4457d1===_0x1368c0){_0x289376[_0x5c6f79]=_0xf12700[_0x7ad9('0x44')];}}});}return _0x289376;}function getTicket(_0x2fcedb,_0x4e1f0d,_0x37606e,_0x377f39,_0x2acb79,_0x135e23,_0x4bf918){return new Promise(function(_0x1d45d1,_0x5e16e4){var _0x4c38aa;return getAuthToken(_0x4e1f0d,_0x37606e,_0x4bf918)['then'](function(_0x3d8d7d){if(_0x135e23[_0x7ad9('0x45')]===_0x7ad9('0x46')){_0x4c38aa={'method':_0x7ad9('0xe'),'uri':_0x377f39+_0x7ad9('0x47'),'body':Object[_0x7ad9('0x48')]({},{'title':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4a')],_0x2acb79,'\x20'),'description':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4b')],_0x2acb79,'\x0a'),'customerid_contact@odata.bind':_0x2fcedb[_0x7ad9('0x32')]?'/contacts('+_0x2fcedb[_0x7ad9('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','caseorigincode':'1'},getCustomFields(_0x135e23[_0x7ad9('0x4c')],_0x2acb79,_0x135e23[_0x7ad9('0x45')])),'headers':{'Authorization':_0x7ad9('0x1b')+_0x3d8d7d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x135e23[_0x7ad9('0x45')]===_0x7ad9('0x4d')){var _0x381fb0=_0x2fcedb['enduserId']?[{'partyid_systemuser@odata.bind':_0x7ad9('0x2d')+_0x2fcedb[_0x7ad9('0x2e')]+')','participationtypemask':_0x2fcedb['callDirection']===_0x7ad9('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x7ad9('0x4f')+_0x2fcedb[_0x7ad9('0x32')]+')','participationtypemask':_0x2fcedb['callDirection']===_0x7ad9('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','participationtypemask':_0x2fcedb[_0x7ad9('0x50')]===_0x7ad9('0x4e')?0x2:0x1}];_0x4c38aa={'method':_0x7ad9('0xe'),'uri':_0x377f39+_0x7ad9('0x51'),'body':Object[_0x7ad9('0x48')]({},{'subject':intUtil['getString'](_0x135e23['Subjects'],_0x2acb79,'\x20'),'phonenumber':String(_0x2acb79['calleridnum']),'description':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4b')],_0x2acb79,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2fcedb[_0x7ad9('0x32')]?_0x7ad9('0x4f')+_0x2fcedb[_0x7ad9('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','directioncode':_0x2fcedb[_0x7ad9('0x50')]===_0x7ad9('0x4e')?![]:!![],'phonecall_activity_parties':_0x381fb0},getCustomFields(_0x135e23[_0x7ad9('0x4c')],_0x2acb79,_0x135e23[_0x7ad9('0x45')])),'headers':{'Authorization':_0x7ad9('0x1b')+_0x3d8d7d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4c38aa);})[_0x7ad9('0x13')](function(_0x5d9e16){var _0x246fa1=_0x5d9e16[_0x7ad9('0x52')][_0x7ad9('0x2f')];var _0x6841f2=_0x246fa1[_0x7ad9('0x30')](_0x246fa1[_0x7ad9('0x31')]('(')+0x1,_0x246fa1[_0x7ad9('0x31')](')'));_0x2fcedb['ticketId']=_0x6841f2;_0x1d45d1(_0x2fcedb);})[_0x7ad9('0x15')](function(_0x5dfa6e){_0x5e16e4(_0x5dfa6e[_0x7ad9('0x18')]);});});}function emit(_0x27c3a9,_0x2b0696,_0x554a98,_0x3f894b){var _0x380465={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x27c3a9,_0x554a98,_0x3f894b)};io['to'](util['format'](_0x7ad9('0x53'),_0x2b0696))[_0x7ad9('0x54')](_0x7ad9('0x55'),_0x380465);}exports['cs']=function(_0x1085d6,_0x233b9b,_0x5298ee,_0xfb9c5e,_0x1ceca0,_0x19c38f,_0x1978cc,_0xe15316){var _0x239d39={};_0x19c38f['remoteUri']=_0x19c38f[_0x7ad9('0x8')]?intUtil[_0x7ad9('0x56')](_0x19c38f['CloudProvider'][_0x7ad9('0x57')]):intUtil[_0x7ad9('0x56')](_0x19c38f[_0x7ad9('0x9')]);_0x19c38f[_0x7ad9('0x58')]=intUtil['stripTrailingSlash'](_0x19c38f[_0x7ad9('0x58')]);_0x239d39['callDirection']=_0xe15316===_0x7ad9('0x4e')||_0xe15316==='unmanaged'?'queue':_0x7ad9('0x2a');var _0x2af3a3=_0x19c38f[_0x7ad9('0x8')]?util[_0x7ad9('0x59')](_0x7ad9('0x5a'),_0x19c38f[_0x7ad9('0xa')][_0x7ad9('0x57')]):util[_0x7ad9('0x59')](_0x7ad9('0x5a'),_0x19c38f[_0x7ad9('0x9')]);var _0x30034e=util[_0x7ad9('0x59')](_0x7ad9('0x5b'),_0x19c38f[_0x7ad9('0xb')]);var _0xf4cec0=util[_0x7ad9('0x59')](_0x7ad9('0x5c'),_0x19c38f[_0x7ad9('0x58')],_0x233b9b['uniqueid'],md5(_0x233b9b[_0x7ad9('0x5d')]));if(_0x1ceca0&&_0x1ceca0['monitor_format']){logger[_0x7ad9('0x25')](_0x7ad9('0x5e'),_0x7ad9('0x5f'));_0x233b9b[_0x7ad9('0x60')]=_0xf4cec0;}else if(_0x1978cc&&_0x1978cc[_0x7ad9('0x61')]&&_0x1978cc['recordingFormat']!==_0x7ad9('0x62')){logger[_0x7ad9('0x25')](_0x7ad9('0x63'),'Recording\x20is\x20enabled!');_0x233b9b[_0x7ad9('0x60')]=_0xf4cec0;}else{_0x233b9b['recordingURL']='';}return getUser(_0x239d39,_0x19c38f,_0xfb9c5e,_0x30034e,_0x2af3a3,_0xe15316)['then'](function(_0x3fd715){logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x64'),_0x3fd715[_0x7ad9('0x2e')]);logger['info']('['+_0xe15316[_0x7ad9('0x27')]()+']\x20The\x20User\x20email\x20is:',_0x3fd715['userEmail']);return getEndUser(_0x3fd715,_0x19c38f,_0x30034e,_0x2af3a3,_0x233b9b,_0xe15316,_0x5298ee['moduleCreate'],_0x5298ee[_0x7ad9('0x65')]);})[_0x7ad9('0x13')](function(_0x37f5c0){logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x66'),_0x37f5c0[_0x7ad9('0x32')]);logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x67'),_0x233b9b[_0x7ad9('0x2c')]);return getTicket(_0x37f5c0,_0x19c38f,_0x30034e,_0x2af3a3,_0x233b9b,_0x5298ee,_0xe15316);})[_0x7ad9('0x13')](function(_0x51a9fe){logger[_0x7ad9('0x25')](util[_0x7ad9('0x59')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x68'),_0x5298ee[_0x7ad9('0x45')],_0x51a9fe[_0x7ad9('0x69')]));logger['info'](util[_0x7ad9('0x59')]('['+_0xe15316[_0x7ad9('0x27')]()+']\x20Call\x20direction:\x20%s',_0xe15316));if(_0xe15316!=='unmanaged'&&_0x5298ee[_0x7ad9('0x6a')]){logger['info']('['+_0xe15316[_0x7ad9('0x27')]()+']',_0x7ad9('0x6b'));emit(_0x19c38f['remoteUri'],_0xfb9c5e[_0x7ad9('0x6c')],_0x5298ee[_0x7ad9('0x45')],_0x51a9fe[_0x7ad9('0x69')]);}})[_0x7ad9('0x15')](function(_0x8b1311){logger[_0x7ad9('0x16')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x6d'),_0x8b1311[_0x7ad9('0x18')]);console[_0x7ad9('0x16')](_0x7ad9('0x6e'),_0x8b1311);});}; \ No newline at end of file +var _0x9cc2=['user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','format','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','data5','POST','username','then','access_token','catch','error','message','GET','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','/systemusers(','body','substring','lastIndexOf','enduserId','\x20eq\x20\x27','replace','%2b','length','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','customField','idField','indexOf','content','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','phonecalls','headers','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s'];(function(_0x202e6c,_0xb884e1){var _0x342cb0=function(_0x3c385b){while(--_0x3c385b){_0x202e6c['push'](_0x202e6c['shift']());}};_0x342cb0(++_0xb884e1);}(_0x9cc2,0x1bc));var _0x29cc=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9cc2[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x29cc('0x0'));var rp=require(_0x29cc('0x1'));var util=require(_0x29cc('0x2'));var intUtil=require(_0x29cc('0x3'));var md5=require('md5');var Redis=require(_0x29cc('0x4'));var logger=require(_0x29cc('0x5'))('dynamics365');var config=require(_0x29cc('0x6'));config[_0x29cc('0x7')]=_['defaults'](config[_0x29cc('0x7')],{'host':_0x29cc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29cc('0x7')]));function getAuthToken(_0x402b86,_0x47e4dd,_0x5e6e64){if(_0x402b86[_0x29cc('0x9')]){_0x402b86[_0x29cc('0xa')]=_0x402b86['CloudProvider'][_0x29cc('0xb')];_0x402b86[_0x29cc('0xc')]=_0x402b86[_0x29cc('0xd')]['data2'];return Promise[_0x29cc('0xe')](_0x402b86['CloudProvider'][_0x29cc('0xf')]);}var _0x436df0={'method':_0x29cc('0x10'),'uri':_0x47e4dd,'form':{'client_id':_0x402b86['clientId'],'resource':_0x402b86[_0x29cc('0xa')],'username':_0x402b86[_0x29cc('0x11')],'password':_0x402b86['password'],'grant_type':'password','client_secret':_0x402b86['clientSecret']},'json':!![]};return rp(_0x436df0)[_0x29cc('0x12')](function(_0xc9bdf){return _0xc9bdf[_0x29cc('0x13')];})[_0x29cc('0x14')](function(_0xd90418){logger[_0x29cc('0x15')]('['+[_0x5e6e64['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xd90418[_0x29cc('0x16')];});}function getUser(_0x50d448,_0x2eceed,_0x2622c9,_0x1a67a3,_0x3795a2,_0x281c07){return new Promise(function(_0x2de853,_0x8a85){return getAuthToken(_0x2eceed,_0x1a67a3,_0x281c07)[_0x29cc('0x12')](function(_0x2526fa){var _0x201c12={'method':_0x29cc('0x17'),'uri':_0x3795a2+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x29cc('0x18')+_0x2526fa,'OData-Version':_0x29cc('0x19')},'json':!![]};return rp(_0x201c12);})[_0x29cc('0x12')](function(_0x353c90){var _0x5b646f=_0x353c90[_0x29cc('0x1a')];var _0x16210b=![];var _0x8d6249=null;if(!_[_0x29cc('0x1b')](_0x2622c9)){if(intUtil['validateEmail'](_0x2622c9[_0x29cc('0x1c')])){_0x50d448[_0x29cc('0x1d')]=_0x2622c9[_0x29cc('0x1c')];for(_0x8d6249=0x0;_0x8d6249<_0x5b646f['length'];_0x8d6249++){if(_0x5b646f[_0x8d6249][_0x29cc('0x1e')]===_0x2622c9['email']&&!_0x5b646f[_0x8d6249][_0x29cc('0x1f')]){_0x16210b=!![];logger['info']('['+[_0x281c07[_0x29cc('0x20')]()]+_0x29cc('0x21')+_0x5b646f[_0x8d6249][_0x29cc('0x22')]+'!');_0x50d448[_0x29cc('0x23')]=_0x5b646f[_0x8d6249]['systemuserid'];}}}}if(!_0x16210b){logger[_0x29cc('0x24')]('['+[_0x281c07[_0x29cc('0x20')]()]+_0x29cc('0x25'));_0x50d448[_0x29cc('0x1d')]=_0x2eceed[_0x29cc('0x11')];for(_0x8d6249=0x0;_0x8d6249<_0x5b646f['length'];_0x8d6249++){if(_0x5b646f[_0x8d6249][_0x29cc('0x1e')]===_0x2eceed[_0x29cc('0x11')]){_0x50d448['userId']=_0x5b646f[_0x8d6249][_0x29cc('0x22')];}}}_0x2de853(_0x50d448);})[_0x29cc('0x14')](function(_0xf6d539){_0x8a85(_0xf6d539[_0x29cc('0x16')]);});});}function createEndUser(_0x3b880c,_0x1389b8,_0x3ac12d,_0x391c56,_0xbeb895,_0x4510cf,_0x2de132){return new Promise(function(_0x336390,_0x1d7a39){return getAuthToken(_0x1389b8,_0x3ac12d,_0x4510cf)[_0x29cc('0x12')](function(_0x501b15){var _0x194e4d=_0x4510cf[_0x29cc('0x26')]()==='outbound'?_0xbeb895[_0x29cc('0x27')]:_0xbeb895[_0x29cc('0x28')];var _0x204ce0={'method':_0x29cc('0x10'),'uri':_0x391c56+'contacts','body':{'fullname':_0x194e4d,'firstname':_0x194e4d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x29cc('0x29')+_0x3b880c[_0x29cc('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x501b15,'OData-Version':_0x29cc('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x204ce0[_0x29cc('0x2a')][_0x2de132]=_0x194e4d;return rp(_0x204ce0);})['then'](function(_0x23826f){var _0x10ae50=_0x23826f['headers']['odata-entityid'];var _0x54d1d8=_0x10ae50[_0x29cc('0x2b')](_0x10ae50[_0x29cc('0x2c')]('(')+0x1,_0x10ae50[_0x29cc('0x2c')](')'));_0x3b880c[_0x29cc('0x2d')]=_0x54d1d8;_0x336390(_0x3b880c);})[_0x29cc('0x14')](function(_0xad7d35){_0x1d7a39(_0xad7d35[_0x29cc('0x16')]);});});}function getEndUser(_0x43f6be,_0x4f0d00,_0x151c0d,_0x423238,_0x3a0109,_0x54ad32,_0x369333,_0x59fe0c){var _0x158d48=_0x54ad32[_0x29cc('0x26')]()==='outbound'?_0x3a0109[_0x29cc('0x27')]:_0x3a0109[_0x29cc('0x28')];return getAuthToken(_0x4f0d00,_0x151c0d,_0x54ad32)[_0x29cc('0x12')](function(_0xfb50b1){_0x59fe0c=_0x59fe0c?_0x59fe0c:'telephone1';var _0x331a0e={'method':_0x29cc('0x17'),'uri':_0x423238+'contacts?$select='+_0x59fe0c+'&$filter='+_0x59fe0c+_0x29cc('0x2e')+_0x158d48[_0x29cc('0x2f')]('+',_0x29cc('0x30'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xfb50b1,'If-None-Match':null,'OData-Version':_0x29cc('0x19')},'json':!![]};return rp(_0x331a0e);})[_0x29cc('0x12')](function(_0xd4bcaa){var _0x3da6c6=![];if(!_0xd4bcaa)return _0x3da6c6;var _0x156f0e=_0xd4bcaa['value'];for(var _0x56e8c0=0x0;_0x56e8c0<_0x156f0e[_0x29cc('0x31')];_0x56e8c0++){if(_0x156f0e[_0x56e8c0][_0x59fe0c]===_0x158d48){_0x3da6c6=!![];_0x43f6be['enduserId']=_0x156f0e[_0x56e8c0][_0x29cc('0x32')];}}return _0x3da6c6;})[_0x29cc('0x12')](function(_0x1c3c69){if(_0x1c3c69)return _0x43f6be;if(_0x369333==='nothing'){logger['info']('['+[_0x54ad32['toUpperCase']()]+_0x29cc('0x33'));return _0x43f6be;}return createEndUser(_0x43f6be,_0x4f0d00,_0x151c0d,_0x423238,_0x3a0109,_0x54ad32,_0x59fe0c)['then'](function(_0x1a61ea){logger[_0x29cc('0x24')]('['+[_0x54ad32[_0x29cc('0x20')]()]+_0x29cc('0x34'),_0x1a61ea[_0x29cc('0x2d')]);return _0x1a61ea;});});}function getCustomFields(_0x317aea,_0x3a2cf2,_0x1232db){var _0x29f5c2={};if(_0x317aea['length']>0x0){_['forEach'](_0x317aea,function(_0x1de8a7){if(_[_0x29cc('0x35')]([_0x29cc('0x36'),_0x29cc('0x37')],_0x1de8a7[_0x29cc('0x38')])&&_0x1de8a7[_0x29cc('0x39')]&&!_0x1de8a7[_0x29cc('0x3a')]){var _0x4a66c7=_0x1de8a7[_0x29cc('0x3b')]['toLowerCase']();var _0x3878cb=_0x4a66c7[_0x29cc('0x2b')](0x0,_0x4a66c7[_0x29cc('0x3c')]('_'));var _0x25c8cc=_0x4a66c7[_0x29cc('0x2b')](_0x4a66c7['indexOf']('_')+0x1);if(_0x3878cb===_0x1232db){_0x29f5c2[_0x25c8cc]=_0x1de8a7[_0x29cc('0x3d')];}}});}return _0x29f5c2;}function getTicket(_0x36ffc0,_0x103bc3,_0x4fbb83,_0x15fff7,_0x43681b,_0x769f9e,_0x58ce7c){return new Promise(function(_0x34e949,_0x1da51){var _0x39f152;return getAuthToken(_0x103bc3,_0x4fbb83,_0x58ce7c)['then'](function(_0x473744){if(_0x769f9e['ticketType']==='incident'){_0x39f152={'method':_0x29cc('0x10'),'uri':_0x15fff7+'incidents','body':Object[_0x29cc('0x3e')]({},{'title':intUtil[_0x29cc('0x3f')](_0x769f9e[_0x29cc('0x40')],_0x43681b,'\x20'),'description':intUtil[_0x29cc('0x3f')](_0x769f9e[_0x29cc('0x41')],_0x43681b,'\x0a'),'customerid_contact@odata.bind':_0x36ffc0[_0x29cc('0x2d')]?_0x29cc('0x42')+_0x36ffc0[_0x29cc('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x36ffc0[_0x29cc('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x769f9e[_0x29cc('0x43')],_0x43681b,_0x769f9e[_0x29cc('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x473744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x769f9e[_0x29cc('0x44')]===_0x29cc('0x45')){var _0x5bd73b=_0x36ffc0['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x36ffc0[_0x29cc('0x23')]+')','participationtypemask':_0x36ffc0['callDirection']===_0x29cc('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x29cc('0x42')+_0x36ffc0['enduserId']+')','participationtypemask':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x29cc('0x29')+_0x36ffc0[_0x29cc('0x23')]+')','participationtypemask':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?0x2:0x1}];_0x39f152={'method':'POST','uri':_0x15fff7+_0x29cc('0x48'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x769f9e[_0x29cc('0x40')],_0x43681b,'\x20'),'phonenumber':String(_0x43681b[_0x29cc('0x28')]),'description':intUtil['getString'](_0x769f9e[_0x29cc('0x41')],_0x43681b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x36ffc0[_0x29cc('0x2d')]?_0x29cc('0x42')+_0x36ffc0[_0x29cc('0x2d')]+')':undefined,'ownerid@odata.bind':_0x29cc('0x29')+_0x36ffc0[_0x29cc('0x23')]+')','directioncode':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?![]:!![],'phonecall_activity_parties':_0x5bd73b},getCustomFields(_0x769f9e[_0x29cc('0x43')],_0x43681b,_0x769f9e[_0x29cc('0x44')])),'headers':{'Authorization':_0x29cc('0x18')+_0x473744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39f152);})[_0x29cc('0x12')](function(_0x54ec79){var _0x27cddf=_0x54ec79[_0x29cc('0x49')][_0x29cc('0x4a')];var _0x157b36=_0x27cddf[_0x29cc('0x2b')](_0x27cddf['lastIndexOf']('(')+0x1,_0x27cddf[_0x29cc('0x2c')](')'));_0x36ffc0['ticketId']=_0x157b36;_0x34e949(_0x36ffc0);})[_0x29cc('0x14')](function(_0x2e8e05){_0x1da51(_0x2e8e05[_0x29cc('0x16')]);});});}function emit(_0x509ec9,_0x1f9799,_0x567576,_0x43bb33){var _0x6fd142={'uri':util['format'](_0x29cc('0x4b'),_0x509ec9,_0x567576,_0x43bb33)};io['to'](util['format'](_0x29cc('0x4c'),_0x1f9799))[_0x29cc('0x4d')](_0x29cc('0x4e'),_0x6fd142);}exports['cs']=function(_0x3e56f,_0x98ffd0,_0x4e1770,_0x1339f0,_0x2e264f,_0x19ea29,_0x21c0ef,_0x40a9b2){var _0x2b38cc={};_0x19ea29[_0x29cc('0xa')]=_0x19ea29[_0x29cc('0x9')]?intUtil[_0x29cc('0x4f')](_0x19ea29['CloudProvider'][_0x29cc('0xb')]):intUtil[_0x29cc('0x4f')](_0x19ea29[_0x29cc('0xa')]);_0x19ea29[_0x29cc('0x50')]=intUtil[_0x29cc('0x4f')](_0x19ea29['serverUrl']);_0x2b38cc[_0x29cc('0x47')]=_0x40a9b2===_0x29cc('0x46')||_0x40a9b2===_0x29cc('0x51')?'queue':_0x29cc('0x52');var _0x295f93=_0x19ea29['modernAuthentication']?util['format'](_0x29cc('0x53'),_0x19ea29[_0x29cc('0xd')][_0x29cc('0xb')]):util[_0x29cc('0x54')](_0x29cc('0x53'),_0x19ea29[_0x29cc('0xa')]);var _0x5c8090=util[_0x29cc('0x54')](_0x29cc('0x55'),_0x19ea29[_0x29cc('0xc')]);var _0x11ae7e=util[_0x29cc('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19ea29[_0x29cc('0x50')],_0x98ffd0[_0x29cc('0x56')],md5(_0x98ffd0['uniqueid']));if(_0x2e264f&&_0x2e264f['monitor_format']){logger[_0x29cc('0x24')](_0x29cc('0x57'),_0x29cc('0x58'));_0x98ffd0['recordingURL']=_0x11ae7e;}else if(_0x21c0ef&&_0x21c0ef[_0x29cc('0x59')]&&_0x21c0ef[_0x29cc('0x59')]!==_0x29cc('0x5a')){logger[_0x29cc('0x24')](_0x29cc('0x5b'),_0x29cc('0x58'));_0x98ffd0['recordingURL']=_0x11ae7e;}else{_0x98ffd0[_0x29cc('0x5c')]='';}return getUser(_0x2b38cc,_0x19ea29,_0x1339f0,_0x5c8090,_0x295f93,_0x40a9b2)[_0x29cc('0x12')](function(_0x5a8a17){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x5d'),_0x5a8a17[_0x29cc('0x23')]);logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x5e'),_0x5a8a17['userEmail']);return getEndUser(_0x5a8a17,_0x19ea29,_0x5c8090,_0x295f93,_0x98ffd0,_0x40a9b2,_0x4e1770[_0x29cc('0x5f')],_0x4e1770['additionalSearchContact']);})['then'](function(_0x2171ae){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x60'),_0x2171ae[_0x29cc('0x2d')]);logger['info']('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x61'),_0x98ffd0[_0x29cc('0x28')]);return getTicket(_0x2171ae,_0x19ea29,_0x5c8090,_0x295f93,_0x98ffd0,_0x4e1770,_0x40a9b2);})['then'](function(_0x5b4172){logger[_0x29cc('0x24')](util[_0x29cc('0x54')]('['+_0x40a9b2[_0x29cc('0x20')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4e1770[_0x29cc('0x44')],_0x5b4172[_0x29cc('0x62')]));logger[_0x29cc('0x24')](util[_0x29cc('0x54')]('['+_0x40a9b2['toUpperCase']()+_0x29cc('0x63'),_0x40a9b2));if(_0x40a9b2!=='unmanaged'&&_0x4e1770['openNewTab']){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+']',_0x29cc('0x64'));emit(_0x19ea29[_0x29cc('0xa')],_0x1339f0[_0x29cc('0x65')],_0x4e1770['ticketType'],_0x5b4172[_0x29cc('0x62')]);}})[_0x29cc('0x14')](function(_0x4614e0){logger[_0x29cc('0x15')]('['+_0x40a9b2['toUpperCase']()+_0x29cc('0x66'),_0x4614e0[_0x29cc('0x16')]);console[_0x29cc('0x15')](_0x29cc('0x67'),_0x4614e0);});}; \ 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 7b8bc1c..db98d45 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 _0xcec8=['destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','calleridname','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','toString','base64','debug','stringify','defaults','map','includes','string','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname'];(function(_0x309fb3,_0x1614e1){var _0x582a21=function(_0x298e18){while(--_0x298e18){_0x309fb3['push'](_0x309fb3['shift']());}};_0x582a21(++_0x1614e1);}(_0xcec8,0xba));var _0x8cec=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0xcec8[_0x289891];return _0x31cf2e;};'use strict';var _=require(_0x8cec('0x0'));var rp=require(_0x8cec('0x1'));var md5=require(_0x8cec('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8cec('0x3'));var config=require(_0x8cec('0x4'));var logger=require(_0x8cec('0x5'))(_0x8cec('0x6'));config[_0x8cec('0x7')]=_['defaults'](config['redis'],{'host':_0x8cec('0x8'),'port':0x18eb});var io=require(_0x8cec('0x9'))(new Redis(config[_0x8cec('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xb0942e,_0x3bd231,_0xf81390){io['to'](_0xb0942e)[_0x8cec('0xa')](_0x3bd231,_0xf81390);}function getTicket(_0x6a0c1e,_0x13d5cd,_0x2ec031,_0x3cefe8,_0x129237){logger[_0x8cec('0xb')](_0x8cec('0xc'));var _0x34178f=_[_0x8cec('0xd')]({'responder_id':_0x13d5cd['id'],'requester_id':_0x2ec031['id'],'name':util['format'](_0x8cec('0xe'),_0x129237['calleridname']),'phone':_0x129237[_0x8cec('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8cec('0x10')](_0x3cefe8[_0x8cec('0x11')],_0x129237,'\x20'),'description':intUtil[_0x8cec('0x10')](_0x3cefe8['Descriptions'],_0x129237,_0x8cec('0x12')),'tags':getTags(_0x3cefe8[_0x8cec('0x13')],_0x8cec('0x14'))},getCustomFields(_0x3cefe8[_0x8cec('0x15')],_0x129237));_0x34178f[_0x8cec('0x16')]=_[_0x8cec('0x17')](_['keyBy'](_0x34178f[_0x8cec('0x16')],'id'),_0x8cec('0x18'));return request({'uri':util['format'](_0x8cec('0x19'),_0x6a0c1e[_0x8cec('0x1a')]),'method':_0x8cec('0x1b'),'body':_0x34178f})[_0x8cec('0x1c')](function(_0x1b09a){logger[_0x8cec('0xb')](_0x8cec('0x1d'));return _0x1b09a;});}function getUser(_0x1c254e,_0x437536){if(intUtil[_0x8cec('0x1e')](_0x437536)){return request({'uri':util['format'](_0x8cec('0x1f'),_0x1c254e[_0x8cec('0x1a')]),'qs':{'email':_0x437536}})['then'](function(_0xafe076){if(_0xafe076[_0x8cec('0x20')]){logger[_0x8cec('0xb')]('Agent\x20found!');return _[_0x8cec('0x21')](_0xafe076,function(_0x208a59){return _0x208a59[_0x8cec('0x22')][_0x8cec('0x23')]===_0x437536;});}else{logger[_0x8cec('0xb')](_0x8cec('0x24'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x26'),_0x1c254e['remoteUri'])})[_0x8cec('0x1c')](function(_0x52d9af){logger['info'](_0x8cec('0x27'));return _0x52d9af;});}});}else{logger[_0x8cec('0xb')](_0x8cec('0x28'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x26'),_0x1c254e['remoteUri'])})['then'](function(_0x5bef36){logger[_0x8cec('0xb')](_0x8cec('0x27'));return _0x5bef36;});}}function getEndUser(_0x5ba58d,_0x66828b,_0x143d7d){logger[_0x8cec('0xb')](_0x8cec('0x29'),_0x143d7d);return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x2a'),_0x5ba58d[_0x8cec('0x1a')]),'qs':{'phone':_0x143d7d}})[_0x8cec('0x1c')](function(_0x4e36fd){if(_0x4e36fd[_0x8cec('0x20')]){logger['info'](_0x8cec('0x2b'));return _[_0x8cec('0x21')](_0x4e36fd,{'phone':_0x143d7d});}else{logger[_0x8cec('0xb')](_0x8cec('0x2c'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x2a'),_0x5ba58d[_0x8cec('0x1a')]),'method':_0x8cec('0x1b'),'body':{'name':_0x66828b,'phone':_0x143d7d}})[_0x8cec('0x1c')](function(_0x221d28){logger['info']('Enduser\x20created.');return _0x221d28;});}});}function getAuth(_0x4a0953){return util[_0x8cec('0x25')]('Basic\x20%s',new Buffer(_0x4a0953[_0x8cec('0x2d')]+':X')[_0x8cec('0x2e')](_0x8cec('0x2f')));}function request(_0x136963){logger[_0x8cec('0x30')]('[HTTP]',JSON[_0x8cec('0x31')](_0x136963));return rp(_[_0x8cec('0x32')](_0x136963,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x42ae43,_0x286b08){var _0x4970fe=[];if(_0x42ae43&&_0x42ae43['length']>0x0){_0x4970fe=_[_0x8cec('0x33')](_0x42ae43,_0x286b08);}return _0x4970fe;}function getCustomFields(_0x44d047,_0x3cffb3){var _0x4356bf=[];var _0x4eed9c={'custom_fields':[]};if(_0x44d047[_0x8cec('0x20')]>0x0){_['forEach'](_0x44d047,function(_0x1acc49){if(_[_0x8cec('0x34')]([_0x8cec('0x35'),'picklist'],_0x1acc49[_0x8cec('0x36')])&&_0x1acc49[_0x8cec('0x37')]&&!_0x1acc49[_0x8cec('0x38')]){_0x4eed9c[_0x1acc49[_0x8cec('0x37')][_0x8cec('0x39')]()]=_0x1acc49[_0x8cec('0x3a')][_0x8cec('0x2e')]();}else if(_[_0x8cec('0x34')]([_0x8cec('0x35'),'picklist'],_0x1acc49['type'])&&_0x1acc49[_0x8cec('0x3b')]&&_0x1acc49[_0x8cec('0x38')]){_0x4eed9c[_0x8cec('0x16')][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x1acc49['content'][_0x8cec('0x2e')]()});}else if(_0x1acc49[_0x8cec('0x36')]===_0x8cec('0x3d')&&_0x1acc49['variableName']&&_0x1acc49[_0x8cec('0x3b')]&&_0x1acc49[_0x8cec('0x38')]){_0x3cffb3[_0x1acc49[_0x8cec('0x3e')]]&&_0x4eed9c['custom_fields'][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x3cffb3[_0x1acc49['variableName']][_0x8cec('0x2e')]()});}else if(_0x1acc49[_0x8cec('0x36')]==='customVariable'&&_0x1acc49[_0x8cec('0x3f')]&&_0x1acc49['Variable'][_0x8cec('0x14')]&&_0x1acc49['idField']&&_0x1acc49[_0x8cec('0x38')]){_0x3cffb3[_0x1acc49[_0x8cec('0x3f')][_0x8cec('0x14')]['toLowerCase']()]&&_0x4eed9c['custom_fields'][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x3cffb3[_0x1acc49['Variable'][_0x8cec('0x14')][_0x8cec('0x39')]()][_0x8cec('0x2e')]()});}});}return _0x4eed9c;}exports[_0x8cec('0x40')]=function(_0x4f16f5,_0x5dbde1,_0x4ae9b9,_0x21a4fe,_0x326a4f,_0x2f5e63){var _0x4053e2,_0x15b0b7;_0x2f5e63['remoteUri']=intUtil['stripTrailingSlash'](_0x2f5e63[_0x8cec('0x1a')]);_0x2f5e63[_0x8cec('0x41')]=intUtil['stripTrailingSlash'](_0x2f5e63['serverUrl']);if(_0x326a4f&&_0x326a4f['monitor_format']){logger[_0x8cec('0xb')]('[QUEUE]',_0x8cec('0x42'));_0x5dbde1['recordingURL']=util['format'](_0x8cec('0x43'),_0x2f5e63[_0x8cec('0x41')],_0x5dbde1[_0x8cec('0x44')],md5(_0x5dbde1[_0x8cec('0x44')]));}else{_0x5dbde1[_0x8cec('0x45')]='';}headers[_0x8cec('0x46')]=getAuth(_0x2f5e63);return getUser(_0x2f5e63,_0x21a4fe[_0x8cec('0x23')])['then'](function(_0x1d7ef6){_0x4053e2=_0x1d7ef6;logger[_0x8cec('0xb')]('The\x20User\x20ID\x20is:',_0x4053e2['id']);return getEndUser(_0x2f5e63,_0x5dbde1['calleridname'],_0x5dbde1['calleridnum']);})['then'](function(_0x5f4b10){_0x15b0b7=_0x5f4b10;logger[_0x8cec('0xb')](_0x8cec('0x47'),_0x15b0b7['id']);return getTicket(_0x2f5e63,_0x4053e2,_0x15b0b7,_0x4ae9b9,_0x5dbde1);})[_0x8cec('0x1c')](function(_0x277936){if(_0x277936&&_0x277936['id']){logger[_0x8cec('0xb')](_0x8cec('0x1d'));logger[_0x8cec('0xb')]('The\x20Ticket\x20ID\x20is:',_0x277936['id']);logger[_0x8cec('0xb')](_0x8cec('0x48'),_0x8cec('0x49'));emit(util[_0x8cec('0x25')](_0x8cec('0x4a'),_0x21a4fe[_0x8cec('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2f5e63[_0x8cec('0x1a')],_0x277936['id'])});}})[_0x8cec('0x4b')](function(_0x19e817){logger[_0x8cec('0x4c')](_0x8cec('0x48'),JSON['stringify'](_0x19e817));});};exports[_0x8cec('0x4d')]=function(_0x53917b,_0x54da53,_0x1e1d3c,_0x5edc77,_0x43a6b5,_0x1761f3,_0x300928){var _0x4aa8b8,_0x2219d5;_0x1761f3[_0x8cec('0x1a')]=intUtil[_0x8cec('0x4e')](_0x1761f3[_0x8cec('0x1a')]);_0x1761f3[_0x8cec('0x41')]=intUtil[_0x8cec('0x4e')](_0x1761f3[_0x8cec('0x41')]);if(_0x300928&&_0x300928[_0x8cec('0x4f')]&&_0x300928[_0x8cec('0x4f')]!==_0x8cec('0x50')){logger['info'](_0x8cec('0x51'),_0x8cec('0x42'));_0x54da53[_0x8cec('0x45')]=util[_0x8cec('0x25')](_0x8cec('0x43'),_0x1761f3[_0x8cec('0x41')],_0x54da53['uniqueid'],md5(_0x54da53['uniqueid']));}headers[_0x8cec('0x46')]=getAuth(_0x1761f3);return getUser(_0x1761f3,_0x5edc77[_0x8cec('0x23')])[_0x8cec('0x1c')](function(_0x28b252){_0x4aa8b8=_0x28b252;logger[_0x8cec('0xb')](_0x8cec('0x52'),_0x4aa8b8['id']);return getEndUser(_0x1761f3,_0x54da53[_0x8cec('0x53')],_0x54da53[_0x8cec('0x54')]);})[_0x8cec('0x1c')](function(_0x260c4d){_0x2219d5=_0x260c4d;logger['info'](_0x8cec('0x47'),_0x2219d5['id']);return getTicket(_0x1761f3,_0x4aa8b8,_0x2219d5,_0x1e1d3c,_0x54da53);})[_0x8cec('0x1c')](function(_0x346462){if(_0x346462&&_0x346462['id']){logger['info'](_0x8cec('0x1d'));logger[_0x8cec('0xb')](_0x8cec('0x55'),_0x346462['id']);logger[_0x8cec('0xb')]('[OUTBOUND]',_0x8cec('0x49'));emit(util[_0x8cec('0x25')]('user:%s',_0x5edc77[_0x8cec('0x14')]),_0x8cec('0x56'),{'uri':util[_0x8cec('0x25')](_0x8cec('0x57'),_0x1761f3[_0x8cec('0x1a')],_0x346462['id'])});}})[_0x8cec('0x4b')](function(_0x2b8766){logger['error'](_0x8cec('0x51'),JSON[_0x8cec('0x31')](_0x2b8766));});};exports['unmanaged']=function(_0x38126d,_0x3ad1b0,_0x4531ed,_0x6358b5,_0x49df16,_0x263653){var _0x235337,_0x279069;_0x263653[_0x8cec('0x1a')]=intUtil[_0x8cec('0x4e')](_0x263653[_0x8cec('0x1a')]);_0x263653[_0x8cec('0x41')]=intUtil[_0x8cec('0x4e')](_0x263653['serverUrl']);if(_0x49df16&&_0x49df16['monitor_format']){logger[_0x8cec('0xb')]('['+_0x3ad1b0['lastevent']['toUpperCase']()+']',_0x8cec('0x42'));_0x3ad1b0[_0x8cec('0x45')]=util[_0x8cec('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x263653['serverUrl'],_0x3ad1b0['uniqueid'],md5(_0x3ad1b0['uniqueid']));}else{_0x3ad1b0[_0x8cec('0x45')]='';}headers['Authorization']=getAuth(_0x263653);return getUser(_0x263653,'')[_0x8cec('0x1c')](function(_0x4115b1){_0x235337=_0x4115b1;logger['info']('The\x20User\x20ID\x20is:',_0x235337['id']);return getEndUser(_0x263653,_0x3ad1b0[_0x8cec('0x58')],_0x3ad1b0[_0x8cec('0xf')]);})[_0x8cec('0x1c')](function(_0x38b735){_0x279069=_0x38b735;logger[_0x8cec('0xb')](_0x8cec('0x47'),_0x279069['id']);return getTicket(_0x263653,_0x235337,_0x279069,_0x4531ed,_0x3ad1b0);})['then'](function(_0x6fab62){if(_0x6fab62){logger[_0x8cec('0xb')]('Ticket\x20created!');logger[_0x8cec('0xb')](_0x8cec('0x55'),_0x6fab62['id']);}})[_0x8cec('0x4b')](function(_0x5cb669){logger[_0x8cec('0x4c')]('['+_0x3ad1b0['lastevent'][_0x8cec('0x59')]()+']',JSON[_0x8cec('0x31')](_0x5cb669));});}; \ No newline at end of file +var _0x6f3a=['Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','%s/helpdesk/tickets/%d','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','keyBy','custom_fields','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','push','variable','variableName','customField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0xf6a62,_0x557fc6){var _0x4361b1=function(_0xa8969e){while(--_0xa8969e){_0xf6a62['push'](_0xf6a62['shift']());}};_0x4361b1(++_0x557fc6);}(_0x6f3a,0x18f));var _0xa6f3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6f3a[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xa6f3('0x0'));var rp=require(_0xa6f3('0x1'));var md5=require(_0xa6f3('0x2'));var util=require(_0xa6f3('0x3'));var Redis=require(_0xa6f3('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa6f3('0x5'))('freshdesk');config['redis']=_[_0xa6f3('0x6')](config[_0xa6f3('0x7')],{'host':_0xa6f3('0x8'),'port':0x18eb});var io=require(_0xa6f3('0x9'))(new Redis(config[_0xa6f3('0x7')]));var headers={'Content-Type':_0xa6f3('0xa'),'Accept':_0xa6f3('0xa')};function emit(_0x439a51,_0x4a7c8b,_0x3c40df){io['to'](_0x439a51)[_0xa6f3('0xb')](_0x4a7c8b,_0x3c40df);}function getTicket(_0x4ef996,_0x10e480,_0x472f3c,_0x170ae6,_0x8af68a){logger[_0xa6f3('0xc')](_0xa6f3('0xd'));var _0x91b616=_['merge']({'responder_id':_0x10e480['id'],'requester_id':_0x472f3c['id'],'name':util[_0xa6f3('0xe')](_0xa6f3('0xf'),_0x8af68a[_0xa6f3('0x10')]),'phone':_0x8af68a[_0xa6f3('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x170ae6[_0xa6f3('0x12')],_0x8af68a,'\x20'),'description':intUtil[_0xa6f3('0x13')](_0x170ae6[_0xa6f3('0x14')],_0x8af68a,_0xa6f3('0x15')),'tags':getTags(_0x170ae6[_0xa6f3('0x16')],_0xa6f3('0x17'))},getCustomFields(_0x170ae6[_0xa6f3('0x18')],_0x8af68a));_0x91b616['custom_fields']=_['mapValues'](_[_0xa6f3('0x19')](_0x91b616[_0xa6f3('0x1a')],'id'),_0xa6f3('0x1b'));return request({'uri':util[_0xa6f3('0xe')]('%s/api/v2/tickets',_0x4ef996[_0xa6f3('0x1c')]),'method':_0xa6f3('0x1d'),'body':_0x91b616})[_0xa6f3('0x1e')](function(_0x36cf0f){logger[_0xa6f3('0xc')]('Ticket\x20created!');return _0x36cf0f;});}function getUser(_0x3ed175,_0x2e8dbc){if(intUtil[_0xa6f3('0x1f')](_0x2e8dbc)){return request({'uri':util['format'](_0xa6f3('0x20'),_0x3ed175['remoteUri']),'qs':{'email':_0x2e8dbc}})[_0xa6f3('0x1e')](function(_0x1ce294){if(_0x1ce294[_0xa6f3('0x21')]){logger[_0xa6f3('0xc')](_0xa6f3('0x22'));return _[_0xa6f3('0x23')](_0x1ce294,function(_0x2fea85){return _0x2fea85[_0xa6f3('0x24')][_0xa6f3('0x25')]===_0x2e8dbc;});}else{logger[_0xa6f3('0xc')](_0xa6f3('0x26'));return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x27'),_0x3ed175[_0xa6f3('0x1c')])})[_0xa6f3('0x1e')](function(_0x46161c){logger['info'](_0xa6f3('0x28'));return _0x46161c;});}});}else{logger[_0xa6f3('0xc')](_0xa6f3('0x29'));return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x27'),_0x3ed175[_0xa6f3('0x1c')])})['then'](function(_0x265714){logger[_0xa6f3('0xc')](_0xa6f3('0x28'));return _0x265714;});}}function getEndUser(_0x58340a,_0x4d6d7b,_0x495f17){logger[_0xa6f3('0xc')]('Searching\x20enduser\x20with\x20phone',_0x495f17);return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x2a'),_0x58340a[_0xa6f3('0x1c')]),'qs':{'phone':_0x495f17}})[_0xa6f3('0x1e')](function(_0x569500){if(_0x569500['length']){logger['info'](_0xa6f3('0x2b'));return _[_0xa6f3('0x23')](_0x569500,{'phone':_0x495f17});}else{logger[_0xa6f3('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x58340a[_0xa6f3('0x1c')]),'method':_0xa6f3('0x1d'),'body':{'name':_0x4d6d7b,'phone':_0x495f17}})['then'](function(_0x6b1c1b){logger['info'](_0xa6f3('0x2c'));return _0x6b1c1b;});}});}function getAuth(_0x1a533e){return util[_0xa6f3('0xe')]('Basic\x20%s',new Buffer(_0x1a533e[_0xa6f3('0x2d')]+':X')[_0xa6f3('0x2e')](_0xa6f3('0x2f')));}function request(_0x4aa0df){logger[_0xa6f3('0x30')]('[HTTP]',JSON[_0xa6f3('0x31')](_0x4aa0df));return rp(_[_0xa6f3('0x6')](_0x4aa0df,{'method':_0xa6f3('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x89eb20,_0x5be1bc){var _0x2effe0=[];if(_0x89eb20&&_0x89eb20[_0xa6f3('0x21')]>0x0){_0x2effe0=_[_0xa6f3('0x33')](_0x89eb20,_0x5be1bc);}return _0x2effe0;}function getCustomFields(_0x33d0fa,_0x2e4f69){var _0x377c4c=[];var _0x566b11={'custom_fields':[]};if(_0x33d0fa[_0xa6f3('0x21')]>0x0){_[_0xa6f3('0x34')](_0x33d0fa,function(_0x4d219d){if(_[_0xa6f3('0x35')]([_0xa6f3('0x36'),_0xa6f3('0x37')],_0x4d219d[_0xa6f3('0x38')])&&_0x4d219d['nameField']&&!_0x4d219d['customField']){_0x566b11[_0x4d219d[_0xa6f3('0x39')][_0xa6f3('0x3a')]()]=_0x4d219d[_0xa6f3('0x3b')][_0xa6f3('0x2e')]();}else if(_[_0xa6f3('0x35')]([_0xa6f3('0x36'),_0xa6f3('0x37')],_0x4d219d[_0xa6f3('0x38')])&&_0x4d219d[_0xa6f3('0x3c')]&&_0x4d219d['customField']){_0x566b11[_0xa6f3('0x1a')][_0xa6f3('0x3d')]({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x4d219d[_0xa6f3('0x3b')][_0xa6f3('0x2e')]()});}else if(_0x4d219d[_0xa6f3('0x38')]===_0xa6f3('0x3e')&&_0x4d219d[_0xa6f3('0x3f')]&&_0x4d219d['idField']&&_0x4d219d[_0xa6f3('0x40')]){_0x2e4f69[_0x4d219d[_0xa6f3('0x3f')]]&&_0x566b11[_0xa6f3('0x1a')][_0xa6f3('0x3d')]({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x2e4f69[_0x4d219d[_0xa6f3('0x3f')]][_0xa6f3('0x2e')]()});}else if(_0x4d219d[_0xa6f3('0x38')]===_0xa6f3('0x41')&&_0x4d219d[_0xa6f3('0x42')]&&_0x4d219d[_0xa6f3('0x42')][_0xa6f3('0x17')]&&_0x4d219d[_0xa6f3('0x3c')]&&_0x4d219d[_0xa6f3('0x40')]){_0x2e4f69[_0x4d219d[_0xa6f3('0x42')][_0xa6f3('0x17')][_0xa6f3('0x3a')]()]&&_0x566b11[_0xa6f3('0x1a')]['push']({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x2e4f69[_0x4d219d['Variable']['name'][_0xa6f3('0x3a')]()][_0xa6f3('0x2e')]()});}});}return _0x566b11;}exports['queue']=function(_0x36c781,_0x39edf7,_0x2c1d56,_0x555698,_0x2c3ef2,_0x5b87ec){var _0x332060,_0x1a36fa;_0x5b87ec[_0xa6f3('0x1c')]=intUtil[_0xa6f3('0x43')](_0x5b87ec['remoteUri']);_0x5b87ec[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x5b87ec['serverUrl']);if(_0x2c3ef2&&_0x2c3ef2[_0xa6f3('0x45')]){logger[_0xa6f3('0xc')](_0xa6f3('0x46'),_0xa6f3('0x47'));_0x39edf7[_0xa6f3('0x48')]=util[_0xa6f3('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b87ec[_0xa6f3('0x44')],_0x39edf7[_0xa6f3('0x49')],md5(_0x39edf7['uniqueid']));}else{_0x39edf7[_0xa6f3('0x48')]='';}headers[_0xa6f3('0x4a')]=getAuth(_0x5b87ec);return getUser(_0x5b87ec,_0x555698[_0xa6f3('0x25')])['then'](function(_0x247335){_0x332060=_0x247335;logger[_0xa6f3('0xc')](_0xa6f3('0x4b'),_0x332060['id']);return getEndUser(_0x5b87ec,_0x39edf7[_0xa6f3('0x10')],_0x39edf7[_0xa6f3('0x11')]);})[_0xa6f3('0x1e')](function(_0x5ddcc4){_0x1a36fa=_0x5ddcc4;logger['info'](_0xa6f3('0x4c'),_0x1a36fa['id']);return getTicket(_0x5b87ec,_0x332060,_0x1a36fa,_0x2c1d56,_0x39edf7);})['then'](function(_0x5dc03a){if(_0x5dc03a&&_0x5dc03a['id']){logger[_0xa6f3('0xc')](_0xa6f3('0x4d'));logger[_0xa6f3('0xc')](_0xa6f3('0x4e'),_0x5dc03a['id']);logger[_0xa6f3('0xc')](_0xa6f3('0x46'),_0xa6f3('0x4f'));emit(util[_0xa6f3('0xe')]('user:%s',_0x555698[_0xa6f3('0x17')]),_0xa6f3('0x50'),{'uri':util[_0xa6f3('0xe')]('%s/helpdesk/tickets/%d',_0x5b87ec[_0xa6f3('0x1c')],_0x5dc03a['id'])});}})[_0xa6f3('0x51')](function(_0xf0369){logger[_0xa6f3('0x52')](_0xa6f3('0x46'),JSON[_0xa6f3('0x31')](_0xf0369));});};exports[_0xa6f3('0x53')]=function(_0x329767,_0x108eba,_0x38a9be,_0x418d48,_0x4a699d,_0x38d9f8,_0x4956af){var _0x58c413,_0x36d34b;_0x38d9f8[_0xa6f3('0x1c')]=intUtil[_0xa6f3('0x43')](_0x38d9f8[_0xa6f3('0x1c')]);_0x38d9f8[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x38d9f8[_0xa6f3('0x44')]);if(_0x4956af&&_0x4956af['recordingFormat']&&_0x4956af[_0xa6f3('0x54')]!=='none'){logger['info']('[OUTBOUND]',_0xa6f3('0x47'));_0x108eba[_0xa6f3('0x48')]=util[_0xa6f3('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38d9f8[_0xa6f3('0x44')],_0x108eba['uniqueid'],md5(_0x108eba[_0xa6f3('0x49')]));}headers['Authorization']=getAuth(_0x38d9f8);return getUser(_0x38d9f8,_0x418d48[_0xa6f3('0x25')])[_0xa6f3('0x1e')](function(_0x6f8f6e){_0x58c413=_0x6f8f6e;logger[_0xa6f3('0xc')]('The\x20User\x20ID\x20is:',_0x58c413['id']);return getEndUser(_0x38d9f8,_0x108eba[_0xa6f3('0x55')],_0x108eba[_0xa6f3('0x56')]);})[_0xa6f3('0x1e')](function(_0x166f5c){_0x36d34b=_0x166f5c;logger[_0xa6f3('0xc')]('The\x20Enduser\x20ID\x20is:',_0x36d34b['id']);return getTicket(_0x38d9f8,_0x58c413,_0x36d34b,_0x38a9be,_0x108eba);})[_0xa6f3('0x1e')](function(_0x5dedc9){if(_0x5dedc9&&_0x5dedc9['id']){logger[_0xa6f3('0xc')](_0xa6f3('0x4d'));logger['info'](_0xa6f3('0x4e'),_0x5dedc9['id']);logger[_0xa6f3('0xc')](_0xa6f3('0x57'),_0xa6f3('0x4f'));emit(util['format'](_0xa6f3('0x58'),_0x418d48['name']),_0xa6f3('0x50'),{'uri':util[_0xa6f3('0xe')](_0xa6f3('0x59'),_0x38d9f8[_0xa6f3('0x1c')],_0x5dedc9['id'])});}})['catch'](function(_0x46c16e){logger[_0xa6f3('0x52')](_0xa6f3('0x57'),JSON[_0xa6f3('0x31')](_0x46c16e));});};exports[_0xa6f3('0x5a')]=function(_0x2d6e51,_0x4acf99,_0x27b2eb,_0x1647e2,_0x8e69ae,_0x854e25){var _0x41ed2a,_0xcde183;_0x854e25['remoteUri']=intUtil[_0xa6f3('0x43')](_0x854e25['remoteUri']);_0x854e25[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x854e25[_0xa6f3('0x44')]);if(_0x8e69ae&&_0x8e69ae['monitor_format']){logger[_0xa6f3('0xc')]('['+_0x4acf99[_0xa6f3('0x5b')]['toUpperCase']()+']',_0xa6f3('0x47'));_0x4acf99[_0xa6f3('0x48')]=util['format'](_0xa6f3('0x5c'),_0x854e25[_0xa6f3('0x44')],_0x4acf99['uniqueid'],md5(_0x4acf99[_0xa6f3('0x49')]));}else{_0x4acf99[_0xa6f3('0x48')]='';}headers[_0xa6f3('0x4a')]=getAuth(_0x854e25);return getUser(_0x854e25,'')['then'](function(_0x2e6460){_0x41ed2a=_0x2e6460;logger[_0xa6f3('0xc')](_0xa6f3('0x4b'),_0x41ed2a['id']);return getEndUser(_0x854e25,_0x4acf99[_0xa6f3('0x10')],_0x4acf99['calleridnum']);})['then'](function(_0x65ec39){_0xcde183=_0x65ec39;logger[_0xa6f3('0xc')]('The\x20Enduser\x20ID\x20is:',_0xcde183['id']);return getTicket(_0x854e25,_0x41ed2a,_0xcde183,_0x27b2eb,_0x4acf99);})[_0xa6f3('0x1e')](function(_0x269e3b){if(_0x269e3b){logger['info'](_0xa6f3('0x4d'));logger[_0xa6f3('0xc')](_0xa6f3('0x4e'),_0x269e3b['id']);}})[_0xa6f3('0x51')](function(_0x5c8228){logger[_0xa6f3('0x52')]('['+_0x4acf99[_0xa6f3('0x5b')][_0xa6f3('0x5d')]()+']',JSON[_0xa6f3('0x31')](_0x5c8228));});}; \ 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 4ca2bad..e5dcb2c 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 _0xee9a=['Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task'];(function(_0x49d764,_0x2937f3){var _0x5d8917=function(_0x68c39f){while(--_0x68c39f){_0x49d764['push'](_0x49d764['shift']());}};_0x5d8917(++_0x2937f3);}(_0xee9a,0x70));var _0xaee9=function(_0x147285,_0x3f4f58){_0x147285=_0x147285-0x0;var _0x4cb53c=_0xee9a[_0x147285];return _0x4cb53c;};'use strict';var _=require(_0xaee9('0x0'));var rp=require(_0xaee9('0x1'));var md5=require('md5');var util=require(_0xaee9('0x2'));var moment=require(_0xaee9('0x3'));var Promise=require(_0xaee9('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xaee9('0x5'));var logger=require(_0xaee9('0x6'))(_0xaee9('0x7'));config['redis']=_[_0xaee9('0x8')](config[_0xaee9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaee9('0xa'))(new Redis(config['redis']));function getAdminId(_0x3fe83d,_0x263a5b,_0x3007a8,_0x54ddc9){return new Promise(function(_0x4f2b7d,_0x4fbaf1){var _0xb8f589=![];var _0x44e755={'method':'GET','uri':_0x54ddc9+_0xaee9('0xb'),'json':!![]};_0x44e755[_0xaee9('0xc')]=_0x3007a8;logger[_0xaee9('0xd')](_0xaee9('0xe'));return rp(_0x44e755)[_0xaee9('0xf')](function(_0x599c07){if(_0x599c07){var _0x3ea42c=_0x599c07[_0xaee9('0x10')];var _0x2a133a=null;for(_0x2a133a=0x0;_0x2a133a<_0x3ea42c[_0xaee9('0x11')];_0x2a133a++){if(_0x3ea42c[_0x2a133a][_0xaee9('0x12')]===_0x3fe83d[_0xaee9('0x13')]){_0x3fe83d[_0xaee9('0x14')]=_0x3ea42c[_0x2a133a]['id'];_0xb8f589=!![];}}if(_0xb8f589){logger[_0xaee9('0xd')](_0xaee9('0x15'),_0x3fe83d[_0xaee9('0x14')]);_0x4f2b7d(_0x3fe83d);}else{_0x4fbaf1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4fbaf1({'statusCode':0x194,'message':_0xaee9('0x16')});}})[_0xaee9('0x17')](function(_0x2ccf7e){logger[_0xaee9('0x18')]('['+[_0x263a5b[_0xaee9('0x19')]()]+']',_0x2ccf7e[_0xaee9('0x1a')]);_0x4fbaf1(_0x2ccf7e);});});}function getUser(_0x359b6a,_0x5f5636,_0x23d2c1){return function(_0x7e4f31){return new Promise(function(_0x1944d4,_0x2b7a2c){var _0x5e4187={'method':_0xaee9('0x1b'),'uri':_0x23d2c1+_0xaee9('0xb'),'json':!![]};_0x5e4187[_0xaee9('0xc')]=_0x5f5636;logger[_0xaee9('0xd')]('Getting\x20user\x20list');return rp(_0x5e4187)[_0xaee9('0xf')](function(_0x241fa2){if(_0x241fa2){var _0x134e95=_0x241fa2[_0xaee9('0x10')];var _0x15b7b3=![];var _0xa95618=null;if(_0x7e4f31[_0xaee9('0x1c')]!==null){logger[_0xaee9('0xd')](_0xaee9('0x1d'),_0x7e4f31[_0xaee9('0x1c')]);_0x7e4f31[_0xaee9('0x1e')]=_0x7e4f31[_0xaee9('0x1c')];for(_0xa95618=0x0;_0xa95618<_0x134e95[_0xaee9('0x11')];_0xa95618++){if(_0x134e95[_0xa95618][_0xaee9('0x12')]===_0x7e4f31['agentEmail']){_0x15b7b3=!![];_0x7e4f31['userId']=_0x134e95[_0xa95618]['id'];logger[_0xaee9('0xd')](_0xaee9('0x1f'),_0x7e4f31[_0xaee9('0x20')]);}}}if(!_0x15b7b3){logger[_0xaee9('0xd')](_0xaee9('0x21'));_0x7e4f31[_0xaee9('0x1e')]=_0x7e4f31[_0xaee9('0x13')];_0x7e4f31['userId']=_0x7e4f31['adminId'];_0x15b7b3=!![];}if(_0x15b7b3){_0x1944d4(_0x7e4f31);}else{_0x2b7a2c({'statusCode':0x194,'message':_0xaee9('0x16')});}}else{_0x2b7a2c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xaee9('0x17')](function(_0xaacdd8){logger[_0xaee9('0x18')]('['+[_0x359b6a['toUpperCase']()]+']',_0xaacdd8[_0xaee9('0x1a')]);_0x2b7a2c(_0xaacdd8);});});};}function searchContact(_0x39749c,_0xa9f625,_0x194fd9,_0x3dbd53){return new Promise(function(_0x2b3957,_0x33b6bd){var _0x34127c={'method':_0xaee9('0x1b'),'headers':_0xa9f625,'uri':_0x39749c+_0xaee9('0x22')+_0x3dbd53+'&f='+_0x194fd9+_0xaee9('0x23'),'json':!![]};rp(_0x34127c)[_0xaee9('0xf')](function(_0x35f1a7){var _0x5eccb4=_['find'](_0x35f1a7[_0xaee9('0x24')][_0xaee9('0x24')],[_0x194fd9,_0x3dbd53]);_0x2b3957(_0x5eccb4);})[_0xaee9('0x17')](function(_0x127be4){_0x33b6bd(_0x127be4);});});}function getEndUser(_0x3f74c1,_0x3f36dd,_0x14cf98){return function(_0x251f02){return new Promise(function(_0x13696d,_0x29029c){logger['info'](util[_0xaee9('0x25')](_0xaee9('0x26'),_0x251f02['contactNumber']));searchContact(_0x14cf98,_0x3f36dd,_0xaee9('0x27'),_0x251f02[_0xaee9('0x28')])[_0xaee9('0xf')](function(_0x3f6cec){if(_0x3f6cec){_0x251f02[_0xaee9('0x29')]=_0x3f6cec['id'];logger[_0xaee9('0xd')]('Contact\x20found\x20mobile_number:',_0x251f02['endUserId']);return _0x13696d(_0x251f02);}searchContact(_0x14cf98,_0x3f36dd,'work_number',_0x251f02[_0xaee9('0x28')])[_0xaee9('0xf')](function(_0x4c4507){if(_0x4c4507){_0x251f02[_0xaee9('0x29')]=_0x4c4507['id'];logger[_0xaee9('0xd')](_0xaee9('0x2a'),_0x251f02['endUserId']);return _0x13696d(_0x251f02);}createEndUser(_0x251f02,_0x3f74c1,_0x3f36dd,_0x14cf98)['then'](function(_0x2507de){logger[_0xaee9('0xd')]('Contact\x20created:',_0x2507de[_0xaee9('0x29')]);return _0x13696d(_0x2507de);});});})[_0xaee9('0x17')](function(_0x56ca1c){_0x29029c(_0x56ca1c);});});};}function createEndUser(_0xd3a25c,_0x1cc50b,_0xdc3dfb,_0x143d93){return new Promise(function(_0x11fb82,_0x5b4abf){var _0x28828e=moment();var _0x196e38={'method':_0xaee9('0x2b'),'uri':_0x143d93+_0xaee9('0x2c'),'body':{'contact':{'last_name':_0xd3a25c['contactNumber'],'work_number':_0xd3a25c[_0xaee9('0x28')],'mobile_number':_0xd3a25c[_0xaee9('0x28')],'owner_id':_0xd3a25c[_0xaee9('0x20')],'created_at':_0x28828e[_0xaee9('0x25')](_0xaee9('0x2d'))}},'json':!![]};_0x196e38['headers']=_0xdc3dfb;logger[_0xaee9('0xd')](_0xaee9('0x2e'));return rp(_0x196e38)[_0xaee9('0xf')](function(_0x19d1e0){_0xd3a25c[_0xaee9('0x29')]=_0x19d1e0[_0xaee9('0x2f')]['id'];_0x11fb82(_0xd3a25c);})[_0xaee9('0x17')](function(_0x389a9d){logger['error']('['+[_0x1cc50b[_0xaee9('0x19')]()]+']',_0x389a9d['message']);_0x5b4abf(_0x389a9d[_0xaee9('0x1a')]);});});}function getTicket(_0xc7ba44,_0x321fea,_0x50f5b5,_0x1a6b9a,_0x410b34){return function(_0x4e06be){logger['info'](_0xaee9('0x30'));return new Promise(function(_0x1e3b7f,_0x78e528){var _0x2e1163=moment();var _0x39f2c2={'method':_0xaee9('0x2b'),'uri':_0x50f5b5+_0xaee9('0x31'),'body':{'title':intUtil[_0xaee9('0x32')](_0x1a6b9a['Subjects'],_0x410b34,'\x20'),'description':intUtil['getString'](_0x1a6b9a[_0xaee9('0x33')],_0x410b34,'\x0a'),'owner_id':_0x4e06be[_0xaee9('0x20')],'creater_id':_0x4e06be[_0xaee9('0x14')],'targetable_id':_0x4e06be[_0xaee9('0x29')],'targetable_type':_0xaee9('0x34'),'created_at':_0x2e1163[_0xaee9('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2e1163[_0xaee9('0x35')](0x1e,'m')['format'](_0xaee9('0x2d'))},'json':!![]};_0x39f2c2[_0xaee9('0xc')]=_0x321fea;return rp(_0x39f2c2)[_0xaee9('0xf')](function(_0x2cba78){_0x4e06be[_0xaee9('0x36')]=_0x2cba78[_0xaee9('0x37')]['id'];logger[_0xaee9('0xd')](_0xaee9('0x38'),_0x4e06be[_0xaee9('0x36')]);_0x1e3b7f(_0x4e06be);})[_0xaee9('0x17')](function(_0x39f404){logger['error']('['+[_0xc7ba44[_0xaee9('0x19')]()]+']',_0x39f404[_0xaee9('0x1a')]);_0x78e528(_0x39f404[_0xaee9('0x1a')]);});});};}function emit(_0x62f43d,_0x45cb70,_0x593cf6){var _0x143fa2={'uri':_0x62f43d+_0xaee9('0x39')+_0x593cf6};io['to'](util[_0xaee9('0x25')](_0xaee9('0x3a'),_0x45cb70))['emit']('trigger:browser:url',_0x143fa2);}exports['cs']=function(_0x2ca39c,_0x2a6e22,_0x1c7542,_0x2e0796,_0x2bee67,_0x362dfe,_0xaa79b,_0x3f8b74){var _0x271273={};var _0x1ed398={'Authorization':_0xaee9('0x3b')+_0x362dfe[_0xaee9('0x3c')]};_0x362dfe['remoteUri']=intUtil[_0xaee9('0x3d')](_0x362dfe[_0xaee9('0x3e')]);_0x362dfe[_0xaee9('0x3f')]=intUtil[_0xaee9('0x3d')](_0x362dfe['serverUrl']);var _0x1b4dce=_0x362dfe[_0xaee9('0x3e')];_0x271273[_0xaee9('0x13')]=_0x362dfe[_0xaee9('0x40')];_0x271273['contactNumber']=_0x3f8b74['toLowerCase']()===_0xaee9('0x41')?_0x2a6e22[_0xaee9('0x42')]:_0x2a6e22[_0xaee9('0x43')];_0x271273[_0xaee9('0x44')]=_0x3f8b74==='queue'||_0x3f8b74===_0xaee9('0x45')?_0xaee9('0x46'):'outbound';if(_0x2e0796){_0x271273[_0xaee9('0x1c')]=_0x2e0796[_0xaee9('0x12')];}var _0x412547=util['format'](_0xaee9('0x47'),_0x362dfe['serverUrl'],_0x2a6e22['uniqueid'],md5(_0x2a6e22[_0xaee9('0x48')]));if(_0x2bee67&&_0x2bee67[_0xaee9('0x49')]){logger[_0xaee9('0xd')](_0xaee9('0x4a'),_0xaee9('0x4b'));_0x2a6e22['recordingURL']=_0x412547;}else if(_0xaa79b&&_0xaa79b[_0xaee9('0x4c')]&&_0xaa79b[_0xaee9('0x4c')]!==_0xaee9('0x4d')){logger['info'](_0xaee9('0x4e'),_0xaee9('0x4b'));_0x2a6e22[_0xaee9('0x4f')]=_0x412547;}else{_0x2a6e22[_0xaee9('0x4f')]='';}return getAdminId(_0x271273,_0x3f8b74,_0x1ed398,_0x1b4dce)[_0xaee9('0xf')](getUser(_0x3f8b74,_0x1ed398,_0x1b4dce))[_0xaee9('0xf')](getEndUser(_0x3f8b74,_0x1ed398,_0x1b4dce))['then'](getTicket(_0x3f8b74,_0x1ed398,_0x1b4dce,_0x1c7542,_0x2a6e22))[_0xaee9('0xf')](function(_0x4fb29e){logger['info'](util['format'](_0xaee9('0x50'),_0x4fb29e[_0xaee9('0x36')]));if(_0x3f8b74!==_0xaee9('0x45')){logger[_0xaee9('0xd')]('['+[_0x3f8b74[_0xaee9('0x19')]()]+']',_0xaee9('0x51'));emit(_0x1b4dce,_0x2e0796[_0xaee9('0x52')],_0x4fb29e[_0xaee9('0x29')]);}})[_0xaee9('0x17')](function(_0x580a5f){logger[_0xaee9('0x18')]('['+[_0x3f8b74['toUpperCase']()]+_0xaee9('0x53'),util['inspect'](_0x580a5f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6754=['username','toLowerCase','outbound','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','ioredis','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','users','length','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','find','contacts','mobile_number','contactNumber','then','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x317a46,_0xae8c22){var _0x56f054=function(_0x3e75be){while(--_0x3e75be){_0x317a46['push'](_0x317a46['shift']());}};_0x56f054(++_0xae8c22);}(_0x6754,0x159));var _0x4675=function(_0xeb8a5c,_0x5c849a){_0xeb8a5c=_0xeb8a5c-0x0;var _0x12adaf=_0x6754[_0xeb8a5c];return _0x12adaf;};'use strict';var _=require(_0x4675('0x0'));var rp=require(_0x4675('0x1'));var md5=require('md5');var util=require(_0x4675('0x2'));var moment=require('moment');var Promise=require(_0x4675('0x3'));var Redis=require(_0x4675('0x4'));var intUtil=require('./util');var config=require(_0x4675('0x5'));var logger=require('../../../../config/logger')(_0x4675('0x6'));config[_0x4675('0x7')]=_[_0x4675('0x8')](config[_0x4675('0x7')],{'host':_0x4675('0x9'),'port':0x18eb});var io=require(_0x4675('0xa'))(new Redis(config[_0x4675('0x7')]));function getAdminId(_0x59a452,_0x6fa0d7,_0x187911,_0x3e906f){return new Promise(function(_0x29b68f,_0x57e15a){var _0x1a718b=![];var _0x1cb97b={'method':_0x4675('0xb'),'uri':_0x3e906f+'/api/selector/owners','json':!![]};_0x1cb97b[_0x4675('0xc')]=_0x187911;logger['info'](_0x4675('0xd'));return rp(_0x1cb97b)['then'](function(_0x56d3e4){if(_0x56d3e4){var _0x5b5b2b=_0x56d3e4[_0x4675('0xe')];var _0x177222=null;for(_0x177222=0x0;_0x177222<_0x5b5b2b[_0x4675('0xf')];_0x177222++){if(_0x5b5b2b[_0x177222]['email']===_0x59a452[_0x4675('0x10')]){_0x59a452['adminId']=_0x5b5b2b[_0x177222]['id'];_0x1a718b=!![];}}if(_0x1a718b){logger[_0x4675('0x11')](_0x4675('0x12'),_0x59a452[_0x4675('0x13')]);_0x29b68f(_0x59a452);}else{_0x57e15a({'statusCode':0x194,'message':_0x4675('0x14')});}}else{_0x57e15a({'statusCode':0x194,'message':_0x4675('0x14')});}})['catch'](function(_0x2e3ebf){logger[_0x4675('0x15')]('['+[_0x6fa0d7[_0x4675('0x16')]()]+']',_0x2e3ebf[_0x4675('0x17')]);_0x57e15a(_0x2e3ebf);});});}function getUser(_0x41e902,_0x35721c,_0x2a2920){return function(_0x694f5f){return new Promise(function(_0x2a1290,_0x5a8299){var _0x4096cb={'method':_0x4675('0xb'),'uri':_0x2a2920+_0x4675('0x18'),'json':!![]};_0x4096cb[_0x4675('0xc')]=_0x35721c;logger['info'](_0x4675('0x19'));return rp(_0x4096cb)['then'](function(_0xafa6c6){if(_0xafa6c6){var _0x11cb33=_0xafa6c6[_0x4675('0xe')];var _0x8d29b0=![];var _0x5d97e7=null;if(_0x694f5f[_0x4675('0x1a')]!==null){logger[_0x4675('0x11')](_0x4675('0x1b'),_0x694f5f[_0x4675('0x1a')]);_0x694f5f[_0x4675('0x1c')]=_0x694f5f['agentEmail'];for(_0x5d97e7=0x0;_0x5d97e7<_0x11cb33['length'];_0x5d97e7++){if(_0x11cb33[_0x5d97e7][_0x4675('0x1d')]===_0x694f5f['agentEmail']){_0x8d29b0=!![];_0x694f5f[_0x4675('0x1e')]=_0x11cb33[_0x5d97e7]['id'];logger[_0x4675('0x11')](_0x4675('0x1f'),_0x694f5f[_0x4675('0x1e')]);}}}if(!_0x8d29b0){logger[_0x4675('0x11')](_0x4675('0x20'));_0x694f5f[_0x4675('0x1c')]=_0x694f5f[_0x4675('0x10')];_0x694f5f[_0x4675('0x1e')]=_0x694f5f['adminId'];_0x8d29b0=!![];}if(_0x8d29b0){_0x2a1290(_0x694f5f);}else{_0x5a8299({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5a8299({'statusCode':0x194,'message':_0x4675('0x14')});}})[_0x4675('0x21')](function(_0x41c446){logger[_0x4675('0x15')]('['+[_0x41e902['toUpperCase']()]+']',_0x41c446[_0x4675('0x17')]);_0x5a8299(_0x41c446);});});};}function searchContact(_0x13a0f8,_0x25bd4f,_0x11d8ea,_0x3cd7c4){return new Promise(function(_0xc421ab,_0x2af2a3){var _0x300e37={'method':'GET','headers':_0x25bd4f,'uri':_0x13a0f8+_0x4675('0x22')+_0x3cd7c4+'&f='+_0x11d8ea+'&entities=contact','json':!![]};rp(_0x300e37)['then'](function(_0x6b6109){var _0x165532=_[_0x4675('0x23')](_0x6b6109[_0x4675('0x24')][_0x4675('0x24')],[_0x11d8ea,_0x3cd7c4]);_0xc421ab(_0x165532);})['catch'](function(_0x40c25c){_0x2af2a3(_0x40c25c);});});}function getEndUser(_0x2dcfed,_0x26de4c,_0x4fc24a){return function(_0x20270b){return new Promise(function(_0x14705f,_0x140427){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x20270b['contactNumber']));searchContact(_0x4fc24a,_0x26de4c,_0x4675('0x25'),_0x20270b[_0x4675('0x26')])[_0x4675('0x27')](function(_0x11721c){if(_0x11721c){_0x20270b[_0x4675('0x28')]=_0x11721c['id'];logger[_0x4675('0x11')]('Contact\x20found\x20mobile_number:',_0x20270b['endUserId']);return _0x14705f(_0x20270b);}searchContact(_0x4fc24a,_0x26de4c,_0x4675('0x29'),_0x20270b[_0x4675('0x26')])[_0x4675('0x27')](function(_0x529d63){if(_0x529d63){_0x20270b[_0x4675('0x28')]=_0x529d63['id'];logger['info'](_0x4675('0x2a'),_0x20270b[_0x4675('0x28')]);return _0x14705f(_0x20270b);}createEndUser(_0x20270b,_0x2dcfed,_0x26de4c,_0x4fc24a)[_0x4675('0x27')](function(_0x39b7bc){logger[_0x4675('0x11')](_0x4675('0x2b'),_0x39b7bc[_0x4675('0x28')]);return _0x14705f(_0x39b7bc);});});})['catch'](function(_0x356fc6){_0x140427(_0x356fc6);});});};}function createEndUser(_0x2fc213,_0x5af0d5,_0x59611b,_0x2ed18e){return new Promise(function(_0x285e1b,_0x3d2b46){var _0x125271=moment();var _0x1743ce={'method':_0x4675('0x2c'),'uri':_0x2ed18e+_0x4675('0x2d'),'body':{'contact':{'last_name':_0x2fc213[_0x4675('0x26')],'work_number':_0x2fc213[_0x4675('0x26')],'mobile_number':_0x2fc213['contactNumber'],'owner_id':_0x2fc213[_0x4675('0x1e')],'created_at':_0x125271[_0x4675('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1743ce[_0x4675('0xc')]=_0x59611b;logger['info'](_0x4675('0x2f'));return rp(_0x1743ce)[_0x4675('0x27')](function(_0x3e4500){_0x2fc213[_0x4675('0x28')]=_0x3e4500[_0x4675('0x30')]['id'];_0x285e1b(_0x2fc213);})[_0x4675('0x21')](function(_0x5ac625){logger['error']('['+[_0x5af0d5[_0x4675('0x16')]()]+']',_0x5ac625['message']);_0x3d2b46(_0x5ac625[_0x4675('0x17')]);});});}function getTicket(_0x444ee3,_0xc52c18,_0x262ef3,_0x51ceb7,_0x5345de){return function(_0x1cad6d){logger['info'](_0x4675('0x31'));return new Promise(function(_0x4a53a9,_0xe020ab){var _0x380eaa=moment();var _0x5b9d21={'method':_0x4675('0x2c'),'uri':_0x262ef3+'/api/tasks','body':{'title':intUtil['getString'](_0x51ceb7[_0x4675('0x32')],_0x5345de,'\x20'),'description':intUtil['getString'](_0x51ceb7[_0x4675('0x33')],_0x5345de,'\x0a'),'owner_id':_0x1cad6d[_0x4675('0x1e')],'creater_id':_0x1cad6d['adminId'],'targetable_id':_0x1cad6d[_0x4675('0x28')],'targetable_type':_0x4675('0x34'),'created_at':_0x380eaa[_0x4675('0x2e')](_0x4675('0x35')),'due_date':_0x380eaa[_0x4675('0x36')](0x1e,'m')[_0x4675('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5b9d21[_0x4675('0xc')]=_0xc52c18;return rp(_0x5b9d21)[_0x4675('0x27')](function(_0x104f22){_0x1cad6d[_0x4675('0x37')]=_0x104f22[_0x4675('0x38')]['id'];logger[_0x4675('0x11')](_0x4675('0x39'),_0x1cad6d[_0x4675('0x37')]);_0x4a53a9(_0x1cad6d);})[_0x4675('0x21')](function(_0x5d04a7){logger['error']('['+[_0x444ee3['toUpperCase']()]+']',_0x5d04a7['message']);_0xe020ab(_0x5d04a7[_0x4675('0x17')]);});});};}function emit(_0x50f3ae,_0x3bfc92,_0x2ec437){var _0x402b55={'uri':_0x50f3ae+_0x4675('0x3a')+_0x2ec437};io['to'](util[_0x4675('0x2e')]('user:%s',_0x3bfc92))['emit'](_0x4675('0x3b'),_0x402b55);}exports['cs']=function(_0x4d4a81,_0x5d3e31,_0x3ee724,_0x16cf39,_0x49464b,_0x379dd2,_0x231015,_0x1ebda1){var _0x101878={};var _0x4bc5df={'Authorization':_0x4675('0x3c')+_0x379dd2[_0x4675('0x3d')]};_0x379dd2[_0x4675('0x3e')]=intUtil[_0x4675('0x3f')](_0x379dd2['remoteUri']);_0x379dd2[_0x4675('0x40')]=intUtil['stripTrailingSlash'](_0x379dd2['serverUrl']);var _0x124f53=_0x379dd2[_0x4675('0x3e')];_0x101878[_0x4675('0x10')]=_0x379dd2[_0x4675('0x41')];_0x101878[_0x4675('0x26')]=_0x1ebda1[_0x4675('0x42')]()===_0x4675('0x43')?_0x5d3e31['destcalleridnum']:_0x5d3e31[_0x4675('0x44')];_0x101878['callDirection']=_0x1ebda1==='queue'||_0x1ebda1===_0x4675('0x45')?_0x4675('0x46'):_0x4675('0x43');if(_0x16cf39){_0x101878[_0x4675('0x1a')]=_0x16cf39[_0x4675('0x1d')];}var _0x5e3f03=util[_0x4675('0x2e')](_0x4675('0x47'),_0x379dd2[_0x4675('0x40')],_0x5d3e31[_0x4675('0x48')],md5(_0x5d3e31['uniqueid']));if(_0x49464b&&_0x49464b[_0x4675('0x49')]){logger[_0x4675('0x11')](_0x4675('0x4a'),_0x4675('0x4b'));_0x5d3e31['recordingURL']=_0x5e3f03;}else if(_0x231015&&_0x231015['recordingFormat']&&_0x231015['recordingFormat']!=='none'){logger['info'](_0x4675('0x4c'),_0x4675('0x4b'));_0x5d3e31[_0x4675('0x4d')]=_0x5e3f03;}else{_0x5d3e31[_0x4675('0x4d')]='';}return getAdminId(_0x101878,_0x1ebda1,_0x4bc5df,_0x124f53)[_0x4675('0x27')](getUser(_0x1ebda1,_0x4bc5df,_0x124f53))['then'](getEndUser(_0x1ebda1,_0x4bc5df,_0x124f53))[_0x4675('0x27')](getTicket(_0x1ebda1,_0x4bc5df,_0x124f53,_0x3ee724,_0x5d3e31))[_0x4675('0x27')](function(_0x4d581f){logger[_0x4675('0x11')](util[_0x4675('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4d581f[_0x4675('0x37')]));if(_0x1ebda1!==_0x4675('0x45')){logger['info']('['+[_0x1ebda1[_0x4675('0x16')]()]+']',_0x4675('0x4e'));emit(_0x124f53,_0x16cf39[_0x4675('0x4f')],_0x4d581f[_0x4675('0x28')]);}})[_0x4675('0x21')](function(_0x5a2364){logger['error']('['+[_0x1ebda1[_0x4675('0x16')]()]+_0x4675('0x50'),util[_0x4675('0x51')](_0x5a2364,{'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 6e165c7..e103140 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 _0xbc42=['lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','vtiger','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbc42,0x75));var _0x2bc4=function(_0x110c70,_0x2f52bd){_0x110c70=_0x110c70-0x0;var _0x133f30=_0xbc42[_0x110c70];return _0x133f30;};'use strict';var _=require(_0x2bc4('0x0'));var util=require(_0x2bc4('0x1'));var zendesk=require(_0x2bc4('0x2'));var salesforce=require(_0x2bc4('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x2bc4('0x4'));var desk=require(_0x2bc4('0x5'));var vtiger=require(_0x2bc4('0x6'));var servicenow=require(_0x2bc4('0x7'));var dynamics365=require(_0x2bc4('0x8'));var freshsales=require(_0x2bc4('0x9'));var integrations=[_0x2bc4('0xa'),'salesforce','sugarcrm',_0x2bc4('0xb'),_0x2bc4('0xc'),_0x2bc4('0xd'),'vtiger',_0x2bc4('0xe'),_0x2bc4('0xf'),'servicenow'];exports[_0x2bc4('0x10')]=function(_0x5ed6c7,_0x1ad9cb,_0x4ad625,_0x1244a9,_0x3b069d,_0x4b1964){if(_0x4ad625){if(_[_0x2bc4('0x11')](integrations,_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]())){try{var _0x2859e3=null;var _0x5212cf='';var _0xc3e903=_0x4ad625[_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]()];if(_0xc3e903){var _0x54f5b0=_0xc3e903[_0x5ed6c7['data2']];if(_0x54f5b0){var _0x2e3e39=_['find'](_0x54f5b0[_0x2bc4('0x14')],{'id':parseInt(_0x5ed6c7[_0x2bc4('0x15')],0xa)});if(_0x2e3e39){if(_0x1244a9){if(_0x3b069d&&_0x1ad9cb[_0x2bc4('0x16')]){_0x5212cf=_0x2bc4('0x16');}else if(_0x1ad9cb[_0x2bc4('0x17')]){_0x5212cf=_0x2bc4('0x18');}else{console['log'](_0x2bc4('0x19'),_0x1ad9cb);}}else{_0x5212cf=_0x2bc4('0x1a');}switch(_0x5ed6c7['data1'][_0x2bc4('0x13')]()){case _0x2bc4('0xa'):zendesk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1b'):salesforce[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1c'):sugarcrm[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case'freshdesk':freshdesk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0xc'):zoho[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case'desk':desk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1d'):vtiger[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0xf'):freshsales['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;case _0x2bc4('0x1e'):servicenow['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;case _0x2bc4('0xe'):dynamics365['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;default:console['log'](_0x2bc4('0x1f'));}}else{_0x2859e3=require(_0x2bc4('0x20'))(_0x5ed6c7[_0x2bc4('0x12')]['toLowerCase']());_0x2859e3['error'](_0x2bc4('0x21'),util[_0x2bc4('0x22')](_0x2bc4('0x23'),_0x5ed6c7['data1']['toLowerCase'](),_0x5ed6c7['data3']));}}else{_0x2859e3=require(_0x2bc4('0x20'))(_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]());_0x2859e3['error'](_0x2bc4('0x21'),util[_0x2bc4('0x22')](_0x2bc4('0x24'),_0x5ed6c7[_0x2bc4('0x12')]['toLowerCase'](),_0x5ed6c7[_0x2bc4('0x25')]));}}else{}}catch(_0x172ee6){console[_0x2bc4('0x26')](_0x172ee6);}}}}; \ No newline at end of file +var _0x0cc1=['format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','freshsales','log','unknown\x20integration','../../../../config/logger','[EXEC]'];(function(_0x3677a1,_0x368045){var _0x531fd8=function(_0x3abc8e){while(--_0x3abc8e){_0x3677a1['push'](_0x3677a1['shift']());}};_0x531fd8(++_0x368045);}(_0x0cc1,0xc7));var _0x10cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10cc('0x0'));var util=require(_0x10cc('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x10cc('0x2'));var sugarcrm=require(_0x10cc('0x3'));var freshdesk=require(_0x10cc('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x10cc('0x5'));var servicenow=require(_0x10cc('0x6'));var dynamics365=require(_0x10cc('0x7'));var freshsales=require(_0x10cc('0x8'));var integrations=[_0x10cc('0x9'),'salesforce','sugarcrm',_0x10cc('0xa'),'zoho',_0x10cc('0xb'),_0x10cc('0xc'),_0x10cc('0xd'),'freshsales',_0x10cc('0xe')];exports[_0x10cc('0xf')]=function(_0x5b8960,_0x3e951b,_0x3a4ed7,_0x1a4840,_0x6e217c,_0x7f1e8c){if(_0x3a4ed7){if(_[_0x10cc('0x10')](integrations,_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]())){try{var _0x4957d3=null;var _0x16b89f='';var _0x2e0a6c=_0x3a4ed7[_0x5b8960['data1'][_0x10cc('0x12')]()];if(_0x2e0a6c){var _0x56d8d9=_0x2e0a6c[_0x5b8960[_0x10cc('0x13')]];if(_0x56d8d9){var _0x4966b3=_[_0x10cc('0x14')](_0x56d8d9[_0x10cc('0x15')],{'id':parseInt(_0x5b8960[_0x10cc('0x16')],0xa)});if(_0x4966b3){if(_0x1a4840){if(_0x6e217c&&_0x3e951b['queue']){_0x16b89f=_0x10cc('0x17');}else if(_0x3e951b[_0x10cc('0x18')]){_0x16b89f=_0x10cc('0x19');}else{console['log'](_0x10cc('0x1a'),_0x3e951b);}}else{_0x16b89f=_0x10cc('0x1b');}switch(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]()){case'zendesk':zendesk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case'salesforce':salesforce[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1c'):sugarcrm[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case'freshdesk':freshdesk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1d'):zoho[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0xb'):desk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0xc'):vtiger[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1e'):freshsales['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;case _0x10cc('0xe'):servicenow['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;case _0x10cc('0xd'):dynamics365['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;default:console[_0x10cc('0x1f')](_0x10cc('0x20'));}}else{_0x4957d3=require(_0x10cc('0x21'))(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]());_0x4957d3['error'](_0x10cc('0x22'),util[_0x10cc('0x23')](_0x10cc('0x24'),_0x5b8960['data1'][_0x10cc('0x12')](),_0x5b8960['data3']));}}else{_0x4957d3=require(_0x10cc('0x21'))(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]());_0x4957d3[_0x10cc('0x25')]('[EXEC]',util['format'](_0x10cc('0x26'),_0x5b8960[_0x10cc('0x11')]['toLowerCase'](),_0x5b8960[_0x10cc('0x13')]));}}else{}}catch(_0x10db48){console[_0x10cc('0x25')](_0x10db48);}}}}; \ 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 7a6dce6..7d3befc 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 _0xe40f=['redis','defaults','assign','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','toLowerCase','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','ioredis','../../../../config/logger','salesforce'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xe40f,0x70));var _0xfe40=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe40f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfe40('0x0'));var rp=require(_0xfe40('0x1'));var moment=require(_0xfe40('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xfe40('0x3'));var util=require('util');var Redis=require(_0xfe40('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xfe40('0x5'))(_0xfe40('0x6'));config[_0xfe40('0x7')]=_[_0xfe40('0x8')](config[_0xfe40('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe40('0x7')]));function emit(_0x465b04,_0x232804,_0x12ab10){io['to'](_0x465b04)['emit'](_0x232804,_0x12ab10);}function getTicket(_0xb411e0,_0x28a114,_0x7e6b70,_0x53531b,_0x98be1b,_0x4ac674,_0x4e2c85,_0x11b4b1){var _0x84aa09=Object[_0xfe40('0x9')]({},{'OwnerId':_0x28a114['id'],'Subject':intUtil['getString'](_0x53531b['Subjects'],_0x98be1b,'\x20'),'Description':intUtil['getString'](_0x53531b[_0xfe40('0xa')],_0x98be1b,'\x0a')},getCustomFields(_0x4ac674,_0x98be1b));if(_0x7e6b70){if(_0x53531b[_0xfe40('0xb')]===_0xfe40('0xc')){_0x84aa09[_0xfe40('0xd')]=moment[_0xfe40('0xe')]();_0x84aa09[_0xfe40('0xf')]=![];_0x84aa09[_0xfe40('0x10')]=![];if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x12')||_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x13')){_0x84aa09[_0xfe40('0x14')]=_0x7e6b70['id'];}else if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x15')){_0x84aa09[_0xfe40('0x16')]=_0x7e6b70['id'];}}else if(_0x53531b[_0xfe40('0xb')]===_0xfe40('0x17')){if(_0x7e6b70['endUserType']===_0xfe40('0x12')){_0x84aa09[_0xfe40('0x18')]=_0x7e6b70['id'];}else if(_0x7e6b70['endUserType']==='account'){_0x84aa09['AccountId']=_0x7e6b70['id'];}else if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x13')&&_0x53531b['leadId']){_0x84aa09[_0x53531b['leadId']]=_0x7e6b70['id'];}else{logger[_0xfe40('0x19')](_0xfe40('0x1a'));}}}return _0x4e2c85[_0xfe40('0x1b')](_0x53531b[_0xfe40('0xb')])['create'](_0x84aa09);}function getUser(_0x13074e,_0x2d64de,_0x237829){if(!_[_0xfe40('0x1c')](_0x2d64de)&&intUtil[_0xfe40('0x1d')](_0x2d64de)){var _0x255c56={'Email':_0x2d64de};var _0x58f69a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x237829['sobject'](_0xfe40('0x1e'))['find'](_0x255c56,_0x58f69a)[_0xfe40('0x1f')]()[_0xfe40('0x20')](function(_0x6adcfa){if(_0x6adcfa[_0xfe40('0x21')]){var _0x540913=_[_0xfe40('0x22')](_0x6adcfa,function(_0x26fd24){return _0x26fd24['Email']===_0x2d64de;});if(_0x540913){logger['info'](_0xfe40('0x23'),_0x2d64de);return BPromise[_0xfe40('0x24')]({'id':_0x540913['Id'],'name':_0x540913['Name']});}}else{logger[_0xfe40('0x19')](_0xfe40('0x25'),_0x2d64de);return _0x237829[_0xfe40('0x26')]()['then'](function(_0x2ed794){return BPromise[_0xfe40('0x24')]({'id':_0x2ed794[_0xfe40('0x27')],'name':_0x2ed794[_0xfe40('0x28')]});});}});}else{logger[_0xfe40('0x19')](_0xfe40('0x25'),_0x2d64de);return _0x237829[_0xfe40('0x26')]()[_0xfe40('0x20')](function(_0x54abd5){return BPromise['resolve']({'id':_0x54abd5[_0xfe40('0x27')],'name':_0x54abd5['display_name']});});}}function getEndUser(_0x20e791,_0x5edca3,_0x1a7df2,_0x3ef799,_0x54af8c){var _0x14816d={'$or':{'Phone':_0x3ef799}};var _0x4d146c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfe40('0x24')]()[_0xfe40('0x20')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x29')]);switch(_0x5edca3[_0xfe40('0x29')]){case _0xfe40('0x2a'):var _0x1fe22f=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x2c')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x1fe22f['$or'],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x1fe22f,_0x4d146c)[_0xfe40('0x1f')]()['then'](function(_0x727b47){if(_0x727b47&&_0x727b47[_0xfe40('0x21')]){return _0x727b47;}else{var _0x5b109c=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2f')]){var _0x4acf6c={};_0x4acf6c[_0x5edca3['additionalSearchLead']]=_0x3ef799;_[_0xfe40('0x2d')](_0x5b109c[_0xfe40('0x30')],_0x4acf6c);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x5b109c,_0x4d146c);}});case _0xfe40('0x32'):var _0x12aa19=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x33')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x33')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x12aa19['$or'],_0x143aa9);}return _0x54af8c['sobject'](_0xfe40('0x34'))[_0xfe40('0x22')](_0x12aa19,_0x4d146c)[_0xfe40('0x1f')]()[_0xfe40('0x20')](function(_0x73c5d9){if(_0x73c5d9&&_0x73c5d9['length']){return _0x73c5d9;}else{var _0x34eb8c=_['cloneDeep'](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x280de={};_0x280de[_0x5edca3[_0xfe40('0x2c')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x34eb8c[_0xfe40('0x30')],_0x280de);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x34eb8c,_0x4d146c)[_0xfe40('0x20')](function(_0x26dd11){if(_0x26dd11&&_0x26dd11[_0xfe40('0x21')]){return _0x26dd11;}else{var _0x298fc5=_['cloneDeep'](_0x14816d);if(_0x5edca3['additionalSearchLead']){var _0x2abda9={};_0x2abda9[_0x5edca3[_0xfe40('0x2f')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x298fc5[_0xfe40('0x30')],_0x2abda9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x298fc5,_0x4d146c);}});}});case _0xfe40('0x12'):var _0x1fe22f=_['cloneDeep'](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x143aa9={};_0x143aa9[_0x5edca3['additionalSearchContact']]=_0x3ef799;_['merge'](_0x1fe22f[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c['sobject'](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x1fe22f,_0x4d146c)[_0xfe40('0x1f')]();case _0xfe40('0x13'):var _0x151fcc=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2f')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x2f')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x151fcc[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x151fcc,_0x4d146c);case'account':var _0x12aa19=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x33')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x33')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x12aa19[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x34'))[_0xfe40('0x22')](_0x12aa19,_0x4d146c);default:return null;}})['then'](function(_0x2eb1c1){if(_0x2eb1c1&&_0x2eb1c1[_0xfe40('0x21')]){var _0x29ed48=_[_0xfe40('0x35')](_0x2eb1c1);if(_0x29ed48){return BPromise['resolve']({'id':_0x29ed48['Id'],'name':_0x29ed48[_0xfe40('0x36')],'phone':_0x29ed48[_0xfe40('0x37')],'endUserType':_0x29ed48['attributes'][_0xfe40('0x38')][_0xfe40('0x39')]()});}}})['then'](function(_0x3c551b){if(_0x3c551b){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3c551b[_0xfe40('0x11')],_0x3ef799);return BPromise[_0xfe40('0x24')](_0x3c551b);}else{logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3ef799);var _0x5027b7={'Phone':_0x3ef799};if(_0x5edca3[_0xfe40('0x3a')]){if(_0x5edca3[_0xfe40('0x3a')]===_0xfe40('0x12')){logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7[_0xfe40('0x3b')]=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);}else if(_0x5edca3['moduleCreate']===_0xfe40('0x13')){logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7['LastName']=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);_0x5027b7[_0xfe40('0x3f')]=_0xfe40('0x40');}else if(_0x5edca3[_0xfe40('0x3a')]==='account'){logger[_0xfe40('0x19')](_0xfe40('0x41'),_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7[_0xfe40('0x36')]=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);}else{return null;}}return _0x54af8c[_0xfe40('0x1b')](_[_0xfe40('0x42')](_0x5edca3[_0xfe40('0x3a')]))['create'](_0x5027b7)[_0xfe40('0x20')](function(_0x7b8c0e){return BPromise['resolve']({'id':_0x7b8c0e['id'],'endUserType':_0x5edca3[_0xfe40('0x3a')]});});}});}function getCustomFields(_0x1cad98,_0xe60f75){var _0x31abdf={};if(_0x1cad98['length']>0x0){_[_0xfe40('0x43')](_0x1cad98,function(_0x350a4c){if(_['includes']([_0xfe40('0x44'),_0xfe40('0x45')],_0x350a4c['type'])&&_0x350a4c[_0xfe40('0x46')]){_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0x350a4c[_0xfe40('0x47')][_0xfe40('0x48')]();}else if(_0x350a4c['type']==='variable'&&_0x350a4c[_0xfe40('0x49')]&&_0x350a4c[_0xfe40('0x46')]){_0xe60f75[_0x350a4c[_0xfe40('0x49')]]&&(_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0xe60f75[_0x350a4c[_0xfe40('0x49')]]['toString']());}else if(_0x350a4c[_0xfe40('0x38')]===_0xfe40('0x4a')&&_0x350a4c[_0xfe40('0x4b')]&&_0x350a4c['Variable'][_0xfe40('0x4c')]&&_0x350a4c['idField']){_0xe60f75[_0x350a4c[_0xfe40('0x4b')][_0xfe40('0x4c')][_0xfe40('0x39')]()]&&(_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0xe60f75[_0x350a4c[_0xfe40('0x4b')][_0xfe40('0x4c')][_0xfe40('0x39')]()][_0xfe40('0x48')]());}});}return _0x31abdf;}function getConnection(_0x232a44){var _0x55074b=_0x232a44[_0xfe40('0x4d')][_0xfe40('0x4e')](_0x232a44[_0xfe40('0x4f')]);var _0x211b44=new jsforce[(_0xfe40('0x50'))]({'oauth2':{'loginUrl':_0x232a44['remoteUri']||_0xfe40('0x51'),'clientId':_0x232a44[_0xfe40('0x52')],'clientSecret':_0x232a44[_0xfe40('0x53')]}});return _0x211b44[_0xfe40('0x54')](_0x232a44[_0xfe40('0x55')],_0x55074b)[_0xfe40('0x20')](function(){logger[_0xfe40('0x19')](_0xfe40('0x56'));return _0x211b44;});}exports[_0xfe40('0x57')]=function(_0xa582aa,_0x279de7,_0x527852,_0x3ee22a,_0x712cd5,_0x5eb550){var _0x403479,_0x2512c4,_0x48e9e3,_0x2625b3;_0x5eb550[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0x5eb550[_0xfe40('0x58')]);_0x5eb550[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0x5eb550[_0xfe40('0x5a')]);if(_0x712cd5&&_0x712cd5[_0xfe40('0x5b')]){logger[_0xfe40('0x19')](_0xfe40('0x5c'),'Recording\x20is\x20enabled!');_0x279de7[_0xfe40('0x5d')]=util['format'](_0xfe40('0x5e'),_0x5eb550[_0xfe40('0x58')],_0x279de7[_0xfe40('0x5f')],md5(_0x279de7['uniqueid']));}else{_0x279de7[_0xfe40('0x5d')]='';}return getConnection(_0x5eb550)['then'](function(_0x5d09c9){_0x2625b3=_0x5d09c9;return getUser(_0x5eb550,_0x3ee22a[_0xfe40('0x60')],_0x2625b3);})['then'](function(_0x21b952){_0x403479=_0x21b952;return getEndUser(_0x5eb550,_0x527852,_0x279de7['calleridname'],_0x279de7['calleridnum'],_0x2625b3);})['then'](function(_0x3e4e7e){_0x2512c4=_0x3e4e7e;return getTicket(_0x5eb550,_0x403479,_0x2512c4,_0x527852,_0x279de7,_0x527852[_0xfe40('0x61')],_0x2625b3,'queue');})[_0xfe40('0x20')](function(_0x461d35){_0x48e9e3=_0x461d35;logger[_0xfe40('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48e9e3['id']);logger[_0xfe40('0x19')](_0xfe40('0x62'),_0x48e9e3['id'],_0x3ee22a[_0xfe40('0x4c')],_0x5eb550[_0xfe40('0x38')]);switch(_0x5eb550[_0xfe40('0x38')]){case _0xfe40('0x63'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x3ee22a[_0xfe40('0x4c')]),'trigger:salesforce:display',{'recordId':_0x48e9e3['id']});break;case _0xfe40('0x65'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x3ee22a[_0xfe40('0x4c')]),_0xfe40('0x66'),{'uri':util[_0xfe40('0x3d')](_0xfe40('0x67'),_0x2625b3[_0xfe40('0x68')],_0x48e9e3['id'])});break;default:logger[_0xfe40('0x69')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfe40('0x6a')](function(_0x1bf45b){logger['error'](_0xfe40('0x5c'),_0x1bf45b);});};exports[_0xfe40('0x6b')]=function(_0x42add8,_0x2b74e2,_0x547a13,_0x6bc1f5,_0x483ada,_0xa7ebf8,_0x2b56e3){var _0x3f1126,_0x219d77,_0x182e5d,_0x78387c;_0xa7ebf8[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0xa7ebf8[_0xfe40('0x58')]);_0xa7ebf8[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0xa7ebf8[_0xfe40('0x5a')]);if(_0x2b56e3&&_0x2b56e3[_0xfe40('0x6c')]&&_0x2b56e3['recordingFormat']!==_0xfe40('0x6d')){logger[_0xfe40('0x19')](_0xfe40('0x6e'),_0xfe40('0x6f'));_0x2b74e2[_0xfe40('0x5d')]=util['format'](_0xfe40('0x5e'),_0xa7ebf8[_0xfe40('0x58')],_0x2b74e2[_0xfe40('0x5f')],md5(_0x2b74e2[_0xfe40('0x5f')]));}return getConnection(_0xa7ebf8)[_0xfe40('0x20')](function(_0x3841f8){_0x78387c=_0x3841f8;return getUser(_0xa7ebf8,_0x6bc1f5[_0xfe40('0x60')],_0x78387c);})[_0xfe40('0x20')](function(_0x366aff){_0x3f1126=_0x366aff;return getEndUser(_0xa7ebf8,_0x547a13,_0x2b74e2['destcalleridname'],_0x2b74e2[_0xfe40('0x70')],_0x78387c);})[_0xfe40('0x20')](function(_0x3d25af){_0x219d77=_0x3d25af;return getTicket(_0xa7ebf8,_0x3f1126,_0x219d77,_0x547a13,_0x2b74e2,_0x547a13[_0xfe40('0x61')],_0x78387c,'outbound');})[_0xfe40('0x20')](function(_0x31af01){_0x182e5d=_0x31af01;logger[_0xfe40('0x19')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x182e5d['id']);logger[_0xfe40('0x19')](_0xfe40('0x71'),_0x182e5d['id'],_0x6bc1f5[_0xfe40('0x4c')],_0xa7ebf8[_0xfe40('0x38')]);switch(_0xa7ebf8[_0xfe40('0x38')]){case _0xfe40('0x63'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x6bc1f5[_0xfe40('0x4c')]),'trigger:salesforce:display',{'recordId':_0x182e5d['id']});break;case _0xfe40('0x65'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x6bc1f5[_0xfe40('0x4c')]),'trigger:browser:url',{'uri':util[_0xfe40('0x3d')]('%s/%s/e',_0x78387c[_0xfe40('0x68')],_0x182e5d['id'])});break;default:logger['error'](_0xfe40('0x6e'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xfe40('0x6a')](function(_0x1d4602){logger[_0xfe40('0x69')](_0xfe40('0x6e'),_0x1d4602);});};exports[_0xfe40('0x72')]=function(_0x1892d7,_0x2bbe5e,_0x119691,_0x82de0f,_0x28a908,_0x1dbd7b){var _0x212f5b,_0x1d0698,_0x192a45,_0x43ba65;_0x1dbd7b[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0x1dbd7b[_0xfe40('0x58')]);_0x1dbd7b[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0x1dbd7b[_0xfe40('0x5a')]);if(_0x28a908&&_0x28a908[_0xfe40('0x5b')]){logger[_0xfe40('0x19')]('['+_0x2bbe5e[_0xfe40('0x73')][_0xfe40('0x74')]()+']',_0xfe40('0x6f'));_0x2bbe5e[_0xfe40('0x5d')]=util[_0xfe40('0x3d')](_0xfe40('0x5e'),_0x1dbd7b['serverUrl'],_0x2bbe5e[_0xfe40('0x5f')],md5(_0x2bbe5e['uniqueid']));}else{_0x2bbe5e[_0xfe40('0x5d')]='';}return getConnection(_0x1dbd7b)['then'](function(_0x2fed1e){_0x43ba65=_0x2fed1e;if(!_[_0xfe40('0x1c')](_0x82de0f)){return getUser(_0x1dbd7b,_0x82de0f[_0xfe40('0x4c')],_0x43ba65);}else{return getUser(_0x1dbd7b,null,_0x43ba65);}})[_0xfe40('0x20')](function(_0x450d85){_0x212f5b=_0x450d85;return getEndUser(_0x1dbd7b,_0x119691,_0x2bbe5e[_0xfe40('0x75')],_0x2bbe5e['calleridnum'],_0x43ba65);})[_0xfe40('0x20')](function(_0x3c116c){_0x1d0698=_0x3c116c;return getTicket(_0x1dbd7b,_0x212f5b,_0x1d0698,_0x119691,_0x2bbe5e,_0x119691['Fields'],_0x43ba65);})[_0xfe40('0x20')](function(_0x39f5b3){_0x192a45=_0x39f5b3;logger['info']('['+_0x2bbe5e[_0xfe40('0x73')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x192a45['id']);logger[_0xfe40('0x19')]('['+_0x2bbe5e[_0xfe40('0x73')]['toUpperCase']()+_0xfe40('0x76'),_0x1dbd7b['type']);})[_0xfe40('0x6a')](function(_0x2b9d07){logger[_0xfe40('0x69')]('['+_0x2bbe5e['lastevent'][_0xfe40('0x74')]()+']',_0x2b9d07);});}; \ No newline at end of file +var _0x3b65=['getString','Subjects','ticketType','Task','ActivityDate','utc','endUserType','contact','lead','WhoId','WhatId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','find','execute','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','display_name','info','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','length','cloneDeep','additionalSearchLead','additionalSearchAccount','$or','Account','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','isNil',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x311069,_0x1f9d3e){var _0x49cd1e=function(_0x3fcb16){while(--_0x3fcb16){_0x311069['push'](_0x311069['shift']());}};_0x49cd1e(++_0x1f9d3e);}(_0x3b65,0x168));var _0x53b6=function(_0xf06cd6,_0x25ebf5){_0xf06cd6=_0xf06cd6-0x0;var _0x50c7c7=_0x3b65[_0xf06cd6];return _0x50c7c7;};'use strict';var _=require('lodash');var rp=require(_0x53b6('0x0'));var moment=require(_0x53b6('0x1'));var BPromise=require(_0x53b6('0x2'));var md5=require(_0x53b6('0x3'));var jsforce=require(_0x53b6('0x4'));var util=require(_0x53b6('0x5'));var Redis=require(_0x53b6('0x6'));var intUtil=require(_0x53b6('0x7'));var config=require('../../../../config/environment');var logger=require(_0x53b6('0x8'))(_0x53b6('0x9'));config[_0x53b6('0xa')]=_[_0x53b6('0xb')](config['redis'],{'host':_0x53b6('0xc'),'port':0x18eb});var io=require(_0x53b6('0xd'))(new Redis(config[_0x53b6('0xa')]));function emit(_0x3fe187,_0xda8f07,_0x4b389f){io['to'](_0x3fe187)[_0x53b6('0xe')](_0xda8f07,_0x4b389f);}function getTicket(_0x2c2bac,_0x407d65,_0x2b5364,_0x112fe6,_0x59eb5e,_0x5813ac,_0x181e98,_0x18556e){var _0x12a671=Object['assign']({},{'OwnerId':_0x407d65['id'],'Subject':intUtil[_0x53b6('0xf')](_0x112fe6[_0x53b6('0x10')],_0x59eb5e,'\x20'),'Description':intUtil['getString'](_0x112fe6['Descriptions'],_0x59eb5e,'\x0a')},getCustomFields(_0x5813ac,_0x59eb5e));if(_0x2b5364){if(_0x112fe6[_0x53b6('0x11')]===_0x53b6('0x12')){_0x12a671[_0x53b6('0x13')]=moment[_0x53b6('0x14')]();_0x12a671['IsReminderSet']=![];_0x12a671['IsRecurrence']=![];if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x16')||_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x17')){_0x12a671[_0x53b6('0x18')]=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]==='account'){_0x12a671[_0x53b6('0x19')]=_0x2b5364['id'];}}else if(_0x112fe6[_0x53b6('0x11')]==='Case'){if(_0x2b5364['endUserType']===_0x53b6('0x16')){_0x12a671['ContactId']=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x1a')){_0x12a671[_0x53b6('0x1b')]=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x17')&&_0x112fe6[_0x53b6('0x1c')]){_0x12a671[_0x112fe6[_0x53b6('0x1c')]]=_0x2b5364['id'];}else{logger['info'](_0x53b6('0x1d'));}}}return _0x181e98[_0x53b6('0x1e')](_0x112fe6[_0x53b6('0x11')])[_0x53b6('0x1f')](_0x12a671);}function getUser(_0x3c7101,_0x4fafc5,_0x31a5f2){if(!_['isNil'](_0x4fafc5)&&intUtil[_0x53b6('0x20')](_0x4fafc5)){var _0x455c13={'Email':_0x4fafc5};var _0x2412bb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31a5f2['sobject']('User')[_0x53b6('0x21')](_0x455c13,_0x2412bb)[_0x53b6('0x22')]()[_0x53b6('0x23')](function(_0x759ef4){if(_0x759ef4['length']){var _0x10727f=_['find'](_0x759ef4,function(_0x5a401a){return _0x5a401a[_0x53b6('0x24')]===_0x4fafc5;});if(_0x10727f){logger['info'](_0x53b6('0x25'),_0x4fafc5);return BPromise['resolve']({'id':_0x10727f['Id'],'name':_0x10727f[_0x53b6('0x26')]});}}else{logger['info'](_0x53b6('0x27'),_0x4fafc5);return _0x31a5f2[_0x53b6('0x28')]()[_0x53b6('0x23')](function(_0x41d3c3){return BPromise[_0x53b6('0x29')]({'id':_0x41d3c3['user_id'],'name':_0x41d3c3[_0x53b6('0x2a')]});});}});}else{logger[_0x53b6('0x2b')](_0x53b6('0x27'),_0x4fafc5);return _0x31a5f2['identity']()['then'](function(_0x260ced){return BPromise['resolve']({'id':_0x260ced[_0x53b6('0x2c')],'name':_0x260ced[_0x53b6('0x2a')]});});}}function getEndUser(_0x2c4262,_0x34991a,_0x329018,_0x51641b,_0x574527){var _0x149dc3={'$or':{'Phone':_0x51641b}};var _0x1374d0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x53b6('0x23')](function(){logger[_0x53b6('0x2b')](_0x53b6('0x2d'),_0x51641b,_0x34991a[_0x53b6('0x2e')]);switch(_0x34991a[_0x53b6('0x2e')]){case _0x53b6('0x2f'):var _0x1e4395=_['cloneDeep'](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_[_0x53b6('0x31')](_0x1e4395['$or'],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x1e4395,_0x1374d0)[_0x53b6('0x22')]()['then'](function(_0x3436c3){if(_0x3436c3&&_0x3436c3[_0x53b6('0x33')]){return _0x3436c3;}else{var _0x271ade=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x54386f={};_0x54386f[_0x34991a[_0x53b6('0x35')]]=_0x51641b;_[_0x53b6('0x31')](_0x271ade['$or'],_0x54386f);}return _0x574527[_0x53b6('0x1e')]('Lead')[_0x53b6('0x21')](_0x271ade,_0x1374d0);}});case'account_contact_lead':var _0x2c8917=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a['additionalSearchAccount']){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x36')]]=_0x51641b;_['merge'](_0x2c8917[_0x53b6('0x37')],_0x643374);}return _0x574527['sobject'](_0x53b6('0x38'))[_0x53b6('0x21')](_0x2c8917,_0x1374d0)[_0x53b6('0x22')]()['then'](function(_0x2fb13c){if(_0x2fb13c&&_0x2fb13c[_0x53b6('0x33')]){return _0x2fb13c;}else{var _0x5261a1=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x4c4349={};_0x4c4349[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_['merge'](_0x5261a1[_0x53b6('0x37')],_0x4c4349);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x5261a1,_0x1374d0)['then'](function(_0x2365cf){if(_0x2365cf&&_0x2365cf[_0x53b6('0x33')]){return _0x2365cf;}else{var _0x2c9bc1=_['cloneDeep'](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x2eecc2={};_0x2eecc2[_0x34991a['additionalSearchLead']]=_0x51641b;_[_0x53b6('0x31')](_0x2c9bc1[_0x53b6('0x37')],_0x2eecc2);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x39'))[_0x53b6('0x21')](_0x2c9bc1,_0x1374d0);}});}});case _0x53b6('0x16'):var _0x1e4395=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_[_0x53b6('0x31')](_0x1e4395[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x1e4395,_0x1374d0)[_0x53b6('0x22')]();case _0x53b6('0x17'):var _0x1df0eb=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x35')]]=_0x51641b;_[_0x53b6('0x31')](_0x1df0eb[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x39'))[_0x53b6('0x21')](_0x1df0eb,_0x1374d0);case _0x53b6('0x1a'):var _0x2c8917=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a['additionalSearchAccount']){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x36')]]=_0x51641b;_[_0x53b6('0x31')](_0x2c8917[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x38'))['find'](_0x2c8917,_0x1374d0);default:return null;}})[_0x53b6('0x23')](function(_0x3ff5a0){if(_0x3ff5a0&&_0x3ff5a0['length']){var _0x20f631=_[_0x53b6('0x3a')](_0x3ff5a0);if(_0x20f631){return BPromise[_0x53b6('0x29')]({'id':_0x20f631['Id'],'name':_0x20f631[_0x53b6('0x26')],'phone':_0x20f631[_0x53b6('0x3b')],'endUserType':_0x20f631[_0x53b6('0x3c')][_0x53b6('0x3d')][_0x53b6('0x3e')]()});}}})['then'](function(_0x242ab0){if(_0x242ab0){logger[_0x53b6('0x2b')](_0x53b6('0x3f'),_0x242ab0[_0x53b6('0x15')],_0x51641b);return BPromise['resolve'](_0x242ab0);}else{logger[_0x53b6('0x2b')](_0x53b6('0x40'),_0x51641b);var _0x3e7206={'Phone':_0x51641b};if(_0x34991a[_0x53b6('0x41')]){if(_0x34991a[_0x53b6('0x41')]==='contact'){logger[_0x53b6('0x2b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x42')]=_0x329018!==''?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);}else if(_0x34991a['moduleCreate']===_0x53b6('0x17')){logger[_0x53b6('0x2b')](_0x53b6('0x44'),_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x42')]=_0x329018!==''?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);_0x3e7206[_0x53b6('0x45')]=_0x53b6('0x46');}else if(_0x34991a[_0x53b6('0x41')]===_0x53b6('0x1a')){logger['info'](_0x53b6('0x44'),_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x26')]=_0x329018!==_0x53b6('0x47')?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);}else{return null;}}return _0x574527[_0x53b6('0x1e')](_['upperFirst'](_0x34991a[_0x53b6('0x41')]))[_0x53b6('0x1f')](_0x3e7206)[_0x53b6('0x23')](function(_0xcc3fc4){return BPromise[_0x53b6('0x29')]({'id':_0xcc3fc4['id'],'endUserType':_0x34991a['moduleCreate']});});}});}function getCustomFields(_0xe769fa,_0xea8e1c){var _0x5d295f={};if(_0xe769fa[_0x53b6('0x33')]>0x0){_[_0x53b6('0x48')](_0xe769fa,function(_0x2f2dab){if(_[_0x53b6('0x49')](['string',_0x53b6('0x4a')],_0x2f2dab[_0x53b6('0x3d')])&&_0x2f2dab['idField']){_0x5d295f[_0x2f2dab[_0x53b6('0x4b')]]=_0x2f2dab[_0x53b6('0x4c')][_0x53b6('0x4d')]();}else if(_0x2f2dab['type']===_0x53b6('0x4e')&&_0x2f2dab['variableName']&&_0x2f2dab['idField']){_0xea8e1c[_0x2f2dab[_0x53b6('0x4f')]]&&(_0x5d295f[_0x2f2dab[_0x53b6('0x4b')]]=_0xea8e1c[_0x2f2dab[_0x53b6('0x4f')]][_0x53b6('0x4d')]());}else if(_0x2f2dab[_0x53b6('0x3d')]===_0x53b6('0x50')&&_0x2f2dab[_0x53b6('0x51')]&&_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')]&&_0x2f2dab['idField']){_0xea8e1c[_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')][_0x53b6('0x3e')]()]&&(_0x5d295f[_0x2f2dab['idField']]=_0xea8e1c[_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')][_0x53b6('0x3e')]()][_0x53b6('0x4d')]());}});}return _0x5d295f;}function getConnection(_0x7804c6){var _0x5ed6d1=_0x7804c6['password'][_0x53b6('0x53')](_0x7804c6[_0x53b6('0x54')]);var _0xa33880=new jsforce[(_0x53b6('0x55'))]({'oauth2':{'loginUrl':_0x7804c6[_0x53b6('0x56')]||_0x53b6('0x57'),'clientId':_0x7804c6['clientId'],'clientSecret':_0x7804c6[_0x53b6('0x58')]}});return _0xa33880[_0x53b6('0x59')](_0x7804c6['username'],_0x5ed6d1)[_0x53b6('0x23')](function(){logger[_0x53b6('0x2b')]('Connection\x20established.');return _0xa33880;});}exports[_0x53b6('0x5a')]=function(_0x1df9ef,_0x11a4ff,_0x2858b7,_0x352ea7,_0x30d874,_0x1bbd93){var _0x168782,_0x2d45aa,_0x4b7c0b,_0x34f7ea;_0x1bbd93[_0x53b6('0x5b')]=intUtil[_0x53b6('0x5c')](_0x1bbd93['serverUrl']);_0x1bbd93['remoteUri']=intUtil[_0x53b6('0x5c')](_0x1bbd93[_0x53b6('0x56')]);if(_0x30d874&&_0x30d874[_0x53b6('0x5d')]){logger[_0x53b6('0x2b')](_0x53b6('0x5e'),'Recording\x20is\x20enabled!');_0x11a4ff[_0x53b6('0x5f')]=util[_0x53b6('0x60')](_0x53b6('0x61'),_0x1bbd93[_0x53b6('0x5b')],_0x11a4ff[_0x53b6('0x62')],md5(_0x11a4ff[_0x53b6('0x62')]));}else{_0x11a4ff['recordingURL']='';}return getConnection(_0x1bbd93)[_0x53b6('0x23')](function(_0x1216ee){_0x34f7ea=_0x1216ee;return getUser(_0x1bbd93,_0x352ea7['email'],_0x34f7ea);})['then'](function(_0x377e60){_0x168782=_0x377e60;return getEndUser(_0x1bbd93,_0x2858b7,_0x11a4ff['calleridname'],_0x11a4ff[_0x53b6('0x63')],_0x34f7ea);})[_0x53b6('0x23')](function(_0x40e97f){_0x2d45aa=_0x40e97f;return getTicket(_0x1bbd93,_0x168782,_0x2d45aa,_0x2858b7,_0x11a4ff,_0x2858b7['Fields'],_0x34f7ea,_0x53b6('0x5a'));})['then'](function(_0x4eb16c){_0x4b7c0b=_0x4eb16c;logger[_0x53b6('0x2b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4b7c0b['id']);logger[_0x53b6('0x2b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4b7c0b['id'],_0x352ea7['name'],_0x1bbd93[_0x53b6('0x3d')]);switch(_0x1bbd93[_0x53b6('0x3d')]){case'integrationTab':emit(util['format'](_0x53b6('0x64'),_0x352ea7[_0x53b6('0x52')]),_0x53b6('0x65'),{'recordId':_0x4b7c0b['id']});break;case _0x53b6('0x66'):emit(util[_0x53b6('0x60')](_0x53b6('0x64'),_0x352ea7[_0x53b6('0x52')]),'trigger:browser:url',{'uri':util[_0x53b6('0x60')](_0x53b6('0x67'),_0x34f7ea['instanceUrl'],_0x4b7c0b['id'])});break;default:logger[_0x53b6('0x68')](_0x53b6('0x69'));}})[_0x53b6('0x6a')](function(_0x1beac5){logger[_0x53b6('0x68')](_0x53b6('0x5e'),_0x1beac5);});};exports['outbound']=function(_0x4d1f01,_0x1b0484,_0x2d2c1e,_0x48f420,_0x4a9152,_0x467b13,_0x73c327){var _0x4e0ec0,_0x4c444e,_0x47ed73,_0x15cec9;_0x467b13[_0x53b6('0x5b')]=intUtil[_0x53b6('0x5c')](_0x467b13['serverUrl']);_0x467b13[_0x53b6('0x56')]=intUtil['stripTrailingSlash'](_0x467b13[_0x53b6('0x56')]);if(_0x73c327&&_0x73c327['recordingFormat']&&_0x73c327[_0x53b6('0x6b')]!==_0x53b6('0x6c')){logger[_0x53b6('0x2b')](_0x53b6('0x6d'),_0x53b6('0x6e'));_0x1b0484['recordingURL']=util[_0x53b6('0x60')](_0x53b6('0x61'),_0x467b13[_0x53b6('0x5b')],_0x1b0484[_0x53b6('0x62')],md5(_0x1b0484[_0x53b6('0x62')]));}return getConnection(_0x467b13)[_0x53b6('0x23')](function(_0x8ce7a2){_0x15cec9=_0x8ce7a2;return getUser(_0x467b13,_0x48f420['email'],_0x15cec9);})[_0x53b6('0x23')](function(_0xa89fd1){_0x4e0ec0=_0xa89fd1;return getEndUser(_0x467b13,_0x2d2c1e,_0x1b0484[_0x53b6('0x6f')],_0x1b0484[_0x53b6('0x70')],_0x15cec9);})[_0x53b6('0x23')](function(_0x542d2b){_0x4c444e=_0x542d2b;return getTicket(_0x467b13,_0x4e0ec0,_0x4c444e,_0x2d2c1e,_0x1b0484,_0x2d2c1e[_0x53b6('0x71')],_0x15cec9,_0x53b6('0x72'));})['then'](function(_0x4f2be6){_0x47ed73=_0x4f2be6;logger['info'](_0x53b6('0x73'),_0x47ed73['id']);logger['info'](_0x53b6('0x74'),_0x47ed73['id'],_0x48f420['name'],_0x467b13[_0x53b6('0x3d')]);switch(_0x467b13[_0x53b6('0x3d')]){case _0x53b6('0x75'):emit(util[_0x53b6('0x60')]('user:%s',_0x48f420[_0x53b6('0x52')]),_0x53b6('0x65'),{'recordId':_0x47ed73['id']});break;case _0x53b6('0x66'):emit(util[_0x53b6('0x60')]('user:%s',_0x48f420[_0x53b6('0x52')]),'trigger:browser:url',{'uri':util[_0x53b6('0x60')]('%s/%s/e',_0x15cec9[_0x53b6('0x76')],_0x47ed73['id'])});break;default:logger[_0x53b6('0x68')](_0x53b6('0x6d'),_0x53b6('0x77'));}})[_0x53b6('0x6a')](function(_0x30dd9){logger[_0x53b6('0x68')](_0x53b6('0x6d'),_0x30dd9);});};exports['unmanaged']=function(_0x8e7496,_0x546866,_0x1ad88c,_0x1cffcd,_0x456bf6,_0x267728){var _0x27a108,_0x356746,_0x1c48fd,_0x1b5c31;_0x267728['serverUrl']=intUtil[_0x53b6('0x5c')](_0x267728['serverUrl']);_0x267728[_0x53b6('0x56')]=intUtil[_0x53b6('0x5c')](_0x267728[_0x53b6('0x56')]);if(_0x456bf6&&_0x456bf6[_0x53b6('0x5d')]){logger['info']('['+_0x546866[_0x53b6('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x546866['recordingURL']=util[_0x53b6('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x267728[_0x53b6('0x5b')],_0x546866[_0x53b6('0x62')],md5(_0x546866[_0x53b6('0x62')]));}else{_0x546866['recordingURL']='';}return getConnection(_0x267728)[_0x53b6('0x23')](function(_0x48af3d){_0x1b5c31=_0x48af3d;if(!_[_0x53b6('0x79')](_0x1cffcd)){return getUser(_0x267728,_0x1cffcd[_0x53b6('0x52')],_0x1b5c31);}else{return getUser(_0x267728,null,_0x1b5c31);}})[_0x53b6('0x23')](function(_0x361c7b){_0x27a108=_0x361c7b;return getEndUser(_0x267728,_0x1ad88c,_0x546866['calleridname'],_0x546866[_0x53b6('0x63')],_0x1b5c31);})['then'](function(_0x4bf288){_0x356746=_0x4bf288;return getTicket(_0x267728,_0x27a108,_0x356746,_0x1ad88c,_0x546866,_0x1ad88c[_0x53b6('0x71')],_0x1b5c31);})['then'](function(_0x48fb9c){_0x1c48fd=_0x48fb9c;logger[_0x53b6('0x2b')]('['+_0x546866[_0x53b6('0x78')]['toUpperCase']()+_0x53b6('0x7a'),_0x1c48fd['id']);logger['info']('['+_0x546866['lastevent'][_0x53b6('0x7b')]()+_0x53b6('0x7c'),_0x267728[_0x53b6('0x3d')]);})['catch'](function(_0x407870){logger[_0x53b6('0x68')]('['+_0x546866[_0x53b6('0x78')][_0x53b6('0x7b')]()+']',_0x407870);});}; \ 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 a173770..35032fe 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 _0x7429=['uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','forEach','push','all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7429,0x6f));var _0x9742=function(_0x50ec7a,_0x309d3a){_0x50ec7a=_0x50ec7a-0x0;var _0x5af71e=_0x7429[_0x50ec7a];return _0x5af71e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x9742('0x0'));var util=require('util');var md5=require(_0x9742('0x1'));var Redis=require(_0x9742('0x2'));var intUtil=require('./util');var config=require(_0x9742('0x3'));var logger=require(_0x9742('0x4'))(_0x9742('0x5'));config[_0x9742('0x6')]=_[_0x9742('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9742('0x8'))(new Redis(config[_0x9742('0x6')]));function getAdminUser(_0x4ead4b,_0x240a9f,_0x257625,_0x5af649,_0x3ceed4,_0x169d64){return new Promise(function(_0x1ce654,_0x57107f){var _0xa507f9={'method':'GET','uri':_0x5af649+_0x9742('0x9')+'&'+_0x3ceed4+'&'+_0x169d64,'auth':_0x240a9f,'json':!![]};return rp(_0xa507f9)[_0x9742('0xa')](function(_0x58a1bd){if(_0x58a1bd[_0x9742('0xb')][_0x9742('0xc')]>0x0){_0x257625[_0x9742('0xd')]=_0x58a1bd['result'][0x0][_0x9742('0xe')];}logger[_0x9742('0xf')]('['+[_0x4ead4b[_0x9742('0x10')]()]+'],\x20getAdminUser\x20crm',_0x257625);_0x1ce654(_0x257625);})[_0x9742('0x11')](function(_0x2055d3){logger['error']('['+[_0x4ead4b[_0x9742('0x10')]()]+']',_0x2055d3[_0x9742('0x12')]);_0x57107f(_0x2055d3[_0x9742('0x12')]);});});}function getUser(_0x31160a,_0x674b9f,_0x50af96,_0x2bb5b1,_0x4d69d5){return function(_0x6f4f13){logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x13'),_0x6f4f13);return new Promise(function(_0x416614,_0x58c895){if(intUtil['validateEmail'](_0x6f4f13[_0x9742('0x14')])){var _0x4beb18={'method':_0x9742('0x15'),'uri':_0x50af96+_0x9742('0x16')+_0x6f4f13[_0x9742('0x14')]+'&'+_0x2bb5b1+'&'+_0x4d69d5,'auth':_0x674b9f,'json':!![]};logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x17'),_0x4beb18);return rp(_0x4beb18)[_0x9742('0xa')](function(_0x7c4c69){logger['info']('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x18'),_0x7c4c69);if(_0x7c4c69[_0x9742('0xb')][_0x9742('0xc')]>0x0&&String(_0x7c4c69['result'][0x0][_0x9742('0x19')])===_0x9742('0x1a')){_0x6f4f13['userId']=_0x7c4c69[_0x9742('0xb')][0x0][_0x9742('0xe')];}else{_0x6f4f13[_0x9742('0x1b')]=_0x6f4f13['adminId'];_0x6f4f13[_0x9742('0x14')]=_0x6f4f13['adminEmail'];}logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x1c'),_0x6f4f13);_0x416614(_0x6f4f13);})[_0x9742('0x11')](function(_0x2242de){logger[_0x9742('0x1d')]('['+[_0x31160a[_0x9742('0x10')]()]+']',_0x2242de['message']);_0x58c895(_0x2242de[_0x9742('0x12')]);});}else{logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x1e'));_0x6f4f13['userId']=_0x6f4f13['adminId'];_0x6f4f13[_0x9742('0x14')]=_0x6f4f13[_0x9742('0x1f')];_0x416614(_0x6f4f13);}});};}function createEndUser(_0x4b25b7,_0x4a2040,_0x4b237b,_0x25c237,_0x35dd19){logger['info']('['+[_0x4b25b7['toUpperCase']()]+_0x9742('0x20'),_0x4b237b);return new Promise(function(_0x4af874,_0x44cd8a){var _0x4d3778={'method':_0x9742('0x21'),'uri':_0x25c237+_0x9742('0x22')+_0x35dd19,'body':{'user_name':_0x4b237b[_0x9742('0x23')],'roles':_0x9742('0x24'),'first_name':_0x4b237b[_0x9742('0x23')],'active':_0x9742('0x1a'),'date_format':_0x9742('0x25'),'phone':_0x4b237b['endUserNumber']},'auth':_0x4a2040,'json':!![]};return rp(_0x4d3778)[_0x9742('0xa')](function(_0x49d1d1){logger[_0x9742('0xf')]('['+[_0x4b25b7[_0x9742('0x10')]()]+_0x9742('0x26'),_0x49d1d1[_0x9742('0xb')]);_0x4b237b[_0x9742('0x27')]=_0x49d1d1[_0x9742('0xb')][_0x9742('0xe')];_0x4af874(_0x4b237b);})[_0x9742('0x11')](function(_0xa5d889){logger[_0x9742('0x1d')]('['+[_0x4b25b7[_0x9742('0x10')]()]+']',_0xa5d889[_0x9742('0x12')]);_0x44cd8a(_0xa5d889['message']);});});}function getEndUser(_0x20d6af,_0x461b27,_0x29c257,_0x2b9c8d,_0x33b259){return function(_0x29541a){logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+_0x9742('0x28'),_0x29541a);return new Promise(function(_0x49da32,_0xb17eec){var _0x4c755c={'method':_0x9742('0x15'),'uri':_0x29c257+_0x9742('0x29')+_0x29541a['endUserNumber']+'&'+_0x2b9c8d+'&'+_0x33b259,'auth':_0x461b27,'json':!![]};return rp(_0x4c755c)[_0x9742('0xa')](function(_0x44bf1e){if(_0x44bf1e[_0x9742('0xb')][_0x9742('0xc')]>0x0){_0x29541a['endUserId']=_0x44bf1e['result'][0x0][_0x9742('0xe')];logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+_0x9742('0x2a'),_0x29541a);_0x49da32(_0x29541a);}else{return createEndUser(_0x20d6af,_0x461b27,_0x29541a,_0x29c257,_0x2b9c8d)['then'](function(_0x22c45c){logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+'],\x20createEndUser\x20crm',_0x22c45c);_0x49da32(_0x22c45c);});}})[_0x9742('0x11')](function(_0x30760e){logger[_0x9742('0x1d')]('['+[_0x20d6af[_0x9742('0x10')]()]+']',_0x30760e[_0x9742('0x12')]);_0xb17eec(_0x30760e[_0x9742('0x12')]);});});};}function getCustomFields(_0xf3cf17,_0x496ae8){var _0xbbe310={};if(_0xf3cf17[_0x9742('0xc')]>0x0){_['forEach'](_0xf3cf17,function(_0x11ee0c){if(_[_0x9742('0x2b')]([_0x9742('0x2c'),_0x9742('0x2d')],_0x11ee0c['type'])&&_0x11ee0c[_0x9742('0x2e')]&&!_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x2e')][_0x9742('0x30')]()]=_0x11ee0c[_0x9742('0x31')][_0x9742('0x32')]();}else if(_[_0x9742('0x2b')]([_0x9742('0x2c'),'picklist'],_0x11ee0c[_0x9742('0x33')])&&_0x11ee0c['idField']&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x11ee0c[_0x9742('0x31')][_0x9742('0x32')]();}else if(_0x11ee0c[_0x9742('0x33')]==='variable'&&_0x11ee0c[_0x9742('0x35')]&&_0x11ee0c[_0x9742('0x34')]&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x496ae8[_0x11ee0c[_0x9742('0x35')]][_0x9742('0x32')]();}else if(_0x11ee0c[_0x9742('0x33')]==='customVariable'&&_0x11ee0c[_0x9742('0x36')]&&_0x11ee0c[_0x9742('0x36')][_0x9742('0x37')]&&_0x11ee0c[_0x9742('0x34')]&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x496ae8[_0x11ee0c[_0x9742('0x36')][_0x9742('0x37')]['toLowerCase']()][_0x9742('0x32')]();}});}return _0xbbe310;}function getTicket(_0x1039e3,_0x4c638a,_0x62c526,_0x1b89e9,_0x5218da,_0x525dbd){return function(_0x94210a){logger[_0x9742('0xf')]('['+[_0x1039e3[_0x9742('0x10')]()]+_0x9742('0x38'),_0x94210a);return new Promise(function(_0x500f4b,_0x32d0f6){var _0x3bf825=_0x1039e3[_0x9742('0x30')]()===_0x9742('0x39')?_0x94210a[_0x9742('0x1b')]:_0x94210a[_0x9742('0x27')];var _0x4d3509={'method':_0x9742('0x21'),'uri':_0x62c526+_0x9742('0x3a')+'?'+_0x525dbd,'body':Object[_0x9742('0x3b')]({},{'active':'true','caller_id':_0x3bf825,'assigned_to':_0x94210a[_0x9742('0x1b')],'short_description':intUtil[_0x9742('0x3c')](_0x1b89e9[_0x9742('0x3d')],_0x5218da,'\x20'),'description':intUtil[_0x9742('0x3c')](_0x1b89e9[_0x9742('0x3e')],_0x5218da,'\x0a')},getCustomFields(_0x1b89e9['Fields'],_0x5218da)),'auth':_0x4c638a,'json':!![]};return rp(_0x4d3509)[_0x9742('0xa')](function(_0x59a2fe){logger['info']('['+[_0x1039e3[_0x9742('0x10')]()]+_0x9742('0x3f'),_0x59a2fe['result']);_0x94210a[_0x9742('0x40')]=_0x59a2fe['result'][_0x9742('0xe')];_0x94210a[_0x9742('0x41')]=_0x59a2fe['result'][_0x9742('0x42')];logger[_0x9742('0xf')]('['+[_0x1039e3[_0x9742('0x10')]()]+']\x20getTicket\x20crm',_0x94210a);_0x500f4b(_0x94210a);})[_0x9742('0x11')](function(_0x3b2be5){logger[_0x9742('0x1d')]('['+[_0x1039e3[_0x9742('0x10')]()]+']',_0x3b2be5['message']);_0x32d0f6(_0x3b2be5['message']);});});};}function createRemoteTag(_0x39fcb0,_0x3e8d23,_0x165d85,_0x65f0d3){return new Promise(function(_0x18d3ea,_0x2eb7d4){var _0x202e82={'method':_0x9742('0x21'),'uri':_0x165d85+'label'+'?'+_0x65f0d3,'body':{'short_description':_0x39fcb0,'global':!![],'active':!![],'name':_0x39fcb0},'auth':_0x3e8d23,'json':!![]};return rp(_0x202e82)[_0x9742('0xa')](function(_0x3999e4){var _0x4a57dc=_0x3999e4[_0x9742('0xb')][_0x9742('0xe')];_0x18d3ea(_0x4a57dc);});});}function getRemoteTag(_0xc5884e,_0x59daee,_0xe26c53,_0x532561,_0x1f02d4){return new Promise(function(_0x51c3b0,_0x7a88a4){var _0xb738f6={'method':_0x9742('0x15'),'uri':_0xe26c53+_0x9742('0x43')+_0x9742('0x44')+_0xc5884e+'&'+_0x532561,'auth':_0x59daee,'json':!![]};return rp(_0xb738f6)[_0x9742('0xa')](function(_0x2ccfb2){if(_0x2ccfb2[_0x9742('0xb')]['length']>0x0){var _0x49a21d=_0x2ccfb2[_0x9742('0xb')][0x0][_0x9742('0xe')];_0x51c3b0(_0x49a21d);}else{return createRemoteTag(_0xc5884e,_0x59daee,_0xe26c53,_0x532561)[_0x9742('0xa')](function(_0x37927e){_0x51c3b0(_0x37927e);});}});});}function assignTagToIncident(_0x130cb2,_0x56e64e,_0x394d8b,_0x5d7129,_0x3d4781){return new Promise(function(_0x3d3c84,_0x1539b9){var _0x160ecb={'method':_0x9742('0x21'),'uri':_0x394d8b+'label_entry'+'?'+_0x3d4781,'body':{'label':_0x130cb2,'table':_0x9742('0x3a'),'id_type':_0x9742('0x45'),'table_key':_0x5d7129[_0x9742('0x40')],'title':_0x9742('0x46')+_0x5d7129[_0x9742('0x41')],'id_display':_0x5d7129[_0x9742('0x41')]},'auth':_0x56e64e,'json':!![]};return rp(_0x160ecb)[_0x9742('0xa')](function(_0x40057a){_0x3d3c84();})[_0x9742('0x11')](function(){_0x3d3c84();});});}function manageTags(_0xc0975d,_0x5dce74,_0x44607e,_0x25d456,_0x454572,_0x403d49,_0x1642a2){return new Promise(function(_0x11c3f7,_0x2f270a){var _0x2bf802=[];_0x5dce74[_0x9742('0x47')](function(_0x5c3cb9){_0x2bf802[_0x9742('0x48')](getRemoteTag(_0x5c3cb9,_0x44607e,_0x25d456,_0x403d49,_0x1642a2));});return Promise[_0x9742('0x49')](_0x2bf802)['then'](function(_0x4dd7d6){if(_0x4dd7d6[_0x9742('0xc')]){logger['info']('['+[_0xc0975d[_0x9742('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4dd7d6);var _0x5cb862=[];_0x4dd7d6[_0x9742('0x47')](function(_0x1eabc8){_0x5cb862['push'](assignTagToIncident(_0x1eabc8,_0x44607e,_0x25d456,_0x454572,_0x403d49));});return Promise['all'](_0x5cb862)[_0x9742('0xa')](function(){_0x11c3f7();})[_0x9742('0x11')](function(){_0x11c3f7();});}else{_0x11c3f7();}});});}function getTags(_0x11b360,_0x564cd5,_0x3c16a4,_0xc8bf8d,_0x5e2fb3,_0x2fb04c){return function(_0x33b788){return new Promise(function(_0x564481,_0x1f9c54){var _0x794c29=[];var _0x414b5f=_0xc8bf8d['Tags'];if(_0x414b5f&&_0x414b5f[_0x9742('0xc')]>0x0){_0x794c29=_['map'](_0x414b5f,_0x9742('0x37'));}if(_0x794c29['length']>0x0){return manageTags(_0x11b360,_0x794c29,_0x564cd5,_0x3c16a4,_0x33b788,_0x5e2fb3,_0x2fb04c)[_0x9742('0xa')](function(){_0x564481(_0x33b788);});}else{_0x564481(_0x33b788);}});};}function emit(_0x4ee00a,_0x42c61c,_0x3da4d8){var _0x1971e9=_0x9742('0x4a')+_0x9742('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x9742('0x4c');var _0x1b7d17={'uri':_0x4ee00a+_0x9742('0x4d')+_0x3da4d8+_0x1971e9};io['to'](util[_0x9742('0x4e')](_0x9742('0x4f'),_0x42c61c))['emit'](_0x9742('0x50'),_0x1b7d17);}exports['cs']=function(_0xe17165,_0x323c9d,_0x2bf46d,_0x2ac2e8,_0x515eaf,_0x1f6797,_0x3e097a,_0x376de3){var _0xf2e934={};var _0x1c66b7={'user':_0x1f6797['username'],'pass':_0x1f6797[_0x9742('0x51')]};var _0xe4c755=_0x9742('0x52');var _0x17fedb=_0x9742('0x53');_0x1f6797[_0x9742('0x54')]=intUtil['stripTrailingSlash'](_0x1f6797[_0x9742('0x54')]);_0x1f6797[_0x9742('0x55')]=intUtil['stripTrailingSlash'](_0x1f6797[_0x9742('0x55')]);var _0x432c2c=util[_0x9742('0x4e')]('%s/api/now/table/',_0x1f6797[_0x9742('0x54')]);_0xf2e934[_0x9742('0x14')]=!_[_0x9742('0x56')](_0x2ac2e8)?_0x2ac2e8['email']:null;_0xf2e934[_0x9742('0x1f')]=_0x1f6797[_0x9742('0x57')];_0xf2e934[_0x9742('0x23')]=_0x376de3[_0x9742('0x30')]()==='outbound'?_0x323c9d[_0x9742('0x58')]:_0x323c9d[_0x9742('0x59')];_0xf2e934['callDirection']=_0x376de3==='queue'||_0x376de3===_0x9742('0x5a')?_0x9742('0x5b'):_0x9742('0x39');var _0x2cf4d9=util[_0x9742('0x4e')](_0x9742('0x5c'),_0x1f6797['serverUrl'],_0x323c9d[_0x9742('0x5d')],md5(_0x323c9d['uniqueid']));if(_0x515eaf&&_0x515eaf['monitor_format']){logger[_0x9742('0xf')]('[QUEUE]',_0x9742('0x5e'));_0x323c9d[_0x9742('0x5f')]=_0x2cf4d9;}else if(_0x3e097a&&_0x3e097a[_0x9742('0x60')]&&_0x3e097a[_0x9742('0x60')]!==_0x9742('0x61')){logger[_0x9742('0xf')](_0x9742('0x62'),_0x9742('0x5e'));_0x323c9d['recordingURL']=_0x2cf4d9;}else{_0x323c9d[_0x9742('0x5f')]='';}return getAdminUser(_0x376de3,_0x1c66b7,_0xf2e934,_0x432c2c,_0x17fedb,_0xe4c755)[_0x9742('0xa')](getUser(_0x376de3,_0x1c66b7,_0x432c2c,_0x17fedb,_0xe4c755))[_0x9742('0xa')](getEndUser(_0x376de3,_0x1c66b7,_0x432c2c,_0x17fedb,_0xe4c755))['then'](getTicket(_0x376de3,_0x1c66b7,_0x432c2c,_0x2bf46d,_0x323c9d,_0x17fedb))['then'](function(_0x593c94){logger['info'](util[_0x9742('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x593c94[_0x9742('0x40')]));logger['info'](util[_0x9742('0x4e')]('call\x20direction:\x20%s',_0x376de3));if(_0x376de3!==_0x9742('0x5a')){logger['info']('['+[_0x376de3[_0x9742('0x10')]()]+']',_0x9742('0x63'));emit(_0x1f6797[_0x9742('0x54')],_0x2ac2e8[_0x9742('0x37')],_0x593c94[_0x9742('0x40')]);}})['catch'](function(_0x114fa5){logger[_0x9742('0x1d')]('['+[_0x376de3[_0x9742('0x10')]()]+_0x9742('0x64'),util[_0x9742('0x65')](_0x114fa5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3f84=['number','POST','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','util','md5','ioredis','./util','../../../../config/environment','servicenow','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','idField','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0x32c813,_0xf88851){var _0x5c5879=function(_0x5df10f){while(--_0x5df10f){_0x32c813['push'](_0x32c813['shift']());}};_0x5c5879(++_0xf88851);}(_0x3f84,0x1c0));var _0x43f8=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0x3f84[_0x526046];return _0x5b92a2;};'use strict';var _=require(_0x43f8('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x43f8('0x1'));var md5=require(_0x43f8('0x2'));var Redis=require(_0x43f8('0x3'));var intUtil=require(_0x43f8('0x4'));var config=require(_0x43f8('0x5'));var logger=require('../../../../config/logger')(_0x43f8('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x43f8('0x7'))(new Redis(config[_0x43f8('0x8')]));function getAdminUser(_0x35b818,_0x307753,_0x496e77,_0x5450d9,_0x91e5bc,_0x4cc782){return new Promise(function(_0x38145e,_0x5c936f){var _0x35976d={'method':_0x43f8('0x9'),'uri':_0x5450d9+_0x43f8('0xa')+'&'+_0x91e5bc+'&'+_0x4cc782,'auth':_0x307753,'json':!![]};return rp(_0x35976d)[_0x43f8('0xb')](function(_0x4144d8){if(_0x4144d8[_0x43f8('0xc')][_0x43f8('0xd')]>0x0){_0x496e77[_0x43f8('0xe')]=_0x4144d8[_0x43f8('0xc')][0x0][_0x43f8('0xf')];}logger[_0x43f8('0x10')]('['+[_0x35b818['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x496e77);_0x38145e(_0x496e77);})['catch'](function(_0x4a6e5b){logger[_0x43f8('0x11')]('['+[_0x35b818[_0x43f8('0x12')]()]+']',_0x4a6e5b[_0x43f8('0x13')]);_0x5c936f(_0x4a6e5b[_0x43f8('0x13')]);});});}function getUser(_0x586a35,_0x4c1e44,_0x27df2b,_0x21c65d,_0x45d586){return function(_0x4f6721){logger['info']('['+[_0x586a35[_0x43f8('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x4f6721);return new Promise(function(_0x4aae58,_0x30aca5){if(intUtil[_0x43f8('0x14')](_0x4f6721[_0x43f8('0x15')])){var _0x132d14={'method':'GET','uri':_0x27df2b+_0x43f8('0x16')+_0x4f6721[_0x43f8('0x15')]+'&'+_0x21c65d+'&'+_0x45d586,'auth':_0x4c1e44,'json':!![]};logger['info']('['+[_0x586a35['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x132d14);return rp(_0x132d14)[_0x43f8('0xb')](function(_0x302200){logger[_0x43f8('0x10')]('['+[_0x586a35['toUpperCase']()]+'],\x20getUser\x20entity',_0x302200);if(_0x302200[_0x43f8('0xc')][_0x43f8('0xd')]>0x0&&String(_0x302200['result'][0x0][_0x43f8('0x17')])===_0x43f8('0x18')){_0x4f6721[_0x43f8('0x19')]=_0x302200[_0x43f8('0xc')][0x0]['sys_id'];}else{_0x4f6721[_0x43f8('0x19')]=_0x4f6721[_0x43f8('0xe')];_0x4f6721[_0x43f8('0x15')]=_0x4f6721[_0x43f8('0x1a')];}logger['info']('['+[_0x586a35['toUpperCase']()]+_0x43f8('0x1b'),_0x4f6721);_0x4aae58(_0x4f6721);})[_0x43f8('0x1c')](function(_0x58c679){logger[_0x43f8('0x11')]('['+[_0x586a35[_0x43f8('0x12')]()]+']',_0x58c679[_0x43f8('0x13')]);_0x30aca5(_0x58c679[_0x43f8('0x13')]);});}else{logger[_0x43f8('0x10')]('['+[_0x586a35['toUpperCase']()]+_0x43f8('0x1d'));_0x4f6721[_0x43f8('0x19')]=_0x4f6721[_0x43f8('0xe')];_0x4f6721[_0x43f8('0x15')]=_0x4f6721[_0x43f8('0x1a')];_0x4aae58(_0x4f6721);}});};}function createEndUser(_0x5d4e42,_0xf4925c,_0x25eff1,_0x52af51,_0x19a84d){logger[_0x43f8('0x10')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+_0x43f8('0x1e'),_0x25eff1);return new Promise(function(_0x310554,_0x5bd4ee){var _0x5574b5={'method':'POST','uri':_0x52af51+_0x43f8('0x1f')+_0x19a84d,'body':{'user_name':_0x25eff1['endUserNumber'],'roles':'user','first_name':_0x25eff1[_0x43f8('0x20')],'active':'true','date_format':'System','phone':_0x25eff1[_0x43f8('0x20')]},'auth':_0xf4925c,'json':!![]};return rp(_0x5574b5)[_0x43f8('0xb')](function(_0x20b569){logger[_0x43f8('0x10')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+_0x43f8('0x21'),_0x20b569[_0x43f8('0xc')]);_0x25eff1[_0x43f8('0x22')]=_0x20b569['result']['sys_id'];_0x310554(_0x25eff1);})[_0x43f8('0x1c')](function(_0x3cff0a){logger[_0x43f8('0x11')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+']',_0x3cff0a[_0x43f8('0x13')]);_0x5bd4ee(_0x3cff0a[_0x43f8('0x13')]);});});}function getEndUser(_0x358d5f,_0x5b9294,_0x158e00,_0x4f2f08,_0x3331f4){return function(_0x410299){logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x23'),_0x410299);return new Promise(function(_0x1f0f69,_0x278c44){var _0x5c984c={'method':_0x43f8('0x9'),'uri':_0x158e00+_0x43f8('0x24')+_0x410299[_0x43f8('0x20')]+'&'+_0x4f2f08+'&'+_0x3331f4,'auth':_0x5b9294,'json':!![]};return rp(_0x5c984c)['then'](function(_0x5a4378){if(_0x5a4378['result'][_0x43f8('0xd')]>0x0){_0x410299[_0x43f8('0x22')]=_0x5a4378['result'][0x0]['sys_id'];logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x25'),_0x410299);_0x1f0f69(_0x410299);}else{return createEndUser(_0x358d5f,_0x5b9294,_0x410299,_0x158e00,_0x4f2f08)[_0x43f8('0xb')](function(_0x23738c){logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x26'),_0x23738c);_0x1f0f69(_0x23738c);});}})[_0x43f8('0x1c')](function(_0x804014){logger[_0x43f8('0x11')]('['+[_0x358d5f['toUpperCase']()]+']',_0x804014[_0x43f8('0x13')]);_0x278c44(_0x804014['message']);});});};}function getCustomFields(_0x3e1097,_0x409107){var _0x340c7a={};if(_0x3e1097[_0x43f8('0xd')]>0x0){_['forEach'](_0x3e1097,function(_0x1a9de6){if(_[_0x43f8('0x27')]([_0x43f8('0x28'),_0x43f8('0x29')],_0x1a9de6[_0x43f8('0x2a')])&&_0x1a9de6[_0x43f8('0x2b')]&&!_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2b')]['toLowerCase']()]=_0x1a9de6['content']['toString']();}else if(_[_0x43f8('0x27')]([_0x43f8('0x28'),'picklist'],_0x1a9de6[_0x43f8('0x2a')])&&_0x1a9de6['idField']&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')]['toLowerCase']()]=_0x1a9de6['content']['toString']();}else if(_0x1a9de6[_0x43f8('0x2a')]==='variable'&&_0x1a9de6['variableName']&&_0x1a9de6[_0x43f8('0x2c')]&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')][_0x43f8('0x2d')]()]=_0x409107[_0x1a9de6['variableName']]['toString']();}else if(_0x1a9de6[_0x43f8('0x2a')]==='customVariable'&&_0x1a9de6['Variable']&&_0x1a9de6[_0x43f8('0x2e')][_0x43f8('0x2f')]&&_0x1a9de6[_0x43f8('0x2c')]&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')][_0x43f8('0x2d')]()]=_0x409107[_0x1a9de6['Variable'][_0x43f8('0x2f')][_0x43f8('0x2d')]()]['toString']();}});}return _0x340c7a;}function getTicket(_0x2c3fa7,_0x237f39,_0x1d8f3e,_0x18aa75,_0x54fc46,_0x54b5ff){return function(_0x32a78d){logger[_0x43f8('0x10')]('['+[_0x2c3fa7[_0x43f8('0x12')]()]+_0x43f8('0x30'),_0x32a78d);return new Promise(function(_0x26c938,_0x4c5244){var _0x8daaeb=_0x2c3fa7['toLowerCase']()===_0x43f8('0x31')?_0x32a78d[_0x43f8('0x19')]:_0x32a78d['endUserId'];var _0x4c4671={'method':'POST','uri':_0x1d8f3e+_0x43f8('0x32')+'?'+_0x54b5ff,'body':Object[_0x43f8('0x33')]({},{'active':_0x43f8('0x18'),'caller_id':_0x8daaeb,'assigned_to':_0x32a78d[_0x43f8('0x19')],'short_description':intUtil['getString'](_0x18aa75[_0x43f8('0x34')],_0x54fc46,'\x20'),'description':intUtil[_0x43f8('0x35')](_0x18aa75['Descriptions'],_0x54fc46,'\x0a')},getCustomFields(_0x18aa75[_0x43f8('0x36')],_0x54fc46)),'auth':_0x237f39,'json':!![]};return rp(_0x4c4671)[_0x43f8('0xb')](function(_0x5b4e34){logger[_0x43f8('0x10')]('['+[_0x2c3fa7[_0x43f8('0x12')]()]+_0x43f8('0x37'),_0x5b4e34[_0x43f8('0xc')]);_0x32a78d[_0x43f8('0x38')]=_0x5b4e34['result']['sys_id'];_0x32a78d['ticketNumber']=_0x5b4e34[_0x43f8('0xc')][_0x43f8('0x39')];logger[_0x43f8('0x10')]('['+[_0x2c3fa7['toUpperCase']()]+']\x20getTicket\x20crm',_0x32a78d);_0x26c938(_0x32a78d);})[_0x43f8('0x1c')](function(_0x41ed74){logger[_0x43f8('0x11')]('['+[_0x2c3fa7['toUpperCase']()]+']',_0x41ed74[_0x43f8('0x13')]);_0x4c5244(_0x41ed74[_0x43f8('0x13')]);});});};}function createRemoteTag(_0x31ba46,_0x51c255,_0x1642e8,_0x44d6d8){return new Promise(function(_0x1e7cb2,_0x507a07){var _0x5db0f3={'method':_0x43f8('0x3a'),'uri':_0x1642e8+_0x43f8('0x3b')+'?'+_0x44d6d8,'body':{'short_description':_0x31ba46,'global':!![],'active':!![],'name':_0x31ba46},'auth':_0x51c255,'json':!![]};return rp(_0x5db0f3)['then'](function(_0x3dd11f){var _0x76f63b=_0x3dd11f['result'][_0x43f8('0xf')];_0x1e7cb2(_0x76f63b);});});}function getRemoteTag(_0x4a5410,_0x51d93a,_0x35813b,_0x312945,_0x5757be){return new Promise(function(_0x1af400,_0x1c64fe){var _0x1a0e0f={'method':_0x43f8('0x9'),'uri':_0x35813b+_0x43f8('0x3b')+_0x43f8('0x3c')+_0x4a5410+'&'+_0x312945,'auth':_0x51d93a,'json':!![]};return rp(_0x1a0e0f)['then'](function(_0x38c24a){if(_0x38c24a[_0x43f8('0xc')][_0x43f8('0xd')]>0x0){var _0x21be5d=_0x38c24a[_0x43f8('0xc')][0x0][_0x43f8('0xf')];_0x1af400(_0x21be5d);}else{return createRemoteTag(_0x4a5410,_0x51d93a,_0x35813b,_0x312945)[_0x43f8('0xb')](function(_0x2ed816){_0x1af400(_0x2ed816);});}});});}function assignTagToIncident(_0xd6261a,_0x2bd2c4,_0x8d76d2,_0x3fa584,_0x309139){return new Promise(function(_0x295c95,_0x14a5fd){var _0x4313da={'method':_0x43f8('0x3a'),'uri':_0x8d76d2+'label_entry'+'?'+_0x309139,'body':{'label':_0xd6261a,'table':_0x43f8('0x32'),'id_type':_0x43f8('0x3d'),'table_key':_0x3fa584[_0x43f8('0x38')],'title':_0x43f8('0x3e')+_0x3fa584[_0x43f8('0x3f')],'id_display':_0x3fa584['ticketNumber']},'auth':_0x2bd2c4,'json':!![]};return rp(_0x4313da)[_0x43f8('0xb')](function(_0x49d244){_0x295c95();})[_0x43f8('0x1c')](function(){_0x295c95();});});}function manageTags(_0x29fe30,_0x16959a,_0x277089,_0x823fb,_0xcfd92e,_0x4a1ff8,_0x53aab8){return new Promise(function(_0x1330ed,_0xf2f6da){var _0x5f284e=[];_0x16959a[_0x43f8('0x40')](function(_0x325819){_0x5f284e['push'](getRemoteTag(_0x325819,_0x277089,_0x823fb,_0x4a1ff8,_0x53aab8));});return Promise['all'](_0x5f284e)['then'](function(_0x28f4eb){if(_0x28f4eb['length']){logger[_0x43f8('0x10')]('['+[_0x29fe30[_0x43f8('0x12')]()]+_0x43f8('0x41'),_0x28f4eb);var _0x35a13a=[];_0x28f4eb[_0x43f8('0x40')](function(_0x24ac8d){_0x35a13a[_0x43f8('0x42')](assignTagToIncident(_0x24ac8d,_0x277089,_0x823fb,_0xcfd92e,_0x4a1ff8));});return Promise[_0x43f8('0x43')](_0x35a13a)['then'](function(){_0x1330ed();})[_0x43f8('0x1c')](function(){_0x1330ed();});}else{_0x1330ed();}});});}function getTags(_0x35b0b6,_0x5164b3,_0x6306ed,_0x33d999,_0x5e3030,_0x41d7ea){return function(_0x37f217){return new Promise(function(_0x3748c7,_0x260fb4){var _0x30d50c=[];var _0x280b73=_0x33d999[_0x43f8('0x44')];if(_0x280b73&&_0x280b73[_0x43f8('0xd')]>0x0){_0x30d50c=_[_0x43f8('0x45')](_0x280b73,_0x43f8('0x2f'));}if(_0x30d50c['length']>0x0){return manageTags(_0x35b0b6,_0x30d50c,_0x5164b3,_0x6306ed,_0x37f217,_0x5e3030,_0x41d7ea)['then'](function(){_0x3748c7(_0x37f217);});}else{_0x3748c7(_0x37f217);}});};}function emit(_0x23d907,_0x14bb6f,_0x29346e){var _0x14ac88=_0x43f8('0x46')+_0x43f8('0x47')+_0x43f8('0x48')+_0x43f8('0x49');var _0x272e06={'uri':_0x23d907+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x29346e+_0x14ac88};io['to'](util[_0x43f8('0x4a')](_0x43f8('0x4b'),_0x14bb6f))[_0x43f8('0x4c')](_0x43f8('0x4d'),_0x272e06);}exports['cs']=function(_0x55121e,_0x4cb3,_0xcb9622,_0x49af14,_0x3c6eae,_0x164d54,_0x18fdda,_0xcb6bb2){var _0x57cc5a={};var _0x3ca036={'user':_0x164d54[_0x43f8('0x4e')],'pass':_0x164d54[_0x43f8('0x4f')]};var _0x5b8684=_0x43f8('0x50');var _0x427809=_0x43f8('0x51');_0x164d54[_0x43f8('0x52')]=intUtil[_0x43f8('0x53')](_0x164d54['remoteUri']);_0x164d54['serverUrl']=intUtil[_0x43f8('0x53')](_0x164d54[_0x43f8('0x54')]);var _0x229426=util[_0x43f8('0x4a')](_0x43f8('0x55'),_0x164d54[_0x43f8('0x52')]);_0x57cc5a[_0x43f8('0x15')]=!_[_0x43f8('0x56')](_0x49af14)?_0x49af14[_0x43f8('0x57')]:null;_0x57cc5a[_0x43f8('0x1a')]=_0x164d54[_0x43f8('0x57')];_0x57cc5a[_0x43f8('0x20')]=_0xcb6bb2['toLowerCase']()===_0x43f8('0x31')?_0x4cb3[_0x43f8('0x58')]:_0x4cb3[_0x43f8('0x59')];_0x57cc5a['callDirection']=_0xcb6bb2==='queue'||_0xcb6bb2===_0x43f8('0x5a')?_0x43f8('0x5b'):_0x43f8('0x31');var _0x456382=util[_0x43f8('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x164d54['serverUrl'],_0x4cb3['uniqueid'],md5(_0x4cb3[_0x43f8('0x5c')]));if(_0x3c6eae&&_0x3c6eae[_0x43f8('0x5d')]){logger['info'](_0x43f8('0x5e'),_0x43f8('0x5f'));_0x4cb3[_0x43f8('0x60')]=_0x456382;}else if(_0x18fdda&&_0x18fdda['recordingFormat']&&_0x18fdda[_0x43f8('0x61')]!==_0x43f8('0x62')){logger[_0x43f8('0x10')](_0x43f8('0x63'),_0x43f8('0x5f'));_0x4cb3[_0x43f8('0x60')]=_0x456382;}else{_0x4cb3[_0x43f8('0x60')]='';}return getAdminUser(_0xcb6bb2,_0x3ca036,_0x57cc5a,_0x229426,_0x427809,_0x5b8684)[_0x43f8('0xb')](getUser(_0xcb6bb2,_0x3ca036,_0x229426,_0x427809,_0x5b8684))[_0x43f8('0xb')](getEndUser(_0xcb6bb2,_0x3ca036,_0x229426,_0x427809,_0x5b8684))[_0x43f8('0xb')](getTicket(_0xcb6bb2,_0x3ca036,_0x229426,_0xcb9622,_0x4cb3,_0x427809))[_0x43f8('0xb')](function(_0x3c30f0){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3c30f0['ticketId']));logger[_0x43f8('0x10')](util[_0x43f8('0x4a')]('call\x20direction:\x20%s',_0xcb6bb2));if(_0xcb6bb2!==_0x43f8('0x5a')){logger[_0x43f8('0x10')]('['+[_0xcb6bb2[_0x43f8('0x12')]()]+']',_0x43f8('0x64'));emit(_0x164d54['remoteUri'],_0x49af14[_0x43f8('0x2f')],_0x3c30f0[_0x43f8('0x38')]);}})[_0x43f8('0x1c')](function(_0x1e71aa){logger['error']('['+[_0xcb6bb2[_0x43f8('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x1e71aa,{'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 fba4dcf..29aa323 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 _0x59b1=['find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','[HTTP]','map','forEach','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','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','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','lastevent','toUpperCase','lodash','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list'];(function(_0x25c9a1,_0x3acf1c){var _0x59731d=function(_0x2a7f60){while(--_0x2a7f60){_0x25c9a1['push'](_0x25c9a1['shift']());}};_0x59731d(++_0x3acf1c);}(_0x59b1,0x131));var _0x159b=function(_0x4c28d7,_0x1d8c30){_0x4c28d7=_0x4c28d7-0x0;var _0x443270=_0x59b1[_0x4c28d7];return _0x443270;};'use strict';var _=require(_0x159b('0x0'));var rp=require('request-promise');var BPromise=require(_0x159b('0x1'));var md5=require('md5');var util=require(_0x159b('0x2'));var Redis=require(_0x159b('0x3'));var intUtil=require('./util');var config=require(_0x159b('0x4'));var logger=require(_0x159b('0x5'))(_0x159b('0x6'));config[_0x159b('0x7')]=_[_0x159b('0x8')](config[_0x159b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x159b('0x9'))(new Redis(config[_0x159b('0x7')]));var def={'method':_0x159b('0xa'),'json':!![]};function emit(_0x3f612b,_0x14c8c3,_0x144b1f){io['to'](_0x3f612b)[_0x159b('0xb')](_0x14c8c3,_0x144b1f);}function getTicket(_0x39ab27,_0x279786,_0x3fd4b2,_0x152e0a,_0x13189f,_0x17ef30,_0x39dcdc,_0x9aa057){logger[_0x159b('0xc')]('Creating\x20new\x20ticket...');var _0x2441c8=new Date();var _0x3ca4fd=[{'name':_0x159b('0xd'),'value':intUtil[_0x159b('0xe')](_0x152e0a[_0x159b('0xf')],_0x13189f,'\x20')},{'name':_0x159b('0x10'),'value':_0x279786['id']},{'name':_0x159b('0x11'),'value':_0x279786['id']},{'name':_0x159b('0x12'),'value':intUtil[_0x159b('0xe')](_0x152e0a[_0x159b('0x13')],_0x13189f,'\x0a')},{'name':'date_start','value':_0x2441c8[_0x159b('0x14')]()[_0x159b('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x159b('0x16'),'value':'0'},{'name':_0x159b('0x17'),'value':'15'},{'name':_0x159b('0x18'),'value':_0x3fd4b2['id']},{'name':_0x159b('0x19'),'value':_0x159b('0x1a')},{'name':_0x159b('0x1b'),'value':_0x3fd4b2[_0x159b('0xd')]},{'name':'direction','value':_0x9aa057}];if(_0x17ef30[_0x159b('0x1c')]){_['forEach'](_0x17ef30,function(_0x29e787){if(_0x13189f[_0x29e787[_0x159b('0x1d')]]){_0x3ca4fd[_0x159b('0x1e')]({'name':_0x29e787['idField'],'value':_0x13189f[_0x29e787[_0x159b('0x1d')]]});}});}return request({'form':{'method':_0x159b('0x1f'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x39dcdc['id'],'module_name':_0x159b('0x22'),'name_value_list':_0x3ca4fd})}});}function getAuth(_0x774140){return util[_0x159b('0x23')](_0x159b('0x24'),new Buffer(_0x774140['apiKey']+':X')[_0x159b('0x25')](_0x159b('0x26')));}function getServerInfo(_0x27f75f){return request({'form':{'method':'get_server_info','input_type':_0x159b('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x27f75f['id']})}});}function getUser(_0x438421,_0x520ea5,_0x58ecd7){if(!_[_0x159b('0x27')](_0x520ea5)){logger[_0x159b('0xc')](_0x159b('0x28'),_0x520ea5);return request({'form':{'method':_0x159b('0x29'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x58ecd7['id'],'module_name':_0x159b('0x2a'),'query':util[_0x159b('0x23')](_0x159b('0x2b'),_0x520ea5),'order_by':'','offset':'0','select_fields':['id',_0x159b('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x159b('0x2c')](function(_0x40ad5f){if(_0x40ad5f[_0x159b('0x2d')][_0x159b('0x1c')]){var _0x97bed4=_[_0x159b('0x2e')](_0x40ad5f[_0x159b('0x2d')],function(_0x36efae){return _0x36efae[_0x159b('0x2f')][_0x159b('0x30')][_0x159b('0x31')]===_0x520ea5;});if(_0x97bed4){logger[_0x159b('0xc')](_0x159b('0x32'));return BPromise[_0x159b('0x33')]({'id':_0x97bed4[_0x159b('0x2f')]['id'][_0x159b('0x31')],'name':_0x97bed4[_0x159b('0x2f')][_0x159b('0xd')][_0x159b('0x31')]});}}logger[_0x159b('0xc')](_0x159b('0x34'));return BPromise[_0x159b('0x33')]({'id':_0x58ecd7[_0x159b('0x2f')][_0x159b('0x35')][_0x159b('0x31')],'name':_0x58ecd7['name_value_list'][_0x159b('0x30')][_0x159b('0x31')]});});}else{logger['info'](_0x159b('0x36'));return BPromise[_0x159b('0x33')]({'id':_0x58ecd7[_0x159b('0x2f')]['user_id'][_0x159b('0x31')],'name':_0x58ecd7[_0x159b('0x2f')]['user_name']['value']});}}function getEndUser(_0x46f50b,_0x3b3ecb,_0x21e9ac,_0x387bcf){logger[_0x159b('0xc')]('Searching\x20enduser\x20with\x20phone',_0x21e9ac);return request({'form':{'method':'get_entry_list','input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x387bcf['id'],'module_name':_0x159b('0x1a'),'query':util[_0x159b('0x23')](_0x159b('0x37'),_0x21e9ac),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x291be7){if(_0x291be7[_0x159b('0x2d')]['length']){var _0x27e54a=_[_0x159b('0x2e')](_0x291be7['entry_list'],function(_0x1e47e6){return _0x1e47e6['name_value_list'][_0x159b('0x38')][_0x159b('0x31')]===_0x21e9ac;});if(_0x27e54a){logger[_0x159b('0xc')](_0x159b('0x39'));return BPromise[_0x159b('0x33')]({'id':_0x27e54a[_0x159b('0x2f')]['id']['value'],'name':_0x27e54a[_0x159b('0x2f')]['name'][_0x159b('0x31')],'phone':_0x27e54a[_0x159b('0x2f')][_0x159b('0x38')]['value']});}}else{logger['info'](_0x159b('0x3a'));return request({'form':{'method':_0x159b('0x1f'),'input_type':'JSON','response_type':_0x159b('0x20'),'rest_data':JSON['stringify']({'session':_0x387bcf['id'],'module_name':_0x159b('0x1a'),'name_value_list':[{'name':_0x159b('0x3b'),'value':_0x3b3ecb!==_0x159b('0x3c')?_0x3b3ecb:util[_0x159b('0x23')](_0x159b('0x3d'),_0x21e9ac)},{'name':_0x159b('0x38'),'value':_0x21e9ac}]})}})[_0x159b('0x2c')](function(_0x98bb44){logger[_0x159b('0xc')]('Enduser\x20created.');return BPromise[_0x159b('0x33')]({'id':_0x98bb44['id'],'name':_0x98bb44['entry_list'][_0x159b('0x3b')][_0x159b('0x31')],'phone':_0x98bb44['entry_list'][_0x159b('0x38')]['value']});});}});}function request(_0x5c9d71){logger['debug'](_0x159b('0x3e'),JSON['stringify'](_0x5c9d71));return rp(_['merge'](def,_0x5c9d71));}function getTags(_0x4ee8fa,_0x61c25b){var _0x259c34=[];if(_0x4ee8fa&&_0x4ee8fa[_0x159b('0x1c')]>0x0){_0x259c34=_[_0x159b('0x3f')](_0x4ee8fa,_0x61c25b);}return _0x259c34;}function getCustomFields(_0x15c4fe,_0x4b888d){var _0x311865=[];var _0x3f69a7={'custom_fields':[]};if(_0x15c4fe['length']>0x0){_[_0x159b('0x40')](_0x15c4fe,function(_0x43da7e){if(_0x43da7e['type']===_0x159b('0x41')&&_0x43da7e[_0x159b('0x42')]&&!_0x43da7e[_0x159b('0x43')]){_0x3f69a7[_0x43da7e[_0x159b('0x42')][_0x159b('0x44')]()]=_0x43da7e[_0x159b('0x45')]['toString']();}else if(_0x43da7e[_0x159b('0x46')]==='string'&&_0x43da7e[_0x159b('0x47')]&&_0x43da7e[_0x159b('0x43')]){_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x43da7e[_0x159b('0x45')]['toString']()});}else if(_0x43da7e[_0x159b('0x46')]===_0x159b('0x49')&&_0x43da7e['variableName']&&_0x43da7e[_0x159b('0x47')]&&_0x43da7e[_0x159b('0x43')]){_0x4b888d[_0x43da7e[_0x159b('0x1d')]]&&_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x4b888d[_0x43da7e[_0x159b('0x1d')]][_0x159b('0x25')]()});}else if(_0x43da7e['type']===_0x159b('0x4a')&&_0x43da7e['Variable']&&_0x43da7e[_0x159b('0x4b')][_0x159b('0xd')]&&_0x43da7e['idField']&&_0x43da7e[_0x159b('0x43')]){_0x4b888d[_0x43da7e[_0x159b('0x4b')][_0x159b('0xd')][_0x159b('0x44')]()]&&_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x4b888d[_0x43da7e[_0x159b('0x4b')]['name'][_0x159b('0x44')]()][_0x159b('0x25')]()});}});}return _0x3f69a7;}function getConnection(_0x474307){return request({'method':_0x159b('0xa'),'form':{'method':_0x159b('0x4c'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'user_auth':{'user_name':_0x474307[_0x159b('0x4d')],'password':_0x474307[_0x159b('0x4e')],'encryption':_0x159b('0x4f')},'application':_0x159b('0x50')})}})[_0x159b('0x2c')](function(_0x204bfa){var _0x538ded=_0x204bfa;if(_0x538ded['id']){def['sessionID']=_0x538ded['id'];return BPromise['resolve'](_0x538ded);}else{throw new Error(util['format'](_0x159b('0x51'),_0x474307['id']));}});}function setRelationship(_0x52b7b5,_0x2fce48,_0x496fd8,_0x5f5fe4){return request({'form':{'method':'set_relationship','input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x52b7b5['id'],'module_name':_0x159b('0x22'),'module_id':_0x496fd8['id'],'link_field_name':_0x5f5fe4,'related_ids':[_0x2fce48['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xe25a66,_0xecea79,_0xdb4f93,_0x379918,_0x561603,_0x35aa14){var _0x1686b6,_0x5a74ff,_0x1745a7,_0x32da6e;_0x35aa14['remoteUri']=intUtil[_0x159b('0x52')](_0x35aa14['remoteUri']);_0x35aa14[_0x159b('0x53')]=intUtil[_0x159b('0x52')](_0x35aa14[_0x159b('0x53')]);def[_0x159b('0x54')]=util[_0x159b('0x23')](_0x159b('0x55'),_0x35aa14[_0x159b('0x56')]);if(_0x561603&&_0x561603[_0x159b('0x57')]){logger[_0x159b('0xc')](_0x159b('0x58'),_0x159b('0x59'));_0xecea79[_0x159b('0x5a')]=util[_0x159b('0x23')](_0x159b('0x5b'),_0x35aa14['serverUrl'],_0xecea79['uniqueid'],md5(_0xecea79[_0x159b('0x5c')]));}else{_0xecea79[_0x159b('0x5a')]='';}return getConnection(_0x35aa14)[_0x159b('0x2c')](function(_0x2b4a5c){_0x32da6e=_0x2b4a5c;return getUser(_0x35aa14,_0x379918['name'],_0x32da6e);})[_0x159b('0x2c')](function(_0x2d2700){_0x1686b6=_0x2d2700;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x1686b6['id']);return getEndUser(_0x35aa14,_0xecea79[_0x159b('0x5e')],_0xecea79[_0x159b('0x5f')],_0x32da6e);})[_0x159b('0x2c')](function(_0x1134f6){_0x5a74ff=_0x1134f6;logger['info'](_0x159b('0x60'),_0x5a74ff['id']);return getTicket(_0x35aa14,_0x1686b6,_0x5a74ff,_0xdb4f93,_0xecea79,_0xdb4f93[_0x159b('0x61')],_0x32da6e,'Inbound');})[_0x159b('0x2c')](function(_0x58ae01){_0x1745a7=_0x58ae01;logger[_0x159b('0xc')]('Ticket\x20created!');logger[_0x159b('0xc')](_0x159b('0x62'),_0x1745a7['id']);return setRelationship(_0x32da6e,_0x1686b6,_0x1745a7,'users');})['then'](function(){return setRelationship(_0x32da6e,_0x5a74ff,_0x1745a7,_0x159b('0x63'));})[_0x159b('0x2c')](function(){return getServerInfo(_0x32da6e);})[_0x159b('0x2c')](function(_0x44c221){var _0x38eeb6=parseInt(_0x44c221[_0x159b('0x64')][_0x159b('0x65')](0x0));var _0xd48220=util[_0x159b('0x23')](_0x159b('0x66'),_0x35aa14[_0x159b('0x56')],_0x1745a7['id']);if(_0x38eeb6>0x6){_0xd48220=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x35aa14[_0x159b('0x56')],_0x1745a7['id']);}logger[_0x159b('0xc')](_0x159b('0x58'),_0x159b('0x67'));emit(util['format']('user:%s',_0x379918[_0x159b('0xd')]),_0x159b('0x68'),{'uri':_0xd48220});})['catch'](function(_0x48d84a){logger[_0x159b('0x69')]('[QUEUE]',JSON[_0x159b('0x21')](_0x48d84a));});};exports[_0x159b('0x6a')]=function(_0x81cd97,_0x206015,_0x4b2ff1,_0x135743,_0x581c2e,_0x3c4df0,_0x58bca5){var _0x1079c5,_0x2e30d9,_0x1c3a07,_0x23c308;_0x3c4df0[_0x159b('0x56')]=intUtil['stripTrailingSlash'](_0x3c4df0[_0x159b('0x56')]);_0x3c4df0[_0x159b('0x53')]=intUtil[_0x159b('0x52')](_0x3c4df0['serverUrl']);def[_0x159b('0x54')]=util[_0x159b('0x23')](_0x159b('0x55'),_0x3c4df0['remoteUri']);if(_0x58bca5&&_0x58bca5['recordingFormat']&&_0x58bca5[_0x159b('0x6b')]!=='none'){logger[_0x159b('0xc')](_0x159b('0x6c'),_0x159b('0x59'));_0x206015[_0x159b('0x5a')]=util[_0x159b('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c4df0[_0x159b('0x53')],_0x206015['uniqueid'],md5(_0x206015[_0x159b('0x5c')]));}return getConnection(_0x3c4df0)[_0x159b('0x2c')](function(_0x13a88f){_0x23c308=_0x13a88f;return getUser(_0x3c4df0,_0x135743[_0x159b('0xd')],_0x23c308);})[_0x159b('0x2c')](function(_0x48cadf){_0x1079c5=_0x48cadf;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x1079c5['id']);return getEndUser(_0x3c4df0,_0x206015[_0x159b('0x6d')],_0x206015['destcalleridnum'],_0x23c308);})[_0x159b('0x2c')](function(_0x2681cb){_0x2e30d9=_0x2681cb;logger['info'](_0x159b('0x60'),_0x2e30d9['id']);return getTicket(_0x3c4df0,_0x1079c5,_0x2e30d9,_0x4b2ff1,_0x206015,_0x4b2ff1[_0x159b('0x61')],_0x23c308,_0x159b('0x6e'));})[_0x159b('0x2c')](function(_0x47a0c3){_0x1c3a07=_0x47a0c3;logger[_0x159b('0xc')]('Ticket\x20created!');logger[_0x159b('0xc')](_0x159b('0x62'),_0x1c3a07['id']);return setRelationship(_0x23c308,_0x1079c5,_0x1c3a07,_0x159b('0x6f'));})[_0x159b('0x2c')](function(){return setRelationship(_0x23c308,_0x2e30d9,_0x1c3a07,_0x159b('0x63'));})[_0x159b('0x2c')](function(){return getServerInfo(_0x23c308);})[_0x159b('0x2c')](function(_0x14d2c3){var _0x25918f=parseInt(_0x14d2c3['version'][_0x159b('0x65')](0x0));var _0x23aae4=util['format'](_0x159b('0x66'),_0x3c4df0[_0x159b('0x56')],_0x1c3a07['id']);if(_0x25918f>0x6){_0x23aae4=util[_0x159b('0x23')](_0x159b('0x70'),_0x3c4df0[_0x159b('0x56')],_0x1c3a07['id']);}logger['info']('[OUTBOUND]',_0x159b('0x67'));emit(util[_0x159b('0x23')](_0x159b('0x71'),_0x135743[_0x159b('0xd')]),_0x159b('0x68'),{'uri':_0x23aae4});})[_0x159b('0x72')](function(_0x26e609){logger['error'](_0x159b('0x6c'),JSON['stringify'](_0x26e609));});};exports['unmanaged']=function(_0x417248,_0x14cbe8,_0x1adae0,_0x5ef16a,_0x488a4b,_0x4ad377){var _0x463663,_0x557cca,_0x4e5d1b,_0x553548;_0x4ad377['remoteUri']=intUtil[_0x159b('0x52')](_0x4ad377[_0x159b('0x56')]);_0x4ad377['serverUrl']=intUtil[_0x159b('0x52')](_0x4ad377['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x4ad377[_0x159b('0x56')]);if(_0x488a4b&&_0x488a4b[_0x159b('0x57')]){logger['info']('['+_0x14cbe8[_0x159b('0x73')]['toUpperCase']()+']',_0x159b('0x59'));_0x14cbe8[_0x159b('0x5a')]=util['format'](_0x159b('0x5b'),_0x4ad377[_0x159b('0x53')],_0x14cbe8[_0x159b('0x5c')],md5(_0x14cbe8[_0x159b('0x5c')]));}else{_0x14cbe8[_0x159b('0x5a')]='';}return getConnection(_0x4ad377)['then'](function(_0x1b5fb2){_0x553548=_0x1b5fb2;if(!_[_0x159b('0x27')](_0x5ef16a)){return getUser(_0x4ad377,_0x5ef16a[_0x159b('0xd')],_0x553548);}else{return getUser(_0x4ad377,null,_0x553548);}})['then'](function(_0xf3e2ff){_0x463663=_0xf3e2ff;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x463663['id']);return getEndUser(_0x4ad377,_0x14cbe8[_0x159b('0x5e')],_0x14cbe8['calleridnum'],_0x553548);})['then'](function(_0x37a2eb){_0x557cca=_0x37a2eb;logger[_0x159b('0xc')](_0x159b('0x60'),_0x557cca['id']);return getTicket(_0x4ad377,_0x463663,_0x557cca,_0x1adae0,_0x14cbe8,_0x1adae0[_0x159b('0x61')],_0x553548,'Inbound');})[_0x159b('0x2c')](function(_0x1ef5d0){_0x4e5d1b=_0x1ef5d0;logger['info']('Ticket\x20created!');logger['info'](_0x159b('0x62'),_0x4e5d1b['id']);return setRelationship(_0x553548,_0x463663,_0x4e5d1b,_0x159b('0x6f'));})[_0x159b('0x2c')](function(){return setRelationship(_0x553548,_0x557cca,_0x4e5d1b,'contacts');})[_0x159b('0x2c')](function(){return getServerInfo(_0x553548);})[_0x159b('0x72')](function(_0x1da55f){logger[_0x159b('0x69')]('['+_0x14cbe8[_0x159b('0x73')][_0x159b('0x74')]()+']',JSON['stringify'](_0x1da55f));});}; \ No newline at end of file +var _0xddb4=['users','contacts','charAt','user:%s','unmanaged','lastevent','lodash','request-promise','md5','util','../../../../config/environment','sugarcrm','redis','socket.io-emitter','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_minutes','parent_type','Contacts','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','find','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','content','custom_fields','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum'];(function(_0x5e33ab,_0x5bc6d5){var _0x4a6d18=function(_0x254cbf){while(--_0x254cbf){_0x5e33ab['push'](_0x5e33ab['shift']());}};_0x4a6d18(++_0x5bc6d5);}(_0xddb4,0x162));var _0x4ddb=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0xddb4[_0x2384f6];return _0x370294;};'use strict';var _=require(_0x4ddb('0x0'));var rp=require(_0x4ddb('0x1'));var BPromise=require('bluebird');var md5=require(_0x4ddb('0x2'));var util=require(_0x4ddb('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4ddb('0x4'));var logger=require('../../../../config/logger')(_0x4ddb('0x5'));config[_0x4ddb('0x6')]=_['defaults'](config[_0x4ddb('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4ddb('0x7'))(new Redis(config[_0x4ddb('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x38f61e,_0x9e853f,_0x75c744){io['to'](_0x38f61e)['emit'](_0x9e853f,_0x75c744);}function getTicket(_0x4c1c0c,_0x40bdea,_0x331e42,_0x144350,_0xf5da7a,_0x2db48e,_0x449349,_0x3fa3ae){logger[_0x4ddb('0x8')]('Creating\x20new\x20ticket...');var _0x5af039=new Date();var _0x416c30=[{'name':_0x4ddb('0x9'),'value':intUtil[_0x4ddb('0xa')](_0x144350[_0x4ddb('0xb')],_0xf5da7a,'\x20')},{'name':_0x4ddb('0xc'),'value':_0x40bdea['id']},{'name':_0x4ddb('0xd'),'value':_0x40bdea['id']},{'name':_0x4ddb('0xe'),'value':intUtil[_0x4ddb('0xa')](_0x144350['Descriptions'],_0xf5da7a,'\x0a')},{'name':_0x4ddb('0xf'),'value':_0x5af039[_0x4ddb('0x10')]()[_0x4ddb('0x11')](0x0,0x13)[_0x4ddb('0x12')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4ddb('0x13'),'value':'15'},{'name':'parent_id','value':_0x331e42['id']},{'name':_0x4ddb('0x14'),'value':_0x4ddb('0x15')},{'name':'parent_name','value':_0x331e42[_0x4ddb('0x9')]},{'name':'direction','value':_0x3fa3ae}];if(_0x2db48e[_0x4ddb('0x16')]){_[_0x4ddb('0x17')](_0x2db48e,function(_0x1a6487){if(_0xf5da7a[_0x1a6487[_0x4ddb('0x18')]]){_0x416c30[_0x4ddb('0x19')]({'name':_0x1a6487[_0x4ddb('0x1a')],'value':_0xf5da7a[_0x1a6487[_0x4ddb('0x18')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x449349['id'],'module_name':'Calls','name_value_list':_0x416c30})}});}function getAuth(_0x295dfa){return util[_0x4ddb('0x1d')](_0x4ddb('0x1e'),new Buffer(_0x295dfa[_0x4ddb('0x1f')]+':X')[_0x4ddb('0x20')](_0x4ddb('0x21')));}function getServerInfo(_0xfc390b){return request({'form':{'method':_0x4ddb('0x22'),'input_type':_0x4ddb('0x1b'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xfc390b['id']})}});}function getUser(_0x404507,_0x48b311,_0x12026f){if(!_[_0x4ddb('0x23')](_0x48b311)){logger['info'](_0x4ddb('0x24'),_0x48b311);return request({'form':{'method':_0x4ddb('0x25'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x12026f['id'],'module_name':'Employees','query':util[_0x4ddb('0x1d')](_0x4ddb('0x26'),_0x48b311),'order_by':'','offset':'0','select_fields':['id',_0x4ddb('0x9'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ddb('0x27')](function(_0x185987){if(_0x185987[_0x4ddb('0x28')]['length']){var _0x56bd75=_['find'](_0x185987[_0x4ddb('0x28')],function(_0x4aafcf){return _0x4aafcf[_0x4ddb('0x29')][_0x4ddb('0x2a')][_0x4ddb('0x2b')]===_0x48b311;});if(_0x56bd75){logger[_0x4ddb('0x8')](_0x4ddb('0x2c'));return BPromise[_0x4ddb('0x2d')]({'id':_0x56bd75[_0x4ddb('0x29')]['id'][_0x4ddb('0x2b')],'name':_0x56bd75[_0x4ddb('0x29')][_0x4ddb('0x9')][_0x4ddb('0x2b')]});}}logger['info'](_0x4ddb('0x2e'));return BPromise['resolve']({'id':_0x12026f[_0x4ddb('0x29')]['user_id'][_0x4ddb('0x2b')],'name':_0x12026f['name_value_list'][_0x4ddb('0x2a')]['value']});});}else{logger[_0x4ddb('0x8')](_0x4ddb('0x2f'));return BPromise[_0x4ddb('0x2d')]({'id':_0x12026f[_0x4ddb('0x29')][_0x4ddb('0x30')][_0x4ddb('0x2b')],'name':_0x12026f[_0x4ddb('0x29')][_0x4ddb('0x2a')][_0x4ddb('0x2b')]});}}function getEndUser(_0x58bcfc,_0x52ffd7,_0x116b04,_0x5be927){logger[_0x4ddb('0x8')](_0x4ddb('0x31'),_0x116b04);return request({'form':{'method':_0x4ddb('0x25'),'input_type':'JSON','response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x5be927['id'],'module_name':_0x4ddb('0x15'),'query':util[_0x4ddb('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x116b04),'order_by':'','offset':'0','select_fields':['id',_0x4ddb('0x9'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ddb('0x27')](function(_0x30c6b){if(_0x30c6b[_0x4ddb('0x28')][_0x4ddb('0x16')]){var _0x154156=_[_0x4ddb('0x32')](_0x30c6b['entry_list'],function(_0x5a85fe){return _0x5a85fe[_0x4ddb('0x29')]['phone_home'][_0x4ddb('0x2b')]===_0x116b04;});if(_0x154156){logger[_0x4ddb('0x8')](_0x4ddb('0x33'));return BPromise['resolve']({'id':_0x154156[_0x4ddb('0x29')]['id'][_0x4ddb('0x2b')],'name':_0x154156[_0x4ddb('0x29')]['name'][_0x4ddb('0x2b')],'phone':_0x154156[_0x4ddb('0x29')][_0x4ddb('0x34')][_0x4ddb('0x2b')]});}}else{logger[_0x4ddb('0x8')](_0x4ddb('0x35'));return request({'form':{'method':_0x4ddb('0x36'),'input_type':'JSON','response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x5be927['id'],'module_name':_0x4ddb('0x15'),'name_value_list':[{'name':_0x4ddb('0x37'),'value':_0x52ffd7!==_0x4ddb('0x38')?_0x52ffd7:util[_0x4ddb('0x1d')]('Caller\x20-\x20%s',_0x116b04)},{'name':_0x4ddb('0x34'),'value':_0x116b04}]})}})[_0x4ddb('0x27')](function(_0x370a08){logger[_0x4ddb('0x8')](_0x4ddb('0x39'));return BPromise[_0x4ddb('0x2d')]({'id':_0x370a08['id'],'name':_0x370a08[_0x4ddb('0x28')][_0x4ddb('0x37')]['value'],'phone':_0x370a08['entry_list']['phone_home'][_0x4ddb('0x2b')]});});}});}function request(_0x463dd4){logger[_0x4ddb('0x3a')](_0x4ddb('0x3b'),JSON[_0x4ddb('0x1c')](_0x463dd4));return rp(_[_0x4ddb('0x3c')](def,_0x463dd4));}function getTags(_0x4201ce,_0x1bc6c0){var _0x4293de=[];if(_0x4201ce&&_0x4201ce[_0x4ddb('0x16')]>0x0){_0x4293de=_['map'](_0x4201ce,_0x1bc6c0);}return _0x4293de;}function getCustomFields(_0x3b8d6e,_0x48d903){var _0x10d81e=[];var _0x51b871={'custom_fields':[]};if(_0x3b8d6e['length']>0x0){_[_0x4ddb('0x17')](_0x3b8d6e,function(_0x340c49){if(_0x340c49[_0x4ddb('0x3d')]===_0x4ddb('0x3e')&&_0x340c49[_0x4ddb('0x3f')]&&!_0x340c49[_0x4ddb('0x40')]){_0x51b871[_0x340c49[_0x4ddb('0x3f')]['toLowerCase']()]=_0x340c49[_0x4ddb('0x41')]['toString']();}else if(_0x340c49['type']===_0x4ddb('0x3e')&&_0x340c49['idField']&&_0x340c49[_0x4ddb('0x40')]){_0x51b871[_0x4ddb('0x42')][_0x4ddb('0x19')]({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x340c49['content'][_0x4ddb('0x20')]()});}else if(_0x340c49[_0x4ddb('0x3d')]==='variable'&&_0x340c49[_0x4ddb('0x18')]&&_0x340c49['idField']&&_0x340c49[_0x4ddb('0x40')]){_0x48d903[_0x340c49[_0x4ddb('0x18')]]&&_0x51b871[_0x4ddb('0x42')]['push']({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x48d903[_0x340c49[_0x4ddb('0x18')]][_0x4ddb('0x20')]()});}else if(_0x340c49[_0x4ddb('0x3d')]===_0x4ddb('0x43')&&_0x340c49['Variable']&&_0x340c49['Variable'][_0x4ddb('0x9')]&&_0x340c49['idField']&&_0x340c49['customField']){_0x48d903[_0x340c49[_0x4ddb('0x44')][_0x4ddb('0x9')]['toLowerCase']()]&&_0x51b871[_0x4ddb('0x42')][_0x4ddb('0x19')]({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x48d903[_0x340c49[_0x4ddb('0x44')][_0x4ddb('0x9')][_0x4ddb('0x45')]()][_0x4ddb('0x20')]()});}});}return _0x51b871;}function getConnection(_0x22c896){return request({'method':_0x4ddb('0x46'),'form':{'method':_0x4ddb('0x47'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'user_auth':{'user_name':_0x22c896[_0x4ddb('0x48')],'password':_0x22c896[_0x4ddb('0x49')],'encryption':_0x4ddb('0x4a')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4ddb('0x27')](function(_0x48cf4e){var _0x892ec7=_0x48cf4e;if(_0x892ec7['id']){def[_0x4ddb('0x4b')]=_0x892ec7['id'];return BPromise[_0x4ddb('0x2d')](_0x892ec7);}else{throw new Error(util[_0x4ddb('0x1d')](_0x4ddb('0x4c'),_0x22c896['id']));}});}function setRelationship(_0x13817c,_0x4ea35c,_0x51c01f,_0x29394e){return request({'form':{'method':_0x4ddb('0x4d'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x13817c['id'],'module_name':_0x4ddb('0x4e'),'module_id':_0x51c01f['id'],'link_field_name':_0x29394e,'related_ids':[_0x4ea35c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4ddb('0x4f')]=function(_0x175508,_0x6995d6,_0x10ad37,_0x1bed5c,_0x219328,_0x2a76cb){var _0xad8318,_0x4b3997,_0x7553b1,_0x3fe16e;_0x2a76cb[_0x4ddb('0x50')]=intUtil[_0x4ddb('0x51')](_0x2a76cb[_0x4ddb('0x50')]);_0x2a76cb[_0x4ddb('0x52')]=intUtil[_0x4ddb('0x51')](_0x2a76cb['serverUrl']);def[_0x4ddb('0x53')]=util[_0x4ddb('0x1d')](_0x4ddb('0x54'),_0x2a76cb[_0x4ddb('0x50')]);if(_0x219328&&_0x219328[_0x4ddb('0x55')]){logger[_0x4ddb('0x8')](_0x4ddb('0x56'),'Recording\x20is\x20enabled!');_0x6995d6[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a76cb[_0x4ddb('0x52')],_0x6995d6[_0x4ddb('0x58')],md5(_0x6995d6[_0x4ddb('0x58')]));}else{_0x6995d6[_0x4ddb('0x57')]='';}return getConnection(_0x2a76cb)[_0x4ddb('0x27')](function(_0x56f7f0){_0x3fe16e=_0x56f7f0;return getUser(_0x2a76cb,_0x1bed5c[_0x4ddb('0x9')],_0x3fe16e);})['then'](function(_0x1fa943){_0xad8318=_0x1fa943;logger[_0x4ddb('0x8')]('The\x20User\x20ID\x20is:',_0xad8318['id']);return getEndUser(_0x2a76cb,_0x6995d6[_0x4ddb('0x59')],_0x6995d6[_0x4ddb('0x5a')],_0x3fe16e);})[_0x4ddb('0x27')](function(_0x3e58c9){_0x4b3997=_0x3e58c9;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x4b3997['id']);return getTicket(_0x2a76cb,_0xad8318,_0x4b3997,_0x10ad37,_0x6995d6,_0x10ad37[_0x4ddb('0x5c')],_0x3fe16e,_0x4ddb('0x5d'));})['then'](function(_0x2072d7){_0x7553b1=_0x2072d7;logger[_0x4ddb('0x8')](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x7553b1['id']);return setRelationship(_0x3fe16e,_0xad8318,_0x7553b1,'users');})[_0x4ddb('0x27')](function(){return setRelationship(_0x3fe16e,_0x4b3997,_0x7553b1,'contacts');})['then'](function(){return getServerInfo(_0x3fe16e);})[_0x4ddb('0x27')](function(_0x3c8f39){var _0x59f834=parseInt(_0x3c8f39[_0x4ddb('0x60')]['charAt'](0x0));var _0x790420=util['format'](_0x4ddb('0x61'),_0x2a76cb['remoteUri'],_0x7553b1['id']);if(_0x59f834>0x6){_0x790420=util[_0x4ddb('0x1d')](_0x4ddb('0x62'),_0x2a76cb['remoteUri'],_0x7553b1['id']);}logger[_0x4ddb('0x8')]('[QUEUE]',_0x4ddb('0x63'));emit(util[_0x4ddb('0x1d')]('user:%s',_0x1bed5c[_0x4ddb('0x9')]),_0x4ddb('0x64'),{'uri':_0x790420});})[_0x4ddb('0x65')](function(_0x522fa7){logger[_0x4ddb('0x66')](_0x4ddb('0x56'),JSON[_0x4ddb('0x1c')](_0x522fa7));});};exports[_0x4ddb('0x67')]=function(_0x159e8e,_0x1e7085,_0x208a86,_0x1e73f1,_0x4dd4dd,_0x582459,_0xf0832d){var _0x28260a,_0x3fb3d5,_0x1e4aa4,_0x1cfd64;_0x582459[_0x4ddb('0x50')]=intUtil['stripTrailingSlash'](_0x582459[_0x4ddb('0x50')]);_0x582459[_0x4ddb('0x52')]=intUtil['stripTrailingSlash'](_0x582459['serverUrl']);def[_0x4ddb('0x53')]=util['format'](_0x4ddb('0x54'),_0x582459[_0x4ddb('0x50')]);if(_0xf0832d&&_0xf0832d[_0x4ddb('0x68')]&&_0xf0832d[_0x4ddb('0x68')]!=='none'){logger['info'](_0x4ddb('0x69'),_0x4ddb('0x6a'));_0x1e7085[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')](_0x4ddb('0x6b'),_0x582459[_0x4ddb('0x52')],_0x1e7085[_0x4ddb('0x58')],md5(_0x1e7085[_0x4ddb('0x58')]));}return getConnection(_0x582459)[_0x4ddb('0x27')](function(_0x46dd62){_0x1cfd64=_0x46dd62;return getUser(_0x582459,_0x1e73f1['name'],_0x1cfd64);})['then'](function(_0x2d875a){_0x28260a=_0x2d875a;logger[_0x4ddb('0x8')](_0x4ddb('0x6c'),_0x28260a['id']);return getEndUser(_0x582459,_0x1e7085['destcalleridname'],_0x1e7085[_0x4ddb('0x6d')],_0x1cfd64);})[_0x4ddb('0x27')](function(_0x4e239f){_0x3fb3d5=_0x4e239f;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x3fb3d5['id']);return getTicket(_0x582459,_0x28260a,_0x3fb3d5,_0x208a86,_0x1e7085,_0x208a86[_0x4ddb('0x5c')],_0x1cfd64,'Outbound');})[_0x4ddb('0x27')](function(_0x10c17c){_0x1e4aa4=_0x10c17c;logger['info'](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x1e4aa4['id']);return setRelationship(_0x1cfd64,_0x28260a,_0x1e4aa4,_0x4ddb('0x6e'));})[_0x4ddb('0x27')](function(){return setRelationship(_0x1cfd64,_0x3fb3d5,_0x1e4aa4,_0x4ddb('0x6f'));})[_0x4ddb('0x27')](function(){return getServerInfo(_0x1cfd64);})[_0x4ddb('0x27')](function(_0x5636ea){var _0x492122=parseInt(_0x5636ea[_0x4ddb('0x60')][_0x4ddb('0x70')](0x0));var _0x4ba0e5=util[_0x4ddb('0x1d')](_0x4ddb('0x61'),_0x582459[_0x4ddb('0x50')],_0x1e4aa4['id']);if(_0x492122>0x6){_0x4ba0e5=util[_0x4ddb('0x1d')](_0x4ddb('0x62'),_0x582459[_0x4ddb('0x50')],_0x1e4aa4['id']);}logger[_0x4ddb('0x8')](_0x4ddb('0x69'),_0x4ddb('0x63'));emit(util[_0x4ddb('0x1d')](_0x4ddb('0x71'),_0x1e73f1[_0x4ddb('0x9')]),_0x4ddb('0x64'),{'uri':_0x4ba0e5});})[_0x4ddb('0x65')](function(_0x50b45d){logger[_0x4ddb('0x66')](_0x4ddb('0x69'),JSON['stringify'](_0x50b45d));});};exports[_0x4ddb('0x72')]=function(_0x2b2829,_0x6192,_0x2d265f,_0x111553,_0x56e40d,_0x58178c){var _0x2a77dc,_0x48bd50,_0x32fc1d,_0x24aaf5;_0x58178c[_0x4ddb('0x50')]=intUtil[_0x4ddb('0x51')](_0x58178c['remoteUri']);_0x58178c[_0x4ddb('0x52')]=intUtil[_0x4ddb('0x51')](_0x58178c['serverUrl']);def['uri']=util[_0x4ddb('0x1d')](_0x4ddb('0x54'),_0x58178c[_0x4ddb('0x50')]);if(_0x56e40d&&_0x56e40d[_0x4ddb('0x55')]){logger['info']('['+_0x6192[_0x4ddb('0x73')]['toUpperCase']()+']',_0x4ddb('0x6a'));_0x6192[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')](_0x4ddb('0x6b'),_0x58178c[_0x4ddb('0x52')],_0x6192[_0x4ddb('0x58')],md5(_0x6192[_0x4ddb('0x58')]));}else{_0x6192['recordingURL']='';}return getConnection(_0x58178c)[_0x4ddb('0x27')](function(_0x488795){_0x24aaf5=_0x488795;if(!_['isNil'](_0x111553)){return getUser(_0x58178c,_0x111553[_0x4ddb('0x9')],_0x24aaf5);}else{return getUser(_0x58178c,null,_0x24aaf5);}})[_0x4ddb('0x27')](function(_0x3f7863){_0x2a77dc=_0x3f7863;logger[_0x4ddb('0x8')](_0x4ddb('0x6c'),_0x2a77dc['id']);return getEndUser(_0x58178c,_0x6192[_0x4ddb('0x59')],_0x6192[_0x4ddb('0x5a')],_0x24aaf5);})['then'](function(_0x10a5d2){_0x48bd50=_0x10a5d2;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x48bd50['id']);return getTicket(_0x58178c,_0x2a77dc,_0x48bd50,_0x2d265f,_0x6192,_0x2d265f[_0x4ddb('0x5c')],_0x24aaf5,'Inbound');})[_0x4ddb('0x27')](function(_0x24aaea){_0x32fc1d=_0x24aaea;logger[_0x4ddb('0x8')](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x32fc1d['id']);return setRelationship(_0x24aaf5,_0x2a77dc,_0x32fc1d,_0x4ddb('0x6e'));})[_0x4ddb('0x27')](function(){return setRelationship(_0x24aaf5,_0x48bd50,_0x32fc1d,_0x4ddb('0x6f'));})[_0x4ddb('0x27')](function(){return getServerInfo(_0x24aaf5);})[_0x4ddb('0x65')](function(_0x434fd7){logger[_0x4ddb('0x66')]('['+_0x6192[_0x4ddb('0x73')]['toUpperCase']()+']',JSON[_0x4ddb('0x1c')](_0x434fd7));});}; \ 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 36a61b9..45d4bf5 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 _0xda41=['push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','variable','join','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','type','string'];(function(_0x2afa0a,_0x4b273c){var _0x206201=function(_0x9df21a){while(--_0x9df21a){_0x2afa0a['push'](_0x2afa0a['shift']());}};_0x206201(++_0x4b273c);}(_0xda41,0xfd));var _0x1da4=function(_0x4a87ed,_0x5c2810){_0x4a87ed=_0x4a87ed-0x0;var _0x3bec8c=_0xda41[_0x4a87ed];return _0x3bec8c;};'use strict';var _=require(_0x1da4('0x0'));var util=require(_0x1da4('0x1'));exports[_0x1da4('0x2')]=function(_0x3347d2,_0x1fe400,_0x47406b){var _0x1fef48=[];if(_0x3347d2[_0x1da4('0x3')]>0x0){var _0x15b2f8=_[_0x1da4('0x4')](_0x3347d2,['id']);for(var _0x28fcfd=0x0;_0x28fcfd<_0x15b2f8['length'];_0x28fcfd++){var _0x1f9a53=_0x15b2f8[_0x28fcfd];if(_0x1f9a53[_0x1da4('0x5')]===_0x1da4('0x6')){_0x1fef48[_0x1da4('0x7')](_0x1f9a53[_0x1da4('0x8')]);}else if(_0x1f9a53['type']==='variable'&&_0x1f9a53[_0x1da4('0x9')]){_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]&&_0x1fef48[_0x1da4('0x7')](_0x1fe400[_0x1f9a53['variableName']][_0x1da4('0xa')]());}else if(_0x1f9a53[_0x1da4('0x5')]===_0x1da4('0xb')&&_0x1f9a53[_0x1da4('0xc')]&&_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]){_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]['toLowerCase']()]&&_0x1fef48['push'](_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')][_0x1da4('0xe')]()][_0x1da4('0xa')]());}else if(_0x1f9a53[_0x1da4('0x5')]==='keyValue'){if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0x6')&&_0x1f9a53['key']){_0x1fef48[_0x1da4('0x7')](util[_0x1da4('0x10')](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1f9a53['keyContent']));}else if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0x13')&&_0x1f9a53[_0x1da4('0x9')]&&_0x1f9a53['key']){_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]&&_0x1fef48[_0x1da4('0x7')](util[_0x1da4('0x10')](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]));}else if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0xb')&&_0x1f9a53[_0x1da4('0xc')]&&_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]&&_0x1f9a53[_0x1da4('0x12')]){_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]['toLowerCase']()]&&_0x1fef48[_0x1da4('0x7')](util['format'](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')][_0x1da4('0xe')]()]));}}}}return _0x1fef48[_0x1da4('0x14')](_0x47406b);};exports[_0x1da4('0x15')]=function(_0x104e76){var _0x5dc894=_0x104e76[_0x1da4('0x16')](-0x1);if(_0x5dc894==='/'){_0x104e76=_0x104e76['substring'](0x0,_0x104e76[_0x1da4('0x17')](_0x5dc894));}return _0x104e76;};exports['validateEmail']=function(_0x1f7d62){if(!_[_0x1da4('0x18')](_0x1f7d62)&&_0x1f7d62!==''){var _0x508862=/^(([^<>()\[\]\\.,;:\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 _0x508862[_0x1da4('0x19')](String(_0x1f7d62)[_0x1da4('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xc3df=['keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','isNil','test','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x4b52fa,_0x234891){var _0x393f16=function(_0x53eeef){while(--_0x53eeef){_0x4b52fa['push'](_0x4b52fa['shift']());}};_0x393f16(++_0x234891);}(_0xc3df,0x15d));var _0xfc3d=function(_0x4ac2f2,_0x43a291){_0x4ac2f2=_0x4ac2f2-0x0;var _0x4bf328=_0xc3df[_0x4ac2f2];return _0x4bf328;};'use strict';var _=require(_0xfc3d('0x0'));var util=require(_0xfc3d('0x1'));exports['getString']=function(_0xa62593,_0xe120a0,_0x59718e){var _0x538abc=[];if(_0xa62593[_0xfc3d('0x2')]>0x0){var _0x47b1e0=_[_0xfc3d('0x3')](_0xa62593,['id']);for(var _0x35ad26=0x0;_0x35ad26<_0x47b1e0[_0xfc3d('0x2')];_0x35ad26++){var _0x3fa382=_0x47b1e0[_0x35ad26];if(_0x3fa382['type']===_0xfc3d('0x4')){_0x538abc[_0xfc3d('0x5')](_0x3fa382[_0xfc3d('0x6')]);}else if(_0x3fa382[_0xfc3d('0x7')]===_0xfc3d('0x8')&&_0x3fa382['variableName']){_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]&&_0x538abc[_0xfc3d('0x5')](_0xe120a0[_0x3fa382[_0xfc3d('0x9')]][_0xfc3d('0xa')]());}else if(_0x3fa382['type']===_0xfc3d('0xb')&&_0x3fa382[_0xfc3d('0xc')]&&_0x3fa382['Variable'][_0xfc3d('0xd')]){_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]&&_0x538abc['push'](_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]['toString']());}else if(_0x3fa382[_0xfc3d('0x7')]===_0xfc3d('0xf')){if(_0x3fa382[_0xfc3d('0x10')]==='string'&&_0x3fa382[_0xfc3d('0x11')]){_0x538abc['push'](util[_0xfc3d('0x12')](_0xfc3d('0x13'),_0x3fa382[_0xfc3d('0x11')],_0x3fa382[_0xfc3d('0x14')]));}else if(_0x3fa382[_0xfc3d('0x10')]===_0xfc3d('0x8')&&_0x3fa382[_0xfc3d('0x9')]&&_0x3fa382[_0xfc3d('0x11')]){_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]&&_0x538abc['push'](util[_0xfc3d('0x12')](_0xfc3d('0x13'),_0x3fa382[_0xfc3d('0x11')],_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]));}else if(_0x3fa382[_0xfc3d('0x10')]===_0xfc3d('0xb')&&_0x3fa382[_0xfc3d('0xc')]&&_0x3fa382[_0xfc3d('0xc')]['name']&&_0x3fa382['key']){_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]&&_0x538abc[_0xfc3d('0x5')](util[_0xfc3d('0x12')]('%s:\x20%s',_0x3fa382[_0xfc3d('0x11')],_0xe120a0[_0x3fa382['Variable'][_0xfc3d('0xd')][_0xfc3d('0xe')]()]));}}}}return _0x538abc[_0xfc3d('0x15')](_0x59718e);};exports[_0xfc3d('0x16')]=function(_0x3089fa){var _0x32ece4=_0x3089fa['slice'](-0x1);if(_0x32ece4==='/'){_0x3089fa=_0x3089fa['substring'](0x0,_0x3089fa[_0xfc3d('0x17')](_0x32ece4));}return _0x3089fa;};exports['validateEmail']=function(_0x4beb31){if(!_[_0xfc3d('0x18')](_0x4beb31)&&_0x4beb31!==''){var _0xa5f1fe=/^(([^<>()\[\]\\.,;:\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 _0xa5f1fe[_0xfc3d('0x19')](String(_0x4beb31)[_0xfc3d('0xe')]());}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 cee6877..5c86622 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x4e75f4,_0x4525d1){var _0x16fc41=function(_0x3dc3eb){while(--_0x3dc3eb){_0x4e75f4['push'](_0x4e75f4['shift']());}};_0x16fc41(++_0x4525d1);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x38fbb9,_0x14226c){var _0x3f6b26=function(_0xbd8dc1){while(--_0xbd8dc1){_0x38fbb9['push'](_0x38fbb9['shift']());}};_0x3f6b26(++_0x14226c);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 73c3e5d..1a0cb16 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 _0xb929=['recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','%s/users.json','authType','password','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','stringify','defaults','map','forEach','includes','string','type','customField','nameField','picklist','idField','custom_fields','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x45c9b3,_0x24c9b1){var _0x5dca5a=function(_0x5e4873){while(--_0x5e4873){_0x45c9b3['push'](_0x45c9b3['shift']());}};_0x5dca5a(++_0x24c9b1);}(_0xb929,0x90));var _0x9b92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb929[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9b92('0x0'));var rp=require(_0x9b92('0x1'));var md5=require(_0x9b92('0x2'));var util=require(_0x9b92('0x3'));var Redis=require(_0x9b92('0x4'));var intUtil=require('./util');var config=require(_0x9b92('0x5'));var logger=require(_0x9b92('0x6'))(_0x9b92('0x7'));config[_0x9b92('0x8')]=_['defaults'](config['redis'],{'host':_0x9b92('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b92('0x8')]));function emit(_0x11c734,_0xcea298,_0x14fba3){io['to'](_0x11c734)[_0x9b92('0xa')](_0xcea298,_0x14fba3);}var headers={'Content-Type':_0x9b92('0xb'),'Accept':_0x9b92('0xb')};function getTicket(_0x1352c9,_0x21b087,_0x428742,_0x441ed0,_0x2348ab){logger[_0x9b92('0xc')](_0x9b92('0xd'));return request({'uri':util['format'](_0x9b92('0xe'),_0x1352c9[_0x9b92('0xf')]),'method':_0x9b92('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x428742['id'],'submitter_id':_0x21b087?_0x21b087['id']:undefined,'assignee_id':_0x21b087?_0x21b087['id']:undefined,'tags':getTags(_0x441ed0[_0x9b92('0x11')],_0x9b92('0x12')),'subject':intUtil[_0x9b92('0x13')](_0x441ed0['Subjects'],_0x2348ab,'\x20'),'description':intUtil[_0x9b92('0x13')](_0x441ed0['Descriptions'],_0x2348ab,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x441ed0[_0x9b92('0x14')],_0x2348ab,'\x0a')}},getCustomFields(_0x441ed0[_0x9b92('0x15')],_0x2348ab))}})[_0x9b92('0x16')](function(_0x3cdca8){logger[_0x9b92('0xc')](_0x9b92('0x17'));return _0x3cdca8[_0x9b92('0x18')];});}function getUser(_0x319254,_0x3a28d8){if(intUtil[_0x9b92('0x19')](_0x3a28d8)){logger['info'](_0x9b92('0x1a'),_0x3a28d8);return request({'uri':util['format'](_0x9b92('0x1b'),_0x319254[_0x9b92('0xf')]),'qs':{'query':util[_0x9b92('0x1c')]('type:user\x20role:agent\x20email:%s',_0x3a28d8)}})[_0x9b92('0x16')](function(_0x385e38){if(_0x385e38[_0x9b92('0x1d')]){logger[_0x9b92('0xc')](_0x9b92('0x1e'));return _[_0x9b92('0x1f')](_0x385e38[_0x9b92('0x20')],{'email':_0x3a28d8,'role':_0x9b92('0x21')});}else{logger[_0x9b92('0xc')](_0x9b92('0x22'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x23'),_0x319254[_0x9b92('0xf')])})[_0x9b92('0x16')](function(_0x398d1f){logger[_0x9b92('0xc')]('Admin\x20account\x20selected.');return _0x398d1f[_0x9b92('0x24')];});}});}else{logger[_0x9b92('0xc')](_0x9b92('0x22'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x23'),_0x319254[_0x9b92('0xf')])})[_0x9b92('0x16')](function(_0x7751c){logger[_0x9b92('0xc')](_0x9b92('0x25'));return _0x7751c[_0x9b92('0x24')];});}}function getEndUser(_0x524471,_0x1506d7,_0x57315f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x57315f);return request({'uri':util['format']('%s/search.json',_0x524471['remoteUri']),'qs':{'query':util[_0x9b92('0x1c')](_0x9b92('0x26'),_0x57315f)}})[_0x9b92('0x16')](function(_0x14356d){var _0xa489f8;if(_0x14356d[_0x9b92('0x20')]['length']){_0x14356d[_0x9b92('0x20')]=_[_0x9b92('0x27')](_0x14356d['results'],{'suspended':![],'role':_0x9b92('0x28')});if(_0x14356d[_0x9b92('0x20')][_0x9b92('0x29')]){_0xa489f8=_[_0x9b92('0x2a')](_0x14356d[_0x9b92('0x20')]);}}if(_0xa489f8){logger[_0x9b92('0xc')]('Enduser\x20found!');return _0xa489f8;}else{logger[_0x9b92('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x9b92('0x2b'),_0x524471['remoteUri']),'method':_0x9b92('0x10'),'body':{'user':{'role':_0x9b92('0x28'),'name':util['format']('Caller\x20-\x20%s',_0x1506d7||_0x57315f),'phone':_0x57315f}}})['then'](function(_0x2c0786){logger[_0x9b92('0xc')]('Enduser\x20created.');return _0x2c0786[_0x9b92('0x24')];});}});}function getAuth(_0x5b28b1){var _0x9d1a6c;if(_0x5b28b1[_0x9b92('0x2c')]===_0x9b92('0x2d')){_0x9d1a6c=util[_0x9b92('0x1c')]('%s:%s',_0x5b28b1[_0x9b92('0x2e')],_0x5b28b1[_0x9b92('0x2d')]);}else if(_0x5b28b1[_0x9b92('0x2c')]==='token'){_0x9d1a6c=util[_0x9b92('0x1c')](_0x9b92('0x2f'),_0x5b28b1[_0x9b92('0x2e')],_0x5b28b1[_0x9b92('0x30')]);}return util['format'](_0x9b92('0x31'),new Buffer(_0x9d1a6c)[_0x9b92('0x32')](_0x9b92('0x33')));}function request(_0x39584c){logger[_0x9b92('0x34')]('[HTTP]',JSON[_0x9b92('0x35')](_0x39584c));return rp(_[_0x9b92('0x36')](_0x39584c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x18f1a5,_0x5318bd){var _0x495e00=[];if(_0x18f1a5&&_0x18f1a5[_0x9b92('0x29')]>0x0){_0x495e00=_[_0x9b92('0x37')](_0x18f1a5,_0x5318bd);}return _0x495e00;}function getCustomFields(_0x42a0fc,_0x13bdc8){var _0x1a5e60=[];var _0x4f5dae={'custom_fields':[]};if(_0x42a0fc['length']>0x0){_[_0x9b92('0x38')](_0x42a0fc,function(_0x184c09){if(_[_0x9b92('0x39')]([_0x9b92('0x3a'),'picklist'],_0x184c09[_0x9b92('0x3b')])&&_0x184c09['nameField']&&!_0x184c09[_0x9b92('0x3c')]){_0x4f5dae[_0x184c09[_0x9b92('0x3d')]['toLowerCase']()]=_0x184c09['content'][_0x9b92('0x32')]();}else if(_[_0x9b92('0x39')]([_0x9b92('0x3a'),_0x9b92('0x3e')],_0x184c09[_0x9b92('0x3b')])&&_0x184c09[_0x9b92('0x3f')]&&_0x184c09[_0x9b92('0x3c')]){_0x4f5dae[_0x9b92('0x40')]['push']({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x184c09[_0x9b92('0x41')][_0x9b92('0x32')]()});}else if(_0x184c09[_0x9b92('0x3b')]===_0x9b92('0x42')&&_0x184c09['variableName']&&_0x184c09['idField']&&_0x184c09[_0x9b92('0x3c')]){_0x13bdc8[_0x184c09[_0x9b92('0x43')]]&&_0x4f5dae[_0x9b92('0x40')][_0x9b92('0x44')]({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x13bdc8[_0x184c09[_0x9b92('0x43')]]['toString']()});}else if(_0x184c09['type']===_0x9b92('0x45')&&_0x184c09['Variable']&&_0x184c09['Variable']['name']&&_0x184c09['idField']&&_0x184c09[_0x9b92('0x3c')]){_0x13bdc8[_0x184c09[_0x9b92('0x46')][_0x9b92('0x12')][_0x9b92('0x47')]()]&&_0x4f5dae[_0x9b92('0x40')][_0x9b92('0x44')]({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x13bdc8[_0x184c09[_0x9b92('0x46')][_0x9b92('0x12')][_0x9b92('0x47')]()][_0x9b92('0x32')]()});}});}return _0x4f5dae;}exports[_0x9b92('0x48')]=function(_0x2ad8cc,_0x3e9320,_0x31679f,_0x35f3b0,_0x51363a,_0x761e7){var _0x9b542b,_0x5ed1cb;_0x761e7[_0x9b92('0xf')]=intUtil['stripTrailingSlash'](_0x761e7[_0x9b92('0xf')]);_0x761e7['serverUrl']=intUtil['stripTrailingSlash'](_0x761e7[_0x9b92('0x49')]);if(_0x51363a&&_0x51363a['monitor_format']){logger[_0x9b92('0xc')](_0x9b92('0x4a'),_0x9b92('0x4b'));_0x3e9320['recordingURL']=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x761e7[_0x9b92('0x49')],_0x3e9320['uniqueid'],md5(_0x3e9320[_0x9b92('0x4d')]));}else{_0x3e9320[_0x9b92('0x4e')]='';}headers[_0x9b92('0x4f')]=getAuth(_0x761e7);return getUser(_0x761e7,_0x35f3b0[_0x9b92('0x50')])[_0x9b92('0x16')](function(_0x4931de){_0x9b542b=_0x4931de;logger[_0x9b92('0xc')](_0x9b92('0x51'),_0x9b542b['id']);return getEndUser(_0x761e7,_0x3e9320[_0x9b92('0x52')],_0x3e9320[_0x9b92('0x53')]);})[_0x9b92('0x16')](function(_0xee46cc){_0x5ed1cb=_0xee46cc;logger[_0x9b92('0xc')](_0x9b92('0x54'),_0x5ed1cb['id']);return getTicket(_0x761e7,_0x9b542b,_0x5ed1cb,_0x31679f,_0x3e9320);})[_0x9b92('0x16')](function(_0x351c4c){if(_0x351c4c){logger[_0x9b92('0xc')]('The\x20Ticket\x20ID\x20is:',_0x351c4c['id']);switch(_0x761e7[_0x9b92('0x3b')]){case _0x9b92('0x55'):logger[_0x9b92('0xc')](_0x9b92('0x4a'),_0x9b92('0x56'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x57'),_0x761e7['remoteUri'],_0x9b542b['id'],_0x351c4c['id']),'method':_0x9b92('0x10')});case _0x9b92('0x58'):logger[_0x9b92('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9b92('0x59'),_0x35f3b0[_0x9b92('0x12')]),'trigger:browser:url',{'uri':util[_0x9b92('0x1c')](_0x9b92('0x5a'),_0x761e7[_0x9b92('0xf')][_0x9b92('0x5b')]('/api/v2',''),_0x351c4c['id'])});break;default:logger[_0x9b92('0x5c')](_0x9b92('0x4a'),_0x9b92('0x5d'));}}})[_0x9b92('0x5e')](function(_0xf10787){logger[_0x9b92('0x5c')](_0x9b92('0x5f'),util[_0x9b92('0x60')](_0xf10787,{'showHidden':!![],'depth':null}));});};exports[_0x9b92('0x61')]=function(_0xe7fa4a,_0xe57a43,_0x5c1991,_0x19df49,_0x5c7b25,_0x235644,_0x5f2b9d){var _0x18b412,_0x4ff582;_0x235644[_0x9b92('0xf')]=intUtil[_0x9b92('0x62')](_0x235644[_0x9b92('0xf')]);_0x235644[_0x9b92('0x49')]=intUtil[_0x9b92('0x62')](_0x235644[_0x9b92('0x49')]);if(_0x5f2b9d&&_0x5f2b9d[_0x9b92('0x63')]&&_0x5f2b9d['recordingFormat']!=='none'){logger[_0x9b92('0xc')](_0x9b92('0x64'),_0x9b92('0x4b'));_0xe57a43[_0x9b92('0x4e')]=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x235644[_0x9b92('0x49')],_0xe57a43[_0x9b92('0x4d')],md5(_0xe57a43[_0x9b92('0x4d')]));}headers[_0x9b92('0x4f')]=getAuth(_0x235644);return getUser(_0x235644,_0x19df49[_0x9b92('0x50')])[_0x9b92('0x16')](function(_0x33645a){_0x18b412=_0x33645a;logger[_0x9b92('0xc')]('The\x20User\x20ID\x20is:',_0x18b412['id']);return getEndUser(_0x235644,_0xe57a43[_0x9b92('0x65')],_0xe57a43[_0x9b92('0x66')]);})['then'](function(_0x3ed7f2){_0x4ff582=_0x3ed7f2;logger[_0x9b92('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4ff582['id']);return getTicket(_0x235644,_0x18b412,_0x4ff582,_0x5c1991,_0xe57a43);})[_0x9b92('0x16')](function(_0x2a57c7){if(_0x2a57c7){logger[_0x9b92('0xc')](_0x9b92('0x67'),_0x2a57c7['id']);switch(_0x235644[_0x9b92('0x3b')]){case _0x9b92('0x55'):logger['info'](_0x9b92('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x57'),_0x235644['remoteUri'],_0x18b412['id'],_0x2a57c7['id']),'method':'POST'});case _0x9b92('0x58'):logger[_0x9b92('0xc')](_0x9b92('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b92('0x1c')](_0x9b92('0x59'),_0x19df49['name']),_0x9b92('0x68'),{'uri':util[_0x9b92('0x1c')](_0x9b92('0x5a'),_0x235644[_0x9b92('0xf')][_0x9b92('0x5b')](_0x9b92('0x69'),''),_0x2a57c7['id'])});break;default:logger['error'](_0x9b92('0x64'),_0x9b92('0x5d'));}}})[_0x9b92('0x5e')](function(_0x56d594){logger[_0x9b92('0x5c')](_0x9b92('0x6a'),util['inspect'](_0x56d594,{'showHidden':!![],'depth':null}));});};exports[_0x9b92('0x6b')]=function(_0x288760,_0x18c7b2,_0x2e70c5,_0x13c0c1,_0x4c78d4,_0x40e6b5){var _0x1bece1,_0x23db8c;_0x40e6b5[_0x9b92('0xf')]=intUtil['stripTrailingSlash'](_0x40e6b5[_0x9b92('0xf')]);_0x40e6b5[_0x9b92('0x49')]=intUtil[_0x9b92('0x62')](_0x40e6b5[_0x9b92('0x49')]);if(_0x4c78d4&&_0x4c78d4[_0x9b92('0x6c')]){logger['info']('['+_0x18c7b2[_0x9b92('0x6d')]['toUpperCase']()+']',_0x9b92('0x4b'));_0x18c7b2[_0x9b92('0x4e')]=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x40e6b5[_0x9b92('0x49')],_0x18c7b2[_0x9b92('0x4d')],md5(_0x18c7b2[_0x9b92('0x4d')]));}else{_0x18c7b2[_0x9b92('0x4e')]='';}headers[_0x9b92('0x4f')]=getAuth(_0x40e6b5);return getUser(_0x40e6b5)[_0x9b92('0x16')](function(_0x7814ff){_0x1bece1=_0x7814ff;logger[_0x9b92('0xc')](_0x9b92('0x51'),_0x1bece1['id']);return getEndUser(_0x40e6b5,_0x18c7b2[_0x9b92('0x52')],_0x18c7b2[_0x9b92('0x53')]);})[_0x9b92('0x16')](function(_0xbfad6d){_0x23db8c=_0xbfad6d;logger[_0x9b92('0xc')]('The\x20Enduser\x20ID\x20is:',_0x23db8c['id']);return getTicket(_0x40e6b5,_0x1bece1,_0x23db8c,_0x2e70c5,_0x18c7b2);})['then'](function(_0x10f002){if(_0x10f002){logger['info'](_0x9b92('0x67'),_0x10f002['id']);}})['catch'](function(_0x3c6862){logger[_0x9b92('0x5c')]('['+_0x18c7b2[_0x9b92('0x6d')][_0x9b92('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x9b92('0x60')](_0x3c6862,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xad9a=['lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','inspect','request-promise','md5','util','ioredis','./util','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','merge','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','includes','string','type','nameField','toLowerCase','content','picklist','custom_fields','idField','variable','variableName','customVariable','Variable','name','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged'];(function(_0x454d94,_0x2d5642){var _0x1389b0=function(_0x1202ad){while(--_0x1202ad){_0x454d94['push'](_0x454d94['shift']());}};_0x1389b0(++_0x2d5642);}(_0xad9a,0x1c8));var _0xaad9=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xad9a[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var rp=require(_0xaad9('0x0'));var md5=require(_0xaad9('0x1'));var util=require(_0xaad9('0x2'));var Redis=require(_0xaad9('0x3'));var intUtil=require(_0xaad9('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0xaad9('0x5')]=_[_0xaad9('0x6')](config[_0xaad9('0x5')],{'host':_0xaad9('0x7'),'port':0x18eb});var io=require(_0xaad9('0x8'))(new Redis(config['redis']));function emit(_0x1bd2e3,_0x277dbc,_0x102766){io['to'](_0x1bd2e3)[_0xaad9('0x9')](_0x277dbc,_0x102766);}var headers={'Content-Type':'application/json','Accept':_0xaad9('0xa')};function getTicket(_0x5bc57f,_0x182198,_0x5557d5,_0x2b5436,_0x2b16be){logger[_0xaad9('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xaad9('0xc')](_0xaad9('0xd'),_0x5bc57f['remoteUri']),'method':_0xaad9('0xe'),'body':{'ticket':_[_0xaad9('0xf')]({'requester_id':_0x5557d5['id'],'submitter_id':_0x182198?_0x182198['id']:undefined,'assignee_id':_0x182198?_0x182198['id']:undefined,'tags':getTags(_0x2b5436['Tags'],'name'),'subject':intUtil[_0xaad9('0x10')](_0x2b5436[_0xaad9('0x11')],_0x2b16be,'\x20'),'description':intUtil[_0xaad9('0x10')](_0x2b5436[_0xaad9('0x12')],_0x2b16be,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2b5436['Descriptions'],_0x2b16be,'\x0a')}},getCustomFields(_0x2b5436[_0xaad9('0x13')],_0x2b16be))}})[_0xaad9('0x14')](function(_0x2c72b0){logger[_0xaad9('0xb')](_0xaad9('0x15'));return _0x2c72b0[_0xaad9('0x16')];});}function getUser(_0x543df4,_0x4860a3){if(intUtil[_0xaad9('0x17')](_0x4860a3)){logger['info'](_0xaad9('0x18'),_0x4860a3);return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x19'),_0x543df4[_0xaad9('0x1a')]),'qs':{'query':util[_0xaad9('0xc')](_0xaad9('0x1b'),_0x4860a3)}})[_0xaad9('0x14')](function(_0x583ee0){if(_0x583ee0[_0xaad9('0x1c')]){logger[_0xaad9('0xb')](_0xaad9('0x1d'));return _[_0xaad9('0x1e')](_0x583ee0[_0xaad9('0x1f')],{'email':_0x4860a3,'role':_0xaad9('0x20')});}else{logger[_0xaad9('0xb')](_0xaad9('0x21'));return request({'uri':util['format'](_0xaad9('0x22'),_0x543df4['remoteUri'])})['then'](function(_0x159b4b){logger[_0xaad9('0xb')](_0xaad9('0x23'));return _0x159b4b[_0xaad9('0x24')];});}});}else{logger[_0xaad9('0xb')](_0xaad9('0x21'));return request({'uri':util[_0xaad9('0xc')]('%s/users/me.json',_0x543df4[_0xaad9('0x1a')])})['then'](function(_0x1fe2a0){logger[_0xaad9('0xb')]('Admin\x20account\x20selected.');return _0x1fe2a0[_0xaad9('0x24')];});}}function getEndUser(_0x5460a9,_0x2b56aa,_0x58dce7){logger[_0xaad9('0xb')](_0xaad9('0x25'),_0x58dce7);return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x19'),_0x5460a9['remoteUri']),'qs':{'query':util[_0xaad9('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x58dce7)}})[_0xaad9('0x14')](function(_0x318088){var _0x11466f;if(_0x318088['results']['length']){_0x318088['results']=_[_0xaad9('0x26')](_0x318088[_0xaad9('0x1f')],{'suspended':![],'role':_0xaad9('0x27')});if(_0x318088[_0xaad9('0x1f')][_0xaad9('0x28')]){_0x11466f=_['first'](_0x318088[_0xaad9('0x1f')]);}}if(_0x11466f){logger[_0xaad9('0xb')](_0xaad9('0x29'));return _0x11466f;}else{logger['info'](_0xaad9('0x2a'));return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x2b'),_0x5460a9[_0xaad9('0x1a')]),'method':_0xaad9('0xe'),'body':{'user':{'role':_0xaad9('0x27'),'name':util[_0xaad9('0xc')](_0xaad9('0x2c'),_0x2b56aa||_0x58dce7),'phone':_0x58dce7}}})[_0xaad9('0x14')](function(_0x71eba9){logger[_0xaad9('0xb')](_0xaad9('0x2d'));return _0x71eba9['user'];});}});}function getAuth(_0x85d3c4){var _0x15cb6e;if(_0x85d3c4[_0xaad9('0x2e')]===_0xaad9('0x2f')){_0x15cb6e=util[_0xaad9('0xc')](_0xaad9('0x30'),_0x85d3c4[_0xaad9('0x31')],_0x85d3c4['password']);}else if(_0x85d3c4[_0xaad9('0x2e')]===_0xaad9('0x32')){_0x15cb6e=util['format'](_0xaad9('0x33'),_0x85d3c4[_0xaad9('0x31')],_0x85d3c4[_0xaad9('0x32')]);}return util[_0xaad9('0xc')](_0xaad9('0x34'),new Buffer(_0x15cb6e)[_0xaad9('0x35')]('base64'));}function request(_0x29ca25){logger[_0xaad9('0x36')](_0xaad9('0x37'),JSON[_0xaad9('0x38')](_0x29ca25));return rp(_[_0xaad9('0x6')](_0x29ca25,{'method':_0xaad9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0xd1c648,_0xd9ed41){var _0x2b0a12=[];if(_0xd1c648&&_0xd1c648[_0xaad9('0x28')]>0x0){_0x2b0a12=_[_0xaad9('0x3a')](_0xd1c648,_0xd9ed41);}return _0x2b0a12;}function getCustomFields(_0x36ba3e,_0x40cab2){var _0x656f5f=[];var _0x46a525={'custom_fields':[]};if(_0x36ba3e[_0xaad9('0x28')]>0x0){_['forEach'](_0x36ba3e,function(_0xeff407){if(_[_0xaad9('0x3b')]([_0xaad9('0x3c'),'picklist'],_0xeff407[_0xaad9('0x3d')])&&_0xeff407[_0xaad9('0x3e')]&&!_0xeff407['customField']){_0x46a525[_0xeff407[_0xaad9('0x3e')][_0xaad9('0x3f')]()]=_0xeff407[_0xaad9('0x40')][_0xaad9('0x35')]();}else if(_[_0xaad9('0x3b')](['string',_0xaad9('0x41')],_0xeff407[_0xaad9('0x3d')])&&_0xeff407['idField']&&_0xeff407['customField']){_0x46a525[_0xaad9('0x42')]['push']({'id':_0xeff407[_0xaad9('0x43')],'value':_0xeff407[_0xaad9('0x40')]['toString']()});}else if(_0xeff407[_0xaad9('0x3d')]===_0xaad9('0x44')&&_0xeff407[_0xaad9('0x45')]&&_0xeff407[_0xaad9('0x43')]&&_0xeff407['customField']){_0x40cab2[_0xeff407[_0xaad9('0x45')]]&&_0x46a525[_0xaad9('0x42')]['push']({'id':_0xeff407[_0xaad9('0x43')],'value':_0x40cab2[_0xeff407[_0xaad9('0x45')]][_0xaad9('0x35')]()});}else if(_0xeff407[_0xaad9('0x3d')]===_0xaad9('0x46')&&_0xeff407[_0xaad9('0x47')]&&_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')]&&_0xeff407[_0xaad9('0x43')]&&_0xeff407['customField']){_0x40cab2[_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')][_0xaad9('0x3f')]()]&&_0x46a525[_0xaad9('0x42')][_0xaad9('0x49')]({'id':_0xeff407[_0xaad9('0x43')],'value':_0x40cab2[_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')]['toLowerCase']()][_0xaad9('0x35')]()});}});}return _0x46a525;}exports[_0xaad9('0x4a')]=function(_0x1a03fe,_0x13b2f1,_0x43429c,_0x4e1ad8,_0x4b6b5c,_0x59abe8){var _0x367ca8,_0x2553f1;_0x59abe8['remoteUri']=intUtil[_0xaad9('0x4b')](_0x59abe8[_0xaad9('0x1a')]);_0x59abe8[_0xaad9('0x4c')]=intUtil['stripTrailingSlash'](_0x59abe8[_0xaad9('0x4c')]);if(_0x4b6b5c&&_0x4b6b5c[_0xaad9('0x4d')]){logger[_0xaad9('0xb')](_0xaad9('0x4e'),_0xaad9('0x4f'));_0x13b2f1[_0xaad9('0x50')]=util[_0xaad9('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59abe8[_0xaad9('0x4c')],_0x13b2f1[_0xaad9('0x51')],md5(_0x13b2f1[_0xaad9('0x51')]));}else{_0x13b2f1[_0xaad9('0x50')]='';}headers['Authorization']=getAuth(_0x59abe8);return getUser(_0x59abe8,_0x4e1ad8[_0xaad9('0x52')])['then'](function(_0x4f9e11){_0x367ca8=_0x4f9e11;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x367ca8['id']);return getEndUser(_0x59abe8,_0x13b2f1[_0xaad9('0x54')],_0x13b2f1[_0xaad9('0x55')]);})[_0xaad9('0x14')](function(_0x2975dd){_0x2553f1=_0x2975dd;logger[_0xaad9('0xb')](_0xaad9('0x56'),_0x2553f1['id']);return getTicket(_0x59abe8,_0x367ca8,_0x2553f1,_0x43429c,_0x13b2f1);})[_0xaad9('0x14')](function(_0x2a475f){if(_0x2a475f){logger['info'](_0xaad9('0x57'),_0x2a475f['id']);switch(_0x59abe8[_0xaad9('0x3d')]){case _0xaad9('0x58'):logger['info'](_0xaad9('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x59'),_0x59abe8[_0xaad9('0x1a')],_0x367ca8['id'],_0x2a475f['id']),'method':_0xaad9('0xe')});case'newTab':logger[_0xaad9('0xb')](_0xaad9('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaad9('0xc')]('user:%s',_0x4e1ad8['name']),'trigger:browser:url',{'uri':util[_0xaad9('0xc')]('%s/agent/tickets/%s',_0x59abe8[_0xaad9('0x1a')][_0xaad9('0x5a')](_0xaad9('0x5b'),''),_0x2a475f['id'])});break;default:logger[_0xaad9('0x5c')](_0xaad9('0x4e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xaad9('0x5d')](function(_0x2a181b){logger[_0xaad9('0x5c')](_0xaad9('0x5e'),util['inspect'](_0x2a181b,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x54df4c,_0x14a67e,_0x161937,_0x3731af,_0x1c0372,_0x48c9e6,_0x191012){var _0x25cbb8,_0x4d180e;_0x48c9e6[_0xaad9('0x1a')]=intUtil[_0xaad9('0x4b')](_0x48c9e6['remoteUri']);_0x48c9e6[_0xaad9('0x4c')]=intUtil[_0xaad9('0x4b')](_0x48c9e6[_0xaad9('0x4c')]);if(_0x191012&&_0x191012[_0xaad9('0x5f')]&&_0x191012['recordingFormat']!==_0xaad9('0x60')){logger['info'](_0xaad9('0x61'),_0xaad9('0x4f'));_0x14a67e[_0xaad9('0x50')]=util[_0xaad9('0xc')](_0xaad9('0x62'),_0x48c9e6[_0xaad9('0x4c')],_0x14a67e[_0xaad9('0x51')],md5(_0x14a67e['uniqueid']));}headers[_0xaad9('0x63')]=getAuth(_0x48c9e6);return getUser(_0x48c9e6,_0x3731af[_0xaad9('0x52')])['then'](function(_0x35aafa){_0x25cbb8=_0x35aafa;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x25cbb8['id']);return getEndUser(_0x48c9e6,_0x14a67e[_0xaad9('0x64')],_0x14a67e[_0xaad9('0x65')]);})[_0xaad9('0x14')](function(_0x236db8){_0x4d180e=_0x236db8;logger[_0xaad9('0xb')](_0xaad9('0x56'),_0x4d180e['id']);return getTicket(_0x48c9e6,_0x25cbb8,_0x4d180e,_0x161937,_0x14a67e);})[_0xaad9('0x14')](function(_0x5d285e){if(_0x5d285e){logger[_0xaad9('0xb')](_0xaad9('0x57'),_0x5d285e['id']);switch(_0x48c9e6[_0xaad9('0x3d')]){case _0xaad9('0x58'):logger[_0xaad9('0xb')](_0xaad9('0x61'),_0xaad9('0x66'));return request({'uri':util['format'](_0xaad9('0x59'),_0x48c9e6[_0xaad9('0x1a')],_0x25cbb8['id'],_0x5d285e['id']),'method':_0xaad9('0xe')});case _0xaad9('0x67'):logger[_0xaad9('0xb')](_0xaad9('0x61'),_0xaad9('0x68'));emit(util['format']('user:%s',_0x3731af[_0xaad9('0x48')]),_0xaad9('0x69'),{'uri':util[_0xaad9('0xc')](_0xaad9('0x6a'),_0x48c9e6[_0xaad9('0x1a')][_0xaad9('0x5a')](_0xaad9('0x5b'),''),_0x5d285e['id'])});break;default:logger[_0xaad9('0x5c')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xaad9('0x5d')](function(_0x1662d8){logger[_0xaad9('0x5c')](_0xaad9('0x6b'),util['inspect'](_0x1662d8,{'showHidden':!![],'depth':null}));});};exports[_0xaad9('0x6c')]=function(_0x5407d0,_0x597176,_0x45b557,_0x52f6e3,_0x8cd7a4,_0x3c65c2){var _0x34c5fd,_0x5b690d;_0x3c65c2[_0xaad9('0x1a')]=intUtil[_0xaad9('0x4b')](_0x3c65c2['remoteUri']);_0x3c65c2[_0xaad9('0x4c')]=intUtil[_0xaad9('0x4b')](_0x3c65c2[_0xaad9('0x4c')]);if(_0x8cd7a4&&_0x8cd7a4[_0xaad9('0x4d')]){logger['info']('['+_0x597176[_0xaad9('0x6d')][_0xaad9('0x6e')]()+']','Recording\x20is\x20enabled!');_0x597176[_0xaad9('0x50')]=util[_0xaad9('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c65c2[_0xaad9('0x4c')],_0x597176[_0xaad9('0x51')],md5(_0x597176[_0xaad9('0x51')]));}else{_0x597176[_0xaad9('0x50')]='';}headers[_0xaad9('0x63')]=getAuth(_0x3c65c2);return getUser(_0x3c65c2)[_0xaad9('0x14')](function(_0x69aea5){_0x34c5fd=_0x69aea5;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x34c5fd['id']);return getEndUser(_0x3c65c2,_0x597176['calleridname'],_0x597176['calleridnum']);})[_0xaad9('0x14')](function(_0xaecdde){_0x5b690d=_0xaecdde;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5b690d['id']);return getTicket(_0x3c65c2,_0x34c5fd,_0x5b690d,_0x45b557,_0x597176);})['then'](function(_0x274b65){if(_0x274b65){logger[_0xaad9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x274b65['id']);}})[_0xaad9('0x5d')](function(_0x4ec109){logger[_0xaad9('0x5c')]('['+_0x597176[_0xaad9('0x6d')][_0xaad9('0x6e')]()+']'+_0xaad9('0x6f'),util[_0xaad9('0x70')](_0x4ec109,{'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 0381f18..8392a8c 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 _0x2f90=['Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','toUpperCase','The\x20User\x20ID\x20is:','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','queue','host','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x23c217,_0x3aee12){var _0x53fcf8=function(_0x133202){while(--_0x133202){_0x23c217['push'](_0x23c217['shift']());}};_0x53fcf8(++_0x3aee12);}(_0x2f90,0x1e9));var _0x02f9=function(_0xfd80d5,_0x303f80){_0xfd80d5=_0xfd80d5-0x0;var _0xeb957d=_0x2f90[_0xfd80d5];return _0xeb957d;};'use strict';var _=require('lodash');var rp=require(_0x02f9('0x0'));var md5=require(_0x02f9('0x1'));var util=require(_0x02f9('0x2'));var intUtil=require(_0x02f9('0x3'));var moment=require(_0x02f9('0x4'));var Redis=require(_0x02f9('0x5'));var BPromise=require(_0x02f9('0x6'));var config=require(_0x02f9('0x7'));var logger=require(_0x02f9('0x8'))('zoho');config[_0x02f9('0x9')]=_[_0x02f9('0xa')](config[_0x02f9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x02f9('0xb'))(new Redis(config['redis']));function emit(_0x34135f,_0x3b8788,_0x30ed8){io['to'](_0x34135f)[_0x02f9('0xc')](_0x3b8788,_0x30ed8);}function request(_0x180237){logger[_0x02f9('0xd')](_0x02f9('0xe'),JSON[_0x02f9('0xf')](_0x180237));return rp(_0x180237);}function getCustomFields(_0x45fbc8,_0x312a4a){var _0xff761d={};if(_0x45fbc8[_0x02f9('0x10')]>0x0){_['forEach'](_0x45fbc8,function(_0x3ff58f){if(_[_0x02f9('0x11')](['string',_0x02f9('0x12')],_0x3ff58f[_0x02f9('0x13')])&&_0x3ff58f['idField']){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x3ff58f[_0x02f9('0x15')][_0x02f9('0x16')]();}else if(_0x3ff58f[_0x02f9('0x13')]==='variable'&&_0x3ff58f[_0x02f9('0x17')]&&_0x3ff58f[_0x02f9('0x14')]&&_0x312a4a[_0x3ff58f['variableName']]){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x312a4a[_0x3ff58f[_0x02f9('0x17')]][_0x02f9('0x16')]();}else if(_0x3ff58f['type']===_0x02f9('0x18')&&_0x3ff58f[_0x02f9('0x19')]&&_0x3ff58f[_0x02f9('0x19')][_0x02f9('0x1a')]&&_0x3ff58f[_0x02f9('0x14')]&&_0x312a4a[_0x3ff58f[_0x02f9('0x19')][_0x02f9('0x1a')][_0x02f9('0x1b')]()]){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x312a4a[_0x3ff58f[_0x02f9('0x19')]['name'][_0x02f9('0x1b')]()][_0x02f9('0x16')]();}});}return _0xff761d;}function getName(_0x19679a){if(_0x19679a[_0x02f9('0x1c')]('\x20')>0x0){var _0x2a8591=_0x19679a[_0x02f9('0x1d')](/ (.+)/);if(_0x2a8591[0x1]){return _0x2a8591;}}return[_0x19679a,_0x19679a];}var accountsTokens={};function getAccessToken(_0x3fedd5){return new Promise(function(_0xcf61b8,_0x498438){if(!_['isNil'](accountsTokens[_0x3fedd5['id']])&&!_[_0x02f9('0x1e')](accountsTokens[_0x3fedd5['id']][_0x02f9('0x1f')])){if(moment()[_0x02f9('0x20')](accountsTokens[_0x3fedd5['id']]['expires_in'])){_0xcf61b8(accountsTokens[_0x3fedd5['id']][_0x02f9('0x1f')]);}}var _0xcbc145;switch(_0x3fedd5[_0x02f9('0x21')]){case'US':_0xcbc145=_0x02f9('0x22');break;case'AU':_0xcbc145=_0x02f9('0x23');break;case'EU':_0xcbc145=_0x02f9('0x24');break;case'IN':_0xcbc145=_0x02f9('0x25');break;case'CN':_0xcbc145=_0x02f9('0x26');break;default:_0xcbc145=_0x02f9('0x24');break;}var _0x4f8ea6={'method':_0x02f9('0x27'),'uri':_0xcbc145+'/oauth/v2/token','qs':{'refresh_token':_0x3fedd5[_0x02f9('0x28')],'client_id':_0x3fedd5[_0x02f9('0x29')],'client_secret':_0x3fedd5[_0x02f9('0x2a')],'grant_type':_0x02f9('0x2b')},'json':!![]};return rp(_0x4f8ea6)[_0x02f9('0x2c')](function(_0x25e78f){accountsTokens[_0x3fedd5['id']]={'access_token':_0x25e78f[_0x02f9('0x1f')],'expires_in':moment()[_0x02f9('0x2d')](_0x25e78f[_0x02f9('0x2e')],_0x02f9('0x2f'))};_0xcf61b8(_0x25e78f[_0x02f9('0x1f')]);})[_0x02f9('0x30')](function(_0x3210b9){logger[_0x02f9('0x31')]('Failing\x20creating\x20the\x20access_token',_0x3210b9[_0x02f9('0x32')]);_0x498438(_0x3210b9);});});}function getUser(_0x2398d3,_0xef1e04,_0x24ad4b,_0x104fac){logger[_0x02f9('0x33')](_0x02f9('0x34'));return request({'method':_0x02f9('0x35'),'uri':util[_0x02f9('0x36')](_0x02f9('0x37'),_0xef1e04),'qs':{'type':_0x02f9('0x38')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2398d3},'json':!![]})['then'](function(_0x18e432){if(_0x18e432[_0x02f9('0x39')]){var _0x284f8f=-0x1;if(_['isArrayLikeObject'](_0x18e432[_0x02f9('0x39')])){if(!_[_0x02f9('0x1e')](_0x104fac)){_0x284f8f=_[_0x02f9('0x3a')](_0x18e432['users'],function(_0x3f3438){return _0x3f3438[_0x02f9('0x3b')]===_0x104fac;});}if(_0x284f8f>=0x0){logger[_0x02f9('0x33')](_0x02f9('0x3c'));}else{logger[_0x02f9('0x33')](_0x02f9('0x3d'));_0x284f8f=_[_0x02f9('0x3a')](_0x18e432[_0x02f9('0x39')],function(_0xe9e13d){return _0xe9e13d[_0x02f9('0x3e')][_0x02f9('0x1a')]==='Administrator';});}return _0x18e432[_0x02f9('0x39')][_0x284f8f];}else{if(_0x18e432['user']['profile'][_0x02f9('0x1a')]==='Administrator'){logger['info'](_0x02f9('0x3d'));user=_0x18e432['user'];return user;}else{logger[_0x02f9('0x31')]('The\x20failing\x20result\x20is',JSON[_0x02f9('0xf')](_0x18e432));throw new Error(_0x02f9('0x3f')+JSON[_0x02f9('0xf')](_0x18e432));}}}else{logger['error'](_0x02f9('0x40'),JSON['stringify'](_0x18e432));throw new Error(_0x02f9('0x3f')+JSON[_0x02f9('0xf')](_0x18e432));}})['catch'](function(_0x1a0bbd){console['error'](_0x1a0bbd);});}function getZohoUser(_0x329033,_0x2353ae){return new BPromise(function(_0x31e031,_0x56d69f){request(_0x329033)[_0x02f9('0x2c')](function(_0x415d10){var _0x593678=null;if(_0x415d10){_0x593678=_0x415d10[_0x02f9('0x41')][0x0];_0x593678['enduserType']=_0x2353ae;}_0x31e031(_0x593678);})[_0x02f9('0x30')](function(_0xa0d739){_0x56d69f(_0xa0d739);});});}function createEndUser(_0x252a35,_0x50e1b4,_0x30a722,_0x21c7ed,_0x1e4f98,_0x18ae6e){var _0x30a722=getName(_0x30a722);return request({'method':_0x02f9('0x27'),'uri':_0x02f9('0x42')+_0x50e1b4+_0x02f9('0x43')+_[_0x02f9('0x44')](_0x18ae6e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x30a722[0x1],'First_Name':_0x30a722[0x0],'Phone':_0x21c7ed,'Owner':{'name':!_[_0x02f9('0x1e')](_0x1e4f98['role'][_0x02f9('0x1a')])?_0x1e4f98[_0x02f9('0x45')][_0x02f9('0x1a')]:!_[_0x02f9('0x1e')](_0x1e4f98[_0x02f9('0x46')])?_0x1e4f98[_0x02f9('0x46')]+'\x20'+_0x1e4f98[_0x02f9('0x47')]:_0x1e4f98[_0x02f9('0x47')],'id':_0x1e4f98['id']}}]},'headers':{'Authorization':_0x02f9('0x48')+_0x252a35},'json':!![]})[_0x02f9('0x2c')](function(_0x24460c){if(_0x24460c&&_0x24460c[_0x02f9('0x41')][0x0]['code']===_0x02f9('0x49')){var _0x5d578b=_0x24460c[_0x02f9('0x41')][0x0][_0x02f9('0x4a')];_0x5d578b[_0x02f9('0x4b')]=_[_0x02f9('0x44')](_0x18ae6e[_0x02f9('0x4c')])+'s';return _0x5d578b;}logger[_0x02f9('0x31')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x02f9('0x4d')+JSON['stringify'](data));})[_0x02f9('0x30')](function(_0x1d0a85){console[_0x02f9('0x4e')](_0x02f9('0x4f'),_0x1d0a85);});}function getEndUser(_0x32adca,_0x1b736d,_0x398b90,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac){var _0x1dd3be={'method':_0x02f9('0x35'),'uri':'','headers':{'Authorization':_0x02f9('0x48')+_0x32adca},'json':!![]};switch(_0x268eac[_0x02f9('0x50')]){case _0x02f9('0x51'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x53'))['then'](function(_0x29c442){if(_0x29c442)return _0x29c442;_0x1dd3be['uri']='https://www.zohoapis.'+_0x1b736d+_0x02f9('0x54')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,'Leads')[_0x02f9('0x2c')](function(_0xbc23c1){if(_0xbc23c1)return _0xbc23c1;if(_0x268eac[_0x02f9('0x4c')]!=_0x02f9('0x55')){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});});break;case _0x02f9('0x56'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+_0x02f9('0x57')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x53'))[_0x02f9('0x2c')](function(_0x16a816){if(_0x16a816)return _0x16a816;if(_0x268eac[_0x02f9('0x4c')]!='nothing'){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});break;case _0x02f9('0x58'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+_0x02f9('0x54')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x59'))[_0x02f9('0x2c')](function(_0x4341e0){if(_0x4341e0)return _0x4341e0;if(_0x268eac[_0x02f9('0x4c')]!=_0x02f9('0x55')){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});break;}}function getCall(_0x5f14e7,_0x502368,_0x295781,_0x6e6d21,_0xddefd8,_0x2f8a7a,_0x3181f8,_0x18c331){logger[_0x02f9('0x33')]('Creating\x20new\x20call...');var _0x45689c={};_0x45689c[_0x02f9('0x5a')]={'name':!_[_0x02f9('0x1e')](_0x6e6d21[_0x02f9('0x45')][_0x02f9('0x1a')])&&!_[_0x02f9('0x1e')](_0x6e6d21[_0x02f9('0x3e')]['name'])&&_0x6e6d21[_0x02f9('0x3e')][_0x02f9('0x1a')]===_0x02f9('0x5b')?_0x6e6d21[_0x02f9('0x45')][_0x02f9('0x1a')]:!_['isNil'](_0x6e6d21['first_name'])?_0x6e6d21[_0x02f9('0x46')]+'\x20'+_0x6e6d21[_0x02f9('0x47')]:_0x6e6d21['last_name'],'id':_0x6e6d21['id']};_0x45689c[_0x02f9('0x5c')]=intUtil[_0x02f9('0x5d')](_0x2f8a7a['Subjects'],_0x3181f8,'\x20');_0x45689c['Description']=intUtil[_0x02f9('0x5d')](_0x2f8a7a[_0x02f9('0x5e')],_0x3181f8,'\x0a');if(_0xddefd8[_0x02f9('0x4b')]===_0x02f9('0x53')){_0x45689c[_0x02f9('0x5f')]={'name':!_['isNil'](_0xddefd8[_0x02f9('0x60')])?_0xddefd8[_0x02f9('0x60')]:!_['isNil'](_0xddefd8[_0x02f9('0x61')])?_0xddefd8[_0x02f9('0x61')]+'\x20'+_0xddefd8['Last_Name']:_0xddefd8['Last_Name'],'id':_0xddefd8['id']};}if(_0xddefd8[_0x02f9('0x4b')]==='Leads'){_0x45689c['What_Id']={'name':!_[_0x02f9('0x1e')](_0xddefd8['Full_Name'])?_0xddefd8[_0x02f9('0x60')]:!_[_0x02f9('0x1e')](_0xddefd8[_0x02f9('0x61')])?_0xddefd8['First_Name']+'\x20'+_0xddefd8[_0x02f9('0x62')]:_0xddefd8[_0x02f9('0x62')],'id':_0xddefd8['id']};_0x45689c[_0x02f9('0x63')]=_['startCase'](_0xddefd8[_0x02f9('0x4b')]);}if(_0x3181f8[_0x02f9('0x64')]){_0x45689c[_0x02f9('0x65')]=moment[_0x02f9('0x66')](parseInt(_0x3181f8['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x3181f8['answertime']&&_0x3181f8[_0x02f9('0x67')]){_0x45689c[_0x02f9('0x65')]=moment['utc'](moment(_0x3181f8[_0x02f9('0x67')],_0x02f9('0x68'))[_0x02f9('0x69')](moment(_0x3181f8[_0x02f9('0x6a')],_0x02f9('0x68'))))[_0x02f9('0x36')](_0x02f9('0x6b'));}switch(_0x3181f8[_0x02f9('0x6c')]){case _0x02f9('0x6d'):_0x45689c['Call_Result']=_0x02f9('0x6e');break;case _0x02f9('0x6f'):case'connect':_0x45689c[_0x02f9('0x70')]=_0x02f9('0x71');break;case'rejected':_0x45689c[_0x02f9('0x70')]=_0x02f9('0x72');break;case _0x02f9('0x73'):_0x45689c['Call_Result']=_0x02f9('0x74');break;case _0x02f9('0x75'):_0x45689c[_0x02f9('0x70')]=_0x02f9('0x76');default:}_0x45689c['Call_Start_Time']=(_0x18c331===_0x02f9('0x77')?moment(_0x3181f8[_0x02f9('0x6a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x3181f8['agentcalledAt'])[_0x02f9('0x36')](_0x02f9('0x68')))||moment()[_0x02f9('0x36')](_0x02f9('0x68'));_0x45689c[_0x02f9('0x78')]=_0x18c331||_0x02f9('0x79');_0x45689c=_[_0x02f9('0x7a')](_0x45689c,getCustomFields(_0x2f8a7a[_0x02f9('0x7b')],_0x3181f8));return request({'method':_0x02f9('0x27'),'uri':_0x02f9('0x42')+_0x502368+_0x02f9('0x7c'),'headers':{'Authorization':_0x02f9('0x48')+_0x5f14e7},'body':{'data':[_0x45689c]},'json':!![]})['then'](function(_0x3896cf){if(_0x3896cf&&_0x3896cf[_0x02f9('0x41')][0x0][_0x02f9('0x7d')]===_0x02f9('0x49')){logger[_0x02f9('0x33')]('Call\x20created!');return{'id':_0x3896cf[_0x02f9('0x41')][0x0]['details']['id']};}})[_0x02f9('0x30')](function(_0x91c036){logger[_0x02f9('0x33')]('err',_0x91c036[_0x02f9('0x32')]);console['log']('err',_0x91c036);});}exports[_0x02f9('0x7e')]=function(_0x1a5e46,_0x354a76,_0x8b0e4f,_0x9c0c48,_0x238ea0,_0x3befa6){var _0x25a9a1,_0x2bb96a,_0x4997c5;_0x3befa6[_0x02f9('0x7f')]=intUtil[_0x02f9('0x80')](_0x3befa6[_0x02f9('0x7f')]);_0x3befa6['serverUrl']=intUtil[_0x02f9('0x80')](_0x3befa6[_0x02f9('0x81')]);if(_0x238ea0&&_0x238ea0[_0x02f9('0x82')]){logger[_0x02f9('0x33')]('[QUEUE]',_0x02f9('0x83'));_0x354a76['recordingURL']=_0x3befa6[_0x02f9('0x81')]+_0x02f9('0x84')+_0x354a76[_0x02f9('0x85')]+_0x02f9('0x86')+md5(_0x354a76[_0x02f9('0x85')]);}else{_0x354a76['recordingURL']='';}var _0x2028b5=_0x3befa6[_0x02f9('0x7f')]===_0x02f9('0x87')?'eu':_0x02f9('0x88');return getAccessToken(_0x3befa6)[_0x02f9('0x2c')](function(_0x3f6104){_0x4997c5=_0x3f6104;return getUser(_0x4997c5,_0x2028b5,_0x3befa6,_0x9c0c48[_0x02f9('0x3b')]);})[_0x02f9('0x2c')](function(_0x3fd056){_0x25a9a1=_0x3fd056;logger[_0x02f9('0x33')]('The\x20User\x20ID\x20is:',_0x25a9a1['id']);return getEndUser(_0x4997c5,_0x2028b5,_0x3befa6,_0x354a76[_0x02f9('0x89')],_0x354a76[_0x02f9('0x8a')],_0x25a9a1,_0x8b0e4f);})[_0x02f9('0x2c')](function(_0x41d74a){_0x2bb96a=_0x41d74a;return getCall(_0x4997c5,_0x2028b5,_0x3befa6,_0x25a9a1,_0x2bb96a,_0x8b0e4f,_0x354a76,_0x02f9('0x79'));})['then'](function(_0x2fd37c){if(_0x2fd37c){logger['info']('The\x20Call\x20ID\x20is:',_0x2fd37c['id']);logger[_0x02f9('0x33')]('[QUEUE]',_0x02f9('0x8b'));emit(util[_0x02f9('0x36')](_0x02f9('0x8c'),_0x9c0c48[_0x02f9('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3befa6[_0x02f9('0x7f')]+_0x02f9('0x8d')+_0x2fd37c['id']});}})[_0x02f9('0x30')](function(_0x19f883){logger[_0x02f9('0x31')](_0x02f9('0x8e'),JSON['stringify'](_0x19f883));});};exports[_0x02f9('0x77')]=function(_0x3f0868,_0xb785fc,_0x58061a,_0x4c26af,_0x534133,_0x79fc13,_0x3f5ba8){var _0x2fcb5a,_0x2bdffc,_0x1b1e67;_0x79fc13['host']=intUtil[_0x02f9('0x80')](_0x79fc13[_0x02f9('0x7f')]);_0x79fc13['serverUrl']=intUtil[_0x02f9('0x80')](_0x79fc13[_0x02f9('0x81')]);if(_0x3f5ba8&&_0x3f5ba8[_0x02f9('0x8f')]&&_0x3f5ba8[_0x02f9('0x8f')]!==_0x02f9('0x90')){logger[_0x02f9('0x33')](_0x02f9('0x91'),_0x02f9('0x83'));_0xb785fc[_0x02f9('0x92')]=_0x79fc13[_0x02f9('0x81')]+_0x02f9('0x84')+_0xb785fc[_0x02f9('0x85')]+_0x02f9('0x86')+md5(_0xb785fc[_0x02f9('0x85')]);}var _0x4592ea=_0x79fc13[_0x02f9('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x79fc13)[_0x02f9('0x2c')](function(_0x2e6f59){_0x1b1e67=_0x2e6f59;return getUser(_0x1b1e67,_0x4592ea,_0x79fc13,_0x4c26af[_0x02f9('0x3b')]);})[_0x02f9('0x2c')](function(_0x527efc){_0x2fcb5a=_0x527efc;logger['info']('The\x20User\x20ID\x20is:',_0x2fcb5a['id']);return getEndUser(_0x1b1e67,_0x4592ea,_0x79fc13,_0xb785fc[_0x02f9('0x93')],_0xb785fc[_0x02f9('0x94')],_0x2fcb5a,_0x58061a);})[_0x02f9('0x2c')](function(_0x30a91b){_0x2bdffc=_0x30a91b;return getCall(_0x1b1e67,_0x4592ea,_0x79fc13,_0x2fcb5a,_0x2bdffc,_0x58061a,_0xb785fc,_0x02f9('0x95'));})['then'](function(_0x2f3bef){if(_0x2f3bef){logger['info'](_0x02f9('0x96'),_0x2f3bef['id']);logger[_0x02f9('0x33')]('[OUTBOUND]',_0x02f9('0x8b'));emit(util[_0x02f9('0x36')](_0x02f9('0x8c'),_0x4c26af[_0x02f9('0x1a')]),_0x02f9('0x97'),{'uri':_0x02f9('0x98')+_0x79fc13['host']+_0x02f9('0x8d')+_0x2f3bef['id']});}})[_0x02f9('0x30')](function(_0x1c14cf){logger[_0x02f9('0x31')](_0x02f9('0x91'),JSON['stringify'](_0x1c14cf));});};exports['unmanaged']=function(_0x913985,_0x18e7f1,_0x5c592b,_0x3fc590,_0x5e8bac,_0x2368a0){var _0x461703,_0x4a0911,_0xa497f;_0x2368a0[_0x02f9('0x7f')]=intUtil[_0x02f9('0x80')](_0x2368a0[_0x02f9('0x7f')]);_0x2368a0[_0x02f9('0x81')]=intUtil['stripTrailingSlash'](_0x2368a0[_0x02f9('0x81')]);if(_0x5e8bac&&_0x5e8bac[_0x02f9('0x82')]){logger[_0x02f9('0x33')]('['+_0x18e7f1['lastevent'][_0x02f9('0x99')]()+']',_0x02f9('0x83'));_0x18e7f1[_0x02f9('0x92')]=_0x2368a0[_0x02f9('0x81')]+_0x02f9('0x84')+_0x18e7f1['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18e7f1[_0x02f9('0x85')]);}else{_0x18e7f1[_0x02f9('0x92')]='';}var _0x10f858=_0x2368a0['host']===_0x02f9('0x87')?'eu':_0x02f9('0x88');return getAccessToken(_0x2368a0)[_0x02f9('0x2c')](function(_0x4e5490){_0xa497f=_0x4e5490;return getUser(_0xa497f,_0x10f858,_0x2368a0);})[_0x02f9('0x2c')](function(_0xc3ec5){_0x461703=_0xc3ec5;logger[_0x02f9('0x33')](_0x02f9('0x9a'),_0x461703['id']);return getEndUser(_0xa497f,_0x10f858,_0x2368a0,_0x18e7f1[_0x02f9('0x89')],_0x18e7f1[_0x02f9('0x8a')],_0x461703,_0x5c592b);})[_0x02f9('0x2c')](function(_0x42d3b4){_0x4a0911=_0x42d3b4;return getCall(_0xa497f,_0x10f858,_0x2368a0,_0x461703,_0x4a0911,_0x5c592b,_0x18e7f1,_0x02f9('0x79'));})[_0x02f9('0x2c')](function(_0x12dd35){if(_0x12dd35){logger[_0x02f9('0x33')]('The\x20Call\x20ID\x20is:',_0x12dd35['id']);}})['catch'](function(_0x30b6e1){logger[_0x02f9('0x31')]('['+_0x18e7f1['lastevent'][_0x02f9('0x99')]()+']',JSON[_0x02f9('0xf')](_0x30b6e1));});}; \ No newline at end of file +var _0xcc66=['starttime','called','Call_Result','Called','complete','connect','rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','host','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id=','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff'];(function(_0x44e012,_0x1bd12b){var _0x263432=function(_0x2b0131){while(--_0x2b0131){_0x44e012['push'](_0x44e012['shift']());}};_0x263432(++_0x1bd12b);}(_0xcc66,0x163));var _0x6cc6=function(_0x4e4da4,_0x511775){_0x4e4da4=_0x4e4da4-0x0;var _0x4b2cc0=_0xcc66[_0x4e4da4];return _0x4b2cc0;};'use strict';var _=require(_0x6cc6('0x0'));var rp=require(_0x6cc6('0x1'));var md5=require(_0x6cc6('0x2'));var util=require(_0x6cc6('0x3'));var intUtil=require(_0x6cc6('0x4'));var moment=require(_0x6cc6('0x5'));var Redis=require(_0x6cc6('0x6'));var BPromise=require(_0x6cc6('0x7'));var config=require(_0x6cc6('0x8'));var logger=require(_0x6cc6('0x9'))('zoho');config[_0x6cc6('0xa')]=_[_0x6cc6('0xb')](config[_0x6cc6('0xa')],{'host':_0x6cc6('0xc'),'port':0x18eb});var io=require(_0x6cc6('0xd'))(new Redis(config[_0x6cc6('0xa')]));function emit(_0x5c59bf,_0x12f9b6,_0x45defe){io['to'](_0x5c59bf)[_0x6cc6('0xe')](_0x12f9b6,_0x45defe);}function request(_0x47a7d3){logger['debug']('[HTTP]',JSON[_0x6cc6('0xf')](_0x47a7d3));return rp(_0x47a7d3);}function getCustomFields(_0x3be26e,_0x2e0f0a){var _0x4ef508={};if(_0x3be26e[_0x6cc6('0x10')]>0x0){_['forEach'](_0x3be26e,function(_0x7ef4f){if(_[_0x6cc6('0x11')]([_0x6cc6('0x12'),_0x6cc6('0x13')],_0x7ef4f[_0x6cc6('0x14')])&&_0x7ef4f[_0x6cc6('0x15')]){_0x4ef508[_0x7ef4f['idField']]=_0x7ef4f[_0x6cc6('0x16')][_0x6cc6('0x17')]();}else if(_0x7ef4f[_0x6cc6('0x14')]===_0x6cc6('0x18')&&_0x7ef4f[_0x6cc6('0x19')]&&_0x7ef4f[_0x6cc6('0x15')]&&_0x2e0f0a[_0x7ef4f[_0x6cc6('0x19')]]){_0x4ef508[_0x7ef4f['idField']]=_0x2e0f0a[_0x7ef4f['variableName']][_0x6cc6('0x17')]();}else if(_0x7ef4f[_0x6cc6('0x14')]===_0x6cc6('0x1a')&&_0x7ef4f[_0x6cc6('0x1b')]&&_0x7ef4f[_0x6cc6('0x1b')]['name']&&_0x7ef4f['idField']&&_0x2e0f0a[_0x7ef4f[_0x6cc6('0x1b')][_0x6cc6('0x1c')]['toLowerCase']()]){_0x4ef508[_0x7ef4f['idField']]=_0x2e0f0a[_0x7ef4f[_0x6cc6('0x1b')][_0x6cc6('0x1c')][_0x6cc6('0x1d')]()][_0x6cc6('0x17')]();}});}return _0x4ef508;}function getName(_0x4818e7){if(_0x4818e7['indexOf']('\x20')>0x0){var _0x56b6ed=_0x4818e7[_0x6cc6('0x1e')](/ (.+)/);if(_0x56b6ed[0x1]){return _0x56b6ed;}}return[_0x4818e7,_0x4818e7];}var accountsTokens={};function getAccessToken(_0x1f922d){return new Promise(function(_0x42f1c8,_0x1ab369){if(!_['isNil'](accountsTokens[_0x1f922d['id']])&&!_[_0x6cc6('0x1f')](accountsTokens[_0x1f922d['id']][_0x6cc6('0x20')])){if(moment()[_0x6cc6('0x21')](accountsTokens[_0x1f922d['id']]['expires_in'])){_0x42f1c8(accountsTokens[_0x1f922d['id']]['access_token']);}}var _0x59775c;switch(_0x1f922d['zone']){case'US':_0x59775c=_0x6cc6('0x22');break;case'AU':_0x59775c=_0x6cc6('0x23');break;case'EU':_0x59775c=_0x6cc6('0x24');break;case'IN':_0x59775c=_0x6cc6('0x25');break;case'CN':_0x59775c=_0x6cc6('0x26');break;default:_0x59775c='https://accounts.zoho.eu';break;}var _0x1cb45b={'method':_0x6cc6('0x27'),'uri':_0x59775c+'/oauth/v2/token','qs':{'refresh_token':_0x1f922d[_0x6cc6('0x28')],'client_id':_0x1f922d[_0x6cc6('0x29')],'client_secret':_0x1f922d['clientSecret'],'grant_type':_0x6cc6('0x2a')},'json':!![]};return rp(_0x1cb45b)['then'](function(_0x328ecf){accountsTokens[_0x1f922d['id']]={'access_token':_0x328ecf[_0x6cc6('0x20')],'expires_in':moment()[_0x6cc6('0x2b')](_0x328ecf[_0x6cc6('0x2c')],_0x6cc6('0x2d'))};_0x42f1c8(_0x328ecf[_0x6cc6('0x20')]);})[_0x6cc6('0x2e')](function(_0x4f9234){logger[_0x6cc6('0x2f')](_0x6cc6('0x30'),_0x4f9234[_0x6cc6('0x31')]);_0x1ab369(_0x4f9234);});});}function getUser(_0x204c8d,_0x1c075e,_0x344e9c,_0x57bb8c){logger[_0x6cc6('0x32')](_0x6cc6('0x33'));return request({'method':_0x6cc6('0x34'),'uri':util[_0x6cc6('0x35')](_0x6cc6('0x36'),_0x1c075e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x6cc6('0x37')+_0x204c8d},'json':!![]})[_0x6cc6('0x38')](function(_0x1ea16e){if(_0x1ea16e['users']){var _0x262d34=-0x1;if(_['isArrayLikeObject'](_0x1ea16e['users'])){if(!_['isNil'](_0x57bb8c)){_0x262d34=_['findIndex'](_0x1ea16e[_0x6cc6('0x39')],function(_0x38cb91){return _0x38cb91[_0x6cc6('0x3a')]===_0x57bb8c;});}if(_0x262d34>=0x0){logger['info'](_0x6cc6('0x3b'));}else{logger[_0x6cc6('0x32')](_0x6cc6('0x3c'));_0x262d34=_[_0x6cc6('0x3d')](_0x1ea16e[_0x6cc6('0x39')],function(_0xddbf05){return _0xddbf05[_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x3f');});}return _0x1ea16e['users'][_0x262d34];}else{if(_0x1ea16e[_0x6cc6('0x40')][_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x3f')){logger[_0x6cc6('0x32')](_0x6cc6('0x3c'));user=_0x1ea16e['user'];return user;}else{logger[_0x6cc6('0x2f')](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](_0x1ea16e));throw new Error(_0x6cc6('0x42')+JSON[_0x6cc6('0xf')](_0x1ea16e));}}}else{logger[_0x6cc6('0x2f')](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](_0x1ea16e));throw new Error(_0x6cc6('0x42')+JSON[_0x6cc6('0xf')](_0x1ea16e));}})[_0x6cc6('0x2e')](function(_0x5a8e7){console[_0x6cc6('0x2f')](_0x5a8e7);});}function getZohoUser(_0x42a72f,_0x172bd8){return new BPromise(function(_0x427ef7,_0x33b3f5){request(_0x42a72f)[_0x6cc6('0x38')](function(_0x2aa56c){var _0x2463ca=null;if(_0x2aa56c){_0x2463ca=_0x2aa56c[_0x6cc6('0x43')][0x0];_0x2463ca[_0x6cc6('0x44')]=_0x172bd8;}_0x427ef7(_0x2463ca);})[_0x6cc6('0x2e')](function(_0x981bc4){_0x33b3f5(_0x981bc4);});});}function createEndUser(_0x376064,_0x5ce7b6,_0x3d8c24,_0x18b054,_0x46705d,_0x96a3ed){var _0x3d8c24=getName(_0x3d8c24);return request({'method':_0x6cc6('0x27'),'uri':'https://www.zohoapis.'+_0x5ce7b6+_0x6cc6('0x45')+_[_0x6cc6('0x46')](_0x96a3ed[_0x6cc6('0x47')])+'s','body':{'data':[{'Last_Name':_0x3d8c24[0x1],'First_Name':_0x3d8c24[0x0],'Phone':_0x18b054,'Owner':{'name':!_[_0x6cc6('0x1f')](_0x46705d[_0x6cc6('0x48')][_0x6cc6('0x1c')])?_0x46705d['role'][_0x6cc6('0x1c')]:!_['isNil'](_0x46705d[_0x6cc6('0x49')])?_0x46705d[_0x6cc6('0x49')]+'\x20'+_0x46705d[_0x6cc6('0x4a')]:_0x46705d[_0x6cc6('0x4a')],'id':_0x46705d['id']}}]},'headers':{'Authorization':_0x6cc6('0x37')+_0x376064},'json':!![]})[_0x6cc6('0x38')](function(_0x557a1a){if(_0x557a1a&&_0x557a1a[_0x6cc6('0x43')][0x0][_0x6cc6('0x4b')]===_0x6cc6('0x4c')){var _0x1c16e1=_0x557a1a[_0x6cc6('0x43')][0x0][_0x6cc6('0x4d')];_0x1c16e1[_0x6cc6('0x44')]=_[_0x6cc6('0x46')](_0x96a3ed['moduleCreate'])+'s';return _0x1c16e1;}logger['error'](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](data));throw new Error('Error:\x20'+JSON[_0x6cc6('0xf')](data));})['catch'](function(_0x2f52f5){console[_0x6cc6('0x4e')](_0x6cc6('0x4f'),_0x2f52f5);});}function getEndUser(_0x4ddb9a,_0x3ee6d3,_0x45f105,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857){var _0x45275b={'method':_0x6cc6('0x34'),'uri':'','headers':{'Authorization':_0x6cc6('0x37')+_0x4ddb9a},'json':!![]};switch(_0x4a3857[_0x6cc6('0x50')]){case _0x6cc6('0x51'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x54')+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x55'))[_0x6cc6('0x38')](function(_0x3c92c5){if(_0x3c92c5)return _0x3c92c5;_0x45275b[_0x6cc6('0x52')]='https://www.zohoapis.'+_0x3ee6d3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x56'))['then'](function(_0x51faab){if(_0x51faab)return _0x51faab;if(_0x4a3857[_0x6cc6('0x47')]!='nothing'){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});});break;case _0x6cc6('0x57'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x54')+_0x2683ad+'))';return getZohoUser(_0x45275b,'Contacts')[_0x6cc6('0x38')](function(_0x2c59ad){if(_0x2c59ad)return _0x2c59ad;if(_0x4a3857[_0x6cc6('0x47')]!=_0x6cc6('0x58')){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});break;case _0x6cc6('0x59'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x5a')+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x56'))[_0x6cc6('0x38')](function(_0x1b3b11){if(_0x1b3b11)return _0x1b3b11;if(_0x4a3857[_0x6cc6('0x47')]!=_0x6cc6('0x58')){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});break;}}function getCall(_0x23ded8,_0x4d207f,_0xdd6d9d,_0x59d17f,_0x26a0d9,_0x36f44f,_0x5367f4,_0x4ada1d){logger[_0x6cc6('0x32')](_0x6cc6('0x5b'));var _0x2c1df2={};_0x2c1df2['Owner']={'name':!_['isNil'](_0x59d17f['role'][_0x6cc6('0x1c')])&&!_[_0x6cc6('0x1f')](_0x59d17f[_0x6cc6('0x3e')][_0x6cc6('0x1c')])&&_0x59d17f[_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x5c')?_0x59d17f['role'][_0x6cc6('0x1c')]:!_[_0x6cc6('0x1f')](_0x59d17f[_0x6cc6('0x49')])?_0x59d17f[_0x6cc6('0x49')]+'\x20'+_0x59d17f[_0x6cc6('0x4a')]:_0x59d17f['last_name'],'id':_0x59d17f['id']};_0x2c1df2[_0x6cc6('0x5d')]=intUtil[_0x6cc6('0x5e')](_0x36f44f[_0x6cc6('0x5f')],_0x5367f4,'\x20');_0x2c1df2[_0x6cc6('0x60')]=intUtil[_0x6cc6('0x5e')](_0x36f44f['Descriptions'],_0x5367f4,'\x0a');if(_0x26a0d9[_0x6cc6('0x44')]===_0x6cc6('0x55')){_0x2c1df2[_0x6cc6('0x61')]={'name':!_['isNil'](_0x26a0d9[_0x6cc6('0x62')])?_0x26a0d9[_0x6cc6('0x62')]:!_[_0x6cc6('0x1f')](_0x26a0d9['First_Name'])?_0x26a0d9[_0x6cc6('0x63')]+'\x20'+_0x26a0d9[_0x6cc6('0x64')]:_0x26a0d9[_0x6cc6('0x64')],'id':_0x26a0d9['id']};}if(_0x26a0d9[_0x6cc6('0x44')]===_0x6cc6('0x56')){_0x2c1df2[_0x6cc6('0x65')]={'name':!_['isNil'](_0x26a0d9[_0x6cc6('0x62')])?_0x26a0d9[_0x6cc6('0x62')]:!_['isNil'](_0x26a0d9[_0x6cc6('0x63')])?_0x26a0d9[_0x6cc6('0x63')]+'\x20'+_0x26a0d9[_0x6cc6('0x64')]:_0x26a0d9['Last_Name'],'id':_0x26a0d9['id']};_0x2c1df2[_0x6cc6('0x66')]=_[_0x6cc6('0x46')](_0x26a0d9['enduserType']);}if(_0x5367f4['talktime']){_0x2c1df2[_0x6cc6('0x67')]=moment['utc'](parseInt(_0x5367f4[_0x6cc6('0x68')])*0x3e8)['format'](_0x6cc6('0x69'));}else if(_0x5367f4['answertime']&&_0x5367f4['endtime']){_0x2c1df2[_0x6cc6('0x67')]=moment[_0x6cc6('0x6a')](moment(_0x5367f4[_0x6cc6('0x6b')],_0x6cc6('0x6c'))[_0x6cc6('0x6d')](moment(_0x5367f4[_0x6cc6('0x6e')],_0x6cc6('0x6c'))))['format'](_0x6cc6('0x69'));}switch(_0x5367f4['lastevent']){case _0x6cc6('0x6f'):_0x2c1df2[_0x6cc6('0x70')]=_0x6cc6('0x71');break;case _0x6cc6('0x72'):case _0x6cc6('0x73'):_0x2c1df2[_0x6cc6('0x70')]='Answered';break;case _0x6cc6('0x74'):_0x2c1df2[_0x6cc6('0x70')]='Rejected';break;case _0x6cc6('0x75'):_0x2c1df2[_0x6cc6('0x70')]='Abandoned';break;case _0x6cc6('0x76'):_0x2c1df2[_0x6cc6('0x70')]=_0x6cc6('0x77');default:}_0x2c1df2['Call_Start_Time']=(_0x4ada1d===_0x6cc6('0x78')?moment(_0x5367f4[_0x6cc6('0x6e')])[_0x6cc6('0x35')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5367f4[_0x6cc6('0x79')])[_0x6cc6('0x35')](_0x6cc6('0x6c')))||moment()[_0x6cc6('0x35')]('YYYY-MM-DDTHH:mm:ss');_0x2c1df2[_0x6cc6('0x7a')]=_0x4ada1d||_0x6cc6('0x7b');_0x2c1df2=_[_0x6cc6('0x7c')](_0x2c1df2,getCustomFields(_0x36f44f[_0x6cc6('0x7d')],_0x5367f4));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4d207f+_0x6cc6('0x7e'),'headers':{'Authorization':_0x6cc6('0x37')+_0x23ded8},'body':{'data':[_0x2c1df2]},'json':!![]})[_0x6cc6('0x38')](function(_0x1c8bc1){if(_0x1c8bc1&&_0x1c8bc1[_0x6cc6('0x43')][0x0][_0x6cc6('0x4b')]===_0x6cc6('0x4c')){logger[_0x6cc6('0x32')]('Call\x20created!');return{'id':_0x1c8bc1[_0x6cc6('0x43')][0x0][_0x6cc6('0x4d')]['id']};}})[_0x6cc6('0x2e')](function(_0x4bf3d0){logger[_0x6cc6('0x32')](_0x6cc6('0x7f'),_0x4bf3d0[_0x6cc6('0x31')]);console[_0x6cc6('0x4e')](_0x6cc6('0x7f'),_0x4bf3d0);});}exports['queue']=function(_0x2d2c0b,_0x3fb5ba,_0x3fcd4d,_0x31cb7b,_0x1423ab,_0x340f0f){var _0x580e58,_0x2b9862,_0x53f903;_0x340f0f['host']=intUtil[_0x6cc6('0x80')](_0x340f0f['host']);_0x340f0f[_0x6cc6('0x81')]=intUtil[_0x6cc6('0x80')](_0x340f0f[_0x6cc6('0x81')]);if(_0x1423ab&&_0x1423ab['monitor_format']){logger['info']('[QUEUE]',_0x6cc6('0x82'));_0x3fb5ba[_0x6cc6('0x83')]=_0x340f0f[_0x6cc6('0x81')]+_0x6cc6('0x84')+_0x3fb5ba['uniqueid']+_0x6cc6('0x85')+md5(_0x3fb5ba['uniqueid']);}else{_0x3fb5ba[_0x6cc6('0x83')]='';}var _0x309035=_0x340f0f[_0x6cc6('0x86')]===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0x340f0f)['then'](function(_0x14511e){_0x53f903=_0x14511e;return getUser(_0x53f903,_0x309035,_0x340f0f,_0x31cb7b[_0x6cc6('0x3a')]);})['then'](function(_0xd454ab){_0x580e58=_0xd454ab;logger[_0x6cc6('0x32')]('The\x20User\x20ID\x20is:',_0x580e58['id']);return getEndUser(_0x53f903,_0x309035,_0x340f0f,_0x3fb5ba[_0x6cc6('0x89')],_0x3fb5ba[_0x6cc6('0x8a')],_0x580e58,_0x3fcd4d);})[_0x6cc6('0x38')](function(_0x5dca3a){_0x2b9862=_0x5dca3a;return getCall(_0x53f903,_0x309035,_0x340f0f,_0x580e58,_0x2b9862,_0x3fcd4d,_0x3fb5ba,_0x6cc6('0x7b'));})[_0x6cc6('0x38')](function(_0x4f387c){if(_0x4f387c){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x4f387c['id']);logger[_0x6cc6('0x32')](_0x6cc6('0x8c'),_0x6cc6('0x8d'));emit(util[_0x6cc6('0x35')]('user:%s',_0x31cb7b[_0x6cc6('0x1c')]),_0x6cc6('0x8e'),{'uri':_0x6cc6('0x8f')+_0x340f0f['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4f387c['id']});}})[_0x6cc6('0x2e')](function(_0x317023){logger['error'](_0x6cc6('0x8c'),JSON['stringify'](_0x317023));});};exports[_0x6cc6('0x78')]=function(_0x4d12a8,_0x16e745,_0x4dd7ea,_0x332993,_0x456e89,_0xf85581,_0x47a450){var _0x34c6c2,_0x955582,_0x284bf4;_0xf85581[_0x6cc6('0x86')]=intUtil[_0x6cc6('0x80')](_0xf85581[_0x6cc6('0x86')]);_0xf85581[_0x6cc6('0x81')]=intUtil['stripTrailingSlash'](_0xf85581[_0x6cc6('0x81')]);if(_0x47a450&&_0x47a450[_0x6cc6('0x90')]&&_0x47a450[_0x6cc6('0x90')]!==_0x6cc6('0x91')){logger[_0x6cc6('0x32')](_0x6cc6('0x92'),_0x6cc6('0x82'));_0x16e745['recordingURL']=_0xf85581['serverUrl']+_0x6cc6('0x84')+_0x16e745[_0x6cc6('0x93')]+'/downloads?type=uniqueid&token='+md5(_0x16e745[_0x6cc6('0x93')]);}var _0x21e93c=_0xf85581['host']===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0xf85581)[_0x6cc6('0x38')](function(_0xff5e79){_0x284bf4=_0xff5e79;return getUser(_0x284bf4,_0x21e93c,_0xf85581,_0x332993[_0x6cc6('0x3a')]);})[_0x6cc6('0x38')](function(_0x13b47d){_0x34c6c2=_0x13b47d;logger[_0x6cc6('0x32')]('The\x20User\x20ID\x20is:',_0x34c6c2['id']);return getEndUser(_0x284bf4,_0x21e93c,_0xf85581,_0x16e745['destcalleridname'],_0x16e745[_0x6cc6('0x94')],_0x34c6c2,_0x4dd7ea);})[_0x6cc6('0x38')](function(_0x371b2d){_0x955582=_0x371b2d;return getCall(_0x284bf4,_0x21e93c,_0xf85581,_0x34c6c2,_0x955582,_0x4dd7ea,_0x16e745,_0x6cc6('0x95'));})['then'](function(_0x1c944f){if(_0x1c944f){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x1c944f['id']);logger[_0x6cc6('0x32')](_0x6cc6('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6cc6('0x35')](_0x6cc6('0x96'),_0x332993[_0x6cc6('0x1c')]),_0x6cc6('0x8e'),{'uri':'https://crm.'+_0xf85581[_0x6cc6('0x86')]+_0x6cc6('0x97')+_0x1c944f['id']});}})['catch'](function(_0x377e21){logger['error'](_0x6cc6('0x92'),JSON[_0x6cc6('0xf')](_0x377e21));});};exports['unmanaged']=function(_0x150b00,_0x51ce67,_0x11a872,_0x4c3cc1,_0x2a3a81,_0x397e86){var _0x2955b8,_0x1d0bb1,_0x9d7d65;_0x397e86[_0x6cc6('0x86')]=intUtil['stripTrailingSlash'](_0x397e86[_0x6cc6('0x86')]);_0x397e86[_0x6cc6('0x81')]=intUtil['stripTrailingSlash'](_0x397e86[_0x6cc6('0x81')]);if(_0x2a3a81&&_0x2a3a81[_0x6cc6('0x98')]){logger[_0x6cc6('0x32')]('['+_0x51ce67[_0x6cc6('0x99')][_0x6cc6('0x9a')]()+']',_0x6cc6('0x82'));_0x51ce67[_0x6cc6('0x83')]=_0x397e86[_0x6cc6('0x81')]+_0x6cc6('0x84')+_0x51ce67[_0x6cc6('0x93')]+_0x6cc6('0x85')+md5(_0x51ce67[_0x6cc6('0x93')]);}else{_0x51ce67['recordingURL']='';}var _0x5aada2=_0x397e86[_0x6cc6('0x86')]===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0x397e86)['then'](function(_0x1ccf9d){_0x9d7d65=_0x1ccf9d;return getUser(_0x9d7d65,_0x5aada2,_0x397e86);})[_0x6cc6('0x38')](function(_0x1e2245){_0x2955b8=_0x1e2245;logger['info']('The\x20User\x20ID\x20is:',_0x2955b8['id']);return getEndUser(_0x9d7d65,_0x5aada2,_0x397e86,_0x51ce67[_0x6cc6('0x89')],_0x51ce67['calleridnum'],_0x2955b8,_0x11a872);})[_0x6cc6('0x38')](function(_0x5d7799){_0x1d0bb1=_0x5d7799;return getCall(_0x9d7d65,_0x5aada2,_0x397e86,_0x2955b8,_0x1d0bb1,_0x11a872,_0x51ce67,_0x6cc6('0x7b'));})[_0x6cc6('0x38')](function(_0x316258){if(_0x316258){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x316258['id']);}})[_0x6cc6('0x2e')](function(_0x29afea){logger[_0x6cc6('0x2f')]('['+_0x51ce67[_0x6cc6('0x99')]['toUpperCase']()+']',JSON[_0x6cc6('0xf')](_0x29afea));});}; \ 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 21c4fd2..b95474d 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 _0x8ee7=['info','util','shelljs','trigger','exec','Script','data3','error','format'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x8ee7,0x1de));var _0x78ee=function(_0x249ffb,_0x1c84a2){_0x249ffb=_0x249ffb-0x0;var _0x52b118=_0x8ee7[_0x249ffb];return _0x52b118;};'use strict';var util=require(_0x78ee('0x0'));var sh=require(_0x78ee('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x78ee('0x2'));exports[_0x78ee('0x3')]=function(_0xdfe157,_0xb17a16){var _0x194827=_0xdfe157['data2']?_0xdfe157['data2']:_0x78ee('0x4');var _0xe42719=_0xdfe157[_0x78ee('0x5')]?Mustache['render'](_0xdfe157[_0x78ee('0x5')],_0xb17a16):_0xb17a16;sh[_0x78ee('0x3')](_0xe42719,function(_0x4849c7,_0x2243ce,_0x539b27){if(_0x4849c7!==0x0){logger[_0x78ee('0x6')](util[_0x78ee('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x194827,_0xe42719,_0x4849c7,_0x539b27));}else{logger[_0x78ee('0x8')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x194827,_0xe42719,_0x2243ce));}});}; \ No newline at end of file +var _0x0c7d=['format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','exec','Script','data3','render','error'];(function(_0x5ce7b4,_0x404554){var _0x2af81b=function(_0x2b465f){while(--_0x2b465f){_0x5ce7b4['push'](_0x5ce7b4['shift']());}};_0x2af81b(++_0x404554);}(_0x0c7d,0x153));var _0xd0c7=function(_0x2e1e3d,_0x2d6648){_0x2e1e3d=_0x2e1e3d-0x0;var _0x129355=_0x0c7d[_0x2e1e3d];return _0x129355;};'use strict';var util=require(_0xd0c7('0x0'));var sh=require('shelljs');var Mustache=require(_0xd0c7('0x1'));var logger=require(_0xd0c7('0x2'))(_0xd0c7('0x3'));exports[_0xd0c7('0x4')]=function(_0x5ef469,_0x3ad694){var _0x335172=_0x5ef469['data2']?_0x5ef469['data2']:_0xd0c7('0x5');var _0x47da2b=_0x5ef469[_0xd0c7('0x6')]?Mustache[_0xd0c7('0x7')](_0x5ef469[_0xd0c7('0x6')],_0x3ad694):_0x3ad694;sh[_0xd0c7('0x4')](_0x47da2b,function(_0x49c963,_0x580544,_0x1e3d44){if(_0x49c963!==0x0){logger[_0xd0c7('0x8')](util[_0xd0c7('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x335172,_0x47da2b,_0x49c963,_0x1e3d44));}else{logger[_0xd0c7('0xa')](util['format'](_0xd0c7('0xb'),_0x335172,_0x47da2b,_0x580544));}});}; \ 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 6a5289e..4b247e8 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 _0xfce8=['DELETE','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then',',\x20request\x20body:\x20','body','object','format','statusCode','catch','name','message','util','lodash','trigger','exec','data1','render','data2','data5','number','data6','parse','error','stack','toUpperCase','GET'];(function(_0x463805,_0x203219){var _0x85cb8=function(_0x49b541){while(--_0x49b541){_0x463805['push'](_0x463805['shift']());}};_0x85cb8(++_0x203219);}(_0xfce8,0x65));var _0x8fce=function(_0x1e76dc,_0x448187){_0x1e76dc=_0x1e76dc-0x0;var _0x435b9e=_0xfce8[_0x1e76dc];return _0x435b9e;};'use strict';var rp=require('request-promise');var util=require(_0x8fce('0x0'));var _=require(_0x8fce('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x8fce('0x2'));exports[_0x8fce('0x3')]=function(_0x3ffdb0,_0xaf3242){var _0x53c6a2,_0x2b4d57;var _0x4ea2ef={'method':_0x3ffdb0[_0x8fce('0x4')]['toUpperCase'](),'uri':Mustache[_0x8fce('0x5')](_0x3ffdb0[_0x8fce('0x6')],_0xaf3242),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ffdb0[_0x8fce('0x7')])===_0x8fce('0x8')&&parseInt(_0x3ffdb0[_0x8fce('0x7')])>=0x1&&parseInt(_0x3ffdb0['data5'])<=0xa?parseInt(_0x3ffdb0[_0x8fce('0x7')])*0x3e8:0x5*0x3e8};try{_0x4ea2ef['headers']=_0x3ffdb0[_0x8fce('0x9')]?JSON[_0x8fce('0xa')](Mustache['render'](_0x3ffdb0[_0x8fce('0x9')],_0xaf3242)):{};}catch(_0x329734){logger[_0x8fce('0xb')](_0x329734[_0x8fce('0xc')]);}switch(_0x3ffdb0['data1'][_0x8fce('0xd')]()){case _0x8fce('0xe'):case _0x8fce('0xf'):_0x53c6a2=null;_0x4ea2ef['qs']=_0xaf3242;break;case'POST':case'PUT':if(_0x3ffdb0['data7']){try{_0x53c6a2=JSON[_0x8fce('0xa')](Mustache[_0x8fce('0x5')](_0x3ffdb0[_0x8fce('0x10')],_0xaf3242));_0x4ea2ef['body']=_0x53c6a2;}catch(_0x3d769f){logger[_0x8fce('0xb')](_0x3d769f['stack']);logger['error'](_0x8fce('0x11'));}}else{_0x53c6a2=_0xaf3242;_0x4ea2ef['body']=_0x53c6a2;}break;}logger[_0x8fce('0x12')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3ffdb0[_0x8fce('0x4')],_0x3ffdb0[_0x8fce('0x6')],JSON[_0x8fce('0x13')](_0x4ea2ef)));rp(_0x4ea2ef)[_0x8fce('0x14')](function(_0x14fcfe){_0x53c6a2=!_['isNil'](_0x53c6a2)?_0x8fce('0x15')+_0x53c6a2:'';_0x2b4d57=typeof _0x14fcfe[_0x8fce('0x16')]===_0x8fce('0x17')?JSON[_0x8fce('0x13')](_0x14fcfe[_0x8fce('0x16')]):_0x14fcfe['body'];logger['info'](util[_0x8fce('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3ffdb0[_0x8fce('0x4')],_0x3ffdb0['data2'],_0x14fcfe[_0x8fce('0x19')],_0x2b4d57));})[_0x8fce('0x1a')](function(_0x36ba29){logger[_0x8fce('0xb')](util[_0x8fce('0x18')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3ffdb0['data1'],_0x3ffdb0['data2'],_0x36ba29['statusCode'],_0x36ba29[_0x8fce('0x1b')],_0x36ba29[_0x8fce('0x1c')]));});}; \ No newline at end of file +var _0x8749=['trigger','exec','data1','data2','data5','headers','data6','parse','render','error','toUpperCase','POST','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x41ecc2,_0x63f3fe){var _0x4ba158=function(_0x535b1){while(--_0x535b1){_0x41ecc2['push'](_0x41ecc2['shift']());}};_0x4ba158(++_0x63f3fe);}(_0x8749,0x1a8));var _0x9874=function(_0x2f2c92,_0xcd7d9f){_0x2f2c92=_0x2f2c92-0x0;var _0x3cdd48=_0x8749[_0x2f2c92];return _0x3cdd48;};'use strict';var rp=require(_0x9874('0x0'));var util=require(_0x9874('0x1'));var _=require(_0x9874('0x2'));var Mustache=require(_0x9874('0x3'));var logger=require(_0x9874('0x4'))(_0x9874('0x5'));exports[_0x9874('0x6')]=function(_0xd0b8b9,_0x8860e4){var _0x9e58eb,_0xd1b1df;var _0x2b4c3b={'method':_0xd0b8b9[_0x9874('0x7')]['toUpperCase'](),'uri':Mustache['render'](_0xd0b8b9[_0x9874('0x8')],_0x8860e4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd0b8b9['data5'])==='number'&&parseInt(_0xd0b8b9[_0x9874('0x9')])>=0x1&&parseInt(_0xd0b8b9[_0x9874('0x9')])<=0xa?parseInt(_0xd0b8b9[_0x9874('0x9')])*0x3e8:0x5*0x3e8};try{_0x2b4c3b[_0x9874('0xa')]=_0xd0b8b9[_0x9874('0xb')]?JSON[_0x9874('0xc')](Mustache[_0x9874('0xd')](_0xd0b8b9['data6'],_0x8860e4)):{};}catch(_0x3be318){logger[_0x9874('0xe')](_0x3be318['stack']);}switch(_0xd0b8b9[_0x9874('0x7')][_0x9874('0xf')]()){case'GET':case'DELETE':_0x9e58eb=null;_0x2b4c3b['qs']=_0x8860e4;break;case _0x9874('0x10'):case'PUT':if(_0xd0b8b9[_0x9874('0x11')]){try{_0x9e58eb=JSON[_0x9874('0xc')](Mustache[_0x9874('0xd')](_0xd0b8b9[_0x9874('0x11')],_0x8860e4));_0x2b4c3b[_0x9874('0x12')]=_0x9e58eb;}catch(_0x36314f){logger[_0x9874('0xe')](_0x36314f[_0x9874('0x13')]);logger[_0x9874('0xe')](_0x9874('0x14'));}}else{_0x9e58eb=_0x8860e4;_0x2b4c3b[_0x9874('0x12')]=_0x9e58eb;}break;}logger['info'](util[_0x9874('0x15')](_0x9874('0x16'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9['data2'],JSON[_0x9874('0x17')](_0x2b4c3b)));rp(_0x2b4c3b)[_0x9874('0x18')](function(_0x144615){_0x9e58eb=!_[_0x9874('0x19')](_0x9e58eb)?_0x9874('0x1a')+_0x9e58eb:'';_0xd1b1df=typeof _0x144615['body']==='object'?JSON[_0x9874('0x17')](_0x144615[_0x9874('0x12')]):_0x144615[_0x9874('0x12')];logger[_0x9874('0x1b')](util['format'](_0x9874('0x1c'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9[_0x9874('0x8')],_0x144615[_0x9874('0x1d')],_0xd1b1df));})[_0x9874('0x1e')](function(_0x2473d0){logger[_0x9874('0xe')](util['format'](_0x9874('0x1f'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9[_0x9874('0x8')],_0x2473d0['statusCode'],_0x2473d0['name'],_0x2473d0[_0x9874('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index bc4ebb5..4451869 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 _0x8583=['message','result','catch','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc','error'];(function(_0x532127,_0x4e47db){var _0x15e430=function(_0x57ecc1){while(--_0x57ecc1){_0x532127['push'](_0x532127['shift']());}};_0x15e430(++_0x4e47db);}(_0x8583,0x162));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3858('0x0'));var logger=require(_0x3858('0x1'))(_0x3858('0x2'));var client=jayson['client'][_0x3858('0x3')]({'port':0x2329});client[_0x3858('0x4')]=function(_0x30789d,_0x1b522c){return new BPromise(function(_0x466dee,_0x16882a){return client[_0x3858('0x5')](_0x30789d,_0x1b522c)[_0x3858('0x6')](function(_0x42df86){logger[_0x3858('0x7')](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x1b522c,_0x42df86);if(_0x42df86[_0x3858('0x9')]){logger['error'](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x42df86['error']['message'],_0x1b522c);return _0x16882a(_0x42df86['error'][_0x3858('0xa')]);}else{return _0x466dee(_0x42df86[_0x3858('0xb')]);}})[_0x3858('0xc')](function(_0x3fba68){logger[_0x3858('0x9')](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x3fba68,_0x1b522c);return _0x16882a(_0x3fba68);});});};module['exports']=client; \ No newline at end of file +var _0x313f=['message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','error'];(function(_0x561458,_0x225481){var _0x1a8d5f=function(_0x4fe001){while(--_0x4fe001){_0x561458['push'](_0x561458['shift']());}};_0x1a8d5f(++_0x225481);}(_0x313f,0x1c5));var _0xf313=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x313f[_0x473b41];return _0x4e521d;};'use strict';var jayson=require(_0xf313('0x0'));var BPromise=require(_0xf313('0x1'));var logger=require(_0xf313('0x2'))(_0xf313('0x3'));var client=jayson[_0xf313('0x4')][_0xf313('0x5')]({'port':0x2329});client[_0xf313('0x6')]=function(_0x37dd6e,_0x3f98a3){return new BPromise(function(_0xc3de21,_0x4cb652){return client[_0xf313('0x7')](_0x37dd6e,_0x3f98a3)['then'](function(_0x473431){logger['debug']('rpc','routing',_0x37dd6e,_0x3f98a3,_0x473431);if(_0x473431['error']){logger[_0xf313('0x8')]('rpc',_0xf313('0x3'),_0x37dd6e,_0x473431[_0xf313('0x8')][_0xf313('0x9')],_0x3f98a3);return _0x4cb652(_0x473431[_0xf313('0x8')][_0xf313('0x9')]);}else{return _0xc3de21(_0x473431[_0xf313('0xa')]);}})[_0xf313('0xb')](function(_0x3d33ef){logger[_0xf313('0x8')](_0xf313('0xc'),_0xf313('0x3'),_0x37dd6e,_0x3d33ef,_0x3f98a3);return _0x4cb652(_0x3d33ef);});});};module[_0xf313('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5597d3e..69765db 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 _0x88dd=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','then','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x88dd,0xd8));var _0xd88d=function(_0x1f8482,_0x5382fd){_0x1f8482=_0x1f8482-0x0;var _0x235c8c=_0x88dd[_0x1f8482];return _0x235c8c;};'use strict';var server=require(_0xd88d('0x0'));var Realtime=require(_0xd88d('0x1'));var EmailChannel=require(_0xd88d('0x2'));var mailAccount=require(_0xd88d('0x3'));var setting=require(_0xd88d('0x4'));var logger=require(_0xd88d('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd88d('0x6')]()['then'](mailAccount[_0xd88d('0x7')]())['then'](realtime[_0xd88d('0x8')]())['then'](function(){email[_0xd88d('0x9')](realtime[_0xd88d('0xa')]);return realtime;});}function main(){return server[_0xd88d('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0xd88d('0xc')](function(){return setting[_0xd88d('0xd')]();})[_0xd88d('0xc')](function(_0x3ce890){return setInterval(initRealtime,_0x3ce890[_0xd88d('0xe')]*0x3e8);})[_0xd88d('0xf')](function(_0x1b56c9){logger[_0xd88d('0x10')](_0xd88d('0x11'),_0x1b56c9);});}main(); \ No newline at end of file +var _0xf133=['./rpc/setting','../../config/logger','resolve','then','refresh','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0xf133,0x191));var _0x3f13=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xf133[_0x68c979];return _0x4f0001;};'use strict';var server=require(_0x3f13('0x0'));var Realtime=require(_0x3f13('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3f13('0x2'));var logger=require(_0x3f13('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3f13('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x3f13('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0x3f13('0x6')](realtime[_0x3f13('0x7')]);return realtime;});}function main(){return server[_0x3f13('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0x3f13('0x5')](function(){return setting['getSettings']();})[_0x3f13('0x5')](function(_0xdd367b){return setInterval(initRealtime,_0xdd367b[_0x3f13('0x9')]*0x3e8);})[_0x3f13('0xa')](function(_0x4e81d7){logger[_0x3f13('0xb')](_0x3f13('0xc'),_0x4e81d7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 48f9e85..3caedc8 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 _0x3061=['active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','provider','custom','service','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','info','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','exports','moment','bluebird','md5','ioredis','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','key'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3061,0xfc));var _0x1306=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x3061[_0x38622b];return _0x2c1a7a;};'use strict';var _=require('lodash');var moment=require(_0x1306('0x0'));var BPromise=require(_0x1306('0x1'));var md5=require(_0x1306('0x2'));var Redis=require(_0x1306('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x1306('0x4'));config[_0x1306('0x5')]=_[_0x1306('0x6')](config[_0x1306('0x5')],{'host':_0x1306('0x7'),'port':0x18eb});var io=require(_0x1306('0x8'))(new Redis(config[_0x1306('0x5')]));var EmailImap=require(_0x1306('0x9'));var EmailSmtp=require(_0x1306('0xa'));var mailAccount=require(_0x1306('0xb'));var md5Accounts={};function EmailChannel(_0x5241c6){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x5241c6[_0x1306('0xc')];this[_0x1306('0xd')]={};this[_0x1306('0xe')]=new EmailSmtp();}EmailChannel[_0x1306('0xf')][_0x1306('0x10')]=function(_0x15f088){var _0x1f445c=this[_0x1306('0xc')][_0x15f088];var _0x348c3a={'id':_0x1f445c['id'],'name':_0x1f445c['name'],'key':_0x1f445c[_0x1306('0x11')],'active':_0x1f445c[_0x1306('0x12')],'Imap':{'status':_0x1f445c[_0x1306('0x13')][_0x1306('0x14')],'messageStatus':_0x1f445c['Imap'][_0x1306('0x15')],'total':_0x1f445c[_0x1306('0x13')][_0x1306('0x16')]}};if(_[_0x1306('0x17')](md5Accounts[_0x15f088])){md5Accounts[_0x15f088]={};}var _0x16c329=md5(JSON[_0x1306('0x18')](_0x348c3a));if(md5Accounts[_0x15f088][_0x1306('0x2')]!==_0x16c329){md5Accounts[_0x15f088][_0x1306('0x2')]=_0x16c329;io['emit'](_0x1306('0x19'),_0x348c3a);}};EmailChannel[_0x1306('0xf')]['refresh']=function(_0x417c3f){for(var _0x266510 in _0x417c3f){if(_0x417c3f['hasOwnProperty'](_0x266510)){if(_0x417c3f[_0x266510][_0x1306('0x13')]&&_0x417c3f[_0x266510]['active']){var _0x18a7be=_0x417c3f[_0x266510][_0x1306('0x13')];if(!_0x18a7be['service']&&_0x417c3f[_0x266510][_0x1306('0x1a')]!==_0x1306('0x1b'))_0x18a7be[_0x1306('0x1c')]=_0x417c3f[_0x266510]['provider'];if(!this[_0x1306('0xd')]['hasOwnProperty'](_0x18a7be['id'])){this[_0x1306('0xd')][_0x18a7be['id']]=new EmailImap(_0x18a7be,_0x417c3f[_0x266510]['email']);this[_0x1306('0xd')][_0x18a7be['id']]['on'](_0x1306('0x1d'),this[_0x1306('0x1e')][_0x1306('0x1f')](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on']('email',this[_0x1306('0x20')][_0x1306('0x1f')](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on'](_0x1306('0x21'),this[_0x1306('0x22')]['bind'](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on']('error',this[_0x1306('0x23')][_0x1306('0x1f')](this,_0x266510));}}else{if(_[_0x1306('0x17')](this['mailAccounts'][_0x266510]['Imap'])){this[_0x1306('0xc')][_0x266510][_0x1306('0x13')]={};}this['mailAccounts'][_0x266510]['Imap']['status']='disabled';this[_0x1306('0xc')][_0x266510][_0x1306('0x13')][_0x1306('0x15')]='';this[_0x1306('0x10')](_0x266510);}}}};EmailChannel[_0x1306('0xf')]['handleImapBox']=function(_0x333862,_0xf57c2){if(this[_0x1306('0xc')][_0x333862]){this['mailAccounts'][_0x333862][_0x1306('0x13')][_0x1306('0x14')]='connected';this[_0x1306('0xc')][_0x333862][_0x1306('0x13')][_0x1306('0x15')]=_0xf57c2[_0x1306('0x24')];if(_0xf57c2[_0x1306('0x25')]){this[_0x1306('0xc')][_0x333862]['Imap'][_0x1306('0x16')]=_0xf57c2[_0x1306('0x25')][_0x1306('0x16')];}return this['emit'](_0x333862);}};EmailChannel[_0x1306('0xf')][_0x1306('0x20')]=function(_0x20e38b,_0x477795){logger['info'](_0x1306('0x26'),_0x477795[_0x1306('0x27')],_0x477795[_0x1306('0x28')],_0x477795[_0x1306('0x29')],_0x20e38b);if(this[_0x1306('0xc')][_0x20e38b]){return mailAccount['notify'](_0x20e38b,_0x477795)[_0x1306('0x2a')](function(_0xb04239){if(_0xb04239){logger[_0x1306('0x2b')](_0x1306('0x2c'));}})[_0x1306('0x2d')](function(_0x45dc17){logger[_0x1306('0x2e')](_0x1306('0x2f'),JSON[_0x1306('0x18')](_0x45dc17));});}};EmailChannel[_0x1306('0xf')]['handleImapEnd']=function(_0x6d407f){if(this['mailAccounts'][_0x6d407f]&&this[_0x1306('0xc')][_0x6d407f][_0x1306('0x13')]){if(this[_0x1306('0xd')][this[_0x1306('0xc')][_0x6d407f][_0x1306('0x13')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x6d407f][_0x1306('0x13')]['id']];}this[_0x1306('0xc')][_0x6d407f]['Imap'][_0x1306('0x30')]=moment();this[_0x1306('0x10')](_0x6d407f);}};EmailChannel[_0x1306('0xf')][_0x1306('0x23')]=function(_0x5f3cda,_0x23aaf3){if(this['mailAccounts'][_0x5f3cda]){this[_0x1306('0xc')][_0x5f3cda]['Imap']['status']=_0x1306('0x2e');this['mailAccounts'][_0x5f3cda][_0x1306('0x13')][_0x1306('0x15')]=_0x23aaf3;return this[_0x1306('0x10')](_0x5f3cda);}};EmailChannel[_0x1306('0xf')][_0x1306('0x31')]=function(_0x36103a,_0x1fadad){return this[_0x1306('0xe')][_0x1306('0x32')](_0x36103a,_0x1fadad);};EmailChannel[_0x1306('0xf')]['verifySmtp']=function(_0x48856a){var _0x47a7cd=this;if(this[_0x1306('0xc')][_0x48856a['id']]){if(_[_0x1306('0x17')](this[_0x1306('0xc')][_0x48856a['id']]['Smtp'])){this[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')]={};}this[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')][_0x1306('0x30')]=moment();return new BPromise(function(_0xcfe2a,_0x939a0a){return _0x47a7cd[_0x1306('0xe')][_0x1306('0x34')](_0x48856a)['then'](function(_0x4ee831){_0x47a7cd[_0x1306('0xc')][_0x48856a['id']]['Smtp'][_0x1306('0x14')]='verified';_0x47a7cd[_0x1306('0xc')][_0x48856a['id']]['Smtp'][_0x1306('0x15')]='';_0x47a7cd[_0x1306('0x10')](_0x48856a['id']);_0xcfe2a(_0x4ee831);})[_0x1306('0x2d')](function(_0x2bf8dd){_0x47a7cd['mailAccounts'][_0x48856a['id']][_0x1306('0x33')]['status']=_0x1306('0x2e');_0x47a7cd[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')][_0x1306('0x15')]=_0x2bf8dd;_0x47a7cd['emit'](_0x48856a['id']);_0x939a0a(_0x2bf8dd);});});}return this[_0x1306('0xe')][_0x1306('0x34')](_0x48856a);};module[_0x1306('0x35')]=EmailChannel; \ No newline at end of file +var _0x63d8=['Smtp','verify','then','verified','catch','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp'];(function(_0x26ac19,_0x5a940e){var _0x3cb640=function(_0x40f0b5){while(--_0x40f0b5){_0x26ac19['push'](_0x26ac19['shift']());}};_0x3cb640(++_0x5a940e);}(_0x63d8,0x127));var _0x863d=function(_0xf909d4,_0x50dbaa){_0xf909d4=_0xf909d4-0x0;var _0x50b354=_0x63d8[_0xf909d4];return _0x50b354;};'use strict';var _=require(_0x863d('0x0'));var moment=require(_0x863d('0x1'));var BPromise=require(_0x863d('0x2'));var md5=require(_0x863d('0x3'));var Redis=require('ioredis');var config=require(_0x863d('0x4'));var logger=require(_0x863d('0x5'))(_0x863d('0x6'));config[_0x863d('0x7')]=_['defaults'](config[_0x863d('0x7')],{'host':_0x863d('0x8'),'port':0x18eb});var io=require(_0x863d('0x9'))(new Redis(config[_0x863d('0x7')]));var EmailImap=require(_0x863d('0xa'));var EmailSmtp=require(_0x863d('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3ec3d5){logger[_0x863d('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x3ec3d5[_0x863d('0xd')];this[_0x863d('0xe')]={};this[_0x863d('0xf')]=new EmailSmtp();}EmailChannel[_0x863d('0x10')][_0x863d('0x11')]=function(_0xbe585b){var _0x3611a7=this['mailAccounts'][_0xbe585b];var _0xb76bdf={'id':_0x3611a7['id'],'name':_0x3611a7[_0x863d('0x12')],'key':_0x3611a7[_0x863d('0x13')],'active':_0x3611a7[_0x863d('0x14')],'Imap':{'status':_0x3611a7[_0x863d('0x15')][_0x863d('0x16')],'messageStatus':_0x3611a7[_0x863d('0x15')][_0x863d('0x17')],'total':_0x3611a7[_0x863d('0x15')]['total']}};if(_[_0x863d('0x18')](md5Accounts[_0xbe585b])){md5Accounts[_0xbe585b]={};}var _0x28de3b=md5(JSON[_0x863d('0x19')](_0xb76bdf));if(md5Accounts[_0xbe585b][_0x863d('0x3')]!==_0x28de3b){md5Accounts[_0xbe585b]['md5']=_0x28de3b;io[_0x863d('0x11')]('mailAccount:update',_0xb76bdf);}};EmailChannel[_0x863d('0x10')][_0x863d('0x1a')]=function(_0x5536e4){for(var _0x525682 in _0x5536e4){if(_0x5536e4[_0x863d('0x1b')](_0x525682)){if(_0x5536e4[_0x525682]['Imap']&&_0x5536e4[_0x525682][_0x863d('0x14')]){var _0x571f74=_0x5536e4[_0x525682][_0x863d('0x15')];if(!_0x571f74[_0x863d('0x1c')]&&_0x5536e4[_0x525682][_0x863d('0x1d')]!==_0x863d('0x1e'))_0x571f74['service']=_0x5536e4[_0x525682][_0x863d('0x1d')];if(!this[_0x863d('0xe')][_0x863d('0x1b')](_0x571f74['id'])){this['imapAccounts'][_0x571f74['id']]=new EmailImap(_0x571f74,_0x5536e4[_0x525682][_0x863d('0x6')]);this['imapAccounts'][_0x571f74['id']]['on'](_0x863d('0x1f'),this[_0x863d('0x20')][_0x863d('0x21')](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on']('email',this[_0x863d('0x22')][_0x863d('0x21')](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on'](_0x863d('0x23'),this[_0x863d('0x24')]['bind'](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on']('error',this[_0x863d('0x25')][_0x863d('0x21')](this,_0x525682));}}else{if(_[_0x863d('0x18')](this[_0x863d('0xd')][_0x525682][_0x863d('0x15')])){this[_0x863d('0xd')][_0x525682][_0x863d('0x15')]={};}this[_0x863d('0xd')][_0x525682][_0x863d('0x15')][_0x863d('0x16')]='disabled';this[_0x863d('0xd')][_0x525682]['Imap'][_0x863d('0x17')]='';this[_0x863d('0x11')](_0x525682);}}}};EmailChannel['prototype'][_0x863d('0x20')]=function(_0x1bd0ee,_0x460792){if(this[_0x863d('0xd')][_0x1bd0ee]){this[_0x863d('0xd')][_0x1bd0ee]['Imap'][_0x863d('0x16')]=_0x863d('0x26');this[_0x863d('0xd')][_0x1bd0ee][_0x863d('0x15')]['messageStatus']=_0x460792['name'];if(_0x460792[_0x863d('0x27')]){this[_0x863d('0xd')][_0x1bd0ee][_0x863d('0x15')]['total']=_0x460792[_0x863d('0x27')][_0x863d('0x28')];}return this[_0x863d('0x11')](_0x1bd0ee);}};EmailChannel[_0x863d('0x10')]['handleImapEmail']=function(_0x4fb59f,_0x4219ae){logger[_0x863d('0xc')](_0x863d('0x29'),_0x4219ae[_0x863d('0x2a')],_0x4219ae[_0x863d('0x2b')],_0x4219ae[_0x863d('0x2c')],_0x4fb59f);if(this[_0x863d('0xd')][_0x4fb59f]){return mailAccount[_0x863d('0x2d')](_0x4fb59f,_0x4219ae)['then'](function(_0x2a53b3){if(_0x2a53b3){logger[_0x863d('0xc')](_0x863d('0x2e'));}})['catch'](function(_0x3ed975){logger[_0x863d('0x2f')](_0x863d('0x30'),JSON[_0x863d('0x19')](_0x3ed975));});}};EmailChannel[_0x863d('0x10')][_0x863d('0x24')]=function(_0x3a9f09){if(this[_0x863d('0xd')][_0x3a9f09]&&this[_0x863d('0xd')][_0x3a9f09]['Imap']){if(this['imapAccounts'][this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')]['id']]){delete this[_0x863d('0xe')][this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')]['id']];}this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')][_0x863d('0x31')]=moment();this['emit'](_0x3a9f09);}};EmailChannel[_0x863d('0x10')][_0x863d('0x25')]=function(_0x84daa2,_0x2d0624){if(this[_0x863d('0xd')][_0x84daa2]){this[_0x863d('0xd')][_0x84daa2][_0x863d('0x15')][_0x863d('0x16')]='error';this['mailAccounts'][_0x84daa2][_0x863d('0x15')][_0x863d('0x17')]=_0x2d0624;return this[_0x863d('0x11')](_0x84daa2);}};EmailChannel[_0x863d('0x10')][_0x863d('0x32')]=function(_0x1e4dd4,_0x1de8cb){return this['smtp'][_0x863d('0x33')](_0x1e4dd4,_0x1de8cb);};EmailChannel['prototype'][_0x863d('0x34')]=function(_0x2bc4ae){var _0x232352=this;if(this['mailAccounts'][_0x2bc4ae['id']]){if(_[_0x863d('0x18')](this[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')])){this[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')]={};}this['mailAccounts'][_0x2bc4ae['id']]['Smtp'][_0x863d('0x31')]=moment();return new BPromise(function(_0x45df0f,_0x3ecea5){return _0x232352[_0x863d('0xf')][_0x863d('0x36')](_0x2bc4ae)[_0x863d('0x37')](function(_0x43a9e5){_0x232352['mailAccounts'][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x16')]=_0x863d('0x38');_0x232352[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x17')]='';_0x232352[_0x863d('0x11')](_0x2bc4ae['id']);_0x45df0f(_0x43a9e5);})[_0x863d('0x39')](function(_0x3ebc94){_0x232352[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x16')]=_0x863d('0x2f');_0x232352[_0x863d('0xd')][_0x2bc4ae['id']]['Smtp'][_0x863d('0x17')]=_0x3ebc94;_0x232352['emit'](_0x2bc4ae['id']);_0x3ecea5(_0x3ebc94);});});}return this[_0x863d('0xf')][_0x863d('0x36')](_0x2bc4ae);};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 6916270..7586b72 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 _0xa114=['connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','end','handleSimpleParser','parser','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','emailMaxHtmlBytes','html','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','text','substring','stringify','textCode','hasOwnProperty','lodash','util','mailparser','simpleParser','iconv','EventEmitter','./utils','../../../config/logger','../../../config/environment','mailbox','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype'];(function(_0x11c8d6,_0x32bc04){var _0x9a0c0=function(_0x1ba492){while(--_0x1ba492){_0x11c8d6['push'](_0x11c8d6['shift']());}};_0x9a0c0(++_0x32bc04);}(_0xa114,0x105));var _0x4a11=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xa114[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x4a11('0x0'));var util=require(_0x4a11('0x1'));var Imap=require('imap');var simpleParser=require(_0x4a11('0x2'))[_0x4a11('0x3')];var Iconv=require(_0x4a11('0x4'))['Iconv'];var EventEmitter=require('events')[_0x4a11('0x5')];var utils=require(_0x4a11('0x6'));var logger=require(_0x4a11('0x7'))('email');var config=require(_0x4a11('0x8'));function EmailImap(_0x386acf,_0x53375b){this['mailbox']=_0x386acf[_0x4a11('0x9')];this[_0x4a11('0xa')]=this[_0x4a11('0xb')](_0x386acf,_0x53375b);this[_0x4a11('0xc')]=new Imap(this[_0x4a11('0xa')]);this[_0x4a11('0xc')][_0x4a11('0xd')](_0x4a11('0xe'),this[_0x4a11('0xf')][_0x4a11('0x10')](this));this[_0x4a11('0xc')]['once']('end',this[_0x4a11('0x11')][_0x4a11('0x10')](this));this['imap']['on'](_0x4a11('0x12'),this[_0x4a11('0x13')][_0x4a11('0x10')](this));this[_0x4a11('0xc')][_0x4a11('0x14')]();}util[_0x4a11('0x15')](EmailImap,EventEmitter);EmailImap[_0x4a11('0x16')][_0x4a11('0xb')]=function(_0x4b8f3a,_0x573fd2){var _0x39e0fe={'connTimeout':_0x4b8f3a[_0x4a11('0x17')]?_0x4b8f3a[_0x4a11('0x17')]*0x3e8:0x2710,'authTimeout':_0x4b8f3a[_0x4a11('0x18')]?_0x4b8f3a['authTimeout']*0x3e8:0x1388};if(_0x4b8f3a[_0x4a11('0x19')]){_0x39e0fe['user']=_0x4b8f3a[_0x4a11('0x1a')];if(_0x4b8f3a[_0x4a11('0x1b')]){_0x39e0fe[_0x4a11('0x1c')]=utils[_0x4a11('0x1d')](_0x4b8f3a[_0x4a11('0x1e')][_0x4a11('0x1f')],_0x4b8f3a[_0x4a11('0x1a')]);}else{_0x39e0fe['password']=_0x4b8f3a[_0x4a11('0x20')];}}else{if(_0x4b8f3a[_0x4a11('0x21')]){_0x39e0fe['user']=_0x4b8f3a['user'];_0x39e0fe[_0x4a11('0x20')]=_0x4b8f3a[_0x4a11('0x20')];}}_0x39e0fe[_0x4a11('0x22')]=_0x573fd2||_0x4b8f3a['user']||_0x4a11('0x23');_0x39e0fe['host']=_0x4b8f3a['host'];_0x39e0fe[_0x4a11('0x24')]=_0x4b8f3a['port']||0x3e1;if(_0x4b8f3a[_0x4a11('0x25')]){_0x39e0fe['tls']=!![];}else{_0x39e0fe['tls']=![];_0x39e0fe[_0x4a11('0x26')]=_0x4a11('0x27');}return _0x39e0fe;};EmailImap[_0x4a11('0x16')][_0x4a11('0xf')]=function(){this[_0x4a11('0xc')][_0x4a11('0x28')](this['mailbox'],![],this[_0x4a11('0x29')][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')][_0x4a11('0x29')]=function(_0x2535d1,_0x183cbd){if(_0x2535d1){this['handleError'](_0x2535d1,!![]);}else{this[_0x4a11('0x2a')](_0x4a11('0x2b'),_0x183cbd);this['readUnseen']();}};EmailImap[_0x4a11('0x16')]['handleCloseBox']=function(_0x34705c){if(_0x34705c){this[_0x4a11('0x13')](_0x34705c,!![]);}else{this[_0x4a11('0xc')]['end']();}};EmailImap[_0x4a11('0x16')][_0x4a11('0x2c')]=function(){this[_0x4a11('0xc')]['search']([_0x4a11('0x2d')],this[_0x4a11('0x2e')][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')]['handleReadUnseen']=function(_0x2eb139,_0x159b47){if(_0x2eb139){this[_0x4a11('0x13')](_0x2eb139,!![]);}else{if(_0x159b47[_0x4a11('0x2f')]){try{var _0x5ade27=this[_0x4a11('0xc')][_0x4a11('0x30')](_0x159b47['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x5ade27['on'](_0x4a11('0x31'),this[_0x4a11('0x32')][_0x4a11('0x10')](this));_0x5ade27['once']('error',this[_0x4a11('0x33')][_0x4a11('0x10')](this));_0x5ade27[_0x4a11('0xd')]('end',this[_0x4a11('0x34')][_0x4a11('0x10')](this));}catch(_0x201cd9){logger[_0x4a11('0x12')](_0x201cd9);}}else{this[_0x4a11('0xc')][_0x4a11('0x35')](!![],this[_0x4a11('0x36')][_0x4a11('0x10')](this));}}};EmailImap['prototype'][_0x4a11('0x32')]=function(_0x12a3b9){_0x12a3b9['on'](_0x4a11('0x37'),this[_0x4a11('0x38')][_0x4a11('0x10')](this));_0x12a3b9[_0x4a11('0xd')](_0x4a11('0x39'),this[_0x4a11('0x3a')][_0x4a11('0x10')](this));_0x12a3b9['once'](_0x4a11('0x3b'),this['handleMessageEnd'][_0x4a11('0x10')](this));};EmailImap['prototype'][_0x4a11('0x38')]=function(_0x510747){simpleParser(_0x510747,{'Iconv':Iconv},this['handleSimpleParser'][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x4a11('0x16')][_0x4a11('0x3c')]=function(_0x19921b,_0x1ff478){if(_0x19921b){logger[_0x4a11('0x12')](_0x19921b);}else{var _0x35edb5=this;const _0xa27430=_0x1ff478['html'][_0x4a11('0x2f')];if(_0xa27430\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','indexOf','split','slice','join','length','isEmpty','anonymous','html','replace'];(function(_0x3f8139,_0x4fee1f){var _0x59b49c=function(_0x1fa99b){while(--_0x1fa99b){_0x3f8139['push'](_0x3f8139['shift']());}};_0x59b49c(++_0x4fee1f);}(_0x9925,0xc3));var _0x5992=function(_0x5b4dac,_0x394fdd){_0x5b4dac=_0x5b4dac-0x0;var _0x35b20d=_0x9925[_0x5b4dac];return _0x35b20d;};'use strict';var _=require(_0x5992('0x0'));var moment=require(_0x5992('0x1'));var random=require(_0x5992('0x2'));var fs=require('fs');var path=require(_0x5992('0x3'));var util=require(_0x5992('0x4'));var tnef=require(_0x5992('0x5'));var logger=require(_0x5992('0x6'))(_0x5992('0x7'));var config=require(_0x5992('0x8'));function getAddress(_0x3158ca){var _0x354629=_[_0x5992('0x9')](_0x3158ca[_0x5992('0xa')]);return _0x354629&&_0x354629[_0x5992('0xb')]?_0x354629[_0x5992('0xb')]:'anonymous'+random[_0x5992('0xc')](0x6)+_0x5992('0xd');}function getFirstName(_0x3407ab){var _0x1d0e15=_[_0x5992('0x9')](_0x3407ab['value']);if(_0x1d0e15&&_0x1d0e15['name']){if(_0x1d0e15['name']==_0x1d0e15['address']){return _0x1d0e15[_0x5992('0xe')]['substring'](0x0,_0x1d0e15[_0x5992('0xe')][_0x5992('0xf')]('@'));}var _0xd138a8=_0x1d0e15[_0x5992('0xe')][_0x5992('0x10')](/\s+/);return _0xd138a8['length']>0x1?_0xd138a8[_0x5992('0x11')](0x0,-0x1)[_0x5992('0x12')]('\x20'):_0x1d0e15[_0x5992('0xe')];}return'Anonymous';}function getLastName(_0x4fe432){var _0x15df60=_[_0x5992('0x9')](_0x4fe432[_0x5992('0xa')]);if(_0x15df60&&_0x15df60[_0x5992('0xe')]){var _0x312927=_0x15df60[_0x5992('0xe')][_0x5992('0x10')](/\s+/);return _0x312927[_0x5992('0x13')]>0x1?_0x312927['pop']():'';}return'';}function getMails(_0x57cdae,_0x5cb248){var _0x2d5651='';for(var _0x3a4824=0x0;_0x3a4824<_0x5cb248[_0x5992('0xa')][_0x5992('0x13')];_0x3a4824+=0x1){if(_0x5cb248['value'][_0x3a4824]['address']!==_0x57cdae){if(!_[_0x5992('0x14')](_0x2d5651)){_0x2d5651+=',';}_0x2d5651+=_0x5cb248[_0x5992('0xa')][_0x3a4824]['name']||_0x5cb248[_0x5992('0xa')][_0x3a4824]['address']||'';_0x2d5651+='\x20<';_0x2d5651+=_0x5cb248[_0x5992('0xa')][_0x3a4824][_0x5992('0xb')]?_0x5cb248[_0x5992('0xa')][_0x3a4824]['address']:_0x5992('0x15')+random['generate'](0x6)+_0x5992('0xd');_0x2d5651+='>';}}return _0x2d5651;}function parseEmail(_0x342e02,_0x328cc7,_0x439b6c){if(_0x328cc7[_0x5992('0x16')]){var _0x36fd40=/)<[^<]*)*<\/script>/gi;while(_0x36fd40['test'](_0x328cc7[_0x5992('0x16')])){_0x328cc7[_0x5992('0x16')]=_0x328cc7[_0x5992('0x16')][_0x5992('0x17')](_0x36fd40,'');}if(_0x328cc7['html'][_0x5992('0x18')](_0x5992('0x19'))){var _0x386d0d=[];_0x328cc7[_0x5992('0x1a')][_0x5992('0x1b')](_0x6c430c=>{_0x386d0d[_0x5992('0x1c')](_0x6c430c[_0x5992('0x1d')]);});var _0x604a2d=/]+>/g;var _0x496ee3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xdb9cbd=_0x328cc7['html'][_0x5992('0x17')](_0x496ee3,_0x5992('0x1e'));var _0x131cec=_0xdb9cbd[_0x5992('0x17')](_0x604a2d,_0x5992('0x1f'));for(let _0x59526e=0x0;_0x59526e<_0x386d0d[_0x5992('0x13')];_0x59526e++){var _0x1d7c46=_0x131cec['replace'](_0x5992('0x1f'),_0x5992('0x20')+_0x386d0d[_0x59526e]+_0x5992('0x21'));_0x131cec=_0x1d7c46;}_0x328cc7['html']=_0x131cec;}_0x439b6c[_0x5992('0x22')]=_0x328cc7[_0x5992('0x16')];}else{_0x439b6c['body']=_0x328cc7[_0x5992('0x23')];}if(_0x439b6c[_0x5992('0x22')]){_0x439b6c[_0x5992('0x22')]=_0x439b6c[_0x5992('0x22')]['replace'](/0x0){var _0x2a65c9=[_0x5992('0x33'),_0x5992('0x34'),_0x5992('0x35')];for(var _0x239e60=0x0;_0x239e60<_0x328cc7['headerLines'][_0x5992('0x13')];_0x239e60++){var _0x44b647=_[_0x5992('0xf')](_0x2a65c9,_0x328cc7[_0x5992('0x32')][_0x239e60][_0x5992('0x36')]);if(_0x44b647>=0x0){_0x439b6c[_0x5992('0x37')]=!![];}}}return _0x439b6c;}exports[_0x5992('0x38')]=function(_0x1189c8,_0x183b92,_0x24a1cd){var _0x324672={'from':getAddress(_0x183b92[_0x5992('0x39')]),'firstName':getFirstName(_0x183b92['from']),'lastName':getLastName(_0x183b92[_0x5992('0x39')]),'mapKey':'email','message':{'from':getMails(_0x1189c8[_0x5992('0x7')],_0x183b92[_0x5992('0x39')]),'to':_0x1189c8[_0x5992('0x7')],'cc':'','subject':_0x183b92['subject']||'','messageId':_0x183b92[_0x5992('0x3a')],'inReplyTo':_0x183b92[_0x5992('0x3b')],'sentAt':moment(_0x183b92['date'])['format'](_0x5992('0x3c')),'attach':![],'attachments':[]}};if(!_0x183b92[_0x5992('0x16')]&&!_0x183b92[_0x5992('0x23')]){var _0x5a844a=_['filter'](_0x183b92[_0x5992('0x1a')],{'contentType':_0x5992('0x3d')});if(_0x5a844a['length']){logger['info'](util[_0x5992('0x2b')](_0x5992('0x3e'),_0x183b92[_0x5992('0x3a')]));tnef[_0x5992('0x3f')](_[_0x5992('0x40')](_0x5a844a)[_0x5992('0x30')],function(_0x1cf312,_0x567f7e){if(_0x567f7e){_0x183b92['html']=_0x567f7e[_0x5992('0x41')]||_0x5992('0x42');if(_0x567f7e[_0x5992('0x43')]){for(var _0x50f102=0x0;_0x50f102<_0x567f7e[_0x5992('0x43')][_0x5992('0x13')];_0x50f102++){var _0x7d6fe4=_0x567f7e[_0x5992('0x43')][_0x50f102];_0x324672[_0x5992('0x25')][_0x5992('0x1a')][_0x5992('0x1c')]({'filename':_0x7d6fe4[_0x5992('0x44')],'content':Buffer[_0x5992('0x39')](_0x7d6fe4['Data'])});}}}_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));});}else{_0x183b92[_0x5992('0x16')]=_0x5992('0x42');_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));}}else{_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));}};exports[_0x5992('0x45')]=function(_0x12fb28,_0x5e18cc){var _0x5628b7=['user='+(_0x5e18cc||''),_0x5992('0x46')+_0x12fb28,'',''];return Buffer[_0x5992('0x39')](_0x5628b7['join'](''),_0x5992('0x47'))['toString'](_0x5992('0x48'));}; \ No newline at end of file +var _0x1d11=['head','name','substring','length','slice','join','Anonymous','split','pop','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','originCc','bcc','attach','type','filename','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','messageId','inReplyTo','date','filter','application/ms-tnef','info','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','utf-8','toString','lodash','moment','path','util','node-tnef','../../../config/logger','value','address','anonymous','@xcally.com'];(function(_0x5551b0,_0x3eb7ba){var _0x2b3fb1=function(_0x1375a0){while(--_0x1375a0){_0x5551b0['push'](_0x5551b0['shift']());}};_0x2b3fb1(++_0x3eb7ba);}(_0x1d11,0x8a));var _0x11d1=function(_0x12ccae,_0xb5e7f4){_0x12ccae=_0x12ccae-0x0;var _0x3c505a=_0x1d11[_0x12ccae];return _0x3c505a;};'use strict';var _=require(_0x11d1('0x0'));var moment=require(_0x11d1('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x11d1('0x2'));var util=require(_0x11d1('0x3'));var tnef=require(_0x11d1('0x4'));var logger=require(_0x11d1('0x5'))('email');var config=require('../../../config/environment');function getAddress(_0x2ea7c1){var _0x3779e4=_['head'](_0x2ea7c1[_0x11d1('0x6')]);return _0x3779e4&&_0x3779e4[_0x11d1('0x7')]?_0x3779e4[_0x11d1('0x7')]:_0x11d1('0x8')+random['generate'](0x6)+_0x11d1('0x9');}function getFirstName(_0x2d617f){var _0x447650=_[_0x11d1('0xa')](_0x2d617f[_0x11d1('0x6')]);if(_0x447650&&_0x447650[_0x11d1('0xb')]){if(_0x447650[_0x11d1('0xb')]==_0x447650[_0x11d1('0x7')]){return _0x447650[_0x11d1('0xb')][_0x11d1('0xc')](0x0,_0x447650[_0x11d1('0xb')]['indexOf']('@'));}var _0x4d1b98=_0x447650[_0x11d1('0xb')]['split'](/\s+/);return _0x4d1b98[_0x11d1('0xd')]>0x1?_0x4d1b98[_0x11d1('0xe')](0x0,-0x1)[_0x11d1('0xf')]('\x20'):_0x447650['name'];}return _0x11d1('0x10');}function getLastName(_0x10a4b6){var _0x4a132=_[_0x11d1('0xa')](_0x10a4b6[_0x11d1('0x6')]);if(_0x4a132&&_0x4a132['name']){var _0x375502=_0x4a132[_0x11d1('0xb')][_0x11d1('0x11')](/\s+/);return _0x375502[_0x11d1('0xd')]>0x1?_0x375502[_0x11d1('0x12')]():'';}return'';}function getMails(_0x50366b,_0x2fd082){var _0x36f2bf='';for(var _0x4e189b=0x0;_0x4e189b<_0x2fd082[_0x11d1('0x6')]['length'];_0x4e189b+=0x1){if(_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0x7')]!==_0x50366b){if(!_[_0x11d1('0x13')](_0x36f2bf)){_0x36f2bf+=',';}_0x36f2bf+=_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0xb')]||_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0x7')]||'';_0x36f2bf+='\x20<';_0x36f2bf+=_0x2fd082['value'][_0x4e189b][_0x11d1('0x7')]?_0x2fd082['value'][_0x4e189b][_0x11d1('0x7')]:_0x11d1('0x8')+random[_0x11d1('0x14')](0x6)+'@xcally.com';_0x36f2bf+='>';}}return _0x36f2bf;}function parseEmail(_0x4ffd8b,_0x52a582,_0x9828a5){if(_0x52a582[_0x11d1('0x15')]){var _0x250e56=/)<[^<]*)*<\/script>/gi;while(_0x250e56[_0x11d1('0x16')](_0x52a582[_0x11d1('0x15')])){_0x52a582[_0x11d1('0x15')]=_0x52a582['html'][_0x11d1('0x17')](_0x250e56,'');}if(_0x52a582[_0x11d1('0x15')][_0x11d1('0x18')](_0x11d1('0x19'))){var _0x73c1f8=[];_0x52a582[_0x11d1('0x1a')]['forEach'](_0x26c2af=>{_0x73c1f8['push'](_0x26c2af['filename']);});var _0x550382=/]+>/g;var _0x54be3f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x31bbd6=_0x52a582[_0x11d1('0x15')]['replace'](_0x54be3f,_0x11d1('0x1b'));var _0x39c9fb=_0x31bbd6[_0x11d1('0x17')](_0x550382,_0x11d1('0x1c'));for(let _0x52311c=0x0;_0x52311c<_0x73c1f8[_0x11d1('0xd')];_0x52311c++){var _0x111b1a=_0x39c9fb[_0x11d1('0x17')](_0x11d1('0x1c'),_0x11d1('0x1d')+_0x73c1f8[_0x52311c]+_0x11d1('0x1e'));_0x39c9fb=_0x111b1a;}_0x52a582['html']=_0x39c9fb;}_0x9828a5[_0x11d1('0x1f')]=_0x52a582[_0x11d1('0x15')];}else{_0x9828a5[_0x11d1('0x1f')]=_0x52a582[_0x11d1('0x20')];}if(_0x9828a5[_0x11d1('0x1f')]){_0x9828a5['body']=_0x9828a5['body']['replace'](/0x0){var _0x1b3c56=[_0x11d1('0x33'),_0x11d1('0x34'),_0x11d1('0x35')];for(var _0x1ac697=0x0;_0x1ac697<_0x52a582[_0x11d1('0x32')]['length'];_0x1ac697++){var _0x1c4947=_[_0x11d1('0x36')](_0x1b3c56,_0x52a582['headerLines'][_0x1ac697][_0x11d1('0x37')]);if(_0x1c4947>=0x0){_0x9828a5[_0x11d1('0x38')]=!![];}}}return _0x9828a5;}exports[_0x11d1('0x39')]=function(_0x4c6324,_0x1d06ea,_0x199fb6){var _0x55dee0={'from':getAddress(_0x1d06ea[_0x11d1('0x3a')]),'firstName':getFirstName(_0x1d06ea[_0x11d1('0x3a')]),'lastName':getLastName(_0x1d06ea[_0x11d1('0x3a')]),'mapKey':_0x11d1('0x23'),'message':{'from':getMails(_0x4c6324[_0x11d1('0x23')],_0x1d06ea['from']),'to':_0x4c6324[_0x11d1('0x23')],'cc':'','subject':_0x1d06ea['subject']||'','messageId':_0x1d06ea[_0x11d1('0x3b')],'inReplyTo':_0x1d06ea[_0x11d1('0x3c')],'sentAt':moment(_0x1d06ea[_0x11d1('0x3d')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1d06ea[_0x11d1('0x15')]&&!_0x1d06ea[_0x11d1('0x20')]){var _0x22611a=_[_0x11d1('0x3e')](_0x1d06ea[_0x11d1('0x1a')],{'contentType':_0x11d1('0x3f')});if(_0x22611a[_0x11d1('0xd')]){logger[_0x11d1('0x40')](util[_0x11d1('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1d06ea[_0x11d1('0x3b')]));tnef['parseBuffer'](_[_0x11d1('0x41')](_0x22611a)[_0x11d1('0x2f')],function(_0x591df3,_0x2e2f7b){if(_0x2e2f7b){_0x1d06ea[_0x11d1('0x15')]=_0x2e2f7b[_0x11d1('0x42')]||_0x11d1('0x43');if(_0x2e2f7b[_0x11d1('0x44')]){for(var _0x334026=0x0;_0x334026<_0x2e2f7b[_0x11d1('0x44')][_0x11d1('0xd')];_0x334026++){var _0x42b2ec=_0x2e2f7b[_0x11d1('0x44')][_0x334026];_0x55dee0[_0x11d1('0x21')][_0x11d1('0x1a')]['push']({'filename':_0x42b2ec[_0x11d1('0x45')],'content':Buffer[_0x11d1('0x3a')](_0x42b2ec[_0x11d1('0x46')])});}}}_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));});}else{_0x1d06ea[_0x11d1('0x15')]=_0x11d1('0x43');_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));}}else{_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));}};exports['generateXOAuth2Token']=function(_0x2add84,_0x2b2700){var _0xcc8d21=[_0x11d1('0x47')+(_0x2b2700||''),'auth=Bearer\x20'+_0x2add84,'',''];return Buffer[_0x11d1('0x3a')](_0xcc8d21['join'](''),_0x11d1('0x48'))[_0x11d1('0x49')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ae86a71..6fc254d 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef95=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x4b632b,_0x45d71e){var _0x34872d=function(_0x4604cf){while(--_0x4604cf){_0x4b632b['push'](_0x4b632b['shift']());}};_0x34872d(++_0x45d71e);}(_0xef95,0xdd));var _0x5ef9=function(_0x17e717,_0x18fcbe){_0x17e717=_0x17e717-0x0;var _0x229b56=_0xef95[_0x17e717];return _0x229b56;};'use strict';var _=require(_0x5ef9('0x0'));function MailAccount(_0x32a11e){this['id']=_0x32a11e['id']||0x0;this[_0x5ef9('0x1')]=_0x32a11e[_0x5ef9('0x1')]||_0x5ef9('0x2');this[_0x5ef9('0x3')]=_0x32a11e[_0x5ef9('0x3')]||_0x5ef9('0x4');this[_0x5ef9('0x5')]=_0x32a11e[_0x5ef9('0x5')]||![];this[_0x5ef9('0x6')]=_0x32a11e['Imap']||[];this[_0x5ef9('0x7')]=_0x32a11e[_0x5ef9('0x7')]||[];}module[_0x5ef9('0x8')]=MailAccount; \ No newline at end of file +var _0x9e3e=['key','SERV','active','Imap','Smtp','exports','lodash','Service'];(function(_0x4b14b6,_0x195b60){var _0x136472=function(_0x26418e){while(--_0x26418e){_0x4b14b6['push'](_0x4b14b6['shift']());}};_0x136472(++_0x195b60);}(_0x9e3e,0x166));var _0xe9e3=function(_0x1ae417,_0x1b11dc){_0x1ae417=_0x1ae417-0x0;var _0x5ae66c=_0x9e3e[_0x1ae417];return _0x5ae66c;};'use strict';var _=require(_0xe9e3('0x0'));function MailAccount(_0x53bf7f){this['id']=_0x53bf7f['id']||0x0;this['name']=_0x53bf7f['name']||_0xe9e3('0x1');this[_0xe9e3('0x2')]=_0x53bf7f[_0xe9e3('0x2')]||_0xe9e3('0x3');this[_0xe9e3('0x4')]=_0x53bf7f['active']||![];this[_0xe9e3('0x5')]=_0x53bf7f['Imap']||[];this[_0xe9e3('0x6')]=_0x53bf7f[_0xe9e3('0x6')]||[];}module[_0xe9e3('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 1f39823..bb51d7a 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8009=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','exports'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x8009,0x110));var _0x9800=function(_0x1ed708,_0xc5a01f){_0x1ed708=_0x1ed708-0x0;var _0x3a4374=_0x8009[_0x1ed708];return _0x3a4374;};'use strict';var _=require('lodash');var MailAccount=require(_0x9800('0x0'));var Realtime=function(){this[_0x9800('0x1')]={};};function freeIsNotKey(_0x9091a3,_0xc1515a,_0x5bce4d){var _0xe1cdef=_[_0x9800('0x2')](_0x9091a3,function(_0x43978a,_0x4cc146){return _0x43978a[_0x5bce4d];});for(var _0x11ea4b in _0xc1515a){if(_0xc1515a[_0x9800('0x3')](_0x11ea4b)){if(!_0xe1cdef[_0x11ea4b]){delete _0xc1515a[_0x11ea4b];}}}}Realtime[_0x9800('0x4')][_0x9800('0x5')]=function(_0x43bb21,_0x2d411a){for(var _0x4d4981 in _0x2d411a){if(_0x43bb21['hasOwnProperty'](_0x4d4981)){_0x43bb21[_0x4d4981]=_0x2d411a[_0x4d4981];}}};Realtime[_0x9800('0x4')][_0x9800('0x6')]=function(){var _0x65b8df=this;return function(_0x52aa5f){if(_0x52aa5f){freeIsNotKey(_0x52aa5f,_0x65b8df['mailAccounts'],'id');for(var _0x2e4d5d=0x0,_0x476d0b={},_0x5990af={};_0x2e4d5d<_0x52aa5f['length'];_0x2e4d5d+=0x1){_0x476d0b=_0x52aa5f[_0x2e4d5d];if(_['isUndefined'](_0x65b8df[_0x9800('0x1')][_0x476d0b['id']])){_0x65b8df[_0x9800('0x1')][_0x476d0b['id']]=new MailAccount(_0x476d0b);}else{_['merge'](_0x65b8df[_0x9800('0x1')][_0x476d0b['id']],_0x476d0b);}}}return _0x65b8df['mailAccounts'];};};module[_0x9800('0x7')]=Realtime; \ No newline at end of file +var _0xe581=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xe581,0xc0));var _0x1e58=function(_0x19f166,_0x21fce1){_0x19f166=_0x19f166-0x0;var _0x376cad=_0xe581[_0x19f166];return _0x376cad;};'use strict';var _=require(_0x1e58('0x0'));var MailAccount=require(_0x1e58('0x1'));var Realtime=function(){this[_0x1e58('0x2')]={};};function freeIsNotKey(_0x59e8fb,_0x2c2cdd,_0x176c7d){var _0x2dfcf4=_['mapKeys'](_0x59e8fb,function(_0x41b2fe,_0x81aa57){return _0x41b2fe[_0x176c7d];});for(var _0x20bf67 in _0x2c2cdd){if(_0x2c2cdd[_0x1e58('0x3')](_0x20bf67)){if(!_0x2dfcf4[_0x20bf67]){delete _0x2c2cdd[_0x20bf67];}}}}Realtime[_0x1e58('0x4')][_0x1e58('0x5')]=function(_0x47168f,_0x1ceabb){for(var _0x450bb8 in _0x1ceabb){if(_0x47168f[_0x1e58('0x3')](_0x450bb8)){_0x47168f[_0x450bb8]=_0x1ceabb[_0x450bb8];}}};Realtime[_0x1e58('0x4')][_0x1e58('0x6')]=function(){var _0x4e1349=this;return function(_0x131e64){if(_0x131e64){freeIsNotKey(_0x131e64,_0x4e1349[_0x1e58('0x2')],'id');for(var _0x3dab2d=0x0,_0x5759cf={},_0x55dc58={};_0x3dab2d<_0x131e64[_0x1e58('0x7')];_0x3dab2d+=0x1){_0x5759cf=_0x131e64[_0x3dab2d];if(_[_0x1e58('0x8')](_0x4e1349[_0x1e58('0x2')][_0x5759cf['id']])){_0x4e1349['mailAccounts'][_0x5759cf['id']]=new MailAccount(_0x5759cf);}else{_[_0x1e58('0x9')](_0x4e1349[_0x1e58('0x2')][_0x5759cf['id']],_0x5759cf);}}}return _0x4e1349['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ef916a7..8798230 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf130=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','key','ListId','TemplateId','MailServerIn','CloudProvider'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xf130,0x149));var _0x0f13=function(_0x443375,_0x209d3b){_0x443375=_0x443375-0x0;var _0x2fafbe=_0xf130[_0x443375];return _0x2fafbe;};'use strict';var client=require(_0x0f13('0x0'));exports[_0x0f13('0x1')]=function(){return function(){return client[_0x0f13('0x2')](_0x0f13('0x3'),{'options':{'attributes':['id',_0x0f13('0x4'),_0x0f13('0x5'),_0x0f13('0x6'),_0x0f13('0x7'),'active',_0x0f13('0x8'),_0x0f13('0x9'),_0x0f13('0xa')],'raw':![],'include':[{'model':_0x0f13('0xb'),'as':'Imap','include':[{'model':_0x0f13('0xc'),'attributes':['id',_0x0f13('0x4'),_0x0f13('0x6'),'type',_0x0f13('0xd')],'as':_0x0f13('0xc')}]},{'model':_0x0f13('0xe'),'as':_0x0f13('0xf'),'include':[{'model':_0x0f13('0xc'),'attributes':['id',_0x0f13('0x4'),'service','type',_0x0f13('0xd')],'as':'CloudProvider'}]}]},'log':_0x0f13('0x10')});};};exports[_0x0f13('0x11')]=function(_0x474cde,_0x5dece6){return client[_0x0f13('0x2')](_0x0f13('0x12'),{'account':{'id':_0x474cde},'body':_0x5dece6,'log':_0x0f13('0x12')});}; \ No newline at end of file +var _0xed52=['provider','service','email','active','key','ListId','MailServerIn','CloudProvider','data5','MailServerOut','Smtp','type','Request','NotifyMailAccount','getMailAccounts','name'];(function(_0x36e69a,_0x51e852){var _0x44224a=function(_0x496be2){while(--_0x496be2){_0x36e69a['push'](_0x36e69a['shift']());}};_0x44224a(++_0x51e852);}(_0xed52,0x16e));var _0x2ed5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xed52[_0x47a7d0];return _0xb9bd08;};'use strict';var client=require('../client');exports[_0x2ed5('0x0')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x2ed5('0x1'),_0x2ed5('0x2'),_0x2ed5('0x3'),_0x2ed5('0x4'),_0x2ed5('0x5'),_0x2ed5('0x6'),_0x2ed5('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x2ed5('0x8'),'as':'Imap','include':[{'model':_0x2ed5('0x9'),'attributes':['id','name',_0x2ed5('0x3'),'type',_0x2ed5('0xa')],'as':_0x2ed5('0x9')}]},{'model':_0x2ed5('0xb'),'as':_0x2ed5('0xc'),'include':[{'model':_0x2ed5('0x9'),'attributes':['id',_0x2ed5('0x1'),'service',_0x2ed5('0xd'),_0x2ed5('0xa')],'as':_0x2ed5('0x9')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x4dc83c,_0x55c614){return client[_0x2ed5('0xe')](_0x2ed5('0xf'),{'account':{'id':_0x4dc83c},'body':_0x55c614,'log':_0x2ed5('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ff5597a..e89ce1b 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b5c=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x291772,_0x11fb41){var _0x3b148e=function(_0x58b1c5){while(--_0x58b1c5){_0x291772['push'](_0x291772['shift']());}};_0x3b148e(++_0x11fb41);}(_0x7b5c,0x148));var _0xc7b5=function(_0x409f75,_0x5bfa17){_0x409f75=_0x409f75-0x0;var _0x53b645=_0x7b5c[_0x409f75];return _0x53b645;};'use strict';var client=require(_0xc7b5('0x0'));exports[_0xc7b5('0x1')]=function(){return client[_0xc7b5('0x2')](_0xc7b5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc7b5('0x4')]},'log':_0xc7b5('0x5')});}; \ No newline at end of file +var _0x1dfe=['GetSettings','../client','getSettings'];(function(_0x3d7364,_0x12cb1c){var _0x24361e=function(_0x471992){while(--_0x471992){_0x3d7364['push'](_0x3d7364['shift']());}};_0x24361e(++_0x12cb1c);}(_0x1dfe,0xeb));var _0xe1df=function(_0x309171,_0x287e97){_0x309171=_0x309171-0x0;var _0x80627b=_0x1dfe[_0x309171];return _0x80627b;};'use strict';var client=require(_0xe1df('0x0'));exports[_0xe1df('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe1df('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index defe71c..323a986 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 38f1cbf..7b841ae 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf4b=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','localhost','socket.io-redis','default','../../config/express','../../routes'];(function(_0x21d0f7,_0x5cb6f4){var _0x55c681=function(_0x3cd67f){while(--_0x3cd67f){_0x21d0f7['push'](_0x21d0f7['shift']());}};_0x55c681(++_0x5cb6f4);}(_0xbf4b,0x8f));var _0xbbf4=function(_0x2650de,_0x12c23e){_0x2650de=_0x2650de-0x0;var _0x2db8c0=_0xbf4b[_0x2650de];return _0x2db8c0;};'use strict';var _=require(_0xbbf4('0x0'));var http=require(_0xbbf4('0x1'));var express=require(_0xbbf4('0x2'));var sticky=require(_0xbbf4('0x3'));var Redis=require(_0xbbf4('0x4'));var config=require(_0xbbf4('0x5'));var app=express();var server=http[_0xbbf4('0x6')](app);server[_0xbbf4('0x7')]=0xdbba0;if(sticky[_0xbbf4('0x8')](server,config[_0xbbf4('0x9')])){var socketio=require('socket.io')(server,{'transports':[_0xbbf4('0xa'),_0xbbf4('0xb')]});config[_0xbbf4('0xc')]=_['defaults'](config['redis'],{'host':_0xbbf4('0xd'),'port':0x18eb});socketio['adapter'](require(_0xbbf4('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xbbf4('0xc')])}));require('../../config/triggers')['default']();require('../../config/socketio')[_0xbbf4('0xf')](socketio);require(_0xbbf4('0x10'))['default'](app);require(_0xbbf4('0x11'))[_0xbbf4('0xf')](app);}else{server[_0xbbf4('0x12')](_0xbbf4('0x13'),function(){console[_0xbbf4('0x14')](_0xbbf4('0x15'),config[_0xbbf4('0x9')]);});}exports=module[_0xbbf4('0x16')]=app; \ No newline at end of file +var _0x0fe8=['websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io'];(function(_0xe0f2b7,_0x2bad91){var _0x19f339=function(_0x3dbf64){while(--_0x3dbf64){_0xe0f2b7['push'](_0xe0f2b7['shift']());}};_0x19f339(++_0x2bad91);}(_0x0fe8,0xff));var _0x80fe=function(_0x48c960,_0x485947){_0x48c960=_0x48c960-0x0;var _0x32e3f5=_0x0fe8[_0x48c960];return _0x32e3f5;};'use strict';var _=require(_0x80fe('0x0'));var http=require(_0x80fe('0x1'));var express=require('express');var sticky=require(_0x80fe('0x2'));var Redis=require('ioredis');var config=require(_0x80fe('0x3'));var app=express();var server=http[_0x80fe('0x4')](app);server[_0x80fe('0x5')]=0xdbba0;if(sticky[_0x80fe('0x6')](server,config[_0x80fe('0x7')])){var socketio=require(_0x80fe('0x8'))(server,{'transports':[_0x80fe('0x9'),_0x80fe('0xa')]});config[_0x80fe('0xb')]=_[_0x80fe('0xc')](config[_0x80fe('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x80fe('0xd')](require(_0x80fe('0xe'))({'pubClient':new Redis(config[_0x80fe('0xb')]),'subClient':new Redis(config[_0x80fe('0xb')])}));require(_0x80fe('0xf'))[_0x80fe('0x10')]();require(_0x80fe('0x11'))[_0x80fe('0x10')](socketio);require('../../config/express')['default'](app);require(_0x80fe('0x12'))[_0x80fe('0x10')](app);}else{server[_0x80fe('0x13')](_0x80fe('0x14'),function(){console[_0x80fe('0x15')](_0x80fe('0x16'),config[_0x80fe('0x7')]);});}exports=module[_0x80fe('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d4514df..dc41a30 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b98=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0xa95e6a,_0x3a26d0){var _0x3a0624=function(_0x99a1c8){while(--_0x99a1c8){_0xa95e6a['push'](_0xa95e6a['shift']());}};_0x3a0624(++_0x3a26d0);}(_0x1b98,0x176));var _0x81b9=function(_0x4245ad,_0x4c472e){_0x4245ad=_0x4245ad-0x0;var _0x3f487a=_0x1b98[_0x4245ad];return _0x3f487a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x81b9('0x0'));var logger=require(_0x81b9('0x1'))(_0x81b9('0x2'));var client=jayson[_0x81b9('0x3')][_0x81b9('0x4')]({'port':0x2329});client[_0x81b9('0x5')]=function(_0x3705f4,_0x46d005){return new BPromise(function(_0x128a81,_0x424be5){return client[_0x81b9('0x6')](_0x3705f4,_0x46d005)[_0x81b9('0x7')](function(_0x293b20){logger[_0x81b9('0x8')](_0x81b9('0x9'),_0x81b9('0x2'),_0x3705f4,_0x46d005,_0x293b20);if(_0x293b20[_0x81b9('0xa')]){logger['error'](_0x81b9('0x9'),'routing',_0x3705f4,_0x293b20[_0x81b9('0xa')][_0x81b9('0xb')],_0x46d005);return _0x424be5(_0x293b20['error'][_0x81b9('0xb')]);}else{return _0x128a81(_0x293b20[_0x81b9('0xc')]);}})[_0x81b9('0xd')](function(_0x5dc13f){logger['error'](_0x81b9('0x9'),'routing',_0x3705f4,_0x5dc13f,_0x46d005);return _0x424be5(_0x5dc13f);});});};module[_0x81b9('0xe')]=client; \ No newline at end of file +var _0x34ba=['debug','rpc','error','message','result','catch','exports','bluebird','routing','client','http','Request','request','then'];(function(_0x16c23d,_0x568ecc){var _0x4d0257=function(_0x35f237){while(--_0x35f237){_0x16c23d['push'](_0x16c23d['shift']());}};_0x4d0257(++_0x568ecc);}(_0x34ba,0x1ab));var _0xa34b=function(_0xadd6ee,_0x1382bb){_0xadd6ee=_0xadd6ee-0x0;var _0xb8ef6b=_0x34ba[_0xadd6ee];return _0xb8ef6b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa34b('0x0'));var logger=require('../../config/logger')(_0xa34b('0x1'));var client=jayson[_0xa34b('0x2')][_0xa34b('0x3')]({'port':0x2329});client[_0xa34b('0x4')]=function(_0x2302da,_0x509703){return new BPromise(function(_0x4816f8,_0x5beb0e){return client[_0xa34b('0x5')](_0x2302da,_0x509703)[_0xa34b('0x6')](function(_0x3c48c2){logger[_0xa34b('0x7')](_0xa34b('0x8'),_0xa34b('0x1'),_0x2302da,_0x509703,_0x3c48c2);if(_0x3c48c2[_0xa34b('0x9')]){logger[_0xa34b('0x9')]('rpc',_0xa34b('0x1'),_0x2302da,_0x3c48c2[_0xa34b('0x9')]['message'],_0x509703);return _0x5beb0e(_0x3c48c2['error'][_0xa34b('0xa')]);}else{return _0x4816f8(_0x3c48c2[_0xa34b('0xb')]);}})[_0xa34b('0xc')](function(_0x19d33a){logger[_0xa34b('0x9')]('rpc','routing',_0x2302da,_0x19d33a,_0x509703);return _0x5beb0e(_0x19d33a);});});};module[_0xa34b('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0e63a9e..0a58027 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x702d=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','catch','log','bluebird','./server','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x702d,0x1b3));var _0xd702=function(_0x126caa,_0x1b68d6){_0x126caa=_0x126caa-0x0;var _0x349211=_0x702d[_0x126caa];return _0x349211;};'use strict';var BPromise=require(_0xd702('0x0'));var server=require(_0xd702('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xd702('0x2'));var chatQueue=require(_0xd702('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xd702('0x4'));var faxQueue=require(_0xd702('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xd702('0x6')](user['getAgents']())[_0xd702('0x6')](realtime[_0xd702('0x7')]())[_0xd702('0x6')](interval[_0xd702('0x8')]())['then'](realtime[_0xd702('0x9')]())[_0xd702('0x6')](openchannelQueue[_0xd702('0xa')]())[_0xd702('0x6')](realtime[_0xd702('0xb')]())[_0xd702('0x6')](chatQueue[_0xd702('0xc')]())['then'](realtime[_0xd702('0xd')]())[_0xd702('0x6')](smsQueue['getSmsQueues']())[_0xd702('0x6')](realtime[_0xd702('0xe')]())[_0xd702('0x6')](mailQueue[_0xd702('0xf')]())['then'](realtime[_0xd702('0x10')]())[_0xd702('0x6')](faxQueue[_0xd702('0x11')]())[_0xd702('0x6')](realtime[_0xd702('0x12')]())[_0xd702('0x6')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0xd702('0x6')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd702('0x6')](function(_0x1ce830){return initRealtime();})['then'](function(_0x4be84a){return setInterval(initRealtime,0x1388);})[_0xd702('0x13')](function(_0x9adbd5){console[_0xd702('0x14')](_0x9adbd5);});}main(); \ No newline at end of file +var _0x823b=['./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x7d210e,_0x37f970){var _0x1da9f3=function(_0x48993c){while(--_0x48993c){_0x7d210e['push'](_0x7d210e['shift']());}};_0x1da9f3(++_0x37f970);}(_0x823b,0x1dd));var _0xb823=function(_0x4e4485,_0xfa0fb5){_0x4e4485=_0x4e4485-0x0;var _0x49fd4=_0x823b[_0x4e4485];return _0x49fd4;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0xb823('0x0'));var interval=require(_0xb823('0x1'));var openchannelQueue=require(_0xb823('0x2'));var chatQueue=require(_0xb823('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb823('0x4'));var whatsappQueue=require(_0xb823('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb823('0x6')]()[_0xb823('0x7')](user[_0xb823('0x8')]())['then'](realtime[_0xb823('0x9')]())['then'](interval[_0xb823('0xa')]())[_0xb823('0x7')](realtime[_0xb823('0xb')]())['then'](openchannelQueue[_0xb823('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0xb823('0x7')](chatQueue[_0xb823('0xd')]())[_0xb823('0x7')](realtime[_0xb823('0xe')]())['then'](smsQueue[_0xb823('0xf')]())[_0xb823('0x7')](realtime[_0xb823('0x10')]())[_0xb823('0x7')](mailQueue[_0xb823('0x11')]())[_0xb823('0x7')](realtime[_0xb823('0x12')]())['then'](faxQueue[_0xb823('0x13')]())['then'](realtime[_0xb823('0x14')]())[_0xb823('0x7')](whatsappQueue[_0xb823('0x15')]())['then'](realtime['initWhatsappQueues']())[_0xb823('0x7')](function(){return realtime;});}function main(){return server[_0xb823('0x16')](realtime)['then'](function(_0x426572){return initRealtime();})['then'](function(_0x4d2630){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3280c8){console[_0xb823('0x17')](_0x3280c8);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 6abd9b0..78d0757 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x5fc3[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x42eabb,_0x1c8ecb){var _0x2d4655=function(_0x4e6550){while(--_0x4e6550){_0x42eabb['push'](_0x42eabb['shift']());}};_0x2d4655(++_0x1c8ecb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x5fc3[_0x5280f4];return _0xba93e7;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 21efe40..a050d9b 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd23e=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x145026,_0x180f84){var _0x4f93f8=function(_0x49f4f8){while(--_0x49f4f8){_0x145026['push'](_0x145026['shift']());}};_0x4f93f8(++_0x180f84);}(_0xd23e,0x141));var _0xed23=function(_0x16e569,_0x33f836){_0x16e569=_0x16e569-0x0;var _0x22470a=_0xd23e[_0x16e569];return _0x22470a;};'use strict';var BPromise=require(_0xed23('0x0'));var jayson=require(_0xed23('0x1'));var client=jayson[_0xed23('0x2')][_0xed23('0x3')]({'port':0x232b});function request(_0x1a202d,_0x44a79a){return new BPromise(function(_0x8a20f1,_0x5dca41){return client[_0xed23('0x4')](_0x1a202d,_0x44a79a)[_0xed23('0x5')](function(_0x17744b){if(_0x17744b[_0xed23('0x6')]){return _0x5dca41(_0x17744b[_0xed23('0x6')][_0xed23('0x7')]);}else{return _0x8a20f1(_0x17744b[_0xed23('0x8')]);}})['catch'](function(_0x3c36f5){return _0x5dca41(_0x3c36f5);});});}exports[_0xed23('0x9')]=function(_0x34df78,_0x446506){return request(_0xed23('0xa'),{'account':_0x34df78,'message':_0x446506});}; \ No newline at end of file +var _0xfbd6=['client','request','then','error','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xfbd6,0x10c));var _0x6fbd=function(_0x41acd5,_0x749c8e){_0x41acd5=_0x41acd5-0x0;var _0x3df541=_0xfbd6[_0x41acd5];return _0x3df541;};'use strict';var BPromise=require(_0x6fbd('0x0'));var jayson=require(_0x6fbd('0x1'));var client=jayson[_0x6fbd('0x2')]['http']({'port':0x232b});function request(_0x260f63,_0x515f09){return new BPromise(function(_0x1d4c6a,_0x47d50b){return client[_0x6fbd('0x3')](_0x260f63,_0x515f09)[_0x6fbd('0x4')](function(_0x536ea6){if(_0x536ea6[_0x6fbd('0x5')]){return _0x47d50b(_0x536ea6[_0x6fbd('0x5')]['message']);}else{return _0x1d4c6a(_0x536ea6['result']);}})[_0x6fbd('0x6')](function(_0x864906){return _0x47d50b(_0x864906);});});}exports[_0x6fbd('0x7')]=function(_0x2d7225,_0x2df215){return request(_0x6fbd('0x8'),{'account':_0x2d7225,'message':_0x2df215});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index eeee68d..93669f9 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c3c=['openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','online','mailStatusTime','faxStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','faxWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5c3c,0x132));var _0xc5c3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5c3c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc5c3('0x0'));var md5=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var Redis=require(_0xc5c3('0x3'));var config=require('../../../config/environment');config[_0xc5c3('0x4')]=_[_0xc5c3('0x5')](config[_0xc5c3('0x4')],{'host':_0xc5c3('0x6'),'port':0x18eb});var io=require(_0xc5c3('0x7'))(new Redis(config[_0xc5c3('0x4')]));function Agent(_0xe85098){this['id']=_0xe85098['id']||0x0;this[_0xc5c3('0x8')]=_0xe85098[_0xc5c3('0x8')]||'';this['online']=_0xe85098['online']||!![];this['voicePause']=_0xe85098[_0xc5c3('0x9')]||![];this[_0xc5c3('0xa')]=_0xe85098['chatPause']||![];this[_0xc5c3('0xb')]=_0xe85098[_0xc5c3('0xb')]||![];this['faxPause']=_0xe85098[_0xc5c3('0xc')]||![];this[_0xc5c3('0xd')]=_0xe85098['smsPause']||![];this[_0xc5c3('0xe')]=_0xe85098[_0xc5c3('0xe')]||![];this[_0xc5c3('0xf')]='unknown';this[_0xc5c3('0x10')]=0x0;this[_0xc5c3('0x11')]=_0xe85098['chatCapacity']||0x0;this[_0xc5c3('0x12')]=0x0;this[_0xc5c3('0x13')]=_0xc5c3('0x14');this['mailStatusTime']=0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=0x0;this[_0xc5c3('0x17')]=_0xc5c3('0x14');this['faxStatusTime']=0x0;this['faxCapacity']=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=0x0;this[_0xc5c3('0x1a')]=_0xc5c3('0x14');this['smsStatusTime']=0x0;this['smsCapacity']=_0xe85098[_0xc5c3('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xc5c3('0x1c')]=_0xc5c3('0x14');this[_0xc5c3('0x1d')]=0x0;this[_0xc5c3('0x1e')]=_0xe85098[_0xc5c3('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xc5c3('0x1f')]=_0xc5c3('0x14');this[_0xc5c3('0x20')]=0x0;this[_0xc5c3('0x21')]=_0xe85098['openchannelCapacity']||0x0;this[_0xc5c3('0x22')]=0x0;this[_0xc5c3('0x23')]=![];this[_0xc5c3('0x24')]=undefined;this[_0xc5c3('0x1')]='';this[_0xc5c3('0x25')]={};this['faxWaitingInteractions']={};this[_0xc5c3('0x26')]={};this[_0xc5c3('0x27')]={};this[_0xc5c3('0x28')]={};this[_0xc5c3('0x29')]={};this[_0xc5c3('0x2a')]();}Agent[_0xc5c3('0x2b')][_0xc5c3('0x2c')]=function(_0x5996a0){if(this[_0x5996a0+'CurrentCapacity']>0x0){if(this[_0x5996a0+_0xc5c3('0x2d')]>0x0&&this[_0x5996a0+_0xc5c3('0x2e')]>=this[_0x5996a0+'Capacity']){return'maxcapacity';}else{return _0xc5c3('0x2f');}}else{return _0xc5c3('0x30');}};Agent[_0xc5c3('0x2b')]['updateRealtime']=function(){var _0x4af067=[_0xc5c3('0x31'),_0xc5c3('0x32'),_0xc5c3('0x33'),_0xc5c3('0x34'),'sms',_0xc5c3('0x35')];for(var _0x5176c4=0x0;_0x5176c4<_0x4af067[_0xc5c3('0x36')];_0x5176c4+=0x1){var _0x4e6e6f=this[_0xc5c3('0x2c')](_0x4af067[_0x5176c4]);if(this[_0x4af067[_0x5176c4]+_0xc5c3('0x37')]!==_0x4e6e6f){this[_0x4af067[_0x5176c4]+_0xc5c3('0x38')]=_[_0xc5c3('0x39')](moment()[_0xc5c3('0x3a')]('x'));}this[_0x4af067[_0x5176c4]+_0xc5c3('0x37')]=_0x4e6e6f;}var _0x35a397={'id':this['id'],'name':this['name'],'online':this[_0xc5c3('0x3b')],'voicePause':this['voicePause'],'chatPause':this[_0xc5c3('0xa')],'mailPause':this[_0xc5c3('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xc5c3('0xe')],'chatStatus':this[_0xc5c3('0xf')],'chatStatusTime':this[_0xc5c3('0x10')],'chatCapacity':this[_0xc5c3('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc5c3('0x13')],'mailStatusTime':this[_0xc5c3('0x3c')],'mailCapacity':this[_0xc5c3('0x15')],'mailCurrentCapacity':this[_0xc5c3('0x16')],'faxStatus':this[_0xc5c3('0x17')],'faxStatusTime':this[_0xc5c3('0x3d')],'faxCapacity':this[_0xc5c3('0x18')],'faxCurrentCapacity':this[_0xc5c3('0x19')],'smsStatus':this[_0xc5c3('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc5c3('0x1b')],'smsCurrentCapacity':this[_0xc5c3('0x3e')],'whatsappStatus':this[_0xc5c3('0x1c')],'whatsappStatusTime':this[_0xc5c3('0x1d')],'whatsappCapacity':this[_0xc5c3('0x1e')],'whatsappCurrentCapacity':this[_0xc5c3('0x3f')],'openchannelStatus':this[_0xc5c3('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc5c3('0x22')],'busy':this['busy'],'busyQueue':this[_0xc5c3('0x24')],'chatWaitingInteractions':this[_0xc5c3('0x25')],'faxWaitingInteractions':this[_0xc5c3('0x40')],'mailWaitingInteractions':this[_0xc5c3('0x26')],'openchannelWaitingInteractions':this[_0xc5c3('0x27')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xc5c3('0x29')]};var _0xdaecce=md5(JSON['stringify'](_0x35a397));if(this[_0xc5c3('0x1')]!==_0xdaecce){this[_0xc5c3('0x1')]=_0xdaecce;io[_0xc5c3('0x41')](_0xc5c3('0x42'),_[_0xc5c3('0x43')](_0x35a397,[_0xc5c3('0x3b')]));}};module[_0xc5c3('0x44')]=Agent; \ No newline at end of file +var _0xa30a=['sms','length','getChannelStatus','Status','StatusTime','toNumber','format','smsPause','mailStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','mailWaitingInteractions','user:routing:update','omit','lodash','md5','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel'];(function(_0x196809,_0x3a873e){var _0x120b67=function(_0xec1e42){while(--_0xec1e42){_0x196809['push'](_0x196809['shift']());}};_0x120b67(++_0x3a873e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var md5=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var Redis=require('ioredis');var config=require(_0xaa30('0x3'));config[_0xaa30('0x4')]=_[_0xaa30('0x5')](config[_0xaa30('0x4')],{'host':_0xaa30('0x6'),'port':0x18eb});var io=require(_0xaa30('0x7'))(new Redis(config[_0xaa30('0x4')]));function Agent(_0x555947){this['id']=_0x555947['id']||0x0;this[_0xaa30('0x8')]=_0x555947['name']||'';this[_0xaa30('0x9')]=_0x555947[_0xaa30('0x9')]||!![];this[_0xaa30('0xa')]=_0x555947['voicePause']||![];this[_0xaa30('0xb')]=_0x555947[_0xaa30('0xb')]||![];this[_0xaa30('0xc')]=_0x555947[_0xaa30('0xc')]||![];this[_0xaa30('0xd')]=_0x555947[_0xaa30('0xd')]||![];this['smsPause']=_0x555947['smsPause']||![];this[_0xaa30('0xe')]=_0x555947['openchannelPause']||![];this[_0xaa30('0xf')]=_0xaa30('0x10');this[_0xaa30('0x11')]=0x0;this[_0xaa30('0x12')]=_0x555947['chatCapacity']||0x0;this[_0xaa30('0x13')]=0x0;this[_0xaa30('0x14')]=_0xaa30('0x10');this['mailStatusTime']=0x0;this[_0xaa30('0x15')]=_0x555947[_0xaa30('0x15')]||0x0;this[_0xaa30('0x16')]=0x0;this[_0xaa30('0x17')]=_0xaa30('0x10');this[_0xaa30('0x18')]=0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=0x0;this[_0xaa30('0x1b')]='unknown';this[_0xaa30('0x1c')]=0x0;this['smsCapacity']=_0x555947['smsCapacity']||0x0;this[_0xaa30('0x1d')]=0x0;this[_0xaa30('0x1e')]=_0xaa30('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x555947['whatsappCapacity']||0x0;this[_0xaa30('0x1f')]=0x0;this['openchannelStatus']=_0xaa30('0x10');this[_0xaa30('0x20')]=0x0;this['openchannelCapacity']=_0x555947['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xaa30('0x21')]=![];this[_0xaa30('0x22')]=undefined;this[_0xaa30('0x1')]='';this[_0xaa30('0x23')]={};this[_0xaa30('0x24')]={};this['mailWaitingInteractions']={};this[_0xaa30('0x25')]={};this[_0xaa30('0x26')]={};this[_0xaa30('0x27')]={};this[_0xaa30('0x28')]();}Agent[_0xaa30('0x29')]['getChannelStatus']=function(_0x325b42){if(this[_0x325b42+_0xaa30('0x2a')]>0x0){if(this[_0x325b42+_0xaa30('0x2b')]>0x0&&this[_0x325b42+_0xaa30('0x2a')]>=this[_0x325b42+'Capacity']){return _0xaa30('0x2c');}else{return _0xaa30('0x2d');}}else{return _0xaa30('0x2e');}};Agent[_0xaa30('0x29')][_0xaa30('0x28')]=function(){var _0x2a59ce=['mail',_0xaa30('0x2f'),_0xaa30('0x30'),'fax',_0xaa30('0x31'),'whatsapp'];for(var _0x2da4da=0x0;_0x2da4da<_0x2a59ce[_0xaa30('0x32')];_0x2da4da+=0x1){var _0x2aabf8=this[_0xaa30('0x33')](_0x2a59ce[_0x2da4da]);if(this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]!==_0x2aabf8){this[_0x2a59ce[_0x2da4da]+_0xaa30('0x35')]=_[_0xaa30('0x36')](moment()[_0xaa30('0x37')]('x'));}this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]=_0x2aabf8;}var _0x43fb30={'id':this['id'],'name':this[_0xaa30('0x8')],'online':this[_0xaa30('0x9')],'voicePause':this[_0xaa30('0xa')],'chatPause':this[_0xaa30('0xb')],'mailPause':this[_0xaa30('0xc')],'smsPause':this[_0xaa30('0x38')],'faxPause':this[_0xaa30('0xd')],'openchannelPause':this[_0xaa30('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xaa30('0x11')],'chatCapacity':this[_0xaa30('0x12')],'chatCurrentCapacity':this[_0xaa30('0x13')],'mailStatus':this[_0xaa30('0x14')],'mailStatusTime':this[_0xaa30('0x39')],'mailCapacity':this[_0xaa30('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xaa30('0x19')],'faxCurrentCapacity':this[_0xaa30('0x1a')],'smsStatus':this[_0xaa30('0x1b')],'smsStatusTime':this[_0xaa30('0x1c')],'smsCapacity':this[_0xaa30('0x3a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaa30('0x3b')],'whatsappCapacity':this[_0xaa30('0x3c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xaa30('0x3d')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xaa30('0x3e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xaa30('0x21')],'busyQueue':this[_0xaa30('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xaa30('0x24')],'mailWaitingInteractions':this[_0xaa30('0x3f')],'openchannelWaitingInteractions':this[_0xaa30('0x25')],'smsWaitingInteractions':this[_0xaa30('0x26')],'whatsappWaitingInteractions':this[_0xaa30('0x27')]};var _0x61c959=md5(JSON['stringify'](_0x43fb30));if(this[_0xaa30('0x1')]!==_0x61c959){this[_0xaa30('0x1')]=_0x61c959;io['emit'](_0xaa30('0x40'),_[_0xaa30('0x41')](_0x43fb30,[_0xaa30('0x9')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 9db89db..89f8d89 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 _0x8ced=['md5','util','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','chatPause','paused','available','stringify','chat:queue:%s','chat_queue:save','lodash'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8ced,0xa1));var _0xd8ce=function(_0x1fcc1e,_0x39efee){_0x1fcc1e=_0x1fcc1e-0x0;var _0x13497a=_0x8ced[_0x1fcc1e];return _0x13497a;};'use strict';var _=require(_0xd8ce('0x0'));var md5=require(_0xd8ce('0x1'));var util=require(_0xd8ce('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xd8ce('0x3')](config[_0xd8ce('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd8ce('0x5'))(new Redis(config[_0xd8ce('0x4')]));function ChatQueue(_0x303fdf){this['id']=_0x303fdf['id']||0x0;this[_0xd8ce('0x6')]=_0x303fdf[_0xd8ce('0x6')]||'';this[_0xd8ce('0x7')]=_0x303fdf[_0xd8ce('0x7')]||0xa;this['strategy']=_0x303fdf[_0xd8ce('0x8')]||_0xd8ce('0x9');this['Agents']=_0x303fdf['Agents'];this[_0xd8ce('0xa')]={};this[_0xd8ce('0xb')]=0x0;this[_0xd8ce('0x1')]='';this[_0xd8ce('0xc')]();this[_0xd8ce('0xd')]();}ChatQueue[_0xd8ce('0xe')][_0xd8ce('0xc')]=function(){var _0x4bf97f=this['mapAgentsId'][_0xd8ce('0xf')];this[_0xd8ce('0xa')]=_[_0xd8ce('0x10')](this[_0xd8ce('0x11')],'id');this[_0xd8ce('0xa')][_0xd8ce('0xf')]=_0x4bf97f;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xd8ce('0x12')]=0x0;this['paused']=0x0;for(var _0x564c6b=0x0;_0x564c6b=0x0?this['available']:0x0;var _0x4fb508={'id':this['id'],'available':this[_0xd8ce('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd8ce('0x16')],'waiting':this[_0xd8ce('0xb')]};var _0x36e778=md5(JSON[_0xd8ce('0x18')](_0x4fb508));if(this['md5']!==_0x36e778){this[_0xd8ce('0x1')]=_0x36e778;io['to'](util['format'](_0xd8ce('0x19'),_0x4fb508[_0xd8ce('0x6')]))['emit'](_0xd8ce('0x1a'),_0x4fb508);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8c0c=['timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','paused','length','loggedIn','available','waiting','format','chat:queue:%s','name','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x86d7e5,_0x560e31){var _0x55c576=function(_0x239638){while(--_0x239638){_0x86d7e5['push'](_0x86d7e5['shift']());}};_0x55c576(++_0x560e31);}(_0x8c0c,0x6c));var _0xc8c0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8c0c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc8c0('0x0'));var md5=require(_0xc8c0('0x1'));var util=require(_0xc8c0('0x2'));var Redis=require(_0xc8c0('0x3'));var config=require(_0xc8c0('0x4'));config[_0xc8c0('0x5')]=_[_0xc8c0('0x6')](config[_0xc8c0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc8c0('0x7'))(new Redis(config[_0xc8c0('0x5')]));function ChatQueue(_0x150e27){this['id']=_0x150e27['id']||0x0;this['name']=_0x150e27['name']||'';this['timeout']=_0x150e27[_0xc8c0('0x8')]||0xa;this[_0xc8c0('0x9')]=_0x150e27[_0xc8c0('0x9')]||_0xc8c0('0xa');this[_0xc8c0('0xb')]=_0x150e27['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xc8c0('0x1')]='';this[_0xc8c0('0xc')]();this[_0xc8c0('0xd')]();}ChatQueue[_0xc8c0('0xe')][_0xc8c0('0xc')]=function(){var _0x560ef1=this['mapAgentsId'][_0xc8c0('0xf')];this[_0xc8c0('0x10')]=_[_0xc8c0('0x11')](this[_0xc8c0('0xb')],'id');this['mapAgentsId'][_0xc8c0('0xf')]=_0x560ef1;};ChatQueue[_0xc8c0('0xe')][_0xc8c0('0xd')]=function(){this['loggedIn']=0x0;this[_0xc8c0('0x12')]=0x0;for(var _0x20da95=0x0;_0x20da95=0x0?this[_0xc8c0('0x15')]:0x0;var _0x49dbc4={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc8c0('0x14')],'name':this['name'],'paused':this[_0xc8c0('0x12')],'waiting':this[_0xc8c0('0x16')]};var _0x2ae076=md5(JSON['stringify'](_0x49dbc4));if(this['md5']!==_0x2ae076){this[_0xc8c0('0x1')]=_0x2ae076;io['to'](util[_0xc8c0('0x17')](_0xc8c0('0x18'),_0x49dbc4[_0xc8c0('0x19')]))[_0xc8c0('0x1a')](_0xc8c0('0x1b'),_0x49dbc4);}};module[_0xc8c0('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 8035ea3..dfaf2bf 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 _0xd792=['updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x307f72,_0x32fba4){var _0x10f2c6=function(_0x56117a){while(--_0x56117a){_0x307f72['push'](_0x307f72['shift']());}};_0x10f2c6(++_0x32fba4);}(_0xd792,0xc2));var _0x2d79=function(_0xdeee16,_0x2de5a4){_0xdeee16=_0xdeee16-0x0;var _0x425069=_0xd792[_0xdeee16];return _0x425069;};'use strict';var _=require('lodash');var md5=require(_0x2d79('0x0'));var util=require(_0x2d79('0x1'));var Redis=require(_0x2d79('0x2'));var config=require(_0x2d79('0x3'));config[_0x2d79('0x4')]=_[_0x2d79('0x5')](config[_0x2d79('0x4')],{'host':_0x2d79('0x6'),'port':0x18eb});var io=require(_0x2d79('0x7'))(new Redis(config[_0x2d79('0x4')]));function FaxQueue(_0x3d568a){this['id']=_0x3d568a['id']||0x0;this[_0x2d79('0x8')]=_0x3d568a[_0x2d79('0x8')]||'';this[_0x2d79('0x9')]=_0x3d568a[_0x2d79('0x9')]||0xa;this[_0x2d79('0xa')]=_0x3d568a[_0x2d79('0xa')]||_0x2d79('0xb');this[_0x2d79('0xc')]=_0x3d568a[_0x2d79('0xc')];this[_0x2d79('0xd')]={};this[_0x2d79('0xe')]=0x0;this['md5']='';this[_0x2d79('0xf')]();this[_0x2d79('0x10')]();}FaxQueue[_0x2d79('0x11')][_0x2d79('0xf')]=function(){var _0x321b6c=this[_0x2d79('0xd')][_0x2d79('0x12')];this[_0x2d79('0xd')]=_[_0x2d79('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x2d79('0x12')]=_0x321b6c;};FaxQueue[_0x2d79('0x11')]['updateRealtime']=function(){this[_0x2d79('0x14')]=0x0;this[_0x2d79('0x15')]=0x0;for(var _0x259b4f=0x0;_0x259b4f=0x0?this['available']:0x0;var _0x2b0f41={'id':this['id'],'available':this[_0x2d79('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2d79('0x8')],'paused':this['paused'],'waiting':this[_0x2d79('0xe')]};var _0x45d564=md5(JSON[_0x2d79('0x19')](_0x2b0f41));if(this[_0x2d79('0x0')]!==_0x45d564){this[_0x2d79('0x0')]=_0x45d564;io['to'](util['format'](_0x2d79('0x1a'),_0x2b0f41['name']))[_0x2d79('0x1b')](_0x2d79('0x1c'),_0x2b0f41);}};module[_0x2d79('0x1d')]=FaxQueue; \ No newline at end of file +var _0x89ef=['_rr','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','md5','format','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x11e564,_0x6d25d1){var _0x2d13fe=function(_0x8edfd8){while(--_0x8edfd8){_0x11e564['push'](_0x11e564['shift']());}};_0x2d13fe(++_0x6d25d1);}(_0x89ef,0x125));var _0xf89e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x89ef[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xf89e('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf89e('0x1'));var config=require(_0xf89e('0x2'));config[_0xf89e('0x3')]=_['defaults'](config[_0xf89e('0x3')],{'host':_0xf89e('0x4'),'port':0x18eb});var io=require(_0xf89e('0x5'))(new Redis(config[_0xf89e('0x3')]));function FaxQueue(_0x2d8018){this['id']=_0x2d8018['id']||0x0;this[_0xf89e('0x6')]=_0x2d8018[_0xf89e('0x6')]||'';this[_0xf89e('0x7')]=_0x2d8018[_0xf89e('0x7')]||0xa;this[_0xf89e('0x8')]=_0x2d8018['strategy']||_0xf89e('0x9');this[_0xf89e('0xa')]=_0x2d8018[_0xf89e('0xa')];this[_0xf89e('0xb')]={};this[_0xf89e('0xc')]=0x0;this['md5']='';this[_0xf89e('0xd')]();this['updateRealtime']();}FaxQueue[_0xf89e('0xe')][_0xf89e('0xd')]=function(){var _0x43cabb=this[_0xf89e('0xb')][_0xf89e('0xf')];this[_0xf89e('0xb')]=_['map'](this[_0xf89e('0xa')],'id');this[_0xf89e('0xb')][_0xf89e('0xf')]=_0x43cabb;};FaxQueue[_0xf89e('0xe')][_0xf89e('0x10')]=function(){this[_0xf89e('0x11')]=0x0;this[_0xf89e('0x12')]=0x0;for(var _0x53cba2=0x0;_0x53cba2=0x0?this['available']:0x0;var _0x49d6b7={'id':this['id'],'available':this[_0xf89e('0x16')],'loggedIn':this[_0xf89e('0x11')],'name':this[_0xf89e('0x6')],'paused':this[_0xf89e('0x12')],'waiting':this[_0xf89e('0xc')]};var _0x55492c=md5(JSON[_0xf89e('0x17')](_0x49d6b7));if(this[_0xf89e('0x18')]!==_0x55492c){this[_0xf89e('0x18')]=_0x55492c;io['to'](util[_0xf89e('0x19')]('fax:queue:%s',_0x49d6b7[_0xf89e('0x6')]))['emit'](_0xf89e('0x1a'),_0x49d6b7);}};module[_0xf89e('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index de5887b..151caac 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 _0x70bb=['Intervals','exports','name'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x70bb,0xbc));var _0xb70b=function(_0x5ce00e,_0x5be1b1){_0x5ce00e=_0x5ce00e-0x0;var _0x2f825b=_0x70bb[_0x5ce00e];return _0x2f825b;};'use strict';function Interval(_0x28e8df){this['id']=_0x28e8df['id']||0x0;this['name']=_0x28e8df[_0xb70b('0x0')]||'';this[_0xb70b('0x1')]=_0x28e8df[_0xb70b('0x1')]||{};}module[_0xb70b('0x2')]=Interval; \ No newline at end of file +var _0x5f29=['name','Intervals'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x5f29,0x13c));var _0x95f2=function(_0x22b82b,_0x4407cd){_0x22b82b=_0x22b82b-0x0;var _0x220523=_0x5f29[_0x22b82b];return _0x220523;};'use strict';function Interval(_0x158b58){this['id']=_0x158b58['id']||0x0;this[_0x95f2('0x0')]=_0x158b58['name']||'';this[_0x95f2('0x1')]=_0x158b58[_0x95f2('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 7aca4c4..9de18cd 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 _0xe62a=['available','stringify','format','emit','mail_queue:save','md5','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','Agents','length','online','mailPause'];(function(_0x31ca4e,_0x17480f){var _0x14a87a=function(_0x4a730a){while(--_0x4a730a){_0x31ca4e['push'](_0x31ca4e['shift']());}};_0x14a87a(++_0x17480f);}(_0xe62a,0x7d));var _0xae62=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe62a[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var md5=require(_0xae62('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xae62('0x1'));config[_0xae62('0x2')]=_[_0xae62('0x3')](config[_0xae62('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x137f02){this['id']=_0x137f02['id']||0x0;this['name']=_0x137f02[_0xae62('0x4')]||'';this[_0xae62('0x5')]=_0x137f02[_0xae62('0x5')]||0xa;this[_0xae62('0x6')]=_0x137f02[_0xae62('0x6')]||_0xae62('0x7');this['Agents']=_0x137f02['Agents'];this[_0xae62('0x8')]={};this[_0xae62('0x9')]=0x0;this[_0xae62('0x0')]='';this[_0xae62('0xa')]();this['updateRealtime']();}MailQueue[_0xae62('0xb')]['updateRouting']=function(){var _0xa8dbf9=this[_0xae62('0x8')]['_rr'];this[_0xae62('0x8')]=_['map'](this['Agents'],'id');this[_0xae62('0x8')][_0xae62('0xc')]=_0xa8dbf9;};MailQueue[_0xae62('0xb')]['updateRealtime']=function(){this[_0xae62('0xd')]=0x0;this[_0xae62('0xe')]=0x0;for(var _0x18d6cb=0x0;_0x18d6cb=0x0?this[_0xae62('0x13')]:0x0;var _0x44741c={'id':this['id'],'available':this[_0xae62('0x13')],'loggedIn':this[_0xae62('0xd')],'name':this['name'],'paused':this[_0xae62('0xe')],'waiting':this[_0xae62('0x9')]};var _0x3ac08d=md5(JSON[_0xae62('0x14')](_0x44741c));if(this[_0xae62('0x0')]!==_0x3ac08d){this[_0xae62('0x0')]=_0x3ac08d;io['to'](util[_0xae62('0x15')]('mail:queue:%s',_0x44741c[_0xae62('0x4')]))[_0xae62('0x16')](_0xae62('0x17'),_0x44741c);}};module['exports']=MailQueue; \ No newline at end of file +var _0xadb1=['waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x29234f,_0xa4b3b0){var _0x119a23=function(_0x2262e5){while(--_0x2262e5){_0x29234f['push'](_0x29234f['shift']());}};_0x119a23(++_0xa4b3b0);}(_0xadb1,0x67));var _0x1adb=function(_0x43ae5c,_0xecb40e){_0x43ae5c=_0x43ae5c-0x0;var _0x4b5f96=_0xadb1[_0x43ae5c];return _0x4b5f96;};'use strict';var _=require('lodash');var md5=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var Redis=require(_0x1adb('0x2'));var config=require(_0x1adb('0x3'));config[_0x1adb('0x4')]=_[_0x1adb('0x5')](config[_0x1adb('0x4')],{'host':_0x1adb('0x6'),'port':0x18eb});var io=require(_0x1adb('0x7'))(new Redis(config[_0x1adb('0x4')]));function MailQueue(_0x5a2070){this['id']=_0x5a2070['id']||0x0;this[_0x1adb('0x8')]=_0x5a2070['name']||'';this['timeout']=_0x5a2070['timeout']||0xa;this[_0x1adb('0x9')]=_0x5a2070[_0x1adb('0x9')]||_0x1adb('0xa');this['Agents']=_0x5a2070[_0x1adb('0xb')];this[_0x1adb('0xc')]={};this[_0x1adb('0xd')]=0x0;this['md5']='';this[_0x1adb('0xe')]();this[_0x1adb('0xf')]();}MailQueue[_0x1adb('0x10')]['updateRouting']=function(){var _0x48cbaa=this['mapAgentsId'][_0x1adb('0x11')];this[_0x1adb('0xc')]=_[_0x1adb('0x12')](this[_0x1adb('0xb')],'id');this[_0x1adb('0xc')][_0x1adb('0x11')]=_0x48cbaa;};MailQueue[_0x1adb('0x10')]['updateRealtime']=function(){this[_0x1adb('0x13')]=0x0;this[_0x1adb('0x14')]=0x0;for(var _0x65cd59=0x0;_0x65cd59=0x0?this[_0x1adb('0x17')]:0x0;var _0x52e733={'id':this['id'],'available':this[_0x1adb('0x17')],'loggedIn':this[_0x1adb('0x13')],'name':this[_0x1adb('0x8')],'paused':this['paused'],'waiting':this[_0x1adb('0xd')]};var _0x1467bd=md5(JSON['stringify'](_0x52e733));if(this['md5']!==_0x1467bd){this[_0x1adb('0x0')]=_0x1467bd;io['to'](util[_0x1adb('0x18')](_0x1adb('0x19'),_0x52e733[_0x1adb('0x8')]))[_0x1adb('0x1a')](_0x1adb('0x1b'),_0x52e733);}};module[_0x1adb('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ab73fb9..9fb9ea6 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7a54,0x106));var _0x47a5=function(_0x5ef290,_0x42f1ef){_0x5ef290=_0x5ef290-0x0;var _0x3f5de4=_0x7a54[_0x5ef290];return _0x3f5de4;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x264814,_0x4433db){var _0xf180c7=function(_0x5e3901){while(--_0x5e3901){_0x264814['push'](_0x264814['shift']());}};_0xf180c7(++_0x4433db);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x5fc3[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0ba11d0..64e978b 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 _0x7a72=['mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','smsPause','paused','available','waiting','stringify','format','sms_queue:save','exports','md5','util','../../../config/environment','defaults','localhost','redis','name','strategy','beepall','Agents'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a72,0x1be));var _0x27a7=function(_0x4a0166,_0x45ef70){_0x4a0166=_0x4a0166-0x0;var _0x17597c=_0x7a72[_0x4a0166];return _0x17597c;};'use strict';var _=require('lodash');var md5=require(_0x27a7('0x0'));var util=require(_0x27a7('0x1'));var Redis=require('ioredis');var config=require(_0x27a7('0x2'));config['redis']=_[_0x27a7('0x3')](config['redis'],{'host':_0x27a7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27a7('0x5')]));function SmsQueue(_0x5e56ac){this['id']=_0x5e56ac['id']||0x0;this[_0x27a7('0x6')]=_0x5e56ac[_0x27a7('0x6')]||'';this['timeout']=_0x5e56ac['timeout']||0xa;this[_0x27a7('0x7')]=_0x5e56ac['strategy']||_0x27a7('0x8');this[_0x27a7('0x9')]=_0x5e56ac[_0x27a7('0x9')];this[_0x27a7('0xa')]={};this['waiting']=0x0;this[_0x27a7('0x0')]='';this[_0x27a7('0xb')]();this[_0x27a7('0xc')]();}SmsQueue['prototype'][_0x27a7('0xb')]=function(){var _0x38a600=this['mapAgentsId'][_0x27a7('0xd')];this[_0x27a7('0xa')]=_['map'](this[_0x27a7('0x9')],'id');this[_0x27a7('0xa')][_0x27a7('0xd')]=_0x38a600;};SmsQueue[_0x27a7('0xe')][_0x27a7('0xc')]=function(){this[_0x27a7('0xf')]=0x0;this['paused']=0x0;for(var _0x4d3bfb=0x0;_0x4d3bfb=0x0?this[_0x27a7('0x12')]:0x0;var _0x2c82ab={'id':this['id'],'available':this[_0x27a7('0x12')],'loggedIn':this[_0x27a7('0xf')],'name':this[_0x27a7('0x6')],'paused':this['paused'],'waiting':this[_0x27a7('0x13')]};var _0x51253d=md5(JSON[_0x27a7('0x14')](_0x2c82ab));if(this[_0x27a7('0x0')]!==_0x51253d){this['md5']=_0x51253d;io['to'](util[_0x27a7('0x15')]('sms:queue:%s',_0x2c82ab[_0x27a7('0x6')]))['emit'](_0x27a7('0x16'),_0x2c82ab);}};module[_0x27a7('0x17')]=SmsQueue; \ No newline at end of file +var _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x57ff0f,_0x51b988){var _0x29382f=function(_0x4084ad){while(--_0x4084ad){_0x57ff0f['push'](_0x57ff0f['shift']());}};_0x29382f(++_0x51b988);}(_0x44ae,0x17d));var _0xe44a=function(_0x14b74f,_0xf24abd){_0x14b74f=_0x14b74f-0x0;var _0x11f35e=_0x44ae[_0x14b74f];return _0x11f35e;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index f7a9f38..824f70e 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 _0x639d=['map','prototype','loggedIn','paused','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x639d,0xe2));var _0xd639=function(_0x418c9f,_0x3d7034){_0x418c9f=_0x418c9f-0x0;var _0xdb149c=_0x639d[_0x418c9f];return _0xdb149c;};'use strict';var _=require(_0xd639('0x0'));var md5=require('md5');var util=require(_0xd639('0x1'));var Redis=require(_0xd639('0x2'));var config=require('../../../config/environment');config[_0xd639('0x3')]=_[_0xd639('0x4')](config[_0xd639('0x3')],{'host':_0xd639('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x379eec){this['id']=_0x379eec['id']||0x0;this[_0xd639('0x6')]=_0x379eec[_0xd639('0x6')]||'';this[_0xd639('0x7')]=_0x379eec[_0xd639('0x7')]||0xa;this[_0xd639('0x8')]=_0x379eec['strategy']||_0xd639('0x9');this[_0xd639('0xa')]=_0x379eec[_0xd639('0xa')];this[_0xd639('0xb')]={};this[_0xd639('0xc')]=0x0;this[_0xd639('0xd')]='';this[_0xd639('0xe')]();this[_0xd639('0xf')]();}WhatsappQueue['prototype'][_0xd639('0xe')]=function(){var _0x15d5c9=this[_0xd639('0xb')][_0xd639('0x10')];this['mapAgentsId']=_[_0xd639('0x11')](this[_0xd639('0xa')],'id');this['mapAgentsId'][_0xd639('0x10')]=_0x15d5c9;};WhatsappQueue[_0xd639('0x12')]['updateRealtime']=function(){this[_0xd639('0x13')]=0x0;this[_0xd639('0x14')]=0x0;for(var _0x670d39=0x0;_0x670d39=0x0?this[_0xd639('0x16')]:0x0;var _0xd4890d={'id':this['id'],'available':this[_0xd639('0x16')],'loggedIn':this[_0xd639('0x13')],'name':this[_0xd639('0x6')],'paused':this[_0xd639('0x14')],'waiting':this[_0xd639('0xc')]};var _0x5df29b=md5(JSON['stringify'](_0xd4890d));if(this['md5']!==_0x5df29b){this[_0xd639('0xd')]=_0x5df29b;io['to'](util[_0xd639('0x17')](_0xd639('0x18'),_0xd4890d[_0xd639('0x6')]))[_0xd639('0x19')](_0xd639('0x1a'),_0xd4890d);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x17b8=['mapAgentsId','updateRealtime','prototype','updateRouting','paused','length','online','loggedIn','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x29b2de,_0xb3aa09){var _0x32bfab=function(_0x4fd4dd){while(--_0x4fd4dd){_0x29b2de['push'](_0x29b2de['shift']());}};_0x32bfab(++_0xb3aa09);}(_0x17b8,0x17a));var _0x817b=function(_0x23d8cb,_0xb28842){_0x23d8cb=_0x23d8cb-0x0;var _0x489878=_0x17b8[_0x23d8cb];return _0x489878;};'use strict';var _=require('lodash');var md5=require(_0x817b('0x0'));var util=require(_0x817b('0x1'));var Redis=require(_0x817b('0x2'));var config=require(_0x817b('0x3'));config[_0x817b('0x4')]=_[_0x817b('0x5')](config[_0x817b('0x4')],{'host':_0x817b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x17f281){this['id']=_0x17f281['id']||0x0;this[_0x817b('0x7')]=_0x17f281[_0x817b('0x7')]||'';this[_0x817b('0x8')]=_0x17f281[_0x817b('0x8')]||0xa;this[_0x817b('0x9')]=_0x17f281[_0x817b('0x9')]||_0x817b('0xa');this[_0x817b('0xb')]=_0x17f281[_0x817b('0xb')];this[_0x817b('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x817b('0xd')]();}WhatsappQueue[_0x817b('0xe')][_0x817b('0xf')]=function(){var _0x5b0b86=this[_0x817b('0xc')]['_rr'];this[_0x817b('0xc')]=_['map'](this[_0x817b('0xb')],'id');this[_0x817b('0xc')]['_rr']=_0x5b0b86;};WhatsappQueue[_0x817b('0xe')][_0x817b('0xd')]=function(){this['loggedIn']=0x0;this[_0x817b('0x10')]=0x0;for(var _0x25c598=0x0;_0x25c598=0x0?this[_0x817b('0x14')]:0x0;var _0x7eb34f={'id':this['id'],'available':this[_0x817b('0x14')],'loggedIn':this[_0x817b('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x2f067d=md5(JSON[_0x817b('0x15')](_0x7eb34f));if(this[_0x817b('0x0')]!==_0x2f067d){this[_0x817b('0x0')]=_0x2f067d;io['to'](util[_0x817b('0x16')](_0x817b('0x17'),_0x7eb34f[_0x817b('0x7')]))['emit'](_0x817b('0x18'),_0x7eb34f);}};module[_0x817b('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2e7c450..6ab8163 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 375ed4c..7f42484 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 _0x2aa8=['../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x2aa8,0x16e));var _0x82aa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2aa8[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x82aa('0x0'));exports[_0x82aa('0x1')]=function(_0x5986b8,_0x5a86d4){return client[_0x82aa('0x2')](_0x82aa('0x3'),{'body':_0x5a86d4,'options':{'where':{'id':_0x5986b8}},'log':'updateChatInteraction'});};exports[_0x82aa('0x4')]=function(_0x235c90,_0xc85f45){return client['Request'](_0x82aa('0x5'),{'body':_0xc85f45,'options':{'where':{'id':_0x235c90}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3770=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x3c0d8e,_0xb45b0d){var _0x49fa30=function(_0x101c2a){while(--_0x101c2a){_0x3c0d8e['push'](_0x3c0d8e['shift']());}};_0x49fa30(++_0xb45b0d);}(_0x3770,0x136));var _0x0377=function(_0x5f360a,_0x4de76d){_0x5f360a=_0x5f360a-0x0;var _0x4d8ffd=_0x3770[_0x5f360a];return _0x4d8ffd;};'use strict';var client=require('../client');exports[_0x0377('0x0')]=function(_0x1695b8,_0x468ec7){return client[_0x0377('0x1')](_0x0377('0x2'),{'body':_0x468ec7,'options':{'where':{'id':_0x1695b8}},'log':_0x0377('0x3')});};exports[_0x0377('0x4')]=function(_0xce7fbf,_0x44f271){return client[_0x0377('0x1')](_0x0377('0x5'),{'body':_0x44f271,'options':{'where':{'id':_0xce7fbf}},'log':_0x0377('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4697718..9fdf0e5 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 _0x3b45=['create','Request','../client'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0x3b45,0x1af));var _0x53b4=function(_0xb9ff6b,_0x6359af){_0xb9ff6b=_0xb9ff6b-0x0;var _0x111246=_0x3b45[_0xb9ff6b];return _0x111246;};'use strict';var client=require(_0x53b4('0x0'));exports[_0x53b4('0x1')]=function(_0x506a99){return client[_0x53b4('0x2')]('CreateChatMessage',{'body':_0x506a99,'log':'createChatMessage'});}; \ No newline at end of file +var _0x070f=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x34b159,_0x48650a){var _0x39dbf1=function(_0x4badc9){while(--_0x4badc9){_0x34b159['push'](_0x34b159['shift']());}};_0x39dbf1(++_0x48650a);}(_0x070f,0x7e));var _0xf070=function(_0x954338,_0x5abb8d){_0x954338=_0x954338-0x0;var _0x2bdb86=_0x070f[_0x954338];return _0x2bdb86;};'use strict';var client=require(_0xf070('0x0'));exports['create']=function(_0x158ddc){return client[_0xf070('0x1')](_0xf070('0x2'),{'body':_0x158ddc,'log':_0xf070('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index df40068..0a4cb15 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 _0xbd50=['Request','name','timeout','strategy','User','Agents','../client','getChatQueues'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0xbd50,0x196));var _0x0bd5=function(_0x2b370d,_0xe627cb){_0x2b370d=_0x2b370d-0x0;var _0x49eb69=_0xbd50[_0x2b370d];return _0x49eb69;};'use strict';var client=require(_0x0bd5('0x0'));exports[_0x0bd5('0x1')]=function(){return function(){return client[_0x0bd5('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x0bd5('0x3'),_0x0bd5('0x4'),_0x0bd5('0x5')],'include':[{'model':_0x0bd5('0x6'),'as':_0x0bd5('0x7'),'attributes':['id','name','online','chatPause']}]},'log':_0x0bd5('0x1')});};}; \ No newline at end of file +var _0x1159=['../client','GetChatQueue','name','timeout','strategy','User','Agents','online','getChatQueues'];(function(_0x4cf782,_0x43c0dc){var _0x4046aa=function(_0x341c57){while(--_0x341c57){_0x4cf782['push'](_0x4cf782['shift']());}};_0x4046aa(++_0x43c0dc);}(_0x1159,0xf3));var _0x9115=function(_0x4cea39,_0x2f293b){_0x4cea39=_0x4cea39-0x0;var _0x4b4800=_0x1159[_0x4cea39];return _0x4b4800;};'use strict';var client=require(_0x9115('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x9115('0x1'),{'options':{'raw':![],'attributes':['id',_0x9115('0x2'),_0x9115('0x3'),_0x9115('0x4')],'include':[{'model':_0x9115('0x5'),'as':_0x9115('0x6'),'attributes':['id',_0x9115('0x2'),_0x9115('0x7'),'chatPause']}]},'log':_0x9115('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 54476fc..2711ed7 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 _0xf3cd=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x241bd6,_0x64179){var _0x2bac40=function(_0x2da19f){while(--_0x2da19f){_0x241bd6['push'](_0x241bd6['shift']());}};_0x2bac40(++_0x64179);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x55de53,_0x5da3e7){_0x55de53=_0x55de53-0x0;var _0x362fbe=_0xf3cd[_0x55de53];return _0x362fbe;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x3')});};exports['update']=function(_0x401518,_0x71b446){return client[_0xdf3c('0x2')]('UpdateChatQueueReport',{'body':_0x71b446,'options':{'where':{'uniqueid':_0x401518},'order':[['id',_0xdf3c('0x4')]],'limit':0x1},'log':_0xdf3c('0x5')});}; \ No newline at end of file +var _0x834d=['DESC','UpdateChatQueueReport','../client','create','Request','update'];(function(_0x2c4f99,_0x1470fe){var _0x52ed41=function(_0x54d3cf){while(--_0x54d3cf){_0x2c4f99['push'](_0x2c4f99['shift']());}};_0x52ed41(++_0x1470fe);}(_0x834d,0x140));var _0xd834=function(_0x25f0fa,_0x726d3e){_0x25f0fa=_0x25f0fa-0x0;var _0x19a0ee=_0x834d[_0x25f0fa];return _0x19a0ee;};'use strict';var client=require(_0xd834('0x0'));exports[_0xd834('0x1')]=function(_0x595403){return client[_0xd834('0x2')]('CreateChatQueueReport',{'body':_0x595403,'log':'CreateChatQueueReport'});};exports[_0xd834('0x3')]=function(_0x157364,_0x2d838f){return client[_0xd834('0x2')]('UpdateChatQueueReport',{'body':_0x2d838f,'options':{'where':{'uniqueid':_0x157364},'order':[['id',_0xd834('0x4')]],'limit':0x1},'log':_0xd834('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0fdbf6f..97d4ee5 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5302fc,_0x2b2002){var _0x10bc8c=function(_0x51c235){while(--_0x51c235){_0x5302fc['push'](_0x5302fc['shift']());}};_0x10bc8c(++_0x2b2002);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x16a786,_0x2fdef8){var _0x254550=function(_0x32f561){while(--_0x32f561){_0x16a786['push'](_0x16a786['shift']());}};_0x254550(++_0x2fdef8);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ca62961..7e83c22 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 _0x2256=['CreateFaxMessage','../client','Request'];(function(_0x517fac,_0x19e44c){var _0x54b8f8=function(_0x261b42){while(--_0x261b42){_0x517fac['push'](_0x517fac['shift']());}};_0x54b8f8(++_0x19e44c);}(_0x2256,0x1b7));var _0x6225=function(_0x59a470,_0x2cd4a0){_0x59a470=_0x59a470-0x0;var _0x39a8f0=_0x2256[_0x59a470];return _0x39a8f0;};'use strict';var client=require(_0x6225('0x0'));exports['create']=function(_0x4a4f21){return client[_0x6225('0x1')](_0x6225('0x2'),{'body':_0x4a4f21,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xef33=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0xeaffed,_0x2406f8){var _0x540580=function(_0x32c711){while(--_0x32c711){_0xeaffed['push'](_0xeaffed['shift']());}};_0x540580(++_0x2406f8);}(_0xef33,0xf8));var _0x3ef3=function(_0xf24950,_0x58a82d){_0xf24950=_0xf24950-0x0;var _0x117eb7=_0xef33[_0xf24950];return _0x117eb7;};'use strict';var client=require(_0x3ef3('0x0'));exports[_0x3ef3('0x1')]=function(_0x1fe971){return client['Request'](_0x3ef3('0x2'),{'body':_0x1fe971,'log':_0x3ef3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 371a98f..fdcfb83 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 _0x86b0=['GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x20b421,_0x21eda0){var _0x2b497e=function(_0x342b81){while(--_0x342b81){_0x20b421['push'](_0x20b421['shift']());}};_0x2b497e(++_0x21eda0);}(_0x86b0,0x184));var _0x086b=function(_0x5a43ef,_0x2e64c0){_0x5a43ef=_0x5a43ef-0x0;var _0x3f19f6=_0x86b0[_0x5a43ef];return _0x3f19f6;};'use strict';var client=require(_0x086b('0x0'));exports[_0x086b('0x1')]=function(){return function(){return client['Request'](_0x086b('0x2'),{'options':{'raw':![],'attributes':['id',_0x086b('0x3'),_0x086b('0x4'),_0x086b('0x5')],'include':[{'model':_0x086b('0x6'),'as':_0x086b('0x7'),'attributes':['id',_0x086b('0x3'),_0x086b('0x8'),_0x086b('0x9')]}]},'log':_0x086b('0x1')});};}; \ No newline at end of file +var _0x231f=['User','Agents','online','../client','getFaxQueues','name','timeout'];(function(_0x38097f,_0xe557a3){var _0x3c7967=function(_0x978cb7){while(--_0x978cb7){_0x38097f['push'](_0x38097f['shift']());}};_0x3c7967(++_0xe557a3);}(_0x231f,0x13e));var _0xf231=function(_0x955cab,_0x51acda){_0x955cab=_0x955cab-0x0;var _0x43c0ac=_0x231f[_0x955cab];return _0x43c0ac;};'use strict';var client=require(_0xf231('0x0'));exports[_0xf231('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xf231('0x2'),_0xf231('0x3'),'strategy'],'include':[{'model':_0xf231('0x4'),'as':_0xf231('0x5'),'attributes':['id',_0xf231('0x2'),_0xf231('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b925fb9..7f8f115 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 _0xe9ab=['CreateFaxQueueReport','UpdateFaxQueueReport','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe9ab,0x80));var _0xbe9a=function(_0x29bd12,_0x402731){_0x29bd12=_0x29bd12-0x0;var _0x4171f6=_0xe9ab[_0x29bd12];return _0x4171f6;};'use strict';var client=require(_0xbe9a('0x0'));exports['create']=function(_0x347f2b){return client['Request'](_0xbe9a('0x1'),{'body':_0x347f2b,'log':_0xbe9a('0x1')});};exports['update']=function(_0x192188,_0x32af39){return client['Request']('UpdateFaxQueueReport',{'body':_0x32af39,'options':{'where':{'uniqueid':_0x192188},'order':[['id','DESC']],'limit':0x1},'log':_0xbe9a('0x2')});}; \ No newline at end of file +var _0x5cf9=['UpdateFaxQueueReport','../client','CreateFaxQueueReport','update','Request'];(function(_0x13b329,_0x5f2ca7){var _0x2c01bb=function(_0x183409){while(--_0x183409){_0x13b329['push'](_0x13b329['shift']());}};_0x2c01bb(++_0x5f2ca7);}(_0x5cf9,0x19b));var _0x95cf=function(_0x435b89,_0x496dd6){_0x435b89=_0x435b89-0x0;var _0x4b67c0=_0x5cf9[_0x435b89];return _0x4b67c0;};'use strict';var client=require(_0x95cf('0x0'));exports['create']=function(_0x3a0c79){return client['Request']('CreateFaxQueueReport',{'body':_0x3a0c79,'log':_0x95cf('0x1')});};exports[_0x95cf('0x2')]=function(_0x17e25c,_0x3cb10d){return client[_0x95cf('0x3')](_0x95cf('0x4'),{'body':_0x3cb10d,'options':{'where':{'uniqueid':_0x17e25c},'order':[['id','DESC']],'limit':0x1},'log':_0x95cf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fbd2746..b4cb92c 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 _0x22ef=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x35d43a,_0x135321){var _0x30f344=function(_0x501c57){while(--_0x501c57){_0x35d43a['push'](_0x35d43a['shift']());}};_0x30f344(++_0x135321);}(_0x22ef,0x85));var _0xf22e=function(_0x14040d,_0x38ee52){_0x14040d=_0x14040d-0x0;var _0x27fe95=_0x22ef[_0x14040d];return _0x27fe95;};'use strict';var client=require(_0xf22e('0x0'));exports[_0xf22e('0x1')]=function(){return function(){return client[_0xf22e('0x2')](_0xf22e('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf22e('0x4')],'include':[{'model':_0xf22e('0x5'),'as':_0xf22e('0x6'),'attributes':['id',_0xf22e('0x4'),_0xf22e('0x7')]}]},'log':_0xf22e('0x1')});};}; \ No newline at end of file +var _0x00d6=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x485c12,_0x63ee16){var _0x5c87ad=function(_0x5bb3cf){while(--_0x5bb3cf){_0x485c12['push'](_0x485c12['shift']());}};_0x5c87ad(++_0x63ee16);}(_0x00d6,0x17c));var _0x600d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x00d6[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x600d('0x0'));exports[_0x600d('0x1')]=function(){return function(){return client['Request'](_0x600d('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x600d('0x3')],'include':[{'model':_0x600d('0x4'),'as':_0x600d('0x5'),'attributes':['id','name',_0x600d('0x6')]}]},'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 3617d93..5cc63fb 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 _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x5af7cb,_0x20b138){var _0xdf180c=function(_0x4f32d6){while(--_0x4f32d6){_0x5af7cb['push'](_0x5af7cb['shift']());}};_0xdf180c(++_0x20b138);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3a237a,_0x56111c){_0x3a237a=_0x3a237a-0x0;var _0x38c454=_0x02ce[_0x3a237a];return _0x38c454;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file +var _0x36ee=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction'];(function(_0x397567,_0x40bcac){var _0x515c5c=function(_0x424492){while(--_0x424492){_0x397567['push'](_0x397567['shift']());}};_0x515c5c(++_0x40bcac);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports['update']=function(_0x34e33c,_0x521ff3){return client[_0xe36e('0x0')](_0xe36e('0x1'),{'body':_0x521ff3,'options':{'where':{'id':_0x34e33c}},'log':_0xe36e('0x2')});};exports[_0xe36e('0x3')]=function(_0x567a84,_0x1118af){return client[_0xe36e('0x0')](_0xe36e('0x4'),{'body':_0x1118af,'options':{'where':{'id':_0x567a84}},'log':_0xe36e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 061a077..b3c21c5 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 _0xeebf=['CreateMailMessage','Request'];(function(_0x427847,_0x54eb07){var _0x3bf8fc=function(_0x61f63d){while(--_0x61f63d){_0x427847['push'](_0x427847['shift']());}};_0x3bf8fc(++_0x54eb07);}(_0xeebf,0x6f));var _0xfeeb=function(_0x6ba53a,_0x29277a){_0x6ba53a=_0x6ba53a-0x0;var _0x2842ca=_0xeebf[_0x6ba53a];return _0x2842ca;};'use strict';var client=require('../client');exports['create']=function(_0x194cc5){return client[_0xfeeb('0x0')](_0xfeeb('0x1'),{'body':_0x194cc5,'log':'createMailMessage'});}; \ No newline at end of file +var _0x21d9=['createMailMessage','create'];(function(_0x5ae879,_0xcee402){var _0x45f07c=function(_0x547b3a){while(--_0x547b3a){_0x5ae879['push'](_0x5ae879['shift']());}};_0x45f07c(++_0xcee402);}(_0x21d9,0x11b));var _0x921d=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x21d9[_0x406ae7];return _0x5a5b9d;};'use strict';var client=require('../client');exports[_0x921d('0x0')]=function(_0x5d4dc8){return client['Request']('CreateMailMessage',{'body':_0x5d4dc8,'log':_0x921d('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6cbfb2c..5727705 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 _0x85a7=['timeout','strategy','Agents','name','online','../client','getMailQueues','Request','GetMailQueue'];(function(_0x3d92c7,_0x200ba5){var _0x59126f=function(_0x52cda6){while(--_0x52cda6){_0x3d92c7['push'](_0x3d92c7['shift']());}};_0x59126f(++_0x200ba5);}(_0x85a7,0xa7));var _0x785a=function(_0x3c49e1,_0x4c2a19){_0x3c49e1=_0x3c49e1-0x0;var _0x5bdd14=_0x85a7[_0x3c49e1];return _0x5bdd14;};'use strict';var client=require(_0x785a('0x0'));exports[_0x785a('0x1')]=function(){return function(){return client[_0x785a('0x2')](_0x785a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x785a('0x4'),_0x785a('0x5')],'include':[{'model':'User','as':_0x785a('0x6'),'attributes':['id',_0x785a('0x7'),_0x785a('0x8'),'mailPause']}]},'log':_0x785a('0x1')});};}; \ No newline at end of file +var _0x3e57=['strategy','Agents','name','online','../client','getMailQueues','Request','timeout'];(function(_0x210896,_0x37c6b3){var _0x5a69e5=function(_0x16b11c){while(--_0x16b11c){_0x210896['push'](_0x210896['shift']());}};_0x5a69e5(++_0x37c6b3);}(_0x3e57,0x13c));var _0x73e5=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x3e57[_0x13b392];return _0x39db24;};'use strict';var client=require(_0x73e5('0x0'));exports[_0x73e5('0x1')]=function(){return function(){return client[_0x73e5('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x73e5('0x3'),_0x73e5('0x4')],'include':[{'model':'User','as':_0x73e5('0x5'),'attributes':['id',_0x73e5('0x6'),_0x73e5('0x7'),'mailPause']}]},'log':_0x73e5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a619430..b8e27d8 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 _0xec6c=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0xcad254,_0x31c9e4){var _0x5e76b0=function(_0x3b6668){while(--_0x3b6668){_0xcad254['push'](_0xcad254['shift']());}};_0x5e76b0(++_0x31c9e4);}(_0xec6c,0x1da));var _0xcec6=function(_0x54551e,_0x429370){_0x54551e=_0x54551e-0x0;var _0x1d6913=_0xec6c[_0x54551e];return _0x1d6913;};'use strict';var client=require(_0xcec6('0x0'));exports[_0xcec6('0x1')]=function(_0x456b37){return client[_0xcec6('0x2')](_0xcec6('0x3'),{'body':_0x456b37,'log':_0xcec6('0x3')});};exports[_0xcec6('0x4')]=function(_0x13b821,_0x2ab1b1){return client[_0xcec6('0x2')](_0xcec6('0x5'),{'body':_0x2ab1b1,'options':{'where':{'uniqueid':_0x13b821},'order':[['id','DESC']],'limit':0x1},'log':_0xcec6('0x5')});}; \ No newline at end of file +var _0x03c8=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x3daed1,_0x1053f6){var _0x35821c=function(_0x29780b){while(--_0x29780b){_0x3daed1['push'](_0x3daed1['shift']());}};_0x35821c(++_0x1053f6);}(_0x03c8,0x9a));var _0x803c=function(_0x8cef78,_0x302e58){_0x8cef78=_0x8cef78-0x0;var _0x5b67dc=_0x03c8[_0x8cef78];return _0x5b67dc;};'use strict';var client=require(_0x803c('0x0'));exports[_0x803c('0x1')]=function(_0x463f99){return client[_0x803c('0x2')](_0x803c('0x3'),{'body':_0x463f99,'log':'CreateMailQueueReport'});};exports[_0x803c('0x4')]=function(_0x100cdc,_0x35e3e){return client[_0x803c('0x2')](_0x803c('0x5'),{'body':_0x35e3e,'options':{'where':{'uniqueid':_0x100cdc},'order':[['id',_0x803c('0x6')]],'limit':0x1},'log':_0x803c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 663f4c1..7bb5d42 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 _0x6f68=['addTags','addTagsToChatInteraction','update','Request','updateOpenchannelInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f68,0x12e));var _0x86f6=function(_0x17fdf5,_0x1ce706){_0x17fdf5=_0x17fdf5-0x0;var _0x2f0b0e=_0x6f68[_0x17fdf5];return _0x2f0b0e;};'use strict';var client=require('../client');exports[_0x86f6('0x0')]=function(_0x38dc90,_0x2c50ea){return client[_0x86f6('0x1')]('UpdateOpenchannelInteraction',{'body':_0x2c50ea,'options':{'where':{'id':_0x38dc90}},'log':_0x86f6('0x2')});};exports[_0x86f6('0x3')]=function(_0xdc302d,_0x4d2f7c){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x4d2f7c,'options':{'where':{'id':_0xdc302d}},'log':_0x86f6('0x4')});}; \ No newline at end of file +var _0xc7cf=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x1608a5,_0x31619e){var _0xea34d1=function(_0x2b17c1){while(--_0x2b17c1){_0x1608a5['push'](_0x1608a5['shift']());}};_0xea34d1(++_0x31619e);}(_0xc7cf,0x83));var _0xfc7c=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xc7cf[_0x4e6eb2];return _0x4e0c1c;};'use strict';var client=require('../client');exports[_0xfc7c('0x0')]=function(_0x3f0541,_0x387fb0){return client[_0xfc7c('0x1')](_0xfc7c('0x2'),{'body':_0x387fb0,'options':{'where':{'id':_0x3f0541}},'log':_0xfc7c('0x3')});};exports[_0xfc7c('0x4')]=function(_0x149422,_0x1cadea){return client[_0xfc7c('0x1')](_0xfc7c('0x5'),{'body':_0x1cadea,'options':{'where':{'id':_0x149422}},'log':_0xfc7c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bf8acdd..2d87bde 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 _0x3d13=['CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2dd9f5,_0xbf579){var _0x5140e2=function(_0x1e0d66){while(--_0x1e0d66){_0x2dd9f5['push'](_0x2dd9f5['shift']());}};_0x5140e2(++_0xbf579);}(_0x3d13,0x19c));var _0x33d1=function(_0x2d46ef,_0x5b56de){_0x2d46ef=_0x2d46ef-0x0;var _0x12fa0e=_0x3d13[_0x2d46ef];return _0x12fa0e;};'use strict';var client=require('../client');exports['create']=function(_0x5f1d2f){return client['Request'](_0x33d1('0x0'),{'body':_0x5f1d2f,'log':_0x33d1('0x1')});}; \ No newline at end of file +var _0xa223=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x5a9433,_0x4ff56c){var _0x34f6d3=function(_0x2b4016){while(--_0x2b4016){_0x5a9433['push'](_0x5a9433['shift']());}};_0x34f6d3(++_0x4ff56c);}(_0xa223,0x66));var _0x3a22=function(_0x29c10a,_0x3bf55f){_0x29c10a=_0x29c10a-0x0;var _0x39db3a=_0xa223[_0x29c10a];return _0x39db3a;};'use strict';var client=require(_0x3a22('0x0'));exports[_0x3a22('0x1')]=function(_0x355863){return client[_0x3a22('0x2')](_0x3a22('0x3'),{'body':_0x355863,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b967a13..405b041 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 _0xf440=['name','timeout','strategy','online','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xf440,0x1ee));var _0x0f44=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf440[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports[_0x0f44('0x0')]=function(){return function(){return client[_0x0f44('0x1')](_0x0f44('0x2'),{'options':{'raw':![],'attributes':['id',_0x0f44('0x3'),_0x0f44('0x4'),_0x0f44('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x0f44('0x3'),_0x0f44('0x6'),'openchannelPause']}]},'log':_0x0f44('0x0')});};}; \ No newline at end of file +var _0x6edf=['../client','Request','GetOpenchannelQueue','strategy','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x15a2b7,_0x2206fe){var _0x4392d5=function(_0x26b823){while(--_0x26b823){_0x15a2b7['push'](_0x15a2b7['shift']());}};_0x4392d5(++_0x2206fe);}(_0x6edf,0xd8));var _0xf6ed=function(_0x2adb26,_0x153aa7){_0x2adb26=_0x2adb26-0x0;var _0x2b81cb=_0x6edf[_0x2adb26];return _0x2b81cb;};'use strict';var client=require(_0xf6ed('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xf6ed('0x1')](_0xf6ed('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6ed('0x3')],'include':[{'model':'User','as':_0xf6ed('0x4'),'attributes':['id','name',_0xf6ed('0x5'),_0xf6ed('0x6')]}]},'log':_0xf6ed('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1933870..eee6839 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 _0x2ab7=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x58cfae,_0x28e392){var _0x15d7c5=function(_0x261431){while(--_0x261431){_0x58cfae['push'](_0x58cfae['shift']());}};_0x15d7c5(++_0x28e392);}(_0x2ab7,0xe7));var _0x72ab=function(_0x4c5cd4,_0x268643){_0x4c5cd4=_0x4c5cd4-0x0;var _0x210bcf=_0x2ab7[_0x4c5cd4];return _0x210bcf;};'use strict';var client=require(_0x72ab('0x0'));exports[_0x72ab('0x1')]=function(_0x439a2b){return client[_0x72ab('0x2')](_0x72ab('0x3'),{'body':_0x439a2b,'log':_0x72ab('0x3')});};exports['update']=function(_0xee8e51,_0x7ca33){return client[_0x72ab('0x2')](_0x72ab('0x4'),{'body':_0x7ca33,'options':{'where':{'uniqueid':_0xee8e51},'order':[['id','DESC']],'limit':0x1},'log':_0x72ab('0x4')});}; \ No newline at end of file +var _0x5fa1=['create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x5fa1,0xcb));var _0x15fa=function(_0x597070,_0x2c715f){_0x597070=_0x597070-0x0;var _0x487b51=_0x5fa1[_0x597070];return _0x487b51;};'use strict';var client=require(_0x15fa('0x0'));exports[_0x15fa('0x1')]=function(_0x5f1e9b){return client['Request'](_0x15fa('0x2'),{'body':_0x5f1e9b,'log':_0x15fa('0x2')});};exports['update']=function(_0x145a64,_0x1b5823){return client[_0x15fa('0x3')](_0x15fa('0x4'),{'body':_0x1b5823,'options':{'where':{'uniqueid':_0x145a64},'order':[['id',_0x15fa('0x5')]],'limit':0x1},'log':_0x15fa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ce9b023..44a1f34 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 _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1e69,0x85));var _0x91e6=function(_0x5e8874,_0x134292){_0x5e8874=_0x5e8874-0x0;var _0x4bf1de=_0x1e69[_0x5e8874];return _0x4bf1de;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file +var _0x4986=['UpdateSmsInteraction','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x4d75fb,_0x270631){var _0x2a588e=function(_0x27c53f){while(--_0x27c53f){_0x4d75fb['push'](_0x4d75fb['shift']());}};_0x2a588e(++_0x270631);}(_0x4986,0x6e));var _0x6498=function(_0x40b078,_0x400022){_0x40b078=_0x40b078-0x0;var _0x255894=_0x4986[_0x40b078];return _0x255894;};'use strict';var client=require(_0x6498('0x0'));exports[_0x6498('0x1')]=function(_0x3e9618,_0x5c0f72){return client['Request'](_0x6498('0x2'),{'body':_0x5c0f72,'options':{'where':{'id':_0x3e9618}},'log':_0x6498('0x3')});};exports['addTags']=function(_0x15e8d3,_0x12a6fb){return client[_0x6498('0x4')](_0x6498('0x5'),{'body':_0x12a6fb,'options':{'where':{'id':_0x15e8d3}},'log':_0x6498('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1167c42..83c0ee6 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 _0x8541=['create','Request','createSmsMessage','../client'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x8541,0xb3));var _0x1854=function(_0x3c4b91,_0x55bdde){_0x3c4b91=_0x3c4b91-0x0;var _0x86e4c6=_0x8541[_0x3c4b91];return _0x86e4c6;};'use strict';var client=require(_0x1854('0x0'));exports[_0x1854('0x1')]=function(_0x1cb32a){return client[_0x1854('0x2')]('CreateSmsMessage',{'body':_0x1cb32a,'log':_0x1854('0x3')});}; \ No newline at end of file +var _0xae4d=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x1fe540,_0x232fe9){var _0xf5d526=function(_0x3fd3bc){while(--_0x3fd3bc){_0x1fe540['push'](_0x1fe540['shift']());}};_0xf5d526(++_0x232fe9);}(_0xae4d,0xd4));var _0xdae4=function(_0x220425,_0x4820d6){_0x220425=_0x220425-0x0;var _0x174092=_0xae4d[_0x220425];return _0x174092;};'use strict';var client=require('../client');exports[_0xdae4('0x0')]=function(_0x137946){return client[_0xdae4('0x1')](_0xdae4('0x2'),{'body':_0x137946,'log':_0xdae4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 26ddc6f..b304efc 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0xbda505,_0x25a843){var _0x24b553=function(_0x9f1eb3){while(--_0x9f1eb3){_0xbda505['push'](_0xbda505['shift']());}};_0x24b553(++_0x25a843);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x5bb1f3,_0x314b24){var _0x17d26b=function(_0x207529){while(--_0x207529){_0x5bb1f3['push'](_0x5bb1f3['shift']());}};_0x17d26b(++_0x314b24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'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 a3dfb60..7303b13 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x3af26d,_0x6da0f){var _0x5f5ac2=function(_0x378abd){while(--_0x378abd){_0x3af26d['push'](_0x3af26d['shift']());}};_0x5f5ac2(++_0x6da0f);}(_0x3e74,0x175));var _0x43e7=function(_0x5d6e0e,_0x53bb9){_0x5d6e0e=_0x5d6e0e-0x0;var _0x3fe612=_0x3e74[_0x5d6e0e];return _0x3fe612;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4662d4,_0x3fa430){var _0x21ec19=function(_0x2ff273){while(--_0x2ff273){_0x4662d4['push'](_0x4662d4['shift']());}};_0x21ec19(++_0x3fa430);}(_0x70e0,0x17b));var _0x070e=function(_0x14f449,_0x19cd0b){_0x14f449=_0x14f449-0x0;var _0x2c2f91=_0x70e0[_0x14f449];return _0x2c2f91;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 8254070..4612ae3 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x44d7ec,_0x334300){var _0x4fcf8d=function(_0x2f8dbe){while(--_0x2f8dbe){_0x44d7ec['push'](_0x44d7ec['shift']());}};_0x4fcf8d(++_0x334300);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5c381f,_0x35ce72){var _0xe5b997=function(_0x57c5a5){while(--_0x57c5a5){_0x5c381f['push'](_0x5c381f['shift']());}};_0xe5b997(++_0x35ce72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 3da726b..2dcdc51 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 _0xe3da=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x57bf98,_0x37ed90){var _0x53d54f=function(_0xb652d7){while(--_0xb652d7){_0x57bf98['push'](_0x57bf98['shift']());}};_0x53d54f(++_0x37ed90);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xae3d('0x0'));exports[_0xae3d('0x1')]=function(_0x2788fe,_0x405f17){return client[_0xae3d('0x2')](_0xae3d('0x3'),{'body':_0x405f17,'options':{'where':{'id':_0x2788fe}},'log':_0xae3d('0x4')});};exports[_0xae3d('0x5')]=function(_0xb2dfd3,_0x22bacf){return client[_0xae3d('0x2')](_0xae3d('0x6'),{'body':_0x22bacf,'options':{'where':{'id':_0xb2dfd3}},'log':_0xae3d('0x7')});}; \ No newline at end of file +var _0xd916=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xd916,0x18a));var _0x6d91=function(_0x2d1ac2,_0x4b0985){_0x2d1ac2=_0x2d1ac2-0x0;var _0x35904b=_0xd916[_0x2d1ac2];return _0x35904b;};'use strict';var client=require(_0x6d91('0x0'));exports[_0x6d91('0x1')]=function(_0x1a65f4,_0x6a7dab){return client[_0x6d91('0x2')]('UpdateWhatsappInteraction',{'body':_0x6a7dab,'options':{'where':{'id':_0x1a65f4}},'log':_0x6d91('0x3')});};exports[_0x6d91('0x4')]=function(_0x5a4b38,_0x4f82b3){return client[_0x6d91('0x2')](_0x6d91('0x5'),{'body':_0x4f82b3,'options':{'where':{'id':_0x5a4b38}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f1c9447..d8b14a5 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 _0xeddb=['create','Request','CreateWhatsappMessage','../client'];(function(_0x1ce6a7,_0xeaa892){var _0x3095a7=function(_0x4a80df){while(--_0x4a80df){_0x1ce6a7['push'](_0x1ce6a7['shift']());}};_0x3095a7(++_0xeaa892);}(_0xeddb,0x1a7));var _0xbedd=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0xeddb[_0x58b6c7];return _0x5f50d0;};'use strict';var client=require(_0xbedd('0x0'));exports[_0xbedd('0x1')]=function(_0x596760){return client[_0xbedd('0x2')](_0xbedd('0x3'),{'body':_0x596760,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x05f2=['createWhatsappMessage','../client'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x05f2,0x119));var _0x205f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x05f2[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x205f('0x0'));exports['create']=function(_0xce1ed3){return client['Request']('CreateWhatsappMessage',{'body':_0xce1ed3,'log':_0x205f('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c205be7..c971f3e 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 _0x4b45=['strategy','User','online','../client','getWhatsappQueues','name','timeout'];(function(_0x15a72e,_0x32a6d8){var _0x27f659=function(_0x12819b){while(--_0x12819b){_0x15a72e['push'](_0x15a72e['shift']());}};_0x27f659(++_0x32a6d8);}(_0x4b45,0x96));var _0x54b4=function(_0x23b250,_0x416c8f){_0x23b250=_0x23b250-0x0;var _0x5e4a42=_0x4b45[_0x23b250];return _0x5e4a42;};'use strict';var client=require(_0x54b4('0x0'));exports[_0x54b4('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x54b4('0x2'),_0x54b4('0x3'),_0x54b4('0x4')],'include':[{'model':_0x54b4('0x5'),'as':'Agents','attributes':['id',_0x54b4('0x2'),_0x54b4('0x6'),'whatsappPause']}]},'log':_0x54b4('0x1')});};}; \ No newline at end of file +var _0xbbbb=['GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues','../client'];(function(_0x2cfe02,_0x28da9c){var _0x40a079=function(_0x1fac72){while(--_0x1fac72){_0x2cfe02['push'](_0x2cfe02['shift']());}};_0x40a079(++_0x28da9c);}(_0xbbbb,0xb3));var _0xbbbb=function(_0x2f9049,_0x118608){_0x2f9049=_0x2f9049-0x0;var _0xa587d5=_0xbbbb[_0x2f9049];return _0xa587d5;};'use strict';var client=require(_0xbbbb('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xbbbb('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xbbbb('0x2'),_0xbbbb('0x3')],'include':[{'model':_0xbbbb('0x4'),'as':_0xbbbb('0x5'),'attributes':['id',_0xbbbb('0x6'),_0xbbbb('0x7'),_0xbbbb('0x8')]}]},'log':_0xbbbb('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b59a0f0..8ab5da2 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 _0xfb72=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x212f9b,_0x495f89){var _0x2857ae=function(_0x1c0f20){while(--_0x1c0f20){_0x212f9b['push'](_0x212f9b['shift']());}};_0x2857ae(++_0x495f89);}(_0xfb72,0x108));var _0x2fb7=function(_0x37b7c9,_0x274436){_0x37b7c9=_0x37b7c9-0x0;var _0x506993=_0xfb72[_0x37b7c9];return _0x506993;};'use strict';var client=require('../client');exports['create']=function(_0x199265){return client['Request'](_0x2fb7('0x0'),{'body':_0x199265,'log':_0x2fb7('0x0')});};exports['update']=function(_0xf2a6ea,_0x3e7752){return client[_0x2fb7('0x1')](_0x2fb7('0x2'),{'body':_0x3e7752,'options':{'where':{'uniqueid':_0xf2a6ea},'order':[['id',_0x2fb7('0x3')]],'limit':0x1},'log':_0x2fb7('0x2')});}; \ No newline at end of file +var _0x2110=['DESC','UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport','update','Request'];(function(_0x56ffd9,_0x46bb7d){var _0x40f7e4=function(_0x2c337d){while(--_0x2c337d){_0x56ffd9['push'](_0x56ffd9['shift']());}};_0x40f7e4(++_0x46bb7d);}(_0x2110,0x152));var _0x0211=function(_0x2f5c09,_0x48364e){_0x2f5c09=_0x2f5c09-0x0;var _0x58e5c1=_0x2110[_0x2f5c09];return _0x58e5c1;};'use strict';var client=require('../client');exports[_0x0211('0x0')]=function(_0x324451){return client['Request'](_0x0211('0x1'),{'body':_0x324451,'log':_0x0211('0x1')});};exports[_0x0211('0x2')]=function(_0x2fd868,_0x16a4fe){return client[_0x0211('0x3')]('UpdateWhatsappQueueReport',{'body':_0x16a4fe,'options':{'where':{'uniqueid':_0x2fd868},'order':[['id',_0x0211('0x4')]],'limit':0x1},'log':_0x0211('0x5')});}; \ 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 9128d52..57c1c06 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 _0x216b=['complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x216b,0xcf));var _0xb216=function(_0x201bae,_0x24c602){_0x201bae=_0x201bae-0x0;var _0x5dd069=_0x216b[_0x201bae];return _0x5dd069;};'use strict';var schema=require(_0xb216('0x0'));var _=require('lodash');var util=require(_0xb216('0x1'));var seqqueue=require(_0xb216('0x2'));var logger=require(_0xb216('0x3'))(_0xb216('0x4'));var strategy=require(_0xb216('0x5'));var queue=schema({'name':{'type':_0xb216('0x6'),'required':!![],'message':_0xb216('0x7')},'timeout':{'type':_0xb216('0x8'),'message':_0xb216('0x9')}});function writeLog(_0x3c3684,_0x5ef215,_0x263158){return logger[_0xb216('0xa')](util[_0xb216('0xb')](_0xb216('0xc'),_0x3c3684,_0x5ef215['name'],_0x263158));}function handleFindAgent(_0x36a5c0){return function(_0x209953){return _0x209953[_0xb216('0xd')][_0xb216('0xe')]()===_0x36a5c0[_0xb216('0xe')]();};}exports[_0xb216('0xf')]=function(_0x47a72f,_0x7a120f,_0x1fd3ae,_0x5e9d93){return function(_0x5efc5a){try{var _0x1dce31={'name':_0x7a120f[0x0],'timeout':_0x7a120f[0x1]};var _0x5e1a1f=queue[_0xb216('0x0')](_0x1dce31,{'typecast':!![]});if(_0x5e1a1f[_0xb216('0x10')]){logger[_0xb216('0x11')](_0xb216('0x12'),_0x47a72f,_[_0xb216('0x13')](_0x5e1a1f,_0xb216('0x14'))[_0xb216('0x15')](',\x20'));_0x5efc5a[_0xb216('0x16')]();}else{var _0x5b2b3e=_[_0xb216('0x17')](_0x1fd3ae['agents'],handleFindAgent(_0x1dce31['name']));if(_0x5b2b3e){var _0x457d61=(_0x1dce31[_0xb216('0x18')]||0xa)*0x3e8;var _0x1a9db2,_0x17c10c;var _0x3b08eb=seqqueue[_0xb216('0x19')](_0x457d61);_0x3b08eb['id']=_0x47a72f;_0x3b08eb[_0xb216('0x1a')]=_0x457d61;_0x3b08eb['channel']=_0x5e9d93[_0xb216('0x1b')];writeLog(_0x47a72f,_0x5b2b3e,util['format'](_0xb216('0x1c'),_0x457d61));_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]['on'](_0xb216('0x1e'),function(){logger['info'](_0xb216('0x1f'),_0x47a72f);clearTimeout(_0x17c10c);_0x17c10c=undefined;_0x3b08eb[_0xb216('0x20')]();if(_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]){delete _0x1fd3ae[_0xb216('0x1d')][_0x47a72f];}_0x5efc5a[_0xb216('0x16')]();});_0x1fd3ae['rules'][_0x47a72f]['on'](_0xb216('0x21'),function(){if(_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]){delete _0x1fd3ae[_0xb216('0x1d')][_0x47a72f];}});_0x17c10c=setTimeout(function(){logger[_0xb216('0xa')](_0xb216('0x22'),_0x47a72f);clearTimeout(_0x17c10c);_0x3b08eb[_0xb216('0x20')]();_0x5efc5a[_0xb216('0x23')]();},_0x457d61);strategy['agent'](_0x3b08eb,_0x5b2b3e,_0x1fd3ae,_0x5e9d93);}else{logger[_0xb216('0x11')](_0xb216('0x24'),_0x47a72f,_0x1dce31[_0xb216('0xd')]);_0x5efc5a['stop']();}}}catch(_0x1e224a){console[_0xb216('0x25')](_0x1e224a);logger['error'](_0xb216('0x26'),_0x47a72f,_0x1e224a[_0xb216('0x27')]);_0x5efc5a['stop']();}};}; \ No newline at end of file +var _0x32c0=['START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','stop','timeout','createQueue','atimeout'];(function(_0x3c24c3,_0x39888b){var _0x23e5e0=function(_0x3b2415){while(--_0x3b2415){_0x3c24c3['push'](_0x3c24c3['shift']());}};_0x23e5e0(++_0x39888b);}(_0x32c0,0x6d));var _0x032c=function(_0x4ba8b0,_0x453734){_0x4ba8b0=_0x4ba8b0-0x0;var _0x265f3f=_0x32c0[_0x4ba8b0];return _0x265f3f;};'use strict';var schema=require(_0x032c('0x0'));var _=require(_0x032c('0x1'));var util=require(_0x032c('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x032c('0x3'))(_0x032c('0x4'));var strategy=require(_0x032c('0x5'));var queue=schema({'name':{'type':_0x032c('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x032c('0x7'),'message':_0x032c('0x8')}});function writeLog(_0xbeefab,_0x5ea7a3,_0xb2e563){return logger[_0x032c('0x9')](util[_0x032c('0xa')](_0x032c('0xb'),_0xbeefab,_0x5ea7a3[_0x032c('0xc')],_0xb2e563));}function handleFindAgent(_0x1a0ec2){return function(_0x412ec1){return _0x412ec1[_0x032c('0xc')]['toLowerCase']()===_0x1a0ec2[_0x032c('0xd')]();};}exports[_0x032c('0xe')]=function(_0x24d3e9,_0x2fbe44,_0x2867e7,_0x34f343){return function(_0x5f28f3){try{var _0x372124={'name':_0x2fbe44[0x0],'timeout':_0x2fbe44[0x1]};var _0x558e00=queue['validate'](_0x372124,{'typecast':!![]});if(_0x558e00[_0x032c('0xf')]){logger[_0x032c('0x10')]('[%s][AGENT]\x20%s',_0x24d3e9,_[_0x032c('0x11')](_0x558e00,_0x032c('0x12'))['join'](',\x20'));_0x5f28f3[_0x032c('0x13')]();}else{var _0x223dad=_['find'](_0x2867e7['agents'],handleFindAgent(_0x372124[_0x032c('0xc')]));if(_0x223dad){var _0xf0a8ee=(_0x372124[_0x032c('0x14')]||0xa)*0x3e8;var _0x18902c,_0x3732b2;var _0xdb8046=seqqueue[_0x032c('0x15')](_0xf0a8ee);_0xdb8046['id']=_0x24d3e9;_0xdb8046[_0x032c('0x16')]=_0xf0a8ee;_0xdb8046['channel']=_0x34f343['channel'];writeLog(_0x24d3e9,_0x223dad,util[_0x032c('0xa')](_0x032c('0x17'),_0xf0a8ee));_0x2867e7[_0x032c('0x18')][_0x24d3e9]['on']('end',function(){logger[_0x032c('0x9')](_0x032c('0x19'),_0x24d3e9);clearTimeout(_0x3732b2);_0x3732b2=undefined;_0xdb8046[_0x032c('0x1a')]();if(_0x2867e7[_0x032c('0x18')][_0x24d3e9]){delete _0x2867e7[_0x032c('0x18')][_0x24d3e9];}_0x5f28f3['stop']();});_0x2867e7[_0x032c('0x18')][_0x24d3e9]['on'](_0x032c('0x1b'),function(){if(_0x2867e7[_0x032c('0x18')][_0x24d3e9]){delete _0x2867e7[_0x032c('0x18')][_0x24d3e9];}});_0x3732b2=setTimeout(function(){logger[_0x032c('0x9')](_0x032c('0x1c'),_0x24d3e9);clearTimeout(_0x3732b2);_0xdb8046['close']();_0x5f28f3[_0x032c('0x1d')]();},_0xf0a8ee);strategy[_0x032c('0x1e')](_0xdb8046,_0x223dad,_0x2867e7,_0x34f343);}else{logger[_0x032c('0x10')](_0x032c('0x1f'),_0x24d3e9,_0x372124[_0x032c('0xc')]);_0x5f28f3[_0x032c('0x13')]();}}}catch(_0x34c7ba){console['log'](_0x34c7ba);logger[_0x032c('0x10')](_0x032c('0x20'),_0x24d3e9,_0x34c7ba['stack']);_0x5f28f3[_0x032c('0x13')]();}};}; \ 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 c87eba1..f6bf309 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 _0xb558=['dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','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','AccountId','account','upperFirst','interaction','isEmpty','body','getMustacheRender','Message','create','catch','error','[%s][AMAZONLEX]\x20%s','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','toString','postText','amazonlex','providerResponse','then'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xb558,0x1a0));var _0x8b55=function(_0x43e2d9,_0x349db8){_0x43e2d9=_0x43e2d9-0x0;var _0x580fa5=_0xb558[_0x43e2d9];return _0x580fa5;};'use strict';var _=require('lodash');var moment=require(_0x8b55('0x0'));var AWS=require('aws-sdk');var utils=require(_0x8b55('0x1'));var logger=require(_0x8b55('0x2'))(_0x8b55('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8b55('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8b55('0x5')),'faxMessage':require(_0x8b55('0x6')),'whatsappMessage':require(_0x8b55('0x7'))};exports[_0x8b55('0x8')]=function(_0x3d865b,_0x370dda){return function(_0x50608d){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x8b55('0x9'));return _0x50608d[_0x8b55('0xa')]();}var _0x42fda8={'ContactId':this[_0x8b55('0xb')]['id'],'sentAt':moment()[_0x8b55('0xc')](_0x8b55('0xd')),'direction':_0x8b55('0xe')};if(this[_0x8b55('0xf')]===_0x8b55('0x10')||this[_0x8b55('0xf')]===_0x8b55('0x11')){_0x42fda8['phone']=this['interaction'][_0x8b55('0x12')];}var _0x24b041=this['channel'];if(_0x24b041===_0x8b55('0x13')){_0x42fda8[_0x8b55('0x14')]=this['account']['id'];}else{_0x42fda8[_['upperFirst'](_0x24b041)+_0x8b55('0x15')]=this[_0x8b55('0x16')]['id'];}_0x42fda8[_[_0x8b55('0x17')](_0x24b041)+'InteractionId']=this[_0x8b55('0x18')]['id'];if(this[_0x8b55('0x18')]['created']){var _0x32809e=_0x370dda[0x4];if(!_[_0x8b55('0x19')](_0x32809e)){_0x42fda8[_0x8b55('0x1a')]=utils[_0x8b55('0x1b')](_0x32809e,this);return rpc[_0x24b041+_0x8b55('0x1c')][_0x8b55('0x1d')](_0x42fda8)['then'](function(_0xed6461){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x42fda8[_0x8b55('0x1a')]);})[_0x8b55('0x1e')](function(_0x48604f){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,JSON[_0x8b55('0x21')](_0x48604f));})[_0x8b55('0x22')](function(){logger[_0x8b55('0x23')](_0x8b55('0x24'),_0x3d865b);_0x50608d[_0x8b55('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d865b);_0x50608d[_0x8b55('0x25')]();}}else{var _0x303389=this;var _0x2918bd=new AWS['LexRuntime']({'accessKeyId':_0x370dda[0x0],'secretAccessKey':_0x370dda[0x1],'region':_0x370dda[0x2]});var _0x3c1a9d={'botAlias':'$LATEST','botName':_0x370dda[0x3],'inputText':this[_0x8b55('0x26')][_0x8b55('0x1a')],'userId':this[_0x8b55('0xf')]+':'+this[_0x8b55('0x18')]['id'][_0x8b55('0x27')]()};_0x2918bd[_0x8b55('0x28')](_0x3c1a9d,function(_0x1ca940,_0x3b65fc){if(_0x1ca940){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,_0x1ca940[_0x8b55('0x26')]);_0x50608d['next']();}else if(_0x3b65fc&&_0x3b65fc[_0x8b55('0x26')]){_0x303389[_0x8b55('0x1a')]['amazonlex']=_0x3b65fc;_0x42fda8['body']=_0x3b65fc[_0x8b55('0x26')];_0x42fda8['providerName']=_0x8b55('0x29');_0x42fda8[_0x8b55('0x2a')]=JSON[_0x8b55('0x21')](_0x3b65fc);return rpc[_0x24b041+_0x8b55('0x1c')]['create'](_0x42fda8)[_0x8b55('0x2b')](function(_0x331e04){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x42fda8[_0x8b55('0x1a')]);if(_0x3b65fc[_0x8b55('0x2c')]==_0x8b55('0x2d')){_0x50608d[_0x8b55('0xa')]();}else{_0x50608d[_0x8b55('0x25')]();}})[_0x8b55('0x1e')](function(_0x4ab4dd){logger[_0x8b55('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x3d865b,JSON[_0x8b55('0x21')](_0x4ab4dd));_0x50608d[_0x8b55('0xa')]();});}else{_0x50608d['next']();}});}}catch(_0x250368){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,JSON[_0x8b55('0x21')](_0x250368));_0x50608d[_0x8b55('0x25')]();}};}; \ No newline at end of file +var _0x4ddb=['upperFirst','created','body','then','info','catch','error','[%s][AMAZONLEX]\x20%s','stringify','[%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','providerName','amazonlex','providerResponse','create','dialogState','Failed','next','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId'];(function(_0x1c2be6,_0x19072d){var _0x14b8a3=function(_0x1711fc){while(--_0x1711fc){_0x1c2be6['push'](_0x1c2be6['shift']());}};_0x14b8a3(++_0x19072d);}(_0x4ddb,0x1ad));var _0xb4dd=function(_0x541a10,_0x53f603){_0x541a10=_0x541a10-0x0;var _0x45a4a6=_0x4ddb[_0x541a10];return _0x45a4a6;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xb4dd('0x0'))(_0xb4dd('0x1'));var rpc={'chatMessage':require(_0xb4dd('0x2')),'openchannelMessage':require(_0xb4dd('0x3')),'mailMessage':require(_0xb4dd('0x4')),'smsMessage':require(_0xb4dd('0x5')),'faxMessage':require(_0xb4dd('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb4dd('0x7')]=function(_0x2dfbd5,_0x5a98f5){return function(_0x3f704d){try{if(!_[_0xb4dd('0x8')](this[_0xb4dd('0x9')][_0xb4dd('0xa')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dfbd5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3f704d['next']();}var _0x32ff6c={'ContactId':this[_0xb4dd('0xb')]['id'],'sentAt':moment()[_0xb4dd('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb4dd('0xd')};if(this['channel']==='sms'||this[_0xb4dd('0xe')]===_0xb4dd('0xf')){_0x32ff6c[_0xb4dd('0x10')]=this[_0xb4dd('0x9')]['phone'];}var _0xc423a5=this['channel'];if(_0xc423a5===_0xb4dd('0x11')){_0x32ff6c[_0xb4dd('0x12')]=this[_0xb4dd('0x13')]['id'];}else{_0x32ff6c[_['upperFirst'](_0xc423a5)+_0xb4dd('0x14')]=this[_0xb4dd('0x13')]['id'];}_0x32ff6c[_[_0xb4dd('0x15')](_0xc423a5)+'InteractionId']=this[_0xb4dd('0x9')]['id'];if(this[_0xb4dd('0x9')][_0xb4dd('0x16')]){var _0x596d06=_0x5a98f5[0x4];if(!_['isEmpty'](_0x596d06)){_0x32ff6c[_0xb4dd('0x17')]=utils['getMustacheRender'](_0x596d06,this);return rpc[_0xc423a5+'Message']['create'](_0x32ff6c)[_0xb4dd('0x18')](function(_0x460084){logger[_0xb4dd('0x19')]('[%s][AMAZONLEX]\x20%s',_0x2dfbd5,_0x32ff6c[_0xb4dd('0x17')]);})[_0xb4dd('0x1a')](function(_0x14ceae){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0x14ceae));})['finally'](function(){logger[_0xb4dd('0x19')](_0xb4dd('0x1e'),_0x2dfbd5);_0x3f704d[_0xb4dd('0x1f')]();});}else{logger[_0xb4dd('0x19')](_0xb4dd('0x20'),_0x2dfbd5);_0x3f704d[_0xb4dd('0x1f')]();}}else{var _0x20da57=this;var _0x56044a=new AWS[(_0xb4dd('0x21'))]({'accessKeyId':_0x5a98f5[0x0],'secretAccessKey':_0x5a98f5[0x1],'region':_0x5a98f5[0x2]});var _0x2244ab={'botAlias':_0xb4dd('0x22'),'botName':_0x5a98f5[0x3],'inputText':this[_0xb4dd('0x23')]['body'],'userId':this['channel']+':'+this['interaction']['id'][_0xb4dd('0x24')]()};_0x56044a[_0xb4dd('0x25')](_0x2244ab,function(_0x3edd80,_0x17214f){if(_0x3edd80){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,_0x3edd80['message']);_0x3f704d['next']();}else if(_0x17214f&&_0x17214f[_0xb4dd('0x23')]){_0x20da57[_0xb4dd('0x17')]['amazonlex']=_0x17214f;_0x32ff6c['body']=_0x17214f[_0xb4dd('0x23')];_0x32ff6c[_0xb4dd('0x26')]=_0xb4dd('0x27');_0x32ff6c[_0xb4dd('0x28')]=JSON[_0xb4dd('0x1d')](_0x17214f);return rpc[_0xc423a5+'Message'][_0xb4dd('0x29')](_0x32ff6c)[_0xb4dd('0x18')](function(_0xe07279){logger[_0xb4dd('0x19')](_0xb4dd('0x1c'),_0x2dfbd5,_0x32ff6c[_0xb4dd('0x17')]);if(_0x17214f[_0xb4dd('0x2a')]==_0xb4dd('0x2b')){_0x3f704d[_0xb4dd('0x2c')]();}else{_0x3f704d[_0xb4dd('0x1f')]();}})[_0xb4dd('0x1a')](function(_0xbcb10){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0xbcb10));_0x3f704d['next']();});}else{_0x3f704d[_0xb4dd('0x2c')]();}});}}catch(_0x884499){logger['error'](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0x884499));_0x3f704d['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 8245dc6..089e132 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 _0x4fbc=['Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','Message','inReplyTo','','replace','','headers','auto_reply','sendMailMessage','smtpOptions','then','messageId','create','stringify','catch','finally','resolve','autoreplyExecuted','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','getMustacheRender','message','from','phone','read','subject'];(function(_0x455e31,_0x519d65){var _0x581075=function(_0x1521a8){while(--_0x1521a8){_0x455e31['push'](_0x455e31['shift']());}};_0x581075(++_0x519d65);}(_0x4fbc,0x1aa));var _0xc4fb=function(_0x10e467,_0x3a5744){_0x10e467=_0x10e467-0x0;var _0x223959=_0x4fbc[_0x10e467];return _0x223959;};'use strict';var _=require(_0xc4fb('0x0'));var moment=require(_0xc4fb('0x1'));var utils=require(_0xc4fb('0x2'));var logger=require('../../../../config/logger')(_0xc4fb('0x3'));var rpc={'chatMessage':require(_0xc4fb('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc4fb('0x5')),'smsMessage':require(_0xc4fb('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc4fb('0x7')),'chatInteraction':require(_0xc4fb('0x8')),'openchannelInteraction':require(_0xc4fb('0x9')),'mailInteraction':require(_0xc4fb('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xc4fb('0xb')),'whatsappInteraction':require(_0xc4fb('0xc'))};var mailRpc=require(_0xc4fb('0xd'));exports[_0xc4fb('0xe')]=function(_0x1d3a10,_0x2669bc,_0x51796f,_0x34cdd2){return function(_0x1d5a8e){try{var _0x1c4b24=this[_0xc4fb('0xf')];if(_0x1c4b24===_0xc4fb('0x10')&&_0x34cdd2[_0xc4fb('0x11')][_0xc4fb('0x12')]){logger[_0xc4fb('0x13')](_0xc4fb('0x14'),_0x1d3a10,_0xc4fb('0x15'));return _0x1d5a8e['next']();}if(_0x2669bc[0x0]==='1'&&(_[_0xc4fb('0x16')](this[_0xc4fb('0x17')][_0xc4fb('0x18')])||!this[_0xc4fb('0x17')][_0xc4fb('0x18')])){logger['info'](_0xc4fb('0x14'),_0x1d3a10,'Autoreply\x20already\x20sent');return _0x1d5a8e[_0xc4fb('0x19')]();}if(_0x2669bc[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0xc4fb('0x1a'),_0x1d3a10,_0xc4fb('0x1b'));return _0x1d5a8e[_0xc4fb('0x19')]();}var _0x4076b3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc4fb('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc4fb('0x1d')};if(this['channel']===_0xc4fb('0x10')){_0x4076b3[_0xc4fb('0x11')]=utils[_0xc4fb('0x1e')](_0x2669bc[0x2],this);}else{_0x4076b3[_0xc4fb('0x11')]=utils[_0xc4fb('0x1e')](_0x2669bc[0x1],this);}if(this[_0xc4fb('0x1f')]){_0x4076b3['to']=this[_0xc4fb('0x1f')]['from']||'';if(this[_0xc4fb('0xf')]===_0xc4fb('0x10')&&_0x2669bc[0x1]==='1'){_0x4076b3['cc']=this['message']['cc']||'';}_0x4076b3[_0xc4fb('0x20')]=this[_0xc4fb('0x1f')]['to']||'';_0x4076b3[_0xc4fb('0x21')]=this[_0xc4fb('0x1f')][_0xc4fb('0x21')]||'';_0x4076b3[_0xc4fb('0x22')]=!![];if(this[_0xc4fb('0x1f')][_0xc4fb('0x23')]){_0x4076b3[_0xc4fb('0x23')]='';_0x4076b3[_0xc4fb('0x23')]+=_['startsWith'](this['message'][_0xc4fb('0x23')],_0xc4fb('0x24'))?'':_0xc4fb('0x25');_0x4076b3['subject']+=this[_0xc4fb('0x1f')][_0xc4fb('0x23')];}}if(this['channel']===_0xc4fb('0x26')){_0x4076b3[_0xc4fb('0x27')]=this['account']['id'];}else{_0x4076b3[_[_0xc4fb('0x28')](this[_0xc4fb('0xf')])+'AccountId']=this['account']['id'];}_0x4076b3[_[_0xc4fb('0x28')](this[_0xc4fb('0xf')])+_0xc4fb('0x29')]=this['interaction']['id'];var _0x59a943=this[_0xc4fb('0x17')];if(rpc[this[_0xc4fb('0xf')]+_0xc4fb('0x2a')]){if(this['channel']===_0xc4fb('0x10')){_0x4076b3[_0xc4fb('0x2b')]=this[_0xc4fb('0x1f')]['messageId'];_0x4076b3['html']=_0xc4fb('0x2c')+_[_0xc4fb('0x2d')](_0x4076b3['body'],_0xc4fb('0x2e'),_0xc4fb('0x2f'))+_0xc4fb('0x30');_0x4076b3[_0xc4fb('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xc4fb('0x32')};return mailRpc[_0xc4fb('0x33')](this['account'][_0xc4fb('0x34')],_0x4076b3)[_0xc4fb('0x35')](function(_0x12d290){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1d3a10);_0x4076b3[_0xc4fb('0x36')]=_0x12d290['message']['messageId'];return rpc[_0x1c4b24+_0xc4fb('0x2a')][_0xc4fb('0x37')](_0x4076b3);})[_0xc4fb('0x35')](function(_0x1bbba3){logger[_0xc4fb('0x13')]('[%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON[_0xc4fb('0x38')](_0x1bbba3));})[_0xc4fb('0x39')](function(_0x6a3e8d){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON[_0xc4fb('0x38')](_0x6a3e8d));})[_0xc4fb('0x3a')](function(){Promise[_0xc4fb('0x3b')]()['then'](function(){if(_0x2669bc[0x0]!=='2'||_0x59a943[_0xc4fb('0x3c')])return;return rpc[_0x1c4b24+'Interaction'][_0xc4fb('0x3d')](_0x59a943['id'],{'autoreplyExecuted':!![]})[_0xc4fb('0x35')](function(_0xe3c069){logger[_0xc4fb('0x13')](_0xc4fb('0x1a'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0xe3c069));})[_0xc4fb('0x39')](function(_0x3db2ac){logger[_0xc4fb('0x3e')](_0xc4fb('0x3f'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x3db2ac));});})[_0xc4fb('0x35')](function(){_0x1d5a8e[_0xc4fb('0x19')]();});});}else{return rpc[this[_0xc4fb('0xf')]+_0xc4fb('0x2a')][_0xc4fb('0x37')](_0x4076b3)[_0xc4fb('0x35')](function(){logger[_0xc4fb('0x13')](_0xc4fb('0x14'),_0x1d3a10,_0x4076b3[_0xc4fb('0x11')]);})[_0xc4fb('0x39')](function(_0x1821b1){logger[_0xc4fb('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON['stringify'](_0x1821b1));})[_0xc4fb('0x3a')](function(){Promise['resolve']()['then'](function(){if(_0x2669bc[0x0]!=='2'||_0x59a943[_0xc4fb('0x3c')])return;return rpc[_0x1c4b24+_0xc4fb('0x40')][_0xc4fb('0x3d')](_0x59a943['id'],{'autoreplyExecuted':!![]})[_0xc4fb('0x35')](function(_0x357fa0){logger[_0xc4fb('0x13')](_0xc4fb('0x1a'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x357fa0));})['catch'](function(_0x19a039){logger[_0xc4fb('0x3e')](_0xc4fb('0x3f'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x19a039));});})[_0xc4fb('0x35')](function(){_0x1d5a8e['next']();});});}}}catch(_0x44aba3){logger['error'](_0xc4fb('0x14'),_0x1d3a10,JSON['stringify'](_0x44aba3));_0x1d5a8e[_0xc4fb('0x41')]();}};}; \ No newline at end of file +var _0xeb72=['from','phone','subject','startsWith','Re:','chat','account','upperFirst','AccountId','Message','inReplyTo','html','','replace','','headers','auto-replied','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','channel','getMustacheRender','message'];(function(_0x3e510c,_0x294640){var _0x1003f4=function(_0x25aa38){while(--_0x25aa38){_0x3e510c['push'](_0x3e510c['shift']());}};_0x1003f4(++_0x294640);}(_0xeb72,0x9d));var _0x2eb7=function(_0x16e690,_0x5d4683){_0x16e690=_0x16e690-0x0;var _0x3beb56=_0xeb72[_0x16e690];return _0x3beb56;};'use strict';var _=require(_0x2eb7('0x0'));var moment=require(_0x2eb7('0x1'));var utils=require(_0x2eb7('0x2'));var logger=require(_0x2eb7('0x3'))(_0x2eb7('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2eb7('0x5')),'mailMessage':require(_0x2eb7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2eb7('0x7')),'chatInteraction':require(_0x2eb7('0x8')),'openchannelInteraction':require(_0x2eb7('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x2eb7('0xa')),'faxInteraction':require(_0x2eb7('0xb')),'whatsappInteraction':require(_0x2eb7('0xc'))};var mailRpc=require(_0x2eb7('0xd'));exports['consequence']=function(_0x2f7885,_0x2cf787,_0x1ba8b7,_0x5ab56b){return function(_0x1751b3){try{var _0x45f946=this['channel'];if(_0x45f946===_0x2eb7('0xe')&&_0x5ab56b[_0x2eb7('0xf')]['isAutoreply']){logger[_0x2eb7('0x10')](_0x2eb7('0x11'),_0x2f7885,_0x2eb7('0x12'));return _0x1751b3[_0x2eb7('0x13')]();}if(_0x2cf787[0x0]==='1'&&(_['isNil'](this[_0x2eb7('0x14')][_0x2eb7('0x15')])||!this[_0x2eb7('0x14')]['created'])){logger[_0x2eb7('0x10')](_0x2eb7('0x11'),_0x2f7885,_0x2eb7('0x16'));return _0x1751b3[_0x2eb7('0x13')]();}if(_0x2cf787[0x0]==='2'&&this[_0x2eb7('0x14')][_0x2eb7('0x17')]){logger[_0x2eb7('0x10')](_0x2eb7('0x18'),_0x2f7885,_0x2eb7('0x19'));return _0x1751b3[_0x2eb7('0x13')]();}var _0x4d98a4={'ContactId':this[_0x2eb7('0x1a')]['id'],'sentAt':moment()[_0x2eb7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2eb7('0x1c')};if(this[_0x2eb7('0x1d')]==='mail'){_0x4d98a4['body']=utils['getMustacheRender'](_0x2cf787[0x2],this);}else{_0x4d98a4[_0x2eb7('0xf')]=utils[_0x2eb7('0x1e')](_0x2cf787[0x1],this);}if(this[_0x2eb7('0x1f')]){_0x4d98a4['to']=this[_0x2eb7('0x1f')][_0x2eb7('0x20')]||'';if(this[_0x2eb7('0x1d')]===_0x2eb7('0xe')&&_0x2cf787[0x1]==='1'){_0x4d98a4['cc']=this['message']['cc']||'';}_0x4d98a4[_0x2eb7('0x20')]=this[_0x2eb7('0x1f')]['to']||'';_0x4d98a4[_0x2eb7('0x21')]=this[_0x2eb7('0x1f')][_0x2eb7('0x21')]||'';_0x4d98a4['read']=!![];if(this[_0x2eb7('0x1f')]['subject']){_0x4d98a4[_0x2eb7('0x22')]='';_0x4d98a4['subject']+=_[_0x2eb7('0x23')](this[_0x2eb7('0x1f')][_0x2eb7('0x22')],_0x2eb7('0x24'))?'':'Re:\x20';_0x4d98a4['subject']+=this[_0x2eb7('0x1f')]['subject'];}}if(this[_0x2eb7('0x1d')]===_0x2eb7('0x25')){_0x4d98a4['ChatWebsiteId']=this[_0x2eb7('0x26')]['id'];}else{_0x4d98a4[_[_0x2eb7('0x27')](this[_0x2eb7('0x1d')])+_0x2eb7('0x28')]=this['account']['id'];}_0x4d98a4[_[_0x2eb7('0x27')](this[_0x2eb7('0x1d')])+'InteractionId']=this[_0x2eb7('0x14')]['id'];var _0xab4304=this[_0x2eb7('0x14')];if(rpc[this[_0x2eb7('0x1d')]+_0x2eb7('0x29')]){if(this[_0x2eb7('0x1d')]==='mail'){_0x4d98a4[_0x2eb7('0x2a')]=this[_0x2eb7('0x1f')]['messageId'];_0x4d98a4[_0x2eb7('0x2b')]=_0x2eb7('0x2c')+_[_0x2eb7('0x2d')](_0x4d98a4[_0x2eb7('0xf')],']+(>|$)/g,''),'priorityTrue':_0x56cbd2[0x1],'priorityFalse':_0x56cbd2[0x2]};var _0x509ae0=gotoif[_0xe508('0x0')](_0x8c9b68,{'typecast':!![]});if(_0x509ae0[_0xe508('0xa')]){logger[_0xe508('0xb')](_0xe508('0xc'),_0x54e3da,_['map'](_0x509ae0,_0xe508('0xd'))[_0xe508('0xe')](',\x20'));_0x5b8058[_0xe508('0xf')]();}else{try{var _0x272710=eval('('+_0x8c9b68[_0xe508('0x10')]+')');var _0x112889=_0x272710?_0x8c9b68[_0xe508('0x11')]:_0x8c9b68[_0xe508('0x12')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x54e3da,_0x8c9b68[_0xe508('0x10')],_0x272710,_0x112889||_0xe508('0x13'));if(_0x112889){var _0x3e1c07=_[_0xe508('0x14')](_0x5b8058[_0xe508('0x15')](),{'p':_0x112889});if(_0x3e1c07>=0x0){logger[_0xe508('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x54e3da,_0x112889||'next',_0x3e1c07);_0x5b8058[_0xe508('0x13')](_0x3e1c07);}else{logger[_0xe508('0x16')](_0xe508('0x17'),_0x54e3da,_0x112889||_0xe508('0x13'));_0x5b8058[_0xe508('0xf')]();}}else{_0x5b8058['next']();}}catch(_0x148a07){logger[_0xe508('0xb')](_0xe508('0x18'),_0x54e3da,_0x148a07[_0xe508('0xd')]);_0x5b8058[_0xe508('0xf')]();}}}catch(_0x4df946){logger[_0xe508('0xb')]('[%s][GOTOIF]\x20%s',_0x54e3da,JSON[_0xe508('0x19')](_0x4df946));_0x5b8058[_0xe508('0xf')]();}};}; \ No newline at end of file +var _0xedd4=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xedd4,0x183));var _0x4edd=function(_0x5e7aab,_0x2fb8d6){_0x5e7aab=_0x5e7aab-0x0;var _0x23abd5=_0xedd4[_0x5e7aab];return _0x23abd5;};'use strict';var schema=require(_0x4edd('0x0'));var _=require(_0x4edd('0x1'));var htmlToText=require(_0x4edd('0x2'));var utils=require(_0x4edd('0x3'));var logger=require(_0x4edd('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x4edd('0x5'),'required':!![],'message':_0x4edd('0x6')},'priorityTrue':{'type':_0x4edd('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x4edd('0x7'),'message':_0x4edd('0x8')}});exports[_0x4edd('0x9')]=function(_0x243004,_0x2ab047){return function(_0x32295b){try{var _0x4473cb={'condition':htmlToText[_0x4edd('0xa')](utils['getMustacheRender'](_0x2ab047[0x0],this),{'wordwrap':![]})[_0x4edd('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2ab047[0x1],'priorityFalse':_0x2ab047[0x2]};var _0x3c6e10=gotoif[_0x4edd('0x0')](_0x4473cb,{'typecast':!![]});if(_0x3c6e10[_0x4edd('0xc')]){logger[_0x4edd('0xd')]('[%s][GOTOIF]\x20%s',_0x243004,_['map'](_0x3c6e10,_0x4edd('0xe'))['join'](',\x20'));_0x32295b[_0x4edd('0xf')]();}else{try{var _0xe4db91=eval('('+_0x4473cb[_0x4edd('0x10')]+')');var _0x4bb9e8=_0xe4db91?_0x4473cb[_0x4edd('0x11')]:_0x4473cb[_0x4edd('0x12')];logger[_0x4edd('0x13')](_0x4edd('0x14'),_0x243004,_0x4473cb['condition'],_0xe4db91,_0x4bb9e8||_0x4edd('0x15'));if(_0x4bb9e8){var _0x196f7e=_[_0x4edd('0x16')](_0x32295b['rules'](),{'p':_0x4bb9e8});if(_0x196f7e>=0x0){logger[_0x4edd('0x13')](_0x4edd('0x17'),_0x243004,_0x4bb9e8||_0x4edd('0x15'),_0x196f7e);_0x32295b[_0x4edd('0x15')](_0x196f7e);}else{logger['info'](_0x4edd('0x18'),_0x243004,_0x4bb9e8||'next');_0x32295b['stop']();}}else{_0x32295b[_0x4edd('0x15')]();}}catch(_0xa974fd){logger['error'](_0x4edd('0x19'),_0x243004,_0xa974fd[_0x4edd('0xe')]);_0x32295b['stop']();}}}catch(_0x3583b2){logger[_0x4edd('0xd')](_0x4edd('0x1a'),_0x243004,JSON[_0x4edd('0x1b')](_0x3583b2));_0x32295b[_0x4edd('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 92ea957..e0ba928 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 _0x45d7=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x45d7,0x68));var _0x745d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x45d7[_0x17d9e3];return _0x14192d;};'use strict';var schema=require('validate');var _=require(_0x745d('0x0'));var logger=require(_0x745d('0x1'))('routing');var gotop=schema({'priority':{'type':_0x745d('0x2'),'required':!![],'message':_0x745d('0x3')}});exports[_0x745d('0x4')]=function(_0x2e79bc,_0x491738){return function(_0x5d9a5e){try{var _0x257d45={'priority':_0x491738[0x0]};var _0x59d317=gotop['validate'](_0x257d45,{'typecast':!![]});if(_0x59d317['length']){logger[_0x745d('0x5')](_0x745d('0x6'),_0x2e79bc,_[_0x745d('0x7')](_0x59d317,_0x745d('0x8'))[_0x745d('0x9')](',\x20'));_0x5d9a5e[_0x745d('0xa')]();}else{logger[_0x745d('0xb')](_0x745d('0xc'),_0x2e79bc,_0x257d45[_0x745d('0xd')]);if(_0x257d45['priority']){var _0x2ee7de=_['findIndex'](_0x5d9a5e[_0x745d('0xe')](),{'p':_0x257d45[_0x745d('0xd')]});if(_0x2ee7de>=0x0){logger[_0x745d('0xb')](_0x745d('0xf'),_0x2e79bc,_0x257d45[_0x745d('0xd')]||'next',_0x2ee7de);_0x5d9a5e[_0x745d('0x10')](_0x2ee7de);}else{logger[_0x745d('0xb')](_0x745d('0x11'),_0x2e79bc,_0x257d45[_0x745d('0xd')]||_0x745d('0x10'));_0x5d9a5e[_0x745d('0xa')]();}}else{_0x5d9a5e[_0x745d('0x10')]();}}}catch(_0x2b3bbc){logger[_0x745d('0x5')](_0x745d('0x6'),_0x2e79bc,JSON[_0x745d('0x12')](_0x2b3bbc));_0x5d9a5e['stop']();}};}; \ No newline at end of file +var _0xf09b=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%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','message','join','stop'];(function(_0x2be6e6,_0x1b63d2){var _0x276550=function(_0x530250){while(--_0x530250){_0x2be6e6['push'](_0x2be6e6['shift']());}};_0x276550(++_0x1b63d2);}(_0xf09b,0x70));var _0xbf09=function(_0x54412a,_0x4962b0){_0x54412a=_0x54412a-0x0;var _0xc409b5=_0xf09b[_0x54412a];return _0xc409b5;};'use strict';var schema=require(_0xbf09('0x0'));var _=require(_0xbf09('0x1'));var logger=require(_0xbf09('0x2'))(_0xbf09('0x3'));var gotop=schema({'priority':{'type':_0xbf09('0x4'),'required':!![],'message':_0xbf09('0x5')}});exports[_0xbf09('0x6')]=function(_0xbad568,_0x11a9cc){return function(_0x1573cb){try{var _0x8439ce={'priority':_0x11a9cc[0x0]};var _0x54969f=gotop[_0xbf09('0x0')](_0x8439ce,{'typecast':!![]});if(_0x54969f[_0xbf09('0x7')]){logger[_0xbf09('0x8')](_0xbf09('0x9'),_0xbad568,_[_0xbf09('0xa')](_0x54969f,_0xbf09('0xb'))[_0xbf09('0xc')](',\x20'));_0x1573cb[_0xbf09('0xd')]();}else{logger['info'](_0xbf09('0xe'),_0xbad568,_0x8439ce[_0xbf09('0xf')]);if(_0x8439ce['priority']){var _0x783827=_[_0xbf09('0x10')](_0x1573cb['rules'](),{'p':_0x8439ce[_0xbf09('0xf')]});if(_0x783827>=0x0){logger['info'](_0xbf09('0x11'),_0xbad568,_0x8439ce[_0xbf09('0xf')]||'next',_0x783827);_0x1573cb[_0xbf09('0x12')](_0x783827);}else{logger[_0xbf09('0x13')](_0xbf09('0x14'),_0xbad568,_0x8439ce['priority']||_0xbf09('0x12'));_0x1573cb[_0xbf09('0xd')]();}}else{_0x1573cb['next']();}}}catch(_0xe77263){logger['error']('[%s][GOTOP]\x20%s',_0xbad568,JSON['stringify'](_0xe77263));_0x1573cb[_0xbf09('0xd')]();}};}; \ 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 1409ae2..8a7fda8 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 _0x5523=['upperFirst','channel','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','catch','error','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','account','AccountId'];(function(_0xe35b1c,_0x1718dc){var _0x55fdd8=function(_0x1a2c22){while(--_0x1a2c22){_0xe35b1c['push'](_0xe35b1c['shift']());}};_0x55fdd8(++_0x1718dc);}(_0x5523,0x137));var _0x3552=function(_0xc76f55,_0x4ef44c){_0xc76f55=_0xc76f55-0x0;var _0x42cadf=_0x5523[_0xc76f55];return _0x42cadf;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var rpc={'chatMessage':require(_0x3552('0x2')),'openchannelMessage':require(_0x3552('0x3')),'mailMessage':require(_0x3552('0x4')),'smsMessage':require(_0x3552('0x5')),'faxMessage':require(_0x3552('0x6')),'whatsappMessage':require(_0x3552('0x7'))};exports[_0x3552('0x8')]=function(_0xe94944,_0x3225aa){return function(_0x58385b){try{var _0x5d2dc8={'body':utils['getMustacheRender'](_0x3225aa[0x0],this),'ContactId':this[_0x3552('0x9')]['id']};if(this['channel']===_0x3552('0xa')){_0x5d2dc8[_0x3552('0xb')]=this[_0x3552('0xc')]['id'];}else{_0x5d2dc8[_['upperFirst'](this['channel'])+_0x3552('0xd')]=this[_0x3552('0xc')]['id'];}_0x5d2dc8[_[_0x3552('0xe')](this[_0x3552('0xf')])+_0x3552('0x10')]=this[_0x3552('0x11')]['id'];if(rpc[this[_0x3552('0xf')]+_0x3552('0x12')]){return rpc[this[_0x3552('0xf')]+_0x3552('0x12')][_0x3552('0x13')](_0x5d2dc8)['then'](function(_0x295d0d){logger[_0x3552('0x14')](_0x3552('0x15'),_0xe94944,_0x5d2dc8['body']);_0x58385b['next']();})[_0x3552('0x16')](function(_0x3e90fc){logger[_0x3552('0x17')](_0x3552('0x15'),_0xe94944,JSON['stringify'](_0x3e90fc));_0x58385b[_0x3552('0x18')]();});}}catch(_0x268d39){logger[_0x3552('0x17')](_0x3552('0x15'),_0xe94944,JSON['stringify'](_0x268d39));_0x58385b[_0x3552('0x18')]();}};}; \ No newline at end of file +var _0x76ef=['create','then','info','[%s][MESSAGE]\x20%s','body','catch','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message'];(function(_0x456634,_0x436431){var _0x44a131=function(_0x48132){while(--_0x48132){_0x456634['push'](_0x456634['shift']());}};_0x44a131(++_0x436431);}(_0x76ef,0xb6));var _0xf76e=function(_0x609c9c,_0x5d5b75){_0x609c9c=_0x609c9c-0x0;var _0x41e86d=_0x76ef[_0x609c9c];return _0x41e86d;};'use strict';var _=require(_0xf76e('0x0'));var utils=require(_0xf76e('0x1'));var logger=require(_0xf76e('0x2'))(_0xf76e('0x3'));var rpc={'chatMessage':require(_0xf76e('0x4')),'openchannelMessage':require(_0xf76e('0x5')),'mailMessage':require(_0xf76e('0x6')),'smsMessage':require(_0xf76e('0x7')),'faxMessage':require(_0xf76e('0x8')),'whatsappMessage':require(_0xf76e('0x9'))};exports[_0xf76e('0xa')]=function(_0x5f170f,_0x2a8095){return function(_0x502094){try{var _0x4b0ffe={'body':utils[_0xf76e('0xb')](_0x2a8095[0x0],this),'ContactId':this[_0xf76e('0xc')]['id']};if(this[_0xf76e('0xd')]===_0xf76e('0xe')){_0x4b0ffe[_0xf76e('0xf')]=this[_0xf76e('0x10')]['id'];}else{_0x4b0ffe[_[_0xf76e('0x11')](this[_0xf76e('0xd')])+_0xf76e('0x12')]=this[_0xf76e('0x10')]['id'];}_0x4b0ffe[_['upperFirst'](this['channel'])+_0xf76e('0x13')]=this['interaction']['id'];if(rpc[this[_0xf76e('0xd')]+_0xf76e('0x14')]){return rpc[this[_0xf76e('0xd')]+'Message'][_0xf76e('0x15')](_0x4b0ffe)[_0xf76e('0x16')](function(_0x3e1999){logger[_0xf76e('0x17')](_0xf76e('0x18'),_0x5f170f,_0x4b0ffe[_0xf76e('0x19')]);_0x502094['next']();})[_0xf76e('0x1a')](function(_0xd0aea6){logger['error']('[%s][MESSAGE]\x20%s',_0x5f170f,JSON['stringify'](_0xd0aea6));_0x502094[_0xf76e('0x1b')]();});}}catch(_0x515ef9){logger[_0xf76e('0x1c')](_0xf76e('0x18'),_0x5f170f,JSON['stringify'](_0x515ef9));_0x502094[_0xf76e('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index baf348d..8d59403 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 _0x18c6=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','../../../../config/logger','consequence'];(function(_0x20d93a,_0x422a10){var _0x4e5cec=function(_0x56089c){while(--_0x56089c){_0x20d93a['push'](_0x20d93a['shift']());}};_0x4e5cec(++_0x422a10);}(_0x18c6,0x86));var _0x618c=function(_0x51b019,_0x3085c0){_0x51b019=_0x51b019-0x0;var _0x34d320=_0x18c6[_0x51b019];return _0x34d320;};'use strict';var utils=require('./utils');var logger=require(_0x618c('0x0'))('routing');exports[_0x618c('0x1')]=function(_0x23e4a6,_0x5a253e){return function(_0x13dfec){try{logger[_0x618c('0x2')](_0x618c('0x3'),_0x23e4a6,utils['getMustacheRender'](_0x5a253e[0x0],this));_0x13dfec[_0x618c('0x4')]();}catch(_0x3102cc){logger[_0x618c('0x5')](_0x618c('0x3'),_0x23e4a6,JSON[_0x618c('0x6')](_0x3102cc));_0x13dfec[_0x618c('0x7')]();}};}; \ No newline at end of file +var _0x7a72=['consequence','info','[%s][NOOP]\x20%s','next','stringify','stop','../../../../config/logger','routing'];(function(_0xfac3a3,_0x51ec20){var _0x4e40e4=function(_0x51023a){while(--_0x51023a){_0xfac3a3['push'](_0xfac3a3['shift']());}};_0x4e40e4(++_0x51ec20);}(_0x7a72,0xbe));var _0x27a7=function(_0x4e61ae,_0x39bf1d){_0x4e61ae=_0x4e61ae-0x0;var _0x57e831=_0x7a72[_0x4e61ae];return _0x57e831;};'use strict';var utils=require('./utils');var logger=require(_0x27a7('0x0'))(_0x27a7('0x1'));exports[_0x27a7('0x2')]=function(_0x334853,_0x131e77){return function(_0x2d901b){try{logger[_0x27a7('0x3')](_0x27a7('0x4'),_0x334853,utils['getMustacheRender'](_0x131e77[0x0],this));_0x2d901b[_0x27a7('0x5')]();}catch(_0x1eb478){logger['error'](_0x27a7('0x4'),_0x334853,JSON[_0x27a7('0x6')](_0x1eb478));_0x2d901b[_0x27a7('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e9f3658..9fdd702 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 _0x5367=['catch','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','update\x20queue\x20report','waiting','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','queue_id','push','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','string','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x4c9eff,_0x369f99){var _0xd53f88=function(_0x506a81){while(--_0x506a81){_0x4c9eff['push'](_0x4c9eff['shift']());}};_0xd53f88(++_0x369f99);}(_0x5367,0x6e));var _0x7536=function(_0x1498fb,_0x111d3b){_0x1498fb=_0x1498fb-0x0;var _0x59ad93=_0x5367[_0x1498fb];return _0x59ad93;};'use strict';var schema=require(_0x7536('0x0'));var _=require(_0x7536('0x1'));var util=require(_0x7536('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x7536('0x3'));var Redis=require(_0x7536('0x4'));var config=require(_0x7536('0x5'));var logger=require('../../../../config/logger')(_0x7536('0x6'));var strategy=require('./strategy');config[_0x7536('0x7')]=_[_0x7536('0x8')](config[_0x7536('0x7')],{'host':_0x7536('0x9'),'port':0x18eb});var io=require(_0x7536('0xa'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x7536('0xb'),_0x7536('0xc'),'from',_0x7536('0xd')];function emit(_0xd01b43,_0x431b5a,_0x1614af){io['to'](_0xd01b43)['emit'](_0x431b5a,_0x1614af);}function emitChannelQueueInteraction(_0x2fc2e6,_0x1858b7,_0x500d21,_0x452c74,_0x362c8a,_0xd9cd43,_0x501763,_0x15c4af){var _0x230d3f=_['clone'](_0x500d21);_0x230d3f[_0x7536('0xe')]=_0x15c4af;_0x230d3f[_0x7536('0xc')]=_0x1858b7;_0x230d3f[_0x7536('0xb')]=_0x452c74;_0x230d3f['id']=_0x362c8a;if(_0xd9cd43){attributes[_0x7536('0xf')](_['capitalize'](_0x2fc2e6)+'InteractionId');_0x501763[util[_0x7536('0x10')]('%sQueuesWaitingInteractions',_0x2fc2e6)][_0x362c8a]=_[_0x7536('0x11')](_0x230d3f,attributes);}else{delete _0x501763[util['format'](_0x7536('0x12'),_0x2fc2e6)][_0x362c8a];}emit(util[_0x7536('0x10')](_0x7536('0x13'),_0x2fc2e6,_0x1858b7),util[_0x7536('0x10')](_0x7536('0x14'),_0x2fc2e6,_0xd9cd43?_0x7536('0x15'):'remove'),_[_0x7536('0x11')](_0x230d3f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x7536('0x16')),'faxQueueReport':require(_0x7536('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x7536('0x18')),'faxInteraction':require(_0x7536('0x19')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x7536('0x1a')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x7536('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7536('0x1c'),'message':_0x7536('0x1d')}});function startRouting(_0x5334f2,_0x25877f,_0x599e72,_0x1a4527){if(_0x5334f2&&_0x25877f&&_0x599e72){_0x25877f['waiting']+=0x1;var _0x613153={'uniqueid':_0x5334f2,'from':_0x599e72[_0x7536('0x1e')]?_0x599e72[_0x7536('0x1e')][_0x7536('0x1f')]:'','joinAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'ContactId':_0x599e72['contact']?_0x599e72[_0x7536('0x21')]['id']:null,'ListId':_0x599e72[_0x7536('0x22')]?_0x599e72[_0x7536('0x22')]['id']:null};_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x25')]=_0x25877f['id']||null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x26')]=_0x599e72[_0x7536('0x27')]?_0x599e72['interaction']['id']:null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x28')]=_0x599e72['message']?_0x599e72[_0x7536('0x29')]['id']:null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+(_0x599e72['channel']!==_0x7536('0x2a')?_0x7536('0x2b'):'WebsiteId')]=_0x599e72[_0x7536('0xb')]?_0x599e72['account']['id']:null;logger[_0x7536('0x2c')](util[_0x7536('0x10')](_0x7536('0x2d'),_0x5334f2,_0x25877f[_0x7536('0x2e')]));emitChannelQueueInteraction(_0x599e72[_0x7536('0x24')],_0x25877f[_0x7536('0x2e')],_0x613153,_0x599e72[_0x7536('0xb')][_0x7536('0x2e')],_0x599e72[_0x7536('0x29')]['id'],!![],_0x1a4527,_0x25877f['id']);if(rpc[_0x599e72[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x599e72[_0x7536('0x24')]+_0x7536('0x2f')]['create'](_0x613153)[_0x7536('0x30')](function(_0x2c8193){logger['error']('create\x20queue\x20report',_0x2c8193);});}}}function stopRouting(_0x2febad,_0xac7082,_0x292343,_0x5ec6b9){if(_0x2febad&&_0xac7082){_0xac7082['waiting']-=0x1;var _0x2ef3a1={'leaveAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'acceptAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'reason':_0x7536('0x31')};logger[_0x7536('0x2c')](util['format'](_0x7536('0x32'),_0x2febad,_0xac7082['name']));emitChannelQueueInteraction(_0x292343[_0x7536('0x24')],_0xac7082['name'],_0x292343[_0x7536('0x1e')],_0x292343['account'][_0x7536('0x2e')],_0x292343[_0x7536('0x29')]['id'],![],_0x5ec6b9,_0xac7082['id']);return rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x33')]['update'](_0x292343[_0x7536('0x27')]['id'],{'queueId':_0xac7082['id']})['then'](function(){if(rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x2f')][_0x7536('0x34')](_0x2febad,_0x2ef3a1)['catch'](function(_0x5c5e8a){logger[_0x7536('0x35')](_0x7536('0x36'),_0x5c5e8a);});}});}}function endRouting(_0x26ecc5,_0x3923f2,_0x300735,_0x49c504){if(_0x26ecc5&&_0x3923f2){_0x3923f2[_0x7536('0x37')]-=0x1;var _0xcc6d62={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'reason':'timeout'};logger[_0x7536('0x2c')](util[_0x7536('0x10')](_0x7536('0x38'),_0x26ecc5,_0x3923f2[_0x7536('0x2e')]));emitChannelQueueInteraction(_0x300735[_0x7536('0x24')],_0x3923f2[_0x7536('0x2e')],_0x300735[_0x7536('0x1e')],_0x300735['account'][_0x7536('0x2e')],_0x300735['message']['id'],![],_0x49c504);if(rpc[_0x300735[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x300735[_0x7536('0x24')]+_0x7536('0x2f')][_0x7536('0x34')](_0x26ecc5,_0xcc6d62)[_0x7536('0x30')](function(_0x20bbdc){logger[_0x7536('0x35')]('update\x20queue\x20report',_0x20bbdc);});}}}function handleFindQueue(_0x275d26){return function(_0x2769b8){return _0x2769b8[_0x7536('0x2e')][_0x7536('0x39')]()===_0x275d26[_0x7536('0x39')]();};}exports[_0x7536('0x3a')]=function(_0x4597fb,_0x4714a3,_0x51fd38,_0x290359){return function(_0x33c5e0){try{var _0x56b43e={'name':_0x4714a3[0x0],'timeout':_0x4714a3[0x1]};var _0x46e7bf=queue['validate'](_0x56b43e,{'typecast':!![]});if(_0x46e7bf['length']){logger[_0x7536('0x35')](_0x7536('0x3b'),_0x4597fb,_[_0x7536('0x3c')](_0x46e7bf,_0x7536('0x29'))[_0x7536('0x3d')](',\x20'));_0x33c5e0[_0x7536('0x3e')]();}else{var _0xedf608=_[_0x7536('0x3f')](_0x51fd38[_0x290359[_0x7536('0x24')]+_0x7536('0x40')],handleFindQueue(_0x56b43e['name']));if(_0xedf608){startRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);var _0x136240=(_0xedf608['timeout']||0xa)*0x3e8;var _0x294756=(_0x56b43e[_0x7536('0x41')]||0x14)*0x3e8;var _0x2e526c;if(_0x136240>_0x294756){_0x294756=_0x136240;}var _0x2ebada=seqqueue[_0x7536('0x42')](_0x136240);_0x2ebada['id']=_0x4597fb;_0x2ebada[_0x7536('0x43')]=_0x136240;_0x2ebada[_0x7536('0x44')]=_0x294756;_0x2ebada[_0x7536('0x24')]=_0x290359[_0x7536('0x24')];_0x51fd38[_0x7536('0x45')][_0x4597fb]['on']('end',function(){logger[_0x7536('0x2c')](_0x7536('0x46'),_0x4597fb);stopRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);clearTimeout(_0x2e526c);_0x2e526c=undefined;_0x2ebada[_0x7536('0x47')](!![]);if(_0x51fd38[_0x7536('0x45')][_0x4597fb]){delete _0x51fd38[_0x7536('0x45')][_0x4597fb];}_0x33c5e0[_0x7536('0x3e')]();});_0x51fd38[_0x7536('0x45')][_0x4597fb]['on'](_0x7536('0x48'),function(){if(_0x51fd38['rules'][_0x4597fb]){delete _0x51fd38['rules'][_0x4597fb];}});_0x2e526c=setTimeout(function(){logger[_0x7536('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4597fb);endRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);clearTimeout(_0x2e526c);_0x2ebada[_0x7536('0x47')](!![]);_0x33c5e0[_0x7536('0x49')]();},_0x294756);switch(_0xedf608[_0x7536('0x4a')]){case'rrmemory':strategy[_0x7536('0x4b')](_0x2ebada,_0xedf608,_0x51fd38,_0x290359);break;default:strategy[_0x7536('0x4c')](_0x2ebada,_0xedf608,_0x51fd38,_0x290359);}}else{logger['error'](_0x7536('0x4d'),_0x4597fb,_0x56b43e[_0x7536('0x2e')]);_0x33c5e0[_0x7536('0x3e')]();}}}catch(_0x37222d){logger[_0x7536('0x35')](_0x7536('0x3b'),_0x4597fb,_0x37222d[_0x7536('0x4e')]);_0x33c5e0['stop']();}};}; \ No newline at end of file +var _0x7990=['%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','redis','localhost','queue_id','queue','from','joinAt','emit','clone','format','pick','%s:queue:%s'];(function(_0x49a5d2,_0x3946b9){var _0x174e56=function(_0x3247d9){while(--_0x3247d9){_0x49a5d2['push'](_0x49a5d2['shift']());}};_0x174e56(++_0x3946b9);}(_0x7990,0xe3));var _0x0799=function(_0x3deef7,_0x497511){_0x3deef7=_0x3deef7-0x0;var _0x26f330=_0x7990[_0x3deef7];return _0x26f330;};'use strict';var schema=require(_0x0799('0x0'));var _=require(_0x0799('0x1'));var util=require(_0x0799('0x2'));var seqqueue=require(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var Redis=require(_0x0799('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0799('0x6'))('routing');var strategy=require(_0x0799('0x7'));config[_0x0799('0x8')]=_['defaults'](config[_0x0799('0x8')],{'host':_0x0799('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0799('0x8')]));var attributes=['id',_0x0799('0xa'),'account',_0x0799('0xb'),_0x0799('0xc'),_0x0799('0xd')];function emit(_0x36f15d,_0x3bd304,_0x49b45a){io['to'](_0x36f15d)[_0x0799('0xe')](_0x3bd304,_0x49b45a);}function emitChannelQueueInteraction(_0x1d98cd,_0x329685,_0x544560,_0x82cf61,_0x19e547,_0x3b394c,_0x16ed6a,_0x429c50){var _0x4a6383=_[_0x0799('0xf')](_0x544560);_0x4a6383[_0x0799('0xa')]=_0x429c50;_0x4a6383['queue']=_0x329685;_0x4a6383['account']=_0x82cf61;_0x4a6383['id']=_0x19e547;if(_0x3b394c){attributes['push'](_['capitalize'](_0x1d98cd)+'InteractionId');_0x16ed6a[util[_0x0799('0x10')]('%sQueuesWaitingInteractions',_0x1d98cd)][_0x19e547]=_[_0x0799('0x11')](_0x4a6383,attributes);}else{delete _0x16ed6a[util[_0x0799('0x10')]('%sQueuesWaitingInteractions',_0x1d98cd)][_0x19e547];}emit(util[_0x0799('0x10')](_0x0799('0x12'),_0x1d98cd,_0x329685),util[_0x0799('0x10')](_0x0799('0x13'),_0x1d98cd,_0x3b394c?_0x0799('0x14'):_0x0799('0x15')),_['pick'](_0x4a6383,attributes));}var rpc={'openchannelQueueReport':require(_0x0799('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x0799('0x17')),'smsQueueReport':require(_0x0799('0x18')),'faxQueueReport':require(_0x0799('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0799('0x1a')),'faxInteraction':require(_0x0799('0x1b')),'mailInteraction':require(_0x0799('0x1c')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0799('0x1d')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x0799('0x1e'),'required':!![],'message':_0x0799('0x1f')},'timeout':{'type':'number','message':_0x0799('0x20')}});function startRouting(_0x42c540,_0x2920c3,_0x23287c,_0x33fbe5){if(_0x42c540&&_0x2920c3&&_0x23287c){_0x2920c3[_0x0799('0x21')]+=0x1;var _0x236b49={'uniqueid':_0x42c540,'from':_0x23287c['body']?_0x23287c[_0x0799('0x22')][_0x0799('0xc')]:'','joinAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'ContactId':_0x23287c[_0x0799('0x24')]?_0x23287c[_0x0799('0x24')]['id']:null,'ListId':_0x23287c['list']?_0x23287c[_0x0799('0x25')]['id']:null};_0x236b49[_[_0x0799('0x26')](_0x23287c[_0x0799('0x27')])+_0x0799('0x28')]=_0x2920c3['id']||null;_0x236b49[_[_0x0799('0x26')](_0x23287c[_0x0799('0x27')])+'InteractionId']=_0x23287c[_0x0799('0x29')]?_0x23287c[_0x0799('0x29')]['id']:null;_0x236b49[_['upperFirst'](_0x23287c[_0x0799('0x27')])+_0x0799('0x2a')]=_0x23287c['message']?_0x23287c[_0x0799('0x2b')]['id']:null;_0x236b49[_['upperFirst'](_0x23287c['channel'])+(_0x23287c[_0x0799('0x27')]!=='chat'?_0x0799('0x2c'):_0x0799('0x2d'))]=_0x23287c['account']?_0x23287c[_0x0799('0x2e')]['id']:null;logger[_0x0799('0x2f')](util['format'](_0x0799('0x30'),_0x42c540,_0x2920c3[_0x0799('0x31')]));emitChannelQueueInteraction(_0x23287c['channel'],_0x2920c3['name'],_0x236b49,_0x23287c['account'][_0x0799('0x31')],_0x23287c[_0x0799('0x2b')]['id'],!![],_0x33fbe5,_0x2920c3['id']);if(rpc[_0x23287c['channel']+_0x0799('0x32')]){return rpc[_0x23287c[_0x0799('0x27')]+_0x0799('0x32')][_0x0799('0x33')](_0x236b49)[_0x0799('0x34')](function(_0x2ace80){logger[_0x0799('0x35')](_0x0799('0x36'),_0x2ace80);});}}}function stopRouting(_0x1d3fe0,_0x298b1,_0x4e1aed,_0x309f90){if(_0x1d3fe0&&_0x298b1){_0x298b1[_0x0799('0x21')]-=0x1;var _0x2c0461={'leaveAt':moment()['format'](_0x0799('0x23')),'acceptAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'reason':_0x0799('0x37')};logger[_0x0799('0x2f')](util[_0x0799('0x10')](_0x0799('0x38'),_0x1d3fe0,_0x298b1[_0x0799('0x31')]));emitChannelQueueInteraction(_0x4e1aed[_0x0799('0x27')],_0x298b1[_0x0799('0x31')],_0x4e1aed[_0x0799('0x22')],_0x4e1aed[_0x0799('0x2e')][_0x0799('0x31')],_0x4e1aed['message']['id'],![],_0x309f90,_0x298b1['id']);return rpc[_0x4e1aed['channel']+_0x0799('0x39')][_0x0799('0x3a')](_0x4e1aed[_0x0799('0x29')]['id'],{'queueId':_0x298b1['id']})[_0x0799('0x3b')](function(){if(rpc[_0x4e1aed[_0x0799('0x27')]+_0x0799('0x32')]){return rpc[_0x4e1aed[_0x0799('0x27')]+'QueueReport']['update'](_0x1d3fe0,_0x2c0461)[_0x0799('0x34')](function(_0x4edec5){logger[_0x0799('0x35')](_0x0799('0x3c'),_0x4edec5);});}});}}function endRouting(_0x483bf9,_0x7b7438,_0x5a612a,_0x358d66){if(_0x483bf9&&_0x7b7438){_0x7b7438['waiting']-=0x1;var _0x4d1dd6={'leaveAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'exitAt':moment()[_0x0799('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0799('0x2f')](util[_0x0799('0x10')](_0x0799('0x3d'),_0x483bf9,_0x7b7438[_0x0799('0x31')]));emitChannelQueueInteraction(_0x5a612a[_0x0799('0x27')],_0x7b7438[_0x0799('0x31')],_0x5a612a[_0x0799('0x22')],_0x5a612a['account'][_0x0799('0x31')],_0x5a612a[_0x0799('0x2b')]['id'],![],_0x358d66);if(rpc[_0x5a612a[_0x0799('0x27')]+_0x0799('0x32')]){return rpc[_0x5a612a[_0x0799('0x27')]+_0x0799('0x32')][_0x0799('0x3a')](_0x483bf9,_0x4d1dd6)[_0x0799('0x34')](function(_0x17e7ab){logger[_0x0799('0x35')](_0x0799('0x3c'),_0x17e7ab);});}}}function handleFindQueue(_0x689184){return function(_0x336cee){return _0x336cee[_0x0799('0x31')][_0x0799('0x3e')]()===_0x689184[_0x0799('0x3e')]();};}exports[_0x0799('0x3f')]=function(_0x1a7b89,_0x21ca70,_0x46347f,_0x3dcc5c){return function(_0x47da02){try{var _0x40af1a={'name':_0x21ca70[0x0],'timeout':_0x21ca70[0x1]};var _0x4fc621=queue['validate'](_0x40af1a,{'typecast':!![]});if(_0x4fc621['length']){logger[_0x0799('0x35')](_0x0799('0x40'),_0x1a7b89,_[_0x0799('0x41')](_0x4fc621,_0x0799('0x2b'))[_0x0799('0x42')](',\x20'));_0x47da02[_0x0799('0x43')]();}else{var _0x2e458b=_[_0x0799('0x44')](_0x46347f[_0x3dcc5c[_0x0799('0x27')]+'Queues'],handleFindQueue(_0x40af1a['name']));if(_0x2e458b){startRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);var _0x2d3346=(_0x2e458b[_0x0799('0x45')]||0xa)*0x3e8;var _0xee3449=(_0x40af1a[_0x0799('0x45')]||0x14)*0x3e8;var _0x1e4549;if(_0x2d3346>_0xee3449){_0xee3449=_0x2d3346;}var _0x3d615e=seqqueue[_0x0799('0x46')](_0x2d3346);_0x3d615e['id']=_0x1a7b89;_0x3d615e[_0x0799('0x47')]=_0x2d3346;_0x3d615e['qtimeout']=_0xee3449;_0x3d615e[_0x0799('0x27')]=_0x3dcc5c['channel'];_0x46347f['rules'][_0x1a7b89]['on'](_0x0799('0x48'),function(){logger[_0x0799('0x2f')](_0x0799('0x49'),_0x1a7b89);stopRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);clearTimeout(_0x1e4549);_0x1e4549=undefined;_0x3d615e[_0x0799('0x4a')](!![]);if(_0x46347f[_0x0799('0x4b')][_0x1a7b89]){delete _0x46347f[_0x0799('0x4b')][_0x1a7b89];}_0x47da02[_0x0799('0x43')]();});_0x46347f[_0x0799('0x4b')][_0x1a7b89]['on'](_0x0799('0x4c'),function(){if(_0x46347f[_0x0799('0x4b')][_0x1a7b89]){delete _0x46347f['rules'][_0x1a7b89];}});_0x1e4549=setTimeout(function(){logger['info'](_0x0799('0x4d'),_0x1a7b89);endRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);clearTimeout(_0x1e4549);_0x3d615e[_0x0799('0x4a')](!![]);_0x47da02['next']();},_0xee3449);switch(_0x2e458b['strategy']){case _0x0799('0x4e'):strategy[_0x0799('0x4e')](_0x3d615e,_0x2e458b,_0x46347f,_0x3dcc5c);break;default:strategy[_0x0799('0x4f')](_0x3d615e,_0x2e458b,_0x46347f,_0x3dcc5c);}}else{logger['error'](_0x0799('0x50'),_0x1a7b89,_0x40af1a[_0x0799('0x31')]);_0x47da02['stop']();}}}catch(_0x162d89){logger[_0x0799('0x35')](_0x0799('0x40'),_0x1a7b89,_0x162d89[_0x0799('0x51')]);_0x47da02['stop']();}};}; \ 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 ed2c840..841690f 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 _0x6aa7=['STOP','exports','lodash','./util','../../../../../config/logger','routing','notificationId','realtime','squeue','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6aa7,0x178));var _0x76aa=function(_0x4bc55b,_0x4c8698){_0x4bc55b=_0x4bc55b-0x0;var _0x132f8f=_0x6aa7[_0x4bc55b];return _0x132f8f;};'use strict';var _=require(_0x76aa('0x0'));var uuid=require('uuid');var util=require(_0x76aa('0x1'));var logger=require(_0x76aa('0x2'))(_0x76aa('0x3'));var Agent=function(_0x2db4fe,_0x4f007e,_0x13f62b,_0xef15ef){this[_0x76aa('0x4')]=uuid['v4']();this['squeue']=_0x2db4fe;this['agent']=_0x4f007e;this[_0x76aa('0x5')]=_0x13f62b;this['routing']=_0xef15ef;this[_0x76aa('0x6')][_0x76aa('0x7')](this[_0x76aa('0x8')]['bind'](this),this[_0x76aa('0x9')][_0x76aa('0xa')](this));this[_0x76aa('0x6')]['on']('timeout',this[_0x76aa('0x9')][_0x76aa('0xa')](this));this[_0x76aa('0x6')]['on'](_0x76aa('0xb'),this[_0x76aa('0xc')][_0x76aa('0xa')](this));};Agent[_0x76aa('0xd')][_0x76aa('0x7')]=function(){this[_0x76aa('0x6')][_0x76aa('0x7')](this['handleRun'][_0x76aa('0xa')](this),this['handleTimeout'][_0x76aa('0xa')](this));};Agent[_0x76aa('0xd')][_0x76aa('0xc')]=function(){this[_0x76aa('0x9')](!![]);};Agent[_0x76aa('0xd')]['handleRun']=function(){logger['debug'](_0x76aa('0xe'),this['squeue']['id'],this[_0x76aa('0xf')]['id']);if(_[_0x76aa('0x10')](this['realtime'][_0x76aa('0x11')][this['agent']['id']])){logger[_0x76aa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x76aa('0x6')]['id'],this[_0x76aa('0xf')]['id']);setTimeout(this[_0x76aa('0x7')][_0x76aa('0xa')](this),0x3e8);}else{if(this[_0x76aa('0x3')][_0x76aa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],this[_0x76aa('0x6')][_0x76aa('0x14')],![])){this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']][_0x76aa('0x15')]=!![];this['realtime'][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']][_0x76aa('0x16')]=undefined;util['saveWaitingNotification'](this[_0x76aa('0x5')],this[_0x76aa('0x3')],this[_0x76aa('0xf')],this[_0x76aa('0x6')][_0x76aa('0x14')]);util[_0x76aa('0x17')](this[_0x76aa('0x4')],this[_0x76aa('0x6')]['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],null,this[_0x76aa('0x3')]);util[_0x76aa('0x18')](this['squeue']['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],_0x76aa('0x19')+(this[_0x76aa('0x3')][_0x76aa('0x13')]?_0x76aa('0x1a'):''));}else{logger[_0x76aa('0x12')](_0x76aa('0x1b'),this[_0x76aa('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x76aa('0x7')]['bind'](this),0x3e8);}}};Agent[_0x76aa('0xd')][_0x76aa('0x9')]=function(_0x2dec94){if(_[_0x76aa('0x10')](this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']])){return logger[_0x76aa('0x12')](_0x76aa('0x1c'),this[_0x76aa('0x6')]['id'],this['agent']['id']);}else{logger[_0x76aa('0x12')](_0x76aa('0x1d'),this[_0x76aa('0x6')]['id'],this[_0x76aa('0xf')]['id']);util[_0x76aa('0x1e')](this[_0x76aa('0x4')],this[_0x76aa('0x6')]['id'],this['realtime'][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],null,this['routing']);this[_0x76aa('0x5')]['agents'][this[_0x76aa('0xf')]['id']]['busy']=![];this[_0x76aa('0x5')]['agents'][this['agent']['id']][_0x76aa('0x16')]=undefined;util[_0x76aa('0x1f')](this[_0x76aa('0x5')],this[_0x76aa('0x3')],this['agent'],this['squeue'][_0x76aa('0x14')]);util[_0x76aa('0x18')](this[_0x76aa('0x6')]['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this['agent']['id']],_0x2dec94?_0x76aa('0x20'):'TIMEOUT');}if(!_0x2dec94){setTimeout(this['push'][_0x76aa('0xa')](this),0x3e8);}};function agent(_0x36d64e,_0x181216,_0x127bc4,_0x48cf51){return new Agent(_0x36d64e,_0x181216,_0x127bc4,_0x48cf51);}module[_0x76aa('0x21')]=agent; \ No newline at end of file +var _0xeec6=['timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','channel','busy','saveWaitingNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout'];(function(_0x564850,_0x229976){var _0x5b257a=function(_0x4de50c){while(--_0x4de50c){_0x564850['push'](_0x564850['shift']());}};_0x5b257a(++_0x229976);}(_0xeec6,0x1c2));var _0x6eec=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeec6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6eec('0x0'));var uuid=require(_0x6eec('0x1'));var util=require(_0x6eec('0x2'));var logger=require(_0x6eec('0x3'))('routing');var Agent=function(_0x471d43,_0x3e4f10,_0x1699ce,_0x2d7a15){this[_0x6eec('0x4')]=uuid['v4']();this[_0x6eec('0x5')]=_0x471d43;this['agent']=_0x3e4f10;this[_0x6eec('0x6')]=_0x1699ce;this[_0x6eec('0x7')]=_0x2d7a15;this['squeue'][_0x6eec('0x8')](this[_0x6eec('0x9')][_0x6eec('0xa')](this),this[_0x6eec('0xb')]['bind'](this));this[_0x6eec('0x5')]['on'](_0x6eec('0xc'),this[_0x6eec('0xb')]['bind'](this));this['squeue']['on']('drained',this[_0x6eec('0xd')][_0x6eec('0xa')](this));};Agent['prototype']['push']=function(){this[_0x6eec('0x5')]['push'](this[_0x6eec('0x9')][_0x6eec('0xa')](this),this[_0x6eec('0xb')][_0x6eec('0xa')](this));};Agent[_0x6eec('0xe')]['handleDrained']=function(){this[_0x6eec('0xb')](!![]);};Agent[_0x6eec('0xe')][_0x6eec('0x9')]=function(){logger[_0x6eec('0xf')](_0x6eec('0x10'),this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);if(_[_0x6eec('0x12')](this[_0x6eec('0x6')][_0x6eec('0x13')][this['agent']['id']])){logger[_0x6eec('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);setTimeout(this['push'][_0x6eec('0xa')](this),0x3e8);}else{if(this[_0x6eec('0x7')][_0x6eec('0x14')]||util['isAgentAvailable'](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],this[_0x6eec('0x5')][_0x6eec('0x15')],![])){this['realtime'][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x16')]=!![];this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']]['busyQueue']=undefined;util[_0x6eec('0x17')](this[_0x6eec('0x6')],this[_0x6eec('0x7')],this[_0x6eec('0x11')],this[_0x6eec('0x5')][_0x6eec('0x15')]);util['showNotification'](this[_0x6eec('0x4')],this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],null,this[_0x6eec('0x7')]);util[_0x6eec('0x18')](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')]['agents'][this[_0x6eec('0x11')]['id']],_0x6eec('0x19')+(this[_0x6eec('0x7')][_0x6eec('0x14')]?':FORCED':''));}else{logger[_0x6eec('0xf')](_0x6eec('0x1a'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x6eec('0x8')]['bind'](this),0x3e8);}}};Agent[_0x6eec('0xe')][_0x6eec('0xb')]=function(_0x3bbdf8){if(_[_0x6eec('0x12')](this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']])){return logger[_0x6eec('0xf')](_0x6eec('0x1b'),this[_0x6eec('0x5')]['id'],this['agent']['id']);}else{logger[_0x6eec('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);util[_0x6eec('0x1c')](this['notificationId'],this['squeue']['id'],this['realtime'][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],null,this[_0x6eec('0x7')]);this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x16')]=![];this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x1d')]=undefined;util[_0x6eec('0x1e')](this['realtime'],this[_0x6eec('0x7')],this[_0x6eec('0x11')],this[_0x6eec('0x5')]['channel']);util[_0x6eec('0x18')](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],_0x3bbdf8?_0x6eec('0x1f'):'TIMEOUT');}if(!_0x3bbdf8){setTimeout(this[_0x6eec('0x8')][_0x6eec('0xa')](this),0x3e8);}};function agent(_0x2f18e9,_0x5128ac,_0x53acd9,_0x28e5fa){return new Agent(_0x2f18e9,_0x5128ac,_0x53acd9,_0x28e5fa);}module[_0x6eec('0x20')]=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 f1001b7..a6078fd 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 _0x202a=['removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','squeue','realtime','routing','push','handleRun','bind','handleTimeout','timeout','prototype','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','name','notificationId','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT'];(function(_0x167854,_0x572990){var _0x2b504c=function(_0x5d0426){while(--_0x5d0426){_0x167854['push'](_0x167854['shift']());}};_0x2b504c(++_0x572990);}(_0x202a,0x12b));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa202('0x0'));var uuid=require(_0xa202('0x1'));var util=require(_0xa202('0x2'));var logger=require(_0xa202('0x3'))('routing');var Beepall=function(_0x24b7a6,_0x1f13cf,_0x5e3bc9,_0x1808af){this['notificationId']=uuid['v4']();this[_0xa202('0x4')]=_0x24b7a6;this['queue']=_0x1f13cf;this[_0xa202('0x5')]=_0x5e3bc9;this[_0xa202('0x6')]=_0x1808af;this[_0xa202('0x4')][_0xa202('0x7')](this[_0xa202('0x8')][_0xa202('0x9')](this),this[_0xa202('0xa')][_0xa202('0x9')](this));this[_0xa202('0x4')]['on'](_0xa202('0xb'),this['handleTimeout'][_0xa202('0x9')](this));this[_0xa202('0x4')]['on']('drained',this['handleDrained'][_0xa202('0x9')](this));};Beepall['prototype'][_0xa202('0x7')]=function(){this[_0xa202('0x4')][_0xa202('0x7')](this[_0xa202('0x8')][_0xa202('0x9')](this),this[_0xa202('0xa')][_0xa202('0x9')](this));};Beepall['prototype']['handleDrained']=function(){this[_0xa202('0xa')](!![]);};Beepall[_0xa202('0xc')][_0xa202('0x8')]=function(){var _0x350f4d=!![];if(!_[_0xa202('0xd')](this[_0xa202('0xe')])&&!_[_0xa202('0xd')](this[_0xa202('0xe')][_0xa202('0xf')])&&this[_0xa202('0xe')][_0xa202('0xf')][_0xa202('0x10')]>0x0){for(var _0x55d711=0x0,_0x931a39;_0x55d7110x0){for(var _0x3018e7=0x0,_0x5c73a2;_0x3018e70x0&&_0x30b4c6[_0x10490b+_0x8989('0x21')]>=_0x30b4c6[_0x10490b+'Capacity']){writeLog(_0x3f289b,_0x30b4c6,_0x10490b[_0x8989('0x22')]()+_0x8989('0x23'));return![];}}return!![];};exports[_0x8989('0x24')]=function(_0x57ee0d,_0x3dadfd,_0x5b69a0,_0xf015cb,_0x3d9250){return sendNotification(!![],_0x57ee0d,_0x3dadfd,_0x5b69a0,_0xf015cb,_0x3d9250);};exports[_0x8989('0x25')]=function(_0x22f53e,_0xedb227,_0x345af4,_0x183b46,_0x58a04d){return sendNotification(![],_0x22f53e,_0xedb227,_0x345af4,_0x183b46,_0x58a04d);};exports[_0x8989('0x26')]=function(_0xf1498f,_0x33d406,_0x55ffaa){var _0x528e80=_0x33d406[_0x8989('0x27')][_0x8989('0x28')];if(!_0x528e80&&_0x55ffaa){_0x528e80=_0x55ffaa['id'];}var _0x694ce3=_[_0x8989('0x29')](_0xf1498f[_0x33d406[_0x8989('0x2a')]+_0x8989('0x2b')],function(_0x56308b){var _0x4ba39e=_[_0x8989('0x2c')](_0x33d406[_0x8989('0x2a')])+_0x8989('0x2d');return _0x56308b[_0x4ba39e]===_0x33d406[_0x8989('0x27')]['id'];});if(!_0x694ce3&&_0x528e80&&_0xf1498f[_0x8989('0x2e')][_0x528e80]){_0x694ce3=_[_0x8989('0x29')](_0xf1498f[_0x8989('0x2e')][_0x528e80][_0x33d406[_0x8989('0x2a')]+_0x8989('0x2f')],function(_0x85ef7){return _0x85ef7['id']===_0x33d406[_0x8989('0x27')]['id'];});}return _0x694ce3;};exports[_0x8989('0x30')]=function(_0x2dcf57,_0x4a39f3,_0x433231,_0x5aa92f){if(_0x433231&&_0x433231['id']&&_0x2dcf57[_0x8989('0x2e')]&&_0x2dcf57['agents'][_0x433231['id']]){_0x2dcf57[_0x8989('0x2e')][_0x433231['id']][_0x5aa92f+_0x8989('0x2f')][_0x4a39f3[_0x8989('0x31')]['id']]={'id':_0x4a39f3[_0x8989('0x27')]['id']};}};exports['removeWaitingNotification']=function(_0x1560f0,_0x30bd40,_0x576069,_0x2d1313){if(_0x576069&&_0x576069['id']&&_0x1560f0[_0x8989('0x2e')]&&_0x1560f0[_0x8989('0x2e')][_0x576069['id']]){delete _0x1560f0[_0x8989('0x2e')][_0x576069['id']][_0x2d1313+_0x8989('0x2f')][_0x30bd40['message']['id']];}};exports[_0x8989('0x32')]=writeLog; \ No newline at end of file +var _0x65da=['body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','name','emit','format','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','UserId','some','QueuesWaitingInteractions','InteractionId','interaction','channel','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','split','account','notificationSound','notificationShake'];(function(_0x15f724,_0x2794ef){var _0x49b152=function(_0x561b35){while(--_0x561b35){_0x15f724['push'](_0x15f724['shift']());}};_0x49b152(++_0x2794ef);}(_0x65da,0x152));var _0xa65d=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x65da[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xa65d('0x0'));var util=require('util');var utils=require(_0xa65d('0x1'));var Redis=require(_0xa65d('0x2'));var config=require(_0xa65d('0x3'));var logger=require('../../../../../config/logger')(_0xa65d('0x4'));config[_0xa65d('0x5')]=_[_0xa65d('0x6')](config[_0xa65d('0x5')],{'host':_0xa65d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x9f0298,_0x372107,_0x36afc3,_0x461d40,_0x1631de,_0x13ed40){var _0x26110e=_0x13ed40||{};var _0x537529=_0x36afc3[_0xa65d('0x8')]('.');var _0x310409={'uniqueid':_0x372107,'channel':_0x537529[0x0],'id':_0x537529[0x1],'title':_0x537529[0x0]+'\x20interaction','interactionId':_0x537529[0x2],'queue':_0x1631de?_0x1631de['name']:null,'sound':_0x26110e[_0xa65d('0x9')][_0xa65d('0xa')],'shake':_0x26110e[_0xa65d('0x9')][_0xa65d('0xb')]};try{if(!_0x26110e['body']){_0x26110e[_0xa65d('0xc')]={};}if(_0x1631de){_0x26110e[_0xa65d('0xc')][_0xa65d('0xd')]=_0x1631de;}else if(_0x26110e[_0xa65d('0xc')][_0xa65d('0xd')]){delete _0x26110e[_0xa65d('0xc')]['queue'];}_0x310409[_0xa65d('0xe')]=utils[_0xa65d('0xf')](_0x26110e['account'][_0xa65d('0x10')],_0x26110e);}catch(_0x4a279d){_0x310409[_0xa65d('0xe')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xa65d('0x11')](util['format'](_0xa65d('0x12'),_0x372107,_0x4a279d[_0xa65d('0x13')]));}io['to'](util['format']('user:%s',_0x461d40[_0xa65d('0x14')]))[_0xa65d('0x15')](util[_0xa65d('0x16')](_0xa65d('0x17'),_0x9f0298?_0xa65d('0x18'):_0xa65d('0x19')),_0x310409);}function writeLog(_0x4127bb,_0x4cd6ce,_0x43efa4){return logger[_0xa65d('0x1a')](util['format'](_0xa65d('0x1b'),_0x4127bb,_0x4cd6ce[_0xa65d('0x14')],_0x43efa4));}exports[_0xa65d('0x1c')]=function(_0x167ed3,_0x3fa937,_0x1686dd,_0x385844){if(_0x3fa937[_0xa65d('0x1d')]){writeLog(_0x167ed3,_0x3fa937,'BUSY');return![];}if(!_0x3fa937['online']){writeLog(_0x167ed3,_0x3fa937,_0xa65d('0x1e'));return![];}if(_0x3fa937[_0x1686dd+'Pause']){writeLog(_0x167ed3,_0x3fa937,_0xa65d('0x1f'));return![];}if(_0x385844&&_0x3fa937[_0xa65d('0x20')](_0x1686dd+_0xa65d('0x21'))&&_0x3fa937[_0xa65d('0x20')](_0x1686dd+_0xa65d('0x22'))){if(_0x3fa937[_0x1686dd+_0xa65d('0x21')]>0x0&&_0x3fa937[_0x1686dd+'CurrentCapacity']>=_0x3fa937[_0x1686dd+_0xa65d('0x21')]){writeLog(_0x167ed3,_0x3fa937,_0x1686dd[_0xa65d('0x23')]()+_0xa65d('0x24'));return![];}}return!![];};exports[_0xa65d('0x25')]=function(_0x28d92b,_0x563597,_0x36db19,_0x27e6a2,_0x314871){return sendNotification(!![],_0x28d92b,_0x563597,_0x36db19,_0x27e6a2,_0x314871);};exports['hideNotification']=function(_0x5874a6,_0x42dece,_0x9b1557,_0x53175f,_0x101177){return sendNotification(![],_0x5874a6,_0x42dece,_0x9b1557,_0x53175f,_0x101177);};exports[_0xa65d('0x26')]=function(_0x40c1a5,_0x579efe,_0xc48136){var _0x369239=_0x579efe['interaction'][_0xa65d('0x27')];if(!_0x369239&&_0xc48136){_0x369239=_0xc48136['id'];}var _0x32f2df=_[_0xa65d('0x28')](_0x40c1a5[_0x579efe['channel']+_0xa65d('0x29')],function(_0x380bb9){var _0x5c74e0=_['capitalize'](_0x579efe['channel'])+_0xa65d('0x2a');return _0x380bb9[_0x5c74e0]===_0x579efe[_0xa65d('0x2b')]['id'];});if(!_0x32f2df&&_0x369239&&_0x40c1a5['agents'][_0x369239]){_0x32f2df=_['some'](_0x40c1a5['agents'][_0x369239][_0x579efe[_0xa65d('0x2c')]+_0xa65d('0x2d')],function(_0x281417){return _0x281417['id']===_0x579efe[_0xa65d('0x2b')]['id'];});}return _0x32f2df;};exports[_0xa65d('0x2e')]=function(_0x4dbff5,_0x56cf67,_0x50ee17,_0x57a210){if(_0x50ee17&&_0x50ee17['id']&&_0x4dbff5[_0xa65d('0x2f')]&&_0x4dbff5[_0xa65d('0x2f')][_0x50ee17['id']]){_0x4dbff5['agents'][_0x50ee17['id']][_0x57a210+_0xa65d('0x2d')][_0x56cf67[_0xa65d('0x13')]['id']]={'id':_0x56cf67[_0xa65d('0x2b')]['id']};}};exports[_0xa65d('0x30')]=function(_0x419119,_0x2ed60e,_0x2e160e,_0x55bebc){if(_0x2e160e&&_0x2e160e['id']&&_0x419119[_0xa65d('0x2f')]&&_0x419119[_0xa65d('0x2f')][_0x2e160e['id']]){delete _0x419119['agents'][_0x2e160e['id']][_0x55bebc+_0xa65d('0x2d')][_0x2ed60e[_0xa65d('0x13')]['id']];}};exports[_0xa65d('0x31')]=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 30bddf5..fbc6ec7 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 _0x04de=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x536b05,_0x4faea9){var _0x34319e=function(_0x4c23c2){while(--_0x4c23c2){_0x536b05['push'](_0x536b05['shift']());}};_0x34319e(++_0x4faea9);}(_0x04de,0x107));var _0xe04d=function(_0x13771a,_0x56c7ee){_0x13771a=_0x13771a-0x0;var _0x30cf6c=_0x04de[_0x13771a];return _0x30cf6c;};'use strict';var schema=require(_0xe04d('0x0'));var sh=require(_0xe04d('0x1'));var _=require(_0xe04d('0x2'));var utils=require(_0xe04d('0x3'));var logger=require(_0xe04d('0x4'))(_0xe04d('0x5'));var system=schema({'command':{'type':_0xe04d('0x6'),'required':!![],'message':_0xe04d('0x7')}});exports[_0xe04d('0x8')]=function(_0x70ead0,_0x3a0e3b){return function(_0x4804c8){try{var _0x4bb925={'command':_0x3a0e3b[0x0]};var _0x4f7637=system['validate'](_0x4bb925,{'typecast':!![]});if(_0x4f7637[_0xe04d('0x9')]){logger[_0xe04d('0xa')](_0xe04d('0xb'),_0x70ead0,_[_0xe04d('0xc')](_0x4f7637,_0xe04d('0xd'))[_0xe04d('0xe')](',\x20'));logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x70ead0);_0x4804c8['next']();}else{var _0x160d4f=this;var _0x21c91c=utils[_0xe04d('0x11')](_0x3a0e3b[0x0],this);logger[_0xe04d('0xf')](_0xe04d('0x12'),_0x70ead0,_0x21c91c);sh[_0xe04d('0x13')](_[_0xe04d('0x14')](_0x21c91c),function(_0xec9f3a,_0x3ccdc8){logger['info'](_0xe04d('0x15'),_0x70ead0,_0xec9f3a);if(_0xec9f3a==0x0){var _0x1d3f03=_0x3ccdc8[_0xe04d('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0xe04d('0x17')](_0x3a0e3b[0x1])||_[_0xe04d('0x18')](_0x3a0e3b[0x1])){logger[_0xe04d('0xf')](_0xe04d('0x19'),_0x70ead0);_0x160d4f[_0xe04d('0x1a')][_0x3a0e3b[0x1]]=_0x1d3f03;}else{logger[_0xe04d('0xf')](_0xe04d('0x1b'),_0x70ead0,_0x3a0e3b[0x1],_0x1d3f03);_0x160d4f[_0xe04d('0x1a')][_0x3a0e3b[0x1]]=_0x1d3f03;}}_0x4804c8[_0xe04d('0x1c')]();});}}catch(_0x5cfd5b){logger[_0xe04d('0xa')]('[%s][SYSTEM]\x20%s',_0x70ead0,_[_0xe04d('0x1d')](_0x5cfd5b)?JSON['stringify'](_0x5cfd5b):_0x5cfd5b);logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x70ead0);_0x4804c8[_0xe04d('0x1c')]();}};}; \ No newline at end of file +var _0x27bf=['length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x5b70cb,_0x3ca39f){var _0x2c3412=function(_0x2c99b8){while(--_0x2c99b8){_0x5b70cb['push'](_0x5b70cb['shift']());}};_0x2c3412(++_0x3ca39f);}(_0x27bf,0x117));var _0xf27b=function(_0x25f916,_0x73fc4c){_0x25f916=_0x25f916-0x0;var _0x1a2c3b=_0x27bf[_0x25f916];return _0x1a2c3b;};'use strict';var schema=require(_0xf27b('0x0'));var sh=require(_0xf27b('0x1'));var _=require(_0xf27b('0x2'));var utils=require(_0xf27b('0x3'));var logger=require(_0xf27b('0x4'))(_0xf27b('0x5'));var system=schema({'command':{'type':_0xf27b('0x6'),'required':!![],'message':_0xf27b('0x7')}});exports[_0xf27b('0x8')]=function(_0x1542e3,_0x2e1396){return function(_0x583065){try{var _0x1a18b4={'command':_0x2e1396[0x0]};var _0x39bf1b=system[_0xf27b('0x0')](_0x1a18b4,{'typecast':!![]});if(_0x39bf1b[_0xf27b('0x9')]){logger[_0xf27b('0xa')](_0xf27b('0xb'),_0x1542e3,_['map'](_0x39bf1b,_0xf27b('0xc'))[_0xf27b('0xd')](',\x20'));logger[_0xf27b('0xe')](_0xf27b('0xf'),_0x1542e3);_0x583065[_0xf27b('0x10')]();}else{var _0x65eccf=this;var _0x28fc32=utils['getMustacheRender'](_0x2e1396[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x1542e3,_0x28fc32);sh[_0xf27b('0x11')](_['trim'](_0x28fc32),function(_0x2cd45c,_0x3d039f){logger[_0xf27b('0xe')](_0xf27b('0x12'),_0x1542e3,_0x2cd45c);if(_0x2cd45c==0x0){var _0x568f6b=_0x3d039f[_0xf27b('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xf27b('0x14')](_0x2e1396[0x1])||_[_0xf27b('0x15')](_0x2e1396[0x1])){logger[_0xf27b('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x1542e3);_0x65eccf[_0xf27b('0x16')][_0x2e1396[0x1]]=_0x568f6b;}else{logger[_0xf27b('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1542e3,_0x2e1396[0x1],_0x568f6b);_0x65eccf['body'][_0x2e1396[0x1]]=_0x568f6b;}}_0x583065[_0xf27b('0x10')]();});}}catch(_0x589455){logger[_0xf27b('0xa')](_0xf27b('0xb'),_0x1542e3,_[_0xf27b('0x17')](_0x589455)?JSON['stringify'](_0x589455):_0x589455);logger[_0xf27b('0xe')](_0xf27b('0xf'),_0x1542e3);_0x583065[_0xf27b('0x10')]();}};}; \ 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 154a67c..0fa543a 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 _0xbd72=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xbd72,0x1bc));var _0x2bd7=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xbd72[_0x20e7e3];return _0x14b9de;};'use strict';var schema=require(_0x2bd7('0x0'));var _=require(_0x2bd7('0x1'));var rpc={'chatInteraction':require(_0x2bd7('0x2')),'openchannelInteraction':require(_0x2bd7('0x3')),'smsInteraction':require(_0x2bd7('0x4')),'mailInteraction':require(_0x2bd7('0x5')),'faxInteraction':require(_0x2bd7('0x6')),'whatsappInteraction':require(_0x2bd7('0x7'))};var logger=require('../../../../config/logger')(_0x2bd7('0x8'));var tag=schema({'tag':{'type':_0x2bd7('0x9'),'required':!![],'message':_0x2bd7('0xa')}});exports[_0x2bd7('0xb')]=function(_0x3c5cdd,_0x1baf34,_0x5347ed,_0x122f84){return function(_0x2c2a61){try{var _0xcf2853={'tag':_0x1baf34[0x0]};var _0x4d054f=tag[_0x2bd7('0x0')](_0xcf2853,{'typecast':!![]});if(_0x4d054f[_0x2bd7('0xc')]){logger['error'](_0x2bd7('0xd'),_0x3c5cdd,_['map'](_0x4d054f,_0x2bd7('0xe'))[_0x2bd7('0xf')](',\x20'));logger[_0x2bd7('0x10')](_0x2bd7('0x11'),_0x3c5cdd);_0x2c2a61[_0x2bd7('0x12')]();}else{var _0x322154={'ids':[_0x1baf34[0x0]]};if(rpc[_0x122f84[_0x2bd7('0x13')]+_0x2bd7('0x14')]){rpc[_0x122f84[_0x2bd7('0x13')]+_0x2bd7('0x14')]['addTags'](_0x122f84[_0x2bd7('0x15')]['id'],_0x322154)[_0x2bd7('0x16')](function(_0x2f8eba){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3c5cdd,_0x1baf34[0x1],_0x122f84[_0x2bd7('0x13')],_0x122f84[_0x2bd7('0x15')]['id']);})[_0x2bd7('0x17')](function(_0x23e340){logger[_0x2bd7('0x18')](_0x2bd7('0xd'),_0x3c5cdd,JSON[_0x2bd7('0x19')](_0x23e340));logger[_0x2bd7('0x10')](_0x2bd7('0x11'),_0x3c5cdd);})[_0x2bd7('0x1a')](function(){_0x2c2a61[_0x2bd7('0x12')]();});}}}catch(_0xf30bc3){logger[_0x2bd7('0x18')]('[%s][TAG]\x20%s',_0x3c5cdd,_[_0x2bd7('0x1b')](_0xf30bc3)?JSON[_0x2bd7('0x19')](_0xf30bc3):_0xf30bc3);logger['info'](_0x2bd7('0x11'),_0x3c5cdd);_0x2c2a61[_0x2bd7('0x12')]();}};}; \ No newline at end of file +var _0x4bee=['interaction','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel'];(function(_0x2fa850,_0x28a567){var _0x5ebc55=function(_0x4853a0){while(--_0x4853a0){_0x2fa850['push'](_0x2fa850['shift']());}};_0x5ebc55(++_0x28a567);}(_0x4bee,0x1aa));var _0xe4be=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x4bee[_0x3817a9];return _0x443f30;};'use strict';var schema=require(_0xe4be('0x0'));var _=require(_0xe4be('0x1'));var rpc={'chatInteraction':require(_0xe4be('0x2')),'openchannelInteraction':require(_0xe4be('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe4be('0x4')),'whatsappInteraction':require(_0xe4be('0x5'))};var logger=require('../../../../config/logger')(_0xe4be('0x6'));var tag=schema({'tag':{'type':_0xe4be('0x7'),'required':!![],'message':_0xe4be('0x8')}});exports[_0xe4be('0x9')]=function(_0xcc2e73,_0x4e9a49,_0x51b68a,_0x109587){return function(_0x4d3e77){try{var _0x41b9b4={'tag':_0x4e9a49[0x0]};var _0x1cabe1=tag['validate'](_0x41b9b4,{'typecast':!![]});if(_0x1cabe1[_0xe4be('0xa')]){logger[_0xe4be('0xb')](_0xe4be('0xc'),_0xcc2e73,_[_0xe4be('0xd')](_0x1cabe1,_0xe4be('0xe'))[_0xe4be('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);_0x4d3e77['next']();}else{var _0x577462={'ids':[_0x4e9a49[0x0]]};if(rpc[_0x109587['channel']+'Interaction']){rpc[_0x109587['channel']+_0xe4be('0x10')][_0xe4be('0x11')](_0x109587['interaction']['id'],_0x577462)[_0xe4be('0x12')](function(_0x255dfa){logger[_0xe4be('0x13')](_0xe4be('0x14'),_0xcc2e73,_0x4e9a49[0x1],_0x109587[_0xe4be('0x15')],_0x109587[_0xe4be('0x16')]['id']);})[_0xe4be('0x17')](function(_0x2a3232){logger['error'](_0xe4be('0xc'),_0xcc2e73,JSON[_0xe4be('0x18')](_0x2a3232));logger[_0xe4be('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);})[_0xe4be('0x19')](function(){_0x4d3e77[_0xe4be('0x1a')]();});}}}catch(_0x515b18){logger[_0xe4be('0xb')]('[%s][TAG]\x20%s',_0xcc2e73,_[_0xe4be('0x1b')](_0x515b18)?JSON[_0xe4be('0x18')](_0x515b18):_0x515b18);logger[_0xe4be('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);_0x4d3e77['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index e0f307b..dff0519 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x408e=['method','login','params','stringify','utf8','POST','application/json-rpc','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','consequence','replace','push','urlOnAnswer','urlOnRing','title','jsonrpc'];(function(_0x13e973,_0x3deb5f){var _0x45fa40=function(_0x345e40){while(--_0x345e40){_0x13e973['push'](_0x13e973['shift']());}};_0x45fa40(++_0x3deb5f);}(_0x408e,0xc2));var _0xe408=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x408e[_0x36bf88];return _0x332914;};'use strict';var rp=require(_0xe408('0x0'));var logger=require(_0xe408('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xe408('0x2')]=function(_0x2c532c,_0x920147){return function(_0x98da02){var _0x1c8a8b=_0x920147[0xa];var _0x22befe=_0x920147[0xb];var _0xa8b45e=_0x920147[0xc];var _0x45b5f3=_0x920147[0xd];var _0x4afa9d=_0x920147[0xe];var _0x1e1be6=_0x920147[0xf][_0xe408('0x3')](/\n/g,'\x20-\x20');var _0x4dc5a7=_0x920147[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x22befe)){arr[_0xe408('0x4')](_0x22befe);var _0x1b3404=_0x920147[0x3];var _0x43f5e2=_0x920147[0x4];var _0x16047b=_0x920147[0x1];var _0x33c4a0=_0x920147[0x0];var _0x28363b={};_0x28363b[_0xe408('0x5')]=_0x920147[0x8]+'?params='+_0xa8b45e+'|'+_0x1c8a8b+'|'+_0x45b5f3+'|'+_0x22befe+'|'+_0x4afa9d;_0x28363b[_0xe408('0x6')]=_0x920147[0x7]+'?params='+_0xa8b45e+'|'+_0x1c8a8b+'|'+_0x45b5f3+'|'+_0x22befe+'|'+_0x4afa9d+'|'+_0x1e1be6+'|'+_0x4dc5a7;_0x28363b[_0xe408('0x7')]=_0x920147[0x9];var _0xd2c1ef={};_0xd2c1ef[_0xe408('0x8')]='2.0';_0xd2c1ef[_0xe408('0x9')]=_0xe408('0xa');var _0x254d11=[];_0x254d11[_0xe408('0x4')](_0x920147[0x2]);_0x254d11[_0xe408('0x4')](_0x920147[0x5]);_0x254d11['push'](_0x920147[0x6]);_0xd2c1ef[_0xe408('0xb')]=_0x254d11;_0xd2c1ef['id']=0x1;var _0x39bf8c=JSON[_0xe408('0xc')](_0xd2c1ef);var _0x2ac4f4={'encoding':_0xe408('0xd'),'method':_0xe408('0xe'),'timeout':0x2710,'url':_0x1b3404,'headers':{'Content-Type':_0xe408('0xf')},'body':_0x39bf8c};return rp(_0x2ac4f4)['then'](function(_0x2aa269){const _0xab0c6b=JSON[_0xe408('0x10')](_0x2aa269);if(!_0xab0c6b['result'][_0xe408('0x11')]){throw new Error(_0xe408('0x12'));}var _0xfdb012=_0x22befe;var _0x434815=_0xe408('0x13')+_0x16047b+_0xe408('0x14')+_0x33c4a0+_0xe408('0x15')+_0xfdb012+_0xe408('0x16')+JSON[_0xe408('0xc')](_0x28363b);var _0x396fb3=_0x43f5e2+'?'+_0x434815;return rp(_0x396fb3);})[_0xe408('0x17')](function(_0x39340e){logger[_0xe408('0x18')](_0xe408('0x19'),_0x2c532c,_0x39340e);_0x98da02['stop']();})[_0xe408('0x1a')](function(_0xd62e07){logger['error']('[%s][TVOX]\x20%s',_0x2c532c,_[_0xe408('0x1b')](_0xd62e07)?JSON[_0xe408('0xc')](_0xd62e07):_0xd62e07);_0x98da02['stop']();});}else{logger[_0xe408('0x18')](_0xe408('0x1c'),_0x2c532c);_0x98da02['next']();}};}; \ No newline at end of file +var _0x94ed=['push','stringify','utf8','POST','then','parse','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login'];(function(_0x499754,_0x45a36f){var _0x5f11d=function(_0x52792a){while(--_0x52792a){_0x499754['push'](_0x499754['shift']());}};_0x5f11d(++_0x45a36f);}(_0x94ed,0x143));var _0xd94e=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0x94ed[_0xb0acd8];return _0x491d41;};'use strict';var rp=require(_0xd94e('0x0'));var logger=require(_0xd94e('0x1'))('routing');var _=require(_0xd94e('0x2'));var arr=[];exports[_0xd94e('0x3')]=function(_0x2fc4a0,_0x4e4bf7){return function(_0x48049b){var _0x16ee73=_0x4e4bf7[0xa];var _0x35de94=_0x4e4bf7[0xb];var _0x4a9776=_0x4e4bf7[0xc];var _0x50ed7f=_0x4e4bf7[0xd];var _0x554b2e=_0x4e4bf7[0xe];var _0x5886d1=_0x4e4bf7[0xf]['replace'](/\n/g,_0xd94e('0x4'));var _0x112083=_0x4e4bf7[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xd94e('0x5')](_0x35de94)){arr['push'](_0x35de94);var _0x34299c=_0x4e4bf7[0x3];var _0x2445d5=_0x4e4bf7[0x4];var _0x45f356=_0x4e4bf7[0x1];var _0x5405=_0x4e4bf7[0x0];var _0x31b873={};_0x31b873[_0xd94e('0x6')]=_0x4e4bf7[0x8]+_0xd94e('0x7')+_0x4a9776+'|'+_0x16ee73+'|'+_0x50ed7f+'|'+_0x35de94+'|'+_0x554b2e;_0x31b873[_0xd94e('0x8')]=_0x4e4bf7[0x7]+_0xd94e('0x7')+_0x4a9776+'|'+_0x16ee73+'|'+_0x50ed7f+'|'+_0x35de94+'|'+_0x554b2e+'|'+_0x5886d1+'|'+_0x112083;_0x31b873[_0xd94e('0x9')]=_0x4e4bf7[0x9];var _0x513c7d={};_0x513c7d[_0xd94e('0xa')]=_0xd94e('0xb');_0x513c7d['method']=_0xd94e('0xc');var _0x499d0e=[];_0x499d0e[_0xd94e('0xd')](_0x4e4bf7[0x2]);_0x499d0e[_0xd94e('0xd')](_0x4e4bf7[0x5]);_0x499d0e['push'](_0x4e4bf7[0x6]);_0x513c7d['params']=_0x499d0e;_0x513c7d['id']=0x1;var _0x25ad5b=JSON[_0xd94e('0xe')](_0x513c7d);var _0x4db62e={'encoding':_0xd94e('0xf'),'method':_0xd94e('0x10'),'timeout':0x2710,'url':_0x34299c,'headers':{'Content-Type':'application/json-rpc'},'body':_0x25ad5b};return rp(_0x4db62e)[_0xd94e('0x11')](function(_0x571894){const _0x5978ad=JSON[_0xd94e('0x12')](_0x571894);if(!_0x5978ad['result']['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1a0db1=_0x35de94;var _0x27a5c9='channelId='+_0x45f356+_0xd94e('0x13')+_0x5405+_0xd94e('0x14')+_0x1a0db1+'&data='+JSON[_0xd94e('0xe')](_0x31b873);var _0xc6455d=_0x2445d5+'?'+_0x27a5c9;return rp(_0xc6455d);})['then'](function(_0x3ae553){logger[_0xd94e('0x15')](_0xd94e('0x16'),_0x2fc4a0,_0x3ae553);_0x48049b[_0xd94e('0x17')]();})[_0xd94e('0x18')](function(_0xf9c256){logger[_0xd94e('0x19')]('[%s][TVOX]\x20%s',_0x2fc4a0,_[_0xd94e('0x1a')](_0xf9c256)?JSON['stringify'](_0xf9c256):_0xf9c256);_0x48049b[_0xd94e('0x17')]();});}else{logger[_0xd94e('0x15')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2fc4a0);_0x48049b[_0xd94e('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 7e95f03..47e3442 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1fac8e,_0x2630f8){var _0x2ac449=function(_0x2c3304){while(--_0x2c3304){_0x1fac8e['push'](_0x1fac8e['shift']());}};_0x2ac449(++_0x2630f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0xc85c78,_0x197a50){var _0x25178d=function(_0x2d3185){while(--_0x2d3185){_0xc85c78['push'](_0xc85c78['shift']());}};_0x25178d(++_0x197a50);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2aca5be..86e1d76 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 _0x2ff5=['checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','amazonlex','tag','tvox','account','ChatWebsiteId','ContactId','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','interval','rules','channel','message','interaction'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x52cdec,_0x4ded94){_0x52cdec=_0x52cdec-0x0;var _0x572361=_0x2ff5[_0x52cdec];return _0x572361;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var path=require(_0x52ff('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x52ff('0x2'));var utils=require(_0x52ff('0x3'));var sUtils=require(_0x52ff('0x4'));var logger=require(_0x52ff('0x5'))(_0x52ff('0x6'));var rpc={'openchannelQueueReport':require(_0x52ff('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x52ff('0x8')),'smsQueueReport':require(_0x52ff('0x9')),'faxQueueReport':require(_0x52ff('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x52ff('0xb'));function getId(_0xbbba62,_0x3cfd13,_0x17ca0b){return util[_0x52ff('0xc')](_0x52ff('0xd'),_0xbbba62,_0x3cfd13||0x0,_0x17ca0b||0x0);}function getIntervals(_0x27c199,_0x16aaf4){var _0x5e127e=[];if(!_[_0x52ff('0xe')](_0x16aaf4[_0x52ff('0xf')])&&!_[_0x52ff('0xe')](_0x27c199[_0x16aaf4[_0x52ff('0xf')]])&&!_[_0x52ff('0xe')](_0x27c199[_0x16aaf4[_0x52ff('0xf')]]['Intervals'])){_0x5e127e=_['map'](_0x27c199[_0x16aaf4['IntervalId']]['Intervals'],_0x52ff('0x10'));}else if(!_['isNil'](_0x16aaf4[_0x52ff('0x10')])){_0x5e127e=[_0x16aaf4[_0x52ff('0x10')]];}return _0x5e127e;}exports['listen']=function(_0xb12d66){_0xb12d66[_0x52ff('0x11')]={};return new BPromise(function(_0x3c787b,_0x2023d3){var _0x418202={'Start':function(_0x27c987){var _0x5a47b2=this;return new Promise(function(_0x3a1a83,_0x2b8846){if(_0x27c987){try{var _0x3154b7=[];var _0x4c83f=getId(_0x27c987[_0x52ff('0x12')],_0x27c987[_0x52ff('0x13')]?_0x27c987['message']['id']:0x0,_0x27c987[_0x52ff('0x14')]?_0x27c987[_0x52ff('0x14')]['id']:0x0);var _0x3cbe60=sUtils[_0x52ff('0x15')](_0xb12d66,_0x27c987);if(_0x27c987['transfer']||!_0x3cbe60&&_0x27c987[_0x52ff('0x16')]&&_[_0x52ff('0x17')](_0x27c987[_0x52ff('0x16')])&&_0x27c987[_0x52ff('0x16')][_0x52ff('0x18')]){for(var _0x10ad04=0x0;_0x10ad04<_0x27c987[_0x52ff('0x16')][_0x52ff('0x18')];_0x10ad04+=0x1){var _0x1df213=_0x27c987[_0x52ff('0x16')][_0x10ad04];if(fs[_0x52ff('0x19')](path[_0x52ff('0x1a')](__dirname,_0x52ff('0x16'),_0x1df213[_0x52ff('0x1b')]+_0x52ff('0x1c')))){var _0xe68eb5=[];switch(_0x1df213[_0x52ff('0x1b')][_0x52ff('0x1d')]()){case'autoreply':var _0x376edf=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');if(_0x27c987[_0x52ff('0x12')]==='mail'){_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x376edf['slice'](0x2,_0x376edf['length'])[_0x52ff('0x1a')](','));}else{_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x376edf[_0x52ff('0x21')](0x1,_0x376edf[_0x52ff('0x18')])[_0x52ff('0x1a')](','));}break;case _0x52ff('0x22'):var _0x322260=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');_0xe68eb5[_0x52ff('0x20')](_0x322260[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x322260[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x322260[_0x52ff('0x21')](0x2,_0x322260['length'])[_0x52ff('0x1a')](','));break;case'dialogflowv2':var _0x233a3e=_0x1df213[_0x52ff('0x1e')]['split'](',');_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x2]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x3]);_0xe68eb5['push'](_0x233a3e[_0x52ff('0x21')](0x4,_0x233a3e[_0x52ff('0x18')])['join'](','));break;case _0x52ff('0x23'):var _0x2f437d=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');_0xe68eb5['push'](_0x2f437d[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[0x2]);_0xe68eb5['push'](_0x2f437d[0x3]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[_0x52ff('0x21')](0x4,_0x2f437d[_0x52ff('0x18')])[_0x52ff('0x1a')](','));break;case'message':_0xe68eb5[_0x52ff('0x20')](_0x1df213['appdata']);break;case _0x52ff('0x24'):_0xe68eb5[_0x52ff('0x20')](_0x1df213['TagId']);_0xe68eb5[_0x52ff('0x20')](_0x1df213[_0x52ff('0x1e')]);break;case _0x52ff('0x25'):var _0x5e5ac1=utils['getMustacheRender'](_0x27c987[_0x52ff('0x26')]['notificationTemplate'],_0x27c987);var _0x38a8f1=_0x1df213['appdata'][_0x52ff('0x1f')](',');_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x0]);_0xe68eb5['push'](_0x38a8f1[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x2]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x3]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x4]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x5]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x6]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x7]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x8]);_0xe68eb5['push'](_0x38a8f1[0x9]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0xa]);_0xe68eb5[_0x52ff('0x20')](_0x27c987[_0x52ff('0x14')]['id']);_0xe68eb5[_0x52ff('0x20')](_0x27c987[_0x52ff('0x13')]['id']);_0xe68eb5[_0x52ff('0x20')](_0x1df213[_0x52ff('0x27')]);_0xe68eb5['push'](_0x27c987[_0x52ff('0x14')][_0x52ff('0x28')]);_0xe68eb5[_0x52ff('0x20')](_0x27c987['body']['body']);_0xe68eb5[_0x52ff('0x20')](_0x5e5ac1);break;default:_0xe68eb5=_['isNil'](_0x1df213[_0x52ff('0x1e')])?[]:_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');}var _0x28c330={'id':util[_0x52ff('0xc')](_0x52ff('0x29'),_0x4c83f,_0x1df213['id'],_0x1df213[_0x52ff('0x1b')]),'condition':require(_0x52ff('0x2a'))[_0x52ff('0x2b')](_0x4c83f,getIntervals(_0xb12d66['intervals'],_0x1df213),_0xb12d66),'consequence':require(_0x52ff('0x2c')+_0x1df213[_0x52ff('0x1b')])['consequence'](_0x4c83f,_0xe68eb5,_0xb12d66,_0x27c987),'p':_0x1df213[_0x52ff('0x2d')]||0x0};logger[_0x52ff('0x2e')](_0x52ff('0x2f'),_0x28c330['id'],_0x52ff('0x30'),getIntervals(_0xb12d66[_0x52ff('0x31')],_0x1df213)[_0x52ff('0x1a')](_0x52ff('0x32')));_0x3154b7['push'](_0x28c330);}else{logger[_0x52ff('0x33')](_0x52ff('0x34'),path[_0x52ff('0x1a')](__dirname,_0x52ff('0x16'),_0x1df213['app']+'.js'));}}_0xb12d66[_0x52ff('0x11')][_0x4c83f]=new RuleEngine(_0x3154b7);_0xb12d66[_0x52ff('0x11')][_0x4c83f][_0x52ff('0x35')](_0x27c987,function(_0x375c87){logger[_0x52ff('0x2e')]('Applications\x20executed',JSON[_0x52ff('0x36')](_0x375c87[_0x52ff('0x37')]));if(_0xb12d66[_0x52ff('0x11')][_0x4c83f]){_0xb12d66[_0x52ff('0x11')][_0x4c83f][_0x52ff('0x38')](_0x52ff('0x39'));}});return _0x3a1a83({'code':0xc8,'message':_0x27c987});}else{if(_0x3cbe60){logger[_0x52ff('0x2e')](util[_0x52ff('0xc')](_0x52ff('0x3a'),_0x4c83f));}else{logger[_0x52ff('0x2e')]('No\x20applications\x20to\x20execute');}return _0x3a1a83({'code':0xc8,'message':_0x27c987});}}catch(_0x1423c8){logger[_0x52ff('0x33')](_0x1423c8[_0x52ff('0x3b')]);return _0x2b8846(_0x5a47b2[_0x52ff('0x33')](0x1f4,_0x1423c8));}}return _0x2b8846(_0x52ff('0x3c'));});},'AcceptMessage':function(_0x4b43b2){var _0x38043c=this;return new Promise(function(_0x385e92,_0x4a1888){if(_0x4b43b2[_0x52ff('0x3d')]&&_0x4b43b2[_0x52ff('0x3d')]['id']){if(_0xb12d66[_0x52ff('0x3e')][_0x4b43b2[_0x52ff('0x3d')]['id']]){_0xb12d66['agents'][_0x4b43b2['agent']['id']][_0x52ff('0x3f')]=![];_0xb12d66[_0x52ff('0x3e')][_0x4b43b2[_0x52ff('0x3d')]['id']][_0x52ff('0x40')]=undefined;}}if(_0x4b43b2[_0x52ff('0x13')]&&_0x4b43b2[_0x52ff('0x13')]['id']){try{var _0x38283f=getId(_0x4b43b2['channel'],_0x4b43b2['message']?_0x4b43b2[_0x52ff('0x13')]['id']:0x0,_0x4b43b2[_0x52ff('0x14')]?_0x4b43b2[_0x52ff('0x14')]['id']:0x0);if(_0xb12d66[_0x52ff('0x11')][_0x38283f]){_0xb12d66[_0x52ff('0x11')][_0x38283f][_0x52ff('0x38')](_0x52ff('0x41'));if(rpc[_0x4b43b2[_0x52ff('0x12')]+_0x52ff('0x42')]){rpc[_0x4b43b2['channel']+_0x52ff('0x42')][_0x52ff('0x43')](_0x38283f,{'UserId':_0x4b43b2[_0x52ff('0x13')][_0x52ff('0x44')]})[_0x52ff('0x45')](function(){logger['error'](_0x52ff('0x46'));});}}return _0x385e92({'code':0xc8,'message':_0x4b43b2});}catch(_0xcef115){logger[_0x52ff('0x33')](_0xcef115[_0x52ff('0x3b')]);return _0x4a1888(_0x38043c['error'](0x1f4,_0xcef115));}}logger[_0x52ff('0x33')](_0x52ff('0x47'));return _0x4a1888(_0x38043c[_0x52ff('0x33')](0x1f4,_0x52ff('0x47')));});},'RejectMessage':function(_0x4479c1){var _0xdd2625=this;return new Promise(function(_0x559118,_0x3f6f62){if(_0x4479c1['agent']&&_0x4479c1[_0x52ff('0x3d')]['id']){try{if(_0xb12d66[_0x52ff('0x3e')][_0x4479c1[_0x52ff('0x3d')]['id']]){_0xb12d66[_0x52ff('0x3e')][_0x4479c1['agent']['id']][_0x52ff('0x3f')]=![];_0xb12d66['agents'][_0x4479c1[_0x52ff('0x3d')]['id']]['busyQueue']=undefined;}return _0x559118({'code':0xc8,'message':_0x4479c1});}catch(_0x5003d0){logger[_0x52ff('0x33')](_0x5003d0[_0x52ff('0x3b')]);return _0x3f6f62(_0xdd2625['error'](0x1f4,_0x5003d0));}}logger[_0x52ff('0x33')]('message\x20is\x20empty');return _0x3f6f62(_0xdd2625[_0x52ff('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2ce44d){var _0x319fc7=this;return new Promise(function(_0x41c47b,_0xd3f42d){if(_0x2ce44d['channel']&&_0x2ce44d[_0x52ff('0x14')]&&_0x2ce44d[_0x52ff('0x14')]['id']){try{var _0x312c48=getId(_0x2ce44d[_0x52ff('0x12')],_0x2ce44d[_0x52ff('0x13')]?_0x2ce44d[_0x52ff('0x13')]['id']:0x0,_0x2ce44d[_0x52ff('0x14')]?_0x2ce44d['interaction']['id']:0x0);if(_0xb12d66['rules'][_0x312c48]){_0xb12d66['rules'][_0x312c48]['emit'](_0x52ff('0x41'));}return _0x41c47b({'code':0xc8,'message':_0x2ce44d});}catch(_0x1e77ad){logger[_0x52ff('0x33')](_0x1e77ad[_0x52ff('0x3b')]);return _0xd3f42d(_0x319fc7[_0x52ff('0x33')](0x1f4,_0x1e77ad));}}logger[_0x52ff('0x33')]('message\x20is\x20empty');return _0xd3f42d(_0x319fc7[_0x52ff('0x33')](0x1f4,_0x52ff('0x47')));});},'AgentCapacity':function(_0x286dbd){var _0x2c4ee6=this;return new Promise(function(_0x40460f,_0x31e637){if(_0xb12d66['agents'][_0x52ff('0x48')](_0x286dbd['id'])){for(var _0x25f5aa in _0x286dbd[_0x52ff('0x49')]){if(_0x286dbd[_0x52ff('0x49')][_0x52ff('0x48')](_0x25f5aa)){if(_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x52ff('0x48')](_0x25f5aa+_0x52ff('0x4a'))){_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x25f5aa+_0x52ff('0x4a')]=parseInt(_0x286dbd[_0x52ff('0x49')][_0x25f5aa],0xa);}}}_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x52ff('0x4b')]();return _0x40460f({'code':0xc8,'message':_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']]});}else{return _0x31e637(_0x2c4ee6['error'](0x1f4,_0x52ff('0x4c')));}});},'Agents':function(_0x33990d){return new Promise(function(_0x1b45b0){var _0x31aa09=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x3e')]);if(_0x33990d&&_0x33990d['id']){var _0xf4b281=_['find'](_0x31aa09,function(_0xfc9c40){return _0xfc9c40['id']===_0x33990d['id'];});_0x1b45b0(_0xf4b281);}else{_0x1b45b0({'count':_0x31aa09[_0x52ff('0x18')],'rows':_0x31aa09});}});},'ChatQueues':function(){return new Promise(function(_0x259441){var _0x377a58=[];for(var _0x49cf8c in _0xb12d66[_0x52ff('0x4e')]){if(_0xb12d66[_0x52ff('0x4e')][_0x52ff('0x48')](_0x49cf8c)){var _0x4b6772=_0xb12d66[_0x52ff('0x4e')][_0x49cf8c];var _0x3143a8={'id':_0x4b6772['id'],'available':_0x4b6772[_0x52ff('0x4f')],'loggedIn':_0x4b6772['loggedIn'],'name':_0x4b6772[_0x52ff('0x50')],'paused':_0x4b6772[_0x52ff('0x51')],'waiting':_0x4b6772[_0x52ff('0x52')]};_0x377a58[_0x52ff('0x20')](_0x3143a8);}}_0x259441({'count':_0x377a58[_0x52ff('0x18')],'rows':_0x377a58});});},'MailQueues':function(){return new Promise(function(_0x387a5c){var _0xc527c2=[];for(var _0x3105da in _0xb12d66[_0x52ff('0x53')]){if(_0xb12d66['mailQueues']['hasOwnProperty'](_0x3105da)){var _0x3db38a=_0xb12d66[_0x52ff('0x53')][_0x3105da];var _0x14f6d0={'id':_0x3db38a['id'],'available':_0x3db38a[_0x52ff('0x4f')],'loggedIn':_0x3db38a[_0x52ff('0x54')],'name':_0x3db38a[_0x52ff('0x50')],'paused':_0x3db38a[_0x52ff('0x51')],'waiting':_0x3db38a[_0x52ff('0x52')]};_0xc527c2[_0x52ff('0x20')](_0x14f6d0);}}_0x387a5c({'count':_0xc527c2[_0x52ff('0x18')],'rows':_0xc527c2});});},'OpenchannelQueues':function(){return new Promise(function(_0x5b3fe0){var _0x562d83=[];for(var _0x1e6a23 in _0xb12d66[_0x52ff('0x55')]){if(_0xb12d66[_0x52ff('0x55')][_0x52ff('0x48')](_0x1e6a23)){var _0x1c6ec0=_0xb12d66[_0x52ff('0x55')][_0x1e6a23];var _0x220336={'id':_0x1c6ec0['id'],'available':_0x1c6ec0[_0x52ff('0x4f')],'loggedIn':_0x1c6ec0[_0x52ff('0x54')],'name':_0x1c6ec0[_0x52ff('0x50')],'paused':_0x1c6ec0['paused'],'waiting':_0x1c6ec0[_0x52ff('0x52')]};_0x562d83[_0x52ff('0x20')](_0x220336);}}_0x5b3fe0({'count':_0x562d83[_0x52ff('0x18')],'rows':_0x562d83});});},'SmsQueues':function(){return new Promise(function(_0x33db64){var _0x242413=[];for(var _0x1fa59c in _0xb12d66['smsQueues']){if(_0xb12d66[_0x52ff('0x56')]['hasOwnProperty'](_0x1fa59c)){var _0x1bfe00=_0xb12d66['smsQueues'][_0x1fa59c];var _0x4be2c8={'id':_0x1bfe00['id'],'available':_0x1bfe00[_0x52ff('0x4f')],'loggedIn':_0x1bfe00[_0x52ff('0x54')],'name':_0x1bfe00['name'],'paused':_0x1bfe00[_0x52ff('0x51')],'waiting':_0x1bfe00[_0x52ff('0x52')]};_0x242413[_0x52ff('0x20')](_0x4be2c8);}}_0x33db64({'count':_0x242413[_0x52ff('0x18')],'rows':_0x242413});});},'FaxQueues':function(){return new Promise(function(_0xb259d7){var _0x5ae700=[];for(var _0x2d8f5f in _0xb12d66[_0x52ff('0x57')]){if(_0xb12d66[_0x52ff('0x57')][_0x52ff('0x48')](_0x2d8f5f)){var _0x4f1e54=_0xb12d66[_0x52ff('0x57')][_0x2d8f5f];var _0x40297e={'id':_0x4f1e54['id'],'available':_0x4f1e54[_0x52ff('0x4f')],'loggedIn':_0x4f1e54[_0x52ff('0x54')],'name':_0x4f1e54['name'],'paused':_0x4f1e54['paused'],'waiting':_0x4f1e54[_0x52ff('0x52')]};_0x5ae700[_0x52ff('0x20')](_0x40297e);}}_0xb259d7({'count':_0x5ae700[_0x52ff('0x18')],'rows':_0x5ae700});});},'WhatsappQueues':function(){return new Promise(function(_0x269267){var _0xb1839=[];for(var _0x26c4dc in _0xb12d66['whatsappQueues']){if(_0xb12d66[_0x52ff('0x58')][_0x52ff('0x48')](_0x26c4dc)){var _0x30802d=_0xb12d66[_0x52ff('0x58')][_0x26c4dc];var _0x427ab4={'id':_0x30802d['id'],'available':_0x30802d[_0x52ff('0x4f')],'loggedIn':_0x30802d[_0x52ff('0x54')],'name':_0x30802d['name'],'paused':_0x30802d[_0x52ff('0x51')],'waiting':_0x30802d['waiting']};_0xb1839[_0x52ff('0x20')](_0x427ab4);}}_0x269267({'count':_0xb1839[_0x52ff('0x18')],'rows':_0xb1839});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x26a30b){var _0x313376=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x59')]);_0x26a30b({'count':_0x313376[_0x52ff('0x18')],'rows':_0x313376});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x497149){var _0x22e393=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5a')]);_0x497149({'count':_0x22e393[_0x52ff('0x18')],'rows':_0x22e393});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x56c794){var _0x28f89a=_[_0x52ff('0x4d')](_0xb12d66['openchannelQueuesWaitingInteractions']);_0x56c794({'count':_0x28f89a[_0x52ff('0x18')],'rows':_0x28f89a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x36a4c5){var _0xf0a5db=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5b')]);_0x36a4c5({'count':_0xf0a5db['length'],'rows':_0xf0a5db});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x211072){var _0x136ebb=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5c')]);_0x211072({'count':_0x136ebb[_0x52ff('0x18')],'rows':_0x136ebb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2860fe){var _0x2f588c=_[_0x52ff('0x4d')](_0xb12d66['whatsappQueuesWaitingInteractions']);_0x2860fe({'count':_0x2f588c[_0x52ff('0x18')],'rows':_0x2f588c});});}};var _0x8fa723=jayson[_0x52ff('0x5d')](_0x418202)[_0x52ff('0x5e')]();_0x8fa723['on'](_0x52ff('0x33'),function(_0x5befba){logger[_0x52ff('0x33')](JSON[_0x52ff('0x36')](_0x5befba));return _0x2023d3(_0x5befba);});_0x8fa723['listen'](0x232c,_0x52ff('0x5f'),function(){console['log'](_0x52ff('0x60'),0x232c);return _0x3c787b(_0x52ff('0x61')+0x232c);});});}; \ No newline at end of file +var _0x1c52=['agent\x20not\x20found','values','find','chatQueues','available','name','waiting','mailQueues','loggedIn','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','appdata','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','message','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','intervals','\x20|\x20','error','.js','rules','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x1c52,0x7c));var _0x21c5=function(_0x46afe1,_0x3ded94){_0x46afe1=_0x46afe1-0x0;var _0x2ff9ef=_0x1c52[_0x46afe1];return _0x2ff9ef;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var path=require(_0x21c5('0x2'));var fs=require('fs');var jayson=require(_0x21c5('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0x21c5('0x4'))(_0x21c5('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x21c5('0x6')),'chatQueueReport':require(_0x21c5('0x7')),'smsQueueReport':require(_0x21c5('0x8')),'faxQueueReport':require(_0x21c5('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x21c5('0xa'));function getId(_0xb4b1e4,_0x4c5a4f,_0xd34da2){return util[_0x21c5('0xb')](_0x21c5('0xc'),_0xb4b1e4,_0x4c5a4f||0x0,_0xd34da2||0x0);}function getIntervals(_0x27389f,_0x54a640){var _0x38a038=[];if(!_[_0x21c5('0xd')](_0x54a640[_0x21c5('0xe')])&&!_['isNil'](_0x27389f[_0x54a640[_0x21c5('0xe')]])&&!_['isNil'](_0x27389f[_0x54a640[_0x21c5('0xe')]][_0x21c5('0xf')])){_0x38a038=_[_0x21c5('0x10')](_0x27389f[_0x54a640[_0x21c5('0xe')]]['Intervals'],_0x21c5('0x11'));}else if(!_['isNil'](_0x54a640[_0x21c5('0x11')])){_0x38a038=[_0x54a640[_0x21c5('0x11')]];}return _0x38a038;}exports['listen']=function(_0x17be3d){_0x17be3d['rules']={};return new BPromise(function(_0x4791f7,_0x3ba28b){var _0x35d2fe={'Start':function(_0x47030b){var _0x20902a=this;return new Promise(function(_0x15de0c,_0x102433){if(_0x47030b){try{var _0x41b810=[];var _0x4bdf72=getId(_0x47030b[_0x21c5('0x12')],_0x47030b['message']?_0x47030b['message']['id']:0x0,_0x47030b[_0x21c5('0x13')]?_0x47030b['interaction']['id']:0x0);var _0x4daf4d=sUtils[_0x21c5('0x14')](_0x17be3d,_0x47030b);if(_0x47030b['transfer']||!_0x4daf4d&&_0x47030b[_0x21c5('0x15')]&&_['isArray'](_0x47030b[_0x21c5('0x15')])&&_0x47030b['applications']['length']){for(var _0x2d57fc=0x0;_0x2d57fc<_0x47030b[_0x21c5('0x15')][_0x21c5('0x16')];_0x2d57fc+=0x1){var _0x300178=_0x47030b[_0x21c5('0x15')][_0x2d57fc];if(fs[_0x21c5('0x17')](path[_0x21c5('0x18')](__dirname,_0x21c5('0x15'),_0x300178[_0x21c5('0x19')]+'.js'))){var _0x8021db=[];switch(_0x300178[_0x21c5('0x19')][_0x21c5('0x1a')]()){case _0x21c5('0x1b'):var _0x123a7a=_0x300178['appdata'][_0x21c5('0x1c')](',');if(_0x47030b[_0x21c5('0x12')]===_0x21c5('0x1d')){_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x0]);_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x1]);_0x8021db['push'](_0x123a7a['slice'](0x2,_0x123a7a[_0x21c5('0x16')])[_0x21c5('0x18')](','));}else{_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x0]);_0x8021db[_0x21c5('0x1e')](_0x123a7a[_0x21c5('0x1f')](0x1,_0x123a7a[_0x21c5('0x16')])['join'](','));}break;case'dialogflow':var _0x5918df=_0x300178[_0x21c5('0x20')][_0x21c5('0x1c')](',');_0x8021db[_0x21c5('0x1e')](_0x5918df[0x0]);_0x8021db[_0x21c5('0x1e')](_0x5918df[0x1]);_0x8021db['push'](_0x5918df[_0x21c5('0x1f')](0x2,_0x5918df[_0x21c5('0x16')])[_0x21c5('0x18')](','));break;case _0x21c5('0x21'):var _0x3b66f9=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x0]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x1]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x2]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x3]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[_0x21c5('0x1f')](0x4,_0x3b66f9[_0x21c5('0x16')])[_0x21c5('0x18')](','));break;case _0x21c5('0x22'):var _0x2b075a=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x0]);_0x8021db['push'](_0x2b075a[0x1]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x2]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x3]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[_0x21c5('0x1f')](0x4,_0x2b075a['length'])[_0x21c5('0x18')](','));break;case'message':_0x8021db[_0x21c5('0x1e')](_0x300178['appdata']);break;case _0x21c5('0x23'):_0x8021db[_0x21c5('0x1e')](_0x300178[_0x21c5('0x24')]);_0x8021db['push'](_0x300178[_0x21c5('0x20')]);break;case'tvox':var _0x3540c0=utils[_0x21c5('0x25')](_0x47030b[_0x21c5('0x26')]['notificationTemplate'],_0x47030b);var _0x1a82bb=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x0]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x1]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x2]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x3]);_0x8021db['push'](_0x1a82bb[0x4]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x5]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x6]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x7]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x8]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x9]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0xa]);_0x8021db[_0x21c5('0x1e')](_0x47030b[_0x21c5('0x13')]['id']);_0x8021db['push'](_0x47030b[_0x21c5('0x27')]['id']);_0x8021db[_0x21c5('0x1e')](_0x300178[_0x21c5('0x28')]);_0x8021db['push'](_0x47030b[_0x21c5('0x13')][_0x21c5('0x29')]);_0x8021db[_0x21c5('0x1e')](_0x47030b[_0x21c5('0x2a')][_0x21c5('0x2a')]);_0x8021db['push'](_0x3540c0);break;default:_0x8021db=_[_0x21c5('0xd')](_0x300178[_0x21c5('0x20')])?[]:_0x300178[_0x21c5('0x20')][_0x21c5('0x1c')](',');}var _0x31fd72={'id':util['format'](_0x21c5('0x2b'),_0x4bdf72,_0x300178['id'],_0x300178[_0x21c5('0x19')]),'condition':require(_0x21c5('0x2c'))[_0x21c5('0x2d')](_0x4bdf72,getIntervals(_0x17be3d['intervals'],_0x300178),_0x17be3d),'consequence':require(_0x21c5('0x2e')+_0x300178[_0x21c5('0x19')])['consequence'](_0x4bdf72,_0x8021db,_0x17be3d,_0x47030b),'p':_0x300178[_0x21c5('0x2f')]||0x0};logger[_0x21c5('0x30')](_0x21c5('0x31'),_0x31fd72['id'],'on\x20interval',getIntervals(_0x17be3d[_0x21c5('0x32')],_0x300178)[_0x21c5('0x18')](_0x21c5('0x33')));_0x41b810['push'](_0x31fd72);}else{logger[_0x21c5('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x21c5('0x18')](__dirname,_0x21c5('0x15'),_0x300178[_0x21c5('0x19')]+_0x21c5('0x35')));}}_0x17be3d[_0x21c5('0x36')][_0x4bdf72]=new RuleEngine(_0x41b810);_0x17be3d['rules'][_0x4bdf72]['execute'](_0x47030b,function(_0x503ffa){logger[_0x21c5('0x30')]('Applications\x20executed',JSON[_0x21c5('0x37')](_0x503ffa[_0x21c5('0x38')]));if(_0x17be3d[_0x21c5('0x36')][_0x4bdf72]){_0x17be3d[_0x21c5('0x36')][_0x4bdf72]['emit'](_0x21c5('0x39'));}});return _0x15de0c({'code':0xc8,'message':_0x47030b});}else{if(_0x4daf4d){logger[_0x21c5('0x30')](util[_0x21c5('0xb')](_0x21c5('0x3a'),_0x4bdf72));}else{logger[_0x21c5('0x30')](_0x21c5('0x3b'));}return _0x15de0c({'code':0xc8,'message':_0x47030b});}}catch(_0x17876f){logger[_0x21c5('0x34')](_0x17876f[_0x21c5('0x3c')]);return _0x102433(_0x20902a['error'](0x1f4,_0x17876f));}}return _0x102433(_0x21c5('0x3d'));});},'AcceptMessage':function(_0x5f3d15){var _0x462537=this;return new Promise(function(_0x3393a6,_0x2cb9f9){if(_0x5f3d15[_0x21c5('0x3e')]&&_0x5f3d15[_0x21c5('0x3e')]['id']){if(_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']]){_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']][_0x21c5('0x40')]=![];_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x5f3d15['message']&&_0x5f3d15['message']['id']){try{var _0xe237a5=getId(_0x5f3d15[_0x21c5('0x12')],_0x5f3d15[_0x21c5('0x27')]?_0x5f3d15['message']['id']:0x0,_0x5f3d15[_0x21c5('0x13')]?_0x5f3d15[_0x21c5('0x13')]['id']:0x0);if(_0x17be3d[_0x21c5('0x36')][_0xe237a5]){_0x17be3d['rules'][_0xe237a5]['emit'](_0x21c5('0x41'));if(rpc[_0x5f3d15[_0x21c5('0x12')]+_0x21c5('0x42')]){rpc[_0x5f3d15[_0x21c5('0x12')]+'QueueReport'][_0x21c5('0x43')](_0xe237a5,{'UserId':_0x5f3d15[_0x21c5('0x27')][_0x21c5('0x44')]})[_0x21c5('0x45')](function(){logger['error'](_0x21c5('0x46'));});}}return _0x3393a6({'code':0xc8,'message':_0x5f3d15});}catch(_0x174a7e){logger[_0x21c5('0x34')](_0x174a7e['stack']);return _0x2cb9f9(_0x462537[_0x21c5('0x34')](0x1f4,_0x174a7e));}}logger['error']('message\x20is\x20empty');return _0x2cb9f9(_0x462537[_0x21c5('0x34')](0x1f4,_0x21c5('0x47')));});},'RejectMessage':function(_0x26007f){var _0x4550dc=this;return new Promise(function(_0x3ec91a,_0x5dd4d6){if(_0x26007f['agent']&&_0x26007f['agent']['id']){try{if(_0x17be3d[_0x21c5('0x3f')][_0x26007f[_0x21c5('0x3e')]['id']]){_0x17be3d['agents'][_0x26007f[_0x21c5('0x3e')]['id']][_0x21c5('0x40')]=![];_0x17be3d[_0x21c5('0x3f')][_0x26007f[_0x21c5('0x3e')]['id']]['busyQueue']=undefined;}return _0x3ec91a({'code':0xc8,'message':_0x26007f});}catch(_0x1d366a){logger[_0x21c5('0x34')](_0x1d366a[_0x21c5('0x3c')]);return _0x5dd4d6(_0x4550dc[_0x21c5('0x34')](0x1f4,_0x1d366a));}}logger[_0x21c5('0x34')]('message\x20is\x20empty');return _0x5dd4d6(_0x4550dc['error'](0x1f4,_0x21c5('0x47')));});},'AbandonInteraction':function(_0x3d7144){var _0x100f02=this;return new Promise(function(_0xc3fa2,_0x37aa16){if(_0x3d7144['channel']&&_0x3d7144[_0x21c5('0x13')]&&_0x3d7144[_0x21c5('0x13')]['id']){try{var _0x564acd=getId(_0x3d7144[_0x21c5('0x12')],_0x3d7144[_0x21c5('0x27')]?_0x3d7144['message']['id']:0x0,_0x3d7144[_0x21c5('0x13')]?_0x3d7144['interaction']['id']:0x0);if(_0x17be3d[_0x21c5('0x36')][_0x564acd]){_0x17be3d['rules'][_0x564acd][_0x21c5('0x48')](_0x21c5('0x41'));}return _0xc3fa2({'code':0xc8,'message':_0x3d7144});}catch(_0xd4c091){logger[_0x21c5('0x34')](_0xd4c091[_0x21c5('0x3c')]);return _0x37aa16(_0x100f02['error'](0x1f4,_0xd4c091));}}logger[_0x21c5('0x34')]('message\x20is\x20empty');return _0x37aa16(_0x100f02[_0x21c5('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x521729){var _0x35ee5f=this;return new Promise(function(_0x164917,_0x5bde7a){if(_0x17be3d[_0x21c5('0x3f')][_0x21c5('0x49')](_0x521729['id'])){for(var _0x284249 in _0x521729[_0x21c5('0x4a')]){if(_0x521729['capacity'][_0x21c5('0x49')](_0x284249)){if(_0x17be3d['agents'][_0x521729['id']][_0x21c5('0x49')](_0x284249+_0x21c5('0x4b'))){_0x17be3d[_0x21c5('0x3f')][_0x521729['id']][_0x284249+_0x21c5('0x4b')]=parseInt(_0x521729[_0x21c5('0x4a')][_0x284249],0xa);}}}_0x17be3d['agents'][_0x521729['id']]['updateRealtime']();return _0x164917({'code':0xc8,'message':_0x17be3d[_0x21c5('0x3f')][_0x521729['id']]});}else{return _0x5bde7a(_0x35ee5f[_0x21c5('0x34')](0x1f4,_0x21c5('0x4c')));}});},'Agents':function(_0x13059f){return new Promise(function(_0x12bd5d){var _0x5e3c7e=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x3f')]);if(_0x13059f&&_0x13059f['id']){var _0x4bf7ff=_[_0x21c5('0x4e')](_0x5e3c7e,function(_0x500ede){return _0x500ede['id']===_0x13059f['id'];});_0x12bd5d(_0x4bf7ff);}else{_0x12bd5d({'count':_0x5e3c7e[_0x21c5('0x16')],'rows':_0x5e3c7e});}});},'ChatQueues':function(){return new Promise(function(_0x2d79e9){var _0x39ea02=[];for(var _0x149b0e in _0x17be3d[_0x21c5('0x4f')]){if(_0x17be3d['chatQueues'][_0x21c5('0x49')](_0x149b0e)){var _0x23a1f0=_0x17be3d[_0x21c5('0x4f')][_0x149b0e];var _0x47bbe6={'id':_0x23a1f0['id'],'available':_0x23a1f0[_0x21c5('0x50')],'loggedIn':_0x23a1f0['loggedIn'],'name':_0x23a1f0[_0x21c5('0x51')],'paused':_0x23a1f0['paused'],'waiting':_0x23a1f0[_0x21c5('0x52')]};_0x39ea02[_0x21c5('0x1e')](_0x47bbe6);}}_0x2d79e9({'count':_0x39ea02[_0x21c5('0x16')],'rows':_0x39ea02});});},'MailQueues':function(){return new Promise(function(_0x14570a){var _0x2b1b13=[];for(var _0x4ae8cc in _0x17be3d[_0x21c5('0x53')]){if(_0x17be3d[_0x21c5('0x53')]['hasOwnProperty'](_0x4ae8cc)){var _0x289844=_0x17be3d[_0x21c5('0x53')][_0x4ae8cc];var _0xd7bf30={'id':_0x289844['id'],'available':_0x289844['available'],'loggedIn':_0x289844[_0x21c5('0x54')],'name':_0x289844[_0x21c5('0x51')],'paused':_0x289844[_0x21c5('0x55')],'waiting':_0x289844[_0x21c5('0x52')]};_0x2b1b13[_0x21c5('0x1e')](_0xd7bf30);}}_0x14570a({'count':_0x2b1b13['length'],'rows':_0x2b1b13});});},'OpenchannelQueues':function(){return new Promise(function(_0x2f85ec){var _0x2f749c=[];for(var _0x5c29bf in _0x17be3d[_0x21c5('0x56')]){if(_0x17be3d[_0x21c5('0x56')][_0x21c5('0x49')](_0x5c29bf)){var _0x1ca34b=_0x17be3d['openchannelQueues'][_0x5c29bf];var _0x150f0f={'id':_0x1ca34b['id'],'available':_0x1ca34b[_0x21c5('0x50')],'loggedIn':_0x1ca34b[_0x21c5('0x54')],'name':_0x1ca34b[_0x21c5('0x51')],'paused':_0x1ca34b['paused'],'waiting':_0x1ca34b['waiting']};_0x2f749c[_0x21c5('0x1e')](_0x150f0f);}}_0x2f85ec({'count':_0x2f749c['length'],'rows':_0x2f749c});});},'SmsQueues':function(){return new Promise(function(_0x5c40af){var _0x385a9b=[];for(var _0x1cf310 in _0x17be3d[_0x21c5('0x57')]){if(_0x17be3d[_0x21c5('0x57')]['hasOwnProperty'](_0x1cf310)){var _0x181636=_0x17be3d['smsQueues'][_0x1cf310];var _0x11bd17={'id':_0x181636['id'],'available':_0x181636[_0x21c5('0x50')],'loggedIn':_0x181636[_0x21c5('0x54')],'name':_0x181636[_0x21c5('0x51')],'paused':_0x181636[_0x21c5('0x55')],'waiting':_0x181636[_0x21c5('0x52')]};_0x385a9b[_0x21c5('0x1e')](_0x11bd17);}}_0x5c40af({'count':_0x385a9b[_0x21c5('0x16')],'rows':_0x385a9b});});},'FaxQueues':function(){return new Promise(function(_0x9dc5e7){var _0x51336d=[];for(var _0x48c7c8 in _0x17be3d[_0x21c5('0x58')]){if(_0x17be3d['faxQueues'][_0x21c5('0x49')](_0x48c7c8)){var _0x4f5003=_0x17be3d[_0x21c5('0x58')][_0x48c7c8];var _0x4380ba={'id':_0x4f5003['id'],'available':_0x4f5003[_0x21c5('0x50')],'loggedIn':_0x4f5003['loggedIn'],'name':_0x4f5003['name'],'paused':_0x4f5003['paused'],'waiting':_0x4f5003[_0x21c5('0x52')]};_0x51336d[_0x21c5('0x1e')](_0x4380ba);}}_0x9dc5e7({'count':_0x51336d[_0x21c5('0x16')],'rows':_0x51336d});});},'WhatsappQueues':function(){return new Promise(function(_0x1f4513){var _0x4241ab=[];for(var _0x1adb95 in _0x17be3d['whatsappQueues']){if(_0x17be3d['whatsappQueues'][_0x21c5('0x49')](_0x1adb95)){var _0x5697a1=_0x17be3d[_0x21c5('0x59')][_0x1adb95];var _0x183bfb={'id':_0x5697a1['id'],'available':_0x5697a1['available'],'loggedIn':_0x5697a1[_0x21c5('0x54')],'name':_0x5697a1[_0x21c5('0x51')],'paused':_0x5697a1['paused'],'waiting':_0x5697a1[_0x21c5('0x52')]};_0x4241ab[_0x21c5('0x1e')](_0x183bfb);}}_0x1f4513({'count':_0x4241ab[_0x21c5('0x16')],'rows':_0x4241ab});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x738b94){var _0x200738=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5a')]);_0x738b94({'count':_0x200738[_0x21c5('0x16')],'rows':_0x200738});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1c145c){var _0x95511a=_['values'](_0x17be3d[_0x21c5('0x5b')]);_0x1c145c({'count':_0x95511a[_0x21c5('0x16')],'rows':_0x95511a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3cdeda){var _0x571bd6=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5c')]);_0x3cdeda({'count':_0x571bd6[_0x21c5('0x16')],'rows':_0x571bd6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1cb3c4){var _0x6dce8f=_[_0x21c5('0x4d')](_0x17be3d['smsQueuesWaitingInteractions']);_0x1cb3c4({'count':_0x6dce8f[_0x21c5('0x16')],'rows':_0x6dce8f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3f1289){var _0x2b3bbb=_['values'](_0x17be3d['faxQueuesWaitingInteractions']);_0x3f1289({'count':_0x2b3bbb[_0x21c5('0x16')],'rows':_0x2b3bbb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5222ab){var _0x49297a=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5d')]);_0x5222ab({'count':_0x49297a['length'],'rows':_0x49297a});});}};var _0x25e753=jayson[_0x21c5('0x5e')](_0x35d2fe)[_0x21c5('0x5f')]();_0x25e753['on'](_0x21c5('0x34'),function(_0x59ad26){logger[_0x21c5('0x34')](JSON[_0x21c5('0x37')](_0x59ad26));return _0x3ba28b(_0x59ad26);});_0x25e753[_0x21c5('0x60')](0x232c,_0x21c5('0x61'),function(){console['log'](_0x21c5('0x62'),0x232c);return _0x4791f7(_0x21c5('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2789487..074d791 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 _0xe6f1=['jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','info','stop','push','format','iftime\x20%s','true','join','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','stack','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe6f1,0x113));var _0x1e6f=function(_0x5eb180,_0x127912){_0x5eb180=_0x5eb180-0x0;var _0xc5f79c=_0xe6f1[_0x5eb180];return _0xc5f79c;};'use strict';var util=require(_0x1e6f('0x0'));var BPromise=require('bluebird');var jayson=require(_0x1e6f('0x1'));var _=require('lodash');var logger=require(_0x1e6f('0x2'))(_0x1e6f('0x3'));var client=jayson[_0x1e6f('0x4')][_0x1e6f('0x5')]({'port':0x232a});function request(_0x25d0be,_0x7f3b38){return new BPromise(function(_0x11858a,_0x15c6e2){return client[_0x1e6f('0x6')](_0x25d0be,_0x7f3b38)[_0x1e6f('0x7')](function(_0x42ee7a){if(_0x42ee7a['error']){return _0x15c6e2(_0x42ee7a[_0x1e6f('0x8')][_0x1e6f('0x9')]);}else{return _0x11858a(_0x42ee7a[_0x1e6f('0xa')]);}})[_0x1e6f('0xb')](function(_0x4b5d03){return _0x15c6e2(_0x4b5d03);});});}exports[_0x1e6f('0xc')]=function(_0x5c1378,_0x24275b,_0x3ce7bc){return function(_0x86adf1){if(_0x3ce7bc['rules']&&!_0x3ce7bc['rules'][_0x5c1378]){logger[_0x1e6f('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5c1378);return _0x86adf1[_0x1e6f('0xe')]();}var _0x24fa7c=[];for(var _0x2a3b06=0x0;_0x2a3b06<_0x24275b['length'];_0x2a3b06+=0x1){_0x24fa7c[_0x1e6f('0xf')](request('Command',{'command':util[_0x1e6f('0x10')](_0x1e6f('0x11'),_0x24275b[_0x2a3b06])})[_0x1e6f('0x7')](function(_0xb834bd){return _0xb834bd&&_0xb834bd[_0x1e6f('0x9')]&&_0xb834bd[_0x1e6f('0x9')]['indexOf'](_0x1e6f('0x12'))>=0x0?!![]:![];})[_0x1e6f('0xb')](function(){logger[_0x1e6f('0x8')]('[%s][INTERVAL]\x20%s',_0x5c1378,_0x24275b[_0x2a3b06]);}));}BPromise['all'](_0x24fa7c)[_0x1e6f('0x7')](function(_0x2e5ae6){var _0x1ea890=_['some'](_0x2e5ae6);logger[_0x1e6f('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x5c1378,_0x24275b[_0x1e6f('0x13')](_0x1e6f('0x14')),_0x1ea890);_0x86adf1['when'](_0x1ea890);})[_0x1e6f('0xb')](function(_0x1825c0){logger[_0x1e6f('0x8')](_0x1e6f('0x15'),_0x5c1378,_0x24275b[_0x1e6f('0x13')](_0x1e6f('0x14')),_0x1825c0[_0x1e6f('0x16')]);_0x86adf1[_0x1e6f('0xe')]();});};}; \ No newline at end of file +var _0x0c66=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x0c66,0xd8));var _0x60c6=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0c66[_0x500419];return _0x241c1a;};'use strict';var util=require(_0x60c6('0x0'));var BPromise=require(_0x60c6('0x1'));var jayson=require(_0x60c6('0x2'));var _=require(_0x60c6('0x3'));var logger=require(_0x60c6('0x4'))(_0x60c6('0x5'));var client=jayson[_0x60c6('0x6')]['http']({'port':0x232a});function request(_0x44429c,_0x5a2943){return new BPromise(function(_0x2c3d9c,_0x4069cc){return client[_0x60c6('0x7')](_0x44429c,_0x5a2943)[_0x60c6('0x8')](function(_0x1b9abb){if(_0x1b9abb['error']){return _0x4069cc(_0x1b9abb[_0x60c6('0x9')]['message']);}else{return _0x2c3d9c(_0x1b9abb['result']);}})[_0x60c6('0xa')](function(_0x36c8d4){return _0x4069cc(_0x36c8d4);});});}exports[_0x60c6('0xb')]=function(_0x9aea1a,_0x331a52,_0x2b36f0){return function(_0x396e7e){if(_0x2b36f0[_0x60c6('0xc')]&&!_0x2b36f0[_0x60c6('0xc')][_0x9aea1a]){logger[_0x60c6('0xd')](_0x60c6('0xe'),_0x9aea1a);return _0x396e7e[_0x60c6('0xf')]();}var _0x256f5d=[];for(var _0x5cab58=0x0;_0x5cab58<_0x331a52[_0x60c6('0x10')];_0x5cab58+=0x1){_0x256f5d[_0x60c6('0x11')](request(_0x60c6('0x12'),{'command':util[_0x60c6('0x13')](_0x60c6('0x14'),_0x331a52[_0x5cab58])})[_0x60c6('0x8')](function(_0x1a2bc9){return _0x1a2bc9&&_0x1a2bc9[_0x60c6('0x15')]&&_0x1a2bc9['message'][_0x60c6('0x16')](_0x60c6('0x17'))>=0x0?!![]:![];})['catch'](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x9aea1a,_0x331a52[_0x5cab58]);}));}BPromise[_0x60c6('0x18')](_0x256f5d)['then'](function(_0x116fdf){var _0x2f89e8=_[_0x60c6('0x19')](_0x116fdf);logger[_0x60c6('0xd')](_0x60c6('0x1a'),_0x9aea1a,_0x331a52[_0x60c6('0x1b')]('\x20|\x20'),_0x2f89e8);_0x396e7e[_0x60c6('0x1c')](_0x2f89e8);})[_0x60c6('0xa')](function(_0x1281db){logger[_0x60c6('0x9')](_0x60c6('0x1a'),_0x9aea1a,_0x331a52[_0x60c6('0x1b')](_0x60c6('0x1d')),_0x1281db[_0x60c6('0x1e')]);_0x396e7e[_0x60c6('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 048222b..62e3dfd 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 _0x0102=['agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]'];(function(_0x43b407,_0x3e0426){var _0x405d10=function(_0x109b8a){while(--_0x109b8a){_0x43b407['push'](_0x43b407['shift']());}};_0x405d10(++_0x3e0426);}(_0x0102,0x186));var _0x2010=function(_0x13f73b,_0x114836){_0x13f73b=_0x13f73b-0x0;var _0x56b4bd=_0x0102[_0x13f73b];return _0x56b4bd;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c31e,_0x9ae519){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34c31e['uniqueid'],_0x34c31e['channel'],_0x34c31e[_0x2010('0x2')],_0x34c31e[_0x2010('0x3')],_0x34c31e[_0x2010('0x4')],_0x34c31e[_0x2010('0x5')],_0x34c31e['connectedlinenum'],_0x34c31e[_0x2010('0x6')]));if(_0x34c31e['queue']){utils[_0x2010('0x7')](_0x34c31e[_0x2010('0x2')])['then'](function(_0x1f94ca){if(_0x1f94ca){_0x34c31e[_0x2010('0x8')]=_0x1f94ca[_0x2010('0x8')];_0x34c31e[_0x2010('0x9')]=_0x34c31e[_0x2010('0xa')]?_0x1f94ca[_0x2010('0xb')]:![];_0x34c31e[_0x2010('0xc')]=_0x34c31e[_0x2010('0x9')]?_0x1f94ca[_0x2010('0xd')]:0x0;}utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);});}else{utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);}if(_0x9ae519){delete transfers[_0x34c31e[_0x2010('0x10')]];}else{delete agents[_0x34c31e[_0x2010('0x11')]];}}exports[_0x2010('0x12')]=function(_0x528a38){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38[_0x2010('0x10')]),_0x528a38);agents[_0x528a38[_0x2010('0x11')]]=_0x528a38;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x15')]=utils['now']();agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x6')]='called';agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x16')]=null;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x17')]=null;utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x19'),_0x528a38[_0x2010('0x10')],agents[_0x528a38[_0x2010('0x11')]]['membername'],_0x528a38['destuniqueid']));}catch(_0x3c72a8){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38['uniqueid']),_0x3c72a8);}};exports['agentringnoanswer']=function(_0x22c252){try{if(!_[_0x2010('0x1b')](agents[_0x22c252[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x1d'),_0x22c252['uniqueid']),_0x22c252);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22c252['uniqueid'],agents[_0x22c252['destuniqueid']][_0x2010('0x3')],_0x22c252['destuniqueid']));agents[_0x22c252[_0x2010('0x11')]]['agentringnoanswer']=!![];agents[_0x22c252['destuniqueid']][_0x2010('0x1e')]=utils[_0x2010('0x1f')]();agents[_0x22c252['destuniqueid']][_0x2010('0x6')]='timeout';agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x20')]=_0x2010('0x21');agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x22')]=_0x22c252[_0x2010('0x23')]?parseInt(_0x22c252[_0x2010('0x23')])/0x3e8:0x0;agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x24')]=0x0;unanswered[_0x2010('0x25')](_0x22c252[_0x2010('0x11')]);}}catch(_0x2ebdbb){utils['error'](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]',_0x22c252[_0x2010('0x10')]),_0x2ebdbb);}};exports[_0x2010('0x26')]=function(_0xd16c04){try{_[_0x2010('0x27')](agents,function(_0x564a64,_0x554f66){if(_0x564a64[_0x2010('0x10')]==_0xd16c04['uniqueid']&&!_[_0x2010('0x28')](unanswered,_0x564a64[_0x2010('0x11')])){utils['debug'](util[_0x2010('0x13')](_0x2010('0x29'),_0xd16c04[_0x2010('0x10')]),_0xd16c04);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd16c04[_0x2010('0x10')],_0x564a64[_0x2010('0x3')],_0x564a64[_0x2010('0x11')]));_0x564a64['agentringnoanswer']=!![];_0x564a64['agentringnoanswerAt']=utils[_0x2010('0x1f')]();_0x564a64[_0x2010('0x6')]=_0x2010('0x2a');_0x564a64['reason']='abandoned';_0x564a64[_0x2010('0x22')]=_0xd16c04[_0x2010('0x22')];_0x564a64[_0x2010('0x24')]=0x0;writeDB(_0x564a64);}});}catch(_0x339fd2){utils[_0x2010('0x1a')](util['format']('[%s][agents][queuecallerabandon]',_0xd16c04['uniqueid']),_0x339fd2);}};exports[_0x2010('0x2b')]=function(_0x447eed){try{if(agents[_0x447eed[_0x2010('0x11')]]){utils['debug'](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x447eed);utils[_0x2010('0x18')](util['format'](_0x2010('0x2d'),_0x447eed[_0x2010('0x10')],agents[_0x447eed[_0x2010('0x11')]]['membername'],_0x447eed[_0x2010('0x11')]));agents[_0x447eed['destuniqueid']][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x16')]=_0x447eed[_0x2010('0x16')];agents[_0x447eed[_0x2010('0x11')]]['connectedlinename']=_0x447eed[_0x2010('0x17')];agents[_0x447eed['destuniqueid']][_0x2010('0x22')]=_0x447eed[_0x2010('0x23')];agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x2f');_[_0x2010('0x27')](agents,function(_0x398f10,_0x36ff3e){if(_0x398f10[_0x2010('0x11')]!=_0x447eed[_0x2010('0x11')]&&_0x398f10[_0x2010('0x10')]==_0x447eed[_0x2010('0x10')]){_0x398f10[_0x2010('0x24')]=0x0;_0x398f10[_0x2010('0x22')]=_0x447eed['ringtime'];_0x398f10['agentringnoanswer']=!![];_0x398f10[_0x2010('0x1e')]=utils[_0x2010('0x1f')]();_0x398f10[_0x2010('0x6')]=_0x2010('0x30');_0x398f10[_0x2010('0x20')]=_0x2010('0x30');_0x398f10[_0x2010('0x31')]=_0x447eed['destuniqueid'];_0x398f10[_0x2010('0x32')]=_0x447eed['membername'];writeDB(_0x398f10);}});}}catch(_0x27fd64){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x27fd64);}};exports['agentcomplete']=function(_0x364338){try{if(!_[_0x2010('0x1b')](agents[_0x364338[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util['format'](_0x2010('0x33'),_0x364338['uniqueid']),_0x364338);utils['info'](util['format'](_0x2010('0x34'),_0x364338[_0x2010('0x10')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x3')],_0x364338[_0x2010('0x11')]));agents[_0x364338[_0x2010('0x11')]]['agentcomplete']=!![];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();agents[_0x364338['destuniqueid']]['talktime']=utils[_0x2010('0x36')](agents[_0x364338['destuniqueid']][_0x2010('0x35')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x2e')]);agents[_0x364338[_0x2010('0x11')]]['reason']=_0x364338[_0x2010('0x20')];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x37');writeDB(agents[_0x364338[_0x2010('0x11')]]);}}catch(_0x2a53b3){utils['error'](util[_0x2010('0x13')](_0x2010('0x33'),_0x364338[_0x2010('0x10')]),_0x2a53b3);}};exports['blindtransfer']=function(_0x30e5d0){try{if(!_[_0x2010('0x1b')](agents[_0x30e5d0['transfereruniqueid']])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x30e5d0);utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x39'),_0x30e5d0[_0x2010('0x10')],agents[_0x30e5d0['transfereruniqueid']]['membername'],agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')]));agents[_0x30e5d0['transfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3c')]=_0x2010('0x3d');agents[_0x30e5d0[_0x2010('0x3a')]]['transferexten']=_0x30e5d0['extension'];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3e')]=agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')];}}catch(_0x38e596){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x38e596);}};exports[_0x2010('0x3f')]=function(_0x1cc164){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x40'),_0x1cc164['origtransfereruniqueid']),_0x1cc164);if(_0x1cc164[_0x2010('0x41')]==_0x1cc164[_0x2010('0x42')]){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x43')]])){utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3')]));agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3b')]=!![];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x46')]=_0x1cc164[_0x2010('0x47')];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3e')]=_0x1cc164[_0x2010('0x41')];}if(_0x1cc164[_0x2010('0x48')]&&agents[_0x1cc164[_0x2010('0x48')]]){agents[_0x1cc164['transfereeuniqueid']][_0x2010('0x49')]=0x1;transfers[_0x1cc164['transfereeuniqueid']]=_['clone'](agents[_0x1cc164[_0x2010('0x48')]]);transfers[_0x1cc164[_0x2010('0x48')]]['calleridnum']=agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x4a')]=agents[_0x1cc164['secondtransfereruniqueid']][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x15')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164['transfereeuniqueid']][_0x2010('0x2e')]=utils['now']();transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x49')]=0x2;}}else if(_0x1cc164['secondtransfereruniqueid']==_0x1cc164['secondtransfererlinkedid']){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x41')]])){utils['info'](util['format'](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3')]));agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x46')]=_0x1cc164['secondtransfererexten'];agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3e')]=_0x1cc164['secondtransfereruniqueid'];}if(_0x1cc164[_0x2010('0x4b')]&&agents[_0x1cc164[_0x2010('0x4b')]]){agents[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x49')]=0x1;transfers[_0x1cc164[_0x2010('0x4b')]]=_[_0x2010('0x4c')](agents[_0x1cc164[_0x2010('0x4b')]]);transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x5')]=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x4b')]]['calleridname']=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x4b')]]['agententerreason']=0x2;}}}catch(_0xe37cef){utils[_0x2010('0x1a')](util[_0x2010('0x13')]('[%s][agents][attendedtransfer]',_0x1cc164[_0x2010('0x41')]),_0xe37cef);}};exports[_0x2010('0x4d')]=function(_0x13d06d){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x4e'),_0x13d06d['uniqueid']),_0x13d06d);if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]]['reason']==='timeout'){if(_0x13d06d[_0x2010('0x4f')]==='21'){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')]=_0x2010('0x50');agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x50');}utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3')],agents[_0x13d06d['uniqueid']][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d[_0x2010('0x10')]]);var _0x517afa=unanswered[_0x2010('0x52')](_0x13d06d[_0x2010('0x10')]);if(_0x517afa>-0x1){unanswered['splice'](_0x517afa,0x1);}}if(transfers[_0x13d06d['uniqueid']]){transfers[_0x13d06d[_0x2010('0x10')]]['agentcomplete']=!![];transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x24')]=utils[_0x2010('0x36')](transfers[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]);transfers[_0x13d06d[_0x2010('0x10')]]['reason']=_0x2010('0x53');transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d[_0x2010('0x10')],transfers[_0x13d06d['uniqueid']][_0x2010('0x3')],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],transfers[_0x13d06d['uniqueid']][_0x2010('0x6')]));writeDB(transfers[_0x13d06d[_0x2010('0x10')]],!![]);}if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0xa')]=!![];agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt']=utils[_0x2010('0x1f')]();agents[_0x13d06d[_0x2010('0x10')]]['talktime']=utils[_0x2010('0x36')](agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],agents[_0x13d06d[_0x2010('0x10')]]['agentconnectAt']);agents[_0x13d06d['uniqueid']][_0x2010('0x20')]=agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3b')]?_0x2010('0x3b'):_0x2010('0x53');agents[_0x13d06d[_0x2010('0x10')]]['lastevent']=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]]['membername'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d['uniqueid']]);}}catch(_0x496280){utils['error'](util[_0x2010('0x13')]('[%s][agents][hangup]',_0x13d06d[_0x2010('0x10')]),_0x496280);}}; \ No newline at end of file +var _0x57f8=['agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','isNil','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','[%s][agents][hangup]','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x57f8,0x198));var _0x857f=function(_0x52b828,_0x359d0f){_0x52b828=_0x52b828-0x0;var _0x2721d8=_0x57f8[_0x52b828];return _0x2721d8;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var utils=require(_0x857f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e6e52,_0x3c0125){utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x4'),_0x1e6e52[_0x857f('0x5')],_0x1e6e52[_0x857f('0x6')],_0x1e6e52[_0x857f('0x7')],_0x1e6e52[_0x857f('0x8')],_0x1e6e52[_0x857f('0x9')],_0x1e6e52['calleridnum'],_0x1e6e52[_0x857f('0xa')],_0x1e6e52[_0x857f('0xb')]));if(_0x1e6e52[_0x857f('0x7')]){utils['getVoiceQueueByName'](_0x1e6e52[_0x857f('0x7')])[_0x857f('0xc')](function(_0x960b76){if(_0x960b76){_0x1e6e52['type']=_0x960b76[_0x857f('0xd')];_0x1e6e52[_0x857f('0xe')]=_0x1e6e52[_0x857f('0xf')]?_0x960b76['acw']:![];_0x1e6e52[_0x857f('0x10')]=_0x1e6e52[_0x857f('0xe')]?_0x960b76[_0x857f('0x11')]:0x0;}utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);});}else{utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);}if(_0x3c0125){delete transfers[_0x1e6e52['uniqueid']];}else{delete agents[_0x1e6e52[_0x857f('0x14')]];}}exports[_0x857f('0x15')]=function(_0x373333){try{utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333['uniqueid']),_0x373333);agents[_0x373333[_0x857f('0x14')]]=_0x373333;agents[_0x373333['destuniqueid']][_0x857f('0x17')]=utils['now']();agents[_0x373333[_0x857f('0x14')]][_0x857f('0xb')]='called';agents[_0x373333[_0x857f('0x14')]][_0x857f('0xa')]=null;agents[_0x373333[_0x857f('0x14')]][_0x857f('0x18')]=null;utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x19'),_0x373333[_0x857f('0x5')],agents[_0x373333[_0x857f('0x14')]][_0x857f('0x8')],_0x373333[_0x857f('0x14')]));}catch(_0x59e0e1){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333[_0x857f('0x5')]),_0x59e0e1);}};exports[_0x857f('0x1b')]=function(_0x377587){try{if(!_['isNil'](agents[_0x377587['destuniqueid']])){utils[_0x857f('0x16')](util[_0x857f('0x3')](_0x857f('0x1c'),_0x377587['uniqueid']),_0x377587);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x1d'),_0x377587['uniqueid'],agents[_0x377587[_0x857f('0x14')]][_0x857f('0x8')],_0x377587['destuniqueid']));agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1b')]=!![];agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1e')]=utils[_0x857f('0x1f')]();agents[_0x377587[_0x857f('0x14')]][_0x857f('0xb')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x21')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x22')]=_0x377587[_0x857f('0x23')]?parseInt(_0x377587['ringtime'])/0x3e8:0x0;agents[_0x377587[_0x857f('0x14')]][_0x857f('0x24')]=0x0;unanswered[_0x857f('0x25')](_0x377587[_0x857f('0x14')]);}}catch(_0x58c2de){utils[_0x857f('0x1a')](util['format'](_0x857f('0x1c'),_0x377587[_0x857f('0x5')]),_0x58c2de);}};exports[_0x857f('0x26')]=function(_0x2ab814){try{_[_0x857f('0x27')](agents,function(_0x464e8f,_0x1c4fff){if(_0x464e8f[_0x857f('0x5')]==_0x2ab814[_0x857f('0x5')]&&!_[_0x857f('0x28')](unanswered,_0x464e8f[_0x857f('0x14')])){utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][queuecallerabandon]',_0x2ab814[_0x857f('0x5')]),_0x2ab814);utils[_0x857f('0x2')](util['format'](_0x857f('0x29'),_0x2ab814[_0x857f('0x5')],_0x464e8f['membername'],_0x464e8f[_0x857f('0x14')]));_0x464e8f[_0x857f('0x1b')]=!![];_0x464e8f['agentringnoanswerAt']=utils[_0x857f('0x1f')]();_0x464e8f[_0x857f('0xb')]=_0x857f('0x2a');_0x464e8f[_0x857f('0x21')]='abandoned';_0x464e8f['holdtime']=_0x2ab814[_0x857f('0x22')];_0x464e8f[_0x857f('0x24')]=0x0;writeDB(_0x464e8f);}});}catch(_0x4c88fa){utils[_0x857f('0x1a')](util['format'](_0x857f('0x2b'),_0x2ab814[_0x857f('0x5')]),_0x4c88fa);}};exports[_0x857f('0x2c')]=function(_0x438ff1){try{if(agents[_0x438ff1[_0x857f('0x14')]]){utils['debug'](util['format'](_0x857f('0x2d'),_0x438ff1['uniqueid']),_0x438ff1);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x2e'),_0x438ff1['uniqueid'],agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x8')],_0x438ff1[_0x857f('0x14')]));agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();agents[_0x438ff1[_0x857f('0x14')]]['connectedlinenum']=_0x438ff1[_0x857f('0xa')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x18')]=_0x438ff1[_0x857f('0x18')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];agents[_0x438ff1['destuniqueid']][_0x857f('0xb')]=_0x857f('0x30');_[_0x857f('0x27')](agents,function(_0xc2ac41,_0x196c95){if(_0xc2ac41[_0x857f('0x14')]!=_0x438ff1['destuniqueid']&&_0xc2ac41[_0x857f('0x5')]==_0x438ff1[_0x857f('0x5')]){_0xc2ac41[_0x857f('0x24')]=0x0;_0xc2ac41[_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];_0xc2ac41[_0x857f('0x1b')]=!![];_0xc2ac41[_0x857f('0x1e')]=utils[_0x857f('0x1f')]();_0xc2ac41['lastevent']=_0x857f('0x31');_0xc2ac41[_0x857f('0x21')]=_0x857f('0x31');_0xc2ac41[_0x857f('0x32')]=_0x438ff1[_0x857f('0x14')];_0xc2ac41[_0x857f('0x33')]=_0x438ff1[_0x857f('0x8')];writeDB(_0xc2ac41);}});}}catch(_0x42d922){utils[_0x857f('0x1a')](util[_0x857f('0x3')](_0x857f('0x2d'),_0x438ff1[_0x857f('0x5')]),_0x42d922);}};exports[_0x857f('0xf')]=function(_0x376f71){try{if(!_['isNil'](agents[_0x376f71[_0x857f('0x14')]])){utils['debug'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x376f71);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x35'),_0x376f71[_0x857f('0x5')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x8')],_0x376f71[_0x857f('0x14')]));agents[_0x376f71[_0x857f('0x14')]]['agentcomplete']=!![];agents[_0x376f71['destuniqueid']][_0x857f('0x36')]=utils['now']();agents[_0x376f71[_0x857f('0x14')]]['talktime']=utils[_0x857f('0x37')](agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x36')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x2f')]);agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x21')]=_0x376f71[_0x857f('0x21')];agents[_0x376f71['destuniqueid']][_0x857f('0xb')]=_0x857f('0x38');writeDB(agents[_0x376f71[_0x857f('0x14')]]);}}catch(_0x19c967){utils['error'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x19c967);}};exports[_0x857f('0x39')]=function(_0x67563){try{if(!_['isNil'](agents[_0x67563[_0x857f('0x3a')]])){utils[_0x857f('0x16')](util['format'](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x67563);utils['info'](util[_0x857f('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x67563[_0x857f('0x5')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x8')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')]));agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3c')]=!![];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3d')]=_0x857f('0x3e');agents[_0x67563['transfereruniqueid']][_0x857f('0x3f')]=_0x67563[_0x857f('0x40')];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x41')]=agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')];}}catch(_0x12712a){utils['error'](util[_0x857f('0x3')](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x12712a);}};exports[_0x857f('0x42')]=function(_0x22eab9){try{utils[_0x857f('0x16')](util['format'](_0x857f('0x43'),_0x22eab9[_0x857f('0x44')]),_0x22eab9);if(_0x22eab9[_0x857f('0x44')]==_0x22eab9[_0x857f('0x45')]){if(!_[_0x857f('0x46')](agents[_0x22eab9[_0x857f('0x47')]])){utils[_0x857f('0x2')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x22eab9['origtransfereruniqueid'],agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x8')]));agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3f')]=_0x22eab9['origtransfererexten'];agents[_0x22eab9[_0x857f('0x47')]]['transferuniqueid']=_0x22eab9[_0x857f('0x44')];}if(_0x22eab9[_0x857f('0x48')]&&agents[_0x22eab9['transfereeuniqueid']]){agents[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x48')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x48')]]);transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4b')]=agents[_0x22eab9[_0x857f('0x47')]]['calleridnum'];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x17')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]]['holdtime']=0x0;transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x2;}}else if(_0x22eab9[_0x857f('0x47')]==_0x22eab9[_0x857f('0x4d')]){if(!_['isNil'](agents[_0x22eab9[_0x857f('0x44')]])){utils['info'](util[_0x857f('0x3')](_0x857f('0x4e'),_0x22eab9[_0x857f('0x44')],agents[_0x22eab9[_0x857f('0x44')]]['membername']));agents[_0x22eab9['origtransfereruniqueid']][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x44')]]['transferexten']=_0x22eab9[_0x857f('0x4f')];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x41')]=_0x22eab9['secondtransfereruniqueid'];}if(_0x22eab9['transfertargetuniqueid']&&agents[_0x22eab9[_0x857f('0x50')]]){agents[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x50')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x50')]]);transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4b')]=agents[_0x22eab9['origtransfereruniqueid']]['calleridnum'];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x17')]=utils['now']();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x22')]=0x0;transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x2;}}}catch(_0x39ad7c){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]',_0x22eab9[_0x857f('0x44')]),_0x39ad7c);}};exports['hangup']=function(_0x5ec513){try{utils[_0x857f('0x16')](util['format']('[%s][agents][hangup]',_0x5ec513[_0x857f('0x5')]),_0x5ec513);if(agents[_0x5ec513['uniqueid']]&&agents[_0x5ec513[_0x857f('0x5')]]['reason']===_0x857f('0x20')){if(_0x5ec513[_0x857f('0x51')]==='21'){agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]='rejected';agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x52');}utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513['uniqueid']]['membername'],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);var _0x2d7d33=unanswered['indexOf'](_0x5ec513[_0x857f('0x5')]);if(_0x2d7d33>-0x1){unanswered[_0x857f('0x54')](_0x2d7d33,0x1);}}if(transfers[_0x5ec513[_0x857f('0x5')]]){transfers[_0x5ec513['uniqueid']]['agentcomplete']=!![];transfers[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x24')]=utils['diffTime'](transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x36')],transfers[_0x5ec513['uniqueid']][_0x857f('0x2f')]);transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]=_0x857f('0x55');transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],transfers[_0x5ec513[_0x857f('0x5')]]['membername'],transfers[_0x5ec513['uniqueid']]['reason'],transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(transfers[_0x5ec513[_0x857f('0x5')]],!![]);}if(agents[_0x5ec513[_0x857f('0x5')]]&&agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]){agents[_0x5ec513[_0x857f('0x5')]]['agentcomplete']=!![];agents[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils[_0x857f('0x1f')]();agents[_0x5ec513['uniqueid']]['talktime']=utils[_0x857f('0x37')](agents[_0x5ec513['uniqueid']][_0x857f('0x36')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]);agents[_0x5ec513['uniqueid']][_0x857f('0x21')]=agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x3c')]?_0x857f('0x3c'):_0x857f('0x55');agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util['format'](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x8')],agents[_0x5ec513['uniqueid']][_0x857f('0x21')],agents[_0x5ec513['uniqueid']][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);}}catch(_0x15df2f){utils[_0x857f('0x1a')](util['format'](_0x857f('0x56'),_0x5ec513['uniqueid']),_0x15df2f);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 797eafb..3315037 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 _0x387e=['\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','execif','gotoif','lastapplication','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone'];(function(_0x2cd689,_0x246e08){var _0x5a62f8=function(_0x6e8532){while(--_0x6e8532){_0x2cd689['push'](_0x2cd689['shift']());}};_0x5a62f8(++_0x246e08);}(_0x387e,0x1b2));var _0xe387=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x387e[_0x8afdd0];return _0x3de7ac;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xe387('0x0'));var dispositions=[_0xe387('0x1'),_0xe387('0x2'),_0xe387('0x2'),'NO\x20ANSWER',_0xe387('0x1'),_0xe387('0x1'),'ANSWERED',_0xe387('0x3'),'FAILED',_0xe387('0x2'),_0xe387('0x2')];var channels={};function writeDB(_0x31cfe7){utils[_0xe387('0x4')](util[_0xe387('0x5')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x31cfe7[_0xe387('0x6')],_0x31cfe7[_0xe387('0x7')],_0x31cfe7['queue'],_0x31cfe7[_0xe387('0x8')],_0x31cfe7[_0xe387('0x9')],_0x31cfe7['calleridnum'],_0x31cfe7[_0xe387('0xa')],_0x31cfe7[_0xe387('0xb')]));if(_0x31cfe7[_0xe387('0xc')]){utils[_0xe387('0xd')](_0x31cfe7[_0xe387('0xc')])['then'](function(_0x1e0882){if(_0x1e0882){_0x31cfe7[_0xe387('0xe')]=_0x1e0882['id'];}utils['request'](_0xe387('0xf'),_0x31cfe7);});}else{utils[_0xe387('0x10')](_0xe387('0xf'),_0x31cfe7);}if(channels[_0x31cfe7[_0xe387('0x6')]]){delete channels[_0x31cfe7[_0xe387('0x6')]];}}exports[_0xe387('0x11')]=function(_0x43f1d9){try{utils[_0xe387('0x12')](util['format']('[%s][calls][newchannel]',_0x43f1d9['uniqueid']),_0x43f1d9);if(_0x43f1d9[_0xe387('0x6')]==_0x43f1d9[_0xe387('0x13')]&&_0x43f1d9[_0xe387('0x7')]!=_0xe387('0x14')){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x15'),_0x43f1d9[_0xe387('0x6')],_0x43f1d9['context'],_0x43f1d9[_0xe387('0x16')]));channels[_0x43f1d9[_0xe387('0x6')]]={'uniqueid':_0x43f1d9[_0xe387('0x6')],'accountcode':_0x43f1d9[_0xe387('0xc')],'source':_0x43f1d9[_0xe387('0x17')],'destination':_0x43f1d9[_0xe387('0x16')],'destinationcontext':_0x43f1d9[_0xe387('0x18')],'channel':_0x43f1d9[_0xe387('0x7')],'starttime':utils[_0xe387('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe387('0x1'),'amaflags':_0xe387('0x1a')};}}catch(_0x9fd806){utils[_0xe387('0x1b')](util[_0xe387('0x5')]('[%s][calls][newchannel]',_0x43f1d9['uniqueid']),_0x9fd806);}};exports[_0xe387('0x1c')]=function(_0x3f73a6){try{utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x1d'),_0x3f73a6[_0xe387('0x6')]),_0x3f73a6);if(!_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x6')]])&&_0x3f73a6[_0xe387('0x1f')]==0x6){utils[_0xe387('0x4')](util[_0xe387('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3f73a6[_0xe387('0x6')],_0x3f73a6['context'],_0x3f73a6['channel']));if(_['isNil'](channels[_0x3f73a6['uniqueid']][_0xe387('0x20')])){channels[_0x3f73a6['uniqueid']][_0xe387('0x20')]=utils['now']();}}else if(!_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x13')]])&&_0x3f73a6[_0xe387('0x1f')]==0x6&&_0x3f73a6[_0xe387('0x18')]!=_0xe387('0x21')){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x22'),_0x3f73a6['uniqueid'],_0x3f73a6['linkedid'],_0x3f73a6[_0xe387('0x18')],_0x3f73a6['channel']));channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0xc')]=_0x3f73a6[_0xe387('0xc')];channels[_0x3f73a6['linkedid']][_0xe387('0x23')]=_0x3f73a6[_0xe387('0x7')];if(_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x24')])){channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x24')]=utils[_0xe387('0x19')]();}channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x25')]=dispositions[_[_0xe387('0x26')](_0x3f73a6[_0xe387('0x1f')])]||'ANSWERED';}}catch(_0x18d81d){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x1d'),_0x3f73a6[_0xe387('0x6')]),_0x18d81d);}};exports['hangup']=function(_0xa23cba){try{if(!_[_0xe387('0x1e')](channels[_0xa23cba['uniqueid']])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x27'),_0xa23cba['uniqueid']),_0xa23cba);if(_[_0xe387('0x1e')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x28')])){channels[_0xa23cba[_0xe387('0x6')]]['callerid']=_0xa23cba[_0xe387('0x29')]+'\x20<'+_0xa23cba[_0xe387('0x17')]+'>';}utils['info'](util[_0xe387('0x5')](_0xe387('0x2a'),_0xa23cba['uniqueid'],channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x28')],_0xa23cba[_0xe387('0x2b')]));channels[_0xa23cba['uniqueid']][_0xe387('0x2c')]=utils[_0xe387('0x19')]();channels[_0xa23cba[_0xe387('0x6')]]['duration']=utils[_0xe387('0x2d')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2c')],channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2e')]);channels[_0xa23cba['uniqueid']]['billableseconds']=channels[_0xa23cba['uniqueid']][_0xe387('0x24')]?utils[_0xe387('0x2d')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2c')],channels[_0xa23cba[_0xe387('0x6')]]['answertime']):0x0;writeDB(channels[_0xa23cba[_0xe387('0x6')]]);}}catch(_0x2378ff){utils[_0xe387('0x1b')](util[_0xe387('0x5')]('[%s][calls][hangup]',_0xa23cba[_0xe387('0x6')]),_0x2378ff);}};exports['attendedtransfer']=function(_0x1c1827){try{if(!_[_0xe387('0x1e')](channels[_0x1c1827[_0xe387('0x2f')]])){utils['debug'](util[_0xe387('0x5')]('[%s][calls][attendedtransfer]',_0x1c1827['origtransfereruniqueid']),_0x1c1827);if(channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x7')]==_0x1c1827[_0xe387('0x30')]){utils['info'](util['format'](_0xe387('0x31'),_0x1c1827[_0xe387('0x32')],_0x1c1827[_0xe387('0x2f')],_0x1c1827['secondtransfererchannel']));channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x23')]=_0x1c1827['secondtransfererchannel'];channels[_0x1c1827[_0xe387('0x2f')]]['userfield']=_0xe387('0x33');}else if(channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x7')]=_0x1c1827[_0xe387('0x34')]){utils['info'](util[_0xe387('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1c1827[_0xe387('0x32')],_0x1c1827[_0xe387('0x2f')],_0x1c1827[_0xe387('0x35')]));channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x23')]=_0x1c1827[_0xe387('0x35')];channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x36')]=_0xe387('0x33');}}}catch(_0x32f506){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x37'),_0x1c1827[_0xe387('0x32')]),_0x32f506);}};exports[_0xe387('0x38')]=function(_0x30db11){try{if(!_['isNil'](channels[_0x30db11[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x39'),_0x30db11['uniqueid']),_0x30db11);channels[_0x30db11[_0xe387('0x6')]][_0xe387('0x3a')]=utils[_0xe387('0x19')]();utils['info'](util[_0xe387('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x30db11[_0xe387('0x6')],channels[_0x30db11[_0xe387('0x6')]]['musiconholdstartAt']));}}catch(_0x1af1eb){utils['error'](util['format'](_0xe387('0x39'),_0x30db11[_0xe387('0x6')]),_0x1af1eb);}};exports[_0xe387('0x3b')]=function(_0x43d437){try{if(!_[_0xe387('0x1e')](channels[_0x43d437[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x3c'),_0x43d437[_0xe387('0x6')]),_0x43d437);if(!_[_0xe387('0x1e')](channels[_0x43d437['uniqueid']][_0xe387('0x3a')])){channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3d')]+=utils[_0xe387('0x2d')](utils[_0xe387('0x19')](),channels[_0x43d437['uniqueid']][_0xe387('0x3a')]);utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x3e'),_0x43d437[_0xe387('0x6')],channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3d')]));delete channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3a')];}}}catch(_0x52e276){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x3c'),_0x43d437['uniqueid']),_0x52e276);}};exports[_0xe387('0x3f')]=function(_0x2ae807){try{if(!_[_0xe387('0x1e')](channels[_0x2ae807[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x40'),_0x2ae807[_0xe387('0x6')]),_0x2ae807);if(!_['isNil'](_0x2ae807[_0xe387('0x41')][_0xe387('0x42')])){utils['info'](util[_0xe387('0x5')](_0xe387('0x43'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x45')]=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x46')])){utils[_0xe387('0x4')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2ae807['uniqueid'],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['destination']=_0x2ae807['value'];channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x28')]='\x22'+_0x2ae807[_0xe387('0x44')]+_0xe387('0x47')+_0x2ae807[_0xe387('0x44')]+'>';}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x48')])||!_['isNil'](_0x2ae807['variable'][_0xe387('0x49')])){utils[_0xe387('0x4')](util['format'](_0xe387('0x4a'),_0x2ae807[_0xe387('0x6')],!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xe387('0x49'),_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x28')]=_0x2ae807['value'];}if(!_[_0xe387('0x1e')](_0x2ae807['variable'][_0xe387('0x4b')])||!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x4c')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x4a'),_0x2ae807[_0xe387('0x6')],!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['xmd-queue'])?_0xe387('0x4b'):'xmcs-queue',_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807['uniqueid']]['lastapplication']=_0xe387('0x4d');channels[_0x2ae807[_0xe387('0x6')]]['lastdata']=_0x2ae807[_0xe387('0x44')];channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x4e')]=!![];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x4f')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x50'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x51')]=_0x2ae807['value'];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x52')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x53'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['type']=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['outboundrouteid'])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x54'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807['uniqueid']]['routeid']=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['sipcallid'])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x55'),_0x2ae807['uniqueid'],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['sipcallid']=_0x2ae807[_0xe387('0x44')];}}}catch(_0x5930ef){utils['error'](util[_0xe387('0x5')](_0xe387('0x40'),_0x2ae807[_0xe387('0x6')]),_0x5930ef);}};exports['newexten']=function(_0x1ab141){try{if(!_[_0xe387('0x1e')](channels[_0x1ab141[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x56'),_0x1ab141[_0xe387('0x6')]),_0x1ab141);utils[_0xe387('0x4')](util['format'](_0xe387('0x57'),_0x1ab141[_0xe387('0x6')],_0x1ab141[_0xe387('0x58')],_0x1ab141[_0xe387('0x59')]));if(_0x1ab141['application'][_0xe387('0x5a')]()==_0xe387('0x5b')&&_[_0xe387('0x5c')](_0x1ab141[_0xe387('0x59')][_0xe387('0x5a')](),'cdr')){var _0x111ccf=_0x1ab141[_0xe387('0x59')][_0xe387('0x5d')]('=');var _0x441488=_0x111ccf[0x0][_0xe387('0x5e')](_0x111ccf[0x0]['lastIndexOf']('(')+0x1,_0x111ccf[0x0][_0xe387('0x5f')](')'));var _0x3a64f9=_0x111ccf[0x1];channels[_0x1ab141[_0xe387('0x6')]][_0x441488]=_0x3a64f9;}if(!_[_0xe387('0x60')]([_0xe387('0x61'),'noop',_0xe387('0x62'),_0xe387('0x5b'),_0xe387('0x63')],_0x1ab141[_0xe387('0x58')][_0xe387('0x5a')]())){channels[_0x1ab141['uniqueid']][_0xe387('0x64')]=_0x1ab141['application'];channels[_0x1ab141[_0xe387('0x6')]]['lastdata']=_0x1ab141['appdata'];}}}catch(_0x2199cb){utils[_0xe387('0x1b')](util['format']('[%s][calls][newexten]',_0x1ab141[_0xe387('0x6')]),_0x2199cb);}}; \ No newline at end of file +var _0xc6dc=['ANSWERED','BUSY','info','format','uniqueid','channel','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','hangup','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER'];(function(_0x554efc,_0x4ea0c1){var _0x26fc1a=function(_0x10c4f1){while(--_0x10c4f1){_0x554efc['push'](_0x554efc['shift']());}};_0x26fc1a(++_0x4ea0c1);}(_0xc6dc,0x1a3));var _0xcc6d=function(_0x23ce04,_0x2f94fc){_0x23ce04=_0x23ce04-0x0;var _0x7b9a8e=_0xc6dc[_0x23ce04];return _0x7b9a8e;};'use strict';var _=require(_0xcc6d('0x0'));var util=require(_0xcc6d('0x1'));var utils=require(_0xcc6d('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xcc6d('0x3'),_0xcc6d('0x4'),_0xcc6d('0x4'),_0xcc6d('0x4'),_0xcc6d('0x5'),_0xcc6d('0x6'),_0xcc6d('0x3'),_0xcc6d('0x3'),'FAILED'];var channels={};function writeDB(_0x24e167){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x24e167[_0xcc6d('0x9')],_0x24e167[_0xcc6d('0xa')],_0x24e167['queue'],_0x24e167[_0xcc6d('0xb')],_0x24e167['interface'],_0x24e167[_0xcc6d('0xc')],_0x24e167[_0xcc6d('0xd')],_0x24e167['lastevent']));if(_0x24e167[_0xcc6d('0xe')]){utils[_0xcc6d('0xf')](_0x24e167['accountcode'])[_0xcc6d('0x10')](function(_0xbec197){if(_0xbec197){_0x24e167[_0xcc6d('0x11')]=_0xbec197['id'];}utils[_0xcc6d('0x12')](_0xcc6d('0x13'),_0x24e167);});}else{utils['request']('CreateVoiceCallReport',_0x24e167);}if(channels[_0x24e167[_0xcc6d('0x9')]]){delete channels[_0x24e167[_0xcc6d('0x9')]];}}exports[_0xcc6d('0x14')]=function(_0x4e5676){try{utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x16'),_0x4e5676[_0xcc6d('0x9')]),_0x4e5676);if(_0x4e5676[_0xcc6d('0x9')]==_0x4e5676[_0xcc6d('0x17')]&&_0x4e5676[_0xcc6d('0xa')]!=_0xcc6d('0x18')){utils[_0xcc6d('0x7')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4e5676['uniqueid'],_0x4e5676['context'],_0x4e5676['exten']));channels[_0x4e5676['uniqueid']]={'uniqueid':_0x4e5676[_0xcc6d('0x9')],'accountcode':_0x4e5676[_0xcc6d('0xe')],'source':_0x4e5676[_0xcc6d('0xc')],'destination':_0x4e5676[_0xcc6d('0x19')],'destinationcontext':_0x4e5676[_0xcc6d('0x1a')],'channel':_0x4e5676[_0xcc6d('0xa')],'starttime':utils[_0xcc6d('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcc6d('0x4'),'amaflags':_0xcc6d('0x1c')};}}catch(_0x433fdc){utils[_0xcc6d('0x1d')](util['format'](_0xcc6d('0x16'),_0x4e5676[_0xcc6d('0x9')]),_0x433fdc);}};exports['newstate']=function(_0x56db67){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x56db67[_0xcc6d('0x9')]),_0x56db67);if(!_['isNil'](channels[_0x56db67[_0xcc6d('0x9')]])&&_0x56db67[_0xcc6d('0x1e')]==0x6){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x1f'),_0x56db67['uniqueid'],_0x56db67['context'],_0x56db67[_0xcc6d('0xa')]));if(_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x9')]]['systemanswertime'])){channels[_0x56db67[_0xcc6d('0x9')]][_0xcc6d('0x21')]=utils[_0xcc6d('0x1b')]();}}else if(!_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x17')]])&&_0x56db67['channelstate']==0x6&&_0x56db67[_0xcc6d('0x1a')]!=_0xcc6d('0x22')){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x23'),_0x56db67[_0xcc6d('0x9')],_0x56db67['linkedid'],_0x56db67[_0xcc6d('0x1a')],_0x56db67[_0xcc6d('0xa')]));channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0xe')]=_0x56db67[_0xcc6d('0xe')];channels[_0x56db67['linkedid']][_0xcc6d('0x24')]=_0x56db67[_0xcc6d('0xa')];if(_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0x25')])){channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0x25')]=utils[_0xcc6d('0x1b')]();}channels[_0x56db67['linkedid']][_0xcc6d('0x26')]=dispositions[_[_0xcc6d('0x27')](_0x56db67[_0xcc6d('0x1e')])]||_0xcc6d('0x5');}}catch(_0xae814a){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x28'),_0x56db67[_0xcc6d('0x9')]),_0xae814a);}};exports['hangup']=function(_0x59993d){try{if(!_[_0xcc6d('0x20')](channels[_0x59993d[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x29'),_0x59993d[_0xcc6d('0x9')]),_0x59993d);if(_[_0xcc6d('0x20')](channels[_0x59993d[_0xcc6d('0x9')]]['callerid'])){channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2a')]=_0x59993d[_0xcc6d('0x2b')]+'\x20<'+_0x59993d[_0xcc6d('0xc')]+'>';}utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x2c'),_0x59993d[_0xcc6d('0x9')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2a')],_0x59993d['cause-txt']));channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2d')]=utils[_0xcc6d('0x1b')]();channels[_0x59993d['uniqueid']][_0xcc6d('0x2e')]=utils[_0xcc6d('0x2f')](channels[_0x59993d['uniqueid']][_0xcc6d('0x2d')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x30')]);channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x31')]=channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x25')]?utils[_0xcc6d('0x2f')](channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2d')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x25')]):0x0;writeDB(channels[_0x59993d[_0xcc6d('0x9')]]);}}catch(_0x467593){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x29'),_0x59993d[_0xcc6d('0x9')]),_0x467593);}};exports[_0xcc6d('0x32')]=function(_0x464983){try{if(!_['isNil'](channels[_0x464983[_0xcc6d('0x33')]])){utils['debug'](util[_0xcc6d('0x8')]('[%s][calls][attendedtransfer]',_0x464983[_0xcc6d('0x34')]),_0x464983);if(channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0xa')]==_0x464983[_0xcc6d('0x35')]){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x36'),_0x464983['origtransfereruniqueid'],_0x464983[_0xcc6d('0x33')],_0x464983[_0xcc6d('0x37')]));channels[_0x464983['localtwolinkedid']][_0xcc6d('0x24')]=_0x464983['secondtransfererchannel'];channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0x38')]=_0xcc6d('0x39');}else if(channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0xa')]=_0x464983[_0xcc6d('0x3a')]){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x36'),_0x464983[_0xcc6d('0x34')],_0x464983[_0xcc6d('0x33')],_0x464983['origtransfererchannel']));channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0x24')]=_0x464983[_0xcc6d('0x3b')];channels[_0x464983[_0xcc6d('0x33')]]['userfield']='_attended';}}}catch(_0x5e666b){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')]('[%s][calls][attendedtransfer]',_0x464983[_0xcc6d('0x34')]),_0x5e666b);}};exports[_0xcc6d('0x3c')]=function(_0x51e2fd){try{if(!_['isNil'](channels[_0x51e2fd['uniqueid']])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstart]',_0x51e2fd[_0xcc6d('0x9')]),_0x51e2fd);channels[_0x51e2fd[_0xcc6d('0x9')]][_0xcc6d('0x3d')]=utils[_0xcc6d('0x1b')]();utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x3e'),_0x51e2fd[_0xcc6d('0x9')],channels[_0x51e2fd[_0xcc6d('0x9')]]['musiconholdstartAt']));}}catch(_0x36f06e){utils[_0xcc6d('0x1d')](util['format'](_0xcc6d('0x3f'),_0x51e2fd[_0xcc6d('0x9')]),_0x36f06e);}};exports[_0xcc6d('0x40')]=function(_0x29ee56){try{if(!_['isNil'](channels[_0x29ee56['uniqueid']])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x41'),_0x29ee56[_0xcc6d('0x9')]),_0x29ee56);if(!_[_0xcc6d('0x20')](channels[_0x29ee56['uniqueid']][_0xcc6d('0x3d')])){channels[_0x29ee56['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xcc6d('0x1b')](),channels[_0x29ee56[_0xcc6d('0x9')]][_0xcc6d('0x3d')]);utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x29ee56[_0xcc6d('0x9')],channels[_0x29ee56[_0xcc6d('0x9')]]['mohtime']));delete channels[_0x29ee56['uniqueid']]['musiconholdstartAt'];}}}catch(_0x2f5139){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstop]',_0x29ee56[_0xcc6d('0x9')]),_0x2f5139);}};exports[_0xcc6d('0x42')]=function(_0x4d4721){try{if(!_[_0xcc6d('0x20')](channels[_0x4d4721[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util['format']('[%s][calls][varset]',_0x4d4721[_0xcc6d('0x9')]),_0x4d4721);if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x44')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['source']=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x46')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x47'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['destination']=_0x4d4721['value'];channels[_0x4d4721['uniqueid']]['callerid']='\x22'+_0x4d4721['value']+_0xcc6d('0x48')+_0x4d4721[_0xcc6d('0x45')]+'>';}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x49')])||!_[_0xcc6d('0x20')](_0x4d4721['variable'][_0xcc6d('0x4a')])){utils[_0xcc6d('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4d4721[_0xcc6d('0x9')],!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x49')])?'xmd-callerid-preview':_0xcc6d('0x4a'),_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['callerid']=_0x4d4721['value'];}if(!_['isNil'](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4b')])||!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4c')])){utils['info'](util[_0xcc6d('0x8')](_0xcc6d('0x4d'),_0x4d4721[_0xcc6d('0x9')],!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4b')])?'xmd-queue':_0xcc6d('0x4c'),_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x4e')]=_0xcc6d('0x4f');channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x50')]=_0x4d4721[_0xcc6d('0x45')];channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x51')]=!![];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x52')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x53'),_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x54')]=_0x4d4721[_0xcc6d('0x45')];}if(!_['isNil'](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x55')])){utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x56'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['type']=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721['variable'][_0xcc6d('0x57')])){utils['info'](util[_0xcc6d('0x8')](_0xcc6d('0x58'),_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x59')]=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x5a')])){utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x5b'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x5a')]=_0x4d4721[_0xcc6d('0x45')];}}}catch(_0x3e40eb){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x5c'),_0x4d4721[_0xcc6d('0x9')]),_0x3e40eb);}};exports[_0xcc6d('0x5d')]=function(_0x19c5ea){try{if(!_[_0xcc6d('0x20')](channels[_0x19c5ea[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util['format']('[%s][calls][newexten]',_0x19c5ea[_0xcc6d('0x9')]),_0x19c5ea);utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x5e'),_0x19c5ea[_0xcc6d('0x9')],_0x19c5ea[_0xcc6d('0x5f')],_0x19c5ea[_0xcc6d('0x60')]));if(_0x19c5ea[_0xcc6d('0x5f')][_0xcc6d('0x61')]()==_0xcc6d('0x62')&&_['startsWith'](_0x19c5ea['appdata'][_0xcc6d('0x61')](),_0xcc6d('0x63'))){var _0x38c945=_0x19c5ea['appdata'][_0xcc6d('0x64')]('=');var _0xb6a5b8=_0x38c945[0x0][_0xcc6d('0x65')](_0x38c945[0x0][_0xcc6d('0x66')]('(')+0x1,_0x38c945[0x0][_0xcc6d('0x66')](')'));var _0x25b0fe=_0x38c945[0x1];channels[_0x19c5ea['uniqueid']][_0xb6a5b8]=_0x25b0fe;}if(!_[_0xcc6d('0x67')]([_0xcc6d('0x68'),'noop','execif','set',_0xcc6d('0x69')],_0x19c5ea[_0xcc6d('0x5f')][_0xcc6d('0x61')]())){channels[_0x19c5ea[_0xcc6d('0x9')]][_0xcc6d('0x4e')]=_0x19c5ea[_0xcc6d('0x5f')];channels[_0x19c5ea[_0xcc6d('0x9')]]['lastdata']=_0x19c5ea[_0xcc6d('0x60')];}}}catch(_0x380b74){utils['error'](util['format']('[%s][calls][newexten]',_0x19c5ea[_0xcc6d('0x9')]),_0x380b74);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3d77e47..76d8f02 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 _0x6140=['error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6140,0x19b));var _0x0614=function(_0xb9c2da,_0x5e481a){_0xb9c2da=_0xb9c2da-0x0;var _0x195d1d=_0x6140[_0xb9c2da];return _0x195d1d;};'use strict';var utils=require(_0x0614('0x0'));exports['connect']=function(){utils[_0x0614('0x1')](_0x0614('0x2'));};exports[_0x0614('0x3')]=function(){utils[_0x0614('0x1')](_0x0614('0x4'));};exports[_0x0614('0x5')]=function(){utils[_0x0614('0x1')](_0x0614('0x6'));};exports[_0x0614('0x7')]=function(_0x4aa5c5){utils[_0x0614('0x7')]('[core]\x20error',_0x4aa5c5);};exports[_0x0614('0x8')]=function(){utils['info'](_0x0614('0x9'));};exports[_0x0614('0xa')]=function(_0x3add2d){}; \ No newline at end of file +var _0x2cb5=['error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cb5,0x14e));var _0x52cb=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2cb5[_0x5783f4];return _0x28e380;};'use strict';var utils=require(_0x52cb('0x0'));exports[_0x52cb('0x1')]=function(){utils['info'](_0x52cb('0x2'));};exports[_0x52cb('0x3')]=function(){utils[_0x52cb('0x4')](_0x52cb('0x5'));};exports[_0x52cb('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x3a6dbc){utils[_0x52cb('0x7')](_0x52cb('0x8'),_0x3a6dbc);};exports['close']=function(){utils['info'](_0x52cb('0x9'));};exports[_0x52cb('0xa')]=function(_0x2c480d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e74d42d..b57ce4b 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 _0x8f1f=['connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x8f1f,0x16c));var _0xf8f1=function(_0x146f3a,_0x373e03){_0x146f3a=_0x146f3a-0x0;var _0x4ebd8a=_0x8f1f[_0x146f3a];return _0x4ebd8a;};'use strict';var _=require(_0xf8f1('0x0'));var util=require('util');var utils=require(_0xf8f1('0x1'));var dials={};function writeDB(_0x438c2e){utils[_0xf8f1('0x2')](util['format'](_0xf8f1('0x3'),_0x438c2e[_0xf8f1('0x4')],_0x438c2e[_0xf8f1('0x5')],_0x438c2e[_0xf8f1('0x6')],_0x438c2e['calleridnum'],_0x438c2e[_0xf8f1('0x7')],_0x438c2e[_0xf8f1('0x8')]));utils['request'](_0xf8f1('0x9'),_0x438c2e);delete dials[_0x438c2e[_0xf8f1('0x4')]];}exports[_0xf8f1('0xa')]=function(_0x4610f0){try{utils[_0xf8f1('0xb')](util['format'](_0xf8f1('0xc'),_0x4610f0[_0xf8f1('0x4')]),_0x4610f0);utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0xe'),_0x4610f0[_0xf8f1('0x4')],_0x4610f0[_0xf8f1('0xf')],_0x4610f0[_0xf8f1('0x10')]));if(_0x4610f0[_0xf8f1('0xf')][_0xf8f1('0x11')]()=='set'&&_[_0xf8f1('0x12')](_0x4610f0[_0xf8f1('0x10')][_0xf8f1('0x11')](),_0xf8f1('0x13'))){var _0x26cf4f=_0x4610f0['appdata'][_0xf8f1('0x14')]('=');dials[_0x4610f0[_0xf8f1('0x4')]]={'routeId':_0x26cf4f[0x1]};}}catch(_0x4b3333){utils[_0xf8f1('0x15')](util['format'](_0xf8f1('0xc'),_0x4610f0[_0xf8f1('0x4')]),_0x4b3333);}};exports[_0xf8f1('0x16')]=function(_0x1140be){try{utils[_0xf8f1('0xb')](util[_0xf8f1('0xd')](_0xf8f1('0x17'),_0x1140be[_0xf8f1('0x4')]),_0x1140be);if(!_[_0xf8f1('0x18')](_0x1140be[_0xf8f1('0x19')][_0xf8f1('0x1a')])){utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x1b'),_0x1140be[_0xf8f1('0x4')],_0x1140be['value']));dials[_0x1140be[_0xf8f1('0x4')]]={'routeId':_0x1140be['value']};}}catch(_0x2d43ed){utils[_0xf8f1('0x15')](util['format'](_0xf8f1('0x17'),_0x1140be[_0xf8f1('0x4')]),_0x2d43ed);}};exports[_0xf8f1('0x1c')]=function(_0x72bd0a){try{if(!_[_0xf8f1('0x18')](dials[_0x72bd0a[_0xf8f1('0x4')]])){utils[_0xf8f1('0xb')](util[_0xf8f1('0xd')](_0xf8f1('0x1d'),_0x72bd0a['uniqueid']),_0x72bd0a);dials[_0x72bd0a[_0xf8f1('0x4')]]=_[_0xf8f1('0x1e')](dials[_0x72bd0a[_0xf8f1('0x4')]],_0x72bd0a);dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x1f')]=utils[_0xf8f1('0x20')]();dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x21')]=_0xf8f1('0x22');utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x23'),_0x72bd0a[_0xf8f1('0x4')],dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x1f')]));}}catch(_0x3b2ba9){utils[_0xf8f1('0x15')](util['format']('[%s][dials][dialbegin]',_0x72bd0a[_0xf8f1('0x4')]),_0x3b2ba9);}};exports[_0xf8f1('0x24')]=function(_0xdc7523){try{if(!_[_0xf8f1('0x18')](dials[_0xdc7523['uniqueid']])){utils['debug'](util[_0xf8f1('0xd')](_0xf8f1('0x25'),_0xdc7523['uniqueid']),_0xdc7523);dials[_0xdc7523['uniqueid']][_0xf8f1('0x8')]=_0xdc7523[_0xf8f1('0x8')];if(_0xdc7523[_0xf8f1('0x8')]=='ANSWER'){dials[_0xdc7523[_0xf8f1('0x4')]]=_[_0xf8f1('0x1e')](dials[_0xdc7523['uniqueid']],_0xdc7523);dials[_0xdc7523[_0xf8f1('0x4')]][_0xf8f1('0x26')]=utils[_0xf8f1('0x20')]();dials[_0xdc7523['uniqueid']]['lastevent']=_0xf8f1('0x27');utils['info'](util[_0xf8f1('0xd')](_0xf8f1('0x28'),_0xdc7523[_0xf8f1('0x4')],_0xdc7523['dialstatus'],dials[_0xdc7523[_0xf8f1('0x4')]][_0xf8f1('0x26')]));}else{utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x29'),_0xdc7523[_0xf8f1('0x4')],_0xdc7523[_0xf8f1('0x8')]));}}}catch(_0x5354a7){utils[_0xf8f1('0x15')](util[_0xf8f1('0xd')](_0xf8f1('0x25'),_0xdc7523[_0xf8f1('0x4')]),_0x5354a7);}};exports[_0xf8f1('0x2a')]=function(_0x402fa6){try{if(!_[_0xf8f1('0x18')](dials[_0x402fa6[_0xf8f1('0x4')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x402fa6['uniqueid']),_0x402fa6);utils['info'](util[_0xf8f1('0xd')](_0xf8f1('0x2b'),_0x402fa6[_0xf8f1('0x4')],_0x402fa6[_0xf8f1('0x2c')],_0x402fa6[_0xf8f1('0x2d')],_0x402fa6[_0xf8f1('0x2e')]));dials[_0x402fa6['uniqueid']]=_[_0xf8f1('0x1e')](dials[_0x402fa6[_0xf8f1('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x2f')]=utils[_0xf8f1('0x30')](dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x31')],dials[_0x402fa6[_0xf8f1('0x4')]]['starttime']);dials[_0x402fa6['uniqueid']][_0xf8f1('0x32')]=utils[_0xf8f1('0x30')](dials[_0x402fa6['uniqueid']][_0xf8f1('0x26')]||dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x31')],dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x1f')]);dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x33')]=dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x26')]?utils['diffTime'](dials[_0x402fa6[_0xf8f1('0x4')]]['endtime'],dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x26')]):0x0;writeDB(dials[_0x402fa6[_0xf8f1('0x4')]]);}}catch(_0x2b4b4f){utils[_0xf8f1('0x15')](util[_0xf8f1('0xd')](_0xf8f1('0x34'),_0x402fa6[_0xf8f1('0x4')]),_0x2b4b4f);}}; \ No newline at end of file +var _0x7763=['calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','answertime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','ANSWER','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0xd23bf6,_0x4e4718){var _0xccdce5=function(_0x203406){while(--_0x203406){_0xd23bf6['push'](_0xd23bf6['shift']());}};_0xccdce5(++_0x4e4718);}(_0x7763,0x71));var _0x3776=function(_0x463d31,_0x300f00){_0x463d31=_0x463d31-0x0;var _0x54d42f=_0x7763[_0x463d31];return _0x54d42f;};'use strict';var _=require(_0x3776('0x0'));var util=require(_0x3776('0x1'));var utils=require(_0x3776('0x2'));var dials={};function writeDB(_0x26a140){utils[_0x3776('0x3')](util[_0x3776('0x4')](_0x3776('0x5'),_0x26a140[_0x3776('0x6')],_0x26a140[_0x3776('0x7')],_0x26a140[_0x3776('0x8')],_0x26a140[_0x3776('0x9')],_0x26a140[_0x3776('0xa')],_0x26a140[_0x3776('0xb')]));utils[_0x3776('0xc')](_0x3776('0xd'),_0x26a140);delete dials[_0x26a140[_0x3776('0x6')]];}exports[_0x3776('0xe')]=function(_0x75ca){try{utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x10'),_0x75ca[_0x3776('0x6')]),_0x75ca);utils[_0x3776('0x3')](util[_0x3776('0x4')](_0x3776('0x11'),_0x75ca['uniqueid'],_0x75ca[_0x3776('0x12')],_0x75ca['appdata']));if(_0x75ca[_0x3776('0x12')][_0x3776('0x13')]()=='set'&&_[_0x3776('0x14')](_0x75ca[_0x3776('0x15')][_0x3776('0x13')](),_0x3776('0x16'))){var _0x190a15=_0x75ca[_0x3776('0x15')][_0x3776('0x17')]('=');dials[_0x75ca[_0x3776('0x6')]]={'routeId':_0x190a15[0x1]};}}catch(_0x31b985){utils[_0x3776('0x18')](util[_0x3776('0x4')]('[%s][dials][newexten]',_0x75ca[_0x3776('0x6')]),_0x31b985);}};exports[_0x3776('0x19')]=function(_0x1be08f){try{utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x1a'),_0x1be08f[_0x3776('0x6')]),_0x1be08f);if(!_[_0x3776('0x1b')](_0x1be08f[_0x3776('0x1c')][_0x3776('0x1d')])){utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1be08f[_0x3776('0x6')],_0x1be08f[_0x3776('0x1e')]));dials[_0x1be08f['uniqueid']]={'routeId':_0x1be08f['value']};}}catch(_0x2b01f4){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x1a'),_0x1be08f[_0x3776('0x6')]),_0x2b01f4);}};exports[_0x3776('0x1f')]=function(_0x213ec7){try{if(!_[_0x3776('0x1b')](dials[_0x213ec7[_0x3776('0x6')]])){utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x20'),_0x213ec7[_0x3776('0x6')]),_0x213ec7);dials[_0x213ec7[_0x3776('0x6')]]=_[_0x3776('0x21')](dials[_0x213ec7[_0x3776('0x6')]],_0x213ec7);dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x22')]=utils[_0x3776('0x23')]();dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x24')]=_0x3776('0x25');utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x213ec7[_0x3776('0x6')],dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x22')]));}}catch(_0xf1b964){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x20'),_0x213ec7['uniqueid']),_0xf1b964);}};exports['dialend']=function(_0x3f2e75){try{if(!_['isNil'](dials[_0x3f2e75[_0x3776('0x6')]])){utils['debug'](util[_0x3776('0x4')]('[%s][dials][dialend]',_0x3f2e75[_0x3776('0x6')]),_0x3f2e75);dials[_0x3f2e75[_0x3776('0x6')]][_0x3776('0xb')]=_0x3f2e75['dialstatus'];if(_0x3f2e75[_0x3776('0xb')]==_0x3776('0x26')){dials[_0x3f2e75['uniqueid']]=_[_0x3776('0x21')](dials[_0x3f2e75[_0x3776('0x6')]],_0x3f2e75);dials[_0x3f2e75[_0x3776('0x6')]]['answertime']=utils['now']();dials[_0x3f2e75[_0x3776('0x6')]]['lastevent']='connect';utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3f2e75[_0x3776('0x6')],_0x3f2e75[_0x3776('0xb')],dials[_0x3f2e75[_0x3776('0x6')]]['answertime']));}else{utils[_0x3776('0x3')](util['format'](_0x3776('0x27'),_0x3f2e75[_0x3776('0x6')],_0x3f2e75[_0x3776('0xb')]));}}}catch(_0x2f89d1){utils['error'](util[_0x3776('0x4')](_0x3776('0x28'),_0x3f2e75[_0x3776('0x6')]),_0x2f89d1);}};exports[_0x3776('0x29')]=function(_0x4e8681){try{if(!_[_0x3776('0x1b')](dials[_0x4e8681[_0x3776('0x6')]])){utils[_0x3776('0xf')](util[_0x3776('0x4')]('[%s][dials][hangup]',_0x4e8681[_0x3776('0x6')]),_0x4e8681);utils['info'](util[_0x3776('0x4')](_0x3776('0x2a'),_0x4e8681[_0x3776('0x6')],_0x4e8681[_0x3776('0x9')],_0x4e8681[_0x3776('0x2b')],_0x4e8681[_0x3776('0x2c')]));dials[_0x4e8681[_0x3776('0x6')]]=_[_0x3776('0x21')](dials[_0x4e8681[_0x3776('0x6')]],{'endtime':utils['now'](),'lastevent':_0x3776('0x2d')});dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x2e')]=utils[_0x3776('0x2f')](dials[_0x4e8681['uniqueid']][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x22')]);dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x31')]=utils[_0x3776('0x2f')](dials[_0x4e8681[_0x3776('0x6')]]['answertime']||dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x22')]);dials[_0x4e8681[_0x3776('0x6')]]['billableseconds']=dials[_0x4e8681['uniqueid']][_0x3776('0x32')]?utils[_0x3776('0x2f')](dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]]['answertime']):0x0;writeDB(dials[_0x4e8681[_0x3776('0x6')]]);}}catch(_0x32f2c4){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x33'),_0x4e8681[_0x3776('0x6')]),_0x32f2c4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 105af3e..35c6177 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 _0x34b0=['agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','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]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b0,0x137));var _0x034b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34b0[_0x321bb2];return _0x9c12ed;};var AsteriskManager=require(_0x034b('0x0'));var config=require(_0x034b('0x1'));var utils=require('./utils');var util=require(_0x034b('0x2'));var isXDREnabled=config[_0x034b('0x3')]&&config['xdr'][_0x034b('0x4')]?!config[_0x034b('0x3')][_0x034b('0x4')]:!![];var isProduction=config['env']===_0x034b('0x5')||![];var isLocalAsterisk=config[_0x034b('0x3')]&&config[_0x034b('0x3')][_0x034b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x034b('0x7')][_0x034b('0x8')],config['asterisk']['ip'],config[_0x034b('0x7')]['username'],config[_0x034b('0x7')][_0x034b('0x9')],!![]);ami[_0x034b('0xa')]();if(!isXDREnabled){utils['info'](_0x034b('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x034b('0xc'));var queues=require(_0x034b('0xd'));var recordings=require(_0x034b('0xe'));var members=require(_0x034b('0xf'));var dials=require(_0x034b('0x10'));var transfers=require(_0x034b('0x11'));var core=require(_0x034b('0x12'));ami['on']('connect',core[_0x034b('0x13')]);ami['on']('shutdown',core[_0x034b('0x14')]);ami['on'](_0x034b('0x15'),core['fullybooted']);ami['on']('error',core[_0x034b('0x16')]);ami['on'](_0x034b('0x17'),core[_0x034b('0x17')]);ami['on'](_0x034b('0x18'),core[_0x034b('0x18')]);ami['on'](_0x034b('0x19'),function(_0x99ff61){try{utils['debug'](util[_0x034b('0x1a')]('[%s][index][devicestatechange]',_0x99ff61['device']),_0x99ff61);members[_0x034b('0x19')](_0x99ff61);}catch(_0x4b570b){utils['error'](util[_0x034b('0x1a')]('[%s][index][devicestatechange]',_0x99ff61[_0x034b('0x1b')]),_0x4b570b);}});ami['on'](_0x034b('0x1c'),function(_0x52578c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x1e'),_0x52578c[_0x034b('0x1f')]),_0x52578c);agents[_0x034b('0x1c')](_0x52578c);}catch(_0x127735){utils[_0x034b('0x16')](util['format'](_0x034b('0x1e'),_0x52578c[_0x034b('0x1f')]),_0x127735);}});ami['on'](_0x034b('0x20'),function(_0x495149){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x21'),_0x495149[_0x034b('0x1f')]),_0x495149);agents[_0x034b('0x20')](_0x495149);}catch(_0x470c35){utils['error'](util[_0x034b('0x1a')](_0x034b('0x21'),_0x495149[_0x034b('0x1f')]),_0x470c35);}});ami['on'](_0x034b('0x22'),function(_0xf3c228){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x23'),_0xf3c228['uniqueid']),_0xf3c228);agents['agentconnect'](_0xf3c228);queues[_0x034b('0x22')](_0xf3c228);}catch(_0x57d295){utils[_0x034b('0x16')](util['format'](_0x034b('0x23'),_0xf3c228['uniqueid']),_0x57d295);}});ami['on'](_0x034b('0x24'),function(_0x1e888b){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x25'),_0x1e888b[_0x034b('0x1f')]),_0x1e888b);agents['agentcomplete'](_0x1e888b);queues[_0x034b('0x24')](_0x1e888b);members[_0x034b('0x24')](_0x1e888b);}catch(_0x5bf901){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x25'),_0x1e888b['uniqueid']),_0x5bf901);}});ami['on'](_0x034b('0x26'),function(_0x3e9476){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x27'),_0x3e9476['uniqueid']),_0x3e9476);agents['queuecallerabandon'](_0x3e9476);queues[_0x034b('0x26')](_0x3e9476);}catch(_0x5880cf){utils[_0x034b('0x16')](util['format'](_0x034b('0x27'),_0x3e9476['uniqueid']),_0x5880cf);}});ami['on'](_0x034b('0x28'),function(_0x1b9fc9){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x29'),_0x1b9fc9[_0x034b('0x1f')]),_0x1b9fc9);queues[_0x034b('0x28')](_0x1b9fc9);recordings[_0x034b('0x28')](_0x1b9fc9);}catch(_0x2cb808){utils['error'](util[_0x034b('0x1a')]('[%s][index][queuecallerjoin]',_0x1b9fc9['uniqueid']),_0x2cb808);}});ami['on'](_0x034b('0x2a'),function(_0x4885df){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')]('[%s][index][queuecallerleave]',_0x4885df[_0x034b('0x1f')]),_0x4885df);queues['queuecallerleave'](_0x4885df);}catch(_0x2eb6dd){utils[_0x034b('0x16')](util['format'](_0x034b('0x2b'),_0x4885df[_0x034b('0x1f')]),_0x2eb6dd);}});ami['on'](_0x034b('0x2c'),function(_0x429ae3){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x2d'),_0x429ae3[_0x034b('0x1f')]),_0x429ae3);queues[_0x034b('0x2c')](_0x429ae3);calls['musiconholdstart'](_0x429ae3);}catch(_0x30f6cd){utils[_0x034b('0x16')](util['format']('[%s][index][musiconholdstart]',_0x429ae3[_0x034b('0x1f')]),_0x30f6cd);}});ami['on'](_0x034b('0x2e'),function(_0x5cb7cb){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x2f'),_0x5cb7cb[_0x034b('0x1f')]),_0x5cb7cb);queues['musiconholdstop'](_0x5cb7cb);calls['musiconholdstop'](_0x5cb7cb);}catch(_0xe56d4d){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x2f'),_0x5cb7cb[_0x034b('0x1f')]),_0xe56d4d);}});ami['on'](_0x034b('0x30'),function(_0x4a7acc){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x31'),_0x4a7acc[_0x034b('0x1f')]),_0x4a7acc);calls[_0x034b('0x30')](_0x4a7acc);recordings['newstate'](_0x4a7acc);}catch(_0x1b9d13){utils['error'](util[_0x034b('0x1a')](_0x034b('0x31'),_0x4a7acc[_0x034b('0x1f')]),_0x1b9d13);}});ami['on'](_0x034b('0x32'),function(_0x1afb56){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x33'),_0x1afb56['uniqueid']),_0x1afb56);calls[_0x034b('0x32')](_0x1afb56);recordings['hangup'](_0x1afb56);dials[_0x034b('0x32')](_0x1afb56);agents[_0x034b('0x32')](_0x1afb56);queues['hangup'](_0x1afb56);}catch(_0x470e10){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x33'),_0x1afb56['uniqueid']),_0x470e10);}});ami['on'](_0x034b('0x34'),function(_0x298c9c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x35'),_0x298c9c[_0x034b('0x1f')]),_0x298c9c);members[_0x034b('0x34')](_0x298c9c);}catch(_0x44691e){utils[_0x034b('0x16')](util['format'](_0x034b('0x35'),_0x298c9c['uniqueid']),_0x44691e);}});ami['on'](_0x034b('0x36'),function(_0x3a911c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x37'),_0x3a911c[_0x034b('0x1f')]),_0x3a911c);queues[_0x034b('0x36')](_0x3a911c);agents[_0x034b('0x36')](_0x3a911c);transfers[_0x034b('0x36')](_0x3a911c);}catch(_0x4a021d){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x37'),_0x3a911c[_0x034b('0x1f')]),_0x4a021d);}});ami['on'](_0x034b('0x38'),function(_0x1738b0){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x39'),_0x1738b0[_0x034b('0x3a')]),_0x1738b0);queues[_0x034b('0x38')](_0x1738b0);transfers[_0x034b('0x38')](_0x1738b0);agents[_0x034b('0x38')](_0x1738b0);calls[_0x034b('0x38')](_0x1738b0);}catch(_0xf5b5d1){utils[_0x034b('0x16')](util['format'](_0x034b('0x39'),_0x1738b0[_0x034b('0x3a')]),_0xf5b5d1);}});ami['on']('varset',function(_0x357612){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x3b'),_0x357612['uniqueid']),_0x357612);queues[_0x034b('0x3c')](_0x357612);recordings[_0x034b('0x3c')](_0x357612);calls[_0x034b('0x3c')](_0x357612);dials[_0x034b('0x3c')](_0x357612);}catch(_0x1c1734){utils[_0x034b('0x16')](util['format'](_0x034b('0x3b'),_0x357612[_0x034b('0x1f')]),_0x1c1734);}});ami['on'](_0x034b('0x3d'),function(_0x4c0ca6){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x3e'),_0x4c0ca6[_0x034b('0x1f')]),_0x4c0ca6);calls['newexten'](_0x4c0ca6);recordings[_0x034b('0x3d')](_0x4c0ca6);dials[_0x034b('0x3d')](_0x4c0ca6);}catch(_0x44a454){utils[_0x034b('0x16')](util[_0x034b('0x1a')]('[%s][index][newexten]',_0x4c0ca6[_0x034b('0x1f')]),_0x44a454);}});ami['on'](_0x034b('0x3f'),function(_0x21da59){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x40'),_0x21da59[_0x034b('0x1f')]),_0x21da59);calls[_0x034b('0x3f')](_0x21da59);recordings[_0x034b('0x3f')](_0x21da59);}catch(_0x400b66){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x40'),_0x21da59[_0x034b('0x1f')]),_0x400b66);}});ami['on'](_0x034b('0x41'),function(_0x49ce8c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x42'),_0x49ce8c[_0x034b('0x1f')]),_0x49ce8c);dials[_0x034b('0x41')](_0x49ce8c);}catch(_0x454339){utils[_0x034b('0x16')](util[_0x034b('0x1a')]('[%s]dialbegin',_0x49ce8c['uniqueid']),_0x454339);}});ami['on'](_0x034b('0x43'),function(_0x9ccb8e){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x44'),_0x9ccb8e[_0x034b('0x1f')]),_0x9ccb8e);dials['dialend'](_0x9ccb8e);}catch(_0x1e08f7){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x44'),_0x9ccb8e[_0x034b('0x1f')]),_0x1e08f7);}});} \ No newline at end of file +var _0x33f0=['production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env'];(function(_0xd17121,_0x143c48){var _0x13dc79=function(_0x75f311){while(--_0x75f311){_0xd17121['push'](_0xd17121['shift']());}};_0x13dc79(++_0x143c48);}(_0x33f0,0x117));var _0x033f=function(_0x2c1597,_0x431467){_0x2c1597=_0x2c1597-0x0;var _0x29f88c=_0x33f0[_0x2c1597];return _0x29f88c;};var AsteriskManager=require(_0x033f('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x033f('0x1'));var isXDREnabled=config[_0x033f('0x2')]&&config[_0x033f('0x2')]['disabled']?!config['xdr'][_0x033f('0x3')]:!![];var isProduction=config[_0x033f('0x4')]===_0x033f('0x5')||![];var isLocalAsterisk=config[_0x033f('0x2')]&&config[_0x033f('0x2')][_0x033f('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x033f('0x7')][_0x033f('0x8')],config[_0x033f('0x7')]['ip'],config[_0x033f('0x7')][_0x033f('0x9')],config[_0x033f('0x7')][_0x033f('0xa')],!![]);ami[_0x033f('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x033f('0xc')](_0x033f('0xd'));}else{var agents=require(_0x033f('0xe'));var calls=require(_0x033f('0xf'));var queues=require(_0x033f('0x10'));var recordings=require(_0x033f('0x11'));var members=require(_0x033f('0x12'));var dials=require(_0x033f('0x13'));var transfers=require(_0x033f('0x14'));var core=require(_0x033f('0x15'));ami['on'](_0x033f('0x16'),core[_0x033f('0x16')]);ami['on']('shutdown',core[_0x033f('0x17')]);ami['on']('fullybooted',core[_0x033f('0x18')]);ami['on'](_0x033f('0x19'),core[_0x033f('0x19')]);ami['on'](_0x033f('0x1a'),core[_0x033f('0x1a')]);ami['on'](_0x033f('0x1b'),core[_0x033f('0x1b')]);ami['on'](_0x033f('0x1c'),function(_0x4fd43b){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x1f'),_0x4fd43b['device']),_0x4fd43b);members['devicestatechange'](_0x4fd43b);}catch(_0x884395){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][devicestatechange]',_0x4fd43b['device']),_0x884395);}});ami['on']('agentcalled',function(_0x4699d8){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x20'),_0x4699d8[_0x033f('0x21')]),_0x4699d8);agents[_0x033f('0x22')](_0x4699d8);}catch(_0x29569a){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][agentcalled]',_0x4699d8['uniqueid']),_0x29569a);}});ami['on']('agentringnoanswer',function(_0x38bd49){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x23'),_0x38bd49[_0x033f('0x21')]),_0x38bd49);agents[_0x033f('0x24')](_0x38bd49);}catch(_0x5c2c32){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x23'),_0x38bd49[_0x033f('0x21')]),_0x5c2c32);}});ami['on'](_0x033f('0x25'),function(_0x655c5c){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][agentconnect]',_0x655c5c[_0x033f('0x21')]),_0x655c5c);agents[_0x033f('0x25')](_0x655c5c);queues[_0x033f('0x25')](_0x655c5c);}catch(_0x38c568){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x26'),_0x655c5c['uniqueid']),_0x38c568);}});ami['on'](_0x033f('0x27'),function(_0x57e1a3){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x28'),_0x57e1a3[_0x033f('0x21')]),_0x57e1a3);agents[_0x033f('0x27')](_0x57e1a3);queues['agentcomplete'](_0x57e1a3);members['agentcomplete'](_0x57e1a3);}catch(_0x55090f){utils[_0x033f('0x19')](util['format'](_0x033f('0x28'),_0x57e1a3[_0x033f('0x21')]),_0x55090f);}});ami['on'](_0x033f('0x29'),function(_0x240e69){try{utils['debug'](util['format'](_0x033f('0x2a'),_0x240e69[_0x033f('0x21')]),_0x240e69);agents['queuecallerabandon'](_0x240e69);queues['queuecallerabandon'](_0x240e69);}catch(_0x128000){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x2a'),_0x240e69['uniqueid']),_0x128000);}});ami['on'](_0x033f('0x2b'),function(_0x256a07){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][queuecallerjoin]',_0x256a07[_0x033f('0x21')]),_0x256a07);queues[_0x033f('0x2b')](_0x256a07);recordings[_0x033f('0x2b')](_0x256a07);}catch(_0x27b342){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x2c'),_0x256a07[_0x033f('0x21')]),_0x27b342);}});ami['on']('queuecallerleave',function(_0x406b05){try{utils['debug'](util['format'](_0x033f('0x2d'),_0x406b05['uniqueid']),_0x406b05);queues[_0x033f('0x2e')](_0x406b05);}catch(_0x141019){utils['error'](util[_0x033f('0x1e')](_0x033f('0x2d'),_0x406b05['uniqueid']),_0x141019);}});ami['on']('musiconholdstart',function(_0x53b53f){try{utils['debug'](util['format'](_0x033f('0x2f'),_0x53b53f[_0x033f('0x21')]),_0x53b53f);queues[_0x033f('0x30')](_0x53b53f);calls[_0x033f('0x30')](_0x53b53f);}catch(_0x47f07e){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][musiconholdstart]',_0x53b53f[_0x033f('0x21')]),_0x47f07e);}});ami['on'](_0x033f('0x31'),function(_0x5bebf8){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x32'),_0x5bebf8[_0x033f('0x21')]),_0x5bebf8);queues[_0x033f('0x31')](_0x5bebf8);calls[_0x033f('0x31')](_0x5bebf8);}catch(_0x192cf7){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x32'),_0x5bebf8[_0x033f('0x21')]),_0x192cf7);}});ami['on']('newstate',function(_0xdf38ad){try{utils['debug'](util[_0x033f('0x1e')]('[%s][index][newstate]',_0xdf38ad[_0x033f('0x21')]),_0xdf38ad);calls['newstate'](_0xdf38ad);recordings[_0x033f('0x33')](_0xdf38ad);}catch(_0x180be3){utils['error'](util['format'](_0x033f('0x34'),_0xdf38ad[_0x033f('0x21')]),_0x180be3);}});ami['on'](_0x033f('0x35'),function(_0x257af0){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x36'),_0x257af0[_0x033f('0x21')]),_0x257af0);calls[_0x033f('0x35')](_0x257af0);recordings[_0x033f('0x35')](_0x257af0);dials[_0x033f('0x35')](_0x257af0);agents[_0x033f('0x35')](_0x257af0);queues[_0x033f('0x35')](_0x257af0);}catch(_0x36de5){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x36'),_0x257af0['uniqueid']),_0x36de5);}});ami['on'](_0x033f('0x37'),function(_0x583a0f){try{utils['debug'](util[_0x033f('0x1e')](_0x033f('0x38'),_0x583a0f[_0x033f('0x21')]),_0x583a0f);members[_0x033f('0x37')](_0x583a0f);}catch(_0x4abc96){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x38'),_0x583a0f['uniqueid']),_0x4abc96);}});ami['on']('blindtransfer',function(_0x18553d){try{utils['debug'](util[_0x033f('0x1e')](_0x033f('0x39'),_0x18553d[_0x033f('0x21')]),_0x18553d);queues[_0x033f('0x3a')](_0x18553d);agents[_0x033f('0x3a')](_0x18553d);transfers['blindtransfer'](_0x18553d);}catch(_0xe3be52){utils['error'](util[_0x033f('0x1e')]('[%s][index][blindtransfer]',_0x18553d[_0x033f('0x21')]),_0xe3be52);}});ami['on'](_0x033f('0x3b'),function(_0x429cea){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x3c'),_0x429cea[_0x033f('0x3d')]),_0x429cea);queues[_0x033f('0x3b')](_0x429cea);transfers[_0x033f('0x3b')](_0x429cea);agents['attendedtransfer'](_0x429cea);calls['attendedtransfer'](_0x429cea);}catch(_0x42afbc){utils[_0x033f('0x19')](util['format'](_0x033f('0x3c'),_0x429cea[_0x033f('0x3d')]),_0x42afbc);}});ami['on'](_0x033f('0x3e'),function(_0x490c78){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x3f'),_0x490c78[_0x033f('0x21')]),_0x490c78);queues['varset'](_0x490c78);recordings['varset'](_0x490c78);calls[_0x033f('0x3e')](_0x490c78);dials[_0x033f('0x3e')](_0x490c78);}catch(_0x5e1b7c){utils[_0x033f('0x19')](util['format']('[%s][index][varset]',_0x490c78['uniqueid']),_0x5e1b7c);}});ami['on'](_0x033f('0x40'),function(_0x1c29a9){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x41'),_0x1c29a9[_0x033f('0x21')]),_0x1c29a9);calls['newexten'](_0x1c29a9);recordings[_0x033f('0x40')](_0x1c29a9);dials[_0x033f('0x40')](_0x1c29a9);}catch(_0x5c6c06){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x41'),_0x1c29a9[_0x033f('0x21')]),_0x5c6c06);}});ami['on'](_0x033f('0x42'),function(_0x38073f){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][newchannel]',_0x38073f['uniqueid']),_0x38073f);calls[_0x033f('0x42')](_0x38073f);recordings[_0x033f('0x42')](_0x38073f);}catch(_0x4acab5){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][newchannel]',_0x38073f[_0x033f('0x21')]),_0x4acab5);}});ami['on']('dialbegin',function(_0x461b59){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x43'),_0x461b59['uniqueid']),_0x461b59);dials['dialbegin'](_0x461b59);}catch(_0x2a2dfc){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x44'),_0x461b59[_0x033f('0x21')]),_0x2a2dfc);}});ami['on'](_0x033f('0x45'),function(_0x20b62e){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x46'),_0x20b62e[_0x033f('0x21')]),_0x20b62e);dials[_0x033f('0x45')](_0x20b62e);}catch(_0x55892f){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x46'),_0x20b62e[_0x033f('0x21')]),_0x55892f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 59f2c73..d69e672 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 _0x2a92=['some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','channel','assign','data1','data2','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','error','[%s][members][writeDB]'];(function(_0x2e7d83,_0x19c2f7){var _0x2fffb9=function(_0x20f5ec){while(--_0x20f5ec){_0x2e7d83['push'](_0x2e7d83['shift']());}};_0x2fffb9(++_0x19c2f7);}(_0x2a92,0xbf));var _0x22a9=function(_0x4582a9,_0x52e47d){_0x4582a9=_0x4582a9-0x0;var _0x49c003=_0x2a92[_0x4582a9];return _0x49c003;};'use strict';var _=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var utils=require(_0x22a9('0x2'));var members={};var exclude=[_0x22a9('0x3'),'Queue:'];function writeDB(_0x4ce4e9){utils[_0x22a9('0x4')](util[_0x22a9('0x5')](_0x22a9('0x6'),_0x4ce4e9[_0x22a9('0x7')],_0x4ce4e9[_0x22a9('0x8')],_0x4ce4e9['channel'],_0x4ce4e9['data2'],_0x4ce4e9[_0x22a9('0x9')],_0x4ce4e9[_0x22a9('0xa')]));if(_0x4ce4e9[_0x22a9('0x8')]){utils[_0x22a9('0xb')](_0x4ce4e9[_0x22a9('0x8')])[_0x22a9('0xc')](function(_0x4e3f92){if(_0x4e3f92){_0x4ce4e9[_0x22a9('0x9')]=_0x4e3f92[_0x22a9('0xd')];_0x4ce4e9[_0x22a9('0xe')]=_0x4e3f92[_0x22a9('0xe')];utils['request'](_0x22a9('0xf'),_0x4ce4e9);}else{utils[_0x22a9('0x10')](_0x4ce4e9[_0x22a9('0x8')][_0x22a9('0x11')]('/')[0x1])[_0x22a9('0xc')](function(_0x356121){if(_0x356121){_0x4ce4e9['membername']=_0x356121[_0x22a9('0xd')];_0x4ce4e9[_0x22a9('0xe')]=_0x356121[_0x22a9('0xe')];utils[_0x22a9('0x12')]('CreateMemberReport',_0x4ce4e9);}});}})['catch'](function(_0x5e0aaa){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x14'),_0x4ce4e9[_0x22a9('0x7')]),_0x5e0aaa);});}delete members[_0x4ce4e9['interface']];}function startsWith(_0x86b915,_0x1f3987){return _[_0x22a9('0x15')](_0x86b915,function(_0x40fe4b){return _['startsWith'](_0x1f3987,_0x40fe4b);});}exports[_0x22a9('0x16')]=function(_0x1bdd33){try{utils[_0x22a9('0x17')](util['format'](_0x22a9('0x18'),members[_0x1bdd33['device']]?members[_0x1bdd33[_0x22a9('0x19')]]['uniqueid']:_0x1bdd33[_0x22a9('0x19')]),_0x1bdd33);utils[_0x22a9('0x4')](util['format'](_0x22a9('0x1a'),members[_0x1bdd33[_0x22a9('0x19')]]?members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]:_0x1bdd33[_0x22a9('0x19')],_0x1bdd33[_0x22a9('0x1b')],_0x1bdd33[_0x22a9('0x19')]));switch(_0x1bdd33[_0x22a9('0x1b')]){case _0x22a9('0x1c'):case'BUSY':if(!startsWith(exclude,_0x1bdd33[_0x22a9('0x19')])){members[_0x1bdd33[_0x22a9('0x19')]]={'channel':_0x22a9('0x1d'),'interface':_0x1bdd33[_0x22a9('0x19')],'type':_0x22a9('0x1e'),'enterAt':utils[_0x22a9('0x1f')](),'role':_0x22a9('0x20')};}break;case _0x22a9('0x21'):if(!_['isNil'](members[_0x1bdd33[_0x22a9('0x19')]])){members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x22')]=utils[_0x22a9('0x1f')]();members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x23')]=utils[_0x22a9('0x24')](members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x22')],members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x25')]);if(members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]){writeDB(members[_0x1bdd33[_0x22a9('0x19')]]);}}break;default:break;}}catch(_0x42108d){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x18'),members[_0x1bdd33[_0x22a9('0x19')]]?members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]:_0x1bdd33[_0x22a9('0x19')]),_0x42108d);}};exports[_0x22a9('0x26')]=function(_0x27d115){try{if(!_[_0x22a9('0x27')](members[_0x27d115[_0x22a9('0x8')]])){utils[_0x22a9('0x17')](util[_0x22a9('0x5')](_0x22a9('0x28'),_0x27d115[_0x22a9('0x7')]),_0x27d115);utils[_0x22a9('0x4')](util['format'](_0x22a9('0x29'),_0x27d115['uniqueid'],_0x27d115['interface'],_0x27d115[_0x22a9('0x2a')]));members[_0x27d115[_0x22a9('0x8')]]=_['assign'](members[_0x27d115[_0x22a9('0x8')]],{'data4':_0x27d115['queue'],'uniqueid':_0x27d115[_0x22a9('0x7')]});}}catch(_0x5bedad){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x28'),_0x27d115[_0x22a9('0x7')]),_0x5bedad);}};exports[_0x22a9('0x2b')]=function(_0x22f88b){try{utils[_0x22a9('0x17')](util[_0x22a9('0x5')]('[%s][members][cdr]',_0x22f88b['uniqueid']),_0x22f88b);if(_0x22f88b[_0x22a9('0x2c')]){var _0x23841c=_0x22f88b[_0x22a9('0x2c')]['split']('-')[0x0];if(!_[_0x22a9('0x27')](members[_0x23841c])){members[_0x23841c]=_[_0x22a9('0x2d')](members[_0x23841c],{'data1':members[_0x23841c][_0x22a9('0x2e')]||_0x22f88b[_0x22a9('0xa')],'data2':members[_0x23841c][_0x22a9('0x2f')]||_0x22f88b[_0x22a9('0x30')],'data3':members[_0x23841c][_0x22a9('0x31')]||_0x22f88b[_0x22a9('0x32')],'uniqueid':members[_0x23841c][_0x22a9('0x7')]||_0x22f88b[_0x22a9('0x7')]});utils['info'](util[_0x22a9('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x22f88b['uniqueid'],members[_0x23841c][_0x22a9('0x2e')],members[_0x23841c][_0x22a9('0x2f')],members[_0x23841c]['data3']));if(members[_0x23841c][_0x22a9('0x22')]){writeDB(members[_0x23841c]);}}}if(_0x22f88b[_0x22a9('0x33')]){var _0x3e5cc0=_0x22f88b[_0x22a9('0x33')][_0x22a9('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3e5cc0])){members[_0x3e5cc0]=_[_0x22a9('0x2d')](members[_0x3e5cc0],{'data1':members[_0x3e5cc0][_0x22a9('0x2e')]||_0x22f88b[_0x22a9('0xa')],'data2':members[_0x3e5cc0][_0x22a9('0x2f')]||_0x22f88b[_0x22a9('0x30')],'data3':members[_0x3e5cc0]['data3']||_0x22f88b['destination'],'uniqueid':members[_0x3e5cc0][_0x22a9('0x7')]||_0x22f88b[_0x22a9('0x7')]});utils['info'](util['format'](_0x22a9('0x34'),_0x22f88b['uniqueid'],members[_0x3e5cc0]['data1'],members[_0x3e5cc0][_0x22a9('0x2f')],members[_0x3e5cc0][_0x22a9('0x31')]));if(members[_0x3e5cc0]['exitAt']){writeDB(members[_0x3e5cc0]);}}}}catch(_0x1cfe9d){utils['error'](util[_0x22a9('0x5')]('[%s][members][cdr]',_0x22f88b[_0x22a9('0x7')]),_0x1cfe9d);}}; \ No newline at end of file +var _0x2e76=['interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','membername','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','[%s][members][cdr]','lodash','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x2e76,0x199));var _0x62e7=function(_0x2056c1,_0x1988ba){_0x2056c1=_0x2056c1-0x0;var _0x51c286=_0x2e76[_0x2056c1];return _0x51c286;};'use strict';var _=require(_0x62e7('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x62e7('0x1'),'Queue:'];function writeDB(_0x35f3a7){utils[_0x62e7('0x2')](util[_0x62e7('0x3')](_0x62e7('0x4'),_0x35f3a7[_0x62e7('0x5')],_0x35f3a7['interface'],_0x35f3a7['channel'],_0x35f3a7[_0x62e7('0x6')],_0x35f3a7['membername'],_0x35f3a7['type']));if(_0x35f3a7[_0x62e7('0x7')]){utils[_0x62e7('0x8')](_0x35f3a7['interface'])['then'](function(_0x131265){if(_0x131265){_0x35f3a7['membername']=_0x131265[_0x62e7('0x9')];_0x35f3a7['internal']=_0x131265[_0x62e7('0xa')];utils[_0x62e7('0xb')](_0x62e7('0xc'),_0x35f3a7);}else{utils[_0x62e7('0xd')](_0x35f3a7[_0x62e7('0x7')][_0x62e7('0xe')]('/')[0x1])[_0x62e7('0xf')](function(_0x1ec99b){if(_0x1ec99b){_0x35f3a7[_0x62e7('0x10')]=_0x1ec99b[_0x62e7('0x9')];_0x35f3a7[_0x62e7('0xa')]=_0x1ec99b['internal'];utils[_0x62e7('0xb')](_0x62e7('0xc'),_0x35f3a7);}});}})['catch'](function(_0x2a9691){utils[_0x62e7('0x11')](util[_0x62e7('0x3')]('[%s][members][writeDB]',_0x35f3a7[_0x62e7('0x5')]),_0x2a9691);});}delete members[_0x35f3a7[_0x62e7('0x7')]];}function startsWith(_0x22f30d,_0x4c4378){return _[_0x62e7('0x12')](_0x22f30d,function(_0x692bff){return _[_0x62e7('0x13')](_0x4c4378,_0x692bff);});}exports[_0x62e7('0x14')]=function(_0x4fbce8){try{utils[_0x62e7('0x15')](util[_0x62e7('0x3')](_0x62e7('0x16'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8[_0x62e7('0x17')]]['uniqueid']:_0x4fbce8[_0x62e7('0x17')]),_0x4fbce8);utils[_0x62e7('0x2')](util[_0x62e7('0x3')](_0x62e7('0x18'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x5')]:_0x4fbce8['device'],_0x4fbce8[_0x62e7('0x19')],_0x4fbce8[_0x62e7('0x17')]));switch(_0x4fbce8[_0x62e7('0x19')]){case _0x62e7('0x1a'):case _0x62e7('0x1b'):if(!startsWith(exclude,_0x4fbce8[_0x62e7('0x17')])){members[_0x4fbce8[_0x62e7('0x17')]]={'channel':_0x62e7('0x1c'),'interface':_0x4fbce8[_0x62e7('0x17')],'type':_0x62e7('0x1d'),'enterAt':utils[_0x62e7('0x1e')](),'role':_0x62e7('0x1f')};}break;case _0x62e7('0x20'):if(!_[_0x62e7('0x21')](members[_0x4fbce8['device']])){members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x22')]=utils[_0x62e7('0x1e')]();members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x23')]=utils[_0x62e7('0x24')](members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x22')],members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x25')]);if(members[_0x4fbce8[_0x62e7('0x17')]]['uniqueid']){writeDB(members[_0x4fbce8[_0x62e7('0x17')]]);}}break;default:break;}}catch(_0x36466e){utils[_0x62e7('0x11')](util[_0x62e7('0x3')](_0x62e7('0x16'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8['device']][_0x62e7('0x5')]:_0x4fbce8[_0x62e7('0x17')]),_0x36466e);}};exports[_0x62e7('0x26')]=function(_0x6f2e70){try{if(!_[_0x62e7('0x21')](members[_0x6f2e70[_0x62e7('0x7')]])){utils[_0x62e7('0x15')](util['format'](_0x62e7('0x27'),_0x6f2e70[_0x62e7('0x5')]),_0x6f2e70);utils['info'](util[_0x62e7('0x3')](_0x62e7('0x28'),_0x6f2e70[_0x62e7('0x5')],_0x6f2e70[_0x62e7('0x7')],_0x6f2e70[_0x62e7('0x29')]));members[_0x6f2e70[_0x62e7('0x7')]]=_[_0x62e7('0x2a')](members[_0x6f2e70['interface']],{'data4':_0x6f2e70[_0x62e7('0x29')],'uniqueid':_0x6f2e70['uniqueid']});}}catch(_0x4bb257){utils['error'](util['format']('[%s][members][agentcomplete]',_0x6f2e70['uniqueid']),_0x4bb257);}};exports[_0x62e7('0x2b')]=function(_0x1487f7){try{utils[_0x62e7('0x15')](util[_0x62e7('0x3')]('[%s][members][cdr]',_0x1487f7[_0x62e7('0x5')]),_0x1487f7);if(_0x1487f7[_0x62e7('0x2c')]){var _0x11b2e6=_0x1487f7[_0x62e7('0x2c')][_0x62e7('0xe')]('-')[0x0];if(!_[_0x62e7('0x21')](members[_0x11b2e6])){members[_0x11b2e6]=_['assign'](members[_0x11b2e6],{'data1':members[_0x11b2e6][_0x62e7('0x2d')]||_0x1487f7['type'],'data2':members[_0x11b2e6]['data2']||_0x1487f7[_0x62e7('0x2e')],'data3':members[_0x11b2e6][_0x62e7('0x2f')]||_0x1487f7['destination'],'uniqueid':members[_0x11b2e6][_0x62e7('0x5')]||_0x1487f7[_0x62e7('0x5')]});utils[_0x62e7('0x2')](util['format'](_0x62e7('0x30'),_0x1487f7[_0x62e7('0x5')],members[_0x11b2e6][_0x62e7('0x2d')],members[_0x11b2e6][_0x62e7('0x6')],members[_0x11b2e6][_0x62e7('0x2f')]));if(members[_0x11b2e6]['exitAt']){writeDB(members[_0x11b2e6]);}}}if(_0x1487f7[_0x62e7('0x31')]){var _0x35029e=_0x1487f7[_0x62e7('0x31')]['split']('-')[0x0];if(!_[_0x62e7('0x21')](members[_0x35029e])){members[_0x35029e]=_[_0x62e7('0x2a')](members[_0x35029e],{'data1':members[_0x35029e][_0x62e7('0x2d')]||_0x1487f7[_0x62e7('0x32')],'data2':members[_0x35029e]['data2']||_0x1487f7['source'],'data3':members[_0x35029e]['data3']||_0x1487f7['destination'],'uniqueid':members[_0x35029e][_0x62e7('0x5')]||_0x1487f7[_0x62e7('0x5')]});utils['info'](util[_0x62e7('0x3')](_0x62e7('0x30'),_0x1487f7['uniqueid'],members[_0x35029e][_0x62e7('0x2d')],members[_0x35029e][_0x62e7('0x6')],members[_0x35029e][_0x62e7('0x2f')]));if(members[_0x35029e][_0x62e7('0x22')]){writeDB(members[_0x35029e]);}}}}catch(_0x5805bd){utils[_0x62e7('0x11')](util[_0x62e7('0x3')](_0x62e7('0x33'),_0x1487f7['uniqueid']),_0x5805bd);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4c9205c..0663cb1 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 _0xa799=['count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','now','error','[%s][queues][queuecallerjoin]','isNil','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0xa799,0x100));var _0x9a79=function(_0x504025,_0xe4af29){_0x504025=_0x504025-0x0;var _0x273e97=_0xa799[_0x504025];return _0x273e97;};'use strict';var _=require(_0x9a79('0x0'));var util=require(_0x9a79('0x1'));var utils=require(_0x9a79('0x2'));var queues={};function writeDB(_0x2be154){utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2be154[_0x9a79('0x5')],_0x2be154[_0x9a79('0x6')],_0x2be154[_0x9a79('0x7')],_0x2be154[_0x9a79('0x8')],_0x2be154[_0x9a79('0x9')],_0x2be154['accountcode'],_0x2be154['queuecallerexitreason']));if(_0x2be154[_0x9a79('0x7')]){utils[_0x9a79('0xa')](_0x2be154[_0x9a79('0x7')])[_0x9a79('0xb')](function(_0x36cbd8){if(_0x36cbd8){_0x2be154[_0x9a79('0xc')]=_0x36cbd8['type'];}utils[_0x9a79('0xd')]('CreateVoiceQueueReport',_0x2be154);});}else{utils['request'](_0x9a79('0xe'),_0x2be154);}if(_0x2be154[_0x9a79('0xf')]){delete queues[_0x2be154[_0x9a79('0xf')]];}else{delete queues[_0x2be154[_0x9a79('0x5')]];}}exports[_0x9a79('0x10')]=function(_0x121484){try{utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][queuecallerjoin]',_0x121484['uniqueid']),_0x121484);utils[_0x9a79('0x3')](util['format'](_0x9a79('0x12'),_0x121484['uniqueid'],_0x121484['queue'],_0x121484['position']));queues[_0x121484[_0x9a79('0x5')]]=_['assign'](_0x121484,{'originalposition':_0x121484['position'],'queuecallerjoinAt':utils[_0x9a79('0x13')](),'mohtime':0x0});}catch(_0x565d70){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x15'),_0x121484['uniqueid']),_0x565d70);}};exports['hangup']=function(_0x463b54){try{if(!_[_0x9a79('0x16')](queues[_0x463b54[_0x9a79('0x5')]])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][hangup]',_0x463b54[_0x9a79('0x5')]),_0x463b54);if(queues[_0x463b54['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x463b54[_0x9a79('0x5')]]['queuecallerabandon']&&!queues[_0x463b54['uniqueid']][_0x9a79('0x17')]){queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x18')]=!![];queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x19')]=utils[_0x9a79('0x13')]();queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1a')]='COMPLETEDBYAGENT';}utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x463b54[_0x9a79('0x5')],queues[_0x463b54['uniqueid']][_0x9a79('0x1b')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x463b54[_0x9a79('0x5')]]);}else if(queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]){utils[_0x9a79('0x3')](util['format'](_0x9a79('0x1c'),_0x463b54[_0x9a79('0x5')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]));queues[queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]]=queues[_0x463b54['uniqueid']];queues[queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]][_0x9a79('0x1d')]=0x2;delete queues[_0x463b54[_0x9a79('0x5')]];}}}catch(_0x42c08d){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x1e'),_0x463b54[_0x9a79('0x5')]),_0x42c08d);}};exports[_0x9a79('0x1f')]=function(_0x60e80b){try{utils[_0x9a79('0x11')](util['format'](_0x9a79('0x20'),_0x60e80b[_0x9a79('0x5')]),_0x60e80b);if(!_[_0x9a79('0x16')](_0x60e80b['variable'][_0x9a79('0x21')])&&_0x60e80b[_0x9a79('0x22')][_0x9a79('0x23')]()!==_0x9a79('0x24')){if(!_[_0x9a79('0x16')](queues[_0x60e80b[_0x9a79('0x5')]])){queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x17')]=!![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x27')]=utils[_0x9a79('0x13')]();queues[_0x60e80b['uniqueid']][_0x9a79('0x1a')]=_0x60e80b['value'][_0x9a79('0x23')]();utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x28'),_0x60e80b[_0x9a79('0x5')],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x60e80b['value'],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x60e80b[_0x9a79('0x5')]]);}}else if(!_[_0x9a79('0x16')](_0x60e80b[_0x9a79('0x29')][_0x9a79('0x2a')])){if(!_[_0x9a79('0x16')](queues[_0x60e80b['uniqueid']])&&!queues[_0x60e80b['uniqueid']][_0x9a79('0x25')]){queues[_0x60e80b[_0x9a79('0x5')]]['queuecallerabandon']=![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x17')]=!![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x27')]=utils[_0x9a79('0x13')]();queues[_0x60e80b['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x2b'),_0x60e80b['uniqueid'],queues[_0x60e80b['uniqueid']][_0x9a79('0x1b')],_0x60e80b['value'],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1a')]));}}}catch(_0x28c58c){utils[_0x9a79('0x14')](util['format']('[%s][queues][varset]',_0x60e80b[_0x9a79('0x5')]),_0x28c58c);}};exports[_0x9a79('0x25')]=function(_0x4eb427){try{if(!_[_0x9a79('0x16')](queues[_0x4eb427['uniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x2c'),_0x4eb427['uniqueid']),_0x4eb427);queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x17')]=![];queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x25')]=!![];queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x26')]=utils[_0x9a79('0x13')]();queues[_0x4eb427['uniqueid']][_0x9a79('0x1a')]=_0x9a79('0x2d');utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x2e'),_0x4eb427[_0x9a79('0x5')],queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x4eb427[_0x9a79('0x5')]]['queuecallerexitreason']));}}catch(_0x5759b3){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x2c'),_0x4eb427[_0x9a79('0x5')]),_0x5759b3);}};exports[_0x9a79('0x2f')]=function(_0x2692fd){try{if(!_[_0x9a79('0x16')](queues[_0x2692fd[_0x9a79('0x5')]])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][queuecallerleave]',_0x2692fd['uniqueid']),_0x2692fd);utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x30'),_0x2692fd['uniqueid'],queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x2692fd[_0x9a79('0x31')],_0x2692fd[_0x9a79('0x32')]));queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x2f')]=!![];queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x33')]=utils[_0x9a79('0x13')]();queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x34')]=utils[_0x9a79('0x35')](queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x33')],queues[_0x2692fd['uniqueid']][_0x9a79('0x36')]);queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x37')]=_0x2692fd['position'];queues[_0x2692fd[_0x9a79('0x5')]]['count']=_0x2692fd[_0x9a79('0x38')];queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x31')]=_0x2692fd[_0x9a79('0x31')];queues[_0x2692fd['uniqueid']][_0x9a79('0x32')]=_0x2692fd[_0x9a79('0x32')];}}catch(_0x487f34){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x39'),_0x2692fd[_0x9a79('0x5')]),_0x487f34);}};exports[_0x9a79('0x3a')]=function(_0x3084d2){try{if(!_[_0x9a79('0x16')](queues[_0x3084d2['uniqueid']])){utils['debug'](util[_0x9a79('0x4')](_0x9a79('0x3b'),_0x3084d2[_0x9a79('0x5')]),_0x3084d2);utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x3c'),_0x3084d2[_0x9a79('0x5')],queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x3084d2[_0x9a79('0x3d')],_0x3084d2[_0x9a79('0x3e')]));queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x3084d2[_0x9a79('0x5')]]['queuecallerexit']=![];queues[_0x3084d2['uniqueid']][_0x9a79('0x1a')]=null;queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x3084d2[_0x9a79('0x5')]]['assigned']=!![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x3f')]=_0x3084d2['destaccountcode'];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x8')]=_0x3084d2[_0x9a79('0x3d')];}}catch(_0x4e6f71){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x3b'),_0x3084d2[_0x9a79('0x5')]),_0x4e6f71);}};exports[_0x9a79('0x40')]=function(_0x184f2e){try{if(!_[_0x9a79('0x16')](queues[_0x184f2e['uniqueid']])){if(queues[_0x184f2e['uniqueid']][_0x9a79('0x33')]){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x41'),_0x184f2e[_0x9a79('0x5')]),_0x184f2e);queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x17')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x184f2e['uniqueid']][_0x9a79('0x42')]=!![];queues[_0x184f2e[_0x9a79('0x5')]]['lastAssignedTo']=_0x184f2e['membername'];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x18')]=!![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x19')]=utils['now']();if(_0x184f2e[_0x9a79('0x43')]==_0x9a79('0x44')){if(!queues[_0x184f2e['uniqueid']]['transfer']){queues[_0x184f2e['uniqueid']]['queuecallerexitreason']=_0x9a79('0x45');}}else{queues[_0x184f2e[_0x9a79('0x5')]]['queuecallerexitreason']=_0x9a79('0x46')+_0x184f2e['reason'][_0x9a79('0x23')]();}utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x184f2e[_0x9a79('0x5')],queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x184f2e[_0x9a79('0x3d')],queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x184f2e[_0x9a79('0x5')]]);}}}catch(_0x7b6a7b){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x41'),_0x184f2e[_0x9a79('0x5')]),_0x7b6a7b);}};exports['blindtransfer']=function(_0x56a871){try{if(!_[_0x9a79('0x16')](queues[_0x56a871['transfereeuniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x47'),_0x56a871[_0x9a79('0x5')]),_0x56a871);queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x44')]=!![];queues[_0x56a871[_0x9a79('0x48')]]['transfertype']=_0x9a79('0x49');queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x4a')]=_0x56a871[_0x9a79('0x4b')];queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x4c')]=_0x56a871[_0x9a79('0x48')];queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x1a')]=_0x9a79('0x4d');utils['info'](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x56a871[_0x9a79('0x5')],queues[_0x56a871[_0x9a79('0x48')]]['name'],_0x56a871[_0x9a79('0x48')],_0x56a871[_0x9a79('0x4b')]));}}catch(_0x2a623e){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x47'),_0x56a871[_0x9a79('0x5')]),_0x2a623e);}};exports[_0x9a79('0x4e')]=function(_0x3fdbd3){try{utils['debug'](util[_0x9a79('0x4')](_0x9a79('0x4f'),_0x3fdbd3[_0x9a79('0x50')]),_0x3fdbd3);if(_0x3fdbd3[_0x9a79('0x50')]==_0x3fdbd3[_0x9a79('0x51')]){if(!_[_0x9a79('0x16')](queues[_0x3fdbd3[_0x9a79('0x52')]])){utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x53'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x52')]]['name'],_0x3fdbd3[_0x9a79('0x54')]));queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x44')]=!![];queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x55')]=_0x9a79('0x56');queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x4a')]=_0x3fdbd3[_0x9a79('0x54')];queues[_0x3fdbd3[_0x9a79('0x52')]]['transferuniqueid']=_0x3fdbd3[_0x9a79('0x50')];queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x1a')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3fdbd3['origtransfererlinkedid']])){if(_0x3fdbd3[_0x9a79('0x57')]&&queues[_0x3fdbd3[_0x9a79('0x57')]]){queues[_0x3fdbd3['transfereelinkedid']][_0x9a79('0x1d')]=0x1;queues[_0x3fdbd3[_0x9a79('0x48')]]=_['clone'](queues[_0x3fdbd3[_0x9a79('0x57')]]);queues[_0x3fdbd3['transfereeuniqueid']]['transfereduniqueid']=_0x3fdbd3['transfertargetuniqueid'];queues[_0x3fdbd3['transfereeuniqueid']][_0x9a79('0x1d')]=0x2;queues[_0x3fdbd3[_0x9a79('0x48')]]['calleridnum']=queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x9')];queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x58')]=queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x58')];queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x36')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x34')]=0x0;queues[_0x3fdbd3[_0x9a79('0x48')]]['mohtime']=0x0;utils['info'](util['format'](_0x9a79('0x59'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x1b')],queues[_0x3fdbd3['transfereeuniqueid']]['calleridnum'],queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x58')]));}else{utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x5a'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x51')]]['name'],_0x3fdbd3[_0x9a79('0x52')]));queues[_0x3fdbd3['origtransfererlinkedid']]['transfereduniqueid']=_0x3fdbd3['secondtransfererlinkedid'];}}}else if(_0x3fdbd3[_0x9a79('0x5b')]==_0x3fdbd3['secondtransfererlinkedid']){if(!_[_0x9a79('0x16')](queues[_0x3fdbd3[_0x9a79('0x51')]])){utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x1b')],_0x3fdbd3[_0x9a79('0x5b')],_0x3fdbd3['secondtransfererexten']));queues[_0x3fdbd3[_0x9a79('0x51')]]['transfer']=!![];queues[_0x3fdbd3[_0x9a79('0x51')]]['transfertype']=_0x9a79('0x56');queues[_0x3fdbd3[_0x9a79('0x51')]]['transferexten']=_0x3fdbd3[_0x9a79('0x5c')];queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x4c')]=_0x3fdbd3['secondtransfereruniqueid'];queues[_0x3fdbd3[_0x9a79('0x51')]]['queuecallerexitreason']=_0x9a79('0x5d');}if(!_[_0x9a79('0x16')](queues[_0x3fdbd3['secondtransfererlinkedid']])){if(_0x3fdbd3['transfertargetlinkedid']&&queues[_0x3fdbd3[_0x9a79('0x5e')]]){queues[_0x3fdbd3[_0x9a79('0x5e')]][_0x9a79('0x1d')]=0x1;queues[_0x3fdbd3['transfertargetuniqueid']]=_[_0x9a79('0x5f')](queues[_0x3fdbd3[_0x9a79('0x5e')]]);queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0xf')]=_0x3fdbd3[_0x9a79('0x60')];queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x1d')]=0x2;queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x9')]=queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x9')];queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x58')]=queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x58')];queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x36')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x33')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x34')]=0x0;queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x61')]=0x0;utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x62'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x1b')],queues[_0x3fdbd3[_0x9a79('0x60')]]['transfereduniqueid'],queues[_0x3fdbd3[_0x9a79('0x60')]]['calleridnum'],queues[_0x3fdbd3['transfertargetuniqueid']]['calleridname']));}else{utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x5a'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x1b')],_0x3fdbd3[_0x9a79('0x51')]));queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0xf')]=_0x3fdbd3['origtransfererlinkedid'];}}}}catch(_0x3a59e3){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x4f'),_0x3fdbd3['origtransfereruniqueid']),_0x3a59e3);}};exports[_0x9a79('0x63')]=function(_0x552f9a){try{if(!_[_0x9a79('0x16')](queues[_0x552f9a['uniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstart]',_0x552f9a[_0x9a79('0x5')]),_0x552f9a);queues[_0x552f9a['uniqueid']]['musiconholdstartAt']=utils[_0x9a79('0x13')]();utils['info'](util['format'](_0x9a79('0x64'),_0x552f9a['uniqueid'],queues[_0x552f9a[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x552f9a[_0x9a79('0x5')]]['musiconholdstartAt']));}}catch(_0x1b69cf){utils[_0x9a79('0x14')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstart]',_0x552f9a[_0x9a79('0x5')]),_0x1b69cf);}};exports[_0x9a79('0x65')]=function(_0x3c82d0){try{if(!_[_0x9a79('0x16')](queues[_0x3c82d0['uniqueid']])){if(!_[_0x9a79('0x16')](queues[_0x3c82d0['uniqueid']][_0x9a79('0x66')])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x67'),_0x3c82d0[_0x9a79('0x5')]),_0x3c82d0);queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x61')]+=utils[_0x9a79('0x35')](utils[_0x9a79('0x13')](),queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x66')]);utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3c82d0[_0x9a79('0x5')],queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x3c82d0['uniqueid']][_0x9a79('0x61')]));delete queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x66')];}}}catch(_0x2d5064){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x67'),_0x3c82d0[_0x9a79('0x5')]),_0x2d5064);}}; \ No newline at end of file +var _0xd829=['transfereduniqueid','queuecallerjoin','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','type','request'];(function(_0x29ce91,_0x444e01){var _0x483a8e=function(_0x58fbb2){while(--_0x58fbb2){_0x29ce91['push'](_0x29ce91['shift']());}};_0x483a8e(++_0x444e01);}(_0xd829,0xbc));var _0x9d82=function(_0x4190a7,_0x4bc4cb){_0x4190a7=_0x4190a7-0x0;var _0x4ad1d4=_0xd829[_0x4190a7];return _0x4ad1d4;};'use strict';var _=require(_0x9d82('0x0'));var util=require('util');var utils=require(_0x9d82('0x1'));var queues={};function writeDB(_0x2cce4a){utils['info'](util[_0x9d82('0x2')](_0x9d82('0x3'),_0x2cce4a[_0x9d82('0x4')],_0x2cce4a[_0x9d82('0x5')],_0x2cce4a[_0x9d82('0x6')],_0x2cce4a[_0x9d82('0x7')],_0x2cce4a[_0x9d82('0x8')],_0x2cce4a[_0x9d82('0x9')],_0x2cce4a['queuecallerexitreason']));if(_0x2cce4a[_0x9d82('0x6')]){utils['getVoiceQueueByName'](_0x2cce4a[_0x9d82('0x6')])['then'](function(_0x345176){if(_0x345176){_0x2cce4a[_0x9d82('0xa')]=_0x345176['type'];}utils[_0x9d82('0xb')]('CreateVoiceQueueReport',_0x2cce4a);});}else{utils['request']('CreateVoiceQueueReport',_0x2cce4a);}if(_0x2cce4a[_0x9d82('0xc')]){delete queues[_0x2cce4a[_0x9d82('0xc')]];}else{delete queues[_0x2cce4a['uniqueid']];}}exports[_0x9d82('0xd')]=function(_0x3f4086){try{utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][queuecallerjoin]',_0x3f4086['uniqueid']),_0x3f4086);utils[_0x9d82('0xf')](util['format'](_0x9d82('0x10'),_0x3f4086['uniqueid'],_0x3f4086['queue'],_0x3f4086[_0x9d82('0x11')]));queues[_0x3f4086[_0x9d82('0x4')]]=_['assign'](_0x3f4086,{'originalposition':_0x3f4086['position'],'queuecallerjoinAt':utils[_0x9d82('0x12')](),'mohtime':0x0});}catch(_0x513b4b){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x3f4086[_0x9d82('0x4')]),_0x513b4b);}};exports[_0x9d82('0x13')]=function(_0x43a8f2){try{if(!_[_0x9d82('0x14')](queues[_0x43a8f2[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x15'),_0x43a8f2['uniqueid']),_0x43a8f2);if(queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x16')]){if(!queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x17')]&&!queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x18')]){queues[_0x43a8f2['uniqueid']]['queuecallercomplete']=!![];queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x19')]=utils[_0x9d82('0x12')]();queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x1b');}utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x1c'),_0x43a8f2[_0x9d82('0x4')],queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x43a8f2['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x43a8f2['uniqueid']]);}else if(queues[_0x43a8f2['uniqueid']][_0x9d82('0xc')]){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x1e'),_0x43a8f2[_0x9d82('0x4')],queues[_0x43a8f2[_0x9d82('0x4')]]['name'],queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]));queues[queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]]=queues[_0x43a8f2[_0x9d82('0x4')]];queues[queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]][_0x9d82('0x1f')]=0x2;delete queues[_0x43a8f2[_0x9d82('0x4')]];}}}catch(_0x5d2c89){utils[_0x9d82('0x20')](util[_0x9d82('0x2')]('[%s][queues][hangup]',_0x43a8f2['uniqueid']),_0x5d2c89);}};exports['varset']=function(_0x1a9e2a){try{utils[_0x9d82('0xe')](util['format'](_0x9d82('0x21'),_0x1a9e2a[_0x9d82('0x4')]),_0x1a9e2a);if(!_[_0x9d82('0x14')](_0x1a9e2a['variable'][_0x9d82('0x22')])&&_0x1a9e2a[_0x9d82('0x23')][_0x9d82('0x24')]()!==_0x9d82('0x25')){if(!_[_0x9d82('0x14')](queues[_0x1a9e2a['uniqueid']])){queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexit']=!![];queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitAt']=utils[_0x9d82('0x12')]();queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitreason']=_0x1a9e2a[_0x9d82('0x23')][_0x9d82('0x24')]();utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x27'),_0x1a9e2a[_0x9d82('0x4')],queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x1a9e2a[_0x9d82('0x23')],queues[_0x1a9e2a['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x1a9e2a[_0x9d82('0x4')]]);}}else if(!_[_0x9d82('0x14')](_0x1a9e2a[_0x9d82('0x28')][_0x9d82('0x29')])){if(!_[_0x9d82('0x14')](queues[_0x1a9e2a[_0x9d82('0x4')]])&&!queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]){queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x1a9e2a['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x18')]=!![];queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitAt']=utils[_0x9d82('0x12')]();queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitreason']=_0x9d82('0x2a');utils['info'](util[_0x9d82('0x2')](_0x9d82('0x2b'),_0x1a9e2a[_0x9d82('0x4')],queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x1a9e2a['value'],queues[_0x1a9e2a['uniqueid']][_0x9d82('0x1a')]));}}}catch(_0x1b88bf){utils['error'](util['format'](_0x9d82('0x21'),_0x1a9e2a[_0x9d82('0x4')]),_0x1b88bf);}};exports[_0x9d82('0x17')]=function(_0x42c62a){try{if(!_[_0x9d82('0x14')](queues[_0x42c62a[_0x9d82('0x4')]])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x42c62a[_0x9d82('0x4')]),_0x42c62a);queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x18')]=![];queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x2c')]=null;queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x17')]=!![];queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x26')]=utils['now']();queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x2d');utils['info'](util[_0x9d82('0x2')](_0x9d82('0x2e'),_0x42c62a[_0x9d82('0x4')],queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1a')]));}}catch(_0xc878c1){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x2f'),_0x42c62a['uniqueid']),_0xc878c1);}};exports['queuecallerleave']=function(_0x18baad){try{if(!_[_0x9d82('0x14')](queues[_0x18baad[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x30'),_0x18baad[_0x9d82('0x4')]),_0x18baad);utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x31'),_0x18baad[_0x9d82('0x4')],queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x18baad[_0x9d82('0x32')],_0x18baad[_0x9d82('0x33')]));queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x34')]=!![];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x35')]=utils[_0x9d82('0x36')](queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x16')],queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x37')]);queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x11')]=_0x18baad[_0x9d82('0x11')];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x38')]=_0x18baad[_0x9d82('0x38')];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x32')]=_0x18baad['connectedlinenum'];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x33')]=_0x18baad['connectedlinename'];}}catch(_0x3d7a66){utils[_0x9d82('0x20')](util['format'](_0x9d82('0x30'),_0x18baad[_0x9d82('0x4')]),_0x3d7a66);}};exports['agentconnect']=function(_0x2bffa4){try{if(!_[_0x9d82('0x14')](queues[_0x2bffa4[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util['format'](_0x9d82('0x39'),_0x2bffa4['uniqueid']),_0x2bffa4);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2bffa4['uniqueid'],queues[_0x2bffa4['uniqueid']][_0x9d82('0x1d')],_0x2bffa4['membername'],_0x2bffa4[_0x9d82('0x3a')]));queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x18')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x1a')]=null;queues[_0x2bffa4[_0x9d82('0x4')]]['queuecallerexitAt']=null;queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x3b')]=!![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x9')]=_0x2bffa4[_0x9d82('0x3a')];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x7')]=_0x2bffa4[_0x9d82('0x3c')];}}catch(_0x22e8ba){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x39'),_0x2bffa4[_0x9d82('0x4')]),_0x22e8ba);}};exports[_0x9d82('0x3d')]=function(_0x7f970d){try{if(!_[_0x9d82('0x14')](queues[_0x7f970d[_0x9d82('0x4')]])){if(queues[_0x7f970d['uniqueid']][_0x9d82('0x16')]){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x3e'),_0x7f970d['uniqueid']),_0x7f970d);queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x7f970d['uniqueid']][_0x9d82('0x17')]=![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x7f970d['uniqueid']][_0x9d82('0x18')]=![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x2c')]=null;queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x3b')]=!![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x7')]=_0x7f970d[_0x9d82('0x3c')];queues[_0x7f970d['uniqueid']][_0x9d82('0x3f')]=!![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x19')]=utils[_0x9d82('0x12')]();if(_0x7f970d['reason']==_0x9d82('0x40')){if(!queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x40')]){queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1a')]='TRANSFER';}}else{queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x41')+_0x7f970d['reason'][_0x9d82('0x24')]();}utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x42'),_0x7f970d['uniqueid'],queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x7f970d[_0x9d82('0x3c')],queues[_0x7f970d['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x7f970d[_0x9d82('0x4')]]);}}}catch(_0x1007af){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x3e'),_0x7f970d[_0x9d82('0x4')]),_0x1007af);}};exports[_0x9d82('0x43')]=function(_0x2e7c86){try{if(!_[_0x9d82('0x14')](queues[_0x2e7c86[_0x9d82('0x44')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x45'),_0x2e7c86[_0x9d82('0x4')]),_0x2e7c86);queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x40')]=!![];queues[_0x2e7c86['transfereeuniqueid']][_0x9d82('0x46')]=_0x9d82('0x47');queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x48')]=_0x2e7c86[_0x9d82('0x49')];queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x4a')]=_0x2e7c86[_0x9d82('0x44')];queues[_0x2e7c86['transfereeuniqueid']]['queuecallerexitreason']=_0x9d82('0x4b');utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2e7c86[_0x9d82('0x4')],queues[_0x2e7c86['transfereeuniqueid']][_0x9d82('0x1d')],_0x2e7c86['transfereeuniqueid'],_0x2e7c86[_0x9d82('0x49')]));}}catch(_0x9fcfc3){utils['error'](util[_0x9d82('0x2')](_0x9d82('0x45'),_0x2e7c86[_0x9d82('0x4')]),_0x9fcfc3);}};exports['attendedtransfer']=function(_0x394646){try{utils['debug'](util[_0x9d82('0x2')]('[%s][queues][attendedtransfer]',_0x394646[_0x9d82('0x4c')]),_0x394646);if(_0x394646[_0x9d82('0x4c')]==_0x394646['origtransfererlinkedid']){if(!_[_0x9d82('0x14')](queues[_0x394646['secondtransfererlinkedid']])){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x4d'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1d')],_0x394646['origtransfererexten']));queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x40')]=!![];queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x46')]=_0x9d82('0x4f');queues[_0x394646['secondtransfererlinkedid']][_0x9d82('0x48')]=_0x394646[_0x9d82('0x50')];queues[_0x394646['secondtransfererlinkedid']][_0x9d82('0x4a')]=_0x394646[_0x9d82('0x4c')];queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1a')]=_0x9d82('0x51');}if(!_['isNil'](queues[_0x394646[_0x9d82('0x52')]])){if(_0x394646[_0x9d82('0x53')]&&queues[_0x394646[_0x9d82('0x53')]]){queues[_0x394646[_0x9d82('0x53')]]['queuecallerenterreason']=0x1;queues[_0x394646['transfereeuniqueid']]=_['clone'](queues[_0x394646[_0x9d82('0x53')]]);queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0xc')]=_0x394646[_0x9d82('0x54')];queues[_0x394646['transfereeuniqueid']][_0x9d82('0x1f')]=0x2;queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x8')]=queues[_0x394646['secondtransfererlinkedid']]['calleridnum'];queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x55')]=queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x55')];queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x37')]=utils['now']();queues[_0x394646['transfereeuniqueid']][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x394646['transfereeuniqueid']][_0x9d82('0x35')]=0x0;queues[_0x394646['transfereeuniqueid']][_0x9d82('0x56')]=0x0;utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x394646[_0x9d82('0x4c')],queues[_0x394646['transfereeuniqueid']][_0x9d82('0x1d')],queues[_0x394646['transfereeuniqueid']][_0x9d82('0x8')],queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x55')]));}else{utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x57'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x52')]]['name'],_0x394646[_0x9d82('0x4e')]));queues[_0x394646['origtransfererlinkedid']][_0x9d82('0xc')]=_0x394646[_0x9d82('0x4e')];}}}else if(_0x394646[_0x9d82('0x58')]==_0x394646[_0x9d82('0x4e')]){if(!_[_0x9d82('0x14')](queues[_0x394646['origtransfererlinkedid']])){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x59'),_0x394646['origtransfereruniqueid'],queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x1d')],_0x394646[_0x9d82('0x58')],_0x394646[_0x9d82('0x5a')]));queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x40')]=!![];queues[_0x394646[_0x9d82('0x52')]]['transfertype']=_0x9d82('0x4f');queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x48')]=_0x394646[_0x9d82('0x5a')];queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x4a')]=_0x394646['secondtransfereruniqueid'];queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x1a')]=_0x9d82('0x51');}if(!_[_0x9d82('0x14')](queues[_0x394646['secondtransfererlinkedid']])){if(_0x394646[_0x9d82('0x5b')]&&queues[_0x394646[_0x9d82('0x5b')]]){queues[_0x394646[_0x9d82('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x394646[_0x9d82('0x54')]]=_[_0x9d82('0x5c')](queues[_0x394646[_0x9d82('0x5b')]]);queues[_0x394646['transfertargetuniqueid']][_0x9d82('0xc')]=_0x394646[_0x9d82('0x54')];queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x1f')]=0x2;queues[_0x394646[_0x9d82('0x54')]]['calleridnum']=queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x8')];queues[_0x394646[_0x9d82('0x54')]]['calleridname']=queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x55')];queues[_0x394646['transfertargetuniqueid']][_0x9d82('0x37')]=utils[_0x9d82('0x12')]();queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x35')]=0x0;queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x56')]=0x0;utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x5d'),_0x394646[_0x9d82('0x4c')],queues[_0x394646['transfertargetuniqueid']][_0x9d82('0x1d')],queues[_0x394646[_0x9d82('0x54')]]['transfereduniqueid'],queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x8')],queues[_0x394646[_0x9d82('0x54')]]['calleridname']));}else{utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x57'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1d')],_0x394646[_0x9d82('0x52')]));queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0xc')]=_0x394646['origtransfererlinkedid'];}}}}catch(_0x45f76a){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x5e'),_0x394646['origtransfereruniqueid']),_0x45f76a);}};exports['musiconholdstart']=function(_0x49d837){try{if(!_[_0x9d82('0x14')](queues[_0x49d837[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstart]',_0x49d837['uniqueid']),_0x49d837);queues[_0x49d837[_0x9d82('0x4')]][_0x9d82('0x5f')]=utils['now']();utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x49d837[_0x9d82('0x4')],queues[_0x49d837[_0x9d82('0x4')]]['name'],queues[_0x49d837[_0x9d82('0x4')]][_0x9d82('0x5f')]));}}catch(_0x3e9f97){utils['error'](util['format'](_0x9d82('0x60'),_0x49d837['uniqueid']),_0x3e9f97);}};exports[_0x9d82('0x61')]=function(_0x4f9fb5){try{if(!_[_0x9d82('0x14')](queues[_0x4f9fb5[_0x9d82('0x4')]])){if(!_[_0x9d82('0x14')](queues[_0x4f9fb5['uniqueid']][_0x9d82('0x5f')])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstop]',_0x4f9fb5[_0x9d82('0x4')]),_0x4f9fb5);queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x56')]+=utils[_0x9d82('0x36')](utils[_0x9d82('0x12')](),queues[_0x4f9fb5[_0x9d82('0x4')]]['musiconholdstartAt']);utils[_0x9d82('0xf')](util['format'](_0x9d82('0x62'),_0x4f9fb5[_0x9d82('0x4')],queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x56')]));delete queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x5f')];}}}catch(_0x273297){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x63'),_0x4f9fb5[_0x9d82('0x4')]),_0x273297);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b8471cd..e677a79 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 _0x7149=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','isNil'];(function(_0x5a1393,_0x5e081e){var _0x1fc9ab=function(_0x4bf27d){while(--_0x4bf27d){_0x5a1393['push'](_0x5a1393['shift']());}};_0x1fc9ab(++_0x5e081e);}(_0x7149,0x1e5));var _0x9714=function(_0x41f9d2,_0x368500){_0x41f9d2=_0x41f9d2-0x0;var _0x2ecaaf=_0x7149[_0x41f9d2];return _0x2ecaaf;};'use strict';var _=require(_0x9714('0x0'));var util=require(_0x9714('0x1'));var utils=require(_0x9714('0x2'));var recordings={};function writeDB(_0x310429){utils['info'](util[_0x9714('0x3')](_0x9714('0x4'),_0x310429['uniqueid']));if(_0x310429[_0x9714('0x5')]){utils[_0x9714('0x6')](_0x310429['accountcode'])[_0x9714('0x7')](function(_0x1d37a9){if(_0x1d37a9){_0x310429[_0x9714('0x8')]=_0x1d37a9[_0x9714('0x9')];_0x310429['UserId']=_0x1d37a9['id'];}utils['request'](_0x9714('0xa'),_0x310429);});}else{utils[_0x9714('0xb')](_0x9714('0xa'),_0x310429);}}exports[_0x9714('0xc')]=function(_0x3115e0){try{utils[_0x9714('0xd')](util[_0x9714('0x3')](_0x9714('0xe'),_0x3115e0[_0x9714('0xf')]),_0x3115e0);if(_0x3115e0[_0x9714('0xf')]==_0x3115e0[_0x9714('0x10')]){utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x12'),_0x3115e0['uniqueid'],_0x3115e0['context'],_0x3115e0[_0x9714('0x13')]));recordings[_0x3115e0[_0x9714('0xf')]]={'uniqueid':_0x3115e0[_0x9714('0xf')],'accountcode':_0x3115e0['accountcode'],'exten':_0x3115e0[_0x9714('0x13')],'context':_0x3115e0['context'],'channel':_0x3115e0[_0x9714('0x14')],'monitors':[]};}}catch(_0x2273bb){utils[_0x9714('0x15')](util['format']('[%s][recordings][newchannel]',_0x3115e0[_0x9714('0xf')]),_0x2273bb);}};exports[_0x9714('0x16')]=function(_0x51ee8d){try{utils[_0x9714('0xd')](util[_0x9714('0x3')]('[%s][recordings][newstate]',_0x51ee8d[_0x9714('0xf')]),_0x51ee8d);if(!_['isNil'](recordings[_0x51ee8d['uniqueid']])&&_0x51ee8d[_0x9714('0x17')]==0x6){utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x18'),_0x51ee8d[_0x9714('0xf')],_0x51ee8d[_0x9714('0x19')],_0x51ee8d[_0x9714('0x14')]));}else if(!_[_0x9714('0x1a')](recordings[_0x51ee8d[_0x9714('0x10')]])&&_0x51ee8d['channelstate']==0x6&&_0x51ee8d['context']!=_0x9714('0x1b')){utils['info'](util['format'](_0x9714('0x1c'),_0x51ee8d['uniqueid'],_0x51ee8d['linkedid'],_0x51ee8d['context'],_0x51ee8d[_0x9714('0x14')]));recordings[_0x51ee8d[_0x9714('0x10')]]['accountcode']=_0x51ee8d[_0x9714('0x5')];}}catch(_0x15fb6d){utils['error'](util[_0x9714('0x3')]('[%s][recordings][newstate]',_0x51ee8d['uniqueid']),_0x15fb6d);}};exports[_0x9714('0x1d')]=function(_0x104619){try{if(!_[_0x9714('0x1a')](_0x104619[_0x9714('0x1e')])&&!_[_0x9714('0x1a')](_0x104619[_0x9714('0x1e')][_0x9714('0x1f')])){utils['debug'](util[_0x9714('0x3')](_0x9714('0x20'),_0x104619['uniqueid']),_0x104619);utils['info'](util[_0x9714('0x3')](_0x9714('0x21'),_0x104619['uniqueid'],_0x104619[_0x9714('0x1e')],_0x104619['value']));if(_['endsWith'](_0x104619['value'],_0x9714('0x22'))){_0x104619[_0x9714('0x23')]=_0x104619['value'][_0x9714('0x24')](_0x9714('0x22'),'.WAV');}if(recordings[_0x104619[_0x9714('0x10')]]){var _0x181c52=_['find'](recordings[_0x104619[_0x9714('0x10')]][_0x9714('0x25')],{'value':_0x104619[_0x9714('0x23')]});if(_[_0x9714('0x1a')](_0x181c52)){recordings[_0x104619[_0x9714('0x10')]][_0x9714('0x25')][_0x9714('0x26')]({'value':_0x104619[_0x9714('0x23')]});}}}}catch(_0xbbc604){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x20'),_0x104619[_0x9714('0xf')]),_0xbbc604);}};exports[_0x9714('0x27')]=function(_0x1e4709){try{if(!_[_0x9714('0x1a')](recordings[_0x1e4709[_0x9714('0xf')]])){utils[_0x9714('0xd')](util[_0x9714('0x3')](_0x9714('0x28'),_0x1e4709[_0x9714('0xf')]),_0x1e4709);utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x29'),_0x1e4709[_0x9714('0xf')],_0x1e4709['calleridnum'],_0x1e4709[_0x9714('0x2a')],_0x1e4709[_0x9714('0x2b')]));recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2c')]=_0x1e4709['calleridnum'];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2a')]=_0x1e4709[_0x9714('0x2a')];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2d')]=_0x1e4709['connectedlinenum'];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2e')]=_0x1e4709['connectedlinename'];if(recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2f')]=='outbound'&&recordings[_0x1e4709['uniqueid']][_0x9714('0x5')]){recordings[_0x1e4709[_0x9714('0xf')]]['connectedlinenum']=recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x5')];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2e')]='';}recordings[_0x1e4709[_0x9714('0xf')]]['monitors'][_0x9714('0x30')](function(_0x4ba672){var _0x565b8d=_[_0x9714('0x31')](recordings[_0x1e4709[_0x9714('0xf')]]);_0x565b8d[_0x9714('0x23')]=_0x4ba672[_0x9714('0x23')];writeDB(_0x565b8d);});delete recordings[_0x1e4709[_0x9714('0xf')]];}}catch(_0x384a5c){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x28'),_0x1e4709['uniqueid']),_0x384a5c);}};exports[_0x9714('0x32')]=function(_0x9a0868){try{if(!_[_0x9714('0x1a')](recordings[_0x9a0868[_0x9714('0xf')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0x9a0868['uniqueid']),_0x9a0868);utils['info'](util['format'](_0x9714('0x33'),_0x9a0868['uniqueid'],_0x9a0868[_0x9714('0x34')],_0x9a0868[_0x9714('0x35')]));if(_0x9a0868[_0x9714('0x34')][_0x9714('0x36')]()==_0x9714('0x37')&&_[_0x9714('0x38')](_0x9a0868[_0x9714('0x35')]['toLowerCase'](),_0x9714('0x39'))){var _0x19a0b4=_0x9a0868['appdata'][_0x9714('0x3a')]('=');var _0x3ceec5=_0x19a0b4[0x0]['substring'](_0x19a0b4[0x0][_0x9714('0x3b')]('(')+0x1,_0x19a0b4[0x0][_0x9714('0x3b')](')'));var _0x1b81b1=_0x19a0b4[0x1];recordings[_0x9a0868['uniqueid']][_0x3ceec5]=_0x1b81b1;}}}catch(_0x2b2a11){utils[_0x9714('0x15')](util[_0x9714('0x3')]('[%s][recordings][newexten]',_0x9a0868[_0x9714('0xf')]),_0x2b2a11);}};exports[_0x9714('0x3c')]=function(_0x59cc16){try{if(!_[_0x9714('0x1a')](recordings[_0x59cc16['uniqueid']])){utils['debug'](util[_0x9714('0x3')](_0x9714('0x3d'),_0x59cc16[_0x9714('0xf')]),_0x59cc16);utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x3e'),_0x59cc16[_0x9714('0xf')],_0x59cc16[_0x9714('0x3f')]));recordings[_0x59cc16[_0x9714('0xf')]][_0x9714('0x3f')]=_0x59cc16[_0x9714('0x3f')];}}catch(_0xbfeadd){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x3d'),_0x59cc16[_0x9714('0xf')]),_0xbfeadd);}}; \ No newline at end of file +var _0x6fc1=['accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','[%s][recordings][writeDB]'];(function(_0x4d8536,_0x4692b8){var _0x36297d=function(_0x1704f7){while(--_0x1704f7){_0x4d8536['push'](_0x4d8536['shift']());}};_0x36297d(++_0x4692b8);}(_0x6fc1,0xc0));var _0x16fc=function(_0x225352,_0x2686db){_0x225352=_0x225352-0x0;var _0x2288ea=_0x6fc1[_0x225352];return _0x2288ea;};'use strict';var _=require(_0x16fc('0x0'));var util=require('util');var utils=require(_0x16fc('0x1'));var recordings={};function writeDB(_0x423175){utils['info'](util['format'](_0x16fc('0x2'),_0x423175['uniqueid']));if(_0x423175[_0x16fc('0x3')]){utils[_0x16fc('0x4')](_0x423175[_0x16fc('0x3')])[_0x16fc('0x5')](function(_0x3051c6){if(_0x3051c6){_0x423175[_0x16fc('0x6')]=_0x3051c6[_0x16fc('0x7')];_0x423175[_0x16fc('0x8')]=_0x3051c6['id'];}utils['request'](_0x16fc('0x9'),_0x423175);});}else{utils[_0x16fc('0xa')](_0x16fc('0x9'),_0x423175);}}exports[_0x16fc('0xb')]=function(_0x1fcdb6){try{utils[_0x16fc('0xc')](util[_0x16fc('0xd')](_0x16fc('0xe'),_0x1fcdb6['uniqueid']),_0x1fcdb6);if(_0x1fcdb6[_0x16fc('0xf')]==_0x1fcdb6[_0x16fc('0x10')]){utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x12'),_0x1fcdb6['uniqueid'],_0x1fcdb6['context'],_0x1fcdb6[_0x16fc('0x13')]));recordings[_0x1fcdb6[_0x16fc('0xf')]]={'uniqueid':_0x1fcdb6[_0x16fc('0xf')],'accountcode':_0x1fcdb6[_0x16fc('0x3')],'exten':_0x1fcdb6[_0x16fc('0x13')],'context':_0x1fcdb6['context'],'channel':_0x1fcdb6[_0x16fc('0x14')],'monitors':[]};}}catch(_0x5ec2e2){utils[_0x16fc('0x15')](util[_0x16fc('0xd')](_0x16fc('0xe'),_0x1fcdb6['uniqueid']),_0x5ec2e2);}};exports[_0x16fc('0x16')]=function(_0x504672){try{utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][newstate]',_0x504672[_0x16fc('0xf')]),_0x504672);if(!_[_0x16fc('0x17')](recordings[_0x504672[_0x16fc('0xf')]])&&_0x504672[_0x16fc('0x18')]==0x6){utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x19'),_0x504672[_0x16fc('0xf')],_0x504672[_0x16fc('0x1a')],_0x504672[_0x16fc('0x14')]));}else if(!_[_0x16fc('0x17')](recordings[_0x504672['linkedid']])&&_0x504672[_0x16fc('0x18')]==0x6&&_0x504672[_0x16fc('0x1a')]!=_0x16fc('0x1b')){utils[_0x16fc('0x11')](util['format'](_0x16fc('0x1c'),_0x504672['uniqueid'],_0x504672[_0x16fc('0x10')],_0x504672[_0x16fc('0x1a')],_0x504672[_0x16fc('0x14')]));recordings[_0x504672[_0x16fc('0x10')]][_0x16fc('0x3')]=_0x504672[_0x16fc('0x3')];}}catch(_0x41ca17){utils[_0x16fc('0x15')](util['format'](_0x16fc('0x1d'),_0x504672[_0x16fc('0xf')]),_0x41ca17);}};exports[_0x16fc('0x1e')]=function(_0xb2679f){try{if(!_[_0x16fc('0x17')](_0xb2679f[_0x16fc('0x1f')])&&!_[_0x16fc('0x17')](_0xb2679f[_0x16fc('0x1f')][_0x16fc('0x20')])){utils[_0x16fc('0xc')](util[_0x16fc('0xd')](_0x16fc('0x21'),_0xb2679f[_0x16fc('0xf')]),_0xb2679f);utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x22'),_0xb2679f[_0x16fc('0xf')],_0xb2679f['variable'],_0xb2679f['value']));if(_[_0x16fc('0x23')](_0xb2679f['value'],'.wav49')){_0xb2679f[_0x16fc('0x24')]=_0xb2679f['value'][_0x16fc('0x25')](_0x16fc('0x26'),_0x16fc('0x27'));}if(recordings[_0xb2679f[_0x16fc('0x10')]]){var _0x28fb87=_[_0x16fc('0x28')](recordings[_0xb2679f[_0x16fc('0x10')]]['monitors'],{'value':_0xb2679f[_0x16fc('0x24')]});if(_['isNil'](_0x28fb87)){recordings[_0xb2679f['linkedid']][_0x16fc('0x29')]['push']({'value':_0xb2679f[_0x16fc('0x24')]});}}}}catch(_0x4dadf4){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][varset]',_0xb2679f[_0x16fc('0xf')]),_0x4dadf4);}};exports[_0x16fc('0x2a')]=function(_0x317f91){try{if(!_[_0x16fc('0x17')](recordings[_0x317f91[_0x16fc('0xf')]])){utils[_0x16fc('0xc')](util[_0x16fc('0xd')]('[%s][recordings][hangup]',_0x317f91[_0x16fc('0xf')]),_0x317f91);utils['info'](util[_0x16fc('0xd')](_0x16fc('0x2b'),_0x317f91[_0x16fc('0xf')],_0x317f91[_0x16fc('0x2c')],_0x317f91[_0x16fc('0x2d')],_0x317f91['cause-txt']));recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2c')]=_0x317f91[_0x16fc('0x2c')];recordings[_0x317f91[_0x16fc('0xf')]]['calleridname']=_0x317f91['calleridname'];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2e')]=_0x317f91[_0x16fc('0x2e')];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2f')]=_0x317f91[_0x16fc('0x2f')];if(recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x30')]==_0x16fc('0x31')&&recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x3')]){recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2e')]=recordings[_0x317f91[_0x16fc('0xf')]]['accountcode'];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2f')]='';}recordings[_0x317f91['uniqueid']][_0x16fc('0x29')][_0x16fc('0x32')](function(_0x18d079){var _0x7fc287=_[_0x16fc('0x33')](recordings[_0x317f91[_0x16fc('0xf')]]);_0x7fc287['value']=_0x18d079['value'];writeDB(_0x7fc287);});delete recordings[_0x317f91[_0x16fc('0xf')]];}}catch(_0x3c9168){utils[_0x16fc('0x15')](util[_0x16fc('0xd')](_0x16fc('0x34'),_0x317f91[_0x16fc('0xf')]),_0x3c9168);}};exports[_0x16fc('0x35')]=function(_0xbecf84){try{if(!_[_0x16fc('0x17')](recordings[_0xbecf84[_0x16fc('0xf')]])){utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][newexten]',_0xbecf84['uniqueid']),_0xbecf84);utils['info'](util[_0x16fc('0xd')](_0x16fc('0x36'),_0xbecf84[_0x16fc('0xf')],_0xbecf84[_0x16fc('0x37')],_0xbecf84[_0x16fc('0x38')]));if(_0xbecf84[_0x16fc('0x37')][_0x16fc('0x39')]()==_0x16fc('0x3a')&&_[_0x16fc('0x3b')](_0xbecf84[_0x16fc('0x38')]['toLowerCase'](),_0x16fc('0x3c'))){var _0x289a10=_0xbecf84[_0x16fc('0x38')]['split']('=');var _0x424820=_0x289a10[0x0][_0x16fc('0x3d')](_0x289a10[0x0][_0x16fc('0x3e')]('(')+0x1,_0x289a10[0x0][_0x16fc('0x3e')](')'));var _0xaec7b6=_0x289a10[0x1];recordings[_0xbecf84[_0x16fc('0xf')]][_0x424820]=_0xaec7b6;}}}catch(_0x14a353){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][newexten]',_0xbecf84[_0x16fc('0xf')]),_0x14a353);}};exports[_0x16fc('0x3f')]=function(_0x1e4b87){try{if(!_[_0x16fc('0x17')](recordings[_0x1e4b87['uniqueid']])){utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]',_0x1e4b87[_0x16fc('0xf')]),_0x1e4b87);utils['info'](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1e4b87[_0x16fc('0xf')],_0x1e4b87[_0x16fc('0x40')]));recordings[_0x1e4b87[_0x16fc('0xf')]]['queue']=_0x1e4b87[_0x16fc('0x40')];}}catch(_0x2bdefe){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]',_0x1e4b87[_0x16fc('0xf')]),_0x2bdefe);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 977f24d..1244719 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 _0x0939=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','error','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x2aede9,_0x4c5292){var _0x39dfcb=function(_0x125a5a){while(--_0x125a5a){_0x2aede9['push'](_0x2aede9['shift']());}};_0x39dfcb(++_0x4c5292);}(_0x0939,0x85));var _0x9093=function(_0x10cc29,_0x28cea1){_0x10cc29=_0x10cc29-0x0;var _0x596a5f=_0x0939[_0x10cc29];return _0x596a5f;};'use strict';var _=require(_0x9093('0x0'));var util=require(_0x9093('0x1'));var utils=require(_0x9093('0x2'));function writeDB(_0x36c1bd){utils['info'](util[_0x9093('0x3')](_0x9093('0x4'),_0x36c1bd[_0x9093('0x5')]===_0x9093('0x6')?_0x36c1bd[_0x9093('0x7')]:_0x36c1bd[_0x9093('0x8')],_0x36c1bd['type']));utils[_0x9093('0x9')]('CreateVoiceTransferReport',_0x36c1bd);}exports[_0x9093('0xa')]=function(_0xee17d3){try{utils['debug'](util['format'](_0x9093('0xb'),_0xee17d3[_0x9093('0x8')]),_0xee17d3);utils[_0x9093('0xc')](util[_0x9093('0x3')](_0x9093('0xd'),_0xee17d3[_0x9093('0x8')],_0xee17d3['transferercalleridnum'],_0xee17d3[_0x9093('0xe')],_0xee17d3['transfereecalleridnum'],_0xee17d3[_0x9093('0xf')]));_0xee17d3[_0x9093('0x5')]='blind';writeDB(_0xee17d3);}catch(_0x4e227a){utils[_0x9093('0x10')](util[_0x9093('0x3')]('[%s][transfers][blindtransfer]',_0xee17d3[_0x9093('0x8')]),_0x4e227a);}};exports['attendedtransfer']=function(_0x2c922d){try{utils[_0x9093('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x2c922d[_0x9093('0x7')]),_0x2c922d);utils[_0x9093('0xc')](util[_0x9093('0x3')](_0x9093('0x12'),_0x2c922d['origtransfereruniqueid'],_0x2c922d[_0x9093('0x13')],_0x2c922d[_0x9093('0x14')],_0x2c922d[_0x9093('0x15')],_0x2c922d[_0x9093('0x16')]));_0x2c922d=_[_0x9093('0x17')](_0x2c922d,{'transfererchannel':_0x2c922d[_0x9093('0x18')],'transferercalleridnum':_0x2c922d['origtransferercalleridnum'],'transferercalleridname':_0x2c922d[_0x9093('0x14')],'transfererconnectedlinenum':_0x2c922d[_0x9093('0x19')],'transfererconnectedlinename':_0x2c922d[_0x9093('0x1a')],'transfereraccountcode':_0x2c922d[_0x9093('0x1b')],'transferercontext':_0x2c922d[_0x9093('0x1c')],'transfererexten':_0x2c922d[_0x9093('0x1d')],'transfererlinkedid':_0x2c922d['origtransfererlinkedid'],'context':_0x2c922d[_0x9093('0x1e')],'extension':_0x2c922d[_0x9093('0x1f')],'type':_0x9093('0x6')});if(_[_0x9093('0x20')](_0x2c922d['transfereechannel'])){_0x2c922d=_[_0x9093('0x17')](_0x2c922d,{'transfereechannel':_0x2c922d[_0x9093('0x21')],'transfereecalleridnum':_0x2c922d[_0x9093('0x15')],'transfereecalleridname':_0x2c922d[_0x9093('0x16')],'transfereeconnectedlinenum':_0x2c922d[_0x9093('0x22')],'transfereeconnectedlinename':_0x2c922d[_0x9093('0x23')],'transfereeaccountcode':_0x2c922d[_0x9093('0x24')],'transfereecontext':_0x2c922d[_0x9093('0x25')],'transfereeexten':_0x2c922d[_0x9093('0x26')],'transfereelinkedid':_0x2c922d[_0x9093('0x27')]});}writeDB(_0x2c922d);}catch(_0x44fca7){utils[_0x9093('0x10')](util[_0x9093('0x3')]('[%s][transfers][attendedtransfer]',_0x2c922d[_0x9093('0x7')]),_0x44fca7);}}; \ No newline at end of file +var _0x6d2d=['transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x246cd3,_0x17306e){_0x246cd3=_0x246cd3-0x0;var _0x490a07=_0x6d2d[_0x246cd3];return _0x490a07;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xd6d2('0x0'));function writeDB(_0x31b8e0){utils[_0xd6d2('0x1')](util['format'](_0xd6d2('0x2'),_0x31b8e0[_0xd6d2('0x3')]===_0xd6d2('0x4')?_0x31b8e0[_0xd6d2('0x5')]:_0x31b8e0[_0xd6d2('0x6')],_0x31b8e0[_0xd6d2('0x3')]));utils[_0xd6d2('0x7')](_0xd6d2('0x8'),_0x31b8e0);}exports['blindtransfer']=function(_0xd7f991){try{utils[_0xd6d2('0x9')](util[_0xd6d2('0xa')]('[%s][transfers][blindtransfer]',_0xd7f991[_0xd6d2('0x6')]),_0xd7f991);utils[_0xd6d2('0x1')](util[_0xd6d2('0xa')](_0xd6d2('0xb'),_0xd7f991[_0xd6d2('0x6')],_0xd7f991[_0xd6d2('0xc')],_0xd7f991[_0xd6d2('0xd')],_0xd7f991[_0xd6d2('0xe')],_0xd7f991['transfereecalleridname']));_0xd7f991[_0xd6d2('0x3')]=_0xd6d2('0xf');writeDB(_0xd7f991);}catch(_0x3e3704){utils[_0xd6d2('0x10')](util[_0xd6d2('0xa')](_0xd6d2('0x11'),_0xd7f991[_0xd6d2('0x6')]),_0x3e3704);}};exports['attendedtransfer']=function(_0xce1405){try{utils[_0xd6d2('0x9')](util[_0xd6d2('0xa')](_0xd6d2('0x12'),_0xce1405[_0xd6d2('0x5')]),_0xce1405);utils['info'](util[_0xd6d2('0xa')](_0xd6d2('0x13'),_0xce1405['origtransfereruniqueid'],_0xce1405['origtransferercalleridnum'],_0xce1405[_0xd6d2('0x14')],_0xce1405[_0xd6d2('0x15')],_0xce1405['transfertargetcalleridname']));_0xce1405=_[_0xd6d2('0x16')](_0xce1405,{'transfererchannel':_0xce1405[_0xd6d2('0x17')],'transferercalleridnum':_0xce1405['origtransferercalleridnum'],'transferercalleridname':_0xce1405[_0xd6d2('0x14')],'transfererconnectedlinenum':_0xce1405[_0xd6d2('0x18')],'transfererconnectedlinename':_0xce1405[_0xd6d2('0x19')],'transfereraccountcode':_0xce1405[_0xd6d2('0x1a')],'transferercontext':_0xce1405[_0xd6d2('0x1b')],'transfererexten':_0xce1405[_0xd6d2('0x1c')],'transfererlinkedid':_0xce1405[_0xd6d2('0x1d')],'context':_0xce1405[_0xd6d2('0x1e')],'extension':_0xce1405[_0xd6d2('0x1f')],'type':_0xd6d2('0x4')});if(_[_0xd6d2('0x20')](_0xce1405[_0xd6d2('0x21')])){_0xce1405=_[_0xd6d2('0x16')](_0xce1405,{'transfereechannel':_0xce1405[_0xd6d2('0x22')],'transfereecalleridnum':_0xce1405[_0xd6d2('0x15')],'transfereecalleridname':_0xce1405[_0xd6d2('0x23')],'transfereeconnectedlinenum':_0xce1405[_0xd6d2('0x24')],'transfereeconnectedlinename':_0xce1405[_0xd6d2('0x25')],'transfereeaccountcode':_0xce1405[_0xd6d2('0x26')],'transfereecontext':_0xce1405['transfertargetcontext'],'transfereeexten':_0xce1405[_0xd6d2('0x27')],'transfereelinkedid':_0xce1405['transfertargetlinkedid']});}writeDB(_0xce1405);}catch(_0x206a68){utils['error'](util['format'](_0xd6d2('0x12'),_0xce1405['origtransfereruniqueid']),_0x206a68);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5949f6a..97bf152 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 _0x7ce1=['then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','isAfter','isBefore','jayson/promise','util','client','http','xdr','info','inspect','debug','error','request'];(function(_0x2b080,_0x26a48a){var _0x30401b=function(_0x27b0fe){while(--_0x27b0fe){_0x2b080['push'](_0x2b080['shift']());}};_0x30401b(++_0x26a48a);}(_0x7ce1,0x131));var _0x17ce=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x7ce1[_0x134827];return _0x366671;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x17ce('0x0'));var moment=require('moment');var util=require(_0x17ce('0x1'));var client=jayson[_0x17ce('0x2')][_0x17ce('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x17ce('0x4'));exports[_0x17ce('0x5')]=function(_0x2ac681,_0x3347e9){logger[_0x17ce('0x5')](_0x2ac681,_0x3347e9?util[_0x17ce('0x6')](_0x3347e9,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x7')]=function(_0x2a4c53,_0x3a44ec){logger[_0x17ce('0x7')](_0x2a4c53,_0x3a44ec?util[_0x17ce('0x6')](_0x3a44ec,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x8')]=function(_0x5b1b87,_0x5aaa87){logger['error'](_0x5b1b87,_0x5aaa87?util[_0x17ce('0x6')](_0x5aaa87,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x9')]=function(_0x431f66,_0xc5abad){return client[_0x17ce('0x9')](_0x431f66,{'body':_0xc5abad})[_0x17ce('0xa')](function(_0x466526){logger[_0x17ce('0x7')]('[utils][request]\x20name:%s',_0x431f66,_0x466526?util[_0x17ce('0x6')](_0x466526,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x177f32){logger[_0x17ce('0x8')](_0x17ce('0xb'),_0x431f66,_0x177f32?util[_0x17ce('0x6')](_0x177f32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9f1c8f){return client[_0x17ce('0x9')](_0x17ce('0xc'),{'options':{'raw':!![],'attributes':['id',_0x17ce('0xd'),'name',_0x17ce('0xe')],'where':_0x9f1c8f,'limit':0x1}})[_0x17ce('0xa')](function(_0x4452e1){logger[_0x17ce('0x7')](_0x17ce('0xf'),JSON[_0x17ce('0x10')](_0x9f1c8f),_0x4452e1?util[_0x17ce('0x6')](_0x4452e1,{'showHidden':![],'depth':null}):'');return _0x4452e1['result'][_0x17ce('0x11')]?_0x4452e1[_0x17ce('0x12')][0x0]:null;});}exports[_0x17ce('0x13')]=function(_0x2c8ccf){return new BPromise(function(_0x5cbd2d,_0x1eaaf0){if(_0x2c8ccf){return getUser({'internal':_0x2c8ccf})[_0x17ce('0xa')](function(_0x5909ae){logger[_0x17ce('0x5')](_0x17ce('0x14'),_0x2c8ccf,_0x5909ae?_0x17ce('0x15'):_0x17ce('0x16'));return _0x5cbd2d(_0x5909ae);})[_0x17ce('0x17')](function(_0x24243c){logger[_0x17ce('0x8')](_0x17ce('0x18'),_0x24243c?util[_0x17ce('0x6')](_0x24243c,{'showHidden':![],'depth':null}):'');return _0x5cbd2d(null);});}return _0x5cbd2d(null);});};exports[_0x17ce('0x19')]=function(_0x25673c){return new BPromise(function(_0x4faf20,_0x445220){if(_0x25673c){return getUser({'interface':_0x25673c})[_0x17ce('0xa')](function(_0x368d55){logger[_0x17ce('0x5')](_0x17ce('0x1a'),_0x25673c,_0x368d55?_0x17ce('0x15'):_0x17ce('0x16'));return _0x4faf20(_0x368d55);})[_0x17ce('0x17')](function(_0x34135e){logger[_0x17ce('0x8')]('[utils][getUserByInterface]',_0x34135e?util[_0x17ce('0x6')](_0x34135e,{'showHidden':![],'depth':null}):'');return _0x4faf20(null);});}return _0x4faf20(null);});};exports[_0x17ce('0x1b')]=function(_0x482aa2){return new BPromise(function(_0x139172,_0x406be7){if(_0x482aa2){return getUser({'name':_0x482aa2})['then'](function(_0x464530){logger[_0x17ce('0x5')](_0x17ce('0x1c'),_0x482aa2,_0x464530?_0x17ce('0x15'):_0x17ce('0x16'));return _0x139172(_0x464530);})[_0x17ce('0x17')](function(_0x1fb933){logger[_0x17ce('0x8')]('[utils][getUserByName]',_0x1fb933?util[_0x17ce('0x6')](_0x1fb933,{'showHidden':![],'depth':null}):'');return _0x139172(null);});}return _0x139172(null);});};exports[_0x17ce('0x1d')]=function(_0x5d81d5){return new BPromise(function(_0x4e579e,_0x4b45a1){if(_0x5d81d5){return client['request'](_0x17ce('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x17ce('0x1f'),'type',_0x17ce('0x20'),_0x17ce('0x21')],'where':{'name':_0x5d81d5},'limit':0x1}})[_0x17ce('0xa')](function(_0x464cfd){logger[_0x17ce('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5d81d5,_0x464cfd?util['inspect'](_0x464cfd,{'showHidden':![],'depth':null}):'');logger[_0x17ce('0x5')](_0x17ce('0x22'),_0x5d81d5,_0x464cfd?'found':_0x17ce('0x16'));return _0x4e579e(_0x464cfd[_0x17ce('0x12')][_0x17ce('0x11')]?_0x464cfd[_0x17ce('0x12')][0x0]:null);})[_0x17ce('0x17')](function(_0x752b26){logger[_0x17ce('0x8')](_0x17ce('0x23'),_0x752b26?util['inspect'](_0x752b26,{'showHidden':![],'depth':null}):'');return _0x4e579e(null);});}return _0x4e579e(null);});};exports['addTime']=function(_0x9338d6,_0x4e437d){return moment(_0x9338d6)[_0x17ce('0x24')](_0x4e437d,_0x17ce('0x25'))[_0x17ce('0x26')](_0x17ce('0x27'));};exports[_0x17ce('0x28')]=function(_0x3ecc16,_0x2e0510){return moment(_0x3ecc16)[_0x17ce('0x29')](_0x2e0510,_0x17ce('0x25'))['format'](_0x17ce('0x27'));};exports[_0x17ce('0x2a')]=function(_0x16c1bc,_0x461420){return moment(_0x16c1bc)['diff'](moment(_0x461420),_0x17ce('0x25'));};exports['sumTime']=function(_0x232665,_0x5a0d2f){return parseInt(_0x232665,0xa)+parseInt(_0x5a0d2f,0xa);};exports['now']=function(){return moment()[_0x17ce('0x26')](_0x17ce('0x27'));};exports[_0x17ce('0x2b')]=function(_0x4f2bdf,_0x5198f3){if(_0x5198f3){return moment(_0x4f2bdf)[_0x17ce('0x2b')](_0x5198f3);}return!![];};exports[_0x17ce('0x2c')]=function(_0x49a889,_0x1babe5){if(_0x1babe5){return moment(_0x49a889)['isBefore'](_0x1babe5);}else if(_0x49a889){return!![];}return![];}; \ No newline at end of file +var _0x7370=['moment','util','client','http','../../config/logger','xdr','info','debug','error','request','then','[utils][request]\x20name:%s','inspect','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x389643,_0x2a8400){var _0x2f0aa3=function(_0x59235d){while(--_0x59235d){_0x389643['push'](_0x389643['shift']());}};_0x2f0aa3(++_0x2a8400);}(_0x7370,0x1e2));var _0x0737=function(_0x1c7ad0,_0x448315){_0x1c7ad0=_0x1c7ad0-0x0;var _0x27314b=_0x7370[_0x1c7ad0];return _0x27314b;};'use strict';var BPromise=require(_0x0737('0x0'));var jayson=require(_0x0737('0x1'));var moment=require(_0x0737('0x2'));var util=require(_0x0737('0x3'));var client=jayson[_0x0737('0x4')][_0x0737('0x5')]({'port':0x2329});var logger=require(_0x0737('0x6'))(_0x0737('0x7'));exports[_0x0737('0x8')]=function(_0x863f6c,_0x1c35fe){logger[_0x0737('0x8')](_0x863f6c,_0x1c35fe?util['inspect'](_0x1c35fe,{'showHidden':![],'depth':null}):'');};exports[_0x0737('0x9')]=function(_0xb44b81,_0x3e424a){logger[_0x0737('0x9')](_0xb44b81,_0x3e424a?util['inspect'](_0x3e424a,{'showHidden':![],'depth':null}):'');};exports[_0x0737('0xa')]=function(_0x1cff1b,_0x983a85){logger[_0x0737('0xa')](_0x1cff1b,_0x983a85?util['inspect'](_0x983a85,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x51c8ce,_0x48e355){return client[_0x0737('0xb')](_0x51c8ce,{'body':_0x48e355})[_0x0737('0xc')](function(_0x4592eb){logger[_0x0737('0x9')](_0x0737('0xd'),_0x51c8ce,_0x4592eb?util[_0x0737('0xe')](_0x4592eb,{'showHidden':![],'depth':null}):'');})[_0x0737('0xf')](function(_0x3f4bee){logger['error']('[utils][request]\x20name:%s',_0x51c8ce,_0x3f4bee?util[_0x0737('0xe')](_0x3f4bee,{'showHidden':![],'depth':null}):'');});};function getUser(_0xf72da){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0737('0x10'),_0x0737('0x11'),_0x0737('0x12')],'where':_0xf72da,'limit':0x1}})[_0x0737('0xc')](function(_0x209f9f){logger[_0x0737('0x9')](_0x0737('0x13'),JSON[_0x0737('0x14')](_0xf72da),_0x209f9f?util[_0x0737('0xe')](_0x209f9f,{'showHidden':![],'depth':null}):'');return _0x209f9f[_0x0737('0x15')]['length']?_0x209f9f[_0x0737('0x15')][0x0]:null;});}exports[_0x0737('0x16')]=function(_0x449198){return new BPromise(function(_0x17c441,_0x3bc633){if(_0x449198){return getUser({'internal':_0x449198})['then'](function(_0x2cadd2){logger['info'](_0x0737('0x17'),_0x449198,_0x2cadd2?_0x0737('0x18'):'notfound');return _0x17c441(_0x2cadd2);})[_0x0737('0xf')](function(_0x34093c){logger[_0x0737('0xa')](_0x0737('0x19'),_0x34093c?util[_0x0737('0xe')](_0x34093c,{'showHidden':![],'depth':null}):'');return _0x17c441(null);});}return _0x17c441(null);});};exports['getUserByInterface']=function(_0x3e09da){return new BPromise(function(_0x59e7be,_0xa26f5b){if(_0x3e09da){return getUser({'interface':_0x3e09da})[_0x0737('0xc')](function(_0x371f62){logger['info'](_0x0737('0x1a'),_0x3e09da,_0x371f62?_0x0737('0x18'):_0x0737('0x1b'));return _0x59e7be(_0x371f62);})[_0x0737('0xf')](function(_0x5ef450){logger[_0x0737('0xa')]('[utils][getUserByInterface]',_0x5ef450?util[_0x0737('0xe')](_0x5ef450,{'showHidden':![],'depth':null}):'');return _0x59e7be(null);});}return _0x59e7be(null);});};exports['getUserByName']=function(_0x10cf86){return new BPromise(function(_0x463874,_0x150f3f){if(_0x10cf86){return getUser({'name':_0x10cf86})[_0x0737('0xc')](function(_0x6a0f41){logger[_0x0737('0x8')](_0x0737('0x1c'),_0x10cf86,_0x6a0f41?_0x0737('0x18'):_0x0737('0x1b'));return _0x463874(_0x6a0f41);})[_0x0737('0xf')](function(_0x11f233){logger['error']('[utils][getUserByName]',_0x11f233?util['inspect'](_0x11f233,{'showHidden':![],'depth':null}):'');return _0x463874(null);});}return _0x463874(null);});};exports['getVoiceQueueByName']=function(_0x161856){return new BPromise(function(_0x4b8886,_0xef0b39){if(_0x161856){return client[_0x0737('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x0737('0x1d'),_0x0737('0x1e'),_0x0737('0x1f')],'where':{'name':_0x161856},'limit':0x1}})['then'](function(_0x458005){logger[_0x0737('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x161856,_0x458005?util['inspect'](_0x458005,{'showHidden':![],'depth':null}):'');logger['info'](_0x0737('0x20'),_0x161856,_0x458005?_0x0737('0x18'):_0x0737('0x1b'));return _0x4b8886(_0x458005[_0x0737('0x15')]['length']?_0x458005[_0x0737('0x15')][0x0]:null);})[_0x0737('0xf')](function(_0x1894dc){logger[_0x0737('0xa')]('[utils][getVoiceQueueByName]',_0x1894dc?util['inspect'](_0x1894dc,{'showHidden':![],'depth':null}):'');return _0x4b8886(null);});}return _0x4b8886(null);});};exports[_0x0737('0x21')]=function(_0xd80616,_0x60f380){return moment(_0xd80616)['add'](_0x60f380,_0x0737('0x22'))[_0x0737('0x23')](_0x0737('0x24'));};exports[_0x0737('0x25')]=function(_0x4d30f3,_0x5a6764){return moment(_0x4d30f3)[_0x0737('0x26')](_0x5a6764,'seconds')['format'](_0x0737('0x24'));};exports['diffTime']=function(_0x5c4c44,_0x26c5aa){return moment(_0x5c4c44)[_0x0737('0x27')](moment(_0x26c5aa),_0x0737('0x22'));};exports[_0x0737('0x28')]=function(_0x24e338,_0x2ff2b5){return parseInt(_0x24e338,0xa)+parseInt(_0x2ff2b5,0xa);};exports[_0x0737('0x29')]=function(){return moment()['format'](_0x0737('0x24'));};exports['isAfter']=function(_0x49faed,_0x2b9a6a){if(_0x2b9a6a){return moment(_0x49faed)[_0x0737('0x2a')](_0x2b9a6a);}return!![];};exports[_0x0737('0x2b')]=function(_0x44d3fe,_0x1c11a7){if(_0x1c11a7){return moment(_0x44d3fe)[_0x0737('0x2b')](_0x1c11a7);}else if(_0x44d3fe){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 6bc1568..3326e6e 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26b4=['statusCode','responseTime','name','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','other','agent_name','test','url','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','then','catch','user','no-user','data','timestamp','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','connection'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x26b4,0x1be));var _0x426b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x26b4[_0x82129b];return _0x2ae5dc;};var fs=require(_0x426b('0x0'));var _=require(_0x426b('0x1'));var ewinston=require(_0x426b('0x2'));var path=require(_0x426b('0x3'));var util=require(_0x426b('0x4'));var fileLogger=require(_0x426b('0x5'))[_0x426b('0x6')];var safeTemplate=require(_0x426b('0x7'))[_0x426b('0x8')];var maskSensitiveData=require(_0x426b('0x9'))[_0x426b('0xa')];function ClientSideLogger(){function _0x1c9f45(_0x17d16f){var _0xd5dc20=path['join'](_0x426b('0xb'),_0x426b('0xc'),_0x426b('0xd'));var _0x56d6bc=path[_0x426b('0xe')]('client',_0x17d16f['role']+'-'+_0x17d16f['name']);return fs['ensureDir'](path['join'](_0xd5dc20,_0x56d6bc))[_0x426b('0xf')](function(){var _0x485f64=fileLogger('client',path[_0x426b('0xe')](_0xd5dc20,_0x56d6bc));return _0x485f64;})[_0x426b('0x10')](function(_0x12a5ba){throw _0x12a5ba;});}this[_0x426b('0xc')]=function(_0x82d1ee,_0xd98b7d,_0x5128cc,_0x4b22f7){return _0x1c9f45(_0x82d1ee[_0x426b('0x11')])[_0x426b('0xf')](function(_0x57f04f){var _0x536400=_0x57f04f[_0xd98b7d];return _0x536400;})['then'](function(_0x132a48){var _0x15da36=_0x82d1ee['user']?_0x82d1ee['user']['id']:_0x426b('0x12');var _0x2c184b=_0x4b22f7[_0x426b('0x13')];var _0x3a21c0=_0x4b22f7[_0x426b('0x14')];var _0x5952b6=new Date(Number(_0x3a21c0));return _0x132a48(_0x15da36,_0x5952b6,_0x5128cc,_0x2c184b);})[_0x426b('0x10')](function(_0x1d5f17){fileLogger('client')['error'](_0x1d5f17);});};}function setupLoggers(_0x87ee72){return new Promise(function(_0x4c5077){var _0x538368=new ClientSideLogger();var _0x204705=fileLogger(_0x426b('0x15'));var _0x4493e3=fileLogger(_0x426b('0x16'));_0x87ee72[_0x426b('0x17')](_0x426b('0x18'),_0x538368);_0x87ee72['use'](ewinston[_0x426b('0x19')]({'winstonInstance':_0x204705,'meta':![],'statusLevels':!![],'msg':function(_0x20381b,_0x31bfa5){var _0x4e557d=_0x426b('0x1a');if(!_[_0x426b('0x1b')](_0x20381b['body'])){_0x4e557d+=_0x426b('0x1c');var _0x51fa87=_0x20381b[_0x426b('0x1d')];maskSensitiveData(_0x51fa87);}return safeTemplate(util['format'](_0x4e557d,_0x20381b[_0x426b('0x1e')],_0x20381b[_0x426b('0x1f')][_0x426b('0x20')]?_0x20381b[_0x426b('0x1f')][_0x426b('0x20')]:_0x20381b[_0x426b('0x21')]['remoteAddress']||_0x20381b['ip'],_0x20381b['url'],_0x31bfa5[_0x426b('0x22')],_0x31bfa5[_0x426b('0x23')],_0x20381b[_0x426b('0x11')]?_0x20381b[_0x426b('0x11')]['id']:null,_0x20381b['user']?_0x20381b[_0x426b('0x11')][_0x426b('0x24')]:null,_0x20381b[_0x426b('0x11')]?_0x20381b[_0x426b('0x11')]['role']:null,_0x51fa87?util['inspect'](_0x51fa87,![],null):''));}}));_0x87ee72[_0x426b('0x25')](ewinston[_0x426b('0x19')]({'winstonInstance':_0x4493e3,'meta':![],'statusLevels':!![],'msg':function(_0xc34bda,_0x207b37){var _0x2e8562=_0x426b('0x26');if(_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x27')]&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x28')]){_0x2e8562=_0x426b('0x29');}return util[_0x426b('0x2a')](_0x2e8562,_0xc34bda['method'],_0xc34bda['headers'][_0x426b('0x20')]?_0xc34bda['headers'][_0x426b('0x20')]:_0xc34bda[_0x426b('0x21')][_0x426b('0x2b')]||_0xc34bda['ip'],_0xc34bda['url'],_0x207b37[_0x426b('0x22')],_0x207b37[_0x426b('0x23')],_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')]['id']:null,_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')][_0x426b('0x24')]:null,_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')]['role']:null,_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x27')]?_0xc34bda[_0x426b('0x1d')]['device']:_0x426b('0x2c'),_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x28')]?_0xc34bda['body'][_0x426b('0x28')]:'',_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x2d')]?_0xc34bda[_0x426b('0x1d')][_0x426b('0x2d')]:'');},'ignoreRoute':function(_0x5992fc){var _0x322689=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x322689[_0x426b('0x2e')](_0x5992fc[_0x426b('0x2f')]);}}));return _0x4c5077();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xe78c=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','fs-extra','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','name','ensureDir','join','catch','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','logger'];(function(_0x413585,_0x3804b5){var _0x436cd3=function(_0x18caaa){while(--_0x18caaa){_0x413585['push'](_0x413585['shift']());}};_0x436cd3(++_0x3804b5);}(_0xe78c,0x16d));var _0xce78=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe78c[_0x1cc8fe];return _0x230054;};var fs=require(_0xce78('0x0'));var _=require('lodash');var ewinston=require(_0xce78('0x1'));var path=require(_0xce78('0x2'));var util=require('util');var fileLogger=require(_0xce78('0x3'))[_0xce78('0x4')];var safeTemplate=require(_0xce78('0x5'))[_0xce78('0x6')];var maskSensitiveData=require(_0xce78('0x7'))[_0xce78('0x8')];function ClientSideLogger(){function _0x2cf262(_0x397fe1){var _0x356a06=path['join'](_0xce78('0x9'),_0xce78('0xa'),_0xce78('0xb'));var _0x2c2cd3=path['join']('client',_0x397fe1['role']+'-'+_0x397fe1[_0xce78('0xc')]);return fs[_0xce78('0xd')](path[_0xce78('0xe')](_0x356a06,_0x2c2cd3))['then'](function(){var _0x43f4dc=fileLogger('client',path['join'](_0x356a06,_0x2c2cd3));return _0x43f4dc;})[_0xce78('0xf')](function(_0x4526eb){throw _0x4526eb;});}this[_0xce78('0xa')]=function(_0x460c22,_0x959310,_0x48a64b,_0x34eae5){return _0x2cf262(_0x460c22[_0xce78('0x10')])['then'](function(_0x1d58a3){var _0x5ed36c=_0x1d58a3[_0x959310];return _0x5ed36c;})[_0xce78('0x11')](function(_0x473436){var _0x399477=_0x460c22[_0xce78('0x10')]?_0x460c22[_0xce78('0x10')]['id']:_0xce78('0x12');var _0x3118b5=_0x34eae5[_0xce78('0x13')];var _0x3ce64e=_0x34eae5[_0xce78('0x14')];var _0x29927c=new Date(Number(_0x3ce64e));return _0x473436(_0x399477,_0x29927c,_0x48a64b,_0x3118b5);})[_0xce78('0xf')](function(_0xb4c677){fileLogger('client')[_0xce78('0x15')](_0xb4c677);});};}function setupLoggers(_0x3a2454){return new Promise(function(_0x37944a){var _0x1e850f=new ClientSideLogger();var _0xc3333f=fileLogger(_0xce78('0x16'));var _0x44ac6d=fileLogger(_0xce78('0x17'));_0x3a2454[_0xce78('0x18')](_0xce78('0x19'),_0x1e850f);_0x3a2454['use'](ewinston[_0xce78('0x1a')]({'winstonInstance':_0xc3333f,'meta':![],'statusLevels':!![],'msg':function(_0x15523e,_0x59f100){var _0x42f5b1=_0xce78('0x1b');if(!_[_0xce78('0x1c')](_0x15523e[_0xce78('0x1d')])){_0x42f5b1+=_0xce78('0x1e');var _0x239028=_0x15523e['body'];maskSensitiveData(_0x239028);}return safeTemplate(util[_0xce78('0x1f')](_0x42f5b1,_0x15523e[_0xce78('0x20')],_0x15523e[_0xce78('0x21')]['x-forwarded-for']?_0x15523e['headers'][_0xce78('0x22')]:_0x15523e[_0xce78('0x23')][_0xce78('0x24')]||_0x15523e['ip'],_0x15523e[_0xce78('0x25')],_0x59f100[_0xce78('0x26')],_0x59f100[_0xce78('0x27')],_0x15523e[_0xce78('0x10')]?_0x15523e['user']['id']:null,_0x15523e[_0xce78('0x10')]?_0x15523e[_0xce78('0x10')]['name']:null,_0x15523e[_0xce78('0x10')]?_0x15523e['user'][_0xce78('0x28')]:null,_0x239028?util['inspect'](_0x239028,![],null):''));}}));_0x3a2454[_0xce78('0x29')](ewinston[_0xce78('0x1a')]({'winstonInstance':_0x44ac6d,'meta':![],'statusLevels':!![],'msg':function(_0x3c48f5,_0x377588){var _0x5c22f7=_0xce78('0x2a');if(_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2b')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2c')]){_0x5c22f7=_0xce78('0x2d');}return util[_0xce78('0x1f')](_0x5c22f7,_0x3c48f5[_0xce78('0x20')],_0x3c48f5[_0xce78('0x21')][_0xce78('0x22')]?_0x3c48f5[_0xce78('0x21')]['x-forwarded-for']:_0x3c48f5[_0xce78('0x23')][_0xce78('0x24')]||_0x3c48f5['ip'],_0x3c48f5[_0xce78('0x25')],_0x377588[_0xce78('0x26')],_0x377588['responseTime'],_0x3c48f5['user']?_0x3c48f5[_0xce78('0x10')]['id']:null,_0x3c48f5[_0xce78('0x10')]?_0x3c48f5[_0xce78('0x10')][_0xce78('0xc')]:null,_0x3c48f5[_0xce78('0x10')]?_0x3c48f5[_0xce78('0x10')]['role']:null,_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5['body'][_0xce78('0x2b')]?_0x3c48f5['body']['device']:'other',_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')]['agent_id']?_0x3c48f5['body'][_0xce78('0x2c')]:'',_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2e')]?_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2e')]:'');},'ignoreRoute':function(_0x3d23a8){var _0x509d08=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x509d08[_0xce78('0x2f')](_0x3d23a8['url']);}}));return _0x37944a();});}exports[_0xce78('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 0734ac1..49c6734 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f6b=['split','locale','weekdaysShort','indexOf','slice','concat','exports','toLowerCase','clone','minutes','isBefore','startOf','day','endOf','isBetween','format','ddd','includes','max','min','domCompare','MMM','monthCompare','guess','isMoment','padStart','length','iftime','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x1f6b,0x157));var _0xb1f6=function(_0x480d79,_0x5e0204){_0x480d79=_0x480d79-0x0;var _0x4747ed=_0x1f6b[_0x480d79];return _0x4747ed;};var _=require(_0xb1f6('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xb1f6('0x1')](function(_0x28c732){return _0x28c732[_0xb1f6('0x2')];})[_0xb1f6('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb1f6('0x4');var EINVALID_DATE=_0xb1f6('0x5');function throwIfDateNotValid(_0x1326f2){if(!_0x1326f2[_0xb1f6('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2a7281){var _0x1a2e36=_0x2a7281[_0xb1f6('0x7')](':')[_0xb1f6('0x1')](function(_0x1b17f4){return parseInt(_0x1b17f4,0xa);});var _0x223ee1=_0x1a2e36[0x0];var _0x544630=_0x1a2e36[0x1];if(_0x223ee1<0x0||_0x223ee1>0x17||_0x544630<0x0||_0x544630>0x3b){throw new Error(EINVALID_DATE);}return[_0x223ee1,_0x544630];}function circularDoWInterval(_0x380586,_0x65c196){if(_0x380586===_0x65c196){return[_0x380586];}else{var _0x7100d2=moment['locale']();moment[_0xb1f6('0x8')]('en');var _0x2f161e=moment[_0xb1f6('0x9')]()[_0xb1f6('0x1')](function(_0x5f02c4){return _0x5f02c4['toLowerCase']();});moment[_0xb1f6('0x8')](_0x7100d2);var _0x1569a6=_0x2f161e[_0xb1f6('0xa')](_0x380586);var _0x255bd7=_0x2f161e[_0xb1f6('0xa')](_0x65c196);if(_0x255bd7>_0x1569a6){return _0x2f161e[_0xb1f6('0xb')](_0x1569a6,_0x255bd7+0x1);}else{var _0x46c59f=_0x2f161e[_0xb1f6('0xb')](0x0,_0x255bd7+0x1);var _0x387443=_0x2f161e[_0xb1f6('0xb')](_0x1569a6);return _0x387443[_0xb1f6('0xc')](_0x46c59f);}}}module[_0xb1f6('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x523c8b,_0x3f493d){if(_0x523c8b===_0x3f493d){return[_0x523c8b];}else{var _0xab8d9c=moment[_0xb1f6('0x8')]();moment[_0xb1f6('0x8')]('en');var _0x8c8f6c=moment['monthsShort']()[_0xb1f6('0x1')](function(_0x1a5ad){return _0x1a5ad[_0xb1f6('0xe')]();});moment[_0xb1f6('0x8')](_0xab8d9c);var _0x5042c0=_0x8c8f6c[_0xb1f6('0xa')](_0x523c8b);var _0x153b63=_0x8c8f6c[_0xb1f6('0xa')](_0x3f493d);if(_0x153b63>_0x5042c0){return _0x8c8f6c[_0xb1f6('0xb')](_0x5042c0,_0x153b63+0x1);}else{var _0x4a035c=_0x8c8f6c[_0xb1f6('0xb')](0x0,_0x153b63+0x1);var _0x5a85e3=_0x8c8f6c[_0xb1f6('0xb')](_0x5042c0);return _0x5a85e3[_0xb1f6('0xc')](_0x4a035c);}}}module[_0xb1f6('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x468aea){var _0x2e8c3e=parseInt(_0x468aea,0xa);if(_0x2e8c3e<0x1||_0x2e8c3e>0x1f){throw new Error(EINVALID_DATE);}return _0x2e8c3e;}function timeCompare(_0x1159f0,_0x2c454d,_0x346199){var _0x2d5b5d=_0x1159f0['clone']();var _0x354272=extractTime(_0x2c454d);var _0x3ad052=_0x354272[0x0];var _0x45ecb8=_0x354272[0x1];var _0x3c598e=_0x1159f0[_0xb1f6('0xf')]()['hours'](_0x3ad052)['minutes'](_0x45ecb8);throwIfDateNotValid(_0x3c598e);var _0x315716=extractTime(_0x346199);var _0x3eb9ae=_0x315716[0x0];var _0xd28393=_0x315716[0x1];var _0x52a9d0=_0x1159f0[_0xb1f6('0xf')]()['hours'](_0x3eb9ae)[_0xb1f6('0x10')](_0xd28393);throwIfDateNotValid(_0x52a9d0);if(_0x52a9d0[_0xb1f6('0x11')](_0x3c598e)){var _0x7d4734=_0x2d5b5d['clone']()[_0xb1f6('0x12')](_0xb1f6('0x13'));var _0x1d98b8=_0x2d5b5d[_0xb1f6('0xf')]()[_0xb1f6('0x14')]('day');return _0x2d5b5d[_0xb1f6('0x15')](_0x3c598e,_0x1d98b8,undefined,'[]')||_0x2d5b5d['isBetween'](_0x7d4734,_0x52a9d0,undefined,'[]');}else{return _0x2d5b5d[_0xb1f6('0x15')](_0x3c598e,_0x52a9d0,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x250a84,_0x6fe552,_0x4a4226){var _0x1b7b4a=_0x250a84['locale']('en')[_0xb1f6('0x16')](_0xb1f6('0x17'))[_0xb1f6('0xe')]();return circularDoWInterval(_0x6fe552,_0x4a4226)[_0xb1f6('0x18')](_0x1b7b4a);}module[_0xb1f6('0xd')]['dowCompare']=dowCompare;function domCompare(_0x345c7b,_0x463d1a,_0x587f24){var _0x36bb48=_0x345c7b['date']();if(_0x463d1a===_0x587f24){return _0x36bb48===_0x463d1a;}else{var _0x54fac1=_0x345c7b['daysInMonth']();var _0x407183=_0x463d1a<_0x587f24;let _0x14d2f2=![];var _0x295923=0x0;var _0x359563=0x0;if(_0x407183){_0x295923=Math[_0xb1f6('0x19')](0x1,_0x463d1a);_0x359563=Math[_0xb1f6('0x1a')](_0x587f24,_0x54fac1);_0x14d2f2=_0x36bb48>=_0x295923&&_0x36bb48<=_0x359563;}else{_0x295923=Math['min'](_0x463d1a,_0x54fac1);_0x359563=Math[_0xb1f6('0x19')](0x1,_0x587f24);_0x14d2f2=_0x36bb48>=_0x295923||_0x36bb48<=_0x359563;}return _0x14d2f2;}}module[_0xb1f6('0xd')][_0xb1f6('0x1b')]=domCompare;function monthCompare(_0x11342d,_0x5312f8,_0x1607da){var _0xdb0614=_0x11342d['locale']('en')['format'](_0xb1f6('0x1c'))[_0xb1f6('0xe')]();return circularMonthInterval(_0x5312f8,_0x1607da)[_0xb1f6('0x18')](_0xdb0614);}module['exports'][_0xb1f6('0x1d')]=monthCompare;function iftime(_0x213d6a,_0x5d8074=moment['tz'][_0xb1f6('0x1e')](),_0x1cc5ea=moment()){if(!validateRx['test'](_0x213d6a)){throw new Error(EINVALID_STRING);}else{var _0x1111b2=(moment[_0xb1f6('0x1f')](_0x1cc5ea)?_0x1cc5ea[_0xb1f6('0xf')]():moment(_0x1cc5ea))['tz'](_0x5d8074)['locale']('en');throwIfDateNotValid(_0x1111b2);var _0x3e9056=_0x213d6a['split'](',');var _0x4f2d63=_0x3e9056[0x0];var _0x425a58=_0x3e9056[0x1];var _0x2590eb=_0x3e9056[0x2];var _0x3546fb=_0x3e9056[0x3];let _0x5bc9b6=!![];if(_0x4f2d63!=='*'){var _0x4a25a3=_0x4f2d63[_0xb1f6('0x7')]('-');var _0x363ba9=_[_0xb1f6('0x20')](_0x4a25a3[0x0],0x5,'0');var _0xa7f2b4=_0x4a25a3[_0xb1f6('0x21')]===0x2?_[_0xb1f6('0x20')](_0x4a25a3[0x1],0x5,'0'):_0x363ba9;_0x5bc9b6=timeCompare(_0x1111b2,_0x363ba9,_0xa7f2b4);}let _0x59975b=!![];if(_0x425a58!=='*'){var _0x57eef7=_0x425a58['split']('-');var _0x6d8969=_0x57eef7[0x0];var _0x2f0471=_0x57eef7[_0xb1f6('0x21')]===0x2?_0x57eef7[0x1]:_0x6d8969;_0x59975b=dowCompare(_0x1111b2,_0x6d8969,_0x2f0471);}let _0x2a5974=!![];if(_0x2590eb!=='*'){var _0x4aa31e=_0x2590eb[_0xb1f6('0x7')]('-');var _0x45e575=parseDom(_0x4aa31e[0x0]);var _0x2a7d59=_0x4aa31e[_0xb1f6('0x21')]===0x2?parseDom(_0x4aa31e[0x1]):_0x45e575;_0x2a5974=domCompare(_0x1111b2,_0x45e575,_0x2a7d59);}let _0x226f65=!![];if(_0x3546fb!=='*'){var _0x31b6a4=_0x3546fb[_0xb1f6('0x7')]('-');var _0x960625=_0x31b6a4[0x0];var _0x368350=_0x31b6a4[_0xb1f6('0x21')]===0x2?_0x31b6a4[0x1]:_0x31b6a4[0x0];_0x226f65=monthCompare(_0x1111b2,_0x960625,_0x368350);}return _0x5bc9b6&&_0x59975b&&_0x2a5974&&_0x226f65;}}module[_0xb1f6('0xd')][_0xb1f6('0x22')]=iftime; \ No newline at end of file +var _0x507c=['exports','clone','minutes','hours','day','endOf','isBetween','ddd','includes','dowCompare','date','daysInMonth','max','min','format','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase'];(function(_0x16d502,_0x2ce81a){var _0x19f799=function(_0x295329){while(--_0x295329){_0x16d502['push'](_0x16d502['shift']());}};_0x19f799(++_0x2ce81a);}(_0x507c,0xd4));var _0xc507=function(_0x3f8f1b,_0x421983){_0x3f8f1b=_0x3f8f1b-0x0;var _0x25ff15=_0x507c[_0x3f8f1b];return _0x25ff15;};var _=require(_0xc507('0x0'));var moment=require(_0xc507('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0xa98782){return _0xa98782[_0xc507('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc507('0x3');var EINVALID_DATE=_0xc507('0x4');function throwIfDateNotValid(_0x4885d9){if(!_0x4885d9[_0xc507('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x564d9d){var _0x2cd9e0=_0x564d9d[_0xc507('0x6')](':')[_0xc507('0x7')](function(_0x1ce698){return parseInt(_0x1ce698,0xa);});var _0x461322=_0x2cd9e0[0x0];var _0x30742b=_0x2cd9e0[0x1];if(_0x461322<0x0||_0x461322>0x17||_0x30742b<0x0||_0x30742b>0x3b){throw new Error(EINVALID_DATE);}return[_0x461322,_0x30742b];}function circularDoWInterval(_0x591579,_0x2f4ad8){if(_0x591579===_0x2f4ad8){return[_0x591579];}else{var _0x165219=moment[_0xc507('0x8')]();moment[_0xc507('0x8')]('en');var _0x3b7085=moment[_0xc507('0x9')]()[_0xc507('0x7')](function(_0xfd9bb2){return _0xfd9bb2['toLowerCase']();});moment[_0xc507('0x8')](_0x165219);var _0x24d9b0=_0x3b7085[_0xc507('0xa')](_0x591579);var _0x2d7b36=_0x3b7085[_0xc507('0xa')](_0x2f4ad8);if(_0x2d7b36>_0x24d9b0){return _0x3b7085['slice'](_0x24d9b0,_0x2d7b36+0x1);}else{var _0x5a058d=_0x3b7085[_0xc507('0xb')](0x0,_0x2d7b36+0x1);var _0x1f6a9b=_0x3b7085[_0xc507('0xb')](_0x24d9b0);return _0x1f6a9b[_0xc507('0xc')](_0x5a058d);}}}module['exports'][_0xc507('0xd')]=circularDoWInterval;function circularMonthInterval(_0x4b76e3,_0x1819b9){if(_0x4b76e3===_0x1819b9){return[_0x4b76e3];}else{var _0x230d3f=moment[_0xc507('0x8')]();moment[_0xc507('0x8')]('en');var _0x33fa31=moment[_0xc507('0xe')]()[_0xc507('0x7')](function(_0x5d90b2){return _0x5d90b2[_0xc507('0xf')]();});moment[_0xc507('0x8')](_0x230d3f);var _0x4ef4e1=_0x33fa31['indexOf'](_0x4b76e3);var _0x28beca=_0x33fa31[_0xc507('0xa')](_0x1819b9);if(_0x28beca>_0x4ef4e1){return _0x33fa31[_0xc507('0xb')](_0x4ef4e1,_0x28beca+0x1);}else{var _0x2fa9c8=_0x33fa31['slice'](0x0,_0x28beca+0x1);var _0x1e5eae=_0x33fa31[_0xc507('0xb')](_0x4ef4e1);return _0x1e5eae[_0xc507('0xc')](_0x2fa9c8);}}}module[_0xc507('0x10')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x2b0bd2){var _0x320d38=parseInt(_0x2b0bd2,0xa);if(_0x320d38<0x1||_0x320d38>0x1f){throw new Error(EINVALID_DATE);}return _0x320d38;}function timeCompare(_0xfb4224,_0x30cac6,_0x653ad0){var _0x526417=_0xfb4224['clone']();var _0x22aa62=extractTime(_0x30cac6);var _0x19bf57=_0x22aa62[0x0];var _0x2189db=_0x22aa62[0x1];var _0x1839d9=_0xfb4224[_0xc507('0x11')]()['hours'](_0x19bf57)[_0xc507('0x12')](_0x2189db);throwIfDateNotValid(_0x1839d9);var _0x564782=extractTime(_0x653ad0);var _0x20b43d=_0x564782[0x0];var _0x404be8=_0x564782[0x1];var _0x13e5f5=_0xfb4224[_0xc507('0x11')]()[_0xc507('0x13')](_0x20b43d)[_0xc507('0x12')](_0x404be8);throwIfDateNotValid(_0x13e5f5);if(_0x13e5f5['isBefore'](_0x1839d9)){var _0x57ed59=_0x526417['clone']()['startOf'](_0xc507('0x14'));var _0x47c590=_0x526417[_0xc507('0x11')]()[_0xc507('0x15')](_0xc507('0x14'));return _0x526417['isBetween'](_0x1839d9,_0x47c590,undefined,'[]')||_0x526417['isBetween'](_0x57ed59,_0x13e5f5,undefined,'[]');}else{return _0x526417[_0xc507('0x16')](_0x1839d9,_0x13e5f5,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x71d76f,_0xd370b4,_0x39a7a6){var _0x59950b=_0x71d76f[_0xc507('0x8')]('en')['format'](_0xc507('0x17'))['toLowerCase']();return circularDoWInterval(_0xd370b4,_0x39a7a6)[_0xc507('0x18')](_0x59950b);}module['exports'][_0xc507('0x19')]=dowCompare;function domCompare(_0x379e9f,_0x42de50,_0x286848){var _0x57d05e=_0x379e9f[_0xc507('0x1a')]();if(_0x42de50===_0x286848){return _0x57d05e===_0x42de50;}else{var _0x3c6897=_0x379e9f[_0xc507('0x1b')]();var _0x17c118=_0x42de50<_0x286848;let _0x27e8ee=![];var _0x273445=0x0;var _0x42cd47=0x0;if(_0x17c118){_0x273445=Math[_0xc507('0x1c')](0x1,_0x42de50);_0x42cd47=Math[_0xc507('0x1d')](_0x286848,_0x3c6897);_0x27e8ee=_0x57d05e>=_0x273445&&_0x57d05e<=_0x42cd47;}else{_0x273445=Math['min'](_0x42de50,_0x3c6897);_0x42cd47=Math[_0xc507('0x1c')](0x1,_0x286848);_0x27e8ee=_0x57d05e>=_0x273445||_0x57d05e<=_0x42cd47;}return _0x27e8ee;}}module[_0xc507('0x10')]['domCompare']=domCompare;function monthCompare(_0x58c158,_0x57f5c4,_0x583030){var _0x17153e=_0x58c158[_0xc507('0x8')]('en')[_0xc507('0x1e')](_0xc507('0x1f'))[_0xc507('0xf')]();return circularMonthInterval(_0x57f5c4,_0x583030)[_0xc507('0x18')](_0x17153e);}module['exports'][_0xc507('0x20')]=monthCompare;function iftime(_0x56c0c2,_0xc8fb37=moment['tz']['guess'](),_0x45f709=moment()){if(!validateRx[_0xc507('0x21')](_0x56c0c2)){throw new Error(EINVALID_STRING);}else{var _0x1c56c5=(moment[_0xc507('0x22')](_0x45f709)?_0x45f709[_0xc507('0x11')]():moment(_0x45f709))['tz'](_0xc8fb37)[_0xc507('0x8')]('en');throwIfDateNotValid(_0x1c56c5);var _0x2d4368=_0x56c0c2['split'](',');var _0x22e5ba=_0x2d4368[0x0];var _0xafa267=_0x2d4368[0x1];var _0x32c877=_0x2d4368[0x2];var _0x2ed7f5=_0x2d4368[0x3];let _0x28cbc5=!![];if(_0x22e5ba!=='*'){var _0x6efbf5=_0x22e5ba[_0xc507('0x6')]('-');var _0xefb0c6=_[_0xc507('0x23')](_0x6efbf5[0x0],0x5,'0');var _0xc94e42=_0x6efbf5[_0xc507('0x24')]===0x2?_[_0xc507('0x23')](_0x6efbf5[0x1],0x5,'0'):_0xefb0c6;_0x28cbc5=timeCompare(_0x1c56c5,_0xefb0c6,_0xc94e42);}let _0x28a239=!![];if(_0xafa267!=='*'){var _0x1181aa=_0xafa267['split']('-');var _0x396493=_0x1181aa[0x0];var _0x5a1bc6=_0x1181aa[_0xc507('0x24')]===0x2?_0x1181aa[0x1]:_0x396493;_0x28a239=dowCompare(_0x1c56c5,_0x396493,_0x5a1bc6);}let _0x1c7a21=!![];if(_0x32c877!=='*'){var _0xb200b6=_0x32c877[_0xc507('0x6')]('-');var _0x4f332a=parseDom(_0xb200b6[0x0]);var _0x9e458b=_0xb200b6['length']===0x2?parseDom(_0xb200b6[0x1]):_0x4f332a;_0x1c7a21=domCompare(_0x1c56c5,_0x4f332a,_0x9e458b);}let _0x1352b9=!![];if(_0x2ed7f5!=='*'){var _0x5b6b6e=_0x2ed7f5['split']('-');var _0x438586=_0x5b6b6e[0x0];var _0x284016=_0x5b6b6e['length']===0x2?_0x5b6b6e[0x1]:_0x5b6b6e[0x0];_0x1352b9=monthCompare(_0x1c56c5,_0x438586,_0x284016);}return _0x28cbc5&&_0x28a239&&_0x1c7a21&&_0x1352b9;}}module['exports'][_0xc507('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ce9fd5e..bfc65af 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdda=['../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','path','moment','winston'];(function(_0x1b597d,_0x52d0b7){var _0x2c2e66=function(_0x20ac94){while(--_0x20ac94){_0x1b597d['push'](_0x1b597d['shift']());}};_0x2c2e66(++_0x52d0b7);}(_0xbdda,0x1eb));var _0xabdd=function(_0x3e3e19,_0x33d91c){_0x3e3e19=_0x3e3e19-0x0;var _0x163b20=_0xbdda[_0x3e3e19];return _0x163b20;};'use strict';var path=require(_0xabdd('0x0'));var util=require('util');var moment=require(_0xabdd('0x1'));var winston=require(_0xabdd('0x2'));var config=require(_0xabdd('0x3'));var debugLevel=config[_0xabdd('0x4')]?config[_0xabdd('0x4')][_0xabdd('0x5')]():_0xabdd('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xabdd('0x7'),'error':_0xabdd('0x8'),'warn':_0xabdd('0x9'),'info':_0xabdd('0xa'),'print':_0xabdd('0xb'),'success':_0xabdd('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':_0xabdd('0xd'),'silly':_0xabdd('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x56c5ed,_0x11ca6a,_0x54690e){var _0x4d48e0=_0x56c5ed||_0xabdd('0xf');return path[_0xabdd('0x10')](_0x4d48e0,util[_0xabdd('0x11')](_0xabdd('0x12'),_0x11ca6a,_0x54690e));}function formatter(_0x4a07d7,_0x25c461){_0x25c461[_0xabdd('0x13')]=_0x25c461[_0xabdd('0x13')][_0xabdd('0x14')](/@@{/g,'{{{')[_0xabdd('0x14')](/}@@/g,_0xabdd('0x15'))[_0xabdd('0x14')](/@{/g,'{{')[_0xabdd('0x14')](/}@/g,'}}');return util[_0xabdd('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xabdd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x25c461['level'][_0xabdd('0x16')](),_0x4a07d7,_0x25c461[_0xabdd('0x13')]);}function fileFormat(_0x509de9,_0x3ce657){_0x3ce657[_0xabdd('0x13')]=_0x3ce657['message'][_0xabdd('0x14')](/@@{/g,_0xabdd('0x17'))[_0xabdd('0x14')](/}@@/g,'}}}')[_0xabdd('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4ea385=_0x3ce657[_0xabdd('0x18')]&&Object[_0xabdd('0x19')](_0x3ce657[_0xabdd('0x18')])[_0xabdd('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x3ce657[_0xabdd('0x18')]):'';return util[_0xabdd('0x11')](_0xabdd('0x1b'),moment()[_0xabdd('0x11')](_0xabdd('0x1c')),_0x3ce657[_0xabdd('0x1d')][_0xabdd('0x16')](),_0x509de9,_0x3ce657[_0xabdd('0x13')],_0x4ea385);}function consoleLogger(){var _0x35722a=new winston[(_0xabdd('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xabdd('0x1f'))][(_0xabdd('0x20'))]({'level':_0xabdd('0x21'),'json':![],'formatter':function(_0x235414){return formatter('',_0x235414);}})]});return _0x35722a;}function fileLogger(_0x1234dd,_0x17e987){var _0x2deb44=new winston[(_0xabdd('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xabdd('0x1f'))][(_0xabdd('0x22'))]({'name':util['format'](_0xabdd('0x23'),_0x1234dd,'error'),'filename':getLogFileName(_0x17e987,_0x1234dd,_0xabdd('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x226fbf){return fileFormat(_0x1234dd,_0x226fbf);}}),new winston[(_0xabdd('0x1f'))][(_0xabdd('0x22'))]({'name':util[_0xabdd('0x11')](_0xabdd('0x23'),_0x1234dd,debugLevel),'filename':getLogFileName(_0x17e987,_0x1234dd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x197317){return fileFormat(_0x1234dd,_0x197317);}}),new winston[(_0xabdd('0x1f'))][(_0xabdd('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3277ac){return fileFormat(_0x1234dd,_0x3277ac);}})]});return _0x2deb44;}exports['consoleLogger']=consoleLogger;exports[_0xabdd('0x25')]=fileLogger; \ No newline at end of file +var _0x477a=['error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','bold\x20yellow','white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','length','stringify','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s'];(function(_0x580224,_0x5345e1){var _0x5d72a0=function(_0x5af0ba){while(--_0x5af0ba){_0x580224['push'](_0x580224['shift']());}};_0x5d72a0(++_0x5345e1);}(_0x477a,0x75));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xa477('0x0'));var util=require(_0xa477('0x1'));var moment=require(_0xa477('0x2'));var winston=require(_0xa477('0x3'));var config=require(_0xa477('0x4'));var debugLevel=config[_0xa477('0x5')]?config['debugLevel'][_0xa477('0x6')]():_0xa477('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0xa477('0x8'),'info':_0xa477('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0xa477('0xa'),'verbose':'bold\x20magenta','debug':_0xa477('0xb'),'silly':_0xa477('0xc')};winston[_0xa477('0xd')](XC_LOG_COLORS);function getLogFileName(_0x42694f,_0x2e4e16,_0x2f66de){var _0x3d6393=_0x42694f||_0xa477('0xe');return path[_0xa477('0xf')](_0x3d6393,util[_0xa477('0x10')]('%s-%s.log',_0x2e4e16,_0x2f66de));}function formatter(_0x49db25,_0x1ca684){_0x1ca684['message']=_0x1ca684[_0xa477('0x11')][_0xa477('0x12')](/@@{/g,'{{{')[_0xa477('0x12')](/}@@/g,_0xa477('0x13'))[_0xa477('0x12')](/@{/g,'{{')[_0xa477('0x12')](/}@/g,'}}');return util[_0xa477('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa477('0x10')](_0xa477('0x14')),_0x1ca684[_0xa477('0x15')][_0xa477('0x16')](),_0x49db25,_0x1ca684[_0xa477('0x11')]);}function fileFormat(_0x9fae4a,_0x43b2a3){_0x43b2a3[_0xa477('0x11')]=_0x43b2a3['message']['replace'](/@@{/g,_0xa477('0x17'))[_0xa477('0x12')](/}@@/g,_0xa477('0x13'))[_0xa477('0x12')](/@{/g,'{{')[_0xa477('0x12')](/}@/g,'}}');var _0x23920=_0x43b2a3['meta']&&Object[_0xa477('0x18')](_0x43b2a3['meta'])[_0xa477('0x19')]?'\x0a\x09'+JSON[_0xa477('0x1a')](_0x43b2a3[_0xa477('0x1b')]):'';return util[_0xa477('0x10')](_0xa477('0x1c'),moment()[_0xa477('0x10')](_0xa477('0x14')),_0x43b2a3[_0xa477('0x15')][_0xa477('0x16')](),_0x9fae4a,_0x43b2a3[_0xa477('0x11')],_0x23920);}function consoleLogger(){var _0x1ba715=new winston[(_0xa477('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa477('0x1e'))][(_0xa477('0x1f'))]({'level':_0xa477('0x20'),'json':![],'formatter':function(_0x55f38f){return formatter('',_0x55f38f);}})]});return _0x1ba715;}function fileLogger(_0x3a70c5,_0x40787a){var _0x43bb76=new winston[(_0xa477('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa477('0x1e'))][(_0xa477('0x21'))]({'name':util[_0xa477('0x10')](_0xa477('0x22'),_0x3a70c5,_0xa477('0x23')),'filename':getLogFileName(_0x40787a,_0x3a70c5,_0xa477('0x23')),'level':_0xa477('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2deb12){return fileFormat(_0x3a70c5,_0x2deb12);}}),new winston[(_0xa477('0x1e'))][(_0xa477('0x21'))]({'name':util['format']('%s-%s',_0x3a70c5,debugLevel),'filename':getLogFileName(_0x40787a,_0x3a70c5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d2850){return fileFormat(_0x3a70c5,_0x2d2850);}}),new winston[(_0xa477('0x1e'))][(_0xa477('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x34666f){return fileFormat(_0x3a70c5,_0x34666f);}})]});return _0x43bb76;}exports[_0xa477('0x24')]=consoleLogger;exports[_0xa477('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 36f1a75..9fda07e 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x3c2c86,_0x2088f8){var _0x3c427d=function(_0x4c4c30){while(--_0x4c4c30){_0x3c2c86['push'](_0x3c2c86['shift']());}};_0x3c427d(++_0x2088f8);}(_0xadb5,0xad));var _0x5adb=function(_0x4716e7,_0x43f0e9){_0x4716e7=_0x4716e7-0x0;var _0xa44446=_0xadb5[_0x4716e7];return _0xa44446;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x339086,_0x277574){var _0x4bedaf=function(_0x2d9829){while(--_0x2d9829){_0x339086['push'](_0x339086['shift']());}};_0x4bedaf(++_0x277574);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x0b0e[_0x3a8dc1];return _0x4b3595;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index c15610f..3a0cb74 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','replace','\x5c$&'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x5fab,0x177));var _0xb5fa=function(_0x53ff8d,_0x53b3f8){_0x53ff8d=_0x53ff8d-0x0;var _0x36ae29=_0x5fab[_0x53ff8d];return _0x36ae29;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file +var _0x66fa=['exports','replace','\x5c$&'];(function(_0x33cab0,_0x4dc044){var _0x4fbfb7=function(_0x4afd02){while(--_0x4afd02){_0x33cab0['push'](_0x33cab0['shift']());}};_0x4fbfb7(++_0x4dc044);}(_0x66fa,0x117));var _0xa66f=function(_0xcc2811,_0x105054){_0xcc2811=_0xcc2811-0x0;var _0x2e9299=_0x66fa[_0xcc2811];return _0x2e9299;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a097406..00cc115 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x54caab,_0x13105f){var _0x490ed6=function(_0x2aafdf){while(--_0x2aafdf){_0x54caab['push'](_0x54caab['shift']());}};_0x490ed6(++_0x13105f);}(_0xe605,0x92));var _0x5e60=function(_0x4322e6,_0x290bac){_0x4322e6=_0x4322e6-0x0;var _0x2d7913=_0xe605[_0x4322e6];return _0x2d7913;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x14a0,0x8e));var _0x014a=function(_0x471021,_0x500930){_0x471021=_0x471021-0x0;var _0xd02983=_0x14a0[_0x471021];return _0xd02983;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 8b40e9b..5e6cf5c 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cd7=['then','updated','Updating\x20app.json','fs-extra','root','resolve','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6cd7,0xa8));var _0x76cd=function(_0x46bfdd,_0x342b59){_0x46bfdd=_0x46bfdd-0x0;var _0x5e42c5=_0x6cd7[_0x46bfdd];return _0x5e42c5;};var fs=require(_0x76cd('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x76cd('0x1')];var APP_JSON_PATH=path[_0x76cd('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x76cd('0x3'));function setLegacyLibsNodeEnvPath(_0xc28bb7){let _0xb098a=![];if(Array[_0x76cd('0x4')](_0xc28bb7[_0x76cd('0x5')])){var _0x5e4ab4=_0xc28bb7[_0x76cd('0x5')][_0x76cd('0x6')](function(_0x11dd01){return _0x11dd01['name']===_0x76cd('0x7');});if(_0x5e4ab4>-0x1){var _0x4373f4=_0xc28bb7[_0x76cd('0x5')][_0x5e4ab4];if(typeof _0x4373f4[_0x76cd('0x8')][_0x76cd('0x9')]!==_0x76cd('0xa')){_0x4373f4['env'][_0x76cd('0x9')]=NODEPATH;_0xb098a=!![];}}return{'appConfig':_0xc28bb7,'updated':_0xb098a};}}function updateAppConfig(_0x7a244){return fs[_0x76cd('0xb')](APP_JSON_PATH)['then'](function(_0x339591){if(_0x339591){return fs['readJSON'](APP_JSON_PATH)[_0x76cd('0xc')](function(_0x229611){var _0x2f35c9=setLegacyLibsNodeEnvPath(_0x229611);if(_0x2f35c9[_0x76cd('0xd')]){_0x7a244['info'](_0x76cd('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x229611,{'spaces':0x2});}else{return Promise[_0x76cd('0x2')]();}});}else{return Promise[_0x76cd('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x905d=['fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x905d,0x150));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};var fs=require(_0xd905('0x0'));var path=require(_0xd905('0x1'));var config=require(_0xd905('0x2'));var root=config[_0xd905('0x3')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0xd905('0x4')](root,_0xd905('0x5'));function setLegacyLibsNodeEnvPath(_0x426d22){let _0x10b7ea=![];if(Array[_0xd905('0x6')](_0x426d22[_0xd905('0x7')])){var _0x400f8e=_0x426d22[_0xd905('0x7')]['findIndex'](function(_0x342a89){return _0x342a89[_0xd905('0x8')]===_0xd905('0x9');});if(_0x400f8e>-0x1){var _0x5da7be=_0x426d22[_0xd905('0x7')][_0x400f8e];if(typeof _0x5da7be[_0xd905('0xa')][_0xd905('0xb')]!==_0xd905('0xc')){_0x5da7be[_0xd905('0xa')]['NODE_PATH']=NODEPATH;_0x10b7ea=!![];}}return{'appConfig':_0x426d22,'updated':_0x10b7ea};}}function updateAppConfig(_0x252024){return fs[_0xd905('0xd')](APP_JSON_PATH)[_0xd905('0xe')](function(_0x59e6d9){if(_0x59e6d9){return fs[_0xd905('0xf')](APP_JSON_PATH)[_0xd905('0xe')](function(_0x2a8d5c){var _0x19b8a0=setLegacyLibsNodeEnvPath(_0x2a8d5c);if(_0x19b8a0[_0xd905('0x10')]){_0x252024[_0xd905('0x11')](_0xd905('0x12'));return fs[_0xd905('0x13')](APP_JSON_PATH,_0x2a8d5c,{'spaces':0x2});}else{return Promise[_0xd905('0x4')]();}});}else{return Promise[_0xd905('0x4')]();}});}module[_0xd905('0x14')]=updateAppConfig; \ No newline at end of file